From e2f28dfe495e153076f02d5283a68bea5da1b5cd Mon Sep 17 00:00:00 2001 From: Minerx117 <50767117+Minerx117@users.noreply.github.com> Date: Tue, 16 Jul 2019 15:42:14 +1200 Subject: [PATCH] source code --- .gitignore | 70 + Algo256/blake256_14round.cu | 520 + Algo256/blake256_8round.cu | 412 + Algo256/cuda_blake256_14round.cu | 408 + Algo256/cuda_blake2s.cu | 509 + Algo256/cuda_bmw256.cu | 287 + Algo256/cuda_cubehash256.cu | 226 + Algo256/cuda_groestl256.cu | 390 + Algo256/cuda_keccak256.cu | 353 + Algo256/cuda_skein256.cu | 472 + Algo256/decred.cu | 530 + Algo256/keccak256.cu | 134 + LICENSE.txt | 885 + Makefile.am | 107 + README.md | 38 +- README.txt | 403 + algos.h | 113 + api.cpp | 1015 + api/index.php | 265 + api/local-sample.php | 137 + api/websocket.htm | 130 + autogen.sh | 1 + bench.cpp | 181 + bignum.cpp | 93 + bignum.hpp | 584 + build.cmd | 4 + build.sh | 16 + ccminer.conf | 19 + ccminer.cpp | 3787 ++ ccminer.sln | 27 + ccminer.vcxproj | 450 + ccminer.vcxproj.filters | 662 + compat.h | 94 + compat/Makefile.am | 7 + compat/bignum_ssl10.hpp | 602 + compat/getopt/getopt.h | 93 + compat/getopt/getopt_long.c | 551 + compat/gettimeofday.c | 83 + compat/inttypes.h | 2 + compat/jansson/.gitignore | 3 + compat/jansson/Makefile.am | 20 + compat/jansson/configure.ac | 98 + compat/jansson/dump.c | 456 + compat/jansson/error.c | 63 + compat/jansson/hashtable.c | 360 + compat/jansson/hashtable.h | 180 + compat/jansson/jansson.h | 281 + compat/jansson/jansson_config.h | 46 + compat/jansson/jansson_config.h.in | 39 + compat/jansson/jansson_private.h | 93 + compat/jansson/jansson_private_config.h | 140 + compat/jansson/jansson_private_config.h.in | 139 + compat/jansson/load.c | 1077 + compat/jansson/memory.c | 56 + compat/jansson/pack_unpack.c | 762 + compat/jansson/strbuffer.c | 116 + compat/jansson/strbuffer.h | 33 + compat/jansson/strconv.c | 134 + compat/jansson/utf.c | 190 + compat/jansson/utf.h | 39 + compat/jansson/util.h | 15 + compat/jansson/value.c | 950 + compat/nvapi/NVAPI.url | 2 + compat/nvapi/amd64/nvapi64.lib | Bin 0 -> 493398 bytes compat/nvapi/nvHLSLExtns.h | 402 + compat/nvapi/nvHLSLExtnsInternal.h | 472 + compat/nvapi/nvShaderExtnEnums.h | 38 + compat/nvapi/nvapi.h | 11760 +++++ compat/nvapi/nvapi_ccminer.h | 370 + compat/nvapi/nvapi_lite_common.h | 541 + compat/nvapi/nvapi_lite_d3dext.h | 188 + compat/nvapi/nvapi_lite_salend.h | 816 + compat/nvapi/nvapi_lite_salstart.h | 821 + compat/nvapi/nvapi_lite_sli.h | 225 + compat/nvapi/nvapi_lite_stereo.h | 600 + compat/nvapi/nvapi_lite_surround.h | 105 + compat/nvapi/x86/nvapi.lib | Bin 0 -> 201190 bytes compat/pthreads/pthread.h | 1376 + compat/pthreads/sched.h | 183 + compat/pthreads/x64/pthreadVC2.lib | Bin 0 -> 166580 bytes compat/pthreads/x86/pthreadVC2.lib | Bin 0 -> 81328 bytes .../pthreads/x86/pthreadVC2.libkernel32.lib | Bin 0 -> 81328 bytes compat/stdbool.h | 6 + compat/sys/time.h | 11 + compat/unistd.h | 2 + compat/winansi.c | 392 + compat/winansi.h | 32 + configure.ac | 158 + configure.sh | 12 + cpuminer-config.h | 191 + cpuminer-config.h.in | 190 + crc32.c | 119 + cuda.cpp | 277 + cuda_checkhash.cu | 298 + cuda_debug.cuh | 47 + cuda_helper.h | 712 + cuda_myriadgroestl.cu | 438 + cuda_vectors.h | 633 + elist.h | 251 + hashlog.cpp | 276 + lbry/cuda_lbry_merged.cu | 884 + lbry/cuda_sha256_lbry.cu | 893 + lbry/cuda_sha512_lbry.cu | 125 + lbry/lbry.cu | 217 + lyra2/Lyra2.c | 214 + lyra2/Lyra2.h | 42 + lyra2/Sponge.c | 410 + lyra2/Sponge.h | 88 + lyra2/cuda_lyra2.cu | 436 + lyra2/cuda_lyra2_sm5.cuh | 249 + lyra2/cuda_lyra2v2.cu | 459 + lyra2/lyra2RE.cu | 209 + lyra2/lyra2REv2.cu | 218 + miner.h | 823 + myriadgroestl.cu | 140 + neoscrypt/cuda_neoscrypt.cu | 1068 + neoscrypt/neoscrypt-cpu.c | 989 + neoscrypt/neoscrypt.cu | 142 + neoscrypt/neoscrypt.h | 33 + nist5/cuda_nist5.cu | 163 + nvapi.cpp | 460 + nvml.cpp | 2067 + nvml.h | 251 + pools.conf | 30 + pools.cpp | 404 + quark/cuda_bmw512.cu | 651 + quark/cuda_keccak_skein512.cu | 908 + quark/cuda_quark.h | 34 + quark/cuda_quark_blake512.cu | 654 + quark/cuda_quark_compactionTest.cu | 326 + quark/cuda_quark_groestl512.cu | 125 + quark/cuda_quark_jh512.cu | 392 + quark/cuda_quark_keccak512.cu | 416 + quark/cuda_quark_skein512.cu | 582 + quark/groestl_functions_quad.h | 363 + quark/groestl_transf_quad.h | 114 + quark/quarkcoin.cu | 266 + qubit/qubit.cu | 172 + qubit/qubit_luffa512.cu | 841 + res/ccminer.ico | Bin 0 -> 99678 bytes res/ccminer.rc | 105 + res/resource.h | Bin 0 -> 916 bytes serialize.hpp | 861 + sia.cu | 493 + skein/skein.cu | 612 + skein/skein2.cu | 539 + skein/skein_header.h | 383 + sph/aes_helper.c | 392 + sph/blake.c | 1131 + sph/blake2b.c | 196 + sph/blake2b.h | 41 + sph/blake2s.c | 304 + sph/blake2s.h | 150 + sph/bmw.c | 957 + sph/cubehash.c | 723 + sph/echo.c | 1031 + sph/fugue.c | 1208 + sph/groestl.c | 3124 ++ sph/hamsi.c | 867 + sph/hamsi_helper.c | 39648 ++++++++++++++++ sph/haval.c | 983 + sph/haval_helper.c | 188 + sph/jh.c | 1107 + sph/keccak.c | 1824 + sph/luffa.c | 1426 + sph/md_helper.c | 346 + sph/ripemd.c | 833 + sph/sha2.c | 632 + sph/sha256_Y.c | 418 + sph/sha256_Y.h | 63 + sph/sha2big.c | 256 + sph/shabal.c | 810 + sph/shavite.c | 1764 + sph/simd.c | 1799 + sph/skein.c | 1254 + sph/sph_blake.h | 337 + sph/sph_bmw.h | 320 + sph/sph_cubehash.h | 292 + sph/sph_echo.h | 320 + sph/sph_fugue.h | 81 + sph/sph_groestl.h | 329 + sph/sph_hamsi.h | 321 + sph/sph_haval.h | 976 + sph/sph_jh.h | 290 + sph/sph_keccak.h | 293 + sph/sph_luffa.h | 296 + sph/sph_ripemd.h | 273 + sph/sph_sha2.c | 691 + sph/sph_sha2.h | 378 + sph/sph_shabal.h | 344 + sph/sph_shavite.h | 314 + sph/sph_simd.h | 309 + sph/sph_skein.h | 298 + sph/sph_streebog.h | 185 + sph/sph_types.h | 1976 + sph/sph_whirlpool.h | 216 + sph/streebog.c | 1045 + sph/sysendian.h | 140 + sph/whirlpool.c | 3480 ++ sph/yescrypt-opt.c | 1392 + sph/yescrypt-simd.c | 1380 + sph/yescrypt.h | 376 + sph/yescryptcommon.c | 365 + start.sh | 14 + stats.cpp | 164 + streebog/cuda_keccak_streebog.cu | 499 + streebog/cuda_streebog.cu | 490 + streebog/sib.cu | 240 + streebog/streebog_arrays.cuh | 310 + streebog/veltor.cu | 170 + sysinfos.cpp | 94 + uint256.h | 784 + util.cpp | 2223 + x11/c11.cu | 219 + x11/cuda_x11.h | 20 + x11/cuda_x11_aes.cuh | 256 + x11/cuda_x11_cubehash512.cu | 241 + x11/cuda_x11_cubehash_shavite_512.cu | 515 + x11/cuda_x11_echo.cu | 449 + x11/cuda_x11_shavite512.cu | 436 + x11/cuda_x11_simd512.cu | 110 + x11/cuda_x11_simd512_func.cuh | 656 + x11/cuda_x11_simd_echo512.cu | 609 + x11/x11.cu | 226 + x11/x11evo.cu | 392 + x13/cuda_hsr_sm3.cu | 139 + x13/cuda_x13_fugue512.cu | 408 + x13/cuda_x13_hamsi512.cu | 295 + x13/cuda_x13_hamsi_fugue512.cu | 795 + x13/hsr.cu | 241 + x13/sm3.c | 220 + x13/sm3.h | 109 + x13/x13.cu | 244 + x14/cuda_x14_shabal512.cu | 261 + x14/x14.cu | 254 + x15/cuda_whirlpool_tables.cuh | 105 + x15/cuda_whirlpoolx.cu | 460 + x15/cuda_x15_whirlpool.cu | 850 + x15/whirlpool.cu | 159 + x15/whirlpoolx.cu | 126 + x15/x15.cu | 267 + x17/cuda_x17_haval256.cu | 348 + x17/cuda_x17_sha512.cu | 149 + x17/x17.cu | 289 + yescrypt/cuda_yescrypt.cu | 911 + yescrypt/yescrypt.cu | 118 + 246 files changed, 158100 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Algo256/blake256_14round.cu create mode 100644 Algo256/blake256_8round.cu create mode 100644 Algo256/cuda_blake256_14round.cu create mode 100644 Algo256/cuda_blake2s.cu create mode 100644 Algo256/cuda_bmw256.cu create mode 100644 Algo256/cuda_cubehash256.cu create mode 100644 Algo256/cuda_groestl256.cu create mode 100644 Algo256/cuda_keccak256.cu create mode 100644 Algo256/cuda_skein256.cu create mode 100644 Algo256/decred.cu create mode 100644 Algo256/keccak256.cu create mode 100644 LICENSE.txt create mode 100644 Makefile.am create mode 100644 README.txt create mode 100644 algos.h create mode 100644 api.cpp create mode 100644 api/index.php create mode 100644 api/local-sample.php create mode 100644 api/websocket.htm create mode 100644 autogen.sh create mode 100644 bench.cpp create mode 100644 bignum.cpp create mode 100644 bignum.hpp create mode 100644 build.cmd create mode 100644 build.sh create mode 100644 ccminer.conf create mode 100644 ccminer.cpp create mode 100644 ccminer.sln create mode 100644 ccminer.vcxproj create mode 100644 ccminer.vcxproj.filters create mode 100644 compat.h create mode 100644 compat/Makefile.am create mode 100644 compat/bignum_ssl10.hpp create mode 100644 compat/getopt/getopt.h create mode 100644 compat/getopt/getopt_long.c create mode 100644 compat/gettimeofday.c create mode 100644 compat/inttypes.h create mode 100644 compat/jansson/.gitignore create mode 100644 compat/jansson/Makefile.am create mode 100644 compat/jansson/configure.ac create mode 100644 compat/jansson/dump.c create mode 100644 compat/jansson/error.c create mode 100644 compat/jansson/hashtable.c create mode 100644 compat/jansson/hashtable.h create mode 100644 compat/jansson/jansson.h create mode 100644 compat/jansson/jansson_config.h create mode 100644 compat/jansson/jansson_config.h.in create mode 100644 compat/jansson/jansson_private.h create mode 100644 compat/jansson/jansson_private_config.h create mode 100644 compat/jansson/jansson_private_config.h.in create mode 100644 compat/jansson/load.c create mode 100644 compat/jansson/memory.c create mode 100644 compat/jansson/pack_unpack.c create mode 100644 compat/jansson/strbuffer.c create mode 100644 compat/jansson/strbuffer.h create mode 100644 compat/jansson/strconv.c create mode 100644 compat/jansson/utf.c create mode 100644 compat/jansson/utf.h create mode 100644 compat/jansson/util.h create mode 100644 compat/jansson/value.c create mode 100644 compat/nvapi/NVAPI.url create mode 100644 compat/nvapi/amd64/nvapi64.lib create mode 100644 compat/nvapi/nvHLSLExtns.h create mode 100644 compat/nvapi/nvHLSLExtnsInternal.h create mode 100644 compat/nvapi/nvShaderExtnEnums.h create mode 100644 compat/nvapi/nvapi.h create mode 100644 compat/nvapi/nvapi_ccminer.h create mode 100644 compat/nvapi/nvapi_lite_common.h create mode 100644 compat/nvapi/nvapi_lite_d3dext.h create mode 100644 compat/nvapi/nvapi_lite_salend.h create mode 100644 compat/nvapi/nvapi_lite_salstart.h create mode 100644 compat/nvapi/nvapi_lite_sli.h create mode 100644 compat/nvapi/nvapi_lite_stereo.h create mode 100644 compat/nvapi/nvapi_lite_surround.h create mode 100644 compat/nvapi/x86/nvapi.lib create mode 100644 compat/pthreads/pthread.h create mode 100644 compat/pthreads/sched.h create mode 100644 compat/pthreads/x64/pthreadVC2.lib create mode 100644 compat/pthreads/x86/pthreadVC2.lib create mode 100644 compat/pthreads/x86/pthreadVC2.libkernel32.lib create mode 100644 compat/stdbool.h create mode 100644 compat/sys/time.h create mode 100644 compat/unistd.h create mode 100644 compat/winansi.c create mode 100644 compat/winansi.h create mode 100644 configure.ac create mode 100644 configure.sh create mode 100644 cpuminer-config.h create mode 100644 cpuminer-config.h.in create mode 100644 crc32.c create mode 100644 cuda.cpp create mode 100644 cuda_checkhash.cu create mode 100644 cuda_debug.cuh create mode 100644 cuda_helper.h create mode 100644 cuda_myriadgroestl.cu create mode 100644 cuda_vectors.h create mode 100644 elist.h create mode 100644 hashlog.cpp create mode 100644 lbry/cuda_lbry_merged.cu create mode 100644 lbry/cuda_sha256_lbry.cu create mode 100644 lbry/cuda_sha512_lbry.cu create mode 100644 lbry/lbry.cu create mode 100644 lyra2/Lyra2.c create mode 100644 lyra2/Lyra2.h create mode 100644 lyra2/Sponge.c create mode 100644 lyra2/Sponge.h create mode 100644 lyra2/cuda_lyra2.cu create mode 100644 lyra2/cuda_lyra2_sm5.cuh create mode 100644 lyra2/cuda_lyra2v2.cu create mode 100644 lyra2/lyra2RE.cu create mode 100644 lyra2/lyra2REv2.cu create mode 100644 miner.h create mode 100644 myriadgroestl.cu create mode 100644 neoscrypt/cuda_neoscrypt.cu create mode 100644 neoscrypt/neoscrypt-cpu.c create mode 100644 neoscrypt/neoscrypt.cu create mode 100644 neoscrypt/neoscrypt.h create mode 100644 nist5/cuda_nist5.cu create mode 100644 nvapi.cpp create mode 100644 nvml.cpp create mode 100644 nvml.h create mode 100644 pools.conf create mode 100644 pools.cpp create mode 100644 quark/cuda_bmw512.cu create mode 100644 quark/cuda_keccak_skein512.cu create mode 100644 quark/cuda_quark.h create mode 100644 quark/cuda_quark_blake512.cu create mode 100644 quark/cuda_quark_compactionTest.cu create mode 100644 quark/cuda_quark_groestl512.cu create mode 100644 quark/cuda_quark_jh512.cu create mode 100644 quark/cuda_quark_keccak512.cu create mode 100644 quark/cuda_quark_skein512.cu create mode 100644 quark/groestl_functions_quad.h create mode 100644 quark/groestl_transf_quad.h create mode 100644 quark/quarkcoin.cu create mode 100644 qubit/qubit.cu create mode 100644 qubit/qubit_luffa512.cu create mode 100644 res/ccminer.ico create mode 100644 res/ccminer.rc create mode 100644 res/resource.h create mode 100644 serialize.hpp create mode 100644 sia.cu create mode 100644 skein/skein.cu create mode 100644 skein/skein2.cu create mode 100644 skein/skein_header.h create mode 100644 sph/aes_helper.c create mode 100644 sph/blake.c create mode 100644 sph/blake2b.c create mode 100644 sph/blake2b.h create mode 100644 sph/blake2s.c create mode 100644 sph/blake2s.h create mode 100644 sph/bmw.c create mode 100644 sph/cubehash.c create mode 100644 sph/echo.c create mode 100644 sph/fugue.c create mode 100644 sph/groestl.c create mode 100644 sph/hamsi.c create mode 100644 sph/hamsi_helper.c create mode 100644 sph/haval.c create mode 100644 sph/haval_helper.c create mode 100644 sph/jh.c create mode 100644 sph/keccak.c create mode 100644 sph/luffa.c create mode 100644 sph/md_helper.c create mode 100644 sph/ripemd.c create mode 100644 sph/sha2.c create mode 100644 sph/sha256_Y.c create mode 100644 sph/sha256_Y.h create mode 100644 sph/sha2big.c create mode 100644 sph/shabal.c create mode 100644 sph/shavite.c create mode 100644 sph/simd.c create mode 100644 sph/skein.c create mode 100644 sph/sph_blake.h create mode 100644 sph/sph_bmw.h create mode 100644 sph/sph_cubehash.h create mode 100644 sph/sph_echo.h create mode 100644 sph/sph_fugue.h create mode 100644 sph/sph_groestl.h create mode 100644 sph/sph_hamsi.h create mode 100644 sph/sph_haval.h create mode 100644 sph/sph_jh.h create mode 100644 sph/sph_keccak.h create mode 100644 sph/sph_luffa.h create mode 100644 sph/sph_ripemd.h create mode 100644 sph/sph_sha2.c create mode 100644 sph/sph_sha2.h create mode 100644 sph/sph_shabal.h create mode 100644 sph/sph_shavite.h create mode 100644 sph/sph_simd.h create mode 100644 sph/sph_skein.h create mode 100644 sph/sph_streebog.h create mode 100644 sph/sph_types.h create mode 100644 sph/sph_whirlpool.h create mode 100644 sph/streebog.c create mode 100644 sph/sysendian.h create mode 100644 sph/whirlpool.c create mode 100644 sph/yescrypt-opt.c create mode 100644 sph/yescrypt-simd.c create mode 100644 sph/yescrypt.h create mode 100644 sph/yescryptcommon.c create mode 100644 start.sh create mode 100644 stats.cpp create mode 100644 streebog/cuda_keccak_streebog.cu create mode 100644 streebog/cuda_streebog.cu create mode 100644 streebog/sib.cu create mode 100644 streebog/streebog_arrays.cuh create mode 100644 streebog/veltor.cu create mode 100644 sysinfos.cpp create mode 100644 uint256.h create mode 100644 util.cpp create mode 100644 x11/c11.cu create mode 100644 x11/cuda_x11.h create mode 100644 x11/cuda_x11_aes.cuh create mode 100644 x11/cuda_x11_cubehash512.cu create mode 100644 x11/cuda_x11_cubehash_shavite_512.cu create mode 100644 x11/cuda_x11_echo.cu create mode 100644 x11/cuda_x11_shavite512.cu create mode 100644 x11/cuda_x11_simd512.cu create mode 100644 x11/cuda_x11_simd512_func.cuh create mode 100644 x11/cuda_x11_simd_echo512.cu create mode 100644 x11/x11.cu create mode 100644 x11/x11evo.cu create mode 100644 x13/cuda_hsr_sm3.cu create mode 100644 x13/cuda_x13_fugue512.cu create mode 100644 x13/cuda_x13_hamsi512.cu create mode 100644 x13/cuda_x13_hamsi_fugue512.cu create mode 100644 x13/hsr.cu create mode 100644 x13/sm3.c create mode 100644 x13/sm3.h create mode 100644 x13/x13.cu create mode 100644 x14/cuda_x14_shabal512.cu create mode 100644 x14/x14.cu create mode 100644 x15/cuda_whirlpool_tables.cuh create mode 100644 x15/cuda_whirlpoolx.cu create mode 100644 x15/cuda_x15_whirlpool.cu create mode 100644 x15/whirlpool.cu create mode 100644 x15/whirlpoolx.cu create mode 100644 x15/x15.cu create mode 100644 x17/cuda_x17_haval256.cu create mode 100644 x17/cuda_x17_sha512.cu create mode 100644 x17/x17.cu create mode 100644 yescrypt/cuda_yescrypt.cu create mode 100644 yescrypt/yescrypt.cu diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..43042b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,70 @@ + +ccminer +*.o + +autom4te.cache +.deps + +Makefile +Makefile.in +INSTALL +aclocal.m4 +configure +configure.lineno +depcomp +missing +install-sh +stamp-h1 +ccminer-config.h* +compile +config.log +config.status +config.status.lineno +config.guess +config.sub + +mingw32-config.cache + +*/.dirstamp +.DS_Store +Desktop.ini +Thumbs.db + +*.iml + +Debug/ +Release/ +x64/Debug/ +x64/Release/ +*.suo +*.user +*.opensdf +*.sdf +*.pdb +*.VC.opendb +*.VC.db + +.settings/ +.project +.metadata +.classpath +.loadpath +.cproject +.buildpath + +compat/curl-for-windows/ + +*.ptx +*.i +*.ii +*.gpu +*.cubin +*.stub.c +*.module_id +*.hash +*.fatbin.c +*.fatbin +*.cudafe1.cpp +*.cudafe1.c +*.cudafe2.c + diff --git a/Algo256/blake256_14round.cu b/Algo256/blake256_14round.cu new file mode 100644 index 0000000..e0e0694 --- /dev/null +++ b/Algo256/blake256_14round.cu @@ -0,0 +1,520 @@ +/** + * 14-round Blake-256 Cuda Kernel (Tested on SM 5.2) for SaffronCoin + * Provos Alexis - April 2016 + * + * Based on blake256 ccminer implementation of + * Tanguy Pruvot / SP - Jan 2016 + * + * Previous implementation under cuda7.5: + * ccminer 1.8.2 on ASUS Strix 970: 1415.00MH/s - 1265MHz / intensity 31 + * ccminer 1.8.2 on GB windforce 750ti OC: 574.30MH/s - 1320MHz / intensity 30 + * + * Further improved under CUDA 7.5 + * ASUS Strix 970: 1556.6MH/s - 1252MHz / intensity 31 + * GB windforce 750ti OC: 616MH/s - 1320MHz / intensity 30 + */ + +#include +#include + +#include "miner.h" + +extern "C" { +#include "sph/sph_blake.h" +} + +/* threads per block and nonces per thread */ +#define TPB 768 +#define NPT 192 +#define maxResults 16 +/* max count of found nonces in one call */ +#define NBN 2 + +/* hash by cpu with blake 256 */ +extern "C" void blake256_14roundHash(void *output, const void *input) +{ + uchar hash[64]; + sph_blake256_context ctx; + + sph_blake256_set_rounds(14); + + sph_blake256_init(&ctx); + sph_blake256(&ctx, input, 80); + sph_blake256_close(&ctx, hash); + + memcpy(output, hash, 32); +} + +#include "cuda_helper.h" + +#ifdef __INTELLISENSE__ +#define __byte_perm(x, y, b) x +#endif + +__constant__ uint32_t _ALIGN(32) c_v[16]; +__constant__ uint32_t _ALIGN(8) c_h[ 2]; +__constant__ uint32_t c_m[ 3]; +__constant__ uint32_t _ALIGN(32) c_x[90]; + +/* 8 adapters max */ +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +#define GSn(a,b,c,d,x,y) { \ + v[a]+= x + v[b]; \ + v[d] = ROL16(v[d] ^ v[a]); \ + v[c]+= v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 12); \ + v[a]+= y + v[b]; \ + v[d] = ROR8(v[d] ^ v[a]); \ + v[c]+= v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 7); \ +} + +#define GSn4(a,b,c,d,x,y,a1,b1,c1,d1,x1,y1,a2,b2,c2,d2,x2,y2,a3,b3,c3,d3,x3,y3) { \ + v[ a]+= x + v[ b]; v[a1]+= x1 + v[b1]; v[a2]+= x2 + v[b2]; v[a3]+= x3 + v[b3]; \ + v[ d] = ROL16(v[ d] ^ v[ a]); v[d1] = ROL16(v[d1] ^ v[a1]); v[d2] = ROL16(v[d2] ^ v[a2]); v[d3] = ROL16(v[d3] ^ v[a3]); \ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; v[c3]+= v[d3]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 12); v[b1] = ROTR32(v[b1] ^ v[c1], 12); v[b2] = ROTR32(v[b2] ^ v[c2], 12); v[b3] = ROTR32(v[b3] ^ v[c3], 12); \ + v[ a]+= y + v[ b]; v[a1]+= y1 + v[b1]; v[a2]+= y2 + v[b2]; v[a3]+= y3 + v[b3]; \ + v[ d] = ROR8(v[ d] ^ v[ a]); v[d1] = ROR8(v[d1] ^ v[a1]); v[d2] = ROR8(v[d2] ^ v[a2]); v[d3] = ROR8(v[d3] ^ v[a3]); \ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; v[c3]+= v[d3]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 7); v[b1] = ROTR32(v[b1] ^ v[c1], 7); v[b2] = ROTR32(v[b2] ^ v[c2], 7); v[b3] = ROTR32(v[b3] ^ v[c3], 7); \ +} + +#define GSn3(a,b,c,d,x,y,a1,b1,c1,d1,x1,y1,a2,b2,c2,d2,x2,y2) { \ + v[ a]+= x + v[ b]; v[a1]+= x1 + v[b1]; v[a2]+= x2 + v[b2];\ + v[ d] = ROL16(v[ d] ^ v[ a]); v[d1] = ROL16(v[d1] ^ v[a1]); v[d2] = ROL16(v[d2] ^ v[a2]);\ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2];\ + v[ b] = ROTR32(v[ b] ^ v[ c], 12); v[b1] = ROTR32(v[b1] ^ v[c1], 12); v[b2] = ROTR32(v[b2] ^ v[c2], 12);\ + v[ a]+= y + v[ b]; v[a1]+= y1 + v[b1]; v[a2]+= y2 + v[b2];\ + v[ d] = ROR8(v[ d] ^ v[ a]); v[d1] = ROR8(v[d1] ^ v[a1]); v[d2] = ROR8(v[d2] ^ v[a2]);\ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2];\ + v[ b] = ROTR32(v[ b] ^ v[ c], 7); v[b1] = ROTR32(v[b1] ^ v[c1], 7); v[b2] = ROTR32(v[b2] ^ v[c2], 7);\ +} + +#define hostGS(a,b,c,d,x,y) { \ + v[a] += (m[x] ^ z[y]) + v[b]; \ + v[d] = ROTR32(v[d] ^ v[a], 16); \ + v[c] += v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 12); \ + v[a] += (m[y] ^ z[x]) + v[b]; \ + v[d] = ROTR32(v[d] ^ v[a], 8); \ + v[c] += v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 7); \ +} + +__global__ __launch_bounds__(TPB,1) +void blake256_14round_gpu_hash_16(const uint32_t threads,const uint32_t startNonce, uint32_t *resNonce){ + + uint64_t m3 = startNonce + blockDim.x * blockIdx.x + threadIdx.x; + const uint32_t step = gridDim.x * blockDim.x; + const uint64_t maxNonce = startNonce + threads; + + const uint32_t z[16] = { + 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, + 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917 + }; + + uint32_t v[16]; + uint32_t m[16]; + + #pragma unroll + for(int i=0;i<3;i++){ + m[i] = c_m[i]; + } + m[13] = 1; + m[15] = 640; + + const uint32_t m130 = z[12]^m[13]; + const uint32_t m131 = m[13]^z[ 6]; + const uint32_t m132 = z[15]^m[13]; + const uint32_t m133 = z[ 3]^m[13]; + const uint32_t m134 = z[ 4]^m[13]; + const uint32_t m135 = z[14]^m[13]; + const uint32_t m136 = m[13]^z[11]; + const uint32_t m137 = m[13]^z[ 7]; + const uint32_t m138 = m[13]^z[ 0]; + + volatile uint32_t m150 = z[14]^m[15]; + volatile uint32_t m151 = z[ 9]^m[15]; + volatile uint32_t m152 = m[15]^z[13]; + volatile uint32_t m153 = m[15]^z[ 8]; + const uint32_t m154 = z[10]^m[15]; + const uint32_t m155 = z[ 1]^m[15]; + const uint32_t m156 = m[15]^z[ 4]; + const uint32_t m157 = z[ 6]^m[15]; + const uint32_t m158 = m[15]^z[11]; + + const uint32_t h7 = c_h[ 0]; + + for( ; m3data; + uint32_t *ptarget = work->target; + + const uint32_t first_nonce = pdata[19]; + + int dev_id = device_map[thr_id]; + int intensity = (device_sm[dev_id] > 500) ? 31 : 30; + + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + const dim3 grid((throughput + (NPT*TPB)-1)/(NPT*TPB)); + const dim3 block(TPB); + + int rc = 0; + + if (opt_benchmark) { + ptarget[6] = swab32(0xff); + } + + if (!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage (linux) + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], maxResults * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(maxResults * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + CUDA_LOG_ERROR(); + init[thr_id] = true; + } + + uint32_t _ALIGN(64) endiandata[20]; + + for (int k = 0; k < 19; k++) + be32enc(&endiandata[k], pdata[k]); + + blake256_14round_cpu_setBlock_16(&pdata[16], endiandata); + cudaMemset(d_resNonce[thr_id], 0x00, maxResults*sizeof(uint32_t)); + do { + // GPU HASH + blake256_14round_gpu_hash_16<<>>(throughput, pdata[19], d_resNonce[thr_id]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != 0){ + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], maxResults*sizeof(uint32_t), cudaMemcpyDeviceToHost); + cudaMemset(d_resNonce[thr_id], 0x00, sizeof(uint32_t)); + if(h_resNonce[thr_id][0]>(maxResults-1)){ + gpulog(LOG_WARNING,dev_id,"Candidate flood: %u",h_resNonce[thr_id][0]); + h_resNonce[thr_id][0]=maxResults-1; + } + uint32_t i; + for(i=1;i work->shareratio[0]) { + work_set_target_ratio(work, vhashcpu); + xchg(pdata[21], pdata[19]); + } + rc = 2; + break; + } + } + return rc; + } + } + } + + pdata[19] += throughput; + + } while (!work_restart[thr_id].restart && (uint64_t)max_nonce > (uint64_t)throughput + pdata[19]); + + *hashes_done = pdata[19] - first_nonce; + + return rc; +} + +// cleanup +extern "C" void free_blake256_14round(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} + diff --git a/Algo256/blake256_8round.cu b/Algo256/blake256_8round.cu new file mode 100644 index 0000000..4149fd2 --- /dev/null +++ b/Algo256/blake256_8round.cu @@ -0,0 +1,412 @@ +/** + * Blake-256 Cuda Kernel (Tested on SM 5/5.2) + * Tanguy Pruvot / SP - Jan 2016 + * + * Provos Alexis (Tested on SM5.2) - Jan. 2016 + * Reviewed by tpruvot - Feb 2016 + * + * Fixed CUDA 7.5 flaw + * minor code changes + * code cleanup + * replaced SSE2 midstate computation with SPH + * Provos Alexis - Mar 2016 + * + * Minor boost + * Provos Alexis - Apr 2016 + */ + +#include +#include + +#include "miner.h" + +extern "C" { +#include "sph/sph_blake.h" +} + +#include "cuda_helper.h" + +#ifdef __INTELLISENSE__ +#define __byte_perm(x, y, b) x +#endif + +/* threads per block and nonces per thread */ +#define TPB 768 +#define NPT 384 +#define maxResults 8 + +__constant__ uint32_t _ALIGN(16) c_data[20]; + +/* 8 adapters max */ +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +/* hash by cpu with blake 256 */ +extern "C" void blake256_8roundHash(void *output, const void *input){ + uchar hash[64]; + sph_blake256_context ctx; + + sph_blake256_set_rounds(8); + + sph_blake256_init(&ctx); + sph_blake256(&ctx, input, 80); + sph_blake256_close(&ctx, hash); + + memcpy(output, hash, 32); +} + +#define GSn4(a,b,c,d,x,y,a1,b1,c1,d1,x1,y1,a2,b2,c2,d2,x2,y2,a3,b3,c3,d3,x3,y3) { \ + v[ a] = v[ a] + v[ b] + x; v[a1] = v[a1] + v[b1] + x1; v[a2] = v[a2] + v[b2] + x2; v[a3] = v[a3] + v[b3] + x3;\ + v[ d] = ROL16(v[ d] ^ v[ a]); v[d1] = ROL16(v[d1] ^ v[a1]); v[d2] = ROL16(v[d2] ^ v[a2]); v[d3] = ROL16(v[d3] ^ v[a3]); \ + v[ c] = v[ c] + v[ d]; v[c1] = v[c1] + v[d1]; v[c2] = v[c2] + v[d2]; v[c3] = v[c3] + v[d3]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 12); v[b1] = ROTR32(v[b1] ^ v[c1], 12); v[b2] = ROTR32(v[b2] ^ v[c2], 12); v[b3] = ROTR32(v[b3] ^ v[c3], 12); \ + v[ a] = v[ a] + v[ b] + y; v[a1] = v[a1] + v[b1] + y1; v[a2] = v[a2] + v[b2] + y2; v[a3] = v[a3] + v[b3] + y3; \ + v[ d] = ROR8(v[ d] ^ v[ a]); v[d1] = ROR8(v[d1] ^ v[a1]); v[d2] = ROR8(v[d2] ^ v[a2]); v[d3] = ROR8(v[d3] ^ v[a3]); \ + v[ c] = v[ c] + v[ d]; v[c1] = v[c1] + v[d1]; v[c2] = v[c2] + v[d2]; v[c3] = v[c3] + v[d3]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 7); v[b1] = ROTR32(v[b1] ^ v[c1], 7); v[b2] = ROTR32(v[b2] ^ v[c2], 7); v[b3] = ROTR32(v[b3] ^ v[c3], 7); \ +} + +#define GS(a,b,c,d,x,y) { \ + v[a] += (m[x] ^ z[y]) + v[b]; \ + v[d] = ROL16(v[d] ^ v[a]); \ + v[c] += v[d]; \ + v[b] = ROTR32(v[b] ^ v[c],12); \ + v[a] += (m[y] ^ z[x]) + v[b]; \ + v[d] = ROR8(v[d] ^ v[a]); \ + v[c] += v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 7); \ +} + +__global__ __launch_bounds__(TPB) +void blake256_8round_gpu_hash(const uint32_t threads, const uint32_t startNonce, uint32_t *resNonce){ + uint64_t m3 = startNonce + blockDim.x * blockIdx.x + threadIdx.x; + const uint64_t step = gridDim.x * blockDim.x; + const uint64_t maxNonce = startNonce + threads; + + uint32_t v[16]; + uint32_t z[16] = { + 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, + 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917 + }; + + uint32_t m[16] = { + c_data[16], c_data[17], c_data[18], 0, 0x80000000, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 640 + }; + + uint32_t h7 = c_data[19]; + + uint32_t xors[16]; + for(; m3data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + int dev_id = device_map[thr_id]; + + int intensity = 31; + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (!init[thr_id]) { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage (linux) + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], maxResults * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(maxResults * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + CUDA_LOG_ERROR(); + + init[thr_id] = true; + } + + uint32_t _ALIGN(64) endiandata[20]; + + for (int k=0; k < 19; k++) + be32enc(&endiandata[k], pdata[k]); + + blake256_8round_cpu_setBlock_16(thr_id,endiandata,&pdata[16]); + + const dim3 grid((throughput + (NPT*TPB)-1)/(NPT*TPB)); + const dim3 block(TPB); + int rc = 0; + cudaMemset(d_resNonce[thr_id], 0x00, maxResults*sizeof(uint32_t)); + do { + blake256_8round_gpu_hash<<>>(throughput, pdata[19], d_resNonce[thr_id]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], sizeof(uint32_t), cudaMemcpyDeviceToHost); + if (h_resNonce[thr_id][0] != 0){ + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], maxResults*sizeof(uint32_t), cudaMemcpyDeviceToHost); + cudaMemset(d_resNonce[thr_id], 0x00, sizeof(uint32_t)); + if(h_resNonce[thr_id][0]>(maxResults-1)){ + gpulog(LOG_WARNING,dev_id,"Candidate flood: %u",h_resNonce[thr_id][0]); + h_resNonce[thr_id][0]=maxResults-1; + } + uint32_t i; + for(i=1;i work->shareratio[0]) { + work_set_target_ratio(work, vhashcpu); + xchg(pdata[21], pdata[19]); + } + rc=2; + break; + } + } + return rc; + } + } + } + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > ((uint64_t)(pdata[19]) + (uint64_t)throughput))); + + *hashes_done = pdata[19] - first_nonce; + + return rc; +} + +// cleanup +extern "C" void free_blake256_8round(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/Algo256/cuda_blake256_14round.cu b/Algo256/cuda_blake256_14round.cu new file mode 100644 index 0000000..d662cb4 --- /dev/null +++ b/Algo256/cuda_blake256_14round.cu @@ -0,0 +1,408 @@ +/** + * Blake-256 Cuda Kernel (Tested on SM 5.2) + * + * Based upon Tanguy Pruvot - Nov. 2014 + * Provos Alexis - Apr. 2016 + */ + +extern "C" { +#include "sph/sph_blake.h" +} + +#include "cuda_helper.h" +#include "miner.h" +#include + +#define TPB 768 + +static const uint32_t c_IV256[8] = { + 0x6A09E667, 0xBB67AE85, + 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, + 0x1F83D9AB, 0x5BE0CD19 +}; + +__device__ __constant__ uint32_t _ALIGN(16) c_h[ 8]; +__device__ __constant__ uint32_t _ALIGN(16) c_v[16]; +__device__ __constant__ uint32_t _ALIGN(16) c_m[16]; +__device__ __constant__ uint32_t _ALIGN(16) c_x[60]; + +#define GSn(a,b,c,d,x,y) { \ + v[a]+= x + v[b]; \ + v[d] = ROL16(v[d] ^ v[a]); \ + v[c]+= v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 12); \ + v[a]+= y + v[b]; \ + v[d] = ROR8(v[d] ^ v[a]); \ + v[c]+= v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 7); \ +} + +#define GSn4(a,b,c,d,x,y,a1,b1,c1,d1,x1,y1,a2,b2,c2,d2,x2,y2,a3,b3,c3,d3,x3,y3) { \ + v[ a]+= x + v[ b]; v[a1]+= x1 + v[b1]; v[a2]+= x2 + v[b2]; v[a3]+= x3 + v[b3]; \ + v[ d] = ROL16(v[ d] ^ v[ a]); v[d1] = ROL16(v[d1] ^ v[a1]); v[d2] = ROL16(v[d2] ^ v[a2]); v[d3] = ROL16(v[d3] ^ v[a3]); \ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; v[c3]+= v[d3]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 12); v[b1] = ROTR32(v[b1] ^ v[c1], 12); v[b2] = ROTR32(v[b2] ^ v[c2], 12); v[b3] = ROTR32(v[b3] ^ v[c3], 12); \ + v[ a]+= y + v[ b]; v[a1]+= y1 + v[b1]; v[a2]+= y2 + v[b2]; v[a3]+= y3 + v[b3]; \ + v[ d] = ROR8(v[ d] ^ v[ a]); v[d1] = ROR8(v[d1] ^ v[a1]); v[d2] = ROR8(v[d2] ^ v[a2]); v[d3] = ROR8(v[d3] ^ v[a3]); \ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; v[c3]+= v[d3]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 7); v[b1] = ROTR32(v[b1] ^ v[c1], 7); v[b2] = ROTR32(v[b2] ^ v[c2], 7); v[b3] = ROTR32(v[b3] ^ v[c3], 7); \ +} + +#define GSn3(a,b,c,d,x,y,a1,b1,c1,d1,x1,y1,a2,b2,c2,d2,x2,y2) { \ + v[ a]+= x + v[ b]; v[a1]+= x1 + v[b1]; v[a2]+= x2 + v[b2];\ + v[ d] = ROL16(v[ d] ^ v[ a]); v[d1] = ROL16(v[d1] ^ v[a1]); v[d2] = ROL16(v[d2] ^ v[a2]);\ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2];\ + v[ b] = ROTR32(v[ b] ^ v[ c], 12); v[b1] = ROTR32(v[b1] ^ v[c1], 12); v[b2] = ROTR32(v[b2] ^ v[c2], 12);\ + v[ a]+= y + v[ b]; v[a1]+= y1 + v[b1]; v[a2]+= y2 + v[b2];\ + v[ d] = ROR8(v[ d] ^ v[ a]); v[d1] = ROR8(v[d1] ^ v[a1]); v[d2] = ROR8(v[d2] ^ v[a2]);\ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2];\ + v[ b] = ROTR32(v[ b] ^ v[ c], 7); v[b1] = ROTR32(v[b1] ^ v[c1], 7); v[b2] = ROTR32(v[b2] ^ v[c2], 7);\ +} + +#define hostGS(a,b,c,d,x) { \ + const uint32_t idx1 = c_sigma[r][x]; \ + const uint32_t idx2 = c_sigma[r][x+1]; \ + v[a] += (m[idx1] ^ z[idx2]) + v[b]; \ + v[d] = ROTR32(v[d] ^ v[a], 16); \ + v[c] += v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 12); \ +\ + v[a] += (m[idx2] ^ z[idx1]) + v[b]; \ + v[d] = ROTR32(v[d] ^ v[a], 8); \ + v[c] += v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 7); \ + } + +#define hostGSn(a,b,c,d,x,y) { \ + v[a] += (m[x] ^ z[y]) + v[b]; \ + v[d] = ROTR32(v[d] ^ v[a], 16); \ + v[c] += v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 12); \ + v[a] += (m[y] ^ z[x]) + v[b]; \ + v[d] = ROTR32(v[d] ^ v[a], 8); \ + v[c] += v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 7); \ +} + +__host__ __forceinline__ +static void blake256_14round_compress1st(uint32_t *h, const uint32_t *block, const uint32_t T0){ + uint32_t m[16]; + uint32_t v[16]; + + const uint32_t c_sigma[16][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }, + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 }, + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } + }; + const uint32_t z[16] = { + 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, + 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917 + }; + + for (int i = 0; i < 16; i++) { + m[i] = block[i]; + } + + for (int i = 0; i < 8; i++) + v[i] = h[i]; + + v[8] = z[0]; + v[9] = z[1]; + v[10] = z[2]; + v[11] = z[3]; + + v[12] = z[4] ^ T0; + v[13] = z[5] ^ T0; + v[14] = z[6]; + v[15] = z[7]; + + for (int r = 0; r < 14; r++) { + /* column step */ + hostGS(0, 4, 0x8, 0xC, 0x0); + hostGS(1, 5, 0x9, 0xD, 0x2); + hostGS(2, 6, 0xA, 0xE, 0x4); + hostGS(3, 7, 0xB, 0xF, 0x6); + /* diagonal step */ + hostGS(0, 5, 0xA, 0xF, 0x8); + hostGS(1, 6, 0xB, 0xC, 0xA); + hostGS(2, 7, 0x8, 0xD, 0xC); + hostGS(3, 4, 0x9, 0xE, 0xE); + } + + for (int i = 0; i < 16; i++) { + int j = i & 7; + h[j] ^= v[i]; + } +} + +__global__ +void blake256_14round_gpu_hash_80(const uint32_t threads, const uint32_t startNonce, uint2 * Hash){ + const uint32_t thread = blockDim.x * blockIdx.x + threadIdx.x; + + const uint32_t z[16] = { + 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, + 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917 + }; + + uint32_t v[16]; + uint32_t xors[16]; + + if(thread>> (threads, startNonce, d_Hash); +} + +__host__ +void blake256_14round_cpu_setBlock_80(const uint32_t *pdata){ + uint32_t _ALIGN(64) h[8]; + uint32_t _ALIGN(64) v[16]; + uint32_t _ALIGN(64) data[20]; + uint32_t _ALIGN(64) x[60]; + + memcpy(data, pdata, 80); + memcpy(h, c_IV256, sizeof(c_IV256)); + blake256_14round_compress1st(h, pdata, 512); + + cudaMemcpyToSymbol(c_h, h, 8*sizeof(uint32_t), 0); + + const uint32_t m[16] = { pdata[16], pdata[17], pdata[18], 0, + 0x80000000, 0, 0, 0, + 0, 0, 0, 0, + 0, 1, 0, 640 + }; + + cudaMemcpyToSymbol(c_m, m, 16*sizeof(uint32_t), 0); + + const uint32_t z[16] = { + 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, + 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917 + }; + + v[ 0] = h[ 0]; v[ 1] = h[ 1]; v[ 2] = h[ 2]; v[ 3] = h[ 3]; + v[ 4] = h[ 4]; v[ 5] = h[ 5]; v[ 6] = h[ 6]; v[ 7] = h[ 7]; + v[ 8] = z[ 0]; v[ 9] = z[ 1]; v[10] = z[ 2]; v[11] = z[ 3]; + v[12] = z[ 4] ^ 640; v[13] = z[ 5] ^ 640; v[14] = z[ 6]; v[15] = z[ 7]; + + hostGSn(0, 4, 8,12, 0, 1); + hostGSn(2, 6,10,14, 4, 5); + hostGSn(3, 7,11,15, 6, 7); + + v[ 1]+= (m[ 2] ^ z[ 3]) + v[ 5]; + v[13] = ROTR32(v[13] ^ v[ 1],16); + v[ 9] += v[13]; + v[ 5] = ROTR32(v[ 5] ^ v[ 9],12); + + v[ 1]+= v[ 5]; + v[ 0]+= z[ 9]; + + v[ 2]+= z[13] + v[ 7]; + v[ 3]+= z[15] + v[ 4]; + v[14] = ROTL32(v[14] ^ v[ 3],16); + + cudaMemcpyToSymbol(c_v, v, 16*sizeof(uint32_t), 0); + + int i=0; + x[i++] = m[ 0]^z[ 1]; x[i++] = m[ 2]^z[ 3]; x[i++] = m[ 4]^z[ 5]; x[i++] = z[ 0]^m[ 1]; x[i++] = z[12]^m[13]; x[i++] = z[14]^m[15]; +//1 + x[i++] = m[ 4]^z[ 8]; x[i++] = m[13]^z[ 6]; x[i++] = z[ 9]^m[15]; x[i++] = m[ 1]^z[12]; x[i++] = m[ 0]^z[ 2]; x[i++] = z[ 0]^m[ 2]; +//2 + x[i++] = m[15]^z[13]; x[i++] = z[12]^m[ 0]; x[i++] = z[ 5]^m[ 2]; x[i++] = z[15]^m[13]; x[i++] = z[ 7]^m[ 1]; x[i++] = z[ 9]^m[ 4]; +//3 + x[i++] = z[12]^m[13]; x[i++] = z[ 3]^m[ 1]; x[i++] = m[ 2]^z[ 6]; x[i++] = m[ 4]^z[ 0]; x[i++] = m[15]^z[ 8]; x[i++] = z[ 4]^m[ 0]; +//4 + x[i++] = m[ 2]^z[ 4]; x[i++] = z[ 9]^m[ 0]; x[i++] = z[ 2]^m[ 4]; x[i++] = z[10]^m[15]; x[i++] = z[14]^m[ 1]; x[i++] = z[ 3]^m[13]; +//5 + x[i++] = m[ 2]^z[12]; x[i++] = m[ 0]^z[11]; x[i++] = m[ 4]^z[13]; x[i++] = z[14]^m[15]; x[i++] = m[ 1]^z[ 9]; x[i++] = z[ 4]^m[13]; +//6 + x[i++] = m[ 1]^z[15]; x[i++] = m[ 4]^z[10]; x[i++] = z[ 1]^m[15]; x[i++] = z[14]^m[13]; x[i++] = m[ 0]^z[ 7]; x[i++] = z[ 9]^m[ 2]; +//7 + x[i++] = m[13]^z[11]; x[i++] = z[12]^m[ 1]; x[i++] = m[15]^z[ 4]; x[i++] = m[ 2]^z[10]; x[i++] = z[ 5]^m[ 0]; x[i++] = z[15]^m[ 4]; +//8 + x[i++] = m[ 0]^z[ 8]; x[i++] = z[ 6]^m[15]; x[i++] = m[13]^z[ 7]; x[i++] = m[ 1]^z[ 4]; x[i++] = z[12]^m[ 2]; x[i++] = z[ 1]^m[ 4]; +//9 + x[i++] = m[ 1]^z[ 5]; x[i++] = z[10]^m[ 2]; x[i++] = z[ 8]^m[ 4]; x[i++] = m[15]^z[11]; x[i++] = m[13]^z[ 0]; x[i++] = z[13]^m[ 0]; + + cudaMemcpyToSymbol(c_x, x, i*sizeof(uint32_t), 0); +} diff --git a/Algo256/cuda_blake2s.cu b/Algo256/cuda_blake2s.cu new file mode 100644 index 0000000..c828bfb --- /dev/null +++ b/Algo256/cuda_blake2s.cu @@ -0,0 +1,509 @@ +/* + Based on the SPH implementation of blake2s + Provos Alexis - 2016 +*/ + +#include "miner.h" + +#include +#include + +#include "sph/blake2s.h" +#include "sph/sph_types.h" + +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#ifdef __INTELLISENSE__ +#define __byte_perm(x, y, b) x +#endif + +static const uint32_t blake2s_IV[8] = +{ + 0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL, + 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL +}; + +static const uint8_t blake2s_sigma[10][16] = +{ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } +}; + +#define G(r,i,a,b,c,d) \ + do { \ + a = a + b + m[blake2s_sigma[r][2*i+0]]; \ + d = SPH_ROTR32(d ^ a, 16); \ + c = c + d; \ + b = SPH_ROTR32(b ^ c, 12); \ + a = a + b + m[blake2s_sigma[r][2*i+1]]; \ + d = SPH_ROTR32(d ^ a, 8); \ + c = c + d; \ + b = SPH_ROTR32(b ^ c, 7); \ + } while(0) +#define ROUND(r) \ + do { \ + G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \ + G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \ + G(r,2,v[ 2],v[ 6],v[10],v[14]); \ + G(r,3,v[ 3],v[ 7],v[11],v[15]); \ + G(r,4,v[ 0],v[ 5],v[10],v[15]); \ + G(r,5,v[ 1],v[ 6],v[11],v[12]); \ + G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \ + G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \ + } while(0) + +extern "C" void blake2s_hash(void *output, const void *input){ + uint32_t m[16]; + uint32_t v[16]; + uint32_t h[8]; + + uint32_t *in = (uint32_t*)input; +// COMPRESS + for(int i = 0; i < 16; ++i ) + m[i] = in[i]; + + h[ 0] = 0x01010020 ^ blake2s_IV[0]; h[ 1] = blake2s_IV[1]; + h[ 2] = blake2s_IV[2]; h[ 3] = blake2s_IV[3]; + h[ 4] = blake2s_IV[4]; h[ 5] = blake2s_IV[5]; + h[ 6] = blake2s_IV[6]; h[ 7] = blake2s_IV[7]; + + for(int i = 0; i < 8; ++i ) + v[i] = h[i]; + + v[ 8] = blake2s_IV[0]; v[ 9] = blake2s_IV[1]; + v[10] = blake2s_IV[2]; v[11] = blake2s_IV[3]; + v[12] = 64 ^ blake2s_IV[4]; v[13] = blake2s_IV[5]; + v[14] = blake2s_IV[6]; v[15] = blake2s_IV[7]; + + ROUND( 0 ); ROUND( 1 ); ROUND( 2 ); + ROUND( 3 ); ROUND( 4 ); ROUND( 5 ); + ROUND( 6 ); ROUND( 7 ); ROUND( 8 ); + ROUND( 9 ); + + for( size_t i = 0; i < 8; ++i ) + h[i] ^= v[i] ^ v[i + 8]; + +// COMPRESS + m[0] = in[16]; m[1] = in[17]; + m[2] = in[18]; m[3] = in[19]; + for( size_t i = 4; i < 16; ++i ) + m[i] = 0; + + for( size_t i = 0; i < 8; ++i ) + v[i] = h[i]; + + v[ 8] = blake2s_IV[0]; v[ 9] = blake2s_IV[1]; + v[10] = blake2s_IV[2]; v[11] = blake2s_IV[3]; + v[12] = 0x50 ^ blake2s_IV[4]; v[13] = blake2s_IV[5]; + v[14] = ~blake2s_IV[6]; v[15] = blake2s_IV[7]; + + ROUND( 0 ); ROUND( 1 ); ROUND( 2 ); + ROUND( 3 ); ROUND( 4 ); ROUND( 5 ); + ROUND( 6 ); ROUND( 7 ); ROUND( 8 ); + ROUND( 9 ); + + for( size_t i = 0; i < 8; ++i ) + h[i] ^= v[i] ^ v[i + 8]; + + memcpy(output, h, 32); +} + +#define TPB 1024 +#define NPT 256 +#define maxResults 16 +#define NBN 1 + +__constant__ uint32_t _ALIGN(16) midstate[20]; + +/* 16 adapters max */ +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +#define GS4(a,b,c,d,e,f,a1,b1,c1,d1,e1,f1,a2,b2,c2,d2,e2,f2,a3,b3,c3,d3,e3,f3){ \ + a += b + e; a1+= b1 + e1; a2+= b2 + e2; a3+= b3 + e3; \ + d = ROL16( d ^ a); d1 = ROL16(d1 ^ a1); d2 = ROL16(d2 ^ a2); d3 = ROL16(d3 ^ a3); \ + c +=d; c1+=d1; c2+=d2; c3+=d3;\ + b = ROTR32(b ^ c, 12); b1 = ROTR32(b1^c1, 12); b2 = ROTR32(b2^c2, 12); b3 = ROTR32(b3^c3, 12); \ + a += b + f; a1+= b1 + f1; a2+= b2 + f2; a3+= b3 + f3; \ + d = ROR8(d ^ a); d1 = ROR8(d1^a1); d2 = ROR8(d2^a2); d3 = ROR8(d3^a3); \ + c += d; c1 += d1; c2 += d2; c3 += d3;\ + b = ROTR32(b ^ c, 7); b1 = ROTR32(b1^c1, 7); b2 = ROTR32(b2^c2, 7); b3 = ROTR32(b3^c3, 7); \ +} + +__global__ __launch_bounds__(TPB,1) +void blake2s_gpu_hash_nonce(const uint32_t threads, const uint32_t startNonce, uint32_t *resNonce, const uint32_t ptarget7){ + + const uint32_t step = gridDim.x * blockDim.x; + + uint32_t m[ 3]; + uint32_t v[16]; + + m[0] = midstate[16]; + m[1] = midstate[17]; + m[2] = midstate[18]; + + const uint32_t h7 = midstate[19]; + + for(uint32_t thread = blockDim.x * blockIdx.x + threadIdx.x ; thread data; + uint32_t *ptarget = work->target; + + const uint32_t first_nonce = pdata[19]; + + const int dev_id = device_map[thr_id]; + int intensity = 31; + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + const dim3 grid((throughput + (NPT*TPB)-1)/(NPT*TPB)); + const dim3 block(TPB); + + if (!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage (linux) + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); +// cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], maxResults * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(maxResults * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + CUDA_LOG_ERROR(); + + init[thr_id] = true; + } + for (int i=0; i < 19; i++) { + be32enc(&endiandata[i], pdata[i]); + } + blake2s_setBlock(endiandata,ptarget[7]); + + int rc=0; + cudaMemset(d_resNonce[thr_id], 0x00, maxResults*sizeof(uint32_t)); + do { + if(ptarget[7]){ + blake2s_gpu_hash_nonce<<>>(throughput,pdata[19],d_resNonce[thr_id],ptarget[7]); + }else{ + blake2s_gpu_hash_nonce<<>>(throughput,pdata[19],d_resNonce[thr_id]); + } + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != 0){ + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], maxResults*sizeof(uint32_t), cudaMemcpyDeviceToHost); + cudaMemset(d_resNonce[thr_id], 0x00, sizeof(uint32_t)); + if(h_resNonce[thr_id][0]>(maxResults-1)){ + gpulog(LOG_WARNING,dev_id,"Candidate flood: %u",h_resNonce[thr_id][0]); + h_resNonce[thr_id][0]=maxResults-1; + } + uint32_t i; + for(i=1;inonces[0] = nonce; + rc=1; + //search for 2nd nonce + for(uint32_t j=i+1;jnonces[1] = nonce; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %u/%08X - %u/%08X",i,pdata[19],j,work->nonces[1]); + if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio[0]) { + work_set_target_ratio(work, vhashcpu); + xchg(work->nonces[1], pdata[19]); + } + rc=2; + break; + } + } + return rc; + }/*else{ + applog_hash(ptarget); + applog_compare_hash(vhashcpu, ptarget); + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + }*/ + } + } + pdata[19]+=throughput; + } while (!work_restart[thr_id].restart && (uint64_t)max_nonce > (uint64_t)throughput + (uint64_t)pdata[19]); + + *hashes_done = pdata[19] - first_nonce; + +// MyStreamSynchronize(NULL, 0, device_map[thr_id]); + + return rc; +} + +// cleanup +extern "C" void free_blake2s(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} + diff --git a/Algo256/cuda_bmw256.cu b/Algo256/cuda_bmw256.cu new file mode 100644 index 0000000..2bb4560 --- /dev/null +++ b/Algo256/cuda_bmw256.cu @@ -0,0 +1,287 @@ +#include +#include + +#include "cuda_helper.h" +#include "cuda_vectors.h" + +static uint32_t *d_gnounce[MAX_GPUS]; +static uint32_t *d_GNonce[MAX_GPUS]; + +#define shl(x, n) (x << n) +#define shr(x, n) (x >> n) + +#define ss0(x) (shr(x, 1)^ shl(x, 3) ^ ROTL32(x, 4) ^ ROTL32(x, 19)) +#define ss1(x) (shr(x, 1)^ shl(x, 2) ^ ROL8(x) ^ ROTL32(x, 23)) +#define ss2(x) (shr(x, 2)^ shl(x, 1) ^ ROTL32(x, 12) ^ ROTL32(x, 25)) +#define ss3(x) (shr(x, 2)^ shl(x, 2) ^ ROTL32(x, 15) ^ ROTL32(x, 29)) +#define ss4(x) (shr(x, 1) ^ x) +#define ss5(x) (shr(x, 2) ^ x) + +#define rs1(x) ROTL32(x, 3) +#define rs2(x) ROTL32(x, 7) +#define rs3(x) ROTL32(x, 13) +#define rs4(x) ROL16(x) +#define rs5(x) ROTL32(x, 19) +#define rs6(x) ROTL32(x, 23) +#define rs7(x) ROTL32(x, 27) + +#define TPB 1024 +#define NBN 2 + +__global__ __launch_bounds__(TPB,1) +void bmw256_gpu_hash_32(uint32_t threads, uint2 *g_hash, uint32_t *const __restrict__ nonceVector, const uint2 target){ + + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + uint32_t M32[16] = { 0 }; + + *(uint2*)&M32[ 0] = __ldg(&g_hash[thread]); + *(uint2*)&M32[ 2] = __ldg(&g_hash[thread + 1 * threads]); + *(uint2*)&M32[ 4] = __ldg(&g_hash[thread + 2 * threads]); + *(uint2*)&M32[ 6] = __ldg(&g_hash[thread + 3 * threads]); + + M32[ 8]=0x80; + M32[14]=0x100; + +// Compression256(message); + uint32_t Q[32], XL32, XH32; + + const uint32_t H[16] = { + 0x40414243, 0x44454647, 0x48494A4B, 0x4C4D4E4F, 0x50515253, 0x54555657, 0x58595A5B, 0x5C5D5E5F, + 0x60616263, 0x64656667, 0x68696A6B, 0x6C6D6E6F, 0x70717273, 0x74757677, 0x78797A7B, 0x7C7D7E7F + }; + uint32_t tmp[16]; + + *(uint16*)&tmp[ 0] = *(uint16*)&M32[ 0] ^ *(uint16*)&H[ 0]; + + Q[ 0] = tmp[ 5] - tmp[ 7] + tmp[10] + tmp[13] + tmp[14]; Q[ 1] = tmp[ 6] - tmp[ 8] + tmp[11] + tmp[14] - tmp[15]; + Q[ 2] = tmp[ 0] + tmp[ 7] + tmp[ 9] - tmp[12] + tmp[15]; Q[ 3] = tmp[ 0] - tmp[ 1] + tmp[ 8] - tmp[10] + tmp[13]; + Q[ 4] = tmp[ 1] + tmp[ 2] + tmp[ 9] - tmp[11] - tmp[14]; Q[ 5] = tmp[ 3] - tmp[ 2] + tmp[10] - tmp[12] + tmp[15]; + Q[ 6] = tmp[ 4] - tmp[ 0] - tmp[ 3] - tmp[11] + tmp[13]; Q[ 7] = tmp[ 1] - tmp[ 4] - tmp[ 5] - tmp[12] - tmp[14]; + Q[ 8] = tmp[ 2] - tmp[ 5] - tmp[ 6] + tmp[13] - tmp[15]; Q[ 9] = tmp[ 0] - tmp[ 3] + tmp[ 6] - tmp[ 7] + tmp[14]; + Q[10] = tmp[ 8] - tmp[ 1] - tmp[ 4] - tmp[ 7] + tmp[15]; Q[11] = tmp[ 8] - tmp[ 0] - tmp[ 2] - tmp[ 5] + tmp[ 9]; + Q[12] = tmp[ 1] + tmp[ 3] - tmp[ 6] - tmp[ 9] + tmp[10]; Q[13] = tmp[ 2] + tmp[ 4] + tmp[ 7] + tmp[10] + tmp[11]; + Q[14] = tmp[ 3] - tmp[ 5] + tmp[ 8] - tmp[11] - tmp[12]; Q[15] = tmp[12] - tmp[ 4] - tmp[ 6] - tmp[ 9] + tmp[13]; + + /* Diffuse the differences in every word in a bijective manner with ssi, and then add the values of the previous double pipe. */ + Q[ 0] = ss0(Q[ 0]) + H[ 1]; Q[ 1] = ss1(Q[ 1]) + H[ 2]; Q[ 2] = ss2(Q[ 2]) + H[ 3]; Q[ 3] = ss3(Q[ 3]) + H[ 4]; + Q[ 4] = ss4(Q[ 4]) + H[ 5]; Q[ 5] = ss0(Q[ 5]) + H[ 6]; Q[ 6] = ss1(Q[ 6]) + H[ 7]; Q[ 7] = ss2(Q[ 7]) + H[ 8]; + Q[ 8] = ss3(Q[ 8]) + H[ 9]; Q[ 9] = ss4(Q[ 9]) + H[10]; Q[10] = ss0(Q[10]) + H[11]; Q[11] = ss1(Q[11]) + H[12]; + Q[12] = ss2(Q[12]) + H[13]; Q[13] = ss3(Q[13]) + H[14]; Q[14] = ss4(Q[14]) + H[15]; Q[15] = ss0(Q[15]) + H[ 0]; + + /* This is the Message expansion or f_1 in the documentation. It has 16 rounds. Blue Midnight Wish has two tunable security parameters. */ + /* The parameters are named EXPAND_1_ROUNDS and EXPAND_2_ROUNDS. The following relation for these parameters should is satisfied: */ + /* EXPAND_1_ROUNDS + EXPAND_2_ROUNDS = 16 */ + + tmp[ 0] = ROTL32(M32[ 0], 1); tmp[ 1] = ROTL32(M32[ 1], 2); tmp[ 2] = ROTL32(M32[ 2], 3); tmp[ 3] = ROTL32(M32[ 3], 4); + tmp[ 4] = ROTL32(M32[ 4], 5); tmp[ 5] = ROTL32(M32[ 5], 6); tmp[ 6] = ROTL32(M32[ 6], 7); tmp[ 7] = ROL8(M32[ 7]); + tmp[ 8] = ROTL32(M32[ 8], 9); + tmp[14] = ROTL32(M32[14],15); + + uint32_t tmp2[ 2]; + + Q[16] = ss1(Q[ 0]) + ss2(Q[ 1]) + ss3(Q[ 2]) + ss0(Q[ 3]) + ss1(Q[ 4]) + ss2(Q[ 5]) + ss3(Q[ 6]) + ss0(Q[ 7]) + + ss1(Q[ 8]) + ss2(Q[ 9]) + ss3(Q[10]) + ss0(Q[11]) + ss1(Q[12]) + ss2(Q[13]) + ss3(Q[14]) + ss0(Q[15]) + ((shl(0x05555555,4) + tmp[ 0] + tmp[ 3]) ^ H[ 7]); + Q[17] = ss1(Q[ 1]) + ss2(Q[ 2]) + ss3(Q[ 3]) + ss0(Q[ 4]) + ss1(Q[ 5]) + ss2(Q[ 6]) + ss3(Q[ 7]) + ss0(Q[ 8]) + + ss1(Q[ 9]) + ss2(Q[10]) + ss3(Q[11]) + ss0(Q[12]) + ss1(Q[13]) + ss2(Q[14]) + ss3(Q[15]) + ss0(Q[16]) + ((17U*(0x05555555) + tmp[ 1] + tmp[ 4]) ^ H[ 8]); + + tmp2[ 0] = Q[ 2] + Q[ 4] + Q[ 6] + Q[ 8] + Q[10] + Q[12] + Q[14]; + tmp2[ 1] = Q[ 3] + Q[ 5] + Q[ 7] + Q[ 9] + Q[11] + Q[13] + Q[15]; + + Q[18] = rs1(Q[ 3]) + rs2(Q[ 5]) + rs3(Q[ 7]) + rs4(Q[ 9]) + rs5(Q[11]) + rs6(Q[13]) + rs7(Q[15]) + ss4(Q[16]) + ss5(Q[17]) + tmp2[ 0] +((18U*(0x05555555) + tmp[ 2] + tmp[ 5]) ^ H[ 9]); + Q[19] = rs1(Q[ 4]) + rs2(Q[ 6]) + rs3(Q[ 8]) + rs4(Q[10]) + rs5(Q[12]) + rs6(Q[14]) + rs7(Q[16]) + ss4(Q[17]) + ss5(Q[18]) + tmp2[ 1] +((19U*(0x05555555) + tmp[ 3] + tmp[ 6]) ^ H[10]); + + tmp2[ 0]+= Q[16] - Q[ 2]; + tmp2[ 1]+= Q[17] - Q[ 3]; + + Q[20] = rs1(Q[ 5])+rs2(Q[ 7])+rs3(Q[ 9])+rs4(Q[11])+rs5(Q[13])+rs6(Q[15])+rs7(Q[17])+ss4(Q[18])+ss5(Q[19])+tmp2[ 0]+((20U*(0x05555555) + tmp[ 4] + tmp[ 7] - tmp[14]) ^ H[11]); + Q[21] = rs1(Q[ 6])+rs2(Q[ 8])+rs3(Q[10])+rs4(Q[12])+rs5(Q[14])+rs6(Q[16])+rs7(Q[18])+ss4(Q[19])+ss5(Q[20])+tmp2[ 1]+((21U*(0x05555555) + tmp[ 5] + tmp[ 8]) ^ H[12]); + + tmp2[ 0]+= Q[18] - Q[ 4]; + tmp2[ 1]+= Q[19] - Q[ 5]; + + Q[22] = rs1(Q[ 7])+rs2(Q[ 9])+rs3(Q[11])+rs4(Q[13])+rs5(Q[15])+rs6(Q[17])+rs7(Q[19])+ss4(Q[20])+ss5(Q[21])+tmp2[ 0]+((22U*(0x05555555) + tmp[ 6] - tmp[ 0]) ^ H[13]); + Q[23] = rs1(Q[ 8])+rs2(Q[10])+rs3(Q[12])+rs4(Q[14])+rs5(Q[16])+rs6(Q[18])+rs7(Q[20])+ss4(Q[21])+ss5(Q[22])+tmp2[ 1]+((23U*(0x05555555) + tmp[ 7] - tmp[ 1]) ^ H[14]); + + tmp2[ 0]+= Q[20] - Q[ 6]; + tmp2[ 1]+= Q[21] - Q[ 7]; + + Q[24] = rs1(Q[ 9])+rs2(Q[11])+rs3(Q[13])+rs4(Q[15])+rs5(Q[17])+rs6(Q[19])+rs7(Q[21])+ss4(Q[22])+ss5(Q[23])+tmp2[ 0]+((24U*(0x05555555) + tmp[ 8] - tmp[ 2]) ^ H[15]); + Q[25] = rs1(Q[10])+rs2(Q[12])+rs3(Q[14])+rs4(Q[16])+rs5(Q[18])+rs6(Q[20])+rs7(Q[22])+ss4(Q[23])+ss5(Q[24])+tmp2[ 1]+((25U*(0x05555555) - tmp[ 3]) ^ H[ 0]); + + tmp2[ 0]+= Q[22] - Q[ 8]; + tmp2[ 1]+= Q[23] - Q[ 9]; + + Q[26] = rs1(Q[11])+rs2(Q[13])+rs3(Q[15])+rs4(Q[17])+rs5(Q[19])+rs6(Q[21])+rs7(Q[23])+ss4(Q[24])+ss5(Q[25])+tmp2[ 0]+((26U*(0x05555555) - tmp[ 4]) ^ H[ 1]); + Q[27] = rs1(Q[12])+rs2(Q[14])+rs3(Q[16])+rs4(Q[18])+rs5(Q[20])+rs6(Q[22])+rs7(Q[24])+ss4(Q[25])+ss5(Q[26])+tmp2[ 1]+((27U*(0x05555555) + tmp[14] - tmp[ 5]) ^ H[ 2]); + + tmp2[ 0]+= Q[24] - Q[10]; + tmp2[ 1]+= Q[25] - Q[11]; + + Q[28] = rs1(Q[13])+rs2(Q[15])+rs3(Q[17])+rs4(Q[19])+rs5(Q[21])+rs6(Q[23])+rs7(Q[25])+ss4(Q[26])+ss5(Q[27])+tmp2[ 0]+((28U*(0x05555555) - tmp[ 6]) ^ H[ 3]); + Q[29] = rs1(Q[14])+rs2(Q[16])+rs3(Q[18])+rs4(Q[20])+rs5(Q[22])+rs6(Q[24])+rs7(Q[26])+ss4(Q[27])+ss5(Q[28])+tmp2[ 1]+((29U*(0x05555555) + tmp[ 0] - tmp[ 7]) ^ H[ 4]); + + tmp2[ 0]+= Q[26] - Q[12]; + tmp2[ 1]+= Q[27] - Q[13]; + + Q[30] = rs1(Q[15])+rs2(Q[17])+rs3(Q[19])+rs4(Q[21])+rs5(Q[23])+rs6(Q[25])+rs7(Q[27])+ss4(Q[28])+ss5(Q[29])+tmp2[ 0]+((30U*(0x05555555) + tmp[14] + tmp[ 1] - tmp[ 8]) ^ H[ 5]); + Q[31] = rs1(Q[16])+rs2(Q[18])+rs3(Q[20])+rs4(Q[22])+rs5(Q[24])+rs6(Q[26])+rs7(Q[28])+ss4(Q[29])+ss5(Q[30])+tmp2[ 1]+((31U*(0x05555555) + tmp[ 2]) ^ H[ 6]); + + /* Blue Midnight Wish has two temporary cummulative variables that accumulate via XORing 16 new variables that are produced in the Message Expansion part. */ + XL32 = Q[16] ^ xor3x(Q[17], Q[18], xor3x(Q[19], Q[20], xor3x(Q[21], Q[22], Q[23]))); + XH32 = xor3x(XL32, Q[24], xor3x(Q[25], Q[26], xor3x(Q[27], Q[28], xor3x(Q[29], Q[30], Q[31])))); + + /* This part is the function f_2 - in the documentation */ + /* Compute the double chaining pipe for the next message block. */ + M32[0] = xor3x(shl(XH32, 5), shr(Q[16], 5), M32[ 0]) + xor3x(XL32, Q[24], Q[ 0]); + M32[1] = xor3x(shr(XH32, 7), shl(Q[17], 8), M32[ 1]) + xor3x(XL32, Q[25], Q[ 1]); + M32[2] = xor3x(shr(XH32, 5), shl(Q[18], 5), M32[ 2]) + xor3x(XL32, Q[26], Q[ 2]); + M32[3] = xor3x(shr(XH32, 1), shl(Q[19], 5), M32[ 3]) + xor3x(XL32, Q[27], Q[ 3]); + M32[4] = xor3x(shr(XH32, 3), Q[20] , M32[ 4]) + xor3x(XL32, Q[28], Q[ 4]); + M32[5] = xor3x(shl(XH32, 6), shr(Q[21], 6), M32[ 5]) + xor3x(XL32, Q[29], Q[ 5]); + M32[6] = xor3x(shr(XH32, 4), shl(Q[22], 6), M32[ 6]) + xor3x(XL32, Q[30], Q[ 6]); + M32[7] = xor3x(shr(XH32,11), shl(Q[23], 2), M32[ 7]) + xor3x(XL32, Q[31], Q[ 7]); + + M32[ 8] = ROTL32(M32[ 4], 9) + xor3x(XH32, Q[24], M32[ 8]) + xor3x(shl(XL32, 8), Q[23], Q[ 8]); + M32[ 9] = ROTL32(M32[ 5],10) + xor3x(XH32, Q[25], M32[ 9]) + xor3x(shr(XL32, 6), Q[16], Q[ 9]); + M32[10] = ROTL32(M32[ 6],11) + xor3x(XH32, Q[26], M32[10]) + xor3x(shl(XL32, 6), Q[17], Q[10]); + M32[11] = ROTL32(M32[ 7],12) + xor3x(XH32, Q[27], M32[11]) + xor3x(shl(XL32, 4), Q[18], Q[11]); + M32[12] = ROTL32(M32[ 0],13) + xor3x(XH32, Q[28], M32[12]) + xor3x(shr(XL32, 3), Q[19], Q[12]); + M32[13] = ROTL32(M32[ 1],14) + xor3x(XH32, Q[29], M32[13]) + xor3x(shr(XL32, 4), Q[20], Q[13]); + M32[14] = ROTL32(M32[ 2],15) + xor3x(XH32, Q[30], M32[14]) + xor3x(shr(XL32, 7), Q[21], Q[14]); + M32[15] = ROL16(M32[ 3]) + xor3x(XH32, Q[31], M32[15]) + xor3x(shr(XL32, 2), Q[22], Q[15]); + +// Compression256_2(M32); + const uint32_t H2[16] = { + 0xaaaaaaa0, 0xaaaaaaa1, 0xaaaaaaa2, 0xaaaaaaa3, 0xaaaaaaa4, 0xaaaaaaa5, 0xaaaaaaa6, 0xaaaaaaa7, + 0xaaaaaaa8, 0xaaaaaaa9, 0xaaaaaaaa, 0xaaaaaaab, 0xaaaaaaac, 0xaaaaaaad, 0xaaaaaaae, 0xaaaaaaaf + }; + + *(uint16*)&tmp[ 0] = *(uint16*)&M32[ 0] ^ *(uint16*)&H2[ 0]; + + Q[ 0] = tmp[ 5] - tmp[ 7] + tmp[10] + tmp[13] + tmp[14]; Q[ 1] = tmp[ 6] - tmp[ 8] + tmp[11] + tmp[14] - tmp[15]; + Q[ 2] = tmp[ 0] + tmp[ 7] + tmp[ 9] - tmp[12] + tmp[15]; Q[ 3] = tmp[ 0] - tmp[ 1] + tmp[ 8] - tmp[10] + tmp[13]; + Q[ 4] = tmp[ 1] + tmp[ 2] + tmp[ 9] - tmp[11] - tmp[14]; Q[ 5] = tmp[ 3] - tmp[ 2] + tmp[10] - tmp[12] + tmp[15]; + Q[ 6] = tmp[ 4] - tmp[ 0] - tmp[ 3] - tmp[11] + tmp[13]; Q[ 7] = tmp[ 1] - tmp[ 4] - tmp[ 5] - tmp[12] - tmp[14]; + Q[ 8] = tmp[ 2] - tmp[ 5] - tmp[ 6] + tmp[13] - tmp[15]; Q[ 9] = tmp[ 0] - tmp[ 3] + tmp[ 6] - tmp[ 7] + tmp[14]; + Q[10] = tmp[ 8] - tmp[ 1] - tmp[ 4] - tmp[ 7] + tmp[15]; Q[11] = tmp[ 8] - tmp[ 0] - tmp[ 2] - tmp[ 5] + tmp[ 9]; + Q[12] = tmp[ 1] + tmp[ 3] - tmp[ 6] - tmp[ 9] + tmp[10]; Q[13] = tmp[ 2] + tmp[ 4] + tmp[ 7] + tmp[10] + tmp[11]; + Q[14] = tmp[ 3] - tmp[ 5] + tmp[ 8] - tmp[11] - tmp[12]; Q[15] = tmp[12] - tmp[ 4] - tmp[ 6] - tmp[ 9] + tmp[13]; + + /* Diffuse the differences in every word in a bijective manner with ssi, and then add the values of the previous double pipe. */ + Q[ 0] = ss0(Q[ 0]) + H2[ 1]; Q[ 1] = ss1(Q[ 1]) + H2[ 2]; Q[ 2] = ss2(Q[ 2]) + H2[ 3]; Q[ 3] = ss3(Q[ 3]) + H2[ 4]; + Q[ 4] = ss4(Q[ 4]) + H2[ 5]; Q[ 5] = ss0(Q[ 5]) + H2[ 6]; Q[ 6] = ss1(Q[ 6]) + H2[ 7]; Q[ 7] = ss2(Q[ 7]) + H2[ 8]; + Q[ 8] = ss3(Q[ 8]) + H2[ 9]; Q[ 9] = ss4(Q[ 9]) + H2[10]; Q[10] = ss0(Q[10]) + H2[11]; Q[11] = ss1(Q[11]) + H2[12]; + Q[12] = ss2(Q[12]) + H2[13]; Q[13] = ss3(Q[13]) + H2[14]; Q[14] = ss4(Q[14]) + H2[15]; Q[15] = ss0(Q[15]) + H2[ 0]; + + /* This is the Message expansion or f_1 in the documentation. It has 16 rounds. Blue Midnight Wish has two tunable security parameters. */ + /* The parameters are named EXPAND_1_ROUNDS and EXPAND_2_ROUNDS. The following relation for these parameters should is satisfied: */ + /* EXPAND_1_ROUNDS + EXPAND_2_ROUNDS = 16 */ + tmp[ 0] = ROTL32(M32[ 0], 1); tmp[ 1] = ROTL32(M32[ 1], 2); tmp[ 2] = ROTL32(M32[ 2], 3); tmp[ 3] = ROTL32(M32[ 3], 4); + tmp[ 4] = ROTL32(M32[ 4], 5); tmp[ 5] = ROTL32(M32[ 5], 6); tmp[ 6] = ROTL32(M32[ 6], 7); tmp[ 7] = ROL8(M32[ 7]); + tmp[ 8] = ROTL32(M32[ 8], 9); tmp[ 9] = ROTL32(M32[ 9],10); tmp[10] = ROTL32(M32[10],11); tmp[11] = ROTL32(M32[11],12); + tmp[12] = ROTL32(M32[12],13); tmp[13] = ROTL32(M32[13],14); tmp[14] = ROTL32(M32[14],15); tmp[15] = ROL16(M32[15]); + + Q[16] = ss1(Q[ 0]) + ss2(Q[ 1]) + ss3(Q[ 2]) + ss0(Q[ 3]) + ss1(Q[ 4]) + ss2(Q[ 5]) + ss3(Q[ 6]) + ss0(Q[ 7]) + + ss1(Q[ 8]) + ss2(Q[ 9]) + ss3(Q[10]) + ss0(Q[11]) + ss1(Q[12]) + ss2(Q[13]) + ss3(Q[14]) + ss0(Q[15]) + + ((shl(0x05555555,4) + tmp[ 0] + tmp[ 3] - tmp[10]) ^ H2[ 7]); + Q[17] = ss1(Q[ 1]) + ss2(Q[ 2]) + ss3(Q[ 3]) + ss0(Q[ 4]) + ss1(Q[ 5]) + ss2(Q[ 6]) + ss3(Q[ 7]) + ss0(Q[ 8]) + + ss1(Q[ 9]) + ss2(Q[10]) + ss3(Q[11]) + ss0(Q[12]) + ss1(Q[13]) + ss2(Q[14]) + ss3(Q[15]) + ss0(Q[16]) + + ((17U*(0x05555555) + tmp[ 1] + tmp[ 4] - tmp[11]) ^ H2[ 8]); + + tmp2[ 0] = Q[ 2] + Q[ 4] + Q[ 6] + Q[ 8] + Q[10] + Q[12] + Q[14]; + tmp2[ 1] = Q[ 3] + Q[ 5] + Q[ 7] + Q[ 9] + Q[11] + Q[13] + Q[15]; + + Q[18] = rs1(Q[ 3])+rs2(Q[ 5])+rs3(Q[ 7])+rs4(Q[ 9])+rs5(Q[11])+rs6(Q[13])+rs7(Q[15])+ss4(Q[16])+ss5(Q[17])+tmp2[ 0]+((18U*(0x05555555) + tmp[ 2] + tmp[ 5] - tmp[12]) ^ H2[ 9]); + Q[19] = rs1(Q[ 4])+rs2(Q[ 6])+rs3(Q[ 8])+rs4(Q[10])+rs5(Q[12])+rs6(Q[14])+rs7(Q[16])+ss4(Q[17])+ss5(Q[18])+tmp2[ 1]+((19U*(0x05555555) + tmp[ 3] + tmp[ 6] - tmp[13]) ^ H2[10]); + + tmp2[ 0]+= Q[16] - Q[ 2]; + tmp2[ 1]+= Q[17] - Q[ 3]; + + Q[20] = rs1(Q[ 5])+rs2(Q[ 7])+rs3(Q[ 9])+rs4(Q[11])+rs5(Q[13])+rs6(Q[15])+rs7(Q[17])+ss4(Q[18])+ss5(Q[19])+tmp2[ 0]+((20U*(0x05555555) + tmp[ 4] + tmp[ 7] - tmp[14]) ^ H2[11]); + Q[21] = rs1(Q[ 6])+rs2(Q[ 8])+rs3(Q[10])+rs4(Q[12])+rs5(Q[14])+rs6(Q[16])+rs7(Q[18])+ss4(Q[19])+ss5(Q[20])+tmp2[ 1]+((21U*(0x05555555) + tmp[ 5] + tmp[ 8] - tmp[15]) ^ H2[12]); + + tmp2[ 0]+= Q[18] - Q[ 4]; + tmp2[ 1]+= Q[19] - Q[ 5]; + + Q[22] = rs1(Q[ 7])+rs2(Q[ 9])+rs3(Q[11])+rs4(Q[13])+rs5(Q[15])+rs6(Q[17])+rs7(Q[19])+ss4(Q[20])+ss5(Q[21])+tmp2[ 0]+((22U*(0x05555555) + tmp[ 6] + tmp[ 9] - tmp[ 0]) ^ H2[13]); + Q[23] = rs1(Q[ 8])+rs2(Q[10])+rs3(Q[12])+rs4(Q[14])+rs5(Q[16])+rs6(Q[18])+rs7(Q[20])+ss4(Q[21])+ss5(Q[22])+tmp2[ 1]+((23U*(0x05555555) + tmp[ 7] + tmp[10] - tmp[ 1]) ^ H2[14]); + + tmp2[ 0]+= Q[20] - Q[ 6]; + tmp2[ 1]+= Q[21] - Q[ 7]; + + Q[24] = rs1(Q[ 9])+rs2(Q[11])+rs3(Q[13])+rs4(Q[15])+rs5(Q[17])+rs6(Q[19])+rs7(Q[21])+ss4(Q[22])+ss5(Q[23])+tmp2[ 0]+((24U*(0x05555555) + tmp[ 8] + tmp[11] - tmp[ 2]) ^ H2[15]); + Q[25] = rs1(Q[10])+rs2(Q[12])+rs3(Q[14])+rs4(Q[16])+rs5(Q[18])+rs6(Q[20])+rs7(Q[22])+ss4(Q[23])+ss5(Q[24])+tmp2[ 1]+((25U*(0x05555555) + tmp[ 9] + tmp[12] - tmp[ 3]) ^ H2[ 0]); + + tmp2[ 0]+= Q[22] - Q[ 8]; + tmp2[ 1]+= Q[23] - Q[ 9]; + + Q[26] = rs1(Q[11])+rs2(Q[13])+rs3(Q[15])+rs4(Q[17])+rs5(Q[19])+rs6(Q[21])+rs7(Q[23])+ss4(Q[24])+ss5(Q[25])+tmp2[ 0]+((26U*(0x05555555) + tmp[10] + tmp[13] - tmp[ 4]) ^ H2[ 1]); + Q[27] = rs1(Q[12])+rs2(Q[14])+rs3(Q[16])+rs4(Q[18])+rs5(Q[20])+rs6(Q[22])+rs7(Q[24])+ss4(Q[25])+ss5(Q[26])+tmp2[ 1]+((27U*(0x05555555) + tmp[11] + tmp[14] - tmp[ 5]) ^ H2[ 2]); + + tmp2[ 0]+= Q[24] - Q[10]; + tmp2[ 1]+= Q[25] - Q[11]; + + Q[28] = rs1(Q[13])+rs2(Q[15])+rs3(Q[17])+rs4(Q[19])+rs5(Q[21])+rs6(Q[23])+rs7(Q[25])+ss4(Q[26])+ss5(Q[27])+tmp2[ 0]+((28U*(0x05555555) + tmp[12] + tmp[15] - tmp[ 6]) ^ H2[ 3]); + Q[29] = rs1(Q[14])+rs2(Q[16])+rs3(Q[18])+rs4(Q[20])+rs5(Q[22])+rs6(Q[24])+rs7(Q[26])+ss4(Q[27])+ss5(Q[28])+tmp2[ 1]+((29U*(0x05555555) + tmp[13] + tmp[ 0] - tmp[ 7]) ^ H2[ 4]); + + tmp2[ 0]+= Q[26] - Q[12]; + tmp2[ 1]+= Q[27] - Q[13]; + + Q[30] = rs1(Q[15])+rs2(Q[17])+rs3(Q[19])+rs4(Q[21])+rs5(Q[23])+rs6(Q[25])+rs7(Q[27])+ss4(Q[28])+ss5(Q[29])+tmp2[ 0]+((30U*(0x05555555) + tmp[14] + tmp[ 1] - tmp[ 8]) ^ H2[ 5]); + Q[31] = rs1(Q[16])+rs2(Q[18])+rs3(Q[20])+rs4(Q[22])+rs5(Q[24])+rs6(Q[26])+rs7(Q[28])+ss4(Q[29])+ss5(Q[30])+tmp2[ 1]+((31U*(0x05555555) + tmp[15] + tmp[ 2] - tmp[ 9]) ^ H2[ 6]); + + /* Blue Midnight Wish has two temporary cummulative variables that accumulate via XORing */ + /* 16 new variables that are produced in the Message Expansion part. */ + XL32 = Q[16] ^ Q[17] ^ Q[18] ^ Q[19] ^ Q[20] ^ Q[21] ^ Q[22] ^ Q[23]; + XH32 = XL32 ^ Q[24] ^ Q[25] ^ Q[26] ^ Q[27] ^ Q[28] ^ Q[29] ^ Q[30] ^ Q[31]; + + M32[ 3] = (M32[ 3] ^ shl(Q[19], 5) ^ shr(XH32, 1)) + (Q[27] ^ Q[ 3] ^ XL32); + M32[15] = ROL16(M32[ 3]) + (Q[31] ^ M32[15] ^ XH32) + (Q[22] ^ Q[15] ^ shr(XL32, 2)); + + if (M32[15] <= target.y){ + M32[ 2] = xor3x(shr(XH32, 5), shl(Q[18], 5), M32[ 2]) + xor3x(XL32, Q[26], Q[ 2]); + M32[14] = ROTL32(M32[ 2], 15) + xor3x(XH32, Q[30], M32[14]) + xor3x(shr(XL32, 7), Q[21], Q[14]); + if (M32[14] <= target.x){ + uint32_t tmp = atomicExch(&nonceVector[0], thread); + if (tmp != 0) + nonceVector[1] = tmp; + } + } + } +} + +__host__ +void bmw256_cpu_hash_32(int thr_id, uint32_t threads, uint2 *g_hash, uint32_t *resultnonces, const uint2 target) +{ + const dim3 grid((threads + TPB - 1) / TPB); + const dim3 block(TPB); + + bmw256_gpu_hash_32<<>>(threads, g_hash, d_GNonce[thr_id], target); +// cudaThreadSynchronize(); + cudaMemcpy(d_gnounce[thr_id], d_GNonce[thr_id], 2 * sizeof(uint32_t), cudaMemcpyDeviceToHost); + resultnonces[0] = *(d_gnounce[thr_id]); + resultnonces[1] = *(d_gnounce[thr_id] + 1); +} + + +__host__ +void bmw256_cpu_init(int thr_id) +{ + cudaMalloc(&d_GNonce[thr_id], 2 * sizeof(uint32_t)); + cudaMallocHost(&d_gnounce[thr_id], 2 * sizeof(uint32_t)); +} + +__host__ +void bmw_set_output(int thr_id) +{ + cudaMemset(d_GNonce[thr_id], 0, 2 * sizeof(uint32_t)); +} + +__host__ +void bmw256_cpu_free(int thr_id) +{ + cudaFree(d_GNonce[thr_id]); + cudaFreeHost(d_gnounce[thr_id]); +} diff --git a/Algo256/cuda_cubehash256.cu b/Algo256/cuda_cubehash256.cu new file mode 100644 index 0000000..e9a7f6b --- /dev/null +++ b/Algo256/cuda_cubehash256.cu @@ -0,0 +1,226 @@ +/* + Based upon Tanguy Pruvot's repo + Provos Alexis - 2016 +*/ + +#include "cuda_helper.h" +#include "miner.h" +#include "cuda_vectors.h" + +//#define SHUFFLE //<-- 2-way implementation of cubehash kernel, seems to be slightly better on certain gpus (or can be done), the rest will throttle + +#define SWAP(a,b) { uint32_t u = a; a = b; b = u; } +//#define SWAP(a,b) { a ^= b; b ^= a; a ^= b; } + +#if defined(SHUFFLE) + +#define TPB 1024 + +__device__ __forceinline__ +void rrounds(uint32_t *x){ + #pragma unroll 4 + for (int r = 0; r < 16; ++r) { + /* "add x_0jklm into x_1jklm modulo 2^32 rotate x_0jklm upwards by 7 bits" */ + x[ 8] += x[ 0]; x[ 9] += x[ 1]; + x[10] += x[ 2]; x[11] += x[ 3]; + x[12] += x[ 4]; x[13] += x[ 5]; + x[14] += x[ 6]; x[15] += x[ 7]; + x[ 0] = ROTL32(x[ 0], 7); + x[ 1] = ROTL32(x[ 1], 7); + x[ 2] = ROTL32(x[ 2], 7); + x[ 3] = ROTL32(x[ 3], 7); + x[ 4] = ROTL32(x[ 4], 7); + x[ 5] = ROTL32(x[ 5], 7); + x[ 6] = ROTL32(x[ 6], 7); + x[ 7] = ROTL32(x[ 7], 7); + /* "swap x_00klm with x_01klm" */ + SWAP(x[ 0], x[ 4]); SWAP(x[ 1], x[ 5]); + SWAP(x[ 2], x[ 6]); SWAP(x[ 3], x[ 7]); + + x[ 0] ^= x[ 8]; x[ 4] ^= x[12]; + x[ 1] ^= x[ 9]; x[ 5] ^= x[13]; + x[ 2] ^= x[10]; x[ 6] ^= x[14]; + x[ 3] ^= x[11]; x[ 7] ^= x[15]; + /* "swap x_1jk0m with x_1jk1m" */ + SWAP(x[ 8],x[10]); SWAP(x[ 9],x[11]); + SWAP(x[12],x[14]); SWAP(x[13],x[15]); + /* "add x_0jklm into x_1jklm modulo 2^32 rotate x_0jklm upwards by 11 bits" */ + x[ 8] += x[ 0]; x[ 9] += x[ 1]; + x[10] += x[ 2]; x[11] += x[ 3]; + x[12] += x[ 4]; x[13] += x[ 5]; + x[14] += x[ 6]; x[15] += x[ 7]; + x[ 0] = ROTL32(x[ 0],11); + x[ 1] = ROTL32(x[ 1],11); + x[ 2] = ROTL32(x[ 2],11); + x[ 3] = ROTL32(x[ 3],11); + x[ 4] = ROTL32(x[ 4],11); + x[ 5] = ROTL32(x[ 5],11); + x[ 6] = ROTL32(x[ 6],11); + x[ 7] = ROTL32(x[ 7],11); + /* "swap x_0j0lm with x_0j1lm" */ + x[ 0] = __shfl(x[ 0],threadIdx.x^1); + x[ 1] = __shfl(x[ 1],threadIdx.x^1); + x[ 2] = __shfl(x[ 2],threadIdx.x^1); + x[ 3] = __shfl(x[ 3],threadIdx.x^1); + x[ 4] = __shfl(x[ 4],threadIdx.x^1); + x[ 5] = __shfl(x[ 5],threadIdx.x^1); + x[ 6] = __shfl(x[ 6],threadIdx.x^1); + x[ 7] = __shfl(x[ 7],threadIdx.x^1); + + x[ 0] ^= x[ 8]; x[ 1] ^= x[ 9]; + x[ 2] ^= x[10]; x[ 3] ^= x[11]; + x[ 4] ^= x[12]; x[ 5] ^= x[13]; + x[ 6] ^= x[14]; x[ 7] ^= x[15]; + /* "swap x_1jkl0 with x_1jkl1" */ + SWAP(x[ 8],x[ 9]); SWAP(x[10],x[11]); + SWAP(x[12],x[13]); SWAP(x[14],x[15]); + } +} +__global__ __launch_bounds__(TPB, 1) +void cubehash256_gpu_hash_32(uint32_t threads, uint2* g_hash){ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x)>>1; + + const uint32_t even = (threadIdx.x & 1); + + if (thread < threads){ + uint2 Hash[ 2]; + + Hash[ 0] = __ldg(&g_hash[thread + (2*even+0) * threads]); //((2*lid)+1) + Hash[ 1] = __ldg(&g_hash[thread + (2*even+1) * threads]); + + uint32_t x[16]; + if(even==0){ + x[ 0] = 0xEA2BD4B4; x[ 1] = 0xCCD6F29F; x[ 2] = 0x63117E71; x[ 3] = 0x35481EAE; + x[ 4] = 0xC2D0B696; x[ 5] = 0x42AF2070; x[ 6] = 0xD0720C35; x[ 7] = 0x3361DA8C; + x[ 8] = 0xD89041C3; x[ 9] = 0x6107FBD5; x[10] = 0x6C859D41; x[11] = 0xF0B26679; + x[12] = 0x2AF2B5AE; x[13] = 0x9E4B4E60; x[14] = 0x774ABFDD; x[15] = 0x85254725; + }else{ + x[ 0] = 0x22512D5B; x[ 1] = 0xE5D94E63; x[ 2] = 0x7E624131; x[ 3] = 0xF4CC12BE; + x[ 4] = 0x28CCECA4; x[ 5] = 0x8EF8AD83; x[ 6] = 0x4680AC00; x[ 7] = 0x40E5FBAB; + x[ 8] = 0x09392549; x[ 9] = 0x5FA25603; x[10] = 0x65C892FD; x[11] = 0x93CB6285; + x[12] = 0x15815AEB; x[13] = 0x4AB6AAD6; x[14] = 0x9CDAF8AF; x[15] = 0xD6032C0A; + } + x[ 0] ^= Hash[ 0].x; x[ 1] ^= Hash[ 0].y; + x[ 2] ^= Hash[ 1].x; x[ 3] ^= Hash[ 1].y; + + rrounds(x); + + if(!even) + x[ 0] ^= 0x80U; + + rrounds(x); + /* "the integer 1 is xored into the last state word x_11111" */ + if(even) + x[15] ^= 1U; + + #pragma unroll 10 + for (int i = 0; i < 10; ++i) + rrounds(x); + + g_hash[thread + (2*even+0) * threads] = *(uint2*)&x[ 0]; + g_hash[thread + (2*even+1) * threads] = *(uint2*)&x[ 2]; + } +} +__host__ +void cubehash256_cpu_hash_32(const uint32_t threads, uint2* d_hash){ + dim3 grid(((threads * 2 + TPB-1)/TPB)); + dim3 block(TPB); + cubehash256_gpu_hash_32 <<>> (threads, d_hash); +} + +#else + +#define TPB 768 + +__device__ __forceinline__ +void rrounds(uint32_t *x){ + #pragma unroll 2 + for (int r = 0; r < 16; r++) { + /* "add x_0jklm into x_1jklmn modulo 2^32 rotate x_0jklm upwards by 7 bits" */ + x[16] = x[16] + x[ 0]; x[ 0] = ROTL32(x[ 0], 7);x[17] = x[17] + x[ 1];x[ 1] = ROTL32(x[ 1], 7); + x[18] = x[18] + x[ 2]; x[ 2] = ROTL32(x[ 2], 7);x[19] = x[19] + x[ 3];x[ 3] = ROTL32(x[ 3], 7); + x[20] = x[20] + x[ 4]; x[ 4] = ROTL32(x[ 4], 7);x[21] = x[21] + x[ 5];x[ 5] = ROTL32(x[ 5], 7); + x[22] = x[22] + x[ 6]; x[ 6] = ROTL32(x[ 6], 7);x[23] = x[23] + x[ 7];x[ 7] = ROTL32(x[ 7], 7); + x[24] = x[24] + x[ 8]; x[ 8] = ROTL32(x[ 8], 7);x[25] = x[25] + x[ 9];x[ 9] = ROTL32(x[ 9], 7); + x[26] = x[26] + x[10]; x[10] = ROTL32(x[10], 7);x[27] = x[27] + x[11];x[11] = ROTL32(x[11], 7); + x[28] = x[28] + x[12]; x[12] = ROTL32(x[12], 7);x[29] = x[29] + x[13];x[13] = ROTL32(x[13], 7); + x[30] = x[30] + x[14]; x[14] = ROTL32(x[14], 7);x[31] = x[31] + x[15];x[15] = ROTL32(x[15], 7); + /* "swap x_00klm with x_01klm" */ + /* "swap x_1jk0m with x_1jk1m" */ + SWAP(x[ 0], x[ 8]);SWAP(x[ 1], x[ 9]);x[ 0] ^= x[16];x[ 8] ^= x[24];x[ 1] ^= x[17];x[ 9] ^= x[25]; + SWAP(x[ 2], x[10]);SWAP(x[ 3], x[11]);x[ 2] ^= x[18];x[10] ^= x[26];x[ 3] ^= x[19];x[11] ^= x[27]; + SWAP(x[ 4], x[12]);SWAP(x[ 5], x[13]);x[ 4] ^= x[20];x[12] ^= x[28];x[ 5] ^= x[21];x[13] ^= x[29]; + SWAP(x[ 6], x[14]);SWAP(x[ 7], x[15]);x[ 6] ^= x[22];x[14] ^= x[30];x[ 7] ^= x[23];x[15] ^= x[31]; + SWAP(x[16], x[18]); + SWAP(x[17], x[19]); + SWAP(x[24], x[26]); + SWAP(x[25], x[27]); + SWAP(x[20], x[22]); + SWAP(x[21], x[23]); + SWAP(x[28], x[30]); + SWAP(x[29], x[31]); + /* "add x_0jklm into x_1jklm modulo 2^32 rotate x_0jklm upwards by 11 bits" */ + x[16] = x[16] + x[ 0]; x[ 0] = ROTL32(x[ 0],11);x[17] = x[17] + x[ 1];x[ 1] = ROTL32(x[ 1],11); + x[18] = x[18] + x[ 2]; x[ 2] = ROTL32(x[ 2],11);x[19] = x[19] + x[ 3];x[ 3] = ROTL32(x[ 3],11); + x[20] = x[20] + x[ 4]; x[ 4] = ROTL32(x[ 4],11);x[21] = x[21] + x[ 5];x[ 5] = ROTL32(x[ 5],11); + x[22] = x[22] + x[ 6]; x[ 6] = ROTL32(x[ 6],11);x[23] = x[23] + x[ 7];x[ 7] = ROTL32(x[ 7],11); + x[24] = x[24] + x[ 8]; x[ 8] = ROTL32(x[ 8],11);x[25] = x[25] + x[ 9];x[ 9] = ROTL32(x[ 9],11); + x[26] = x[26] + x[10]; x[10] = ROTL32(x[10],11);x[27] = x[27] + x[11];x[11] = ROTL32(x[11],11); + x[28] = x[28] + x[12]; x[12] = ROTL32(x[12],11);x[29] = x[29] + x[13];x[13] = ROTL32(x[13],11); + x[30] = x[30] + x[14]; x[14] = ROTL32(x[14],11);x[31] = x[31] + x[15];x[15] = ROTL32(x[15],11); + /* "swap x_0j0lm with x_0j1lm" */ + SWAP(x[ 0], x[ 4]);SWAP(x[ 1], x[ 5]); x[ 0] ^= x[16]; x[ 4] ^= x[20]; x[ 1] ^= x[17]; x[ 5] ^= x[21]; + SWAP(x[ 2], x[ 6]);SWAP(x[ 3], x[ 7]); x[ 2] ^= x[18]; x[ 6] ^= x[22]; x[ 3] ^= x[19]; x[ 7] ^= x[23]; + SWAP(x[ 8], x[12]);SWAP(x[ 9], x[13]); x[ 8] ^= x[24]; x[12] ^= x[28]; x[ 9] ^= x[25]; x[13] ^= x[29]; + SWAP(x[10], x[14]);SWAP(x[11], x[15]); x[10] ^= x[26]; x[14] ^= x[30]; x[11] ^= x[27]; x[15] ^= x[31]; + /* "swap x_1jkl0 with x_1jkl1" */ + SWAP(x[16], x[17]); + SWAP(x[18], x[19]); SWAP(x[20], x[21]); SWAP(x[22], x[23]);SWAP(x[24], x[25]); SWAP(x[26], x[27]); SWAP(x[28], x[29]); SWAP(x[30], x[31]); + } +} +__global__ __launch_bounds__(TPB,1) +void cubehash256_gpu_hash_32(const uint32_t threads, uint2* g_hash){ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread >= threads)return; + + uint2 Hash[ 4]; + + Hash[ 0] = __ldg(&g_hash[thread]); + Hash[ 1] = __ldg(&g_hash[thread + 1 * threads]); + Hash[ 2] = __ldg(&g_hash[thread + 2 * threads]); + Hash[ 3] = __ldg(&g_hash[thread + 3 * threads]); + + uint32_t x[32] = { + 0xEA2BD4B4, 0xCCD6F29F, 0x63117E71, 0x35481EAE, 0x22512D5B, 0xE5D94E63, 0x7E624131, 0xF4CC12BE, + 0xC2D0B696, 0x42AF2070, 0xD0720C35, 0x3361DA8C, 0x28CCECA4, 0x8EF8AD83, 0x4680AC00, 0x40E5FBAB, + 0xD89041C3, 0x6107FBD5, 0x6C859D41, 0xF0B26679, 0x09392549, 0x5FA25603, 0x65C892FD, 0x93CB6285, + 0x2AF2B5AE, 0x9E4B4E60, 0x774ABFDD, 0x85254725, 0x15815AEB, 0x4AB6AAD6, 0x9CDAF8AF, 0xD6032C0A + }; + + *(uint2x4*)&x[ 0] ^= *(uint2x4*)&Hash[ 0]; + + rrounds(x); + x[ 0] ^= 0x80U; + rrounds(x); + + /* "the integer 1 is xored into the last state word x_11111" */ + x[31] ^= 1U; + + #pragma unroll + for (int i = 0; i < 10; ++i)rrounds(x); + + g_hash[thread] = make_uint2(x[ 0],x[ 1]); + g_hash[1 * threads + thread] = make_uint2(x[ 2],x[ 3]); + g_hash[2 * threads + thread] = make_uint2(x[ 4],x[ 5]); + g_hash[3 * threads + thread] = make_uint2(x[ 6],x[ 7]); +} + +__host__ +void cubehash256_cpu_hash_32(const uint32_t threads, uint2* d_hash){ + dim3 grid((threads + TPB-1)/TPB); + dim3 block(TPB); + cubehash256_gpu_hash_32 <<>> (threads, d_hash); +} + +#endif diff --git a/Algo256/cuda_groestl256.cu b/Algo256/cuda_groestl256.cu new file mode 100644 index 0000000..962fa86 --- /dev/null +++ b/Algo256/cuda_groestl256.cu @@ -0,0 +1,390 @@ +#include "cuda_helper.h" + +#define TPB 256 + +static uint32_t *h_GNonces[MAX_GPUS]; +static uint32_t *d_GNonces[MAX_GPUS]; + +__constant__ uint32_t pTarget[8]; + +__device__ static uint32_t T0up[] = { + 0xA5F432C6, 0x84976FF8, 0x99B05EEE, 0x8D8C7AF6, 0x0D17E8FF, 0xBDDC0AD6, 0xB1C816DE, 0x54FC6D91, 0x50F09060, 0x03050702, 0xA9E02ECE, 0x7D87D156, 0x192BCCE7, 0x62A613B5, 0xE6317C4D, 0x9AB559EC, + 0x45CF408F, 0x9DBCA31F, 0x40C04989, 0x879268FA, 0x153FD0EF, 0xEB2694B2, 0xC940CE8E, 0x0B1DE6FB, 0xEC2F6E41, 0x67A91AB3, 0xFD1C435F, 0xEA256045, 0xBFDAF923, 0xF7025153, 0x96A145E4, 0x5BED769B, + 0xC25D2875, 0x1C24C5E1, 0xAEE9D43D, 0x6ABEF24C, 0x5AEE826C, 0x41C3BD7E, 0x0206F3F5, 0x4FD15283, 0x5CE48C68, 0xF4075651, 0x345C8DD1, 0x0818E1F9, 0x93AE4CE2, 0x73953EAB, 0x53F59762, 0x3F416B2A, + 0x0C141C08, 0x52F66395, 0x65AFE946, 0x5EE27F9D, 0x28784830, 0xA1F8CF37, 0x0F111B0A, 0xB5C4EB2F, 0x091B150E, 0x365A7E24, 0x9BB6AD1B, 0x3D4798DF, 0x266AA7CD, 0x69BBF54E, 0xCD4C337F, 0x9FBA50EA, + 0x1B2D3F12, 0x9EB9A41D, 0x749CC458, 0x2E724634, 0x2D774136, 0xB2CD11DC, 0xEE299DB4, 0xFB164D5B, 0xF601A5A4, 0x4DD7A176, 0x61A314B7, 0xCE49347D, 0x7B8DDF52, 0x3E429FDD, 0x7193CD5E, 0x97A2B113, + 0xF504A2A6, 0x68B801B9, 0x00000000, 0x2C74B5C1, 0x60A0E040, 0x1F21C2E3, 0xC8433A79, 0xED2C9AB6, 0xBED90DD4, 0x46CA478D, 0xD9701767, 0x4BDDAF72, 0xDE79ED94, 0xD467FF98, 0xE82393B0, 0x4ADE5B85, + 0x6BBD06BB, 0x2A7EBBC5, 0xE5347B4F, 0x163AD7ED, 0xC554D286, 0xD762F89A, 0x55FF9966, 0x94A7B611, 0xCF4AC08A, 0x1030D9E9, 0x060A0E04, 0x819866FE, 0xF00BABA0, 0x44CCB478, 0xBAD5F025, 0xE33E754B, + 0xF30EACA2, 0xFE19445D, 0xC05BDB80, 0x8A858005, 0xADECD33F, 0xBCDFFE21, 0x48D8A870, 0x040CFDF1, 0xDF7A1963, 0xC1582F77, 0x759F30AF, 0x63A5E742, 0x30507020, 0x1A2ECBE5, 0x0E12EFFD, 0x6DB708BF, + 0x4CD45581, 0x143C2418, 0x355F7926, 0x2F71B2C3, 0xE13886BE, 0xA2FDC835, 0xCC4FC788, 0x394B652E, 0x57F96A93, 0xF20D5855, 0x829D61FC, 0x47C9B37A, 0xACEF27C8, 0xE73288BA, 0x2B7D4F32, 0x95A442E6, + 0xA0FB3BC0, 0x98B3AA19, 0xD168F69E, 0x7F8122A3, 0x66AAEE44, 0x7E82D654, 0xABE6DD3B, 0x839E950B, 0xCA45C98C, 0x297BBCC7, 0xD36E056B, 0x3C446C28, 0x798B2CA7, 0xE23D81BC, 0x1D273116, 0x769A37AD, + 0x3B4D96DB, 0x56FA9E64, 0x4ED2A674, 0x1E223614, 0xDB76E492, 0x0A1E120C, 0x6CB4FC48, 0xE4378FB8, 0x5DE7789F, 0x6EB20FBD, 0xEF2A6943, 0xA6F135C4, 0xA8E3DA39, 0xA4F7C631, 0x37598AD3, 0x8B8674F2, + 0x325683D5, 0x43C54E8B, 0x59EB856E, 0xB7C218DA, 0x8C8F8E01, 0x64AC1DB1, 0xD26DF19C, 0xE03B7249, 0xB4C71FD8, 0xFA15B9AC, 0x0709FAF3, 0x256FA0CF, 0xAFEA20CA, 0x8E897DF4, 0xE9206747, 0x18283810, + 0xD5640B6F, 0x888373F0, 0x6FB1FB4A, 0x7296CA5C, 0x246C5438, 0xF1085F57, 0xC7522173, 0x51F36497, 0x2365AECB, 0x7C8425A1, 0x9CBF57E8, 0x21635D3E, 0xDD7CEA96, 0xDC7F1E61, 0x86919C0D, 0x85949B0F, + 0x90AB4BE0, 0x42C6BA7C, 0xC4572671, 0xAAE529CC, 0xD873E390, 0x050F0906, 0x0103F4F7, 0x12362A1C, 0xA3FE3CC2, 0x5FE18B6A, 0xF910BEAE, 0xD06B0269, 0x91A8BF17, 0x58E87199, 0x2769533A, 0xB9D0F727, + 0x384891D9, 0x1335DEEB, 0xB3CEE52B, 0x33557722, 0xBBD604D2, 0x709039A9, 0x89808707, 0xA7F2C133, 0xB6C1EC2D, 0x22665A3C, 0x92ADB815, 0x2060A9C9, 0x49DB5C87, 0xFF1AB0AA, 0x7888D850, 0x7A8E2BA5, + 0x8F8A8903, 0xF8134A59, 0x809B9209, 0x1739231A, 0xDA751065, 0x315384D7, 0xC651D584, 0xB8D303D0, 0xC35EDC82, 0xB0CBE229, 0x7799C35A, 0x11332D1E, 0xCB463D7B, 0xFC1FB7A8, 0xD6610C6D, 0x3A4E622C +}; + +__device__ static uint32_t T0dn[] = { + 0xC6A597F4, 0xF884EB97, 0xEE99C7B0, 0xF68DF78C, 0xFF0DE517, 0xD6BDB7DC, 0xDEB1A7C8, 0x915439FC, 0x6050C0F0, 0x02030405, 0xCEA987E0, 0x567DAC87, 0xE719D52B, 0xB56271A6, 0x4DE69A31, 0xEC9AC3B5, + 0x8F4505CF, 0x1F9D3EBC, 0x894009C0, 0xFA87EF92, 0xEF15C53F, 0xB2EB7F26, 0x8EC90740, 0xFB0BED1D, 0x41EC822F, 0xB3677DA9, 0x5FFDBE1C, 0x45EA8A25, 0x23BF46DA, 0x53F7A602, 0xE496D3A1, 0x9B5B2DED, + 0x75C2EA5D, 0xE11CD924, 0x3DAE7AE9, 0x4C6A98BE, 0x6C5AD8EE, 0x7E41FCC3, 0xF502F106, 0x834F1DD1, 0x685CD0E4, 0x51F4A207, 0xD134B95C, 0xF908E918, 0xE293DFAE, 0xAB734D95, 0x6253C4F5, 0x2A3F5441, + 0x080C1014, 0x955231F6, 0x46658CAF, 0x9D5E21E2, 0x30286078, 0x37A16EF8, 0x0A0F1411, 0x2FB55EC4, 0x0E091C1B, 0x2436485A, 0x1B9B36B6, 0xDF3DA547, 0xCD26816A, 0x4E699CBB, 0x7FCDFE4C, 0xEA9FCFBA, + 0x121B242D, 0x1D9E3AB9, 0x5874B09C, 0x342E6872, 0x362D6C77, 0xDCB2A3CD, 0xB4EE7329, 0x5BFBB616, 0xA4F65301, 0x764DECD7, 0xB76175A3, 0x7DCEFA49, 0x527BA48D, 0xDD3EA142, 0x5E71BC93, 0x139726A2, + 0xA6F55704, 0xB96869B8, 0x00000000, 0xC12C9974, 0x406080A0, 0xE31FDD21, 0x79C8F243, 0xB6ED772C, 0xD4BEB3D9, 0x8D4601CA, 0x67D9CE70, 0x724BE4DD, 0x94DE3379, 0x98D42B67, 0xB0E87B23, 0x854A11DE, + 0xBB6B6DBD, 0xC52A917E, 0x4FE59E34, 0xED16C13A, 0x86C51754, 0x9AD72F62, 0x6655CCFF, 0x119422A7, 0x8ACF0F4A, 0xE910C930, 0x0406080A, 0xFE81E798, 0xA0F05B0B, 0x7844F0CC, 0x25BA4AD5, 0x4BE3963E, + 0xA2F35F0E, 0x5DFEBA19, 0x80C01B5B, 0x058A0A85, 0x3FAD7EEC, 0x21BC42DF, 0x7048E0D8, 0xF104F90C, 0x63DFC67A, 0x77C1EE58, 0xAF75459F, 0x426384A5, 0x20304050, 0xE51AD12E, 0xFD0EE112, 0xBF6D65B7, + 0x814C19D4, 0x1814303C, 0x26354C5F, 0xC32F9D71, 0xBEE16738, 0x35A26AFD, 0x88CC0B4F, 0x2E395C4B, 0x93573DF9, 0x55F2AA0D, 0xFC82E39D, 0x7A47F4C9, 0xC8AC8BEF, 0xBAE76F32, 0x322B647D, 0xE695D7A4, + 0xC0A09BFB, 0x199832B3, 0x9ED12768, 0xA37F5D81, 0x446688AA, 0x547EA882, 0x3BAB76E6, 0x0B83169E, 0x8CCA0345, 0xC729957B, 0x6BD3D66E, 0x283C5044, 0xA779558B, 0xBCE2633D, 0x161D2C27, 0xAD76419A, + 0xDB3BAD4D, 0x6456C8FA, 0x744EE8D2, 0x141E2822, 0x92DB3F76, 0x0C0A181E, 0x486C90B4, 0xB8E46B37, 0x9F5D25E7, 0xBD6E61B2, 0x43EF862A, 0xC4A693F1, 0x39A872E3, 0x31A462F7, 0xD337BD59, 0xF28BFF86, + 0xD532B156, 0x8B430DC5, 0x6E59DCEB, 0xDAB7AFC2, 0x018C028F, 0xB16479AC, 0x9CD2236D, 0x49E0923B, 0xD8B4ABC7, 0xACFA4315, 0xF307FD09, 0xCF25856F, 0xCAAF8FEA, 0xF48EF389, 0x47E98E20, 0x10182028, + 0x6FD5DE64, 0xF088FB83, 0x4A6F94B1, 0x5C72B896, 0x3824706C, 0x57F1AE08, 0x73C7E652, 0x975135F3, 0xCB238D65, 0xA17C5984, 0xE89CCBBF, 0x3E217C63, 0x96DD377C, 0x61DCC27F, 0x0D861A91, 0x0F851E94, + 0xE090DBAB, 0x7C42F8C6, 0x71C4E257, 0xCCAA83E5, 0x90D83B73, 0x06050C0F, 0xF701F503, 0x1C123836, 0xC2A39FFE, 0x6A5FD4E1, 0xAEF94710, 0x69D0D26B, 0x17912EA8, 0x995829E8, 0x3A277469, 0x27B94ED0, + 0xD938A948, 0xEB13CD35, 0x2BB356CE, 0x22334455, 0xD2BBBFD6, 0xA9704990, 0x07890E80, 0x33A766F2, 0x2DB65AC1, 0x3C227866, 0x15922AAD, 0xC9208960, 0x874915DB, 0xAAFF4F1A, 0x5078A088, 0xA57A518E, + 0x038F068A, 0x59F8B213, 0x0980129B, 0x1A173439, 0x65DACA75, 0xD731B553, 0x84C61351, 0xD0B8BBD3, 0x82C31F5E, 0x29B052CB, 0x5A77B499, 0x1E113C33, 0x7BCBF646, 0xA8FC4B1F, 0x6DD6DA61, 0x2C3A584E +}; + +__device__ static uint32_t T1up[] = { + 0xF432C6C6, 0x976FF8F8, 0xB05EEEEE, 0x8C7AF6F6, 0x17E8FFFF, 0xDC0AD6D6, 0xC816DEDE, 0xFC6D9191, 0xF0906060, 0x05070202, 0xE02ECECE, 0x87D15656, 0x2BCCE7E7, 0xA613B5B5, 0x317C4D4D, 0xB559ECEC, + 0xCF408F8F, 0xBCA31F1F, 0xC0498989, 0x9268FAFA, 0x3FD0EFEF, 0x2694B2B2, 0x40CE8E8E, 0x1DE6FBFB, 0x2F6E4141, 0xA91AB3B3, 0x1C435F5F, 0x25604545, 0xDAF92323, 0x02515353, 0xA145E4E4, 0xED769B9B, + 0x5D287575, 0x24C5E1E1, 0xE9D43D3D, 0xBEF24C4C, 0xEE826C6C, 0xC3BD7E7E, 0x06F3F5F5, 0xD1528383, 0xE48C6868, 0x07565151, 0x5C8DD1D1, 0x18E1F9F9, 0xAE4CE2E2, 0x953EABAB, 0xF5976262, 0x416B2A2A, + 0x141C0808, 0xF6639595, 0xAFE94646, 0xE27F9D9D, 0x78483030, 0xF8CF3737, 0x111B0A0A, 0xC4EB2F2F, 0x1B150E0E, 0x5A7E2424, 0xB6AD1B1B, 0x4798DFDF, 0x6AA7CDCD, 0xBBF54E4E, 0x4C337F7F, 0xBA50EAEA, + 0x2D3F1212, 0xB9A41D1D, 0x9CC45858, 0x72463434, 0x77413636, 0xCD11DCDC, 0x299DB4B4, 0x164D5B5B, 0x01A5A4A4, 0xD7A17676, 0xA314B7B7, 0x49347D7D, 0x8DDF5252, 0x429FDDDD, 0x93CD5E5E, 0xA2B11313, + 0x04A2A6A6, 0xB801B9B9, 0x00000000, 0x74B5C1C1, 0xA0E04040, 0x21C2E3E3, 0x433A7979, 0x2C9AB6B6, 0xD90DD4D4, 0xCA478D8D, 0x70176767, 0xDDAF7272, 0x79ED9494, 0x67FF9898, 0x2393B0B0, 0xDE5B8585, + 0xBD06BBBB, 0x7EBBC5C5, 0x347B4F4F, 0x3AD7EDED, 0x54D28686, 0x62F89A9A, 0xFF996666, 0xA7B61111, 0x4AC08A8A, 0x30D9E9E9, 0x0A0E0404, 0x9866FEFE, 0x0BABA0A0, 0xCCB47878, 0xD5F02525, 0x3E754B4B, + 0x0EACA2A2, 0x19445D5D, 0x5BDB8080, 0x85800505, 0xECD33F3F, 0xDFFE2121, 0xD8A87070, 0x0CFDF1F1, 0x7A196363, 0x582F7777, 0x9F30AFAF, 0xA5E74242, 0x50702020, 0x2ECBE5E5, 0x12EFFDFD, 0xB708BFBF, + 0xD4558181, 0x3C241818, 0x5F792626, 0x71B2C3C3, 0x3886BEBE, 0xFDC83535, 0x4FC78888, 0x4B652E2E, 0xF96A9393, 0x0D585555, 0x9D61FCFC, 0xC9B37A7A, 0xEF27C8C8, 0x3288BABA, 0x7D4F3232, 0xA442E6E6, + 0xFB3BC0C0, 0xB3AA1919, 0x68F69E9E, 0x8122A3A3, 0xAAEE4444, 0x82D65454, 0xE6DD3B3B, 0x9E950B0B, 0x45C98C8C, 0x7BBCC7C7, 0x6E056B6B, 0x446C2828, 0x8B2CA7A7, 0x3D81BCBC, 0x27311616, 0x9A37ADAD, + 0x4D96DBDB, 0xFA9E6464, 0xD2A67474, 0x22361414, 0x76E49292, 0x1E120C0C, 0xB4FC4848, 0x378FB8B8, 0xE7789F9F, 0xB20FBDBD, 0x2A694343, 0xF135C4C4, 0xE3DA3939, 0xF7C63131, 0x598AD3D3, 0x8674F2F2, + 0x5683D5D5, 0xC54E8B8B, 0xEB856E6E, 0xC218DADA, 0x8F8E0101, 0xAC1DB1B1, 0x6DF19C9C, 0x3B724949, 0xC71FD8D8, 0x15B9ACAC, 0x09FAF3F3, 0x6FA0CFCF, 0xEA20CACA, 0x897DF4F4, 0x20674747, 0x28381010, + 0x640B6F6F, 0x8373F0F0, 0xB1FB4A4A, 0x96CA5C5C, 0x6C543838, 0x085F5757, 0x52217373, 0xF3649797, 0x65AECBCB, 0x8425A1A1, 0xBF57E8E8, 0x635D3E3E, 0x7CEA9696, 0x7F1E6161, 0x919C0D0D, 0x949B0F0F, + 0xAB4BE0E0, 0xC6BA7C7C, 0x57267171, 0xE529CCCC, 0x73E39090, 0x0F090606, 0x03F4F7F7, 0x362A1C1C, 0xFE3CC2C2, 0xE18B6A6A, 0x10BEAEAE, 0x6B026969, 0xA8BF1717, 0xE8719999, 0x69533A3A, 0xD0F72727, + 0x4891D9D9, 0x35DEEBEB, 0xCEE52B2B, 0x55772222, 0xD604D2D2, 0x9039A9A9, 0x80870707, 0xF2C13333, 0xC1EC2D2D, 0x665A3C3C, 0xADB81515, 0x60A9C9C9, 0xDB5C8787, 0x1AB0AAAA, 0x88D85050, 0x8E2BA5A5, + 0x8A890303, 0x134A5959, 0x9B920909, 0x39231A1A, 0x75106565, 0x5384D7D7, 0x51D58484, 0xD303D0D0, 0x5EDC8282, 0xCBE22929, 0x99C35A5A, 0x332D1E1E, 0x463D7B7B, 0x1FB7A8A8, 0x610C6D6D, 0x4E622C2C +}; + +__device__ static uint32_t T1dn[] = { + 0xA597F4A5, 0x84EB9784, 0x99C7B099, 0x8DF78C8D, 0x0DE5170D, 0xBDB7DCBD, 0xB1A7C8B1, 0x5439FC54, 0x50C0F050, 0x03040503, 0xA987E0A9, 0x7DAC877D, 0x19D52B19, 0x6271A662, 0xE69A31E6, 0x9AC3B59A, + 0x4505CF45, 0x9D3EBC9D, 0x4009C040, 0x87EF9287, 0x15C53F15, 0xEB7F26EB, 0xC90740C9, 0x0BED1D0B, 0xEC822FEC, 0x677DA967, 0xFDBE1CFD, 0xEA8A25EA, 0xBF46DABF, 0xF7A602F7, 0x96D3A196, 0x5B2DED5B, + 0xC2EA5DC2, 0x1CD9241C, 0xAE7AE9AE, 0x6A98BE6A, 0x5AD8EE5A, 0x41FCC341, 0x02F10602, 0x4F1DD14F, 0x5CD0E45C, 0xF4A207F4, 0x34B95C34, 0x08E91808, 0x93DFAE93, 0x734D9573, 0x53C4F553, 0x3F54413F, + 0x0C10140C, 0x5231F652, 0x658CAF65, 0x5E21E25E, 0x28607828, 0xA16EF8A1, 0x0F14110F, 0xB55EC4B5, 0x091C1B09, 0x36485A36, 0x9B36B69B, 0x3DA5473D, 0x26816A26, 0x699CBB69, 0xCDFE4CCD, 0x9FCFBA9F, + 0x1B242D1B, 0x9E3AB99E, 0x74B09C74, 0x2E68722E, 0x2D6C772D, 0xB2A3CDB2, 0xEE7329EE, 0xFBB616FB, 0xF65301F6, 0x4DECD74D, 0x6175A361, 0xCEFA49CE, 0x7BA48D7B, 0x3EA1423E, 0x71BC9371, 0x9726A297, + 0xF55704F5, 0x6869B868, 0x00000000, 0x2C99742C, 0x6080A060, 0x1FDD211F, 0xC8F243C8, 0xED772CED, 0xBEB3D9BE, 0x4601CA46, 0xD9CE70D9, 0x4BE4DD4B, 0xDE3379DE, 0xD42B67D4, 0xE87B23E8, 0x4A11DE4A, + 0x6B6DBD6B, 0x2A917E2A, 0xE59E34E5, 0x16C13A16, 0xC51754C5, 0xD72F62D7, 0x55CCFF55, 0x9422A794, 0xCF0F4ACF, 0x10C93010, 0x06080A06, 0x81E79881, 0xF05B0BF0, 0x44F0CC44, 0xBA4AD5BA, 0xE3963EE3, + 0xF35F0EF3, 0xFEBA19FE, 0xC01B5BC0, 0x8A0A858A, 0xAD7EECAD, 0xBC42DFBC, 0x48E0D848, 0x04F90C04, 0xDFC67ADF, 0xC1EE58C1, 0x75459F75, 0x6384A563, 0x30405030, 0x1AD12E1A, 0x0EE1120E, 0x6D65B76D, + 0x4C19D44C, 0x14303C14, 0x354C5F35, 0x2F9D712F, 0xE16738E1, 0xA26AFDA2, 0xCC0B4FCC, 0x395C4B39, 0x573DF957, 0xF2AA0DF2, 0x82E39D82, 0x47F4C947, 0xAC8BEFAC, 0xE76F32E7, 0x2B647D2B, 0x95D7A495, + 0xA09BFBA0, 0x9832B398, 0xD12768D1, 0x7F5D817F, 0x6688AA66, 0x7EA8827E, 0xAB76E6AB, 0x83169E83, 0xCA0345CA, 0x29957B29, 0xD3D66ED3, 0x3C50443C, 0x79558B79, 0xE2633DE2, 0x1D2C271D, 0x76419A76, + 0x3BAD4D3B, 0x56C8FA56, 0x4EE8D24E, 0x1E28221E, 0xDB3F76DB, 0x0A181E0A, 0x6C90B46C, 0xE46B37E4, 0x5D25E75D, 0x6E61B26E, 0xEF862AEF, 0xA693F1A6, 0xA872E3A8, 0xA462F7A4, 0x37BD5937, 0x8BFF868B, + 0x32B15632, 0x430DC543, 0x59DCEB59, 0xB7AFC2B7, 0x8C028F8C, 0x6479AC64, 0xD2236DD2, 0xE0923BE0, 0xB4ABC7B4, 0xFA4315FA, 0x07FD0907, 0x25856F25, 0xAF8FEAAF, 0x8EF3898E, 0xE98E20E9, 0x18202818, + 0xD5DE64D5, 0x88FB8388, 0x6F94B16F, 0x72B89672, 0x24706C24, 0xF1AE08F1, 0xC7E652C7, 0x5135F351, 0x238D6523, 0x7C59847C, 0x9CCBBF9C, 0x217C6321, 0xDD377CDD, 0xDCC27FDC, 0x861A9186, 0x851E9485, + 0x90DBAB90, 0x42F8C642, 0xC4E257C4, 0xAA83E5AA, 0xD83B73D8, 0x050C0F05, 0x01F50301, 0x12383612, 0xA39FFEA3, 0x5FD4E15F, 0xF94710F9, 0xD0D26BD0, 0x912EA891, 0x5829E858, 0x27746927, 0xB94ED0B9, + 0x38A94838, 0x13CD3513, 0xB356CEB3, 0x33445533, 0xBBBFD6BB, 0x70499070, 0x890E8089, 0xA766F2A7, 0xB65AC1B6, 0x22786622, 0x922AAD92, 0x20896020, 0x4915DB49, 0xFF4F1AFF, 0x78A08878, 0x7A518E7A, + 0x8F068A8F, 0xF8B213F8, 0x80129B80, 0x17343917, 0xDACA75DA, 0x31B55331, 0xC61351C6, 0xB8BBD3B8, 0xC31F5EC3, 0xB052CBB0, 0x77B49977, 0x113C3311, 0xCBF646CB, 0xFC4B1FFC, 0xD6DA61D6, 0x3A584E3A +}; + +__device__ static uint32_t T2up[] = { + 0x32C6C6A5, 0x6FF8F884, 0x5EEEEE99, 0x7AF6F68D, 0xE8FFFF0D, 0x0AD6D6BD, 0x16DEDEB1, 0x6D919154, 0x90606050, 0x07020203, 0x2ECECEA9, 0xD156567D, 0xCCE7E719, 0x13B5B562, 0x7C4D4DE6, 0x59ECEC9A, + 0x408F8F45, 0xA31F1F9D, 0x49898940, 0x68FAFA87, 0xD0EFEF15, 0x94B2B2EB, 0xCE8E8EC9, 0xE6FBFB0B, 0x6E4141EC, 0x1AB3B367, 0x435F5FFD, 0x604545EA, 0xF92323BF, 0x515353F7, 0x45E4E496, 0x769B9B5B, + 0x287575C2, 0xC5E1E11C, 0xD43D3DAE, 0xF24C4C6A, 0x826C6C5A, 0xBD7E7E41, 0xF3F5F502, 0x5283834F, 0x8C68685C, 0x565151F4, 0x8DD1D134, 0xE1F9F908, 0x4CE2E293, 0x3EABAB73, 0x97626253, 0x6B2A2A3F, + 0x1C08080C, 0x63959552, 0xE9464665, 0x7F9D9D5E, 0x48303028, 0xCF3737A1, 0x1B0A0A0F, 0xEB2F2FB5, 0x150E0E09, 0x7E242436, 0xAD1B1B9B, 0x98DFDF3D, 0xA7CDCD26, 0xF54E4E69, 0x337F7FCD, 0x50EAEA9F, + 0x3F12121B, 0xA41D1D9E, 0xC4585874, 0x4634342E, 0x4136362D, 0x11DCDCB2, 0x9DB4B4EE, 0x4D5B5BFB, 0xA5A4A4F6, 0xA176764D, 0x14B7B761, 0x347D7DCE, 0xDF52527B, 0x9FDDDD3E, 0xCD5E5E71, 0xB1131397, + 0xA2A6A6F5, 0x01B9B968, 0x00000000, 0xB5C1C12C, 0xE0404060, 0xC2E3E31F, 0x3A7979C8, 0x9AB6B6ED, 0x0DD4D4BE, 0x478D8D46, 0x176767D9, 0xAF72724B, 0xED9494DE, 0xFF9898D4, 0x93B0B0E8, 0x5B85854A, + 0x06BBBB6B, 0xBBC5C52A, 0x7B4F4FE5, 0xD7EDED16, 0xD28686C5, 0xF89A9AD7, 0x99666655, 0xB6111194, 0xC08A8ACF, 0xD9E9E910, 0x0E040406, 0x66FEFE81, 0xABA0A0F0, 0xB4787844, 0xF02525BA, 0x754B4BE3, + 0xACA2A2F3, 0x445D5DFE, 0xDB8080C0, 0x8005058A, 0xD33F3FAD, 0xFE2121BC, 0xA8707048, 0xFDF1F104, 0x196363DF, 0x2F7777C1, 0x30AFAF75, 0xE7424263, 0x70202030, 0xCBE5E51A, 0xEFFDFD0E, 0x08BFBF6D, + 0x5581814C, 0x24181814, 0x79262635, 0xB2C3C32F, 0x86BEBEE1, 0xC83535A2, 0xC78888CC, 0x652E2E39, 0x6A939357, 0x585555F2, 0x61FCFC82, 0xB37A7A47, 0x27C8C8AC, 0x88BABAE7, 0x4F32322B, 0x42E6E695, + 0x3BC0C0A0, 0xAA191998, 0xF69E9ED1, 0x22A3A37F, 0xEE444466, 0xD654547E, 0xDD3B3BAB, 0x950B0B83, 0xC98C8CCA, 0xBCC7C729, 0x056B6BD3, 0x6C28283C, 0x2CA7A779, 0x81BCBCE2, 0x3116161D, 0x37ADAD76, + 0x96DBDB3B, 0x9E646456, 0xA674744E, 0x3614141E, 0xE49292DB, 0x120C0C0A, 0xFC48486C, 0x8FB8B8E4, 0x789F9F5D, 0x0FBDBD6E, 0x694343EF, 0x35C4C4A6, 0xDA3939A8, 0xC63131A4, 0x8AD3D337, 0x74F2F28B, + 0x83D5D532, 0x4E8B8B43, 0x856E6E59, 0x18DADAB7, 0x8E01018C, 0x1DB1B164, 0xF19C9CD2, 0x724949E0, 0x1FD8D8B4, 0xB9ACACFA, 0xFAF3F307, 0xA0CFCF25, 0x20CACAAF, 0x7DF4F48E, 0x674747E9, 0x38101018, + 0x0B6F6FD5, 0x73F0F088, 0xFB4A4A6F, 0xCA5C5C72, 0x54383824, 0x5F5757F1, 0x217373C7, 0x64979751, 0xAECBCB23, 0x25A1A17C, 0x57E8E89C, 0x5D3E3E21, 0xEA9696DD, 0x1E6161DC, 0x9C0D0D86, 0x9B0F0F85, + 0x4BE0E090, 0xBA7C7C42, 0x267171C4, 0x29CCCCAA, 0xE39090D8, 0x09060605, 0xF4F7F701, 0x2A1C1C12, 0x3CC2C2A3, 0x8B6A6A5F, 0xBEAEAEF9, 0x026969D0, 0xBF171791, 0x71999958, 0x533A3A27, 0xF72727B9, + 0x91D9D938, 0xDEEBEB13, 0xE52B2BB3, 0x77222233, 0x04D2D2BB, 0x39A9A970, 0x87070789, 0xC13333A7, 0xEC2D2DB6, 0x5A3C3C22, 0xB8151592, 0xA9C9C920, 0x5C878749, 0xB0AAAAFF, 0xD8505078, 0x2BA5A57A, + 0x8903038F, 0x4A5959F8, 0x92090980, 0x231A1A17, 0x106565DA, 0x84D7D731, 0xD58484C6, 0x03D0D0B8, 0xDC8282C3, 0xE22929B0, 0xC35A5A77, 0x2D1E1E11, 0x3D7B7BCB, 0xB7A8A8FC, 0x0C6D6DD6, 0x622C2C3A +}; + +__device__ static uint32_t T2dn[] = { + 0x97F4A5F4, 0xEB978497, 0xC7B099B0, 0xF78C8D8C, 0xE5170D17, 0xB7DCBDDC, 0xA7C8B1C8, 0x39FC54FC, 0xC0F050F0, 0x04050305, 0x87E0A9E0, 0xAC877D87, 0xD52B192B, 0x71A662A6, 0x9A31E631, 0xC3B59AB5, + 0x05CF45CF, 0x3EBC9DBC, 0x09C040C0, 0xEF928792, 0xC53F153F, 0x7F26EB26, 0x0740C940, 0xED1D0B1D, 0x822FEC2F, 0x7DA967A9, 0xBE1CFD1C, 0x8A25EA25, 0x46DABFDA, 0xA602F702, 0xD3A196A1, 0x2DED5BED, + 0xEA5DC25D, 0xD9241C24, 0x7AE9AEE9, 0x98BE6ABE, 0xD8EE5AEE, 0xFCC341C3, 0xF1060206, 0x1DD14FD1, 0xD0E45CE4, 0xA207F407, 0xB95C345C, 0xE9180818, 0xDFAE93AE, 0x4D957395, 0xC4F553F5, 0x54413F41, + 0x10140C14, 0x31F652F6, 0x8CAF65AF, 0x21E25EE2, 0x60782878, 0x6EF8A1F8, 0x14110F11, 0x5EC4B5C4, 0x1C1B091B, 0x485A365A, 0x36B69BB6, 0xA5473D47, 0x816A266A, 0x9CBB69BB, 0xFE4CCD4C, 0xCFBA9FBA, + 0x242D1B2D, 0x3AB99EB9, 0xB09C749C, 0x68722E72, 0x6C772D77, 0xA3CDB2CD, 0x7329EE29, 0xB616FB16, 0x5301F601, 0xECD74DD7, 0x75A361A3, 0xFA49CE49, 0xA48D7B8D, 0xA1423E42, 0xBC937193, 0x26A297A2, + 0x5704F504, 0x69B868B8, 0x00000000, 0x99742C74, 0x80A060A0, 0xDD211F21, 0xF243C843, 0x772CED2C, 0xB3D9BED9, 0x01CA46CA, 0xCE70D970, 0xE4DD4BDD, 0x3379DE79, 0x2B67D467, 0x7B23E823, 0x11DE4ADE, + 0x6DBD6BBD, 0x917E2A7E, 0x9E34E534, 0xC13A163A, 0x1754C554, 0x2F62D762, 0xCCFF55FF, 0x22A794A7, 0x0F4ACF4A, 0xC9301030, 0x080A060A, 0xE7988198, 0x5B0BF00B, 0xF0CC44CC, 0x4AD5BAD5, 0x963EE33E, + 0x5F0EF30E, 0xBA19FE19, 0x1B5BC05B, 0x0A858A85, 0x7EECADEC, 0x42DFBCDF, 0xE0D848D8, 0xF90C040C, 0xC67ADF7A, 0xEE58C158, 0x459F759F, 0x84A563A5, 0x40503050, 0xD12E1A2E, 0xE1120E12, 0x65B76DB7, + 0x19D44CD4, 0x303C143C, 0x4C5F355F, 0x9D712F71, 0x6738E138, 0x6AFDA2FD, 0x0B4FCC4F, 0x5C4B394B, 0x3DF957F9, 0xAA0DF20D, 0xE39D829D, 0xF4C947C9, 0x8BEFACEF, 0x6F32E732, 0x647D2B7D, 0xD7A495A4, + 0x9BFBA0FB, 0x32B398B3, 0x2768D168, 0x5D817F81, 0x88AA66AA, 0xA8827E82, 0x76E6ABE6, 0x169E839E, 0x0345CA45, 0x957B297B, 0xD66ED36E, 0x50443C44, 0x558B798B, 0x633DE23D, 0x2C271D27, 0x419A769A, + 0xAD4D3B4D, 0xC8FA56FA, 0xE8D24ED2, 0x28221E22, 0x3F76DB76, 0x181E0A1E, 0x90B46CB4, 0x6B37E437, 0x25E75DE7, 0x61B26EB2, 0x862AEF2A, 0x93F1A6F1, 0x72E3A8E3, 0x62F7A4F7, 0xBD593759, 0xFF868B86, + 0xB1563256, 0x0DC543C5, 0xDCEB59EB, 0xAFC2B7C2, 0x028F8C8F, 0x79AC64AC, 0x236DD26D, 0x923BE03B, 0xABC7B4C7, 0x4315FA15, 0xFD090709, 0x856F256F, 0x8FEAAFEA, 0xF3898E89, 0x8E20E920, 0x20281828, + 0xDE64D564, 0xFB838883, 0x94B16FB1, 0xB8967296, 0x706C246C, 0xAE08F108, 0xE652C752, 0x35F351F3, 0x8D652365, 0x59847C84, 0xCBBF9CBF, 0x7C632163, 0x377CDD7C, 0xC27FDC7F, 0x1A918691, 0x1E948594, + 0xDBAB90AB, 0xF8C642C6, 0xE257C457, 0x83E5AAE5, 0x3B73D873, 0x0C0F050F, 0xF5030103, 0x38361236, 0x9FFEA3FE, 0xD4E15FE1, 0x4710F910, 0xD26BD06B, 0x2EA891A8, 0x29E858E8, 0x74692769, 0x4ED0B9D0, + 0xA9483848, 0xCD351335, 0x56CEB3CE, 0x44553355, 0xBFD6BBD6, 0x49907090, 0x0E808980, 0x66F2A7F2, 0x5AC1B6C1, 0x78662266, 0x2AAD92AD, 0x89602060, 0x15DB49DB, 0x4F1AFF1A, 0xA0887888, 0x518E7A8E, + 0x068A8F8A, 0xB213F813, 0x129B809B, 0x34391739, 0xCA75DA75, 0xB5533153, 0x1351C651, 0xBBD3B8D3, 0x1F5EC35E, 0x52CBB0CB, 0xB4997799, 0x3C331133, 0xF646CB46, 0x4B1FFC1F, 0xDA61D661, 0x584E3A4E +}; + +__device__ static uint32_t T3up[] = { + 0xC6C6A597, 0xF8F884EB, 0xEEEE99C7, 0xF6F68DF7, 0xFFFF0DE5, 0xD6D6BDB7, 0xDEDEB1A7, 0x91915439, 0x606050C0, 0x02020304, 0xCECEA987, 0x56567DAC, 0xE7E719D5, 0xB5B56271, 0x4D4DE69A, 0xECEC9AC3, + 0x8F8F4505, 0x1F1F9D3E, 0x89894009, 0xFAFA87EF, 0xEFEF15C5, 0xB2B2EB7F, 0x8E8EC907, 0xFBFB0BED, 0x4141EC82, 0xB3B3677D, 0x5F5FFDBE, 0x4545EA8A, 0x2323BF46, 0x5353F7A6, 0xE4E496D3, 0x9B9B5B2D, + 0x7575C2EA, 0xE1E11CD9, 0x3D3DAE7A, 0x4C4C6A98, 0x6C6C5AD8, 0x7E7E41FC, 0xF5F502F1, 0x83834F1D, 0x68685CD0, 0x5151F4A2, 0xD1D134B9, 0xF9F908E9, 0xE2E293DF, 0xABAB734D, 0x626253C4, 0x2A2A3F54, + 0x08080C10, 0x95955231, 0x4646658C, 0x9D9D5E21, 0x30302860, 0x3737A16E, 0x0A0A0F14, 0x2F2FB55E, 0x0E0E091C, 0x24243648, 0x1B1B9B36, 0xDFDF3DA5, 0xCDCD2681, 0x4E4E699C, 0x7F7FCDFE, 0xEAEA9FCF, + 0x12121B24, 0x1D1D9E3A, 0x585874B0, 0x34342E68, 0x36362D6C, 0xDCDCB2A3, 0xB4B4EE73, 0x5B5BFBB6, 0xA4A4F653, 0x76764DEC, 0xB7B76175, 0x7D7DCEFA, 0x52527BA4, 0xDDDD3EA1, 0x5E5E71BC, 0x13139726, + 0xA6A6F557, 0xB9B96869, 0x00000000, 0xC1C12C99, 0x40406080, 0xE3E31FDD, 0x7979C8F2, 0xB6B6ED77, 0xD4D4BEB3, 0x8D8D4601, 0x6767D9CE, 0x72724BE4, 0x9494DE33, 0x9898D42B, 0xB0B0E87B, 0x85854A11, + 0xBBBB6B6D, 0xC5C52A91, 0x4F4FE59E, 0xEDED16C1, 0x8686C517, 0x9A9AD72F, 0x666655CC, 0x11119422, 0x8A8ACF0F, 0xE9E910C9, 0x04040608, 0xFEFE81E7, 0xA0A0F05B, 0x787844F0, 0x2525BA4A, 0x4B4BE396, + 0xA2A2F35F, 0x5D5DFEBA, 0x8080C01B, 0x05058A0A, 0x3F3FAD7E, 0x2121BC42, 0x707048E0, 0xF1F104F9, 0x6363DFC6, 0x7777C1EE, 0xAFAF7545, 0x42426384, 0x20203040, 0xE5E51AD1, 0xFDFD0EE1, 0xBFBF6D65, + 0x81814C19, 0x18181430, 0x2626354C, 0xC3C32F9D, 0xBEBEE167, 0x3535A26A, 0x8888CC0B, 0x2E2E395C, 0x9393573D, 0x5555F2AA, 0xFCFC82E3, 0x7A7A47F4, 0xC8C8AC8B, 0xBABAE76F, 0x32322B64, 0xE6E695D7, + 0xC0C0A09B, 0x19199832, 0x9E9ED127, 0xA3A37F5D, 0x44446688, 0x54547EA8, 0x3B3BAB76, 0x0B0B8316, 0x8C8CCA03, 0xC7C72995, 0x6B6BD3D6, 0x28283C50, 0xA7A77955, 0xBCBCE263, 0x16161D2C, 0xADAD7641, + 0xDBDB3BAD, 0x646456C8, 0x74744EE8, 0x14141E28, 0x9292DB3F, 0x0C0C0A18, 0x48486C90, 0xB8B8E46B, 0x9F9F5D25, 0xBDBD6E61, 0x4343EF86, 0xC4C4A693, 0x3939A872, 0x3131A462, 0xD3D337BD, 0xF2F28BFF, + 0xD5D532B1, 0x8B8B430D, 0x6E6E59DC, 0xDADAB7AF, 0x01018C02, 0xB1B16479, 0x9C9CD223, 0x4949E092, 0xD8D8B4AB, 0xACACFA43, 0xF3F307FD, 0xCFCF2585, 0xCACAAF8F, 0xF4F48EF3, 0x4747E98E, 0x10101820, + 0x6F6FD5DE, 0xF0F088FB, 0x4A4A6F94, 0x5C5C72B8, 0x38382470, 0x5757F1AE, 0x7373C7E6, 0x97975135, 0xCBCB238D, 0xA1A17C59, 0xE8E89CCB, 0x3E3E217C, 0x9696DD37, 0x6161DCC2, 0x0D0D861A, 0x0F0F851E, + 0xE0E090DB, 0x7C7C42F8, 0x7171C4E2, 0xCCCCAA83, 0x9090D83B, 0x0606050C, 0xF7F701F5, 0x1C1C1238, 0xC2C2A39F, 0x6A6A5FD4, 0xAEAEF947, 0x6969D0D2, 0x1717912E, 0x99995829, 0x3A3A2774, 0x2727B94E, + 0xD9D938A9, 0xEBEB13CD, 0x2B2BB356, 0x22223344, 0xD2D2BBBF, 0xA9A97049, 0x0707890E, 0x3333A766, 0x2D2DB65A, 0x3C3C2278, 0x1515922A, 0xC9C92089, 0x87874915, 0xAAAAFF4F, 0x505078A0, 0xA5A57A51, + 0x03038F06, 0x5959F8B2, 0x09098012, 0x1A1A1734, 0x6565DACA, 0xD7D731B5, 0x8484C613, 0xD0D0B8BB, 0x8282C31F, 0x2929B052, 0x5A5A77B4, 0x1E1E113C, 0x7B7BCBF6, 0xA8A8FC4B, 0x6D6DD6DA, 0x2C2C3A58 +}; + +__device__ static uint32_t T3dn[] = { + 0xF4A5F432, 0x9784976F, 0xB099B05E, 0x8C8D8C7A, 0x170D17E8, 0xDCBDDC0A, 0xC8B1C816, 0xFC54FC6D, 0xF050F090, 0x05030507, 0xE0A9E02E, 0x877D87D1, 0x2B192BCC, 0xA662A613, 0x31E6317C, 0xB59AB559, + 0xCF45CF40, 0xBC9DBCA3, 0xC040C049, 0x92879268, 0x3F153FD0, 0x26EB2694, 0x40C940CE, 0x1D0B1DE6, 0x2FEC2F6E, 0xA967A91A, 0x1CFD1C43, 0x25EA2560, 0xDABFDAF9, 0x02F70251, 0xA196A145, 0xED5BED76, + 0x5DC25D28, 0x241C24C5, 0xE9AEE9D4, 0xBE6ABEF2, 0xEE5AEE82, 0xC341C3BD, 0x060206F3, 0xD14FD152, 0xE45CE48C, 0x07F40756, 0x5C345C8D, 0x180818E1, 0xAE93AE4C, 0x9573953E, 0xF553F597, 0x413F416B, + 0x140C141C, 0xF652F663, 0xAF65AFE9, 0xE25EE27F, 0x78287848, 0xF8A1F8CF, 0x110F111B, 0xC4B5C4EB, 0x1B091B15, 0x5A365A7E, 0xB69BB6AD, 0x473D4798, 0x6A266AA7, 0xBB69BBF5, 0x4CCD4C33, 0xBA9FBA50, + 0x2D1B2D3F, 0xB99EB9A4, 0x9C749CC4, 0x722E7246, 0x772D7741, 0xCDB2CD11, 0x29EE299D, 0x16FB164D, 0x01F601A5, 0xD74DD7A1, 0xA361A314, 0x49CE4934, 0x8D7B8DDF, 0x423E429F, 0x937193CD, 0xA297A2B1, + 0x04F504A2, 0xB868B801, 0x00000000, 0x742C74B5, 0xA060A0E0, 0x211F21C2, 0x43C8433A, 0x2CED2C9A, 0xD9BED90D, 0xCA46CA47, 0x70D97017, 0xDD4BDDAF, 0x79DE79ED, 0x67D467FF, 0x23E82393, 0xDE4ADE5B, + 0xBD6BBD06, 0x7E2A7EBB, 0x34E5347B, 0x3A163AD7, 0x54C554D2, 0x62D762F8, 0xFF55FF99, 0xA794A7B6, 0x4ACF4AC0, 0x301030D9, 0x0A060A0E, 0x98819866, 0x0BF00BAB, 0xCC44CCB4, 0xD5BAD5F0, 0x3EE33E75, + 0x0EF30EAC, 0x19FE1944, 0x5BC05BDB, 0x858A8580, 0xECADECD3, 0xDFBCDFFE, 0xD848D8A8, 0x0C040CFD, 0x7ADF7A19, 0x58C1582F, 0x9F759F30, 0xA563A5E7, 0x50305070, 0x2E1A2ECB, 0x120E12EF, 0xB76DB708, + 0xD44CD455, 0x3C143C24, 0x5F355F79, 0x712F71B2, 0x38E13886, 0xFDA2FDC8, 0x4FCC4FC7, 0x4B394B65, 0xF957F96A, 0x0DF20D58, 0x9D829D61, 0xC947C9B3, 0xEFACEF27, 0x32E73288, 0x7D2B7D4F, 0xA495A442, + 0xFBA0FB3B, 0xB398B3AA, 0x68D168F6, 0x817F8122, 0xAA66AAEE, 0x827E82D6, 0xE6ABE6DD, 0x9E839E95, 0x45CA45C9, 0x7B297BBC, 0x6ED36E05, 0x443C446C, 0x8B798B2C, 0x3DE23D81, 0x271D2731, 0x9A769A37, + 0x4D3B4D96, 0xFA56FA9E, 0xD24ED2A6, 0x221E2236, 0x76DB76E4, 0x1E0A1E12, 0xB46CB4FC, 0x37E4378F, 0xE75DE778, 0xB26EB20F, 0x2AEF2A69, 0xF1A6F135, 0xE3A8E3DA, 0xF7A4F7C6, 0x5937598A, 0x868B8674, + 0x56325683, 0xC543C54E, 0xEB59EB85, 0xC2B7C218, 0x8F8C8F8E, 0xAC64AC1D, 0x6DD26DF1, 0x3BE03B72, 0xC7B4C71F, 0x15FA15B9, 0x090709FA, 0x6F256FA0, 0xEAAFEA20, 0x898E897D, 0x20E92067, 0x28182838, + 0x64D5640B, 0x83888373, 0xB16FB1FB, 0x967296CA, 0x6C246C54, 0x08F1085F, 0x52C75221, 0xF351F364, 0x652365AE, 0x847C8425, 0xBF9CBF57, 0x6321635D, 0x7CDD7CEA, 0x7FDC7F1E, 0x9186919C, 0x9485949B, + 0xAB90AB4B, 0xC642C6BA, 0x57C45726, 0xE5AAE529, 0x73D873E3, 0x0F050F09, 0x030103F4, 0x3612362A, 0xFEA3FE3C, 0xE15FE18B, 0x10F910BE, 0x6BD06B02, 0xA891A8BF, 0xE858E871, 0x69276953, 0xD0B9D0F7, + 0x48384891, 0x351335DE, 0xCEB3CEE5, 0x55335577, 0xD6BBD604, 0x90709039, 0x80898087, 0xF2A7F2C1, 0xC1B6C1EC, 0x6622665A, 0xAD92ADB8, 0x602060A9, 0xDB49DB5C, 0x1AFF1AB0, 0x887888D8, 0x8E7A8E2B, + 0x8A8F8A89, 0x13F8134A, 0x9B809B92, 0x39173923, 0x75DA7510, 0x53315384, 0x51C651D5, 0xD3B8D303, 0x5EC35EDC, 0xCBB0CBE2, 0x997799C3, 0x3311332D, 0x46CB463D, 0x1FFC1FB7, 0x61D6610C, 0x4E3A4E62 +}; + +#define PC32up(j, r) ((uint32_t)((j) + (r))) +#define PC32dn(j, r) 0 +#define QC32up(j, r) 0xFFFFFFFF +#define QC32dn(j, r) (((uint32_t)(r) << 24) ^ (~((uint32_t)(j) << 24))) + +#define B32_0(x) __byte_perm(x, 0, 0x4440) //((x) & 0xFF) +#define B32_1(x) __byte_perm(x, 0, 0x4441) //(((x) >> 8) & 0xFF) +#define B32_2(x) __byte_perm(x, 0, 0x4442) //(((x) >> 16) & 0xFF) +#define B32_3(x) __byte_perm(x, 0, 0x4443) //((x) >> 24) + +//#define B32_0(x) ((x) & 0xFF) +//#define B32_1(x) bfe(x, 8, 8)//(((x) >> 8) & 0xFF) +//#define B32_2(x) bfe(x,16, 8)//(((x) >> 16) & 0xFF) +//#define B32_3(x) bfe(x,24, 8)//((x) >> 24) + +#define T0up(x) __ldg(&T0up[x]) +#define T0dn(x) mixtabs[1][x] +#define T1up(x) mixtabs[2][x] +#define T1dn(x) mixtabs[3][x] +#define T2up(x) mixtabs[4][x] +#define T2dn(x) __ldg(&T2dn[x]) +#define T3up(x) mixtabs[6][x] +#define T3dn(x) __ldg(&T3dn[x]) + + + +#define RSTT(d0, d1, a, b0, b1, b2, b3, b4, b5, b6, b7) do { \ + t[d0] = T0up(B32_0(a[b0]))^ T0dn(B32_0(a[b4]));\ + t[d0]^= T1up(B32_1(a[b1]));\ + t[d0]^= T1dn(B32_1(a[b5]));\ + t[d0]^= T2up(B32_2(a[b2]));\ + t[d0]^= T3up(B32_3(a[b3]));\ + t[d0]^= T2dn(B32_2(a[b6]));\ + t[d0]^= T3dn(B32_3(a[b7]));\ + t[d1] = T0dn(B32_0(a[b0])) ^ T1dn(B32_1(a[b1]));\ + t[d1]^= T2dn(B32_2(a[b2]));\ + t[d1]^= T0up(B32_0(a[b4]));\ + t[d1]^= T1up(B32_1(a[b5]));\ + t[d1]^= T2up(B32_2(a[b6]));\ + t[d1]^= T3up(B32_3(a[b7]));\ + t[d1]^= T3dn(B32_3(a[b3]));\ +} while (0) + +// t[d0] = T0up(B32_0(a[b0])) ^ xor3x(T1up(B32_1(a[b1])), T2up(B32_2(a[b2])), xor3x(T3up(B32_3(a[b3])), T0dn(B32_0(a[b4])), xor3x(T1dn(B32_1(a[b5])), T2dn(B32_2(a[b6])), T3dn(B32_3(a[b7]))))); +// t[d1] = T0dn(B32_0(a[b0])) ^ xor3x(T1dn(B32_1(a[b1])), T2dn(B32_2(a[b2])), xor3x(T3dn(B32_3(a[b3])), T0up(B32_0(a[b4])), xor3x(T1up(B32_1(a[b5])), T2up(B32_2(a[b6])), T3up(B32_3(a[b7]))))); + +__device__ __forceinline__ +void groestl256_perm_Q(uint32_t thread, uint32_t *a,const uint32_t mixtabs[8][256]) +{ + for (int r = 0; r<10; r++) + { + uint32_t t[16]; + + a[0x0] ^= QC32up(0x00, r); + a[0x1] ^= QC32dn(0x00, r); + a[0x2] ^= QC32up(0x10, r); + a[0x3] ^= QC32dn(0x10, r); + a[0x4] ^= QC32up(0x20, r); + a[0x5] ^= QC32dn(0x20, r); + a[0x6] ^= QC32up(0x30, r); + a[0x7] ^= QC32dn(0x30, r); + a[0x8] ^= QC32up(0x40, r); + a[0x9] ^= QC32dn(0x40, r); + a[0xA] ^= QC32up(0x50, r); + a[0xB] ^= QC32dn(0x50, r); + a[0xC] ^= QC32up(0x60, r); + a[0xD] ^= QC32dn(0x60, r); + a[0xE] ^= QC32up(0x70, r); + a[0xF] ^= QC32dn(0x70, r); + RSTT(0x0, 0x1, a, 0x2, 0x6, 0xA, 0xE, 0x1, 0x5, 0x9, 0xD); + RSTT(0x2, 0x3, a, 0x4, 0x8, 0xC, 0x0, 0x3, 0x7, 0xB, 0xF); + RSTT(0x4, 0x5, a, 0x6, 0xA, 0xE, 0x2, 0x5, 0x9, 0xD, 0x1); + RSTT(0x6, 0x7, a, 0x8, 0xC, 0x0, 0x4, 0x7, 0xB, 0xF, 0x3); + RSTT(0x8, 0x9, a, 0xA, 0xE, 0x2, 0x6, 0x9, 0xD, 0x1, 0x5); + RSTT(0xA, 0xB, a, 0xC, 0x0, 0x4, 0x8, 0xB, 0xF, 0x3, 0x7); + RSTT(0xC, 0xD, a, 0xE, 0x2, 0x6, 0xA, 0xD, 0x1, 0x5, 0x9); + RSTT(0xE, 0xF, a, 0x0, 0x4, 0x8, 0xC, 0xF, 0x3, 0x7, 0xB); + + #pragma unroll + for (int k = 0; k<16; k++) + a[k] = t[k]; + } +} + +__global__ __launch_bounds__(TPB,2) +void groestl256_gpu_hash_32(uint32_t threads, uint32_t startNounce, uint2 *d_Hash, uint32_t *resNonces) +{ + __shared__ uint32_t mixtabs[8][256]; + + mixtabs[0][threadIdx.x] = __ldg(&T0up[threadIdx.x]); + mixtabs[1][threadIdx.x] = __ldg(&T0dn[threadIdx.x]); + mixtabs[2][threadIdx.x] = __ldg(&T1up[threadIdx.x]); + mixtabs[3][threadIdx.x] = __ldg(&T1dn[threadIdx.x]); + mixtabs[4][threadIdx.x] = __ldg(&T2up[threadIdx.x]); + mixtabs[5][threadIdx.x] = __ldg(&T2dn[threadIdx.x]); + mixtabs[6][threadIdx.x] = __ldg(&T3up[threadIdx.x]); + mixtabs[7][threadIdx.x] = __ldg(&T3dn[threadIdx.x]); + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + const uint32_t nonce = startNounce + thread; + uint32_t t[16]; + + // GROESTL + uint32_t message[16] = { 0 }; + uint32_t state[16]; + + #pragma unroll + for (int k = 0; k<4; k++) + *(uint2*)&message[2*k]=__ldg(&d_Hash[k*threads+thread]); + + __syncthreads(); + + message[8] = 0x80; + message[15] = 0x01000000; + + #pragma unroll 16 + for (int u = 0; u<16; u++) + state[u] = message[u]; + + state[15] ^= 0x10000; + + // Perm +// groestl256_perm_P(thread, state, mixtabs); + for (int r = 0; r<10; r++){ + state[0x0] ^= PC32up(0x00, r); + state[0x2] ^= PC32up(0x10, r); + state[0x4] ^= PC32up(0x20, r); + state[0x6] ^= PC32up(0x30, r); + state[0x8] ^= PC32up(0x40, r); + state[0xA] ^= PC32up(0x50, r); + state[0xC] ^= PC32up(0x60, r); + state[0xE] ^= PC32up(0x70, r); + RSTT(0x0, 0x1, state, 0x0, 0x2, 0x4, 0x6, 0x9, 0xB, 0xD, 0xF); + RSTT(0x2, 0x3, state, 0x2, 0x4, 0x6, 0x8, 0xB, 0xD, 0xF, 0x1); + RSTT(0x4, 0x5, state, 0x4, 0x6, 0x8, 0xA, 0xD, 0xF, 0x1, 0x3); + RSTT(0x6, 0x7, state, 0x6, 0x8, 0xA, 0xC, 0xF, 0x1, 0x3, 0x5); + RSTT(0x8, 0x9, state, 0x8, 0xA, 0xC, 0xE, 0x1, 0x3, 0x5, 0x7); + RSTT(0xA, 0xB, state, 0xA, 0xC, 0xE, 0x0, 0x3, 0x5, 0x7, 0x9); + RSTT(0xC, 0xD, state, 0xC, 0xE, 0x0, 0x2, 0x5, 0x7, 0x9, 0xB); + RSTT(0xE, 0xF, state, 0xE, 0x0, 0x2, 0x4, 0x7, 0x9, 0xB, 0xD); + + #pragma unroll 16 + for (int k = 0; k<16; k++) + state[k] = t[k]; + } + + state[15] ^= 0x10000; + + groestl256_perm_Q(thread, message, mixtabs); + + #pragma unroll 16 + for (int u = 0; u<16; u++) state[u] ^= message[u]; + +// #pragma unroll 16 +// for (int u = 0; u<16; u++) message[u] = state[u]; + uint32_t state15 = state[15]; + +// groestl256_perm_P(thread, state, mixtabs); + for (int r = 0; r<10; r++){ + state[0x0] ^= PC32up(0x00, r); + state[0x2] ^= PC32up(0x10, r); + state[0x4] ^= PC32up(0x20, r); + state[0x6] ^= PC32up(0x30, r); + state[0x8] ^= PC32up(0x40, r); + state[0xA] ^= PC32up(0x50, r); + state[0xC] ^= PC32up(0x60, r); + state[0xE] ^= PC32up(0x70, r); + RSTT(0x0, 0x1, state, 0x0, 0x2, 0x4, 0x6, 0x9, 0xB, 0xD, 0xF); + RSTT(0x2, 0x3, state, 0x2, 0x4, 0x6, 0x8, 0xB, 0xD, 0xF, 0x1); + RSTT(0x4, 0x5, state, 0x4, 0x6, 0x8, 0xA, 0xD, 0xF, 0x1, 0x3); + RSTT(0x6, 0x7, state, 0x6, 0x8, 0xA, 0xC, 0xF, 0x1, 0x3, 0x5); + RSTT(0x8, 0x9, state, 0x8, 0xA, 0xC, 0xE, 0x1, 0x3, 0x5, 0x7); + RSTT(0xA, 0xB, state, 0xA, 0xC, 0xE, 0x0, 0x3, 0x5, 0x7, 0x9); + RSTT(0xC, 0xD, state, 0xC, 0xE, 0x0, 0x2, 0x5, 0x7, 0x9, 0xB); + RSTT(0xE, 0xF, state, 0xE, 0x0, 0x2, 0x4, 0x7, 0x9, 0xB, 0xD); + + #pragma unroll 16 + for (int k = 0; k<16; k++) + state[k] = t[k]; + } + + if ((state15^state[15]) <= pTarget[7]) { + uint32_t tmp = atomicExch(&resNonces[0], nonce); + if (tmp != UINT32_MAX) + resNonces[1] = tmp; + } +} + +__host__ +void groestl256_cpu_init(int thr_id, uint32_t threads) +{ + cudaMalloc(&d_GNonces[thr_id], 2*sizeof(uint32_t)); + cudaMallocHost(&h_GNonces[thr_id], 2*sizeof(uint32_t)); +} + +__host__ +void groestl256_cpu_free(int thr_id) +{ + cudaFree(d_GNonces[thr_id]); + cudaFreeHost(h_GNonces[thr_id]); +} + +__host__ +void groestl256_cpu_hash_32(int thr_id, uint32_t threads, uint32_t startNounce, uint2 *d_Hash, uint32_t *resultnonces) +{ + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + TPB-1)/TPB); + dim3 block(TPB); + + size_t shared_size = 8 * 256 * sizeof(uint32_t); + + groestl256_gpu_hash_32<<>>(threads, startNounce, d_Hash, d_GNonces[thr_id]); + +// cudaThreadSynchronize(); + + cudaMemcpy(resultnonces, d_GNonces[thr_id], 2*sizeof(uint32_t), cudaMemcpyDeviceToHost); +} + +__host__ +void groestl256_set_output(int thr_id) +{ + cudaMemset(d_GNonces[thr_id], 0xff, 2*sizeof(uint32_t)); +} + +__host__ +void groestl256_setTarget(const void *pTargetIn) +{ + cudaMemcpyToSymbol(pTarget, pTargetIn, 32, 0, cudaMemcpyHostToDevice); +} diff --git a/Algo256/cuda_keccak256.cu b/Algo256/cuda_keccak256.cu new file mode 100644 index 0000000..e383994 --- /dev/null +++ b/Algo256/cuda_keccak256.cu @@ -0,0 +1,353 @@ +/* + --KECCAK-256 CUDA implementation for CCMINER-- + + based on Vertcoin published code + + forked from tpruvot@github + + Improved from SP for maxwell arch under CUDA7.5 (350Mh/s to 380Mh/s GTX970 @1278MHz) + + Further improved for maxwell GPUS under CUDA-7.5 + GTX970 strix OC: From 380Mh/s @1278MHz to 430Mh/s @1265MHz + GTX750ti: From 152Mh/s @1320MHz to 174Mh/s @1320MHz + Provos Alexis + + //Thetarho instructions pipeline inherited from genoil's repo + //https://github.com/Genoil/cpp-ethereum/blob/d7acec6dcc43783f1b28b79a947ed80305d0ee50/libethash-cuda/keccak.cuh#L54-L87 +*/ + +#include "miner.h" + +extern "C" { +#include +#include +} + +#include "cuda_helper.h" + +#define TPB52 1024 +#define TPB50 384 +#define NPT 2 +#define NBN 2 + +uint32_t *d_nounce[MAX_GPUS]; +uint32_t *h_nounce[MAX_GPUS]; + +__constant__ uint2 c_PaddedMessage80[ 6]; // padded message (80 bytes + padding?) +__constant__ uint2 c_mid[17]; + +__constant__ uint2 keccak_round_constants[24] = { + { 0x00000001, 0x00000000 }, { 0x00008082, 0x00000000 }, { 0x0000808a, 0x80000000 }, { 0x80008000, 0x80000000 }, + { 0x0000808b, 0x00000000 }, { 0x80000001, 0x00000000 }, { 0x80008081, 0x80000000 }, { 0x00008009, 0x80000000 }, + { 0x0000008a, 0x00000000 }, { 0x00000088, 0x00000000 }, { 0x80008009, 0x00000000 }, { 0x8000000a, 0x00000000 }, + { 0x8000808b, 0x00000000 }, { 0x0000008b, 0x80000000 }, { 0x00008089, 0x80000000 }, { 0x00008003, 0x80000000 }, + { 0x00008002, 0x80000000 }, { 0x00000080, 0x80000000 }, { 0x0000800a, 0x00000000 }, { 0x8000000a, 0x80000000 }, + { 0x80008081, 0x80000000 }, { 0x00008080, 0x80000000 }, { 0x80000001, 0x00000000 }, { 0x80008008, 0x80000000 } +}; + +#if __CUDA_ARCH__ <= 500 +__global__ __launch_bounds__(TPB50, 2) +#else +__global__ __launch_bounds__(TPB52, 1) +#endif +void keccak256_gpu_hash_80(uint32_t threads, uint32_t startNounce,uint32_t *resNounce,const uint2 highTarget){ + + uint32_t thread = blockDim.x * blockIdx.x + threadIdx.x; + uint2 s[25],t[5], v, w, u[ 5]; +#if __CUDA_ARCH__ > 500 + uint64_t step = gridDim.x * blockDim.x; + uint64_t maxNonce = startNounce + threads; + for(uint64_t nounce = startNounce + thread; nounce 500 + #pragma unroll 22 + #else + #pragma unroll 4 + #endif + for (int i = 1; i < 23; i++) { + #pragma unroll + for(int j=0;j<5;j++){ + t[ j] = vectorize(xor5(devectorize(s[ j]),devectorize(s[j+5]),devectorize(s[j+10]),devectorize(s[j+15]),devectorize(s[j+20]))); + } + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 4] = xor3x(s[ 4], t[3], u[ 0]);s[ 9] = xor3x(s[ 9], t[3], u[ 0]);s[14] = xor3x(s[14], t[3], u[ 0]);s[19] = xor3x(s[19], t[3], u[ 0]);s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]);s[ 5] = xor3x(s[ 5], t[4], u[ 1]);s[10] = xor3x(s[10], t[4], u[ 1]);s[15] = xor3x(s[15], t[4], u[ 1]);s[20] = xor3x(s[20], t[4], u[ 1]); + s[ 1] = xor3x(s[ 1], t[0], u[ 2]);s[ 6] = xor3x(s[ 6], t[0], u[ 2]);s[11] = xor3x(s[11], t[0], u[ 2]);s[16] = xor3x(s[16], t[0], u[ 2]);s[21] = xor3x(s[21], t[0], u[ 2]); + s[ 2] = xor3x(s[ 2], t[1], u[ 3]);s[ 7] = xor3x(s[ 7], t[1], u[ 3]);s[12] = xor3x(s[12], t[1], u[ 3]);s[17] = xor3x(s[17], t[1], u[ 3]);s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]);s[13] = xor3x(s[13], t[2], u[ 4]);s[18] = xor3x(s[18], t[2], u[ 4]);s[23] = xor3x(s[23], t[2], u[ 4]); + /*rho pi: b[..] = rotl(a[..] ^ d[...], ..)*/ + v = s[ 1]; + s[ 1] = ROL2(s[ 6],44); s[ 6] = ROL2(s[ 9],20); s[ 9] = ROL2(s[22],61); s[22] = ROL2(s[14],39); + s[14] = ROL2(s[20],18); s[20] = ROL2(s[ 2],62); s[ 2] = ROL2(s[12],43); s[12] = ROL2(s[13],25); + s[13] = ROL8(s[19]); s[19] = ROR8(s[23]); s[23] = ROL2(s[15],41); s[15] = ROL2(s[ 4],27); + s[ 4] = ROL2(s[24],14); s[24] = ROL2(s[21], 2); s[21] = ROL2(s[ 8],55); s[ 8] = ROL2(s[16],45); + s[16] = ROL2(s[ 5],36); s[ 5] = ROL2(s[ 3],28); s[ 3] = ROL2(s[18],21); s[18] = ROL2(s[17],15); + s[17] = ROL2(s[11],10); s[11] = ROL2(s[ 7], 6); s[ 7] = ROL2(s[10], 3); s[10] = ROL2(v, 1); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(s[j],s[j+1],s[j+2]);s[j+1] = chi(s[j+1],s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + /* iota: a[0,0] ^= round constant */ + s[ 0] ^=keccak_round_constants[ i]; + } + /* theta: c = a[0,i] ^ a[1,i] ^ .. a[4,i] */ + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = xor3x(xor3x(s[j+0],s[j+5],s[j+10]),s[j+15],s[j+20]); + } + s[24] = xor3x(s[24],t[3],ROL2(t[0],1)); + s[18] = xor3x(s[18],t[2],ROL2(t[4],1)); + s[ 0] = xor3x(s[ 0],t[4],ROL2(t[1],1)); + /* theta: d[i] = c[i+4] ^ rotl(c[i+1],1) */ + s[24] = ROL2(s[24],14); + s[18] = ROL2(s[18],21); + if (devectorize(chi(s[18],s[24],s[ 0])) <= devectorize(highTarget)){ +// if(chi(s[18].x,s[24].x,s[0].x)<=highTarget.x){ +// if(chi(s[18].y,s[24].y,s[0].y)<=highTarget.y){ + const uint32_t tmp = atomicExch(&resNounce[0], nounce); + if (tmp != UINT32_MAX) + resNounce[1] = tmp; + // return; +// } + } + } +} + +__host__ +void keccak256_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce,const uint2 highTarget){ + + uint32_t tpb; + dim3 grid; + if (device_sm[device_map[thr_id]] <= 500){ + tpb = TPB50; + grid.x = (threads + tpb-1)/tpb; + }else{ + tpb = TPB52; + grid.x = (threads + (NPT*tpb)-1)/(NPT*tpb); + } + const dim3 block(tpb); + + keccak256_gpu_hash_80<<>>(threads, startNounce, d_nounce[thr_id],highTarget); +// cudaThreadSynchronize(); + cudaMemcpy(h_nounce[thr_id], d_nounce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); +} + +#if __CUDA_ARCH__ <= 500 +__global__ __launch_bounds__(TPB50, 2) +#else +__global__ __launch_bounds__(TPB52, 1) +#endif +void keccak256_gpu_hash_32(uint32_t threads, uint2* outputHash){ + + uint32_t thread = blockDim.x * blockIdx.x + threadIdx.x; + uint2 s[25],t[5], v, w, u[ 5]; + if(thread 500 + #pragma unroll + #else + #pragma unroll 4 + #endif + for (uint32_t i = 0; i < 23; i++) { + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = vectorize(xor5(devectorize(s[ j]),devectorize(s[j+5]),devectorize(s[j+10]),devectorize(s[j+15]),devectorize(s[j+20]))); + } + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 4] = xor3x(s[ 4], t[3], u[ 0]);s[ 9] = xor3x(s[ 9], t[3], u[ 0]);s[14] = xor3x(s[14], t[3], u[ 0]);s[19] = xor3x(s[19], t[3], u[ 0]);s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]);s[ 5] = xor3x(s[ 5], t[4], u[ 1]);s[10] = xor3x(s[10], t[4], u[ 1]);s[15] = xor3x(s[15], t[4], u[ 1]);s[20] = xor3x(s[20], t[4], u[ 1]); + s[ 1] = xor3x(s[ 1], t[0], u[ 2]);s[ 6] = xor3x(s[ 6], t[0], u[ 2]);s[11] = xor3x(s[11], t[0], u[ 2]);s[16] = xor3x(s[16], t[0], u[ 2]);s[21] = xor3x(s[21], t[0], u[ 2]); + s[ 2] = xor3x(s[ 2], t[1], u[ 3]);s[ 7] = xor3x(s[ 7], t[1], u[ 3]);s[12] = xor3x(s[12], t[1], u[ 3]);s[17] = xor3x(s[17], t[1], u[ 3]);s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]);s[13] = xor3x(s[13], t[2], u[ 4]);s[18] = xor3x(s[18], t[2], u[ 4]);s[23] = xor3x(s[23], t[2], u[ 4]); + /*rho pi: b[..] = rotl(a[..] ^ d[...], ..)*/ + v = s[ 1]; + s[ 1] = ROL2(s[ 6],44); s[ 6] = ROL2(s[ 9],20); s[ 9] = ROL2(s[22],61); s[22] = ROL2(s[14],39); + s[14] = ROL2(s[20],18); s[20] = ROL2(s[ 2],62); s[ 2] = ROL2(s[12],43); s[12] = ROL2(s[13],25); + s[13] = ROL8(s[19]); s[19] = ROR8(s[23]); s[23] = ROL2(s[15],41); s[15] = ROL2(s[ 4],27); + s[ 4] = ROL2(s[24],14); s[24] = ROL2(s[21], 2); s[21] = ROL2(s[ 8],55); s[ 8] = ROL2(s[16],45); + s[16] = ROL2(s[ 5],36); s[ 5] = ROL2(s[ 3],28); s[ 3] = ROL2(s[18],21); s[18] = ROL2(s[17],15); + s[17] = ROL2(s[11],10); s[11] = ROL2(s[ 7], 6); s[ 7] = ROL2(s[10], 3); s[10] = ROL2(v, 1); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + /* iota: a[0,0] ^= round constant */ + s[ 0] ^=keccak_round_constants[ i]; + } + /* theta: c = a[0,i] ^ a[1,i] ^ .. a[4,i] */ + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = xor3x(xor3x(s[j+0],s[j+5],s[j+10]),s[j+15],s[j+20]); + } + /* theta: d[i] = c[i+4] ^ rotl(c[i+1],1) */ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j],1); + } + /* thetarho pi: b[..] = rotl(a[..] ^ d[...], ..) //There's no need to perform theta and -store- the result since it's unique for each a[..]*/ + s[ 4] = xor3x(s[24],t[ 3],u[ 0]); + s[ 0] = xor3x(s[ 0],t[ 4],u[ 1]); + s[ 1] = xor3x(s[ 6],t[ 0],u[ 2]); + s[ 2] = xor3x(s[12],t[ 1],u[ 3]); + s[ 3] = xor3x(s[18],t[ 2],u[ 4]); + s[ 1] = ROR2(s[ 1],20); + s[ 2] = ROR2(s[ 2],21); + s[ 3] = ROL2(s[ 3],21); + s[ 4] = ROL2(s[ 4],14); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + outputHash[0*threads+thread] = chi(s[ 0],s[ 1],s[ 2]) ^ keccak_round_constants[23]; + outputHash[1*threads+thread] = chi(s[ 1],s[ 2],s[ 3]); + outputHash[2*threads+thread] = chi(s[ 2],s[ 3],s[ 4]); + outputHash[3*threads+thread] = chi(s[ 3],s[ 4],s[ 0]); + } +} + +__host__ +void keccak256_cpu_hash_32(const int thr_id,const uint32_t threads, uint2* d_hash){ + + uint32_t tpb = TPB52; + if (device_sm[device_map[thr_id]] == 500) tpb = TPB50; + const dim3 grid((threads + tpb-1)/tpb); + const dim3 block(tpb); + + keccak256_gpu_hash_32 <<>> (threads, d_hash); +} + +__host__ +void keccak256_setBlock_80(uint64_t *PaddedMessage80){ + + uint64_t s[25],t[5],u[5],midstate[17]; + + s[10] = 1;//(uint64_t)make_uint2(1, 0); + s[16] = (uint64_t)1<<63;//(uint64_t)make_uint2(0, 0x80000000); + + t[ 0] = PaddedMessage80[ 0]^PaddedMessage80[ 5]^s[10]; + t[ 1] = PaddedMessage80[ 1]^PaddedMessage80[ 6]^s[16]; + t[ 2] = PaddedMessage80[ 2]^PaddedMessage80[ 7]; + t[ 3] = PaddedMessage80[ 3]^PaddedMessage80[ 8]; + + midstate[ 0] = ROTL64(t[ 1],1); //u[0] -partial + u[ 1] = t[ 0]^ROTL64(t[ 2],1); //u[1] + u[ 2] = t[ 1]^ROTL64(t[ 3],1); //u[2] + midstate[ 1] = t[ 2]; //u[3]; -partial + midstate[ 2] = t[ 3]^ROTL64(t[ 0],1); //u[4]; + midstate[ 3] = ROTL64(PaddedMessage80[ 1]^u[ 1],1); //v + midstate[ 4] = ROTL64(PaddedMessage80[ 6]^u[ 1],44); + midstate[ 5] = ROTL64(PaddedMessage80[ 2]^u[ 2],62); + midstate[ 6] = ROTL64(u[ 2],61); + midstate[ 7] = ROTL64(midstate[ 2],39); + midstate[ 8] = ROTL64(u[ 2],43); + midstate[ 9] = ROTL64(midstate[ 2], 8); + midstate[10] = ROTL64(PaddedMessage80[ 4]^midstate[ 2],27); + midstate[11] = ROTL64(midstate[ 2],14); + midstate[12] = ROTL64(u[ 1], 2); + midstate[13] = ROTL64(s[16]^u[ 1],45); + midstate[14] = ROTL64(u[ 2],15); + midstate[15] = ROTL64(u[ 1],10); + midstate[16] = ROTL64(PaddedMessage80[ 7]^u[ 2], 6); + + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_mid, midstate,17*sizeof(uint64_t), 0, cudaMemcpyHostToDevice)); + + //rearrange PaddedMessage80, pass only what's needed + uint64_t PaddedMessage[ 6]; + PaddedMessage[ 0] = PaddedMessage80[ 9]; + PaddedMessage[ 1] = PaddedMessage80[ 4]; + PaddedMessage[ 2] = PaddedMessage80[ 8]; + PaddedMessage[ 3] = PaddedMessage80[ 5]; + PaddedMessage[ 4] = PaddedMessage80[ 3]; + PaddedMessage[ 5] = PaddedMessage80[ 0]; + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_PaddedMessage80, PaddedMessage, 6*sizeof(uint64_t), 0, cudaMemcpyHostToDevice)); +} + +__host__ +void keccak256_cpu_init(int thr_id) +{ + CUDA_SAFE_CALL(cudaMalloc(&d_nounce[thr_id], NBN*sizeof(uint32_t))); +// CUDA_SAFE_CALL(cudaMallocHost(&h_nounce[thr_id], NBN*sizeof(uint32_t))); + h_nounce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_nounce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } +} +__host__ +void keccak256_setOutput(int thr_id) +{ + CUDA_SAFE_CALL(cudaMemset(d_nounce[thr_id], 0xff, NBN*sizeof(uint32_t))); +} + +__host__ +void keccak256_cpu_free(int thr_id) +{ + cudaFree(d_nounce[thr_id]); + cudaFreeHost(h_nounce[thr_id]); +} diff --git a/Algo256/cuda_skein256.cu b/Algo256/cuda_skein256.cu new file mode 100644 index 0000000..a12d61f --- /dev/null +++ b/Algo256/cuda_skein256.cu @@ -0,0 +1,472 @@ +/* + Based upon Tanguy Pruvot's repo + Provos Alexis - 2016 +*/ + +#include +#include "cuda_helper.h" +#include "miner.h" + +#define TPB 512 + +#define TFBIGMIX8e(){\ + p0+=p1;p2+=p3;p4+=p5;p6+=p7;p1=ROTL64(p1,46) ^ p0;p3=ROTL64(p3,36) ^ p2;p5=ROTL64(p5,19) ^ p4;p7=ROTL64(p7,37) ^ p6;\ + p2+=p1;p4+=p7;p6+=p5;p0+=p3;p1=ROTL64(p1,33) ^ p2;p7=ROTL64(p7,27) ^ p4;p5=ROTL64(p5,14) ^ p6;p3=ROTL64(p3,42) ^ p0;\ + p4+=p1;p6+=p3;p0+=p5;p2+=p7;p1=ROTL64(p1,17) ^ p4;p3=ROTL64(p3,49) ^ p6;p5=ROTL64(p5,36) ^ p0;p7=ROTL64(p7,39) ^ p2;\ + p6+=p1;p0+=p7;p2+=p5;p4+=p3;p1=ROTL64(p1,44) ^ p6;p7=ROTL64(p7, 9) ^ p0;p5=ROTL64(p5,54) ^ p2;p3=ROTR64(p3, 8) ^ p4;\ +} +#define TFBIGMIX8o(){\ + p0+=p1;p2+=p3;p4+=p5;p6+=p7;p1=ROTL64(p1,39) ^ p0;p3=ROTL64(p3,30) ^ p2;p5=ROTL64(p5,34) ^ p4;p7=ROTL64(p7,24) ^ p6;\ + p2+=p1;p4+=p7;p6+=p5;p0+=p3;p1=ROTL64(p1,13) ^ p2;p7=ROTL64(p7,50) ^ p4;p5=ROTL64(p5,10) ^ p6;p3=ROTL64(p3,17) ^ p0;\ + p4+=p1;p6+=p3;p0+=p5;p2+=p7;p1=ROTL64(p1,25) ^ p4;p3=ROTL64(p3,29) ^ p6;p5=ROTL64(p5,39) ^ p0;p7=ROTL64(p7,43) ^ p2;\ + p6+=p1;p0+=p7;p2+=p5;p4+=p3;p1=ROTL64(p1, 8) ^ p6;p7=ROTL64(p7,35) ^ p0;p5=ROTR64(p5, 8) ^ p2;p3=ROTL64(p3,22) ^ p4;\ +} + +__constant__ uint64_t c_sk_buf[64]; + +__constant__ uint64_t c_t2[ 3] = { 0x08, 0xff00000000000000, 0xff00000000000008}; +__constant__ uint32_t c_add[18] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; + +#define skein_ks_parity64 0x1BD11BDAA9FC1A22ull +//#include +__global__ __launch_bounds__(512, 2) +void skein256_gpu_hash_32(uint32_t threads, uint64_t *outputHash) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + const uint64_t dt0 = __ldg(&outputHash[thread]); + const uint64_t dt1 = __ldg(&outputHash[threads + thread]); + const uint64_t dt2 = __ldg(&outputHash[threads*2 + thread]); + const uint64_t dt3 = __ldg(&outputHash[threads*3 + thread]); + + uint64_t h[ 9] = { + 0xCCD044A12FDB3E13, 0xE83590301A79A9EB, 0x55AEA0614F816E6F, 0x2A2767A4AE9B94DB, + 0xEC06025E74DD7683, 0xE7A436CDC4746251, 0xC36FBAF9393AD185, 0x3EEDBA1833EDFC13, + 0xb69d3cfcc73a4e2a, // skein_ks_parity64 ^ h[0..7] + }; + + int i=0; + + uint64_t p0 = c_sk_buf[i++] + dt0 + dt1; + uint64_t p1 = c_sk_buf[i++] + dt1; + uint64_t p2 = c_sk_buf[i++] + dt2 + dt3; + uint64_t p3 = c_sk_buf[i++] + dt3; + uint64_t p4 = c_sk_buf[i++]; + uint64_t p5 = c_sk_buf[i++]; + uint64_t p6 = c_sk_buf[i++]; + uint64_t p7 = c_sk_buf[i++]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 1); +// TFBIGMIX8e(); + p1=ROTL64(p1,46) ^ p0; + p3=ROTL64(p3,36) ^ p2; + p2+=p1; + p0+=p3; + p1=ROTL64(p1,33) ^ p2; + p3=ROTL64(p3,42) ^ p0; + p4+=p1; + p6+=p3; + p0+=p5; + p2+=p7; + p1=ROTL64(p1,17) ^ p4; + p3=ROTL64(p3,49) ^ p6; + p5=c_sk_buf[i++] ^ p0; + p7=c_sk_buf[i++] ^ p2; + p6+=p1; + p0+=p7; + p2+=p5; + p4+=p3; + p1=ROTL64(p1,44) ^ p6; + p7=ROTL64(p7, 9) ^ p0; + p5=ROTL64(p5,54) ^ p2; + p3=ROTL64(p3,56) ^ p4; + + p0+=h[ 1]; p1+=h[ 2]; + p2+=h[ 3]; p3+=h[ 4]; + p4+=h[ 5]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + + p0+=h[ 2]; p1+=h[ 3]; + p2+=h[ 4]; p3+=h[ 5]; + p4+=h[ 6]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 3); + TFBIGMIX8e(); + + p0+=h[ 3]; p1+=h[ 4]; + p2+=h[ 5]; p3+=h[ 6]; + p4+=h[ 7]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + + p0+=h[ 4]; p1+=h[ 5]; + p2+=h[ 6]; p3+=h[ 7]; + p4+=h[ 8]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 5); + TFBIGMIX8e(); + + p0+=h[ 5]; p1+=h[ 6]; + p2+=h[ 7]; p3+=h[ 8]; + p4+=h[ 0]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + + p0+=h[ 6]; p1+=h[ 7]; + p2+=h[ 8]; p3+=h[ 0]; + p4+=h[ 1]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 7); + TFBIGMIX8e(); + + p0+=h[ 7]; p1+=h[ 8]; + p2+=h[ 0]; p3+=h[ 1]; + p4+=h[ 2]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + + p0+=h[ 8]; p1+=h[ 0]; + p2+=h[ 1]; p3+=h[ 2]; + p4+=h[ 3]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 9); + TFBIGMIX8e(); + + p0+=h[ 0]; p1+=h[ 1]; + p2+=h[ 2]; p3+=h[ 3]; + p4+=h[ 4]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + + p0+=h[ 1]; p1+=h[ 2]; + p2+=h[ 3]; p3+=h[ 4]; + p4+=h[ 5]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7,11); + TFBIGMIX8e(); + + p0+=h[ 2]; p1+=h[ 3]; + p2+=h[ 4]; p3+=h[ 5]; + p4+=h[ 6]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + + p0+=h[ 3]; p1+=h[ 4]; + p2+=h[ 5]; p3+=h[ 6]; + p4+=h[ 7]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7,13); + TFBIGMIX8e(); + + p0+=h[ 4]; p1+=h[ 5]; + p2+=h[ 6]; p3+=h[ 7]; + p4+=h[ 8]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + + p0+=h[ 5]; p1+=h[ 6]; + p2+=h[ 7]; p3+=h[ 8]; + p4+=h[ 0]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7,15); + TFBIGMIX8e(); + + p0+=h[ 6]; p1+=h[ 7]; + p2+=h[ 8]; p3+=h[ 0]; + p4+=h[ 1]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + + p0+=h[ 7]; p1+=h[ 8]; + p2+=h[ 0]; p3+=h[ 1]; + p4+=h[ 2]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7,17); + TFBIGMIX8e(); + + p0+=h[ 8]; p1+=h[ 0]; + p2+=h[ 1]; p3+=h[ 2]; + p4+=h[ 3]; p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; p6+=c_sk_buf[i]; + + TFBIGMIX8o(); + p4+=h[ 4]; + p5+=c_sk_buf[i++]; + p7+=c_sk_buf[i++]; + p6+=c_sk_buf[i]; + + p0 = (p0+h[ 0]) ^ dt0; + p1 = (p1+h[ 1]) ^ dt1; + p2 = (p2+h[ 2]) ^ dt2; + p3 = (p3+h[ 3]) ^ dt3; + + h[0] = p0; + h[1] = p1; + h[2] = p2; + h[3] = p3; + h[4] = p4; + h[5] = p5; + h[6] = p6; + h[7] = p7; + h[8] = h[ 0] ^ h[ 1] ^ h[ 2] ^ h[ 3] ^ h[ 4] ^ h[ 5] ^ h[ 6] ^ h[ 7] ^ skein_ks_parity64; + + p5+=c_t2[0]; //p5 already equal h[5] + p6+=c_t2[1]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 1); + TFBIGMIX8e(); + + p0+=h[ 1]; p1+=h[ 2]; + p2+=h[ 3]; p3+=h[ 4]; + p4+=h[ 5]; p5+=h[ 6] + c_t2[ 1]; + p6+=h[ 7] + c_t2[ 2]; p7+=h[ 8] + c_add[ 0]; + + TFBIGMIX8o(); + + p0+=h[ 2]; p1+=h[ 3]; + p2+=h[ 4]; p3+=h[ 5]; + p4+=h[ 6]; p5+=h[ 7] + c_t2[ 2]; + p6+=h[ 8] + c_t2[ 0]; p7+=h[ 0] + c_add[ 1]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 3); + TFBIGMIX8e(); + + p0+=h[ 3]; p1+=h[ 4]; + p2+=h[ 5]; p3+=h[ 6]; + p4+=h[ 7]; p5+=h[ 8] + c_t2[ 0]; + p6+=h[ 0] + c_t2[ 1]; p7+=h[ 1] + c_add[ 2]; + + TFBIGMIX8o(); + + p0+=h[ 4]; p1+=h[ 5]; + p2+=h[ 6]; p3+=h[ 7]; + p4+=h[ 8]; p5+=h[ 0] + c_t2[ 1]; + p6+=h[ 1] + c_t2[ 2]; p7+=h[ 2] + c_add[ 3]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 5); + TFBIGMIX8e(); + + p0+=h[ 5]; p1+=h[ 6]; + p2+=h[ 7]; p3+=h[ 8]; + p4+=h[ 0]; p5+=h[ 1] + c_t2[ 2]; + p6+=h[ 2] + c_t2[ 0]; p7+=h[ 3] + c_add[ 4]; + + TFBIGMIX8o(); + + p0+=h[ 6]; p1+=h[ 7]; + p2+=h[ 8]; p3+=h[ 0]; + p4+=h[ 1]; p5+=h[ 2] + c_t2[ 0]; + p6+=h[ 3] + c_t2[ 1]; p7+=h[ 4] + c_add[ 5]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 7); + TFBIGMIX8e(); + + p0+=h[ 7]; p1+=h[ 8]; + p2+=h[ 0]; p3+=h[ 1]; + p4+=h[ 2]; p5+=h[ 3] + c_t2[ 1]; + p6+=h[ 4] + c_t2[ 2]; p7+=h[ 5] + c_add[ 6]; + + TFBIGMIX8o(); + + p0+=h[ 8]; p1+=h[ 0]; + p2+=h[ 1]; p3+=h[ 2]; + p4+=h[ 3]; p5+=h[ 4] + c_t2[ 2]; + p6+=h[ 5] + c_t2[ 0]; p7+=h[ 6] + c_add[ 7]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7, 9); + TFBIGMIX8e(); + + p0+=h[ 0]; p1+=h[ 1]; + p2+=h[ 2]; p3+=h[ 3]; + p4+=h[ 4]; p5+=h[ 5] + c_t2[ 0]; + p6+=h[ 6] + c_t2[ 1]; p7+=h[ 7] + c_add[ 8]; + + TFBIGMIX8o(); + + p0+=h[ 1]; p1+=h[ 2]; + p2+=h[ 3]; p3+=h[ 4]; + p4+=h[ 5]; p5+=h[ 6] + c_t2[ 1]; + p6+=h[ 7] + c_t2[ 2]; p7+=h[ 8] + c_add[ 9]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7,11); + TFBIGMIX8e(); + + p0+=h[ 2]; p1+=h[ 3]; + p2+=h[ 4]; p3+=h[ 5]; + p4+=h[ 6]; p5+=h[ 7] + c_t2[ 2]; + p6+=h[ 8] + c_t2[ 0]; p7+=h[ 0] + c_add[10]; + + TFBIGMIX8o(); + + p0+=h[ 3]; p1+=h[ 4]; + p2+=h[ 5]; p3+=h[ 6]; + p4+=h[ 7]; p5+=h[ 8] + c_t2[ 0]; + p6+=h[ 0] + c_t2[ 1]; p7+=h[ 1] + c_add[11]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7,13); + TFBIGMIX8e(); + + p0+=h[ 4]; p1+=h[ 5]; + p2+=h[ 6]; p3+=h[ 7]; + p4+=h[ 8]; p5+=h[ 0] + c_t2[ 1]; + p6+=h[ 1] + c_t2[ 2]; p7+=h[ 2] + c_add[12]; + + TFBIGMIX8o(); + + p0+=h[ 5]; p1+=h[ 6]; + p2+=h[ 7]; p3+=h[ 8]; + p4+=h[ 0]; p5+=h[ 1] + c_t2[ 2]; + p6+=h[ 2] + c_t2[ 0]; p7+=h[ 3] + c_add[13]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7,15); + TFBIGMIX8e(); + + p0+=h[ 6]; p1+=h[ 7]; + p2+=h[ 8]; p3+=h[ 0]; + p4+=h[ 1]; p5+=h[ 2] + c_t2[ 0]; + p6+=h[ 3] + c_t2[ 1]; p7+=h[ 4] + c_add[14]; + + TFBIGMIX8o(); + + p0+=h[ 7]; p1+=h[ 8]; + p2+=h[ 0]; p3+=h[ 1]; + p4+=h[ 2]; p5+=h[ 3] + c_t2[ 1]; + p6+=h[ 4] + c_t2[ 2]; p7+=h[ 5] + c_add[15]; + +// Round_8_512v30(h, t, p0, p1, p2, p3, p4, p5, p6, p7,17); + TFBIGMIX8e(); + + p0+=h[ 8]; p1+=h[ 0]; + p2+=h[ 1]; p3+=h[ 2]; + p4+=h[ 3]; p5+=h[ 4] + c_t2[ 2]; + p6+=h[ 5] + c_t2[ 0]; p7+=h[ 6] + c_add[16]; + + TFBIGMIX8o(); + + p0+=h[ 0]; p1+=h[ 1]; + p2+=h[ 2]; p3+=h[ 3]; + p4+=h[ 4]; p5+=h[ 5] + c_t2[ 0]; + p6+=h[ 6] + c_t2[ 1]; p7+=h[ 7] + c_add[17]; + + outputHash[thread] = p0; + outputHash[threads + thread] = p1; + outputHash[threads*2 + thread] = p2; + outputHash[threads*3 + thread] = p3; + } //thread +} +__host__ +void skein256_cpu_init(int thr_id){ + + uint64_t h[ 9] = { + 0xCCD044A12FDB3E13, 0xE83590301A79A9EB, 0x55AEA0614F816E6F, 0x2A2767A4AE9B94DB, + 0xEC06025E74DD7683, 0xE7A436CDC4746251, 0xC36FBAF9393AD185, 0x3EEDBA1833EDFC13, + 0xb69d3cfcc73a4e2a, // skein_ks_parity64 ^ h[0..7] + }; + + uint64_t t[3] = {0x20, 0xf000000000000000, 0xf000000000000020}; + uint64_t dt0,dt1,dt2,dt3; + + dt0=dt1=dt2=dt3=0; + + uint64_t sk_buf[64]; + int i=0; + + uint64_t p0 = h[0] + dt0; + uint64_t p1 = h[1] + dt1; + uint64_t p2 = h[2] + dt2; + uint64_t p3 = h[3] + dt3; + uint64_t p4 = h[4]; + uint64_t p5 = h[5] + t[0]; + uint64_t p6 = h[6] + t[1]; + uint64_t p7 = h[7]; + + p0+=p1; + p2+=p3; + p4+=p5; + p6+=p7; + + p5=ROTL64(p5,19) ^ p4; + p7=ROTL64(p7,37) ^ p6; + + p4+=p7; + p6+=p5; + + p7=ROTL64(p7,27) ^ p4; + p5=ROTL64(p5,14) ^ p6; + + sk_buf[i++] = p0; + sk_buf[i++] = p1; + sk_buf[i++] = p2; + sk_buf[i++] = p3; + sk_buf[i++] = p4; + sk_buf[i++] = p5; + sk_buf[i++] = p6; + sk_buf[i++] = p7; + sk_buf[i++] = ROTL64(p5,36); + sk_buf[i++] = ROTL64(p7,39); + sk_buf[i++] = h[ 6] + t[1]; + sk_buf[i++] = h[ 8] + 1; + sk_buf[i++] = h[ 7] + t[2]; + sk_buf[i++] = h[ 0] + 2; + sk_buf[i++] = h[ 8] + t[ 0]; + sk_buf[i++] = h[ 1] + 3; + sk_buf[i++] = h[ 0] + t[ 1]; + sk_buf[i++] = h[ 2] + 4; + sk_buf[i++] = h[ 1] + t[ 2]; + sk_buf[i++] = h[ 3] + 5; + sk_buf[i++] = h[ 2] + t[ 0]; + sk_buf[i++] = h[ 4] + 6; + sk_buf[i++] = h[ 3] + t[ 1]; + sk_buf[i++] = h[ 5] + 7; + sk_buf[i++] = h[ 4] + t[ 2]; + sk_buf[i++] = h[ 6] + 8; + sk_buf[i++] = h[ 5] + t[ 0]; + sk_buf[i++] = h[ 7] + 9; + sk_buf[i++] = h[ 6] + t[ 1]; + sk_buf[i++] = h[ 8] + 10; + sk_buf[i++] = h[ 7] + t[ 2]; + sk_buf[i++] = h[ 0] + 11; + sk_buf[i++] = h[ 8] + t[ 0]; + sk_buf[i++] = h[ 1] + 12; + sk_buf[i++] = h[ 0] + t[ 1]; + sk_buf[i++] = h[ 2] + 13; + sk_buf[i++] = h[ 1] + t[ 2]; + sk_buf[i++] = h[ 3] + 14; + sk_buf[i++] = h[ 2] + t[ 0]; + sk_buf[i++] = h[ 4] + 15; + sk_buf[i++] = h[ 3] + t[ 1]; + sk_buf[i++] = h[ 5] + 16; + sk_buf[i++] = h[ 4] + t[ 2]; + sk_buf[i++] = h[ 6] + 17; + sk_buf[i++] = h[ 5] + t[ 0]; + sk_buf[i++] = h[ 7] + 18; + sk_buf[i++] = h[ 6] + t[ 1]; + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_sk_buf, sk_buf, sizeof(sk_buf), 0, cudaMemcpyHostToDevice)); +} + +__host__ +void skein256_cpu_hash_32(const uint32_t threads, uint2 *d_hash) +{ + dim3 grid((threads + TPB - 1) / TPB); + dim3 block(TPB); + skein256_gpu_hash_32<<>>(threads, (uint64_t*)d_hash); +} + diff --git a/Algo256/decred.cu b/Algo256/decred.cu new file mode 100644 index 0000000..f5c99ba --- /dev/null +++ b/Algo256/decred.cu @@ -0,0 +1,530 @@ +/** + * Blake-256 Decred 180-Bytes input Cuda Kernel (Tested on SM 5/5.2) + * + * Tanguy Pruvot - Feb 2016 + * + * Faster implementation + * Alexis Provos - Mar 2016 + * + * Merged 8-round blake (XVC) tweaks + * Further improved by: ~2.72% + * Alexis Provos + */ + +#include +#include +#include + +extern "C" { +#include +} + +/* threads per block */ +#define TPB 768 +#define NPT 192 +#define maxResults 16 +/* max count of found nonces in one call */ +#define NBN 2 + +/* hash by cpu with blake 256 */ +extern "C" void decred_hash(void *output, const void *input){ + sph_blake256_context ctx; + + sph_blake256_set_rounds(14); + + sph_blake256_init(&ctx); + sph_blake256(&ctx, input, 180); + sph_blake256_close(&ctx, output); +} + +#include + +#ifdef __INTELLISENSE__ +#define __byte_perm(x, y, b) x +#endif + +__constant__ static uint32_t _ALIGN(32) c_v[16]; +__constant__ static uint32_t _ALIGN(8) c_h[ 2]; +__constant__ static uint32_t c_m[ 3]; +__constant__ static uint32_t _ALIGN(32) c_x[90]; + +/*Buffers of candidate nonce(s) */ +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +#define GSn(a,b,c,d,x,y) { \ + v[a]+= x + v[b]; \ + v[d] = ROL16(v[d] ^ v[a]); \ + v[c]+= v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 12); \ + v[a]+= y + v[b]; \ + v[d] = ROR8(v[d] ^ v[a]); \ + v[c]+= v[d]; \ + v[b] = ROTR32(v[b] ^ v[c], 7); \ +} + +#define GSn4(a,b,c,d,x,y,a1,b1,c1,d1,x1,y1,a2,b2,c2,d2,x2,y2,a3,b3,c3,d3,x3,y3) { \ + v[ a]+= x + v[ b]; v[a1]+= x1 + v[b1]; v[a2]+= x2 + v[b2]; v[a3]+= x3 + v[b3]; \ + v[ d] = ROL16(v[ d] ^ v[ a]); v[d1] = ROL16(v[d1] ^ v[a1]); v[d2] = ROL16(v[d2] ^ v[a2]); v[d3] = ROL16(v[d3] ^ v[a3]); \ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; v[c3]+= v[d3]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 12); v[b1] = ROTR32(v[b1] ^ v[c1], 12); v[b2] = ROTR32(v[b2] ^ v[c2], 12); v[b3] = ROTR32(v[b3] ^ v[c3], 12); \ + v[ a]+= y + v[ b]; v[a1]+= y1 + v[b1]; v[a2]+= y2 + v[b2]; v[a3]+= y3 + v[b3]; \ + v[ d] = ROR8(v[ d] ^ v[ a]); v[d1] = ROR8(v[d1] ^ v[a1]); v[d2] = ROR8(v[d2] ^ v[a2]); v[d3] = ROR8(v[d3] ^ v[a3]); \ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; v[c3]+= v[d3]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 7); v[b1] = ROTR32(v[b1] ^ v[c1], 7); v[b2] = ROTR32(v[b2] ^ v[c2], 7); v[b3] = ROTR32(v[b3] ^ v[c3], 7); \ +} + +#define GSn3(a,b,c,d,x,y,a1,b1,c1,d1,x1,y1,a2,b2,c2,d2,x2,y2) { \ + v[ a]+= x + v[ b]; v[a1]+= x1 + v[b1]; v[a2]+= x2 + v[b2]; \ + v[ d] = ROL16(v[ d] ^ v[ a]); v[d1] = ROL16(v[d1] ^ v[a1]); v[d2] = ROL16(v[d2] ^ v[a2]); \ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 12); v[b1] = ROTR32(v[b1] ^ v[c1], 12); v[b2] = ROTR32(v[b2] ^ v[c2], 12); \ + v[ a]+= y + v[ b]; v[a1]+= y1 + v[b1]; v[a2]+= y2 + v[b2]; \ + v[ d] = ROR8(v[ d] ^ v[ a]); v[d1] = ROR8(v[d1] ^ v[a1]); v[d2] = ROR8(v[d2] ^ v[a2]); \ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; \ + v[ b] = ROTR32(v[ b] ^ v[ c], 7); v[b1] = ROTR32(v[b1] ^ v[c1], 7); v[b2] = ROTR32(v[b2] ^ v[c2], 7); \ +} + +__global__ __launch_bounds__(TPB,1) +void decred_gpu_hash_nonce(const uint32_t threads,const uint32_t startNonce, uint32_t *resNonce){ + + uint64_t m3 = startNonce + blockDim.x * blockIdx.x + threadIdx.x; + const uint32_t step = gridDim.x * blockDim.x; + const uint64_t maxNonce = startNonce + threads; + + const uint32_t z[16] = { + 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, + 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917 + }; + + uint32_t v[16]; + uint32_t m[16]; + + #pragma unroll 3 + for(int i=0;i<3;i++){ + m[i] = c_m[i]; + } + m[13] = 0x80000001; + m[15] = 0x000005a0; + + const uint32_t m130 = z[12]^m[13]; + const uint32_t m131 = m[13]^z[ 6]; + const uint32_t m132 = z[15]^m[13]; + const uint32_t m133 = z[ 3]^m[13]; + const uint32_t m134 = z[ 4]^m[13]; + const uint32_t m135 = z[14]^m[13]; + const uint32_t m136 = m[13]^z[11]; + const uint32_t m137 = m[13]^z[ 7]; + const uint32_t m138 = m[13]^z[ 0]; + + volatile uint32_t m150 = z[14]^m[15]; + volatile uint32_t m151 = z[ 9]^m[15]; + volatile uint32_t m152 = m[15]^z[13]; + volatile uint32_t m153 = m[15]^z[ 8]; + const uint32_t m154 = z[10]^m[15]; + const uint32_t m155 = z[ 1]^m[15]; + const uint32_t m156 = m[15]^z[ 4]; + const uint32_t m157 = z[ 6]^m[15]; + const uint32_t m158 = m[15]^z[11]; + + const uint32_t h7 = c_h[ 0]; + + for( ; m3data; + uint32_t *ptarget = work->target; + uint32_t *pnonce = &pdata[DCR_NONCE_OFT32]; + + const uint32_t first_nonce = *pnonce; + const int dev_id = device_map[thr_id]; + int intensity = (device_sm[thr_id] > 500) ? 31 : 30; + + + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + const dim3 grid((throughput + (NPT*TPB)-1)/(NPT*TPB)); + const dim3 block(TPB); + + int rc = 0; + + if (opt_benchmark) { + ptarget[6] = swab32(0xff); + } + if (!init[thr_id]){ + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage (linux) + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], maxResults * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(maxResults * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + CUDA_LOG_ERROR(); + init[thr_id] = true; + } + memcpy(endiandata, pdata, 180); + + decred_cpu_setBlock_52(thr_id,endiandata,&pdata[32]); + cudaMemset(d_resNonce[thr_id], 0x00, maxResults*sizeof(uint32_t)); + do { + // GPU HASH + decred_gpu_hash_nonce <<>> (throughput,(*pnonce), d_resNonce[thr_id]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != 0){ + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], maxResults*sizeof(uint32_t), cudaMemcpyDeviceToHost); + cudaMemset(d_resNonce[thr_id], 0x00, sizeof(uint32_t)); + if(h_resNonce[thr_id][0]>(maxResults-1)){ + gpulog(LOG_WARNING,dev_id,"Candidate flood: %u",h_resNonce[thr_id][0]); + h_resNonce[thr_id][0]=maxResults-1; + } + uint32_t i; + for(i=1;inonces[0]= swab32(h_resNonce[thr_id][i]); + rc = 1; + //search for 2nd nonce + for(uint32_t j=i+1;jnonces[1] = swab32(h_resNonce[thr_id][j]); +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %u/%08X - %u/%08X",i,pdata[19],j,pdata[21]); + if(bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + uint32_t tmp = work->nonces[1]; + work->nonces[1] = work->nonces[0]; + work->nonces[0] = tmp; + } + rc = 2; + break; + } + } + *pnonce = work->nonces[ 0]; + return rc; + } + } + } + *pnonce += throughput; + + } while (!work_restart[thr_id].restart && (uint64_t)max_nonce > (uint64_t)throughput + (uint64_t)(*pnonce)); + + *hashes_done = (*pnonce) - first_nonce; + + return rc; +} + +// cleanup +extern "C" void free_decred(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/Algo256/keccak256.cu b/Algo256/keccak256.cu new file mode 100644 index 0000000..4832b3c --- /dev/null +++ b/Algo256/keccak256.cu @@ -0,0 +1,134 @@ +/* + * Keccak 256 + * + */ + +extern "C" +{ +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_keccak.h" + +#include "miner.h" +} + +#include "cuda_helper.h" + +extern uint32_t *h_nounce[MAX_GPUS]; + +extern void keccak256_cpu_init(int thr_id); +extern void keccak256_cpu_free(int thr_id); +extern void keccak256_setBlock_80(uint64_t *PaddedMessage80); +extern void keccak256_setOutput(int thr_id); +extern void keccak256_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce,const uint2 highTarget); + +// CPU Hash +extern "C" void keccak256_hash(void *state, const void *input) +{ + uint32_t _ALIGN(64) hash[16]; + sph_keccak_context ctx_keccak; + + sph_keccak256_init(&ctx_keccak); + sph_keccak256 (&ctx_keccak, input, 80); + sph_keccak256_close(&ctx_keccak, (void*) hash); + + memcpy(state, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_keccak256(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + uint32_t _ALIGN(64) endiandata[20]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + int dev_id = device_map[thr_id]; + int intensity = (device_sm[dev_id] >= 520) ? 28 : 25; + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ptarget[7] = 0x000f; + +// const uint64_t highTarget = *(uint64_t*)&ptarget[6]; + const uint2 highTarget = make_uint2(ptarget[6],ptarget[7]); + if (!init[thr_id]) { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage (linux) + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + keccak256_cpu_init(thr_id); + + init[thr_id] = true; + } + + for (int k=0; k < 20; k++) { + be32enc(&endiandata[k], pdata[k]); + } + + keccak256_setBlock_80((uint64_t*)endiandata); + keccak256_setOutput(thr_id); + int rc = 0; + do { + keccak256_cpu_hash_80(thr_id, throughput, pdata[19],highTarget); + if (h_nounce[thr_id][0] != UINT32_MAX && bench_algo < 0) + { + uint32_t _ALIGN(64) vhash64[8]; + be32enc(&endiandata[19], h_nounce[thr_id][0]); + keccak256_hash(vhash64, endiandata); + + if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] = h_nounce[thr_id][0]; + rc = 1; + if(h_nounce[thr_id][1]!=UINT32_MAX){ +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce %08x !", h_nounce[thr_id][1]); + be32enc(&endiandata[19], h_nounce[thr_id][1]); + keccak256_hash(vhash64, endiandata); + pdata[21] = h_nounce[thr_id][1]; + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]) { + work_set_target_ratio(work, vhash64); + xchg(pdata[19], pdata[21]); + } + rc = 2; + } + return rc; + } + else{ + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_nounce[thr_id][0]); + keccak256_setOutput(thr_id); + } + } + + pdata[19] += throughput; + + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > ((uint64_t)(pdata[19]) + (uint64_t)throughput))); + + *hashes_done = pdata[19] - first_nonce; + + return rc; + +} + +// cleanup +extern "C" void free_keccak256(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaThreadSynchronize(); + + keccak256_cpu_free(thr_id); + + cudaDeviceSynchronize(); + init[thr_id] = false; +} diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..f3f0e12 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,885 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + + + + + + + + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..3406615 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,107 @@ +# allow to use Host cuda functions in C/C++ +DEF_INCLUDES = @CUDA_INCLUDES@ + +if WANT_JANSSON +JANSSON_INCLUDES= -I$(top_srcdir)/compat/jansson +else +JANSSON_INCLUDES= +endif + +EXTRA_DIST = autogen.sh README.md README.txt LICENSE.txt \ + ccminer.sln ccminer.vcxproj ccminer.vcxproj.filters \ + compat/gettimeofday.c compat/getopt/getopt_long.c cpuminer-config.h.in + +SUBDIRS = compat + +bin_PROGRAMS = ccminer + +ccminer_SOURCES = elist.h miner.h compat.h \ + compat/inttypes.h compat/stdbool.h compat/unistd.h \ + compat/sys/time.h compat/getopt/getopt.h \ + crc32.c \ + ccminer.cpp pools.cpp util.cpp bench.cpp bignum.cpp \ + api.cpp hashlog.cpp nvml.cpp stats.cpp sysinfos.cpp cuda.cpp \ + Algo256/decred.cu \ + Algo256/blake256_8round.cu Algo256/blake256_14round.cu Algo256/cuda_blake256_14round.cu \ + Algo256/cuda_keccak256.cu Algo256/keccak256.cu \ + Algo256/cuda_skein256.cu \ + Algo256/cuda_groestl256.cu \ + Algo256/cuda_bmw256.cu \ + Algo256/cuda_blake2s.cu \ + Algo256/cuda_cubehash256.cu \ + lyra2/Lyra2.c lyra2/Sponge.c lyra2/lyra2RE.cu lyra2/cuda_lyra2.cu lyra2/lyra2REv2.cu lyra2/cuda_lyra2v2.cu \ + cuda_checkhash.cu \ + sph/blake.c sph/keccak.c sph/shavite.c sph/simd.c sph/groestl.c\ + sph/sha2.c sph/cubehash.c sph/skein.c sph/bmw.c sph/jh.c \ + sph/echo.c sph/luffa.c sph/fugue.c sph/hamsi.c \ + sph/whirlpool.c sph/shabal.c sph/sha2big.c sph/haval.c sph/ripemd.c sph/sph_sha2.c \ + sph/streebog.c \ + sph/blake2b.c \ + neoscrypt/neoscrypt-cpu.c neoscrypt/cuda_neoscrypt.cu \ + neoscrypt/neoscrypt.cu \ + skein/skein.cu skein/skein2.cu \ + nist5/cuda_nist5.cu \ + quark/cuda_keccak_skein512.cu \ + quark/cuda_quark_jh512.cu quark/cuda_quark_blake512.cu quark/cuda_quark_groestl512.cu quark/cuda_quark_skein512.cu \ + quark/cuda_bmw512.cu quark/cuda_quark_keccak512.cu quark/cuda_quark_compactionTest.cu \ + quark/quarkcoin.cu \ + qubit/qubit_luffa512.cu \ + qubit/qubit.cu \ + x11/cuda_x11_cubehash_shavite_512.cu \ + x11/cuda_x11_simd_echo512.cu \ + x11/cuda_x11_cubehash512.cu x11/cuda_x11_shavite512.cu x11/cuda_x11_simd512.cu x11/cuda_x11_echo.cu \ + x11/x11.cu x11/x11evo.cu x11/c11.cu \ + streebog/cuda_streebog.cu streebog/cuda_keccak_streebog.cu \ + streebog/sib.cu streebog/veltor.cu \ + x13/cuda_x13_hamsi_fugue512.cu \ + x13/cuda_x13_fugue512.cu x13/cuda_x13_hamsi512.cu \ + x13/x13.cu \ + x13/hsr.cu x13/cuda_hsr_sm3.cu x13/sm3.c \ + x14/cuda_x14_shabal512.cu \ + x14/x14.cu \ + x15/cuda_x15_whirlpool.cu \ + x15/x15.cu \ + x15/whirlpool.cu \ + x17/cuda_x17_haval256.cu x17/cuda_x17_sha512.cu \ + x17/x17.cu \ + lbry/cuda_sha256_lbry.cu lbry/cuda_sha512_lbry.cu \ + lbry/cuda_lbry_merged.cu \ + lbry/lbry.cu \ + sia.cu \ + cuda_myriadgroestl.cu \ + myriadgroestl.cu + +if HAVE_NVML +nvml_defs = -DUSE_WRAPNVML +nvml_libs = -ldl +endif + +if HAVE_WINDOWS +ccminer_SOURCES += compat/winansi.c +endif + +ccminer_LDFLAGS = $(PTHREAD_FLAGS) @CUDA_LDFLAGS@ +ccminer_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@ @CUDA_LIBS@ @PCILIB@ @OPENMP_CFLAGS@ @LIBS@ $(nvml_libs) +ccminer_CPPFLAGS = @LIBCURL_CPPFLAGS@ @PCIFLAGS@ @OPENMP_CFLAGS@ $(CPPFLAGS) $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES) $(DEF_INCLUDES) $(nvml_defs) + +nvcc_ARCH = -gencode=arch=compute_52,code=\"sm_52,compute_52\" +nvcc_ARCH += -gencode=arch=compute_50,code=\"sm_50,compute_50\" +#nvcc_ARCH = -gencode=arch=compute_35,code=\"sm_35,compute_35\" +#nvcc_ARCH += -gencode=arch=compute_30,code=\"sm_30,compute_30\" +#nvcc_ARCH += -gencode=arch=compute_20,code=\"sm_21,compute_20\" + +nvcc_FLAGS = $(nvcc_ARCH) @CUDA_INCLUDES@ -I. @CUDA_CFLAGS@ +nvcc_FLAGS += $(JANSSON_INCLUDES) --ptxas-options="-v" -lineinfo + +# we're now targeting all major compute architectures within one binary. +.cu.o: + $(NVCC) $(nvcc_FLAGS) --maxrregcount=128 -o $@ -c $< + +streebog/cuda_streebog.o : streebog/cuda_streebog.cu + $(NVCC) $(nvcc_FLAGS) --maxrregcount=72 -o $@ -c $< + +x11/cuda_x11_simd_echo512.o: x11/cuda_x11_simd_echo512.cu + $(NVCC) $(nvcc_FLAGS) --maxrregcount=72 -o $@ -c $< + +x15/cuda_x15_whirlpool.o: x15/cuda_x15_whirlpool.cu + $(NVCC) $(nvcc_FLAGS) --maxrregcount=72 -o $@ -c $< diff --git a/README.md b/README.md index 932c35a..f2f2125 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,36 @@ -# ccmineralexis78 -ccmineralexis78 +ccminer +======= + +Based on Christian Buchner's & Christian H.'s CUDA project, no more active on github recently. + +Fork by tpruvot@github with X14,X15,X17,Blake256,BlakeCoin,Lyra2RE,Skein,ZR5 and others, check the [README.txt](README.txt) + +Tpruvot BTC donation address: 1AJdfCpLWPNoAMDfHF1wD5y8VgKSSTHxPo + [![tip for next commit](https://tip4commit.com/projects/927.svg)](https://tip4commit.com/github/tpruvot/ccminer) + +A part of the recent algos were originally wrote by [djm34](https://github.com/djm34). + +This variant was tested and built on Linux (ubuntu server 14.04) and VStudio 2013 on Windows 7. + +Note that the x86 releases are generally faster than x64 ones on Windows. + +About source code dependencies +------------------------------ + +This project requires some libraries to be built : + +- OpenSSL (prebuilt for win) + +- Curl (prebuilt for win) + +- pthreads (prebuilt for win) + +The tree now contains recent prebuilt openssl and curl .lib for both x86 and x64 platforms (windows). + +To rebuild them, you need to clone this repository and its submodules : + git clone https://github.com/peters/curl-for-windows.git compat/curl-for-windows + +On Linux, you can use the helper ./build.sh (edit it if required) + +There is also an old [Tutorial for windows](http://cudamining.co.uk/url/tutorials/id/3) on [CudaMining](http://cudamining.co.uk) website. + diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..065d147 --- /dev/null +++ b/README.txt @@ -0,0 +1,403 @@ + +ccMiner release 1.7.1 (Jan 2015) "Sibcoin & Whirlpool midstate" +--------------------------------------------------------------- + +*************************************************************** +If you find this tool useful and like to support its continuous + development, then consider a donation. + +tpruvot@github: + BTC : 1AJdfCpLWPNoAMDfHF1wD5y8VgKSSTHxPo + DRK : XeVrkPrWB7pDbdFLfKhF1Z3xpqhsx6wkH3 + ZRC : ZEcubH2xp2mpuwxMjy7wZThr5AzLGu3mqT + +DJM34: + BTC donation address: 1NENYmxwZGHsKFmyjTc5WferTn5VTFb7Ze + +cbuchner v1.2: + LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm + BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM + +*************************************************************** + +>>> Introduction <<< + +This is a CUDA accelerated mining application which handle : + +Saffroncoin blake (256 14-rounds) +Decred +BlakeCoin (256 8-rounds) +Vcash (Blake256 8-rounds - double sha256) +Blake2s (Neva/XVG/TAJ) +Keccak (Maxcoin) +LyraBar Lyra2 +Vertcoin Lyra2v2 +Skein (Skein + SHA) +Woodcoin (Double Skein) +Nist-5 (Talkcoin/Power) +QuarkCoin family & AnimeCoin +Qubit (Digibyte, ...) +DarkCoin and other X11 coins +Chaincoin and Flaxscript (C11) +Sibcoin (sib) +Revolvercoin (x11evo) +MaruCoin and other X13 coins +BernCoin (X14) +JoinCoin (X15) +VergeCoin(X17) +Library Credits (LBRY) +Neoscrypt (FeatherCoin) +SiaCoin (blake2b) +Myriad-Groestl +Veltor + +where some of these coins have a VERY NOTABLE nVidia advantage +over competing AMD (OpenCL Only) implementations. + +We did not take a big effort on improving usability, so please set +your parameters carefuly. + +THIS PROGRAMM IS PROVIDED "AS-IS", USE IT AT YOUR OWN RISK! + +If you're interessted and read the source-code, please excuse +that the most of our comments are in german. + +>>> Command Line Interface <<< + +This code is based on the pooler cpuminer and inherits +its command line interface and options. + + -a, --algo=ALGO specify the algorithm to use + blake Blake256-14rounds(SFR) + decred Blake256-14rounds(DCR) + blakecoin Blake256-8rounds (BLC) + vcash Blake256-8rounds (XVC) + blake2s Blake2s (NEVA/XVG) + keccak keccak256 (Maxcoin) + lyra2 (LyraBar) + lyra2v2 (VertCoin) + skein Skein SHA2 (AUR/DGB/SKC) + skein2 Double Skein (Woodcoin) + nist5 NIST5 (Talkcoin/Power) + quark Quark (Quarkcoin) + qubit Qubit + x11 X11 (DarkCoin) + c11 C11 (Chaincoin) + sib X11+gost (Sibcoin) + x11evo Permuted x11 (Revolver) + x13 X13 (MaruCoin) + x14 X14 (BernCoin) + x15 X15 (Joincoin) + x17 X17 (XVG) + whirlpool whirlpool (JoinCoin) + lbry Lbry (Library Credits) + neoscrypt Neoscrypt (FTC/PXC/UFO) + sia Sia (SIAcoin) + myr-gr Myriad-Groestl (SFR/AUR/DGB/XVG/MYR) + veltor Thor's Riddle(?) (Veltor) + + -d, --devices gives a comma separated list of CUDA device IDs + to operate on. Device IDs start counting from 0! + Alternatively give string names of your card like + gtx780ti or gt640#2 (matching 2nd gt640 in the PC). + + -i, --intensity=N[,N] GPU threads per call 8-25 (2^N + F, default: 0=auto) + Decimals and multiple values are allowed for fine tuning + --cuda-schedule Set device threads scheduling mode (default: auto) + -f, --diff-factor Divide difficulty by this factor (default 1.0) + -m, --diff-multiplier Multiply difficulty by this value (default 1.0) + --vote=VOTE block reward vote (for HeavyCoin) + --trust-pool trust the max block reward vote (maxvote) sent by the pool + -o, --url=URL URL of mining server + -O, --userpass=U:P username:password pair for mining server + -u, --user=USERNAME username for mining server + -p, --pass=PASSWORD password for mining server + --cert=FILE certificate for mining server using SSL + -x, --proxy=[PROTOCOL://]HOST[:PORT] connect through a proxy + -t, --threads=N number of miner threads (default: number of nVidia GPUs in your system) + -r, --retries=N number of times to retry if a network call fails + (default: retry indefinitely) + -R, --retry-pause=N time to pause between retries, in seconds (default: 15) + --shares-limit maximum shares to mine before exiting the program. + --time-limit maximum time [s] to mine before exiting the program. + -T, --timeout=N network timeout, in seconds (default: 300) + -s, --scantime=N upper bound on time spent scanning current work when + long polling is unavailable, in seconds (default: 5) + -n, --ndevs list cuda devices + -N, --statsavg number of samples used to display hashrate (default: 30) + --no-gbt disable getblocktemplate support (height check in solo) + --no-longpoll disable X-Long-Polling support + --no-stratum disable X-Stratum support + -q, --quiet disable per-thread hashmeter output + --no-color disable colored output + -D, --debug enable debug output + -P, --protocol-dump verbose dump of protocol-level activities + -b, --api-bind IP/Port for the miner API (default: 127.0.0.1:4068) + --api-remote Allow remote control + --max-temp=N Only mine if gpu temp is less than specified value + --max-rate=N[KMG] Only mine if net hashrate is less than specified value + --max-diff=N Only mine if net difficulty is less than specified value + --pstate=0 will force the Geforce 9xx to run in P0 P-State + --plimit=150W set the gpu power limit, allow multiple values for N cards + --tlimit=85 Set the gpu thermal limit (windows only) + --keep-clocks prevent reset clocks and/or power limit on exit + -B, --background run the miner in the background + --benchmark run in offline benchmark mode + --cputest debug hashes from cpu algorithms + --cpu-affinity set process affinity to specific cpu core(s) mask + --cpu-priority set process priority (default: 0 idle, 2 normal to 5 highest) + -c, --config=FILE load a JSON-format configuration file + can be from an url with the http:// prefix + -V, --version display version information and exit + -h, --help display this help text and exit + + +>>> Examples <<< + + +Example for Heavycoin Mining on heavycoinpool.com with a single gpu in your system + ccminer -t 1 -a heavy -o stratum+tcp://stratum01.heavycoinpool.com:5333 -u <> -p <> -v 8 + + +Example for Heavycoin Mining on hvc.1gh.com with a dual gpu in your system + ccminer -t 2 -a heavy -o stratum+tcp://hvcpool.1gh.com:5333/ -u <> -p x -v 8 + + +Example for Fuguecoin solo-mining with 4 gpu's in your system and a Fuguecoin-wallet running on localhost + ccminer -q -s 1 -t 4 -a fugue256 -o http://localhost:9089/ -u <> -p <> + + +Example for Fuguecoin pool mining on dwarfpool.com with all your GPUs + ccminer -q -a fugue256 -o stratum+tcp://erebor.dwarfpool.com:3340/ -u YOURWALLETADDRESS.1 -p YOUREMAILADDRESS + + +Example for Groestlcoin solo mining + ccminer -q -s 1 -a groestl -o http://127.0.0.1:1441/ -u USERNAME -p PASSWORD + + +Example for Scrypt-N (2048) on Nicehash + ccminer -a scrypt:10 -o stratum+tcp://stratum.nicehash.com:3335 -u 3EujYFcoBzWvpUEvbe3obEG95mBuU88QBD -p x + +For solo-mining you typically use -o http://127.0.0.1:xxxx where xxxx represents +the rpcport number specified in your wallet's .conf file and you have to pass the same username +and password with -O (or -u -p) as specified in the wallet config. + +The wallet must also be started with the -server option and/or with the server=1 flag in the .conf file + +>>> Configuration files <<< + +With the -c parameter you can use a json config file to set your prefered settings. +An example is present in source tree, and is also the default one when no command line parameters are given. +This allow you to run the miner without batch/script. + + +>>> API and Monitoring <<< + +With the -b parameter you can open your ccminer to your network, use -b 0.0.0.0:4068 if required. +On windows, setting 0.0.0.0 will ask firewall permissions on the first launch. Its normal. + +Default API feature is only enabled for localhost queries by default, on port 4068. + +You can test this api on linux with "telnet 4068" and type "help" to list the commands. +Default api format is delimited text. If required a php json wrapper is present in api/ folder. + +>>> Additional Notes <<< + +This code should be running on nVidia GPUs of compute capability 5.0 and beyond. +Support for lower than compute 5.0 devices has been dropped so we can more efficiently implement new algorithms using the latest +hardware features. + +>>> RELEASE HISTORY <<< + + Oct 28th 2016 Release version alexis-1.0 - source code developed under CUDA7.5 for compute 5.0 and 5.2 + + Changed the output in order to display how many blocks have been solved by the miner + [S/A/T] stands for [Solved blocks / Accepted (shares) / Total (shares)] + + Display the hardware state (temperatures, fan percentage, core/memory clocks, wattage) + by implementing hardware monitoring threads which are sampling the hardware through + NVML concurrently with the scanhash functions execution in order to fetch as accurate + as possible results. + Hardware sampling happens once every 5 minutes. An example output is shown bellow: + + [2016-10-22 04:20:26] GPU#0:ASUS GTX 970, 6530.09kH/s + [2016-10-22 04:20:26] GPU#0:ASUS GTX 970, 0.045MH/W, 0.0053MH/Mhz + [2016-10-22 04:20:26] GPU#0:ASUS GTX 970, 67C(F:44%) 1235/3004MHz(145W) + + API functionality was not changed, the returned results are the values of that moment. + ------------------------------------------------------------------------------------ + + All data bellow are from testing the source code under Linux, compiled with gcc 4.8.4 + and the CUDA7.5 toolkit. + + The gpus used for tuning/testing the source are: + ASUS DIRECTCUII GTX970 OC running at 1290MHz maximum core clock with 163W maximum TDP + GB Windforce GTX750Ti OC running at 1320MHz maximum core clock with 46W maximum TDP + (The latter was kindly donated from Mr. Tanguy) + + Unless stated otherwise, the throughput increases bellow refer to the GTX970. + + +2.72% and +1.1% on Decred/Saffron. + Using the hybrid approach and storing the most frequently accessed precomputed + values in registers yields a further +2.72% improvement in decred's hashing + function and +1.1% in 14-round blake. + ------------------------------------------------------------------------------------ + + +12.5% Keccak. + ------------------------------------------------------------------------------------ + + +120% blake2s implementation. + There are 2 hashing functions implemented in order to decrease the number of + operations in the final block when difficulty is set to 1 or higher. + ------------------------------------------------------------------------------------ + + + 8% on skein on compute5.2 devices. + +26% on skein on compute5.0 devices. + +40% on skein2 on compute5.2 devices. + +27% on skein2 on compute5.0 devices. + Skein hashing function consists of ~2000 operations, from which almost half are + 64-bit additions. Deepening the precomputations, at least 56 of these operations + can be computed once, yielding a 2.8% reduction in the instructions used. + Carefully increasing the register usage and tuning the threads per block parameter + leads to the above throughput increases. Moreover, on skein2, as noted from skein, + merging the hash functions allows the gpu to better utilize it's computational resources. + ------------------------------------------------------------------------------------ + + +3.15% lyra2v2, tuned under CUDA7.5, in order to reach CUDA6.5 reported throughput. + ------------------------------------------------------------------------------------ + + +21% Lyra2re implementation + By reducing the code size of the main bottleneck function. + Applied partial shared memory utilization on groestl256 hashing function (see qubit) + ------------------------------------------------------------------------------------ + + +95% Whirlpool implementation + Applied the same precomputations with whirlpoolx implementation in order to decrease + shared memory's bank conflicts. + Applied partial shared memory utilization (see qubit) + ------------------------------------------------------------------------------------ + + +10% and 13.2% nist5/quark + ------------------------------------------------------------------------------------ + + +43.5% Qubit implementation / +21% on 750ti + + Qubit is a sequential appliance of: + luffa(5.1%),cubehash(13.4%),shavite(19.6%),simd(28.1%) and echo(33.7%) + Shavite512 and Echo512 are both utilizing shared memory in order to perform random + table lookups and therefore being bounded by the bank conflicts which occur, making them + responsible for 53.3% of the total execution time while keeping the gpu under-utilized. + Since there is no way to precompute any part of these values, a different method needs + to be applied. A combination of texture memory and shared memory utilization, which was + applied to Kepler gpus, was found by previous developers to not be efficient in terms + of hardware utilization in latest architectures. However, a combination of shared memory + accesses and __ldg() loads, cached in the texture cache, was found to significantly + increase the performance. + Moreover, warps are executing instructions from the instruction cache independently to + each other, unless otherwise specified with synchronization routines. Therefore, + merging a memory dependent hashing function, such as simd_compress, with a shared memory + dependent hashing function such as echo, allows the warps to propagate through the + instruction path creating an - in warp level - overlap which allows a far better gpu + utilization. + Applying the above methods to the rest of the hashing functions the bellow increases + were noticed: + + +28% increase in X11/C11 performance / +21% on 750ti + + +20% increase in x11evo performance (without warp-level overlap) / +21% on 750ti + + +27% increase in X13 performance / +21% on 750ti + + +29% increase in X14 performance / +24% on 750ti + + +33% increase in X15 performance / +30% on 750ti + + +32% increase in X17 performance / +28% on 750ti + + +332% and 835% increase in sib/veltor performance + By utilizing shared memory for the look up tables and applying the partial shared + memory utilization on streebog hashing function. + ------------------------------------------------------------------------------------ + + +3.5% LBRY in order to partially reach CUDA8.0 throughput when compiled under CUDA7.5 + ------------------------------------------------------------------------------------ + + +4.6% neoscrypt / +7% on 750Ti + Used video SIMD instruction for cumulative sum of bufidx + Replaced 64bit shifts with byte permutations, since shifting is always 0,8,16 or 24 + Performed more precomputations. + (On high power consumption cards there seemed to be a decrease in hashrate) + ------------------------------------------------------------------------------------ + + +6% on SIA + Mostly precomputations and final block reduction of operations + ------------------------------------------------------------------------------------ + + +8.2% on myr-gr / +8.45% on 750ti + Using groestl512 of quark and replacement of the sha256 hashing function with + the one used on LBRY. + ------------------------------------------------------------------------------------ + + Apr 11th 2016 Release faster decred implementation. + From the previously mentioned methods, it was found that passing the precomputed + values in constant memory can yield 1% increase from storing them in registers. + + Apr 8th 2016 Release 10% faster 14-rounds blake + Following the exact same approach with 8-rounds blake leads to increased performance, + despite the fact of increased register pressure and lower occupancy per SM. However, + a hybrid approach is applicable and will potentially allow a better utilization. + + Mar 21st 2016 Fixed a CUDA7.5 issue for 8-rounds blake which was not allowing the compiler to store + the precomputed values in registers. Set CUDA7.5 as the default toolkit for future + development. + + Feb 13th 2016 Release 15% faster 8-rounds blake under CUDA6.5 toolkit. + 8-rounds blake hashing function is a simple and computational bounded function. + Each core block consists of 14 operations. Since a big part of the messsage is + held constant, most of the xors of the message values with the constant table + can be precomputed and used during the execution of the hashing function, reducing + each block's operations by up to 14.28%. Moreover, 8-round blake is not a register + intensive function. Therefore, in contrast with the whirlpoolx implementation, + we can store these -reusable through the core blocks - precomputed values in registers + in order to eliminate the constant memory loading times throughout the execution. + This is achieved by utilizing each unique thread to compute multiple hashes + in it's lifespan. A healthy combination of threads per block and hashes per thread + can yield the best throughput. + + Jan 31st 2016 Update to 1.7.1 version from Tanguy Pruvot repository + + Mar 7th 2015 Initial Release with 30% faster whirlpoolx. + The current implementation of whirlpool hashing function rely heavily in Table Lookups. + Since the look ups are dependent on the state of each thread, a random access pattern + occurs, disallowing the use of the device's global memory as a memory to host the LUTs. + In order to improve read time, LUTs are stored in shared memory, which is the fastest + of device's memories. However, since each thread inside a warp is reading from a random + location of the LUTs, the execution time heavily relys on the bank conflicts which emerge. + In order to reduce bank conflicts and thus the serialized loads inside the warp, a deeper + precomputation of the round keys can emerge, by taking advantage of the fact that a big + part of the input is held constant. The precomputed round keys are stored in constant + memory relieving the hashing function from repetitive logical operations and redundant + accesses to shared memory. + +>>> AUTHORS <<< + +Notable contributors to this application are: + +Christian Buchner, Christian H. (Germany): Initial CUDA implementation + +djm34, tsiv, sp and klausT for cuda algos implementation and optimisation + +Tanguy Pruvot : 750Ti tuning, blake, colors, zr5, skein, general code cleanup + API monitoring, linux Config/Makefile and vstudio libs... + +and also many thanks to anyone else who contributed to the original +cpuminer application (Jeff Garzik, pooler) + +Source code is included to satisfy GNU GPL V3 requirements. + + +With kind regards, + + Christian Buchner ( Christian.Buchner@gmail.com ) + Christian H. ( Chris84 ) + Tanguy Pruvot ( tpruvot@github ) diff --git a/algos.h b/algos.h new file mode 100644 index 0000000..1a16fb1 --- /dev/null +++ b/algos.h @@ -0,0 +1,113 @@ +#ifndef ALGOS_H +#define ALGOS_H + +#include +#include "compat.h" + +enum sha_algos { + ALGO_BLAKE, + ALGO_DECRED, + ALGO_VCASH, + ALGO_BLAKECOIN, + ALGO_BLAKE2S, +// ALGO_WHIRLPOOLX, + ALGO_KECCAK, + ALGO_HSR, + ALGO_LYRA2, + ALGO_LYRA2v2, + ALGO_SKEIN, + ALGO_SKEIN2, + ALGO_NIST5, + ALGO_QUARK, + ALGO_QUBIT, + ALGO_WHIRLPOOL, + ALGO_X11, + ALGO_X11EVO, + ALGO_C11, + ALGO_SIB, + ALGO_X13, + ALGO_X14, + ALGO_X15, + ALGO_X17, + ALGO_LBRY, + ALGO_NEOSCRYPT, + ALGO_SIA, + ALGO_MYR_GR, + ALGO_VELTOR, +// ALGO_YESCRYPT, + ALGO_AUTO, + ALGO_COUNT +}; + +extern volatile enum sha_algos opt_algo; + +static const char *algo_names[] = { + "blake", + "decred", + "vcash", + "blakecoin", + "blake2s", +// "whirlpoolx", + "keccak", + "hsr", + "lyra2", + "lyra2v2", + "skein", + "skein2", + "nist5", + "quark", + "qubit", + "whirlpool", + "x11", + "x11evo", + "c11", + "sib", + "x13", + "x14", + "x15", + "x17", + "lbry", + "neoscrypt", + "sia", + "myr-gr", + "veltor", +// "yescrypt", + "auto", /* reserved for multi algo */ + "" +}; + +// string to int/enum +static inline int algo_to_int(char* arg) +{ + int i; + + for (i = 0; i < ALGO_COUNT; i++) { + if (algo_names[i] && !strcasecmp(arg, algo_names[i])) { + return i; + } + } + + if (i == ALGO_COUNT) { + // some aliases... + if (!strcasecmp("all", arg)) + i = ALGO_AUTO; + else if (!strcasecmp("flax", arg)) + i = ALGO_C11; + else if (!strcasecmp("x13sm3", arg)) + i = ALGO_HSR; + else if (!strcasecmp("lyra2re", arg)) + i = ALGO_LYRA2; + else if (!strcasecmp("lyra2rev2", arg)) + i = ALGO_LYRA2v2; + else if (!strcasecmp("thorsriddle", arg)) + i = ALGO_VELTOR; + else if (!strcasecmp("whirl", arg)) + i = ALGO_WHIRLPOOL; + else + i = -1; + } + + return i; +} + +#endif diff --git a/api.cpp b/api.cpp new file mode 100644 index 0000000..73e1872 --- /dev/null +++ b/api.cpp @@ -0,0 +1,1015 @@ +/* + * Copyright 2014 ccminer team + * + * Implementation by tpruvot (based on cgminer) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. See COPYING for more details. + */ +#define APIVERSION "1.8" + +#ifdef WIN32 +# define _WINSOCK_DEPRECATED_NO_WARNINGS +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "miner.h" +#include "nvml.h" +#include "algos.h" + +#ifndef WIN32 +# include +# include +# include +# include +# include +# define SOCKETTYPE long +# define SOCKETFAIL(a) ((a) < 0) +# define INVSOCK -1 /* INVALID_SOCKET */ +# define INVINETADDR -1 /* INADDR_NONE */ +# define CLOSESOCKET close +# define SOCKETINIT {} +# define SOCKERRMSG strerror(errno) +#else +# define SOCKETTYPE SOCKET +# define SOCKETFAIL(a) ((a) == SOCKET_ERROR) +# define INVSOCK INVALID_SOCKET +# define INVINETADDR INADDR_NONE +# define CLOSESOCKET closesocket +# define in_addr_t uint32_t +#endif + +#define GROUP(g) (toupper(g)) +#define PRIVGROUP GROUP('W') +#define NOPRIVGROUP GROUP('R') +#define ISPRIVGROUP(g) (GROUP(g) == PRIVGROUP) +#define GROUPOFFSET(g) (GROUP(g) - GROUP('A')) +#define VALIDGROUP(g) (GROUP(g) >= GROUP('A') && GROUP(g) <= GROUP('Z')) +#define COMMANDS(g) (apigroups[GROUPOFFSET(g)].commands) +#define DEFINEDGROUP(g) (ISPRIVGROUP(g) || COMMANDS(g) != NULL) +struct APIGROUPS { + // This becomes a string like: "|cmd1|cmd2|cmd3|" so it's quick to search + char *commands; +} apigroups['Z' - 'A' + 1]; // only A=0 to Z=25 (R: noprivs, W: allprivs) + +struct IP4ACCESS { + in_addr_t ip; + in_addr_t mask; + char group; +}; + +static int ips = 1; +static struct IP4ACCESS *ipaccess = NULL; + +#define MYBUFSIZ 16384 +#define SOCK_REC_BUFSZ 1024 +#define QUEUE 10 + +#define ALLIP4 "0.0.0.0" +static const char *localaddr = "127.0.0.1"; +static const char *UNAVAILABLE = " - API will not be available"; +static char *buffer = NULL; +static time_t startup = 0; +static int bye = 0; + +extern char *opt_api_allow; +extern int opt_api_listen; /* port */ +extern int opt_api_remote; + +// current stratum... +extern struct stratum_ctx stratum; + +// sysinfos.cpp +extern int num_cpus; +extern float cpu_temp(int); +extern uint32_t cpu_clock(int); + + +char driver_version[32] = { 0 }; + +/***************************************************************/ + +static void gpustatus(int thr_id) +{ + struct pool_infos *p = &pools[cur_pooln]; + + if (thr_id >= 0 && thr_id < opt_n_threads) { + struct cgpu_info *cgpu = &thr_info[thr_id].gpu; + int gpuid = cgpu->gpu_id; + char buf[512]; *buf = '\0'; + char* card; + + cuda_gpu_info(cgpu); + #ifdef USE_WRAPNVML + cgpu->has_monitoring = true; + cgpu->gpu_bus = gpu_busid(cgpu); + cgpu->gpu_temp = (uint32_t)gpu_temp(cgpu); + cgpu->gpu_fan = (uint16_t) gpu_fanpercent(cgpu); + cgpu->gpu_fan_rpm = (uint16_t) gpu_fanrpm(cgpu); + cgpu->gpu_power = gpu_power(cgpu); // mWatts + #endif + // todo: per gpu + cgpu->accepted = p->accepted_count; + cgpu->rejected = p->rejected_count; + + cgpu->khashes = stats_get_speed(thr_id, 0.0) / 1000.0; + + card = device_name[gpuid]; + + snprintf(buf, sizeof(buf), "GPU=%d;BUS=%hd;CARD=%s;TEMP=%hu;" + "POWER=%u;FAN=%hu;RPM=%hu;FREQ=%d;KHS=%.2f;HWF=%d;I=%.1f;THR=%u|", + gpuid, cgpu->gpu_bus, card, cgpu->gpu_temp, + cgpu->gpu_power, cgpu->gpu_fan, cgpu->gpu_fan_rpm, + cgpu->gpu_clock, cgpu->khashes, + cgpu->hw_errors, cgpu->intensity, cgpu->throughput); + + // append to buffer for multi gpus + strcat(buffer, buf); + } +} + +/** +* Returns gpu/thread specific stats +*/ +static char *getthreads(char *params) +{ + *buffer = '\0'; + for (int i = 0; i < opt_n_threads; i++) + gpustatus(i); + return buffer; +} + +/*****************************************************************************/ + +/** +* Returns miner global infos +*/ +static char *getsummary(char *params) +{ + char algo[64] = { 0 }; + time_t ts = time(NULL); + double accps, uptime = difftime(ts, startup); + uint32_t wait_time = 0, solved_count = 0; + uint32_t accepted_count = 0, rejected_count = 0; + for (int p = 0; p < num_pools; p++) { + wait_time += pools[p].wait_time; + accepted_count += pools[p].accepted_count; + rejected_count += pools[p].rejected_count; + solved_count += pools[p].solved_count; + } + accps = (60.0 * accepted_count) / (uptime ? uptime : 1.0); + + get_currentalgo(algo, sizeof(algo)); + + *buffer = '\0'; + sprintf(buffer, "NAME=%s;VER=%s;API=%s;" + "ALGO=%s;GPUS=%d;KHS=%.2f;SOLV=%d;ACC=%d;REJ=%d;" + "ACCMN=%.3f;DIFF=%.6f;NETKHS=%.0f;" + "POOLS=%u;WAIT=%u;UPTIME=%.0f;TS=%u|", + PACKAGE_NAME, PACKAGE_VERSION, APIVERSION, + algo, active_gpus, (double)global_hashrate / 1000., + solved_count, accepted_count, rejected_count, + accps, net_diff > 1e-6 ? net_diff : stratum_diff, (double)net_hashrate / 1000., + num_pools, wait_time, uptime, (uint32_t) ts); + return buffer; +} + +/** + * Returns some infos about current pool + */ +static char *getpoolnfo(char *params) +{ + char *s = buffer; + char jobid[128] = { 0 }; + char extra[96] = { 0 }; + int pooln = params ? atoi(params) % num_pools : cur_pooln; + struct pool_infos *p = &pools[pooln]; + uint32_t last_share = 0; + if (p->last_share_time) + last_share = (uint32_t) (time(NULL) - p->last_share_time); + + *s = '\0'; + + if (stratum.job.job_id) + strncpy(jobid, stratum.job.job_id, sizeof(stratum.job.job_id)); + if (stratum.job.xnonce2) { + /* used temporary to be sure all is ok */ + sprintf(extra, "0x"); + if (p->algo == ALGO_DECRED) { + char compat[32] = { 0 }; + cbin2hex(&extra[2], (const char*) stratum.xnonce1, min(36, stratum.xnonce2_size)); + cbin2hex(compat, (const char*) stratum.job.xnonce2, 4); + memcpy(&extra[2], compat, 8); // compat extranonce + } else { + cbin2hex(&extra[2], (const char*) stratum.job.xnonce2, stratum.xnonce2_size); + } + } + + snprintf(s, MYBUFSIZ, "POOL=%s;ALGO=%s;URL=%s;USER=%s;SOLV=%d;ACC=%d;REJ=%d;STALE=%u;H=%u;JOB=%s;DIFF=%.6f;" + "BEST=%.6f;N2SZ=%d;N2=%s;PING=%u;DISCO=%u;WAIT=%u;UPTIME=%u;LAST=%u|", + strlen(p->name) ? p->name : p->short_url, algo_names[p->algo], + p->url, p->type & POOL_STRATUM ? p->user : "", + p->solved_count, p->accepted_count, p->rejected_count, p->stales_count, + stratum.job.height, jobid, stratum_diff, p->best_share, + (int) stratum.xnonce2_size, extra, stratum.answer_msec, + p->disconnects, p->wait_time, p->work_time, last_share); + + return s; +} + +/*****************************************************************************/ + +static void gpuhwinfos(int gpu_id) +{ + char buf[256]; + char pstate[8]; + char* card; + struct cgpu_info *cgpu = NULL; + + for (int g = 0; g < opt_n_threads; g++) { + if (device_map[g] == gpu_id) { + cgpu = &thr_info[g].gpu; + break; + } + } + + if (cgpu == NULL) + return; + + cuda_gpu_info(cgpu); +#ifdef USE_WRAPNVML + cgpu->has_monitoring = true; + cgpu->gpu_bus = gpu_busid(cgpu); + cgpu->gpu_temp = (uint32_t)gpu_temp(cgpu); + cgpu->gpu_fan = (uint16_t) gpu_fanpercent(cgpu); + cgpu->gpu_fan_rpm = (uint16_t) gpu_fanrpm(cgpu); + cgpu->gpu_pstate = (int16_t) gpu_pstate(cgpu); + cgpu->gpu_power = gpu_power(cgpu); + gpu_info(cgpu); +#ifdef WIN32 + if (opt_debug) nvapi_pstateinfo(cgpu->gpu_id); +#endif +#endif + + memset(pstate, 0, sizeof(pstate)); + if (cgpu->gpu_pstate != -1) + snprintf(pstate, sizeof(pstate), "P%d", (int) cgpu->gpu_pstate); + + card = device_name[gpu_id]; + + snprintf(buf, sizeof(buf), "GPU=%d;BUS=%hd;CARD=%s;SM=%u;MEM=%lu;" + "TEMP=%hu;FAN=%hu;RPM=%hu;FREQ=%d;MEMFREQ=%d;PST=%s;POWER=%u;" + "VID=%hx;PID=%hx;NVML=%d;NVAPI=%d;SN=%s;BIOS=%s|", + gpu_id, cgpu->gpu_bus, card, cgpu->gpu_arch, (uint32_t)cgpu->gpu_mem, + cgpu->gpu_temp, cgpu->gpu_fan, cgpu->gpu_fan_rpm, + cgpu->gpu_clock, cgpu->gpu_memclock, + pstate, cgpu->gpu_power, + cgpu->gpu_vid, cgpu->gpu_pid, cgpu->nvml_id, cgpu->nvapi_id, + cgpu->gpu_sn, cgpu->gpu_desc); + + strcat(buffer, buf); +} + +#ifndef WIN32 +static char os_version[64] = "linux "; +#endif + +static const char* os_name() +{ +#ifdef WIN32 + return "windows"; +#else + FILE *fd = fopen("/proc/version", "r"); + if (!fd || !fscanf(fd, "Linux version %48s", &os_version[6])) + return "linux"; + fclose(fd); + os_version[48] = '\0'; + return (const char*) os_version; +#endif +} + +/** + * System and CPU Infos + */ +static void syshwinfos() +{ + char buf[256]; + + int cputc = (int) cpu_temp(0); + uint32_t cpuclk = cpu_clock(0); + + memset(buf, 0, sizeof(buf)); + snprintf(buf, sizeof(buf), "OS=%s;NVDRIVER=%s;CPUS=%d;CPUTEMP=%d;CPUFREQ=%d|", + os_name(), driver_version, num_cpus, cputc, cpuclk); + strcat(buffer, buf); +} + +/** + * Returns gpu and system (todo) informations + */ +static char *gethwinfos(char *params) +{ + *buffer = '\0'; + for (int i = 0; i < cuda_num_devices(); i++) + gpuhwinfos(i); + syshwinfos(); + return buffer; +} + +/*****************************************************************************/ + +/** + * Returns the last 50 scans stats + * optional param thread id (default all) + */ +static char *gethistory(char *params) +{ + struct stats_data data[50]; + int thrid = params ? atoi(params) : -1; + char *p = buffer; + int records = stats_get_history(thrid, data, ARRAY_SIZE(data)); + *buffer = '\0'; + for (int i = 0; i < records; i++) { + time_t ts = data[i].tm_stat; + p += sprintf(p, "GPU=%d;H=%u;KHS=%.2f;DIFF=%.6f;" + "COUNT=%u;FOUND=%u;ID=%u;TS=%u|", + data[i].gpu_id, data[i].height, data[i].hashrate, data[i].difficulty, + data[i].hashcount, data[i].hashfound, data[i].uid, (uint32_t)ts); + } + return buffer; +} + +/** + * Returns the job scans ranges (debug purpose) + */ +static char *getscanlog(char *params) +{ + struct hashlog_data data[50]; + char *p = buffer; + int records = hashlog_get_history(data, ARRAY_SIZE(data)); + *buffer = '\0'; + for (int i = 0; i < records; i++) { + time_t ts = data[i].tm_upd; + p += sprintf(p, "H=%u;P=%u;JOB=%u;N=%u;FROM=0x%x;SCANTO=0x%x;" + "COUNT=0x%x;FOUND=%u;TS=%u|", + data[i].height, data[i].npool, data[i].njobid, data[i].nonce, data[i].scanned_from, data[i].scanned_to, + (data[i].scanned_to - data[i].scanned_from), data[i].tm_sent ? 1 : 0, (uint32_t)ts); + } + return buffer; +} + +/** + * Some debug infos about memory usage + */ +static char *getmeminfo(char *params) +{ + uint64_t smem, hmem, totmem; + uint32_t srec, hrec; + + stats_getmeminfo(&smem, &srec); + hashlog_getmeminfo(&hmem, &hrec); + totmem = smem + hmem; + + *buffer = '\0'; + sprintf(buffer, "STATS=%u;HASHLOG=%u;MEM=%lu|", + srec, hrec, totmem); + + return buffer; +} + +/*****************************************************************************/ + +/** + * Remote control allowed ? + * TODO: ip filters + */ +static bool check_remote_access(void) +{ + return (opt_api_remote > 0); +} + +/** + * Set pool by index (pools array in json config) + * switchpool|1| + */ +static char *remote_switchpool(char *params) +{ + bool ret = false; + *buffer = '\0'; + if (!check_remote_access()) + return buffer; + if (!params || strlen(params) == 0) { + // rotate pool test + ret = pool_switch_next(-1); + } else { + int n = atoi(params); + if (n == cur_pooln) + ret = true; + else if (n < num_pools) + ret = pool_switch(-1, n); + } + sprintf(buffer, "%s|", ret ? "ok" : "fail"); + return buffer; +} + +/** + * Change pool url (see --url parameter) + * seturl|stratum+tcp://:@mine.xpool.ca:1131| + */ +static char *remote_seturl(char *params) +{ + bool ret; + *buffer = '\0'; + if (!check_remote_access()) + return buffer; + if (!params || strlen(params) == 0) { + // rotate pool test + ret = pool_switch_next(-1); + } else { + ret = pool_switch_url(params); + } + sprintf(buffer, "%s|", ret ? "ok" : "fail"); + return buffer; +} + +/** + * Ask the miner to quit + */ +static char *remote_quit(char *params) +{ + *buffer = '\0'; + if (!check_remote_access()) + return buffer; + bye = 1; + sprintf(buffer, "%s", "bye|"); + return buffer; +} + +/*****************************************************************************/ + +static char *gethelp(char *params); +struct CMDS { + const char *name; + char *(*func)(char *); +} cmds[] = { + { "summary", getsummary }, + { "threads", getthreads }, + { "pool", getpoolnfo }, + { "histo", gethistory }, + { "hwinfo", gethwinfos }, + { "meminfo", getmeminfo }, + { "scanlog", getscanlog }, + + /* remote functions */ + { "seturl", remote_seturl }, /* prefer switchpool, deprecated */ + { "switchpool", remote_switchpool }, + { "quit", remote_quit }, + + /* keep it the last */ + { "help", gethelp }, +}; +#define CMDMAX ARRAY_SIZE(cmds) + +static char *gethelp(char *params) +{ + *buffer = '\0'; + char * p = buffer; + for (int i = 0; i < CMDMAX-1; i++) + p += sprintf(p, "%s\n", cmds[i].name); + sprintf(p, "|"); + return buffer; +} + +/*****************************************************************************/ + +static int send_result(SOCKETTYPE c, char *result) +{ + int n; + if (!result) { + n = send(c, "", 1, 0); + } else { + // ignore failure - it's closed immediately anyway + n = send(c, result, (int) strlen(result) + 1, 0); + } + return n; +} + +/* ---- Base64 Encoding/Decoding Table --- */ +static const char table64[]= + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +static size_t base64_encode(const uchar *indata, size_t insize, char *outptr, size_t outlen) +{ + uchar ibuf[3]; + uchar obuf[4]; + int i, inputparts, inlen = (int) insize; + size_t len = 0; + char *output, *outbuf; + + memset(outptr, 0, outlen); + + outbuf = output = (char*)calloc(1, inlen * 4 / 3 + 4); + if (outbuf == NULL) { + return -1; + } + + while (inlen > 0) { + for (i = inputparts = 0; i < 3; i++) { + if (inlen > 0) { + inputparts++; + ibuf[i] = (uchar) *indata; + indata++; inlen--; + } + else + ibuf[i] = 0; + } + + obuf[0] = (uchar) ((ibuf[0] & 0xFC) >> 2); + obuf[1] = (uchar) (((ibuf[0] & 0x03) << 4) | ((ibuf[1] & 0xF0) >> 4)); + obuf[2] = (uchar) (((ibuf[1] & 0x0F) << 2) | ((ibuf[2] & 0xC0) >> 6)); + obuf[3] = (uchar) (ibuf[2] & 0x3F); + + switch(inputparts) { + case 1: /* only one byte read */ + snprintf(output, 5, "%c%c==", + table64[obuf[0]], + table64[obuf[1]]); + break; + case 2: /* two bytes read */ + snprintf(output, 5, "%c%c%c=", + table64[obuf[0]], + table64[obuf[1]], + table64[obuf[2]]); + break; + default: + snprintf(output, 5, "%c%c%c%c", + table64[obuf[0]], + table64[obuf[1]], + table64[obuf[2]], + table64[obuf[3]] ); + break; + } + if ((len+4) > outlen) + break; + output += 4; len += 4; + } + len = snprintf(outptr, len, "%s", outbuf); + // todo: seems to be missing on linux + if (strlen(outptr) == 27) + strcat(outptr, "="); + free(outbuf); + + return len; +} + +#include "compat/curl-for-windows/openssl/openssl/crypto/sha/sha.h" + +/* websocket handshake (tested in Chrome) */ +static int websocket_handshake(SOCKETTYPE c, char *result, char *clientkey) +{ + char answer[256]; + char inpkey[128] = { 0 }; + char seckey[64]; + uchar sha1[20]; + SHA_CTX ctx; + + if (opt_protocol) + applog(LOG_DEBUG, "clientkey: %s", clientkey); + + sprintf(inpkey, "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11", clientkey); + + // SHA-1 test from rfc, returns in base64 "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=" + //sprintf(inpkey, "dGhlIHNhbXBsZSBub25jZQ==258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + + SHA1_Init(&ctx); + SHA1_Update(&ctx, inpkey, strlen(inpkey)); + SHA1_Final(sha1, &ctx); + + base64_encode(sha1, 20, seckey, sizeof(seckey)); + + sprintf(answer, + "HTTP/1.1 101 Switching Protocol\r\n" + "Upgrade: WebSocket\r\nConnection: Upgrade\r\n" + "Sec-WebSocket-Accept: %s\r\n" + "Sec-WebSocket-Protocol: text\r\n" + "\r\n", seckey); + + // data result as tcp frame + + uchar hd[10] = { 0 }; + hd[0] = 129; // 0x1 text frame (FIN + opcode) + uint64_t datalen = (uint64_t) strlen(result); + uint8_t frames = 2; + if (datalen <= 125) { + hd[1] = (uchar) (datalen); + } else if (datalen <= 65535) { + hd[1] = (uchar) 126; + hd[2] = (uchar) (datalen >> 8); + hd[3] = (uchar) (datalen); + frames = 4; + } else { + hd[1] = (uchar) 127; + hd[2] = (uchar) (datalen >> 56); + hd[3] = (uchar) (datalen >> 48); + hd[4] = (uchar) (datalen >> 40); + hd[5] = (uchar) (datalen >> 32); + hd[6] = (uchar) (datalen >> 24); + hd[7] = (uchar) (datalen >> 16); + hd[8] = (uchar) (datalen >> 8); + hd[9] = (uchar) (datalen); + frames = 10; + } + + size_t handlen = strlen(answer); + uchar *data = (uchar*) calloc(1, handlen + frames + (size_t) datalen + 1); + if (data == NULL) + return -1; + else { + uchar *p = data; + // HTTP header 101 + memcpy(p, answer, handlen); + p += handlen; + // WebSocket Frame - Header + Data + memcpy(p, hd, frames); + memcpy(p + frames, result, (size_t)datalen); + send(c, (const char*)data, (int) (strlen(answer) + frames + datalen + 1), 0); + free(data); + } + return 0; +} + +/* + * N.B. IP4 addresses are by Definition 32bit big endian on all platforms + */ +static void setup_ipaccess() +{ + char *buf, *ptr, *comma, *slash, *dot; + int ipcount, mask, octet, i; + char group; + + buf = (char*) calloc(1, strlen(opt_api_allow) + 1); + if (unlikely(!buf)) + proper_exit(1);//, "Failed to malloc ipaccess buf"); + + strcpy(buf, opt_api_allow); + ipcount = 1; + ptr = buf; + while (*ptr) if (*(ptr++) == ',') + ipcount++; + + // possibly more than needed, but never less + ipaccess = (struct IP4ACCESS *) calloc(ipcount, sizeof(struct IP4ACCESS)); + if (unlikely(!ipaccess)) + proper_exit(1);//, "Failed to calloc ipaccess"); + + ips = 0; + ptr = buf; + while (ptr && *ptr) { + while (*ptr == ' ' || *ptr == '\t') + ptr++; + + if (*ptr == ',') { + ptr++; + continue; + } + + comma = strchr(ptr, ','); + if (comma) + *(comma++) = '\0'; + + group = NOPRIVGROUP; + + if (isalpha(*ptr) && *(ptr+1) == ':') { + if (DEFINEDGROUP(*ptr)) + group = GROUP(*ptr); + ptr += 2; + } + + ipaccess[ips].group = group; + + if (strcmp(ptr, ALLIP4) == 0) + ipaccess[ips].ip = ipaccess[ips].mask = 0; + else + { + slash = strchr(ptr, '/'); + if (!slash) + ipaccess[ips].mask = 0xffffffff; + else { + *(slash++) = '\0'; + mask = atoi(slash); + if (mask < 1 || mask > 32) + goto popipo; // skip invalid/zero + + ipaccess[ips].mask = 0; + while (mask-- >= 0) { + octet = 1 << (mask % 8); + ipaccess[ips].mask |= (octet << (24 - (8 * (mask >> 3)))); + } + } + + ipaccess[ips].ip = 0; // missing default to '.0' + for (i = 0; ptr && (i < 4); i++) { + dot = strchr(ptr, '.'); + if (dot) + *(dot++) = '\0'; + octet = atoi(ptr); + + if (octet < 0 || octet > 0xff) + goto popipo; // skip invalid + + ipaccess[ips].ip |= (octet << (24 - (i * 8))); + + ptr = dot; + } + + ipaccess[ips].ip &= ipaccess[ips].mask; + } + + ips++; +popipo: + ptr = comma; + } + + free(buf); +} + +static bool check_connect(struct sockaddr_in *cli, char **connectaddr, char *group) +{ + bool addrok = false; + + *connectaddr = inet_ntoa(cli->sin_addr); + + *group = NOPRIVGROUP; + if (opt_api_allow) { + int client_ip = htonl(cli->sin_addr.s_addr); + for (int i = 0; i < ips; i++) { + if ((client_ip & ipaccess[i].mask) == ipaccess[i].ip) { + addrok = true; + *group = ipaccess[i].group; + break; + } + } + } + else + addrok = (strcmp(*connectaddr, localaddr) == 0); + + return addrok; +} + +static void api() +{ + const char *addr = opt_api_allow; + unsigned short port = (unsigned short) opt_api_listen; // 4068 + char buf[MYBUFSIZ]; + int n, bound; + char *connectaddr; + char *binderror; + char group; + time_t bindstart; + struct sockaddr_in serv; + struct sockaddr_in cli; + socklen_t clisiz; + bool addrok = false; + long long counter; + char *result; + char *params; + int i; + + SOCKETTYPE c; + SOCKETTYPE *apisock; + if (!opt_api_listen && opt_debug) { + applog(LOG_DEBUG, "API disabled"); + return; + } + + if (opt_api_allow) { + setup_ipaccess(); + if (ips == 0) { + applog(LOG_WARNING, "API not running (no valid IPs specified)%s", UNAVAILABLE); + } + } + + apisock = (SOCKETTYPE*) calloc(1, sizeof(*apisock)); + *apisock = INVSOCK; + + sleep(1); + + *apisock = socket(AF_INET, SOCK_STREAM, 0); + if (*apisock == INVSOCK) { + applog(LOG_ERR, "API initialisation failed (%s)%s", strerror(errno), UNAVAILABLE); + return; + } + + memset(&serv, 0, sizeof(serv)); + serv.sin_family = AF_INET; + serv.sin_addr.s_addr = inet_addr(addr); + if (serv.sin_addr.s_addr == (in_addr_t)INVINETADDR) { + applog(LOG_ERR, "API initialisation 2 failed (%s)%s", strerror(errno), UNAVAILABLE); + return; + } + + serv.sin_port = htons(port); + +#ifndef WIN32 + // On linux with SO_REUSEADDR, bind will get the port if the previous + // socket is closed (even if it is still in TIME_WAIT) but fail if + // another program has it open - which is what we want + int optval = 1; + // If it doesn't work, we don't really care - just show a debug message + if (SOCKETFAIL(setsockopt(*apisock, SOL_SOCKET, SO_REUSEADDR, (void *)(&optval), sizeof(optval)))) + applog(LOG_DEBUG, "API setsockopt SO_REUSEADDR failed (ignored): %s", SOCKERRMSG); +#else + // On windows a 2nd program can bind to a port>1024 already in use unless + // SO_EXCLUSIVEADDRUSE is used - however then the bind to a closed port + // in TIME_WAIT will fail until the timeout - so we leave the options alone +#endif + + // try for 1 minute ... in case the old one hasn't completely gone yet + bound = 0; + bindstart = time(NULL); + while (bound == 0) { + if (bind(*apisock, (struct sockaddr *)(&serv), sizeof(serv)) < 0) { + binderror = strerror(errno); + if ((time(NULL) - bindstart) > 61) + break; + else if (opt_api_listen == 4068) { + /* when port is default one, use first available */ + if (opt_debug) + applog(LOG_DEBUG, "API bind to port %d failed, trying port %u", + port, (uint32_t) port+1); + port++; + serv.sin_port = htons(port); + sleep(1); + } else { + if (!opt_quiet || opt_debug) + applog(LOG_WARNING, "API bind to port %u failed - trying again in 20sec", + (uint32_t) port); + sleep(20); + } + } + else { + bound = 1; + if (opt_api_listen != port) { + applog(LOG_WARNING, "API bind to port %d failed - using port %u", + opt_api_listen, (uint32_t) port); + opt_api_listen = port; + } + } + } + + if (bound == 0) { + applog(LOG_WARNING, "API bind to port %d failed (%s)%s", port, binderror, UNAVAILABLE); + free(apisock); + return; + } + + if (SOCKETFAIL(listen(*apisock, QUEUE))) { + applog(LOG_ERR, "API initialisation 3 failed (%s)%s", strerror(errno), UNAVAILABLE); + CLOSESOCKET(*apisock); + free(apisock); + return; + } + + buffer = (char *) calloc(1, MYBUFSIZ + 1); + + counter = 0; + while (bye == 0 && !abort_flag) { + counter++; + + clisiz = sizeof(cli); + c = accept(*apisock, (struct sockaddr*) (&cli), &clisiz); + if (SOCKETFAIL(c)) { + applog(LOG_ERR, "API failed (%s)%s", strerror(errno), UNAVAILABLE); + CLOSESOCKET(*apisock); + free(apisock); + free(buffer); + return; + } + + addrok = check_connect(&cli, &connectaddr, &group); + if (opt_debug && opt_protocol) + applog(LOG_DEBUG, "API: connection from %s - %s", + connectaddr, addrok ? "Accepted" : "Ignored"); + + if (addrok) { + bool fail; + char *wskey = NULL; + n = recv(c, &buf[0], SOCK_REC_BUFSZ, 0); + + fail = SOCKETFAIL(n); + if (fail) + buf[0] = '\0'; + else if (n > 0 && buf[n-1] == '\n') { + /* telnet compat \r\n */ + buf[n-1] = '\0'; n--; + if (n > 0 && buf[n-1] == '\r') + buf[n-1] = '\0'; + } + buf[n] = '\0'; + + //if (opt_debug && opt_protocol && n > 0) + // applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]); + + if (!fail) { + char *msg = NULL; + /* Websocket requests compat. */ + if ((msg = strstr(buf, "GET /")) && strlen(msg) > 5) { + char cmd[256] = { 0 }; + sscanf(&msg[5], "%s\n", cmd); + params = strchr(cmd, '/'); + if (params) + *(params++) = '|'; + params = strchr(cmd, '/'); + if (params) + *(params++) = '\0'; + wskey = strstr(msg, "Sec-WebSocket-Key"); + if (wskey) { + char *eol = strchr(wskey, '\r'); + if (eol) *eol = '\0'; + wskey = strchr(wskey, ':'); + wskey++; + while ((*wskey) == ' ') wskey++; // ltrim + } + n = sprintf(buf, "%s", cmd); + } + + params = strchr(buf, '|'); + if (params != NULL) + *(params++) = '\0'; + + if (opt_debug && opt_protocol && n > 0) + applog(LOG_DEBUG, "API: exec command %s(%s)", buf, params ? params : ""); + + for (i = 0; i < CMDMAX; i++) { + if (strcmp(buf, cmds[i].name) == 0 && strlen(buf)) { + if (params && strlen(params)) { + // remove possible trailing | + if (params[strlen(params)-1] == '|') + params[strlen(params)-1] = '\0'; + } + result = (cmds[i].func)(params); + if (wskey) { + websocket_handshake(c, result, wskey); + break; + } + send_result(c, result); + break; + } + } + CLOSESOCKET(c); + } + } + } + + CLOSESOCKET(*apisock); + free(apisock); + free(buffer); +} + +/* external access */ +void *api_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info*)userdata; + + startup = time(NULL); + api(); + tq_freeze(mythr->q); + + if (bye) { + // quit command + proper_exit(1); + } + + return NULL; +} + +/* to be able to report the default value set in each algo */ +void api_set_throughput(int thr_id, uint32_t throughput) +{ + if (thr_id < MAX_GPUS && thr_info) { + struct cgpu_info *cgpu = &thr_info[thr_id].gpu; + cgpu->throughput = throughput; + cgpu->intensity = throughput2intensity(throughput); + } + // to display in bench results + if (opt_benchmark) + bench_set_throughput(thr_id, throughput); +} diff --git a/api/index.php b/api/index.php new file mode 100644 index 0000000..e7aed8f --- /dev/null +++ b/api/index.php @@ -0,0 +1,265 @@ +'local-sample.php', + //'EPSYTOUR'=>'epsytour.php', /* copy local.php file and edit target IP:PORT */ +); + +// 3 seconds max. +set_time_limit(3); +error_reporting(0); + +function getdataFromPeers() +{ + global $host, $configs; + $data = array(); + foreach ($configs as $name => $conf) { + + $json = file_get_contents($host.$conf); + + $data[$name] = json_decode($json, TRUE); + } + return $data; +} + +function ignoreField($key) +{ + $ignored = array( + 'API','VER','GPU','BUS','POOLS', + 'CARD','GPUS','CPU','TS', + ); + return in_array($key, $ignored); +} + +function translateField($key) +{ + $intl = array(); + $intl['NAME'] = 'Software'; + $intl['VER'] = 'Version'; + + $intl['ALGO'] = 'Algorithm'; + $intl['GPUS'] = 'GPUs'; + $intl['CPUS'] = 'Threads'; + $intl['KHS'] = 'Hash rate'; + $intl['ACC'] = 'Accepted shares'; + $intl['ACCMN'] = 'Accepted / mn'; + $intl['REJ'] = 'Rejected'; + $intl['SOLV'] = 'Solved'; + $intl['BEST'] = 'Best share'; + $intl['LAST'] = 'Last share'; + $intl['DIFF'] = 'Difficulty'; + $intl['NETKHS'] = 'Net Rate'; + $intl['UPTIME'] = 'Miner up time'; + $intl['TS'] = 'Last update'; + $intl['THR'] = 'Throughput'; + $intl['WAIT'] = 'Wait time'; + + $intl['H'] = 'Bloc height'; + $intl['I'] = 'Intensity'; + $intl['HWF'] = 'Failures'; + $intl['POOLS'] = 'Pools'; + + $intl['TEMP'] = 'T°c'; + $intl['FAN'] = 'Fan %'; + $intl['FREQ'] = 'Freq.'; + $intl['POWER'] = 'Power'; + $intl['PST'] = 'P-State'; + + // pool infos + $intl['POOL'] = 'Pool'; + $intl['PING'] = 'Ping (ms)'; + $intl['DISCO'] = 'Disconnects'; + $intl['USER'] = 'User'; + + if (isset($intl[$key])) + return $intl[$key]; + else + return $key; +} + +function translateValue($key,$val,$data=array()) +{ + switch ($key) { + case 'UPTIME': + case 'WAIT': + $min = floor(intval($val) / 60); + $sec = intval($val) % 60; + $val = "${min}mn${sec}s"; + if ($min > 180) { + $hrs = floor($min / 60); + $min = $min % 60; + $val = "${hrs}h${min}mn"; + } + break; + case 'NAME': + $val = $data['NAME'].' '.$data['VER']; + break; + case 'FREQ': + $val = sprintf("%d MHz", round(floatval($val)/1000.0)); + break; + case 'POWER': + $val = sprintf("%d W", round(floatval($val)/1000.0)); + break; + case 'TS': + $val = strftime("%H:%M:%S", (int) $val); + break; + case 'KHS': + case 'NETKHS': + $val = ''.$val.' kH/s'; + break; + case 'NAME': + case 'POOL'; + case 'USER': + // long fields + $val = ''.$val.''; + break; + } + return $val; +} + +function filterPoolInfos($stats) +{ + $keys = array('USER','H','PING','DISCO'); + $data = array(); + $pool = array_pop($stats); + // simplify URL to host only + $data['POOL'] = $pool['URL']; + if (strstr($pool['URL'],'://')) { + $parts = explode(':', $pool['URL']); + $data['POOL'] = substr($parts[1],2); + } + foreach ($pool as $key=>$val) { + if (in_array($key, $keys)) + $data[$key] = $val; + } + return $data; +} + +function displayData($data) +{ + $htm = ''; + $totals = array(); + foreach ($data as $name => $stats) { + if (!isset($stats['summary'])) + continue; + $htm .= ''."\n"; + $htm .= '\n"; + if (!empty($stats)) { + $summary = (array) $stats['summary']; + foreach ($summary as $key=>$val) { + if (!empty($val) && !ignoreField($key)) + $htm .= ''. + '\n"; + } + if (isset($summary['KHS'])) + @ $totals[$summary['ALGO']] += floatval($summary['KHS']); + + if (isset($stats['pool']) && !empty($stats['pool']) ) { + $pool = filterPoolInfos($stats['pool']); + $htm .= ''."\n"; + foreach ($pool as $key=>$val) { + if (!empty($val) && !ignoreField($key)) + $htm .= ''. + '\n"; + } + } + + foreach ($stats['threads'] as $g=>$gpu) { + $card = isset($gpu['CARD']) ? $gpu['CARD'] : ''; + $htm .= '\n"; + foreach ($gpu as $key=>$val) { + if (!empty($val) && !ignoreField($key)) + $htm .= ''. + '\n"; + } + } + } + $htm .= "
'.$name."
'.translateField($key).''.translateValue($key, $val, $summary)."
POOL
'.translateField($key).''.translateValue($key, $val)."
'.$g." $card
'.translateField($key).''.translateValue($key, $val)."
\n"; + } + // totals + if (!empty($totals)) { + $htm .= '

Total Hash rate

'."\n"; + foreach ($totals as $algo => $hashrate) { + $htm .= '
  • '.$algo.":$hashrate kH/s
  • \n"; + } + $htm .= '
    '; + } + return $htm; +} + +$data = getdataFromPeers(); + +?> + + + ccminer rig api sample + + + + + + + +
    + +
    + + + + + diff --git a/api/local-sample.php b/api/local-sample.php new file mode 100644 index 0000000..1e1ff8f --- /dev/null +++ b/api/local-sample.php @@ -0,0 +1,137 @@ + 0) { + $err = socket_last_error($socket); + echo "."; + if ($timeout > 1 && ($err == 115 || $err == 114)) { + $timeout--; + usleep(50); + $res = socket_connect($socket, API_HOST, $port); + continue; + } + $error = socket_strerror($err); + $msg = "socket connect($port) failed"; + echo "ERR: $msg '$error'\n"; + socket_close($socket); + return NULL; + } + + socket_set_block($socket); + + return $socket; +} + +function readsockline($socket) +{ + $line = ''; + while (true) { + $byte = socket_read($socket, 1); + if ($byte === false || $byte === '') + break; + if ($byte === "\0") + break; + $line .= $byte; + } + return $line; +} + + +function request($cmd) +{ + $socket = getsock(API_PORT); + if ($socket == null) + return NULL; + + socket_write($socket, $cmd, strlen($cmd)); + $line = readsockline($socket); + socket_close($socket); + + if (strlen($line) == 0) { + echo "WARN: '$cmd' returned nothing\n"; + return $line; + } + + echo "$cmd returned '$line'\n"; + + $data = array(); + + $objs = explode('|', $line); + foreach ($objs as $obj) + { + if (strlen($obj) > 0) + { + $items = explode(';', $obj); + $item = $items[0]; + $id = explode('=', $items[0], 2); + if (count($id) == 1) + $name = $id[0]; + else + $name = $id[0].$id[1]; + + if (strlen($name) == 0) + $name = 'null'; + + if (isset($data[$name])) { + $num = 1; + while (isset($data[$name.$num])) + $num++; + $name .= $num; + } + + $counter = 0; + foreach ($items as $item) + { + $id = explode('=', $item, 2); + if (count($id) == 2) + $data[$name][$id[0]] = $id[1]; + else + $data[$name][$counter] = $id[0]; + + $counter++; + } + + } + } + if ($cmd == 'summary') + return array_pop($data); + else + return $data; +} + +ob_start(); + +error_reporting(0); + +$summary = request('summary'); +$threads = request('threads'); +$pool = request('pool'); + +ob_end_clean(); /* swap to debug */ +//echo ob_get_clean()."\n"; + +header("Content-Type: application/json"); +echo json_encode(compact('summary', 'threads', 'pool'))."\n"; +?> diff --git a/api/websocket.htm b/api/websocket.htm new file mode 100644 index 0000000..783d2dd --- /dev/null +++ b/api/websocket.htm @@ -0,0 +1,130 @@ + + + + + + + + +
    + + + diff --git a/autogen.sh b/autogen.sh new file mode 100644 index 0000000..8261a2c --- /dev/null +++ b/autogen.sh @@ -0,0 +1 @@ +aclocal && autoheader && automake --add-missing --gnu --copy && autoconf diff --git a/bench.cpp b/bench.cpp new file mode 100644 index 0000000..e3926b0 --- /dev/null +++ b/bench.cpp @@ -0,0 +1,181 @@ +/** + * Made to benchmark and test algo switch + * + * 2015 - tpruvot@github + */ + +#include + +#include "miner.h" +#include "algos.h" + +int bench_algo = -1; + +static double algo_hashrates[MAX_GPUS][ALGO_COUNT] = { 0 }; +static uint32_t algo_throughput[MAX_GPUS][ALGO_COUNT] = { 0 }; +static int algo_mem_used[MAX_GPUS][ALGO_COUNT] = { 0 }; +static int device_mem_free[MAX_GPUS] = { 0 }; + +static pthread_barrier_t miner_barr; +static pthread_barrier_t algo_barr; +static pthread_mutex_t bench_lock = PTHREAD_MUTEX_INITIALIZER; + +extern double thr_hashrates[MAX_GPUS]; + +void bench_init(int threads) +{ + bench_algo = opt_algo = (enum sha_algos) 0; /* first */ + applog(LOG_BLUE, "Starting benchmark mode with %s", algo_names[opt_algo]); + pthread_barrier_init(&miner_barr, NULL, threads); + pthread_barrier_init(&algo_barr, NULL, threads); + // required for usage of first algo. + for (int n=0; n < opt_n_threads; n++) { + device_mem_free[n] = cuda_available_memory(n); + } +} + +void bench_free() +{ + pthread_barrier_destroy(&miner_barr); + pthread_barrier_destroy(&algo_barr); +} + +// required to switch algos +void algo_free_all(int thr_id){ + // only initialized algos will be freed + free_blake256_8round(thr_id); + free_blake256_14round(thr_id); + free_decred(thr_id); + free_blake2s(thr_id); + free_keccak256(thr_id); + free_hsr(thr_id); + free_lyra2(thr_id); + free_lyra2v2(thr_id); +// free_whirlx(thr_id); + free_skeincoin(thr_id); + free_skein2(thr_id); + free_nist5(thr_id); + free_quark(thr_id); + free_qubit(thr_id); + free_x11(thr_id); + free_x11evo(thr_id); + free_c11(thr_id); + free_sib(thr_id); + free_x13(thr_id); + free_x14(thr_id); + free_x15(thr_id); + free_x17(thr_id); + free_lbry(thr_id); + free_neoscrypt(thr_id); + free_myriad(thr_id); + free_sia(thr_id); + free_veltor(thr_id); +// free_yescrypt(thr_id); +} + +// benchmark all algos (called once per mining thread) +bool bench_algo_switch_next(int thr_id) +{ + int algo = (int) opt_algo; + int prev_algo = algo; + int dev_id = device_map[thr_id % MAX_GPUS]; + int mfree, mused; + // doesnt seems enough to prevent device slow down + // after some algo switchs + bool need_reset = (gpu_threads == 1); + + algo++; + + // Skip yescrypt +// if(algo == ALGO_YESCRYPT){ +// algo++; +// } + + // free current algo memory and track mem usage + mused = cuda_available_memory(thr_id); + algo_free_all(thr_id); + CUDA_LOG_ERROR(); + + // device can take some time to free + mfree = cuda_available_memory(thr_id); + if (device_mem_free[thr_id] > mfree) { + sleep(1); + mfree = cuda_available_memory(thr_id); + } + + // we need to wait completion on all cards before the switch + if (opt_n_threads > 1) { + pthread_barrier_wait(&miner_barr); + } + + char rate[32] = { 0 }; + double hashrate = stats_get_speed(thr_id, thr_hashrates[thr_id]); + format_hashrate(hashrate, rate); + gpulog(LOG_NOTICE, thr_id, "%s hashrate = %s", algo_names[prev_algo], rate); + + // ensure memory leak is still real after the barrier + if (device_mem_free[thr_id] > mfree) { + mfree = cuda_available_memory(thr_id); + } + + // check if there is memory leak + if (device_mem_free[thr_id] - mfree > 1) { + gpulog(LOG_WARNING, thr_id, "possible %d MB memory leak in %s! %d MB free", + (device_mem_free[thr_id] - mfree), algo_names[prev_algo], mfree); + cuda_reset_device(thr_id, NULL); // force to free the leak + need_reset = false; + mfree = cuda_available_memory(thr_id); + } + // store used memory per algo + algo_mem_used[thr_id][opt_algo] = device_mem_free[thr_id] - mused; + device_mem_free[thr_id] = mfree; + + // store to dump a table per gpu later + algo_hashrates[thr_id][prev_algo] = hashrate; + + // wait the other threads to display logs correctly + if (opt_n_threads > 1) { + pthread_barrier_wait(&algo_barr); + } + + if (algo == ALGO_AUTO) + return false; // all algos done + + // mutex primary used for the stats purge + pthread_mutex_lock(&bench_lock); + stats_purge_all(); + + opt_algo = (enum sha_algos) algo; + global_hashrate = 0; + thr_hashrates[thr_id] = 0; // reset for minmax64 + pthread_mutex_unlock(&bench_lock); + + if (need_reset) + cuda_reset_device(thr_id, NULL); + + if (thr_id == 0) + applog(LOG_BLUE, "Benchmark algo %s...", algo_names[algo]); + + return true; +} + +void bench_set_throughput(int thr_id, uint32_t throughput) +{ + algo_throughput[thr_id][opt_algo] = throughput; +} + +void bench_display_results() +{ + for (int n=0; n < opt_n_threads; n++) + { + int dev_id = device_map[n]; + applog(LOG_BLUE, "Benchmark results for GPU #%d - %s:", dev_id, device_name[dev_id]); + for (int i=0; i < ALGO_COUNT-1; i++) { + double rate = algo_hashrates[n][i]; + if (rate == 0.0) continue; + applog(LOG_INFO, "%12s : %12.1f kH/s, %5d MB, %8u thr.", algo_names[i], + rate / 1024., algo_mem_used[n][i], algo_throughput[n][i]); + } + } +} + diff --git a/bignum.cpp b/bignum.cpp new file mode 100644 index 0000000..4ef359a --- /dev/null +++ b/bignum.cpp @@ -0,0 +1,93 @@ +/** + * Wrapper to OpenSSL BIGNUM used by net diff (nBits) + */ + +#include + +#include "uint256.h" + +#include +#if OPENSSL_VERSION_NUMBER < 0x10100000L +#include "compat/bignum_ssl10.hpp" +#else +#include "bignum.hpp" +#endif + +#include "miner.h" // hex2bin + +extern "C" double bn_convert_nbits(const uint32_t nBits) +{ + uint256 bn = CBigNum().SetCompact(nBits).getuint256(); + return bn.getdouble(); +} + +// copy the big number to 32-bytes uchar +extern "C" void bn_nbits_to_uchar(const uint32_t nBits, unsigned char *target) +{ + char buff[65]; + uint256 bn = CBigNum().SetCompact(nBits).getuint256(); + + snprintf(buff, 65, "%s\n", bn.ToString().c_str()); buff[64] = '\0'; + hex2bin(target, buff, 32); +} + +// unused, but should allow more than 256bits targets +#if 0 +extern "C" double bn_hash_target_ratio(uint32_t* hash, uint32_t* target) +{ + double dhash; + + if (!opt_showdiff) + return 0.0; + + CBigNum h(0), t(0); + std::vector vch(32); + + memcpy(&vch[0], (void*) target, 32); + t.setvch(vch); + memcpy(&vch[0], (void*) hash, 32); + h.setvch(vch); + + dhash = h.getuint256().getdouble(); + if (dhash > 0.) + return t.getuint256().getdouble() / dhash; + else + return dhash; +} +#endif + +// new method to save all nonce(s) share diff/ratio +extern "C" void bn_set_target_ratio(struct work* work, uint32_t* hash, int nonce) +{ + bn_store_hash_target_ratio(hash, work->target, work, nonce); +} + +// compute the diff ratio between a found hash and the target +extern "C" double bn_hash_target_ratio(uint32_t* hash, uint32_t* target) +{ + uint256 h, t; + double dhash; + + memcpy(&t, (void*) target, 32); + memcpy(&h, (void*) hash, 32); + + dhash = h.getdouble(); + if (dhash > 0.) + return t.getdouble() / dhash; + else + return dhash; +} + +// store ratio in work struct +extern "C" void bn_store_hash_target_ratio(uint32_t* hash, uint32_t* target, struct work* work, int nonce) +{ + // only if the option is enabled (to reduce cpu usage) + work->shareratio[nonce] = bn_hash_target_ratio(hash, target); + work->sharediff[nonce] = work->targetdiff * work->shareratio[0]; +} + +extern "C" void work_set_target_ratio(struct work* work, uint32_t* hash) +{ + bn_store_hash_target_ratio(hash, work->target, work,0); +} + diff --git a/bignum.hpp b/bignum.hpp new file mode 100644 index 0000000..414b6cb --- /dev/null +++ b/bignum.hpp @@ -0,0 +1,584 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2012 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. +#ifndef BITCOIN_BIGNUM_H +#define BITCOIN_BIGNUM_H + +#ifndef PROTOCOL_VERSION +#define PROTOCOL_VERSION 70001 +#endif + +#include +#include + +#include + +#include "serialize.hpp" + +/** Errors thrown by the bignum class */ +class bignum_error : public std::runtime_error +{ +public: + explicit bignum_error(const std::string& str) : std::runtime_error(str) {} +}; + + +/** RAII encapsulated BN_CTX (OpenSSL bignum context) */ +class CAutoBN_CTX +{ +protected: + BN_CTX* pctx; + BN_CTX* operator=(BN_CTX* pnew) { return pctx = pnew; } + +public: + CAutoBN_CTX() + { + pctx = BN_CTX_new(); + if (pctx == NULL) + throw bignum_error("CAutoBN_CTX : BN_CTX_new() returned NULL"); + } + + ~CAutoBN_CTX() + { + if (pctx != NULL) + BN_CTX_free(pctx); + } + + operator BN_CTX*() { return pctx; } + BN_CTX& operator*() { return *pctx; } + BN_CTX** operator&() { return &pctx; } + bool operator!() { return (pctx == NULL); } +}; + + +/** C++ wrapper for BIGNUM (OpenSSL bignum) */ +class CBigNum +{ +private: + BIGNUM *self = NULL; + + void init() + { + if (self) + BN_clear_free(self); + self = BN_new(); + if (!self) + throw bignum_error("CBigNum::init(): BN_new() returned NULL"); + } + +public: + BIGNUM *get() { return self; } + const BIGNUM *getc() const { return self; } + + CBigNum() + { + init(); + } + + CBigNum(const CBigNum& b) + { + init(); + if (!BN_copy(self, b.getc())) + { + BN_clear_free(self); + throw bignum_error("CBigNum::CBigNum(const CBigNum&) : BN_copy failed"); + } + } + + CBigNum& operator=(const CBigNum& b) + { + if (!BN_copy(self, b.getc())) + throw bignum_error("CBigNum::operator= : BN_copy failed"); + return (*this); + } + + ~CBigNum() + { + BN_clear_free(self); + } + + //CBigNum(char n) is not portable. Use 'signed char' or 'unsigned char'. + CBigNum(signed char n) { init(); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(short n) { init(); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(int n) { init(); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(int64 n) { init(); setint64(n); } + CBigNum(unsigned char n) { init(); setulong(n); } + CBigNum(unsigned short n) { init(); setulong(n); } + CBigNum(unsigned int n) { init(); setulong(n); } + CBigNum(unsigned long n) { init(); setulong(n); } + CBigNum(uint64 n) { init(); setuint64(n); } + explicit CBigNum(uint256 n) { init(); setuint256(n); } + + explicit CBigNum(const std::vector& vch) + { + init(); + setvch(vch); + } + + void setulong(unsigned long n) + { + if (!BN_set_word(self, n)) + throw bignum_error("CBigNum conversion from unsigned long : BN_set_word failed"); + } + + unsigned long getulong() const + { + return BN_get_word(self); + } + + unsigned int getuint() const + { + return BN_get_word(self); + } + + int getint() const + { + unsigned long n = BN_get_word(self); + if (!BN_is_negative(self)) + return (n > (unsigned long)std::numeric_limits::max() ? std::numeric_limits::max() : n); + else + return (n > (unsigned long)std::numeric_limits::max() ? std::numeric_limits::min() : -(int)n); + } + + void setint64(int64 sn) + { + unsigned char pch[sizeof(sn) + 6]; + unsigned char* p = pch + 4; + bool fNegative; + uint64 n; + + if (sn < (int64)0) + { + // Since the minimum signed integer cannot be represented as positive so long as its type is signed, and it's not well-defined what happens if you make it unsigned before negating it, we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate + n = -(sn + 1); + ++n; + fNegative = true; + } else { + n = sn; + fNegative = false; + } + + bool fLeadingZeroes = true; + for (int i = 0; i < 8; i++) + { + unsigned char c = (n >> 56) & 0xff; + n <<= 8; + if (fLeadingZeroes) + { + if (c == 0) + continue; + if (c & 0x80) + *p++ = (fNegative ? 0x80 : 0); + else if (fNegative) + c |= 0x80; + fLeadingZeroes = false; + } + *p++ = c; + } + unsigned int nSize = p - (pch + 4); + pch[0] = (nSize >> 24) & 0xff; + pch[1] = (nSize >> 16) & 0xff; + pch[2] = (nSize >> 8) & 0xff; + pch[3] = (nSize) & 0xff; + BN_mpi2bn(pch, p - pch, self); + } + + uint64 getuint64() + { + unsigned int nSize = BN_bn2mpi(self, NULL); + if (nSize < 4) + return 0; + std::vector vch(nSize); + BN_bn2mpi(self, &vch[0]); + if (vch.size() > 4) + vch[4] &= 0x7f; + uint64 n = 0; + for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--) + ((unsigned char*)&n)[i] = vch[j]; + return n; + } + + void setuint64(uint64 n) + { + unsigned char pch[sizeof(n) + 6]; + unsigned char* p = pch + 4; + bool fLeadingZeroes = true; + for (int i = 0; i < 8; i++) + { + unsigned char c = (n >> 56) & 0xff; + n <<= 8; + if (fLeadingZeroes) + { + if (c == 0) + continue; + if (c & 0x80) + *p++ = 0; + fLeadingZeroes = false; + } + *p++ = c; + } + unsigned int nSize = p - (pch + 4); + pch[0] = (nSize >> 24) & 0xff; + pch[1] = (nSize >> 16) & 0xff; + pch[2] = (nSize >> 8) & 0xff; + pch[3] = (nSize) & 0xff; + BN_mpi2bn(pch, p - pch, self); + } + + void setuint256(uint256 n) + { + unsigned char pch[sizeof(n) + 6]; + unsigned char* p = pch + 4; + bool fLeadingZeroes = true; + unsigned char* pbegin = (unsigned char*)&n; + unsigned char* psrc = pbegin + sizeof(n); + while (psrc != pbegin) + { + unsigned char c = *(--psrc); + if (fLeadingZeroes) + { + if (c == 0) + continue; + if (c & 0x80) + *p++ = 0; + fLeadingZeroes = false; + } + *p++ = c; + } + unsigned int nSize = p - (pch + 4); + pch[0] = (nSize >> 24) & 0xff; + pch[1] = (nSize >> 16) & 0xff; + pch[2] = (nSize >> 8) & 0xff; + pch[3] = (nSize >> 0) & 0xff; + BN_mpi2bn(pch, p - pch, self); + } + + uint256 getuint256() + { + unsigned int nSize = BN_bn2mpi(self, NULL); + if (nSize < 4) + return 0; + std::vector vch(nSize); + BN_bn2mpi(self, &vch[0]); + if (vch.size() > 4) + vch[4] &= 0x7f; + uint256 n = 0; + for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--) + ((unsigned char*)&n)[i] = vch[j]; + return n; + } + + + void setvch(const std::vector& vch) + { + std::vector vch2(vch.size() + 4); + unsigned int nSize = vch.size(); + // BIGNUM's byte stream format expects 4 bytes of + // big endian size data info at the front + vch2[0] = (nSize >> 24) & 0xff; + vch2[1] = (nSize >> 16) & 0xff; + vch2[2] = (nSize >> 8) & 0xff; + vch2[3] = (nSize >> 0) & 0xff; + // swap data to big endian + reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4); + BN_mpi2bn(&vch2[0], vch2.size(), self); + } + + std::vector getvch() const + { + unsigned int nSize = BN_bn2mpi(self, NULL); + if (nSize <= 4) + return std::vector(); + std::vector vch(nSize); + BN_bn2mpi(self, &vch[0]); + vch.erase(vch.begin(), vch.begin() + 4); + reverse(vch.begin(), vch.end()); + return vch; + } + + CBigNum& SetCompact(unsigned int nCompact) + { + unsigned int nSize = nCompact >> 24; + std::vector vch(4 + nSize); + vch[3] = nSize; + if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff; + if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff; + if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff; + BN_mpi2bn(&vch[0], vch.size(), self); + return *this; + } + + unsigned int GetCompact() const + { + unsigned int nSize = BN_bn2mpi(self, NULL); + std::vector vch(nSize); + nSize -= 4; + BN_bn2mpi(self, &vch[0]); + unsigned int nCompact = nSize << 24; + if (nSize >= 1) nCompact |= (vch[4] << 16); + if (nSize >= 2) nCompact |= (vch[5] << 8); + if (nSize >= 3) nCompact |= (vch[6] << 0); + return nCompact; + } + + void SetHex(const std::string& str) + { + // skip 0x + const char* psz = str.c_str(); + while (isspace(*psz)) + psz++; + bool fNegative = false; + if (*psz == '-') + { + fNegative = true; + psz++; + } + if (psz[0] == '0' && tolower(psz[1]) == 'x') + psz += 2; + while (isspace(*psz)) + psz++; + + // hex string to bignum + static const signed char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 }; + *this = 0; + while (isxdigit(*psz)) + { + *this <<= 4; + int n = phexdigit[(unsigned char)*psz++]; + *this += n; + } + if (fNegative) + *this = 0 - *this; + } + + std::string ToString(int nBase=10) const + { + CAutoBN_CTX pctx; + CBigNum bnBase = nBase; + CBigNum bn0 = 0; + std::string str; + CBigNum bn = *this; + BN_set_negative(bn.get(), false); + CBigNum dv; + CBigNum rem; + if (BN_cmp(bn.getc(), bn0.getc()) == 0) + return "0"; + while (BN_cmp(bn.getc(), bn0.getc()) > 0) + { + if (!BN_div(dv.get(), rem.get(), bn.getc(), bnBase.getc(), pctx)) + throw bignum_error("CBigNum::ToString() : BN_div failed"); + bn = dv; + unsigned int c = rem.getulong(); + str += "0123456789abcdef"[c]; + } + if (BN_is_negative(self)) + str += "-"; + reverse(str.begin(), str.end()); + return str; + } + + std::string GetHex() const + { + return ToString(16); + } + + unsigned int GetSerializeSize(int nType=0, int nVersion=PROTOCOL_VERSION) const + { + return ::GetSerializeSize(getvch(), nType, nVersion); + } + + template + void Serialize(Stream& s, int nType=0, int nVersion=PROTOCOL_VERSION) const + { + ::Serialize(s, getvch(), nType, nVersion); + } + + template + void Unserialize(Stream& s, int nType=0, int nVersion=PROTOCOL_VERSION) + { + std::vector vch; + ::Unserialize(s, vch, nType, nVersion); + setvch(vch); + } + + + bool operator!() const + { + return BN_is_zero(self); + } + + CBigNum& operator+=(const CBigNum& b) + { + if (!BN_add(self, self, b.getc())) + throw bignum_error("CBigNum::operator+= : BN_add failed"); + return *this; + } + + CBigNum& operator-=(const CBigNum& b) + { + *this = *this - b; + return *this; + } + + CBigNum& operator*=(const CBigNum& b) + { + CAutoBN_CTX pctx; + if (!BN_mul(self, self, b.getc(), pctx)) + throw bignum_error("CBigNum::operator*= : BN_mul failed"); + return *this; + } + + CBigNum& operator/=(const CBigNum& b) + { + *this = *this / b; + return *this; + } + + CBigNum& operator%=(const CBigNum& b) + { + *this = *this % b; + return *this; + } + + CBigNum& operator<<=(unsigned int shift) + { + if (!BN_lshift(self, self, shift)) + throw bignum_error("CBigNum:operator<<= : BN_lshift failed"); + return *this; + } + + CBigNum& operator>>=(unsigned int shift) + { + // Note: BN_rshift segfaults on 64-bit if 2^shift is greater than the number + // if built on ubuntu 9.04 or 9.10, probably depends on version of OpenSSL + CBigNum a = 1; + a <<= shift; + if (BN_cmp(a.getc(), self) > 0) + { + *this = 0; + return *this; + } + + if (!BN_rshift(self, self, shift)) + throw bignum_error("CBigNum:operator>>= : BN_rshift failed"); + return *this; + } + + + CBigNum& operator++() + { + // prefix operator + if (!BN_add(self, self, BN_value_one())) + throw bignum_error("CBigNum::operator++ : BN_add failed"); + return *this; + } + + const CBigNum operator++(int) + { + // postfix operator + const CBigNum ret = *this; + ++(*this); + return ret; + } + + CBigNum& operator--() + { + // prefix operator + CBigNum r; + if (!BN_sub(r.get(), self, BN_value_one())) + throw bignum_error("CBigNum::operator-- : BN_sub failed"); + *this = r; + return *this; + } + + const CBigNum operator--(int) + { + // postfix operator + const CBigNum ret = *this; + --(*this); + return ret; + } + + + friend inline const CBigNum operator-(const CBigNum& a, const CBigNum& b); + friend inline const CBigNum operator/(const CBigNum& a, const CBigNum& b); + friend inline const CBigNum operator%(const CBigNum& a, const CBigNum& b); +}; + + + +inline const CBigNum operator+(const CBigNum& a, const CBigNum& b) +{ + CBigNum r; + if (!BN_add(r.get(), a.getc(), b.getc())) + throw bignum_error("CBigNum::operator+ : BN_add failed"); + return r; +} + +inline const CBigNum operator-(const CBigNum& a, const CBigNum& b) +{ + CBigNum r; + if (!BN_sub(r.get(), a.getc(), b.getc())) + throw bignum_error("CBigNum::operator- : BN_sub failed"); + return r; +} + +inline const CBigNum operator-(const CBigNum& a) +{ + CBigNum r(a); + BN_set_negative(r.get(), !BN_is_negative(r.getc())); + return r; +} + +inline const CBigNum operator*(const CBigNum& a, const CBigNum& b) +{ + CAutoBN_CTX pctx; + CBigNum r; + if (!BN_mul(r.get(), a.getc(), b.getc(), pctx)) + throw bignum_error("CBigNum::operator* : BN_mul failed"); + return r; +} + +inline const CBigNum operator/(const CBigNum& a, const CBigNum& b) +{ + CAutoBN_CTX pctx; + CBigNum r; + if (!BN_div(r.get(), NULL, a.getc(), b.getc(), pctx)) + throw bignum_error("CBigNum::operator/ : BN_div failed"); + return r; +} + +inline const CBigNum operator%(const CBigNum& a, const CBigNum& b) +{ + CAutoBN_CTX pctx; + CBigNum r; + if (!BN_mod(r.get(), a.getc(), b.getc(), pctx)) + throw bignum_error("CBigNum::operator% : BN_div failed"); + return r; +} + +inline const CBigNum operator<<(const CBigNum& a, unsigned int shift) +{ + CBigNum r; + if (!BN_lshift(r.get(), a.getc(), shift)) + throw bignum_error("CBigNum:operator<< : BN_lshift failed"); + return r; +} + +inline const CBigNum operator>>(const CBigNum& a, unsigned int shift) +{ + CBigNum r = a; + r >>= shift; + return r; +} + +inline bool operator==(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.getc(), b.getc()) == 0); } +inline bool operator!=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.getc(), b.getc()) != 0); } +inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.getc(), b.getc()) <= 0); } +inline bool operator>=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.getc(), b.getc()) >= 0); } +inline bool operator<(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.getc(), b.getc()) < 0); } +inline bool operator>(const CBigNum& a, const CBigNum& b) { return (BN_cmp(a.getc(), b.getc()) > 0); } + +#endif diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000..6bea46b --- /dev/null +++ b/build.cmd @@ -0,0 +1,4 @@ +REM COMMAND LINE MS BUILD +REM Note: /m:2 = 2 threads, but for host code only... + +msbuild ccminer.vcxproj /m /p:Configuration=Release diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..577daff --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Simple script to create the Makefile and build + +# export PATH="$PATH:/usr/local/cuda/bin/" + +make distclean || echo clean + +rm -f Makefile.in +rm -f config.status +./autogen.sh || echo done + +# CFLAGS="-O2" ./configure +./configure.sh + +make -j 6 diff --git a/ccminer.conf b/ccminer.conf new file mode 100644 index 0000000..fe2c9dc --- /dev/null +++ b/ccminer.conf @@ -0,0 +1,19 @@ +{ + "_comment1" : "Possible keys are the long options (ccminer --help)", + "_comment2" : "todo: support /* comments */", + + "algo" : "blake", + "intensity": 19, + + "api-bind": "127.0.0.1:4068", + "statsavg": 20, + + "quiet" : false, + "debug" : false, + "protocol" : false, + "cpu-priority" : 3, + + "url" : "stratum+tcp://stratum.eu.miners-pool.eu:8421", + "user" : "ShGCAFrspnLDo414EzUyJm4k5Qr2Kkrmvh", + "pass" : "x" +} diff --git a/ccminer.cpp b/ccminer.cpp new file mode 100644 index 0000000..35efc27 --- /dev/null +++ b/ccminer.cpp @@ -0,0 +1,3787 @@ +/* + * Copyright 2010 Jeff Garzik + * Copyright 2012-2014 pooler + * Copyright 2014-2015 tpruvot + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. See COPYING for more details. + */ + +#include "cpuminer-config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef WIN32 +#include +#include +#else +#include +#include +#if HAVE_SYS_SYSCTL_H +#include +#if HAVE_SYS_PARAM_H +#include +#endif +#include +#endif +#endif + +#include "miner.h" +#include "algos.h" +#include + + +#ifdef WIN32 +#include +#pragma comment(lib, "winmm.lib") +#include "compat/winansi.h" +BOOL WINAPI ConsoleHandler(DWORD); +#endif + +#define PROGRAM_NAME "ccminer" +#define LP_SCANTIME 60 +#define HEAVYCOIN_BLKHDR_SZ 84 +#define MNR_BLKHDR_SZ 80 + +#include "nvml.h" +#ifdef USE_WRAPNVML +nvml_handle *hnvml = NULL; +#endif + +enum workio_commands { + WC_GET_WORK, + WC_SUBMIT_WORK, + WC_ABORT, +}; + +struct workio_cmd { + enum workio_commands cmd; + struct thr_info *thr; + union { + struct work *work; + } u; + int pooln; +}; + +bool opt_debug = false; +bool opt_debug_diff = false; +bool opt_debug_threads = false; +bool opt_protocol = false; +bool opt_benchmark = false; + +// todo: limit use of these flags, +// prefer the pools[] attributes +bool want_longpoll = true; +bool have_longpoll = false; +bool want_stratum = true; +bool have_stratum = false; +bool allow_gbt = true; +bool allow_mininginfo = true; +bool check_dups = false; +bool check_stratum_jobs = false; + +static bool submit_old = false; +bool use_syslog = false; +bool use_colors = true; +int use_pok = 0; +static bool opt_background = false; +bool opt_quiet = false; +static int opt_retries = -1; +static int opt_fail_pause = 30; +int opt_time_limit = -1; +int opt_shares_limit = -1; +time_t firstwork_time = 0; +int opt_timeout = 300; // curl +int opt_scantime = 60; +static json_t *opt_config; +static const bool opt_time = true; +volatile enum sha_algos opt_algo = ALGO_AUTO; +int opt_n_threads = 0; +int gpu_threads = 1; +int64_t opt_affinity = -1L; +int opt_priority = 0; +static double opt_difficulty = 1.; +bool opt_extranonce = true; +bool opt_trust_pool = false; +uint16_t opt_vote = 9999; +int num_cpus; +int active_gpus; +char * device_name[MAX_GPUS]; +short device_map[MAX_GPUS] = { 0 }; +long device_sm[MAX_GPUS] = { 0 }; +uint32_t gpus_intensity[MAX_GPUS] = { 0 }; +uint32_t device_gpu_clocks[MAX_GPUS] = { 0 }; +uint32_t device_mem_clocks[MAX_GPUS] = { 0 }; +uint32_t device_plimit[MAX_GPUS] = { 0 }; +uint8_t device_tlimit[MAX_GPUS] = { 0 }; +int8_t device_pstate[MAX_GPUS] = { -1 }; +int32_t device_led[MAX_GPUS] = { -1, -1 }; +int opt_led_mode = 0; +int opt_cudaschedule = -1; +static bool opt_keep_clocks = false; + +// un-linked to cmdline scrypt options (useless) +int device_batchsize[MAX_GPUS] = { 0 }; +int device_texturecache[MAX_GPUS] = { 0 }; +int device_singlememory[MAX_GPUS] = { 0 }; +// implemented scrypt options +int parallel = 2; // All should be made on GPU +char *device_config[MAX_GPUS] = { 0 }; +int device_backoff[MAX_GPUS] = { 0 }; +int device_lookup_gap[MAX_GPUS] = { 0 }; +int device_interactive[MAX_GPUS] = { 0 }; +int opt_nfactor = 0; +bool opt_autotune = true; +char *jane_params = NULL; + +// pools (failover/getwork infos) +struct pool_infos pools[MAX_POOLS] = { 0 }; +int num_pools = 1; +volatile int cur_pooln = 0; +bool opt_pool_failover = true; +volatile bool pool_on_hold = false; +volatile bool pool_is_switching = false; +volatile int pool_switch_count = 0; +bool conditional_pool_rotate = false; + +// current connection +char *rpc_user = NULL; +char *rpc_pass; +char *rpc_url; +char *short_url = NULL; + +struct stratum_ctx stratum = { 0 }; +pthread_mutex_t stratum_sock_lock; +pthread_mutex_t stratum_work_lock; + +char *opt_cert; +char *opt_proxy; +long opt_proxy_type; +struct thr_info *thr_info = NULL; +static int work_thr_id; +struct thr_api *thr_api; +int longpoll_thr_id = -1; +int stratum_thr_id = -1; +int api_thr_id = -1; +bool stratum_need_reset = false; +volatile bool abort_flag = false; +struct work_restart *work_restart = NULL; +static int app_exit_code = EXIT_CODE_OK; + +pthread_mutex_t applog_lock; +pthread_mutex_t stats_lock; +double thr_hashrates[MAX_GPUS] = { 0 }; +uint64_t global_hashrate = 0; +double stratum_diff = 0.0; +double net_diff = 0; +uint64_t net_hashrate = 0; +uint64_t net_blocks = 0; +// conditional mining +uint8_t conditional_state[MAX_GPUS] = { 0 }; +double opt_max_temp = 0.0; +double opt_max_diff = -1.; +double opt_max_rate = -1.; +double opt_resume_temp = 0.; +double opt_resume_diff = 0.; +double opt_resume_rate = -1.; + +int opt_statsavg = 30; + +// strdup on char* to allow a common free() if used +static char* opt_syslog_pfx = strdup(PROGRAM_NAME); +char *opt_api_allow = strdup("127.0.0.1"); /* 0.0.0.0 for all ips */ +int opt_api_remote = 0; +int opt_api_listen = 4068; /* 0 to disable */ + +bool opt_stratum_stats = false; + +static char const usage[] = "\ +Usage: " PROGRAM_NAME " [OPTIONS]\n\ +Options:\n\ + -a, --algo=ALGO specify the hash algorithm to use\n\ + blake Blake256-14rounds(SFR)\n\ + decred Blake256-14rounds(DCR)\n\ + blakecoin Blake256-8rounds (BLC)\n\ + vcash Blake256-8rounds (XVC)\n\ + blake2s Blake2s (NEVA/XVG)\n\ + keccak keccak256 (Maxcoin)\n\ + hsr X13+SM3 (Hshare)\n\ + lyra2 (LyraBar)\n\ + lyra2v2 (VertCoin)\n\ + skein Skein SHA2 (AUR/DGB/SKC)\n\ + skein2 Double Skein (Woodcoin)\n\ + nist5 NIST5 (Talkcoin/Power)\n\ + quark Quark (Quarkcoin)\n\ + qubit Qubit\n\ + x11 X11 (DarkCoin)\n\ + c11 C11 (Chaincoin)\n\ + sib X11+gost (Sibcoin)\n\ + x11evo Permuted x11 (Revolver)\n\ + x13 X13 (MaruCoin)\n\ + x14 X14 (BernCoin)\n\ + x15 X15 (Joincoin)\n\ + x17 X17 (XVG)\n\ + whirlpool whirlpool (JoinCoin)\n\ + lbry Lbry (Library Credits)\n\ + neoscrypt Neoscrypt (FTC/PXC/UFO)\n\ + sia Sia (SIAcoin)\n\ + myr-gr Myriad-Groestl (SFR/AUR/DGB/XVG/MYR)\n\ + veltor Thor's Riddle(?) (Veltor)\n\ + -d, --devices Comma separated list of CUDA devices to use.\n\ + Device IDs start counting from 0! Alternatively takes\n\ + string names of your cards like gtx780ti or gt640#2\n\ + (matching 2nd gt640 in the PC)\n\ + -i --intensity=N[,N] GPU intensity 8.0-25.0 (default: auto) \n\ + Decimals are allowed for fine tuning \n\ + --cuda-schedule Set device threads scheduling mode (default: auto)\n\ + -f, --diff-factor Divide difficulty by this factor (default 1.0) \n\ + -m, --diff-multiplier Multiply difficulty by this value (default 1.0) \n\ + --vote=VOTE vote (for decred and HeavyCoin)\n\ + --trust-pool trust the max block reward vote (maxvote) sent by the pool\n\ + -o, --url=URL URL of mining server\n\ + -O, --userpass=U:P username:password pair for mining server\n\ + -u, --user=USERNAME username for mining server\n\ + -p, --pass=PASSWORD password for mining server\n\ + --cert=FILE certificate for mining server using SSL\n\ + -x, --proxy=[PROTOCOL://]HOST[:PORT] connect through a proxy\n\ + -t, --threads=N number of miner threads (default: number of nVidia GPUs)\n\ + -r, --retries=N number of times to retry if a network call fails\n\ + (default: retry indefinitely)\n\ + -R, --retry-pause=N time to pause between retries, in seconds (default: 30)\n\ + --time-limit maximum time [s] to mine before exiting the program.\n\ + -T, --timeout=N network timeout, in seconds (default: 300)\n\ + -s, --scantime=N upper bound on time spent scanning current work when\n\ + long polling is unavailable, in seconds (default: 60)\n\ + -n, --ndevs list cuda devices\n\ + -N, --statsavg number of samples used to compute hashrate (default: 30)\n\ + --no-gbt disable getblocktemplate support (height check in solo)\n\ + --no-longpoll disable X-Long-Polling support\n\ + --no-stratum disable X-Stratum support\n\ + --no-extranonce disable extranonce subscribe on stratum\n\ + -q, --quiet disable per-thread hashmeter output\n\ + --no-color disable colored output\n\ + -D, --debug enable debug output\n\ + -P, --protocol-dump verbose dump of protocol-level activities\n\ + --cpu-affinity set process affinity to cpu core(s), mask 0x3 for cores 0 and 1\n\ + --cpu-priority set process priority (default: 3) 0 idle, 2 normal to 5 highest\n\ + -b, --api-bind=port IP:port for the miner API (default: 127.0.0.1:4068), 0 disabled\n\ + --api-remote Allow remote control, like pool switching\n\ + --max-temp=N Only mine if gpu temp is less than specified value\n\ + --max-rate=N[KMG] Only mine if net hashrate is less than specified value\n\ + --max-diff=N Only mine if net difficulty is less than specified value\n\ + Can be tuned with --resume-diff=N to set a resume value\n" +#if defined(__linux) || defined(_WIN64) /* via nvml */ +"\ + --mem-clock=3505 Set the gpu memory max clock (346.72+ driver)\n\ + --gpu-clock=1150 Set the gpu engine max clock (346.72+ driver)\n\ + --pstate=0[,2] Set the gpu power state (352.21+ driver)\n\ + --plimit=100W Set the gpu power limit (352.21+ driver)\n" +#else /* via nvapi.dll */ +"\ + --mem-clock=3505 Set the gpu memory boost clock\n\ + --gpu-clock=1150 Set the gpu engine boost clock\n\ + --plimit=100 Set the gpu power limit in percentage\n\ + --tlimit=80 Set the gpu thermal limit in degrees\n\ + --led=100 Set the logo led level (0=disable, 0xFF00FF for RVB)\n" +#endif +#ifdef HAVE_SYSLOG_H +"\ + -S, --syslog use system log for output messages\n\ + --syslog-prefix=... allow to change syslog tool name\n" +#endif +"\ + -B, --background run the miner in the background\n\ + --benchmark run in offline benchmark mode\n\ + --cputest debug hashes from cpu algorithms\n\ + -c, --config=FILE load a JSON-format configuration file\n\ + -V, --version display version information and exit\n\ + -h, --help display this help text and exit\n\ +"; + +static char const short_options[] = +#ifdef HAVE_SYSLOG_H + "S" +#endif + "a:Bc:i:Dhp:Px:f:m:nqr:R:s:t:T:o:u:O:Vd:N:b:l:L:"; + +struct option options[] = { + { "algo", 1, NULL, 'a' }, + { "api-bind", 1, NULL, 'b' }, + { "api-remote", 0, NULL, 1030 }, + { "background", 0, NULL, 'B' }, + { "benchmark", 0, NULL, 1005 }, + { "cert", 1, NULL, 1001 }, + { "config", 1, NULL, 'c' }, + { "cputest", 0, NULL, 1006 }, + { "cpu-affinity", 1, NULL, 1020 }, + { "cpu-priority", 1, NULL, 1021 }, + { "cuda-schedule", 1, NULL, 1025 }, + { "debug", 0, NULL, 'D' }, + { "help", 0, NULL, 'h' }, + { "intensity", 1, NULL, 'i' }, + { "ndevs", 0, NULL, 'n' }, + { "no-color", 0, NULL, 1002 }, + { "no-extranonce", 0, NULL, 1012 }, + { "no-gbt", 0, NULL, 1011 }, + { "no-longpoll", 0, NULL, 1003 }, + { "no-stratum", 0, NULL, 1007 }, + { "no-autotune", 0, NULL, 1004 }, // scrypt + { "interactive", 1, NULL, 1050 }, // scrypt + { "launch-config", 1, NULL, 'l' }, // scrypt + { "lookup-gap", 1, NULL, 'L' }, // scrypt + { "texture-cache", 1, NULL, 1051 },// scrypt + { "max-temp", 1, NULL, 1060 }, + { "max-diff", 1, NULL, 1061 }, + { "max-rate", 1, NULL, 1062 }, + { "resume-diff", 1, NULL, 1063 }, + { "resume-rate", 1, NULL, 1064 }, + { "resume-temp", 1, NULL, 1065 }, + { "pass", 1, NULL, 'p' }, + { "pool-name", 1, NULL, 1100 }, // pool + { "pool-algo", 1, NULL, 1101 }, // pool + { "pool-scantime", 1, NULL, 1102 }, // pool + { "pool-time-limit", 1, NULL, 1108 }, + { "pool-max-diff", 1, NULL, 1161 }, // pool + { "pool-max-rate", 1, NULL, 1162 }, // pool + { "pool-disabled", 1, NULL, 1199 }, // pool + { "protocol-dump", 0, NULL, 'P' }, + { "proxy", 1, NULL, 'x' }, + { "quiet", 0, NULL, 'q' }, + { "retries", 1, NULL, 'r' }, + { "retry-pause", 1, NULL, 'R' }, + { "scantime", 1, NULL, 's' }, + { "statsavg", 1, NULL, 'N' }, + { "gpu-clock", 1, NULL, 1070 }, + { "mem-clock", 1, NULL, 1071 }, + { "pstate", 1, NULL, 1072 }, + { "plimit", 1, NULL, 1073 }, + { "keep-clocks", 0, NULL, 1074 }, + { "tlimit", 1, NULL, 1075 }, + { "led", 1, NULL, 1080 }, +#ifdef HAVE_SYSLOG_H + { "syslog", 0, NULL, 'S' }, + { "syslog-prefix", 1, NULL, 1018 }, +#endif + { "shares-limit", 1, NULL, 1009 }, + { "time-limit", 1, NULL, 1008 }, + { "threads", 1, NULL, 't' }, + { "vote", 1, NULL, 1022 }, + { "trust-pool", 0, NULL, 1023 }, + { "timeout", 1, NULL, 'T' }, + { "url", 1, NULL, 'o' }, + { "user", 1, NULL, 'u' }, + { "userpass", 1, NULL, 'O' }, + { "version", 0, NULL, 'V' }, + { "devices", 1, NULL, 'd' }, + { "diff-multiplier", 1, NULL, 'm' }, + { "diff-factor", 1, NULL, 'f' }, + { "diff", 1, NULL, 'f' }, // compat + { 0, 0, 0, 0 } +}; + +static char const scrypt_usage[] = "\n\ +Scrypt specific options:\n\ + -l, --launch-config gives the launch configuration for each kernel\n\ + in a comma separated list, one per device.\n\ + -L, --lookup-gap Divides the per-hash memory requirement by this factor\n\ + by storing only every N'th value in the scratchpad.\n\ + Default is 1.\n\ + --interactive comma separated list of flags (0/1) specifying\n\ + which of the CUDA device you need to run at inter-\n\ + active frame rates (because it drives a display).\n\ + --texture-cache comma separated list of flags (0/1/2) specifying\n\ + which of the CUDA devices shall use the texture\n\ + cache for mining. Kepler devices may profit.\n\ + --no-autotune disable auto-tuning of kernel launch parameters\n\ +"; + +struct work _ALIGN(64) g_work; +volatile time_t g_work_time; +pthread_mutex_t g_work_lock; + +// get const array size (defined in ccminer.cpp) +int options_count() +{ + int n = 0; + while (options[n].name != NULL) + n++; + return n; +} + +#ifdef __linux /* Linux specific policy and affinity management */ +#include +static inline void drop_policy(void) { + struct sched_param param; + param.sched_priority = 0; +#ifdef SCHED_IDLE + if (unlikely(sched_setscheduler(0, SCHED_IDLE, ¶m) == -1)) +#endif +#ifdef SCHED_BATCH + sched_setscheduler(0, SCHED_BATCH, ¶m); +#endif +} + +static void affine_to_cpu_mask(int id, unsigned long mask) { + cpu_set_t set; + CPU_ZERO(&set); + for (uint8_t i = 0; i < num_cpus; i++) { + // cpu mask + if (mask & (1UL< +static inline void drop_policy(void) { } +static void affine_to_cpu_mask(int id, unsigned long mask) { + cpuset_t set; + CPU_ZERO(&set); + for (uint8_t i = 0; i < num_cpus; i++) { + if (mask & (1UL<data[18] : swab32(work->data[18]); + if (opt_algo == ALGO_LBRY) nbits = swab32(work->data[26]); + if (opt_algo == ALGO_DECRED) nbits = work->data[29]; + if (opt_algo == ALGO_SIA) nbits = work->data[11]; // unsure if correct + uint32_t bits = (nbits & 0xffffff); + int16_t shift = (swab32(nbits) & 0xff); // 0x1c = 28 + + uint64_t diffone = 0x0000FFFF00000000ull; + double d = (double)0x0000ffff / (double)bits; + + for (int m=shift; m < 29; m++) d *= 256.0; + for (int m=29; m < shift; m++) d /= 256.0; + if (opt_algo == ALGO_DECRED && shift == 28) d *= 256.0; + if (opt_debug_diff) + applog(LOG_DEBUG, "net diff: %f -> shift %u, bits %08x", d, shift, bits); + + net_diff = d; +} + +/* decode data from getwork (wallets and longpoll pools) */ +static bool work_decode(const json_t *val, struct work *work) +{ + int data_size, target_size = sizeof(work->target); + int adata_sz, atarget_sz = ARRAY_SIZE(work->target); + int i; + + switch (opt_algo) { + case ALGO_DECRED: + data_size = 192; + adata_sz = 180/4; + break; + case ALGO_NEOSCRYPT: + data_size = 80; + adata_sz = data_size / 4; + break; + default: + data_size = 128; + adata_sz = data_size / 4; + } + + if (!jobj_binary(val, "data", work->data, data_size)) { + json_t *obj = json_object_get(val, "data"); + int len = obj ? (int) strlen(json_string_value(obj)) : 0; + if (!len || len > sizeof(work->data)*2) { + applog(LOG_ERR, "JSON invalid data (len %d <> %d)", len/2, data_size); + return false; + } else { + data_size = len / 2; + if (!jobj_binary(val, "data", work->data, data_size)) { + applog(LOG_ERR, "JSON invalid data (len %d)", data_size); + return false; + } + } + } + + if (!jobj_binary(val, "target", work->target, target_size)) { + applog(LOG_ERR, "JSON invalid target"); + return false; + } + + work->maxvote = 0; + + for (i = 0; i < adata_sz; i++) + work->data[i] = le32dec(work->data + i); + for (i = 0; i < atarget_sz; i++) + work->target[i] = le32dec(work->target + i); + + if (!allow_mininginfo) + calc_network_diff(work); + + work->targetdiff = target_to_diff(work->target); + + // for api stats, on longpoll pools + stratum_diff = work->targetdiff; + + work->tx_count = use_pok = 0; +/* if (work->data[0] & POK_BOOL_MASK) { + use_pok = 1; + json_t *txs = json_object_get(val, "txs"); + if (txs && json_is_array(txs)) { + size_t idx, totlen = 0; + json_t *p; + + json_array_foreach(txs, idx, p) { + const int tx = work->tx_count % POK_MAX_TXS; + const char* hexstr = json_string_value(p); + size_t txlen = strlen(hexstr)/2; + work->tx_count++; + if (work->tx_count > POK_MAX_TXS || txlen >= POK_MAX_TX_SZ) { + // when tx is too big, just reset use_pok for the block + use_pok = 0; + if (opt_debug) applog(LOG_WARNING, + "pok: large block ignored, tx len: %u", txlen); + work->tx_count = 0; + break; + } + hex2bin((uchar*)work->txs[tx].data, hexstr, min(txlen, POK_MAX_TX_SZ)); + work->txs[tx].len = (uint32_t) (txlen); + totlen += txlen; + } + if (opt_debug) + applog(LOG_DEBUG, "block txs: %u, total len: %u", work->tx_count, totlen); + } + }*/ + + /* use work ntime as job id (solo-mining) */ + cbin2hex(work->job_id, (const char*)&work->data[17], 4); + + if (opt_algo == ALGO_DECRED) { + uint16_t vote; + // always keep last bit of votebits + memcpy(&vote, &work->data[25], 2); + vote = (opt_vote << 1) | (vote & 1); + memcpy(&work->data[25], &vote, 2); + // some random extradata to make it unique + work->data[36] = (rand()*4); + work->data[37] = (rand()*4) << 8; + // required for the longpoll pool block info... + work->height = work->data[32]; + if (!have_longpoll && work->height > net_blocks + 1) { + char netinfo[64] = { 0 }; + if (net_diff > 0.) { + if (net_diff != work->targetdiff) + sprintf(netinfo, ", diff %.3f, pool %.1f", net_diff, work->targetdiff); + else + sprintf(netinfo, ", diff %.3f", net_diff); + } + applog(LOG_BLUE, "%s block %d%s", + algo_names[opt_algo], work->height, netinfo); + net_blocks = work->height - 1; + } + cbin2hex(work->job_id, (const char*)&work->data[34], 4); + } + + return true; +} + +#define YES "yes!" +#define YAY "yay!!!" +#define BOO "booooo" + +int share_result(int result, int pooln, double sharediff, const char *reason) +{ + const char *flag; + char suppl[32] = { 0 }; + char s[32] = { 0 }; + double hashrate = 0.; + struct pool_infos *p = &pools[pooln]; + + pthread_mutex_lock(&stats_lock); + for (int i = 0; i < opt_n_threads; i++) { + hashrate += stats_get_speed(i, thr_hashrates[i]); + } + pthread_mutex_unlock(&stats_lock); + + result ? p->accepted_count++ : p->rejected_count++; + + p->last_share_time = time(NULL); + if (sharediff > p->best_share) + p->best_share = sharediff; + + global_hashrate = llround(hashrate); + + format_hashrate(hashrate, s); + + if (!net_diff || sharediff < net_diff) { + flag = use_colors ? + (result ? CL_GRN YES : CL_RED BOO) + : (result ? "(" YES ")" : "(" BOO ")"); + } else { + p->solved_count++; + flag = use_colors ? + (result ? CL_GRN YAY : CL_RED BOO) + : (result ? "(" YAY ")" : "(" BOO ")"); + } + + applog(LOG_NOTICE, "[S/A/T]: %lu/%lu/%lu, diff: %2.3f, %s %s",p->solved_count, p->accepted_count, p->accepted_count + p->rejected_count,sharediff, s, flag); + if (reason) { + applog(LOG_WARNING, "reject reason: %s", reason); + if (!check_dups && strncasecmp(reason, "duplicate", 9) == 0) { + applog(LOG_WARNING, "enabling duplicates check feature"); + check_dups = true; + g_work_time = 0; + } + } + return 1; +} + +static bool submit_upstream_work(CURL *curl, struct work *work) +{ + char s[512]; + struct pool_infos *pool = &pools[work->pooln]; + json_t *val, *res, *reason; + bool stale_work = false; + + /* discard if a newer block was received */ + stale_work = work->height && work->height < g_work.height; + +/* + if (have_stratum && !stale_work) { + pthread_mutex_lock(&g_work_lock); + if (strlen(work->job_id + 8)) + stale_work = strncmp(work->job_id + 8, g_work.job_id + 8, sizeof(g_work.job_id) - 8); + if (stale_work) { + pool->stales_count++; + if (opt_debug) applog(LOG_DEBUG, "outdated job %s, new %s stales=%d", + work->job_id + 8 , g_work.job_id + 8, pool->stales_count); + if (!check_stratum_jobs && pool->stales_count > 5) { + if (!opt_quiet) applog(LOG_WARNING, "Enabled stratum stale jobs workaround"); + check_stratum_jobs = true; + } + } + pthread_mutex_unlock(&g_work_lock); + } +*/ + if (!have_stratum && !stale_work && allow_gbt) { + struct work wheight = { 0 }; + if (get_blocktemplate(curl, &wheight)) { + if (work->height && work->height < wheight.height) { + if (opt_debug) + applog(LOG_WARNING, "block %u was already solved", work->height); + return true; + } + } + } + +// if (!stale_work && opt_algo == ALGO_ZR5 && !have_stratum) { +// stale_work = (memcmp(&work->data[1], &g_work.data[1], 68)); +// } + + if (!submit_old && stale_work) { + if (opt_debug) + applog(LOG_WARNING, "stale work detected, discarding"); + return true; + } + + if (pool->type & POOL_STRATUM) { + uint32_t sent = 0; + uint32_t ntime, nonce; + char *ntimestr, *noncestr, *xnonce2str, *nvotestr; + uint16_t nvote = 0; + + switch (opt_algo) { + case ALGO_BLAKE: + case ALGO_BLAKECOIN: + case ALGO_BLAKE2S: + case ALGO_VCASH: + // fast algos require that... (todo: regen hash) + check_dups = true; + le32enc(&ntime, work->data[17]); + le32enc(&nonce, work->data[19]); + break; + case ALGO_DECRED: + be16enc(&nvote, *((uint16_t*)&work->data[25])); + be32enc(&ntime, work->data[34]); + be32enc(&nonce, work->data[35]); + break; + case ALGO_LBRY: + check_dups = true; + le32enc(&ntime, work->data[25]); + le32enc(&nonce, work->data[27]); + break; + case ALGO_SIA: + be32enc(&ntime, work->data[10]); + be32enc(&nonce, work->data[8]); + break; + default: + le32enc(&ntime, work->data[17]); + le32enc(&nonce, work->data[19]); + } + noncestr = bin2hex((const uchar*)(&nonce), 4); + + if (check_dups) + sent = hashlog_already_submittted(work->job_id, nonce); + if (sent > 0) { + sent = (uint32_t) time(NULL) - sent; + if (!opt_quiet) { + applog(LOG_WARNING, "nonce %s was already sent %u seconds ago", noncestr, sent); + hashlog_dump_job(work->job_id); + } + free(noncestr); + // prevent useless computing on some pools + g_work_time = 0; + restart_threads(); + return true; + } + + ntimestr = bin2hex((const uchar*)(&ntime), 4); + + if (opt_algo == ALGO_DECRED) { + xnonce2str = bin2hex((const uchar*)&work->data[36], stratum.xnonce1_size); + } else if (opt_algo == ALGO_SIA) { + uint16_t high_nonce = swab32(work->data[9]) >> 16; + xnonce2str = bin2hex((unsigned char*)(&high_nonce), 2); + } else { + xnonce2str = bin2hex(work->xnonce2, work->xnonce2_len); + } + + // store to keep/display the solved ratio/diff + stratum.sharediff = work->sharediff[0]; + + if (net_diff && stratum.sharediff > net_diff && (opt_debug || opt_debug_diff)) + applog(LOG_INFO, "share diff: %.5f, possible block found!!!", + stratum.sharediff); + else if (opt_debug_diff) + applog(LOG_DEBUG, "share diff: %.5f (x %.1f)", + stratum.sharediff, work->shareratio); + + if (opt_vote) { // ALGO_HEAVY ALGO_DECRED + nvotestr = bin2hex((const uchar*)(&nvote), 2); + sprintf(s, "{\"method\": \"mining.submit\", \"params\": [" + "\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}", + pool->user, work->job_id + 8, xnonce2str, ntimestr, noncestr, nvotestr); + free(nvotestr); + } else { + sprintf(s, "{\"method\": \"mining.submit\", \"params\": [" + "\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}", + pool->user, work->job_id + 8, xnonce2str, ntimestr, noncestr); + } + free(xnonce2str); + free(ntimestr); + free(noncestr); + + gettimeofday(&stratum.tv_submit, NULL); + if (unlikely(!stratum_send_line(&stratum, s))) { + applog(LOG_ERR, "submit_upstream_work stratum_send_line failed"); + return false; + } + + if (check_dups) + hashlog_remember_submit(work, nonce); + + } else { + + int data_size = 128; + int adata_sz = data_size / sizeof(uint32_t); + + /* build hex string */ + char *str = NULL; + + if (opt_algo == ALGO_DECRED) { + data_size = 192; adata_sz = 180/4; + } else if(opt_algo == ALGO_SIA){ + return sia_submit(curl,pool,work); + } + + for (int i = 0; i < adata_sz; i++) + le32enc(work->data + i, work->data[i]); + + str = bin2hex((uchar*)work->data, data_size); + if (unlikely(!str)) { + applog(LOG_ERR, "submit_upstream_work OOM"); + return false; + } + + /* build JSON-RPC request */ + sprintf(s, + "{\"method\": \"getwork\", \"params\": [\"%s\"], \"id\":4}\r\n", + str); + + /* issue JSON-RPC request */ + val = json_rpc_call_pool(curl, pool, s, false, false, NULL); + if (unlikely(!val)) { + applog(LOG_ERR, "submit_upstream_work json_rpc_call failed"); + return false; + } + + res = json_object_get(val, "result"); + reason = json_object_get(val, "reject-reason"); + if (!share_result(json_is_true(res), work->pooln, work->sharediff[0], + reason ? json_string_value(reason) : NULL)) + { + if (check_dups) + hashlog_purge_job(work->job_id); + } + + json_decref(val); + + free(str); + } + + return true; +} + +/* simplified method to only get some extra infos in solo mode */ +static bool gbt_work_decode(const json_t *val, struct work *work) +{ + json_t *err = json_object_get(val, "error"); + if (err && !json_is_null(err)) { + allow_gbt = false; + applog(LOG_INFO, "GBT not supported, block height unavailable"); + return false; + } + + if (!work->height) { + // complete missing data from getwork + json_t *key = json_object_get(val, "height"); + if (key && json_is_integer(key)) { + work->height = (uint32_t) json_integer_value(key); + if (!opt_quiet && work->height > g_work.height) { + if (net_diff > 0.) { + char netinfo[64] = { 0 }; + char srate[32] = { 0 }; + sprintf(netinfo, "diff %.2f", net_diff); + if (net_hashrate) { + format_hashrate((double) net_hashrate, srate); + strcat(netinfo, ", net "); + strcat(netinfo, srate); + } + applog(LOG_BLUE, "%s block %d, %s", algo_names[opt_algo], work->height, netinfo); + } else { + applog(LOG_BLUE, "%s %s block %d", short_url,algo_names[opt_algo], work->height); + } + g_work.height = work->height; + } + } + } + + return true; +} + +#define GBT_CAPABILITIES "[\"coinbasetxn\", \"coinbasevalue\", \"longpoll\", \"workid\"]" +static const char *gbt_req = + "{\"method\": \"getblocktemplate\", \"params\": [{" + // "\"capabilities\": " GBT_CAPABILITIES "" + "}], \"id\":9}\r\n"; + +static bool get_blocktemplate(CURL *curl, struct work *work) +{ + struct pool_infos *pool = &pools[work->pooln]; + if (!allow_gbt) + return false; + + int curl_err = 0; + json_t *val = json_rpc_call_pool(curl, pool, gbt_req, false, false, &curl_err); + + if (!val && curl_err == -1) { + // when getblocktemplate is not supported, disable it + allow_gbt = false; + if (!opt_quiet) { + applog(LOG_BLUE, "gbt not supported, block height notices disabled"); + } + return false; + } + + bool rc = gbt_work_decode(json_object_get(val, "result"), work); + + json_decref(val); + + return rc; +} + +// good alternative for wallet mining, difficulty and net hashrate +static const char *info_req = + "{\"method\": \"getmininginfo\", \"params\": [], \"id\":8}\r\n"; + +static bool get_mininginfo(CURL *curl, struct work *work) +{ + struct pool_infos *pool = &pools[work->pooln]; + int curl_err = 0; + + if (have_stratum || have_longpoll || !allow_mininginfo) + return false; + + json_t *val = json_rpc_call_pool(curl, pool, info_req, false, false, &curl_err); + + if (!val && curl_err == -1) { + allow_mininginfo = false; + if (opt_debug) { + applog(LOG_DEBUG, "getmininginfo not supported"); + } + return false; + } else { + json_t *res = json_object_get(val, "result"); + // "blocks": 491493 (= current work height - 1) + // "difficulty": 0.99607860999999998 + // "networkhashps": 56475980 + // "netmhashps": 351.74414726 + if (res) { + json_t *key = json_object_get(res, "difficulty"); + if (key) { + if (json_is_object(key)) + key = json_object_get(key, "proof-of-work"); + if (json_is_real(key)) + net_diff = json_real_value(key); + } + key = json_object_get(res, "networkhashps"); + if (key && json_is_integer(key)) { + net_hashrate = json_integer_value(key); + } + key = json_object_get(res, "netmhashps"); + if (key && json_is_real(key)) { + net_hashrate = (uint64_t)(json_real_value(key) * 1e6); + } + key = json_object_get(res, "blocks"); + if (key && json_is_integer(key)) { + net_blocks = json_integer_value(key); + } + } + } + json_decref(val); + return true; +} + +/* +static const char *rpc_req = + "{\"method\": \"getwork\", \"params\": [], \"id\":0}\r\n"; +*/ +static const char *json_rpc_getwork = + "{\"method\":\"getwork\",\"params\":[],\"id\":0}\r\n"; + +static bool get_upstream_work(CURL *curl, struct work *work) +{ + bool rc = false; + struct timeval tv_start, tv_end, diff; + struct pool_infos *pool = &pools[work->pooln]; + const char *rpc_req = json_rpc_getwork; + json_t *val; + + gettimeofday(&tv_start, NULL); + + if (opt_algo == ALGO_SIA) { + char *sia_header = sia_getheader(curl, pool); + if (sia_header) { + rc = sia_work_decode(sia_header, work); + free(sia_header); + } + gettimeofday(&tv_end, NULL); + if (have_stratum || unlikely(work->pooln != cur_pooln)) { + return rc; + } + return rc; + } + + if (opt_debug_threads) + applog(LOG_DEBUG, "%s: want_longpoll=%d have_longpoll=%d", __func__, want_longpoll, have_longpoll); + /* want_longpoll/have_longpoll required here to init/unlock the lp thread */ + val = json_rpc_call_pool(curl, pool, rpc_req, want_longpoll, have_longpoll, NULL); + gettimeofday(&tv_end, NULL); + + if (have_stratum || unlikely(work->pooln != cur_pooln)) { + if (val) + json_decref(val); + return false; + } + + if (!val) + return false; + + rc = work_decode(json_object_get(val, "result"), work); + + if (opt_protocol && rc) { + timeval_subtract(&diff, &tv_end, &tv_start); + /* show time because curl can be slower against versions/config */ + applog(LOG_DEBUG, "got new work in %.2f ms", + (1000.0 * diff.tv_sec) + (0.001 * diff.tv_usec)); + } + + json_decref(val); + + get_mininginfo(curl, work); + get_blocktemplate(curl, work); + + return rc; +} + +static void workio_cmd_free(struct workio_cmd *wc) +{ + if (!wc) + return; + + switch (wc->cmd) { + case WC_SUBMIT_WORK: + aligned_free(wc->u.work); + break; + default: /* do nothing */ + break; + } + + memset(wc, 0, sizeof(*wc)); /* poison */ + free(wc); +} + +static void workio_abort() +{ + struct workio_cmd *wc; + + /* fill out work request message */ + wc = (struct workio_cmd *)calloc(1, sizeof(*wc)); + if (!wc) + return; + + wc->cmd = WC_ABORT; + + /* send work request to workio thread */ + if (!tq_push(thr_info[work_thr_id].q, wc)) { + workio_cmd_free(wc); + } +} + +static bool workio_get_work(struct workio_cmd *wc, CURL *curl) +{ + struct work *ret_work; + int failures = 0; + + ret_work = (struct work*)aligned_calloc(sizeof(struct work)); + if (!ret_work) + return false; + + /* assign pool number before rpc calls */ + ret_work->pooln = wc->pooln; + // applog(LOG_DEBUG, "%s: pool %d", __func__, wc->pooln); + + /* obtain new work from bitcoin via JSON-RPC */ + while (!get_upstream_work(curl, ret_work)) { + + if (unlikely(ret_work->pooln != cur_pooln)) { + applog(LOG_ERR, "get_work json_rpc_call failed"); + aligned_free(ret_work); + tq_push(wc->thr->q, NULL); + return true; + } + + if (unlikely((opt_retries >= 0) && (++failures > opt_retries))) { + applog(LOG_ERR, "get_work json_rpc_call failed"); + aligned_free(ret_work); + return false; + } + + /* pause, then restart work-request loop */ + applog(LOG_ERR, "get_work failed, retry after %d seconds", + opt_fail_pause); + sleep(opt_fail_pause); + } + + /* send work to requesting thread */ + if (!tq_push(wc->thr->q, ret_work)) + aligned_free(ret_work); + + return true; +} + +static bool workio_submit_work(struct workio_cmd *wc, CURL *curl) +{ + int failures = 0; + uint32_t pooln = wc->pooln; + // applog(LOG_DEBUG, "%s: pool %d", __func__, wc->pooln); + + /* submit solution to bitcoin via JSON-RPC */ + while (!submit_upstream_work(curl, wc->u.work)) { + if (pooln != cur_pooln) { + applog(LOG_DEBUG, "work from pool %u discarded", pooln); + return true; + } + if (unlikely((opt_retries >= 0) && (++failures > opt_retries))) { + applog(LOG_ERR, "...terminating workio thread"); + return false; + } + /* pause, then restart work-request loop */ + if (!opt_benchmark) + applog(LOG_ERR, "...retry after %d seconds", opt_fail_pause); + + sleep(opt_fail_pause); + } + + return true; +} + +static void *workio_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info*)userdata; + CURL *curl; + bool ok = true; + + curl = curl_easy_init(); + if (unlikely(!curl)) { + applog(LOG_ERR, "CURL initialization failed"); + return NULL; + } + + while (ok && !abort_flag) { + struct workio_cmd *wc; + + /* wait for workio_cmd sent to us, on our queue */ + wc = (struct workio_cmd *)tq_pop(mythr->q, NULL); + if (!wc) { + ok = false; + break; + } + + /* process workio_cmd */ + switch (wc->cmd) { + case WC_GET_WORK: + ok = workio_get_work(wc, curl); + break; + case WC_SUBMIT_WORK: + if (opt_led_mode == LED_MODE_SHARES) + gpu_led_on(device_map[wc->thr->id]); + ok = workio_submit_work(wc, curl); + if (opt_led_mode == LED_MODE_SHARES) + gpu_led_off(device_map[wc->thr->id]); + break; + case WC_ABORT: + default: /* should never happen */ + ok = false; + break; + } + + if (!ok && num_pools > 1 && opt_pool_failover) { + if (opt_debug_threads) + applog(LOG_DEBUG, "%s died, failover", __func__); + ok = pool_switch_next(-1); + tq_push(wc->thr->q, NULL); // get_work() will return false + } + + workio_cmd_free(wc); + } + + if (opt_debug_threads) + applog(LOG_DEBUG, "%s() died", __func__); + curl_easy_cleanup(curl); + tq_freeze(mythr->q); + return NULL; +} + +bool get_work(struct thr_info *thr, struct work *work) +{ + struct workio_cmd *wc; + struct work *work_heap; + + if (opt_benchmark) { + memset(work->data, 0x55, 76); + //work->data[17] = swab32((uint32_t)time(NULL)); + memset(work->data + 19, 0x00, 52); + if (opt_algo == ALGO_DECRED) { + memset(&work->data[35], 0x00, 52); + } else if (opt_algo == ALGO_LBRY) { + work->data[28] = 0x80000000; + } else { + work->data[20] = 0x80000000; + work->data[31] = 0x00000280; + } + memset(work->target, 0x00, sizeof(work->target)); + return true; + } + + /* fill out work request message */ + wc = (struct workio_cmd *)calloc(1, sizeof(*wc)); + if (!wc) + return false; + + wc->cmd = WC_GET_WORK; + wc->thr = thr; + wc->pooln = cur_pooln; + + /* send work request to workio thread */ + if (!tq_push(thr_info[work_thr_id].q, wc)) { + workio_cmd_free(wc); + return false; + } + + /* wait for response, a unit of work */ + work_heap = (struct work *)tq_pop(thr->q, NULL); + if (!work_heap) + return false; + + /* copy returned work into storage provided by caller */ + memcpy(work, work_heap, sizeof(*work)); + aligned_free(work_heap); + + return true; +} + +static bool submit_work(struct thr_info *thr, const struct work *work_in) +{ + struct workio_cmd *wc; + /* fill out work request message */ + wc = (struct workio_cmd *)calloc(1, sizeof(*wc)); + if (!wc) + return false; + + wc->u.work = (struct work *)aligned_calloc(sizeof(*work_in)); + if (!wc->u.work) + goto err_out; + + wc->cmd = WC_SUBMIT_WORK; + wc->thr = thr; + memcpy(wc->u.work, work_in, sizeof(struct work)); + wc->pooln = work_in->pooln; + + /* send solution to workio thread */ + if (!tq_push(thr_info[work_thr_id].q, wc)) + goto err_out; + + return true; + +err_out: + workio_cmd_free(wc); + return false; +} + +static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) +{ + uchar merkle_root[64] = { 0 }; + int i; + + if (!sctx->job.job_id) { + // applog(LOG_WARNING, "stratum_gen_work: job not yet retrieved"); + return false; + } + + pthread_mutex_lock(&stratum_work_lock); + + // store the job ntime as high part of jobid + snprintf(work->job_id, sizeof(work->job_id), "%07x %s", + be32dec(sctx->job.ntime) & 0xfffffff, sctx->job.job_id); + work->xnonce2_len = sctx->xnonce2_size; + memcpy(work->xnonce2, sctx->job.xnonce2, sctx->xnonce2_size); + + // also store the block number + work->height = sctx->job.height; + // and the pool of the current stratum + work->pooln = sctx->pooln; + + /* Generate merkle root */ + switch (opt_algo) { + case ALGO_DECRED: + case ALGO_SIA: + // getwork over stratum, no merkle to generate + break; + case ALGO_KECCAK: + case ALGO_BLAKECOIN: + SHA256((uchar*)sctx->job.coinbase, sctx->job.coinbase_size, (uchar*)merkle_root); + break; +// case ALGO_WHIRLPOOLX: + case ALGO_WHIRLPOOL: + default: + sha256d(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size); + } + + for (i = 0; i < sctx->job.merkle_count; i++) { + memcpy(merkle_root + 32, sctx->job.merkle[i], 32); + sha256d(merkle_root, merkle_root, 64); + } + + /* Increment extranonce2 */ + for (i = 0; i < (int)sctx->xnonce2_size && !++sctx->job.xnonce2[i]; i++); + + /* Assemble block header */ + memset(work->data, 0, sizeof(work->data)); + work->data[0] = le32dec(sctx->job.version); + for (i = 0; i < 8; i++) + work->data[1 + i] = le32dec((uint32_t *)sctx->job.prevhash + i); + + if (opt_algo == ALGO_DECRED) { + uint16_t vote; + for (i = 0; i < 8; i++) // reversed prevhash + work->data[1 + i] = swab32(work->data[1 + i]); + // decred header (coinb1) [merkle...nonce] + memcpy(&work->data[9], sctx->job.coinbase, 108); + // last vote bit should never be changed + memcpy(&vote, &work->data[25], 2); + vote = (opt_vote << 1) | (vote & 1); + memcpy(&work->data[25], &vote, 2); + // extradata + if (sctx->xnonce1_size > sizeof(work->data)-(36*4)) { + // should never happen... + applog(LOG_ERR, "extranonce size overflow!"); + sctx->xnonce1_size = sizeof(work->data)-(36*4); + } + memcpy(&work->data[36], sctx->xnonce1, sctx->xnonce1_size); + // work->data[36] = swab32(vote); // alt vote submission method + work->data[37] = (rand()*4) << 8; // random work data + sctx->job.height = work->data[32]; + //applog_hex(work->data, 180); + } else if (opt_algo == ALGO_SIA) { + uint32_t extra = 0; + memcpy(&extra, &sctx->job.coinbase[32], 2); + for (i = 0; i < 8; i++) // reversed hash + work->data[i] = ((uint32_t*)sctx->job.prevhash)[7-i]; + work->data[8] = 0; // nonce + work->data[9] = swab32(extra) | ((rand() << 8) & 0xffff); + work->data[10] = be32dec(sctx->job.ntime); + work->data[11] = be32dec(sctx->job.nbits); + memcpy(&work->data[12], sctx->job.coinbase, 32); // merkle_root + work->data[20] = 0x80000000; + if (opt_debug) applog_hex(work->data, 80); + } else if (opt_algo == ALGO_LBRY) { + for (i = 0; i < 8; i++) + work->data[9 + i] = be32dec((uint32_t *)merkle_root + i); + for (i = 0; i < 8; i++) + work->data[17 + i] = ((uint32_t*)sctx->job.claim)[i]; + work->data[25] = le32dec(sctx->job.ntime); + work->data[26] = le32dec(sctx->job.nbits); + work->data[28] = 0x80000000; + } else { + for (i = 0; i < 8; i++) + work->data[9 + i] = be32dec((uint32_t *)merkle_root + i); + work->data[17] = le32dec(sctx->job.ntime); + work->data[18] = le32dec(sctx->job.nbits); + work->data[20] = 0x80000000; + work->data[31] = 0x00000280; + } + + calc_network_diff(work); + + pthread_mutex_unlock(&stratum_work_lock); + + if (opt_debug && opt_algo != ALGO_DECRED && opt_algo != ALGO_SIA) { + uint32_t utm = work->data[17]; + utm = swab32(utm); + char *tm = atime2str(utm - sctx->srvtime_diff); + char *xnonce2str = bin2hex(work->xnonce2, sctx->xnonce2_size); + applog(LOG_DEBUG, "DEBUG: job_id=%s xnonce2=%s time=%s", + work->job_id, xnonce2str, tm); + free(tm); + free(xnonce2str); + } + + if (opt_difficulty == 0.) + opt_difficulty = 1.; + + switch (opt_algo) { + case ALGO_NEOSCRYPT: + work_set_target(work, sctx->job.diff / (65536.0 * opt_difficulty)); + break; + case ALGO_KECCAK: + case ALGO_LBRY: + case ALGO_LYRA2v2: + work_set_target(work, sctx->job.diff / (256.0 * opt_difficulty)); + break; + case ALGO_LYRA2: + work_set_target(work, sctx->job.diff / (128.0 * opt_difficulty)); + break; + default: + work_set_target(work, sctx->job.diff / opt_difficulty); + } + + if (stratum_diff != sctx->job.diff) { + char sdiff[32] = { 0 }; + // store for api stats + stratum_diff = sctx->job.diff; + if (work->targetdiff != stratum_diff) + snprintf(sdiff, 32, " (%.5f)", work->targetdiff); + applog(LOG_WARNING, "Stratum difficulty set to %g%s", stratum_diff, sdiff); + } + + return true; +} + +void restart_threads(void) +{ + if (opt_debug && !opt_quiet) + applog(LOG_DEBUG,"%s", __FUNCTION__); + + for (int i = 0; i < opt_n_threads && work_restart; i++) + work_restart[i].restart = 1; +} + +static bool wanna_mine(int thr_id) +{ + bool state = true; + bool allow_pool_rotate = (thr_id == 0 && num_pools > 1 && !pool_is_switching); + + if (opt_max_temp > 0.0) { +#ifdef USE_WRAPNVML + struct cgpu_info * cgpu = &thr_info[thr_id].gpu; + uint32_t temp = gpu_temp(cgpu); + if (temp > opt_max_temp) { + if (!conditional_state[thr_id] && !opt_quiet) + gpulog(LOG_INFO, thr_id, "temperature too high (%.0f°c), waiting...", temp); + state = false; + } else if (opt_max_temp > 0. && opt_resume_temp > 0. && conditional_state[thr_id] && temp > opt_resume_temp) { + if (!thr_id && opt_debug) + applog(LOG_DEBUG, "temperature did not reach resume value %.1f...", opt_resume_temp); + state = false; + } +#endif + } + // Network Difficulty + if (opt_max_diff > 0.0 && net_diff > opt_max_diff) { + int next = pool_get_first_valid(cur_pooln+1); + if (num_pools > 1 && pools[next].max_diff != pools[cur_pooln].max_diff && opt_resume_diff <= 0.) + conditional_pool_rotate = allow_pool_rotate; + if (!thr_id && !conditional_state[thr_id] && !opt_quiet) + applog(LOG_INFO, "network diff too high, waiting..."); + state = false; + } else if (opt_max_diff > 0. && opt_resume_diff > 0. && conditional_state[thr_id] && net_diff > opt_resume_diff) { + if (!thr_id && opt_debug) + applog(LOG_DEBUG, "network diff did not reach resume value %.3f...", opt_resume_diff); + state = false; + } + // Network hashrate + if (opt_max_rate > 0.0 && net_hashrate > opt_max_rate) { + int next = pool_get_first_valid(cur_pooln+1); + if (pools[next].max_rate != pools[cur_pooln].max_rate && opt_resume_rate <= 0.) + conditional_pool_rotate = allow_pool_rotate; + if (!thr_id && !conditional_state[thr_id] && !opt_quiet) { + char rate[32]; + format_hashrate(opt_max_rate, rate); + applog(LOG_INFO, "network hashrate too high, waiting %s...", rate); + } + state = false; + } else if (opt_max_rate > 0. && opt_resume_rate > 0. && conditional_state[thr_id] && net_hashrate > opt_resume_rate) { + if (!thr_id && opt_debug) + applog(LOG_DEBUG, "network rate did not reach resume value %.3f...", opt_resume_rate); + state = false; + } + conditional_state[thr_id] = (uint8_t) !state; // only one wait message in logs + return state; +} + +static void *miner_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info *)userdata; + + int switchn = pool_switch_count; + int thr_id = mythr->id; + int dev_id = device_map[thr_id % MAX_GPUS]; + + struct work work; + uint64_t loopcnt = 0; + uint32_t max_nonce; + uint32_t end_nonce = UINT32_MAX / opt_n_threads * (thr_id + 1) - (thr_id + 1); + bool work_done = false; + bool extrajob = false; + char s[16]; + int rc = 0; + + struct timeval info_display_start, info_display_end; + struct timeval hw_sampling_start, hw_sampling_end; + int display_interval = 30; + int hw_sampling_interval = 300; + struct cgpu_info * cgpu = &thr_info[thr_id].gpu; + + memset(&work, 0, sizeof(work)); // prevent work from being used uninitialized + + if (opt_priority > 0) { + int prio = 2; // default to normal +#ifndef WIN32 + prio = 0; + // note: different behavior on linux (-19 to 19) + switch (opt_priority) { + case 0: + prio = 15; + break; + case 1: + prio = 5; + break; + case 2: + prio = 0; // normal process + break; + case 3: + prio = -1; // above + break; + case 4: + prio = -10; + break; + case 5: + prio = -15; + } + if (opt_debug) + applog(LOG_DEBUG, "Thread %d priority %d (nice %d)", thr_id, opt_priority, prio); +#endif + setpriority(PRIO_PROCESS, 0, prio); + drop_policy(); + } + + /* Cpu thread affinity */ + if (num_cpus > 1) { + if (opt_affinity == -1L && opt_n_threads > 1) { + if (opt_debug) + applog(LOG_DEBUG, "Binding thread %d to cpu %d (mask %x)", thr_id, thr_id % num_cpus, (1UL << (thr_id % num_cpus))); + affine_to_cpu_mask(thr_id, 1 << (thr_id % num_cpus)); + } else if (opt_affinity != -1L) { + if (opt_debug) + applog(LOG_DEBUG, "Binding thread %d to cpu mask %lx", thr_id, (long) opt_affinity); + affine_to_cpu_mask(thr_id, (unsigned long) opt_affinity); + } + } + + gpu_led_off(dev_id); + + gettimeofday(&info_display_start, NULL); + gettimeofday(&hw_sampling_start, NULL); + + while (!abort_flag) { + struct timeval tv_start, tv_end, diff; + unsigned long hashes_done; + uint32_t start_nonce; + uint32_t scan_time = have_longpoll ? LP_SCANTIME : opt_scantime; + uint64_t max64, minmax = 0x100000; + int nodata_check_oft = 0; + bool regen = false; + + // &work.data[19] + int wcmplen = (opt_algo == ALGO_DECRED) ? 140 : 76; + int wcmpoft = 0; + + if (opt_algo == ALGO_LBRY) wcmplen = 108; + else if(opt_algo == ALGO_SIA){ + wcmpoft = (32+16)/4; + wcmplen = 32; + } + uint32_t *nonceptr = (uint32_t*) (((char*)work.data) + wcmplen); + + if (have_stratum) { + uint32_t sleeptime = 0; + + if (opt_algo == ALGO_DECRED) + work_done = true; // force "regen" hash + while (!work_done && time(NULL) >= (g_work_time + opt_scantime)) { + usleep(100*1000); + if (sleeptime > 4) { + extrajob = true; + break; + } + sleeptime++; + } + if (sleeptime && opt_debug && !opt_quiet) + applog(LOG_DEBUG, "sleeptime: %u ms", sleeptime*100); + nonceptr = (uint32_t*) (((char*)work.data) + wcmplen); + pthread_mutex_lock(&g_work_lock); + extrajob |= work_done; + + regen = (nonceptr[0] >= end_nonce); + if (opt_algo == ALGO_SIA) { + regen = ((nonceptr[1] & 0xFF00) >= 0xF000); + } + regen = regen || extrajob; + + if (regen) { + work_done = false; + extrajob = false; + if (stratum_gen_work(&stratum, &g_work)) + g_work_time = time(NULL); + } + } else { + uint32_t secs = 0; + pthread_mutex_lock(&g_work_lock); + secs = (uint32_t) (time(NULL) - g_work_time); + if (secs >= scan_time || nonceptr[0] >= (end_nonce - 0x100)) { + if (opt_debug && g_work_time && !opt_quiet) + applog(LOG_DEBUG, "work time %u/%us nonce %x/%x", secs, scan_time, nonceptr[0], end_nonce); + /* obtain new work from internal workio thread */ + if (unlikely(!get_work(mythr, &g_work))) { + pthread_mutex_unlock(&g_work_lock); + if (switchn != pool_switch_count) { + switchn = pool_switch_count; + continue; + } else { + applog(LOG_ERR, "work retrieval failed, exiting mining thread %d", mythr->id); + goto out; + } + } + g_work_time = time(NULL); + } + } + + if (!opt_benchmark && (g_work.height != work.height || memcmp(work.target, g_work.target, sizeof(work.target)))) + { + if (opt_debug) { + uint64_t target64 = g_work.target[7] * 0x100000000ULL + g_work.target[6]; + applog(LOG_DEBUG, "job %s target change: %llx (%.1f)", g_work.job_id, target64, g_work.targetdiff); + } + memcpy(work.target, g_work.target, sizeof(work.target)); + work.targetdiff = g_work.targetdiff; + work.height = g_work.height; + //nonceptr[0] = (UINT32_MAX / opt_n_threads) * thr_id; // 0 if single thr + } + + if (memcmp(&work.data[wcmpoft], &g_work.data[wcmpoft], wcmplen)) { + #if 0 + if (opt_debug) { + for (int n=0; n <= (wcmplen-8); n+=8) { + if (memcmp(work.data + n, g_work.data + n, 8)) { + applog(LOG_DEBUG, "job %s work updated at offset %d:", g_work.job_id, n); + applog_hash((uchar*) &work.data[n]); + applog_compare_hash((uchar*) &g_work.data[n], (uchar*) &work.data[n]); + } + } + } + #endif + memcpy(&work, &g_work, sizeof(struct work)); + nonceptr[0] = (UINT32_MAX / opt_n_threads) * thr_id; // 0 if single thr + } else + nonceptr[0]++; //?? + + if (opt_algo == ALGO_DECRED) { + // suprnova job_id check without data/target/height change... + if (check_stratum_jobs && strcmp(work.job_id, g_work.job_id)) { + pthread_mutex_unlock(&g_work_lock); + continue; + } + + // use the full range per loop + nonceptr[0] = 0; + end_nonce = UINT32_MAX; + // and make an unique work (extradata) + nonceptr[1] += 1; + nonceptr[2] |= thr_id; + } else if (opt_algo == ALGO_SIA) { + // suprnova job_id check without data/target/height change... + if (have_stratum && strcmp(work.job_id, g_work.job_id)) { + pthread_mutex_unlock(&g_work_lock); + work_done = true; + continue; + } + nonceptr[1] += opt_n_threads; + nonceptr[1] |= thr_id; + // range max + nonceptr[0] = 0; + end_nonce = UINT32_MAX; + } else if (opt_benchmark) { + // randomize work + nonceptr[-1] += 1; + } + + pthread_mutex_unlock(&g_work_lock); + + // --benchmark [-a all] + if (opt_benchmark && bench_algo >= 0) { + //gpulog(LOG_DEBUG, thr_id, "loop %d", loopcnt); + if (loopcnt >= 3) { + if (!bench_algo_switch_next(thr_id) && thr_id == 0) + { + bench_display_results(); + proper_exit(0); + break; + } + loopcnt = 0; + } + } + loopcnt++; + + /* prevent gpu scans before a job is received */ + if (opt_algo == ALGO_SIA) nodata_check_oft = 7; // no stratum version + else if (opt_algo == ALGO_DECRED) nodata_check_oft = 4; // testnet ver is 0 + else nodata_check_oft = 0; + if (have_stratum && work.data[nodata_check_oft] == 0 && !opt_benchmark){ + sleep(1); + if (!thr_id) pools[cur_pooln].wait_time += 1; + gpulog(LOG_DEBUG, thr_id, "no data"); + continue; + } + + /* conditional mining */ + if (!wanna_mine(thr_id)) { + + // free gpu resources + algo_free_all(thr_id); + // clear any free error (algo switch) + cuda_clear_lasterror(); + + // conditional pool switch + if (num_pools > 1 && conditional_pool_rotate) { + if (!pool_is_switching) + pool_switch_next(thr_id); + else if (time(NULL) - firstwork_time > 35) { + if (!opt_quiet) + applog(LOG_WARNING, "Pool switching timed out..."); + if (!thr_id) pools[cur_pooln].wait_time += 1; + pool_is_switching = false; + } + sleep(1); + continue; + } + + pool_on_hold = true; + global_hashrate = 0; + sleep(5); + if (!thr_id) pools[cur_pooln].wait_time += 5; + continue; + } + pool_on_hold = false; + + work_restart[thr_id].restart = 0; + + /* adjust max_nonce to meet target scan time */ + if (have_stratum) + max64 = LP_SCANTIME; + else + max64 = max(1, (int64_t) scan_time + g_work_time - time(NULL)); + + /* time limit */ + if (opt_time_limit > 0 && firstwork_time) { + int passed = (int)(time(NULL) - firstwork_time); + int remain = (int)(opt_time_limit - passed); + if (remain < 0) { + if (thr_id != 0) { + sleep(1); + continue; + } + if (num_pools > 1 && pools[cur_pooln].time_limit > 0) { + if (!pool_is_switching) { + if (!opt_quiet) + applog(LOG_INFO, "Pool mining timeout of %ds reached, rotate...", opt_time_limit); + pool_switch_next(thr_id); + } else if (passed > 35) { + // ensure we dont stay locked if pool_is_switching is not reset... + applog(LOG_WARNING, "Pool switch to %d timed out...", cur_pooln); + if (!thr_id) pools[cur_pooln].wait_time += 1; + pool_is_switching = false; + } + sleep(1); + continue; + } + app_exit_code = EXIT_CODE_TIME_LIMIT; + abort_flag = true; + if (opt_benchmark) { + char rate[32]; + format_hashrate((double)global_hashrate, rate); + applog(LOG_NOTICE, "Benchmark: %s", rate); + usleep(200*1000); + fprintf(stderr, "%llu\n", (long long unsigned int) global_hashrate); + } else { + applog(LOG_NOTICE, + "Mining timeout of %ds reached, exiting...", opt_time_limit); + } + workio_abort(); + break; + } + if (remain < max64) max64 = remain; + } + + /* shares limit */ + if (opt_shares_limit > 0 && firstwork_time) { + int64_t shares = (pools[cur_pooln].accepted_count + pools[cur_pooln].rejected_count); + if (shares >= opt_shares_limit) { + int passed = (int)(time(NULL) - firstwork_time); + if (thr_id != 0) { + sleep(1); continue; + } + if (num_pools > 1 && pools[cur_pooln].shares_limit > 0) { + if (!pool_is_switching) { + if (!opt_quiet) + applog(LOG_INFO, "Pool shares limit of %d reached, rotate...", opt_shares_limit); + pool_switch_next(thr_id); + } else if (passed > 35) { + // ensure we dont stay locked if pool_is_switching is not reset... + applog(LOG_WARNING, "Pool switch to %d timed out...", cur_pooln); + if (!thr_id) pools[cur_pooln].wait_time += 1; + pool_is_switching = false; + } + sleep(1); + continue; + } + abort_flag = true; + app_exit_code = EXIT_CODE_OK; + applog(LOG_NOTICE, "Mining limit of %d shares reached, exiting...", opt_shares_limit); + workio_abort(); + break; + } + } + + max64 *= (uint32_t)thr_hashrates[thr_id]; + + /* on start, max64 should not be 0, + * before hashrate is computed */ + if (max64 < minmax) { + switch (opt_algo) { + + case ALGO_BLAKECOIN: + case ALGO_BLAKE2S: + case ALGO_VCASH: + minmax = 0x80000000U; + break; +// case ALGO_WHIRLPOOLX: + case ALGO_DECRED: + case ALGO_BLAKE: + minmax = 0x40000000U; + break; + case ALGO_KECCAK: + case ALGO_LBRY: + case ALGO_SIA: + case ALGO_SKEIN: + case ALGO_SKEIN2: + case ALGO_LYRA2v2: + minmax = 0x8000000; + break; + case ALGO_NEOSCRYPT: + case ALGO_SIB: + case ALGO_VELTOR: + case ALGO_LYRA2: + minmax = 0x80000; + break; + case ALGO_C11: + case ALGO_HSR: + case ALGO_X11: + case ALGO_X11EVO: + case ALGO_X13: + case ALGO_WHIRLPOOL: + minmax = 0x400000; + break; + case ALGO_X14: + case ALGO_X15: + case ALGO_X17: + minmax = 0x300000; + break; + + } + max64 = max(minmax-1, max64); + } + + // we can't scan more than uint32 capacity + max64 = min(UINT32_MAX, max64); + + start_nonce = nonceptr[0]; + + /* never let small ranges at end */ + if (end_nonce >= UINT32_MAX - 256) + end_nonce = UINT32_MAX; + + if ((max64 + start_nonce) >= end_nonce) + max_nonce = end_nonce; + else + max_nonce = (uint32_t) (max64 + start_nonce); + + // todo: keep it rounded to a multiple of 256 ? + + if (unlikely(start_nonce > max_nonce)) { + // should not happen but seen in skein2 benchmark with 2 gpus + max_nonce = end_nonce = UINT32_MAX; + } + + work.scanned_from = start_nonce; + + gpulog(LOG_DEBUG, thr_id, "start=%08x end=%08x range=%08x", + start_nonce, max_nonce, (max_nonce-start_nonce)); + + if (opt_led_mode == LED_MODE_MINING) + gpu_led_on(dev_id); + + hashes_done = 0; + gettimeofday(&tv_start, NULL); + + // check (and reset) previous errors + cudaError_t err = cudaGetLastError(); + if (err != cudaSuccess && !opt_quiet) + gpulog(LOG_WARNING, thr_id, "%s", cudaGetErrorString(err)); + + /* Raise sampling flag and send a sampling signal (once in a while)*/ + if (!opt_quiet){ + if(!opt_benchmark){ + gettimeofday(&hw_sampling_end, NULL); + timeval_subtract(&diff, &hw_sampling_end, &hw_sampling_start); + if (diff.tv_sec > hw_sampling_interval){ + cgpu->monitor.sampling_flag = true; + pthread_cond_signal(&cgpu->monitor.sampling_signal); + gettimeofday(&hw_sampling_start, NULL); + } + } + } + if(opt_debug){ + cgpu->monitor.sampling_flag = true; + pthread_cond_signal(&cgpu->monitor.sampling_signal); + } + /* scan nonces for a proof-of-work hash */ + switch (opt_algo) { + case ALGO_KECCAK: + rc = scanhash_keccak256(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_BLAKE: + rc = scanhash_blake256_14round(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_DECRED: + //applog(LOG_BLUE, "version %x, nbits %x, ntime %x extra %x", + // work.data[0], work.data[29], work.data[34], work.data[38]); + rc = scanhash_decred(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_BLAKECOIN: + case ALGO_VCASH: + rc = scanhash_blake256_8round(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_BLAKE2S: + rc = scanhash_blake2s(thr_id, &work, max_nonce, &hashes_done); + break; +/* case ALGO_WHIRLPOOLX: + rc = scanhash_whirlpoolx(thr_id, &work, max_nonce, &hashes_done); + break;*/ + case ALGO_LYRA2: + rc = scanhash_lyra2(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_LYRA2v2: + rc = scanhash_lyra2v2(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_SKEIN: + rc = scanhash_skeincoin(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_SKEIN2: + rc = scanhash_skein2(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_NIST5: + rc = scanhash_nist5(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_QUARK: + rc = scanhash_quark(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_QUBIT: + rc = scanhash_qubit(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_WHIRLPOOL: + rc = scanhash_whirl(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_X11: + rc = scanhash_x11(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_X11EVO: + rc = scanhash_x11evo(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_C11: + rc = scanhash_c11(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_HSR: + rc = scanhash_hsr(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_SIB: + rc = scanhash_sib(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_VELTOR: + rc = scanhash_veltor(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_X13: + rc = scanhash_x13(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_X14: + rc = scanhash_x14(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_X15: + rc = scanhash_x15(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_X17: + rc = scanhash_x17(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_LBRY: + rc = scanhash_lbry(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_NEOSCRYPT: + rc = scanhash_neoscrypt(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_SIA: + rc = scanhash_sia(thr_id, &work, max_nonce, &hashes_done); + break; + case ALGO_MYR_GR: + rc = scanhash_myriad(thr_id, &work, max_nonce, &hashes_done); + break; + default: + /* should never happen */ + goto out; + } + + /* Drop sampling flag */ + cgpu->monitor.sampling_flag = false; + + if (opt_led_mode == LED_MODE_MINING) + gpu_led_off(dev_id); + + if (abort_flag) + break; // time to leave the mining loop... + + if (work_restart[thr_id].restart) + continue; + + /* record scanhash elapsed time */ + gettimeofday(&tv_end, NULL); + + // todo: update all algos to use work->nonces + if (opt_algo != ALGO_SIA) // reversed endian + work.nonces[0] = nonceptr[0]; + if (opt_algo != ALGO_DECRED && opt_algo != ALGO_BLAKE2S && opt_algo != ALGO_LBRY && opt_algo != ALGO_SIA) { + work.nonces[1] = nonceptr[2]; + } + + if (rc > 0 && opt_debug) + applog(LOG_NOTICE, CL_CYN "found => %08x" CL_GRN " %08x", work.nonces[0], swab32(work.nonces[0])); + if (rc > 1 && opt_debug) + applog(LOG_NOTICE, CL_CYN "found => %08x" CL_GRN " %08x", work.nonces[1], swab32(work.nonces[1])); + + timeval_subtract(&diff, &tv_end, &tv_start); + + if (diff.tv_usec || diff.tv_sec) { + double dtime = (double) diff.tv_sec + 1e-6 * diff.tv_usec; + + /* hashrate factors for some algos */ + double rate_factor = 1.0; + switch (opt_algo) { + case ALGO_QUARK: + // to stay comparable to other ccminer forks or pools + rate_factor = 0.5; + break; + } + /* store thread hashrate */ + if (dtime > 0.0) { + pthread_mutex_lock(&stats_lock); + thr_hashrates[thr_id] = hashes_done / dtime; + thr_hashrates[thr_id] *= rate_factor; + if (loopcnt > 1) // ignore first (init time) + stats_remember_speed(thr_id, hashes_done, thr_hashrates[thr_id], (uint8_t) rc, work.height); + pthread_mutex_unlock(&stats_lock); + } + } + + if (rc > 0) + work.scanned_to = start_nonce + hashes_done;//work.nonces[0]; + if (rc > 1) + work.scanned_to = max(work.nonces[0], work.nonces[1]); + else { + work.scanned_to = max_nonce; + if (opt_debug && opt_benchmark) { + // to debug nonce ranges + gpulog(LOG_DEBUG, thr_id, "ends=%08x range=%08x", nonceptr[0], (nonceptr[0] - start_nonce)); + } + // prevent low scan ranges on next loop on fast algos (blake) + if (nonceptr[0] > UINT32_MAX - 64) + nonceptr[0] = UINT32_MAX; + } + + if (check_dups && opt_algo != ALGO_DECRED && opt_algo != ALGO_SIA) + hashlog_remember_scan_range(&work); + + /*Less spammy output */ + bool display=false; + if (!opt_quiet && loopcnt > 1) { + gettimeofday(&info_display_end, NULL); + timeval_subtract(&diff, &info_display_end, &info_display_start); + double dtime = (double) diff.tv_sec + 1e-6 * diff.tv_usec; + if(dtime>display_interval){ + display=true; + if(display_interval<300)display_interval+=10; // slowly increase the stats interval, up to 5 minutes per gpu + } + } + if(opt_debug) + display=true; + + if(display){ + gettimeofday(&info_display_start, NULL); + format_hashrate(thr_hashrates[thr_id], s); + #ifdef USE_WRAPNVML + if (hnvml != NULL) { + gpulog(LOG_INFO, thr_id, "%s, %s", device_name[dev_id], s); + pthread_mutex_lock(&cgpu->monitor.lock); + if (cgpu->monitor.gpu_power != 0){ + gpulog(LOG_INFO, thr_id, "%s, %1.2gMH/W, %1.2gMH/Mhz", + device_name[dev_id], (double)(thr_hashrates[thr_id] / 1.0e6) / (cgpu->monitor.gpu_power / 1000), + (double)(thr_hashrates[thr_id] / 1.0e6) / (cgpu->monitor.gpu_clock)); + gpulog(LOG_INFO, thr_id, "%s, %uC(F:%u%%) %u/%uMHz(%uW)", + device_name[dev_id], cgpu->monitor.gpu_temp, cgpu->monitor.gpu_fan,cgpu->monitor.gpu_clock, + cgpu->monitor.gpu_memclock,(cgpu->monitor.gpu_power / 1000)); + } + pthread_mutex_unlock(&cgpu->monitor.lock); + }else + #endif + { + gpulog(LOG_INFO, thr_id, "%s, %s", device_name[dev_id], s); + } + } + /* ignore first loop hashrate */ + if (firstwork_time && thr_id == (opt_n_threads - 1)) { + double hashrate = 0.; + pthread_mutex_lock(&stats_lock); + for (int i = 0; i < opt_n_threads && thr_hashrates[i]; i++) + hashrate += stats_get_speed(i, thr_hashrates[i]); + pthread_mutex_unlock(&stats_lock); + if (opt_benchmark && bench_algo == -1 && loopcnt > 2) { + format_hashrate(hashrate, s); + applog(LOG_NOTICE, "Total: %s", s); + } + + // since pool start + pools[cur_pooln].work_time = (uint32_t) (time(NULL) - firstwork_time); + + // X-Mining-Hashrate + global_hashrate = llround(hashrate); + } + + if (firstwork_time == 0) + firstwork_time = time(NULL); + + /* if nonce found, submit work */ + if (rc > 0 && !opt_benchmark) { + + if (opt_led_mode == LED_MODE_SHARES) + gpu_led_percent(dev_id, 50); + + if (!submit_work(mythr, &work)) + break; + + // prevent stale work in solo. We can't submit twice a block! + if (!have_stratum && !have_longpoll) { + pthread_mutex_lock(&g_work_lock); + // will force getwork + g_work_time = 0; + pthread_mutex_unlock(&g_work_lock); +// if (rc > 1) //??? +// work.scanned_to = work.nonces[0]; + continue; + } + + // second nonce found, submit too (on pool only!) + if (rc > 1) { + nonceptr[0] = work.nonces[1]; + if (!submit_work(mythr, &work)) + break; + } + } + nonceptr[ 0] = work.scanned_to; + } + +out: + if (opt_led_mode) + gpu_led_off(dev_id); + if (opt_debug_threads) + applog(LOG_DEBUG, "%s() died", __func__); + tq_freeze(mythr->q); + return NULL; +} + +#ifdef USE_WRAPNVML +static void *monitor_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info *)userdata; + int thr_id = mythr->id; + int dev_id = device_map[thr_id % MAX_GPUS]; + if (opt_priority > 0) { + int prio = 2; // default to normal +#ifndef WIN32 + prio = 0; + // note: different behavior on linux (-19 to 19) + switch (opt_priority) { + case 0: + prio = 15; + break; + case 1: + prio = 5; + break; + case 2: + prio = 0; // normal process + break; + case 3: + prio = -1; // above + break; + case 4: + prio = -10; + break; + case 5: + prio = -15; + } + if (opt_debug) + applog(LOG_DEBUG, "Thread %d priority %d (nice %d)", + thr_id, opt_priority, prio); +#endif + setpriority(PRIO_PROCESS, 0, prio); + drop_policy(); + } + + /* Cpu thread affinity */ + if (num_cpus > 1) { + if (opt_affinity == -1L && opt_n_threads > 1) { + if (opt_debug) + applog(LOG_DEBUG, "Binding monitor thread %d to cpu %d (mask %x)", thr_id, + thr_id % num_cpus, (1UL << (thr_id % num_cpus))); + affine_to_cpu_mask(thr_id, 1 << (thr_id % num_cpus)); + } else if (opt_affinity != -1L) { + if (opt_debug) + applog(LOG_DEBUG, "Binding monitor thread %d to cpu mask %lx", thr_id, + (long) opt_affinity); + affine_to_cpu_mask(thr_id, (unsigned long) opt_affinity); + } + } + + struct cgpu_info * cgpu = &thr_info[thr_id].gpu; + + while (!abort_flag && !opt_quiet) { + pthread_cond_wait(&cgpu->monitor.sampling_signal,&cgpu->monitor.lock); + if (hnvml != NULL) { + uint32_t tempC=0,fanpercent=0,power=0,clock=0,mem_clock=0,counter=0; + do{ + tempC += gpu_temp(cgpu); + fanpercent += gpu_fanpercent(cgpu); + power += gpu_power(cgpu); + uint32_t tmp_clock,tmp_memclock; + nvml_get_current_clocks(device_map[thr_id], &tmp_clock, &tmp_memclock); + clock+=tmp_clock; + mem_clock+=tmp_memclock; + counter++; + usleep(5000); + }while(cgpu->monitor.sampling_flag);//make sure at least one sample will be fetched + + cgpu->monitor.gpu_temp = tempC/counter; + cgpu->monitor.gpu_fan = fanpercent/counter; + cgpu->monitor.gpu_power = power/counter; + cgpu->monitor.gpu_clock = clock/counter; + cgpu->monitor.gpu_memclock = mem_clock/counter; + pthread_mutex_unlock(&cgpu->monitor.lock); + } + } + if (opt_debug_threads) + applog(LOG_DEBUG, "%s() died", __func__); + return NULL; +} +#endif + +static void *longpoll_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info *)userdata; + struct pool_infos *pool; + CURL *curl = NULL; + char *hdr_path = NULL, *lp_url = NULL; + const char *rpc_req = json_rpc_getwork; + bool need_slash = false; + int pooln, switchn; + + curl = curl_easy_init(); + if (unlikely(!curl)) { + applog(LOG_ERR, "%s() CURL init failed", __func__); + goto out; + } + +wait_lp_url: + hdr_path = (char*)tq_pop(mythr->q, NULL); // wait /LP url + if (!hdr_path) + goto out; + + if (!(pools[cur_pooln].type & POOL_STRATUM)) { + pooln = cur_pooln; + pool = &pools[pooln]; + } else { + // hack... + have_stratum = true; + } + + // to detect pool switch during loop + switchn = pool_switch_count; + + if (opt_algo == ALGO_SIA) { + goto out; + } + + /* full URL */ + else if (strstr(hdr_path, "://")) { + lp_url = hdr_path; + hdr_path = NULL; + } + /* absolute path, on current server */ + else { + char *copy_start = (*hdr_path == '/') ? (hdr_path + 1) : hdr_path; + if (rpc_url[strlen(rpc_url) - 1] != '/') + need_slash = true; + + lp_url = (char*)malloc(strlen(rpc_url) + strlen(copy_start) + 2); + if (!lp_url) + goto out; + + sprintf(lp_url, "%s%s%s", rpc_url, need_slash ? "/" : "", copy_start); + } + + if (!pool_is_switching) + applog(LOG_BLUE, "Long-polling on %s", lp_url); + + pool_is_switching = false; + + pool->type |= POOL_LONGPOLL; + +longpoll_retry: + + while (!abort_flag) { + json_t *val = NULL, *soval; + int err = 0; + + if (opt_debug_threads) + applog(LOG_DEBUG, "longpoll %d: %d count %d %d, switching=%d, have_stratum=%d", + pooln, cur_pooln, switchn, pool_switch_count, pool_is_switching, have_stratum); + + // exit on pool switch + if (switchn != pool_switch_count) + goto need_reinit; + + if (opt_algo == ALGO_SIA) { + char *sia_header = sia_getheader(curl, pool); + if (sia_header) { + pthread_mutex_lock(&g_work_lock); + if (sia_work_decode(sia_header, &g_work)) { + g_work_time = time(NULL); + } + free(sia_header); + pthread_mutex_unlock(&g_work_lock); + } + continue; + } + + val = json_rpc_longpoll(curl, lp_url, pool, rpc_req, &err); + if (have_stratum || switchn != pool_switch_count) { + if (val) + json_decref(val); + goto need_reinit; + } + + if (likely(val)) { + soval = json_object_get(json_object_get(val, "result"), "submitold"); + submit_old = soval ? json_is_true(soval) : false; + pthread_mutex_lock(&g_work_lock); + if (work_decode(json_object_get(val, "result"), &g_work)) { + restart_threads(); + if (!opt_quiet) { + char netinfo[64] = { 0 }; + if (net_diff > 0.) { + sprintf(netinfo, ", diff %.3f", net_diff); + } + sprintf(&netinfo[strlen(netinfo)], ", target %.3f", g_work.targetdiff); + + if (g_work.height) + applog(LOG_BLUE, "%s block %u%s", algo_names[opt_algo], g_work.height, netinfo); + else + applog(LOG_BLUE, "%s detected new block%s", short_url, netinfo); + } + g_work_time = time(NULL); + } + pthread_mutex_unlock(&g_work_lock); + json_decref(val); + } else { + // to check... + g_work_time = 0; + if (err != CURLE_OPERATION_TIMEDOUT) { + if (opt_debug_threads) applog(LOG_DEBUG, "%s() err %d, retry in %s seconds", + __func__, err, opt_fail_pause); + sleep(opt_fail_pause); + goto longpoll_retry; + } + } + } + +out: + have_longpoll = false; + if (opt_debug_threads) + applog(LOG_DEBUG, "%s() died", __func__); + + free(hdr_path); + free(lp_url); + tq_freeze(mythr->q); + if (curl) + curl_easy_cleanup(curl); + + return NULL; + +need_reinit: + /* this thread should not die to allow pool switch */ + have_longpoll = false; + if (opt_debug_threads) + applog(LOG_DEBUG, "%s() reinit...", __func__); + if (hdr_path) free(hdr_path); hdr_path = NULL; + if (lp_url) free(lp_url); lp_url = NULL; + goto wait_lp_url; +} + +static bool stratum_handle_response(char *buf) +{ + json_t *val, *err_val, *res_val, *id_val; + json_error_t err; + struct timeval tv_answer, diff; + int num = 0; + bool ret = false; + + val = JSON_LOADS(buf, &err); + if (!val) { + applog(LOG_INFO, "JSON decode failed(%d): %s", err.line, err.text); + goto out; + } + + res_val = json_object_get(val, "result"); + err_val = json_object_get(val, "error"); + id_val = json_object_get(val, "id"); + + if (!id_val || json_is_null(id_val) || !res_val) + goto out; + + // ignore late login answers + num = (int) json_integer_value(id_val); + if (num < 4) + goto out; + + gettimeofday(&tv_answer, NULL); + timeval_subtract(&diff, &tv_answer, &stratum.tv_submit); + // store time required to the pool to answer to a submit + stratum.answer_msec = (1000 * diff.tv_sec) + (uint32_t) (0.001 * diff.tv_usec); + + share_result(json_is_true(res_val), stratum.pooln, stratum.sharediff, + err_val ? json_string_value(json_array_get(err_val, 1)) : NULL); + + ret = true; +out: + if (val) + json_decref(val); + + return ret; +} + +static void *stratum_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info *)userdata; + struct pool_infos *pool; + stratum_ctx *ctx = &stratum; + int pooln, switchn; + char *s; + +wait_stratum_url: + stratum.url = (char*)tq_pop(mythr->q, NULL); + if (!stratum.url) + goto out; + + if (!pool_is_switching) + applog(LOG_BLUE, "Starting on %s", stratum.url); + + ctx->pooln = pooln = cur_pooln; + switchn = pool_switch_count; + pool = &pools[pooln]; + + pool_is_switching = false; + stratum_need_reset = false; + + while (!abort_flag) { + int failures = 0; + + if (stratum_need_reset) { + stratum_need_reset = false; + if (stratum.url) + stratum_disconnect(&stratum); + else + stratum.url = strdup(pool->url); // may be useless + } + + while (!stratum.curl && !abort_flag) { + pthread_mutex_lock(&g_work_lock); + g_work_time = 0; + g_work.data[0] = 0; + pthread_mutex_unlock(&g_work_lock); + restart_threads(); + + if (!stratum_connect(&stratum, pool->url) || + !stratum_subscribe(&stratum) || + !stratum_authorize(&stratum, pool->user, pool->pass)) + { + stratum_disconnect(&stratum); + if (opt_retries >= 0 && ++failures > opt_retries) { + if (num_pools > 1 && opt_pool_failover) { + applog(LOG_WARNING, "Stratum connect timeout, failover..."); + pool_switch_next(-1); + } else { + applog(LOG_ERR, "...terminating workio thread"); + //tq_push(thr_info[work_thr_id].q, NULL); + workio_abort(); + proper_exit(EXIT_CODE_POOL_TIMEOUT); + goto out; + } + } + if (switchn != pool_switch_count) + goto pool_switched; + if (!opt_benchmark) + applog(LOG_ERR, "...retry after %d seconds", opt_fail_pause); + sleep(opt_fail_pause); + } + } + + if (switchn != pool_switch_count) goto pool_switched; + + if (stratum.job.job_id && (!g_work_time || strncmp(stratum.job.job_id, g_work.job_id + 8, sizeof(g_work.job_id)-8))) { + pthread_mutex_lock(&g_work_lock); + if (stratum_gen_work(&stratum, &g_work)) + g_work_time = time(NULL); + if (stratum.job.clean) { + static uint32_t last_bloc_height; + if (!opt_quiet && stratum.job.height != last_bloc_height) { + last_bloc_height = stratum.job.height; + if (net_diff > 0.) + applog(LOG_BLUE, "%s block %d, diff %.3f", algo_names[opt_algo], + stratum.job.height, net_diff); + else + applog(LOG_BLUE, "%s %s block %d", pool->short_url, algo_names[opt_algo], + stratum.job.height); + } + restart_threads(); + if (check_dups) + hashlog_purge_old(); + stats_purge_old(); + } else if (opt_debug && !opt_quiet) { + applog(LOG_BLUE, "%s asks job %08x for block %d", pool->short_url, strtoul(stratum.job.job_id, NULL, 16), stratum.job.height); + } + pthread_mutex_unlock(&g_work_lock); + } + + // check we are on the right pool + if (switchn != pool_switch_count) goto pool_switched; + + if (!stratum_socket_full(&stratum, opt_timeout)) { + if (opt_debug) + applog(LOG_WARNING, "Stratum connection timed out"); + s = NULL; + } else + s = stratum_recv_line(&stratum); + + // double check we are on the right pool + if (switchn != pool_switch_count) goto pool_switched; + + if (!s) { + stratum_disconnect(&stratum); + if (!opt_quiet && !pool_on_hold) + applog(LOG_WARNING, "Stratum connection interrupted"); + continue; + } + if (!stratum_handle_method(&stratum, s)) + stratum_handle_response(s); + free(s); + } + +out: + if (opt_debug_threads) + applog(LOG_DEBUG, "%s() died", __func__); + + return NULL; + +pool_switched: + /* this thread should not die on pool switch */ + stratum_disconnect(&(pools[pooln].stratum)); + if (stratum.url) free(stratum.url); stratum.url = NULL; + if (opt_debug_threads) + applog(LOG_DEBUG, "%s() reinit...", __func__); + goto wait_stratum_url; +} + +static void show_version_and_exit(void) +{ + printf("%s v%s\n" +#ifdef WIN32 + "pthreads static %s\n" +#endif + "%s\n", + PACKAGE_NAME, PACKAGE_VERSION, +#ifdef WIN32 + PTW32_VERSION_STRING, +#endif + curl_version()); + proper_exit(EXIT_CODE_OK); +} + +static void show_usage_and_exit(int status) +{ + if (status) + fprintf(stderr, "Try `" PROGRAM_NAME " --help' for more information.\n"); + else + printf(usage); + proper_exit(status); +} + +void parse_arg(int key, char *arg) +{ + char *p = arg; + int v, i; + uint64_t ul; + double d; + + switch(key) { + case 'a': /* --algo */ + p = strstr(arg, ":"); // optional factor + if (p) *p = '\0'; + + i = algo_to_int(arg); + if (i >= 0) + opt_algo = (enum sha_algos)i; + else { + applog(LOG_ERR, "Unknown algo parameter '%s'", arg); + show_usage_and_exit(1); + } + + if (p) { + opt_nfactor = atoi(p + 1); + } + break; + case 'b': + p = strstr(arg, ":"); + if (p) { + /* ip:port */ + if (p - arg > 0) { + free(opt_api_allow); + opt_api_allow = strdup(arg); + opt_api_allow[p - arg] = '\0'; + } + opt_api_listen = atoi(p + 1); + } + else if (arg && strstr(arg, ".")) { + /* ip only */ + free(opt_api_allow); + opt_api_allow = strdup(arg); + } + else if (arg) { + /* port or 0 to disable */ + opt_api_listen = atoi(arg); + } + break; + case 1030: /* --api-remote */ + opt_api_remote = 1; + break; + case 'B': + opt_background = true; + break; + case 'c': { + json_error_t err; + if (opt_config) { + json_decref(opt_config); + opt_config = NULL; + } + if (arg && strstr(arg, "://")) { + opt_config = json_load_url(arg, &err); + } else { + opt_config = JSON_LOADF(arg, &err); + } + if (!json_is_object(opt_config)) { + applog(LOG_ERR, "JSON decode of %s failed", arg); + proper_exit(EXIT_CODE_USAGE); + } + break; + } + case 'i': + d = atof(arg); + v = (uint32_t) d; + if (v < 0 || v > 31) + show_usage_and_exit(1); + { + int n = 0; + int ngpus = cuda_num_devices(); + uint32_t last = 0; + char * pch = strtok(arg,","); + while (pch != NULL) { + d = atof(pch); + v = (uint32_t) d; + if (v > 7) { /* 0 = default */ + if ((d - v) > 0.0) { + uint32_t adds = (uint32_t)floor((d - v) * (1 << (v - 8))) * 256; + gpus_intensity[n] = (1 << v) + adds; + if(opt_debug) + applog(LOG_INFO, "Adding %u threads to intensity %u, %u cuda threads", adds, v, gpus_intensity[n]); + } + else if (gpus_intensity[n] != (1 << v)) { + gpus_intensity[n] = (1 << v); + if(opt_debug) + applog(LOG_INFO, "Intensity set to %u, %u cuda threads", v, gpus_intensity[n]); + } + } + last = gpus_intensity[n]; + n++; + pch = strtok(NULL, ","); + } + while (n < MAX_GPUS) + gpus_intensity[n++] = last; + } + break; + case 'D': + opt_debug = true; + break; + case 'N': + v = atoi(arg); + if (v < 1) + opt_statsavg = INT_MAX; + opt_statsavg = v; + break; + case 'n': /* --ndevs */ + // to get gpu vendors... + #ifdef USE_WRAPNVML + hnvml = nvml_create(); + #ifdef WIN32 + nvapi_init(); + cuda_devicenames(); // req for leds + nvapi_init_settings(); + #endif + #endif + cuda_print_devices(); + proper_exit(EXIT_CODE_OK); + break; + case 'q': + opt_quiet = true; + break; + case 'p': + free(rpc_pass); + rpc_pass = strdup(arg); + pool_set_creds(cur_pooln); + break; + case 'P': + opt_protocol = true; + break; + case 'r': + v = atoi(arg); + if (v < -1 || v > 9999) /* sanity check */ + show_usage_and_exit(1); + opt_retries = v; + break; + case 'R': + v = atoi(arg); + if (v < 1 || v > 9999) /* sanity check */ + show_usage_and_exit(1); + opt_fail_pause = v; + break; + case 's': + v = atoi(arg); + if (v < 1 || v > 9999) /* sanity check */ + show_usage_and_exit(1); + opt_scantime = v; + break; + case 'T': + v = atoi(arg); + if (v < 1 || v > 99999) /* sanity check */ + show_usage_and_exit(1); + opt_timeout = v; + break; + case 't': + v = atoi(arg); + if (v < 0 || v > 9999) /* sanity check */ + show_usage_and_exit(1); + opt_n_threads = v; + break; + case 1022: // --vote + v = atoi(arg); + if (v < 0 || v > 8192) /* sanity check */ + show_usage_and_exit(1); + opt_vote = (uint16_t)v; + break; + case 1023: // --trust-pool + opt_trust_pool = true; + break; + case 'u': + free(rpc_user); + rpc_user = strdup(arg); + pool_set_creds(cur_pooln); + break; + case 'o': /* --url */ + if (pools[cur_pooln].type != POOL_UNUSED) { + // rotate pool pointer + cur_pooln = (cur_pooln + 1) % MAX_POOLS; + num_pools = max(cur_pooln+1, num_pools); + // change some defaults if multi pools + if (opt_retries == -1) opt_retries = 1; + if (opt_fail_pause == 30) opt_fail_pause = 5; + if (opt_timeout == 300) opt_timeout = 60; + } + p = strstr(arg, "://"); + if (p) { + if (strncasecmp(arg, "http://", 7) && strncasecmp(arg, "https://", 8) && + strncasecmp(arg, "stratum+tcp://", 14)) + show_usage_and_exit(1); + free(rpc_url); + rpc_url = strdup(arg); + short_url = &rpc_url[(p - arg) + 3]; + } else { + if (!strlen(arg) || *arg == '/') + show_usage_and_exit(1); + free(rpc_url); + rpc_url = (char*)malloc(strlen(arg) + 8); + sprintf(rpc_url, "http://%s", arg); + short_url = &rpc_url[7]; + } + p = strrchr(rpc_url, '@'); + if (p) { + char *sp, *ap; + *p = '\0'; + ap = strstr(rpc_url, "://") + 3; + sp = strchr(ap, ':'); + if (sp && sp < p) { + free(rpc_user); + rpc_user = (char*)calloc(sp - ap + 1, 1); + strncpy(rpc_user, ap, sp - ap); + free(rpc_pass); + rpc_pass = strdup(sp + 1); + } else { + free(rpc_user); + rpc_user = strdup(ap); + } + // remove user[:pass]@ from rpc_url + memmove(ap, p + 1, strlen(p + 1) + 1); + // host:port only + short_url = ap; + } + have_stratum = !opt_benchmark && !strncasecmp(rpc_url, "stratum", 7); + pool_set_creds(cur_pooln); + break; + case 'O': /* --userpass */ + p = strchr(arg, ':'); + if (!p) + show_usage_and_exit(1); + free(rpc_user); + rpc_user = (char*)calloc(p - arg + 1, 1); + strncpy(rpc_user, arg, p - arg); + free(rpc_pass); + rpc_pass = strdup(p + 1); + pool_set_creds(cur_pooln); + break; + case 'x': /* --proxy */ + if (!strncasecmp(arg, "socks4://", 9)) + opt_proxy_type = CURLPROXY_SOCKS4; + else if (!strncasecmp(arg, "socks5://", 9)) + opt_proxy_type = CURLPROXY_SOCKS5; +#if LIBCURL_VERSION_NUM >= 0x071200 + else if (!strncasecmp(arg, "socks4a://", 10)) + opt_proxy_type = CURLPROXY_SOCKS4A; + else if (!strncasecmp(arg, "socks5h://", 10)) + opt_proxy_type = CURLPROXY_SOCKS5_HOSTNAME; +#endif + else + opt_proxy_type = CURLPROXY_HTTP; + free(opt_proxy); + opt_proxy = strdup(arg); + pool_set_creds(cur_pooln); + break; + case 1001: + free(opt_cert); + opt_cert = strdup(arg); + break; + case 1002: + use_colors = false; + break; + case 1004: + opt_autotune = false; + break; + case 'l': /* scrypt --launch-config */ + { + char *last = NULL, *pch = strtok(arg,","); + int n = 0; + while (pch != NULL) { + device_config[n++] = last = strdup(pch); + pch = strtok(NULL, ","); + } + while (n < MAX_GPUS) + device_config[n++] = last; + } + break; + case 'L': /* scrypt --lookup-gap */ + { + char *pch = strtok(arg,","); + int n = 0, last = atoi(arg); + while (pch != NULL) { + device_lookup_gap[n++] = last = atoi(pch); + pch = strtok(NULL, ","); + } + while (n < MAX_GPUS) + device_lookup_gap[n++] = last; + } + break; + case 1050: /* scrypt --interactive */ + { + char *pch = strtok(arg,","); + int n = 0, last = atoi(arg); + while (pch != NULL) { + device_interactive[n++] = last = atoi(pch); + pch = strtok(NULL, ","); + } + while (n < MAX_GPUS) + device_interactive[n++] = last; + } + break; + case 1051: /* scrypt --texture-cache */ + { + char *pch = strtok(arg,","); + int n = 0, last = atoi(arg); + while (pch != NULL) { + device_texturecache[n++] = last = atoi(pch); + pch = strtok(NULL, ","); + } + while (n < MAX_GPUS) + device_texturecache[n++] = last; + } + break; + case 1070: /* --gpu-clock */ + { + char *pch = strtok(arg,","); + int n = 0; + while (pch != NULL && n < MAX_GPUS) { + int dev_id = device_map[n++]; + device_gpu_clocks[dev_id] = atoi(pch); + pch = strtok(NULL, ","); + } + } + break; + case 1071: /* --mem-clock */ + { + char *pch = strtok(arg,","); + int n = 0; + while (pch != NULL && n < MAX_GPUS) { + int dev_id = device_map[n++]; + device_mem_clocks[dev_id] = atoi(pch); + pch = strtok(NULL, ","); + } + } + break; + case 1072: /* --pstate */ + { + char *pch = strtok(arg,","); + int n = 0; + while (pch != NULL && n < MAX_GPUS) { + int dev_id = device_map[n++]; + device_pstate[dev_id] = (int8_t) atoi(pch); + pch = strtok(NULL, ","); + } + } + break; + case 1073: /* --plimit */ + { + char *pch = strtok(arg,","); + int n = 0; + while (pch != NULL && n < MAX_GPUS) { + int dev_id = device_map[n++]; + device_plimit[dev_id] = atoi(pch); + pch = strtok(NULL, ","); + } + } + break; + case 1074: /* --keep-clocks */ + opt_keep_clocks = true; + break; + case 1075: /* --tlimit */ + { + char *pch = strtok(arg,","); + int n = 0; + while (pch != NULL && n < MAX_GPUS) { + int dev_id = device_map[n++]; + device_tlimit[dev_id] = (uint8_t) atoi(pch); + pch = strtok(NULL, ","); + } + } + break; + case 1080: /* --led */ + { + if (!opt_led_mode) + opt_led_mode = LED_MODE_SHARES; + char *pch = strtok(arg,","); + int n = 0, lastval, val; + while (pch != NULL && n < MAX_GPUS) { + int dev_id = device_map[n++]; + char * p = strstr(pch, "0x"); + val = p ? (int32_t) strtoul(p, NULL, 16) : atoi(pch); + if (!val && !strcmp(pch, "mining")) + opt_led_mode = LED_MODE_MINING; + else if (device_led[dev_id] == -1) + device_led[dev_id] = lastval = val; + pch = strtok(NULL, ","); + } + if (lastval) while (n < MAX_GPUS) { + device_led[n++] = lastval; + } + } + break; + case 1005: + opt_benchmark = true; + want_longpoll = false; + want_stratum = false; + have_stratum = false; + break; + case 1006: + print_hash_tests(); + proper_exit(EXIT_CODE_OK); + break; + case 1003: + want_longpoll = false; + break; + case 1007: + want_stratum = false; + opt_extranonce = false; + break; + case 1008: + opt_time_limit = atoi(arg); + break; + case 1009: + opt_shares_limit = atoi(arg); + break; + case 1011: + allow_gbt = false; + break; + case 1012: + opt_extranonce = false; + break; + case 'S': + case 1018: + applog(LOG_INFO, "Now logging to syslog..."); + use_syslog = true; + if (arg && strlen(arg)) { + free(opt_syslog_pfx); + opt_syslog_pfx = strdup(arg); + } + break; + case 1020: + p = strstr(arg, "0x"); + ul = p ? strtoul(p, NULL, 16) : atol(arg); + if (ul > (1UL< 5) /* sanity check */ + show_usage_and_exit(1); + opt_priority = v; + break; + case 1025: // cuda-schedule + opt_cudaschedule = atoi(arg); + break; + case 1060: // max-temp + d = atof(arg); + opt_max_temp = d; + break; + case 1061: // max-diff + d = atof(arg); + opt_max_diff = d; + break; + case 1062: // max-rate + d = atof(arg); + p = strstr(arg, "K"); + if (p) d *= 1e3; + p = strstr(arg, "M"); + if (p) d *= 1e6; + p = strstr(arg, "G"); + if (p) d *= 1e9; + opt_max_rate = d; + break; + case 1063: // resume-diff + d = atof(arg); + opt_resume_diff = d; + break; + case 1064: // resume-rate + d = atof(arg); + p = strstr(arg, "K"); + if (p) d *= 1e3; + p = strstr(arg, "M"); + if (p) d *= 1e6; + p = strstr(arg, "G"); + if (p) d *= 1e9; + opt_resume_rate = d; + break; + case 1065: // resume-temp + d = atof(arg); + opt_resume_temp = d; + break; + case 'd': // --device + { + int device_thr[MAX_GPUS] = { 0 }; + int ngpus = cuda_num_devices(); + char * pch = strtok (arg,","); + opt_n_threads = 0; + while (pch != NULL && opt_n_threads < MAX_GPUS) { + if (pch[0] >= '0' && pch[0] <= '9') + { + if (atoi(pch) < ngpus) + device_map[opt_n_threads++] = atoi(pch); + else { + applog(LOG_ERR, "Non-existant CUDA device #%d specified in -d option", atoi(pch)); + proper_exit(EXIT_CODE_CUDA_NODEVICE); + } + } else { + int device = cuda_finddevice(pch); + if (device >= 0 && device < ngpus) + device_map[opt_n_threads++] = device; + else { + applog(LOG_ERR, "Non-existant CUDA device '%s' specified in -d option", pch); + proper_exit(EXIT_CODE_CUDA_NODEVICE); + } + } + pch = strtok (NULL, ","); + } + // count threads per gpu + for (int n=0; n < opt_n_threads; n++) { + int device = device_map[n]; + device_thr[device]++; + } + for (int n=0; n < ngpus; n++) { + gpu_threads = max(gpu_threads, device_thr[n]); + } + } + break; + + case 'f': // --diff-factor + d = atof(arg); + if (d <= 0.) + show_usage_and_exit(1); + opt_difficulty = d; + break; + case 'm': // --diff-multiplier + d = atof(arg); + if (d <= 0.) + show_usage_and_exit(1); + opt_difficulty = 1.0/d; + break; + + /* PER POOL CONFIG OPTIONS */ + + case 1100: /* pool name */ + pool_set_attr(cur_pooln, "name", arg); + break; + case 1101: /* pool algo */ + pool_set_attr(cur_pooln, "algo", arg); + break; + case 1102: /* pool scantime */ + pool_set_attr(cur_pooln, "scantime", arg); + break; + case 1108: /* pool time-limit */ + pool_set_attr(cur_pooln, "time-limit", arg); + break; + case 1161: /* pool max-diff */ + pool_set_attr(cur_pooln, "max-diff", arg); + break; + case 1162: /* pool max-rate */ + pool_set_attr(cur_pooln, "max-rate", arg); + break; + case 1199: + pool_set_attr(cur_pooln, "disabled", arg); + break; + + case 'V': + show_version_and_exit(); + case 'h': + show_usage_and_exit(0); + default: + break; + } + + if (use_syslog) + use_colors = false; +} + +void parse_config(json_t* json_obj) +{ + int i; + json_t *val; + + if (!json_is_object(json_obj)) + return; + + for (i = 0; i < ARRAY_SIZE(options); i++) { + + if (!options[i].name) + break; + + if (!strcasecmp(options[i].name, "config")) + continue; + + val = json_object_get(json_obj, options[i].name); + if (!val) + continue; + + if (options[i].has_arg && json_is_string(val)) { + char *s = strdup(json_string_value(val)); + if (!s) + continue; + parse_arg(options[i].val, s); + free(s); + } + else if (options[i].has_arg && json_is_integer(val)) { + char buf[16]; + sprintf(buf, "%d", (int) json_integer_value(val)); + parse_arg(options[i].val, buf); + } + else if (options[i].has_arg && json_is_real(val)) { + char buf[16]; + sprintf(buf, "%f", json_real_value(val)); + parse_arg(options[i].val, buf); + } + else if (!options[i].has_arg) { + if (json_is_true(val)) + parse_arg(options[i].val, (char*) ""); + } + else + applog(LOG_ERR, "JSON option %s invalid", + options[i].name); + } + + val = json_object_get(json_obj, "pools"); + if (val && json_typeof(val) == JSON_ARRAY) { + parse_pool_array(val); + } +} + +static void parse_cmdline(int argc, char *argv[]){ + + int key; + + while (1) { +#if HAVE_GETOPT_LONG + key = getopt_long(argc, argv, short_options, options, NULL); +#else + key = getopt(argc, argv, short_options); +#endif + if (key < 0) + break; + + parse_arg(key, optarg); + } + if (optind < argc) { + fprintf(stderr, "%s: unsupported non-option argument '%s' (see --help)\n", + argv[0], argv[optind]); + //show_usage_and_exit(1); + } + + parse_config(opt_config); + + if (opt_vote == 9999) { + opt_vote = 0; // default, don't vote + } +} + +static void parse_single_opt(int opt, int argc, char *argv[]) +{ + int key, prev = optind; + while (1) { +#if HAVE_GETOPT_LONG + key = getopt_long(argc, argv, short_options, options, NULL); +#else + key = getopt(argc, argv, short_options); +#endif + if (key < 0) + break; + if (key == opt /* || key == 'c'*/) + parse_arg(key, optarg); + } + //todo with a filter: parse_config(opt_config); + + optind = prev; // reset argv index +} + +#ifndef WIN32 +static void signal_handler(int sig) +{ + switch (sig) { + case SIGHUP: + applog(LOG_INFO, "SIGHUP received"); + break; + case SIGINT: + signal(sig, SIG_IGN); + applog(LOG_INFO, "SIGINT received, exiting"); + proper_exit(EXIT_CODE_KILLED); + break; + case SIGTERM: + applog(LOG_INFO, "SIGTERM received, exiting"); + proper_exit(EXIT_CODE_KILLED); + break; + } +} +#else +BOOL WINAPI ConsoleHandler(DWORD dwType) +{ + switch (dwType) { + case CTRL_C_EVENT: + applog(LOG_INFO, "CTRL_C_EVENT received, exiting"); + proper_exit(EXIT_CODE_KILLED); + break; + case CTRL_BREAK_EVENT: + applog(LOG_INFO, "CTRL_BREAK_EVENT received, exiting"); + proper_exit(EXIT_CODE_KILLED); + break; + case CTRL_LOGOFF_EVENT: + applog(LOG_INFO, "CTRL_LOGOFF_EVENT received, exiting"); + proper_exit(EXIT_CODE_KILLED); + break; + case CTRL_SHUTDOWN_EVENT: + applog(LOG_INFO, "CTRL_SHUTDOWN_EVENT received, exiting"); + proper_exit(EXIT_CODE_KILLED); + break; + default: + return false; + } + return true; +} +#endif + +int main(int argc, char *argv[]) +{ + struct thr_info *thr; + long flags; + int i; + + // get opt_quiet early + parse_single_opt('q', argc, argv); + + char comment_toolkit[30]; + if(((int)(CUDART_VERSION/1000)==7) && ((int)((CUDART_VERSION % 1000)/10)==5)) + strcpy(comment_toolkit, "Recommended"); + else + strcpy(comment_toolkit, "Not recommended prefer 7.5"); + + printf("*** " PROGRAM_NAME " " PACKAGE_VERSION " for nVidia GPUs from alexis78@github ***\n"); + if (!opt_quiet) { +#ifdef _MSC_VER + printf("*** Built with VC++ 2013 and nVidia CUDA SDK %d.%d (%s)\n\n", +#else + printf("*** Built with the nVidia CUDA Toolkit %d.%d (%s)\n\n", +#endif + CUDART_VERSION/1000, (CUDART_VERSION % 1000)/10, comment_toolkit); + printf("*** Based on tpruvot@github ccminer\n"); + printf("*** Originally based on Christian Buchner and Christian H. project\n"); + printf("*** Include some of the work of djm34, sp, tsiv and klausT.\n\n"); + } + + rpc_user = strdup(""); + rpc_pass = strdup(""); + rpc_url = strdup(""); + jane_params = strdup(""); + + pthread_mutex_init(&applog_lock, NULL); + pthread_mutex_init(&stratum_sock_lock, NULL); + pthread_mutex_init(&stratum_work_lock, NULL); + pthread_mutex_init(&stats_lock, NULL); + pthread_mutex_init(&g_work_lock, NULL); + + // number of cpus for thread affinity +#if defined(WIN32) + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + num_cpus = sysinfo.dwNumberOfProcessors; +#elif defined(_SC_NPROCESSORS_CONF) + num_cpus = sysconf(_SC_NPROCESSORS_CONF); +#elif defined(CTL_HW) && defined(HW_NCPU) + int req[] = { CTL_HW, HW_NCPU }; + size_t len = sizeof(num_cpus); + sysctl(req, 2, &num_cpus, &len, NULL, 0); +#else + num_cpus = 1; +#endif + if (num_cpus < 1) + num_cpus = 1; + + // number of gpus + active_gpus = cuda_num_devices(); + + for (i = 0; i < MAX_GPUS; i++) { + device_map[i] = i % active_gpus; + device_name[i] = NULL; + device_config[i] = NULL; + device_backoff[i] = is_windows() ? 12 : 2; + device_lookup_gap[i] = 1; + device_batchsize[i] = 1024; + device_interactive[i] = -1; + device_texturecache[i] = -1; + device_singlememory[i] = -1; + device_pstate[i] = -1; + device_led[i] = -1; + } + + cuda_devicenames(); + + /* parse command line */ + parse_cmdline(argc, argv); + + if (!opt_benchmark && !strlen(rpc_url)) { + // try default config file (user then binary folder) + char defconfig[MAX_PATH] = { 0 }; + get_defconfig_path(defconfig, MAX_PATH, argv[0]); + if (strlen(defconfig)) { + if (opt_debug) + applog(LOG_DEBUG, "Using config %s", defconfig); + parse_arg('c', defconfig); + parse_cmdline(argc, argv); + } + } + + if (!strlen(rpc_url)) { + if (!opt_benchmark) { + fprintf(stderr, "%s: no URL supplied\n", argv[0]); + show_usage_and_exit(1); + } + // ensure a pool is set with default params... + pool_set_creds(0); + } + + /* init stratum data.. */ + memset(&stratum.url, 0, sizeof(stratum)); + + // ensure default params are set + pool_init_defaults(); + + if (opt_debug) + pool_dump_infos(); + cur_pooln = pool_get_first_valid(0); + pool_switch(-1, cur_pooln); + + if (opt_algo == ALGO_DECRED || opt_algo == ALGO_SIA) { + allow_gbt = false; + allow_mininginfo = false; + } + + flags = !opt_benchmark && strncmp(rpc_url, "https:", 6) + ? (CURL_GLOBAL_ALL & ~CURL_GLOBAL_SSL) + : CURL_GLOBAL_ALL; + if (curl_global_init(flags)) { + applog(LOG_ERR, "CURL initialization failed"); + return EXIT_CODE_SW_INIT_ERROR; + } + + if (opt_background) { +#ifndef WIN32 + i = fork(); + if (i < 0) proper_exit(EXIT_CODE_SW_INIT_ERROR); + if (i > 0) proper_exit(EXIT_CODE_OK); + i = setsid(); + if (i < 0) + applog(LOG_ERR, "setsid() failed (errno = %d)", errno); + i = chdir("/"); + if (i < 0) + applog(LOG_ERR, "chdir() failed (errno = %d)", errno); + signal(SIGHUP, signal_handler); + signal(SIGTERM, signal_handler); +#else + HWND hcon = GetConsoleWindow(); + if (hcon) { + // this method also hide parent command line window + ShowWindow(hcon, SW_HIDE); + } else { + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + CloseHandle(h); + FreeConsole(); + } +#endif + } + +#ifndef WIN32 + /* Always catch Ctrl+C */ + signal(SIGINT, signal_handler); +#else + SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE); + if (opt_priority > 0) { + DWORD prio = NORMAL_PRIORITY_CLASS; + switch (opt_priority) { + case 1: + prio = BELOW_NORMAL_PRIORITY_CLASS; + break; + case 2: + prio = NORMAL_PRIORITY_CLASS; + break; + case 3: + prio = ABOVE_NORMAL_PRIORITY_CLASS; + break; + case 4: + prio = HIGH_PRIORITY_CLASS; + break; + case 5: + prio = REALTIME_PRIORITY_CLASS; + } + SetPriorityClass(GetCurrentProcess(), prio); + } + // Prevent windows to sleep while mining + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); + +#endif + if (opt_affinity != -1) { + if (!opt_quiet) + applog(LOG_DEBUG, "Binding process to cpu mask %x", opt_affinity); + affine_to_cpu_mask(-1, (unsigned long)opt_affinity); + } + if (active_gpus == 0) { + applog(LOG_ERR, "No CUDA devices found! terminating."); + exit(1); + } + if (!opt_n_threads) + opt_n_threads = active_gpus; + else if (active_gpus > opt_n_threads) + active_gpus = opt_n_threads; + + // generally doesn't work well... + gpu_threads = max(gpu_threads, opt_n_threads / active_gpus); + + if (opt_benchmark && opt_algo == ALGO_AUTO) { + bench_init(opt_n_threads); + for (int n=0; n < MAX_GPUS; n++) { + gpus_intensity[n] = 0; // use default + } + opt_autotune = false; + } + +#ifdef HAVE_SYSLOG_H + if (use_syslog) + openlog(opt_syslog_pfx, LOG_PID, LOG_USER); +#endif + + work_restart = (struct work_restart *)calloc(opt_n_threads, sizeof(*work_restart)); + if (!work_restart) + return EXIT_CODE_SW_INIT_ERROR; + + thr_info = (struct thr_info *)calloc(2*opt_n_threads + 4, sizeof(*thr)); + if (!thr_info) + return EXIT_CODE_SW_INIT_ERROR; + + /* longpoll thread */ + longpoll_thr_id = opt_n_threads + 1; + thr = &thr_info[longpoll_thr_id]; + thr->id = longpoll_thr_id; + thr->q = tq_new(); + if (!thr->q) + return EXIT_CODE_SW_INIT_ERROR; + + /* always start the longpoll thread (will wait a tq_push on workio /LP) */ + if (unlikely(pthread_create(&thr->pth[0], NULL, longpoll_thread, thr))) { + applog(LOG_ERR, "longpoll thread create failed"); + return EXIT_CODE_SW_INIT_ERROR; + } + + /* stratum thread */ + stratum_thr_id = opt_n_threads + 2; + thr = &thr_info[stratum_thr_id]; + thr->id = stratum_thr_id; + thr->q = tq_new(); + if (!thr->q) + return EXIT_CODE_SW_INIT_ERROR; + + /* always start the stratum thread (will wait a tq_push) */ + if (unlikely(pthread_create(&thr->pth[0], NULL, stratum_thread, thr))) { + applog(LOG_ERR, "stratum thread create failed"); + return EXIT_CODE_SW_INIT_ERROR; + } + + /* init workio thread */ + work_thr_id = opt_n_threads; + thr = &thr_info[work_thr_id]; + thr->id = work_thr_id; + thr->q = tq_new(); + if (!thr->q) + return EXIT_CODE_SW_INIT_ERROR; + + if (pthread_create(&thr->pth[0], NULL, workio_thread, thr)) { + applog(LOG_ERR, "workio thread create failed"); + return EXIT_CODE_SW_INIT_ERROR; + } + + /* real start of the stratum work */ + if (want_stratum && have_stratum) { + tq_push(thr_info[stratum_thr_id].q, strdup(rpc_url)); + } + +#ifdef USE_WRAPNVML +#if defined(__linux__) || defined(_WIN64) + /* nvml is currently not the best choice on Windows (only in x64) */ + hnvml = nvml_create(); + if (hnvml) { + bool gpu_reinit = (opt_cudaschedule >= 0); //false + cuda_devicenames(); // refresh gpu vendor name + if (!opt_quiet) + applog(LOG_INFO, "NVML GPU monitoring enabled."); + for (int n=0; n < active_gpus; n++) { + if (nvml_set_pstate(device_map[n]) == 1) + gpu_reinit = true; + if (nvml_set_plimit(device_map[n]) == 1) + gpu_reinit = true; + if (nvml_set_clocks(device_map[n]) == 1) + gpu_reinit = true; + if (gpu_reinit) { + cuda_reset_device(n, NULL); + } + } + } +#endif + // force reinit to set default device flags + if (opt_cudaschedule >= 0 && !hnvml) { + for (int n=0; n < active_gpus; n++) { + cuda_reset_device(n, NULL); + } + } +#ifdef WIN32 + if (!hnvml && nvapi_init() == 0) { + if (!opt_quiet) + applog(LOG_INFO, "NVAPI GPU monitoring enabled."); + cuda_devicenames(); // refresh gpu vendor name + } +#endif + else if (!hnvml) + if (!opt_quiet) + applog(LOG_INFO, "GPU monitoring is not available."); +#endif + + if (opt_api_listen) { + /* api thread */ + api_thr_id = opt_n_threads + 3; + thr = &thr_info[api_thr_id]; + thr->id = api_thr_id; + thr->q = tq_new(); + if (!thr->q) + return EXIT_CODE_SW_INIT_ERROR; + + /* start stratum thread */ + if (unlikely(pthread_create(&thr->pth[0], NULL, api_thread, thr))) { + applog(LOG_ERR, "api thread create failed"); + return EXIT_CODE_SW_INIT_ERROR; + } + } + + + uint32_t bad_devices = 0; + /* start mining threads */ + /* start monitoring threads */ + for (i = 0; i < opt_n_threads; i++) { + thr = &thr_info[i]; + + thr->id = i; + thr->gpu.thr_id = i; + thr->gpu.gpu_id = (uint8_t) device_map[i]; + thr->gpu.gpu_arch = (uint16_t) device_sm[device_map[i]]; + if(device_sm[device_map[i]]<500){ + gpulog(LOG_ERR,i, "Unsupported compute capability device. Ignoring"); + bad_devices++; + continue; + } + pthread_mutex_init(&thr->gpu.monitor.lock, NULL); + pthread_cond_init(&thr->gpu.monitor.sampling_signal, NULL); + thr->q = tq_new(); + if (!thr->q) + return EXIT_CODE_SW_INIT_ERROR; + + if (unlikely(pthread_create(&thr->pth[0], NULL, miner_thread, thr))) { + applog(LOG_ERR, "Mining thread %d create failed", i); + return EXIT_CODE_SW_INIT_ERROR; + } + #ifdef USE_WRAPNVML + if (unlikely(pthread_create(&thr->pth[1], NULL, monitor_thread, thr))) { + applog(LOG_ERR, "Monitoring thread %d create failed", i); + return EXIT_CODE_SW_INIT_ERROR; + } + #endif + } + + applog(LOG_INFO, "%d miner thread%s started, using '%s' algorithm.", (opt_n_threads-bad_devices), (opt_n_threads-bad_devices) > 1 ? "s":"", algo_names[opt_algo]); + +#ifdef WIN32 + timeBeginPeriod(1); // enable high timer precision (similar to Google Chrome Trick) +#endif + + /* main loop - simply wait for workio thread to exit */ + pthread_join(thr_info[work_thr_id].pth[0], NULL); + + /* wait for mining/monitoring threads */ + for (i = 0; i < opt_n_threads; i++){ + pthread_join(thr_info[i].pth[0], NULL); + pthread_join(thr_info[i].pth[1], NULL); + } + if (opt_debug) + applog(LOG_DEBUG, "workio thread dead, exiting."); + + proper_exit(EXIT_CODE_OK); + return 0; +} diff --git a/ccminer.sln b/ccminer.sln new file mode 100644 index 0000000..8b9caa4 --- /dev/null +++ b/ccminer.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccminer", "ccminer.vcxproj", "{36DC07F9-A4A6-4877-A146-1B960083CF6F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|Win32.ActiveCfg = Debug|Win32 + {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|Win32.Build.0 = Debug|Win32 + {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|x64.ActiveCfg = Debug|x64 + {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|x64.Build.0 = Debug|x64 + {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|Win32.ActiveCfg = Release|Win32 + {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|Win32.Build.0 = Release|Win32 + {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|x64.ActiveCfg = Release|x64 + {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ccminer.vcxproj b/ccminer.vcxproj new file mode 100644 index 0000000..fa0e319 --- /dev/null +++ b/ccminer.vcxproj @@ -0,0 +1,450 @@ + + + + + Release + Win32 + + + Debug + Win32 + + + Release + x64 + + + Debug + x64 + + + + {36DC07F9-A4A6-4877-A146-1B960083CF6F} + ccminer + + + + Application + false + MultiByte + v120 + false + false + true + + + Application + true + MultiByte + v120 + false + false + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + MultiThreadedDebugDLL + true + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;USE_WRAPNVML;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions) + .;compat;compat\curl-for-windows\curl\include;compat\jansson;compat\getopt;compat\pthreads;compat\curl-for-windows\openssl\openssl\include;compat\curl-for-windows\zlib;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir) + true + true + true + + + true + Console + cudart_static.lib;cuda.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;pthreadVC2.lib;libcurl.x86.lib;openssl.x86.lib;zlib.x86.lib;ws2_32.lib;Wldap32.lib;nvapi.lib;%(AdditionalDependencies) + libcmt.lib;msvcrt.lib + compat\pthreads\x86;compat\curl-for-windows\out\x86\Release\lib;compat\nvapi\x86;%(AdditionalLibraryDirectories);$(CudaToolkitLibDir) + /NODEFAULTLIB:LIBCMT %(AdditionalOptions) + true + + + false + true + 128 + true + true + compute_50,sm_50 + $(NVTOOLSEXT_PATH)\include;..\..\..\Common\C99 + + + + + Level3 + Disabled + MultiThreadedDebugDLL + true + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;USE_WRAPNVML;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions) + .;compat;compat\curl-for-windows\curl\include;compat\jansson;compat\getopt;compat\pthreads;compat\curl-for-windows\openssl\openssl\include;compat\curl-for-windows\zlib;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir) + 8Bytes + true + true + true + + + true + Console + cudart_static.lib;cuda.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;pthreadVC2.lib;libcurl.x64.lib;openssl.x64.lib;zlib.x64.lib;ws2_32.lib;Wldap32.lib;nvapi64.lib;%(AdditionalDependencies) + libcmt.lib + compat\pthreads\x64;compat\curl-for-windows\out\x64\Release\lib;compat\nvapi\amd64;%(AdditionalLibraryDirectories);$(CudaToolkitLibDir) + /NODEFAULTLIB:LIBCMTD %(AdditionalOptions) + true + + + false + true + 128 + true + true + compute_50,sm_50 + $(NVTOOLSEXT_PATH)\include;..\..\..\Common\C99 + 64 + + + false + + + + + Level3 + MaxSpeed + MultiThreaded + Speed + StreamingSIMDExtensions2 + false + true + true + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;USE_WRAPNVML;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions) + .;compat;compat\curl-for-windows\curl\include;compat\jansson;compat\getopt;compat\pthreads;compat\curl-for-windows\openssl\openssl\include;compat\curl-for-windows\zlib;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir) + true + true + true + true + + + false + true + true + Console + cudart_static.lib;cuda.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;pthreadVC2.lib;libcurl.x86.lib;openssl.x86.lib;zlib.x86.lib;ws2_32.lib;Wldap32.lib;nvapi.lib;%(AdditionalDependencies) + libcmt.lib + compat\pthreads\x86;compat\curl-for-windows\out\x86\Release\lib;compat\nvapi\x86;%(AdditionalLibraryDirectories);$(CudaToolkitLibDir) + /NODEFAULTLIB:LIBCMT %(AdditionalOptions) + false + false + true + + + false + 128 + true + true + compute_50,sm_50;compute_52,sm_52 + --ptxas-options="-O2" %(AdditionalOptions) + O2 + + + false + O3 + + + + + Level3 + MaxSpeed + MultiThreaded + Speed + + + true + false + true + true + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;USE_WRAPNVML;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions) + .;compat;compat\curl-for-windows\curl\include;compat\jansson;compat\getopt;compat\pthreads;compat\curl-for-windows\openssl\openssl\include;compat\curl-for-windows\zlib;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir) + true + true + + + $(IntDir) + $(IntDir) + $(IntDir) + + + false + true + true + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;pthreadVC2.lib;libcurl.x64.lib;openssl.x64.lib;zlib.x64.lib;ws2_32.lib;Wldap32.lib;cudart_static.lib;cuda.lib;nvapi64.lib;%(AdditionalDependencies) + libcmt.lib + compat\pthreads\x64;compat\curl-for-windows\out\x64\Release\lib;compat\nvapi\amd64;%(AdditionalLibraryDirectories);$(CudaToolkitLibDir) + /NODEFAULTLIB:LIBCMT %(AdditionalOptions) + false + true + + + false + 128 + true + true + compute_50,sm_50;compute_52,sm_52 + $(NVTOOLSEXT_PATH)\include;..\..\..\Common\C99 + O3 + 64 + + + + + O2 + false + + + + + + + + + + + + + + + + + + false + Full + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 72 + + + + + + + + + + + + + -Xptxas "-abi=yes" %(AdditionalOptions) + -Xptxas "-abi=yes" %(AdditionalOptions) + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + 72 + + + + + + 72 + + + + + + + 72 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccminer.vcxproj.filters b/ccminer.vcxproj.filters new file mode 100644 index 0000000..b1e6c7a --- /dev/null +++ b/ccminer.vcxproj.filters @@ -0,0 +1,662 @@ + + + + + {2450a9c7-a97a-49e1-ba19-c8dbc5a4e3e7} + + + {c53ce808-c5c5-4c6c-99a2-3947090c62f1} + + + {5a45c1bf-81d2-4bc6-97b5-714e34f51a82} + + + {431cec61-9376-4de9-aae9-04c4250652e7} + + + {cc8bb259-5332-4a45-ba81-f4840a55b604} + + + {89362bd8-4690-4f0c-a4f7-6b2fa67a1f34} + + + {6c3cd392-b6b8-424c-87d2-10e33dbd4b41} + + + {5a31b6f4-4943-4b22-b69a-230f3cc96269} + + + {a0f072d0-a831-4c23-8d64-7a026521df9c} + + + {dd0822bd-27cc-4d5c-8e2f-cf7d9b00feb4} + + + {0dc051db-f833-476f-b3f4-c69fd03b9348} + + + {7c2a98c6-064c-4a69-b803-d6f6ff5edd0b} + + + {f3ed23a2-8ce7-41a5-b051-6da56047dc35} + + + {dd751f2d-bfd6-42c1-8f9b-cbe94e539353} + + + {d67a2af7-4851-4d21-910e-87791bc8ee35} + + + {a2403c22-6777-46ab-a55a-3fcc7386c974} + + + {85dfae6a-66ca-4332-8cec-98ee70cbdf2f} + + + {17b56151-79ec-4a32-bac3-9d94ae7f68fe} + + + {ef6f9983-bda5-4fb2-adfa-ac4f29b74f25} + + + {9762c92c-9677-4044-8292-ff6ba4bfdd89} + + + {2ff6e4ce-7c92-4cb2-a3ad-c331e94fd81d} + + + {f5117ccb-a70d-411a-b7ea-d6faed230bc7} + + + {1613763f-895c-4321-b58b-6f5849868956} + + + {4c232be6-5a71-4873-a963-7e20021789bd} + + + {bdd00143-2d53-4814-bae7-5a41333652d5} + + + {37129fe0-9400-49fe-98bd-391f2c10e801} + + + {82ce9ec4-7b62-4b8a-963c-4626e3122fd9} + + + {172198ff-b13f-41d4-b108-fb2a936afb31} + + + {8433e87e-02db-4d16-b07b-daa99d116867} + + + + + Source Files\jansson + + + Source Files\jansson + + + Source Files\jansson + + + Source Files\jansson + + + Source Files\jansson + + + Source Files\jansson + + + Source Files\getopt + + + Source Files\gettimeofday + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\jansson + + + Source Files\jansson + + + Source Files\jansson + + + Source Files\jansson + + + Source Files\sph + + + Source Files + + + Source Files + + + Source Files\sph + + + Source Files\sph + + + Source Files\sph + + + Source Files\CUDA\lyra2 + + + Source Files\CUDA\neoscrypt + + + Header Files\sph + + + Source Files + + + Source Files\CUDA\x13 + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\compat\sys + + + Header Files\compat + + + Header Files\compat + + + Header Files\compat\getopt + + + Header Files\compat + + + Header Files + + + Header Files + + + Header Files\CUDA + + + Header Files\CUDA + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\CUDA + + + Header Files\CUDA + + + Header Files\CUDA + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Header Files\compat + + + Header Files + + + Header Files\compat\nvapi + + + Header Files\compat\nvapi + + + Header Files\compat\nvapi + + + Header Files\compat\nvapi + + + Header Files\compat\nvapi + + + Header Files\compat\nvapi + + + Header Files\compat\nvapi + + + Header Files\compat\nvapi + + + Header Files\compat\nvapi + + + Header Files\compat + + + Header Files\lyra2 + + + Header Files\lyra2 + + + Source Files\CUDA\quark + + + Source Files\CUDA\quark + + + Ressources + + + Header Files + + + Source Files\CUDA\lyra2 + + + Source Files\CUDA\lyra2 + + + Source Files\CUDA + + + Source Files\CUDA\neoscrypt + + + Header Files\sph + + + Header Files\sph + + + Header Files\sph + + + Source Files\CUDA\skein + + + Source Files\CUDA\streebog + + + + + Source Files\CUDA + + + Source Files\CUDA\quark + + + Source Files\CUDA\quark + + + Source Files\CUDA\quark + + + Source Files\CUDA\quark + + + Source Files\CUDA\quark + + + Source Files\CUDA\quark + + + Source Files\CUDA\qubit + + + Source Files\CUDA\qubit + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x13 + + + Source Files\CUDA + + + Source Files\CUDA\x15 + + + Source Files\CUDA\x15 + + + Source Files\CUDA\x17 + + + Source Files\CUDA\x17 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\lyra2 + + + Source Files\CUDA\lyra2 + + + Source Files\CUDA\lyra2 + + + Source Files\CUDA\lyra2 + + + Source Files\CUDA\nist5 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\Algo256 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x14 + + + Source Files\CUDA\x14 + + + Source Files\CUDA\x17 + + + Source Files\CUDA\lbry + + + Source Files\CUDA\lbry + + + Source Files\CUDA\lbry + + + Source Files\CUDA\quark + + + Source Files\CUDA\quark + + + Source Files\CUDA\neoscrypt + + + Source Files\CUDA\neoscrypt + + + Source Files\CUDA + + + Source Files\CUDA + + + Source Files\CUDA + + + Source Files\CUDA\skein + + + Source Files\CUDA\skein + + + Source Files\CUDA\streebog + + + Source Files\CUDA\streebog + + + Source Files\CUDA\streebog + + + Source Files\CUDA\streebog + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x11 + + + Source Files\CUDA\x13 + + + Source Files\CUDA\quark + + + Source Files\CUDA\lbry + + + Source Files\CUDA\x15 + + + Source Files\CUDA\x13 + + + Source Files\CUDA\x13 + + + + + Ressources + + + + + Ressources + + + + + Ressources + + + diff --git a/compat.h b/compat.h new file mode 100644 index 0000000..a98dab9 --- /dev/null +++ b/compat.h @@ -0,0 +1,94 @@ +#ifndef __COMPAT_H__ +#define __COMPAT_H__ + +#ifdef WIN32 + +#include +#include + +#define localtime_r(src, dst) localtime_s(dst, src) + +static __inline void sleep(int secs) +{ + Sleep(secs * 1000); +} + +enum { + PRIO_PROCESS = 0, +}; + +extern int opt_priority; + +static __inline int setpriority(int which, int who, int prio) +{ + switch (opt_priority) { + case 5: + prio = THREAD_PRIORITY_TIME_CRITICAL; + break; + case 4: + prio = THREAD_PRIORITY_HIGHEST; + break; + case 3: + prio = THREAD_PRIORITY_ABOVE_NORMAL; + break; + case 2: + prio = THREAD_PRIORITY_NORMAL; + break; + case 1: + prio = THREAD_PRIORITY_BELOW_NORMAL; + break; + case 0: + default: + prio = THREAD_PRIORITY_IDLE; + } + return -!SetThreadPriority(GetCurrentThread(), prio); +} + +#ifdef _MSC_VER +#define snprintf(...) _snprintf(__VA_ARGS__) +#define strdup(...) _strdup(__VA_ARGS__) +#define strncasecmp(x,y,z) _strnicmp(x,y,z) +#define strcasecmp(x,y) _stricmp(x,y) +typedef int ssize_t; + +__inline int msver(void) { + switch (_MSC_VER) { + case 1500: return 2008; + case 1600: return 2010; + case 1700: return 2012; + case 1800: return 2013; + case 1900: return 2015; + default: return (_MSC_VER/100); + } +} + +#include +static __inline char * dirname(char *file) { + char buffer[_MAX_PATH] = { 0 }; + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + char fname[_MAX_FNAME]; + char ext[_MAX_EXT]; + _splitpath_s(file, drive, _MAX_DRIVE, dir, _MAX_DIR, fname, _MAX_FNAME, ext, _MAX_EXT); + sprintf(buffer, "%s%s", drive, dir); + return strdup(buffer); +} +#endif + +#endif /* WIN32 */ + +#ifdef _MSC_VER +# define __func__ __FUNCTION__ +# define __thread __declspec(thread) +# define _ALIGN(x) __declspec(align(x)) +#else +# define _ALIGN(x) __attribute__ ((aligned(x))) +/* dirname() for linux/mingw */ +#include +#endif + +#ifndef WIN32 +#define MAX_PATH PATH_MAX +#endif + +#endif /* __COMPAT_H__ */ diff --git a/compat/Makefile.am b/compat/Makefile.am new file mode 100644 index 0000000..77af3c5 --- /dev/null +++ b/compat/Makefile.am @@ -0,0 +1,7 @@ + +if WANT_JANSSON +SUBDIRS = jansson +else +SUBDIRS = +endif + diff --git a/compat/bignum_ssl10.hpp b/compat/bignum_ssl10.hpp new file mode 100644 index 0000000..d8236b7 --- /dev/null +++ b/compat/bignum_ssl10.hpp @@ -0,0 +1,602 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2012 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. +#ifndef BITCOIN_BIGNUM_H +#define BITCOIN_BIGNUM_H + +#ifndef PROTOCOL_VERSION +#define PROTOCOL_VERSION 70001 +#endif + +#include +#include +#include +#include +#include + +#include "uint256.h" + +#include + +#include "serialize.hpp" + +using namespace std; + +/** Errors thrown by the bignum class */ +class bignum_error : public std::runtime_error +{ +public: + explicit bignum_error(const std::string& str) : std::runtime_error(str) {} +}; + + +/** RAII encapsulated BN_CTX (OpenSSL bignum context) */ +class CAutoBN_CTX +{ +protected: + BN_CTX* pctx; + BN_CTX* operator=(BN_CTX* pnew) { return pctx = pnew; } + +public: + CAutoBN_CTX() + { + pctx = BN_CTX_new(); + if (pctx == NULL) + throw bignum_error("CAutoBN_CTX : BN_CTX_new() returned NULL"); + } + + ~CAutoBN_CTX() + { + if (pctx != NULL) + BN_CTX_free(pctx); + } + + operator BN_CTX*() { return pctx; } + BN_CTX& operator*() { return *pctx; } + BN_CTX** operator&() { return &pctx; } + bool operator!() { return (pctx == NULL); } +}; + + +/** C++ wrapper for BIGNUM (OpenSSL bignum) */ +class CBigNum : public BIGNUM +{ +public: + CBigNum() + { + BN_init(this); + } + + CBigNum(const CBigNum& b) + { + BN_init(this); + if (!BN_copy(this, &b)) + { + BN_clear_free(this); + throw bignum_error("CBigNum::CBigNum(const CBigNum&) : BN_copy failed"); + } + } + + CBigNum& operator=(const CBigNum& b) + { + if (!BN_copy(this, &b)) + throw bignum_error("CBigNum::operator= : BN_copy failed"); + return (*this); + } + + ~CBigNum() + { + BN_clear_free(this); + } + + //CBigNum(char n) is not portable. Use 'signed char' or 'unsigned char'. + CBigNum(signed char n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(short n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(int n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(long n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); } + CBigNum(int64 n) { BN_init(this); setint64(n); } + CBigNum(unsigned char n) { BN_init(this); setulong(n); } + CBigNum(unsigned short n) { BN_init(this); setulong(n); } + CBigNum(unsigned int n) { BN_init(this); setulong(n); } + CBigNum(unsigned long n) { BN_init(this); setulong(n); } + CBigNum(uint64 n) { BN_init(this); setuint64(n); } + explicit CBigNum(uint256 n) { BN_init(this); setuint256(n); } + + explicit CBigNum(const std::vector& vch) + { + BN_init(this); + setvch(vch); + } + + void setulong(unsigned long n) + { + if (!BN_set_word(this, n)) + throw bignum_error("CBigNum conversion from unsigned long : BN_set_word failed"); + } + + unsigned long getulong() const + { + return (unsigned long) BN_get_word(this); + } + + unsigned int getuint() const + { + return (unsigned int) BN_get_word(this); + } + + int getint() const + { + unsigned long n = (unsigned long) BN_get_word(this); + if (!BN_is_negative(this)) + return (n > (unsigned long)std::numeric_limits::max() ? std::numeric_limits::max() : n); + else + return (n > (unsigned long)std::numeric_limits::max() ? std::numeric_limits::min() : -(int)n); + } + + void setint64(int64 sn) + { + unsigned char pch[sizeof(sn) + 6]; + unsigned char* p = pch + 4; + bool fNegative; + uint64 n; + + if (sn < 0LL) + { + // Since the minimum signed integer cannot be represented as positive so long as its type is signed, + // and it's not well-defined what happens if you make it unsigned before negating it, + // we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate + n = -(sn + 1); + ++n; + fNegative = true; + } else { + n = sn; + fNegative = false; + } + + bool fLeadingZeroes = true; + for (int i = 0; i < 8; i++) + { + unsigned char c = (n >> 56) & 0xff; + n <<= 8; + if (fLeadingZeroes) + { + if (c == 0) + continue; + if (c & 0x80) + *p++ = (fNegative ? 0x80 : 0); + else if (fNegative) + c |= 0x80; + fLeadingZeroes = false; + } + *p++ = c; + } + unsigned int nSize = (unsigned int) (p - (pch + 4)); + pch[0] = (nSize >> 24) & 0xff; + pch[1] = (nSize >> 16) & 0xff; + pch[2] = (nSize >> 8) & 0xff; + pch[3] = (nSize) & 0xff; + BN_mpi2bn(pch, (int) (p - pch), this); + } + + void setuint64(uint64 n) + { + unsigned char pch[sizeof(n) + 6]; + unsigned char* p = pch + 4; + bool fLeadingZeroes = true; + for (int i = 0; i < 8; i++) + { + unsigned char c = (n >> 56) & 0xff; + n <<= 8; + if (fLeadingZeroes) + { + if (c == 0) + continue; + if (c & 0x80) + *p++ = 0; + fLeadingZeroes = false; + } + *p++ = c; + } + unsigned int nSize = (unsigned int) (p - (pch + 4)); + pch[0] = (nSize >> 24) & 0xff; + pch[1] = (nSize >> 16) & 0xff; + pch[2] = (nSize >> 8) & 0xff; + pch[3] = (nSize) & 0xff; + BN_mpi2bn(pch, (int) (p - pch), this); + } + + void setuint256(uint256 n) + { + unsigned char pch[sizeof(n) + 6]; + unsigned char* p = pch + 4; + bool fLeadingZeroes = true; + unsigned char* pbegin = (unsigned char*)&n; + unsigned char* psrc = pbegin + sizeof(n); + while (psrc != pbegin) + { + unsigned char c = *(--psrc); + if (fLeadingZeroes) + { + if (c == 0) + continue; + if (c & 0x80) + *p++ = 0; + fLeadingZeroes = false; + } + *p++ = c; + } + unsigned int nSize = (unsigned int) (p - (pch + 4)); + pch[0] = (nSize >> 24) & 0xff; + pch[1] = (nSize >> 16) & 0xff; + pch[2] = (nSize >> 8) & 0xff; + pch[3] = (nSize >> 0) & 0xff; + BN_mpi2bn(pch, (int) (p - pch), this); + } + + uint256 getuint256() const + { + unsigned int nSize = BN_bn2mpi(this, NULL); + if (nSize < 4) + return 0; + std::vector vch(nSize); + BN_bn2mpi(this, &vch[0]); + if (vch.size() > 4) + vch[4] &= 0x7f; + uint256 n = 0; + for (unsigned int i = 0, j = (unsigned int) vch.size()-1; i < sizeof(n) && j >= 4; i++, j--) + ((unsigned char*)&n)[i] = vch[j]; + return n; + } + + void setvch(const std::vector& vch) + { + std::vector vch2(vch.size() + 4); + unsigned int nSize = (unsigned int) vch.size(); + // BIGNUM's byte stream format expects 4 bytes of + // big endian size data info at the front + vch2[0] = (nSize >> 24) & 0xff; + vch2[1] = (nSize >> 16) & 0xff; + vch2[2] = (nSize >> 8) & 0xff; + vch2[3] = (nSize >> 0) & 0xff; + // swap data to big endian + reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4); + BN_mpi2bn(&vch2[0], (int) vch2.size(), this); + } + + std::vector getvch() const + { + unsigned int nSize = BN_bn2mpi(this, NULL); + if (nSize <= 4) + return std::vector(); + std::vector vch(nSize); + BN_bn2mpi(this, &vch[0]); + vch.erase(vch.begin(), vch.begin() + 4); + reverse(vch.begin(), vch.end()); + return vch; + } + + // The "compact" format is a representation of a whole + // number N using an unsigned 32bit number similar to a + // floating point format. + // The most significant 8 bits are the unsigned exponent of base 256. + // This exponent can be thought of as "number of bytes of N". + // The lower 23 bits are the mantissa. + // Bit number 24 (0x800000) represents the sign of N. + // N = (-1^sign) * mantissa * 256^(exponent-3) + // + // Satoshi's original implementation used BN_bn2mpi() and BN_mpi2bn(). + // MPI uses the most significant bit of the first byte as sign. + // Thus 0x1234560000 is compact (0x05123456) + // and 0xc0de000000 is compact (0x0600c0de) + // (0x05c0de00) would be -0x40de000000 + // + // Bitcoin only uses this "compact" format for encoding difficulty + // targets, which are unsigned 256bit quantities. Thus, all the + // complexities of the sign bit and using base 256 are probably an + // implementation accident. + // + // This implementation directly uses shifts instead of going + // through an intermediate MPI representation. + CBigNum& SetCompact(unsigned int nCompact) + { + unsigned int nSize = nCompact >> 24; + bool fNegative =(nCompact & 0x00800000) != 0; + unsigned int nWord = nCompact & 0x007fffff; + if (nSize <= 3) + { + nWord >>= 8*(3-nSize); + BN_set_word(this, nWord); + } + else + { + BN_set_word(this, nWord); + BN_lshift(this, this, 8*(nSize-3)); + } + BN_set_negative(this, fNegative); + return *this; + } + + unsigned int GetCompact() const + { + unsigned int nSize = BN_num_bytes(this); + unsigned int nCompact = 0; + if (nSize <= 3) + nCompact = (unsigned int) BN_get_word(this) << 8*(3-nSize); + else + { + CBigNum bn; + BN_rshift(&bn, this, 8*(nSize-3)); + nCompact = (unsigned int) BN_get_word(&bn); + } + // The 0x00800000 bit denotes the sign. + // Thus, if it is already set, divide the mantissa by 256 and increase the exponent. + if (nCompact & 0x00800000) + { + nCompact >>= 8; + nSize++; + } + nCompact |= nSize << 24; + nCompact |= (BN_is_negative(this) ? 0x00800000 : 0); + return nCompact; + } + + void SetHex(const std::string& str) + { + // skip 0x + const char* psz = str.c_str(); + while (isspace(*psz)) + psz++; + bool fNegative = false; + if (*psz == '-') + { + fNegative = true; + psz++; + } + if (psz[0] == '0' && tolower(psz[1]) == 'x') + psz += 2; + while (isspace(*psz)) + psz++; + + // hex string to bignum + static const signed char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 }; + *this = 0; + while (isxdigit(*psz)) + { + *this <<= 4; + int n = phexdigit[(unsigned char)*psz++]; + *this += n; + } + if (fNegative) + *this = 0 - *this; + } + + std::string ToString(int nBase=10) const + { + CAutoBN_CTX pctx; + CBigNum bnBase = nBase; + CBigNum bn0 = 0; + std::string str; + CBigNum bn = *this; + BN_set_negative(&bn, false); + CBigNum dv; + CBigNum rem; + if (BN_cmp(&bn, &bn0) == 0) + return "0"; + while (BN_cmp(&bn, &bn0) > 0) + { + if (!BN_div(&dv, &rem, &bn, &bnBase, pctx)) + throw bignum_error("CBigNum::ToString() : BN_div failed"); + bn = dv; + unsigned int c = rem.getulong(); + str += "0123456789abcdef"[c]; + } + if (BN_is_negative(this)) + str += "-"; + reverse(str.begin(), str.end()); + return str; + } + + std::string GetHex() const + { + return ToString(16); + } + + unsigned int GetSerializeSize(int nType=0, int nVersion=PROTOCOL_VERSION) const + { + return ::GetSerializeSize(getvch(), nType, nVersion); + } + + template + void Serialize(Stream& s, int nType=0, int nVersion=PROTOCOL_VERSION) const + { + ::Serialize(s, getvch(), nType, nVersion); + } + + template + void Unserialize(Stream& s, int nType=0, int nVersion=PROTOCOL_VERSION) + { + std::vector vch; + ::Unserialize(s, vch, nType, nVersion); + setvch(vch); + } + + + bool operator!() const + { + return BN_is_zero(this); + } + + CBigNum& operator+=(const CBigNum& b) + { + if (!BN_add(this, this, &b)) + throw bignum_error("CBigNum::operator+= : BN_add failed"); + return *this; + } + + CBigNum& operator-=(const CBigNum& b) + { + *this = *this - b; + return *this; + } + + CBigNum& operator*=(const CBigNum& b) + { + CAutoBN_CTX pctx; + if (!BN_mul(this, this, &b, pctx)) + throw bignum_error("CBigNum::operator*= : BN_mul failed"); + return *this; + } + + CBigNum& operator/=(const CBigNum& b) + { + *this = *this / b; + return *this; + } + + CBigNum& operator%=(const CBigNum& b) + { + *this = *this % b; + return *this; + } + + CBigNum& operator<<=(unsigned int shift) + { + if (!BN_lshift(this, this, shift)) + throw bignum_error("CBigNum:operator<<= : BN_lshift failed"); + return *this; + } + + CBigNum& operator>>=(unsigned int shift) + { + // Note: BN_rshift segfaults on 64-bit if 2^shift is greater than the number + // if built on ubuntu 9.04 or 9.10, probably depends on version of OpenSSL + CBigNum a = 1; + a <<= shift; + if (BN_cmp(&a, this) > 0) + { + *this = 0; + return *this; + } + + if (!BN_rshift(this, this, shift)) + throw bignum_error("CBigNum:operator>>= : BN_rshift failed"); + return *this; + } + + + CBigNum& operator++() + { + // prefix operator + if (!BN_add(this, this, BN_value_one())) + throw bignum_error("CBigNum::operator++ : BN_add failed"); + return *this; + } + + const CBigNum operator++(int) + { + // postfix operator + const CBigNum ret = *this; + ++(*this); + return ret; + } + + CBigNum& operator--() + { + // prefix operator + CBigNum r; + if (!BN_sub(&r, this, BN_value_one())) + throw bignum_error("CBigNum::operator-- : BN_sub failed"); + *this = r; + return *this; + } + + const CBigNum operator--(int) + { + // postfix operator + const CBigNum ret = *this; + --(*this); + return ret; + } + + + friend inline const CBigNum operator-(const CBigNum& a, const CBigNum& b); + friend inline const CBigNum operator/(const CBigNum& a, const CBigNum& b); + friend inline const CBigNum operator%(const CBigNum& a, const CBigNum& b); +}; + + + +inline const CBigNum operator+(const CBigNum& a, const CBigNum& b) +{ + CBigNum r; + if (!BN_add(&r, &a, &b)) + throw bignum_error("CBigNum::operator+ : BN_add failed"); + return r; +} + +inline const CBigNum operator-(const CBigNum& a, const CBigNum& b) +{ + CBigNum r; + if (!BN_sub(&r, &a, &b)) + throw bignum_error("CBigNum::operator- : BN_sub failed"); + return r; +} + +inline const CBigNum operator-(const CBigNum& a) +{ + CBigNum r(a); + BN_set_negative(&r, !BN_is_negative(&r)); + return r; +} + +inline const CBigNum operator*(const CBigNum& a, const CBigNum& b) +{ + CAutoBN_CTX pctx; + CBigNum r; + if (!BN_mul(&r, &a, &b, pctx)) + throw bignum_error("CBigNum::operator* : BN_mul failed"); + return r; +} + +inline const CBigNum operator/(const CBigNum& a, const CBigNum& b) +{ + CAutoBN_CTX pctx; + CBigNum r; + if (!BN_div(&r, NULL, &a, &b, pctx)) + throw bignum_error("CBigNum::operator/ : BN_div failed"); + return r; +} + +inline const CBigNum operator%(const CBigNum& a, const CBigNum& b) +{ + CAutoBN_CTX pctx; + CBigNum r; + if (!BN_mod(&r, &a, &b, pctx)) + throw bignum_error("CBigNum::operator% : BN_div failed"); + return r; +} + +inline const CBigNum operator<<(const CBigNum& a, unsigned int shift) +{ + CBigNum r; + if (!BN_lshift(&r, &a, shift)) + throw bignum_error("CBigNum:operator<< : BN_lshift failed"); + return r; +} + +inline const CBigNum operator>>(const CBigNum& a, unsigned int shift) +{ + CBigNum r = a; + r >>= shift; + return r; +} + +inline bool operator==(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) == 0); } +inline bool operator!=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) != 0); } +inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) <= 0); } +inline bool operator>=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) >= 0); } +inline bool operator<(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) < 0); } +inline bool operator>(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) > 0); } + +#endif diff --git a/compat/getopt/getopt.h b/compat/getopt/getopt.h new file mode 100644 index 0000000..4de6e85 --- /dev/null +++ b/compat/getopt/getopt.h @@ -0,0 +1,93 @@ +/* $Id: getopt.h,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $ */ +/* $OpenBSD: getopt.h,v 1.1 2002/12/03 20:24:29 millert Exp $ */ +/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */ + +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dieter Baron and Thomas Klausner. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _GETOPT_H_ +#define _GETOPT_H_ + +#if 0 +#include +#endif + +/* + * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions + */ +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +struct option { + /* name of long option */ + const char *name; + /* + * one of no_argument, required_argument, and optional_argument: + * whether option takes an argument + */ + int has_arg; + /* if not NULL, set *flag to val when option found */ + int *flag; + /* if flag not NULL, value to set *flag to; else return value */ + int val; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +int getopt_long(int, char * const *, const char *, + const struct option *, int *); +int getopt_long_only(int, char * const *, const char *, + const struct option *, int *); +#ifndef _GETOPT_DEFINED +#define _GETOPT_DEFINED +int getopt(int, char * const *, const char *); +int getsubopt(char **, char * const *, char **); + +extern char *optarg; /* getopt(3) external variables */ +extern int opterr; +extern int optind; +extern int optopt; +extern int optreset; +extern char *suboptarg; /* getsubopt(3) external variable */ +#endif /* _GETOPT_DEFINED */ + +#ifdef __cplusplus +} +#endif +#endif /* !_GETOPT_H_ */ diff --git a/compat/getopt/getopt_long.c b/compat/getopt/getopt_long.c new file mode 100644 index 0000000..a78ec8f --- /dev/null +++ b/compat/getopt/getopt_long.c @@ -0,0 +1,551 @@ +/* $Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $ */ +/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $ */ +/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ + +/* + * Copyright (c) 2002 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +#ifndef lint +static const char rcsid[]="$Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $"; +#endif /* lint */ +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dieter Baron and Thomas Klausner. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#ifdef _WIN32 + +/* Windows needs warnx(). We change the definition though: + * 1. (another) global is defined, opterrmsg, which holds the error message + * 2. errors are always printed out on stderr w/o the program name + * Note that opterrmsg always gets set no matter what opterr is set to. The + * error message will not be printed if opterr is 0 as usual. + */ + +#include +#include +#include + +char opterrmsg[128]; /* last error message is stored here */ + +static void warnx(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + if (fmt != NULL) + _vsnprintf(opterrmsg, 128, fmt, ap); + else + opterrmsg[0]='\0'; + va_end(ap); + fprintf(stderr, opterrmsg); + fprintf(stderr, "\n"); +} + +#endif /*_WIN32*/ + +#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */ + +#ifdef REPLACE_GETOPT +int opterr = 1; /* if error message should be printed */ +int optind = 1; /* index into parent argv vector */ +int optopt = '?'; /* character checked for validity */ +int optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ +#endif + +#define PRINT_ERROR ((opterr) && (*options != ':')) + +#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */ +#define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */ +#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */ + +/* return values */ +#define BADCH (int)'?' +#define BADARG ((*options == ':') ? (int)':' : (int)'?') +#define INORDER (int)1 + +#define EMSG "" + +static int getopt_internal(int, char * const *, const char *, + const struct option *, int *, int); +static int parse_long_options(char * const *, const char *, + const struct option *, int *, int); +static int gcd(int, int); +static void permute_args(int, int, int, char * const *); + +static char *place = EMSG; /* option letter processing */ + +/* XXX: set optreset to 1 rather than these two */ +static int nonopt_start = -1; /* first non option argument (for permute) */ +static int nonopt_end = -1; /* first option after non options (for permute) */ + +/* Error messages */ +static const char recargchar[] = "option requires an argument -- %c"; +static const char recargstring[] = "option requires an argument -- %s"; +static const char ambig[] = "ambiguous option -- %.*s"; +static const char noarg[] = "option doesn't take an argument -- %.*s"; +static const char illoptchar[] = "unknown option -- %c"; +static const char illoptstring[] = "unknown option -- %s"; + +/* + * Compute the greatest common divisor of a and b. + */ +static int +gcd(int a, int b) +{ + int c; + + c = a % b; + while (c != 0) { + a = b; + b = c; + c = a % b; + } + + return (b); +} + +/* + * Exchange the block from nonopt_start to nonopt_end with the block + * from nonopt_end to opt_end (keeping the same order of arguments + * in each block). + */ +static void +permute_args(int panonopt_start, int panonopt_end, int opt_end, + char * const *nargv) +{ + int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos; + char *swap; + + /* + * compute lengths of blocks and number and size of cycles + */ + nnonopts = panonopt_end - panonopt_start; + nopts = opt_end - panonopt_end; + ncycle = gcd(nnonopts, nopts); + cyclelen = (opt_end - panonopt_start) / ncycle; + + for (i = 0; i < ncycle; i++) { + cstart = panonopt_end+i; + pos = cstart; + for (j = 0; j < cyclelen; j++) { + if (pos >= panonopt_end) + pos -= nnonopts; + else + pos += nopts; + swap = nargv[pos]; + /* LINTED const cast */ + ((char **) nargv)[pos] = nargv[cstart]; + /* LINTED const cast */ + ((char **)nargv)[cstart] = swap; + } + } +} + +/* + * parse_long_options -- + * Parse long options in argc/argv argument vector. + * Returns -1 if short_too is set and the option does not match long_options. + */ +static int +parse_long_options(char * const *nargv, const char *options, + const struct option *long_options, int *idx, int short_too) +{ + char *current_argv, *has_equal; + size_t current_argv_len; + int i, match; + + current_argv = place; + match = -1; + + optind++; + + if ((has_equal = strchr(current_argv, '=')) != NULL) { + /* argument found (--option=arg) */ + current_argv_len = has_equal - current_argv; + has_equal++; + } else + current_argv_len = strlen(current_argv); + + for (i = 0; long_options[i].name; i++) { + /* find matching long option */ + if (strncmp(current_argv, long_options[i].name, + current_argv_len)) + continue; + + if (strlen(long_options[i].name) == current_argv_len) { + /* exact match */ + match = i; + break; + } + /* + * If this is a known short option, don't allow + * a partial match of a single character. + */ + if (short_too && current_argv_len == 1) + continue; + + if (match == -1) /* partial match */ + match = i; + else { + /* ambiguous abbreviation */ + if (PRINT_ERROR) + warnx(ambig, (int)current_argv_len, + current_argv); + optopt = 0; + return (BADCH); + } + } + if (match != -1) { /* option found */ + if (long_options[match].has_arg == no_argument + && has_equal) { + if (PRINT_ERROR) + warnx(noarg, (int)current_argv_len, + current_argv); + /* + * XXX: GNU sets optopt to val regardless of flag + */ + if (long_options[match].flag == NULL) + optopt = long_options[match].val; + else + optopt = 0; + return (BADARG); + } + if (long_options[match].has_arg == required_argument || + long_options[match].has_arg == optional_argument) { + if (has_equal) + optarg = has_equal; + else if (long_options[match].has_arg == + required_argument) { + /* + * optional argument doesn't use next nargv + */ + optarg = nargv[optind++]; + } + } + if ((long_options[match].has_arg == required_argument) + && (optarg == NULL)) { + /* + * Missing argument; leading ':' indicates no error + * should be generated. + */ + if (PRINT_ERROR) + warnx(recargstring, + current_argv); + /* + * XXX: GNU sets optopt to val regardless of flag + */ + if (long_options[match].flag == NULL) + optopt = long_options[match].val; + else + optopt = 0; + --optind; + return (BADARG); + } + } else { /* unknown option */ + if (short_too) { + --optind; + return (-1); + } + if (PRINT_ERROR) + warnx(illoptstring, current_argv); + optopt = 0; + return (BADCH); + } + if (idx) + *idx = match; + if (long_options[match].flag) { + *long_options[match].flag = long_options[match].val; + return (0); + } else + return (long_options[match].val); +} + +/* + * getopt_internal -- + * Parse argc/argv argument vector. Called by user level routines. + */ +static int +getopt_internal(int nargc, char * const *nargv, const char *options, + const struct option *long_options, int *idx, int flags) +{ + char *oli; /* option letter list index */ + int optchar, short_too; + static int posixly_correct = -1; + + if (options == NULL) + return (-1); + + /* + * Disable GNU extensions if POSIXLY_CORRECT is set or options + * string begins with a '+'. + */ + if (posixly_correct == -1) + posixly_correct = (getenv("POSIXLY_CORRECT") != NULL); + if (posixly_correct || *options == '+') + flags &= ~FLAG_PERMUTE; + else if (*options == '-') + flags |= FLAG_ALLARGS; + if (*options == '+' || *options == '-') + options++; + + /* + * XXX Some GNU programs (like cvs) set optind to 0 instead of + * XXX using optreset. Work around this braindamage. + */ + if (optind == 0) + optind = optreset = 1; + + optarg = NULL; + if (optreset) + nonopt_start = nonopt_end = -1; +start: + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc) { /* end of argument vector */ + place = EMSG; + if (nonopt_end != -1) { + /* do permutation, if we have to */ + permute_args(nonopt_start, nonopt_end, + optind, nargv); + optind -= nonopt_end - nonopt_start; + } + else if (nonopt_start != -1) { + /* + * If we skipped non-options, set optind + * to the first of them. + */ + optind = nonopt_start; + } + nonopt_start = nonopt_end = -1; + return (-1); + } + if (*(place = nargv[optind]) != '-' || + (place[1] == '\0' && strchr(options, '-') == NULL)) { + place = EMSG; /* found non-option */ + if (flags & FLAG_ALLARGS) { + /* + * GNU extension: + * return non-option as argument to option 1 + */ + optarg = nargv[optind++]; + return (INORDER); + } + if (!(flags & FLAG_PERMUTE)) { + /* + * If no permutation wanted, stop parsing + * at first non-option. + */ + return (-1); + } + /* do permutation */ + if (nonopt_start == -1) + nonopt_start = optind; + else if (nonopt_end != -1) { + permute_args(nonopt_start, nonopt_end, + optind, nargv); + nonopt_start = optind - + (nonopt_end - nonopt_start); + nonopt_end = -1; + } + optind++; + /* process next argument */ + goto start; + } + if (nonopt_start != -1 && nonopt_end == -1) + nonopt_end = optind; + + /* + * If we have "-" do nothing, if "--" we are done. + */ + if (place[1] != '\0' && *++place == '-' && place[1] == '\0') { + optind++; + place = EMSG; + /* + * We found an option (--), so if we skipped + * non-options, we have to permute. + */ + if (nonopt_end != -1) { + permute_args(nonopt_start, nonopt_end, + optind, nargv); + optind -= nonopt_end - nonopt_start; + } + nonopt_start = nonopt_end = -1; + return (-1); + } + } + + /* + * Check long options if: + * 1) we were passed some + * 2) the arg is not just "-" + * 3) either the arg starts with -- we are getopt_long_only() + */ + if (long_options != NULL && place != nargv[optind] && + (*place == '-' || (flags & FLAG_LONGONLY))) { + short_too = 0; + if (*place == '-') + place++; /* --foo long option */ + else if (*place != ':' && strchr(options, *place) != NULL) + short_too = 1; /* could be short option too */ + + optchar = parse_long_options(nargv, options, long_options, + idx, short_too); + if (optchar != -1) { + place = EMSG; + return (optchar); + } + } + + if ((optchar = (int)*place++) == (int)':' || + (optchar == (int)'-' && *place != '\0') || + (oli = strchr(options, optchar)) == NULL) { + /* + * If the user specified "-" and '-' isn't listed in + * options, return -1 (non-option) as per POSIX. + * Otherwise, it is an unknown option character (or ':'). + */ + if (optchar == (int)'-' && *place == '\0') + return (-1); + if (!*place) + ++optind; + if (PRINT_ERROR) + warnx(illoptchar, optchar); + optopt = optchar; + return (BADCH); + } + if (long_options != NULL && optchar == 'W' && oli[1] == ';') { + /* -W long-option */ + if (*place) /* no space */ + /* NOTHING */; + else if (++optind >= nargc) { /* no arg */ + place = EMSG; + if (PRINT_ERROR) + warnx(recargchar, optchar); + optopt = optchar; + return (BADARG); + } else /* white space */ + place = nargv[optind]; + optchar = parse_long_options(nargv, options, long_options, + idx, 0); + place = EMSG; + return (optchar); + } + if (*++oli != ':') { /* doesn't take argument */ + if (!*place) + ++optind; + } else { /* takes (optional) argument */ + optarg = NULL; + if (*place) /* no white space */ + optarg = place; + else if (oli[1] != ':') { /* arg not optional */ + if (++optind >= nargc) { /* no arg */ + place = EMSG; + if (PRINT_ERROR) + warnx(recargchar, optchar); + optopt = optchar; + return (BADARG); + } else + optarg = nargv[optind]; + } + place = EMSG; + ++optind; + } + /* dump back option letter */ + return (optchar); +} + +#ifdef REPLACE_GETOPT +/* + * getopt -- + * Parse argc/argv argument vector. + * + * [eventually this will replace the BSD getopt] + */ +int +getopt(int nargc, char * const *nargv, const char *options) +{ + + /* + * We don't pass FLAG_PERMUTE to getopt_internal() since + * the BSD getopt(3) (unlike GNU) has never done this. + * + * Furthermore, since many privileged programs call getopt() + * before dropping privileges it makes sense to keep things + * as simple (and bug-free) as possible. + */ + return (getopt_internal(nargc, nargv, options, NULL, NULL, 0)); +} +#endif /* REPLACE_GETOPT */ + +/* + * getopt_long -- + * Parse argc/argv argument vector. + */ +int +getopt_long(int nargc, char * const *nargv, const char *options, + const struct option *long_options, int *idx) +{ + + return (getopt_internal(nargc, nargv, options, long_options, idx, + FLAG_PERMUTE)); +} + +/* + * getopt_long_only -- + * Parse argc/argv argument vector. + */ +int +getopt_long_only(int nargc, char * const *nargv, const char *options, + const struct option *long_options, int *idx) +{ + + return (getopt_internal(nargc, nargv, options, long_options, idx, + FLAG_PERMUTE|FLAG_LONGONLY)); +} diff --git a/compat/gettimeofday.c b/compat/gettimeofday.c new file mode 100644 index 0000000..8512a05 --- /dev/null +++ b/compat/gettimeofday.c @@ -0,0 +1,83 @@ +#include < time.h > +#include //I've ommited this line. +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +int gettimeofday(struct timeval *tv, struct timezone *tz) +{ + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; + + if (NULL != tv) + { + GetSystemTimeAsFileTime(&ft); + + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch*/ + tmpres /= 10; /*convert into microseconds*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); + } + + if (NULL != tz) + { + if (!tzflag) + { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; +} + +void usleep(__int64 waitTime) +{ + if (waitTime > 0) + { + if (waitTime > 100) + { + // use a waitable timer for larger intervals > 0.1ms + + HANDLE timer; + LARGE_INTEGER ft; + + ft.QuadPart = -(10*waitTime); // Convert to 100 nanosecond interval, negative value indicates relative time + + timer = CreateWaitableTimer(NULL, TRUE, NULL); + SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); + WaitForSingleObject(timer, INFINITE); + CloseHandle(timer); + } + else + { + // use a polling loop for short intervals <= 100ms + + LARGE_INTEGER perfCnt, start, now; + __int64 elapsed; + + QueryPerformanceFrequency(&perfCnt); + QueryPerformanceCounter(&start); + do { + QueryPerformanceCounter((LARGE_INTEGER*) &now); + elapsed = (__int64)((now.QuadPart - start.QuadPart) / (float)perfCnt.QuadPart * 1000 * 1000); + } while ( elapsed < waitTime ); + } + } +} diff --git a/compat/inttypes.h b/compat/inttypes.h new file mode 100644 index 0000000..dc7485e --- /dev/null +++ b/compat/inttypes.h @@ -0,0 +1,2 @@ +#pragma once +#include diff --git a/compat/jansson/.gitignore b/compat/jansson/.gitignore new file mode 100644 index 0000000..1a81967 --- /dev/null +++ b/compat/jansson/.gitignore @@ -0,0 +1,3 @@ +*.h.in~ +libtool +libjansson.a diff --git a/compat/jansson/Makefile.am b/compat/jansson/Makefile.am new file mode 100644 index 0000000..29e9745 --- /dev/null +++ b/compat/jansson/Makefile.am @@ -0,0 +1,20 @@ + +noinst_LIBRARIES = libjansson.a + +libjansson_a_SOURCES = \ + jansson_private_config.h \ + dump.c \ + error.c \ + hashtable.c hashtable.h \ + jansson.h \ + jansson_config.h \ + jansson_private.h \ + load.c \ + memory.c \ + pack_unpack.c \ + strbuffer.c strbuffer.h \ + strconv.c \ + utf.c utf.h \ + util.h \ + value.c + diff --git a/compat/jansson/configure.ac b/compat/jansson/configure.ac new file mode 100644 index 0000000..defa183 --- /dev/null +++ b/compat/jansson/configure.ac @@ -0,0 +1,98 @@ +AC_PREREQ([2.60]) +AC_INIT([jansson], [2.6], [petri@digip.org]) + +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE([1.10 foreign]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +AC_CONFIG_SRCDIR([value.c]) +AC_CONFIG_HEADERS([jansson_private_config.h]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_LIBTOOL +AM_CONDITIONAL([GCC], [test x$GCC = xyes]) + +# Checks for libraries. + +# Checks for header files. +AC_CHECK_HEADERS([endian.h fcntl.h locale.h sched.h unistd.h sys/param.h sys/stat.h sys/time.h sys/types.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_INT32_T +AC_TYPE_UINT32_T +AC_TYPE_LONG_LONG_INT + +AC_C_INLINE +case $ac_cv_c_inline in + yes) json_inline=inline;; + no) json_inline=;; + *) json_inline=$ac_cv_c_inline;; +esac +AC_SUBST([json_inline]) + +# Checks for library functions. +AC_CHECK_FUNCS([close getpid gettimeofday localeconv open read sched_yield strtoll]) + +AC_MSG_CHECKING([for gcc __sync builtins]) +have_sync_builtins=no +AC_TRY_LINK( + [], [unsigned long val; __sync_bool_compare_and_swap(&val, 0, 1);], + [have_sync_builtins=yes], +) +if test "x$have_sync_builtins" = "xyes"; then + AC_DEFINE([HAVE_SYNC_BUILTINS], [1], + [Define to 1 if gcc's __sync builtins are available]) +fi +AC_MSG_RESULT([$have_sync_builtins]) + +AC_MSG_CHECKING([for gcc __atomic builtins]) +have_atomic_builtins=no +AC_TRY_LINK( + [], [char l; unsigned long v; __atomic_test_and_set(&l, __ATOMIC_RELAXED); __atomic_store_n(&v, 1, __ATOMIC_ACQ_REL); __atomic_load_n(&v, __ATOMIC_ACQUIRE);], + [have_atomic_builtins=yes], +) +if test "x$have_atomic_builtins" = "xyes"; then + AC_DEFINE([HAVE_ATOMIC_BUILTINS], [1], + [Define to 1 if gcc's __atomic builtins are available]) +fi +AC_MSG_RESULT([$have_atomic_builtins]) + +case "$ac_cv_type_long_long_int$ac_cv_func_strtoll" in + yesyes) json_have_long_long=1;; + *) json_have_long_long=0;; +esac +AC_SUBST([json_have_long_long]) + +case "$ac_cv_header_locale_h$ac_cv_func_localeconv" in + yesyes) json_have_localeconv=1;; + *) json_have_localeconv=0;; +esac +AC_SUBST([json_have_localeconv]) + +# Features +AC_ARG_ENABLE([urandom], + [AS_HELP_STRING([--disable-urandom], + [Don't use /dev/urandom to seed the hash function])], + [use_urandom=$enableval], [use_urandom=yes]) + +if test "x$use_urandom" = xyes; then +AC_DEFINE([USE_URANDOM], [1], + [Define to 1 if /dev/urandom should be used for seeding the hash function]) +fi + +AC_ARG_ENABLE([windows-cryptoapi], + [AS_HELP_STRING([--disable-windows-cryptoapi], + [Don't use CryptGenRandom to seed the hash function])], + [use_windows_cryptoapi=$enableval], [use_windows_cryptoapi=yes]) + +if test "x$use_windows_cryptoapi" = xyes; then +AC_DEFINE([USE_WINDOWS_CRYPTOAPI], [1], + [Define to 1 if CryptGenRandom should be used for seeding the hash function]) +fi + +AC_CONFIG_FILES([ + Makefile +]) +AC_OUTPUT diff --git a/compat/jansson/dump.c b/compat/jansson/dump.c new file mode 100644 index 0000000..3b19c73 --- /dev/null +++ b/compat/jansson/dump.c @@ -0,0 +1,456 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include +#include +#include +#include + +#include "jansson.h" +#include "jansson_private.h" +#include "strbuffer.h" +#include "utf.h" + +#define MAX_INTEGER_STR_LENGTH 100 +#define MAX_REAL_STR_LENGTH 100 + +struct object_key { + size_t serial; + const char *key; +}; + +static int dump_to_strbuffer(const char *buffer, size_t size, void *data) +{ + return strbuffer_append_bytes((strbuffer_t *)data, buffer, size); +} + +static int dump_to_file(const char *buffer, size_t size, void *data) +{ + FILE *dest = (FILE *)data; + if(fwrite(buffer, size, 1, dest) != 1) + return -1; + return 0; +} + +/* 32 spaces (the maximum indentation size) */ +static const char whitespace[] = " "; + +static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t dump, void *data) +{ + if(JSON_INDENT(flags) > 0) + { + int i, ws_count = JSON_INDENT(flags); + + if(dump("\n", 1, data)) + return -1; + + for(i = 0; i < depth; i++) + { + if(dump(whitespace, ws_count, data)) + return -1; + } + } + else if(space && !(flags & JSON_COMPACT)) + { + return dump(" ", 1, data); + } + return 0; +} + +static int dump_string(const char *str, json_dump_callback_t dump, void *data, size_t flags) +{ + const char *pos, *end; + int32_t codepoint; + + if(dump("\"", 1, data)) + return -1; + + end = pos = str; + while(1) + { + const char *text; + char seq[13]; + int length; + + while(*end) + { + end = utf8_iterate(pos, &codepoint); + if(!end) + return -1; + + /* mandatory escape or control char */ + if(codepoint == '\\' || codepoint == '"' || codepoint < 0x20) + break; + + /* slash */ + if((flags & JSON_ESCAPE_SLASH) && codepoint == '/') + break; + + /* non-ASCII */ + if((flags & JSON_ENSURE_ASCII) && codepoint > 0x7F) + break; + + pos = end; + } + + if(pos != str) { + if(dump(str, pos - str, data)) + return -1; + } + + if(end == pos) + break; + + /* handle \, /, ", and control codes */ + length = 2; + switch(codepoint) + { + case '\\': text = "\\\\"; break; + case '\"': text = "\\\""; break; + case '\b': text = "\\b"; break; + case '\f': text = "\\f"; break; + case '\n': text = "\\n"; break; + case '\r': text = "\\r"; break; + case '\t': text = "\\t"; break; + case '/': text = "\\/"; break; + default: + { + /* codepoint is in BMP */ + if(codepoint < 0x10000) + { + sprintf(seq, "\\u%04x", codepoint); + length = 6; + } + + /* not in BMP -> construct a UTF-16 surrogate pair */ + else + { + int32_t first, last; + + codepoint -= 0x10000; + first = 0xD800 | ((codepoint & 0xffc00) >> 10); + last = 0xDC00 | (codepoint & 0x003ff); + + sprintf(seq, "\\u%04x\\u%04x", first, last); + length = 12; + } + + text = seq; + break; + } + } + + if(dump(text, length, data)) + return -1; + + str = pos = end; + } + + return dump("\"", 1, data); +} + +static int object_key_compare_keys(const void *key1, const void *key2) +{ + return strcmp(((const struct object_key *)key1)->key, + ((const struct object_key *)key2)->key); +} + +static int object_key_compare_serials(const void *key1, const void *key2) +{ + size_t a = ((const struct object_key *)key1)->serial; + size_t b = ((const struct object_key *)key2)->serial; + + return a < b ? -1 : a == b ? 0 : 1; +} + +static int do_dump(const json_t *json, size_t flags, int depth, + json_dump_callback_t dump, void *data) +{ + if(!json) + return -1; + + switch(json_typeof(json)) { + case JSON_NULL: + return dump("null", 4, data); + + case JSON_TRUE: + return dump("true", 4, data); + + case JSON_FALSE: + return dump("false", 5, data); + + case JSON_INTEGER: + { + char buffer[MAX_INTEGER_STR_LENGTH]; + int size; + + size = snprintf(buffer, MAX_INTEGER_STR_LENGTH, + "%" JSON_INTEGER_FORMAT, + json_integer_value(json)); + if(size < 0 || size >= MAX_INTEGER_STR_LENGTH) + return -1; + + return dump(buffer, size, data); + } + + case JSON_REAL: + { + char buffer[MAX_REAL_STR_LENGTH]; + int size; + double value = json_real_value(json); + + size = jsonp_dtostr(buffer, MAX_REAL_STR_LENGTH, value); + if(size < 0) + return -1; + + return dump(buffer, size, data); + } + + case JSON_STRING: + return dump_string(json_string_value(json), dump, data, flags); + + case JSON_ARRAY: + { + int i; + int n; + json_array_t *array; + + /* detect circular references */ + array = json_to_array(json); + if(array->visited) + goto array_error; + array->visited = 1; + + n = json_array_size(json); + + if(dump("[", 1, data)) + goto array_error; + if(n == 0) { + array->visited = 0; + return dump("]", 1, data); + } + if(dump_indent(flags, depth + 1, 0, dump, data)) + goto array_error; + + for(i = 0; i < n; ++i) { + if(do_dump(json_array_get(json, i), flags, depth + 1, + dump, data)) + goto array_error; + + if(i < n - 1) + { + if(dump(",", 1, data) || + dump_indent(flags, depth + 1, 1, dump, data)) + goto array_error; + } + else + { + if(dump_indent(flags, depth, 0, dump, data)) + goto array_error; + } + } + + array->visited = 0; + return dump("]", 1, data); + + array_error: + array->visited = 0; + return -1; + } + + case JSON_OBJECT: + { + json_object_t *object; + void *iter; + const char *separator; + int separator_length; + + if(flags & JSON_COMPACT) { + separator = ":"; + separator_length = 1; + } + else { + separator = ": "; + separator_length = 2; + } + + /* detect circular references */ + object = json_to_object(json); + if(object->visited) + goto object_error; + object->visited = 1; + + iter = json_object_iter((json_t *)json); + + if(dump("{", 1, data)) + goto object_error; + if(!iter) { + object->visited = 0; + return dump("}", 1, data); + } + if(dump_indent(flags, depth + 1, 0, dump, data)) + goto object_error; + + if(flags & JSON_SORT_KEYS || flags & JSON_PRESERVE_ORDER) + { + struct object_key *keys; + size_t size, i; + int (*cmp_func)(const void *, const void *); + + size = json_object_size(json); + keys = jsonp_malloc(size * sizeof(struct object_key)); + if(!keys) + goto object_error; + + i = 0; + while(iter) + { + keys[i].serial = hashtable_iter_serial(iter); + keys[i].key = json_object_iter_key(iter); + iter = json_object_iter_next((json_t *)json, iter); + i++; + } + assert(i == size); + + if(flags & JSON_SORT_KEYS) + cmp_func = object_key_compare_keys; + else + cmp_func = object_key_compare_serials; + + qsort(keys, size, sizeof(struct object_key), cmp_func); + + for(i = 0; i < size; i++) + { + const char *key; + json_t *value; + + key = keys[i].key; + value = json_object_get(json, key); + assert(value); + + dump_string(key, dump, data, flags); + if(dump(separator, separator_length, data) || + do_dump(value, flags, depth + 1, dump, data)) + { + jsonp_free(keys); + goto object_error; + } + + if(i < size - 1) + { + if(dump(",", 1, data) || + dump_indent(flags, depth + 1, 1, dump, data)) + { + jsonp_free(keys); + goto object_error; + } + } + else + { + if(dump_indent(flags, depth, 0, dump, data)) + { + jsonp_free(keys); + goto object_error; + } + } + } + + jsonp_free(keys); + } + else + { + /* Don't sort keys */ + + while(iter) + { + void *next = json_object_iter_next((json_t *)json, iter); + + dump_string(json_object_iter_key(iter), dump, data, flags); + if(dump(separator, separator_length, data) || + do_dump(json_object_iter_value(iter), flags, depth + 1, + dump, data)) + goto object_error; + + if(next) + { + if(dump(",", 1, data) || + dump_indent(flags, depth + 1, 1, dump, data)) + goto object_error; + } + else + { + if(dump_indent(flags, depth, 0, dump, data)) + goto object_error; + } + + iter = next; + } + } + + object->visited = 0; + return dump("}", 1, data); + + object_error: + object->visited = 0; + return -1; + } + + default: + /* not reached */ + return -1; + } +} + +char *json_dumps(const json_t *json, size_t flags) +{ + strbuffer_t strbuff; + char *result; + + if(strbuffer_init(&strbuff)) + return NULL; + + if(json_dump_callback(json, dump_to_strbuffer, (void *)&strbuff, flags)) + result = NULL; + else + result = jsonp_strdup(strbuffer_value(&strbuff)); + + strbuffer_close(&strbuff); + return result; +} + +int json_dumpf(const json_t *json, FILE *output, size_t flags) +{ + return json_dump_callback(json, dump_to_file, (void *)output, flags); +} + +int json_dump_file(const json_t *json, const char *path, size_t flags) +{ + int result; + + FILE *output = fopen(path, "w"); + if(!output) + return -1; + + result = json_dumpf(json, output, flags); + + fclose(output); + return result; +} + +int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags) +{ + if(!(flags & JSON_ENCODE_ANY)) { + if(!json_is_array(json) && !json_is_object(json)) + return -1; + } + + return do_dump(json, flags, 0, callback, data); +} diff --git a/compat/jansson/error.c b/compat/jansson/error.c new file mode 100644 index 0000000..a544a59 --- /dev/null +++ b/compat/jansson/error.c @@ -0,0 +1,63 @@ +#include +#include "jansson_private.h" + +void jsonp_error_init(json_error_t *error, const char *source) +{ + if(error) + { + error->text[0] = '\0'; + error->line = -1; + error->column = -1; + error->position = 0; + if(source) + jsonp_error_set_source(error, source); + else + error->source[0] = '\0'; + } +} + +void jsonp_error_set_source(json_error_t *error, const char *source) +{ + size_t length; + + if(!error || !source) + return; + + length = strlen(source); + if(length < JSON_ERROR_SOURCE_LENGTH) + strcpy(error->source, source); + else { + size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4; + strcpy(error->source, "..."); + strcpy(error->source + 3, source + extra); + } +} + +void jsonp_error_set(json_error_t *error, int line, int column, + size_t position, const char *msg, ...) +{ + va_list ap; + + va_start(ap, msg); + jsonp_error_vset(error, line, column, position, msg, ap); + va_end(ap); +} + +void jsonp_error_vset(json_error_t *error, int line, int column, + size_t position, const char *msg, va_list ap) +{ + if(!error) + return; + + if(error->text[0] != '\0') { + /* error already set */ + return; + } + + error->line = line; + error->column = column; + error->position = position; + + vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap); + error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; +} diff --git a/compat/jansson/hashtable.c b/compat/jansson/hashtable.c new file mode 100644 index 0000000..5fb0467 --- /dev/null +++ b/compat/jansson/hashtable.c @@ -0,0 +1,360 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#include +#include +#include /* for JSON_INLINE */ +#include "jansson_private.h" /* for container_of() */ +#include "hashtable.h" + +typedef struct hashtable_list list_t; +typedef struct hashtable_pair pair_t; +typedef struct hashtable_bucket bucket_t; + +#define list_to_pair(list_) container_of(list_, pair_t, list) + +/* From http://www.cse.yorku.ca/~oz/hash.html */ +static size_t hash_str(const void *ptr) +{ + const char *str = (const char *)ptr; + + size_t hash = 5381; + size_t c; + + while((c = (size_t)*str)) + { + hash = ((hash << 5) + hash) + c; + str++; + } + + return hash; +} + +static JSON_INLINE void list_init(list_t *list) +{ + list->next = list; + list->prev = list; +} + +static JSON_INLINE void list_insert(list_t *list, list_t *node) +{ + node->next = list; + node->prev = list->prev; + list->prev->next = node; + list->prev = node; +} + +static JSON_INLINE void list_remove(list_t *list) +{ + list->prev->next = list->next; + list->next->prev = list->prev; +} + +static JSON_INLINE int bucket_is_empty(hashtable_t *hashtable, bucket_t *bucket) +{ + return bucket->first == &hashtable->list && bucket->first == bucket->last; +} + +static void insert_to_bucket(hashtable_t *hashtable, bucket_t *bucket, + list_t *list) +{ + if(bucket_is_empty(hashtable, bucket)) + { + list_insert(&hashtable->list, list); + bucket->first = bucket->last = list; + } + else + { + list_insert(bucket->first, list); + bucket->first = list; + } +} + +static const size_t primes[] = { + 5, 13, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, + 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, + 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, + 805306457, 1610612741 +}; + +static JSON_INLINE size_t num_buckets(hashtable_t *hashtable) +{ + return primes[hashtable->num_buckets]; +} + + +static pair_t *hashtable_find_pair(hashtable_t *hashtable, bucket_t *bucket, + const char *key, size_t hash) +{ + list_t *list; + pair_t *pair; + + if(bucket_is_empty(hashtable, bucket)) + return NULL; + + list = bucket->first; + while(1) + { + pair = list_to_pair(list); + if(pair->hash == hash && strcmp(pair->key, key) == 0) + return pair; + + if(list == bucket->last) + break; + + list = list->next; + } + + return NULL; +} + +/* returns 0 on success, -1 if key was not found */ +static int hashtable_do_del(hashtable_t *hashtable, + const char *key, size_t hash) +{ + pair_t *pair; + bucket_t *bucket; + size_t index; + + index = hash % num_buckets(hashtable); + bucket = &hashtable->buckets[index]; + + pair = hashtable_find_pair(hashtable, bucket, key, hash); + if(!pair) + return -1; + + if(&pair->list == bucket->first && &pair->list == bucket->last) + bucket->first = bucket->last = &hashtable->list; + + else if(&pair->list == bucket->first) + bucket->first = pair->list.next; + + else if(&pair->list == bucket->last) + bucket->last = pair->list.prev; + + list_remove(&pair->list); + json_decref(pair->value); + + jsonp_free(pair); + hashtable->size--; + + return 0; +} + +static void hashtable_do_clear(hashtable_t *hashtable) +{ + list_t *list, *next; + pair_t *pair; + + for(list = hashtable->list.next; list != &hashtable->list; list = next) + { + next = list->next; + pair = list_to_pair(list); + json_decref(pair->value); + jsonp_free(pair); + } +} + +static int hashtable_do_rehash(hashtable_t *hashtable) +{ + list_t *list, *next; + pair_t *pair; + size_t i, index, new_size; + + jsonp_free(hashtable->buckets); + + hashtable->num_buckets++; + new_size = num_buckets(hashtable); + + hashtable->buckets = jsonp_malloc(new_size * sizeof(bucket_t)); + if(!hashtable->buckets) + return -1; + + for(i = 0; i < num_buckets(hashtable); i++) + { + hashtable->buckets[i].first = hashtable->buckets[i].last = + &hashtable->list; + } + + list = hashtable->list.next; + list_init(&hashtable->list); + + for(; list != &hashtable->list; list = next) { + next = list->next; + pair = list_to_pair(list); + index = pair->hash % new_size; + insert_to_bucket(hashtable, &hashtable->buckets[index], &pair->list); + } + + return 0; +} + + +int hashtable_init(hashtable_t *hashtable) +{ + size_t i; + + hashtable->size = 0; + hashtable->num_buckets = 0; /* index to primes[] */ + hashtable->buckets = jsonp_malloc(num_buckets(hashtable) * sizeof(bucket_t)); + if(!hashtable->buckets) + return -1; + + list_init(&hashtable->list); + + for(i = 0; i < num_buckets(hashtable); i++) + { + hashtable->buckets[i].first = hashtable->buckets[i].last = + &hashtable->list; + } + + return 0; +} + +void hashtable_close(hashtable_t *hashtable) +{ + hashtable_do_clear(hashtable); + jsonp_free(hashtable->buckets); +} + +int hashtable_set(hashtable_t *hashtable, + const char *key, size_t serial, + json_t *value) +{ + pair_t *pair; + bucket_t *bucket; + size_t hash, index; + + /* rehash if the load ratio exceeds 1 */ + if(hashtable->size >= num_buckets(hashtable)) + if(hashtable_do_rehash(hashtable)) + return -1; + + hash = hash_str(key); + index = hash % num_buckets(hashtable); + bucket = &hashtable->buckets[index]; + pair = hashtable_find_pair(hashtable, bucket, key, hash); + + if(pair) + { + json_decref(pair->value); + pair->value = value; + } + else + { + /* offsetof(...) returns the size of pair_t without the last, + flexible member. This way, the correct amount is + allocated. */ + pair = jsonp_malloc(offsetof(pair_t, key) + strlen(key) + 1); + if(!pair) + return -1; + + pair->hash = hash; + pair->serial = serial; + strcpy(pair->key, key); + pair->value = value; + list_init(&pair->list); + + insert_to_bucket(hashtable, bucket, &pair->list); + + hashtable->size++; + } + return 0; +} + +void *hashtable_get(hashtable_t *hashtable, const char *key) +{ + pair_t *pair; + size_t hash; + bucket_t *bucket; + + hash = hash_str(key); + bucket = &hashtable->buckets[hash % num_buckets(hashtable)]; + + pair = hashtable_find_pair(hashtable, bucket, key, hash); + if(!pair) + return NULL; + + return pair->value; +} + +int hashtable_del(hashtable_t *hashtable, const char *key) +{ + size_t hash = hash_str(key); + return hashtable_do_del(hashtable, key, hash); +} + +void hashtable_clear(hashtable_t *hashtable) +{ + size_t i; + + hashtable_do_clear(hashtable); + + for(i = 0; i < num_buckets(hashtable); i++) + { + hashtable->buckets[i].first = hashtable->buckets[i].last = + &hashtable->list; + } + + list_init(&hashtable->list); + hashtable->size = 0; +} + +void *hashtable_iter(hashtable_t *hashtable) +{ + return hashtable_iter_next(hashtable, &hashtable->list); +} + +void *hashtable_iter_at(hashtable_t *hashtable, const char *key) +{ + pair_t *pair; + size_t hash; + bucket_t *bucket; + + hash = hash_str(key); + bucket = &hashtable->buckets[hash % num_buckets(hashtable)]; + + pair = hashtable_find_pair(hashtable, bucket, key, hash); + if(!pair) + return NULL; + + return &pair->list; +} + +void *hashtable_iter_next(hashtable_t *hashtable, void *iter) +{ + list_t *list = (list_t *)iter; + if(list->next == &hashtable->list) + return NULL; + return list->next; +} + +void *hashtable_iter_key(void *iter) +{ + pair_t *pair = list_to_pair((list_t *)iter); + return pair->key; +} + +size_t hashtable_iter_serial(void *iter) +{ + pair_t *pair = list_to_pair((list_t *)iter); + return pair->serial; +} + +void *hashtable_iter_value(void *iter) +{ + pair_t *pair = list_to_pair((list_t *)iter); + return pair->value; +} + +void hashtable_iter_set(void *iter, json_t *value) +{ + pair_t *pair = list_to_pair((list_t *)iter); + + json_decref(pair->value); + pair->value = value; +} diff --git a/compat/jansson/hashtable.h b/compat/jansson/hashtable.h new file mode 100644 index 0000000..4a7ce6f --- /dev/null +++ b/compat/jansson/hashtable.h @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef HASHTABLE_H +#define HASHTABLE_H + +struct hashtable_list { + struct hashtable_list *prev; + struct hashtable_list *next; +}; + +/* "pair" may be a bit confusing a name, but think of it as a + key-value pair. In this case, it just encodes some extra data, + too */ +struct hashtable_pair { + size_t hash; + struct hashtable_list list; + json_t *value; + size_t serial; + char key[1]; +}; + +struct hashtable_bucket { + struct hashtable_list *first; + struct hashtable_list *last; +}; + +typedef struct hashtable { + size_t size; + struct hashtable_bucket *buckets; + size_t num_buckets; /* index to primes[] */ + struct hashtable_list list; +} hashtable_t; + + +#define hashtable_key_to_iter(key_) \ + (&(container_of(key_, struct hashtable_pair, key)->list)) + +/** + * hashtable_init - Initialize a hashtable object + * + * @hashtable: The (statically allocated) hashtable object + * + * Initializes a statically allocated hashtable object. The object + * should be cleared with hashtable_close when it's no longer used. + * + * Returns 0 on success, -1 on error (out of memory). + */ +int hashtable_init(hashtable_t *hashtable); + +/** + * hashtable_close - Release all resources used by a hashtable object + * + * @hashtable: The hashtable + * + * Destroys a statically allocated hashtable object. + */ +void hashtable_close(hashtable_t *hashtable); + +/** + * hashtable_set - Add/modify value in hashtable + * + * @hashtable: The hashtable object + * @key: The key + * @serial: For addition order of keys + * @value: The value + * + * If a value with the given key already exists, its value is replaced + * with the new value. Value is "stealed" in the sense that hashtable + * doesn't increment its refcount but decreases the refcount when the + * value is no longer needed. + * + * Returns 0 on success, -1 on failure (out of memory). + */ +int hashtable_set(hashtable_t *hashtable, + const char *key, size_t serial, + json_t *value); + +/** + * hashtable_get - Get a value associated with a key + * + * @hashtable: The hashtable object + * @key: The key + * + * Returns value if it is found, or NULL otherwise. + */ +void *hashtable_get(hashtable_t *hashtable, const char *key); + +/** + * hashtable_del - Remove a value from the hashtable + * + * @hashtable: The hashtable object + * @key: The key + * + * Returns 0 on success, or -1 if the key was not found. + */ +int hashtable_del(hashtable_t *hashtable, const char *key); + +/** + * hashtable_clear - Clear hashtable + * + * @hashtable: The hashtable object + * + * Removes all items from the hashtable. + */ +void hashtable_clear(hashtable_t *hashtable); + +/** + * hashtable_iter - Iterate over hashtable + * + * @hashtable: The hashtable object + * + * Returns an opaque iterator to the first element in the hashtable. + * The iterator should be passed to hashtable_iter_* functions. + * The hashtable items are not iterated over in any particular order. + * + * There's no need to free the iterator in any way. The iterator is + * valid as long as the item that is referenced by the iterator is not + * deleted. Other values may be added or deleted. In particular, + * hashtable_iter_next() may be called on an iterator, and after that + * the key/value pair pointed by the old iterator may be deleted. + */ +void *hashtable_iter(hashtable_t *hashtable); + +/** + * hashtable_iter_at - Return an iterator at a specific key + * + * @hashtable: The hashtable object + * @key: The key that the iterator should point to + * + * Like hashtable_iter() but returns an iterator pointing to a + * specific key. + */ +void *hashtable_iter_at(hashtable_t *hashtable, const char *key); + +/** + * hashtable_iter_next - Advance an iterator + * + * @hashtable: The hashtable object + * @iter: The iterator + * + * Returns a new iterator pointing to the next element in the + * hashtable or NULL if the whole hastable has been iterated over. + */ +void *hashtable_iter_next(hashtable_t *hashtable, void *iter); + +/** + * hashtable_iter_key - Retrieve the key pointed by an iterator + * + * @iter: The iterator + */ +void *hashtable_iter_key(void *iter); + +/** + * hashtable_iter_serial - Retrieve the serial number pointed to by an iterator + * + * @iter: The iterator + */ +size_t hashtable_iter_serial(void *iter); + +/** + * hashtable_iter_value - Retrieve the value pointed by an iterator + * + * @iter: The iterator + */ +void *hashtable_iter_value(void *iter); + +/** + * hashtable_iter_set - Set the value pointed by an iterator + * + * @iter: The iterator + * @value: The value to set + */ +void hashtable_iter_set(void *iter, json_t *value); + +#endif diff --git a/compat/jansson/jansson.h b/compat/jansson/jansson.h new file mode 100644 index 0000000..c192ffa --- /dev/null +++ b/compat/jansson/jansson.h @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef JANSSON_H +#define JANSSON_H + +#include +#include /* for size_t */ +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* version */ + +#define JANSSON_MAJOR_VERSION 2 +#define JANSSON_MINOR_VERSION 6 +#define JANSSON_MICRO_VERSION 0 + +/* Micro version is omitted if it's 0 */ +#define JANSSON_VERSION "2.6" + +/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this + for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */ +#define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \ + (JANSSON_MINOR_VERSION << 8) | \ + (JANSSON_MICRO_VERSION << 0)) + + +/* types */ + +typedef enum { + JSON_OBJECT, + JSON_ARRAY, + JSON_STRING, + JSON_INTEGER, + JSON_REAL, + JSON_TRUE, + JSON_FALSE, + JSON_NULL +} json_type; + +typedef struct json_t { + json_type type; + size_t refcount; +} json_t; + +#ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ +#if JSON_INTEGER_IS_LONG_LONG +#ifdef _WIN32 +#define JSON_INTEGER_FORMAT "I64d" +#else +#define JSON_INTEGER_FORMAT "lld" +#endif +typedef long long json_int_t; +#else +#define JSON_INTEGER_FORMAT "ld" +typedef long json_int_t; +#endif /* JSON_INTEGER_IS_LONG_LONG */ +#endif + +#define json_typeof(json) ((json)->type) +#define json_is_object(json) (json && json_typeof(json) == JSON_OBJECT) +#define json_is_array(json) (json && json_typeof(json) == JSON_ARRAY) +#define json_is_string(json) (json && json_typeof(json) == JSON_STRING) +#define json_is_integer(json) (json && json_typeof(json) == JSON_INTEGER) +#define json_is_real(json) (json && json_typeof(json) == JSON_REAL) +#define json_is_number(json) (json_is_integer(json) || json_is_real(json)) +#define json_is_true(json) (json && json_typeof(json) == JSON_TRUE) +#define json_is_false(json) (json && json_typeof(json) == JSON_FALSE) +#define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) +#define json_is_null(json) (json && json_typeof(json) == JSON_NULL) + +/* construction, destruction, reference counting */ + +json_t *json_object(void); +json_t *json_array(void); +json_t *json_string(const char *value); +json_t *json_string_nocheck(const char *value); +json_t *json_integer(json_int_t value); +json_t *json_real(double value); +json_t *json_true(void); +json_t *json_false(void); +#define json_boolean(val) ((val) ? json_true() : json_false()) +json_t *json_null(void); + +static JSON_INLINE +json_t *json_incref(json_t *json) +{ + if(json && json->refcount != (size_t)-1) + ++json->refcount; + return json; +} + +/* do not call json_delete directly */ +void json_delete(json_t *json); + +static JSON_INLINE +void json_decref(json_t *json) +{ + if(json && json->refcount != (size_t)-1 && --json->refcount == 0) + json_delete(json); +} + + +/* error reporting */ + +#define JSON_ERROR_TEXT_LENGTH 160 +#define JSON_ERROR_SOURCE_LENGTH 80 + +typedef struct { + int line; + int column; + int position; + char source[JSON_ERROR_SOURCE_LENGTH]; + char text[JSON_ERROR_TEXT_LENGTH]; +} json_error_t; + + +/* getters, setters, manipulation */ + +size_t json_object_size(const json_t *object); +json_t *json_object_get(const json_t *object, const char *key); +int json_object_set_new(json_t *object, const char *key, json_t *value); +int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value); +int json_object_del(json_t *object, const char *key); +int json_object_clear(json_t *object); +int json_object_update(json_t *object, json_t *other); +int json_object_update_existing(json_t *object, json_t *other); +int json_object_update_missing(json_t *object, json_t *other); +void *json_object_iter(json_t *object); +void *json_object_iter_at(json_t *object, const char *key); +void *json_object_key_to_iter(const char *key); +void *json_object_iter_next(json_t *object, void *iter); +const char *json_object_iter_key(void *iter); +json_t *json_object_iter_value(void *iter); +int json_object_iter_set_new(json_t *object, void *iter, json_t *value); + +#define json_object_foreach(object, key, value) \ + for(key = json_object_iter_key(json_object_iter(object)); \ + key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ + key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key)))) + +#define json_array_foreach(array, index, value) \ + for(index = 0; \ + index < json_array_size(array) && (value = json_array_get(array, index)); \ + index++) + +static JSON_INLINE +int json_object_set(json_t *object, const char *key, json_t *value) +{ + return json_object_set_new(object, key, json_incref(value)); +} + +static JSON_INLINE +int json_object_set_nocheck(json_t *object, const char *key, json_t *value) +{ + return json_object_set_new_nocheck(object, key, json_incref(value)); +} + +static JSON_INLINE +int json_object_iter_set(json_t *object, void *iter, json_t *value) +{ + return json_object_iter_set_new(object, iter, json_incref(value)); +} + +size_t json_array_size(const json_t *array); +json_t *json_array_get(const json_t *array, size_t index); +int json_array_set_new(json_t *array, size_t index, json_t *value); +int json_array_append_new(json_t *array, json_t *value); +int json_array_insert_new(json_t *array, size_t index, json_t *value); +int json_array_remove(json_t *array, size_t index); +int json_array_clear(json_t *array); +int json_array_extend(json_t *array, json_t *other); + +static JSON_INLINE +int json_array_set(json_t *array, size_t ind, json_t *value) +{ + return json_array_set_new(array, ind, json_incref(value)); +} + +static JSON_INLINE +int json_array_append(json_t *array, json_t *value) +{ + return json_array_append_new(array, json_incref(value)); +} + +static JSON_INLINE +int json_array_insert(json_t *array, size_t ind, json_t *value) +{ + return json_array_insert_new(array, ind, json_incref(value)); +} + +const char *json_string_value(const json_t *string); +json_int_t json_integer_value(const json_t *integer); +double json_real_value(const json_t *real); +double json_number_value(const json_t *json); + +int json_string_set(json_t *string, const char *value); +int json_string_set_nocheck(json_t *string, const char *value); +int json_integer_set(json_t *integer, json_int_t value); +int json_real_set(json_t *real, double value); + + +/* pack, unpack */ + +json_t *json_pack(const char *fmt, ...); +json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...); +json_t *json_vpack_ex(json_error_t *error, size_t flags, const char *fmt, va_list ap); + +#define JSON_VALIDATE_ONLY 0x1 +#define JSON_STRICT 0x2 + +int json_unpack(json_t *root, const char *fmt, ...); +int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...); +int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, va_list ap); + + +/* equality */ + +int json_equal(json_t *value1, json_t *value2); + + +/* copying */ + +json_t *json_copy(json_t *value); +json_t *json_deep_copy(const json_t *value); + + +/* decoding */ + +#define JSON_REJECT_DUPLICATES 0x1 +#define JSON_DISABLE_EOF_CHECK 0x2 +#define JSON_DECODE_ANY 0x4 +#define JSON_DECODE_INT_AS_REAL 0x8 + +typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data); + +json_t *json_loads(const char *input, size_t flags, json_error_t *error); +json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error); +json_t *json_loadf(FILE *input, size_t flags, json_error_t *error); +json_t *json_load_file(const char *path, size_t flags, json_error_t *error); +json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error); + + +/* encoding */ + +#define JSON_INDENT(n) (n & 0x1F) +#define JSON_COMPACT 0x20 +#define JSON_ENSURE_ASCII 0x40 +#define JSON_SORT_KEYS 0x80 +#define JSON_PRESERVE_ORDER 0x100 +#define JSON_ENCODE_ANY 0x200 +#define JSON_ESCAPE_SLASH 0x400 + +typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data); + +char *json_dumps(const json_t *json, size_t flags); +int json_dumpf(const json_t *json, FILE *output, size_t flags); +int json_dump_file(const json_t *json, const char *path, size_t flags); +int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags); + +/* custom memory allocation */ + +typedef void *(*json_malloc_t)(size_t); +typedef void (*json_free_t)(void *); + +void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/compat/jansson/jansson_config.h b/compat/jansson/jansson_config.h new file mode 100644 index 0000000..0f3c7ca --- /dev/null +++ b/compat/jansson/jansson_config.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2010-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + * + * + * This file specifies a part of the site-specific configuration for + * Jansson, namely those things that affect the public API in + * jansson.h. + * + * The configure script copies this file to jansson_config.h and + * replaces @var@ substitutions by values that fit your system. If you + * cannot run the configure script, you can do the value substitution + * by hand. + */ + +#ifndef JANSSON_CONFIG_H +#define JANSSON_CONFIG_H +/* If your compiler supports the inline keyword in C, JSON_INLINE is + defined to `inline', otherwise empty. In C++, the inline is always + supported. */ + +#ifdef _MSC_VER +#define inline __inline +#if !defined(HAVE_STRUCT_TIMESPEC) && _MSC_VER >= 1900 +#define HAVE_STRUCT_TIMESPEC +#endif +#endif + +#ifdef __cplusplus +#define JSON_INLINE inline +#else +#define JSON_INLINE inline +#endif + +/* If your compiler supports the `long long` type and the strtoll() + library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, + otherwise to 0. */ +#define JSON_INTEGER_IS_LONG_LONG 1 + +/* If locale.h and localeconv() are available, define to 1, + otherwise to 0. */ +#define JSON_HAVE_LOCALECONV 1 + +#endif diff --git a/compat/jansson/jansson_config.h.in b/compat/jansson/jansson_config.h.in new file mode 100644 index 0000000..12580a0 --- /dev/null +++ b/compat/jansson/jansson_config.h.in @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010-2014 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + * + * + * This file specifies a part of the site-specific configuration for + * Jansson, namely those things that affect the public API in + * jansson.h. + * + * The configure script copies this file to jansson_config.h and + * replaces @var@ substitutions by values that fit your system. If you + * cannot run the configure script, you can do the value substitution + * by hand. + */ + +#ifndef JANSSON_CONFIG_H +#define JANSSON_CONFIG_H + +/* If your compiler supports the inline keyword in C, JSON_INLINE is + defined to `inline', otherwise empty. In C++, the inline is always + supported. */ +#ifdef __cplusplus +#define JSON_INLINE inline +#else +#define JSON_INLINE @json_inline@ +#endif + +/* If your compiler supports the `long long` type and the strtoll() + library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, + otherwise to 0. */ +#define JSON_INTEGER_IS_LONG_LONG @json_have_long_long@ + +/* If locale.h and localeconv() are available, define to 1, + otherwise to 0. */ +#define JSON_HAVE_LOCALECONV @json_have_localeconv@ + +#endif diff --git a/compat/jansson/jansson_private.h b/compat/jansson/jansson_private.h new file mode 100644 index 0000000..403b53a --- /dev/null +++ b/compat/jansson/jansson_private.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef JANSSON_PRIVATE_H +#define JANSSON_PRIVATE_H + +#include +#include "jansson.h" +#include "hashtable.h" +#include "strbuffer.h" + +#define container_of(ptr_, type_, member_) \ + ((type_ *)((char *)ptr_ - offsetof(type_, member_))) + +/* On some platforms, max() may already be defined */ +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + +/* va_copy is a C99 feature. In C89 implementations, it's sometimes + available as __va_copy. If not, memcpy() should do the trick. */ +#ifndef va_copy +#ifdef __va_copy +#define va_copy __va_copy +#else +#define va_copy(a, b) memcpy(&(a), &(b), sizeof(va_list)) +#endif +#endif + +typedef struct { + json_t json; + hashtable_t hashtable; + size_t serial; + int visited; +} json_object_t; + +typedef struct { + json_t json; + size_t size; + size_t entries; + json_t **table; + int visited; +} json_array_t; + +typedef struct { + json_t json; + char *value; +} json_string_t; + +typedef struct { + json_t json; + double value; +} json_real_t; + +typedef struct { + json_t json; + json_int_t value; +} json_integer_t; + +#define json_to_object(json_) container_of(json_, json_object_t, json) +#define json_to_array(json_) container_of(json_, json_array_t, json) +#define json_to_string(json_) container_of(json_, json_string_t, json) +#define json_to_real(json_) container_of(json_, json_real_t, json) +#define json_to_integer(json_) container_of(json_, json_integer_t, json) + +void jsonp_error_init(json_error_t *error, const char *source); +void jsonp_error_set_source(json_error_t *error, const char *source); +void jsonp_error_set(json_error_t *error, int line, int column, + size_t position, const char *msg, ...); +void jsonp_error_vset(json_error_t *error, int line, int column, + size_t position, const char *msg, va_list ap); + +/* Locale independent string<->double conversions */ +int jsonp_strtod(strbuffer_t *strbuffer, double *out); +int jsonp_dtostr(char *buffer, size_t size, double value); + +/* Wrappers for custom memory functions */ +void* jsonp_malloc(size_t size); +void jsonp_free(void *ptr); +char *jsonp_strndup(const char *str, size_t length); +char *jsonp_strdup(const char *str); + +/* Windows compatibility */ +#ifdef _WIN32 +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#endif + +#endif diff --git a/compat/jansson/jansson_private_config.h b/compat/jansson/jansson_private_config.h new file mode 100644 index 0000000..2eb70a8 --- /dev/null +++ b/compat/jansson/jansson_private_config.h @@ -0,0 +1,140 @@ +/* jansson_private_config.h. Generated from jansson_private_config.h.in by configure. */ +/* jansson_private_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if gcc's __atomic builtins are available */ +/* #undef HAVE_ATOMIC_BUILTINS */ + +/* Define to 1 if you have the `close' function. */ +#define HAVE_CLOSE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `localeconv' function. */ +#define HAVE_LOCALECONV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if the system has the type `long long int'. */ +#define HAVE_LONG_LONG_INT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `open' function. */ +#define HAVE_OPEN 1 + +/* Define to 1 if you have the `read' function. */ +#define HAVE_READ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SCHED_H 1 + +/* Define to 1 if you have the `sched_yield' function. */ +/* #undef HAVE_SCHED_YIELD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if gcc's __sync builtins are available */ +#define HAVE_SYNC_BUILTINS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "jansson" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "petri@digip.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "jansson" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "jansson 2.6" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "jansson" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.6" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if /dev/urandom should be used for seeding the hash function */ +#define USE_URANDOM 1 + +/* Define to 1 if CryptGenRandom should be used for seeding the hash function + */ +#define USE_WINDOWS_CRYPTOAPI 1 + +/* Version number of package */ +#define VERSION "2.6" + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int32_t */ + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ diff --git a/compat/jansson/jansson_private_config.h.in b/compat/jansson/jansson_private_config.h.in new file mode 100644 index 0000000..7c07084 --- /dev/null +++ b/compat/jansson/jansson_private_config.h.in @@ -0,0 +1,139 @@ +/* jansson_private_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if gcc's __atomic builtins are available */ +#undef HAVE_ATOMIC_BUILTINS + +/* Define to 1 if you have the `close' function. */ +#undef HAVE_CLOSE + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `getpid' function. */ +#undef HAVE_GETPID + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `localeconv' function. */ +#undef HAVE_LOCALECONV + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if the system has the type `long long int'. */ +#undef HAVE_LONG_LONG_INT + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `open' function. */ +#undef HAVE_OPEN + +/* Define to 1 if you have the `read' function. */ +#undef HAVE_READ + +/* Define to 1 if you have the header file. */ +#undef HAVE_SCHED_H + +/* Define to 1 if you have the `sched_yield' function. */ +#undef HAVE_SCHED_YIELD + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define to 1 if gcc's __sync builtins are available */ +#undef HAVE_SYNC_BUILTINS + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if /dev/urandom should be used for seeding the hash function */ +#undef USE_URANDOM + +/* Define to 1 if CryptGenRandom should be used for seeding the hash function + */ +#undef USE_WINDOWS_CRYPTOAPI + +/* Version number of package */ +#undef VERSION + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef int32_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t diff --git a/compat/jansson/load.c b/compat/jansson/load.c new file mode 100644 index 0000000..c5536f5 --- /dev/null +++ b/compat/jansson/load.c @@ -0,0 +1,1077 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include +#include +#include +#include +#include +#include + +#include "jansson.h" +#include "jansson_private.h" +#include "strbuffer.h" +#include "utf.h" + +#define STREAM_STATE_OK 0 +#define STREAM_STATE_EOF -1 +#define STREAM_STATE_ERROR -2 + +#define TOKEN_INVALID -1 +#define TOKEN_EOF 0 +#define TOKEN_STRING 256 +#define TOKEN_INTEGER 257 +#define TOKEN_REAL 258 +#define TOKEN_TRUE 259 +#define TOKEN_FALSE 260 +#define TOKEN_NULL 261 + +/* Locale independent versions of isxxx() functions */ +#define l_isupper(c) ('A' <= (c) && (c) <= 'Z') +#define l_islower(c) ('a' <= (c) && (c) <= 'z') +#define l_isalpha(c) (l_isupper(c) || l_islower(c)) +#define l_isdigit(c) ('0' <= (c) && (c) <= '9') +#define l_isxdigit(c) \ + (l_isdigit(c) || ('A' <= (c) && (c) <= 'F') || ('a' <= (c) && (c) <= 'f')) + +/* Read one byte from stream, convert to unsigned char, then int, and + return. return EOF on end of file. This corresponds to the + behaviour of fgetc(). */ +typedef int (*get_func)(void *data); + +typedef struct { + get_func get; + void *data; + char buffer[5]; + size_t buffer_pos; + int state; + int line; + int column, last_column; + size_t position; +} stream_t; + +typedef struct { + stream_t stream; + strbuffer_t saved_text; + int token; + union { + char *string; + json_int_t integer; + double real; + } value; +} lex_t; + +#define stream_to_lex(stream) container_of(stream, lex_t, stream) + + +/*** error reporting ***/ + +static void error_set(json_error_t *error, const lex_t *lex, + const char *msg, ...) +{ + va_list ap; + char msg_text[JSON_ERROR_TEXT_LENGTH]; + char msg_with_context[JSON_ERROR_TEXT_LENGTH]; + + int line = -1, col = -1; + size_t pos = 0; + const char *result = msg_text; + + if(!error) + return; + + va_start(ap, msg); + vsnprintf(msg_text, JSON_ERROR_TEXT_LENGTH, msg, ap); + msg_text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; + va_end(ap); + + if(lex) + { + const char *saved_text = strbuffer_value(&lex->saved_text); + + line = lex->stream.line; + col = lex->stream.column; + pos = lex->stream.position; + + if(saved_text && saved_text[0]) + { + if(lex->saved_text.length <= 20) { + snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, + "%s near '%s'", msg_text, saved_text); + msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; + result = msg_with_context; + } + } + else + { + if(lex->stream.state == STREAM_STATE_ERROR) { + /* No context for UTF-8 decoding errors */ + result = msg_text; + } + else { + snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, + "%s near end of file", msg_text); + msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; + result = msg_with_context; + } + } + } + + jsonp_error_set(error, line, col, pos, "%s", result); +} + + +/*** lexical analyzer ***/ + +static void +stream_init(stream_t *stream, get_func get, void *data) +{ + stream->get = get; + stream->data = data; + stream->buffer[0] = '\0'; + stream->buffer_pos = 0; + + stream->state = STREAM_STATE_OK; + stream->line = 1; + stream->column = 0; + stream->position = 0; +} + +static int stream_get(stream_t *stream, json_error_t *error) +{ + int c; + + if(stream->state != STREAM_STATE_OK) + return stream->state; + + if(!stream->buffer[stream->buffer_pos]) + { + c = stream->get(stream->data); + if(c == EOF) { + stream->state = STREAM_STATE_EOF; + return STREAM_STATE_EOF; + } + + stream->buffer[0] = c; + stream->buffer_pos = 0; + + if(0x80 <= c && c <= 0xFF) + { + /* multi-byte UTF-8 sequence */ + int i, count; + + count = utf8_check_first(c); + if(!count) + goto out; + + assert(count >= 2); + + for(i = 1; i < count; i++) + stream->buffer[i] = stream->get(stream->data); + + if(!utf8_check_full(stream->buffer, count, NULL)) + goto out; + + stream->buffer[count] = '\0'; + } + else + stream->buffer[1] = '\0'; + } + + c = stream->buffer[stream->buffer_pos++]; + + stream->position++; + if(c == '\n') { + stream->line++; + stream->last_column = stream->column; + stream->column = 0; + } + else if(utf8_check_first(c)) { + /* track the Unicode character column, so increment only if + this is the first character of a UTF-8 sequence */ + stream->column++; + } + + return c; + +out: + stream->state = STREAM_STATE_ERROR; + error_set(error, stream_to_lex(stream), "unable to decode byte 0x%x", c); + return STREAM_STATE_ERROR; +} + +static void stream_unget(stream_t *stream, int c) +{ + if(c == STREAM_STATE_EOF || c == STREAM_STATE_ERROR) + return; + + stream->position--; + if(c == '\n') { + stream->line--; + stream->column = stream->last_column; + } + else if(utf8_check_first(c)) + stream->column--; + + assert(stream->buffer_pos > 0); + stream->buffer_pos--; + assert(stream->buffer[stream->buffer_pos] == c); +} + + +static int lex_get(lex_t *lex, json_error_t *error) +{ + return stream_get(&lex->stream, error); +} + +static void lex_save(lex_t *lex, int c) +{ + strbuffer_append_byte(&lex->saved_text, c); +} + +static int lex_get_save(lex_t *lex, json_error_t *error) +{ + int c = stream_get(&lex->stream, error); + if(c != STREAM_STATE_EOF && c != STREAM_STATE_ERROR) + lex_save(lex, c); + return c; +} + +static void lex_unget(lex_t *lex, int c) +{ + stream_unget(&lex->stream, c); +} + +static void lex_unget_unsave(lex_t *lex, int c) +{ + if(c != STREAM_STATE_EOF && c != STREAM_STATE_ERROR) { + /* Since we treat warnings as errors, when assertions are turned + * off the "d" variable would be set but never used. Which is + * treated as an error by GCC. + */ + #ifndef NDEBUG + char d; + #endif + stream_unget(&lex->stream, c); + #ifndef NDEBUG + d = + #endif + strbuffer_pop(&lex->saved_text); + assert(c == d); + } +} + +static void lex_save_cached(lex_t *lex) +{ + while(lex->stream.buffer[lex->stream.buffer_pos] != '\0') + { + lex_save(lex, lex->stream.buffer[lex->stream.buffer_pos]); + lex->stream.buffer_pos++; + lex->stream.position++; + } +} + +/* assumes that str points to 'u' plus at least 4 valid hex digits */ +static int32_t decode_unicode_escape(const char *str) +{ + int i; + int32_t value = 0; + + assert(str[0] == 'u'); + + for(i = 1; i <= 4; i++) { + char c = str[i]; + value <<= 4; + if(l_isdigit(c)) + value += c - '0'; + else if(l_islower(c)) + value += c - 'a' + 10; + else if(l_isupper(c)) + value += c - 'A' + 10; + else + assert(0); + } + + return value; +} + +static void lex_scan_string(lex_t *lex, json_error_t *error) +{ + int c; + const char *p; + char *t; + int i; + + lex->value.string = NULL; + lex->token = TOKEN_INVALID; + + c = lex_get_save(lex, error); + + while(c != '"') { + if(c == STREAM_STATE_ERROR) + goto out; + + else if(c == STREAM_STATE_EOF) { + error_set(error, lex, "premature end of input"); + goto out; + } + + else if(0 <= c && c <= 0x1F) { + /* control character */ + lex_unget_unsave(lex, c); + if(c == '\n') + error_set(error, lex, "unexpected newline", c); + else + error_set(error, lex, "control character 0x%x", c); + goto out; + } + + else if(c == '\\') { + c = lex_get_save(lex, error); + if(c == 'u') { + c = lex_get_save(lex, error); + for(i = 0; i < 4; i++) { + if(!l_isxdigit(c)) { + error_set(error, lex, "invalid escape"); + goto out; + } + c = lex_get_save(lex, error); + } + } + else if(c == '"' || c == '\\' || c == '/' || c == 'b' || + c == 'f' || c == 'n' || c == 'r' || c == 't') + c = lex_get_save(lex, error); + else { + error_set(error, lex, "invalid escape"); + goto out; + } + } + else + c = lex_get_save(lex, error); + } + + /* the actual value is at most of the same length as the source + string, because: + - shortcut escapes (e.g. "\t") (length 2) are converted to 1 byte + - a single \uXXXX escape (length 6) is converted to at most 3 bytes + - two \uXXXX escapes (length 12) forming an UTF-16 surrogate pair + are converted to 4 bytes + */ + lex->value.string = jsonp_malloc(lex->saved_text.length + 1); + if(!lex->value.string) { + /* this is not very nice, since TOKEN_INVALID is returned */ + goto out; + } + + /* the target */ + t = lex->value.string; + + /* + 1 to skip the " */ + p = strbuffer_value(&lex->saved_text) + 1; + + while(*p != '"') { + if(*p == '\\') { + p++; + if(*p == 'u') { + char buffer[4]; + int length; + int32_t value; + + value = decode_unicode_escape(p); + p += 5; + + if(0xD800 <= value && value <= 0xDBFF) { + /* surrogate pair */ + if(*p == '\\' && *(p + 1) == 'u') { + int32_t value2 = decode_unicode_escape(++p); + p += 5; + + if(0xDC00 <= value2 && value2 <= 0xDFFF) { + /* valid second surrogate */ + value = + ((value - 0xD800) << 10) + + (value2 - 0xDC00) + + 0x10000; + } + else { + /* invalid second surrogate */ + error_set(error, lex, + "invalid Unicode '\\u%04X\\u%04X'", + value, value2); + goto out; + } + } + else { + /* no second surrogate */ + error_set(error, lex, "invalid Unicode '\\u%04X'", + value); + goto out; + } + } + else if(0xDC00 <= value && value <= 0xDFFF) { + error_set(error, lex, "invalid Unicode '\\u%04X'", value); + goto out; + } + else if(value == 0) + { + error_set(error, lex, "\\u0000 is not allowed"); + goto out; + } + + if(utf8_encode(value, buffer, &length)) + assert(0); + + memcpy(t, buffer, length); + t += length; + } + else { + switch(*p) { + case '"': case '\\': case '/': + *t = *p; break; + case 'b': *t = '\b'; break; + case 'f': *t = '\f'; break; + case 'n': *t = '\n'; break; + case 'r': *t = '\r'; break; + case 't': *t = '\t'; break; + default: assert(0); + } + t++; + p++; + } + } + else + *(t++) = *(p++); + } + *t = '\0'; + lex->token = TOKEN_STRING; + return; + +out: + jsonp_free(lex->value.string); +} + +#ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ +#if JSON_INTEGER_IS_LONG_LONG +#ifdef _MSC_VER /* Microsoft Visual Studio */ +#define json_strtoint _strtoi64 +#else +#define json_strtoint strtoll +#endif +#else +#define json_strtoint strtol +#endif +#endif + +static int lex_scan_number(lex_t *lex, int c, json_error_t *error) +{ + const char *saved_text; + char *end; + double value; + + lex->token = TOKEN_INVALID; + + if(c == '-') + c = lex_get_save(lex, error); + + if(c == '0') { + c = lex_get_save(lex, error); + if(l_isdigit(c)) { + lex_unget_unsave(lex, c); + goto out; + } + } + else if(l_isdigit(c)) { + c = lex_get_save(lex, error); + while(l_isdigit(c)) + c = lex_get_save(lex, error); + } + else { + lex_unget_unsave(lex, c); + goto out; + } + + if(c != '.' && c != 'E' && c != 'e') { + json_int_t value; + + lex_unget_unsave(lex, c); + + saved_text = strbuffer_value(&lex->saved_text); + + errno = 0; + value = json_strtoint(saved_text, &end, 10); + if(errno == ERANGE) { + if(value < 0) + error_set(error, lex, "too big negative integer"); + else + error_set(error, lex, "too big integer"); + goto out; + } + + assert(end == saved_text + lex->saved_text.length); + + lex->token = TOKEN_INTEGER; + lex->value.integer = value; + return 0; + } + + if(c == '.') { + c = lex_get(lex, error); + if(!l_isdigit(c)) { + lex_unget(lex, c); + goto out; + } + lex_save(lex, c); + + c = lex_get_save(lex, error); + while(l_isdigit(c)) + c = lex_get_save(lex, error); + } + + if(c == 'E' || c == 'e') { + c = lex_get_save(lex, error); + if(c == '+' || c == '-') + c = lex_get_save(lex, error); + + if(!l_isdigit(c)) { + lex_unget_unsave(lex, c); + goto out; + } + + c = lex_get_save(lex, error); + while(l_isdigit(c)) + c = lex_get_save(lex, error); + } + + lex_unget_unsave(lex, c); + + if(jsonp_strtod(&lex->saved_text, &value)) { + error_set(error, lex, "real number overflow"); + goto out; + } + + lex->token = TOKEN_REAL; + lex->value.real = value; + return 0; + +out: + return -1; +} + +static int lex_scan(lex_t *lex, json_error_t *error) +{ + int c; + + strbuffer_clear(&lex->saved_text); + + if(lex->token == TOKEN_STRING) { + jsonp_free(lex->value.string); + lex->value.string = NULL; + } + + c = lex_get(lex, error); + while(c == ' ' || c == '\t' || c == '\n' || c == '\r') + c = lex_get(lex, error); + + if(c == STREAM_STATE_EOF) { + lex->token = TOKEN_EOF; + goto out; + } + + if(c == STREAM_STATE_ERROR) { + lex->token = TOKEN_INVALID; + goto out; + } + + lex_save(lex, c); + + if(c == '{' || c == '}' || c == '[' || c == ']' || c == ':' || c == ',') + lex->token = c; + + else if(c == '"') + lex_scan_string(lex, error); + + else if(l_isdigit(c) || c == '-') { + if(lex_scan_number(lex, c, error)) + goto out; + } + + else if(l_isalpha(c)) { + /* eat up the whole identifier for clearer error messages */ + const char *saved_text; + + c = lex_get_save(lex, error); + while(l_isalpha(c)) + c = lex_get_save(lex, error); + lex_unget_unsave(lex, c); + + saved_text = strbuffer_value(&lex->saved_text); + + if(strcmp(saved_text, "true") == 0) + lex->token = TOKEN_TRUE; + else if(strcmp(saved_text, "false") == 0) + lex->token = TOKEN_FALSE; + else if(strcmp(saved_text, "null") == 0) + lex->token = TOKEN_NULL; + else + lex->token = TOKEN_INVALID; + } + + else { + /* save the rest of the input UTF-8 sequence to get an error + message of valid UTF-8 */ + lex_save_cached(lex); + lex->token = TOKEN_INVALID; + } + +out: + return lex->token; +} + +static char *lex_steal_string(lex_t *lex) +{ + char *result = NULL; + if(lex->token == TOKEN_STRING) + { + result = lex->value.string; + lex->value.string = NULL; + } + return result; +} + +static int lex_init(lex_t *lex, get_func get, void *data) +{ + stream_init(&lex->stream, get, data); + if(strbuffer_init(&lex->saved_text)) + return -1; + + lex->token = TOKEN_INVALID; + return 0; +} + +static void lex_close(lex_t *lex) +{ + if(lex->token == TOKEN_STRING) + jsonp_free(lex->value.string); + strbuffer_close(&lex->saved_text); +} + + +/*** parser ***/ + +static json_t *parse_value(lex_t *lex, size_t flags, json_error_t *error); + +static json_t *parse_object(lex_t *lex, size_t flags, json_error_t *error) +{ + json_t *object = json_object(); + if(!object) + return NULL; + + lex_scan(lex, error); + if(lex->token == '}') + return object; + + while(1) { + char *key; + json_t *value; + + if(lex->token != TOKEN_STRING) { + error_set(error, lex, "string or '}' expected"); + goto error; + } + + key = lex_steal_string(lex); + if(!key) + return NULL; + + if(flags & JSON_REJECT_DUPLICATES) { + if(json_object_get(object, key)) { + jsonp_free(key); + error_set(error, lex, "duplicate object key"); + goto error; + } + } + + lex_scan(lex, error); + if(lex->token != ':') { + jsonp_free(key); + error_set(error, lex, "':' expected"); + goto error; + } + + lex_scan(lex, error); + value = parse_value(lex, flags, error); + if(!value) { + jsonp_free(key); + goto error; + } + + if(json_object_set_nocheck(object, key, value)) { + jsonp_free(key); + json_decref(value); + goto error; + } + + json_decref(value); + jsonp_free(key); + + lex_scan(lex, error); + if(lex->token != ',') + break; + + lex_scan(lex, error); + } + + if(lex->token != '}') { + error_set(error, lex, "'}' expected"); + goto error; + } + + return object; + +error: + json_decref(object); + return NULL; +} + +static json_t *parse_array(lex_t *lex, size_t flags, json_error_t *error) +{ + json_t *array = json_array(); + if(!array) + return NULL; + + lex_scan(lex, error); + if(lex->token == ']') + return array; + + while(lex->token) { + json_t *elem = parse_value(lex, flags, error); + if(!elem) + goto error; + + if(json_array_append(array, elem)) { + json_decref(elem); + goto error; + } + json_decref(elem); + + lex_scan(lex, error); + if(lex->token != ',') + break; + + lex_scan(lex, error); + } + + if(lex->token != ']') { + error_set(error, lex, "']' expected"); + goto error; + } + + return array; + +error: + json_decref(array); + return NULL; +} + +static json_t *parse_value(lex_t *lex, size_t flags, json_error_t *error) +{ + json_t *json; + double value; + + switch(lex->token) { + case TOKEN_STRING: { + json = json_string_nocheck(lex->value.string); + break; + } + + case TOKEN_INTEGER: { + if (flags & JSON_DECODE_INT_AS_REAL) { + if(jsonp_strtod(&lex->saved_text, &value)) { + error_set(error, lex, "real number overflow"); + return NULL; + } + json = json_real(value); + } else { + json = json_integer(lex->value.integer); + } + break; + } + + case TOKEN_REAL: { + json = json_real(lex->value.real); + break; + } + + case TOKEN_TRUE: + json = json_true(); + break; + + case TOKEN_FALSE: + json = json_false(); + break; + + case TOKEN_NULL: + json = json_null(); + break; + + case '{': + json = parse_object(lex, flags, error); + break; + + case '[': + json = parse_array(lex, flags, error); + break; + + case TOKEN_INVALID: + error_set(error, lex, "invalid token"); + return NULL; + + default: + error_set(error, lex, "unexpected token"); + return NULL; + } + + if(!json) + return NULL; + + return json; +} + +static json_t *parse_json(lex_t *lex, size_t flags, json_error_t *error) +{ + json_t *result; + + lex_scan(lex, error); + if(!(flags & JSON_DECODE_ANY)) { + if(lex->token != '[' && lex->token != '{') { + error_set(error, lex, "'[' or '{' expected"); + return NULL; + } + } + + result = parse_value(lex, flags, error); + if(!result) + return NULL; + + if(!(flags & JSON_DISABLE_EOF_CHECK)) { + lex_scan(lex, error); + if(lex->token != TOKEN_EOF) { + error_set(error, lex, "end of file expected"); + json_decref(result); + return NULL; + } + } + + if(error) { + /* Save the position even though there was no error */ + error->position = lex->stream.position; + } + + return result; +} + +typedef struct +{ + const char *data; + int pos; +} string_data_t; + +static int string_get(void *data) +{ + char c; + string_data_t *stream = (string_data_t *)data; + c = stream->data[stream->pos]; + if(c == '\0') + return EOF; + else + { + stream->pos++; + return (unsigned char)c; + } +} + +json_t *json_loads(const char *string, size_t flags, json_error_t *error) +{ + lex_t lex; + json_t *result; + string_data_t stream_data; + + jsonp_error_init(error, ""); + + if (string == NULL) { + error_set(error, NULL, "wrong arguments"); + return NULL; + } + + stream_data.data = string; + stream_data.pos = 0; + + if(lex_init(&lex, string_get, (void *)&stream_data)) + return NULL; + + result = parse_json(&lex, flags, error); + + lex_close(&lex); + return result; +} + +typedef struct +{ + const char *data; + size_t len; + size_t pos; +} buffer_data_t; + +static int buffer_get(void *data) +{ + char c; + buffer_data_t *stream = data; + if(stream->pos >= stream->len) + return EOF; + + c = stream->data[stream->pos]; + stream->pos++; + return (unsigned char)c; +} + +json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error) +{ + lex_t lex; + json_t *result; + buffer_data_t stream_data; + + jsonp_error_init(error, ""); + + if (buffer == NULL) { + error_set(error, NULL, "wrong arguments"); + return NULL; + } + + stream_data.data = buffer; + stream_data.pos = 0; + stream_data.len = buflen; + + if(lex_init(&lex, buffer_get, (void *)&stream_data)) + return NULL; + + result = parse_json(&lex, flags, error); + + lex_close(&lex); + return result; +} + +json_t *json_loadf(FILE *input, size_t flags, json_error_t *error) +{ + lex_t lex; + const char *source; + json_t *result; + + if(input == stdin) + source = ""; + else + source = ""; + + jsonp_error_init(error, source); + + if (input == NULL) { + error_set(error, NULL, "wrong arguments"); + return NULL; + } + + if(lex_init(&lex, (get_func)fgetc, input)) + return NULL; + + result = parse_json(&lex, flags, error); + + lex_close(&lex); + return result; +} + +json_t *json_load_file(const char *path, size_t flags, json_error_t *error) +{ + json_t *result; + FILE *fp; + + jsonp_error_init(error, path); + + if (path == NULL) { + error_set(error, NULL, "wrong arguments"); + return NULL; + } + + fp = fopen(path, "rb"); + if(!fp) + { + error_set(error, NULL, "unable to open %s: %s", + path, strerror(errno)); + return NULL; + } + + result = json_loadf(fp, flags, error); + + fclose(fp); + return result; +} + +#define MAX_BUF_LEN 1024 + +typedef struct +{ + char data[MAX_BUF_LEN]; + size_t len; + size_t pos; + json_load_callback_t callback; + void *arg; +} callback_data_t; + +static int callback_get(void *data) +{ + char c; + callback_data_t *stream = data; + + if(stream->pos >= stream->len) { + stream->pos = 0; + stream->len = stream->callback(stream->data, MAX_BUF_LEN, stream->arg); + if(stream->len == 0 || stream->len == (size_t)-1) + return EOF; + } + + c = stream->data[stream->pos]; + stream->pos++; + return (unsigned char)c; +} + +json_t *json_load_callback(json_load_callback_t callback, void *arg, size_t flags, json_error_t *error) +{ + lex_t lex; + json_t *result; + + callback_data_t stream_data; + + memset(&stream_data, 0, sizeof(stream_data)); + stream_data.callback = callback; + stream_data.arg = arg; + + jsonp_error_init(error, ""); + + if (callback == NULL) { + error_set(error, NULL, "wrong arguments"); + return NULL; + } + + if(lex_init(&lex, (get_func)callback_get, &stream_data)) + return NULL; + + result = parse_json(&lex, flags, error); + + lex_close(&lex); + return result; +} diff --git a/compat/jansson/memory.c b/compat/jansson/memory.c new file mode 100644 index 0000000..eb6cec5 --- /dev/null +++ b/compat/jansson/memory.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * Copyright (c) 2011-2012 Basile Starynkevitch + * + * Jansson is free software; you can redistribute it and/or modify it + * under the terms of the MIT license. See LICENSE for details. + */ + +#include +#include + +#include "jansson.h" +#include "jansson_private.h" + +/* memory function pointers */ +static json_malloc_t do_malloc = malloc; +static json_free_t do_free = free; + +void *jsonp_malloc(size_t size) +{ + if(!size) + return NULL; + + return (*do_malloc)(size); +} + +void jsonp_free(void *ptr) +{ + if(!ptr) + return; + + (*do_free)(ptr); +} + +char *jsonp_strdup(const char *str) +{ + char *new_str; + size_t len; + + len = strlen(str); + if(len == (size_t)-1) + return NULL; + + new_str = jsonp_malloc(len + 1); + if(!new_str) + return NULL; + + memcpy(new_str, str, len + 1); + return new_str; +} + +void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn) +{ + do_malloc = malloc_fn; + do_free = free_fn; +} diff --git a/compat/jansson/pack_unpack.c b/compat/jansson/pack_unpack.c new file mode 100644 index 0000000..0d932f7 --- /dev/null +++ b/compat/jansson/pack_unpack.c @@ -0,0 +1,762 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * Copyright (c) 2011-2012 Graeme Smecher + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#include +#include "jansson.h" +#include "jansson_private.h" +#include "utf.h" + +typedef struct { + int line; + int column; + size_t pos; + char token; +} token_t; + +typedef struct { + const char *start; + const char *fmt; + token_t prev_token; + token_t token; + token_t next_token; + json_error_t *error; + size_t flags; + int line; + int column; + size_t pos; +} scanner_t; + +#define token(scanner) ((scanner)->token.token) + +static const char * const type_names[] = { + "object", + "array", + "string", + "integer", + "real", + "true", + "false", + "null" +}; + +#define type_name(x) type_names[json_typeof(x)] + +static const char unpack_value_starters[] = "{[siIbfFOon"; + + +static void scanner_init(scanner_t *s, json_error_t *error, + size_t flags, const char *fmt) +{ + s->error = error; + s->flags = flags; + s->fmt = s->start = fmt; + memset(&s->prev_token, 0, sizeof(token_t)); + memset(&s->token, 0, sizeof(token_t)); + memset(&s->next_token, 0, sizeof(token_t)); + s->line = 1; + s->column = 0; + s->pos = 0; +} + +static void next_token(scanner_t *s) +{ + const char *t; + s->prev_token = s->token; + + if(s->next_token.line) { + s->token = s->next_token; + s->next_token.line = 0; + return; + } + + t = s->fmt; + s->column++; + s->pos++; + + /* skip space and ignored chars */ + while(*t == ' ' || *t == '\t' || *t == '\n' || *t == ',' || *t == ':') { + if(*t == '\n') { + s->line++; + s->column = 1; + } + else + s->column++; + + s->pos++; + t++; + } + + s->token.token = *t; + s->token.line = s->line; + s->token.column = s->column; + s->token.pos = s->pos; + + t++; + s->fmt = t; +} + +static void prev_token(scanner_t *s) +{ + s->next_token = s->token; + s->token = s->prev_token; +} + +static void set_error(scanner_t *s, const char *source, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + + jsonp_error_vset(s->error, s->token.line, s->token.column, s->token.pos, + fmt, ap); + + jsonp_error_set_source(s->error, source); + + va_end(ap); +} + +static json_t *pack(scanner_t *s, va_list *ap); + + +/* ours will be set to 1 if jsonp_free() must be called for the result + afterwards */ +static char *read_string(scanner_t *s, va_list *ap, + const char *purpose, int *ours) +{ + char t; + strbuffer_t strbuff; + const char *str; + size_t length; + char *result; + + next_token(s); + t = token(s); + prev_token(s); + + if(t != '#' && t != '+') { + /* Optimize the simple case */ + str = va_arg(*ap, const char *); + + if(!str) { + set_error(s, "", "NULL string argument"); + return NULL; + } + + if(!utf8_check_string(str, -1)) { + set_error(s, "", "Invalid UTF-8 %s", purpose); + return NULL; + } + + *ours = 0; + return (char *)str; + } + + strbuffer_init(&strbuff); + + while(1) { + str = va_arg(*ap, const char *); + if(!str) { + set_error(s, "", "NULL string argument"); + strbuffer_close(&strbuff); + return NULL; + } + + next_token(s); + + if(token(s) == '#') { + length = va_arg(*ap, int); + } + else { + prev_token(s); + length = strlen(str); + } + + if(strbuffer_append_bytes(&strbuff, str, length) == -1) { + set_error(s, "", "Out of memory"); + strbuffer_close(&strbuff); + return NULL; + } + + next_token(s); + if(token(s) != '+') { + prev_token(s); + break; + } + } + + result = strbuffer_steal_value(&strbuff); + + if(!utf8_check_string(result, -1)) { + set_error(s, "", "Invalid UTF-8 %s", purpose); + return NULL; + } + + *ours = 1; + return result; +} + +static json_t *pack_object(scanner_t *s, va_list *ap) +{ + json_t *object = json_object(); + next_token(s); + + while(token(s) != '}') { + char *key; + int ours; + json_t *value; + + if(!token(s)) { + set_error(s, "", "Unexpected end of format string"); + goto error; + } + + if(token(s) != 's') { + set_error(s, "", "Expected format 's', got '%c'", token(s)); + goto error; + } + + key = read_string(s, ap, "object key", &ours); + if(!key) + goto error; + + next_token(s); + + value = pack(s, ap); + if(!value) + goto error; + + if(json_object_set_new_nocheck(object, key, value)) { + if(ours) + jsonp_free(key); + + set_error(s, "", "Unable to add key \"%s\"", key); + goto error; + } + + if(ours) + jsonp_free(key); + + next_token(s); + } + + return object; + +error: + json_decref(object); + return NULL; +} + +static json_t *pack_array(scanner_t *s, va_list *ap) +{ + json_t *array = json_array(); + next_token(s); + + while(token(s) != ']') { + json_t *value; + + if(!token(s)) { + set_error(s, "", "Unexpected end of format string"); + goto error; + } + + value = pack(s, ap); + if(!value) + goto error; + + if(json_array_append_new(array, value)) { + set_error(s, "", "Unable to append to array"); + goto error; + } + + next_token(s); + } + return array; + +error: + json_decref(array); + return NULL; +} + +static json_t *pack(scanner_t *s, va_list *ap) +{ + switch(token(s)) { + case '{': + return pack_object(s, ap); + + case '[': + return pack_array(s, ap); + + case 's': { /* string */ + char *str; + int ours; + json_t *result; + + str = read_string(s, ap, "string", &ours); + if(!str) + return NULL; + + result = json_string_nocheck(str); + if(ours) + jsonp_free(str); + + return result; + } + + case 'n': /* null */ + return json_null(); + + case 'b': /* boolean */ + return va_arg(*ap, int) ? json_true() : json_false(); + + case 'i': /* integer from int */ + return json_integer(va_arg(*ap, int)); + + case 'I': /* integer from json_int_t */ + return json_integer(va_arg(*ap, json_int_t)); + + case 'f': /* real */ + return json_real(va_arg(*ap, double)); + + case 'O': /* a json_t object; increments refcount */ + return json_incref(va_arg(*ap, json_t *)); + + case 'o': /* a json_t object; doesn't increment refcount */ + return va_arg(*ap, json_t *); + + default: + set_error(s, "", "Unexpected format character '%c'", + token(s)); + return NULL; + } +} + +static int unpack(scanner_t *s, json_t *root, va_list *ap); + +static int unpack_object(scanner_t *s, json_t *root, va_list *ap) +{ + int ret = -1; + int strict = 0; + + /* Use a set (emulated by a hashtable) to check that all object + keys are accessed. Checking that the correct number of keys + were accessed is not enough, as the same key can be unpacked + multiple times. + */ + hashtable_t key_set; + + if(hashtable_init(&key_set)) { + set_error(s, "", "Out of memory"); + return -1; + } + + if(root && !json_is_object(root)) { + set_error(s, "", "Expected object, got %s", + type_name(root)); + goto out; + } + next_token(s); + + while(token(s) != '}') { + const char *key; + json_t *value; + int opt = 0; + + if(strict != 0) { + set_error(s, "", "Expected '}' after '%c', got '%c'", + (strict == 1 ? '!' : '*'), token(s)); + goto out; + } + + if(!token(s)) { + set_error(s, "", "Unexpected end of format string"); + goto out; + } + + if(token(s) == '!' || token(s) == '*') { + strict = (token(s) == '!' ? 1 : -1); + next_token(s); + continue; + } + + if(token(s) != 's') { + set_error(s, "", "Expected format 's', got '%c'", token(s)); + goto out; + } + + key = va_arg(*ap, const char *); + if(!key) { + set_error(s, "", "NULL object key"); + goto out; + } + + next_token(s); + + if(token(s) == '?') { + opt = 1; + next_token(s); + } + + if(!root) { + /* skipping */ + value = NULL; + } + else { + value = json_object_get(root, key); + if(!value && !opt) { + set_error(s, "", "Object item not found: %s", key); + goto out; + } + } + + if(unpack(s, value, ap)) + goto out; + + hashtable_set(&key_set, key, 0, json_null()); + next_token(s); + } + + if(strict == 0 && (s->flags & JSON_STRICT)) + strict = 1; + + if(root && strict == 1 && key_set.size != json_object_size(root)) { + long diff = (long)json_object_size(root) - (long)key_set.size; + set_error(s, "", "%li object item(s) left unpacked", diff); + goto out; + } + + ret = 0; + +out: + hashtable_close(&key_set); + return ret; +} + +static int unpack_array(scanner_t *s, json_t *root, va_list *ap) +{ + size_t i = 0; + int strict = 0; + + if(root && !json_is_array(root)) { + set_error(s, "", "Expected array, got %s", type_name(root)); + return -1; + } + next_token(s); + + while(token(s) != ']') { + json_t *value; + + if(strict != 0) { + set_error(s, "", "Expected ']' after '%c', got '%c'", + (strict == 1 ? '!' : '*'), + token(s)); + return -1; + } + + if(!token(s)) { + set_error(s, "", "Unexpected end of format string"); + return -1; + } + + if(token(s) == '!' || token(s) == '*') { + strict = (token(s) == '!' ? 1 : -1); + next_token(s); + continue; + } + + if(!strchr(unpack_value_starters, token(s))) { + set_error(s, "", "Unexpected format character '%c'", + token(s)); + return -1; + } + + if(!root) { + /* skipping */ + value = NULL; + } + else { + value = json_array_get(root, i); + if(!value) { + set_error(s, "", "Array index %lu out of range", + (unsigned long)i); + return -1; + } + } + + if(unpack(s, value, ap)) + return -1; + + next_token(s); + i++; + } + + if(strict == 0 && (s->flags & JSON_STRICT)) + strict = 1; + + if(root && strict == 1 && i != json_array_size(root)) { + long diff = (long)json_array_size(root) - (long)i; + set_error(s, "", "%li array item(s) left unpacked", diff); + return -1; + } + + return 0; +} + +static int unpack(scanner_t *s, json_t *root, va_list *ap) +{ + switch(token(s)) + { + case '{': + return unpack_object(s, root, ap); + + case '[': + return unpack_array(s, root, ap); + + case 's': + if(root && !json_is_string(root)) { + set_error(s, "", "Expected string, got %s", + type_name(root)); + return -1; + } + + if(!(s->flags & JSON_VALIDATE_ONLY)) { + const char **target; + + target = va_arg(*ap, const char **); + if(!target) { + set_error(s, "", "NULL string argument"); + return -1; + } + + if(root) + *target = json_string_value(root); + } + return 0; + + case 'i': + if(root && !json_is_integer(root)) { + set_error(s, "", "Expected integer, got %s", + type_name(root)); + return -1; + } + + if(!(s->flags & JSON_VALIDATE_ONLY)) { + int *target = va_arg(*ap, int*); + if(root) + *target = (int)json_integer_value(root); + } + + return 0; + + case 'I': + if(root && !json_is_integer(root)) { + set_error(s, "", "Expected integer, got %s", + type_name(root)); + return -1; + } + + if(!(s->flags & JSON_VALIDATE_ONLY)) { + json_int_t *target = va_arg(*ap, json_int_t*); + if(root) + *target = json_integer_value(root); + } + + return 0; + + case 'b': + if(root && !json_is_boolean(root)) { + set_error(s, "", "Expected true or false, got %s", + type_name(root)); + return -1; + } + + if(!(s->flags & JSON_VALIDATE_ONLY)) { + int *target = va_arg(*ap, int*); + if(root) + *target = json_is_true(root); + } + + return 0; + + case 'f': + if(root && !json_is_real(root)) { + set_error(s, "", "Expected real, got %s", + type_name(root)); + return -1; + } + + if(!(s->flags & JSON_VALIDATE_ONLY)) { + double *target = va_arg(*ap, double*); + if(root) + *target = json_real_value(root); + } + + return 0; + + case 'F': + if(root && !json_is_number(root)) { + set_error(s, "", "Expected real or integer, got %s", + type_name(root)); + return -1; + } + + if(!(s->flags & JSON_VALIDATE_ONLY)) { + double *target = va_arg(*ap, double*); + if(root) + *target = json_number_value(root); + } + + return 0; + + case 'O': + if(root && !(s->flags & JSON_VALIDATE_ONLY)) + json_incref(root); + /* Fall through */ + + case 'o': + if(!(s->flags & JSON_VALIDATE_ONLY)) { + json_t **target = va_arg(*ap, json_t**); + if(root) + *target = root; + } + + return 0; + + case 'n': + /* Never assign, just validate */ + if(root && !json_is_null(root)) { + set_error(s, "", "Expected null, got %s", + type_name(root)); + return -1; + } + return 0; + + default: + set_error(s, "", "Unexpected format character '%c'", + token(s)); + return -1; + } +} + +json_t *json_vpack_ex(json_error_t *error, size_t flags, + const char *fmt, va_list ap) +{ + scanner_t s; + va_list ap_copy; + json_t *value; + + if(!fmt || !*fmt) { + jsonp_error_init(error, ""); + jsonp_error_set(error, -1, -1, 0, "NULL or empty format string"); + return NULL; + } + jsonp_error_init(error, NULL); + + scanner_init(&s, error, flags, fmt); + next_token(&s); + + va_copy(ap_copy, ap); + value = pack(&s, &ap_copy); + va_end(ap_copy); + + if(!value) + return NULL; + + next_token(&s); + if(token(&s)) { + json_decref(value); + set_error(&s, "", "Garbage after format string"); + return NULL; + } + + return value; +} + +json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...) +{ + json_t *value; + va_list ap; + + va_start(ap, fmt); + value = json_vpack_ex(error, flags, fmt, ap); + va_end(ap); + + return value; +} + +json_t *json_pack(const char *fmt, ...) +{ + json_t *value; + va_list ap; + + va_start(ap, fmt); + value = json_vpack_ex(NULL, 0, fmt, ap); + va_end(ap); + + return value; +} + +int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, + const char *fmt, va_list ap) +{ + scanner_t s; + va_list ap_copy; + + if(!root) { + jsonp_error_init(error, ""); + jsonp_error_set(error, -1, -1, 0, "NULL root value"); + return -1; + } + + if(!fmt || !*fmt) { + jsonp_error_init(error, ""); + jsonp_error_set(error, -1, -1, 0, "NULL or empty format string"); + return -1; + } + jsonp_error_init(error, NULL); + + scanner_init(&s, error, flags, fmt); + next_token(&s); + + va_copy(ap_copy, ap); + if(unpack(&s, root, &ap_copy)) { + va_end(ap_copy); + return -1; + } + va_end(ap_copy); + + next_token(&s); + if(token(&s)) { + set_error(&s, "", "Garbage after format string"); + return -1; + } + + return 0; +} + +int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = json_vunpack_ex(root, error, flags, fmt, ap); + va_end(ap); + + return ret; +} + +int json_unpack(json_t *root, const char *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = json_vunpack_ex(root, NULL, 0, fmt, ap); + va_end(ap); + + return ret; +} diff --git a/compat/jansson/strbuffer.c b/compat/jansson/strbuffer.c new file mode 100644 index 0000000..2d6ff31 --- /dev/null +++ b/compat/jansson/strbuffer.c @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include +#include +#include "jansson_private.h" +#include "strbuffer.h" + +#define STRBUFFER_MIN_SIZE 16 +#define STRBUFFER_FACTOR 2 +#define STRBUFFER_SIZE_MAX ((size_t)-1) + +int strbuffer_init(strbuffer_t *strbuff) +{ + strbuff->size = STRBUFFER_MIN_SIZE; + strbuff->length = 0; + + strbuff->value = jsonp_malloc(strbuff->size); + if(!strbuff->value) + return -1; + + /* initialize to empty */ + strbuff->value[0] = '\0'; + return 0; +} + +void strbuffer_close(strbuffer_t *strbuff) +{ + if(strbuff->value) + jsonp_free(strbuff->value); + + strbuff->size = 0; + strbuff->length = 0; + strbuff->value = NULL; +} + +void strbuffer_clear(strbuffer_t *strbuff) +{ + strbuff->length = 0; + strbuff->value[0] = '\0'; +} + +const char *strbuffer_value(const strbuffer_t *strbuff) +{ + return strbuff->value; +} + +char *strbuffer_steal_value(strbuffer_t *strbuff) +{ + char *result = strbuff->value; + strbuff->value = NULL; + return result; +} + +int strbuffer_append(strbuffer_t *strbuff, const char *string) +{ + return strbuffer_append_bytes(strbuff, string, strlen(string)); +} + +int strbuffer_append_byte(strbuffer_t *strbuff, char byte) +{ + return strbuffer_append_bytes(strbuff, &byte, 1); +} + +int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size) +{ + if(size >= strbuff->size - strbuff->length) + { + size_t new_size; + char *new_value; + + /* avoid integer overflow */ + if (strbuff->size > STRBUFFER_SIZE_MAX / STRBUFFER_FACTOR + || size > STRBUFFER_SIZE_MAX - 1 + || strbuff->length > STRBUFFER_SIZE_MAX - 1 - size) + return -1; + + new_size = max(strbuff->size * STRBUFFER_FACTOR, + strbuff->length + size + 1); + + new_value = jsonp_malloc(new_size); + if(!new_value) + return -1; + + memcpy(new_value, strbuff->value, strbuff->length); + + jsonp_free(strbuff->value); + strbuff->value = new_value; + strbuff->size = new_size; + } + + memcpy(strbuff->value + strbuff->length, data, size); + strbuff->length += size; + strbuff->value[strbuff->length] = '\0'; + + return 0; +} + +char strbuffer_pop(strbuffer_t *strbuff) +{ + if(strbuff->length > 0) { + char c = strbuff->value[--strbuff->length]; + strbuff->value[strbuff->length] = '\0'; + return c; + } + else + return '\0'; +} diff --git a/compat/jansson/strbuffer.h b/compat/jansson/strbuffer.h new file mode 100644 index 0000000..06fd065 --- /dev/null +++ b/compat/jansson/strbuffer.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef STRBUFFER_H +#define STRBUFFER_H + +typedef struct { + char *value; + size_t length; /* bytes used */ + size_t size; /* bytes allocated */ +} strbuffer_t; + +int strbuffer_init(strbuffer_t *strbuff); +void strbuffer_close(strbuffer_t *strbuff); + +void strbuffer_clear(strbuffer_t *strbuff); + +const char *strbuffer_value(const strbuffer_t *strbuff); + +/* Steal the value and close the strbuffer */ +char *strbuffer_steal_value(strbuffer_t *strbuff); + +int strbuffer_append(strbuffer_t *strbuff, const char *string); +int strbuffer_append_byte(strbuffer_t *strbuff, char byte); +int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size); + +char strbuffer_pop(strbuffer_t *strbuff); + +#endif diff --git a/compat/jansson/strconv.c b/compat/jansson/strconv.c new file mode 100644 index 0000000..1c2472e --- /dev/null +++ b/compat/jansson/strconv.c @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include "jansson_private.h" +#include "strbuffer.h" + +/* need jansson_private_config.h to get the correct snprintf */ +#ifdef HAVE_CONFIG_H +#include "jansson_private_config.h" +#endif + +#if JSON_HAVE_LOCALECONV +#include + +/* + - This code assumes that the decimal separator is exactly one + character. + + - If setlocale() is called by another thread between the call to + localeconv() and the call to sprintf() or strtod(), the result may + be wrong. setlocale() is not thread-safe and should not be used + this way. Multi-threaded programs should use uselocale() instead. +*/ + +static void to_locale(strbuffer_t *strbuffer) +{ + const char *point; + char *pos; + + point = localeconv()->decimal_point; + if(*point == '.') { + /* No conversion needed */ + return; + } + + pos = strchr(strbuffer->value, '.'); + if(pos) + *pos = *point; +} + +static void from_locale(char *buffer) +{ + const char *point; + char *pos; + + point = localeconv()->decimal_point; + if(*point == '.') { + /* No conversion needed */ + return; + } + + pos = strchr(buffer, *point); + if(pos) + *pos = '.'; +} +#endif + +int jsonp_strtod(strbuffer_t *strbuffer, double *out) +{ + double value; + char *end; + +#if JSON_HAVE_LOCALECONV + to_locale(strbuffer); +#endif + + errno = 0; + value = strtod(strbuffer->value, &end); + assert(end == strbuffer->value + strbuffer->length); + + if(errno == ERANGE && value != 0) { + /* Overflow */ + return -1; + } + + *out = value; + return 0; +} + +int jsonp_dtostr(char *buffer, size_t size, double value) +{ + int ret; + char *start, *end; + size_t length; + + ret = snprintf(buffer, size, "%.17g", value); + if(ret < 0) + return -1; + + length = (size_t)ret; + if(length >= size) + return -1; + +#if JSON_HAVE_LOCALECONV + from_locale(buffer); +#endif + + /* Make sure there's a dot or 'e' in the output. Otherwise + a real is converted to an integer when decoding */ + if(strchr(buffer, '.') == NULL && + strchr(buffer, 'e') == NULL) + { + if(length + 3 >= size) { + /* No space to append ".0" */ + return -1; + } + buffer[length] = '.'; + buffer[length + 1] = '0'; + buffer[length + 2] = '\0'; + length += 2; + } + + /* Remove leading '+' from positive exponent. Also remove leading + zeros from exponents (added by some printf() implementations) */ + start = strchr(buffer, 'e'); + if(start) { + start++; + end = start + 1; + + if(*start == '-') + start++; + + while(*end == '0') + end++; + + if(end != start) { + memmove(start, end, length - (size_t)(end - buffer)); + length -= (size_t)(end - start); + } + } + + return (int)length; +} diff --git a/compat/jansson/utf.c b/compat/jansson/utf.c new file mode 100644 index 0000000..65b849b --- /dev/null +++ b/compat/jansson/utf.c @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#include +#include "utf.h" + +int utf8_encode(int32_t codepoint, char *buffer, int *size) +{ + if(codepoint < 0) + return -1; + else if(codepoint < 0x80) + { + buffer[0] = (char)codepoint; + *size = 1; + } + else if(codepoint < 0x800) + { + buffer[0] = 0xC0 + ((codepoint & 0x7C0) >> 6); + buffer[1] = 0x80 + ((codepoint & 0x03F)); + *size = 2; + } + else if(codepoint < 0x10000) + { + buffer[0] = 0xE0 + ((codepoint & 0xF000) >> 12); + buffer[1] = 0x80 + ((codepoint & 0x0FC0) >> 6); + buffer[2] = 0x80 + ((codepoint & 0x003F)); + *size = 3; + } + else if(codepoint <= 0x10FFFF) + { + buffer[0] = 0xF0 + ((codepoint & 0x1C0000) >> 18); + buffer[1] = 0x80 + ((codepoint & 0x03F000) >> 12); + buffer[2] = 0x80 + ((codepoint & 0x000FC0) >> 6); + buffer[3] = 0x80 + ((codepoint & 0x00003F)); + *size = 4; + } + else + return -1; + + return 0; +} + +int utf8_check_first(char byte) +{ + unsigned char u = (unsigned char)byte; + + if(u < 0x80) + return 1; + + if(0x80 <= u && u <= 0xBF) { + /* second, third or fourth byte of a multi-byte + sequence, i.e. a "continuation byte" */ + return 0; + } + else if(u == 0xC0 || u == 0xC1) { + /* overlong encoding of an ASCII byte */ + return 0; + } + else if(0xC2 <= u && u <= 0xDF) { + /* 2-byte sequence */ + return 2; + } + + else if(0xE0 <= u && u <= 0xEF) { + /* 3-byte sequence */ + return 3; + } + else if(0xF0 <= u && u <= 0xF4) { + /* 4-byte sequence */ + return 4; + } + else { /* u >= 0xF5 */ + /* Restricted (start of 4-, 5- or 6-byte sequence) or invalid + UTF-8 */ + return 0; + } +} + +int utf8_check_full(const char *buffer, int size, int32_t *codepoint) +{ + int i; + int32_t value = 0; + unsigned char u = (unsigned char)buffer[0]; + + if(size == 2) + { + value = u & 0x1F; + } + else if(size == 3) + { + value = u & 0xF; + } + else if(size == 4) + { + value = u & 0x7; + } + else + return 0; + + for(i = 1; i < size; i++) + { + u = (unsigned char)buffer[i]; + + if(u < 0x80 || u > 0xBF) { + /* not a continuation byte */ + return 0; + } + + value = (value << 6) + (u & 0x3F); + } + + if(value > 0x10FFFF) { + /* not in Unicode range */ + return 0; + } + + else if(0xD800 <= value && value <= 0xDFFF) { + /* invalid code point (UTF-16 surrogate halves) */ + return 0; + } + + else if((size == 2 && value < 0x80) || + (size == 3 && value < 0x800) || + (size == 4 && value < 0x10000)) { + /* overlong encoding */ + return 0; + } + + if(codepoint) + *codepoint = value; + + return 1; +} + +const char *utf8_iterate(const char *buffer, int32_t *codepoint) +{ + int count; + int32_t value; + + if(!*buffer) + return buffer; + + count = utf8_check_first(buffer[0]); + if(count <= 0) + return NULL; + + if(count == 1) + value = (unsigned char)buffer[0]; + else + { + if(!utf8_check_full(buffer, count, &value)) + return NULL; + } + + if(codepoint) + *codepoint = value; + + return buffer + count; +} + +int utf8_check_string(const char *string, int length) +{ + int i; + + if(length == -1) + length = strlen(string); + + for(i = 0; i < length; i++) + { + int count = utf8_check_first(string[i]); + if(count == 0) + return 0; + else if(count > 1) + { + if(i + count > length) + return 0; + + if(!utf8_check_full(&string[i], count, NULL)) + return 0; + + i += count - 1; + } + } + + return 1; +} diff --git a/compat/jansson/utf.h b/compat/jansson/utf.h new file mode 100644 index 0000000..9047c6e --- /dev/null +++ b/compat/jansson/utf.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef UTF_H +#define UTF_H + +#ifdef HAVE_CONFIG_H +#include "jansson_private_config.h" + +#ifdef HAVE_INTTYPES_H +/* inttypes.h includes stdint.h in a standard environment, so there's +no need to include stdint.h separately. If inttypes.h doesn't define +int32_t, it's defined in config.h. */ +#include +#endif /* HAVE_INTTYPES_H */ + +#else /* !HAVE_CONFIG_H */ +#ifdef _WIN32 +typedef int int32_t; +#else /* !_WIN32 */ +/* Assume a standard environment */ +#include +#endif /* _WIN32 */ + +#endif /* HAVE_CONFIG_H */ + +int utf8_encode(int codepoint, char *buffer, int *size); + +int utf8_check_first(char byte); +int utf8_check_full(const char *buffer, int size, int32_t *codepoint); +const char *utf8_iterate(const char *buffer, int32_t *codepoint); + +int utf8_check_string(const char *string, int length); + +#endif diff --git a/compat/jansson/util.h b/compat/jansson/util.h new file mode 100644 index 0000000..c4f033a --- /dev/null +++ b/compat/jansson/util.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2009, 2010 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef UTIL_H +#define UTIL_H + +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + +#endif diff --git a/compat/jansson/value.c b/compat/jansson/value.c new file mode 100644 index 0000000..582849b --- /dev/null +++ b/compat/jansson/value.c @@ -0,0 +1,950 @@ +/* + * Copyright (c) 2009-2013 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include +#include +#include +#include + +#include "jansson.h" +#include "hashtable.h" +#include "jansson_private.h" +#include "utf.h" + +/* Work around nonstandard isnan() and isinf() implementations */ +#ifndef isnan +static JSON_INLINE int isnan(double x) { return x != x; } +#endif +#ifndef isinf +static JSON_INLINE int isinf(double x) { return !isnan(x) && isnan(x - x); } +#endif + +static JSON_INLINE void json_init(json_t *json, json_type type) +{ + json->type = type; + json->refcount = 1; +} + + +/*** object ***/ + +json_t *json_object(void) +{ + json_object_t *object = jsonp_malloc(sizeof(json_object_t)); + if(!object) + return NULL; + json_init(&object->json, JSON_OBJECT); + + if(hashtable_init(&object->hashtable)) + { + jsonp_free(object); + return NULL; + } + + object->serial = 0; + object->visited = 0; + + return &object->json; +} + +static void json_delete_object(json_object_t *object) +{ + hashtable_close(&object->hashtable); + jsonp_free(object); +} + +size_t json_object_size(const json_t *json) +{ + json_object_t *object; + + if(!json_is_object(json)) + return 0; + + object = json_to_object(json); + return object->hashtable.size; +} + +json_t *json_object_get(const json_t *json, const char *key) +{ + json_object_t *object; + + if(!json_is_object(json)) + return NULL; + + object = json_to_object(json); + return hashtable_get(&object->hashtable, key); +} + +int json_object_set_new_nocheck(json_t *json, const char *key, json_t *value) +{ + json_object_t *object; + + if(!value) + return -1; + + if(!key || !json_is_object(json) || json == value) + { + json_decref(value); + return -1; + } + object = json_to_object(json); + + if(hashtable_set(&object->hashtable, key, object->serial++, value)) + { + json_decref(value); + return -1; + } + + return 0; +} + +int json_object_set_new(json_t *json, const char *key, json_t *value) +{ + if(!key || !utf8_check_string(key, -1)) + { + json_decref(value); + return -1; + } + + return json_object_set_new_nocheck(json, key, value); +} + +int json_object_del(json_t *json, const char *key) +{ + json_object_t *object; + + if(!json_is_object(json)) + return -1; + + object = json_to_object(json); + return hashtable_del(&object->hashtable, key); +} + +int json_object_clear(json_t *json) +{ + json_object_t *object; + + if(!json_is_object(json)) + return -1; + + object = json_to_object(json); + + hashtable_clear(&object->hashtable); + object->serial = 0; + + return 0; +} + +int json_object_update(json_t *object, json_t *other) +{ + const char *key; + json_t *value; + + if(!json_is_object(object) || !json_is_object(other)) + return -1; + + json_object_foreach(other, key, value) { + if(json_object_set_nocheck(object, key, value)) + return -1; + } + + return 0; +} + +int json_object_update_existing(json_t *object, json_t *other) +{ + const char *key; + json_t *value; + + if(!json_is_object(object) || !json_is_object(other)) + return -1; + + json_object_foreach(other, key, value) { + if(json_object_get(object, key)) + json_object_set_nocheck(object, key, value); + } + + return 0; +} + +int json_object_update_missing(json_t *object, json_t *other) +{ + const char *key; + json_t *value; + + if(!json_is_object(object) || !json_is_object(other)) + return -1; + + json_object_foreach(other, key, value) { + if(!json_object_get(object, key)) + json_object_set_nocheck(object, key, value); + } + + return 0; +} + +void *json_object_iter(json_t *json) +{ + json_object_t *object; + + if(!json_is_object(json)) + return NULL; + + object = json_to_object(json); + return hashtable_iter(&object->hashtable); +} + +void *json_object_iter_at(json_t *json, const char *key) +{ + json_object_t *object; + + if(!key || !json_is_object(json)) + return NULL; + + object = json_to_object(json); + return hashtable_iter_at(&object->hashtable, key); +} + +void *json_object_iter_next(json_t *json, void *iter) +{ + json_object_t *object; + + if(!json_is_object(json) || iter == NULL) + return NULL; + + object = json_to_object(json); + return hashtable_iter_next(&object->hashtable, iter); +} + +const char *json_object_iter_key(void *iter) +{ + if(!iter) + return NULL; + + return hashtable_iter_key(iter); +} + +json_t *json_object_iter_value(void *iter) +{ + if(!iter) + return NULL; + + return (json_t *)hashtable_iter_value(iter); +} + +int json_object_iter_set_new(json_t *json, void *iter, json_t *value) +{ + if(!json_is_object(json) || !iter || !value) + return -1; + + hashtable_iter_set(iter, value); + return 0; +} + +void *json_object_key_to_iter(const char *key) +{ + if(!key) + return NULL; + + return hashtable_key_to_iter(key); +} + +static int json_object_equal(json_t *object1, json_t *object2) +{ + const char *key; + json_t *value1, *value2; + + if(json_object_size(object1) != json_object_size(object2)) + return 0; + + json_object_foreach(object1, key, value1) { + value2 = json_object_get(object2, key); + + if(!json_equal(value1, value2)) + return 0; + } + + return 1; +} + +static json_t *json_object_copy(json_t *object) +{ + json_t *result; + + const char *key; + json_t *value; + + result = json_object(); + if(!result) + return NULL; + + json_object_foreach(object, key, value) + json_object_set_nocheck(result, key, value); + + return result; +} + +static json_t *json_object_deep_copy(const json_t *object) +{ + json_t *result; + void *iter; + + result = json_object(); + if(!result) + return NULL; + + /* Cannot use json_object_foreach because object has to be cast + non-const */ + iter = json_object_iter((json_t *)object); + while(iter) { + const char *key; + const json_t *value; + key = json_object_iter_key(iter); + value = json_object_iter_value(iter); + + json_object_set_new_nocheck(result, key, json_deep_copy(value)); + iter = json_object_iter_next((json_t *)object, iter); + } + + return result; +} + + +/*** array ***/ + +json_t *json_array(void) +{ + json_array_t *array = jsonp_malloc(sizeof(json_array_t)); + if(!array) + return NULL; + json_init(&array->json, JSON_ARRAY); + + array->entries = 0; + array->size = 8; + + array->table = jsonp_malloc(array->size * sizeof(json_t *)); + if(!array->table) { + jsonp_free(array); + return NULL; + } + + array->visited = 0; + + return &array->json; +} + +static void json_delete_array(json_array_t *array) +{ + size_t i; + + for(i = 0; i < array->entries; i++) + json_decref(array->table[i]); + + jsonp_free(array->table); + jsonp_free(array); +} + +size_t json_array_size(const json_t *json) +{ + if(!json_is_array(json)) + return 0; + + return json_to_array(json)->entries; +} + +json_t *json_array_get(const json_t *json, size_t index) +{ + json_array_t *array; + if(!json_is_array(json)) + return NULL; + array = json_to_array(json); + + if(index >= array->entries) + return NULL; + + return array->table[index]; +} + +int json_array_set_new(json_t *json, size_t index, json_t *value) +{ + json_array_t *array; + + if(!value) + return -1; + + if(!json_is_array(json) || json == value) + { + json_decref(value); + return -1; + } + array = json_to_array(json); + + if(index >= array->entries) + { + json_decref(value); + return -1; + } + + json_decref(array->table[index]); + array->table[index] = value; + + return 0; +} + +static void array_move(json_array_t *array, size_t dest, + size_t src, size_t count) +{ + memmove(&array->table[dest], &array->table[src], count * sizeof(json_t *)); +} + +static void array_copy(json_t **dest, size_t dpos, + json_t **src, size_t spos, + size_t count) +{ + memcpy(&dest[dpos], &src[spos], count * sizeof(json_t *)); +} + +static json_t **json_array_grow(json_array_t *array, + size_t amount, + int copy) +{ + size_t new_size; + json_t **old_table, **new_table; + + if(array->entries + amount <= array->size) + return array->table; + + old_table = array->table; + + new_size = max(array->size + amount, array->size * 2); + new_table = jsonp_malloc(new_size * sizeof(json_t *)); + if(!new_table) + return NULL; + + array->size = new_size; + array->table = new_table; + + if(copy) { + array_copy(array->table, 0, old_table, 0, array->entries); + jsonp_free(old_table); + return array->table; + } + + return old_table; +} + +int json_array_append_new(json_t *json, json_t *value) +{ + json_array_t *array; + + if(!value) + return -1; + + if(!json_is_array(json) || json == value) + { + json_decref(value); + return -1; + } + array = json_to_array(json); + + if(!json_array_grow(array, 1, 1)) { + json_decref(value); + return -1; + } + + array->table[array->entries] = value; + array->entries++; + + return 0; +} + +int json_array_insert_new(json_t *json, size_t index, json_t *value) +{ + json_array_t *array; + json_t **old_table; + + if(!value) + return -1; + + if(!json_is_array(json) || json == value) { + json_decref(value); + return -1; + } + array = json_to_array(json); + + if(index > array->entries) { + json_decref(value); + return -1; + } + + old_table = json_array_grow(array, 1, 0); + if(!old_table) { + json_decref(value); + return -1; + } + + if(old_table != array->table) { + array_copy(array->table, 0, old_table, 0, index); + array_copy(array->table, index + 1, old_table, index, + array->entries - index); + jsonp_free(old_table); + } + else + array_move(array, index + 1, index, array->entries - index); + + array->table[index] = value; + array->entries++; + + return 0; +} + +int json_array_remove(json_t *json, size_t index) +{ + json_array_t *array; + + if(!json_is_array(json)) + return -1; + array = json_to_array(json); + + if(index >= array->entries) + return -1; + + json_decref(array->table[index]); + + /* If we're removing the last element, nothing has to be moved */ + if(index < array->entries - 1) + array_move(array, index, index + 1, array->entries - index - 1); + + array->entries--; + + return 0; +} + +int json_array_clear(json_t *json) +{ + json_array_t *array; + size_t i; + + if(!json_is_array(json)) + return -1; + array = json_to_array(json); + + for(i = 0; i < array->entries; i++) + json_decref(array->table[i]); + + array->entries = 0; + return 0; +} + +int json_array_extend(json_t *json, json_t *other_json) +{ + json_array_t *array, *other; + size_t i; + + if(!json_is_array(json) || !json_is_array(other_json)) + return -1; + array = json_to_array(json); + other = json_to_array(other_json); + + if(!json_array_grow(array, other->entries, 1)) + return -1; + + for(i = 0; i < other->entries; i++) + json_incref(other->table[i]); + + array_copy(array->table, array->entries, other->table, 0, other->entries); + + array->entries += other->entries; + return 0; +} + +static int json_array_equal(json_t *array1, json_t *array2) +{ + size_t i, size; + + size = json_array_size(array1); + if(size != json_array_size(array2)) + return 0; + + for(i = 0; i < size; i++) + { + json_t *value1, *value2; + + value1 = json_array_get(array1, i); + value2 = json_array_get(array2, i); + + if(!json_equal(value1, value2)) + return 0; + } + + return 1; +} + +static json_t *json_array_copy(json_t *array) +{ + json_t *result; + size_t i; + + result = json_array(); + if(!result) + return NULL; + + for(i = 0; i < json_array_size(array); i++) + json_array_append(result, json_array_get(array, i)); + + return result; +} + +static json_t *json_array_deep_copy(const json_t *array) +{ + json_t *result; + size_t i; + + result = json_array(); + if(!result) + return NULL; + + for(i = 0; i < json_array_size(array); i++) + json_array_append_new(result, json_deep_copy(json_array_get(array, i))); + + return result; +} + +/*** string ***/ + +json_t *json_string_nocheck(const char *value) +{ + json_string_t *string; + + if(!value) + return NULL; + + string = jsonp_malloc(sizeof(json_string_t)); + if(!string) + return NULL; + json_init(&string->json, JSON_STRING); + + string->value = jsonp_strdup(value); + if(!string->value) { + jsonp_free(string); + return NULL; + } + + return &string->json; +} + +json_t *json_string(const char *value) +{ + if(!value || !utf8_check_string(value, -1)) + return NULL; + + return json_string_nocheck(value); +} + +const char *json_string_value(const json_t *json) +{ + if(!json_is_string(json)) + return NULL; + + return json_to_string(json)->value; +} + +int json_string_set_nocheck(json_t *json, const char *value) +{ + char *dup; + json_string_t *string; + + if(!json_is_string(json) || !value) + return -1; + + dup = jsonp_strdup(value); + if(!dup) + return -1; + + string = json_to_string(json); + jsonp_free(string->value); + string->value = dup; + + return 0; +} + +int json_string_set(json_t *json, const char *value) +{ + if(!value || !utf8_check_string(value, -1)) + return -1; + + return json_string_set_nocheck(json, value); +} + +static void json_delete_string(json_string_t *string) +{ + jsonp_free(string->value); + jsonp_free(string); +} + +static int json_string_equal(json_t *string1, json_t *string2) +{ + return strcmp(json_string_value(string1), json_string_value(string2)) == 0; +} + +static json_t *json_string_copy(const json_t *string) +{ + return json_string_nocheck(json_string_value(string)); +} + + +/*** integer ***/ + +json_t *json_integer(json_int_t value) +{ + json_integer_t *integer = jsonp_malloc(sizeof(json_integer_t)); + if(!integer) + return NULL; + json_init(&integer->json, JSON_INTEGER); + + integer->value = value; + return &integer->json; +} + +json_int_t json_integer_value(const json_t *json) +{ + if(!json_is_integer(json)) + return 0; + + return json_to_integer(json)->value; +} + +int json_integer_set(json_t *json, json_int_t value) +{ + if(!json_is_integer(json)) + return -1; + + json_to_integer(json)->value = value; + + return 0; +} + +static void json_delete_integer(json_integer_t *integer) +{ + jsonp_free(integer); +} + +static int json_integer_equal(json_t *integer1, json_t *integer2) +{ + return json_integer_value(integer1) == json_integer_value(integer2); +} + +static json_t *json_integer_copy(const json_t *integer) +{ + return json_integer(json_integer_value(integer)); +} + + +/*** real ***/ + +json_t *json_real(double value) +{ + json_real_t *real; + + if(isnan(value) || isinf(value)) + return NULL; + + real = jsonp_malloc(sizeof(json_real_t)); + if(!real) + return NULL; + json_init(&real->json, JSON_REAL); + + real->value = value; + return &real->json; +} + +double json_real_value(const json_t *json) +{ + if(!json_is_real(json)) + return 0; + + return json_to_real(json)->value; +} + +int json_real_set(json_t *json, double value) +{ + if(!json_is_real(json) || isnan(value) || isinf(value)) + return -1; + + json_to_real(json)->value = value; + + return 0; +} + +static void json_delete_real(json_real_t *real) +{ + jsonp_free(real); +} + +static int json_real_equal(json_t *real1, json_t *real2) +{ + return json_real_value(real1) == json_real_value(real2); +} + +static json_t *json_real_copy(const json_t *real) +{ + return json_real(json_real_value(real)); +} + + +/*** number ***/ + +double json_number_value(const json_t *json) +{ + if(json_is_integer(json)) + return (double)json_integer_value(json); + else if(json_is_real(json)) + return json_real_value(json); + else + return 0.0; +} + + +/*** simple values ***/ + +json_t *json_true(void) +{ + static json_t the_true = {JSON_TRUE, (size_t)-1}; + return &the_true; +} + + +json_t *json_false(void) +{ + static json_t the_false = {JSON_FALSE, (size_t)-1}; + return &the_false; +} + + +json_t *json_null(void) +{ + static json_t the_null = {JSON_NULL, (size_t)-1}; + return &the_null; +} + + +/*** deletion ***/ + +void json_delete(json_t *json) +{ + if(json_is_object(json)) + json_delete_object(json_to_object(json)); + + else if(json_is_array(json)) + json_delete_array(json_to_array(json)); + + else if(json_is_string(json)) + json_delete_string(json_to_string(json)); + + else if(json_is_integer(json)) + json_delete_integer(json_to_integer(json)); + + else if(json_is_real(json)) + json_delete_real(json_to_real(json)); + + /* json_delete is not called for true, false or null */ +} + + +/*** equality ***/ + +int json_equal(json_t *json1, json_t *json2) +{ + if(!json1 || !json2) + return 0; + + if(json_typeof(json1) != json_typeof(json2)) + return 0; + + /* this covers true, false and null as they are singletons */ + if(json1 == json2) + return 1; + + if(json_is_object(json1)) + return json_object_equal(json1, json2); + + if(json_is_array(json1)) + return json_array_equal(json1, json2); + + if(json_is_string(json1)) + return json_string_equal(json1, json2); + + if(json_is_integer(json1)) + return json_integer_equal(json1, json2); + + if(json_is_real(json1)) + return json_real_equal(json1, json2); + + return 0; +} + + +/*** copying ***/ + +json_t *json_copy(json_t *json) +{ + if(!json) + return NULL; + + if(json_is_object(json)) + return json_object_copy(json); + + if(json_is_array(json)) + return json_array_copy(json); + + if(json_is_string(json)) + return json_string_copy(json); + + if(json_is_integer(json)) + return json_integer_copy(json); + + if(json_is_real(json)) + return json_real_copy(json); + + if(json_is_true(json) || json_is_false(json) || json_is_null(json)) + return json; + + return NULL; +} + +json_t *json_deep_copy(const json_t *json) +{ + if(!json) + return NULL; + + if(json_is_object(json)) + return json_object_deep_copy(json); + + if(json_is_array(json)) + return json_array_deep_copy(json); + + /* for the rest of the types, deep copying doesn't differ from + shallow copying */ + + if(json_is_string(json)) + return json_string_copy(json); + + if(json_is_integer(json)) + return json_integer_copy(json); + + if(json_is_real(json)) + return json_real_copy(json); + + if(json_is_true(json) || json_is_false(json) || json_is_null(json)) + return (json_t *)json; + + return NULL; +} diff --git a/compat/nvapi/NVAPI.url b/compat/nvapi/NVAPI.url new file mode 100644 index 0000000..fd7349d --- /dev/null +++ b/compat/nvapi/NVAPI.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://developer.nvidia.com/nvapi diff --git a/compat/nvapi/amd64/nvapi64.lib b/compat/nvapi/amd64/nvapi64.lib new file mode 100644 index 0000000000000000000000000000000000000000..d9c832f808e45356a614a6dc3d9b805162dd732c GIT binary patch literal 493398 zcmeFa33yw@)jxa{JNse>0wk;s7zkTp$4Q#7S+XQsie+2GPQns!6kCp!D3+@wu~|xj z6Tk>l*0Q(kOMyZuTi|_*AwZy%ol>^8Y;OwTH{<7C zojdb8XXczav)++B{m4kNt@G${v&!tDa?aeU`Sa&jEtqSMuaJ+GRh9Ea((-Yd=4#Wl zXy^Z$%QYdc?YMT>V22Ov@PYpeeW1F!)$4ApsPVW1{u+PS=kvLn)5%!Z%GzXNP2J+4 zZ+3OL$K%#aT)n?8P+J!axSKnp@wmSy+LlR2{XHHP7Yc^MO}<)>f?I0G)wmaiY8z^U zb$)kqpe~xOO~l)y$#5jynF9=Y{NARs>H@nQ&Z6EuNA;! zGSOsj(~4EmwzM7Sb=QPK3+sJ8DbW{gOSDIwkUqB`S$jjFdbc;4Oe5dM$eO6IlcKlJ z9jXgA`Wk#S?#3lSU(i!M*PBRoCz6qLEYW2zK&{&!Zm6rT4|q}1Xe1pCClhVaRLYZD zoQftD{cGK|o?3r>gV*D(te!Kwdd~bg71eVpE34+tS%A-Ky3bSP*ZOLkYQptoi5&S# z!Ry@ho~DKV#&E4s@aD{lM6x~Bg_1!F1s`(P)&_#UrcjV=QXA`PC)>n2Vr{?&yPDI9 zWYk`skUP9^Vc1jO5D+ZMXw<^uO?0KBJ@z{C*11FBu)i@>Q|De1O~#sIE4xsXcqEmo zo?AtxZAZ~479LwYcXoy0s15Ews3{O`g#RsyuJpzesc3z)*H)e;x3?+KRMQZuAxKkq zvAG&n^s4@CEAw3xydus~l@rR)(6qbxn?Iw!-=7$Px@&*C{kDrBBkdz*}F|{4H zYHn`CVJ&HsFW9iqi&jbr&2;Oe8!OGK@$CndwB8Lf219;tJqzW^WP7b8$q~A-4Pr$7 zK*^!H`lg!38tDpBBX2!PsxDVP*$@1b#Kz}a!g#FaoU3!4#b4(R25S~JHZ)j_!tPK@ z%q?_d4`;;|(IaP4J)6izx-FqwkZwMMVzkJPz0WKO8^e5L1F?UwfjEJCVv#`|N#si5 zlodv0`r&roVA$(hC_FgF9=d&4Wv*(@U?mCU49uJ}6vqZ*M-av4{J0J|l9TzyVz`Da zX!DtM;S_EO<|9L@=NK9U{q8`0Q+>!+D}21L21*^U;o0U)v6*D;E+B0L9VXImKC>B^ ziy4@eYl^FRF##7TEL^!Pf>W5e)~$)*)!WwTjii@ao)X=?OSP`G_7N>7f`?F#b94?n zMPN{G?oFkmYZ?;mnRql1>1vNhNq}PlafA|)_E2m^GLpooK}cJKf}rVCOEQBD+CvG9 zkeCeQFgap$IW)+DSItj}Hqfj}F4`VV=ta?ZG?I!oV;Yx?S~OS`O(il(Oh5jGXTrP-t zLb4;$#w|ei^$H9U_4Re0a3Bq>6b1@iD=S`|xsld&}BSaH-C zd6Cp2dM+V{?nA(d%z*%`aAD9!{)_CR-PG#ZkIE5=k-4 zxMJ;?Q(7Bl9(X=AR<@$it#-Ss7Pl^H3AK6`1zUn%PpGxo?`;V-HM-p%t$Jna8gBWm zi=rLgM5ZeZI3}ys6ioj--LYU7rstMK;hF*6zF^9+0}By2)LeW~6z-3js|wHa99!R7 zpHm&~GpO;VqFfP+DHm(!Ni(qI@#OY8Ns@ByFmV)?s%*%mUaL)Wa8;qU3jrCU%3_` zOLU|sN0ZcY?IrhjwdXNKFx80umbUJ=zm( z4|b)}k*+o(+G9!dIQh`S!k|?vhEi{&JC!Sg5~+`|r8Gy=zG!#4vj&Z^J=GFT9bo!4c8?j-JP+vR5;chjmNsMXt$efc57}nyu`DXvPTMYa)zE(IB;YIhBY=Y z9#(tFuPv(dkm8}lx)8GNYU`Djw*dmNE_Cd)MmKS)6D$zTqB+BZp9dDy1V3#>BolEYmp(K&KC?PV{0%;mYAT?<47?L3AFq~l5H4^W1@jM zrx-PS3L+6N2y2P0vG@$}E{bAcfMZxp){?|T#wx!#vNpd_sdEs6R;~qFlD#&`y3j?< zvb*qflSlDfKPL@aeI1w!=fpQ-{|~b|OT4IdXIVLEW_v^_L~3qMws>fmwpfkXQt(%oS;}G55_mXiZ6p@wo=}JkwhxD}ceGNBEU(Hd%V~|KJx5DTWn{3Orb~)uW-=uZ zz-(10KTY=?>}8E69$Ji991Z;r?b&+babL6}f|-cb)-qA5AOX3|_Vir6sIfVe%o^R2 zP|5}TFh&Q$*|tcKx#>j}V|8FDB&HI^d<{*!)yut$z2~QRs;*kRWr*5G1%DU0x-3{j zA{B|XwIsSBV`Z<*OCXf2sG)=sD`^3TNsn$}ip}2_o2h2cEqf(fpG~-MXK%_uc#GHT zkRs<~p1QCHi#nQU%cAQEJlr*9(%l)u8T6!h92?JVt80_dA7?PDF*|J&V08Gpnr4!t z%$h_biHW8$FOcw>Ov>W-HH;Zwl2(6jD?2TElFVpz_Czj>e5)cGZbsL zPBBzDm_Za4WdaIF6SEoA%_4Kgs^=uq!rq|Ymsp1>I_7w5md4uCo%Z^Z-WkT^+*m6} z5x(B8$eLK2NJ^2>jiEy#{9Z3~$EcqX@2+wy1_*yLnMgXOkbzKfIkoBc1%38X)@I^y zOaCUb$472m)^%s_HVrKi%X7PsfX^G26Kj#PJvq4O7$qVe&tSG-9h_yx4be4;WN&W4 zMV0233AGSx$Gj77zM@IR)5F-P!fQoTPYQcCs$=Udl6#k$Oh*S+by(Wj3o2`9c70$@(=4eqrxr-UUL`S!jcI$XOJe9gBk}w-DK=#+PG?^QQVB4`M$>uP6x31Mqon|p zYHwDE30g9R-mI8S$CE+eZx+)7tqcxt<0CE7L0ToDx zAc4^ft&3LX0irmpp2HePq(ZgA1)|!J8LAT~C}XbevNdAe2O_B{}?VpY5 znB%MmGGrNiNvxHVveD=^GE&3Xe6n_laA6ut8nFI}tTcLwXgc6)2+Fo%ha0Z}9GfL= zxahMin(N9knZ>Xt>s>M0p$V}>l8Btimm@Oen43iu1I*k_AyUgIcIqv&Nz23vE}(DP zEr~_f86F!=n?=j<1bfXbsfkCrR`d92_W98?i8BjAPexxJob9E4R;J=G}9feDiU<4EA=$x)Ev7UM9#Qiq$EmW!NfL`Wzj|y#SJH zlGsS@w08#*W9PRtAfp45Kuo+L$%l1EZi$R0)}3*bU{s2zC91o)xmYvng*ql_G(_TM zP%@h8q&YZw3%phLeI#0%jeIhijo9RDleP*LcdhQivcZn>MI*G@%PFfbx+1f(b!j9O z!m9^*GayQdd8*zg$YSgBT$BxlT8TBGVJT4#9nc)@#;H9^gER#2{^k!+P3&YjS%bHh zR1JAw%eG|JvliO|cD(4s>~Ux~dG$k@Y?rb|a#;Pn7`vU72XieQ55Nu^&uOTY=kOO` z7K+F&E0L#2fM@~C9iTiAYTz^B#_Q-_O#Nv!Ia(%6qgC6gpG5emtyA* zFNf)!bSRP1orW;M(!G!vg0?d$3b}G8!9^v!sj{GzT+T#uvHwUR}RS=Tht-VaGvuxvL_~vg05;P6OJ{XX2X~I}XC@d!X==1^D*Vj)U;{&KPX5;~+dXm3JJ3 z7f0pwjua=6#pq%=X`Pd1e^=%+cyf=QiI}XC{I0&EGaS&d71D1N!9S7m1E%M$3b{~cCq6iym>ZV z9?;%#5T3uuj9x=JiT$8FnvY|=iI*qOcN~P@aS(pTL3sYfF#7ctc@Wq6P&67aR0$%f%pOhz6G&-Tx%keo+ZAZl$zC!ADD_K@U_fYku~k} z=FGzHo~l2jIy13il{O3$ewl7{E50(v*m1M;f1INK{}lQERpu{{5qf+@#k_g*%F5=< zo+tnH%JOmTXWpr8y6BcAy%9}YN?+GNnAuLh+=t&Slc5ry@jdh>`8lo>IQp(%d9$AK zdk|MEIJZ_>Gjl~MrDN#xO?(qX4ePb=;7t5#CyHT&F`#058jno4wTi)+^tXcz{t1{5 zBrc!6rQjc3rfIw3qF~@0>^HYe(>%B+7&yg#Q;^nLrfDf$6bzh$ybH?UtGFl_I7J@S z+e2l9FoTm_T9Lf9%)}6t&n^c{*R=FiMxr%ep<0rtJqv8}j$S$`4^B*eC zLEh`Y{8hy%@~B-F?~9uyIN60dh6%v6N~{ad`Roz{CL?kA>_YioBr$r{PWe(hzf!?* zzDheP2kuwEy(qDT%J(KP?@L^v@{QV0FPZpsD&I^bO#<#ni7k|GEij8Dt_XZA&!IlL zB}UKPDc`S<*aKXG6i1-unXf)>++Wjvjf+B|e4mpTft2M_?A!+h{|Mai2MW|geB{gb zO<>-axP19ie>G}`o}>6=eUtY7l>A`t9Gu%dQ^D;DT;+D)4gjvs38(10KlEJ#+=T~; zvW>z=K7F4B=5>k7r!VyfUjsAdU?I=IIkevcfSIl06n~-qAPh{qigS>61~BKTI0t#R zON=O?^aI7tyC88e2Z#Dl>~{)qe^78v?e|&I;}AVZ@tM!gdmoCi3l{~$eu^H{-v=ay zfw(!fqs@qK0dC@90yPpJ`SPs>re5OmX0im%}Wzs1hP}UeBTA;6N$^GFHI#U&epVpa8V%fTt20J6eGS$ zVhBgU2{#$>Kgz-7_G{En2Apt8d%G6}S`OSUb0|lA;>xG*-+=jt#O2eM>@|6=rcK91 z!N586FV(=*t2m`yQoY51IZeem$h#7ln^l~HyvHSm3y7POokt-4H7A^6KMyMI4dC`X zTuAfaBcJ_lI#Sc_#zn!fi&8%Fm**vhfw(!9Zzsfmn1jpp0~!av-wqu4)#Rgavjlf( zt~|o+yB#=M3RZ0=u5mkXC6E`}4%{T*dbR^c?c+=*oKnBk5B(gtZzPuLEnofacC@DL zhl@hK`Xzt%NDKpU;X-4)Wdw<`Wg?Aa7y_<0>u+h8_;`s)4Cjaf&?B zHzqMG5I3iOD1rE1;NG{$%V+0N4cJSZ5hK>Y@Q`(2|zQF-&_ zyQ)dk*5aa&FJJPjizSAExH;w9i}+iBn;sS@bi;Y`4Fa=R;tJ)Pk{BV;Io~cMo(0?& z5?d(Wy^g_r5*LMh`A$Guoy0H@Hz$2p!OqRV{pTWqB0J@?^QLA^y8su3eEAapof5-9 z+&Eu{`RypkZ%ug14{*J96s{t`x!9bNnE~sN#8w= z6|(fZQ@!ni#92AG+;w~e5)#8e-13$0tQ=f! z`Sw8ht^)3U8o&?=m2c@XO>4tNp-}lYNQ^)_myhNpm*?Pe%eNJ{n}O>(QAjIPzb^vw zXNk*KKC0huB}PchU%t|lbcFbHns1DP{q_c~oHoD_CgaLizs~~my2KSK-`5hu0&#Py zU#h1G%XNhKbSmGiNZJ#)$8k{@k1JpKsv??Jjf+CQ@=1_IyoQ^F zfA;5D9BK&#YYyKxlZmy@jK@~&n=hIMfX{F}jBA7DBKvCI!EVXV~G8$ioud%nbC)X}ZR?VyATWdwdvUdJW!PGMTpKHrf?W>p3`^9DQrQ|Z> zrQ|YxDG8YKOUc8vBPVMsur}37P>``b&l#T$v9@F)mFP&9%~*6$SyOi!zmR(}e*UhE zejN}0H6$rEJzQX`8VqHB7ufV-de4rMeSDhMvA~s{5a@ekM4<2QuFPlKMj|aU@`0t= z==BYo2Gcuj8tfSzI^=f^{bRNSsX<`-VGFU32_EtMx}vJVEeze_uX@pweUuVL29J1Q ztq=fSZy@`qUu3vjhi}1HJ+Jp&nNKON!OSSnW+OBIrl)$w1rB-MlYJ!EU%I8CzZ4XG zYzg!)D<2c+KefEHYABd}HI#kbm)#o5{*iL53}k)fGaxIyuczex$sLHA*3mzilnRn! zLr(^W9u4+wb7kJxHnL&U8<~lLz7Ixt9yl2~28Vvv(Z9fx9Sm%GBV82g-#L(_jIzjR z3n`nXn+&t?S)`Fu2x<%{+MX!VT;qzhap@7-$T==emNZ^o8t6}#Po*-Kd0GN}AC^_U z5y*ZP$ZiX4da7jOonWkbvFfQI>dm!4-%~?@?DxLxTUCP{pWhky>V?3-F+-k#P`N8m z^uj>BJ5cnZL}uS7P1ky|F9)(uinxKmP)FaX4cfBwr0kOqQqMLt*wNq8z+yvfgH?l& zEyebI<4Vs9WM63<@cFfpecW2f{iyn3WT0-4|F=RuBA)Zj$a0{udxyPz`>@2kt?X| z|Ni_}Y`ZCA2O8bNIHByTWUzX|Ss-MGIf3j;4cRTCA(Z@9*x?D?4v>|7A~5u*-3qS; zVH>CoD=dQ*p!-R9e!}uJ2Za*qUkQpjK|Odu2&Dx@N@M+mxaktIr~D)*Gckgq?vG|T zMH-<6$R?gg+FHz1)uKwz?I%tI$cNK*UQie^?f}ny{l(vko=9BAsp=;R8!w$ zW41g%{S{LcAX=$3G8~IfVMsxdN;F`ah9qNAAVZoMK~dT&TtymDBwG(oa@&yzxy2*2 zV%Zt!vME|NkwiPm7D!jIOM`gL-Avvsd^d=f7MeDQc|GbS6+c@hHt>_+UhGWD?+U71^XTgY}p@= zSzIEgnV|Hr5roJ|P?Xa-9LG7GVcL2kv7lpyt`&j)z38dXhs<39v&{Y9<((ok%qQDl zs6d6%>;lnKov>vr^c#(mlpQxV*EVX71NsZ7z3Fpa4U?n2(FpoEk@P`h&KPjRO*7BfcR zt};@u2SvIRYj@&4j;Z@_rzvK!_Mf;@(<{~hyzeNJ93N&2D_kYR-O5!`xpWDVY5|W*##<1IHBm2RtrnMr8s7z;8p@$2-msWVZ$m z`AY{zK58Ja$9<(G_f433$P1a#fuX@oPh~#FBx2=qPIdpE9HDtD6Q(HZ~0nVOH}}PAN+^&P9q40d|st!F`6Upd}k86ZgO_ zR6Jz+K7DQ)beCL=Nr)^24Z6!|BGOGGat}>U;^m#_g~FJRkXzq|t5_qqzJ;kK+(m_- z0P04Lqg@{{Twi3Q{t46#ocgU1HwB}Sz#R!nNT~-!t_b%Bbq!N1KnY$vYIOEO50`@w zZX+min_qC8YuY$%TDnA=);>v_)-q9>HfMr1?ZRCK8dNJdXk>A1MBHSuaXHR zx>J>Gx`5L+QTl`bgvy)gS9?QQ-{{i7fUkVHKRc!&>&E;Y9eRko#b>$-d~#*BrF=Oi zxk6sBzqp)S`52iY3xuo^$O>6xg)j%B(Sh@_3*7Y~GW*aIfxfL%kI3|toG~B1v~84- zPrlMglelH%H}UcwIE>qKqG#DjTe4fWy&nK4bsNRnBHSNgiqsR`!*!s97rbM{jX-9? zmnMRu(2@9(GW7``k4wx& z9F(gmQBdT+gSco&#fekCi<^_|K_p>jzVjGu=av#}=Q)$Kos%WcPaGV-ymIF3ne*pV z%&e@enmcE~%*vSyX3o?6Rd0A;V00m40~`JY)1PiG2$%V@FHwruv-x`@U}+gT%C%>yG0^O&+k|;KfNqKiyq8XGoOjIX(+puux-IZo?kdH!3%JDA=b6Q zLmmws@>=7-MvYVys|Z>%vlip6S_Frl3v{4AgN80||-@^g746 zN=9iV?W464EGJ85kMEX_VjAhSsxM8w-Vl0?hh8%BQ;S->2F8-lP>TjBFRo(kVBBA3 zY98*QxFEC!y2>CF=4_P@mx{)-J?d z80TJ4W?epnCp~-)LYPTVWTsC!&NXF>HU--QQ?NZS1@$>)cBx*UHdAH)j>hj$trN3< zC{VGi9M`T}xaFS6RMaj_hX0PMn8yIKc4;=Dhi^fMVhf6j{cn!TS8NQ)>GHCrfejyq zM^L*ONumN(j|KWSmb(#Cg-O)w*g4wtV#!AG7#apEu;2Co{eK7Ho(qm5o=jC>fV=*x z7e#cx5QP>x%^0@jbTS~)wvE>F!|ZZ&)!+yHdIn;87U&O^msLHLeP!r*0OGo%{hM}^ z251*V>{L;_zHgNt=NbsO0|Qg$>8`^w)9XW+37{{)Hj-#lp#f1kiV@Sh5cLMe6U|Yx z=duL?RljG2LIYQolZ}Ge6Uu_w)Qn*E-PSGC_$Fg;EY@m3?aWjV)M#8{5HIDpwvAC`aSMrnS<`XR?biaViot zKGH@6!VoUuAcCU2=oMCxHm!WLwo`kPw$q$O@GjKGcM~3qRj5oWD%$Wb(w2d04&a+& zwTXCpG#QShJC|bl)u~0bIR2`%*%;5;nTD^>t{F}FrY@CJz6zf5y-n-sa!3kh{{*u9 z0Fd~cLH$=S`;jO6-GaS9YMEZoz~T{}yNdLkN<6yoh)NW-i{~=sc|Yleq3qyRuHrpW z?yVz>A#N0|ts_ZeL}?hz52I1P+-HcG6nFR|Kd?9U2EWO1~rrAkrAik602oFQR_I2Q^_BNzwZr7#Qg}=p`1z!Ao5*| z)1VIGxE|a^hj^huU1?AQpy-&R9(DyS+JK|S04`x3OX1}DTZcp~lq3qvDma9q z&lva4Ex!zv9K`z>q|c}HQ;Dh|s)s1-%mjyg5LPzyJZ+R1yE?alFOY?NbW(wVjpgU# z8Ji=cu+w7M8?muav&&x0Nbc|STBIS@kV~5rQtqHBH#{nYb&qw3}9objF)$)T#Auf5!o#~qk*k4qp1jH zSI@_c#&Z&n0w-AG|-@w!g+{LD30u)tjv9=Zzb=}3&pxY7*o20wr+epakv^P)Fk` z)@I`_Hg)HN61Zwm0#^&_2wWIYai=a`?AQt1iHMubaUBM=29&VN$)JShXMqyBT?|T; z{#sC?e7^!EO7L4yB9Ft+P29+mTR;iiawBdXC^5)xGU9GGa1R)9yP~%jxs`(w^5%iM zoF%)BxW%A;#c}t85*&{kseb|`yy>r?#8CZ-L45~G=vIQBOz680C}9H#)##MH9$KKG z7`_EX11Z@ZE7)n{v4dHO9n1=Cn(JU~r?*OCulo=8ST zQZgE~B;i*V_?Q|+@jpeBNGVnPpTssTsr72zcvY4=d&aJ%ZBZG>yQ&PB%gSudb^%tE z^p==jn)70r1}-nIVr?$&>6k52*D z$2qaKe9MfH<7oC98l<{?*b%0lo+s*}Hy=q34HA2>oRuA^~ zvoAmLcf9F+r=+9rU*kGFB{hSOd@!}6@9mO~qUW<)JNmvEhtmq>X-?@VdJ<6>C2_*x z_m6xqg<*ssHY2fz6HA>FPv*o4&WWdT;uz<|pKu~xrlM$;Jh3bJSV!MmB^~|emam6a zY$WWbaG}2LC_;HRmY;zH(eKlS`BbzgIYHaF1T+?14`^u7p5M~Srvszzst10yk=I*{si{U@4+o{G^L*eYQ<@|wOxr@`zyFbGq`o!gxgBY zC=Nprw9o?n$i(u^3DZqEdjbE?CVl!WOnQ~fxMX7w^fVq;;{kJ#l8r0O*#G7}Majlp zA&aI+nD{_r-+<@90IG&)`n*hjUL!wmk)LYS%o z^wuLF-2-!)k02XwT=2SuHe6{E^%i0pvQJdKh*h|IJs$AcLS63rxOn!43|h)tD64P) z&1F8xtq7rj?hxi#ZvmBkiC?bJtxV)Kv<1_^R=Ic`_zyM_R*9?uDtK@5j2l}1e^Z0E=1o~cmOh>CJaGlw(R#%zlGV68?&Q; zb#{bzlK1r;1tx4#+<|s06vhIZ+ZHV4$cxQh9}jfiV8Qd>ct$+##e zdS_Rxbs1C!)EOLiiV=4To&}C%?T7ec?HhxlmcA3mjRkc&^Ok}Vvou;^h}8W+oyw_) zf)cZlDkJr9P`#W=tCyWwUY&uX<&BWC7}Q$EEdxaxMOc^{xELsM%wjERP`#jpyfZ-w zj;lcJ%D5XrrC1)#Mnsu^W28O|s+&`v1SQJ+9H`xx_f>=HEyB038FvLJk=wIGaoi}l zw#at_C{ezjg4&m*TnB0u<8A>Z?0gp}F@Jd+l-OF^28uXFYF`T>GSajRdip^Hp??s1Qc4gdZ$wHho`PBk={`J7=RY&|T9l0RBdf2$rzk^( z)`Qbq_CK;PZ@kENC9h%c`d^}Jpc9_$CHEI$;9i!_Jxvu9r>Sa`(^RvuX~$hKI?~ab zuZ8$+}D96?JqjYpiZ3ClZbe?pOHN9_;zq+J&}NJ?+g*YnAl?9+J0&IKl9 z7>>)(dl~imX#o70eFg&4^_qqw04I(W^x;Iovepx~(2%`+(?`fNP~!U|ge{l8l->nf z1^X{RL}s7OW6Q>_7gBUtPiLRkfm1yj-ZR|IpM6Y+@Y~mE`qQ)7R|RQoK4-Unuo@$> zZNGwjwHpf%Q98v@vB9#{NZS*-3THhMlyFw+csAfF=HoP3rpQ%mFx?NTmAxb}$*)MZnyrbI!NB2LIA)XR()Hz(P5 z3)#F!{X=AvM7CiOI2pqq|383dslR^`))ln7U|n&Tmd9X=;v`#3hIiN8)nBr`&oK;jLkt+CMYuS7LF@; zI-K8g(Pq2agM2BQ3C%#OAg4eNLhqww4>FdK_8#O5l*HbHkYiF0LRHK?NLuMZu=lBU z9$$0kF$SH-2e%4=Y)%X@9kw3h74$r|9;0pnA~K$WJw|5Vz^0+J(K9@!_6(RJyU~x( z`+faI6{-;|2kM=Pg=O0W?m)JU+Q1jhnUqC2TGaElCFr-6fD zp2gEAg=di>#!^9%k3GY2uARncJGD&0YuJg}PD!zQrECIKVHNZ#HiED&+GC(;sjv&i zc~}HzT8vE|YGf6%rSN;iQeXB7bC-yY(3o{Vvj~%)yJAcl%1|t!=#ijA6FLUeRuomd z6*QYrFXHv^s-d2sNWDJ_^^O>$9YLpHaDt))Cn${5Fg#_-z791oYR%t-Z>xNRCFXpL zT*hFuE9Ov@eW#Ys*D?n?IN@`~u$95l8B(Z^&h=0agjQobPsgLE_#;3G?L44FCD(%z z6%T@!Vf0Di4K6=*3xXn@-sU)U`XgR>%dVgdid21x1FPA$c=PVhdT%h4=?!2QUZKC- z{Z2o^a3pVOm+)+nLQ>e-)x9!E_(Gib{|lwnBAPTr5tEcdkvt(R(2bx&mpE* zqsIRkQzwJ^n5ol2ZDWcyYlP=s2}(%$C8#yHinaTV)JKif7eI-Q|lcDNLS+^VpvS@y09rx-hgayRrNh!s8f$ajqGM4iQZ|RH5v%IHFCPJFxb~ z@@pg#&+y2NVslHpw?j{ZcZ8HqJ3*k&1`Tos$n}CO(><6EN@MSe-<_cX!>yLuqy1Xa zv{<_o)VEB5(5N_i_>T3bwkIgE$-g;H>_AV#X{?DjjWt1=a$)XiEP3_>_V}RcjjE>_ zvTrw#MLx$jwqyy>4$)g zSCtQGUI9PDsVqU&C0P|HCHqm#=Em!vm&f?97-{RZ`4phl0NYN9~nqaMZ} zRyeGnsB-Wv9>lq(j?<>LmugdSZg(oCe^W1<^88MNxfKLwT~3uFob}a!zGx=94?>#F zS^1zCHBtS20_tJ+yxYw$g|fQlzm>l&8K5Fw@?*52`o1P9Ok9H zPD{<>nHvSwBB~*`4uQP}X~0o?py~rTgG6xU;i1ekgo%%F^xLeo<<2c42pMvl4V2i* zTL$XyxQem8qo>mJbt=c5g8LM%rj4M+p_+=d^Ndsw8vSs99(FORPEb^JlSS3>8o3nh zss!x{?d$H+Zt?#)@t-lLO6Wr+xuS_|#3H zgiqaJq;3W^4Og-DIPTNgr=A5Re2Oe0QbF)IN1qh-HGE1?$ zxLb4w4t^!RE@FNAsUIMeekF!A{`SZZ@T>JG%l7!y2H^gu{R*!^dc<%G*ML9x%DZuF zN4k*SQNY#WbV3gcFLdqlgx-IrYtQEqqoHvze<6tWN{ThRM~GDNh}{`S9x>CwBSb0^ zwLL7o%q+tr1VtWkh{Yo&z$3=PBQRJj5+2dq8I8yNJ@|F>bTro$FkDo~;o`L*tzteG zb>$-)+Q*7wjL6CD>Jnbr{x0D*d-aNu`N`cwS%7n z1BlU=#${pLCQ!okOF)Unc%qRS1GNV(aa8ySHa(pM5{>a}BNYT65T;KGM;fLV6q$a$ zFgs?@%otG4KHNivqR5|MIvf#zGW4?F9e8r)NF&Q14T7g%-^dP6xEQZQ*$0g3l7o! zn)9d&jkwD}iMqcLl&JgLL5aG*&q$>~Zckj|%cB9Vd+L5g-T%c%1;KBN=#xUwsCz+C z-TN(dZ~qE|weI~rve7xd$H+{zRkvkn9mqDrL+YpEy#!Y~CRKmguEw`HAZBUwm86_m zTEI3-I}eirGt0oxJLZdx{h*+zDmN%m8MK}kMqUa^82Kbn!pKo0mDY=U;S$H#=%r?{ zb|#*Mk!k)WQbE{$Rbh!?WI>UU7YQR#;EjW4B4~P7DKO&rrKiM zcq+5SEW*}S0fnp|PYB~oWv z>U6R#uh++XeTvDoR&p`MmKUvhid<9Zj_dUGt0E@XRg#M_nl&%-ZBwuI@+pUyT#rgF z#@O=WTnzttZ_?fWFuCXmECo>#tL15{qR7?Cspz8~J${~P`SH|b5q8P3{H};KOW5_t zS(oi%Sbn-}=JoB~Ti2Uht&)o|w!CPiXj=Y| zZI@qVa{WYdF~*h`ttQO8ns&K!smXP<=wjT2D8*9+X^+v9(;9U=_KV zaVMYubj|cG)AFxMu03-sPjdpZg!}*V);IPvEdP<@VvMbXdo!2bhhKloYyUL4#>%dV zF>?6u-`LWD0q!zi#aVPBe&$%p` z&Xrtcg3Hq4rZbn`i{2hT^0YETQ@7+|j7`&hnM>F7g$0k7m|Tk_7h{0aw5W_B+OFw- zh$(W-#GT5#`+4Iwn411Xa_y&;(b!}uGwEp7PJ8#aAMR(A`AW&f7+ab5XD+?W7u>n( z=O)*~l8Z6GVU{Ulh_;s*LmG1b3U{ifcb2Tdq`F|{9=wXCb9%}p%N8?6i9%b{fgAh~X>O;Y4 zEV*>@MflLQ=#z2|f);kmAIx03w+!@eIprWji;E=}V{BR+!d&`@cKpg`!Y0@4l8Z4~ zYYHdO+SYV~0fB93`FYtx5oflGYsZbdi1ZZUaVdu|BJML8L+K*MMbi@*P&*dMhatAe zMSUrSzZX@bdUeTDBo|@qT;#V!t^2kX($hVjV+fNJ^KogbSu7?E6rvDY9qt0EWe$W!>&lsBF7VBVTjY9{c~Ij+&-R;K*GsPXg3HoxEMP9Z-bXGzG%??(_g_mc#@Ot0xWPr) z(Ja^GdO~tBhI)xAvJ?d>p}m(l0x?Cd&A3y?=Du!!OrvyPeN)OgBB#tpGM8TFbD!D# z)DcFRzmQyvv6UH9YUD+}O5x@WO&^(DyU;`)fiXqb>tr}yZdNEuU^T;7@J;h=CbN#a$PRD7(;cT zR|WrUrM=7^mh%wqR2K{PExFq)^Mg{3C#TFc%%zw4v)^5n^%!M-L2@z1R%S1AQCp^P zmbdMnCf6sDi!q!&i55&U@VH}Gp2}?3!iSh5*9mmTb#l*9ADUY1C*}BZwD2>RuEqJE zgvR&`Ee@AljIn7^%Uo71Os-=k7h`OerxM!BT*q>}F0pIU^8o#eH#~4yC*{ln$!7)sVw%a~lRYe8y}OVlbuanqkNl8Z31-VHf=%*{D5gSHrJy)Wjx z=nJGCP~F#LP+f2W4zEkD#i)09i)B1rf^@Uqm;beA@?xXjKa*UHvDs%Sb5X0LFzv?E zmYG~76GbdzY;EUQBow(YWO6v;q7(acJ+YrFxd>x#JI5i$oaG+8*J}}z>sZM}7(3VT z%rzNz3Zu{c{v(sCPjV5)&c*$((Yo(`chQ+9*X@#vFm|qGh$(XIfjfnNUi95vCf6S% z7h&vNCnCn=%HF&?%&Ggvm`NlF-#*1<=b}CRB3B6|BK-7(DLp3F5t55AcCJ>$6uD%w z_Q92F-!r+eImCf5cCO`!F?+4_1(}OYt}`VUVZ<0mvp@>uhxYLT6$Ux_7}xRDhcB3( z`G%Ae$??n;%tbCpEtkf)h~b%^OD@LPJhP3trr=J2MrxC*RGN)3wlR)MXfJa+Vv1b! z6(^db|K+OPE;q|OOUh|SneDx3l)3aWf3a`zi|t04alnKFV{B#aV6Jl9UAV@a<$v7d zS}(a6V{1(-nTtkD3e_v`o^9679g>SM_B!oEOp%L5c?uuidDU4aSAsfn1j5+4Vu&&4 zqLzD>SC_lai{RNFHS)v=v<>@_eK~y zR{}9bE}iS;W&inClWV!;B8-sqgx*c&$mwP|8*!&_?^9Q~bsqSsl(ypFkKGWRwn*P}9;F}B`@N@y=LI&qYl-k4FtjW%BSrfKJorJSCeGWRl< zUgqxqnDlv%QRb1mAQ6EvwlbfLSkacLU!CW_tl#9?Uve?VHcvQ(x%9j`hBmG;x%`rg zF}A!;WiC>H@_KG){#=tQD!CYA%j+~-UaJSEr%bL*l8Z66ynbTKtL@HhKQ_5;lw6Fl z<#oC(uh;Khs!~Q!z1uxu z17eC?+*g3w?~xPAOi!316U)=aLT zGE-kv#Tc8Nsf6}2W7tEPsdW_NI_}uNPB+W^ODX59oHC!yTzZ)wI%l8X zoMn{xA<4xUTbcWrOE2^1-yd_6$@P-tVvNnsR6={1&tW+$y~ zIFuryV{8_?n7MR| zegD_xZ6?=f*$prTI87_lI|k4^!=J;^xKWwyo_Pskid=M99uoxZ`-U+$nOe-1axTfy z;%CgIYw`TZOFzEE(4tmyF~+9FrOc%l?)twr9d2@+B%>JvoTjbQfuLE7c^r)!mD#Sv zWr)G3okRYxL$HG#-_y;%%#`GV-GBN z*yMUdaxum>=f9G<W*9EuDd+;hl({jnh7@MX)XD(SdZG615-Q=o~T#T`4`U~dLHGN_K z8$U8NjYuxSu%?yzcuIQNHNA%A&?#NgbmMhLeQj!bo|JP6)I9YI@n^x>s^B#-{1@%ryyj3Zb_v-!e6QMsg9xuIV+1v1@t*Vv1Z_ zaVPJ6=k8x%xPaOmK9_QC$kFshq?_J5v$3uF21C;ky9;i{*fd4+2AA%=Pwh3W*W{We zxfo;9^k(MLHNCRs)^ANsD$Gab)aADrns!Pq#@ICdC3EST(td);wLx+*#-{0Q%tanY;jnl1yWiCGO36hSQKz#R zB~HuPHN71v;)K$8P``S2zmcYk2y_30gP5-s@A*iMINMrUON%%LZxP+$YW;l>uqqGX7cQz#2`P69DY^}Sa zOZmxVPUc^<6Uj{CXX?Zc$^ozZ;GB%9b^diaJvHX|vv!oK{tBKRXZ@)>DMk53JsoNL z^~SIB8*>?A?~JlR2oM4DH_f%ieKeZzNX|H?_t~8zH9)X z^|bC%6+vgC6%751O(KQ=f|80Qx`JID_@SJZWG0pNboGW3_=P~kYAfj9p+wS|WVC5* zG?|RGN3|8+&S=|es2am*hThslG8ZC#XeSiyT8W?8#=m`}FIkAENd|ACyH^)c&QqpxA<34I=~@Rba7Yo~(P{2YrK4+V@lPG;hrcx`$2m=ka!hP( zjjic!CF8_B@pz(56A|zok%KRm#4j`^lD$julZ;fGi@Rd<%Z;MM^ut4*R9h^j7of7d zFsiLH66-1-4ke6Iv0bu;LkU@hOJy@q9tG(KBvJMhnY%gKjh~=|RV->dCmZ@YCmV`7 zCkt+9=$tH7b57KCa!l0)dRC+oaeTAK=0lRho~DSiB{ruc$#iOIEZyntj3hO3N`DWU zQc5?EHAV`uL>V4Oah^1~krgOXYN-aVTupIkkaf{6{A;7OMbSvRr;Wb!sEaO)k(m_) ziR^`gP;N`LuCLa`OeNU~Q8roz$2 zwXybCggT{YyPk7yyv!yip}M-&>u#;6@wr2F;YMGBuf{F@p;Yx;%YT%rF86rcvh~AW zkvJ8?>#p_G`s*9K9(QH+oY~cL@XwU0=ZOENgwN_Z z3##YL6ZVv2MO!Bi7y6ij#|VZW`*@;9$|9MZ1npXjB8pBP!+0hh4Me)y$^E5_{ON{2 z=Mi8uXuDhy-5gDuzLX~q&oE^`df_s7pj{{tX&36rrbLqiLpSGCL#ku4P=Jyw5*;(L zDBvK;T71W3(HS)d#DDgnPRZ6m^EjNFDhr>7xwW;fS=4ZnXFJmMDywS4b)JQu@Ip7a zSM_YZTlxajF-_n+?d?hGcJfCe8Gl=UU)Vo zG}EnDMOfS6k0B&{%UWo4+zTi4VGwMlnf zf10h4xij%N`2_uB_EOnPQ?J_5Ynl97642@}=C{Yl5)F~mYP1glC+9L|yO#FhoNBZW z$7J0%yzZJ%Xkoq2=W*x!*0<0@NBZ1;zqiR73e~%5odm@!zX5KCV$cdTH3hx?S|QZ3 z;8B4g4}>;`W$u>W47USA?%LWw(AN|Sa^}vzC9blB7cLBY>Kg)r#c>s9V+o^U_XX<% z3k3%+o%pB6ZKx)9L%q*i)7V%el+zcGRuDC%hM+%G@2?NBOSDmHl5V|p>!w?pZrjzA z938;YZ#mSkwcm0~))!QULoteenjLOe8;QlS=+e93?ZZlk+b*zdH-4DO8w`7W3%#=C zcYlLN~T#hA1{M_g2-+lAy@7bmK@)<{OLQe#?S3pIIWO zaLt*I45^;u)?2>6&K(TaENpCOu=JTtlwmF1TIjZvZrm#@BFaxU(Rnu#xrA;(y7>%> z(Lx0;MY0}TaCRN@(bS(c;siE~$e@mxxl`tp6?(ZVYCP_Mzs4W-`Fw73eaJsdODsCB zvc~WB*7|CKbq%71nhb$#o$Yd8*@HB=1EHosxUtsb#`0a?n6Tzn(d4cRVV1hkPYCnJ zZxxKUDbQ5Y5UL@N`J1>_P-RWM8)XiL{N8$YEVd`t9XkVCjV;Mm`vF>z`rU#0ruvYt z*1sJsM)5p$H}*89*g0h83n+U*hlvzUYBoFOVg_bqd$MycCbY$`nT1`NMQ{o;*P1?s zR^Q|e1OgtRLj{TGp&L`%ajTX_Cr1^NIyuXuO%7!;ku#MX25O9(mdRrtvBPI=>7<7f zXYH|v$I7WJFEcGOTsd*7D$kcL=0W+>#bjvqF#P$`^(k24{44Ux7yS9SZFR%TOzZSs zv>onP#OzsLS=gMgYhh53N_h;RS`tfw7}1TPTOX%$qGbux zczqjGEI;I)FaM{OXd3&mhB&!fnir;v9|k7}`>H@waA7dq*eE(K?kK3y8~s96qd(~J z2Wso|o{fh-0qI(6D}`nDtHv8vR}!Rm@PbULObcrp%2E|-yt7!3oX;z0RjmBgFJnb( zhwG_%vXII8JiONJ4>#1+*9W|qf9CGlJDN-U>{wpyI0vh{IS97xfB0&fYQpt2yU!^A zj||i+Ti*v*a#o@Zo$c{bSY0N#xN?;isl5zd?-b)I*+^FUk81H0b5ppI4NWsxa^rh*F2dSYGHyG3Wmc? zK1{b1W|7&rS#zt(tf6ww+^YHW=T|M5YmF@{tE{M)H*a29*__#P=FP68wB_U4&m27_ zd(kaRw)7Wi`fGRVkFn5uIeLwLs7HU5N-+rIO7WvDG_NUd77^kl+FSj0fp?G?wnE>V#i7UdhyR^b>{kaIj zjlp%f#LzPZ##s*DP#hgExE8qkEb=&C1@|U!F9UNIedh^*UOVS2-|;>d{^hE`6)N9G ziD7}barrD?!KHXQN^out&h55-A&GFL#|=(6MUO9m+YH>Deo?+%@tjYOY^_VX6c>ej zdeCd}dnJZ}xH;*uH{zel!R6{f`u@!cr|5Aia6`bIQYXqc3eWlUxF47;5?4r%wl)F9K$TisQK)v+|9~w;q^tRa_5V$wo{Z`N1!N`K^j`koP7q@2faP9<|?5 z4MGP!7bm-Xg~Um~jcgQHI&YA#K6Y+$Y5U-!P{=Mv0n?!39Q0TX%sLgP=s|Y51ejY@ zoP)frz`Ug56nSKq&m@NQpx|VehY@o|OY8B_8$BDqiRGgv*+2t%?u2gXj@-_qWxQcU-_bxDBsW=CDyWm&8rsFE4 zFZofm#4r#yCp$ll_&VTrS}f!h^1l_pbV*zxJD&^8RVvOwj|YKyLd7}QgIzuW zrs!BjUk7>9fjLaYDe`EXsh61H>~aEdGmabHE_4_n1fZEB9H76kQf$-n^XTn{?Y>6q7#2MvN z@+Cjb0&}H`bI@ZmFpsM^MIPDZU0}XaaSrl!S&s1t7lnM~BfC^f3Z)cKHhu zR{P&#VPWrd}l}uNDfYRq4~>&z_qR%-Y$0n^N_?9vde40e4yeS^cdag(sss0A)h?5 zOC>OV73UzY4VZ+AbFj;R#Bj#AIoXB!-K&8+J~q5vehJKd5|>X8s*jg}c~8YT=rID{ zwwpxXxI@S%kL+?NFm4s+Anzn#R;f6}F4XUyEisfYg?x6o7`S6r4{w)ifw@EC^65c# zc^a5ERGfnz-vBc*KD=G_1Lj96&OzQ{U?M8c!7isu3>&3@U9!Lh)(mf#%YeB-;tJX2 zQD9zFaSnQX3e2}EPSJz>W%n+ZHWL>GBVPx3Az+SGaf&?hm$eeZ0&#Ql7wTWm0In%9 zyj^|)%xw~9luyZ*{N*WNUQ=-ndVB>;QMaP6B9H7c9hkW)&Ou%?Fs&+1kw@h_O=3WD zaIy>aF9X0W{PFO1xdND*B(9KM9s}lO73ZMG=fHfg;uJl|E_)_jS_Li&M!pX68i6@p z#VPX0UwR~l1>%;^E*pXKq=vW41;AV_aYp%+e5pPj0_JHI=b*<2z!QZfjLISDe}lJ35j8WxaG6UDZtIo3~!gSfw@@XjPfb@l3nfw=1~>rpvPOl ze5m3Sd1RMyYhBvjxF{I;I> zrBh;9Aa42Wk_N8wl;Q2N0hj@aGs>srOZ9OZFb}CX2R&W`=D$>&B9H7+bgE0+4HpF? zUk7<}f$^v~MIPCuRbp5mZu#u88n_v!4R4noU^YseQ9dPKvdeYA+^ymq^mrbaH&vV> zkL>aE&oFZ|B>~c9Ux2iY?yKDvK zB^9UWL3a5Jn33y;x66LO%u;cRJhDrJ#0aZ6`wQ(e90%O|4a3{zY+x>yxI%Wh8<!N+2~0r6Imqjf7#4_|lfTe-bTV*teZ$-3Qedu^ zIHP<@zSNE$0p7wC9~T89Uk7>hz${g9iaaV`Mq*eXZccWg z@n{opHJgUF%Z0%FT;h!KIpq5v!2DjtIq30sV7^pwiafH*lrz!);i6#V>maWdm_;g1 zkw@*QTVhxsZu#tTDsT(V8s0Abz+576M){O{sXl%K%oY{rpvT+5e5B$Od1ROIXQTha zMZw6|LEcfo1XY|OkL~fOCut41M*<}@Q2WE%2%Q|5CB+e+Gk}uii zT3~*y;vDpN4wyGooFb3x@(nN(&mG<_hXC^<6{pA}yDXL%kQ|)sLhq*|z#Td;yj@NO z=4^>8WS5(OxlhG8*yUwl-coUj9%PsAf!XQ2;q6iZ%#kWikw^7*yu`3kaLZ?xRlv>t z>F{>h1k42zSI91R0`stnbFj;wfcZehDSD7yMxXD}_P|BK$k##M0$}_qPLW4;X_FWh zh?|pL=sZmdxS1CWZm)XD^ zt>P4U)Q*-(42h=TWEUEzJAvE(qT%h50cL~56|&1OfVoq}IoRbHU|v&kiXLQ_uYehU z@$hyz2$;DlPLW4;X_gp}9GvX(0a99l3tTe1T`mLW28k_DRh)yowGzVuadWZ@`O7)L)m=KgT`mRYdWkd2r{qiR_Yq)T zP;m}=d;-kBRh%M^>@w{#%y)57F!FVfR}aim6{pA}f5}J;3&bs-T{ZxB^yS0b$OX(FZtsEBxBVPx3HNZ5gI7J@WB`z^65Vw4G z=>cx;mBZU*6EGJ@oKZd{U$V=cz&xzt9Q61TFdwKmMIPB@^i>#-a8WSwb&$6J7{7{B z~a$@_o+AsJzfUpEfuH8BfESL%uYWa z-Yylu9I4_Id1RO4B?csie0J#oZogj)Zr%PNRyIc*-9V*VjE>8pVM-`{&L3a59 zn6cLkZnCphO%ih2otl|`TWS4-%3}=@X;3i)`yj>!|tdY1vcF6*BrHXT~%VuC6S8<9S zWS4h=`AWq($lK)xoR`8yAz%5(F4YplK-}`Rqk7=R+&H{ljs>P&;_~H7{mU7^T&Ut4 z^tcO{|4?xbc6l9`k5!z5ya_kCw5hl#m%e9@OvN2h8tOoP)ggf%&J3 zQ{<6dcKX%!*=29w-jLWrb~)ru?1$l^P{=Nefr+X(2R-_L`KgLi^dP(30n8&R&OzQ^ zfZ3+v6nSKqv3G5sU3LNPMTsqBmwkVYbuBImh3panW|@j}(Boua&Qx)V9%PprfO$a0 zImmkjn0Hj1B9H8%-MxKwnE>2V5?jbF(|&_}8e9|#*~JS?vx;-j&MZ z_@e*kv)8ltK4;yvpMAyG{Xf0-zN>TJ`}6GeS?lb*&v?O{pgALt^S}(zoXUf~i~}=S zbB5j=Fbg%O^ytg?j$s}gmM?t0@i%aDr=|O{({wzJ!ouP6r3ILiHD}~80L&$tQ+d#r zJHb4rIYVzgn8lh?dc3~+)iKP2!}5jCOO>C2*OReu`1)nLnRuNT3y05_W?))t&d8$= zm|>bzdC-?z!91inL+=eR?`ux!v0r|44D;Yf^5u7MGoMfQrSc2qGBvPp_qG-u>-7MR|eQ+d#rYr#y=oS`=p%*PNj@4a{qrQ+m7~Eq4s_;7Ic2J8%!bmF~+X zFy-f``?5EfhMF_-I2p`Ynp1humrKChs5wLLF)%YVr}XH{V#m-EjwD~c0ypvPbYFf1 z^Sk4G{j$qDcwQb0N5mO<6oENSb1Dz|G6>8ynltns0Q02glpcL~*D>5bjwD|`0e8o{ z>ArjmW}V}reAT?X|8Bbg&&y-sh&UsUqrjY~Ii*KmdV{%4bB5joFjF+A^ytg$j^X}s zSiUU8?eBrRe_^^WKY{tfaZ$c%Uiz}@d*w0*VBv^3Bac>KPS>2$qc4NOT&p=l??Et6 zX-?^J{}wog`^RDV!t1)v!QK6Sx-Z{>+32_^Ut``KKPZ>k7Yj$k8F{n>(@t|rkG}K= zbG7CSy@_C^YEJ2~U*2*I_m9K!h5hmoxXB-;`?4NP-XfK+nwRw`1XE9QMjmazbkv;E zqc0bNxn6UI-Xmb9X-?^J|2}jK!eCgw@VagVxFxobYwIOnWRGzIlg$8L2rVk4a!2*PP+Y+hCS!&d~c4OqFl^`^V!;ZN~(O zU}gEj>)l4+esZkOmlogRdo;0d_$^Xp(1Y0k)F9hl9U zQ+d#r-M_+yLe-%^AMT0Q0uy z487H0)@x4b(U%?8Ne)3GSXsXC{96canPYvv9P|sG7r?^d^W_XMy)Cu-T9m700l6?6c+|2)``%?LLyx#{4htHRWV2;t8kw-T$ z=W9;oL0^i&+^0E1?1(W?Nlx=vo{uwr2S*vT7WrSbB5kv zFjr_!?H_%<$1$9jBgy9n!JU&Q`{z6UJq_k%$0g;#>&{QXe5W}hk1F|jnH{lkB^W{~ETFT9`M>c4KVLJ&gaXIWGbfnvIm&` zHD}~e1g5j*3|}q=bB*Sd9{c41$A~L-zwr6fC&67(DczU(U=};h=gY5P%2!VJWp6MC zYfk0CemMzDH_aKoTmhz7b4ri>{IFxve3=PuWR-MZJ_NJeaXw%E1hY-mbYBhx(?oMB z5Bky`Odrh|zKjNQtLBs*eR!3uc|;qI`{cx7|H2QxgkE#2I-U1?EJ}DLwkq8_Z>zGxR2anW8zRM_*od z4EK-2@`dlaSp@FsJ<@&2+Y{HZSU945jd>3Q(@b+l9v#7)t2w1dUq*r%uQ@|+8kpBK zXXq_=OppjxmM=UX{Q~ZZ!gOCYgQ;3G-IqFGnrhC-;|ws}HD}~;6`0#JXXrfx<`vB; zJ)V!2ImYJ;-`BSa+?#u)`?B-id6`;RIDGwbG?-H~XXG&u%%z%Bd9YvZ0`s`$486C( zEYX~yx85;9B3N1dLSL%X!s8w+9KPqJn(mXAITj0t&zJ6C25Zj9<7P1TXwJyv1uzRV zXXvd3vq^J?-cI{U4nZPVS-$XdPX~b8=vbdGMf>GtPQ$|C^JNg2t2JljF%isE%^7*T z1?Dr&8G65isZ=|C|MqoEkO)?mFMM9=5OC`p>+|K9I(eD4SU7yXoDb$Q%^7)205e5% zhA*#!`B-y?-UcxF`}_Bg$CsLp2@=67$(Mt`t#+*MdGwYC<#Hi9WQ(7%5?UhM_u5X~8Sr-A9JIkkW6qstvbUpSI{z6RVe2g&~V z`tKGn_c_kz^Gjgf(VUUT8Za9)r}CgLHR|SN>R{oB<~8(=2Xm_Clpg!<0>=b`SXsXC z`uQ?&MF*$*G9JtWj*IqB&CBbs*TB55IU|oB!Thc{rAJ?Osh5|ji-jYa*U)PXri12` z9`|pUV*){}EMIs%bPc!`_0xU18O%M7i}uf$_XRNXHD~0p3e2yXQ+o7e`v!TL{jhLE z^BQ``f;m}pN{{_Az%hX!R+cY3j$Z<ApM%=2gc<`={omFQ0?? zL32hPTOX2_`41M3Bt80aD3}v9XXy0?GgNbG|EPD1V>mB|<;%CYeG0f64o&yvGccr$m47!Az4HEW*k%k^N! zJ1*KkH7|Xc2IdXT8F{P#^P}dJ9{X>b7U%;k9MQanUUM+5HK+8re|;Pi2x4XV!sFG& z;Lbcc-Is^KJmhvA;k+D4zT5+@W0CBi@BH>Gm|2cX%7eaq2IhOs8F_5g3fE0oIFj_} z%OPM+(43)n9+)ATQ@&7d9GJwiRuY+OX zNb-d~9|YzI%^7)g0@F)#Di8WH3e26FGxVl|nXNgc$Nu}mF$jZ^GhB0O|LF5=j^Vr)1!YOmkdP9=xA_2xf)m zj6CvA!Rv!qIFj_}%Yk5;YtGO+8%!U~DPMR$AMF^<%aP>Et>8{RHQkr{!93=;q&(=$ zd@xHjXXLR7O!?E&ec2n#p_()FP6yLXbA~ThI3_S9!IxFIy%^k()6;#K17@M)e7<}S z=1@8f(tT<5V!cG-v3I0&}zGlpgo*3CAD|hUE*7FRy^R^vrZ$ z-UhS8aXw$xgQ?Il-IrQm>S<2p!TPoVbB^W=U#&{B|Aoxl^R45eeAT?HNBJIjJ`oE?#2I-s1ap+; zlpcLK3(N(YGxTl*GeL7okG{-w4EK*C$(Pr`UENdi@I8Ov9p z;Fdbp=X2xp@H#OTj>tbXFMaL;W`O35JjQ~#Q*%m>K2HZTUvq}uDlorl&d}SwH_oeA zIHEiZy<@?gtU0Aep9eT55X8#zna?W^2iLxj%5d6@5G%`|&d6gdm^(FRaF#^!5aEfaa7Q_pg;>(tJ4++`hxp zeHjMkYRCC}nF!`d%^7*T3+5BesXSQUjbOIAFx{8^!5pGFrAJ>*bBxayK2GTYuI5GQ zzFYw2GROIRnE>Wd%^AMT1G7kTDi8Xy4ot<1(|y?oOnuEMJzkHubxfKsoxtsUNxCoR zff?dBpD*LUOwyd;%PcT&Yfj}sUsi+pQ*(yiZkOWuNh};m`$u1nb4&nYWgTCR#CiG@ za5r6+?#ps8-#IR6UiN8~%kwh3VBv^3BabFvT58VlG-v4D3TC3_484~f6YL;X zmM>?+m-oTdyE5IEE5TgvxF}yWFMW9g%=4Nv@>l|9h31qV`z7xxJRZct5zTApH3HLI zbB5m8jtK;@vV2*J+XsO=>FRV}?g8_#0l6$m3Tq>_vH~V(;VmXBjSuaP5{$hb4rgs4*@e;bB5kzFi&gF z&|3&*h2{*syc=*l#gdbU(xcA@IwkJX!vtxaaYmdGW@BhQX5&5U)rO*Aq zT&g)EkGsH3)|}F#&vU>m(VU^T9!%a%{{7?qywEWSgJJo?=Rpnxx5=?SUs~Oa?{mY# z;qzrMm=T&Y^0*(&W12I3nGfc3%^7-sfT=t#egF1zOppjxNxmEkuHY8Y^Z9Zbn68fV z`Eog!8#HI+F%`@V%^ALY1ZK77482OX;`LB09KQW);Fti!%JPMu+c_FsG@O?@0IM zNiZ)uF4{jeFOM&ufLX0MBacesQC}<^NqRiKGyrp)<_x_aUh1Vsqa73JuM?)}2Y0k*wEHD>n&d|FN%mmFDdNUmp>>yT_ zFYn^^cc?cZ-Iq0BHaITISItXbYTTWd*#`?p#2I-U1E#I!lpgDQKA5XCXXxDr=26Wl zJ?`H;$8i5REMIs&`WW2gd(wSb4<_$km9H^xA((oaGxBHyrlaPR9(}nG%=MZx^d12- zO>;_*zI^ByguzJiWd*pW?o0Qj+(dl-0}Dsg2gbYyfH_=qMjmH^>8UxTM_)#OxkGb? z-g97H)tu6!FP}Sxd2m?1@Nvoy;HKU$`T8EGRG5U%zhU9<`BD!|bIlofoDHUr=2RZ^ zWi*((HD~BO59STc8G0+gY}A~gx8wieb5B@&`SQA^xnly5|2IDW#_Q)Ia1|a%_qi*W zevb3`d>xp(G-u>71I!%F8NPf8X1(SNy&WFJ`_{2=B<&yTb|jcnG-v1y1aqn8)c(=u zyBx!LIV_*q&y&D)nVjzPOfauIE-4S*kG=x4PIE>c+fK>L?2d&aNsqo94yLW<488Ng zT%}fgEgo0=<`XAK^P3n=dbab z)4?6~sLadl3ahv4TGyEOIxx38&gb*9VCHDf(EAe1_nK3A(C4kD;&_0CBbwLHI}*$Z znltpyb4(zJmE{ZX=a+(O`k2h?J8#_r=03+o`={n*|Gfm}9nBeetO2t@b4riC)OZ}< zuY!dmn%B@f9?YqlGxRP1GfH!Y-v5DlLUT%wee{lFf*r)l@|pd&2;B2er1xKyC-FKC z7LF)iH7|W`1g53tj6BW((_eE+k3L@yW}@Z{y_dnfr8z@yrDK=}N0KkUgZtvCbYJQ} zjrTWU;qdv=2~1zj8F`EWbDQRjJe~nFS96Bm*I<6qoS|3k8Ob3?1S`uIzD}|?xX&Ex zyI(eW7JYz)!{^I6UBDF}UW_WL}@ocY&GgIG@jRzO# zEF96ihF%*m9W`g@T?poS%^7-+fSIN_rAMDXbWE^=SXn;vJo72IJ7-89zVq)YFuyu3 z%2&#J=ZbZKMusV!AKif?4OdC|_gVZC}Fsps;X6oRP;-U{2JW(xWfE!Ca;}LvI3@ zDVkGy?3dRa!~Ns1eBu4*J#aU?obJnKU{*UW%2&Cu-L9mDCu-n!1UFe;ma5>w`or4(U)f&gD@CLzPtkN($~^`c^k|U$N79&52nKGbYE(Lsi!%W z2YqP+<{Zr#zFZ0Bdd(?4`tpcl#Fb29zf1!+cuu-6v%xHIoX?lFVE)jYk;ksD8=hUnYR-@K(An4}p2saY=d5m-oSZ zsW~H$%zV6`8Vg5~9(~y#%#oTi^g4q%PjiMZ*ElAa7^@^-#(``5cDgV3fqB$%NqNwh zd0;-)oRP-{F!}GK`%)83W6c?Qr-JFCIm4IB9FykD7;wkEo9@f)U?w@v=gTZG3pHot z@jaN|G^g@lzwEpK?_0vc5zTApodBl2=9C`KM?)MF2x67gFIR#)Vqv;3W5L|%xM=^> zyzH0hVCHJh$m44;KWR?s(U)rP;qew0j%Z#(uLYQsG^h0FOJBzXf>_@QP!C9mFch=egiUew6O>XJA%4F3MNUOP?z(#^Wt491&;a zaR`{BHK+9Gb5}4!G-v3I19PwD480e@EYzH#_dS^3G^h0F^Ug~oSLVx+2o(Q7iiAN<3=zOG^h0F^Gq=BXwJ}E17?Hf480nk;B^fw98n&I z-tk~g)tu6!&lfl*5X8#zc^PiM2weN6GOzD>xXECic3iZ7YF_%h5X^GT8F~B(rpl)( zU!_N%YlCT~IYX}_m~%B}=#6v?q=RAk!sk`SgFAg$x-SocdCGA(iuxM#jd@4x&n z@w^lk4xi5lfjL5RMjoBO^wONlgT9OcbEoDEz3E_PYfkC$xbcN!mt9^s(Ff1HCUz&nxr8y&yUSI}mPUS&gZU*z9<_x{rU>0c3&|3?p+_x$Z zLvK$o2WU>|@qXFLG4zEa$>)>7ZM8Dp=X1dfa-7fSo4`!eoRP=NVBXT4%7Z?y1oOM* z482`e;q&oWIFj~{dM&|p(43(+49wM3 zE-4S*kJfmB|<;zUm{sg%5 zzDxII2ADaHOUi@uehKDh%^7)AUyJXpz`~KFM_&#D(?)ZKUOzAwYEJpW>yq0Y!+AL@ zU!KA3lfa$+z3iXw`1b^u7aW(A2YvY%%qq#xnnFGN%PX@tH9i>IU|oJz`US2!mG$Yq)CSW`bB10= zFz0Gc`NHGrNXMl4auc|dHl+J<515A?=ksMQn8lhi^7s`@xsB<*>YVBtvWEBajDF#(8G(($h;xb=?p^>e#F^D>>W za3sx3pDzY;o#u=@9s={M<_urn2lI{Q484NQd70{1eEY|`)dh33<_x{AVESoJ?H_%< z&N0EnSS9&94qV&7Ise~Tz7Nc!j`R6E56s7!GxFE~Cchk&lIuoaYJzF3IYaMMFkLjK zeBpWKGRJUUjwD~kfIBWv_Rn|zy&cRX$N7Aj1!keW9`t4B{QS&;SU942 z4ZRbYR=F*AIw#nGxY8Q^Qh*O9`9fC924vy zR!Kg;2kwSS={~On^NZu6eAT@4dArK_nZ2-ZM4XXFb1sa6M@6f9GnPaeUME2o(Q7iiAN z<3=zOG^h0F^Gq=BXwJ}E17?HflpgQrHMWu*5C+5Yg~z{|;68V(&zFO@&d(f%olIoYLd{e41mpe;k%Cd_C_qaF^9c_vIZhA3H9} zSItXbHh`(PW4bTxH&hX_n#{?5&W%?XU8B6Mv~9Jft$X2y3gD0k)PQe3rCVK^!acwCu+{fqc@nLnp1hu zms`M0(VU_8I+*t~XXyO^CVx+rhoM&!%t4w{di423#~=)bj? zzTl%kC|Xz*PP+YS70`1&d{r|5BdcQN7DWU{o` z6Twy3SM+@6g|1-wIWB2l_RDo(?$Vr*#|$uYG-vqoC7AV^GxT=YFF#X=g(GSIc)vUn z%qf~P^ag^tRC8+oc-*8eDxc2+Y{`vavNiZ)uE-4TC@(GyL znltjKbU=P)2P_;(di13MnBz2O==A_IP;<%`>fHcllI9G(SzzAQoYG?-t#%B;U|2r$ z`1doo#}1Tyef{?bn92wFeWB0$fjLxjMjoew>83fA2YtB$%q^NT^qvCqlID~i`){dZ z5C+5Yh4;&E!97qn-Irg;9GvdU9$@Nf&d8%Rm=2m#dC-?(V6M}gq4yA&XEmqv=*#<# z2~5E%$(PT-O{kad%Nj5n97j6PQ}eQ4YShQ;0a!R9&dB2!Fl{xb^ytg^V6M`fp?4pc zM>VJP=*v9EaQ`@xd|3o;Tm#9&cf9%z%tpsW`Ko#8%Z?54cp3{w#2I?()(xcDw!F;YcL+=kTl@CeZzx^D;JUA?0`1d6b1-Ij& zqUZDFTrh(i=kw(zFcURr|j@O)_*V8e9AXb(y zJilE8?vTS}Uf=QRCNOt9F4{jeFMW9)%v+i>@>mJx7tJX>)_1#R=mRVq(Y%IUOEB#; zXXy0@bG7CSy@_C^YEJ3#{`Hn)f*r&v$>;aM-FQU0&#S=v>bNLhH7|YM{>c2y-dH#y z&d8$$n3FW8^yqV6Fjr{K(7OlB!@v2aBGsd?#hKQNbS&dB2~Fq1W>^yu>(FiSLN=&c8n*TTPl)GGwjNOOkX zDPYdloZ3J7e5qp)1|!Mmk>FY!E&J#5c>Cxv!jtO=Ut0bS7fxD}vTP)pLaMG??=MI5phNyM}ujjIi*LR`+>PqbB5l%U>?z&(&KgZn~vfBaU}WjA-J25 zOZVjqFl!wb<*VkUFIA7n>oZt5BF@O8DVSq5r}XGccQC^>XXxDq=6=m7J^J#BW4M1D zmM?sMcRslBMd`k*1oMmIqI}i7^kutNcwYe)j)*hzXbz^e=9C_N=>z6+%^7-kgLz1E zN{{>ZhGV#Y9F{M<&iM%3EhnV=@)ejL92ezl%)9l8xL(7;5phNyhl4p@b4riC^aOK} z<_x_%!2F-)lpg!#RmX7uIFfvM2i$e7(|!2_%r}mU@>TP)9t9`ic{3~=5ohGl0L+n^ zQ+o8JGnj#zGxTl%bC>3n9(|eN815fOk}q?>UDYPtm-oOdb6k|KnwP%(7fjW*>Autf z(^zv#kG`A=rkCanUq*qsS#wH{zC7U=gu$?U;qm1KaHHF$`?3Vg3di|;$vYYEL&3rk zaYi2Xz%iVwL2}d*JRpE!~&z!Tjd9 zC|_gVolnQ>epomn&dB39FsEov>Cu;gU`A@r(3=G2am^_``tr78xPKg$FMR&$Q*cw- zr~9%2O#T@vUt`{yVCrkm$fGToPMTAC^yMNjV>M^!Jql*J=9C_NS>zam!LWScdHQQ` zlRBjP@-vt}9T)Y1G4F0?;&TaDI3mu-;{-76HK+9G%MdW5HD~Be2J^J$lpc?}3mwD# zp!ez6JMe=X75R&dSeJ$HKvNpl8fm7tE2GGxF#R<~+?QJ^FGDn7cG*=*<8# zM{`P#zI^EzguzJi zwVE^Zs`kjw?1Y6QY5(YRW5)y_R+ca9msa3v_e}TYLNFs8mozW?bP|}SHD~0p5X`5V zGkp0C%r@t$d=0$=!8FmFq1WCqK3{k~>I3f3Ug^GE3+5Kb`Fwc_%&VF+^7tIg8qFDb zR6Y;a&saF3c@4e8!5ptSrN_GUbW9+KRZ_nU1$SESbYC6-^Q7aV{WIo$7tCjxGxGQy zOr<_5U!}*s-xthbnltn|fa#$*L+@(G_ zgZHD;!SvRg;mfsPZqc05n_TP50$3FdsQCDG&DPFJKCWseFw* z_5xE^b1Dz|(i%)x%^7-^gSk#~N{{>ZkYf-A!}5jqqZ#0a4wpQ9uU{?zv(#}uUp9fM zd||pT`+;ewIh6-}IT=h(%^ALo0CS_}486y|ys9}v?{hF~G^h0VI%MUGB-g-Xtde}* z7Tmjz^}T+%$Hn=X{jqTPd@cghL32hP!@yjvIh6-}o(Sey%^7;{gZWHzN{`2@-yOp| zI4oayzpQi#Uhl@j;qzsmOYyuO77m{;ZNYTWoRP<6V8&=pf{*u!ja^2cW{MQr~7;{m}?y8^Z5ZV z&uY%d<9#rnX-?%qpMM8aeMGu1b-^5_IYX}ln0}fw_U}3{w`)%6(dTC!LytKupLu=% zBDiZuN*=!Z`C>3%InL*Exl#E178Z_(Gx9hX%;B0-dC=!G!JMx-L$4Uj9hy^mJpMiB z815fOk}t1=yXl&AUzUUU&T&z`#=KRo&Cl$Dg(KpOJeq)MsX3)bU(NwDOml|btzaf< zPU+E?mmS0XDT zpRi2Ba$%<2w)l}b=CIB~I}aZ)sPEu`-MaVe+@^htcCAird1B|m!#fY^*{^f2fkV6W z7&NT&poWLk4_003)$812Q14+q2MzAre^|GHy*m%?(YJG#0Yis$KBIU49s`CC?%bp2 zu%7(}4D30mbGP$*9MT9_zux`(cInl#f87D+^vN8SX|`>-bMR7ErW)q2eBpxV=SjW0 z4;nCdz_~*TYoAi5umzc=9ejDvP{wDeem0$V`LJZi$$92LM#QrE{}S@+NfLbzoN0hzRDgKjR|(S zXwroag#D^Ea`@)Wn_bQg-)}KvJRDhxJTlOs z(JWy-ECm_nbx;t|IvQ7yX%t0mqNrOGosXyrmV(US=(da9ZRImpBdQwwcAUGdAaiGQ z+Z03x2ETm_Ynk_1MD)KPGY4xHz991+*7bu3tIVfdxzPYWrPLB}kLv`tg{2PKyUW0y z15X~>bI?Vt`VZ+j=v>@KGIG1Rv1m-cTGflj45_vA8EDZ$*P=z;Hzjnbv{BKR&b8{f za*bscnWEwiMI&DPgJEXqrK2_v-9BCo-mts*z}m_OIFE?!(z zJU`g1cq59x3;q{Qwlyb^{}j(%vsclWyMN^^b4NbMALX#*$f4ZD*wv!qezlqu6%VP^ z9Mv!EGMi1#rF>=&tmQ6H3z6K<_K$u`i{-cM$>XpTWLjc4=1zjYwvD3lSR_552G! zZYd(+5MRm@atP<3Gc%&^SB%z(`B zOwY`qOgF^6Gj)+wKm5bTuJBvA?GW5a;@jB|l~gMgxyI=JQ^TcA?yifiGeh>Sw&#@$ zX3{39;^x^S{##}69#_5?5SgJX&_+Q?Gefs2em7`>H5GA4S(BGg%bg%4^`MLF4?OjW z^~qQYg5St(?eKr`uOp(y!Edq3T*{Rjr{Je}B@w;icKMldJ5dWL~yl{eWwX zNcP}xM6#zX5XqhvMZax>h@KW?PD4}}M12v-KKDR06iYY;A&|R{MBMkD!EH4ivdaA| zz|WYGh`C&V1>cc?HMPTG>9RWbR*mv`nevUOhQ9(4ti`cdQ6f4f+Sw#yOIyhB3Zyi5 zb!LjYI`_F;wUJNaM|@YGg#V2=BG^ZFR}WGP?u_nEA$O}0SJ3h1$ZPBHaPE!a+g@^qVkz<5N*H` zj?oCD)g_|yJUE~w9WvJaWHn+&BJSh0SnzgEtf?Ii`F-v-SK*hrtsZJ~)>u&@wz_Cj zGb9;X+CoOHj!Wn2!8L%KABul!IIpPqx0T#_)U0ZwuEEdXYPqO*cizS;-a19aaxTGX zWyhJ<7aY_N51@*dxJNcTA5{!aK5LE-!MQDKHJ7bt4cV$_>}j={N1H7!es}W+*f^G~ zR#Xh2W$|psxT^CUOx>OQqmDBa%yi0};`Vf=m;vD+N)T=(cW%muMmKtHfN0$ zC1Qr6O*AAKTiQYfmohyn2A49;vkG2Ryvbe1vE0F9Wj;7Uxj8e-jRziC<$my}@_f7; zlv{{dLw5`=@1#KCWd|OmgxjI|tOmqf^_$ELRTfyaZ^GIOkz4!V`jL}L!L~yrW#1Q( zl)V8W5_tF@-4Jk#)=X#SJ5U#{cu>?%rLjPN~cZDkYsFW z%U+bLke8{@AP70r~*S{KhP{-~(<9jm#D*j$3;Hka`bTiT)!Q%IZfc@=51=7?CBf=v79 zw%&-Oxo$@!&BarZs62;gK9+DSL?F#25!Lt*nN1*r$1)B!SIkJn=HitkUVX!w+TpNt z=i!&R4G?N`)>u)Z>bOm`sTq=tEo~voRm*)Cp4Qzb;5O!4LgB{@sgb|ZSfhE z!%h$)>Vy+LogkaFES_8BZw28>*$OO;v_fM$5Ry$#|7rBv7$t51<}qX8C%*ymTZOGi_Ic^waIJK@Mut*afz$V z_Z~QTQ`iDRL@iL1bu?&>jpOq|^O@mhcw#pBa#J8xf8%oVKhTz=0Bx3|KvP7ttpI;E zC%o+(L~;}ui%5;jcl*^i9ME)mOKKe6mFBN5Afgjse=_fT)yV?~KrcF{(VQ+7*R z$lS7rj{%CtTw1HJ#c6mpt)4s*Xj%LP9|>$~QT$`^>Xnq|gMsVulL!6gc+AVFaHee5x_Cj$;x~#HwJ3hudOT3b#{)u2FEkIIXy{i9 zXOtne+7%UFTB`$|a;Vp$^X#24gB-r=Ad-{75r}A7L8cYfEM!53&o0Yte6~?e0(@3b zP6E8n7nN5LEyEHHKIbaue~GAeyp+!&yzu1UNg!q~R>eOS zW%UP7o?(9!F)q;`JKnZ-udqLai29?Ar$1yf^hfLBH;RfEwemEGpns`B_Q$SDgB*!S znt}hPxdoZ7(QShfNrOCqNE+mIMA9H^6<)K4qfbyY7GEN&oh5~I$RX}$E+aG>q<27* zqINhe-R>nCB-G}tv7$uGP_(HTl8h~FA^i=K^(+;iLck-(tOt&xAsk*RwqsnPD=zPO z@v~u92oZHftE{dl;x0x{O%=_Q&G2ZU_#@9V2tui|N68oIrHFfC25E(ch@=&cLPQ%2 zGN(tkorg$Tfv+%0D?EotRQNOwAIXQ~%BU42qT1k`Rye?+Y=xMSh^=r%K$D_&I4s?Z zvRXkND}>sdHCB{}8HzSFLz1zjEo8~Z3gKxas|||WQ%OnBAauYKB^zP8J;yyBHi8gQ zBlw;{kj?O1Qpz(3!j-ZWYGMzi6?h1hR%n4pT476{LAX6A56dhO)y7E45OMI43P&y@ zG+W`efF_mw41%S5qv&Qmb_lgOYpf^{GZbwE(OxjNw1q6$3V-48Lsv+bY=J$;P5nA- z0U@Fm@I7n{H}hUd3Z&})uRUy>8kJrm7U8~}(uWV&So)Zeh^2otph-=|5)MoE!4jnp zwK;37C=p99+SCk5#+J5_xfhauq3q{Dwq)5WR=wrpufJ%N{FA#IlPvf}FBj+Cpw|*#}~Zl4U=0^)p3b*@Y-o*~87e zWf!Qd%DyBjyF@Je{KT@yj6^K^Vzca)?t9*{$BGiM?4pezr|g!tkhx{wg7f`_n5ty? zE8O-&qp_!!s>QA2SlM^!b5;KHpoqf0QVFsLfepMTuB?(MFJS z1hBM)%sm49h4cMrOi{Az3kGigeOPuON>%o7GjG`iDyy>Z5|v#d7GUe(wwiPsBPx>@)5P@A*HiW0HxqKzQh3&xhVkXu~#n;=`V?C%wP^jKJSAxc&D za5Hb&1uCnu*Ne(75eu+)V%cLxB9{GNv+R~`9dFrVMTuB;(MFI{c1v5x+_G=M`F=d6 zDp~#pzx`kI_+E&p{J!(OY?gk$7fyA+zk9wvE@}gb*al5=+93OUA2SlM4UP?HeZIGJ zk1Ejyp*ClY6(wRDh&F=gs)MnmE#%)i-%o^e$riY_Pu|?{2p~k%0>1NoxS96|Adss6 zzjnUw9F<-o7NKoU>BECF5BxDB5li1Gph-=|5)MoE^b(~HwK;37C=p99+SCk5#+J5_ zxkrG%aK3*CvL(xYL)+6Y3(GD* zmOWOKh-DXT1UY55w1wQ_vOkF_N|t@zEA@5?%PvHz${ud!ExSNvRrb+Q*(GAxFG(zW z%t*wtUu%}#(!I)C_E=FOmR+yFg`C z_IsnUOT@C@oLKglk%(o#$1J<0dxy8|v7$sQyJ#cGDZ8aDWNz8R%RKw#-WJ81JTLdo z!ki`hVA9eHGvVD|h^P;IFZar3Elcxqub|QmrF=iY{@7J{qUWD{x%b(qF(hJROv!1C z@P$^M{bNQVHpVjntzYi7bRWxV49*k3h|B-QiW0FgL_3>gY-tNw>X&=dUgvug(-?hG z{geyCz7Qhn3*X~_Nx^36j{}5Lhlqdoall(qJ4nRByp+=p;k7#3A!a0EJIo7c{W!qV zot@PVCEp$zD@w$65N!lGj{_`iA^+CnfQ6W*WD7KX;`#+)3kVUlfbVfYxS979A&{#7 zzxFs_c~p9dSo#lgN*`Wu&@mR__G1M&c7e*O?CYblOT+@KN-TTKNW`-LYL?y7{lQ!I zSWzODU9=J8l-<%6a*NBp98;7m``fQP@_bl!Axc&Da5Hb&1uCnuZXjtSAx7F4_p9yCj(_OT;=&c4knnYf6_%> zA$Cx%`TxmJ1~!SBKq5B50Xa=@Aa3Dc6U2-}Y=T1rniStX7!FIfeu*XswK;37C=r`L zw5b`Aj4f>;OJ3yt^+wo;8A>+7it-OO4;w*2EM5G8B7VfIJik>%&i%2(h!-8BaZaIKJ~tzM@2ks55*=h;TFS5kjD{ zIzmj2$}bTMac55X!}}&r3^5}S%l}|Nlgd6qSi1LRmA~Y}!dOuvmS40H@S#Qw{)NLmOWOK zh-DXT1UY55w1wQ_vh!odC9eX%p0PYCyAY)+d$^gm>;jcl+24=KE)mQAdScmQMk1E| zJ+thV?tE|AV?~KrcF{(VQ+7*R$Sp2=J+ti98duprytfNcsU4>$9cU7)fm`wqBLlLvhgvFsIt+iKEnjOzHM?bocg_Jyw*6WfyG(Ic2xBh1}w@w=>Ir*&p2=4Danil&b9EX5O+3R90ng z9+h1pmc3zO*<(f`mi;KR?3Qj*Z`or-iCA{gMvzl>OIye-E_(;F?6>Y$&_67@5Tz=6 zxS6-?0+m(S+ec-Wh-Gh;SoWBah-E+BEW4%K)?4;iQ6iRIv=QW#-O?6vi_6~CEc?WL zT1D^O7ot>U4>$9cU7)fmd%vjc60z)E63ZSl60z)k&9Ym%J-ua*6(wTXMH@j**)44$ zx47)*nPq=!cG1G{-Y!I`${ud!ExSNvRraf+vP;CW4^1q4%t*wtUuBlv(!Io6_E=FO zmR+SSl!#>)Z3H=Gx3q=a;<8_9mi_qO8boi^5~5UP4>$9cU7)fm z`<$rk60z*l6U!bm60z*F&9Ym%FL}!zD@w$&i#CFsvRm3hZgJU1n`Pho*hSG7@(EF@ zvWJ^_%Pvq^mHm^b>=Lo;?3-lXd#orC%P!goa>{OL3%SK*zsW57 z>>a0l8Xn|@C{@|R&Aeq7sI1EVV^nsDSoW_H%N{clvFtyXWw&%!dCMLvO2o2@HiDe8 zTiQbAmOXrHhJItF=bQS+o8@nx*KA~1ej%dr`#ygoo27p}yKt%llHQtG6K2TUFaF8z z*{e`Ke6m&|w!x;HHpu?`P0UEdHYgt`=+EC+x|>V1L8#4HV?~MB2BM81=kqs~wveTI zM_$sKvnHA?u>E!$2ZSvkMAQPlw_b#sd5-`BsrvtGZ_e5+D!oK3Lbc#Fwi?Gi@*{(~ zWnxAmmVVcOCN0?ESSbEW>Ubq*GEo~ulj{tw+trriOWncfmW#huK z3sI`FhnsoJE>KyOy+Ke4mQ*5^eIF?g9mWU^&t-&W+3N>1sqC^_x(A4ELfK_U{P?BQnKvI|sJWiJX!!IDbEvL7zxp~Dy~C`T?M zG|PT`K$FTYyQSMgbQ8)RD@w$&i#CF2FBn_eLgtn|>3pC3Cz@uM)o)*=NA%cEh^YGB z4`KwHrM~}O)K&eH&h~{!U(WXb=He+lQNZ@Bad+ z`u}TZ`yo;3C1MeJ<&=IOx{bm1h#84k`oRHBYATj+Si0wnZo>UPR+NaP7j0^Wd%@V! z7Bct#{};~oZ<=MVxMsWP6Ieo&s_fxr-m(i+R%O2~Cajezri()a2wF+1V&LywKVhee2} z6MT>NWwZ3}+Yqjltxyvt{PU0Zr$wzG5sUJ0PAi0u$!UGeNW@lnE}-?}eM|R=60Hzw zbJkc6Gg=Ev{~K!~UXd{+SBX5LeQK&t-#+7-at zQRyXO5njnD{XTRagQbrdiCFsi0ZnQumT*|QuZwQN6+o;g5lb)H)C~86v863!?y2A} zlzpXH_8KF)b_vTaM5)RiZssk!KxI|-FN0FBq!O|0i=;es7$Y=1ml2v}|01ACWtZL3 zT`IZ>WsemlV%bF-L9`c)Eo~vUxa>cgWncHn?r()<7ot>U4>$9cU7)fm`^KOYEU82+ z`x+?^9mZfmIdU1HS@sP9O)9(WmhMlYn^5*xQ6iRIv=Kym!PwFka*NBp(JcGqQF}&j z&=R6lWe+#=mR+E-D*HCL@Rm1UOT@C53vR1PhcU9t9y1cL>{|!4F1w{$QFIf^9xF=3 zvWs^1UNE+_h0HB`(q&$YYST7Wn->2q?(3l$e&a?4Uolhi6IO-a)twdI?S+WypZ(|e zinw>tCvA&n%4RLAO`F@i+BEN<;}%jiLDEJ4UYJF$^!OoD`c#lP8f(_BAk!hbtuLY~ z!EF<;mJimxh)6zI%fDs55KA~}MV%lK)ppA1gt`vp0U%~1Vkhh!(4?px4oi3U5}gog zbJkcq@VZ*#zrupE5jb0wJO%@LlPJn|Tic0;&4{Ygc-QMWvUB zMK~y@^w|f2n30I3ZyM10AYkb>EK&MUo3qA>60!86jUYM{F}AdY{QC!i>Sp~vZn}QA zu>L|s_4geFWV6y71cX#g@b4Z3+C`lp5o>ZxPA7zSKOO{PMk01X+kn;w0ZX@4iB1T$ zIcuya5j#P&5#$^MENvl69t4b2g7F9SvY!Il+3bY}&KMGXK0}D87kp0v$!7Av-}9#x z1uJDE6vB>w{+a)CqehU3B{?&v5e~#H9BhP`k%*1ZGoVRjKLupzb}7*ap*ClY6(wRL zh&F$%HfN0$C1T-4 zn|dM1*wPl#J{QDa!J_^wv*(MLYnyG*_R$lc3C{^aL~Y>vB4*hv`t}vyA7&O*x}i+J zhaoI*(762 zTS)thm`i_D;GcLY`8eT;#-~MZ{t+T-2j5X4+{|}W5T>k-3J*oamxyJUkW>8d{>b9T zj6^K{lz=9ceN?b?@6ReeLX1$Gv&M=NvG}5$O)|E$h5U<0h2%fh-o)&J%W93^7#gY-tN=9}~h$M&C&z>uUae)!b~4Z%+QRL)acdl&U>sGdX7zFY=u-g#7=YJwA-uLn0PxZen}Hj6`gY56t$k zbl>r|N319j+e5SwL`}-r(iYO+9$D`lPI*L8WOhaOPWSZ*yF!SlD}0YAWV6&q6oRR< zN76&fLfG)nKcZM2HG@QKhGjX;a3F5s;ISfRBw{nH3TRTnNudJ-?5K#m8t{uY7eAf=bsOtY~k0>$~!>5=fVhPse z6h1t^v+yw^5evULph;z4J6O7#N)$fS=B%-zL@c~$^OqsX*wPj<_u3)%g0Va87h0HE{^Q>ciQSqjR^Hx%4)U0ZwZo$v+d4sO5 z-c7=<;>0&_?l`mlCv_%=^%i2*&>f44JJ+fwU#dCdkIkDm#Zp&It zf*||~&nA(|0_*!aoACQOWuDyH2dXT?HdqQW+hHw-`F#=5l!8nHtVtAPilW>2f`V+( z2T_&ax8tyu7Zjd}e)|-nm#~DRLDT>eQFqUr2H3-)yx+%+L~MZi0o@A`wZmcQ?&Eaf zc_SPGFhXt48Y@b~Tt%A{^}}IlA0XOU%~d*WYKA0ZOI!A$T!p+$g$8*8OV?QEnT^%+ zmR;`(8%u~SX{=Bsxv_*O)5dBO6ogG95leiyYXBM@+n&n^&Bi(@pnD<8ZY)c;h10bg zD^`?G^ z^$7~Xrjdw^b%tvInjYJp%LvWJ>K)L%5M?)(rF)jswHqr|l!%Qb+PbkU?e3zT&{)aZ zm?WpMEN$6~u(9-a73&M2YoHjO5HED?RVO^L1t-LK#0-99zWv``sQHg?w z+MG33l!(nF+6bb(U~Fj%nSK59SBie6S@f>sJ}V55DMFO0=;3C*q6<@2MZY~Nx<@3Bs} znfI}dK z7rbSU6(wTXMH@j**)44$x47)%&9Xn8Uw%qhb|Fet_HZ+A*##=AvM-6sE)mN3-`id#orC%P!goa>{OL3%SK*f5%o7 zGjG`iDyy;=pw99RX^B|&4T)us8Hrf-{6ImU+b!Kcyk(CSC1Tk{8$nLlEo~vQ%U-&t zo1S#_&V3$p><-;)hxHa>OP&=7Rg#|-5F)qs|MK≫4`Y#0JjP6vKL`v>1Q6i4?<_T{>pv6>GY+~^$Pn- zh*F)X!p*!VDuHr)%6h`-fAb*pl%Nc36^ZcQ%(1TQv^PFQbQDg7YGq`f$uF^vRSp-AGIuAkoZ@03;Ft+kkSez{$5_S+SqIUy}T~7 zw}lDvEM#p&@^V}=M6^s^goD$F&W>)o0Fk^1cRwO|5$-iaqB0B7QY_)<9TbWMmxyYe zg4@EA7r!rtBbO1HP0=f$NzK9%4okP2=mt%}J;XW8;hZ&Al!zIMHldJYY-tNw4(FLY z&&$tL!=KBmhCi2AZBW&Lf9aU8(CmiGZ@KN`up5Mky21CvRJfV^JD9TTnyO2X1g z#6k>`GSO*_@P3=i2+i_e9?<%jVCh~cx(UaGSWzODU$nFLg0ZD7Wb!egaC3QX8XOan zzr|^ZS^Zw?+P)E1Ux=vszIR^9W~txeB$%rIzx&Rs+k(Qdz!KrVnbA@#nuc+p{0NQ# zF(VP1;MRa9mHo~uOZNuR&1!;Bo3qA>60r$H8$q-ej4f>;OTP0e`{Yo%Mp$k(LdS2m z|1E3;AxhNqfA29}wMyMu-(9 zVk3xl_Fgcyw1xa98eyf`2($Zt5xo~vh*C9zY?j&xf|Y3_yc!gTMV1Kv%{(gwqvsge zjSw>uu@Pnkv~C1T_j%DxXoOf%A~u3(XYU1LOIyg2jgb4cJl~7bKbj42)Dyj;uXPk6 zY5?Dh(&1*l*C&Nh)&JLClwKSZgN2s}|INH51)|3owd6-|Du@}0Son_unpF0S(w6Q* z(akD+sLfepMTuB=(MAyM1!GHF$lU9J(ieTBS@f-!Y>K|ZRftj*J>1M!bYaS>=xc*Q zu;>!e{^e2}`il`3CYKSKMgK0KNo5z^()~ts6N(-yO2ndzHiBp`7+cyx<`&&J_oux5 z9#7^PpWIs2>*SrnbH5N#@qHJ8vRUfe?*&u!|939}^DBo>V@t#)SfA4bJeYH^31UVf zHbGvXKq~tp(9-?AL=%MCoHbUIh)p2c2%-}YV@q4ezjMg1WH!JTbITtdHh>UO1NaX4 z;by*jzc8x$|Jot{KT+W&VhOeiZVR6Q$iDZ-j6^K_&H=6O{g&=_qMLBUJ9e{R8w=z>p(sQA8nzigIz?-xwf|KGj$9~?D-L~Me+a+)B#hw|PZ zGZL{0>IO8a?0dhZTf0OPgxZ`nR+NZMAle9W?){dwkR|W^$)|zhpI1_t@6I2MpW&Mk zcQ*Ur%!4XU3J(H8M19aIeAgo0j$cH@=#!g8Gi9^j!r$|)4nmc(4fezgCtxYaG{l-F z6=aUWnidvhPLFOo4-ubhE6Ci6wLBZh0?D(1d~^OhEa5mdC=E+25!ISVxg2tU`;vk&S`yKK*}4}^&N zz;`^5%~Br#3RcQSD1-&l2z-iE8lgENX@vICZM_jmBixRtDwcxGbgZQj*b?)xgrieX z92Qw3sYg4pf)J%@1lcUL5dGtt9LaZne8$q-Y zdl=$>^>*6mO&ciE5$sg{oXLiJ}+M`>A9U(;25x!TBWHY>M)Ux=E;zg~B z-?l!v6})mJq%=h-zwo0D43cBSKl$PQYlCv}{x1<*<6wsJe%lBKsvJl`DpHYUXB4FqN#w8)>J?U{T~R(q!bWVFz%j)0Wl0K1mw|dKyteG zR|dosSs@_QmZBD8iaMuFWOYE?8^Psvl!`A97@Ez+#FM@_Fy?}Yl#8k_5Fm{g9;&`e zg19Cpn7ACo{RNKL++Pfmiu;RQ)4D^X;{IZ+RNP-okc#^YoO4W;pSZl1;=l@OPrEq8 z5BYDEzZixU;_#}X%U>Xn(|xfJ2OdbGHoBT3D?CDKOX0piAg4`a{RA^JgJ|@HfxBfR zFy^SuZj2EiB1NF;=95UPoI?;)@;`Is@te6J?c-!UE0{3VSzo;Q#4xO2{YQ!}-+YqO zeZS87sEw|s$O_g|TZ(iG4CxZLI9{; zzQHx8JvX%rS1{ss;}JF1mOr{Xr*qoeiZ0#YIy}2S`Sg$1EfDiXL{s~dNUPkR5actJ zJ16;O_9rW(II+UuFBWXaP}?&ZaWV`m#A$g&m-i<*-L^W*i~AE(WQ90UTMD;7$!QZ= z+@JUxT*Ey~cpbC!4a8@Pdc1-?BJ2LEpPv2Q=spq2{i-XMr12YwD=uLZR`P$=zLK$F z3IQvGV1Nt3D)2xSgupPY5P}U94OH>UWlnePx)4NdbTvg*2m!UFa2Kp{+C(-rpJ;GJ zVpKK&Ki=SXU&R0rkpfV4MS`^ID-r?IO;;p#OvbZ<1)DqL+cEC4z<9&3g7G^j8mMdK zCoVbNt*Kks;YV$BHAPl1p4!liNYpuPBK@;}CMJ<5XI)=%-80j5C?b;URg=g_tK8`m zRC?0SvPtB@Y6UE11q1e?Js4qG;*Qy4h=%RM6 zobD*<>OMkBS)w+&nj$NNh1x|V>YO%_y!J3(Z4r65!y@u-heeKFV4}?w?BY~0G<-#) zv+#km7fO#9nlahXtln>@OJZnT!&!X z9+&EG@)MT})jWiN6)Zc0h6YG9(_@H6P%cn3P|%J`PWN2uHVBF-vO-X(4b8X}sB_vx zHXD@iY4;8GF6T%O1O=a5JT@DYZ7*13S_}#iDJWH!xk+p4Dkh=alQj9_*GjV4L*%FV zJ;~LAW#IyDXEvqC^Fqmfc!iPm@w(Fn-3iU#Tdz{8T$y_&ij5cDx^{L2(s zAt2N)B2nkGiOgNaEMCKKA7Y8mc8n((SA-n+OBjd!X0i0;heUMc5(ZU9H@<=q0B*in zx`KhX&kd2ERz3b=Xj*Hl%Wn)^Yi$ep&2_sfQs7aYKpAz2&pYa+6vS;Z6d1=P~}%q z8h;=6_-sDT{N;t)#C#Bu@=dv# zh4M@#r#qV>muWClF-2Ag2eqY0^Ci?dZ6b3s6+7oC?mt%;;%Dtj~=ftyb6_gahq5h(&ym&zio@=_T=CI4sHrLwh> z^{ilhKWBZsoCWI*!wS|9RCM`LSx&cqo%K;0T}_b{tf#gV?owG!o5#YZ=4TuUW7`sQX9m8wSWRD>l zaXL`Z<^4%ccUYa}#r=sXvO=7wUEB)PIc*|met+_Mc7Jl_nOi*<{U)L-`;(~Bcz;5K z_kI@dPfkezV1)pTZ~=(VHUz*htPp^oD7w5q$>|;!bo2WYQ)GnzP`kW8$!VWJ?FRdk z#@f=v?N4&r+={qADITaAUR0Z!&DEq0<{TMwMMPI}MU{$+Y5~xl7u7CTI}jOGh}GG_ zehj%?a`G6W5v$7-jf-Bzi)uOD^MbC$DqhY)S5st#SWz1&=*K0eJ(k*qST&~&&4@&u z)8#}!V1QY3$|l;{b9;5 ztPrQ$6kR?{<#cbXv%GkiGDTL16Sa$5fjXy6WbrUHQ?`Gawf(6NemywuRfuTH_DHL= zouKZr{qbZwE7*QtL)#6*3bsF%wLPc%V5RM*$O^VoTMBo!lhY>B+g^V`toRyl{fz+^ zOP_cR9oGQsznOU5d-mNd=75NlgWW2wp+_38q4TPkyiKM0B05RT#W(gU?~U@1#T9uh zPs(q;wli6(cjPB7Z>Vk9Gq6HLo~4xmQoJ-~7*>eL>xu>n+HuM0zC>L;7|7K(S)w+& znj$MigxWYO%_OPI9ubiOQgsoXv>DzwNLXoCF>5cP|0{)o z6>NFeg<%zpzbpuhVOSvypC}rr;zjhF?({+!cwsDRqpK;hLKvtmg}aEJ( zHUWn$@oMk5iy$H;pz6X{q*Wd&2rBtM%Px$~C+_hQIV+e@({;E8izOb#VZC8k39vS= zqRTUcobDXdEldidHoBT3D_Bo$DbiM;&S?|r4;3?U{i1Ky_R*jIesr{*h^B0hv`X6v z>Mq;AtyaKNRxqG9?ZF7k60PwVq6Ju6R?%hKbGl1Vw}I`Z$O^VoySNpobJ|3D+v{ft z^*8qvZUQ@7q~pCkZP^%X|Mdc^#uyNhVo>$IcG7rnPxbrSiDVXS`=>uajOd z$G=RG6=FecXvVETozo`rzxIMzzicc9-uCeaF&0FmSX8}WM%s*DFe9$CgJ?7__-0-( z+fFTl)vRF5CbSJBFH3x>%43KYU~OAP166#%ET`K^-NIfXYNM+uvO*lFEk)W2)H!V; z|D$=qfNTV&wLUu{Mu3PEfvR~yq*Wdu2rBtM%jN|Ks2#AC6-?NT7GacSDIOpU!%BcP zxieR07Ucs(PIqtW7Oaoj=xU0rU_G^^NLztAr%j|kK+MFvVBM_kJB=Q(RkWRmrfiS2 zO4|wQF57>oR={>vFyIKQ>5ims1KUlJ6>O(=aVt>gw23U* zUcCI=_;u2b;J1IB^viqqzasigL|3jqN0r8}YY^eRpT)0hT&$+RTviCcsWb{>Elcrr z4a2Y!VC^DBmtWV&>7EsI?E-YvMpsj0g#b{y{JKU?dknP;;c8A>nxsdFI;YL8h!>!n z3sz?~Sl9Mh`R*7jBDxZ+sM0uCM09JgZdF4NELO1iiVy${v<f*t>jPve=SMj=eB5V(6nFr<_v zUWN1+q6JucRM9};j43WT-TSGlp+Fzg#=lIF6&@kAi%8TtZ6d4BWh@}o7sD@?9`R!M zZrOlb+vC;r9hF3+fDEg+7*3kJ;VHaHZl>NN7s%i2Tc3U>51psKFG$7H-{++IKz`!# zn%amsu!4C{)7k(jM#eC#1Xz1j(Lg~vE;-#7sjHExzbI~stPmM$Lo;p#>YO%_GrlN3 ztnk$^_`0Z}`u#Ay`h7SR%J`T!e0U84Bky%wa#%Jno2<9$nsJXpL<-Cg3W4c>VtQL; z#{|+o>^1+X?N`WOq&T}BpPAFE->dPnAwTT3z~J@)3K^r21-5SQrz^8>x9q^%Eh)>r z&xo(*6PkSS&0+1MI!E8uezN=nUoSOO-f=nXKl^&ACq#;2`iE2u(|cIgBEQ1&u^Nmp zu|k-p()56cU+m;DL<_L?k)nZuc3g70?^9R9gsrhJjY3ybWQ8zMyNE=c(7wROT|lVGja3r@NA0qfArliV~U7KDXO}bLfVY4r4Z-mKN1U><&Tv2 z^yw5EZN=~;`k-Qh3udzgJ zbTvg*hy%5yaMx0D+C6c0@K4XaDJ2hs8_~kup*Bx@@GC-h5mA zx-3ZyNVmQ&yNp_g2(W@-3)4=xBTL-*dkoQtNt>d9nhbbYa=MFAx4|LE6j>oA)P`i- z3e-7mB4>OEYAYOqN}uR*mPq5+GeC|#qp}G(WWxo29uq=DN=VgSgEYP{TlEof#C7Xl zV;!{!R`)4hgaSRoE;D;lWcUL&VFfVvuo`n`rJvO*lFjSYxffjXy6 zWaGU?`2bQ8g_E;USYpw?trMd_L{m{9ZN^a`u3Mw9joO1KutF3%Xc<5RE8o zt!SW%QON0TPTdAkFhy2~0=1<`TY);KO=Nu(X5y;s8QBQ@^O;q9#Rw3QB2aZPKGG_$ z$`Vxaf0kX0-%ss;t*l`EF0=@vEKBjKtYKKe`h68$zABs3-K);}sEw|s$O_g|TZ*(5 zsB_vx7O%?A)NOoYvbMkc(GGV;+lgq(_DHL=ouKZr{rkywRxseOhPE4q6>J}swLPbM zbfxX4$O^VoTMB1;PMb(?d;N5A1ZM*A!{_CFt%Voqr%9X6GcRpF8UL5h;0Q@rC7xma zbmGX~6RvosclxRtA|@U?_nlvT{q@)HT&=v><#(-9zNKWC7DAf0^PHX9hb88z?Nj70 z;X0RG!;nuCI<@^#SvC4O%pYYpa%%fT`DeJ#Pd*Oh)OLLM4*s~V)Z?X=a)6ZMSoQofM<74Eh>(=MUnfI2X5AD0<=wsTp9R0(7TaNyV`=}th3!p<){T-17a3Y>U(0Wvxqe&DRl^C7R2#`pTz-~v#|mmcak-1HzhjqV7*@#L zxrzpAnHlJwLEWCS)p`!Z_Sjo(DU>H`&=hcb^s+jwn?q!91;ysFT7mEJoV=zTlc!bn0 zB2nkGiEQcHv(|UyBDKEzFI?-p(?Yer|3p5+Y-ngaJ^BFG=Q{AM?kBVlkSlbfKkwDg zzK!8*>3~xu3Coh>LNNV>|JEPe^n-YmBqALptL|YUO)kpy>i0s!Pe5!#NQmU2a#+0b zHnM#L*(**I9;s?*R-yZS5x&!|~tzR`}E{?(^oTzU)@`POmdX zIi5d{&xWGorQzwriik*|sJgM4w0M~|_tAHqNCaV}$y1|?Zf&x$3ElgWQ9jaZD_`=K%LVjvZ-^X2A_y}XEp$r-#zBsxK|(|1)%B^QAumKKj?t_0ps3G zmwV$=UwOzh9)m#Rv5Teg+opBBsss5IXX9cyFobm0l1`CWg z46Au%-Cq?A6tv@#(|x_p_^6GprpOA9klN6UNYpuPBK_1kbE4e9^ojD|>fi5jR$I@z zqUl65WjblqrUy(nnf_HWofU?EdPCCGlh{`CyqMD+G($Js@(Ks=D)7tT-h8> zPw)nO8E~0m+#tX2lb^V3r9L1ltdOUT=uLnu7yj=tL?cf_6b%%#X$>YO%_#UoXh?g@B3>;Fyt&PiVkMnv+z>eW5cW_(Woais(_Iz7ShgR@jz z)WRUO)&|LM3}I_+*R<{sspi&oW92tvfO}}f1Hs`$WwQLlWgoQ$7PErdPP8jPRt^96 z7@`q_VTuN-_>xXecMs|oVi2{_)f8Fb5mH+U_mWOdo5=dplX#K0{OVrCXVXp1Mq$!+ z52d%-5Ybc=NSkpKi0jrU9G{}V3Z@*=FbalYg(w`CjY3X$L}e6AkrkpqZ7Ez7a@s^T zjza$SkovdnUn#wCc#!LxOHR*b;?fhYJ1QO?h)9{J`aJ(gOSdZG!l_&cmD@#{`8E{oLh@`&WxmA)=|ML>i+aAFbWYUWKIpfv8MK zQDKFsT;DJ%hGB)M+?kC^PWP6|sF)%vM1|T?xTxf`iOfYs&v-lH%PODYWt9PZS*5L4 zzkl}X_t{kFToEgGnC;INbA+_`Ck2=?96{2 z*>GG!CC;S+ucpY$KPR-e;cH{Q_W=BnVU)S$vhsU~R(P6Xv|4MM$ZsH8YrCa&hf0Mf zW^3&i@|(MkyQHEDjyzAuPh6fFvQeqSa$ZTZ(Y!pVl zx74LE3Pfb1(1{I9QRtjN+KgwY#4!p3;;U=3_GIO4wFfq{f+;W3GCU|*;t7Sv5RE9j zrReg>N>2Ax>NYr8F-2C00=0`;7^;RXY;$vSX5-h4z?y?B^#*)>{F6&Tr1gT+#WbGCbfRVOw_ZXs) ztV0xC-eu)<_YS)GWSJr>B#YYRWaYH?r*?y6HP$XZLex2JZbeL%y--wjb+2#>csxep zif~5=oWEi-XYH1IW8jEL6YrhlEfI3__W*2QItLptfizqIE__y-TolgU5UXG68W=P4 zhIPABdqe3CQ(9|V%5MavwU+xTv}@%r+@U=#6?bTpq>CZ(9LLQL*y z7!$*=LQEdb#w4eEe`QQekriS>Z7JNxisrP5%*CX5YTxk7O@?KUQVYEC-byhJM0DjS zMV0)E3G3p;gaB~2=9aD);Uh4H$j>+RjlplH7_dSNo^~--oh}f5QDcAeV|k~ z$xmGPch7k-=-NRlYNM+uvO)}~4HWd_lGA>b+J%EubK201NYpuPZiOABwr=lPxFEge zq|U;v-eW}rGa$JHx#aL{wvN8`y<1|ohzQwQm#-n{nX`UmS!#Le26~lJDRQF;t z!_p_ki4}~UTi3-)+{*>8(UH+TzAzM|A zfx)a`M;pzO3d<_|pB}Xg!wMl-MbSXr9+3E7PIr0g7D5oU(bW`L2{>p&FCtOrw7C`K z7rV00|H3imG*OFB|C6%;Sm)`*(@S1NqySXChm5r9w-W`7o3rGe{e5L4X*>o2!_um6 z)5V~**0xRS_K}JQlhIP~*?+xMeD+@}Rq;J!o2nTwo)y&Ara@9+Y3Kjcc*C%oSN^t% zqJe^TTynY_P`6-w)J9iRWF_FB4b6x|ozv!4_-Fr2?DWsby8gjihkYyV^odBWSMBs8 zt#YSNQ0YlO%RX#nceSEb29p&G*qZiWgk_1lTaO_cw(q8Bpb)OOfC zaE~DxwjZHrpo+HVbca*7f$gTqO29!|inJA|bK2aBF55mfYx^amhCCB(C!#6aBdyYQ zg1XE0pQ;tGlof0rMSC#9vJ`DM3@g}vs-nxb=X6h`ZUfs*k(Gdhc5y3E=d`&MUAFy- ztnG77+cxdwiD=69NUOA+pzgB$614)hvx4pC(jJVkEJfQ5!wRNc?56j=#4XcxBvbxxaG(Pi7mXKnxW(ewQ<+D=4Mwnti}?F4m~ z?T@Gxu$>ibzl-)@gk>q(ZWvau{b5CyZO`dWq;3P-O_7y=gLZK%Q0KI{6-4s~~ zIA|BQ0(DNCThV3PCuVJ*W5egRkG2!hl?Fv7AFZ8r=n z*#1vNmu=7KPNQxE+f9*`fP;2%D^TaOxfNZu{n4!LPmQ~H`Di;4P1zo4m9`VqUAE69 zFJJN6KP%Y&WkcHy!wRcZzX7aFZb)gZ~yj_Z?)c==5j=Is`@wR;m04wNjOUG#}6X960E4wI9NnZ zV3{H-1dH0`VCA$Aq;`W~HP$XZLex2JZpF+6YkD?V&;Q?5hsIzL(Uo9DmBzs$qFaM? zrW%6KutKno3jx4D`(PP{6@qn!qRYX`>7EdD^T9GjRtOfg%fZTN|Ag8Ng4I~N_y|$w zw7C^ASh<@oi{F4K9~&bd>rl8y_iT~HtJU(^*Gqnyoe^zw&GdAUi-_?7H&_U&Y-I5h)H;FJnhq^v z;<6wjhG7N!Z&Nf-*UL{_a=JGb?C1O_YNM+uvV#58hGs;f&S?`l^AqHr!EZl7eskc3 zr$xVs=*ra5elk!#3Gio`?N6Z;Jbynu6f4LbzTE zA&^p*Rro*MyBLNQ!u3~0168~!E~oo?T>zpsx|$*@gp1lzq^&@m(Xqb+-+nRecB_r+ZR5nVabP^IE+9Rc8Okt`i(WYoeQ0LNMk zOKWX)`3Z(ZH}m1o|raK&hY|mz?grLDvp6QQIq$i^ocBpr9X@oc4m$E*xl@(}re5qRwe^ zE8>BssaW;P#%kc5ebOhP648}dQKceQ0nnYXT1)LfWLUxAWrO_~W*c;mAsVq7sOWO6 za=QJ3Za!9~$O^Hdb~#o#?f%qm5Ua-8#Yc!br_HU1v9ioLo}i_MA1M& zJ1#lh!FBdWZFDt7R(OQehGs;f&S?`_K4_J1=^rg;#f3Zie=1_p{&lnVKl%PWTSohd zNcL}Du)hPFmF(}BK-%aRMn94BUf&`XAa1vkJ0_|<2^7g$uAh~`KlAAxWaV9f{T`4F3eV2@q@vlFFVO5& zrNTh9);3M+c9e?7?k`of?Zs#1kCN@IpnHh39amtmz;?s1g6$_L8t)z{+Md%L5p;1N zftt()^fw=kDYC+2r8ZE|k4sMbIBM&GWM;IX8Mgv;PMcfN(%MpM-9&7jQJgxnaawua zhx*4j5z&P>QKVs<_~-77(=XHp7{Cf~IxX0a;kCi`7@`rUv5GFoDW`jO(9Orm6j>oo z)Go&D(g3z#n?o~8NDlEkdc7|bvVBMzZ@&&t` z?zo_96W*weuBONekCocx3wAl}8>wBG@HVF{P0}Moozv!4*o1c`-p96E$d{k$ZnNoO zE5>{gk>)y8F91YZABobB8w6%UHn zOLedO#N~0d0dZmlwflnY#KcSQ9z!(Z^q8W7f_7YTx)0V_9<|Zc6j|XBQX85Pi8`lE zq?_%`%zM^{Wo`dxofEH*wiD5m?U7b#J3-xL`y0u2Rxse%hPE4q6>NV!YkN-jrApgP zkriyGwiM3xoHmg~+nYO#49^}$2Clxy`q6J9x^ftaDvb{#M0oFK@nPhv6aZETz`HI0 zad(X8yF~;P7k{I!-y%eLI9{;K8)nFKcRMm!$@OoY2pqeIc;u5Jd89K ztP$B@4Zq>aPhzl$=t{7nO59KSUK$lsofx0jkTpodW5KR+T4nn3)ZM?ur7La_^L5jM06!sQKfOP zi0IZ}t)+%wZ^R0rSvCX!18u|ZF+?L+0~K8kR!+BH(9H+S6j>oy)Gh}rr`@004T9BJ zyZ8uE=d`&MF<9kGe4V()*XYidle06R0r!kwI_8Urre;8qRyhMA$Y*NSO?O)r6wdaXHjzc! zb$$}=d(`VE_|hWzwxSQFLJxPOoG$;zrC!|kI40}+uP>itujo4wS>K03FJw-$D(Siig_i)Q2zNZLZQ8b|V6-A4QHqUeWONCKst*tM=;Z$o4t+{SLsd%1y zu2ekF#S6nc&%Hsa`{XAs$0y%eLG2Ld`|<&br@LWT!S~}74HUHFlG7bg@Ev_>wWy7M znIbDZ8fq7jsB_vxw)AeT^&UQ3ZH^sg8`0dnbZqe3UpL!raO+FaZz8%feTXWJrw>H< z=lm=_;Wa162n$C>^LeCPZ5G1Vy!dre@u|^dYqYQDKER-5G4hqp_)h#}JJ;J*epN zyfmkKU!CQ}d8sL~LY$~w+zQk=Z6doqK^dR*eXHA_-!S@4MArAA*sA3F&r{Y=r<8vIgUh?#>WvN{BwR5Pf-4q0>BE!yyXH=oS+zn6$0>yqRYpT zobJ0pH-8*4MOFv^wadqmoc45TH#m+o)|Mu2f|AqbR>b2-a}$(_*`+XvmkJplo`{DSwSSE+VoAst#;iI#6{?h_uQH3PC4C~S=$Tu zM4l!}@t(*jS=X;R>CN=MQ6iG-RiAQ9TJ@(K2h0p_iu`6i<#^*{IxCpIhBLh#<17n; zVHj30eIrE!b*=owC8xV?o#{~88jErc+xAXL?SX$gZ0Hde-#Wj_>nG zG@Xd1Oed|{^nmFm(+^Fivx4b+H#FTatYG>fS<`d6`&XK7imYHdwWV;T=d_6|n%>-W zacZ#JpNBks*kSWUyNT$^bTO(lo-PvM5ACz~JmmBg09FXVNEd+Od5B?HApoZ-x;$OX z>HZ+-=BJCM$O-|Vc6qv((>|Hn4W^5YwWWzW56NkBE8=vqxnNDt2J7};oH#lLi-@iS zE2=aO77^VVtY51km>;l0u*QS{V9;&YJ%(rm>ncT;gO$_0DCp*cWs0m2ENYj7mD9eI z+6{u$SiATLQRlR|6){-Z32Cq2eLfX*yrOr8{6Ee}Kg}Me&ivVP8^nAOk&aVa7T&JW z0mZ_32x;%{zrEo9h=Cp|{9;vc#(Tg83&{=qE`B@?#{jbdl2g_f)b6LkF>64R) zNd9kC@V^rqn*8saK$^Tsue16?28b&qpwTz);Bo_B*~O>DV31mCgXA}iYpvmp#awrY zRCDXPvGSX*>`su1uk79-)nxgJ%abVvte|$ki@~Y^il`Wd6=Lv&qJe^TTynaP*2N%d zqpK;h!lR)!G$RsqPMgRXy-iQ=;c0MA+B2JgPp^4DecB%pDFIdIq@-2PR0F1)W~y%| z<5|Ii7oG9#7;9NzykS_u__q`d)V1;xmz?gab;d_+bTvg*FrM1bj7ZcuZ6b@$|KfzA z;Rg!LAKdm6)oJtmZ11?gC!#C!393}Q^E&{X^QC#}H~oPEEsMmqrV0m2QT#xGobE?K*QOIu8(mG273`;W`JLZ6?a%9?)tok(L?r5*Hn*a3I??EU zz`og?$qK6<@I;Ik5ou>q^+uRTtDH>`R63T-vM+S%lj6h*#?Gzl;#Kl^#7CSA!wPZg zt!SXGm!G)gbmymTVFnqs(bW`LAx_kWW<;XSX%pFKZ_@aUb#2+*$=>fh+7bOGqAR1m4)tolAHzHBzw7C_P`;!K9lYZIV$z5Om`QsQbBGT@pYHmVW z_1q+2+z~2wZt~4sFW*v4z@CB?Y~3K3j={BAfyWSyFm)=rU8>^TB&WMco#9|%L03~` zg)mVYh=@d;(G6WL|k*Uj4gQ18L- zMcavJ%JxXBw4I>tvi;a(J1ZD4yrJ!eVFlYqW^K>u9#Lt#DYAm?)Rw~8p3^3>XnXNY zr19LLBlzu4MV^{AJ$>gd5nY)(M3u&K2O_-pvv}_C^ArG92*8Oh0P)C*=e=QAApm0( zeUMbexkFC()S#Q6JD4IX1c2J*xkFC-ENVBHJ2cjoCT{MK)8fnxydxSH+DSfE zrugaIgGPV0<>=|1g^%w(NA%;{ScYaJap2-vuy%tgGWEP z_2`E?t3SV+P{yLk&+lGInhlYk*4jq$8$;Ks|Hi?D4|1w2Zc!bmj zC?Zkkw291re)oS8klnHYnQN(q7K;HPqN#w8)>J?U{T~R(GbtdfVAaD717a9f2*}gf zfaG-lSQ!vgWQBlGTM8GDoHmiUfHXHp85V-z=P3Q3yI_tO1R}aJM~Nzp=O{$@!^kY2 zqx>TUffa)AXBULx9K|rK5QO&?eUMbeIZ96V&7hl~qnIKq1cBP+IZ94@DzyuTsJPvD zM2)rOk8X~V)8Q)rLuCExZ#@f=v1uLh`t(duBjmQS;(0jkT zPTXS=(Uo9DmBzs$qFaNtLJAfu1Z!cMgfW*T8icuxVOSwp%V&d?(_Jj+=J!~p$O^%t zb~#u%?KWyR*kd);mL};DqRwe^D`qZOqq4zT_{4j@jKLzJE5V8?je|u*w+3rdH3Xqy zgL%JxXB zw4I>tvi-YLLh(%T+SxeFf=KcoB4 z#$@duKCI6lqy0oA`>XChBW=d_pAlC|z^uLh?58OPtPq1yE(Y<=FFgAV!wNAtRnb5d z??21wo>&)ysEw|s$Oac&N(q>?$NN`O3|Jus zQ(O$~dO{;cTo@jj>fd|eEpHoBT3E5v}>Qn=%NPMgU3<9!#RaA!6O*F1Aw z@3VwnqVUgb6mq)LDx+YEtPlliOW~rB(yY2DuC=y{{N}oYrQ!?n7fHnzT&sr%hD+btf00a z4GWM}!vAr2FbpdMVJSre1?{-xbo)}baQ!c8qpK;h!lR)!G$RsqPMgU3Ak4&h!IW$Q z?%D3fC1V1JNC~Jq9gMWf2_iuy|7Y3h;9ALgRxqKTvp$}(!Ft26g7pIxT|OPm>GrR) zK5C<@DYAm~)Rw|c5Odl@{>Kx<7qj-idd(J_M*E3K_E$|1Nt^MZfVffuX6*!Vs}uuP zFk~YagSfj!3=G2xF&Lug@}VH7JGd?eQ5#)NkriS-cxKtxkfAZ^A`Ag)`ZuuqBtE10rV!zdVr6{0XK8-<+i9+gorMOKIcwWV-T$Y~S# zUx~uhY!n{e>flvk6o_al3Z%_A3dD756pl|(V1+0g(l82!VTC9hmyJSBcSL0rOpz6$ zKy4{p6mr@`HjYC6F3v40@8X=E&BVcHFP+{mKt#$!)m@yVZQaaWoP;tK-Fg@2IVl{h z5RQ{wIM#+Yvfz+m7*+_!*@_0Lco%0*_q0Md(8q4Q!@o?C6~aO7A`*2@o5Tt3IXW6)j?$moVMgO#M>`Nc+3VIXI8!|#oP;rYdrQt|v^vQ+QLPh5Vj_8|tW zVA@5rG(d_`F$^n2X{8u0iUTXybia#3JY&E<#W1W8hbI&b)E)8@mz?gS)Gb_(h}!6C zimVU^YC|(3QRlRY?83aGbXYk@^y9ln=Fetg-BW&lOw0rkDHB!u3et*4l-$9j4PS*q z=>NdJ;%zky#U0!ACF=fR;9O_A4uP9PegLR>a`8hIGLz;Cn{kj{~KM|Y?GnjxyOI=wT%^0 z2v{Kmi@6Z2B5SbVkYX5C2*L7-2CDelMozb_E(B2nikJ{*JimYHgwWV;+|C~0F{`v21FMmnqX`&iGV{zTA>qp$T#PiX0B9iM>pJEef zFN}U7H&g7uOp%xwn=T_3p6_^;U`SeP>&kBoSZi(Dv~C}%a71mbjh5fM)^NR4yw-57 zRCmiyTy|6=U??l7ZBBCnq&@uKV~B?7J180`XvZa|yESzSJN>AQuBONekC58Xj7Zcu zZ6dwtjb6nVH2Txx=MS7ElF|K+to!@!chy_beIkSXd zr?s}0{ALUWNyQlKn${g6)!g#aS{p0B8H2{3uz9dr1B+QfZ7h}!6CimVU=YD?h`Ejeu>%ZHYkdi&h4Yy_@2@YM7<0z{+;RP6yG zt#S`QP|5#Uc1H0?vYr)8xXW1|pQW(gFsxwx!-_8N0dl$%>#UF3=xU0rU_G^^aAy=b zZ6b?%faYct!-L;`M)BC)FQunE5nY*4M3u%f3L?Dsvv@}FmlOb2uwse}Ks+)d0ES_O z0KBQ_@{A&<`+U&N&nQfh6#_u*@{A&<{by=7m{By=mL_gSk<;c@#2H0%!5Wbb)>+$J zIXNCni0DeNqDtdn5z(!|`dSS^Xjmaw(?S3+=r-&gLo|Z*Z$+1bmDBxa(9H+S6j>oy z)Gh}rr~N6l8w9JdcJUFS&S`TiVzBHb_slD*4eswA6=LRRthe3u&z>=6M5NuDn1D0ufCGfwUQ33@5BxgRpW6 z0xMXuRKp+`h82RaQZ@)V-S)~Lm?A3#f!b2IAmp@(tPeu-S4Gdr24MHie|uRB01+tw zRaZqLt?H^MF(vmi6Ia=PegjuU2PNZK!T5pB_;!rDEZ74Wh82wOP&822%1>N!y6e{& zAGOid6j{M|YC|(3QRlRYbQ9P8jy!xs|AY6RYt*T=ufN8AuK)f=AF$uZ;|_pEi~RIx zSskTY`tN_hzQ-Qaz9Ux3VNfs+y1(Ne{r5cvpKGa05Bc4rrQclPpYDIH;a|W&OWr^c zer(MivSxt%*qXEDU+cOxnO^=r4L-qG_dVbDP#NRFv7M9jpn>^C~Blh2CYx*5Dtr)!Mh- z7B3U(f^D9|Jqo$^Qj{0LZ~0kqll$Zqkw{;PCe`Mw;Zb1OAgnW+)aodlEvF5|WkVP@I{zuyw z;zD?j7VI^!?0^5>pWrcYIV`Y%;krx18vI=zX+cN5(-Fhp{&d{8_KY04&Jb9@%vL-6 zfWwbDAjU->yLhqsnxM&o5%XTmCu@4N$Y#}g%g;T1zyFGj;j2M;zPd5Qt2;J^lb38= zZ@x5!eZo^tF>VZdDQjW*jpd*J-u^en+BL8gqkkV8*5Dr;pKINk;`q!jm>w~82K zPwo&owc1001q^jojN#|wDvUF7WPTmlYhf`b`qdFwz;NA#Nhhwk(yhVB$GscI*^fNF zexygs3A$eHGFf|1dCIrQzp&gBbQY`|`Gw@KHuA5X`t=tJrjh5}&$XIj+{k0hd$h!n zKYi2vJ~GypcoNH^7_BY{Yw!hV~3@a7rzQD#kg%=Mp@B|zy09gqm1=TU@69p&$6!9)J(%ah%`;}BM~!uCU@6A+T25Kv&w8Xb)-_?ZV$_RxEWpTnFP2xG zyX7}X3yipPck|-aptF3P7b_?$dU3`@-(7V1fu$JNYn8;3 zqPEVzrc5^0If11Z^@xW4y+ve4j6}|X)(t%Tq^-*9c#*NPa*XzC=FWTH#OJXV{i(*_a91nRU!sOza z>kqoYSeplyVq7nblkKBAE}nB^V;vb-igCS=bnA7}m$$uRtg(Tm7}sl{>$T{&S3lTT ze+VqaxL(-9+5T|NcV_>Iv8D!=Vw~@A+55h>>O3yL@zmL3$2&GQ-{+Uv2$r?$e8<7g z#^=IgfBg8`$@gUgOEGSn*Hu>X{a5GqG1i8Gr5HCpm<(92yS82R6l3icSc-AI)>l@1 z4xTh_ul~k5Ca@IadVR5 z)tM~6;l+?G@0KBKkqXNng3g9@UTh?PwedOU&F9|OFnRH0U@69Jv)C-G=*6MGYJb^S ze+?|fxbf+5y~fRc!yd-^DzFsedJR%m^x}WNoEI2*@5NTCgJY9EFTQ)&d*;PwL1(KvFSb?|{tPevv3{=s zTO}|0%qOd4QHZDg%IFJ3+E4?T^wQD7;?jnB5qioI6ed&G~7bwFS##`W4xS<#D~ zZe3_~W1SsXigCS$x?XD>cG1nox;3yA<9cnMSW@Ub!B{T_mSUV274Bvf*Xz5=Dtck8ae<{6*K2Rr3tkv&QeY{@_4;07NugdCYieLA#(9B}_g)N> zH9cBhk>A)y-M!1#a*&B$^u(~qGOW&vePpe9am&9J-DOzvqAjo#by8oS<#E0FZ|-bBa#=d29{#nHjhwN^kUitTPPG#`QYJ^{Sn?#MQ?7Nnk0) z^%|)xJT5Gl(;DlVz*3C!0weFeI9Ar!oc7tx7J1*icq-@|Tj#}b%8FiKPJ3+f;)B3a zjN9hpl@-0f`Gv6-TS)#Wi(=gPjFPqH1?IHI+BC2f<9dBxSb9}q0WmR$zN@J zaO^%IdGSSHDaLK{iOPyz;Mi@f#W8HMD8`M?NwU^@;n;1g?*x`&T(6Ur6}`Zm)>wN6 zmSSA5AG=;Sb{p%5fu$JN>nDjNg&w<&^^3q#jPn8`@4Yxhb)px`-gC-F=Ea>s=af1x zPE}TXUcie}k{3@0mSWsC|5RB;FO2nZU@69pk4&;lUKp$IBJxLB6ytiGE^F<26udCj zcLGZ>uGbmLijNCk7z4&oVu6yvt}d}T#1aJ(?qguqga8=nhYFB~t7 z^_Rd>jO%rwvZ5C_UKne>KJrId6ythbBx~();do)JbplH>-8(w3(pH<;r&rq6ythbCTqEc z_&c5##=0r66yv-YD_HNv<*F0+QNQ2rUQ zUrhcei(=e1kCV0D3uA2%Sc-AuBPTqi=Y_F`2bN-7uWOZ6^ukyd1eRi4uj^bdcwwxG zfu$JN>-xl!LcK87yMd(`=LJUIdvSy6#N)-Lcdqs~^J0<3pH9amV^mt*czDr{~1xDU`aht5M?==^7La8b9CU80^Wt{- zt9gOv#cj!py#q@zZkvCntmp;yQO5dlU@69p&mFE8_EE;VIr$OuA0{%gb*3%Dh-L z=-gfB#XZU@?xXHbUThXvigDX~ud<3>80)~mQj8m)`&=)0VXV^wOEIq3@0C^b!dT-1 zOEIq3MAr*m7;92sDaQ5sLt;sxUKnd?U@68uFEH}ni~CjQUipnV?Wco2pU1rDxs*u`UTL z#kgLNxL)wWSoa5(VqC9B6H5y9!dQO`EX6o4F!J7uNvadQ*ysHN&M+_LTN>K6+N3%! z9+S1+i%H3g{(+?!x6O|$tLTNXb_*=UxbgX;>jf{2^^?F-jO&FXpg-?6*7bp<7}x6w z*9%@4>-oS^jO+DeVo9N180+7Gr5NW0M&5fdMRi`2-*{f^b=ERJGA~wWlU1@zsq^9~ zS!-V4n)#IEMQ0m0awoU^_&Kdi(S#Mfz%_GY9o;5>ltnRae4dfD)(h9njdf`oIC6iF z{P-h1(atg-8~pS;;Qhj}q5=)6$p#f!>{#|zA(UPxZ-6t$udeH7+V#(Ffc6ytjR+4aIa%2?9^OEIq3E9r4b zq4OwXeQQ~)ldqqWAAjt|$a^nd1tuN4&%JK0Z<`mZ2c1`IZF1jo@t%J?k1Ri!N4=W7 z*fX#ckZcn`zT}mA+QwVdcCQv=mq9c#`-9*6ytjR#r48I z%2+GN$Y4>7>-Cnbmoj;;f+acAXc0 zRaSgnz>Bw&7k31fV%#>%sf%oL(FTHdhzMU$Dd|id>VA7 z)p_xrvf?(wi)qP=`InPF%Ay#z&F{-v?}f2e4=lyF@%e|cVlQ}MtQ`VNF|OBiWfh+n z#yTdj6yth*;CjIeV_gtfigCUEnOIV&7sk3ZuoUCGz{q2#E2|6Fv zdGV35;`qRe50e+~2bN;oHh-+F;`72-3ob8zltnRad_Ix2wm*ay##%eD6ytjROIbxP zjI~E#DaQ5s)b)ZF#yT;u6yth*mRM4#7sk3GuoUCGz{q)*20_EET>)>z92mSSA5uay-a7w)Gu)}X*rjO&F96@0#9TX4O?Qzc z1eRjl_~6~NwvWPlJ&ZLuuoUBZ&8w{F1>Wmntj_~WF|OBqt{2|xVXPHal#P}}F|OCQ z5(|IFJjz%*1eRi)7Z`c(MK9Hf$BRu~>Rs^S#GuowrR>H0sXIm$$BSOciwgovF>ad| zP*&VWVNPqTTLVimZhRJWy>PrR*3*Hd7}skdWkoMAk22N=fu$JNYhl+5#|vZ4zY<1T z-m3_V>$ON?;qUOmSgQt>Vw@KkdGAGU)prVy;v@FkNc?hZh!t7sfh1uoUBZt>}8e3u9dvSc-AIR!S_47Q8Ul&4HyD=LJUId$F?WL@%~K z^6%;Z!d2w3MS)--=yjU}Jk6x^iy!cgMDaLK{KxGxZFxI_+r5HCpYq?(V!dR~amSSA5 zwUt%$!dPDgmSSA5bzCoaVXP(lW29xQfpNXoO)UMpcwwyX1eRi)7Z`c(#d@j}z4-c? zH?A@-_6R!bwUoVBKXs2@te3nvG_Vxow)s2CDtck8p9Yp<-1uzZdcg~0T^?A9alJNF zR?!P%O$aQ-xLzB%Uhu+L&jglYT(6B2D|%t9zXz6LoEI2*??s2|L@$=v<-?22i`Lbk zEoTBPWiJM$?$L{m~r-is|%Cwg)E(iinMFFp!7Thw{c znYu?Wwn$zqH~?EDpMM05+vY8mRrJDG>jjo#-1rP}z2Jqhh6R>lT(7N^RrJDGrw5i| zT(7NNFL+_B8v{!*uGcn+g~tsqjP*=lDaLt$k@sF~t2)t(|9kO}oy?2Rg3h)r<>$qA zseANd+vLTft7D65HO07X9;&SQ#e|2jPn8`@4eVrb)pwz#(XH3A!U^=^RB`F z@7z-MVwcoCda-lzV!6OljN9g2l~we@SX%^^V%+%b=6b;kV;vk=igCSmS60yrV~q|h z#kgL3xL)wWST_WgVqC916AR-7FN`%guoUCGz{qjf{2by;93#`W4avGB;@g|Yq+Sc-98VC20Q`>9U!V&9XFmrKI3N|(2T&VDUr zFZNH}qZj)nFXkIawqo2iAE2zF7slEsuoUCQ=RnsBUKs1hz*3Csb&#@(UKs0&z*3Cs zHQe=r7sh%juoUBZ9h_KrV%s7~}^=N~P1v3W5d=p52g_Ttdg zJ$i9S@?z(}QjFW?!<1F@!dRySmSWua9PWC-3uE0JSc-AIj!;(73uC<&Sc-AIj&!}? zg|X&ao1>~2*K0�Rbp0g7UKnem zz*3Csb$nt$6ZW*=z75mV|^T0igCS8P*%|kWA$AZV^*sv#`XG<>jf{2^_{>{ zjO%q`VnG#N7;CSdSR@O14}Wk*Qu@-yfD@x>tUqj+l7E} zy?&Zl_&dBX)|!E(80Q5>-g|MH>O?OVnfR+enio3+ozq&%UYwq~M=wrGUK|rxigDX~ zhO&xY80%Mor5HCpXS!bS!dQ<4mSSA5vy@fz!dM>!mSSA5(XJP~FxKL7r4EZ?T(7ee z3x9_f#@aNn6yvpa&B_YE4W z&v(dDjO%rNdR#!@^=@OW7g&mMUSQ!dT}AmSSA5%av91!dQ0%mSSA5 zD_k#lVXT(}OEIq3m5GH>hZn~BDzFseyuiqNFRoIZ=*3Y#_~H=rqHRNH*J@X_l)dK?tgDtWOs0e%P|&%irR>GE zsXM&D{ZZE>FZK>B#kg(0PFc|l+#hAEQv*veZhWqHy>Ne&v91j)#kgKKC@Xq_`=g9C zC9o9Zdfn)H;r=LNeG*uTalLLzk4pwaj~B*TY-6me)fD5rz{q^dEG# zd9iWO8Q)U&;%2waI9`lTUThOsigDX~OWNjmyfD`Ofu$HXKDWAFcwQLmhk>OS*XuTA zMK5r?FxGj2r5M-icGnBf3u9dqSc-AIewSD>g!;TN)_sAc80Q5>-g|L}>O?PAU2ys1 z&5LJ)&K-4L+?l$^ebgPvi@yYxV%#=QP*!|i;CNxIF9J(3ZhY=?z2Jqh7V5yGmv<%t z<9gk#tfCjjTDe0>HO07I_qbm0!dROImSSA5dlL(~*hd*__rOw&^8zF9y|_{|ydjm@`ZhZdWdSM@Btf_&e z7}x85WkoNrk22OmgKD}c#`Su@^};^NSQ`bFVqC8Wm4(NJ1#?g93gnHN6~IuEs!y?9tz@tQf#FCI!>+!|PlaohZevZ5C_zcALTfu$HXK99Oy zIKME~T$|{_uPMg$nxw4g1jdg1)SSl*vCarA#W*i8 z^4^O-s!rTT9o_r*tIUgAg3cf7yqN5^8OMu1CNG`}EXBBOej;siJYE>86X#p`P=Ecdy|DqZdiI?uF}pBK-j?mYwvFP=$WybxH5aohZyvf}ds#|vY9 z7FddL z-h1(e>O?Pozug5Vnipe&&Kq@JyqUU3FWyLATpL)5aohYCWfi?J*5traj2oY~TrYTG ztm%QJ7}x7viV+YyZwzuLYK3T(4=$ieAii)AtWER_hkB(XuGU^?J|s+JD5C(~PxZU@6A+ zdOtlbsA3*vtgQn}G0qE&y!YZCsuQ0VPp80+4^Qj8m)f4W|HUKnd?U@6A+`cPTX3mm(RwNNL-CZAh3AE_ zHVQ1oxLzM87F2P(FxEkVr5NW0M&5hziR#4X#ocX>j5jZS9&|owDSPp+)IB~gK1p8O z6j+LJ+x)4riq8vUJs((#apUuu>xJiqvAzl{#kgLdD=T_|=Y_G_x5Sv$YKn2azHq(p zyfD^Qfu$JN>&x`Gpo-^(u|@=zVw@KkdGEznsuR!kF8$G(=a?541)Z;2%3l22Z8NS% zeU-epEwB{hw)yL{&2SLsdd7M=uoUCQN8aXNxc3|9dd8Y<2p+vGz_?y5%8Fj#T+di5 z29{!6ui0ELoa-5DXkaPE_3EK4WDE$T1{J2pg?`vOZbZky*w+YB%8em!Ho8(4~Q<1?r0h4~r-ivuu z=QYuQ7n|*W_s!*r>wY-!h6Jw)w;C^$)XrH zKHqY^@YyWJS~0K`<9hW{R`dd&&0?%=14}Wk*Zi&*-XmtLV**PtuGa#o7ajpVo5ffc z1(sr*7Z`c(#e%96pBJaC{I->xFN!wf80A zI~R=gP+%#>^;$ah!Xv=*!dM>%mSUV27w zqAhu`U0^B3ZS%6qDtck89|x9V-1vOk^@111x;3yA<9f9#tLTNX-VQ9qxL(V-Uhu+L zeTH&06ytg=pLziSFO0QCU@69VfsyxKte`rNiw2$-uXIj7-@F(VbXKVIqMzGl%%fIF zUi>n!6yvseMP4Bvf*K1{EMK3UqGS=eTOM6)q z<9e;)dSM=Atjz;UF|OCD>2X07^C)8-8CZ&OUSQ+R|2i*L zbK8vLMgQc*y@90|x6K36Hp2@XFO2nWU@69p&+4uhju*!2vjZM|t)>{)YYk;ZFL1mt z*5JTWjO(?g>xJWmv5pEX#kgJr6ARmdI^K!xLzH~ieBLRMvXNxuoUBZ4RXEkeWS*@BCr(WdTru*;rm97^~bxJ(dHP)wrr5M+1u(EJG!GiA_HP*5_bFE^W?{L}szM1OaISAit*DrCQ`Myoi*{sg@ z&D}P`_sx>;2L+a5+%|8atfKG6IxDag<9cnWtcB$vA(`;qSW^N^ zF|OAT*9*QI>%+iOjO(?P>jmG9h0k)qq8Qg}Yu5|D8*9D5QjF`hjk1cq8*7iiQjGH* zE_>g%Rh{VjUW-1ln)!Z0(Al=m_wC#^!}o2I?-vD@V%#w?a%b-wTBwi)xEU6b#V0!uM& zn|D`M^d0jbV@(e%#kld=!}Y@a$5?%KqZf*Cz4laA^d0jbV{H^zigCU6a=kGBG1dWr zr5M-iyNQLZ!TiTqX9bpGoEI2*@5SD#6TRrX@y@%aBOm%3xm1~2wbUc4As zigDXKOj$)Qj5XKp996}*@!7}qf)~bGKd=P zz4lM6=!LN!4=lwvFEH}nivv_A&PD%z^i#h#FTMym2h@3SVCoJpFc&=_dC|THM^!Oy zn-5Y}^a68HW9<@HigDvJ-1Wj-)L3T(mSSA5gOwG%z+BW=cLkPWT(3i1FU&=aH7&3d z<9Z#MSkVh(EwLv@Lov<^jJ)^aFx81(+`ZTlH<%aO1f9d`yf{2{k6s*>ycii+igDX~ zgtCfW80+f5Qj8m)BV8|eVXS8ZOEIq32xS$$Fjnhc93REFUPrlJ@WNOF14}Wk*U^a; zy)f3kfu$Jd1xDU`ag6FjFRuK5+TH@(s&b3^-+(Bn*Tlp`%xi#wO-KlWh?I(fM>vGU z!NUQ>){7n3iH(Y43pR=!U}3kSVkagT-x_1j_nm9(we~*v{r}&2p6kOsd;I2@?;LyO zj`P7LXL}asS)H+&Eb5|r$YN~F;u)i;k)FqqN@wBJ(gzpkLygR5ym%oCr#c%&jd)EU zmCnMcNk&m4UPp=-vT*7Nqo@(DiIECfI8`{LxGriW3rt?KIEr;>I?_8K_rXV0Ro z)j2AY#nI6{WN}o?VvtePNYBTRN@wBJc}7tq^Ep<$kcCr^8bytG9Y-pig;U=eMU8kJ zFJ8#PspbQVQ>8|{PKXo~ICeX=r%}{M7MQ$daU$!4EIzxw?VFxOoz*!plf_BVJ!ElW z%;HL;sF9xkM=G6#Q!g1sjm&3~cp(d?8XQ`j4>jU-GO2VHPHkrtHR5%Ocp(d?s*R#X zyiSc2x>X)%j;jiN?+ zK7&-q0{1SQ`okz{WIkt#7p`TTTB9nlPkyKoud_&nEN~6$)DA{bBVK2V7p`TT>SGi& z;&qOA;abM2BaEU(ye5kmu4SB>Y!o%(buOv&wTx5KjiN?!N6MP}d8`w1f9uIn$u0H< z#bFknwL0fzaz9^sM(*du+&?gi8tM50Qt8~C`pYP4WIh*)7jk!Mox_T)QX^g$kxJ+8 z)UHNRBVHGa7jk!MfKk+l*CpbG+?|?e6gA>?sdyoGr!F;$8u7Y}R62L3W*S9}nc(qcbuy`wU<%Uh}YHPg?+D6hZ{wWcwG}ItO5I8r%p498p#5a z*DS7Oop+NO$n~?8S3AnHxXJ2V+pzR~Dc42!MhP|G?pK$)HfHgpQPfD!*OLlajJWUR z`qhZ9_25$*ICYRw z)QHzj(F?syI_9OXojSoNY6=5~jI0|sw%UG&w>Gux(X;ioz>*(iq3KLx<*=pvw9QK+ zJ)Ik@%Ct;6H_IxprA&+IJZls+vWi>#9WjdqMo}X@-$g29fmeZ@YBHoaRcd5DcZ(NZ1$Jr+qo@(Ddq{;W z@G7uVJ&dA8yk>|OUIlh)v{BTE*UY#stO2hAJ9Umx)JPVXyk>DP>x3+(3~1Eav$(_R z+?&bbKIs`*+#9oa(kN=A=lf&NNDx^#HQy*|WIhjw7qW1wFtnH;HRAOksdN@jt!ET9 z;`NYtAq%H=Gm0AVdN{5tWZ~5QMo}YKVDg&9EY=BG)IM;3a+f}w#f`H%vocvcB0VFE zSuu-qjG{(*el+$RvT*87qo|Sj%oZSv><5wFL^3t2d|`mkc| z)QHy;aa|z`r`i}rjbwqzYZgzk&O=EN9L>LKGO~?lv7gm>GLywq(lhQzKN+(aYZNuo z^V6|sWPw))oVwH~YGgjoh!^fiJ2lHFYQ*bVQXvbxI^fiNqo@(D=fn$lq@7x3I3}I^ zJw#~4>-k9GaU3t4+QKMmBnwPlvzWs=A&XYWT(*^G(bMY8$z(A%x?`%yVouCrh*8u? z&o7V)#|vcP)Tu^MBlCGtypV-c(~P1}`MfS(*he{alu^`(*Bhil7C3f0b*WL*h}WCqg?*G$_Zmfwc)bb#xF;vMN3+r`^4iG|E*GZMsh z;nZ$MQ6uwtPrR^QI5pHLYQ*b(QXvcMqntY5C~Cy(1M$Lk;nXans1dIZBZYNiALY~n zqo|QAFnP`5Bi5Od)M%3Y@ANI#Z|PaAlw51z=c7y(A4m7FU3?U?*wH9zr04mh(%Xeo zLye+F=JSboVY_hZ5~HXQuTM#ZEU;ZT^^8%}h}UQ0h3&$r-;AP0ycWcDVOrQOoZ5I4 zepe_^BUxbbn#Jd=^IW1v7E=zKu&ig%*Xn$p$>Iy?xyhTC4f#A~afDISNY7u!o{``; z7j|FQsY{HaM&|RCc-?*bJFT6XWfV2y^);!G#gJ<+Yw6S{Mo}YP--uV?xOJvF)pT^y zH2Q`{yuKxc=NNvFg;QG@MU7;E$!iwhu};`7w!Yx{uRV+2R_D7+7T=RvK5-7)#dk4_ z(MC}tJ^v7U28H8=Qx_OTjm+mq@xpfD)cr^WrN)VW4cBlG!PypV-c_Zvlxc>O^torO~$8AXkFEfOze;Z&0`#Vn{1uf=g) zP++@oYHOpYkt{HI&EikiNlu=)k9u(54Sx14`dOVnGgydef5t3ojiN?+{yX-} zERs)%ICZH})X04P5ifiy!Kp`#qDH*1!TMig#3w|Y`qU_D#H#_R@EpUZ5}aE0h+-Dh zh*!ht1qD8p;MCSeQ6pJk@|r~>)(PiPtsk6lg=f*n>NILpdgpd2=^5uyjT$vBwpy5A z6gARwV^S+6y5t``k8*0NQPjwMmKHCZM>+M1QPhanGNi(Gf%7P*{x*sl@oFMoIFEAb zzqQ2$QX^hXBLxM{qnzq*6g83sCa+m6%Q_z>HE`^{V5{?{c@`&Gon9uHHsSPd3jPH3w)x`shf=QXva`qR^?=jiN@pRunIM zqR^>tjG{)oR*GK9Ft}Yf)nF`sS13>;Szz*-#mcM`vY1l!$Hkt-8dhiJOctw1&-irb z$}x*gjiN?+UX@fj3#Zx}MUBj-nRp=!rw%ZR8u40hAXFbFp3)ST35XA4OdR} zH;NkZT8|Xgg&!Qdof>BpHIfA;uUV|mI^ngX+q;iQw#0BAb&=IsKa<4<(lcI5T0ds- zpi$IF&l|>`lYj7AGMxItC~9OrEyN42B{{YFI4-|Hjd*QDs#)?dyzp9*Q=N>WM!Z^z z7hX$ps@5oK#B1Y7p&J}8oVv;=Y9tFxUbEPQb&y5Vn}#T=`%NhXU;qkHlX zzT;(+n8mk7Q6oKXMk;IPQnPK`E- z8u9wCc;TH7PF-dcHR83Uc;TH7PCaQ9HR83Ec;TH7PJM3_HR823DeS}WgHP)?wdRE4 zZ>f>ok+SB#4eNw$@SE-4PhJ5G+u$BnXPZp!t)ypcgWJU14>5`w>A5wjkUL(_b?Sdc zQ6ux&R=ltcIyKEGYQ$?hQXzM2gHF9*6gA?ty?9|8bm}Lgs1dInB89nQ8+2;5Ba2y3 zBUxbbnnfGd3D=bmzO?9i&thk*(Pe%h5wBgv3)huSeQ6Xm;NTUN5wC9Ig?*G$zZpf1c-^FkvIlVi&8^J(EQbQsKVD^DoUlpnJ?>f1{|8p7$mdvcPqv zQ^y-cjm)Q~czyiM+~1tK(I{%fYadb}3;Z>6r(Q6M8u98SUbvQV>Sv><5wCrt7p9KC zX71El$$kbu)JPVXyk^mxbv{qj$l~D(cAnu`w6i+BGg|>Xj<=>#eqgqBR%&e zmCnMc6O5up=F?BSPJZ^S_nf-HC~Cy3KdE#UPCaiFHR83Ocp(d?zBh^*@!CInVd}`j zsa1}}?+OKKBnwPlvp9ft!Zm(}Yd%k&>|r0(#_Al9$zp)?jBES@VivuPqDFc?kW@Mg zrzRLhjm+mD@xnE}Q&WthM!XIt6|%tn7N;IFiW>1cM7)rNQwxluM!W__FH9ZR_)axF z4!2%7O$;4Z#T)QZ;YZw zyoQL^l*PLab*kC%NTN`nM!bfK*P@n>eD2h4Mo}YP!$_sCWt=+9C~72kq^!9QXPvM= zeDtFMJ9_S?Tb<#V+z*$Yu|FIhbHCRpYNY28q(biawkW5*F^U?Q&q(naw|1B5PPI6J zLoHAvUZY5b+Q#7YP*OFaisK&W7C9~#Tq9SX=?jCkSLRIT z&xzuN`_E3DWE3^xbrPwN1@1pPb+b{_h}Zwb3-_O$df6yy#A^~MtP4NbE}Z(sC~71N zOkT4%nRR9*HLzVAy2_E@c#2zF^i5yQ6oK{Ln>r}`_E3* z7)6cDXR>(V{iyv`Rd+<$gz{Zlx? z0yW}wfq3Emvs2xTqDH(fB$YmAb84JX)JX0~S#!ULb;35-aJTLId+yg*or^NLUo1Ui z8@wpy{-{yZNY9s$3b|t&bn0`XsFC?xDqh$Iom%nK;#8>-ugge<+_4QhwWCqgh}Y%f zg>BHOfksgyUROj4-C!GZ>SUv+kt{HI&0-4cgl+Jh>-zuUS=?%Mrew0XGP)=K;5IlV zW--SoYNY3@NQEr04LY^ZC~9OrSBn?6L8qFZR?LDL@w$do$O7A-Qyq<>M!c>SFKmNO zjWCKD@w!gDunjtOfl<_m*Y)CsZP2NQjG{)orjlw>TsB_=a_VEFsFB=}vgUpR>xAp& z^=8ew+H-Gmda?WsncQ!bo^ic=L(F{(qo|RdZz2_PUp={AcB-FI)X03Mi5ISyojSoN zYQ*biQXzL-FFQ5eC~Cy(7V*OMvQuvuMU8k(7cX2dJJsNf;tZ(~uUo|n*UL_AX%sc$ zbsMR4?oRbHiWpl15t1zr<( z>RO|yk@-9=Ubv6s)EuLz5wB-Rg)DF%$*EtAqDH))6))UJa%%l^FzG^p8u5BAt_zRj zdfBNxjiN@fz~nWH=UFH0qt5+ym()GIF;?gKOcrybXPm1)AG0{mC~BnVxv}TuAAG-- zQx6$Mjm+l-@xngJsn3j}M!a4m6|%tb!l@M}V`hZ{HRAP>cwryq)XqjxBVI2@3RQ8u zaH`5EY9tFxUbA?GbwU;mn%#Y=Zx?4+omVnh%!}^HKX|-&C1x?*C~BnVS4oBK0>^Hr zUN?#wna^wDg)E%<$0%yV>vdA;ES%c>T+FOcphmpj5HDomR3D?L5wABRg{sKHsiTde zMzX-l0ET3*29IYQ6I@vqFIy@%mJ}aDUaQ4n|QUUZ2Hv zp(>6SP90_xHIfA;uURZ$ov@FpKKu12Jc~(IXF(>5&q*zxI4A$$K59YCVyaQpNY7u8 z3Rz$u<R`YJ-cCUnM`(h}R$Dh5KwybvB9`@meHa zxX&G_t~79Y!o%(^(QGDPw<2HT03>OQPfE8NLh3Li*-Wo_btEuy`K9U zR_Cuw?te?q_;$g+V(vd1MUC|Q52?S9HHsSXT28!hKf$S=jG{)omXBT-0nQJdT06P+ z!4EZ(1tzaq{D*aZOw`DAms`$G{u%BkbhJAE$z-vD^t@UB4}SYk%;F%UsF9vmB$dv> zspE{IM&`4Ucuo2G%b8AHV-z*wwKA!Y1@7%Q^|(>gh}SCOg)E%<)F^7iYt`t5spH;` zQ%hZj-xUhfNEVp9X3>mwmP^KuEVe%G#d|%Ajjc|zOctw2&!4Wg=~m5R7CRY5jr6=a zsgMP}>CvgaMo}a4Swp<$?7nD4r^XmXjd-m|DrE8IlmqW}>MWzE5wEqx3*YqU)HI{0 z5wEqQ7pC6uq-$F`^|(>gNEVp9X3?B=!gbT5rw`oEvv}X?G|yzQj`WP{rsgq=hL@wG zLV+6Td0kR5i{!e=sa8f&BlB5Lyl~y*)FDPuBVOy13R&Q~$*Hr9qDH(n5HDOeIrX4X z)QH!Haa~w9uA7`%U=%fy1tzaqv|ycZ|9SuIPfggck6QH#)GicSWU|;uddB_d7BP#h zjG{(*ZW(({4qJS`mQ%fqqDJPkv3TMBvr}V@qDH(nAr-Q~KFXSzz*-#pbLNwu{qyZ;?7){AqPI&t$QM^o;Fd^O(iDQ_xYN zK#lbLUsCDq!l^xtqDJPkrFdbxaOw!7s1dKNNQEr0T{v}xQPhan*5ZZj!l|c>qDH*7 ziR;3;v0XUztx?oS7MQ$d(Ta6K77JFse-+;@R=*Op3x!shELuy?$f8xuVh5wBk)F4W zJ!8ATy&b0xHi{aV&vxR4ESx&oC~CxOds68voVv{@YQ$>?@j@0(y>1jW;?*Xu3)4at zPAxWy8p#5a*DQ8qomoi@9J}YPwcJe4qQzCHom?Sjve-#_#%lpP#w^+zMUC{lbL<&e z;NFf?gN&j^=Cg}<;eLWsrx`_!c9YuyXcOoB8#>$iye)kMtW{fD(s_> zg;R$ZMUBj-gLoker%pDC8u8kLR5}Z%ZZ(P;@#-jE$ik^tjiN@pIzx`R6PrHpty5PTMU8mvC0=+fz^O-#qDH*B zM=z{l#ktotaq2^(sF5r%dCj5+>l|WPY}tL~NuEXFTGTESdStTLn^d^}eEG|JztbaT zv9VFqNY6bRvfMUBj-zj)zW{hhkOC~CxOKT;u!qxRpS zk5exgMU8mvFJ8FTbLtnPs1dINq8Fxq{6^DWb*lOG_+6nujbwqzYZe1oC%mVk=?6=# z>sjn!bp~XzI8b`VdnyLREJhkdjr4pFsgMQUQ{mLrMo}a4Ias{#o(iYt8AXkF9YQK( zf%jB6)p%-gKGcZUK=HzRDxBKMC~Cy(P*PYIesCV;)NrGykt{HI&7z8R9!hFpyLjWD z_5SfJuCO{)nJf+?74}j1o`I^E#Y09>BRvly6|%s0&pP#~QPjwM28$QIXTYid+KHK~vVzGuLxHbzk+UPHtS-!tIUK%=M;uc47bFF1BPb&65cNEVp9W-*L)LKdsH znt70Cal6$Swp8hT+Tqc?QR0p)hQ%!A8byutd^o9e7EUcRiW-^E2=PJ|POW_-R-as} zKqFowNu{%Js)JF~h}S6bLKaR9Gm0AV8XYP0f-Iam+bC)z3rt?Ks9_zP)8aL<`}=P_ z(6hM5>eOVi7!%!*1zszuiCMg46gATG5u`#Ec#X`dpN*nM=2I(Pc&)^#wQfr6lOJlt zYb>dd1zsa_s;yDfh*zC>;k6Q{1{p<-c#RV;yjJ4WX+}{aUgO0Jua!7;n^Dw=*9217 zhv5gWkva9UQPfE8NLh0~l66AvdmS=y4bS~&t8-)~_leRoaz8TWzQVL(Pt-`yN0CbB z?o?}|sFC>`EndjoslG;0BVNalO6Ts>1f!@CuVcjvxjS{aQPhanapHyCotkA7HR5%= zcp-PEJ~E0L@j8K2lj4Y(yHgErF8-Pt$sH+c?kBR&BME?7_np4Sp`QCjR_DY_?k7pl zgO1pE;}c`xAyryewl z8u2r|6l@Vi2R8p#5a*DOwBop7IR@fkP$NFT5_})HOy?BVJRY7ka_#GETi_6g83sCa+ms$vR&qHIT(ei`V(ivuJudY8MJu zX0o_Sdd6#HSH>*1Hi{bQ`D#*OAB8NOI>;z$WIor37hWTC>I|c(5wB}WrL%DAexs-n zuj|AMSva-8C~Cy(`sjseAq%HgxdXo|6sVCbFnP^lD(i$S)*aTgp=Z&~>P*dKaf9@X zET+aRh8jhU^n4?!bQVrsY7{jxpPR%BSvd8aQPhanG*am-oLXcQHR5%%cp(d?{(EO} zs?>dKPC`o#~k@Zk3+bKkCJGr^hVr zFp3)K`8HB3B|g|kop$;3eonn_6g4uR+r{hWr&j&hspalU3MD_(h}RvYLKfS!J*$gT zI~zrfc-<*pgU9^&jZ;I7qDH*#it9ozJ;&d(sZ$piMU7;E$!ivOv(5`i4P?>$xUDzy zEM{AsyE9qbBR%8TeRs^_ZKJ4>o@d0K!?D|`#YRyh^O-4LICeX=?%h~@p+Jpz-AgKD zf%7P*+8ITSc-<#nICeW#WfV2yb$?tJdcm>VsS}N&MzX-*~p##dTKa zflL+;O3%pRftbaEMo}X@KNNcoSvd8sQPjwM9u_ZT;nbf-Q6pZnNTsuIYTbJ@xnE}Q@KLP_5wB;&3)lEgO*4ub@p_gN_F?$Jy&b3K8AXlcj+8a` z=U4~V_)U}l9X4ge51#v9R_D1)?$1ll-!;1Vz~^G_Et7X0;D;LNc@C*?Y(nl%^)-qb zna^DDI=Jsz&pI{9C~Cy(1yaqDKJXkv?oQ1xiW>2HQM{15Q=b||jd;BzUdY|4X36^} z@k5Pxy)0hH-KkDSQ6pZjkV@z7RIO3eNbX2kbDzgLVSE2)a_vW+`?XeQUMBZfrDtsK z^J4Cg7)6cr{2Hlr?oNGb6g4uR*ToClyHm^F$DtOe5wAB$rE_O7;U5wDNM3%NTr!zgORYrc3Pcc3ygj70rr+znz8p$0gYwn-2 z&Syzfs8!c}{K204+7A>H{4|sMXVUYe=XPKE)0q3NMo}X@FCZ0jPu>ILRJBpm$b3E* zuO{mb`qHV%Mo}YPUyus9<9j%rdcY`Z#Oq7(!h2wx`ot(|#Otf*g?Zt6(5dAfEY6S` z$pVwtEWT!)ur58kkXk;m!4VDn-mha8dmBZK^!zQUm_>5Tb*jcF zYGgj&i5K?0PMv2IHRAO>sgMPZxlY|<6gA@YgLq*Zbn11Zs1dIp#S7b@Q@~SCqLAP*FsY1ZP2NmjiN?!N6MP}&#V)+!Kp*1uIITAusT0ya{ono#y0qK z%>6{8sF9w3B^7f|wn3-vGKw0R&u`*|ZP2NYjiN@pekT=j$2REH$`2Q(N{x8^Azs)9 zo$6o|HR81>dZ8}1L8oerqDHd7`2r`|V;8p#5a*DUa79vd~l(+k%iJKS^8PM*c8I8{l08a6I{j|V<*={@7S z&KfpOe#M_wMo}X@Bd$gbLKgV0GpG6+MUBh{h20C^b>`GDMo}YPOOpy&;JeP8y3QzS z#A_Mx!grlH^{i3Uh*uNw!grlH^_@}Fh*wkb!grlH)$GyYEU6K%Wl5#?hfeKe6g84N zQr6s;W1XiH8{~f0@K^uv+z+-o%Vlz3UV7f)pOsoH7jr+(C~BnV|Bwo~KQno$hE7d0 ziW-^E3gR`q;jimCHP0w&#A`)TA@@s`TXw!ve;P%Nc&#K}XZ&&IM5i{HoeU`Xp+>w` z7O!0oeEUYHdd((Ophmn_5wHJN_j$;vql}_PyjCR@a$o$%`XijW&M0amcciSjH)9>_ zAW-Z68CSmNxzDjW%`&;KCOzZ5@y%lHpBY7s^t?K$kUQR2;8c^x68q$b8kx@;;)VCd zJM~|qs1dI0Pibs>U^W9kt{HI&7wK$ z%t>k>i`i`tOk!z(lF82utJ6G_#X8X)=c0JuY4e!H6Gl-ZJ+DhDWP$gcI`ytm)X03+ z6ED2))TxC=Q6paKlL}ejeWy+>_c)hVphmnl5HGy%)Txb(qDH(njO#*O+=F#$XQQZ* zEHHV^q6O>VIEXBoF8H>EXVJ^*w8&(!k@SrBI<|;e9BLFb(sRq$GZMu6PMw-)6g4uR zjl~P^b#&@{qo@(DO-O|-@V-;0rW-|#cx@_Pc(0>VPZ~vycx@J`WLexUoO;(NY9tFx zUbEPob;3TXuw{efnxX+pCO-?U&gPjcwutVSD)v#E$1Ik5f^dNv>G{8;!ghgulvC>& zMUBj7OYy=!%Bh`3SCQ?{A_EAnvGKw0> z0+ZJ)TCq;ZqVdAM$9oo6TAfyzELunRMwUgZn8p1@Q6oKXODdg(Q|}o?jm&2|@j@0( z6`m~SPK|hNPb!^-Q!S06M!a?qFJ$3VSEHyAuQrhiSvYmLQPfBln7n4OBkP1LuKDP| zsEkcCs18%2$H?LjJ?g;Vz#MU8lM z6fb1q)N4jjBVL^%6|!*Zd!wk4EHHV^qBHA+EQWn{WgE|8Ib7l-Kb6U^`E(U8WZ_gVqo@(DZluy#ICZ#D)QHz!;)N`nnq(9;;?+G; zm==x~PE9e28p#5a*DQLlPROF$vS)1MS=x~3#UFZ ziW-^EKH`NeoLXcQHR9EaR5}Z%nmvP=6$;dd*S_L~ES%cfC~Cy3ccf4iSvb|jC~71N zOkT6-!#W|0kM6(eSI=Ug)#;PTqHlB$S@eln)EY&N^xThBIt!=HF^U?QPk-@37Eaw_ z6gA?tAE|T}PCacDHR83ucp(d?<{L$gcpVU_kcCr!8bys{fyrwY16U_yaqxAMlLL1+ zcCYa)Y8MIvGFcoL-9r`wVisE%MUC`)5UF$)PIWPg8kx_*;)N`nI?O0)#On}J=`5T& z&M0ccYoK@`3#TqOiW>1cG*XxrwhO0b7)6a_fyrwYRjd=T_-WGhXL%McS)Hm(7KcUm zkVRF@Vu4ZANY8^vrL%Bq>F2PHLV+5Y&tUOF7EWzq6gA>iO)8y*Q(cUrM!bfI7qW0_ zh*8vt*U(5|1<1mwNk&m4Szz*-#W2jm&3+cp(d?78ym2c#R~L&cdm+pU2D!1!}}=lz1Tvr*<)l8u1z(DO5!k zPVH|LHIfA;uUXWvPRQcj3G000Sxm4xHJL2NME8(IP0Zpfqo|Rdk06!K!l_$~qDJOZ zD_+RLsb`I%M!d$7N@wBJ0;8xAuR8HU7EUdNn|8?$HR3fcQg|F$IJJRM)JPVXyk;?; zb&y5VOS*QuSFZxl7+b*y;db!w;n zF^U@TI*wG6Wa{|Adjg$Wdv5W!)JX0~S#v+0bwciQZ)mi?Z-Z^D&heStPmrFG`|&aN zE=Ex!J)cM_ox4*5jiN^8bCP%=cc+dtiW>3yAE|WiPMv2IHR3f%ypX$7w-`l@c%3X> z$la+YjG{)oP7yEU?$momQ6pZbl1k_9)Iy`Ek=&88=6)LMgxqKBx!)?D`*L`jcJgyt zCil~&XXJib%zbU6sF9w}AeGMDscns-M&@&-cp-PE_A-hZ@j8oCI(MfIGm0AVI$OMu zyHiIQMU8l!BVNeesq>AZM!Y7A7jk#%7Ne*UuX9PIb9ZXCQPfE8NLh0~k9FQp(nYPQ zyY0QR=l-VEIWLp@`O@>?v3TLV5Ki4;6gA>?N%X=B@Ljl0y<-$Lk_9HOSzO9G z*aneBtJZ~sJ&UDZLhVA~(o7bYNzb^acWKOG9iym`o-ZdAvcT&OPVH(GH8P(o#0%#? zP7N@M8u6M!DrAAz9h{nI6gA>?rFh}|$Eiz=qDH)~iWH`W^B<>X8bys{fyrwYSF=vo zAD+>6o%Wu^t5)agOcvKf_i+Amb<^vV z$|!2Y>v~cl3!MKr)zc_y#A~W}VSngUjZxHy*A3!@{h?Fm8bytG-6&qzA3AlHQPhan zO{CKML#JLgiWxa;X)*WZUqOC_0yWa} zEu>aT9>cQ*uZcU=+9+ydKGVeuuZcU=-zaLt>sC@Bcf2O<)X_#!BVMKdb{ z5wF|hy0C7%ChpV|Mo}YKVDg&99jp_wxap8j_Vz43w>o!Zvba-vMizI(EE>#1M}-14 z((_%h=a7X{Esdf^=5x1rAq%JWG>RJWx`$Lc3#Se@iW>2nAzsMBsk4ouM!aUmbz$Ae z!l~PhqDHd7L-OS4xfa{1~Zp?oRDv6g4uR$Hfb|J9VZ})QHy;q?#qIV0%aI zPCa83HRAQ8cp-PE8og0m7d7Jblz1U`r`j1sjd(pRUdY|4qm80Qyq+PI&fTe*Mo}ZV zBW2C~S=PbrMbv8D{ELq~_aCgzvzgqVlb)NrdD)O>WA1CeS)30w()07ALhj#O*nM56 z_BM(dna>>Yy8HHbT03=uQPhanTv8$TA=h5k(y4olqDH)45U;{<>r8cOfl<_m*Nbso zSUL8+POb4)aT?S}7MQ$d@e=FcqbbOu`s9Z$@GQDnotH9MyevH*zGBDwUW!?aH;NkR z`IXo+wu=KM-~OUgw;Dx_%x9i>wf<$9)t#De6gA@YDyfjgs}COYn^SAPU7Qa!;`N$% z&8+@of>S+>qDH)4j}+?Sy1=QEjG{)ez~nWHH(2MMqz3MbcDZ|llRb<3tj-&mEZ&Un znCf+_{%?~vVit3ZqDFdti&We$W?%n~Q(qWGjm+n5@jB$afzLbDIC*sgKh%iVJETGu zL#yU?ajJz;)QH!+;?;G+4`(~o&M0cc>pk(B(|Y}eP90Jy`=k@?IQFXZl2gLjL$QzKrVkV@z7)cQtIBVM117jk!MccZ8gug}B_xjS{B zQPhan0`WrbPE9n58u9v^R62L3E;5Q5$sH+c?q9G@xDW9CAq&3n-0!wJUu1IsQhLUH z(Jx}|&lyFH^!yd6kUQ=JIQ6Ab)X03k7BAcfaH?tY?t1)CBVON-3c2GxfK!_rMU8lU zD_*z{;8ZuGs1dL4#0&QUoEmNvHRAQXc;P;PQ>Pn6jd=Y)D&&sWL7ckDC~72kq^!CB z$U5O(+_k@-zMkj)wAJ}BllxE7Gw#Lx7<2#BC~BnVg``66xEJTta_<)tq(8XPQ7UqHR83jcwv9&)MBHk5wB%P zrT2$Ut@{zHCeFO3%o>$=@j~uS{b&?5 z;(mPBocdOpqG!T2s7`yHlGRMU8l^MJk=UQ(cXsMsi2Wn)}+UgWOSTan0(m+ELueOaQ?Gl%%a*TYNY3lNTsuI>U5*1k@>U~FJ$4=ZAMWeUK^82XW`T(aOxMMs1dJCBNei6YK>2e2~s0jVDg&9W~}o_0${t?yyF9}dKSA_oy{^?Y#!Yk zB^16FeY2QFKclFTp0^+sve^B^o~Jl9(I{$UKK~W3&S!Oc+NmpzqDH*7Bo(sQ@#AIc zoO;YCYQ$?R@p@&%TJ4Zo^ejn zA?Ci)7sV{7k)At}3c2H)#Hk&OqDJP^NxX0zbZUT6)QDGSQXzMolQ?y}QPhZ67xBVz z(5b0LQ6pY^MhYv(If+xx7)6a_fyrwYU0Ej_2M>Gy#-%)qudPnkOcvduJGMa_2fM~B zmie-n1vS$1UZg@6I1W0srBT$#e7cJlj)P9^YZNu&)q_;X0>?q8#v4VAc zg;CUqSIL1)ucxEaqFCeKJ|}itb^5xKGTY(O1PR zsF9xcB^9#3anPx)jG{*7(_6f-KXht8qo@(DKBPhxI1V~>qEXa{S6}hM{?MuEMo}YP z{lp9VL#JLhiW>3iFJ9OmI`xlH)QH!9q?!~*%=hX$wdvQzUsEHwBW2Bff7S`P&)xR1 z%{}*CR%icA?gvQEIRDu{=6-}x)JV?*NTqXk>I$Q%k@*}bUdY|4r;MUTybdCj&fTf+ zjiN@p4i+!u?$lb}6sJm!cpV~M$la-qMo}YP1H}uuJ2lEEYQ*bMQt8~Cy2vPMBzL5& zxmU4HI1cXJY16B3?KSI(3#&)QH#6NMQ{)4mvf{C~71NOkT4X#ySrr zHIVB{_nrQaXYrxc8J5Xncy!0Umw%%$X3^lg-kxER+R`X$WIiLr zi+`gqQu`T2jd+bD6|%th_PEzcMo}YPqr{7UqcD2iW)wBzH9AsQH?nZAH;kf2vcTju ziyGDmS=4TSXg|-Q@I7i53N@K5#zgm!MNRB^J)@|Ro{u1v&cdnAMo}a4sTD6|;nYZ@ zs1dKRq|#Y9b%9aTh*zC>Aq%G-G>RJW8W$-{3t2ezp;6RG7MQ$dF`jio7TeFRp5|FJ z{sFZMh4GmzCPep;#rT-ThDK2%Js(LborP0fjG{*7Gf}*dg;V$@eEd)&UPqBiXW`Vj zMo}YPM~fG-aB8Me)QHzHkwP!X!l}26qDHd7R zaDI4f%wnA%(NUp5jr4pxsg;t)K;it*sm?}GBl9^yyl|f2)M%rq5w8=+q@f zQ6pX_i5JcjoSJPEHRAO@@xpn6Q(qcIjd)EGFPtYhwaQPJV4*;bc%4iteV*Xd&PGuq zxg%xG{S?*-xzBxl&zn8>Dywr!CihdNXPh6N5_3P!C~BnV(@3RrcWSCp)X02J7cb=Q z)bmDBBVK2aO6Ts>4@OZVUT2CIa(8O=g~cqW5wEkv3%NVBn^Dw=*V*EQ+?_hiC~Cy( z98&4rojS!RY9x20thrBSop5b_^j072;JHt?I+HWGpDR7%+I(`%{S~9Ak)F>Z6>`V< zp;LvQi&LdW=5xMy;cs_3wT)5Kh}Q+ALhd*}bm|bJs1dIV#S7<$PMvKOHR5$qq_76; zd!2gFC~71NOkT6Nm~~!AY9QAID}0drGu*TK!s=X{$>Ngej=d=U&e6p&i{*bwewF-C zBRyYADrAAb7wOc_Mo}a4xlFw9caEGIViYyvbvdbKNgwDCe{;&I3yh*hysi*0{GB7G zW*bF~cuk4x!n*N3YNx(7iWUe}2i&Pkk_ zWfV2yb$z5TEo>J~eP9$dk_9HOSxjXeWYH9b*1dBr&!X@fewBP0Ig`Z=(H&F8=Srr= zESeidjr4pYsjyw(^F&UyGm09S&rRZm&y_ee$S7*WYZ|GL1wL2e)Tu^MBVIR)7d}_w z)O4e$5wBas3!f`->LsJ75wGduh0m2Zwa_SP#Oqd4>0^^qtNqTn3e-sMNLh2gjdjAk ziZrVH7pu^?am47EU$zt2hm6 zBnwPlvzWs=A&aNau1d~l!nyiZR%cEoi@DJ~WHBdZ(cdU)q~{k%rL%DAG^41I`MfAz z$ik@yjiN@pULuvw!l`eJqDH)47B6Js)Ovpxr%H`@y%MRAg;PC^qDHd7h8RVSc)cxNI5s(Tj#1Qz z*E^)r$0ny{7)6cbj+8a`cUfmnG6mEcv1p68J@B}h3|ZDYA>Ux5w8zPh1~J|8&1_4MU8lUBwqN=2d6GKiW>3y zIIauNCR{H&HQOj^BnwPlvzX61A6gc5FSqOLS$uAF=4Z0_M0)NudYRwn$1EB(DDF?G zk)A(|J!8vV{mx$&IklNl)X0236R%dU?!KZ^dmBZKcr73mvRLQkhnqN6YZNu&^|^TA z@5noKiBZ&u*B8+XS>U^&oO;kGY9tFxUbFa;bwU<%KR9b0&*B5C^JONBucT*W@ny{7 z52L7&p1&p)whLt8)Vd9e2~s2T`9{2ug;O1jqDH*FC6&&?scNIB5wGvW3t2dIx>3}K z*Z0vYWZ~3wqo|QAFnP`52i6J4rf$pbu#9K%qSg5!lf{qHGp?I{h*>N!iW=$pCsH8` z9Gje4rcp5qYGghO#S6zKr#3T+8u9v>RLBCyCa1a?MU8mVRZNf?>3K1!bnZ@VViYwppFhP5xjWU>C~Cy(FH-5;ojTkoYQ*br@j~uS zon;g?;`NVsA$O;4H;NkZDkNK&{|!Fm?$pahQ6pXrNTqXk>Ib8!k=&88=H8HXLhd&& zIJckYzH;MYf(@4`ecx##=^42hUHIh40*4&q4osj#tEf#I%xo>QBmdoV6y!4FRmy5aYW)wBj^M6RCb9d?>qo|Sj ztRP;<-Kk@YqDH({B$dwHsVPQLBVH?s7jk#%VWX%Kua(6MxjXfqQPhanD&mFQo%+)# zYQ$?*Qt8~CT6>vd?$k)`NLh1l#yZFywR%oCCUt*oXRFgJllyAYGw#VWi@EP_6gATG z>ZC&MxF_S(2}V&P^I1c@a38>_X+}{aUTcyHx#OOUQ!g7ujd-mkUbqk7)bB=7BVKDq z3i~_UA9HHGCdDkMkt{HI&7wK$ge)$e^7^vA4R*FV%`;i76Wzl-ndUKz!;GRvdR~`Q zIt!;xGm09S&wAp8ES$RCC~CxOeNyQxoO;bDYQ$>;@j@0(Ei#H4@!Bv_Aq%J0Yg){L z8p#5a*DPAFPIxVQeqpssJ&TT3r$r`Uy7ryeni8u8jxyzpAKQy&^djd*Pq*M%%_ZSK_HMo}YK zVDg&9=ByL8iyr4(^p0n--m=9^H_v3Th4hSl)aEgZHbzk+J^wfMj0CZda%w-LsFC?> zDPGtvoI27dYQ$?RQXvcMqnx_TC~CxOYw^N%;naghQ6pa4L<(78ALZ2BMo}YKVDg$p zE7l2Ftk`qy)cXqlusW?WS+tJsVIS2hX3>1PVuI92&)bp;+Xb?4s*6$7$b7aFFJ$4= z5k^rXUfYvOXW`Toqo@%tTn+oVIv2cg$q5Q*;km>=?7y%_wT5=bcHVvv6vtQPjwMb`dXR;nev?Q6pZvl1gXc z)GVW@5wG3E3t2ezg;CUq*Y1%DSva-we~L4tMzX-i7f*S`v)I+@w9RDE zF1m-~McbG~U!$mzp4*cOS>Sl#)Oe$)k@<8GFB~tNy3{CY#A^>yAqyNYoO;kGYQ(Ff zc;R^A)O$uzBVL{2x{w8q7f$_Y6g83sCa+m^W}T45)gzv{(X&{0g<__iGg)+zo^kB% z9J6R+6gATGp0Q^nh%B7i-zaKiK3&BNSvYl+QPhZ6H&W>=oSI@3HR83Gcp(d?9x;j< z@#-Ge6|!*Z1EZ*sEHHV^q6h1QEE>JN=lY(-KUSwlCX2nLXJpYMX3>1bVuI92&pl($ zAq%J48%2%GXCLuG7EVS*e%>HPUmx*fX-g_q{u{l~L5l zeEN$QUT<=0Z=Sh!*;x$mbaO`$!gi+Lp*P)R@7C5JM>P(}kkt{HI&7z8R z!anNkUEY}CS=?%Msxny|7Tqyb?4zn;7S9?*jr2T-RQlNM)VD@aBl8(7Uf4%DwaO~R z1gR0PYEmH!9J`&`(I{%fYlwJZALZ0RMo}YPL*u%T1&-ZL9d8shk_9HOSqx*Hkj24` zciPpnxZdgv%VaTJdPWw*Viu1XMUC`)cLjD6kt{HI&7y{NLKb@-GIYFWG0p1KWU?3| zJtK>nn8lMuQ6oJc5ql0SW@XMoZ8MPYQ(EfypV-c z`x`}#c#Vte3RyUHv{BSZ7MQ$dF`jk8YvNO@oBz+VxZ3KB&tx${dd6$w<6{;N8%2%u zd}QnyS>QEsr{)_)jm&4Fc;Pj1r<$x*%z_&6I*L@t0`E_7YHOpY5wD}g3$KYg)z>I$ z#Os*og)H#?1gDNPiWYIqo|QAFnP^l66=KRVw;oh+QqXt+v-fpWO1_ejO}7l z%;GkqsF9veA(hU;sW*(GM&@&>cwxJ6>K~)15wFuog)FdLIJMat#RRDluhYc~Sva+? zQPhan8PN+_V7qYYNTaBcEHHV^;!M^F$BReL{-B3vagEhEGn2(x(ld@1XT~gM8byut zd^V|&1+KfDdetauWIpGJ7mgQB{b&?5;x(C6$O7k4POZ3RF$-$M>s;}|@xrOCjG{)o z&Wr0p7C4V`s+&>NNEVp9W^q32gzcis!~abkFNRp1^D|joAU$KdI6r1_v{BSZ&lkp? z!|}qY%Z#E%=5vvFVY_hZKBK4+uZu~AEU;ZT^}12ih}R|Jh3&$rg+@^$UYAC%uw6K{ z;#$SrsgW!&dClT7)(OXp9X4G2rf(NpTAj->SzInX<9Kmd%%Y=F)JV@)kP6!cju%c1 zGKw0R&lK^(@xrP98AXkFT}dirf#Zc!*BeERcwHr4$ik^7jG{)ou8v;F0>=xdJ~oOP z$pVwtEUsalaNWJh!<%pKSrpbTW_nE~i)*E4Tz6j+vuI%yHPZ8Sq(TN_!WP$rpPSqJjjm+m3 z@xuKmr>--K8u6M=DrABCQBJ*V6gA>?t9apllv95jMU8mf7T1L=aJ+D8i*<@Kq(-v9 zQPjwM?h-F- z7fwBG6gA>?H>r>XwhO1eGm0AVx<|aQT{yM+y2YtdBVIEig)FdLIJKKm)JPVXyk;?z zbskD;;QHd=NB`T#vlwJ`W@fUuH@ai0_{`eOn8is(Q6oLyM=ER=_{^G9w-`l@%;$db z!e`c;nr9R>;`IQjkOe-o=F}pis1dIR#S5QVbE?I9#Vn{1uZJR)41-xX)zv6!BnwPl zvv`ispQPjwM9u+T~ z(>nEmQPhanY*HZ$oYOkB^!mlAQX^iEi5Jdko!Z(cYQ*dDxGrRYeUwvujiN@fz~nWH zCs+sjD11(8gTD`4*Rwd<>O7Ij;z{Wl?@@drW^t)e)JV@y#h#HM-iz+kBSujp^Lbjl z@E%2{J~fIO@p^_-$O7+0cWT)Uidj%2UeAgb-lOPLE2F3pujj-I?@@HBzfshP*Yo0q z_b57bj8W8x*Bnym_b57bjZxG{?nqg4pUXPo*!2Fp$0VoH#i7Tv@C@YR^b zKSog_J-<#WWP$ymQ`@vCWqGIvcHz`4 zqo@(Dk0OOEaL(q``$kbCSzz*-#mB4@j!kX1nbFa+_}l7yoXKK-bVn9AHhmnkSfgbz zL29JuPe_FkIM1vB{}VjG{)oz9f}CHaXR3 z_m)=Yt4!`+OV7yttC)Lxqo|Rdzaf>*-KlD$sFC@6D_+RmsWXhCM!dcwmCoI%JB*@6 zyuKGNf8QOcsl!XJoM`X7Q0x)JV^N#-6dq#(gBGR@tmLA8KSie~A~eaH^A0 z)QH#Lq|#Y9HQp#{#OojNLKaRC~CxOnMffEoRc`U<`%^nQX^Sl@=F)G zB#*ZnINarbm~s1#tFE2cZFF6A?U1TL)d}9KO^05cJM7=R{eaFn#F*+aOGpf=8ac90 zT~%#evF85Wld1ztszTGdx^7(U=pY){eZTDo7Mn}px^ZLMx7S9x?p-r@+(>u@X>=SY6cD*K5EQBH!X21 zwChw|p@|~hsd{8}U3G>m&N@}QYxT%6)wNhayAGM4GI2oBAJ4PB_vzHHN9TdvIw8%t z?*B*C!^r;MlyBE=V8`|YTkX-UefRErcIef$N00W!r$uJVXxFkshxUcyeD|!b>s4Db zsKemFwbf(C7DACO?f2=@t4rs-yZ5vrx@{FJwCj;Pg^P{!@kj@X_J;SG(=;-@*9L$oL=pqkUoYcr2yQ#IbeNqpYRQNA72Fv`#YZ(zRpv zPThNSD6uYaXoG5Wso*tmV7F0KL#y|w8e474?u@-`W*h6D>?xA{Ky@+Uu2rK4WAB!` zfz^}q{|}Wy;{V@E6|?U%vbuUqp}0TyJyh5OWPfk|nFor$DDKSz-MXdzcF?e@;iFrY z{-353OFw_VbTOCSu-vU(R2o>=t?O9onQ z&84F)qcgi+{RU$Eow{`jV+}ipJ<|`BJX6vSl`J&v3X#BM{8Go$}#$TtKi@%h{!f&Oi&PSGM3lHQr=0w^>E~m1b4(Nkt zdvO9CMi1VjwrcdCVP!_qr?OZFQjb{2Qjb`NQ;#@3qI#q73f%OACj#Qp4B-5U4D)rz2uySWtrK>i%Z*Q&mIFiADLXH)g`Bt)yYOzy0jdD zE-go(Ddz}uX*q)Q(sCY_rDY$_TUzpTue>x0DlIKlA*80(sR|VY<(Edj!qV_~-qJc% z52+eAvTkg>>4~t?QbkxPO%YZ~RfOe7AhHUhNb4$%B$Zh>oNH#GP%6765H86`QWf)` z4PssYNLX(PMgm=NB%PBRR=tKz9E-b6$@V|C^!cBCT%Qx!$93J=$MqSIeLTI&?4z={ z%)`E>z8yQ(x2%jLyRwWVySR)byS|L1bcq>3W|gH1Uuch-p_Q_ehqDWmhqH^5hqDWl zhf5bF4`vpWezdrlJlp{b+wh0y6{TM^b9KLWE>TQd6U6l z`i<^TS64M?SoPo~8c`Xf(yYoLm4;RZsWiPZNcl0A0V>QhpNNC?=OKjUr&&gq8DSY+ zW^QG4nPHXDl}xCNs&p**vNE$sZHze^pq3JCJu?w)J#!IlJ+l#Q#rcS`@{H2bIH%Mv z$KqMzv&b1#C2?j_mBg7*RT5`rRY_bjtV+_-X;skLxQbUjdyW~`v8J|~uYP5QlqV?} zO`fD=AbFCKG2}^P@p%GWa*je4+F|6#ea6*|8CRD%ld`L;v>i3;ErreV@Ey$f=T97-gv>R6M}cgG3WCz*lo(_drH}j4!rMTK<{fKB z9X5P)72e{OcTrG5oLzDSaW=sU;%ufB#HC}YAkB=Zyw=B+jIqnOkt2InjViYf@`tk{ z$)QUkE~U#pT)I#xompD?QCUo{j@`Nqt{z=Ce8}+RO$vFLCupfCcVVTXY{q3Pl`Jy9 zQpL9O7F<$B_~hKI!loP_&0T1GGzy3B0ie4iuhRGD#C-MtLQek%rh?m@L0JOI9Ku%5-$I-{N7QqOy|i%rG57q zSySgdlw3e0J%q>0^&cKDmqB>ETngdw{I!Hf%dE#9mNj+jy>FQ$_(<+LQcTIDQ%v3? zIbD;;>lY75r~MBbUNg3L_4wg2@Wgyn}(A}lwK z5?R@Ss7^-GVb5M2@J5hvwdGDoM3FlLQRJ>(6uHY5Mb3KV@w|nm1+v19<7#V@GnC}< z-W6_Fl!$WInO~`7*HkLXU2Ul-XThbCyfv3-@|K;P#dPjeGhy`Dy4vchQTq)aTsN%D z-p-2U0+q&*3*UYSWWd(;NUUG%;<&~GZ;Wd#iwaIDw9^-}#sjlsld~~PG9LuV6 zhgepfJHfK*+-F%?bAaBW{kcIA1Q&l^-!uu&x zkLNBi^?2_3Qjg~@F72>4 zio8{;ByYXjwkop?8;Zv(t<(9ELt=(6|9JVep?ZaNB@fG*!f~5XmRVPcCU|GPz0_ zP~TzIwWIK1=DND%6G`QEbs1IeSTd^IiDXo{!^o&|=8)0kji6LiTz$7~JNB-w%G_&; zzt;7|U+aS6uXP3S*XfqyFQv!u+t}28$%n@?XQPSAexGSe^kM%|s?Ywuq%*5h+FJ3~ z{&d-|rgj8&9La5#F4f7$^=t8YgK=Z>b|Yn_x`O0h=D@O29d<>j22fF&UV25LOrw&r z(t!98?VKKTqTrfa#vZR$z5lOCU>PJnw+(kDDqaTlG63^gUgkdo061U zZAwyZu_;NpwWcKbOHB#Ntkf00(B9Q!lh^G#cJ#+`PN{N4*~R9Fvdhg8Wfzw*(CtK6G3ykAszS&XHzEP*2s8-B^AD*>TiUbqN-g8BMv8UJGxR zC>c=Ru`gGa9Zaq)`|QY-We1WgD}9FKiZX-9Q^^qe45}JkGmanTA3b(>-NZ6O$jWku zkd@^QAuG!rLROYDgsdoU2pN?RA$hKpK8oW&=F}D^E#2%5~ zGb1W1^*JR^C7aWJRkdTvoCoBHvXjXXWk-@D%FZH3R62wlNoMs~jW63LW6NHGCx~@{S~*$WCg> zJkk@ZkH}80KBD|HDt{H3N!DZF6ZMhjS1xu^a^7vvk9;CK(IxXpPqaQFJJI@x(uvlm z&rGx)Ab+B%bD_K^XS$|HE6-4*#f6m{o=7WCO{A5^CBlkxN-OIfP}#fY@!6It2k{aQ z$ty3xn7r~5ikEOysJo=YO0+VrUdcC7cB&qfys$ks`ToMPU(k`2<&G#T%Y6=IWx3Cv ztSo0BSyA37GAbVeZ-zdlKM%`mOQ&95nHhaqsn0*zQ>CY$H};GqJMD}lJLHU{SS3B%j3hhKj3oD|o42A0 zOU}%#)WzB4@S9gW{mjcqvg67~vg67~vg67~vg67~vg67~id8BsIWw-(5=9o@gwb>S z@WI2Y>{DdLuYC;9uyE#4R#t4aUYRbso@!x>D=SMczN|MIUmRt}pF}bTQg{QGS|UNu&E}y#d`EQ&HD8^%lh>?$@=x_Io7Y1Db_15 z&ahLrKD}@&#|Puj;w2dAzs7aK{~FhU|7%?5|F7|M9RC`Ybp9<}-xEIf<4oyPCCj2( zqmbu7j#?*QpIQf9pE^C)`m{2}dc<*R{+#ybx$TL|Os-xcGrf9=%mnKtGE=OVD4Arv z`qF9E2NWmTd34obBdfdam%M{#Y)!no6;2{cA1$t;+@r;g!)bIrTkcVvXg=$wOnE)$ zuScd*QnpAWPoBJTVUd}Kbq1M-bqJYH5m4G_`UnU28d2dd1~5vhFgXm}q7^~5*bBi{TW62 z8IdgI|8#bC&21Z77JZ+8lgv{dWh?g8jGeeFC%5Lw#Yl|J8=6#+QWE|9X|U12IcKla zfKrtQM`v}T_d?@?AOK1|W{tqK9hgG==vyX{tNLWID)SxMw#?j?$K;ZPhSPfb*Y*3G z@ycAXo`mpeibElMA|hlxC4J=Mbm?FbwdJ6)`~uAH$IG)G<^F}o({UeHR|5H*3FMw6-7;XGq_GwoxEKff<(2kky z<3p>4P}sI@TiiCQx-6kzAH)}ZiucFz3rl4!Z5}qi?e^u%QGGh24GU4uhiF)R#-sS&vD!=b1=Rm_wK8L|Y z4ug^$1~WM*y+zc*7Ro^VEUsQYWu4j)O1;ZP78esYRG{o@(#P)s=sLx!LdjjhN5)&XUBOpVMfcT9-h!V>& zQmC6PsOT9^wadr%oBLPK<3H)*Xgg8MXdils_6C+{uVaa}ZkAXlY614v-d^8)IPJcb zUrwBiw7t%BIdD9+M6_mFh1NjRb-?9bSE0NLI%92HRMUhg$wv^)6X~^&vg^J2O?cZo zw2=jw4~F-Qi9KK4@Pl=+6@u6b!7NY+wm*d=wjvr^m>T>2@x0mH zUG6n+`_@m#ha+9X>7rgi7xf~#sMpa&t&}e4)bz+GXz=p(bkqks=S~cg2{A|}!XTLd zgK%&IB!Ool1|2TP?>7(c%9Rm)CHx#VU|HaRWuXI>1rHd94^Se&Q%*wJSjLCv2TO71 zH!6q_3WyNKj}V5B5JZm%1rLmiT~1M!V@C*MM+jp_2xCVGVn>8x2gb#&UqC|gcFr)a zaNz2Ym$^FXcDAt8-!g|j)A6;#Xue#q3cZn7#hlyXeLUI@=k&wV&F5Fog2`xHbJY;eFOx?~_h_7oGf%CmPPaJ_2QRetQg-HC9&gibb1Uck9LzaC|8lPO*XCZ%`FWRf-fhm=`Ib}8ZHiU5?zAjU zp}M%Hw~KniUDQkNqTX{C^{Tt5x7|gp@Gj___sDU>xP3m{eIEAq!#}Re%eU|5{c5|4 z^p>GI`~}GC==L;i`n))+AnC`2XU4|9JWbZS1)+8U7)1w+!UN{#LAp>C0DXZ1rL2Uq z109d3x=+8X2nSGb2T)`OP*?|OOjm}0wr-=9UCxl;@>YQIZ+6HX>a$V;klVpZTGQ%X9VN%U72WAkoW{SF%W|$;1Op+NU$qbWf zhB+{Upfz)K|DSR)_4y`@`pi1RDtn zLK0G(B%Eqt(3rU`KPK`xyoL1cakz7-F3IH#1egc}7zhL;4}>HRbxrC4lkoL^yE%RQ zgxRJVq?&4wXR1MxsU{hwijKaOrg0BPk)MD2PgyPX^$2f{vO_g%sY^??E-h)hwB+y7 z!AO^lj(YHHt(=XvM>>nvV>QM``f=Z53j#& zcJeEbWo?IUJiV0M(@PdSy=27GeLJ3AFy&xtt!x}HYd!5A63xagt`FL0h{X;c~1+_3XyG0=G2B3w87ov;~CbUO-e?0AS8}Vw!KmA?(eE+ndAv z?ru|_8&9vsGFJy{KW8&1xs&Be_=F1v5-Mt7Y;sX%XFVbOxEU_bmR~(hb>yfR$x)G# zqv9n;gPI(Sc2d#`x?C=Me|vQ`ULySd`s)1C@i6?QZE0pUlrFmsNLIH2DeE>Maoq;0 zuZx4k9&c6Fx%Q^awYS@2d3pWmxt(S`?00v&2H2>Ug;gh+b^8 z#x~E|tm}46^K(3>Ut+cO?T?pBeXq;-0(<6A`u(^+e0$nFeBIrhKkOd1``uxi9VEV6 zXrME5p@HgKXrS|Pp+TIA3%Gdf^YhC2emM4o&y?jh?I*n_Y&eJM(Ij!HZ#$)y`(8_{ zyL=oVE`=v+pKs2Wdu1+nlI^GONzKM5gxC>6=9CaJiG&Err5@8pKoVZvJ?{SO1#Cc? zuK{Vi2Bhg4kc4aHEZbP0qJ8)G=kkQX@ao2TSS$bY$LsQQep5<&x}CFixa-(Da(e>4 z)bBc0oOZH_-VPf~cgQF`N3H+i3!ZxXcz68kU3tCY;qJNKiQ0~O-fNGi_0Z#KUG(_c zzh56cp4Lf^r}fg~b=~x6SU(+nUPs@3e*d(8+>Jl-RrYh!jZk*Y5T)ybC|wIgse7W- zI8o}EsA!iMaS9NcyeV%$qX}->SETFE_F|`H(n}ZVs10@JfW~RHdyb-fG3L(=-h&oy`MTDq*^a!z- z^kJru5W$+%qpb)`mddQS%!ljK=C7N>`Ehf&+ujcskxu1)jJEChxzXckF743<+an$Ey#``4SF2iLs^st~E;Zo6SbyaYsidPHn&1YBMs z=Ab`6Y~}8Rp+)_>MzVZ6_C;R*9!Fezkzro`Jdf@5{&=1~zgn+jK}Y9W*kQO9P>2H@ zc^P5-`#i+q+MGU4F$ifD9b~KMWM~zg1FaIr+5RpA9Sdfp<$;%S)8@BLxi0nyrwx}e z3j?DU266}kiG-1CLTJi}%z1|``0~r>Z5L@LkSS_HQ`BgtsF_SLhA|~cG1undm&<- zNitM)q`r+EPphchR*55Rf0vPtg?XgK!rRTaZ=1yGSkuwQc6PjTO-DS};+W@(jCv}~ z<1RtcanCg!_gt&Xx8t5`I_|j^$30hM+*4^DcZrfdC3x9ey1I^^+S?4it~q=?X7N?Y zmBhtGMNk4{bl~GYx;INHgyTKJ)r_$}{sm&fI?- zC4?#POx>I>Kfdzrc=yNf_Nw7G=r@nM@=a3Kx|s&W-q94LhL&pffuFbx?LH2cY)Q z0aOb1V6_AwiV0;=^A|`{RU*X+ro*>*G13mVk^|U*a{6VwtC^jcDY{W zf>bXJ&n=<8V6RQsa4c%YnkOk%MPcvZTP8)6>syA2+KMnGTZxQ}H5YumXD&%TRWbTh z#q3kHwhiH@DyE;RJca6ger?R0hXk~4U5lG@^>W|(3oF>v(SoU?2UABArj9O59c`F; zZJ(thBXeWdYPisJc~U!k%Nlmeiq#P=Vi+{*ElhsJAhtr3UMMG_-ncWq?c;R(cJs^O zkHhgV`L=L8M&&q4$#ImE<2WgD9AxD%NlR%b@47t1d^$e+mmGvGD=;-kpQ)pd`x3vb z+E1TB$2gua`vLVgXcQ0hD3^)M5b;W6Pw*)SaB0bCWh5x58f65p`%i0@Fbs zVXZp?^0_(%w17)E?3}j`n|jTmZ4MzpU@&E1FlS(JMFs}427=Oh#N{m?4HokT2J;36 z^9Ba<1_ts5g7SLA<-OkCowl3vRzu4nK*2iV6<{5<91OA^SAZy#!k|?GK`mkA7dR*R z=AcRI;(|K@Q8IxjnZVj(kW3&-CJ-eP2$BgS$-p_uWuq?FK+12IeJM}8Oh<0rRXL~* zd;vlYadD_1LJ&V96g@C5cGorU;M$rzVpoc;7gQOEwb_|fZE;OWO z6a_JgvxiX>#3%@2kOU#=1eKe{hgbRj&%^f1&9}{$Z1yOIViZFuilGq2K!!pjLMSI; zc=&DncvikIO*Wtip@0Zs{0L$A2to9SQ1HOG*q=_jFJHE&&l)`(?g*@dUIEsDhuv@9 z;|dU^<~@d87J(p_FcJ)$lRVD64+p<}1#v>5UZK#fP_?fhRw%S86wXzlz^5=IGeXYf z$89-fFP}dz7rI~Vcf;9ixn{Xfw$~i58N%*A$5Bj@ z;SG>Po{1Rr`c&R6a%VKM`mqeREoVRl7 zS*C_w3k!P{#c-l1hQSrX38NUqSBMM<6#@> zo0P77ucguYLf>KHr8KOAl%-XX!ETL|X+OTM{B^lld)d?H9|AK$j_VnfRzc=T1<*kInyB+GeSa}m> z_N7+01&ZsoKzrR5sIc1tJa&1K*=yj8mPvZO{e4qj@-yD0+fHV~z7x2bY?-Th!X7Z~ zZ<)h&koFh$j=+I$pvbaf&TW~|>{gG_k;9pp_7^e&hqDkkZ~+v#P^`KbUKjZHcvpD$ z?fw9H3*DZYf&}vU6Uc^75SN^pDfSO5QUfEQf$^I_83!;D8JLh5h!|LrG4IFQ7Pow| zGZ(Si{^44II>HW6hu8K9X%8JBh|0z=%^n4uA}xDAQlI6FxA5HNb|RsABB6dFQTwoh zBB6#N5hhZ}7>Vd8)zF(TT5$6IY&{SXFPzt(I@f^F{5dl!78CBb}ge z($IS>hJAnO!x5;%5oo~?7~T<(+0`kk1?GfhlGsB0W!I805}Gg)nlKWYFcL9gtV_ZG z%n9F=i??IMSI<9fzTqJpAk7JoMg>UI0u%!SBAJz$V-HVhkFn(e_+jGux`y?2&FSkJ z(br=-UzK34JZCB!+fV&ek|lRVqNkDU`|+%(pL||>p3qMw&{EmAk7Jo zMg>UI0u%!SBAJz$W7i|Ni48w`R^}{X8XYkWkC?_sEDAtK6cE*sKl{L3R~3_wyG&?Ra4k%Okr!1!W8Ee!^|CH zq?_Vg*Cf>5&Ou+-G`=45_^KpwWuNKl&&_Us`5BtJj&APLc!+XRM0EuY<3g14BT6a| zL@Px01tmXAHJ&)f{u;ebQ=`|JYV zoVs96T`;FEn2Ro$5*LWgEZt8EZ+Tx!lp4+Z zvWGOHqD^ANB|u_woK~YvI$s)liJ;D_1WYw>k6M0UxCKBo*5;1+OOWpv~gtz~9xj_B; z>+YdMw;!$Bj)jOix*kzS*LEm*A3efb%KK;=7!lSI)tw~(oTYcW`>VtKb$Oj`M^uE+ zRfJGiglbR0ScFhog#7FpV@C+oMTG1H#tAI%v3l5Vp6l7*+lQxO^XI3>ho?t97a9lE zZBb*i%UWw%pq&-V2ve-v0=#v3lGtnDjCzT~Y30;3?y5#V-4 uav, uint address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_ADD); +} + +uint NvInterlockedMinFp16x2(RWTexture1D uav, uint address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MIN); +} + +uint NvInterlockedMaxFp16x2(RWTexture1D uav, uint address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MAX); +} + +uint NvInterlockedAddFp16x2(RWTexture2D uav, uint2 address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_ADD); +} + +uint NvInterlockedMinFp16x2(RWTexture2D uav, uint2 address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MIN); +} + +uint NvInterlockedMaxFp16x2(RWTexture2D uav, uint2 address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MAX); +} + +uint NvInterlockedAddFp16x2(RWTexture3D uav, uint3 address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_ADD); +} + +uint NvInterlockedMinFp16x2(RWTexture3D uav, uint3 address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MIN); +} + +uint NvInterlockedMaxFp16x2(RWTexture3D uav, uint3 address, uint fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MAX); +} + + +// versions taking two fp32 values (internally converted to fp16) +uint NvInterlockedAddFp16x2(RWTexture1D uav, uint address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_ADD); +} + +uint NvInterlockedMinFp16x2(RWTexture1D uav, uint address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_MIN); +} + +uint NvInterlockedMaxFp16x2(RWTexture1D uav, uint address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_MAX); +} + +uint NvInterlockedAddFp16x2(RWTexture2D uav, uint2 address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_ADD); +} + +uint NvInterlockedMinFp16x2(RWTexture2D uav, uint2 address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_MIN); +} + +uint NvInterlockedMaxFp16x2(RWTexture2D uav, uint2 address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_MAX); +} + +uint NvInterlockedAddFp16x2(RWTexture3D uav, uint3 address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_ADD); +} + +uint NvInterlockedMinFp16x2(RWTexture3D uav, uint3 address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_MIN); +} + +uint NvInterlockedMaxFp16x2(RWTexture3D uav, uint3 address, float2 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x2Tofp16x2(val), NV_EXTN_ATOM_MAX); +} + + +//----------------------------------------------------------------------------// + +// The functions below perform Atomic operation on a R16G16B16A16_FLOAT UAV at the given address +// the uint2 paramater 'fp16x2Val' is treated as four fp16 values +// i.e, fp16x2Val.x = uav.xy and fp16x2Val.y = uav.yz +// The returned value are the four fp16 values (.xyzw components) packed into uint2 +// Warning: Behaviour of these set of functions is undefined if the UAV is not +// of R16G16B16A16_FLOAT format (might result in app crash or TDR) + +uint2 NvInterlockedAddFp16x4(RWTexture1D uav, uint address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_ADD); +} + +uint2 NvInterlockedMinFp16x4(RWTexture1D uav, uint address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MIN); +} + +uint2 NvInterlockedMaxFp16x4(RWTexture1D uav, uint address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MAX); +} + +uint2 NvInterlockedAddFp16x4(RWTexture2D uav, uint2 address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_ADD); +} + +uint2 NvInterlockedMinFp16x4(RWTexture2D uav, uint2 address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MIN); +} + +uint2 NvInterlockedMaxFp16x4(RWTexture2D uav, uint2 address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MAX); +} + +uint2 NvInterlockedAddFp16x4(RWTexture3D uav, uint3 address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_ADD); +} + +uint2 NvInterlockedMinFp16x4(RWTexture3D uav, uint3 address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MIN); +} + +uint2 NvInterlockedMaxFp16x4(RWTexture3D uav, uint3 address, uint2 fp16x2Val) +{ + return __NvAtomicOpFP16x2(uav, address, fp16x2Val, NV_EXTN_ATOM_MAX); +} + +// versions taking four fp32 values (internally converted to fp16) +uint2 NvInterlockedAddFp16x4(RWTexture1D uav, uint address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_ADD); +} + +uint2 NvInterlockedMinFp16x4(RWTexture1D uav, uint address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_MIN); +} + +uint2 NvInterlockedMaxFp16x4(RWTexture1D uav, uint address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_MAX); +} + +uint2 NvInterlockedAddFp16x4(RWTexture2D uav, uint2 address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_ADD); +} + +uint2 NvInterlockedMinFp16x4(RWTexture2D uav, uint2 address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_MIN); +} + +uint2 NvInterlockedMaxFp16x4(RWTexture2D uav, uint2 address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_MAX); +} + +uint2 NvInterlockedAddFp16x4(RWTexture3D uav, uint3 address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_ADD); +} + +uint2 NvInterlockedMinFp16x4(RWTexture3D uav, uint3 address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_MIN); +} + +uint2 NvInterlockedMaxFp16x4(RWTexture3D uav, uint3 address, float4 val) +{ + return __NvAtomicOpFP16x2(uav, address, __fp32x4Tofp16x4(val), NV_EXTN_ATOM_MAX); +} + + +//----------------------------------------------------------------------------// +//----------------------------- FP32 Atmoic Functions-------------------------// +//----------------------------------------------------------------------------// + +// The functions below performs atomic add on the given UAV treating the value as float +// byteAddress must be multiple of 4 +// The returned value is the value present in memory location before the atomic add + +float NvInterlockedAddFp32(RWByteAddressBuffer uav, uint byteAddress, float val) +{ + return __NvAtomicAddFP32(uav, byteAddress, val); +} + +//----------------------------------------------------------------------------// + +// The functions below perform atomic add on a R32_FLOAT UAV at the given address +// the returned value is the value before performing the atomic add +// Warning: Behaviour of these set of functions is undefined if the UAV is not +// of R32_FLOAT format (might result in app crash or TDR) + +float NvInterlockedAddFp32(RWTexture1D uav, uint address, float val) +{ + return __NvAtomicAddFP32(uav, address, val); +} + +float NvInterlockedAddFp32(RWTexture2D uav, uint2 address, float val) +{ + return __NvAtomicAddFP32(uav, address, val); +} + +float NvInterlockedAddFp32(RWTexture3D uav, uint3 address, float val) +{ + return __NvAtomicAddFP32(uav, address, val); +} + diff --git a/compat/nvapi/nvHLSLExtnsInternal.h b/compat/nvapi/nvHLSLExtnsInternal.h new file mode 100644 index 0000000..1c2ebf6 --- /dev/null +++ b/compat/nvapi/nvHLSLExtnsInternal.h @@ -0,0 +1,472 @@ +////////////////////////// NVIDIA SHADER EXTENSIONS ///////////////// +// internal functions +// Functions in this file are not expected to be called by apps directly + +#include "nvShaderExtnEnums.h" + +struct NvShaderExtnStruct +{ + uint opcode; // opcode + uint rid; // resource ID + uint sid; // sampler ID + + uint4 dst1u; // destination operand 1 (for instructions that need extra destination operands) + uint4 padding0[3]; // currently unused + + uint4 src0u; // uint source operand 0 + uint4 src1u; // uint source operand 0 + uint4 src2u; // uint source operand 0 + uint4 dst0u; // uint destination operand + + uint markUavRef; // the next store to UAV is fake and is used only to identify the uav slot + float padding1[28];// struct size: 256 bytes +}; + +// RW structured buffer for Nvidia shader extensions + +// Application needs to define NV_SHADER_EXTN_SLOT as a unused slot, which should be +// set using NvAPI_D3D11_SetNvShaderExtnSlot() call before creating the first shader that +// uses nvidia shader extensions. E.g before including this file in shader define it as: +// #define NV_SHADER_EXTN_SLOT u7 + +// Note that other operations to this UAV will be ignored so application +// should bind a null resource +RWStructuredBuffer g_NvidiaExt : register( NV_SHADER_EXTN_SLOT ); + + +//----------------------------------------------------------------------------// +// the exposed SHFL instructions accept a mask parameter in src2 +// To compute lane mask from width of segment: +// minLaneID : currentLaneId & src2[12:8] +// maxLaneID : minLaneId | (src2[4:0] & ~src2[12:8]) +// where [minLaneId, maxLaneId] defines the segment where currentLaneId belongs +// we always set src2[4:0] to 11111 (0x1F), and set src2[12:8] as (32 - width) +int __NvGetShflMaskFromWidth(uint width) +{ + return ((NV_WARP_SIZE - width) << 8) | 0x1F; +} + +//----------------------------------------------------------------------------// + +void __NvReferenceUAVForOp(RWByteAddressBuffer uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav.Store(index, 0); +} + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = float2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = float2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = float2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = float4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = float4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = float4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = 0.0f; +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = 0.0f; +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = 0.0f; +} + + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = uint2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = uint2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = uint2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = uint4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = uint4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = uint4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = 0; +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = 0; +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = 0; +} + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = int2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = int2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = int2(0,0); +} + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = int4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = int4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = int4(0,0,0,0); +} + +void __NvReferenceUAVForOp(RWTexture1D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[index] = 0; +} + +void __NvReferenceUAVForOp(RWTexture2D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint2(index,index)] = 0; +} + +void __NvReferenceUAVForOp(RWTexture3D uav) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].markUavRef = 1; + uav[uint3(index,index,index)] = 0; +} + +//----------------------------------------------------------------------------// +// ATOMIC op sub-opcodes +#define NV_EXTN_ATOM_ADD 3 +#define NV_EXTN_ATOM_MAX 6 +#define NV_EXTN_ATOM_MIN 7 + +//----------------------------------------------------------------------------// + +// performs Atomic operation on two consecutive fp16 values in the given UAV +// the uint paramater 'fp16x2Val' is treated as two fp16 values +// the passed sub-opcode 'op' should be an immediate constant +// byteAddress must be multiple of 4 +// the returned value are the two fp16 values packed into a single uint +uint __NvAtomicOpFP16x2(RWByteAddressBuffer uav, uint byteAddress, uint fp16x2Val, uint atomicOpType) +{ + __NvReferenceUAVForOp(uav); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.x = byteAddress; + g_NvidiaExt[index].src1u.x = fp16x2Val; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + + return g_NvidiaExt[index].dst0u.x; +} + +//----------------------------------------------------------------------------// + +// performs Atomic operation on a R16G16_FLOAT UAV at the given address +// the uint paramater 'fp16x2Val' is treated as two fp16 values +// the passed sub-opcode 'op' should be an immediate constant +// the returned value are the two fp16 values (.x and .y components) packed into a single uint +// Warning: Behaviour of these set of functions is undefined if the UAV is not +// of R16G16_FLOAT format (might result in app crash or TDR) + +uint __NvAtomicOpFP16x2(RWTexture1D uav, uint address, uint fp16x2Val, uint atomicOpType) +{ + __NvReferenceUAVForOp(uav); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.x = address; + g_NvidiaExt[index].src1u.x = fp16x2Val; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + + return g_NvidiaExt[index].dst0u.x; +} + +uint __NvAtomicOpFP16x2(RWTexture2D uav, uint2 address, uint fp16x2Val, uint atomicOpType) +{ + __NvReferenceUAVForOp(uav); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.xy = address; + g_NvidiaExt[index].src1u.x = fp16x2Val; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + + return g_NvidiaExt[index].dst0u.x; +} + +uint __NvAtomicOpFP16x2(RWTexture3D uav, uint3 address, uint fp16x2Val, uint atomicOpType) +{ + __NvReferenceUAVForOp(uav); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.xyz = address; + g_NvidiaExt[index].src1u.x = fp16x2Val; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + + return g_NvidiaExt[index].dst0u.x; +} + +//----------------------------------------------------------------------------// + +// performs Atomic operation on a R16G16B16A16_FLOAT UAV at the given address +// the uint2 paramater 'fp16x2Val' is treated as four fp16 values +// i.e, fp16x2Val.x = uav.xy and fp16x2Val.y = uav.yz +// the passed sub-opcode 'op' should be an immediate constant +// the returned value are the four fp16 values (.xyzw components) packed into uint2 +// Warning: Behaviour of these set of functions is undefined if the UAV is not +// of R16G16B16A16_FLOAT format (might result in app crash or TDR) + +uint2 __NvAtomicOpFP16x2(RWTexture1D uav, uint address, uint2 fp16x2Val, uint atomicOpType) +{ + __NvReferenceUAVForOp(uav); + + // break it down into two fp16x2 atomic ops + uint2 retVal; + + // first op has x-coordinate = x * 2 + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.x = address * 2; + g_NvidiaExt[index].src1u.x = fp16x2Val.x; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + retVal.x = g_NvidiaExt[index].dst0u.x; + + // second op has x-coordinate = x * 2 + 1 + index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.x = address * 2 + 1; + g_NvidiaExt[index].src1u.x = fp16x2Val.y; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + retVal.y = g_NvidiaExt[index].dst0u.x; + + return retVal; +} + +uint2 __NvAtomicOpFP16x2(RWTexture2D uav, uint2 address, uint2 fp16x2Val, uint atomicOpType) +{ + __NvReferenceUAVForOp(uav); + + // break it down into two fp16x2 atomic ops + uint2 retVal; + + // first op has x-coordinate = x * 2 + uint2 addressTemp = uint2(address.x * 2, address.y); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.xy = addressTemp; + g_NvidiaExt[index].src1u.x = fp16x2Val.x; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + retVal.x = g_NvidiaExt[index].dst0u.x; + + // second op has x-coordinate = x * 2 + 1 + addressTemp.x++; + index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.xy = addressTemp; + g_NvidiaExt[index].src1u.x = fp16x2Val.y; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + retVal.y = g_NvidiaExt[index].dst0u.x; + + return retVal; +} + +uint2 __NvAtomicOpFP16x2(RWTexture3D uav, uint3 address, uint2 fp16x2Val, uint atomicOpType) +{ + __NvReferenceUAVForOp(uav); + + // break it down into two fp16x2 atomic ops + uint2 retVal; + + // first op has x-coordinate = x * 2 + uint3 addressTemp = uint3(address.x * 2, address.y, address.z); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.xyz = addressTemp; + g_NvidiaExt[index].src1u.x = fp16x2Val.x; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + retVal.x = g_NvidiaExt[index].dst0u.x; + + // second op has x-coordinate = x * 2 + 1 + addressTemp.x++; + index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.xyz = addressTemp; + g_NvidiaExt[index].src1u.x = fp16x2Val.y; + g_NvidiaExt[index].src2u.x = atomicOpType; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP16_ATOMIC; + retVal.y = g_NvidiaExt[index].dst0u.x; + + return retVal; +} + +uint __fp32x2Tofp16x2(float2 val) +{ + return (f32tof16(val.y)<<16) | f32tof16(val.x) ; +} + +uint2 __fp32x4Tofp16x4(float4 val) +{ + return uint2( (f32tof16(val.y)<<16) | f32tof16(val.x), (f32tof16(val.w)<<16) | f32tof16(val.z) ) ; +} + +// FP32 Atomic functions + +// performs Atomic operation treating the uav as float (fp32) values +// the passed sub-opcode 'op' should be an immediate constant +// byteAddress must be multiple of 4 +float __NvAtomicAddFP32(RWByteAddressBuffer uav, uint byteAddress, float val) +{ + __NvReferenceUAVForOp(uav); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.x = byteAddress; + g_NvidiaExt[index].src1u.x = asuint(val); // passing as uint to make it more convinient for the driver to translate + g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_ADD; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP32_ATOMIC; + + return asfloat(g_NvidiaExt[index].dst0u.x); +} + +float __NvAtomicAddFP32(RWTexture1D uav, uint address, float val) +{ + __NvReferenceUAVForOp(uav); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.x = address; + g_NvidiaExt[index].src1u.x = asuint(val); + g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_ADD; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP32_ATOMIC; + + return asfloat(g_NvidiaExt[index].dst0u.x); +} + +float __NvAtomicAddFP32(RWTexture2D uav, uint2 address, float val) +{ + __NvReferenceUAVForOp(uav); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.xy = address; + g_NvidiaExt[index].src1u.x = asuint(val); + g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_ADD; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP32_ATOMIC; + + return asfloat(g_NvidiaExt[index].dst0u.x); +} + +float __NvAtomicAddFP32(RWTexture3D uav, uint3 address, float val) +{ + __NvReferenceUAVForOp(uav); + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].src0u.xyz = address; + g_NvidiaExt[index].src1u.x = asuint(val); + g_NvidiaExt[index].src2u.x = NV_EXTN_ATOM_ADD; + g_NvidiaExt[index].opcode = NV_EXTN_OP_FP32_ATOMIC; + + return asfloat(g_NvidiaExt[index].dst0u.x); +} + diff --git a/compat/nvapi/nvShaderExtnEnums.h b/compat/nvapi/nvShaderExtnEnums.h new file mode 100644 index 0000000..4293d94 --- /dev/null +++ b/compat/nvapi/nvShaderExtnEnums.h @@ -0,0 +1,38 @@ +//////////////////////////////////////////////////////////////////////////////// +////////////////////////// NVIDIA SHADER EXTENSIONS //////////////////////////// +//////////////////////////////////////////////////////////////////////////////// + +// This file can be included both from HLSL shader code as well as C++ code. +// The app should call NvAPI_D3D_IsNvShaderExtnOpCodeSupported() to +// check for support for every nv shader extension opcode it plans to use + + + +//----------------------------------------------------------------------------// +//---------------------------- NV Shader Extn Version -----------------------// +//----------------------------------------------------------------------------// +#define NV_SHADER_EXTN_VERSION 1 + +//----------------------------------------------------------------------------// +//---------------------------- Misc constants --------------------------------// +//----------------------------------------------------------------------------// +#define NV_WARP_SIZE 32 + + +//----------------------------------------------------------------------------// +//---------------------------- opCode constants ------------------------------// +//----------------------------------------------------------------------------// + + +#define NV_EXTN_OP_SHFL 1 +#define NV_EXTN_OP_SHFL_UP 2 +#define NV_EXTN_OP_SHFL_DOWN 3 +#define NV_EXTN_OP_SHFL_XOR 4 + +#define NV_EXTN_OP_VOTE_ALL 5 +#define NV_EXTN_OP_VOTE_ANY 6 +#define NV_EXTN_OP_VOTE_BALLOT 7 + +#define NV_EXTN_OP_GET_LANE_ID 8 +#define NV_EXTN_OP_FP16_ATOMIC 12 +#define NV_EXTN_OP_FP32_ATOMIC 13 diff --git a/compat/nvapi/nvapi.h b/compat/nvapi/nvapi.h new file mode 100644 index 0000000..803f84e --- /dev/null +++ b/compat/nvapi/nvapi.h @@ -0,0 +1,11760 @@ +#include"nvapi_lite_salstart.h" +#include"nvapi_lite_common.h" +#include"nvapi_lite_sli.h" +#include"nvapi_lite_surround.h" +#include"nvapi_lite_stereo.h" +#include"nvapi_lite_d3dext.h" + /************************************************************************************************************************************\ +|* *| +|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *| +|* *| +|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *| +|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *| +|* Otherwise, you have no rights to use or access this software in any manner. *| +|* *| +|* If not covered by the applicable NVIDIA software license agreement: *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *| +|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *| +|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *| +|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *| +|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *| +|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. *| +|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial computer software documentation" *| +|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the software with only those rights set forth herein. *| +|* *| +|* Any use of this software in individual and commercial software must include, *| +|* in the user documentation and internal comments to the code, *| +|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *| +|* *| + \************************************************************************************************************************************/ + + +/////////////////////////////////////////////////////////////////////////////// +// +// Date: Jan 27, 2016 +// File: nvapi.h +// +// NvAPI provides an interface to NVIDIA devices. This file contains the +// interface constants, structure definitions and function prototypes. +// +// Target Profile: developer +// Target Platform: windows +// +/////////////////////////////////////////////////////////////////////////////// +#ifndef _NVAPI_H +#define _NVAPI_H + +#pragma pack(push,8) // Make sure we have consistent structure packings + +#ifdef __cplusplus +extern "C" { +#endif +// ==================================================== +// Universal NvAPI Definitions +// ==================================================== +#ifndef _WIN32 +#define __cdecl +#endif + + + +//! @} + +//! \ingroup nvapistatus +#define NVAPI_API_NOT_INTIALIZED NVAPI_API_NOT_INITIALIZED //!< Fix typo in error code + +//! \ingroup nvapistatus +#define NVAPI_INVALID_USER_PRIVILEDGE NVAPI_INVALID_USER_PRIVILEGE //!< Fix typo in error code + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Initialize +// +//! This function initializes the NvAPI library (if not already initialized) but always increments the ref-counter. +//! This must be called before calling other NvAPI_ functions. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_ERROR An error occurred during the initialization process (generic error) +//! \retval NVAPI_LIBRARYNOTFOUND Failed to load the NVAPI support library +//! \retval NVAPI_OK Initialized +//! \sa nvapistatus +//! \ingroup nvapifunctions +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Initialize(); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Unload +// +//! DESCRIPTION: Decrements the ref-counter and when it reaches ZERO, unloads NVAPI library. +//! This must be called in pairs with NvAPI_Initialize. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! Note: By design, it is not mandatory to call NvAPI_Initialize before calling any NvAPI. +//! When any NvAPI is called without first calling NvAPI_Initialize, the internal refcounter +//! will be implicitly incremented. In such cases, calling NvAPI_Initialize from a different thread will +//! result in incrementing the refcount again and the user has to call NvAPI_Unload twice to +//! unload the library. However, note that the implicit increment of the refcounter happens only once. +//! If the client wants unload functionality, it is recommended to always call NvAPI_Initialize and NvAPI_Unload in pairs. +//! +//! Unloading NvAPI library is not supported when the library is in a resource locked state. +//! Some functions in the NvAPI library initiates an operation or allocates certain resources +//! and there are corresponding functions available, to complete the operation or free the +//! allocated resources. All such function pairs are designed to prevent unloading NvAPI library. +//! +//! For example, if NvAPI_Unload is called after NvAPI_XXX which locks a resource, it fails with +//! NVAPI_ERROR. Developers need to call the corresponding NvAPI_YYY to unlock the resources, +//! before calling NvAPI_Unload again. +//! +//! \retval ::NVAPI_ERROR One or more resources are locked and hence cannot unload NVAPI library +//! \retval ::NVAPI_OK NVAPI library unloaded +//! +//! \ingroup nvapifunctions +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Unload(); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetErrorMessage +// +//! This function converts an NvAPI error code into a null terminated string. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 80 +//! +//! \param nr The error code to convert +//! \param szDesc The string corresponding to the error code +//! +//! \return NULL terminated string (always, never NULL) +//! \ingroup nvapifunctions +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetErrorMessage(NvAPI_Status nr,NvAPI_ShortString szDesc); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetInterfaceVersionString +// +//! This function returns a string describing the version of the NvAPI library. +//! The contents of the string are human readable. Do not assume a fixed +//! format. +//! +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 80 +//! +//! \param szDesc User readable string giving NvAPI version information +//! +//! \return See \ref nvapistatus for the list of possible return values. +//! \ingroup nvapifunctions +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetInterfaceVersionString(NvAPI_ShortString szDesc); + + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// All display port related data types definition starts +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// This category is intentionally added before the #ifdef. The #endif should also be in the same scope +#ifndef DISPLAYPORT_STRUCTS_DEFINED +#define DISPLAYPORT_STRUCTS_DEFINED + +//! \ingroup dispcontrol +//! Used in NV_DISPLAY_PORT_INFO. +typedef enum _NV_DP_LINK_RATE +{ + NV_DP_1_62GBPS = 6, + NV_DP_2_70GBPS = 0xA, + NV_DP_5_40GBPS = 0x14, + NV_DP_8_10GBPS = 0x1E +} NV_DP_LINK_RATE; + + +//! \ingroup dispcontrol +//! Used in NV_DISPLAY_PORT_INFO. +typedef enum _NV_DP_LANE_COUNT +{ + NV_DP_1_LANE = 1, + NV_DP_2_LANE = 2, + NV_DP_4_LANE = 4, +} NV_DP_LANE_COUNT; + + +//! \ingroup dispcontrol +//! Used in NV_DISPLAY_PORT_INFO. +typedef enum _NV_DP_COLOR_FORMAT +{ + NV_DP_COLOR_FORMAT_RGB = 0, + NV_DP_COLOR_FORMAT_YCbCr422, + NV_DP_COLOR_FORMAT_YCbCr444, +} NV_DP_COLOR_FORMAT; + + +//! \ingroup dispcontrol +//! Used in NV_DISPLAY_PORT_INFO. +typedef enum _NV_DP_COLORIMETRY +{ + NV_DP_COLORIMETRY_RGB = 0, + NV_DP_COLORIMETRY_YCbCr_ITU601, + NV_DP_COLORIMETRY_YCbCr_ITU709, +} NV_DP_COLORIMETRY; + + +//! \ingroup dispcontrol +//! Used in NV_DISPLAY_PORT_INFO. +typedef enum _NV_DP_DYNAMIC_RANGE +{ + NV_DP_DYNAMIC_RANGE_VESA = 0, + NV_DP_DYNAMIC_RANGE_CEA, +} NV_DP_DYNAMIC_RANGE; + + +//! \ingroup dispcontrol +//! Used in NV_DISPLAY_PORT_INFO. +typedef enum _NV_DP_BPC +{ + NV_DP_BPC_DEFAULT = 0, + NV_DP_BPC_6, + NV_DP_BPC_8, + NV_DP_BPC_10, + NV_DP_BPC_12, + NV_DP_BPC_16, +} NV_DP_BPC; + +#endif //#ifndef DISPLAYPORT_STRUCTS_DEFINED + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// All display port related data types definitions end +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetEDID +// +//! \fn NvAPI_GPU_GetEDID(NvPhysicalGpuHandle hPhysicalGpu, NvU32 displayOutputId, NV_EDID *pEDID) +//! This function returns the EDID data for the specified GPU handle and connection bit mask. +//! displayOutputId should have exactly 1 bit set to indicate a single display. See \ref handles. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 85 +//! +//! \retval NVAPI_INVALID_ARGUMENT pEDID is NULL; displayOutputId has 0 or > 1 bits set +//! \retval NVAPI_OK *pEDID contains valid data. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \retval NVAPI_DATA_NOT_FOUND The requested display does not contain an EDID. +// +/////////////////////////////////////////////////////////////////////////////// + + +//! \ingroup gpu +//! @{ + +#define NV_EDID_V1_DATA_SIZE 256 + +#define NV_EDID_DATA_SIZE NV_EDID_V1_DATA_SIZE + +typedef struct +{ + NvU32 version; //structure version + NvU8 EDID_Data[NV_EDID_DATA_SIZE]; +} NV_EDID_V1; + +//! Used in NvAPI_GPU_GetEDID() +typedef struct +{ + NvU32 version; //!< Structure version + NvU8 EDID_Data[NV_EDID_DATA_SIZE]; + NvU32 sizeofEDID; +} NV_EDID_V2; + +//! Used in NvAPI_GPU_GetEDID() +typedef struct +{ + NvU32 version; //!< Structure version + NvU8 EDID_Data[NV_EDID_DATA_SIZE]; + NvU32 sizeofEDID; + NvU32 edidId; //!< ID which always returned in a monotonically increasing counter. + //!< Across a split-EDID read we need to verify that all calls returned the same edidId. + //!< This counter is incremented if we get the updated EDID. + NvU32 offset; //!< Which 256-byte page of the EDID we want to read. Start at 0. + //!< If the read succeeds with edidSize > NV_EDID_DATA_SIZE, + //!< call back again with offset+256 until we have read the entire buffer +} NV_EDID_V3; + +typedef NV_EDID_V3 NV_EDID; + +#define NV_EDID_VER1 MAKE_NVAPI_VERSION(NV_EDID_V1,1) +#define NV_EDID_VER2 MAKE_NVAPI_VERSION(NV_EDID_V2,2) +#define NV_EDID_VER3 MAKE_NVAPI_VERSION(NV_EDID_V3,3) +#define NV_EDID_VER NV_EDID_VER3 + +//! @} + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_GetEDID(NvPhysicalGpuHandle hPhysicalGpu, NvU32 displayOutputId, NV_EDID *pEDID); + +//! \ingroup gpu +//! Used in NV_GPU_CONNECTOR_DATA +typedef enum _NV_GPU_CONNECTOR_TYPE +{ + NVAPI_GPU_CONNECTOR_VGA_15_PIN = 0x00000000, + NVAPI_GPU_CONNECTOR_TV_COMPOSITE = 0x00000010, + NVAPI_GPU_CONNECTOR_TV_SVIDEO = 0x00000011, + NVAPI_GPU_CONNECTOR_TV_HDTV_COMPONENT = 0x00000013, + NVAPI_GPU_CONNECTOR_TV_SCART = 0x00000014, + NVAPI_GPU_CONNECTOR_TV_COMPOSITE_SCART_ON_EIAJ4120 = 0x00000016, + NVAPI_GPU_CONNECTOR_TV_HDTV_EIAJ4120 = 0x00000017, + NVAPI_GPU_CONNECTOR_PC_POD_HDTV_YPRPB = 0x00000018, + NVAPI_GPU_CONNECTOR_PC_POD_SVIDEO = 0x00000019, + NVAPI_GPU_CONNECTOR_PC_POD_COMPOSITE = 0x0000001A, + NVAPI_GPU_CONNECTOR_DVI_I_TV_SVIDEO = 0x00000020, + NVAPI_GPU_CONNECTOR_DVI_I_TV_COMPOSITE = 0x00000021, + NVAPI_GPU_CONNECTOR_DVI_I = 0x00000030, + NVAPI_GPU_CONNECTOR_DVI_D = 0x00000031, + NVAPI_GPU_CONNECTOR_ADC = 0x00000032, + NVAPI_GPU_CONNECTOR_LFH_DVI_I_1 = 0x00000038, + NVAPI_GPU_CONNECTOR_LFH_DVI_I_2 = 0x00000039, + NVAPI_GPU_CONNECTOR_SPWG = 0x00000040, + NVAPI_GPU_CONNECTOR_OEM = 0x00000041, + NVAPI_GPU_CONNECTOR_DISPLAYPORT_EXTERNAL = 0x00000046, + NVAPI_GPU_CONNECTOR_DISPLAYPORT_INTERNAL = 0x00000047, + NVAPI_GPU_CONNECTOR_DISPLAYPORT_MINI_EXT = 0x00000048, + NVAPI_GPU_CONNECTOR_HDMI_A = 0x00000061, + NVAPI_GPU_CONNECTOR_HDMI_C_MINI = 0x00000063, + NVAPI_GPU_CONNECTOR_LFH_DISPLAYPORT_1 = 0x00000064, + NVAPI_GPU_CONNECTOR_LFH_DISPLAYPORT_2 = 0x00000065, + NVAPI_GPU_CONNECTOR_VIRTUAL_WFD = 0x00000070, + NVAPI_GPU_CONNECTOR_UNKNOWN = 0xFFFFFFFF, +} NV_GPU_CONNECTOR_TYPE; + +//////////////////////////////////////////////////////////////////////////////// +// +// NvAPI_TVOutput Information +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup tvapi +//! Used in NV_DISPLAY_TV_OUTPUT_INFO +typedef enum _NV_DISPLAY_TV_FORMAT +{ + NV_DISPLAY_TV_FORMAT_NONE = 0, + NV_DISPLAY_TV_FORMAT_SD_NTSCM = 0x00000001, + NV_DISPLAY_TV_FORMAT_SD_NTSCJ = 0x00000002, + NV_DISPLAY_TV_FORMAT_SD_PALM = 0x00000004, + NV_DISPLAY_TV_FORMAT_SD_PALBDGH = 0x00000008, + NV_DISPLAY_TV_FORMAT_SD_PALN = 0x00000010, + NV_DISPLAY_TV_FORMAT_SD_PALNC = 0x00000020, + NV_DISPLAY_TV_FORMAT_SD_576i = 0x00000100, + NV_DISPLAY_TV_FORMAT_SD_480i = 0x00000200, + NV_DISPLAY_TV_FORMAT_ED_480p = 0x00000400, + NV_DISPLAY_TV_FORMAT_ED_576p = 0x00000800, + NV_DISPLAY_TV_FORMAT_HD_720p = 0x00001000, + NV_DISPLAY_TV_FORMAT_HD_1080i = 0x00002000, + NV_DISPLAY_TV_FORMAT_HD_1080p = 0x00004000, + NV_DISPLAY_TV_FORMAT_HD_720p50 = 0x00008000, + NV_DISPLAY_TV_FORMAT_HD_1080p24 = 0x00010000, + NV_DISPLAY_TV_FORMAT_HD_1080i50 = 0x00020000, + NV_DISPLAY_TV_FORMAT_HD_1080p50 = 0x00040000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp30 = 0x00080000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp30_3840 = NV_DISPLAY_TV_FORMAT_UHD_4Kp30, + NV_DISPLAY_TV_FORMAT_UHD_4Kp25 = 0x00100000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp25_3840 = NV_DISPLAY_TV_FORMAT_UHD_4Kp25, + NV_DISPLAY_TV_FORMAT_UHD_4Kp24 = 0x00200000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp24_3840 = NV_DISPLAY_TV_FORMAT_UHD_4Kp24, + NV_DISPLAY_TV_FORMAT_UHD_4Kp24_SMPTE = 0x00400000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp50_3840 = 0x00800000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp60_3840 = 0x00900000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp30_4096 = 0x00A00000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp25_4096 = 0x00B00000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp24_4096 = 0x00C00000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp50_4096 = 0x00D00000, + NV_DISPLAY_TV_FORMAT_UHD_4Kp60_4096 = 0x00E00000, + + NV_DISPLAY_TV_FORMAT_SD_OTHER = 0x01000000, + NV_DISPLAY_TV_FORMAT_ED_OTHER = 0x02000000, + NV_DISPLAY_TV_FORMAT_HD_OTHER = 0x04000000, + + NV_DISPLAY_TV_FORMAT_ANY = 0x80000000, + +} NV_DISPLAY_TV_FORMAT; + + +//! \ingroup dispcontrol +//! @{ +#define NVAPI_MAX_VIEW_TARGET 2 +#define NVAPI_ADVANCED_MAX_VIEW_TARGET 4 + +#ifndef _NV_TARGET_VIEW_MODE_ +#define _NV_TARGET_VIEW_MODE_ + +//! Used in NvAPI_SetView(). +typedef enum _NV_TARGET_VIEW_MODE +{ + NV_VIEW_MODE_STANDARD = 0, + NV_VIEW_MODE_CLONE = 1, + NV_VIEW_MODE_HSPAN = 2, + NV_VIEW_MODE_VSPAN = 3, + NV_VIEW_MODE_DUALVIEW = 4, + NV_VIEW_MODE_MULTIVIEW = 5, +} NV_TARGET_VIEW_MODE; +#endif + +//! @} + + +// Following definitions are used in NvAPI_SetViewEx. + +//! Scaling modes - used in NvAPI_SetViewEx(). +//! \ingroup dispcontrol +typedef enum _NV_SCALING +{ + NV_SCALING_DEFAULT = 0, //!< No change + + // New Scaling Declarations + NV_SCALING_GPU_SCALING_TO_CLOSEST = 1, //!< Balanced - Full Screen + NV_SCALING_GPU_SCALING_TO_NATIVE = 2, //!< Force GPU - Full Screen + NV_SCALING_GPU_SCANOUT_TO_NATIVE = 3, //!< Force GPU - Centered\No Scaling + NV_SCALING_GPU_SCALING_TO_ASPECT_SCANOUT_TO_NATIVE = 5, //!< Force GPU - Aspect Ratio + NV_SCALING_GPU_SCALING_TO_ASPECT_SCANOUT_TO_CLOSEST = 6, //!< Balanced - Aspect Ratio + NV_SCALING_GPU_SCANOUT_TO_CLOSEST = 7, //!< Balanced - Centered\No Scaling + + // Legacy Declarations + NV_SCALING_MONITOR_SCALING = NV_SCALING_GPU_SCALING_TO_CLOSEST, + NV_SCALING_ADAPTER_SCALING = NV_SCALING_GPU_SCALING_TO_NATIVE, + NV_SCALING_CENTERED = NV_SCALING_GPU_SCANOUT_TO_NATIVE, + NV_SCALING_ASPECT_SCALING = NV_SCALING_GPU_SCALING_TO_ASPECT_SCANOUT_TO_NATIVE, + + NV_SCALING_CUSTOMIZED = 255 //!< For future use +} NV_SCALING; + +//! Rotate modes- used in NvAPI_SetViewEx(). +//! \ingroup dispcontrol +typedef enum _NV_ROTATE +{ + NV_ROTATE_0 = 0, + NV_ROTATE_90 = 1, + NV_ROTATE_180 = 2, + NV_ROTATE_270 = 3, + NV_ROTATE_IGNORED = 4, +} NV_ROTATE; + +//! Color formats- used in NvAPI_SetViewEx(). +//! \ingroup dispcontrol +#define NVFORMAT_MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((NvU32)(NvU8)(ch0) | ((NvU32)(NvU8)(ch1) << 8) | \ + ((NvU32)(NvU8)(ch2) << 16) | ((NvU32)(NvU8)(ch3) << 24 )) + + + +//! Color formats- used in NvAPI_SetViewEx(). +//! \ingroup dispcontrol +typedef enum _NV_FORMAT +{ + NV_FORMAT_UNKNOWN = 0, //!< unknown. Driver will choose one as following value. + NV_FORMAT_P8 = 41, //!< for 8bpp mode + NV_FORMAT_R5G6B5 = 23, //!< for 16bpp mode + NV_FORMAT_A8R8G8B8 = 21, //!< for 32bpp mode + NV_FORMAT_A16B16G16R16F = 113, //!< for 64bpp(floating point) mode. + +} NV_FORMAT; + +// TV standard + +typedef struct +{ + float x; //!< x-coordinate of the viewport top-left point + float y; //!< y-coordinate of the viewport top-left point + float w; //!< Width of the viewport + float h; //!< Height of the viewport +} NV_VIEWPORTF; + + + +//! \ingroup dispcontrol +//! The timing override is not supported yet; must be set to _AUTO. \n + + +typedef enum _NV_TIMING_OVERRIDE +{ + NV_TIMING_OVERRIDE_CURRENT = 0, //!< get the current timing + NV_TIMING_OVERRIDE_AUTO, //!< the timing the driver will use based the current policy + NV_TIMING_OVERRIDE_EDID, //!< EDID timing + NV_TIMING_OVERRIDE_DMT, //!< VESA DMT timing + NV_TIMING_OVERRIDE_DMT_RB, //!< VESA DMT timing with reduced blanking + NV_TIMING_OVERRIDE_CVT, //!< VESA CVT timing + NV_TIMING_OVERRIDE_CVT_RB, //!< VESA CVT timing with reduced blanking + NV_TIMING_OVERRIDE_GTF, //!< VESA GTF timing + NV_TIMING_OVERRIDE_EIA861, //!< EIA 861x pre-defined timing + NV_TIMING_OVERRIDE_ANALOG_TV, //!< analog SD/HDTV timing + NV_TIMING_OVERRIDE_CUST, //!< NV custom timings + NV_TIMING_OVERRIDE_NV_PREDEFINED, //!< NV pre-defined timing (basically the PsF timings) + NV_TIMING_OVERRIDE_NV_PSF = NV_TIMING_OVERRIDE_NV_PREDEFINED, + NV_TIMING_OVERRIDE_NV_ASPR, + NV_TIMING_OVERRIDE_SDI, //!< Override for SDI timing + + NV_TIMING_OVRRIDE_MAX, +}NV_TIMING_OVERRIDE; + + +#ifndef NV_TIMING_STRUCTS_DEFINED +#define NV_TIMING_STRUCTS_DEFINED + +//*********************** +// The Timing Structure +//*********************** +// +//! \ingroup dispcontrol +//! NVIDIA-specific timing extras \n +//! Used in NV_TIMING. +typedef struct tagNV_TIMINGEXT +{ + NvU32 flag; //!< Reserved for NVIDIA hardware-based enhancement, such as double-scan. + NvU16 rr; //!< Logical refresh rate to present + NvU32 rrx1k; //!< Physical vertical refresh rate in 0.001Hz + NvU32 aspect; //!< Display aspect ratio Hi(aspect):horizontal-aspect, Low(aspect):vertical-aspect + NvU16 rep; //!< Bit-wise pixel repetition factor: 0x1:no pixel repetition; 0x2:each pixel repeats twice horizontally,.. + NvU32 status; //!< Timing standard + NvU8 name[40]; //!< Timing name +}NV_TIMINGEXT; + + + +//! \ingroup dispcontrol +//!The very basic timing structure based on the VESA standard: +//! \code +//! |<----------------------------htotal--------------------------->| +//! ---------"active" video-------->|<-------blanking------>|<----- +//! |<-------hvisible-------->|<-hb->|<-hfp->|<-hsw->|<-hbp->|<-hb->| +//! --------- -+-------------------------+ | | | | | +//! A A | | | | | | | +//! : : | | | | | | | +//! : : | | | | | | | +//! :vertical| addressable video | | | | | | +//! : visible| | | | | | | +//! : : | | | | | | | +//! : : | | | | | | | +//! vertical V | | | | | | | +//! total --+-------------------------+ | | | | | +//! : vb border | | | | | +//! : -----------------------------------+ | | | | +//! : vfp front porch | | | | +//! : -------------------------------------------+ | | | +//! : vsw sync width | | | +//! : ---------------------------------------------------+ | | +//! : vbp back porch | | +//! : -----------------------------------------------------------+ | +//! V vb border | +//! ---------------------------------------------------------------------------+ +//! \endcode +typedef struct _NV_TIMING +{ + // VESA scan out timing parameters: + NvU16 HVisible; //!< horizontal visible + NvU16 HBorder; //!< horizontal border + NvU16 HFrontPorch; //!< horizontal front porch + NvU16 HSyncWidth; //!< horizontal sync width + NvU16 HTotal; //!< horizontal total + NvU8 HSyncPol; //!< horizontal sync polarity: 1-negative, 0-positive + + NvU16 VVisible; //!< vertical visible + NvU16 VBorder; //!< vertical border + NvU16 VFrontPorch; //!< vertical front porch + NvU16 VSyncWidth; //!< vertical sync width + NvU16 VTotal; //!< vertical total + NvU8 VSyncPol; //!< vertical sync polarity: 1-negative, 0-positive + + NvU16 interlaced; //!< 1-interlaced, 0-progressive + NvU32 pclk; //!< pixel clock in 10 kHz + + //other timing related extras + NV_TIMINGEXT etc; +}NV_TIMING; +#endif //NV_TIMING_STRUCTS_DEFINED + + +//! \addtogroup dispcontrol +//! Timing-related constants +//! @{ +#define NV_TIMING_H_SYNC_POSITIVE 0 +#define NV_TIMING_H_SYNC_NEGATIVE 1 +#define NV_TIMING_H_SYNC_DEFAULT NV_TIMING_H_SYNC_NEGATIVE +// +#define NV_TIMING_V_SYNC_POSITIVE 0 +#define NV_TIMING_V_SYNC_NEGATIVE 1 +#define NV_TIMING_V_SYNC_DEFAULT NV_TIMING_V_SYNC_POSITIVE +// +#define NV_TIMING_PROGRESSIVE 0 +#define NV_TIMING_INTERLACED 1 +#define NV_TIMING_INTERLACED_EXTRA_VBLANK_ON_FIELD2 1 +#define NV_TIMING_INTERLACED_NO_EXTRA_VBLANK_ON_FIELD2 2 +//! @} + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_SetView +// +//! \fn NvAPI_SetView(NvDisplayHandle hNvDisplay, NV_VIEW_TARGET_INFO *pTargetInfo, NV_TARGET_VIEW_MODE targetView) +//! This function lets the caller modify the target display arrangement of the selected source display handle in any nView mode. +//! It can also modify or extend the source display in Dualview mode. +//! \note Maps the selected source to the associated target Ids. +//! \note Display PATH with this API is limited to single GPU. DUALVIEW across GPUs cannot be enabled with this API. +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_DISP_SetDisplayConfig. +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 90 +//! +//! \param [in] hNvDisplay NVIDIA Display selection. #NVAPI_DEFAULT_HANDLE is not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle(). +//! \param [in] pTargetInfo Pointer to array of NV_VIEW_TARGET_INFO, specifying device properties in this view. +//! The first device entry in the array is the physical primary. +//! The device entry with the lowest source id is the desktop primary. +//! \param [in] targetCount Count of target devices specified in pTargetInfo. +//! \param [in] targetView Target view selected from NV_TARGET_VIEW_MODE. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred +//! \retval NVAPI_INVALID_ARGUMENT Invalid input parameter. +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup dispcontrol +//! Used in NvAPI_SetView() and NvAPI_GetView() +typedef struct +{ + NvU32 version; //!< (IN) structure version + NvU32 count; //!< (IN) target count + struct + { + NvU32 deviceMask; //!< (IN/OUT) Device mask + NvU32 sourceId; //!< (IN/OUT) Source ID - values will be based on the number of heads exposed per GPU. + NvU32 bPrimary:1; //!< (OUT) Indicates if this is the GPU's primary view target. This is not the desktop GDI primary. + //!< NvAPI_SetView automatically selects the first target in NV_VIEW_TARGET_INFO index 0 as the GPU's primary view. + NvU32 bInterlaced:1; //!< (IN/OUT) Indicates if the timing being used on this monitor is interlaced. + NvU32 bGDIPrimary:1; //!< (IN/OUT) Indicates if this is the desktop GDI primary. + NvU32 bForceModeSet:1;//!< (IN) Used only on Win7 and higher during a call to NvAPI_SetView(). Turns off optimization & forces OS to set supplied mode. + } target[NVAPI_MAX_VIEW_TARGET]; +} NV_VIEW_TARGET_INFO; + +//! \ingroup dispcontrol +#define NV_VIEW_TARGET_INFO_VER MAKE_NVAPI_VERSION(NV_VIEW_TARGET_INFO,2) + + +//! \ingroup dispcontrol +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_DISP_SetDisplayConfig.") +NVAPI_INTERFACE NvAPI_SetView(NvDisplayHandle hNvDisplay, NV_VIEW_TARGET_INFO *pTargetInfo, NV_TARGET_VIEW_MODE targetView); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_SetViewEx +// +//! \fn NvAPI_SetViewEx(NvDisplayHandle hNvDisplay, NV_DISPLAY_PATH_INFO *pPathInfo, NV_TARGET_VIEW_MODE displayView) +//! This function lets caller to modify the display arrangement for selected source display handle in any of the nview modes. +//! It also allows to modify or extend the source display in dualview mode. +//! \note Maps the selected source to the associated target Ids. +//! \note Display PATH with this API is limited to single GPU. DUALVIEW across GPUs cannot be enabled with this API. +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_DISP_SetDisplayConfig. +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 95 +//! +//! \param [in] hNvDisplay NVIDIA Display selection. #NVAPI_DEFAULT_HANDLE is not allowed, it has to be a handle enumerated with +//! NvAPI_EnumNVidiaDisplayHandle(). +//! \param [in] pPathInfo Pointer to array of NV_VIEW_PATH_INFO, specifying device properties in this view. +//! The first device entry in the array is the physical primary. +//! The device entry with the lowest source id is the desktop primary. +//! \param [in] pathCount Count of paths specified in pPathInfo. +//! \param [in] displayView Display view selected from NV_TARGET_VIEW_MODE. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred +//! \retval NVAPI_INVALID_ARGUMENT Invalid input parameter. +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup dispcontrol +#define NVAPI_MAX_DISPLAY_PATH NVAPI_MAX_VIEW_TARGET + +//! \ingroup dispcontrol +#define NVAPI_ADVANCED_MAX_DISPLAY_PATH NVAPI_ADVANCED_MAX_VIEW_TARGET + + + +//! \ingroup dispcontrol +//! Used in NV_DISPLAY_PATH_INFO. +typedef struct +{ + NvU32 deviceMask; //!< (IN) Device mask + NvU32 sourceId; //!< (IN) Values will be based on the number of heads exposed per GPU(0, 1?) + NvU32 bPrimary:1; //!< (IN/OUT) Indicates if this is the GPU's primary view target. This is not the desktop GDI primary. + //!< NvAPI_SetViewEx() automatically selects the first target in NV_DISPLAY_PATH_INFO index 0 as the GPU's primary view. + NV_GPU_CONNECTOR_TYPE connector; //!< (IN) Specify connector type. For TV only. + + // source mode information + NvU32 width; //!< (IN) Width of the mode + NvU32 height; //!< (IN) Height of the mode + NvU32 depth; //!< (IN) Depth of the mode + NV_FORMAT colorFormat; //!< Color format if it needs to be specified. Not used now. + + //rotation setting of the mode + NV_ROTATE rotation; //!< (IN) Rotation setting. + + // the scaling mode + NV_SCALING scaling; //!< (IN) Scaling setting + + // Timing info + NvU32 refreshRate; //!< (IN) Refresh rate of the mode + NvU32 interlaced:1; //!< (IN) Interlaced mode flag + + NV_DISPLAY_TV_FORMAT tvFormat; //!< (IN) To choose the last TV format set this value to NV_DISPLAY_TV_FORMAT_NONE + + // Windows desktop position + NvU32 posx; //!< (IN/OUT) X-offset of this display on the Windows desktop + NvU32 posy; //!< (IN/OUT) Y-offset of this display on the Windows desktop + NvU32 bGDIPrimary:1; //!< (IN/OUT) Indicates if this is the desktop GDI primary. + + NvU32 bForceModeSet:1;//!< (IN) Used only on Win7 and higher during a call to NvAPI_SetViewEx(). Turns off optimization & forces OS to set supplied mode. + NvU32 bFocusDisplay:1;//!< (IN) If set, this display path should have the focus after the GPU topology change + NvU32 gpuId:24; //!< (IN) the physical display/target Gpu id which is the owner of the scan out (for SLI multimon, display from the slave Gpu) + +} NV_DISPLAY_PATH; + +//! \ingroup dispcontrol +//! Used in NvAPI_SetViewEx() and NvAPI_GetViewEx(). +typedef struct +{ + NvU32 version; //!< (IN) Structure version + NvU32 count; //!< (IN) Path count + NV_DISPLAY_PATH path[NVAPI_MAX_DISPLAY_PATH]; +} NV_DISPLAY_PATH_INFO_V3; + +//! \ingroup dispcontrol +//! Used in NvAPI_SetViewEx() and NvAPI_GetViewEx(). +typedef struct +{ + NvU32 version; //!< (IN) Structure version + NvU32 count; //!< (IN) Path count + NV_DISPLAY_PATH path[NVAPI_ADVANCED_MAX_DISPLAY_PATH]; +} NV_DISPLAY_PATH_INFO; + +//! \addtogroup dispcontrol +//! Macro for constructing the version fields of NV_DISPLAY_PATH_INFO +//! @{ +#define NV_DISPLAY_PATH_INFO_VER NV_DISPLAY_PATH_INFO_VER4 +#define NV_DISPLAY_PATH_INFO_VER4 MAKE_NVAPI_VERSION(NV_DISPLAY_PATH_INFO,4) +#define NV_DISPLAY_PATH_INFO_VER3 MAKE_NVAPI_VERSION(NV_DISPLAY_PATH_INFO,3) +#define NV_DISPLAY_PATH_INFO_VER2 MAKE_NVAPI_VERSION(NV_DISPLAY_PATH_INFO,2) +#define NV_DISPLAY_PATH_INFO_VER1 MAKE_NVAPI_VERSION(NV_DISPLAY_PATH_INFO,1) +//! @} + + +//! \ingroup dispcontrol +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_DISP_SetDisplayConfig.") +NVAPI_INTERFACE NvAPI_SetViewEx(NvDisplayHandle hNvDisplay, NV_DISPLAY_PATH_INFO *pPathInfo, NV_TARGET_VIEW_MODE displayView); + + + +/////////////////////////////////////////////////////////////////////////////// +// SetDisplayConfig/GetDisplayConfig +/////////////////////////////////////////////////////////////////////////////// +//! \ingroup dispcontrol + +typedef struct _NV_POSITION +{ + NvS32 x; + NvS32 y; +} NV_POSITION; + +//! \ingroup dispcontrol +typedef struct _NV_RESOLUTION +{ + NvU32 width; + NvU32 height; + NvU32 colorDepth; +} NV_RESOLUTION; + +//! \ingroup dispcontrol +typedef struct _NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO_V1 +{ + NvU32 version; + + // Rotation and Scaling + NV_ROTATE rotation; //!< (IN) rotation setting. + NV_SCALING scaling; //!< (IN) scaling setting. + + // Refresh Rate + NvU32 refreshRate1K; //!< (IN) Non-interlaced Refresh Rate of the mode, multiplied by 1000, 0 = ignored + //!< This is the value which driver reports to the OS. + // Flags + NvU32 interlaced:1; //!< (IN) Interlaced mode flag, ignored if refreshRate == 0 + NvU32 primary:1; //!< (IN) Declares primary display in clone configuration. This is *NOT* GDI Primary. + //!< Only one target can be primary per source. If no primary is specified, the first + //!< target will automatically be primary. +#ifdef NV_PAN_AND_SCAN_DEFINED + NvU32 isPanAndScanTarget:1; //!< Whether on this target Pan and Scan is enabled or has to be enabled. Valid only + //!< when the target is part of clone topology. +#else + NvU32 reservedBit1:1; +#endif + NvU32 disableVirtualModeSupport:1; + NvU32 isPreferredUnscaledTarget:1; + NvU32 reserved:27; + // TV format information + NV_GPU_CONNECTOR_TYPE connector; //!< Specify connector type. For TV only, ignored if tvFormat == NV_DISPLAY_TV_FORMAT_NONE + NV_DISPLAY_TV_FORMAT tvFormat; //!< (IN) to choose the last TV format set this value to NV_DISPLAY_TV_FORMAT_NONE + //!< In case of NvAPI_DISP_GetDisplayConfig(), this field will indicate the currently applied TV format; + //!< if no TV format is applied, this field will have NV_DISPLAY_TV_FORMAT_NONE value. + //!< In case of NvAPI_DISP_SetDisplayConfig(), this field should only be set in case of TVs; + //!< for other displays this field will be ignored and resolution & refresh rate specified in input will be used to apply the TV format. + + // Backend (raster) timing standard + NV_TIMING_OVERRIDE timingOverride; //!< Ignored if timingOverride == NV_TIMING_OVERRIDE_CURRENT + NV_TIMING timing; //!< Scan out timing, valid only if timingOverride == NV_TIMING_OVERRIDE_CUST + //!< The value NV_TIMING::NV_TIMINGEXT::rrx1k is obtained from the EDID. The driver may + //!< tweak this value for HDTV, stereo, etc., before reporting it to the OS. +} NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO_V1; + +//! \ingroup dispcontrol +typedef NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO_V1 NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO; + +//! \ingroup dispcontrol +#define NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO_VER1 MAKE_NVAPI_VERSION(NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO_V1,1) + +//! \ingroup dispcontrol +#define NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO_VER NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO_VER1 + +//! \ingroup dispcontrol +typedef struct _NV_DISPLAYCONFIG_PATH_TARGET_INFO_V1 +{ + NvU32 displayId; //!< Display ID + NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO* details; //!< May be NULL if no advanced settings are required. NULL for Non-NVIDIA Display. +} NV_DISPLAYCONFIG_PATH_TARGET_INFO_V1; + +//! \ingroup dispcontrol +typedef struct _NV_DISPLAYCONFIG_PATH_TARGET_INFO_V2 +{ + NvU32 displayId; //!< Display ID + NV_DISPLAYCONFIG_PATH_ADVANCED_TARGET_INFO* details; //!< May be NULL if no advanced settings are required + NvU32 targetId; //!< Windows CCD target ID. Must be present only for non-NVIDIA adapter, for NVIDIA adapter this parameter is ignored. +} NV_DISPLAYCONFIG_PATH_TARGET_INFO_V2; + + +//! \ingroup dispcontrol +//! As version is not defined for this structure, we will be using version of NV_DISPLAYCONFIG_PATH_INFO +typedef NV_DISPLAYCONFIG_PATH_TARGET_INFO_V2 NV_DISPLAYCONFIG_PATH_TARGET_INFO; + + +//! \ingroup dispcontrol +typedef enum _NV_DISPLAYCONFIG_SPANNING_ORIENTATION +{ + NV_DISPLAYCONFIG_SPAN_NONE = 0, + NV_DISPLAYCONFIG_SPAN_HORIZONTAL = 1, + NV_DISPLAYCONFIG_SPAN_VERTICAL = 2, +} NV_DISPLAYCONFIG_SPANNING_ORIENTATION; + +//! \ingroup dispcontrol +typedef struct _NV_DISPLAYCONFIG_SOURCE_MODE_INFO_V1 +{ + NV_RESOLUTION resolution; + NV_FORMAT colorFormat; //!< Ignored at present, must be NV_FORMAT_UNKNOWN (0) + NV_POSITION position; //!< Is all positions are 0 or invalid, displays will be automatically + //!< positioned from left to right with GDI Primary at 0,0, and all + //!< other displays in the order of the path array. + NV_DISPLAYCONFIG_SPANNING_ORIENTATION spanningOrientation; //!< Spanning is only supported on XP + NvU32 bGDIPrimary : 1; + NvU32 bSLIFocus : 1; + NvU32 reserved : 30; //!< Must be 0 +} NV_DISPLAYCONFIG_SOURCE_MODE_INFO_V1; + + + +//! \ingroup dispcontrol +typedef struct _NV_DISPLAYCONFIG_PATH_INFO_V1 +{ + NvU32 version; + NvU32 reserved_sourceId; //!< This field is reserved. There is ongoing debate if we need this field. + //!< Identifies sourceIds used by Windows. If all sourceIds are 0, + //!< these will be computed automatically. + NvU32 targetInfoCount; //!< Number of elements in targetInfo array + NV_DISPLAYCONFIG_PATH_TARGET_INFO_V1* targetInfo; + NV_DISPLAYCONFIG_SOURCE_MODE_INFO_V1* sourceModeInfo; //!< May be NULL if mode info is not important +} NV_DISPLAYCONFIG_PATH_INFO_V1; + +//! \ingroup dispcontrol +//! This define is temporary and must be removed once DVS failure is fixed. +#define _NV_DISPLAYCONFIG_PATH_INFO_V2 _NV_DISPLAYCONFIG_PATH_INFO + +//! \ingroup dispcontrol +typedef struct _NV_DISPLAYCONFIG_PATH_INFO_V2 +{ + NvU32 version; + union { + NvU32 sourceId; //!< Identifies sourceId used by Windows CCD. This can be optionally set. + NvU32 reserved_sourceId; //!< Only for compatibility + }; + + NvU32 targetInfoCount; //!< Number of elements in targetInfo array + NV_DISPLAYCONFIG_PATH_TARGET_INFO_V2* targetInfo; + NV_DISPLAYCONFIG_SOURCE_MODE_INFO_V1* sourceModeInfo; //!< May be NULL if mode info is not important + NvU32 IsNonNVIDIAAdapter : 1; //!< True for non-NVIDIA adapter. + NvU32 reserved : 31; //!< Must be 0 + void *pOSAdapterID; //!< Used by Non-NVIDIA adapter for pointer to OS Adapter of LUID + //!< type, type casted to void *. +} NV_DISPLAYCONFIG_PATH_INFO_V2; + +//! \ingroup dispcontrol +#define NV_DISPLAYCONFIG_PATH_INFO_VER1 MAKE_NVAPI_VERSION(NV_DISPLAYCONFIG_PATH_INFO_V1,1) + +//! \ingroup dispcontrol +#define NV_DISPLAYCONFIG_PATH_INFO_VER2 MAKE_NVAPI_VERSION(NV_DISPLAYCONFIG_PATH_INFO_V2,2) + +#ifndef NV_DISPLAYCONFIG_PATH_INFO_VER + +typedef NV_DISPLAYCONFIG_PATH_INFO_V2 NV_DISPLAYCONFIG_PATH_INFO; + +#define NV_DISPLAYCONFIG_PATH_INFO_VER NV_DISPLAYCONFIG_PATH_INFO_VER2 + +typedef NV_DISPLAYCONFIG_SOURCE_MODE_INFO_V1 NV_DISPLAYCONFIG_SOURCE_MODE_INFO; + +#endif + + +//! \ingroup dispcontrol +typedef enum _NV_DISPLAYCONFIG_FLAGS +{ + NV_DISPLAYCONFIG_VALIDATE_ONLY = 0x00000001, + NV_DISPLAYCONFIG_SAVE_TO_PERSISTENCE = 0x00000002, + NV_DISPLAYCONFIG_DRIVER_RELOAD_ALLOWED = 0x00000004, //!< Driver reload is permitted if necessary + NV_DISPLAYCONFIG_FORCE_MODE_ENUMERATION = 0x00000008, //!< Refresh OS mode list. +} NV_DISPLAYCONFIG_FLAGS; + + +#define NVAPI_UNICODE_STRING_MAX 2048 +#define NVAPI_BINARY_DATA_MAX 4096 + +typedef NvU16 NvAPI_UnicodeString[NVAPI_UNICODE_STRING_MAX]; +typedef const NvU16 *NvAPI_LPCWSTR; +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetDisplayDriverVersion +//! \fn NvAPI_GetDisplayDriverVersion(NvDisplayHandle hNvDisplay, NV_DISPLAY_DRIVER_VERSION *pVersion) +//! This function returns a struct that describes aspects of the display driver +//! build. +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_SYS_GetDriverAndBranchVersion. +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 80 +//! +//! \param [in] hNvDisplay NVIDIA display handle. +//! \param [out] pVersion Pointer to NV_DISPLAY_DRIVER_VERSION struc +//! +//! \retval NVAPI_ERROR +//! \retval NVAPI_OK +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup driverapi +//! Used in NvAPI_GetDisplayDriverVersion() +typedef struct +{ + NvU32 version; // Structure version + NvU32 drvVersion; + NvU32 bldChangeListNum; + NvAPI_ShortString szBuildBranchString; + NvAPI_ShortString szAdapterString; +} NV_DISPLAY_DRIVER_VERSION; + +//! \ingroup driverapi +#define NV_DISPLAY_DRIVER_VERSION_VER MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_VERSION,1) + + +//! \ingroup driverapi +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_SYS_GetDriverAndBranchVersion.") +NVAPI_INTERFACE NvAPI_GetDisplayDriverVersion(NvDisplayHandle hNvDisplay, NV_DISPLAY_DRIVER_VERSION *pVersion); + + + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_OGL_ExpertModeSet[Get] +// +//! \name NvAPI_OGL_ExpertModeSet[Get] Functions +//@{ +//! This function configures OpenGL Expert Mode, an API usage feedback and +//! advice reporting mechanism. The effects of this call are +//! applied only to the current context, and are reset to the +//! defaults when the context is destroyed. +//! +//! \note This feature is valid at runtime only when GLExpert +//! functionality has been built into the OpenGL driver +//! installed on the system. All Windows Vista OpenGL +//! drivers provided by NVIDIA have this instrumentation +//! included by default. Windows XP, however, requires a +//! special display driver available with the NVIDIA +//! PerfSDK found at developer.nvidia.com. +//! +//! \note These functions are valid only for the current OpenGL +//! context. Calling these functions prior to creating a +//! context and calling MakeCurrent with it will result +//! in errors and undefined behavior. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \param expertDetailMask Mask made up of NVAPI_OGLEXPERT_DETAIL bits, +//! this parameter specifies the detail level in +//! the feedback stream. +//! +//! \param expertReportMask Mask made up of NVAPI_OGLEXPERT_REPORT bits, +//! this parameter specifies the areas of +//! functional interest. +//! +//! \param expertOutputMask Mask made up of NVAPI_OGLEXPERT_OUTPUT bits, +//! this parameter specifies the feedback output +//! location. +//! +//! \param expertCallback Used in conjunction with OUTPUT_TO_CALLBACK, +//! this is a simple callback function the user +//! may use to obtain the feedback stream. The +//! function will be called once per fully +//! qualified feedback stream extry. +//! +//! \retval NVAPI_API_NOT_INTIALIZED NVAPI not initialized +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU found +//! \retval NVAPI_OPENGL_CONTEXT_NOT_CURRENT No NVIDIA OpenGL context +//! which supports GLExpert +//! has been made current +//! \retval NVAPI_ERROR OpenGL driver failed to load properly +//! \retval NVAPI_OK Success +// +/////////////////////////////////////////////////////////////////////////////// + +//! \addtogroup oglapi +//! @{ +#define NVAPI_OGLEXPERT_DETAIL_NONE 0x00000000 +#define NVAPI_OGLEXPERT_DETAIL_ERROR 0x00000001 +#define NVAPI_OGLEXPERT_DETAIL_SWFALLBACK 0x00000002 +#define NVAPI_OGLEXPERT_DETAIL_BASIC_INFO 0x00000004 +#define NVAPI_OGLEXPERT_DETAIL_DETAILED_INFO 0x00000008 +#define NVAPI_OGLEXPERT_DETAIL_PERFORMANCE_WARNING 0x00000010 +#define NVAPI_OGLEXPERT_DETAIL_QUALITY_WARNING 0x00000020 +#define NVAPI_OGLEXPERT_DETAIL_USAGE_WARNING 0x00000040 +#define NVAPI_OGLEXPERT_DETAIL_ALL 0xFFFFFFFF + +#define NVAPI_OGLEXPERT_REPORT_NONE 0x00000000 +#define NVAPI_OGLEXPERT_REPORT_ERROR 0x00000001 +#define NVAPI_OGLEXPERT_REPORT_SWFALLBACK 0x00000002 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_VERTEX 0x00000004 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_GEOMETRY 0x00000008 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_XFB 0x00000010 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_RASTER 0x00000020 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_FRAGMENT 0x00000040 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_ROP 0x00000080 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_FRAMEBUFFER 0x00000100 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_PIXEL 0x00000200 +#define NVAPI_OGLEXPERT_REPORT_PIPELINE_TEXTURE 0x00000400 +#define NVAPI_OGLEXPERT_REPORT_OBJECT_BUFFEROBJECT 0x00000800 +#define NVAPI_OGLEXPERT_REPORT_OBJECT_TEXTURE 0x00001000 +#define NVAPI_OGLEXPERT_REPORT_OBJECT_PROGRAM 0x00002000 +#define NVAPI_OGLEXPERT_REPORT_OBJECT_FBO 0x00004000 +#define NVAPI_OGLEXPERT_REPORT_FEATURE_SLI 0x00008000 +#define NVAPI_OGLEXPERT_REPORT_ALL 0xFFFFFFFF + + +#define NVAPI_OGLEXPERT_OUTPUT_TO_NONE 0x00000000 +#define NVAPI_OGLEXPERT_OUTPUT_TO_CONSOLE 0x00000001 +#define NVAPI_OGLEXPERT_OUTPUT_TO_DEBUGGER 0x00000004 +#define NVAPI_OGLEXPERT_OUTPUT_TO_CALLBACK 0x00000008 +#define NVAPI_OGLEXPERT_OUTPUT_TO_ALL 0xFFFFFFFF + +//! @} + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION TYPE: NVAPI_OGLEXPERT_CALLBACK +// +//! DESCRIPTION: Used in conjunction with OUTPUT_TO_CALLBACK, this is a simple +//! callback function the user may use to obtain the feedback +//! stream. The function will be called once per fully qualified +//! feedback stream entry. +//! +//! \param categoryId Contains the bit from the NVAPI_OGLEXPERT_REPORT +//! mask that corresponds to the current message +//! \param messageId Unique ID for the current message +//! \param detailLevel Contains the bit from the NVAPI_OGLEXPERT_DETAIL +//! mask that corresponds to the current message +//! \param objectId Unique ID of the object that corresponds to the +//! current message +//! \param messageStr Text string from the current message +//! +//! \ingroup oglapi +/////////////////////////////////////////////////////////////////////////////// +typedef void (* NVAPI_OGLEXPERT_CALLBACK) (unsigned int categoryId, unsigned int messageId, unsigned int detailLevel, int objectId, const char *messageStr); + + + +//! \ingroup oglapi +//! SUPPORTED OS: Windows XP and higher +//! +NVAPI_INTERFACE NvAPI_OGL_ExpertModeSet(NvU32 expertDetailLevel, + NvU32 expertReportMask, + NvU32 expertOutputMask, + NVAPI_OGLEXPERT_CALLBACK expertCallback); + +//! \addtogroup oglapi +//! SUPPORTED OS: Windows XP and higher +//! +NVAPI_INTERFACE NvAPI_OGL_ExpertModeGet(NvU32 *pExpertDetailLevel, + NvU32 *pExpertReportMask, + NvU32 *pExpertOutputMask, + NVAPI_OGLEXPERT_CALLBACK *pExpertCallback); + +//@} +/////////////////////////////////////////////////////////////////////////////// +// +//! \name NvAPI_OGL_ExpertModeDefaultsSet[Get] Functions +//! +//@{ +//! This function configures OpenGL Expert Mode global defaults. These settings +//! apply to any OpenGL application which starts up after these +//! values are applied (i.e. these settings *do not* apply to +//! currently running applications). +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \param expertDetailLevel Value which specifies the detail level in +//! the feedback stream. This is a mask made up +//! of NVAPI_OGLEXPERT_LEVEL bits. +//! +//! \param expertReportMask Mask made up of NVAPI_OGLEXPERT_REPORT bits, +//! this parameter specifies the areas of +//! functional interest. +//! +//! \param expertOutputMask Mask made up of NVAPI_OGLEXPERT_OUTPUT bits, +//! this parameter specifies the feedback output +//! location. Note that using OUTPUT_TO_CALLBACK +//! here is meaningless and has no effect, but +//! using it will not cause an error. +//! +//! \return ::NVAPI_ERROR or ::NVAPI_OK +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup oglapi +//! SUPPORTED OS: Windows XP and higher +//! +NVAPI_INTERFACE NvAPI_OGL_ExpertModeDefaultsSet(NvU32 expertDetailLevel, + NvU32 expertReportMask, + NvU32 expertOutputMask); + +//! \addtogroup oglapi +//! SUPPORTED OS: Windows XP and higher +//! +NVAPI_INTERFACE NvAPI_OGL_ExpertModeDefaultsGet(NvU32 *pExpertDetailLevel, + NvU32 *pExpertReportMask, + NvU32 *pExpertOutputMask); +//@} + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_EnumTCCPhysicalGPUs +// +//! This function returns an array of physical GPU handles that are in TCC Mode. +//! Each handle represents a physical GPU present in the system in TCC Mode. +//! That GPU may not be visible to the OS directly. +//! +//! The array nvGPUHandle will be filled with physical GPU handle values. The returned +//! gpuCount determines how many entries in the array are valid. +//! +//! NOTE: Handles enumerated by this API are only valid for NvAPIs that are tagged as TCC_SUPPORTED +//! If handle is passed to any other API, it will fail with NVAPI_INVALID_HANDLE +//! +//! For WDDM GPU handles please use NvAPI_EnumPhysicalGPUs() +//! +//! SUPPORTED OS: Windows Vista and higher, Mac OS X +//! +//! +//! +//! \param [out] nvGPUHandle Physical GPU array that will contain all TCC Physical GPUs +//! \param [out] pGpuCount count represent the number of valid entries in nvGPUHandle +//! +//! +//! \retval NVAPI_INVALID_ARGUMENT nvGPUHandle or pGpuCount is NULL +//! \retval NVAPI_OK One or more handles were returned +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_EnumTCCPhysicalGPUs( NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_EnumLogicalGPUs +// +//! This function returns an array of logical GPU handles. +//! +//! Each handle represents one or more GPUs acting in concert as a single graphics device. +//! +//! At least one GPU must be present in the system and running an NVIDIA display driver. +//! +//! The array nvGPUHandle will be filled with logical GPU handle values. The returned +//! gpuCount determines how many entries in the array are valid. +//! +//! \note All logical GPUs handles get invalidated on a GPU topology change, so the calling +//! application is required to renum the logical GPU handles to get latest physical handle +//! mapping after every GPU topology change activated by a call to NvAPI_SetGpuTopologies(). +//! +//! To detect if SLI rendering is enabled, use NvAPI_D3D_GetCurrentSLIState(). +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT nvGPUHandle or pGpuCount is NULL +//! \retval NVAPI_OK One or more handles were returned +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_EnumLogicalGPUs(NvLogicalGpuHandle nvGPUHandle[NVAPI_MAX_LOGICAL_GPUS], NvU32 *pGpuCount); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetPhysicalGPUsFromDisplay +// +//! This function returns an array of physical GPU handles associated with the specified display. +//! +//! At least one GPU must be present in the system and running an NVIDIA display driver. +//! +//! The array nvGPUHandle will be filled with physical GPU handle values. The returned +//! gpuCount determines how many entries in the array are valid. +//! +//! If the display corresponds to more than one physical GPU, the first GPU returned +//! is the one with the attached active output. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT hNvDisp is not valid; nvGPUHandle or pGpuCount is NULL +//! \retval NVAPI_OK One or more handles were returned +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND no NVIDIA GPU driving a display was found +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetPhysicalGPUsFromDisplay(NvDisplayHandle hNvDisp, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetPhysicalGPUFromUnAttachedDisplay +// +//! This function returns a physical GPU handle associated with the specified unattached display. +//! The source GPU is a physical render GPU which renders the frame buffer but may or may not drive the scan out. +//! +//! At least one GPU must be present in the system and running an NVIDIA display driver. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT hNvUnAttachedDisp is not valid or pPhysicalGpu is NULL. +//! \retval NVAPI_OK One or more handles were returned +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetPhysicalGPUFromUnAttachedDisplay(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvPhysicalGpuHandle *pPhysicalGpu); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetLogicalGPUFromDisplay +// +//! This function returns the logical GPU handle associated with the specified display. +//! At least one GPU must be present in the system and running an NVIDIA display driver. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT hNvDisp is not valid; pLogicalGPU is NULL +//! \retval NVAPI_OK One or more handles were returned +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetLogicalGPUFromDisplay(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetLogicalGPUFromPhysicalGPU +// +//! This function returns the logical GPU handle associated with specified physical GPU handle. +//! At least one GPU must be present in the system and running an NVIDIA display driver. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGPU is not valid; pLogicalGPU is NULL +//! \retval NVAPI_OK One or more handles were returned +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetLogicalGPUFromPhysicalGPU(NvPhysicalGpuHandle hPhysicalGPU, NvLogicalGpuHandle *pLogicalGPU); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetPhysicalGPUsFromLogicalGPU +// +//! This function returns the physical GPU handles associated with the specified logical GPU handle. +//! At least one GPU must be present in the system and running an NVIDIA display driver. +//! +//! The array hPhysicalGPU will be filled with physical GPU handle values. The returned +//! gpuCount determines how many entries in the array are valid. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT hLogicalGPU is not valid; hPhysicalGPU is NULL +//! \retval NVAPI_OK One or more handles were returned +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_LOGICAL_GPU_HANDLE hLogicalGPU was not a logical GPU handle +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetPhysicalGPUsFromLogicalGPU(NvLogicalGpuHandle hLogicalGPU,NvPhysicalGpuHandle hPhysicalGPU[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetGpuCoreCount +// +//! DESCRIPTION: Retrieves the total number of cores defined for a GPU. +//! Returns 0 on architectures that don't define GPU cores. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \retval ::NVAPI_INVALID_ARGUMENT pCount is NULL +//! \retval ::NVAPI_OK *pCount is set +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND no NVIDIA GPU driving a display was found +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +//! \retval ::NVAPI_NOT_SUPPORTED API call is not supported on current architecture +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetGpuCoreCount(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pCount); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetAllOutputs +// +//! This function returns set of all GPU-output identifiers as a bitmask. +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetAllDisplayIds. +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 85 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pOutputsMask is NULL. +//! \retval NVAPI_OK *pOutputsMask contains a set of GPU-output identifiers. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetAllDisplayIds.") +NVAPI_INTERFACE NvAPI_GPU_GetAllOutputs(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pOutputsMask); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetConnectedOutputs +// +//! This function is the same as NvAPI_GPU_GetAllOutputs() but returns only the set of GPU output +//! identifiers that are connected to display devices. +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetConnectedDisplayIds. +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pOutputsMask is NULL. +//! \retval NVAPI_OK *pOutputsMask contains a set of GPU-output identifiers. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetConnectedDisplayIds.") +NVAPI_INTERFACE NvAPI_GPU_GetConnectedOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetConnectedSLIOutputs +// +//! DESCRIPTION: This function is the same as NvAPI_GPU_GetConnectedOutputs() but returns only the set of GPU-output +//! identifiers that can be selected in an SLI configuration. +//! NOTE: This function matches NvAPI_GPU_GetConnectedOutputs() +//! - On systems which are not SLI capable. +//! - If the queried GPU is not part of a valid SLI group. +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetConnectedDisplayIds. +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 170 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pOutputsMask is NULL +//! \retval NVAPI_OK *pOutputsMask contains a set of GPU-output identifiers +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetConnectedDisplayIds.") +NVAPI_INTERFACE NvAPI_GPU_GetConnectedSLIOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask); + + + + +//! \ingroup gpu +typedef enum +{ + NV_MONITOR_CONN_TYPE_UNINITIALIZED = 0, + NV_MONITOR_CONN_TYPE_VGA, + NV_MONITOR_CONN_TYPE_COMPONENT, + NV_MONITOR_CONN_TYPE_SVIDEO, + NV_MONITOR_CONN_TYPE_HDMI, + NV_MONITOR_CONN_TYPE_DVI, + NV_MONITOR_CONN_TYPE_LVDS, + NV_MONITOR_CONN_TYPE_DP, + NV_MONITOR_CONN_TYPE_COMPOSITE, + NV_MONITOR_CONN_TYPE_UNKNOWN = -1 +} NV_MONITOR_CONN_TYPE; + + +//! \addtogroup gpu +//! @{ +#define NV_GPU_CONNECTED_IDS_FLAG_UNCACHED NV_BIT(0) //!< Get uncached connected devices +#define NV_GPU_CONNECTED_IDS_FLAG_SLI NV_BIT(1) //!< Get devices such that those can be selected in an SLI configuration +#define NV_GPU_CONNECTED_IDS_FLAG_LIDSTATE NV_BIT(2) //!< Get devices such that to reflect the Lid State +#define NV_GPU_CONNECTED_IDS_FLAG_FAKE NV_BIT(3) //!< Get devices that includes the fake connected monitors +#define NV_GPU_CONNECTED_IDS_FLAG_EXCLUDE_MST NV_BIT(4) //!< Excludes devices that are part of the multi stream topology. + +//! @} + +//! \ingroup gpu +typedef struct _NV_GPU_DISPLAYIDS +{ + NvU32 version; + NV_MONITOR_CONN_TYPE connectorType; //!< out: vga, tv, dvi, hdmi and dp. This is reserved for future use and clients should not rely on this information. Instead get the + //!< GPU connector type from NvAPI_GPU_GetConnectorInfo/NvAPI_GPU_GetConnectorInfoEx + NvU32 displayId; //!< this is a unique identifier for each device + NvU32 isDynamic:1; //!< if bit is set then this display is part of MST topology and it's a dynamic + NvU32 isMultiStreamRootNode:1; //!< if bit is set then this displayID belongs to a multi stream enabled connector(root node). Note that when multi stream is enabled and + //!< a single multi stream capable monitor is connected to it, the monitor will share the display id with the RootNode. + //!< When there is more than one monitor connected in a multi stream topology, then the root node will have a separate displayId. + NvU32 isActive:1; //!< if bit is set then this display is being actively driven + NvU32 isCluster:1; //!< if bit is set then this display is the representative display + NvU32 isOSVisible:1; //!< if bit is set, then this display is reported to the OS + NvU32 isWFD:1; //!< if bit is set, then this display is wireless + NvU32 isConnected:1; //!< if bit is set, then this display is connected + NvU32 reservedInternal:10; //!< Do not use + NvU32 isPhysicallyConnected:1; //!< if bit is set, then this display is a phycially connected display; Valid only when isConnected bit is set + NvU32 reserved: 14; //!< must be zero +} NV_GPU_DISPLAYIDS; + +//! \ingroup gpu +//! Macro for constructing the version field of ::_NV_GPU_DISPLAYIDS +#define NV_GPU_DISPLAYIDS_VER1 MAKE_NVAPI_VERSION(NV_GPU_DISPLAYIDS,1) +#define NV_GPU_DISPLAYIDS_VER2 MAKE_NVAPI_VERSION(NV_GPU_DISPLAYIDS,3) + +#define NV_GPU_DISPLAYIDS_VER NV_GPU_DISPLAYIDS_VER2 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetConnectedDisplayIds +// +//! \code +//! DESCRIPTION: Due to space limitation NvAPI_GPU_GetConnectedOutputs can return maximum 32 devices, but +//! this is no longer true for DPMST. NvAPI_GPU_GetConnectedDisplayIds will return all +//! the connected display devices in the form of displayIds for the associated hPhysicalGpu. +//! This function can accept set of flags to request cached, uncached, sli and lid to get the connected devices. +//! Default value for flags will be cached . +//! HOW TO USE: 1) for each PhysicalGpu, make a call to get the number of connected displayId's +//! using NvAPI_GPU_GetConnectedDisplayIds by passing the pDisplayIds as NULL +//! On call success: +//! 2) Allocate memory based on pDisplayIdCount then make a call NvAPI_GPU_GetConnectedDisplayIds to populate DisplayIds +//! SUPPORTED OS: Windows XP and higher +//! +//! PARAMETERS: hPhysicalGpu (IN) - GPU selection +//! flags (IN) - One or more defines from NV_GPU_CONNECTED_IDS_FLAG_* as valid flags. +//! pDisplayIds (IN/OUT) - Pointer to an NV_GPU_DISPLAYIDS struct, each entry represents a one displayID and its attributes +//! pDisplayIdCount(OUT)- Number of displayId's. +//! +//! RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pDisplayIds or pDisplayIdCount is NULL +//! NVAPI_OK: *pDisplayIds contains a set of GPU-output identifiers +//! NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found +//! NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle +//! \endcode +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetConnectedDisplayIds(__in NvPhysicalGpuHandle hPhysicalGpu, __inout_ecount_part_opt(*pDisplayIdCount, *pDisplayIdCount) NV_GPU_DISPLAYIDS* pDisplayIds, __inout NvU32* pDisplayIdCount, __in NvU32 flags); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetAllDisplayIds +// +//! DESCRIPTION: This API returns display IDs for all possible outputs on the GPU. +//! For DPMST connector, it will return display IDs for all the video sinks in the topology. \n +//! HOW TO USE: 1. The first call should be made to get the all display ID count. To get the display ID count, send in \n +//! a) hPhysicalGpu - a valid GPU handle(enumerated using NvAPI_EnumPhysicalGPUs()) as input, \n +//! b) pDisplayIds - NULL, as we just want to get the display ID count. \n +//! c) pDisplayIdCount - a valid pointer to NvU32, whose value is set to ZERO. \n +//! If all parameters are correct and this call is successful, this call will return the display ID's count. \n +//! 2. To get the display ID array, make the second call to NvAPI_GPU_GetAllDisplayIds() with \n +//! a) hPhysicalGpu - should be same value which was sent in first call, \n +//! b) pDisplayIds - pointer to the display ID array allocated by caller based on display ID count, \n +//! eg. malloc(sizeof(NV_GPU_DISPLAYIDS) * pDisplayIdCount). \n +//! c) pDisplayIdCount - a valid pointer to NvU32. This indicates for how many display IDs \n +//! the memory is allocated(pDisplayIds) by the caller. \n +//! If all parameters are correct and this call is successful, this call will return the display ID array and actual +//! display ID count (which was obtained in the first call to NvAPI_GPU_GetAllDisplayIds). If the input display ID count is +//! less than the actual display ID count, it will overwrite the input and give the pDisplayIdCount as actual count and the +//! API will return NVAPI_INSUFFICIENT_BUFFER. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hPhysicalGpu GPU selection. +//! \param [in,out] DisplayIds Pointer to an array of NV_GPU_DISPLAYIDS structures, each entry represents one displayID +//! and its attributes. +//! \param [in,out] pDisplayIdCount As input, this parameter indicates the number of display's id's for which caller has +//! allocated the memory. As output, it will return the actual number of display IDs. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \retval NVAPI_INSUFFICIENT_BUFFER When the input buffer(pDisplayIds) is less than the actual number of display IDs, this API +//! will return NVAPI_INSUFFICIENT_BUFFER. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetAllDisplayIds(__in NvPhysicalGpuHandle hPhysicalGpu, __inout_ecount_part_opt(*pDisplayIdCount, *pDisplayIdCount) NV_GPU_DISPLAYIDS* pDisplayIds, __inout NvU32* pDisplayIdCount); + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetConnectedOutputsWithLidState +// +//! This function is similar to NvAPI_GPU_GetConnectedOutputs(), and returns the connected display identifiers that are connected +//! as an output mask but unlike NvAPI_GPU_GetConnectedOutputs() this API "always" reflects the Lid State in the output mask. +//! Thus if you expect the LID close state to be available in the connection mask use this API. +//! - If LID is closed then this API will remove the LID panel from the connected display identifiers. +//! - If LID is open then this API will reflect the LID panel in the connected display identifiers. +//! +//! \note This API should be used on notebook systems and on systems where the LID state is required in the connection +//! output mask. On desktop systems the returned identifiers will match NvAPI_GPU_GetConnectedOutputs(). +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetConnectedDisplayIds. +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 95 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pOutputsMask is NULL +//! \retval NVAPI_OK *pOutputsMask contains a set of GPU-output identifiers +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetConnectedDisplayIds.") +NVAPI_INTERFACE NvAPI_GPU_GetConnectedOutputsWithLidState(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetConnectedSLIOutputsWithLidState +// +//! DESCRIPTION: This function is the same as NvAPI_GPU_GetConnectedOutputsWithLidState() but returns only the set +//! of GPU-output identifiers that can be selected in an SLI configuration. With SLI disabled, +//! this function matches NvAPI_GPU_GetConnectedOutputsWithLidState(). +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetConnectedDisplayIds. +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 170 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pOutputsMask is NULL +//! \retval NVAPI_OK *pOutputsMask contains a set of GPU-output identifiers +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_GPU_GetConnectedDisplayIds.") +NVAPI_INTERFACE NvAPI_GPU_GetConnectedSLIOutputsWithLidState(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetSystemType +// +//! \fn NvAPI_GPU_GetSystemType(NvPhysicalGpuHandle hPhysicalGpu, NV_SYSTEM_TYPE *pSystemType) +//! This function identifies whether the GPU is a notebook GPU or a desktop GPU. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 95 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pOutputsMask is NULL +//! \retval NVAPI_OK *pSystemType contains the GPU system type +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup gpu +//! Used in NvAPI_GPU_GetSystemType() +typedef enum +{ + NV_SYSTEM_TYPE_UNKNOWN = 0, + NV_SYSTEM_TYPE_LAPTOP = 1, + NV_SYSTEM_TYPE_DESKTOP = 2, + +} NV_SYSTEM_TYPE; + + + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_GetSystemType(NvPhysicalGpuHandle hPhysicalGpu, NV_SYSTEM_TYPE *pSystemType); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetActiveOutputs +// +//! This function is the same as NvAPI_GPU_GetAllOutputs but returns only the set of GPU output +//! identifiers that are actively driving display devices. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 85 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pOutputsMask is NULL. +//! \retval NVAPI_OK *pOutputsMask contains a set of GPU-output identifiers. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetActiveOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_SetEDID +// +//! Thus function sets the EDID data for the specified GPU handle and connection bit mask. +//! User can either send (Gpu handle & output id) or only display Id in variable displayOutputId parameter & hPhysicalGpu parameter can be default handle (0). +//! \note The EDID will be cached across the boot session and will be enumerated to the OS in this call. +//! To remove the EDID set sizeofEDID to zero. +//! OS and NVAPI connection status APIs will reflect the newly set or removed EDID dynamically. +//! +//! This feature will NOT be supported on the following boards: +//! - GeForce +//! - Quadro VX +//! - Tesla +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 100 +//! +//! \retval NVAPI_INVALID_ARGUMENT pEDID is NULL; displayOutputId has 0 or > 1 bits set +//! \retval NVAPI_OK *pEDID data was applied to the requested displayOutputId. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle. +//! \retval NVAPI_NOT_SUPPORTED For the above mentioned GPUs +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_SetEDID(NvPhysicalGpuHandle hPhysicalGpu, NvU32 displayOutputId, NV_EDID *pEDID); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetOutputType +// +//! \fn NvAPI_GPU_GetOutputType(NvPhysicalGpuHandle hPhysicalGpu, NvU32 outputId, NV_GPU_OUTPUT_TYPE *pOutputType) +//! This function returns the output type for a specific physical GPU handle and outputId (exactly 1 bit set - see \ref handles). +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \Version Earliest supported ForceWare version: 82.61 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu, outputId, or pOutputsMask is NULL; or outputId has > 1 bit set +//! \retval NVAPI_OK *pOutputType contains a NvGpuOutputType value +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup gpu +//! used in NvAPI_GPU_GetOutputType() +typedef enum _NV_GPU_OUTPUT_TYPE +{ + NVAPI_GPU_OUTPUT_UNKNOWN = 0, + NVAPI_GPU_OUTPUT_CRT = 1, //!< CRT display device + NVAPI_GPU_OUTPUT_DFP = 2, //!< Digital Flat Panel display device + NVAPI_GPU_OUTPUT_TV = 3, //!< TV display device +} NV_GPU_OUTPUT_TYPE; + + + + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_GetOutputType(NvPhysicalGpuHandle hPhysicalGpu, NvU32 outputId, NV_GPU_OUTPUT_TYPE *pOutputType); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_ValidateOutputCombination +// +//! This function determines if a set of GPU outputs can be active +//! simultaneously. While a GPU may have outputs, typically they cannot +//! all be active at the same time due to internal resource sharing. +//! +//! Given a physical GPU handle and a mask of candidate outputs, this call +//! will return NVAPI_OK if all of the specified outputs can be driven +//! simultaneously. It will return NVAPI_INVALID_COMBINATION if they cannot. +//! +//! Use NvAPI_GPU_GetAllOutputs() to determine which outputs are candidates. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 85 +//! +//! \retval NVAPI_OK Combination of outputs in outputsMask are valid (can be active simultaneously). +//! \retval NVAPI_INVALID_COMBINATION Combination of outputs in outputsMask are NOT valid. +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or outputsMask does not have at least 2 bits set. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_ValidateOutputCombination(NvPhysicalGpuHandle hPhysicalGpu, NvU32 outputsMask); + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetFullName +// +//! This function retrieves the full GPU name as an ASCII string - for example, "Quadro FX 1400". +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 90 +//! +//! \return NVAPI_ERROR or NVAPI_OK +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetFullName(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetPCIIdentifiers +// +//! This function returns the PCI identifiers associated with this GPU. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 90 +//! +//! \param DeviceId The internal PCI device identifier for the GPU. +//! \param SubSystemId The internal PCI subsystem identifier for the GPU. +//! \param RevisionId The internal PCI device-specific revision identifier for the GPU. +//! \param ExtDeviceId The external PCI device identifier for the GPU. +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or an argument is NULL +//! \retval NVAPI_OK Arguments are populated with PCI identifiers +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetPCIIdentifiers(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pDeviceId,NvU32 *pSubSystemId,NvU32 *pRevisionId,NvU32 *pExtDeviceId); + + + + +//! \ingroup gpu +//! Used in NvAPI_GPU_GetGPUType(). +typedef enum _NV_GPU_TYPE +{ + NV_SYSTEM_TYPE_GPU_UNKNOWN = 0, + NV_SYSTEM_TYPE_IGPU = 1, //!< Integrated GPU + NV_SYSTEM_TYPE_DGPU = 2, //!< Discrete GPU +} NV_GPU_TYPE; + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetGPUType +// +//! DESCRIPTION: This function returns the GPU type (integrated or discrete). +//! See ::NV_GPU_TYPE. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 173 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu +//! \retval NVAPI_OK *pGpuType contains the GPU type +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetGPUType(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_TYPE *pGpuType); + + + + +//! \ingroup gpu +//! Used in NvAPI_GPU_GetBusType() +typedef enum _NV_GPU_BUS_TYPE +{ + NVAPI_GPU_BUS_TYPE_UNDEFINED = 0, + NVAPI_GPU_BUS_TYPE_PCI = 1, + NVAPI_GPU_BUS_TYPE_AGP = 2, + NVAPI_GPU_BUS_TYPE_PCI_EXPRESS = 3, + NVAPI_GPU_BUS_TYPE_FPCI = 4, + NVAPI_GPU_BUS_TYPE_AXI = 5, +} NV_GPU_BUS_TYPE; +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetBusType +// +//! This function returns the type of bus associated with this GPU. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 90 +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pBusType is NULL. +//! \retval NVAPI_OK *pBusType contains bus identifier. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetBusType(NvPhysicalGpuHandle hPhysicalGpu,NV_GPU_BUS_TYPE *pBusType); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetBusId +// +//! DESCRIPTION: Returns the ID of the bus associated with this GPU. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 167 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pBusId is NULL. +//! \retval NVAPI_OK *pBusId contains the bus ID. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetBusId(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusId); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetBusSlotId +// +//! DESCRIPTION: Returns the ID of the bus slot associated with this GPU. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 167 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pBusSlotId is NULL. +//! \retval NVAPI_OK *pBusSlotId contains the bus slot ID. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetBusSlotId(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusSlotId); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetIRQ +// +//! This function returns the interrupt number associated with this GPU. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pIRQ is NULL. +//! \retval NVAPI_OK *pIRQ contains interrupt number. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetIRQ(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pIRQ); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetVbiosRevision +// +//! This function returns the revision of the video BIOS associated with this GPU. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pBiosRevision is NULL. +//! \retval NVAPI_OK *pBiosRevision contains revision number. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetVbiosRevision(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pBiosRevision); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetVbiosOEMRevision +// +//! This function returns the OEM revision of the video BIOS associated with this GPU. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu or pBiosRevision is NULL +//! \retval NVAPI_OK *pBiosRevision contains revision number +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetVbiosOEMRevision(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pBiosRevision); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetVbiosVersionString +// +//! This function returns the full video BIOS version string in the form of xx.xx.xx.xx.yy where +//! - xx numbers come from NvAPI_GPU_GetVbiosRevision() and +//! - yy comes from NvAPI_GPU_GetVbiosOEMRevision(). +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT hPhysicalGpu is NULL. +//! \retval NVAPI_OK szBiosRevision contains version string. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetVbiosVersionString(NvPhysicalGpuHandle hPhysicalGpu,NvAPI_ShortString szBiosRevision); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetAGPAperture +// +//! This function returns the AGP aperture in megabytes. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT pSize is NULL. +//! \retval NVAPI_OK Call successful. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetAGPAperture(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetCurrentAGPRate +// +//! This function returns the current AGP Rate (0 = AGP not present, 1 = 1x, 2 = 2x, etc.). +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT pRate is NULL. +//! \retval NVAPI_OK Call successful. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetCurrentAGPRate(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pRate); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetCurrentPCIEDownstreamWidth +// +//! This function returns the number of PCIE lanes being used for the PCIE interface +//! downstream from the GPU. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT pWidth is NULL. +//! \retval NVAPI_OK Call successful. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetCurrentPCIEDownstreamWidth(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pWidth); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetPhysicalFrameBufferSize +// +//! This function returns the physical size of framebuffer in KB. This does NOT include any +//! system RAM that may be dedicated for use by the GPU. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT pSize is NULL +//! \retval NVAPI_OK Call successful +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetPhysicalFrameBufferSize(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetVirtualFrameBufferSize +// +//! This function returns the virtual size of framebuffer in KB. This includes the physical RAM plus any +//! system RAM that has been dedicated for use by the GPU. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 90 +//! +//! \retval NVAPI_INVALID_ARGUMENT pSize is NULL. +//! \retval NVAPI_OK Call successful. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle. +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetVirtualFrameBufferSize(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetQuadroStatus +// +//! This function retrieves the Quadro status for the GPU (1 if Quadro, 0 if GeForce) +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 80 +//! +//! \return NVAPI_ERROR or NVAPI_OK +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetQuadroStatus(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pStatus); + + + + +//! \ingroup gpu +typedef struct _NV_BOARD_INFO +{ + NvU32 version; //!< structure version + NvU8 BoardNum[16]; //!< Board Serial Number + +}NV_BOARD_INFO_V1; + +#define NV_BOARD_INFO_VER1 MAKE_NVAPI_VERSION(NV_BOARD_INFO_V1,1) +#ifndef NV_BOARD_INFO_VER +//! \ingroup gpu +typedef NV_BOARD_INFO_V1 NV_BOARD_INFO; +//! \ingroup gpu +//! \ingroup gpu +#define NV_BOARD_INFO_VER NV_BOARD_INFO_VER1 +#endif + +//! SUPPORTED OS: Windows XP and higher +//! +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetBoardInfo +// +//! DESCRIPTION: This API Retrieves the Board information (a unique GPU Board Serial Number) stored in the InfoROM. +//! +//! \param [in] hPhysicalGpu Physical GPU Handle. +//! \param [in,out] NV_BOARD_INFO Board Information. +//! +//! TCC_SUPPORTED +//! +//! \retval ::NVAPI_OK completed request +//! \retval ::NVAPI_ERROR miscellaneous error occurred +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE handle passed is not a physical GPU handle +//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized +//! \retval ::NVAPI_INVALID_POINTER pBoardInfo is NULL +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION the version of the INFO struct is not supported +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetBoardInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_BOARD_INFO *pBoardInfo); + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// GPU Clock Control +// +// These APIs allow the user to get and set individual clock domains +// on a per-GPU basis. +// +/////////////////////////////////////////////////////////////////////////////// + + +//! \ingroup gpuclock +//! @{ +#define NVAPI_MAX_GPU_CLOCKS 32 +#define NVAPI_MAX_GPU_PUBLIC_CLOCKS 32 +#define NVAPI_MAX_GPU_PERF_CLOCKS 32 +#define NVAPI_MAX_GPU_PERF_VOLTAGES 16 +#define NVAPI_MAX_GPU_PERF_PSTATES 16 +//! @} + +//! \ingroup gpuclock +typedef enum _NV_GPU_PUBLIC_CLOCK_ID +{ + NVAPI_GPU_PUBLIC_CLOCK_GRAPHICS = 0, + NVAPI_GPU_PUBLIC_CLOCK_MEMORY = 4, + NVAPI_GPU_PUBLIC_CLOCK_PROCESSOR = 7, + NVAPI_GPU_PUBLIC_CLOCK_VIDEO = 8, + NVAPI_GPU_PUBLIC_CLOCK_UNDEFINED = NVAPI_MAX_GPU_PUBLIC_CLOCKS, +} NV_GPU_PUBLIC_CLOCK_ID; + + +//! \ingroup gpuclock +typedef enum _NV_GPU_PERF_VOLTAGE_INFO_DOMAIN_ID +{ + NVAPI_GPU_PERF_VOLTAGE_INFO_DOMAIN_CORE = 0, + NVAPI_GPU_PERF_VOLTAGE_INFO_DOMAIN_UNDEFINED = NVAPI_MAX_GPU_PERF_VOLTAGES, +} NV_GPU_PERF_VOLTAGE_INFO_DOMAIN_ID; + + + +//! \ingroup gpuclock +//! Used in NvAPI_GPU_GetAllClockFrequencies() +typedef struct +{ + NvU32 version; //!< Structure version + NvU32 reserved; //!< These bits are reserved for future use. + struct + { + NvU32 bIsPresent:1; //!< Set if this domain is present on this GPU + NvU32 reserved:31; //!< These bits are reserved for future use. + NvU32 frequency; //!< Clock frequency (kHz) + }domain[NVAPI_MAX_GPU_PUBLIC_CLOCKS]; +} NV_GPU_CLOCK_FREQUENCIES_V1; + +//! \ingroup gpuclock +//! Used in NvAPI_GPU_GetAllClockFrequencies() +typedef enum +{ + NV_GPU_CLOCK_FREQUENCIES_CURRENT_FREQ = 0, + NV_GPU_CLOCK_FREQUENCIES_BASE_CLOCK = 1, + NV_GPU_CLOCK_FREQUENCIES_BOOST_CLOCK = 2, + NV_GPU_CLOCK_FREQUENCIES_CLOCK_TYPE_NUM = 3 +} NV_GPU_CLOCK_FREQUENCIES_CLOCK_TYPE; + +//! \ingroup gpuclock +//! Used in NvAPI_GPU_GetAllClockFrequencies() +typedef struct +{ + NvU32 version; //!< Structure version + NvU32 ClockType:2; //!< One of NV_GPU_CLOCK_FREQUENCIES_CLOCK_TYPE. Used to specify the type of clock to be returned. + NvU32 reserved:22; //!< These bits are reserved for future use. Must be set to 0. + NvU32 reserved1:8; //!< These bits are reserved. + struct + { + NvU32 bIsPresent:1; //!< Set if this domain is present on this GPU + NvU32 reserved:31; //!< These bits are reserved for future use. + NvU32 frequency; //!< Clock frequency (kHz) + }domain[NVAPI_MAX_GPU_PUBLIC_CLOCKS]; +} NV_GPU_CLOCK_FREQUENCIES_V2; + +//! \ingroup gpuclock +//! Used in NvAPI_GPU_GetAllClockFrequencies() +typedef NV_GPU_CLOCK_FREQUENCIES_V2 NV_GPU_CLOCK_FREQUENCIES; + +//! \addtogroup gpuclock +//! @{ +#define NV_GPU_CLOCK_FREQUENCIES_VER_1 MAKE_NVAPI_VERSION(NV_GPU_CLOCK_FREQUENCIES_V1,1) +#define NV_GPU_CLOCK_FREQUENCIES_VER_2 MAKE_NVAPI_VERSION(NV_GPU_CLOCK_FREQUENCIES_V2,2) +#define NV_GPU_CLOCK_FREQUENCIES_VER_3 MAKE_NVAPI_VERSION(NV_GPU_CLOCK_FREQUENCIES_V2,3) +#define NV_GPU_CLOCK_FREQUENCIES_VER NV_GPU_CLOCK_FREQUENCIES_VER_3 +//! @} + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetAllClockFrequencies +// +//! This function retrieves the NV_GPU_CLOCK_FREQUENCIES structure for the specified physical GPU. +//! +//! For each clock domain: +//! - bIsPresent is set for each domain that is present on the GPU +//! - frequency is the domain's clock freq in kHz +//! +//! Each domain's info is indexed in the array. For example: +//! clkFreqs.domain[NVAPI_GPU_PUBLIC_CLOCK_MEMORY] holds the info for the MEMORY domain. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 295 +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, +//! they are listed below. +//! \retval NVAPI_INVALID_ARGUMENT pClkFreqs is NULL. +//! \ingroup gpuclock +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetAllClockFrequencies(__in NvPhysicalGpuHandle hPhysicalGPU, __inout NV_GPU_CLOCK_FREQUENCIES *pClkFreqs); + + +//! \addtogroup gpupstate +//! @{ + +typedef enum _NV_GPU_PERF_PSTATE_ID +{ + NVAPI_GPU_PERF_PSTATE_P0 = 0, + NVAPI_GPU_PERF_PSTATE_P1, + NVAPI_GPU_PERF_PSTATE_P2, + NVAPI_GPU_PERF_PSTATE_P3, + NVAPI_GPU_PERF_PSTATE_P4, + NVAPI_GPU_PERF_PSTATE_P5, + NVAPI_GPU_PERF_PSTATE_P6, + NVAPI_GPU_PERF_PSTATE_P7, + NVAPI_GPU_PERF_PSTATE_P8, + NVAPI_GPU_PERF_PSTATE_P9, + NVAPI_GPU_PERF_PSTATE_P10, + NVAPI_GPU_PERF_PSTATE_P11, + NVAPI_GPU_PERF_PSTATE_P12, + NVAPI_GPU_PERF_PSTATE_P13, + NVAPI_GPU_PERF_PSTATE_P14, + NVAPI_GPU_PERF_PSTATE_P15, + NVAPI_GPU_PERF_PSTATE_UNDEFINED = NVAPI_MAX_GPU_PERF_PSTATES, + NVAPI_GPU_PERF_PSTATE_ALL, + +} NV_GPU_PERF_PSTATE_ID; + +//! @} + + + +//! \ingroup gpupstate +//! Used in NvAPI_GPU_GetPstatesInfoEx() +typedef struct +{ + NvU32 version; + NvU32 flags; //!< - bit 0 indicates if perfmon is enabled or not + //!< - bit 1 indicates if dynamic Pstate is capable or not + //!< - bit 2 indicates if dynamic Pstate is enable or not + //!< - all other bits must be set to 0 + NvU32 numPstates; //!< The number of available p-states + NvU32 numClocks; //!< The number of clock domains supported by each P-State + struct + { + NV_GPU_PERF_PSTATE_ID pstateId; //!< ID of the p-state. + NvU32 flags; //!< - bit 0 indicates if the PCIE limit is GEN1 or GEN2 + //!< - bit 1 indicates if the Pstate is overclocked or not + //!< - bit 2 indicates if the Pstate is overclockable or not + //!< - all other bits must be set to 0 + struct + { + NV_GPU_PUBLIC_CLOCK_ID domainId; //!< ID of the clock domain + NvU32 flags; //!< Reserved. Must be set to 0 + NvU32 freq; //!< Clock frequency in kHz + + } clocks[NVAPI_MAX_GPU_PERF_CLOCKS]; + } pstates[NVAPI_MAX_GPU_PERF_PSTATES]; + +} NV_GPU_PERF_PSTATES_INFO_V1; + + +//! \ingroup gpupstate +typedef struct +{ + NvU32 version; + NvU32 flags; //!< - bit 0 indicates if perfmon is enabled or not + //!< - bit 1 indicates if dynamic Pstate is capable or not + //!< - bit 2 indicates if dynamic Pstate is enable or not + //!< - all other bits must be set to 0 + NvU32 numPstates; //!< The number of available p-states + NvU32 numClocks; //!< The number of clock domains supported by each P-State + NvU32 numVoltages; + struct + { + NV_GPU_PERF_PSTATE_ID pstateId; //!< ID of the p-state. + NvU32 flags; //!< - bit 0 indicates if the PCIE limit is GEN1 or GEN2 + //!< - bit 1 indicates if the Pstate is overclocked or not + //!< - bit 2 indicates if the Pstate is overclockable or not + //!< - all other bits must be set to 0 + struct + { + NV_GPU_PUBLIC_CLOCK_ID domainId; + NvU32 flags; //!< bit 0 indicates if this clock is overclockable + //!< all other bits must be set to 0 + NvU32 freq; + + } clocks[NVAPI_MAX_GPU_PERF_CLOCKS]; + struct + { + NV_GPU_PERF_VOLTAGE_INFO_DOMAIN_ID domainId; //!< ID of the voltage domain, containing flags and mvolt info + NvU32 flags; //!< Reserved for future use. Must be set to 0 + NvU32 mvolt; //!< Voltage in mV + + } voltages[NVAPI_MAX_GPU_PERF_VOLTAGES]; + + } pstates[NVAPI_MAX_GPU_PERF_PSTATES]; //!< Valid index range is 0 to numVoltages-1 + +} NV_GPU_PERF_PSTATES_INFO_V2; + +//! \ingroup gpupstate +typedef NV_GPU_PERF_PSTATES_INFO_V2 NV_GPU_PERF_PSTATES_INFO; + + +//! \ingroup gpupstate +//! @{ + +//! Macro for constructing the version field of NV_GPU_PERF_PSTATES_INFO_V1 +#define NV_GPU_PERF_PSTATES_INFO_VER1 MAKE_NVAPI_VERSION(NV_GPU_PERF_PSTATES_INFO_V1,1) + +//! Macro for constructing the version field of NV_GPU_PERF_PSTATES_INFO_V2 +#define NV_GPU_PERF_PSTATES_INFO_VER2 MAKE_NVAPI_VERSION(NV_GPU_PERF_PSTATES_INFO_V2,2) + +//! Macro for constructing the version field of NV_GPU_PERF_PSTATES_INFO_V2 +#define NV_GPU_PERF_PSTATES_INFO_VER3 MAKE_NVAPI_VERSION(NV_GPU_PERF_PSTATES_INFO_V2,3) + +//! Macro for constructing the version field of NV_GPU_PERF_PSTATES_INFO +#define NV_GPU_PERF_PSTATES_INFO_VER NV_GPU_PERF_PSTATES_INFO_VER3 + +//! @} + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetPstatesInfoEx +// +//! DESCRIPTION: This API retrieves all performance states (P-States) information. This is the same as +//! NvAPI_GPU_GetPstatesInfo(), but supports an input flag for various options. +//! +//! P-States are GPU active/executing performance capability and power consumption states. +//! +//! P-States ranges from P0 to P15, with P0 being the highest performance/power state, and +//! P15 being the lowest performance/power state. Each P-State, if available, maps to a +//! performance level. Not all P-States are available on a given system. The definitions +//! of each P-State are currently as follows: \n +//! - P0/P1 - Maximum 3D performance +//! - P2/P3 - Balanced 3D performance-power +//! - P8 - Basic HD video playback +//! - P10 - DVD playback +//! - P12 - Minimum idle power consumption +//! +//! \deprecated Do not use this function - it is deprecated in release 304. Instead, use NvAPI_GPU_GetPstates20. +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \param [in] hPhysicalGPU GPU selection. +//! \param [out] pPerfPstatesInfo P-States information retrieved, as detailed below: \n +//! - flags is reserved for future use. +//! - numPstates is the number of available P-States +//! - numClocks is the number of clock domains supported by each P-State +//! - pstates has valid index range from 0 to numPstates - 1 +//! - pstates[i].pstateId is the ID of the P-State, +//! containing the following info: +//! - pstates[i].flags containing the following info: +//! - bit 0 indicates if the PCIE limit is GEN1 or GEN2 +//! - bit 1 indicates if the Pstate is overclocked or not +//! - bit 2 indicates if the Pstate is overclockable or not +//! - pstates[i].clocks has valid index range from 0 to numClocks -1 +//! - pstates[i].clocks[j].domainId is the public ID of the clock domain, +//! containing the following info: +//! - pstates[i].clocks[j].flags containing the following info: +//! bit 0 indicates if the clock domain is overclockable or not +//! - pstates[i].clocks[j].freq is the clock frequency in kHz +//! - pstates[i].voltages has a valid index range from 0 to numVoltages - 1 +//! - pstates[i].voltages[j].domainId is the ID of the voltage domain, +//! containing the following info: +//! - pstates[i].voltages[j].flags is reserved for future use. +//! - pstates[i].voltages[j].mvolt is the voltage in mV +//! inputFlags(IN) - This can be used to select various options: +//! - if bit 0 is set, pPerfPstatesInfo would contain the default settings +//! instead of the current, possibily overclocked settings. +//! - if bit 1 is set, pPerfPstatesInfo would contain the maximum clock +//! frequencies instead of the nominal frequencies. +//! - if bit 2 is set, pPerfPstatesInfo would contain the minimum clock +//! frequencies instead of the nominal frequencies. +//! - all other bits must be set to 0. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_ERROR Miscellaneous error occurred +//! \retval ::NVAPI_HANDLE_INVALIDATED Handle passed has been invalidated (see user guide) +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE Handle passed is not a physical GPU handle +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the NV_GPU_PERF_PSTATES struct is not supported +//! +//! \ingroup gpupstate +/////////////////////////////////////////////////////////////////////////////// +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 304. Instead, use NvAPI_GPU_GetPstates20.") +NVAPI_INTERFACE NvAPI_GPU_GetPstatesInfoEx(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_PSTATES_INFO *pPerfPstatesInfo, NvU32 inputFlags); + + +//! \addtogroup gpupstate +//! @{ + +#define NVAPI_MAX_GPU_PSTATE20_PSTATES 16 +#define NVAPI_MAX_GPU_PSTATE20_CLOCKS 8 +#define NVAPI_MAX_GPU_PSTATE20_BASE_VOLTAGES 4 + +//! Used to identify clock type +typedef enum +{ + //! Clock domains that use single frequency value within given pstate + NVAPI_GPU_PERF_PSTATE20_CLOCK_TYPE_SINGLE = 0, + + //! Clock domains that allow range of frequency values within given pstate + NVAPI_GPU_PERF_PSTATE20_CLOCK_TYPE_RANGE, +} NV_GPU_PERF_PSTATE20_CLOCK_TYPE_ID; + +//! Used to describe both voltage and frequency deltas +typedef struct +{ + //! Value of parameter delta (in respective units [kHz, uV]) + NvS32 value; + + struct + { + //! Min value allowed for parameter delta (in respective units [kHz, uV]) + NvS32 min; + + //! Max value allowed for parameter delta (in respective units [kHz, uV]) + NvS32 max; + } valueRange; +} NV_GPU_PERF_PSTATES20_PARAM_DELTA; + +//! Used to describe single clock entry +typedef struct +{ + //! ID of the clock domain + NV_GPU_PUBLIC_CLOCK_ID domainId; + + //! Clock type ID + NV_GPU_PERF_PSTATE20_CLOCK_TYPE_ID typeId; + NvU32 bIsEditable:1; + + //! These bits are reserved for future use (must be always 0) + NvU32 reserved:31; + + //! Current frequency delta from nominal settings in (kHz) + NV_GPU_PERF_PSTATES20_PARAM_DELTA freqDelta_kHz; + + //! Clock domain type dependant information + union + { + struct + { + //! Clock frequency within given pstate in (kHz) + NvU32 freq_kHz; + } single; + + struct + { + //! Min clock frequency within given pstate in (kHz) + NvU32 minFreq_kHz; + + //! Max clock frequency within given pstate in (kHz) + NvU32 maxFreq_kHz; + + //! Voltage domain ID and value range in (uV) required for this clock + NV_GPU_PERF_VOLTAGE_INFO_DOMAIN_ID domainId; + NvU32 minVoltage_uV; + NvU32 maxVoltage_uV; + } range; + } data; +} NV_GPU_PSTATE20_CLOCK_ENTRY_V1; + +//! Used to describe single base voltage entry +typedef struct +{ + //! ID of the voltage domain + NV_GPU_PERF_VOLTAGE_INFO_DOMAIN_ID domainId; + NvU32 bIsEditable:1; + + //! These bits are reserved for future use (must be always 0) + NvU32 reserved:31; + + //! Current base voltage settings in [uV] + NvU32 volt_uV; + + NV_GPU_PERF_PSTATES20_PARAM_DELTA voltDelta_uV; // Current base voltage delta from nominal settings in [uV] +} NV_GPU_PSTATE20_BASE_VOLTAGE_ENTRY_V1; + +//! Used in NvAPI_GPU_GetPstates20() interface call. + +typedef struct +{ + //! Version info of the structure (NV_GPU_PERF_PSTATES20_INFO_VER) + NvU32 version; + + NvU32 bIsEditable:1; + + //! These bits are reserved for future use (must be always 0) + NvU32 reserved:31; + + //! Number of populated pstates + NvU32 numPstates; + + //! Number of populated clocks (per pstate) + NvU32 numClocks; + + //! Number of populated base voltages (per pstate) + NvU32 numBaseVoltages; + + //! Performance state (P-State) settings + //! Valid index range is 0 to numPstates-1 + struct + { + //! ID of the P-State + NV_GPU_PERF_PSTATE_ID pstateId; + + NvU32 bIsEditable:1; + + //! These bits are reserved for future use (must be always 0) + NvU32 reserved:31; + + //! Array of clock entries + //! Valid index range is 0 to numClocks-1 + NV_GPU_PSTATE20_CLOCK_ENTRY_V1 clocks[NVAPI_MAX_GPU_PSTATE20_CLOCKS]; + + //! Array of baseVoltage entries + //! Valid index range is 0 to numBaseVoltages-1 + NV_GPU_PSTATE20_BASE_VOLTAGE_ENTRY_V1 baseVoltages[NVAPI_MAX_GPU_PSTATE20_BASE_VOLTAGES]; + } pstates[NVAPI_MAX_GPU_PSTATE20_PSTATES]; +} NV_GPU_PERF_PSTATES20_INFO_V1; + +//! Used in NvAPI_GPU_GetPstates20() interface call. + +typedef struct _NV_GPU_PERF_PSTATES20_INFO_V2 +{ + //! Version info of the structure (NV_GPU_PERF_PSTATES20_INFO_VER) + NvU32 version; + + NvU32 bIsEditable:1; + + //! These bits are reserved for future use (must be always 0) + NvU32 reserved:31; + + //! Number of populated pstates + NvU32 numPstates; + + //! Number of populated clocks (per pstate) + NvU32 numClocks; + + //! Number of populated base voltages (per pstate) + NvU32 numBaseVoltages; + + //! Performance state (P-State) settings + //! Valid index range is 0 to numPstates-1 + struct + { + //! ID of the P-State + NV_GPU_PERF_PSTATE_ID pstateId; + + NvU32 bIsEditable:1; + + //! These bits are reserved for future use (must be always 0) + NvU32 reserved:31; + + //! Array of clock entries + //! Valid index range is 0 to numClocks-1 + NV_GPU_PSTATE20_CLOCK_ENTRY_V1 clocks[NVAPI_MAX_GPU_PSTATE20_CLOCKS]; + + //! Array of baseVoltage entries + //! Valid index range is 0 to numBaseVoltages-1 + NV_GPU_PSTATE20_BASE_VOLTAGE_ENTRY_V1 baseVoltages[NVAPI_MAX_GPU_PSTATE20_BASE_VOLTAGES]; + } pstates[NVAPI_MAX_GPU_PSTATE20_PSTATES]; + + //! OV settings - Please refer to NVIDIA over-volting recommendation to understand impact of this functionality + //! Valid index range is 0 to numVoltages-1 + struct + { + //! Number of populated voltages + NvU32 numVoltages; + + //! Array of voltage entries + //! Valid index range is 0 to numVoltages-1 + NV_GPU_PSTATE20_BASE_VOLTAGE_ENTRY_V1 voltages[NVAPI_MAX_GPU_PSTATE20_BASE_VOLTAGES]; + } ov; +} NV_GPU_PERF_PSTATES20_INFO_V2; + +typedef NV_GPU_PERF_PSTATES20_INFO_V2 NV_GPU_PERF_PSTATES20_INFO; + +//! Macro for constructing the version field of NV_GPU_PERF_PSTATES20_INFO_V1 +#define NV_GPU_PERF_PSTATES20_INFO_VER1 MAKE_NVAPI_VERSION(NV_GPU_PERF_PSTATES20_INFO_V1,1) + +//! Macro for constructing the version field of NV_GPU_PERF_PSTATES20_INFO_V2 +#define NV_GPU_PERF_PSTATES20_INFO_VER2 MAKE_NVAPI_VERSION(NV_GPU_PERF_PSTATES20_INFO_V2,2) + +//! Macro for constructing the version field of NV_GPU_PERF_PSTATES20_INFO_V2 +#define NV_GPU_PERF_PSTATES20_INFO_VER3 MAKE_NVAPI_VERSION(NV_GPU_PERF_PSTATES20_INFO_V2,3) + +//! Macro for constructing the version field of NV_GPU_PERF_PSTATES20_INFO +#define NV_GPU_PERF_PSTATES20_INFO_VER NV_GPU_PERF_PSTATES20_INFO_VER3 + +//! @} + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetPstates20 +// +//! DESCRIPTION: This API retrieves all performance states (P-States) 2.0 information. +//! +//! P-States are GPU active/executing performance capability states. +//! They range from P0 to P15, with P0 being the highest performance state, +//! and P15 being the lowest performance state. Each P-State, if available, +//! maps to a performance level. Not all P-States are available on a given system. +//! The definition of each P-States are currently as follow: +//! - P0/P1 - Maximum 3D performance +//! - P2/P3 - Balanced 3D performance-power +//! - P8 - Basic HD video playback +//! - P10 - DVD playback +//! - P12 - Minimum idle power consumption +//! +//! TCC_SUPPORTED +//! +//! \since Release: 295 +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hPhysicalGPU GPU selection +//! \param [out] pPstatesInfo P-States information retrieved, as documented in declaration above +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, +//! they are listed below. +//! +//! \ingroup gpupstate +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetPstates20(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_PERF_PSTATES20_INFO *pPstatesInfo); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetCurrentPstate +// +//! DESCRIPTION: This function retrieves the current performance state (P-State). +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 165 +//! +//! TCC_SUPPORTED +//! +//! \param [in] hPhysicalGPU GPU selection +//! \param [out] pCurrentPstate The ID of the current P-State of the GPU - see \ref NV_GPU_PERF_PSTATES. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred. +//! \retval NVAPI_HANDLE_INVALIDATED Handle passed has been invalidated (see user guide). +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE Handle passed is not a physical GPU handle. +//! \retval NVAPI_NOT_SUPPORTED P-States is not supported on this setup. +//! +//! \ingroup gpupstate +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetCurrentPstate(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_PSTATE_ID *pCurrentPstate); + + + + +//! \ingroup gpupstate +#define NVAPI_MAX_GPU_UTILIZATIONS 8 + + + +//! \ingroup gpupstate +//! Used in NvAPI_GPU_GetDynamicPstatesInfoEx(). +typedef struct +{ + NvU32 version; //!< Structure version + NvU32 flags; //!< bit 0 indicates if the dynamic Pstate is enabled or not + struct + { + NvU32 bIsPresent:1; //!< Set if this utilization domain is present on this GPU + NvU32 percentage; //!< Percentage of time where the domain is considered busy in the last 1 second interval + } utilization[NVAPI_MAX_GPU_UTILIZATIONS]; +} NV_GPU_DYNAMIC_PSTATES_INFO_EX; + +//! \ingroup gpupstate +//! Macro for constructing the version field of NV_GPU_DYNAMIC_PSTATES_INFO_EX +#define NV_GPU_DYNAMIC_PSTATES_INFO_EX_VER MAKE_NVAPI_VERSION(NV_GPU_DYNAMIC_PSTATES_INFO_EX,1) + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetDynamicPstatesInfoEx +// +//! DESCRIPTION: This API retrieves the NV_GPU_DYNAMIC_PSTATES_INFO_EX structure for the specified physical GPU. +//! Each domain's info is indexed in the array. For example: +//! - pDynamicPstatesInfo->utilization[NVAPI_GPU_UTILIZATION_DOMAIN_GPU] holds the info for the GPU domain. \p +//! There are currently 4 domains for which GPU utilization and dynamic P-State thresholds can be retrieved: +//! graphic engine (GPU), frame buffer (FB), video engine (VID), and bus interface (BUS). +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 185 +//! +//! \retval ::NVAPI_OK +//! \retval ::NVAPI_ERROR +//! \retval ::NVAPI_INVALID_ARGUMENT pDynamicPstatesInfo is NULL +//! \retval ::NVAPI_HANDLE_INVALIDATED +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the INFO struct is not supported +//! +//! \ingroup gpupstate +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetDynamicPstatesInfoEx(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_DYNAMIC_PSTATES_INFO_EX *pDynamicPstatesInfoEx); + +/////////////////////////////////////////////////////////////////////////////////// +// Thermal API +// Provides ability to get temperature levels from the various thermal sensors associated with the GPU + +//! \ingroup gputhermal +#define NVAPI_MAX_THERMAL_SENSORS_PER_GPU 3 + +//! \ingroup gputhermal +//! Used in NV_GPU_THERMAL_SETTINGS +typedef enum +{ + NVAPI_THERMAL_TARGET_NONE = 0, + NVAPI_THERMAL_TARGET_GPU = 1, //!< GPU core temperature requires NvPhysicalGpuHandle + NVAPI_THERMAL_TARGET_MEMORY = 2, //!< GPU memory temperature requires NvPhysicalGpuHandle + NVAPI_THERMAL_TARGET_POWER_SUPPLY = 4, //!< GPU power supply temperature requires NvPhysicalGpuHandle + NVAPI_THERMAL_TARGET_BOARD = 8, //!< GPU board ambient temperature requires NvPhysicalGpuHandle + NVAPI_THERMAL_TARGET_VCD_BOARD = 9, //!< Visual Computing Device Board temperature requires NvVisualComputingDeviceHandle + NVAPI_THERMAL_TARGET_VCD_INLET = 10, //!< Visual Computing Device Inlet temperature requires NvVisualComputingDeviceHandle + NVAPI_THERMAL_TARGET_VCD_OUTLET = 11, //!< Visual Computing Device Outlet temperature requires NvVisualComputingDeviceHandle + + NVAPI_THERMAL_TARGET_ALL = 15, + NVAPI_THERMAL_TARGET_UNKNOWN = -1, +} NV_THERMAL_TARGET; + +//! \ingroup gputhermal +//! Used in NV_GPU_THERMAL_SETTINGS +typedef enum +{ + NVAPI_THERMAL_CONTROLLER_NONE = 0, + NVAPI_THERMAL_CONTROLLER_GPU_INTERNAL, + NVAPI_THERMAL_CONTROLLER_ADM1032, + NVAPI_THERMAL_CONTROLLER_MAX6649, + NVAPI_THERMAL_CONTROLLER_MAX1617, + NVAPI_THERMAL_CONTROLLER_LM99, + NVAPI_THERMAL_CONTROLLER_LM89, + NVAPI_THERMAL_CONTROLLER_LM64, + NVAPI_THERMAL_CONTROLLER_ADT7473, + NVAPI_THERMAL_CONTROLLER_SBMAX6649, + NVAPI_THERMAL_CONTROLLER_VBIOSEVT, + NVAPI_THERMAL_CONTROLLER_OS, + NVAPI_THERMAL_CONTROLLER_UNKNOWN = -1, +} NV_THERMAL_CONTROLLER; + +//! \ingroup gputhermal +//! Used in NvAPI_GPU_GetThermalSettings() +typedef struct +{ + NvU32 version; //!< structure version + NvU32 count; //!< number of associated thermal sensors + struct + { + NV_THERMAL_CONTROLLER controller; //!< internal, ADM1032, MAX6649... + NvU32 defaultMinTemp; //!< The min default temperature value of the thermal sensor in degree Celsius + NvU32 defaultMaxTemp; //!< The max default temperature value of the thermal sensor in degree Celsius + NvU32 currentTemp; //!< The current temperature value of the thermal sensor in degree Celsius + NV_THERMAL_TARGET target; //!< Thermal sensor targeted @ GPU, memory, chipset, powersupply, Visual Computing Device, etc. + } sensor[NVAPI_MAX_THERMAL_SENSORS_PER_GPU]; + +} NV_GPU_THERMAL_SETTINGS_V1; + +//! \ingroup gputhermal +typedef struct +{ + NvU32 version; //!< structure version + NvU32 count; //!< number of associated thermal sensors + struct + { + NV_THERMAL_CONTROLLER controller; //!< internal, ADM1032, MAX6649... + NvS32 defaultMinTemp; //!< Minimum default temperature value of the thermal sensor in degree Celsius + NvS32 defaultMaxTemp; //!< Maximum default temperature value of the thermal sensor in degree Celsius + NvS32 currentTemp; //!< Current temperature value of the thermal sensor in degree Celsius + NV_THERMAL_TARGET target; //!< Thermal sensor targeted - GPU, memory, chipset, powersupply, Visual Computing Device, etc + } sensor[NVAPI_MAX_THERMAL_SENSORS_PER_GPU]; + +} NV_GPU_THERMAL_SETTINGS_V2; + +//! \ingroup gputhermal +typedef NV_GPU_THERMAL_SETTINGS_V2 NV_GPU_THERMAL_SETTINGS; + +//! \ingroup gputhermal +//! @{ + +//! Macro for constructing the version field of NV_GPU_THERMAL_SETTINGS_V1 +#define NV_GPU_THERMAL_SETTINGS_VER_1 MAKE_NVAPI_VERSION(NV_GPU_THERMAL_SETTINGS_V1,1) + +//! Macro for constructing the version field of NV_GPU_THERMAL_SETTINGS_V2 +#define NV_GPU_THERMAL_SETTINGS_VER_2 MAKE_NVAPI_VERSION(NV_GPU_THERMAL_SETTINGS_V2,2) + +//! Macro for constructing the version field of NV_GPU_THERMAL_SETTINGS +#define NV_GPU_THERMAL_SETTINGS_VER NV_GPU_THERMAL_SETTINGS_VER_2 +//! @} + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetThermalSettings +// +//! This function retrieves the thermal information of all thermal sensors or specific thermal sensor associated with the selected GPU. +//! Thermal sensors are indexed 0 to NVAPI_MAX_THERMAL_SENSORS_PER_GPU-1. +//! +//! - To retrieve specific thermal sensor info, set the sensorIndex to the required thermal sensor index. +//! - To retrieve info for all sensors, set sensorIndex to NVAPI_THERMAL_TARGET_ALL. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 85 +//! +//! \param [in] hPhysicalGPU GPU selection. +//! \param [in] sensorIndex Explicit thermal sensor index selection. +//! \param [out] pThermalSettings Array of thermal settings. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred. +//! \retval NVAPI_INVALID_ARGUMENT pThermalInfo is NULL. +//! \retval NVAPI_HANDLE_INVALIDATED Handle passed has been invalidated (see user guide). +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE Handle passed is not a physical GPU handle. +//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the INFO struct is not supported. +//! \ingroup gputhermal +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetThermalSettings(NvPhysicalGpuHandle hPhysicalGpu, NvU32 sensorIndex, NV_GPU_THERMAL_SETTINGS *pThermalSettings); + + +/////////////////////////////////////////////////////////////////////////////////// +// I2C API +// Provides ability to read or write data using I2C protocol. +// These APIs allow I2C access only to DDC monitors + + +//! \addtogroup i2capi +//! @{ +#define NVAPI_MAX_SIZEOF_I2C_DATA_BUFFER 4096 +#define NVAPI_MAX_SIZEOF_I2C_REG_ADDRESS 4 +#define NVAPI_DISPLAY_DEVICE_MASK_MAX 24 +#define NVAPI_I2C_SPEED_DEPRECATED 0xFFFF + +typedef enum +{ + NVAPI_I2C_SPEED_DEFAULT, //!< Set i2cSpeedKhz to I2C_SPEED_DEFAULT if default I2C speed is to be chosen, ie.use the current frequency setting. + NVAPI_I2C_SPEED_3KHZ, + NVAPI_I2C_SPEED_10KHZ, + NVAPI_I2C_SPEED_33KHZ, + NVAPI_I2C_SPEED_100KHZ, + NVAPI_I2C_SPEED_200KHZ, + NVAPI_I2C_SPEED_400KHZ, +} NV_I2C_SPEED; + +//! Used in NvAPI_I2CRead() and NvAPI_I2CWrite() +typedef struct +{ + NvU32 version; //!< The structure version. + NvU32 displayMask; //!< The Display Mask of the concerned display. + NvU8 bIsDDCPort; //!< This flag indicates either the DDC port (TRUE) or the communication port + //!< (FALSE) of the concerned display. + NvU8 i2cDevAddress; //!< The address of the I2C slave. The address should be shifted left by one. For + //!< example, the I2C address 0x50, often used for reading EDIDs, would be stored + //!< here as 0xA0. This matches the position within the byte sent by the master, as + //!< the last bit is reserved to specify the read or write direction. + NvU8* pbI2cRegAddress; //!< The I2C target register address. May be NULL, which indicates no register + //!< address should be sent. + NvU32 regAddrSize; //!< The size in bytes of target register address. If pbI2cRegAddress is NULL, this + //!< field must be 0. + NvU8* pbData; //!< The buffer of data which is to be read or written (depending on the command). + NvU32 cbSize; //!< The size of the data buffer, pbData, to be read or written. + NvU32 i2cSpeed; //!< The target speed of the transaction (between 28Kbps to 40Kbps; not guaranteed). +} NV_I2C_INFO_V1; + +//! Used in NvAPI_I2CRead() and NvAPI_I2CWrite() +typedef struct +{ + NvU32 version; //!< The structure version. + NvU32 displayMask; //!< The Display Mask of the concerned display. + NvU8 bIsDDCPort; //!< This flag indicates either the DDC port (TRUE) or the communication port + //!< (FALSE) of the concerned display. + NvU8 i2cDevAddress; //!< The address of the I2C slave. The address should be shifted left by one. For + //!< example, the I2C address 0x50, often used for reading EDIDs, would be stored + //!< here as 0xA0. This matches the position within the byte sent by the master, as + //!< the last bit is reserved to specify the read or write direction. + NvU8* pbI2cRegAddress; //!< The I2C target register address. May be NULL, which indicates no register + //!< address should be sent. + NvU32 regAddrSize; //!< The size in bytes of target register address. If pbI2cRegAddress is NULL, this + //!< field must be 0. + NvU8* pbData; //!< The buffer of data which is to be read or written (depending on the command). + NvU32 cbSize; //!< The size of the data buffer, pbData, to be read or written. + NvU32 i2cSpeed; //!< Deprecated, Must be set to NVAPI_I2C_SPEED_DEPRECATED. + NV_I2C_SPEED i2cSpeedKhz; //!< The target speed of the transaction in (kHz) (Chosen from the enum NV_I2C_SPEED). +} NV_I2C_INFO_V2; + +//! Used in NvAPI_I2CRead() and NvAPI_I2CWrite() +typedef struct +{ + NvU32 version; //!< The structure version. + NvU32 displayMask; //!< The Display Mask of the concerned display. + NvU8 bIsDDCPort; //!< This flag indicates either the DDC port (TRUE) or the communication port + //!< (FALSE) of the concerned display. + NvU8 i2cDevAddress; //!< The address of the I2C slave. The address should be shifted left by one. For + //!< example, the I2C address 0x50, often used for reading EDIDs, would be stored + //!< here as 0xA0. This matches the position within the byte sent by the master, as + //!< the last bit is reserved to specify the read or write direction. + NvU8* pbI2cRegAddress; //!< The I2C target register address. May be NULL, which indicates no register + //!< address should be sent. + NvU32 regAddrSize; //!< The size in bytes of target register address. If pbI2cRegAddress is NULL, this + //!< field must be 0. + NvU8* pbData; //!< The buffer of data which is to be read or written (depending on the command). + NvU32 cbSize; //!< The size of the data buffer, pbData, to be read or written. + NvU32 i2cSpeed; //!< Deprecated, Must be set to NVAPI_I2C_SPEED_DEPRECATED. + NV_I2C_SPEED i2cSpeedKhz; //!< The target speed of the transaction in (kHz) (Chosen from the enum NV_I2C_SPEED). + NvU8 portId; //!< The portid on which device is connected (remember to set bIsPortIdSet if this value is set) + //!< Optional for pre-Kepler + NvU32 bIsPortIdSet; //!< set this flag on if and only if portid value is set +} NV_I2C_INFO_V3; + +typedef NV_I2C_INFO_V3 NV_I2C_INFO; + +#define NV_I2C_INFO_VER3 MAKE_NVAPI_VERSION(NV_I2C_INFO_V3,3) +#define NV_I2C_INFO_VER2 MAKE_NVAPI_VERSION(NV_I2C_INFO_V2,2) +#define NV_I2C_INFO_VER1 MAKE_NVAPI_VERSION(NV_I2C_INFO_V1,1) + +#define NV_I2C_INFO_VER NV_I2C_INFO_VER3 +//! @} + +/***********************************************************************************/ + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_I2CRead +// +//! This function reads the data buffer from the I2C port. +//! The I2C request must be for a DDC port: pI2cInfo->bIsDDCPort = 1. +//! +//! A data buffer size larger than 16 bytes may be rejected if a register address is specified. In such a case, +//! NVAPI_ARGUMENT_EXCEED_MAX_SIZE would be returned. +//! +//! If a register address is specified (i.e. regAddrSize is positive), then the transaction will be performed in +//! the combined format described in the I2C specification. The register address will be written, followed by +//! reading into the data buffer. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 85 +//! +//! \param [in] hPhysicalGPU GPU selection. +//! \param [out] NV_I2C_INFO *pI2cInfo The I2C data input structure +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred. +//! \retval NVAPI_HANDLE_INVALIDATED Handle passed has been invalidated (see user guide). +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE Handle passed is not a physical GPU handle. +//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION Structure version is not supported. +//! \retval NVAPI_INVALID_ARGUMENT - argument does not meet specified requirements +//! \retval NVAPI_ARGUMENT_EXCEED_MAX_SIZE - an argument exceeds the maximum +//! +//! \ingroup i2capi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_I2CRead(NvPhysicalGpuHandle hPhysicalGpu, NV_I2C_INFO *pI2cInfo); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_I2CWrite +// +//! This function writes the data buffer to the I2C port. +//! +//! The I2C request must be for a DDC port: pI2cInfo->bIsDDCPort = 1. +//! +//! A data buffer size larger than 16 bytes may be rejected if a register address is specified. In such a case, +//! NVAPI_ARGUMENT_EXCEED_MAX_SIZE would be returned. +//! +//! If a register address is specified (i.e. regAddrSize is positive), then the register address will be written +//! and the data buffer will immediately follow without a restart. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 85 +//! +//! \param [in] hPhysicalGPU GPU selection. +//! \param [in] pI2cInfo The I2C data input structure +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred. +//! \retval NVAPI_HANDLE_INVALIDATED Handle passed has been invalidated (see user guide). +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE Handle passed is not a physical GPU handle. +//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION Structure version is not supported. +//! \retval NVAPI_INVALID_ARGUMENT Argument does not meet specified requirements +//! \retval NVAPI_ARGUMENT_EXCEED_MAX_SIZE Argument exceeds the maximum +//! +//! \ingroup i2capi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_I2CWrite(NvPhysicalGpuHandle hPhysicalGpu, NV_I2C_INFO *pI2cInfo); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_WorkstationFeatureSetup +// +//! \fn NvAPI_GPU_WorkstationFeatureSetup(NvPhysicalGpuHandle hPhysicalGpu, NvU32 featureEnableMask, NvU32 featureDisableMask) +//! DESCRIPTION: This API configures the driver for a set of workstation features. +//! The driver can allocate the memory resources accordingly. +//! +//! SUPPORTED OS: Windows 7 +//! +//! +//! \param [in] hPhysicalGpu Physical GPU Handle of the display adapter to be configured. GPU handles may be retrieved +//! using NvAPI_EnumPhysicalGPUs. A value of NULL is permitted and applies the same operation +//! to all GPU handles enumerated by NvAPI_EnumPhysicalGPUs. +//! \param [in] featureEnableMask Mask of features the caller requests to enable for use +//! \param [in] featureDisableMask Mask of features the caller requests to disable +//! +//! As a general rule, features in the enable and disable masks are expected to be disjoint, although the disable +//! mask has precedence and a feature flagged in both masks will be disabled. +//! +//! \retval ::NVAPI_OK configuration request succeeded +//! \retval ::NVAPI_ERROR configuration request failed +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu is not a physical GPU handle. +//! \retval ::NVAPI_GPU_WORKSTATION_FEATURE_INCOMPLETE requested feature set does not have all resources allocated for completeness. +//! \retval ::NVAPI_NO_IMPLEMENTATION only implemented for Win7 +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup gpu +typedef enum +{ + NVAPI_GPU_WORKSTATION_FEATURE_MASK_SWAPGROUP = 0x00000001, + NVAPI_GPU_WORKSTATION_FEATURE_MASK_STEREO = 0x00000010, + NVAPI_GPU_WORKSTATION_FEATURE_MASK_WARPING = 0x00000100, + NVAPI_GPU_WORKSTATION_FEATURE_MASK_PIXINTENSITY = 0x00000200, + NVAPI_GPU_WORKSTATION_FEATURE_MASK_GRAYSCALE = 0x00000400, + NVAPI_GPU_WORKSTATION_FEATURE_MASK_BPC10 = 0x00001000 +} NVAPI_GPU_WORKSTATION_FEATURE_MASK; + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_WorkstationFeatureSetup(__in NvPhysicalGpuHandle hPhysicalGpu, __in NvU32 featureEnableMask, __in NvU32 featureDisableMask); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_WorkstationFeatureQuery +// +//! DESCRIPTION: This API queries the current set of workstation features. +//! +//! SUPPORTED OS: Windows 7 +//! +//! +//! \param [in] hPhysicalGpu Physical GPU Handle of the display adapter to be configured. GPU handles may be retrieved +//! using NvAPI_EnumPhysicalGPUs. +//! \param [out] pConfiguredFeatureMask Mask of features requested for use by client drivers +//! \param [out] pConsistentFeatureMask Mask of features that have all resources allocated for completeness. +//! +//! \retval ::NVAPI_OK configuration request succeeded +//! \retval ::NVAPI_ERROR configuration request failed +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu is not a physical GPU handle. +//! \retval ::NVAPI_NO_IMPLEMENTATION only implemented for Win7 +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_WorkstationFeatureQuery(__in NvPhysicalGpuHandle hPhysicalGpu, __out_opt NvU32 *pConfiguredFeatureMask, __out_opt NvU32 *pConsistentFeatureMask); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetHDCPSupportStatus +// +//! \fn NvAPI_GPU_GetHDCPSupportStatus(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_GET_HDCP_SUPPORT_STATUS *pGetHDCPSupportStatus) +//! DESCRIPTION: This function returns a GPU's HDCP support status. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 175 +//! +//! \retval ::NVAPI_OK +//! \retval ::NVAPI_ERROR +//! \retval ::NVAPI_INVALID_ARGUMENT +//! \retval ::NVAPI_HANDLE_INVALIDATED +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION +// +//////////////////////////////////////////////////////////////////////////////// + + +//! \addtogroup gpu +//! @{ + + +//! HDCP fuse states - used in NV_GPU_GET_HDCP_SUPPORT_STATUS +typedef enum _NV_GPU_HDCP_FUSE_STATE +{ + NV_GPU_HDCP_FUSE_STATE_UNKNOWN = 0, + NV_GPU_HDCP_FUSE_STATE_DISABLED = 1, + NV_GPU_HDCP_FUSE_STATE_ENABLED = 2, +} NV_GPU_HDCP_FUSE_STATE; + + +//! HDCP key sources - used in NV_GPU_GET_HDCP_SUPPORT_STATUS +typedef enum _NV_GPU_HDCP_KEY_SOURCE +{ + NV_GPU_HDCP_KEY_SOURCE_UNKNOWN = 0, + NV_GPU_HDCP_KEY_SOURCE_NONE = 1, + NV_GPU_HDCP_KEY_SOURCE_CRYPTO_ROM = 2, + NV_GPU_HDCP_KEY_SOURCE_SBIOS = 3, + NV_GPU_HDCP_KEY_SOURCE_I2C_ROM = 4, + NV_GPU_HDCP_KEY_SOURCE_FUSES = 5, +} NV_GPU_HDCP_KEY_SOURCE; + + +//! HDCP key source states - used in NV_GPU_GET_HDCP_SUPPORT_STATUS +typedef enum _NV_GPU_HDCP_KEY_SOURCE_STATE +{ + NV_GPU_HDCP_KEY_SOURCE_STATE_UNKNOWN = 0, + NV_GPU_HDCP_KEY_SOURCE_STATE_ABSENT = 1, + NV_GPU_HDCP_KEY_SOURCE_STATE_PRESENT = 2, +} NV_GPU_HDCP_KEY_SOURCE_STATE; + + +//! HDPC support status - used in NvAPI_GPU_GetHDCPSupportStatus() +typedef struct +{ + NvU32 version; //! Structure version constucted by macro #NV_GPU_GET_HDCP_SUPPORT_STATUS + NV_GPU_HDCP_FUSE_STATE hdcpFuseState; //! GPU's HDCP fuse state + NV_GPU_HDCP_KEY_SOURCE hdcpKeySource; //! GPU's HDCP key source + NV_GPU_HDCP_KEY_SOURCE_STATE hdcpKeySourceState; //! GPU's HDCP key source state +} NV_GPU_GET_HDCP_SUPPORT_STATUS; + + +//! Macro for constructing the version for structure NV_GPU_GET_HDCP_SUPPORT_STATUS +#define NV_GPU_GET_HDCP_SUPPORT_STATUS_VER MAKE_NVAPI_VERSION(NV_GPU_GET_HDCP_SUPPORT_STATUS,1) + + +//! @} + + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_GetHDCPSupportStatus(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_GET_HDCP_SUPPORT_STATUS *pGetHDCPSupportStatus); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetTachReading +// +//! DESCRIPTION: This API retrieves the fan speed tachometer reading for the specified physical GPU. +//! +//! HOW TO USE: +//! - NvU32 Value = 0; +//! - ret = NvAPI_GPU_GetTachReading(hPhysicalGpu, &Value); +//! - On call success: +//! - Value contains the tachometer reading +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \param [in] hPhysicalGpu GPU selection. +//! \param [out] pValue Pointer to a variable to get the tachometer reading +//! +//! \retval ::NVAPI_OK - completed request +//! \retval ::NVAPI_ERROR - miscellaneous error occurred +//! \retval ::NVAPI_NOT_SUPPORTED - functionality not supported +//! \retval ::NVAPI_API_NOT_INTIALIZED - nvapi not initialized +//! \retval ::NVAPI_INVALID_ARGUMENT - invalid argument passed +//! \retval ::NVAPI_HANDLE_INVALIDATED - handle passed has been invalidated (see user guide) +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE - handle passed is not a physical GPU handle +//! +//! \ingroup gpucooler +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetTachReading(NvPhysicalGpuHandle hPhysicalGPU, NvU32 *pValue); + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetECCStatusInfo +// +//! \fn NvAPI_GPU_GetECCStatusInfo(NvPhysicalGpuHandle hPhysicalGpu, +//! NV_GPU_ECC_STATUS_INFO *pECCStatusInfo); +//! DESCRIPTION: This function returns ECC memory status information. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \param [in] hPhysicalGpu A handle identifying the physical GPU for which ECC +//! status information is to be retrieved. +//! \param [out] pECCStatusInfo A pointer to an ECC status structure. +//! +//! \retval ::NVAPI_OK The request was completed successfully. +//! \retval ::NVAPI_ERROR An unknown error occurred. +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE The provided GPU handle is not a physical GPU handle. +//! \retval ::NVAPI_INVALID_HANDLE The provided GPU handle is invalid. +//! \retval ::NVAPI_HANDLE_INVALIDATED The provided GPU handle is no longer valid. +//! \retval ::NVAPI_INVALID_POINTER An invalid argument pointer was provided. +//! \retval ::NVAPI_NOT_SUPPORTED The request is not supported. +//! \retval ::NVAPI_API_NOT_INTIALIZED NvAPI was not yet initialized. +// +/////////////////////////////////////////////////////////////////////////////// + +//! \addtogroup gpuecc +//! Used in NV_GPU_ECC_STATUS_INFO. +typedef enum _NV_ECC_CONFIGURATION +{ + NV_ECC_CONFIGURATION_NOT_SUPPORTED = 0, + NV_ECC_CONFIGURATION_DEFERRED, //!< Changes require a POST to take effect + NV_ECC_CONFIGURATION_IMMEDIATE, //!< Changes can optionally be made to take effect immediately +} NV_ECC_CONFIGURATION; + +//! \ingroup gpuecc +//! Used in NvAPI_GPU_GetECCStatusInfo(). +typedef struct +{ + NvU32 version; //!< Structure version + NvU32 isSupported : 1; //!< ECC memory feature support + NV_ECC_CONFIGURATION configurationOptions; //!< Supported ECC memory feature configuration options + NvU32 isEnabled : 1; //!< Active ECC memory setting +} NV_GPU_ECC_STATUS_INFO; + +//! \ingroup gpuecc +//! Macro for constructing the version field of NV_GPU_ECC_STATUS_INFO +#define NV_GPU_ECC_STATUS_INFO_VER MAKE_NVAPI_VERSION(NV_GPU_ECC_STATUS_INFO,1) + +//! \ingroup gpuecc +NVAPI_INTERFACE NvAPI_GPU_GetECCStatusInfo(NvPhysicalGpuHandle hPhysicalGpu, + NV_GPU_ECC_STATUS_INFO *pECCStatusInfo); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetECCErrorInfo +// +//! \fn NvAPI_GPU_GetECCErrorInfo(NvPhysicalGpuHandle hPhysicalGpu, +//! NV_GPU_ECC_ERROR_INFO *pECCErrorInfo); +//! +//! DESCRIPTION: This function returns ECC memory error information. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \param [in] hPhysicalGpu A handle identifying the physical GPU for +//! which ECC error information is to be +//! retrieved. +//! \param [out] pECCErrorInfo A pointer to an ECC error structure. +//! +//! \retval ::NVAPI_OK The request was completed successfully. +//! \retval ::NVAPI_ERROR An unknown error occurred. +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE The provided GPU handle is not a physical GPU handle. +//! \retval ::NVAPI_INVALID_ARGUMENT incorrect param value +//! \retval ::NVAPI_INVALID_POINTER An invalid argument pointer was provided. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION structure version is not supported, initialize to NV_GPU_ECC_ERROR_INFO_VER. +//! \retval ::NVAPI_HANDLE_INVALIDATED The provided GPU handle is no longer valid. +//! \retval ::NVAPI_NOT_SUPPORTED The request is not supported. +//! \retval ::NVAPI_API_NOT_INTIALIZED NvAPI was not yet initialized. +// +/////////////////////////////////////////////////////////////////////////////// + + +//! \ingroup gpuecc +//! Used in NvAPI_GPU_GetECCErrorInfo()/ +typedef struct +{ + NvU32 version; //!< Structure version + struct { + NvU64 singleBitErrors; //!< Number of single-bit ECC errors detected since last boot + NvU64 doubleBitErrors; //!< Number of double-bit ECC errors detected since last boot + } current; + struct { + NvU64 singleBitErrors; //!< Number of single-bit ECC errors detected since last counter reset + NvU64 doubleBitErrors; //!< Number of double-bit ECC errors detected since last counter reset + } aggregate; +} NV_GPU_ECC_ERROR_INFO; + +//! \ingroup gpuecc +//! Macro for constructing the version field of NV_GPU_ECC_ERROR_INFO +#define NV_GPU_ECC_ERROR_INFO_VER MAKE_NVAPI_VERSION(NV_GPU_ECC_ERROR_INFO,1) + +//! \ingroup gpuecc +NVAPI_INTERFACE NvAPI_GPU_GetECCErrorInfo(NvPhysicalGpuHandle hPhysicalGpu, + NV_GPU_ECC_ERROR_INFO *pECCErrorInfo); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_ResetECCErrorInfo +// +//! DESCRIPTION: This function resets ECC memory error counters. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \param [in] hPhysicalGpu A handle identifying the physical GPU for +//! which ECC error information is to be +//! cleared. +//! \param [in] bResetCurrent Reset the current ECC error counters. +//! \param [in] bResetAggregate Reset the aggregate ECC error counters. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE - The caller does not have administrative privileges +//! +//! \ingroup gpuecc +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_ResetECCErrorInfo(NvPhysicalGpuHandle hPhysicalGpu, NvU8 bResetCurrent, + NvU8 bResetAggregate); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetECCConfigurationInfo +// +//! \fn NvAPI_GPU_GetECCConfigurationInfo(NvPhysicalGpuHandle hPhysicalGpu, +//! NV_GPU_ECC_CONFIGURATION_INFO *pECCConfigurationInfo); +//! DESCRIPTION: This function returns ECC memory configuration information. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \param [in] hPhysicalGpu A handle identifying the physical GPU for +//! which ECC configuration information +//! is to be retrieved. +//! \param [out] pECCConfigurationInfo A pointer to an ECC +//! configuration structure. +//! +//! \retval ::NVAPI_OK The request was completed successfully. +//! \retval ::NVAPI_ERROR An unknown error occurred. +//! \retval ::NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE The provided GPU handle is not a physical GPU handle. +//! \retval ::NVAPI_INVALID_HANDLE The provided GPU handle is invalid. +//! \retval ::NVAPI_HANDLE_INVALIDATED The provided GPU handle is no longer valid. +//! \retval ::NVAPI_INVALID_POINTER An invalid argument pointer was provided. +//! \retval ::NVAPI_NOT_SUPPORTED The request is not supported. +//! \retval ::NVAPI_API_NOT_INTIALIZED NvAPI was not yet initialized. +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup gpuecc +//! Used in NvAPI_GPU_GetECCConfigurationInfo(). +typedef struct +{ + NvU32 version; //! Structure version + NvU32 isEnabled : 1; //! Current ECC configuration stored in non-volatile memory + NvU32 isEnabledByDefault : 1; //! Factory default ECC configuration (static) +} NV_GPU_ECC_CONFIGURATION_INFO; + +//! \ingroup gpuecc +//! Macro for consstructing the verion field of NV_GPU_ECC_CONFIGURATION_INFO +#define NV_GPU_ECC_CONFIGURATION_INFO_VER MAKE_NVAPI_VERSION(NV_GPU_ECC_CONFIGURATION_INFO,1) + +//! \ingroup gpuecc +NVAPI_INTERFACE NvAPI_GPU_GetECCConfigurationInfo(NvPhysicalGpuHandle hPhysicalGpu, + NV_GPU_ECC_CONFIGURATION_INFO *pECCConfigurationInfo); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_SetECCConfiguration +// +//! DESCRIPTION: This function updates the ECC memory configuration setting. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \param [in] hPhysicalGpu A handle identifying the physical GPU for +//! which to update the ECC configuration +//! setting. +//! \param [in] bEnable The new ECC configuration setting. +//! \param [in] bEnableImmediately Request that the new setting take effect immediately. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_INVALID_CONFIGURATION - Possibly SLI is enabled. Disable SLI and retry. +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE - The caller does not have administrative privileges +//! +//! \ingroup gpuecc +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_SetECCConfiguration(NvPhysicalGpuHandle hPhysicalGpu, NvU8 bEnable, + NvU8 bEnableImmediately); + + + +//! \ingroup gpu +typedef struct +{ + NvU32 version; //!< version of this structure + NvU32 width; //!< width of the input texture + NvU32 height; //!< height of the input texture + float* blendingTexture; //!< array of floating values building an intensity RGB texture +} NV_SCANOUT_INTENSITY_DATA_V1; + +//! \ingroup gpu +typedef struct +{ + NvU32 version; //!< version of this structure + NvU32 width; //!< width of the input texture + NvU32 height; //!< height of the input texture + float* blendingTexture; //!< array of floating values building an intensity RGB texture + float* offsetTexture; //!< array of floating values building an offset texture + NvU32 offsetTexChannels; //!< number of channels per pixel in the offset texture +} NV_SCANOUT_INTENSITY_DATA_V2; + +typedef NV_SCANOUT_INTENSITY_DATA_V2 NV_SCANOUT_INTENSITY_DATA; + +//! \ingroup gpu +#define NV_SCANOUT_INTENSITY_DATA_VER1 MAKE_NVAPI_VERSION(NV_SCANOUT_INTENSITY_DATA_V1, 1) +#define NV_SCANOUT_INTENSITY_DATA_VER2 MAKE_NVAPI_VERSION(NV_SCANOUT_INTENSITY_DATA_V2, 2) +#define NV_SCANOUT_INTENSITY_DATA_VER NV_SCANOUT_INTENSITY_DATA_VER2 + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GPU_SetScanoutIntensity +// +//! DESCRIPTION: This API enables and sets up per-pixel intensity feature on the specified display. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] displayId combined physical display and GPU identifier of the display to apply the intensity control. +//! \param [in] scanoutIntensityData the intensity texture info. +//! \param [out] pbSticky(OUT) indicates whether the settings will be kept over a reboot. +//! +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input parameters. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI not initialized. +//! \retval ::NVAPI_NOT_SUPPORTED Interface not supported by the driver used, or only supported on selected GPUs +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input data. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION NV_SCANOUT_INTENSITY_DATA structure version mismatch. +//! \retval ::NVAPI_OK Feature enabled. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_SetScanoutIntensity(NvU32 displayId, NV_SCANOUT_INTENSITY_DATA* scanoutIntensityData, int *pbSticky); + + +//! \ingroup gpu +typedef struct _NV_SCANOUT_INTENSITY_STATE_DATA +{ + NvU32 version; //!< version of this structure + NvU32 bEnabled; //!< intensity is enabled or not +} NV_SCANOUT_INTENSITY_STATE_DATA; + +//! \ingroup gpu +#define NV_SCANOUT_INTENSITY_STATE_VER MAKE_NVAPI_VERSION(NV_SCANOUT_INTENSITY_STATE_DATA, 1) + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GPU_GetScanoutIntensityState +// +//! DESCRIPTION: This API queries current state of the intensity feature on the specified display. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] displayId combined physical display and GPU identifier of the display to query the configuration. +//! \param [in,out] scanoutIntensityStateData intensity state data. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input parameters. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI not initialized. +//! \retval ::NVAPI_NOT_SUPPORTED Interface not supported by the driver used, or only supported on selected GPUs. +//! \retval ::NVAPI_OK Feature enabled. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetScanoutIntensityState(__in NvU32 displayId, __inout NV_SCANOUT_INTENSITY_STATE_DATA* scanoutIntensityStateData); + + +//! \ingroup gpu +typedef enum +{ + NV_GPU_WARPING_VERTICE_FORMAT_TRIANGLESTRIP_XYUVRQ = 0, + NV_GPU_WARPING_VERTICE_FORMAT_TRIANGLES_XYUVRQ = 1, +} NV_GPU_WARPING_VERTICE_FORMAT; + +//! \ingroup gpu +typedef struct +{ + NvU32 version; //!< version of this structure + float* vertices; //!< width of the input texture + NV_GPU_WARPING_VERTICE_FORMAT vertexFormat; //!< format of the input vertices + int numVertices; //!< number of the input vertices + NvSBox* textureRect; //!< rectangle in desktop coordinates describing the source area for the warping +} NV_SCANOUT_WARPING_DATA; + +//! \ingroup gpu +#define NV_SCANOUT_WARPING_VER MAKE_NVAPI_VERSION(NV_SCANOUT_WARPING_DATA, 1) + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GPU_SetScanoutWarping +// +//! DESCRIPTION: This API enables and sets up the warping feature on the specified display. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] displayId Combined physical display and GPU identifier of the display to apply the intensity control +//! \param [in] scanoutWarpingData The warping data info +//! \param [out] pbSticky Indicates whether the settings will be kept over a reboot. +//! +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input parameters. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI not initialized. +//! \retval ::NVAPI_NOT_SUPPORTED Interface not supported by the driver used, or only supported on selected GPUs +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input data. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION NV_SCANOUT_WARPING_DATA structure version mismatch. +//! \retval ::NVAPI_OK Feature enabled. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// + +NVAPI_INTERFACE NvAPI_GPU_SetScanoutWarping(NvU32 displayId, NV_SCANOUT_WARPING_DATA* scanoutWarpingData, int* piMaxNumVertices, int* pbSticky); + + +//! \ingroup gpu +typedef struct _NV_SCANOUT_WARPING_STATE_DATA +{ + NvU32 version; //!< version of this structure + NvU32 bEnabled; //!< warping is enabled or not +} NV_SCANOUT_WARPING_STATE_DATA; + +//! \ingroup gpu +#define NV_SCANOUT_WARPING_STATE_VER MAKE_NVAPI_VERSION(NV_SCANOUT_WARPING_STATE_DATA, 1) + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GPU_GetScanoutWarpingState +// +//! DESCRIPTION: This API queries current state of the warping feature on the specified display. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] displayId combined physical display and GPU identifier of the display to query the configuration. +//! \param [in,out] scanoutWarpingStateData warping state data. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input parameters. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI not initialized. +//! \retval ::NVAPI_NOT_SUPPORTED Interface not supported by the driver used, or only supported on selected GPUs. +//! \retval ::NVAPI_OK Feature enabled. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetScanoutWarpingState(__in NvU32 displayId, __inout NV_SCANOUT_WARPING_STATE_DATA* scanoutWarpingStateData); + +typedef enum +{ + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_WARPING_RESAMPLING_METHOD = 0 +} NV_GPU_SCANOUT_COMPOSITION_PARAMETER; + +//! This enum defines a collection of possible scanout composition values that can be used to configure +//! possible scanout composition settings. (Currently the only parameter defined is the WARPING_RESAMPLING_METHOD). +typedef enum +{ + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_SET_TO_DEFAULT = 0, // Set parameter to default value. + // WARPING_RESAMPLING_METHOD section: + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE_WARPING_RESAMPLING_METHOD_BILINEAR = 0x100, + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE_WARPING_RESAMPLING_METHOD_BICUBIC_TRIANGULAR = 0x101, + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE_WARPING_RESAMPLING_METHOD_BICUBIC_BELL_SHAPED = 0x102, + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE_WARPING_RESAMPLING_METHOD_BICUBIC_BSPLINE = 0x103, + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE_WARPING_RESAMPLING_METHOD_BICUBIC_ADAPTIVE_TRIANGULAR = 0x104, + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE_WARPING_RESAMPLING_METHOD_BICUBIC_ADAPTIVE_BELL_SHAPED = 0x105, + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE_WARPING_RESAMPLING_METHOD_BICUBIC_ADAPTIVE_BSPLINE = 0x106 +} NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE; + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GPU_SetScanoutCompositionParameter +// +//! DESCRIPTION: This API sets various parameters that configure the scanout composition feature on the specified display. +//! (currently there is only one configurable parameter defined: WARPING_RESAMPLING_METHOD, +//! but this function is designed to support the addition of parameters as needed.) +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] displayId Combined physical display and GPU identifier of the display to apply the intensity control +//! \param [in] parameter The scanout composition parameter to be set +//! \param [in] parameterValue The data to be set for the specified parameter +//! \param [in] pContainer Additional container for data associated with the specified parameter +//! +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input parameters. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI not initialized. +//! \retval ::NVAPI_NOT_SUPPORTED Interface not supported by the driver used, or only supported on selected GPUs +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input data. +//! \retval ::NVAPI_OK Feature enabled. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// + +NVAPI_INTERFACE NvAPI_GPU_SetScanoutCompositionParameter(NvU32 displayId, NV_GPU_SCANOUT_COMPOSITION_PARAMETER parameter, + NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE parameterValue, float *pContainer); + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GPU_GetScanoutCompositionParameter +// +//! DESCRIPTION: This API queries current state of one of the various scanout composition parameters on the specified display. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] displayId combined physical display and GPU identifier of the display to query the configuration. +//! \param [in] parameter scanout composition parameter to by queried. +//! \param [out] parameterData scanout composition parameter data. +//! \param [out] pContainer Additional container for returning data associated with the specified parameter +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input parameters. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI not initialized. +//! \retval ::NVAPI_NOT_SUPPORTED Interface not supported by the driver used, or only supported on selected GPUs. +//! \retval ::NVAPI_OK Feature enabled. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetScanoutCompositionParameter(__in NvU32 displayId, __in NV_GPU_SCANOUT_COMPOSITION_PARAMETER parameter, + __out NV_GPU_SCANOUT_COMPOSITION_PARAMETER_VALUE *parameterData, __out float *pContainer); + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GPU_GetScanoutConfiguration +// +//! DESCRIPTION: This API queries the desktop and scanout portion of the specified display. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] displayId combined physical display and GPU identifier of the display to query the configuration. +//! \param [in,out] desktopRect desktop area of the display in desktop coordinates. +//! \param [in,out] scanoutRect scanout area of the display relative to desktopRect. +//! +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid input parameters. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI not initialized. +//! \retval ::NVAPI_NOT_SUPPORTED Interface not supported by the driver used, or only supported on selected GPUs. +//! \retval ::NVAPI_OK Feature enabled. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetScanoutConfiguration(NvU32 displayId, NvSBox* desktopRect, NvSBox* scanoutRect); + + + +//! \ingroup gpu +//! Used in NvAPI_GPU_GetScanoutConfigurationEx(). +typedef struct _NV_SCANOUT_INFORMATION +{ + NvU32 version; //!< Structure version, needs to be initialized with NV_SCANOUT_INFORMATION_VER. + + NvSBox sourceDesktopRect; //!< Operating system display device rect in desktop coordinates displayId is scanning out from. + NvSBox sourceViewportRect; //!< Area inside the sourceDesktopRect which is scanned out to the display. + NvSBox targetViewportRect; //!< Area inside the rect described by targetDisplayWidth/Height sourceViewportRect is scanned out to. + NvU32 targetDisplayWidth; //!< Horizontal size of the active resolution scanned out to the display. + NvU32 targetDisplayHeight; //!< Vertical size of the active resolution scanned out to the display. + NvU32 cloneImportance; //!< If targets are cloned views of the sourceDesktopRect the cloned targets have an importance assigned (0:primary,1 secondary,...). + NV_ROTATE sourceToTargetRotation; //!< Rotation performed between the sourceViewportRect and the targetViewportRect. +} NV_SCANOUT_INFORMATION; + +#define NV_SCANOUT_INFORMATION_VER MAKE_NVAPI_VERSION(NV_SCANOUT_INFORMATION,1) + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GPU_GetScanoutConfigurationEx +// +//! DESCRIPTION: This API queries the desktop and scanout portion of the specified display. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! \since Release: 331 +//! +//! \param [in] displayId combined physical display and GPU identifier of the display to query the configuration. +//! \param [in,out] pScanoutInformation desktop area to displayId mapping information. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetScanoutConfigurationEx(__in NvU32 displayId, __inout NV_SCANOUT_INFORMATION *pScanoutInformation); + +//! Used in NvAPI_GPU_GetPerfDecreaseInfo. +//! Bit masks for knowing the exact reason for performance decrease +typedef enum _NVAPI_GPU_PERF_DECREASE +{ + NV_GPU_PERF_DECREASE_NONE = 0, //!< No Slowdown detected + NV_GPU_PERF_DECREASE_REASON_THERMAL_PROTECTION = 0x00000001, //!< Thermal slowdown/shutdown/POR thermal protection + NV_GPU_PERF_DECREASE_REASON_POWER_CONTROL = 0x00000002, //!< Power capping / pstate cap + NV_GPU_PERF_DECREASE_REASON_AC_BATT = 0x00000004, //!< AC->BATT event + NV_GPU_PERF_DECREASE_REASON_API_TRIGGERED = 0x00000008, //!< API triggered slowdown + NV_GPU_PERF_DECREASE_REASON_INSUFFICIENT_POWER = 0x00000010, //!< Power connector missing + NV_GPU_PERF_DECREASE_REASON_UNKNOWN = 0x80000000, //!< Unknown reason +} NVAPI_GPU_PERF_DECREASE; + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetPerfDecreaseInfo +// +//! DESCRIPTION: This function retrieves - in NvU32 variable - reasons for the current performance decrease. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! \param [in] hPhysicalGPU (IN) - GPU for which performance decrease is to be evaluated. +//! \param [out] pPerfDecrInfo (OUT) - Pointer to a NvU32 variable containing performance decrease info +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetPerfDecreaseInfo(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NvU32 *pPerfDecrInfo); + +//! \ingroup gpu +typedef enum _NV_GPU_ILLUMINATION_ATTRIB +{ + NV_GPU_IA_LOGO_BRIGHTNESS = 0, + NV_GPU_IA_SLI_BRIGHTNESS = 1, +} NV_GPU_ILLUMINATION_ATTRIB; + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_QueryIlluminationSupport +// +//! \fn NvAPI_GPU_QueryIlluminationSupport(__inout NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM *pIlluminationSupportInfo) +//! DESCRIPTION: This function reports if the specified illumination attribute is supported. +//! +//! \note Only a single GPU can manage an given attribute on a given HW element, +//! regardless of how many are attatched. I.E. only one GPU will be used to control +//! the brightness of the LED on an SLI bridge, regardless of how many are physicaly attached. +//! You should enumerate thru the GPUs with this call to determine which GPU is managing the attribute. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! \since Version: 300.05 +//! +//! \param [in] hPhysicalGpu Physical GPU handle +//! \param Attribute An enumeration value specifying the Illumination attribute to be querried +//! \param [out] pSupported A boolean indicating if the attribute is supported. +//! +//! \return See \ref nvapistatus for the list of possible return values. +// +////////////////////////////////////////////////////////////////////////////// + +//! \ingroup gpu +typedef struct _NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM_V1 { + + // IN + NvU32 version; //!< Version of this structure + NvPhysicalGpuHandle hPhysicalGpu; //!< The handle of the GPU that you are checking for the specified attribute. + //!< note that this is the GPU that is managing the attribute. + //!< Only a single GPU can manage an given attribute on a given HW element, + //!< regardless of how many are attatched. + //!< I.E. only one GPU will be used to control the brightness of the LED on an SLI bridge, + //!< regardless of how many are physicaly attached. + //!< You enumerate thru the GPUs with this call to determine which GPU is managing the attribute. + NV_GPU_ILLUMINATION_ATTRIB Attribute; //!< An enumeration value specifying the Illumination attribute to be querried. + //!< refer to enum \ref NV_GPU_ILLUMINATION_ATTRIB. + + // OUT + NvU32 bSupported; //!< A boolean indicating if the attribute is supported. + +} NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM_V1; + +//! \ingroup gpu +typedef NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM_V1 NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM; +//! \ingroup gpu +#define NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM_VER_1 MAKE_NVAPI_VERSION(NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM_V1,1) +//! \ingroup gpu +#define NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM_VER NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM_VER_1 + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_QueryIlluminationSupport(__inout NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM *pIlluminationSupportInfo); + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetIllumination +// +//! \fn NvAPI_GPU_GetIllumination(NV_GPU_GET_ILLUMINATION_PARM *pIlluminationInfo) +//! DESCRIPTION: This function reports value of the specified illumination attribute. +//! +//! \note Only a single GPU can manage an given attribute on a given HW element, +//! regardless of how many are attatched. I.E. only one GPU will be used to control +//! the brightness of the LED on an SLI bridge, regardless of how many are physicaly attached. +//! You should enumerate thru the GPUs with the \ref NvAPI_GPU_QueryIlluminationSupport call to +//! determine which GPU is managing the attribute. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! \since Version: 300.05 +//! +//! \param [in] hPhysicalGpu Physical GPU handle +//! \param Attribute An enumeration value specifying the Illumination attribute to be querried +//! \param [out] Value A DWORD containing the current value for the specified attribute. +//! This is specified as a percentage of the full range of the attribute +//! (0-100; 0 = off, 100 = full brightness) +//! +//! \return See \ref nvapistatus for the list of possible return values. Return values of special interest are: +//! NVAPI_INVALID_ARGUMENT The specified attibute is not known to the driver. +//! NVAPI_NOT_SUPPORTED: The specified attribute is not supported on the specified GPU +// +////////////////////////////////////////////////////////////////////////////// + +//! \ingroup gpu +typedef struct _NV_GPU_GET_ILLUMINATION_PARM_V1 { + + // IN + NvU32 version; //!< Version of this structure + NvPhysicalGpuHandle hPhysicalGpu; //!< The handle of the GPU that you are checking for the specified attribute. + //!< Note that this is the GPU that is managing the attribute. + //!< Only a single GPU can manage an given attribute on a given HW element, + //!< regardless of how many are attatched. + //!< I.E. only one GPU will be used to control the brightness of the LED on an SLI bridge, + //!< regardless of how many are physicaly attached. + //!< You enumerate thru the GPUs with this call to determine which GPU is managing the attribute. + NV_GPU_ILLUMINATION_ATTRIB Attribute; //!< An enumeration value specifying the Illumination attribute to be querried. + //!< refer to enum \ref NV_GPU_ILLUMINATION_ATTRIB. + + // OUT + NvU32 Value; //!< A DWORD that will contain the current value of the specified attribute. + //! This is specified as a percentage of the full range of the attribute + //! (0-100; 0 = off, 100 = full brightness) + +} NV_GPU_GET_ILLUMINATION_PARM_V1; + +//! \ingroup gpu +typedef NV_GPU_GET_ILLUMINATION_PARM_V1 NV_GPU_GET_ILLUMINATION_PARM; +//! \ingroup gpu +#define NV_GPU_GET_ILLUMINATION_PARM_VER_1 MAKE_NVAPI_VERSION(NV_GPU_GET_ILLUMINATION_PARM_V1,1) +//! \ingroup gpu +#define NV_GPU_GET_ILLUMINATION_PARM_VER NV_GPU_GET_ILLUMINATION_PARM_VER_1 + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_GetIllumination(NV_GPU_GET_ILLUMINATION_PARM *pIlluminationInfo); + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_SetIllumination +// +//! \fn NvAPI_GPU_SetIllumination(NV_GPU_SET_ILLUMINATION_PARM *pIlluminationInfo) +//! DESCRIPTION: This function sets the value of the specified illumination attribute. +//! +//! \note Only a single GPU can manage an given attribute on a given HW element, +//! regardless of how many are attatched. I.E. only one GPU will be used to control +//! the brightness of the LED on an SLI bridge, regardless of how many are physicaly attached. +//! You should enumerate thru the GPUs with the \ref NvAPI_GPU_QueryIlluminationSupport call to +//! determine which GPU is managing the attribute. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! \since Version: 300.05 +//! +//! \param [in] hPhysicalGpu Physical GPU handle +//! \param Attribute An enumeration value specifying the Illumination attribute to be set +//! \param Value The new value for the specified attribute. +//! This should be specified as a percentage of the full range of the attribute +//! (0-100; 0 = off, 100 = full brightness) +//! If a value is specified outside this range, NVAPI_INVALID_ARGUMENT will be returned. +//! +//! \return See \ref nvapistatus for the list of possible return values. Return values of special interest are: +//! NVAPI_INVALID_ARGUMENT The specified attibute is not known to the driver, or the specified value is out of range. +//! NVAPI_NOT_SUPPORTED The specified attribute is not supported on the specified GPU. +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup gpu +typedef struct _NV_GPU_SET_ILLUMINATION_PARM_V1 { + + // IN + NvU32 version; //!< Version of this structure + NvPhysicalGpuHandle hPhysicalGpu; //!< The handle of the GPU that you are checking for the specified attribute. + //!< Note that this is the GPU that is managing the attribute. + //!< Only a single GPU can manage an given attribute on a given HW element, + //!< regardless of how many are attatched. + //!< I.E. only one GPU will be used to control the brightness of the LED on an SLI bridge, + //!< regardless of how many are physicaly attached. + //!< You enumerate thru the GPUs with this call to determine which GPU is managing the attribute. + NV_GPU_ILLUMINATION_ATTRIB Attribute; //!< An enumeration value specifying the Illumination attribute to be querried. + //!< refer to enum \ref NV_GPU_ILLUMINATION_ATTRIB. + NvU32 Value; //!< A DWORD containing the new value for the specified attribute. + //!< This should be specified as a percentage of the full range of the attribute + //!< (0-100; 0 = off, 100 = full brightness) + //!< If a value is specified outside this range, NVAPI_INVALID_ARGUMENT will be returned. + + // OUT + +} NV_GPU_SET_ILLUMINATION_PARM_V1; + +//! \ingroup gpu +typedef NV_GPU_SET_ILLUMINATION_PARM_V1 NV_GPU_SET_ILLUMINATION_PARM; +//! \ingroup gpu +#define NV_GPU_SET_ILLUMINATION_PARM_VER_1 MAKE_NVAPI_VERSION(NV_GPU_SET_ILLUMINATION_PARM_V1,1) +//! \ingroup gpu +#define NV_GPU_SET_ILLUMINATION_PARM_VER NV_GPU_SET_ILLUMINATION_PARM_VER_1 + +//! \ingroup gpu +NVAPI_INTERFACE NvAPI_GPU_SetIllumination(NV_GPU_SET_ILLUMINATION_PARM *pIlluminationInfo); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_EnumNvidiaDisplayHandle +// +//! This function returns the handle of the NVIDIA display specified by the enum +//! index (thisEnum). The client should keep enumerating until it +//! returns NVAPI_END_ENUMERATION. +//! +//! Note: Display handles can get invalidated on a modeset, so the calling applications need to +//! renum the handles after every modeset. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \param [in] thisEnum The index of the NVIDIA display. +//! \param [out] pNvDispHandle Pointer to the NVIDIA display handle. +//! +//! \retval NVAPI_INVALID_ARGUMENT Either the handle pointer is NULL or enum index too big +//! \retval NVAPI_OK Return a valid NvDisplayHandle based on the enum index +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA device found in the system +//! \retval NVAPI_END_ENUMERATION No more display device to enumerate +//! \ingroup disphandle +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_EnumNvidiaDisplayHandle(NvU32 thisEnum, NvDisplayHandle *pNvDispHandle); + + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_EnumNvidiaUnAttachedDisplayHandle +// +//! This function returns the handle of the NVIDIA unattached display specified by the enum +//! index (thisEnum). The client should keep enumerating until it +//! returns error. +//! Note: Display handles can get invalidated on a modeset, so the calling applications need to +//! renum the handles after every modeset. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \param [in] thisEnum The index of the NVIDIA display. +//! \param [out] pNvUnAttachedDispHandle Pointer to the NVIDIA display handle of the unattached display. +//! +//! \retval NVAPI_INVALID_ARGUMENT Either the handle pointer is NULL or enum index too big +//! \retval NVAPI_OK Return a valid NvDisplayHandle based on the enum index +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA device found in the system +//! \retval NVAPI_END_ENUMERATION No more display device to enumerate. +//! \ingroup disphandle +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_EnumNvidiaUnAttachedDisplayHandle(NvU32 thisEnum, NvUnAttachedDisplayHandle *pNvUnAttachedDispHandle); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_CreateDisplayFromUnAttachedDisplay +// +//! This function converts the unattached display handle to an active attached display handle. +//! +//! At least one GPU must be present in the system and running an NVIDIA display driver. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT hNvUnAttachedDisp is not valid or pNvDisplay is NULL. +//! \retval NVAPI_OK One or more handles were returned +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_CreateDisplayFromUnAttachedDisplay(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvDisplayHandle *pNvDisplay); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetAssociatedNVidiaDisplayHandle +// +//! This function returns the handle of the NVIDIA display that is associated +//! with the given display "name" (such as "\\.\DISPLAY1"). +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT Either argument is NULL +//! \retval NVAPI_OK *pNvDispHandle is now valid +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA device maps to that display name +//! \ingroup disphandle +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetAssociatedNvidiaDisplayHandle(const char *szDisplayName, NvDisplayHandle *pNvDispHandle); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_GetAssociatedUnAttachedNvidiaDisplayHandle +// +//! DESCRIPTION: This function returns the handle of an unattached NVIDIA display that is +//! associated with the given display name (such as "\\DISPLAY1"). +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \retval ::NVAPI_INVALID_ARGUMENT Either argument is NULL. +//! \retval ::NVAPI_OK *pNvUnAttachedDispHandle is now valid. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA device maps to that display name. +//! +//! \ingroup disphandle +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetAssociatedUnAttachedNvidiaDisplayHandle(const char *szDisplayName, NvUnAttachedDisplayHandle *pNvUnAttachedDispHandle); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetAssociatedNVidiaDisplayName +// +//! For a given NVIDIA display handle, this function returns a string (such as "\\.\DISPLAY1") to identify the display. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT Either argument is NULL +//! \retval NVAPI_OK *pNvDispHandle is now valid +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA device maps to that display name +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetAssociatedNvidiaDisplayName(NvDisplayHandle NvDispHandle, NvAPI_ShortString szDisplayName); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetUnAttachedAssociatedDisplayName +// +//! This function returns the display name given, for example, "\\DISPLAY1", using the unattached NVIDIA display handle +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 95 +//! +//! \retval NVAPI_INVALID_ARGUMENT Either argument is NULL +//! \retval NVAPI_OK *pNvDispHandle is now valid +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA device maps to that display name +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetUnAttachedAssociatedDisplayName(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvAPI_ShortString szDisplayName); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_EnableHWCursor +// +//! This function enables hardware cursor support +//! +//! SUPPORTED OS: Windows XP +//! +//! +//! +//! \since Release: 80 +//! +//! \return NVAPI_ERROR or NVAPI_OK +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_EnableHWCursor(NvDisplayHandle hNvDisplay); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DisableHWCursor +// +//! This function disables hardware cursor support +//! +//! SUPPORTED OS: Windows XP +//! +//! +//! \since Release: 80 +//! +//! \return NVAPI_ERROR or NVAPI_OK +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DisableHWCursor(NvDisplayHandle hNvDisplay); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetVBlankCounter +// +//! This function gets the V-blank counter +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 80 +//! +//! \return NVAPI_ERROR or NVAPI_OK +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetVBlankCounter(NvDisplayHandle hNvDisplay, NvU32 *pCounter); + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_SetRefreshRateOverride +// +//! This function overrides the refresh rate on the given display/outputsMask. +//! The new refresh rate can be applied right away in this API call or deferred to be applied with the +//! next OS modeset. The override is good for only one modeset (regardless whether it's deferred or immediate). +//! +//! +//! SUPPORTED OS: Windows XP +//! +//! +//! \since Release: 80 +//! +//! \param [in] hNvDisplay The NVIDIA display handle. It can be NVAPI_DEFAULT_HANDLE or a handle +//! enumerated from NvAPI_EnumNVidiaDisplayHandle(). +//! \param [in] outputsMask A set of bits that identify all target outputs which are associated with the NVIDIA +//! display handle to apply the refresh rate override. When SLI is enabled, the +//! outputsMask only applies to the GPU that is driving the display output. +//! \param [in] refreshRate The override value. "0.0" means cancel the override. +//! \param [in] bSetDeferred +//! - "0": Apply the refresh rate override immediately in this API call.\p +//! - "1": Apply refresh rate at the next OS modeset. +//! +//! \retval NVAPI_INVALID_ARGUMENT hNvDisplay or outputsMask is invalid +//! \retval NVAPI_OK The refresh rate override is correct set +//! \retval NVAPI_ERROR The operation failed +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_SetRefreshRateOverride(NvDisplayHandle hNvDisplay, NvU32 outputsMask, float refreshRate, NvU32 bSetDeferred); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetAssociatedDisplayOutputId +// +//! This function gets the active outputId associated with the display handle. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 90 +//! +//! \param [in] hNvDisplay NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle(). +//! \param [out] outputId The active display output ID associated with the selected display handle hNvDisplay. +//! The outputid will have only one bit set. In the case of Clone or Span mode, this will indicate the +//! display outputId of the primary display that the GPU is driving. See \ref handles. +//! +//! \retval NVAPI_OK Call successful. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_EXPECTED_DISPLAY_HANDLE hNvDisplay is not a valid display handle. +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetAssociatedDisplayOutputId(NvDisplayHandle hNvDisplay, NvU32 *pOutputId); + + +//! \ingroup dispcontrol +//! Used in NvAPI_GetDisplayPortInfo(). +typedef struct _NV_DISPLAY_PORT_INFO_V1 +{ + NvU32 version; //!< Structure version + NvU32 dpcd_ver; //!< DPCD version of the monitor + NV_DP_LINK_RATE maxLinkRate; //!< Maximum supported link rate + NV_DP_LANE_COUNT maxLaneCount; //!< Maximum supported lane count + NV_DP_LINK_RATE curLinkRate; //!< Current link rate + NV_DP_LANE_COUNT curLaneCount; //!< Current lane count + NV_DP_COLOR_FORMAT colorFormat; //!< Current color format + NV_DP_DYNAMIC_RANGE dynamicRange; //!< Dynamic range + NV_DP_COLORIMETRY colorimetry; //!< Ignored in RGB space + NV_DP_BPC bpc; //!< Current bit-per-component + NvU32 isDp : 1; //!< If the monitor is driven by a DisplayPort + NvU32 isInternalDp : 1; //!< If the monitor is driven by an NV Dp transmitter + NvU32 isColorCtrlSupported : 1; //!< If the color format change is supported + NvU32 is6BPCSupported : 1; //!< If 6 bpc is supported + NvU32 is8BPCSupported : 1; //!< If 8 bpc is supported + NvU32 is10BPCSupported : 1; //!< If 10 bpc is supported + NvU32 is12BPCSupported : 1; //!< If 12 bpc is supported + NvU32 is16BPCSupported : 1; //!< If 16 bpc is supported + NvU32 isYCrCb422Supported : 1; //!< If YCrCb422 is supported + NvU32 isYCrCb444Supported : 1; //!< If YCrCb444 is supported + NvU32 isRgb444SupportedOnCurrentMode : 1; //!< If Rgb444 is supported on the current mode + NvU32 isYCbCr444SupportedOnCurrentMode : 1; //!< If YCbCr444 is supported on the current mode + NvU32 isYCbCr422SupportedOnCurrentMode : 1; //!< If YCbCr422 is support on the current mode + NvU32 is6BPCSupportedOnCurrentMode : 1; // if 6 bpc is supported On Current Mode + NvU32 is8BPCSupportedOnCurrentMode : 1; // if 8 bpc is supported On Current Mode + NvU32 is10BPCSupportedOnCurrentMode : 1; // if 10 bpc is supported On Current Mode + NvU32 is12BPCSupportedOnCurrentMode : 1; // if 12 bpc is supported On Current Mode + NvU32 is16BPCSupportedOnCurrentMode : 1; // if 16 bpc is supported On Current Mode + NvU32 isMonxvYCC601Capable : 1; // if xvYCC 601 extended colorimetry is supported + NvU32 isMonxvYCC709Capable : 1; // if xvYCC 709 extended colorimetry is supported + NvU32 isMonsYCC601Capable : 1; // if sYCC601 extended colorimetry is supported + NvU32 isMonAdobeYCC601Capable : 1; // if AdobeYCC601 extended colorimetry is supported + NvU32 isMonAdobeRGBCapable : 1; // if AdobeRGB extended colorimetry is supported + NvU32 isMonBT2020RGBCapable : 1; // if BT2020 RGB extended colorimetry is supported + NvU32 isMonBT2020YCCCapable : 1; // if BT2020 Y'CbCr extended colorimetry is supported + NvU32 isMonBT2020cYCCCapable : 1; // if BT2020 cYCbCr (constant luminance) extended colorimetry is supported + + NvU32 reserved : 6; //!< reserved + } NV_DISPLAY_PORT_INFO_V1; + + typedef NV_DISPLAY_PORT_INFO_V1 NV_DISPLAY_PORT_INFO; + +//! Macro for constructing the version field of NV_DISPLAY_PORT_INFO. +#define NV_DISPLAY_PORT_INFO_VER1 MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_INFO,1) +#define NV_DISPLAY_PORT_INFO_VER2 MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_INFO,2) +#define NV_DISPLAY_PORT_INFO_VER NV_DISPLAY_PORT_INFO_VER2 + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GetDisplayPortInfo +// +//! \fn NvAPI_GetDisplayPortInfo(__in_opt NvDisplayHandle hNvDisplay, __in NvU32 outputId, __inout NV_DISPLAY_PORT_INFO *pInfo) +//! DESCRIPTION: This function returns the current DisplayPort-related information on the specified device (monitor). +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 165 +//! +//! \param [in] hvDisplay NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle(). +//! This parameter is ignored when the outputId is a NvAPI displayId. +//! \param [in] outputId This can either be the connection bit mask or the NvAPI displayId. When the legacy connection bit mask is passed, +//! it should have exactly 1 bit set to indicate a single display. If it's "0" then the default outputId from +//! NvAPI_GetAssociatedDisplayOutputId() will be used. See \ref handles. +//! \param [out] pInfo The DisplayPort information +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred +//! \retval NVAPI_INVALID_ARGUMENT Invalid input parameter. +// +/////////////////////////////////////////////////////////////////////////////// +//! \ingroup dispcontrol +NVAPI_INTERFACE NvAPI_GetDisplayPortInfo(__in_opt NvDisplayHandle hNvDisplay, __in NvU32 outputId, __inout NV_DISPLAY_PORT_INFO *pInfo); + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_SetDisplayPort +// +//! \fn NvAPI_SetDisplayPort(NvDisplayHandle hNvDisplay, NvU32 outputId, NV_DISPLAY_PORT_CONFIG *pCfg) +//! DESCRIPTION: This function sets up DisplayPort-related configurations. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 165 +//! +//! \param [in] hNvDisplay NVIDIA display handle. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from +//! NvAPI_EnumNVidiaDisplayHandle(). +//! \param [in] outputId This display output ID, when it's "0" it means the default outputId generated from the return of +//! NvAPI_GetAssociatedDisplayOutputId(). See \ref handles. +//! \param [in] pCfg The display port config structure. If pCfg is NULL, it means to use the driver's default value to setup. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred +//! \retval NVAPI_INVALID_ARGUMENT Invalid input parameter +/////////////////////////////////////////////////////////////////////////////// + + +//! \ingroup dispcontrol +//! DisplayPort configuration settings - used in NvAPI_SetDisplayPort(). +typedef struct +{ + NvU32 version; //!< Structure version - 2 is the latest + NV_DP_LINK_RATE linkRate; //!< Link rate + NV_DP_LANE_COUNT laneCount; //!< Lane count + NV_DP_COLOR_FORMAT colorFormat; //!< Color format to set + NV_DP_DYNAMIC_RANGE dynamicRange; //!< Dynamic range + NV_DP_COLORIMETRY colorimetry; //!< Ignored in RGB space + NV_DP_BPC bpc; //!< Bit-per-component + NvU32 isHPD : 1; //!< If the control panel is making this call due to HPD + NvU32 isSetDeferred : 1; //!< Requires an OS modeset to finalize the setup if set + NvU32 isChromaLpfOff : 1; //!< Force the chroma low_pass_filter to be off + NvU32 isDitherOff : 1; //!< Force to turn off dither + NvU32 testLinkTrain : 1; //!< If testing mode, skip validation + NvU32 testColorChange : 1; //!< If testing mode, skip validation + +} NV_DISPLAY_PORT_CONFIG; + +//! \addtogroup dispcontrol +//! @{ +//! Macro for constructing the version field of NV_DISPLAY_PORT_CONFIG +#define NV_DISPLAY_PORT_CONFIG_VER MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,2) +//! Macro for constructing the version field of NV_DISPLAY_PORT_CONFIG +#define NV_DISPLAY_PORT_CONFIG_VER_1 MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,1) +//! Macro for constructing the version field of NV_DISPLAY_PORT_CONFIG +#define NV_DISPLAY_PORT_CONFIG_VER_2 MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,2) +//! @} + + +//! \ingroup dispcontrol +NVAPI_INTERFACE NvAPI_SetDisplayPort(NvDisplayHandle hNvDisplay, NvU32 outputId, NV_DISPLAY_PORT_CONFIG *pCfg); + + + + +//! \ingroup dispcontrol +//! Used in NvAPI_GetHDMISupportInfo(). +typedef struct _NV_HDMI_SUPPORT_INFO_V1 +{ + NvU32 version; //!< Structure version + + NvU32 isGpuHDMICapable : 1; //!< If the GPU can handle HDMI + NvU32 isMonUnderscanCapable : 1; //!< If the monitor supports underscan + NvU32 isMonBasicAudioCapable : 1; //!< If the monitor supports basic audio + NvU32 isMonYCbCr444Capable : 1; //!< If YCbCr 4:4:4 is supported + NvU32 isMonYCbCr422Capable : 1; //!< If YCbCr 4:2:2 is supported + NvU32 isMonxvYCC601Capable : 1; //!< If xvYCC 601 is supported + NvU32 isMonxvYCC709Capable : 1; //!< If xvYCC 709 is supported + NvU32 isMonHDMI : 1; //!< If the monitor is HDMI (with IEEE's HDMI registry ID) + NvU32 reserved : 24; //!< Reserved. + + NvU32 EDID861ExtRev; //!< Revision number of the EDID 861 extension + } NV_HDMI_SUPPORT_INFO_V1; + +typedef struct _NV_HDMI_SUPPORT_INFO_V2 +{ + NvU32 version; //!< Structure version + + NvU32 isGpuHDMICapable : 1; //!< If the GPU can handle HDMI + NvU32 isMonUnderscanCapable : 1; //!< If the monitor supports underscan + NvU32 isMonBasicAudioCapable : 1; //!< If the monitor supports basic audio + NvU32 isMonYCbCr444Capable : 1; //!< If YCbCr 4:4:4 is supported + NvU32 isMonYCbCr422Capable : 1; //!< If YCbCr 4:2:2 is supported + NvU32 isMonxvYCC601Capable : 1; //!< If xvYCC extended colorimetry 601 is supported + NvU32 isMonxvYCC709Capable : 1; //!< If xvYCC extended colorimetry 709 is supported + NvU32 isMonHDMI : 1; //!< If the monitor is HDMI (with IEEE's HDMI registry ID) + NvU32 isMonsYCC601Capable : 1; //!< if sYCC601 extended colorimetry is supported + NvU32 isMonAdobeYCC601Capable : 1; //!< if AdobeYCC601 extended colorimetry is supported + NvU32 isMonAdobeRGBCapable : 1; //!< if AdobeRGB extended colorimetry is supported + NvU32 reserved : 21; //!< Reserved. + + NvU32 EDID861ExtRev; //!< Revision number of the EDID 861 extension + } NV_HDMI_SUPPORT_INFO_V2; + +#define NV_HDMI_SUPPORT_INFO_VER1 MAKE_NVAPI_VERSION(NV_HDMI_SUPPORT_INFO_V1, 1) +#define NV_HDMI_SUPPORT_INFO_VER2 MAKE_NVAPI_VERSION(NV_HDMI_SUPPORT_INFO_V2, 2) + + + +#ifndef NV_HDMI_SUPPORT_INFO_VER + +typedef NV_HDMI_SUPPORT_INFO_V2 NV_HDMI_SUPPORT_INFO; +#define NV_HDMI_SUPPORT_INFO_VER NV_HDMI_SUPPORT_INFO_VER2 + +#endif + + +//! SUPPORTED OS: Windows Vista and higher +//! +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GetHDMISupportInfo +// +//! \fn NvAPI_GetHDMISupportInfo(__in_opt NvDisplayHandle hNvDisplay, __in NvU32 outputId, __inout NV_HDMI_SUPPORT_INFO *pInfo) +//! This API returns the current infoframe data on the specified device(monitor). +//! +//! \since Release: 95 +//! +//! \param [in] hvDisplay NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle(). +//! This parameter is ignored when the outputId is a NvAPI displayId. +//! \param [in] outputId This can either be the connection bit mask or the NvAPI displayId. When the legacy connection bit mask is passed, +//! it should have exactly 1 bit set to indicate a single display. If it's "0" then the default outputId from +//! NvAPI_GetAssociatedDisplayOutputId() will be used. See \ref handles. +//! \param [out] pInfo The monitor and GPU's HDMI support info +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred +//! \retval NVAPI_INVALID_ARGUMENT Invalid input parameter. +/////////////////////////////////////////////////////////////////////////////// + + +//! \ingroup dispcontrol +NVAPI_INTERFACE NvAPI_GetHDMISupportInfo(__in_opt NvDisplayHandle hNvDisplay, __in NvU32 outputId, __inout NV_HDMI_SUPPORT_INFO *pInfo); + + +//! \ingroup dispcontrol + +typedef enum +{ + NV_INFOFRAME_CMD_GET_DEFAULT = 0, //!< Returns the fields in the infoframe with values set by the manufacturer - NVIDIA/OEM. + NV_INFOFRAME_CMD_RESET, //!< Sets the fields in the infoframe to auto, and infoframe to the default infoframe for use in a set. + NV_INFOFRAME_CMD_GET, //!< Get the current infoframe state. + NV_INFOFRAME_CMD_SET, //!< Set the current infoframe state (flushed to the monitor), the values are one time and do not persist. + NV_INFOFRAME_CMD_GET_OVERRIDE, //!< Get the override infoframe state, non-override fields will be set to value = AUTO, overridden fields will have the current override values. + NV_INFOFRAME_CMD_SET_OVERRIDE, //!< Set the override infoframe state, non-override fields will be set to value = AUTO, other values indicate override; persist across modeset/reboot + NV_INFOFRAME_CMD_GET_PROPERTY, //!< get properties associated with infoframe (each of the infoframe type will have properties) + NV_INFOFRAME_CMD_SET_PROPERTY, //!< set properties associated with infoframe +} NV_INFOFRAME_CMD; + + +typedef enum +{ + NV_INFOFRAME_PROPERTY_MODE_AUTO = 0, //!< Driver determines whether to send infoframes. + NV_INFOFRAME_PROPERTY_MODE_ENABLE, //!< Driver always sends infoframe. + NV_INFOFRAME_PROPERTY_MODE_DISABLE, //!< Driver never sends infoframe. + NV_INFOFRAME_PROPERTY_MODE_ALLOW_OVERRIDE, //!< Driver only sends infoframe when client requests it via infoframe escape call. +} NV_INFOFRAME_PROPERTY_MODE; + + +//! Returns whether the current monitor is in blacklist or force this monitor to be in blacklist. +typedef enum +{ + NV_INFOFRAME_PROPERTY_BLACKLIST_FALSE = 0, + NV_INFOFRAME_PROPERTY_BLACKLIST_TRUE, +} NV_INFOFRAME_PROPERTY_BLACKLIST; + +typedef struct +{ + NvU32 mode : 4; + NvU32 blackList : 2; + NvU32 reserved : 10; + NvU32 version : 8; + NvU32 length : 8; +} NV_INFOFRAME_PROPERTY; + +//! Byte1 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_SCANINFO_NODATA = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_SCANINFO_OVERSCAN, + NV_INFOFRAME_FIELD_VALUE_AVI_SCANINFO_UNDERSCAN, + NV_INFOFRAME_FIELD_VALUE_AVI_SCANINFO_FUTURE, + NV_INFOFRAME_FIELD_VALUE_AVI_SCANINFO_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_SCANINFO; + + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_BARDATA_NOT_PRESENT = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_BARDATA_VERTICAL_PRESENT, + NV_INFOFRAME_FIELD_VALUE_AVI_BARDATA_HORIZONTAL_PRESENT, + NV_INFOFRAME_FIELD_VALUE_AVI_BARDATA_BOTH_PRESENT, + NV_INFOFRAME_FIELD_VALUE_AVI_BARDATA_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_BARDATA; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_AFI_ABSENT = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_AFI_PRESENT, + NV_INFOFRAME_FIELD_VALUE_AVI_AFI_AUTO = 3 +} NV_INFOFRAME_FIELD_VALUE_AVI_ACTIVEFORMATINFO; + + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_COLORFORMAT_RGB = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_COLORFORMAT_YCbCr422, + NV_INFOFRAME_FIELD_VALUE_AVI_COLORFORMAT_YCbCr444, + NV_INFOFRAME_FIELD_VALUE_AVI_COLORFORMAT_FUTURE, + NV_INFOFRAME_FIELD_VALUE_AVI_COLORFORMAT_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_COLORFORMAT; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_F17_FALSE = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_F17_TRUE, + NV_INFOFRAME_FIELD_VALUE_AVI_F17_AUTO = 3 +} NV_INFOFRAME_FIELD_VALUE_AVI_F17; + +//! Byte2 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_NO_AFD = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_RESERVE01, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_RESERVE02, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_RESERVE03, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_LETTERBOX_GT16x9, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_RESERVE05, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_RESERVE06, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_RESERVE07, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_EQUAL_CODEDFRAME = 8, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_CENTER_4x3, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_CENTER_16x9, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_CENTER_14x9, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_RESERVE12, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_4x3_ON_14x9, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_16x9_ON_14x9, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_16x9_ON_4x3, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION_AUTO = 31, +} NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOACTIVEPORTION; + + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOCODEDFRAME_NO_DATA = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOCODEDFRAME_4x3, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOCODEDFRAME_16x9, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOCODEDFRAME_FUTURE, + NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOCODEDFRAME_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_ASPECTRATIOCODEDFRAME; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_COLORIMETRY_NO_DATA = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_COLORIMETRY_SMPTE_170M, + NV_INFOFRAME_FIELD_VALUE_AVI_COLORIMETRY_ITUR_BT709, + NV_INFOFRAME_FIELD_VALUE_AVI_COLORIMETRY_USE_EXTENDED_COLORIMETRY, + NV_INFOFRAME_FIELD_VALUE_AVI_COLORIMETRY_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_COLORIMETRY; + +//! Byte 3 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_NONUNIFORMPICTURESCALING_NO_DATA = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_NONUNIFORMPICTURESCALING_HORIZONTAL, + NV_INFOFRAME_FIELD_VALUE_AVI_NONUNIFORMPICTURESCALING_VERTICAL, + NV_INFOFRAME_FIELD_VALUE_AVI_NONUNIFORMPICTURESCALING_BOTH, + NV_INFOFRAME_FIELD_VALUE_AVI_NONUNIFORMPICTURESCALING_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_NONUNIFORMPICTURESCALING; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_RGBQUANTIZATION_DEFAULT = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_RGBQUANTIZATION_LIMITED_RANGE, + NV_INFOFRAME_FIELD_VALUE_AVI_RGBQUANTIZATION_FULL_RANGE, + NV_INFOFRAME_FIELD_VALUE_AVI_RGBQUANTIZATION_RESERVED, + NV_INFOFRAME_FIELD_VALUE_AVI_RGBQUANTIZATION_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_RGBQUANTIZATION; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_XVYCC601 = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_XVYCC709, + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_SYCC601, + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_ADOBEYCC601, + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_ADOBERGB, + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_RESERVED05, + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_RESERVED06, + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_RESERVED07, + NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY_AUTO = 15 +} NV_INFOFRAME_FIELD_VALUE_AVI_EXTENDEDCOLORIMETRY; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_ITC_VIDEO_CONTENT = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_ITC_ITCONTENT, + NV_INFOFRAME_FIELD_VALUE_AVI_ITC_AUTO = 3 +} NV_INFOFRAME_FIELD_VALUE_AVI_ITC; + +//! Byte 4 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_NONE = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X02, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X03, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X04, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X05, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X06, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X07, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X08, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X09, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_X10, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_RESERVED10, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_RESERVED11, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_RESERVED12, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_RESERVED13, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_RESERVED14, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_RESERVED15, + NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION_AUTO = 31 +} NV_INFOFRAME_FIELD_VALUE_AVI_PIXELREPETITION; + + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_CONTENTTYPE_GRAPHICS = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_CONTENTTYPE_PHOTO, + NV_INFOFRAME_FIELD_VALUE_AVI_CONTENTTYPE_CINEMA, + NV_INFOFRAME_FIELD_VALUE_AVI_CONTENTTYPE_GAME, + NV_INFOFRAME_FIELD_VALUE_AVI_CONTENTTYPE_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_CONTENTTYPE; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AVI_YCCQUANTIZATION_LIMITED_RANGE = 0, + NV_INFOFRAME_FIELD_VALUE_AVI_YCCQUANTIZATION_FULL_RANGE, + NV_INFOFRAME_FIELD_VALUE_AVI_YCCQUANTIZATION_RESERVED02, + NV_INFOFRAME_FIELD_VALUE_AVI_YCCQUANTIZATION_RESERVED03, + NV_INFOFRAME_FIELD_VALUE_AVI_YCCQUANTIZATION_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AVI_YCCQUANTIZATION; + +//! Adding an Auto bit to each field +typedef struct +{ + NvU32 vic : 8; + NvU32 pixelRepeat : 5; + NvU32 colorSpace : 3; + NvU32 colorimetry : 3; + NvU32 extendedColorimetry : 4; + NvU32 rgbQuantizationRange : 3; + NvU32 yccQuantizationRange : 3; + NvU32 itContent : 2; + NvU32 contentTypes : 3; + NvU32 scanInfo : 3; + NvU32 activeFormatInfoPresent : 2; + NvU32 activeFormatAspectRatio : 5; + NvU32 picAspectRatio : 3; + NvU32 nonuniformScaling : 3; + NvU32 barInfo : 3; + NvU32 top_bar : 17; + NvU32 bottom_bar : 17; + NvU32 left_bar : 17; + NvU32 right_bar : 17; + NvU32 Future17 : 2; + NvU32 Future47 : 2; +} NV_INFOFRAME_VIDEO; + +//! Byte 1 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_IN_HEADER = 0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_2, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_3, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_4, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_5, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_6, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_7, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_8, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT_AUTO = 15 +} NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELCOUNT; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_IN_HEADER = 0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_PCM, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_AC3, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_MPEG1, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_MP3, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_MPEG2, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_AACLC, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_DTS, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_ATRAC, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_DSD, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_EAC3, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_DTSHD, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_MLP, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_DST, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_WMAPRO, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_USE_CODING_EXTENSION_TYPE, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE_AUTO = 31 +} NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGTYPE; + +//! Byte 2 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLESIZE_IN_HEADER = 0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLESIZE_16BITS, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLESIZE_20BITS, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLESIZE_24BITS, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLESIZE_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLESIZE; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_IN_HEADER = 0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_32000HZ, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_44100HZ, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_48000HZ, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_88200KHZ, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_96000KHZ, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_176400KHZ, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_192000KHZ, + NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY_AUTO = 15 +} NV_INFOFRAME_FIELD_VALUE_AUDIO_SAMPLEFREQUENCY; + + + +//! Byte 3 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_USE_CODING_TYPE = 0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_HEAAC, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_HEAACV2, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_MPEGSURROUND, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE04, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE05, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE06, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE07, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE08, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE09, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE10, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE11, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE12, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE13, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE14, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE15, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE16, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE17, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE18, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE19, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE20, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE21, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE22, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE23, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE24, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE25, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE26, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE27, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE28, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE29, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE30, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_RESERVE31, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE_AUTO = 63 +} NV_INFOFRAME_FIELD_VALUE_AUDIO_CODINGEXTENSIONTYPE; + + +//! Byte 4 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_X_X_X_X_FR_FL =0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_X_X_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_X_X_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_X_X_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_X_RC_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_X_RC_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_X_RC_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_X_RC_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_RR_RL_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_RR_RL_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_X_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_RC_RR_RL_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_RC_RR_RL_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_RC_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_RC_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_RRC_RLC_RR_RL_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_RRC_RLC_RR_RL_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_RRC_RLC_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_RRC_RLC_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_X_X_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_X_X_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_X_X_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_X_X_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_X_RC_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_X_RC_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_X_RC_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_X_RC_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_RR_RL_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_RR_RL_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRC_FLC_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_FCH_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_X_FCH_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_TC_X_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_TC_X_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRH_FLH_RR_RL_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRH_FLH_RR_RL_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRW_FLW_RR_RL_X_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRW_FLW_RR_RL_X_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_TC_RC_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_TC_RC_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FCH_RC_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FCH_RC_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_TC_FCH_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_TC_FCH_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRH_FLH_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRH_FLH_RR_RL_FC_LFE_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRW_FLW_RR_RL_FC_X_FR_FL, + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_FRW_FLW_RR_RL_FC_LFE_FR_FL = 0X31, + // all other values should default to auto + NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION_AUTO = 0x1FF +} NV_INFOFRAME_FIELD_VALUE_AUDIO_CHANNELALLOCATION; + +//! Byte 5 related +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_LFEPLAYBACKLEVEL_NO_DATA = 0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LFEPLAYBACKLEVEL_0DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LFEPLAYBACKLEVEL_PLUS10DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LFEPLAYBACKLEVEL_RESERVED03, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LFEPLAYBACKLEVEL_AUTO = 7 +} NV_INFOFRAME_FIELD_VALUE_AUDIO_LFEPLAYBACKLEVEL; + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_0DB = 0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_1DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_2DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_3DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_4DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_5DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_6DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_7DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_8DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_9DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_10DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_11DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_12DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_13DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_14DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_15DB, + NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES_AUTO = 31 +} NV_INFOFRAME_FIELD_VALUE_AUDIO_LEVELSHIFTVALUES; + + +typedef enum +{ + NV_INFOFRAME_FIELD_VALUE_AUDIO_DOWNMIX_PERMITTED = 0, + NV_INFOFRAME_FIELD_VALUE_AUDIO_DOWNMIX_PROHIBITED, + NV_INFOFRAME_FIELD_VALUE_AUDIO_DOWNMIX_AUTO = 3 +} NV_INFOFRAME_FIELD_VALUE_AUDIO_DOWNMIX; + +typedef struct +{ + NvU32 codingType : 5; + NvU32 codingExtensionType : 6; + NvU32 sampleSize : 3; + NvU32 sampleRate : 4; + NvU32 channelCount : 4; + NvU32 speakerPlacement : 9; + NvU32 downmixInhibit : 2; + NvU32 lfePlaybackLevel : 3; + NvU32 levelShift : 5; + NvU32 Future12 : 2; + NvU32 Future2x : 4; + NvU32 Future3x : 4; + NvU32 Future52 : 2; + NvU32 Future6 : 9; + NvU32 Future7 : 9; + NvU32 Future8 : 9; + NvU32 Future9 : 9; + NvU32 Future10 : 9; +} NV_INFOFRAME_AUDIO; + +typedef struct +{ + NvU32 version; //!< version of this structure + NvU16 size; //!< size of this structure + NvU8 cmd; //!< The actions to perform from NV_INFOFRAME_CMD + NvU8 type; //!< type of infoframe + + union + { + NV_INFOFRAME_PROPERTY property; //!< This is NVIDIA-specific and corresponds to the property cmds and associated infoframe. + NV_INFOFRAME_AUDIO audio; + NV_INFOFRAME_VIDEO video; + } infoframe; +} NV_INFOFRAME_DATA; + +//! Macro for constructing the version field of ::NV_INFOFRAME_DATA +#define NV_INFOFRAME_DATA_VER MAKE_NVAPI_VERSION(NV_INFOFRAME_DATA,1) + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_Disp_InfoFrameControl +// +//! DESCRIPTION: This API controls the InfoFrame values. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] displayId Monitor Identifier +//! \param [in,out] pInfoframeData Contains data corresponding to InfoFrame +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Disp_InfoFrameControl(__in NvU32 displayId, __inout NV_INFOFRAME_DATA *pInfoframeData); + + + + + + +//! \ingroup dispcontrol +//! @{ +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_Disp_ColorControl +// +//! \fn NvAPI_Disp_ColorControl(NvU32 displayId, NV_COLOR_DATA *pColorData) +//! DESCRIPTION: This API controls the Color values. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] displayId Monitor Identifier +//! \param [in,out] pColorData Contains data corresponding to color information +//! +//! \return RETURN STATUS: +//! ::NVAPI_OK, +//! ::NVAPI_ERROR, +//! ::NVAPI_INVALID_ARGUMENT +// +/////////////////////////////////////////////////////////////////////////////// + +typedef enum +{ + NV_COLOR_CMD_GET = 1, + NV_COLOR_CMD_SET, + NV_COLOR_CMD_IS_SUPPORTED_COLOR, + NV_COLOR_CMD_GET_DEFAULT +} NV_COLOR_CMD; + +//! See Table 14 of CEA-861E. Not all of this is supported by the GPU. +typedef enum +{ + NV_COLOR_FORMAT_RGB = 0, + NV_COLOR_FORMAT_YUV422, + NV_COLOR_FORMAT_YUV444, + NV_COLOR_FORMAT_YUV420, + + NV_COLOR_FORMAT_DEFAULT = 0xFE, + NV_COLOR_FORMAT_AUTO = 0xFF +} NV_COLOR_FORMAT; + + + +typedef enum +{ + NV_COLOR_COLORIMETRY_RGB = 0, + NV_COLOR_COLORIMETRY_YCC601, + NV_COLOR_COLORIMETRY_YCC709, + NV_COLOR_COLORIMETRY_XVYCC601, + NV_COLOR_COLORIMETRY_XVYCC709, + NV_COLOR_COLORIMETRY_SYCC601, + NV_COLOR_COLORIMETRY_ADOBEYCC601, + NV_COLOR_COLORIMETRY_ADOBERGB, + NV_COLOR_COLORIMETRY_BT2020RGB, + NV_COLOR_COLORIMETRY_BT2020YCC, + NV_COLOR_COLORIMETRY_BT2020cYCC, + + NV_COLOR_COLORIMETRY_DEFAULT = 0xFE, + NV_COLOR_COLORIMETRY_AUTO = 0xFF +} NV_COLOR_COLORIMETRY; + +typedef enum _NV_DYNAMIC_RANGE +{ + NV_DYNAMIC_RANGE_VESA = 0x0, + NV_DYNAMIC_RANGE_CEA = 0x1, + + NV_DYNAMIC_RANGE_AUTO = 0xFF +} NV_DYNAMIC_RANGE; + +typedef enum _NV_BPC +{ + NV_BPC_DEFAULT = 0, + NV_BPC_6 = 1, + NV_BPC_8 = 2, + NV_BPC_10 = 3, + NV_BPC_12 = 4, + NV_BPC_16 = 5, +} NV_BPC; + +typedef struct _NV_COLOR_DATA_V1 +{ + NvU32 version; //!< Version of this structure + NvU16 size; //!< Size of this structure + NvU8 cmd; + struct + { + NvU8 colorFormat; //!< One of NV_COLOR_FORMAT enum values. + NvU8 colorimetry; //!< One of NV_COLOR_COLORIMETRY enum values. + } data; +} NV_COLOR_DATA_V1; + +typedef struct _NV_COLOR_DATA_V2 +{ + NvU32 version; //!< Version of this structure + NvU16 size; //!< Size of this structure + NvU8 cmd; + struct + { + NvU8 colorFormat; //!< One of NV_COLOR_FORMAT enum values. + NvU8 colorimetry; //!< One of NV_COLOR_COLORIMETRY enum values. + NvU8 dynamicRange; //!< One of NV_DYNAMIC_RANGE enum values. + } data; +} NV_COLOR_DATA_V2; + +typedef struct _NV_COLOR_DATA_V3 +{ + NvU32 version; //!< Version of this structure + NvU16 size; //!< Size of this structure + NvU8 cmd; + struct + { + NvU8 colorFormat; //!< One of NV_COLOR_FORMAT enum values. + NvU8 colorimetry; //!< One of NV_COLOR_COLORIMETRY enum values. + NvU8 dynamicRange; //!< One of NV_DYNAMIC_RANGE enum values. + NV_BPC bpc; //!< One of NV_BPC enum values. + } data; +} NV_COLOR_DATA_V3; + +typedef NV_COLOR_DATA_V3 NV_COLOR_DATA; + +#define NV_COLOR_DATA_VER1 MAKE_NVAPI_VERSION(NV_COLOR_DATA_V1, 1) +#define NV_COLOR_DATA_VER2 MAKE_NVAPI_VERSION(NV_COLOR_DATA_V2, 2) +#define NV_COLOR_DATA_VER3 MAKE_NVAPI_VERSION(NV_COLOR_DATA_V3, 3) +#define NV_COLOR_DATA_VER NV_COLOR_DATA_VER3 + +NVAPI_INTERFACE NvAPI_Disp_ColorControl(NvU32 displayId, NV_COLOR_DATA *pColorData); + +//! @} + +//! \ingroup dispcontrol +//! Used in NvAPI_DISP_GetTiming(). +typedef struct +{ + NvU32 isInterlaced : 4; //!< To retrieve interlaced/progressive timing + NvU32 reserved0 : 12; + union + { + NvU32 tvFormat : 8; //!< The actual analog HD/SDTV format. Used when the timing type is + //! NV_TIMING_OVERRIDE_ANALOG_TV and width==height==rr==0. + NvU32 ceaId : 8; //!< The EIA/CEA 861B/D predefined short timing descriptor ID. + //! Used when the timing type is NV_TIMING_OVERRIDE_EIA861 + //! and width==height==rr==0. + NvU32 nvPsfId : 8; //!< The NV predefined PsF format Id. + //! Used when the timing type is NV_TIMING_OVERRIDE_NV_PREDEFINED. + }; + NvU32 scaling : 8; //!< Define preferred scaling +}NV_TIMING_FLAG; + +//! \ingroup dispcontrol +//! Used in NvAPI_DISP_GetTiming(). +typedef struct _NV_TIMING_INPUT +{ + NvU32 version; //!< (IN) structure version + + NvU32 width; //!< Visible horizontal size + NvU32 height; //!< Visible vertical size + float rr; //!< Timing refresh rate + + NV_TIMING_FLAG flag; //!< Flag containing additional info for timing calculation. + + NV_TIMING_OVERRIDE type; //!< Timing type(formula) to use for calculating the timing +}NV_TIMING_INPUT; + +#define NV_TIMING_INPUT_VER MAKE_NVAPI_VERSION(NV_TIMING_INPUT,1) + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_GetTiming +// +//! DESCRIPTION: This function calculates the timing from the visible width/height/refresh-rate and timing type info. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 313 +//! +//! +//! \param [in] displayId Display ID of the display. +//! \param [in] timingInput Inputs used for calculating the timing. +//! \param [out] pTiming Pointer to the NV_TIMING structure. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetTiming( __in NvU32 displayId,__in NV_TIMING_INPUT *timingInput, __out NV_TIMING *pTiming); + + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_GetMonitorCapabilities +// +//! \fn NvAPI_DISP_GetMonitorCapabilities(NvU32 displayId, NV_MONITOR_CAPABILITIES *pMonitorCapabilities) +//! DESCRIPTION: This API returns the Monitor capabilities +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] displayId Monitor Identifier +//! \param [out] pMonitorCapabilities The monitor support info +//! +//! \return ::NVAPI_OK, +//! ::NVAPI_ERROR, +//! ::NVAPI_INVALID_ARGUMENT +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup dispcontrol +//! @{ + + +//! HDMI-related and extended CAPs +typedef enum +{ + // hdmi related caps + NV_MONITOR_CAPS_TYPE_HDMI_VSDB = 0x1000, + NV_MONITOR_CAPS_TYPE_HDMI_VCDB = 0x1001, +} NV_MONITOR_CAPS_TYPE; + + + +typedef struct _NV_MONITOR_CAPS_VCDB +{ + NvU8 quantizationRangeYcc : 1; + NvU8 quantizationRangeRgb : 1; + NvU8 scanInfoPreferredVideoFormat : 2; + NvU8 scanInfoITVideoFormats : 2; + NvU8 scanInfoCEVideoFormats : 2; +} NV_MONITOR_CAPS_VCDB; + + +//! See NvAPI_DISP_GetMonitorCapabilities(). +typedef struct _NV_MONITOR_CAPS_VSDB +{ + // byte 1 + NvU8 sourcePhysicalAddressB : 4; //!< Byte 1 + NvU8 sourcePhysicalAddressA : 4; //!< Byte 1 + // byte 2 + NvU8 sourcePhysicalAddressD : 4; //!< Byte 2 + NvU8 sourcePhysicalAddressC : 4; //!< Byte 2 + // byte 3 + NvU8 supportDualDviOperation : 1; //!< Byte 3 + NvU8 reserved6 : 2; //!< Byte 3 + NvU8 supportDeepColorYCbCr444 : 1; //!< Byte 3 + NvU8 supportDeepColor30bits : 1; //!< Byte 3 + NvU8 supportDeepColor36bits : 1; //!< Byte 3 + NvU8 supportDeepColor48bits : 1; //!< Byte 3 + NvU8 supportAI : 1; //!< Byte 3 + // byte 4 + NvU8 maxTmdsClock; //!< Bye 4 + // byte 5 + NvU8 cnc0SupportGraphicsTextContent : 1; //!< Byte 5 + NvU8 cnc1SupportPhotoContent : 1; //!< Byte 5 + NvU8 cnc2SupportCinemaContent : 1; //!< Byte 5 + NvU8 cnc3SupportGameContent : 1; //!< Byte 5 + NvU8 reserved8 : 1; //!< Byte 5 + NvU8 hasVicEntries : 1; //!< Byte 5 + NvU8 hasInterlacedLatencyField : 1; //!< Byte 5 + NvU8 hasLatencyField : 1; //!< Byte 5 + // byte 6 + NvU8 videoLatency; //!< Byte 6 + // byte 7 + NvU8 audioLatency; //!< Byte 7 + // byte 8 + NvU8 interlacedVideoLatency; //!< Byte 8 + // byte 9 + NvU8 interlacedAudioLatency; //!< Byte 9 + // byte 10 + NvU8 reserved13 : 7; //!< Byte 10 + NvU8 has3dEntries : 1; //!< Byte 10 + // byte 11 + NvU8 hdmi3dLength : 5; //!< Byte 11 + NvU8 hdmiVicLength : 3; //!< Byte 11 + // Remaining bytes + NvU8 hdmi_vic[7]; //!< Keeping maximum length for 3 bits + NvU8 hdmi_3d[31]; //!< Keeping maximum length for 5 bits +} NV_MONITOR_CAPS_VSDB; + + +//! See NvAPI_DISP_GetMonitorCapabilities(). +typedef struct _NV_MONITOR_CAPABILITIES_V1 +{ + NvU32 version; + NvU16 size; + NvU32 infoType; + NvU32 connectorType; //!< Out: VGA, TV, DVI, HDMI, DP + NvU8 bIsValidInfo : 1; //!< Boolean : Returns invalid if requested info is not present such as VCDB not present + union { + NV_MONITOR_CAPS_VSDB vsdb; + NV_MONITOR_CAPS_VCDB vcdb; + } data; +} NV_MONITOR_CAPABILITIES_V1; + +typedef NV_MONITOR_CAPABILITIES_V1 NV_MONITOR_CAPABILITIES; + +//! Macro for constructing the version field of ::NV_MONITOR_CAPABILITIES_V1 +#define NV_MONITOR_CAPABILITIES_VER1 MAKE_NVAPI_VERSION(NV_MONITOR_CAPABILITIES_V1,1) +#define NV_MONITOR_CAPABILITIES_VER NV_MONITOR_CAPABILITIES_VER1 + +//! @} + +//! SUPPORTED OS: Windows Vista and higher +//! +//! \ingroup dispcontrol +NVAPI_INTERFACE NvAPI_DISP_GetMonitorCapabilities(__in NvU32 displayId, __inout NV_MONITOR_CAPABILITIES *pMonitorCapabilities); + +//! \ingroup dispcontrol +typedef struct _NV_MONITOR_COLOR_DATA +{ + NvU32 version; +// We are only supporting DP monitors for now. We need to extend this to HDMI panels as well + NV_DP_COLOR_FORMAT colorFormat; //!< One of the supported color formats + NV_DP_BPC backendBitDepths; //!< One of the supported bit depths +} NV_MONITOR_COLOR_CAPS_V1; + +typedef NV_MONITOR_COLOR_CAPS_V1 NV_MONITOR_COLOR_CAPS; + +//! \ingroup dispcontrol +#define NV_MONITOR_COLOR_CAPS_VER1 MAKE_NVAPI_VERSION(NV_MONITOR_COLOR_CAPS_V1,1) +#define NV_MONITOR_COLOR_CAPS_VER NV_MONITOR_COLOR_CAPS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_GetMonitorColorCapabilities +// +//! DESCRIPTION: This API returns all the color formats and bit depth values supported by a given DP monitor. +//! +//! USAGE: Sequence of calls which caller should make to get the information. +//! 1. First call NvAPI_DISP_GetMonitorColorCapabilities() with pMonitorColorCapabilities as NULL to get the count. +//! 2. Allocate memory for color caps(NV_MONITOR_COLOR_CAPS) array. +//! 3. Call NvAPI_DISP_GetMonitorColorCapabilities() again with the pointer to the memory allocated to get all the +//! color capabilities. +//! +//! Note : +//! 1. pColorCapsCount should never be NULL, else the API will fail with NVAPI_INVALID_ARGUMENT. +//! 2. *pColorCapsCount returned from the API will always be the actual count in any/every call. +//! 3. Memory size to be allocated should be (*pColorCapsCount * sizeof(NV_MONITOR_COLOR_CAPS)). +//! 4. If the memory allocated is less than what is required to return all the timings, this API will return the +//! amount of information which can fit in user provided buffer and API will return NVAPI_INSUFFICIENT_BUFFER. +//! 5. If the caller specifies a greater value for *pColorCapsCount in second call to NvAPI_DISP_GetMonitorColorCapabilities() +//! than what was returned from first call, the API will return only the actual number of elements in the color +//! capabilities array and the extra buffer will remain unused. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] displayId Monitor Identifier +//! \param [in, out] pMonitorColorCapabilities The monitor color capabilities information +//! \param [in, out] pColorCapsCount - During input, the number of elements allocated for the pMonitorColorCapabilities pointer +//! - During output, the actual number of color data elements the monitor supports +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \retval NVAPI_INSUFFICIENT_BUFFER The input buffer size is not sufficient to hold the total contents. In this case +//! *pColorCapsCount will hold the required amount of elements. +//! \retval NVAPI_INVALID_DISPLAY_ID The input monitor is either not connected or is not a DP panel. +//! +//! \ingroup dispcontrol +//! +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetMonitorColorCapabilities(__in NvU32 displayId, __inout_ecount_part_opt(*pColorCapsCount, *pColorCapsCount) NV_MONITOR_COLOR_CAPS *pMonitorColorCapabilities, __inout NvU32 *pColorCapsCount); + +//! \ingroup dispcontrol +//! Used in NvAPI_DISP_EnumCustomDisplay() and NvAPI_DISP_TryCustomDisplay(). +typedef struct +{ + NvU32 version; + + // the source mode information + NvU32 width; //!< Source surface(source mode) width + NvU32 height; //!< Source surface(source mode) height + NvU32 depth; //!< Source surface color depth."0" means all 8/16/32bpp + NV_FORMAT colorFormat; //!< Color format (optional) + + NV_VIEWPORTF srcPartition; //!< For multimon support, should be set to (0,0,1.0,1.0) for now. + + float xRatio; //!< Horizontal scaling ratio + float yRatio; //!< Vertical scaling ratio + + NV_TIMING timing; //!< Timing used to program TMDS/DAC/LVDS/HDMI/TVEncoder, etc. + NvU32 hwModeSetOnly : 1; //!< If set, it means a hardware modeset without OS update + +}NV_CUSTOM_DISPLAY; + +//! \ingroup dispcontrol +//! Used in NV_CUSTOM_DISPLAY. +#define NV_CUSTOM_DISPLAY_VER MAKE_NVAPI_VERSION(NV_CUSTOM_DISPLAY,1) + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_EnumCustomDisplay +// +//! DESCRIPTION: This API enumerates the custom timing specified by the enum index. +//! The client should keep enumerating until it returns NVAPI_END_ENUMERATION. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 313 +//! +//! \param [in] displayId Dispaly ID of the display. +//! \param [in] index Enum index +//! \param [inout] pCustDisp Pointer to the NV_CUSTOM_DISPLAY structure +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! \retval NVAPI_INVALID_DISPLAY_ID: Custom Timing is not supported on the Display, whose display id is passed +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_EnumCustomDisplay( __in NvU32 displayId, __in NvU32 index, __inout NV_CUSTOM_DISPLAY *pCustDisp); + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_TryCustomDisplay +// +//! DESCRIPTION: This API is used to set up a custom display without saving the configuration on multiple displays. +//! +//! \note +//! All the members of srcPartition, present in NV_CUSTOM_DISPLAY structure, should have their range in (0.0,1.0). +//! In clone mode the timings can applied to both the target monitors but only one target at a time. \n +//! For the secondary target the applied timings works under the following conditions: +//! - If the secondary monitor EDID supports the selected timing, OR +//! - If the selected custom timings can be scaled by the secondary monitor for the selected source resolution on the primary, OR +//! - If the selected custom timings matches the existing source resolution on the primary. +//! Setting up a custom display on non-active but connected monitors is supported only for Win7 and above. +//! +//! SUPPORTED OS: Windows XP, Windows 7 and higher +//! +//! +//! \since Release: 313 +//! +//! +//! \param [in] pDisplayIds Array of the target display Dispaly IDs - See \ref handles. +//! \param [in] count Total number of the incoming Display IDs and corresponding NV_CUSTOM_DISPLAY structure. This is for the multi-head support. +//! \param [in] pCustDisp Pointer to the NV_CUSTOM_DISPLAY structure array. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! \retval NVAPI_INVALID_DISPLAY_ID: Custom Timing is not supported on the Display, whose display id is passed +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_TryCustomDisplay( __in_ecount(count) NvU32 *pDisplayIds, __in NvU32 count, __in_ecount(count) NV_CUSTOM_DISPLAY *pCustDisp); + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_DeleteCustomDisplay +// +//! DESCRIPTION: This function deletes the custom display configuration, specified from the registry for all the displays whose display IDs are passed. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 313 +//! +//! +//! \param [in] pDisplayIds Array of Dispaly IDs on which custom display configuration is to be saved. +//! \param [in] count Total number of the incoming Dispaly IDs. This is for the multi-head support. +//! \param [in] pCustDisp Pointer to the NV_CUSTOM_DISPLAY structure +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! \retval NVAPI_INVALID_DISPLAY_ID: Custom Timing is not supported on the Display, whose display id is passed +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_DeleteCustomDisplay( __in_ecount(count) NvU32 *pDisplayIds, __in NvU32 count, __in NV_CUSTOM_DISPLAY *pCustDisp); + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_SaveCustomDisplay +// +//! DESCRIPTION: This function saves the current hardware display configuration on the specified Display IDs as a custom display configuration. +//! This function should be called right after NvAPI_DISP_TryCustomDisplay() to save the custom display from the current +//! hardware context. This function will not do anything if the custom display configuration is not tested on the hardware. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 313 +//! +//! +//! \param [in] pDisplayIds Array of Dispaly IDs on which custom display configuration is to be saved. +//! \param [in] count Total number of the incoming Dispaly IDs. This is for the multi-head support. +//! \param [in] isThisOutputIdOnly If set, the saved custom display will only be applied on the monitor with the same outputId (see \ref handles). +//! \param [in] isThisMonitorIdOnly If set, the saved custom display will only be applied on the monitor with the same EDID ID or +//! the same TV connector in case of analog TV. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! \retval NVAPI_INVALID_DISPLAY_ID: Custom Timing is not supported on the Display, whose display id is passed +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_SaveCustomDisplay( __in_ecount(count) NvU32 *pDisplayIds, __in NvU32 count, __in NvU32 isThisOutputIdOnly, __in NvU32 isThisMonitorIdOnly); + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_RevertCustomDisplayTrial +// +//! DESCRIPTION: This API is used to restore the display configuration, that was changed by calling NvAPI_DISP_TryCustomDisplay(). This function +//! must be called only after a custom display configuration is tested on the hardware, using NvAPI_DISP_TryCustomDisplay(), +//! otherwise no action is taken. On Vista, NvAPI_DISP_RevertCustomDisplayTrial should be called with an active display that +//! was affected during the NvAPI_DISP_TryCustomDisplay() call, per GPU. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 313 +//! +//! +//! \param [in] pDisplayIds Pointer to display Id, of an active display. +//! \param [in] count Total number of incoming Display IDs. For future use only. Currently it is expected to be passed as 1. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_RevertCustomDisplayTrial( __in_ecount(count) NvU32* pDisplayIds, __in NvU32 count); + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GetView +// +//! This API lets caller retrieve the target display arrangement for selected source display handle. +//! \note Display PATH with this API is limited to single GPU. DUALVIEW across GPUs will be returned as STANDARD VIEW. +//! Use NvAPI_SYS_GetDisplayTopologies() to query views across GPUs. +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_DISP_GetDisplayConfig. +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 85 +//! +//! \param [in] hNvDisplay NVIDIA Display selection. It can be #NVAPI_DEFAULT_HANDLE or a handle enumerated from +//! NvAPI_EnumNVidiaDisplayHandle(). +//! \param [out] pTargets User allocated storage to retrieve an array of NV_VIEW_TARGET_INFO. Can be NULL to retrieve +//! the targetCount. +//! \param [in,out] targetMaskCount Count of target device mask specified in pTargetMask. +//! \param [out] targetView Target view selected from NV_TARGET_VIEW_MODE. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred +//! \retval NVAPI_INVALID_ARGUMENT Invalid input parameter. +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_DISP_GetDisplayConfig.") +NVAPI_INTERFACE NvAPI_GetView(NvDisplayHandle hNvDisplay, NV_VIEW_TARGET_INFO *pTargets, NvU32 *pTargetMaskCount, NV_TARGET_VIEW_MODE *pTargetView); + + + + + + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GetViewEx +// +//! DESCRIPTION: This API lets caller retrieve the target display arrangement for selected source display handle. +//! \note Display PATH with this API is limited to single GPU. DUALVIEW across GPUs will be returned as STANDARD VIEW. +//! Use NvAPI_SYS_GetDisplayTopologies() to query views across GPUs. +//! +//! \deprecated Do not use this function - it is deprecated in release 290. Instead, use NvAPI_DISP_GetDisplayConfig. +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 165 +//! +//! \param [in] hNvDisplay NVIDIA Display selection. #NVAPI_DEFAULT_HANDLE is not allowed, it has to be a handle enumerated with +//! NvAPI_EnumNVidiaDisplayHandle(). +//! \param [in,out] pPathInfo Count field should be set to NVAPI_MAX_DISPLAY_PATH. Can be NULL to retrieve just the pathCount. +//! \param [in,out] pPathCount Number of elements in array pPathInfo->path. +//! \param [out] pTargetViewMode Display view selected from NV_TARGET_VIEW_MODE. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_API_NOT_INTIALIZED NVAPI not initialized +//! \retval NVAPI_ERROR Miscellaneous error occurred +//! \retval NVAPI_INVALID_ARGUMENT Invalid input parameter. +//! \retval NVAPI_EXPECTED_DISPLAY_HANDLE hNvDisplay is not a valid display handle. +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +__nvapi_deprecated_function("Do not use this function - it is deprecated in release 290. Instead, use NvAPI_DISP_GetDisplayConfig.") +NVAPI_INTERFACE NvAPI_GetViewEx(NvDisplayHandle hNvDisplay, NV_DISPLAY_PATH_INFO *pPathInfo, NvU32 *pPathCount, NV_TARGET_VIEW_MODE *pTargetViewMode); + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_GetSupportedViews +// +//! This API lets caller enumerate all the supported NVIDIA display views - nView and Dualview modes. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 85 +//! +//! \param [in] hNvDisplay NVIDIA Display selection. It can be #NVAPI_DEFAULT_HANDLE or a handle enumerated from +//! NvAPI_EnumNVidiaDisplayHandle(). +//! \param [out] pTargetViews Array of supported views. Can be NULL to retrieve the pViewCount first. +//! \param [in,out] pViewCount Count of supported views. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Miscellaneous error occurred +//! \retval NVAPI_INVALID_ARGUMENT Invalid input parameter. +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetSupportedViews(NvDisplayHandle hNvDisplay, NV_TARGET_VIEW_MODE *pTargetViews, NvU32 *pViewCount); + + +//! SUPPORTED OS: Windows XP and higher +//! +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_GetDisplayIdByDisplayName +// +//! DESCRIPTION: This API retrieves the Display Id of a given display by +//! display name. The display must be active to retrieve the +//! displayId. In the case of clone mode or Surround gaming, +//! the primary or top-left display will be returned. +//! +//! \param [in] displayName Name of display (Eg: "\\DISPLAY1" to +//! retrieve the displayId for. +//! \param [out] displayId Display ID of the requested display. +//! +//! retval ::NVAPI_OK: Capabilties have been returned. +//! retval ::NVAPI_INVALID_ARGUMENT: One or more args passed in are invalid. +//! retval ::NVAPI_API_NOT_INTIALIZED: The NvAPI API needs to be initialized first +//! retval ::NVAPI_NO_IMPLEMENTATION: This entrypoint not available +//! retval ::NVAPI_ERROR: Miscellaneous error occurred +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetDisplayIdByDisplayName(const char *displayName, NvU32* displayId); + + + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_GetDisplayConfig +// +//! DESCRIPTION: This API lets caller retrieve the current global display +//! configuration. +//! USAGE: The caller might have to call this three times to fetch all the required configuration details as follows: +//! First Pass: Caller should Call NvAPI_DISP_GetDisplayConfig() with pathInfo set to NULL to fetch pathInfoCount. +//! Second Pass: Allocate memory for pathInfo with respect to the number of pathInfoCount(from First Pass) to fetch +//! targetInfoCount. If sourceModeInfo is needed allocate memory or it can be initialized to NULL. +//! Third Pass(Optional, only required if target information is required): Allocate memory for targetInfo with respect +//! to number of targetInfoCount(from Second Pass). +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in,out] pathInfoCount Number of elements in pathInfo array, returns number of valid topologies, this cannot be null. +//! \param [in,out] pathInfo Array of path information +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. If there are return error codes with +//! specific meaning for this API, they are listed below. +//! +//! \retval NVAPI_INVALID_ARGUMENT - Invalid input parameter. Following can be the reason for this return value: +//! -# pathInfoCount is NULL. +//! -# *pathInfoCount is 0 and pathInfo is not NULL. +//! -# *pathInfoCount is not 0 and pathInfo is NULL. +//! \retval NVAPI_DEVICE_BUSY - ModeSet has not yet completed. Please wait and call it again. +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetDisplayConfig(__inout NvU32 *pathInfoCount, __out_ecount_full_opt(*pathInfoCount) NV_DISPLAYCONFIG_PATH_INFO *pathInfo); + + + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_DISP_SetDisplayConfig +// +// +//! DESCRIPTION: This API lets caller apply a global display configuration +//! across multiple GPUs. +//! +//! If all sourceIds are zero, then NvAPI will pick up sourceId's based on the following criteria : +//! - If user provides sourceModeInfo then we are trying to assign 0th sourceId always to GDIPrimary. +//! This is needed since active windows always moves along with 0th sourceId. +//! - For rest of the paths, we are incrementally assigning the sourceId per adapter basis. +//! - If user doesn't provide sourceModeInfo then NVAPI just picks up some default sourceId's in incremental order. +//! Note : NVAPI will not intelligently choose the sourceIDs for any configs that does not need a modeset. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] pathInfoCount Number of supplied elements in pathInfo +//! \param [in] pathInfo Array of path information +//! \param [in] flags Flags for applying settings +//! +//! \retval ::NVAPI_OK - completed request +//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized +//! \retval ::NVAPI_ERROR - miscellaneous error occurred +//! \retval ::NVAPI_INVALID_ARGUMENT - Invalid input parameter. +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_SetDisplayConfig(__in NvU32 pathInfoCount, __in_ecount(pathInfoCount) NV_DISPLAYCONFIG_PATH_INFO* pathInfo, __in NvU32 flags); + + + + + +//////////////////////////////////////////////////////////////////////////////////////// +// +// MOSAIC allows a multi display target output scanout on a single source. +// +// SAMPLE of MOSAIC 1x4 topo with 8 pixel horizontal overlap +// +//+-------------------------++-------------------------++-------------------------++-------------------------+ +//| || || || | +//| || || || | +//| || || || | +//| DVI1 || DVI2 || DVI3 || DVI4 | +//| || || || | +//| || || || | +//| || || || | +//| || || || | +//+-------------------------++-------------------------++-------------------------++-------------------------+ + + +//! \addtogroup mosaicapi +//! @{ + +#define NVAPI_MAX_MOSAIC_DISPLAY_ROWS 8 +#define NVAPI_MAX_MOSAIC_DISPLAY_COLUMNS 8 +// +// These bits are used to describe the validity of a topo. +// +#define NV_MOSAIC_TOPO_VALIDITY_VALID 0x00000000 //!< The topology is valid +#define NV_MOSAIC_TOPO_VALIDITY_MISSING_GPU 0x00000001 //!< Not enough SLI GPUs were found to fill the entire + //! topology. hPhysicalGPU will be 0 for these. +#define NV_MOSAIC_TOPO_VALIDITY_MISSING_DISPLAY 0x00000002 //!< Not enough displays were found to fill the entire + //! topology. displayOutputId will be 0 for these. +#define NV_MOSAIC_TOPO_VALIDITY_MIXED_DISPLAY_TYPES 0x00000004 //!< The topoogy is only possible with displays of the same + //! NV_GPU_OUTPUT_TYPE. Check displayOutputIds to make + //! sure they are all CRTs, or all DFPs. + + +// +//! This structure defines the topology details. +typedef struct +{ + NvU32 version; //!< Version of this structure + NvLogicalGpuHandle hLogicalGPU; //!< Logical GPU for this topology + NvU32 validityMask; //!< 0 means topology is valid with the current hardware. + //! If not 0, inspect bits against NV_MOSAIC_TOPO_VALIDITY_*. + NvU32 rowCount; //!< Number of displays in a row + NvU32 colCount; //!< Number of displays in a column + + struct + { + NvPhysicalGpuHandle hPhysicalGPU; //!< Physical GPU to be used in the topology (0 if GPU missing) + NvU32 displayOutputId; //!< Connected display target (0 if no display connected) + NvS32 overlapX; //!< Pixels of overlap on left of target: (+overlap, -gap) + NvS32 overlapY; //!< Pixels of overlap on top of target: (+overlap, -gap) + + } gpuLayout[NVAPI_MAX_MOSAIC_DISPLAY_ROWS][NVAPI_MAX_MOSAIC_DISPLAY_COLUMNS]; + +} NV_MOSAIC_TOPO_DETAILS; + +//! Macro for constructing te vesion field of NV_MOSAIC_TOPO_DETAILS +#define NVAPI_MOSAIC_TOPO_DETAILS_VER MAKE_NVAPI_VERSION(NV_MOSAIC_TOPO_DETAILS,1) + + +// +//! These values refer to the different types of Mosaic topologies that are possible. When +//! getting the supported Mosaic topologies, you can specify one of these types to narrow down +//! the returned list to only those that match the given type. +typedef enum +{ + NV_MOSAIC_TOPO_TYPE_ALL, //!< All mosaic topologies + NV_MOSAIC_TOPO_TYPE_BASIC, //!< Basic Mosaic topologies + NV_MOSAIC_TOPO_TYPE_PASSIVE_STEREO, //!< Passive Stereo topologies + NV_MOSAIC_TOPO_TYPE_SCALED_CLONE, //!< Not supported at this time + NV_MOSAIC_TOPO_TYPE_PASSIVE_STEREO_SCALED_CLONE, //!< Not supported at this time + NV_MOSAIC_TOPO_TYPE_MAX, //!< Always leave this at end of the enum +} NV_MOSAIC_TOPO_TYPE; + + +// +//! This is a complete list of supported Mosaic topologies. +//! +//! Using a "Basic" topology combines multiple monitors to create a single desktop. +//! +//! Using a "Passive" topology combines multiples monitors to create a passive stereo desktop. +//! In passive stereo, two identical topologies combine - one topology is used for the right eye and the other identical //! topology (targeting different displays) is used for the left eye. \n +//! NOTE: common\inc\nvEscDef.h shadows a couple PASSIVE_STEREO enums. If this +//! enum list changes and effects the value of NV_MOSAIC_TOPO_BEGIN_PASSIVE_STEREO +//! please update the corresponding value in nvEscDef.h +typedef enum +{ + NV_MOSAIC_TOPO_NONE, + + // 'BASIC' topos start here + // + // The result of using one of these Mosaic topos is that multiple monitors + // will combine to create a single desktop. + // + NV_MOSAIC_TOPO_BEGIN_BASIC, + NV_MOSAIC_TOPO_1x2_BASIC = NV_MOSAIC_TOPO_BEGIN_BASIC, + NV_MOSAIC_TOPO_2x1_BASIC, + NV_MOSAIC_TOPO_1x3_BASIC, + NV_MOSAIC_TOPO_3x1_BASIC, + NV_MOSAIC_TOPO_1x4_BASIC, + NV_MOSAIC_TOPO_4x1_BASIC, + NV_MOSAIC_TOPO_2x2_BASIC, + NV_MOSAIC_TOPO_2x3_BASIC, + NV_MOSAIC_TOPO_2x4_BASIC, + NV_MOSAIC_TOPO_3x2_BASIC, + NV_MOSAIC_TOPO_4x2_BASIC, + NV_MOSAIC_TOPO_1x5_BASIC, + NV_MOSAIC_TOPO_1x6_BASIC, + NV_MOSAIC_TOPO_7x1_BASIC, + + // Add padding for 10 more entries. 6 will be enough room to specify every + // possible topology with 8 or fewer displays, so this gives us a little + // extra should we need it. + NV_MOSAIC_TOPO_END_BASIC = NV_MOSAIC_TOPO_7x1_BASIC + 9, + + // 'PASSIVE_STEREO' topos start here + // + // The result of using one of these Mosaic topos is that multiple monitors + // will combine to create a single PASSIVE STEREO desktop. What this means is + // that there will be two topos that combine to create the overall desktop. + // One topo will be used for the left eye, and the other topo (of the + // same rows x cols), will be used for the right eye. The difference between + // the two topos is that different GPUs and displays will be used. + // + NV_MOSAIC_TOPO_BEGIN_PASSIVE_STEREO, // value shadowed in nvEscDef.h + NV_MOSAIC_TOPO_1x2_PASSIVE_STEREO = NV_MOSAIC_TOPO_BEGIN_PASSIVE_STEREO, + NV_MOSAIC_TOPO_2x1_PASSIVE_STEREO, + NV_MOSAIC_TOPO_1x3_PASSIVE_STEREO, + NV_MOSAIC_TOPO_3x1_PASSIVE_STEREO, + NV_MOSAIC_TOPO_1x4_PASSIVE_STEREO, + NV_MOSAIC_TOPO_4x1_PASSIVE_STEREO, + NV_MOSAIC_TOPO_2x2_PASSIVE_STEREO, + NV_MOSAIC_TOPO_END_PASSIVE_STEREO = NV_MOSAIC_TOPO_2x2_PASSIVE_STEREO + 4, + + + // + // Total number of topos. Always leave this at the end of the enumeration. + // + NV_MOSAIC_TOPO_MAX //! Total number of topologies. + +} NV_MOSAIC_TOPO; + + +// +//! This is a "topology brief" structure. It tells you what you need to know about +//! a topology at a high level. A list of these is returned when you query for the +//! supported Mosaic information. +//! +//! If you need more detailed information about the topology, call +//! NvAPI_Mosaic_GetTopoGroup() with the topology value from this structure. +typedef struct +{ + NvU32 version; //!< Version of this structure + NV_MOSAIC_TOPO topo; //!< The topology + NvU32 enabled; //!< 1 if topo is enabled, else 0 + NvU32 isPossible; //!< 1 if topo *can* be enabled, else 0 + +} NV_MOSAIC_TOPO_BRIEF; + +//! Macro for constructing the version field of NV_MOSAIC_TOPO_BRIEF +#define NVAPI_MOSAIC_TOPO_BRIEF_VER MAKE_NVAPI_VERSION(NV_MOSAIC_TOPO_BRIEF,1) + + +// +//! Basic per-display settings that are used in setting/getting the Mosaic mode +typedef struct _NV_MOSAIC_DISPLAY_SETTING_V1 +{ + NvU32 version; //!< Version of this structure + NvU32 width; //!< Per-display width + NvU32 height; //!< Per-display height + NvU32 bpp; //!< Bits per pixel + NvU32 freq; //!< Display frequency +} NV_MOSAIC_DISPLAY_SETTING_V1; + +typedef struct NV_MOSAIC_DISPLAY_SETTING_V2 +{ + NvU32 version; //!< Version of this structure + NvU32 width; //!< Per-display width + NvU32 height; //!< Per-display height + NvU32 bpp; //!< Bits per pixel + NvU32 freq; //!< Display frequency + NvU32 rrx1k; //!< Display frequency in x1k +} NV_MOSAIC_DISPLAY_SETTING_V2; + +typedef NV_MOSAIC_DISPLAY_SETTING_V2 NV_MOSAIC_DISPLAY_SETTING; + +//! Macro for constructing the version field of NV_MOSAIC_DISPLAY_SETTING +#define NVAPI_MOSAIC_DISPLAY_SETTING_VER1 MAKE_NVAPI_VERSION(NV_MOSAIC_DISPLAY_SETTING_V1,1) +#define NVAPI_MOSAIC_DISPLAY_SETTING_VER2 MAKE_NVAPI_VERSION(NV_MOSAIC_DISPLAY_SETTING_V2,2) +#define NVAPI_MOSAIC_DISPLAY_SETTING_VER NVAPI_MOSAIC_DISPLAY_SETTING_VER2 + + +// +// Set a reasonable max number of display settings to support +// so arrays are bound. +// +#define NV_MOSAIC_DISPLAY_SETTINGS_MAX 40 //!< Set a reasonable maximum number of display settings to support + //! so arrays are bound. + + +// +//! This structure is used to contain a list of supported Mosaic topologies +//! along with the display settings that can be used. +typedef struct _NV_MOSAIC_SUPPORTED_TOPO_INFO_V1 +{ + NvU32 version; //!< Version of this structure + NvU32 topoBriefsCount; //!< Number of topologies in below array + NV_MOSAIC_TOPO_BRIEF topoBriefs[NV_MOSAIC_TOPO_MAX]; //!< List of supported topologies with only brief details + NvU32 displaySettingsCount; //!< Number of display settings in below array + NV_MOSAIC_DISPLAY_SETTING_V1 displaySettings[NV_MOSAIC_DISPLAY_SETTINGS_MAX]; //!< List of per display settings possible + +} NV_MOSAIC_SUPPORTED_TOPO_INFO_V1; + +typedef struct _NV_MOSAIC_SUPPORTED_TOPO_INFO_V2 +{ + NvU32 version; //!< Version of this structure + NvU32 topoBriefsCount; //!< Number of topologies in below array + NV_MOSAIC_TOPO_BRIEF topoBriefs[NV_MOSAIC_TOPO_MAX]; //!< List of supported topologies with only brief details + NvU32 displaySettingsCount; //!< Number of display settings in below array + NV_MOSAIC_DISPLAY_SETTING_V2 displaySettings[NV_MOSAIC_DISPLAY_SETTINGS_MAX]; //!< List of per display settings possible + +} NV_MOSAIC_SUPPORTED_TOPO_INFO_V2; + +typedef NV_MOSAIC_SUPPORTED_TOPO_INFO_V2 NV_MOSAIC_SUPPORTED_TOPO_INFO; + +//! Macro forconstructing the version field of NV_MOSAIC_SUPPORTED_TOPO_INFO +#define NVAPI_MOSAIC_SUPPORTED_TOPO_INFO_VER1 MAKE_NVAPI_VERSION(NV_MOSAIC_SUPPORTED_TOPO_INFO_V1,1) +#define NVAPI_MOSAIC_SUPPORTED_TOPO_INFO_VER2 MAKE_NVAPI_VERSION(NV_MOSAIC_SUPPORTED_TOPO_INFO_V2,2) +#define NVAPI_MOSAIC_SUPPORTED_TOPO_INFO_VER NVAPI_MOSAIC_SUPPORTED_TOPO_INFO_VER2 + + +// +// Indices to use to access the topos array within the mosaic topology +#define NV_MOSAIC_TOPO_IDX_DEFAULT 0 + +#define NV_MOSAIC_TOPO_IDX_LEFT_EYE 0 +#define NV_MOSAIC_TOPO_IDX_RIGHT_EYE 1 +#define NV_MOSAIC_TOPO_NUM_EYES 2 + + +// +//! This defines the maximum number of topos that can be in a topo group. +//! At this time, it is set to 2 because our largest topo group (passive +//! stereo) only needs 2 topos (left eye and right eye). +//! +//! If a new topo group with more than 2 topos is added above, then this +//! number will also have to be incremented. +#define NV_MOSAIC_MAX_TOPO_PER_TOPO_GROUP 2 + + +// +//! This structure defines a group of topologies that work together to create one +//! overall layout. All of the supported topologies are represented with this +//! structure. +//! +//! For example, a 'Passive Stereo' topology would be represented with this +//! structure, and would have separate topology details for the left and right eyes. +//! The count would be 2. A 'Basic' topology is also represented by this structure, +//! with a count of 1. +//! +//! The structure is primarily used internally, but is exposed to applications in a +//! read-only fashion because there are some details in it that might be useful +//! (like the number of rows/cols, or connected display information). A user can +//! get the filled-in structure by calling NvAPI_Mosaic_GetTopoGroup(). +//! +//! You can then look at the detailed values within the structure. There are no +//! entrypoints which take this structure as input (effectively making it read-only). +typedef struct +{ + NvU32 version; //!< Version of this structure + NV_MOSAIC_TOPO_BRIEF brief; //!< The brief details of this topo + NvU32 count; //!< Number of topos in array below + NV_MOSAIC_TOPO_DETAILS topos[NV_MOSAIC_MAX_TOPO_PER_TOPO_GROUP]; + +} NV_MOSAIC_TOPO_GROUP; + +//! Macro for constructing the version field of NV_MOSAIC_TOPO_GROUP +#define NVAPI_MOSAIC_TOPO_GROUP_VER MAKE_NVAPI_VERSION(NV_MOSAIC_TOPO_GROUP,1) + +//! @} + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_GetSupportedTopoInfo +// +//! DESCRIPTION: This API returns information on the topologies and display resolutions +//! supported by Mosaic mode. +//! +//! NOTE: Not all topologies returned can be set immediately. +//! See 'OUT' Notes below. +//! +//! Once you get the list of supported topologies, you can call +//! NvAPI_Mosaic_GetTopoGroup() with one of the Mosaic topologies if you need +//! more information about it. +//! +//! 'IN' Notes: pSupportedTopoInfo->version must be set before calling this function. +//! If the specified version is not supported by this implementation, +//! an error will be returned (NVAPI_INCOMPATIBLE_STRUCT_VERSION). +//! +//! 'OUT' Notes: Some of the topologies returned might not be valid for one reason or +//! another. It could be due to mismatched or missing displays. It +//! could also be because the required number of GPUs is not found. +//! At a high level, you can see if the topology is valid and can be enabled +//! by looking at the pSupportedTopoInfo->topoBriefs[xxx].isPossible flag. +//! If this is true, the topology can be enabled. If it +//! is false, you can find out why it cannot be enabled by getting the +//! details of the topology via NvAPI_Mosaic_GetTopoGroup(). From there, +//! look at the validityMask of the individual topologies. The bits can +//! be tested against the NV_MOSAIC_TOPO_VALIDITY_* bits. +//! +//! It is possible for this function to return NVAPI_OK with no topologies +//! listed in the return structure. If this is the case, it means that +//! the current hardware DOES support Mosaic, but with the given configuration +//! no valid topologies were found. This most likely means that SLI was not +//! enabled for the hardware. Once enabled, you should see valid topologies +//! returned from this function. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! +//! \param [in,out] pSupportedTopoInfo Information about what topologies and display resolutions +//! are supported for Mosaic. +//! \param [in] type The type of topologies the caller is interested in +//! getting. See NV_MOSAIC_TOPO_TYPE for possible values. +//! +//! \retval ::NVAPI_OK No errors in returning supported topologies. +//! \retval ::NVAPI_NOT_SUPPORTED Mosaic is not supported with the existing hardware. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more arguments passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first. +//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the structure passed in is not +// compatible with this entry point. +//! \retval ::NVAPI_ERROR: Miscellaneous error occurred. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_GetSupportedTopoInfo(NV_MOSAIC_SUPPORTED_TOPO_INFO *pSupportedTopoInfo, NV_MOSAIC_TOPO_TYPE type); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_GetTopoGroup +// +//! DESCRIPTION: This API returns a structure filled with the details +//! of the specified Mosaic topology. +//! +//! If the pTopoBrief passed in matches the current topology, +//! then information in the brief and group structures +//! will reflect what is current. Thus the brief would have +//! the current 'enable' status, and the group would have the +//! current overlap values. If there is no match, then the +//! returned brief has an 'enable' status of FALSE (since it +//! is obviously not enabled), and the overlap values will be 0. +//! +//! 'IN' Notes: pTopoGroup->version must be set before calling this function. +//! If the specified version is not supported by this implementation, +//! an error will be returned (NVAPI_INCOMPATIBLE_STRUCT_VERSION). +//! +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] pTopoBrief The topology for getting the details +//! This must be one of the topology briefs +//! returned from NvAPI_Mosaic_GetSupportedTopoInfo(). +//! \param [in,out] pTopoGroup The topology details matching the brief +//! +//! \retval ::NVAPI_OK Details were retrieved successfully. +//! \retval ::NVAPI_NOT_SUPPORTED Mosaic is not supported with the existing hardware. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more argumentss passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first. +//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the structure passed in is not +// compatible with this entry point. +//! \retval ::NVAPI_ERROR: Miscellaneous error occurred. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_GetTopoGroup(NV_MOSAIC_TOPO_BRIEF *pTopoBrief, NV_MOSAIC_TOPO_GROUP *pTopoGroup); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_GetOverlapLimits +// +//! DESCRIPTION: This API returns the X and Y overlap limits required if +//! the given Mosaic topology and display settings are to be used. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] pTopoBrief The topology for getting limits +//! This must be one of the topo briefs +//! returned from NvAPI_Mosaic_GetSupportedTopoInfo(). +//! \param [in] pDisplaySetting The display settings for getting the limits. +//! This must be one of the settings +//! returned from NvAPI_Mosaic_GetSupportedTopoInfo(). +//! \param [out] pMinOverlapX X overlap minimum +//! \param [out] pMaxOverlapX X overlap maximum +//! \param [out] pMinOverlapY Y overlap minimum +//! \param [out] pMaxOverlapY Y overlap maximum +//! +//! \retval ::NVAPI_OK Details were retrieved successfully. +//! \retval ::NVAPI_NOT_SUPPORTED Mosaic is not supported with the existing hardware. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more argumentss passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first. +//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the structure passed in is not +//! compatible with this entry point. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_GetOverlapLimits(NV_MOSAIC_TOPO_BRIEF *pTopoBrief, NV_MOSAIC_DISPLAY_SETTING *pDisplaySetting, NvS32 *pMinOverlapX, NvS32 *pMaxOverlapX, NvS32 *pMinOverlapY, NvS32 *pMaxOverlapY); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_SetCurrentTopo +// +//! DESCRIPTION: This API sets the Mosaic topology and performs a mode switch +//! using the given display settings. +//! +//! If NVAPI_OK is returned, the current Mosaic topology was set +//! correctly. Any other status returned means the +//! topology was not set, and remains what it was before this +//! function was called. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] pTopoBrief The topology to set. This must be one of the topologies returned from +//! NvAPI_Mosaic_GetSupportedTopoInfo(), and it must have an isPossible value of 1. +//! \param [in] pDisplaySetting The per display settings to be used in the Mosaic mode. This must be one of the +//! settings returned from NvAPI_Mosaic_GetSupportedTopoInfo(). +//! \param [in] overlapX The pixel overlap to use between horizontal displays (use positive a number for +//! overlap, or a negative number to create a gap.) If the overlap is out of bounds +//! for what is possible given the topo and display setting, the overlap will be clamped. +//! \param [in] overlapY The pixel overlap to use between vertical displays (use positive a number for +//! overlap, or a negative number to create a gap.) If the overlap is out of bounds for +//! what is possible given the topo and display setting, the overlap will be clamped. +//! \param [in] enable If 1, the topology being set will also be enabled, meaning that the mode set will +//! occur. \n +//! If 0, you don't want to be in Mosaic mode right now, but want to set the current +//! Mosaic topology so you can enable it later with NvAPI_Mosaic_EnableCurrentTopo(). +//! +//! \retval ::NVAPI_OK The Mosaic topology was set. +//! \retval ::NVAPI_NOT_SUPPORTED Mosaic is not supported with the existing hardware. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more argumentss passed in are invalid. +//! \retval ::NVAPI_TOPO_NOT_POSSIBLE The topology passed in is not currently possible. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first. +//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the structure passed in is not +//! compatible with this entrypoint. +//! \retval ::NVAPI_MODE_CHANGE_FAILED There was an error changing the display mode. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_SetCurrentTopo(NV_MOSAIC_TOPO_BRIEF *pTopoBrief, NV_MOSAIC_DISPLAY_SETTING *pDisplaySetting, NvS32 overlapX, NvS32 overlapY, NvU32 enable); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_GetCurrentTopo +// +//! DESCRIPTION: This API returns information for the current Mosaic topology. +//! This includes topology, display settings, and overlap values. +//! +//! You can call NvAPI_Mosaic_GetTopoGroup() with the topology +//! if you require more information. +//! +//! If there isn't a current topology, then pTopoBrief->topo will +//! be NV_MOSAIC_TOPO_NONE. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \param [out] pTopoBrief The current Mosaic topology +//! \param [out] pDisplaySetting The current per-display settings +//! \param [out] pOverlapX The pixel overlap between horizontal displays +//! \param [out] pOverlapY The pixel overlap between vertical displays +//! +//! \retval ::NVAPI_OK Success getting current info. +//! \retval ::NVAPI_NOT_SUPPORTED Mosaic is not supported with the existing hardware. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more argumentss passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first. +//! \retval ::NVAPI_NO_IMPLEMENTATION This entry point not available. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_GetCurrentTopo(NV_MOSAIC_TOPO_BRIEF *pTopoBrief, NV_MOSAIC_DISPLAY_SETTING *pDisplaySetting, NvS32 *pOverlapX, NvS32 *pOverlapY); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_EnableCurrentTopo +// +//! DESCRIPTION: This API enables or disables the current Mosaic topology +//! based on the setting of the incoming 'enable' parameter. +//! +//! An "enable" setting enables the current (previously set) Mosaic topology. +//! Note that when the current Mosaic topology is retrieved, it must have an isPossible value of 1 or +//! an error will occur. +//! +//! A "disable" setting disables the current Mosaic topology. +//! The topology information will persist, even across reboots. +//! To re-enable the Mosaic topology, call this function +//! again with the enable parameter set to 1. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] enable 1 to enable the current Mosaic topo, 0 to disable it. +//! +//! \retval ::NVAPI_OK The Mosaic topo was enabled/disabled. +//! \retval ::NVAPI_NOT_SUPPORTED Mosaic is not supported with the existing hardware. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more arguments passed in are invalid. +//! \retval ::NVAPI_TOPO_NOT_POSSIBLE The current topology is not currently possible. +//! \retval ::NVAPI_MODE_CHANGE_FAILED There was an error changing the display mode. +//! \retval ::NVAPI_ERROR: Miscellaneous error occurred. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_EnableCurrentTopo(NvU32 enable); + +//! \ingroup mosaicapi +//! @{ +typedef struct _NV_MOSAIC_GRID_TOPO_DISPLAY_V1 +{ + NvU32 displayId; //!< DisplayID of the display + NvS32 overlapX; //!< (+overlap, -gap) + NvS32 overlapY; //!< (+overlap, -gap) + NV_ROTATE rotation; //!< Rotation of display + NvU32 cloneGroup; //!< Reserved, must be 0 +} NV_MOSAIC_GRID_TOPO_DISPLAY_V1; + +typedef enum _NV_PIXEL_SHIFT_TYPE +{ + NV_PIXEL_SHIFT_TYPE_NO_PIXEL_SHIFT = 0, //!< No pixel shift will be applied to this display. + NV_PIXEL_SHIFT_TYPE_2x2_TOP_LEFT_PIXELS = 1, //!< This display will be used to scanout top left pixels in 2x2 PixelShift configuration + NV_PIXEL_SHIFT_TYPE_2x2_BOTTOM_RIGHT_PIXELS = 2, //!< This display will be used to scanout bottom right pixels in 2x2 PixelShift configuration +} NV_PIXEL_SHIFT_TYPE; + +typedef struct _NV_MOSAIC_GRID_TOPO_DISPLAY_V2 +{ + NvU32 version; //!< Version of this structure + + NvU32 displayId; //!< DisplayID of the display + NvS32 overlapX; //!< (+overlap, -gap) + NvS32 overlapY; //!< (+overlap, -gap) + NV_ROTATE rotation; //!< Rotation of display + NvU32 cloneGroup; //!< Reserved, must be 0 + NV_PIXEL_SHIFT_TYPE pixelShiftType; //!< Type of the pixel shift enabled display +} NV_MOSAIC_GRID_TOPO_DISPLAY_V2; + +#ifndef NV_MOSAIC_GRID_TOPO_DISPLAY_VER + +typedef NV_MOSAIC_GRID_TOPO_DISPLAY_V1 NV_MOSAIC_GRID_TOPO_DISPLAY; + +#endif + +typedef struct _NV_MOSAIC_GRID_TOPO_V1 +{ + NvU32 version; //!< Version of this structure + NvU32 rows; //!< Number of rows + NvU32 columns; //!< Number of columns + NvU32 displayCount; //!< Number of display details + NvU32 applyWithBezelCorrect : 1; //!< When enabling and doing the modeset, do we switch to the bezel-corrected resolution + NvU32 immersiveGaming : 1; //!< Enable as immersive gaming instead of Mosaic SLI (for Quadro-boards only) + NvU32 baseMosaic : 1; //!< Enable as Base Mosaic (Panoramic) instead of Mosaic SLI (for NVS and Quadro-boards only) + NvU32 driverReloadAllowed : 1; //!< If necessary, reloading the driver is permitted (for Vista and above only). Will not be persisted. Value undefined on get. + NvU32 acceleratePrimaryDisplay : 1; //!< Enable SLI acceleration on the primary display while in single-wide mode (For Immersive Gaming only). Will not be persisted. Value undefined on get. + NvU32 reserved : 27; //!< Reserved, must be 0 + NV_MOSAIC_GRID_TOPO_DISPLAY_V1 displays[NV_MOSAIC_MAX_DISPLAYS]; //!< Displays are done as [(row * columns) + column] + NV_MOSAIC_DISPLAY_SETTING_V1 displaySettings; //!< Display settings +} NV_MOSAIC_GRID_TOPO_V1; + +typedef struct _NV_MOSAIC_GRID_TOPO_V2 +{ + NvU32 version; //!< Version of this structure + NvU32 rows; //!< Number of rows + NvU32 columns; //!< Number of columns + NvU32 displayCount; //!< Number of display details + NvU32 applyWithBezelCorrect : 1; //!< When enabling and doing the modeset, do we switch to the bezel-corrected resolution + NvU32 immersiveGaming : 1; //!< Enable as immersive gaming instead of Mosaic SLI (for Quadro-boards only) + NvU32 baseMosaic : 1; //!< Enable as Base Mosaic (Panoramic) instead of Mosaic SLI (for NVS and Quadro-boards only) + NvU32 driverReloadAllowed : 1; //!< If necessary, reloading the driver is permitted (for Vista and above only). Will not be persisted. Value undefined on get. + NvU32 acceleratePrimaryDisplay : 1; //!< Enable SLI acceleration on the primary display while in single-wide mode (For Immersive Gaming only). Will not be persisted. Value undefined on get. + NvU32 pixelShift : 1; //!< Enable Pixel shift + NvU32 reserved : 26; //!< Reserved, must be 0 + NV_MOSAIC_GRID_TOPO_DISPLAY_V2 displays[NV_MOSAIC_MAX_DISPLAYS]; //!< Displays are done as [(row * columns) + column] + NV_MOSAIC_DISPLAY_SETTING_V1 displaySettings; //!< Display settings +} NV_MOSAIC_GRID_TOPO_V2; + +//! Macro for constructing the version field of ::NV_MOSAIC_GRID_TOPO +#define NV_MOSAIC_GRID_TOPO_VER1 MAKE_NVAPI_VERSION(NV_MOSAIC_GRID_TOPO_V1,1) +#define NV_MOSAIC_GRID_TOPO_VER2 MAKE_NVAPI_VERSION(NV_MOSAIC_GRID_TOPO_V2,2) +#ifndef NV_MOSAIC_GRID_TOPO_VER + +typedef NV_MOSAIC_GRID_TOPO_V2 NV_MOSAIC_GRID_TOPO; + +//! Macro for constructing the version field of ::NV_MOSAIC_GRID_TOPO +#define NV_MOSAIC_GRID_TOPO_VER NV_MOSAIC_GRID_TOPO_VER2 + +#endif + +//! @} + +//! since Release R290 + +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_DISPLAY_ON_INVALID_GPU NV_BIT(0) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_DISPLAY_ON_WRONG_CONNECTOR NV_BIT(1) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_NO_COMMON_TIMINGS NV_BIT(2) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_NO_EDID_AVAILABLE NV_BIT(3) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_MISMATCHED_OUTPUT_TYPE NV_BIT(4) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_NO_DISPLAY_CONNECTED NV_BIT(5) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_NO_GPU_TOPOLOGY NV_BIT(6) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_NOT_SUPPORTED NV_BIT(7) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_NO_SLI_BRIDGE NV_BIT(8) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_ECC_ENABLED NV_BIT(9) +#define NV_MOSAIC_DISPLAYCAPS_PROBLEM_GPU_TOPOLOGY_NOT_SUPPORTED NV_BIT(10) + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_SetDisplayGrids +// +//! DESCRIPTION: Sets a new display topology, replacing any existing topologies +//! that use the same displays. +//! +//! This function will look for an SLI configuration that will +//! allow the display topology to work. +//! +//! To revert to a single display, specify that display as a 1x1 +//! grid. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] pGridTopologies The topology details to set. +//! \param [in] gridCount The number of elements in the pGridTopologies array. +//! \param [in] setTopoFlags Zero or more of the NVAPI_MOSAIC_SETDISPLAYTOPO_FLAG_* +//! flags. +//! +//! +//! \retval ::NVAPI_OK Capabilities have been returned. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more args passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first +//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available +//! \retval ::NVAPI_NO_ACTIVE_SLI_TOPOLOGY No matching GPU topologies could be found. +//! \retval ::NVAPI_TOPO_NOT_POSSIBLE One or more of the display grids are not valid. +//! \retval ::NVAPI_ERROR Miscellaneous error occurred +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// + + +//! Do not change the current GPU topology. If the NO_DRIVER_RELOAD bit is not +//! specified, then it may still require a driver reload. +#define NV_MOSAIC_SETDISPLAYTOPO_FLAG_CURRENT_GPU_TOPOLOGY NV_BIT(0) + +//! Do not allow a driver reload. That is, stick with the same master GPU as well as the +//! same SLI configuration. +#define NV_MOSAIC_SETDISPLAYTOPO_FLAG_NO_DRIVER_RELOAD NV_BIT(1) + +//! When choosing a GPU topology, choose the topology with the best performance. +//! Without this flag, it will choose the topology that uses the smallest number +//! of GPU's. +#define NV_MOSAIC_SETDISPLAYTOPO_FLAG_MAXIMIZE_PERFORMANCE NV_BIT(2) + +//! Do not return an error if no configuration will work with all of the grids. +#define NV_MOSAIC_SETDISPLAYTOPO_FLAG_ALLOW_INVALID NV_BIT(3) + +NVAPI_INTERFACE NvAPI_Mosaic_SetDisplayGrids(__in_ecount(gridCount) NV_MOSAIC_GRID_TOPO *pGridTopologies, __in NvU32 gridCount, __in NvU32 setTopoFlags); + + +//! \ingroup mosaicapi +//! Indicates that a display's position in the grid is sub-optimal. +#define NV_MOSAIC_DISPLAYTOPO_WARNING_DISPLAY_POSITION NV_BIT(0) + +//! \ingroup mosaicapi +//! Indicates that SetDisplaySettings would need to perform a driver reload. +#define NV_MOSAIC_DISPLAYTOPO_WARNING_DRIVER_RELOAD_REQUIRED NV_BIT(1) + +//! \ingroup mosaicapi +typedef struct +{ + NvU32 version; + NvU32 errorFlags; //!< (OUT) Any of the NV_MOSAIC_DISPLAYTOPO_ERROR_* flags. + NvU32 warningFlags; //!< (OUT) Any of the NV_MOSAIC_DISPLAYTOPO_WARNING_* flags. + + NvU32 displayCount; //!< (OUT) The number of valid entries in the displays array. + struct + { + NvU32 displayId; //!< (OUT) The DisplayID of this display. + NvU32 errorFlags; //!< (OUT) Any of the NV_MOSAIC_DISPLAYCAPS_PROBLEM_* flags. + NvU32 warningFlags; //!< (OUT) Any of the NV_MOSAIC_DISPLAYTOPO_WARNING_* flags. + + NvU32 supportsRotation : 1; //!< (OUT) This display can be rotated + NvU32 reserved : 31; //!< (OUT) reserved + } displays[NVAPI_MAX_DISPLAYS]; +} NV_MOSAIC_DISPLAY_TOPO_STATUS; + +//! \ingroup mosaicapi +#define NV_MOSAIC_DISPLAY_TOPO_STATUS_VER MAKE_NVAPI_VERSION(NV_MOSAIC_DISPLAY_TOPO_STATUS,1) + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_ValidateDisplayGrids +// +//! DESCRIPTION: Determines if a list of grid topologies is valid. It will choose an SLI +//! configuration in the same way that NvAPI_Mosaic_SetDisplayGrids() does. +//! +//! On return, each element in the pTopoStatus array will contain any errors or +//! warnings about each grid topology. If any error flags are set, then the topology +//! is not valid. If any warning flags are set, then the topology is valid, but +//! sub-optimal. +//! +//! If the ALLOW_INVALID flag is set, then it will continue to validate the grids +//! even if no SLI configuration will allow all of the grids. In this case, a grid +//! grid with no matching GPU topology will have the error +//! flags NO_GPU_TOPOLOGY or NOT_SUPPORTED set. +//! +//! If the ALLOW_INVALID flag is not set and no matching SLI configuration is +//! found, then it will skip the rest of the validation and return +//! NVAPI_NO_ACTIVE_SLI_TOPOLOGY. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] setTopoFlags Zero or more of the NVAPI_MOSAIC_SETDISPLAYTOPO_FLAG_* +//! flags. +//! \param [in] pGridTopologies The array of grid topologies to verify. +//! \param [in,out] pTopoStatus The array of problems and warnings with each grid topology. +//! \param [in] gridCount The number of elements in the pGridTopologies and +//! pTopoStatus arrays. +//! +//! +//! \retval ::NVAPI_OK: Capabilities have been returned. +//! \retval ::NVAPI_INVALID_ARGUMENT: One or more args passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED: The NvAPI API needs to be initialized first +//! \retval ::NVAPI_NO_IMPLEMENTATION: This entrypoint not available +//! \retval ::NVAPI_NO_ACTIVE_SLI_TOPOLOGY: No matching GPU topologies could be found. +//! \retval ::NVAPI_ERROR: Miscellaneous error occurred +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_ValidateDisplayGrids(__in NvU32 setTopoFlags, + __in_ecount(gridCount) NV_MOSAIC_GRID_TOPO *pGridTopologies, + __inout_ecount_full(gridCount) NV_MOSAIC_DISPLAY_TOPO_STATUS *pTopoStatus, + __in NvU32 gridCount); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_EnumDisplayModes +// +//! DESCRIPTION: Determines the set of available display modes for a given grid topology. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] pGridTopology The grid topology to use. +//! \param [in,out] pDisplaySettings A pointer to an array of display settings to populate, +//! or NULL to find out the total number of available modes. +//! \param [in,out] pDisplayCount If pDisplaySettings is not NULL, then pDisplayCount +//! should point to the number of elements in the +//! pDisplaySettings array. On return, it will contain the +//! number of modes that were actually returned. If +//! pDisplaySettings is NULL, then pDisplayCount will receive +//! the total number of modes that are available. +//! +//! +//! \retval ::NVAPI_OK Capabilities have been returned. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more args passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first +//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available +//! \retval ::NVAPI_ERROR Miscellaneous error occurred +//! +//! \ingroup mosaciapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_EnumDisplayModes(__in NV_MOSAIC_GRID_TOPO *pGridTopology, + __inout_ecount_part_opt(*pDisplayCount, *pDisplayCount) NV_MOSAIC_DISPLAY_SETTING *pDisplaySettings, + __inout NvU32 *pDisplayCount); + + +//! SUPPORTED OS: Windows 7 and higher +//! +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_EnumDisplayGrids +// +//! DESCRIPTION: Enumerates the current active grid topologies. This includes Mosaic, IG, and +//! Panoramic topologies, as well as single displays. +//! +//! If pGridTopologies is NULL, then pGridCount will be set to the number of active +//! grid topologies. +//! +//! If pGridTopologies is not NULL, then pGridCount contains the maximum number of +//! grid topologies to return. On return, pGridCount will be set to the number of +//! grid topologies that were returned. +//! +//! \param [out] pGridTopologies The list of active grid topologies. +//! \param [in,out] pGridCount A pointer to the number of grid topologies returned. +//! +//! \retval ::NVAPI_OK Capabilties have been returned. +//! \retval ::NVAPI_END_ENUMERATION There are no more topologies to return. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more args passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first +//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available +//! \retval ::NVAPI_ERROR Miscellaneous error occurred +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_EnumDisplayGrids(__inout_ecount_part_opt(*pGridCount, *pGridCount) NV_MOSAIC_GRID_TOPO *pGridTopologies, + __inout NvU32 *pGridCount); + + +//////////////////////////////////////////////////////////////////////////////////////// +// +// ########################################################################### +// DELME_RUSS - DELME_RUSS - DELME_RUSS - DELME_RUSS - DELME_RUSS - DELME_RUSS +// +// Below is the Phase 1 Mosaic stuff, the Phase 2 stuff above is what will remain +// once Phase 2 is complete. For a small amount of time, the two will co-exist. As +// soon as apps (nvapichk, NvAPITestMosaic, and CPL) are updated to use the Phase 2 +// entrypoints, the code below will be deleted. +// +// DELME_RUSS - DELME_RUSS - DELME_RUSS - DELME_RUSS - DELME_RUSS - DELME_RUSS +// ########################################################################### +// +// Supported topos 1x4, 4x1 and 2x2 to start with. +// +// Selected scan out targets can be one per GPU or more than one on the same GPU. +// +// SAMPLE of MOSAIC 1x4 SCAN OUT TOPO with 8 pixel horizontal overlap +// +//+-------------------------++-------------------------++-------------------------++-------------------------+ +//| || || || | +//| || || || | +//| || || || | +//| DVI1 || DVI2 || DVI3 || DVI4 | +//| || || || | +//| || || || | +//| || || || | +//| || || || | +//+-------------------------++-------------------------++-------------------------++-------------------------+ + + +//! \addtogroup mosaicapi +//! @{ + +//! Used in NV_MOSAIC_TOPOLOGY. +#define NVAPI_MAX_MOSAIC_DISPLAY_ROWS 8 + +//! Used in NV_MOSAIC_TOPOLOGY. +#define NVAPI_MAX_MOSAIC_DISPLAY_COLUMNS 8 + +//! Used in NV_MOSAIC_TOPOLOGY. +#define NVAPI_MAX_MOSAIC_TOPOS 16 + +//! Used in NvAPI_GetCurrentMosaicTopology() and NvAPI_SetCurrentMosaicTopology(). +typedef struct +{ + NvU32 version; //!< Version number of the mosaic topology + NvU32 rowCount; //!< Horizontal display count + NvU32 colCount; //!< Vertical display count + + struct + { + NvPhysicalGpuHandle hPhysicalGPU; //!< Physical GPU to be used in the topology + NvU32 displayOutputId; //!< Connected display target + NvS32 overlapX; //!< Pixels of overlap on the left of target: (+overlap, -gap) + NvS32 overlapY; //!< Pixels of overlap on the top of target: (+overlap, -gap) + + } gpuLayout[NVAPI_MAX_MOSAIC_DISPLAY_ROWS][NVAPI_MAX_MOSAIC_DISPLAY_COLUMNS]; + +} NV_MOSAIC_TOPOLOGY; + +//! Used in NV_MOSAIC_TOPOLOGY. +#define NVAPI_MOSAIC_TOPOLOGY_VER MAKE_NVAPI_VERSION(NV_MOSAIC_TOPOLOGY,1) + +//! Used in NvAPI_GetSupportedMosaicTopologies(). +typedef struct +{ + NvU32 version; + NvU32 totalCount; //!< Count of valid topologies + NV_MOSAIC_TOPOLOGY topos[NVAPI_MAX_MOSAIC_TOPOS]; //!< Maximum number of topologies + +} NV_MOSAIC_SUPPORTED_TOPOLOGIES; + +//! Used in NV_MOSAIC_SUPPORTED_TOPOLOGIES. +#define NVAPI_MOSAIC_SUPPORTED_TOPOLOGIES_VER MAKE_NVAPI_VERSION(NV_MOSAIC_SUPPORTED_TOPOLOGIES,1) + +//!@} + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetSupportedMosaicTopologies +// +//! DESCRIPTION: This API returns all valid Mosaic topologies. +//! +//! SUPPORTED OS: Windows XP +//! +//! +//! \since Release: 177 +//! +//! \param [out] pMosaicTopos An array of valid Mosaic topologies. +//! +//! \retval NVAPI_OK Call succeeded; 1 or more topologies were returned +//! \retval NVAPI_INVALID_ARGUMENT One or more arguments are invalid +//! \retval NVAPI_MIXED_TARGET_TYPES Mosaic topology is only possible with all targets of the same NV_GPU_OUTPUT_TYPE. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_NOT_SUPPORTED Mosaic is not supported with GPUs on this system. +//! \retval NVAPI_NO_ACTIVE_SLI_TOPOLOGY SLI is not enabled, yet needs to be, in order for this function to succeed. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetSupportedMosaicTopologies(NV_MOSAIC_SUPPORTED_TOPOLOGIES *pMosaicTopos); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetCurrentMosaicTopology +// +//! DESCRIPTION: This API gets the current Mosaic topology. +//! +//! SUPPORTED OS: Windows XP +//! +//! +//! \since Release: 177 +//! +//! \param [out] pMosaicTopo The current Mosaic topology +//! \param [out] pEnabled TRUE if returned topology is currently enabled, else FALSE +//! +//! \retval NVAPI_OK Call succeeded +//! \retval NVAPI_INVALID_ARGUMENT One or more arguments are invalid +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_NOT_SUPPORTED Mosaic is not supported with GPUs on this system. +//! \retval NVAPI_NO_ACTIVE_SLI_TOPOLOGY SLI is not enabled, yet needs to be, in order for this function to succeed. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GetCurrentMosaicTopology(NV_MOSAIC_TOPOLOGY *pMosaicTopo, NvU32 *pEnabled); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_SetCurrentMosaicTopology +// +//! DESCRIPTION: This API sets the Mosaic topology, and enables it so that the +//! Mosaic display settings are enumerated upon request. +//! +//! SUPPORTED OS: Windows XP +//! +//! +//! \since Release: 177 +//! +//! \param [in] pMosaicTopo A valid Mosaic topology +//! +//! \retval NVAPI_OK Call succeeded +//! \retval NVAPI_INVALID_ARGUMENT One or more arguments are invalid +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_NOT_SUPPORTED Mosaic is not supported with GPUs on this system. +//! \retval NVAPI_NO_ACTIVE_SLI_TOPOLOGY SLI is not enabled, yet needs to be, in order for this function to succeed. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_SetCurrentMosaicTopology(NV_MOSAIC_TOPOLOGY *pMosaicTopo); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_EnableCurrentMosaicTopology +// +//! DESCRIPTION: This API enables or disables the current Mosaic topology. +//! When enabling, the last Mosaic topology will be set. +//! +//! - If enabled, enumeration of display settings will include valid Mosaic resolutions. +//! - If disabled, enumeration of display settings will not include Mosaic resolutions. +//! +//! SUPPORTED OS: Windows XP +//! +//! +//! \since Release: 177 +//! +//! \param [in] enable TRUE to enable the Mosaic Topology, FALSE to disable it. +//! +//! \retval NVAPI_OK Call succeeded +//! \retval NVAPI_INVALID_ARGUMENT One or more arguments are invalid +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \retval NVAPI_NOT_SUPPORTED Mosaic is not supported with GPUs on this system. +//! \retval NVAPI_NO_ACTIVE_SLI_TOPOLOGY SLI is not enabled, yet needs to be, in order for this function to succeed. +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_EnableCurrentMosaicTopology(NvU32 enable); + + +#define NVAPI_MAX_GSYNC_DEVICES 4 + + +// Sync Display APIs + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_EnumSyncDevices +// +//! DESCRIPTION: This API returns an array of Sync device handles. A Sync device handle represents a +//! single Sync device on the system. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 313 +//! +//! \param [out] nvGSyncHandles- The caller provides an array of handles, which must contain at least +//! NVAPI_MAX_GSYNC_DEVICES elements. The API will zero out the entire array and then fill in one +//! or more handles. If an error occurs, the array is invalid. +//! \param [out] *gsyncCount- The caller provides the storage space. NvAPI_GSync_EnumSyncDevices +//! sets *gsyncCount to indicate how many of the elements in the nvGSyncHandles[] array are valid. +//! If an error occurs, *gsyncCount will be set to zero. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval ::NVAPI_INVALID_ARGUMENT nvGSyncHandles or gsyncCount is NULL. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any Sync Device. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_EnumSyncDevices(__out NvGSyncDeviceHandle nvGSyncHandles[NVAPI_MAX_GSYNC_DEVICES], __out NvU32 *gsyncCount); + + + +// GSync boardId values +#define NVAPI_GSYNC_BOARD_ID_P358 856 //!< GSync board ID 0x358, see NV_GSYNC_CAPABILITIES +#define NVAPI_GSYNC_BOARD_ID_P2060 8288 //!< GSync board ID 0x2060, see NV_GSYNC_CAPABILITIES + + +//! Used in NvAPI_GSync_QueryCapabilities(). +typedef struct _NV_GSYNC_CAPABILITIES_V1 +{ + NvU32 version; //!< Version of the structure + NvU32 boardId; //!< Board ID + NvU32 revision; //!< FPGA Revision + NvU32 capFlags; //!< Capabilities of the Sync board. Reserved for future use +} NV_GSYNC_CAPABILITIES_V1; + +typedef NV_GSYNC_CAPABILITIES_V1 NV_GSYNC_CAPABILITIES; + + +//! \ingroup gsyncapi +//! Macro for constructing the version field of NV_GSYNC_CAPABILITIES. +#define NV_GSYNC_CAPABILITIES_VER1 MAKE_NVAPI_VERSION(NV_GSYNC_CAPABILITIES_V1,1) +#define NV_GSYNC_CAPABILITIES_VER NV_GSYNC_CAPABILITIES_VER1 + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_QueryCapabilities +// +//! DESCRIPTION: This API returns the capabilities of the Sync device. +//! +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 313 +//! +//! \param [in] hNvGSyncDevice- The handle for a Sync device for which the capabilities will be queried. +//! \param [inout] *pNvGSyncCapabilities- The caller provides the storage space. NvAPI_GSync_QueryCapabilities() sets +//! *pNvGSyncCapabilities to the version and capabilities details of the Sync device +//! If an error occurs, *pNvGSyncCapabilities will be set to NULL. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval ::NVAPI_INVALID_ARGUMENT hNvGSyncDevice is NULL. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any Sync Device. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_QueryCapabilities(__in NvGSyncDeviceHandle hNvGSyncDevice, __inout NV_GSYNC_CAPABILITIES *pNvGSyncCapabilities); + + + +//! Connector values for a GPU. Used in NV_GSYNC_GPU. +typedef enum _NVAPI_GSYNC_GPU_TOPOLOGY_CONNECTOR +{ + NVAPI_GSYNC_GPU_TOPOLOGY_CONNECTOR_NONE = 0, + NVAPI_GSYNC_GPU_TOPOLOGY_CONNECTOR_PRIMARY = 1, + NVAPI_GSYNC_GPU_TOPOLOGY_CONNECTOR_SECONDARY = 2, + NVAPI_GSYNC_GPU_TOPOLOGY_CONNECTOR_TERTIARY = 3, + NVAPI_GSYNC_GPU_TOPOLOGY_CONNECTOR_QUARTERNARY = 4, +} NVAPI_GSYNC_GPU_TOPOLOGY_CONNECTOR; + +//! Display sync states. Used in NV_GSYNC_DISPLAY. +typedef enum _NVAPI_GSYNC_DISPLAY_SYNC_STATE +{ + NVAPI_GSYNC_DISPLAY_SYNC_STATE_UNSYNCED = 0, + NVAPI_GSYNC_DISPLAY_SYNC_STATE_SLAVE = 1, + NVAPI_GSYNC_DISPLAY_SYNC_STATE_MASTER = 2, +} NVAPI_GSYNC_DISPLAY_SYNC_STATE; + +typedef struct _NV_GSYNC_GPU +{ + NvU32 version; //!< Version of the structure + NvPhysicalGpuHandle hPhysicalGpu; //!< GPU handle + NVAPI_GSYNC_GPU_TOPOLOGY_CONNECTOR connector; //!< Indicates which connector on the device the GPU is connected to. + NvPhysicalGpuHandle hProxyPhysicalGpu; //!< GPU through which hPhysicalGpu is connected to the Sync device (if not directly connected) + //!< - this is NULL otherwise + NvU32 isSynced : 1; //!< Whether this GPU is sync'd or not. + NvU32 reserved : 31; //!< Should be set to ZERO +} NV_GSYNC_GPU; + +typedef struct _NV_GSYNC_DISPLAY +{ + NvU32 version; //!< Version of the structure + NvU32 displayId; //!< display identifier for displays.The GPU to which it is connected, can be retireved from NvAPI_SYS_GetPhysicalGpuFromDisplayId + NvU32 isMasterable : 1; //!< Can this display be the master? (Read only) + NvU32 reserved : 31; //!< Should be set to ZERO + NVAPI_GSYNC_DISPLAY_SYNC_STATE syncState; //!< Is this display slave/master + //!< (Retrieved with topology or set by caller for enable/disable sync) +} NV_GSYNC_DISPLAY; + +#define NV_GSYNC_DISPLAY_VER MAKE_NVAPI_VERSION(NV_GSYNC_DISPLAY,1) +#define NV_GSYNC_GPU_VER MAKE_NVAPI_VERSION(NV_GSYNC_GPU,1) + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_GetTopology +// +//! DESCRIPTION: This API returns the topology for the specified Sync device. +//! +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 313 +//! +//! \param [in] hNvGSyncDevice- The caller provides the handle for a Sync device for which the topology will be queried. +//! \param [in, out] gsyncGpuCount- It returns number of GPUs connected to Sync device +//! \param [in, out] gsyncGPUs- It returns info about GPUs connected to Sync device +//! \param [in, out] gsyncDisplayCount- It returns number of active displays that belongs to Sync device +//! \param [in, out] gsyncDisplays- It returns info about all active displays that belongs to Sync device +//! +//! HOW TO USE: 1) make a call to get the number of GPUs connected OR displays synced through Sync device +//! by passing the gsyncGPUs OR gsyncDisplays as NULL respectively. Both gsyncGpuCount and gsyncDisplayCount can be retrieved in same call by passing +//! both gsyncGPUs and gsyncDisplays as NULL +//! On call success: +//! 2) Allocate memory based on gsyncGpuCount(for gsyncGPUs) and/or gsyncDisplayCount(for gsyncDisplays) then make a call to populate gsyncGPUs and/or gsyncDisplays respectively. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval ::NVAPI_INVALID_ARGUMENT hNvGSyncDevice is NULL. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any Sync Device. +//! \retval ::NVAPI_INSUFFICIENT_BUFFER When the actual number of GPUs/displays in the topology exceed the number of elements allocated for SyncGPUs/SyncDisplays respectively. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_GetTopology(__in NvGSyncDeviceHandle hNvGSyncDevice, __inout_opt NvU32 *gsyncGpuCount, __inout_ecount_part_opt(*gsyncGpuCount, *gsyncGpuCount) NV_GSYNC_GPU *gsyncGPUs, + __inout_opt NvU32 *gsyncDisplayCount, __inout_ecount_part_opt(*gsyncDisplayCount, *gsyncDisplayCount) NV_GSYNC_DISPLAY *gsyncDisplays); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_SetSyncStateSettings +// +//! DESCRIPTION: Sets a new sync state for the displays in system. +//! +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 313 +//! +//! \param [in] gsyncDisplayCount- The number of displays in gsyncDisplays. +//! \param [in] pGsyncDisplays- The caller provides the structure containing all displays that need to be synchronized in the system. +//! The displays that are not part of pGsyncDisplays, will be un-synchronized. +//! \param [in] flags- Reserved for future use. +//! +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_INVALID_ARGUMENT If the display topology or count not valid. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any Sync Device. +//! \retval ::NVAPI_INVALID_SYNC_TOPOLOGY 1.If any mosaic grid is partial. +//! 2.If timing(HVisible/VVisible/refreshRate) applied of any display is different. +//! 3.If There is a across GPU mosaic grid in system and that is not a part of pGsyncDisplays. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_SetSyncStateSettings(__in NvU32 gsyncDisplayCount, __in_ecount(gsyncDisplayCount) NV_GSYNC_DISPLAY *pGsyncDisplays, __in NvU32 flags); + + +//! \ingroup gsyncapi + +//! Source signal edge to be used for output pulse. See NV_GSYNC_CONTROL_PARAMS. +typedef enum _NVAPI_GSYNC_POLARITY +{ + NVAPI_GSYNC_POLARITY_RISING_EDGE = 0, + NVAPI_GSYNC_POLARITY_FALLING_EDGE = 1, + NVAPI_GSYNC_POLARITY_BOTH_EDGES = 2, +} NVAPI_GSYNC_POLARITY; + +//! Used in NV_GSYNC_CONTROL_PARAMS. +typedef enum _NVAPI_GSYNC_VIDEO_MODE +{ + NVAPI_GSYNC_VIDEO_MODE_NONE = 0, + NVAPI_GSYNC_VIDEO_MODE_TTL = 1, + NVAPI_GSYNC_VIDEO_MODE_NTSCPALSECAM = 2, + NVAPI_GSYNC_VIDEO_MODE_HDTV = 3, + NVAPI_GSYNC_VIDEO_MODE_COMPOSITE = 4, +} NVAPI_GSYNC_VIDEO_MODE; + +//! Used in NV_GSYNC_CONTROL_PARAMS. +typedef enum _NVAPI_GSYNC_SYNC_SOURCE +{ + NVAPI_GSYNC_SYNC_SOURCE_VSYNC = 0, + NVAPI_GSYNC_SYNC_SOURCE_HOUSESYNC = 1, +} NVAPI_GSYNC_SYNC_SOURCE; + +//! Used in NV_GSYNC_CONTROL_PARAMS. +typedef struct _NV_GSYNC_DELAY +{ + NvU32 version; //!< Version of the structure + NvU32 numLines; //!< delay to be induced in number of horizontal lines. + NvU32 numPixels; //!< delay to be induced in number of pixels. + NvU32 maxLines; //!< maximum number of lines supported at current display mode to induce delay. Updated by NvAPI_GSync_GetControlParameters(). Read only. + NvU32 minPixels; //!< minimum number of pixels required at current display mode to induce delay. Updated by NvAPI_GSync_GetControlParameters(). Read only. +} NV_GSYNC_DELAY; + +#define NV_GSYNC_DELAY_VER MAKE_NVAPI_VERSION(NV_GSYNC_DELAY,1) + +//! Used in NvAPI_GSync_GetControlParameters() and NvAPI_GSync_SetControlParameters(). +typedef struct _NV_GSYNC_CONTROL_PARAMS +{ + NvU32 version; //!< Version of the structure + NVAPI_GSYNC_POLARITY polarity; //!< Leading edge / Falling edge / both + NVAPI_GSYNC_VIDEO_MODE vmode; //!< None, TTL, NTSCPALSECAM, HDTV + NvU32 interval; //!< Number of pulses to wait between framelock signal generation + NVAPI_GSYNC_SYNC_SOURCE source; //!< VSync/House sync + NvU32 interlaceMode:1; //!< interlace mode for a Sync device + NvU32 reserved:31; //!< should be set zero + NV_GSYNC_DELAY syncSkew; //!< The time delay between the frame sync signal and the GPUs signal. + NV_GSYNC_DELAY startupDelay; //!< Sync start delay for master. +} NV_GSYNC_CONTROL_PARAMS; + +#define NV_GSYNC_CONTROL_PARAMS_VER MAKE_NVAPI_VERSION(NV_GSYNC_CONTROL_PARAMS,1) + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_GetControlParameters +// +//! DESCRIPTION: This API queries for sync control parameters as defined in NV_GSYNC_CONTROL_PARAMS. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 313 +//! +//! \param [in] hNvGSyncDevice- The caller provides the handle of the Sync device for which to get parameters +//! \param [inout] *pGsyncControls- The caller provides the storage space. NvAPI_GSync_GetControlParameters() populates *pGsyncControls with values. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval ::NVAPI_INVALID_ARGUMENT hNvGSyncDevice is NULL. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any Sync Device. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_GetControlParameters(__in NvGSyncDeviceHandle hNvGSyncDevice, __inout NV_GSYNC_CONTROL_PARAMS *pGsyncControls); + + + +////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_SetControlParameters +// +//! DESCRIPTION: This API sets control parameters as defined in NV_SYNC_CONTROL_PARAMS. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 313 +//! +//! \param [in] hNvGSyncDevice- The caller provides the handle of the Sync device for which to get parameters +//! \param [inout] *pGsyncControls- The caller provides NV_GSYNC_CONTROL_PARAMS. skew and startDelay will be updated to the applied values. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval ::NVAPI_INVALID_ARGUMENT hNvGSyncDevice is NULL. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any Sync Device. +//! \retval ::NVAPI_SYNC_MASTER_NOT_FOUND Control Parameters can only be set if there is a Sync Master enabled on the Gsync card. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_SetControlParameters(__in NvGSyncDeviceHandle hNvGSyncDevice, __inout NV_GSYNC_CONTROL_PARAMS *pGsyncControls); + + + + +//! Used in NvAPI_GSync_AdjustSyncDelay() +typedef enum _NVAPI_GSYNC_DELAY_TYPE +{ + NVAPI_GSYNC_DELAY_TYPE_UNKNOWN = 0, + NVAPI_GSYNC_DELAY_TYPE_SYNC_SKEW = 1, + NVAPI_GSYNC_DELAY_TYPE_STARTUP = 2 +} NVAPI_GSYNC_DELAY_TYPE; + +////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_AdjustSyncDelay +// +//! DESCRIPTION: This API adjusts the skew and startDelay to the closest possible values. Use this API before calling NvAPI_GSync_SetControlParameters for skew or startDelay. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 319 +//! +//! \param [in] hNvGSyncDevice- The caller provides the handle of the Sync device for which to get parameters +//! \param [in] delayType- Specifies whether the delay is syncSkew or startupDelay. +//! \param [inout] *pGsyncDelay- The caller provides NV_GSYNC_DELAY. skew and startDelay will be adjusted and updated to the closest values. +//! \param [out] *syncSteps- This parameter is optional. It returns the sync delay in unit steps. If 0, it means either the NV_GSYNC_DELAY::numPixels is less than NV_GSYNC_DELAY::minPixels or NV_GSYNC_DELAY::numOfLines exceeds the NV_GSYNC_DELAY::maxLines. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_AdjustSyncDelay(__in NvGSyncDeviceHandle hNvGSyncDevice, __in NVAPI_GSYNC_DELAY_TYPE delayType, __inout NV_GSYNC_DELAY *pGsyncDelay, __out_opt NvU32* syncSteps); + + + +//! Used in NvAPI_GSync_GetSyncStatus(). +typedef struct _NV_GSYNC_STATUS +{ + NvU32 version; //!< Version of the structure + NvU32 bIsSynced; //!< Is timing in sync? + NvU32 bIsStereoSynced; //!< Does the phase of the timing signal from the GPU = the phase of the master sync signal? + NvU32 bIsSyncSignalAvailable; //!< Is the sync signal available? +} NV_GSYNC_STATUS; + +//! Macro for constructing the version field for NV_GSYNC_STATUS. +#define NV_GSYNC_STATUS_VER MAKE_NVAPI_VERSION(NV_GSYNC_STATUS,1) + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_GetSyncStatus +// +//! DESCRIPTION: This API queries the sync status of a GPU - timing, stereosync and sync signal availability. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 313 +//! +//! \param [in] hNvGSyncDevice- Handle of the Sync device +//! \param [in] hPhysicalGpu- GPU to be queried for sync status. +//! \param [out] *status- The caller provides the storage space. NvAPI_GSync_GetSyncStatus() populates *status with +//! values - timing, stereosync and signal availability. On error, *status is set to NULL. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval ::NVAPI_INVALID_ARGUMENT hNvGSyncDevice is NULL / SyncTarget is NULL. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any G-Sync Device. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_GetSyncStatus(__in NvGSyncDeviceHandle hNvGSyncDevice, __in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GSYNC_STATUS *status); + + +//! \ingroup gsyncapi + +#define NVAPI_MAX_RJ45_PER_GSYNC 2 + +//! Used in NV_GSYNC_STATUS_PARAMS. +typedef enum _NVAPI_GSYNC_RJ45_IO +{ + NVAPI_GSYNC_RJ45_OUTPUT = 0, + NVAPI_GSYNC_RJ45_INPUT = 1, + NVAPI_GSYNC_RJ45_UNUSED = 2 //!< This field is used to notify that the framelock is not actually present. + +} NVAPI_GSYNC_RJ45_IO; + +//! \ingroup gsyncapi +//! Used in NvAPI_GSync_GetStatusParameters(). +typedef struct _NV_GSYNC_STATUS_PARAMS +{ + NvU32 version; + NvU32 refreshRate; //!< The refresh rate + NVAPI_GSYNC_RJ45_IO RJ45_IO[NVAPI_MAX_RJ45_PER_GSYNC]; //!< Configured as input / output + NvU32 RJ45_Ethernet[NVAPI_MAX_RJ45_PER_GSYNC]; //!< Connected to ethernet hub? [ERRONEOUSLY CONNECTED!] + NvU32 houseSyncIncoming; //!< Incoming house sync frequency in Hz + NvU32 bHouseSync; //!< Is house sync connected? +} NV_GSYNC_STATUS_PARAMS; + + +//! \ingroup gsyncapi +//! Macro for constructing the version field of NV_GSYNC_STATUS_PARAMS +#define NV_GSYNC_STATUS_PARAMS_VER MAKE_NVAPI_VERSION(NV_GSYNC_STATUS_PARAMS,1) + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GSync_GetStatusParameters +// +//! DESCRIPTION: This API queries for sync status parameters as defined in NV_GSYNC_STATUS_PARAMS. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 313 +//! +//! \param [in] hNvGSyncDevice The caller provides the handle of the GSync device for which to get parameters +//! \param [out] *pStatusParams The caller provides the storage space. NvAPI_GSync_GetStatusParameters populates *pStatusParams with +//! values. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval ::NVAPI_INVALID_ARGUMENT hNvGSyncDevice is NULL / pStatusParams is NULL. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any GSync Device. +//! +//! \ingroup gsyncapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GSync_GetStatusParameters(NvGSyncDeviceHandle hNvGSyncDevice, NV_GSYNC_STATUS_PARAMS *pStatusParams); + +//! @} + + + + + + + +#if defined(_D3D9_H_) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D9_RegisterResource +// +//! DESCRIPTION: This API binds a resource (surface/texture) so that it can be retrieved +//! internally by NVAPI. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! \param [in] pResource surface/texture +//! +//! \return ::NVAPI_OK, ::NVAPI_ERROR +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D9_RegisterResource(IDirect3DResource9* pResource); +#endif //defined(_D3D9_H_) +#if defined(_D3D9_H_) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D9_UnregisterResource +// +//! DESCRIPTION: This API unbinds a resource (surface/texture) after use. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] pResource surface/texture +//! +//! \return ::NVAPI_OK, ::NVAPI_ERROR +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D9_UnregisterResource(IDirect3DResource9* pResource); + +#endif //defined(_D3D9_H_) + + + +#if defined(_D3D9_H_) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D9_AliasSurfaceAsTexture +// +//! \fn NvAPI_D3D9_AliasSurfaceAsTexture(IDirect3DDevice9* pDev, +//! IDirect3DSurface9* pSurface, +//! IDirect3DTexture9 **ppTexture, +//! DWORD dwFlag); +//! DESCRIPTION: Create a texture that is an alias of a surface registered with NvAPI. The +//! new texture can be bound with IDirect3DDevice9::SetTexture(). Note that the texture must +//! be unbound before drawing to the surface again. +//! Unless the USE_SUPER flag is passed, MSAA surfaces will be resolved before +//! being used as a texture. MSAA depth buffers are resolved with a point filter, +//! and non-depth MSAA surfaces are resolved with a linear filter. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] pDev The D3D device that owns the objects +//! \param [in] pSurface Pointer to a surface that has been registered with NvAPI +//! to which a texture alias is to be provided +//! \param [out] ppTexture Fill with the texture created +//! \param [in] dwFlag NVAPI_ALIAS_SURFACE_FLAG to describe how to handle the texture +//! +//! \retval ::NVAPI_OK completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as an argument +//! \retval ::NVAPI_INVALID_ARGUMENT One of the arguments was invalid, probably dwFlag. +//! \retval ::NVAPI_UNREGISTERED_RESOURCE pSurface has not been registered with NvAPI +//! \retval ::NVAPI_ERROR error occurred +// +/////////////////////////////////////////////////////////////////////////////// + + +//! \ingroup dx +//! See NvAPI_D3D9_AliasSurfaceAsTexture(). +typedef enum { + NVAPI_ALIAS_SURFACE_FLAG_NONE = 0x00000000, + NVAPI_ALIAS_SURFACE_FLAG_USE_SUPER = 0x00000001, //!< Use the surface's msaa buffer directly as a texture, rather than resolving. (This is much slower, but potentially has higher quality.) + NVAPI_ALIAS_SURFACE_FLAG_MASK = 0x00000001 +} NVAPI_ALIAS_SURFACE_FLAG; + + +//! \ingroup dx +NVAPI_INTERFACE NvAPI_D3D9_AliasSurfaceAsTexture(IDirect3DDevice9* pDev, + IDirect3DSurface9* pSurface, + IDirect3DTexture9 **ppTexture, + DWORD dwFlag); +#endif //defined(_D3D9_H_) +#if defined(_D3D9_H_) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D9_StretchRectEx +// +//! DESCRIPTION: This API copies the contents of the source resource to the destination +//! resource. This function can convert +//! between a wider range of surfaces than +//! IDirect3DDevice9::StretchRect. For example, it can copy +//! from a depth/stencil surface to a texture. +//! +//! The source and destination resources *must* be registered +//! with NvAPI before being used with NvAPI_D3D9_StretchRectEx(). +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] pDevice The D3D device that owns the objects. +//! \param [in] pSourceResource Pointer to the source resource. +//! \param [in] pSrcRect Defines the rectangle on the source to copy from. If NULL, copy from the entire resource. +//! \param [in] pDestResource Pointer to the destination resource. +//! \param [in] pDstRect Defines the rectangle on the destination to copy to. If NULL, copy to the entire resource. +//! \param [in] Filter Choose a filtering method: D3DTEXF_NONE, D3DTEXF_POINT, D3DTEXF_LINEAR. +//! +//! \retval ::NVAPI_OK completed request +//! \retval ::NVAPI_INVALID_POINTER An invalid pointer was passed as an argument (probably NULL) +//! \retval ::NVAPI_INVALID_ARGUMENT One of the arguments was invalid +//! \retval ::NVAPI_UNREGISTERED_RESOURCE a resource was passed in without being registered +//! \retval ::NVAPI_ERROR error occurred +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D9_StretchRectEx(IDirect3DDevice9 * pDevice, + IDirect3DResource9 * pSourceResource, + CONST RECT * pSourceRect, + IDirect3DResource9 * pDestResource, + CONST RECT * pDestRect, + D3DTEXTUREFILTERTYPE Filter); + +#endif //defined(_D3D9_H_) +#if defined(_D3D9_H_) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D9_ClearRT +// +//! DESCRIPTION: This API Clears the currently bound render target(s) with the +//! given color +//! +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] pDevice The D3D device that owns the objects. +//! \param [in] dwNumRects The no of rectangles to clear. If 0, clear the entire surface (clipped to viewport) +//! \param [in] pRects Defines the rectangles to clear. Should be NULL if dwNumRects == 0 +//! \param [in] r red component of the clear color +//! \param [in] g green component of the clear color +//! \param [in] b blue component of the clear color +//! \param [in] a alpha component of the clear color +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D9_ClearRT(IDirect3DDevice9 * pDevice, + NvU32 dwNumRects, + CONST RECT * pRects, + float r, float g, float b, float a); +#endif //if defined(_D3D9_H_) + + + + + + + + + + +#if defined(_D3D9_H_) && defined(__cplusplus) +//! SUPPORTED OS: Windows XP and higher +//! + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D9_GetSurfaceHandle +// +//! This function gets the handle of a given surface. This handle uniquely +//! identifies the surface through all NvAPI entries. +//! +//! +//! \since Release: 313 +//! +//! \param [in] pSurface Surface to be identified +//! \param [out] pHandle Will be filled by the return handle +//! +//! \return An int which could be an NvAPI status or DX HRESULT code +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D9_GetSurfaceHandle(IDirect3DSurface9 *pSurface, + NVDX_ObjectHandle *pHandle); + +#endif //defined(_D3D9_H_) && defined(__cplusplus) + +#if defined(_D3D9_H_) && defined(__cplusplus) +//! SUPPORTED OS: Windows Vista and higher +//! +//! \addtogroup dxvidcontrol +//! @{ + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION_NAME: NvAPI_D3D9_VideoSetStereoInfo +// +//! \fn NvAPI_D3D9_VideoSetStereoInfo(IDirect3DDevice9 *pDev, +//! NV_DX_VIDEO_STEREO_INFO *pStereoInfo); +//! \code +//! DESCRIPTION: This api specifies the stereo format of a surface, so that the +//! surface could be used for stereo video processing or compositing. +//! In particular, this api could be used to link the left and right +//! views of a decoded picture. +//! +//! \since Release: 313 +//! +//! INPUT: pDev - The device on which the stereo surface will be used +//! pStereoInfo - The stereo format of the surface +//! +//! RETURN STATUS: an int which could be an NvAPI status or DX HRESULT code +//! \endcode +/////////////////////////////////////////////////////////////////////////////// + +#ifndef NV_STEREO_VIDEO_FORMAT_DEFINE +#define NV_STEREO_VIDEO_FORMAT_DEFINE + + +typedef enum _NV_STEREO_VIDEO_FORMAT +{ + NV_STEREO_VIDEO_FORMAT_NOT_STEREO = 0, + + NV_STEREO_VIDEO_FORMAT_SIDE_BY_SIDE_LR = 1, + NV_STEREO_VIDEO_FORMAT_SIDE_BY_SIDE_RL = 2, + NV_STEREO_VIDEO_FORMAT_TOP_BOTTOM_LR = 3, + NV_STEREO_VIDEO_FORMAT_TOP_BOTTOM_RL = 4, + NV_STEREO_VIDEO_FORMAT_ROW_INTERLEAVE_LR = 5, + NV_STEREO_VIDEO_FORMAT_ROW_INTERLEAVE_RL = 6, + NV_STEREO_VIDEO_FORMAT_TWO_FRAMES_LR = 7, + NV_STEREO_VIDEO_FORMAT_MONO_PLUS_OFFSET = 8, + + NV_STEREO_VIDEO_FORMAT_LAST = 9, +} NV_STEREO_VIDEO_FORMAT; + +#endif // NV_STEREO_VIDEO_FORMAT_DEFINE + + +typedef struct _NV_DX_VIDEO_STEREO_INFO { + NvU32 dwVersion; //!< Must be NV_DX_VIDEO_STEREO_INFO_VER + NVDX_ObjectHandle hSurface; //!< The surface whose stereo format is to be set + NVDX_ObjectHandle hLinkedSurface; //!< The linked surface (must be valid when eFormat==NV_STEREO_VIDEO_FORMAT_TWO_FRAMES_LR) + NV_STEREO_VIDEO_FORMAT eFormat; //!< Stereo format of the surface + NvS32 sViewOffset; //!< Signed offset of each view (positive offset indicating left view is shifted left) + BOOL bStereoEnable; //!< Whether stereo rendering should be enabled (if FALSE, only left view will be used) +} NV_DX_VIDEO_STEREO_INFO; + +//! Macro for constructing the version field of ::NV_DX_VIDEO_STEREO_INFO +#define NV_DX_VIDEO_STEREO_INFO_VER MAKE_NVAPI_VERSION(NV_DX_VIDEO_STEREO_INFO,1) + +NVAPI_INTERFACE NvAPI_D3D9_VideoSetStereoInfo(IDirect3DDevice9 *pDev, + NV_DX_VIDEO_STEREO_INFO *pStereoInfo); + +//! @} +#endif //defined(_D3D9_H_) && defined(__cplusplus) + + + + + + +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_IsNvShaderExtnOpCodeSupported +// +//! DESCRIPTION: This function checks if a nv HLSL shader extension opcode is +//! supported on current hardware. List of opcodes is in nvShaderExtnEnums.h +//! To use Nvidia HLSL extensions the application must include nvHLSLExtns.h +//! in the hlsl shader code. See nvHLSLExtns.h for more details on supported opcodes. +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] pDev The device on which to query for support, +//! should be a ID3D11Device+ device +//! \param [in] opCode the opcode to check +//! \param [out] pSupported true if supported, false otherwise +//! +//! RETURN STATUS: This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval :: NVAPI_OK if the call succeeded +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D11_IsNvShaderExtnOpCodeSupported(__in IUnknown *pDev, + __in NvU32 opCode, + __out bool *pSupported); + +#endif //defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_SetNvShaderExtnSlot +// +//! DESCRIPTION: This function sets the fake UAV slot that is used by Nvidia HLSL +//! shader extensions. All createShader calls made to the driver after +//! setting this slot would treat writes/reads to this UAV in a +//! different way. Applications are expected to bind null UAV to this slot. +//! The same slot is used for all shader stages. +//! To disable shader extensions the app may set this uav slot +//! to some value that is bigger than the max allowed slot index +//! e.g, 128 or 0xFFFFFFFF. +//! To use Nvidia HLSL extensions the application must include nvHLSLExtns.h +//! in the hlsl shader code. See nvHLSLExtns.h for more details. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] pDev The device for which to set the extension slot +//! should be a ID3D11Device+ device +//! \param [in] uavSlot the uav slot to use +//! +//! RETURN STATUS: This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! \retval :: NVAPI_OK : success, the uavSlot was set sucessfully +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D11_SetNvShaderExtnSlot(__in IUnknown *pDev, + __in NvU32 uavSlot); + +#endif //defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + + +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_BeginUAVOverlapEx +// +//! DESCRIPTION: Causes the driver to skip synchronization that is normally needed when accessing UAVs. +//! Applications must use this with caution otherwise this might cause data hazards when +//! multiple draw calls/compute shader launches are accessing same memory locations +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] *pDeviceOrContext pointer to D3D11 device, or D3D11 device context +//! \param [in] insertWFIFlags bit fields to indicate which WFI would be inserted (gfx / compute / both). +//! +//! RETURN STATUS: This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +typedef enum _NVAPI_D3D11_INSERTWFI_FLAG +{ + NVAPI_D3D_BEGIN_UAV_OVERLAP_NO_WFI = 0x00000000, //!< no WFI + NVAPI_D3D_BEGIN_UAV_OVERLAP_GFX_WFI = 0x00000001, //!< (bit 0) force graphics WFI + NVAPI_D3D_BEGIN_UAV_OVERLAP_COMP_WFI = 0x00000002, //!< (bit 1) force compute WFI +} NVAPI_D3D11_INSERTWFI_FLAG; + +NVAPI_INTERFACE NvAPI_D3D11_BeginUAVOverlapEx(__in IUnknown *pDeviceOrContext, __in NvU32 insertWFIFlags); + +#endif //defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_BeginUAVOverlap +// +//! DESCRIPTION: Causes the driver to skip synchronization that is normally needed when accessing UAVs. +//! Applications must use this with caution otherwise this might cause data hazards when +//! multiple draw calls/compute shader launches are accessing same memory locations +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] *pDeviceOrContext pointer to D3D11 device, or D3D11 device context +//! +//! RETURN STATUS: This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D11_BeginUAVOverlap(__in IUnknown *pDeviceOrContext); + +#endif //defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_EndUAVOverlap +// +//! DESCRIPTION: Re-enables driver synchronization between calls that access same UAVs +//! See NvAPI_D3D_BeginUAVOverlap for more details. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] *pDeviceOrContext pointer to D3D11 device, or D3D11 device context +//! +//! RETURN STATUS: This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D11_EndUAVOverlap(__in IUnknown *pDeviceOrContext); + +#endif //defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + +#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D_SetFPSIndicatorState +// +//! DESCRIPTION: Display an overlay that tracks the number of times the app presents per second, or, +//! the number of frames-per-second (FPS) +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] bool Whether or not to enable the fps indicator. +//! +//! \return ::NVAPI_OK, +//! ::NVAPI_ERROR +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D_SetFPSIndicatorState(IUnknown *pDev, NvU8 doEnable); + +#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__) + +//! SUPPORTED OS: Windows Vista and higher +//! +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__) || defined(__d3d12_h__)) + +enum NVAPI_QUAD_FILLMODE +{ + NVAPI_QUAD_FILLMODE_DISABLED = 0, + NVAPI_QUAD_FILLMODE_BBOX = 1, + NVAPI_QUAD_FILLMODE_FULL_VIEWPORT = 2, +}; + +#endif //defined(__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__) || defined(__d3d12_h__)) + +//! SUPPORTED OS: Windows Vista and higher +//! +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + +typedef struct NvAPI_D3D11_RASTERIZER_DESC_EX +{ + // D3D11_RASTERIZER_DESC member variables + D3D11_FILL_MODE FillMode; + D3D11_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + INT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL ScissorEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; + + // NvAPI_D3D11_RASTERIZER_DESC_EX specific member variables + NvU32 ForcedSampleCount; //1 it needs to match N, in non-TIR it needs to match RT sample count. Ignored if ForcePerSampleInterlock is set + NvU8 SamplePositionsX[16]; //1 it needs to match N, in non-TIR it needs to match RT sample count. Ignored if ForcePerSampleInterlock is set + NvU8 SamplePositionsX[16]; //SetFence(dstGpu, hFence, Value); \ + pMultiGPUDevice->WaitForFence(1 << (srcGpu), hFence, Value); \ + Value++; + +#define FENCE_SYNCHRONIZATION_END(pMultiGPUDevice, hFence, Value, srcGpu, dstGpu) \ + pMultiGPUDevice->SetFence(srcGpu, hFence, Value); \ + pMultiGPUDevice->WaitForFence(1 << (dstGpu), hFence, Value); \ + Value++; + +//! PresentCompositingConfig method flags. +#define NVAPI_PRESENT_COMPOSITING_CONFIG_FLAG_USE_VIDEO_BRIDGE 0x01 +#define NVAPI_PRESENT_COMPOSITING_CONFIG_FLAG_CLEAR_OUTBANDS 0x02 +#define NVAPI_PRESENT_COMPOSITING_CONFIG_FLAG_GET_VIDEO_BRIDGE_STATUS 0x80000000 + +#define NVAPI_VIDEO_BRIDGE_STATUS_AVAILABLE 0 +#define NVAPI_VIDEO_BRIDGE_STATUS_NOT_AVAILABLE 1 +#define NVAPI_VIDEO_BRIDGE_STATUS_FAILED_ACCESS 2 +#define NVAPI_VIDEO_BRIDGE_STATUS_UNKNOWN 3 + +#define NVAPI_ALL_GPUS 0 +typedef ID3D11MultiGPUDevice_V1 ID3D11MultiGPUDevice; + +#define ID3D11MultiGPUDevice_VER1 MAKE_NVAPI_VERSION(ID3D11MultiGPUDevice_V1, 1) +#define ID3D11MultiGPUDevice_VER2 MAKE_NVAPI_VERSION(ID3D11MultiGPUDevice_V1, 2) +#define ID3D11MultiGPUDevice_VER ID3D11MultiGPUDevice_VER2 + +#define ALL_GPUS 0 + +//! \ingroup dx +NVAPI_INTERFACE NvAPI_D3D11_CreateMultiGPUDevice(__in ID3D11Device *pDevice, __in ULONG version, __out ULONG *currentVersion, __out ID3D11MultiGPUDevice **ppD3D11MultiGPUDevice, __in UINT maxGpus=ALL_GPUS); + +#endif //defined(__cplusplus) && defined(__d3d11_h__) + +#if defined (__cplusplus) && (defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__)) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D_RegisterDevice +// +//! DESCRIPTION: Tells NvAPI about a D3D device. This must be called prior to using any DX1x +//! deferred-context calls. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] pDev The ID3D10Device or ID3D11Device to use. +//! +//! RETURN STATUS: This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D_RegisterDevice(__in IUnknown *pDev); + +#endif //if defined(__cplusplus) && (defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__)) + + + +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_MultiDrawInstancedIndirect +// +//! DESCRIPTION: Extension of DrawInstancedIndirect that takes a draw count in. The effect of this function is to loop over +//! that draw count and perform the DrawInstancedIndirect operation each time, incrementing the buffer offset +//! by the supplied stride each time. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] *pDevContext11 Pointer to D3D11 device context (IC or DC) +//! \param [in] drawCount Do DrawInstancedIndirect operation this many times +//! \param [in] *pBuffer ID3D11Buffer that contains the command parameters +//! \param [in] alignedByteOffsetForArgs Start in pBuffer of the command parameters +//! \param [in] alignedByteStrideForArgs Stride of the command parameters - must be >= 4 * sizeof(NvU32) +//! +//! RETURN STATUS: This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval NVAPI_D3D_DEVICE_NOT_REGISTERED When MultiDraw is called on a deferred context, and the device has not yet +//! been registered (NvAPI_D3D_RegisterDevice), this error is returned. +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// + +NVAPI_INTERFACE NvAPI_D3D11_MultiDrawInstancedIndirect(__in ID3D11DeviceContext *pDevContext11, + __in NvU32 drawCount, + __in ID3D11Buffer *pBuffer, + __in NvU32 alignedByteOffsetForArgs, + __in NvU32 alignedByteStrideForArgs); + +#endif //defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + + +#if defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_MultiDrawIndexedInstancedIndirect +// +//! DESCRIPTION: Extension of DrawIndexedInstancedIndirect that takes a draw count in. The effect of this function is to loop over +//! that draw count and perform the DrawIndexedInstancedIndirect operation each time, incrementing the buffer offset +//! by the supplied stride each time. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] *pDevContext11 Pointer to D3D11 device context (IC or DC) +//! \param [in] drawCount Do DrawIndexedInstancedIndirect operation this many times +//! \param [in] *pBuffer ID3D11Buffer that contains the command parameters +//! \param [in] alignedByteOffsetForArgs Start in pBuffer of the command parameters +//! \param [in] alignedByteStrideForArgs Stride of the command parameters - must be >= 5 * sizeof(NvU32) +//! +//! RETURN STATUS: This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval NVAPI_D3D_DEVICE_NOT_REGISTERED When MultiDraw is called on a deferred context, and the device has not yet +//! been registered (NvAPI_D3D_RegisterDevice), this error is returned. +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// + +NVAPI_INTERFACE NvAPI_D3D11_MultiDrawIndexedInstancedIndirect(__in ID3D11DeviceContext *pDevContext11, + __in NvU32 drawCount, + __in ID3D11Buffer *pBuffer, + __in NvU32 alignedByteOffsetForArgs, + __in NvU32 alignedByteStrideForArgs); + +#endif //defined (__cplusplus) && (defined(__d3d11_h__) || defined(__d3d11_1_h__)) + +//! SUPPORTED OS: Windows 7 and higher +//! +#if defined (__cplusplus) && ( defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d10_1_h__) ||defined(__d3d11_h__) ) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D_ImplicitSLIControl +// +//! This function enables/disables the SLI rendering mode. It has to be called prior to D3D device creation. Once this function is called with DISABLE_IMPLICIT_SLI +//! parameter all subsequently created devices will be forced to run in a single gpu mode until the same function is called with ENABLE_IMPLICIT_SLI parameter. The enable +//! call will force all subsequently created devices to run in default implicit SLI mode being determined by an application profile or a global control panel SLI setting. +//! This NvAPI call is supported in all DX10+ versions of the driver. It is supported on all Windows versions. +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Error occurred +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup dx +typedef enum _IMPLICIT_SLI_CONTROL +{ + DISABLE_IMPLICIT_SLI = 0, + ENABLE_IMPLICIT_SLI = 1, +} IMPLICIT_SLI_CONTROL; + +//! \ingroup dx +NVAPI_INTERFACE NvAPI_D3D_ImplicitSLIControl(__in IMPLICIT_SLI_CONTROL implicitSLIControl); + +#endif //defined (__cplusplus) && ( defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d10_1_h__) ||defined(__d3d11_h__) ) + +//! SUPPORTED OS: Windows Vista and higher +//! +#if defined(__cplusplus) && ( defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__) ) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D1x_GetLowLatencySupport +// +//! DESCRIPTION: Query support for low latency nodes +//! +//! +//! \param [in] adapterId The adapter ID that specifies the GPU to query. +//! \param [out] pIsLowLatencySupported Returns true if and only if low latency nodes are supported. +//! +//! \retval NVAPI_OK Call succeeded. +//! \retval NVAPI_ERROR Call failed. +//! \retval NVAPI_INVALID_ARGUMENT One or more arguments are invalid. +//! \retval NVAPI_INVALID_POINTER A NULL pointer was passed +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D1x_GetLowLatencySupport(__in LUID pAdapterId, + __out BOOL *pIsLowLatencySupported); + +#endif //defined(__cplusplus) && ( defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__) ) + +///////////////////////////////////////////////////////////////////////// +// Video Input Output (VIO) API +///////////////////////////////////////////////////////////////////////// + + + +//! \ingroup vidio +//! Unique identifier for VIO owner (process identifier or NVVIOOWNERID_NONE) +typedef NvU32 NVVIOOWNERID; + + +//! \addtogroup vidio +//! @{ + + +#define NVVIOOWNERID_NONE 0 //!< Unregistered ownerId + + +//! Owner type for device +typedef enum _NVVIOOWNERTYPE +{ + NVVIOOWNERTYPE_NONE , //!< No owner for the device + NVVIOOWNERTYPE_APPLICATION , //!< Application owns the device + NVVIOOWNERTYPE_DESKTOP , //!< Desktop transparent mode owns the device (not applicable for video input) +}NVVIOOWNERTYPE; + +// Access rights for NvAPI_VIO_Open() + +//! Read access (not applicable for video output) +#define NVVIO_O_READ 0x00000000 + +//! Write exclusive access (not applicable for video input) +#define NVVIO_O_WRITE_EXCLUSIVE 0x00010001 + +//! +#define NVVIO_VALID_ACCESSRIGHTS (NVVIO_O_READ | \ + NVVIO_O_WRITE_EXCLUSIVE ) + + +//! VIO_DATA.ulOwnerID high-bit is set only if device has been initialized by VIOAPI +//! examined at NvAPI_GetCapabilities|NvAPI_VIO_Open to determine if settings need to be applied from registry or POR state read +#define NVVIO_OWNERID_INITIALIZED 0x80000000 + +//! VIO_DATA.ulOwnerID next-bit is set only if device is currently in exclusive write access mode from NvAPI_VIO_Open() +#define NVVIO_OWNERID_EXCLUSIVE 0x40000000 + +//! VIO_DATA.ulOwnerID lower bits are: +//! NVGVOOWNERTYPE_xxx enumerations indicating use context +#define NVVIO_OWNERID_TYPEMASK 0x0FFFFFFF //!< mask for NVVIOOWNERTYPE_xxx + + +//! @} + +//--------------------------------------------------------------------- +// Enumerations +//--------------------------------------------------------------------- + + +//! \addtogroup vidio +//! @{ + +//! Video signal format and resolution +typedef enum _NVVIOSIGNALFORMAT +{ + NVVIOSIGNALFORMAT_NONE, //!< Invalid signal format + NVVIOSIGNALFORMAT_487I_59_94_SMPTE259_NTSC, //!< 01 487i 59.94Hz (SMPTE259) NTSC + NVVIOSIGNALFORMAT_576I_50_00_SMPTE259_PAL, //!< 02 576i 50.00Hz (SMPTE259) PAL + NVVIOSIGNALFORMAT_1035I_60_00_SMPTE260, //!< 03 1035i 60.00Hz (SMPTE260) + NVVIOSIGNALFORMAT_1035I_59_94_SMPTE260, //!< 04 1035i 59.94Hz (SMPTE260) + NVVIOSIGNALFORMAT_1080I_50_00_SMPTE295, //!< 05 1080i 50.00Hz (SMPTE295) + NVVIOSIGNALFORMAT_1080I_60_00_SMPTE274, //!< 06 1080i 60.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080I_59_94_SMPTE274, //!< 07 1080i 59.94Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080I_50_00_SMPTE274, //!< 08 1080i 50.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080P_30_00_SMPTE274, //!< 09 1080p 30.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080P_29_97_SMPTE274, //!< 10 1080p 29.97Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080P_25_00_SMPTE274, //!< 11 1080p 25.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080P_24_00_SMPTE274, //!< 12 1080p 24.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080P_23_976_SMPTE274, //!< 13 1080p 23.976Hz (SMPTE274) + NVVIOSIGNALFORMAT_720P_60_00_SMPTE296, //!< 14 720p 60.00Hz (SMPTE296) + NVVIOSIGNALFORMAT_720P_59_94_SMPTE296, //!< 15 720p 59.94Hz (SMPTE296) + NVVIOSIGNALFORMAT_720P_50_00_SMPTE296, //!< 16 720p 50.00Hz (SMPTE296) + NVVIOSIGNALFORMAT_1080I_48_00_SMPTE274, //!< 17 1080I 48.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080I_47_96_SMPTE274, //!< 18 1080I 47.96Hz (SMPTE274) + NVVIOSIGNALFORMAT_720P_30_00_SMPTE296, //!< 19 720p 30.00Hz (SMPTE296) + NVVIOSIGNALFORMAT_720P_29_97_SMPTE296, //!< 20 720p 29.97Hz (SMPTE296) + NVVIOSIGNALFORMAT_720P_25_00_SMPTE296, //!< 21 720p 25.00Hz (SMPTE296) + NVVIOSIGNALFORMAT_720P_24_00_SMPTE296, //!< 22 720p 24.00Hz (SMPTE296) + NVVIOSIGNALFORMAT_720P_23_98_SMPTE296, //!< 23 720p 23.98Hz (SMPTE296) + NVVIOSIGNALFORMAT_2048P_30_00_SMPTE372, //!< 24 2048p 30.00Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048P_29_97_SMPTE372, //!< 25 2048p 29.97Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048I_60_00_SMPTE372, //!< 26 2048i 60.00Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048I_59_94_SMPTE372, //!< 27 2048i 59.94Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048P_25_00_SMPTE372, //!< 28 2048p 25.00Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048I_50_00_SMPTE372, //!< 29 2048i 50.00Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048P_24_00_SMPTE372, //!< 30 2048p 24.00Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048P_23_98_SMPTE372, //!< 31 2048p 23.98Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048I_48_00_SMPTE372, //!< 32 2048i 48.00Hz (SMPTE372) + NVVIOSIGNALFORMAT_2048I_47_96_SMPTE372, //!< 33 2048i 47.96Hz (SMPTE372) + + NVVIOSIGNALFORMAT_1080PSF_25_00_SMPTE274, //!< 34 1080PsF 25.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080PSF_29_97_SMPTE274, //!< 35 1080PsF 29.97Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080PSF_30_00_SMPTE274, //!< 36 1080PsF 30.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080PSF_24_00_SMPTE274, //!< 37 1080PsF 24.00Hz (SMPTE274) + NVVIOSIGNALFORMAT_1080PSF_23_98_SMPTE274, //!< 38 1080PsF 23.98Hz (SMPTE274) + + NVVIOSIGNALFORMAT_1080P_50_00_SMPTE274_3G_LEVEL_A, //!< 39 1080P 50.00Hz (SMPTE274) 3G Level A + NVVIOSIGNALFORMAT_1080P_59_94_SMPTE274_3G_LEVEL_A, //!< 40 1080P 59.94Hz (SMPTE274) 3G Level A + NVVIOSIGNALFORMAT_1080P_60_00_SMPTE274_3G_LEVEL_A, //!< 41 1080P 60.00Hz (SMPTE274) 3G Level A + + NVVIOSIGNALFORMAT_1080P_60_00_SMPTE274_3G_LEVEL_B, //!< 42 1080p 60.00Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_1080I_60_00_SMPTE274_3G_LEVEL_B, //!< 43 1080i 60.00Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048I_60_00_SMPTE372_3G_LEVEL_B, //!< 44 2048i 60.00Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080P_50_00_SMPTE274_3G_LEVEL_B, //!< 45 1080p 50.00Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_1080I_50_00_SMPTE274_3G_LEVEL_B, //!< 46 1080i 50.00Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048I_50_00_SMPTE372_3G_LEVEL_B, //!< 47 2048i 50.00Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080P_30_00_SMPTE274_3G_LEVEL_B, //!< 48 1080p 30.00Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048P_30_00_SMPTE372_3G_LEVEL_B, //!< 49 2048p 30.00Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080P_25_00_SMPTE274_3G_LEVEL_B, //!< 50 1080p 25.00Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048P_25_00_SMPTE372_3G_LEVEL_B, //!< 51 2048p 25.00Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080P_24_00_SMPTE274_3G_LEVEL_B, //!< 52 1080p 24.00Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048P_24_00_SMPTE372_3G_LEVEL_B, //!< 53 2048p 24.00Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080I_48_00_SMPTE274_3G_LEVEL_B, //!< 54 1080i 48.00Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048I_48_00_SMPTE372_3G_LEVEL_B, //!< 55 2048i 48.00Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080P_59_94_SMPTE274_3G_LEVEL_B, //!< 56 1080p 59.94Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_1080I_59_94_SMPTE274_3G_LEVEL_B, //!< 57 1080i 59.94Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048I_59_94_SMPTE372_3G_LEVEL_B, //!< 58 2048i 59.94Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080P_29_97_SMPTE274_3G_LEVEL_B, //!< 59 1080p 29.97Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048P_29_97_SMPTE372_3G_LEVEL_B, //!< 60 2048p 29.97Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080P_23_98_SMPTE274_3G_LEVEL_B, //!< 61 1080p 29.98Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048P_23_98_SMPTE372_3G_LEVEL_B, //!< 62 2048p 29.98Hz (SMPTE372) 3G Level B + NVVIOSIGNALFORMAT_1080I_47_96_SMPTE274_3G_LEVEL_B, //!< 63 1080i 47.96Hz (SMPTE274) 3G Level B + NVVIOSIGNALFORMAT_2048I_47_96_SMPTE372_3G_LEVEL_B, //!< 64 2048i 47.96Hz (SMPTE372) 3G Level B + + NVVIOSIGNALFORMAT_END //!< 65 To indicate end of signal format list + +}NVVIOSIGNALFORMAT; + +//! SMPTE standards format +typedef enum _NVVIOVIDEOSTANDARD +{ + NVVIOVIDEOSTANDARD_SMPTE259 , //!< SMPTE259 + NVVIOVIDEOSTANDARD_SMPTE260 , //!< SMPTE260 + NVVIOVIDEOSTANDARD_SMPTE274 , //!< SMPTE274 + NVVIOVIDEOSTANDARD_SMPTE295 , //!< SMPTE295 + NVVIOVIDEOSTANDARD_SMPTE296 , //!< SMPTE296 + NVVIOVIDEOSTANDARD_SMPTE372 , //!< SMPTE372 +}NVVIOVIDEOSTANDARD; + +//! HD or SD video type +typedef enum _NVVIOVIDEOTYPE +{ + NVVIOVIDEOTYPE_SD , //!< Standard-definition (SD) + NVVIOVIDEOTYPE_HD , //!< High-definition (HD) +}NVVIOVIDEOTYPE; + +//! Interlace mode +typedef enum _NVVIOINTERLACEMODE +{ + NVVIOINTERLACEMODE_PROGRESSIVE , //!< Progressive (p) + NVVIOINTERLACEMODE_INTERLACE , //!< Interlace (i) + NVVIOINTERLACEMODE_PSF , //!< Progressive Segment Frame (psf) +}NVVIOINTERLACEMODE; + +//! Video data format +typedef enum _NVVIODATAFORMAT +{ + NVVIODATAFORMAT_UNKNOWN = -1 , //!< Invalid DataFormat + NVVIODATAFORMAT_R8G8B8_TO_YCRCB444 , //!< R8:G8:B8 => YCrCb (4:4:4) + NVVIODATAFORMAT_R8G8B8A8_TO_YCRCBA4444 , //!< R8:G8:B8:A8 => YCrCbA (4:4:4:4) + NVVIODATAFORMAT_R8G8B8Z10_TO_YCRCBZ4444 , //!< R8:G8:B8:Z10 => YCrCbZ (4:4:4:4) + NVVIODATAFORMAT_R8G8B8_TO_YCRCB422 , //!< R8:G8:B8 => YCrCb (4:2:2) + NVVIODATAFORMAT_R8G8B8A8_TO_YCRCBA4224 , //!< R8:G8:B8:A8 => YCrCbA (4:2:2:4) + NVVIODATAFORMAT_R8G8B8Z10_TO_YCRCBZ4224 , //!< R8:G8:B8:Z10 => YCrCbZ (4:2:2:4) + NVVIODATAFORMAT_X8X8X8_444_PASSTHRU , //!< R8:G8:B8 => RGB (4:4:4) + NVVIODATAFORMAT_X8X8X8A8_4444_PASSTHRU , //!< R8:G8:B8:A8 => RGBA (4:4:4:4) + NVVIODATAFORMAT_X8X8X8Z10_4444_PASSTHRU , //!< R8:G8:B8:Z10 => RGBZ (4:4:4:4) + NVVIODATAFORMAT_X10X10X10_444_PASSTHRU , //!< Y10:CR10:CB10 => YCrCb (4:4:4) + NVVIODATAFORMAT_X10X8X8_444_PASSTHRU , //!< Y10:CR8:CB8 => YCrCb (4:4:4) + NVVIODATAFORMAT_X10X8X8A10_4444_PASSTHRU , //!< Y10:CR8:CB8:A10 => YCrCbA (4:4:4:4) + NVVIODATAFORMAT_X10X8X8Z10_4444_PASSTHRU , //!< Y10:CR8:CB8:Z10 => YCrCbZ (4:4:4:4) + NVVIODATAFORMAT_DUAL_R8G8B8_TO_DUAL_YCRCB422 , //!< R8:G8:B8 + R8:G8:B8 => YCrCb (4:2:2 + 4:2:2) + NVVIODATAFORMAT_DUAL_X8X8X8_TO_DUAL_422_PASSTHRU , //!< Y8:CR8:CB8 + Y8:CR8:CB8 => YCrCb (4:2:2 + 4:2:2) + NVVIODATAFORMAT_R10G10B10_TO_YCRCB422 , //!< R10:G10:B10 => YCrCb (4:2:2) + NVVIODATAFORMAT_R10G10B10_TO_YCRCB444 , //!< R10:G10:B10 => YCrCb (4:4:4) + NVVIODATAFORMAT_X12X12X12_444_PASSTHRU , //!< X12:X12:X12 => XXX (4:4:4) + NVVIODATAFORMAT_X12X12X12_422_PASSTHRU , //!< X12:X12:X12 => XXX (4:2:2) + NVVIODATAFORMAT_Y10CR10CB10_TO_YCRCB422 , //!< Y10:CR10:CB10 => YCrCb (4:2:2) + NVVIODATAFORMAT_Y8CR8CB8_TO_YCRCB422 , //!< Y8:CR8:CB8 => YCrCb (4:2:2) + NVVIODATAFORMAT_Y10CR8CB8A10_TO_YCRCBA4224 , //!< Y10:CR8:CB8:A10 => YCrCbA (4:2:2:4) + NVVIODATAFORMAT_R10G10B10_TO_RGB444 , //!< R10:G10:B10 => RGB (4:4:4) + NVVIODATAFORMAT_R12G12B12_TO_YCRCB444 , //!< R12:G12:B12 => YCrCb (4:4:4) + NVVIODATAFORMAT_R12G12B12_TO_YCRCB422 , //!< R12:G12:B12 => YCrCb (4:2:2) +}NVVIODATAFORMAT; + +//! Video output area +typedef enum _NVVIOOUTPUTAREA +{ + NVVIOOUTPUTAREA_FULLSIZE , //!< Output to entire video resolution (full size) + NVVIOOUTPUTAREA_SAFEACTION , //!< Output to centered 90% of video resolution (safe action) + NVVIOOUTPUTAREA_SAFETITLE , //!< Output to centered 80% of video resolution (safe title) +}NVVIOOUTPUTAREA; + +//! Synchronization source +typedef enum _NVVIOSYNCSOURCE +{ + NVVIOSYNCSOURCE_SDISYNC , //!< SDI Sync (Digital input) + NVVIOSYNCSOURCE_COMPSYNC , //!< COMP Sync (Composite input) +}NVVIOSYNCSOURCE; + +//! Composite synchronization type +typedef enum _NVVIOCOMPSYNCTYPE +{ + NVVIOCOMPSYNCTYPE_AUTO , //!< Auto-detect + NVVIOCOMPSYNCTYPE_BILEVEL , //!< Bi-level signal + NVVIOCOMPSYNCTYPE_TRILEVEL , //!< Tri-level signal +}NVVIOCOMPSYNCTYPE; + +//! Video input output status +typedef enum _NVVIOINPUTOUTPUTSTATUS +{ + NVINPUTOUTPUTSTATUS_OFF , //!< Not in use + NVINPUTOUTPUTSTATUS_ERROR , //!< Error detected + NVINPUTOUTPUTSTATUS_SDI_SD , //!< SDI (standard-definition) + NVINPUTOUTPUTSTATUS_SDI_HD , //!< SDI (high-definition) +}NVVIOINPUTOUTPUTSTATUS; + +//! Synchronization input status +typedef enum _NVVIOSYNCSTATUS +{ + NVVIOSYNCSTATUS_OFF , //!< Sync not detected + NVVIOSYNCSTATUS_ERROR , //!< Error detected + NVVIOSYNCSTATUS_SYNCLOSS , //!< Genlock in use, format mismatch with output + NVVIOSYNCSTATUS_COMPOSITE , //!< Composite sync + NVVIOSYNCSTATUS_SDI_SD , //!< SDI sync (standard-definition) + NVVIOSYNCSTATUS_SDI_HD , //!< SDI sync (high-definition) +}NVVIOSYNCSTATUS; + +//! Video Capture Status +typedef enum _NVVIOCAPTURESTATUS +{ + NVVIOSTATUS_STOPPED , //!< Sync not detected + NVVIOSTATUS_RUNNING , //!< Error detected + NVVIOSTATUS_ERROR , //!< Genlock in use, format mismatch with output +}NVVIOCAPTURESTATUS; + +//! Video Capture Status +typedef enum _NVVIOSTATUSTYPE +{ + NVVIOSTATUSTYPE_IN , //!< Input Status + NVVIOSTATUSTYPE_OUT , //!< Output Status +}NVVIOSTATUSTYPE; + + +//! Assumption, maximum 4 SDI input and 4 SDI output cards supported on a system +#define NVAPI_MAX_VIO_DEVICES 8 + +//! 4 physical jacks supported on each SDI input card. +#define NVAPI_MAX_VIO_JACKS 4 + + +//! Each physical jack an on SDI input card can have +//! two "channels" in the case of "3G" VideoFormats, as specified +//! by SMPTE 425; for non-3G VideoFormats, only the first channel within +//! a physical jack is valid. +#define NVAPI_MAX_VIO_CHANNELS_PER_JACK 2 + +//! 4 Streams, 1 per physical jack +#define NVAPI_MAX_VIO_STREAMS 4 + +#define NVAPI_MIN_VIO_STREAMS 1 + +//! SDI input supports a max of 2 links per stream +#define NVAPI_MAX_VIO_LINKS_PER_STREAM 2 + + +#define NVAPI_MAX_FRAMELOCK_MAPPING_MODES 20 + +//! Min number of capture images +#define NVAPI_GVI_MIN_RAW_CAPTURE_IMAGES 1 + +//! Max number of capture images +#define NVAPI_GVI_MAX_RAW_CAPTURE_IMAGES 32 + +//! Default number of capture images +#define NVAPI_GVI_DEFAULT_RAW_CAPTURE_IMAGES 5 + + + +// Data Signal notification events. These need a event handler in RM. +// Register/Unregister and PopEvent NVAPI's are already available. + +//! Device configuration +typedef enum _NVVIOCONFIGTYPE +{ + NVVIOCONFIGTYPE_IN , //!< Input Status + NVVIOCONFIGTYPE_OUT , //!< Output Status +}NVVIOCONFIGTYPE; + +typedef enum _NVVIOCOLORSPACE +{ + NVVIOCOLORSPACE_UNKNOWN, + NVVIOCOLORSPACE_YCBCR, + NVVIOCOLORSPACE_YCBCRA, + NVVIOCOLORSPACE_YCBCRD, + NVVIOCOLORSPACE_GBR, + NVVIOCOLORSPACE_GBRA, + NVVIOCOLORSPACE_GBRD, +} NVVIOCOLORSPACE; + +//! Component sampling +typedef enum _NVVIOCOMPONENTSAMPLING +{ + NVVIOCOMPONENTSAMPLING_UNKNOWN, + NVVIOCOMPONENTSAMPLING_4444, + NVVIOCOMPONENTSAMPLING_4224, + NVVIOCOMPONENTSAMPLING_444, + NVVIOCOMPONENTSAMPLING_422 +} NVVIOCOMPONENTSAMPLING; + +typedef enum _NVVIOBITSPERCOMPONENT +{ + NVVIOBITSPERCOMPONENT_UNKNOWN, + NVVIOBITSPERCOMPONENT_8, + NVVIOBITSPERCOMPONENT_10, + NVVIOBITSPERCOMPONENT_12, +} NVVIOBITSPERCOMPONENT; + +typedef enum _NVVIOLINKID +{ + NVVIOLINKID_UNKNOWN, + NVVIOLINKID_A, + NVVIOLINKID_B, + NVVIOLINKID_C, + NVVIOLINKID_D +} NVVIOLINKID; + + +typedef enum _NVVIOANCPARITYCOMPUTATION +{ + NVVIOANCPARITYCOMPUTATION_AUTO, + NVVIOANCPARITYCOMPUTATION_ON, + NVVIOANCPARITYCOMPUTATION_OFF +} NVVIOANCPARITYCOMPUTATION; + + + +//! @} + + +//--------------------------------------------------------------------- +// Structures +//--------------------------------------------------------------------- + +//! \addtogroup vidio +//! @{ + + +//! Supports Serial Digital Interface (SDI) output +#define NVVIOCAPS_VIDOUT_SDI 0x00000001 + +//! Supports Internal timing source +#define NVVIOCAPS_SYNC_INTERNAL 0x00000100 + +//! Supports Genlock timing source +#define NVVIOCAPS_SYNC_GENLOCK 0x00000200 + +//! Supports Serial Digital Interface (SDI) synchronization input +#define NVVIOCAPS_SYNCSRC_SDI 0x00001000 + +//! Supports Composite synchronization input +#define NVVIOCAPS_SYNCSRC_COMP 0x00002000 + +//! Supports Desktop transparent mode +#define NVVIOCAPS_OUTPUTMODE_DESKTOP 0x00010000 + +//! Supports OpenGL application mode +#define NVVIOCAPS_OUTPUTMODE_OPENGL 0x00020000 + +//! Supports Serial Digital Interface (SDI) input +#define NVVIOCAPS_VIDIN_SDI 0x00100000 + +//! Supports Packed ANC +#define NVVIOCAPS_PACKED_ANC_SUPPORTED 0x00200000 + +//! Supports ANC audio blanking +#define NVVIOCAPS_AUDIO_BLANKING_SUPPORTED 0x00400000 + +//! SDI-class interface: SDI output with two genlock inputs +#define NVVIOCLASS_SDI 0x00000001 + +//! Device capabilities +typedef struct _NVVIOCAPS +{ + NvU32 version; //!< Structure version + NvAPI_String adapterName; //!< Graphics adapter name + NvU32 adapterClass; //!< Graphics adapter classes (NVVIOCLASS_SDI mask) + NvU32 adapterCaps; //!< Graphics adapter capabilities (NVVIOCAPS_* mask) + NvU32 dipSwitch; //!< On-board DIP switch settings bits + NvU32 dipSwitchReserved; //!< On-board DIP switch settings reserved bits + NvU32 boardID; //!< Board ID + //! Driver version + struct // + { + NvU32 majorVersion; //!< Major version. For GVI, majorVersion contains MajorVersion(HIWORD) And MinorVersion(LOWORD) + NvU32 minorVersion; //!< Minor version. For GVI, minorVersion contains Revison(HIWORD) And Build(LOWORD) + } driver; // + //! Firmware version + struct + { + NvU32 majorVersion; //!< Major version. In version 2, for both GVI and GVO, majorVersion contains MajorVersion(HIWORD) And MinorVersion(LOWORD) + NvU32 minorVersion; //!< Minor version. In version 2, for both GVI and GVO, minorVersion contains Revison(HIWORD) And Build(LOWORD) + } firmWare; // + NVVIOOWNERID ownerId; //!< Unique identifier for owner of video output (NVVIOOWNERID_INVALID if free running) + NVVIOOWNERTYPE ownerType; //!< Owner type (OpenGL application or Desktop mode) +} NVVIOCAPS; + +//! Macro for constructing the version field of NVVIOCAPS +#define NVVIOCAPS_VER1 MAKE_NVAPI_VERSION(NVVIOCAPS,1) +#define NVVIOCAPS_VER2 MAKE_NVAPI_VERSION(NVVIOCAPS,2) +#define NVVIOCAPS_VER NVVIOCAPS_VER2 + +//! Input channel status +typedef struct _NVVIOCHANNELSTATUS +{ + NvU32 smpte352; //!< 4-byte SMPTE 352 video payload identifier + NVVIOSIGNALFORMAT signalFormat; //!< Signal format + NVVIOBITSPERCOMPONENT bitsPerComponent; //!< Bits per component + NVVIOCOMPONENTSAMPLING samplingFormat; //!< Sampling format + NVVIOCOLORSPACE colorSpace; //!< Color space + NVVIOLINKID linkID; //!< Link ID +} NVVIOCHANNELSTATUS; + +//! Input device status +typedef struct _NVVIOINPUTSTATUS +{ + NVVIOCHANNELSTATUS vidIn[NVAPI_MAX_VIO_JACKS][NVAPI_MAX_VIO_CHANNELS_PER_JACK]; //!< Video input status per channel within a jack + NVVIOCAPTURESTATUS captureStatus; //!< status of video capture +} NVVIOINPUTSTATUS; + +//! Output device status +typedef struct _NVVIOOUTPUTSTATUS +{ + NVVIOINPUTOUTPUTSTATUS vid1Out; //!< Video 1 output status + NVVIOINPUTOUTPUTSTATUS vid2Out; //!< Video 2 output status + NVVIOSYNCSTATUS sdiSyncIn; //!< SDI sync input status + NVVIOSYNCSTATUS compSyncIn; //!< Composite sync input status + NvU32 syncEnable; //!< Sync enable (TRUE if using syncSource) + NVVIOSYNCSOURCE syncSource; //!< Sync source + NVVIOSIGNALFORMAT syncFormat; //!< Sync format + NvU32 frameLockEnable; //!< Framelock enable flag + NvU32 outputVideoLocked; //!< Output locked status + NvU32 dataIntegrityCheckErrorCount; //!< Data integrity check error count + NvU32 dataIntegrityCheckEnabled; //!< Data integrity check status enabled + NvU32 dataIntegrityCheckFailed; //!< Data integrity check status failed + NvU32 uSyncSourceLocked; //!< genlocked to framelocked to ref signal + NvU32 uPowerOn; //!< TRUE: indicates there is sufficient power +} NVVIOOUTPUTSTATUS; + +//! Video device status. +typedef struct _NVVIOSTATUS +{ + NvU32 version; //!< Structure version + NVVIOSTATUSTYPE nvvioStatusType; //!< Input or Output status + union + { + NVVIOINPUTSTATUS inStatus; //!< Input device status + NVVIOOUTPUTSTATUS outStatus; //!< Output device status + }vioStatus; +} NVVIOSTATUS; + +//! Macro for constructingthe version field of NVVIOSTATUS +#define NVVIOSTATUS_VER MAKE_NVAPI_VERSION(NVVIOSTATUS,1) + +//! Output region +typedef struct _NVVIOOUTPUTREGION +{ + NvU32 x; //!< Horizontal origin in pixels + NvU32 y; //!< Vertical origin in pixels + NvU32 width; //!< Width of region in pixels + NvU32 height; //!< Height of region in pixels +} NVVIOOUTPUTREGION; + +//! Gamma ramp (8-bit index) +typedef struct _NVVIOGAMMARAMP8 +{ + NvU16 uRed[256]; //!< Red channel gamma ramp (8-bit index, 16-bit values) + NvU16 uGreen[256]; //!< Green channel gamma ramp (8-bit index, 16-bit values) + NvU16 uBlue[256]; //!< Blue channel gamma ramp (8-bit index, 16-bit values) +} NVVIOGAMMARAMP8; + +//! Gamma ramp (10-bit index) +typedef struct _NVVIOGAMMARAMP10 +{ + NvU16 uRed[1024]; //!< Red channel gamma ramp (10-bit index, 16-bit values) + NvU16 uGreen[1024]; //!< Green channel gamma ramp (10-bit index, 16-bit values) + NvU16 uBlue[1024]; //!< Blue channel gamma ramp (10-bit index, 16-bit values) +} NVVIOGAMMARAMP10; + + +//! Sync delay +typedef struct _NVVIOSYNCDELAY +{ + NvU32 version; //!< Structure version + NvU32 horizontalDelay; //!< Horizontal delay in pixels + NvU32 verticalDelay; //!< Vertical delay in lines +} NVVIOSYNCDELAY; + +//! Macro for constructing the version field of NVVIOSYNCDELAY +#define NVVIOSYNCDELAY_VER MAKE_NVAPI_VERSION(NVVIOSYNCDELAY,1) + + +//! Video mode information +typedef struct _NVVIOVIDEOMODE +{ + NvU32 horizontalPixels; //!< Horizontal resolution (in pixels) + NvU32 verticalLines; //!< Vertical resolution for frame (in lines) + float fFrameRate; //!< Frame rate + NVVIOINTERLACEMODE interlaceMode; //!< Interlace mode + NVVIOVIDEOSTANDARD videoStandard; //!< SMPTE standards format + NVVIOVIDEOTYPE videoType; //!< HD or SD signal classification +} NVVIOVIDEOMODE; + +//! Signal format details +typedef struct _NVVIOSIGNALFORMATDETAIL +{ + NVVIOSIGNALFORMAT signalFormat; //!< Signal format enumerated value + NVVIOVIDEOMODE videoMode; //!< Video mode for signal format +}NVVIOSIGNALFORMATDETAIL; + + +//! R8:G8:B8 +#define NVVIOBUFFERFORMAT_R8G8B8 0x00000001 + +//! R8:G8:B8:Z24 +#define NVVIOBUFFERFORMAT_R8G8B8Z24 0x00000002 + +//! R8:G8:B8:A8 +#define NVVIOBUFFERFORMAT_R8G8B8A8 0x00000004 + +//! R8:G8:B8:A8:Z24 +#define NVVIOBUFFERFORMAT_R8G8B8A8Z24 0x00000008 + +//! R16FP:G16FP:B16FP +#define NVVIOBUFFERFORMAT_R16FPG16FPB16FP 0x00000010 + +//! R16FP:G16FP:B16FP:Z24 +#define NVVIOBUFFERFORMAT_R16FPG16FPB16FPZ24 0x00000020 + +//! R16FP:G16FP:B16FP:A16FP +#define NVVIOBUFFERFORMAT_R16FPG16FPB16FPA16FP 0x00000040 + +//! R16FP:G16FP:B16FP:A16FP:Z24 +#define NVVIOBUFFERFORMAT_R16FPG16FPB16FPA16FPZ24 0x00000080 + + + +//! Data format details +typedef struct _NVVIODATAFORMATDETAIL +{ + NVVIODATAFORMAT dataFormat; //!< Data format enumerated value + NvU32 vioCaps; //!< Data format capabilities (NVVIOCAPS_* mask) +}NVVIODATAFORMATDETAIL; + +//! Colorspace conversion +typedef struct _NVVIOCOLORCONVERSION +{ + NvU32 version; //!< Structure version + float colorMatrix[3][3]; //!< Output[n] = + float colorOffset[3]; //!< Input[0] * colorMatrix[n][0] + + float colorScale[3]; //!< Input[1] * colorMatrix[n][1] + + //!< Input[2] * colorMatrix[n][2] + + //!< OutputRange * colorOffset[n] + //!< where OutputRange is the standard magnitude of + //!< Output[n][n] and colorMatrix and colorOffset + //!< values are within the range -1.0 to +1.0 + NvU32 compositeSafe; //!< compositeSafe constrains luminance range when using composite output +} NVVIOCOLORCONVERSION; + +//! macro for constructing the version field of _NVVIOCOLORCONVERSION. +#define NVVIOCOLORCONVERSION_VER MAKE_NVAPI_VERSION(NVVIOCOLORCONVERSION,1) + +//! Gamma correction +typedef struct _NVVIOGAMMACORRECTION +{ + NvU32 version; //!< Structure version + NvU32 vioGammaCorrectionType; //!< Gamma correction type (8-bit or 10-bit) + //! Gamma correction: + union + { + NVVIOGAMMARAMP8 gammaRamp8; //!< Gamma ramp (8-bit index, 16-bit values) + NVVIOGAMMARAMP10 gammaRamp10; //!< Gamma ramp (10-bit index, 16-bit values) + }gammaRamp; + float fGammaValueR; //!< Red Gamma value within gamma ranges. 0.5 - 6.0 + float fGammaValueG; //!< Green Gamma value within gamma ranges. 0.5 - 6.0 + float fGammaValueB; //!< Blue Gamma value within gamma ranges. 0.5 - 6.0 +} NVVIOGAMMACORRECTION; + +//! Macro for constructing thevesion field of _NVVIOGAMMACORRECTION +#define NVVIOGAMMACORRECTION_VER MAKE_NVAPI_VERSION(NVVIOGAMMACORRECTION,1) + +//! Maximum number of ranges per channel +#define MAX_NUM_COMPOSITE_RANGE 2 + + +typedef struct _NVVIOCOMPOSITERANGE +{ + NvU32 uRange; + NvU32 uEnabled; + NvU32 uMin; + NvU32 uMax; +} NVVIOCOMPOSITERANGE; + + + +// Device configuration (fields masks indicating NVVIOCONFIG fields to use for NvAPI_VIO_GetConfig/NvAPI_VIO_SetConfig() ) +// +#define NVVIOCONFIG_SIGNALFORMAT 0x00000001 //!< fields: signalFormat +#define NVVIOCONFIG_DATAFORMAT 0x00000002 //!< fields: dataFormat +#define NVVIOCONFIG_OUTPUTREGION 0x00000004 //!< fields: outputRegion +#define NVVIOCONFIG_OUTPUTAREA 0x00000008 //!< fields: outputArea +#define NVVIOCONFIG_COLORCONVERSION 0x00000010 //!< fields: colorConversion +#define NVVIOCONFIG_GAMMACORRECTION 0x00000020 //!< fields: gammaCorrection +#define NVVIOCONFIG_SYNCSOURCEENABLE 0x00000040 //!< fields: syncSource and syncEnable +#define NVVIOCONFIG_SYNCDELAY 0x00000080 //!< fields: syncDelay +#define NVVIOCONFIG_COMPOSITESYNCTYPE 0x00000100 //!< fields: compositeSyncType +#define NVVIOCONFIG_FRAMELOCKENABLE 0x00000200 //!< fields: EnableFramelock +#define NVVIOCONFIG_422FILTER 0x00000400 //!< fields: bEnable422Filter +#define NVVIOCONFIG_COMPOSITETERMINATE 0x00000800 //!< fields: bCompositeTerminate (Not supported on Quadro FX 4000 SDI) +#define NVVIOCONFIG_DATAINTEGRITYCHECK 0x00001000 //!< fields: bEnableDataIntegrityCheck (Not supported on Quadro FX 4000 SDI) +#define NVVIOCONFIG_CSCOVERRIDE 0x00002000 //!< fields: colorConversion override +#define NVVIOCONFIG_FLIPQUEUELENGTH 0x00004000 //!< fields: flipqueuelength control +#define NVVIOCONFIG_ANCTIMECODEGENERATION 0x00008000 //!< fields: bEnableANCTimeCodeGeneration +#define NVVIOCONFIG_COMPOSITE 0x00010000 //!< fields: bEnableComposite +#define NVVIOCONFIG_ALPHAKEYCOMPOSITE 0x00020000 //!< fields: bEnableAlphaKeyComposite +#define NVVIOCONFIG_COMPOSITE_Y 0x00040000 //!< fields: compRange +#define NVVIOCONFIG_COMPOSITE_CR 0x00080000 //!< fields: compRange +#define NVVIOCONFIG_COMPOSITE_CB 0x00100000 //!< fields: compRange +#define NVVIOCONFIG_FULL_COLOR_RANGE 0x00200000 //!< fields: bEnableFullColorRange +#define NVVIOCONFIG_RGB_DATA 0x00400000 //!< fields: bEnableRGBData +#define NVVIOCONFIG_RESERVED_SDIOUTPUTENABLE 0x00800000 //!< fields: bEnableSDIOutput +#define NVVIOCONFIG_STREAMS 0x01000000 //!< fields: streams +#define NVVIOCONFIG_ANC_PARITY_COMPUTATION 0x02000000 //!< fields: ancParityComputation +#define NVVIOCONFIG_ANC_AUDIO_REPEAT 0x04000000 //!< fields: enableAudioBlanking + + +// Don't forget to update NVVIOCONFIG_VALIDFIELDS in nvapi.spec when NVVIOCONFIG_ALLFIELDS changes. +#define NVVIOCONFIG_ALLFIELDS ( NVVIOCONFIG_SIGNALFORMAT | \ + NVVIOCONFIG_DATAFORMAT | \ + NVVIOCONFIG_OUTPUTREGION | \ + NVVIOCONFIG_OUTPUTAREA | \ + NVVIOCONFIG_COLORCONVERSION | \ + NVVIOCONFIG_GAMMACORRECTION | \ + NVVIOCONFIG_SYNCSOURCEENABLE | \ + NVVIOCONFIG_SYNCDELAY | \ + NVVIOCONFIG_COMPOSITESYNCTYPE | \ + NVVIOCONFIG_FRAMELOCKENABLE | \ + NVVIOCONFIG_422FILTER | \ + NVVIOCONFIG_COMPOSITETERMINATE | \ + NVVIOCONFIG_DATAINTEGRITYCHECK | \ + NVVIOCONFIG_CSCOVERRIDE | \ + NVVIOCONFIG_FLIPQUEUELENGTH | \ + NVVIOCONFIG_ANCTIMECODEGENERATION | \ + NVVIOCONFIG_COMPOSITE | \ + NVVIOCONFIG_ALPHAKEYCOMPOSITE | \ + NVVIOCONFIG_COMPOSITE_Y | \ + NVVIOCONFIG_COMPOSITE_CR | \ + NVVIOCONFIG_COMPOSITE_CB | \ + NVVIOCONFIG_FULL_COLOR_RANGE | \ + NVVIOCONFIG_RGB_DATA | \ + NVVIOCONFIG_RESERVED_SDIOUTPUTENABLE | \ + NVVIOCONFIG_STREAMS | \ + NVVIOCONFIG_ANC_PARITY_COMPUTATION | \ + NVVIOCONFIG_ANC_AUDIO_REPEAT ) + +#define NVVIOCONFIG_VALIDFIELDS ( NVVIOCONFIG_SIGNALFORMAT | \ + NVVIOCONFIG_DATAFORMAT | \ + NVVIOCONFIG_OUTPUTREGION | \ + NVVIOCONFIG_OUTPUTAREA | \ + NVVIOCONFIG_COLORCONVERSION | \ + NVVIOCONFIG_GAMMACORRECTION | \ + NVVIOCONFIG_SYNCSOURCEENABLE | \ + NVVIOCONFIG_SYNCDELAY | \ + NVVIOCONFIG_COMPOSITESYNCTYPE | \ + NVVIOCONFIG_FRAMELOCKENABLE | \ + NVVIOCONFIG_RESERVED_SDIOUTPUTENABLE | \ + NVVIOCONFIG_422FILTER | \ + NVVIOCONFIG_COMPOSITETERMINATE | \ + NVVIOCONFIG_DATAINTEGRITYCHECK | \ + NVVIOCONFIG_CSCOVERRIDE | \ + NVVIOCONFIG_FLIPQUEUELENGTH | \ + NVVIOCONFIG_ANCTIMECODEGENERATION | \ + NVVIOCONFIG_COMPOSITE | \ + NVVIOCONFIG_ALPHAKEYCOMPOSITE | \ + NVVIOCONFIG_COMPOSITE_Y | \ + NVVIOCONFIG_COMPOSITE_CR | \ + NVVIOCONFIG_COMPOSITE_CB | \ + NVVIOCONFIG_FULL_COLOR_RANGE | \ + NVVIOCONFIG_RGB_DATA | \ + NVVIOCONFIG_RESERVED_SDIOUTPUTENABLE | \ + NVVIOCONFIG_STREAMS | \ + NVVIOCONFIG_ANC_PARITY_COMPUTATION | \ + NVVIOCONFIG_ANC_AUDIO_REPEAT) + +#define NVVIOCONFIG_DRIVERFIELDS ( NVVIOCONFIG_OUTPUTREGION | \ + NVVIOCONFIG_OUTPUTAREA | \ + NVVIOCONFIG_COLORCONVERSION | \ + NVVIOCONFIG_FLIPQUEUELENGTH) + +#define NVVIOCONFIG_GAMMAFIELDS ( NVVIOCONFIG_GAMMACORRECTION ) + +#define NVVIOCONFIG_RMCTRLFIELDS ( NVVIOCONFIG_SIGNALFORMAT | \ + NVVIOCONFIG_DATAFORMAT | \ + NVVIOCONFIG_SYNCSOURCEENABLE | \ + NVVIOCONFIG_COMPOSITESYNCTYPE | \ + NVVIOCONFIG_FRAMELOCKENABLE | \ + NVVIOCONFIG_422FILTER | \ + NVVIOCONFIG_COMPOSITETERMINATE | \ + NVVIOCONFIG_DATAINTEGRITYCHECK | \ + NVVIOCONFIG_COMPOSITE | \ + NVVIOCONFIG_ALPHAKEYCOMPOSITE | \ + NVVIOCONFIG_COMPOSITE_Y | \ + NVVIOCONFIG_COMPOSITE_CR | \ + NVVIOCONFIG_COMPOSITE_CB) + +#define NVVIOCONFIG_RMSKEWFIELDS ( NVVIOCONFIG_SYNCDELAY ) + +#define NVVIOCONFIG_ALLOWSDIRUNNING_FIELDS ( NVVIOCONFIG_DATAINTEGRITYCHECK | \ + NVVIOCONFIG_SYNCDELAY | \ + NVVIOCONFIG_CSCOVERRIDE | \ + NVVIOCONFIG_ANCTIMECODEGENERATION | \ + NVVIOCONFIG_COMPOSITE | \ + NVVIOCONFIG_ALPHAKEYCOMPOSITE | \ + NVVIOCONFIG_COMPOSITE_Y | \ + NVVIOCONFIG_COMPOSITE_CR | \ + NVVIOCONFIG_COMPOSITE_CB | \ + NVVIOCONFIG_ANC_PARITY_COMPUTATION) + + + #define NVVIOCONFIG_RMMODESET_FIELDS ( NVVIOCONFIG_SIGNALFORMAT | \ + NVVIOCONFIG_DATAFORMAT | \ + NVVIOCONFIG_SYNCSOURCEENABLE | \ + NVVIOCONFIG_FRAMELOCKENABLE | \ + NVVIOCONFIG_COMPOSITESYNCTYPE | \ + NVVIOCONFIG_ANC_AUDIO_REPEAT) + + +//! Output device configuration +// No members can be deleted from below structure. Only add new members at the +// end of the structure. +typedef struct _NVVIOOUTPUTCONFIG_V1 +{ + NVVIOSIGNALFORMAT signalFormat; //!< Signal format for video output + NVVIODATAFORMAT dataFormat; //!< Data format for video output + NVVIOOUTPUTREGION outputRegion; //!< Region for video output (Desktop mode) + NVVIOOUTPUTAREA outputArea; //!< Usable resolution for video output (safe area) + NVVIOCOLORCONVERSION colorConversion; //!< Color conversion. + NVVIOGAMMACORRECTION gammaCorrection; + NvU32 syncEnable; //!< Sync enable (TRUE to use syncSource) + NVVIOSYNCSOURCE syncSource; //!< Sync source + NVVIOSYNCDELAY syncDelay; //!< Sync delay + NVVIOCOMPSYNCTYPE compositeSyncType; //!< Composite sync type + NvU32 frameLockEnable; //!< Flag indicating whether framelock was on/off + NvU32 psfSignalFormat; //!< Indicates whether contained format is PSF Signal format + NvU32 enable422Filter; //!< Enables/Disables 4:2:2 filter + NvU32 compositeTerminate; //!< Composite termination + NvU32 enableDataIntegrityCheck; //!< Enable data integrity check: true - enable, false - disable + NvU32 cscOverride; //!< Use provided CSC color matrix to overwrite + NvU32 flipQueueLength; //!< Number of buffers used for the internal flipqueue + NvU32 enableANCTimeCodeGeneration; //!< Enable SDI ANC time code generation + NvU32 enableComposite; //!< Enable composite + NvU32 enableAlphaKeyComposite; //!< Enable Alpha key composite + NVVIOCOMPOSITERANGE compRange; //!< Composite ranges + NvU8 reservedData[256]; //!< Inicates last stored SDI output state TRUE-ON / FALSE-OFF + NvU32 enableFullColorRange; //!< Flag indicating Full Color Range + NvU32 enableRGBData; //!< Indicates data is in RGB format +} NVVIOOUTPUTCONFIG_V1; + +typedef struct _NVVIOOUTPUTCONFIG_V2 +{ + NVVIOSIGNALFORMAT signalFormat; //!< Signal format for video output + NVVIODATAFORMAT dataFormat; //!< Data format for video output + NVVIOOUTPUTREGION outputRegion; //!< Region for video output (Desktop mode) + NVVIOOUTPUTAREA outputArea; //!< Usable resolution for video output (safe area) + NVVIOCOLORCONVERSION colorConversion; //!< Color conversion. + NVVIOGAMMACORRECTION gammaCorrection; + NvU32 syncEnable; //!< Sync enable (TRUE to use syncSource) + NVVIOSYNCSOURCE syncSource; //!< Sync source + NVVIOSYNCDELAY syncDelay; //!< Sync delay + NVVIOCOMPSYNCTYPE compositeSyncType; //!< Composite sync type + NvU32 frameLockEnable; //!< Flag indicating whether framelock was on/off + NvU32 psfSignalFormat; //!< Indicates whether contained format is PSF Signal format + NvU32 enable422Filter; //!< Enables/Disables 4:2:2 filter + NvU32 compositeTerminate; //!< Composite termination + NvU32 enableDataIntegrityCheck; //!< Enable data integrity check: true - enable, false - disable + NvU32 cscOverride; //!< Use provided CSC color matrix to overwrite + NvU32 flipQueueLength; //!< Number of buffers used for the internal flip queue + NvU32 enableANCTimeCodeGeneration; //!< Enable SDI ANC time code generation + NvU32 enableComposite; //!< Enable composite + NvU32 enableAlphaKeyComposite; //!< Enable Alpha key composite + NVVIOCOMPOSITERANGE compRange; //!< Composite ranges + NvU8 reservedData[256]; //!< Indicates last stored SDI output state TRUE-ON / FALSE-OFF + NvU32 enableFullColorRange; //!< Flag indicating Full Color Range + NvU32 enableRGBData; //!< Indicates data is in RGB format + NVVIOANCPARITYCOMPUTATION ancParityComputation; //!< Enable HW ANC parity bit computation (auto/on/off) +} NVVIOOUTPUTCONFIG_V2; + +typedef struct _NVVIOOUTPUTCONFIG_V3 +{ + NVVIOSIGNALFORMAT signalFormat; //!< Signal format for video output + NVVIODATAFORMAT dataFormat; //!< Data format for video output + NVVIOOUTPUTREGION outputRegion; //!< Region for video output (Desktop mode) + NVVIOOUTPUTAREA outputArea; //!< Usable resolution for video output (safe area) + NVVIOCOLORCONVERSION colorConversion; //!< Color conversion. + NVVIOGAMMACORRECTION gammaCorrection; + NvU32 syncEnable; //!< Sync enable (TRUE to use syncSource) + NVVIOSYNCSOURCE syncSource; //!< Sync source + NVVIOSYNCDELAY syncDelay; //!< Sync delay + NVVIOCOMPSYNCTYPE compositeSyncType; //!< Composite sync type + NvU32 frameLockEnable; //!< Flag indicating whether framelock was on/off + NvU32 psfSignalFormat; //!< Indicates whether contained format is PSF Signal format + NvU32 enable422Filter; //!< Enables/Disables 4:2:2 filter + NvU32 compositeTerminate; //!< Composite termination + NvU32 enableDataIntegrityCheck; //!< Enable data integrity check: true - enable, false - disable + NvU32 cscOverride; //!< Use provided CSC color matrix to overwrite + NvU32 flipQueueLength; //!< Number of buffers used for the internal flip queue + NvU32 enableANCTimeCodeGeneration; //!< Enable SDI ANC time code generation + NvU32 enableComposite; //!< Enable composite + NvU32 enableAlphaKeyComposite; //!< Enable Alpha key composite + NVVIOCOMPOSITERANGE compRange; //!< Composite ranges + NvU8 reservedData[256]; //!< Indicates last stored SDI output state TRUE-ON / FALSE-OFF + NvU32 enableFullColorRange; //!< Flag indicating Full Color Range + NvU32 enableRGBData; //!< Indicates data is in RGB format + NVVIOANCPARITYCOMPUTATION ancParityComputation; //!< Enable HW ANC parity bit computation (auto/on/off) + NvU32 enableAudioBlanking; //!< Enable HANC audio blanking on repeat frames +} NVVIOOUTPUTCONFIG_V3; + +//! Stream configuration +typedef struct _NVVIOSTREAM +{ + NvU32 bitsPerComponent; //!< Bits per component + NVVIOCOMPONENTSAMPLING sampling; //!< Sampling + NvU32 expansionEnable; //!< Enable/disable 4:2:2->4:4:4 expansion + NvU32 numLinks; //!< Number of active links + struct + { + NvU32 jack; //!< This stream's link[i] will use the specified (0-based) channel within the + NvU32 channel; //!< specified (0-based) jack + } links[NVAPI_MAX_VIO_LINKS_PER_STREAM]; +} NVVIOSTREAM; + +//! Input device configuration +typedef struct _NVVIOINPUTCONFIG +{ + NvU32 numRawCaptureImages; //!< numRawCaptureImages is the number of frames to keep in the capture queue. + //!< must be between NVAPI_GVI_MIN_RAW_CAPTURE_IMAGES and NVAPI_GVI_MAX_RAW_CAPTURE_IMAGES, + NVVIOSIGNALFORMAT signalFormat; //!< Signal format. + //!< Please note that both numRawCaptureImages and signalFormat should be set together. + NvU32 numStreams; //!< Number of active streams. + NVVIOSTREAM streams[NVAPI_MAX_VIO_STREAMS]; //!< Stream configurations + NvU32 bTestMode; //!< This attribute controls the GVI test mode. + //!< Possible values 0/1. When testmode enabled, the + //!< GVI device will generate fake data as quickly as possible. +} NVVIOINPUTCONFIG; + +typedef struct _NVVIOCONFIG_V1 +{ + NvU32 version; //!< Structure version + NvU32 fields; //!< Caller sets to NVVIOCONFIG_* mask for fields to use + NVVIOCONFIGTYPE nvvioConfigType; //!< Input or Output configuration + union + { + NVVIOINPUTCONFIG inConfig; //!< Input device configuration + NVVIOOUTPUTCONFIG_V1 outConfig; //!< Output device configuration + }vioConfig; +} NVVIOCONFIG_V1; + + +typedef struct _NVVIOCONFIG_V2 +{ + NvU32 version; //!< Structure version + NvU32 fields; //!< Caller sets to NVVIOCONFIG_* mask for fields to use + NVVIOCONFIGTYPE nvvioConfigType; //!< Input or Output configuration + union + { + NVVIOINPUTCONFIG inConfig; //!< Input device configuration + NVVIOOUTPUTCONFIG_V2 outConfig; //!< Output device configuration + }vioConfig; +} NVVIOCONFIG_V2; + +typedef struct _NVVIOCONFIG_V3 +{ + NvU32 version; //!< Structure version + NvU32 fields; //!< Caller sets to NVVIOCONFIG_* mask for fields to use + NVVIOCONFIGTYPE nvvioConfigType; //!< Input or Output configuration + union + { + NVVIOINPUTCONFIG inConfig; //!< Input device configuration + NVVIOOUTPUTCONFIG_V3 outConfig; //!< Output device configuration + }vioConfig; +} NVVIOCONFIG_V3; +typedef NVVIOOUTPUTCONFIG_V3 NVVIOOUTPUTCONFIG; +typedef NVVIOCONFIG_V3 NVVIOCONFIG; + +#define NVVIOCONFIG_VER1 MAKE_NVAPI_VERSION(NVVIOCONFIG_V1,1) +#define NVVIOCONFIG_VER2 MAKE_NVAPI_VERSION(NVVIOCONFIG_V2,2) +#define NVVIOCONFIG_VER3 MAKE_NVAPI_VERSION(NVVIOCONFIG_V3,3) +#define NVVIOCONFIG_VER NVVIOCONFIG_VER3 + + +typedef struct +{ + NvPhysicalGpuHandle hPhysicalGpu; //!< Handle to Physical GPU (This could be NULL for GVI device if its not binded) + NvVioHandle hVioHandle; //!Create Stereo Handle->InitActivation->Reset Device +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! \since Release: 302 +//! +//! \param [in] stereoHandle Stereo handle corresponding to the device interface. +//! \param [in] bDelayed Use delayed activation +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, +//! they are listed below. +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED - Stereo part of NVAPI not initialized. +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// + +//! \addtogroup stereoapi +//! @{ + +//! InitActivation Flags +typedef enum _NVAPI_STEREO_INIT_ACTIVATION_FLAGS +{ + NVAPI_STEREO_INIT_ACTIVATION_IMMEDIATE = 0X00, + NVAPI_STEREO_INIT_ACTIVATION_DELAYED = 0x01, +} NVAPI_STEREO_INIT_ACTIVATION_FLAGS; + +NVAPI_INTERFACE NvAPI_Stereo_InitActivation(__in StereoHandle hStereoHandle, __in NVAPI_STEREO_INIT_ACTIVATION_FLAGS flags); + +//! @} + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_Trigger_Activation +// +//! DESCRIPTION: This API allows an application to trigger creation of a stereo desktop, +//! in case the creation was stopped on application launch. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! \since Release: 302 +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, +//! they are listed below. +//! \retval ::NVAPI_STEREO_INIT_ACTIVATION_NOT_DONE - Stereo InitActivation not called. +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED - Stereo part of NVAPI not initialized. +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_Trigger_Activation(__in StereoHandle hStereoHandle); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_CapturePngImage +// +//! DESCRIPTION: This API captures the current stereo image in PNG stereo format. +//! Only the last capture call per flip will be effective. +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle corresponding to the device interface. +//! +//! \retval ::NVAPI_OK Image captured. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_CapturePngImage(StereoHandle stereoHandle); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_ReverseStereoBlitControl +// +//! DESCRIPTION: This API turns on/off reverse stereo blit. +//! +//! HOW TO USE: Use after the stereo handle for the device interface is created via successfull call to the appropriate +//! NvAPI_Stereo_CreateHandleFrom() function. +//! After reversed stereo blit control is turned on, blits from the stereo surface will +//! produce the right-eye image in the left side of the destination surface and the left-eye +//! image in the right side of the destination surface. +//! +//! In DirectX 9, the destination surface must be created as the render target, and StretchRect must be used. +//! Conditions: +//! - DstWidth == 2*SrcWidth +//! - DstHeight == SrcHeight +//! - Src surface is the stereo surface. +//! - SrcRect must be {0,0,SrcWidth,SrcHeight} +//! - DstRect must be {0,0,DstWidth,DstHeight} +//! +//! In DirectX 10, ResourceCopyRegion must be used. +//! Conditions: +//! - DstWidth == 2*SrcWidth +//! - DstHeight == SrcHeight +//! - dstX == 0, +//! - dstY == 0, +//! - dstZ == 0, +//! - SrcBox: left=top=front==0; right==SrcWidth; bottom==SrcHeight; back==1; +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] stereoHandle Stereo handle corresponding to the device interface. +//! \param [in] TurnOn != 0 : Turns on \n +//! == 0 : Turns off +//! +//! +//! \retval ::NVAPI_OK Retrieval of frustum adjust mode was successfull. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_ReverseStereoBlitControl(StereoHandle hStereoHandle, NvU8 TurnOn); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_SetNotificationMessage +// +//! DESCRIPTION: This API is a Setup notification message that the stereo driver uses to notify the application +//! when the user changes the stereo driver state. +//! +//! When the user changes the stereo state (Activated or Deactivated, separation or conversion) +//! the stereo driver posts a defined message with the following parameters: +//! +//! lParam is the current conversion. (Actual conversion is *(float*)&lParam ) +//! +//! wParam == MAKEWPARAM(l, h) where +//! - l == 0 if stereo is deactivated +//! - l == 1 if stereo is deactivated +//! - h is the current separation. (Actual separation is float(h*100.f/0xFFFF) +//! +//! Call this API with NULL hWnd to prohibit notification. +//! +//! WHEN TO USE: Use after the stereo handle for device interface is created via successful call to appropriate +//! NvAPI_Stereo_CreateHandleFrom() function. +//! +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! +//! \param [in] stereoHandle Stereo handle corresponding to the device interface. +//! \param [in] hWnd Window HWND that will be notified when the user changes the stereo driver state. +//! Actual HWND must be cast to an NvU64. +//! \param [in] messageID MessageID of the message that will be posted to hWnd +//! +//! \retval ::NVAPI_OK Notification set. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_SetNotificationMessage(StereoHandle hStereoHandle, NvU64 hWnd,NvU64 messageID); + + + + + + + + + + + + + + + +//! \ingroup stereoapi +#define NVAPI_STEREO_QUADBUFFERED_API_VERSION 0x2 + +//! \ingroup stereoapi + typedef enum _NV_StereoSwapChainMode + { + NVAPI_STEREO_SWAPCHAIN_DEFAULT = 0, + NVAPI_STEREO_SWAPCHAIN_STEREO = 1, + NVAPI_STEREO_SWAPCHAIN_MONO = 2, + } NV_STEREO_SWAPCHAIN_MODE; + +#if defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D1x_CreateSwapChain +// +//! DESCRIPTION: This API allows the user to create a mono or a stereo swap chain. +//! +//! NOTE: NvAPI_D3D1x_CreateSwapChain is a wrapper of the method IDXGIFactory::CreateSwapChain which +//! additionally notifies the D3D driver of the mode in which stereo mode the swap chain is to be +//! created. +//! +//! \since Release: 285 +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] hStereoHandle Stereo handle that corresponds to the device interface. +//! A pointer to the device that will write 2D images to the swap chain. +//! \param [in] pDesc A pointer to the swap-chain description (DXGI_SWAP_CHAIN_DESC). This parameter cannot be NULL. +//! \param [out] ppSwapChain A pointer to the swap chain created. +//! \param [in] mode The stereo mode fot the swap chain. +//! NVAPI_STEREO_SWAPCHAIN_DEFAULT +//! NVAPI_STEREO_SWAPCHAIN_STEREO +//! NVAPI_STEREO_SWAPCHAIN_MONO +//! +//! \retval ::NVAPI_OK The swap chain was created successfully. +//! \retval ::NVAPI_ERROR The operation failed. +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D1x_CreateSwapChain(StereoHandle hStereoHandle, + DXGI_SWAP_CHAIN_DESC* pDesc, + IDXGISwapChain** ppSwapChain, + NV_STEREO_SWAPCHAIN_MODE mode); + +#endif //if defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__) + + +#if defined(_D3D9_H_) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D9_CreateSwapChain +// +//! DESCRIPTION: This API allows the user to create a mono or a stereo swap chain. +//! +//! NOTE: NvAPI_D3D9_CreateSwapChain is a wrapper of the method IDirect3DDevice9::CreateAdditionalSwapChain which +//! additionally notifies the D3D driver if the swap chain creation mode must be stereo or mono. +//! +//! +//! \since Release: 285 +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \param [in] hStereoHandle Stereo handle that corresponds to the device interface. +//! \param [in, out] pPresentationParameters A pointer to the swap-chain description (DXGI). This parameter cannot be NULL. +//! \param [out] ppSwapChain A pointer to the swap chain created. +//! \param [in] mode The stereo mode for the swap chain. +//! NVAPI_STEREO_SWAPCHAIN_DEFAULT +//! NVAPI_STEREO_SWAPCHAIN_STEREO +//! NVAPI_STEREO_SWAPCHAIN_MONO +//! +//! \retval ::NVAPI_OK The swap chain creation was successful +//! \retval ::NVAPI_ERROR The operation failed. +//! +//!\ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D9_CreateSwapChain(StereoHandle hStereoHandle, + D3DPRESENT_PARAMETERS *pPresentationParameters, + IDirect3DSwapChain9 **ppSwapChain, + NV_STEREO_SWAPCHAIN_MODE mode); +#endif //if defined(_D3D9_H_) + + + + + +//! \addtogroup drsapi +//! @{ + + +// GPU Profile APIs + +NV_DECLARE_HANDLE(NvDRSSessionHandle); +NV_DECLARE_HANDLE(NvDRSProfileHandle); + +#define NVAPI_DRS_GLOBAL_PROFILE ((NvDRSProfileHandle) -1) + +#define NVAPI_SETTING_MAX_VALUES 100 + +typedef enum _NVDRS_SETTING_TYPE +{ + NVDRS_DWORD_TYPE, + NVDRS_BINARY_TYPE, + NVDRS_STRING_TYPE, + NVDRS_WSTRING_TYPE +} NVDRS_SETTING_TYPE; + +typedef enum _NVDRS_SETTING_LOCATION +{ + NVDRS_CURRENT_PROFILE_LOCATION, + NVDRS_GLOBAL_PROFILE_LOCATION, + NVDRS_BASE_PROFILE_LOCATION, + NVDRS_DEFAULT_PROFILE_LOCATION +} NVDRS_SETTING_LOCATION; + + +typedef struct _NVDRS_GPU_SUPPORT +{ + NvU32 geforce : 1; + NvU32 quadro : 1; + NvU32 nvs : 1; + NvU32 reserved4 : 1; + NvU32 reserved5 : 1; + NvU32 reserved6 : 1; + NvU32 reserved7 : 1; + NvU32 reserved8 : 1; + NvU32 reserved9 : 1; + NvU32 reserved10 : 1; + NvU32 reserved11 : 1; + NvU32 reserved12 : 1; + NvU32 reserved13 : 1; + NvU32 reserved14 : 1; + NvU32 reserved15 : 1; + NvU32 reserved16 : 1; + NvU32 reserved17 : 1; + NvU32 reserved18 : 1; + NvU32 reserved19 : 1; + NvU32 reserved20 : 1; + NvU32 reserved21 : 1; + NvU32 reserved22 : 1; + NvU32 reserved23 : 1; + NvU32 reserved24 : 1; + NvU32 reserved25 : 1; + NvU32 reserved26 : 1; + NvU32 reserved27 : 1; + NvU32 reserved28 : 1; + NvU32 reserved29 : 1; + NvU32 reserved30 : 1; + NvU32 reserved31 : 1; + NvU32 reserved32 : 1; +} NVDRS_GPU_SUPPORT; + +//! Enum to decide on the datatype of setting value. +typedef struct _NVDRS_BINARY_SETTING +{ + NvU32 valueLength; //!< valueLength should always be in number of bytes. + NvU8 valueData[NVAPI_BINARY_DATA_MAX]; +} NVDRS_BINARY_SETTING; + +typedef struct _NVDRS_SETTING_VALUES +{ + NvU32 version; //!< Structure Version + NvU32 numSettingValues; //!< Total number of values available in a setting. + NVDRS_SETTING_TYPE settingType; //!< Type of setting value. + union //!< Setting can hold either DWORD or Binary value or string. Not mixed types. + { + NvU32 u32DefaultValue; //!< Accessing default DWORD value of this setting. + NVDRS_BINARY_SETTING binaryDefaultValue; //!< Accessing default Binary value of this setting. + //!< Must be allocated by caller with valueLength specifying buffer size, or only valueLength will be filled in. + NvAPI_UnicodeString wszDefaultValue; //!< Accessing default unicode string value of this setting. + }; + union //!< Setting values can be of either DWORD, Binary values or String type, + { //!< NOT mixed types. + NvU32 u32Value; //!< All possible DWORD values for a setting + NVDRS_BINARY_SETTING binaryValue; //!< All possible Binary values for a setting + NvAPI_UnicodeString wszValue; //!< Accessing current unicode string value of this setting. + }settingValues[NVAPI_SETTING_MAX_VALUES]; +} NVDRS_SETTING_VALUES; + +//! Macro for constructing the version field of ::_NVDRS_SETTING_VALUES +#define NVDRS_SETTING_VALUES_VER MAKE_NVAPI_VERSION(NVDRS_SETTING_VALUES,1) + +typedef struct _NVDRS_SETTING_V1 +{ + NvU32 version; //!< Structure Version + NvAPI_UnicodeString settingName; //!< String name of setting + NvU32 settingId; //!< 32 bit setting Id + NVDRS_SETTING_TYPE settingType; //!< Type of setting value. + NVDRS_SETTING_LOCATION settingLocation; //!< Describes where the value in CurrentValue comes from. + NvU32 isCurrentPredefined; //!< It is different than 0 if the currentValue is a predefined Value, + //!< 0 if the currentValue is a user value. + NvU32 isPredefinedValid; //!< It is different than 0 if the PredefinedValue union contains a valid value. + union //!< Setting can hold either DWORD or Binary value or string. Not mixed types. + { + NvU32 u32PredefinedValue; //!< Accessing default DWORD value of this setting. + NVDRS_BINARY_SETTING binaryPredefinedValue; //!< Accessing default Binary value of this setting. + //!< Must be allocated by caller with valueLength specifying buffer size, + //!< or only valueLength will be filled in. + NvAPI_UnicodeString wszPredefinedValue; //!< Accessing default unicode string value of this setting. + }; + union //!< Setting can hold either DWORD or Binary value or string. Not mixed types. + { + NvU32 u32CurrentValue; //!< Accessing current DWORD value of this setting. + NVDRS_BINARY_SETTING binaryCurrentValue; //!< Accessing current Binary value of this setting. + //!< Must be allocated by caller with valueLength specifying buffer size, + //!< or only valueLength will be filled in. + NvAPI_UnicodeString wszCurrentValue; //!< Accessing current unicode string value of this setting. + }; +} NVDRS_SETTING_V1; + +//! Macro for constructing the version field of ::_NVDRS_SETTING +#define NVDRS_SETTING_VER1 MAKE_NVAPI_VERSION(NVDRS_SETTING_V1, 1) + +typedef NVDRS_SETTING_V1 NVDRS_SETTING; +#define NVDRS_SETTING_VER NVDRS_SETTING_VER1 + +typedef struct _NVDRS_APPLICATION_V1 +{ + NvU32 version; //!< Structure Version + NvU32 isPredefined; //!< Is the application userdefined/predefined + NvAPI_UnicodeString appName; //!< String name of the Application + NvAPI_UnicodeString userFriendlyName; //!< UserFriendly name of the Application + NvAPI_UnicodeString launcher; //!< Indicates the name (if any) of the launcher that starts the application +} NVDRS_APPLICATION_V1; + +typedef struct _NVDRS_APPLICATION_V2 +{ + NvU32 version; //!< Structure Version + NvU32 isPredefined; //!< Is the application userdefined/predefined + NvAPI_UnicodeString appName; //!< String name of the Application + NvAPI_UnicodeString userFriendlyName; //!< UserFriendly name of the Application + NvAPI_UnicodeString launcher; //!< Indicates the name (if any) of the launcher that starts the Application + NvAPI_UnicodeString fileInFolder; //!< Select this application only if this file is found. + //!< When specifying multiple files, separate them using the ':' character. +} NVDRS_APPLICATION_V2; + +typedef struct _NVDRS_APPLICATION_V3 +{ + NvU32 version; //!< Structure Version + NvU32 isPredefined; //!< Is the application userdefined/predefined + NvAPI_UnicodeString appName; //!< String name of the Application + NvAPI_UnicodeString userFriendlyName; //!< UserFriendly name of the Application + NvAPI_UnicodeString launcher; //!< Indicates the name (if any) of the launcher that starts the Application + NvAPI_UnicodeString fileInFolder; //!< Select this application only if this file is found. + //!< When specifying multiple files, separate them using the ':' character. + NvU32 isMetro:1; //!< Windows 8 style app + NvU32 isCommandLine:1; //!< Command line parsing for the application name + NvU32 reserved:30; //!< Reserved. Should be 0. +} NVDRS_APPLICATION_V3; + +#define NVDRS_APPLICATION_VER_V1 MAKE_NVAPI_VERSION(NVDRS_APPLICATION_V1,1) +#define NVDRS_APPLICATION_VER_V2 MAKE_NVAPI_VERSION(NVDRS_APPLICATION_V2,2) +#define NVDRS_APPLICATION_VER_V3 MAKE_NVAPI_VERSION(NVDRS_APPLICATION_V3,3) + +typedef NVDRS_APPLICATION_V3 NVDRS_APPLICATION; +#define NVDRS_APPLICATION_VER NVDRS_APPLICATION_VER_V3 + +typedef struct _NVDRS_PROFILE_V1 +{ + NvU32 version; //!< Structure Version + NvAPI_UnicodeString profileName; //!< String name of the Profile + NVDRS_GPU_SUPPORT gpuSupport; //!< This read-only flag indicates the profile support on either + //!< Quadro, or Geforce, or both. + NvU32 isPredefined; //!< Is the Profile user-defined, or predefined + NvU32 numOfApps; //!< Total number of applications that belong to this profile. Read-only + NvU32 numOfSettings; //!< Total number of settings applied for this Profile. Read-only +} NVDRS_PROFILE_V1; + +typedef NVDRS_PROFILE_V1 NVDRS_PROFILE; + +//! Macro for constructing the version field of ::NVDRS_PROFILE +#define NVDRS_PROFILE_VER1 MAKE_NVAPI_VERSION(NVDRS_PROFILE_V1,1) +#define NVDRS_PROFILE_VER NVDRS_PROFILE_VER1 + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_CreateSession +// +//! DESCRIPTION: This API allocates memory and initializes the session. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [out] *phSession Return pointer to the session handle. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR: For miscellaneous errors. +// +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_CreateSession(NvDRSSessionHandle *phSession); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_DestroySession +// +//! DESCRIPTION: This API frees the allocation: cleanup of NvDrsSession. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +// +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_DestroySession(NvDRSSessionHandle hSession); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_LoadSettings +// +//! DESCRIPTION: This API loads and parses the settings data. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +// +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_LoadSettings(NvDRSSessionHandle hSession); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_SaveSettings +// +//! DESCRIPTION: This API saves the settings data to the system. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +// +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_SaveSettings(NvDRSSessionHandle hSession); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_LoadSettingsFromFile +// +//! DESCRIPTION: This API loads settings from the given file path. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle +//! \param [in] fileName Binary File Name/Path +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +// +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_LoadSettingsFromFile(NvDRSSessionHandle hSession, NvAPI_UnicodeString fileName); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_SaveSettingsToFile +// +//! DESCRIPTION: This API saves settings to the given file path. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] fileName Binary File Name/Path +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +// +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_SaveSettingsToFile(NvDRSSessionHandle hSession, NvAPI_UnicodeString fileName); + +//! @} + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_CreateProfile +// +//! DESCRIPTION: This API creates an empty profile. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] *pProfileInfo Input pointer to NVDRS_PROFILE. +//! \param [in] *phProfile Returns pointer to profile handle. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_CreateProfile(NvDRSSessionHandle hSession, NVDRS_PROFILE *pProfileInfo, NvDRSProfileHandle *phProfile); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_DeleteProfile +// +//! DESCRIPTION: This API deletes a profile or sets it back to a predefined value. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_DeleteProfile(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_SetCurrentGlobalProfile +// +//! DESCRIPTION: This API sets the current global profile in the driver. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] wszGlobalProfileName Input current Global profile name. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_SetCurrentGlobalProfile(NvDRSSessionHandle hSession, NvAPI_UnicodeString wszGlobalProfileName); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_GetCurrentGlobalProfile +// +//! DESCRIPTION: This API returns the handle to the current global profile. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [out] *phProfile Returns current Global profile handle. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_GetCurrentGlobalProfile(NvDRSSessionHandle hSession, NvDRSProfileHandle *phProfile); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_GetProfileInfo +// +//! DESCRIPTION: This API gets information about the given profile. User needs to specify the name of the Profile. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [out] *pProfileInfo Return the profile info. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_GetProfileInfo(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NVDRS_PROFILE *pProfileInfo); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_SetProfileInfo +// +//! DESCRIPTION: Specifies flags for a given profile. Currently only the NVDRS_GPU_SUPPORT is +//! used to update the profile. Neither the name, number of settings or applications +//! or other profile information can be changed with this function. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] *pProfileInfo Input the new profile info. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_SetProfileInfo(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NVDRS_PROFILE *pProfileInfo); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_FindProfileByName +// +//! DESCRIPTION: This API finds a profile in the current session. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] profileName Input profileName. +//! \param [out] phProfile Input profile handle. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_PROFILE_NOT_FOUND if profile is not found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_FindProfileByName(NvDRSSessionHandle hSession, NvAPI_UnicodeString profileName, NvDRSProfileHandle* phProfile); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_EnumProfiles +// +//! DESCRIPTION: This API enumerates through all the profiles in the session. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] index Input the index for enumeration. +//! \param [out] *phProfile Returns profile handle. +//! +//! RETURN STATUS: NVAPI_OK: SUCCESS if the profile is found +//! NVAPI_ERROR: For miscellaneous errors. +//! NVAPI_END_ENUMERATION: index exceeds the total number of available Profiles in DB. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_EnumProfiles(NvDRSSessionHandle hSession, NvU32 index, NvDRSProfileHandle *phProfile); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_GetNumProfiles +// +//! DESCRIPTION: This API obtains the number of profiles in the current session object. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param out] *numProfiles Returns count of profiles in the current hSession. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_API_NOT_INTIALIZED Failed to initialize. +//! \retval ::NVAPI_INVALID_ARGUMENT Invalid Arguments. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_GetNumProfiles(NvDRSSessionHandle hSession, NvU32 *numProfiles); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_CreateApplication +// +//! DESCRIPTION: This API adds an executable name to a profile. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] *pApplication Input NVDRS_APPLICATION struct with the executable name to be added. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_CreateApplication(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NVDRS_APPLICATION *pApplication); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_DeleteApplicationEx +// +//! DESCRIPTION: This API removes an executable from a profile. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession - Input to the session handle. +//! \param [in] hProfile - Input profile handle. +//! \param [in] *pApp - Input all the information about the application to be removed. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! \retval ::NVAPI_EXECUTABLE_PATH_IS_AMBIGUOUS If the path provided could refer to two different executables, +//! this error will be returned. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_DeleteApplicationEx(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NVDRS_APPLICATION *pApp); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_DeleteApplication +// +//! DESCRIPTION: This API removes an executable name from a profile. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSessionPARAMETERS Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] appName Input the executable name to be removed. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! \retval ::NVAPI_EXECUTABLE_PATH_IS_AMBIGUOUS If the path provided could refer to two different executables, +//! this error will be returned +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_DeleteApplication(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvAPI_UnicodeString appName); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_GetApplicationInfo +// +//! DESCRIPTION: This API gets information about the given application. The input application name +//! must match exactly what the Profile has stored for the application. +//! This function is better used to retrieve application information from a previous +//! enumeration. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] appName Input application name. +//! \param [out] *pApplication Returns NVDRS_APPLICATION struct with all the attributes. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, +//! they are listed below. +//! \retval ::NVAPI_EXECUTABLE_PATH_IS_AMBIGUOUS The application name could not +// single out only one executable. +//! \retval ::NVAPI_EXECUTABLE_NOT_FOUND No application with that name is found on the profile. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_GetApplicationInfo(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvAPI_UnicodeString appName, NVDRS_APPLICATION *pApplication); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_EnumApplications +// +//! DESCRIPTION: This API enumerates all the applications in a given profile from the starting index to the maximum length. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] startIndex Indicates starting index for enumeration. +//! \param [in,out] *appCount Input maximum length of the passed in arrays. Returns the actual length. +//! \param [out] *pApplication Returns NVDRS_APPLICATION struct with all the attributes. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! \retval ::NVAPI_END_ENUMERATION startIndex exceeds the total appCount. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_EnumApplications(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvU32 startIndex, NvU32 *appCount, NVDRS_APPLICATION *pApplication); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_FindApplicationByName +// +//! DESCRIPTION: This API searches the application and the associated profile for the given application name. +//! If a fully qualified path is provided, this function will always return the profile +//! the driver will apply upon running the application (on the path provided). +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the hSession handle +//! \param [in] appName Input appName. For best results, provide a fully qualified path of the type +//! c:/Folder1/Folder2/App.exe +//! \param [out] *phProfile Returns profile handle. +//! \param [in,out] *pApplication Returns NVDRS_APPLICATION struct pointer. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, +//! they are listed below: +//! \retval ::NVAPI_APPLICATION_NOT_FOUND If App not found +//! \retval ::NVAPI_EXECUTABLE_PATH_IS_AMBIGUOUS If the input appName was not fully qualified, this error might return in the case of multiple matches +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_FindApplicationByName(__in NvDRSSessionHandle hSession, __in NvAPI_UnicodeString appName, __out NvDRSProfileHandle *phProfile, __inout NVDRS_APPLICATION *pApplication); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_SetSetting +// +//! DESCRIPTION: This API adds/modifies a setting to a profile. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] *pSetting Input NVDRS_SETTING struct pointer. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_SetSetting(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NVDRS_SETTING *pSetting); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_GetSetting +// +//! DESCRIPTION: This API gets information about the given setting. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] settingId Input settingId. +//! \param [out] *pSetting Returns all the setting info +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_GetSetting(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvU32 settingId, NVDRS_SETTING *pSetting); + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_EnumSettings +// +//! DESCRIPTION: This API enumerates all the settings of a given profile from startIndex to the maximum length. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] startIndex Indicates starting index for enumeration. +//! \param [in,out] *settingsCount Input max length of the passed in arrays, Returns the actual length. +//! \param [out] *pSetting Returns all the settings info. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! \retval ::NVAPI_END_ENUMERATION startIndex exceeds the total appCount. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_EnumSettings(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvU32 startIndex, NvU32 *settingsCount, NVDRS_SETTING *pSetting); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_EnumAvailableSettingIds +// +//! DESCRIPTION: This API enumerates all the Ids of all the settings recognized by NVAPI. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [out] pSettingIds User-provided array of length *pMaxCount that NVAPI will fill with IDs. +//! \param [in,out] pMaxCount Input max length of the passed in array, Returns the actual length. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! NVAPI_END_ENUMERATION: the provided pMaxCount is not enough to hold all settingIds. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_EnumAvailableSettingIds(NvU32 *pSettingIds, NvU32 *pMaxCount); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_EnumAvailableSettingValues +// +//! DESCRIPTION: This API enumerates all available setting values for a given setting. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] settingId Input settingId. +//! \param [in,out] maxNumCount Input max length of the passed in arrays, Returns the actual length. +//! \param [out] *pSettingValues Returns all available setting values and its count. +//! +//! \retval ::NVAPI_OK SUCCESS +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_EnumAvailableSettingValues(NvU32 settingId, NvU32 *pMaxNumValues, NVDRS_SETTING_VALUES *pSettingValues); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_GetSettingIdFromName +// +//! DESCRIPTION: This API gets the binary ID of a setting given the setting name. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] settingName Input Unicode settingName. +//! \param [out] *pSettingId Returns corresponding settingId. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_PROFILE_NOT_FOUND if profile is not found +//! \retval ::NVAPI_SETTING_NOT_FOUND if setting is not found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_GetSettingIdFromName(NvAPI_UnicodeString settingName, NvU32 *pSettingId); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_GetSettingNameFromId +// +//! DESCRIPTION: This API gets the setting name given the binary ID. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] settingId Input settingId. +//! \param [in] *pSettingName Returns corresponding Unicode settingName. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_PROFILE_NOT_FOUND if profile is not found +//! \retval ::NVAPI_SETTING_NOT_FOUND if setting is not found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_GetSettingNameFromId(NvU32 settingId, NvAPI_UnicodeString *pSettingName); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_DeleteProfileSetting +// +//! DESCRIPTION: This API deletes a setting or sets it back to predefined value. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] settingId Input settingId to be deleted. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_DeleteProfileSetting(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvU32 settingId); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_RestoreAllDefaults +// +//! DESCRIPTION: This API restores the whole system to predefined(default) values. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_RestoreAllDefaults(NvDRSSessionHandle hSession); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_RestoreProfileDefault +// +//! DESCRIPTION: This API restores the given profile to predefined(default) values. +//! Any and all user specified modifications will be removed. +//! If the whole profile was set by the user, the profile will be removed. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! \retval ::NVAPI_PROFILE_REMOVED SUCCESS, and the hProfile is no longer valid. +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_RestoreProfileDefault(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_RestoreProfileDefaultSetting +// +//! DESCRIPTION: This API restores the given profile setting to predefined(default) values. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] hProfile Input profile handle. +//! \param [in] settingId Input settingId. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_RestoreProfileDefaultSetting(NvDRSSessionHandle hSession, NvDRSProfileHandle hProfile, NvU32 settingId); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DRS_GetBaseProfile +// +//! DESCRIPTION: Returns the handle to the current global profile. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hSession Input to the session handle. +//! \param [in] *phProfile Returns Base profile handle. +//! +//! \retval ::NVAPI_OK SUCCESS if the profile is found +//! \retval ::NVAPI_ERROR For miscellaneous errors. +//! +//! \ingroup drsapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DRS_GetBaseProfile(NvDRSSessionHandle hSession, NvDRSProfileHandle *phProfile); + + + + +//! \addtogroup sysgeneral +//! @{ + +typedef struct +{ + NvU32 version; //!< structure version + NvU32 vendorId; //!< Chipset vendor identification + NvU32 deviceId; //!< Chipset device identification + NvAPI_ShortString szVendorName; //!< Chipset vendor Name + NvAPI_ShortString szChipsetName; //!< Chipset device Name + NvU32 flags; //!< Chipset info flags - obsolete + NvU32 subSysVendorId; //!< Chipset subsystem vendor identification + NvU32 subSysDeviceId; //!< Chipset subsystem device identification + NvAPI_ShortString szSubSysVendorName; //!< subsystem vendor Name + NvU32 HBvendorId; //!< Host bridge vendor identification + NvU32 HBdeviceId; //!< Host bridge device identification + NvU32 HBsubSysVendorId; //!< Host bridge subsystem vendor identification + NvU32 HBsubSysDeviceId; //!< Host bridge subsystem device identification + +} NV_CHIPSET_INFO_v4; + +typedef struct +{ + NvU32 version; //!< structure version + NvU32 vendorId; //!< vendor ID + NvU32 deviceId; //!< device ID + NvAPI_ShortString szVendorName; //!< vendor Name + NvAPI_ShortString szChipsetName; //!< device Name + NvU32 flags; //!< Chipset info flags - obsolete + NvU32 subSysVendorId; //!< subsystem vendor ID + NvU32 subSysDeviceId; //!< subsystem device ID + NvAPI_ShortString szSubSysVendorName; //!< subsystem vendor Name +} NV_CHIPSET_INFO_v3; + +typedef enum +{ + NV_CHIPSET_INFO_HYBRID = 0x00000001, +} NV_CHIPSET_INFO_FLAGS; + +typedef struct +{ + NvU32 version; //!< structure version + NvU32 vendorId; //!< vendor ID + NvU32 deviceId; //!< device ID + NvAPI_ShortString szVendorName; //!< vendor Name + NvAPI_ShortString szChipsetName; //!< device Name + NvU32 flags; //!< Chipset info flags +} NV_CHIPSET_INFO_v2; + +typedef struct +{ + NvU32 version; //structure version + NvU32 vendorId; //vendor ID + NvU32 deviceId; //device ID + NvAPI_ShortString szVendorName; //vendor Name + NvAPI_ShortString szChipsetName; //device Name +} NV_CHIPSET_INFO_v1; + +#define NV_CHIPSET_INFO_VER_1 MAKE_NVAPI_VERSION(NV_CHIPSET_INFO_v1,1) +#define NV_CHIPSET_INFO_VER_2 MAKE_NVAPI_VERSION(NV_CHIPSET_INFO_v2,2) +#define NV_CHIPSET_INFO_VER_3 MAKE_NVAPI_VERSION(NV_CHIPSET_INFO_v3,3) +#define NV_CHIPSET_INFO_VER_4 MAKE_NVAPI_VERSION(NV_CHIPSET_INFO_v4,4) + +#define NV_CHIPSET_INFO NV_CHIPSET_INFO_v4 +#define NV_CHIPSET_INFO_VER NV_CHIPSET_INFO_VER_4 + +//! @} + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_SYS_GetChipSetInfo +// +//! This function returns information about the system's chipset. +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \since Release: 95 +//! +//! \retval NVAPI_INVALID_ARGUMENT pChipSetInfo is NULL. +//! \retval NVAPI_OK *pChipSetInfo is now set. +//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION NV_CHIPSET_INFO version not compatible with driver. +//! \ingroup sysgeneral +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_SYS_GetChipSetInfo(NV_CHIPSET_INFO *pChipSetInfo); + + +//! \ingroup sysgeneral +//! Lid and dock information - used in NvAPI_GetLidDockInfo() +typedef struct +{ + NvU32 version; //! Structure version, constructed from the macro #NV_LID_DOCK_PARAMS_VER + NvU32 currentLidState; + NvU32 currentDockState; + NvU32 currentLidPolicy; + NvU32 currentDockPolicy; + NvU32 forcedLidMechanismPresent; + NvU32 forcedDockMechanismPresent; +}NV_LID_DOCK_PARAMS; + + +//! ingroup sysgeneral +#define NV_LID_DOCK_PARAMS_VER MAKE_NVAPI_VERSION(NV_LID_DOCK_PARAMS,1) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GetLidDockInfo +// +//! DESCRIPTION: This function returns the current lid and dock information. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 177 +//! +//! \retval ::NVAPI_OK +//! \retval ::NVAPI_ERROR +//! \retval ::NVAPI_NOT_SUPPORTED +//! \retval ::NVAPI_HANDLE_INVALIDATED +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! +//! \ingroup sysgeneral +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_SYS_GetLidAndDockInfo(NV_LID_DOCK_PARAMS *pLidAndDock); + + + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_SYS_GetDisplayIdFromGpuAndOutputId +// +//! DESCRIPTION: This API converts a Physical GPU handle and output ID to a +//! display ID. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] hPhysicalGpu Handle to the physical GPU +//! \param [in] outputId Connected display output ID on the +//! target GPU - must only have one bit set +//! \param [out] displayId Pointer to an NvU32 which contains +//! the display ID +//! +//! \retval ::NVAPI_OK - completed request +//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized +//! \retval ::NVAPI_ERROR - miscellaneous error occurred +//! \retval ::NVAPI_INVALID_ARGUMENT - Invalid input parameter. +//! +//! \ingroup sysgeneral +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_SYS_GetDisplayIdFromGpuAndOutputId(NvPhysicalGpuHandle hPhysicalGpu, NvU32 outputId, NvU32* displayId); + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_SYS_GetGpuAndOutputIdFromDisplayId +// +//! DESCRIPTION: This API converts a display ID to a Physical GPU handle and output ID. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [in] displayId Display ID of display to retrieve +//! GPU and outputId for +//! \param [out] hPhysicalGpu Handle to the physical GPU +//! \param [out] outputId ) Connected display output ID on the +//! target GPU will only have one bit set. +//! +//! \retval ::NVAPI_OK +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_ID_OUT_OF_RANGE The DisplayId corresponds to a +//! display which is not within the +//! normal outputId range. +//! \retval ::NVAPI_ERROR +//! \retval ::NVAPI_INVALID_ARGUMENT +//! +//! \ingroup sysgeneral +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_SYS_GetGpuAndOutputIdFromDisplayId(NvU32 displayId, NvPhysicalGpuHandle *hPhysicalGpu, NvU32 *outputId); + + +/////////////////////////////////////////////////////////////////////////////// +// FUNCTION NAME: NvAPI_SYS_GetPhysicalGpuFromDisplayId +// +//! \code +//! DESCRIPTION: This API retrieves the Physical GPU handle of the connected display +//! +//! \since Release: 313 +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! PARAMETERS: displayId(IN) - Display ID of display to retrieve +//! GPU handle +//! hPhysicalGpu(OUT) - Handle to the physical GPU +//! +//! RETURN STATUS: +//! NVAPI_OK - completed request +//! NVAPI_API_NOT_INTIALIZED - NVAPI not initialized +//! NVAPI_ERROR - miscellaneous error occurred +//! NVAPI_INVALID_ARGUMENT - Invalid input parameter. +//! \endcode +//! \ingroup sysgeneral +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_SYS_GetPhysicalGpuFromDisplayId(NvU32 displayId, NvPhysicalGpuHandle *hPhysicalGpu); + + + + +#ifdef __cplusplus +}; //extern "C" { + +#endif + +#pragma pack(pop) + +#endif // _NVAPI_H + +#include"nvapi_lite_salend.h" diff --git a/compat/nvapi/nvapi_ccminer.h b/compat/nvapi/nvapi_ccminer.h new file mode 100644 index 0000000..31f4773 --- /dev/null +++ b/compat/nvapi/nvapi_ccminer.h @@ -0,0 +1,370 @@ +#pragma once + +#define NVAPI_INTERNAL +#include "nvapi.h" + +NvAPI_Status nvapi_dll_init(); + +typedef struct { + NvU32 version; + NvU32 flags; + struct + { + NvU32 pstate; // Assumption + NvU32 unknown1[2]; + NvU32 min_power; + NvU32 unknown2[2]; + NvU32 def_power; + NvU32 unknown3[2]; + NvU32 max_power; + NvU32 unknown4; // 0 + } entries[4]; +} NVAPI_GPU_POWER_INFO; +#define NVAPI_GPU_POWER_INFO_VER MAKE_NVAPI_VERSION(NVAPI_GPU_POWER_INFO, 1) + +typedef struct { + NvU32 version; + NvU32 flags; + struct { + NvU32 unknown1; + NvU32 unknown2; + NvU32 power; // percent * 1000 + NvU32 unknown4; + } entries[4]; +} NVAPI_GPU_POWER_STATUS; +#define NVAPI_GPU_POWER_STATUS_VER MAKE_NVAPI_VERSION(NVAPI_GPU_POWER_STATUS, 1) + +typedef struct { + NvU32 version; + NvU32 count; + struct { + NvU32 unknown1; + NvU32 unknown2; + NvU32 power; // unsure ?? 85536 to 95055 on 1080, 104825+ on 970 + NvU32 unknown4; + } entries[4]; +} NVAPI_GPU_POWER_TOPO; +#define NVAPI_GPU_POWER_TOPO_VER MAKE_NVAPI_VERSION(NVAPI_GPU_POWER_TOPO, 1) + +typedef struct { + NvU32 version; + NvU32 flags; + struct { + NvU32 controller; + NvU32 unknown; + NvS32 min_temp; + NvS32 def_temp; + NvS32 max_temp; + NvU32 defaultFlags; + } entries[4]; +} NVAPI_GPU_THERMAL_INFO; +#define NVAPI_GPU_THERMAL_INFO_VER MAKE_NVAPI_VERSION(NVAPI_GPU_THERMAL_INFO, 2) + +typedef struct { + NvU32 version; + NvU32 flags; + struct { + NvU32 controller; + NvU32 value; + NvU32 flags; + } entries[4]; +} NVAPI_GPU_THERMAL_LIMIT; +#define NVAPI_GPU_THERMAL_LIMIT_VER MAKE_NVAPI_VERSION(NVAPI_GPU_THERMAL_LIMIT, 2) + +// Maxwell gpu core voltage reading +typedef struct { + NvU32 version; + NvU32 flags; + NvU32 count; // unsure + NvU32 unknown; + NvU32 value_uV; + NvU32 buf1[30]; +} NVAPI_VOLT_STATUS; // 140 bytes (1-008c) +#define NVAPI_VOLT_STATUS_VER MAKE_NVAPI_VERSION(NVAPI_VOLT_STATUS, 1) + +// Pascal gpu core voltage reading +typedef struct { + NvU32 version; + NvU32 flags; + NvU32 nul[8]; + NvU32 value_uV; + NvU32 buf1[8]; +} NVAPI_VOLTAGE_STATUS; // 76 bytes (1-004c) +#define NVAPI_VOLTAGE_STATUS_VER MAKE_NVAPI_VERSION(NVAPI_VOLTAGE_STATUS, 1) + +typedef struct { + NvU32 version; + NvU32 numClocks; // unsure + NvU32 nul[8]; + struct { + NvU32 a; + NvU32 clockType; + NvU32 c; + NvU32 d; + NvU32 e; + NvU32 f; + NvU32 g; + NvU32 h; + NvU32 i; + NvU32 j; + NvS32 rangeMax; + NvS32 rangeMin; + NvS32 tempMax; // ? unsure + NvU32 n; + NvU32 o; + NvU32 p; + NvU32 q; + NvU32 r; + } entries[32]; // NVAPI_MAX_GPU_CLOCKS ? +} NVAPI_CLOCKS_RANGE; // 2344 bytes +#define NVAPI_CLOCKS_RANGE_VER MAKE_NVAPI_VERSION(NVAPI_CLOCKS_RANGE, 1) + +// seems to return a clock table mask +typedef struct { + NvU32 version; + NvU32 mask[4]; // 80 bits mask + NvU32 buf0[8]; + struct { + NvU32 a; + NvU32 b; + NvU32 c; + NvU32 d; + NvU32 memDelta; // 1 for mem + NvU32 gpuDelta; // 1 for gpu + } clocks[80 + 23]; + NvU32 buf1[916]; +} NVAPI_CLOCK_MASKS; // 6188 bytes +#define NVAPI_CLOCK_MASKS_VER MAKE_NVAPI_VERSION(NVAPI_CLOCK_MASKS, 1) + +// contains the gpu/mem clocks deltas +typedef struct { + NvU32 version; + NvU32 mask[4]; // 80 bits mask (could be 8x 32bits) + NvU32 buf0[12]; + struct { + NvU32 a; + NvU32 b; + NvU32 c; + NvU32 d; + NvU32 e; + NvS32 freqDelta; // 84000 = +84MHz + NvU32 g; + NvU32 h; + NvU32 i; + } gpuDeltas[80]; + NvU32 memFilled[23]; // maybe only 4 max + NvS32 memDeltas[23]; + NvU32 buf1[1529]; +} NVAPI_CLOCK_TABLE; // 9248 bytes +#define NVAPI_CLOCK_TABLE_VER MAKE_NVAPI_VERSION(NVAPI_CLOCK_TABLE, 1) + +typedef struct { + NvU32 version; + NvU32 mask[4]; // 80 bits mask + NvU32 buf0[12]; + struct { + NvU32 a; // 0 + NvU32 freq_kHz; + NvU32 volt_uV; + NvU32 d; + NvU32 e; + NvU32 f; + NvU32 g; + } gpuEntries[80]; + struct { + NvU32 a; // 1 for idle values ? + NvU32 freq_kHz; + NvU32 volt_uV; + NvU32 d; + NvU32 e; + NvU32 f; + NvU32 g; + } memEntries[23]; + NvU32 buf1[1064]; +} NVAPI_VFP_CURVE; // 7208 bytes (1-1c28) +#define NVAPI_VFP_CURVE_VER MAKE_NVAPI_VERSION(NVAPI_VFP_CURVE, 1) + +typedef struct { + NvU32 version; + NvS32 percent; + NvU32 pad[8]; +} NVAPI_VOLTBOOST_PERCENT; // 40 bytes (1-0028) +#define NVAPI_VOLTBOOST_PERCENT_VER MAKE_NVAPI_VERSION(NVAPI_VOLTBOOST_PERCENT, 1) + +typedef struct { + NvU32 version; + NvU32 flags; + NvU32 filled; // 1 + struct { + NvU32 volt_uV; + NvU32 unknown; + } entries[128]; + // some empty tables then... + NvU32 buf1[3888]; +} NVAPI_VOLTAGES_TABLE; // 16588 bytes (1-40cc) +#define NVAPI_VOLTAGES_TABLE_VER MAKE_NVAPI_VERSION(NVAPI_VOLTAGES_TABLE, 1) + +typedef struct { + NvU32 version; + NvU32 val1; // 7 + NvU32 val2; // 0x3F (63.) + NvU32 pad[16]; +} NVAPI_GPU_PERF_INFO; // 76 bytes (1-004c) +#define NVAPI_GPU_PERF_INFO_VER MAKE_NVAPI_VERSION(NVAPI_GPU_PERF_INFO, 1) + +typedef struct { + NvU32 version; + NvU32 flags; // 0 + NvU64 timeRef; // increment with time + NvU64 val1; // seen 1 4 5 while mining, 16 else + NvU64 val2; // seen 7 and 3 + NvU64 values[3]; // increment with time + NvU32 pad[326]; // empty +} NVAPI_GPU_PERF_STATUS; // 1360 bytes (1-0550) +#define NVAPI_GPU_PERF_STATUS_VER MAKE_NVAPI_VERSION(NVAPI_GPU_PERF_STATUS, 1) + +typedef struct { + NvU32 version; + NvU32 val1; // 4 + NvU32 val2; // 2 or 0 + NvU32 val3; // 2 + NvU32 val4; // 3 + NV_GPU_PERF_PSTATE_ID pStateId; + NvU32 val6; // 0 or 2 + NvU32 val7; // 4 + NvU32 val8; // 0 + NvU32 memFreq1; // 405000. + NvU32 memFreq2; // 405000. + NvU32 memFreqMin;// 101250. + NvU32 memFreqMax;// 486000. + NvU32 zeros[3]; + NvU32 gpuFreq1; // 696000. Unsure about those + NvU32 gpuFreq2; // 696000. + NvU32 gpuFreqMin;// 174000. + NvU32 gpuFreqMax;// 658000. + NvU32 pad[2697]; +} NVAPI_GPU_PERF_CLOCKS; // 10868 bytes (2-2a74) +#define NVAPI_GPU_PERF_CLOCKS_VER MAKE_NVAPI_VERSION(NVAPI_GPU_PERF_CLOCKS, 2) + +typedef struct { + NvU32 version; + NvU32 level; + NvU32 count; + NvU32 pad[339]; // (4-0558) +} NVAPI_COOLER_SETTINGS; +#define NVAPI_COOLER_SETTINGS_VER MAKE_NVAPI_VERSION(NVAPI_COOLER_SETTINGS, 4) + +typedef struct { + NvU32 version; + NvU32 level; // 0 = auto ? + NvU32 count; // 1 + NvU32 pad[38]; // (1-00a4) +} NVAPI_COOLER_LEVEL; +#define NVAPI_COOLER_LEVEL_VER MAKE_NVAPI_VERSION(NVAPI_COOLER_LEVEL, 1) + +NvAPI_Status NvAPI_DLL_GetInterfaceVersionString(NvAPI_ShortString string); + +NvAPI_Status NvAPI_DLL_PerfPoliciesGetInfo(NvPhysicalGpuHandle, NVAPI_GPU_PERF_INFO*); // 409D9841 1-004c +NvAPI_Status NvAPI_DLL_PerfPoliciesGetStatus(NvPhysicalGpuHandle, NVAPI_GPU_PERF_STATUS*); // 3D358A0C 1-0550 + +NvAPI_Status NvAPI_DLL_ClientPowerPoliciesGetInfo(NvPhysicalGpuHandle, NVAPI_GPU_POWER_INFO*); +NvAPI_Status NvAPI_DLL_ClientPowerPoliciesGetStatus(NvPhysicalGpuHandle, NVAPI_GPU_POWER_STATUS*); +NvAPI_Status NvAPI_DLL_ClientPowerPoliciesSetStatus(NvPhysicalGpuHandle, NVAPI_GPU_POWER_STATUS*); +NvAPI_Status NvAPI_DLL_ClientPowerTopologyGetStatus(NvPhysicalGpuHandle, NVAPI_GPU_POWER_TOPO*); // EDCF624E 1-0048 + +NvAPI_Status NvAPI_DLL_ClientThermalPoliciesGetInfo(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_INFO*); +NvAPI_Status NvAPI_DLL_ClientThermalPoliciesGetLimit(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_LIMIT*); +NvAPI_Status NvAPI_DLL_ClientThermalPoliciesSetLimit(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_LIMIT*); + +// Pascal GTX only +NvAPI_Status NvAPI_DLL_GetClockBoostRanges(NvPhysicalGpuHandle, NVAPI_CLOCKS_RANGE*); +NvAPI_Status NvAPI_DLL_GetClockBoostMask(NvPhysicalGpuHandle, NVAPI_CLOCK_MASKS*); // 0x507B4B59 +NvAPI_Status NvAPI_DLL_GetClockBoostTable(NvPhysicalGpuHandle, NVAPI_CLOCK_TABLE*); // 0x23F1B133 +NvAPI_Status NvAPI_DLL_SetClockBoostTable(NvPhysicalGpuHandle, NVAPI_CLOCK_TABLE*); // 0x0733E009 +NvAPI_Status NvAPI_DLL_GetVFPCurve(NvPhysicalGpuHandle, NVAPI_VFP_CURVE*); // 0x21537AD4 +NvAPI_Status NvAPI_DLL_GetCurrentVoltage(NvPhysicalGpuHandle, NVAPI_VOLTAGE_STATUS*); // 0x465F9BCF 1-004c +NvAPI_Status NvAPI_DLL_GetCoreVoltageBoostPercent(NvPhysicalGpuHandle, NVAPI_VOLTBOOST_PERCENT*); +NvAPI_Status NvAPI_DLL_SetCoreVoltageBoostPercent(NvPhysicalGpuHandle, NVAPI_VOLTBOOST_PERCENT*); + +// Maxwell only +NvAPI_Status NvAPI_DLL_GetVoltageDomainsStatus(NvPhysicalGpuHandle, NVAPI_VOLT_STATUS*); // 0xC16C7E2C +NvAPI_Status NvAPI_DLL_GetVoltages(NvPhysicalGpuHandle, NVAPI_VOLTAGES_TABLE*); // 0x7D656244 1-40CC +NvAPI_Status NvAPI_DLL_GetVoltageStep(NvPhysicalGpuHandle, NVAPI_VOLT_STATUS*); // 0x28766157 1-008C unsure of the name + +NvAPI_Status NvAPI_DLL_GetCoolerSettings(NvPhysicalGpuHandle, uint32_t, NVAPI_COOLER_SETTINGS*); // 0xDA141340 4-0558 +NvAPI_Status NvAPI_DLL_SetCoolerLevels(NvPhysicalGpuHandle, uint32_t, NVAPI_COOLER_LEVEL*); // 0x891FA0AE 1-00A4 +NvAPI_Status NvAPI_DLL_RestoreCoolerSettings(NvPhysicalGpuHandle, NVAPI_COOLER_SETTINGS*, uint32_t); + +NvAPI_Status NvAPI_DLL_GetSerialNumber(NvPhysicalGpuHandle, NvAPI_ShortString serial); + +NvAPI_Status NvAPI_DLL_GetPerfClocks(NvPhysicalGpuHandle, uint32_t num, NVAPI_GPU_PERF_CLOCKS* pClocks); // 2-2A74 +//NvAPI_Status NvAPI_DLL_SetPerfClocks(NvPhysicalGpuHandle, uint32_t num, NVAPI_GPU_PERF_CLOCKS* pClocks); // error + +//invalid.. +//NvAPI_Status NvAPI_DLL_GetPstateClientLimits(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATE_ID, uint32_t* pLimits); +//NvAPI_Status NvAPI_DLL_SetPstateClientLimits(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATE_ID, uint32_t* pLimits); + +NvAPI_Status NvAPI_DLL_SetPstates20v1(NvPhysicalGpuHandle handle, NV_GPU_PERF_PSTATES20_INFO_V1 *pSet); +NvAPI_Status NvAPI_DLL_SetPstates20v2(NvPhysicalGpuHandle handle, NV_GPU_PERF_PSTATES20_INFO_V2 *pSet); + +NvAPI_Status NvAPI_DLL_Unload(); + +#define NV_ASSERT(x) { NvAPI_Status ret = x; if(ret != NVAPI_OK) return ret; } + +// to reduce stack size, allow to reuse a mem buffer +#define NV_INIT_STRUCT_ON(TYPE, var, mem) { \ + var = (TYPE*) mem; \ + memset(var, 0, sizeof(TYPE)); \ + var->version = TYPE##_VER; \ +} + +// alloc a struct, need free(var) +#define NV_INIT_STRUCT_ALLOC(TYPE, var) { \ + var = (TYPE*) calloc(1, TYPE##_VER & 0xFFFF); \ + if (var) var->version = TYPE##_VER; \ +} + +//! Used in NvAPI_I2CReadEx() +typedef struct +{ + NvU32 version; + NvU32 displayMask; // Display Mask of the concerned display. + NvU8 bIsDDCPort; // indicates either the DDC port (TRUE) or the communication port (FALSE) of the concerned display. + NvU8 i2cDevAddress; // address of the I2C slave. The address should be shifted left by one. 0x50 -> 0xA0. + NvU8* pbI2cRegAddress; // I2C target register address. May be NULL, which indicates no register address should be sent. + NvU32 regAddrSize; // size in bytes of target register address. If pbI2cRegAddress is NULL, this field must be 0. + NvU8* pbData; // buffer of data which is to be read or written (depending on the command). + NvU32 cbRead; // bytes to read ??? seems required on write too + NvU32 cbSize; // full size of the data buffer, pbData, to be read or written. + NV_I2C_SPEED i2cSpeedKhz; // target speed of the transaction in (kHz) (Chosen from the enum NV_I2C_SPEED). + NvU8 portId; // portid on which device is connected (remember to set bIsPortIdSet if this value is set) + NvU32 bIsPortIdSet; // set this flag on if and only if portid value is set + +} NV_I2C_INFO_EX; +#define NV_I2C_INFO_EX_VER MAKE_NVAPI_VERSION(NV_I2C_INFO_EX,3) +/* +sample evga x64 call (struct of 0x40 bytes) +ReadEx +$ ==> 40 00 03 00 00 00 00 00 00 40 00 00 00 00 00 00 +$+10 58 F9 2B 00 00 00 00 00 01 00 00 00 00 00 00 00 +$+20 C0 F9 2B 00 00 00 00 00 02 00 00 00 FF FF 00 00 +$+30 00 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 + +$ ==> 40 00 03 00 00 00 00 00 00 10 00 00 00 00 00 00 +$+10 68 F9 2B 00 00 00 00 00 01 00 00 00 00 00 00 00 +$+20 C0 F9 2B 00 00 00 00 00 01 00 00 00 FF FF 00 00 +$+30 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 +00000000002BF968 > 75 83 CF 3F 01 00 00 00 +00000000002BF9C0 > 0 + +WriteEx +$ ==> 40 00 03 00 00 00 00 00 00 8C 00 00 00 00 00 00 +$+10 30 F9 2B 00 00 00 00 00 01 00 00 00 00 00 00 00 +$+20 38 F9 2B 00 00 00 00 00 02 00 00 00 FF FF 00 00 +$+30 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 +00000000002BF930 > D1 00 00 00 00 00 00 00 +00000000002BF938 > 38 00 00 00 00 00 00 00 +*/ + +NvAPI_Status NvAPI_DLL_I2CReadEx(NvPhysicalGpuHandle, NV_I2C_INFO_EX*, NvU32*); +NvAPI_Status NvAPI_DLL_I2CWriteEx(NvPhysicalGpuHandle, NV_I2C_INFO_EX*, NvU32*); diff --git a/compat/nvapi/nvapi_lite_common.h b/compat/nvapi/nvapi_lite_common.h new file mode 100644 index 0000000..e31463a --- /dev/null +++ b/compat/nvapi/nvapi_lite_common.h @@ -0,0 +1,541 @@ + /************************************************************************************************************************************\ +|* *| +|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *| +|* *| +|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *| +|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *| +|* Otherwise, you have no rights to use or access this software in any manner. *| +|* *| +|* If not covered by the applicable NVIDIA software license agreement: *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *| +|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *| +|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *| +|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *| +|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *| +|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. *| +|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial computer software documentation" *| +|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the software with only those rights set forth herein. *| +|* *| +|* Any use of this software in individual and commercial software must include, *| +|* in the user documentation and internal comments to the code, *| +|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *| +|* *| + \************************************************************************************************************************************/ +#pragma once +#include"nvapi_lite_salstart.h" +#pragma pack(push,8) +#ifdef __cplusplus +extern "C" { +#endif +#if (defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER) && (_MSC_VER > 1399) && !defined(NVAPI_INTERNAL) && !defined(NVAPI_DEPRECATED_OLD) +#ifndef __nvapi_deprecated_function +#define __nvapi_deprecated_function(message) __declspec(deprecated(message)) +#endif +#ifndef __nvapi_deprecated_datatype +#define __nvapi_deprecated_datatype(FirstRelease) __declspec(deprecated("Do not use this data type - it is deprecated in release " #FirstRelease ".")) +#endif +#else +#ifndef __nvapi_deprecated_function +#define __nvapi_deprecated_function(message) +#endif +#ifndef __nvapi_deprecated_datatype +#define __nvapi_deprecated_datatype(FirstRelease) +#endif +#endif + + +/* 64-bit types for compilers that support them, plus some obsolete variants */ +#if defined(__GNUC__) || defined(__arm) || defined(__IAR_SYSTEMS_ICC__) || defined(__ghs__) || defined(_WIN64) +typedef unsigned long long NvU64; /* 0 to 18446744073709551615 */ +typedef long long NvS64; /* -9223372036854775808 to 9223372036854775807 */ +#else +typedef unsigned __int64 NvU64; /* 0 to 18446744073709551615 */ +typedef __int64 NvS64; /* -9223372036854775808 to 9223372036854775807 */ +#endif + +// mac os 32-bit still needs this +#if (defined(macintosh) || defined(__APPLE__)) && !defined(__LP64__) +typedef signed long NvS32; /* -2147483648 to 2147483647 */ +#else +typedef signed int NvS32; /* -2147483648 to 2147483647 */ +#endif + +#ifndef __unix +// mac os 32-bit still needs this +#if ( (defined(macintosh) && defined(__LP64__) && (__NVAPI_RESERVED0__)) || \ + (!defined(macintosh) && defined(__NVAPI_RESERVED0__)) ) +typedef unsigned int NvU32; /* 0 to 4294967295 */ +#else +typedef unsigned long NvU32; /* 0 to 4294967295 */ +#endif +#else +typedef unsigned int NvU32; /* 0 to 4294967295 */ +#endif + +typedef unsigned long temp_NvU32; /* 0 to 4294967295 */ +typedef signed short NvS16; +typedef unsigned short NvU16; +typedef unsigned char NvU8; +typedef signed char NvS8; + +/* Boolean type */ +typedef NvU8 NvBool; +#define NV_TRUE ((NvBool)(0 == 0)) +#define NV_FALSE ((NvBool)(0 != 0)) + + +typedef struct _NV_RECT +{ + NvU32 left; + NvU32 top; + NvU32 right; + NvU32 bottom; +} NV_RECT; + + + +#define NV_DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name + +//! \addtogroup nvapihandles +//! NVAPI Handles - These handles are retrieved from various calls and passed in to others in NvAPI +//! These are meant to be opaque types. Do not assume they correspond to indices, HDCs, +//! display indexes or anything else. +//! +//! Most handles remain valid until a display re-configuration (display mode set) or GPU +//! reconfiguration (going into or out of SLI modes) occurs. If NVAPI_HANDLE_INVALIDATED +//! is received by an app, it should discard all handles, and re-enumerate them. +//! @{ +NV_DECLARE_HANDLE(NvDisplayHandle); //!< Display Device driven by NVIDIA GPU(s) (an attached display) +NV_DECLARE_HANDLE(NvMonitorHandle); //!< Monitor handle +NV_DECLARE_HANDLE(NvUnAttachedDisplayHandle); //!< Unattached Display Device driven by NVIDIA GPU(s) +NV_DECLARE_HANDLE(NvLogicalGpuHandle); //!< One or more physical GPUs acting in concert (SLI) +NV_DECLARE_HANDLE(NvPhysicalGpuHandle); //!< A single physical GPU +NV_DECLARE_HANDLE(NvEventHandle); //!< A handle to an event registration instance +NV_DECLARE_HANDLE(NvVisualComputingDeviceHandle); //!< A handle to a Visual Computing Device +NV_DECLARE_HANDLE(NvHICHandle); //!< A handle to a Host Interface Card +NV_DECLARE_HANDLE(NvGSyncDeviceHandle); //!< A handle to a Sync device +NV_DECLARE_HANDLE(NvVioHandle); //!< A handle to an SDI device +NV_DECLARE_HANDLE(NvTransitionHandle); //!< A handle to address a single transition request +NV_DECLARE_HANDLE(NvAudioHandle); //!< NVIDIA HD Audio Device +NV_DECLARE_HANDLE(Nv3DVPContextHandle); //!< A handle for a 3D Vision Pro (3DVP) context +NV_DECLARE_HANDLE(Nv3DVPTransceiverHandle); //!< A handle for a 3DVP RF transceiver +NV_DECLARE_HANDLE(Nv3DVPGlassesHandle); //!< A handle for a pair of 3DVP RF shutter glasses + +typedef void* StereoHandle; //!< A stereo handle, that corresponds to the device interface + +NV_DECLARE_HANDLE(NvSourceHandle); //!< Unique source handle on the system +NV_DECLARE_HANDLE(NvTargetHandle); //!< Unique target handle on the system +NV_DECLARE_HANDLE(NVDX_SwapChainHandle); //!< DirectX SwapChain objects +static const NVDX_SwapChainHandle NVDX_SWAPCHAIN_NONE = 0; +//! @} + +//! \ingroup nvapihandles +//! @{ +#define NVAPI_DEFAULT_HANDLE 0 +#define NV_BIT(x) (1 << (x)) +//! @} + + + +//! \addtogroup nvapitypes +//! @{ +#define NVAPI_GENERIC_STRING_MAX 4096 +#define NVAPI_LONG_STRING_MAX 256 +#define NVAPI_SHORT_STRING_MAX 64 + + +typedef struct +{ + NvS32 sX; + NvS32 sY; + NvS32 sWidth; + NvS32 sHeight; +} NvSBox; + +#ifndef NvGUID_Defined +#define NvGUID_Defined + +typedef struct +{ + NvU32 data1; + NvU16 data2; + NvU16 data3; + NvU8 data4[8]; +} NvGUID, NvLUID; + +#endif //#ifndef NvGUID_Defined + + +#define NVAPI_MAX_PHYSICAL_GPUS 64 +#define NVAPI_MAX_PHYSICAL_BRIDGES 100 +#define NVAPI_PHYSICAL_GPUS 32 +#define NVAPI_MAX_LOGICAL_GPUS 64 +#define NVAPI_MAX_AVAILABLE_GPU_TOPOLOGIES 256 +#define NVAPI_MAX_AVAILABLE_SLI_GROUPS 256 +#define NVAPI_MAX_GPU_TOPOLOGIES NVAPI_MAX_PHYSICAL_GPUS +#define NVAPI_MAX_GPU_PER_TOPOLOGY 8 +#define NVAPI_MAX_DISPLAY_HEADS 2 +#define NVAPI_ADVANCED_DISPLAY_HEADS 4 +#define NVAPI_MAX_DISPLAYS NVAPI_PHYSICAL_GPUS * NVAPI_ADVANCED_DISPLAY_HEADS +#define NVAPI_MAX_ACPI_IDS 16 +#define NVAPI_MAX_VIEW_MODES 8 +#define NV_MAX_HEADS 4 //!< Maximum heads, each with NVAPI_DESKTOP_RES resolution +#define NVAPI_MAX_HEADS_PER_GPU 32 + +#define NV_MAX_HEADS 4 //!< Maximum number of heads, each with #NVAPI_DESKTOP_RES resolution +#define NV_MAX_VID_STREAMS 4 //!< Maximum number of input video streams, each with a #NVAPI_VIDEO_SRC_INFO +#define NV_MAX_VID_PROFILES 4 //!< Maximum number of output video profiles supported + +#define NVAPI_SYSTEM_MAX_DISPLAYS NVAPI_MAX_PHYSICAL_GPUS * NV_MAX_HEADS + +#define NVAPI_SYSTEM_MAX_HWBCS 128 +#define NVAPI_SYSTEM_HWBC_INVALID_ID 0xffffffff +#define NVAPI_MAX_AUDIO_DEVICES 16 + + +typedef char NvAPI_String[NVAPI_GENERIC_STRING_MAX]; +typedef char NvAPI_LongString[NVAPI_LONG_STRING_MAX]; +typedef char NvAPI_ShortString[NVAPI_SHORT_STRING_MAX]; +//! @} + + +// ========================================================================================= +//! NvAPI Version Definition \n +//! Maintain per structure specific version define using the MAKE_NVAPI_VERSION macro. \n +//! Usage: #define NV_GENLOCK_STATUS_VER MAKE_NVAPI_VERSION(NV_GENLOCK_STATUS, 1) +//! \ingroup nvapitypes +// ========================================================================================= +#define MAKE_NVAPI_VERSION(typeName,ver) (NvU32)(sizeof(typeName) | ((ver)<<16)) + +//! \ingroup nvapitypes +#define GET_NVAPI_VERSION(ver) (NvU32)((ver)>>16) + +//! \ingroup nvapitypes +#define GET_NVAPI_SIZE(ver) (NvU32)((ver) & 0xffff) + + +// ==================================================== +//! NvAPI Status Values +//! All NvAPI functions return one of these codes. +//! \ingroup nvapistatus +// ==================================================== + + +typedef enum _NvAPI_Status +{ + NVAPI_OK = 0, //!< Success. Request is completed. + NVAPI_ERROR = -1, //!< Generic error + NVAPI_LIBRARY_NOT_FOUND = -2, //!< NVAPI support library cannot be loaded. + NVAPI_NO_IMPLEMENTATION = -3, //!< not implemented in current driver installation + NVAPI_API_NOT_INITIALIZED = -4, //!< NvAPI_Initialize has not been called (successfully) + NVAPI_INVALID_ARGUMENT = -5, //!< The argument/parameter value is not valid or NULL. + NVAPI_NVIDIA_DEVICE_NOT_FOUND = -6, //!< No NVIDIA display driver, or NVIDIA GPU driving a display, was found. + NVAPI_END_ENUMERATION = -7, //!< No more items to enumerate + NVAPI_INVALID_HANDLE = -8, //!< Invalid handle + NVAPI_INCOMPATIBLE_STRUCT_VERSION = -9, //!< An argument's structure version is not supported + NVAPI_HANDLE_INVALIDATED = -10, //!< The handle is no longer valid (likely due to GPU or display re-configuration) + NVAPI_OPENGL_CONTEXT_NOT_CURRENT = -11, //!< No NVIDIA OpenGL context is current (but needs to be) + NVAPI_INVALID_POINTER = -14, //!< An invalid pointer, usually NULL, was passed as a parameter + NVAPI_NO_GL_EXPERT = -12, //!< OpenGL Expert is not supported by the current drivers + NVAPI_INSTRUMENTATION_DISABLED = -13, //!< OpenGL Expert is supported, but driver instrumentation is currently disabled + NVAPI_NO_GL_NSIGHT = -15, //!< OpenGL does not support Nsight + + NVAPI_EXPECTED_LOGICAL_GPU_HANDLE = -100, //!< Expected a logical GPU handle for one or more parameters + NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE = -101, //!< Expected a physical GPU handle for one or more parameters + NVAPI_EXPECTED_DISPLAY_HANDLE = -102, //!< Expected an NV display handle for one or more parameters + NVAPI_INVALID_COMBINATION = -103, //!< The combination of parameters is not valid. + NVAPI_NOT_SUPPORTED = -104, //!< Requested feature is not supported in the selected GPU + NVAPI_PORTID_NOT_FOUND = -105, //!< No port ID was found for the I2C transaction + NVAPI_EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106, //!< Expected an unattached display handle as one of the input parameters. + NVAPI_INVALID_PERF_LEVEL = -107, //!< Invalid perf level + NVAPI_DEVICE_BUSY = -108, //!< Device is busy; request not fulfilled + NVAPI_NV_PERSIST_FILE_NOT_FOUND = -109, //!< NV persist file is not found + NVAPI_PERSIST_DATA_NOT_FOUND = -110, //!< NV persist data is not found + NVAPI_EXPECTED_TV_DISPLAY = -111, //!< Expected a TV output display + NVAPI_EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112, //!< Expected a TV output on the D Connector - HDTV_EIAJ4120. + NVAPI_NO_ACTIVE_SLI_TOPOLOGY = -113, //!< SLI is not active on this device. + NVAPI_SLI_RENDERING_MODE_NOTALLOWED = -114, //!< Setup of SLI rendering mode is not possible right now. + NVAPI_EXPECTED_DIGITAL_FLAT_PANEL = -115, //!< Expected a digital flat panel. + NVAPI_ARGUMENT_EXCEED_MAX_SIZE = -116, //!< Argument exceeds the expected size. + NVAPI_DEVICE_SWITCHING_NOT_ALLOWED = -117, //!< Inhibit is ON due to one of the flags in NV_GPU_DISPLAY_CHANGE_INHIBIT or SLI active. + NVAPI_TESTING_CLOCKS_NOT_SUPPORTED = -118, //!< Testing of clocks is not supported. + NVAPI_UNKNOWN_UNDERSCAN_CONFIG = -119, //!< The specified underscan config is from an unknown source (e.g. INF) + NVAPI_TIMEOUT_RECONFIGURING_GPU_TOPO = -120, //!< Timeout while reconfiguring GPUs + NVAPI_DATA_NOT_FOUND = -121, //!< Requested data was not found + NVAPI_EXPECTED_ANALOG_DISPLAY = -122, //!< Expected an analog display + NVAPI_NO_VIDLINK = -123, //!< No SLI video bridge is present + NVAPI_REQUIRES_REBOOT = -124, //!< NVAPI requires a reboot for the settings to take effect + NVAPI_INVALID_HYBRID_MODE = -125, //!< The function is not supported with the current Hybrid mode. + NVAPI_MIXED_TARGET_TYPES = -126, //!< The target types are not all the same + NVAPI_SYSWOW64_NOT_SUPPORTED = -127, //!< The function is not supported from 32-bit on a 64-bit system. + NVAPI_IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128, //!< There is no implicit GPU topology active. Use NVAPI_SetHybridMode to change topology. + NVAPI_REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129, //!< Prompt the user to close all non-migratable applications. + NVAPI_OUT_OF_MEMORY = -130, //!< Could not allocate sufficient memory to complete the call. + NVAPI_WAS_STILL_DRAWING = -131, //!< The previous operation that is transferring information to or from this surface is incomplete. + NVAPI_FILE_NOT_FOUND = -132, //!< The file was not found. + NVAPI_TOO_MANY_UNIQUE_STATE_OBJECTS = -133, //!< There are too many unique instances of a particular type of state object. + NVAPI_INVALID_CALL = -134, //!< The method call is invalid. For example, a method's parameter may not be a valid pointer. + NVAPI_D3D10_1_LIBRARY_NOT_FOUND = -135, //!< d3d10_1.dll cannot be loaded. + NVAPI_FUNCTION_NOT_FOUND = -136, //!< Couldn't find the function in the loaded DLL. + NVAPI_INVALID_USER_PRIVILEGE = -137, //!< Current User is not Admin. + NVAPI_EXPECTED_NON_PRIMARY_DISPLAY_HANDLE = -138, //!< The handle corresponds to GDIPrimary. + NVAPI_EXPECTED_COMPUTE_GPU_HANDLE = -139, //!< Setting Physx GPU requires that the GPU is compute-capable. + NVAPI_STEREO_NOT_INITIALIZED = -140, //!< The Stereo part of NVAPI failed to initialize completely. Check if the stereo driver is installed. + NVAPI_STEREO_REGISTRY_ACCESS_FAILED = -141, //!< Access to stereo-related registry keys or values has failed. + NVAPI_STEREO_REGISTRY_PROFILE_TYPE_NOT_SUPPORTED = -142, //!< The given registry profile type is not supported. + NVAPI_STEREO_REGISTRY_VALUE_NOT_SUPPORTED = -143, //!< The given registry value is not supported. + NVAPI_STEREO_NOT_ENABLED = -144, //!< Stereo is not enabled and the function needed it to execute completely. + NVAPI_STEREO_NOT_TURNED_ON = -145, //!< Stereo is not turned on and the function needed it to execute completely. + NVAPI_STEREO_INVALID_DEVICE_INTERFACE = -146, //!< Invalid device interface. + NVAPI_STEREO_PARAMETER_OUT_OF_RANGE = -147, //!< Separation percentage or JPEG image capture quality is out of [0-100] range. + NVAPI_STEREO_FRUSTUM_ADJUST_MODE_NOT_SUPPORTED = -148, //!< The given frustum adjust mode is not supported. + NVAPI_TOPO_NOT_POSSIBLE = -149, //!< The mosaic topology is not possible given the current state of the hardware. + NVAPI_MODE_CHANGE_FAILED = -150, //!< An attempt to do a display resolution mode change has failed. + NVAPI_D3D11_LIBRARY_NOT_FOUND = -151, //!< d3d11.dll/d3d11_beta.dll cannot be loaded. + NVAPI_INVALID_ADDRESS = -152, //!< Address is outside of valid range. + NVAPI_STRING_TOO_SMALL = -153, //!< The pre-allocated string is too small to hold the result. + NVAPI_MATCHING_DEVICE_NOT_FOUND = -154, //!< The input does not match any of the available devices. + NVAPI_DRIVER_RUNNING = -155, //!< Driver is running. + NVAPI_DRIVER_NOTRUNNING = -156, //!< Driver is not running. + NVAPI_ERROR_DRIVER_RELOAD_REQUIRED = -157, //!< A driver reload is required to apply these settings. + NVAPI_SET_NOT_ALLOWED = -158, //!< Intended setting is not allowed. + NVAPI_ADVANCED_DISPLAY_TOPOLOGY_REQUIRED = -159, //!< Information can't be returned due to "advanced display topology". + NVAPI_SETTING_NOT_FOUND = -160, //!< Setting is not found. + NVAPI_SETTING_SIZE_TOO_LARGE = -161, //!< Setting size is too large. + NVAPI_TOO_MANY_SETTINGS_IN_PROFILE = -162, //!< There are too many settings for a profile. + NVAPI_PROFILE_NOT_FOUND = -163, //!< Profile is not found. + NVAPI_PROFILE_NAME_IN_USE = -164, //!< Profile name is duplicated. + NVAPI_PROFILE_NAME_EMPTY = -165, //!< Profile name is empty. + NVAPI_EXECUTABLE_NOT_FOUND = -166, //!< Application not found in the Profile. + NVAPI_EXECUTABLE_ALREADY_IN_USE = -167, //!< Application already exists in the other profile. + NVAPI_DATATYPE_MISMATCH = -168, //!< Data Type mismatch + NVAPI_PROFILE_REMOVED = -169, //!< The profile passed as parameter has been removed and is no longer valid. + NVAPI_UNREGISTERED_RESOURCE = -170, //!< An unregistered resource was passed as a parameter. + NVAPI_ID_OUT_OF_RANGE = -171, //!< The DisplayId corresponds to a display which is not within the normal outputId range. + NVAPI_DISPLAYCONFIG_VALIDATION_FAILED = -172, //!< Display topology is not valid so the driver cannot do a mode set on this configuration. + NVAPI_DPMST_CHANGED = -173, //!< Display Port Multi-Stream topology has been changed. + NVAPI_INSUFFICIENT_BUFFER = -174, //!< Input buffer is insufficient to hold the contents. + NVAPI_ACCESS_DENIED = -175, //!< No access to the caller. + NVAPI_MOSAIC_NOT_ACTIVE = -176, //!< The requested action cannot be performed without Mosaic being enabled. + NVAPI_SHARE_RESOURCE_RELOCATED = -177, //!< The surface is relocated away from video memory. + NVAPI_REQUEST_USER_TO_DISABLE_DWM = -178, //!< The user should disable DWM before calling NvAPI. + NVAPI_D3D_DEVICE_LOST = -179, //!< D3D device status is D3DERR_DEVICELOST or D3DERR_DEVICENOTRESET - the user has to reset the device. + NVAPI_INVALID_CONFIGURATION = -180, //!< The requested action cannot be performed in the current state. + NVAPI_STEREO_HANDSHAKE_NOT_DONE = -181, //!< Call failed as stereo handshake not completed. + NVAPI_EXECUTABLE_PATH_IS_AMBIGUOUS = -182, //!< The path provided was too short to determine the correct NVDRS_APPLICATION + NVAPI_DEFAULT_STEREO_PROFILE_IS_NOT_DEFINED = -183, //!< Default stereo profile is not currently defined + NVAPI_DEFAULT_STEREO_PROFILE_DOES_NOT_EXIST = -184, //!< Default stereo profile does not exist + NVAPI_CLUSTER_ALREADY_EXISTS = -185, //!< A cluster is already defined with the given configuration. + NVAPI_DPMST_DISPLAY_ID_EXPECTED = -186, //!< The input display id is not that of a multi stream enabled connector or a display device in a multi stream topology + NVAPI_INVALID_DISPLAY_ID = -187, //!< The input display id is not valid or the monitor associated to it does not support the current operation + NVAPI_STREAM_IS_OUT_OF_SYNC = -188, //!< While playing secure audio stream, stream goes out of sync + NVAPI_INCOMPATIBLE_AUDIO_DRIVER = -189, //!< Older audio driver version than required + NVAPI_VALUE_ALREADY_SET = -190, //!< Value already set, setting again not allowed. + NVAPI_TIMEOUT = -191, //!< Requested operation timed out + NVAPI_GPU_WORKSTATION_FEATURE_INCOMPLETE = -192, //!< The requested workstation feature set has incomplete driver internal allocation resources + NVAPI_STEREO_INIT_ACTIVATION_NOT_DONE = -193, //!< Call failed because InitActivation was not called. + NVAPI_SYNC_NOT_ACTIVE = -194, //!< The requested action cannot be performed without Sync being enabled. + NVAPI_SYNC_MASTER_NOT_FOUND = -195, //!< The requested action cannot be performed without Sync Master being enabled. + NVAPI_INVALID_SYNC_TOPOLOGY = -196, //!< Invalid displays passed in the NV_GSYNC_DISPLAY pointer. + NVAPI_ECID_SIGN_ALGO_UNSUPPORTED = -197, //!< The specified signing algorithm is not supported. Either an incorrect value was entered or the current installed driver/hardware does not support the input value. + NVAPI_ECID_KEY_VERIFICATION_FAILED = -198, //!< The encrypted public key verification has failed. + NVAPI_FIRMWARE_OUT_OF_DATE = -199, //!< The device's firmware is out of date. + NVAPI_FIRMWARE_REVISION_NOT_SUPPORTED = -200, //!< The device's firmware is not supported. + NVAPI_LICENSE_CALLER_AUTHENTICATION_FAILED = -201, //!< The caller is not authorized to modify the License. + NVAPI_D3D_DEVICE_NOT_REGISTERED = -202, //!< The user tried to use a deferred context without registering the device first + NVAPI_RESOURCE_NOT_ACQUIRED = -203, //!< Head or SourceId was not reserved for the VR Display before doing the Modeset. + NVAPI_TIMING_NOT_SUPPORTED = -204, //!< Provided timing is not supported. + NVAPI_HDCP_ENCRYPTION_FAILED = -205, //!< HDCP Encryption Failed for the device. Would be applicable when the device is HDCP Capable. + NVAPI_PCLK_LIMITATION_FAILED = -206, //!< Provided mode is over sink device pclk limitation. + NVAPI_NO_CONNECTOR_FOUND = -207, //!< No connector on GPU found. +} NvAPI_Status; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_SYS_GetDriverAndBranchVersion +// +//! DESCRIPTION: This API returns display driver version and driver-branch string. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \param [out] pDriverVersion Contains the driver version after successful return. +//! \param [out] szBuildBranchString Contains the driver-branch string after successful return. +//! +//! \retval ::NVAPI_INVALID_ARGUMENT: either pDriverVersion is NULL or enum index too big +//! \retval ::NVAPI_OK - completed request +//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized +//! \retval ::NVAPI_ERROR - miscellaneous error occurred +//! +//! \ingroup driverapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_SYS_GetDriverAndBranchVersion(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString); +//! \ingroup driverapi +//! Used in NvAPI_GPU_GetMemoryInfo(). +typedef struct +{ + NvU32 version; //!< Version info + NvU32 dedicatedVideoMemory; //!< Size(in kb) of the physical framebuffer. + NvU32 availableDedicatedVideoMemory; //!< Size(in kb) of the available physical framebuffer for allocating video memory surfaces. + NvU32 systemVideoMemory; //!< Size(in kb) of system memory the driver allocates at load time. + NvU32 sharedSystemMemory; //!< Size(in kb) of shared system memory that driver is allowed to commit for surfaces across all allocations. + +} NV_DISPLAY_DRIVER_MEMORY_INFO_V1; + + +//! \ingroup driverapi +//! Used in NvAPI_GPU_GetMemoryInfo(). +typedef struct +{ + NvU32 version; //!< Version info + NvU32 dedicatedVideoMemory; //!< Size(in kb) of the physical framebuffer. + NvU32 availableDedicatedVideoMemory; //!< Size(in kb) of the available physical framebuffer for allocating video memory surfaces. + NvU32 systemVideoMemory; //!< Size(in kb) of system memory the driver allocates at load time. + NvU32 sharedSystemMemory; //!< Size(in kb) of shared system memory that driver is allowed to commit for surfaces across all allocations. + NvU32 curAvailableDedicatedVideoMemory; //!< Size(in kb) of the current available physical framebuffer for allocating video memory surfaces. + +} NV_DISPLAY_DRIVER_MEMORY_INFO_V2; + +//! \ingroup driverapi +//! Used in NvAPI_GPU_GetMemoryInfo(). +typedef struct +{ + NvU32 version; //!< Version info + NvU32 dedicatedVideoMemory; //!< Size(in kb) of the physical framebuffer. + NvU32 availableDedicatedVideoMemory; //!< Size(in kb) of the available physical framebuffer for allocating video memory surfaces. + NvU32 systemVideoMemory; //!< Size(in kb) of system memory the driver allocates at load time. + NvU32 sharedSystemMemory; //!< Size(in kb) of shared system memory that driver is allowed to commit for surfaces across all allocations. + NvU32 curAvailableDedicatedVideoMemory; //!< Size(in kb) of the current available physical framebuffer for allocating video memory surfaces. + NvU32 dedicatedVideoMemoryEvictionsSize; //!< Size(in kb) of the total size of memory released as a result of the evictions. + NvU32 dedicatedVideoMemoryEvictionCount; //!< Indicates the number of eviction events that caused an allocation to be removed from dedicated video memory to free GPU + //!< video memory to make room for other allocations. +} NV_DISPLAY_DRIVER_MEMORY_INFO_V3; + +//! \ingroup driverapi +typedef NV_DISPLAY_DRIVER_MEMORY_INFO_V3 NV_DISPLAY_DRIVER_MEMORY_INFO; + +//! \ingroup driverapi +//! Macro for constructing the version field of NV_DISPLAY_DRIVER_MEMORY_INFO_V1 +#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER_1 MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_MEMORY_INFO_V1,1) + +//! \ingroup driverapi +//! Macro for constructing the version field of NV_DISPLAY_DRIVER_MEMORY_INFO_V2 +#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER_2 MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_MEMORY_INFO_V2,2) + +//! \ingroup driverapi +//! Macro for constructing the version field of NV_DISPLAY_DRIVER_MEMORY_INFO_V3 +#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER_3 MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_MEMORY_INFO_V3,3) + +//! \ingroup driverapi +#define NV_DISPLAY_DRIVER_MEMORY_INFO_VER NV_DISPLAY_DRIVER_MEMORY_INFO_VER_3 + + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetMemoryInfo +// +//! DESCRIPTION: This function retrieves the available driver memory footprint for the specified GPU. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 177 +//! +//! \param [in] hPhysicalGpu Handle of the physical GPU for which the memory information is to be extracted. +//! \param [out] pMemoryInfo The memory footprint available in the driver. See NV_DISPLAY_DRIVER_MEMORY_INFO. +//! +//! \retval NVAPI_INVALID_ARGUMENT pMemoryInfo is NULL. +//! \retval NVAPI_OK Call successful. +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found. +//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION NV_DISPLAY_DRIVER_MEMORY_INFO structure version mismatch. +//! +//! \ingroup driverapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetMemoryInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_DISPLAY_DRIVER_MEMORY_INFO *pMemoryInfo); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_EnumPhysicalGPUs +// +//! This function returns an array of physical GPU handles. +//! Each handle represents a physical GPU present in the system. +//! That GPU may be part of an SLI configuration, or may not be visible to the OS directly. +//! +//! At least one GPU must be present in the system and running an NVIDIA display driver. +//! +//! The array nvGPUHandle will be filled with physical GPU handle values. The returned +//! gpuCount determines how many entries in the array are valid. +//! +//! \note In drivers older than 105.00, all physical GPU handles get invalidated on a +//! modeset. So the calling applications need to renum the handles after every modeset.\n +//! With drivers 105.00 and up, all physical GPU handles are constant. +//! Physical GPU handles are constant as long as the GPUs are not physically moved and +//! the SBIOS VGA order is unchanged. +//! +//! For GPU handles in TCC MODE please use NvAPI_EnumTCCPhysicalGPUs() +//! +//! SUPPORTED OS: Windows XP and higher, Mac OS X +//! +//! +//! \par Introduced in +//! \since Release: 80 +//! +//! \retval NVAPI_INVALID_ARGUMENT nvGPUHandle or pGpuCount is NULL +//! \retval NVAPI_OK One or more handles were returned +//! \retval NVAPI_NVIDIA_DEVICE_NOT_FOUND No NVIDIA GPU driving a display was found +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_EnumPhysicalGPUs(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount); +#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) + +NV_DECLARE_HANDLE(NVDX_ObjectHandle); // DX Objects +static const NVDX_ObjectHandle NVDX_OBJECT_NONE = 0; + +#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) +#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D_GetObjectHandleForResource +// +//! DESCRIPTION: This API gets a handle to a resource. +//! +//! \param [in] pDev The ID3D11Device, ID3D10Device or IDirect3DDevice9 to use +//! \param [in] pResource The ID3D10Resource, ID3D10Resource or IDirect3DResource9 from which +//! we want the NvAPI handle +//! \param [out] pHandle A handle to the resource +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \return ::NVAPI_OK if the handle was populated. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D_GetObjectHandleForResource( + IUnknown *pDevice, + IUnknown *pResource, + NVDX_ObjectHandle *pHandle); + + +#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) + +#include"nvapi_lite_salend.h" +#ifdef __cplusplus +} +#endif +#pragma pack(pop) diff --git a/compat/nvapi/nvapi_lite_d3dext.h b/compat/nvapi/nvapi_lite_d3dext.h new file mode 100644 index 0000000..75e21f3 --- /dev/null +++ b/compat/nvapi/nvapi_lite_d3dext.h @@ -0,0 +1,188 @@ + /************************************************************************************************************************************\ +|* *| +|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *| +|* *| +|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *| +|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *| +|* Otherwise, you have no rights to use or access this software in any manner. *| +|* *| +|* If not covered by the applicable NVIDIA software license agreement: *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *| +|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *| +|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *| +|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *| +|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *| +|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. *| +|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial computer software documentation" *| +|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the software with only those rights set forth herein. *| +|* *| +|* Any use of this software in individual and commercial software must include, *| +|* in the user documentation and internal comments to the code, *| +|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *| +|* *| + \************************************************************************************************************************************/ +#pragma once +#include"nvapi_lite_salstart.h" +#include"nvapi_lite_common.h" +#pragma pack(push,8) +#ifdef __cplusplus +extern "C" { +#endif +#if defined(__cplusplus) && (defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__)) +//! \ingroup dx +//! D3D_FEATURE_LEVEL supported - used in NvAPI_D3D11_CreateDevice() and NvAPI_D3D11_CreateDeviceAndSwapChain() +typedef enum +{ + NVAPI_DEVICE_FEATURE_LEVEL_NULL = -1, + NVAPI_DEVICE_FEATURE_LEVEL_10_0 = 0, + NVAPI_DEVICE_FEATURE_LEVEL_10_0_PLUS = 1, + NVAPI_DEVICE_FEATURE_LEVEL_10_1 = 2, + NVAPI_DEVICE_FEATURE_LEVEL_11_0 = 3, +} NVAPI_DEVICE_FEATURE_LEVEL; + +#endif //defined(__cplusplus) && (defined(__d3d10_h__) || defined(__d3d10_1_h__) || defined(__d3d11_h__)) +#if defined(__cplusplus) && defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_CreateDevice +// +//! DESCRIPTION: This function tries to create a DirectX 11 device. If the call fails (if we are running +//! on pre-DirectX 11 hardware), depending on the type of hardware it will try to create a DirectX 10.1 OR DirectX 10.0+ +//! OR DirectX 10.0 device. The function call is the same as D3D11CreateDevice(), but with an extra +//! argument (D3D_FEATURE_LEVEL supported by the device) that the function fills in. This argument +//! can contain -1 (NVAPI_DEVICE_FEATURE_LEVEL_NULL), if the requested featureLevel is less than DirecX 10.0. +//! +//! NOTE: When NvAPI_D3D11_CreateDevice is called with 10+ feature level we have an issue on few set of +//! tesla hardware (G80/G84/G86/G92/G94/G96) which does not support all feature level 10+ functionality +//! e.g. calling driver with mismatch between RenderTarget and Depth Buffer. App developers should +//! take into consideration such limitation when using NVAPI on such tesla hardwares. +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] pAdapter +//! \param [in] DriverType +//! \param [in] Software +//! \param [in] Flags +//! \param [in] *pFeatureLevels +//! \param [in] FeatureLevels +//! \param [in] SDKVersion +//! \param [in] **ppDevice +//! \param [in] *pFeatureLevel +//! \param [in] **ppImmediateContext +//! \param [in] *pSupportedLevel D3D_FEATURE_LEVEL supported +//! +//! \return NVAPI_OK if the createDevice call succeeded. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D11_CreateDevice(IDXGIAdapter* pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + CONST D3D_FEATURE_LEVEL *pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + ID3D11Device **ppDevice, + D3D_FEATURE_LEVEL *pFeatureLevel, + ID3D11DeviceContext **ppImmediateContext, + NVAPI_DEVICE_FEATURE_LEVEL *pSupportedLevel); + + +#endif //defined(__cplusplus) && defined(__d3d11_h__) +#if defined(__cplusplus) && defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_CreateDeviceAndSwapChain +// +//! DESCRIPTION: This function tries to create a DirectX 11 device and swap chain. If the call fails (if we are +//! running on pre=DirectX 11 hardware), depending on the type of hardware it will try to create a DirectX 10.1 OR +//! DirectX 10.0+ OR DirectX 10.0 device. The function call is the same as D3D11CreateDeviceAndSwapChain, +//! but with an extra argument (D3D_FEATURE_LEVEL supported by the device) that the function fills +//! in. This argument can contain -1 (NVAPI_DEVICE_FEATURE_LEVEL_NULL), if the requested featureLevel +//! is less than DirectX 10.0. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] pAdapter +//! \param [in] DriverType +//! \param [in] Software +//! \param [in] Flags +//! \param [in] *pFeatureLevels +//! \param [in] FeatureLevels +//! \param [in] SDKVersion +//! \param [in] *pSwapChainDesc +//! \param [in] **ppSwapChain +//! \param [in] **ppDevice +//! \param [in] *pFeatureLevel +//! \param [in] **ppImmediateContext +//! \param [in] *pSupportedLevel D3D_FEATURE_LEVEL supported +//! +//!return NVAPI_OK if the createDevice with swap chain call succeeded. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D11_CreateDeviceAndSwapChain(IDXGIAdapter* pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + CONST D3D_FEATURE_LEVEL *pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + CONST DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, + IDXGISwapChain **ppSwapChain, + ID3D11Device **ppDevice, + D3D_FEATURE_LEVEL *pFeatureLevel, + ID3D11DeviceContext **ppImmediateContext, + NVAPI_DEVICE_FEATURE_LEVEL *pSupportedLevel); + + + +#endif //defined(__cplusplus) && defined(__d3d11_h__) +#if defined(__cplusplus) && defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D11_SetDepthBoundsTest +// +//! DESCRIPTION: This function enables/disables the depth bounds test +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] pDeviceOrContext The device or device context to set depth bounds test +//! \param [in] bEnable Enable(non-zero)/disable(zero) the depth bounds test +//! \param [in] fMinDepth The minimum depth for depth bounds test +//! \param [in] fMaxDepth The maximum depth for depth bounds test +//! The valid values for fMinDepth and fMaxDepth +//! are such that 0 <= fMinDepth <= fMaxDepth <= 1 +//! +//! \return ::NVAPI_OK if the depth bounds test was correcly enabled or disabled +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D11_SetDepthBoundsTest(IUnknown* pDeviceOrContext, + NvU32 bEnable, + float fMinDepth, + float fMaxDepth); + +#endif //defined(__cplusplus) && defined(__d3d11_h__) + +#include"nvapi_lite_salend.h" +#ifdef __cplusplus +} +#endif +#pragma pack(pop) diff --git a/compat/nvapi/nvapi_lite_salend.h b/compat/nvapi/nvapi_lite_salend.h new file mode 100644 index 0000000..287f988 --- /dev/null +++ b/compat/nvapi/nvapi_lite_salend.h @@ -0,0 +1,816 @@ + /************************************************************************************************************************************\ +|* *| +|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *| +|* *| +|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *| +|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *| +|* Otherwise, you have no rights to use or access this software in any manner. *| +|* *| +|* If not covered by the applicable NVIDIA software license agreement: *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *| +|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *| +|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *| +|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *| +|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *| +|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. *| +|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial computer software documentation" *| +|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the software with only those rights set forth herein. *| +|* *| +|* Any use of this software in individual and commercial software must include, *| +|* in the user documentation and internal comments to the code, *| +|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *| +|* *| + \************************************************************************************************************************************/ +#ifndef __NVAPI_EMPTY_SAL +#ifdef __nvapi_undef__ecount + #undef __ecount + #undef __nvapi_undef__ecount +#endif +#ifdef __nvapi_undef__bcount + #undef __bcount + #undef __nvapi_undef__bcount +#endif +#ifdef __nvapi_undef__in + #undef __in + #undef __nvapi_undef__in +#endif +#ifdef __nvapi_undef__in_ecount + #undef __in_ecount + #undef __nvapi_undef__in_ecount +#endif +#ifdef __nvapi_undef__in_bcount + #undef __in_bcount + #undef __nvapi_undef__in_bcount +#endif +#ifdef __nvapi_undef__in_z + #undef __in_z + #undef __nvapi_undef__in_z +#endif +#ifdef __nvapi_undef__in_ecount_z + #undef __in_ecount_z + #undef __nvapi_undef__in_ecount_z +#endif +#ifdef __nvapi_undef__in_bcount_z + #undef __in_bcount_z + #undef __nvapi_undef__in_bcount_z +#endif +#ifdef __nvapi_undef__in_nz + #undef __in_nz + #undef __nvapi_undef__in_nz +#endif +#ifdef __nvapi_undef__in_ecount_nz + #undef __in_ecount_nz + #undef __nvapi_undef__in_ecount_nz +#endif +#ifdef __nvapi_undef__in_bcount_nz + #undef __in_bcount_nz + #undef __nvapi_undef__in_bcount_nz +#endif +#ifdef __nvapi_undef__out + #undef __out + #undef __nvapi_undef__out +#endif +#ifdef __nvapi_undef__out_ecount + #undef __out_ecount + #undef __nvapi_undef__out_ecount +#endif +#ifdef __nvapi_undef__out_bcount + #undef __out_bcount + #undef __nvapi_undef__out_bcount +#endif +#ifdef __nvapi_undef__out_ecount_part + #undef __out_ecount_part + #undef __nvapi_undef__out_ecount_part +#endif +#ifdef __nvapi_undef__out_bcount_part + #undef __out_bcount_part + #undef __nvapi_undef__out_bcount_part +#endif +#ifdef __nvapi_undef__out_ecount_full + #undef __out_ecount_full + #undef __nvapi_undef__out_ecount_full +#endif +#ifdef __nvapi_undef__out_bcount_full + #undef __out_bcount_full + #undef __nvapi_undef__out_bcount_full +#endif +#ifdef __nvapi_undef__out_z + #undef __out_z + #undef __nvapi_undef__out_z +#endif +#ifdef __nvapi_undef__out_z_opt + #undef __out_z_opt + #undef __nvapi_undef__out_z_opt +#endif +#ifdef __nvapi_undef__out_ecount_z + #undef __out_ecount_z + #undef __nvapi_undef__out_ecount_z +#endif +#ifdef __nvapi_undef__out_bcount_z + #undef __out_bcount_z + #undef __nvapi_undef__out_bcount_z +#endif +#ifdef __nvapi_undef__out_ecount_part_z + #undef __out_ecount_part_z + #undef __nvapi_undef__out_ecount_part_z +#endif +#ifdef __nvapi_undef__out_bcount_part_z + #undef __out_bcount_part_z + #undef __nvapi_undef__out_bcount_part_z +#endif +#ifdef __nvapi_undef__out_ecount_full_z + #undef __out_ecount_full_z + #undef __nvapi_undef__out_ecount_full_z +#endif +#ifdef __nvapi_undef__out_bcount_full_z + #undef __out_bcount_full_z + #undef __nvapi_undef__out_bcount_full_z +#endif +#ifdef __nvapi_undef__out_nz + #undef __out_nz + #undef __nvapi_undef__out_nz +#endif +#ifdef __nvapi_undef__out_nz_opt + #undef __out_nz_opt + #undef __nvapi_undef__out_nz_opt +#endif +#ifdef __nvapi_undef__out_ecount_nz + #undef __out_ecount_nz + #undef __nvapi_undef__out_ecount_nz +#endif +#ifdef __nvapi_undef__out_bcount_nz + #undef __out_bcount_nz + #undef __nvapi_undef__out_bcount_nz +#endif +#ifdef __nvapi_undef__inout + #undef __inout + #undef __nvapi_undef__inout +#endif +#ifdef __nvapi_undef__inout_ecount + #undef __inout_ecount + #undef __nvapi_undef__inout_ecount +#endif +#ifdef __nvapi_undef__inout_bcount + #undef __inout_bcount + #undef __nvapi_undef__inout_bcount +#endif +#ifdef __nvapi_undef__inout_ecount_part + #undef __inout_ecount_part + #undef __nvapi_undef__inout_ecount_part +#endif +#ifdef __nvapi_undef__inout_bcount_part + #undef __inout_bcount_part + #undef __nvapi_undef__inout_bcount_part +#endif +#ifdef __nvapi_undef__inout_ecount_full + #undef __inout_ecount_full + #undef __nvapi_undef__inout_ecount_full +#endif +#ifdef __nvapi_undef__inout_bcount_full + #undef __inout_bcount_full + #undef __nvapi_undef__inout_bcount_full +#endif +#ifdef __nvapi_undef__inout_z + #undef __inout_z + #undef __nvapi_undef__inout_z +#endif +#ifdef __nvapi_undef__inout_ecount_z + #undef __inout_ecount_z + #undef __nvapi_undef__inout_ecount_z +#endif +#ifdef __nvapi_undef__inout_bcount_z + #undef __inout_bcount_z + #undef __nvapi_undef__inout_bcount_z +#endif +#ifdef __nvapi_undef__inout_nz + #undef __inout_nz + #undef __nvapi_undef__inout_nz +#endif +#ifdef __nvapi_undef__inout_ecount_nz + #undef __inout_ecount_nz + #undef __nvapi_undef__inout_ecount_nz +#endif +#ifdef __nvapi_undef__inout_bcount_nz + #undef __inout_bcount_nz + #undef __nvapi_undef__inout_bcount_nz +#endif +#ifdef __nvapi_undef__ecount_opt + #undef __ecount_opt + #undef __nvapi_undef__ecount_opt +#endif +#ifdef __nvapi_undef__bcount_opt + #undef __bcount_opt + #undef __nvapi_undef__bcount_opt +#endif +#ifdef __nvapi_undef__in_opt + #undef __in_opt + #undef __nvapi_undef__in_opt +#endif +#ifdef __nvapi_undef__in_ecount_opt + #undef __in_ecount_opt + #undef __nvapi_undef__in_ecount_opt +#endif +#ifdef __nvapi_undef__in_bcount_opt + #undef __in_bcount_opt + #undef __nvapi_undef__in_bcount_opt +#endif +#ifdef __nvapi_undef__in_z_opt + #undef __in_z_opt + #undef __nvapi_undef__in_z_opt +#endif +#ifdef __nvapi_undef__in_ecount_z_opt + #undef __in_ecount_z_opt + #undef __nvapi_undef__in_ecount_z_opt +#endif +#ifdef __nvapi_undef__in_bcount_z_opt + #undef __in_bcount_z_opt + #undef __nvapi_undef__in_bcount_z_opt +#endif +#ifdef __nvapi_undef__in_nz_opt + #undef __in_nz_opt + #undef __nvapi_undef__in_nz_opt +#endif +#ifdef __nvapi_undef__in_ecount_nz_opt + #undef __in_ecount_nz_opt + #undef __nvapi_undef__in_ecount_nz_opt +#endif +#ifdef __nvapi_undef__in_bcount_nz_opt + #undef __in_bcount_nz_opt + #undef __nvapi_undef__in_bcount_nz_opt +#endif +#ifdef __nvapi_undef__out_opt + #undef __out_opt + #undef __nvapi_undef__out_opt +#endif +#ifdef __nvapi_undef__out_ecount_opt + #undef __out_ecount_opt + #undef __nvapi_undef__out_ecount_opt +#endif +#ifdef __nvapi_undef__out_bcount_opt + #undef __out_bcount_opt + #undef __nvapi_undef__out_bcount_opt +#endif +#ifdef __nvapi_undef__out_ecount_part_opt + #undef __out_ecount_part_opt + #undef __nvapi_undef__out_ecount_part_opt +#endif +#ifdef __nvapi_undef__out_bcount_part_opt + #undef __out_bcount_part_opt + #undef __nvapi_undef__out_bcount_part_opt +#endif +#ifdef __nvapi_undef__out_ecount_full_opt + #undef __out_ecount_full_opt + #undef __nvapi_undef__out_ecount_full_opt +#endif +#ifdef __nvapi_undef__out_bcount_full_opt + #undef __out_bcount_full_opt + #undef __nvapi_undef__out_bcount_full_opt +#endif +#ifdef __nvapi_undef__out_ecount_z_opt + #undef __out_ecount_z_opt + #undef __nvapi_undef__out_ecount_z_opt +#endif +#ifdef __nvapi_undef__out_bcount_z_opt + #undef __out_bcount_z_opt + #undef __nvapi_undef__out_bcount_z_opt +#endif +#ifdef __nvapi_undef__out_ecount_part_z_opt + #undef __out_ecount_part_z_opt + #undef __nvapi_undef__out_ecount_part_z_opt +#endif +#ifdef __nvapi_undef__out_bcount_part_z_opt + #undef __out_bcount_part_z_opt + #undef __nvapi_undef__out_bcount_part_z_opt +#endif +#ifdef __nvapi_undef__out_ecount_full_z_opt + #undef __out_ecount_full_z_opt + #undef __nvapi_undef__out_ecount_full_z_opt +#endif +#ifdef __nvapi_undef__out_bcount_full_z_opt + #undef __out_bcount_full_z_opt + #undef __nvapi_undef__out_bcount_full_z_opt +#endif +#ifdef __nvapi_undef__out_ecount_nz_opt + #undef __out_ecount_nz_opt + #undef __nvapi_undef__out_ecount_nz_opt +#endif +#ifdef __nvapi_undef__out_bcount_nz_opt + #undef __out_bcount_nz_opt + #undef __nvapi_undef__out_bcount_nz_opt +#endif +#ifdef __nvapi_undef__inout_opt + #undef __inout_opt + #undef __nvapi_undef__inout_opt +#endif +#ifdef __nvapi_undef__inout_ecount_opt + #undef __inout_ecount_opt + #undef __nvapi_undef__inout_ecount_opt +#endif +#ifdef __nvapi_undef__inout_bcount_opt + #undef __inout_bcount_opt + #undef __nvapi_undef__inout_bcount_opt +#endif +#ifdef __nvapi_undef__inout_ecount_part_opt + #undef __inout_ecount_part_opt + #undef __nvapi_undef__inout_ecount_part_opt +#endif +#ifdef __nvapi_undef__inout_bcount_part_opt + #undef __inout_bcount_part_opt + #undef __nvapi_undef__inout_bcount_part_opt +#endif +#ifdef __nvapi_undef__inout_ecount_full_opt + #undef __inout_ecount_full_opt + #undef __nvapi_undef__inout_ecount_full_opt +#endif +#ifdef __nvapi_undef__inout_bcount_full_opt + #undef __inout_bcount_full_opt + #undef __nvapi_undef__inout_bcount_full_opt +#endif +#ifdef __nvapi_undef__inout_z_opt + #undef __inout_z_opt + #undef __nvapi_undef__inout_z_opt +#endif +#ifdef __nvapi_undef__inout_ecount_z_opt + #undef __inout_ecount_z_opt + #undef __nvapi_undef__inout_ecount_z_opt +#endif +#ifdef __nvapi_undef__inout_ecount_z_opt + #undef __inout_ecount_z_opt + #undef __nvapi_undef__inout_ecount_z_opt +#endif +#ifdef __nvapi_undef__inout_bcount_z_opt + #undef __inout_bcount_z_opt + #undef __nvapi_undef__inout_bcount_z_opt +#endif +#ifdef __nvapi_undef__inout_nz_opt + #undef __inout_nz_opt + #undef __nvapi_undef__inout_nz_opt +#endif +#ifdef __nvapi_undef__inout_ecount_nz_opt + #undef __inout_ecount_nz_opt + #undef __nvapi_undef__inout_ecount_nz_opt +#endif +#ifdef __nvapi_undef__inout_bcount_nz_opt + #undef __inout_bcount_nz_opt + #undef __nvapi_undef__inout_bcount_nz_opt +#endif +#ifdef __nvapi_undef__deref_ecount + #undef __deref_ecount + #undef __nvapi_undef__deref_ecount +#endif +#ifdef __nvapi_undef__deref_bcount + #undef __deref_bcount + #undef __nvapi_undef__deref_bcount +#endif +#ifdef __nvapi_undef__deref_out + #undef __deref_out + #undef __nvapi_undef__deref_out +#endif +#ifdef __nvapi_undef__deref_out_ecount + #undef __deref_out_ecount + #undef __nvapi_undef__deref_out_ecount +#endif +#ifdef __nvapi_undef__deref_out_bcount + #undef __deref_out_bcount + #undef __nvapi_undef__deref_out_bcount +#endif +#ifdef __nvapi_undef__deref_out_ecount_part + #undef __deref_out_ecount_part + #undef __nvapi_undef__deref_out_ecount_part +#endif +#ifdef __nvapi_undef__deref_out_bcount_part + #undef __deref_out_bcount_part + #undef __nvapi_undef__deref_out_bcount_part +#endif +#ifdef __nvapi_undef__deref_out_ecount_full + #undef __deref_out_ecount_full + #undef __nvapi_undef__deref_out_ecount_full +#endif +#ifdef __nvapi_undef__deref_out_bcount_full + #undef __deref_out_bcount_full + #undef __nvapi_undef__deref_out_bcount_full +#endif +#ifdef __nvapi_undef__deref_out_z + #undef __deref_out_z + #undef __nvapi_undef__deref_out_z +#endif +#ifdef __nvapi_undef__deref_out_ecount_z + #undef __deref_out_ecount_z + #undef __nvapi_undef__deref_out_ecount_z +#endif +#ifdef __nvapi_undef__deref_out_bcount_z + #undef __deref_out_bcount_z + #undef __nvapi_undef__deref_out_bcount_z +#endif +#ifdef __nvapi_undef__deref_out_nz + #undef __deref_out_nz + #undef __nvapi_undef__deref_out_nz +#endif +#ifdef __nvapi_undef__deref_out_ecount_nz + #undef __deref_out_ecount_nz + #undef __nvapi_undef__deref_out_ecount_nz +#endif +#ifdef __nvapi_undef__deref_out_bcount_nz + #undef __deref_out_bcount_nz + #undef __nvapi_undef__deref_out_bcount_nz +#endif +#ifdef __nvapi_undef__deref_inout + #undef __deref_inout + #undef __nvapi_undef__deref_inout +#endif +#ifdef __nvapi_undef__deref_inout_z + #undef __deref_inout_z + #undef __nvapi_undef__deref_inout_z +#endif +#ifdef __nvapi_undef__deref_inout_ecount + #undef __deref_inout_ecount + #undef __nvapi_undef__deref_inout_ecount +#endif +#ifdef __nvapi_undef__deref_inout_bcount + #undef __deref_inout_bcount + #undef __nvapi_undef__deref_inout_bcount +#endif +#ifdef __nvapi_undef__deref_inout_ecount_part + #undef __deref_inout_ecount_part + #undef __nvapi_undef__deref_inout_ecount_part +#endif +#ifdef __nvapi_undef__deref_inout_bcount_part + #undef __deref_inout_bcount_part + #undef __nvapi_undef__deref_inout_bcount_part +#endif +#ifdef __nvapi_undef__deref_inout_ecount_full + #undef __deref_inout_ecount_full + #undef __nvapi_undef__deref_inout_ecount_full +#endif +#ifdef __nvapi_undef__deref_inout_bcount_full + #undef __deref_inout_bcount_full + #undef __nvapi_undef__deref_inout_bcount_full +#endif +#ifdef __nvapi_undef__deref_inout_z + #undef __deref_inout_z + #undef __nvapi_undef__deref_inout_z +#endif +#ifdef __nvapi_undef__deref_inout_ecount_z + #undef __deref_inout_ecount_z + #undef __nvapi_undef__deref_inout_ecount_z +#endif +#ifdef __nvapi_undef__deref_inout_bcount_z + #undef __deref_inout_bcount_z + #undef __nvapi_undef__deref_inout_bcount_z +#endif +#ifdef __nvapi_undef__deref_inout_nz + #undef __deref_inout_nz + #undef __nvapi_undef__deref_inout_nz +#endif +#ifdef __nvapi_undef__deref_inout_ecount_nz + #undef __deref_inout_ecount_nz + #undef __nvapi_undef__deref_inout_ecount_nz +#endif +#ifdef __nvapi_undef__deref_inout_bcount_nz + #undef __deref_inout_bcount_nz + #undef __nvapi_undef__deref_inout_bcount_nz +#endif +#ifdef __nvapi_undef__deref_ecount_opt + #undef __deref_ecount_opt + #undef __nvapi_undef__deref_ecount_opt +#endif +#ifdef __nvapi_undef__deref_bcount_opt + #undef __deref_bcount_opt + #undef __nvapi_undef__deref_bcount_opt +#endif +#ifdef __nvapi_undef__deref_out_opt + #undef __deref_out_opt + #undef __nvapi_undef__deref_out_opt +#endif +#ifdef __nvapi_undef__deref_out_ecount_opt + #undef __deref_out_ecount_opt + #undef __nvapi_undef__deref_out_ecount_opt +#endif +#ifdef __nvapi_undef__deref_out_bcount_opt + #undef __deref_out_bcount_opt + #undef __nvapi_undef__deref_out_bcount_opt +#endif +#ifdef __nvapi_undef__deref_out_ecount_part_opt + #undef __deref_out_ecount_part_opt + #undef __nvapi_undef__deref_out_ecount_part_opt +#endif +#ifdef __nvapi_undef__deref_out_bcount_part_opt + #undef __deref_out_bcount_part_opt + #undef __nvapi_undef__deref_out_bcount_part_opt +#endif +#ifdef __nvapi_undef__deref_out_ecount_full_opt + #undef __deref_out_ecount_full_opt + #undef __nvapi_undef__deref_out_ecount_full_opt +#endif +#ifdef __nvapi_undef__deref_out_bcount_full_opt + #undef __deref_out_bcount_full_opt + #undef __nvapi_undef__deref_out_bcount_full_opt +#endif +#ifdef __nvapi_undef__deref_out_z_opt + #undef __deref_out_z_opt + #undef __nvapi_undef__deref_out_z_opt +#endif +#ifdef __nvapi_undef__deref_out_ecount_z_opt + #undef __deref_out_ecount_z_opt + #undef __nvapi_undef__deref_out_ecount_z_opt +#endif +#ifdef __nvapi_undef__deref_out_bcount_z_opt + #undef __deref_out_bcount_z_opt + #undef __nvapi_undef__deref_out_bcount_z_opt +#endif +#ifdef __nvapi_undef__deref_out_nz_opt + #undef __deref_out_nz_opt + #undef __nvapi_undef__deref_out_nz_opt +#endif +#ifdef __nvapi_undef__deref_out_ecount_nz_opt + #undef __deref_out_ecount_nz_opt + #undef __nvapi_undef__deref_out_ecount_nz_opt +#endif +#ifdef __nvapi_undef__deref_out_bcount_nz_opt + #undef __deref_out_bcount_nz_opt + #undef __nvapi_undef__deref_out_bcount_nz_opt +#endif +#ifdef __nvapi_undef__deref_inout_opt + #undef __deref_inout_opt + #undef __nvapi_undef__deref_inout_opt +#endif +#ifdef __nvapi_undef__deref_inout_ecount_opt + #undef __deref_inout_ecount_opt + #undef __nvapi_undef__deref_inout_ecount_opt +#endif +#ifdef __nvapi_undef__deref_inout_bcount_opt + #undef __deref_inout_bcount_opt + #undef __nvapi_undef__deref_inout_bcount_opt +#endif +#ifdef __nvapi_undef__deref_inout_ecount_part_opt + #undef __deref_inout_ecount_part_opt + #undef __nvapi_undef__deref_inout_ecount_part_opt +#endif +#ifdef __nvapi_undef__deref_inout_bcount_part_opt + #undef __deref_inout_bcount_part_opt + #undef __nvapi_undef__deref_inout_bcount_part_opt +#endif +#ifdef __nvapi_undef__deref_inout_ecount_full_opt + #undef __deref_inout_ecount_full_opt + #undef __nvapi_undef__deref_inout_ecount_full_opt +#endif +#ifdef __nvapi_undef__deref_inout_bcount_full_opt + #undef __deref_inout_bcount_full_opt + #undef __nvapi_undef__deref_inout_bcount_full_opt +#endif +#ifdef __nvapi_undef__deref_inout_z_opt + #undef __deref_inout_z_opt + #undef __nvapi_undef__deref_inout_z_opt +#endif +#ifdef __nvapi_undef__deref_inout_ecount_z_opt + #undef __deref_inout_ecount_z_opt + #undef __nvapi_undef__deref_inout_ecount_z_opt +#endif +#ifdef __nvapi_undef__deref_inout_bcount_z_opt + #undef __deref_inout_bcount_z_opt + #undef __nvapi_undef__deref_inout_bcount_z_opt +#endif +#ifdef __nvapi_undef__deref_inout_nz_opt + #undef __deref_inout_nz_opt + #undef __nvapi_undef__deref_inout_nz_opt +#endif +#ifdef __nvapi_undef__deref_inout_ecount_nz_opt + #undef __deref_inout_ecount_nz_opt + #undef __nvapi_undef__deref_inout_ecount_nz_opt +#endif +#ifdef __nvapi_undef__deref_inout_bcount_nz_opt + #undef __deref_inout_bcount_nz_opt + #undef __nvapi_undef__deref_inout_bcount_nz_opt +#endif +#ifdef __nvapi_undef__deref_opt_ecount + #undef __deref_opt_ecount + #undef __nvapi_undef__deref_opt_ecount +#endif +#ifdef __nvapi_undef__deref_opt_bcount + #undef __deref_opt_bcount + #undef __nvapi_undef__deref_opt_bcount +#endif +#ifdef __nvapi_undef__deref_opt_out + #undef __deref_opt_out + #undef __nvapi_undef__deref_opt_out +#endif +#ifdef __nvapi_undef__deref_opt_out_z + #undef __deref_opt_out_z + #undef __nvapi_undef__deref_opt_out_z +#endif +#ifdef __nvapi_undef__deref_opt_out_ecount + #undef __deref_opt_out_ecount + #undef __nvapi_undef__deref_opt_out_ecount +#endif +#ifdef __nvapi_undef__deref_opt_out_bcount + #undef __deref_opt_out_bcount + #undef __nvapi_undef__deref_opt_out_bcount +#endif +#ifdef __nvapi_undef__deref_opt_out_ecount_part + #undef __deref_opt_out_ecount_part + #undef __nvapi_undef__deref_opt_out_ecount_part +#endif +#ifdef __nvapi_undef__deref_opt_out_bcount_part + #undef __deref_opt_out_bcount_part + #undef __nvapi_undef__deref_opt_out_bcount_part +#endif +#ifdef __nvapi_undef__deref_opt_out_ecount_full + #undef __deref_opt_out_ecount_full + #undef __nvapi_undef__deref_opt_out_ecount_full +#endif +#ifdef __nvapi_undef__deref_opt_out_bcount_full + #undef __deref_opt_out_bcount_full + #undef __nvapi_undef__deref_opt_out_bcount_full +#endif +#ifdef __nvapi_undef__deref_opt_inout + #undef __deref_opt_inout + #undef __nvapi_undef__deref_opt_inout +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount + #undef __deref_opt_inout_ecount + #undef __nvapi_undef__deref_opt_inout_ecount +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount + #undef __deref_opt_inout_bcount + #undef __nvapi_undef__deref_opt_inout_bcount +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_part + #undef __deref_opt_inout_ecount_part + #undef __nvapi_undef__deref_opt_inout_ecount_part +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_part + #undef __deref_opt_inout_bcount_part + #undef __nvapi_undef__deref_opt_inout_bcount_part +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_full + #undef __deref_opt_inout_ecount_full + #undef __nvapi_undef__deref_opt_inout_ecount_full +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_full + #undef __deref_opt_inout_bcount_full + #undef __nvapi_undef__deref_opt_inout_bcount_full +#endif +#ifdef __nvapi_undef__deref_opt_inout_z + #undef __deref_opt_inout_z + #undef __nvapi_undef__deref_opt_inout_z +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_z + #undef __deref_opt_inout_ecount_z + #undef __nvapi_undef__deref_opt_inout_ecount_z +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_z + #undef __deref_opt_inout_bcount_z + #undef __nvapi_undef__deref_opt_inout_bcount_z +#endif +#ifdef __nvapi_undef__deref_opt_inout_nz + #undef __deref_opt_inout_nz + #undef __nvapi_undef__deref_opt_inout_nz +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_nz + #undef __deref_opt_inout_ecount_nz + #undef __nvapi_undef__deref_opt_inout_ecount_nz +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_nz + #undef __deref_opt_inout_bcount_nz + #undef __nvapi_undef__deref_opt_inout_bcount_nz +#endif +#ifdef __nvapi_undef__deref_opt_ecount_opt + #undef __deref_opt_ecount_opt + #undef __nvapi_undef__deref_opt_ecount_opt +#endif +#ifdef __nvapi_undef__deref_opt_bcount_opt + #undef __deref_opt_bcount_opt + #undef __nvapi_undef__deref_opt_bcount_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_opt + #undef __deref_opt_out_opt + #undef __nvapi_undef__deref_opt_out_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_ecount_opt + #undef __deref_opt_out_ecount_opt + #undef __nvapi_undef__deref_opt_out_ecount_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_bcount_opt + #undef __deref_opt_out_bcount_opt + #undef __nvapi_undef__deref_opt_out_bcount_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_ecount_part_opt + #undef __deref_opt_out_ecount_part_opt + #undef __nvapi_undef__deref_opt_out_ecount_part_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_bcount_part_opt + #undef __deref_opt_out_bcount_part_opt + #undef __nvapi_undef__deref_opt_out_bcount_part_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_ecount_full_opt + #undef __deref_opt_out_ecount_full_opt + #undef __nvapi_undef__deref_opt_out_ecount_full_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_bcount_full_opt + #undef __deref_opt_out_bcount_full_opt + #undef __nvapi_undef__deref_opt_out_bcount_full_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_z_opt + #undef __deref_opt_out_z_opt + #undef __nvapi_undef__deref_opt_out_z_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_ecount_z_opt + #undef __deref_opt_out_ecount_z_opt + #undef __nvapi_undef__deref_opt_out_ecount_z_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_bcount_z_opt + #undef __deref_opt_out_bcount_z_opt + #undef __nvapi_undef__deref_opt_out_bcount_z_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_nz_opt + #undef __deref_opt_out_nz_opt + #undef __nvapi_undef__deref_opt_out_nz_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_ecount_nz_opt + #undef __deref_opt_out_ecount_nz_opt + #undef __nvapi_undef__deref_opt_out_ecount_nz_opt +#endif +#ifdef __nvapi_undef__deref_opt_out_bcount_nz_opt + #undef __deref_opt_out_bcount_nz_opt + #undef __nvapi_undef__deref_opt_out_bcount_nz_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_opt + #undef __deref_opt_inout_opt + #undef __nvapi_undef__deref_opt_inout_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_opt + #undef __deref_opt_inout_ecount_opt + #undef __nvapi_undef__deref_opt_inout_ecount_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_opt + #undef __deref_opt_inout_bcount_opt + #undef __nvapi_undef__deref_opt_inout_bcount_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_part_opt + #undef __deref_opt_inout_ecount_part_opt + #undef __nvapi_undef__deref_opt_inout_ecount_part_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_part_opt + #undef __deref_opt_inout_bcount_part_opt + #undef __nvapi_undef__deref_opt_inout_bcount_part_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_full_opt + #undef __deref_opt_inout_ecount_full_opt + #undef __nvapi_undef__deref_opt_inout_ecount_full_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_full_opt + #undef __deref_opt_inout_bcount_full_opt + #undef __nvapi_undef__deref_opt_inout_bcount_full_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_z_opt + #undef __deref_opt_inout_z_opt + #undef __nvapi_undef__deref_opt_inout_z_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_z_opt + #undef __deref_opt_inout_ecount_z_opt + #undef __nvapi_undef__deref_opt_inout_ecount_z_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_z_opt + #undef __deref_opt_inout_bcount_z_opt + #undef __nvapi_undef__deref_opt_inout_bcount_z_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_nz_opt + #undef __deref_opt_inout_nz_opt + #undef __nvapi_undef__deref_opt_inout_nz_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_ecount_nz_opt + #undef __deref_opt_inout_ecount_nz_opt + #undef __nvapi_undef__deref_opt_inout_ecount_nz_opt +#endif +#ifdef __nvapi_undef__deref_opt_inout_bcount_nz_opt + #undef __deref_opt_inout_bcount_nz_opt + #undef __nvapi_undef__deref_opt_inout_bcount_nz_opt +#endif +#ifdef __nvapi_success + #undef __success + #undef __nvapi_success +#endif +#ifdef __nvapi__Ret_notnull_ + #undef __nvapi__Ret_notnull_ + #undef _Ret_notnull_ +#endif +#ifdef __nvapi__Post_writable_byte_size_ + #undef __nvapi__Post_writable_byte_size_ + #undef _Post_writable_byte_size_ +#endif +#ifdef __nvapi_Outptr_ + #undef __nvapi_Outptr_ + #undef _Outptr_ +#endif + +#endif // __NVAPI_EMPTY_SAL diff --git a/compat/nvapi/nvapi_lite_salstart.h b/compat/nvapi/nvapi_lite_salstart.h new file mode 100644 index 0000000..8f493a4 --- /dev/null +++ b/compat/nvapi/nvapi_lite_salstart.h @@ -0,0 +1,821 @@ + /************************************************************************************************************************************\ +|* *| +|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *| +|* *| +|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *| +|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *| +|* Otherwise, you have no rights to use or access this software in any manner. *| +|* *| +|* If not covered by the applicable NVIDIA software license agreement: *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *| +|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *| +|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *| +|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *| +|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *| +|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. *| +|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial computer software documentation" *| +|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the software with only those rights set forth herein. *| +|* *| +|* Any use of this software in individual and commercial software must include, *| +|* in the user documentation and internal comments to the code, *| +|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *| +|* *| + \************************************************************************************************************************************/ + +// ==================================================== +// SAL related support +// ==================================================== + +#ifndef __ecount + #define __nvapi_undef__ecount + #define __ecount(size) +#endif +#ifndef __bcount + #define __nvapi_undef__bcount + #define __bcount(size) +#endif +#ifndef __in + #define __nvapi_undef__in + #define __in +#endif +#ifndef __in_ecount + #define __nvapi_undef__in_ecount + #define __in_ecount(size) +#endif +#ifndef __in_bcount + #define __nvapi_undef__in_bcount + #define __in_bcount(size) +#endif +#ifndef __in_z + #define __nvapi_undef__in_z + #define __in_z +#endif +#ifndef __in_ecount_z + #define __nvapi_undef__in_ecount_z + #define __in_ecount_z(size) +#endif +#ifndef __in_bcount_z + #define __nvapi_undef__in_bcount_z + #define __in_bcount_z(size) +#endif +#ifndef __in_nz + #define __nvapi_undef__in_nz + #define __in_nz +#endif +#ifndef __in_ecount_nz + #define __nvapi_undef__in_ecount_nz + #define __in_ecount_nz(size) +#endif +#ifndef __in_bcount_nz + #define __nvapi_undef__in_bcount_nz + #define __in_bcount_nz(size) +#endif +#ifndef __out + #define __nvapi_undef__out + #define __out +#endif +#ifndef __out_ecount + #define __nvapi_undef__out_ecount + #define __out_ecount(size) +#endif +#ifndef __out_bcount + #define __nvapi_undef__out_bcount + #define __out_bcount(size) +#endif +#ifndef __out_ecount_part + #define __nvapi_undef__out_ecount_part + #define __out_ecount_part(size,length) +#endif +#ifndef __out_bcount_part + #define __nvapi_undef__out_bcount_part + #define __out_bcount_part(size,length) +#endif +#ifndef __out_ecount_full + #define __nvapi_undef__out_ecount_full + #define __out_ecount_full(size) +#endif +#ifndef __out_bcount_full + #define __nvapi_undef__out_bcount_full + #define __out_bcount_full(size) +#endif +#ifndef __out_z + #define __nvapi_undef__out_z + #define __out_z +#endif +#ifndef __out_z_opt + #define __nvapi_undef__out_z_opt + #define __out_z_opt +#endif +#ifndef __out_ecount_z + #define __nvapi_undef__out_ecount_z + #define __out_ecount_z(size) +#endif +#ifndef __out_bcount_z + #define __nvapi_undef__out_bcount_z + #define __out_bcount_z(size) +#endif +#ifndef __out_ecount_part_z + #define __nvapi_undef__out_ecount_part_z + #define __out_ecount_part_z(size,length) +#endif +#ifndef __out_bcount_part_z + #define __nvapi_undef__out_bcount_part_z + #define __out_bcount_part_z(size,length) +#endif +#ifndef __out_ecount_full_z + #define __nvapi_undef__out_ecount_full_z + #define __out_ecount_full_z(size) +#endif +#ifndef __out_bcount_full_z + #define __nvapi_undef__out_bcount_full_z + #define __out_bcount_full_z(size) +#endif +#ifndef __out_nz + #define __nvapi_undef__out_nz + #define __out_nz +#endif +#ifndef __out_nz_opt + #define __nvapi_undef__out_nz_opt + #define __out_nz_opt +#endif +#ifndef __out_ecount_nz + #define __nvapi_undef__out_ecount_nz + #define __out_ecount_nz(size) +#endif +#ifndef __out_bcount_nz + #define __nvapi_undef__out_bcount_nz + #define __out_bcount_nz(size) +#endif +#ifndef __inout + #define __nvapi_undef__inout + #define __inout +#endif +#ifndef __inout_ecount + #define __nvapi_undef__inout_ecount + #define __inout_ecount(size) +#endif +#ifndef __inout_bcount + #define __nvapi_undef__inout_bcount + #define __inout_bcount(size) +#endif +#ifndef __inout_ecount_part + #define __nvapi_undef__inout_ecount_part + #define __inout_ecount_part(size,length) +#endif +#ifndef __inout_bcount_part + #define __nvapi_undef__inout_bcount_part + #define __inout_bcount_part(size,length) +#endif +#ifndef __inout_ecount_full + #define __nvapi_undef__inout_ecount_full + #define __inout_ecount_full(size) +#endif +#ifndef __inout_bcount_full + #define __nvapi_undef__inout_bcount_full + #define __inout_bcount_full(size) +#endif +#ifndef __inout_z + #define __nvapi_undef__inout_z + #define __inout_z +#endif +#ifndef __inout_ecount_z + #define __nvapi_undef__inout_ecount_z + #define __inout_ecount_z(size) +#endif +#ifndef __inout_bcount_z + #define __nvapi_undef__inout_bcount_z + #define __inout_bcount_z(size) +#endif +#ifndef __inout_nz + #define __nvapi_undef__inout_nz + #define __inout_nz +#endif +#ifndef __inout_ecount_nz + #define __nvapi_undef__inout_ecount_nz + #define __inout_ecount_nz(size) +#endif +#ifndef __inout_bcount_nz + #define __nvapi_undef__inout_bcount_nz + #define __inout_bcount_nz(size) +#endif +#ifndef __ecount_opt + #define __nvapi_undef__ecount_opt + #define __ecount_opt(size) +#endif +#ifndef __bcount_opt + #define __nvapi_undef__bcount_opt + #define __bcount_opt(size) +#endif +#ifndef __in_opt + #define __nvapi_undef__in_opt + #define __in_opt +#endif +#ifndef __in_ecount_opt + #define __nvapi_undef__in_ecount_opt + #define __in_ecount_opt(size) +#endif +#ifndef __in_bcount_opt + #define __nvapi_undef__in_bcount_opt + #define __in_bcount_opt(size) +#endif +#ifndef __in_z_opt + #define __nvapi_undef__in_z_opt + #define __in_z_opt +#endif +#ifndef __in_ecount_z_opt + #define __nvapi_undef__in_ecount_z_opt + #define __in_ecount_z_opt(size) +#endif +#ifndef __in_bcount_z_opt + #define __nvapi_undef__in_bcount_z_opt + #define __in_bcount_z_opt(size) +#endif +#ifndef __in_nz_opt + #define __nvapi_undef__in_nz_opt + #define __in_nz_opt +#endif +#ifndef __in_ecount_nz_opt + #define __nvapi_undef__in_ecount_nz_opt + #define __in_ecount_nz_opt(size) +#endif +#ifndef __in_bcount_nz_opt + #define __nvapi_undef__in_bcount_nz_opt + #define __in_bcount_nz_opt(size) +#endif +#ifndef __out_opt + #define __nvapi_undef__out_opt + #define __out_opt +#endif +#ifndef __out_ecount_opt + #define __nvapi_undef__out_ecount_opt + #define __out_ecount_opt(size) +#endif +#ifndef __out_bcount_opt + #define __nvapi_undef__out_bcount_opt + #define __out_bcount_opt(size) +#endif +#ifndef __out_ecount_part_opt + #define __nvapi_undef__out_ecount_part_opt + #define __out_ecount_part_opt(size,length) +#endif +#ifndef __out_bcount_part_opt + #define __nvapi_undef__out_bcount_part_opt + #define __out_bcount_part_opt(size,length) +#endif +#ifndef __out_ecount_full_opt + #define __nvapi_undef__out_ecount_full_opt + #define __out_ecount_full_opt(size) +#endif +#ifndef __out_bcount_full_opt + #define __nvapi_undef__out_bcount_full_opt + #define __out_bcount_full_opt(size) +#endif +#ifndef __out_ecount_z_opt + #define __nvapi_undef__out_ecount_z_opt + #define __out_ecount_z_opt(size) +#endif +#ifndef __out_bcount_z_opt + #define __nvapi_undef__out_bcount_z_opt + #define __out_bcount_z_opt(size) +#endif +#ifndef __out_ecount_part_z_opt + #define __nvapi_undef__out_ecount_part_z_opt + #define __out_ecount_part_z_opt(size,length) +#endif +#ifndef __out_bcount_part_z_opt + #define __nvapi_undef__out_bcount_part_z_opt + #define __out_bcount_part_z_opt(size,length) +#endif +#ifndef __out_ecount_full_z_opt + #define __nvapi_undef__out_ecount_full_z_opt + #define __out_ecount_full_z_opt(size) +#endif +#ifndef __out_bcount_full_z_opt + #define __nvapi_undef__out_bcount_full_z_opt + #define __out_bcount_full_z_opt(size) +#endif +#ifndef __out_ecount_nz_opt + #define __nvapi_undef__out_ecount_nz_opt + #define __out_ecount_nz_opt(size) +#endif +#ifndef __out_bcount_nz_opt + #define __nvapi_undef__out_bcount_nz_opt + #define __out_bcount_nz_opt(size) +#endif +#ifndef __inout_opt + #define __nvapi_undef__inout_opt + #define __inout_opt +#endif +#ifndef __inout_ecount_opt + #define __nvapi_undef__inout_ecount_opt + #define __inout_ecount_opt(size) +#endif +#ifndef __inout_bcount_opt + #define __nvapi_undef__inout_bcount_opt + #define __inout_bcount_opt(size) +#endif +#ifndef __inout_ecount_part_opt + #define __nvapi_undef__inout_ecount_part_opt + #define __inout_ecount_part_opt(size,length) +#endif +#ifndef __inout_bcount_part_opt + #define __nvapi_undef__inout_bcount_part_opt + #define __inout_bcount_part_opt(size,length) +#endif +#ifndef __inout_ecount_full_opt + #define __nvapi_undef__inout_ecount_full_opt + #define __inout_ecount_full_opt(size) +#endif +#ifndef __inout_bcount_full_opt + #define __nvapi_undef__inout_bcount_full_opt + #define __inout_bcount_full_opt(size) +#endif +#ifndef __inout_z_opt + #define __nvapi_undef__inout_z_opt + #define __inout_z_opt +#endif +#ifndef __inout_ecount_z_opt + #define __nvapi_undef__inout_ecount_z_opt + #define __inout_ecount_z_opt(size) +#endif +#ifndef __inout_ecount_z_opt + #define __nvapi_undef__inout_ecount_z_opt + #define __inout_ecount_z_opt(size) +#endif +#ifndef __inout_bcount_z_opt + #define __nvapi_undef__inout_bcount_z_opt + #define __inout_bcount_z_opt(size) +#endif +#ifndef __inout_nz_opt + #define __nvapi_undef__inout_nz_opt + #define __inout_nz_opt +#endif +#ifndef __inout_ecount_nz_opt + #define __nvapi_undef__inout_ecount_nz_opt + #define __inout_ecount_nz_opt(size) +#endif +#ifndef __inout_bcount_nz_opt + #define __nvapi_undef__inout_bcount_nz_opt + #define __inout_bcount_nz_opt(size) +#endif +#ifndef __deref_ecount + #define __nvapi_undef__deref_ecount + #define __deref_ecount(size) +#endif +#ifndef __deref_bcount + #define __nvapi_undef__deref_bcount + #define __deref_bcount(size) +#endif +#ifndef __deref_out + #define __nvapi_undef__deref_out + #define __deref_out +#endif +#ifndef __deref_out_ecount + #define __nvapi_undef__deref_out_ecount + #define __deref_out_ecount(size) +#endif +#ifndef __deref_out_bcount + #define __nvapi_undef__deref_out_bcount + #define __deref_out_bcount(size) +#endif +#ifndef __deref_out_ecount_part + #define __nvapi_undef__deref_out_ecount_part + #define __deref_out_ecount_part(size,length) +#endif +#ifndef __deref_out_bcount_part + #define __nvapi_undef__deref_out_bcount_part + #define __deref_out_bcount_part(size,length) +#endif +#ifndef __deref_out_ecount_full + #define __nvapi_undef__deref_out_ecount_full + #define __deref_out_ecount_full(size) +#endif +#ifndef __deref_out_bcount_full + #define __nvapi_undef__deref_out_bcount_full + #define __deref_out_bcount_full(size) +#endif +#ifndef __deref_out_z + #define __nvapi_undef__deref_out_z + #define __deref_out_z +#endif +#ifndef __deref_out_ecount_z + #define __nvapi_undef__deref_out_ecount_z + #define __deref_out_ecount_z(size) +#endif +#ifndef __deref_out_bcount_z + #define __nvapi_undef__deref_out_bcount_z + #define __deref_out_bcount_z(size) +#endif +#ifndef __deref_out_nz + #define __nvapi_undef__deref_out_nz + #define __deref_out_nz +#endif +#ifndef __deref_out_ecount_nz + #define __nvapi_undef__deref_out_ecount_nz + #define __deref_out_ecount_nz(size) +#endif +#ifndef __deref_out_bcount_nz + #define __nvapi_undef__deref_out_bcount_nz + #define __deref_out_bcount_nz(size) +#endif +#ifndef __deref_inout + #define __nvapi_undef__deref_inout + #define __deref_inout +#endif +#ifndef __deref_inout_z + #define __nvapi_undef__deref_inout_z + #define __deref_inout_z +#endif +#ifndef __deref_inout_ecount + #define __nvapi_undef__deref_inout_ecount + #define __deref_inout_ecount(size) +#endif +#ifndef __deref_inout_bcount + #define __nvapi_undef__deref_inout_bcount + #define __deref_inout_bcount(size) +#endif +#ifndef __deref_inout_ecount_part + #define __nvapi_undef__deref_inout_ecount_part + #define __deref_inout_ecount_part(size,length) +#endif +#ifndef __deref_inout_bcount_part + #define __nvapi_undef__deref_inout_bcount_part + #define __deref_inout_bcount_part(size,length) +#endif +#ifndef __deref_inout_ecount_full + #define __nvapi_undef__deref_inout_ecount_full + #define __deref_inout_ecount_full(size) +#endif +#ifndef __deref_inout_bcount_full + #define __nvapi_undef__deref_inout_bcount_full + #define __deref_inout_bcount_full(size) +#endif +#ifndef __deref_inout_z + #define __nvapi_undef__deref_inout_z + #define __deref_inout_z +#endif +#ifndef __deref_inout_ecount_z + #define __nvapi_undef__deref_inout_ecount_z + #define __deref_inout_ecount_z(size) +#endif +#ifndef __deref_inout_bcount_z + #define __nvapi_undef__deref_inout_bcount_z + #define __deref_inout_bcount_z(size) +#endif +#ifndef __deref_inout_nz + #define __nvapi_undef__deref_inout_nz + #define __deref_inout_nz +#endif +#ifndef __deref_inout_ecount_nz + #define __nvapi_undef__deref_inout_ecount_nz + #define __deref_inout_ecount_nz(size) +#endif +#ifndef __deref_inout_bcount_nz + #define __nvapi_undef__deref_inout_bcount_nz + #define __deref_inout_bcount_nz(size) +#endif +#ifndef __deref_ecount_opt + #define __nvapi_undef__deref_ecount_opt + #define __deref_ecount_opt(size) +#endif +#ifndef __deref_bcount_opt + #define __nvapi_undef__deref_bcount_opt + #define __deref_bcount_opt(size) +#endif +#ifndef __deref_out_opt + #define __nvapi_undef__deref_out_opt + #define __deref_out_opt +#endif +#ifndef __deref_out_ecount_opt + #define __nvapi_undef__deref_out_ecount_opt + #define __deref_out_ecount_opt(size) +#endif +#ifndef __deref_out_bcount_opt + #define __nvapi_undef__deref_out_bcount_opt + #define __deref_out_bcount_opt(size) +#endif +#ifndef __deref_out_ecount_part_opt + #define __nvapi_undef__deref_out_ecount_part_opt + #define __deref_out_ecount_part_opt(size,length) +#endif +#ifndef __deref_out_bcount_part_opt + #define __nvapi_undef__deref_out_bcount_part_opt + #define __deref_out_bcount_part_opt(size,length) +#endif +#ifndef __deref_out_ecount_full_opt + #define __nvapi_undef__deref_out_ecount_full_opt + #define __deref_out_ecount_full_opt(size) +#endif +#ifndef __deref_out_bcount_full_opt + #define __nvapi_undef__deref_out_bcount_full_opt + #define __deref_out_bcount_full_opt(size) +#endif +#ifndef __deref_out_z_opt + #define __nvapi_undef__deref_out_z_opt + #define __deref_out_z_opt +#endif +#ifndef __deref_out_ecount_z_opt + #define __nvapi_undef__deref_out_ecount_z_opt + #define __deref_out_ecount_z_opt(size) +#endif +#ifndef __deref_out_bcount_z_opt + #define __nvapi_undef__deref_out_bcount_z_opt + #define __deref_out_bcount_z_opt(size) +#endif +#ifndef __deref_out_nz_opt + #define __nvapi_undef__deref_out_nz_opt + #define __deref_out_nz_opt +#endif +#ifndef __deref_out_ecount_nz_opt + #define __nvapi_undef__deref_out_ecount_nz_opt + #define __deref_out_ecount_nz_opt(size) +#endif +#ifndef __deref_out_bcount_nz_opt + #define __nvapi_undef__deref_out_bcount_nz_opt + #define __deref_out_bcount_nz_opt(size) +#endif +#ifndef __deref_inout_opt + #define __nvapi_undef__deref_inout_opt + #define __deref_inout_opt +#endif +#ifndef __deref_inout_ecount_opt + #define __nvapi_undef__deref_inout_ecount_opt + #define __deref_inout_ecount_opt(size) +#endif +#ifndef __deref_inout_bcount_opt + #define __nvapi_undef__deref_inout_bcount_opt + #define __deref_inout_bcount_opt(size) +#endif +#ifndef __deref_inout_ecount_part_opt + #define __nvapi_undef__deref_inout_ecount_part_opt + #define __deref_inout_ecount_part_opt(size,length) +#endif +#ifndef __deref_inout_bcount_part_opt + #define __nvapi_undef__deref_inout_bcount_part_opt + #define __deref_inout_bcount_part_opt(size,length) +#endif +#ifndef __deref_inout_ecount_full_opt + #define __nvapi_undef__deref_inout_ecount_full_opt + #define __deref_inout_ecount_full_opt(size) +#endif +#ifndef __deref_inout_bcount_full_opt + #define __nvapi_undef__deref_inout_bcount_full_opt + #define __deref_inout_bcount_full_opt(size) +#endif +#ifndef __deref_inout_z_opt + #define __nvapi_undef__deref_inout_z_opt + #define __deref_inout_z_opt +#endif +#ifndef __deref_inout_ecount_z_opt + #define __nvapi_undef__deref_inout_ecount_z_opt + #define __deref_inout_ecount_z_opt(size) +#endif +#ifndef __deref_inout_bcount_z_opt + #define __nvapi_undef__deref_inout_bcount_z_opt + #define __deref_inout_bcount_z_opt(size) +#endif +#ifndef __deref_inout_nz_opt + #define __nvapi_undef__deref_inout_nz_opt + #define __deref_inout_nz_opt +#endif +#ifndef __deref_inout_ecount_nz_opt + #define __nvapi_undef__deref_inout_ecount_nz_opt + #define __deref_inout_ecount_nz_opt(size) +#endif +#ifndef __deref_inout_bcount_nz_opt + #define __nvapi_undef__deref_inout_bcount_nz_opt + #define __deref_inout_bcount_nz_opt(size) +#endif +#ifndef __deref_opt_ecount + #define __nvapi_undef__deref_opt_ecount + #define __deref_opt_ecount(size) +#endif +#ifndef __deref_opt_bcount + #define __nvapi_undef__deref_opt_bcount + #define __deref_opt_bcount(size) +#endif +#ifndef __deref_opt_out + #define __nvapi_undef__deref_opt_out + #define __deref_opt_out +#endif +#ifndef __deref_opt_out_z + #define __nvapi_undef__deref_opt_out_z + #define __deref_opt_out_z +#endif +#ifndef __deref_opt_out_ecount + #define __nvapi_undef__deref_opt_out_ecount + #define __deref_opt_out_ecount(size) +#endif +#ifndef __deref_opt_out_bcount + #define __nvapi_undef__deref_opt_out_bcount + #define __deref_opt_out_bcount(size) +#endif +#ifndef __deref_opt_out_ecount_part + #define __nvapi_undef__deref_opt_out_ecount_part + #define __deref_opt_out_ecount_part(size,length) +#endif +#ifndef __deref_opt_out_bcount_part + #define __nvapi_undef__deref_opt_out_bcount_part + #define __deref_opt_out_bcount_part(size,length) +#endif +#ifndef __deref_opt_out_ecount_full + #define __nvapi_undef__deref_opt_out_ecount_full + #define __deref_opt_out_ecount_full(size) +#endif +#ifndef __deref_opt_out_bcount_full + #define __nvapi_undef__deref_opt_out_bcount_full + #define __deref_opt_out_bcount_full(size) +#endif +#ifndef __deref_opt_inout + #define __nvapi_undef__deref_opt_inout + #define __deref_opt_inout +#endif +#ifndef __deref_opt_inout_ecount + #define __nvapi_undef__deref_opt_inout_ecount + #define __deref_opt_inout_ecount(size) +#endif +#ifndef __deref_opt_inout_bcount + #define __nvapi_undef__deref_opt_inout_bcount + #define __deref_opt_inout_bcount(size) +#endif +#ifndef __deref_opt_inout_ecount_part + #define __nvapi_undef__deref_opt_inout_ecount_part + #define __deref_opt_inout_ecount_part(size,length) +#endif +#ifndef __deref_opt_inout_bcount_part + #define __nvapi_undef__deref_opt_inout_bcount_part + #define __deref_opt_inout_bcount_part(size,length) +#endif +#ifndef __deref_opt_inout_ecount_full + #define __nvapi_undef__deref_opt_inout_ecount_full + #define __deref_opt_inout_ecount_full(size) +#endif +#ifndef __deref_opt_inout_bcount_full + #define __nvapi_undef__deref_opt_inout_bcount_full + #define __deref_opt_inout_bcount_full(size) +#endif +#ifndef __deref_opt_inout_z + #define __nvapi_undef__deref_opt_inout_z + #define __deref_opt_inout_z +#endif +#ifndef __deref_opt_inout_ecount_z + #define __nvapi_undef__deref_opt_inout_ecount_z + #define __deref_opt_inout_ecount_z(size) +#endif +#ifndef __deref_opt_inout_bcount_z + #define __nvapi_undef__deref_opt_inout_bcount_z + #define __deref_opt_inout_bcount_z(size) +#endif +#ifndef __deref_opt_inout_nz + #define __nvapi_undef__deref_opt_inout_nz + #define __deref_opt_inout_nz +#endif +#ifndef __deref_opt_inout_ecount_nz + #define __nvapi_undef__deref_opt_inout_ecount_nz + #define __deref_opt_inout_ecount_nz(size) +#endif +#ifndef __deref_opt_inout_bcount_nz + #define __nvapi_undef__deref_opt_inout_bcount_nz + #define __deref_opt_inout_bcount_nz(size) +#endif +#ifndef __deref_opt_ecount_opt + #define __nvapi_undef__deref_opt_ecount_opt + #define __deref_opt_ecount_opt(size) +#endif +#ifndef __deref_opt_bcount_opt + #define __nvapi_undef__deref_opt_bcount_opt + #define __deref_opt_bcount_opt(size) +#endif +#ifndef __deref_opt_out_opt + #define __nvapi_undef__deref_opt_out_opt + #define __deref_opt_out_opt +#endif +#ifndef __deref_opt_out_ecount_opt + #define __nvapi_undef__deref_opt_out_ecount_opt + #define __deref_opt_out_ecount_opt(size) +#endif +#ifndef __deref_opt_out_bcount_opt + #define __nvapi_undef__deref_opt_out_bcount_opt + #define __deref_opt_out_bcount_opt(size) +#endif +#ifndef __deref_opt_out_ecount_part_opt + #define __nvapi_undef__deref_opt_out_ecount_part_opt + #define __deref_opt_out_ecount_part_opt(size,length) +#endif +#ifndef __deref_opt_out_bcount_part_opt + #define __nvapi_undef__deref_opt_out_bcount_part_opt + #define __deref_opt_out_bcount_part_opt(size,length) +#endif +#ifndef __deref_opt_out_ecount_full_opt + #define __nvapi_undef__deref_opt_out_ecount_full_opt + #define __deref_opt_out_ecount_full_opt(size) +#endif +#ifndef __deref_opt_out_bcount_full_opt + #define __nvapi_undef__deref_opt_out_bcount_full_opt + #define __deref_opt_out_bcount_full_opt(size) +#endif +#ifndef __deref_opt_out_z_opt + #define __nvapi_undef__deref_opt_out_z_opt + #define __deref_opt_out_z_opt +#endif +#ifndef __deref_opt_out_ecount_z_opt + #define __nvapi_undef__deref_opt_out_ecount_z_opt + #define __deref_opt_out_ecount_z_opt(size) +#endif +#ifndef __deref_opt_out_bcount_z_opt + #define __nvapi_undef__deref_opt_out_bcount_z_opt + #define __deref_opt_out_bcount_z_opt(size) +#endif +#ifndef __deref_opt_out_nz_opt + #define __nvapi_undef__deref_opt_out_nz_opt + #define __deref_opt_out_nz_opt +#endif +#ifndef __deref_opt_out_ecount_nz_opt + #define __nvapi_undef__deref_opt_out_ecount_nz_opt + #define __deref_opt_out_ecount_nz_opt(size) +#endif +#ifndef __deref_opt_out_bcount_nz_opt + #define __nvapi_undef__deref_opt_out_bcount_nz_opt + #define __deref_opt_out_bcount_nz_opt(size) +#endif +#ifndef __deref_opt_inout_opt + #define __nvapi_undef__deref_opt_inout_opt + #define __deref_opt_inout_opt +#endif +#ifndef __deref_opt_inout_ecount_opt + #define __nvapi_undef__deref_opt_inout_ecount_opt + #define __deref_opt_inout_ecount_opt(size) +#endif +#ifndef __deref_opt_inout_bcount_opt + #define __nvapi_undef__deref_opt_inout_bcount_opt + #define __deref_opt_inout_bcount_opt(size) +#endif +#ifndef __deref_opt_inout_ecount_part_opt + #define __nvapi_undef__deref_opt_inout_ecount_part_opt + #define __deref_opt_inout_ecount_part_opt(size,length) +#endif +#ifndef __deref_opt_inout_bcount_part_opt + #define __nvapi_undef__deref_opt_inout_bcount_part_opt + #define __deref_opt_inout_bcount_part_opt(size,length) +#endif +#ifndef __deref_opt_inout_ecount_full_opt + #define __nvapi_undef__deref_opt_inout_ecount_full_opt + #define __deref_opt_inout_ecount_full_opt(size) +#endif +#ifndef __deref_opt_inout_bcount_full_opt + #define __nvapi_undef__deref_opt_inout_bcount_full_opt + #define __deref_opt_inout_bcount_full_opt(size) +#endif +#ifndef __deref_opt_inout_z_opt + #define __nvapi_undef__deref_opt_inout_z_opt + #define __deref_opt_inout_z_opt +#endif +#ifndef __deref_opt_inout_ecount_z_opt + #define __nvapi_undef__deref_opt_inout_ecount_z_opt + #define __deref_opt_inout_ecount_z_opt(size) +#endif +#ifndef __deref_opt_inout_bcount_z_opt + #define __nvapi_undef__deref_opt_inout_bcount_z_opt + #define __deref_opt_inout_bcount_z_opt(size) +#endif +#ifndef __deref_opt_inout_nz_opt + #define __nvapi_undef__deref_opt_inout_nz_opt + #define __deref_opt_inout_nz_opt +#endif +#ifndef __deref_opt_inout_ecount_nz_opt + #define __nvapi_undef__deref_opt_inout_ecount_nz_opt + #define __deref_opt_inout_ecount_nz_opt(size) +#endif +#ifndef __deref_opt_inout_bcount_nz_opt + #define __nvapi_undef__deref_opt_inout_bcount_nz_opt + #define __deref_opt_inout_bcount_nz_opt(size) +#endif +#ifndef __success + #define __nvapi_success + #define __success(epxr) +#endif +#ifndef _Ret_notnull_ + #define __nvapi__Ret_notnull_ + #define _Ret_notnull_ +#endif +#ifndef _Post_writable_byte_size_ + #define __nvapi__Post_writable_byte_size_ + #define _Post_writable_byte_size_(n) +#endif +#ifndef _Outptr_ + #define __nvapi_Outptr_ + #define _Outptr_ +#endif + + +#define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl diff --git a/compat/nvapi/nvapi_lite_sli.h b/compat/nvapi/nvapi_lite_sli.h new file mode 100644 index 0000000..b4fd661 --- /dev/null +++ b/compat/nvapi/nvapi_lite_sli.h @@ -0,0 +1,225 @@ + /************************************************************************************************************************************\ +|* *| +|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *| +|* *| +|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *| +|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *| +|* Otherwise, you have no rights to use or access this software in any manner. *| +|* *| +|* If not covered by the applicable NVIDIA software license agreement: *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *| +|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *| +|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *| +|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *| +|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *| +|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. *| +|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial computer software documentation" *| +|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the software with only those rights set forth herein. *| +|* *| +|* Any use of this software in individual and commercial software must include, *| +|* in the user documentation and internal comments to the code, *| +|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *| +|* *| + \************************************************************************************************************************************/ + +#pragma once +#include"nvapi_lite_salstart.h" +#include"nvapi_lite_common.h" +#pragma pack(push,8) +#ifdef __cplusplus +extern "C" { +#endif +//----------------------------------------------------------------------------- +// DirectX APIs +//----------------------------------------------------------------------------- + + +//! \ingroup dx +//! Used in NvAPI_D3D10_GetCurrentSLIState(), and NvAPI_D3D_GetCurrentSLIState(). +typedef struct +{ + NvU32 version; //!< Structure version + NvU32 maxNumAFRGroups; //!< [OUT] The maximum possible value of numAFRGroups + NvU32 numAFRGroups; //!< [OUT] The number of AFR groups enabled in the system + NvU32 currentAFRIndex; //!< [OUT] The AFR group index for the frame currently being rendered + NvU32 nextFrameAFRIndex; //!< [OUT] What the AFR group index will be for the next frame (i.e. after calling Present) + NvU32 previousFrameAFRIndex; //!< [OUT] The AFR group index that was used for the previous frame (~0 if more than one frame has not been rendered yet) + NvU32 bIsCurAFRGroupNew; //!< [OUT] Boolean: Is this frame the first time running on the current AFR group + +} NV_GET_CURRENT_SLI_STATE; + +//! \ingroup dx +#define NV_GET_CURRENT_SLI_STATE_VER MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE,1) +#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D_GetCurrentSLIState +// +//! DESCRIPTION: This function returns the current SLI state for the specified device. The structure +//! contains the number of AFR groups, the current AFR group index, +//! and what the AFR group index will be for the next frame. \p +//! pDevice can be either a IDirect3DDevice9 or ID3D10Device pointer. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 173 +//! +//! \retval NVAPI_OK Completed request +//! \retval NVAPI_ERROR Error occurred +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D_GetCurrentSLIState(IUnknown *pDevice, NV_GET_CURRENT_SLI_STATE *pSliState); +#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) +#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D_SetResourceHint +// +//! \fn NvAPI_D3D_SetResourceHint(IUnknown *pDev, NVDX_ObjectHandle obj, +//! NVAPI_D3D_SETRESOURCEHINT_CATEGORY dwHintCategory, +//! NvU32 dwHintName, +//! NvU32 *pdwHintValue) +//! +//! DESCRIPTION: This is a general purpose function for passing down various resource +//! related hints to the driver. Hints are divided into categories +//! and types within each category. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] pDev The ID3D10Device or IDirect3DDevice9 that is a using the resource +//! \param [in] obj Previously obtained HV resource handle +//! \param [in] dwHintCategory Category of the hints +//! \param [in] dwHintName A hint within this category +//! \param [in] *pdwHintValue Pointer to location containing hint value +//! +//! \return an int which could be an NvAPI status or DX HRESULT code +//! +//! \retval ::NVAPI_OK +//! \retval ::NVAPI_INVALID_ARGUMENT +//! \retval ::NVAPI_INVALID_CALL It is illegal to change a hint dynamically when the resource is already bound. +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +//! \ingroup dx +//! Valid categories for NvAPI_D3D_SetResourceHint() +typedef enum _NVAPI_D3D_SETRESOURCEHINT_CATEGORY +{ + NVAPI_D3D_SRH_CATEGORY_SLI = 1 +} NVAPI_D3D_SETRESOURCEHINT_CATEGORY; + + +// +// NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC: +// NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USING: + + +//! \ingroup dx +//! Types of SLI hints; \n +//! NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC: Valid values : 0 or 1 \n +//! Default value: 0 \n +//! Explanation: If the value is 1, the driver will not track any rendering operations that would mark this resource as dirty, +//! avoiding any form of synchronization across frames rendered in parallel in multiple GPUs in AFR mode. +//! +//! NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USAGE: Valid values : 0 or 1 \n +//! Default value: 0 \n +//! Explanation: If the value is 1, the driver will try to perform operations which involved target resource in broadcast, +//! where its possible. Hint is static and must be set before resource starts using. +typedef enum _NVAPI_D3D_SETRESOURCEHINT_SLI +{ + NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC = 1, + NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USAGE = 2 +} NVAPI_D3D_SETRESOURCEHINT_SLI; + +//! \ingroup dx +NVAPI_INTERFACE NvAPI_D3D_SetResourceHint(IUnknown *pDev, NVDX_ObjectHandle obj, + NVAPI_D3D_SETRESOURCEHINT_CATEGORY dwHintCategory, + NvU32 dwHintName, + NvU32 *pdwHintValue); +#endif //defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) +#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D_BeginResourceRendering +// +//! \fn NvAPI_D3D_BeginResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags) +//! DESCRIPTION: This function tells the driver that the resource will begin to receive updates. It must be used in combination with NvAPI_D3D_EndResourceRendering(). +//! The primary use of this function is allow the driver to initiate early inter-frame synchronization of resources while running in AFR SLI mode. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] pDev The ID3D10Device or IDirect3DDevice9 that is a using the resource +//! \param [in] obj Previously obtained HV resource handle +//! \param [in] Flags The flags for functionality applied to resource while being used. +//! +//! \retval ::NVAPI_OK Function succeeded, if used properly and driver can initiate proper sync'ing of the resources. +//! \retval ::NVAPI_INVALID_ARGUMENT Bad argument(s) or invalid flag values +//! \retval ::NVAPI_INVALID_CALL Mismatched begin/end calls +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup dx +//! Used in NvAPI_D3D_BeginResourceRendering(). +typedef enum _NVAPI_D3D_RESOURCERENDERING_FLAG +{ + NVAPI_D3D_RR_FLAG_DEFAULTS = 0x00000000, //!< All bits set to 0 are defaults. + NVAPI_D3D_RR_FLAG_FORCE_DISCARD_CONTENT = 0x00000001, //!< (bit 0) The flag forces to discard previous content of the resource regardless of the NvApiHints_Sli_Disable_InterframeSync hint + NVAPI_D3D_RR_FLAG_FORCE_KEEP_CONTENT = 0x00000002, //!< (bit 1) The flag forces to respect previous content of the resource regardless of the NvApiHints_Sli_Disable_InterframeSync hint + NVAPI_D3D_RR_FLAG_MULTI_FRAME = 0x00000004 //!< (bit 2) The flag hints the driver that content will be used for many frames. If not specified then the driver assumes that content is used only on the next frame +} NVAPI_D3D_RESOURCERENDERING_FLAG; + +//! \ingroup dx +NVAPI_INTERFACE NvAPI_D3D_BeginResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags); + +#endif //defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) +#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D_EndResourceRendering +// +//! DESCRIPTION: This function tells the driver that the resource is done receiving updates. It must be used in combination with +//! NvAPI_D3D_BeginResourceRendering(). +//! The primary use of this function is allow the driver to initiate early inter-frame syncs of resources while running in AFR SLI mode. +//! +//! SUPPORTED OS: Windows XP and higher +//! +//! +//! \since Release: 185 +//! +//! \param [in] pDev The ID3D10Device or IDirect3DDevice9 thatis a using the resource +//! \param [in] obj Previously obtained HV resource handle +//! \param [in] Flags Reserved, must be zero +// +//! \retval ::NVAPI_OK Function succeeded, if used properly and driver can initiate proper sync'ing of the resources. +//! \retval ::NVAPI_INVALID_ARGUMENT Bad argument(s) or invalid flag values +//! \retval ::NVAPI_INVALID_CALL Mismatched begin/end calls +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D_EndResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags); +#endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) + +#include"nvapi_lite_salend.h" +#ifdef __cplusplus +} +#endif +#pragma pack(pop) diff --git a/compat/nvapi/nvapi_lite_stereo.h b/compat/nvapi/nvapi_lite_stereo.h new file mode 100644 index 0000000..6b733f6 --- /dev/null +++ b/compat/nvapi/nvapi_lite_stereo.h @@ -0,0 +1,600 @@ + /************************************************************************************************************************************\ +|* *| +|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *| +|* *| +|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *| +|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *| +|* Otherwise, you have no rights to use or access this software in any manner. *| +|* *| +|* If not covered by the applicable NVIDIA software license agreement: *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *| +|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *| +|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *| +|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *| +|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *| +|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. *| +|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial computer software documentation" *| +|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the software with only those rights set forth herein. *| +|* *| +|* Any use of this software in individual and commercial software must include, *| +|* in the user documentation and internal comments to the code, *| +|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *| +|* *| + \************************************************************************************************************************************/ + +#pragma once +#include"nvapi_lite_salstart.h" +#include"nvapi_lite_common.h" +#pragma pack(push,8) +#ifdef __cplusplus +extern "C" { +#endif +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_Enable +// +//! DESCRIPTION: This APU enables stereo mode in the registry. +//! Calls to this function affect the entire system. +//! If stereo is not enabled, then calls to functions that require that stereo is enabled have no effect, +//! and will return the appropriate error code. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \retval ::NVAPI_OK Stereo is now enabled. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_Enable(void); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_Disable +// +//! DESCRIPTION: This API disables stereo mode in the registry. +//! Calls to this function affect the entire system. +//! If stereo is not enabled, then calls to functions that require that stereo is enabled have no effect, +//! and will return the appropriate error code. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \retval ::NVAPI_OK Stereo is now disabled. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_Disable(void); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_IsEnabled +// +//! DESCRIPTION: This API checks if stereo mode is enabled in the registry. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [out] pIsStereoEnabled Address where the result of the inquiry will be placed. +//! +//! \retval ::NVAPI_OK Check was sucessfully completed and result reflects current state of stereo availability. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_IsEnabled(NvU8 *pIsStereoEnabled); +#if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__) + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_CreateHandleFromIUnknown +// +//! DESCRIPTION: This API creates a stereo handle that is used in subsequent calls related to a given device interface. +//! This must be called before any other NvAPI_Stereo_ function for that handle. +//! Multiple devices can be used at one time using multiple calls to this function (one per each device). +//! +//! HOW TO USE: After the Direct3D device is created, create the stereo handle. +//! On call success: +//! -# Use all other NvAPI_Stereo_ functions that have stereo handle as first parameter. +//! -# After the device interface that corresponds to the the stereo handle is destroyed, +//! the application should call NvAPI_DestroyStereoHandle() for that stereo handle. +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] pDevice Pointer to IUnknown interface that is IDirect3DDevice9* in DX9, ID3D10Device*. +//! \param [out] pStereoHandle Pointer to the newly created stereo handle. +//! +//! \retval ::NVAPI_OK Stereo handle is created for given device interface. +//! \retval ::NVAPI_INVALID_ARGUMENT Provided device interface is invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_CreateHandleFromIUnknown(IUnknown *pDevice, StereoHandle *pStereoHandle); + +#endif // defined(_D3D9_H_) || defined(__d3d10_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_DestroyHandle +// +//! DESCRIPTION: This API destroys the stereo handle created with one of the NvAPI_Stereo_CreateHandleFrom() functions. +//! This should be called after the device corresponding to the handle has been destroyed. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle that is to be destroyed. +//! +//! \retval ::NVAPI_OK Stereo handle is destroyed. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_DestroyHandle(StereoHandle stereoHandle); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_Activate +// +//! DESCRIPTION: This API activates stereo for the device interface corresponding to the given stereo handle. +//! Activating stereo is possible only if stereo was enabled previously in the registry. +//! If stereo is not activated, then calls to functions that require that stereo is activated have no effect, +//! and will return the appropriate error code. +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle corresponding to the device interface. +//! +//! \retval ::NVAPI_OK Stereo is turned on. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_Activate(StereoHandle stereoHandle); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_Deactivate +// +//! DESCRIPTION: This API deactivates stereo for the given device interface. +//! If stereo is not activated, then calls to functions that require that stereo is activated have no effect, +//! and will return the appropriate error code. +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! +//! \retval ::NVAPI_OK Stereo is turned off. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_Deactivate(StereoHandle stereoHandle); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_IsActivated +// +//! DESCRIPTION: This API checks if stereo is activated for the given device interface. +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! \param [in] pIsStereoOn Address where result of the inquiry will be placed. +//! +//! \retval ::NVAPI_OK - Check was sucessfully completed and result reflects current state of stereo (on/off). +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE - Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized. +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED - Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR - Something is wrong (generic error). +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_IsActivated(StereoHandle stereoHandle, NvU8 *pIsStereoOn); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_GetSeparation +// +//! DESCRIPTION: This API gets current separation value (in percents). +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! \param [out] pSeparationPercentage Address of @c float type variable to store current separation percentage in. +//! +//! \retval ::NVAPI_OK Retrieval of separation percentage was successfull. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_GetSeparation(StereoHandle stereoHandle, float *pSeparationPercentage); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_SetSeparation +// +//! DESCRIPTION: This API sets separation to given percentage. +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! \param [in] newSeparationPercentage New value for separation percentage. +//! +//! \retval ::NVAPI_OK Setting of separation percentage was successfull. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized. +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_STEREO_PARAMETER_OUT_OF_RANGE Given separation percentage is out of [0..100] range. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_SetSeparation(StereoHandle stereoHandle, float newSeparationPercentage); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_GetConvergence +// +//! DESCRIPTION: This API gets the current convergence value. +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! \param [out] pConvergence Address of @c float type variable to store current convergence value in. +//! +//! \retval ::NVAPI_OK Retrieval of convergence value was successfull. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_GetConvergence(StereoHandle stereoHandle, float *pConvergence); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_SetConvergence +// +//! DESCRIPTION: This API sets convergence to the given value. +//! +//! WHEN TO USE: After the stereo handle for the device interface is created via successfull call to the appropriate NvAPI_Stereo_CreateHandleFrom() function. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \since Release: 180 +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! \param [in] newConvergence New value for convergence. +//! +//! \retval ::NVAPI_OK Setting of convergence value was successfull. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_SetConvergence(StereoHandle stereoHandle, float newConvergence); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_SetActiveEye +// +//! \fn NvAPI_Stereo_SetActiveEye(StereoHandle hStereoHandle, NV_STEREO_ACTIVE_EYE StereoEye); +//! DESCRIPTION: This API sets the back buffer to left or right in Direct stereo mode. +//! +//! HOW TO USE: After the stereo handle for device interface is created via successfull call to appropriate +//! NvAPI_Stereo_CreateHandleFrom function. +//! +//! \since Release: 285 +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! \param [in] StereoEye Defines active eye in Direct stereo mode +//! +//! \retval ::NVAPI_OK - Active eye is set. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE - Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED - NVAPI not initialized. +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED - Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_INVALID_ARGUMENT - StereoEye parameter has not allowed value. +//! \retval ::NVAPI_SET_NOT_ALLOWED - Current stereo mode is not Direct +//! \retval ::NVAPI_ERROR - Something is wrong (generic error). +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup stereoapi +typedef enum _NV_StereoActiveEye +{ + NVAPI_STEREO_EYE_RIGHT = 1, + NVAPI_STEREO_EYE_LEFT = 2, + NVAPI_STEREO_EYE_MONO = 3, +} NV_STEREO_ACTIVE_EYE; + +//! \ingroup stereoapi +NVAPI_INTERFACE NvAPI_Stereo_SetActiveEye(StereoHandle hStereoHandle, NV_STEREO_ACTIVE_EYE StereoEye); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_SetDriverMode +// +//! \fn NvAPI_Stereo_SetDriverMode( NV_STEREO_DRIVER_MODE mode ); +//! DESCRIPTION: This API sets the 3D stereo driver mode: Direct or Automatic +//! +//! HOW TO USE: This API must be called before the device is created. +//! Applies to DirectX 9 and higher. +//! +//! \since Release: 285 +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] mode Defines the 3D stereo driver mode: Direct or Automatic +//! +//! \retval ::NVAPI_OK Active eye is set. +//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized. +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_INVALID_ARGUMENT mode parameter has not allowed value. +//! \retval ::NVAPI_ERROR Something is wrong (generic error). +// +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup stereoapi +typedef enum _NV_StereoDriverMode +{ + NVAPI_STEREO_DRIVER_MODE_AUTOMATIC = 0, + NVAPI_STEREO_DRIVER_MODE_DIRECT = 2, +} NV_STEREO_DRIVER_MODE; + +//! \ingroup stereoapi +NVAPI_INTERFACE NvAPI_Stereo_SetDriverMode( NV_STEREO_DRIVER_MODE mode ); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_GetEyeSeparation +// +//! DESCRIPTION: This API returns eye separation as a ratio of /. +//! +//! HOW TO USE: After the stereo handle for device interface is created via successfull call to appropriate API. Applies only to DirectX 9 and up. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [in] stereoHandle Stereo handle that corresponds to the device interface. +//! \param [out] pSeparation Eye separation. +//! +//! \retval ::NVAPI_OK Active eye is set. +//! \retval ::NVAPI_STEREO_INVALID_DEVICE_INTERFACE Device interface is not valid. Create again, then attach again. +//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized. +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR (generic error). +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_GetEyeSeparation(StereoHandle hStereoHandle, float *pSeparation ); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_IsWindowedModeSupported +// +//! DESCRIPTION: This API returns availability of windowed mode stereo +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! \param [out] bSupported(OUT) != 0 - supported, \n +//! == 0 - is not supported +//! +//! +//! \retval ::NVAPI_OK Retrieval of frustum adjust mode was successfull. +//! \retval ::NVAPI_API_NOT_INTIALIZED NVAPI not initialized. +//! \retval ::NVAPI_STEREO_NOT_INITIALIZED Stereo part of NVAPI not initialized. +//! \retval ::NVAPI_ERROR Something is wrong (generic error). +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_IsWindowedModeSupported(NvU8* bSupported); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_SetSurfaceCreationMode +// +//! \function NvAPI_Stereo_SetSurfaceCreationMode(StereoHandle hStereoHandle, NVAPI_STEREO_SURFACECREATEMODE creationMode) +//! \param [in] hStereoHandle Stereo handle that corresponds to the device interface. +//! \param [in] creationMode New surface creation mode for this device interface. +//! +//! \since Release: 285 +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! DESCRIPTION: This API sets surface creation mode for this device interface. +//! +//! WHEN TO USE: After the stereo handle for device interface is created via successful call to appropriate NvAPI_Stereo_CreateHandleFrom function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! There are no return error codes with specific meaning for this API. +//! +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup stereoapi +typedef enum _NVAPI_STEREO_SURFACECREATEMODE +{ + NVAPI_STEREO_SURFACECREATEMODE_AUTO, //!< Use driver registry profile settings for surface creation mode. + NVAPI_STEREO_SURFACECREATEMODE_FORCESTEREO, //!< Always create stereo surfaces. + NVAPI_STEREO_SURFACECREATEMODE_FORCEMONO //!< Always create mono surfaces. +} NVAPI_STEREO_SURFACECREATEMODE; + +//! \ingroup stereoapi +NVAPI_INTERFACE NvAPI_Stereo_SetSurfaceCreationMode(__in StereoHandle hStereoHandle, __in NVAPI_STEREO_SURFACECREATEMODE creationMode); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_GetSurfaceCreationMode +// +//! \function NvAPI_Stereo_GetSurfaceCreationMode(StereoHandle hStereoHandle, NVAPI_STEREO_SURFACECREATEMODE* pCreationMode) +//! \param [in] hStereoHandle Stereo handle that corresponds to the device interface. +//! \param [out] pCreationMode The current creation mode for this device interface. +//! +//! \since Release: 295 +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! DESCRIPTION: This API gets surface creation mode for this device interface. +//! +//! WHEN TO USE: After the stereo handle for device interface is created via successful call to appropriate NvAPI_Stereo_CreateHandleFrom function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! There are no return error codes with specific meaning for this API. +//! +/////////////////////////////////////////////////////////////////////////////// + +//! \ingroup stereoapi +NVAPI_INTERFACE NvAPI_Stereo_GetSurfaceCreationMode(__in StereoHandle hStereoHandle, __in NVAPI_STEREO_SURFACECREATEMODE* pCreationMode); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_Debug_WasLastDrawStereoized +// +//! \param [in] hStereoHandle Stereo handle that corresponds to the device interface. +//! \param [out] pWasStereoized Address where result of the inquiry will be placed. +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! DESCRIPTION: This API checks if the last draw call was stereoized. It is a very expensive to call and should be used for debugging purpose *only*. +//! +//! WHEN TO USE: After the stereo handle for device interface is created via successful call to appropriate NvAPI_Stereo_CreateHandleFrom function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! There are no return error codes with specific meaning for this API. +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_Debug_WasLastDrawStereoized(__in StereoHandle hStereoHandle, __out NvU8 *pWasStereoized); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_SetDefaultProfile +// +//! +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! DESCRIPTION: This API defines the stereo profile used by the driver in case the application has no associated profile. +//! +//! WHEN TO USE: To take effect, this API must be called before D3D device is created. Calling once a device has been created will not affect the current device. +//! +//! \param [in] szProfileName Default profile name. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! Error codes specific to this API are described below. +//! +//! \retval NVAPI_SUCCESS - Default stereo profile name has been copied into szProfileName. +//! \retval NVAPI_INVALID_ARGUMENT - szProfileName == NULL. +//! \retval NVAPI_DEFAULT_STEREO_PROFILE_DOES_NOT_EXIST - Default stereo profile does not exist +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_SetDefaultProfile(__in const char* szProfileName); +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Stereo_GetDefaultProfile +// +//! SUPPORTED OS: Windows Vista and higher +//! +//! +//! DESCRIPTION: This API retrieves the current default stereo profile. +//! +//! After call cbSizeOut contain 0 if default profile is not set required buffer size cbSizeOut. +//! To get needed buffer size this function can be called with szProfileName==0 and cbSizeIn == 0. +//! +//! WHEN TO USE: This API can be called at any time. +//! +//! +//! \param [in] cbSizeIn Size of buffer allocated for default stereo profile name. +//! \param [out] szProfileName Default stereo profile name. +//! \param [out] pcbSizeOut Required buffer size. +//! # ==0 - there is no default stereo profile name currently set +//! # !=0 - size of buffer required for currently set default stereo profile name including trailing '0'. +//! +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! Error codes specific to this API are described below. +//! +//! \retval NVAPI_SUCCESS - Default stereo profile name has been copied into szProfileName. +//! \retval NVAPI_DEFAULT_STEREO_PROFILE_IS_NOT_DEFINED - There is no default stereo profile set at this time. +//! \retval NVAPI_INVALID_ARGUMENT - pcbSizeOut == 0 or cbSizeIn >= *pcbSizeOut && szProfileName == 0 +//! \retval NVAPI_INSUFFICIENT_BUFFER - cbSizeIn < *pcbSizeOut +//! +//! \ingroup stereoapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Stereo_GetDefaultProfile( __in NvU32 cbSizeIn, __out_bcount_part_opt(cbSizeIn, *pcbSizeOut) char* szProfileName, __out NvU32 *pcbSizeOut); + +#include"nvapi_lite_salend.h" +#ifdef __cplusplus +} +#endif +#pragma pack(pop) diff --git a/compat/nvapi/nvapi_lite_surround.h b/compat/nvapi/nvapi_lite_surround.h new file mode 100644 index 0000000..d7576d1 --- /dev/null +++ b/compat/nvapi/nvapi_lite_surround.h @@ -0,0 +1,105 @@ + /************************************************************************************************************************************\ +|* *| +|* Copyright © 2012 NVIDIA Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: *| +|* *| +|* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *| +|* *| +|* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *| +|* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *| +|* Otherwise, you have no rights to use or access this software in any manner. *| +|* *| +|* If not covered by the applicable NVIDIA software license agreement: *| +|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *| +|* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *| +|* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *| +|* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *| +|* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *| +|* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. *| +|* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial computer software documentation" *| +|* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *| +|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the software with only those rights set forth herein. *| +|* *| +|* Any use of this software in individual and commercial software must include, *| +|* in the user documentation and internal comments to the code, *| +|* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *| +|* *| + \************************************************************************************************************************************/ + +#pragma once +#include"nvapi_lite_salstart.h" +#include"nvapi_lite_common.h" +#pragma pack(push,8) +#ifdef __cplusplus +extern "C" { +#endif +//! SUPPORTED OS: Windows XP and higher +//! +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_GetGDIPrimaryDisplayId +// +//! DESCRIPTION: This API returns the Display ID of the GDI Primary. +//! +//! \param [out] displayId Display ID of the GDI Primary display. +//! +//! \retval ::NVAPI_OK: Capabilties have been returned. +//! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND: GDI Primary not on an NVIDIA GPU. +//! \retval ::NVAPI_INVALID_ARGUMENT: One or more args passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED: The NvAPI API needs to be initialized first +//! \retval ::NVAPI_NO_IMPLEMENTATION: This entrypoint not available +//! \retval ::NVAPI_ERROR: Miscellaneous error occurred +//! +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetGDIPrimaryDisplayId(NvU32* displayId); +#define NV_MOSAIC_MAX_DISPLAYS (64) +//! SUPPORTED OS: Windows Vista and higher +//! +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_Mosaic_GetDisplayViewportsByResolution +// +//! DESCRIPTION: This API returns the viewports that would be applied on +//! the requested display. +//! +//! \param [in] displayId Display ID of a single display in the active +//! mosaic topology to query. +//! \param [in] srcWidth Width of full display topology. If both +//! width and height are 0, the current +//! resolution is used. +//! \param [in] srcHeight Height of full display topology. If both +//! width and height are 0, the current +//! resolution is used. +//! \param [out] viewports Array of NV_RECT viewports which represent +//! the displays as identified in +//! NvAPI_Mosaic_EnumGridTopologies. If the +//! requested resolution is a single-wide +//! resolution, only viewports[0] will +//! contain the viewport details, regardless +//! of which display is driving the display. +//! \param [out] bezelCorrected Returns 1 if the requested resolution is +//! bezel corrected. May be NULL. +//! +//! \retval ::NVAPI_OK Capabilties have been returned. +//! \retval ::NVAPI_INVALID_ARGUMENT One or more args passed in are invalid. +//! \retval ::NVAPI_API_NOT_INTIALIZED The NvAPI API needs to be initialized first +//! \retval ::NVAPI_MOSAIC_NOT_ACTIVE The display does not belong to an active Mosaic Topology +//! \retval ::NVAPI_NO_IMPLEMENTATION This entrypoint not available +//! \retval ::NVAPI_ERROR Miscellaneous error occurred +//! +//! \ingroup mosaicapi +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_Mosaic_GetDisplayViewportsByResolution(NvU32 displayId, NvU32 srcWidth, NvU32 srcHeight, NV_RECT viewports[NV_MOSAIC_MAX_DISPLAYS], NvU8* bezelCorrected); + +#include"nvapi_lite_salend.h" +#ifdef __cplusplus +} +#endif +#pragma pack(pop) diff --git a/compat/nvapi/x86/nvapi.lib b/compat/nvapi/x86/nvapi.lib new file mode 100644 index 0000000000000000000000000000000000000000..38d85961c9d53cffae293c648cefd4a46c74e2e1 GIT binary patch literal 201190 zcmeEv349yH+5Rea6els*5QhW^;D7@mK(J#cIezt z2snWTk#Zm9C<#a5E0h)}cMAbS0_DEL(UulyxeMhkhyTwzGrQWAw7ZJG^2_)8{XNNy zXJ?*y=AC!Wot@QAUFeT=_AVNCbg|ZyRm?7*J9lpR+&S9tQgK;UUU5tX^Pf0Qk}N%v z)N|GUzxI{sk~CsRbTHBeM%uvty*5x;>2uh8rB!xYt*grAbvm84mRKa%*Haw{udZ3* zcFw9SvDZJ;wA3%J(WQ*j=**W2iFrxl>u=JM9p)Ya8GAZfrK3wR^p&OkJ3 zk1mM@A}QsswpH7!U3K*iyREFUVpe6v+=|l5in6lu*%kBfx02jBsr=Q>>c%Q>9cdzs zKSl5wTb;dev8%ybtq9%{UlERU1^XZwN|A#1*s7~*-Ofgjo9U!F*w;n633dlNfp_<{ z#KMt)RvwSdyLhqJURPhslSBdmRT4+IFBVvH_OD@-*5UjkS$c^`0t% zH1-GjfN-tV>b=ocBqbHbM@o(0=lFyN}-mt(dn*V>_9K2h!%2s$zg?NMPtq`Nm^%v8r>e3qmGfX%4GUlL(G11 zm=1#E+eKziOqC}25VyY}j`ODgYi=vqFnG;qnD_PE!>5ZkT(N^0~=WeWV zR5SU(TTQ9FN>WDBqg=8Qu~D5hd?plYB&xCr4oahF-&JFCyQ>yA)Yq%D&)OZ!ua&@z zk!i4*E?H?RXOXvooHlaYa4zPpJxzDAE}42-h?~_G zD>R!HSfN=fj#DgCE^9PAXO=0eZx+a+nG;lGaJy`^b&Yi%XEkrp#xkTRf|Z^XocU@< z22q#ul73cYTxZFGuv9fR$;T%|hdhLRyVq3*Lje-qA48UmE<<>` zvihvHHCB78UG;Shw!Ss~{-BR7?%Y^7M7sT*tY^sGp%k-5U0sdcTkG)%aDSj*A76$E z3thOr%H^qL!xZb4tjDpgnH*s&*;r&aVKv(78l0}`x+*?mC#e_<>&qumuS)jiUC6_U z)m1R&hy-I;YK2f+)Q)Vn#krIR+j4CsRP$5MUM}?Zk5eezQotu>hU?6-K}ni-Q#O!OY3}fX_a9+J|zWeDZ=ET1YWzZPJ;;bbA9&o$F;4TXW>PfjQF%(p@Zjo;q~MV z^x?jshZWz~05N&7*2GqXSeSQCP3=;MFPax0uARYXf5^X%#x5VDoxF!$@`TGqcU2C<`La4x+ zU}r!-#@^S}a+1H_(d!TPWkOZ^qqrXouMWf_>sosKxOdGCGzG%$f*GZnPU<8AXF5Dc4viUHnI{f{ZQh2N76)%^ZjWpV*mO#uI=#TYQ zp;LB6TLaM)0T8b)TT3Xc0nGC8`mTxi`+I|(QE#w65DNC;CO$=fvwZ0}v3ov^sA~mX z#girDy`@YU~q7t--+F&1sdAe~=0@K>WJl#Y9GKT5&8^xnMx06hc_fLju% z(<+tPV70e}x*C>=;j~^(@p5sgl_;d{7O&5VWn3)az%nzuI(2xZc-qC#kA*7i(P+3c zh-TN79H$%B1iONML6_1hh!n|0BvjKKOxBGy(%n_HPT*(@O(QobYMgFwB)A&OX#sL4 zM^Yh;~i$?xr#*5iw#cstJWx_(Pc?4e`~Pih{%< zI75aRY6N%@>h7YYS8559@f1S{Ri8sK=$;{y>eS(sitgmp%@4y9?Eu?DA!nf5j}?tZ z@gi1~L?ALG*8(yWkNRRJ@zmk1;Z)&}!mI`W(a|$vM2?EUe7dh~2Wd2%TmfPj@HyBh zlrmjV1XW)(o?Zk}<`P#Q^#UPYeK_h5cD9E5!P2u%&W}Sl-5%_U^`=y(XtZA30VHoq1c`H9pMQ0*lgCA=0+LgXfVdnEr~r$HIDcA} zp_Tw~MIzxy<|xt>sxiHCT~4<%Mb_$gD5M?>g$($Up=xXT<9LdPo{9~D6rNhA!z)(r zJo}V*cXLx}NGKG?!b3B~i`?r2tHY6X84AGbID=%U6n7U^wRr9ph@^G`FSf<-R1?(| z#hy`Glb5?J8-=Rk-QBpI#64w-xT3~pm1Yhn-n5!*iu=1F;f(rd>Gb!7<1t5gb$>XD zsx)pFAW5yy%tWFp z)sgZRBJWISfh#ifLVC~;MGJvyt8wd%Ig6=E&65s+RB>hZiQNYJ>|HBy7eRM~STp;T zshdaAT*{+p_bJ&jD2x`47zXL~Qt27#2;R4h0HER^MRb`xbveOhV#UmKTg9VML=&l~ zYDA`KOEQ!xc~>bWZC(wk$yJRpSg~lhG&s$8t}O8~uc5#q zr@YiHG6|uWnn*Y~c!?0!%1b!d{2Y@|SZRRmk%y(vS60BIRiy(>A= z2_)9`;Bw*~CxcW<2keh$=1^*gR~gl0NOg~xtRx!1Wc48w54IwKXfLhvsr{f0E1d$d z>OLhdlYNSB&idFEr)mu)f-!f{bh)@c(BodM8X2|G-oDJSSfpapQoZ~ax8Hn|G_nqd zvy@V>O=7WOCbn#8<6=qQsy^JHq`;g3Kiy`g3+xQ6i1+x~{ZS7dr_iGgE-9A4%CI41 zmlx5H4=U@y-Dpy0ToxJ866nW~M0IynDA=y-E)|gPwq;TZ+xki?C)<0|-nGlQ^Bszm z6nv~p2}GaLFD4>IuNAeEp4hbxv%iiKki44CKVU16EstmvNM|rg&dVc4whT%6V-WV# z1Vd&9es>?gAJQ+QjL;Q><_^&ZRKv2+v^y$ykJLuwj&gmchqq&w5l_MC*?jurIKj(y zrg1ofHMc5ke4_yBM-T#rKFjhCpc+!tgQ#qq5{K$EbwnDr0g7h>Wd`jd&a43d(hwHs zNT~|7%dBKEb*l#i;^~z^Gr+EXPY=!=q}L;V!Y%8r&E1H{XE;5o4xr_`(;xHWInio= za^@v0i(=1hm9>r>%+9%lGNhp%*WyrTKq2(FDCGeMF;SG}35y7<@vmO(PvM}=0o854 zK=K<8)jbJ?yRpi{UL+lmplYMrbBtoD=T#ik9Pgu}w(5N7;H>(Z-AAO(MwA-$l2S|x zNh=Ei)5=0sntCV2DCtCmI&^a~u_AbBOH0zi-bH&?Dqa;bX z3hy^fe+BP1S@5ot&c9IzCu{Ui8!umtLb{QEBO3VMYQU)F>BS}A`51XOzP2OR_ z%Q8RW(Q)>&XW7VmGQ0IXnaYs^{POEHBM10ZNBl<)@GCd!{4{vV>Hg$CG>>MxJ9vmN za)5v20Ka?!7_X0v9N-^0z&~<;f8+qaa*Sf+0KYss;yCxn0e+P-@GNEI06!k*uoFJ1 zXXM2Z{gDIwBM10L4)BXZxp-R1kNEQgLdqjvooJ&2_cBxRc)t7`GnFifFyb3Iz|UVQ zhW0WX(jGa$A00WsAH|QmWM~^B2l(X|Zqy?Xj$Di!;2$}_uQUnu;e2soHuaP&EvJ=N z$2AA@wPzCbaVZDC4PSx;i;!dF0Ka@9T~%Ak`C+^YN(YEX4)BYk?d*gee?dRf@pV-+ z9fVVsc*!&K`Um5aO>*P_zvhHLCKI`7YESq>W0@mVDa2{{kpukfm%2s{@U!15qhE=^ zX4c37e$^3OaW)!#3iqixhqq~n;=ji*a)6)S2^l%Suln7Naz-Pxm4UJfz)^3A+*`HMIwj`M}% zv7`B$UD2bv@VjE6FkXB;dhOgfN8?v?Q-5Q3W_ZO)$uJ3it#FkOuO2ewxTEEd?a1HU zk-y1PCQHEomX(&ynS<~2%$i#{rl%$jK)(V-KUG$rd_~ANX zX5#NHd&^hi@3=zXXw6m9BF8)k&ub|-n^age6Tj8!mqGZO2m6Z&ssMOxQt7stE22?# z=z1ZKCQPzzn@QgWPz5fBe`^X~aiRA_Az!r&Ere$XxPl@cLiDym$d|(BLioM{!;zAt z$G04~J`=t(K(ZE?Zv<{MuJ!nim?%jLV9Dso7eky2n0r+?J-$I;UQppOmA4Xne+FjC zK9sA3cZ~GqD+R_TaC-7NkbW^Rn^ibH`7Q(IMinlTe3QU;o4~-!j2_=(!0j~Q+ZPOf z2j*K9PLFRiGM`8S!045iq7Q;IM}^blvjO8(;WCwX2l$Q$X6j_h74-tE$2Sj!aZ`a{ z^yFKJh!$YZ+mGX@A27a%wqsHkI(mPOkzHG1scmKo?odQlWq~90_GZHIaYNHDPXq4f z0;^Y!XTWzkFg>IY7%Ob1a!_->PGAT}hLs~jzV`t4n851gOVQ86`B;V1tB~7}?F#Kd2u~$^y3+a5J*REyw~#-N%z9t|tpz0r<|$0=Fk{7i58>;q01BxD5UB zZs2wZtWi674j3y9NH9k2pahr-fz#v5$(5uXBN18;2zHcNA>nnmbkaFz|r*bX_mP0M**xdnflQN#7|4Z zrR$m6)&Hd7puY_3x`%+X(t;MoXx!Zom>B}6*IuR|q5>E%H58b9SiN!bF<^EIoF3nN zr2jiGQ)mE&F>25AfmtkYdVKBRXa(kGfkX4wmG1>$-ZJ5P3+X=s=GiiMU=__s0(9M$hnGvQL|_iZTRBH&J<2^NN?n@sXiy0~4Lg zaeLyAUV9z_rhq0&7(G50;`Rk*xxg8f_bgy8HR1aLd|QCIggOe0B45h-l=7LnfI$=| zQ~eTdS|(hE`aK-Dc>=3fURvikfY~B&M)mOkFi)HCT?W3Lz=Rj_VvNBbz52Klm`4Rp zPrhrB{uy9?axCY=2YEC0kBJC>NnkiqfBpPEaQ_ily?kE-N$w&^`U@->y?Ud3S5`8J z;;?$lP#>oQcb>rN<@*p=egVw!HcqFPFNOa@U^r60yq^P?Yv(Avd^aI_Phc(+I6Xa6 zzTXNAXVlMkY!&(vEE&Cg??c=n!2DU@_P}+f@vji!J_j6?(bIDnxYGqzFW=L_vk90y zCnwY^FXbB&7&&Xbd`|)HT!EGIJsO`;vM=$pdfZj>501x!T{A<$6$cmV1dl=%r%Pj5 zMr$4OJK`ND(a(AI4=oiDPxYWw6vp({cusV zgMH7YBigm9gZAV)#5P`svW?e)Z9IT7ZsX0BCKS>-V~n(iG)@|w&)uo@!OloH8t#r2 zPj5cFxUoNmU+p^?hp&t2w|4LlCc-P33f`VLr6j+6+s2{z*n8TgG3$K~=SvAsNnTqb zR#LRtEp;dM>E8H!thjsAUIPz}8rVK+;9r*b`vdQdT7J*TfOqcz38eu+9zt2*awU|s zvz)1jmK&5Gw*O$quso3M<86sgV+SQ#OY*u0=1Z}?1|A+Y@SY|9Zzjuf;(c5QMi;;p zLYUkmKHW5nuF23WKqg1jMLGOqq$O?bJxfA3V|- z&%ty!X(a*WgjMSU4tmDs-7YuVgYBAt^ru+6gJ@%UFqJgh0l#%;0c_QccW&u?C5 zX*p-#frl&`UI*xzO{mY zU}G69r+gdFad0xo>R{&XU}?l}S1X0)kORlHn@Ax*Yy7 zl9#ukfv<;R<8Jb*l92FiuvSFMn*#ORp;veeOSxeCF5?RXe=5&BlYGbSYRxJg43`vPm8Qcbgq4jX)Pb$i9Jri?`dl#!qub+yn9l>3 z7Tdhv9l(4`;qJ$LG(J)7Sfy^b#mu(~F6C{N*1+AL`A$>92H>NI{atbg9?AP^Cq&t1Y2V~5DNGZ9dVUnv%4(O!UaLe( z-UZe^mbZrs?yRFDy9g4uoUQ6m!JJj|w(!K}e#(mMEIXG~CR! ziJIt3RNE5Hxp|4gge`ZorzF2=$&zMo@8?t?`hhPQ7+Z#wM1GUp>Nak}{9UwZRLn`N zo_TqjTTAkry$MUgox8-_lp+28e*~p8FlZUrk-q>!o*5V#8uBF`Jz?2#gFF*)K|3F( z!19q`9rO9%PGvr-XI?kgC}EGl$LpqS=B%0c!1+x6ee;=RGw02u;RN?Gu#~?=8pAZV z7Je*Tptxfp#_4PF*dhhX5Hz*C_Yld3Dq7y~35Es`GBgp8IRkc#L<_5Yw(8o97V2%| z4R_yuhy9J1$mwn5j!@-usUwOn(;*(`DblKS0Hqm3=6&?0yin>3AiFNN+{$q_;nRhNK$xZt>o!yrlwWH7{*^)yl*hsV3 zN;Zy3tVS^cZ`^hr0wq3`@U=-V1$c*EN$f!$cGbi{2%;IB2Q`Zz_GhaS{NGK-$Yt?2 z?58TrhCS35bX%psKEpVmT>JwUOgfq_UscCEslIp+7b_)>IhQu0w#FlK400IsOG*+Ag=~=b0_+hD zX6MG&l?*q4YTyqg*W-^Ao6On-%1f7PZ5y zCzj+heaRBELV{LE;NlWA1FV)HkJEoJnlz7bmUV%lmoWz7MsSS0*g&_!NH}(-+`dUU z2pA))mhRq`o$(0ulR_WK(#nz=j#b(M_b}$W5iVbC-U1)T-3A|7 zE92*3590b(7WODyzAAkRJ|6o#d^fY$op4K-@2_wVVZOKFa@>3H-NeHFt%Q9A-wiD6 zd$=Fa9A2gOR zl&U`3104JI3QI&E38cjM1`|Hqh%YU*(3kIcR3s2kMd4gFdwxMd>{q1)Qn2zLn(mY$ z(mJUh_xI(}EZk3ZK|iD+GW6J*>S2_Gvsf_K!v0sLDt>u}3bs6Z7E8s~kSVU@R!znvY-%92JQ@NMa0Pa}yJb;Om8zHesWS1~CAfh^ocX z$d%_EdYMJyV(_7NrwqJV(0%MUY5&Iu{`SqlL&tRIJk*UO6%;pFj(dLK@81kOjJSs> zZVts2$#L3rb1AM+j?<=_PjUHjoHpG;ip!JZwCNU6T&^6KOn1%;B#mw0?*-k7ht*}E zF&yP+rs(RSm&>;;__|=@YP8pRqe&|T8_rbxT$A1GhSEZRW=Nwb*^%&0&fET-ox-ME zx`F;2_^B`?F77Kd}_uizXubRFdrcYB$l-=&M>A|W=5 zg<^_lC|1dGNQT7%11S^nPBaVU;tBP|1Idf{jLgfE*xpJ$&u(ICkPobUErQ*)=LzRm4AulSl$O?#9dhVwtH;|-Ta4= zE%@`<%@Dvt0(hF}K7p15$i1X_^9Ht_@U}I9wPHP>_#2|0!r8F}hdFlnV_*v!8&qEg}xa8rn*qVJWhWnjkbErTYgYaU?%$KK2Hp!N6 zn}=JVf=l?q4=pBd0Gb#za7sxY8rVO67#d;)A9{JEkmw$8Nm$^&bHX44#s4bmG5)fc zr+wHcr06{W`~a5UdvM>rN?0*`B({~!EPFE_-4Afwe8uNfd~W#u3CnkT-ex`@m5ljT z!B@aWZ!&zGWttK@ONp(7kMB^q;d_atXn>DPwN#1q!AG;Z73)lS zCyQpf{aM)a@X^}OD!l_A&&`n|%hC!T>99x&!}lcf{SrPd-}Ufu-QNx$*ZmXlJ;C^1 zf{)fPR_P-p_A4c92KM)6KnpEW5OZ#ytZ3~#$Y>{+l6_G z{?VObi_|DpORZA7WXGPm3!A15SedycC#)S@4zNWqzmZFM1mWugss^)M7`u&rHrw$j zm`<+OEO9$$fir~Mv@;?;4a25P`ZNsu^o|DmFiJaJ(RT?D;aW>_bU}VU@(iXhjALb{ zQoC5`NT&I?qP0Gry+D(m+z4p^d#kjBm9!Y;biwCF`Q0cd#ke7P z1JKpDa!Ve>J8?CY{Y&Ov4aul{r1jPK%Vj9VI;S+{A8DA~uAhM(j13R|gorjIc5(mW z5D@YGi-qtd_b*(yA|pQ<`WSvJF%s0ku#G|c7cXGDq;SC($-V#iY*W9&Z0~;pgNY4~ z7ihm@*`T%OrqaBAkS`pKZz0@4+gwimzUcTr5dSGZMK7M8K&;#Acz5nEX^1{Rh` z@e)-nh>4|LT@B0PqmJVbhmISZ1QM(+*9uJeFGK zSQgt1AD>7`Y1C@@jWPF~ifcZ_Y*Ktz!N+gn9)ypN7LUMZWqeP-N8?11^s?fkHs4Z< z8>Q-Ss4Ech`eVKA7&Ch@y3zfNb|fG8uxJTwI^fyaJhpnFB^PWyT2djkMEotHn>qZQ zOj5=>@rbS%)&e`KjjOtuYgzfT@(`xF9c)oeJ!Qw}T%@%U&*(h32$H%t%`U=U-lN5X z3U&43q1^c8Y;AIoL5aA`1;WJ8frjHXgu>~oWCZ{*2+=M>Yb#5 z4HqG}y-gtL?tz-HxSj|vT4lUY44MqJ^3V?s!ZY;KzUzohV*vv@EbUxv9~7|wuDrx2 zXrSn;vw57ChQu}=HSkCw>Bojb6~!mY1NWe%{L6uFa|+I#i}}d6OxfbWIFr|eTR5ys z=|NKwTQ$;+pH-@YyFYYTgc(uxc@^Jr@Nt|^@dXuMRPmjr_%^_|ANZ`&`S4AEwX!uA z_uYx>eOWB6xp*V~0zRrmtF$Lv+6BRC6)umRtAy1mz6SWHomi#g;I3wQ(CrBA^jW1a zxy-i?F7FEK;p4Gq!IuMDBwYfRcdf1P6|%6q;BvmF6d&ztc(E1XV?%!duJI^CJbA_-^a?%IKvgP_=;yKdx7=)+-kZVld$)jm=oMP@ z5Aw#qwglt(y<3wJsO7>l{ze<~82dz%z!PNZW_+}s4j&CXMbc8ZBx4bd=*SZsJnR7p z{iRRbkSS*6(0L}YD_ihHWVWX8l;ucs*{AuLL2@l;pFRjYBlj z#rD*sQc0X_59N@Cw+HIee2H`^e0+&SJEXjg+zlU}<^K%dwXj9ff8g>~m5XY7jD=CZ z=L@5$@bTEA72mP&@uiek!6BLC#})o#5i_3kof){`j{)=OjMA6!Jyyz3yr}sz9nuy) zTOt-wqxUw+eIh^cwOm=)rye9eF2;WF*wC!`YJZ0aZ}8hQx_qPii1nCwvTn@^EOwJY-i77{UE;+e!l54|@k@$F|fBpw_1 zTh3?KcMmK$I6kJAvio2(`@>fiXjy0!L-7e>4Tb{0#P`-w#b2=!V-DFz#P)7M`XoSJ zKGLdrZ+UlM`3Y>Aq$YxASc=Z#Pr-6iCh@m;f;r&yg11YaX7+kutltXc@b-H&1;NS0NnR; z_-d45(}I@Fcqy0FMKvq7rYyEeEHs~#PY8p;748X!xd3`bV)Q2p|w39I_Yn|Xe%C2;0}=; z##FbJ$*FB+ingsR+|{8&t8_NpeVOlkxU}QU7o5COeyPM}s1!RQ@%jdHsZw}L zZUsfAN|};cDaG1KIdXSY%5+pk302Azs+1{EeKR%l|AOw1fLgfj`CY75_dJ$#Kbhf3 z_q0u%s(T*W(i;ecTx;<|3$XxK`a{5z86%Y5!IZ8UK1yhe#PCt{BMu+Mq%=}r5vi{T zg9KAw#$lgE30~}S__$KEqXdtoQDPD-A0>L2QnaH4k5wy$4-cD=ip&@>JajRoV0e(v zE3paXW!#)&GKufmy9LCaJOFNAL&SgUj;+%VJeweayye~S{U*0F1?9pU^;0sWPq+lH8yWgTNJ zK}W*!u^JP1T`%*w25ag>Bc`&NA~stw^~K&+l%YS9ZIcz6ab&%=olQ$Q5NI~s^vIEFJ1I{tnh9Mc zL+BwR86Kj3qnQS`91GPInR6cc3noJWmZk~MXsH-s>fgbkdxjhfNruds8O=71)XZZL zo?~%|_!*Ydk4iEx5X@uJn5iUM<}qo^V;SZQxFr3uf1kQ7DMyQ79t&n_ostxkiv#~C z$#+s`G=$HKb3^4KbE*cTF6lVLYULT5CeL_=p>9UnICc;FjY)Z~5X|G5JZfgDMJ@CA zH0C`RrV=jETy))?*twuQ$lN2C_ef*j6R}$6J<^!zQFo5T0hjn5o;wX4Q)YffFc&ap zUoh$q_4oP#gCUKnOF?Zwn^!?vUVAajBuWl*);E19x}4WLBCowzUTWsOfz>kamBu`Q zVQAeqs7mY94ye6gPMcT`; zECfB(Wmiqp$;rGDf_Y!1Tvsc3v6i5EXPRy)b1YONWVVhQcM)lsn;S(c!tk&c6dpO` zJxz%E*Mjy(svOIqg6sGP|GiUABT3(hRD?mxRLMh{%dwEQ$-JLa`BgI292y8=2%~M! z2OvbNv3=7tb|Ay>0~I(#aq8KFNsV<2<^vUtohCw%C`H197!S28GOd^X_T!|4=ZjQ? z(Mnj15Uqpk*cUvt${ElI6@Aeg5yW<*P)2_y{9{~%3>dL*Hi zqt)27wA>G4m{M|KFFWYE>yx?97R-mGm5bH^TIR#jnCXTq$3pvSMALK7hO3gyje_}b zrCdF_rI?YH*Wqb-(MmeUGMil3)%zcVVp-rLvtBSCkyZ*?-)Kv5L>ezH^R9MHp==>T5X`ny<;6x2$MwGSweND&8N}qaSMn z7Fr3AdGE?KZzof|B~lTF=btx*!I-1XeGbBMEHsahiCqxCSWY8J#Ud49kV^IY3dbNs z+oFz2Yf*CuUtq40Kc&+Vu{xpwXlsR+Z@ke#dh1+tjRu9|liGM;J?`{8e|Iy=d83@vYA2%}9! z8w$K!6#t7FZ%;DS?IIOnw5b-cR7I2o=68SJ|D|NA*F-A9Xj9R8GRH#ePcqvcd1@$` zY8oxBVF;s5WkX1g(xPrT?vv@sRJ9@%VYI32npB&vpt_N@8WO1pqfJ%CQqgLG%s;>Q zX>Bsq1tJw;w5c2j$+5_(UhMeeKa#0F5UB{GP32^%Hozrw=i^t|lBt?#`42-FF7-|k zLZMn77ebOf<@Kt4FO<_@gb=9+gH)kc#`N&!MuW%g3`xD2>G>nbs|Ko!xd?Hbur9kaA`?$_+x`uM#+-> zTrhVjd2P|nE0C5~S6W`(40A19n!Zlov&){$>t4a!&GJ&Of3R>tDJH@tV?F=aPm_9n zPNX7?w(PwK(U!eCO`agbyatzOp5A_bC83}LkL zP}|eW6HJpQ#4r!RrOdzCF##(^3w&f8f;p5X&uYXb*HNComA#pir&XjPj8>jLmP*|Y zLuvA$JArukLlvJ`jaVF0+sLZ#*(HrPog*Qrq z(O6_1J}u9_0}_iz0*&~{P9)eB047ry`{aVXZ=ENM*FxEcX2MbYa!3?jcVBl{^7VK3 zr9K}^53{G?@EwDclpK@sv;jdgL5I`-6fZ{ViK2Px_m-Tui)NtA5*72~@vvD--Cvb*n^Ye)Cq2R=s_z&V|2$ z%gVt-7sW_9$1X7dt2zSkSCt&${&ns6wK<%-v6U&Io=d$cncL@Zu3 z_6Pf-MBWnU_ecClm<+bBh=xNr7s2yxiTNY3D1BVm(d!3_q;joAYsbg$xLkCKAA$B5 z+RF;0i?-V;B$9R&1*1#U1p4rkIGxP_f0wG)iK50U^xuf0y|EMJOwLlkO=#N3VwXdx7Ic&btDyPj;<85%(JF9H` zw|6RMtA4eovczt;$>b=J#~+QkB9U;!Rw{=w{ZqckP>?!mY#y)I)!?bBvB^LC1KN;3 z8m*jNP8oCsDrbwI{;8ZjtJEf^M1ned<6>8Xw^|WL^;WejaYmZ5qF##i@y69d<4NDn%+ZFvdY*il5;yS0(Zc7`1xLRaQI&ChOqtW5<)Y<5z ze5gS6{=XKAM&)U2bUR$toK!VZr2;*6kT!Tl?yAvC3-s8kt83lPMvt3io_Rz|P2yd= z*lVw=ujNTHj&hnLUbGdbyRLRIPmvt>G^j>feVx-$)zDDI3kR7Ql7o^>fDRbiyYR7? zXjEyBWmRrlz1!ufbJclll%SKG2s!J>=_e;fPB}TV$f>L#w~L&R;*bYDv~Nv@%0;Ei z)2&kB3`W1XfEl&g9}Hni7EPec1(6(Xufw_6!9=Poanuog+TYm}+Col{oE~!e$nlfI zq>hu16(>NxN|q!{-ZkW~Ko-rMpgaJSxoT`~ch%yC`g%K)f#uRjNvg?dC8wPnHV!nC z&qYq#A~jold7MIXSR5X(@?}E30zZ z9M#S$cTGK46O)cr2rE@q^(DGey{*>MSnF-5w%b(e26b+wjkX#OhQq}!LL}eTO~E)C zYa6TTJyirsE-uudvZ^{8WOjR8jyk4UrV`eeSdFl%W37(W=`NIlm_0Rhja3a*i+Q_Y z!)RKoky{gM3arvt1u!RBAC)X;UR4_T-7Z^gU1OccS?$WAb*8it)-YI`V7?k+7J1A| z`n}}k%_-T$S*jXk667CncG4G}cq5@{omVI8(~XYW+FCmov6T4MlEZviIF&+mtWPIr zA2m=aeE1AR6OEV$v|tPge4tPU1bJE1Qp;aDr0IdJaYUiYtGzY$#dfc# zTh`C0NOFHDt*Wvu_EgtbyK7vwltmw_1sO={X>_{l7dtQo69enpz2svZCpo5N)%dWu zN%=k-=2o12!Rk&~-jtPj8XYx_4Um?y;bMz{Su7D~VJKH$qph}~&fQq!sFqt88+2H+ zNH$Y8+_6j6XI2v{D=4cwHb$!oP~u=5nyg)G`~7`guD&(FNVsoxpfAR28Y@Iv1S?C2 z>UbzbH9@m0qUOj^yaM6McSSrB0a#UF726f0!M)xeUBwbp6(b3fLO4jO7Wo6fB zYrw*)!BK~4O_fUYO(;kmN_8j~*lw$H)gV82ttKHL88f6`jYuZ-xV_#+Cnh#6yU2Ci z(X+K5-BZ32IJ;P5@^m`73cExrY#&cL_$Zn)JV-98%I5HRXy_rR>6?R*&8N7Unc8<@`pPEWog5%B{sGyIH>{nVQt z-&NSwzlFB;Vf6SON8DY&oZiV`?B{m$_%>tf{%YF3htcDE0C6`06QF{_jD^+Xdk~ms z1Wu3dUZj5&mn!x-@$f-U`W+SZ3L;yacwK?XDA zJ06&o0%yb*1Lhdo(1#fdtEayUfY~Z=dVEwLHv7d=3L zF_P~ZV16rbdVJLW?gi!)di(%m#P>2V{}4DMzE6O;gC13w@a=(z4hPVK2N*p*YA=TY zLr-4F7|BJy4(W46(Bfg&ibB4ef@g;z9(*p|=zUzRwL*VrIs6PG( z%zAp<0b?ZJYrwoOaC&^Czt4fWeJ!Ii@wKnVn_*`#m|=Sf19Q5->G9EcwF#J}GtK#K z2IhW&)8nK1eH56V4Vd%&9hiR$oE{(5?{~o5x51pRXd~WAf+b_bHxrl-1USV-uh+nx%eg-EEyxdE?^Gc%yCA1rvP)V!0GWl z1)58N>HN7l-yeZ_O5pVPsJyQLbIEz;eE$MwNZ^e4#-5Mg;({e(RNko(}@(Tv#%Cd{kZ^FbChvV20!ADZrd7a7KKW0(0Cg=6rVmGbnI+e5Ajp zfJywuobMfAz7RMgz9C@#c&jgn1ZL`O9B0J$ zQ(zJTrzaoP?VBI6Xe9k0*gS=MHnew}JUw;Pm)Nz8`>j==bJ)``?NA z9F~j`-)vyM7C0mQHQ$AOU|1tQDsKpw8FzD>5#I)2E*3aF`5pt!FM;X4$DD5)FwY8{ z9v{i~8ZejNYtHv?U`E}?ae90tUp_D|3Y<}SXWlPKi(ttZ@znxT_y>+N;#&#K$pWXx zN9|<;Fg1TP=i3U*Z33sqNBX-Tn04fVF_P~EVBQiqBfgJ-x%okJzR}yT&j3qCkB_SL zplx_h36_kJe6t>sq$*f4MtmM%MnBAPMtnYC!UAW+w+@(DR536{eCGmlmB8uok$Qgx zOxGif&XDf`V4fB@Bfg!$T>7Xv-zS9G&T&S3c{7dSmW>fS#9^U(9=eEYwE`5cyv5#MZJ zz7{wm{WZUc`5e}aF9gidFL9g^-zH#wA#i%~k^Zg&#{aT8-~GTmA#g@~F9CDWE9QJ3 z0rS1U>G4s0jM*tke}W}rRNj(T@#|HvWc2u`yo-SOPT-9A+Frvt2bPQ;AIaAbO!?~! zW+>lgV6GN8BfcAfS^0)J-y^`hC~!u6e*tFepUwHc1!nwTIL?S~A}~7z&Pac={)+h= zmW&=BjRziJiryrYasBqaDM_cnlF{R%`u*9PctiYegfiya0?h9OPLGe|yAPN%|IX+P z>-P;{J`^}3zAu4!;4O2$$!}wS9F~k8AGN<(z{Ns{(`_9_74U# zEbke>Tp)0IeD{LpN?=<5Y0h^mFb@cv9v{i~7%*qOYtHv3FrNsV9v|uNKfwI)J#)TE z??W%JWc2t*zA|9`C2&Ud;r;;k)39WW_&R}^`XR>|@%{MthPWxfye)7>jz-;==obN4QJ`*@SKGNU!z&!f7Ip0BF zU>yNVMvsr=n+MEy0%ueoZC_%(ge9ZLNByH8n3-QOm|=bV44BIWPLGf3_gY|reATZ|+ne+Vvm@frR zkB{0jX?Kum*tk9puvny{V0ntn=WQQA+cIvjOviz!~u^&9g|outt2;e6w%+>UrC>SI8z5-?peHsu(kB{Wr3z!!L&WLa3 z-WF*QtQlV|FyrYfS1?9=0bt?+rzaovx6^?+w#c0CGGJ~LI3vE>fC*1D=X)HOR|QUw zkCwx40rT`e=6us9S){qJWc2uG*-{0}F_X>tE&yh$!0GW(f4do&D1Ge=#;87?0_M*G zr^iR_<)6U(dOvf%Tzt>12$qZFO%7 z7HJ-=8J`1~?*z_>uWhD9>V`Gr>j&oWqdCrqZvdE!1WvEK)Sj;fW+nSZg>n0P1eg~E zPLGf3<1fHmR%R~Wr@&Zdahx6>$u}ODodRc6-dW`qsS1{i5uXQ`eJeQ5h%XAvfWYbT zQF%85Q$5?9ZwoNL6F5CS>c95^bLt#(zE^V^jx*xR2j)?MGpdh+>MYXHutxPk_eb-9v3ShoTL#Q3fzy+Z`bQj? z@_KW=&A?nOaC&@HA2$MXVuLx~eZc%l;Pm)tynhjx%Nou3J_W|&yZvq*Qrk})c8VY@{th9zUfHv^d01KY$Rsa(bI6e7Df2RO5|9Er0i-Eab;Eecg1tzr2oNqfYFAJO=AC>n_ zV1ChI&i5HGIVW(O5#JubY!^7A`Y2v*kxF6781c;q<}-ma;;Z*rq!VC`_^3X5fSGn8 z#~JaR4$OH1rzaor{Q{VFzd7G+z&s>yMtn~IvuTAn-&??ZCUAOuRKMQ?b62N1UtyO; zDuyLv#5V(&w*<~ef5!$aQa!8@AL*|hn2Fuy@`ZspUEuWOBfd?*)byD1Z3X5wfz#t7 z{oM~ttk<0HX<+^$a7KLZ0<$$}&i5@a<5zN=9v_u=A}}uqoKbxowF>*xuw;z*YJeFX z;y5EdA24BoGvZqZ%rUFY`7QuvtH2rY-3&~y&zx@%m=^?2kB{p2&%j(7Hs||2Wz zH88y~bH0axd0yc3_^3YK0OpdoIp4p484@@>K9Xcz`>hqg%sAa# zz74=!EO2`A5#KL?>0WQnw+)zQ1x}BT^!FMt7oB0w_YpAP3!D+(m@_TXHdr!7`rB^+ zdVwWl#8&~#M*?TWSF-`@CRj5*KQQ}kG?y<1%m#telaKnx&w=rrWzP32VD1t)Bff3G zoOZT3-%eoO6*xUUYR~@$=FXp)^A&8eNC&|h>5s~LI57VdIHUTopJS1lV9ofJ0kdzy zT)rqU0|G~Az5Suhz|@^<&UXVacM6;yAL;KwV9wlZ&i4i|9}1ii-l|1kJ{s>M zz|6nQT)vBexnAJ(Ba&x|yfO$vY^!P}=e*ts%FUnL^jCW&=3iJNJ~saXGvg|A`8EJ^vB2rcNBa9EFsrUM=X(^Gmjq6akH*u#0(12* z&H26pX3RAlr^iS7+Y6W%1jCCu=8S$M6OuxVx@tq9J+-uGG zE(GRUfz#uo^4`G5%voE{&^w+@(NZZhY)0GO=;r^iS7yBV0S|1sx#0GOu* z&WLX(Fce3<;bO-*LaeJ_D=~ zAJs<`n6g{VVu9>0Wii3-Ff=3~@HB1M16WcMr zBi?ZmzS0xz_jd+58rtk$cZ;*GBYILtBoON8>5u!mB5OJ#<#WoI<0~!g=!yi_;8(yq z`sjN{9nr2;9lmfp*3lm9>k6L~?dS@u353G^fk?;NxpM#t1^ZU{dIEhj!z)(Kl_nI@ z#~R1rH*&{Gqw~2twLaJx2}i@-vEu2?hZi^Y$AYVaC*uQ6#g6dme*Bbu1iw*uEK^~8 z?_T;lG?Coxqsg@lQi%#-t?Y|g`!OF~AIN+Uq=P(Qzy_zaDrbZyrm= z8Nm}<*naN>2wuMJL8ANYW*?`K$p*f*#P>~jghWkRiOx(-yL_++B&D!c_LIR!G2g*( z_hr7hiqEb1+7#c3@J)iXO5I9WSP6^4M-^k0&W5`e^PLZur??b89{Vf!j%2aFfy*WM zJ$#c{*dSbL^ew;VhoPaN69$*Gam?3* z8H!DA6O~K}xi_)HxBP^`O%*Jc9l7iewMq?J`L+|XZvO`%F>lh-;H!kSvg)PIWR(`d zC2N&ja2GJ&Vz^YzMbc8ZJneG$j)ApGeQ-%{Mbc?-=diE=xE!|$K8~a6VJ->BWMiLbHf&~^RyM%erbS3D@dkrN zm5W9-c3_8P6D!gHbqmR&ZWf8{%d>732O=@A2^!jXtC#^F4R2Pd3@)!RY6ni(B8gfB z5A(vuac%H%mJaxMeZqs9)EY{Q+9`j1?g12$X*{3DV#MHHuz_AWFbZ$n7CS&xKpKeUx|Ish z?%l-Xkn>>UFB^SXA|9#des;53z;}tyM`H5Od%k0mP#d7eV`X2+<~kqYSKnyOY}srEP@)gG^Tsy$w}T}tdq_&8rbe7tT?hmSKS6x;<0 z?lJ}UYxp?d?-U&MSkCtc1-BhOEto%=bN9UfvuG3|xZo@bP^2f{&MDANURdwn&<)#Ntvq5?9=CPa`f&+ifmD+ecFZ zOTmV7@kegA>zSXTsofGFz1>o*C04+ijog}+4Q{1iO&b&Kio!P?kaT$x7O8GjJU8B` zDBu55qvG@L|F%)_Du_ZXUXdrm$C=l|$E$uLe7wS`p>Z5FG+w!v!N)82YWO(cweay2 zH^Ij{$F1;{z*?o>!{v?O0mTQ8^f)=p@Ct8*e~dKnVP4DqtU_5YU&+T{8iBVJY`hSV zt(0Wrw)m046PwU`ZthVbwy@i{?K+B$7aqAexBJf%4a+nxt>TzPS_%e z)^EHk9RVNj!ZszW7CxThc=#s4TBY;h@=kT95(|$+`lF@yDE5IAyfzQNiN-bq!dkRe zV>eWe=1XB{j9T0Ve;7T!*wOMIW( zR9V!vw^HlSDl0hig=6IAMX|$CmdruQnu6vv8I1`|tVyM|e5STmv@tZuw&tc@In9rv zwo6bDuD1K&OR8-USERNap|(!=P1+b!8+9hF+U|O#eXOiDiXD#HWR6`?o1A91s;xIm zwb5XyRa@^b@3G2iquAl7P3G7YwaICAtJ+qZtBuV8G@oeI_T2SN-^gmC*x{&6<{-6Y zF$c)-A4Ox?&H<4uHAb_%R%5^U^`VE$8l%|ZXiVnFQe!fFw`%O9EHySIO=G=xd^1MY z7{v}pV=_mU8k6C>Rb!`^YwRjOwid(Dwy~4{HF~bBF^V0I#$*oCSTUx~DVQH8H&Yk& zHmR2#g{jL9IpL3@yDLx{K7Z1^XLA003|BON=8F0A4ERmvPo_IsD{FPP&m|unEbES9 zhod{0W0!R&C)};NJIh>mZ0#{UO?RgSPX4{DJBl5S?qm+qUA9X$In9rvwrrPdv?4ZX za!hSUrm1c3gD$*PRvX0*M{P34uBc5;vs=|hGp>o+*xI8sO>GBVc*{Go+9-B7YLhug zZCR{6WcZJwv252K)F89bSVfw~#*Dw{Ras*cI~us=`B#OkF^V0I#$=9N8O-D~KZ@G2odd2n zR~sA5Y-wuqe>B-EtBqoZqc)i%%Z4Vye-w>nJDB|s%9>5rbf#(Snf?hM%NnED;b=_e z$Wmi6e79#Y%uerX>8Viu2WWK z6gwP^$sD^fn8|5=6t!hLnB8NpHa3`f)6{nM%27MyhDNc&QJc(>WkZwUKZ?e(9nAii zrN&y*H1_kxC8x?7quAkSOy`0cSVx-1#{Ol!vc*lY!_k<`k)_6D_-@tMlja(`3XrWQ!qM&pUHkf4Np52lI~H{o2)j99gf;$j$KikoMyMG?Q?UrvHrO}O>Hke{J65|NU_6Fo6M1A z|CHfBipH{?HNQbwO&S{0*oHKXUGwvgpOzaM#STYfGDnsgli|BnV?UT{jE*dB{aKpE z`tJJcQL@G;b~qZ7IY?tAc&J{Chw4-4q52drJz{UtoPI1yeX=g6{!tW2JO2F1`Xlfq zpR7NHD|)g%T0B{&W5(GuxpR?5dpC94tqXA6oSiAXj$((SK$#=UCMUyx6pdxuN%OMQ z81ZQ}R&w@j`^y@m*x_hQ=EzcGGJLmcY>zB8c5#}<-nr*ZMPn2@9F55wS!zs%?^ccN zou$SuPt#bz>~S;XHb$|-(U{DUrN(6VZq?YNEHy@3L)u-}`Tn+Ze?TM`JQamKu}cyH#UHWT~-R(lmDQVYz*>#wd0; z8k0G))R+w4tr{!MQe(eM)7X}2ZsoZq#STYfGDnsgli|BnW3#i=*zeOccH3a>vvM1w z*x_hQ=EzcGGJLmcY<`v+yC+R!IUjsmEo+Qohodo>BTJ3R@ZGAh$}BbZhct~j@5()1 z))>VOM`JQamKu}cyH#V(EH$<*O=C6xnWb!JQ|xdwCUaz|F&VyFHRjGzW3&UJUGpE} zdP#XJfMSQEF_|MvjmhxcsGf>kYYAQtWUvCUaz|F&VyFHP<F}C;r zWSYj>MlIYRYm8!tqcNF-G?w)v6Or$aqPA=wnJhI|8{5f#Hcf34_Wn97tBqoZqc)i% z%Z4Vye-w?Kk23I$*gN4%Zp5a(hJHep8hbHKV_#l>>V>k#D0Vm+lR2`~m<->o8e5U2 z#&)J@?4#%Za-ys;iXD!|WR5H~Cc}5D#(K;(#s;%D(lpjKu1i^BQ0)IJ?rh*>D%(H4 zi%?0DB&1cFRBT>0Ny@I>#j@7g^_EB0*c}XGXPcc}l*&^oO7cijNysCWB)zFrQY1-| zN|GY=sE|tiRjU7e-E&`a&zawH?m3^&`ONv$+CA5Gf6slsbHAN4Z%&LcBd)Cu(J1Of8#4_1C#Sn&%ydM%-O$((Fm~2$BZ}D=MV%O9 zhM_S|PpC2RN%=<4mK+6RzwA7B6C0zb6JyLUG{)%(HAbI{Z}R-oF)+6D_VXflvMK7s z7&8owae6|H(I?^C7?ZOmeafcw4p7R0w6)yEDC)!*Gsu|f)j5}OMVslYNgsf3qfHL~ zwLsf1b043;+9>Ko8#4?W8mGHr%yjstkG!`rCL0>PILO-2KD+X_=4_0jPK+@lo`%L{ zT+wFQ&>l0?Ru8l-861i{|4UIP+L#fKHZGG;ZQ?`e?OL1cpAA4;r~S<%mroRRqKz4b z{gcyOF=pC7>7(jx`saKxFD_~X#`-Z8DuQ3H-&LQSKOJtDQuO!JK5Tr zfV*cd9}u}$OHn88m|@u3INcRvrmgKIdtVS@>cky0;&#Uc6YB0wdv|gbk_zrh{`Kfsc1KYs?wCRDOqaV{ z#uaU*tB?)$+T;M&8nhk$cF$hcMo}l)m|-};ak?wUOb59442{vpjavt}q#n22!p11- z#27OSjd6NHjcv6zCO<`*Uae*|)_&*3OW7Djofu;V89VW(NOPtuvP?fk`eQ>`=^)E{ zU$ci;7Db)NVurme&P=GRorbbHgRDCj4XDAgDC$HOGwfw?WMY1?0m zv@D7`k;M$dfs4~!F=jf{?=v)(0meqm-krkDi=s}9F~iUprzh0dcZSBY!PtUHzn8Ev ziaIgI3`1j_o={_l42|^yW9k1{cR3rQs1sw%Ff_*L2{rbMp|LzLwyNeykFzm~Ix)r! zLt~ttP-908jTL~glkR>z@?ubmIx)r!Lt~ttP-A}?8XEw{W_>y>@-eCubz+PehQ>HO zp~h;6cTU^fWt5BjAzALj{dt>q*Y$+J)uzYqq zHbzk=#+X6I;=1F{1zmAxdJnd-y*t_3#(=w<@4G+pk>eC~;*J@Ht&P)NF=pD@n%f(b zcV7KqZ1gYvHgIdBs1sw%AY-O?Ub&1b+Dz}fwlvgM4%&u(d*&akjiOGpF(V#rTqdE~ zS{Z5!fws5G_C)UUQ`CtzX2he7%Oq6WrS{t7ur?92b$e!Xn{W(Z*#Gs;$Ugo4j_P2imGyPs?R(6m_DF8Kf<) zYj-Z_iaXP5_aXM~}Z2BWF zf5OHn>cki`;%;qR&=q&4t!<>CyCvZ6$SG?+XLl5J;*J?{yW@fhbvN4Hom{~!19xk0 z`EwMzqo@;i%piBB_l&rVE80v~aDIDja)4V7+Gbs!6Zv{4iaOE848sAA(_JxUI>23T zZ%jTdwGxcAzw40}+|VfM#27Qk*omK(;!Ia$nLaI5WiLxMujfJ5(alet!LlgoL>4m) zn-{0MV$8I8-Dq!2j$^CA*zTh8`r==# zjiOGpF~hK-ak?wUOdHzmhQ`){v2#05k1TB|>cki`42^MmLXF*JZ)_>O?dfeWcKG(W z^SF&s)QK@>kg?X{1MgGC$KR*W$KR*W$KR*)mwy)Y|L2pt4=)n6NV@IqCh{}z2c*^$ zp}K<#`;TFSD;AfCV}?I^>0R-g{^+G`;x8dCskZtI{Cn*!QvDZg1dHuk4|td@Qq+k> zW{}1BzeIpbyCTr^O9bZF3zSz_n?YdyoDK(AAVr-BWCjV0>w2CGy5i3C3hP08cXIKz z72NrkHjR9+1Vx>=V+Of9@#2j$U6EzFcw1mEYZ3L-?I7!;jpHMqUr13WvY6qlr*dgm z1e*5L$Ls~lwcHL6IQ^mf`*KgEs1t$AAc3aWq+G@oZKi9vW%kV$#EH1w3#-!RrcEC<-qd=5-j1O`qQ9V>U)nC&rjz z-@G`}6|=Xli|ERUZj4yppWb=R$Q(9C zQ76WjLB`_0$HApt5omhlw9{UoT*lS{fnR*NJo4gFiaHU<3=(L1<-}!N(Pp}g{nB2W z9NX%Gwz183H|BOnQ777%Vc1hS-4$b|W7|GMWAv6GYfruV=o@#lF^W1d#tcJaoSsl) z-`N|JSLY4DSpR>{h+NLR=SXlQPhbsW{|NH-_PJoS7e!9aMq}4_SWoF zkoDx*m%hrfDC$HOGwfw?W@7Y;m!tFsHS289{mQl-xdl?x ziA83R#Wv!l3a!P<5mM=e3#s(Ng;aXsg8H+6VbrS^n#)%&pNhZ4d5aICs3m@i9D9{=1(yygOE-Rhj8#(9iArXWO4AEdF5`+e z(-mAZdu{TDNN3PC6TbW6Ur##_0()mTqtC4Kd*^$^&By zKWZF#%PmEn7-I$*>nfHZoy967ofakOv?xiZMac>NEG&pxsI-Y)s4&|Vy|2+CMEqYn zX|MRH7b-u9zl4jVQ`JJ{N_)NZI?Y7|p!b^v_eCzzDC$HnGe~c?5Sk%;b|t-CNpDxu zYxJjOMVKBdnvdd&=y!yjuxR?iGA;U7@fV3cO^Lq7UbMWt8vvqf-SEr}-18~wL^Lx< zbX=ErT+kJFrk8hF_U`1WW(c^;*f}Qha!iUkamNgDXS$l^GOlPdUDfom*CwauVW92N zS7*)SCPz^x+L%Gw45nvJcg2|L^xW6b*a$FoS4!Pi*ce5f7-NQ^F-}jYu|j)e@_uM3 z7+co$WiK0}s1sw%AY&)KAIh1o$TGbjI@nOw7?3sivBr_xR1|e0iy8K^I5VNLhS|%K zqn96KeZIdc@@cyibs~!yhJBIKT`^`ldU@=P$!W42j6Ku(p2+*cDeA-+Gsu|fG|6RL z(PlbLjxy910&Va1TOWD0m7-3xF(V#rTqdE~#@TC=_uMCfw)vBvx}HaViaOE84ASQC zo;xF4v1oeFz1-fSyyH0;EWVy~T_Ibfs1u9KAdB(e@#NC32sFLpS!pP63J4rDZC&Jh z;3?`vATyi^f!}rO_%gRZiaHU4pbWpQRgWz92`H6LUx*mq+x%c7_gS8_#r6W_puYqJZhgDP3>HXHCjyya-`Y6S6ZK-pba zg1|HO9K3`DQq+k+X4rRE&U8hVX?K0mUY5M-d>&*4pFFsVWl_|LEM|}_(|eU%#uaU* zSDmlgYm+y{SA({iXTEzbYon+WZOkBT22bg6x+}&^Z;G$AHzpg}8ZegG>rmufsT6f$ zj2ZDXG%n+cHq(Z--d>w*Xlp^+72BFcE;uRbL>n^<8ycs(V$8ImZ89|WHW>S9pT9nL zO^P}(#tcJaoSsl)9~c_j2*w`kbcki`42^MmLXGV6TbW6Ur##_0()cF@q+ zS75C6)gSj~V-$5_j2VW;I6a}pel|3=4~%`d?15HnjG|7AF~iUprzh0d{}~$F55}Ho zbbb#uMo}lmm|j=ntY|sApxkFOai7aN=%i_$0$~x6h)=`l4 z$$uA*V_6h+B8wUJvN$uLvKrXSlJ7=22D17-aX7MMrKl5G%ph5Dy&HuKy5i3C-6&_- zyOX!ZlEma-eVhE?fs-TOAwf|m?wCRD4DP{lx+}&^Z;dszHzuDMsRhRNrr&=DcTI{q zF~$u0uF09M$TA)D&$E{$Z&=p_S^F;g^m~>?Q75vPL9$Gr8R0UnXfwTGooc9!J}Si8 zEB7xuFY?|BiaOE8jCizhnS^S)*j}6LnhikPf!S5Bb8Dlh6K%|}@0y(HiY(KvnPw=f z5y(nkeRkxX0u*&3iy8K^I5VNLI@-&U<5&}r)$7rWRBl-mbs~!y@pMQo~`@+>_zn1DAtibCujZz+|VfM z#27Q`M&9Zl`*lj3;fka?#F>TPe!finrr&=4toTc;&c!C|h^@P!q*Rb}X}$GnEQz8{ zBr)Uok~kxwl6u-pl9OR;khJIMz3D88qD~|+!+w0{Ojl%?PKJ5*vgAP324wZk@?Xrd zDC$HOGYkhRPItwa=|I)r&{#V#cI1kim$Na7Ix)r!Lt~ttP-BDajmZv49};67+SA*g z)rE~w)QK@>*mp?IbVZhFhy0hJtj-{7%+re^-yT9yC$gAfFN-r1Dr zkEf=n6Isl#m&KV0mF2aUC5QS9kkxL@%JaAzQq+koW*81!obHM-)1iK>p|NZ*mfrHb z$TvGs)QK@>7#idBgc=JN8tVnd9(%O*Fm7WMbz+PehQ>HOp~gb?#^mIf2gZhE*V@U( zDC)!*Gwg>j&U8hV>Et-cP*wrRI&fgwyDW>MPGm8|UKVF2RMyS*vgCL_0A!_~ys|gT zqNo#D%rNYWobHM-)A9Z`Lt{h0Sf3X@xtfhp)QK@>7#idBgc_S>Z%mF}!@$_tU*DO> z#whB<7&GiUBxkxJ%XIX*$57S?koEeLH$`5PNl_=Vm|-uAGZQLnw!JJldX<8#tcP#= zmRlA@oycN_VPE8QSB#mCUJn==8w17`-?BIIY5}a{axhk7!rAYzF^W1d#tcJaoSsl)OYM!x88QUMw)y?1u`!A| zF~$rscH)=Hai%M>OlQca3}sCOSuZ?zbL0!!DC$HOGwfw?Wg?9*(@YkfKhEF@uc7|5+AX+7*GOpDyr< zy+GOIrh>quPaKN8?w6uY1Tw?0$#J?X#!Q>s8}`QJ@IMWV9XR#g;oM0n>cki`>_;@t zbVZiw@c*{GEZMwffUJw!d$+JGiaL?S48!Kd>8=x%81>oau@z)8@6sUY2ZLb3oQB$9Db7vMB0A7BdW+7pJ>o%(QuZWN2(280+-TPo3Bp zMV%O9hM_S|PpGjShQ{WDvGt9!53(_eIx)r!Lt~ttP-9=%8fy0rH_MoT} zW6ZE0!Z_0vS*AnSUVB;c<(NxA*1DGYBe{7|)QK!+kSx=em2(+aw3)sf^MCf*Dcz0p{(aY*3l0>i#!ufQ75vPVK0j_6DsRZ zLs_dq*0|TMi+tB1MV-iEhP^D#OsK4+lg!?(yar@7x_M3Hdt52%L>4pbWpQRgWu0U% zOI{_d1zFSgAB=oD5k;NIVg|`Fc8=6JyLUG{)%(HP*t=*mf}X=s!1l*ce5f7-NQ^ zF-}jYu?y^t$-!&~82cpfe#96>ofuBs-~zDZOkBT1{VXI?us$f6-QTlV{$e)0LFGd(KCx18bzHL zV@5m;jmx;A&2%=%G}Lw&v@N>*`}M4iqE56iBOYyBCZXDT7-~BL+BWp@wP9@(b)tY57xIsuNw8uAr?qcCjyxfcjM!NuDCO8 zd_(Qs$=S6QxT~@4rorrvqE6f~BcAb&%ebP=bapMa*Cv}>UC`F~wl^wR8%3RHV@BLf zjtjct&a}yu+PjnET|IEO^U8KB*d0ZkxMPO1@s3NoBG7ca^VtiO*AVn+me%pEw-krHuFJA0>O>YZ;u*rYj4Rqqhp_(|YRdp^|6O!xO>ne;?c%s5~}S< zdu?*$&jxMR_IP{&w>FA8(Z&qYW^hf;>8=S;#?nUl{9gG{yh%xa|C5w7x=vP? zVU@!s1cKu#$~`6CVflkH3v!FH`wXj?Ff8cx4;x)xSzH>d8W!x>slEJB+^*fQ(x9)( z8>|>sR^=)84XY>}H>@~N85%a&S5_LBP%*63Tjli!%Dus16FYYjNq%41xZ=^?vb2)& za&>I}C!-`VzC6uWdQ!a+N&krY)J)14<@JQp+OO++Q^Cu{$1R?7dcOh#~(M^xm^5^IWn9gevT0T)1L6h z8Fv=Hk!$>E@O_-Nc?ImOTLy z6WNm%@=gqecO=o-)J&%G^xOKpwKpauspO>l)GxJ?Qq*}p!y%DdBS~59A^xD3APY_d z@sm?($$inssx5Qq9;=SzL?5d*9ILL(*(`pZ zA^v}cV-|lR4CS8;Sp)ulyh2t!-SY$PFSk%8q+1 zY9rQTHGpF^lsPoa&^aGGx@5aP)=i4sP#!C~U&z*O=@$)wOs;Asw-FEHh2po)XZ*8X zlkZjJMnI<4Wvz1~Ak&Ag*Gzs_{A?!vpYlwzEt>p@A~y!|*+6a#WI4Vhzb-PVKaAUc zQl=(vQsgE;J_pE6fZSB(ysXGw?_GVJCht+?ra-3iv)X71WI0MEzop2PlPiAGdEs)y)nO0D`J^%Fg*Q+)88%0h7@?}6y19Cf= z!>w-8!QDMIxi&2j#MTbT?ZsYePiY5aG0lh^Ccj?4EIgrzV+)3u}BiL@{H7{v$fg*PT@)bbt1mw<^I`>R}tG6Zx6}dBzuLN>u zAa}8lbGJ+p%i3hIkG4k?xeJi55>e|T*agS}6!i!`+~K)3n*5p~cLnm*K<*0UYh(_4 zes)Pkl#M-#d<~Gh0r?srXUH6GbtRwvd7rLxZCa>`Ed$7zVz1Rk29UeU940?A{IokX zxuqg^2XYpWy8}7fLe6aY->)^fiy~(OIS0tuK<;57?@9`aC2g|UN87cE+ylrxMbv7e z2atQo93Dk0-k$xgCf}&Yy?`tR#29ifAd99Ta=2}rUDUctlOIv!-azgHxTa= z05Yw>t&d;jiaZL)qk%jM$YU(zR-?TOHMx@_j{&j| z$YX#!)fB5WkG$m zauCQBKn?;qWFg;j)dlZp^3RGK0&*pgLqHZ&b(H5?$&=GGxydOaD7GpfPY`>po~wX7 zQReU?IQGdQXKM1*iaZg>lYl%C$TwKXHNN}h-J00eLczZo^J;76q&=Gcl>_slbXCjk*5Ip z-$0%M&ebwfxj^peFs+V(2)R3P6jqE;JIfh?Bz zB8NQ}y!FpFntYO2OVf4-kna?Gt>im^JWb}X=eL%v5sN0S^971L4an1hJPpWqS;$vC z^^XGf#&b1!nj+5v@_&Fl3&^uA5EJQv9GWDd8D3op3y zNlpG;k>>$f3;{9Zc|d;1Qs=F;&pJz!8`l#-u{{Ljhs9p2=ZAniU*>R~>-;uZ3{lC1 z6Wf)FJRiu9h^Uo3AIJ-24wHjJgraZ+nT&nk(UBlT+GCHUJB%87V?@qI!CRMYMmy6Vp|5}C&XTB+gJu<(J@30 zw~bxtf!}nU(-iqhAU_4axE|XT`FS9}0OaR^{G!a^NAT3jPdaGwkBa;vkY57w zi$Gp&A(wC3B`VByu3ujS#kLyAWY5~3R|8pGN{Jk<^QY(Ba=Ip8p~$ZQ`Bfml0^~Io z^5R-e#lXaM_9*fiAioCWH9)4?>Nt z7RYY`c`cCFS;#f|75=Ho-zxGtAk#QweFWD5Sqz#YhkHt&!iU8YGFj}St$}znX?q*U z>&0Fx`E4L?kU32LG<&Q#2`0BvV0KtwNLab;R_})dV!HTefc-VWrCfxI2apIFHC{;GGeCfB8D zL~Ne``BSmiYU2|i?~plcqtk|Yvo*P;BJTk5XF%QonoBy3Q-9n!Hev zzXI|eAb$m9vHXf^&pS4D8Lr8%De_(*e+}flK;9>Fc#JxflqN16lEpsSzEI?SKo&PI zVp`okAb%@!xNY40_4Z#h`AVqj~h@jZ^1Nl3#*V}sp){Es3Z1@iAeJ__VNWDd=SV!@kqcgxf>HMwa+u}f@!09h;tV{H5Z zWU)vRIif*G@?Q(C6Vq3+_=~nH75NyD{}NGaA3O%+zhw^h!B+wg+^)%k6!~u;{{!T| zflL+DtJCGTzZXTWP~@cK6nfQb_*La%&Jo9!rD(tszl68slf=K#uYax~bJ)hVNA?DE z_I-+6BRQ5_6Ua4yTubI~dw#Uxt_)3nQ;}-{`6M9M0&;Dc!=Cf^JU&8`zf|PfK&}Ji z+CZ*rsdKYH{jHi@L$pBJ>L$n9I2p)wfqaV0;Xc^x36JQMVwc=nD)K2nJ{8EP0J)yb z;j!*mr>PS(IYW`_0r@l_*8_5WnZtFiv+mo4np~>L^?^*U{kQg%`ao`AsdM@reL8CL zR7Gw8Pyw(-Kvb)wqFJBr*0$Y%k$5s({O z$f@toPtkSWr^tNtXcmQXpRf01aypPZ$sDfp|2_Da zP|oBHirfjvR{*&akULw*pSM_amnQF5JEUV0n4*d@1YMZP9Eb`+&|7FyRE z*8n*~=KLy1MBe$Y2S#i1a7E4lawd>7fZSc?aPLmtQNOoc_W*KFAol=rFAKT%rZ+?z7Q5tjSdn`H zITy&ifZSW=@W_ABAGztZHMikuJRen8F#a)Hd@wz0JF3(Yinv?3P(xj&E#fLv%H*X$JfTa)inaEGoDe?dy4+Qc6AP!tOYyho7-0eLWx2LXAAh1~s- zi^R<*u}f}snuPxyk{mlCT?^zPKprY{_z@iXe4pu>+)j~)0{LG+9tz}P7V@EW=ZUA1 z#4foFQsiMkz7EL4fIQqn&Yy8z)E(DyMIH|1VjvF(@(7v3y?fD$^r*Rex+0GNvIoc` zfIQMduKnhUE!xJ@iaZj?B|sht20eTX!6I3Tnc0_kV}C)%0jNa@~Zus{EH%w z0`h1ej{@=-nZrHh>&r{qYI6N^lH@i9$UY#C0rFT&oqxSxRMeGbJ4GG~gFvnTauCQNnZvVH+w`@Wn!HDmLqM(satO#(GKcH@ za+{uaX!0>dt^)D|AXfo-qRinsSB~4?LX+z?O_JM0AWs7FL?GW_A)mbZdr?oZOK#^X z@(n<~5y&?Hd9sE4=R5h&YVu`@JQ>J00eLczZ?=%1-S+lXn%qZ`ZwB%$K)xBsQ!M1~ z($g|Dd4wWQ0rJ0rJO#+NTF8&y-|+)Yu2ke(fqWZ~Zw2yH3;C?uCSRb*cPjE!Am0w; zsX)HNLcU@4m2)-uK}Eg;$aezy4j@mnko$cbIHbu>EAliTPY3ceAm3#n|FHJ3Pm|wN zYVv1_JOjx00C@(GXIjXeroXdNlYdg=nLxf5$TNXFOXj?s z6ds?8e(-;($#uk9nzmWVvFp130C^UWXIsd9zPvYTjnrI`X9M{@AkPN!91HpJ3l50^ zRqT>mTScA&4*563EMC z4!4b@i&G0U`9(!u4&A=MvEl5 zy$$5`KzTcbJ+8> ze;v%x-UH4Nd-3k+%Z*Lm+Pj@-~^nZR3&8PJUREk0|msAb$kpZ9v{`Avd|;)2L_C z&pIzjZrg$UF_5+(6Fa8`5{H#1>`S)ybH*? zEp^_QRWHi(i;BD($X^0^H;})w)VapNonPuYf2_z~0eKIQzXI}JOPxD@c=$F={!@|n z0{Lqo?*;Nc3%PwOx-%&LlUqtk_}_iWu`8KxWT^%s%(?r3{H@I4_MD$K|1X`LqsZR^ z`F}wE7RdW$4!4cZUvFAVlLLypAIRSUc|VZ9mpObjv326sD>V6DMgAVhKLGiAARmx9 ze098W=AaFl{EQ+W0P;Z~9{}e|Pdg zO&+Jne*pPUApZg6V={+(O7~X_Dl~bzA|C_tUqC(vz^&;U9T5x(&XKWTm#58 zfm{Q~wPX%^{_3$ChG}y0`C%)yfP4~=YXP~og?x&?$1j@POp$8?xekzP1G%n+Ts7mp zotk{PBG(1-$w00P4p1(|!rz&!NAk!y#TVIbn#^Gv zw_jQ1*W^+~P6P5~Ku!a4J4>B!ui6@AV}>HP19E#Hw*ztqnZusH{3#>q+0vzo+yTfP zf!qPe=@#rvv$NAg2SllgxQbv@Pm`FFbcs7ft>`kvjqT3Ltj^a%T(q z|Mt(kPLt~hGqiOE@|8gD4CF2{hg;oUk!U)gAxQ=Bge;iO)D5=N z!j%q#se}jwWu>V=L1u9uONPHZT)f;{-oMftoRnJ@@&-qFO5~Yz$}A9Ns?8T)(PNXJ z7bqDg>N&8ua6n#hR$=ad+^o#J;-Z|a0lEG1<$00+EbBv(k#TM2kRd~pii>^Y%ZrQk zBNUsLp42VdYY)iw`n@4la@hM91%z2~rDU9u!KT?<^|r+b?@yUQTgt zHi=K_)~z@zqqtr7+>AbbdS({%%FD|LKMr8GTWV%z2A^e5Z>S&`D9J1p-#JuKk56Ry&7B`@3Yk!>DD#ty7UT>anWY80wl#$L=%JX`vs?k4Z)F+qHLk2fr} zm#3`MFS>&RwMBlfx16Mg`1(Rw2fUKO8fwD3&dwNT4!bN$xHW}*Vb4z0nA&!0ASnS~k`$A*#e5Ew`=`IjH zyGW|8$_cW=L)w5z<*}Gdu~ew?R&y?*!9{l>&WDXkX z3se+(t9&%7R2S=))AvN-6OBiiJqt2v5U32so_tniFeuJlBotQjAcuoOP)>GWLRm#9 z==F>r>?;k8iK!oVl^#K%w|nKNQQlyYSopE_$>R;(84Fbl%&5feIq8aoMUz{i&GXbeA zkFEly$hAv!ifE<1vaqcWmHLR@trn$YvBe5F2*no+`wIWDQgFeh6RvqYUkUd6DR z!!s)?0wq3?UwVQ=XXh3b(5gu%>nfa}n5Bdz&oXUzLzG$>;EQXSb zK%|9;#Oij7gAeNN_mqv3D+b-5gnV&vEUsO~&Z?0-B(fO1tuJ1+#4AX|dEAy|Wb0~H=$33aMS6$b>$1JP|lr%_;FEfb;{(GX2go_lf;Y_@K;7J z6m>mRc2CjQB9DTK@^bS8Dbxa0n6A5G2~lCo0ixxG4@MsR;=)KHM2l&)^NwdaWd+ z2Mig>@_RkO!U24iVjtDC-^j5dH9XPw2vk?8V(|cQU3>Y;B7;5wx{Jz|aj;O_S@lNW z<)Dn5veFa9uMCeA@`S9jy{z*fF@*)FF$iB?%OE1c?b{ctC4p>uQ70A?5w}B%CV0xT z#&~>@E2eOHfzI}phsJal_moS8&x+`?6O`PF{Hmfc9&uVZ6GLVF%CqS12oJs10}51h zE?v!86QrwwnS<2GW_fhPp<=?;vcjS+85N?(rbj_huDGRL;t_LVY-@{%DD+U16W3bR zrN~y*wq_6AnK(m>tdRpdP}W zK~MP@Ur9xQuiPuXG~Np*(t%Dj=CKkZY^5G?sI}!*$j&QA9Pw@UYRMB73ExPF3bdbC zEJk2jXoXKj{4p+z?h9FSsNsjtCoeD|Pb{#?N+yLzyy(34#eKzHFrT{K6t##99O32` ziPB9-Yr!y_6963UWAyM^(*&%Ubt{f;~Os$9rP3V4ui?nL`nex1a7H zMO|@Gc5X#sWm#F&BA0fG)7NY3@Qy&_x;|V=E~n|q9a=Zg)uXsp7Hv4X(sK1+os_Ap zoRVW_T?)vF+&8*R+^S@LF72Vr*4a{E<3#1iA99Rg_ym$72)K_1(iCWXocb5V)}v#hx@mh zXT|;C+<|4|%EZmG7<#stf`Wlb)~Qe-6;X)zw=rZb?KhYSmGw zT^}#T_YIDlkXu$FZ!8=)A>3ER+J3YcL1WJ({O}$p$j26~>^K>G@Z)EQqxT4kC7*bz zST6mj^TgN`b+Ahj<2o(7dY5}g=Z=qh)<+4Xv0aIexxUs?_4vFUnqZ&iD2&kT3gc14VZp=jw zm7tpnqIp^_hG>6uKHV1UA;w)kx7cz60hyD%5?F<(7u1FU?;n7@4{VC+d=4eI$J9ndP+5u?&U! z^rM1N3-*YesBpA#amc7h>{(Dnqr#TT(iuj@@GOOV)dpe?Sj}EJqgT^lWCf}`KEGV{ zh7+Qm0i?69E+uBU9agIjn_EgPFZLl39#otnl%el2YRBq9tL6m6m7}<*@zQgV>IvrP zlU7kxTxHlMRC5?n&FY~=#(?1f literal 0 HcmV?d00001 diff --git a/compat/pthreads/pthread.h b/compat/pthreads/pthread.h new file mode 100644 index 0000000..c8ee778 --- /dev/null +++ b/compat/pthreads/pthread.h @@ -0,0 +1,1376 @@ +/* This is an implementation of the threads API of POSIX 1003.1-2001. + * + * -------------------------------------------------------------------------- + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2005 Pthreads-win32 contributors + * + * Contact Email: rpj@callisto.canberra.edu.au + * + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +// undef for DLLs +#define PTW32_STATIC_LIB + + +#if !defined( PTHREAD_H ) +#define PTHREAD_H + +#if !defined(HAVE_STRUCT_TIMESPEC) && _MSC_VER >= 1900 +#define HAVE_STRUCT_TIMESPEC +#endif + +/* + * See the README file for an explanation of the pthreads-win32 version + * numbering scheme and how the DLL is named etc. + */ +#define PTW32_VERSION 2,9,1,0 +#define PTW32_VERSION_STRING "2, 9, 1, 0\0" + +/* There are three implementations of cancel cleanup. + * Note that pthread.h is included in both application + * compilation units and also internally for the library. + * The code here and within the library aims to work + * for all reasonable combinations of environments. + * + * The three implementations are: + * + * WIN32 SEH + * C + * C++ + * + * Please note that exiting a push/pop block via + * "return", "exit", "break", or "continue" will + * lead to different behaviour amongst applications + * depending upon whether the library was built + * using SEH, C++, or C. For example, a library built + * with SEH will call the cleanup routine, while both + * C++ and C built versions will not. + */ + +/* + * Define defaults for cleanup code. + * Note: Unless the build explicitly defines one of the following, then + * we default to standard C style cleanup. This style uses setjmp/longjmp + * in the cancelation and thread exit implementations and therefore won't + * do stack unwinding if linked to applications that have it (e.g. + * C++ apps). This is currently consistent with most/all commercial Unix + * POSIX threads implementations. + */ +#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C ) +# define __CLEANUP_C +#endif + +#if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC)) +#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler. +#endif + +/* + * Stop here if we are being included by the resource compiler. + */ +#if !defined(RC_INVOKED) + +#undef PTW32_LEVEL + +#if defined(_POSIX_SOURCE) +#define PTW32_LEVEL 0 +/* Early POSIX */ +#endif + +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 +#undef PTW32_LEVEL +#define PTW32_LEVEL 1 +/* Include 1b, 1c and 1d */ +#endif + +#if defined(INCLUDE_NP) +#undef PTW32_LEVEL +#define PTW32_LEVEL 2 +/* Include Non-Portable extensions */ +#endif + +#define PTW32_LEVEL_MAX 3 + +#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL) +#define PTW32_LEVEL PTW32_LEVEL_MAX +/* Include everything */ +#endif + +#if defined(_UWIN) +# define HAVE_STRUCT_TIMESPEC 1 +# define HAVE_SIGNAL_H 1 +# undef HAVE_PTW32_CONFIG_H +# pragma comment(lib, "pthread") +#endif + +/* + * ------------------------------------------------------------- + * + * + * Module: pthread.h + * + * Purpose: + * Provides an implementation of PThreads based upon the + * standard: + * + * POSIX 1003.1-2001 + * and + * The Single Unix Specification version 3 + * + * (these two are equivalent) + * + * in order to enhance code portability between Windows, + * various commercial Unix implementations, and Linux. + * + * See the ANNOUNCE file for a full list of conforming + * routines and defined constants, and a list of missing + * routines and constants not defined in this implementation. + * + * Authors: + * There have been many contributors to this library. + * The initial implementation was contributed by + * John Bossom, and several others have provided major + * sections or revisions of parts of the implementation. + * Often significant effort has been contributed to + * find and fix important bugs and other problems to + * improve the reliability of the library, which sometimes + * is not reflected in the amount of code which changed as + * result. + * As much as possible, the contributors are acknowledged + * in the ChangeLog file in the source code distribution + * where their changes are noted in detail. + * + * Contributors are listed in the CONTRIBUTORS file. + * + * As usual, all bouquets go to the contributors, and all + * brickbats go to the project maintainer. + * + * Maintainer: + * The code base for this project is coordinated and + * eventually pre-tested, packaged, and made available by + * + * Ross Johnson + * + * QA Testers: + * Ultimately, the library is tested in the real world by + * a host of competent and demanding scientists and + * engineers who report bugs and/or provide solutions + * which are then fixed or incorporated into subsequent + * versions of the library. Each time a bug is fixed, a + * test case is written to prove the fix and ensure + * that later changes to the code don't reintroduce the + * same error. The number of test cases is slowly growing + * and therefore so is the code reliability. + * + * Compliance: + * See the file ANNOUNCE for the list of implemented + * and not-implemented routines and defined options. + * Of course, these are all defined is this file as well. + * + * Web site: + * The source code and other information about this library + * are available from + * + * http://sources.redhat.com/pthreads-win32/ + * + * ------------------------------------------------------------- + */ + +/* Try to avoid including windows.h */ +#if (defined(__MINGW64__) || defined(__MINGW32__)) && defined(__cplusplus) +#define PTW32_INCLUDE_WINDOWS_H +#endif + +#if defined(PTW32_INCLUDE_WINDOWS_H) +#include +#endif + +#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__) +/* + * VC++6.0 or early compiler's header has no DWORD_PTR type. + */ +typedef unsigned long DWORD_PTR; +typedef unsigned long ULONG_PTR; +#endif +/* + * ----------------- + * autoconf switches + * ----------------- + */ + +#if defined(HAVE_PTW32_CONFIG_H) +#include "config.h" +#endif /* HAVE_PTW32_CONFIG_H */ + +#if !defined(NEED_FTIME) +#include +#else /* NEED_FTIME */ +/* use native WIN32 time API */ +#endif /* NEED_FTIME */ + +#if defined(HAVE_SIGNAL_H) +#include +#endif /* HAVE_SIGNAL_H */ + +#include + +/* + * Boolean values to make us independent of system includes. + */ +enum { + PTW32_FALSE = 0, + PTW32_TRUE = (! PTW32_FALSE) +}; + +/* + * This is a duplicate of what is in the autoconf config.h, + * which is only used when building the pthread-win32 libraries. + */ + +#if !defined(PTW32_CONFIG_H) +# if defined(WINCE) +# define NEED_ERRNO +# define NEED_SEM +# endif +# if defined(__MINGW64__) +# define HAVE_STRUCT_TIMESPEC +# define HAVE_MODE_T +# elif defined(_UWIN) || defined(__MINGW32__) +# define HAVE_MODE_T +# endif +#endif + +/* + * + */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +#if defined(NEED_ERRNO) +#include "need_errno.h" +#else +#include +#endif +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Several systems don't define some error numbers. + */ +#if !defined(ENOTSUP) +# define ENOTSUP 48 /* This is the value in Solaris. */ +#endif + +#if !defined(ETIMEDOUT) +# define ETIMEDOUT 10060 /* Same as WSAETIMEDOUT */ +#endif + +#if !defined(ENOSYS) +# define ENOSYS 140 /* Semi-arbitrary value */ +#endif + +#if !defined(EDEADLK) +# if defined(EDEADLOCK) +# define EDEADLK EDEADLOCK +# else +# define EDEADLK 36 /* This is the value in MSVC. */ +# endif +#endif + +/* POSIX 2008 - related to robust mutexes */ +#if !defined(EOWNERDEAD) +# define EOWNERDEAD 43 +#endif +#if !defined(ENOTRECOVERABLE) +# define ENOTRECOVERABLE 44 +#endif + +#include + +/* + * To avoid including windows.h we define only those things that we + * actually need from it. + */ +#if !defined(PTW32_INCLUDE_WINDOWS_H) +#if !defined(HANDLE) +# define PTW32__HANDLE_DEF +# define HANDLE void * +#endif +#if !defined(DWORD) +# define PTW32__DWORD_DEF +# define DWORD unsigned long +#endif +#endif + +#if !defined(HAVE_STRUCT_TIMESPEC) +#define HAVE_STRUCT_TIMESPEC +#if !defined(_TIMESPEC_DEFINED) +#define _TIMESPEC_DEFINED +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#endif /* _TIMESPEC_DEFINED */ +#endif /* HAVE_STRUCT_TIMESPEC */ + +#if !defined(SIG_BLOCK) +#define SIG_BLOCK 0 +#endif /* SIG_BLOCK */ + +#if !defined(SIG_UNBLOCK) +#define SIG_UNBLOCK 1 +#endif /* SIG_UNBLOCK */ + +#if !defined(SIG_SETMASK) +#define SIG_SETMASK 2 +#endif /* SIG_SETMASK */ + +#if defined(__cplusplus) +extern "C" +{ +#endif /* __cplusplus */ + +/* + * ------------------------------------------------------------- + * + * POSIX 1003.1-2001 Options + * ========================= + * + * Options are normally set in , which is not provided + * with pthreads-win32. + * + * For conformance with the Single Unix Specification (version 3), all of the + * options below are defined, and have a value of either -1 (not supported) + * or 200112L (supported). + * + * These options can neither be left undefined nor have a value of 0, because + * either indicates that sysconf(), which is not implemented, may be used at + * runtime to check the status of the option. + * + * _POSIX_THREADS (== 200112L) + * If == 200112L, you can use threads + * + * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L) + * If == 200112L, you can control the size of a thread's + * stack + * pthread_attr_getstacksize + * pthread_attr_setstacksize + * + * _POSIX_THREAD_ATTR_STACKADDR (== -1) + * If == 200112L, you can allocate and control a thread's + * stack. If not supported, the following functions + * will return ENOSYS, indicating they are not + * supported: + * pthread_attr_getstackaddr + * pthread_attr_setstackaddr + * + * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1) + * If == 200112L, you can use realtime scheduling. + * This option indicates that the behaviour of some + * implemented functions conforms to the additional TPS + * requirements in the standard. E.g. rwlocks favour + * writers over readers when threads have equal priority. + * + * _POSIX_THREAD_PRIO_INHERIT (== -1) + * If == 200112L, you can create priority inheritance + * mutexes. + * pthread_mutexattr_getprotocol + + * pthread_mutexattr_setprotocol + + * + * _POSIX_THREAD_PRIO_PROTECT (== -1) + * If == 200112L, you can create priority ceiling mutexes + * Indicates the availability of: + * pthread_mutex_getprioceiling + * pthread_mutex_setprioceiling + * pthread_mutexattr_getprioceiling + * pthread_mutexattr_getprotocol + + * pthread_mutexattr_setprioceiling + * pthread_mutexattr_setprotocol + + * + * _POSIX_THREAD_PROCESS_SHARED (== -1) + * If set, you can create mutexes and condition + * variables that can be shared with another + * process.If set, indicates the availability + * of: + * pthread_mutexattr_getpshared + * pthread_mutexattr_setpshared + * pthread_condattr_getpshared + * pthread_condattr_setpshared + * + * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L) + * If == 200112L you can use the special *_r library + * functions that provide thread-safe behaviour + * + * _POSIX_READER_WRITER_LOCKS (== 200112L) + * If == 200112L, you can use read/write locks + * + * _POSIX_SPIN_LOCKS (== 200112L) + * If == 200112L, you can use spin locks + * + * _POSIX_BARRIERS (== 200112L) + * If == 200112L, you can use barriers + * + * + These functions provide both 'inherit' and/or + * 'protect' protocol, based upon these macro + * settings. + * + * ------------------------------------------------------------- + */ + +/* + * POSIX Options + */ +#undef _POSIX_THREADS +#define _POSIX_THREADS 200809L + +#undef _POSIX_READER_WRITER_LOCKS +#define _POSIX_READER_WRITER_LOCKS 200809L + +#undef _POSIX_SPIN_LOCKS +#define _POSIX_SPIN_LOCKS 200809L + +#undef _POSIX_BARRIERS +#define _POSIX_BARRIERS 200809L + +#undef _POSIX_THREAD_SAFE_FUNCTIONS +#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L + +#undef _POSIX_THREAD_ATTR_STACKSIZE +#define _POSIX_THREAD_ATTR_STACKSIZE 200809L + +/* + * The following options are not supported + */ +#undef _POSIX_THREAD_ATTR_STACKADDR +#define _POSIX_THREAD_ATTR_STACKADDR -1 + +#undef _POSIX_THREAD_PRIO_INHERIT +#define _POSIX_THREAD_PRIO_INHERIT -1 + +#undef _POSIX_THREAD_PRIO_PROTECT +#define _POSIX_THREAD_PRIO_PROTECT -1 + +/* TPS is not fully supported. */ +#undef _POSIX_THREAD_PRIORITY_SCHEDULING +#define _POSIX_THREAD_PRIORITY_SCHEDULING -1 + +#undef _POSIX_THREAD_PROCESS_SHARED +#define _POSIX_THREAD_PROCESS_SHARED -1 + + +/* + * POSIX 1003.1-2001 Limits + * =========================== + * + * These limits are normally set in , which is not provided with + * pthreads-win32. + * + * PTHREAD_DESTRUCTOR_ITERATIONS + * Maximum number of attempts to destroy + * a thread's thread-specific data on + * termination (must be at least 4) + * + * PTHREAD_KEYS_MAX + * Maximum number of thread-specific data keys + * available per process (must be at least 128) + * + * PTHREAD_STACK_MIN + * Minimum supported stack size for a thread + * + * PTHREAD_THREADS_MAX + * Maximum number of threads supported per + * process (must be at least 64). + * + * SEM_NSEMS_MAX + * The maximum number of semaphores a process can have. + * (must be at least 256) + * + * SEM_VALUE_MAX + * The maximum value a semaphore can have. + * (must be at least 32767) + * + */ +#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 + +#undef PTHREAD_DESTRUCTOR_ITERATIONS +#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS + +#undef _POSIX_THREAD_KEYS_MAX +#define _POSIX_THREAD_KEYS_MAX 128 + +#undef PTHREAD_KEYS_MAX +#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX + +#undef PTHREAD_STACK_MIN +#define PTHREAD_STACK_MIN 0 + +#undef _POSIX_THREAD_THREADS_MAX +#define _POSIX_THREAD_THREADS_MAX 64 + + /* Arbitrary value */ +#undef PTHREAD_THREADS_MAX +#define PTHREAD_THREADS_MAX 2019 + +#undef _POSIX_SEM_NSEMS_MAX +#define _POSIX_SEM_NSEMS_MAX 256 + + /* Arbitrary value */ +#undef SEM_NSEMS_MAX +#define SEM_NSEMS_MAX 1024 + +#undef _POSIX_SEM_VALUE_MAX +#define _POSIX_SEM_VALUE_MAX 32767 + +#undef SEM_VALUE_MAX +#define SEM_VALUE_MAX INT_MAX + + +#if defined(__GNUC__) && !defined(__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the library, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the library, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#if !defined(PTW32_STATIC_LIB) +# if defined(PTW32_BUILD) +# define PTW32_DLLPORT __declspec (dllexport) +# else +# define PTW32_DLLPORT __declspec (dllimport) +# endif +#else +# define PTW32_DLLPORT +#endif + +/* + * The Open Watcom C/C++ compiler uses a non-standard calling convention + * that passes function args in registers unless __cdecl is explicitly specified + * in exposed function prototypes. + * + * We force all calls to cdecl even though this could slow Watcom code down + * slightly. If you know that the Watcom compiler will be used to build both + * the DLL and application, then you can probably define this as a null string. + * Remember that pthread.h (this file) is used for both the DLL and application builds. + */ +#define PTW32_CDECL __cdecl + +#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX +# include +#else +/* + * Generic handle type - intended to extend uniqueness beyond + * that available with a simple pointer. It should scale for either + * IA-32 or IA-64. + */ +typedef struct { + void * p; /* Pointer to actual object */ + unsigned int x; /* Extra information - reuse count etc */ +} ptw32_handle_t; + +typedef ptw32_handle_t pthread_t; +typedef struct pthread_attr_t_ * pthread_attr_t; +typedef struct pthread_once_t_ pthread_once_t; +typedef struct pthread_key_t_ * pthread_key_t; +typedef struct pthread_mutex_t_ * pthread_mutex_t; +typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t; +typedef struct pthread_cond_t_ * pthread_cond_t; +typedef struct pthread_condattr_t_ * pthread_condattr_t; +#endif +typedef struct pthread_rwlock_t_ * pthread_rwlock_t; +typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t; +typedef struct pthread_spinlock_t_ * pthread_spinlock_t; +typedef struct pthread_barrier_t_ * pthread_barrier_t; +typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t; + +/* + * ==================== + * ==================== + * POSIX Threads + * ==================== + * ==================== + */ + +enum { +/* + * pthread_attr_{get,set}detachstate + */ + PTHREAD_CREATE_JOINABLE = 0, /* Default */ + PTHREAD_CREATE_DETACHED = 1, + +/* + * pthread_attr_{get,set}inheritsched + */ + PTHREAD_INHERIT_SCHED = 0, + PTHREAD_EXPLICIT_SCHED = 1, /* Default */ + +/* + * pthread_{get,set}scope + */ + PTHREAD_SCOPE_PROCESS = 0, + PTHREAD_SCOPE_SYSTEM = 1, /* Default */ + +/* + * pthread_setcancelstate paramters + */ + PTHREAD_CANCEL_ENABLE = 0, /* Default */ + PTHREAD_CANCEL_DISABLE = 1, + +/* + * pthread_setcanceltype parameters + */ + PTHREAD_CANCEL_ASYNCHRONOUS = 0, + PTHREAD_CANCEL_DEFERRED = 1, /* Default */ + +/* + * pthread_mutexattr_{get,set}pshared + * pthread_condattr_{get,set}pshared + */ + PTHREAD_PROCESS_PRIVATE = 0, + PTHREAD_PROCESS_SHARED = 1, + +/* + * pthread_mutexattr_{get,set}robust + */ + PTHREAD_MUTEX_STALLED = 0, /* Default */ + PTHREAD_MUTEX_ROBUST = 1, + +/* + * pthread_barrier_wait + */ + PTHREAD_BARRIER_SERIAL_THREAD = -1 +}; + +/* + * ==================== + * ==================== + * Cancelation + * ==================== + * ==================== + */ +#define PTHREAD_CANCELED ((void *)(size_t) -1) + + +/* + * ==================== + * ==================== + * Once Key + * ==================== + * ==================== + */ +#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0} + +struct pthread_once_t_ +{ + int done; /* indicates if user function has been executed */ + void * lock; + int reserved1; + int reserved2; +}; + + +/* + * ==================== + * ==================== + * Object initialisers + * ==================== + * ==================== + */ +#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -1) +#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -2) +#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -3) + +/* + * Compatibility with LinuxThreads + */ +#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER +#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER + +#define PTHREAD_COND_INITIALIZER ((pthread_cond_t)(size_t) -1) + +#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t)(size_t) -1) + +#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t)(size_t) -1) + + +/* + * Mutex types. + */ +enum +{ + /* Compatibility with LinuxThreads */ + PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP, + /* For compatibility with POSIX */ + PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL +}; + + +typedef struct ptw32_cleanup_t ptw32_cleanup_t; + +#if defined(_MSC_VER) +/* Disable MSVC 'anachronism used' warning */ +#pragma warning( disable : 4229 ) +#endif + +typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *); + +#if defined(_MSC_VER) +#pragma warning( default : 4229 ) +#endif + +struct ptw32_cleanup_t +{ + ptw32_cleanup_callback_t routine; + void *arg; + struct ptw32_cleanup_t *prev; +}; + +#if defined(__CLEANUP_SEH) + /* + * WIN32 SEH version of cancel cleanup. + */ + +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + ptw32_cleanup_t _cleanup; \ + \ + _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \ + _cleanup.arg = (_arg); \ + __try \ + { \ + +#define pthread_cleanup_pop( _execute ) \ + } \ + __finally \ + { \ + if( _execute || AbnormalTermination()) \ + { \ + (*(_cleanup.routine))( _cleanup.arg ); \ + } \ + } \ + } + +#else /* __CLEANUP_SEH */ + +#if defined(__CLEANUP_C) + + /* + * C implementation of PThreads cancel cleanup + */ + +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + ptw32_cleanup_t _cleanup; \ + \ + ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \ + +#define pthread_cleanup_pop( _execute ) \ + (void) ptw32_pop_cleanup( _execute ); \ + } + +#else /* __CLEANUP_C */ + +#if defined(__CLEANUP_CXX) + + /* + * C++ version of cancel cleanup. + * - John E. Bossom. + */ + + class PThreadCleanup { + /* + * PThreadCleanup + * + * Purpose + * This class is a C++ helper class that is + * used to implement pthread_cleanup_push/ + * pthread_cleanup_pop. + * The destructor of this class automatically + * pops the pushed cleanup routine regardless + * of how the code exits the scope + * (i.e. such as by an exception) + */ + ptw32_cleanup_callback_t cleanUpRout; + void * obj; + int executeIt; + + public: + PThreadCleanup() : + cleanUpRout( 0 ), + obj( 0 ), + executeIt( 0 ) + /* + * No cleanup performed + */ + { + } + + PThreadCleanup( + ptw32_cleanup_callback_t routine, + void * arg ) : + cleanUpRout( routine ), + obj( arg ), + executeIt( 1 ) + /* + * Registers a cleanup routine for 'arg' + */ + { + } + + ~PThreadCleanup() + { + if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) + { + (void) (*cleanUpRout)( obj ); + } + } + + void execute( int exec ) + { + executeIt = exec; + } + }; + + /* + * C++ implementation of PThreads cancel cleanup; + * This implementation takes advantage of a helper + * class who's destructor automatically calls the + * cleanup routine if we exit our scope weirdly + */ +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \ + (void *) (_arg) ); + +#define pthread_cleanup_pop( _execute ) \ + cleanup.execute( _execute ); \ + } + +#else + +#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. + +#endif /* __CLEANUP_CXX */ + +#endif /* __CLEANUP_C */ + +#endif /* __CLEANUP_SEH */ + +/* + * =============== + * =============== + * Methods + * =============== + * =============== + */ + +/* + * PThread Attribute Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr, + int *detachstate); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr, + void **stackaddr); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr, + size_t * stacksize); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr, + int detachstate); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr, + void *stackaddr); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr, + size_t stacksize); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr, + struct sched_param *param); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr, + const struct sched_param *param); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *, + int); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (const pthread_attr_t *, + int *); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr, + int inheritsched); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(const pthread_attr_t * attr, + int * inheritsched); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *, + int); + +PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *, + int *); + +/* + * PThread Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid, + const pthread_attr_t * attr, + void *(PTW32_CDECL *start) (void *), + void *arg); + +PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid); + +PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1, + pthread_t t2); + +PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr); + +PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread, + void **value_ptr); + +PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void); + +PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread); + +PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state, + int *oldstate); + +PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type, + int *oldtype); + +PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void); + +PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control, + void (PTW32_CDECL *init_routine) (void)); + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute); + +PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup, + ptw32_cleanup_callback_t routine, + void *arg); +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Thread Specific Data Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key, + void (PTW32_CDECL *destructor) (void *)); + +PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key); + +PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key, + const void *value); + +PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key); + + +/* + * Mutex Attribute Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t + * attr, + int *pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, + int pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind); +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *kind); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setrobust( + pthread_mutexattr_t *attr, + int robust); +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getrobust( + const pthread_mutexattr_t * attr, + int * robust); + +/* + * Barrier Attribute Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t + * attr, + int *pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, + int pshared); + +/* + * Mutex Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex, + const pthread_mutexattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t * mutex, + const struct timespec *abstime); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_mutex_consistent (pthread_mutex_t * mutex); + +/* + * Spinlock Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock); + +/* + * Barrier Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier, + const pthread_barrierattr_t * attr, + unsigned int count); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier); + +PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier); + +/* + * Condition Variable Attribute Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr, + int *pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr, + int pshared); + +/* + * Condition Variable Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond, + const pthread_condattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond, + pthread_mutex_t * mutex); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond, + pthread_mutex_t * mutex, + const struct timespec *abstime); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond); + +PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond); + +/* + * Scheduling + */ +PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread, + int policy, + const struct sched_param *param); + +PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread, + int *policy, + struct sched_param *param); + +PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int); + +PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void); + +/* + * Read-Write Lock Functions + */ +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock, + const pthread_rwlockattr_t *attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, + const struct timespec *abstime); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, + const struct timespec *abstime); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, + int *pshared); + +PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, + int pshared); + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 + +/* + * Signal Functions. Should be defined in but MSVC and MinGW32 + * already have signal.h that don't define these. + */ +PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig); + +/* + * Non-portable functions + */ + +/* + * Compatibility with Linux. + */ +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, + int kind); +PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, + int *kind); + +/* + * Possibly supported by other POSIX threads implementations + */ +PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval); +PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void); +PTW32_DLLPORT unsigned __int64 PTW32_CDECL pthread_getunique_np(pthread_t thread); + +/* + * Useful if an application wants to statically link + * the lib rather than load the DLL at run-time. + */ +PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void); +PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void); +PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void); +PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void); + +/* + * Features that are auto-detected at load/run time. + */ +PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int); +enum ptw32_features { + PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */ + PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */ +}; + +/* + * Register a system time change with the library. + * Causes the library to perform various functions + * in response to the change. Should be called whenever + * the application's top level window receives a + * WM_TIMECHANGE message. It can be passed directly to + * pthread_create() as a new thread if desired. + */ +PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *); + +#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX + +/* + * Returns the Win32 HANDLE for the POSIX thread. + */ +PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread); +/* + * Returns the win32 thread ID for POSIX thread. + */ +PTW32_DLLPORT DWORD PTW32_CDECL pthread_getw32threadid_np (pthread_t thread); + + +/* + * Protected Methods + * + * This function blocks until the given WIN32 handle + * is signaled or pthread_cancel had been called. + * This function allows the caller to hook into the + * PThreads cancel mechanism. It is implemented using + * + * WaitForMultipleObjects + * + * on 'waitHandle' and a manually reset WIN32 Event + * used to implement pthread_cancel. The 'timeout' + * argument to TimedWait is simply passed to + * WaitForMultipleObjects. + */ +PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle); +PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle, + DWORD timeout); + +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Thread-Safe C Runtime Library Mappings. + */ +#if !defined(_UWIN) +# if defined(NEED_ERRNO) + PTW32_DLLPORT int * PTW32_CDECL _errno( void ); +# else +# if !defined(errno) +# if (defined(_MT) || defined(_DLL)) + __declspec(dllimport) extern int * __cdecl _errno(void); +# define errno (*_errno()) +# endif +# endif +# endif +#endif + +/* + * Some compiler environments don't define some things. + */ +#if defined(__BORLANDC__) +# define _ftime ftime +# define _timeb timeb +#endif + +#if defined(__cplusplus) + +/* + * Internal exceptions + */ +class ptw32_exception {}; +class ptw32_exception_cancel : public ptw32_exception {}; +class ptw32_exception_exit : public ptw32_exception {}; + +#endif + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX + +/* FIXME: This is only required if the library was built using SEH */ +/* + * Get internal SEH tag + */ +PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void); + +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +#if !defined(PTW32_BUILD) + +#if defined(__CLEANUP_SEH) + +/* + * Redefine the SEH __except keyword to ensure that applications + * propagate our internal exceptions up to the library's internal handlers. + */ +#define __except( E ) \ + __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ + ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) + +#endif /* __CLEANUP_SEH */ + +#if defined(__CLEANUP_CXX) + +/* + * Redefine the C++ catch keyword to ensure that applications + * propagate our internal exceptions up to the library's internal handlers. + */ +#if defined(_MSC_VER) + /* + * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll' + * if you want Pthread-Win32 cancelation and pthread_exit to work. + */ + +#if !defined(PtW32NoCatchWarn) + +#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.") +#pragma message("------------------------------------------------------------------") +#pragma message("When compiling applications with MSVC++ and C++ exception handling:") +#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads") +#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread") +#pragma message(" cancelation and pthread_exit to work. For example:") +#pragma message("") +#pragma message(" #if defined(PtW32CatchAll)") +#pragma message(" PtW32CatchAll") +#pragma message(" #else") +#pragma message(" catch(...)") +#pragma message(" #endif") +#pragma message(" {") +#pragma message(" /* Catchall block processing */") +#pragma message(" }") +#pragma message("------------------------------------------------------------------") + +#endif + +#define PtW32CatchAll \ + catch( ptw32_exception & ) { throw; } \ + catch( ... ) + +#else /* _MSC_VER */ + +#define catch( E ) \ + catch( ptw32_exception & ) { throw; } \ + catch( E ) + +#endif /* _MSC_VER */ + +#endif /* __CLEANUP_CXX */ + +#endif /* ! PTW32_BUILD */ + +#if defined(__cplusplus) +} /* End of extern "C" */ +#endif /* __cplusplus */ + +#if defined(PTW32__HANDLE_DEF) +# undef HANDLE +#endif +#if defined(PTW32__DWORD_DEF) +# undef DWORD +#endif + +#undef PTW32_LEVEL +#undef PTW32_LEVEL_MAX + +#endif /* ! RC_INVOKED */ + +#endif /* PTHREAD_H */ diff --git a/compat/pthreads/sched.h b/compat/pthreads/sched.h new file mode 100644 index 0000000..f36a97a --- /dev/null +++ b/compat/pthreads/sched.h @@ -0,0 +1,183 @@ +/* + * Module: sched.h + * + * Purpose: + * Provides an implementation of POSIX realtime extensions + * as defined in + * + * POSIX 1003.1b-1993 (POSIX.1b) + * + * -------------------------------------------------------------------------- + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2005 Pthreads-win32 contributors + * + * Contact Email: rpj@callisto.canberra.edu.au + * + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#if !defined(_SCHED_H) +#define _SCHED_H + +#undef PTW32_SCHED_LEVEL + +#if defined(_POSIX_SOURCE) +#define PTW32_SCHED_LEVEL 0 +/* Early POSIX */ +#endif + +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 +#undef PTW32_SCHED_LEVEL +#define PTW32_SCHED_LEVEL 1 +/* Include 1b, 1c and 1d */ +#endif + +#if defined(INCLUDE_NP) +#undef PTW32_SCHED_LEVEL +#define PTW32_SCHED_LEVEL 2 +/* Include Non-Portable extensions */ +#endif + +#define PTW32_SCHED_LEVEL_MAX 3 + +#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_SCHED_LEVEL) +#define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX +/* Include everything */ +#endif + + +#if defined(__GNUC__) && !defined(__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the library, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the library, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#if !defined(PTW32_STATIC_LIB) +# if defined(PTW32_BUILD) +# define PTW32_DLLPORT __declspec (dllexport) +# else +# define PTW32_DLLPORT __declspec (dllimport) +# endif +#else +# define PTW32_DLLPORT +#endif + +/* + * This is a duplicate of what is in the autoconf config.h, + * which is only used when building the pthread-win32 libraries. + */ + +#if !defined(PTW32_CONFIG_H) +# if defined(WINCE) +# define NEED_ERRNO +# define NEED_SEM +# endif +# if defined(__MINGW64__) +# define HAVE_STRUCT_TIMESPEC +# define HAVE_MODE_T +# elif defined(_UWIN) || defined(__MINGW32__) +# define HAVE_MODE_T +# endif +#endif + +/* + * + */ + +#if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX +#if defined(NEED_ERRNO) +#include "need_errno.h" +#else +#include +#endif +#endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */ + +#if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN) +# if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX +/* For pid_t */ +# include +/* Required by Unix 98 */ +# include +# else + typedef int pid_t; +# endif +#else + typedef int pid_t; +#endif + +/* Thread scheduling policies */ + +enum { + SCHED_OTHER = 0, + SCHED_FIFO, + SCHED_RR, + SCHED_MIN = SCHED_OTHER, + SCHED_MAX = SCHED_RR +}; + +struct sched_param { + int sched_priority; +}; + +#if defined(__cplusplus) +extern "C" +{ +#endif /* __cplusplus */ + +PTW32_DLLPORT int __cdecl sched_yield (void); + +PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy); + +PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy); + +PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy); + +PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid); + +/* + * Note that this macro returns ENOTSUP rather than + * ENOSYS as might be expected. However, returning ENOSYS + * should mean that sched_get_priority_{min,max} are + * not implemented as well as sched_rr_get_interval. + * This is not the case, since we just don't support + * round-robin scheduling. Therefore I have chosen to + * return the same value as sched_setscheduler when + * SCHED_RR is passed to it. + */ +#define sched_rr_get_interval(_pid, _interval) \ + ( errno = ENOTSUP, (int) -1 ) + + +#if defined(__cplusplus) +} /* End of extern "C" */ +#endif /* __cplusplus */ + +#undef PTW32_SCHED_LEVEL +#undef PTW32_SCHED_LEVEL_MAX + +#endif /* !_SCHED_H */ + diff --git a/compat/pthreads/x64/pthreadVC2.lib b/compat/pthreads/x64/pthreadVC2.lib new file mode 100644 index 0000000000000000000000000000000000000000..3e26e4a066c3eeca1a1de8a78bf9c089b1750407 GIT binary patch literal 166580 zcmeFa4}2BH)jqx<7YP5nL8^vgC1})86@mdIQY9e?Y$Op75iDScAwuL&LUOM_DIyIi z-mWS7TH9Ldx3;#m*4oNzt)R68qXxu3sI5Y+Rcn1UrdFs`pcM0ao;kC7@15)>w|(FD z^Zoq39~buK+}UT(&dfP;=FFMdxud>N)lj|c;(=qclaF!Z^9u6v&L2PF{N(gJ{dN4r zN&3p-ftF=$v#ifIe0qLb2mgQ8fhkieiwi6Brj{0#mX}{T>iCtD&YGTV))kc!Amln>LR#s6wZAL}ml=ElLol|;Q z>HI0u_Rn^NHBUO=_ zZr5s8Evsp$jWkv-t69?RqDrl=YN%QnaH(!ZZFTqOHCETvcYhL|U%k9)$&!Zdym+Ot z_DjY+keF9&DNADyWx=)JvfyG+S-eX=Wl`6PKVQtlvZ_@}Rs>$HU6Od;wRN?tJkHB&)>T#~7nDgTY)wMhm)EX{%V}jaQnR)a z1!}BqjMS`(%U&*+!k5&fT9>31b=Awgd`Oa#zF&I7I-k_&s_u!tdZC!Rim|*Fikl$D zq>HA~CtYl)yE>Yn>Pgok>k{l+{7Uy?yV@3<4WG6bXNZe|*}%1=Y^;i|tgLUStFCEm ztZQgYEHjibZdn`Fuo}B{6*@Vo1Uju@Nm9k@R3*F~F0ETtuAlCU z_0&)6SrZ-)!N3IYFEd^uvbdq z;1=urB_(Tz*6&h7&C0s#+zQuLQJ%Y|Awh8N72k^07kz7%HtupY7>T!n#+sE0tf4W| z?CKk8>oA0H+X{_}QVRdp;a&E9tZ>w=QkPrOE~|+))=aI7MCv#gp$HPvXVuYDGZP`A z?x~j>&^a}$FO9Ce+S5egIww-q;5Gs@W9EHjsuLDwx z2lhc2>NjUtR>S92ILhkt>A(Nw8i>b0K8=@jk6(NmFL8~GPwdCL^l7{#AU*qj&pTGjx>PH?1+SyFR#bZO2U`D$6?(=6*I_ly2pXk|_v)6m#Zos&1t zy)++0E3jD%!r%aD72?0fozFBL52Rbx=^7&`f(zlxhd9q+;ukMmsJ+<6^AG_$@BH%$ z&Kq~04h}C&D6(b!9q=rid|qbScZQ70JO6iM?aaO9fA~uFd#f$$5Yk`7Imb#Hia%EI zg$o(4Z(LZKzp$vjzN9KrwXnPnVf=-c*Q~5xxMJ1v^^?X;ESWa0pya%1Q>W#hH@xp`4!JDNs;I4QsB5gd zCX$_d+34)zD=xpRbdFVST{P6HUbCd<@>w-&Ypm%PF1%vS`FZ2=7hX}kaBA753#(Qx znK*u7^>q;ldJGZWjx;M1X{d`Ek}svHy2X1Ln zI^Q}MTng0ZIQ7Y#S=K~#uUi)LuAc5=oxAsy;AxF07we`TrE{NZSrsT*wpEOibz@l< zTVecVokdg*SD~aU5^95Y$7|pU+vYJ6IgVJlcuqNxOI1nv#Cl*@Q%h0O2r%8#vT;|jH5!~mYp%up)Eapj>yGzdjb}!{ zk8;jNJ>^;B@M%GF&hpB}+919W>3kZ(`_PxM_}7?FF1Ive6t|_gnp}U4Fdl1EZRg_& zW5KHgXBt`=Yr(DkcuTNQyKF_5<0|X65i+X6v*UU(AoM_}u)1z#{g~P%LoR#O>gr+( zE~N81CNGc1Pf`*sd>T^I(`e(9k3{RvcAK6?`<@I-wCpq<>1l~JMEK=gmZuJWQy7)3 zZTpzItFKM1&zdk{;)L;TpY>WF_F1Esq*=D^w8kuHsHu)%7E2$C@b|k|i<)!{%(N0q z&TC)BdDOtEzU}Hp3fDW)8a9sYU)5wr^;}d-EN7ctcet2%-7_J30aGAhl znYiN1F3*`?JXhU}5Ar)5n9uv-W+maq1M>wF=TqKkz|2U%`IVQ?oeRvOUU1WaTMEq2 zd%@)bw_RgEs>AQO#J!OsE+eWL=|6t_*qZZFzzqVfG6me3z+IanZfgp-O7Qz7aKo+x zfg?!&&ce0NX^aBm!>_!=6{mp92d*{+9LxLN6mX+}+m!x3aKpdaob@VgV3%hn5y%jx}a?1_E_%)1&FB)5^k{Y_(p zqd&jNxHuF>u$+bvM-abJxORocC?G!k^7juIyfwhB-YBSH0XUX#>>K7*4-&~wAMb{a6}^@7U)?gC(@ z^n#lRTp2JMd%;m|F^vJK4!`n}-%o)1V=w$Dw|7(E_f=HHfS6@%{hBj+;F7dsWF1|f9@A?@mIiQ-Ylqo_~Vy9%C{VtIU0v- z_~Po2z6h9Sdcn~ndl{I|-U0$gQ2XU`CuxiV;=?b08AzX!0*>utdJ4GTpn$W13*RbF zWq;!L+}n`80hklNA-JG&IA}+Cz&!d*!O{Ql<2M!0t@{?%SbSS>ESDdSWBIh(1>=7D z;r4>xxxgL%j-Z0{B@?)Hcc6`YS8()){rEkN0&W9l{au0!(&v0I_#H4AKN4Kfa|fVa zz6Q*#_Xw^p{`ft&2>E*wn11&PE+~Jr<70qXtZ}%_mtQv0uhkfk>hOCm?Z($qz-0q> zZ;H4*Dd4^UejUJ_`BM-$g356ku8q|g1;mG6IYuG9A_W}ztx6GhQwq3Z@cSun?`tf? z?VG>LQNXnO;G_Nw031Q>?L;tW1Lk)>7hF(3xE1_v{RMpOZGsEp_ZwWk8JJ7|Q*c4{ z?*J};4VdZ&d&aHAbH4}7;D-bkr1yO8*MTYjRnPnegWrw7eB)uk(H{EAmuBVnz|?OS zTu}R127ccr<`KaK<&W*?E5Q6x<8YhrbJ;$AqcOtKA4h-aHQ=%y6;u$vQMi1%#`MIm z01S$O`|_^^bprnQ)yqe~WjtnC$64Vxg8EhBqB~&|cJ+*-zWoW9k2DUq`93#>^e$j- zd|dbi={@_I?*jA1Cj=KHj~3wm08H&uf*XiGe&sz2xMzX+uw8IL`cjL_1-mWl2RL~I z<&OjFUjdV|N5KMdrMNr^m<<|-Z20Eyd$_O#n6vf@zo2&c32@&4=0Bbl+|U4i)PpZP z2iZL@xX%XQsG{rkSyuiFf(z1@OkCax%<~!-R1VsS0~#Y7{mYw=ihUip6Mrix^7oV5 z3Z(xhFsJ=aa6$cGUp#mgFmqoO+}Q#A!bpGh4~TEz3vwrX6EKN$n= zeqbiP0|G|~r(gY5BK<009@Ds>a*PD-1&slz4nKbLaOEIy)87?LP&szs!fap$z9+aK z`5wgOyMVd5Q*iz8$M3ltk^T%YGyc*uZZ$4%0p>_AI5yq!??a#eD*S@%!3vb)7GREl zAh;9p$1i_ZBYhhRGwhJyg33WRVa8mwyFJ_#?pu=`-_p9x#o);2hv?0p`??g?WB0rSIu2rj4`72x+cFyVg+ZZQ7%$(QzT3ow5= z-ZSoL;J)|?XDC462;$d)Yu^Q?IZbdu`b>EY?UQC*i<3u?eAnaJ^}rm}IHLW^QH%8S z^fYS)P98zHvvKV@VD3x-cMmYn^@6Jgzx}{W4#{(a+R-h*tpw&1jSJEj`gIrf#pE(h z9zo@x9iInGT`xH0Zvd0uPxuAt-;cqs1(^K)J(nW~murBDWe6^)A7uUx0CPy=i1w4) zJxD(W%nt_i{M;vj`z!$rDJduMuIvfK*3eW?tc#`eYp2*BQW#)mXN3h4bN8ks`mjz*VKd zZ)1x5wg7i)FZ@`JZ7K4547feL@MHbGlOn$lfIF4~zu^ozB^*KW7zNyU8rzdRW~9h( z4seyd@XJQNHl)b!PT=nCh2N>**PbH3w}AVg7k-rQkfEv7-*Dj0)Yzc<`waLM12fOW z`LvHHFq=%A(LUJzzX!}OOq>tDXMs6j;tYPQzrz{>QXN71GVH`OYa~t{LFFaCi!??7 z@e#!DO5kdG;YWEirO0n9aCh{=FB|-J0CT{^`PAQGVA6;6Twcm!6fomVoDaX5z$`Fv zhCG(i;(Yi$3{0DeGx#xoZ)yxkbp*-d5OBwP;m7`C#And2;^g7!flvNs1GC7) z8Tn)TSP#rr6X(P4eqeT(ID;R{`wB4cm^dGPeNRfWhT`PmmBWYMSYW1@I3IqCfT=Zc z20zx{7GS<-;(Yi$2FxB4XYgZr-_aPBgGZ2j4+EEea?j;u{zd^)VB&o8HxHO<6KCX) z^4$c?Z6?l#--E#HG;sz$miIMa-ZybR{05zpW}SkQM^Eyd08FWg^Wj$wOr41{^2hpX z0p>?0&WB$cFwdJfgCFhR`x?V?@CcIcQQ-P!^;}-&?+jojn>e5RT?tH$i8Jy?`8EOb zEfeR%?;&7znK*+V<@-7?ADB2FenW<*S;KMi=t;g805jdh`S7a&X0?ek^2hqy3d}tw z&WGQVz`S7M41SdF2O7h2@CcIcG2r@tw&(Iv9%lkmVB&o8HxHO<6KCX)<=q6#?IzBL z-^0MPnK*+V^YOq@@7+kkoA z#2MwKJl+Q;ZKR8K__6(#0du8^^WnD!m?jhF!|(gRY%_5_{GJEqRTF3M zV|kBi3`lhZ>GP0m^lvzM1j(2DE&yhRiSx-{Eih3NXXKCdcPlV=n>ZhSyMTGt#2Nh9 zemgY=q&kAidl@OwB# zemjBN+Y3MHOGk?QjsrK~^q%EGerE$S*~Izi%ay>?m^edUsDDks+-l-{_-zB`F%xI- zqyD|BF(B0uq<`-K_hB#mSl*#$Ant>chu1EB@>dMZOcQ71kNj2wv&qEy@cSMx_nA0@ zAM0-qFb7PW55L2}q%#1H!z+gmzfr)9GjTrrW&*Ro#2Nf3k98WO9*mD5c{BreOE3J` zAN>NDy(Z2le;vSlWa5ncQ69t2gdc{JhgUB?{7QkDZQ=}mlt&#f8%>-KzdM1s*Tnho zYX{~P6X(P4BVf|Fa3!%EKKw>%i~`~#NFHN>o7@Y(Y}|h(FzZa5PyW6I%-tr=Cx5$u zdBMc_@cRImV|&iu@h} zZci`#n7?;`IcDN~$~$~C>^M#yUcDIQ<@mQ4m<1-zhu=D2noXR+kNLY>WB6PiLG|}A zaBV5@dlQ(COq@^thJ7C6X`DQQ%1iyb2$%{J=fiI~Fl$VlQC|9Mw`mNY%Oj|~cLH~B z3jEqr4~ z`0WDbSrcdQV|hD)IcDN~_zgc7?E@!|pz>0_#Tui4_z05k4B+PV!jI*R0uwWFKKZ)` zmm;5FGGuy=Z@T&u6y@@mOM|s>1%)KVghhIA| zFPS)lALVgKV?e4SNFGOl>pQ0B@~U_-Fq2K3PyVh1rpCk>`J;TBfcch*^WpapFuP2g z!H@O#IxruYI3IpP#$r5;lShzz$?pPSrkgk)el@_XHgQJ&*uQPn7(SOrkUZ`H?w(%w zQNB;6$nRO;4)ns0ZhSb-=7QaYp`Ff46H4pUWf29(*6T`+MQX^6mxZ zEfeRHzqAX|tRXmg1eKTk&H<*_#QE^60%oO&Gs;VT4ls9{I3IqyfO*!$8T=@ZPGF9i zI3Iq)C&9nR$)l(876Y@u#QE@B2TZexGxA6I-mNj}!T1Q0?|r~M+zUU}-|v8V-^BUk zZ%_gJdz?IaD(?hfDomUYzvaNJF>ywDDUaKL`H_k9;nxPt^Cr&VM}P8tjbS->1l8YB z;QC(Jb9rf>&j98E6X%n^xxiGJI3s`Lw-K0IO`H$EZNNNc;tYPQzgL0jG;u!s224i3 zg_B2+e5rr=8l!;t2&%uyz)kOkAN8*Wm<=Y*Cx3SUbB~EL%1eGv0`r=Q^Wk?4nEqer zxxAFenZOj7I3IrVfT=cdM*hfe6EL@#I3Iow0<+V^8T=^U*MNE7#QE?WbP?JwP98z> zCBF&4l$tmne$~L#nK+;PwE%OciSyz2C@}3N&fv%P`?kig96W;b?+|dud*MfUjJO!< z>T&Y$>cuC26~J6+;*9)}-x^>X6X(P4USJ+FaRxu?^Gm>Vnm8YR1E!$;;^g6#!{A5x z<^xk~;(Yj30khJ?`S5dqxx>Wy@Y?~*lP1oG-&-1^3WARy`F;poS1Jq01-RRL;m7#e!@#^`;(X+B2$|~$#QE@R0%og;Gx$*+_iKz220nu1@epvkdf~_R`#La(O`K2uPMVJR zBu*Yd@+H41z|1poKK!D!=fm#>U|utE20zO87%+ouqZ~f`Mgud! z#2NgUzd67xHE}-tnt{2+#2NgUzh3~e)5Q7kdkvTl6KC+Ff6%`ywe~vI zB4B2lIG_C00khu38Tq5W+z!k(6X(P4d0<{OaRxuu-%(%&T++LI&ju#n#QE@>4NR4Z z^U2>vU>p-?@MC%J)fkZK2x`B(fP1zVew0UNiu}5O8#KeH7bAbV}CTFA~pMR25@6F)~jcu{>ZN) zMSgREt4e|2#uWK&0q)jb_)%ZBrO0m=aL@L_kMigQCjHXh^=}j~=b1R8{>X0zFx4i` zN1rzV(_-Qbek|{Oz&vW=eE1yz=4}(_!!LbiYWgw^xRDwgq%W#J0%o>}^T}TwFzZd6 zPyTKP=3W!$!>=8fmrR@wze5^>s#HgiJxH4czY`~qp2~X;FjGvNPyQAGQ)}Xk{IUMF z0CR_l^WnDxm?uq~55Kp7Ic(y5_?r=klul7nqAooKOB10JGG@`Q)z|nA=R855EV2 z*=gboe$3x%z#P&zmL{mY$AIZSr|0rg9%pI{NOc79n*dx!1TS`s23l8X8<$S#2Nfpe-*$iGI2iq)&sM}#QE_15ik## zI3Ip50rR?vGx$*+$2A6|I)dcecP{)eoIHZ;AIm#dV-ye{LHwowHzNgpwJGvj2V8Rs z{O(SX--E#I?1i6dZ@?TfaX#`0UxD})P98ngUjZ;>CeDZ7QeYZQoFQM1FK^Kp^UDo?(Kyi%i9jjt0vATe@B7oJFn;RlHVD?TwvmS_{{~T%ETGvrT%RMW~+(w;dehU zJ4~DpzgK{H$He*Y>pLIq11FCl`Lex@)fffDN02-&0Is+fezbp8De_wfTyrn{D37~= zdDz7Hl=pYQylLWm>aPo!@Rdfr`0zUqm;w`L@MHbW(-@HI2&%tI;FkBokL8V}$nQ?z z?(Kyi+gp2z{9Xd?^sX%snQ~;K%Yl zsWBkc5hRZnfP1YMew4?t6#0c0z@Fmd5!BvT-U49CG>+(?{LKNTvKM|V?*@$lsg59i zG2m`Xf!~8E^4kgA-W2$Cq{#0h;L;ZMTz{0uNR83O4XnR>;HLD#kL`C+iu`JTTipvk z=5H%7cbhmLeclDkvnI~aXX;BQFvm=s55M7y&@OTE2+}{6w^(Bo5FbJMG6T4IDe#M? z$ZrF1v0nJG|F|bbemjBN+Y3L|Uq_1kjsn;Bs-EkQ@;w8X3rw7kJmvyZW#W9~yAhbJ zCeDZ7{lM%naRxu;?-gJ=O`H$E0hL(4fs;p&zK~x&Fw;$(55F2ZhS4+GO? z;tYPYS8r+zNOc6sqXW2)df`X=GVE%p6U{DAzUKgUfyM^aAM-aiMShEbtL=p!^>0gx z{B8yAd%f_ZJRVDt-?P9SNP*ws6#4b9#`{M&c?8uT^=}+7r6$ftU#fwrGjWE#u)Hn6 z+-c%`_&o|tyNPQ^-UpYzL-Dr8fK*3eCVuzOz;VCbzomd8s(U}u(>Tv}97I_LCkZl2G5+gIVt zv*gE&d;Xo|grC{O50rjkD1O}(zf^o8?oVHfAA8V$lYgmrW__e~W$l-0S1rvh#!rdX zuBd4M&aD#nFOs}8(mc3HchHfC3+LfXvnJt_+qYw~8=s2F%itQa?54luzRM)L>4{u* zjk{$ZP}jIm_$!Jcz&$<(A~8djmEA2R2;)7x0ND;%O;2~J6xOk%6wX10vTf&p-Ml9< z#&*)|=GMqrnxvi}yTy~1MQw>~>e(tIIxu4;4!*1(Lm~KnXsJ6*sKJ=~L8F7;ZXp+M50)v7%FxZs}GThkrk!^~_Dkq82bX zoYM7lq@U7~He^;8kz5pv4?IN|BCHG1-;T}7NP3PRBGW^ZJAa@87m5OhH*;Z_?F>cs z!<#3OZhAbcEVeu&|NXL-8T<2FK_A5VF3vZ~VsrK%w8Ps5MuxPMW|le2Ga!?~1#NaL zk~80qeK}{b?M!y2hYI?Kzw#fHP0P$o)p8-j>ul%poNPOGj_o`P9=pnOa#5UUuH90S zlTD_dw_C~qn7li34yj4fxVZ#ajTyE8cH!fwn!{RTgVRTiX*^RMvvDSP^ueN>Q7Y zq!evbu@aO8nwMXizX#>ce=&cLTSo`wrbtd+bTIVFcAj&uc*K;haJ0sDpqzHg8t835 zsGQPOJ9bqTPKf5J3_f|B*4tf?QG`RQTcg8njz3G1B7e1G(=wcSA=sSjmQp3Vo>n#A z36)hkxtCe))+#>hwTiP7TZIeOg->b`ZliPdZ%4&i2gAGiQ(}v|S|?8rMNh!9vqk2w zhD%OkeHt6M>xt0*W14MAk27$MlVc3h)!JS{R&wmjF%R&E=6?s(7n8Ep>- z(*XB(tb`s&I+sV-b;H`VTyk6s83H;1okT*XqI>Ol$HCvz5M^fGPS(c$1PCt@YJM@= z7tLs>w%Ubr=ghO6zu24paszG(XQt7zwp84e|6+J_>0PR(og>Yy;pU&CytuGWC51Ds zYwYm#yTCqrLd*2Q_NFIzd*y;fZQ;z_<*^^;{Dj;_mp%~AOeYd)zsz|6Y2~qB=WNH{ z()=#P0hm@;&FEmKbbD#bnzVw_-I4TC=dkUJz|-C+k8L<&w-isp--9^cwPU4kpedC# zJ=0}_<6YpyA}+97kS@)sJiM(cu{o7F?bOZEgH-MF16xz{U_fIkDR}f|$TZx13O@1W zCiP_?KAqy+rX!(n3w|NSDsBEaa#eeAF2&W}L=65zaC6@%bDrn(E8b;gp~EPB;~=tl zAxnpXhd0*(h%ZM}#d=^g4HhIbyqT)lF_|EzF~e)?FonT z;HBN};U4nRIz8$mP-Ae0tVeL43^n+pI+IiydMWlVbLSOZUNjfoE}C`IUly0yj|pc1TBQC1Yx=T*SVnCe^tcRXO=ZR-&HobJ-qoWFtl4ZQlW0Pmd94^$GH#Z zZZyGGdyCRDx9PRUo8G$QruU?3diw&J9vn1W-?nI?{)T>5 ziStHB41X(PWBib=w;9pHuM#KQyWcs8rZgzwt6jjJ1X3){jSjG5N>rV&4>R&0jNJIu zyripha_!hu_()z&Cs$RtnZE#LR#$lQ-&AUaQDq&wRkEukFxD%N;Dn)GsSS0KmLwQx zUo8nT(5{xa2HMNJCd!&F?uzzBop$!!$yyc@BVtuX*E2DcKaFmZfzv=A`8Rikn~xmt z>MCvib5XeT@6IP3@8O&B8aw_5>M}g+6r3SzrAM`ZlGaTJLoCP>pu{pf3rZ}=0Z`&h zyalRJS%HI~eyXT0P=i&Q&ck=H8(iZmoSQ(&)fP~4@3%qShcjf|k5BR6ANH<3?xj8B zrR@hLcf14Y9-JZTAU;`zA?vtDoq&7{RcW+gLMa=h@>h*d$=_N~bjd^3tseCtD9Q5+ zprkh510}WbAtJK5&MCU0NO|4x6_f>gosD^j46_T1DvPe-*zLN{bHMnTw2cJcTkmG6_`6C7$oh@kKPFW$oaOpWrHo6*m0g6*-GbTBfFP z(6X#NHmM}GHp6Y8aicQ@t&c;H{1>}lgQGhmTVGHn2_5|mY0n_Uf_bg3%z2%v^*Lmq zGrh>^@(e9TkmV>4yqz!S}o%#O|XF3EUUY)~`o?eliH1maL&8vW$4fOtH5gq$!I(Ebj<(iPMu+h53q&i^u6 zUI?0FJPg@I^s^vXadK|}B_p=4fs*#{T`!G4@+N5yf%-8jJ!G*(N*iH|6zXMA;+Ve= zO4{`hpoKagl;|bbQHmxn2PK*u0VSHe5tOu%uX)sWKuN3O)8#7Lrlh?IN_77dQ1XoY z7dwy#6~C6Qy#iX>7r~j6+th_YxJW-DL|0Fx(C?I##Gn)-b1KktlJ@-q1A40EDvngK z9)=|xuxGGYW@EtX9Br8sYMGHH+;^xrS2MhU{^61XGAzsED7>*bVW|q z6|N&AgOmK$@aRZReT8$V!g-_I>3Ed2;2eb4PXo}`b}sBpw;c=@%5!FMnDGEEtCkwh z%;Q)CuFw17&A&%#iSyWvsOufspmoI{Jb_Wp=3gVFJhnKqJXW6-9-4XdCPZmZon4=!U~SUDobVZE>^&!rXRff+~ zRoXm$R}@rdez~KDju~Rh=eOBS1y*!q)4B{RI$Y)34M513Rw&W@Hm59Od($6B6jMPK z)9}yQv}?-Luywe@`3K9Ly{qd)r+wGEBh!x*)mrbOBS}9ZmEa)e@@n)%+K^c-#Rx2s z0a-Sw(HsU(VPua37v~ib2uHkcplC4OlkAquwE*C2G2D@dQQwB@Zo{kmR~;SLn8c0> zaX?sM`nM_ylBWiHdlb*|99v~9j!y^=hByBZppI|i!{7+JX>yFHxML68lE!N+HtS$J z>V`h-{5CaqjGQVpqAuweKdM`YCgaysECa%Fqn8PTsZn6~9~7}Q8dRsEI2|Hst3Zk3 zd>@pU%!fgJUMWO>pv3^r^{6N)F@-+^CH$W9(l~6BVUV&$@mOPdY)MWwhCc8c)ZhnW zfdY6BUI#lDBbf~t$!yriQ4Id>wzsI64h9sIk8zl`gy95Ov8jyCq360fc}yeWgne`* ze8LH?w;D92Q6`1Lg-IzYn3fT4j^RtwP8yc9X#Yo9|DD$(%muxh`$m!Tx@gLDgc|y( zh*%^ewuRu%0R`%B7?BM#%;0&vZkQo*ZVyBHOi!YneIHe-p+-;=wn!d9kzcnFlm<#= zRVDV|XmzK<0wFRxGXpBFZEZ`%14ZG?ehd$(!j-oy%&Au${fMT zThvCCqLe~biAPbTL_ux>CH?V_K#6kw9F+9Oe+DILHWqazYBmFu+{@lt((drm9sng= zc7YP>Mdz|0Eqa18HKU*?BPxPu!>oi-J=Gi9&P8|>j0hs!U1*k!YfE{Zu(MxNd(l7X zN>H)t=B{XlYn*rBX_g&ZBaQi)A^3Iz&XARj&p+d0$of2}j}$cl)Z2=h4k}Nzqq(4@ zRfx;hhE$88Kukii)AsV3r^0-P5RX@8GylahXMcD!IwU0xsP$O8sjJU*IWU@$kuii{ z`#CqVXG7R<5UoKWeKH&NBhQVu8i~1hDBEbrN_0k|Xim5Z6Nxn5ZsiPeYXlyoTTe7n za6Hj15KSLb%6~Q}DL+FtQhtUp91BJXe+o1B*SUe6FCOBSSxrOqY#PcDmV-IK@O1-w zV$$!HZ&A*yn1;VWuyDd8(pVNNq-m%KZ(HnV8t6*&WEz47vQ(T?VHRK&qMy+g0R}(~ zIKw6TFpOSiFM7M8Cai7k`;mi}f2(1d?hDTRCfKDtL zMyM8H+GzjnIgmo<1-fy&%5xgLlL(Y%x?L9Qhh|QT!6>h~-Z?<^J)M1=Hr49kcKpw` z`80@MS~Z7Q($YTxLDiisIuWC-hsA&dP1WthO^7SE_uZ;k3g8>$pEGJ z%*CMot};3Yly;+>C+6x9-!f%%5Z1dEEgoaE40^An`5%|Z*1pS#UU|Xltng;8u?Ce9 z-aHc&I+yKs(=I(kbucN^{Azgf1YUvbe51;6Iz)%gGI|gbTNsW;-^KX`T8Em<(ouJJ z5)0j=5!87~h5itL@ofu7(0KYQi#nL9U_ zb5Majpmaq>FmLX5_d2Rxn$32X(RP=Sv<468%SbA#`PEOlF!v^v<(wcIP+o8yD)ux(Db=t-7tvhtRzIEri7??FdryAF`gs9&CR8hTw z1Lma}VZT`^h725(HD8AQ*+!!Dv3G!y_O=6*^vW-SlK%8nP|_>E1?p_oX=Os=q^+I{ zO75kmN?P0vq$7D4XGkrW5gfY$c?M%t@{ChJ$umko375s7O zeK)ebXg9H%!rJ5>LA3%M zjkzd3`NS@1nQK^dTR@)|*cgDeofD`yCpbl_gXm`$T$vGd{WZ+NYMo`=1-4`{RUAR6 z5-d-U#^M)zQSC~CFKobxu3I_!;KFinsz*ODQ1w9=K9}xSy|TS%ff~|_SH{j*sH;Iq zO@9@X$mT9kBAa_biEKDIW?E=ODiDrCu0t(TPi`xiov{IaX<4rFc@JXUL`J0VBXo|P z$J+|$T%o7q(-?#}*n7hfVP`1KHkvRj-BR()Bjr&{LE^yUZGHk=jqC(OZQXN zu9t(lPf-piX{EP;5{+T(LDJelQ4c~Et%y*J(}~`V10{M#FJJVIZ*~e7dikPvR4ciI zp(Y3|l9R>sw@h{HP;3Ue|Nc#Dp_dbzc6Xh#O9iH4#d;PAE<$c>86b#0 z#IoeiGWTz0XF8TUB^s9Hnfl?e;%s&xVRR5J^{2Wydd*!Z<2=RH6Idz}p+o;=<SdzN#uvCexz1AK#3d*=U|$V&2TY%Zp5F;ouft0AJh|zV0O3`ZZRUY3*qjg zaW;fi56z|&Zr+s6n)+GJ4PZuhgS|?bGlgpez6}zQwhYXthi~iyAw_3BhEHqDSO)LL z;6~KYmi~;@jl!2}uDK>Wax<=jkux*f8)Kr}Cum^wzd8=X?5lxw$NQkz>?As-IK%Tr zWHEDhcqoG_;ca81gJX4}@X+a*9Xo*zXHL&l?yq)+VNl^KL_dE`xNg@q;l}+L*MzTc zEkJlLdP>RUkD?h}(?cCw_&hqt9UDODd?2!yoWpSQvaYT!HhSZQ9e-Qricm(PhalI_J4?^WC`7 zc~UCu7SQqfD#P+B$Iiv`QRv!?$UyLnR6v9nXHZ#T_DkHX&+V4=OYrQ3%tW^lAv*Tx zM%>-89sotLT-lqBk!85K2B~;(c&MG(`8jn3W6ZyHz5&a`n!gO?R+kH5`|Vs-`P1bE zKUj;q%41cTQN(4d&`iI^gpT3(u$`}vh9iXrp-CI9SrCW$Ov)OsikOf zI1^eXRl#Zq4=v2BDEP5g3;kFNohO$$UvheqKp+{}tkr%|{SU*bA$JL_Qs5yRh)n=syr_63l$ohY^HI3@&nUjCZx|9)$&50EN0v}lrO>PdBXWW=Oq|?82H-#_L(&z!#w|{* zE)M#?-lP$3-iQHKQcj~=5u?{uW~Z_;Kg5%ij5@vxYEze387e8;kec>++|4ALQF*~5 z(u~$+M!!%VTjv>*1-OM(AYNm)jv*W7>73}fs7Ga!I`8wWjj!RMKca*V!}ENi;c4&Q zaZGYMj^a?q?@-e!s?xz377R(kBMTGzIJYRM&IF@=>vpi(*i%0hSAghHqgp#>!MV-Ybd(&UC1Q=1!!V1m#T-2>^|(4S3Ujnt znWHVr@W2$8Ihv$7+R9X?o$IvNj%`PpwvEL#cj3DlV!&5e3twSTC3c-c`gVjscu%F7Mzvnb)i5!edamqobglAhdWY`q=0s$Uhy~L+F%Tj?4`y3kRYO3$Qkk@I}#VC7MCjuKrzAQ~Fpd>L$>D!a1_tJ_N29F9`a;cZ7QsBe@J zJHl3e-}D3pTck#MuFK%ph&vzUHq)YtD?w?6@u;^wstgq_SLyyEq?fexeX;EfR|{C| zreheReu&$!khA&YwM(LyuH3?qVR$Ru>JC;Yr6bNM?MJZawP)vwznLSYrcctM1G;8} z!p+|yC#>h|yhbUSNc-uob6z%?W+#i|GA)kWs11`KWACEvXdl+WlJK^o49txU#42J4 zYepzKi4zC9BSkryTi2Zxw$GsWE=GN^L zcm(b^Cd%{ogh#^fdOXsnYnPqg8vQ%w{hOZ1ZR48NzW^7qhJ)g|mylIBmxIY=He+k@ zmIc?`K)B(}qd{;v)MA)pIt1ZeX&gp|cpa1Th{5lY^;#tbQ?&By2#Ys#nt3LVL7U9X^Jky10^y$3zWRFPzj1Jj)ttS<5MQq*w`3N4Ow@Cl8H6G{Uf+1Kz&3UVVeBO0b$kt13)Y{yae-5uT~M60aSoxe z^*O5gfm4fS-PL;GX7TZ6z$dv_5I{QzJ+Ql2WUuqCh`NJITD+$#ehU0pCbH}t>EQ6v zTUx*#87hiU9^$zCFhY3{5a(jp@RAnrG47fi%2VqL;Jh-F;`8>8j{YOg6cGNG^{^;p zXJ57ISihm8X6YFnb~P@W!9b;PjA%p>R^?$-#BgG8V0bZ{_x>1Hm44uSRM0|=i{(SDC(b3KLf?J?IDW`L}XR!E{}Q!ltiDn zj7#p|=tL;WgZ3n3odOO*6@e1%q}wGitS^BQmyj!IB{KLVDA8wrkLxp6)2sP?uA)Ec z9B1tf<+3Fdb{5K+T~vuS$1W&r7hD(_C}AeX4IatGN6RG#T(fb6^2}(NKe&UX)zL!6 z-eSwL5HXA`%XVIKv1$gnFR+~x6GM9{ddN^I#a9lHQQ zoKwnM)?_%ZVOBOep{V65HPnmDPlp=6^eLWwD8j zb2Y+icS+ovnD;JntcfLK(U1STUM^*vA`)L(*%tA;4fTVC2w z2vzQ7_(1NM4NC5~78I9Xge;C#RCyQU3ckZ2anm{_pv(Z#Z6Sgj?-tGDiC zC~l?CL^}iBi$8+0%S%ZA9CF3bOvsuJN}3=Wo={%_B~6BXpingTLeYuMR65TUBJ!qq z4;8>+T0#Y6dbU7MjoZ#EZvIimdZQwum$Agas5(`}&AEt%A)4NW+As^wxe^q-5-(k- zs%kIJ2G&ZfuISTAcTt`7Jvl&1rCb5(UM27~9>upkr2=SqgnH7W;!{po2}1XzC!H7% z*0wWc(?+Gfks+>5==q?R-6qH$E`!*XnW%!7)jD*k2eyS%To`TYVl+%WWzw|qR76sr zLe`w=+0Cuj4;(!`t9^PlzH?0(cz&I-JdBxptejRoQEYm4xprH`FQPM5ue>3eg}!jB zI?oW>QbcR@Zc_KTIm&=>UqLW`hzzQG1123rfV(21;C%r$L>e^qt*- zI5i)D5~t=Lpv0-+(h#|07$|XS=w`~&=~p3C-T$ z?zzr5TDWKRL@{9R_|j~GU4!D59!WB8P3up!qBGFam68`{>Bio)KFhj(hG#m#M463K z6k}xwlel=#i@L7|bvL5%l=k9NQC%F4>Xm14D=PJPHLeO(4@&g#evf+8qqyuruId_v z$v}bW{i0>V^NlZu^XogD;!~x{XdUTS!gih!FUmL=$LJ8$f!BK;VTE*tyLQKlPt`Sn zdQlV|HFO%uJw)6!t3poYErUic&l^0dkUc?R?>3LafCQW8=>uNGcI_C=omyy3bB9i5 z7E34rS2e|se$I7Gkgh!uW%b&`=CQp8*}Qvj?eKn@(D};nb+dUg_@iS^n-|J|-`C{X zuJdo0JTjK?ow9ZbQw%V7G<$dvL&O8q9qmh#_cm-@t843M;pQhAJhOy;JvMbs+H73c z7$g!4#?DD>-XB4U&0`!%Y#yT~V)KrHk~HK;6{V{}^E zfIfXzJy^ZhAu$2QNejb6`*ogfI~DFa0q1wI<{R;7+Zh6$I{rFzBH#8{tX5mv&Qr4B zayb@RH|Ftu4=k{*Y#RZztTmntN;IhylxWf{P@+l8K*>uX^cz3Gqe2#6w31NHk3juZ zrTyGXdkNHADvhD%Y}G?k9}lUtLHLyCav7LtCWV-dLDvdytFX?Md1lC*YJD0 zxru=LNaMAAEbcP55}@CQIuNVxtr14V2tfvJCGa&|@7$Qe+XAUAATD=M?|i4|2Jppd zK!n6@1Ok z<{gDA#ixwn9gpH*PWbUtD9*3OUmy8@OxbQm;gqtG(A!l+*Foz(RW`AR&-~v~w&p$S z^yXMGWuFml=Oh4Q`sNCBc|+r<^LyHTyjNW2987va zekmiI*}ufW!h3aZ{6-VzjnotGJsbS?L3KjbVo>rzpNa_3Sz|Oz8)o#XDi99KOy_X& zbJ%(eFZLu@>F6{ybJVdE+&DTsOAJ}!0MquO>bQ=V1*T09XOnZ6<3PIH?6Bj)G+ve6}1h4fZ zCtT*dEcLi!5DE$hv*Zv>Fe}J;%6+H8>)vUGvv5gz*>gdOnJoh){rntI($8N7O8R*k zT$wg#_o(+kaaWL#^*L0&nArkQVp6a1(!S!Q-2&=koTA*BYGQy&l&wY-Tw!_0c?~tI zUr2BYlxXRX;`O7h$ke7O>Cv+o8c|Y|m4l;r6>kc~#%N_~>tL*RJ5Gx;*O5P|D1(F7 zq=}ShhiV9XJc9G^;`xy)qXBubp5ujC?mAmDIB%@8RU4WF2j_cV%B?o5K>iUA$wa1g za9(XfQEmq3&b>mfqy5-tQ5kls>RiM7Pryqu?bHzLd~4nX~r75D;p%urQV@`p6Ag`nC5@XS)051%qkimCgFL*Mi;l1i8(hNty($n}H!kujVgi>)d?evL&f}1{4dq*`M4iv;tUExs;po9zE zWudrThYSz6?PGis8u$GmZ10HoeUjf1(p$8s{j;!_R*~}w^^&_h?v9T#ljeELumUgs z%ErGl&ucr38Nn!V+Ldqby{*1+{uN5M7EK+lQu8h*^6HOCsJJ6?*KsGmVb2<|Wr)Ux zn>jjkiZfvNKI`Pek}@XXl;695Ol9lq9W9_Q*egV7SBS>$9K_^HK0W6 zxU62Z?mM7F>%I?)rYvN!^AuYdf?kP{;RYG9`O|1nvN_Fo@9O0qRRc=)qpb6AdqIg7 zzY9w80xP`fFL~&qY`s}eKDH6wtTq@C^Tm~HUj45_Y9DjZ^(pf@T}eo~Rz z#YKT#fb4UkqfzcwWBuJ{fx#Je%Sq(wwO9}ur%|1Nt3eONl%=;Rv}GK`t`_~)?#|L~ zY;a{n*FJonWH(*JCs%`$YgS>W(^47pkjkJ!&(k zLY3A6>bSatVZscYA?yF(Q|@5cTGAc_HC*wd@shN?po$fj-+~e@{{@Qo_Eo#4GpBv6 zWB8PN``}4(?*LHp49495sdA8|(=sdufTyUZA?!OzS8jMS=hI~ci{8!v;m>(&bGjq( zkCCGN6*7=|p1X}j4%e+JbxIt4D$R2;+<@1+cosw>B7}F8N0SMEK&g^Qk*d+BYo7*5 zn(`vhN++pRWT*&~pKCp2h%*|L3~cg2$-w4fP%^Mt0!nstSPn|=U`HaulrMqe9%mtI z6DX;>{{S^jNr2sqNPw19uKo;^)U2a&o!@%K3zJ_6f1|YxY?Ky-#NTQwgma{}WAv)} zL_qlR(+xnnn@4bL%g%~5u0xIfHBR7<0hD^iaFiCGi`s4kH}7qGdL^=tNRn3)LkGWQ zs0?^yvy(UCo1HWyFGfmmN_yDr#Pvtat@-F6v`^2a3+#3Ov;hCMpU|{(ElLe$C~hR0 z^!C>lUa=iaq|eSRcZxFY*t*Pe=aQ@nXcZEtV%b*_6EfWd?A2V9RaS5_@59!L&Qv7a zAWUXs@$^$$rsB3T*X-#hN583coU8j-+0oOr4ECYgU2oCQbaqhiY(&=ERRQpF90H_L z7OevbNs8q7UetROC{fl4phUf=fD-k-1eB=vYEWk?1^!P^(l_h_CH+(fDCwvE21@#= zvycPnO{Rj9JAUm^>|vz2FxD?QI0{Odi|TdI_)zJpytec@2Vq%lMy}9DV}4^+8ahI6 zfaHzHaS@5^rLw?KS~f$-H|41N|{od1e#z$}F9I*hCCB!aIyza1v5r@cV72QA`rN-(#B%29uSO^16E@vCywf5L@(m^F}A+S<#rS_7WtHq8e-&m3E2>7jW1^-BNR_}{OG zMR4ulzOKVS8v`2nk#pf&U>^!>UV*>+aqhEYYX4SL%Fys;_P4AuuT=iEw(x(x*5czC zcl)xAr_>%1#jrh;)fY%%MlSAA4VYI!$UR7fb`@NirEpnslSLtX ztjEeq2w!xCz_GFx!v9zcWZ^hphp--&I_p;08B)Eq5`>JyDTr|MjDKoc0 zxr31=xuXq~+%Xy5l3cwUlw4f|O0KR0CHyvl>cm|b5rC5J{60|9!SdBn;W7f0aLEBB zT&95%E_{hiaNqZEKlO0Wc(_vZ%n~!)0!r?<3zTra7nE?`14=j#M}H}}^Fax2GAO~Z z+n1|9^se6TUEKppxNu=fLJVghs$EaN23~;wn?auzCLTW_!XR3<>p;WUw?ftTl{kO< z4XVyk!wA}sNgRTFw%~g=AvKDbo#};ktaLY<_kfnhKAmXni*|D!sML85i*?*>*PPvm zeQchCd%E!RG-~!>2O}Y}tA5FWj!C$LMHadxsyPZ}n_H%<^#ovc3sQ0(gG}B^vclP@;J!0V8_JmMeO>43s#v zcY73HLz8=n7V1M#UZ4+K;G>sbo+a1Dqtj2osb1v&M)Y7;Y z-CuN3dq$$Nuk{&51y39G`c4OT3t>e61iB2eNY2^cImG$n4izioG~fX}mE`W}!wH93 zS^*dpL#EJ0AP__uCe0_gcR&FE>b?cDti+qo$kuBA5q2?Lei6tRtXAL=>Rh%R#T+ytC;qv-01saE_?S_pJsHDaH%u7~clA&B8aZ7%VPNQv!4sCRsC_3HO{`ZVYg@0L z##1nr48z7nN3cnpMT8YV^{RE&{94GVZkKt&3uNBHLYEiDN0ZRYayHUdHq3qXK@DzM z9$1D`k!3U;Ssf2cHdyC6BUYYM&#Dyjhu1diJMs}I)l>RrNeTcQhJGbv%?CA5QEXwd zi#&&o5`<)2N|p-#6x2k8dk&NgIroE-KI$z{GUR*@l-$8K`EBGVWQFi4flf{p4^mv% zo60jT0QC)=dRkb$Xn^+&C||y%;l3coE?I@Ehj3Wvt>LFQAcDqhRGq3dRMH}eTA%9- zB9n)Z4|D`W(swyW5wgaMo#~w`yIR$IsQAtepVB)QsyKG|>o)?N7|Ygz19L|dhq|v8 z&U!g;X5c+bIGlY)4~ikm-4*HQOa{mPU4!HivybgS=XU{81PDD zpMjG@4A|=$j%0EdQ1^u=t|_1x3h^2<7gAE;Gg_u~p>jLNbQOm-tq(yHr$kRrsMzRu zR5-tnPIsktI%+TB8PU)4_2uCS_arELxbuWE=L9!5eV7|OpU$A2oUhNJfKoY(1W4sj zy+zSCfs#Vs>ZQ>-NtN6OO76wHpf|B84UUu4g$!w+$!bpktr0st;&n|p6Kb~6Zhj$> zUewiUr@t8euq6J{u5AC<#0BLH>Bx-lX`nuV4A2UoOWv!v`e*U*!mk8}@Y09-%IDC? zKs?*-IumzVZNu;(X4A{5GT*!SN^f*>d>p8vx$a<4FHe}PM`7Nqp+_(Zt8#i4_=_QD z^i&M_bWmc*sWW;Lc#I8xZ^s7Ou`eN_@+J6dU&=smkuSud!`Op0m|x@?OY|$3B=(5( zFV<(mnevN`=v=PP49q58eq=T)+b;5|frd>oOnFO&*&F#~7+vK6=N0B*P6l#{sVFsw z-d12w-XDR#r02Fg2+E<$ki4+R%f>i7NV>CGphPY(TdbC;sFtaymZ=%6grWA~{hVgX zl>)TCA57TKZ00()&Bl!iD307lt^mb$77b3I+EohH2Q+;Lv>J{ z@Ts82B0Xf~fcmjglL`2wCl|6V^3s|?i8}uPlss28c{L=X(qg{uC}$V2Mu%zHIAvK3 zHWJ~M5^ZYtAO!BBXSH0K_Q(TZ|9XdyG;ZozFQF}@!ghrxRs#9cVn(H)h~7;&uEaS9rmf{rCyDc z=-m2l*^TQtlF@Vu7#W?RGCC(Iqn!`1DT1kXr><(_1g2zmBq+)3Xi$>b@t`ELS9my% zHgskYKhX1Ok%8NlK5%ylRkO@|c79jOyzG{lY38Iib{eN<;CHi>c;FwZA)V~sj12GH z$(~vg5n70;DnMsdD(vKf$s{*5CXv2MWO~j7wE-m&^DX;g$du1Hcs{8NYXUw+{YpT| zBn+27{T<~ESyiBa~RI4bvi)-HB;pzktRG*D{N#dJ%To=3)?xEGCkdA{Ry1_U@*2nx*hHoOCF5SQ!P{QRZP+C8r2l_Sf*wAwLEbhRTuSb6j z-#Ed(C5?mijE87_Y>jIl)Cz3ZhIJqlYW`eGdp5p_X<%K5Y4`#tF%4`Dg1ZWomLMQ~jV>q*qyFC|v@47%{u;E5xog?SBV>hma$Pj{a zFCYr1N$$=jSHVe!Fy3B%vooCC5k#BRzF|#A`-Dp$Z`IoEvjd+6>CMif zs|fMab%m?z%!Xqx3Ginzt6rcU!YOvuRw zL}>!;uMFJSDufdM_S2XhhZQNr?1rP_BxWbnzY??K#71z;4nq*n65#!26*-VK`{-iN zh97`;l*O>(JAQm=8kS!3=KOMn+xHGg>N7 z*8P2!+N_RUIDC0HvWQG*4=?fEh3E^|SQ{2)W=8ZxrQmY63X^v}+7)(2s?_FJ*I~>v zGZVvp0pz!K{vZdLk{AVt;F4vI2qdHQO66*Um(~PIDvecz5@1s%68vzz01U_XM3(7@sylJw z_jV?&Ipm$Rr9RdWOTICyEWA844WaAX- z8Bo&m9t0)*_dsM%ggXqB^xrw44&n@1*Wgon?Iuui@29p>Z)TO6t)%f0TPf7PVk_@g zLO22rB7~DXAz+Q}yZFNXlT(iO0K$l3UXl7qoNI38HlUd{MymgDgSvDB|AdE5y&;@g zcvpDnB>>nD;QL+p-iq%J;QKy&Z^idF@O>Y?AH;Xk2g~qo#m_az@K87jh1p2X#N}-M z`V(7V;?hjaCa~psKWM;R=n}qfdV)D``zA6ZBU}z5MDc#*Q9eq>-;!73dOJ2QwmJhV z=P{FJ&Zcp=iqVGrxG8^4W4|qPrW96U&`_^w@N4>*>T=t)jviuo5g0xM+Li^IHg>bb zdp^!o_#rAEMKX+xsa%&$ZY>L!>~_~F#~M&~Q&ETM=2TnUI3Ume<}4e%PYf{T(;!@> zUfL61o)JBv7J-uXya|-pf;&KoE%+fQ5y=Cf#FyU%ip2_9&v|L|`6X>QWGYHZPd~v@ z$SmkAthB+q44jY=A&U6o6QLBPH*otG#HXS%NtV0&D=rur^&q}w4C&;*ShSsiB@EXY zZIa0f8=J%+%~Am#ZorNGrrL{h`yEpWU&e1-u#FI*=C-jZDjN3}_Lt?Uus+~PMrd9S}W+necFXqj63QAv>I<9DE zXt?5a&rRYNH=m`506*7Wm`gp7NApENW});jB~`H#IaBZSo{QTK6GA5%ulrRzOxd0X z!rh2QiB@iqCtnF?s&s5(?wtxe@3-(m>s7^YK}mEZ7{Ajs7xlUyPksg3W}`+wK&EI| zI^m#}zJm28R6`ppQ=IvtO744v{B2gsC~@fomP`~QNrvW^fRd2FWuRopdnYK-r8ZEa zOK*Y_UFrlS=7AHi((Jh*rrfa{RH4$Zdq5q)8M1zXPx)m*twDw>JOLc7{4S>h!~JLo z+oz5Y0r&KlAZdIUSr98SOlYmjVZ%{P;@JMotj3iUI6e`68BQ`q(XP$$MC{Q{?*zqDH}t#^K>vvLYb6py}0#DO75i8ye{ zwL~1Q1l31X*Ox#^b$tbtR2RqU5|3a57B2rEYi9zdQ~Cb?GlnttC0j^CBSNxo$xha6 zQ>ie<%!6Ufj9Dx#lq?|>X_d55N<|B8QYkGG?Nn0vwl6Ae>RbP7yYKs4=bUGze&7Fj znP+a-{dr%XdppZ>o@MTV5@&fBN}OfC)x85Hp2QU?W*Q?B5 zF?fX++&(x0$}r&CgBMlswMKd?fd113T+tLPP9uvpP~z3$e?oPfznc=jo7nsv8^~IH zJ05HJX&OCyf_I|8U!#G)ln!?Rn#1Tq8UBvv@D^lRE z*^Hqqa1(^`;3XE{twc>G+&%yZZY97i1jq#U6JYkBfT?N>>^hj<)7b}7;D6{noqZLPzu&Uw+rRNR>|}D285&&NjH_wapg+TU03;A+mpM1Lhb^dCAkZOpu}C6 z2qo@9j*a1zn3DtzN%QBEq4H}Q2doUX0VfSVk|HyT_Y&yzh)IT4tV-U zcM9M&KlzyW?j%@L^N2G&vNl)#R=o)BRLb*LxGnG~-Wj=vdU+O<_-4R4P~ri?CoLSC z1SRe(9+^0X*Nr?vc-@Ex{j%OxD9LUCV*&bUPmcZZ3dGTv= z-xWrTHU6CvUi|L_*|`5hp~U^d(;@fuQX5-hW5E-d+zUzRz3eE=ICQBzeTBf+lX_qA z8_vW``FqUg@iz<9gGA;~Yrj(fzNEJ^+(=mhw>9$NgTLS7da2iY`T1}=$bKB^J=}>p z!fV*@(lq^90UnURvVcy)d%Hx(9k7tzhpLiGuUi+d%$e7)|T`&FM7Ya ze2RPl@StTM!QXFN_-*kuK;sou@9o$dwu2)x9#ir9iC+N!axzrHw-&VD`Q=O~;VmXU z9^>sKE-ix+uZ(M<#N)dcN_>&=sja2gWa-p`Z{^}u^?%$0VWH7Z_;+z?v%lkg*P5byzu5j=?mJ8aM$8kV7c)PIC^mvdbjLH z?q5;i!Z+sTSvP8bEZF|B%j(h;wtVr-ee+r^du4gqcE28gj=VfK^~}A?-l=xZe(8_v z%W0jX`%(e=Qa#R5$=<(&k)=Hn4o!HGz@6=HJ63EvyTZn9hY}ADcH7)?#6yVeW$>K4 zD}L+CK{#UML*Hq-@GSyKz43YvULN3Y1MLUj)?p@&-v$Za3lGULIH+su;yR&2%9rb* z+J6i6(t+mdZs{GI_!=u@f_L`d)i=CL0B<4iyEgIto3O+F!#8ZgK22}f?8R+|CDhw| zbMZ^qR0>}SUy19%7fkLn_ekNjp8O@raNNVULyv$rL&F=Or@^=H6~f;EkZ<5?4$WFc ztLIE8@zt5T*P8(`UQv^w#Djc^jV*!_Uv932Qg_<@@U9G>J9k2fFFap`5?^?}0VO8z za+5DS@%Ca@V*h{=zd^Gyw8%{<9qM6T|G(V~hd1e)dFEv+H^Y~~4mvjpzR9#a?2473 zHC6_TO=(Py|<^bSD{Z zVZcEf-@jv9>kdU2in#6nMD&`KMVbSr0a#S9bn*T;KF5OZEd7TIHANO`8@o{9nKG4^ zy|nB-34#HB!9q(oFv79_4EWU$#*3FBUR&@8;}r$(|Cx3)vu*7h8(RP+UQ~Ftz)!%G z_3nidFGJjcc^U425--CSpv1(xP~v5X=Mr9q-$03%VM5siuWTRqFKj39FM8|)9*KAj z?Qtm?N?R%BCz|<)zLww;68I%CiC#RSpC!12#11AZmh~!jNb)MSOUg$JJTscDzooc@ z)Gnsr$z4*rGI&t+a6HX6z!F?S;*}7AZ)!E$*_PlE68k~~?jL3wXbCPM@eUKis(QnY z)$vlMl=n_dtLL5Ap{{r0k2Mch-&b{K<@`z$FvB7^7?^F4&BP_l^Z{o|sqCffs_mr| z)$&rZPViDX)bvu`IPqxR!?i~sjWchy!8Qw*Fv};L1;;k4yd7J7$BS z36C>Oqw0OgZMG<%%IqT&lNU$RwS`MK$D9{)epX7}nvxg#0&Vx8?H;xr`huJB!T)jg zsP>}=&VkvY+Fy@Hw|bISy+aMJ`l^xP+^Kso*Mz%0H0v6)=IT zz_~CHTm@0N&yi6LuL4$M|C|Ho4X%QyylFNsBv7j$Dld;ka1})5y-@PTUjjdgGp zMCG4A`4g&?^{RBJ=2cn6$ANa(3E9rGD}YNlLX)^vr$81r#3ph7O{4K%#mDSpT^J31+ zefv{X-q|)Ux|^|xmzT!^b1o|-?_9|XnP9BFe>K*a`?gZ@FQEJh@WqkkpG(Z=GcCN; z96KQ!{-IJn25<>SXeqY}XXqHuz9F!dbr|Oot^+1el?Fd%i^_cs=WblqYkZ`pmz-6D zT4N}km3drUOrdIlNe;iG@?X#SlgoI?9ja4n3=yyGOrQ#%$eJxG_gc;k5`Rlz?xZE! zf%9U{&rMRR)XW_=uYUx!hTDVV!()Lt2l{3|s=fEvyx0IUhw<|A9AeJ2Qu5-TuZ1hP zz;$y|G?8tLT~%Ddk$Hq$!nVpe6P4Q6|*q(9;`|@I_r-r~<)?rV%ggs>fRsG?|Y*D%QsGg>X6kF~5odf5^ zoD)TfzoPQK!9A^(nFYJdUsj9t(VfhzoF0JBBq{)%&h#NQH}2Ucqb&Wkzc!&sOtD(_L77gc5~;^pPBz?{oU z$@>fCO{ksh)rRLBwL6^P)qbPuVR*hx^EKBr34V{Yv&ALs$)9c{kJTitA+VNpIFek# zkz@i@_xeUMDt8&^96T=oC2l4!_SpG52hNK*{m)jT@+MQ>ga&2321QBsK1e@u;RpPd z6h8NH3Ht(1OYzv2z#FkMv z@){gD!K+>bSBz;m2k`k6dgL#@Wj&rHxP(VdCQ+5`Ygv@XME1b51YC{!32XrqxB|F@ z?o43b4RBmETU72ToEs$mybzRZ+JW<8PQ30gTU6d$n-^7PEaK(mvA~?Kl#;iI@+MR& z=T-Wo{Lymz;5owtZbvKrMUOE%Q(VGcT+A&>P4-e@KRS6=9j{heZMX)v1%=g#Bj{Rfl|QG|FQYdw>!* zlNY<>+QB94HRr{g_?o%dqVnD-dEq|x5oi&#-TPN<$NUvwOw1PLv5q|G%A=?{oQbNz z)kjsY_EtU<_4c)JvK?J6;ppDQbcM2Bg?8l*!>o)zug3Tw+Z0Q238_uouX1>gz5?kC zfwio|k>V20j}TCr1wUqs%KZ@Mu2$BoRs=5?2J-8y%;T(ce$0KUug6jOALAa^O7?1H zRe`;zvRA7^C9hTi-(A1WG!1@d+n#d?`}UOU`H_mGH3ZhO4%^5j>^T#t%Ja1>D))1o z8EChQj}`7FPq8a5XT6s>+blY*G1paek4Qyg0J14O~Jm z&WkxyO36Ebdt4{ks{{8t>TIocxXQjtJ1gWTk3g$#_#j(>?KPLM*F(8g$?#nA*a@%? z@I4PhVM|zxz2*}3nkiIG^v!!z{!yyeCNK8dwSi0M#d$I3tWxrhk-U%z+U@PsXgB7}FC}jl}9OXe92eivDi zOGxH3StSWx9joY7X;d8ItVM;2R>OGwV-QAmfcfIm_J&N&$KJVW7(u@+YcmvD73 zg{oulW45ULmvVlQn7p_;TpPHAUYr+mmQN7GDm61-@A4?>QB$v=-d*nzO3f)0#m_#Dk}dckv%r8!qJPLKe$gt<^MwR zLn7ErUYsdbV;{MMUfk~BJ{6VsJ03|Kmk#dzjZ+|p*)F!D$t83;#;w8QupB)Mfwio| zc5n&DlnGSb4L@d!%6(jV3by|$H|E`I62tGP-1zj&y^dtsjHAeE-Fj{_<~&eJ-XzLP z>#?9rK8nr0gyl=@2yzKsDsxM4+~FBcIe7+UC>%T1;@EKs*CSJ?S_D64i^^Y9dJ28R zcZ~e2{FwUzlN^3W<*aRtCLKtF-KV?y_W3C#O&DY+ZD+()WVOAHY&HxsBz@f|s$ z+MUX|LFsP^t^ihR2hNK*N0gEmo;JzK@{dKlygU||)Bh|Ws=aM&UK}*DKH}x&^?^C3 zl+xZ#ls5sNz4%@U%R&>`F14$cOE@y!xivKFIJ>a8=#l@%8|yI6C0x5qpvr$Pjmq6e zdJ4Ak4Dz4l#=K^IKvBHQ+7h;VAm@gcNK=l%`_*7o`6=CEZX51xOkwWEzR`?o`#I8f z?xkssZUb}ZC9Q#+u~PD;*}Q<+v5uFQ#~O1^FD37Vls92Ok~aXZ0MCNstoaPU^=Ks9 zWp)K{2}g1QlfJ82|Lf9oEx{!uCNUA`weNYB;1Uu!OjJnpD$Fl8g6|*lxBN-Nyvr@c zC8P?7YTP!-YkMpi-Yrsd3nVW@VO;1vgrGEIqFc*O zI66EgnEMRhT8e7-Qrm72+q}9B%%K#&bKRoOE@~$ zb4%zNuOggN(a%x%Ki1;Ba0z?L6z0Afe#{n?f35Ts`c_mC&Z++~%>8UB`5*Wn@?-9|OUeHT<@bLws;}uT{Jzqz2rl7@c!G!%;m;LS zNLb|Y-AuSffCp=vj@P8gn9ff%9U{+RzxYMYZ`)*XF=@>x|6e$n$t( z-sYv`E(5o)+;ciJkMY{fc`+w`qpjJZ+MG;z6DpVWDi2kS27YfK zm#{BYxi$F8m7E_8fwio|+2IoQlnGRs>qaO>=B~xL={aLHc-~c&T4N}kmGk4uWeQdJ ziB_|5J&qEWuyytANcvl&HLON2&Wky>l#(~a=0$fi9`W+>cwo-IO38aF{+%hN->`SJ~O(685+iXP|dL;=5kq-H-4Zn|TMM|Jbv{(p*Bi9n-b& zT^R6_RvzAkk>u5C$M3@M9}$;YnoCG`@p)GP@5l?4%4t13fB*7as6-!k0?x` zY7YFEEh_)ToZo}B1Npswl^=62Hp$_4RQ}5)Kg&$Jaiy{v`^Y8i3%46{Zh#-NMde*Y zdFiu}a4(`d?3dLGDo;S7i^1UcYCED_Lbt2AMR@$j=LoPF0&7`^ZQ&A*D-)531sU1xjCCG5{S z*IPIO<7Nn~WgYgGOW0c`P_+eq%odgVF3w#JpKDj5yoQLEn+a6CX%fTlsN9=mB%w?H zDmUgm!8e*wxgV0;JQk+SI7_V7t>-pl&S|COeaz;?&Y5wJmzT#GbJF*>Ap%=ed!M4b zrLFZfcJ{f1y?BmW6lblo4riZBIQvWl*Lqa$msD^4Yu))f2hJN@>rr|4QeJ*WxZXY^ z#J};5Ep^WbbKrkwyWaMlOW60fc+?t~^BTh&q8q|Fq--D7?>89yzQK}QLh>M!cn+D* z(t1APMoVxBiNib=bYCMGo>5dHy`iw(ti=)L5+0?QLe*^eFSmI95opHzQvMULb4*0_)gWp`RQUGxz>_gLb5uMbloWDCqrN@>u|2Qge!^( zRBeVIvqj~GH&Q`=8jHl_#W`{Q&Vln{&SAbeiOSoM^3pRgc+OLKRq_P1sEQA=-D-Qv zCG1NRZjJAmm?5y1b=XrbVNaPrRT2D{Eh=|&&Q0g0D%27~#LLYDsy3R$@H;AZYt9X| z{+8e!hVclqHcMw zZdL=YZio6_-Gq7`e;N}$r{nXx-O^k_dOXur61^&)B<(YwxjoV6d55LAgcQEv3-;mq zmA(4MDtmR{m9px)V4o|3&*{K>B+J5QLUA)$@N+rLrr1&{lsF5j{tK_>n=Q(3D*K7V zHnC+EeS<@l)zaZ!2mx%YU^gmbfb*DQWXo!RcRz2_44ekN0Kp3yHeDEz+5 z(p*CNQld|+4WCgc;Csz&Ac{5ay2Ae|(A_o%mryyMa?oeseC=KWHD=pjDJ~&(RU~EZ z-yyltQd~l6MI>cjV@B#8OK}OQ>zIl&MrMCOdXuHOg!Ii!C%MmYoQzW0?z04!kXTOy zpRst-4S}_+!?nRB+}D{v)d=`8TU721oLeL&FRni4?;JQU=JX%oqVnEPdHv7ftC?oN z?+&(?T*7{AEs^MG2`(YAoryjby*|e(c->&vkoTzCZ*zLh=h?|-;1Xuo!5OM1c~#+i zpsKE_cr^JifB(xsAKBTGTtadek&Tn_Q}a0D@R~L~@@i)t&Iy-L!33)2i4uQB<$i^8 zi^}B1IdT5Zf%9U{YlXmHQF-@CUg*xhYBT1&zLebWaBjRFfcyP^0xG06dOVoGy#Dic zRJ%Wrc5@F+OX7_O=f#};eCLO#yr0;-*tvoD09(AgJkFTYe?1VD_Y2C)M=l2>VY%SmzDl^|OXs`Fj+9^Lci)^UEd7P?IzGj{6rt)NI`>!6hW>F%dX} z4=@P)KGRZMLaGr{^qfk6M~UCByCu1VWGa&p&#AijJRh_qmym2hWaBvZL0E@tmrJ;I znZUgMdwx;5+i-4B;$~WcYry$C2hJP34-%EP6XhK{^4!t=NA(}my5G>D-pJxuaqQf} zSV8X*ef!T2{5O42Zgx>HHXu7U+v}B?H$A^~c2?r-!`|P2Yf z(mJakmRU42hJC<=l9(_Ki)w3~6`NQ*IdwD!VUR&{sjA2Sw4PX4XoC20k;H`A=D+GU zjt_3A!Cd^!MmSd-X`Pi(ltFPm;w2{Zg8!ki{-2*dDHZU`Ki-^Y7(_7-I&cI#g>&k> z=D`2zsmN0JUy6#{2LEfWB9FlT+Nj7Y@IPEPF7pTQKWvkWd=3BWr6P$izynpJ5ky9) z2)@oTMn&*B_yiTf?=F~PBdv>Kvx`!v=R&~4OZvnFd<2R2z}>r=atZ$9EyfUR<-8PV zrJuqhZz6ndp2w}$tFs?=)D1!lDbxVfcT`&Hn7-#?1a^r?YI>pbLXDwD5QX=>qr8wZUZ~;KvJtw0s|D8&&LV%? zMhg6Pk;9w z%!6wwF#$&aw}PuX!x9T>PJo)k1X!T7eZ2aD&0$R~r8)1jaec#@+N4Q`M|9}lV#(^T zrVeRNg-6`#FCPNMV0-F9O=5!4yfZux4unAs9Xk@*Qxz+SgDF!tskp@3$jC*67kp*{! zHH}E~5I(}sUn{?u7S^0hnnxiI?K49+jSXv3NYf4;u@x1@+&nd`X-pc-hTDz5ei*Ul zu}6ss`2JPQ)3f#d>~Nk_NQ2pMo8B@TmK&=5>p2zvpO|pG41XK={`Gq!+KekOF#-F8 z^hukh-51V-t0FN0KL?4ft3K<0O<2>6G%4VPt8MNBcf1e~v&FjNE-Wb-jAPpWTQ8V_XgL}f7mZa$+i7bhlM2#-nd^UhzBprgU|bRdnHuPsk)c`vNNcg-Xw zmaqnAAu*vJKElt8!GpGkHJwR=Ubt2Mc>Kz+26k`AgY%Bt!ZJHYhc#WH zhSxJ{I(_|Y#6H-KG&`Wdu+w;#{M~$OI1lc9i3w})5q=(L~zNP{aDw<+J=3OiF!(-UeE6JCWd&im2EAG{sb^de1l z(3FMJfV*?ykQU6-n>6@cO1KV(Oh4zBu%-`b@LPw_D?9BN{0ipjOB#54BVBd9dCOZb zhBY+f3B9E~+YW92B&_LAc}hNJ4j@emJmPk3tG&a*dCrEK#DtRf<$P@S%WF_+I9Ht)o`8>q`_}ctpuein-4z~){G=gO-OPAls@eF z%A&Al6lqpUo~b7txGt=LT^IVb10M1CQ)fdF93X@JN+Zny(JamU5Dr&C&AFtR4q;rY zkNmWwPgrvvX-f9OyUU3QcvQw?P|kZh-~bu)8bg}v;Su+*pO+_Z3u`VQ4SvcA+f(7u z*Wn}+%!5bW#DtR9{6(ZGc|F7F9P*TWoiL6xjo}fu=yTI}s7Xw~_nPCC^p$_+r-s`M zhdrK)Jz9D2?P1LXr8$0CTEzaIK^j~;kjk6U;OE2PJQGQ?1Ri0Td4uy$h&X0u zk_M0AIL_mK=nE$z%;-PAXORX!fq>UH7nENBJ9khMBMsi2!g;T=V>ldaf|^OB$%aR4 z&z3QB*M&8cNs}v@5!K(lDy*488a(2m!-4~?_JuX*l9+(sjg9-@WwVEG2y5V!2AaP> zgU?33-clWQ%3zzPkp}0qK9ts^&4*G@lS3Lf2-3VSe?MteSTmh8)!`B8#B+yS5!PU@ z6BBSh#_f)l*S#Fp;1xn*LVFlM%(bscVT-UPpETI2a`4mm>rtD+ni-_QSJ|3Dsc_=z zQ^T49(o};-Y;%_ySKS!a6#fGZT$)3h@eU%c`OSarS{%+(Oq!OUsQ{%4TW^9XL0A7e zoJktIKaFkLo7WyX5!B2g4c;Ne>xAuJwu0^jHM2?c8a$SVpAElPe>|+2Lz+Z*#BKS> zPkbNNTnsgd33yb*^}P4{V|Ro#myo6rJmQwpcTB^u=2EChOsEHs*wWRB8SpFE=F3P! zM_?!odw=Dkux2i4mcSz(SEqG-5N0=+XC7(rD1>dE)3F~kFsQklH0GGOvlMK2EDE( z%>dC1U!Ax-tbq{ZX$_A!@2}M;`&L-9f;1)XgDXixXJ;tgvU?%yOu_bCLmF%k?mvJ2 zHluD>b1iAGcQ}T}+g}EQ5zMoSH2A&?JSLnrv>P03f|}K&DY?yX*#v!m4jF=l2gQe=qrvvvKpK4S25OpbE^|{@b0cZKghyP5 zFKt)a|>y*MRR&59Livu*OCSflvLAb z``Uq%p-Z6*x7 z=9jSMcG8$*W`i3tBHD8YY4E%Zo%U9IaYeguo;yji0UoiF&OOEU8G5cFrHI3 zC*E5rtht*sCASA%5)(GUBYO3#HT6(957s6oydau+OP^>S*4#rHyvJW1N?kq~zdNkC zmo&JyqSt^=7d{)-Y$8p`ZH7YLR2Z&Oc!wST^45DPv~J=2 zEs^CeQ-M)1APxK*){dnHoUMqZG}2{!VPMBuN*Neh3M z2>dlViPXl!1Z)j#4w2?s)scs`#5~*h+^CWVjjoc!U8aA>`B6V%#Es0dKksl;d z-$u%pixBayK-@|{F3w2=xG+3O-3X(o|zHqu`rXW7Uo zi43ukJc$gjk*g)r#ztB~O|_B566s zKNOi4id++lYz#%74MpAxMGl7|zl9<-tC)Uza;`ir6zLO+To{TJgd&SVk()x1dqR;X zLXkb8$iYzLhfpLLpFGIMGgvzs z%|@%q%a7$^=DV$?qiAlok)9ISWFvzma;J@)FOf@ZBqot!8@XH}^KE3UL{`|y;}ThB zBX3D$sf~Osk*jT_96nWmE#F2?mdGL-=`4}OHgb+cuCtMe5?N>?vn6t+jm($G8XLJm zBG=o!Fb3L8Oz3;JphS z!8;xl>1s51UxFfCOa$*{XsWh}v~43IJSdZR`8!=tAk@h$oKPT|F*$~yfGemGphaZj@%>)}U8W+L# z+y;5Ft)?TCaI+EH_Yn}~Hk;8{U?O%@uQCza_cKkTlNqt@CeqRLE7L?wz{3K0*~nlM zF`b~lqo_4aLYfp4X=@fxFB7qI(bGiQwv~SLwvmn!>0=@tO`g6c(!tDNKN~SUjhRS$ zqscOnwx(l~Y{Y0L+lU$GMkdnUMBvsNk52~^IoU+a1bU~Nh#j$(CSu#u%tShyHlJ!D zc1|anh|Pl*yv9r~M%jqjX(h& z9@1eS&!M~xGTG@jq<0ixuliHBadTCaSeNTa+SR9?fUJ^YiSRtiNL<@Hd=YpwO#EEH*! z*Ori%qxJ|z8s)XsQc&=kzIH*=+pO1DLXk#!J!~l)!@NgYeCnujwJ;NZe;K^z-#1^6 zK-A6Go%b9#w$6H;EEH*!*P}$4`5Ln^YrLbn2}K&^^;pQOw)ILAiZse=oAR3aanjX} z$`y(<%4>Vb3;ym6#Bf_I6ls*#<526?;jvf8oZ_gvgd&addV;7Fc*L#Qj@bv!uwFZb zB8~ET612|i%f+X(chtK=kw$qvMN~sHf^BirF-zK7uWyASjq-XLw9acw%GuK$Rkk*z z@<^k+c327(oqyf;T6^nNUntTjuV*ZU>(Fa)EYneE2t^v@wUa3908*2Fp7E)p`U*uF z<@GF4W*uhMyt9*|E)a?|%Ii6zs^cU4e6#b;gO17*iZsgWdF54gX@e^rwNNP1D6d^a z`RA*f9m89MB8~ETL3uTPy;96k4+%vY<@KWSnt#^Yy~bOwT|$vYdF@tSpY;8?yQ2;W zMH=PxlBJ*k2dUL9Q?1vxLXk#!y=*BQ`R@PC+3%>bbubaUnhrnu81)K95>hA*-`I0$ zYHdf=7m75>>s6x6+NfTC%}Lz!q2<2dS2qFi-jVM@_L;p)31q1N0S`2N+{AOuYE*ezi`WKc*d4=J71fG zB8~Fe4_bHJSeMqPlA~T0iZsgW4WjDdBmA`N|K40jeJ&Jfl-HZe>$Rc3e(0$3b)gbA z(kQRDAexw9jvEhVZ$0d&WR6ls*#d&;X|NA0bS+9(uhl-B{}wPyLF6&$r&DAFjegG8D6s@(dT za~<`$P^3{_?<=nlujrHLsPdQ$Hqt1s4^f{F6ls*#heVnA!gc7V{z8#P zc^x9k^b6Oaqb3SP8s+to^1^lKs4Ijbjq*B7lz$yMYQ0dTQC=S_FIo!gc7Vh9^QLY@|_M|ADAGZs0m})R{t&MtOZk z6gCBq8@LV~b)itCQC^=bFIuXXZMpSSZpcuOF0Gy(W1T9CfWwq)}c!5@qJ=*N5IN@2Jf}kw$s_q`Y=NUiorI zy(|=Il-Ds!LBXq9^l69P^3{_KU)g-l*Omqa<`+73q=~`^$SsEZ9KL4+(JiH zZ2*<9kw$s_3Q@Ns9QBq^q)}d80?xAO*R+@SG<4Kg zLXk#!B@kuK%LBeRez~K(hR_h$NTa;USPJX$dF2AT=IaPW8s(K}DO~gIa<1Rvs5U~8 zMtPMb%B+pFhfiqhs6j%JMtPM}UiV&lM!uu6gd&adN+QaP;h{y(COc}LP^3{_<(1dd z_bu-1sGEf%jq*yilo`XT>=-^O6ls)K1xw)=o;Pvk?~d9h6ls)KMWW0Ywt4!eIga{D zDAFjeO3G_S-Jw1z=_G75e6j~M%BwO_W(=RWs&Oyp)kG-LD6cBY>(t3ryE&?dP^3{_ zRjn7cW#bjYzdh5A;e|qxMtN0JUTdD1FxgSXLXk#!Rksv+rQg0_YyFPHwM!_{D6bQg*Y|~&^>Wl^xfvqBw5;n0gd&adYDAQouXD1O zdycAoGIiD?jq*BKc}-b&u(zYy2}K&^m0~H(yZ7F4pLMchI9w>wD6htr!qKR^=iSYY znkE!!lvfj?lDPvO-ZLL;y%q^Y8s&A0@@h9=;v0^-TPV^fuT&r!{UB8~EDuDq~cDc0+3p-7{= zPE%gkFGo!iiZsfr1yN@I>fGX-#zZAT%ky# zyxJ?TVYlu1(NW8VB8~FupuC#)7(UNY_X|ZD<<(Jn9Z&e+B1gR{6ls)KC!)-J-Clgl z5J!C_6ls)KXXVxB^|EapRiO#a23$jr6}G+SuRw+p&(iLMYNGukJ*dYn$ek>RsTdTZAHw z@;Xa-jXW{8nxnP}MH=PRgDA5OU!RoI-BE7}MH=PRQ+d69*)yj(>U*I`qr7?%W!A>i zKXrY~QI$@?arHdXD6ihiYjlgr{TtDp749!$J5cC?RO8QGW_W8s#-ec~yAe%aM*cDHRgIMjGWc z*m`08%S)c@*w>C>51~k-yoM;Rb#ot^;;6Agkw$q9CCcnyGuQO`!BKOBB8~DIro0lz zes;E_ZWM|%%Ih54FC4>y>ptG^sBJ=#MtKcaUT0Lw+Uclwgd&ad8ln1iUxSs~9rd$N zq)}cYmDi9Se}3(#T1{~_JdZTWYZOuDdgJwD4e#$~=c~O?q)}d@mDlcNcTBqrA>n zUX7|HG4H6>ZnkpQC=6?e&HA<4ovNr zWyi46sThMRIn*exiD>jq)0&y!PJp>lQ~% z6pA#;YdlfroU&!;ufrX6xlp80Ug^p!XA%@c|=%4>@9 zI_;MizH=0Q>l$vPQC``~Yx@}w!EKjvEcTuhiZse=Dp6(~R$IMmwWAIQMH=NbO?e%B zsuA3*F3Pl>_l}nVFuh(Y& z_Kl;`gd&ad%2QrXo^;VGjw%+4G|DTVD05z}RCf=2X4Z_x^+J(GdCgE>JI-4kbJRAW zNTa+8l-K5Wzv}6z_k<#i@+wqbp6ls*#Y@*EhtIgMo zQysNNDAFjeIm)X?nNM3g3coiGH_|Ati-|Jpu*;8qmN{y_P^3{_mng5@Cl7epQQr$i z8s&8oVoF<(>uaII5*kq)}dTl^4Di;HW`Dkw$sVQ(k*V zw1yjbW<^aFiZsgWa!X+!@IAMuTWX2HpjDimpy*AnH`bMead zj#?-bX_VJeqRjRD&=)`X;#50^>xCkX@>-_69vxn#mZP2)iZsgWYNE^-&OHC7d`BG+ ziZse=x$>%8u<;c~{VEh`l-CNP%)WfV-4||lRP9#0Hb|qqRw}QlJIa-FRC}RFqr9$B z{fe!4rK_Vx3Pl>_b*=KMU$)I-j>;2?G|FpL3H@3w6ls*#YUOn#wd3>7>pr1Kqr9%O zUN~O;8eDY6M7uU#7K${=YmM^yVO`NsM}007X_VLXA+L_stL*7KU!+l9Hz=>VTVJi< zs3t;@MtR++ygHR1zF?H~>M0ayl-EtltLggQ4IOonP^3{_Hxp&n{J2wgEOgXNp-7{= zZc$$Ec6;X~N39l$G|FqO?H3+5ULIWMZbv;N6ls*#t;*}gce{S=sMmxdjq+Nj`nCDl zzfv9bl~ANnUbiW)<(n?P$x-E7^DL7_d95eP9HU0ubjALWcD_=DB8~F8U3tBH>W0OR z>MIm!l-C{B3&-%sd!~$ZREAKbQC@c{uPt}IyvtEn2t^v@br(_Q7}a#o4?P@pyHKQ2 zUUw_63(~LhweVS?NTa+q5amBFpJ&JLW1&c+yf!MYZ@wcold?l3W@sp!A2}K&^wOM(s{CeFMN9_@cG|KA%qWtr9zMZe{gd&addQf?Nbo|qF zM^$UX^F9X<8h;X^+!H) z)E`2TMtN;hUJuqdw9!!~wdMIDjq=)FLce+nMH=Pxxbix=$*a#fuMD9`qr9FV%D)ar z+jV%QP^3{_Pbx1wZaC_8p-7{=o>Kk7lx*R#|=j{XvgzK8s)WywceJmIKeLXk#! zy{x>tPTIZRQ8R=hjq-YhD6@b4ly%#W7ufk)BNS&k0K&$HS%>U5z< zqrCPJW!B+@w=eDQsG&lUMtSX5UVR?h@v@_)2}K&^^@j55HQ=Nd9ko;_(kQPtmDewy z%oyvadxav6@_LIXvko5^`(?hPUJ{Bl%Ij_AHTci(S~%)+p-7{=-ceqo-k!R|QAr(n zzDT3I-c?>ZP8;eQ!=^%!MtQxbyzpG!78u5BT1m zbM5{$UntTjulFs5$HU$a+@9vByM-c+^7??NT0kI`{@v;Q9JO00(kQPFmDeA8%Qbb> z*Fup-c^y(-KkfL-b5ylXU=JHo8H~xN-8ix3qNB`Qk+y z<@K@hn)1o}*Es4Dp-7{=J|W7i`2j~SIqIm}gd&ad`c!#!|8~-)j(T1w(kQPZ%4>7K zU%qwJ=R%Q2dHqLuC0+d4T1Qpt%p*@4<@K5MLd75V@6Q=y*WnpLkw$rauDoVG{r#7Y z8YUEJl-CzTnR5!>gB@$VrV2$G<@KfV!uL8lYN=49QC?puFMO}#h1Tm{p-7{=zE)oN zUPnjm5sEa*>l;hq7;Y%H_ocI}*LOmZMtOZ}DcmbtHW+@gqY}GdCeI^{^7@V_^P1F* zS9&jWR9&G+qrARXUYj33@P(sJ7m75>>nKs?xN*^`w|(oVzCw{kdHtZg(qFIgoTDxf ziZsgWN21LB)qC`ck&em}iZsgWC*^hP*Hb@q)Iy<1qr8q0RS(7&N522iyQe$q7NJO^ zyna?*13p~R*il=AB8~F;MfGd<5A`-UYPV3NQC`0)uj%I=ndGPsg(8je`i&^Ff6e%^ z*@iZD9sVQ~X_VLR%B%3X&i`>#<*v92J&!cX>o`&Mpbp2dN`p#YIx1Bt(kQP#lvl-R zqaJir51~k-y#7>PU;Q%WG)IjQiZsgWzsl>-;|nS|sz4~xD6hXt@VZ(k(kQRLl~>;Z zT@O324MLGddEr<2@n0~(G1UFqDHLgxR{~L$W#rEsS*^_nIWX_Qxa<%QqB;i%O@kw$qXtA4eecU9*c>-B_Cq)}e@ zSL$599&KCWAxC{86ls)KMcXf28xO3>JMO3oXF>=z(kQP=%4_?s?^-#kolvAvUX_*C z_;Zdax^P3xpz#@~TRdInJlGeteCiHVZ`>Ba*I(UY=Q^r+cOH4tC@=h*bZ*V>+FJZeo?ROwg(8je zIzf5e-{q|*95q`g(kQQ5M44mnYvX>c;HY&%kw$sdR$epjJtfakFA7B(b zMjGW+pD42qZ|+<4j-yrxMH=PRKza3>kTu*)9tOv~biRp-7{=PEuZ< z4|#uvqmp`XzeuCJ8mWHudgIDON3|A;G|KB_<&{73>Vu9tPbktTuM|sRYrgKg?4GH1 z&CeBzG|H>7rSQmh;<(dabJSfzkw$qnAZnkp zQC_J;nf+_|s%BR^s%}pndD1AarpoKc851vXR1cv@qr6Tf%B;huF1~BJqhdmlMtL<; zUJw2(!(e#ypQS%IkFHmG?@g zvmMo`7eO9rlo$SG9=_f{#p1r1$L_UWgM=cD@;XC#&Ag$(Qb&ywiZsfrjq*w^n{fVp z)+=8q(kQRCAumT=ArxtpS3B#4d*z|E=T3CgwL+0bdEsAFbk{Z&e>iKVqwW-nG|H<3 zQD)8GeA&?Uj(Sum(kQQv%IlG@PX5hNyM-c+^6EsCS%+l~7XNgQ9m4}ckw$rSR$eXA zJ8pK=_d=0Id37PmzYaH8ud=;8+DN0kx+WI`gQKM{m*T*UQLA} zjq*BEd5s=4pq-<73Pl>_)txB+_59t|Ym88&QC?>$FZ>+6qq2n}jq>Ud^19u6%@K+; z%ByF{%TddOB8~Fu74q6-z19jv8s*hHO&N+dEB!0UH$T%*6UfJNTa;^ zDlczt!@C^yj!>jgUj2wN=dW$G_V;nrS3;3SdG%Lb!+w71prgD#+-}k+uK~(y#P3_@ zJF1RQq)}dHE3XZmPdeLV0sl-D5Tl{MwE*^U|`6ls*# zVC#iFKb-l{gkn2ixk8afc@0rsFAZ#do};c6iZse=C{gCxrgP3|!yWaoP^3{_!<5%s zsaq2q^{!B)QC{Z|WyUb|j(OiZ>JOnvqr8SIuK}w++vcc~`|{c#jq(~{y-;z<#cSKl zw`15>DAFjek;?15f%9*6)MTMZqr65DWybKcpFZC0sHH-YMtO}^UiTmTV6~$j6pA#; zD@}QQQ*}(PquvsVG|KB->pbPvYy7enj%w78N1imw>wM)k;b6u* zN5MzjXd{jC8bg#>8@<~2y`~678s&9?@>+BLU)MUXUbrtis&RiFL((X(@kE(*i2Jgm z`U^!G<(00ya9?)RG@(eNye8OwB|>v>Uv|{BLXk#!WhgJ)mmRfDDAFjeiMC$};FVGH zaB99C!w-cbjq=J=UdJBox7bmC3q=~`m1X;dqx|lIocW8aSIPj4!5I`a$}6V4=Fi;r zilcf7MH=Nbi70bzbM1pu*DbbQ=|Yi4c}-Sccx~gTxk8afc}*e8oR_bC=aXTMS}PQ3 zlvlR$YF6X+Vn;nC6ls*#RHDo}%t_z>k)u8kiZse=n({jMUQ=Jc{uGKd$}5K`bKH3K zk6-pUuZCyye33?ZO;=v`efYv7j_NKHX_Qy4^1|;3a@1I%NTa;+lvnv9vz~I)r9zQL zdF2yj)<(;PUAA6l*T!0*NTa-FD6hf2uI%Ed?Lv`8c@@}x;dqUBtIMAYt=F4Ekw$qH zDzB>79-rW-AA}-}@+wkZQ}R~KztVbD9mw-V8s$~2yav~r_P3)_gd&adnyI|-*t^Dh zwH1mq%4?SL8ngVGvmAAfP^3{_vxzcmK6iVAagLfQ6ls*#9Od=WEgk=M)Kx-}MtNOq z`-R8eM<(xH;HV8kkw$r4qP*s2KlY=eb_qoq<#nm0aBh13-TQ>=?HGO{6ls*#WtPGg zwyU|cwxi&WtkOmroIhXFKX9p-7{=u2fz**?rbIYP(RRQC_wNQB_-(K|(NBtrcX_VI@qLO(!>3gv*wrivIU=EW;c`a66y^jxC z?Wndwkw$r4MU=UhvVLi+_g7i3p+b>Hc`Z?1gL~Yz)=@b^kw$qfCCaSBg&#fA%TddO zB8~D|ro8U0lRm~#_X|ZD<#jbtW^HVE>!qfSdQB+OD6i$p>&=yWZgSLjLXk#!tsu%j zU(4+nRvW_eMH=O`Qh8WmuYb%XNyYG|KB1<#qK< zBda>yz*R9Iy;QlwSbJUkYkw$r~vlLj-7|yj` ziNi1k-|2}O<#n5-a18OYfsSe-6ls*#dP`weoUeJ-tCvuuQC_!O3cc`e>o_W1DAFje zJ1k|quCQL02}K&^b*H7!3*V3Js9S|1jq3xF8mj1d^~SWs(S2rHuRnz% zjq=)}ygnOs=f{p}IGkshG|Fo$Q8-_?HGQ?oyECoVnL?39c|EMW#vGV^+)-nMB8~ET zgeY@u^Y?pot2?SlDAFjeN0nE*J}38e)GDD!qr4uo{lYc>Nc%H<)I&m%MtN;hUSDlG z_NepPD->yz*LKyfju+lN)luIFMH=PxxbiAjxTcY#DvqG(@JOS)o={#jwtck2QO$)S zjq-X@d6hq5Zw*Hc5Q;R)>nWmeZQvMwdDC+n9hD^%X_VK~%4_BPHRByMUntTjuN}%u z&)0gPNTa--QC`!w?HlX7b_hip<+amNILi2$tXX!=e;^cTl-IMC!qHefZgGO6eie!| z%Ii6z%$k35(k;~-RbwRjdmd?&*YnEjqBkBZ@2Jy-B8~FerM%{K8aTvJgM=cD@_Ipe zHT=(lBaVs*MH=PxVhLVX2t^v@wOe_;l~UBgdEF`$X_VJXL{*28!jXqr-tMT!g(8je zdRcj0fAst}9rdL3Fqk0HM8s)WD^$S0PaFg}ANGQ@Muh*3qes0uJbA%#| z^4e!9>^EK?USqwk7m75>Yrmy%mZ!e@ET<_fx-C>&MX zIyG!R-cgxCp+-|5Dr)!3H$3Sm_y8+ysDXd5Jt+|^m+@YM|K%6WYTqusAT~L>uqalL zo|%!G8OzBi%FfG`s{Dey%vfRJpxo@D?2Mf3i(^?*Q8c9>mXS3oR$LfM%gYZ3`{WfB zjH2R#SfRq8x6tPFoV?6w5}#gN6q}u16a(jM=%>Fb)7ty=6pWM? z%tBdos>1y2+^E{T+;kaaa`$}ykIl|5k~S8^pl^lQGh^x0+Ki&2f^^fbSV2KvLFSYg zIEO1EKuH;edFkod)AQ5Qp)NPiD}2tDUIayMk94ms>X6F@T7tKkZo}C*R&X_IX z!dMZdD9(XN;$)D(h4Oh3rBiQk=%Hn_N;r}QGg6R;lj#dWf~;6kM&^{lqKu+gs1Bl; z(=xKMa8YQAY6@Wm>l$cd+PHKcgT6m%pzOW;jZ!%FD^7Ks{H_rUrCM0%MXkOdHJK6u$TLWnTN{S#AXy{;7-Y{mF3F+nVJWy!_?sZ zZ~wyw8T(&o2uJjU+HlbvUn6m^3-Ebx$bw{e9LvwkPnW}ri4+%3@rAf)(_(Yd1O38K zRxBsx>naXVek?P4Qg)_oD-KUE=5{%?f?YVcj9m?+%P*XgQ9uV(ZkwwF{}L5Ko4=ZkX`Mt(!%WV5=yoY$#F`@TOqES_Vd& zm|)Py#Ajvr4w!gO3eS~|26Nboh*`3A5mSV9x|I}(N}nETA5Tv>T$nvM*LN79j1vp; zGO{u=e2W!YL&rFM^n~_DL_rH#d{+a!NI)DFmb13neI*v`m^r~0%qh_8%vH=PP-{Rc z;>dBmMps3rp#>gY6i<+N;AGP!t#=-X3` zNw5-*!5MS>>fGY#=JF`7pwM3fO)SpMo>3h02WMsH;(35CTJb6ZE)?R|^Vuw1?@rp0 zxKzib@j}vEdis;&6G#GKgqzT<(5 zrr{EkDm+JmO?qs0W-K2s^3w}r1v9hZ0zW-7FDoV&e{ihL&CDo*%S*l(?3jD)$J61FlcG&)SH7df3F zg*_OMS1>v|cXCc__{6EPOp~E6U7=8l-o`d37R#41w5l&XD<~Slt0G=}P*$iWjaF=& zu+>8+SvW#2j2#deA6*RB5V=_@ISfPb^q2~zL3JqPnv{B*Ez#73a3e>Oz5!UoTBV}Go^;)IkjuR_zs10g7}&cU2}4) zGBbR`HOY;`bbmZ2FL(0P>G@t^Y`VRyz%rbrXW{-sW!z=#|MK%-cb+cIr20(UA*ck$ z-0a+GRGb_unn{zxm!jE)^c+SmL*cBGmCn!5a%1q6N=`MnKgv}HJ$nn*$+;sM+`>ur9td>eM{^=P4VSjk z;>Se3Ct{?=oq{iD_{?R4#kmvZ8p>tOfHR!Aq{JwJ=`lQ&_{JP}-v}$UR|lGb*W>6G z+CS6N&mPSuxPrd8d%_69R2I{%58fp+^YW%;$Gp_yT)6JYN~H@?xm}W)kGBzZNXcL+ z>pLlm2-lVX!~K>LV60UzOf$8V?#d`o*C+@Y6bI5Z0-1|Fcl{|w5fxF0xipQUY+V49 zr}P2DL<3^Ekr5D^Xh2LSnShjIa5` zb~6yHXTF_nY_OgOC4N2gZqTCn`1Q=YL5$|(*E8=1HJXoKA8+vKHdDN@=SsGY7+OCY zx0>mQf%VgItC@}%RzDrLn(2r^_0w^ynT{AzKOMI^FyOv>o`KQ!*RZ7Ttx#+sUVA9>juWJ4Mth( z2E(rnMp^3yz^@HPS?fCO*9N1k?PL#Oer+&n2Mn*WeAn*oToJ0^^f*YNDqeb#RZQWk zj6+3M>E`)w@7r0WbgCxMKvfrLp{ffsQPsJfD(q()$+x_GFF4pnhHD}qc}XGyGBw;n zx8{5=WC#^q$DCV#VJ^CkIky(WTy!0CZe51C=(@n5z`4u5023G$RmFC0w^fyH#(5G{ zC6n%0sVd!^N05Q0;&rikttik`RTaS8y;HhL5FmrKabbIr%uO~Ic#gM%KnnkBG*K-G z*O!pMn&?*eb680r4c`}uYJtBdIM4pN;57T|g0t+e3r@1XF0zrf3%Zxg*~;jq+Un@m z+Un>A+v?~x+iIrWks#1CrsGyK?T!bLblmF5A)}}FQEQvue32U6U_TXXE!Rai)z1an z>F3;`i@WIOqU+et9lF9?bY0}2&@BzWr`l_MFK){41iKRAOAv6wgPjUxC_xb21$nVE za%#;hp>bx{R!1*KTOB>ewwmcs*GN|(om!ZWevMM+_zJ$S%@l{1N&mKLPGmDWZTNl|#Tgzmiowk-)->DWmXlt2`R~yyf zs9lFz%N0>bVAZHT+PVN}UVo38K3x|a99vn-CHePL<&IYE% z43x=itK)Uq3gY$J3OIw?149;^p#%YEaL;SvWGF$v89LkNOK~!kAc!-JbgMdWpfJg~ zj;-CY*R|aDc(u%iSB2j-UM;iXRpDpj)iN8N5kDKRHZV~5VnN)S#(~Oss9j1tT4t?U z+SW%T;FsnCGeoao@a`TQVqX=zx$*T?1qatx#grRaUsY7|Y}>0gcEL8g!+J9vr>01LI;Uxe1{aVXEV-2vZ%W1ExC8iZIno zho;szrsGyePd2Rwogpye zO2JKtUgbJV$r{cRy~=f-k~N$sv=mgE*n6C4Mv0W>({y&fsTv>_f-23uNOy`sFptz%>_Vo#Q z&i{dsGrGl5O2&U6?_t99eMhjU(f1ZU>4Z<7}nMIGbBeC1xvC#@XCrDluEBGMNH= zceMYumHWR>V6P*%->9)6pA2qm`0x7C8?Q~sCktx$|7ISM@+;b;x(I99`XbyQf5c~m z1H_-@kflT|azURIKj>lJE@YunQRyC`deQPy^d)CQx{Sbnz`-Q5j- zu0@(&l7bC!PscZ1m6WAqjTw;A^WdpDzL)A0zxZEbui{8_x8jI+3QWJ^h;+x|h|I)u z&*F$U6CRPU`*B2OS(GT^On5XZHB%`f&V=W_QZtnzQWGan+Dn|dcp7e!nU#1dJ$La` zoXf1Zcq%=6@l>jVQJ?Qpdt0PHrI62E4YFSZV-83>7ZKG_xcj`AvJZWlOx_}5h9X?A z2O(U~Ly2c+Tq)st=Hu5hZ&rUiK7Kv(W;w^>CiRoaMU4 zoHytROo)tEtH(B)H3z_8Ewkp760GHkiC6po3b~dY209tKv`uP=CHtquH)tQAj%YqUZhz%=7IyQ$wZ1~Pe$L3Io#fge3$)+)e#t90S%Hz}` z0v!_h5u>Aic@e}Qj>v~tLR!QU;vfcbL>j~r!XTEA1+i5W?l8D25(`=gyngV{ZQz69<=wD2RV8T@7WdeGy6mcF;sHcJ8AT#skCXNIP{OZx~Zo)*4Bz$ zQOLmRcXq2ER7b8I=qH+ld7Xbr-1OyTwL?E|m{@?%mz8??F z>@(+l&v(w{InTMwnaS~It!`;pe@_2Xi_+a`6HCfUN=}C}lc z=gmt)RZW|9-hy*y&a0ZAL8z$u`Z>)To0=QvG)Eg-Hg0aXuyJkq=1p5xw=`C4Z&<&& zd0k`G<|c+&S&#-~T|+~CLv%C1l-7#0snzwPq<&kX>suOEuPtBQ+|amj^_q>1i<>qz zuB~0&6t(J&ur%-b)zN56{o2OXXv^ju9$0l@daq2i5%uS@KdTL9I;}XU2jyBnv>% ztv%%lfj#62p}u+Y!m{N_0?j14WgRKs%zNXytaN#%jVT<8&L|YHHx#ed zrghD$H)gO#sr%`f7O?4+y$}eNkZdL31)8bx&pX;?YWrD>HoBv}c}p_g+RT#IjTgmI zv(>mgRgaM@q@p3#($d(R+J4}lO+V?qrLm#uf~JP#4d5ATZn`Men3fFqZY!Ojwgk3n z?MDCLrnPA?H^8VR*)MF|QQwe}Y5F1Kjj083VbjKx%G(r+Hg2y+)>@ldqm9ieN}(Z! zR;YJ+MW`PQZ!$URCu)&3pk+rk?^tsd-|QMAH*i(v!X{{TYUQSd8Vw^Yv}N;}SZZrX z3ykhaHH*ohECt}IVh?G_)<~0_2=z}30@Ksd9NSdCrDbzNV{7Z?me#b)Ls3(#a?3WB zsoC8){^>b!JX_YL*Ms9N)!9?nHtBwoTHwZO+2I$fWrt6kOjU5GvZJ%Bh(>XB#L$A2 z;B1B9)~6A#wQ=JG$toA9vkRdH=#Z*jja5sU=51?gE}h`2B|Co%WO@Lo3C;rGt?Ms<1&_5f zrt7xeLCvNA4V>^aepuQ1MUCrd=USXWTeNAjSWpHvtlqehgW8!oEL*fWhH*(_D=S)p zH#V+rj%_)&Q3g-qlU|LE*V=lF%+TDL8ynZwyS3qkZN%N{*JIS^(XvYxU$>glvC-8{ zVy!)2DH-zCr$%s#%B4l8Qs20}p>YdySdUz7ZGxeIonI@4foy;z&4(MWsZ~a7?&YS2 z*7^%Ju3iTQ=@}T$^K-j)*OTd~U)^v~tf|Gj3Blsuf?jBKtLYC-%oe8^39XN|tZr_- zfTMP;0 z6SBCmWm8kLGy0GivDWpOcWrSr5qc-{hg4NWVQoS$-PGFH;OU?C4E35#jL6+&rujPq z>8xQbjhi-a^(w%zrh4;jEva?s24z=cCp3FO(=slWSy4(mX>Ht;N)J`i*14snX)|Ur zUVEYq5?%3WKwfzEdn>8adfgIG&qa-~*2Wo|qtVSWEn=0V1XOL7L1CsZ>MRS(;!JRL z<3$T%o7N~I^j5$GS z;^>db7H%Vv(JTnRe6G1|0cqZ1)zra%M?fNBRX&;vC!V-QJMeE;p0xYNrfxhrvf zuoU;mD9dUdD@$@#pO63jZzzG}8qmk1PTJXWiC9sgZGSwJ@o!~y(nds|Ks%{tT@s7 zq)j_NUN8E1y$H{JK3*^KmQ{3#QM;j!*NbGr#w`Y^YeR0Alj`?>*m}{{#+FvBc#p?Z z16exq+qrdGNy(&1SSdPf(!|N`deOW7qzOKVF*ami_J&{7EZ0UO~W6dXir8vZ-D3G}18JIAt)aWLwmxF9b6 ziDL{s&p&g8Ga6_ehZVtb6ULQ|J8hh^qP`*}%a-*P;DtDNzewN<1CKA6@Z71hBR`q< zn=6X`c9CVh0so)ksI~%w@ne;rxq{C;T31w*u9&`M%goi$)hp(0#-orGiyJp>S+TMC z!b_%4FDacdX~r4j$|ue|ZQR6}6_dtIFPk)D+>DaS>66MQl+CD|Ipfmt(M?;dan@Ob zL&yyB*yE4 zk%wBEh~FBNT0PDc)*?uAtn;h|xSoS^C1kn>ga7!5W#13$Y^lFfCDgK5s~MGTMR3Oe z_@Y*e)nqkW>%i7zZL}J}+-zN7ZAP5e5Gi1lSQBxS$?qDREvwEt4*pe$x!GE4#jFOf zEU;Evn-H6>3h81>ms&;EVrxBcjR;+9wc?u0E%>dKyROC6Hu0Z_ShK8o68}tVfWcn_ zjus%B5CfYWtqImxu$0O9G&wV6mNiM@x_QZr)l)o{xf^dL?$(NYv23;=ckW#+Yd&&T zWR>G!*;v*&Rv5o5v#6x789CjUQW}h%EP)!toM4T&W+JDW*Gh?hp4@4jlnLXz=^&ey zYHvL2tzx939Hp}fDPE2A>_|z4g&Ns{^fe>h)xgAXzXn|E)dfi7HpF2)6~Uhzn}BIX zdZOSdLRx2`ewgB@H5&Js2jn`*Det%i7?#vJ5Sm_otuPwf zq_j(Mhf~2d6Gs58jHTd~ezGN4C|$Oq#Rz5DwxW(!@IIRJ@|He119k}Qv zE0LfvMDJ@rYo>;d@Z1ZdmSU8+@QyUhvEuBXFNEjo=yP9W8WC|~iS5^=l| zjCeaXef;J%8`Ar#iO#lS=f~}29w`*qLz6H$PnYi*ri;I_*F9D4>^8E;yhqB_T(r}Lh^V3XRMt-S#&pQ~s zgOgt!V^q3+?7#jB+&ig!5sWc1_yzzMIKz#lzfvw)`0{}p?qFHY)5wUioFDZ!E%wI2Zxq<73ND*Iv-hlbFv{p(e%Au`mBZk><1qPN0Pe57@No?N#$ob} znu5Lt2c4h3oPw~a4n}}D`RPj&a65Y8qrS8qCf}XFJQI|jHZ4%V;yehi8VU;<|=7wxqlUnwx<4$hD7QpBGR%##j|!xBHf1Hc?|aDIHZ zA%358EbD7H=yGxR@%;gqHyxZG-${u70Wc$-=@@Z-eB*#QI|Y}my^TctSq=uGI6uA( zz+K!6AN!9zz}%gJ^W*ywFi)o7vZasu_e%$(sq@e8d%*RdrYOJidjJ6i!2Eo=;)deK zFMW5;K>NT!=f}tX{83X_g>uS5HNQ+1JFY7`|*9b0yrFWe(9Ts zfFA;rGfQzCzxnaq1cc6r3O5E5IB~!DY+uQQ&(In8C9(eY~$9-!Ndt zq~Nmg4MF_Vftj6x^W$3t%$gKjHa^&< z_rg~UhIfD&Hb=R7D!);{oSuTqmOi$(sSZXN{p+ISvss}=}M*2?_ScQ-J59h@KE2+%y~ zV3g56zkdbponH9943fZk80X-i8;HX%eMME4Rf2=gFMaHP&ID#!3eJyjE->e(;Iiq< zF7T}d<_`|8r~cAfi1l0?bbje$|8Wd3l@6{azO}$ad*P$L?Q$@@FP&e0uLkaOz3_z) z|CYn#`zCNd>VjT`zol!S^aK-&h0zj`i)A-#-KMF9+vWADa+A0nEl~ zvgyi?AKxc{`GSM<1 zAD1iUdaELuM!)o34%{bu;mg5|z5vXZnNYZXIQ;nD0Vc0jV7~3+83Ydo=8q08*aP2y zrRW!M(D~)}fj*Ws3Yb^US6ol_WzBNSYQaJ0$JdMs*a^(v>J-QEf?s|wuSfaep!4G^ zVfg{`NKCetnpH9|AY9LGS99U#9OU2h&^nrT};DVelgApK3 ze(9SJ+{#|~n7(y~$@dB1zHk_Pw;d*57jQ51!gnmv_j_OxDLB9U_G`4PqjAvrmER8# zHWHX$Ik=w2lV@LmxjYU!KfW^&Pz%hb)+uffe*DrmV!dUJ!$IfAHxvP905iWyaU3uB z@qHPXyBwS!-{%qkhrm>AP`=zA_^tuwOAgMD?|X>esYcpP+o z>H7r2CIj<`gX@cHKfbqs32q^qKi``O8$`@SMCr47KfWqpRyjDo^sztM0L-USaDIGW z1m?~ZoS*%>*TF~vaq{DP5x4`r@Ns!(P$2S_7$tk#O={pheXE+#T^yga- z-1c7h9tFu2z|3k@wt@KZOWzZ~{K~=k)d%gtAAxx{s(d}!m-ZOe?{U!i@g0SLuLARf zt%~c3Z^kyuT7-knk8dc#RshqIg7eGoPGGJ{!DXwDtHF08Fvo7^U3IsJA73RfH4e@% zeg6W-DqxoE5IXF~@UM?fV4ihwetcbs|65>gyIA>pvM;XybI`&0@o{|r9xxwX(mP+- zPRp8ugU*lde1ug4bC-kbgKNL?+Xu`qdf{7!_%8u7@lptIJ@L&3W~qboOW#~@tO4d* zDLB9M{Q#K9QgGSysL7F{L;sv+Eid}ad17^=U)Qzr(XDu z!;St9%)s4pTWc78{PH{O3an4!pz}-LH3&N$n0*eer}jI)4dXu?bbfpV2wMltB`G++ z^tA(XLkccieXu=z)xq$-bbfrd19xvPd|@Q~VPKxxqg?qt@Kv_M9^jz!%WplxRsr*{ zgX@cHzx2HUOyEkg`Sbk%1OtHCXDjY_{P^(==)im$2c2K~Rw8T^FjqLZp2kDZ0P}~# z;Cl_2IoHZU z8^K2c^QeRCX*@aL2Ivb8IzPS~gpG1A0>sHLzoUVh+za1%h(80EPdT_gJ@DNQ%)Pzv z9f$Z2I~a)K{L=R_aDVTG?`SX_0%q`y%EfZ=;~NIdm=s(#do=~|PX}g;gJXI6@m&kd zS9;-NcYg;kCwvwHTo8vJ-&|nMcW{37yA|=*0`u#`;Op}_tYhM!^Wz(bu;C6yfH?W3 zZw_$Fdf}@^{03ltkb?8$+Y8LoDY$I)L3{seU|#*armiRZ68nN>wd0`k%kOs)b{#O& zz9_IB?cXPXxyix#@ht_-H-YK%CFSdB{C5s83mlvuAMO28VD3E(zBhmgd|B`7$M+b5 z2LSU62X_Rn{pzFrE9lR0(E0H(SziTa%2x%}u>OLB&W~>r!X^XL?BH^6?U&zcfca7{e6-JB17`T` z5a4>!=cT}`cW{2`dkGvZz|8-e(Dld{2j=q*&W~>uXl?~2=j+PX7e9XaJsp?|2j|DP z2=UJY=4J=ilfK*w%%i>VHGuEuz)ZM9)0fvn`nCgewS)6ZUlj4L2PXF$z4OfjW`%?E z#3X{ z1?IV4_-euTJ76Y#i+9!g`su+mV5(AZ+4|}8!Ert?-%r8$@jV30Qz^J?d?Ud3A~63- z!TIqefC=BlT=!}^R0?ff)_%?#?Jzy^Q zHUzj_9DeD$1(@$SI6r+EfcQTKrYi;K$M*|hexHKNmfr~Yx`BB=1?R`t_dA%=;GpwM z-#rLB4wz>gTu<||Nth&6a-sz1$F~h(RlsyPxSs0cU10igAPDEjcRB)w05ki0it8zT z-vZ{x4$hA+0-DEwc|HZ_SAMSmb1(&$tv+n8zKes-k8eA|Mgwz`gX<~3&j9m>Uiera zuL1Kx3eGQmxj(e5p*ZOL(#LM22$&}vTu=Hk?mq0J#X;xswWPmTG!S949E<>Qnij!( zI~lkz{1+bvt^l}(!^CaNg2QW9r_QXXoW5k<;(2psoOwbl*0gr~#-=qV9G3U|>KeR9 zlz}~O-pmEl=T}spP!vSs-oVj}qr`a$x99hJQ(hCp3wCD>woc%qxFZlhXFDdn&Tsk~ zw&&rypPQO4Zfagv#1G*&@uPq0SP8CU$C~OG#-k7iJNsN~IL_?ObFEi#mcSD*Y%H)2 z@Y3@eC4RKyBSm5$-SIf+tF9P7$*XK(_Tu7@J+C-u&n(VA82;|yPDUK8u`Mu*I~78n z1&Bbe3J8d8j?T@}cmdIe+L`K@3XZhYj)>r#n4-L7rmg}7RVfK{$;Sx!hD0J-9Fl@) z+aKyAXEF+Pm5#+pcZx)*u@R&F?dZvNZu{Qo$la6wp4huTHmpk^iAjkgDYWemc1ban z?yc**Zzz1~I+?UZpwQwgBMc6&Gz5YJVacvZv+81EqVF zu#>UJ@&xDRs_U>=3VLCA=CD{Iy|DZ&m8Dp6bgYx3p{#l2a8TQ!K3n@~(WT{Uf@aIh z*V7)CZP~L689g3C48quY=l~J-OT|J3QD(>3{ctYWT_&}ZFB&%|C~>7)gkiK3(`9(P zR|dViKf@Ek;HXNhZ%5_Oy3P&5J>6*E8_T;dA9t((ouJ&|^gIPLPmmbyh&qN9AjUF#0Kg=olA&xHfZF@Hm%Z<;@Pb>CQ zmB%Z}Cl8;fphu!#q?YK3QYS@Dok(ROoe?|IF(ce|=-6$!@r98zwuu?ZdMY(p!zF)1 zo%{`A4Zri^u)U*pBT`CBIVFSR=PpO6?SK_MdUiBdYZLK8!4?&#-f+R0dnl?x@SJ zKEPDNoIz!ei|2KKph~=ITxCWg>y}H*4OU`n$c>Pngd(=kJ21(SL|6^#8fb9=UjD{1 zm`ImEQY(2qq$T3VH8~B1VEq^e8%w|nvRPOODTiv7LVkN9dZE3dxS;)|XhY40;tc^! zrG2n%KW%m;>ZO3$6`esnclRmXyTPi8SB5$&^Q+=@!T7OVl~QC*zVngq-1r%F^~*cG z90%*_rSUHBte3nj@8qifLTQc*A!(u;AtlZIrMRNYvHBpnSYvW4k2a#P{q69cPr#R5 zN_fxZkZMs~p|-t|g<9J7Bot=^nMe$(ijC^1EO5LlgYauR6xcd&b`^6VsqQ|aG|@do zM9EhMna%kPiQo2G5o@}(YCZ2!nvhyV zI!c(hC!#cOW2a1y#QK))2*vt7jIy+Vcho^Ev3(u7Pwl!LK> zWs8d^#`5?g7}ftJX{Q~PMXEcvP1{4Cq^2%sR=$Cl30yI^k{8@i8JhjD%IGBRCxQU&oENgtU}I?q7jLT5t*w68v^2k zTy@NvyrEB(2H16>YLzxvj&OD#+&Q)t*Xwy-CsD~XDIDo7bTb)oV%9B(!n1ggwVX?j zPHZhkWEQGMK>-fw*q+lp$gV8BpWbbUg5mk^N|Cu~^C&n-r6I_b(XKWbj`Fm5%z^Z4 zRB?fPszE~^@j@Sm#6CUOdJg9axK*z8J4ods@m8fGeF#Yh>V1*rUE;?_P8UKdu#Sba zSo}sqnkLd|kj@Zk8l*OnY9S2*Q?9idlBVxMNYf?s6Obl~bf*^zutkjt;kS(c;0TMT=b^FOCvIVL>R3 z-OA-{`wKel+-jJ_UE|#l=_5w)W{GF*$w|(G53qAU)K?$GZ&w8oPND?OTkeepHIieF z)h`4;D~_h!(Oj@Zv+*KBUWyISOI+A5LeI)hCuc10R{nJ7+6#uqrx)6l!yW%4Yb3zQ zaJ0Ap@w!Xx1%);7>CONX4PAV>U)M<;oAsqu0!C=1)!p}DW+JU5+7q!nbV3y`+wUg} z1%;#i8%yX6L>Y!7*J3xI`a2tvn*1e@9)>>T;^NuD$r5=}_1MU7Xf5|Z{KD?Dif zq~U_w3`uiz4J1t|0xZ6aO4Agu28urCI_ev#DSf*P-8QT%2KMYOVU~y2qUN26TifJ7 zYzX}x9*yYn61P{~P~`PCIwEmU9F!$d)k`)6px`=zgi-6N3?Uq5jiy$$t!+OBCMjw^ zbA#2U_|>Oi4E&W5~$P7 z{Eb%*mtUkMC%&c7k>jGl;hB$#rV4{ZriRZfE?&7jnbqka(Ju9JNIG!pfTX&_XS?cm zr{~898gEM7KLJU#H!tAo18t^i#xO{#K_flCF`gfnRg?O_ zmx);ieXO7?X!I3*z_9o5Enq*1f?|+?r8KWjScQC9h8Y6xb^z3Pa_mC~4{@R7-STnA ze5XwFI|m>*8I2@#C?j!s63tz;I7U`23Y@+aHDWANup3Gax!h@!JGJa1Y)C)t+`l{I z%F(27%vJifS}=qB$kJWYdgI98>RV*1{JJhujeB&>>Ob zjslI(!xZC*@SdL`(B4!0G=AdKLy&$+>E!rD!T5B}QzqE6^6mOiynPS++b%1x>{+CW z#D?kJK!a&pk$pMu!T=epwR2|IRUxggYC~}0dR$u78{kz!$w>!#mcsao;^Fa?A&k_9 z;cgLVOk{&qEmFkk8cUq#YfwnE0^!y&qC@1L*f0S zA$9C59&P{YpSLR)bfF5hXiKA~A*f0`55KWVQD$68jYGF$ceTB5oi9DV#;#|U~+V9S!F18^Z~@M(7tIZ)bL`m+eUl8Aaq~b%frfd@0&U!Y`ybp zQ|A`__)uk=Qz*g^ZHd6=9LpA@m2itN3P~V5#SvoV6!FF`8PJJaunt^(! zXpRT+WiikvLn@QH81MP5grs$Q6(k*)ei@P)=zWmX+;UA&2gGbP6NKeuNID??DBv61iMd= zIeD3cpaBw=4D{xA!#zLr%g3=vW16%zqy>+5Igy8(JPtN6s4bF3LYh*hOE zkhDZD^Q2FE(l;P!?QnRu0i`0%#$t;M;pijZyu|ZCX-Di2rXcCD2&53CNGw+})`^)s z(3T92@ynv7dqJXc5)gvv6$M7lf>^g0;bh93E&|YhiH6e5ZXWH%JAAD_!rnGoiYYnN zNuOi}95V$Q#V$xSkfo;@cswN4K=zBOfwX(7chezhjB_Drj3tmXMja%Lu@#c)?4^)2 zE?a}@?2V9AXCYW@8*~9HPdfG&rQmL+S0_~0V%oSa;hsg5(;!EaBOSrw8fQ7-ZOJ^k z*&lZbolUR)mf~G+I{Rr!A@d0d8b2=xZ@=q)N6ZMND$O|Iu|iI ziMX7dvVb^xpmRYd3kcl|D}gJ0rYRYYn-tNM3@J@W$vGAUi*cB#A-;AAQghIIw1V{_ zV{M{e$E-eTl+omd#|BTqcp)~R{=Q;Fk~$MB;l#xAme@$A?)uu5qvM>o7x8cbN>zU! z@2OSpECzC|K&z2Dm^36>ja>3nlTJgTkI!y`MAM)~V=t~)$vIZO6wI%1&a-MZL^5YX z186?tCG09YwbtXgSOtg;bJ{C{^HBz>dH1of>$pgl4|ObvFMzh-BIHb$;-?`@=%_?_ z!0LeVct|sl#a#JP=^~Nfg>ST~>*EYE{~(D(Pr!xc(Oh2V#H8)Ad@H)R?XsX1T~LFj zg1&lINSlkj4QXTNFcJQRRd#OMUdL|NND0HYSdkJgeiEkuI# z%Ig;Lo%VooDBUY-S0^D|S}D^#X%?gy@>al)jyUaYxhFM4s*s#t0ZHRt(yqa`_+Hl~_Jz&_$x~;fjNfjp^N9)F36QN@_2LBNzJE6mxPex}qbVj)!e! z7lkezYR@SweWq<+P`V;Mi{@Hv--m{RgO&q7_`x4_eT4+9l9(w6D@mq+pbUmqvr)dJXwnl?wFp4SL$OAZB|{>K&u*! zkQ~nN&ekQM=z#bc%N17o5|)54bnc%VFDJG-(+k8Mv^;)>l$oNF-55sH>IL#p%7h&n z**5jV7Os1R;%9hv-F_^Ieux&-2q}W6uH&qQr0XtMLQ=)J9+D2T@AUlkL81xHl|h0k z)vs}_R^lyBf`AX~YBi$RQQ*3olZSa21_b$~FSWlO%U#(~K6H5}E1>}6+5$Tdg))fi zD*ftL-ZvUi@IYq6@Js^|j>oJAIG?Pm=Om*uek`Bq)Zyt^bed3{Y0nPE7lcr&+fiMo z;>pLDeVD>kI%BDLWg*&Cd}$E1fK>{dmgdVj)SVNr3vIw;fdArk`Hp$2#N;LxuIX5s ze7IZsHWFcXA_dDksa|S!*wIx>llwNL$s#=rDcR7T!4)0;#34r!vdY1sXs8-bv?5DN zU$=8`uYMgBL%C)d>V#gl4AI3K`v6jnd1-qaO4A+&-7ODs%7{tD)f}%{^_kf~e8ZN#Pghv@JW>ej2)=2vme#_s^L0lzjr@dOzB=UtO2N; zxwSQk)<~k&U6aqATYB)qa)jP7DocHfr;`UN=O#3L!I>xvgW)y zqDvpHC8Ao9%tU!wCSs#fG7#P~B>|TaHTr1xkopH{FFp45*P|iLMC?c>si^p9ak1R8 zZGV2f{iu_!;}LHS6ukgn8FyzBoMGr-;T}kw1{7E?c%h?EF&cUuB%OcU1!MdNPHLJEMW;;(W^(#!)UE9!n^y`I>i&La%?uL`pDAPow%{5 zlg+DMCfN5&q5tR;xLtVWlPm3g(gN!1#NWNtTILeNa6UpwQ6;p;y0X^%*r2lNNUUGm zC85Bp-$wdfZJxnoN)l1;@b^!q{W!YRQ<4dN65G3mqq~c+d9tP*9f(&)oD}YUmrvuQ zlal1G49|Qdv-w86=6eUQPB!fKkUTWs0yN)(aQnXWlKu{WJ+<9|Vhxr7mD+xrog9bv z@JW|_VFA>4K4^+i{8}+y$5-XdEt%tR`$RMbG!HkSu|0n6JLMrssMBrTEP+@5fed(A zOR1amX8sePjAnj3nt6fI%<(ve4P6VfH#1gR`b2l%`)O?KS5bvy+^Ro;BYtGY(MQY* zqW8Flg?>55pgXktUEZNrOTdPwmY@aFHffuj`)bQ&52daC zXq20V7DLj|4oDh004-NTheFcONs!b!tcRqy&p=W;(Fb?BTJFZdisDv6N?Hf58Ul_( zt;4@?k!LMrmz$3+H=Au3fCSmYFxRLKq2*!A!1g6lyV?)Nin#yg&!BW#h7@$X9F1iq z8_BZHw)Xal?!9N=Ns_sj%guR=7-y_z;#(oBz9@r`xrqc z76ilX9L&ad<#*2!RNE7YF+btbeOYCGtd`J4c&7Rzsz&Mr0;U6b-+IIVH$FMrrP;1^W(^EAL(pATp@dIFjnLusTRp%Pr3op1yIofi#bvS zhG20w23^1k$rSq?DI6Fq?s@#5ZL0aJQq2U_-sn)-#}eV5UT9Uwo`X4Oyno83G#N7@ zAuK4mW06>I8|%OOeCR;>tt})VW$!B<4SD;5c&p4?zn&hO>s$Xu!n-B*hJ0^E(erko zt{Fk5!Ppg4N?$nEG~Hh`QCcxa%5EpwqSW?oAMA6Si{eZv%#j+$E6fq8h4~*m=Xy1@ zM2?iI3`2vtB?&j5p1!>>^X9MpPg4FjiM$Z2UfREkX6}`7cevt7dmra7xybEi9{AL^1thvjlR$1kYQ zJ%&4b0kLj2yz?|f(fRLeNSy!X%Hyryqf`p4W$+tIeL(0)N z#=_Md+fx=pUWy-!f}adss&&>X4v{Yr8;+-B?#iipMMo#MqPQB9vclCR3oBUWTG`1| zism8%$OgSika%5bVV|k%D_?`8<MJ$&TS!`CfAOS)kTeDai_M0vkCiJ! zkg$}$yOm(fVg4Fk1+CBaDSB72h4xT1M77pm(_!Ne9ND)V>m%Eu(*vg+Dc zS!PR%VZ&F!$(8xl@m)GlcUxfCBSFnAPvPVRM;Z;1wWK01g`X<&7D%di97n1|E2+?Lpx!Wv;q-A%kWcNg7cc_;NWEYDjSZv{F%FHsC?;^D>nol5BrDQxd$Iy!CF}o9- z^Tu)#l?84*?9)T7cREGlD5fZgQ!KIPJSc(5a+nD!j_3v$QLhqgTlnOB=forO>{2SAQsnQxGt{@Th+0#hQ3!0ehzP;7oRQd{|tKmbS#{ zh;ak#KEdjHWx>ur;sFy2t8_0OZ``ogvy}+X#n3oW8G)8LcjxmTRj#>^v?y15Qc}6T z3BQX_V7b=akhI5p1X8;w=AR(FA{7F`O5lJu3R?G54V8lazodQX;`slheGN{_ZqG`^ zwwY9_Y$oO6>e@^*5=}NCD4R?)U?$jO$I1;oYTK1>?K;D=z|wO^2f21w%}rXP(`}?0 zV0WS0ptVf5L+8Lp%c;tf>LF>X`=lp*)syb>BnZ|sJi)mZ>4>xvE3_w}F&=@@j6NvN zG`MzUq#E6#bUw+xhfh$;VO?V3WCw&E$v)&|9gU$vtn2J}Wu&9h8C9l?K|H`Dq%ApM zxDu(;;hpBM1)(Zk>`4$T8aO&PS4T;%4%@!$MbxA!q}UhNvd93AgXJt5k?g6Y;yk;u z&d>+7E9WioGb|m=cpQ>qwrExQ(yF|gX--xmq`x!1P@AF#Eoo9{r?ni<_oOCBT6(ua zQj@|-u$q+nAgM`t7E;oryooCmC(2e$%8^pG|CNa`*LwfssqHZm`M>wJNnvVY{)4IE zFo`c4AJ0Z{VFfrk)|m^X?7T_Ng~IkF`F5ARJYqkK(bn=##}e4TM#Na#bsP}~x~|$I zB@e@XBsrbuN}EF)`f%8|Bz_fp+{E+FqfP7+bR@LVA=T~*IcBA$&&WLzF^4FA)zyet zn?4sqYBVXFM;?JASN>@51Y|5%oMuZkvRI;-Lw+hmkBJF^5mPl=o zP7{g4Bi&YbE2OF7$6ihEb}uBIl|ir`1>GeUM+Q+0Ig%rxU`NrmDM`_1*B1kTVVYPl5VZ~BP88g^(Lgn!u$cGkjo6#Uv)&PVye=j$K?l;B5JfJC#P$%((yWRNjTikyc&@B(1#9Lee7s zG9;}$4i2^Qz7I(&??FgfdCx%7%KJ4Wtvn7Gwer|(wDLZLl&m~{5jwT6kRbd}cqD0;r zC{B5B8j(PEwh)mm@a!SgtZ5^ejBCw#3#2Vbuh<%k=8?_a-9f9NElgO8t8_Nc*p;wv5tK`Q+4f*`2=>^a4|pp%Q?$7g*0EHO zoK-|!h#0cO-73|-_x=G$cX;NnkOge_VEU82!7&I@D?`h#YF7bC)ouYKRl7JOEncdu zN>tCN6mKUaEppE5RQfHXnF!^*Fc-oR!qLYXEVaQtLDZ;PN*r&wp|S7b6w^L~D{yQM z7_&wfw4IX^8{>^HoxMP@?KQepNGkyb+U}J7yphh*C)|xp_-;ZV`a=B!)ZjYFc%&1> zl%KI4HZ>6|q<8!{Z))d}(O*{5ydXS+W)VhkJJCXs$KejTNKy`Ikz{%sBrezHro75X zL#KtqB{7vCSY0@%nE_cQ!#9AO!U<6&BY2F{HB(?H0LT&}VB%nr|YcD;zFr^5rWUo5YejY7gm|Do6mgo#Qn+dEc` z+-SI&`#SZC;zD;xVI(X_Q9MTilXc{*UFCLh(a*XW2Un2?R41MmS-R8MK#<#AE`3b` zPZEM%)I4Z_=Y0~cboHB)q=izjpN7N-1_c)NPuHs+hor^+OHYCzJE+)b-3OQNO2N8w z=ee?2Gn0!o15>62u`}$U_cNBONO+LdC;GZA4|?$|0+Yi-IkABqGw|vM4Ct%8k+XV5 zRkM-G0_!|TI#_2g$5M3eWaj;}bj*=-lpE=ol$nm%(PL&uBeS8eY4?tRxelAiy^p9Q zlTnT!om=wu%XorwlktHh1JA93cy4u;eFV;v+TO#uhUC0co|=l$!&BS-SU))$1+feJ z19M_wq`=F(_ju-PaO-S@cbUr*oZEAJD0kyvPewiR)(5mRyyu4i@zvsRJ14embFhI$ zu4dy^YYuh-;XPO2CpnG-F5Uv3^|tK5iZ)ap59EZH#LfuY{*~FU?x<8y{)0>Kx0S1JLveZO!0cJnx(zbVG_*= zvmY1lIJ3mpiscs@Lk8=;=?gnsTh+ZFH5R?oPcP^T z3r9l2C%J)!)@waPFZEuViB>odNwR!mp$;wJ#I}d`AbKD+BC#!!*rxk4Zzdz!0fwO^ zT18Tc;$4sWJ~l%O`Xrv#npLn`Q8Yt~L+V_M&yKYHb9k-o|9D8+{!f9V?Y|t7zDzV5 zlEzp9Nk>!cOPZwYSfg4dO_07P<+KHomitaGl=Y~k2*IK;O?4xs#B5oNDBU{}odMpE z2!=nix05N?`XZjqnNErszb8sO%_IHQ_E1t+Ea8|aIF%9J^ELv!3JLG|EiU~lg~P$S zfk>$iG~x)x%1+OKt3rGggSU0Nih{Pwc3RO|JlGuvUrV+a&f000V3UenlaIxEds#k4 zBDwbTP`o^3FXMZkxX8!Gqq4a>VG_DY-9MUY27DGz5YHIfPapYLq zs%Z__mz7|=IWZnA#zOs`n^2a{%&ntpxKrh&Pt@pwnxki!y#*_VkkY^ogZUV0cvo_F^#b&5PN*6US3b$CSsT z8-#zX!(WubKQwr#DPe4+;M|2Nxc5sXCk3bPxDQy8Q#>ssVDwP#t z;diw2Tg>09xFcxZVU|X*q*g3P4<&+DYj2szfnFV|(XQb~wo2L_3E|df@s_Ba68YBF zWM08{B7b$r8QtX;U+EK00ZQUh3h=zN0?bU(zgLK?Z}&~+SAX`A?rya!L#Rl5R}fvt z=AfE(fX+y6f(h?A25pNIs$lp!HZvp9eCIW_*0CQ3rQp{3*o<;aO>{qMmK3q`lU)Ox z*F5(|2T%`k^%BV_!HuDWPT4UTB~ICuK>2DV8D}}lmzj*SQWP+IGA5EYLlIeq3AD9p zSWbKbX4{7-#RU-*A`~kJ`>EKh;s zMjVpH$U)z^2v_)G4kX1bhorbQkQBEIlJa$U(oZ01jK4tA7_URp82!+bsb3h9`YnT` zF}~nQC?Jb}iYgz!eVk65Lxa5Js4D8d1e$G_`=5PEtR8o8#uFT#>qv#eLM`y)A?Zlv z3`ja{oeD{(t#cshv~?+@#Zr6_td%^$xhoNE|95A@or6$sI8Nc`IvX$9$}Ac8aWCel2G-j0wJ0ROP(NYCmm1+4iax-t%(= z&xszr`#tX!lKVdauln%JeX<;ZsLoz9_PIAA2t*h-r!1+^1Wq2RQz+*3r8~ON) zgJNAtSp;dms7pH}T}k1($aeS@SPw(e0q~=cbg=sjBvnq%E>$`I3`v#qJxHpYEHzb5 zjA|X_6kP{57AF_Jny=~TSmWLl4KVpMKsO{ZEtfcVqhwlF;R+@NO-f(-UG3=Na4vTi zL$4SpyIUW@FP9v{d+vjjzE=&}ibq1aJ#S2{eNM-=Nb1sPIFXlf86Bh}lX{!4!VmA{ zzGGyUZ&h-W6_)YP4EWO3dfvJU%SrlF#iigoh!_vV_=0^2zQO2~8dBh>uzU^<%Tn5c zz=>X;k4lGoA5a+Hc{0eE+XAZs(o&H)pEzHn)sXZ{Syw^Y1HWABQ;>9v#AhMtlI3?G zEt43W+h~j@Ah91Qz%QO-%B>??I>fb!vAukky#XrqQ=Wa8+Qp%j01o=&r)}Va}J};N@WzW6Q+;|=y1$8d5 zoAEwrG}KXncg#cG*vu5%jUjv@F*SBZMj3{+3|B(eBr3}8WNaEvE$7&8@S=M9jbbC) zJ`BXL^(hVa{Y0r-5h%1i@w}Bx3@wzF%uGmHG7BMT$*hN@y2`aTEhDb8sUKI@l1~!2 zBtqwY>V*27$EUXRgq-HaN+4d278@id&8oB9i4=~e`UXp%k+uE~T3D<7sc2wE&J(eB zIE#g0jt_=m>y!^kP~h^#nIP6R$ax|$+Icu=Bm+(|_}s?Z2{c%~J3GMn{&WtX7_eeH zaabG{(m6G4t4&)3C%*Y%)B*~)>H^tb=I~{4!0$Bn{)4masro9zXGVK@R zims2mnJA*v5It@AGCAr$K!qM$1?Z;lr@RL zQyz;R*M>2EtiV}fvJ+Sgc!6Hgx9ed#;yGyWX9BHL6UM9N2@YH2<<6JLZFLw?o$(dp z71%d}aYPQgs|VQkj9S7+ z7*gLmc-xPu?a)WDQM5~zYv{4}6E}6zYZIs6WDv z!IAo9;8Sp|PkqZFvC<2$N6u9nT1%agb$Fq-Kq6DFbqCJ+bePW<5r6E8bibZyp|R-X3q> z=~ielD)gwt)<|Nj`#Fga-;ghT23rrkjei`lY?6X2f~18x84{}kQ&~@{^dxGlhF%Ft zTj=K?=_Wr279Z}Y(`|ekrD(jReQq?acfSOmZ6YeqTVSCre5xA;8e@xXLD>M1*p~4w z8I+?F_&Bn&*8BS@i{QoA^vO+Hy=`R)8SHF(Yf~e6|_OTBg-L#vuX^>m(WEF znCEj6&n3*SXdz$}o)!#}NA-9v;G`Fymph%@q7Z1e-S^3+%n-aZp-l1+9J$sBIBSym zlvtBI*9&FunM`tWdaNH}P%pG-yg4L!!Smh)=2xfwbGB$-DIGTnD1GM<2%my+G?8nK#938y0wk7M zuEpg9ea>|jB*k%jKLcfvYq3(b?KeQu7#BfOmdhb&skcK?mQO%ZmQO=cmajol7OJ$y z_z@(H!C9upfFR%N;jioX^i}49-t(=i5hS^UN)PdjbMl#PPhorsbUmq)Wd(KO4yNOv zol=qVWf*%4K1=%o?eAl49|d9u>+8JNN8y>gSNg-I!64Q$8U~3Urz(&)gVm3{qUN1t zuA$RBKQ<=aVz&s=cI3Lis)fX7NV(QJoV5fwIZ^9Lo0TlLFX2iCKhC(2Wh>*tkp4A_ zcpldf%)uq|J?+h!j^2DcRhZ zMYHl=5UK%e$|loyjJGIqQ!-n_39@M?1T1`;UA(DKA&@N$dgmv-8t#9;FOoQmW+A1 z?fpdTNYrt8V!4dQbr(S!c3sFuvn+hi zrO(KBAMn0-xZ;t{``G9^8JSg2CrtQV>ygzUk*FCY)V?Sm&lc>tT!qWEXW&^+$ezoG z6}VtXSq+~IL##xSN#>6Ku@PE$FA!2$2Eh9v@4V=|au%=5_qN2j3m&05`70}z&whNKHP7~`n%R3XfUKCz(rCBGvEG3;AOn{{2HQkdSSo3&- zLu!x?yg4MPk@~33NXm$^+-M{wSyBr1u>QDOpdGa7Bl`ny?ZWm?iVh z4`fe4?>VGn+fZ%q_3;vXQiiXBbZibfFE3(GW)R!0US3j`6Vv4|csOu;DM*H1h=d{u z+h>RokqA2m;JZ{99?4)HgN)L>%VoJ#mk>@wN;KVNkTkVyNgBG$^Scm|<_dzfl_xm& z0~uVHKwBF~KWLu!f;`vtIHexjmguvsZ%6qX-GdXqP?(qADF?&X(C`zIcOT7v_khGN zQi3mwbyQ+Y?tpE1597gVq8lqGAKD+mL-tyREBOaQuu5IweK`<@KIY^XdUH(2(xHNI zi-enW`GiR}^+w|NUX5FNoo+G^pyWnf)|eIv*9=v<0+RM>*Fic5MUZRV1WDEXK~I7p zn=GjKLF*_kL&)ZG83Ujb&iH)ne|bIlSllhMk#aZd;WtuSD|cpbaQACBfenL{vukP- z-!Hx!7g(moABK_-m;dv2Ek&5eiJXb*m{9gY@RQ{c#N*e?>+5#!Cru|+Pp1a7w#lUi znhY8>EH&V)JDR+*awom`yCzbfy8VbFp7#RLlk6D<57D%$icNX!R>lv{d`kD_*)93; ziwo?FBQlfp)Zqp9bB(;64p`XNYt`~v2P~&T;&3QezG|s{Q$4?QJJ$ez9lGeM1Lsk0 z7HIA8+EU7(jeGttiLAc~k?_u+qzm8ZLm!+dkKj9CUFC(Gi*=RDpR2nWB9`9qrOo)# zg6`ZnjWDOi`6_ve3}Z+YXM55-QSUTQCqeooQdD47Lef0dK+-&|^8DDdCvA5WSIko% zd6Pq{j-N|-t?jk3_WV%I!ub5x?CC-Kw0OkDi!+s=UGYIYb}+tWH2#7g z2Nm5%&W`4{J(ZZvfGwl3m!aYVd&_7kPiF@JV?9=9|9RyjLF+U`(E%uDwMXE{wK!bX z(cN4~T3Y8r(o$%Ibe)vjt&sGg5Jx)tP{7>Wwf$J>OS7Y)*|AXDPZHfZcD?4p`LjyM#qzWdYu7kSoIhp#Xij>5;>z)C6>^em z)q6Q%ZEH?0f~3!0FN3sLa1g9LJi!Gle!CKX9T*|d>YaE%gq`0*;Uk{}Mm1%A{0#$E z_c6fZSRxE`W`4#FU$N`t)O;H#3#?NhB|DorxT2GL;`eH~?S?{k)dY;U`FwJg7{%LkF2PB4l9$vxI<^P8m{;ETx{>sh&a~X?ETy??@5BgV8}REAJc4{^ zg^}P5bf*6%!9F375faulX6cw>%0cu8n4Qo%s1K^6*wNL}m)Z{X4d2k&F?=Ocq2cjD zj#KJ79kt~P2wYH@g8b!5qGyXV8h$z_W4qLBam<$NDi-64&K>*i?=gJ{{EyNH4aaAx z2W#BAF6o?*0eNxa-%mHkRLLsZDCwt$>1Jf^oy|ixpf`g;vPmZwgn7GEw^!f_P9_YV zDYu|mr*pM{pXf_|>J5*&7TTBc4duBV+k!gZa9@@>yDab0W8Eo8P~KHV+3xPa6`eb}t2uZV* zYz`cDs2|ODQmwY(ims2Pf7pO~airykDb~tDM*>L)Cc2dVCMj9jIVGFmM~TCg0Zs#Fe17YvtsejSihhrZ(Zy$ESCiaytR*$d_4 zfd%3>9FpoE0xkYAEV>-4pLAMFq{=jvy)|tb3Az;$M?dt9@d&?3hWgp%Oe*7(VYMVr znV&L=y>8>~}jG%znmN8QI9jp>~7^krl0Cp&`2yz{GgUi%ZfMo#&O-MPUE zFW6V**)(WI{>jI6Y(WkmVh%kv+#=t}Vb*q%Y_yXQO*7jJNi)l&tKXL)Y4Jd??&Jv$ zAM6ng;06cI8Vd332u*WzEwoyUxqXhBPwdG>68pCOEYUr{8~ED?I_i^ub&e~Lz+6%d zdvu&@o}IRqx@f>nR2l0A@<(y8^@d*z=8LZQ1|a69>zP8m*%B0#P*wqFte z{k3?6R#qOk;t0QZ2sMG3NufM1PyQt%9r$q>S(SwSyp|EiL|R6hJ-<&v;%ZHLd=n zh$CH?EIvs!qTLQPSD@PPaV(>Oy~IVRp7kj|Q=i81b;5!a{gHJkxwC!H?fUu0n%gf% z6Ls|`UzYS#QTPl(i;R;uEwY)Aw0P!wq3b+978e)Va;;sER8g*mq>4f{QbmCv-+%=a zMXTzuRElZE!X?!eiz=3mpE+-ywJ_EgYh2RW*fPDUykdLCW&NDyrf8;LWm9vLHLYRu zrY+-}*5+(~#Y!Y-;-_8ExH>w%q~ucp>vHuOzqX~ZA-a`wOc|-=1XfZ^bK}=Gu8FNH zuBIpS8*eG^Obh45__eE}s~unFCMPf&XQEeMwsNu)fFHNZ5R7;qk25>eq|a1b6{h)c zO2U3sG2_>?w&Fq@`EmlR4byFPyog~+EbDq4yh{3f3s*%r$gG%0AQh+iyo9R|j%2KZ zxMG@Iqe3rteIL&80d{~yrSi9jfHqGbD@F_|2 zxd%QI(|n$S4=W$xpgIMK@78frqr#-j&^$=^C6N?x(R+YqJj{NR5*NLUMPAv@@;G6)Lx#+e%(ee*1 z7pFB<(pU68K)rGEK0wMom1iJAa{^?e`&Hr3FlgaTQ+c@Tl9R?WPS-3^jO;GIElvd7189YZLc22m+#=41EM+`OJKYO-xJAFoS1=@Jzs&?zL-wz0u@379r{7Ji_2PPB5%lx)1C> z+;8#}AtasWID_YS!O)`7{qEK`pEG$*Ku9{z@dnRG!MHqie?RoJ$wNz;&NI^BfoTJV zJq%0t!R@~sWAdD6@QgBeP7=(iIMZDiY(@2E))!Noo}QBoo|6UR@@#vwKQfWY!JmV3P&NI&7VUBcEK%RFt zPiZ%KN(`P;4IYlcassRox{J5&>NI(%?dj<`&EP2&jLY-ZjWd2_^04&Mc}fkQ(*^Tm zoY`N-1`fK%`bPr5>3XMCH=NyEj^PFw) za8#)Fkg-p_>Cay^d8QdWQw^T!f^qA8#fs{@MS9pv)f~9tcP7tlgJ+h(!{;730sd8V_VnL9 z^2YTh&s>9Nj=^)TVBCD|`_5n}FG$n+_jv}-xdspCS2+Rp&WwHFv_+SjJPQPq+Mmuh zc+L|HM;+wpv*oKRO`a-)=RAXFp)lP1q9grw)I-r!j+m@nhZk^PlT_n@IR(vq>-mNCH>?<(>a9dC)ax@N6=8HVbAi z&aAT$x88(?o0*<1f=O+sn+=|e1S6?}bX8;pnnxy2i@|e|!P6?3+i*sMuwGgAn>Ldt zYVfogJTbwDg@Ls0_nmu9o~;H?%;4E3m`OO(t-a~G_f4Md2uZK^Z3fQ{!SHX9GGF(7 z`d?Z4uZsLCG`u5q^nLJk*Ji84Zs0+&HC7fA4 zKYO6+DU)Z9!P92&pm~F*=W*th22Z=ebCqCA4yq>H2e(!4ntENRq&1 zAFqA_A?ZAEgU1$(o1WhcpZXg!J=YjKw!zbp#*;l?*BU$>1`nzkX)eW?T3r2|pQGwB z_4$(q&vgdRrv&4cPx&naVEi(9t~Yo-W$=7jFelU? zX)x1sqrr27!SmTPp6vPhoWb*1gXi;tITmM@N^AZaboH6#^96(F^9Iis1@i-(*%!XK z=dNFwJYO<+zG(1pq>&TgmjMPrn)Q_~G^Wh-e8u4TvcZGt7I^qoZQ6||zE?2B<7<$_g8r)&n*Ve%?8h{g881qlOMYH4<^rT2G6Yq&+URq;LLn|=bbz5 zH+jBh@Z4_jd|fa-=j#rG=j#T~Hw43e2L)rzdMlA-e(_C%=Nkskor0mI>WgFc_ddGZ z%-6RBliFY0Y4F@7m^X1|`P}}%jalsKw+)`V44&@@<|Le{ec9I&?lyS7WAJ=eFm8L# zZl9?Y>2~A02G2c$;dqtl$-bU|qR-&D$KbhFFg@Ebw&L{k+-vasP%tQ587I7bXSVi! zpTYA(g9qyCv{SbCpDn5Vhgt7GGI;JccpeZ8Kg3R+hg!~u3b3S7=W#zacpfl#9u&+_ zoEdw4;nlV3+8H^gE;mCUjDVovsW;w`uwoLvrjPp!kJ_G%llt@(Byf< z;Mr&JbPA>mXWFs1tEy(0Jo^ovPJ@Rvo)h4Bl{}CBcKd}U&tnG9qXrLCqU+dwAYC-$ zd>Hl2`g+{p=`whp5X>^1$#e0@8>X8)PZ~T=7(71_%v_wAik4Mpq4Ug4&rc1WpBOwp z6U?(XbNsw$OWye=&r=4^&kUZQ3kHJ&33=}4Pb@Kco;G-XZt(m<3S8FGlmoOwTKVNwq(} zGkAV4n4Wq5VDS9j;Q6Cq+;QFS>Tf;HOwXSTo zz^x|FYX(oZ!SlLca&V^WIPOPT`qRH7B)wg{Ztx%)Fz4Y+yZYGYOK&jKbI{=Vhr#oP zU{KlO{&u4Eb(4pqwe+3Cp=br}8zXUUdXB=JoKD*iE zdE4Omm%;OnU@pd){rjmWy_bats+p0mcMP6)1+&%RdFtLnwwa#y44!ulp7#Ya4rjVo z?x_B~$@2k1(#!dMgXcrRRO8Ijt$piOdeXNbe?_&5C0}}PGCMbn6KLpURq`H@QZ%wJOd1#fr5Dq9IUV3j4L|FHkOuwa+h4cBHFXC7hj3^sU%2!?ip zZtK}cX5rzhhw14VV({>b+sWOA2m1UNO$}aY`QoZYI?s^?4`(_#fmMj<-w$$6UpmiG z2G7xgnFk))u{XyY@rs$AV+@|74IX~uF()ty9JH%BD_(_4!YeIb+{&Mxo?!;h2*J=E zQV)l`_w^kn&#?y22!n?sUS01cPwQ(xK!*mewDc4iJjWS4#|vf^V)~c!2?o#c2G2;r zECLVv)3ZPP^p$3MiVdET2G1zLG=PKSgo#U@-e>ZhXz+|Ocuo=w2A9I~Oym_*8@$rW zXSBg{lEHJbV19&{Z12BZnd|n0Df=@|5zHQh_ruY+9)EbmxYrotUZ)uM8Y`GN;9wcP z_R9E)CeJv7XRN`)ovk^6T5v$Ho`3RtS#0L12G4kdhfgJvd$GP)`8lX98B^CBPBVB) z3?6=wIVXS)Kw?k)>2JSi@{}4p6AYe-X*@5-K0vj=D=j^IfhN5TPBeHX31%^3Qs?td z_5nR7z~J|Enk2CC!n(MN=r|f!86(5;jBUTlrr||e|WCQ-=|D`bJWK6BEv(qpLw9Ybk&JoN#2;@vJ>UA;8|XH1k(RG=gJ*`pGcyg7y?iRtFt~{|)8MHT3zJV~-`<8hF&NtJu(BP>O z9x^Vb8FieBYaE|514UwE@%P~zpNXCizXne?A>d-Z>iA6deC~04CV4(xj?XB|jm0lf z(;eyg9CUn+@_YtzFadYG=QG;z8R_}(GgNdZc|NNgpVK@aeiD+d)bqK~@fqg%e9!S2 zA*>x*eYpo==FwCb*M5pA#LQqdlLQj?bx{55H_rcbwB}Qs(@F#{=tBv+YYeP)aRNEM1 z2*FzaurY)-M5;E1V5`O`wha}d)#y3*o_pr!&SR1-Gv7Jq-gECg_ZRk-$Z;l@h@4>Z zCLE;TInCsqMDAyDJ&|P{x|Mr~tYk7pWPz>fL?R}Kh&;{YZX$Ii$A}zda+1hhOnyV; z^Gq%i`3jSDxIl#GJ|;I1`4W@8M83+TPUMSBK1-yB$wNeTGC4uyW+pEX>1FadkwZ*Y z<5CZv7L)f7`4p266ZtfgDI#|;IY8u2CWnbEGWiCPpEG%!$WNKb|LqX?bBf71(s_o- z--!H*Ne3#zauiv z^}HMw~FTCeOJo)6Tq3fP$woXRqDNVE8f3&E zGX_~Q$QKOqkU@?c+wjD9!0thGG>qi2D!^1-!jM#4RYEb=MD0j zK~}8R9_#knV32Nuj2Wb6kUI?WHG_QDAZHBnia}Q5U!l;W>UonvK4_4g2H9Fdxd2cO7CnH(ZA!sK&ACYXGg$X+H76B%Uk7?C|peney!lV1|~2$Qo!#+aNZQe|?H z$gAAr{zK%COy0VtBA@>;*+yhNr!z%l4U>S#Y9>dBtYz|TA}?^tCy6X)opVH1F!?)? zcQaXrN7C?I-J#oJ1Cb6U*Acmn$xb5gWim#`XBawe{%G-#%&g2#%|6<}2`7e{t5P3hRe3S@gsQS(^ zgB&MviPJevs zMCC+IXFcfT$Q=4OwFTbrcSo3P-43J=e(>y6mTT*c@O5X7 zVA=Cz2awy~=K}mFtD6j>bnlx58Rm*0D|{ zTG{@Nu1};^b7X}&d8>Unt5eV12MwqqwNkm4tWZa>9}~e$uBx1cFRK|Zc6C~C8ATFC z?m=NS5;*U+<2bY;EfirGgwC9B=F6ldrdKl5vQX6BC>EjR*uEn?J9YzK%bH=}h$zAf zHeB0tZx=N!iRVIL*Cs_0iRqwOLi>U^4jNhz32$~J4v%s923i zGkjCbavM#{vLI&spkhT3HZ`l|3J)dr5N`DWyWA-a&t-Y zz?={9lpArLiXg>iG-rouBvme^QgGtR(tIVQhLCJK5u_OgGf9-`j5)iaaK;WpSA->f zI4d!Vm=%^4GAnOeOd9iaL`grPr3#~l!g?6a)S(r-4N)rJd(f zex}NBz%FQ-A`Me~GiylZ?bbxB9kdvlHW?HalXUAHcluDY9v5^c*${LP^Wvzz7 zg0m8pW?`9bsunBZkz4n(1CLB~CJgMFV`oDdoGKfZp&(@#v>~DF`anewsF!k@!}I-| zpix9U;fJlT5QC{?G0cYsN!l4;IJc3tNlEsAHnL){smx0vB_n84N@-LUEg93Yc$s&- z%xsd5L!dkFLMZuiDVgcgIwM00HA4Tubtp-t(*uvO?-DD5jnc(`Z$xQH7>4D zU=4Bw1vNF6D5OiA@&riU-X0g6dXbt-A6wIzv;DfT;J-Ckc;&=UESUII@=D%T?B?pW zUoG`#Jh4AJa-?_~BTvh4a)qocvE+y*ZVxQDiSM8bI|IuJYA_|Mr6!EhzGKI@U4bk4 zJl7XPKI|(n;6-g-aKny{*Z1q=x~ zZ_<+8A|8Q(VgPqc)h(J%Whtiubl@P2_G!A40s_)tuw9A7lxWz^xgZqPt(`hqtf;{t zoO1oTC&p(Ez=eWU_M~5~uw-JrRoH}6ZB2PXG}9cx-+sAmi6>M%rcN88p<0=6TK1au zlB^Y!SgB9Y`ag9Saw~|^dP-n17xjA3_NhZaAn}jcULw+R0|aLj zbM*JJlaR^ekm+mrG(u#=%!zmuXW$N>eSE+Z(%Fy!SB(TfJ%7G1C!uCbYv= z>LFNQGQF??fvs?=OdMG6>@3a@tx-FgH=|-S@nW~B<08t0fQk$bsBCnMz(hx$^ro(; z)wk+x4jgy|uvArFv*5XYZ{#Fi;MWf{U|5YrgJx=c<8d87U~QtNVEjnm)LbG52oy8} zoOtycoIt2@DFmAe+(3ewgB?}9!i3}cu)9WF7x6)Cdc9hABe^HkpD_K_EOoTu3)rdZ zDHq2cT9wIj4?{>ZXd6?txTO?mzofIw$zXq3%0tlz;BrvfVocIm2@RB2JSx#PG`~!X z5cb%#*TPc8vcK+17q-5uo$X9PUR5X4JasSJ}r0$b9|G0S{!6a|ioa-B!4V4>I$ zAlckP;Wc2P;6}n>uNzJz&tojxSxBJo>I9iX5Vw^ni5A<&_R6qqU)8P8&$+TNWW>8U*~7^=N9#sDF# z-5EIf!0u1=jeP`@%kFZe1qw2~HKU&RGkV3DrftK-&x>)y($*3<31-^?`)yf%$T_>B zGq|t8EREh=wV;@=_QvBT)m@z+n0M7M4>bp)RF^L5oV5Ulb0JiFPmk4KwYH2^hX;p7 z`v-?dt391`HE>Ti+zs5bxwp5fwI-^&$H#_ujZBPI^H&DvwE70B!{dE>_Y4gT6x8HZ d!bRPIk&&_Cv5~=|E?zOLbm5pSEtxD+<^N{R!?^$e literal 0 HcmV?d00001 diff --git a/compat/pthreads/x86/pthreadVC2.libkernel32.lib b/compat/pthreads/x86/pthreadVC2.libkernel32.lib new file mode 100644 index 0000000000000000000000000000000000000000..5880478f96d8c8279e8bc87c1c2555bb2a16fb2c GIT binary patch literal 81328 zcmeFa3w#vS`8PgGmSlmzE)p>cXq2ER7b8I=qH+ld7Xbr-1OyTwL?E|m{@?%mz8??F z>@(+l&v(w{InTMwnaS~It!`;pe@_2Xi_+a`6HCfUN=}C}lc z=gmt)RZW|9-hy*y&a0ZAL8z$u`Z>)To0=QvG)Eg-Hg0aXuyJkq=1p5xw=`C4Z&<&& zd0k`G<|c+&S&#-~T|+~CLv%C1l-7#0snzwPq<&kX>suOEuPtBQ+|amj^_q>1i<>qz zuB~0&6t(J&ur%-b)zN56{o2OXXv^ju9$0l@daq2i5%uS@KdTL9I;}XU2jyBnv>% ztv%%lfj#62p}u+Y!m{N_0?j14WgRKs%zNXytaN#%jVT<8&L|YHHx#ed zrghD$H)gO#sr%`f7O?4+y$}eNkZdL31)8bx&pX;?YWrD>HoBv}c}p_g+RT#IjTgmI zv(>mgRgaM@q@p3#($d(R+J4}lO+V?qrLm#uf~JP#4d5ATZn`Men3fFqZY!Ojwgk3n z?MDCLrnPA?H^8VR*)MF|QQwe}Y5F1Kjj083VbjKx%G(r+Hg2y+)>@ldqm9ieN}(Z! zR;YJ+MW`PQZ!$URCu)&3pk+rk?^tsd-|QMAH*i(v!X{{TYUQSd8Vw^Yv}N;}SZZrX z3ykhaHH*ohECt}IVh?G_)<~0_2=z}30@Ksd9NSdCrDbzNV{7Z?me#b)Ls3(#a?3WB zsoC8){^>b!JX_YL*Ms9N)!9?nHtBwoTHwZO+2I$fWrt6kOjU5GvZJ%Bh(>XB#L$A2 z;B1B9)~6A#wQ=JG$toA9vkRdH=#Z*jja5sU=51?gE}h`2B|Co%WO@Lo3C;rGt?Ms<1&_5f zrt7xeLCvNA4V>^aepuQ1MUCrd=USXWTeNAjSWpHvtlqehgW8!oEL*fWhH*(_D=S)p zH#V+rj%_)&Q3g-qlU|LE*V=lF%+TDL8ynZwyS3qkZN%N{*JIS^(XvYxU$>glvC-8{ zVy!)2DH-zCr$%s#%B4l8Qs20}p>YdySdUz7ZGxeIonI@4foy;z&4(MWsZ~a7?&YS2 z*7^%Ju3iTQ=@}T$^K-j)*OTd~U)^v~tf|Gj3Blsuf?jBKtLYC-%oe8^39XN|tZr_- zfTMP;0 z6SBCmWm8kLGy0GivDWpOcWrSr5qc-{hg4NWVQoS$-PGFH;OU?C4E35#jL6+&rujPq z>8xQbjhi-a^(w%zrh4;jEva?s24z=cCp3FO(=slWSy4(mX>Ht;N)J`i*14snX)|Ur zUVEYq5?%3WKwfzEdn>8adfgIG&qa-~*2Wo|qtVSWEn=0V1XOL7L1CsZ>MRS(;!JRL z<3$T%o7N~I^j5$GS z;^>db7H%Vv(JTnRe6G1|0cqZ1)zra%M?fNBRX&;vC!V-QJMeE;p0xYNrfxhrvf zuoU;mD9dUdD@$@#pO63jZzzG}8qmk1PTJXWiC9sgZGSwJ@o!~y(nds|Ks%{tT@s7 zq)j_NUN8E1y$H{JK3*^KmQ{3#QM;j!*NbGr#w`Y^YeR0Alj`?>*m}{{#+FvBc#p?Z z16exq+qrdGNy(&1SSdPf(!|N`deOW7qzOKVF*ami_J&{7EZ0UO~W6dXir8vZ-D3G}18JIAt)aWLwmxF9b6 ziDL{s&p&g8Ga6_ehZVtb6ULQ|J8hh^qP`*}%a-*P;DtDNzewN<1CKA6@Z71hBR`q< zn=6X`c9CVh0so)ksI~%w@ne;rxq{C;T31w*u9&`M%goi$)hp(0#-orGiyJp>S+TMC z!b_%4FDacdX~r4j$|ue|ZQR6}6_dtIFPk)D+>DaS>66MQl+CD|Ipfmt(M?;dan@Ob zL&yyB*yE4 zk%wBEh~FBNT0PDc)*?uAtn;h|xSoS^C1kn>ga7!5W#13$Y^lFfCDgK5s~MGTMR3Oe z_@Y*e)nqkW>%i7zZL}J}+-zN7ZAP5e5Gi1lSQBxS$?qDREvwEt4*pe$x!GE4#jFOf zEU;Evn-H6>3h81>ms&;EVrxBcjR;+9wc?u0E%>dKyROC6Hu0Z_ShK8o68}tVfWcn_ zjus%B5CfYWtqImxu$0O9G&wV6mNiM@x_QZr)l)o{xf^dL?$(NYv23;=ckW#+Yd&&T zWR>G!*;v*&Rv5o5v#6x789CjUQW}h%EP)!toM4T&W+JDW*Gh?hp4@4jlnLXz=^&ey zYHvL2tzx939Hp}fDPE2A>_|z4g&Ns{^fe>h)xgAXzXn|E)dfi7HpF2)6~Uhzn}BIX zdZOSdLRx2`ewgB@H5&Js2jn`*Det%i7?#vJ5Sm_otuPwf zq_j(Mhf~2d6Gs58jHTd~ezGN4C|$Oq#Rz5DwxW(!@IIRJ@|He119k}Qv zE0LfvMDJ@rYo>;d@Z1ZdmSU8+@QyUhvEuBXFNEjo=yP9W8WC|~iS5^=l| zjCeaXef;J%8`Ar#iO#lS=f~}29w`*qLz6H$PnYi*ri;I_*F9D4>^8E;yhqB_T(r}Lh^V3XRMt-S#&pQ~s zgOgt!V^q3+?7#jB+&ig!5sWc1_yzzMIKz#lzfvw)`0{}p?qFHY)5wUioFDZ!E%wI2Zxq<73ND*Iv-hlbFv{p(e%Au`mBZk><1qPN0Pe57@No?N#$ob} znu5Lt2c4h3oPw~a4n}}D`RPj&a65Y8qrS8qCf}XFJQI|jHZ4%V;yehi8VU;<|=7wxqlUnwx<4$hD7QpBGR%##j|!xBHf1Hc?|aDIHZ zA%358EbD7H=yGxR@%;gqHyxZG-${u70Wc$-=@@Z-eB*#QI|Y}my^TctSq=uGI6uA( zz+K!6AN!9zz}%gJ^W*ywFi)o7vZasu_e%$(sq@e8d%*RdrYOJidjJ6i!2Eo=;)deK zFMW5;K>NT!=f}tX{83X_g>uS5HNQ+1JFY7`|*9b0yrFWe(9Ts zfFA;rGfQzCzxnaq1cc6r3O5E5IB~!DY+uQQ&(In8C9(eY~$9-!Ndt zq~Nmg4MF_Vftj6x^W$3t%$gKjHa^&< z_rg~UhIfD&Hb=R7D!);{oSuTqmOi$(sSZXN{p+ISvss}=}M*2?_ScQ-J59h@KE2+%y~ zV3g56zkdbponH9943fZk80X-i8;HX%eMME4Rf2=gFMaHP&ID#!3eJyjE->e(;Iiq< zF7T}d<_`|8r~cAfi1l0?bbje$|8Wd3l@6{azO}$ad*P$L?Q$@@FP&e0uLkaOz3_z) z|CYn#`zCNd>VjT`zol!S^aK-&h0zj`i)A-#-KMF9+vWADa+A0nEl~ zvgyi?AKxc{`GSM<1 zAD1iUdaELuM!)o34%{bu;mg5|z5vXZnNYZXIQ;nD0Vc0jV7~3+83Ydo=8q08*aP2y zrRW!M(D~)}fj*Ws3Yb^US6ol_WzBNSYQaJ0$JdMs*a^(v>J-QEf?s|wuSfaep!4G^ zVfg{`NKCetnpH9|AY9LGS99U#9OU2h&^nrT};DVelgApK3 ze(9SJ+{#|~n7(y~$@dB1zHk_Pw;d*57jQ51!gnmv_j_OxDLB9U_G`4PqjAvrmER8# zHWHX$Ik=w2lV@LmxjYU!KfW^&Pz%hb)+uffe*DrmV!dUJ!$IfAHxvP905iWyaU3uB z@qHPXyBwS!-{%qkhrm>AP`=zA_^tuwOAgMD?|X>esYcpP+o z>H7r2CIj<`gX@cHKfbqs32q^qKi``O8$`@SMCr47KfWqpRyjDo^sztM0L-USaDIGW z1m?~ZoS*%>*TF~vaq{DP5x4`r@Ns!(P$2S_7$tk#O={pheXE+#T^yga- z-1c7h9tFu2z|3k@wt@KZOWzZ~{K~=k)d%gtAAxx{s(d}!m-ZOe?{U!i@g0SLuLARf zt%~c3Z^kyuT7-knk8dc#RshqIg7eGoPGGJ{!DXwDtHF08Fvo7^U3IsJA73RfH4e@% zeg6W-DqxoE5IXF~@UM?fV4ihwetcbs|65>gyIA>pvM;XybI`&0@o{|r9xxwX(mP+- zPRp8ugU*lde1ug4bC-kbgKNL?+Xu`qdf{7!_%8u7@lptIJ@L&3W~qboOW#~@tO4d* zDLB9M{Q#K9QgGSysL7F{L;sv+Eid}ad17^=U)Qzr(XDu z!;St9%)s4pTWc78{PH{O3an4!pz}-LH3&N$n0*eer}jI)4dXu?bbfpV2wMltB`G++ z^tA(XLkccieXu=z)xq$-bbfrd19xvPd|@Q~VPKxxqg?qt@Kv_M9^jz!%WplxRsr*{ zgX@cHzx2HUOyEkg`Sbk%1OtHCXDjY_{P^(==)im$2c2K~Rw8T^FjqLZp2kDZ0P}~# z;Cl_2IoHZU z8^K2c^QeRCX*@aL2Ivb8IzPS~gpG1A0>sHLzoUVh+za1%h(80EPdT_gJ@DNQ%)Pzv z9f$Z2I~a)K{L=R_aDVTG?`SX_0%q`y%EfZ=;~NIdm=s(#do=~|PX}g;gJXI6@m&kd zS9;-NcYg;kCwvwHTo8vJ-&|nMcW{37yA|=*0`u#`;Op}_tYhM!^Wz(bu;C6yfH?W3 zZw_$Fdf}@^{03ltkb?8$+Y8LoDY$I)L3{seU|#*armiRZ68nN>wd0`k%kOs)b{#O& zz9_IB?cXPXxyix#@ht_-H-YK%CFSdB{C5s83mlvuAMO28VD3E(zBhmgd|B`7$M+b5 z2LSU62X_Rn{pzFrE9lR0(E0H(SziTa%2x%}u>OLB&W~>r!X^XL?BH^6?U&zcfca7{e6-JB17`T` z5a4>!=cT}`cW{2`dkGvZz|8-e(Dld{2j=q*&W~>uXl?~2=j+PX7e9XaJsp?|2j|DP z2=UJY=4J=ilfK*w%%i>VHGuEuz)ZM9)0fvn`nCgewS)6ZUlj4L2PXF$z4OfjW`%?E z#3X{ z1?IV4_-euTJ76Y#i+9!g`su+mV5(AZ+4|}8!Ert?-%r8$@jV30Qz^J?d?Ud3A~63- z!TIqefC=BlT=!}^R0?ff)_%?#?Jzy^Q zHUzj_9DeD$1(@$SI6r+EfcQTKrYi;K$M*|hexHKNmfr~Yx`BB=1?R`t_dA%=;GpwM z-#rLB4wz>gTu<||Nth&6a-sz1$F~h(RlsyPxSs0cU10igAPDEjcRB)w05ki0it8zT z-vZ{x4$hA+0-DEwc|HZ_SAMSmb1(&$tv+n8zKes-k8eA|Mgwz`gX<~3&j9m>Uiera zuL1Kx3eGQmxj(e5p*ZOL(#LM22$&}vTu=Hk?mq0J#X;xswWPmTG!S949E<>Qnij!( zI~lkz{1+bvt^l}(!^CaNg2QW9r_QXXoW5k<;(2psoOwbl*0gr~#-=qV9G3U|>KeR9 zlz}~O-pmEl=T}spP!vSs-oVj}qr`a$x99hJQ(hCp3wCD>woc%qxFZlhXFDdn&Tsk~ zw&&rypPQO4Zfagv#1G*&@uPq0SP8CU$C~OG#-k7iJNsN~IL_?ObFEi#mcSD*Y%H)2 z@Y3@eC4RKyBSm5$-SIf+tF9P7$*XK(_Tu7@J+C-u&n(VA82;|yPDUK8u`Mu*I~78n z1&Bbe3J8d8j?T@}cmdIe+L`K@3XZhYj)>r#n4-L7rmg}7RVfK{$;Sx!hD0J-9Fl@) z+aKyAXEF+Pm5#+pcZx)*u@R&F?dZvNZu{Qo$la6wp4huTHmpk^iAjkgDYWemc1ban z?yc**Zzz1~I+?UZpwQwgBMc6&Gz5YJVacvZv+81EqVF zu#>UJ@&xDRs_U>=3VLCA=CD{Iy|DZ&m8Dp6bgYx3p{#l2a8TQ!K3n@~(WT{Uf@aIh z*V7)CZP~L689g3C48quY=l~J-OT|J3QD(>3{ctYWT_&}ZFB&%|C~>7)gkiK3(`9(P zR|dViKf@Ek;HXNhZ%5_Oy3P&5J>6*E8_T;dA9t((ouJ&|^gIPLPmmbyh&qN9AjUF#0Kg=olA&xHfZF@Hm%Z<;@Pb>CQ zmB%Z}Cl8;fphu!#q?YK3QYS@Dok(ROoe?|IF(ce|=-6$!@r98zwuu?ZdMY(p!zF)1 zo%{`A4Zri^u)U*pBT`CBIVFSR=PpO6?SK_MdUiBdYZLK8!4?&#-f+R0dnl?x@SJ zKEPDNoIz!ei|2KKph~=ITxCWg>y}H*4OU`n$c>Pngd(=kJ21(SL|6^#8fb9=UjD{1 zm`ImEQY(2qq$T3VH8~B1VEq^e8%w|nvRPOODTiv7LVkN9dZE3dxS;)|XhY40;tc^! zrG2n%KW%m;>ZO3$6`esnclRmXyTPi8SB5$&^Q+=@!T7OVl~QC*zVngq-1r%F^~*cG z90%*_rSUHBte3nj@8qifLTQc*A!(u;AtlZIrMRNYvHBpnSYvW4k2a#P{q69cPr#R5 zN_fxZkZMs~p|-t|g<9J7Bot=^nMe$(ijC^1EO5LlgYauR6xcd&b`^6VsqQ|aG|@do zM9EhMna%kPiQo2G5o@}(YCZ2!nvhyV zI!c(hC!#cOW2a1y#QK))2*vt7jIy+Vcho^Ev3(u7Pwl!LK> zWs8d^#`5?g7}ftJX{Q~PMXEcvP1{4Cq^2%sR=$Cl30yI^k{8@i8JhjD%IGBRCxQU&oENgtU}I?q7jLT5t*w68v^2k zTy@NvyrEB(2H16>YLzxvj&OD#+&Q)t*Xwy-CsD~XDIDo7bTb)oV%9B(!n1ggwVX?j zPHZhkWEQGMK>-fw*q+lp$gV8BpWbbUg5mk^N|Cu~^C&n-r6I_b(XKWbj`Fm5%z^Z4 zRB?fPszE~^@j@Sm#6CUOdJg9axK*z8J4ods@m8fGeF#Yh>V1*rUE;?_P8UKdu#Sba zSo}sqnkLd|kj@Zk8l*OnY9S2*Q?9idlBVxMNYf?s6Obl~bf*^zutkjt;kS(c;0TMT=b^FOCvIVL>R3 z-OA-{`wKel+-jJ_UE|#l=_5w)W{GF*$w|(G53qAU)K?$GZ&w8oPND?OTkeepHIieF z)h`4;D~_h!(Oj@Zv+*KBUWyISOI+A5LeI)hCuc10R{nJ7+6#uqrx)6l!yW%4Yb3zQ zaJ0Ap@w!Xx1%);7>CONX4PAV>U)M<;oAsqu0!C=1)!p}DW+JU5+7q!nbV3y`+wUg} z1%;#i8%yX6L>Y!7*J3xI`a2tvn*1e@9)>>T;^NuD$r5=}_1MU7Xf5|Z{KD?Dif zq~U_w3`uiz4J1t|0xZ6aO4Agu28urCI_ev#DSf*P-8QT%2KMYOVU~y2qUN26TifJ7 zYzX}x9*yYn61P{~P~`PCIwEmU9F!$d)k`)6px`=zgi-6N3?Uq5jiy$$t!+OBCMjw^ zbA#2U_|>Oi4E&W5~$P7 z{Eb%*mtUkMC%&c7k>jGl;hB$#rV4{ZriRZfE?&7jnbqka(Ju9JNIG!pfTX&_XS?cm zr{~898gEM7KLJU#H!tAo18t^i#xO{#K_flCF`gfnRg?O_ zmx);ieXO7?X!I3*z_9o5Enq*1f?|+?r8KWjScQC9h8Y6xb^z3Pa_mC~4{@R7-STnA ze5XwFI|m>*8I2@#C?j!s63tz;I7U`23Y@+aHDWANup3Gax!h@!JGJa1Y)C)t+`l{I z%F(27%vJifS}=qB$kJWYdgI98>RV*1{JJhujeB&>>Ob zjslI(!xZC*@SdL`(B4!0G=AdKLy&$+>E!rD!T5B}QzqE6^6mOiynPS++b%1x>{+CW z#D?kJK!a&pk$pMu!T=epwR2|IRUxggYC~}0dR$u78{kz!$w>!#mcsao;^Fa?A&k_9 z;cgLVOk{&qEmFkk8cUq#YfwnE0^!y&qC@1L*f0S zA$9C59&P{YpSLR)bfF5hXiKA~A*f0`55KWVQD$68jYGF$ceTB5oi9DV#;#|U~+V9S!F18^Z~@M(7tIZ)bL`m+eUl8Aaq~b%frfd@0&U!Y`ybp zQ|A`__)uk=Qz*g^ZHd6=9LpA@m2itN3P~V5#SvoV6!FF`8PJJaunt^(! zXpRT+WiikvLn@QH81MP5grs$Q6(k*)ei@P)=zWmX+;UA&2gGbP6NKeuNID??DBv61iMd= zIeD3cpaBw=4D{xA!#zLr%g3=vW16%zqy>+5Igy8(JPtN6s4bF3LYh*hOE zkhDZD^Q2FE(l;P!?QnRu0i`0%#$t;M;pijZyu|ZCX-Di2rXcCD2&53CNGw+})`^)s z(3T92@ynv7dqJXc5)gvv6$M7lf>^g0;bh93E&|YhiH6e5ZXWH%JAAD_!rnGoiYYnN zNuOi}95V$Q#V$xSkfo;@cswN4K=zBOfwX(7chezhjB_Drj3tmXMja%Lu@#c)?4^)2 zE?a}@?2V9AXCYW@8*~9HPdfG&rQmL+S0_~0V%oSa;hsg5(;!EaBOSrw8fQ7-ZOJ^k z*&lZbolUR)mf~G+I{Rr!A@d0d8b2=xZ@=q)N6ZMND$O|Iu|iI ziMX7dvVb^xpmRYd3kcl|D}gJ0rYRYYn-tNM3@J@W$vGAUi*cB#A-;AAQghIIw1V{_ zV{M{e$E-eTl+omd#|BTqcp)~R{=Q;Fk~$MB;l#xAme@$A?)uu5qvM>o7x8cbN>zU! z@2OSpECzC|K&z2Dm^36>ja>3nlTJgTkI!y`MAM)~V=t~)$vIZO6wI%1&a-MZL^5YX z186?tCG09YwbtXgSOtg;bJ{C{^HBz>dH1of>$pgl4|ObvFMzh-BIHb$;-?`@=%_?_ z!0LeVct|sl#a#JP=^~Nfg>ST~>*EYE{~(D(Pr!xc(Oh2V#H8)Ad@H)R?XsX1T~LFj zg1&lINSlkj4QXTNFcJQRRd#OMUdL|NND0HYSdkJgeiEkuI# z%Ig;Lo%VooDBUY-S0^D|S}D^#X%?gy@>al)jyUaYxhFM4s*s#t0ZHRt(yqa`_+Hl~_Jz&_$x~;fjNfjp^N9)F36QN@_2LBNzJE6mxPex}qbVj)!e! z7lkezYR@SweWq<+P`V;Mi{@Hv--m{RgO&q7_`x4_eT4+9l9(w6D@mq+pbUmqvr)dJXwnl?wFp4SL$OAZB|{>K&u*! zkQ~nN&ekQM=z#bc%N17o5|)54bnc%VFDJG-(+k8Mv^;)>l$oNF-55sH>IL#p%7h&n z**5jV7Os1R;%9hv-F_^Ieux&-2q}W6uH&qQr0XtMLQ=)J9+D2T@AUlkL81xHl|h0k z)vs}_R^lyBf`AX~YBi$RQQ*3olZSa21_b$~FSWlO%U#(~K6H5}E1>}6+5$Tdg))fi zD*ftL-ZvUi@IYq6@Js^|j>oJAIG?Pm=Om*uek`Bq)Zyt^bed3{Y0nPE7lcr&+fiMo z;>pLDeVD>kI%BDLWg*&Cd}$E1fK>{dmgdVj)SVNr3vIw;fdArk`Hp$2#N;LxuIX5s ze7IZsHWFcXA_dDksa|S!*wIx>llwNL$s#=rDcR7T!4)0;#34r!vdY1sXs8-bv?5DN zU$=8`uYMgBL%C)d>V#gl4AI3K`v6jnd1-qaO4A+&-7ODs%7{tD)f}%{^_kf~e8ZN#Pghv@JW>ej2)=2vme#_s^L0lzjr@dOzB=UtO2N; zxwSQk)<~k&U6aqATYB)qa)jP7DocHfr;`UN=O#3L!I>xvgW)y zqDvpHC8Ao9%tU!wCSs#fG7#P~B>|TaHTr1xkopH{FFp45*P|iLMC?c>si^p9ak1R8 zZGV2f{iu_!;}LHS6ukgn8FyzBoMGr-;T}kw1{7E?c%h?EF&cUuB%OcU1!MdNPHLJEMW;;(W^(#!)UE9!n^y`I>i&La%?uL`pDAPow%{5 zlg+DMCfN5&q5tR;xLtVWlPm3g(gN!1#NWNtTILeNa6UpwQ6;p;y0X^%*r2lNNUUGm zC85Bp-$wdfZJxnoN)l1;@b^!q{W!YRQ<4dN65G3mqq~c+d9tP*9f(&)oD}YUmrvuQ zlal1G49|Qdv-w86=6eUQPB!fKkUTWs0yN)(aQnXWlKu{WJ+<9|Vhxr7mD+xrog9bv z@JW|_VFA>4K4^+i{8}+y$5-XdEt%tR`$RMbG!HkSu|0n6JLMrssMBrTEP+@5fed(A zOR1amX8sePjAnj3nt6fI%<(ve4P6VfH#1gR`b2l%`)O?KS5bvy+^Ro;BYtGY(MQY* zqW8Flg?>55pgXktUEZNrOTdPwmY@aFHffuj`)bQ&52daC zXq20V7DLj|4oDh004-NTheFcONs!b!tcRqy&p=W;(Fb?BTJFZdisDv6N?Hf58Ul_( zt;4@?k!LMrmz$3+H=Au3fCSmYFxRLKq2*!A!1g6lyV?)Nin#yg&!BW#h7@$X9F1iq z8_BZHw)Xal?!9N=Ns_sj%guR=7-y_z;#(oBz9@r`xrqc z76ilX9L&ad<#*2!RNE7YF+btbeOYCGtd`J4c&7Rzsz&Mr0;U6b-+IIVH$FMrrP;1^W(^EAL(pATp@dIFjnLusTRp%Pr3op1yIofi#bvS zhG20w23^1k$rSq?DI6Fq?s@#5ZL0aJQq2U_-sn)-#}eV5UT9Uwo`X4Oyno83G#N7@ zAuK4mW06>I8|%OOeCR;>tt})VW$!B<4SD;5c&p4?zn&hO>s$Xu!n-B*hJ0^E(erko zt{Fk5!Ppg4N?$nEG~Hh`QCcxa%5EpwqSW?oAMA6Si{eZv%#j+$E6fq8h4~*m=Xy1@ zM2?iI3`2vtB?&j5p1!>>^X9MpPg4FjiM$Z2UfREkX6}`7cevt7dmra7xybEi9{AL^1thvjlR$1kYQ zJ%&4b0kLj2yz?|f(fRLeNSy!X%Hyryqf`p4W$+tIeL(0)N z#=_Md+fx=pUWy-!f}adss&&>X4v{Yr8;+-B?#iipMMo#MqPQB9vclCR3oBUWTG`1| zism8%$OgSika%5bVV|k%D_?`8<MJ$&TS!`CfAOS)kTeDai_M0vkCiJ! zkg$}$yOm(fVg4Fk1+CBaDSB72h4xT1M77pm(_!Ne9ND)V>m%Eu(*vg+Dc zS!PR%VZ&F!$(8xl@m)GlcUxfCBSFnAPvPVRM;Z;1wWK01g`X<&7D%di97n1|E2+?Lpx!Wv;q-A%kWcNg7cc_;NWEYDjSZv{F%FHsC?;^D>nol5BrDQxd$Iy!CF}o9- z^Tu)#l?84*?9)T7cREGlD5fZgQ!KIPJSc(5a+nD!j_3v$QLhqgTlnOB=forO>{2SAQsnQxGt{@Th+0#hQ3!0ehzP;7oRQd{|tKmbS#{ zh;ak#KEdjHWx>ur;sFy2t8_0OZ``ogvy}+X#n3oW8G)8LcjxmTRj#>^v?y15Qc}6T z3BQX_V7b=akhI5p1X8;w=AR(FA{7F`O5lJu3R?G54V8lazodQX;`slheGN{_ZqG`^ zwwY9_Y$oO6>e@^*5=}NCD4R?)U?$jO$I1;oYTK1>?K;D=z|wO^2f21w%}rXP(`}?0 zV0WS0ptVf5L+8Lp%c;tf>LF>X`=lp*)syb>BnZ|sJi)mZ>4>xvE3_w}F&=@@j6NvN zG`MzUq#E6#bUw+xhfh$;VO?V3WCw&E$v)&|9gU$vtn2J}Wu&9h8C9l?K|H`Dq%ApM zxDu(;;hpBM1)(Zk>`4$T8aO&PS4T;%4%@!$MbxA!q}UhNvd93AgXJt5k?g6Y;yk;u z&d>+7E9WioGb|m=cpQ>qwrExQ(yF|gX--xmq`x!1P@AF#Eoo9{r?ni<_oOCBT6(ua zQj@|-u$q+nAgM`t7E;oryooCmC(2e$%8^pG|CNa`*LwfssqHZm`M>wJNnvVY{)4IE zFo`c4AJ0Z{VFfrk)|m^X?7T_Ng~IkF`F5ARJYqkK(bn=##}e4TM#Na#bsP}~x~|$I zB@e@XBsrbuN}EF)`f%8|Bz_fp+{E+FqfP7+bR@LVA=T~*IcBA$&&WLzF^4FA)zyet zn?4sqYBVXFM;?JASN>@51Y|5%oMuZkvRI;-Lw+hmkBJF^5mPl=o zP7{g4Bi&YbE2OF7$6ihEb}uBIl|ir`1>GeUM+Q+0Ig%rxU`NrmDM`_1*B1kTVVYPl5VZ~BP88g^(Lgn!u$cGkjo6#Uv)&PVye=j$K?l;B5JfJC#P$%((yWRNjTikyc&@B(1#9Lee7s zG9;}$4i2^Qz7I(&??FgfdCx%7%KJ4Wtvn7Gwer|(wDLZLl&m~{5jwT6kRbd}cqD0;r zC{B5B8j(PEwh)mm@a!SgtZ5^ejBCw#3#2Vbuh<%k=8?_a-9f9NElgO8t8_Nc*p;wv5tK`Q+4f*`2=>^a4|pp%Q?$7g*0EHO zoK-|!h#0cO-73|-_x=G$cX;NnkOge_VEU82!7&I@D?`h#YF7bC)ouYKRl7JOEncdu zN>tCN6mKUaEppE5RQfHXnF!^*Fc-oR!qLYXEVaQtLDZ;PN*r&wp|S7b6w^L~D{yQM z7_&wfw4IX^8{>^HoxMP@?KQepNGkyb+U}J7yphh*C)|xp_-;ZV`a=B!)ZjYFc%&1> zl%KI4HZ>6|q<8!{Z))d}(O*{5ydXS+W)VhkJJCXs$KejTNKy`Ikz{%sBrezHro75X zL#KtqB{7vCSY0@%nE_cQ!#9AO!U<6&BY2F{HB(?H0LT&}VB%nr|YcD;zFr^5rWUo5YejY7gm|Do6mgo#Qn+dEc` z+-SI&`#SZC;zD;xVI(X_Q9MTilXc{*UFCLh(a*XW2Un2?R41MmS-R8MK#<#AE`3b` zPZEM%)I4Z_=Y0~cboHB)q=izjpN7N-1_c)NPuHs+hor^+OHYCzJE+)b-3OQNO2N8w z=ee?2Gn0!o15>62u`}$U_cNBONO+LdC;GZA4|?$|0+Yi-IkABqGw|vM4Ct%8k+XV5 zRkM-G0_!|TI#_2g$5M3eWaj;}bj*=-lpE=ol$nm%(PL&uBeS8eY4?tRxelAiy^p9Q zlTnT!om=wu%XorwlktHh1JA93cy4u;eFV;v+TO#uhUC0co|=l$!&BS-SU))$1+feJ z19M_wq`=F(_ju-PaO-S@cbUr*oZEAJD0kyvPewiR)(5mRyyu4i@zvsRJ14embFhI$ zu4dy^YYuh-;XPO2CpnG-F5Uv3^|tK5iZ)ap59EZH#LfuY{*~FU?x<8y{)0>Kx0S1JLveZO!0cJnx(zbVG_*= zvmY1lIJ3mpiscs@Lk8=;=?gnsTh+ZFH5R?oPcP^T z3r9l2C%J)!)@waPFZEuViB>odNwR!mp$;wJ#I}d`AbKD+BC#!!*rxk4Zzdz!0fwO^ zT18Tc;$4sWJ~l%O`Xrv#npLn`Q8Yt~L+V_M&yKYHb9k-o|9D8+{!f9V?Y|t7zDzV5 zlEzp9Nk>!cOPZwYSfg4dO_07P<+KHomitaGl=Y~k2*IK;O?4xs#B5oNDBU{}odMpE z2!=nix05N?`XZjqnNErszb8sO%_IHQ_E1t+Ea8|aIF%9J^ELv!3JLG|EiU~lg~P$S zfk>$iG~x)x%1+OKt3rGggSU0Nih{Pwc3RO|JlGuvUrV+a&f000V3UenlaIxEds#k4 zBDwbTP`o^3FXMZkxX8!Gqq4a>VG_DY-9MUY27DGz5YHIfPapYLq zs%Z__mz7|=IWZnA#zOs`n^2a{%&ntpxKrh&Pt@pwnxki!y#*_VkkY^ogZUV0cvo_F^#b&5PN*6US3b$CSsT z8-#zX!(WubKQwr#DPe4+;M|2Nxc5sXCk3bPxDQy8Q#>ssVDwP#t z;diw2Tg>09xFcxZVU|X*q*g3P4<&+DYj2szfnFV|(XQb~wo2L_3E|df@s_Ba68YBF zWM08{B7b$r8QtX;U+EK00ZQUh3h=zN0?bU(zgLK?Z}&~+SAX`A?rya!L#Rl5R}fvt z=AfE(fX+y6f(h?A25pNIs$lp!HZvp9eCIW_*0CQ3rQp{3*o<;aO>{qMmK3q`lU)Ox z*F5(|2T%`k^%BV_!HuDWPT4UTB~ICuK>2DV8D}}lmzj*SQWP+IGA5EYLlIeq3AD9p zSWbKbX4{7-#RU-*A`~kJ`>EKh;s zMjVpH$U)z^2v_)G4kX1bhorbQkQBEIlJa$U(oZ01jK4tA7_URp82!+bsb3h9`YnT` zF}~nQC?Jb}iYgz!eVk65Lxa5Js4D8d1e$G_`=5PEtR8o8#uFT#>qv#eLM`y)A?Zlv z3`ja{oeD{(t#cshv~?+@#Zr6_td%^$xhoNE|95A@or6$sI8Nc`IvX$9$}Ac8aWCel2G-j0wJ0ROP(NYCmm1+4iax-t%(= z&xszr`#tX!lKVdauln%JeX<;ZsLoz9_PIAA2t*h-r!1+^1Wq2RQz+*3r8~ON) zgJNAtSp;dms7pH}T}k1($aeS@SPw(e0q~=cbg=sjBvnq%E>$`I3`v#qJxHpYEHzb5 zjA|X_6kP{57AF_Jny=~TSmWLl4KVpMKsO{ZEtfcVqhwlF;R+@NO-f(-UG3=Na4vTi zL$4SpyIUW@FP9v{d+vjjzE=&}ibq1aJ#S2{eNM-=Nb1sPIFXlf86Bh}lX{!4!VmA{ zzGGyUZ&h-W6_)YP4EWO3dfvJU%SrlF#iigoh!_vV_=0^2zQO2~8dBh>uzU^<%Tn5c zz=>X;k4lGoA5a+Hc{0eE+XAZs(o&H)pEzHn)sXZ{Syw^Y1HWABQ;>9v#AhMtlI3?G zEt43W+h~j@Ah91Qz%QO-%B>??I>fb!vAukky#XrqQ=Wa8+Qp%j01o=&r)}Va}J};N@WzW6Q+;|=y1$8d5 zoAEwrG}KXncg#cG*vu5%jUjv@F*SBZMj3{+3|B(eBr3}8WNaEvE$7&8@S=M9jbbC) zJ`BXL^(hVa{Y0r-5h%1i@w}Bx3@wzF%uGmHG7BMT$*hN@y2`aTEhDb8sUKI@l1~!2 zBtqwY>V*27$EUXRgq-HaN+4d278@id&8oB9i4=~e`UXp%k+uE~T3D<7sc2wE&J(eB zIE#g0jt_=m>y!^kP~h^#nIP6R$ax|$+Icu=Bm+(|_}s?Z2{c%~J3GMn{&WtX7_eeH zaabG{(m6G4t4&)3C%*Y%)B*~)>H^tb=I~{4!0$Bn{)4masro9zXGVK@R zims2mnJA*v5It@AGCAr$K!qM$1?Z;lr@RL zQyz;R*M>2EtiV}fvJ+Sgc!6Hgx9ed#;yGyWX9BHL6UM9N2@YH2<<6JLZFLw?o$(dp z71%d}aYPQgs|VQkj9S7+ z7*gLmc-xPu?a)WDQM5~zYv{4}6E}6zYZIs6WDv z!IAo9;8Sp|PkqZFvC<2$N6u9nT1%agb$Fq-Kq6DFbqCJ+bePW<5r6E8bibZyp|R-X3q> z=~ielD)gwt)<|Nj`#Fga-;ghT23rrkjei`lY?6X2f~18x84{}kQ&~@{^dxGlhF%Ft zTj=K?=_Wr279Z}Y(`|ekrD(jReQq?acfSOmZ6YeqTVSCre5xA;8e@xXLD>M1*p~4w z8I+?F_&Bn&*8BS@i{QoA^vO+Hy=`R)8SHF(Yf~e6|_OTBg-L#vuX^>m(WEF znCEj6&n3*SXdz$}o)!#}NA-9v;G`Fymph%@q7Z1e-S^3+%n-aZp-l1+9J$sBIBSym zlvtBI*9&FunM`tWdaNH}P%pG-yg4L!!Smh)=2xfwbGB$-DIGTnD1GM<2%my+G?8nK#938y0wk7M zuEpg9ea>|jB*k%jKLcfvYq3(b?KeQu7#BfOmdhb&skcK?mQO%ZmQO=cmajol7OJ$y z_z@(H!C9upfFR%N;jioX^i}49-t(=i5hS^UN)PdjbMl#PPhorsbUmq)Wd(KO4yNOv zol=qVWf*%4K1=%o?eAl49|d9u>+8JNN8y>gSNg-I!64Q$8U~3Urz(&)gVm3{qUN1t zuA$RBKQ<=aVz&s=cI3Lis)fX7NV(QJoV5fwIZ^9Lo0TlLFX2iCKhC(2Wh>*tkp4A_ zcpldf%)uq|J?+h!j^2DcRhZ zMYHl=5UK%e$|loyjJGIqQ!-n_39@M?1T1`;UA(DKA&@N$dgmv-8t#9;FOoQmW+A1 z?fpdTNYrt8V!4dQbr(S!c3sFuvn+hi zrO(KBAMn0-xZ;t{``G9^8JSg2CrtQV>ygzUk*FCY)V?Sm&lc>tT!qWEXW&^+$ezoG z6}VtXSq+~IL##xSN#>6Ku@PE$FA!2$2Eh9v@4V=|au%=5_qN2j3m&05`70}z&whNKHP7~`n%R3XfUKCz(rCBGvEG3;AOn{{2HQkdSSo3&- zLu!x?yg4MPk@~33NXm$^+-M{wSyBr1u>QDOpdGa7Bl`ny?ZWm?iVh z4`fe4?>VGn+fZ%q_3;vXQiiXBbZibfFE3(GW)R!0US3j`6Vv4|csOu;DM*H1h=d{u z+h>RokqA2m;JZ{99?4)HgN)L>%VoJ#mk>@wN;KVNkTkVyNgBG$^Scm|<_dzfl_xm& z0~uVHKwBF~KWLu!f;`vtIHexjmguvsZ%6qX-GdXqP?(qADF?&X(C`zIcOT7v_khGN zQi3mwbyQ+Y?tpE1597gVq8lqGAKD+mL-tyREBOaQuu5IweK`<@KIY^XdUH(2(xHNI zi-enW`GiR}^+w|NUX5FNoo+G^pyWnf)|eIv*9=v<0+RM>*Fic5MUZRV1WDEXK~I7p zn=GjKLF*_kL&)ZG83Ujb&iH)ne|bIlSllhMk#aZd;WtuSD|cpbaQACBfenL{vukP- z-!Hx!7g(moABK_-m;dv2Ek&5eiJXb*m{9gY@RQ{c#N*e?>+5#!Cru|+Pp1a7w#lUi znhY8>EH&V)JDR+*awom`yCzbfy8VbFp7#RLlk6D<57D%$icNX!R>lv{d`kD_*)93; ziwo?FBQlfp)Zqp9bB(;64p`XNYt`~v2P~&T;&3QezG|s{Q$4?QJJ$ez9lGeM1Lsk0 z7HIA8+EU7(jeGttiLAc~k?_u+qzm8ZLm!+dkKj9CUFC(Gi*=RDpR2nWB9`9qrOo)# zg6`ZnjWDOi`6_ve3}Z+YXM55-QSUTQCqeooQdD47Lef0dK+-&|^8DDdCvA5WSIko% zd6Pq{j-N|-t?jk3_WV%I!ub5x?CC-Kw0OkDi!+s=UGYIYb}+tWH2#7g z2Nm5%&W`4{J(ZZvfGwl3m!aYVd&_7kPiF@JV?9=9|9RyjLF+U`(E%uDwMXE{wK!bX z(cN4~T3Y8r(o$%Ibe)vjt&sGg5Jx)tP{7>Wwf$J>OS7Y)*|AXDPZHfZcD?4p`LjyM#qzWdYu7kSoIhp#Xij>5;>z)C6>^em z)q6Q%ZEH?0f~3!0FN3sLa1g9LJi!Gle!CKX9T*|d>YaE%gq`0*;Uk{}Mm1%A{0#$E z_c6fZSRxE`W`4#FU$N`t)O;H#3#?NhB|DorxT2GL;`eH~?S?{k)dY;U`FwJg7{%LkF2PB4l9$vxI<^P8m{;ETx{>sh&a~X?ETy??@5BgV8}REAJc4{^ zg^}P5bf*6%!9F375faulX6cw>%0cu8n4Qo%s1K^6*wNL}m)Z{X4d2k&F?=Ocq2cjD zj#KJ79kt~P2wYH@g8b!5qGyXV8h$z_W4qLBam<$NDi-64&K>*i?=gJ{{EyNH4aaAx z2W#BAF6o?*0eNxa-%mHkRLLsZDCwt$>1Jf^oy|ixpf`g;vPmZwgn7GEw^!f_P9_YV zDYu|mr*pM{pXf_|>J5*&7TTBc4duBV+k!gZa9@@>yDab0W8Eo8P~KHV+3xPa6`eb}t2uZV* zYz`cDs2|ODQmwY(ims2Pf7pO~airykDb~tDM*>L)Cc2dVCMj9jIVGFmM~TCg0Zs#Fe17YvtsejSihhrZ(Zy$ESCiaytR*$d_4 zfd%3>9FpoE0xkYAEV>-4pLAMFq{=jvy)|tb3Az;$M?dt9@d&?3hWgp%Oe*7(VYMVr znV&L=y>8>~}jG%znmN8QI9jp>~7^krl0Cp&`2yz{GgUi%ZfMo#&O-MPUE zFW6V**)(WI{>jI6Y(WkmVh%kv+#=t}Vb*q%Y_yXQO*7jJNi)l&tKXL)Y4Jd??&Jv$ zAM6ng;06cI8Vd332u*WzEwoyUxqXhBPwdG>68pCOEYUr{8~ED?I_i^ub&e~Lz+6%d zdvu&@o}IRqx@f>nR2l0A@<(y8^@d*z=8LZQ1|a69>zP8m*%B0#P*wqFte z{k3?6R#qOk;t0QZ2sMG3NufM1PyQt%9r$q>S(SwSyp|EiL|R6hJ-<&v;%ZHLd=n zh$CH?EIvs!qTLQPSD@PPaV(>Oy~IVRp7kj|Q=i81b;5!a{gHJkxwC!H?fUu0n%gf% z6Ls|`UzYS#QTPl(i;R;uEwY)Aw0P!wq3b+978e)Va;;sER8g*mq>4f{QbmCv-+%=a zMXTzuRElZE!X?!eiz=3mpE+-ywJ_EgYh2RW*fPDUykdLCW&NDyrf8;LWm9vLHLYRu zrY+-}*5+(~#Y!Y-;-_8ExH>w%q~ucp>vHuOzqX~ZA-a`wOc|-=1XfZ^bK}=Gu8FNH zuBIpS8*eG^Obh45__eE}s~unFCMPf&XQEeMwsNu)fFHNZ5R7;qk25>eq|a1b6{h)c zO2U3sG2_>?w&Fq@`EmlR4byFPyog~+EbDq4yh{3f3s*%r$gG%0AQh+iyo9R|j%2KZ zxMG@Iqe3rteIL&80d{~yrSi9jfHqGbD@F_|2 zxd%QI(|n$S4=W$xpgIMK@78frqr#-j&^$=^C6N?x(R+YqJj{NR5*NLUMPAv@@;G6)Lx#+e%(ee*1 z7pFB<(pU68K)rGEK0wMom1iJAa{^?e`&Hr3FlgaTQ+c@Tl9R?WPS-3^jO;GIElvd7189YZLc22m+#=41EM+`OJKYO-xJAFoS1=@Jzs&?zL-wz0u@379r{7Ji_2PPB5%lx)1C> z+;8#}AtasWID_YS!O)`7{qEK`pEG$*Ku9{z@dnRG!MHqie?RoJ$wNz;&NI^BfoTJV zJq%0t!R@~sWAdD6@QgBeP7=(iIMZDiY(@2E))!Noo}QBoo|6UR@@#vwKQfWY!JmV3P&NI&7VUBcEK%RFt zPiZ%KN(`P;4IYlcassRox{J5&>NI(%?dj<`&EP2&jLY-ZjWd2_^04&Mc}fkQ(*^Tm zoY`N-1`fK%`bPr5>3XMCH=NyEj^PFw) za8#)Fkg-p_>Cay^d8QdWQw^T!f^qA8#fs{@MS9pv)f~9tcP7tlgJ+h(!{;730sd8V_VnL9 z^2YTh&s>9Nj=^)TVBCD|`_5n}FG$n+_jv}-xdspCS2+Rp&WwHFv_+SjJPQPq+Mmuh zc+L|HM;+wpv*oKRO`a-)=RAXFp)lP1q9grw)I-r!j+m@nhZk^PlT_n@IR(vq>-mNCH>?<(>a9dC)ax@N6=8HVbAi z&aAT$x88(?o0*<1f=O+sn+=|e1S6?}bX8;pnnxy2i@|e|!P6?3+i*sMuwGgAn>Ldt zYVfogJTbwDg@Ls0_nmu9o~;H?%;4E3m`OO(t-a~G_f4Md2uZK^Z3fQ{!SHX9GGF(7 z`d?Z4uZsLCG`u5q^nLJk*Ji84Zs0+&HC7fA4 zKYO6+DU)Z9!P92&pm~F*=W*th22Z=ebCqCA4yq>H2e(!4ntENRq&1 zAFqA_A?ZAEgU1$(o1WhcpZXg!J=YjKw!zbp#*;l?*BU$>1`nzkX)eW?T3r2|pQGwB z_4$(q&vgdRrv&4cPx&naVEi(9t~Yo-W$=7jFelU? zX)x1sqrr27!SmTPp6vPhoWb*1gXi;tITmM@N^AZaboH6#^96(F^9Iis1@i-(*%!XK z=dNFwJYO<+zG(1pq>&TgmjMPrn)Q_~G^Wh-e8u4TvcZGt7I^qoZQ6||zE?2B<7<$_g8r)&n*Ve%?8h{g881qlOMYH4<^rT2G6Yq&+URq;LLn|=bbz5 zH+jBh@Z4_jd|fa-=j#rG=j#T~Hw43e2L)rzdMlA-e(_C%=Nkskor0mI>WgFc_ddGZ z%-6RBliFY0Y4F@7m^X1|`P}}%jalsKw+)`V44&@@<|Le{ec9I&?lyS7WAJ=eFm8L# zZl9?Y>2~A02G2c$;dqtl$-bU|qR-&D$KbhFFg@Ebw&L{k+-vasP%tQ587I7bXSVi! zpTYA(g9qyCv{SbCpDn5Vhgt7GGI;JccpeZ8Kg3R+hg!~u3b3S7=W#zacpfl#9u&+_ zoEdw4;nlV3+8H^gE;mCUjDVovsW;w`uwoLvrjPp!kJ_G%llt@(Byf< z;Mr&JbPA>mXWFs1tEy(0Jo^ovPJ@Rvo)h4Bl{}CBcKd}U&tnG9qXrLCqU+dwAYC-$ zd>Hl2`g+{p=`whp5X>^1$#e0@8>X8)PZ~T=7(71_%v_wAik4Mpq4Ug4&rc1WpBOwp z6U?(XbNsw$OWye=&r=4^&kUZQ3kHJ&33=}4Pb@Kco;G-XZt(m<3S8FGlmoOwTKVNwq(} zGkAV4n4Wq5VDS9j;Q6Cq+;QFS>Tf;HOwXSTo zz^x|FYX(oZ!SlLca&V^WIPOPT`qRH7B)wg{Ztx%)Fz4Y+yZYGYOK&jKbI{=Vhr#oP zU{KlO{&u4Eb(4pqwe+3Cp=br}8zXUUdXB=JoKD*iE zdE4Omm%;OnU@pd){rjmWy_bats+p0mcMP6)1+&%RdFtLnwwa#y44!ulp7#Ya4rjVo z?x_B~$@2k1(#!dMgXcrRRO8Ijt$piOdeXNbe?_&5C0}}PGCMbn6KLpURq`H@QZ%wJOd1#fr5Dq9IUV3j4L|FHkOuwa+h4cBHFXC7hj3^sU%2!?ip zZtK}cX5rzhhw14VV({>b+sWOA2m1UNO$}aY`QoZYI?s^?4`(_#fmMj<-w$$6UpmiG z2G7xgnFk))u{XyY@rs$AV+@|74IX~uF()ty9JH%BD_(_4!YeIb+{&Mxo?!;h2*J=E zQV)l`_w^kn&#?y22!n?sUS01cPwQ(xK!*mewDc4iJjWS4#|vf^V)~c!2?o#c2G2;r zECLVv)3ZPP^p$3MiVdET2G1zLG=PKSgo#U@-e>ZhXz+|Ocuo=w2A9I~Oym_*8@$rW zXSBg{lEHJbV19&{Z12BZnd|n0Df=@|5zHQh_ruY+9)EbmxYrotUZ)uM8Y`GN;9wcP z_R9E)CeJv7XRN`)ovk^6T5v$Ho`3RtS#0L12G4kdhfgJvd$GP)`8lX98B^CBPBVB) z3?6=wIVXS)Kw?k)>2JSi@{}4p6AYe-X*@5-K0vj=D=j^IfhN5TPBeHX31%^3Qs?td z_5nR7z~J|Enk2CC!n(MN=r|f!86(5;jBUTlrr||e|WCQ-=|D`bJWK6BEv(qpLw9Ybk&JoN#2;@vJ>UA;8|XH1k(RG=gJ*`pGcyg7y?iRtFt~{|)8MHT3zJV~-`<8hF&NtJu(BP>O z9x^Vb8FieBYaE|514UwE@%P~zpNXCizXne?A>d-Z>iA6deC~04CV4(xj?XB|jm0lf z(;eyg9CUn+@_YtzFadYG=QG;z8R_}(GgNdZc|NNgpVK@aeiD+d)bqK~@fqg%e9!S2 zA*>x*eYpo==FwCb*M5pA#LQqdlLQj?bx{55H_rcbwB}Qs(@F#{=tBv+YYeP)aRNEM1 z2*FzaurY)-M5;E1V5`O`wha}d)#y3*o_pr!&SR1-Gv7Jq-gECg_ZRk-$Z;l@h@4>Z zCLE;TInCsqMDAyDJ&|P{x|Mr~tYk7pWPz>fL?R}Kh&;{YZX$Ii$A}zda+1hhOnyV; z^Gq%i`3jSDxIl#GJ|;I1`4W@8M83+TPUMSBK1-yB$wNeTGC4uyW+pEX>1FadkwZ*Y z<5CZv7L)f7`4p266ZtfgDI#|;IY8u2CWnbEGWiCPpEG%!$WNKb|LqX?bBf71(s_o- z--!H*Ne3#zauiv z^}HMw~FTCeOJo)6Tq3fP$woXRqDNVE8f3&E zGX_~Q$QKOqkU@?c+wjD9!0thGG>qi2D!^1-!jM#4RYEb=MD0j zK~}8R9_#knV32Nuj2Wb6kUI?WHG_QDAZHBnia}Q5U!l;W>UonvK4_4g2H9Fdxd2cO7CnH(ZA!sK&ACYXGg$X+H76B%Uk7?C|peney!lV1|~2$Qo!#+aNZQe|?H z$gAAr{zK%COy0VtBA@>;*+yhNr!z%l4U>S#Y9>dBtYz|TA}?^tCy6X)opVH1F!?)? zcQaXrN7C?I-J#oJ1Cb6U*Acmn$xb5gWim#`XBawe{%G-#%&g2#%|6<}2`7e{t5P3hRe3S@gsQS(^ zgB&MviPJevs zMCC+IXFcfT$Q=4OwFTbrcSo3P-43J=e(>y6mTT*c@O5X7 zVA=Cz2awy~=K}mFtD6j>bnlx58Rm*0D|{ zTG{@Nu1};^b7X}&d8>Unt5eV12MwqqwNkm4tWZa>9}~e$uBx1cFRK|Zc6C~C8ATFC z?m=NS5;*U+<2bY;EfirGgwC9B=F6ldrdKl5vQX6BC>EjR*uEn?J9YzK%bH=}h$zAf zHeB0tZx=N!iRVIL*Cs_0iRqwOLi>U^4jNhz32$~J4v%s923i zGkjCbavM#{vLI&spkhT3HZ`l|3J)dr5N`DWyWA-a&t-Y zz?={9lpArLiXg>iG-rouBvme^QgGtR(tIVQhLCJK5u_OgGf9-`j5)iaaK;WpSA->f zI4d!Vm=%^4GAnOeOd9iaL`grPr3#~l!g?6a)S(r-4N)rJd(f zex}NBz%FQ-A`Me~GiylZ?bbxB9kdvlHW?HalXUAHcluDY9v5^c*${LP^Wvzz7 zg0m8pW?`9bsunBZkz4n(1CLB~CJgMFV`oDdoGKfZp&(@#v>~DF`anewsF!k@!}I-| zpix9U;fJlT5QC{?G0cYsN!l4;IJc3tNlEsAHnL){smx0vB_n84N@-LUEg93Yc$s&- z%xsd5L!dkFLMZuiDVgcgIwM00HA4Tubtp-t(*uvO?-DD5jnc(`Z$xQH7>4D zU=4Bw1vNF6D5OiA@&riU-X0g6dXbt-A6wIzv;DfT;J-Ckc;&=UESUII@=D%T?B?pW zUoG`#Jh4AJa-?_~BTvh4a)qocvE+y*ZVxQDiSM8bI|IuJYA_|Mr6!EhzGKI@U4bk4 zJl7XPKI|(n;6-g-aKny{*Z1q=x~ zZ_<+8A|8Q(VgPqc)h(J%Whtiubl@P2_G!A40s_)tuw9A7lxWz^xgZqPt(`hqtf;{t zoO1oTC&p(Ez=eWU_M~5~uw-JrRoH}6ZB2PXG}9cx-+sAmi6>M%rcN88p<0=6TK1au zlB^Y!SgB9Y`ag9Saw~|^dP-n17xjA3_NhZaAn}jcULw+R0|aLj zbM*JJlaR^ekm+mrG(u#=%!zmuXW$N>eSE+Z(%Fy!SB(TfJ%7G1C!uCbYv= z>LFNQGQF??fvs?=OdMG6>@3a@tx-FgH=|-S@nW~B<08t0fQk$bsBCnMz(hx$^ro(; z)wk+x4jgy|uvArFv*5XYZ{#Fi;MWf{U|5YrgJx=c<8d87U~QtNVEjnm)LbG52oy8} zoOtycoIt2@DFmAe+(3ewgB?}9!i3}cu)9WF7x6)Cdc9hABe^HkpD_K_EOoTu3)rdZ zDHq2cT9wIj4?{>ZXd6?txTO?mzofIw$zXq3%0tlz;BrvfVocIm2@RB2JSx#PG`~!X z5cb%#*TPc8vcK+17q-5uo$X9PUR5X4JasSJ}r0$b9|G0S{!6a|ioa-B!4V4>I$ zAlckP;Wc2P;6}n>uNzJz&tojxSxBJo>I9iX5Vw^ni5A<&_R6qqU)8P8&$+TNWW>8U*~7^=N9#sDF# z-5EIf!0u1=jeP`@%kFZe1qw2~HKU&RGkV3DrftK-&x>)y($*3<31-^?`)yf%$T_>B zGq|t8EREh=wV;@=_QvBT)m@z+n0M7M4>bp)RF^L5oV5Ulb0JiFPmk4KwYH2^hX;p7 z`v-?dt391`HE>Ti+zs5bxwp5fwI-^&$H#_ujZBPI^H&DvwE70B!{dE>_Y4gT6x8HZ d!bRPIk&&_Cv5~=|E?zOLbm5pSEtxD+<^N{R!?^$e literal 0 HcmV?d00001 diff --git a/compat/stdbool.h b/compat/stdbool.h new file mode 100644 index 0000000..3def25f --- /dev/null +++ b/compat/stdbool.h @@ -0,0 +1,6 @@ +#pragma once + +#define false 0 +#define true 1 + +#define bool int diff --git a/compat/sys/time.h b/compat/sys/time.h new file mode 100644 index 0000000..d34fd4a --- /dev/null +++ b/compat/sys/time.h @@ -0,0 +1,11 @@ +#pragma once +#ifdef __cplusplus +extern "C" +{ +#endif +int gettimeofday(struct timeval *tv, struct timezone *tz); +void usleep(__int64 usec); +#ifdef __cplusplus +} +#endif +typedef __int64 useconds_t; diff --git a/compat/unistd.h b/compat/unistd.h new file mode 100644 index 0000000..b0690f9 --- /dev/null +++ b/compat/unistd.h @@ -0,0 +1,2 @@ +#pragma once +#include "getopt/getopt.h" \ No newline at end of file diff --git a/compat/winansi.c b/compat/winansi.c new file mode 100644 index 0000000..50e8388 --- /dev/null +++ b/compat/winansi.c @@ -0,0 +1,392 @@ +/** + * Old Git implementation of windows terminal colors (2009) + * before use of a threaded wrapper. + */ + +#undef NOGDI +#include +#include +#include +#include +#include +#include + +#include "compat/winansi.h" +/* +* Copyright 2008 Peter Harris +*/ + +/* +Functions to be wrapped: +*/ +#undef printf +#undef fprintf +#undef fputs +#undef vfprintf +/* TODO: write */ + +/* +ANSI codes used by git: m, K + +This file is git-specific. Therefore, this file does not attempt +to implement any codes that are not used by git. +*/ + +static HANDLE console; +static WORD plain_attr; +static WORD attr; +static int negative; + +static void init(void) +{ + CONSOLE_SCREEN_BUFFER_INFO sbi; + + static int initialized = 0; + if (initialized) + return; + + console = GetStdHandle(STD_OUTPUT_HANDLE); + if (console == INVALID_HANDLE_VALUE) + console = NULL; + + if (!console) + return; + + GetConsoleScreenBufferInfo(console, &sbi); + attr = plain_attr = sbi.wAttributes; + negative = 0; + + initialized = 1; +} + +static int write_console(const char *str, int len) +{ + /* convert utf-8 to utf-16, write directly to console */ + int wlen = MultiByteToWideChar(CP_UTF8, 0, str, len, NULL, 0); + wchar_t *wbuf = (wchar_t *)alloca(wlen * sizeof(wchar_t)); + MultiByteToWideChar(CP_UTF8, 0, str, len, wbuf, wlen); + + WriteConsoleW(console, wbuf, wlen, NULL, NULL); + + /* return original (utf-8 encoded) length */ + return len; +} + +#define FOREGROUND_ALL (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) +#define BACKGROUND_ALL (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) + +static void set_console_attr(void) +{ + WORD attributes = attr; + if (negative) { + attributes &= ~FOREGROUND_ALL; + attributes &= ~BACKGROUND_ALL; + + /* This could probably use a bitmask + instead of a series of ifs */ + if (attr & FOREGROUND_RED) + attributes |= BACKGROUND_RED; + if (attr & FOREGROUND_GREEN) + attributes |= BACKGROUND_GREEN; + if (attr & FOREGROUND_BLUE) + attributes |= BACKGROUND_BLUE; + + if (attr & BACKGROUND_RED) + attributes |= FOREGROUND_RED; + if (attr & BACKGROUND_GREEN) + attributes |= FOREGROUND_GREEN; + if (attr & BACKGROUND_BLUE) + attributes |= FOREGROUND_BLUE; + } + SetConsoleTextAttribute(console, attributes); +} + +static void erase_in_line(void) +{ + CONSOLE_SCREEN_BUFFER_INFO sbi; + DWORD dummy; /* Needed for Windows 7 (or Vista) regression */ + + if (!console) + return; + + GetConsoleScreenBufferInfo(console, &sbi); + FillConsoleOutputCharacterA(console, ' ', + sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition, + &dummy); +} + + +static const char *set_attr(const char *str) +{ + const char *func; + size_t len = strspn(str, "0123456789;"); + func = str + len; + + switch (*func) { + case 'm': + do { + long val = strtol(str, (char **)&str, 10); + switch (val) { + case 0: /* reset */ + attr = plain_attr; + negative = 0; + break; + case 1: /* bold */ + attr |= FOREGROUND_INTENSITY; + break; + case 2: /* faint */ + case 22: /* normal */ + attr &= ~FOREGROUND_INTENSITY; + break; + case 3: /* italic */ + /* Unsupported */ + break; + case 4: /* underline */ + case 21: /* double underline */ + /* Wikipedia says this flag does nothing */ + /* Furthermore, mingw doesn't define this flag + attr |= COMMON_LVB_UNDERSCORE; */ + break; + case 24: /* no underline */ + /* attr &= ~COMMON_LVB_UNDERSCORE; */ + break; + case 5: /* slow blink */ + case 6: /* fast blink */ + /* We don't have blink, but we do have + background intensity */ + attr |= BACKGROUND_INTENSITY; + break; + case 25: /* no blink */ + attr &= ~BACKGROUND_INTENSITY; + break; + case 7: /* negative */ + negative = 1; + break; + case 27: /* positive */ + negative = 0; + break; + case 8: /* conceal */ + case 28: /* reveal */ + /* Unsupported */ + break; + case 30: /* Black */ + attr &= ~FOREGROUND_ALL; + break; + case 31: /* Red */ + attr &= ~FOREGROUND_ALL; + attr |= FOREGROUND_RED; + break; + case 32: /* Green */ + attr &= ~FOREGROUND_ALL; + attr |= FOREGROUND_GREEN; + break; + case 33: /* Yellow */ + attr &= ~FOREGROUND_ALL; + attr |= FOREGROUND_RED | FOREGROUND_GREEN; + break; + case 34: /* Blue */ + attr &= ~FOREGROUND_ALL; + attr |= FOREGROUND_BLUE; + break; + case 35: /* Magenta */ + attr &= ~FOREGROUND_ALL; + attr |= FOREGROUND_RED | FOREGROUND_BLUE; + break; + case 36: /* Cyan */ + attr &= ~FOREGROUND_ALL; + attr |= FOREGROUND_GREEN | FOREGROUND_BLUE; + break; + case 37: /* White */ + attr |= FOREGROUND_RED | + FOREGROUND_GREEN | + FOREGROUND_BLUE; + break; + case 38: /* Unknown */ + break; + case 39: /* reset */ + attr &= ~FOREGROUND_ALL; + attr |= (plain_attr & FOREGROUND_ALL); + break; + case 40: /* Black */ + attr &= ~BACKGROUND_ALL; + break; + case 41: /* Red */ + attr &= ~BACKGROUND_ALL; + attr |= BACKGROUND_RED; + break; + case 42: /* Green */ + attr &= ~BACKGROUND_ALL; + attr |= BACKGROUND_GREEN; + break; + case 43: /* Yellow */ + attr &= ~BACKGROUND_ALL; + attr |= BACKGROUND_RED | BACKGROUND_GREEN; + break; + case 44: /* Blue */ + attr &= ~BACKGROUND_ALL; + attr |= BACKGROUND_BLUE; + break; + case 45: /* Magenta */ + attr &= ~BACKGROUND_ALL; + attr |= BACKGROUND_RED | BACKGROUND_BLUE; + break; + case 46: /* Cyan */ + attr &= ~BACKGROUND_ALL; + attr |= BACKGROUND_GREEN | BACKGROUND_BLUE; + break; + case 47: /* White */ + attr |= BACKGROUND_RED | + BACKGROUND_GREEN | + BACKGROUND_BLUE; + break; + case 48: /* Unknown */ + break; + case 49: /* reset */ + attr &= ~BACKGROUND_ALL; + attr |= (plain_attr & BACKGROUND_ALL); + break; + default: + /* Unsupported code */ + break; + } + str++; + } while (*(str - 1) == ';'); + + set_console_attr(); + break; + case 'K': + erase_in_line(); + break; + default: + /* Unsupported code */ + break; + } + + return func + 1; +} + +static int ansi_emulate(const char *str, FILE *stream) +{ + int rv = 0; + const char *pos = str; + + fflush(stream); + + while (*pos) { + pos = strstr(str, "\033["); + if (pos) { + int len = (int) (pos - str); + + if (len) { + int out_len = write_console(str, len); + rv += out_len; + if (out_len < len) + return rv; + } + + str = pos + 2; + rv += 2; + + pos = set_attr(str); + rv += (int) (pos - str); + str = pos; + } + else { + int len = (int) strlen(str); + rv += write_console(str, len); + return rv; + } + } + return rv; +} + +int winansi_fputs(const char *str, FILE *stream) +{ + int rv; + + if (!isatty(fileno(stream))) + return fputs(str, stream); + + init(); + + if (!console) + return fputs(str, stream); + + rv = ansi_emulate(str, stream); + + if (rv >= 0) + return 0; + else + return EOF; +} + +int winansi_vfprintf(FILE *stream, const char *format, va_list list) +{ + int len, rv; + char small_buf[256] = { 0 }; + char *buf = small_buf; + va_list cp; + + if (!isatty(fileno(stream))) + goto abort; + + init(); + + if (!console) + goto abort; + + va_copy(cp, list); + len = vsnprintf(small_buf, sizeof(small_buf), format, cp); +#ifdef WIN32 + /* bug on long strings without that */ + if (len == -1) + len = _vscprintf(format, cp); +#endif + va_end(cp); + + if (len > sizeof(small_buf) - 1) { + buf = malloc(len + 1); + if (!buf) + goto abort; + + len = vsnprintf(buf, len + 1, format, list); +#ifdef WIN32 + if (len == -1) + len = _vscprintf(format, list); +#endif + } + + rv = ansi_emulate(buf, stream); + + if (buf != small_buf) + free(buf); + return rv; + +abort: + rv = vfprintf(stream, format, list); + return rv; +} + +int winansi_fprintf(FILE *stream, const char *format, ...) +{ + va_list list; + int rv; + + va_start(list, format); + rv = winansi_vfprintf(stream, format, list); + va_end(list); + + return rv; +} + +int winansi_printf(const char *format, ...) +{ + va_list list; + int rv; + + va_start(list, format); + rv = winansi_vfprintf(stdout, format, list); + va_end(list); + + return rv; +} \ No newline at end of file diff --git a/compat/winansi.h b/compat/winansi.h new file mode 100644 index 0000000..c28dd15 --- /dev/null +++ b/compat/winansi.h @@ -0,0 +1,32 @@ +/* + * ANSI emulation wrappers + */ +#ifdef WIN32 +#include +#include +#include + +#define isatty(fd) _isatty(fd) +#define fileno(fd) _fileno(fd) + +#ifdef __cplusplus +extern "C" { +#endif + int winansi_fputs(const char *str, FILE *stream); + int winansi_printf(const char *format, ...); + int winansi_fprintf(FILE *stream, const char *format, ...); + int winansi_vfprintf(FILE *stream, const char *format, va_list list); +#ifdef __cplusplus +} +#endif + +#undef fputs +#undef fprintf +#undef vfprintf + +#define fputs winansi_fputs +#define printf winansi_printf +#define fprintf winansi_fprintf +#define vfprintf winansi_vfprintf + +#endif \ No newline at end of file diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..dccae8c --- /dev/null +++ b/configure.ac @@ -0,0 +1,158 @@ +AC_INIT([ccminer], [alexis-1.0], [], [ccminer], [https://github.com/alexis78/ccminer]) + +AC_PREREQ([2.59c]) +AC_CANONICAL_SYSTEM +AC_CONFIG_SRCDIR([ccminer.cpp]) +AM_INIT_AUTOMAKE([foreign subdir-objects]) +AC_CONFIG_HEADERS([cpuminer-config.h]) + +dnl Make sure anyone changing configure.ac/Makefile.am has a clue +AM_MAINTAINER_MODE + +dnl Checks for programs +AC_PROG_CC_C99 +AC_PROG_GCC_TRADITIONAL +AM_PROG_CC_C_O +AM_PROG_AS +AC_PROG_RANLIB +AC_PROG_CXX +AC_OPENMP + +dnl Checks for header files +AC_HEADER_STDC +AC_CHECK_HEADERS([sys/endian.h sys/param.h syslog.h]) +# sys/sysctl.h requires sys/types.h on FreeBSD +# sys/sysctl.h requires sys/param.h on OpenBSD +AC_CHECK_HEADERS([sys/sysctl.h], [], [], +[#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +]) + +AC_CHECK_DECLS([be32dec, le32dec, be32enc, le32enc], [], [], +[AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif +]) + +AC_FUNC_ALLOCA +AC_CHECK_FUNCS([getopt_long]) + +case $target in + i*86-*-*) + have_x86=true + ;; + x86_64-*-*) + have_x86=true + have_x86_64=true + ;; + amd64-*-*) + have_x86=true + have_x86_64=true + ;; +esac + +PTHREAD_FLAGS="-pthread" +WS2_LIBS="" + +case $target in + *-*-mingw*) + have_win32=true + PTHREAD_FLAGS="" + WS2_LIBS="-lws2_32" + ;; +esac + +AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true) +AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS="-lpthread", + AC_CHECK_LIB([pthreadGC2], [pthread_create], PTHREAD_LIBS="-lpthreadGC2", + AC_CHECK_LIB([pthreadGC1], [pthread_create], PTHREAD_LIBS="-lpthreadGC1", + AC_CHECK_LIB([pthreadGC], [pthread_create], PTHREAD_LIBS="-lpthreadGC" +)))) + +AC_CHECK_LIB([z],[gzopen], [], []) +AC_CHECK_LIB([ssl],[SSL_free], [], [AC_MSG_ERROR([OpenSSL library required])]) +AC_CHECK_LIB([crypto],[EVP_DigestFinal_ex], [], [AC_MSG_ERROR([OpenSSL library required])]) + +# libpci-dev (to get vendor name) +PCILIB=""; PCIFLAGS="" +AC_CHECK_LIB([pci],[pci_alloc], PCILIB="-lpci"; PCIFLAGS="-DHAVE_PCIDEV", []) +AC_SUBST(PCILIB) +AC_SUBST(PCIFLAGS) + +AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue]) +AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue]) +AM_CONDITIONAL([ARCH_x86], [test x$have_x86 = xtrue]) +AM_CONDITIONAL([ARCH_x86_64], [test x$have_x86_64 = xtrue]) + +if test x$request_jansson = xtrue +then + JANSSON_LIBS="compat/jansson/libjansson.a" +else + JANSSON_LIBS=-ljansson +fi + +LIBCURL_CHECK_CONFIG(, 7.15.2, , + [AC_MSG_ERROR([Missing required libcurl >= 7.15.2])]) + +AC_SUBST(JANSSON_LIBS) +AC_SUBST(PTHREAD_FLAGS) +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(WS2_LIBS) + +AC_CONFIG_FILES([ + Makefile + compat/Makefile + compat/jansson/Makefile + ]) + +dnl find out what version we are running +ARCH=`uname -m` +if [[ $ARCH == "x86_64" ]]; +then + SUFFIX="64" +else + SUFFIX="" +fi + +dnl Setup CUDA paths +AC_ARG_WITH([cuda], + [ --with-cuda=PATH prefix where cuda is installed [default=/usr/local/cuda]]) + +AC_ARG_WITH([nvml], + [ --with-nvml=PATH prefix where libnvml is installed [default=/usr/lib]]) + +AM_CONDITIONAL([HAVE_NVML], [test -n "$with_nvml"]) + +NVCC="nvcc" + +if test -n "$with_cuda" ; then + CUDA_INCLUDES="-I$with_cuda/include" + CUDA_LIBS="-lcudart" + CUDA_LDFLAGS="-L$with_cuda/lib$SUFFIX" + if test -x "$with_cuda/bin/nvcc" ; then + NVCC="$with_cuda/bin/nvcc" + fi +else + CUDA_INCLUDES="-I/usr/local/cuda/include" + CUDA_LIBS="-lcudart -static-libstdc++" + CUDA_LDFLAGS="-L/usr/local/cuda/lib$SUFFIX" +fi + +if test -n "$with_nvml" ; then + NVML_LIBPATH=$with_nvml + CUDA_LDFLAGS="$CUDA_LDFLAGS -ldl" +fi +AC_SUBST(NVML_LIBPATH) + +AC_SUBST(CUDA_CFLAGS) +AC_SUBST(CUDA_INCLUDES) +AC_SUBST(CUDA_LIBS) +AC_SUBST(CUDA_LDFLAGS) +AC_SUBST(NVCC) + +AC_SUBST(OPENMP_CFLAGS) + +AC_OUTPUT diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000..cb92748 --- /dev/null +++ b/configure.sh @@ -0,0 +1,12 @@ +# possible additional CUDA_CFLAGS +#-gencode=arch=compute_52,code=\"sm_52,compute_52\" +#-gencode=arch=compute_50,code=\"sm_50,compute_50\" +#-gencode=arch=compute_35,code=\"sm_35,compute_35\" +#-gencode=arch=compute_30,code=\"sm_30,compute_30\" + +#--ptxas-options=\"-v -dlcm=cg\"" + +extracflags="-march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16" + +CUDA_CFLAGS="-O3 -lineno -Xcompiler -Wall -D_FORCE_INLINES" ./configure CXXFLAGS="-O3 $extracflags" --with-cuda=/usr/local/cuda-7.5 --with-nvml=libnvidia-ml.so + diff --git a/cpuminer-config.h b/cpuminer-config.h new file mode 100644 index 0000000..e07f6c9 --- /dev/null +++ b/cpuminer-config.h @@ -0,0 +1,191 @@ +/* cpuminer-config.h. Generated from cpuminer-config.h.in by configure. */ +/* cpuminer-config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the declaration of `be32dec', and to 0 if you + don't. */ +#define HAVE_DECL_BE32DEC 0 + +/* Define to 1 if you have the declaration of `be32enc', and to 0 if you + don't. */ +#define HAVE_DECL_BE32ENC 0 + +/* Define to 1 if you have the declaration of `le32dec', and to 0 if you + don't. */ +#define HAVE_DECL_LE32DEC 0 + +/* Define to 1 if you have the declaration of `le32enc', and to 0 if you + don't. */ +#define HAVE_DECL_LE32ENC 0 + +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#define HAVE_LIBCRYPTO 1 + +/* Define to 1 if you have a functional curl library. */ +#define HAVE_LIBCURL 1 + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#define HAVE_LIBSSL 1 + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSLOG_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Defined if libcurl supports AsynchDNS */ +#define LIBCURL_FEATURE_ASYNCHDNS 1 + +/* Defined if libcurl supports IDN */ +#define LIBCURL_FEATURE_IDN 1 + +/* Defined if libcurl supports IPv6 */ +#define LIBCURL_FEATURE_IPV6 1 + +/* Defined if libcurl supports KRB4 */ +/* #undef LIBCURL_FEATURE_KRB4 */ + +/* Defined if libcurl supports libz */ +#define LIBCURL_FEATURE_LIBZ 1 + +/* Defined if libcurl supports NTLM */ +#define LIBCURL_FEATURE_NTLM 1 + +/* Defined if libcurl supports SSL */ +#define LIBCURL_FEATURE_SSL 1 + +/* Defined if libcurl supports SSPI */ +/* #undef LIBCURL_FEATURE_SSPI */ + +/* Defined if libcurl supports DICT */ +#define LIBCURL_PROTOCOL_DICT 1 + +/* Defined if libcurl supports FILE */ +#define LIBCURL_PROTOCOL_FILE 1 + +/* Defined if libcurl supports FTP */ +#define LIBCURL_PROTOCOL_FTP 1 + +/* Defined if libcurl supports FTPS */ +#define LIBCURL_PROTOCOL_FTPS 1 + +/* Defined if libcurl supports HTTP */ +#define LIBCURL_PROTOCOL_HTTP 1 + +/* Defined if libcurl supports HTTPS */ +#define LIBCURL_PROTOCOL_HTTPS 1 + +/* Defined if libcurl supports IMAP */ +#define LIBCURL_PROTOCOL_IMAP 1 + +/* Defined if libcurl supports LDAP */ +#define LIBCURL_PROTOCOL_LDAP 1 + +/* Defined if libcurl supports POP3 */ +#define LIBCURL_PROTOCOL_POP3 1 + +/* Defined if libcurl supports RTSP */ +#define LIBCURL_PROTOCOL_RTSP 1 + +/* Defined if libcurl supports SMTP */ +#define LIBCURL_PROTOCOL_SMTP 1 + +/* Defined if libcurl supports TELNET */ +#define LIBCURL_PROTOCOL_TELNET 1 + +/* Defined if libcurl supports TFTP */ +#define LIBCURL_PROTOCOL_TFTP 1 + +/* Name of package */ +#define PACKAGE "ccminer" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "ccminer" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "ccminer alexis-1.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "ccminer" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "https://github.com/alexis78/ccminer" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "alexis-1.0" + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "alexis-1.0" + +/* Define curl_free() as free() if our version of curl lacks curl_free. */ +/* #undef curl_free */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ diff --git a/cpuminer-config.h.in b/cpuminer-config.h.in new file mode 100644 index 0000000..4667b45 --- /dev/null +++ b/cpuminer-config.h.in @@ -0,0 +1,190 @@ +/* cpuminer-config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the declaration of `be32dec', and to 0 if you + don't. */ +#undef HAVE_DECL_BE32DEC + +/* Define to 1 if you have the declaration of `be32enc', and to 0 if you + don't. */ +#undef HAVE_DECL_BE32ENC + +/* Define to 1 if you have the declaration of `le32dec', and to 0 if you + don't. */ +#undef HAVE_DECL_LE32DEC + +/* Define to 1 if you have the declaration of `le32enc', and to 0 if you + don't. */ +#undef HAVE_DECL_LE32ENC + +/* Define to 1 if you have the `getopt_long' function. */ +#undef HAVE_GETOPT_LONG + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + +/* Define to 1 if you have a functional curl library. */ +#undef HAVE_LIBCURL + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + +/* Define to 1 if you have the `z' library (-lz). */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSLOG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Defined if libcurl supports AsynchDNS */ +#undef LIBCURL_FEATURE_ASYNCHDNS + +/* Defined if libcurl supports IDN */ +#undef LIBCURL_FEATURE_IDN + +/* Defined if libcurl supports IPv6 */ +#undef LIBCURL_FEATURE_IPV6 + +/* Defined if libcurl supports KRB4 */ +#undef LIBCURL_FEATURE_KRB4 + +/* Defined if libcurl supports libz */ +#undef LIBCURL_FEATURE_LIBZ + +/* Defined if libcurl supports NTLM */ +#undef LIBCURL_FEATURE_NTLM + +/* Defined if libcurl supports SSL */ +#undef LIBCURL_FEATURE_SSL + +/* Defined if libcurl supports SSPI */ +#undef LIBCURL_FEATURE_SSPI + +/* Defined if libcurl supports DICT */ +#undef LIBCURL_PROTOCOL_DICT + +/* Defined if libcurl supports FILE */ +#undef LIBCURL_PROTOCOL_FILE + +/* Defined if libcurl supports FTP */ +#undef LIBCURL_PROTOCOL_FTP + +/* Defined if libcurl supports FTPS */ +#undef LIBCURL_PROTOCOL_FTPS + +/* Defined if libcurl supports HTTP */ +#undef LIBCURL_PROTOCOL_HTTP + +/* Defined if libcurl supports HTTPS */ +#undef LIBCURL_PROTOCOL_HTTPS + +/* Defined if libcurl supports IMAP */ +#undef LIBCURL_PROTOCOL_IMAP + +/* Defined if libcurl supports LDAP */ +#undef LIBCURL_PROTOCOL_LDAP + +/* Defined if libcurl supports POP3 */ +#undef LIBCURL_PROTOCOL_POP3 + +/* Defined if libcurl supports RTSP */ +#undef LIBCURL_PROTOCOL_RTSP + +/* Defined if libcurl supports SMTP */ +#undef LIBCURL_PROTOCOL_SMTP + +/* Defined if libcurl supports TELNET */ +#undef LIBCURL_PROTOCOL_TELNET + +/* Defined if libcurl supports TFTP */ +#undef LIBCURL_PROTOCOL_TFTP + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define curl_free() as free() if our version of curl lacks curl_free. */ +#undef curl_free + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/crc32.c b/crc32.c new file mode 100644 index 0000000..f036bcb --- /dev/null +++ b/crc32.c @@ -0,0 +1,119 @@ +/*- + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + * + * First, the polynomial itself and its table of feedback terms. The + * polynomial is + * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 + * + * Note that we take it "backwards" and put the highest-order term in + * the lowest-order bit. The X^32 term is "implied"; the LSB is the + * X^31 term, etc. The X^0 term (usually shown as "+1") results in + * the MSB being 1 + * + * Note that the usual hardware shift register implementation, which + * is what we're using (we're merely optimizing it by doing eight-bit + * chunks at a time) shifts bits into the lowest-order term. In our + * implementation, that means shifting towards the right. Why do we + * do it this way? Because the calculated CRC must be transmitted in + * order from highest-order term to lowest-order term. UARTs transmit + * characters in order from LSB to MSB. By storing the CRC this way + * we hand it to the UART in the order low-byte to high-byte; the UART + * sends each low-bit to hight-bit; and the result is transmission bit + * by bit from highest- to lowest-order term without requiring any bit + * shuffling on our part. Reception works similarly + * + * The feedback terms table consists of 256, 32-bit entries. Notes + * + * The table can be generated at runtime if desired; code to do so + * is shown later. It might not be obvious, but the feedback + * terms simply represent the results of eight shift/xor opera + * tions for all combinations of data and CRC register values + * + * The values must be right-shifted by eight bits by the "updcrc + * logic; the shift must be unsigned (bring in zeroes). On some + * hardware you could probably optimize the shift in assembler by + * using byte-swap instructions + * polynomial $edb88320 + * + * + * CRC32 code derived from work by Gary S. Brown. + */ + +#include +#include + +static uint32_t crc32_tab[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +/* Real CRC32 Function */ +extern uint32_t crc32(uint32_t crc, const void *buf, size_t size) +{ + const uint8_t *p; + + p = buf; + crc = crc ^ ~0U; + + while (size--) + crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + + return crc ^ ~0U; +} + +/* CRC32 Function simplified for ccminer */ +extern uint32_t crc32_u32t(const uint32_t *buf, size_t size) +{ + const uint8_t *p; + uint32_t crc = 0; + + p = (uint8_t *) buf; + crc = crc ^ ~0U; + + while (size--) + crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + + return crc ^ ~0U; +} diff --git a/cuda.cpp b/cuda.cpp new file mode 100644 index 0000000..d8ca784 --- /dev/null +++ b/cuda.cpp @@ -0,0 +1,277 @@ +#include +#include +#include +#include +#include + +// include thrust +#ifndef __cplusplus +#include +#include +#include +#include +#else +#include +#endif + +#include "miner.h" +#include "nvml.h" + +#include "cuda_runtime.h" + +#ifdef __cplusplus +/* miner.h functions are declared in C type, not C++ */ +extern "C" { +#endif + +// CUDA Devices on the System +int cuda_num_devices() +{ + int version; + cudaError_t err = cudaDriverGetVersion(&version); + if (err != cudaSuccess) + { + applog(LOG_ERR, "Unable to query CUDA driver version! Is an nVidia driver installed?"); + exit(1); + } + + int maj = version / 1000, min = version % 100; // same as in deviceQuery sample + if (maj < 5 || (maj == 5 && min < 5)) + { + applog(LOG_ERR, "Driver does not support CUDA %d.%d API! Update your nVidia driver!", 5, 5); + exit(1); + } + + int GPU_N; + err = cudaGetDeviceCount(&GPU_N); + if (err != cudaSuccess) + { + applog(LOG_ERR, "Unable to query number of CUDA devices! Is an nVidia driver installed?"); + exit(1); + } + return GPU_N; +} + +int cuda_version() +{ + return (int) CUDART_VERSION; +} + +void cuda_devicenames() +{ + cudaError_t err; + int GPU_N; + err = cudaGetDeviceCount(&GPU_N); + if (err != cudaSuccess) + { + applog(LOG_ERR, "Unable to query number of CUDA devices! Is an nVidia driver installed?"); + exit(1); + } + + if (opt_n_threads) + GPU_N = min(MAX_GPUS, opt_n_threads); + for (int i=0; i < GPU_N; i++) + { + char vendorname[32] = { 0 }; + int dev_id = device_map[i]; + cudaDeviceProp props; + cudaGetDeviceProperties(&props, dev_id); + + device_sm[dev_id] = (props.major * 100 + props.minor * 10); + + if (device_name[dev_id]) { + free(device_name[dev_id]); + device_name[dev_id] = NULL; + } +#ifdef USE_WRAPNVML + if (gpu_vendor((uint8_t)props.pciBusID, vendorname) > 0 && strlen(vendorname)) { + device_name[dev_id] = (char*) calloc(1, strlen(vendorname) + strlen(props.name) + 2); + if (!strncmp(props.name, "GeForce ", 8)) + sprintf(device_name[dev_id], "%s %s", vendorname, &props.name[8]); + else + sprintf(device_name[dev_id], "%s %s", vendorname, props.name); + } else +#endif + device_name[dev_id] = strdup(props.name); + } +} + +void cuda_print_devices() +{ + int ngpus = cuda_num_devices(); + cuda_devicenames(); + for (int n=0; n < ngpus; n++) { + int dev_id = device_map[n % MAX_GPUS]; + cudaDeviceProp props; + cudaGetDeviceProperties(&props, dev_id); + if (!opt_n_threads || n < opt_n_threads) { + fprintf(stderr, "GPU #%d: SM %d.%d %s\n", dev_id, props.major, props.minor, device_name[dev_id]); + } + } +} + +void cuda_shutdown() +{ + cudaDeviceSynchronize(); + cudaDeviceReset(); +} + +static bool substringsearch(const char *haystack, const char *needle, int &match) +{ + int hlen = (int) strlen(haystack); + int nlen = (int) strlen(needle); + for (int i=0; i < hlen; ++i) + { + if (haystack[i] == ' ') continue; + int j=0, x = 0; + while(j < nlen) + { + if (haystack[i+x] == ' ') {++x; continue;} + if (needle[j] == ' ') {++j; continue;} + if (needle[j] == '#') return ++match == needle[j+1]-'0'; + if (tolower(haystack[i+x]) != tolower(needle[j])) break; + ++j; ++x; + } + if (j == nlen) return true; + } + return false; +} + +// CUDA Gerät nach Namen finden (gibt Geräte-Index zurück oder -1) +int cuda_finddevice(char *name) +{ + int num = cuda_num_devices(); + int match = 0; + for (int i=0; i < num; ++i) + { + cudaDeviceProp props; + if (cudaGetDeviceProperties(&props, i) == cudaSuccess) + if (substringsearch(props.name, name, match)) return i; + } + return -1; +} + +// since 1.7 +uint32_t cuda_default_throughput(int thr_id, uint32_t defcount) +{ + //int dev_id = device_map[thr_id % MAX_GPUS]; + uint32_t throughput = gpus_intensity[thr_id] ? gpus_intensity[thr_id] : defcount; + if (gpu_threads > 1 && throughput == defcount) throughput /= (gpu_threads-1); + if (api_thr_id != -1) api_set_throughput(thr_id, throughput); + //gpulog(LOG_INFO, thr_id, "throughput %u", throughput); + return throughput; +} + +// if we use 2 threads on the same gpu, we need to reinit the threads +void cuda_reset_device(int thr_id, bool *init) +{ + int dev_id = device_map[thr_id % MAX_GPUS]; + cudaSetDevice(dev_id); + if (init != NULL) { + // with init array, its meant to be used in algo's scan code... + for (int i=0; i < MAX_GPUS; i++) { + if (device_map[i] == dev_id) { + init[i] = false; + } + } + // force exit from algo's scan loops/function + restart_threads(); + cudaDeviceSynchronize(); + while (cudaStreamQuery(NULL) == cudaErrorNotReady) + usleep(1000); + } + cudaDeviceReset(); + if (opt_cudaschedule >= 0) { + cudaSetDeviceFlags((unsigned)(opt_cudaschedule & cudaDeviceScheduleMask)); + } else { + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + } + cudaDeviceSynchronize(); +} + +// return free memory in megabytes +int cuda_available_memory(int thr_id) +{ + int dev_id = device_map[thr_id % MAX_GPUS]; + size_t mtotal, mfree = 0; + cudaSetDevice(dev_id); + cudaMemGetInfo(&mfree, &mtotal); + return (int) (mfree / (1024 * 1024)); +} + +// Check (and reset) last cuda error, and report it in logs +void cuda_log_lasterror(int thr_id, const char* func, int line) +{ + cudaError_t err = cudaGetLastError(); + if (err != cudaSuccess && !opt_quiet) + gpulog(LOG_WARNING, thr_id, "%s:%d %s", func, line, cudaGetErrorString(err)); +} + +// Clear any cuda error in non-cuda unit (.c/.cpp) +void cuda_clear_lasterror() +{ + cudaGetLastError(); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +int cuda_gpu_info(struct cgpu_info *gpu){ + + cudaDeviceProp props; + if (cudaGetDeviceProperties(&props, gpu->gpu_id) == cudaSuccess) { + //These are not looking like the current clocks... + gpu->gpu_clock = props.clockRate; //clockRate is the clock frequency in kilohertz; + gpu->gpu_memclock = props.memoryClockRate; //Peak memory clock frequency in kilohertz + gpu->gpu_mem = (props.totalGlobalMem / 1024); // kB +#if defined(_WIN32) && defined(USE_WRAPNVML) + // required to get mem size > 4GB (size_t too small for bytes on 32bit) + nvapiMemGetInfo(gpu->gpu_id, &gpu->gpu_memfree, &gpu->gpu_mem); // kB +#endif + gpu->gpu_mem = gpu->gpu_mem / 1024; // MB + return 0; + } + return -1; +} + +// Zeitsynchronisations-Routine von cudaminer mit CPU sleep +// Note: if you disable all of these calls, CPU usage will hit 100% +typedef struct { double value[8]; } tsumarray; +/*cudaError_t MyStreamSynchronize(cudaStream_t stream, int situation, int thr_id) +{ + cudaError_t result = cudaSuccess; + if (abort_flag) + return result; + if (situation >= 0) + { + static std::map tsum; + + double a = 0.95, b = 0.05; + if (tsum.find(situation) == tsum.end()) { a = 0.5; b = 0.5; } // faster initial convergence + + double tsync = 0.0; + double tsleep = 0.95 * tsum[situation].value[thr_id]; + if (cudaStreamQuery(stream) == cudaErrorNotReady) + { + usleep((useconds_t)(1e6*tsleep)); + struct timeval tv_start, tv_end; + gettimeofday(&tv_start, NULL); + result = cudaStreamSynchronize(stream); + gettimeofday(&tv_end, NULL); + tsync = 1e-6 * (tv_end.tv_usec-tv_start.tv_usec) + (tv_end.tv_sec-tv_start.tv_sec); + } + if (tsync >= 0) tsum[situation].value[thr_id] = a * tsum[situation].value[thr_id] + b * (tsleep+tsync); + } + else + result = cudaStreamSynchronize(stream); + return result; +}*/ + +void cudaReportHardwareFailure(int thr_id, cudaError_t err, const char* func) +{ + struct cgpu_info *gpu = &thr_info[thr_id].gpu; + gpu->hw_errors++; + gpulog(LOG_ERR, thr_id, "%s %s", func, cudaGetErrorString(err)); + sleep(1); +} diff --git a/cuda_checkhash.cu b/cuda_checkhash.cu new file mode 100644 index 0000000..74753d7 --- /dev/null +++ b/cuda_checkhash.cu @@ -0,0 +1,298 @@ +/** + * This code compares final hash against target + */ +#include +#include + +#include "miner.h" + +#include "cuda_helper.h" + +__constant__ uint32_t pTarget[8]; // 32 bytes + +// store MAX_GPUS device arrays of 8 nonces +static uint32_t* h_resNonces[MAX_GPUS] = { NULL }; +static uint32_t* d_resNonces[MAX_GPUS] = { NULL }; +static __thread bool init_done = false; + +__host__ +void cuda_check_cpu_init(int thr_id, uint32_t threads) +{ + CUDA_CALL_OR_RET(cudaMalloc(&d_resNonces[thr_id], 32)); + CUDA_SAFE_CALL(cudaMallocHost(&h_resNonces[thr_id], 32)); + init_done = true; +} + +__host__ +void cuda_check_cpu_free(int thr_id) +{ + if (!init_done) return; + cudaFree(d_resNonces[thr_id]); + cudaFreeHost(h_resNonces[thr_id]); + d_resNonces[thr_id] = NULL; + h_resNonces[thr_id] = NULL; + init_done = false; +} + +// Target Difficulty +__host__ +void cuda_check_cpu_setTarget(const void *ptarget) +{ + CUDA_SAFE_CALL(cudaMemcpyToSymbol(pTarget, ptarget, 32, 0, cudaMemcpyHostToDevice)); +} + +/* --------------------------------------------------------------------------------------------- */ + +__device__ __forceinline__ +static bool hashbelowtarget(const uint32_t *const __restrict__ hash, const uint32_t *const __restrict__ target) +{ + if (hash[7] > target[7]) + return false; + if (hash[7] < target[7]) + return true; + if (hash[6] > target[6]) + return false; + if (hash[6] < target[6]) + return true; + + if (hash[5] > target[5]) + return false; + if (hash[5] < target[5]) + return true; + if (hash[4] > target[4]) + return false; + if (hash[4] < target[4]) + return true; + + if (hash[3] > target[3]) + return false; + if (hash[3] < target[3]) + return true; + if (hash[2] > target[2]) + return false; + if (hash[2] < target[2]) + return true; + + if (hash[1] > target[1]) + return false; + if (hash[1] < target[1]) + return true; + if (hash[0] > target[0]) + return false; + + return true; +} + +__global__ __launch_bounds__(512, 4) +void cuda_checkhash_64(uint32_t threads, uint32_t startNounce, uint32_t *hash, uint32_t *resNonces) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + // shl 4 = *16 x 4 (uint32) = 64 bytes + // todo: use only 32 bytes * threads if possible + uint32_t *inpHash = &hash[thread << 4]; + + if (resNonces[0] == UINT32_MAX) { + if (hashbelowtarget(inpHash, pTarget)) + resNonces[0] = (startNounce + thread); + } + } +} + +__global__ __launch_bounds__(512, 4) +void cuda_checkhash_32(uint32_t threads, uint32_t startNounce, uint32_t *hash, uint32_t *resNonces) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + uint32_t *inpHash = &hash[thread << 3]; + + if (resNonces[0] == UINT32_MAX) { + if (hashbelowtarget(inpHash, pTarget)) + resNonces[0] = (startNounce + thread); + } + } +} + +__host__ +uint32_t cuda_check_hash(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_inputHash) +{ + cudaMemset(d_resNonces[thr_id], 0xff, sizeof(uint32_t)); + + const uint32_t threadsperblock = 512; + + dim3 grid((threads + threadsperblock - 1) / threadsperblock); + dim3 block(threadsperblock); + + if (bench_algo >= 0) // dont interrupt the global benchmark + return UINT32_MAX; + + if (!init_done) { + applog(LOG_ERR, "missing call to cuda_check_cpu_init"); + return UINT32_MAX; + } + + cuda_checkhash_64 <<>> (threads, startNounce, d_inputHash, d_resNonces[thr_id]); + cudaThreadSynchronize(); + + cudaMemcpy(h_resNonces[thr_id], d_resNonces[thr_id], sizeof(uint32_t), cudaMemcpyDeviceToHost); + return h_resNonces[thr_id][0]; +} + +__host__ +uint32_t cuda_check_hash_32(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_inputHash) +{ + cudaMemset(d_resNonces[thr_id], 0xff, sizeof(uint32_t)); + + const uint32_t threadsperblock = 512; + + dim3 grid((threads + threadsperblock - 1) / threadsperblock); + dim3 block(threadsperblock); + + if (bench_algo >= 0) // dont interrupt the global benchmark + return UINT32_MAX; + + if (!init_done) { + applog(LOG_ERR, "missing call to cuda_check_cpu_init"); + return UINT32_MAX; + } + + cuda_checkhash_32 <<>> (threads, startNounce, d_inputHash, d_resNonces[thr_id]); + cudaThreadSynchronize(); + + cudaMemcpy(h_resNonces[thr_id], d_resNonces[thr_id], sizeof(uint32_t), cudaMemcpyDeviceToHost); + return h_resNonces[thr_id][0]; +} + +/* --------------------------------------------------------------------------------------------- */ + +__global__ __launch_bounds__(512, 4) +void cuda_checkhash_64_suppl(uint32_t startNounce, uint32_t *hash, uint32_t *resNonces) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint32_t *inpHash = &hash[thread << 4]; + + if (hashbelowtarget(inpHash, pTarget)) { + int resNum = ++resNonces[0]; + __threadfence(); + if (resNum < 8) + resNonces[resNum] = (startNounce + thread); + } +} + +__host__ +uint32_t cuda_check_hash_suppl(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_inputHash, uint8_t numNonce) +{ + uint32_t rescnt, result = 0; + + const uint32_t threadsperblock = 512; + dim3 grid((threads + threadsperblock - 1) / threadsperblock); + dim3 block(threadsperblock); + + if (!init_done) { + applog(LOG_ERR, "missing call to cuda_check_cpu_init"); + return 0; + } + + // first element stores the count of found nonces + cudaMemset(d_resNonces[thr_id], 0, sizeof(uint32_t)); + + cuda_checkhash_64_suppl <<>> (startNounce, d_inputHash, d_resNonces[thr_id]); + cudaThreadSynchronize(); + + cudaMemcpy(h_resNonces[thr_id], d_resNonces[thr_id], 32, cudaMemcpyDeviceToHost); + rescnt = h_resNonces[thr_id][0]; + if (rescnt > numNonce) { + if (numNonce <= rescnt) { + result = h_resNonces[thr_id][numNonce+1]; + } + if (opt_debug) + applog(LOG_WARNING, "Found %d nonces: %x + %x", rescnt, h_resNonces[thr_id][1], result); + } + + return result; +} + +/* --------------------------------------------------------------------------------------------- */ + +__global__ +void cuda_check_hash_branch_64(uint32_t threads, uint32_t startNounce, uint32_t *g_nonceVector, uint32_t *g_hash, uint32_t *resNounce) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + uint32_t nounce = g_nonceVector[thread]; + uint32_t hashPosition = (nounce - startNounce) << 4; + uint32_t *inpHash = &g_hash[hashPosition]; + + for (int i = 7; i >= 0; i--) { + if (inpHash[i] > pTarget[i]) { + return; + } + if (inpHash[i] < pTarget[i]) { + break; + } + } + if (resNounce[0] > nounce) + resNounce[0] = nounce; + } +} + +__host__ +uint32_t cuda_check_hash_branch(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_nonceVector, uint32_t *d_inputHash, int order) +{ + const uint32_t threadsperblock = 256; + + uint32_t result = UINT32_MAX; + + if (bench_algo >= 0) // dont interrupt the global benchmark + return result; + + if (!init_done) { + applog(LOG_ERR, "missing call to cuda_check_cpu_init"); + return result; + } + + cudaMemset(d_resNonces[thr_id], 0xff, sizeof(uint32_t)); + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + cuda_check_hash_branch_64 <<>> (threads, startNounce, d_nonceVector, d_inputHash, d_resNonces[thr_id]); + +// MyStreamSynchronize(NULL, order, thr_id); + + cudaMemcpy(h_resNonces[thr_id], d_resNonces[thr_id], sizeof(uint32_t), cudaMemcpyDeviceToHost); + + cudaThreadSynchronize(); + result = *h_resNonces[thr_id]; + + return result; +} + +/* Function to get the compiled Shader Model version */ +int cuda_arch[MAX_GPUS] = { 0 }; +__global__ void nvcc_get_arch(int *d_version) +{ + *d_version = 0; +#ifdef __CUDA_ARCH__ + *d_version = __CUDA_ARCH__; +#endif +} + +__host__ +int cuda_get_arch(int thr_id) +{ + int *d_version; + int dev_id = device_map[thr_id]; + if (cuda_arch[dev_id] == 0) { + // only do it once... + cudaMalloc(&d_version, sizeof(int)); + nvcc_get_arch <<< 1, 1 >>> (d_version); + cudaMemcpy(&cuda_arch[dev_id], d_version, sizeof(int), cudaMemcpyDeviceToHost); + cudaFree(d_version); + } + return cuda_arch[dev_id]; +} diff --git a/cuda_debug.cuh b/cuda_debug.cuh new file mode 100644 index 0000000..363dc1a --- /dev/null +++ b/cuda_debug.cuh @@ -0,0 +1,47 @@ +/** + * Helper to trace gpu computed data with --cputest + * + * Sample usage in an algo scan cuda unit : + * + * #define _DEBUG + * #define _DEBUG_PREFIX "x11-" + * #include "cuda_debug.cuh" + * + * TRACE64("luffa", d_hash); + * or + * TRACE("luffa") + * + * Dont forget to link the scan function in util.cpp (do_gpu_tests) + * + */ + +#include +//#include "cuda_helper.h" + +#ifndef _DEBUG_PREFIX +#define _DEBUG_PREFIX "" +#endif + +#ifdef _DEBUG +#define TRACE64(algo, d_buf) { \ + if (max_nonce == 1 && pdata[19] <= 1 && !opt_benchmark) { \ + uint32_t oft = 0; \ + uint32_t* debugbuf = NULL; \ + cudaMallocHost(&debugbuf, 16*sizeof(uint32_t)); \ + cudaMemcpy(debugbuf, d_buf[thr_id] + oft, 16*sizeof(uint32_t), cudaMemcpyDeviceToHost); \ + printf(_DEBUG_PREFIX "%s %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", \ + algo, \ + swab32(debugbuf[0]), swab32(debugbuf[1]), swab32(debugbuf[2]), swab32(debugbuf[3]), \ + swab32(debugbuf[4]), swab32(debugbuf[5]), swab32(debugbuf[6]), swab32(debugbuf[7]), \ + swab32(debugbuf[8]), swab32(debugbuf[9]), swab32(debugbuf[10]),swab32(debugbuf[11]), \ + swab32(debugbuf[12]),swab32(debugbuf[13]),swab32(debugbuf[14]),swab32(debugbuf[15])); \ + cudaFreeHost(debugbuf); \ + } \ +} +#else +#define TRACE64(algo, d_buf) {} +#endif + +// simplified default +#define TRACE(algo) TRACE64(algo, d_hash) + diff --git a/cuda_helper.h b/cuda_helper.h new file mode 100644 index 0000000..e026c79 --- /dev/null +++ b/cuda_helper.h @@ -0,0 +1,712 @@ +#ifndef CUDA_HELPER_H +#define CUDA_HELPER_H + +#include +#include + +#ifdef __INTELLISENSE__ +/* reduce vstudio warnings (__byteperm, blockIdx...) */ +#include +#include +#define __launch_bounds__(max_tpb, min_blocks) +#endif + +#include +#include + +#ifndef UINT32_MAX +/* slackware need that */ +#define UINT32_MAX UINT_MAX +#endif + +#ifndef MAX_GPUS +#define MAX_GPUS 16 +#endif + +extern "C" short device_map[MAX_GPUS]; +extern "C" long device_sm[MAX_GPUS]; + +extern int cuda_arch[MAX_GPUS]; + +// common functions +extern int cuda_get_arch(int thr_id); +extern void cuda_check_cpu_init(int thr_id, uint32_t threads); +extern void cuda_check_cpu_free(int thr_id); +extern void cuda_check_cpu_setTarget(const void *ptarget); +extern uint32_t cuda_check_hash(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_inputHash); +extern uint32_t cuda_check_hash_suppl(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_inputHash, uint8_t numNonce); +extern cudaError_t MyStreamSynchronize(cudaStream_t stream, int situation, int thr_id); +extern void cudaReportHardwareFailure(int thr_id, cudaError_t error, const char* func); +extern __device__ __device_builtin__ void __syncthreads(void); +extern __device__ __device_builtin__ void __threadfence(void); + +#ifndef __CUDA_ARCH__ +// define blockDim and threadIdx for host +extern const dim3 blockDim; +extern const uint3 threadIdx; +#endif + +#ifndef SPH_C32 +#define SPH_C32(x) (x) +// #define SPH_C32(x) ((uint32_t)(x ## U)) +#endif + +#ifndef SPH_C64 +#define SPH_C64(x) (x) +// #define SPH_C64(x) ((uint64_t)(x ## ULL)) +#endif + +#ifndef SPH_T32 +#define SPH_T32(x) (x) +// #define SPH_T32(x) ((x) & SPH_C32(0xFFFFFFFF)) +#endif + +#ifndef SPH_T64 +#define SPH_T64(x) (x) +// #define SPH_T64(x) ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF)) +#endif + +/*********************************************************************/ +// Macros to catch CUDA errors in CUDA runtime calls + +#define CUDA_SAFE_CALL(call) \ +do { \ + cudaError_t err = call; \ + if (cudaSuccess != err) { \ + fprintf(stderr, "Cuda error in func '%s' at line %i : %s.\n", \ + __FUNCTION__, __LINE__, cudaGetErrorString(err) ); \ + exit(EXIT_FAILURE); \ + } \ +} while (0) + +#define CUDA_CALL_OR_RET(call) do { \ + cudaError_t err = call; \ + if (cudaSuccess != err) { \ + cudaReportHardwareFailure(thr_id, err, __FUNCTION__); \ + return; \ + } \ +} while (0) + +#define CUDA_CALL_OR_RET_X(call, ret) do { \ + cudaError_t err = call; \ + if (cudaSuccess != err) { \ + cudaReportHardwareFailure(thr_id, err, __FUNCTION__); \ + return ret; \ + } \ +} while (0) + +/*********************************************************************/ + +__device__ __forceinline__ uint64_t MAKE_ULONGLONG(uint32_t LO, uint32_t HI){ + return __double_as_longlong(__hiloint2double(HI, LO)); +// return (uint64_t)LO | (((uint64_t)HI) << 32); +} + +// das Hi Word in einem 64 Bit Typen ersetzen +__device__ __forceinline__ uint64_t REPLACE_HIDWORD(const uint64_t &x, const uint32_t &y) { + return (x & 0xFFFFFFFFULL) | (((uint64_t)y) << 32U); +} + +// das Lo Word in einem 64 Bit Typen ersetzen +__device__ __forceinline__ uint64_t REPLACE_LODWORD(const uint64_t &x, const uint32_t &y) { + return (x & 0xFFFFFFFF00000000ULL) | ((uint64_t)y); +} + +// Endian Drehung für 32 Bit Typen +#if defined(__CUDA_ARCH__) +__device__ __forceinline__ uint32_t cuda_swab32(uint32_t x) +{ + /* device */ + return __byte_perm(x, x, 0x0123); +} +#else + /* host */ + #define cuda_swab32(x) \ + ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) | \ + (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu)) +#endif + +// das Lo Word aus einem 64 Bit Typen extrahieren +__device__ __forceinline__ uint32_t _LODWORD(const uint64_t &x) { + return (uint32_t)__double2loint(__longlong_as_double(x)); +// return (uint32_t)(x & 0xFFFFFFFFULL); +} + +// das Hi Word aus einem 64 Bit Typen extrahieren +__device__ __forceinline__ uint32_t _HIDWORD(const uint64_t &x) { + return (uint32_t)__double2hiint(__longlong_as_double(x)); +// return (uint32_t)(x >> 32); +} + + +__device__ __forceinline__ uint2 cuda_swab64_U2(uint2 a) +{ + // Input: 77665544 33221100 + // Output: 00112233 44556677 + uint2 result; + result.y = __byte_perm(a.x, 0, 0x0123); + result.x = __byte_perm(a.y, 0, 0x0123); + return result; +} + +#if defined(__CUDA_ARCH__) +__device__ __forceinline__ uint64_t cuda_swab64(uint64_t x) +{ + // Input: 77665544 33221100 + // Output: 00112233 44556677 + uint64_t result = __byte_perm((uint32_t) x, 0, 0x0123); + return (result << 32) | __byte_perm(_HIDWORD(x), 0, 0x0123); +} +#else +/* host */ +#define cuda_swab64(x) \ + ((uint64_t)((((uint64_t)(x) & 0xff00000000000000ULL) >> 56) | \ + (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \ + (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \ + (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \ + (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \ + (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \ + (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \ + (((uint64_t)(x) & 0x00000000000000ffULL) << 56))) +#endif + +// swap two uint32_t without extra registers +__device__ __host__ __forceinline__ void xchg(uint32_t &x, uint32_t &y) { + x ^= y; y = x ^ y; x ^= y; +} +// for other types... +#define XCHG(x, y) { x ^= y; y = x ^ y; x ^= y; } + +static __host__ __device__ __forceinline__ uint2 vectorize(uint64_t v) { + uint2 result; +#if defined(__CUDA_ARCH__) + asm("mov.b64 {%0,%1},%2; \n\t" + : "=r"(result.x), "=r"(result.y) : "l"(v)); +#else + result.x = (uint32_t)(v); + result.y = (uint32_t)(v >> 32); +#endif + return result; +} + +static __host__ __device__ __forceinline__ uint64_t devectorize(uint2 v) { +#if defined(__CUDA_ARCH__) + return MAKE_ULONGLONG(v.x, v.y); +#else + return (((uint64_t)v.y) << 32) + v.x; +#endif +} + +#if defined(__CUDA_ARCH__) + // Compute 3.2+ + #define ROTL32(x, n) __funnelshift_l( (x), (x), (n) ) + #define ROTR32(x, n) __funnelshift_r( (x), (x), (n) ) +#else + // Host and Compute 3.0 + #define ROTL32(x, n) SPH_T32(((x) << (n)) | ((x) >> (32 - (n)))) + #define ROTR32(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) + #define __ldg(x) (*(x)) +#endif + +__device__ __forceinline__ +uint32_t ROL16(const uint32_t a){ + return __byte_perm(a, 0, 0x1032); +} +__device__ __forceinline__ +uint32_t ROL8(const uint32_t a){ + return __byte_perm(a, 0, 0x2103); +} +__device__ __forceinline__ +uint32_t ROR8(const uint32_t a){ + return __byte_perm(a, 0, 0x0321); +} + +// device asm for whirpool +__device__ __forceinline__ +uint64_t xor1(uint64_t a, uint64_t b) +{ + uint64_t result; + asm("xor.b64 %0, %1, %2;" : "=l"(result) : "l"(a), "l"(b)); + return result; +} + +// device asm for whirpool +__device__ __forceinline__ +uint64_t xor3(uint64_t a, uint64_t b, uint64_t c) +{ + uint64_t result; + asm("xor.b64 %0, %2, %3;\n\t" + "xor.b64 %0, %0, %1;\n\t" + /* output : input registers */ + : "=l"(result) : "l"(a), "l"(b), "l"(c)); + return result; +} + +// device asm for whirpool +__device__ __forceinline__ +uint64_t xor5(uint64_t a, uint64_t b, uint64_t c, uint64_t d,uint64_t e) +{ + uint64_t result; + asm("xor.b64 %0, %1, %2;" : "=l"(result) : "l"(d) ,"l"(e)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(c)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(b)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(a)); + return result; +} + +__device__ __forceinline__ +uint64_t xor9(const uint64_t a, const uint64_t b, const uint64_t c, const uint64_t d, const uint64_t e, const uint64_t f, const uint64_t g, const uint64_t h,const uint64_t i) +{ + uint64_t result; + asm("xor.b64 %0, %1, %2;" : "=l"(result) : "l"(h) ,"l"(i)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(g)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(f)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(e)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(d)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(c)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(b)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(a)); + return result; +} + +__device__ __forceinline__ +uint64_t xor8(uint64_t a, uint64_t b, uint64_t c, uint64_t d,uint64_t e,uint64_t f,uint64_t g, uint64_t h) +{ + uint64_t result; + asm("xor.b64 %0, %1, %2;" : "=l"(result) : "l"(g) ,"l"(h)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(f)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(e)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(d)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(c)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(b)); + asm("xor.b64 %0, %0, %1;" : "+l"(result) : "l"(a)); + return result; +} + +static __device__ __forceinline__ uint2 xorswap32(uint2 u, uint2 v) +{ + uint2 result; + result.y = u.x ^ v.x; + result.x = u.y ^ v.y; + return result; +} + +// device asm for x17 +__device__ __forceinline__ +uint64_t andor(const uint64_t a,const uint64_t b,const uint64_t c) +{ + uint64_t result; + asm("{\n\t" + ".reg .u64 m,n;\n\t" + "and.b64 m, %1, %2;\n\t" + " or.b64 n, %1, %2;\n\t" + "and.b64 %0, n, %3;\n\t" + " or.b64 %0, %0, m ;\n\t" + "}\n" + : "=l"(result) : "l"(a), "l"(b), "l"(c)); + return result; +// return ((a | b) & c) | (a & b); +} + +// device asm for x17 +__device__ __forceinline__ +uint64_t shr_u64(const uint64_t x, uint32_t n){ + uint64_t result; + asm ("shr.b64 %0,%1,%2;\n\t" : "=l"(result) : "l"(x), "r"(n)); + return result; +// return x >> n; +} + +__device__ __forceinline__ +uint64_t shl_u64(const uint64_t x, uint32_t n){ + uint64_t result; + asm("shl.b64 %0,%1,%2;\n\t" : "=l"(result) : "l"(x), "r"(n)); + return result; +// return x << n; +} + +__device__ __forceinline__ +uint32_t shr_u32(const uint32_t x,uint32_t n) { + uint32_t result; + asm("shr.b32 %0,%1,%2;" : "=r"(result) : "r"(x), "r"(n)); + return result; +// return x >> n; +} + +__device__ __forceinline__ +uint32_t shl_u32(const uint32_t x,uint32_t n) { + uint32_t result; + asm("shl.b32 %0,%1,%2;" : "=r"(result) : "r"(x), "r"(n)); + return result; +// return x << n; +} + +// 64-bit ROTATE RIGHT +#if defined(__CUDA_ARCH__) +/* complicated sm >= 3.5 one (with Funnel Shifter beschleunigt), to bench */ +__device__ __forceinline__ +uint64_t ROTR64(const uint64_t value, const int offset) { + uint2 result; + const uint2 tmp = vectorize(value); + + if(offset == 8) { + result.x = __byte_perm(tmp.x, tmp.y, 0x4321); + result.y = __byte_perm(tmp.y, tmp.x, 0x4321); + } + else if(offset == 16) { + result.x = __byte_perm(tmp.x, tmp.y, 0x5432); + result.y = __byte_perm(tmp.y, tmp.x, 0x5432); + } + else if(offset < 32) { + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(tmp.x), "r"(tmp.y), "r"(offset)); + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(tmp.y), "r"(tmp.x), "r"(offset)); + } else { + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(tmp.y), "r"(tmp.x), "r"(offset)); + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(tmp.x), "r"(tmp.y), "r"(offset)); + } + return devectorize(result); +} +#else +/* host */ +#define ROTR64(x, n) (((x) >> (n)) | ((x) << (64 - (n)))) +#endif + +// 64-bit ROTATE LEFT +#if defined(__CUDA_ARCH__) +__device__ __forceinline__ +uint64_t ROTL64(const uint64_t value, const int offset) { + uint2 result; + const uint2 tmp = vectorize(value); + if(offset == 8){ + result.x = __byte_perm(tmp.x, tmp.y, 0x2107); + result.y = __byte_perm(tmp.y, tmp.x, 0x2107); + } + else if(offset == 16) { + result.x = __byte_perm(tmp.x, tmp.y, 0x1076); + result.y = __byte_perm(tmp.y, tmp.x, 0x1076); + } + else if(offset == 24) { + result.x = __byte_perm(tmp.x, tmp.y, 0x0765); + result.y = __byte_perm(tmp.y, tmp.x, 0x0765); + } + else if(offset >= 32) { + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(tmp.x), "r"(tmp.y), "r"(offset)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(tmp.y), "r"(tmp.x), "r"(offset)); + } else { + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(tmp.y), "r"(tmp.x), "r"(offset)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(tmp.x), "r"(tmp.y), "r"(offset)); + } + return devectorize(result); +} +#else +/* host */ +#define ROTL64(x, n) (((x) << (n)) | ((x) >> (64 - (n)))) +#endif + +__device__ __forceinline__ +uint64_t SWAPDWORDS(uint64_t value){ + uint2 temp; + asm("mov.b64 {%0, %1}, %2; ": "=r"(temp.x), "=r"(temp.y) : "l"(value)); + asm("mov.b64 %0, {%1, %2}; ": "=l"(value) : "r"(temp.y), "r"(temp.x)); + return value; +} + +__device__ __forceinline__ +uint2 SWAPDWORDS2(uint2 value){ + return make_uint2(value.y, value.x); +} + +/* lyra2/bmw - uint2 vector's operators */ + +__device__ __forceinline__ +uint2 SHL8(const uint2 a){ + uint2 result; + result.y = __byte_perm(a.y, a.x, 0x2107); + result.x = __byte_perm(a.x, 0, 0x2107); + + return result; +} + +__device__ __forceinline__ +void LOHI(uint32_t &lo, uint32_t &hi, uint64_t x) { +#if defined(__CUDA_ARCH__) + asm("mov.b64 {%0,%1},%2; \n\t" + : "=r"(lo), "=r"(hi) : "l"(x)); +#else + lo = (uint32_t)(x); + hi = (uint32_t)(x >> 32); +#endif +} + +/** + * uint2 direct ops by c++ operator definitions + */ +static __device__ __forceinline__ uint2 operator^ (const uint2 a,const uint32_t b) { return make_uint2(a.x^ b, a.y); } +static __device__ __forceinline__ uint2 operator^ (const uint2 a,const uint2 b) { return make_uint2(a.x ^ b.x, a.y ^ b.y); } +static __device__ __forceinline__ uint2 operator& (const uint2 a,const uint2 b) { return make_uint2(a.x & b.x, a.y & b.y); } +static __device__ __forceinline__ uint2 operator| (const uint2 a,const uint2 b) { return make_uint2(a.x | b.x, a.y | b.y); } +static __device__ __forceinline__ uint2 operator~ (const uint2 a) { return make_uint2(~a.x, ~a.y); } +static __device__ __forceinline__ void operator^= (uint2 &a,const uint2 b) { a = a ^ b; } + +static __device__ __forceinline__ uint2 operator+ (const uint2 a,const uint2 b) { +#if defined(__CUDA_ARCH__) && CUDA_VERSION < 7000 + uint2 result; + asm("{\n\t" + "add.cc.u32 %0,%2,%4; \n\t" + "addc.u32 %1,%3,%5; \n\t" + "}\n\t" + : "=r"(result.x), "=r"(result.y) : "r"(a.x), "r"(a.y), "r"(b.x), "r"(b.y)); + return result; +#else + return vectorize(devectorize(a) + devectorize(b)); +#endif +} + +static __device__ __forceinline__ uint2 operator+ (const uint2 a,const uint64_t b) { + return vectorize(devectorize(a) + b); +} + +static __device__ __forceinline__ void operator+= (uint2 &a,const uint2 b) { a = a + b; } + +static __device__ __forceinline__ uint2 operator- (const uint2 a,const uint2 b) { +#if defined(__CUDA_ARCH__) && CUDA_VERSION < 7000 + uint2 result; + asm("{\n\t" + "sub.cc.u32 %0,%2,%4; \n\t" + "subc.u32 %1,%3,%5; \n\t" + "}\n\t" + : "=r"(result.x), "=r"(result.y) : "r"(a.x), "r"(a.y), "r"(b.x), "r"(b.y)); + return result; +#else + return vectorize(devectorize(a) - devectorize(b)); +#endif +} +static __device__ __forceinline__ void operator-= (uint2 &a,const uint2 b) { a = a - b; } + +static __device__ __forceinline__ uint2 operator+ (const uint2 a,const uint32_t b) +{ +#if defined(__CUDA_ARCH__) && CUDA_VERSION < 7000 + uint2 result; + asm("add.cc.u32 %0,%2,%4; \n\t" + "addc.u32 %1,%3,%5; \n\t" + : "=r"(result.x), "=r"(result.y) : "r"(a.x), "r"(a.y), "r"(b), "r"(0)); + return result; +#else + return vectorize(devectorize(a) + b); +#endif +} + +static __device__ __forceinline__ uint2 operator- (const uint2 a,const uint64_t b) { + return vectorize(devectorize(a) - b); +} +static __device__ __forceinline__ uint2 operator- (const uint2 a,const uint32_t b) +{ +#if defined(__CUDA_ARCH__) && CUDA_VERSION < 7000 + uint2 result; + asm("sub.cc.u32 %0,%2,%4; \n\t" + "subc.u32 %1,%3,%5; \n\t" + : "=r"(result.x), "=r"(result.y) : "r"(a.x), "r"(a.y), "r"(b), "r"(0)); + return result; +#else + return vectorize(devectorize(a) - b); +#endif +} + +/** + * basic multiplication between 64bit no carry outside that range (ie mul.lo.b64(a*b)) + * (what does uint64 "*" operator) + */ +static __device__ __forceinline__ uint2 operator* (const uint2 a,const uint2 b){ + uint2 result; + asm("{\n\t" + "mul.lo.u32 %0,%2,%4; \n\t" + "mul.hi.u32 %1,%2,%4; \n\t" + "mad.lo.cc.u32 %1,%3,%4,%1; \n\t" + "madc.lo.u32 %1,%3,%5,%1; \n\t" + "}\n\t" + : "=r"(result.x), "=r"(result.y) : "r"(a.x), "r"(a.y), "r"(b.x), "r"(b.y)); + return result; +} + +// uint2 ROR/ROL methods +__device__ __forceinline__ +uint2 ROR2(const uint2 a, const uint32_t offset){ + uint2 result; +#if __CUDA_ARCH__ > 300 + if (offset < 32) { + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(a.x), "r"(a.y), "r"(offset)); + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(a.y), "r"(a.x), "r"(offset)); + } else /* if (offset < 64) */ { + /* offset SHOULD BE < 64 ! */ + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(a.y), "r"(a.x), "r"(offset)); + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(a.x), "r"(a.y), "r"(offset)); + } +#else + if (!offset) + result = a; + else if (offset < 32) { + result.y = ((a.y >> offset) | (a.x << (32 - offset))); + result.x = ((a.x >> offset) | (a.y << (32 - offset))); + } else if (offset == 32) { + result.y = a.x; + result.x = a.y; + } else { + result.y = ((a.x >> (offset - 32)) | (a.y << (64 - offset))); + result.x = ((a.y >> (offset - 32)) | (a.x << (64 - offset))); + } +#endif + return result; +} + +__device__ __forceinline__ +uint2 ROL2(const uint2 a, const uint32_t offset) +{ + uint2 result; +#if __CUDA_ARCH__ > 300 + if (offset >= 32) { + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(a.x), "r"(a.y), "r"(offset)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(a.y), "r"(a.x), "r"(offset)); + } + else { + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(a.y), "r"(a.x), "r"(offset)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(a.x), "r"(a.y), "r"(offset)); + } +#else + if (!offset) + result = a; + else + result = ROR2(a, 64 - offset); +#endif + return result; +} + +__device__ __forceinline__ +uint2 SWAPUINT2(uint2 value) +{ + return make_uint2(value.y, value.x); +} + +/* Byte aligned Rotations (lyra2) */ +__device__ __forceinline__ +uint2 ROL8(const uint2 a){ + uint2 result; + result.x = __byte_perm(a.x, a.y, 0x2107); + result.y = __byte_perm(a.y, a.x, 0x2107); + return result; +} +__device__ __forceinline__ +uint2 ROR8(const uint2 a){ + uint2 result; + result.x = __byte_perm(a.x, a.y, 0x4321); + result.y = __byte_perm(a.y, a.x, 0x4321); + return result; +} +__device__ __forceinline__ +uint2 ROR16(const uint2 a){ + uint2 result; + result.x = __byte_perm(a.x, a.y, 0x5432); + result.y = __byte_perm(a.y, a.x, 0x5432); + return result; +} +__device__ __forceinline__ +uint2 ROL16(const uint2 a){ + uint2 result; + result.x = __byte_perm(a.x, a.y, 0x1076); + result.y = __byte_perm(a.y, a.x, 0x1076); + + return result; +} + +__device__ __forceinline__ +uint2 ROR24(const uint2 a){ + uint2 result; + result.x = __byte_perm(a.x, a.y, 0x6543); + result.y = __byte_perm(a.y, a.x, 0x6543); + return result; +} +__device__ __forceinline__ +uint2 ROL24(const uint2 a){ + uint2 result; + result.x = __byte_perm(a.x, a.y, 0x0765); + result.y = __byte_perm(a.y, a.x, 0x0765); + return result; +} +/* uint2 for bmw512 - to double check later */ + +__device__ __forceinline__ +static uint2 SHL2(const uint2 a,const uint32_t n) { + uint64_t result; + const uint64_t x = devectorize(a); + asm ("shl.b64 %0,%1,%2;\n\t" : "=l"(result) : "l"(x), "r"(n)); + return vectorize(result); +} + +__device__ __forceinline__ +static uint2 SHR2(const uint2 a,const uint32_t n){ + + uint64_t result; + const uint64_t x = devectorize(a); + asm ("shr.b64 %0,%1,%2;\n\t" : "=l"(result) : "l"(x), "r"(n)); + return vectorize(result); +} + +__device__ __forceinline__ +uint32_t xor3x(uint32_t a,uint32_t b,uint32_t c){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x96;" : "=r"(result) : "r"(a), "r"(b),"r"(c)); //0x96 = 0xF0 ^ 0xCC ^ 0xAA + #else + result = a^b^c; + #endif + return result; +} + +__device__ __forceinline__ +uint2 xor3x(const uint2 a,const uint2 b,const uint2 c){ + uint2 result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x96;" : "=r"(result.x) : "r"(a.x), "r"(b.x),"r"(c.x)); //0x96 = 0xF0 ^ 0xCC ^ 0xAA + asm ("lop3.b32 %0, %1, %2, %3, 0x96;" : "=r"(result.y) : "r"(a.y), "r"(b.y),"r"(c.y)); //0x96 = 0xF0 ^ 0xCC ^ 0xAA + #else + result = a^b^c; + #endif + return result; +} + +__device__ __forceinline__ +uint2 chi(const uint2 a,const uint2 b,const uint2 c){ //keccak - chi + uint2 result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0xD2;" : "=r"(result.x) : "r"(a.x), "r"(b.x),"r"(c.x)); //0xD2 = 0xF0 ^ ((~0xCC) & 0xAA) + asm ("lop3.b32 %0, %1, %2, %3, 0xD2;" : "=r"(result.y) : "r"(a.y), "r"(b.y),"r"(c.y)); //0xD2 = 0xF0 ^ ((~0xCC) & 0xAA) + #else + result = a ^ (~b) & c; + #endif + return result; +} +__device__ __forceinline__ +uint32_t chi(const uint32_t a,const uint32_t b,const uint32_t c){ //keccak - chi + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0xD2;" : "=r"(result) : "r"(a), "r"(b),"r"(c)); //0xD2 = 0xF0 ^ ((~0xCC) & 0xAA) + #else + result = a ^ (~b) & c; + #endif + return result; +} +__device__ __forceinline__ +uint32_t bfe(uint32_t x, uint32_t bit, uint32_t numBits) { + uint32_t ret; + asm("bfe.u32 %0, %1, %2, %3;" : "=r"(ret) : "r"(x), "r"(bit), "r"(numBits)); + return ret; + +} + +__device__ __forceinline__ +uint32_t bfi(uint32_t x, uint32_t a, uint32_t bit, uint32_t numBits) { + uint32_t ret; + asm("bfi.b32 %0, %1, %2, %3,%4;" : "=r"(ret) : "r"(x), "r"(a), "r"(bit), "r"(numBits)); + return ret; +} +#endif // #ifndef CUDA_HELPER_H + diff --git a/cuda_myriadgroestl.cu b/cuda_myriadgroestl.cu new file mode 100644 index 0000000..7718785 --- /dev/null +++ b/cuda_myriadgroestl.cu @@ -0,0 +1,438 @@ +// Auf Myriadcoin spezialisierte Version von Groestl inkl. Bitslice +// Based on Tanguy Pruvot's repo +// Provos Alexis - 2016 + +#include "cuda_helper.h" +#include "miner.h" + +#ifdef __INTELLISENSE__ +#define __CUDA_ARCH__ 500 +#define __funnelshift_r(x,y,n) (x >> n) +#define atomicExch(p,x) x +#endif + +// 64 Registers Variant for Compute 3.0 +#include "quark/groestl_functions_quad.h" +#include "quark/groestl_transf_quad.h" + +// globaler Speicher für alle HeftyHashes aller Threads +static uint32_t *d_outputHashes[MAX_GPUS]; + +__constant__ uint32_t _ALIGN(8) c_input[32]; +// muss expandiert werden +__constant__ const uint32_t sha256_constantTable[64] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +}; + +__constant__ const uint32_t sha256_constantTable2[64] = { + 0xC28A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF374, + 0x649B69C1, 0xF0FE4786, 0x0FE1EDC6, 0x240CF254, 0x4FE9346F, 0x6CC984BE, 0x61B9411E, 0x16F988FA, 0xF2C65152, 0xA88E5A6D, 0xB019FC65, 0xB9D99EC7, 0x9A1231C3, 0xE70EEAA0, 0xFDB1232B, 0xC7353EB0, + 0x3069BAD5, 0xCB976D5F, 0x5A0F118F, 0xDC1EEEFD, 0x0A35B689, 0xDE0B7A04, 0x58F4CA9D, 0xE15D5B16, 0x007F3E86, 0x37088980, 0xA507EA32, 0x6FAB9537, 0x17406110, 0x0D8CD6F1, 0xCDAA3B6D, 0xC0BBBE37, + 0x83613BDA, 0xDB48A363, 0x0B02E931, 0x6FD15CA7, 0x521AFACA, 0x31338431, 0x6ED41A95, 0x6D437890, 0xC39C91F2, 0x9ECCABBD, 0xB5C9A0E6, 0x532FB63C, 0xD2C741C6, 0x07237EA3, 0xA4954B68, 0x4C191D76 +}; + +#define Ch(a, b, c) (((b^c) & a) ^ c) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) //((b) & (c)) | (((b) | (c)) & (a)); //andor32(a,b,c); + +#define xor3b(a,b,c) ((a ^ b) ^ c) + +__device__ __forceinline__ uint32_t bsg2_0(const uint32_t x) +{ + return xor3b(ROTR32(x,2),ROTR32(x,13),ROTR32(x,22)); +} + +__device__ __forceinline__ uint32_t bsg2_1(const uint32_t x) +{ + return xor3b(ROTR32(x,6),ROTR32(x,11),ROTR32(x,25)); +} + +__device__ __forceinline__ uint32_t ssg2_0(const uint32_t x) +{ + return xor3b(ROTR32(x,7),ROTR32(x,18),(x>>3)); +} + +__device__ __forceinline__ uint32_t ssg2_1(const uint32_t x) +{ + return xor3b(ROTR32(x,17),ROTR32(x,19),(x>>10)); +} + +__device__ __forceinline__ +static void sha2_step1(const uint32_t a,const uint32_t b,const uint32_t c, uint32_t &d,const uint32_t e,const uint32_t f,const uint32_t g, uint32_t &h,const uint32_t in, const uint32_t Kshared) +{ + const uint32_t t1 = h + bsg2_1(e) + Ch(e, f, g) + Kshared + in; + h = t1 + bsg2_0(a) + Maj(a, b, c); + d+= t1; + +} + +__device__ __forceinline__ +static void sha2_step2(const uint32_t a,const uint32_t b,const uint32_t c, uint32_t &d,const uint32_t e,const uint32_t f,const uint32_t g, uint32_t &h, const uint32_t Kshared) +{ + const uint32_t t1 = h + bsg2_1(e) + Ch(e, f, g) + Kshared; + h = t1 + bsg2_0(a) + Maj(a, b, c); + d+= t1; + +} + +__device__ __forceinline__ +static void sha256_round_body(uint32_t* in, uint32_t* state,const uint32_t* __restrict__ Kshared) +{ + uint32_t a = state[0]; + uint32_t b = state[1]; + uint32_t c = state[2]; + uint32_t d = state[3]; + uint32_t e = state[4]; + uint32_t f = state[5]; + uint32_t g = state[6]; + uint32_t h = state[7]; + + sha2_step1(a,b,c,d,e,f,g,h,in[0], Kshared[0]); + sha2_step1(h,a,b,c,d,e,f,g,in[1], Kshared[1]); + sha2_step1(g,h,a,b,c,d,e,f,in[2], Kshared[2]); + sha2_step1(f,g,h,a,b,c,d,e,in[3], Kshared[3]); + sha2_step1(e,f,g,h,a,b,c,d,in[4], Kshared[4]); + sha2_step1(d,e,f,g,h,a,b,c,in[5], Kshared[5]); + sha2_step1(c,d,e,f,g,h,a,b,in[6], Kshared[6]); + sha2_step1(b,c,d,e,f,g,h,a,in[7], Kshared[7]); + sha2_step1(a,b,c,d,e,f,g,h,in[8], Kshared[8]); + sha2_step1(h,a,b,c,d,e,f,g,in[9], Kshared[9]); + sha2_step1(g,h,a,b,c,d,e,f,in[10],Kshared[10]); + sha2_step1(f,g,h,a,b,c,d,e,in[11],Kshared[11]); + sha2_step1(e,f,g,h,a,b,c,d,in[12],Kshared[12]); + sha2_step1(d,e,f,g,h,a,b,c,in[13],Kshared[13]); + sha2_step1(c,d,e,f,g,h,a,b,in[14],Kshared[14]); + sha2_step1(b,c,d,e,f,g,h,a,in[15],Kshared[15]); + + #pragma unroll 3 + for (int i=0; i<3; i++) + { + #pragma unroll 16 + for (int j = 0; j < 16; j++){ + in[j] = in[j] + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]) + ssg2_1(in[(j + 14) & 15]); + } + sha2_step1(a, b, c, d, e, f, g, h, in[0], Kshared[16 + 16 * i]); + sha2_step1(h, a, b, c, d, e, f, g, in[1], Kshared[17 + 16 * i]); + sha2_step1(g, h, a, b, c, d, e, f, in[2], Kshared[18 + 16 * i]); + sha2_step1(f, g, h, a, b, c, d, e, in[3], Kshared[19 + 16 * i]); + sha2_step1(e, f, g, h, a, b, c, d, in[4], Kshared[20 + 16 * i]); + sha2_step1(d, e, f, g, h, a, b, c, in[5], Kshared[21 + 16 * i]); + sha2_step1(c, d, e, f, g, h, a, b, in[6], Kshared[22 + 16 * i]); + sha2_step1(b, c, d, e, f, g, h, a, in[7], Kshared[23 + 16 * i]); + sha2_step1(a, b, c, d, e, f, g, h, in[8], Kshared[24 + 16 * i]); + sha2_step1(h, a, b, c, d, e, f, g, in[9], Kshared[25 + 16 * i]); + sha2_step1(g, h, a, b, c, d, e, f, in[10], Kshared[26 + 16 * i]); + sha2_step1(f, g, h, a, b, c, d, e, in[11], Kshared[27 + 16 * i]); + sha2_step1(e, f, g, h, a, b, c, d, in[12], Kshared[28 + 16 * i]); + sha2_step1(d, e, f, g, h, a, b, c, in[13], Kshared[29 + 16 * i]); + sha2_step1(c, d, e, f, g, h, a, b, in[14], Kshared[30 + 16 * i]); + sha2_step1(b, c, d, e, f, g, h, a, in[15], Kshared[31 + 16 * i]); + } + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; +} + +__device__ __forceinline__ +static void sha256_round_body_final(uint32_t* state,const uint32_t* Kshared) +{ + uint32_t a = state[0]; + uint32_t b = state[1]; + uint32_t c = state[2]; + uint32_t d = state[3]; + uint32_t e = state[4]; + uint32_t f = state[5]; + uint32_t g = state[6]; + uint32_t h = state[7]; + + sha2_step2(a,b,c,d,e,f,g,h, Kshared[0]); + sha2_step2(h,a,b,c,d,e,f,g, Kshared[1]); + sha2_step2(g,h,a,b,c,d,e,f, Kshared[2]); + sha2_step2(f,g,h,a,b,c,d,e, Kshared[3]); + sha2_step2(e,f,g,h,a,b,c,d, Kshared[4]); + sha2_step2(d,e,f,g,h,a,b,c, Kshared[5]); + sha2_step2(c,d,e,f,g,h,a,b, Kshared[6]); + sha2_step2(b,c,d,e,f,g,h,a, Kshared[7]); + sha2_step2(a,b,c,d,e,f,g,h, Kshared[8]); + sha2_step2(h,a,b,c,d,e,f,g, Kshared[9]); + sha2_step2(g,h,a,b,c,d,e,f, Kshared[10]); + sha2_step2(f,g,h,a,b,c,d,e, Kshared[11]); + sha2_step2(e,f,g,h,a,b,c,d, Kshared[12]); + sha2_step2(d,e,f,g,h,a,b,c, Kshared[13]); + sha2_step2(c,d,e,f,g,h,a,b, Kshared[14]); + sha2_step2(b,c,d,e,f,g,h,a, Kshared[15]); + + #pragma unroll + for (int i=0; i<2; i++){ + + sha2_step2(a, b, c, d, e, f, g, h, Kshared[16 + 16 * i]); + sha2_step2(h, a, b, c, d, e, f, g, Kshared[17 + 16 * i]); + sha2_step2(g, h, a, b, c, d, e, f, Kshared[18 + 16 * i]); + sha2_step2(f, g, h, a, b, c, d, e, Kshared[19 + 16 * i]); + sha2_step2(e, f, g, h, a, b, c, d, Kshared[20 + 16 * i]); + sha2_step2(d, e, f, g, h, a, b, c, Kshared[21 + 16 * i]); + sha2_step2(c, d, e, f, g, h, a, b, Kshared[22 + 16 * i]); + sha2_step2(b, c, d, e, f, g, h, a, Kshared[23 + 16 * i]); + sha2_step2(a, b, c, d, e, f, g, h, Kshared[24 + 16 * i]); + sha2_step2(h, a, b, c, d, e, f, g, Kshared[25 + 16 * i]); + sha2_step2(g, h, a, b, c, d, e, f, Kshared[26 + 16 * i]); + sha2_step2(f, g, h, a, b, c, d, e, Kshared[27 + 16 * i]); + sha2_step2(e, f, g, h, a, b, c, d, Kshared[28 + 16 * i]); + sha2_step2(d, e, f, g, h, a, b, c, Kshared[29 + 16 * i]); + sha2_step2(c, d, e, f, g, h, a, b, Kshared[30 + 16 * i]); + sha2_step2(b, c, d, e, f, g, h, a, Kshared[31 + 16 * i]); + } + sha2_step2(a, b, c, d, e, f, g, h, Kshared[16 + 16 * 2]); + sha2_step2(h, a, b, c, d, e, f, g, Kshared[17 + 16 * 2]); + sha2_step2(g, h, a, b, c, d, e, f, Kshared[18 + 16 * 2]); + sha2_step2(f, g, h, a, b, c, d, e, Kshared[19 + 16 * 2]); + sha2_step2(e, f, g, h, a, b, c, d, Kshared[20 + 16 * 2]); + sha2_step2(d, e, f, g, h, a, b, c, Kshared[21 + 16 * 2]); + sha2_step2(c, d, e, f, g, h, a, b, Kshared[22 + 16 * 2]); + sha2_step2(b, c, d, e, f, g, h, a, Kshared[23 + 16 * 2]); + sha2_step2(a, b, c, d, e, f, g, h, Kshared[24 + 16 * 2]); + sha2_step2(h, a, b, c, d, e, f, g, Kshared[25 + 16 * 2]); + sha2_step2(g, h, a, b, c, d, e, f, Kshared[26 + 16 * 2]); + sha2_step2(f, g, h, a, b, c, d, e, Kshared[27 + 16 * 2]); + sha2_step2(e, f, g, h, a, b, c, d, Kshared[28 + 16 * 2]); + sha2_step2(d, e, f, g, h, a, b, c, Kshared[29 + 16 * 2]); + + state[6]+= g; + state[7]+= h; +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(1024,2) /* to force 32 regs */ +#else +__launch_bounds__(768,2) /* to force 32 regs */ +#endif +void myriadgroestl_gpu_hash_sha(uint32_t threads, uint32_t startNounce, uint32_t* hashBuffer, uint32_t *resNonces,const uint64_t target64){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + uint32_t W[16]; + uint32_t *inpHash = &hashBuffer[thread<<4]; + + *(uint2x4*)&W[ 0] = __ldg4((uint2x4*)&inpHash[ 0]); + *(uint2x4*)&W[ 8] = __ldg4((uint2x4*)&inpHash[ 8]); + + uint32_t buf[ 8] = { + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + }; + + sha256_round_body(W,buf,sha256_constantTable); + + sha256_round_body_final(buf,sha256_constantTable2); + + #if 0 + // Full sha hash + #pragma unroll + for(int k=0; k<8; k++) + W[k] = cuda_swab32(buf[k]); + #else + W[6] = cuda_swab32(buf[6]); + W[7] = cuda_swab32(buf[7]); + #endif + + if (*(uint64_t*)&W[6] <= target64){ + uint32_t tmp = atomicExch(&resNonces[0], startNounce + thread); + if (tmp != UINT32_MAX) + resNonces[1] = tmp; + } + } +} + +#define TPB52 512 +#define TPB50 512 +#define THF 4 + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB52, 2) +#else +__launch_bounds__(TPB50, 2) +#endif +void myriadgroestl_gpu_hash_quad(uint32_t threads, uint32_t startNounce, uint32_t *d_hash){ + + // durch 4 dividieren, weil jeweils 4 Threads zusammen ein Hash berechnen + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x)>>2; + if (thread < threads) + { + const uint32_t thr = threadIdx.x & 3; + // GROESTL + uint32_t input[8]; + uint32_t other[8]; + uint32_t msgBitsliced[8]; + uint32_t state[8]; + uint32_t output[16]; + + *(uint2x4*)input = *(uint2x4*)&c_input[((threadIdx.x & 2)<<3)]; + *(uint2x4*)other = *(uint2x4*)&c_input[(((threadIdx.x+1)&3)<<3)]; + #pragma unroll 8 + for(int k=0; k<8; k++){ +// input[k] = c_input[k+((threadIdx.x & 2)<<3)]; +// other[k] = c_input[k+(((threadIdx.x+1)&3)<<3)]; + other[k] = __shfl(other[k], threadIdx.x & 2, 4); + } + + if ((thr == 2) || (thr == 3)) + other[4] = cuda_swab32(startNounce + thread); + + uint32_t t; + + const uint32_t perm = (threadIdx.x & 1) ? 0x7362 : 0x5140; + + merge8(msgBitsliced[0], input[0], input[4], perm); + merge8(msgBitsliced[1], other[0], other[4], perm); + merge8(msgBitsliced[2], input[1], input[5], perm); + merge8(msgBitsliced[3], other[1], other[5], perm); + merge8(msgBitsliced[4], input[2], input[6], perm); + merge8(msgBitsliced[5], other[2], other[6], perm); + merge8(msgBitsliced[6], input[3], input[7], perm); + merge8(msgBitsliced[7], other[3], other[7], perm); + + SWAP1(msgBitsliced[0], msgBitsliced[1]); + SWAP1(msgBitsliced[2], msgBitsliced[3]); + SWAP1(msgBitsliced[4], msgBitsliced[5]); + SWAP1(msgBitsliced[6], msgBitsliced[7]); + + SWAP2(msgBitsliced[0], msgBitsliced[2]); + SWAP2(msgBitsliced[1], msgBitsliced[3]); + SWAP2(msgBitsliced[4], msgBitsliced[6]); + SWAP2(msgBitsliced[5], msgBitsliced[7]); + + SWAP4(msgBitsliced[0], msgBitsliced[4]); + SWAP4(msgBitsliced[1], msgBitsliced[5]); + SWAP4(msgBitsliced[2], msgBitsliced[6]); + SWAP4(msgBitsliced[3], msgBitsliced[7]); + + groestl512_progressMessage_quad(state, msgBitsliced,thr); + + from_bitslice_quad52(state, output); + + uint2x4* outHash = (uint2x4*)&d_hash[thread<<4]; + +#if __CUDA_ARCH__ <= 500 + output[0] = __byte_perm(output[0], __shfl(output[0], (threadIdx.x + 1) & 3, 4), 0x0167); + output[2] = __byte_perm(output[2], __shfl(output[2], (threadIdx.x + 1) & 3, 4), 0x0167); + output[4] = __byte_perm(output[4], __shfl(output[4], (threadIdx.x + 1) & 3, 4), 0x2367); + output[6] = __byte_perm(output[6], __shfl(output[6], (threadIdx.x + 1) & 3, 4), 0x2367); + output[8] = __byte_perm(output[8], __shfl(output[8], (threadIdx.x + 1) & 3, 4), 0x0167); + output[10] = __byte_perm(output[10], __shfl(output[10], (threadIdx.x + 1) & 3, 4), 0x0167); + output[12] = __byte_perm(output[12], __shfl(output[12], (threadIdx.x + 1) & 3, 4), 0x2367); + output[14] = __byte_perm(output[14], __shfl(output[14], (threadIdx.x + 1) & 3, 4), 0x2367); + + if (thr == 0 || thr == 2){ + output[0 + 1] = __shfl(output[0], (threadIdx.x + 2) & 3, 4); + output[2 + 1] = __shfl(output[2], (threadIdx.x + 2) & 3, 4); + output[4 + 1] = __shfl(output[4], (threadIdx.x + 2) & 3, 4); + output[6 + 1] = __shfl(output[6], (threadIdx.x + 2) & 3, 4); + output[8 + 1] = __shfl(output[8], (threadIdx.x + 2) & 3, 4); + output[10 + 1] = __shfl(output[10], (threadIdx.x + 2) & 3, 4); + output[12 + 1] = __shfl(output[12], (threadIdx.x + 2) & 3, 4); + output[14 + 1] = __shfl(output[14], (threadIdx.x + 2) & 3, 4); + if(thr==0){ + outHash[0] = *(uint2x4*)&output[0]; + outHash[1] = *(uint2x4*)&output[8]; + } + } +#else + output[ 0] = __byte_perm(output[0], __shfl(output[0], (threadIdx.x + 1) & 3, 4), 0x0167); + output[ 1] = __shfl(output[0], (threadIdx.x + 2) & 3, 4); + + output[ 2] = __byte_perm(output[2], __shfl(output[2], (threadIdx.x + 1) & 3, 4), 0x0167); + output[ 3] = __shfl(output[2], (threadIdx.x + 2) & 3, 4); + + output[ 4] = __byte_perm(output[4], __shfl(output[4], (threadIdx.x + 1) & 3, 4), 0x2367); + output[ 5] = __shfl(output[4], (threadIdx.x + 2) & 3, 4); + + output[ 6] = __byte_perm(output[6], __shfl(output[6], (threadIdx.x + 1) & 3, 4), 0x2367); + output[ 7] = __shfl(output[6], (threadIdx.x + 2) & 3, 4); + + output[ 8] = __byte_perm(output[8], __shfl(output[8], (threadIdx.x + 1) & 3, 4), 0x0167); + output[ 9] = __shfl(output[8], (threadIdx.x + 2) & 3, 4); + + output[10] = __byte_perm(output[10], __shfl(output[10], (threadIdx.x + 1) & 3, 4), 0x0167); + output[11] = __shfl(output[10], (threadIdx.x + 2) & 3, 4); + + output[12] = __byte_perm(output[12], __shfl(output[12], (threadIdx.x + 1) & 3, 4), 0x2367); + output[13] = __shfl(output[12], (threadIdx.x + 2) & 3, 4); + + output[14] = __byte_perm(output[14], __shfl(output[14], (threadIdx.x + 1) & 3, 4), 0x2367); + output[15] = __shfl(output[14], (threadIdx.x + 2) & 3, 4); + + if(thr==0){ + outHash[0] = *(uint2x4*)&output[0]; + outHash[1] = *(uint2x4*)&output[8]; + } +#endif + } +} + +// Setup Function +__host__ +void myriadgroestl_cpu_init(int thr_id, uint32_t threads) +{ + CUDA_SAFE_CALL(cudaMalloc(&d_outputHashes[thr_id], (size_t) 64 * threads)); +} + +__host__ +void myriadgroestl_cpu_free(int thr_id) +{ + cudaFree(d_outputHashes[thr_id]); +} + +__host__ +void myriadgroestl_cpu_setBlock(int thr_id, void *data){ + + uint32_t msgBlock[32] = { 0 }; + uint32_t paddedInput[32]; + memcpy(&msgBlock[0], data, 80); + msgBlock[20] = 0x80; + msgBlock[31] = 0x01000000; + + for(int thr=0;thr<4;thr++) + for(int k=0; k<8; k++) + paddedInput[k+(thr<<3)] = msgBlock[4*k+thr]; + + for(int k=0;k<8;k++){ + uint32_t temp = paddedInput[k+(1<<3)]; + paddedInput[k+(1<<3)] = paddedInput[k+(2<<3)]; + paddedInput[k+(2<<3)] = temp; + } + + cudaMemcpyToSymbol(c_input, paddedInput, 128); +} + +__host__ +void myriadgroestl_cpu_hash(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_resNounce, const uint64_t target) +{ + // Compute 3.0 benutzt die registeroptimierte Quad Variante mit Warp Shuffle + // mit den Quad Funktionen brauchen wir jetzt 4 threads pro Hash, daher Faktor 4 bei der Blockzahl + uint32_t tpb = TPB52; + int dev_id = device_map[thr_id]; + if (device_sm[dev_id] <= 500) tpb = TPB50; + const dim3 grid((THF*threads + tpb-1)/tpb); + const dim3 block(tpb); + + myriadgroestl_gpu_hash_quad <<< grid, block >>> (threads, startNounce, d_outputHashes[thr_id]); + + tpb = (device_sm[dev_id] <= 500) ? 768 : 1024; + + dim3 grid2((threads + tpb - 1) / tpb); + dim3 block2(tpb); + + myriadgroestl_gpu_hash_sha <<< grid2, block2 >>> (threads, startNounce, d_outputHashes[thr_id], d_resNounce, target); + +} diff --git a/cuda_vectors.h b/cuda_vectors.h new file mode 100644 index 0000000..24a4da8 --- /dev/null +++ b/cuda_vectors.h @@ -0,0 +1,633 @@ +/* DJM CRAP to strip (again) made for SM 3.2+ */ + +#ifndef CUDA_LYRA_VECTOR_H +#define CUDA_LYRA_VECTOR_H + +/////////////////////////////////////////////////////////////////////////////////// +#if (defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) +#define __LDG_PTR "l" +#else +#define __LDG_PTR "r" +#endif + +#include "cuda_helper.h" + +#if __CUDA_ARCH__ < 320 && !defined(__ldg4) +#define __ldg4(x) (*(x)) +#endif + +typedef struct __align__(32) uint8 { + unsigned int s0, s1, s2, s3, s4, s5, s6, s7; +} uint8; + +typedef struct __align__(64) uint2_8 { + uint2 s0, s1, s2, s3, s4, s5, s6, s7; +} uint2_8; + +typedef struct __align__(16) ulong2x2 { + ulonglong2 l0,l1; +} ulonglong2x2; + +typedef struct __align__(64) ulonglong2to8 { + ulonglong2 l0,l1,l2,l3; +} ulonglong2to8; + +typedef struct __align__(128) ulonglong8to16 { + ulonglong2to8 lo, hi; +} ulonglong8to16; + +typedef struct __align__(256) ulonglong16to32 { + ulonglong8to16 lo, hi; +} ulonglong16to32; + +typedef struct __align__(512) ulonglong32to64 { + ulonglong16to32 lo, hi; +} ulonglong32to64; + +typedef struct __align__(128) ulonglonglong { + ulonglong2 s0,s1,s2,s3,s4,s5,s6,s7; +} ulonglonglong; + +typedef struct __align__(64) uint16 { + union { + struct {unsigned int s0, s1, s2, s3, s4, s5, s6, s7;}; + uint8 lo; + }; + union { + struct {unsigned int s8, s9, sa, sb, sc, sd, se, sf;}; + uint8 hi; + }; +} uint16; + +typedef struct __align__(128) uint2_16 { + union { + struct { uint2 s0, s1, s2, s3, s4, s5, s6, s7; }; + uint2_8 lo; + }; + union { + struct { uint2 s8, s9, sa, sb, sc, sd, se, sf; }; + uint2_8 hi; + }; +} uint2_16; + +typedef struct __align__(128) uint32 { + uint16 lo,hi; +} uint32; + +struct __align__(128) ulong8 { + ulonglong4 s0, s1, s2, s3; +}; +typedef __device_builtin__ struct ulong8 ulong8; + +typedef struct __align__(256) ulonglong16 { + ulonglong4 s0, s1, s2, s3, s4, s5, s6, s7; +} ulonglong16; + +typedef struct __align__(16) uint28 { + uint2 x, y, z, w; +} uint2x4; +typedef uint2x4 uint28; /* name deprecated */ + +typedef struct __builtin_align__(32) uint48 { + uint4 s0,s1; +} uint48; + +typedef struct __align__(256) uint4x16 { + uint4 s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15; +} uint4x16; + +static __inline__ __device__ ulonglong2to8 make_ulonglong2to8(ulonglong2 s0, ulonglong2 s1, ulonglong2 s2, ulonglong2 s3) +{ + ulonglong2to8 t; t.l0=s0; t.l1=s1; t.l2=s2; t.l3=s3; + return t; +} + +static __inline__ __device__ ulonglong8to16 make_ulonglong8to16(const ulonglong2to8 &s0, const ulonglong2to8 &s1) +{ + ulonglong8to16 t; t.lo = s0; t.hi = s1; + return t; +} + +static __inline__ __device__ ulonglong16to32 make_ulonglong16to32(const ulonglong8to16 &s0, const ulonglong8to16 &s1) +{ + ulonglong16to32 t; t.lo = s0; t.hi = s1; + return t; +} + +static __inline__ __device__ ulonglong32to64 make_ulonglong32to64(const ulonglong16to32 &s0, const ulonglong16to32 &s1) +{ + ulonglong32to64 t; t.lo = s0; t.hi = s1; + return t; +} + +static __inline__ __host__ __device__ ulonglonglong make_ulonglonglong( + const ulonglong2 &s0, const ulonglong2 &s1, const ulonglong2 &s2, const ulonglong2 &s3, + const ulonglong2 &s4, const ulonglong2 &s5) +{ + ulonglonglong t; t.s0 = s0; t.s1 = s1; t.s2 = s2; t.s3 = s3; t.s4 = s4; t.s5 = s5; + return t; +} + +static __inline__ __device__ uint48 make_uint48(uint4 s0, uint4 s1) +{ + uint48 t; t.s0 = s0; t.s1 = s1; + return t; +} + +static __inline__ __device__ uint28 make_uint28(uint2 s0, uint2 s1, uint2 s2, uint2 s3) +{ + uint28 t; t.x = s0; t.y = s1; t.z = s2; t.w = s3; + return t; +} + +static __inline__ __host__ __device__ uint4x16 make_uint4x16( + uint4 s0, uint4 s1, uint4 s2, uint4 s3, uint4 s4, uint4 s5, uint4 s6, uint4 s7, + uint4 s8, uint4 s9, uint4 sa, uint4 sb, uint4 sc, uint4 sd, uint4 se, uint4 sf) +{ + uint4x16 t; t.s0 = s0; t.s1 = s1; t.s2 = s2; t.s3 = s3; t.s4 = s4; t.s5 = s5; t.s6 = s6; t.s7 = s7; + t.s8 = s8; t.s9 = s9; t.s10 = sa; t.s11 = sb; t.s12 = sc; t.s13 = sd; t.s14 = se; t.s15 = sf; + return t; +} + +static __inline__ __device__ uint2_16 make_uint2_16( + uint2 s0, uint2 s1, uint2 s2, uint2 s3, uint2 s4, uint2 s5, uint2 s6, uint2 s7, + uint2 s8, uint2 s9, uint2 sa, uint2 sb, uint2 sc, uint2 sd, uint2 se, uint2 sf) +{ + uint2_16 t; t.s0 = s0; t.s1 = s1; t.s2 = s2; t.s3 = s3; t.s4 = s4; t.s5 = s5; t.s6 = s6; t.s7 = s7; + t.s8 = s8; t.s9 = s9; t.sa = sa; t.sb = sb; t.sc = sc; t.sd = sd; t.se = se; t.sf = sf; + return t; +} + +static __inline__ __host__ __device__ uint16 make_uint16( + unsigned int s0, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4, unsigned int s5, unsigned int s6, unsigned int s7, + unsigned int s8, unsigned int s9, unsigned int sa, unsigned int sb, unsigned int sc, unsigned int sd, unsigned int se, unsigned int sf) +{ + uint16 t; t.s0 = s0; t.s1 = s1; t.s2 = s2; t.s3 = s3; t.s4 = s4; t.s5 = s5; t.s6 = s6; t.s7 = s7; + t.s8 = s8; t.s9 = s9; t.sa = sa; t.sb = sb; t.sc = sc; t.sd = sd; t.se = se; t.sf = sf; + return t; +} + +static __inline__ __host__ __device__ uint16 make_uint16(const uint8 &a, const uint8 &b) +{ + uint16 t; t.lo=a; t.hi=b; return t; +} + +static __inline__ __host__ __device__ uint32 make_uint32(const uint16 &a, const uint16 &b) +{ + uint32 t; t.lo = a; t.hi = b; return t; +} + + +static __inline__ __host__ __device__ uint8 make_uint8( + unsigned int s0, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4, unsigned int s5, unsigned int s6, unsigned int s7) +{ + uint8 t; t.s0 = s0; t.s1 = s1; t.s2 = s2; t.s3 = s3; t.s4 = s4; t.s5 = s5; t.s6 = s6; t.s7 = s7; + return t; +} + +static __inline__ __host__ __device__ uint2_8 make_uint2_8( + uint2 s0, uint2 s1, uint2 s2, uint2 s3, uint2 s4, uint2 s5, uint2 s6, uint2 s7) +{ + uint2_8 t; t.s0 = s0; t.s1 = s1; t.s2 = s2; t.s3 = s3; t.s4 = s4; t.s5 = s5; t.s6 = s6; t.s7 = s7; + return t; +} + +static __inline__ __host__ __device__ ulonglong16 make_ulonglong16(const ulonglong4 &s0, const ulonglong4 &s1, + const ulonglong4 &s2, const ulonglong4 &s3, const ulonglong4 &s4, const ulonglong4 &s5, const ulonglong4 &s6, const ulonglong4 &s7) +{ + ulonglong16 t; t.s0 = s0; t.s1 = s1; t.s2 = s2; t.s3 = s3; t.s4 = s4; t.s5 = s5; t.s6 = s6; t.s7 = s7; + return t; +} + +static __inline__ __host__ __device__ ulong8 make_ulong8( + ulonglong4 s0, ulonglong4 s1, ulonglong4 s2, ulonglong4 s3) +{ + ulong8 t; t.s0 = s0; t.s1 = s1; t.s2 = s2; t.s3 = s3;// t.s4 = s4; t.s5 = s5; t.s6 = s6; t.s7 = s7; + return t; +} + + +static __forceinline__ __device__ uchar4 operator^ (uchar4 a, uchar4 b) { return make_uchar4(a.x ^ b.x, a.y ^ b.y, a.z ^ b.z, a.w ^ b.w); } +static __forceinline__ __device__ uchar4 operator+ (uchar4 a, uchar4 b) { return make_uchar4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); } + +static __forceinline__ __device__ uint4 operator+ (uint4 a, uint4 b) { return make_uint4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); } +static __forceinline__ __device__ uint4 operator^ (uint4 a, uint4 b) { return make_uint4(a.x ^ b.x, a.y ^ b.y, a.z ^ b.z, a.w ^ b.w); } +static __forceinline__ __device__ uint4 operator& (uint4 a, uint4 b) { return make_uint4(a.x & b.x, a.y & b.y, a.z & b.z, a.w & b.w); } +static __forceinline__ __device__ uint4 operator>>(uint4 a, int b) { return make_uint4(a.x >> b, a.y >> b, a.z >> b, a.w >> b); } +static __forceinline__ __device__ uint4 operator<<(uint4 a, int b) { return make_uint4(a.x << b, a.y << b, a.z << b, a.w << b); } +static __forceinline__ __device__ uint4 operator* (uint4 a, int b) { return make_uint4(a.x * b, a.y * b, a.z * b, a.w * b); } +static __forceinline__ __device__ void operator^=(uint4 &a,uint4 b) { a = a ^ b; } +static __forceinline__ __device__ void operator+=(uint4 &a, uint4 b){ a = a + b; } + +static __forceinline__ __device__ ulonglong4 operator^ (ulonglong4 a, ulonglong4 b) { return make_ulonglong4(a.x ^ b.x, a.y ^ b.y, a.z ^ b.z, a.w ^ b.w); } +static __forceinline__ __device__ ulonglong4 operator+ (ulonglong4 a, ulonglong4 b) { return make_ulonglong4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); } +static __forceinline__ __device__ ulonglong2 operator^ (ulonglong2 a, ulonglong2 b) { return make_ulonglong2(a.x ^ b.x, a.y ^ b.y); } +static __forceinline__ __device__ ulonglong2 operator+ (ulonglong2 a, ulonglong2 b) { return make_ulonglong2(a.x + b.x, a.y + b.y); } + +static __forceinline__ __device__ ulong8 operator^ (const ulong8 &a, const ulong8 &b) { + return make_ulong8(a.s0 ^ b.s0, a.s1 ^ b.s1, a.s2 ^ b.s2, a.s3 ^ b.s3); +} + +static __forceinline__ __device__ ulong8 operator+ (const ulong8 &a, const ulong8 &b) { + return make_ulong8(a.s0 + b.s0, a.s1 + b.s1, a.s2 + b.s2, a.s3 + b.s3); +} + +static __forceinline__ __device__ __host__ uint8 operator^ (const uint8 &a, const uint8 &b) { return make_uint8(a.s0 ^ b.s0, a.s1 ^ b.s1, a.s2 ^ b.s2, a.s3 ^ b.s3, a.s4 ^ b.s4, a.s5 ^ b.s5, a.s6 ^ b.s6, a.s7 ^ b.s7); } + +static __forceinline__ __device__ __host__ uint8 operator+ (const uint8 &a, const uint8 &b) { return make_uint8(a.s0 + b.s0, a.s1 + b.s1, a.s2 + b.s2, a.s3 + b.s3, a.s4 + b.s4, a.s5 + b.s5, a.s6 + b.s6, a.s7 + b.s7); } + +static __forceinline__ __device__ uint2_8 operator^ (const uint2_8 &a, const uint2_8 &b) { return make_uint2_8(a.s0 ^ b.s0, a.s1 ^ b.s1, a.s2 ^ b.s2, a.s3 ^ b.s3, a.s4 ^ b.s4, a.s5 ^ b.s5, a.s6 ^ b.s6, a.s7 ^ b.s7); } + +static __forceinline__ __device__ uint2_8 operator+ (const uint2_8 &a, const uint2_8 &b) { return make_uint2_8(a.s0 + b.s0, a.s1 + b.s1, a.s2 + b.s2, a.s3 + b.s3, a.s4 + b.s4, a.s5 + b.s5, a.s6 + b.s6, a.s7 + b.s7); } + + +////////////// mess++ ////// + +static __forceinline__ __device__ uint28 operator^ (const uint28 &a, const uint28 &b) { + return make_uint28(a.x ^ b.x, a.y ^ b.y, a.z ^ b.z, a.w ^ b.w); +} + +static __forceinline__ __device__ uint28 operator+ (const uint28 &a, const uint28 &b) { + return make_uint28(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); +} + +static __forceinline__ __device__ uint48 operator+ (const uint48 &a, const uint48 &b) { + return make_uint48(a.s0 + b.s0, a.s1 + b.s1); +} + +///////////////////////// + +static __forceinline__ __device__ __host__ uint16 operator^ (const uint16 &a, const uint16 &b) { + return make_uint16(a.s0 ^ b.s0, a.s1 ^ b.s1, a.s2 ^ b.s2, a.s3 ^ b.s3, a.s4 ^ b.s4, a.s5 ^ b.s5, a.s6 ^ b.s6, a.s7 ^ b.s7, + a.s8 ^ b.s8, a.s9 ^ b.s9, a.sa ^ b.sa, a.sb ^ b.sb, a.sc ^ b.sc, a.sd ^ b.sd, a.se ^ b.se, a.sf ^ b.sf); +} + +static __forceinline__ __device__ __host__ uint16 operator+ (const uint16 &a, const uint16 &b) { + return make_uint16(a.s0 + b.s0, a.s1 + b.s1, a.s2 + b.s2, a.s3 + b.s3, a.s4 + b.s4, a.s5 + b.s5, a.s6 + b.s6, a.s7 + b.s7, + a.s8 + b.s8, a.s9 + b.s9, a.sa + b.sa, a.sb + b.sb, a.sc + b.sc, a.sd + b.sd, a.se + b.se, a.sf + b.sf); +} + +static __forceinline__ __device__ __host__ uint16 operator- (const uint16 &a, const uint16 &b) { + return make_uint16(a.s0 - b.s0, a.s1 - b.s1, a.s2 - b.s2, a.s3 - b.s3, a.s4 - b.s4, a.s5 - b.s5, a.s6 - b.s6, a.s7 - b.s7, + a.s8 - b.s8, a.s9 - b.s9, a.sa - b.sa, a.sb - b.sb, a.sc - b.sc, a.sd - b.sd, a.se - b.se, a.sf - b.sf); +} + +static __forceinline__ __device__ uint2_16 operator^ (const uint2_16 &a, const uint2_16 &b) { + return make_uint2_16(a.s0 ^ b.s0, a.s1 ^ b.s1, a.s2 ^ b.s2, a.s3 ^ b.s3, a.s4 ^ b.s4, a.s5 ^ b.s5, a.s6 ^ b.s6, a.s7 ^ b.s7, + a.s8 ^ b.s8, a.s9 ^ b.s9, a.sa ^ b.sa, a.sb ^ b.sb, a.sc ^ b.sc, a.sd ^ b.sd, a.se ^ b.se, a.sf ^ b.sf); +} + +static __forceinline__ __device__ uint2_16 operator+ (const uint2_16 &a, const uint2_16 &b) { + return make_uint2_16(a.s0 + b.s0, a.s1 + b.s1, a.s2 + b.s2, a.s3 + b.s3, a.s4 + b.s4, a.s5 + b.s5, a.s6 + b.s6, a.s7 + b.s7, + a.s8 + b.s8, a.s9 + b.s9, a.sa + b.sa, a.sb + b.sb, a.sc + b.sc, a.sd + b.sd, a.se + b.se, a.sf + b.sf); +} + +static __forceinline__ __device__ uint32 operator^ (const uint32 &a, const uint32 &b) { + return make_uint32(a.lo ^ b.lo, a.hi ^ b.hi); +} + +static __forceinline__ __device__ uint32 operator+ (const uint32 &a, const uint32 &b) { + return make_uint32(a.lo + b.lo, a.hi + b.hi); +} + +static __forceinline__ __device__ ulonglong16 operator^ (const ulonglong16 &a, const ulonglong16 &b) { + return make_ulonglong16(a.s0 ^ b.s0, a.s1 ^ b.s1, a.s2 ^ b.s2, a.s3 ^ b.s3, a.s4 ^ b.s4, a.s5 ^ b.s5, a.s6 ^ b.s6, a.s7 ^ b.s7); +} + +static __forceinline__ __device__ ulonglong16 operator+ (const ulonglong16 &a, const ulonglong16 &b) { + return make_ulonglong16(a.s0 + b.s0, a.s1 + b.s1, a.s2 + b.s2, a.s3 + b.s3, a.s4 + b.s4, a.s5 + b.s5, a.s6 + b.s6, a.s7 + b.s7); +} + +static __forceinline__ __device__ void operator^= (ulong8 &a, const ulong8 &b) { a = a ^ b; } + +static __forceinline__ __device__ void operator^= (uint28 &a, const uint28 &b) { a = a ^ b; } +static __forceinline__ __device__ void operator+= (uint28 &a, const uint28 &b) { a = a + b; } + +static __forceinline__ __device__ void operator^= (uint2_8 &a, const uint2_8 &b) { a = a ^ b; } +static __forceinline__ __device__ void operator+= (uint2_8 &a, const uint2_8 &b) { a = a + b; } + +static __forceinline__ __device__ void operator^= (uint32 &a, const uint32 &b) { a = a ^ b; } +static __forceinline__ __device__ void operator+= (uint32 &a, const uint32 &b) { a = a + b; } + +static __forceinline__ __device__ void operator^= (uchar4 &a, uchar4 b) { a = a ^ b; } + +static __forceinline__ __device__ __host__ void operator^= (uint8 &a, const uint8 &b) { a = a ^ b; } +static __forceinline__ __device__ __host__ void operator^= (uint16 &a, const uint16 &b) { a = a ^ b; } + +static __forceinline__ __device__ void operator^= (ulonglong16 &a, const ulonglong16 &b) { a = a ^ b; } +static __forceinline__ __device__ void operator^= (ulonglong4 &a, const ulonglong4 &b) { a = a ^ b; } +static __forceinline__ __device__ void operator+= (ulonglong4 &a, const ulonglong4 &b) { a = a + b; } + +static __forceinline__ __device__ void operator^= (ulonglong2 &a, const ulonglong2 &b) { a = a ^ b; } +static __forceinline__ __device__ void operator+= (ulonglong2 &a, const ulonglong2 &b) { a = a + b; } + +static __forceinline__ __device__ +ulonglong2to8 operator^ (const ulonglong2to8 &a, const ulonglong2to8 &b) +{ + return make_ulonglong2to8(a.l0 ^ b.l0, a.l1 ^ b.l1, a.l2 ^ b.l2, a.l3 ^ b.l3); +} +static __forceinline__ __device__ +ulonglong2to8 operator+ (const ulonglong2to8 &a, const ulonglong2to8 &b) +{ + return make_ulonglong2to8(a.l0 + b.l0, a.l1 + b.l1, a.l2 + b.l2, a.l3 + b.l3); +} + +static __forceinline__ __device__ +ulonglong8to16 operator^ (const ulonglong8to16 &a, const ulonglong8to16 &b) +{ + return make_ulonglong8to16(a.lo ^ b.lo, a.hi ^ b.hi); +} + +static __forceinline__ __device__ +ulonglong8to16 operator+ (const ulonglong8to16 &a, const ulonglong8to16 &b) +{ + return make_ulonglong8to16(a.lo + b.lo, a.hi + b.hi); +} + +static __forceinline__ __device__ +ulonglong16to32 operator^ (const ulonglong16to32 &a, const ulonglong16to32 &b) +{ + return make_ulonglong16to32(a.lo ^ b.lo, a.hi ^ b.hi); +} + +static __forceinline__ __device__ +ulonglong16to32 operator+ (const ulonglong16to32 &a, const ulonglong16to32 &b) +{ + return make_ulonglong16to32(a.lo + b.lo, a.hi + b.hi); +} + +static __forceinline__ __device__ +ulonglong32to64 operator^ (const ulonglong32to64 &a, const ulonglong32to64 &b) +{ + return make_ulonglong32to64(a.lo ^ b.lo, a.hi ^ b.hi); +} + +static __forceinline__ __device__ +ulonglong32to64 operator+ (const ulonglong32to64 &a, const ulonglong32to64 &b) +{ + return make_ulonglong32to64(a.lo + b.lo, a.hi + b.hi); +} + +static __forceinline__ __device__ ulonglonglong operator^ (const ulonglonglong &a, const ulonglonglong &b) { + return make_ulonglonglong(a.s0 ^ b.s0, a.s1 ^ b.s1, a.s2 ^ b.s2, a.s3 ^ b.s3, a.s4 ^ b.s4, a.s5 ^ b.s5); +} + +static __forceinline__ __device__ ulonglonglong operator+ (const ulonglonglong &a, const ulonglonglong &b) { + return make_ulonglonglong(a.s0 + b.s0, a.s1 + b.s1, a.s2 + b.s2, a.s3 + b.s3, a.s4 + b.s4, a.s5 + b.s5); +} + +static __forceinline__ __device__ void operator^= (ulonglong2to8 &a, const ulonglong2to8 &b) { a = a ^ b; } + +static __forceinline__ __device__ void operator+= (uchar4 &a, uchar4 b) { a = a + b; } +static __forceinline__ __device__ __host__ void operator+= (uint8 &a, const uint8 &b) { a = a + b; } +static __forceinline__ __device__ __host__ void operator+= (uint16 &a, const uint16 &b) { a = a + b; } +static __forceinline__ __device__ __host__ void operator-= (uint16 &a, const uint16 &b) { a = a - b; } +static __forceinline__ __device__ void operator+= (uint2_16 &a, const uint2_16 &b) { a = a + b; } +static __forceinline__ __device__ void operator^= (uint2_16 &a, const uint2_16 &b) { a = a + b; } + +static __forceinline__ __device__ void operator+= (ulong8 &a, const ulong8 &b) { a = a + b; } +static __forceinline__ __device__ void operator+= (ulonglong16 &a, const ulonglong16 &b) { a = a + b; } +static __forceinline__ __device__ void operator+= (ulonglong8to16 &a, const ulonglong8to16 &b) { a = a + b; } +static __forceinline__ __device__ void operator^= (ulonglong8to16 &a, const ulonglong8to16 &b) { a = a ^ b; } + +static __forceinline__ __device__ void operator+= (ulonglong16to32 &a, const ulonglong16to32 &b) { a = a + b; } +static __forceinline__ __device__ void operator^= (ulonglong16to32 &a, const ulonglong16to32 &b) { a = a ^ b; } + +static __forceinline__ __device__ void operator+= (ulonglong32to64 &a, const ulonglong32to64 &b) { a = a + b; } +static __forceinline__ __device__ void operator^= (ulonglong32to64 &a, const ulonglong32to64 &b) { a = a ^ b; } + +static __forceinline__ __device__ void operator+= (ulonglonglong &a, const ulonglonglong &b) { a = a + b; } +static __forceinline__ __device__ void operator^= (ulonglonglong &a, const ulonglonglong &b) { a = a ^ b; } + + +static __forceinline__ __device__ uint4 rotate4(uint4 vec4, uint32_t shift) +{ + uint4 ret; + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.x) : "r"(vec4.x), "r"(vec4.x), "r"(shift)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.y) : "r"(vec4.y), "r"(vec4.y), "r"(shift)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.z) : "r"(vec4.z), "r"(vec4.z), "r"(shift)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.w) : "r"(vec4.w), "r"(vec4.w), "r"(shift)); + return ret; +} + +static __forceinline__ __device__ uint2x4 rotate2x4(const uint2x4 &vec4, uint32_t shift) +{ + uint2x4 ret; + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.x.x) : "r"(vec4.x.x), "r"(vec4.x.x), "r"(shift)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.x.y) : "r"(vec4.x.y), "r"(vec4.x.y), "r"(shift)); + + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.y.x) : "r"(vec4.y.x), "r"(vec4.y.x), "r"(shift)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.y.y) : "r"(vec4.y.y), "r"(vec4.y.y), "r"(shift)); + + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.z.x) : "r"(vec4.z.x), "r"(vec4.z.x), "r"(shift)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.z.y) : "r"(vec4.z.y), "r"(vec4.z.y), "r"(shift)); + + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.w.x) : "r"(vec4.w.x), "r"(vec4.w.x), "r"(shift)); + asm("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.w.y) : "r"(vec4.w.y), "r"(vec4.w.y), "r"(shift)); + return ret; +} + +__device__ __forceinline__ +static uint4 rotate4R(uint4 vec4, uint32_t shift) +{ + uint4 ret; + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.x) : "r"(vec4.x), "r"(vec4.x), "r"(shift)); + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.y) : "r"(vec4.y), "r"(vec4.y), "r"(shift)); + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.z) : "r"(vec4.z), "r"(vec4.z), "r"(shift)); + asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(ret.w) : "r"(vec4.w), "r"(vec4.w), "r"(shift)); + return ret; +} + +#ifdef __CUDA_ARCH__ + +static __device__ __inline__ ulonglong4 __ldg4(const ulonglong4 *ptr) +{ + ulonglong4 ret; + asm("ld.global.nc.v2.u64 {%0,%1}, [%2];" : "=l"(ret.x), "=l"(ret.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+16];" : "=l"(ret.z), "=l"(ret.w) : __LDG_PTR(ptr)); + return ret; +} + +static __device__ __inline__ ulonglong2to8 __ldg4(const ulonglong2to8 *ptr) +{ + ulonglong2to8 ret; + asm("ld.global.nc.v2.u64 {%0,%1}, [%2];" : "=l"(ret.l0.x), "=l"(ret.l0.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+16];" : "=l"(ret.l1.x), "=l"(ret.l1.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+32];" : "=l"(ret.l2.x), "=l"(ret.l2.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+48];" : "=l"(ret.l3.x), "=l"(ret.l3.y) : __LDG_PTR(ptr)); + return ret; +} + +static __device__ __inline__ void ldg4(const ulonglong4 *ptr,ulonglong4 *ret) +{ + asm("ld.global.nc.v2.u64 {%0,%1}, [%2];" : "=l"(ret[0].x), "=l"(ret[0].y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+16];" : "=l"(ret[0].z), "=l"(ret[0].w) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+32];" : "=l"(ret[1].x), "=l"(ret[1].y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+48];" : "=l"(ret[1].z), "=l"(ret[1].w) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+64];" : "=l"(ret[2].x), "=l"(ret[2].y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v2.u64 {%0,%1}, [%2+80];" : "=l"(ret[2].z), "=l"(ret[2].w) : __LDG_PTR(ptr)); +} + +static __device__ __forceinline__ uint2x4 __ldg4(const uint2x4 *ptr) +{ + uint2x4 ret; + asm ("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4];" : "=r"(ret.x.x), "=r"(ret.x.y), "=r"(ret.y.x), "=r"(ret.y.y) : __LDG_PTR(ptr)); + asm ("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+16];" : "=r"(ret.z.x), "=r"(ret.z.y), "=r"(ret.w.x), "=r"(ret.w.y) : __LDG_PTR(ptr)); +// asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4];" : "=r"(ret.x.x), "=r"(ret.x.y), "=r"(ret.y.x), "=r"(ret.y.y) : __LDG_PTR(ptr)); +// asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+16];" : "=r"(ret.z.x), "=r"(ret.z.y), "=r"(ret.w.x), "=r"(ret.w.y) : __LDG_PTR(ptr)); + return ret; +} + +static __device__ __inline__ uint48 __ldg4(const uint48 *ptr) +{ + uint48 ret; + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4];" : "=r"(ret.s0.x), "=r"(ret.s0.y), "=r"(ret.s0.z), "=r"(ret.s0.w) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+16];" : "=r"(ret.s1.x), "=r"(ret.s1.y), "=r"(ret.s1.z), "=r"(ret.s1.w) : __LDG_PTR(ptr)); + return ret; +} + +static __device__ __inline__ void ldg4(const uint28 *ptr, uint28 *ret) +{ + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4];" : "=r"(ret[0].x.x), "=r"(ret[0].x.y), "=r"(ret[0].y.x), "=r"(ret[0].y.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+16];" : "=r"(ret[0].z.x), "=r"(ret[0].z.y), "=r"(ret[0].w.x), "=r"(ret[0].w.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+32];" : "=r"(ret[1].x.x), "=r"(ret[1].x.y), "=r"(ret[1].y.x), "=r"(ret[1].y.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+48];" : "=r"(ret[1].z.x), "=r"(ret[1].z.y), "=r"(ret[1].w.x), "=r"(ret[1].w.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+64];" : "=r"(ret[2].x.x), "=r"(ret[2].x.y), "=r"(ret[2].y.x), "=r"(ret[2].y.y) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+80];" : "=r"(ret[2].z.x), "=r"(ret[2].z.y), "=r"(ret[2].w.x), "=r"(ret[2].w.y) : __LDG_PTR(ptr)); +} + +#endif /* __CUDA_ARCH__ < 320 */ + + +static __forceinline__ __device__ uint8 swapvec(const uint8 &buf) +{ + uint8 vec; + vec.s0 = cuda_swab32(buf.s0); + vec.s1 = cuda_swab32(buf.s1); + vec.s2 = cuda_swab32(buf.s2); + vec.s3 = cuda_swab32(buf.s3); + vec.s4 = cuda_swab32(buf.s4); + vec.s5 = cuda_swab32(buf.s5); + vec.s6 = cuda_swab32(buf.s6); + vec.s7 = cuda_swab32(buf.s7); + return vec; +} + +static __forceinline__ __device__ uint8 swapvec(const uint8 *buf) +{ + uint8 vec; + vec.s0 = cuda_swab32(buf[0].s0); + vec.s1 = cuda_swab32(buf[0].s1); + vec.s2 = cuda_swab32(buf[0].s2); + vec.s3 = cuda_swab32(buf[0].s3); + vec.s4 = cuda_swab32(buf[0].s4); + vec.s5 = cuda_swab32(buf[0].s5); + vec.s6 = cuda_swab32(buf[0].s6); + vec.s7 = cuda_swab32(buf[0].s7); + return vec; +} + +static __forceinline__ __device__ uint16 swapvec(const uint16 *buf) +{ + uint16 vec; + vec.s0 = cuda_swab32(buf[0].s0); + vec.s1 = cuda_swab32(buf[0].s1); + vec.s2 = cuda_swab32(buf[0].s2); + vec.s3 = cuda_swab32(buf[0].s3); + vec.s4 = cuda_swab32(buf[0].s4); + vec.s5 = cuda_swab32(buf[0].s5); + vec.s6 = cuda_swab32(buf[0].s6); + vec.s7 = cuda_swab32(buf[0].s7); + vec.s8 = cuda_swab32(buf[0].s8); + vec.s9 = cuda_swab32(buf[0].s9); + vec.sa = cuda_swab32(buf[0].sa); + vec.sb = cuda_swab32(buf[0].sb); + vec.sc = cuda_swab32(buf[0].sc); + vec.sd = cuda_swab32(buf[0].sd); + vec.se = cuda_swab32(buf[0].se); + vec.sf = cuda_swab32(buf[0].sf); + return vec; +} + +static __forceinline__ __device__ uint28 swapvec(const uint28 &buf) +{ + uint28 vec; + vec.x.x = cuda_swab32(buf.x.x); + vec.x.y = cuda_swab32(buf.x.y); + vec.y.x = cuda_swab32(buf.y.x); + vec.y.y = cuda_swab32(buf.y.y); + vec.z.x = cuda_swab32(buf.z.x); + vec.z.y = cuda_swab32(buf.z.y); + vec.w.x = cuda_swab32(buf.w.x); + vec.w.y = cuda_swab32(buf.w.y); + return vec; +} + +static __forceinline__ __device__ uint16 swapvec(const uint16 &buf) +{ + uint16 vec; + vec.s0 = cuda_swab32(buf.s0); + vec.s1 = cuda_swab32(buf.s1); + vec.s2 = cuda_swab32(buf.s2); + vec.s3 = cuda_swab32(buf.s3); + vec.s4 = cuda_swab32(buf.s4); + vec.s5 = cuda_swab32(buf.s5); + vec.s6 = cuda_swab32(buf.s6); + vec.s7 = cuda_swab32(buf.s7); + vec.s8 = cuda_swab32(buf.s8); + vec.s9 = cuda_swab32(buf.s9); + vec.sa = cuda_swab32(buf.sa); + vec.sb = cuda_swab32(buf.sb); + vec.sc = cuda_swab32(buf.sc); + vec.sd = cuda_swab32(buf.sd); + vec.se = cuda_swab32(buf.se); + vec.sf = cuda_swab32(buf.sf); + return vec; +} + +static __device__ __forceinline__ uint28 shuffle4(const uint28 &var, int lane) +{ +#if __CUDA_ARCH__ >= 300 + uint28 res; + res.x.x = __shfl(var.x.x, lane); + res.x.y = __shfl(var.x.y, lane); + res.y.x = __shfl(var.y.x, lane); + res.y.y = __shfl(var.y.y, lane); + res.z.x = __shfl(var.z.x, lane); + res.z.y = __shfl(var.z.y, lane); + res.w.x = __shfl(var.w.x, lane); + res.w.y = __shfl(var.w.y, lane); + return res; +#else + return var; +#endif +} + +static __device__ __forceinline__ ulonglong4 shuffle4(ulonglong4 var, int lane) +{ +#if __CUDA_ARCH__ >= 300 + ulonglong4 res; + uint2 temp; + temp = vectorize(var.x); + temp.x = __shfl(temp.x, lane); + temp.y = __shfl(temp.y, lane); + res.x = devectorize(temp); + temp = vectorize(var.y); + temp.x = __shfl(temp.x, lane); + temp.y = __shfl(temp.y, lane); + res.y = devectorize(temp); + temp = vectorize(var.z); + temp.x = __shfl(temp.x, lane); + temp.y = __shfl(temp.y, lane); + res.z = devectorize(temp); + temp = vectorize(var.w); + temp.x = __shfl(temp.x, lane); + temp.y = __shfl(temp.y, lane); + res.w = devectorize(temp); + return res; +#else + return var; +#endif +} + +#endif // #ifndef CUDA_LYRA_VECTOR_H diff --git a/elist.h b/elist.h new file mode 100644 index 0000000..5dcdda5 --- /dev/null +++ b/elist.h @@ -0,0 +1,251 @@ +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static __inline void __list_add(struct list_head *lnew, + struct list_head *prev, + struct list_head *next) +{ + next->prev = lnew; + lnew->next = next; + lnew->prev = prev; + prev->next = lnew; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static __inline void list_add(struct list_head *lnew, struct list_head *head) +{ + __list_add(lnew, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static __inline void list_add_tail(struct list_head *lnew, struct list_head *head) +{ + __list_add(lnew, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static __inline void __list_del(struct list_head *prev, struct list_head *next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is in an undefined state. + */ +static __inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = (struct list_head *) 0; + entry->prev = (struct list_head *) 0; +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static __inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static __inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static __inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static __inline int list_empty(struct list_head *head) +{ + return head->next == head; +} + +static __inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static __inline void list_splice(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static __inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); \ + pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member, tpos) \ + for (pos = list_entry((head)->next, tpos, member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, tpos, member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member, tpos, tn) \ + for (pos = list_entry((head)->next, tpos, member), \ + n = list_entry(pos->member.next, tpos, member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, tn, member)) + +/** + * list_for_each_entry_continue - iterate over list of given type + * continuing after existing point + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_continue(pos, head, member, tpos) \ + for (pos = list_entry(pos->member.next, tpos, member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, tpos, member), \ + prefetch(pos->member.next)) + +#endif diff --git a/hashlog.cpp b/hashlog.cpp new file mode 100644 index 0000000..876ce3a --- /dev/null +++ b/hashlog.cpp @@ -0,0 +1,276 @@ +/** + * Hash log of submitted job nonces + * Prevent duplicate shares + * + * (to be merged later with stats) + * + * tpruvot@github 2014 + */ +#include +#include +#include + +#include "miner.h" + +#define HI_DWORD(u64) ((uint32_t) (u64 >> 32)) +#define LO_DWORD(u64) ((uint32_t) u64) +#define MK_HI64(u32) (0x100000000ULL * u32) + +/* from miner.h +struct hashlog_data { + uint8_t npool; + uint8_t pool_type; + uint32_t height; + uint32_t njobid; + uint32_t nonce; + uint32_t scanned_from; + uint32_t scanned_to; + uint32_t last_from; + uint32_t tm_add; + uint32_t tm_upd; + uint32_t tm_sent; +}; +*/ + +static std::map tlastshares; + +#define LOG_PURGE_TIMEOUT 5*60 + +/** + * str hex to uint32 + */ +static uint64_t hextouint(char* jobid) +{ + char *ptr; + /* dont use strtoull(), only since VS2013 */ + return (uint64_t) strtoul(jobid, &ptr, 16); +} + +/** + * @return time of a job/nonce submission (or last nonce if nonce is 0) + */ +uint32_t hashlog_already_submittted(char* jobid, uint32_t nonce) +{ + uint32_t ret = 0; + uint64_t njobid = hextouint(jobid); + uint64_t key = (njobid << 32) + nonce; + + if (nonce == 0) { + // search last submitted nonce for job + ret = hashlog_get_last_sent(jobid); + } else if (tlastshares.find(key) != tlastshares.end()) { + hashlog_data data = tlastshares[key]; + ret = data.tm_sent; + } + return ret; +} +/** + * Store submitted nonces of a job + */ +void hashlog_remember_submit(struct work* work, uint32_t nonce) +{ + uint64_t njobid = hextouint(work->job_id); + uint64_t key = (njobid << 32) + nonce; + hashlog_data data; + + memset(&data, 0, sizeof(data)); + data.scanned_from = work->scanned_from; + data.scanned_to = nonce; + data.height = work->height; + data.njobid = (uint32_t) njobid; + data.tm_add = data.tm_upd = data.tm_sent = (uint32_t) time(NULL); + data.npool = (uint8_t) cur_pooln; + data.pool_type = pools[cur_pooln].type; + tlastshares[key] = data; +} + +/** + * Update job scanned range + */ +void hashlog_remember_scan_range(struct work* work) +{ + uint64_t njobid = hextouint(work->job_id); + uint64_t key = (njobid << 32); + uint64_t range = hashlog_get_scan_range(work->job_id); + hashlog_data data; + + // global scan range of a job + data = tlastshares[key]; + if (range == 0) { + memset(&data, 0, sizeof(data)); + data.njobid = (uint32_t) njobid; + } else { + // get min and max from all sent records + data.scanned_from = LO_DWORD(range); + data.scanned_to = HI_DWORD(range); + } + + if (data.tm_add == 0) + data.tm_add = (uint32_t) time(NULL); + + data.last_from = work->scanned_from; + + if (work->scanned_from < work->scanned_to) { + if (data.scanned_to == 0 || work->scanned_from == data.scanned_to + 1) + data.scanned_to = work->scanned_to; + if (data.scanned_from == 0) + data.scanned_from = work->scanned_from ? work->scanned_from : 1; // min 1 + else if (work->scanned_from < data.scanned_from || work->scanned_to == (data.scanned_from - 1)) + data.scanned_from = work->scanned_from; + } + + data.tm_upd = (uint32_t) time(NULL); + + tlastshares[key] = data; +/* applog(LOG_BLUE, "job %s range : %x %x -> %x %x", jobid, + scanned_from, scanned_to, data.scanned_from, data.scanned_to); */ +} + +/** + * Returns the range of a job + * @return uint64_t to|from + */ +uint64_t hashlog_get_scan_range(char* jobid) +{ + uint64_t ret = 0; + uint64_t njobid = hextouint(jobid); + uint64_t keypfx = (njobid << 32); + uint64_t keymsk = (0xffffffffULL << 32); + hashlog_data data; + + data.scanned_from = 0; + data.scanned_to = 0; + std::map::iterator i = tlastshares.begin(); + while (i != tlastshares.end()) { + if ((keymsk & i->first) == keypfx && i->second.scanned_to > ret) { + if (i->second.scanned_to > data.scanned_to) + data.scanned_to = i->second.scanned_to; + if (i->second.scanned_from < data.scanned_from || data.scanned_from == 0) + data.scanned_from = i->second.scanned_from; + } + i++; + } + ret = data.scanned_from; + ret += MK_HI64(data.scanned_to); + return ret; +} + +/** + * Search last submitted nonce for a job + * @return max nonce + */ +uint32_t hashlog_get_last_sent(char* jobid) +{ + uint32_t nonce = 0; + uint64_t njobid = hextouint(jobid); + uint64_t keypfx = (njobid << 32); + std::map::iterator i = tlastshares.begin(); + while (i != tlastshares.end()) { + if ((keypfx & i->first) == keypfx && i->second.tm_sent > 0) { + nonce = LO_DWORD(i->first); + } + i++; + } + return nonce; +} + +/** + * Export data for api calls + */ +int hashlog_get_history(struct hashlog_data *data, int max_records) +{ + int records = 0; + + std::map::reverse_iterator it = tlastshares.rbegin(); + while (it != tlastshares.rend() && records < max_records) { + memcpy(&data[records], &(it->second), sizeof(struct hashlog_data)); + data[records].nonce = LO_DWORD(it->first); + data[records].njobid = (uint32_t) HI_DWORD(it->first); + records++; + ++it; + } + return records; +} + +/** + * Remove entries of a job... + */ +void hashlog_purge_job(char* jobid) +{ + int deleted = 0; + uint64_t njobid = hextouint(jobid); + uint64_t keypfx = (njobid << 32); + uint32_t sz = (uint32_t) tlastshares.size(); + std::map::iterator i = tlastshares.begin(); + while (i != tlastshares.end()) { + if ((keypfx & i->first) == keypfx) { + deleted++; + tlastshares.erase(i++); + } + else ++i; + } + if (opt_debug && deleted) { + applog(LOG_DEBUG, "hashlog: purge job %s, del %d/%d", jobid, deleted, sz); + } +} + +/** + * Remove old entries to reduce memory usage + */ +void hashlog_purge_old(void) +{ + int deleted = 0; + uint32_t now = (uint32_t) time(NULL); + uint32_t sz = (uint32_t) tlastshares.size(); + std::map::iterator i = tlastshares.begin(); + while (i != tlastshares.end()) { + if ((now - i->second.tm_sent) > LOG_PURGE_TIMEOUT) { + deleted++; + tlastshares.erase(i++); + } + else ++i; + } + if (opt_debug && deleted) { + applog(LOG_DEBUG, "hashlog: %d/%d purged", deleted, sz); + } +} + +/** + * Reset the submitted nonces cache + */ +void hashlog_purge_all(void) +{ + tlastshares.clear(); +} + +/** + * API meminfo + */ +void hashlog_getmeminfo(uint64_t *mem, uint32_t *records) +{ + (*records) = (uint32_t) tlastshares.size(); + (*mem) = (*records) * sizeof(hashlog_data); +} + +/** + * Used to debug ranges... + */ +void hashlog_dump_job(char* jobid) +{ + if (opt_debug) { + uint64_t njobid = hextouint(jobid); + uint64_t keypfx = (njobid << 32); + // uint32_t sz = tlastshares.size(); + std::map::iterator i = tlastshares.begin(); + while (i != tlastshares.end()) { + if ((keypfx & i->first) == keypfx) { + if (i->first != keypfx) + applog(LOG_DEBUG, CL_YLW "job %s, found %08x ", jobid, LO_DWORD(i->first)); + else + applog(LOG_DEBUG, CL_YLW "job %s(%u) range done: %08x-%08x", jobid, + i->second.height, i->second.scanned_from, i->second.scanned_to); + } + i++; + } + } +} diff --git a/lbry/cuda_lbry_merged.cu b/lbry/cuda_lbry_merged.cu new file mode 100644 index 0000000..5c7fe3a --- /dev/null +++ b/lbry/cuda_lbry_merged.cu @@ -0,0 +1,884 @@ +/* + * LBRY merged kernel CUDA implementation. + * For compute 5.2 and beyond gpus + * Developed under CUDA7.5 + * Sponsored by LBRY.IO team + * tpruvot and Provos Alexis - SEP 2016 + * + * RIPEMD-160 implementation inherited from + * https://github.com/sipa/Coin25519/blob/master/src/crypto/ripemd160.c + * Written in 2008 by Dwayne C. Litzenberger + */ + +#include +#include +#include + +#include +#include + +#include + +__constant__ static uint32_t _ALIGN(16) c_midstate112[8]; +__constant__ static uint32_t _ALIGN(16) c_midbuffer112[8]; +__constant__ static uint32_t _ALIGN(16) c_dataEnd112[12]; + +__constant__ static const uint32_t _ALIGN(8) c_K[64] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +}; + +#ifdef __INTELLISENSE__ +#define atomicExch(p,y) y +#endif + +// ------------------------------------------------------------------------------------------------ + +static const uint32_t cpu_H256[8] = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 +}; + +static const uint32_t cpu_K[64] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +}; + +__host__ +static void sha256_step1_host(uint32_t a, uint32_t b, uint32_t c, uint32_t &d, uint32_t e, uint32_t f, uint32_t g, uint32_t &h, uint32_t in, const uint32_t Kshared){ + + uint32_t vxandx = (((f) ^ (g)) & (e)) ^ (g); // xandx(e, f, g); + uint32_t bsg21 = ROTR32(e, 6) ^ ROTR32(e, 11) ^ ROTR32(e, 25); // bsg2_1(e); + uint32_t bsg20 = ROTR32(a, 2) ^ ROTR32(a, 13) ^ ROTR32(a, 22); //bsg2_0(a); + uint32_t andorv = ((b) & (c)) | (((b) | (c)) & (a)); //andor32(a,b,c); + uint32_t t1 = h + bsg21 + vxandx + Kshared + in; + uint32_t t2 = bsg20 + andorv; + d = d + t1; + h = t1 + t2; +} + +__host__ +static void sha256_step2_host(uint32_t a, uint32_t b, uint32_t c, uint32_t &d, uint32_t e, uint32_t f, uint32_t g, uint32_t &h, uint32_t* in, uint32_t pc, const uint32_t Kshared){ + + uint32_t pcidx1 = (pc-2) & 0xF; + uint32_t pcidx2 = (pc-7) & 0xF; + uint32_t pcidx3 = (pc-15) & 0xF; + + uint32_t inx0 = in[pc]; + uint32_t inx1 = in[pcidx1]; + uint32_t inx2 = in[pcidx2]; + uint32_t inx3 = in[pcidx3]; + + uint32_t ssg21 = ROTR32(inx1, 17) ^ ROTR32(inx1, 19) ^ SPH_T32((inx1) >> 10); //ssg2_1(inx1); + uint32_t ssg20 = ROTR32(inx3, 7) ^ ROTR32(inx3, 18) ^ SPH_T32((inx3) >> 3); //ssg2_0(inx3); + uint32_t vxandx = (((f) ^ (g)) & (e)) ^ (g); // xandx(e, f, g); + uint32_t bsg21 = ROTR32(e, 6) ^ ROTR32(e, 11) ^ ROTR32(e, 25); // bsg2_1(e); + uint32_t bsg20 = ROTR32(a, 2) ^ ROTR32(a, 13) ^ ROTR32(a, 22); //bsg2_0(a); + uint32_t andorv = ((b) & (c)) | (((b) | (c)) & (a)); //andor32(a,b,c); + uint32_t t1,t2; + + in[pc] = ssg21 + inx2 + ssg20 + inx0; + + t1 = h + bsg21 + vxandx + Kshared + in[pc]; + t2 = bsg20 + andorv; + d = d + t1; + h = t1 + t2; +} + +__host__ +static void sha256_round_body_host(uint32_t* in, uint32_t* state, const uint32_t* Kshared){ + + uint32_t a = state[0]; + uint32_t b = state[1]; + uint32_t c = state[2]; + uint32_t d = state[3]; + uint32_t e = state[4]; + uint32_t f = state[5]; + uint32_t g = state[6]; + uint32_t h = state[7]; + + sha256_step1_host(a,b,c,d,e,f,g,h,in[0], Kshared[0]); + sha256_step1_host(h,a,b,c,d,e,f,g,in[1], Kshared[1]); + sha256_step1_host(g,h,a,b,c,d,e,f,in[2], Kshared[2]); + sha256_step1_host(f,g,h,a,b,c,d,e,in[3], Kshared[3]); + sha256_step1_host(e,f,g,h,a,b,c,d,in[4], Kshared[4]); + sha256_step1_host(d,e,f,g,h,a,b,c,in[5], Kshared[5]); + sha256_step1_host(c,d,e,f,g,h,a,b,in[6], Kshared[6]); + sha256_step1_host(b,c,d,e,f,g,h,a,in[7], Kshared[7]); + sha256_step1_host(a,b,c,d,e,f,g,h,in[8], Kshared[8]); + sha256_step1_host(h,a,b,c,d,e,f,g,in[9], Kshared[9]); + sha256_step1_host(g,h,a,b,c,d,e,f,in[10],Kshared[10]); + sha256_step1_host(f,g,h,a,b,c,d,e,in[11],Kshared[11]); + sha256_step1_host(e,f,g,h,a,b,c,d,in[12],Kshared[12]); + sha256_step1_host(d,e,f,g,h,a,b,c,in[13],Kshared[13]); + sha256_step1_host(c,d,e,f,g,h,a,b,in[14],Kshared[14]); + sha256_step1_host(b,c,d,e,f,g,h,a,in[15],Kshared[15]); + + for (uint32_t i=0; i<3; i++) + { + sha256_step2_host(a,b,c,d,e,f,g,h,in,0, Kshared[16+16*i]); + sha256_step2_host(h,a,b,c,d,e,f,g,in,1, Kshared[17+16*i]); + sha256_step2_host(g,h,a,b,c,d,e,f,in,2, Kshared[18+16*i]); + sha256_step2_host(f,g,h,a,b,c,d,e,in,3, Kshared[19+16*i]); + sha256_step2_host(e,f,g,h,a,b,c,d,in,4, Kshared[20+16*i]); + sha256_step2_host(d,e,f,g,h,a,b,c,in,5, Kshared[21+16*i]); + sha256_step2_host(c,d,e,f,g,h,a,b,in,6, Kshared[22+16*i]); + sha256_step2_host(b,c,d,e,f,g,h,a,in,7, Kshared[23+16*i]); + sha256_step2_host(a,b,c,d,e,f,g,h,in,8, Kshared[24+16*i]); + sha256_step2_host(h,a,b,c,d,e,f,g,in,9, Kshared[25+16*i]); + sha256_step2_host(g,h,a,b,c,d,e,f,in,10,Kshared[26+16*i]); + sha256_step2_host(f,g,h,a,b,c,d,e,in,11,Kshared[27+16*i]); + sha256_step2_host(e,f,g,h,a,b,c,d,in,12,Kshared[28+16*i]); + sha256_step2_host(d,e,f,g,h,a,b,c,in,13,Kshared[29+16*i]); + sha256_step2_host(c,d,e,f,g,h,a,b,in,14,Kshared[30+16*i]); + sha256_step2_host(b,c,d,e,f,g,h,a,in,15,Kshared[31+16*i]); + } + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; +} + +__host__ +void lbry_sha256_setBlock_112_merged(uint32_t *pdata){ + + uint32_t in[16], buf[8], end[16]; + for (uint32_t i=0;i<16;i++) in[i] = cuda_swab32(pdata[i]); + for (uint32_t i=0; i<8;i++) buf[i] = cpu_H256[i]; + for (uint32_t i=0;i<11;i++) end[i] = cuda_swab32(pdata[16+i]); + sha256_round_body_host(in, buf, cpu_K); + + cudaMemcpyToSymbol(c_midstate112, buf, 32, 0, cudaMemcpyHostToDevice); + + uint32_t a = buf[0]; + uint32_t b = buf[1]; + uint32_t c = buf[2]; + uint32_t d = buf[3]; + uint32_t e = buf[4]; + uint32_t f = buf[5]; + uint32_t g = buf[6]; + uint32_t h = buf[7]; + + sha256_step1_host(a,b,c,d,e,f,g,h,end[0], cpu_K[0]); + sha256_step1_host(h,a,b,c,d,e,f,g,end[1], cpu_K[1]); + sha256_step1_host(g,h,a,b,c,d,e,f,end[2], cpu_K[2]); + sha256_step1_host(f,g,h,a,b,c,d,e,end[3], cpu_K[3]); + sha256_step1_host(e,f,g,h,a,b,c,d,end[4], cpu_K[4]); + sha256_step1_host(d,e,f,g,h,a,b,c,end[5], cpu_K[5]); + sha256_step1_host(c,d,e,f,g,h,a,b,end[6], cpu_K[6]); + sha256_step1_host(b,c,d,e,f,g,h,a,end[7], cpu_K[7]); + sha256_step1_host(a,b,c,d,e,f,g,h,end[8], cpu_K[8]); + sha256_step1_host(h,a,b,c,d,e,f,g,end[9], cpu_K[9]); + sha256_step1_host(g,h,a,b,c,d,e,f,end[10],cpu_K[10]); + sha256_step1_host(f, g, h, a, b, c, d, e, 0, cpu_K[11]); + + buf[0] = a; + buf[1] = b; + buf[2] = c; + buf[3] = d; + buf[4] = e; + buf[5] = f; + buf[6] = g; + buf[7] = h; + + cudaMemcpyToSymbol(c_midbuffer112, buf, 32, 0, cudaMemcpyHostToDevice); + + end[12] = 0x80000000; + end[13] = 0; + end[14] = 0; + end[15] = 0x380; + uint32_t x2_0,x2_1; + + x2_0 = ROTR32(end[1], 7) ^ ROTR32(end[1], 18) ^ SPH_T32(end[1] >> 3); //ssg2_0(inx3);//ssg2_0(end[1]); +// x2_1 = ROTR32(end[14], 17) ^ ROTR32(end[14], 19) ^ SPH_T32(end[14] >> 10) + x2_0; //ssg2_1(inx1); ssg2_1(end[14]) + x2_0; + end[0] = end[0] + end[9] + x2_0; + + x2_0 = ROTR32(end[2], 7) ^ ROTR32(end[2], 18) ^ SPH_T32(end[2] >> 3); + x2_1 = (ROTR32(end[15], 17) ^ ROTR32(end[15], 19) ^ SPH_T32(end[15] >> 10)) + x2_0; + end[1] = end[1] + end[10] + x2_1; + + x2_0 = ROTR32(end[3], 7) ^ ROTR32(end[3], 18) ^ SPH_T32(end[3] >> 3);//ssg2_0(end[3]); + x2_1 = (ROTR32(end[0], 17) ^ ROTR32(end[0], 19) ^ SPH_T32(end[0] >> 10)) + x2_0; + end[2]+= x2_1; + + x2_0 = ROTR32(end[4], 7) ^ ROTR32(end[4], 18) ^ SPH_T32(end[4] >> 3);//ssg2_0(end[4]); + x2_1 = (ROTR32(end[1], 17) ^ ROTR32(end[1], 19) ^ SPH_T32(end[1] >> 10)) + x2_0; + end[3] = end[3] + end[12] + x2_1; + + x2_0 = ROTR32(end[5], 7) ^ ROTR32(end[5], 18) ^ SPH_T32(end[5] >> 3);//ssg2_0(end[4]); + end[4] = end[4] + end[13] + x2_0; + + x2_0 = ROTR32(end[6], 7) ^ ROTR32(end[6], 18) ^ SPH_T32(end[6] >> 3);//ssg2_0(end[6]); + x2_1 = (ROTR32(end[3], 17) ^ ROTR32(end[3], 19) ^ SPH_T32(end[3] >> 10)) + x2_0; + end[5] = end[5] + end[14] + x2_1; + + x2_0 = ROTR32(end[7], 7) ^ ROTR32(end[7], 18) ^ SPH_T32(end[7] >> 3);//ssg2_0(end[7]); + end[6] = end[6] + end[15] + x2_0; + + x2_0 = ROTR32(end[8], 7) ^ ROTR32(end[8], 18) ^ SPH_T32(end[8] >> 3);//ssg2_0(end[8]); + x2_1 = (ROTR32(end[5], 17) ^ ROTR32(end[5], 19) ^ SPH_T32(end[5] >> 10)) + x2_0; + end[7] = end[7] + end[0] + x2_1; + + x2_0 = ROTR32(end[9], 7) ^ ROTR32(end[9], 18) ^ SPH_T32(end[9] >> 3);//ssg2_0(end[9]); + end[8] = end[8] + end[1] + x2_0; + + x2_0 = ROTR32(end[10], 7) ^ ROTR32(end[10], 18) ^ SPH_T32(end[10] >> 3);//ssg2_0(end[10]); + x2_1 = (ROTR32(end[7], 17) ^ ROTR32(end[7], 19) ^ SPH_T32(end[7] >> 10)) + x2_0; + end[9] = end[9] + x2_1; + + cudaMemcpyToSymbol(c_dataEnd112, end, sizeof(end), 0, cudaMemcpyHostToDevice); +} + +//END OF HOST FUNCTIONS ------------------------------------------------------------------- + +//SHA256 MACROS --------------------------------------------------------------------------- + +#define xor3b(a,b,c) (a ^ b ^ c) + +__device__ __forceinline__ uint32_t bsg2_0(const uint32_t x) +{ + return xor3b(ROTR32(x,2),ROTR32(x,13),ROTR32(x,22)); +} + +__device__ __forceinline__ uint32_t bsg2_1(const uint32_t x) +{ + return xor3b(ROTR32(x,6),ROTR32(x,11),ROTR32(x,25)); +} + +__device__ __forceinline__ uint32_t ssg2_0(const uint32_t x){ + return xor3b(ROTR32(x,7),ROTR32(x,18),(x>>3)); +} + +__device__ __forceinline__ uint32_t ssg2_1(const uint32_t x){ + return xor3b(ROTR32(x,17),ROTR32(x,19),(x>>10)); +} + +__device__ __forceinline__ uint32_t ssg2_11(const uint32_t x){ + return xor3b(ROTR32(x,17),ROTR32(x,19),shr_u32(x,10)); +} + +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define Ch(a, b, c) (((b^c) & a) ^ c) + +__device__ __forceinline__ uint64_t vectorizeswap(const uint64_t v){ + uint2 result; + asm volatile ("mov.b64 {%0,%1},%2;" : "=r"(result.y), "=r"(result.x) : "l"(v)); + return devectorize(result); +} + +__device__ __forceinline__ +static void sha2_step(const uint32_t a,const uint32_t b,const uint32_t c, uint32_t &d,const uint32_t e,const uint32_t f,const uint32_t g, uint32_t &h,const uint32_t in, const uint32_t Kshared) +{ + uint32_t bsg2_1 = ROTR32(e,6) ^ ROTR32(e,11) ^ ROTR32(e,25); + uint32_t bsg2_0 = ROTR32(a,2) ^ ROTR32(a,13) ^ ROTR32(a,22); + + uint32_t Ch = ((f ^ g) & e) ^ g; + uint32_t Maj= (b & c) | ((b | c) & a); + + const uint32_t t1 = h + bsg2_1 + Ch + Kshared + in; + h = t1 + Maj + bsg2_0; + d+= t1; + +} + +__device__ __forceinline__ +static void sha256_round_first(uint32_t *in,uint32_t *buf,const uint32_t *state) +{ + uint32_t a = buf[0] + in[11]; + uint32_t b = buf[1]; + uint32_t c = buf[2]; + uint32_t d = buf[3]; + uint32_t e = buf[4] + in[11]; + uint32_t f = buf[5]; + uint32_t g = buf[6]; + uint32_t h = buf[7]; + + // 10 first steps made on host + //sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[11]); + + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[12]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[13]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[14]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[15]); + + //in is partially precomputed on host + in[2]+= in[11]; + in[4]+= ssg2_11(in[2]); + in[6]+= ssg2_11(in[4]); + in[8]+= ssg2_11(in[6]); + in[9]+= in[ 2]; + + sha2_step(a,b,c,d,e,f,g,h,in[0], c_K[16]); + sha2_step(h,a,b,c,d,e,f,g,in[1], c_K[17]); + sha2_step(g,h,a,b,c,d,e,f,in[2], c_K[18]); + sha2_step(f,g,h,a,b,c,d,e,in[3], c_K[19]); + sha2_step(e,f,g,h,a,b,c,d,in[4], c_K[20]); + sha2_step(d,e,f,g,h,a,b,c,in[5], c_K[21]); + sha2_step(c,d,e,f,g,h,a,b,in[6], c_K[22]); + sha2_step(b,c,d,e,f,g,h,a,in[7], c_K[23]); + sha2_step(a,b,c,d,e,f,g,h,in[8], c_K[24]); + sha2_step(h,a,b,c,d,e,f,g,in[9], c_K[25]); + + #pragma unroll 6 + for (uint32_t j = 10; j < 16; j++){ + in[j]+= ssg2_11(in[(j + 14) & 15]) + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]); + } + + sha2_step(g,h,a,b,c,d,e,f,in[10],c_K[26]); + sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[27]); + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[28]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[29]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[30]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[31]); + + #pragma unroll 16 + for (uint32_t j = 0; j < 16; j++){ + in[j]+= ssg2_11(in[(j + 14) & 15]) + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]); + } + + sha2_step(a,b,c,d,e,f,g,h,in[0], c_K[16+16]); + sha2_step(h,a,b,c,d,e,f,g,in[1], c_K[17+16]); + sha2_step(g,h,a,b,c,d,e,f,in[2], c_K[18+16]); + sha2_step(f,g,h,a,b,c,d,e,in[3], c_K[19+16]); + sha2_step(e,f,g,h,a,b,c,d,in[4], c_K[20+16]); + sha2_step(d,e,f,g,h,a,b,c,in[5], c_K[21+16]); + sha2_step(c,d,e,f,g,h,a,b,in[6], c_K[22+16]); + sha2_step(b,c,d,e,f,g,h,a,in[7], c_K[23+16]); + sha2_step(a,b,c,d,e,f,g,h,in[8], c_K[24+16]); + sha2_step(h,a,b,c,d,e,f,g,in[9], c_K[25+16]); + sha2_step(g,h,a,b,c,d,e,f,in[10],c_K[26+16]); + sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[27+16]); + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[28+16]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[29+16]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[30+16]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[31+16]); + + #pragma unroll 16 + for (uint32_t j = 0; j < 16; j++){ + in[j]+= ssg2_11(in[(j + 14) & 15]) + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]); + } + + sha2_step(a,b,c,d,e,f,g,h,in[0], c_K[16+16*2]); + sha2_step(h,a,b,c,d,e,f,g,in[1], c_K[17+16*2]); + sha2_step(g,h,a,b,c,d,e,f,in[2], c_K[18+16*2]); + sha2_step(f,g,h,a,b,c,d,e,in[3], c_K[19+16*2]); + sha2_step(e,f,g,h,a,b,c,d,in[4], c_K[20+16*2]); + sha2_step(d,e,f,g,h,a,b,c,in[5], c_K[21+16*2]); + sha2_step(c,d,e,f,g,h,a,b,in[6], c_K[22+16*2]); + sha2_step(b,c,d,e,f,g,h,a,in[7], c_K[23+16*2]); + sha2_step(a,b,c,d,e,f,g,h,in[8], c_K[24+16*2]); + sha2_step(h,a,b,c,d,e,f,g,in[9], c_K[25+16*2]); + sha2_step(g,h,a,b,c,d,e,f,in[10],c_K[26+16*2]); + sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[27+16*2]); + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[28+16*2]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[29+16*2]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[30+16*2]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[31+16*2]); + + buf[ 0] = state[0] + a; + buf[ 1] = state[1] + b; + buf[ 2] = state[2] + c; + buf[ 3] = state[3] + d; + buf[ 4] = state[4] + e; + buf[ 5] = state[5] + f; + buf[ 6] = state[6] + g; + buf[ 7] = state[7] + h; +} + +//END OF SHA256 MACROS -------------------------------------------------------------------- + +//SHA512 MACROS --------------------------------------------------------------------------- +static __constant__ const uint64_t K_512[80] = { + 0x428A2F98D728AE22, 0x7137449123EF65CD, 0xB5C0FBCFEC4D3B2F, 0xE9B5DBA58189DBBC, 0x3956C25BF348B538, 0x59F111F1B605D019, 0x923F82A4AF194F9B, 0xAB1C5ED5DA6D8118, + 0xD807AA98A3030242, 0x12835B0145706FBE, 0x243185BE4EE4B28C, 0x550C7DC3D5FFB4E2, 0x72BE5D74F27B896F, 0x80DEB1FE3B1696B1, 0x9BDC06A725C71235, 0xC19BF174CF692694, + 0xE49B69C19EF14AD2, 0xEFBE4786384F25E3, 0x0FC19DC68B8CD5B5, 0x240CA1CC77AC9C65, 0x2DE92C6F592B0275, 0x4A7484AA6EA6E483, 0x5CB0A9DCBD41FBD4, 0x76F988DA831153B5, + 0x983E5152EE66DFAB, 0xA831C66D2DB43210, 0xB00327C898FB213F, 0xBF597FC7BEEF0EE4, 0xC6E00BF33DA88FC2, 0xD5A79147930AA725, 0x06CA6351E003826F, 0x142929670A0E6E70, + 0x27B70A8546D22FFC, 0x2E1B21385C26C926, 0x4D2C6DFC5AC42AED, 0x53380D139D95B3DF, 0x650A73548BAF63DE, 0x766A0ABB3C77B2A8, 0x81C2C92E47EDAEE6, 0x92722C851482353B, + 0xA2BFE8A14CF10364, 0xA81A664BBC423001, 0xC24B8B70D0F89791, 0xC76C51A30654BE30, 0xD192E819D6EF5218, 0xD69906245565A910, 0xF40E35855771202A, 0x106AA07032BBD1B8, + 0x19A4C116B8D2D0C8, 0x1E376C085141AB53, 0x2748774CDF8EEB99, 0x34B0BCB5E19B48A8, 0x391C0CB3C5C95A63, 0x4ED8AA4AE3418ACB, 0x5B9CCA4F7763E373, 0x682E6FF3D6B2B8A3, + 0x748F82EE5DEFB2FC, 0x78A5636F43172F60, 0x84C87814A1F0AB72, 0x8CC702081A6439EC, 0x90BEFFFA23631E28, 0xA4506CEBDE82BDE9, 0xBEF9A3F7B2C67915, 0xC67178F2E372532B, + 0xCA273ECEEA26619C, 0xD186B8C721C0C207, 0xEADA7DD6CDE0EB1E, 0xF57D4F7FEE6ED178, 0x06F067AA72176FBA, 0x0A637DC5A2C898A6, 0x113F9804BEF90DAE, 0x1B710B35131C471B, + 0x28DB77F523047D84, 0x32CAAB7B40C72493, 0x3C9EBE0A15C9BEBC, 0x431D67C49C100D4C, 0x4CC5D4BECB3E42B6, 0x597F299CFC657E2A, 0x5FCB6FAB3AD6FAEC, 0x6C44198C4A475817 +}; + +#define bsg5_0(x) (ROTR64(x,28) ^ ROTR64(x,34) ^ ROTR64(x,39)) +#define bsg5_1(x) (ROTR64(x,14) ^ ROTR64(x,18) ^ ROTR64(x,41)) +#define ssg5_0(x) (ROTR64(x, 1) ^ ROTR64(x, 8) ^ shr_u64(x,7)) +#define ssg5_1(x) (ROTR64(x,19) ^ ROTR64(x,61) ^ shr_u64(x,6)) + + +#define andor64(a,b,c) ((a & (b | c)) | (b & c)) +#define xandx64(e,f,g) (g ^ (e & (g ^ f))) + +// RIPEMD MACROS----------------------------------------------------------------------------- + +/* + * Round constants for RIPEMD-160. + */ +static __constant__ const uint32_t c_IV[5] = {0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0}; +static __constant__ const uint32_t KL[5] = {0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E}; +static __constant__ const uint32_t KR[5] = {0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000}; + +/* Left line */ +static __constant__ const uint32_t RL[5][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* Round 1: id */ + { 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8 }, /* Round 2: rho */ + { 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12 }, /* Round 3: rho^2 */ + { 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2 }, /* Round 4: rho^3 */ + { 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 } /* Round 5: rho^4 */ +}; + +/* Right line */ +static __constant__ const uint32_t RR[5][16] = { + { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12 }, /* Round 1: pi */ + { 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2 }, /* Round 2: rho pi */ + { 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13 }, /* Round 3: rho^2 pi */ + { 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14 }, /* Round 4: rho^3 pi */ + { 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 } /* Round 5: rho^4 pi */ +}; + +/* Shifts, left line */ +static __constant__ const uint32_t SL[5][16] = { + { 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8 }, /* Round 1 */ + { 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12 }, /* Round 2 */ + { 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5 }, /* Round 3 */ + { 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12 }, /* Round 4 */ + { 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 } /* Round 5 */ +}; + +/* Shifts, right line */ +static __constant__ const uint32_t SR[5][16] = { + { 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6 }, /* Round 1 */ + { 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11 }, /* Round 2 */ + { 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5 }, /* Round 3 */ + { 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8 }, /* Round 4 */ + { 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 } /* Round 5 */ +}; + +__device__ __forceinline__ +static uint32_t ROTATE(const uint32_t x,const uint32_t r){ + if(r==8) + return __byte_perm(x, 0, 0x2103); + else + return ROTL32(x,r); +} + +/* + * Round functions for RIPEMD-160. + */ +//#define F1(x, y, z) xor3x(x, y, z) +__device__ __forceinline__ +uint32_t F1(const uint32_t a,const uint32_t b,const uint32_t c){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x96;" : "=r"(result) : "r"(a), "r"(b),"r"(c)); + #else + result = a^b^c; + #endif + return result; +} + + +//#define F2(x, y, z) ((x & (y ^ z)) ^ z) +__device__ __forceinline__ +uint32_t F2(const uint32_t a,const uint32_t b,const uint32_t c){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0xCA;" : "=r"(result) : "r"(a), "r"(b),"r"(c)); //0xCA=((F0∧(CC⊻AA))⊻AA) + #else + result = ((a & (b ^ c)) ^ c); + #endif + return result; +} + +//#define F3(x, y, z) ((x | ~y) ^ z) +__device__ __forceinline__ +uint32_t F3(const uint32_t x,const uint32_t y,const uint32_t z){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x59;" : "=r"(result) : "r"(x), "r"(y),"r"(z)); //0x59=((F0∨(¬CC))⊻AA) + #else + result = ((x | ~y) ^ z); + #endif + return result; +} +//#define F4(x, y, z) (y ^ ((x ^ y) & z)) +__device__ __forceinline__ +uint32_t F4(const uint32_t x,const uint32_t y,const uint32_t z){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0xE4;" : "=r"(result) : "r"(x), "r"(y),"r"(z)); //0xE4=(CC⊻((F0⊻CC)∧AA)) + #else + result = (y ^ ((x ^ y) & z)); + #endif + return result; +} + +//#define F5(x, y, z) (x ^ (y | ~z)) +__device__ __forceinline__ +uint32_t F5(const uint32_t x,const uint32_t y,const uint32_t z){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x2D;" : "=r"(result) : "r"(x), "r"(y),"r"(z)); //0x2D=(F0⊻(CC∨(¬AA))) + #else + result = (x ^ (y | ~z)); + #endif + return result; +} + +__device__ __forceinline__ +static void RIPEMD160_ROUND_BODY(const uint32_t *in, uint32_t *h){ + uint32_t T; + uint32_t AL, BL, CL, DL, EL; /* left line */ + uint32_t AR, BR, CR, DR, ER; /* right line */ + + AL = AR = h[0]; + BL = BR = h[1]; + CL = CR = h[2]; + DL = DR = h[3]; + EL = ER = h[4]; + + /* Round 1 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F1(BL, CL, DL) + in[RL[0][w]] + KL[0], SL[0][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F5(BR, CR, DR) + in[RR[0][w]] + KR[0], SR[0][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + /* Round 2 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F2(BL, CL, DL) + in[RL[1][w]] + KL[1], SL[1][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F4(BR, CR, DR) + in[RR[1][w]] + KR[1], SR[1][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + /* Round 3 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F3(BL, CL, DL) + in[RL[2][w]] + KL[2], SL[2][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F3(BR, CR, DR) + in[RR[2][w]] + KR[2], SR[2][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + /* Round 4 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F4(BL, CL, DL) + in[RL[3][w]] + KL[3], SL[3][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F2(BR, CR, DR) + in[RR[3][w]] + KR[3], SR[3][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + /* Round 5 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F5(BL, CL, DL) + in[RL[4][w]] + KL[4], SL[4][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F1(BR, CR, DR) + in[RR[4][w]] + KR[4], SR[4][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + T = h[1] + CL + DR; + h[1] = h[2] + DL + ER; + h[2] = h[3] + EL + AR; + h[3] = h[4] + AL + BR; + h[4] = h[0] + BL + CR; + h[0] = T; +} +// END OF RIPEMD MACROS---------------------------------------------------------------------- + +#define NPT 4 + +__global__ __launch_bounds__(768,1) +void gpu_lbry_merged(const uint32_t threads,const uint32_t startNounce, uint32_t *resNonces,const uint64_t target64){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint32_t buf[8], state[8]; + + const uint32_t c_H256[8] = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 + }; + const uint64_t IV512[8] = { + 0x6A09E667F3BCC908, 0xBB67AE8584CAA73B, 0x3C6EF372FE94F82B, 0xA54FF53A5F1D36F1, + 0x510E527FADE682D1, 0x9B05688C2B3E6C1F, 0x1F83D9ABFB41BD6B, 0x5BE0CD19137E2179 + }; + uint64_t r[8]; + uint64_t W[16]; + + uint32_t dat[16]; + uint32_t h[5]; + + const uint64_t step = gridDim.x * blockDim.x; + const uint64_t maxNonce = startNounce + threads; + for(uint64_t nounce = startNounce + thread; nounce= 0; l--) buf[l + 1] = buf[l]; + buf[0] = t1 + Maj(buf[1], buf[2], buf[3]) + bsg2_0(buf[1]); + buf[4]+= t1; + } + + #pragma unroll + for (int i = 16; i < 64; i++) { + dat[i & 15]+= ssg2_1(dat[(i - 2) & 15]) + dat[(i - 7) & 15] + ssg2_0(dat[(i - 15) & 15]); + + const uint32_t t1 = dat[i & 15] + buf[7] + bsg2_1(buf[4]) + Ch(buf[4], buf[5], buf[6]) + c_K[i]; + #pragma unroll 7 + for (int l = 6; l >= 0; l--) buf[l + 1] = buf[l]; + buf[0] = t1 + Maj(buf[1], buf[2], buf[3]) + bsg2_0(buf[1]); + buf[4]+= t1; + } + + #pragma unroll 8 + for(uint32_t i=0;i<8;i++) + buf[ i] += c_H256[ i]; + +//SHA512------------------------------------------------------------------------------------- + #pragma unroll 8 + for(uint32_t i=0;i<8;i++) + r[ i] = IV512[ i]; + + W[0] = vectorizeswap(((uint64_t*)buf)[0]); + W[1] = vectorizeswap(((uint64_t*)buf)[1]); + W[2] = vectorizeswap(((uint64_t*)buf)[2]); + W[3] = vectorizeswap(((uint64_t*)buf)[3]); + W[4] = 0x8000000000000000; // end tag + + #pragma unroll 10 + for (int i = 5; i < 15; i++) + W[i] = 0; + + W[15] = 0x100; // 256 bits + + uint64_t t1; + #pragma unroll 16 + for (int i = 0; i < 16; i++) { + t1 = W[i] + r[ 7] + bsg5_1(r[ 4]) + xandx64(r[ 4], r[ 5], r[ 6]) + K_512[i]; + #pragma unroll + for (int l = 6; l >= 0; l--) r[l + 1] = r[l]; + r[0] = t1 + andor64(r[ 1], r[ 2], r[ 3]) + bsg5_0(r[ 1]); + r[4]+= t1; + } + + #pragma unroll + for (int i = 16; i < 80; i+=16) { + #pragma unroll + for(uint32_t j=0;j<16;j++){ + W[j] = ssg5_1(W[(j + 14) & 15]) + ssg5_0(W[(j + 1) & 15]) + W[j] + W[(j + 9) & 15]; + } + + #pragma unroll + for(uint32_t j=0;j<16;j++){ + t1 = r[ 7] + W[j] + bsg5_1(r[ 4]) + xandx64(r[ 4], r[ 5], r[ 6]) + K_512[i+j]; +// t1 = r[ 7] + W[j] + K_512[i+j] + xandx64(r[ 4], r[ 5], r[ 6]) + bsg5_1(r[ 4]); + #pragma unroll + for (int l = 6; l >= 0; l--) r[l + 1] = r[l]; + r[0] = t1 + andor64(r[ 1], r[ 2], r[ 3]) + bsg5_0(r[ 1]); + r[4]+= t1; + } + + } +//END OF SHA512------------------------------------------------------------------------------ + *(uint2x4*)&dat[ 0] = *(uint2x4*)&r[ 0] + *(uint2x4*)&IV512[ 0]; + +// #pragma unroll 4 + for (int i = 0; i < 4; i++) + *(uint64_t*)&dat[i<<1] = cuda_swab64(*(uint64_t*)&dat[i<<1]); + + dat[8] = 0x80; + + #pragma unroll 7 + for (int i=9;i<16;i++) dat[i] = 0; + + dat[14] = 0x100; // size in bits + + #pragma unroll 5 + for (int i=0; i<5; i++) + h[i] = c_IV[i]; + + RIPEMD160_ROUND_BODY(dat, h); + + #pragma unroll 5 + for (int i=0; i<5; i++) + buf[i] = h[i]; + + // second 32 bytes block hash + *(uint2x4*)&dat[ 0] = *(uint2x4*)&r[ 4] + *(uint2x4*)&IV512[ 4]; + +// #pragma unroll 4 + for (int i = 0; i < 4; i++) + *(uint64_t*)&dat[i<<1] = cuda_swab64(*(uint64_t*)&dat[i<<1]); + + dat[8] = 0x80; + + #pragma unroll 7 + for (int i=9;i<16;i++) dat[i] = 0; + + dat[14] = 0x100; // size in bits + + #pragma unroll 5 + for (int i=0; i<5; i++) + h[i] = c_IV[i]; + + RIPEMD160_ROUND_BODY(dat, h); + + // first final sha256 + + #pragma unroll 5 + for (int i=0;i<5;i++) dat[i] = cuda_swab32(buf[i]); + #pragma unroll 5 + for (int i=0;i<5;i++) dat[i+5] = cuda_swab32(h[i]); + dat[10] = 0x80000000; + #pragma unroll 4 + for (int i=11; i<15; i++) dat[i] = 0; + + dat[15] = 0x140; + + #pragma unroll 8 + for(uint32_t i=0;i<8;i++){ + buf[ i] = c_H256[ i]; + } + + #pragma unroll + for (int i = 0; i < 16; i++) { + const uint32_t t1 = buf[7] + bsg2_1(buf[4]) + Ch(buf[4], buf[5], buf[6]) + c_K[i] + dat[i]; + #pragma unroll 7 + for (int l = 6; l >= 0; l--) buf[l + 1] = buf[l]; + buf[0] = t1 + Maj(buf[1], buf[2], buf[3]) + bsg2_0(buf[1]); + buf[4]+= t1; + } + + #pragma unroll + for (int i = 16; i < 64; i+=16) { + #pragma unroll + for(uint32_t j=0;j<16;j++) + dat[j] = ssg2_11(dat[(j + 14) & 15]) + dat[j] + dat[(j + 9) & 15] + ssg2_0(dat[(j + 1) & 15]); + + #pragma unroll + for(uint32_t j=0;j<16;j++){ + const uint32_t t1 = dat[j] + buf[7] + bsg2_1(buf[4]) + Ch(buf[4], buf[5], buf[6]) + c_K[i+j]; + #pragma unroll 7 + for (int l = 6; l >= 0; l--) buf[l + 1] = buf[l]; + buf[0] = t1 + Maj(buf[1], buf[2], buf[3]) + bsg2_0(buf[1]); + buf[4]+= t1; + } + } + + // second sha256 + #pragma unroll 8 + for(uint32_t i=0;i<8;i++) + dat[i] = buf[i] + c_H256[i]; + + dat[8] = 0x80000000; + #pragma unroll 6 + for (int i=9; i<15; i++) dat[i] = 0; + dat[15] = 0x100; + + #pragma unroll 8 + for(uint32_t i=0;i<8;i++){ + buf[ i] = c_H256[ i]; + } + +// sha256_round_body_final(dat, buf); + #pragma unroll + for (int i = 0; i < 16; i++) { + const uint32_t t1 = buf[7] + dat[i] + c_K[i] + bsg2_1(buf[4]) + Ch(buf[4], buf[5], buf[6]); + #pragma unroll 7 + for (int l = 6; l >= 0; l--) buf[l + 1] = buf[l]; + buf[0] = t1 + Maj(buf[1], buf[2], buf[3]) + bsg2_0(buf[1]); + buf[4]+= t1; + } + + #pragma unroll + for (int i = 16; i < 58; i++) { + dat[i & 15]+= ssg2_1(dat[(i - 2) & 15]) + dat[(i - 7) & 15] + ssg2_0(dat[(i - 15) & 15]); + + const uint32_t t1 = buf[7] + dat[i & 15] + c_K[i] + bsg2_1(buf[4]) + Ch(buf[4], buf[5], buf[6]); + #pragma unroll 7 + for (int l = 6; l >= 0; l--) buf[l + 1] = buf[l]; + buf[0] = t1 + Maj(buf[1], buf[2], buf[3]) + bsg2_0(buf[1]); + buf[4]+= t1; + } + + dat[10]+= ssg2_1(dat[8]) + dat[3] + ssg2_0(dat[11]); + buf[3]+= buf[7] + dat[10] + c_K[58] + bsg2_1(buf[4]) + Ch(buf[4], buf[5], buf[6]); + + dat[11]+= ssg2_1(dat[9]) + dat[4] + ssg2_0(dat[12]); + buf[2]+= buf[6] + dat[11] + c_K[59] + bsg2_1(buf[3]) + Ch(buf[3], buf[4], buf[5]); + + dat[12]+= ssg2_1(dat[10]) + dat[5] + ssg2_0(dat[13]); + buf[1]+= buf[5] + dat[12] + c_K[60] + bsg2_1(buf[2]) + Ch(buf[2], buf[3], buf[4]); + + buf[6] = cuda_swab32(c_H256[6] + buf[0] + buf[4] + dat[13]+ ssg2_1(dat[11]) + dat[6] + ssg2_0(dat[14]) + c_K[61] + bsg2_1(buf[1]) + Ch(buf[1], buf[2], buf[3])); + buf[7] = cuda_swab32(c_H256[7] + buf[1]); + + // valid nonces + if (*(uint64_t*)&buf[ 6] <= target64){ + uint32_t tmp = atomicExch(&resNonces[0], nounce-startNounce); //we actually return "thread" + if (tmp != UINT32_MAX) + resNonces[1] = tmp; + return; + } + } +} + +__host__ +void lbry_merged(int thr_id,uint32_t startNonce, uint32_t threads, uint32_t *d_resNonce, const uint64_t target64){ + + uint32_t threadsperblock = 768; + dim3 grid((threads + (NPT*threadsperblock) - 1) / (NPT*threadsperblock)); + dim3 block(threadsperblock); + gpu_lbry_merged <<>> (threads,startNonce, d_resNonce, target64); +} diff --git a/lbry/cuda_sha256_lbry.cu b/lbry/cuda_sha256_lbry.cu new file mode 100644 index 0000000..73608a1 --- /dev/null +++ b/lbry/cuda_sha256_lbry.cu @@ -0,0 +1,893 @@ +/* + * sha256 + ripemd CUDA implementation for compute5.0 GPUS + * tpruvot and Provos Alexis - JUL 2016 + */ + +#include +#include +#include + +#include +#include + +#include + +__constant__ static uint32_t _ALIGN(16) c_midstate112[8]; +__constant__ static uint32_t _ALIGN(16) c_midbuffer112[8]; +__constant__ static uint32_t _ALIGN(16) c_dataEnd112[12]; + +__constant__ const uint32_t c_H256[8] = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 +}; +__constant__ static uint32_t c_K[64] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +}; + +#ifdef __INTELLISENSE__ +#define atomicExch(p,y) y +#endif + +// ------------------------------------------------------------------------------------------------ + +static const uint32_t cpu_H256[8] = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 +}; + +static const uint32_t cpu_K[64] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +}; + +__host__ +static void sha256_step1_host(uint32_t a, uint32_t b, uint32_t c, uint32_t &d, + uint32_t e, uint32_t f, uint32_t g, uint32_t &h, uint32_t in, const uint32_t Kshared) +{ + uint32_t vxandx = (((f) ^ (g)) & (e)) ^ (g); // xandx(e, f, g); + uint32_t bsg21 = ROTR32(e, 6) ^ ROTR32(e, 11) ^ ROTR32(e, 25); // bsg2_1(e); + uint32_t bsg20 = ROTR32(a, 2) ^ ROTR32(a, 13) ^ ROTR32(a, 22); //bsg2_0(a); + uint32_t andorv = ((b) & (c)) | (((b) | (c)) & (a)); //andor32(a,b,c); + uint32_t t1 = h + bsg21 + vxandx + Kshared + in; + uint32_t t2 = bsg20 + andorv; + d = d + t1; + h = t1 + t2; +} + +__host__ +static void sha256_step2_host(uint32_t a, uint32_t b, uint32_t c, uint32_t &d, + uint32_t e, uint32_t f, uint32_t g, uint32_t &h, uint32_t* in, uint32_t pc, const uint32_t Kshared) +{ + int pcidx1 = (pc-2) & 0xF; + int pcidx2 = (pc-7) & 0xF; + int pcidx3 = (pc-15) & 0xF; + + uint32_t inx0 = in[pc]; + uint32_t inx1 = in[pcidx1]; + uint32_t inx2 = in[pcidx2]; + uint32_t inx3 = in[pcidx3]; + + uint32_t ssg21 = ROTR32(inx1, 17) ^ ROTR32(inx1, 19) ^ SPH_T32((inx1) >> 10); //ssg2_1(inx1); + uint32_t ssg20 = ROTR32(inx3, 7) ^ ROTR32(inx3, 18) ^ SPH_T32((inx3) >> 3); //ssg2_0(inx3); + uint32_t vxandx = (((f) ^ (g)) & (e)) ^ (g); // xandx(e, f, g); + uint32_t bsg21 = ROTR32(e, 6) ^ ROTR32(e, 11) ^ ROTR32(e, 25); // bsg2_1(e); + uint32_t bsg20 = ROTR32(a, 2) ^ ROTR32(a, 13) ^ ROTR32(a, 22); //bsg2_0(a); + uint32_t andorv = ((b) & (c)) | (((b) | (c)) & (a)); //andor32(a,b,c); + uint32_t t1,t2; + + in[pc] = ssg21 + inx2 + ssg20 + inx0; + + t1 = h + bsg21 + vxandx + Kshared + in[pc]; + t2 = bsg20 + andorv; + d = d + t1; + h = t1 + t2; +} + +__host__ +static void sha256_round_body_host(uint32_t* in, uint32_t* state, const uint32_t* Kshared) +{ + uint32_t a = state[0]; + uint32_t b = state[1]; + uint32_t c = state[2]; + uint32_t d = state[3]; + uint32_t e = state[4]; + uint32_t f = state[5]; + uint32_t g = state[6]; + uint32_t h = state[7]; + + sha256_step1_host(a,b,c,d,e,f,g,h,in[0], Kshared[0]); + sha256_step1_host(h,a,b,c,d,e,f,g,in[1], Kshared[1]); + sha256_step1_host(g,h,a,b,c,d,e,f,in[2], Kshared[2]); + sha256_step1_host(f,g,h,a,b,c,d,e,in[3], Kshared[3]); + sha256_step1_host(e,f,g,h,a,b,c,d,in[4], Kshared[4]); + sha256_step1_host(d,e,f,g,h,a,b,c,in[5], Kshared[5]); + sha256_step1_host(c,d,e,f,g,h,a,b,in[6], Kshared[6]); + sha256_step1_host(b,c,d,e,f,g,h,a,in[7], Kshared[7]); + sha256_step1_host(a,b,c,d,e,f,g,h,in[8], Kshared[8]); + sha256_step1_host(h,a,b,c,d,e,f,g,in[9], Kshared[9]); + sha256_step1_host(g,h,a,b,c,d,e,f,in[10],Kshared[10]); + sha256_step1_host(f,g,h,a,b,c,d,e,in[11],Kshared[11]); + sha256_step1_host(e,f,g,h,a,b,c,d,in[12],Kshared[12]); + sha256_step1_host(d,e,f,g,h,a,b,c,in[13],Kshared[13]); + sha256_step1_host(c,d,e,f,g,h,a,b,in[14],Kshared[14]); + sha256_step1_host(b,c,d,e,f,g,h,a,in[15],Kshared[15]); + + for (int i=0; i<3; i++) + { + sha256_step2_host(a,b,c,d,e,f,g,h,in,0, Kshared[16+16*i]); + sha256_step2_host(h,a,b,c,d,e,f,g,in,1, Kshared[17+16*i]); + sha256_step2_host(g,h,a,b,c,d,e,f,in,2, Kshared[18+16*i]); + sha256_step2_host(f,g,h,a,b,c,d,e,in,3, Kshared[19+16*i]); + sha256_step2_host(e,f,g,h,a,b,c,d,in,4, Kshared[20+16*i]); + sha256_step2_host(d,e,f,g,h,a,b,c,in,5, Kshared[21+16*i]); + sha256_step2_host(c,d,e,f,g,h,a,b,in,6, Kshared[22+16*i]); + sha256_step2_host(b,c,d,e,f,g,h,a,in,7, Kshared[23+16*i]); + sha256_step2_host(a,b,c,d,e,f,g,h,in,8, Kshared[24+16*i]); + sha256_step2_host(h,a,b,c,d,e,f,g,in,9, Kshared[25+16*i]); + sha256_step2_host(g,h,a,b,c,d,e,f,in,10,Kshared[26+16*i]); + sha256_step2_host(f,g,h,a,b,c,d,e,in,11,Kshared[27+16*i]); + sha256_step2_host(e,f,g,h,a,b,c,d,in,12,Kshared[28+16*i]); + sha256_step2_host(d,e,f,g,h,a,b,c,in,13,Kshared[29+16*i]); + sha256_step2_host(c,d,e,f,g,h,a,b,in,14,Kshared[30+16*i]); + sha256_step2_host(b,c,d,e,f,g,h,a,in,15,Kshared[31+16*i]); + } + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; +} + +#define xor3b(a,b,c) (a ^ b ^ c) + +__device__ __forceinline__ uint32_t bsg2_0(const uint32_t x) +{ + return xor3b(ROTR32(x,2),ROTR32(x,13),ROTR32(x,22)); +} + +__device__ __forceinline__ uint32_t bsg2_1(const uint32_t x) +{ + return xor3b(ROTR32(x,6),ROTR32(x,11),ROTR32(x,25)); +} + +__device__ __forceinline__ uint32_t ssg2_0(const uint32_t x) +{ + return xor3b(ROTR32(x,7),ROTR32(x,18),(x>>3)); +} + +__device__ __forceinline__ uint32_t ssg2_1(const uint32_t x) +{ + return xor3b(ROTR32(x,17),ROTR32(x,19),(x>>10)); +} + +__device__ __forceinline__ uint32_t ssg2_11(const uint32_t x) +{ + return xor3b(ROTR32(x,17),ROTR32(x,19),shr_u32(x,10)); +} + +__device__ __forceinline__ uint2 vectorizeswap(const uint64_t v) +{ + uint2 result; + asm volatile ("mov.b64 {%0,%1},%2;" : "=r"(result.y), "=r"(result.x) : "l"(v)); + return result; +} + +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define Ch(a, b, c) (((b^c) & a) ^ c) + +__device__ __forceinline__ +static void sha2_step(const uint32_t a,const uint32_t b,const uint32_t c, uint32_t &d,const uint32_t e,const uint32_t f,const uint32_t g, uint32_t &h,const uint32_t in, const uint32_t Kshared) +{ + const uint32_t t1 = h + bsg2_1(e) + Ch(e, f, g) + Kshared + in; + h = t1 + bsg2_0(a) + Maj(a, b, c); + d+= t1; + +} + +__device__ __forceinline__ +static void sha256_round_first(uint32_t *in,uint32_t* buf,const uint32_t *const __restrict__ state) +{ + uint32_t a = buf[0] + in[11]; + uint32_t b = buf[1]; + uint32_t c = buf[2]; + uint32_t d = buf[3]; + uint32_t e = buf[4] + in[11]; + uint32_t f = buf[5]; + uint32_t g = buf[6]; + uint32_t h = buf[7]; + + // 10 first steps made on host + //sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[11]); + + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[12]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[13]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[14]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[15]); + + //in is partially precomputed on host + in[2]+= in[11]; + in[4]+= ssg2_1(in[2]); + in[6]+= ssg2_1(in[4]); + in[8]+= ssg2_1(in[6]); + in[9]+= in[ 2]; + + sha2_step(a,b,c,d,e,f,g,h,in[0], c_K[16]); + sha2_step(h,a,b,c,d,e,f,g,in[1], c_K[17]); + sha2_step(g,h,a,b,c,d,e,f,in[2], c_K[18]); + sha2_step(f,g,h,a,b,c,d,e,in[3], c_K[19]); + sha2_step(e,f,g,h,a,b,c,d,in[4], c_K[20]); + sha2_step(d,e,f,g,h,a,b,c,in[5], c_K[21]); + sha2_step(c,d,e,f,g,h,a,b,in[6], c_K[22]); + sha2_step(b,c,d,e,f,g,h,a,in[7], c_K[23]); + sha2_step(a,b,c,d,e,f,g,h,in[8], c_K[24]); + sha2_step(h,a,b,c,d,e,f,g,in[9], c_K[25]); + + #pragma unroll 6 + for (uint32_t j = 10; j < 16; j++){ + in[j] = in[j] + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]) + ssg2_1(in[(j + 14) & 15]); + } + + sha2_step(g,h,a,b,c,d,e,f,in[10],c_K[26]); + sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[27]); + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[28]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[29]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[30]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[31]); + + #pragma unroll 16 + for (uint32_t j = 0; j < 16; j++){ + in[j] = in[j] + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]) + ssg2_1(in[(j + 14) & 15]); + } + + sha2_step(a,b,c,d,e,f,g,h,in[0], c_K[16+16]); + sha2_step(h,a,b,c,d,e,f,g,in[1], c_K[17+16]); + sha2_step(g,h,a,b,c,d,e,f,in[2], c_K[18+16]); + sha2_step(f,g,h,a,b,c,d,e,in[3], c_K[19+16]); + sha2_step(e,f,g,h,a,b,c,d,in[4], c_K[20+16]); + sha2_step(d,e,f,g,h,a,b,c,in[5], c_K[21+16]); + sha2_step(c,d,e,f,g,h,a,b,in[6], c_K[22+16]); + sha2_step(b,c,d,e,f,g,h,a,in[7], c_K[23+16]); + sha2_step(a,b,c,d,e,f,g,h,in[8], c_K[24+16]); + sha2_step(h,a,b,c,d,e,f,g,in[9], c_K[25+16]); + sha2_step(g,h,a,b,c,d,e,f,in[10],c_K[26+16]); + sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[27+16]); + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[28+16]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[29+16]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[30+16]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[31+16]); + + #pragma unroll 16 + for (uint32_t j = 0; j < 16; j++){ + in[j] = in[j] + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]) + ssg2_1(in[(j + 14) & 15]); + } + + sha2_step(a,b,c,d,e,f,g,h,in[0], c_K[16+16*2]); + sha2_step(h,a,b,c,d,e,f,g,in[1], c_K[17+16*2]); + sha2_step(g,h,a,b,c,d,e,f,in[2], c_K[18+16*2]); + sha2_step(f,g,h,a,b,c,d,e,in[3], c_K[19+16*2]); + sha2_step(e,f,g,h,a,b,c,d,in[4], c_K[20+16*2]); + sha2_step(d,e,f,g,h,a,b,c,in[5], c_K[21+16*2]); + sha2_step(c,d,e,f,g,h,a,b,in[6], c_K[22+16*2]); + sha2_step(b,c,d,e,f,g,h,a,in[7], c_K[23+16*2]); + sha2_step(a,b,c,d,e,f,g,h,in[8], c_K[24+16*2]); + sha2_step(h,a,b,c,d,e,f,g,in[9], c_K[25+16*2]); + sha2_step(g,h,a,b,c,d,e,f,in[10],c_K[26+16*2]); + sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[27+16*2]); + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[28+16*2]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[29+16*2]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[30+16*2]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[31+16*2]); + + buf[ 0] = state[0] + a; + buf[ 1] = state[1] + b; + buf[ 2] = state[2] + c; + buf[ 3] = state[3] + d; + buf[ 4] = state[4] + e; + buf[ 5] = state[5] + f; + buf[ 6] = state[6] + g; + buf[ 7] = state[7] + h; +} + +__device__ __forceinline__ +static void sha256_round_body(uint32_t* in, uint32_t* state) +{ + uint32_t a = state[0]; + uint32_t b = state[1]; + uint32_t c = state[2]; + uint32_t d = state[3]; + uint32_t e = state[4]; + uint32_t f = state[5]; + uint32_t g = state[6]; + uint32_t h = state[7]; + + sha2_step(a,b,c,d,e,f,g,h,in[0], c_K[0]); + sha2_step(h,a,b,c,d,e,f,g,in[1], c_K[1]); + sha2_step(g,h,a,b,c,d,e,f,in[2], c_K[2]); + sha2_step(f,g,h,a,b,c,d,e,in[3], c_K[3]); + sha2_step(e,f,g,h,a,b,c,d,in[4], c_K[4]); + sha2_step(d,e,f,g,h,a,b,c,in[5], c_K[5]); + sha2_step(c,d,e,f,g,h,a,b,in[6], c_K[6]); + sha2_step(b,c,d,e,f,g,h,a,in[7], c_K[7]); + sha2_step(a,b,c,d,e,f,g,h,in[8], c_K[8]); + sha2_step(h,a,b,c,d,e,f,g,in[9], c_K[9]); + sha2_step(g,h,a,b,c,d,e,f,in[10],c_K[10]); + sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[11]); + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[12]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[13]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[14]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[15]); + + #pragma unroll 3 + for (uint32_t i=0; i<3; i++) + { + #pragma unroll 16 + for (uint32_t j = 0; j < 16; j++){ + in[j]+= ssg2_11(in[(j + 14) & 15]) + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]); + } + sha2_step(a, b, c, d, e, f, g, h, in[0], c_K[16 + 16 * i]); + sha2_step(h, a, b, c, d, e, f, g, in[1], c_K[17 + 16 * i]); + sha2_step(g, h, a, b, c, d, e, f, in[2], c_K[18 + 16 * i]); + sha2_step(f, g, h, a, b, c, d, e, in[3], c_K[19 + 16 * i]); + sha2_step(e, f, g, h, a, b, c, d, in[4], c_K[20 + 16 * i]); + sha2_step(d, e, f, g, h, a, b, c, in[5], c_K[21 + 16 * i]); + sha2_step(c, d, e, f, g, h, a, b, in[6], c_K[22 + 16 * i]); + sha2_step(b, c, d, e, f, g, h, a, in[7], c_K[23 + 16 * i]); + sha2_step(a, b, c, d, e, f, g, h, in[8], c_K[24 + 16 * i]); + sha2_step(h, a, b, c, d, e, f, g, in[9], c_K[25 + 16 * i]); + sha2_step(g, h, a, b, c, d, e, f, in[10], c_K[26 + 16 * i]); + sha2_step(f, g, h, a, b, c, d, e, in[11], c_K[27 + 16 * i]); + sha2_step(e, f, g, h, a, b, c, d, in[12], c_K[28 + 16 * i]); + sha2_step(d, e, f, g, h, a, b, c, in[13], c_K[29 + 16 * i]); + sha2_step(c, d, e, f, g, h, a, b, in[14], c_K[30 + 16 * i]); + sha2_step(b, c, d, e, f, g, h, a, in[15], c_K[31 + 16 * i]); + } + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; +} + +__device__ __forceinline__ +static void sha256_round_body_final(uint32_t* in, uint32_t* state) +{ + uint32_t a = state[0]; + uint32_t b = state[1]; + uint32_t c = state[2]; + uint32_t d = state[3]; + uint32_t e = state[4]; + uint32_t f = state[5]; + uint32_t g = state[6]; + uint32_t h = state[7]; + + sha2_step(a,b,c,d,e,f,g,h,in[0], c_K[0]); + sha2_step(h,a,b,c,d,e,f,g,in[1], c_K[1]); + sha2_step(g,h,a,b,c,d,e,f,in[2], c_K[2]); + sha2_step(f,g,h,a,b,c,d,e,in[3], c_K[3]); + sha2_step(e,f,g,h,a,b,c,d,in[4], c_K[4]); + sha2_step(d,e,f,g,h,a,b,c,in[5], c_K[5]); + sha2_step(c,d,e,f,g,h,a,b,in[6], c_K[6]); + sha2_step(b,c,d,e,f,g,h,a,in[7], c_K[7]); + sha2_step(a,b,c,d,e,f,g,h,in[8], c_K[8]); + sha2_step(h,a,b,c,d,e,f,g,in[9], c_K[9]); + sha2_step(g,h,a,b,c,d,e,f,in[10],c_K[10]); + sha2_step(f,g,h,a,b,c,d,e,in[11],c_K[11]); + sha2_step(e,f,g,h,a,b,c,d,in[12],c_K[12]); + sha2_step(d,e,f,g,h,a,b,c,in[13],c_K[13]); + sha2_step(c,d,e,f,g,h,a,b,in[14],c_K[14]); + sha2_step(b,c,d,e,f,g,h,a,in[15],c_K[15]); + + #pragma unroll 2 + for (uint32_t i=0; i<2; i++) + { + #pragma unroll 16 + for (uint32_t j = 0; j < 16; j++){ + in[j] = in[j] + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]) + ssg2_1(in[(j + 14) & 15]); + } + sha2_step(a, b, c, d, e, f, g, h, in[0], c_K[16 + 16 * i]); + sha2_step(h, a, b, c, d, e, f, g, in[1], c_K[17 + 16 * i]); + sha2_step(g, h, a, b, c, d, e, f, in[2], c_K[18 + 16 * i]); + sha2_step(f, g, h, a, b, c, d, e, in[3], c_K[19 + 16 * i]); + sha2_step(e, f, g, h, a, b, c, d, in[4], c_K[20 + 16 * i]); + sha2_step(d, e, f, g, h, a, b, c, in[5], c_K[21 + 16 * i]); + sha2_step(c, d, e, f, g, h, a, b, in[6], c_K[22 + 16 * i]); + sha2_step(b, c, d, e, f, g, h, a, in[7], c_K[23 + 16 * i]); + sha2_step(a, b, c, d, e, f, g, h, in[8], c_K[24 + 16 * i]); + sha2_step(h, a, b, c, d, e, f, g, in[9], c_K[25 + 16 * i]); + sha2_step(g, h, a, b, c, d, e, f, in[10], c_K[26 + 16 * i]); + sha2_step(f, g, h, a, b, c, d, e, in[11], c_K[27 + 16 * i]); + sha2_step(e, f, g, h, a, b, c, d, in[12], c_K[28 + 16 * i]); + sha2_step(d, e, f, g, h, a, b, c, in[13], c_K[29 + 16 * i]); + sha2_step(c, d, e, f, g, h, a, b, in[14], c_K[30 + 16 * i]); + sha2_step(b, c, d, e, f, g, h, a, in[15], c_K[31 + 16 * i]); + } + #pragma unroll 14 + for (uint32_t j = 0; j < 14; j++){ + in[j] = in[j] + in[(j + 9) & 15] + ssg2_0(in[(j + 1) & 15]) + ssg2_1(in[(j + 14) & 15]); + } + sha2_step(a, b, c, d, e, f, g, h, in[0], c_K[16 + 16 * 2]); + sha2_step(h, a, b, c, d, e, f, g, in[1], c_K[17 + 16 * 2]); + sha2_step(g, h, a, b, c, d, e, f, in[2], c_K[18 + 16 * 2]); + sha2_step(f, g, h, a, b, c, d, e, in[3], c_K[19 + 16 * 2]); + sha2_step(e, f, g, h, a, b, c, d, in[4], c_K[20 + 16 * 2]); + sha2_step(d, e, f, g, h, a, b, c, in[5], c_K[21 + 16 * 2]); + sha2_step(c, d, e, f, g, h, a, b, in[6], c_K[22 + 16 * 2]); + sha2_step(b, c, d, e, f, g, h, a, in[7], c_K[23 + 16 * 2]); + sha2_step(a, b, c, d, e, f, g, h, in[8], c_K[24 + 16 * 2]); + sha2_step(h, a, b, c, d, e, f, g, in[9], c_K[25 + 16 * 2]); + sha2_step(g, h, a, b, c, d, e, f, in[10], c_K[26 + 16 * 2]); + sha2_step(f, g, h, a, b, c, d, e, in[11], c_K[27 + 16 * 2]); + sha2_step(e, f, g, h, a, b, c, d, in[12], c_K[28 + 16 * 2]); + sha2_step(d, e, f, g, h, a, b, c, in[13], c_K[29 + 16 * 2]); + + state[6] = cuda_swab32(state[6] + g); + state[7] = cuda_swab32(state[7] + h); +} + +__global__ __launch_bounds__(768,2) /* to force 32 regs */ +void lbry_sha256d_gpu_hash_112(const uint32_t threads, const uint32_t startNonce, uint64_t *outputHash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint32_t buf[8], state[8]; + if (thread < threads) + { + uint32_t dat[16]; + + #pragma unroll 11 + for (uint32_t i=0; i<11; i++) dat[i] = c_dataEnd112[i]; + dat[11] = startNonce + thread; + dat[12] = 0x80000000; + dat[13] = 0; + dat[14] = 0; + dat[15] = 0x380; + + *(uint2x4*)&state[0] = *(uint2x4*)&c_midstate112[0]; + *(uint2x4*)&buf[0] = *(uint2x4*)&c_midbuffer112[0]; + + sha256_round_first(dat, buf, state); // no shared mem here + + // second sha256 + + *(uint2x4*)&dat[0] = *(uint2x4*)&buf[0]; + + dat[8] = 0x80000000; + + #pragma unroll 6 + for (uint32_t i=9; i<15; i++) dat[i] = 0; + dat[15] = 0x100; + + *(uint2x4*)&buf[0] = *(uint2x4*)&c_H256[0]; + + sha256_round_body(dat, buf); //no shared mem at all + + // output + *(uint2*)&buf[0] = vectorizeswap(((uint64_t*)buf)[0]); + *(uint2*)&buf[2] = vectorizeswap(((uint64_t*)buf)[1]); + *(uint2*)&buf[4] = vectorizeswap(((uint64_t*)buf)[2]); + *(uint2*)&buf[6] = vectorizeswap(((uint64_t*)buf)[3]); + + *(uint2x4*)&outputHash[thread<<3] = *(uint2x4*)&buf[0]; + } +} + +__host__ +void lbry_sha256d_hash_112(int thr_id, uint32_t threads, uint32_t startNonce, uint32_t *d_outputHash){ + + const int threadsperblock = 768; + + dim3 grid((threads + threadsperblock - 1) / threadsperblock); + dim3 block(threadsperblock); + + lbry_sha256d_gpu_hash_112 <<>> (threads, startNonce, (uint64_t*) d_outputHash); +} + +__host__ +void lbry_sha256_init(int thr_id) +{ + cudaMemcpyToSymbol(c_K, cpu_K, sizeof(cpu_K), 0, cudaMemcpyHostToDevice); +} + +__host__ +void lbry_sha256_setBlock_112(uint32_t *pdata){ + + uint32_t in[16], buf[8], end[16]; + for (int i=0;i<16;i++) in[i] = cuda_swab32(pdata[i]); + for (int i=0; i<8;i++) buf[i] = cpu_H256[i]; + for (int i=0;i<11;i++) end[i] = cuda_swab32(pdata[16+i]); + sha256_round_body_host(in, buf, cpu_K); + + cudaMemcpyToSymbol(c_midstate112, buf, 32, 0, cudaMemcpyHostToDevice); + + uint32_t a = buf[0]; + uint32_t b = buf[1]; + uint32_t c = buf[2]; + uint32_t d = buf[3]; + uint32_t e = buf[4]; + uint32_t f = buf[5]; + uint32_t g = buf[6]; + uint32_t h = buf[7]; + + sha256_step1_host(a,b,c,d,e,f,g,h,end[0], cpu_K[0]); + sha256_step1_host(h,a,b,c,d,e,f,g,end[1], cpu_K[1]); + sha256_step1_host(g,h,a,b,c,d,e,f,end[2], cpu_K[2]); + sha256_step1_host(f,g,h,a,b,c,d,e,end[3], cpu_K[3]); + sha256_step1_host(e,f,g,h,a,b,c,d,end[4], cpu_K[4]); + sha256_step1_host(d,e,f,g,h,a,b,c,end[5], cpu_K[5]); + sha256_step1_host(c,d,e,f,g,h,a,b,end[6], cpu_K[6]); + sha256_step1_host(b,c,d,e,f,g,h,a,end[7], cpu_K[7]); + sha256_step1_host(a,b,c,d,e,f,g,h,end[8], cpu_K[8]); + sha256_step1_host(h,a,b,c,d,e,f,g,end[9], cpu_K[9]); + sha256_step1_host(g,h,a,b,c,d,e,f,end[10],cpu_K[10]); + sha256_step1_host(f, g, h, a, b, c, d, e, 0, cpu_K[11]); + + buf[0] = a; + buf[1] = b; + buf[2] = c; + buf[3] = d; + buf[4] = e; + buf[5] = f; + buf[6] = g; + buf[7] = h; + + cudaMemcpyToSymbol(c_midbuffer112, buf, 32, 0, cudaMemcpyHostToDevice); + + end[12] = 0x80000000; + end[13] = 0; + end[14] = 0; + end[15] = 0x380; + uint32_t x2_0,x2_1; + + x2_0 = ROTR32(end[1], 7) ^ ROTR32(end[1], 18) ^ SPH_T32(end[1] >> 3); //ssg2_0(end[1]); +// x2_1 = ROTR32(end[14], 17) ^ ROTR32(end[14], 19) ^ SPH_T32(end[14] >> 10) + x2_0; //ssg2_1(end[14]) + x2_0; + end[0] = end[0] + end[9] + x2_0; + + x2_0 = ROTR32(end[2], 7) ^ ROTR32(end[2], 18) ^ SPH_T32(end[2] >> 3); + x2_1 = (ROTR32(end[15], 17) ^ ROTR32(end[15], 19) ^ SPH_T32(end[15] >> 10)) + x2_0; + end[1] = end[1] + end[10] + x2_1; + + x2_0 = ROTR32(end[3], 7) ^ ROTR32(end[3], 18) ^ SPH_T32(end[3] >> 3);//ssg2_0(end[3]); + x2_1 = (ROTR32(end[0], 17) ^ ROTR32(end[0], 19) ^ SPH_T32(end[0] >> 10)) + x2_0; + end[2]+= x2_1; + + x2_0 = ROTR32(end[4], 7) ^ ROTR32(end[4], 18) ^ SPH_T32(end[4] >> 3);//ssg2_0(end[4]); + x2_1 = (ROTR32(end[1], 17) ^ ROTR32(end[1], 19) ^ SPH_T32(end[1] >> 10)) + x2_0; + end[3] = end[3] + end[12] + x2_1; + + x2_0 = ROTR32(end[5], 7) ^ ROTR32(end[5], 18) ^ SPH_T32(end[5] >> 3);//ssg2_0(end[4]); + end[4] = end[4] + end[13] + x2_0; + + x2_0 = ROTR32(end[6], 7) ^ ROTR32(end[6], 18) ^ SPH_T32(end[6] >> 3);//ssg2_0(end[6]); + x2_1 = (ROTR32(end[3], 17) ^ ROTR32(end[3], 19) ^ SPH_T32(end[3] >> 10)) + x2_0; + end[5] = end[5] + end[14] + x2_1; + + x2_0 = ROTR32(end[7], 7) ^ ROTR32(end[7], 18) ^ SPH_T32(end[7] >> 3);//ssg2_0(end[7]); + end[6] = end[6] + end[15] + x2_0; + + x2_0 = ROTR32(end[8], 7) ^ ROTR32(end[8], 18) ^ SPH_T32(end[8] >> 3);//ssg2_0(end[8]); + x2_1 = (ROTR32(end[5], 17) ^ ROTR32(end[5], 19) ^ SPH_T32(end[5] >> 10)) + x2_0; + end[7] = end[7] + end[0] + x2_1; + + x2_0 = ROTR32(end[9], 7) ^ ROTR32(end[9], 18) ^ SPH_T32(end[9] >> 3);//ssg2_0(end[9]); + end[8] = end[8] + end[1] + x2_0; + + x2_0 = ROTR32(end[10], 7) ^ ROTR32(end[10], 18) ^ SPH_T32(end[10] >> 3);//ssg2_0(end[10]); + x2_1 = (ROTR32(end[7], 17) ^ ROTR32(end[7], 19) ^ SPH_T32(end[7] >> 10)) + x2_0; + end[9] = end[9] + x2_1; + + cudaMemcpyToSymbol(c_dataEnd112, end, 12*sizeof(uint32_t), 0, cudaMemcpyHostToDevice); +} + +// RIPEMD MACROS----------------------------------------------------------------------------- + +/* + * Round constants for RIPEMD-160. + */ +static __constant__ const uint32_t c_IV[5] = {0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0}; +static __constant__ const uint32_t KL[5] = {0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E}; +static __constant__ const uint32_t KR[5] = {0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000}; + +/* Left line */ +static __constant__ const uint32_t RL[5][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* Round 1: id */ + { 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8 }, /* Round 2: rho */ + { 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12 }, /* Round 3: rho^2 */ + { 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2 }, /* Round 4: rho^3 */ + { 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 } /* Round 5: rho^4 */ +}; + +/* Right line */ +static __constant__ const uint32_t RR[5][16] = { + { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12 }, /* Round 1: pi */ + { 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2 }, /* Round 2: rho pi */ + { 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13 }, /* Round 3: rho^2 pi */ + { 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14 }, /* Round 4: rho^3 pi */ + { 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 } /* Round 5: rho^4 pi */ +}; + +/* Shifts, left line */ +static __constant__ const uint32_t SL[5][16] = { + { 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8 }, /* Round 1 */ + { 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12 }, /* Round 2 */ + { 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5 }, /* Round 3 */ + { 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12 }, /* Round 4 */ + { 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 } /* Round 5 */ +}; + +/* Shifts, right line */ +static __constant__ const uint32_t SR[5][16] = { + { 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6 }, /* Round 1 */ + { 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11 }, /* Round 2 */ + { 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5 }, /* Round 3 */ + { 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8 }, /* Round 4 */ + { 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 } /* Round 5 */ +}; + +__device__ __forceinline__ +static uint32_t ROTATE(const uint32_t x,const uint32_t r){ + if(r==8) + return __byte_perm(x, 0, 0x2103); + else + return ROTL32(x,r); +} + +/* + * Round functions for RIPEMD-160. + */ +//#define F1(x, y, z) xor3x(x, y, z) +__device__ __forceinline__ +uint32_t F1(const uint32_t a,const uint32_t b,const uint32_t c){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x96;" : "=r"(result) : "r"(a), "r"(b),"r"(c)); + #else + result = a^b^c; + #endif + return result; +} + + +//#define F2(x, y, z) ((x & (y ^ z)) ^ z) +__device__ __forceinline__ +uint32_t F2(const uint32_t a,const uint32_t b,const uint32_t c){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0xCA;" : "=r"(result) : "r"(a), "r"(b),"r"(c)); //0xCA=((F0∧(CC⊻AA))⊻AA) + #else + result = ((a & (b ^ c)) ^ c); + #endif + return result; +} + +//#define F3(x, y, z) ((x | ~y) ^ z) +__device__ __forceinline__ +uint32_t F3(const uint32_t x,const uint32_t y,const uint32_t z){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x59;" : "=r"(result) : "r"(x), "r"(y),"r"(z)); //0x59=((F0∨(¬CC))⊻AA) + #else + result = ((x | ~y) ^ z); + #endif + return result; +} +//#define F4(x, y, z) (y ^ ((x ^ y) & z)) +__device__ __forceinline__ +uint32_t F4(const uint32_t x,const uint32_t y,const uint32_t z){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0xE4;" : "=r"(result) : "r"(x), "r"(y),"r"(z)); //0xE4=(CC⊻((F0⊻CC)∧AA)) + #else + result = (y ^ ((x ^ y) & z)); + #endif + return result; +} + +//#define F5(x, y, z) (x ^ (y | ~z)) +__device__ __forceinline__ +uint32_t F5(const uint32_t x,const uint32_t y,const uint32_t z){ + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x2D;" : "=r"(result) : "r"(x), "r"(y),"r"(z)); //0x2D=(F0⊻(CC∨(¬AA))) + #else + result = (x ^ (y | ~z)); + #endif + return result; +} + +__device__ __forceinline__ +static void RIPEMD160_ROUND_BODY(const uint32_t *in, uint32_t *h){ + uint32_t T; + uint32_t AL, BL, CL, DL, EL; /* left line */ + uint32_t AR, BR, CR, DR, ER; /* right line */ + + AL = AR = h[0]; + BL = BR = h[1]; + CL = CR = h[2]; + DL = DR = h[3]; + EL = ER = h[4]; + + /* Round 1 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F1(BL, CL, DL) + in[RL[0][w]] + KL[0], SL[0][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F5(BR, CR, DR) + in[RR[0][w]] + KR[0], SR[0][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + /* Round 2 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F2(BL, CL, DL) + in[RL[1][w]] + KL[1], SL[1][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F4(BR, CR, DR) + in[RR[1][w]] + KR[1], SR[1][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + /* Round 3 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F3(BL, CL, DL) + in[RL[2][w]] + KL[2], SL[2][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F3(BR, CR, DR) + in[RR[2][w]] + KR[2], SR[2][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + /* Round 4 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F4(BL, CL, DL) + in[RL[3][w]] + KL[3], SL[3][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F2(BR, CR, DR) + in[RR[3][w]] + KR[3], SR[3][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + /* Round 5 */ + #pragma unroll 16 + for (uint32_t w = 0; w < 16; w++) { + T = ROTATE(AL + F5(BL, CL, DL) + in[RL[4][w]] + KL[4], SL[4][w]) + EL; + AL = EL; EL = DL; DL = ROTL32(CL,10); CL = BL; BL = T; + + T = ROTATE(AR + F1(BR, CR, DR) + in[RR[4][w]] + KR[4], SR[4][w]) + ER; + AR = ER; ER = DR; DR = ROTL32(CR,10); CR = BR; BR = T; + } + + T = h[1] + CL + DR; + h[1] = h[2] + DL + ER; + h[2] = h[3] + EL + AR; + h[3] = h[4] + AL + BR; + h[4] = h[0] + BL + CR; + h[0] = T; +} +// END OF RIPEMD MACROS---------------------------------------------------------------------- + +__global__ __launch_bounds__(1024,2) /* to force 32 regs */ +void lbry_ripemd(const uint32_t threads, uint32_t *const __restrict__ Hash512){ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint32_t dat[16]; + uint32_t h[5]; + uint32_t buf[8]; // align for vectorize + if(thread>> (threads,d_inputHash); + lbry_sha256d_gpu_hash_final <<>> (threads, d_inputHash, d_resNonce, target64); +} diff --git a/lbry/cuda_sha512_lbry.cu b/lbry/cuda_sha512_lbry.cu new file mode 100644 index 0000000..41ff8a2 --- /dev/null +++ b/lbry/cuda_sha512_lbry.cu @@ -0,0 +1,125 @@ +/** + * sha-512 CUDA implementation. + * Tanguy Pruvot and Provos Alexis - JUL 2016 + */ + +//#define USE_ROT_ASM_OPT 0 +#include +#include "cuda_vectors.h" +#include "miner.h" + +static __constant__ uint64_t K_512[80] = { + 0x428A2F98D728AE22, 0x7137449123EF65CD, 0xB5C0FBCFEC4D3B2F, 0xE9B5DBA58189DBBC, 0x3956C25BF348B538, 0x59F111F1B605D019, 0x923F82A4AF194F9B, 0xAB1C5ED5DA6D8118, + 0xD807AA98A3030242, 0x12835B0145706FBE, 0x243185BE4EE4B28C, 0x550C7DC3D5FFB4E2, 0x72BE5D74F27B896F, 0x80DEB1FE3B1696B1, 0x9BDC06A725C71235, 0xC19BF174CF692694, + 0xE49B69C19EF14AD2, 0xEFBE4786384F25E3, 0x0FC19DC68B8CD5B5, 0x240CA1CC77AC9C65, 0x2DE92C6F592B0275, 0x4A7484AA6EA6E483, 0x5CB0A9DCBD41FBD4, 0x76F988DA831153B5, + 0x983E5152EE66DFAB, 0xA831C66D2DB43210, 0xB00327C898FB213F, 0xBF597FC7BEEF0EE4, 0xC6E00BF33DA88FC2, 0xD5A79147930AA725, 0x06CA6351E003826F, 0x142929670A0E6E70, + 0x27B70A8546D22FFC, 0x2E1B21385C26C926, 0x4D2C6DFC5AC42AED, 0x53380D139D95B3DF, 0x650A73548BAF63DE, 0x766A0ABB3C77B2A8, 0x81C2C92E47EDAEE6, 0x92722C851482353B, + 0xA2BFE8A14CF10364, 0xA81A664BBC423001, 0xC24B8B70D0F89791, 0xC76C51A30654BE30, 0xD192E819D6EF5218, 0xD69906245565A910, 0xF40E35855771202A, 0x106AA07032BBD1B8, + 0x19A4C116B8D2D0C8, 0x1E376C085141AB53, 0x2748774CDF8EEB99, 0x34B0BCB5E19B48A8, 0x391C0CB3C5C95A63, 0x4ED8AA4AE3418ACB, 0x5B9CCA4F7763E373, 0x682E6FF3D6B2B8A3, + 0x748F82EE5DEFB2FC, 0x78A5636F43172F60, 0x84C87814A1F0AB72, 0x8CC702081A6439EC, 0x90BEFFFA23631E28, 0xA4506CEBDE82BDE9, 0xBEF9A3F7B2C67915, 0xC67178F2E372532B, + 0xCA273ECEEA26619C, 0xD186B8C721C0C207, 0xEADA7DD6CDE0EB1E, 0xF57D4F7FEE6ED178, 0x06F067AA72176FBA, 0x0A637DC5A2C898A6, 0x113F9804BEF90DAE, 0x1B710B35131C471B, + 0x28DB77F523047D84, 0x32CAAB7B40C72493, 0x3C9EBE0A15C9BEBC, 0x431D67C49C100D4C, 0x4CC5D4BECB3E42B6, 0x597F299CFC657E2A, 0x5FCB6FAB3AD6FAEC, 0x6C44198C4A475817 +}; + +#undef xor3 +#define xor3(a,b,c) (a^b^c) + +#define bsg5_0(x) xor3(ROTR64(x,28),ROTR64(x,34),ROTR64(x,39)) +#define bsg5_1(x) xor3(ROTR64(x,14),ROTR64(x,18),ROTR64(x,41)) +#define ssg5_0(x) xor3(ROTR64(x,1),ROTR64(x,8),shr_u64(x,7)) +#define ssg5_1(x) xor3(ROTR64(x,19),ROTR64(x,61),shr_u64(x,6)) + + +#define andor64(a,b,c) ((a & (b | c)) | (b & c)) +#define xandx64(e,f,g) (g ^ (e & (g ^ f))) + +__device__ __forceinline__ +static void sha512_step2(uint64_t *const r,const uint64_t W,const uint64_t K, const int ord){ + + const uint64_t T1 = r[(15-ord) & 7] + K + W + bsg5_1(r[(12-ord) & 7]) + xandx64(r[(12-ord) & 7],r[(13-ord) & 7],r[(14-ord) & 7]); + r[(15-ord)& 7] = T1 + andor64(r[( 8-ord) & 7],r[( 9-ord) & 7],r[(10-ord) & 7]) + bsg5_0(r[( 8-ord) & 7]); + r[(11-ord)& 7]+= T1; +} + +/**************************************************************************************************/ + +__global__ __launch_bounds__(512,2) +void lbry_sha512_gpu_hash_32(const uint32_t threads, uint32_t *const __restrict__ g_hash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + const uint64_t IV512[8] = { + 0x6A09E667F3BCC908, 0xBB67AE8584CAA73B, 0x3C6EF372FE94F82B, 0xA54FF53A5F1D36F1, + 0x510E527FADE682D1, 0x9B05688C2B3E6C1F, 0x1F83D9ABFB41BD6B, 0x5BE0CD19137E2179 + }; + uint64_t r[8]; + uint64_t W[16]; + if (thread < threads) + { + uint32_t *const pHash = &g_hash[thread<<4]; + + *(uint2x4*)&r[ 0] = *(uint2x4*)&IV512[ 0]; + *(uint2x4*)&r[ 4] = *(uint2x4*)&IV512[ 4]; + + *(uint2x4*)&W[ 0] = __ldg4((uint2x4*)&pHash[ 0]); + + W[4] = 0x8000000000000000; // end tag + + #pragma unroll + for (uint32_t i = 5; i < 15; i++) W[i] = 0; + + W[15] = 0x100; // 256 bits + + uint64_t t1; + uint64_t constants[2]; + #pragma unroll 8 + for (int i = 0; i < 16; i+=2){ + *(uint4*)&constants = *(uint4*)&K_512[i]; + + t1 = W[i+0] + r[ 7] + bsg5_1(r[ 4]) + xandx64(r[ 4], r[ 5], r[ 6]) + constants[0]; + #pragma unroll + for (int l = 6; l >= 0; l--) r[l + 1] = r[l]; + r[0] = t1 + andor64(r[ 1], r[ 2], r[ 3]) + bsg5_0(r[ 1]); + r[4]+= t1; + + t1 = W[i+1] + r[ 7] + bsg5_1(r[ 4]) + xandx64(r[ 4], r[ 5], r[ 6]) + constants[1]; + #pragma unroll + for (int l = 6; l >= 0; l--) r[l + 1] = r[l]; + r[0] = t1 + andor64(r[ 1], r[ 2], r[ 3]) + bsg5_0(r[ 1]); + r[4]+= t1; + } + + #pragma unroll + for (uint32_t i = 16; i < 80; i+=16){ + #pragma unroll 16 + for (uint32_t j = 0; j<16; j++){ + W[j & 15] += ssg5_0(W[(j - 15) & 15]) + W[(j - 7) & 15] + ssg5_1(W[(j - 2) & 15]); + } + #pragma unroll 8 + for (uint32_t j = 0; j<16; j+=2){ + *(uint4*)&constants = *(uint4*)&K_512[i+j]; + + sha512_step2(r, W[j+0],constants[0], (i+j+0)&7); + sha512_step2(r, W[j+1],constants[1], (i+j+1)&7); + } + } + + #pragma unroll 8 + for (uint32_t i = 0; i < 8; i++) + r[i] = cuda_swab64(r[i] + IV512[i]); + + *(uint2x4*)&pHash[ 0] = *(uint2x4*)&r[ 0]; + *(uint2x4*)&pHash[ 8] = *(uint2x4*)&r[ 4]; + + } +} + +__host__ +void lbry_sha512_hash_32(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + const int threadsperblock = 512; + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + lbry_sha512_gpu_hash_32 <<>> (threads, d_hash); +} diff --git a/lbry/lbry.cu b/lbry/lbry.cu new file mode 100644 index 0000000..27fa826 --- /dev/null +++ b/lbry/lbry.cu @@ -0,0 +1,217 @@ +/** + * Lbry CUDA Implementation + * + * by tpruvot@github - July 2016 + * + */ + +#include +#include + +extern "C" { +#include +#include +} + +#include +#include + +#define A 64 +#define debug_cpu 0 + +extern "C" void lbry_hash(void* output, const void* input) +{ + uint32_t _ALIGN(A) hashA[16]; + uint32_t _ALIGN(A) hashB[8]; + uint32_t _ALIGN(A) hashC[8]; + + sph_sha256_context ctx_sha256; + sph_sha512_context ctx_sha512; + sph_ripemd160_context ctx_ripemd; + + sph_sha256_init(&ctx_sha256); + sph_sha256(&ctx_sha256, input, 112); + sph_sha256_close(&ctx_sha256, hashA); + + sph_sha256(&ctx_sha256, hashA, 32); + sph_sha256_close(&ctx_sha256, hashA); + + sph_sha512_init(&ctx_sha512); + sph_sha512(&ctx_sha512, hashA, 32); + sph_sha512_close(&ctx_sha512, hashA); + + sph_ripemd160_init(&ctx_ripemd); + sph_ripemd160(&ctx_ripemd, hashA, 32); // sha512 low + sph_ripemd160_close(&ctx_ripemd, hashB); + if (debug_cpu) applog_hex(hashB, 20); + + sph_ripemd160(&ctx_ripemd, &hashA[8], 32); // sha512 high + sph_ripemd160_close(&ctx_ripemd, hashC); + if (debug_cpu) applog_hex(hashC, 20); + + sph_sha256(&ctx_sha256, hashB, 20); + sph_sha256(&ctx_sha256, hashC, 20); + sph_sha256_close(&ctx_sha256, hashA); + if (debug_cpu) applog_hex(hashA,32); + + sph_sha256(&ctx_sha256, hashA, 32); + sph_sha256_close(&ctx_sha256, hashA); + + memcpy(output, hashA, 32); +} + +/* ############################################################################################################################### */ + +extern void lbry_sha256_init(int thr_id); +extern void lbry_sha256_free(int thr_id); +extern void lbry_sha256_setBlock_112(uint32_t *pdata); +extern void lbry_sha256d_hash_112(int thr_id, uint32_t threads, uint32_t startNonce, uint32_t *d_outputHash); +extern void lbry_sha512_hash_32(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void lbry_sha256d_hash_final(int thr_id, uint32_t threads, uint32_t *d_inputHash, uint32_t *d_resNonce, const uint64_t target64); + +extern void lbry_sha256_setBlock_112_merged(uint32_t *pdata); +extern void lbry_merged(int thr_id,uint32_t startNonce, uint32_t threads, uint32_t *d_resNonce, const uint64_t target64); + +static __inline uint32_t swab32_if(uint32_t val, bool iftrue) { + return iftrue ? swab32(val) : val; +} + +static bool init[MAX_GPUS] = { 0 }; + +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +// nonce position is different +#define LBC_NONCE_OFT32 27 + +extern "C" int scanhash_lbry(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done) +{ + uint32_t _ALIGN(A) vhash[8]; + uint32_t _ALIGN(A) endiandata[28]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + + const uint32_t first_nonce = pdata[LBC_NONCE_OFT32]; + const int swap = 0; // to toggle nonce endian (need kernel change) + + const int dev_id = device_map[thr_id]; + uint32_t default_throughput = (device_sm[dev_id] > 500) ? ((1U<<26)+256*256*256) : ((1U<<23)+256*256*64); + + if (strstr(device_name[dev_id], "GTX 1080")) default_throughput=(1<<28); + else + if (strstr(device_name[dev_id], "GTX 1070")) default_throughput=(1<<28); + else + if (strstr(device_name[dev_id], "GTX 1060 6GB")) default_throughput=(1<<28); + else + if (strstr(device_name[dev_id], "GTX 980")) default_throughput =(1<<28); + + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) { + ptarget[7] = 0xf; + } + + if (!init[thr_id]){ + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + if(device_sm[dev_id]<=500) + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], (size_t) 8 * sizeof(uint64_t) * throughput)); + + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], 2 * sizeof(uint32_t))); + + CUDA_LOG_ERROR(); + + init[thr_id] = true; + } + + for (int i=0; i < LBC_NONCE_OFT32; i++) { + be32enc(&endiandata[i], pdata[i]); + } + + if(device_sm[dev_id]<=500) + lbry_sha256_setBlock_112(endiandata); + else + lbry_sha256_setBlock_112_merged(endiandata); + cudaMemset(d_resNonce[thr_id], 0xFF, 2 * sizeof(uint32_t)); + do { + // Hash with CUDA + if(device_sm[dev_id]<=500){ + lbry_sha256d_hash_112(thr_id, throughput, pdata[LBC_NONCE_OFT32], d_hash[thr_id]); + lbry_sha512_hash_32(thr_id, throughput, d_hash[thr_id]); + lbry_sha256d_hash_final(thr_id, throughput, d_hash[thr_id], d_resNonce[thr_id], *(uint64_t*)&ptarget[6]); + }else{ + lbry_merged(thr_id,pdata[LBC_NONCE_OFT32], throughput, d_resNonce[thr_id], *(uint64_t*)&ptarget[6]); + } + uint32_t resNonces[2] = { UINT32_MAX, UINT32_MAX }; + cudaMemcpy(resNonces, d_resNonce[thr_id], 2 * sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (resNonces[ 0] != UINT32_MAX) + { + const uint32_t startNonce = pdata[LBC_NONCE_OFT32]; + + resNonces[ 0]+= startNonce; + + endiandata[LBC_NONCE_OFT32] = swab32_if(resNonces[ 0], !swap); + lbry_hash(vhash, endiandata); + + if (vhash[7] <= ptarget[7] && fulltest(vhash, ptarget)) { + int res = 1; + *hashes_done = pdata[LBC_NONCE_OFT32] - first_nonce + throughput; + work->nonces[0] = swab32_if(resNonces[ 0], swap); + work_set_target_ratio(work, vhash); + if (resNonces[ 1] != UINT32_MAX) { + resNonces[ 1]+=startNonce; +// if(!opt_quiet) +// gpulog(LOG_BLUE, thr_id, "Found 2nd nonce %08x", swab32(resNonces[ 1])); + endiandata[LBC_NONCE_OFT32] = swab32_if(resNonces[ 1], !swap); + lbry_hash(vhash, endiandata); + work->nonces[1] = swab32_if(resNonces[ 1], swap); + if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio[0]) { + work_set_target_ratio(work, vhash); + xchg(work->nonces[0], work->nonces[1]); + } + res++; + } + pdata[LBC_NONCE_OFT32] = work->nonces[0]; + return res; + } else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU %08x > %08x!", resNonces[ 0], vhash[7], ptarget[7]); + cudaMemset(d_resNonce[thr_id], 0xFF, 2 * sizeof(uint32_t)); + } + } + + pdata[LBC_NONCE_OFT32] += throughput; + + } while (!work_restart[thr_id].restart && ((uint64_t)throughput + (uint64_t)pdata[LBC_NONCE_OFT32] < (uint64_t)max_nonce)); + + *hashes_done = pdata[LBC_NONCE_OFT32] - first_nonce; + + return 0; +} + +// cleanup +void free_lbry(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaThreadSynchronize(); + + if(device_sm[device_map[thr_id]]<=500) + cudaFree(d_hash[thr_id]); + + cudaFree(d_resNonce[thr_id]); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/lyra2/Lyra2.c b/lyra2/Lyra2.c new file mode 100644 index 0000000..1f0a953 --- /dev/null +++ b/lyra2/Lyra2.c @@ -0,0 +1,214 @@ +/** + * Implementation of the Lyra2 Password Hashing Scheme (PHS). + * + * Author: The Lyra PHC team (http://www.lyra-kdf.net/) -- 2014. + * + * This software is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include + +#include "Lyra2.h" +#include "Sponge.h" + +/** + * Executes Lyra2 based on the G function from Blake2b. This version supports salts and passwords + * whose combined length is smaller than the size of the memory matrix, (i.e., (nRows x nCols x b) bits, + * where "b" is the underlying sponge's bitrate). In this implementation, the "basil" is composed by all + * integer parameters (treated as type "unsigned int") in the order they are provided, plus the value + * of nCols, (i.e., basil = kLen || pwdlen || saltlen || timeCost || nRows || nCols). + * + * @param K The derived key to be output by the algorithm + * @param kLen Desired key length + * @param pwd User password + * @param pwdlen Password length + * @param salt Salt + * @param saltlen Salt length + * @param timeCost Parameter to determine the processing time (T) + * @param nRows Number or rows of the memory matrix (R) + * @param nCols Number of columns of the memory matrix (C) + * + * @return 0 if the key is generated correctly; -1 if there is an error (usually due to lack of memory for allocation) + */ +int LYRA2(void *K, int64_t kLen, const void *pwd, int32_t pwdlen, const void *salt, int32_t saltlen, int64_t timeCost, const int16_t nRows, const int16_t nCols) +{ + //============================= Basic variables ============================// + int64_t row = 2; //index of row to be processed + int64_t prev = 1; //index of prev (last row ever computed/modified) + int64_t rowa = 0; //index of row* (a previous row, deterministically picked during Setup and randomly picked while Wandering) + int64_t tau; //Time Loop iterator + int64_t step = 1; //Visitation step (used during Setup and Wandering phases) + int64_t window = 2; //Visitation window (used to define which rows can be revisited during Setup) + int64_t gap = 1; //Modifier to the step, assuming the values 1 or -1 + int64_t i; //auxiliary iteration counter + int64_t v64; // 64bit var for memcpy + //==========================================================================/ + + //========== Initializing the Memory Matrix and pointers to it =============// + //Tries to allocate enough space for the whole memory matrix + + const int64_t ROW_LEN_INT64 = BLOCK_LEN_INT64 * nCols; + const int64_t ROW_LEN_BYTES = ROW_LEN_INT64 * 8; + // for Lyra2REv2, nCols = 4, v1 was using 8 + const int64_t BLOCK_LEN = (nCols == 4) ? BLOCK_LEN_BLAKE2_SAFE_INT64 : BLOCK_LEN_BLAKE2_SAFE_BYTES; + + size_t sz = (size_t)ROW_LEN_BYTES * nRows; + uint64_t *wholeMatrix = malloc(sz); + if (wholeMatrix == NULL) { + return -1; + } + memset(wholeMatrix, 0, sz); + + //Allocates pointers to each row of the matrix + uint64_t **memMatrix = malloc(sizeof(uint64_t*) * nRows); + if (memMatrix == NULL) { + return -1; + } + //Places the pointers in the correct positions + uint64_t *ptrWord = wholeMatrix; + for (i = 0; i < nRows; i++) { + memMatrix[i] = ptrWord; + ptrWord += ROW_LEN_INT64; + } + //==========================================================================/ + + //============= Getting the password + salt + basil padded with 10*1 ===============// + //OBS.:The memory matrix will temporarily hold the password: not for saving memory, + //but this ensures that the password copied locally will be overwritten as soon as possible + + //First, we clean enough blocks for the password, salt, basil and padding + int64_t nBlocksInput = ((saltlen + pwdlen + 6 * sizeof(uint64_t)) / BLOCK_LEN_BLAKE2_SAFE_BYTES) + 1; + + byte *ptrByte = (byte*) wholeMatrix; + + //Prepends the password + memcpy(ptrByte, pwd, pwdlen); + ptrByte += pwdlen; + + //Concatenates the salt + memcpy(ptrByte, salt, saltlen); + ptrByte += saltlen; + + memset(ptrByte, 0, (size_t) (nBlocksInput * BLOCK_LEN_BLAKE2_SAFE_BYTES - (saltlen + pwdlen))); + + //Concatenates the basil: every integer passed as parameter, in the order they are provided by the interface + memcpy(ptrByte, &kLen, sizeof(int64_t)); + ptrByte += sizeof(uint64_t); + v64 = pwdlen; + memcpy(ptrByte, &v64, sizeof(int64_t)); + ptrByte += sizeof(uint64_t); + v64 = saltlen; + memcpy(ptrByte, &v64, sizeof(int64_t)); + ptrByte += sizeof(uint64_t); + v64 = timeCost; + memcpy(ptrByte, &v64, sizeof(int64_t)); + ptrByte += sizeof(uint64_t); + v64 = nRows; + memcpy(ptrByte, &v64, sizeof(int64_t)); + ptrByte += sizeof(uint64_t); + v64 = nCols; + memcpy(ptrByte, &v64, sizeof(int64_t)); + ptrByte += sizeof(uint64_t); + + //Now comes the padding + *ptrByte = 0x80; //first byte of padding: right after the password + ptrByte = (byte*) wholeMatrix; //resets the pointer to the start of the memory matrix + ptrByte += nBlocksInput * BLOCK_LEN_BLAKE2_SAFE_BYTES - 1; //sets the pointer to the correct position: end of incomplete block + *ptrByte ^= 0x01; //last byte of padding: at the end of the last incomplete block + //==========================================================================/ + + //======================= Initializing the Sponge State ====================// + //Sponge state: 16 uint64_t, BLOCK_LEN_INT64 words of them for the bitrate (b) and the remainder for the capacity (c) + uint64_t state[16]; + initState(state); + //==========================================================================/ + + //================================ Setup Phase =============================// + //Absorbing salt, password and basil: this is the only place in which the block length is hard-coded to 512 bits + ptrWord = wholeMatrix; + for (i = 0; i < nBlocksInput; i++) { + absorbBlockBlake2Safe(state, ptrWord); //absorbs each block of pad(pwd || salt || basil) + ptrWord += BLOCK_LEN; //goes to next block of pad(pwd || salt || basil) + } + + //Initializes M[0] and M[1] + reducedSqueezeRow0(state, memMatrix[0], nCols); //The locally copied password is most likely overwritten here + + reducedDuplexRow1(state, memMatrix[0], memMatrix[1], nCols); + + do { + //M[row] = rand; //M[row*] = M[row*] XOR rotW(rand) + + reducedDuplexRowSetup(state, memMatrix[prev], memMatrix[rowa], memMatrix[row], nCols); + + //updates the value of row* (deterministically picked during Setup)) + rowa = (rowa + step) & (window - 1); + //update prev: it now points to the last row ever computed + prev = row; + //updates row: goes to the next row to be computed + row++; + + //Checks if all rows in the window where visited. + if (rowa == 0) { + step = window + gap; //changes the step: approximately doubles its value + window *= 2; //doubles the size of the re-visitation window + gap = -gap; //inverts the modifier to the step + } + + } while (row < nRows); + //==========================================================================/ + + //============================ Wandering Phase =============================// + row = 0; //Resets the visitation to the first row of the memory matrix + for (tau = 1; tau <= timeCost; tau++) { + //Step is approximately half the number of all rows of the memory matrix for an odd tau; otherwise, it is -1 + step = (tau % 2 == 0) ? -1 : nRows / 2 - 1; + do { + //Selects a pseudorandom index row* + //------------------------------------------------------------------------------------------ + rowa = state[0] & (unsigned int)(nRows-1); //(USE THIS IF nRows IS A POWER OF 2) + //rowa = state[0] % nRows; //(USE THIS FOR THE "GENERIC" CASE) + //------------------------------------------------------------------------------------------ + + //Performs a reduced-round duplexing operation over M[row*] XOR M[prev], updating both M[row*] and M[row] + reducedDuplexRow(state, memMatrix[prev], memMatrix[rowa], memMatrix[row], nCols); + + //update prev: it now points to the last row ever computed + prev = row; + + //updates row: goes to the next row to be computed + //------------------------------------------------------------------------------------------ + row = (row + step) & (unsigned int)(nRows-1); //(USE THIS IF nRows IS A POWER OF 2) + //row = (row + step) % nRows; //(USE THIS FOR THE "GENERIC" CASE) + //------------------------------------------------------------------------------------------ + + } while (row != 0); + } + + //============================ Wrap-up Phase ===============================// + //Absorbs the last block of the memory matrix + absorbBlock(state, memMatrix[rowa]); + + //Squeezes the key + squeeze(state, K, (unsigned int) kLen); + + //========================= Freeing the memory =============================// + free(memMatrix); + free(wholeMatrix); + + return 0; +} diff --git a/lyra2/Lyra2.h b/lyra2/Lyra2.h new file mode 100644 index 0000000..edf9179 --- /dev/null +++ b/lyra2/Lyra2.h @@ -0,0 +1,42 @@ +/** + * Header file for the Lyra2 Password Hashing Scheme (PHS). + * + * Author: The Lyra PHC team (http://www.lyra-kdf.net/) -- 2014. + * + * This software is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef LYRA2_H_ +#define LYRA2_H_ + +#include + +typedef unsigned char byte; + +//Block length required so Blake2's Initialization Vector (IV) is not overwritten (THIS SHOULD NOT BE MODIFIED) +#define BLOCK_LEN_BLAKE2_SAFE_INT64 8 //512 bits (=64 bytes, =8 uint64_t) +#define BLOCK_LEN_BLAKE2_SAFE_BYTES (BLOCK_LEN_BLAKE2_SAFE_INT64 * 8) //same as above, in bytes + + +#ifdef BLOCK_LEN_BITS + #define BLOCK_LEN_INT64 (BLOCK_LEN_BITS/64) //Block length: 768 bits (=96 bytes, =12 uint64_t) + #define BLOCK_LEN_BYTES (BLOCK_LEN_BITS/8) //Block length, in bytes +#else //default block lenght: 768 bits + #define BLOCK_LEN_INT64 12 //Block length: 768 bits (=96 bytes, =12 uint64_t) + #define BLOCK_LEN_BYTES (BLOCK_LEN_INT64 * 8) //Block length, in bytes +#endif + +int LYRA2(void *K, int64_t kLen, const void *pwd, int32_t pwdlen, const void *salt, int32_t saltlen, int64_t timeCost, const int16_t nRows, const int16_t nCols); + +#endif /* LYRA2_H_ */ diff --git a/lyra2/Sponge.c b/lyra2/Sponge.c new file mode 100644 index 0000000..a698229 --- /dev/null +++ b/lyra2/Sponge.c @@ -0,0 +1,410 @@ +/** + * A simple implementation of Blake2b's internal permutation + * in the form of a sponge. + * + * Author: The Lyra PHC team (http://www.lyra-kdf.net/) -- 2014. + * + * This software is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include "Sponge.h" +#include "Lyra2.h" + + +/** + * Initializes the Sponge State. The first 512 bits are set to zeros and the remainder + * receive Blake2b's IV as per Blake2b's specification. Note: Even though sponges + * typically have their internal state initialized with zeros, Blake2b's G function + * has a fixed point: if the internal state and message are both filled with zeros. the + * resulting permutation will always be a block filled with zeros; this happens because + * Blake2b does not use the constants originally employed in Blake2 inside its G function, + * relying on the IV for avoiding possible fixed points. + * + * @param state The 1024-bit array to be initialized + */ +void initState(uint64_t state[/*16*/]) { + //First 512 bis are zeros + memset(state, 0, 64); + //Remainder BLOCK_LEN_BLAKE2_SAFE_BYTES are reserved to the IV + state[8] = blake2b_IV[0]; + state[9] = blake2b_IV[1]; + state[10] = blake2b_IV[2]; + state[11] = blake2b_IV[3]; + state[12] = blake2b_IV[4]; + state[13] = blake2b_IV[5]; + state[14] = blake2b_IV[6]; + state[15] = blake2b_IV[7]; +} + +/** + * Execute Blake2b's G function, with all 12 rounds. + * + * @param v A 1024-bit (16 uint64_t) array to be processed by Blake2b's G function + */ +__inline static void blake2bLyra(uint64_t *v) { + ROUND_LYRA(0); + ROUND_LYRA(1); + ROUND_LYRA(2); + ROUND_LYRA(3); + ROUND_LYRA(4); + ROUND_LYRA(5); + ROUND_LYRA(6); + ROUND_LYRA(7); + ROUND_LYRA(8); + ROUND_LYRA(9); + ROUND_LYRA(10); + ROUND_LYRA(11); +} + +/** + * Executes a reduced version of Blake2b's G function with only one round + * @param v A 1024-bit (16 uint64_t) array to be processed by Blake2b's G function + */ +__inline static void reducedBlake2bLyra(uint64_t *v) { + ROUND_LYRA(0); +} + +/** + * Performs a squeeze operation, using Blake2b's G function as the + * internal permutation + * + * @param state The current state of the sponge + * @param out Array that will receive the data squeezed + * @param len The number of bytes to be squeezed into the "out" array + */ +void squeeze(uint64_t *state, byte *out, unsigned int len) +{ + int fullBlocks = len / BLOCK_LEN_BYTES; + byte *ptr = out; + int i; + //Squeezes full blocks + for (i = 0; i < fullBlocks; i++) { + memcpy(ptr, state, BLOCK_LEN_BYTES); + blake2bLyra(state); + ptr += BLOCK_LEN_BYTES; + } + + //Squeezes remaining bytes + memcpy(ptr, state, (len % BLOCK_LEN_BYTES)); +} + +/** + * Performs an absorb operation for a single block (BLOCK_LEN_INT64 words + * of type uint64_t), using Blake2b's G function as the internal permutation + * + * @param state The current state of the sponge + * @param in The block to be absorbed (BLOCK_LEN_INT64 words) + */ +void absorbBlock(uint64_t *state, const uint64_t *in) +{ + //XORs the first BLOCK_LEN_INT64 words of "in" with the current state + state[0] ^= in[0]; + state[1] ^= in[1]; + state[2] ^= in[2]; + state[3] ^= in[3]; + state[4] ^= in[4]; + state[5] ^= in[5]; + state[6] ^= in[6]; + state[7] ^= in[7]; + state[8] ^= in[8]; + state[9] ^= in[9]; + state[10] ^= in[10]; + state[11] ^= in[11]; + + //Applies the transformation f to the sponge's state + blake2bLyra(state); +} + +/** + * Performs an absorb operation for a single block (BLOCK_LEN_BLAKE2_SAFE_INT64 + * words of type uint64_t), using Blake2b's G function as the internal permutation + * + * @param state The current state of the sponge + * @param in The block to be absorbed (BLOCK_LEN_BLAKE2_SAFE_INT64 words) + */ +void absorbBlockBlake2Safe(uint64_t *state, const uint64_t *in) +{ + //XORs the first BLOCK_LEN_BLAKE2_SAFE_INT64 words of "in" with the current state + + state[0] ^= in[0]; + state[1] ^= in[1]; + state[2] ^= in[2]; + state[3] ^= in[3]; + state[4] ^= in[4]; + state[5] ^= in[5]; + state[6] ^= in[6]; + state[7] ^= in[7]; + + //Applies the transformation f to the sponge's state + blake2bLyra(state); +} + +/** + * Performs a reduced squeeze operation for a single row, from the highest to + * the lowest index, using the reduced-round Blake2b's G function as the + * internal permutation + * + * @param state The current state of the sponge + * @param rowOut Row to receive the data squeezed + */ +void reducedSqueezeRow0(uint64_t* state, uint64_t* rowOut, const uint32_t nCols) +{ + uint64_t* ptrWord = rowOut + (nCols-1)*BLOCK_LEN_INT64; //In Lyra2: pointer to M[0][C-1] + unsigned int i; + //M[row][C-1-col] = H.reduced_squeeze() + for (i = 0; i < nCols; i++) { + ptrWord[0] = state[0]; + ptrWord[1] = state[1]; + ptrWord[2] = state[2]; + ptrWord[3] = state[3]; + ptrWord[4] = state[4]; + ptrWord[5] = state[5]; + ptrWord[6] = state[6]; + ptrWord[7] = state[7]; + ptrWord[8] = state[8]; + ptrWord[9] = state[9]; + ptrWord[10] = state[10]; + ptrWord[11] = state[11]; + + //Goes to next block (column) that will receive the squeezed data + ptrWord -= BLOCK_LEN_INT64; + + //Applies the reduced-round transformation f to the sponge's state + reducedBlake2bLyra(state); + } +} + +/** + * Performs a reduced duplex operation for a single row, from the highest to + * the lowest index, using the reduced-round Blake2b's G function as the + * internal permutation + * + * @param state The current state of the sponge + * @param rowIn Row to feed the sponge + * @param rowOut Row to receive the sponge's output + */ +void reducedDuplexRow1(uint64_t *state, uint64_t *rowIn, uint64_t *rowOut, const uint32_t nCols) +{ + uint64_t* ptrWordIn = rowIn; //In Lyra2: pointer to prev + uint64_t* ptrWordOut = rowOut + (nCols-1)*BLOCK_LEN_INT64; //In Lyra2: pointer to row + unsigned int i; + + for (i = 0; i < nCols; i++) { + + //Absorbing "M[prev][col]" + state[0] ^= (ptrWordIn[0]); + state[1] ^= (ptrWordIn[1]); + state[2] ^= (ptrWordIn[2]); + state[3] ^= (ptrWordIn[3]); + state[4] ^= (ptrWordIn[4]); + state[5] ^= (ptrWordIn[5]); + state[6] ^= (ptrWordIn[6]); + state[7] ^= (ptrWordIn[7]); + state[8] ^= (ptrWordIn[8]); + state[9] ^= (ptrWordIn[9]); + state[10] ^= (ptrWordIn[10]); + state[11] ^= (ptrWordIn[11]); + + //Applies the reduced-round transformation f to the sponge's state + reducedBlake2bLyra(state); + + //M[row][C-1-col] = M[prev][col] XOR rand + ptrWordOut[0] = ptrWordIn[0] ^ state[0]; + ptrWordOut[1] = ptrWordIn[1] ^ state[1]; + ptrWordOut[2] = ptrWordIn[2] ^ state[2]; + ptrWordOut[3] = ptrWordIn[3] ^ state[3]; + ptrWordOut[4] = ptrWordIn[4] ^ state[4]; + ptrWordOut[5] = ptrWordIn[5] ^ state[5]; + ptrWordOut[6] = ptrWordIn[6] ^ state[6]; + ptrWordOut[7] = ptrWordIn[7] ^ state[7]; + ptrWordOut[8] = ptrWordIn[8] ^ state[8]; + ptrWordOut[9] = ptrWordIn[9] ^ state[9]; + ptrWordOut[10] = ptrWordIn[10] ^ state[10]; + ptrWordOut[11] = ptrWordIn[11] ^ state[11]; + + //Input: next column (i.e., next block in sequence) + ptrWordIn += BLOCK_LEN_INT64; + //Output: goes to previous column + ptrWordOut -= BLOCK_LEN_INT64; + } +} + +/** + * Performs a duplexing operation over "M[rowInOut][col] [+] M[rowIn][col]" (i.e., + * the wordwise addition of two columns, ignoring carries between words). The + * output of this operation, "rand", is then used to make + * "M[rowOut][(N_COLS-1)-col] = M[rowIn][col] XOR rand" and + * "M[rowInOut][col] = M[rowInOut][col] XOR rotW(rand)", where rotW is a 64-bit + * rotation to the left and N_COLS is a system parameter. + * + * @param state The current state of the sponge + * @param rowIn Row used only as input + * @param rowInOut Row used as input and to receive output after rotation + * @param rowOut Row receiving the output + * + */ +void reducedDuplexRowSetup(uint64_t *state, uint64_t *rowIn, uint64_t *rowInOut, uint64_t *rowOut, const uint32_t nCols) +{ + uint64_t* ptrWordIn = rowIn; //In Lyra2: pointer to prev + uint64_t* ptrWordInOut = rowInOut; //In Lyra2: pointer to row* + uint64_t* ptrWordOut = rowOut + (nCols-1)*BLOCK_LEN_INT64; //In Lyra2: pointer to row + unsigned int i; + + for (i = 0; i < nCols; i++) { + + //Absorbing "M[prev] [+] M[row*]" + state[0] ^= (ptrWordIn[0] + ptrWordInOut[0]); + state[1] ^= (ptrWordIn[1] + ptrWordInOut[1]); + state[2] ^= (ptrWordIn[2] + ptrWordInOut[2]); + state[3] ^= (ptrWordIn[3] + ptrWordInOut[3]); + state[4] ^= (ptrWordIn[4] + ptrWordInOut[4]); + state[5] ^= (ptrWordIn[5] + ptrWordInOut[5]); + state[6] ^= (ptrWordIn[6] + ptrWordInOut[6]); + state[7] ^= (ptrWordIn[7] + ptrWordInOut[7]); + state[8] ^= (ptrWordIn[8] + ptrWordInOut[8]); + state[9] ^= (ptrWordIn[9] + ptrWordInOut[9]); + state[10] ^= (ptrWordIn[10] + ptrWordInOut[10]); + state[11] ^= (ptrWordIn[11] + ptrWordInOut[11]); + + //Applies the reduced-round transformation f to the sponge's state + reducedBlake2bLyra(state); + + //M[row][col] = M[prev][col] XOR rand + ptrWordOut[0] = ptrWordIn[0] ^ state[0]; + ptrWordOut[1] = ptrWordIn[1] ^ state[1]; + ptrWordOut[2] = ptrWordIn[2] ^ state[2]; + ptrWordOut[3] = ptrWordIn[3] ^ state[3]; + ptrWordOut[4] = ptrWordIn[4] ^ state[4]; + ptrWordOut[5] = ptrWordIn[5] ^ state[5]; + ptrWordOut[6] = ptrWordIn[6] ^ state[6]; + ptrWordOut[7] = ptrWordIn[7] ^ state[7]; + ptrWordOut[8] = ptrWordIn[8] ^ state[8]; + ptrWordOut[9] = ptrWordIn[9] ^ state[9]; + ptrWordOut[10] = ptrWordIn[10] ^ state[10]; + ptrWordOut[11] = ptrWordIn[11] ^ state[11]; + + //M[row*][col] = M[row*][col] XOR rotW(rand) + ptrWordInOut[0] ^= state[11]; + ptrWordInOut[1] ^= state[0]; + ptrWordInOut[2] ^= state[1]; + ptrWordInOut[3] ^= state[2]; + ptrWordInOut[4] ^= state[3]; + ptrWordInOut[5] ^= state[4]; + ptrWordInOut[6] ^= state[5]; + ptrWordInOut[7] ^= state[6]; + ptrWordInOut[8] ^= state[7]; + ptrWordInOut[9] ^= state[8]; + ptrWordInOut[10] ^= state[9]; + ptrWordInOut[11] ^= state[10]; + + //Inputs: next column (i.e., next block in sequence) + ptrWordInOut += BLOCK_LEN_INT64; + ptrWordIn += BLOCK_LEN_INT64; + //Output: goes to previous column + ptrWordOut -= BLOCK_LEN_INT64; + } +} + +/** + * Performs a duplexing operation over "M[rowInOut][col] [+] M[rowIn][col]" (i.e., + * the wordwise addition of two columns, ignoring carries between words). The + * output of this operation, "rand", is then used to make + * "M[rowOut][col] = M[rowOut][col] XOR rand" and + * "M[rowInOut][col] = M[rowInOut][col] XOR rotW(rand)", where rotW is a 64-bit + * rotation to the left. + * + * @param state The current state of the sponge + * @param rowIn Row used only as input + * @param rowInOut Row used as input and to receive output after rotation + * @param rowOut Row receiving the output + * + */ +void reducedDuplexRow(uint64_t *state, uint64_t *rowIn, uint64_t *rowInOut, uint64_t *rowOut, const uint32_t nCols) +{ + uint64_t* ptrWordInOut = rowInOut; //In Lyra2: pointer to row* + uint64_t* ptrWordIn = rowIn; //In Lyra2: pointer to prev + uint64_t* ptrWordOut = rowOut; //In Lyra2: pointer to row + unsigned int i; + + for (i = 0; i < nCols; i++) { + + //Absorbing "M[prev] [+] M[row*]" + state[0] ^= (ptrWordIn[0] + ptrWordInOut[0]); + state[1] ^= (ptrWordIn[1] + ptrWordInOut[1]); + state[2] ^= (ptrWordIn[2] + ptrWordInOut[2]); + state[3] ^= (ptrWordIn[3] + ptrWordInOut[3]); + state[4] ^= (ptrWordIn[4] + ptrWordInOut[4]); + state[5] ^= (ptrWordIn[5] + ptrWordInOut[5]); + state[6] ^= (ptrWordIn[6] + ptrWordInOut[6]); + state[7] ^= (ptrWordIn[7] + ptrWordInOut[7]); + state[8] ^= (ptrWordIn[8] + ptrWordInOut[8]); + state[9] ^= (ptrWordIn[9] + ptrWordInOut[9]); + state[10] ^= (ptrWordIn[10] + ptrWordInOut[10]); + state[11] ^= (ptrWordIn[11] + ptrWordInOut[11]); + + //Applies the reduced-round transformation f to the sponge's state + reducedBlake2bLyra(state); + + //M[rowOut][col] = M[rowOut][col] XOR rand + ptrWordOut[0] ^= state[0]; + ptrWordOut[1] ^= state[1]; + ptrWordOut[2] ^= state[2]; + ptrWordOut[3] ^= state[3]; + ptrWordOut[4] ^= state[4]; + ptrWordOut[5] ^= state[5]; + ptrWordOut[6] ^= state[6]; + ptrWordOut[7] ^= state[7]; + ptrWordOut[8] ^= state[8]; + ptrWordOut[9] ^= state[9]; + ptrWordOut[10] ^= state[10]; + ptrWordOut[11] ^= state[11]; + + //M[rowInOut][col] = M[rowInOut][col] XOR rotW(rand) + ptrWordInOut[0] ^= state[11]; + ptrWordInOut[1] ^= state[0]; + ptrWordInOut[2] ^= state[1]; + ptrWordInOut[3] ^= state[2]; + ptrWordInOut[4] ^= state[3]; + ptrWordInOut[5] ^= state[4]; + ptrWordInOut[6] ^= state[5]; + ptrWordInOut[7] ^= state[6]; + ptrWordInOut[8] ^= state[7]; + ptrWordInOut[9] ^= state[8]; + ptrWordInOut[10] ^= state[9]; + ptrWordInOut[11] ^= state[10]; + + //Goes to next block + ptrWordOut += BLOCK_LEN_INT64; + ptrWordInOut += BLOCK_LEN_INT64; + ptrWordIn += BLOCK_LEN_INT64; + } +} + +/** + * Prints an array of unsigned chars + */ +void printArray(unsigned char *array, unsigned int size, char *name) +{ + unsigned int i; + printf("%s: ", name); + for (i = 0; i < size; i++) { + printf("%2x|", array[i]); + } + printf("\n"); +} + +//////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/lyra2/Sponge.h b/lyra2/Sponge.h new file mode 100644 index 0000000..7fcd093 --- /dev/null +++ b/lyra2/Sponge.h @@ -0,0 +1,88 @@ +/** + * Header file for Blake2b's internal permutation in the form of a sponge. + * This code is based on the original Blake2b's implementation provided by + * Samuel Neves (https://blake2.net/) + * + * Author: The Lyra PHC team (http://www.lyra-kdf.net/) -- 2014. + * + * This software is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SPONGE_H_ +#define SPONGE_H_ + +#include + +/* Blake2b IV Array */ +static const uint64_t blake2b_IV[8] = +{ + 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, + 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, + 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, + 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL +}; + +/* Blake2b's rotation */ +static __inline uint64_t rotr64(const uint64_t w, const unsigned c) { +#ifdef _MSC_VER + return _rotr64(w, c); +#else + return ( w >> c ) | ( w << ( 64 - c ) ); +#endif +} + +/* Blake2b's G function */ +#define G(r,i,a,b,c,d) do { \ + a = a + b; \ + d = rotr64(d ^ a, 32); \ + c = c + d; \ + b = rotr64(b ^ c, 24); \ + a = a + b; \ + d = rotr64(d ^ a, 16); \ + c = c + d; \ + b = rotr64(b ^ c, 63); \ + } while(0) + + +/*One Round of the Blake2b's compression function*/ +#define ROUND_LYRA(r) \ + G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \ + G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \ + G(r,2,v[ 2],v[ 6],v[10],v[14]); \ + G(r,3,v[ 3],v[ 7],v[11],v[15]); \ + G(r,4,v[ 0],v[ 5],v[10],v[15]); \ + G(r,5,v[ 1],v[ 6],v[11],v[12]); \ + G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \ + G(r,7,v[ 3],v[ 4],v[ 9],v[14]); + +//---- Housekeeping +void initState(uint64_t state[/*16*/]); + +//---- Squeezes +void squeeze(uint64_t *state, unsigned char *out, unsigned int len); +void reducedSqueezeRow0(uint64_t* state, uint64_t* row, const uint32_t nCols); + +//---- Absorbs +void absorbBlock(uint64_t *state, const uint64_t *in); +void absorbBlockBlake2Safe(uint64_t *state, const uint64_t *in); + +//---- Duplexes +void reducedDuplexRow1(uint64_t *state, uint64_t *rowIn, uint64_t *rowOut, const uint32_t nCols); +void reducedDuplexRowSetup(uint64_t *state, uint64_t *rowIn, uint64_t *rowInOut, uint64_t *rowOut, const uint32_t nCols); +void reducedDuplexRow(uint64_t *state, uint64_t *rowIn, uint64_t *rowInOut, uint64_t *rowOut, const uint32_t nCols); + +//---- Misc +void printArray(unsigned char *array, unsigned int size, char *name); + +#endif /* SPONGE_H_ */ diff --git a/lyra2/cuda_lyra2.cu b/lyra2/cuda_lyra2.cu new file mode 100644 index 0000000..227e4b6 --- /dev/null +++ b/lyra2/cuda_lyra2.cu @@ -0,0 +1,436 @@ +/** +* Lyra2 (v1) cuda implementation based on djm34 work - SM 5/5.2 +* Improved by Nanashi Meiyo-Meijin - 2016 +* tpruvot@github 2015 + +* Further improved on 970 by utilizing for loops in order to +* reduce the code size. +* Provos Alexis - 2016 +* +*/ + +#include +#include +#include "cuda_vectors.h" +#include "cuda_helper.h" + +#ifdef __INTELLISENSE__ +/* just for vstudio code colors */ +#define __CUDA_ARCH__ 520 +#endif + +#define TPB52 32 +#define TPB50 16 + +#define Nrow 8 +#define Ncol 8 +#define memshift 3 + +__constant__ const uint2x4 blake2b_IV[2] = { + 0xf3bcc908lu, 0x6a09e667lu, + 0x84caa73blu, 0xbb67ae85lu, + 0xfe94f82blu, 0x3c6ef372lu, + 0x5f1d36f1lu, 0xa54ff53alu, + 0xade682d1lu, 0x510e527flu, + 0x2b3e6c1flu, 0x9b05688clu, + 0xfb41bd6blu, 0x1f83d9ablu, + 0x137e2179lu, 0x5be0cd19lu +}; + +//#include "cuda_lyra2_sm2.cuh" +#include "cuda_lyra2_sm5.cuh" + +#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ > 500 + +#include "cuda_vectors.h" + +#ifdef __INTELLISENSE__ +/* just for vstudio code colors */ +__device__ uint32_t __shfl(uint32_t a, uint32_t b, uint32_t c); +#endif + +__device__ uint2 *DMatrix; + +__device__ +void LD4S(uint2 res[3], const uint32_t row, const uint32_t col, const uint2* shared_mem) +{ + const uint32_t s0 = (Ncol * row + col) * memshift; + + #pragma unroll 3 + for (uint32_t j = 0; j < 3; j++) + res[j] = shared_mem[((s0 + j) * blockDim.y + threadIdx.y) * blockDim.x + threadIdx.x]; +} + +__device__ +void ST4S(const uint32_t row, const uint32_t col, const uint2 data[3], uint2* shared_mem) +{ + const uint32_t s0 = (Ncol * row + col) * memshift; + + #pragma unroll 3 + for (uint32_t j = 0; j < 3; j++) + shared_mem[((s0 + j) * blockDim.y + threadIdx.y) * blockDim.x + threadIdx.x] = data[j]; +} + +__device__ __forceinline__ uint2 __shfl(uint2 a, uint32_t b, uint32_t c) +{ + return make_uint2(__shfl(a.x, b, c), __shfl(a.y, b, c)); +} + +__device__ __forceinline__ void __shfl3(uint2 &a1, uint2 &a2, uint2 &a3, uint32_t b1, uint32_t b2, uint32_t b3, uint32_t c) +{ + a1 = __shfl(a1, b1, c); + a2 = __shfl(a2, b2, c); + a3 = __shfl(a3, b3, c); +} + +static __device__ +void Gfunc(uint2 &a, uint2 &b, uint2 &c, uint2 &d) +{ + a+= b; + d = SWAPUINT2(d^a); + c+= d; + b = ROR24(b^c); + a+= b; + d = ROR16(d^a); + c+= d; + b = ROR2(b^c, 63); +} + +static __device__ +void round_lyra(uint2 s[4]){ + Gfunc(s[0], s[1], s[2], s[3]); + __shfl3(s[1], s[2], s[3], threadIdx.x + 1, threadIdx.x + 2, threadIdx.x + 3, 4); + Gfunc(s[0], s[1], s[2], s[3]); + __shfl3(s[1], s[2], s[3], threadIdx.x + 3, threadIdx.x + 2, threadIdx.x + 1, 4); +} + +static __device__ +void round_lyra(uint2x4 *const __restrict__ s) +{ + Gfunc(s[0].x, s[1].x, s[2].x, s[3].x); + Gfunc(s[0].y, s[1].y, s[2].y, s[3].y); + Gfunc(s[0].z, s[1].z, s[2].z, s[3].z); + Gfunc(s[0].w, s[1].w, s[2].w, s[3].w); + Gfunc(s[0].x, s[1].y, s[2].z, s[3].w); + Gfunc(s[0].y, s[1].z, s[2].w, s[3].x); + Gfunc(s[0].z, s[1].w, s[2].x, s[3].y); + Gfunc(s[0].w, s[1].x, s[2].y, s[3].z); +} + +static __device__ +void reduceDuplex(uint2 state[4], uint2* shared) +{ + uint2 state1[3]; + + + #pragma unroll 8 + for (int i = 0; i < Nrow; i++) + { + ST4S(0, Ncol - i - 1, state, shared); + + round_lyra(state); + } + + #pragma unroll 8 + for (int i = 0; i < Nrow; i++) + { + LD4S(state1, 0, i, shared); + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state[j] ^= state1[j]; + + round_lyra(state); + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state1[j] ^= state[j]; + + ST4S(1, Ncol - i - 1, state1, shared); + } +} + +static __device__ +void reduceDuplexRowSetup(const int rowIn, const int rowInOut, const int rowOut, uint2 state[4], uint2* shared) +{ + uint2 state1[3], state2[3]; + + #pragma unroll 1 + for (uint32_t i = 0; i < Nrow; i++) + { + LD4S(state1, rowIn, i, shared); + LD4S(state2, rowInOut, i, shared); + for (int j = 0; j < 3; j++) + state[j] ^= state1[j] + state2[j]; + + round_lyra(state); + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state1[j] ^= state[j]; + + ST4S(rowOut, Ncol - i - 1, state1, shared); + + //一個手å‰ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã‹ã‚‰ãƒ‡ãƒ¼ã‚¿ã‚’è²°ã†(åŒæ™‚ã«ä¸€å€‹å…ˆã®ã‚¹ãƒ¬ãƒƒãƒ‰ã«ãƒ‡ãƒ¼ã‚¿ã‚’é€ã‚‹) + uint2 Data0 = state[0]; + uint2 Data1 = state[1]; + uint2 Data2 = state[2]; + __shfl3(Data0, Data1, Data2, threadIdx.x - 1, threadIdx.x - 1, threadIdx.x - 1, 4); + + if (threadIdx.x == 0) + { + state2[0] ^= Data2; + state2[1] ^= Data0; + state2[2] ^= Data1; + } + else + { + state2[0] ^= Data0; + state2[1] ^= Data1; + state2[2] ^= Data2; + } + + ST4S(rowInOut, i, state2, shared); + } +} + +static __device__ +void reduceDuplexRowt(const int rowIn, const int rowInOut, const int rowOut, uint2 state[4], uint2* shared) +{ + for (uint32_t i = 0; i < Nrow; i++) + { + uint2 state1[3], state2[3]; + + LD4S(state1, rowIn, i, shared); + LD4S(state2, rowInOut, i, shared); + + #pragma unroll + for (int j = 0; j < 3; j++) + state[j] ^= state1[j] + state2[j]; + + round_lyra(state); + + //一個手å‰ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã‹ã‚‰ãƒ‡ãƒ¼ã‚¿ã‚’è²°ã†(åŒæ™‚ã«ä¸€å€‹å…ˆã®ã‚¹ãƒ¬ãƒƒãƒ‰ã«ãƒ‡ãƒ¼ã‚¿ã‚’é€ã‚‹) + uint2 Data0 = state[0]; + uint2 Data1 = state[1]; + uint2 Data2 = state[2]; + __shfl3(Data0, Data1, Data2, threadIdx.x - 1, threadIdx.x - 1, threadIdx.x - 1, 4); + + if (threadIdx.x == 0) + { + state2[0] ^= Data2; + state2[1] ^= Data0; + state2[2] ^= Data1; + } + else + { + state2[0] ^= Data0; + state2[1] ^= Data1; + state2[2] ^= Data2; + } + + ST4S(rowInOut, i, state2, shared); + + LD4S(state1, rowOut, i, shared); + + #pragma unroll + for (int j = 0; j < 3; j++) + state1[j] ^= state[j]; + + ST4S(rowOut, i, state1, shared); + } +} + +static __device__ +void reduceDuplexRowt_8(const int rowInOut, uint2* state, uint2* shared) +{ + + uint2 state1[3], state2[3], last[3]; + + LD4S(state1, 2, 0, shared); + LD4S(last, rowInOut, 0, shared); + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state[j] ^= state1[j] + last[j]; + + round_lyra(state); + + //一個手å‰ã®ã‚¹ãƒ¬ãƒƒãƒ‰ã‹ã‚‰ãƒ‡ãƒ¼ã‚¿ã‚’è²°ã†(åŒæ™‚ã«ä¸€å€‹å…ˆã®ã‚¹ãƒ¬ãƒƒãƒ‰ã«ãƒ‡ãƒ¼ã‚¿ã‚’é€ã‚‹) + uint2 Data0 = state[0]; + uint2 Data1 = state[1]; + uint2 Data2 = state[2]; + __shfl3(Data0, Data1, Data2, threadIdx.x - 1, threadIdx.x - 1, threadIdx.x - 1, 4); + + if (threadIdx.x == 0) + { + last[0] ^= Data2; + last[1] ^= Data0; + last[2] ^= Data1; + } + else + { + last[0] ^= Data0; + last[1] ^= Data1; + last[2] ^= Data2; + } + + if (rowInOut == 5) + { + #pragma unroll 3 + for (int j = 0; j < 3; j++) + last[j] ^= state[j]; + } + + #pragma unroll 1 + for (uint32_t i = 1; i < Nrow; i++) + { + LD4S(state1, 2, i, shared); + LD4S(state2, rowInOut, i, shared); + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state[j] ^= state1[j] + state2[j]; + + round_lyra(state); + } + + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state[j] ^= last[j]; +} + +__global__ __launch_bounds__(512, 1) +void lyra2_gpu_hash_32_1(uint32_t threads,const uint2* __restrict__ g_hash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads) + { + uint2x4 state[4]; + + state[0].x = state[1].x = __ldg(&g_hash[thread + threads * 0]); + state[0].y = state[1].y = __ldg(&g_hash[thread + threads * 1]); + state[0].z = state[1].z = __ldg(&g_hash[thread + threads * 2]); + state[0].w = state[1].w = __ldg(&g_hash[thread + threads * 3]); + state[2] = blake2b_IV[0]; + state[3] = blake2b_IV[1]; + + for (uint32_t i = 0; i<24; i++) + round_lyra(state); //because 12 is not enough + + ((uint2x4*)DMatrix)[threads * 0 + thread] = state[0]; + ((uint2x4*)DMatrix)[threads * 1 + thread] = state[1]; + ((uint2x4*)DMatrix)[threads * 2 + thread] = state[2]; + ((uint2x4*)DMatrix)[threads * 3 + thread] = state[3]; + } +} + +__global__ __launch_bounds__(TPB52, 1) +void lyra2_gpu_hash_32_2(uint32_t threads) +{ + const uint32_t thread = blockDim.y * blockIdx.x + threadIdx.y; + + __shared__ uint2 shared[192*TPB52]; + + if (thread < threads) + { + uint2 state[4]; + state[0] = __ldg(&DMatrix[(0 * threads + thread) * blockDim.x + threadIdx.x]); + state[1] = __ldg(&DMatrix[(1 * threads + thread) * blockDim.x + threadIdx.x]); + state[2] = __ldg(&DMatrix[(2 * threads + thread) * blockDim.x + threadIdx.x]); + state[3] = __ldg(&DMatrix[(3 * threads + thread) * blockDim.x + threadIdx.x]); + + reduceDuplex(state,shared); + + reduceDuplexRowSetup(1, 0, 2, state,shared); + reduceDuplexRowSetup(2, 1, 3, state,shared); + + for(int i=3;i<7;i++){ + reduceDuplexRowSetup(i, 8%(i+1), i+1, state,shared); + } + + uint32_t rowa = __shfl(state[0].x, 0, 4) & 7; + uint32_t prev = 7; + for(int i=0;i<21;i+=3){ + reduceDuplexRowt(prev, rowa, i&7, state,shared); + prev = i&7; + rowa = __shfl(state[0].x, 0, 4) & 7; + } + reduceDuplexRowt_8(rowa, state,shared); + + DMatrix[(0 * threads + thread) * blockDim.x + threadIdx.x] = state[0]; + DMatrix[(1 * threads + thread) * blockDim.x + threadIdx.x] = state[1]; + DMatrix[(2 * threads + thread) * blockDim.x + threadIdx.x] = state[2]; + DMatrix[(3 * threads + thread) * blockDim.x + threadIdx.x] = state[3]; + } +} + +__global__ __launch_bounds__(512, 1) +void lyra2_gpu_hash_32_3(uint32_t threads, uint2 *g_hash) +{ + const uint32_t thread = blockDim.x * blockIdx.x + threadIdx.x; + + uint2x4 state[4]; + + if (thread < threads) + { + state[0] = __ldg4(&((uint2x4*)DMatrix)[threads * 0 + thread]); + state[1] = __ldg4(&((uint2x4*)DMatrix)[threads * 1 + thread]); + state[2] = __ldg4(&((uint2x4*)DMatrix)[threads * 2 + thread]); + state[3] = __ldg4(&((uint2x4*)DMatrix)[threads * 3 + thread]); + + for (uint32_t i = 0; i < 12; i++) + round_lyra(state); + + g_hash[thread + threads * 0] = state[0].x; + g_hash[thread + threads * 1] = state[0].y; + g_hash[thread + threads * 2] = state[0].z; + g_hash[thread + threads * 3] = state[0].w; + + } //thread +} +#else +#if __CUDA_ARCH__ < 500 + +/* for unsupported SM arch */ +__device__ void* DMatrix; +#endif +__global__ void lyra2_gpu_hash_32_1(uint32_t threads, const uint2* __restrict__ g_hash) {} +__global__ void lyra2_gpu_hash_32_2(uint32_t threads) {} +__global__ void lyra2_gpu_hash_32_3(uint32_t threads, uint2 *g_hash) {} +#endif + +__host__ +void lyra2_cpu_init(int thr_id, uint32_t threads, uint2* d_matrix) +{ + // just assign the device pointer allocated in main loop + cudaMemcpyToSymbol(DMatrix, &d_matrix, sizeof(uint64_t*), 0, cudaMemcpyHostToDevice); +} + +__host__ +void lyra2_cpu_hash_32(int thr_id, uint32_t threads, uint2* d_hash) +{ + int dev_id = device_map[thr_id]; + + if (device_sm[dev_id] >= 520) + { + dim3 grid1((threads * 4 + TPB52 - 1) / TPB52); + dim3 block1(4, TPB52 >> 2); + + dim3 grid2((threads + 512 - 1) / 64); + dim3 block2(512); + + lyra2_gpu_hash_32_1 << > > (threads, d_hash); + + lyra2_gpu_hash_32_2 << > > (threads); + + lyra2_gpu_hash_32_3 << > > (threads, d_hash); + } + else{ + dim3 grid((threads + TPB50 - 1) / TPB50); + dim3 block(TPB50); + + lyra2_gpu_hash_32 <<< grid, block >>> (threads, d_hash); + } +} diff --git a/lyra2/cuda_lyra2_sm5.cuh b/lyra2/cuda_lyra2_sm5.cuh new file mode 100644 index 0000000..7733413 --- /dev/null +++ b/lyra2/cuda_lyra2_sm5.cuh @@ -0,0 +1,249 @@ +/** +* Lyra2 (v1) cuda implementation based on djm34 work - SM 5/5.2 +* tpruvot@github 2015 +* +* Provos Alexis - 2016 +*/ + +#ifdef __INTELLISENSE__ +/* just for vstudio code colors */ +#undef __CUDA_ARCH__ +#define __CUDA_ARCH__ 500 +#endif + +#if __CUDA_ARCH__ == 500 + +__device__ uint2x4* DMatrix; + +static __device__ __forceinline__ +void Gfunc(uint2 &a, uint2 &b, uint2 &c, uint2 &d) +{ + a += b; d ^= a; d = SWAPUINT2(d); + c += d; b ^= c; b = ROR24(b); + a += b; d ^= a; d = ROR16(d); + c += d; b ^= c; b = ROR2(b, 63); +} + +static __device__ __forceinline__ +void round_lyra(uint2x4* s) +{ + Gfunc(s[0].x, s[1].x, s[2].x, s[3].x); + Gfunc(s[0].y, s[1].y, s[2].y, s[3].y); + Gfunc(s[0].z, s[1].z, s[2].z, s[3].z); + Gfunc(s[0].w, s[1].w, s[2].w, s[3].w); + Gfunc(s[0].x, s[1].y, s[2].z, s[3].w); + Gfunc(s[0].y, s[1].z, s[2].w, s[3].x); + Gfunc(s[0].z, s[1].w, s[2].x, s[3].y); + Gfunc(s[0].w, s[1].x, s[2].y, s[3].z); +} + +static __device__ __forceinline__ +void reduceDuplex(uint2x4 state[4],const uint32_t thread) +{ + uint2x4 state1[3]; + + const uint32_t ps1 = (256 * thread); + const uint32_t ps2 = (memshift * 7 + memshift * 8 + 256 * thread); + + #pragma unroll 4 + for (int i = 0; i < 8; i++){ + const uint32_t s1 = ps1 + i*memshift; + const uint32_t s2 = ps2 - i*memshift; + + #pragma unroll + for (int j = 0; j < 3; j++) + state1[j] = __ldg4(&(DMatrix+s1)[j]); + + #pragma unroll + for (int j = 0; j < 3; j++) + state[j] ^= state1[j]; + + round_lyra(state); + + #pragma unroll + for (int j = 0; j < 3; j++) + state1[j] ^= state[j]; + + #pragma unroll + for (int j = 0; j < 3; j++) + (DMatrix + s2)[j] = state1[j]; + } +} + +static __device__ __forceinline__ +void reduceDuplexRowSetup(const int rowIn, const int rowInOut, const int rowOut, uint2x4 state[4],const uint32_t thread) +{ + uint2x4 state1[3], state2[3]; + + const uint32_t ps1 = ( memshift*8 * rowIn + 256 * thread); + const uint32_t ps2 = ( memshift*8 * rowInOut + 256 * thread); + const uint32_t ps3 = (memshift*7 + memshift*8 * rowOut + 256 * thread); + + #pragma nounroll + for (int i = 0; i < 8; i++) + { + const uint32_t s1 = ps1 + i*memshift; + const uint32_t s2 = ps2 + i*memshift; + const uint32_t s3 = ps3 - i*memshift; + + #pragma unroll + for (int j = 0; j < 3; j++) + state1[j]= __ldg4(&(DMatrix + s1)[j]); + #pragma unroll + for (int j = 0; j < 3; j++) + state2[j]= __ldg4(&(DMatrix + s2)[j]); + + #pragma unroll + for (int j = 0; j < 3; j++) { + uint2x4 tmp = state1[j] + state2[j]; + state[j] ^= tmp; + } + + round_lyra(state); + + #pragma unroll + for (int j = 0; j < 3; j++) { + (DMatrix + s3)[j] = state1[j]^state[ j]; + } + + ((uint2*)state2)[0] ^= ((uint2*)state)[11]; + + #pragma unroll + for (int j = 0; j < 11; j++) + ((uint2*)state2)[j+1] ^= ((uint2*)state)[j]; + + #pragma unroll + for (int j = 0; j < 3; j++) + (DMatrix + s2)[j] = state2[j]; + } +} + +static __device__ __forceinline__ +void reduceDuplexRowt(const int rowIn, const int rowInOut, const int rowOut, uint2x4* state, const uint32_t thread) +{ + const uint32_t ps1 = (memshift * 8 * rowIn + 256 * thread); + const uint32_t ps2 = (memshift * 8 * rowInOut + 256 * thread); + const uint32_t ps3 = (memshift * 8 * rowOut + 256 * thread); + + #pragma unroll 1 + for (int i = 0; i < 8; i++) + { + uint2x4 state1[3], state2[3]; + + const uint32_t s1 = ps1 + i*memshift; + const uint32_t s2 = ps2 + i*memshift; + const uint32_t s3 = ps3 + i*memshift; + + #pragma unroll + for (int j = 0; j < 3; j++) + state1[j] = __ldg4(&(DMatrix + s1)[j]); + + #pragma unroll + for (int j = 0; j < 3; j++) + state2[j] = __ldg4(&(DMatrix + s2)[j]); + + #pragma unroll + for (int j = 0; j < 3; j++) + state1[j] += state2[j]; + + #pragma unroll + for (int j = 0; j < 3; j++) + state[j] ^= state1[j]; + + round_lyra(state); + + ((uint2*)state2)[0] ^= ((uint2*)state)[11]; + + #pragma unroll + for (int j = 0; j < 11; j++) + ((uint2*)state2)[j + 1] ^= ((uint2*)state)[j]; + + if (rowInOut != rowOut) { + #pragma unroll + for (int j = 0; j < 3; j++){ + state1[j]=state[j]^(__ldg4(&(DMatrix + s3)[j])); + } + #pragma unroll + for (int j = 0; j < 3; j++){ + (DMatrix + s3)[j]=state1[j]; + } + }else{ + #pragma unroll + for (int j = 0; j < 3; j++) + state2[j] ^= state[j]; + } + #pragma unroll + for (int j = 0; j < 3; j++) + (DMatrix + s2)[j] = state2[j]; + } +} + +__global__ __launch_bounds__(TPB50, 1) +void lyra2_gpu_hash_32(uint32_t threads, uint2 *g_hash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads) + { + uint2x4 state[4]; + + ((uint2*)state)[0] = __ldg(&g_hash[thread]); + ((uint2*)state)[1] = __ldg(&g_hash[thread + threads]); + ((uint2*)state)[2] = __ldg(&g_hash[thread + threads*2]); + ((uint2*)state)[3] = __ldg(&g_hash[thread + threads*3]); + + state[1] = state[0]; + state[2] = blake2b_IV[0]; + state[3] = blake2b_IV[1]; + + for (int i = 0; i<24; i++) + round_lyra(state); //because 12 is not enough + + const uint32_t ps1 = (memshift * 7 + 256 * thread); + + for (int i = 0; i < 8; i++) + { + const uint32_t s1 = ps1 - memshift * i; + + for (int j = 0; j < 3; j++) + (DMatrix + s1)[j] = (state)[j]; + round_lyra(state); + } + + reduceDuplex(state, thread); + + reduceDuplexRowSetup(1, 0, 2, state, thread); + reduceDuplexRowSetup(2, 1, 3, state, thread); + + for(uint32_t i=3;i<7;i++){ + reduceDuplexRowSetup(i, 8%(i+1), i+1, state, thread); + } + + uint32_t rowa; + int prev=7; + #pragma unroll 1 + for(int i=0;i<23;i+=3){ + rowa = ((uint2*)state)[0].x & 7; + reduceDuplexRowt(prev, rowa, i&7, state, thread); + prev = i&7; + } + + const uint32_t shift = (memshift * 8 * rowa + 256 * thread); + + #pragma unroll + for (int j = 0; j < 3; j++) + state[j] ^= __ldg4(&(DMatrix + shift)[j]); + + for (int i = 0; i < 12; i++) + round_lyra(state); + + g_hash[thread] = ((uint2*)state)[0]; + g_hash[thread + threads] = ((uint2*)state)[1]; + g_hash[thread + threads*2] = ((uint2*)state)[2]; + g_hash[thread + threads*3] = ((uint2*)state)[3]; + } +} +#else +/* for unsupported SM arch */ +__global__ void lyra2_gpu_hash_32(uint32_t threads, uint2 *g_hash) {} +#endif diff --git a/lyra2/cuda_lyra2v2.cu b/lyra2/cuda_lyra2v2.cu new file mode 100644 index 0000000..1a6d5f3 --- /dev/null +++ b/lyra2/cuda_lyra2v2.cu @@ -0,0 +1,459 @@ +/* +* Lyra2v2 kernel merged from nicehash repository +* Based on djm34/VTC sources and incredible 2x boost by Nanashi Meiyo-Meijin (May 2016) +*/ + +#include +#include +#include "cuda_vectors.h" +#include "miner.h" + +#define TPB1 32 +#define TPB2 128 + +#define Nrow 4 +#define Ncol 4 +#define u64type uint4 +#define vectype uint48 +#define memshift 3 + +__device__ __forceinline__ uint2 LD4S(const int index,const uint2* shared_mem) +{ + return shared_mem[(index * blockDim.y + threadIdx.y) * blockDim.x + threadIdx.x]; +} + +__device__ __forceinline__ void ST4S(const int index, const uint2 data, uint2* shared_mem) +{ + shared_mem[(index * blockDim.y + threadIdx.y) * blockDim.x + threadIdx.x] = data; +} + +__device__ __forceinline__ +void Gfunc_v35(uint2 &a, uint2 &b, uint2 &c, uint2 &d){ + a += b;d = SWAPUINT2(d^a); + c += d;b = ROR24(b^c); + a += b;d = ROR16(d^a); + c += d;b = ROR2(b^c, 63); +} + +__device__ __forceinline__ +void round_lyra_v35(uint2x4 s[4]) +{ + Gfunc_v35(s[0].x, s[1].x, s[2].x, s[3].x); + Gfunc_v35(s[0].y, s[1].y, s[2].y, s[3].y); + Gfunc_v35(s[0].z, s[1].z, s[2].z, s[3].z); + Gfunc_v35(s[0].w, s[1].w, s[2].w, s[3].w); + + Gfunc_v35(s[0].x, s[1].y, s[2].z, s[3].w); + Gfunc_v35(s[0].y, s[1].z, s[2].w, s[3].x); + Gfunc_v35(s[0].z, s[1].w, s[2].x, s[3].y); + Gfunc_v35(s[0].w, s[1].x, s[2].y, s[3].z); +} + +__device__ __forceinline__ uint2 __shfl(uint2 a, uint32_t b, uint32_t c) +{ + return make_uint2(__shfl(a.x, b, c), __shfl(a.y, b, c)); +} + +__device__ __forceinline__ +void round_lyra_v35(uint2 s[4]) +{ + Gfunc_v35(s[0], s[1], s[2], s[3]); + s[1] = __shfl(s[1], threadIdx.x + 1, 4); + s[2] = __shfl(s[2], threadIdx.x + 2, 4); + s[3] = __shfl(s[3], threadIdx.x + 3, 4); + Gfunc_v35(s[0], s[1], s[2], s[3]); + s[1] = __shfl(s[1], threadIdx.x + 3, 4); + s[2] = __shfl(s[2], threadIdx.x + 2, 4); + s[3] = __shfl(s[3], threadIdx.x + 1, 4); +} + +__device__ __forceinline__ +void reduceDuplexRowSetupV2(uint2 state[4],uint2* shared){ + + uint2 state1[Ncol][3], state0[Ncol][3], state2[3]; + + #pragma unroll 4 + for (int i = 0; i < Ncol; i++) + { + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state0[Ncol - i - 1][j] = state[j]; + round_lyra_v35(state); + } + + #pragma unroll 4 + for (int i = 0; i < Ncol; i++) + { + #pragma unroll + for (int j = 0; j < 3; j++) + state[j] ^= state0[i][j]; + + round_lyra_v35(state); + + #pragma unroll + for (int j = 0; j < 3; j++) + state1[Ncol - i - 1][j] = state0[i][j]; + + #pragma unroll + for (int j = 0; j < 3; j++) + state1[Ncol - i - 1][j] ^= state[j]; + } + + for (int i = 0; i < Ncol; i++){ + const uint32_t s0 = memshift * Ncol * 0 + i * memshift; + const uint32_t s2 = memshift * Ncol * 2 + memshift * (Ncol - 1) - i*memshift; + + #pragma unroll + for (int j = 0; j < 3; j++) + state[j] ^= state1[i][j] + state0[i][j]; + + round_lyra_v35(state); + + #pragma unroll + for (int j = 0; j < 3; j++) + state2[j] = state1[i][j]; + + #pragma unroll + for (int j = 0; j < 3; j++) + state2[j] ^= state[j]; + + #pragma unroll + for (int j = 0; j < 3; j++) + ST4S(s2 + j, state2[j],shared); + + //ˆêŒÂŽè‘O‚̃XƒŒƒbƒh‚©‚çƒfÂ[ƒ^‚ð–á‚€(“¯Žž‚ɈêŒÂÂæ‚̃XƒŒƒbƒh‚ɃfÂ[ƒ^‚ð‘—‚é) + uint2 Data0 = __shfl(state[0], threadIdx.x - 1, 4); + uint2 Data1 = __shfl(state[1], threadIdx.x - 1, 4); + uint2 Data2 = __shfl(state[2], threadIdx.x - 1, 4); + + if (threadIdx.x == 0) + { + state0[i][0] ^= Data2; + state0[i][1] ^= Data0; + state0[i][2] ^= Data1; + } + else + { + state0[i][0] ^= Data0; + state0[i][1] ^= Data1; + state0[i][2] ^= Data2; + } + + #pragma unroll + for (int j = 0; j < 3; j++) + ST4S(s0 + j, state0[i][j],shared); + + #pragma unroll + for (int j = 0; j < 3; j++) + state0[i][j] = state2[j]; + + } + +// #pragma nounroll + for (int i = 0; i < Ncol; i++) + { + const uint32_t s1 = memshift * Ncol * 1 + i*memshift; + const uint32_t s3 = memshift * Ncol * 3 + memshift * (Ncol - 1) - i*memshift; + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state[j] ^= state1[i][j] + state0[Ncol - i - 1][j]; + + round_lyra_v35(state); + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state0[Ncol - i - 1][j] ^= state[j]; + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + ST4S(s3 + j, state0[Ncol - i - 1][j],shared); + + //ˆêŒÂŽè‘O‚̃XƒŒƒbƒh‚©‚çƒfÂ[ƒ^‚ð–á‚€(“¯Žž‚ɈêŒÂÂæ‚̃XƒŒƒbƒh‚ɃfÂ[ƒ^‚ð‘—‚é) + uint2 Data0 = __shfl(state[0], threadIdx.x - 1, 4); + uint2 Data1 = __shfl(state[1], threadIdx.x - 1, 4); + uint2 Data2 = __shfl(state[2], threadIdx.x - 1, 4); + + if (threadIdx.x == 0) + { + state1[i][0] ^= Data2; + state1[i][1] ^= Data0; + state1[i][2] ^= Data1; + } + else + { + state1[i][0] ^= Data0; + state1[i][1] ^= Data1; + state1[i][2] ^= Data2; + } + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + ST4S(s1 + j, state1[i][j],shared); + } +} + +__device__ +void reduceDuplexRowtV2(const int rowIn, const int rowInOut, const int rowOut, uint2 state[4],uint2 *shared) +{ + uint2 state1[3]; + uint32_t ps1 = memshift * Ncol * rowIn; + uint32_t ps2 = memshift * Ncol * rowInOut; + uint32_t ps3 = memshift * Ncol * rowOut; + + #pragma unroll 1 + for (int i = 0; i < Ncol; i++){ + uint32_t s1 = ps1 + i*memshift; + uint32_t s2 = ps2 + i*memshift; + uint32_t s3 = ps3 + i*memshift; + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state1[j] = LD4S(s2 + j,shared); + + #pragma unroll 3 + for (int j = 0; j < 3; j++){ + state[j] = state[j] ^ (state1[j] + LD4S(s1 + j,shared)); + } + round_lyra_v35(state); + + //���Ž��O�̃X���b�h�����f�[�^���Ⴄ(�����Ɉ��Â��̃X���b�h�Ƀf�[�^�𑗂�) + uint2 Data0 = __shfl(state[0], threadIdx.x - 1, 4); + uint2 Data1 = __shfl(state[1], threadIdx.x - 1, 4); + uint2 Data2 = __shfl(state[2], threadIdx.x - 1, 4); + if (threadIdx.x != 0) + { + state1[0] ^= Data0; + state1[1] ^= Data1; + state1[2] ^= Data2; + } + else + { + state1[0] ^= Data2; + state1[1] ^= Data0; + state1[2] ^= Data1; + } + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + ST4S(s2 + j, state1[j],shared); + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + state1[j] = LD4S(s3 + j, shared); + + #pragma unroll 3 + for (int j = 0; j < 3; j++) + ST4S(s3 + j, state1[j] ^ state[j],shared); + } +} + +__device__ +void reduceDuplexRowtV2_4(const int rowInOut, uint2 state[4], uint2* shared) +{ + int i, j; + uint2 last[3],last2[3]; + const uint32_t ps1 = memshift * Ncol * 2; + const uint32_t ps2 = memshift * Ncol * rowInOut; + + #pragma unroll + for (int j = 0; j < 3; j++) + last[j] = LD4S(ps2 + j,shared); + + #pragma unroll + for (int j = 0; j < 3; j++) + state[j] ^= LD4S(ps1 + j,shared) + last[j]; + + round_lyra_v35(state); + + //���Ž��O�̃X���b�h�����f�[�^���Ⴄ(�����Ɉ��Â��̃X���b�h�Ƀf�[�^�𑗂�) + uint2 Data0 = __shfl(state[0], threadIdx.x - 1, 4); + uint2 Data1 = __shfl(state[1], threadIdx.x - 1, 4); + uint2 Data2 = __shfl(state[2], threadIdx.x - 1, 4); + + if (threadIdx.x == 0) + { + last[0] ^= Data2; + last[1] ^= Data0; + last[2] ^= Data1; + } + else + { + last[0] ^= Data0; + last[1] ^= Data1; + last[2] ^= Data2; + } + + if (rowInOut == 3) + { + #pragma unroll + for (j = 0; j < 3; j++) + last[j] ^= state[j]; + } + + #pragma unroll + for (i = 1; i < Ncol; i++) + { + const uint32_t s1 = ps1 + i*memshift; + const uint32_t s2 = ps2 + i*memshift; + + #pragma unroll + for (j = 0; j < 3; j++) + last2[j] = LD4S(s2 + j,shared); + + #pragma unroll + for (j = 0; j < 3; j++) + state[j] ^= LD4S(s1 + j,shared) + last2[j]; + + round_lyra_v35(state); + } + + #pragma unroll + for (int j = 0; j < 3; j++) + state[j] ^= last[j]; +} + +__constant__ const uint2x4 blake2b_IV[2] = { + 0xf3bcc908lu, 0x6a09e667lu, + 0x84caa73blu, 0xbb67ae85lu, + 0xfe94f82blu, 0x3c6ef372lu, + 0x5f1d36f1lu, 0xa54ff53alu, + 0xade682d1lu, 0x510e527flu, + 0x2b3e6c1flu, 0x9b05688clu, + 0xfb41bd6blu, 0x1f83d9ablu, + 0x137e2179lu, 0x5be0cd19lu +}; + +__constant__ const uint2x4 Mask[2] = { + 0x00000020lu, 0x00000000lu, + 0x00000020lu, 0x00000000lu, + 0x00000020lu, 0x00000000lu, + 0x00000001lu, 0x00000000lu, + 0x00000004lu, 0x00000000lu, + 0x00000004lu, 0x00000000lu, + 0x00000080lu, 0x00000000lu, + 0x00000000lu, 0x01000000lu +}; + +__global__ +__launch_bounds__(TPB2) +void lyra2v2_gpu_hash_32_1(uint32_t threads,uint2* DMatrix,const uint2* __restrict__ outputHash) +{ + const uint32_t thread = blockDim.x * blockIdx.x + threadIdx.x; + + uint2x4 state[4]; + + uint2x4 *DState = (uint2x4*)DMatrix; + + if (thread < threads) + { + state[0].x = state[1].x = __ldg(&outputHash[thread + threads * 0]); + state[0].y = state[1].y = __ldg(&outputHash[thread + threads * 1]); + state[0].z = state[1].z = __ldg(&outputHash[thread + threads * 2]); + state[0].w = state[1].w = __ldg(&outputHash[thread + threads * 3]); + state[2] = blake2b_IV[0]; + state[3] = blake2b_IV[1]; + + #pragma unroll 1 + for (int i = 0; i<12; i++) + round_lyra_v35(state); + + state[0] ^= Mask[0]; + state[1] ^= Mask[1]; + + for (int i = 0; i<12; i++) + round_lyra_v35(state); + + DState[blockDim.x * gridDim.x * 0 + thread] = state[0]; + DState[blockDim.x * gridDim.x * 1 + thread] = state[1]; + DState[blockDim.x * gridDim.x * 2 + thread] = state[2]; + DState[blockDim.x * gridDim.x * 3 + thread] = state[3]; + + } //thread +} + +__global__ +__launch_bounds__(TPB1) +void lyra2v2_gpu_hash_32_2(uint32_t threads,uint2* DState) +{ + const uint32_t thread = blockDim.y * blockIdx.x + threadIdx.y; + + __shared__ uint2 shared[48 * TPB1]; + + if (thread < threads) + { + uint2 state[4]; + state[0] = ((uint2*)DState)[(0 * gridDim.x * blockDim.y + thread) * blockDim.x + threadIdx.x]; + state[1] = ((uint2*)DState)[(1 * gridDim.x * blockDim.y + thread) * blockDim.x + threadIdx.x]; + state[2] = ((uint2*)DState)[(2 * gridDim.x * blockDim.y + thread) * blockDim.x + threadIdx.x]; + state[3] = ((uint2*)DState)[(3 * gridDim.x * blockDim.y + thread) * blockDim.x + threadIdx.x]; + + reduceDuplexRowSetupV2(state,shared); + + uint32_t rowa; + int prev = 3; + + #pragma unroll 2 + for (int i = 0; i < 3; i++) + { + rowa = __shfl(state[0].x, 0, 4) & 3; + reduceDuplexRowtV2(prev, rowa, i, state,shared); + prev = i; + } + + rowa = __shfl(state[0].x, 0, 4) & 3; + reduceDuplexRowtV2_4(rowa, state,shared); + + ((uint2*)DState)[(0 * gridDim.x * blockDim.y + thread) * blockDim.x + threadIdx.x] = state[0]; + ((uint2*)DState)[(1 * gridDim.x * blockDim.y + thread) * blockDim.x + threadIdx.x] = state[1]; + ((uint2*)DState)[(2 * gridDim.x * blockDim.y + thread) * blockDim.x + threadIdx.x] = state[2]; + ((uint2*)DState)[(3 * gridDim.x * blockDim.y + thread) * blockDim.x + threadIdx.x] = state[3]; + } //thread +} + +__global__ +__launch_bounds__(TPB2) +void lyra2v2_gpu_hash_32_3(uint32_t threads,const uint2* __restrict__ DMatrix,uint2 *outputHash) +{ + const uint32_t thread = blockDim.x * blockIdx.x + threadIdx.x; + + uint2x4 state[4]; + + uint2x4 *DState = (uint2x4*)DMatrix; + + if (thread < threads) + { + state[0] = __ldg4(&DState[blockDim.x * gridDim.x * 0 + thread]); + state[1] = __ldg4(&DState[blockDim.x * gridDim.x * 1 + thread]); + state[2] = __ldg4(&DState[blockDim.x * gridDim.x * 2 + thread]); + state[3] = __ldg4(&DState[blockDim.x * gridDim.x * 3 + thread]); + + #pragma unroll 1 + for (int i = 0; i < 12; i++) + round_lyra_v35(state); + + outputHash[thread + threads * 0] = state[0].x; + outputHash[thread + threads * 1] = state[0].y; + outputHash[thread + threads * 2] = state[0].z; + outputHash[thread + threads * 3] = state[0].w; + + } //thread +} + +__host__ +void lyra2v2_cpu_hash_32(int thr_id, uint32_t threads,uint2* DMatrix, uint2 *d_outputHash) +{ + dim3 grid1((threads * 4 + TPB1 - 1) / TPB1); + dim3 block1(4, TPB1>>2); + + dim3 grid2((threads + TPB2 - 1) / TPB2); + dim3 block2(TPB2); + + lyra2v2_gpu_hash_32_1 <<>>(threads,DMatrix,d_outputHash); + + lyra2v2_gpu_hash_32_2 <<>>(threads,DMatrix); + + lyra2v2_gpu_hash_32_3 <<>>(threads,DMatrix,d_outputHash); + +} + diff --git a/lyra2/lyra2RE.cu b/lyra2/lyra2RE.cu new file mode 100644 index 0000000..fc11cb8 --- /dev/null +++ b/lyra2/lyra2RE.cu @@ -0,0 +1,209 @@ +extern "C" { +#include "sph/sph_blake.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_keccak.h" +#include "lyra2/Lyra2.h" +} + +#include "miner.h" +#include "cuda_helper.h" + +static uint2* d_hash[MAX_GPUS]; +static uint2* d_matrix[MAX_GPUS]; + +extern void blake256_14round_cpu_hash_80(const uint32_t threads, const uint32_t startNonce, uint2* d_Hash); +extern void blake256_14round_cpu_setBlock_80(const uint32_t *pdata); + +extern void keccak256_cpu_hash_32(const int thr_id,const uint32_t threads, uint2* d_hash); +extern void keccak256_cpu_init(int thr_id); +extern void keccak256_cpu_free(int thr_id); + +extern void skein256_cpu_init(int thr_id); +extern void skein256_cpu_hash_32(const uint32_t threads, uint2 *d_hash); + +extern void lyra2_cpu_init(int thr_id, uint32_t threads, uint2* d_matrix); +extern void lyra2_cpu_hash_32(int thr_id, uint32_t threads, uint2* d_outputHash); + +extern void groestl256_cpu_init(int thr_id, uint32_t threads); +extern void groestl256_cpu_free(int thr_id); +extern void groestl256_setTarget(const void *ptarget); +extern void groestl256_set_output(int thr_id); +extern void groestl256_cpu_hash_32(int thr_id, uint32_t threads, uint32_t startNounce, uint2 *d_Hash, uint32_t *resultnonces); + + +#ifdef _DEBUG +#define TRACE(algo) { \ + if (max_nonce == 1 && pdata[19] <= 1) { \ + uint32_t* debugbuf = NULL; \ + cudaMallocHost(&debugbuf, 8*sizeof(uint32_t)); \ + cudaMemcpy(debugbuf, d_hash[thr_id], 8*sizeof(uint32_t), cudaMemcpyDeviceToHost); \ + printf("lyra %s %08x %08x %08x %08x...\n", algo, swab32(debugbuf[0]), swab32(debugbuf[1]), \ + swab32(debugbuf[2]), swab32(debugbuf[3])); \ + cudaFreeHost(debugbuf); \ + } \ +} +#else +#define TRACE(algo) {} +#endif + +extern "C" void lyra2re_hash(void *state, const void *input) +{ + uint32_t hashA[8], hashB[8]; + + sph_blake256_context ctx_blake; + sph_keccak256_context ctx_keccak; + sph_skein256_context ctx_skein; + sph_groestl256_context ctx_groestl; + + sph_blake256_set_rounds(14); + + sph_blake256_init(&ctx_blake); + sph_blake256(&ctx_blake, input, 80); + sph_blake256_close(&ctx_blake, hashA); + + sph_keccak256_init(&ctx_keccak); + sph_keccak256(&ctx_keccak, hashA, 32); + sph_keccak256_close(&ctx_keccak, hashB); + + LYRA2(hashA, 32, hashB, 32, hashB, 32, 1, 8, 8); + + sph_skein256_init(&ctx_skein); + sph_skein256(&ctx_skein, hashA, 32); + sph_skein256_close(&ctx_skein, hashB); + + sph_groestl256_init(&ctx_groestl); + sph_groestl256(&ctx_groestl, hashB, 32); + sph_groestl256_close(&ctx_groestl, hashA); + + memcpy(state, hashA, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_lyra2(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + + const int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + int intensity = (device_sm[dev_id] > 500 ) ? 19 : 17; + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); // 18=256*256*4; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ptarget[7] = 0x000f; + + if (!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + keccak256_cpu_init(thr_id); + skein256_cpu_init(thr_id); + groestl256_cpu_init(thr_id, throughput); + + // DMatrix +// size_t matrix_sz = sizeof(uint64_t) * 4 * 4; +// CUDA_SAFE_CALL(cudaMalloc(&d_matrix[thr_id], matrix_sz * throughput)); +// lyra2_cpu_init(thr_id, throughput, d_matrix[thr_id]); + size_t matrix_sz = device_sm[dev_id] > 500 ? sizeof(uint64_t) * 4 * 4 : 16 * 8 * 8 * sizeof(uint2); + CUDA_SAFE_CALL(cudaMalloc(&d_matrix[thr_id], matrix_sz * throughput)); + lyra2_cpu_init(thr_id, throughput, d_matrix[thr_id]); +// cudaMalloc(&d_matrix[thr_id], (size_t)16 * 8 * 8 * sizeof(uint2) * throughput); +// lyra2_cpu_init(thr_id, throughput, d_matrix[thr_id]); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], (size_t)32 * throughput)); + + init[thr_id] = true; + } + + uint32_t _ALIGN(128) endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + blake256_14round_cpu_setBlock_80(pdata); + groestl256_setTarget(ptarget); + groestl256_set_output(thr_id); + do { + uint32_t foundNonces[2]; + + blake256_14round_cpu_hash_80(throughput, pdata[19], d_hash[thr_id]); + keccak256_cpu_hash_32(thr_id,throughput, d_hash[thr_id]); + lyra2_cpu_hash_32(thr_id, throughput, d_hash[thr_id]); + skein256_cpu_hash_32(throughput, d_hash[thr_id]); + groestl256_cpu_hash_32(thr_id, throughput, pdata[19], d_hash[thr_id], foundNonces); + + if (foundNonces[ 0] != UINT32_MAX) + { + uint32_t _ALIGN(64) vhash64[8]; + + be32enc(&endiandata[19], foundNonces[ 0]); + lyra2re_hash(vhash64, endiandata); + + if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { + int res = 1; + + work_set_target_ratio(work, vhash64); + *hashes_done = pdata[19] - first_nonce + throughput; + pdata[19] = foundNonces[ 0]; + if (foundNonces[ 1] != UINT32_MAX) + { + be32enc(&endiandata[19], foundNonces[ 1]); + lyra2re_hash(vhash64, endiandata); +// if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { +// applog(LOG_NOTICE,"Legit extranonce"); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]) + work_set_target_ratio(work, vhash64); + pdata[21] = foundNonces[ 1]; + res++; +// } +// if(!opt_quiet) +// applog(LOG_BLUE,"Found 2nd nonce: %08X",pdata[21]); + } + return res; + } else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNonces[ 0]); + groestl256_set_output(thr_id); + } + } + + if ((uint64_t)throughput + pdata[19] >= max_nonce) { + pdata[19] = max_nonce; + break; + } + pdata[19] += throughput; + + } while (!work_restart[thr_id].restart); + + *hashes_done = pdata[19] - first_nonce; + return 0; +} + +// cleanup +extern "C" void free_lyra2(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaThreadSynchronize(); + + cudaFree(d_hash[thr_id]); + cudaFree(d_matrix[thr_id]); + + keccak256_cpu_free(thr_id); + groestl256_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/lyra2/lyra2REv2.cu b/lyra2/lyra2REv2.cu new file mode 100644 index 0000000..a6b0acc --- /dev/null +++ b/lyra2/lyra2REv2.cu @@ -0,0 +1,218 @@ +extern "C" { +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_skein.h" +#include "sph/sph_keccak.h" +#include "sph/sph_cubehash.h" +#include "lyra2/Lyra2.h" +} + +#include "miner.h" +#include "cuda_helper.h" + + +static uint2 *d_hash[MAX_GPUS]; +static uint2 *d_matrix[MAX_GPUS]; + +extern void blake256_14round_cpu_hash_80(const uint32_t threads, const uint32_t startNonce, uint2* d_Hash); +extern void blake256_14round_cpu_setBlock_80(const uint32_t *pdata); + +extern void keccak256_cpu_hash_32(const int thr_id,const uint32_t threads, uint2* d_hash); +extern void keccak256_cpu_init(int thr_id); +extern void keccak256_cpu_free(int thr_id); + +extern void skein256_cpu_hash_32(const uint32_t threads, uint2 *d_hash); +extern void skein256_cpu_init(int thr_id); + +extern void cubehash256_cpu_hash_32(const uint32_t threads, uint2* d_hash); + +extern void lyra2v2_cpu_hash_32(int thr_id, uint32_t threads,uint2* DMatrix, uint2 *d_Hash); +extern void lyra2v2_cpu_init(int thr_id, uint2 *hash); + +extern void bmw256_setTarget(const void *ptarget); +extern void bmw256_cpu_init(int thr_id); +extern void bmw256_cpu_free(int thr_id); +extern void bmw_set_output(int thr_id); +extern void bmw256_cpu_hash_32(int thr_id, uint32_t threads,uint2 *g_hash, uint32_t *resultnonces, const uint2 target); + +void lyra2v2_hash(void *state, const void *input) +{ + uint32_t hashA[8], hashB[8]; + + sph_blake256_context ctx_blake; + sph_keccak256_context ctx_keccak; + sph_skein256_context ctx_skein; + sph_bmw256_context ctx_bmw; + sph_cubehash256_context ctx_cube; + + sph_blake256_set_rounds(14); + + sph_blake256_init(&ctx_blake); + sph_blake256(&ctx_blake, input, 80); + sph_blake256_close(&ctx_blake, hashA); + + sph_keccak256_init(&ctx_keccak); + sph_keccak256(&ctx_keccak, hashA, 32); + sph_keccak256_close(&ctx_keccak, hashB); + + sph_cubehash256_init(&ctx_cube); + sph_cubehash256(&ctx_cube, hashB, 32); + sph_cubehash256_close(&ctx_cube, hashA); + + LYRA2(hashB, 32, hashA, 32, hashA, 32, 1, 4, 4); + + sph_skein256_init(&ctx_skein); + sph_skein256(&ctx_skein, hashB, 32); + sph_skein256_close(&ctx_skein, hashA); + + sph_cubehash256_init(&ctx_cube); + sph_cubehash256(&ctx_cube, hashA, 32); + sph_cubehash256_close(&ctx_cube, hashB); + + sph_bmw256_init(&ctx_bmw); + sph_bmw256(&ctx_bmw, hashB, 32); + sph_bmw256_close(&ctx_bmw, hashA); + + memcpy(state, hashA, 32); +} + +#ifdef _DEBUG +#define TRACE(algo) { \ + if (max_nonce == 1 && pdata[19] <= 1) { \ + uint32_t* debugbuf = NULL; \ + cudaMallocHost(&debugbuf, 32); \ + cudaMemcpy(debugbuf, d_hash[thr_id], 32, cudaMemcpyDeviceToHost); \ + printf("lyra2 %s %08x %08x %08x %08x...%08x... \n", algo, swab32(debugbuf[0]), swab32(debugbuf[1]), \ + swab32(debugbuf[2]), swab32(debugbuf[3]), swab32(debugbuf[7])); \ + cudaFreeHost(debugbuf); \ + } \ +} +#else +#define TRACE(algo) {} +#endif + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_lyra2v2(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + int dev_id = device_map[thr_id]; + int intensity = (device_sm[dev_id] > 500) ? 22 : 20; + uint32_t throughput = cuda_default_throughput(dev_id, 1UL << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ptarget[7] = 0x000f; + + if (!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + cudaDeviceSetSharedMemConfig(cudaSharedMemBankSizeEightByte); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + cuda_get_arch(dev_id); + skein256_cpu_init(thr_id); +// keccak256_cpu_init(thr_id); + bmw256_cpu_init(thr_id); + + CUDA_SAFE_CALL(cudaMalloc(&d_matrix[thr_id], 4 * 4 * sizeof(uint2) * throughput)); +// lyra2v2_cpu_init(thr_id, d_matrix[thr_id]); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint32_t) * throughput)); +// api_set_throughput(thr_id, throughput); + init[thr_id] = true; + } + + uint32_t endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + blake256_14round_cpu_setBlock_80(pdata); + bmw_set_output(thr_id); + do { + uint32_t foundNonces[2] = { 0, 0 }; + + blake256_14round_cpu_hash_80(throughput, pdata[19], d_hash[thr_id]); + keccak256_cpu_hash_32(thr_id,throughput, d_hash[thr_id]); + cubehash256_cpu_hash_32(throughput, d_hash[thr_id]); + lyra2v2_cpu_hash_32(thr_id, throughput,d_matrix[thr_id],d_hash[thr_id]); + skein256_cpu_hash_32(throughput, d_hash[thr_id]); + cubehash256_cpu_hash_32(throughput, d_hash[thr_id]); + bmw256_cpu_hash_32(thr_id, throughput, d_hash[thr_id], foundNonces, *(uint2*)&ptarget[6]); + + if (foundNonces[0] != 0) + { + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + foundNonces[0]); + lyra2v2_hash(vhash64, endiandata); + if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) + { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + foundNonces[0]; + // check if there was another one... + if (foundNonces[1] != 0) + { + be32enc(&endiandata[19], (pdata[19]-foundNonces[ 0])+foundNonces[1]); + lyra2v2_hash(vhash64, endiandata); + pdata[21] = startNounce + foundNonces[1]; +// if(!opt_quiet) +// applog(LOG_BLUE,"Found 2nd nonce: %08X",pdata[21]); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]) { + work_set_target_ratio(work, vhash64); + xchg(pdata[19], pdata[21]); + } + res=2; + } + return res; + } + else + { + if(vhash64[7]>ptarget[ 7]) + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNonces[0]); + bmw_set_output(thr_id); + } + } + + if ((uint64_t)throughput + pdata[19] >= max_nonce) { + pdata[19] = max_nonce; + break; + } + pdata[19] += throughput; + + } while (!work_restart[thr_id].restart && !abort_flag); + + *hashes_done = pdata[19] - first_nonce; + return 0; +} + +// cleanup +extern "C" void free_lyra2v2(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + cudaFree(d_hash[thr_id]); + cudaFree(d_matrix[thr_id]); + + bmw256_cpu_free(thr_id); +// keccak256_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/miner.h b/miner.h new file mode 100644 index 0000000..7624acb --- /dev/null +++ b/miner.h @@ -0,0 +1,823 @@ +#ifndef __MINER_H__ +#define __MINER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cpuminer-config.h" + +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#undef HAVE_ALLOCA_H +#undef HAVE_SYSLOG_H +#endif + +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif + +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +void *alloca (size_t); +# endif +#endif + +#include "compat.h" + +#ifdef __INTELLISENSE__ +/* should be in stdint.h but... */ +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef __int16 int8_t; +typedef unsigned __int16 uint8_t; + +typedef unsigned __int32 time_t; +typedef char * va_list; +#endif + +#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ > 0 +# undef _ALIGN +# define _ALIGN(x) __align__(x) +#endif + +#ifdef HAVE_SYSLOG_H +#include +#define LOG_BLUE 0x10 +#define LOG_RAW 0x99 +#else +enum { + LOG_ERR, + LOG_WARNING, + LOG_NOTICE, + LOG_INFO, + LOG_DEBUG, + /* custom notices */ + LOG_BLUE = 0x10, + LOG_RAW = 0x99 +}; +#endif + +typedef unsigned char uchar; + +#undef unlikely +#undef likely +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define unlikely(expr) (__builtin_expect(!!(expr), 0)) +#define likely(expr) (__builtin_expect(!!(expr), 1)) +#else +#define unlikely(expr) (expr) +#define likely(expr) (expr) +#endif + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif + +#ifndef max +# define max(a, b) ((a) > (b) ? (a) : (b)) +#endif +#ifndef min +# define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef UINT32_MAX +/* for gcc 4.4 */ +#define UINT32_MAX UINT_MAX +#endif + +static inline bool is_windows(void) { +#ifdef WIN32 + return 1; +#else + return 0; +#endif +} + +#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) +#define WANT_BUILTIN_BSWAP +#else +#define bswap_32(x) ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) \ + | (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu)) +#define bswap_64(x) (((uint64_t) bswap_32((uint32_t)((x) & 0xffffffffu)) << 32) \ + | (uint64_t) bswap_32((uint32_t)((x) >> 32))) +#endif + +static inline uint32_t swab32(uint32_t v) +{ +#ifdef WANT_BUILTIN_BSWAP + return __builtin_bswap32(v); +#else + return bswap_32(v); +#endif +} + +static inline uint64_t swab64(uint64_t v) +{ +#ifdef WANT_BUILTIN_BSWAP + return __builtin_bswap64(v); +#else + return bswap_64(v); +#endif +} + +static inline void swab256(void *dest_p, const void *src_p) +{ + uint32_t *dest = (uint32_t *) dest_p; + const uint32_t *src = (const uint32_t *) src_p; + + dest[0] = swab32(src[7]); + dest[1] = swab32(src[6]); + dest[2] = swab32(src[5]); + dest[3] = swab32(src[4]); + dest[4] = swab32(src[3]); + dest[5] = swab32(src[2]); + dest[6] = swab32(src[1]); + dest[7] = swab32(src[0]); +} + +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +#if !HAVE_DECL_BE32DEC +static inline uint32_t be32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) + + ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24)); +} +#endif + +#if !HAVE_DECL_LE32DEC +static inline uint32_t le32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) + + ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24)); +} +#endif + +#if !HAVE_DECL_BE32ENC +static inline void be32enc(void *pp, uint32_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[3] = x & 0xff; + p[2] = (x >> 8) & 0xff; + p[1] = (x >> 16) & 0xff; + p[0] = (x >> 24) & 0xff; +} +#endif + +#if !HAVE_DECL_LE32ENC +static inline void le32enc(void *pp, uint32_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; +} +#endif + +#if !HAVE_DECL_BE16DEC +static inline uint16_t be16dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint16_t)(p[1]) + ((uint16_t)(p[0]) << 8)); +} +#endif + +#if !HAVE_DECL_BE16ENC +static inline void be16enc(void *pp, uint16_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[1] = x & 0xff; + p[0] = (x >> 8) & 0xff; +} +#endif + +#if !HAVE_DECL_LE16DEC +static inline uint16_t le16dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint16_t)(p[0]) + ((uint16_t)(p[1]) << 8)); +} +#endif + +#if !HAVE_DECL_LE16ENC +static inline void le16enc(void *pp, uint16_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; +} +#endif + +/* used for struct work */ +void *aligned_calloc(int size); +void aligned_free(void *ptr); + +#if JANSSON_MAJOR_VERSION >= 2 +#define JSON_LOADS(str, err_ptr) json_loads((str), 0, (err_ptr)) +#define JSON_LOADF(str, err_ptr) json_load_file((str), 0, (err_ptr)) +#else +#define JSON_LOADS(str, err_ptr) json_loads((str), (err_ptr)) +#define JSON_LOADF(str, err_ptr) json_load_file((str), (err_ptr)) +#endif + +json_t * json_load_url(char* cfg_url, json_error_t *err); + +#define USER_AGENT PACKAGE_NAME "/" PACKAGE_VERSION + +void sha256_init(uint32_t *state); +void sha256_transform(uint32_t *state, const uint32_t *block, int swap); +void sha256d(unsigned char *hash, const unsigned char *data, int len); + +#define HAVE_SHA256_4WAY 0 +#define HAVE_SHA256_8WAY 0 + +struct work; + +extern int scanhash_blake256_8round(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_decred(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_blake256_14round(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_blake2s(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); +//extern int scanhash_whirlpoolx(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_keccak256(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_hsr(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_sha256d(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_lyra2(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_lyra2v2(int thr_id,struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_skeincoin(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_skein2(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_nist5(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_quark(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_qubit(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_whirl(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_x11(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_x11evo(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_c11(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_sib(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_x13(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_x14(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_x15(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_x17(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_lbry(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_neoscrypt(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_sia(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_myriad(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_veltor(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +//extern int scanhash_yescrypt(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); + +/* SIA getwork - submit*/ +extern size_t sia_data_cb(const void *ptr, size_t size, size_t nmemb, void *user_data); +extern char* sia_getheader(CURL *curl, struct pool_infos *pool); +extern bool sia_work_decode(const char *hexdata, struct work *work); +extern bool sia_submit(CURL *curl, struct pool_infos *pool, struct work *work); + +/* free device allocated memory per algo */ +void algo_free_all(int thr_id); + +extern void free_blake256_8round(int thr_id); +extern void free_blake256_14round(int thr_id); +extern void free_decred(int thr_id); +extern void free_blake256(int thr_id); +extern void free_blake2s(int thr_id); +//extern void free_whirlx(int thr_id); +extern void free_keccak256(int thr_id); +extern void free_hsr(int thr_id); +extern void free_lyra2(int thr_id); +extern void free_lyra2v2(int thr_id); +extern void free_skeincoin(int thr_id); +extern void free_skein2(int thr_id); +extern void free_nist5(int thr_id); +extern void free_quark(int thr_id); +extern void free_qubit(int thr_id); +extern void free_whirl(int thr_id); +extern void free_x11(int thr_id); +extern void free_x11evo(int thr_id); +extern void free_c11(int thr_id); +extern void free_sib(int thr_id); +extern void free_x13(int thr_id); +extern void free_x14(int thr_id); +extern void free_x15(int thr_id); +extern void free_x17(int thr_id); +extern void free_lbry(int thr_id); +extern void free_neoscrypt(int thr_id); +extern void free_sia(int thr_id); +extern void free_myriad(int thr_id); +extern void free_veltor(int thr_id); +//extern void free_yescrypt(int thr_id); +//extern void free_sha256d(int thr_id); + +/* api related */ +void *api_thread(void *userdata); +void api_set_throughput(int thr_id, uint32_t throughput); + +struct monitor_info { + uint32_t gpu_temp; + uint32_t gpu_fan; + uint32_t gpu_clock; + uint32_t gpu_memclock; + uint32_t gpu_power; + + pthread_mutex_t lock; + pthread_cond_t sampling_signal; + bool sampling_flag; +}; + +struct cgpu_info { + uint8_t gpu_id; + uint8_t thr_id; + int accepted; + int rejected; + int hw_errors; + double khashes; + uint8_t has_monitoring; + uint32_t gpu_temp; + uint32_t gpu_fan; + uint16_t gpu_fan_rpm; + uint16_t gpu_arch; + uint32_t gpu_clock; + uint32_t gpu_memclock; + size_t gpu_mem; + size_t gpu_memfree; + uint32_t gpu_power; + double gpu_vddc; + int16_t gpu_pstate; + int16_t gpu_bus; + uint16_t gpu_vid; + uint16_t gpu_pid; + + int8_t nvml_id; + int8_t nvapi_id; + + char gpu_sn[64]; + char gpu_desc[64]; + double intensity; + uint32_t throughput; + + struct monitor_info monitor; +}; + +struct thr_api { + int id; + pthread_t pth; + struct thread_q *q; +}; + +struct stats_data { + uint32_t uid; + uint32_t tm_stat; + uint32_t hashcount; + uint32_t height; + + double difficulty; + double hashrate; + + uint8_t thr_id; + uint8_t gpu_id; + uint8_t hashfound; + uint8_t ignored; + + uint8_t npool; + uint8_t pool_type; + uint16_t align; +}; + +struct hashlog_data { + uint8_t npool; + uint8_t pool_type; + uint16_t align; + + uint32_t height; + uint32_t njobid; + uint32_t nonce; + uint32_t scanned_from; + uint32_t scanned_to; + uint32_t last_from; + uint32_t tm_add; + uint32_t tm_upd; + uint32_t tm_sent; +}; + +/* end of api */ + +struct thr_info { + int id; + pthread_t pth[2]; //mining thread and monitoring thread + struct thread_q *q; + struct cgpu_info gpu; +}; + +struct work_restart { + /* volatile to modify accross threads (vstudio thing) */ + volatile uint32_t restart; + char padding[128 - sizeof(uint32_t)]; +}; + +#ifdef HAVE_GETOPT_LONG +#include +#else +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; +#endif +extern int options_count(); + +extern bool opt_benchmark; +extern bool opt_debug; +extern bool opt_quiet; +extern bool opt_protocol; +extern bool opt_showdiff; +extern bool opt_tracegpu; +extern int opt_n_threads; +extern int active_gpus; +extern int gpu_threads; +extern int opt_timeout; +extern bool want_longpoll; +extern bool have_longpoll; +extern bool want_stratum; +extern bool have_stratum; +extern bool opt_stratum_stats; +extern char *opt_cert; +extern char *opt_proxy; +extern long opt_proxy_type; +extern bool use_syslog; +extern bool use_colors; +extern int use_pok; +extern pthread_mutex_t applog_lock; +extern struct thr_info *thr_info; +extern int longpoll_thr_id; +extern int stratum_thr_id; +extern int api_thr_id; +extern volatile bool abort_flag; +extern struct work_restart *work_restart; +extern bool opt_trust_pool; +extern uint16_t opt_vote; + +extern uint64_t global_hashrate; +extern uint64_t net_hashrate; +extern double net_diff; +extern double stratum_diff; + +#define MAX_GPUS 16 +extern char* device_name[MAX_GPUS]; +extern short device_map[MAX_GPUS]; +extern long device_sm[MAX_GPUS]; +extern uint32_t gpus_intensity[MAX_GPUS]; +extern int opt_cudaschedule; + +// cuda.cpp +int cuda_num_devices(); +void cuda_devicenames(); +void cuda_reset_device(int thr_id, bool *init); +void cuda_shutdown(); +int cuda_finddevice(char *name); +int cuda_version(); +void cuda_print_devices(); +int cuda_available_memory(int thr_id); +int cuda_gpu_info(struct cgpu_info *gpu); + +uint32_t cuda_default_throughput(int thr_id, uint32_t defcount); +#define device_intensity(t,f,d) cuda_default_throughput(t,d) + +void cuda_log_lasterror(int thr_id, const char* func, int line); +void cuda_clear_lasterror(); +#define CUDA_LOG_ERROR() cuda_log_lasterror(thr_id, __func__, __LINE__) + +#define CL_N "\x1B[0m" +#define CL_RED "\x1B[31m" +#define CL_GRN "\x1B[32m" +#define CL_YLW "\x1B[33m" +#define CL_BLU "\x1B[34m" +#define CL_MAG "\x1B[35m" +#define CL_CYN "\x1B[36m" + +#define CL_BLK "\x1B[22;30m" /* black */ +#define CL_RD2 "\x1B[22;31m" /* red */ +#define CL_GR2 "\x1B[22;32m" /* green */ +#define CL_YL2 "\x1B[22;33m" /* dark yellow */ +#define CL_BL2 "\x1B[22;34m" /* blue */ +#define CL_MA2 "\x1B[22;35m" /* magenta */ +#define CL_CY2 "\x1B[22;36m" /* cyan */ +#define CL_SIL "\x1B[22;37m" /* gray */ + +#ifdef WIN32 +#define CL_GRY "\x1B[01;30m" /* dark gray */ +#else +#define CL_GRY "\x1B[90m" /* dark gray selectable in putty */ +#endif +#define CL_LRD "\x1B[01;31m" /* light red */ +#define CL_LGR "\x1B[01;32m" /* light green */ +#define CL_LYL "\x1B[01;33m" /* tooltips */ +#define CL_LBL "\x1B[01;34m" /* light blue */ +#define CL_LMA "\x1B[01;35m" /* light magenta */ +#define CL_LCY "\x1B[01;36m" /* light cyan */ + +#define CL_WHT "\x1B[01;37m" /* white */ + +extern void format_hashrate(double hashrate, char *output); +extern void applog(int prio, const char *fmt, ...); +extern void gpulog(int prio, int thr_id, const char *fmt, ...); +void get_defconfig_path(char *out, size_t bufsize, char *argv0); +extern double throughput2intensity(uint32_t throughput); +extern void cbin2hex(char *out, const char *in, size_t len); +extern char *bin2hex(const unsigned char *in, size_t len); +extern bool hex2bin(void *output, const char *hexstr, size_t len); +extern int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); +extern bool fulltest(const uint32_t *hash, const uint32_t *target); +void diff_to_target(uint32_t* target, double diff); +void work_set_target(struct work* work, double diff); +double target_to_diff(uint32_t* target); +extern void get_currentalgo(char* buf, int sz); + +// bignum +double bn_convert_nbits(const uint32_t nbits); +void bn_nbits_to_uchar(const uint32_t nBits, uchar *target); +double bn_hash_target_ratio(uint32_t* hash, uint32_t* target); +void bn_store_hash_target_ratio(uint32_t* hash, uint32_t* target, struct work* work, int nonce); +void bn_set_target_ratio(struct work* work, uint32_t* hash, int nonce); +void work_set_target_ratio(struct work* work, uint32_t* hash); + +// bench +extern int bench_algo; +void bench_init(int threads); +void bench_free(); +bool bench_algo_switch_next(int thr_id); +void bench_set_throughput(int thr_id, uint32_t throughput); +void bench_display_results(); + +struct stratum_job { + char *job_id; + unsigned char prevhash[32]; + size_t coinbase_size; + unsigned char *coinbase; + unsigned char *xnonce2; + int merkle_count; + unsigned char **merkle; + unsigned char version[4]; + unsigned char nbits[4]; + unsigned char ntime[4]; + unsigned char claim[32]; // lbry + bool clean; + unsigned char nreward[2]; + uint32_t height; + double diff; +}; + +struct stratum_ctx { + char *url; + + CURL *curl; + char *curl_url; + char curl_err_str[CURL_ERROR_SIZE]; + curl_socket_t sock; + size_t sockbuf_size; + char *sockbuf; + + double next_diff; + double sharediff; + + char *session_id; + size_t xnonce1_size; + unsigned char *xnonce1; + size_t xnonce2_size; + struct stratum_job job; + + struct timeval tv_submit; + uint32_t answer_msec; + int pooln; + time_t tm_connected; + + int srvtime_diff; +}; + +#define POK_MAX_TXS 4 +#define POK_MAX_TX_SZ 16384U +struct tx { + uint8_t data[POK_MAX_TX_SZ]; + uint32_t len; +}; + +#define MAX_NONCES 2 +struct work { + uint32_t data[48]; + uint32_t target[8]; + uint32_t maxvote; + + char job_id[128]; + size_t xnonce2_len; + uchar xnonce2[32]; + + union { + uint32_t u32[2]; + uint64_t u64[1]; + } noncerange; + + uint32_t nonces[MAX_NONCES]; + + double targetdiff; + double shareratio[MAX_NONCES]; + double sharediff[MAX_NONCES]; + uint32_t height; + uint8_t pooln; + + uint32_t scanned_from; + uint32_t scanned_to; + + /* pok getwork txs */ + uint32_t tx_count; + struct tx txs[POK_MAX_TXS]; +}; + +#define POK_BOOL_MASK 0x00008000 +#define POK_DATA_MASK 0xFFFF0000 + + +#define MAX_POOLS 8 +struct pool_infos { + uint8_t id; +#define POOL_UNUSED 0 +#define POOL_GETWORK 1 +#define POOL_STRATUM 2 +#define POOL_LONGPOLL 4 + uint8_t type; +#define POOL_ST_DEFINED 1 +#define POOL_ST_VALID 2 +#define POOL_ST_DISABLED 4 +#define POOL_ST_REMOVED 8 + uint16_t status; + int algo; + char name[64]; + // credentials + char url[512]; + char short_url[64]; + char user[128]; + char pass[384]; + // config options + double max_diff; + double max_rate; + int shares_limit; + int time_limit; + int scantime; + // connection + struct stratum_ctx stratum; + uint8_t allow_gbt; + uint8_t allow_mininginfo; + uint16_t check_dups; // 16_t for align + int retries; + int fail_pause; + int timeout; + // stats + uint32_t work_time; + uint32_t wait_time; + uint32_t accepted_count; + uint32_t rejected_count; + uint32_t solved_count; + uint32_t stales_count; + time_t last_share_time; + double best_share; + uint32_t disconnects; +}; + +extern struct pool_infos pools[MAX_POOLS]; +extern int num_pools; +extern volatile int cur_pooln; + +void pool_init_defaults(void); +void pool_set_creds(int pooln); +void pool_set_attr(int pooln, const char* key, char* arg); +bool pool_switch_url(char *params); +bool pool_switch(int thr_id, int pooln); +bool pool_switch_next(int thr_id); +int pool_get_first_valid(int startfrom); +bool parse_pool_array(json_t *obj); +void pool_dump_infos(void); + +json_t * json_rpc_call_pool(CURL *curl, struct pool_infos*, const char *req, bool lp_scan, bool lp, int *err); +json_t * json_rpc_longpoll(CURL *curl, char *lp_url, struct pool_infos*, const char *req, int *err); + +bool stratum_socket_full(struct stratum_ctx *sctx, int timeout); +bool stratum_send_line(struct stratum_ctx *sctx, char *s); +char *stratum_recv_line(struct stratum_ctx *sctx); +bool stratum_connect(struct stratum_ctx *sctx, const char *url); +void stratum_disconnect(struct stratum_ctx *sctx); +bool stratum_subscribe(struct stratum_ctx *sctx); +bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *pass); +bool stratum_handle_method(struct stratum_ctx *sctx, const char *s); +void stratum_free_job(struct stratum_ctx *sctx); + +void hashlog_remember_submit(struct work* work, uint32_t nonce); +void hashlog_remember_scan_range(struct work* work); +uint32_t hashlog_already_submittted(char* jobid, uint32_t nounce); +uint32_t hashlog_get_last_sent(char* jobid); +uint64_t hashlog_get_scan_range(char* jobid); +int hashlog_get_history(struct hashlog_data *data, int max_records); +void hashlog_purge_old(void); +void hashlog_purge_job(char* jobid); +void hashlog_purge_all(void); +void hashlog_dump_job(char* jobid); +void hashlog_getmeminfo(uint64_t *mem, uint32_t *records); + +void stats_remember_speed(int thr_id, uint32_t hashcount, double hashrate, uint8_t found, uint32_t height); +double stats_get_speed(int thr_id, double def_speed); +double stats_get_gpu_speed(int gpu_id); +int stats_get_history(int thr_id, struct stats_data *data, int max_records); +void stats_purge_old(void); +void stats_purge_all(void); +void stats_getmeminfo(uint64_t *mem, uint32_t *records); + +struct thread_q; + +extern struct thread_q *tq_new(void); +extern void tq_free(struct thread_q *tq); +extern bool tq_push(struct thread_q *tq, void *data); +extern void *tq_pop(struct thread_q *tq, const struct timespec *abstime); +extern void tq_freeze(struct thread_q *tq); +extern void tq_thaw(struct thread_q *tq); + +#define EXIT_CODE_OK 0 +#define EXIT_CODE_USAGE 1 +#define EXIT_CODE_POOL_TIMEOUT 2 +#define EXIT_CODE_SW_INIT_ERROR 3 +#define EXIT_CODE_CUDA_NODEVICE 4 +#define EXIT_CODE_CUDA_ERROR 5 +#define EXIT_CODE_TIME_LIMIT 0 +#define EXIT_CODE_KILLED 7 + +void parse_arg(int key, char *arg); +void proper_exit(int reason); +void restart_threads(void); + +size_t time2str(char* buf, time_t timer); +char* atime2str(time_t timer); + +void applog_hex(void *data, int len); +void applog_hash(void *hash); +void applog_hash64(void *hash); +void applog_compare_hash(void *hash, void *hash_ref); + +void print_hash_tests(void); +void blake256_8roundHash(void *output, const void *input); +void blake256_14roundHash(void *output, const void *input); +void blake2s_hash(void *output, const void *input); +//void whirlxHash(void *state, const void *input); +void keccak256_hash(void *state, const void *input); +void hsr_hash(void *output, const void *input); +void lyra2re_hash(void *state, const void *input); +void lyra2v2_hash(void *state, const void *input); +void decred_hash(void *state, const void *input); +void skeincoinhash(void *output, const void *input); +void skein2hash(void *output, const void *input); +void nist5hash(void *state, const void *input); +void quarkhash(void *state, const void *input); +void qubithash(void *state, const void *input); +void wcoinhash(void *state, const void *input); +void x11hash(void *output, const void *input); +void x11evo_hash(void *output, const void *input); +void c11hash(void *output, const void *input); +void sibhash(void *output, const void *input); +void x13hash(void *output, const void *input); +void x14hash(void *output, const void *input); +void x15hash(void *output, const void *input); +void x17hash(void *output, const void *input); +void lbry_hash(void *output, const void *input); +void neoscrypt(uchar *output, const uchar *input, uint32_t profile); +void siahash(void *output, const void *input); +void myriadhash(void *state, const void *input); +void veltorhash(void *output, const void *input); +//void yescrypt_hash(void *output, const void *input); +#ifdef __cplusplus +} +#endif + +#endif /* __MINER_H__ */ diff --git a/myriadgroestl.cu b/myriadgroestl.cu new file mode 100644 index 0000000..ea0fbe0 --- /dev/null +++ b/myriadgroestl.cu @@ -0,0 +1,140 @@ +#include +#include +#include +#include + +#include "sph/sph_groestl.h" + +#include "miner.h" +#include "cuda_helper.h" + +#define NBN 2 +//#define NPT 2 + +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +void myriadgroestl_cpu_init(int thr_id, uint32_t threads); +void myriadgroestl_cpu_free(int thr_id); +void myriadgroestl_cpu_setBlock(int thr_id, void *data); +void myriadgroestl_cpu_hash(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_resNounce, const uint64_t target); + +void myriadhash(void *state, const void *input) +{ + uint32_t _ALIGN(64) hash[16]; + sph_groestl512_context ctx_groestl; + SHA256_CTX sha256; + + sph_groestl512_init(&ctx_groestl); + sph_groestl512(&ctx_groestl, input, 80); + sph_groestl512_close(&ctx_groestl, hash); + + SHA256_Init(&sha256); + SHA256_Update(&sha256,(unsigned char *)hash, 64); + SHA256_Final((unsigned char *)hash, &sha256); + + memcpy(state, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +int scanhash_myriad(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done) +{ + uint32_t _ALIGN(64) endiandata[32]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + uint32_t first_nonce = pdata[19]; + int dev_id = device_map[thr_id]; + int intensity = 23;//(device_sm[dev_id] >= 600) ? 20 : 18; + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ptarget[7] = 0x00000000; + + // init + if(!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + myriadgroestl_cpu_init(thr_id, throughput); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + CUDA_SAFE_CALL(cudaMallocHost(&h_resNonce[thr_id], NBN * sizeof(uint32_t))); + + init[thr_id] = true; + } + + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + myriadgroestl_cpu_setBlock(thr_id, endiandata); + + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + int rc = 0; + do { + myriadgroestl_cpu_hash(thr_id, throughput, pdata[19], d_resNonce[thr_id], *(uint64_t*)&ptarget[6]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + uint32_t _ALIGN(64) vhash64[8]; + endiandata[19] = swab32(h_resNonce[thr_id][0]); + myriadhash(vhash64, endiandata); + if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { + *hashes_done = pdata[19] - first_nonce + throughput + 1; + rc = 1; + work_set_target_ratio(work, vhash64); + pdata[19] = h_resNonce[thr_id][0]; + work->nonces[0] = pdata[19]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", swab32(h_resNonce[thr_id][1])); + endiandata[19] = swab32(h_resNonce[thr_id][1]); + myriadhash(vhash64, endiandata); + pdata[21] = h_resNonce[thr_id][1]; + work->nonces[1] = pdata[21]; + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + xchg(work->nonces[ 0],work->nonces[ 1]); + } + rc=2; + } + return rc; + } else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && (uint64_t)max_nonce > (uint64_t)throughput + (uint64_t)pdata[19]); + + *hashes_done = pdata[19] - first_nonce + 1; + + return rc; +} + +// cleanup +void free_myriad(int thr_id){ + + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + cudaFreeHost(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + myriadgroestl_cpu_free(thr_id); + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/neoscrypt/cuda_neoscrypt.cu b/neoscrypt/cuda_neoscrypt.cu new file mode 100644 index 0000000..e9929c8 --- /dev/null +++ b/neoscrypt/cuda_neoscrypt.cu @@ -0,0 +1,1068 @@ +// originally from djm34 (https://github.com/djm34/ccminer-sp-neoscrypt/) +// forked from KlausT repository + +// 1. Removed compute3.0 and lower compute capability +// 2. Replaced 64bit shifts with byte permutations +// 3. Removed pointer fetching from constant memory +// 4. Better loop unrolling factors for cp5.0/5.2 +// 6. More precomputations +// 7. Increased default intensity (?) +// 8. Restored Second nonce buffer +// 9. Use video SIMD instruction for cumulative sum of bufidx +// Provos Alexis - 2016 + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#if (defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) +#define __LDG_PTR "l" +#else +#define __LDG_PTR "r" +#endif + +#ifdef _MSC_VER +#define THREAD __declspec(thread) +#else +#define THREAD __thread +#endif + +static cudaStream_t stream[MAX_GPUS][2]; + +__constant__ uint32_t key_init[16]; +__constant__ uint32_t _ALIGN(16) c_data[64]; +__constant__ uint32_t _ALIGN(8) buf_shifts[16]; + +/// constants /// + +static const __constant__ uint8 BLAKE2S_IV_Vec = +{ + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 +}; + + +static const uint8 BLAKE2S_IV_Vechost = +{ + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 +}; + +static const uint32_t BLAKE2S_SIGMA_host[10][16] = +{ + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3}, + {11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4}, {7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8}, + {9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13}, {2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9}, + {12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11}, {13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10}, + {6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5}, {10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0}, +}; + +#define SALSA(a,b,c,d){ \ + b^=ROTL32(a+d, 7);\ + c^=ROTL32(a+b, 9);\ + d^=ROTL32(b+c, 13);\ + a^=ROTL32(c+d, 18);\ +} + +#define SALSA_CORE(state) { \ + SALSA(state.s0,state.s4,state.s8,state.sc);\ + SALSA(state.s5,state.s9,state.sd,state.s1);\ + SALSA(state.sa,state.se,state.s2,state.s6);\ + SALSA(state.sf,state.s3,state.s7,state.sb);\ + SALSA(state.s0,state.s1,state.s2,state.s3);\ + SALSA(state.s5,state.s6,state.s7,state.s4);\ + SALSA(state.sa,state.sb,state.s8,state.s9);\ + SALSA(state.sf,state.sc,state.sd,state.se);\ +} + +#define CHACHA_STEP(a,b,c,d) { \ + a += b; d = __byte_perm(d^a,0,0x1032); \ + c += d; b = ROTL32(b^c, 12); \ + a += b; d = __byte_perm(d^a,0,0x2103); \ + c += d; b = ROTL32(b^c, 7); \ +} + +#define CHACHA_CORE_PARALLEL(state){\ + CHACHA_STEP(state.lo.s0, state.lo.s4, state.hi.s0, state.hi.s4); \ + CHACHA_STEP(state.lo.s1, state.lo.s5, state.hi.s1, state.hi.s5); \ + CHACHA_STEP(state.lo.s2, state.lo.s6, state.hi.s2, state.hi.s6); \ + CHACHA_STEP(state.lo.s3, state.lo.s7, state.hi.s3, state.hi.s7); \ + CHACHA_STEP(state.lo.s0, state.lo.s5, state.hi.s2, state.hi.s7); \ + CHACHA_STEP(state.lo.s1, state.lo.s6, state.hi.s3, state.hi.s4); \ + CHACHA_STEP(state.lo.s2, state.lo.s7, state.hi.s0, state.hi.s5); \ + CHACHA_STEP(state.lo.s3, state.lo.s4, state.hi.s1, state.hi.s6); \ +} + +#define BLAKE_G(idx0, idx1, a, b, c, d, key) { \ + idx = BLAKE2S_SIGMA[idx0][idx1]; a += key[idx]; \ + a += b; d = __byte_perm(d^a,0, 0x1032); \ + c += d; b = ROTR32(b^c, 12); \ + idx = BLAKE2S_SIGMA[idx0][idx1+1]; a += key[idx]; \ + a += b; d = __byte_perm(d^a,0, 0x0321); \ + c += d; b = ROTR32(b^c, 7); \ +} + +#define BLAKE(a, b, c, d, key1,key2) { \ + a += b + key1; \ + d = __byte_perm(d^a, 0, 0x1032); \ + c += d; b = ROTR32(b^c, 12); \ + a += b + key2; \ + d = __byte_perm(d^a, 0, 0x0321); \ + c += d; b = ROTR32(b^c, 7); \ +} + +#define BLAKE_G_PRE(idx0, idx1, a, b, c, d, key) { \ + a += b + key[idx0]; \ + d = __byte_perm(d^a, 0, 0x1032); \ + c += d; b = ROTR32(b^c, 12); \ + a += b + key[idx1]; \ + d = __byte_perm(d^a, 0, 0x0321); \ + c += d; b = ROTR32(b^c, 7); \ +} + +#define BLAKE_G_PRE0(idx0, idx1, a, b, c, d, key) { \ + a += b; d = __byte_perm(d^a, 0, 0x1032); \ + c += d; b = ROTR32(b^c, 12); \ + a += b; d = __byte_perm(d^a, 0, 0x0321); \ + c += d; b = ROTR32(b^c, 7); \ +} + +#define BLAKE_G_PRE1(idx0, idx1, a, b, c, d, key) { \ + a += b + key[idx0]; \ + d = __byte_perm(d^a, 0, 0x1032); \ + c += d; b = ROTR32(b^c, 12); \ + a += b; d = __byte_perm(d^a, 0, 0x0321); \ + c += d; b = ROTR32(b^c, 7); \ +} + +#define BLAKE_G_PRE2(idx0, idx1, a, b, c, d, key) { \ + a += b; d = __byte_perm(d^a,0, 0x1032); \ + c += d; b = ROTR32(b^c, 12); \ + a += b + key[idx1]; \ + d = __byte_perm(d^a,0, 0x0321); \ + c += d; b = ROTR32(b^c, 7); \ +} + +#define BLAKE_Ghost(idx0, idx1, a, b, c, d, key) { \ + idx = BLAKE2S_SIGMA_host[idx0][idx1]; \ + a += b + key[idx]; \ + d = ROTR32(d^a, 16); \ + c += d; b = ROTR32(b^c, 12); \ + idx = BLAKE2S_SIGMA_host[idx0][idx1+1]; \ + a += b + key[idx]; \ + d = ROTR32(d^a, 8); \ + c += d; b = ROTR32(b^c, 7); \ +} + +__device__ __forceinline__ +static void Blake2S_v2(uint32_t *out, const uint32_t* __restrict__ inout, const uint32_t * __restrict__ TheKey){ + + uint16 V; + uint8 tmpblock; + + V.hi = BLAKE2S_IV_Vec; + V.lo = BLAKE2S_IV_Vec; + V.lo.s0 ^= 0x01012020; + + // Copy input block for later + tmpblock = V.lo; + + V.hi.s4 ^= 64; + + // { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + BLAKE_G_PRE(0, 1, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE(2, 3, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE(4, 5, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE(6, 7, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE0(8, 9, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE0(10, 11, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE0(12, 13, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE0(14, 15, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + // { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, + BLAKE_G_PRE0(14, 10, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE1(4, 8, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE0(9, 15, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE2(13, 6, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE1(1, 12, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE(0, 2, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE2(11, 7, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE(5, 3, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + // { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, + BLAKE_G_PRE0(11, 8, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE2(12, 0, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE(5, 2, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE0(15, 13, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE0(10, 14, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE(3, 6, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE(7, 1, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE2(9, 4, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + // { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, + BLAKE_G_PRE1(7, 9, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE(3, 1, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE0(13, 12, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE0(11, 14, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE(2, 6, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE1(5, 10, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE(4, 0, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE0(15, 8, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + // { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, + BLAKE_G_PRE2(9, 0, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE(5, 7, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE(2, 4, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE0(10, 15, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE2(14, 1, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE0(11, 12, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE1(6, 8, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE1(3, 13, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + // { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }, + BLAKE_G_PRE1(2, 12, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE1(6, 10, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE1(0, 11, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE2(8, 3, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE1(4, 13, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE(7, 5, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE0(15, 14, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE1(1, 9, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + + // { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 }, + BLAKE_G_PRE2(12, 5, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE1(1, 15, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE0(14, 13, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE1(4, 10, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE(0, 7, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE(6, 3, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE2(9, 2, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE0(8, 11, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + + // { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 }, + BLAKE_G_PRE0(13, 11, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE1(7, 14, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE2(12, 1, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE1(3, 9, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE(5, 0, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE2(15, 4, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE2(8, 6, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE(2, 10, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + // { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 }, + BLAKE_G_PRE1(6, 15, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE0(14, 9, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE2(11, 3, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE1(0, 8, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE2(12, 2, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE2(13, 7, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE(1, 4, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE2(10, 5, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + // { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 }, + BLAKE_G_PRE2(10, 2, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, TheKey); + BLAKE_G_PRE2(8, 4, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, TheKey); + BLAKE_G_PRE(7, 6, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, TheKey); + BLAKE_G_PRE(1, 5, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, TheKey); + BLAKE_G_PRE0(15, 11, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, TheKey); + BLAKE_G_PRE0(9, 14, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, TheKey); + BLAKE_G_PRE1(3, 12, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, TheKey); + BLAKE_G_PRE2(13, 0, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, TheKey); + + V.lo = V.lo ^ tmpblock ^ V.hi; + + V.hi = BLAKE2S_IV_Vec; + tmpblock = V.lo; + + V.hi.s4 ^= 128; + V.hi.s6 = ~V.hi.s6; + + // { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + BLAKE_G_PRE(0, 1, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout); + BLAKE_G_PRE(2, 3, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout); + BLAKE_G_PRE(4, 5, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout); + BLAKE_G_PRE(6, 7, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout); + BLAKE_G_PRE(8, 9, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout); + BLAKE_G_PRE(10, 11, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout); + BLAKE_G_PRE(12, 13, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout); + BLAKE_G_PRE(14, 15, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout); + + + // { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, + BLAKE_G_PRE(14, 10, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout); + BLAKE_G_PRE(4, 8, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout); + BLAKE_G_PRE(9, 15, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout); + BLAKE_G_PRE(13, 6, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout); + BLAKE_G_PRE(1, 12, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout); + BLAKE_G_PRE(0, 2, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout); + BLAKE_G_PRE(11, 7, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout); + BLAKE_G_PRE(5, 3, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout); + + // { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, + BLAKE_G_PRE(11, 8, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout); + BLAKE_G_PRE(12, 0, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout); + BLAKE_G_PRE(5, 2, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout); + BLAKE_G_PRE(15, 13, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout); + BLAKE_G_PRE(10, 14, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout); + BLAKE_G_PRE(3, 6, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout); + BLAKE_G_PRE(7, 1, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout); + BLAKE_G_PRE(9, 4, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout); + + + // { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, + BLAKE_G_PRE(7, 9, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout); + BLAKE_G_PRE(3, 1, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout); + BLAKE_G_PRE(13, 12, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout); + BLAKE_G_PRE(11, 14, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout); + BLAKE_G_PRE(2, 6, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout); + BLAKE_G_PRE(5, 10, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout); + BLAKE_G_PRE(4, 0, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout); + BLAKE_G_PRE(15, 8, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout); + + //#pragma unroll + + // 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, + // 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, + // 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, + + BLAKE(V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout[9], inout[0]); + BLAKE(V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout[5], inout[7]); + BLAKE(V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout[2], inout[4]); + BLAKE(V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout[10], inout[15]); + BLAKE(V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout[14], inout[1]); + BLAKE(V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout[11], inout[12]); + BLAKE(V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout[6], inout[8]); + BLAKE(V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout[3], inout[13]); + + BLAKE(V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout[2], inout[12]); + BLAKE(V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout[6], inout[10]); + BLAKE(V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout[0], inout[11]); + BLAKE(V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout[8], inout[3]); + BLAKE(V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout[4], inout[13]); + BLAKE(V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout[7], inout[5]); + BLAKE(V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout[15], inout[14]); + BLAKE(V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout[1], inout[9]); + + BLAKE(V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout[12], inout[5]); + BLAKE(V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout[1], inout[15]); + BLAKE(V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout[14], inout[13]); + BLAKE(V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout[4], inout[10]); + BLAKE(V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout[0], inout[7]); + BLAKE(V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout[6], inout[3]); + BLAKE(V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout[9], inout[2]); + BLAKE(V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout[8], inout[11]); + + // 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, + // 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, + + BLAKE(V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout[13], inout[11]); + BLAKE(V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout[7], inout[14]); + BLAKE(V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout[12], inout[1]); + BLAKE(V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout[3], inout[9]); + BLAKE(V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout[5], inout[0]); + BLAKE(V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout[15], inout[4]); + BLAKE(V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout[8], inout[6]); + BLAKE(V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout[2], inout[10]); + + BLAKE(V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout[6], inout[15]); + BLAKE(V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout[14], inout[9]); + BLAKE(V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout[11], inout[3]); + BLAKE(V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout[0], inout[8]); + BLAKE(V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout[12], inout[2]); + BLAKE(V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout[13], inout[7]); + BLAKE(V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout[1], inout[4]); + BLAKE(V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout[10], inout[5]); + // 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, + BLAKE(V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout[10], inout[2]); + BLAKE(V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout[8], inout[4]); + BLAKE(V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout[7], inout[6]); + BLAKE(V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout[1], inout[5]); + BLAKE(V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout[15], inout[11]); + BLAKE(V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout[9], inout[14]); + BLAKE(V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout[3], inout[12]); + BLAKE(V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout[13], inout[0]); + + ((uint8*)out)[0] = V.lo ^ tmpblock ^ V.hi; +} + +__device__ __forceinline__ +static uint16 salsa_small_scalar_rnd(const uint16 &X) +{ + uint16 state = X; + + for (uint32_t i = 0; i < 10; i++) { + SALSA_CORE(state); + } + + return(X + state); +} + +__device__ __forceinline__ +static uint16 chacha_small_parallel_rnd(const uint16 &X){ + + uint16 state = X; + + for (uint32_t i = 0; i < 10; i++) { + CHACHA_CORE_PARALLEL(state); + } + return (X + state); +} + +static void Blake2Shost(uint32_t * inout, const uint32_t * inkey){ + + uint16 V; + uint32_t idx; + uint8 tmpblock; + + V.hi = BLAKE2S_IV_Vechost; + V.lo = BLAKE2S_IV_Vechost; + V.lo.s0 ^= 0x01012020; + + // Copy input block for later + tmpblock = V.lo; + + V.hi.s4 ^= 64; + + for(int x = 0; x < 10; ++x) + { + BLAKE_Ghost(x, 0x00, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inkey); + BLAKE_Ghost(x, 0x02, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inkey); + BLAKE_Ghost(x, 0x04, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inkey); + BLAKE_Ghost(x, 0x06, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inkey); + BLAKE_Ghost(x, 0x08, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inkey); + BLAKE_Ghost(x, 0x0A, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inkey); + BLAKE_Ghost(x, 0x0C, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inkey); + BLAKE_Ghost(x, 0x0E, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inkey); + } + + V.lo ^= V.hi; + V.lo ^= tmpblock; + + V.hi = BLAKE2S_IV_Vechost; + tmpblock = V.lo; + + V.hi.s4 ^= 128; + V.hi.s6 = ~V.hi.s6; + + for(int x = 0; x < 10; ++x) + { + BLAKE_Ghost(x, 0x00, V.lo.s0, V.lo.s4, V.hi.s0, V.hi.s4, inout); + BLAKE_Ghost(x, 0x02, V.lo.s1, V.lo.s5, V.hi.s1, V.hi.s5, inout); + BLAKE_Ghost(x, 0x04, V.lo.s2, V.lo.s6, V.hi.s2, V.hi.s6, inout); + BLAKE_Ghost(x, 0x06, V.lo.s3, V.lo.s7, V.hi.s3, V.hi.s7, inout); + BLAKE_Ghost(x, 0x08, V.lo.s0, V.lo.s5, V.hi.s2, V.hi.s7, inout); + BLAKE_Ghost(x, 0x0A, V.lo.s1, V.lo.s6, V.hi.s3, V.hi.s4, inout); + BLAKE_Ghost(x, 0x0C, V.lo.s2, V.lo.s7, V.hi.s0, V.hi.s5, inout); + BLAKE_Ghost(x, 0x0E, V.lo.s3, V.lo.s4, V.hi.s1, V.hi.s6, inout); + } + + V.lo ^= V.hi ^ tmpblock; + + ((uint8*)inout)[0] = V.lo; +} + +#define TPB 128 + +#define TPBchacha152 64 +#define TPBchacha150 128 + +#define TPBchacha252 512 +#define TPBchacha250 128 + +#define TPBsalsa152 512 +#define TPBsalsa150 512 + +#define TPBsalsa252 512 +#define TPBsalsa250 128 + +__global__ __launch_bounds__(TPB, 2) +void neoscrypt_gpu_hash_start(int stratum, uint32_t threads, uint32_t startNonce,uint2x4* Input){ + + __shared__ uint32_t s_data[64 * TPB]; + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if(thread>1)] = __byte_perm(temp[(k>>1)],temp[(k>>1)+1],bitbuf); + } + + if(qbuf < 60){ + const uint32_t noncepos = 19 - qbuf % 20; + if (noncepos <= 16){ + if (noncepos) + input[noncepos - 1] = __byte_perm(data18,nonce,bitbuf); + if (noncepos != 16U) + input[noncepos] = __byte_perm(nonce,data20,bitbuf); + } + } + + Blake2S_v2(input, input, key); + + #pragma unroll 9 + for (uint32_t k = 0; k < 9; k++) + B[(k + qbuf) & 0x3f] = temp[k]; + + #pragma unroll 31 + for (uint32_t i = 1; i < 31; i++) + { + uint8_t bufidx = 0; + #pragma unroll 4 + for (uint32_t x = 0; x < 8; x+=2){ + bufidx+= __vsadu4(input[x],0) + __vsadu4(input[x+1],0); + } + qbuf = bufidx >> 2; + rbuf = bufidx & 3; + bitbuf = rbuf << 3; + + uint32_t temp[9]; + + uint32_t shift = 32 - bitbuf; + const uint32_t byte_perm_shift = 0x76543210ULL >> (shift>>1); + const uint32_t byte_perm_bitbf = 0x76543210ULL >> (bitbuf>>1); + + shift = (input[7]>>shift); + temp[8] = B[(8 + qbuf) & 0x3f] ^ shift; + shift = __byte_perm(input[ 6],input[ 7],byte_perm_shift); + temp[7] = B[(7 + qbuf) & 0x3f] ^ shift; + shift = __byte_perm(input[ 5],input[ 6],byte_perm_shift); + temp[6] = B[(6 + qbuf) & 0x3f] ^ shift; + shift = __byte_perm(input[ 4],input[ 5],byte_perm_shift); + temp[5] = B[(5 + qbuf) & 0x3f] ^ shift; + shift = __byte_perm(input[ 3],input[ 4],byte_perm_shift); + temp[4] = B[(4 + qbuf) & 0x3f] ^ shift; + shift = __byte_perm(input[ 2],input[ 3],byte_perm_shift); + temp[3] = B[(3 + qbuf) & 0x3f] ^ shift; + shift = __byte_perm(input[ 1],input[ 2],byte_perm_shift); + temp[2] = B[(2 + qbuf) & 0x3f] ^ shift; + shift = __byte_perm(input[ 0],input[ 1],byte_perm_shift); + temp[1] = B[(1 + qbuf) & 0x3f] ^ shift; + temp[0] = B[(0 + qbuf) & 0x3f] ^ (input[ 0]<>1)] = __byte_perm(temp[(k>>1)],temp[(k>>1)+1],byte_perm_bitbf); + } + + if(qbuf < 60){ + const uint32_t noncepos = 19 - qbuf % 20U; + if (noncepos <= 16){ + if (noncepos) + input[noncepos - 1] = __byte_perm(data18,nonce,byte_perm_bitbf); + if (noncepos != 16U) + input[noncepos] = __byte_perm(nonce,data20,byte_perm_bitbf); + } + } + + Blake2S_v2(input, input, key); + + #pragma unroll 9 + for (int k = 0; k < 9; k++) + B[(k + qbuf) & 0x3f] = temp[k]; + } + + uint8_t bufidx = 0; + #pragma unroll 4 + for (uint32_t x = 0; x < 8; x+=2){ + bufidx+= __vsadu4(input[x],0) + __vsadu4(input[x+1],0); + } + qbuf = bufidx >> 2; + rbuf = bufidx & 3; + + uint32_t byte_perm_bitbf = 0x76543210ULL >> (rbuf<<2); + + uint2x4 output[8]; + #pragma unroll + for (uint32_t i = 0; i<64; i++) { + const uint32_t a = (qbuf + i) & 0x3f, b = (qbuf + i + 1) & 0x3f; + ((uint32_t*)output)[i] = __byte_perm(B[a],B[b],byte_perm_bitbf); + } + + output[0] ^= ((uint2x4*)input)[0]; + ((uint32_t*)output)[19] ^= nonce; + ((uint32_t*)output)[39] ^= nonce; + ((uint32_t*)output)[59] ^= nonce; + + #pragma unroll 8 + for(uint32_t i=0;i<8;i++){ + Input[i*threads+thread] = output[i] ^ ((uint2x4*)c_data)[i]; + } + } +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPBchacha152, 6) +#else +__launch_bounds__(TPBchacha150, 6) +#endif +void neoscrypt_gpu_hash_chacha1_stream1(const uint32_t threads,const uint2x4* Input, uint2x4 *const __restrict__ W, uint2x4 *const __restrict__ Tr){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if(thread 500 + #pragma unroll 8 + for(uint32_t j = 0; j<8; j++) + W[(thread<<10) + (i<<3) + j] = X[j]; + #else + #pragma unroll 8 + for(uint32_t j = 0; j<8; j++) + W[(i*8+j)*threads+thread] = X[j]; + #endif + + const uint16 temp = XV[2]; + XV[0] = chacha_small_parallel_rnd(XV[0] ^ XV[3]); + XV[2] = chacha_small_parallel_rnd(XV[1] ^ XV[0]); + XV[1] = chacha_small_parallel_rnd(XV[2] ^ temp); + XV[3] = chacha_small_parallel_rnd(XV[3] ^ XV[1]); + + } + + #pragma unroll 8 + for(uint32_t i = 0; i<8; i++) + Tr[i*threads+thread] = X[i]; + } +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPBchacha252, 1) +#else +__launch_bounds__(TPBchacha250, 1) +#endif +void neoscrypt_gpu_hash_chacha2_stream1(const uint32_t threads, const uint2x4 *const __restrict__ W, uint2x4 *const __restrict__ Tr){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint2x4 X[8]; + uint16* XV = (uint16*)X; + + if(thread 500 + #pragma unroll 8 + for(uint32_t j = 0; j<8; j++) + X[j] ^= __ldg4(&W[(thread<<10) + idx + j]); + #else + #pragma nounroll + for(uint32_t j = 0; j<8; j++) + X[j] ^= __ldg4(&W[(idx+j)*threads + thread]); + #endif + + const uint16 temp = XV[2]; + XV[0] = chacha_small_parallel_rnd(XV[0] ^ XV[3]); + XV[2] = chacha_small_parallel_rnd(XV[1] ^ XV[0]); + XV[1] = chacha_small_parallel_rnd(XV[2] ^ temp); + XV[3] = chacha_small_parallel_rnd(XV[3] ^ XV[1]); + } + + #pragma unroll 8 + for(uint32_t i = 0; i<8; i++) + Tr[i*threads+thread] = X[i]; + } +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPBsalsa152, 1) +#else +__launch_bounds__(TPBsalsa150, 1) +#endif +void neoscrypt_gpu_hash_salsa1_stream1(const uint32_t threads,const uint2x4* Input, uint2x4 *const __restrict__ W2, uint2x4 *const __restrict__ Tr2){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint2x4 Z[8]; + uint16* XV = (uint16*)Z; + + if(thread 500 + #pragma unroll 8 + for(uint32_t j = 0; j<8; j++) + W2[(thread<<10) + (i<<3) + j] = Z[j]; + #else + #pragma unroll 8 + for(uint32_t j = 0; j<8; j++) + W2[((i<<3)+j)*threads+thread] = Z[j]; + #endif + const uint16 temp = XV[ 2]; + + XV[0] = salsa_small_scalar_rnd(XV[0] ^ XV[3]); + XV[2] = salsa_small_scalar_rnd(XV[1] ^ XV[0]); + XV[1] = salsa_small_scalar_rnd(XV[2] ^ temp); + XV[3] = salsa_small_scalar_rnd(XV[3] ^ XV[1]); + } + + #pragma unroll 8 + for(uint32_t i = 0; i<8; i++) + Tr2[i*threads+thread] = Z[i]; + } +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPBsalsa252, 1) +#else +__launch_bounds__(TPBsalsa250, 1) +#endif +void neoscrypt_gpu_hash_salsa2_stream1(const uint32_t threads, const uint2x4 *const __restrict__ W2, uint2x4 *const __restrict__ Tr2){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint2x4 X[8]; + uint16* XV = (uint16*)X; + if(thread 500 + #pragma unroll 8 + for(uint32_t j = 0; j<8; j++) + X[j] ^= __ldg4(&W2[(thread<<10) + idx + j]); + #else + uint2x4 tmp[8]; + #pragma nounroll + for(uint32_t j = 0; j<8; j++) + tmp[j] = __ldg4(&W2[(idx+j)*threads + thread]); + #pragma nounroll + for(uint32_t j = 0; j<8; j++) + X[j] ^= tmp[j]; + #endif + const uint16 temp = XV[ 2]; + + XV[0] = salsa_small_scalar_rnd(XV[0] ^ XV[3]); + XV[2] = salsa_small_scalar_rnd(XV[1] ^ XV[0]); + XV[1] = salsa_small_scalar_rnd(XV[2] ^ temp); + XV[3] = salsa_small_scalar_rnd(XV[3] ^ XV[1]); + } + + #pragma unroll 8 + for(uint32_t i = 0; i<8; i++) + Tr2[i*threads+thread] = X[i]; + } +} + +__global__ __launch_bounds__(TPB, 3) +void neoscrypt_gpu_hash_ending(int stratum, uint32_t threads, uint32_t startNonce,const uint2x4 *const __restrict__ Tr,const uint2x4 *const __restrict__ Tr2, uint32_t *resNonces,const uint32_t target){ + + __shared__ uint32_t s_data[64 * TPB]; + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if(thread> 2; + bitbuf = (bufidx & 3) << 3; + + uint32_t shift = 32U - bitbuf; + const uint32_t byte_perm_shift = 0x76543210ULL >> (shift>>1); + const uint32_t byte_perm_bitbf = 0x76543210ULL >> (bitbuf>>1); + + shift = (input[7]>>shift); + B0[(8 + qbuf) & 0x3f] = (temp[8] = B0[(8 + qbuf) & 0x3f] ^ shift); + shift = __byte_perm(input[ 6],input[ 7],byte_perm_shift); + B0[(7 + qbuf) & 0x3f] = (temp[7] = B0[(7 + qbuf) & 0x3f] ^ shift); + shift = __byte_perm(input[ 5],input[ 6],byte_perm_shift); + B0[(6 + qbuf) & 0x3f] = (temp[6] = B0[(6 + qbuf) & 0x3f] ^ shift); + shift = __byte_perm(input[ 4],input[ 5],byte_perm_shift); + B0[(5 + qbuf) & 0x3f] = (temp[5] = B0[(5 + qbuf) & 0x3f] ^ shift); + shift = __byte_perm(input[ 3],input[ 4],byte_perm_shift); + B0[(4 + qbuf) & 0x3f] = (temp[4] = B0[(4 + qbuf) & 0x3f] ^ shift); + shift = __byte_perm(input[ 2],input[ 3],byte_perm_shift); + B0[(3 + qbuf) & 0x3f] = (temp[3] = B0[(3 + qbuf) & 0x3f] ^ shift); + shift = __byte_perm(input[ 1],input[ 2],byte_perm_shift); + B0[(2 + qbuf) & 0x3f] = (temp[2] = B0[(2 + qbuf) & 0x3f] ^ shift); + shift = __byte_perm(input[ 0],input[ 1],byte_perm_shift); + B0[(1 + qbuf) & 0x3f] = (temp[1] = B0[(1 + qbuf) & 0x3f] ^ shift); + B0[(0 + qbuf) & 0x3f] = (temp[0] = B0[(0 + qbuf) & 0x3f] ^ (input[ 0]<>1)] = __byte_perm(temp[(k>>1)],temp[(k>>1)+1],byte_perm_bitbf); + } + + if(qbuf<60){ + const uint32_t noncepos = 19 - qbuf % 20; + if (noncepos <= 16){ + if (noncepos != 0) + input[noncepos - 1] = __byte_perm(data18,nonce,byte_perm_bitbf); + if (noncepos != 16) + input[noncepos] = __byte_perm(nonce,data20,byte_perm_bitbf); + } + } + } + + Blake2S_v2(input, input, key); + + uint8_t bufidx = 0; + #pragma unroll 4 + for (uint32_t x = 0; x < 8; x+=2){ + bufidx+= __vsadu4(input[x],0) + __vsadu4(input[x+1],0); + } + qbuf = bufidx >> 2; + const uint32_t byte_perm_bitbf = 0x76543210ULL >> ((bufidx & 3)<<2); + const uint32_t output = input[ 7] ^ cdata7 ^ __byte_perm(B0[(qbuf + 7) & 0x3f],B0[(qbuf + 8) & 0x3f],byte_perm_bitbf); + + if (output <= target){ + // resNonces[0] = nonce; + uint32_t tmp = atomicExch(resNonces, Nonce); + if(tmp != UINT32_MAX) + resNonces[1] = tmp; + } + } +} + +uint2x4* W[MAX_GPUS]; +uint2x4* W2[MAX_GPUS]; // 2 streams +uint2x4* Trans1[MAX_GPUS]; +uint2x4* Trans2[MAX_GPUS]; // 2 streams +uint2x4 *Input[MAX_GPUS]; // 2 streams + +void neoscrypt_cpu_init(int thr_id, uint32_t threads) +{ + CUDA_SAFE_CALL(cudaStreamCreate(&stream[thr_id][0])); + CUDA_SAFE_CALL(cudaStreamCreate(&stream[thr_id][1])); + + CUDA_SAFE_CALL(cudaMalloc(&W[thr_id], 32 * 128 * sizeof(uint64_t) * threads)); + CUDA_SAFE_CALL(cudaMalloc(&W2[thr_id], 32 * 128 * sizeof(uint64_t) * threads)); + CUDA_SAFE_CALL(cudaMalloc(&Trans1[thr_id], 32 * sizeof(uint64_t) * threads)); + CUDA_SAFE_CALL(cudaMalloc(&Trans2[thr_id], 32 * sizeof(uint64_t) * threads)); + CUDA_SAFE_CALL(cudaMalloc(&Input[thr_id], 32 * sizeof(uint64_t) * threads)); +} + +__host__ +void neoscrypt_free(int thr_id){ + + cudaFree(W[thr_id]); + cudaFree(W2[thr_id]); + cudaFree(Trans1[thr_id]); + cudaFree(Trans2[thr_id]); + cudaFree(Input[thr_id]); + + cudaStreamDestroy(stream[thr_id][0]); + cudaStreamDestroy(stream[thr_id][1]); +} + +__host__ void neoscrypt_cpu_hash_k4(bool stratum, int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_resNonce,const uint32_t target7){ + + const uint32_t threadsperblock2 = TPB; + dim3 grid((threads + threadsperblock2 - 1) / threadsperblock2); + dim3 block(threadsperblock2); + + const int threadsperblock3 = device_sm[device_map[thr_id]]>500 ? TPBchacha152 : TPBchacha150; + dim3 grid3((threads + threadsperblock3 - 1) / threadsperblock3); + dim3 block3(threadsperblock3); + + const int threadsperblock4 = device_sm[device_map[thr_id]]>500 ? TPBsalsa152 : TPBsalsa150; + dim3 grid4((threads + threadsperblock4 - 1) / threadsperblock4); + dim3 block4(threadsperblock4); + + const int threadsperblock5 = device_sm[device_map[thr_id]]>500 ? TPBchacha252 : TPBchacha250; + dim3 grid5((threads + threadsperblock5 - 1) / threadsperblock5); + dim3 block5(threadsperblock5); + + const int threadsperblock6 = device_sm[device_map[thr_id]]>500 ? TPBsalsa252 : TPBsalsa250; + dim3 grid6((threads + threadsperblock6 - 1) / threadsperblock6); + dim3 block6(threadsperblock6); + + neoscrypt_gpu_hash_start <<< grid, block >>>(stratum, threads, startNounce,Input[thr_id]); //fastkdf + + cudaThreadSynchronize(); + + neoscrypt_gpu_hash_salsa1_stream1 <<< grid4, block4, 0, stream[thr_id][0] >>>(threads,Input[thr_id], W2[thr_id], Trans2[thr_id]); //salsa + neoscrypt_gpu_hash_chacha1_stream1 <<< grid3, block3, 0, stream[thr_id][1] >>>(threads,Input[thr_id], W[thr_id], Trans1[thr_id]); //chacha + + neoscrypt_gpu_hash_salsa2_stream1 <<< grid6, block6, 0, stream[thr_id][0] >>>(threads, W2[thr_id], Trans2[thr_id]);//salsa + neoscrypt_gpu_hash_chacha2_stream1 <<< grid5, block5, 0, stream[thr_id][1] >>>(threads, W[thr_id], Trans1[thr_id]); //chacha + + cudaStreamSynchronize(stream[thr_id][0]); + cudaStreamSynchronize(stream[thr_id][1]); + + neoscrypt_gpu_hash_ending << > >(stratum, threads, startNounce, Trans1[thr_id], Trans2[thr_id], d_resNonce,target7); //fastkdf+end +} + +__host__ void neoscrypt_setBlockTarget(uint32_t* pdata) +{ + uint32_t PaddedMessage[64]; + uint32_t input[16], key[16] = { 0 }; + + for (int i = 0; i < 19; i++) + { + PaddedMessage[i] = pdata[i]; + PaddedMessage[i + 20] = pdata[i]; + PaddedMessage[i + 40] = pdata[i]; + } + for (int i = 0; i<4; i++) + PaddedMessage[i + 60] = pdata[i]; + + PaddedMessage[19] = 0; + PaddedMessage[39] = 0; + PaddedMessage[59] = 0; + + ((uint16*)input)[0] = ((uint16*)pdata)[0]; + ((uint8*)key)[0] = ((uint8*)pdata)[0]; + + Blake2Shost(input, key); + +// cudaMemcpyToSymbol(input_init, input, 64, 0, cudaMemcpyHostToDevice); + uint8_t bufidx = 0; + for (int x = 0; x < 8; x++){ + uint32_t bufhelper = (input[x] & 0x00ff00ff) + ((input[x] & 0xff00ff00) >> 8); + bufhelper = bufhelper + (bufhelper >> 16); + bufidx += bufhelper; + } + uint32_t qbuf, rbuf, bitbuf; + qbuf = bufidx >> 2; + rbuf = bufidx & 3; + bitbuf = rbuf << 3; + uint32_t shifted[ 9]; + + uint32_t shift = 32 - bitbuf; + + #define LONGLONG(LO,HI) ((uint64_t)LO | (((uint64_t)HI) << 32)) + + shifted[ 0] = input[ 0] << bitbuf; + shifted[ 1] = LONGLONG(input[ 0],input[ 1]) >> shift; + shifted[ 2] = LONGLONG(input[ 1],input[ 2]) >> shift; + shifted[ 3] = LONGLONG(input[ 2],input[ 3]) >> shift; + shifted[ 4] = LONGLONG(input[ 3],input[ 4]) >> shift; + shifted[ 5] = LONGLONG(input[ 4],input[ 5]) >> shift; + shifted[ 6] = LONGLONG(input[ 5],input[ 6]) >> shift; + shifted[ 7] = LONGLONG(input[ 6],input[ 7]) >> shift; + shifted[ 8] = LONGLONG(input[ 7], 0) >> shift; + + uint32_t values[11];//qbuf,bitbuf,shiftedvalues + values[ 0] = qbuf; + values[ 1] = 0x76543210ULL >> (bitbuf >> 1); + + memcpy(&values[2],shifted,9*sizeof(uint32_t)); + + cudaMemcpyToSymbol(buf_shifts,values,11*sizeof(uint32_t),0,cudaMemcpyHostToDevice); + + + cudaMemcpyToSymbol(key_init, key, 64, 0, cudaMemcpyHostToDevice); + + cudaMemcpyToSymbol(c_data, PaddedMessage, 64 * sizeof(uint32_t), 0, cudaMemcpyHostToDevice); + CUDA_SAFE_CALL(cudaGetLastError()); +} diff --git a/neoscrypt/neoscrypt-cpu.c b/neoscrypt/neoscrypt-cpu.c new file mode 100644 index 0000000..d1ef2ff --- /dev/null +++ b/neoscrypt/neoscrypt-cpu.c @@ -0,0 +1,989 @@ +/* + * Copyright (c) 2009 Colin Percival, 2011 ArtForz + * Copyright (c) 2012 Andrew Moon (floodyberry) + * Copyright (c) 2012 Samuel Neves + * Copyright (c) 2014 John Doering + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +#include +#include +#include + +#include "neoscrypt.h" + +#ifdef WIN32 +/* sizeof(unsigned long) = 4 for MinGW64 */ +typedef unsigned long long ulong; +#else +typedef unsigned long ulong; +#endif +typedef unsigned int uint; +typedef unsigned char uchar; +typedef unsigned int bool; + +#define MIN(a, b) ((a) < (b) ? a : b) +#define MAX(a, b) ((a) > (b) ? a : b) + +/* SHA-256 */ + +static const uint32_t sha256_constants[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +#define Ch(x,y,z) (z ^ (x & (y ^ z))) +#define Maj(x,y,z) (((x | y) & z) | (x & y)) +#define S0(x) (ROTR32(x, 2) ^ ROTR32(x, 13) ^ ROTR32(x, 22)) +#define S1(x) (ROTR32(x, 6) ^ ROTR32(x, 11) ^ ROTR32(x, 25)) +#define G0(x) (ROTR32(x, 7) ^ ROTR32(x, 18) ^ (x >> 3)) +#define G1(x) (ROTR32(x, 17) ^ ROTR32(x, 19) ^ (x >> 10)) +#define W0(in,i) (U8TO32_BE(&in[i * 4])) +#define W1(i) (G1(w[i - 2]) + w[i - 7] + G0(w[i - 15]) + w[i - 16]) +#define STEP(i) \ + t1 = S0(r[0]) + Maj(r[0], r[1], r[2]); \ + t0 = r[7] + S1(r[4]) + Ch(r[4], r[5], r[6]) + sha256_constants[i] + w[i]; \ + r[7] = r[6]; \ + r[6] = r[5]; \ + r[5] = r[4]; \ + r[4] = r[3] + t0; \ + r[3] = r[2]; \ + r[2] = r[1]; \ + r[1] = r[0]; \ + r[0] = t0 + t1; + + +typedef struct sha256_hash_state_t { + uint32_t H[8]; + uint64_t T; + uint32_t leftover; + uint8_t buffer[SCRYPT_HASH_BLOCK_SIZE]; +} sha256_hash_state; + + +static void sha256_blocks(sha256_hash_state *S, const uint8_t *in, size_t blocks) +{ + uint32_t r[8], w[64], t0, t1; + size_t i; + + for (i = 0; i < 8; i++) + r[i] = S->H[i]; + + while (blocks--) { + for (i = 0U; i < 16; i++) { + w[i] = W0(in, i); + } + for (i = 16; i < 64; i++) { + w[i] = W1(i); + } + for (i = 0U; i < 64; i++) { + STEP(i); + } + for (i = 0U; i < 8U; i++) { + r[i] += S->H[i]; + S->H[i] = r[i]; + } + S->T += SCRYPT_HASH_BLOCK_SIZE * 8; + in += SCRYPT_HASH_BLOCK_SIZE; + } +} + +static void neoscrypt_hash_init_sha256(sha256_hash_state *S) +{ + S->H[0] = 0x6a09e667; + S->H[1] = 0xbb67ae85; + S->H[2] = 0x3c6ef372; + S->H[3] = 0xa54ff53a; + S->H[4] = 0x510e527f; + S->H[5] = 0x9b05688c; + S->H[6] = 0x1f83d9ab; + S->H[7] = 0x5be0cd19; + S->T = 0; + S->leftover = 0; +} + +static void neoscrypt_hash_update_sha256(sha256_hash_state *S, const uint8_t *in, size_t inlen) +{ + size_t blocks, want; + + /* handle the previous data */ + if (S->leftover) { + want = (SCRYPT_HASH_BLOCK_SIZE - S->leftover); + want = (want < inlen) ? want : inlen; + memcpy(S->buffer + S->leftover, in, want); + S->leftover += (uint32_t)want; + if (S->leftover < SCRYPT_HASH_BLOCK_SIZE) + return; + in += want; + inlen -= want; + sha256_blocks(S, S->buffer, 1); + } + + /* handle the current data */ + blocks = (inlen & ~(SCRYPT_HASH_BLOCK_SIZE - 1)); + S->leftover = (uint32_t)(inlen - blocks); + if (blocks) { + sha256_blocks(S, in, blocks / SCRYPT_HASH_BLOCK_SIZE); + in += blocks; + } + + /* handle leftover data */ + if (S->leftover) + memcpy(S->buffer, in, S->leftover); +} + +static void neoscrypt_hash_finish_sha256(sha256_hash_state *S, uint8_t *hash) +{ + uint64_t t = S->T + (S->leftover * 8); + + S->buffer[S->leftover] = 0x80; + if (S->leftover <= 55) { + memset(S->buffer + S->leftover + 1, 0, 55 - S->leftover); + } else { + memset(S->buffer + S->leftover + 1, 0, 63 - S->leftover); + sha256_blocks(S, S->buffer, 1); + memset(S->buffer, 0, 56); + } + + U64TO8_BE(S->buffer + 56, t); + sha256_blocks(S, S->buffer, 1); + + U32TO8_BE(&hash[ 0], S->H[0]); + U32TO8_BE(&hash[ 4], S->H[1]); + U32TO8_BE(&hash[ 8], S->H[2]); + U32TO8_BE(&hash[12], S->H[3]); + U32TO8_BE(&hash[16], S->H[4]); + U32TO8_BE(&hash[20], S->H[5]); + U32TO8_BE(&hash[24], S->H[6]); + U32TO8_BE(&hash[28], S->H[7]); +} + +static void neoscrypt_hash_sha256(hash_digest hash, const uint8_t *m, size_t mlen) +{ + sha256_hash_state st; + neoscrypt_hash_init_sha256(&st); + neoscrypt_hash_update_sha256(&st, m, mlen); + neoscrypt_hash_finish_sha256(&st, hash); +} + + +/* HMAC for SHA-256 */ + +typedef struct sha256_hmac_state_t { + sha256_hash_state inner, outer; +} sha256_hmac_state; + +static void neoscrypt_hmac_init_sha256(sha256_hmac_state *st, const uint8_t *key, size_t keylen) +{ + uint8_t pad[SCRYPT_HASH_BLOCK_SIZE] = {0}; + size_t i; + + neoscrypt_hash_init_sha256(&st->inner); + neoscrypt_hash_init_sha256(&st->outer); + + if (keylen <= SCRYPT_HASH_BLOCK_SIZE) { + /* use the key directly if it's <= blocksize bytes */ + memcpy(pad, key, keylen); + } else { + /* if it's > blocksize bytes, hash it */ + neoscrypt_hash_sha256(pad, key, keylen); + } + + /* inner = (key ^ 0x36) */ + /* h(inner || ...) */ + for (i = 0; i < SCRYPT_HASH_BLOCK_SIZE; i++) + pad[i] ^= 0x36; + neoscrypt_hash_update_sha256(&st->inner, pad, SCRYPT_HASH_BLOCK_SIZE); + + /* outer = (key ^ 0x5c) */ + /* h(outer || ...) */ + for (i = 0; i < SCRYPT_HASH_BLOCK_SIZE; i++) + pad[i] ^= (0x5c ^ 0x36); + neoscrypt_hash_update_sha256(&st->outer, pad, SCRYPT_HASH_BLOCK_SIZE); +} + +static void neoscrypt_hmac_update_sha256(sha256_hmac_state *st, const uint8_t *m, size_t mlen) +{ + /* h(inner || m...) */ + neoscrypt_hash_update_sha256(&st->inner, m, mlen); +} + +static void neoscrypt_hmac_finish_sha256(sha256_hmac_state *st, hash_digest mac) +{ + /* h(inner || m) */ + hash_digest innerhash; + neoscrypt_hash_finish_sha256(&st->inner, innerhash); + + /* h(outer || h(inner || m)) */ + neoscrypt_hash_update_sha256(&st->outer, innerhash, sizeof(innerhash)); + neoscrypt_hash_finish_sha256(&st->outer, mac); +} + + +/* PBKDF2 for SHA-256 */ + +static void neoscrypt_pbkdf2_sha256(const uint8_t *password, size_t password_len, + const uint8_t *salt, size_t salt_len, uint64_t N, uint8_t *output, size_t output_len) +{ + sha256_hmac_state hmac_pw, hmac_pw_salt, work; + hash_digest ti, u; + uint8_t be[4]; + uint32_t i, j, k, blocks; + + /* bytes must be <= (0xffffffff - (SCRYPT_HASH_DIGEST_SIZE - 1)), which they will always be under scrypt */ + + /* hmac(password, ...) */ + neoscrypt_hmac_init_sha256(&hmac_pw, password, password_len); + + /* hmac(password, salt...) */ + hmac_pw_salt = hmac_pw; + neoscrypt_hmac_update_sha256(&hmac_pw_salt, salt, salt_len); + + blocks = ((uint32_t)output_len + (SCRYPT_HASH_DIGEST_SIZE - 1)) / SCRYPT_HASH_DIGEST_SIZE; + for(i = 1; i <= blocks; i++) { + /* U1 = hmac(password, salt || be(i)) */ + U32TO8_BE(be, i); + work = hmac_pw_salt; + neoscrypt_hmac_update_sha256(&work, be, 4); + neoscrypt_hmac_finish_sha256(&work, ti); + memcpy(u, ti, sizeof(u)); + + /* T[i] = U1 ^ U2 ^ U3... */ + for(j = 0; j < N - 1; j++) { + /* UX = hmac(password, U{X-1}) */ + work = hmac_pw; + neoscrypt_hmac_update_sha256(&work, u, SCRYPT_HASH_DIGEST_SIZE); + neoscrypt_hmac_finish_sha256(&work, u); + + /* T[i] ^= UX */ + for(k = 0; k < sizeof(u); k++) + ti[k] ^= u[k]; + } + + memcpy(output, ti, (output_len > SCRYPT_HASH_DIGEST_SIZE) ? SCRYPT_HASH_DIGEST_SIZE : output_len); + output += SCRYPT_HASH_DIGEST_SIZE; + output_len -= SCRYPT_HASH_DIGEST_SIZE; + } +} + + +/* NeoScrypt */ + +#if defined(ASM) + +extern void neoscrypt_salsa(uint *X, uint rounds); +extern void neoscrypt_salsa_tangle(uint *X, uint count); +extern void neoscrypt_chacha(uint *X, uint rounds); + +extern void neoscrypt_blkcpy(void *dstp, const void *srcp, uint len); +extern void neoscrypt_blkswp(void *blkAp, void *blkBp, uint len); +extern void neoscrypt_blkxor(void *dstp, const void *srcp, uint len); + +#else + +/* Salsa20, rounds must be a multiple of 2 */ +static void neoscrypt_salsa(uint *X, uint rounds) +{ + uint x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, t; + + x0 = X[0]; x1 = X[1]; x2 = X[2]; x3 = X[3]; + x4 = X[4]; x5 = X[5]; x6 = X[6]; x7 = X[7]; + x8 = X[8]; x9 = X[9]; x10 = X[10]; x11 = X[11]; + x12 = X[12]; x13 = X[13]; x14 = X[14]; x15 = X[15]; + +#define quarter(a, b, c, d) \ + t = a + d; t = ROTL32(t, 7); b ^= t; \ + t = b + a; t = ROTL32(t, 9); c ^= t; \ + t = c + b; t = ROTL32(t, 13); d ^= t; \ + t = d + c; t = ROTL32(t, 18); a ^= t; + + for(; rounds; rounds -= 2) { + quarter( x0, x4, x8, x12); + quarter( x5, x9, x13, x1); + quarter(x10, x14, x2, x6); + quarter(x15, x3, x7, x11); + quarter( x0, x1, x2, x3); + quarter( x5, x6, x7, x4); + quarter(x10, x11, x8, x9); + quarter(x15, x12, x13, x14); + } + + X[0] += x0; X[1] += x1; X[2] += x2; X[3] += x3; + X[4] += x4; X[5] += x5; X[6] += x6; X[7] += x7; + X[8] += x8; X[9] += x9; X[10] += x10; X[11] += x11; + X[12] += x12; X[13] += x13; X[14] += x14; X[15] += x15; + +#undef quarter +} + +/* ChaCha20, rounds must be a multiple of 2 */ +static void neoscrypt_chacha(uint *X, uint rounds) +{ + uint x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, t; + + x0 = X[0]; x1 = X[1]; x2 = X[2]; x3 = X[3]; + x4 = X[4]; x5 = X[5]; x6 = X[6]; x7 = X[7]; + x8 = X[8]; x9 = X[9]; x10 = X[10]; x11 = X[11]; + x12 = X[12]; x13 = X[13]; x14 = X[14]; x15 = X[15]; + +#define quarter(a,b,c,d) \ + a += b; t = d ^ a; d = ROTL32(t, 16); \ + c += d; t = b ^ c; b = ROTL32(t, 12); \ + a += b; t = d ^ a; d = ROTL32(t, 8); \ + c += d; t = b ^ c; b = ROTL32(t, 7); + + for(; rounds; rounds -= 2) { + quarter( x0, x4, x8, x12); + quarter( x1, x5, x9, x13); + quarter( x2, x6, x10, x14); + quarter( x3, x7, x11, x15); + quarter( x0, x5, x10, x15); + quarter( x1, x6, x11, x12); + quarter( x2, x7, x8, x13); + quarter( x3, x4, x9, x14); + } + + X[0] += x0; X[1] += x1; X[2] += x2; X[3] += x3; + X[4] += x4; X[5] += x5; X[6] += x6; X[7] += x7; + X[8] += x8; X[9] += x9; X[10] += x10; X[11] += x11; + X[12] += x12; X[13] += x13; X[14] += x14; X[15] += x15; + +#undef quarter +} + + +/* Fast 32-bit / 64-bit memcpy(); + * len must be a multiple of 32 bytes */ +static void neoscrypt_blkcpy(void *dstp, const void *srcp, uint len) +{ + ulong *dst = (ulong *) dstp; + ulong *src = (ulong *) srcp; + uint i; + + for(i = 0; i < (len / sizeof(ulong)); i += 4) { + dst[i] = src[i]; + dst[i + 1] = src[i + 1]; + dst[i + 2] = src[i + 2]; + dst[i + 3] = src[i + 3]; + } +} + +/* Fast 32-bit / 64-bit block swapper; + * len must be a multiple of 32 bytes */ +static void neoscrypt_blkswp(void *blkAp, void *blkBp, uint len) +{ + ulong *blkA = (ulong *) blkAp; + ulong *blkB = (ulong *) blkBp; + register ulong t0, t1, t2, t3; + uint i; + + for(i = 0; i < (len / sizeof(ulong)); i += 4) { + t0 = blkA[i]; + t1 = blkA[i + 1]; + t2 = blkA[i + 2]; + t3 = blkA[i + 3]; + blkA[i] = blkB[i]; + blkA[i + 1] = blkB[i + 1]; + blkA[i + 2] = blkB[i + 2]; + blkA[i + 3] = blkB[i + 3]; + blkB[i] = t0; + blkB[i + 1] = t1; + blkB[i + 2] = t2; + blkB[i + 3] = t3; + } +} + +/* Fast 32-bit / 64-bit block XOR engine; + * len must be a multiple of 32 bytes */ +static void neoscrypt_blkxor(void *dstp, const void *srcp, uint len) +{ + ulong *dst = (ulong *) dstp; + ulong *src = (ulong *) srcp; + uint i; + + for (i = 0; i < (len / sizeof(ulong)); i += 4) { + dst[i] ^= src[i]; + dst[i + 1] ^= src[i + 1]; + dst[i + 2] ^= src[i + 2]; + dst[i + 3] ^= src[i + 3]; + } +} + +#endif + +/* 32-bit / 64-bit optimised memcpy() */ +static void neoscrypt_copy(void *dstp, const void *srcp, uint len) +{ + ulong *dst = (ulong *) dstp; + ulong *src = (ulong *) srcp; + uint i, tail; + + for(i = 0; i < (len / sizeof(ulong)); i++) + dst[i] = src[i]; + + tail = len & (sizeof(ulong) - 1); + if(tail) { + uchar *dstb = (uchar *) dstp; + uchar *srcb = (uchar *) srcp; + + for(i = len - tail; i < len; i++) + dstb[i] = srcb[i]; + } +} + +/* 32-bit / 64-bit optimised memory erase aka memset() to zero */ +static void neoscrypt_erase(void *dstp, uint len) +{ + const ulong null = 0; + ulong *dst = (ulong *) dstp; + uint i, tail; + + for (i = 0; i < (len / sizeof(ulong)); i++) + dst[i] = null; + + tail = len & (sizeof(ulong) - 1); + if (tail) { + uchar *dstb = (uchar *) dstp; + + for(i = len - tail; i < len; i++) + dstb[i] = (uchar)null; + } +} + +/* 32-bit / 64-bit optimised XOR engine */ +static void neoscrypt_xor(void *dstp, const void *srcp, uint len) +{ + ulong *dst = (ulong *) dstp; + ulong *src = (ulong *) srcp; + uint i, tail; + + for (i = 0; i < (len / sizeof(ulong)); i++) + dst[i] ^= src[i]; + + tail = len & (sizeof(ulong) - 1); + if (tail) { + uchar *dstb = (uchar *) dstp; + uchar *srcb = (uchar *) srcp; + + for(i = len - tail; i < len; i++) + dstb[i] ^= srcb[i]; + } +} + + +/* BLAKE2s */ + +#define BLAKE2S_BLOCK_SIZE 64U +#define BLAKE2S_OUT_SIZE 32U +#define BLAKE2S_KEY_SIZE 32U + +/* Parameter block of 32 bytes */ +typedef struct blake2s_param_t { + uchar digest_length; + uchar key_length; + uchar fanout; + uchar depth; + uint leaf_length; + uchar node_offset[6]; + uchar node_depth; + uchar inner_length; + uchar salt[8]; + uchar personal[8]; +} blake2s_param; + +/* State block of 180 bytes */ +typedef struct blake2s_state_t { + uint h[8]; + uint t[2]; + uint f[2]; + uchar buf[2 * BLAKE2S_BLOCK_SIZE]; + uint buflen; +} blake2s_state; + +static const uint blake2s_IV[8] = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 +}; + +static const uint8_t blake2s_sigma[10][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , + { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , + { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } , +}; + +static void blake2s_compress(blake2s_state *S, const uint *buf) +{ + uint i; + uint m[16]; + uint v[16]; + + neoscrypt_copy(m, buf, 64); + neoscrypt_copy(v, S, 32); + + v[ 8] = blake2s_IV[0]; + v[ 9] = blake2s_IV[1]; + v[10] = blake2s_IV[2]; + v[11] = blake2s_IV[3]; + v[12] = S->t[0] ^ blake2s_IV[4]; + v[13] = S->t[1] ^ blake2s_IV[5]; + v[14] = S->f[0] ^ blake2s_IV[6]; + v[15] = S->f[1] ^ blake2s_IV[7]; + +#define G(r,i,a,b,c,d) do { \ + a = a + b + m[blake2s_sigma[r][2*i+0]]; \ + d = ROTR32(d ^ a, 16); \ + c = c + d; \ + b = ROTR32(b ^ c, 12); \ + a = a + b + m[blake2s_sigma[r][2*i+1]]; \ + d = ROTR32(d ^ a, 8); \ + c = c + d; \ + b = ROTR32(b ^ c, 7); \ +} while(0) + +#define ROUND(r) do { \ + G(r, 0, v[ 0], v[ 4], v[ 8], v[12]); \ + G(r, 1, v[ 1], v[ 5], v[ 9], v[13]); \ + G(r, 2, v[ 2], v[ 6], v[10], v[14]); \ + G(r, 3, v[ 3], v[ 7], v[11], v[15]); \ + G(r, 4, v[ 0], v[ 5], v[10], v[15]); \ + G(r, 5, v[ 1], v[ 6], v[11], v[12]); \ + G(r, 6, v[ 2], v[ 7], v[ 8], v[13]); \ + G(r, 7, v[ 3], v[ 4], v[ 9], v[14]); \ +} while(0) + + ROUND(0); + ROUND(1); + ROUND(2); + ROUND(3); + ROUND(4); + ROUND(5); + ROUND(6); + ROUND(7); + ROUND(8); + ROUND(9); + + for (i = 0; i < 8; i++) + S->h[i] = S->h[i] ^ v[i] ^ v[i + 8]; + +#undef G +#undef ROUND +} + +static void blake2s_update(blake2s_state *S, const uchar *input, uint input_size) +{ + uint left, fill; + + while(input_size > 0) { + left = S->buflen; + fill = 2 * BLAKE2S_BLOCK_SIZE - left; + if(input_size > fill) { + /* Buffer fill */ + neoscrypt_copy(S->buf + left, input, fill); + S->buflen += fill; + /* Counter increment */ + S->t[0] += BLAKE2S_BLOCK_SIZE; + /* Compress */ + blake2s_compress(S, (uint *) S->buf); + /* Shift buffer left */ + neoscrypt_copy(S->buf, S->buf + BLAKE2S_BLOCK_SIZE, BLAKE2S_BLOCK_SIZE); + S->buflen -= BLAKE2S_BLOCK_SIZE; + input += fill; + input_size -= fill; + } else { + neoscrypt_copy(S->buf + left, input, input_size); + S->buflen += input_size; + /* Do not compress */ + input += input_size; + input_size = 0; + } + } +} + +static void neoscrypt_blake2s(const void *input, const uint input_size, const void *key, const uchar key_size, + void *output, const uchar output_size) +{ + uchar block[BLAKE2S_BLOCK_SIZE]; + blake2s_param P[1]; + blake2s_state S[1]; + + /* Initialise */ + neoscrypt_erase(P, 32); + P->digest_length = output_size; + P->key_length = key_size; + P->fanout = 1; + P->depth = 1; + + neoscrypt_erase(S, 180); + neoscrypt_copy(S, blake2s_IV, 32); + neoscrypt_xor(S, P, 32); + + neoscrypt_erase(block, BLAKE2S_BLOCK_SIZE); + neoscrypt_copy(block, key, key_size); + blake2s_update(S, (uchar *) block, BLAKE2S_BLOCK_SIZE); + + /* Update */ + blake2s_update(S, (uchar *) input, input_size); + + /* Finish */ + if(S->buflen > BLAKE2S_BLOCK_SIZE) { + S->t[0] += BLAKE2S_BLOCK_SIZE; + blake2s_compress(S, (uint *) S->buf); + S->buflen -= BLAKE2S_BLOCK_SIZE; + neoscrypt_copy(S->buf, S->buf + BLAKE2S_BLOCK_SIZE, S->buflen); + } + S->t[0] += S->buflen; + S->f[0] = ~0U; + neoscrypt_erase(S->buf + S->buflen, 2 * BLAKE2S_BLOCK_SIZE - S->buflen); + blake2s_compress(S, (uint *) S->buf); + + /* Write back */ + neoscrypt_copy(output, S, output_size); + + //for (int k = 0; k<4; k++) { printf("cpu blake %d %08x %08x\n", k, ((unsigned int*)output)[2 * k], ((unsigned int*)output)[2 * k + 1]); } +} + + +#define FASTKDF_BUFFER_SIZE 256U + +/* FastKDF, a fast buffered key derivation function: + * FASTKDF_BUFFER_SIZE must be a power of 2; + * password_len, salt_len and output_len should not exceed FASTKDF_BUFFER_SIZE; + * prf_output_size must be <= prf_key_size; */ +static void neoscrypt_fastkdf(const uchar *password, uint password_len, const uchar *salt, uint salt_len, + uint N, uchar *output, uint output_len) +{ + //for (int i = 0; i<10; i++) { printf("cpu password %d %08x %08x\n", i, ((unsigned int*)password)[2 * i], ((unsigned int*)password)[2 * i+1]); } + const uint stack_align = 0x40; + const uint kdf_buf_size = 256U; //FASTKDF_BUFFER_SIZE + const uint prf_input_size = 64U; //BLAKE2S_BLOCK_SIZE + const uint prf_key_size = 32U; //BLAKE2S_KEY_SIZE + const uint prf_output_size = 32U; //BLAKE2S_OUT_SIZE + uint bufptr, a, b, i, j; + uchar *A, *B, *prf_input, *prf_key, *prf_output; + uchar *stack; + stack = (uchar*)malloc(sizeof(uchar) * 2 * kdf_buf_size + prf_input_size + prf_key_size + prf_output_size + stack_align); + /* Align and set up the buffers in stack */ + //uchar stack[2 * kdf_buf_size + prf_input_size + prf_key_size + prf_output_size + stack_align]; + + A = &stack[stack_align & ~(stack_align - 1)]; + B = &A[kdf_buf_size + prf_input_size]; + prf_output = &A[2 * kdf_buf_size + prf_input_size + prf_key_size]; + + /* Initialise the password buffer */ + if(password_len > kdf_buf_size) + password_len = kdf_buf_size; + + a = kdf_buf_size / password_len; + for(i = 0; i < a; i++) + neoscrypt_copy(&A[i * password_len], &password[0], password_len); + b = kdf_buf_size - a * password_len; + if(b) + neoscrypt_copy(&A[a * password_len], &password[0], b); + neoscrypt_copy(&A[kdf_buf_size], &password[0], prf_input_size); + + /* Initialise the salt buffer */ + if(salt_len > kdf_buf_size) + salt_len = kdf_buf_size; + + a = kdf_buf_size / salt_len; + for(i = 0; i < a; i++) + neoscrypt_copy(&B[i * salt_len], &salt[0], salt_len); + b = kdf_buf_size - a * salt_len; + if(b) + neoscrypt_copy(&B[a * salt_len], &salt[0], b); + neoscrypt_copy(&B[kdf_buf_size], &salt[0], prf_key_size); + + /* The primary iteration */ + for(i = 0, bufptr = 0; i < N; i++) { + + /* Map the PRF input buffer */ + prf_input = &A[bufptr]; + + /* Map the PRF key buffer */ + prf_key = &B[bufptr]; + + /* PRF */ + // for (int k = 0; k<(prf_input_size/4); k++) { printf("cpu bufptr %08x before blake %d %d %08x \n",bufptr, i, k, ((unsigned int*)prf_input)[k]); } + neoscrypt_blake2s(prf_input, prf_input_size, prf_key, prf_key_size, prf_output, prf_output_size); + // for (int k = 0; k<(prf_output_size/4); k++) { printf("cpu after blake %d %d %08x \n", i, k, ((unsigned int*)prf_output)[k]); } + + /* Calculate the next buffer pointer */ + for(j = 0, bufptr = 0; j < prf_output_size; j++) + bufptr += prf_output[j]; + bufptr &= (kdf_buf_size - 1); + + /* Modify the salt buffer */ + neoscrypt_xor(&B[bufptr], &prf_output[0], prf_output_size); + + /* Head modified, tail updated */ + if(bufptr < prf_key_size) + neoscrypt_copy(&B[kdf_buf_size + bufptr], &B[bufptr], MIN(prf_output_size, prf_key_size - bufptr)); + + /* Tail modified, head updated */ + if((kdf_buf_size - bufptr) < prf_output_size) + neoscrypt_copy(&B[0], &B[kdf_buf_size], prf_output_size - (kdf_buf_size - bufptr)); + } + + /* Modify and copy into the output buffer */ + if(output_len > kdf_buf_size) + output_len = kdf_buf_size; + + a = kdf_buf_size - bufptr; + if(a >= output_len) { + neoscrypt_xor(&B[bufptr], &A[0], output_len); + neoscrypt_copy(&output[0], &B[bufptr], output_len); + } else { + neoscrypt_xor(&B[bufptr], &A[0], a); + neoscrypt_xor(&B[0], &A[a], output_len - a); + neoscrypt_copy(&output[0], &B[bufptr], a); + neoscrypt_copy(&output[a], &B[0], output_len - a); + } + // for (int i = 0; i<10; i++) { printf("cpu fastkdf %d %08x %08x\n", i, ((unsigned int*)output)[2 * i], ((unsigned int*)output)[2 * i + 1]); } +} + + +/* Configurable optimised block mixer */ +static void neoscrypt_blkmix(uint *X, uint *Y, uint r, uint mixmode) +{ + uint i, mixer, rounds; + + mixer = mixmode >> 8; + rounds = mixmode & 0xFF; + + /* NeoScrypt flow: Scrypt flow: + Xa ^= Xd; M(Xa'); Ya = Xa"; Xa ^= Xb; M(Xa'); Ya = Xa"; + Xb ^= Xa"; M(Xb'); Yb = Xb"; Xb ^= Xa"; M(Xb'); Yb = Xb"; + Xc ^= Xb"; M(Xc'); Yc = Xc"; Xa" = Ya; + Xd ^= Xc"; M(Xd'); Yd = Xd"; Xb" = Yb; + Xa" = Ya; Xb" = Yc; + Xc" = Yb; Xd" = Yd; */ + + if (r == 1) { + neoscrypt_blkxor(&X[0], &X[16], SCRYPT_BLOCK_SIZE); + if(mixer) + neoscrypt_chacha(&X[0], rounds); + else + neoscrypt_salsa(&X[0], rounds); + neoscrypt_blkxor(&X[16], &X[0], SCRYPT_BLOCK_SIZE); + if(mixer) + neoscrypt_chacha(&X[16], rounds); + else + neoscrypt_salsa(&X[16], rounds); + return; + } + + if (r == 2) { + neoscrypt_blkxor(&X[0], &X[48], SCRYPT_BLOCK_SIZE); + if(mixer) + neoscrypt_chacha(&X[0], rounds); + else + neoscrypt_salsa(&X[0], rounds); + neoscrypt_blkxor(&X[16], &X[0], SCRYPT_BLOCK_SIZE); + if(mixer) + neoscrypt_chacha(&X[16], rounds); + else + neoscrypt_salsa(&X[16], rounds); + neoscrypt_blkxor(&X[32], &X[16], SCRYPT_BLOCK_SIZE); + if(mixer) + neoscrypt_chacha(&X[32], rounds); + else + neoscrypt_salsa(&X[32], rounds); + neoscrypt_blkxor(&X[48], &X[32], SCRYPT_BLOCK_SIZE); + if(mixer) + neoscrypt_chacha(&X[48], rounds); + else + neoscrypt_salsa(&X[48], rounds); + neoscrypt_blkswp(&X[16], &X[32], SCRYPT_BLOCK_SIZE); + return; + } + + /* Reference code for any reasonable r */ + for (i = 0; i < 2 * r; i++) { + if(i) neoscrypt_blkxor(&X[16 * i], &X[16 * (i - 1)], SCRYPT_BLOCK_SIZE); + else neoscrypt_blkxor(&X[0], &X[16 * (2 * r - 1)], SCRYPT_BLOCK_SIZE); + if(mixer) + neoscrypt_chacha(&X[16 * i], rounds); + else + neoscrypt_salsa(&X[16 * i], rounds); + neoscrypt_blkcpy(&Y[16 * i], &X[16 * i], SCRYPT_BLOCK_SIZE); + } + for (i = 0; i < r; i++) + neoscrypt_blkcpy(&X[16 * i], &Y[16 * 2 * i], SCRYPT_BLOCK_SIZE); + for (i = 0; i < r; i++) + neoscrypt_blkcpy(&X[16 * (i + r)], &Y[16 * (2 * i + 1)], SCRYPT_BLOCK_SIZE); +} + +/* NeoScrypt core engine: + * p = 1, salt = password; + * Basic customisation (required): + * profile bit 0: + * 0 = NeoScrypt(128, 2, 1) with Salsa20/20 and ChaCha20/20; + * 1 = Scrypt(1024, 1, 1) with Salsa20/8; + * profile bits 4 to 1: + * 0000 = FastKDF-BLAKE2s; + * 0001 = PBKDF2-HMAC-SHA256; + * Extended customisation (optional): + * profile bit 31: + * 0 = extended customisation absent; + * 1 = extended customisation present; + * profile bits 7 to 5 (rfactor): + * 000 = r of 1; + * 001 = r of 2; + * 010 = r of 4; + * ... + * 111 = r of 128; + * profile bits 12 to 8 (Nfactor): + * 00000 = N of 2; + * 00001 = N of 4; + * 00010 = N of 8; + * ..... + * 00110 = N of 128; + * ..... + * 01001 = N of 1024; + * ..... + * 11110 = N of 2147483648; + * profile bits 30 to 13 are reserved */ +void neoscrypt(unsigned char *output, const unsigned char *input, unsigned int profile) +{ + uint N = 128, r = 2, dblmix = 1, mixmode = 0x14, stack_align = 0x40; + uint kdf, i, j; + uint *X, *Y, *Z, *V; + + if(profile & 0x1) { + N = 1024; /* N = (1 << (Nfactor + 1)); */ + r = 1; /* r = (1 << rfactor); */ + dblmix = 0; /* Salsa only */ + mixmode = 0x08; /* 8 rounds */ + } + + if(profile >> 31) { + N = (1 << (((profile >> 8) & 0x1F) + 1)); + r = (1 << ((profile >> 5) & 0x7)); + } + uchar *stack; + stack = (uchar*)malloc(((N + 3) * r * 2 * SCRYPT_BLOCK_SIZE + stack_align)*sizeof(uchar)); + /* X = r * 2 * SCRYPT_BLOCK_SIZE */ + X = (uint *) &stack[stack_align & ~(stack_align - 1)]; + /* Z is a copy of X for ChaCha */ + Z = &X[32 * r]; + /* Y is an X sized temporal space */ + Y = &X[64 * r]; + /* V = N * r * 2 * SCRYPT_BLOCK_SIZE */ + V = &X[96 * r]; + + /* X = KDF(password, salt) */ + kdf = (profile >> 1) & 0xF; + + switch(kdf) { + + default: + case(0x0): + neoscrypt_fastkdf(input, 80, input, 80, 32, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE); + break; + + case(0x1): + neoscrypt_pbkdf2_sha256(input, 80, input, 80, 1, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE); + break; + } + + /* Process ChaCha 1st, Salsa 2nd and XOR them into FastKDF; otherwise Salsa only */ + + if(dblmix) { + /* blkcpy(Z, X) */ + neoscrypt_blkcpy(&Z[0], &X[0], r * 2 * SCRYPT_BLOCK_SIZE); + + /* Z = SMix(Z) */ + for(i = 0; i < N; i++) { + /* blkcpy(V, Z) */ + neoscrypt_blkcpy(&V[i * (32 * r)], &Z[0], r * 2 * SCRYPT_BLOCK_SIZE); + /* blkmix(Z, Y) */ + neoscrypt_blkmix(&Z[0], &Y[0], r, (mixmode | 0x0100)); + } + for(i = 0; i < N; i++) { + /* integerify(Z) mod N */ + j = (32 * r) * (Z[16 * (2 * r - 1)] & (N - 1)); + /* blkxor(Z, V) */ + neoscrypt_blkxor(&Z[0], &V[j], r * 2 * SCRYPT_BLOCK_SIZE); + /* blkmix(Z, Y) */ + neoscrypt_blkmix(&Z[0], &Y[0], r, (mixmode | 0x0100)); + } + } + +#if (ASM) + /* Must be called before and after SSE2 Salsa */ + neoscrypt_salsa_tangle(&X[0], r * 2); +#endif + + /* X = SMix(X) */ + for(i = 0; i < N; i++) { + /* blkcpy(V, X) */ + neoscrypt_blkcpy(&V[i * (32 * r)], &X[0], r * 2 * SCRYPT_BLOCK_SIZE); + /* blkmix(X, Y) */ + neoscrypt_blkmix(&X[0], &Y[0], r, mixmode); + } + for(i = 0; i < N; i++) { + /* integerify(X) mod N */ + j = (32 * r) * (X[16 * (2 * r - 1)] & (N - 1)); + /* blkxor(X, V) */ + neoscrypt_blkxor(&X[0], &V[j], r * 2 * SCRYPT_BLOCK_SIZE); + /* blkmix(X, Y) */ + neoscrypt_blkmix(&X[0], &Y[0], r, mixmode); + } + +#if (ASM) + neoscrypt_salsa_tangle(&X[0], r * 2); +#endif + + if(dblmix) + /* blkxor(X, Z) */ + neoscrypt_blkxor(&X[0], &Z[0], r * 2 * SCRYPT_BLOCK_SIZE); + + /* output = KDF(password, X) */ + switch(kdf) { + + default: + case(0x0): + neoscrypt_fastkdf(input, 80, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE, 32, output, 32); + break; + + case(0x1): + neoscrypt_pbkdf2_sha256(input, 80, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE, 1, output, 32); + break; + } +} + diff --git a/neoscrypt/neoscrypt.cu b/neoscrypt/neoscrypt.cu new file mode 100644 index 0000000..878ee5f --- /dev/null +++ b/neoscrypt/neoscrypt.cu @@ -0,0 +1,142 @@ +#include +#include + +#include +#include "cuda_helper.h" + +#include "neoscrypt.h" + +#define NBN 2 + +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +extern void neoscrypt_setBlockTarget(uint32_t* pdata); +extern void neoscrypt_cpu_init(int thr_id, uint32_t threads); +extern void neoscrypt_free(int thr_id); +extern void neoscrypt_cpu_hash_k4(bool stratum, int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *result,const uint32_t target7); + +static bool init[MAX_GPUS] = { 0 }; + +int scanhash_neoscrypt(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + uint32_t _ALIGN(64) endiandata[20]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + int dev_id = device_map[thr_id]; + int intensity = 14; + + if (strstr(device_name[dev_id], "GTX 10")) intensity = 16; + + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + + if (strstr(device_name[dev_id], "GTX 9")) throughput = 45312; + + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + api_set_throughput(thr_id, throughput); + + if (opt_benchmark) + ptarget[7] = 0x00ff; + + if(!init[thr_id]){ + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + cudaGetLastError(); // reset errors if device is not "reset" + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + neoscrypt_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + CUDA_LOG_ERROR(); + init[thr_id] = true; + } + + if (have_stratum) { + for (int k = 0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + } else { + for (int k = 0; k < 20; k++) + endiandata[k] = pdata[k]; + } + + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + + neoscrypt_setBlockTarget(endiandata); + + int rc = 0; + + do{ + neoscrypt_cpu_hash_k4(have_stratum, thr_id, throughput, pdata[19], d_resNonce[thr_id], ptarget[7]); + + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + if(h_resNonce[thr_id][0] != UINT32_MAX){ + uint32_t vhash[8]; + if(have_stratum) + be32enc(&endiandata[19], h_resNonce[thr_id][0]); + else + endiandata[19] = h_resNonce[thr_id][0]; + neoscrypt((uchar*)vhash,(uchar*)endiandata, 0x80000620); + if(vhash[7] <= ptarget[7] && fulltest(vhash, ptarget)){ + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash); + pdata[19] = h_resNonce[thr_id][0]; + rc = 1; + if(h_resNonce[thr_id][1] != UINT32_MAX){ +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found second nonce %08x !", h_resNonce[thr_id][1]); + if(have_stratum) + be32enc(&endiandata[19], h_resNonce[thr_id][1]); + else + endiandata[19] = h_resNonce[thr_id][1]; + neoscrypt((uchar*)vhash,(uchar*)endiandata, 0x80000620); + pdata[21] = h_resNonce[thr_id][1]; + if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash); + xchg(pdata[19],pdata[21]); + } + rc = 2; + } + return rc; + } + else{ + if(vhash[7] != ptarget[7]) + applog(LOG_WARNING, "GPU #%d: Nonce $%08X does not validate on CPU!", device_map[thr_id], h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + pdata[19] += throughput; + } while(!work_restart[thr_id].restart && ((uint64_t)max_nonce > ((uint64_t)(pdata[19]) + (uint64_t)throughput))); + *hashes_done = pdata[19] - first_nonce; + return rc; +} + +// cleanup +void free_neoscrypt(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + neoscrypt_free(thr_id); + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/neoscrypt/neoscrypt.h b/neoscrypt/neoscrypt.h new file mode 100644 index 0000000..fc4d7e7 --- /dev/null +++ b/neoscrypt/neoscrypt.h @@ -0,0 +1,33 @@ +#if (__cplusplus) +extern "C" { +#endif + +void neoscrypt(unsigned char *output, const unsigned char *input, unsigned int profile); + +#if (__cplusplus) +} +#else + +#define SCRYPT_BLOCK_SIZE 64 +#define SCRYPT_HASH_BLOCK_SIZE 64 +#define SCRYPT_HASH_DIGEST_SIZE 32 + +typedef uint8_t hash_digest[SCRYPT_HASH_DIGEST_SIZE]; + +#define ROTL32(a,b) (((a) << (b)) | ((a) >> (32 - b))) +#define ROTR32(a,b) (((a) >> (b)) | ((a) << (32 - b))) + +#define U8TO32_BE(p) \ + (((uint32_t)((p)[0]) << 24) | ((uint32_t)((p)[1]) << 16) | \ + ((uint32_t)((p)[2]) << 8) | ((uint32_t)((p)[3]))) + +#define U32TO8_BE(p, v) \ + (p)[0] = (uint8_t)((v) >> 24); (p)[1] = (uint8_t)((v) >> 16); \ + (p)[2] = (uint8_t)((v) >> 8); (p)[3] = (uint8_t)((v) ); + +#define U64TO8_BE(p, v) \ + U32TO8_BE((p), (uint32_t)((v) >> 32)); \ + U32TO8_BE((p) + 4, (uint32_t)((v) )); + +#endif + diff --git a/nist5/cuda_nist5.cu b/nist5/cuda_nist5.cu new file mode 100644 index 0000000..84bc791 --- /dev/null +++ b/nist5/cuda_nist5.cu @@ -0,0 +1,163 @@ +extern "C" +{ +#include "sph/sph_blake.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" +} + +#include "miner.h" + +#include "cuda_helper.h" + +#include "quark/cuda_quark.h" + + +static uint32_t *d_hash[MAX_GPUS]; +#define NBN 2 + +/* 8 adapters max */ +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +// Original nist5hash Funktion aus einem miner Quelltext +extern "C" void nist5hash(void *state, const void *input) +{ + sph_blake512_context ctx_blake; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + + uint8_t hash[64]; + + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, (void*) hash); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, (void*) hash); + + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, (void*) hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, (void*) hash); + + memcpy(state, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_nist5(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done){ + + int dev_id = device_map[thr_id]; + + uint32_t _ALIGN(64) endiandata[20]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + uint32_t throughput = cuda_default_throughput(thr_id, 1 << 21); // 256*256*16 + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ((uint32_t*)ptarget)[7] = 0x00FF; + + const uint64_t highTarget = *(uint64_t*)&ptarget[6]; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + int rc = 0; + do { + // Hash with CUDA + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_keccak_skein512_cpu_hash_64_final(thr_id, throughput, NULL, d_hash[thr_id],d_resNonce[thr_id],highTarget); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce+h_resNonce[thr_id][0]); + nist5hash(vhash64, endiandata); + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + rc = 1; + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] =startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + be32enc(&endiandata[19], startNounce+h_resNonce[thr_id][1]); + nist5hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]) + work_set_target_ratio(work, vhash64); + pdata[21] = startNounce+h_resNonce[thr_id][1]; + rc=2; + } + return rc; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && (uint64_t)max_nonce > (uint64_t)throughput + (uint64_t)pdata[19]); + + *hashes_done = pdata[19] - first_nonce; + return 0; +} + +// ressources cleanup +extern "C" void free_nist5(int thr_id){ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + +// blake512_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/nvapi.cpp b/nvapi.cpp new file mode 100644 index 0000000..2c6ed77 --- /dev/null +++ b/nvapi.cpp @@ -0,0 +1,460 @@ +/** +* Wrapper to nvapi.dll to query informations missing for x86 binaries (there is no nvml x86) +* based on the work of https://github.com/ircubic/lib_gpu +* +* tpruvot@ccminer.org 06-2016 +*/ + +#ifdef _WIN32 + +#include +#include +#include + +#include "compat/nvapi/nvapi_ccminer.h" + +class NvAPILibraryHandle +{ + typedef void *(*QueryPtr)(uint32_t); + +private: + HMODULE library; + QueryPtr nvidia_query; + +public: + NvAPILibraryHandle() + { + bool success = false; +#ifdef _WIN64 + library = LoadLibrary("nvapi64.dll"); +#else + library = LoadLibrary("nvapi.dll"); +#endif + if (library != NULL) { + nvidia_query = reinterpret_cast(GetProcAddress(library, "nvapi_QueryInterface")); + if (nvidia_query != NULL) { + const uint32_t NVAPI_ID_INIT = 0x0150E828; + auto init = static_cast(nvidia_query(NVAPI_ID_INIT)); + NvAPI_Status ret = init(); + success = (ret == NVAPI_OK); + } + } + + if (!success) { + throw std::runtime_error("Unable to locate NVAPI library!"); + } + } + + ~NvAPILibraryHandle() + { + NvAPI_DLL_Unload(); + FreeLibrary(library); + } + + void *query(uint32_t ID) + { + return nvidia_query(ID); + } + +}; + +static std::unique_ptr nvidia_handle; +bool nvapi_dll_loaded = false; + +NvAPI_Status nvapi_dll_init() +{ + try { + if (!nvapi_dll_loaded) { + nvidia_handle = std::make_unique(); + nvapi_dll_loaded = true; + } + } + catch (std::runtime_error) { + nvapi_dll_loaded = false; + return NVAPI_ERROR; + } + + return NVAPI_OK; +} + +// Hidden nvapi.dll functions + +#define NVAPI_ID_IFVERSION 0x01053FA5 +NvAPI_Status NvAPI_DLL_GetInterfaceVersionString(NvAPI_ShortString string) { + static NvAPI_Status(*pointer)(NvAPI_ShortString string) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvAPI_ShortString))nvidia_handle->query(NVAPI_ID_IFVERSION); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(string); +} + +#define NVAPI_ID_PERF_INFO 0x409D9841 +NvAPI_Status NvAPI_DLL_PerfPoliciesGetInfo(NvPhysicalGpuHandle handle, NVAPI_GPU_PERF_INFO* pInfo) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_PERF_INFO*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_PERF_INFO*))nvidia_handle->query(NVAPI_ID_PERF_INFO); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pInfo); +} + +#define NVAPI_ID_PERF_STATS 0x3D358A0C +NvAPI_Status NvAPI_DLL_PerfPoliciesGetStatus(NvPhysicalGpuHandle handle, NVAPI_GPU_PERF_STATUS* pStatus) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_PERF_STATUS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_PERF_STATUS*))nvidia_handle->query(NVAPI_ID_PERF_STATS); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pStatus); +} + +#define NVAPI_ID_POWER_INFO 0x34206D86 +NvAPI_Status NvAPI_DLL_ClientPowerPoliciesGetInfo(NvPhysicalGpuHandle handle, NVAPI_GPU_POWER_INFO* pInfo) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_POWER_INFO*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_POWER_INFO*))nvidia_handle->query(NVAPI_ID_POWER_INFO); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pInfo); +} + +#define NVAPI_ID_POWERPOL_GET 0x70916171 +NvAPI_Status NvAPI_DLL_ClientPowerPoliciesGetStatus(NvPhysicalGpuHandle handle, NVAPI_GPU_POWER_STATUS* pPolicies) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_POWER_STATUS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_POWER_STATUS*))nvidia_handle->query(NVAPI_ID_POWERPOL_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pPolicies); +} + +#define NVAPI_ID_POWERPOL_SET 0xAD95F5ED +NvAPI_Status NvAPI_DLL_ClientPowerPoliciesSetStatus(NvPhysicalGpuHandle handle, NVAPI_GPU_POWER_STATUS* pPolicies) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_POWER_STATUS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_POWER_STATUS*))nvidia_handle->query(NVAPI_ID_POWERPOL_SET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pPolicies); +} + +#define NVAPI_ID_POWERTOPO_GET 0xEDCF624E +NvAPI_Status NvAPI_DLL_ClientPowerTopologyGetStatus(NvPhysicalGpuHandle handle, NVAPI_GPU_POWER_TOPO* topo) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_POWER_TOPO*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_POWER_TOPO*))nvidia_handle->query(NVAPI_ID_POWERTOPO_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, topo); +} + +#define NVAPI_ID_THERMAL_INFO 0x0D258BB5 +NvAPI_Status NvAPI_DLL_ClientThermalPoliciesGetInfo(NvPhysicalGpuHandle handle, NVAPI_GPU_THERMAL_INFO* pInfo) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_INFO*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_INFO*))nvidia_handle->query(NVAPI_ID_THERMAL_INFO); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pInfo); +} + +#define NVAPI_ID_TLIMIT_GET 0xE9C425A1 +NvAPI_Status NvAPI_DLL_ClientThermalPoliciesGetLimit(NvPhysicalGpuHandle handle, NVAPI_GPU_THERMAL_LIMIT* pLimit) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_LIMIT*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_LIMIT*))nvidia_handle->query(NVAPI_ID_TLIMIT_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pLimit); +} + +#define NVAPI_ID_TLIMIT_SET 0x34C0B13D +NvAPI_Status NvAPI_DLL_ClientThermalPoliciesSetLimit(NvPhysicalGpuHandle handle, NVAPI_GPU_THERMAL_LIMIT* pLimit) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_LIMIT*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_GPU_THERMAL_LIMIT*))nvidia_handle->query(NVAPI_ID_TLIMIT_SET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pLimit); +} + +#define NVAPI_ID_SERIALNUM_GET 0x14B83A5F +NvAPI_Status NvAPI_DLL_GetSerialNumber(NvPhysicalGpuHandle handle, NvAPI_ShortString serial) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NvAPI_ShortString) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NvAPI_ShortString))nvidia_handle->query(NVAPI_ID_SERIALNUM_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, serial); +} + +#define NVAPI_ID_VOLTAGE_GET 0x465F9BCF +NvAPI_Status NvAPI_DLL_GetCurrentVoltage(NvPhysicalGpuHandle handle, NVAPI_VOLTAGE_STATUS* status) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_VOLTAGE_STATUS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_VOLTAGE_STATUS*))nvidia_handle->query(NVAPI_ID_VOLTAGE_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, status); +} + +#define NVAPI_ID_VOLT_STATUS_GET 0xC16C7E2C // Maxwell +NvAPI_Status NvAPI_DLL_GetVoltageDomainsStatus(NvPhysicalGpuHandle handle, NVAPI_VOLT_STATUS* data) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_VOLT_STATUS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_VOLT_STATUS*))nvidia_handle->query(NVAPI_ID_VOLT_STATUS_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, data); +} + +#define NVAPI_ID_VOLTAGE 0x28766157 // Maxwell 1-008c Real func name is unknown +NvAPI_Status NvAPI_DLL_GetVoltageStep(NvPhysicalGpuHandle handle, NVAPI_VOLT_STATUS* data) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_VOLT_STATUS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_VOLT_STATUS*))nvidia_handle->query(NVAPI_ID_VOLTAGE); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, data); +} + +#define NVAPI_ID_CLK_RANGE_GET 0x64B43A6A // Pascal +NvAPI_Status NvAPI_DLL_GetClockBoostRanges(NvPhysicalGpuHandle handle, NVAPI_CLOCKS_RANGE* range) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_CLOCKS_RANGE*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_CLOCKS_RANGE*))nvidia_handle->query(NVAPI_ID_CLK_RANGE_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, range); +} + +#define NVAPI_ID_CLK_BOOST_MASK 0x507B4B59 // Pascal +NvAPI_Status NvAPI_DLL_GetClockBoostMask(NvPhysicalGpuHandle handle, NVAPI_CLOCK_MASKS* range) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_CLOCK_MASKS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_CLOCK_MASKS*))nvidia_handle->query(NVAPI_ID_CLK_BOOST_MASK); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, range); +} + +#define NVAPI_ID_CLK_BOOST_TABLE_GET 0x23F1B133 // Pascal +NvAPI_Status NvAPI_DLL_GetClockBoostTable(NvPhysicalGpuHandle handle, NVAPI_CLOCK_TABLE* table) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_CLOCK_TABLE*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_CLOCK_TABLE*))nvidia_handle->query(NVAPI_ID_CLK_BOOST_TABLE_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, table); +} + +#define NVAPI_ID_CLK_BOOST_TABLE_SET 0x0733E009 // Pascal +NvAPI_Status NvAPI_DLL_SetClockBoostTable(NvPhysicalGpuHandle handle, NVAPI_CLOCK_TABLE* table) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_CLOCK_TABLE*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_CLOCK_TABLE*))nvidia_handle->query(NVAPI_ID_CLK_BOOST_TABLE_SET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, table); +} + +#define NVAPI_ID_VFP_CURVE_GET 0x21537AD4 // Pascal +NvAPI_Status NvAPI_DLL_GetVFPCurve(NvPhysicalGpuHandle handle, NVAPI_VFP_CURVE* curve) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_VFP_CURVE*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_VFP_CURVE*))nvidia_handle->query(NVAPI_ID_VFP_CURVE_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, curve); +} + +#define NVAPI_ID_CURVE_GET 0xE440B867 // Pascal 2-030c struct 0C 03 02 00 00 00 00 00 01 00 00 00 06 00 00 00 +#define NVAPI_ID_CURVE_SET 0x39442CFB // Pascal 2-030c struct 0C 03 02 00 00 00 00 00 01 00 00 00 06 00 00 00 + +#define NVAPI_ID_VOLTBOOST_GET 0x9DF23CA1 // Pascal 1-0028 +NvAPI_Status NvAPI_DLL_GetCoreVoltageBoostPercent(NvPhysicalGpuHandle handle, NVAPI_VOLTBOOST_PERCENT* boost) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_VOLTBOOST_PERCENT*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_VOLTBOOST_PERCENT*))nvidia_handle->query(NVAPI_ID_VOLTBOOST_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, boost); +} +#define NVAPI_ID_VOLTBOOST_SET 0xB9306D9B // Pascal 1-0028 +NvAPI_Status NvAPI_DLL_SetCoreVoltageBoostPercent(NvPhysicalGpuHandle handle, NVAPI_VOLTBOOST_PERCENT* boost) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_VOLTBOOST_PERCENT*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_VOLTBOOST_PERCENT*))nvidia_handle->query(NVAPI_ID_VOLTBOOST_SET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, boost); +} + +#define NVAPI_ID_PERFCLOCKS_GET 0x1EA54A3B +NvAPI_Status NvAPI_DLL_GetPerfClocks(NvPhysicalGpuHandle handle, uint32_t num, NVAPI_GPU_PERF_CLOCKS* pClocks) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, uint32_t, NVAPI_GPU_PERF_CLOCKS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, uint32_t, NVAPI_GPU_PERF_CLOCKS*))nvidia_handle->query(NVAPI_ID_PERFCLOCKS_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, num, pClocks); +} + +#define NVAPI_ID_PERFCLOCKS_SET 0x07BCF4AC // error +NvAPI_Status NvAPI_DLL_SetPerfClocks(NvPhysicalGpuHandle handle, uint32_t num, NVAPI_GPU_PERF_CLOCKS* pClocks) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, uint32_t, NVAPI_GPU_PERF_CLOCKS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, uint32_t, NVAPI_GPU_PERF_CLOCKS*))nvidia_handle->query(NVAPI_ID_PERFCLOCKS_SET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, num, pClocks); +} + +#define NVAPI_ID_PSTATELIMITS_GET 0x88C82104 // wrong prototype or missing struct data ? +NvAPI_Status NvAPI_DLL_GetPstateClientLimits(NvPhysicalGpuHandle handle, NV_GPU_PERF_PSTATE_ID pst, uint32_t* pLimits) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATE_ID, uint32_t*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATE_ID, uint32_t*))nvidia_handle->query(NVAPI_ID_PSTATELIMITS_GET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pst, pLimits); +} + +#define NVAPI_ID_PSTATELIMITS_SET 0xFDFC7D49 // wrong prototype or missing struct data ? +NvAPI_Status NvAPI_DLL_SetPstateClientLimits(NvPhysicalGpuHandle handle, NV_GPU_PERF_PSTATE_ID pst, uint32_t* pLimits) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATE_ID, uint32_t*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATE_ID, uint32_t*))nvidia_handle->query(NVAPI_ID_PSTATELIMITS_SET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pst, pLimits); +} + +#define NVAPI_ID_PSTATE20_SET 0x0F4DAE6B +// allow to set gpu/mem core freq delta +NvAPI_Status NvAPI_DLL_SetPstates20v1(NvPhysicalGpuHandle handle, NV_GPU_PERF_PSTATES20_INFO_V1 *pSet) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATES20_INFO_V1*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATES20_INFO_V1*))nvidia_handle->query(NVAPI_ID_PSTATE20_SET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pSet); +} + +// allow to set gpu core voltage delta +NvAPI_Status NvAPI_DLL_SetPstates20v2(NvPhysicalGpuHandle handle, NV_GPU_PERF_PSTATES20_INFO_V2 *pSet) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATES20_INFO_V2*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NV_GPU_PERF_PSTATES20_INFO_V2*))nvidia_handle->query(NVAPI_ID_PSTATE20_SET); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pSet); +} + +// maxwell voltage table +#define NVAPI_ID_VOLTAGES 0x7D656244 // 1-40cc +NvAPI_Status NvAPI_DLL_GetVoltages(NvPhysicalGpuHandle handle, NVAPI_VOLTAGES_TABLE *pInfo) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_VOLTAGES_TABLE*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_VOLTAGES_TABLE*))nvidia_handle->query(NVAPI_ID_VOLTAGES); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pInfo); +} + +#define NVAPI_ID_COOLERSETTINGS 0xDA141340 // 4-0558 +NvAPI_Status NvAPI_DLL_GetCoolerSettings(NvPhysicalGpuHandle handle, uint32_t id, NVAPI_COOLER_SETTINGS* pSettings) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, uint32_t, NVAPI_COOLER_SETTINGS*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, uint32_t, NVAPI_COOLER_SETTINGS*))nvidia_handle->query(NVAPI_ID_COOLERSETTINGS); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, id, pSettings); +} + +#define NVAPI_ID_COOLER_SETLEVELS 0x891FA0AE // 1-00A4 +NvAPI_Status NvAPI_DLL_SetCoolerLevels(NvPhysicalGpuHandle handle, uint32_t id, NVAPI_COOLER_LEVEL* pLevel) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, uint32_t, NVAPI_COOLER_LEVEL*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, uint32_t, NVAPI_COOLER_LEVEL*))nvidia_handle->query(NVAPI_ID_COOLER_SETLEVELS); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, id, pLevel); +} + +#define NVAPI_ID_COOLER_RESTORE 0x8F6ED0FB +NvAPI_Status NvAPI_DLL_RestoreCoolerSettings(NvPhysicalGpuHandle handle, NVAPI_COOLER_SETTINGS* pSettings, uint32_t id) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NVAPI_COOLER_SETTINGS*, uint32_t) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NVAPI_COOLER_SETTINGS*, uint32_t))nvidia_handle->query(NVAPI_ID_COOLER_RESTORE); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, pSettings, id); +} + +#define NVAPI_ID_I2CREADEX 0x4D7B0709 // 3-002c +NvAPI_Status NvAPI_DLL_I2CReadEx(NvPhysicalGpuHandle handle, NV_I2C_INFO_EX *i2c, NvU32 *exData) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NV_I2C_INFO_EX*, NvU32*) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NV_I2C_INFO_EX*, NvU32*))nvidia_handle->query(NVAPI_ID_I2CREADEX); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, i2c, exData); +} + +#define NVAPI_ID_I2CWRITEEX 0x283AC65A +NvAPI_Status NvAPI_DLL_I2CWriteEx(NvPhysicalGpuHandle handle, NV_I2C_INFO_EX *i2c, NvU32 *exData) { + static NvAPI_Status(*pointer)(NvPhysicalGpuHandle, NV_I2C_INFO_EX*, NvU32 *exData) = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)(NvPhysicalGpuHandle, NV_I2C_INFO_EX*, NvU32 *exData))nvidia_handle->query(NVAPI_ID_I2CWRITEEX); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(handle, i2c, exData); +} + +#define NVAPI_ID_UNLOAD 0xD22BDD7E +NvAPI_Status NvAPI_DLL_Unload() { + static NvAPI_Status(*pointer)() = NULL; + if (!nvapi_dll_loaded) return NVAPI_API_NOT_INITIALIZED; + if (!pointer) { + pointer = (NvAPI_Status(*)())nvidia_handle->query(NVAPI_ID_UNLOAD); + } + if (!pointer) return NVAPI_NO_IMPLEMENTATION; + return (*pointer)(); +} + +#endif \ No newline at end of file diff --git a/nvml.cpp b/nvml.cpp new file mode 100644 index 0000000..1cc0877 --- /dev/null +++ b/nvml.cpp @@ -0,0 +1,2067 @@ +/* + * A trivial little dlopen()-based wrapper library for the + * NVIDIA NVML library, to allow runtime discovery of NVML on an + * arbitrary system. This is all very hackish and simple-minded, but + * it serves my immediate needs in the short term until NVIDIA provides + * a static NVML wrapper library themselves, hopefully in + * CUDA 6.5 or maybe sometime shortly after. + * + * This trivial code is made available under the "new" 3-clause BSD license, + * and/or any of the GPL licenses you prefer. + * Feel free to use the code and modify as you see fit. + * + * John E. Stone - john.stone@gmail.com + * Tanguy Pruvot - tpruvot@github + * + */ + +#include +#include +#include +#include +#include + +#include "miner.h" +#include "nvml.h" +#include "cuda_runtime.h" + +#ifdef USE_WRAPNVML + +extern nvml_handle *hnvml; +extern char driver_version[32]; + +static uint32_t device_bus_ids[MAX_GPUS] = { 0 }; + +extern uint32_t device_gpu_clocks[MAX_GPUS]; +extern uint32_t device_mem_clocks[MAX_GPUS]; +extern uint32_t device_plimit[MAX_GPUS]; +extern uint8_t device_tlimit[MAX_GPUS]; +extern int8_t device_pstate[MAX_GPUS]; +extern int32_t device_led[MAX_GPUS]; +int32_t device_led_state[MAX_GPUS] = { 0 }; +static __thread bool has_rgb_ok = false; + +uint32_t clock_prev[MAX_GPUS] = { 0 }; +uint32_t clock_prev_mem[MAX_GPUS] = { 0 }; +uint32_t limit_prev[MAX_GPUS] = { 0 }; + +/* + * Wrappers to emulate dlopen() on other systems like Windows + */ +#if defined(_MSC_VER) || defined(_WIN32) || defined(_WIN64) + #include + static void *wrap_dlopen(const char *filename) { + HMODULE h = LoadLibrary(filename); + if (!h && opt_debug) { + applog(LOG_DEBUG, "dlopen(%d): failed to load %s", + GetLastError(), filename); + } + return (void*)h; + } + static void *wrap_dlsym(void *h, const char *sym) { + return (void *)GetProcAddress((HINSTANCE)h, sym); + } + static int wrap_dlclose(void *h) { + /* FreeLibrary returns nonzero on success */ + return (!FreeLibrary((HINSTANCE)h)); + } +#else + /* assume we can use dlopen itself... */ + #include + #include + static void *wrap_dlopen(const char *filename) { + void *h = dlopen(filename, RTLD_NOW); + if (h == NULL && opt_debug) { + applog(LOG_DEBUG, "dlopen(%d): failed to load %s", + errno, filename); + } + return (void*)h; + } + + static void *wrap_dlsym(void *h, const char *sym) { + return dlsym(h, sym); + } + static int wrap_dlclose(void *h) { + return dlclose(h); + } +#endif + +nvml_handle* nvml_create(){ + + int i=0; + +#if defined(WIN32) + /* Windows (do not use slashes, else ExpandEnvironmentStrings will mix them) */ +#define libnvidia_ml "%PROGRAMFILES%\\NVIDIA Corporation\\NVSMI\\nvml.dll" +#else + /* linux assumed */ +#define libnvidia_ml "libnvidia-ml.so" +#endif + + char tmp[512]; +#ifdef WIN32 + ExpandEnvironmentStrings(libnvidia_ml, tmp, sizeof(tmp)); +#else + strcpy(tmp, libnvidia_ml); +#endif + + void *nvml_dll = wrap_dlopen(tmp); + if (nvml_dll == NULL) { +#ifdef WIN32 + nvml_dll = wrap_dlopen("nvml.dll"); + if (nvml_dll == NULL) +#endif + return NULL; + } + + hnvml = (nvml_handle *) calloc(1, sizeof(nvml_handle)); + + hnvml->nvml_dll = nvml_dll; + + hnvml->nvmlInit = (nvmlReturn_t (*)(void)) wrap_dlsym(hnvml->nvml_dll, "nvmlInit_v2"); + if (!hnvml->nvmlInit) + hnvml->nvmlInit = (nvmlReturn_t (*)(void)) wrap_dlsym(hnvml->nvml_dll, "nvmlInit"); + hnvml->nvmlDeviceGetCount = (nvmlReturn_t (*)(int *)) wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetCount_v2"); + if (!hnvml->nvmlDeviceGetCount) + hnvml->nvmlDeviceGetCount = (nvmlReturn_t (*)(int *)) wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetCount"); + hnvml->nvmlDeviceGetHandleByIndex = (nvmlReturn_t (*)(int, nvmlDevice_t *)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetHandleByIndex_v2"); + hnvml->nvmlDeviceGetAPIRestriction = (nvmlReturn_t (*)(nvmlDevice_t, nvmlRestrictedAPI_t, nvmlEnableState_t *)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetAPIRestriction"); + hnvml->nvmlDeviceSetAPIRestriction = (nvmlReturn_t (*)(nvmlDevice_t, nvmlRestrictedAPI_t, nvmlEnableState_t)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceSetAPIRestriction"); + hnvml->nvmlDeviceGetDefaultApplicationsClock = (nvmlReturn_t (*)(nvmlDevice_t, nvmlClockType_t, unsigned int *clock)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetDefaultApplicationsClock"); + hnvml->nvmlDeviceGetApplicationsClock = (nvmlReturn_t (*)(nvmlDevice_t, nvmlClockType_t, unsigned int *clocks)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetApplicationsClock"); + hnvml->nvmlDeviceSetApplicationsClocks = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int mem, unsigned int gpu)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceSetApplicationsClocks"); + hnvml->nvmlDeviceResetApplicationsClocks = (nvmlReturn_t (*)(nvmlDevice_t)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceResetApplicationsClocks"); + hnvml->nvmlDeviceGetSupportedGraphicsClocks = (nvmlReturn_t (*)(nvmlDevice_t, uint32_t mem, uint32_t *num, uint32_t *)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetSupportedGraphicsClocks"); + hnvml->nvmlDeviceGetSupportedMemoryClocks = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *count, unsigned int *clocksMHz)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetSupportedMemoryClocks"); + hnvml->nvmlDeviceGetClockInfo = (nvmlReturn_t (*)(nvmlDevice_t, nvmlClockType_t, unsigned int *clock)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetClockInfo"); + hnvml->nvmlDeviceGetMaxClockInfo = (nvmlReturn_t (*)(nvmlDevice_t, nvmlClockType_t, unsigned int *clock)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetMaxClockInfo"); + hnvml->nvmlDeviceGetPciInfo = (nvmlReturn_t (*)(nvmlDevice_t, nvmlPciInfo_t *)) wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetPciInfo_v2"); + if (!hnvml->nvmlDeviceGetPciInfo) + hnvml->nvmlDeviceGetPciInfo = (nvmlReturn_t (*)(nvmlDevice_t, nvmlPciInfo_t *)) wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetPciInfo"); + hnvml->nvmlDeviceGetCurrPcieLinkGeneration = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *gen)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetCurrPcieLinkGeneration"); + hnvml->nvmlDeviceGetCurrPcieLinkWidth = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *width)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetCurrPcieLinkWidth"); + hnvml->nvmlDeviceGetMaxPcieLinkGeneration = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *gen)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetMaxPcieLinkGeneration"); + hnvml->nvmlDeviceGetMaxPcieLinkWidth = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *width)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetMaxPcieLinkWidth"); + hnvml->nvmlDeviceGetPowerUsage = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetPowerUsage"); + hnvml->nvmlDeviceGetPowerManagementDefaultLimit = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *limit)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetPowerManagementDefaultLimit"); + hnvml->nvmlDeviceGetPowerManagementLimit = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *limit)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetPowerManagementLimit"); + hnvml->nvmlDeviceGetPowerManagementLimitConstraints = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *min, unsigned int *max)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetPowerManagementLimitConstraints"); + hnvml->nvmlDeviceSetPowerManagementLimit = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int limit)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceSetPowerManagementLimit"); + hnvml->nvmlDeviceGetName = (nvmlReturn_t (*)(nvmlDevice_t, char *, int)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetName"); + hnvml->nvmlDeviceGetTemperature = (nvmlReturn_t (*)(nvmlDevice_t, int, unsigned int *)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetTemperature"); + hnvml->nvmlDeviceGetFanSpeed = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetFanSpeed"); + hnvml->nvmlDeviceGetPerformanceState = (nvmlReturn_t (*)(nvmlDevice_t, int *)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetPerformanceState"); /* or nvmlDeviceGetPowerState */ + hnvml->nvmlDeviceGetSerial = (nvmlReturn_t (*)(nvmlDevice_t, char *, unsigned int)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetSerial"); + hnvml->nvmlDeviceGetUUID = (nvmlReturn_t (*)(nvmlDevice_t, char *, unsigned int)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetUUID"); + hnvml->nvmlDeviceGetVbiosVersion = (nvmlReturn_t (*)(nvmlDevice_t, char *, unsigned int)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetVbiosVersion"); + hnvml->nvmlSystemGetDriverVersion = (nvmlReturn_t (*)(char *, unsigned int)) + wrap_dlsym(hnvml->nvml_dll, "nvmlSystemGetDriverVersion"); + hnvml->nvmlErrorString = (char* (*)(nvmlReturn_t)) + wrap_dlsym(hnvml->nvml_dll, "nvmlErrorString"); + hnvml->nvmlShutdown = (nvmlReturn_t (*)()) + wrap_dlsym(hnvml->nvml_dll, "nvmlShutdown"); + // v331 + hnvml->nvmlDeviceGetEnforcedPowerLimit = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int *limit)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetEnforcedPowerLimit"); + // v340 +#ifdef __linux__ + hnvml->nvmlDeviceClearCpuAffinity = (nvmlReturn_t (*)(nvmlDevice_t)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceClearCpuAffinity"); + hnvml->nvmlDeviceGetCpuAffinity = (nvmlReturn_t (*)(nvmlDevice_t, unsigned int sz, unsigned long *cpuSet)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetCpuAffinity"); + hnvml->nvmlDeviceSetCpuAffinity = (nvmlReturn_t (*)(nvmlDevice_t)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceSetCpuAffinity"); +#endif + // v346 + hnvml->nvmlDeviceGetPcieThroughput = (nvmlReturn_t (*)(nvmlDevice_t, nvmlPcieUtilCounter_t, unsigned int *value)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetPcieThroughput"); + // v36x (API 8 / Pascal) + hnvml->nvmlDeviceGetClock = (nvmlReturn_t (*)(nvmlDevice_t, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int *clockMHz)) + wrap_dlsym(hnvml->nvml_dll, "nvmlDeviceGetClock"); + + if (hnvml->nvmlInit == NULL || + hnvml->nvmlShutdown == NULL || + hnvml->nvmlErrorString == NULL || + hnvml->nvmlDeviceGetCount == NULL || + hnvml->nvmlDeviceGetHandleByIndex == NULL || + hnvml->nvmlDeviceGetPciInfo == NULL || + hnvml->nvmlDeviceGetName == NULL) + { + if (opt_debug) + applog(LOG_DEBUG, "Failed to obtain required NVML function pointers"); + wrap_dlclose(hnvml->nvml_dll); + free(hnvml); + return NULL; + } + + hnvml->nvmlInit(); + if (hnvml->nvmlSystemGetDriverVersion) + hnvml->nvmlSystemGetDriverVersion(driver_version, sizeof(driver_version)); + hnvml->nvmlDeviceGetCount(&hnvml->nvml_gpucount); + + /* Query CUDA device count, in case it doesn't agree with NVML, since */ + /* CUDA will only report GPUs with compute capability greater than 1.0 */ + if (cudaGetDeviceCount(&hnvml->cuda_gpucount) != cudaSuccess) { + if (opt_debug) + applog(LOG_DEBUG, "Failed to query CUDA device count!"); + wrap_dlclose(hnvml->nvml_dll); + free(hnvml); + return NULL; + } + + hnvml->devs = (nvmlDevice_t *) calloc(hnvml->nvml_gpucount, sizeof(nvmlDevice_t)); + hnvml->nvml_pci_domain_id = (unsigned int*) calloc(hnvml->nvml_gpucount, sizeof(unsigned int)); + hnvml->nvml_pci_bus_id = (unsigned int*) calloc(hnvml->nvml_gpucount, sizeof(unsigned int)); + hnvml->nvml_pci_device_id = (unsigned int*) calloc(hnvml->nvml_gpucount, sizeof(unsigned int)); + hnvml->nvml_pci_subsys_id = (unsigned int*) calloc(hnvml->nvml_gpucount, sizeof(unsigned int)); + hnvml->nvml_cuda_device_id = (int*) calloc(hnvml->nvml_gpucount, sizeof(int)); + hnvml->cuda_nvml_device_id = (int*) calloc(hnvml->cuda_gpucount, sizeof(int)); + hnvml->app_clocks = (nvmlEnableState_t*) calloc(hnvml->nvml_gpucount, sizeof(nvmlEnableState_t)); + + /* Obtain GPU device handles we're going to need repeatedly... */ + for (i=0; invml_gpucount; i++) { + hnvml->nvmlDeviceGetHandleByIndex(i, &hnvml->devs[i]); + } + + /* Query PCI info for each NVML device, and build table for mapping of */ + /* CUDA device IDs to NVML device IDs and vice versa */ + for (i=0; invml_gpucount; i++) { + nvmlPciInfo_t pciinfo; + + hnvml->nvmlDeviceGetPciInfo(hnvml->devs[i], &pciinfo); + hnvml->nvml_pci_domain_id[i] = pciinfo.domain; + hnvml->nvml_pci_bus_id[i] = pciinfo.bus; + hnvml->nvml_pci_device_id[i] = pciinfo.device; + hnvml->nvml_pci_subsys_id[i] = pciinfo.pci_subsystem_id; + + hnvml->app_clocks[i] = NVML_FEATURE_UNKNOWN; + if (hnvml->nvmlDeviceSetAPIRestriction) { + hnvml->nvmlDeviceSetAPIRestriction(hnvml->devs[i], NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS, + NVML_FEATURE_ENABLED); + /* there is only this API_SET_APPLICATION_CLOCKS on the 750 Ti (340.58) */ + } + if (hnvml->nvmlDeviceGetAPIRestriction) { + hnvml->nvmlDeviceGetAPIRestriction(hnvml->devs[i], NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS, + &hnvml->app_clocks[i]); + } + } + + /* build mapping of NVML device IDs to CUDA IDs */ + for (i=0; invml_gpucount; i++) { + hnvml->nvml_cuda_device_id[i] = -1; + } + for (i=0; icuda_gpucount; i++) { + cudaDeviceProp props; + hnvml->cuda_nvml_device_id[i] = -1; + + if (cudaGetDeviceProperties(&props, i) == cudaSuccess) { + device_bus_ids[i] = props.pciBusID; + for (int j = 0; j < hnvml->nvml_gpucount; j++) { + if ((hnvml->nvml_pci_domain_id[j] == (uint32_t) props.pciDomainID) && + (hnvml->nvml_pci_bus_id[j] == (uint32_t) props.pciBusID) && + (hnvml->nvml_pci_device_id[j] == (uint32_t) props.pciDeviceID)) { + if (opt_debug) + applog(LOG_DEBUG, "CUDA GPU %d matches NVML GPU %d by busId %u", + i, j, (uint32_t) props.pciBusID); + hnvml->nvml_cuda_device_id[j] = i; + hnvml->cuda_nvml_device_id[i] = j; + } + } + } + } + + return hnvml; +} + +/* apply config clocks to an used device */ +int nvml_set_clocks(int dev_id) +{ + nvmlReturn_t rc; + uint32_t gpu_clk = 0, mem_clk = 0; + int n = hnvml->cuda_nvml_device_id[dev_id]; + if (n < 0 || n >= hnvml->nvml_gpucount) + return -ENODEV; + + if (!device_gpu_clocks[dev_id] && !device_mem_clocks[dev_id]) + return 0; // nothing to do + + if (hnvml->app_clocks[n] != NVML_FEATURE_ENABLED) { + applog(LOG_WARNING, "GPU #%d: NVML application clock feature is not allowed!", dev_id); + return -EPERM; + } + + uint32_t mem_prev = clock_prev_mem[dev_id]; + if (!mem_prev) + hnvml->nvmlDeviceGetApplicationsClock(hnvml->devs[n], NVML_CLOCK_MEM, &mem_prev); + uint32_t gpu_prev = clock_prev[dev_id]; + if (!gpu_prev) + hnvml->nvmlDeviceGetApplicationsClock(hnvml->devs[n], NVML_CLOCK_GRAPHICS, &gpu_prev); + + hnvml->nvmlDeviceGetDefaultApplicationsClock(hnvml->devs[n], NVML_CLOCK_MEM, &mem_clk); + rc = hnvml->nvmlDeviceGetDefaultApplicationsClock(hnvml->devs[n], NVML_CLOCK_GRAPHICS, &gpu_clk); + if (rc != NVML_SUCCESS) { + applog(LOG_WARNING, "GPU #%d: unable to query application clocks", dev_id); + return -EINVAL; + } + + if (opt_debug) + applog(LOG_DEBUG, "GPU #%d: default application clocks are %u/%u", dev_id, mem_clk, gpu_clk); + + // get application config values + if (device_mem_clocks[dev_id]) mem_clk = device_mem_clocks[dev_id]; + if (device_gpu_clocks[dev_id]) gpu_clk = device_gpu_clocks[dev_id]; + + // these functions works for the 960 and the 970 (346.72+), and for the 750 Ti with driver ~361+ + uint32_t nclocks = 0, mem_clocks[32] = { 0 }; + hnvml->nvmlDeviceGetSupportedMemoryClocks(hnvml->devs[n], &nclocks, NULL); + nclocks = min(nclocks, 32); + if (nclocks) + hnvml->nvmlDeviceGetSupportedMemoryClocks(hnvml->devs[n], &nclocks, mem_clocks); + for (uint8_t u=0; u < nclocks; u++) { + // ordered by pstate (so highest is first memory clock - P0) + if (mem_clocks[u] <= mem_clk) { + mem_clk = mem_clocks[u]; + break; + } + } + + uint32_t* gpu_clocks = NULL; + nclocks = 0; + hnvml->nvmlDeviceGetSupportedGraphicsClocks(hnvml->devs[n], mem_clk, &nclocks, NULL); + if (nclocks) { + if (opt_debug) + applog(LOG_DEBUG, "GPU #%d: %u clocks found for mem %u", dev_id, nclocks, mem_clk); + gpu_clocks = (uint32_t*) calloc(1, sizeof(uint32_t) * nclocks + 4); + hnvml->nvmlDeviceGetSupportedGraphicsClocks(hnvml->devs[n], mem_clk, &nclocks, gpu_clocks); + for (uint8_t u=0; u < nclocks; u++) { + // ordered desc, so get first + if (gpu_clocks[u] <= gpu_clk) { + gpu_clk = gpu_clocks[u]; + break; + } + } + free(gpu_clocks); + } + + rc = hnvml->nvmlDeviceSetApplicationsClocks(hnvml->devs[n], mem_clk, gpu_clk); + if (rc == NVML_SUCCESS) + applog(LOG_INFO, "GPU #%d: application clocks set to %u/%u", dev_id, mem_clk, gpu_clk); + else { + applog(LOG_WARNING, "GPU #%d: %u/%u - %s (NVML)", dev_id, mem_clk, gpu_clk, hnvml->nvmlErrorString(rc)); + return -1; + } + + // store previous clocks for reset on exit (or during wait...) + clock_prev[dev_id] = gpu_prev; + clock_prev_mem[dev_id] = mem_prev; + return 1; +} + +/* reset default app clocks and limits on exit */ +int nvml_reset_clocks(int dev_id) +{ + int ret = 0; + nvmlReturn_t rc; + uint32_t gpu_clk = 0, mem_clk = 0; + int n = hnvml->cuda_nvml_device_id[dev_id]; + if (n < 0 || n >= hnvml->nvml_gpucount) + return -ENODEV; + + if (clock_prev[dev_id]) { + rc = hnvml->nvmlDeviceResetApplicationsClocks(hnvml->devs[n]); + if (rc != NVML_SUCCESS) { + applog(LOG_WARNING, "GPU #%d: unable to reset application clocks", dev_id); + } + clock_prev[dev_id] = 0; + ret = 1; + } + + if (limit_prev[dev_id]) { + uint32_t plimit = limit_prev[dev_id]; + if (hnvml->nvmlDeviceGetPowerManagementDefaultLimit && !plimit) { + rc = hnvml->nvmlDeviceGetPowerManagementDefaultLimit(hnvml->devs[n], &plimit); + } else if (plimit) { + rc = NVML_SUCCESS; + } + if (rc == NVML_SUCCESS) + hnvml->nvmlDeviceSetPowerManagementLimit(hnvml->devs[n], plimit); + ret = 1; + } + return ret; +} + + +/** + * Set power state of a device (9xx) + * Code is similar as clocks one, which allow the change of the pstate + */ +int nvml_set_pstate(int dev_id) +{ + nvmlReturn_t rc; + uint32_t gpu_clk = 0, mem_clk = 0; + int n = hnvml->cuda_nvml_device_id[dev_id]; + if (n < 0 || n >= hnvml->nvml_gpucount) + return -ENODEV; + + if (device_pstate[dev_id] < 0) + return 0; + + if (hnvml->app_clocks[n] != NVML_FEATURE_ENABLED) { + applog(LOG_WARNING, "GPU #%d: NVML app. clock feature is not allowed!", dev_id); + return -EPERM; + } + + hnvml->nvmlDeviceGetDefaultApplicationsClock(hnvml->devs[n], NVML_CLOCK_MEM, &mem_clk); + rc = hnvml->nvmlDeviceGetDefaultApplicationsClock(hnvml->devs[n], NVML_CLOCK_GRAPHICS, &gpu_clk); + if (rc != NVML_SUCCESS) { + applog(LOG_WARNING, "GPU #%d: unable to query application clocks", dev_id); + return -EINVAL; + } + + // get application config values + if (device_mem_clocks[dev_id]) mem_clk = device_mem_clocks[dev_id]; + if (device_gpu_clocks[dev_id]) gpu_clk = device_gpu_clocks[dev_id]; + + // these functions works for the 960 and the 970 (346.72+), and for the 750 Ti with driver ~361+ + uint32_t nclocks = 0, mem_clocks[32] = { 0 }; + int8_t wanted_pstate = device_pstate[dev_id]; + hnvml->nvmlDeviceGetSupportedMemoryClocks(hnvml->devs[n], &nclocks, NULL); + nclocks = min(nclocks, 32); + if (nclocks) + hnvml->nvmlDeviceGetSupportedMemoryClocks(hnvml->devs[n], &nclocks, mem_clocks); + if ((uint32_t) wanted_pstate+1 > nclocks) { + applog(LOG_WARNING, "GPU #%d: only %u mem clocks available (p-states)", dev_id, nclocks); + } + for (uint8_t u=0; u < nclocks; u++) { + // ordered by pstate (so highest P0 first) + if (u == wanted_pstate) { + mem_clk = mem_clocks[u]; + break; + } + } + + uint32_t* gpu_clocks = NULL; + nclocks = 0; + hnvml->nvmlDeviceGetSupportedGraphicsClocks(hnvml->devs[n], mem_clk, &nclocks, NULL); + if (nclocks) { + gpu_clocks = (uint32_t*) calloc(1, sizeof(uint32_t) * nclocks + 4); + rc = hnvml->nvmlDeviceGetSupportedGraphicsClocks(hnvml->devs[n], mem_clk, &nclocks, gpu_clocks); + if (rc == NVML_SUCCESS) { + // ordered desc, get the max app clock (do not limit) + gpu_clk = gpu_clocks[0]; + } + free(gpu_clocks); + } + + rc = hnvml->nvmlDeviceSetApplicationsClocks(hnvml->devs[n], mem_clk, gpu_clk); + if (rc != NVML_SUCCESS) { + applog(LOG_WARNING, "GPU #%d: pstate P%d (%u/%u) %s", dev_id, (int) wanted_pstate, + mem_clk, gpu_clk, hnvml->nvmlErrorString(rc)); + return -1; + } + + if (!opt_quiet) + applog(LOG_INFO, "GPU #%d: app clocks set to P%d (%u/%u)", dev_id, (int) wanted_pstate, mem_clk, gpu_clk); + + clock_prev[dev_id] = 1; + return 1; +} + +int nvml_set_plimit(int dev_id) +{ + nvmlReturn_t rc = NVML_ERROR_UNKNOWN; + uint32_t gpu_clk = 0, mem_clk = 0; + int n = hnvml->cuda_nvml_device_id[dev_id]; + if (n < 0 || n >= hnvml->nvml_gpucount) + return -ENODEV; + + if (!device_plimit[dev_id]) + return 0; // nothing to do + + if (!hnvml->nvmlDeviceSetPowerManagementLimit) + return -ENOSYS; + + uint32_t plimit = device_plimit[dev_id] * 1000; + uint32_t pmin = 1000, pmax = 0, prev_limit = 0; + if (hnvml->nvmlDeviceGetPowerManagementLimitConstraints) + rc = hnvml->nvmlDeviceGetPowerManagementLimitConstraints(hnvml->devs[n], &pmin, &pmax); + + if (rc != NVML_SUCCESS) { + if (!hnvml->nvmlDeviceGetPowerManagementLimit) + return -ENOSYS; + } + hnvml->nvmlDeviceGetPowerManagementLimit(hnvml->devs[n], &prev_limit); + if (!pmax) pmax = prev_limit; + + plimit = min(plimit, pmax); + plimit = max(plimit, pmin); + rc = hnvml->nvmlDeviceSetPowerManagementLimit(hnvml->devs[n], plimit); + if (rc != NVML_SUCCESS) { + applog(LOG_WARNING, "GPU #%d: plimit %s", dev_id, hnvml->nvmlErrorString(rc)); + return -1; + } + + if (!opt_quiet) { + applog(LOG_INFO, "GPU #%d: power limit set to %uW (allowed range is %u-%u)", + dev_id, plimit/1000U, pmin/1000U, pmax/1000U); + } + + limit_prev[dev_id] = prev_limit; + return 1; +} + +// ccminer -D -n +#define LSTDEV_PFX " " +void nvml_print_device_info(int dev_id) +{ + if (!hnvml) return; + + int n = hnvml->cuda_nvml_device_id[dev_id]; + if (n < 0 || n >= hnvml->nvml_gpucount) + return; + + nvmlReturn_t rc; + + if (hnvml->nvmlDeviceGetClock) { + uint32_t gpu_clk = 0, mem_clk = 0; + + fprintf(stderr, "------- Clocks -------\n"); + + hnvml->nvmlDeviceGetClock(hnvml->devs[n], NVML_CLOCK_GRAPHICS, NVML_CLOCK_ID_APP_CLOCK_DEFAULT, &gpu_clk); + rc = hnvml->nvmlDeviceGetClock(hnvml->devs[n], NVML_CLOCK_MEM, NVML_CLOCK_ID_APP_CLOCK_DEFAULT, &mem_clk); + if (rc == NVML_SUCCESS) { + fprintf(stderr, LSTDEV_PFX "DEFAULT MEM %4u GPU %4u MHz\n", mem_clk, gpu_clk); + } + hnvml->nvmlDeviceGetClock(hnvml->devs[n], NVML_CLOCK_GRAPHICS, NVML_CLOCK_ID_APP_CLOCK_TARGET, &gpu_clk); + rc = hnvml->nvmlDeviceGetClock(hnvml->devs[n], NVML_CLOCK_MEM, NVML_CLOCK_ID_APP_CLOCK_TARGET, &mem_clk); + if (rc == NVML_SUCCESS) { + fprintf(stderr, LSTDEV_PFX "TARGET MEM %4u GPU %4u MHz\n", mem_clk, gpu_clk); + } + hnvml->nvmlDeviceGetClock(hnvml->devs[n], NVML_CLOCK_GRAPHICS, NVML_CLOCK_ID_CURRENT, &gpu_clk); + rc = hnvml->nvmlDeviceGetClock(hnvml->devs[n], NVML_CLOCK_MEM, NVML_CLOCK_ID_CURRENT, &mem_clk); + if (rc == NVML_SUCCESS) { + fprintf(stderr, LSTDEV_PFX "CURRENT MEM %4u GPU %4u MHz\n", mem_clk, gpu_clk); + } + } +} + +int nvml_get_gpucount(int *gpucount) +{ + *gpucount = hnvml->nvml_gpucount; + return 0; +} + +int cuda_get_gpucount(int *gpucount) +{ + *gpucount = hnvml->cuda_gpucount; + return 0; +} + + +int nvml_get_gpu_name(int cudaindex, char *namebuf, int bufsize) +{ + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + if (!hnvml->nvmlDeviceGetName) + return -ENOSYS; + + if (hnvml->nvmlDeviceGetName(hnvml->devs[gpuindex], namebuf, bufsize) != NVML_SUCCESS) + return -1; + + return 0; +} + + +int nvml_get_tempC(int cudaindex, unsigned int *tempC) +{ + nvmlReturn_t rc; + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + if (!hnvml->nvmlDeviceGetTemperature) + return -ENOSYS; + + rc = hnvml->nvmlDeviceGetTemperature(hnvml->devs[gpuindex], 0u /* NVML_TEMPERATURE_GPU */, tempC); + if (rc != NVML_SUCCESS) { + return -1; + } + + return 0; +} + + +int nvml_get_fanpcnt(int cudaindex, unsigned int *fanpcnt) +{ + nvmlReturn_t rc; + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + if (!hnvml->nvmlDeviceGetFanSpeed) + return -ENOSYS; + + rc = hnvml->nvmlDeviceGetFanSpeed(hnvml->devs[gpuindex], fanpcnt); + if (rc != NVML_SUCCESS) { + return -1; + } + + return 0; +} + +int nvml_get_current_clocks(int cudaindex, uint32_t *graphics_clock, uint32_t *mem_clock) +{ + nvmlReturn_t rc; + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) return -1; + + rc = hnvml->nvmlDeviceGetClockInfo(hnvml->devs[gpuindex], NVML_CLOCK_GRAPHICS, graphics_clock); + if (rc != NVML_SUCCESS) return -1; + rc = hnvml->nvmlDeviceGetClockInfo(hnvml->devs[gpuindex], NVML_CLOCK_MEM, mem_clock); + if (rc != NVML_SUCCESS) return -1; + + return 0; +} + + +/* Not Supported on 750Ti 340.23 */ +int nvml_get_power_usage(int cudaindex, unsigned int *milliwatts) +{ + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + if (!hnvml->nvmlDeviceGetPowerUsage) + return -ENOSYS; + + nvmlReturn_t res = hnvml->nvmlDeviceGetPowerUsage(hnvml->devs[gpuindex], milliwatts); + if (res != NVML_SUCCESS) { + //if (opt_debug) + // applog(LOG_DEBUG, "nvmlDeviceGetPowerUsage: %s", hnvml->nvmlErrorString(res)); + return -1; + } + + return 0; +} + +/* Not Supported on 750Ti 340.23 */ +int nvml_get_pstate(int cudaindex, int *pstate) +{ + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + if (!hnvml->nvmlDeviceGetPerformanceState) + return -ENOSYS; + + nvmlReturn_t res = hnvml->nvmlDeviceGetPerformanceState(hnvml->devs[gpuindex], pstate); + if (res != NVML_SUCCESS) { + //if (opt_debug) + // applog(LOG_DEBUG, "nvmlDeviceGetPerformanceState: %s", hnvml->nvmlErrorString(res)); + return -1; + } + + return 0; +} + +int nvml_get_busid(int cudaindex, int *busid) +{ + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + (*busid) = hnvml->nvml_pci_bus_id[gpuindex]; + return 0; +} + +int nvml_get_serial(int cudaindex, char *sn, int maxlen) +{ + uint32_t subids = 0; + char uuid[NVML_DEVICE_UUID_BUFFER_SIZE]; + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + nvmlReturn_t res; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + if (hnvml->nvmlDeviceGetSerial) { + res = hnvml->nvmlDeviceGetSerial(hnvml->devs[gpuindex], sn, maxlen); + if (res == NVML_SUCCESS) + return 0; + } + + if (!hnvml->nvmlDeviceGetUUID) + return -ENOSYS; + + // nvmlDeviceGetUUID: GPU-f2bd642c-369f-5a14-e0b4-0d22dfe9a1fc + // use a part of uuid to generate an unique serial + // todo: check if there is vendor id is inside + memset(uuid, 0, sizeof(uuid)); + res = hnvml->nvmlDeviceGetUUID(hnvml->devs[gpuindex], uuid, sizeof(uuid)-1); + if (res != NVML_SUCCESS) { + if (opt_debug) + applog(LOG_DEBUG, "nvmlDeviceGetUUID: %s", hnvml->nvmlErrorString(res)); + return -1; + } + strncpy(sn, &uuid[4], min((int) strlen(uuid), maxlen)); + sn[maxlen-1] = '\0'; + return 0; +} + +int nvml_get_bios(int cudaindex, char *desc, int maxlen) +{ + uint32_t subids = 0; + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + if (!hnvml->nvmlDeviceGetVbiosVersion) + return -ENOSYS; + + nvmlReturn_t res = hnvml->nvmlDeviceGetVbiosVersion(hnvml->devs[gpuindex], desc, maxlen); + if (res != NVML_SUCCESS) { + if (opt_debug) + applog(LOG_DEBUG, "nvmlDeviceGetVbiosVersion: %s", hnvml->nvmlErrorString(res)); + return -1; + } + return 0; +} + +int nvml_get_info(int cudaindex, uint16_t &vid, uint16_t &pid) +{ + uint32_t subids = 0; + int gpuindex = hnvml->cuda_nvml_device_id[cudaindex]; + if (gpuindex < 0 || gpuindex >= hnvml->nvml_gpucount) + return -ENODEV; + + subids = hnvml->nvml_pci_subsys_id[gpuindex]; + if (!subids) subids = hnvml->nvml_pci_device_id[gpuindex]; + pid = subids >> 16; + vid = subids & 0xFFFF; + // Colorful and Inno3D + if (pid == 0) pid = hnvml->nvml_pci_device_id[gpuindex] >> 16; + return 0; +} + +int nvml_destroy() +{ + hnvml->nvmlShutdown(); + + wrap_dlclose(hnvml->nvml_dll); + + free(hnvml->nvml_pci_bus_id); + free(hnvml->nvml_pci_device_id); + free(hnvml->nvml_pci_domain_id); + free(hnvml->nvml_pci_subsys_id); + free(hnvml->nvml_cuda_device_id); + free(hnvml->cuda_nvml_device_id); + free(hnvml->app_clocks); + free(hnvml->devs); + + free(hnvml); + return 0; +} + +// ---------------------------------------------------------------------------- + +/** + * nvapi alternative for windows x86 binaries + * nvml api doesn't exists as 32bit dll :/// + */ +#ifdef WIN32 +#include "nvapi/nvapi_ccminer.h" + +static unsigned int nvapi_dev_map[MAX_GPUS] = { 0 }; +static NvDisplayHandle hDisplay_a[NVAPI_MAX_PHYSICAL_GPUS * 2] = { 0 }; +static NvPhysicalGpuHandle phys[NVAPI_MAX_PHYSICAL_GPUS] = { 0 }; +static NvU32 nvapi_dev_cnt = 0; +extern bool nvapi_dll_loaded; + +int nvapi_temperature(unsigned int devNum, unsigned int *temperature) +{ + NvAPI_Status ret; + + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + NV_GPU_THERMAL_SETTINGS thermal; + thermal.version = NV_GPU_THERMAL_SETTINGS_VER; + ret = NvAPI_GPU_GetThermalSettings(phys[devNum], 0, &thermal); + if (ret != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI NvAPI_GPU_GetThermalSettings: %s", string); + return -1; + } + + (*temperature) = (unsigned int) thermal.sensor[0].currentTemp; + + return 0; +} + +int nvapi_fanspeed(unsigned int devNum, unsigned int *speed) +{ + NvAPI_Status ret; + + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + NvU32 fanspeed = 0; + ret = NvAPI_GPU_GetTachReading(phys[devNum], &fanspeed); + if (ret != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI NvAPI_GPU_GetTachReading: %s", string); + return -1; + } + + (*speed) = (unsigned int) fanspeed; + + return 0; +} + +int nvapi_getpstate(unsigned int devNum, unsigned int *pstate) +{ + NvAPI_Status ret; + + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + NV_GPU_PERF_PSTATE_ID CurrentPstate = NVAPI_GPU_PERF_PSTATE_UNDEFINED; /* 16 */ + ret = NvAPI_GPU_GetCurrentPstate(phys[devNum], &CurrentPstate); + if (ret != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI NvAPI_GPU_GetCurrentPstate: %s", string); + return -1; + } + else { + // get pstate for the moment... often 0 = P0 + (*pstate) = (unsigned int)CurrentPstate; + } + + return 0; +} + +#define UTIL_DOMAIN_GPU 0 +int nvapi_getusage(unsigned int devNum, unsigned int *pct) +{ + NvAPI_Status ret; + + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + NV_GPU_DYNAMIC_PSTATES_INFO_EX info; + info.version = NV_GPU_DYNAMIC_PSTATES_INFO_EX_VER; + ret = NvAPI_GPU_GetDynamicPstatesInfoEx(phys[devNum], &info); + if (ret != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI GetDynamicPstatesInfoEx: %s", string); + return -1; + } + else { + if (info.utilization[UTIL_DOMAIN_GPU].bIsPresent) + (*pct) = info.utilization[UTIL_DOMAIN_GPU].percentage; + } + + return 0; +} + +int nvapi_getinfo(unsigned int devNum, uint16_t &vid, uint16_t &pid) +{ + NvAPI_Status ret; + NvU32 pDeviceId, pSubSystemId, pRevisionId, pExtDeviceId; + + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + ret = NvAPI_GPU_GetPCIIdentifiers(phys[devNum], &pDeviceId, &pSubSystemId, &pRevisionId, &pExtDeviceId); + if (ret != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI GetPCIIdentifiers: %s", string); + return -1; + } + + pid = pDeviceId >> 16; + vid = pDeviceId & 0xFFFF; + if (vid == 0x10DE && pSubSystemId) { + vid = pSubSystemId & 0xFFFF; + pid = pSubSystemId >> 16; + // Colorful and Inno3D + if (pid == 0) pid = pDeviceId >> 16; + } + + return 0; +} + +int nvapi_getserial(unsigned int devNum, char *serial, unsigned int maxlen) +{ + NvAPI_Status ret; + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + memset(serial, 0, maxlen); + + if (maxlen < 11) + return -EINVAL; + + NvAPI_ShortString ser = { 0 }; + ret = NvAPI_DLL_GetSerialNumber(phys[devNum], ser); + if (ret != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI GetSerialNumber: %s", string); + return -1; + } + + uint8_t *bytes = (uint8_t*) ser; + for (int n=0; n<5; n++) sprintf(&serial[n*2], "%02X", bytes[n]); + return 0; +} + +int nvapi_getbios(unsigned int devNum, char *desc, unsigned int maxlen) +{ + NvAPI_Status ret; + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + if (maxlen < 64) // Short String + return -1; + + ret = NvAPI_GPU_GetVbiosVersionString(phys[devNum], desc); + if (ret != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI GetVbiosVersionString: %s", string); + return -1; + } + return 0; +} + +static int SetAsusRGBLogo(unsigned int devNum, uint32_t RGB, bool ignorePrevState) +{ + NvAPI_Status ret = NVAPI_OK; + NV_I2C_INFO_EX* i2cInfo; + + int delay1 = 20000; + int delay2 = 0; + + uchar4 rgb = { 0 }; + memcpy(&rgb, &RGB, 4); + uchar4 prgb = { 0 }; + int32_t prev = device_led_state[nvapi_devid(devNum)]; + memcpy(&prgb, &prev, 4); + + NV_INIT_STRUCT_ALLOC(NV_I2C_INFO_EX, i2cInfo); + if (i2cInfo == NULL) return -ENOMEM; + + NvU32 data[5] = { 0 }; + NvU32 datv[2] = { 0, 1 }; + NvU32 datw[2] = { 1, 0 }; + if (rgb.z != prgb.z || ignorePrevState) { + data[2] = 4; // R:4 G:5 B:6, Mode = 7 (1 static, 2 breath, 3 blink, 4 demo) + data[3] = 1; + datv[0] = rgb.z | 0x13384000; + + i2cInfo->i2cDevAddress = 0x52; + i2cInfo->pbI2cRegAddress = (NvU8*) (&data[2]); + i2cInfo->regAddrSize = 1; + i2cInfo->pbData = (NvU8*) datv; + i2cInfo->cbRead = 5; + i2cInfo->cbSize = 1; + i2cInfo->portId = 1; + i2cInfo->bIsPortIdSet = 1; + + ret = NvAPI_DLL_I2CWriteEx(phys[devNum], i2cInfo, datw); + usleep(delay1); + has_rgb_ok = (ret == NVAPI_OK); + } + + if (rgb.y != prgb.y || ignorePrevState) { + data[2] = 5; + data[3] = 1; + datv[0] = rgb.y | 0x4000; + + i2cInfo->i2cDevAddress = 0x52; + i2cInfo->pbI2cRegAddress = (NvU8*) (&data[2]); + i2cInfo->regAddrSize = 1; + i2cInfo->pbData = (NvU8*) datv; + i2cInfo->cbRead = 5; + i2cInfo->cbSize = 1; + i2cInfo->portId = 1; + i2cInfo->bIsPortIdSet = 1; + + ret = NvAPI_DLL_I2CWriteEx(phys[devNum], i2cInfo, datw); + usleep(delay1); + has_rgb_ok = (ret == NVAPI_OK); + } + + if (rgb.y != prgb.y || ignorePrevState) { + data[2] = 6; + data[3] = 1; + datv[0] = rgb.x | 0x4000; + + i2cInfo->i2cDevAddress = 0x52; + i2cInfo->pbI2cRegAddress = (NvU8*) (&data[2]); + i2cInfo->regAddrSize = 1; + i2cInfo->pbData = (NvU8*) datv; + i2cInfo->cbRead = 5; + i2cInfo->cbSize = 1; + i2cInfo->portId = 1; + i2cInfo->bIsPortIdSet = 1; + + ret = NvAPI_DLL_I2CWriteEx(phys[devNum], i2cInfo, datw); + usleep(delay1); + has_rgb_ok = (ret == NVAPI_OK); + } + + if (rgb.w && ignorePrevState) { + data[2] = 7; + data[3] = 1; + datv[0] = rgb.w | 0x4000; + + i2cInfo->i2cDevAddress = 0x52; + i2cInfo->pbI2cRegAddress = (NvU8*) (&data[2]); + i2cInfo->regAddrSize = 1; + i2cInfo->pbData = (NvU8*) datv; + i2cInfo->cbRead = 5; + i2cInfo->cbSize = 1; + i2cInfo->portId = 1; + i2cInfo->bIsPortIdSet = 1; + + ret = NvAPI_DLL_I2CWriteEx(phys[devNum], i2cInfo, datw); + usleep(delay1); + has_rgb_ok = (ret == NVAPI_OK); + } + usleep(delay2); + free(i2cInfo); + return (int) ret; +} + +static int SetGigabyteRGBLogo(unsigned int devNum, uint32_t RGB) +{ + NvAPI_Status ret; + NV_I2C_INFO_EX* i2cInfo; + NV_INIT_STRUCT_ALLOC(NV_I2C_INFO_EX, i2cInfo); + if (i2cInfo == NULL) + return -ENOMEM; + + NvU32 readBuf[25] = { 0 }; + NvU32 data[5] = { 0 }; + data[0] = 1; + data[2] = swab32(RGB & 0xfcfcfcU) | 0x40; + + i2cInfo->i2cDevAddress = 0x48 << 1; + i2cInfo->pbI2cRegAddress = (NvU8*) (&data[2]); + i2cInfo->regAddrSize = 4; // NVAPI_MAX_SIZEOF_I2C_REG_ADDRESS + i2cInfo->pbData = (NvU8*) readBuf; + i2cInfo->cbRead = 2; + i2cInfo->cbSize = sizeof(readBuf); + i2cInfo->portId = 1; + i2cInfo->bIsPortIdSet = 1; + + //ret = NvAPI_DLL_I2CWriteEx(phys[devNum], i2cInfo, data); + ret = NvAPI_DLL_I2CReadEx(phys[devNum], i2cInfo, data); + usleep(20000); + free(i2cInfo); + return (int) ret; +} + +static int SetZotacRGBLogo(unsigned int devNum, uint32_t RGB) +{ + NvAPI_Status ret; + NV_I2C_INFO* i2cInfo; + NV_INIT_STRUCT_ALLOC(NV_I2C_INFO, i2cInfo); + if (i2cInfo == NULL) + return -ENOMEM; + + NvU32 buf[25] = { 0 }; + NvU32 data[5] = { 0 }; + + uint32_t color = 0, level = 0x40; + + uchar4 rgb = { 0 }; + memcpy(&rgb, &RGB, 4); + level = rgb.x & 0xF0; + level |= rgb.y & 0xF0; + level |= rgb.z & 0xF0; + //applog(LOG_DEBUG, "R %u G %u B %u", rgb.z, rgb.y, rgb.x); + + // Not really RGB custom, only some basic colors, so convert + // 0: Red, 1: Yellow, 2: Green, 3: Cyan, 4: Blue, 5: magenta, 6: white + if ((RGB & 0xFF0000) && (RGB & 0xFF00) && (RGB & 0xFF)) color = 6; + else if ((RGB & 0xFF0000) && (RGB & 0xFF)) color = 5; + else if ((RGB & 0xFF00) && (RGB & 0xFF)) color = 3; + else if ((RGB & 0xFF0000) && (RGB & 0xFF00)) color = 1; + else if (RGB & 0xFF) color = 4; + else if (RGB & 0xFF00) color = 2; + + buf[0] = 0xF0; // F0 set colors + buf[0] |= (color << 8); // logo + buf[0] |= (1 << 16); // top + if (RGB != 0) // level : 0x10 to 0xF0 + buf[0] |= (level << 24); + else + buf[0] |= (0x10U << 24); + + // todo: i2c data crc ? + + i2cInfo->displayMask = 1; + i2cInfo->bIsDDCPort = 1; + i2cInfo->i2cDevAddress = 0x48 << 1; + i2cInfo->pbI2cRegAddress = (NvU8*) (&data[2]); + i2cInfo->regAddrSize = 1; + i2cInfo->pbData = (NvU8*) buf; + i2cInfo->cbSize = 4; + i2cInfo->i2cSpeed = NVAPI_I2C_SPEED_DEPRECATED; + i2cInfo->i2cSpeedKhz = NVAPI_I2C_SPEED_100KHZ; // 4 + i2cInfo->portId = 1; + i2cInfo->bIsPortIdSet = 1; + + ret = NvAPI_I2CWrite(phys[devNum], i2cInfo); + // required to prevent i2c lock + usleep(20000); + +#if 0 + buf[0] = 0xF7; // F7 toggle leds + if (RGB == 0) + buf[0] |= (1 << 8); // 0 logo on, 1 off + buf[0] |= (1 << 16); // 1 top off + ret = NvAPI_I2CWrite(phys[devNum], i2cInfo); + usleep(20000); +#endif + // other modes: + // 0xF1 breathing green (0x070202F1) + // 0xF2 strobe green (0x070202F2) + // 0xF3 cycle (0x000000F3) + + free(i2cInfo); + return (int) ret; +} + +int nvapi_set_led(unsigned int devNum, int RGB, char *device_name) +{ + uint16_t vid = 0, pid = 0; + NvAPI_Status ret; + if (strstr(device_name, "Gigabyte GTX 10")) { + if (opt_debug) + applog(LOG_DEBUG, "GPU %x: Set RGB led to %06x", (int) phys[devNum], RGB); + return SetGigabyteRGBLogo(devNum, (uint32_t) RGB); + } else if (strstr(device_name, "ASUS GTX 10")) { + if (opt_debug) + applog(LOG_DEBUG, "GPU %x: Set RGB led to %06x", (int) phys[devNum], RGB); + return SetAsusRGBLogo(devNum, (uint32_t) RGB, !has_rgb_ok); + } else if (strstr(device_name, "Zotac GTX 10")) { + if (opt_debug) + applog(LOG_DEBUG, "GPU %x: Set RGB led to %06x", (int) phys[devNum], RGB); + return SetZotacRGBLogo(devNum, (uint32_t) RGB); + } else { + NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM* illu; + NV_INIT_STRUCT_ALLOC(NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM, illu); + illu->hPhysicalGpu = phys[devNum]; + illu->Attribute = NV_GPU_IA_LOGO_BRIGHTNESS; + ret = NvAPI_GPU_QueryIlluminationSupport(illu); + if (!ret && illu->bSupported) { + NV_GPU_GET_ILLUMINATION_PARM *led; + NV_INIT_STRUCT_ALLOC(NV_GPU_GET_ILLUMINATION_PARM, led); + led->hPhysicalGpu = phys[devNum]; + led->Attribute = NV_GPU_IA_LOGO_BRIGHTNESS; + NvAPI_GPU_GetIllumination(led); + if (opt_debug) + applog(LOG_DEBUG, "GPU %x: Led level was %d, set to %d", (int) phys[devNum], led->Value, RGB); + led->Value = (uint32_t) RGB; + ret = NvAPI_GPU_SetIllumination((NV_GPU_SET_ILLUMINATION_PARM*) led); + free(led); + } + free(illu); + return ret; + } +} + +int nvapi_pstateinfo(unsigned int devNum) +{ + uint32_t n; + NvAPI_Status ret; + uint32_t* mem = (uint32_t*) calloc(1, 0x4000); + if (!mem) + return -ENOMEM; + + unsigned int current = 0xFF; + // useless on init but... + nvapi_getpstate(devNum, ¤t); + +#if 0 + // try :p + uint32_t* buf = (uint32_t*) calloc(1, 0x8000); + for (int i=8; i < 0x8000 && buf; i+=4) { + buf[0] = 0x10000 + i; + NV_GPU_PERF_PSTATE_ID pst = NVAPI_GPU_PERF_PSTATE_P0; + ret = NvAPI_DLL_GetPstateClientLimits(phys[devNum], pst, buf); + if (ret != NVAPI_INCOMPATIBLE_STRUCT_VERSION) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + applog(LOG_BLUE, "struct size is %06x : %s", buf[0], string); + for (int n=0; n < i/32; n++) + applog_hex(&buf[n*(32/4)], 32); + break; + } + } + free(buf); +#endif + +#if 0 + // Unsure of the meaning of these values + NVAPI_GPU_POWER_TOPO topo = { 0 }; + topo.version = NVAPI_GPU_POWER_TOPO_VER; + if ((ret = NvAPI_DLL_ClientPowerTopologyGetStatus(phys[devNum], &topo)) == NVAPI_OK) { + if (topo.count) + applog(LOG_RAW, " GPU TDP is %.1f~%.1f W ?", + (double) topo.entries[0].power/1000, (double) topo.entries[1].power/1000); + + // Ok on 970, not pascal + NV_GPU_PERF_PSTATES20_INFO_V2 pset2 = { 0 }; + pset2.version = NV_GPU_PERF_PSTATES20_INFO_VER2; + pset2.ov.numVoltages = 1; + pset2.ov.voltages[0].voltDelta_uV.value = 3000; // gpu + 3000 uv; + ret = NvAPI_DLL_SetPstates20v2(phys[devNum], &pset2); +#endif + + NV_GPU_PERF_PSTATES20_INFO* info; + NV_INIT_STRUCT_ON(NV_GPU_PERF_PSTATES20_INFO, info, mem); + if ((ret = NvAPI_GPU_GetPstates20(phys[devNum], info)) != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_RAW, "NVAPI GetPstates20: %s", string); + return -1; + } + + for (n=0; n < info->numPstates; n++) { + NV_GPU_PSTATE20_CLOCK_ENTRY_V1* clocks = info->pstates[n].clocks; + applog(LOG_RAW, "%sP%d: MEM %4u MHz%s GPU %6.1f MHz%s %4u mV%s \x7F %d/%d", + info->pstates[n].pstateId == current ? ">":" ", (int) info->pstates[n].pstateId, + clocks[1].data.single.freq_kHz/1000, clocks[1].bIsEditable ? "*":" ", + (double) clocks[0].data.single.freq_kHz/1000, clocks[0].bIsEditable ? "*":" ", + info->pstates[n].baseVoltages[0].volt_uV/1000, info->pstates[n].baseVoltages[0].bIsEditable ? "*": " ", + info->pstates[n].baseVoltages[0].voltDelta_uV.valueRange.min/1000, // range if editable + info->pstates[n].baseVoltages[0].voltDelta_uV.valueRange.max/1000); + if (clocks[1].freqDelta_kHz.value || clocks[0].freqDelta_kHz.value) { + applog(LOG_RAW, " OC %+4d MHz %+6.1f MHz", + clocks[1].freqDelta_kHz.value/1000, (double) clocks[0].freqDelta_kHz.value/1000); + } + } + // boost over volting (GTX 9xx only ?) + for (n=0; n < info->ov.numVoltages; n++) { + applog(LOG_RAW, " OV: %u%+d mV%s \x7F %d/%d", + info->ov.voltages[n].volt_uV/1000, info->ov.voltages[n].voltDelta_uV.value/1000, info->ov.voltages[n].bIsEditable ? "*":" ", + info->ov.voltages[n].voltDelta_uV.valueRange.min/1000, info->ov.voltages[n].voltDelta_uV.valueRange.max/1000); + } + + NV_GPU_CLOCK_FREQUENCIES *freqs; + NV_INIT_STRUCT_ON(NV_GPU_CLOCK_FREQUENCIES, freqs, mem); + freqs->ClockType = NV_GPU_CLOCK_FREQUENCIES_BASE_CLOCK; + ret = NvAPI_GPU_GetAllClockFrequencies(phys[devNum], freqs); + applog(LOG_RAW, " MEM %4.0f MHz GPU %6.1f MHz Base Clocks", + (double) freqs->domain[NVAPI_GPU_PUBLIC_CLOCK_MEMORY].frequency / 1000, + (double) freqs->domain[NVAPI_GPU_PUBLIC_CLOCK_GRAPHICS].frequency / 1000); + + freqs->ClockType = NV_GPU_CLOCK_FREQUENCIES_BOOST_CLOCK; + ret = NvAPI_GPU_GetAllClockFrequencies(phys[devNum], freqs); + applog(LOG_RAW, " MEM %4.0f MHz GPU %6.1f MHz Boost Clocks", + (double) freqs->domain[NVAPI_GPU_PUBLIC_CLOCK_MEMORY].frequency / 1000, + (double) freqs->domain[NVAPI_GPU_PUBLIC_CLOCK_GRAPHICS].frequency / 1000); + + freqs->ClockType = NV_GPU_CLOCK_FREQUENCIES_CURRENT_FREQ; + ret = NvAPI_GPU_GetAllClockFrequencies(phys[devNum], freqs); + applog(LOG_RAW, " MEM %4.0f MHz GPU %6.1f MHz >Current", + (double) freqs->domain[NVAPI_GPU_PUBLIC_CLOCK_MEMORY].frequency / 1000, + (double) freqs->domain[NVAPI_GPU_PUBLIC_CLOCK_GRAPHICS].frequency / 1000); + + // Other clock values ?? + NVAPI_GPU_PERF_CLOCKS *pcl; + NV_INIT_STRUCT_ALLOC(NVAPI_GPU_PERF_CLOCKS, pcl); + int numClock=0; ret = NVAPI_OK; + while (ret == NVAPI_OK) { + if ((ret = NvAPI_DLL_GetPerfClocks(phys[devNum], numClock, pcl)) == NVAPI_OK) { + applog(LOG_RAW, " C%d: MEM %4.0f MHz GPU %6.1f MHz [%5.1f/%6.1f]", numClock, + (double) pcl->memFreq1/1000, (double) pcl->gpuFreq1/1000, (double) pcl->gpuFreqMin/1000, (double) pcl->gpuFreqMax/1000); + // ret = NvAPI_DLL_SetPerfClocks(phys[devNum], numClock, pcl); // error + } + numClock++; + } + + // Pascal only + NVAPI_VOLTBOOST_PERCENT *pvb; + NV_INIT_STRUCT_ON(NVAPI_VOLTBOOST_PERCENT, pvb, mem); + if ((ret = NvAPI_DLL_GetCoreVoltageBoostPercent(phys[devNum], pvb)) == NVAPI_OK) { + NVAPI_VOLTAGE_STATUS *pvdom; + NV_INIT_STRUCT_ALLOC(NVAPI_VOLTAGE_STATUS, pvdom); + NvAPI_DLL_GetCurrentVoltage(phys[devNum], pvdom); + if (pvdom && pvdom->value_uV) + applog(LOG_RAW, " GPU Voltage is %u mV %+d%% boost", pvdom->value_uV/1000, pvb->percent); + else if (pvdom) + applog(LOG_RAW, " GPU Voltage is %u mV", pvdom->value_uV/1000); + free(pvdom); + } else { + // Maxwell 9xx + NVAPI_VOLT_STATUS *mvdom, *mvstep; + NV_INIT_STRUCT_ALLOC(NVAPI_VOLT_STATUS, mvdom); + if (mvdom && (ret = NvAPI_DLL_GetVoltageDomainsStatus(phys[devNum], mvdom)) == NVAPI_OK) { + NV_INIT_STRUCT_ALLOC(NVAPI_VOLT_STATUS, mvstep); + NvAPI_DLL_GetVoltageStep(phys[devNum], mvstep); + if (mvdom->value_uV) applog(LOG_RAW, " GPU Voltage is %.1f mV with %.3f mV resolution", + (double) mvdom->value_uV/1000, (double) mvstep->value_uV/1000); + free(mvstep); + } + free(mvdom); + } + + uint32_t plim = nvapi_get_plimit(devNum); + applog(LOG_RAW, " Power limit is set to %u%%", plim); + +#if 0 + NVAPI_COOLER_SETTINGS *cooler; + NV_INIT_STRUCT_ON(NVAPI_COOLER_SETTINGS, cooler, mem); + ret = NvAPI_DLL_GetCoolerSettings(phys[devNum], 7, cooler); + if (ret == NVAPI_OK) { + applog(LOG_RAW, " Fan level is set to %u%%", cooler->level); // wrong val, seems 1 (auto ?) + NVAPI_COOLER_LEVEL *fan; + NV_INIT_STRUCT_ALLOC(NVAPI_COOLER_LEVEL, fan); + fan->level = 100; + fan->count = 1; + ret = NvAPI_DLL_SetCoolerLevels(phys[devNum], 7, fan); + free(fan); + sleep(10); + ret = NvAPI_DLL_RestoreCoolerSettings(phys[devNum], cooler, 7); + } +#endif + + NV_GPU_THERMAL_SETTINGS *tset; + NV_INIT_STRUCT_ON(NV_GPU_THERMAL_SETTINGS, tset, mem); + + NVAPI_GPU_THERMAL_INFO *tnfo; + NV_INIT_STRUCT_ALLOC(NVAPI_GPU_THERMAL_INFO, tnfo); + NVAPI_GPU_THERMAL_LIMIT *tlim; + NV_INIT_STRUCT_ALLOC(NVAPI_GPU_THERMAL_LIMIT, tlim); + NvAPI_GPU_GetThermalSettings(phys[devNum], 0, tset); + NvAPI_DLL_ClientThermalPoliciesGetInfo(phys[devNum], tnfo); + if ((ret = NvAPI_DLL_ClientThermalPoliciesGetLimit(phys[devNum], tlim)) == NVAPI_OK) { + applog(LOG_RAW, " Thermal limit is set to %u, current Tc %d, range [%u-%u]", + tlim->entries[0].value >> 8, tset->sensor[0].currentTemp, + tnfo->entries[0].min_temp >> 8, tnfo->entries[0].max_temp >> 8); + } + free(tnfo); + free(tlim); + +#if 1 + // Read pascal Clocks Table, Empty on 9xx + //NVAPI_CLOCKS_RANGE* ranges; + //NV_INIT_STRUCT_ON(NVAPI_CLOCKS_RANGE, ranges, mem); + //ret = NvAPI_DLL_GetClockBoostRanges(phys[devNum], ranges); + + NVAPI_CLOCK_MASKS* boost; + NV_INIT_STRUCT_ON(NVAPI_CLOCK_MASKS, boost, mem); + ret = NvAPI_DLL_GetClockBoostMask(phys[devNum], boost); + int gpuClocks = 0, memClocks = 0; + for (n=0; n < 80+23; n++) { + if (boost->clocks[n].memDelta) memClocks++; + if (boost->clocks[n].gpuDelta) gpuClocks++; + } + + // PASCAL GTX ONLY + if (gpuClocks || memClocks) { + NVAPI_CLOCK_TABLE *table; + NV_INIT_STRUCT_ALLOC(NVAPI_CLOCK_TABLE, table); + memcpy(table->mask, boost->mask, 12); + ret = NvAPI_DLL_GetClockBoostTable(phys[devNum], table); + gpuClocks = 0, memClocks = 0; + for (n=0; n < 12; n++) { + if (table->buf0[n] != 0) applog(LOG_RAW, "boost table 0[%u] not empty (%u)", n, table->buf0[n]); + } + for (n=0; n < 80; n++) { + if (table->gpuDeltas[n].freqDelta) { + // note: gpu delta value seems to be x2, not the memory + //applog(LOG_RAW, " Boost gpu clock delta %u set to %d MHz", n, table->gpuDeltas[n].freqDelta/2000); + gpuClocks++; + } + } + for (n=0; n < 23; n++) { + if (table->memFilled[n]) { + //applog(LOG_RAW, " Boost mem clock delta %u set to %d MHz", n, table->memDeltas[n]/1000); + memClocks++; + } + } + for (n=0; n < 1529; n++) { + if (table->buf1[n] != 0) applog(LOG_RAW, "boost table 1[%u] not empty (%u)", n, table->buf1[n]); + } + applog(LOG_RAW, " Boost table contains %d gpu and %d mem levels.", gpuClocks, memClocks); + free(table); + + NVAPI_VFP_CURVE *curve; + NV_INIT_STRUCT_ALLOC(NVAPI_VFP_CURVE, curve); + memcpy(curve->mask, boost->mask, 12); + ret = NvAPI_DLL_GetVFPCurve(phys[devNum], curve); + gpuClocks = 0, memClocks = 0; + for (n=0; n < 80; n++) { + if (curve->gpuEntries[n].freq_kHz || curve->gpuEntries[n].volt_uV) { + // applog(LOG_RAW, "gpu volt table %2u %4u MHz - %6u mV", n, curve->gpuEntries[n].freq_kHz/1000, curve->gpuEntries[n].volt_uV/1000); + gpuClocks++; + } + } + for (n=0; n < 23; n++) { + if (curve->memEntries[n].freq_kHz || curve->memEntries[n].volt_uV) { + // applog(LOG_RAW, "mem volt table %2u %4u MHz - %6u mV", n, curve->memEntries[n].freq_kHz/1000, curve->memEntries[n].volt_uV/1000); + memClocks++; + } + } + for (n=0; n < 1064; n++) { + if (curve->buf1[n] != 0) applog(LOG_RAW, "volt table buf1[%u] not empty (%u)", n, curve->buf1[n]); + } + applog(LOG_RAW, " Volts table contains %d gpu and %d mem levels.", gpuClocks, memClocks); + free(curve); + } + + // Maxwell + else { + NVAPI_VOLTAGES_TABLE* volts; + NV_INIT_STRUCT_ALLOC(NVAPI_VOLTAGES_TABLE, volts); + int entries = 0; + ret = NvAPI_DLL_GetVoltages(phys[devNum], volts); + for (n=0; n < 128; n++) { + if (volts->entries[n].volt_uV) + entries++; + } + applog(LOG_RAW, " Volts table contains %d gpu levels.", entries); + free(volts); + } + + NV_DISPLAY_DRIVER_MEMORY_INFO* meminfo; + NV_INIT_STRUCT_ON(NV_DISPLAY_DRIVER_MEMORY_INFO, meminfo, mem); + meminfo->version = NV_DISPLAY_DRIVER_MEMORY_INFO_VER; + if ((ret = NvAPI_GPU_GetMemoryInfo(phys[devNum], meminfo)) == NVAPI_OK) { + applog(LOG_RAW, " Memory: %u MB, %.1f used", meminfo->dedicatedVideoMemory/1024, + (double) (meminfo->availableDedicatedVideoMemory - meminfo->curAvailableDedicatedVideoMemory)/1024); + } +#if 0 /* some undetermined stats */ + NVAPI_GPU_PERF_INFO pi = { 0 }; + pi.version = NVAPI_GPU_PERF_INFO_VER; + ret = NvAPI_DLL_PerfPoliciesGetInfo(phys[devNum], &pi); + + NVAPI_GPU_PERF_STATUS ps = { 0 }; + ps.version = NVAPI_GPU_PERF_STATUS_VER; + ret = NvAPI_DLL_PerfPoliciesGetStatus(phys[devNum], &ps); + applog(LOG_BLUE, "%llx %lld. %lld. %llx %llx %llx", ps.timeRef, ps.val1, ps.val2, ps.values[0], ps.values[1], ps.values[2]); +#endif + +#endif + free(mem); + return 0; +} + +uint8_t nvapi_get_plimit(unsigned int devNum) +{ + NvAPI_Status ret = NVAPI_OK; + NVAPI_GPU_POWER_STATUS pol = { 0 }; + pol.version = NVAPI_GPU_POWER_STATUS_VER; + if ((ret = NvAPI_DLL_ClientPowerPoliciesGetStatus(phys[devNum], &pol)) != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI PowerPoliciesGetStatus: %s", string); + return 0; + } + return (uint8_t) (pol.entries[0].power / 1000); // in percent +} + +int nvapi_set_plimit(unsigned int devNum, uint16_t percent) +{ + NvAPI_Status ret = NVAPI_OK; + uint32_t val = percent * 1000; + + NVAPI_GPU_POWER_INFO nfo = { 0 }; + nfo.version = NVAPI_GPU_POWER_INFO_VER; + ret = NvAPI_DLL_ClientPowerPoliciesGetInfo(phys[devNum], &nfo); + if (ret == NVAPI_OK) { + if (val == 0) + val = nfo.entries[0].def_power; + else if (val < nfo.entries[0].min_power) + val = nfo.entries[0].min_power; + else if (val > nfo.entries[0].max_power) + val = nfo.entries[0].max_power; + } + + NVAPI_GPU_POWER_STATUS pol = { 0 }; + pol.version = NVAPI_GPU_POWER_STATUS_VER; + pol.flags = 1; + pol.entries[0].power = val; + if ((ret = NvAPI_DLL_ClientPowerPoliciesSetStatus(phys[devNum], &pol)) != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI PowerPoliciesSetStatus: %s", string); + return -1; + } + return ret; +} + +int nvapi_set_tlimit(unsigned int devNum, uint8_t limit) +{ + NvAPI_Status ret; + uint32_t val = limit; + + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + NV_GPU_THERMAL_SETTINGS tset = { 0 }; + NVAPI_GPU_THERMAL_INFO tnfo = { 0 }; + NVAPI_GPU_THERMAL_LIMIT tlim = { 0 }; + tset.version = NV_GPU_THERMAL_SETTINGS_VER; + NvAPI_GPU_GetThermalSettings(phys[devNum], 0, &tset); + tnfo.version = NVAPI_GPU_THERMAL_INFO_VER; + NvAPI_DLL_ClientThermalPoliciesGetInfo(phys[devNum], &tnfo); + tlim.version = NVAPI_GPU_THERMAL_LIMIT_VER; + if ((ret = NvAPI_DLL_ClientThermalPoliciesGetLimit(phys[devNum], &tlim)) == NVAPI_OK) { + tlim.entries[0].value = val << 8; + tlim.flags = 1; + ret = NvAPI_DLL_ClientThermalPoliciesSetLimit(phys[devNum], &tlim); + if (ret == NVAPI_OK) { + applog(LOG_INFO, "GPU #%u: thermal limit set to %u, current Tc %d, range [%u-%u]", + devNum, val, tset.sensor[0].currentTemp, + tnfo.entries[0].min_temp >> 8, tnfo.entries[0].max_temp >> 8); + } else { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + applog(LOG_WARNING, "GPU #%u: thermal limit: %s, valid range is [%u-%u]", devNum, string, + tnfo.entries[0].min_temp >> 8, tnfo.entries[0].max_temp >> 8); + } + } + return (int) ret; +} + +int nvapi_set_gpuclock(unsigned int devNum, uint32_t clock) +{ + NvAPI_Status ret; + NvS32 delta = 0; + + if (devNum >= nvapi_dev_cnt) + return -ENODEV; +#if 0 + // wrong api to get default base clock when modified, cuda props seems fine + NV_GPU_CLOCK_FREQUENCIES freqs = { 0 }; + freqs.version = NV_GPU_CLOCK_FREQUENCIES_VER; + freqs.ClockType = NV_GPU_CLOCK_FREQUENCIES_BASE_CLOCK; + ret = NvAPI_GPU_GetAllClockFrequencies(phys[devNum], &freqs); + if (ret == NVAPI_OK) { + delta = (clock * 1000) - freqs.domain[NVAPI_GPU_PUBLIC_CLOCK_GRAPHICS].frequency; + } + + NV_GPU_PERF_PSTATES_INFO deffreqs = { 0 }; + deffreqs.version = NV_GPU_PERF_PSTATES_INFO_VER; + ret = NvAPI_GPU_GetPstatesInfoEx(phys[devNum], &deffreqs, 0); // we want default clock grr! + if (ret == NVAPI_OK) { + if (deffreqs.pstates[0].clocks[1].domainId == NVAPI_GPU_PUBLIC_CLOCK_GRAPHICS) + delta = (clock * 1000) - deffreqs.pstates[0].clocks[1].freq*2; + } +#endif + + cudaDeviceProp props = { 0 }; + NvU32 busId = 0xFFFF; + ret = NvAPI_GPU_GetBusId(phys[devNum], &busId); + for (int d=0; d < (int) nvapi_dev_cnt; d++) { + // unsure about devNum, so be safe + cudaGetDeviceProperties(&props, d); + if (props.pciBusID == busId) { + delta = (clock * 1000) - props.clockRate; + break; + } + } + + if (delta == (clock * 1000)) + return ret; + + NV_GPU_PERF_PSTATES20_INFO_V1 pset1 = { 0 }; + pset1.version = NV_GPU_PERF_PSTATES20_INFO_VER1; + pset1.numPstates = 1; + pset1.numClocks = 1; + // Ok on both 1080 and 970 + pset1.pstates[0].clocks[0].domainId = NVAPI_GPU_PUBLIC_CLOCK_GRAPHICS; + pset1.pstates[0].clocks[0].freqDelta_kHz.value = delta; + ret = NvAPI_DLL_SetPstates20v1(phys[devNum], &pset1); + if (ret == NVAPI_OK) { + applog(LOG_INFO, "GPU #%u: boost gpu clock set to %u (delta %d)", devNum, clock, delta/1000); + } + return ret; +} + +int nvapi_set_memclock(unsigned int devNum, uint32_t clock) +{ + NvAPI_Status ret; + NvS32 delta = 0; + + if (devNum >= nvapi_dev_cnt) + return -ENODEV; + + // wrong to get default base clock (when modified) on maxwell (same as cuda props one) + NV_GPU_CLOCK_FREQUENCIES freqs = { 0 }; + freqs.version = NV_GPU_CLOCK_FREQUENCIES_VER; + freqs.ClockType = NV_GPU_CLOCK_FREQUENCIES_BASE_CLOCK; + ret = NvAPI_GPU_GetAllClockFrequencies(phys[devNum], &freqs); // wrong base clocks, useless + if (ret == NVAPI_OK) { + delta = (clock * 1000) - freqs.domain[NVAPI_GPU_PUBLIC_CLOCK_MEMORY].frequency; + } + + // seems ok on maxwell and pascal for the mem clocks + NV_GPU_PERF_PSTATES_INFO deffreqs = { 0 }; + deffreqs.version = NV_GPU_PERF_PSTATES_INFO_VER; + ret = NvAPI_GPU_GetPstatesInfoEx(phys[devNum], &deffreqs, 0x1); // deprecated but req for def clocks + if (ret == NVAPI_OK) { + if (deffreqs.pstates[0].clocks[0].domainId == NVAPI_GPU_PUBLIC_CLOCK_MEMORY) + delta = (clock * 1000) - deffreqs.pstates[0].clocks[0].freq; + } + + if (delta == (clock * 1000)) + return ret; + + // todo: bounds check with GetPstates20 + + NV_GPU_PERF_PSTATES20_INFO_V1 pset1 = { 0 }; + pset1.version = NV_GPU_PERF_PSTATES20_INFO_VER1; + pset1.numPstates = 1; + pset1.numClocks = 1; + pset1.pstates[0].clocks[0].domainId = NVAPI_GPU_PUBLIC_CLOCK_MEMORY; + pset1.pstates[0].clocks[0].freqDelta_kHz.value = delta; + ret = NvAPI_DLL_SetPstates20v1(phys[devNum], &pset1); + if (ret == NVAPI_OK) { + applog(LOG_INFO, "GPU #%u: Boost mem clock set to %u (delta %d)", devNum, clock, delta/1000); + } + return ret; +} + +// Replacement for WIN32 CUDA 6.5 on pascal +int nvapiMemGetInfo(int dev_id, size_t *free, size_t *total) +{ + NvAPI_Status ret = NVAPI_OK; + NV_DISPLAY_DRIVER_MEMORY_INFO mem = { 0 }; + mem.version = NV_DISPLAY_DRIVER_MEMORY_INFO_VER; + unsigned int devNum = nvapi_dev_map[dev_id % MAX_GPUS]; + if ((ret = NvAPI_GPU_GetMemoryInfo(phys[devNum], &mem)) == NVAPI_OK) { + *total = mem.dedicatedVideoMemory;// mem.availableDedicatedVideoMemory; + *free = mem.curAvailableDedicatedVideoMemory; + } + return (int) ret; +} + +int nvapi_init() +{ + int num_gpus = cuda_num_devices(); + NvAPI_Status ret = NvAPI_Initialize(); + if (!ret == NVAPI_OK){ + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI NvAPI_Initialize: %s", string); + return -1; + } + + ret = NvAPI_EnumPhysicalGPUs(phys, &nvapi_dev_cnt); + if (ret != NVAPI_OK) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + if (opt_debug) + applog(LOG_DEBUG, "NVAPI NvAPI_EnumPhysicalGPUs: %s", string); + return -1; + } + + for (int g = 0; g < num_gpus; g++) { + cudaDeviceProp props; + if (cudaGetDeviceProperties(&props, g) == cudaSuccess) { + device_bus_ids[g] = props.pciBusID; + } + nvapi_dev_map[g] = g; // default mapping + } + + for (NvU8 i = 0; i < nvapi_dev_cnt; i++) { + NvAPI_ShortString name; + ret = NvAPI_GPU_GetFullName(phys[i], name); + if (ret == NVAPI_OK) { + for (int g = 0; g < num_gpus; g++) { + NvU32 busId; + ret = NvAPI_GPU_GetBusId(phys[i], &busId); + if (ret == NVAPI_OK && busId == device_bus_ids[g]) { + nvapi_dev_map[g] = i; + if (opt_debug) + applog(LOG_DEBUG, "CUDA GPU %d matches NVAPI GPU %d by busId %u", + g, i, busId); + break; + } + } + } else { + NvAPI_ShortString string; + NvAPI_GetErrorMessage(ret, string); + applog(LOG_DEBUG, "NVAPI NvAPI_GPU_GetFullName: %s", string); + } + } +#if 0 + if (opt_debug) { + NvAPI_ShortString ver; + NvAPI_GetInterfaceVersionString(ver); + applog(LOG_DEBUG, "%s", ver); + } +#endif + + NvU32 udv; + NvAPI_ShortString str; + ret = NvAPI_SYS_GetDriverAndBranchVersion(&udv, str); + if (ret == NVAPI_OK) { + sprintf(driver_version,"%d.%02d", udv / 100, udv % 100); + } + + return 0; +} + +int nvapi_init_settings() +{ + // nvapi.dll + int ret = nvapi_dll_init(); + if (ret != NVAPI_OK) + return ret; + + if (!opt_n_threads) { + opt_n_threads = active_gpus; + } + + for (int n=0; n < opt_n_threads; n++) { + int dev_id = device_map[n % MAX_GPUS]; + if (device_plimit[dev_id]) { + if (nvapi_set_plimit(nvapi_dev_map[dev_id], device_plimit[dev_id]) == NVAPI_OK) { + uint32_t res = nvapi_get_plimit(nvapi_dev_map[dev_id]); + gpulog(LOG_INFO, n, "Power limit is set to %u%%", res); + } + } + if (device_tlimit[dev_id]) { + nvapi_set_tlimit(nvapi_dev_map[dev_id], device_tlimit[dev_id]); + } + if (device_gpu_clocks[dev_id]) { + ret = nvapi_set_gpuclock(nvapi_dev_map[dev_id], device_gpu_clocks[dev_id]); + if (ret) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage((NvAPI_Status) ret, string); + gpulog(LOG_WARNING, n, "Boost gpu clock %s", string); + } + } + if (device_mem_clocks[dev_id]) { + ret = nvapi_set_memclock(nvapi_dev_map[dev_id], device_mem_clocks[dev_id]); + if (ret) { + NvAPI_ShortString string; + NvAPI_GetErrorMessage((NvAPI_Status) ret, string); + gpulog(LOG_WARNING, n, "Boost mem clock %s", string); + } + } + if (device_pstate[dev_id]) { + // dunno how via nvapi or/and pascal + } + if (device_led[dev_id] != -1) { + int err = nvapi_set_led(nvapi_dev_map[dev_id], device_led[dev_id], device_name[dev_id]); + if (err != 0) { + gpulog(LOG_WARNING, n, "Unable to set led value (err %d)", err); + } + device_led_state[dev_id] = device_led[dev_id]; + } + } + + return ret; +} + +unsigned int nvapi_devnum(int dev_id) +{ + return nvapi_dev_map[dev_id]; +} + +int nvapi_devid(unsigned int devNum) +{ + for (int i=0; i < opt_n_threads; i++) { + int dev_id = device_map[i % MAX_GPUS]; + if (nvapi_dev_map[dev_id] = devNum) + return dev_id; + } + return 0; +} + +#endif /* WIN32 : Windows specific (nvapi) */ + +/* api functions -------------------------------------- */ + +// assume 2500 rpm as default, auto-updated if more +static unsigned int fan_speed_max = 2500; + +unsigned int gpu_fanpercent(struct cgpu_info *gpu) +{ + unsigned int pct = 0; + if (hnvml) { + nvml_get_fanpcnt(gpu->gpu_id, &pct); + } +#ifdef WIN32 + else { + unsigned int rpm = 0; + nvapi_fanspeed(nvapi_dev_map[gpu->gpu_id], &rpm); + pct = (rpm * 100) / fan_speed_max; + if (pct > 100) { + pct = 100; + fan_speed_max = rpm; + } + } +#endif + return pct; +} + +unsigned int gpu_fanrpm(struct cgpu_info *gpu) +{ + unsigned int rpm = 0; +#ifdef WIN32 + nvapi_fanspeed(nvapi_dev_map[gpu->gpu_id], &rpm); +#endif + return rpm; +} + + +unsigned int gpu_temp(struct cgpu_info *gpu){ + + unsigned int tc = 0; + unsigned int tmp = 0; + if (hnvml) { + nvml_get_tempC(gpu->gpu_id, &tmp); + tc = tmp; + } +#ifdef WIN32 + else { + nvapi_temperature(nvapi_dev_map[gpu->gpu_id], &tmp); + tc = tmp; + } +#endif + return tc; +} + +int gpu_pstate(struct cgpu_info *gpu) +{ + int pstate = -1; + int support = -1; + if (hnvml) { + support = nvml_get_pstate(gpu->gpu_id, &pstate); + } +#ifdef WIN32 + if (support == -1) { + unsigned int pst = 0; + nvapi_getpstate(nvapi_dev_map[gpu->gpu_id], &pst); + pstate = (int) pst; + } +#endif + return pstate; +} + +int gpu_busid(struct cgpu_info *gpu) +{ + int busid = -1; + int support = -1; + if (hnvml) { + support = nvml_get_busid(gpu->gpu_id, &busid); + } +#ifdef WIN32 + if (support == -1) { + busid = device_bus_ids[gpu->gpu_id]; + } +#endif + return busid; +} + +unsigned int gpu_power(struct cgpu_info *gpu) +{ + unsigned int mw = 0; + int support = -1; + if (hnvml) { + support = nvml_get_power_usage(gpu->gpu_id, &mw); + } +#ifdef WIN32 + if (support == -1) { + unsigned int pct = 0; + nvapi_getusage(nvapi_dev_map[gpu->gpu_id], &pct); + pct *= nvapi_get_plimit(nvapi_dev_map[gpu->gpu_id]); + pct /= 100; + mw = pct; // to fix + } +#endif + if (gpu->gpu_power > 0) { + // average + mw = (gpu->gpu_power + mw) / 2; + } + return mw; +} + +static int translate_vendor_id(uint16_t vid, char *vendorname) +{ + struct VENDORS { + const uint16_t vid; + const char *name; + } vendors[] = { + { 0x1043, "ASUS" }, + { 0x1048, "Elsa" }, + { 0x107D, "Leadtek" }, + { 0x10B0, "Gainward" }, + // { 0x10DE, "NVIDIA" }, + { 0x1458, "Gigabyte" }, + { 0x1462, "MSI" }, + { 0x154B, "PNY" }, // maybe storage devices + { 0x1569, "Palit" }, + { 0x1682, "XFX" }, + { 0x196D, "Club3D" }, + { 0x196E, "PNY" }, + { 0x19DA, "Zotac" }, + { 0x19F1, "BFG" }, + { 0x1ACC, "PoV" }, + { 0x1B4C, "Galax" }, // KFA2 in EU, to check on Pascal cards + { 0x3842, "EVGA" }, + { 0x7377, "Colorful" }, + { 0, "" } + }; + + if (!vendorname) + return -EINVAL; + + for(int v=0; v < ARRAY_SIZE(vendors); v++) { + if (vid == vendors[v].vid) { + strcpy(vendorname, vendors[v].name); + return vid; + } + } + if (opt_debug && vid != 0x10DE) + applog(LOG_DEBUG, "nvml: Unknown vendor %04x\n", vid); + return 0; +} + +int gpu_vendor(uint8_t pci_bus_id, char *vendorname) +{ + uint16_t vid = 0, pid = 0; + if (hnvml) { // may not be initialized on start... + for (int id=0; id < hnvml->nvml_gpucount; id++) { + if (hnvml->nvml_pci_bus_id[id] == pci_bus_id) { + int dev_id = hnvml->nvml_cuda_device_id[id]; + nvml_get_info(dev_id, vid, pid); + } + } + } else { +#ifdef WIN32 + for (unsigned id = 0; id < nvapi_dev_cnt; id++) { + if (device_bus_ids[id] == pci_bus_id) { + nvapi_getinfo(nvapi_dev_map[id], vid, pid); + break; + } + } +#endif + } + return translate_vendor_id(vid, vendorname); +} + +int gpu_info(struct cgpu_info *gpu) +{ + char vendorname[32] = { 0 }; + int id = gpu->gpu_id; + uint8_t bus_id = 0; + + gpu->nvml_id = -1; + gpu->nvapi_id = -1; + + if (id < 0) + return -1; + + if (hnvml) { + gpu->nvml_id = (int8_t) hnvml->cuda_nvml_device_id[id]; + nvml_get_info(id, gpu->gpu_vid, gpu->gpu_pid); + nvml_get_serial(id, gpu->gpu_sn, sizeof(gpu->gpu_sn)); + nvml_get_bios(id, gpu->gpu_desc, sizeof(gpu->gpu_desc)); + } +#ifdef WIN32 + gpu->nvapi_id = (int8_t) nvapi_dev_map[id]; + nvapi_getinfo(nvapi_dev_map[id], gpu->gpu_vid, gpu->gpu_pid); + nvapi_getserial(nvapi_dev_map[id], gpu->gpu_sn, sizeof(gpu->gpu_sn)); + nvapi_getbios(nvapi_dev_map[id], gpu->gpu_desc, sizeof(gpu->gpu_desc)); +#endif + return 0; +} + +#endif /* USE_WRAPNVML */ + +static int rgb_percent(int RGB, int percent) +{ + uint8_t* comp = (uint8_t*) &RGB; + int res = ((percent*comp[2]) / 100) << 16; + res += ((percent*comp[1]) / 100) << 8; + return res + ((percent*comp[0]) / 100); +} + +void gpu_led_on(int dev_id) +{ +#if defined(WIN32) && defined(USE_WRAPNVML) + int value = device_led[dev_id]; + if (device_led_state[dev_id] != value) { + if (nvapi_set_led(nvapi_dev_map[dev_id], value, device_name[dev_id]) == 0) + device_led_state[dev_id] = value; + } +#endif +} + +void gpu_led_percent(int dev_id, int percent) +{ +#if defined(WIN32) && defined(USE_WRAPNVML) + int value = rgb_percent(device_led[dev_id], percent); + if (device_led_state[dev_id] != value) { + if (nvapi_set_led(nvapi_dev_map[dev_id], value, device_name[dev_id]) == 0) + device_led_state[dev_id] = value; + } +#endif +} + +void gpu_led_off(int dev_id) +{ +#if defined(WIN32) && defined(USE_WRAPNVML) + if (device_led_state[dev_id]) { + if (nvapi_set_led(nvapi_dev_map[dev_id], 0, device_name[dev_id]) == 0) + device_led_state[dev_id] = 0; + } +#endif +} diff --git a/nvml.h b/nvml.h new file mode 100644 index 0000000..34f276b --- /dev/null +++ b/nvml.h @@ -0,0 +1,251 @@ +/* + * A trivial little dlopen()-based wrapper library for the + * NVIDIA NVML library, to allow runtime discovery of NVML on an + * arbitrary system. This is all very hackish and simple-minded, but + * it serves my immediate needs in the short term until NVIDIA provides + * a static NVML wrapper library themselves, hopefully in + * CUDA 6.5 or maybe sometime shortly after. + * + * This trivial code is made available under the "new" 3-clause BSD license, + * and/or any of the GPL licenses you prefer. + * Feel free to use the code and modify as you see fit. + * + * John E. Stone - john.stone@gmail.com + * + */ +#ifdef USE_WRAPNVML + +#include "miner.h" + +typedef void * nvmlDevice_t; + +/* our own version of the PCI info struct */ +typedef struct { + char bus_id_str[16]; /* string form of bus info */ + unsigned int domain; + unsigned int bus; + unsigned int device; + unsigned int pci_device_id; /* combined device and vendor id */ + unsigned int pci_subsystem_id; + unsigned int res0; /* NVML internal use only */ + unsigned int res1; + unsigned int res2; + unsigned int res3; +} nvmlPciInfo_t; + +enum nvmlEnableState_t { + NVML_FEATURE_DISABLED = 0, + NVML_FEATURE_ENABLED = 1, + NVML_FEATURE_UNKNOWN = 2 +}; + +enum nvmlRestrictedAPI_t { + NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS = 0, + NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS = 1, // not for GTX cards + NVML_RESTRICTED_API_COUNT = 2 +}; + +enum nvmlReturn_t { + NVML_SUCCESS = 0, + NVML_ERROR_UNINITIALIZED = 1, + NVML_ERROR_INVALID_ARGUMENT = 2, + NVML_ERROR_NOT_SUPPORTED = 3, + NVML_ERROR_NO_PERMISSION = 4, + NVML_ERROR_ALREADY_INITIALIZED = 5, + NVML_ERROR_NOT_FOUND = 6, + NVML_ERROR_INSUFFICIENT_SIZE = 7, + NVML_ERROR_INSUFFICIENT_POWER = 8, + NVML_ERROR_DRIVER_NOT_LOADED = 9, + NVML_ERROR_TIMEOUT = 10, + NVML_ERROR_IRQ_ISSUE = 11, + NVML_ERROR_LIBRARY_NOT_FOUND = 12, + NVML_ERROR_FUNCTION_NOT_FOUND = 13, + NVML_ERROR_CORRUPTED_INFOROM = 14, + NVML_ERROR_GPU_IS_LOST = 15, + NVML_ERROR_RESET_REQUIRED = 16, + NVML_ERROR_OPERATING_SYSTEM = 17, + NVML_ERROR_LIB_RM_VERSION_MISMATCH = 18, + NVML_ERROR_IN_USE = 19, + NVML_ERROR_UNKNOWN = 999 +}; + +enum nvmlClockType_t { + NVML_CLOCK_GRAPHICS = 0, + NVML_CLOCK_SM = 1, + NVML_CLOCK_MEM = 2, + NVML_CLOCK_VIDEO = 3, + NVML_CLOCK_COUNT +}; + +enum nvmlClockId_t { + NVML_CLOCK_ID_CURRENT = 0, + NVML_CLOCK_ID_APP_CLOCK_TARGET = 1, + NVML_CLOCK_ID_APP_CLOCK_DEFAULT = 2, + NVML_CLOCK_ID_CUSTOMER_BOOST_MAX = 3, + NVML_CLOCK_ID_COUNT +}; + +enum nvmlPcieUtilCounter_t { + NVML_PCIE_UTIL_TX_BYTES = 0, + NVML_PCIE_UTIL_RX_BYTES = 1, + NVML_PCIE_UTIL_COUNT +}; + +enum nvmlValueType_t { + NVML_VALUE_TYPE_DOUBLE = 0, + NVML_VALUE_TYPE_UNSIGNED_INT = 1, + NVML_VALUE_TYPE_UNSIGNED_LONG = 2, + NVML_VALUE_TYPE_UNSIGNED_LONG_LONG = 3, + NVML_VALUE_TYPE_COUNT +}; + +typedef int nvmlGpuTopologyLevel_t; +typedef int nvmlNvLinkCapability_t; +typedef int nvmlNvLinkErrorCounter_t; +typedef int nvmlNvLinkUtilizationControl_t; + +#define NVML_DEVICE_SERIAL_BUFFER_SIZE 30 +#define NVML_DEVICE_UUID_BUFFER_SIZE 80 +#define NVML_DEVICE_VBIOS_VERSION_BUFFER_SIZE 32 + +/* + * Handle to hold the function pointers for the entry points we need, + * and the shared library itself. + */ +typedef struct { + void *nvml_dll; + int nvml_gpucount; + int cuda_gpucount; + unsigned int *nvml_pci_domain_id; + unsigned int *nvml_pci_bus_id; + unsigned int *nvml_pci_device_id; + unsigned int *nvml_pci_subsys_id; + int *nvml_cuda_device_id; /* map NVML dev to CUDA dev */ + int *cuda_nvml_device_id; /* map CUDA dev to NVML dev */ + nvmlDevice_t *devs; + nvmlEnableState_t *app_clocks; + nvmlReturn_t (*nvmlInit)(void); + nvmlReturn_t (*nvmlDeviceGetCount)(int *); + nvmlReturn_t (*nvmlDeviceGetHandleByIndex)(int, nvmlDevice_t *); + nvmlReturn_t (*nvmlDeviceGetAPIRestriction)(nvmlDevice_t, nvmlRestrictedAPI_t, nvmlEnableState_t *); + nvmlReturn_t (*nvmlDeviceSetAPIRestriction)(nvmlDevice_t, nvmlRestrictedAPI_t, nvmlEnableState_t); + nvmlReturn_t (*nvmlDeviceGetDefaultApplicationsClock)(nvmlDevice_t, nvmlClockType_t, unsigned int *); + nvmlReturn_t (*nvmlDeviceGetApplicationsClock)(nvmlDevice_t, nvmlClockType_t, unsigned int *); + nvmlReturn_t (*nvmlDeviceSetApplicationsClocks)(nvmlDevice_t, unsigned int, unsigned int); + nvmlReturn_t (*nvmlDeviceResetApplicationsClocks)(nvmlDevice_t); + nvmlReturn_t (*nvmlDeviceGetSupportedGraphicsClocks)(nvmlDevice_t, uint32_t mem, uint32_t *num, uint32_t *arr); + nvmlReturn_t (*nvmlDeviceGetSupportedMemoryClocks)(nvmlDevice_t, unsigned int *count, unsigned int *clocksMHz); + nvmlReturn_t (*nvmlDeviceGetClockInfo)(nvmlDevice_t, nvmlClockType_t, unsigned int *); + nvmlReturn_t (*nvmlDeviceGetMaxClockInfo)(nvmlDevice_t, nvmlClockType_t, unsigned int *); + nvmlReturn_t (*nvmlDeviceGetPowerManagementDefaultLimit)(nvmlDevice_t, unsigned int *limit); + nvmlReturn_t (*nvmlDeviceGetPowerManagementLimit)(nvmlDevice_t, unsigned int *limit); + nvmlReturn_t (*nvmlDeviceGetPowerManagementLimitConstraints)(nvmlDevice_t, unsigned int *min, unsigned int *max); + nvmlReturn_t (*nvmlDeviceSetPowerManagementLimit)(nvmlDevice_t device, unsigned int limit); + nvmlReturn_t (*nvmlDeviceGetPciInfo)(nvmlDevice_t, nvmlPciInfo_t *); + nvmlReturn_t (*nvmlDeviceGetCurrPcieLinkGeneration)(nvmlDevice_t device, unsigned int *gen); + nvmlReturn_t (*nvmlDeviceGetCurrPcieLinkWidth)(nvmlDevice_t device, unsigned int *width); + nvmlReturn_t (*nvmlDeviceGetMaxPcieLinkGeneration)(nvmlDevice_t device, unsigned int *gen); + nvmlReturn_t (*nvmlDeviceGetMaxPcieLinkWidth)(nvmlDevice_t device, unsigned int *width); + nvmlReturn_t (*nvmlDeviceGetName)(nvmlDevice_t, char *, int); + nvmlReturn_t (*nvmlDeviceGetTemperature)(nvmlDevice_t, int, unsigned int *); + nvmlReturn_t (*nvmlDeviceGetFanSpeed)(nvmlDevice_t, unsigned int *); + nvmlReturn_t (*nvmlDeviceGetPerformanceState)(nvmlDevice_t, int *); /* enum */ + nvmlReturn_t (*nvmlDeviceGetPowerUsage)(nvmlDevice_t, unsigned int *); + nvmlReturn_t (*nvmlDeviceGetSerial)(nvmlDevice_t, char *serial, unsigned int len); + nvmlReturn_t (*nvmlDeviceGetUUID)(nvmlDevice_t, char *uuid, unsigned int len); + nvmlReturn_t (*nvmlDeviceGetVbiosVersion)(nvmlDevice_t, char *version, unsigned int len); + nvmlReturn_t (*nvmlSystemGetDriverVersion)(char *version, unsigned int len); + char* (*nvmlErrorString)(nvmlReturn_t); + nvmlReturn_t (*nvmlShutdown)(void); + // v331 + nvmlReturn_t (*nvmlDeviceGetEnforcedPowerLimit)(nvmlDevice_t, unsigned int *limit); + // v340 +#ifdef __linux__ + nvmlReturn_t (*nvmlDeviceClearCpuAffinity)(nvmlDevice_t); + nvmlReturn_t (*nvmlDeviceGetCpuAffinity)(nvmlDevice_t, unsigned int cpuSetSize, unsigned long* cpuSet); + nvmlReturn_t (*nvmlDeviceSetCpuAffinity)(nvmlDevice_t); +#endif + // v346 + nvmlReturn_t (*nvmlDeviceGetPcieThroughput)(nvmlDevice_t, nvmlPcieUtilCounter_t, unsigned int *value); + // v36x (API 8) + nvmlReturn_t (*nvmlDeviceGetClock)(nvmlDevice_t, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int *clockMHz); +#ifdef __linux__ + nvmlReturn_t (*nvmlSystemGetTopologyGpuSet)(unsigned int cpuNumber, unsigned int *count, nvmlDevice_t *deviceArray); + nvmlReturn_t (*nvmlDeviceGetTopologyNearestGpus)(nvmlDevice_t, nvmlGpuTopologyLevel_t level, unsigned int *count, nvmlDevice_t *deviceArray); + nvmlReturn_t (*nvmlDeviceGetTopologyCommonAncestor)(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t *pathInfo); +#endif + nvmlReturn_t (*nvmlDeviceGetNvLinkState)(nvmlDevice_t, unsigned int link, nvmlEnableState_t *isActive); + nvmlReturn_t (*nvmlDeviceGetNvLinkVersion)(nvmlDevice_t, unsigned int link, unsigned int *version); + nvmlReturn_t (*nvmlDeviceGetNvLinkCapability)(nvmlDevice_t, unsigned int link, nvmlNvLinkCapability_t capability, unsigned int *capResult); + nvmlReturn_t (*nvmlDeviceGetNvLinkRemotePciInfo)(nvmlDevice_t, unsigned int link, nvmlPciInfo_t *pci); + nvmlReturn_t (*nvmlDeviceGetNvLinkErrorCounter)(nvmlDevice_t, unsigned int link, nvmlNvLinkErrorCounter_t counter, unsigned long long *counterValue); + nvmlReturn_t (*nvmlDeviceResetNvLinkErrorCounters)(nvmlDevice_t, unsigned int link); + nvmlReturn_t (*nvmlDeviceSetNvLinkUtilizationControl)(nvmlDevice_t, unsigned int link, unsigned int counter, nvmlNvLinkUtilizationControl_t *control, unsigned int reset); + nvmlReturn_t (*nvmlDeviceGetNvLinkUtilizationControl)(nvmlDevice_t, unsigned int link, unsigned int counter, nvmlNvLinkUtilizationControl_t *control); + nvmlReturn_t (*nvmlDeviceGetNvLinkUtilizationCounter)(nvmlDevice_t, unsigned int link, unsigned int counter, unsigned long long *rxcounter, unsigned long long *txcounter); + nvmlReturn_t (*nvmlDeviceFreezeNvLinkUtilizationCounter)(nvmlDevice_t, unsigned int link, unsigned int counter, nvmlEnableState_t freeze); + nvmlReturn_t (*nvmlDeviceResetNvLinkUtilizationCounter)(nvmlDevice_t, unsigned int link, unsigned int counter); + +} nvml_handle; + +nvml_handle * nvml_create(); +int nvml_destroy(); + +/* +* Query the current graphics and memory clocks from the CUDA device ID +*/ +int nvml_get_current_clocks(int cudaindex, uint32_t *graphics_clock, uint32_t *mem_clock); + +// Debug informations +void nvml_print_device_info(int dev_id); + +// Query the number of GPUs seen by NVML +int nvml_get_gpucount(int *gpucount); + +int nvml_set_plimit(int dev_id); +int nvml_set_pstate(int dev_id); + +int nvml_set_clocks(int dev_id); +int nvml_reset_clocks(int dev_id); + +/* api functions */ + +unsigned int gpu_fanpercent(struct cgpu_info *gpu); +unsigned int gpu_fanrpm(struct cgpu_info *gpu); +unsigned int gpu_temp(struct cgpu_info *gpu); +unsigned int gpu_power(struct cgpu_info *gpu); +int gpu_pstate(struct cgpu_info *gpu); +int gpu_busid(struct cgpu_info *gpu); + +// pid/vid, sn and bios rev +int gpu_info(struct cgpu_info *gpu); + +int gpu_vendor(uint8_t pci_bus_id, char *vendorname); + +/* nvapi functions */ +#ifdef WIN32 +int nvapi_init(); +int nvapi_init_settings(); + +// to debug nvapi.. +int nvapi_pstateinfo(unsigned int devNum); +uint8_t nvapi_get_plimit(unsigned int devNum); + +// nvapi devNum from dev_id (cuda GPU #N) +unsigned int nvapi_devnum(int dev_id); +int nvapi_devid(unsigned int devNum); + +// cuda Replacement for 6.5 compat +int nvapiMemGetInfo(int dev_id, size_t *free, size_t *total); +#endif + +#endif /* USE_WRAPNVML */ + +void gpu_led_on(int dev_id); +void gpu_led_percent(int dev_id, int percent); +void gpu_led_off(int dev_id); + +#define LED_MODE_OFF 0 +#define LED_MODE_SHARES 1 +#define LED_MODE_MINING 2 + diff --git a/pools.conf b/pools.conf new file mode 100644 index 0000000..b13b801 --- /dev/null +++ b/pools.conf @@ -0,0 +1,30 @@ +{ + "_note": "Sample rotation of 2 pools", + + "pools":[{ + "name": "Longpoll sample", + "url": "http://ziftr.suprnova.cc:9991", + "user": "tpruvot.win", + "pass": "x", + "max-diff": 0.0, + "scantime": 40, + "time-limit": 180, + "disabled": false + }, + { + "name": "Stratum sample", + "url": "stratum+tcp://zrc-stratum.suprnova.cc:2257", + "user": "tpruvot.elite", + "pass": "x", + "time-limit": 300 + }], + + "algo" : "zr5", + + "timeout": 60, + + "api-bind" : "0.0.0.0", + "api-remote" : true, + + "no-gbt": true +} diff --git a/pools.cpp b/pools.cpp new file mode 100644 index 0000000..0b80507 --- /dev/null +++ b/pools.cpp @@ -0,0 +1,404 @@ +/** + * Functions which handle multiple pools data + */ + +#include +#include +#include +#include + +#include "miner.h" +#include "compat.h" +#include "algos.h" + +// to move in miner.h +extern bool allow_gbt; +extern bool allow_mininginfo; +extern bool check_dups; + +extern double opt_max_diff; +extern double opt_max_rate; +extern int opt_scantime; +extern int opt_shares_limit; +extern int opt_time_limit; + +extern char* rpc_url; +extern char* rpc_user; +extern char* rpc_pass; +extern char* short_url; + +extern struct work _ALIGN(64) g_work; +extern struct stratum_ctx stratum; +extern pthread_mutex_t stratum_work_lock; +extern pthread_mutex_t stats_lock; +extern bool get_work(struct thr_info *thr, struct work *work); +extern bool stratum_need_reset; +extern time_t firstwork_time; + +extern volatile time_t g_work_time; +extern volatile int pool_switch_count; +extern volatile bool pool_is_switching; +extern uint8_t conditional_state[MAX_GPUS]; + +extern double thr_hashrates[MAX_GPUS]; + +extern struct option options[]; + +#define CFG_NULL 0 +#define CFG_POOL 1 +struct opt_config_array { + int cat; + const char *name; // json key + const char *longname; // global opt name if different +} cfg_array_keys[] = { + { CFG_POOL, "url", NULL }, /* let this key first, increment pools */ + { CFG_POOL, "user", NULL }, + { CFG_POOL, "pass", NULL }, + { CFG_POOL, "userpass", NULL }, + { CFG_POOL, "name", "pool-name" }, + { CFG_POOL, "algo", "pool-algo" }, + { CFG_POOL, "scantime", "pool-scantime" }, + { CFG_POOL, "max-diff", "pool-max-diff" }, + { CFG_POOL, "max-rate", "pool-max-rate" }, + { CFG_POOL, "disabled", "pool-disabled" }, + { CFG_POOL, "time-limit", "pool-time-limit" }, + { CFG_NULL, NULL, NULL } +}; + +// store current credentials in pools container +void pool_set_creds(int pooln) +{ + struct pool_infos *p = &pools[pooln]; + + snprintf(p->url, sizeof(p->url), "%s", rpc_url); + snprintf(p->short_url, sizeof(p->short_url), "%s", short_url); + snprintf(p->user, sizeof(p->user), "%s", rpc_user); + snprintf(p->pass, sizeof(p->pass), "%s", rpc_pass); + + if (!(p->status & POOL_ST_DEFINED)) { + p->id = pooln; + p->status |= POOL_ST_DEFINED; + // init pool options as "unset" + // until cmdline is fully parsed... + p->algo = -1; + p->max_diff = -1.; + p->max_rate = -1.; + p->scantime = -1; + p->shares_limit = -1; + p->time_limit = -1; + + p->allow_mininginfo = allow_mininginfo; + p->allow_gbt = allow_gbt; + p->check_dups = check_dups; + + p->status |= POOL_ST_DEFINED; + } + + if (strlen(rpc_url)) { + if (!strncasecmp(rpc_url, "stratum", 7)) + p->type = POOL_STRATUM; + else /* if (!strncasecmp(rpc_url, "http", 4)) */ + p->type = POOL_GETWORK; // todo: or longpoll + p->status |= POOL_ST_VALID; + } +} + +// fill the unset pools options with cmdline ones +void pool_init_defaults() +{ + struct pool_infos *p; + for (int i=0; ialgo == -1) p->algo = (int) opt_algo; + if (p->max_diff == -1.) p->max_diff = opt_max_diff; + if (p->max_rate == -1.) p->max_rate = opt_max_rate; + if (p->scantime == -1) p->scantime = opt_scantime; + if (p->shares_limit == -1) p->shares_limit = opt_shares_limit; + if (p->time_limit == -1) p->time_limit = opt_time_limit; + } +} + +// attributes only set by a json pools config +void pool_set_attr(int pooln, const char* key, char* arg) +{ + struct pool_infos *p = &pools[pooln]; + if (!strcasecmp(key, "name")) { + snprintf(p->name, sizeof(p->name), "%s", arg); + return; + } + if (!strcasecmp(key, "algo")) { + p->algo = algo_to_int(arg); + return; + } + if (!strcasecmp(key, "scantime")) { + p->scantime = atoi(arg); + return; + } + if (!strcasecmp(key, "max-diff")) { + p->max_diff = atof(arg); + return; + } + if (!strcasecmp(key, "max-rate")) { + p->max_rate = atof(arg); + return; + } + if (!strcasecmp(key, "shares-limit")) { + p->shares_limit = atoi(arg); + return; + } + if (!strcasecmp(key, "time-limit")) { + p->time_limit = atoi(arg); + return; + } + if (!strcasecmp(key, "disabled")) { + int removed = atoi(arg); + if (removed) { + p->status |= POOL_ST_REMOVED; + } + return; + } +} + +// pool switching code +bool pool_switch(int thr_id, int pooln) +{ + int prevn = cur_pooln; + bool algo_switch = false; + struct pool_infos *prev = &pools[cur_pooln]; + struct pool_infos* p = NULL; + + // save prev stratum connection infos (struct) + if (prev->type & POOL_STRATUM) { + // may not be the right moment to free, + // to check if required on submit... + stratum_free_job(&stratum); + prev->stratum = stratum; + } + + if (pooln < num_pools) { + cur_pooln = pooln; + p = &pools[cur_pooln]; + } else { + applog(LOG_ERR, "Switch to inexistant pool %d!", pooln); + return false; + } + + // save global attributes + prev->allow_mininginfo = allow_mininginfo; + prev->allow_gbt = allow_gbt; + prev->check_dups = check_dups; + + pthread_mutex_lock(&stratum_work_lock); + + free(rpc_user); rpc_user = strdup(p->user); + free(rpc_pass); rpc_pass = strdup(p->pass); + free(rpc_url); rpc_url = strdup(p->url); + + short_url = p->short_url; // just a pointer, no alloc + + opt_scantime = p->scantime; + opt_max_diff = p->max_diff; + opt_max_rate = p->max_rate; + opt_shares_limit = p->shares_limit; + opt_time_limit = p->time_limit; + + want_stratum = have_stratum = (p->type & POOL_STRATUM) != 0; + + // yiimp stats reporting + opt_stratum_stats = (strstr(p->pass, "stats") != NULL) || (strcmp(p->user, "benchmark") == 0); + + pthread_mutex_unlock(&stratum_work_lock); + + // algo "blind" switch without free, not proper + // todo: barrier required to free algo resources + if (p->algo != (int) opt_algo) { + + if (opt_algo != ALGO_AUTO) { + + algo_switch = true; + + pthread_mutex_lock(&stats_lock); + for (int n=0; nalgo; + } + + if (prevn != cur_pooln) { + + pool_switch_count++; + net_diff = 0; + g_work_time = 0; + g_work.data[0] = 0; + pool_is_switching = true; + stratum_need_reset = true; + // used to get the pool uptime + firstwork_time = time(NULL); + restart_threads(); + // reset wait states + for (int n=0; nallow_gbt; + allow_mininginfo = p->allow_mininginfo; + check_dups = p->check_dups; + + if (want_stratum) { + + // temporary... until stratum code cleanup + stratum = p->stratum; + stratum.pooln = cur_pooln; + + // unlock the stratum thread + tq_push(thr_info[stratum_thr_id].q, strdup(rpc_url)); + applog(LOG_BLUE, "Switch to stratum pool %d: %s", cur_pooln, + strlen(p->name) ? p->name : p->short_url); + } else { + applog(LOG_BLUE, "Switch to pool %d: %s", cur_pooln, + strlen(p->name) ? p->name : p->short_url); + } + + // will unlock the longpoll thread on /LP url receive + want_longpoll = (p->type & POOL_LONGPOLL) || !(p->type & POOL_STRATUM); + if (want_longpoll) { + pthread_mutex_lock(&stratum_work_lock); + // will issue a lp_url request to unlock the longpoll thread + have_longpoll = false; + get_work(&thr_info[0], &g_work); + pthread_mutex_unlock(&stratum_work_lock); + } + + } + return true; +} + +// search available pool +int pool_get_first_valid(int startfrom) +{ + int next = 0; + struct pool_infos *p; + for (int i=0; istatus & POOL_ST_VALID)) + continue; + if (p->status & (POOL_ST_DISABLED | POOL_ST_REMOVED)) + continue; + next = pooln; + break; + } + return next; +} + +// switch to next available pool +bool pool_switch_next(int thr_id) +{ + if (num_pools > 1) { + int pooln = pool_get_first_valid(cur_pooln+1); + return pool_switch(thr_id, pooln); + } else { + // no switch possible + if (!opt_quiet) + applog(LOG_DEBUG, "No other pools to try..."); + return false; + } +} + +// seturl from api remote (deprecated) +bool pool_switch_url(char *params) +{ + int prevn = cur_pooln, nextn; + parse_arg('o', params); + // cur_pooln modified by parse_arg('o'), get new pool num + nextn = cur_pooln; + // and to handle the "hot swap" from current one... + cur_pooln = prevn; + if (nextn == prevn) + return false; + return pool_switch(-1, nextn); +} + +// Parse pools array in json config +bool parse_pool_array(json_t *obj) +{ + size_t idx; + json_t *p, *val; + + if (!json_is_array(obj)) + return false; + + // array of objects [ {}, {} ] + json_array_foreach(obj, idx, p) + { + if (!json_is_object(p)) + continue; + + for (int i = 0; i < ARRAY_SIZE(cfg_array_keys); i++) + { + int opt = -1; + char *s = NULL; + if (cfg_array_keys[i].cat != CFG_POOL) + continue; + + val = json_object_get(p, cfg_array_keys[i].name); + if (!val) + continue; + + for (int k = 0; k < options_count(); k++) + { + const char *alias = cfg_array_keys[i].longname; + if (alias && !strcasecmp(options[k].name, alias)) { + opt = k; + break; + } + if (!alias && !strcasecmp(options[k].name, cfg_array_keys[i].name)) { + opt = k; + break; + } + } + if (opt == -1) + continue; + + if (json_is_string(val)) { + s = strdup(json_string_value(val)); + if (!s) + continue; + + // applog(LOG_DEBUG, "pool key %s '%s'", options[opt].name, s); + parse_arg(options[opt].val, s); + free(s); + } else { + // numeric or bool + char buf[32] = { 0 }; + double d = 0.; + if (json_is_true(val)) d = 1.; + else if (json_is_integer(val)) + d = 1.0 * json_integer_value(val); + else if (json_is_real(val)) + d = json_real_value(val); + snprintf(buf, sizeof(buf)-1, "%f", d); + // applog(LOG_DEBUG, "pool key %s '%f'", options[opt].name, d); + parse_arg(options[opt].val, buf); + } + } + } + return true; +} + +// debug stuff +void pool_dump_infos() +{ + struct pool_infos *p; + if (opt_benchmark) return; + for (int i=0; ishort_url, p->user, p->scantime); + } +} diff --git a/quark/cuda_bmw512.cu b/quark/cuda_bmw512.cu new file mode 100644 index 0000000..5dbaa1b --- /dev/null +++ b/quark/cuda_bmw512.cu @@ -0,0 +1,651 @@ +/* + Based on SP's BMW kernel + Provos Alexis - 2016 +*/ + +#include +#include + +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#define CONST_EXP3d(i) devectorize(ROL2(q[i+ 1], 5)) + devectorize(ROL2(q[i+ 3],11)) + devectorize(ROL2(q[i+5], 27)) + \ + devectorize(SWAPDWORDS2(q[i+7])) + devectorize(ROL2(q[i+9], 37)) + devectorize(ROL2(q[i+11],43)) + \ + devectorize(ROL2(q[i+13],53)) + devectorize(SHR2(q[i+14],1) ^ q[i+14]) + devectorize(SHR2(q[i+15],2) ^ q[i+15]) + +__device__ __forceinline__ +static void bmw512_round1(uint2* q,uint2* h,const uint64_t* msg){ + const uint2 hash[16] = + { + { 0x84858687, 0x80818283 },{ 0x8C8D8E8F, 0x88898A8B },{ 0x94959697, 0x90919293 },{ 0x9C9D9E9F, 0x98999A9B }, + { 0xA4A5A6A7, 0xA0A1A2A3 },{ 0xACADAEAF, 0xA8A9AAAB },{ 0xB4B5B6B7, 0xB0B1B2B3 },{ 0xBCBDBEBF, 0xB8B9BABB }, + { 0xC4C5C6C7, 0xC0C1C2C3 },{ 0xCCCDCECF, 0xC8C9CACB },{ 0xD4D5D6D7, 0xD0D1D2D3 },{ 0xDCDDDEDF, 0xD8D9DADB }, + { 0xE4E5E6E7, 0xE0E1E2E3 },{ 0xECEDEEEF, 0xE8E9EAEB },{ 0xF4F5F6F7, 0xF0F1F2F3 },{ 0xFCFDFEFF, 0xF8F9FAFB } + }; + + const uint64_t hash2[16] = + { + 0x8081828384858687 ,0x88898A8B8C8D8E8F,0x9091929394959697,0x98999A9B9C9D9E9F, + 0xA0A1A2A3A4A5A6A7 ,0xA8A9AAABACADAEAF,0xB0B1B2B3B4B5B6B7,0xB8B9BABBBCBDBEBF, + 0xC0C1C2C3C4C5C6C7^0x80,0xC8C9CACBCCCDCECF,0xD0D1D2D3D4D5D6D7,0xD8D9DADBDCDDDEDF, + 0xE0E1E2E3E4E5E6E7 ,0xE8E9EAEBECEDEEEF,0xF0F1F2F3F4F5F6F7,0xF8F9FAFBFCFDFEFF + }; + + const uint2 precalcf[9] = + { + { 0x55555550, 0x55555555 },{ 0xAAAAAAA5, 0x5AAAAAAA },{ 0xFFFFFFFA, 0x5FFFFFFF },{ 0x5555554F, 0x65555555 }, + { 0xAAAAAAA4, 0x6AAAAAAA },{ 0xFE00FFF9, 0x6FFFFFFF },{ 0xAAAAAAA1, 0x9AAAAAAA },{ 0xFFFEFFF6, 0x9FFFFFFF },{ 0x5755554B, 0xA5555555 } + }; + + uint2 tmp; + uint64_t mxh[8]; + + mxh[0] = msg[0] ^ hash2[0]; + mxh[1] = msg[1] ^ hash2[1]; + mxh[2] = msg[2] ^ hash2[2]; + mxh[3] = msg[3] ^ hash2[3]; + mxh[4] = msg[4] ^ hash2[4]; + mxh[5] = msg[5] ^ hash2[5]; + mxh[6] = msg[6] ^ hash2[6]; + mxh[7] = msg[7] ^ hash2[7]; + + tmp = vectorize(mxh[5] - mxh[7]) + hash[10] + hash[13] + hash[14]; + q[0] = hash[1] + (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp, 37)); + + tmp = vectorize(mxh[6]) + hash[11] + hash[14] - (hash[15]^512) - (hash[8]^0x80); + q[1] = hash[2] + (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp, 43)); + + tmp = vectorize(mxh[0] + mxh[7]) + hash[9] - hash[12] + (hash[15]^0x200); + q[2] = hash[3] + (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp, 53)); + + q[16] = (SHR2(q[ 0], 1) ^ SHL2(q[ 0], 2) ^ ROL2(q[ 0],13) ^ ROL2(q[ 0],43)) + (SHR2(q[ 1], 2) ^ SHL2(q[ 1], 1) ^ ROL2(q[ 1],19) ^ ROL2(q[ 1],53)); + q[17] = (SHR2(q[ 1], 1) ^ SHL2(q[ 1], 2) ^ ROL2(q[ 1],13) ^ ROL2(q[ 1],43)) + (SHR2(q[ 2], 2) ^ SHL2(q[ 2], 1) ^ ROL2(q[ 2],19) ^ ROL2(q[ 2],53)); + + tmp = vectorize((mxh[0] - mxh[1]) + hash2[8] - hash2[10] + hash2[13]); + q[3] = hash[4] + (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp, 59)); + + tmp = vectorize((mxh[1] + mxh[2]) + hash2[9] - hash2[11] - hash2[14]); + q[4] = hash[5] + (SHR2(tmp, 1) ^ tmp); + + q[16]+=(SHR2(q[ 2], 2) ^ SHL2(q[ 2], 2) ^ ROL2(q[ 2],28) ^ ROL2(q[ 2],59)) + (SHR2(q[ 3], 1) ^ SHL2(q[ 3], 3) ^ ROL2(q[ 3], 4) ^ ROL2(q[ 3],37)); + q[17]+=(SHR2(q[ 3], 2) ^ SHL2(q[ 3], 2) ^ ROL2(q[ 3],28) ^ ROL2(q[ 3],59)) + (SHR2(q[ 4], 1) ^ SHL2(q[ 4], 3) ^ ROL2(q[ 4], 4) ^ ROL2(q[ 4],37)); + + tmp = vectorize((mxh[3] - mxh[2] + hash2[10] - hash2[12] + (512 ^ hash2[15]))); + q[5] = hash[6] + (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp, 37)); + + tmp = vectorize((mxh[4]) - (mxh[0]) - (mxh[3]) + hash2[13] - hash2[11]); + q[6] = hash[7] + (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp, 43)); + + q[16]+=(SHR2(q[ 4], 1) ^ SHL2(q[ 4], 2) ^ ROL2(q[ 4],13) ^ ROL2(q[ 4],43)) + (SHR2(q[ 5], 2) ^ SHL2(q[ 5], 1) ^ ROL2(q[ 5],19) ^ ROL2(q[ 5],53)); + q[17]+=(SHR2(q[ 5], 1) ^ SHL2(q[ 5], 2) ^ ROL2(q[ 5],13) ^ ROL2(q[ 5],43)) + (SHR2(q[ 6], 2) ^ SHL2(q[ 6], 1) ^ ROL2(q[ 6],19) ^ ROL2(q[ 6],53)); + + tmp = vectorize((mxh[1]) - (mxh[4]) - (mxh[5]) - hash2[12] - hash2[14]); + q[7] = hash[8] + (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp, 53)); + + tmp = vectorize((mxh[2]) - (mxh[5]) - (mxh[6]) + hash2[13] - (512 ^ hash2[15])); + q[8] = hash[9] + (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp, 59)); + + q[16]+=(SHR2(q[ 6], 2) ^ SHL2(q[ 6], 2) ^ ROL2(q[ 6],28) ^ ROL2(q[ 6],59)) + (SHR2(q[ 7], 1) ^ SHL2(q[ 7], 3) ^ ROL2(q[ 7], 4) ^ ROL2(q[ 7],37)); + q[17]+=(SHR2(q[ 7], 2) ^ SHL2(q[ 7], 2) ^ ROL2(q[ 7],28) ^ ROL2(q[ 7],59)) + (SHR2(q[ 8], 1) ^ SHL2(q[ 8], 3) ^ ROL2(q[ 8], 4) ^ ROL2(q[ 8],37)); + + tmp = vectorize((mxh[0]) - (mxh[3]) + (mxh[6]) - (mxh[7]) + (hash2[14])); + q[9] = hash[10] + (SHR2(tmp, 1) ^ tmp); + + tmp = vectorize((512 ^ hash2[15]) + hash2[8] - (mxh[1]) - (mxh[4]) - (mxh[7])); + q[10] = hash[11] + (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp, 37)); + + q[16]+=(SHR2(q[ 8], 1) ^ SHL2(q[ 8], 2) ^ ROL2(q[ 8],13) ^ ROL2(q[ 8],43)) + (SHR2(q[ 9], 2) ^ SHL2(q[ 9], 1) ^ ROL2(q[ 9],19) ^ ROL2(q[ 9],53)); + q[17]+=(SHR2(q[ 9], 1) ^ SHL2(q[ 9], 2) ^ ROL2(q[ 9],13) ^ ROL2(q[ 9],43)) + (SHR2(q[10], 2) ^ SHL2(q[10], 1) ^ ROL2(q[10],19) ^ ROL2(q[10],53)); + + tmp = vectorize(hash2[9] + hash2[8] - (mxh[0]) - (mxh[2]) - (mxh[5])); + q[11] = hash[12] + (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp, 43)); + + tmp = vectorize((mxh[1]) + (mxh[3]) - (mxh[6]) + hash2[10] - hash2[9]); + q[12] = hash[13] + (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp, 53)); + + q[16]+=(SHR2(q[10], 2) ^ SHL2(q[10], 2) ^ ROL2(q[10],28) ^ ROL2(q[10],59)) + (SHR2(q[11], 1) ^ SHL2(q[11], 3) ^ ROL2(q[11], 4) ^ ROL2(q[11],37)); + q[17]+=(SHR2(q[11], 2) ^ SHL2(q[11], 2) ^ ROL2(q[11],28) ^ ROL2(q[11],59)) + (SHR2(q[12], 1) ^ SHL2(q[12], 3) ^ ROL2(q[12], 4) ^ ROL2(q[12],37)); + + tmp = vectorize((mxh[2]) + (mxh[4]) + (mxh[7]) + hash2[10] + hash2[11]); + q[13] = hash[14] + (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp, 59)); + + tmp = vectorize((mxh[3]) - (mxh[5]) + hash2[8] - hash2[11] - hash2[12]); + q[14] = hash[15] + (SHR2(tmp, 1) ^ tmp); + + q[16]+=(SHR2(q[12], 1) ^ SHL2(q[12], 2) ^ ROL2(q[12],13) ^ ROL2(q[12],43)) + (SHR2(q[13], 2) ^ SHL2(q[13], 1) ^ ROL2(q[13],19) ^ ROL2(q[13],53)); + q[17]+=(SHR2(q[13], 1) ^ SHL2(q[13], 2) ^ ROL2(q[13],13) ^ ROL2(q[13],43)) + (SHR2(q[14], 2) ^ SHL2(q[14], 1) ^ ROL2(q[14],19) ^ ROL2(q[14],53)); + + tmp = vectorize(hash2[12] - hash2[9] + hash2[13] - (mxh[4]) - (mxh[6])); + q[15] = hash[0] + (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp, 37)); + + q[16]+= (SHR2(q[14], 2) ^ SHL2(q[14], 2) ^ ROL2(q[14],28) ^ ROL2(q[14],59)) + (SHR2(q[15], 1) ^ SHL2(q[15], 3) ^ ROL2(q[15], 4) ^ ROL2(q[15],37)) + + ((precalcf[0] + ROTL64(msg[0], 1) + ROTL64(msg[ 3], 4)) ^ hash[ 7]); + + q[17]+= + (SHR2(q[15], 2) ^ SHL2(q[15], 2) ^ ROL2(q[15],28) ^ ROL2(q[15],59)) + (SHR2(q[16], 1) ^ SHL2(q[16], 3) ^ ROL2(q[16], 4) ^ ROL2(q[16],37)) + + ((precalcf[1] + ROTL64(msg[ 1], 2) + ROTL64(msg[ 4], 5)) ^ hash[ 8]); + + uint64_t add1 = devectorize(q[ 2] + q[ 4] + q[ 6] + q[ 8] + q[10] + q[12] + q[14]); + uint64_t add2 = devectorize(q[ 3] + q[ 5] + q[ 7] + q[ 9] + q[11] + q[13] + q[15]); + + uint2 XL64 = q[16] ^ q[17]; + + q[18] = vectorize(CONST_EXP3d(2) + add1 + devectorize((precalcf[2] + ROTL64(msg[ 2], 3) + ROTL64(msg[ 5], 6)) ^ hash[ 9])); + q[19] = vectorize(CONST_EXP3d(3) + add2 + devectorize((precalcf[3] + ROTL64(msg[ 3], 4) + ROTL64(msg[ 6], 7)) ^ hash[10])); + + add1+= devectorize(q[16] - q[ 2]); + add2+= devectorize(q[17] - q[ 3]); + + XL64= xor3x(XL64,q[18],q[19]); + + q[20] = vectorize(CONST_EXP3d(4) + add1 + devectorize((precalcf[ 4] + ROTL64(msg[ 4], 5) + ROTL64(msg[ 7],8)) ^ hash[11])); + q[21] = vectorize(CONST_EXP3d(5) + add2 + devectorize((precalcf[ 5] + ROTL64(msg[ 5], 6)) ^ hash[5 + 7])); + + add1+= devectorize(q[18] - q[ 4]); + add2+= devectorize(q[19] - q[ 5]); + + XL64= xor3x(XL64,q[20],q[21]); + + q[22] = vectorize(CONST_EXP3d(6) + add1 + devectorize((vectorize((22)*(0x0555555555555555ull)) + ROTL64(msg[ 6], 7) - ROTL64(msg[ 0], 1)) ^ hash[13])); + q[23] = vectorize(CONST_EXP3d(7) + add2 + devectorize((vectorize((23)*(0x0555555555555555ull)) + ROTL64(msg[ 7],8) - ROTL64(msg[ 1], 2)) ^ hash[14])); + + add1+= devectorize(q[20] - q[ 6]); + add2+= devectorize(q[21] - q[ 7]); + + XL64= xor3x(XL64,q[22],q[23]); + + q[24] = vectorize(CONST_EXP3d(8) + add1 + devectorize((vectorize((24)*(0x0555555555555555ull) + 0x10000) - ROTL64(msg[ 2], 3)) ^ hash[15])); + q[25] = vectorize(CONST_EXP3d(9) + add2 + devectorize((vectorize((25)*(0x0555555555555555ull)) - ROTL64(msg[3], 4)) ^ hash[0])); + + add1+= devectorize(q[22] - q[ 8]); + add2+= devectorize(q[23] - q[ 9]); + + uint2 XH64= xor3x(XL64,q[24],q[25]); + + q[26] = vectorize(CONST_EXP3d(10) + add1 + devectorize((vectorize((26)*(0x0555555555555555ull)) - ROTL64(msg[ 4], 5)) ^ hash[ 1])); + q[27] = vectorize(CONST_EXP3d(11) + add2 + devectorize((vectorize((27)*(0x0555555555555555ull)) - ROTL64(msg[ 5], 6)) ^ hash[ 2])); + + add1+= devectorize(q[24] - q[10]); + add2+= devectorize(q[25] - q[11]); + + XH64= xor3x(XH64,q[26],q[27]); + + q[28] = vectorize(CONST_EXP3d(12) + add1 + devectorize((vectorize(0x955555555755554C) - ROTL64(msg[ 6], 7)) ^ hash[3])); + q[29] = vectorize(CONST_EXP3d(13) + add2 + devectorize((precalcf[6] + ROTL64(msg[ 0], 1) - ROTL64(msg[ 7],8)) ^ hash[ 4])); + + add1+= devectorize(q[26] - q[12]); + add2+= devectorize(q[27] - q[13]); + + XH64= xor3x(XH64,q[28],q[29]); + + q[30] = vectorize(CONST_EXP3d(14) + add1 + devectorize((precalcf[ 7] + ROTL64(msg[ 1], 2)) ^ hash[ 5])); + q[31] = vectorize(CONST_EXP3d(15) + add2 + devectorize((precalcf[ 8] + ROTL64(msg[ 2], 3)) ^ hash[ 6])); + + XH64= xor3x(XH64,q[30],q[31]); + + h[0] = (SHL2(XH64, 5) ^ SHR2(q[16], 5) ^ vectorize(msg[0])) + (XL64 ^ q[24] ^ q[0]); + h[1] = (SHR2(XH64, 7) ^ SHL8(q[17]) ^ vectorize(msg[1])) + (XL64 ^ q[25] ^ q[1]); + h[2] = (SHR2(XH64, 5) ^ SHL2(q[18], 5) ^ vectorize(msg[2])) + (XL64 ^ q[26] ^ q[2]); + h[3] = (SHR2(XH64, 1) ^ SHL2(q[19], 5) ^ vectorize(msg[3])) + (XL64 ^ q[27] ^ q[3]); + h[4] = (SHR2(XH64, 3) ^ q[20] ^ vectorize(msg[4])) + (XL64 ^ q[28] ^ q[4]); + h[5] = (SHL2(XH64, 6) ^ SHR2(q[21], 6) ^ vectorize(msg[5])) + (XL64 ^ q[29] ^ q[5]); + h[6] = (SHR2(XH64, 4) ^ SHL2(q[22], 6) ^ vectorize(msg[6])) + (XL64 ^ q[30] ^ q[6]); + h[7] = (SHR2(XH64,11) ^ SHL2(q[23], 2) ^ vectorize(msg[7])) + (XL64 ^ q[31] ^ q[7]); + + h[ 8] = (ROL2(h[ 4], 9)) + (XH64 ^ q[24] ^ 0x80) + (SHL8(XL64) ^ q[23] ^ q[ 8]); + h[ 9] = (ROL2(h[ 5],10)) + (XH64 ^ q[25]) + (SHR2(XL64, 6) ^ q[16] ^ q[ 9]); + h[10] = (ROL2(h[ 6],11)) + (XH64 ^ q[26]) + (SHL2(XL64, 6) ^ q[17] ^ q[10]); + h[11] = (ROL2(h[ 7],12)) + (XH64 ^ q[27]) + (SHL2(XL64, 4) ^ q[18] ^ q[11]); + h[12] = (ROL2(h[ 0],13)) + (XH64 ^ q[28]) + (SHR2(XL64, 3) ^ q[19] ^ q[12]); + h[13] = (ROL2(h[ 1],14)) + (XH64 ^ q[29]) + (SHR2(XL64, 4) ^ q[20] ^ q[13]); + h[14] = (ROL2(h[ 2],15)) + (XH64 ^ q[30]) + (SHR2(XL64, 7) ^ q[21] ^ q[14]); + h[15] = (ROL16(h[ 3])) + (XH64 ^ q[31] ^ 512) + (SHR2(XL64, 2) ^ q[22] ^ q[15]); +} + +__global__ __launch_bounds__(32,8) +void quark_bmw512_gpu_hash_64(uint32_t threads, uint64_t *const __restrict__ g_hash, const uint32_t *const __restrict__ g_nonceVector){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads){ + + const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : g_nonceVector[thread]; + + uint64_t *inpHash = &g_hash[8 * hashPosition]; + + uint64_t msg[16]; + uint2 h[16]; + + uint2x4* phash = (uint2x4*)inpHash; + uint2x4* outpt = (uint2x4*)msg; + outpt[0] = __ldg4(&phash[0]); + outpt[1] = __ldg4(&phash[1]); + + uint2 q[32]; + + bmw512_round1(q,h,msg); + + const uint2 cmsg[16] ={ + 0xaaaaaaa0, 0xaaaaaaaa, 0xaaaaaaa1, 0xaaaaaaaa, 0xaaaaaaa2, 0xaaaaaaaa, 0xaaaaaaa3, 0xaaaaaaaa, + 0xaaaaaaa4, 0xaaaaaaaa, 0xaaaaaaa5, 0xaaaaaaaa, 0xaaaaaaa6, 0xaaaaaaaa, 0xaaaaaaa7, 0xaaaaaaaa, + 0xaaaaaaa8, 0xaaaaaaaa, 0xaaaaaaa9, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaab, 0xaaaaaaaa, + 0xaaaaaaac, 0xaaaaaaaa, 0xaaaaaaad, 0xaaaaaaaa, 0xaaaaaaae, 0xaaaaaaaa, 0xaaaaaaaf, 0xaaaaaaaa + }; + + #pragma unroll 16 + for (int i = 0; i < 16; i++) + msg[i] = devectorize(cmsg[i] ^ h[i]); + + const uint2 precalc[16] = { + { 0x55555550, 0x55555555 },{ 0xAAAAAAA5, 0x5AAAAAAA },{ 0xFFFFFFFA, 0x5FFFFFFF },{ 0x5555554F, 0x65555555 }, + { 0xAAAAAAA4, 0x6AAAAAAA },{ 0xFFFFFFF9, 0x6FFFFFFF },{ 0x5555554E, 0x75555555 },{ 0xAAAAAAA3, 0x7AAAAAAA }, + { 0xFFFFFFF8, 0x7FFFFFFF },{ 0x5555554D, 0x85555555 },{ 0xAAAAAAA2, 0x8AAAAAAA },{ 0xFFFFFFF7, 0x8FFFFFFF }, + { 0x5555554C, 0x95555555 },{ 0xAAAAAAA1, 0x9AAAAAAA },{ 0xFFFFFFF6, 0x9FFFFFFF },{ 0x5555554B, 0xA5555555 } + }; + + const uint64_t p2 = msg[15] - msg[12]; + const uint64_t p3 = msg[14] - msg[7]; + const uint64_t p4 = msg[6] + msg[9]; + const uint64_t p5 = msg[8] - msg[5]; + const uint64_t p6 = msg[1] - msg[14]; + const uint64_t p7 = msg[8] - msg[1]; + const uint64_t p8 = msg[3] + msg[10]; + + + uint2 tmp = vectorize((msg[5]) + (msg[10]) + (msg[13]) + p3); + q[0] = (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp,37)) + cmsg[ 1]; + + tmp = vectorize((msg[6]) - (msg[8]) + (msg[11]) + (msg[14]) - (msg[15])); + q[1] = (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp,43)) + cmsg[ 2]; + + tmp = vectorize((msg[0]) + (msg[7]) + (msg[9]) + p2); + q[2] = (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp,53)) + cmsg[ 3]; + + tmp = vectorize((msg[0]) + p7 - (msg[10]) + (msg[13])); + q[3] = (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp,59)) + cmsg[ 4]; + + tmp = vectorize((msg[2]) + (msg[9]) - (msg[11]) + p6); + q[4] = (SHR2(tmp, 1) ^ tmp) + cmsg[5]; + + tmp = vectorize(p8 + p2 - (msg[2])); + q[5] = (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp,37)) + cmsg[ 6]; + + tmp = vectorize((msg[4]) - (msg[0]) - (msg[3]) - (msg[11]) + (msg[13])); + q[6] = (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp,43)) + cmsg[ 7]; + + tmp = vectorize(p6 - (msg[4]) - (msg[5]) - (msg[12])); + q[7] = (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp,53)) + cmsg[ 8]; + + tmp = vectorize((msg[2]) - (msg[5]) - (msg[6]) + (msg[13]) - (msg[15])); + q[8] = (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp,59)) + cmsg[ 9]; + + tmp = vectorize((msg[0]) - (msg[3]) + (msg[6]) + p3); + q[9] = (SHR2(tmp, 1) ^ tmp) + cmsg[10]; + + tmp = vectorize(p7 - (msg[4]) - (msg[7]) + (msg[15])); + q[10] = (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp,37)) + cmsg[11]; + + tmp = vectorize(p5 - (msg[0]) - (msg[2]) + (msg[9])); + q[11] = (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp,43)) + cmsg[12]; + + tmp = vectorize(p8 + msg[1] - p4); + q[12] = (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp,53)) + cmsg[13]; + + tmp = vectorize((msg[2]) + (msg[4]) + (msg[7]) + (msg[10]) + (msg[11])); + q[13] = (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp,59)) + cmsg[14]; + + tmp = vectorize((msg[3]) + p5 - (msg[11]) - (msg[12])); + q[14] = (SHR2(tmp, 1) ^ tmp) + cmsg[15]; + + tmp = vectorize((msg[12]) - (msg[4]) - p4 + (msg[13])); + q[15] = (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp,37)) + cmsg[0]; + + q[16] = + vectorize(devectorize(SHR2(q[ 0], 1) ^ SHL2(q[ 0], 2) ^ ROL2(q[ 0],13) ^ ROL2(q[ 0],43)) + devectorize(SHR2(q[ 1], 2) ^ SHL2(q[ 1], 1) ^ ROL2(q[ 1],19) ^ ROL2(q[ 1],53)) + + devectorize(SHR2(q[ 2], 2) ^ SHL2(q[ 2], 2) ^ ROL2(q[ 2],28) ^ ROL2(q[ 2],59)) + devectorize(SHR2(q[ 3], 1) ^ SHL2(q[ 3], 3) ^ ROL2(q[ 3], 4) ^ ROL2(q[ 3],37)) + + devectorize(SHR2(q[ 4], 1) ^ SHL2(q[ 4], 2) ^ ROL2(q[ 4],13) ^ ROL2(q[ 4],43)) + devectorize(SHR2(q[ 5], 2) ^ SHL2(q[ 5], 1) ^ ROL2(q[ 5],19) ^ ROL2(q[ 5],53)) + + devectorize(SHR2(q[ 6], 2) ^ SHL2(q[ 6], 2) ^ ROL2(q[ 6],28) ^ ROL2(q[ 6],59)) + devectorize(SHR2(q[ 7], 1) ^ SHL2(q[ 7], 3) ^ ROL2(q[ 7], 4) ^ ROL2(q[ 7],37)) + + devectorize(SHR2(q[ 8], 1) ^ SHL2(q[ 8], 2) ^ ROL2(q[ 8],13) ^ ROL2(q[ 8],43)) + devectorize(SHR2(q[ 9], 2) ^ SHL2(q[ 9], 1) ^ ROL2(q[ 9],19) ^ ROL2(q[ 9],53)) + + devectorize(SHR2(q[10], 2) ^ SHL2(q[10], 2) ^ ROL2(q[10],28) ^ ROL2(q[10],59)) + devectorize(SHR2(q[11], 1) ^ SHL2(q[11], 3) ^ ROL2(q[11], 4) ^ ROL2(q[11],37)) + + devectorize(SHR2(q[12], 1) ^ SHL2(q[12], 2) ^ ROL2(q[12],13) ^ ROL2(q[12],43)) + devectorize(SHR2(q[13], 2) ^ SHL2(q[13], 1) ^ ROL2(q[13],19) ^ ROL2(q[13],53)) + + devectorize(SHR2(q[14], 2) ^ SHL2(q[14], 2) ^ ROL2(q[14],28) ^ ROL2(q[14],59)) + devectorize(SHR2(q[15], 1) ^ SHL2(q[15], 3) ^ ROL2(q[15], 4) ^ ROL2(q[15],37)) + + devectorize((precalc[0] + ROL2(h[0], 1) + ROL2(h[ 3], 4) - ROL2(h[10],11)) ^ cmsg[ 7])); + q[17] = + vectorize(devectorize(SHR2(q[ 1], 1) ^ SHL2(q[ 1], 2) ^ ROL2(q[ 1],13) ^ ROL2(q[ 1],43)) + devectorize(SHR2(q[ 2], 2) ^ SHL2(q[ 2], 1) ^ ROL2(q[ 2],19) ^ ROL2(q[ 2],53)) + + devectorize(SHR2(q[ 3], 2) ^ SHL2(q[ 3], 2) ^ ROL2(q[ 3],28) ^ ROL2(q[ 3],59)) + devectorize(SHR2(q[ 4], 1) ^ SHL2(q[ 4], 3) ^ ROL2(q[ 4], 4) ^ ROL2(q[ 4],37)) + + devectorize(SHR2(q[ 5], 1) ^ SHL2(q[ 5], 2) ^ ROL2(q[ 5],13) ^ ROL2(q[ 5],43)) + devectorize(SHR2(q[ 6], 2) ^ SHL2(q[ 6], 1) ^ ROL2(q[ 6],19) ^ ROL2(q[ 6],53)) + + devectorize(SHR2(q[ 7], 2) ^ SHL2(q[ 7], 2) ^ ROL2(q[ 7],28) ^ ROL2(q[ 7],59)) + devectorize(SHR2(q[ 8], 1) ^ SHL2(q[ 8], 3) ^ ROL2(q[ 8], 4) ^ ROL2(q[ 8],37)) + + devectorize(SHR2(q[ 9], 1) ^ SHL2(q[ 9], 2) ^ ROL2(q[ 9],13) ^ ROL2(q[ 9],43)) + devectorize(SHR2(q[10], 2) ^ SHL2(q[10], 1) ^ ROL2(q[10],19) ^ ROL2(q[10],53)) + + devectorize(SHR2(q[11], 2) ^ SHL2(q[11], 2) ^ ROL2(q[11],28) ^ ROL2(q[11],59)) + devectorize(SHR2(q[12], 1) ^ SHL2(q[12], 3) ^ ROL2(q[12], 4) ^ ROL2(q[12],37)) + + devectorize(SHR2(q[13], 1) ^ SHL2(q[13], 2) ^ ROL2(q[13],13) ^ ROL2(q[13],43)) + devectorize(SHR2(q[14], 2) ^ SHL2(q[14], 1) ^ ROL2(q[14],19) ^ ROL2(q[14],53)) + + devectorize(SHR2(q[15], 2) ^ SHL2(q[15], 2) ^ ROL2(q[15],28) ^ ROL2(q[15],59)) + devectorize(SHR2(q[16], 1) ^ SHL2(q[16], 3) ^ ROL2(q[16], 4) ^ ROL2(q[16],37)) + + devectorize((precalc[1] + ROL2(h[ 1], 2) + ROL2(h[ 4], 5) - ROL2(h[11],12)) ^ cmsg[ 8])); + + uint64_t add1 = devectorize(q[ 2] + q[ 4] + q[ 6] + q[ 8] + q[10] + q[12] + q[14]); + uint64_t add2 = devectorize(q[ 3] + q[ 5] + q[ 7] + q[ 9] + q[11] + q[13] + q[15]); + + uint2 XL64 = q[16] ^ q[17]; + + q[18] = vectorize(add1 + CONST_EXP3d(2) + devectorize((precalc[2] + ROL2(h[2], 3) + ROL2(h[ 5], 6) - ROL2(h[12],13)) ^ cmsg[ 9])); + q[19] = vectorize(add2 + CONST_EXP3d(3) + devectorize((precalc[3] + ROL2(h[3], 4) + ROL2(h[ 6], 7) - ROL2(h[13],14)) ^ cmsg[10])); + + add1 = add1 - devectorize(q[ 2] - q[16]); + add2 = add2 - devectorize(q[ 3] - q[17]); + + XL64 = xor3x(XL64,q[18],q[19]); + + q[20] = vectorize(add1 + CONST_EXP3d(4) + devectorize((precalc[4] + ROL2(h[4], 5) + ROL8(h[ 7]) - ROL2(h[14],15)) ^ cmsg[11])); + q[21] = vectorize(add2 + CONST_EXP3d(5) + devectorize((precalc[5] + ROL2(h[5], 6) + ROL2(h[ 8], 9) - ROL16(h[15])) ^ cmsg[12])); + + add1 = add1 - devectorize(q[ 4] - q[18]); + add2 = add2 - devectorize(q[ 5] -q[19]); + + XL64 = xor3x(XL64,q[20],q[21]); + + q[22] = vectorize(add1 + CONST_EXP3d(6) + devectorize((precalc[6] + ROL2(h[ 6], 7) + ROL2(h[ 9],10) - ROL2(h[ 0], 1)) ^ cmsg[13])); + q[23] = vectorize(add2 + CONST_EXP3d(7) + devectorize((precalc[7] + ROL8(h[ 7]) + ROL2(h[10],11) - ROL2(h[ 1], 2)) ^ cmsg[14])); + + add1 -= devectorize(q[ 6] - q[20]); + add2 -= devectorize(q[ 7] - q[21]); + + XL64 = xor3x(XL64,q[22],q[23]); + + q[24] = vectorize(add1 + CONST_EXP3d(8) + devectorize((precalc[8] + ROL2(h[8], 9) + ROL2(h[11],12) - ROL2(h[ 2], 3)) ^ cmsg[15])); + q[25] = vectorize(add2 + CONST_EXP3d(9) + devectorize((precalc[9] + ROL2(h[9],10) + ROL2(h[12],13) - ROL2(h[ 3], 4)) ^ cmsg[ 0])); + + add1 -= devectorize(q[ 8] - q[22]); + add2 -= devectorize(q[ 9] - q[23]); + + uint2 XH64 = xor3x(XL64,q[24],q[25]); + + q[26] = vectorize(add1 + CONST_EXP3d(10) + devectorize((precalc[10] + ROL2(h[10],11) + ROL2(h[13],14) - ROL2(h[ 4], 5)) ^ cmsg[ 1])); + q[27] = vectorize(add2 + CONST_EXP3d(11) + devectorize((precalc[11] + ROL2(h[11],12) + ROL2(h[14],15) - ROL2(h[ 5], 6)) ^ cmsg[ 2])); + + add1 -= devectorize(q[10] - q[24]); + add2 -= devectorize(q[11] - q[25]); + + XH64 = xor3x(XH64,q[26],q[27]); + + q[28] = vectorize(add1 + CONST_EXP3d(12) + devectorize((precalc[12] + ROL2(h[12], 13) + ROL16(h[15]) - ROL2(h[ 6], 7)) ^ cmsg[ 3])); + q[29] = vectorize(add2 + CONST_EXP3d(13) + devectorize((precalc[13] + ROL2(h[13], 14) + ROL2(h[ 0], 1)- ROL8(h[ 7])) ^ cmsg[ 4])); + + add1 -= devectorize(q[12] - q[26]); + add2 -= devectorize(q[13] - q[27]); + + XH64 = xor3x(XH64,q[28],q[29]); + + q[30] = vectorize(add1 + CONST_EXP3d(14) + devectorize((precalc[14] + ROL2(h[14],15) + ROL2(h[ 1], 2) - ROL2(h[ 8], 9)) ^ cmsg[ 5])); + q[31] = vectorize(add2 + CONST_EXP3d(15) + devectorize((precalc[15] + ROL16(h[15]) + ROL2(h[ 2], 3) - ROL2(h[ 9],10)) ^ cmsg[ 6])); + + XH64 = xor3x(XH64,q[30],q[31]); + + msg[0] = devectorize((SHL2(XH64, 5) ^ SHR2(q[16], 5) ^ h[ 0]) + (XL64 ^ q[24] ^ q[ 0])); + msg[1] = devectorize((SHR2(XH64, 7) ^ SHL8(q[17]) ^ h[ 1]) + (XL64 ^ q[25] ^ q[ 1])); + msg[2] = devectorize((SHR2(XH64, 5) ^ SHL2(q[18], 5) ^ h[ 2]) + (XL64 ^ q[26] ^ q[ 2])); + msg[3] = devectorize((SHR2(XH64, 1) ^ SHL2(q[19], 5) ^ h[ 3]) + (XL64 ^ q[27] ^ q[ 3])); + msg[4] = devectorize((SHR2(XH64, 3) ^ q[20] ^ h[4]) + (XL64 ^ q[28] ^ q[ 4])); + msg[5] = devectorize((SHL2(XH64, 6) ^ SHR2(q[21], 6) ^ h[ 5]) + (XL64 ^ q[29] ^ q[ 5])); + msg[6] = devectorize((SHR2(XH64, 4) ^ SHL2(q[22], 6) ^ h[ 6]) + (XL64 ^ q[30] ^ q[ 6])); + msg[7] = devectorize((SHR2(XH64,11) ^ SHL2(q[23], 2) ^ h[ 7]) + (XL64 ^ q[31] ^ q[ 7])); + msg[8] = devectorize((XH64 ^ q[24] ^ h[8]) + (SHL8(XL64) ^ q[23] ^ q[8]) + ROTL64(msg[4], 9)); + + msg[ 9] = devectorize((XH64 ^ q[25] ^ h[ 9]) + (SHR2(XL64, 6) ^ q[16] ^ q[9]) + ROTL64(msg[ 5],10)); + msg[10] = devectorize((XH64 ^ q[26] ^ h[10]) + (SHL2(XL64, 6) ^ q[17] ^ q[10]) + ROTL64(msg[ 6],11)); + msg[11] = devectorize((XH64 ^ q[27] ^ h[11]) + (SHL2(XL64, 4) ^ q[18] ^ q[11]) + ROTL64(msg[ 7],12)); + + #if __CUDA_ARCH__ > 500 + *(uint2x4*)&inpHash[0] = *(uint2x4*)&msg[8]; + #endif + + msg[12] = devectorize((XH64 ^ q[28] ^ h[12]) + (SHR2(XL64, 3) ^ q[19] ^ q[12]) + ROTL64(msg[ 0],13)); + msg[13] = devectorize((XH64 ^ q[29] ^ h[13]) + (SHR2(XL64, 4) ^ q[20] ^ q[13]) + ROTL64(msg[ 1],14)); + msg[14] = devectorize((XH64 ^ q[30] ^ h[14]) + (SHR2(XL64, 7) ^ q[21] ^ q[14]) + ROTL64(msg[ 2],15)); + msg[15] = devectorize((XH64 ^ q[31] ^ h[15]) + (SHR2(XL64, 2) ^ q[22] ^ q[15]) + ROTL64(msg[ 3],16)); + + #if __CUDA_ARCH__ > 500 + *(uint2x4*)&inpHash[4] = *(uint2x4*)&msg[12]; + #else + *(uint2x4*)&inpHash[0] = *(uint2x4*)&msg[8]; + *(uint2x4*)&inpHash[4] = *(uint2x4*)&msg[12]; + #endif + } +} + +__global__ __launch_bounds__(32,8) +void quark_bmw512_gpu_hash_64_quark(const uint32_t threads, uint64_t *const __restrict__ g_hash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + uint2 *inpHash = (uint2*)&g_hash[thread<<3]; + + uint64_t msg[16]; + uint2 h[16]; + + uint2x4* phash = (uint2x4*)inpHash; + uint2x4* outpt = (uint2x4*)msg; + outpt[0] = __ldg4(&phash[0]); + outpt[1] = __ldg4(&phash[1]); + + uint2 q[32]; + + bmw512_round1(q,h,msg); + + const uint2 cmsg[16] = { + 0xaaaaaaa0, 0xaaaaaaaa, 0xaaaaaaa1, 0xaaaaaaaa, 0xaaaaaaa2, 0xaaaaaaaa, 0xaaaaaaa3, 0xaaaaaaaa, + 0xaaaaaaa4, 0xaaaaaaaa, 0xaaaaaaa5, 0xaaaaaaaa, 0xaaaaaaa6, 0xaaaaaaaa, 0xaaaaaaa7, 0xaaaaaaaa, + 0xaaaaaaa8, 0xaaaaaaaa, 0xaaaaaaa9, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaab, 0xaaaaaaaa, + 0xaaaaaaac, 0xaaaaaaaa, 0xaaaaaaad, 0xaaaaaaaa, 0xaaaaaaae, 0xaaaaaaaa, 0xaaaaaaaf, 0xaaaaaaaa + }; + + #pragma unroll 16 + for (int i = 0; i < 16; i++) { + msg[i] = devectorize(cmsg[i] ^ h[i]); + } + + const uint2 precalc[16] = { + { 0x55555550, 0x55555555 },{ 0xAAAAAAA5, 0x5AAAAAAA },{ 0xFFFFFFFA, 0x5FFFFFFF },{ 0x5555554F, 0x65555555 }, + { 0xAAAAAAA4, 0x6AAAAAAA },{ 0xFFFFFFF9, 0x6FFFFFFF },{ 0x5555554E, 0x75555555 },{ 0xAAAAAAA3, 0x7AAAAAAA }, + { 0xFFFFFFF8, 0x7FFFFFFF },{ 0x5555554D, 0x85555555 },{ 0xAAAAAAA2, 0x8AAAAAAA },{ 0xFFFFFFF7, 0x8FFFFFFF }, + { 0x5555554C, 0x95555555 },{ 0xAAAAAAA1, 0x9AAAAAAA },{ 0xFFFFFFF6, 0x9FFFFFFF },{ 0x5555554B, 0xA5555555 }, + }; + + const uint64_t p2 = msg[15] - msg[12]; + const uint64_t p3 = msg[14] - msg[7]; + const uint64_t p4 = msg[6] + msg[9]; + const uint64_t p5 = msg[8] - msg[5]; + const uint64_t p6 = msg[1] - msg[14]; + const uint64_t p7 = msg[8] - msg[1]; + const uint64_t p8 = msg[3] + msg[10]; + + + uint2 tmp = vectorize((msg[5]) + (msg[10]) + (msg[13]) + p3); + q[0] = (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp,37)) + cmsg[ 1]; + + tmp = vectorize((msg[6]) - (msg[8]) + (msg[11]) + (msg[14]) - (msg[15])); + q[1] = (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp,43)) + cmsg[ 2]; + + tmp = vectorize((msg[0]) + (msg[7]) + (msg[9]) + p2); + q[2] = (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp,53)) + cmsg[ 3]; + + tmp = vectorize((msg[0]) + p7 - (msg[10]) + (msg[13])); + q[3] = (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp,59)) + cmsg[ 4]; + + tmp = vectorize((msg[2]) + (msg[9]) - (msg[11]) + p6); + q[4] = (SHR2(tmp, 1) ^ tmp) + cmsg[5]; + + tmp = vectorize(p8 + p2 - (msg[2])); + q[5] = (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp,37)) + cmsg[ 6]; + + tmp = vectorize((msg[4]) - (msg[0]) - (msg[3]) - (msg[11]) + (msg[13])); + q[6] = (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp,43)) + cmsg[ 7]; + + tmp = vectorize(p6 - (msg[4]) - (msg[5]) - (msg[12])); + q[7] = (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp,53)) + cmsg[ 8]; + + tmp = vectorize((msg[2]) - (msg[5]) - (msg[6]) + (msg[13]) - (msg[15])); + q[8] = (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp,59)) + cmsg[ 9]; + + tmp = vectorize((msg[0]) - (msg[3]) + (msg[6]) + p3); + q[9] = (SHR2(tmp, 1) ^ tmp) + cmsg[10]; + + tmp = vectorize(p7 - (msg[4]) - (msg[7]) + (msg[15])); + q[10] = (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp,37)) + cmsg[11]; + + tmp = vectorize(p5 - (msg[0]) - (msg[2]) + (msg[9])); + q[11] = (SHR2(tmp, 1) ^ SHL2(tmp, 2) ^ ROL2(tmp, 13) ^ ROL2(tmp,43)) + cmsg[12]; + + tmp = vectorize(p8 + msg[1] - p4); + q[12] = (SHR2(tmp, 2) ^ SHL2(tmp, 1) ^ ROL2(tmp, 19) ^ ROL2(tmp,53)) + cmsg[13]; + + tmp = vectorize((msg[2]) + (msg[4]) + (msg[7]) + (msg[10]) + (msg[11])); + q[13] = (SHR2(tmp, 2) ^ SHL2(tmp, 2) ^ ROL2(tmp, 28) ^ ROL2(tmp,59)) + cmsg[14]; + + tmp = vectorize((msg[3]) + p5 - (msg[11]) - (msg[12])); + q[14] = (SHR2(tmp, 1) ^ tmp) + cmsg[15]; + + tmp = vectorize((msg[12]) - (msg[4]) - p4 + (msg[13])); + q[15] = (SHR2(tmp, 1) ^ SHL2(tmp, 3) ^ ROL2(tmp, 4) ^ ROL2(tmp,37)) + cmsg[0]; + + q[16] = + vectorize(devectorize(SHR2(q[ 0], 1) ^ SHL2(q[ 0], 2) ^ ROL2(q[ 0],13) ^ ROL2(q[ 0],43)) + devectorize(SHR2(q[ 1], 2) ^ SHL2(q[ 1], 1) ^ ROL2(q[ 1],19) ^ ROL2(q[ 1],53)) + + devectorize(SHR2(q[ 2], 2) ^ SHL2(q[ 2], 2) ^ ROL2(q[ 2],28) ^ ROL2(q[ 2],59)) + devectorize(SHR2(q[ 3], 1) ^ SHL2(q[ 3], 3) ^ ROL2(q[ 3], 4) ^ ROL2(q[ 3],37)) + + devectorize(SHR2(q[ 4], 1) ^ SHL2(q[ 4], 2) ^ ROL2(q[ 4],13) ^ ROL2(q[ 4],43)) + devectorize(SHR2(q[ 5], 2) ^ SHL2(q[ 5], 1) ^ ROL2(q[ 5],19) ^ ROL2(q[ 5],53)) + + devectorize(SHR2(q[ 6], 2) ^ SHL2(q[ 6], 2) ^ ROL2(q[ 6],28) ^ ROL2(q[ 6],59)) + devectorize(SHR2(q[ 7], 1) ^ SHL2(q[ 7], 3) ^ ROL2(q[ 7], 4) ^ ROL2(q[ 7],37)) + + devectorize(SHR2(q[ 8], 1) ^ SHL2(q[ 8], 2) ^ ROL2(q[ 8],13) ^ ROL2(q[ 8],43)) + devectorize(SHR2(q[ 9], 2) ^ SHL2(q[ 9], 1) ^ ROL2(q[ 9],19) ^ ROL2(q[ 9],53)) + + devectorize(SHR2(q[10], 2) ^ SHL2(q[10], 2) ^ ROL2(q[10],28) ^ ROL2(q[10],59)) + devectorize(SHR2(q[11], 1) ^ SHL2(q[11], 3) ^ ROL2(q[11], 4) ^ ROL2(q[11],37)) + + devectorize(SHR2(q[12], 1) ^ SHL2(q[12], 2) ^ ROL2(q[12],13) ^ ROL2(q[12],43)) + devectorize(SHR2(q[13], 2) ^ SHL2(q[13], 1) ^ ROL2(q[13],19) ^ ROL2(q[13],53)) + + devectorize(SHR2(q[14], 2) ^ SHL2(q[14], 2) ^ ROL2(q[14],28) ^ ROL2(q[14],59)) + devectorize(SHR2(q[15], 1) ^ SHL2(q[15], 3) ^ ROL2(q[15], 4) ^ ROL2(q[15],37)) + + devectorize((precalc[0] + ROL2(h[0], 1) + ROL2(h[ 3], 4) - ROL2(h[10],11)) ^ cmsg[ 7])); + q[17] = + vectorize(devectorize(SHR2(q[ 1], 1) ^ SHL2(q[ 1], 2) ^ ROL2(q[ 1],13) ^ ROL2(q[ 1],43)) + devectorize(SHR2(q[ 2], 2) ^ SHL2(q[ 2], 1) ^ ROL2(q[ 2],19) ^ ROL2(q[ 2],53)) + + devectorize(SHR2(q[ 3], 2) ^ SHL2(q[ 3], 2) ^ ROL2(q[ 3],28) ^ ROL2(q[ 3],59)) + devectorize(SHR2(q[ 4], 1) ^ SHL2(q[ 4], 3) ^ ROL2(q[ 4], 4) ^ ROL2(q[ 4],37)) + + devectorize(SHR2(q[ 5], 1) ^ SHL2(q[ 5], 2) ^ ROL2(q[ 5],13) ^ ROL2(q[ 5],43)) + devectorize(SHR2(q[ 6], 2) ^ SHL2(q[ 6], 1) ^ ROL2(q[ 6],19) ^ ROL2(q[ 6],53)) + + devectorize(SHR2(q[ 7], 2) ^ SHL2(q[ 7], 2) ^ ROL2(q[ 7],28) ^ ROL2(q[ 7],59)) + devectorize(SHR2(q[ 8], 1) ^ SHL2(q[ 8], 3) ^ ROL2(q[ 8], 4) ^ ROL2(q[ 8],37)) + + devectorize(SHR2(q[ 9], 1) ^ SHL2(q[ 9], 2) ^ ROL2(q[ 9],13) ^ ROL2(q[ 9],43)) + devectorize(SHR2(q[10], 2) ^ SHL2(q[10], 1) ^ ROL2(q[10],19) ^ ROL2(q[10],53)) + + devectorize(SHR2(q[11], 2) ^ SHL2(q[11], 2) ^ ROL2(q[11],28) ^ ROL2(q[11],59)) + devectorize(SHR2(q[12], 1) ^ SHL2(q[12], 3) ^ ROL2(q[12], 4) ^ ROL2(q[12],37)) + + devectorize(SHR2(q[13], 1) ^ SHL2(q[13], 2) ^ ROL2(q[13],13) ^ ROL2(q[13],43)) + devectorize(SHR2(q[14], 2) ^ SHL2(q[14], 1) ^ ROL2(q[14],19) ^ ROL2(q[14],53)) + + devectorize(SHR2(q[15], 2) ^ SHL2(q[15], 2) ^ ROL2(q[15],28) ^ ROL2(q[15],59)) + devectorize(SHR2(q[16], 1) ^ SHL2(q[16], 3) ^ ROL2(q[16], 4) ^ ROL2(q[16],37)) + + devectorize((precalc[1] + ROL2(h[ 1], 2) + ROL2(h[ 4], 5) - ROL2(h[11],12)) ^ cmsg[ 8])); + + uint64_t add1 = devectorize(q[ 2] + q[ 4] + q[ 6] + q[ 8] + q[10] + q[12] + q[14]); + uint64_t add2 = devectorize(q[ 3] + q[ 5] + q[ 7] + q[ 9] + q[11] + q[13] + q[15]); + + uint2 XL64 = q[16] ^ q[17]; + + q[18] = vectorize(add1 + CONST_EXP3d(2) + devectorize((precalc[2] + ROL2(h[2], 3) + ROL2(h[ 5], 6) - ROL2(h[12],13)) ^ cmsg[ 9])); + q[19] = vectorize(add2 + CONST_EXP3d(3) + devectorize((precalc[3] + ROL2(h[3], 4) + ROL2(h[ 6], 7) - ROL2(h[13],14)) ^ cmsg[10])); + + add1+= devectorize(q[16] - q[ 2]); + add2+= devectorize(q[17] - q[ 3]); + + XL64 = xor3x(XL64, q[18], q[19]); + + q[20] = vectorize(add1 + CONST_EXP3d(4) + devectorize((precalc[4] + ROL2(h[4], 5) + ROL8(h[ 7]) - ROL2(h[14],15)) ^ cmsg[11])); + q[21] = vectorize(add2 + CONST_EXP3d(5) + devectorize((precalc[5] + ROL2(h[5], 6) + ROL2(h[ 8], 9) - ROL16(h[15])) ^ cmsg[12])); + + add1+= devectorize(q[18] - q[ 4]); + add2+= devectorize(q[19] - q[ 5]); + + XL64 = xor3x(XL64, q[20], q[21]); + + q[22] = vectorize(add1 + CONST_EXP3d(6) + devectorize((precalc[6] + ROL2(h[ 6], 7) + ROL2(h[ 9],10) - ROL2(h[ 0], 1)) ^ cmsg[13])); + q[23] = vectorize(add2 + CONST_EXP3d(7) + devectorize((precalc[7] + ROL8(h[ 7]) + ROL2(h[10],11) - ROL2(h[ 1], 2)) ^ cmsg[14])); + + add1+= devectorize(q[20] - q[ 6]); + add2+= devectorize(q[21] - q[ 7]); + + XL64 = xor3x(XL64, q[22], q[23]); + + q[24] = vectorize(add1 + CONST_EXP3d(8) + devectorize((precalc[8] + ROL2(h[8], 9) + ROL2(h[11],12) - ROL2(h[ 2], 3)) ^ cmsg[15])); + q[25] = vectorize(add2 + CONST_EXP3d(9) + devectorize((precalc[9] + ROL2(h[9],10) + ROL2(h[12],13) - ROL2(h[ 3], 4)) ^ cmsg[ 0])); + + add1+= devectorize(q[22] - q[ 8]); + add2+= devectorize(q[23] - q[ 9]); + + uint2 XH64 = xor3x(XL64, q[24], q[25]); + + q[26] = vectorize(add1 + CONST_EXP3d(10) + devectorize((precalc[10] + ROL2(h[10],11) + ROL2(h[13],14) - ROL2(h[ 4], 5)) ^ cmsg[ 1])); + q[27] = vectorize(add2 + CONST_EXP3d(11) + devectorize((precalc[11] + ROL2(h[11],12) + ROL2(h[14],15) - ROL2(h[ 5], 6)) ^ cmsg[ 2])); + + add1+= devectorize(q[24] - q[10]); + add2+= devectorize(q[25] - q[11]); + + XH64 = xor3x(XH64, q[26], q[27]); + + q[28] = vectorize(add1 + CONST_EXP3d(12) + devectorize((precalc[12] + ROL2(h[12], 13) + ROL16(h[15]) - ROL2(h[ 6], 7)) ^ cmsg[ 3])); + q[29] = vectorize(add2 + CONST_EXP3d(13) + devectorize((precalc[13] + ROL2(h[13], 14) + ROL2(h[ 0], 1)- ROL8(h[ 7])) ^ cmsg[ 4])); + + add1+= devectorize(q[26] - q[12]); + add2+= devectorize(q[27] - q[13]); + + XH64 = xor3x(XH64, q[28], q[29]); + + q[30] = vectorize(add1 + CONST_EXP3d(14) + devectorize((precalc[14] + ROL2(h[14],15) + ROL2(h[ 1], 2) - ROL2(h[ 8], 9)) ^ cmsg[ 5])); + q[31] = vectorize(add2 + CONST_EXP3d(15) + devectorize((precalc[15] + ROL16(h[15]) + ROL2(h[ 2], 3) - ROL2(h[ 9],10)) ^ cmsg[ 6])); + + XH64 = xor3x(XH64, q[30], q[31]); + + msg[4] = devectorize((SHR2(XH64, 3) ^ q[20] ^ h[4]) + (XL64 ^ q[28] ^ q[4])); + msg[8] = devectorize((SHL8(XL64) ^ q[23] ^ q[8]) + (XH64 ^ q[24] ^ h[8]) + ROTL64(msg[4], 9)); + + inpHash[0].x = (vectorize(msg[8])).x; + + if (!(((vectorize(msg[8])).x) & 0x8)){ + + msg[0] = devectorize((h[ 0] ^ SHL2(XH64, 5) ^ SHR2(q[16], 5)) + (XL64 ^ q[ 0] ^ q[24])); + msg[1] = devectorize((h[ 1] ^ SHR2(XH64, 7) ^ SHL8(q[17]) ) + (XL64 ^ q[ 1] ^ q[25])); + msg[2] = devectorize((h[ 2] ^ SHR2(XH64, 5) ^ SHL2(q[18], 5)) + (XL64 ^ q[ 2] ^ q[26])); + msg[3] = devectorize((h[ 3] ^ SHR2(XH64, 1) ^ SHL2(q[19], 5)) + (XL64 ^ q[ 3] ^ q[27])); + msg[5] = devectorize((h[ 5] ^ SHL2(XH64, 6) ^ SHR2(q[21], 6)) + (XL64 ^ q[ 5] ^ q[29])); + msg[6] = devectorize((h[ 6] ^ SHR2(XH64, 4) ^ SHL2(q[22], 6)) + (XL64 ^ q[ 6] ^ q[30])); + msg[7] = devectorize((h[ 7] ^ SHR2(XH64,11) ^ SHL2(q[23], 2)) + (XL64 ^ q[ 7] ^ q[31])); + + msg[ 9] = devectorize((q[ 9] ^ q[16] ^ SHR2(XL64, 6)) + (XH64 ^ q[25] ^ h[ 9]) + ROTL64(msg[ 5],10)); + msg[10] = devectorize((q[10] ^ q[17] ^ SHL2(XL64, 6)) + (XH64 ^ q[26] ^ h[10]) + ROTL64(msg[ 6],11)); + msg[11] = devectorize((q[11] ^ q[18] ^ SHL2(XL64, 4)) + (XH64 ^ q[27] ^ h[11]) + ROTL64(msg[ 7],12)); + + #if __CUDA_ARCH__ > 500 + *(uint2x4*)&inpHash[0] = *(uint2x4*)&msg[8]; + #endif + + msg[12] = devectorize((q[12] ^ q[19] ^ SHR2(XL64, 3)) + (XH64 ^ q[28] ^ h[12]) + ROTL64(msg[ 0],13)); + msg[13] = devectorize((q[13] ^ q[20] ^ SHR2(XL64, 4)) + (XH64 ^ q[29] ^ h[13]) + ROTL64(msg[ 1],14)); + msg[14] = devectorize((q[14] ^ q[21] ^ SHR2(XL64, 7)) + (XH64 ^ q[30] ^ h[14]) + ROTL64(msg[ 2],15)); + msg[15] = devectorize((q[15] ^ q[22] ^ SHR2(XL64, 2)) + (XH64 ^ q[31] ^ h[15]) + ROTL64(msg[ 3],16)); + + #if __CUDA_ARCH__ > 500 + *(uint2x4*)&inpHash[4] = *(uint2x4*)&msg[12]; + #else + *(uint2x4*)&inpHash[0] = *(uint2x4*)&msg[8]; + *(uint2x4*)&inpHash[4] = *(uint2x4*)&msg[12]; + #endif + } + } +} + +__host__ +void quark_bmw512_cpu_init(int thr_id, uint32_t threads) +{ + +} + +__host__ void quark_bmw512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash) +{ + const uint32_t threadsperblock = 32; + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + quark_bmw512_gpu_hash_64<<>>(threads, (uint64_t*)d_hash, d_nonceVector); +} +__host__ void quark_bmw512_cpu_hash_64_quark(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + const uint32_t threadsperblock = 32; + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + threadsperblock - 1) / threadsperblock); + dim3 block(threadsperblock); + + quark_bmw512_gpu_hash_64_quark <<>>(threads, (uint64_t*)d_hash); +} diff --git a/quark/cuda_keccak_skein512.cu b/quark/cuda_keccak_skein512.cu new file mode 100644 index 0000000..60e75b1 --- /dev/null +++ b/quark/cuda_keccak_skein512.cu @@ -0,0 +1,908 @@ +/* + * Based on SP's keccak-skein merged implementation + * For compute5.0/5.2 under CUDA7.5 + * Quarkcoin's throughput increased by 0.27% + * + * Provos Alexis - 2016 + */ + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#define TPB52 256 +#define TPB50 128 + +__constant__ const uint2 keccak_round_constants[24] = { + { 0x00000001, 0x00000000 }, { 0x00008082, 0x00000000 }, { 0x0000808a, 0x80000000 }, { 0x80008000, 0x80000000 }, + { 0x0000808b, 0x00000000 }, { 0x80000001, 0x00000000 }, { 0x80008081, 0x80000000 }, { 0x00008009, 0x80000000 }, + { 0x0000008a, 0x00000000 }, { 0x00000088, 0x00000000 }, { 0x80008009, 0x00000000 }, { 0x8000000a, 0x00000000 }, + { 0x8000808b, 0x00000000 }, { 0x0000008b, 0x80000000 }, { 0x00008089, 0x80000000 }, { 0x00008003, 0x80000000 }, + { 0x00008002, 0x80000000 }, { 0x00000080, 0x80000000 }, { 0x0000800a, 0x00000000 }, { 0x8000000a, 0x80000000 }, + { 0x80008081, 0x80000000 }, { 0x00008080, 0x80000000 }, { 0x80000001, 0x00000000 }, { 0x80008008, 0x80000000 } +}; + +__device__ +static void macro1(uint2 *const __restrict__ p){ + p[0] += p[1];p[2] += p[3];p[4] += p[5];p[6] += p[7];p[1] = ROL2(p[1],46) ^ p[0];p[3] = ROL2(p[3],36) ^ p[2];p[5] = ROL2(p[5],19) ^ p[4];p[7] = ROL2(p[7], 37) ^ p[6]; + p[2] += p[1];p[4] += p[7];p[6] += p[5];p[0] += p[3];p[1] = ROL2(p[1],33) ^ p[2];p[7] = ROL2(p[7],27) ^ p[4];p[5] = ROL2(p[5],14) ^ p[6];p[3] = ROL2(p[3], 42) ^ p[0]; + p[4] += p[1];p[6] += p[3];p[0] += p[5];p[2] += p[7];p[1] = ROL2(p[1],17) ^ p[4];p[3] = ROL2(p[3],49) ^ p[6];p[5] = ROL2(p[5],36) ^ p[0];p[7] = ROL2(p[7], 39) ^ p[2]; + p[6] += p[1];p[0] += p[7];p[2] += p[5];p[4] += p[3];p[1] = ROL2(p[1],44) ^ p[6];p[7] = ROL2(p[7], 9) ^ p[0];p[5] = ROL2(p[5],54) ^ p[2];p[3] = ROR8(p[3]) ^ p[4]; +} + +__device__ +static void macro2(uint2 *const __restrict__ p){ + p[0] += p[1];p[2] += p[3];p[4] += p[5];p[6] += p[7];p[1] = ROL2(p[1], 39) ^ p[0];p[3] = ROL2(p[3], 30) ^ p[2];p[5] = ROL2(p[5], 34) ^ p[4];p[7] = ROL24(p[7]) ^ p[6]; + p[2] += p[1];p[4] += p[7];p[6] += p[5];p[0] += p[3];p[1] = ROL2(p[1], 13) ^ p[2];p[7] = ROL2(p[7], 50) ^ p[4];p[5] = ROL2(p[5], 10) ^ p[6];p[3] = ROL2(p[3], 17) ^ p[0]; + p[4] += p[1];p[6] += p[3];p[0] += p[5];p[2] += p[7];p[1] = ROL2(p[1], 25) ^ p[4];p[3] = ROL2(p[3], 29) ^ p[6];p[5] = ROL2(p[5], 39) ^ p[0];p[7] = ROL2(p[7], 43) ^ p[2]; + p[6] += p[1];p[0] += p[7];p[2] += p[5];p[4] += p[3];p[1] = ROL8(p[1]) ^ p[6];p[7] = ROL2(p[7], 35) ^ p[0];p[5] = ROR8(p[5]) ^ p[2];p[3] = ROL2(p[3], 22) ^ p[4]; +} + +__constant__ const uint2 buffer[152] = { + {0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC33,0xAE18A40B}, + {0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC73,0x9E18A40B},{0x98173EC5,0xCAB2076D}, + {0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC73,0x9E18A40B},{0x98173F04,0xCAB2076D},{0x749C51D0,0x4903ADFF}, + {0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173F04,0xCAB2076D},{0x749C51CE,0x3903ADFF},{0x9746DF06,0x0D95DE39}, + {0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x3903ADFF},{0x9746DF43,0xFD95DE39},{0x27C79BD2,0x8FD19341}, + {0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF43,0xFD95DE39},{0x27C79C0E,0x8FD19341},{0xFF352CB6,0x9A255629}, + {0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79C0E,0x8FD19341},{0xFF352CB1,0x8A255629},{0xDF6CA7B6,0x5DB62599}, + {0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x8A255629},{0xDF6CA7F0,0x4DB62599},{0xA9D5C3FB,0xEABE394C}, + {0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7F0,0x4DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B52B,0x991112C7}, + {0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC3C,0xAE18A40B}, + {0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC73,0x9E18A40B},{0x98173ece,0xcab2076d}, + {0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC73,0x9E18A40B},{0x98173F04,0xCAB2076D},{0x749C51D9,0x4903ADFF}, + {0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173F04,0xCAB2076D},{0x749C51CE,0x3903ADFF},{0x9746DF0F,0x0D95DE39}, + {0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x3903ADFF},{0x9746DF43,0xFD95DE39},{0x27C79BDB,0x8FD19341}, + {0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF43,0xFD95DE39},{0x27C79C0E,0x8FD19341},{0xFF352CBF,0x9A255629}, + {0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79C0E,0x8FD19341},{0xFF352CB1,0x8A255629},{0xDF6CA7BF,0x5DB62599}, + {0x660FCC33,0xAE18A40B},{0x98173ec4,0xcab2076d},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x8A255629},{0xDF6CA7F0,0x4DB62599},{0xA9D5C404,0xEABE394C}, + {0x98173ec4,0xcab2076d},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7F0,0x4DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B534,0x991112C7}, + {0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC45,0xAE18A40B} +}; + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB52,3) +#else +__launch_bounds__(TPB50,7) +#endif +void quark_keccakskein512_gpu_hash_64(uint32_t threads, uint2 *g_hash,const uint32_t * g_nonceVector) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint2 t[5], u[5], v, w; + uint2 s[25]; + + if (thread < threads) + { + const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : g_nonceVector[thread]; + + uint2x4* phash = (uint2x4 *)&g_hash[hashPosition * 8]; + + *(uint2x4*)&s[ 0] = __ldg4(&phash[ 0]); + *(uint2x4*)&s[ 4] = __ldg4(&phash[ 1]); + + s[8] = make_uint2(1,0x80000000); + + /*theta*/ + t[ 0] = s[ 0]^s[ 5]; + t[ 1] = s[ 1]^s[ 6]; + t[ 2] = s[ 2]^s[ 7]; + t[ 3] = s[ 3]^s[ 8]; + t[ 4] = s[4]; + + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + + s[ 4] = xor3x(s[ 4], t[3], u[ 0]); + s[24] = s[19] = s[14] = s[ 9] = t[ 3] ^ u[ 0]; + + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[ 5] = xor3x(s[ 5], t[4], u[ 1]); + s[20] = s[15] = s[10] = t[4] ^ u[ 1]; + + s[ 1] = xor3x(s[ 1], t[0], u[ 2]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[21] = s[16] = s[11] = t[0] ^ u[ 2]; + + s[ 2] = xor3x(s[ 2], t[1], u[ 3]); + s[ 7] = xor3x(s[ 7], t[1], u[ 3]); + s[22] = s[17] = s[12] = t[1] ^ u[ 3]; + + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]); + s[23] = s[18] = s[13] = t[2] ^ u[ 4]; + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[ 0]; + + for (int i = 1; i < 23; i++) { + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + t[ j] = vectorize(xor5(devectorize(s[ j]),devectorize(s[j+5]),devectorize(s[j+10]),devectorize(s[j+15]),devectorize(s[j+20]))); + } + + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 4] = xor3x(s[ 4], t[3], u[ 0]);s[ 9] = xor3x(s[ 9], t[3], u[ 0]);s[14] = xor3x(s[14], t[3], u[ 0]);s[19] = xor3x(s[19], t[3], u[ 0]);s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]);s[ 5] = xor3x(s[ 5], t[4], u[ 1]);s[10] = xor3x(s[10], t[4], u[ 1]);s[15] = xor3x(s[15], t[4], u[ 1]);s[20] = xor3x(s[20], t[4], u[ 1]); + s[ 1] = xor3x(s[ 1], t[0], u[ 2]);s[ 6] = xor3x(s[ 6], t[0], u[ 2]);s[11] = xor3x(s[11], t[0], u[ 2]);s[16] = xor3x(s[16], t[0], u[ 2]);s[21] = xor3x(s[21], t[0], u[ 2]); + s[ 2] = xor3x(s[ 2], t[1], u[ 3]);s[ 7] = xor3x(s[ 7], t[1], u[ 3]);s[12] = xor3x(s[12], t[1], u[ 3]);s[17] = xor3x(s[17], t[1], u[ 3]);s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]);s[13] = xor3x(s[13], t[2], u[ 4]);s[18] = xor3x(s[18], t[2], u[ 4]);s[23] = xor3x(s[23], t[2], u[ 4]); + + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[i]; + } + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + t[ j] = xor3x(xor3x(s[j+0],s[j+5],s[j+10]),s[j+15],s[j+20]); + } + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 9] = xor3x(s[ 9], t[3], u[ 0]); + s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[10] = xor3x(s[10], t[4], u[ 1]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[16] = xor3x(s[16], t[0], u[ 2]); + s[12] = xor3x(s[12], t[1], u[ 3]); + s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]); + s[18] = xor3x(s[18], t[2], u[ 4]); + /* rho pi: b[..] = rotl(a[..], ..) */ + s[ 1] = ROL2(s[ 6], 44); + s[ 2] = ROL2(s[12], 43); + s[ 5] = ROL2(s[ 3], 28); + s[ 7] = ROL2(s[10], 3); + s[ 3] = ROL2(s[18], 21); + s[ 4] = ROL2(s[24], 14); + s[ 6] = ROL2(s[ 9], 20); + s[ 8] = ROL2(s[16], 45); + s[ 9] = ROL2(s[22], 61); + + uint2 p[8],h[9]; + + uint32_t t0; + uint2 t1,t2; + t0 = 8; + t1 = vectorize(0xFF00000000000000); + t2 = t1+t0; + + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + p[ 0] = chi(s[ 0],s[ 1],s[ 2]); + p[ 1] = chi(s[ 1],s[ 2],s[ 3]); + p[ 2] = chi(s[ 2],s[ 3],s[ 4]); + p[ 3] = chi(s[ 3],s[ 4],s[ 0]); + p[ 4] = chi(s[ 4],s[ 0],s[ 1]); + p[ 5] = chi(s[ 5],s[ 6],s[ 7]); + p[ 6] = chi(s[ 6],s[ 7],s[ 8]); + p[ 7] = chi(s[ 7],s[ 8],s[ 9]); + /* iota: a[0,0] ^= round constant */ + p[0] ^= keccak_round_constants[23]; + + h[ 0] = p[0]; + h[ 1] = p[1]; + h[ 2] = p[2]; + h[ 3] = p[3]; + h[ 4] = p[4]; + h[ 5] = p[5]; + h[ 6] = p[6]; + h[ 7] = p[7]; + + p[0] += buffer[0]; p[1] += buffer[1]; p[2] += buffer[2]; p[3] += buffer[3]; p[4] += buffer[4]; p[5] += buffer[5]; p[6] += buffer[6]; p[7] += buffer[7]; + macro1(p); + p[0] += buffer[8]; p[1] += buffer[9]; p[2] += buffer[10]; p[3] += buffer[11]; p[4] += buffer[12]; p[5] += buffer[13]; p[6] += buffer[14]; p[7] += buffer[15]; + macro2(p); + p[0] += buffer[16]; p[1] += buffer[17]; p[2] += buffer[18]; p[3] += buffer[19]; p[4] += buffer[20]; p[5] += buffer[21]; p[6] += buffer[22]; p[7] += buffer[23]; + macro1(p); + p[0] += buffer[24]; p[1] += buffer[25]; p[2] += buffer[26]; p[3] += buffer[27]; p[4] += buffer[28]; p[5] += buffer[29]; p[6] += buffer[30]; p[7] += buffer[31]; + macro2(p); + p[0] += buffer[32]; p[1] += buffer[33]; p[2] += buffer[34]; p[3] += buffer[35]; p[4] += buffer[36]; p[5] += buffer[37]; p[6] += buffer[38]; p[7] += buffer[39]; + macro1(p); + p[0] += buffer[40]; p[1] += buffer[41]; p[2] += buffer[42]; p[3] += buffer[43]; p[4] += buffer[44]; p[5] += buffer[45]; p[6] += buffer[46]; p[7] += buffer[47]; + macro2(p); + p[0] += buffer[48]; p[1] += buffer[49]; p[2] += buffer[50]; p[3] += buffer[51]; p[4] += buffer[52]; p[5] += buffer[53]; p[6] += buffer[54]; p[7] += buffer[55]; + macro1(p); + p[0] += buffer[56]; p[1] += buffer[57]; p[2] += buffer[58]; p[3] += buffer[59]; p[4] += buffer[60]; p[5] += buffer[61]; p[6] += buffer[62]; p[7] += buffer[63]; + macro2(p); + p[0] += buffer[64]; p[1] += buffer[65]; p[2] += buffer[66]; p[3] += buffer[67]; p[4] += buffer[68]; p[5] += buffer[69]; p[6] += buffer[70]; p[7] += buffer[71]; + macro1(p); + p[0] += buffer[72]; p[1] += buffer[73]; p[2] += buffer[74]; p[3] += buffer[75]; p[4] += buffer[76]; p[5] += buffer[77]; p[6] += buffer[78]; p[7] += buffer[79]; + macro2(p); + p[0] += buffer[80]; p[1] += buffer[81]; p[2] += buffer[82]; p[3] += buffer[83]; p[4] += buffer[84]; p[5] += buffer[85]; p[6] += buffer[86]; p[7] += buffer[87]; + macro1(p); + p[0] += buffer[88]; p[1] += buffer[89]; p[2] += buffer[90]; p[3] += buffer[91]; p[4] += buffer[92]; p[5] += buffer[93]; p[6] += buffer[94]; p[7] += buffer[95]; + macro2(p); + p[0] += buffer[96]; p[1] += buffer[97]; p[2] += buffer[98]; p[3] += buffer[99]; p[4] += buffer[100]; p[5] += buffer[101]; p[6] += buffer[102]; p[7] += buffer[103]; + macro1(p); + p[0] += buffer[104]; p[1] += buffer[105]; p[2] += buffer[106]; p[3] += buffer[107]; p[4] += buffer[108]; p[5] += buffer[109]; p[6] += buffer[110]; p[7] += buffer[111]; + macro2(p); + p[0] += buffer[112]; p[1] += buffer[113]; p[2] += buffer[114]; p[3] += buffer[115]; p[4] += buffer[116]; p[5] += buffer[117]; p[6] += buffer[118]; p[7] += buffer[119]; + macro1(p); + p[0] += buffer[120]; p[1] += buffer[121]; p[2] += buffer[122]; p[3] += buffer[123]; p[4] += buffer[124]; p[5] += buffer[125]; p[6] += buffer[126]; p[7] += buffer[127]; + macro2(p); + p[0] += buffer[128]; p[1] += buffer[129]; p[2] += buffer[130]; p[3] += buffer[131]; p[4] += buffer[132]; p[5] += buffer[133]; p[6] += buffer[134]; p[7] += buffer[135]; + macro1(p); + p[0] += buffer[136]; p[1] += buffer[137]; p[2] += buffer[138]; p[3] += buffer[139]; p[4] += buffer[140]; p[5] += buffer[141]; p[6] += buffer[142]; p[7] += buffer[143]; + macro2(p); + p[0] += buffer[144]; p[1] += buffer[145]; p[2] += buffer[146]; p[3] += buffer[147]; p[4] += buffer[148]; p[5] += buffer[149]; p[6] += buffer[150]; p[7] += buffer[151]; + + #define h0 p[0] + #define h1 p[1] + #define h2 p[2] + #define h3 p[3] + #define h4 p[4] + #define h5 p[5] + #define h6 p[6] + #define h7 p[7] + + h0 ^= h[0]; h1 ^= h[1]; h2 ^= h[2]; h3 ^= h[3]; h4 ^= h[4]; h5 ^= h[5]; h6 ^= h[6]; h7 ^= h[7]; + + uint2 skein_h8 = h0 ^ h1 ^ h2 ^ h3 ^ h4 ^ h5 ^ h6 ^ h7 ^ vectorize(0x1BD11BDAA9FC1A22); + + uint2 hash64[8]; + + hash64[5] = h5 + 8U; + + hash64[0] = h0 + h1; + hash64[1] = ROL2(h1, 46) ^ hash64[0]; + hash64[2] = h2 + h3; + hash64[3] = ROL2(h3, 36) ^ hash64[2]; + hash64[4] = h4 + hash64[5]; + hash64[5] = ROL2(hash64[5], 19) ^ hash64[4]; + hash64[6] = h6 + h7 + t1; + hash64[7] = ROL2(h7, 37) ^ hash64[6]; + hash64[2]+= hash64[1]; + hash64[1] = ROL2(hash64[1], 33) ^ hash64[2]; + hash64[4]+= hash64[7]; + hash64[7] = ROL2(hash64[7], 27) ^ hash64[4]; + hash64[6]+= hash64[5]; + hash64[5] = ROL2(hash64[5], 14) ^ hash64[6]; + hash64[0]+= hash64[3]; + hash64[3] = ROL2(hash64[3], 42) ^ hash64[0]; + hash64[4]+= hash64[1]; + hash64[1] = ROL2(hash64[1], 17) ^ hash64[4]; + hash64[6]+= hash64[3]; + hash64[3] = ROL2(hash64[3], 49) ^ hash64[6]; + hash64[0]+= hash64[5]; + hash64[5] = ROL2(hash64[5], 36) ^ hash64[0]; + hash64[2]+= hash64[7]; + hash64[7] = ROL2(hash64[7], 39) ^ hash64[2]; + hash64[6]+= hash64[1]; + hash64[1] = ROL2(hash64[1], 44) ^ hash64[6]; + hash64[0]+= hash64[7]; + hash64[7] = ROL2(hash64[7], 9) ^ hash64[0]; + hash64[2]+= hash64[5]; + hash64[5] = ROL2(hash64[5], 54) ^ hash64[2]; + hash64[4]+= hash64[3]; + hash64[3] = ROR8(hash64[3]) ^ hash64[4]; + + hash64[0]+= h1; hash64[1]+= h2; + hash64[2]+= h3; hash64[3]+= h4; + hash64[4]+= h5; hash64[5]+= h6 + t1; + hash64[6]+= h7 + t2; hash64[7]+= skein_h8 + 1U; + macro2(hash64); + hash64[0]+= h2; hash64[1]+= h3; + hash64[2]+= h4; hash64[3]+= h5; + hash64[4]+= h6; hash64[5]+= h7 + t2; + hash64[6]+= skein_h8+t0;hash64[7]+= h0 + 2U; + macro1(hash64); + hash64[0]+= h3; hash64[1]+= h4; + hash64[2]+= h5; hash64[3]+= h6; + hash64[4]+= h7; hash64[5]+= skein_h8 + t0; + hash64[6]+= h0 + t1; hash64[7]+= h1 + 3U; + macro2(hash64); + hash64[0]+= h4; hash64[1]+= h5; + hash64[2]+= h6; hash64[3]+= h7; + hash64[4]+= skein_h8; hash64[5]+= h0 + t1; + hash64[6]+= h1 + t2; hash64[7]+= h2 + 4U; + macro1(hash64); + hash64[0]+= h5; hash64[1]+= h6; + hash64[2]+= h7; hash64[3]+= skein_h8; + hash64[4]+= h0; hash64[5]+= h1 + t2; + hash64[6]+= h2 + t0; hash64[7]+= h3 + 5U; + macro2(hash64); + hash64[0]+= h6; hash64[1]+= h7; + hash64[2]+= skein_h8; hash64[3]+= h0; + hash64[4]+= h1; hash64[5]+= h2 + t0; + hash64[6]+= h3 + t1; hash64[7]+= h4 + 6U; + macro1(hash64); + hash64[0]+= h7; hash64[1]+= skein_h8; + hash64[2]+= h0; hash64[3]+= h1; + hash64[4]+= h2; hash64[5]+= h3 + t1; + hash64[6]+= h4 + t2; hash64[7]+= h5 + 7U; + macro2(hash64); + hash64[0]+= skein_h8; hash64[1]+= h0; + hash64[2]+= h1; hash64[3]+= h2; + hash64[4]+= h3; hash64[5]+= h4 + t2; + hash64[6]+= h5 + t0; hash64[7]+= h6 + 8U; + macro1(hash64); + hash64[0]+= h0; hash64[1]+= h1; + hash64[2]+= h2; hash64[3]+= h3; + hash64[4]+= h4; hash64[5]+= h5 + t0; + hash64[6]+= h6 + t1; hash64[7]+= h7 + 9U; + macro2(hash64); + hash64[0]+= h1; hash64[1]+= h2; + hash64[2]+= h3; hash64[3]+= h4; + hash64[4]+= h5; hash64[5]+= h6 + t1; + hash64[6]+= h7 + t2; hash64[7]+= skein_h8 + 10U; + macro1(hash64); + hash64[0]+= h2; hash64[1]+= h3; + hash64[2]+= h4; hash64[3]+= h5; + hash64[4]+= h6; hash64[5]+= h7 + t2; + hash64[6]+= skein_h8+t0;hash64[7]+= h0 + 11U; + macro2(hash64); + hash64[0]+= h3; hash64[1]+= h4; + hash64[2]+= h5; hash64[3]+= h6; + hash64[4]+= h7; hash64[5]+= skein_h8 + t0; + hash64[6]+= h0 + t1; hash64[7]+= h1 + 12U; + macro1(hash64); + hash64[0]+= h4; hash64[1]+= h5; + hash64[2]+= h6; hash64[3]+= h7; + hash64[4]+= skein_h8; hash64[5]+= h0 + t1; + hash64[6]+= h1 + t2; hash64[7]+= h2 + 13U; + macro2(hash64); + hash64[0]+= h5; hash64[1]+= h6; + hash64[2]+= h7; hash64[3]+= skein_h8; + hash64[4]+= h0; hash64[5]+= h1 + t2; + hash64[6]+= h2 + t0; hash64[7]+= h3 + 14U; + macro1(hash64); + hash64[0]+= h6; hash64[1]+= h7; + hash64[2]+= skein_h8; hash64[3]+= h0; + hash64[4]+= h1; hash64[5]+= h2 + t0; + hash64[6]+= h3 + t1; hash64[7]+= h4 + 15U; + macro2(hash64); + hash64[0]+= h7; hash64[1]+= skein_h8; + hash64[2]+= h0; hash64[3]+= h1; + hash64[4]+= h2; hash64[5]+= h3 + t1; + hash64[6]+= h4 + t2; hash64[7]+= h5 + 16U; + macro1(hash64); + hash64[0]+= skein_h8; hash64[1]+= h0; + hash64[2]+= h1; hash64[3]+= h2; + hash64[4]+= h3; hash64[5]+= h4 + t2; + hash64[6]+= h5 + t0; hash64[7]+= h6 + 17U; + macro2(hash64); + hash64[0]+= h0; hash64[1]+= h1; + hash64[2]+= h2; hash64[3]+= h3; + hash64[4]+= h4; hash64[5]+= h5 + t0; + hash64[6]+= h6 + t1; hash64[7]+= h7 + 18U; + + phash[0] = *(uint2x4*)&hash64[0]; + phash[1] = *(uint2x4*)&hash64[4]; + + #undef h0 + #undef h1 + #undef h2 + #undef h3 + #undef h4 + #undef h5 + #undef h6 + #undef h7 + } +} + +__host__ void quark_keccak_skein512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash) +{ + // berechne wie viele Thread Blocks wir brauchen + const uint32_t dev_id = device_map[thr_id]; + const uint32_t tpb = (device_sm[dev_id] > 500) ? TPB52 : TPB50; + dim3 grid((threads + tpb - 1) / tpb); + dim3 block(tpb); + + quark_keccakskein512_gpu_hash_64 << > >(threads, (uint2 *)d_hash, d_nonceVector); +} + + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB52,3) +#else +__launch_bounds__(TPB50,7) +#endif +void quark_keccakskein512_gpu_hash_64_final(uint32_t threads, uint2 *g_hash,const uint32_t * g_nonceVector, uint32_t *resNonce,const uint64_t highTarget) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint2 t[5], u[5], v, w; + uint2 s[25]; + + if (thread < threads) + { + const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : g_nonceVector[thread]; + + uint2x4* phash = (uint2x4 *)&g_hash[hashPosition * 8]; + + *(uint2x4*)&s[ 0] = __ldg4(&phash[ 0]); + *(uint2x4*)&s[ 4] = __ldg4(&phash[ 1]); + + s[8] = make_uint2(1,0x80000000); + + /*theta*/ + t[ 0] = s[ 0]^s[ 5]; + t[ 1] = s[ 1]^s[ 6]; + t[ 2] = s[ 2]^s[ 7]; + t[ 3] = s[ 3]^s[ 8]; + t[ 4] = s[4]; + + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + + s[ 4] = xor3x(s[ 4], t[3], u[ 0]); + s[24] = s[19] = s[14] = s[ 9] = t[ 3] ^ u[ 0]; + + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[ 5] = xor3x(s[ 5], t[4], u[ 1]); + s[20] = s[15] = s[10] = t[4] ^ u[ 1]; + + s[ 1] = xor3x(s[ 1], t[0], u[ 2]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[21] = s[16] = s[11] = t[0] ^ u[ 2]; + + s[ 2] = xor3x(s[ 2], t[1], u[ 3]); + s[ 7] = xor3x(s[ 7], t[1], u[ 3]); + s[22] = s[17] = s[12] = t[1] ^ u[ 3]; + + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]); + s[23] = s[18] = s[13] = t[2] ^ u[ 4]; + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[ 0]; + + for (int i = 1; i < 23; i++) { + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + t[ j] = vectorize(xor5(devectorize(s[ j]),devectorize(s[j+5]),devectorize(s[j+10]),devectorize(s[j+15]),devectorize(s[j+20]))); +// t[ j] = s[ j] ^ s[j+5] ^ s[j+10] ^ s[j+15] ^ s[j+20]; + } + + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 4] = xor3x(s[ 4], t[3], u[ 0]);s[ 9] = xor3x(s[ 9], t[3], u[ 0]);s[14] = xor3x(s[14], t[3], u[ 0]);s[19] = xor3x(s[19], t[3], u[ 0]);s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]);s[ 5] = xor3x(s[ 5], t[4], u[ 1]);s[10] = xor3x(s[10], t[4], u[ 1]);s[15] = xor3x(s[15], t[4], u[ 1]);s[20] = xor3x(s[20], t[4], u[ 1]); + s[ 1] = xor3x(s[ 1], t[0], u[ 2]);s[ 6] = xor3x(s[ 6], t[0], u[ 2]);s[11] = xor3x(s[11], t[0], u[ 2]);s[16] = xor3x(s[16], t[0], u[ 2]);s[21] = xor3x(s[21], t[0], u[ 2]); + s[ 2] = xor3x(s[ 2], t[1], u[ 3]);s[ 7] = xor3x(s[ 7], t[1], u[ 3]);s[12] = xor3x(s[12], t[1], u[ 3]);s[17] = xor3x(s[17], t[1], u[ 3]);s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]);s[13] = xor3x(s[13], t[2], u[ 4]);s[18] = xor3x(s[18], t[2], u[ 4]);s[23] = xor3x(s[23], t[2], u[ 4]); + +/* s[ 4] = s[ 4]^t[3]^u[ 0];s[ 9] = s[ 9]^t[3]^u[ 0];s[14] = s[14]^t[3]^u[ 0];s[19] = s[19]^t[3]^u[ 0];s[24] = s[24]^t[3]^u[ 0]; + s[ 0] = s[ 0]^t[4]^u[ 1];s[ 5] = s[ 5]^t[4]^u[ 1];s[10] = s[10]^t[4]^u[ 1];s[15] = s[15]^t[4]^u[ 1];s[20] = s[20]^t[4]^u[ 1]; + s[ 1] = s[ 1]^t[0]^u[ 2];s[ 6] = s[ 6]^t[0]^u[ 2];s[11] = s[11]^t[0]^u[ 2];s[16] = s[16]^t[0]^u[ 2];s[21] = s[21]^t[0]^u[ 2]; + s[ 2] = s[ 2]^t[1]^u[ 3];s[ 7] = s[ 7]^t[1]^u[ 3];s[12] = s[12]^t[1]^u[ 3];s[17] = s[17]^t[1]^u[ 3];s[22] = s[22]^t[1]^u[ 3]; + s[ 3] = s[ 3]^t[2]^u[ 4];s[ 8] = s[ 8]^t[2]^u[ 4];s[13] = s[13]^t[2]^u[ 4];s[18] = s[18]^t[2]^u[ 4];s[23] = s[23]^t[2]^u[ 4];*/ + + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[i]; + } + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + t[ j] = xor3x(xor3x(s[j+0],s[j+5],s[j+10]),s[j+15],s[j+20]); + } + /*theta*/ + #pragma unroll + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 9] = xor3x(s[ 9], t[3], u[ 0]); + s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[10] = xor3x(s[10], t[4], u[ 1]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[16] = xor3x(s[16], t[0], u[ 2]); + s[12] = xor3x(s[12], t[1], u[ 3]); + s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]); + s[18] = xor3x(s[18], t[2], u[ 4]); + /* rho pi: b[..] = rotl(a[..], ..) */ + s[ 1] = ROL2(s[ 6], 44); + s[ 2] = ROL2(s[12], 43); + s[ 5] = ROL2(s[ 3], 28); + s[ 7] = ROL2(s[10], 3); + s[ 3] = ROL2(s[18], 21); + s[ 4] = ROL2(s[24], 14); + s[ 6] = ROL2(s[ 9], 20); + s[ 8] = ROL2(s[16], 45); + s[ 9] = ROL2(s[22], 61); + + uint2 p[8],h[9]; + + uint32_t t0; + uint2 t1,t2; + t0 = 8; + t1 = vectorize(0xFF00000000000000); + t2 = t1+t0; + + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + p[ 0] = chi(s[ 0],s[ 1],s[ 2]); + p[ 1] = chi(s[ 1],s[ 2],s[ 3]); + p[ 2] = chi(s[ 2],s[ 3],s[ 4]); + p[ 3] = chi(s[ 3],s[ 4],s[ 0]); + p[ 4] = chi(s[ 4],s[ 0],s[ 1]); + p[ 5] = chi(s[ 5],s[ 6],s[ 7]); + p[ 6] = chi(s[ 6],s[ 7],s[ 8]); + p[ 7] = chi(s[ 7],s[ 8],s[ 9]); + /* iota: a[0,0] ^= round constant */ + p[0] ^= keccak_round_constants[23]; + + h[ 0] = p[0]; + h[ 1] = p[1]; + h[ 2] = p[2]; + h[ 3] = p[3]; + h[ 4] = p[4]; + h[ 5] = p[5]; + h[ 6] = p[6]; + h[ 7] = p[7]; + + p[0] += buffer[0]; p[1] += buffer[1]; p[2] += buffer[2]; p[3] += buffer[3]; p[4] += buffer[4]; p[5] += buffer[5]; p[6] += buffer[6]; p[7] += buffer[7]; + macro1(p); + p[0] += buffer[8]; p[1] += buffer[9]; p[2] += buffer[10]; p[3] += buffer[11]; p[4] += buffer[12]; p[5] += buffer[13]; p[6] += buffer[14]; p[7] += buffer[15]; + macro2(p); + p[0] += buffer[16]; p[1] += buffer[17]; p[2] += buffer[18]; p[3] += buffer[19]; p[4] += buffer[20]; p[5] += buffer[21]; p[6] += buffer[22]; p[7] += buffer[23]; + macro1(p); + p[0] += buffer[24]; p[1] += buffer[25]; p[2] += buffer[26]; p[3] += buffer[27]; p[4] += buffer[28]; p[5] += buffer[29]; p[6] += buffer[30]; p[7] += buffer[31]; + macro2(p); + p[0] += buffer[32]; p[1] += buffer[33]; p[2] += buffer[34]; p[3] += buffer[35]; p[4] += buffer[36]; p[5] += buffer[37]; p[6] += buffer[38]; p[7] += buffer[39]; + macro1(p); + p[0] += buffer[40]; p[1] += buffer[41]; p[2] += buffer[42]; p[3] += buffer[43]; p[4] += buffer[44]; p[5] += buffer[45]; p[6] += buffer[46]; p[7] += buffer[47]; + macro2(p); + p[0] += buffer[48]; p[1] += buffer[49]; p[2] += buffer[50]; p[3] += buffer[51]; p[4] += buffer[52]; p[5] += buffer[53]; p[6] += buffer[54]; p[7] += buffer[55]; + macro1(p); + p[0] += buffer[56]; p[1] += buffer[57]; p[2] += buffer[58]; p[3] += buffer[59]; p[4] += buffer[60]; p[5] += buffer[61]; p[6] += buffer[62]; p[7] += buffer[63]; + macro2(p); + p[0] += buffer[64]; p[1] += buffer[65]; p[2] += buffer[66]; p[3] += buffer[67]; p[4] += buffer[68]; p[5] += buffer[69]; p[6] += buffer[70]; p[7] += buffer[71]; + macro1(p); + p[0] += buffer[72]; p[1] += buffer[73]; p[2] += buffer[74]; p[3] += buffer[75]; p[4] += buffer[76]; p[5] += buffer[77]; p[6] += buffer[78]; p[7] += buffer[79]; + macro2(p); + p[0] += buffer[80]; p[1] += buffer[81]; p[2] += buffer[82]; p[3] += buffer[83]; p[4] += buffer[84]; p[5] += buffer[85]; p[6] += buffer[86]; p[7] += buffer[87]; + macro1(p); + p[0] += buffer[88]; p[1] += buffer[89]; p[2] += buffer[90]; p[3] += buffer[91]; p[4] += buffer[92]; p[5] += buffer[93]; p[6] += buffer[94]; p[7] += buffer[95]; + macro2(p); + p[0] += buffer[96]; p[1] += buffer[97]; p[2] += buffer[98]; p[3] += buffer[99]; p[4] += buffer[100]; p[5] += buffer[101]; p[6] += buffer[102]; p[7] += buffer[103]; + macro1(p); + p[0] += buffer[104]; p[1] += buffer[105]; p[2] += buffer[106]; p[3] += buffer[107]; p[4] += buffer[108]; p[5] += buffer[109]; p[6] += buffer[110]; p[7] += buffer[111]; + macro2(p); + p[0] += buffer[112]; p[1] += buffer[113]; p[2] += buffer[114]; p[3] += buffer[115]; p[4] += buffer[116]; p[5] += buffer[117]; p[6] += buffer[118]; p[7] += buffer[119]; + macro1(p); + p[0] += buffer[120]; p[1] += buffer[121]; p[2] += buffer[122]; p[3] += buffer[123]; p[4] += buffer[124]; p[5] += buffer[125]; p[6] += buffer[126]; p[7] += buffer[127]; + macro2(p); + p[0] += buffer[128]; p[1] += buffer[129]; p[2] += buffer[130]; p[3] += buffer[131]; p[4] += buffer[132]; p[5] += buffer[133]; p[6] += buffer[134]; p[7] += buffer[135]; + macro1(p); + p[0] += buffer[136]; p[1] += buffer[137]; p[2] += buffer[138]; p[3] += buffer[139]; p[4] += buffer[140]; p[5] += buffer[141]; p[6] += buffer[142]; p[7] += buffer[143]; + macro2(p); + p[0] += buffer[144]; p[1] += buffer[145]; p[2] += buffer[146]; p[3] += buffer[147]; p[4] += buffer[148]; p[5] += buffer[149]; p[6] += buffer[150]; p[7] += buffer[151]; + + #define h0 p[0] + #define h1 p[1] + #define h2 p[2] + #define h3 p[3] + #define h4 p[4] + #define h5 p[5] + #define h6 p[6] + #define h7 p[7] + + h0 ^= h[0]; h1 ^= h[1]; h2 ^= h[2]; h3 ^= h[3]; h4 ^= h[4]; h5 ^= h[5]; h6 ^= h[6]; h7 ^= h[7]; + + uint2 skein_h8 = h0 ^ h1 ^ h2 ^ h3 ^ h4 ^ h5 ^ h6 ^ h7 ^ vectorize(0x1BD11BDAA9FC1A22); + + uint2 hash64[8]; + + hash64[5] = h5 + 8U; + + hash64[0] = h0 + h1; + hash64[1] = ROL2(h1, 46) ^ hash64[0]; + hash64[2] = h2 + h3; + hash64[3] = ROL2(h3, 36) ^ hash64[2]; + hash64[4] = h4 + hash64[5]; + hash64[5] = ROL2(hash64[5], 19) ^ hash64[4]; + hash64[6] = h6 + h7 + t1; + hash64[7] = ROL2(h7, 37) ^ hash64[6]; + hash64[2]+= hash64[1]; + hash64[1] = ROL2(hash64[1], 33) ^ hash64[2]; + hash64[4]+= hash64[7]; + hash64[7] = ROL2(hash64[7], 27) ^ hash64[4]; + hash64[6]+= hash64[5]; + hash64[5] = ROL2(hash64[5], 14) ^ hash64[6]; + hash64[0]+= hash64[3]; + hash64[3] = ROL2(hash64[3], 42) ^ hash64[0]; + hash64[4]+= hash64[1]; + hash64[1] = ROL2(hash64[1], 17) ^ hash64[4]; + hash64[6]+= hash64[3]; + hash64[3] = ROL2(hash64[3], 49) ^ hash64[6]; + hash64[0]+= hash64[5]; + hash64[5] = ROL2(hash64[5], 36) ^ hash64[0]; + hash64[2]+= hash64[7]; + hash64[7] = ROL2(hash64[7], 39) ^ hash64[2]; + hash64[6]+= hash64[1]; + hash64[1] = ROL2(hash64[1], 44) ^ hash64[6]; + hash64[0]+= hash64[7]; + hash64[7] = ROL2(hash64[7], 9) ^ hash64[0]; + hash64[2]+= hash64[5]; + hash64[5] = ROL2(hash64[5], 54) ^ hash64[2]; + hash64[4]+= hash64[3]; + hash64[3] = ROR8(hash64[3]) ^ hash64[4]; + + hash64[0]+= h1; hash64[1]+= h2; + hash64[2]+= h3; hash64[3]+= h4; + hash64[4]+= h5; hash64[5]+= h6 + t1; + hash64[6]+= h7 + t2; hash64[7]+= skein_h8 + 1U; + macro2(hash64); + hash64[0]+= h2; hash64[1]+= h3; + hash64[2]+= h4; hash64[3]+= h5; + hash64[4]+= h6; hash64[5]+= h7 + t2; + hash64[6]+= skein_h8+t0;hash64[7]+= h0 + 2U; + macro1(hash64); + hash64[0]+= h3; hash64[1]+= h4; + hash64[2]+= h5; hash64[3]+= h6; + hash64[4]+= h7; hash64[5]+= skein_h8 + t0; + hash64[6]+= h0 + t1; hash64[7]+= h1 + 3U; + macro2(hash64); + hash64[0]+= h4; hash64[1]+= h5; + hash64[2]+= h6; hash64[3]+= h7; + hash64[4]+= skein_h8; hash64[5]+= h0 + t1; + hash64[6]+= h1 + t2; hash64[7]+= h2 + 4U; + macro1(hash64); + hash64[0]+= h5; hash64[1]+= h6; + hash64[2]+= h7; hash64[3]+= skein_h8; + hash64[4]+= h0; hash64[5]+= h1 + t2; + hash64[6]+= h2 + t0; hash64[7]+= h3 + 5U; + macro2(hash64); + hash64[0]+= h6; hash64[1]+= h7; + hash64[2]+= skein_h8; hash64[3]+= h0; + hash64[4]+= h1; hash64[5]+= h2 + t0; + hash64[6]+= h3 + t1; hash64[7]+= h4 + 6U; + macro1(hash64); + hash64[0]+= h7; hash64[1]+= skein_h8; + hash64[2]+= h0; hash64[3]+= h1; + hash64[4]+= h2; hash64[5]+= h3 + t1; + hash64[6]+= h4 + t2; hash64[7]+= h5 + 7U; + macro2(hash64); + hash64[0]+= skein_h8; hash64[1]+= h0; + hash64[2]+= h1; hash64[3]+= h2; + hash64[4]+= h3; hash64[5]+= h4 + t2; + hash64[6]+= h5 + t0; hash64[7]+= h6 + 8U; + macro1(hash64); + hash64[0]+= h0; hash64[1]+= h1; + hash64[2]+= h2; hash64[3]+= h3; + hash64[4]+= h4; hash64[5]+= h5 + t0; + hash64[6]+= h6 + t1; hash64[7]+= h7 + 9U; + macro2(hash64); + hash64[0]+= h1; hash64[1]+= h2; + hash64[2]+= h3; hash64[3]+= h4; + hash64[4]+= h5; hash64[5]+= h6 + t1; + hash64[6]+= h7 + t2; hash64[7]+= skein_h8 + 10U; + macro1(hash64); + hash64[0]+= h2; hash64[1]+= h3; + hash64[2]+= h4; hash64[3]+= h5; + hash64[4]+= h6; hash64[5]+= h7 + t2; + hash64[6]+= skein_h8+t0;hash64[7]+= h0 + 11U; + macro2(hash64); + hash64[0]+= h3; hash64[1]+= h4; + hash64[2]+= h5; hash64[3]+= h6; + hash64[4]+= h7; hash64[5]+= skein_h8 + t0; + hash64[6]+= h0 + t1; hash64[7]+= h1 + 12U; + macro1(hash64); + hash64[0]+= h4; hash64[1]+= h5; + hash64[2]+= h6; hash64[3]+= h7; + hash64[4]+= skein_h8; hash64[5]+= h0 + t1; + hash64[6]+= h1 + t2; hash64[7]+= h2 + 13U; + macro2(hash64); + hash64[0]+= h5; hash64[1]+= h6; + hash64[2]+= h7; hash64[3]+= skein_h8; + hash64[4]+= h0; hash64[5]+= h1 + t2; + hash64[6]+= h2 + t0; hash64[7]+= h3 + 14U; + macro1(hash64); + hash64[0]+= h6; hash64[1]+= h7; + hash64[2]+= skein_h8; hash64[3]+= h0; + hash64[4]+= h1; hash64[5]+= h2 + t0; + hash64[6]+= h3 + t1; hash64[7]+= h4 + 15U; + macro2(hash64); + hash64[0]+= h7; hash64[1]+= skein_h8; + hash64[2]+= h0; hash64[3]+= h1; + hash64[4]+= h2; hash64[5]+= h3 + t1; + hash64[6]+= h4 + t2; hash64[7]+= h5 + 16U; + macro1(hash64); + hash64[0]+= skein_h8; hash64[1]+= h0; + hash64[2]+= h1; hash64[3]+= h2; + hash64[4]+= h3; hash64[5]+= h4 + t2; + hash64[6]+= h5 + t0; hash64[7]+= h6 + 17U; +// macro2(hash64); + hash64[0] += hash64[1]; + hash64[2] += hash64[3]; + hash64[4] += hash64[5]; + hash64[6] += hash64[7]; + hash64[1] = ROL2(hash64[1], 39) ^ hash64[0]; + hash64[3] = ROL2(hash64[3], 30) ^ hash64[2]; + hash64[5] = ROL2(hash64[5], 34) ^ hash64[4]; + hash64[7] = ROL24(hash64[7]) ^ hash64[6]; + + hash64[2] += hash64[1]; + + hash64[4] += hash64[7]; + + hash64[6] += hash64[5]; + + hash64[0] += hash64[3]; + + hash64[1] = ROL2(hash64[1], 13) ^ hash64[2]; + + hash64[3] = ROL2(hash64[3], 17) ^ hash64[0]; + + hash64[4] += hash64[1]; + hash64[6] += hash64[3]; + + hash64[3] = ROL2(hash64[3], 29) ^ hash64[6]; + + hash64[4] += hash64[3]; + hash64[3] = ROL2(hash64[3], 22) ^ hash64[4]; + + if(devectorize(hash64[3]+h3)<=highTarget){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } +// phash[0] = *(uint2x4*)&hash64[0]; +// phash[1] = *(uint2x4*)&hash64[4]; + + #undef h0 + #undef h1 + #undef h2 + #undef h3 + #undef h4 + #undef h5 + #undef h6 + #undef h7 + } +} + +__host__ void quark_keccak_skein512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash,uint32_t *d_resNonce,const uint64_t highTarget){ + + // berechne wie viele Thread Blocks wir brauchen + const uint32_t dev_id = device_map[thr_id]; + const uint32_t tpb = (device_sm[dev_id] > 500) ? TPB52 : TPB50; + dim3 grid((threads + tpb - 1) / tpb); + dim3 block(tpb); + + quark_keccakskein512_gpu_hash_64_final <<>>(threads, (uint2 *)d_hash, d_nonceVector, d_resNonce, highTarget); +} diff --git a/quark/cuda_quark.h b/quark/cuda_quark.h new file mode 100644 index 0000000..76f6452 --- /dev/null +++ b/quark/cuda_quark.h @@ -0,0 +1,34 @@ +#include "cuda_helper.h" + +/* commonly used cuda quark kernels prototypes */ + +extern void quark_blake512_cpu_setBlock_80(int thr_id, uint32_t *pdata); +extern void quark_blake512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_hash); +extern void quark_blake512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash); + +extern void quark_bmw512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash); +extern void quark_bmw512_cpu_hash_64_quark(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void blake512_bmw512_cpu_setBlock_80(int thr_id, uint32_t *endiandata); +extern void quark_blake512_bmw512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_outputHash); + +extern void quark_groestl512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash); +extern void quark_groestl512_sm20_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash); + +extern void quark_skein512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash); + +extern void quark_keccak512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash); +extern void quark_keccak512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash, uint64_t target, uint32_t *d_resNonce); + +extern void quark_keccak_skein512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash); +extern void quark_keccak_skein512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash,uint32_t *d_resNonce,const uint64_t highTarget); + +extern void quark_jh512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash); +extern void quark_jh512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash, uint64_t target, uint32_t *d_resNonce); +extern void quark_jh512_4way_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t* d_hash); + +extern void quark_compactTest_cpu_init(int thr_id, uint32_t threads); +extern void quark_compactTest_cpu_free(int thr_id); +extern void quark_compactTest_cpu_hash_64(int thr_id,uint32_t threads,uint32_t *inpHashes,uint32_t *d_validNonceTable,uint32_t *d_nonces1,uint32_t *nrm1,uint32_t *d_nonces2,uint32_t *nrm2); +extern void quark_compactTest_single_false_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *inpHashes, uint32_t *d_validNonceTable,uint32_t *d_nonces1, uint32_t *nrm1); + diff --git a/quark/cuda_quark_blake512.cu b/quark/cuda_quark_blake512.cu new file mode 100644 index 0000000..9e70f33 --- /dev/null +++ b/quark/cuda_quark_blake512.cu @@ -0,0 +1,654 @@ +/* + Based upon Tanguy Pruvot's and SP's work + + Provos Alexis - 2016 +*/ +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#define TPB80 512 + +#define TPB52_64 192 +#define TPB50_64 192 + +__constant__ uint2 _ALIGN(16) c_m[16]; // padded message (80 bytes + padding) + +__constant__ uint2 _ALIGN(16) c_v[16]; //state + +__constant__ uint2 _ALIGN(16) c_x[128]; //precomputed xors + +// ---------------------------- BEGIN CUDA quark_blake512 functions ------------------------------------ + +__constant__ _ALIGN(16) uint2 z[16] = +{ + {0x85a308d3,0x243f6a88},{0x03707344,0x13198a2e},{0x299f31d0,0xa4093822},{0xec4e6c89,0x082efa98}, + {0x38d01377,0x452821e6},{0x34e90c6c,0xbe5466cf},{0xc97c50dd,0xc0ac29b7},{0xb5470917,0x3f84d5b5}, + {0x8979fb1b,0x9216d5d9},{0x98dfb5ac,0xd1310ba6},{0xd01adfb7,0x2ffd72db},{0x6a267e96,0xb8e1afed}, + {0xf12c7f99,0xba7c9045},{0xb3916cf7,0x24a19947},{0x858efc16,0x0801f2e2},{0x71574e69,0x636920d8} +}; + +__constant__ const uint2 h[8] = { + { 0xf3bcc908UL, 0x6a09e667UL }, + { 0x84caa73bUL, 0xbb67ae85UL }, + { 0xfe94f82bUL, 0x3c6ef372UL }, + { 0x5f1d36f1UL, 0xa54ff53aUL }, + { 0xade682d1UL, 0x510e527fUL }, + { 0x2b3e6c1fUL, 0x9b05688cUL }, + { 0xfb41bd6bUL, 0x1f83d9abUL }, + { 0x137e2179UL, 0x5be0cd19UL } + }; + +#define G4(x, a,b,c,d,a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3) { \ + v[a] += (m[c_sigma[i][x]] ^ z[c_sigma[i][x+1]]) + v[b]; \ + v[a1] += (m[c_sigma[i][x+2]] ^ z[c_sigma[i][x+3]]) + v[b1]; \ + v[a2] += (m[c_sigma[i][x+4]] ^ z[c_sigma[i][x+5]]) + v[b2]; \ + v[a3] += (m[c_sigma[i][x+6]] ^ z[c_sigma[i][x+7]]) + v[b3]; \ + v[d] = xorswap32(v[d] , v[a]); \ + v[d1] = xorswap32(v[d1] , v[a1]); \ + v[d2] = xorswap32(v[d2] , v[a2]); \ + v[d3] = xorswap32(v[d3] , v[a3]); \ + v[c] += v[d]; \ + v[c1] += v[d1]; \ + v[c2] += v[d2]; \ + v[c3] += v[d3]; \ + v[b] = ROR2( v[b] ^ v[c], 25); \ + v[b1] = ROR2( v[b1] ^ v[c1], 25); \ + v[b2] = ROR2( v[b2] ^ v[c2], 25); \ + v[b3] = ROR2( v[b3] ^ v[c3], 25); \ + v[a] += (m[c_sigma[i][x+1]] ^ z[c_sigma[i][x]]) + v[b]; \ + v[a1] += (m[c_sigma[i][x+3]] ^ z[c_sigma[i][x+2]]) + v[b1]; \ + v[a2] += (m[c_sigma[i][x+5]] ^ z[c_sigma[i][x+4]]) + v[b2]; \ + v[a3] += (m[c_sigma[i][x+7]] ^ z[c_sigma[i][x+6]]) + v[b3]; \ + v[d] = ROR16( v[d] ^ v[a]); \ + v[d1] = ROR16( v[d1] ^ v[a1]); \ + v[d2] = ROR16( v[d2] ^ v[a2]); \ + v[d3] = ROR16( v[d3] ^ v[a3]); \ + v[c] += v[d]; \ + v[c1] += v[d1]; \ + v[c2] += v[d2]; \ + v[c3] += v[d3]; \ + v[b] = ROR2( v[b] ^ v[c], 11); \ + v[b1] = ROR2( v[b1] ^ v[c1], 11); \ + v[b2] = ROR2( v[b2] ^ v[c2], 11); \ + v[b3] = ROR2( v[b3] ^ v[c3], 11); \ +} + +#define GS4(a,b,c,d,e,f,a1,b1,c1,d1,e1,f1,a2,b2,c2,d2,e2,f2,a3,b3,c3,d3,e3,f3){\ + v[ a]+= (m[ e] ^ z[ f]) + v[ b]; v[a1]+= (m[e1] ^ z[f1]) + v[b1]; v[a2]+= (m[e2] ^ z[f2]) + v[b2]; v[a3]+= (m[e3] ^ z[f3]) + v[b3];\ + v[ d] = SWAPDWORDS2(v[ d] ^ v[ a]); v[d1] = SWAPDWORDS2(v[d1] ^ v[a1]); v[d2] = SWAPDWORDS2(v[d2] ^ v[a2]); v[d3] = SWAPDWORDS2(v[d3] ^ v[a3]);\ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; v[c3]+= v[d3];\ + v[ b] = ROR2(v[b] ^ v[c], 25); v[b1] = ROR2(v[b1] ^ v[c1], 25); v[b2] = ROR2(v[b2] ^ v[c2], 25); v[b3] = ROR2(v[b3] ^ v[c3], 25); \ + v[ a]+= (m[ f] ^ z[ e]) + v[ b]; v[a1]+= (m[f1] ^ z[e1]) + v[b1]; v[a2]+= (m[f2] ^ z[e2]) + v[b2]; v[a3]+= (m[f3] ^ z[e3]) + v[b3];\ + v[ d] = ROR16(v[d] ^ v[a]); v[d1] = ROR16(v[d1] ^ v[a1]); v[d2] = ROR16(v[d2] ^ v[a2]); v[d3] = ROR16(v[d3] ^ v[a3]);\ + v[ c]+= v[ d]; v[c1]+= v[d1]; v[c2]+= v[d2]; v[c3]+= v[d3];\ + v[ b] = ROR2(v[b] ^ v[c], 11); v[b1] = ROR2(v[b1] ^ v[c1], 11); v[b2] = ROR2(v[b2] ^ v[c2], 11); v[b3] = ROR2(v[b3] ^ v[c3], 11);\ +} + +#define GSn4(a,b,c,d,e,f,a1,b1,c1,d1,e1,f1,a2,b2,c2,d2,e2,f2,a3,b3,c3,d3,e3,f3){\ + v[ a] = v[ a] + e + v[ b]; v[a1] = v[a1] + e1 + v[b1]; v[a2] = v[a2] + e2 + v[b2]; v[a3] = v[a3] + e3 + v[b3];\ + v[ d] = SWAPDWORDS2(v[ d] ^ v[ a]); v[d1] = SWAPDWORDS2(v[d1] ^ v[a1]); v[d2] = SWAPDWORDS2(v[d2] ^ v[a2]); v[d3] = SWAPDWORDS2(v[d3] ^ v[a3]);\ + v[ c] = v[ c] + v[ d]; v[c1] = v[c1] + v[d1]; v[c2] = v[c2] + v[d2]; v[c3] = v[c3] + v[d3];\ + v[ b] = ROR2(v[b] ^ v[c],25); v[b1] = ROR2(v[b1] ^ v[c1],25); v[b2] = ROR2(v[b2] ^ v[c2],25); v[b3] = ROR2(v[b3] ^ v[c3],25); \ + v[ a] = v[ a] + f + v[ b]; v[a1] = v[a1] + f1 + v[b1]; v[a2] = v[a2] + f2 + v[b2]; v[a3] = v[a3] + f3 + v[b3];\ + v[ d] = ROR16(v[d] ^ v[a]); v[d1] = ROR16(v[d1] ^ v[a1]); v[d2] = ROR16(v[d2] ^ v[a2]); v[d3] = ROR16(v[d3] ^ v[a3]);\ + v[ c] = v[ c] + v[ d]; v[c1] = v[c1] + v[d1]; v[c2] = v[c2] + v[d2]; v[c3] = v[c3] + v[d3];\ + v[ b] = ROR2(v[b] ^ v[c],11); v[b1] = ROR2(v[b1] ^ v[c1],11); v[b2] = ROR2(v[b2] ^ v[c2],11); v[b3] = ROR2(v[b3] ^ v[c3],11);\ +} + +#define GShost(a,b,c,d,e,f) { \ + v[a] += (m[e] ^ z[f]) + v[b]; \ + v[d] = ROTR64(v[d] ^ v[a],32); \ + v[c] += v[d]; \ + v[b] = ROTR64( v[b] ^ v[c], 25); \ + v[a] += (m[f] ^ z[e]) + v[b]; \ + v[d] = ROTR64( v[d] ^ v[a], 16); \ + v[c] += v[d]; \ + v[b] = ROTR64( v[b] ^ v[c], 11); \ +} + +__global__ +__launch_bounds__(192, 1) +void quark_blake512_gpu_hash_64(uint32_t threads, const uint32_t *const __restrict__ g_nonceVector, uint2* g_hash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : g_nonceVector[thread]; + + uint2 msg[16]; + + uint2x4 *phash = (uint2x4*)&g_hash[hashPosition<<3]; + uint2x4 *outpt = (uint2x4*)msg; + outpt[0] = __ldg4(&phash[0]); + outpt[1] = __ldg4(&phash[1]); + + uint2 m[16]; + m[ 0] = cuda_swab64_U2(msg[0]); + m[ 1] = cuda_swab64_U2(msg[1]); + m[ 2] = cuda_swab64_U2(msg[2]); + m[ 3] = cuda_swab64_U2(msg[3]); + m[ 4] = cuda_swab64_U2(msg[4]); + m[ 5] = cuda_swab64_U2(msg[5]); + m[ 6] = cuda_swab64_U2(msg[6]); + m[ 7] = cuda_swab64_U2(msg[7]); + m[ 8] = make_uint2(0,0x80000000); + m[ 9] = make_uint2(0,0); + m[10] = make_uint2(0,0); + m[11] = make_uint2(0,0); + m[12] = make_uint2(0,0); + m[13] = make_uint2(1,0); + m[14] = make_uint2(0,0); + m[15] = make_uint2(0x200,0); + + uint2 v[16] = { + h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7], + z[0], z[1], z[2], z[3], z[4], z[5], z[6], z[7] + }; + v[12].x ^= 512U; + v[13].x ^= 512U; + + GS4(0, 4, 8,12, 0, 1, 1, 5, 9,13, 2, 3, 2, 6,10,14, 4, 5, 3, 7,11,15, 6, 7); + GS4(0, 5,10,15, 8, 9, 1, 6,11,12,10,11, 2, 7, 8,13,12,13, 3, 4, 9,14,14,15); + + GS4(0, 4, 8, 12, 14, 10, 1, 5, 9, 13, 4, 8, 2, 6, 10, 14, 9, 15, 3, 7, 11, 15, 13, 6); + GS4(0, 5, 10, 15, 1, 12, 1, 6, 11, 12, 0, 2, 2, 7, 8, 13, 11, 7, 3, 4, 9, 14, 5, 3); + + GS4(0, 4, 8, 12, 11, 8, 1, 5, 9, 13, 12, 0, 2, 6, 10, 14, 5, 2, 3, 7, 11, 15, 15, 13); + GS4(0, 5, 10, 15, 10, 14, 1, 6, 11, 12, 3, 6, 2, 7, 8, 13, 7, 1, 3, 4, 9, 14, 9, 4); + + GS4(0, 4, 8, 12, 7, 9, 1, 5, 9, 13, 3, 1, 2, 6, 10, 14, 13, 12, 3, 7, 11, 15, 11, 14); + GS4(0, 5, 10, 15, 2, 6, 1, 6, 11, 12, 5, 10, 2, 7, 8, 13, 4, 0, 3, 4, 9, 14, 15, 8); + + GS4(0, 4, 8, 12, 9, 0, 1, 5, 9, 13, 5, 7, 2, 6, 10, 14, 2, 4, 3, 7, 11, 15, 10, 15); + GS4(0, 5, 10, 15, 14, 1, 1, 6, 11, 12, 11, 12, 2, 7, 8, 13, 6, 8, 3, 4, 9, 14, 3, 13); + + GS4(0, 4, 8, 12, 2, 12, 1, 5, 9, 13, 6, 10, 2, 6, 10, 14, 0, 11, 3, 7, 11, 15, 8, 3); + GS4(0, 5, 10, 15, 4, 13, 1, 6, 11, 12, 7, 5, 2, 7, 8, 13, 15, 14, 3, 4, 9, 14, 1, 9); + + GS4(0, 4, 8, 12, 12, 5, 1, 5, 9, 13, 1, 15, 2, 6, 10, 14, 14, 13, 3, 7, 11, 15, 4, 10); + GS4(0, 5, 10, 15, 0, 7, 1, 6, 11, 12, 6, 3, 2, 7, 8, 13, 9, 2, 3, 4, 9, 14, 8, 11); + + GS4(0, 4, 8, 12, 13, 11, 1, 5, 9, 13, 7, 14, 2, 6, 10, 14, 12, 1, 3, 7, 11, 15, 3, 9); + GS4(0, 5, 10, 15, 5, 0, 1, 6, 11, 12, 15, 4, 2, 7, 8, 13, 8, 6, 3, 4, 9, 14, 2, 10); + + GS4(0, 4, 8, 12, 6, 15, 1, 5, 9, 13, 14, 9, 2, 6, 10, 14, 11, 3, 3, 7, 11, 15, 0, 8); + GS4(0, 5, 10, 15, 12, 2, 1, 6, 11, 12, 13, 7, 2, 7, 8, 13, 1, 4, 3, 4, 9, 14, 10, 5); + + GS4(0, 4, 8, 12, 10, 2, 1, 5, 9, 13, 8, 4, 2, 6, 10, 14, 7, 6, 3, 7, 11, 15, 1, 5); + GS4(0, 5, 10, 15,15,11, 1, 6, 11, 12, 9, 14, 2, 7, 8, 13, 3, 12, 3, 4, 9, 14, 13, 0); + +// #if __CUDA_ARCH__ == 500 + + GS4(0, 4, 8,12, 0, 1, 1, 5, 9,13, 2, 3, 2, 6,10,14, 4, 5, 3, 7,11,15, 6, 7); + GS4(0, 5,10,15, 8, 9, 1, 6,11,12,10,11, 2, 7, 8,13,12,13, 3, 4, 9,14,14,15); + + GS4(0, 4, 8, 12, 14, 10, 1, 5, 9, 13, 4, 8, 2, 6, 10, 14, 9, 15, 3, 7, 11, 15, 13, 6); + GS4(0, 5, 10, 15, 1, 12, 1, 6, 11, 12, 0, 2, 2, 7, 8, 13, 11, 7, 3, 4, 9, 14, 5, 3); + + GS4(0, 4, 8, 12, 11, 8, 1, 5, 9, 13, 12, 0, 2, 6, 10, 14, 5, 2, 3, 7, 11, 15, 15, 13); + GS4(0, 5, 10, 15, 10, 14, 1, 6, 11, 12, 3, 6, 2, 7, 8, 13, 7, 1, 3, 4, 9, 14, 9, 4); + + GS4(0, 4, 8, 12, 7, 9, 1, 5, 9, 13, 3, 1, 2, 6, 10, 14, 13, 12, 3, 7, 11, 15, 11, 14); + GS4(0, 5, 10, 15, 2, 6, 1, 6, 11, 12, 5, 10, 2, 7, 8, 13, 4, 0, 3, 4, 9, 14, 15, 8); + + GS4(0, 4, 8, 12, 9, 0, 1, 5, 9, 13, 5, 7, 2, 6, 10, 14, 2, 4, 3, 7, 11, 15, 10, 15); + GS4(0, 5, 10, 15, 14, 1, 1, 6, 11, 12, 11, 12, 2, 7, 8, 13, 6, 8, 3, 4, 9, 14, 3, 13); + + GS4(0, 4, 8, 12, 2, 12, 1, 5, 9, 13, 6, 10, 2, 6, 10, 14, 0, 11, 3, 7, 11, 15, 8, 3); + GS4(0, 5, 10, 15, 4, 13, 1, 6, 11, 12, 7, 5, 2, 7, 8, 13, 15, 14, 3, 4, 9, 14, 1, 9); + +// #else*/ +/* + for (int i = 0; i < 6; i++) + { + G4(0, 0, 4, 8,12, 1, 5, 9,13, 2, 6,10,14, 3, 7,11,15); + G4(8, 0, 5,10,15, 1, 6,11,12, 2, 7, 8,13, 3, 4, 9,14); + } +*/ +// #endif + v[0] = cuda_swab64_U2(xor3x(v[0],h[0],v[ 8])); + v[1] = cuda_swab64_U2(xor3x(v[1],h[1],v[ 9])); + v[2] = cuda_swab64_U2(xor3x(v[2],h[2],v[10])); + v[3] = cuda_swab64_U2(xor3x(v[3],h[3],v[11])); + v[4] = cuda_swab64_U2(xor3x(v[4],h[4],v[12])); + v[5] = cuda_swab64_U2(xor3x(v[5],h[5],v[13])); + v[6] = cuda_swab64_U2(xor3x(v[6],h[6],v[14])); + v[7] = cuda_swab64_U2(xor3x(v[7],h[7],v[15])); + +/* uint2* outHash = &g_hash[hashPosition<<3]; + #pragma unroll 8 + for(uint32_t i=0;i<8;i++){ + outHash[i] = v[i]; + }*/ + phash[0] = *(uint2x4*)&v[ 0]; + phash[1] = *(uint2x4*)&v[ 4]; + } +} + +__global__ __launch_bounds__(TPB80,2) +void quark_blake512_gpu_hash_80(const uint32_t threads,const uint32_t startNounce, uint2x4 *const __restrict__ g_hash){ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint2 v[16]; + uint2 m[10]; + uint2 xors[16]; + + const uint2 h[8] = { + {0xf3bcc908,0x6a09e667}, {0x84caa73b,0xbb67ae85},{0xfe94f82b,0x3c6ef372}, {0x5f1d36f1,0xa54ff53a}, + {0xade682d1,0x510e527f}, {0x2b3e6c1f,0x9b05688c},{0xfb41bd6b,0x1f83d9ab}, {0x137e2179,0x5be0cd19} + }; + const uint2 z[16] = { + {0x85a308d3,0x243f6a88},{0x03707344,0x13198a2e},{0x299f31d0,0xa4093822},{0xec4e6c89,0x082efa98}, + {0x38d01377,0x452821e6},{0x34e90c6c,0xbe5466cf},{0xc97c50dd,0xc0ac29b7},{0xb5470917,0x3f84d5b5}, + {0x8979fb1b,0x9216d5d9},{0x98dfb5ac,0xd1310ba6},{0xd01adfb7,0x2ffd72db},{0x6a267e96,0xb8e1afed}, + {0xf12c7f99,0xba7c9045},{0xb3916cf7,0x24a19947},{0x858efc16,0x0801f2e2},{0x71574e69,0x636920d8} + }; + const uint32_t m150 = 0x280 ^ z[ 9].x;//make_uint2(0x280,0) ^ z[ 9];//2 + const uint32_t m151 = 0x280 ^ z[13].x;//2 + const uint32_t m152 = 0x280 ^ z[ 8].x;//2 + const uint32_t m153 = 0x280 ^ z[10].x;//2 + const uint32_t m154 = 0x280 ^ z[14].x;//3 + const uint32_t m155 = 0x280 ^ z[ 1].x;//1 + const uint32_t m156 = 0x280 ^ z[ 4].x;//1 + const uint32_t m157 = 0x280 ^ z[ 6].x;//1 + const uint32_t m158 = 0x280 ^ z[11].x;//1 + + const uint32_t m130 = 0x01 ^ z[ 6].x;//2 + const uint32_t m131 = 0x01 ^ z[15].x;//2 + const uint32_t m132 = 0x01 ^ z[12].x;//3 + const uint32_t m133 = 0x01 ^ z[ 3].x;//2 + const uint32_t m134 = 0x01 ^ z[ 4].x;//2 + const uint32_t m135 = 0x01 ^ z[14].x;//1 + const uint32_t m136 = 0x01 ^ z[11].x;//1 + const uint32_t m137 = 0x01 ^ z[ 7].x;//1 + const uint32_t m138 = 0x01 ^ z[ 0].x;//1 + + const uint32_t m100 = 0x80000000 ^ z[14].y;//4 + const uint32_t m101 = 0x80000000 ^ z[ 5].y;//3 + const uint32_t m102 = 0x80000000 ^ z[15].y;//2 + const uint32_t m103 = 0x80000000 ^ z[ 6].y;//2 + const uint32_t m104 = 0x80000000 ^ z[ 4].y;//1 + const uint32_t m105 = 0x80000000 ^ z[ 2].y;//2 + const uint32_t m106 = 0x80000000 ^ z[11].y;//2 + + if (thread < threads){ + + int i=0; + + #pragma unroll 10 + for (int i=0; i < 10; ++i) + m[i] = c_m[i]; + + + m[ 9].x = startNounce + thread; + + #pragma unroll 16 + for(int i=0; i < 16; i++) + v[i] = c_v[i]; + +// GSn( 0, 5,10,15, 8, 9); + v[ 0]+= (m[ 9] ^ z[ 8]); + v[15] = ROR16(v[15] ^ v[ 0]); + v[10]+= v[15]; + v[ 5] = ROR2(v[ 5] ^ v[10], 11); + + xors[ 0] = z[10]; xors[ 1] = c_x[i++]; xors[ 2] = m[ 9]^z[15]; xors[ 3] = make_uint2(m130,z[ 6].y); + xors[ 4] = make_uint2(z[14].x,m100); xors[ 5] = c_x[i++]; xors[ 6] = make_uint2(m150,z[9].y); xors[ 7] = c_x[i++]; + + xors[ 8] = c_x[i++]; xors[ 9] = c_x[i++]; xors[10] = z[ 7]; xors[11] = c_x[i++]; + xors[12] = z[ 1]; xors[13] = c_x[i++]; xors[14] = c_x[i++]; xors[15] = c_x[i++]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //2:{11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } + xors[ 0] = z[ 8]; xors[ 1] = z[ 0]; xors[ 2] = c_x[i++]; xors[ 3] = make_uint2(m151,z[13].y); + xors[ 4] = c_x[i++]; xors[ 5] = c_x[i++]; xors[ 6] = c_x[i++]; xors[ 7] = make_uint2(m131,z[15].y); + + xors[ 8] = make_uint2(z[14].x,m100); xors[ 9] = c_x[i++]; xors[10] = c_x[i++]; xors[11] = m[ 9]^z[ 4]; + xors[12] = z[10]; xors[13] = c_x[i++]; xors[14] = c_x[i++]; xors[15] = c_x[i++]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //3:{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } + xors[ 0] = c_x[i++]; xors[ 1] = c_x[i++]; xors[ 2] = make_uint2(m132,z[12].y); xors[ 3] = z[14]; + xors[ 4] = m[ 9]^z[ 7]; xors[ 5] = c_x[i++]; xors[ 6] = z[13]; xors[ 7] = c_x[i++]; + + xors[ 8] = c_x[i++]; xors[ 9] = c_x[i++]; xors[10] = c_x[i++]; xors[11] = make_uint2(m152,z[ 8].y); + xors[12] = c_x[i++]; xors[13] = make_uint2(z[ 5].x,m101); xors[14] = c_x[i++]; xors[15] = c_x[i++]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //4:{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } + xors[ 0] = m[ 9]^z[ 0]; xors[ 1] = c_x[i++]; xors[ 2] = c_x[i++]; xors[ 3] = make_uint2(z[15].x,m102); + xors[ 4] = c_x[i++]; xors[ 5] = c_x[i++]; xors[ 6] = c_x[i++]; xors[ 7] = make_uint2(m153,z[10].y); + + xors[ 8] = z[ 1]; xors[ 9] = z[12]; xors[10] = c_x[i++]; xors[11] = c_x[i++]; + xors[12] = c_x[i++]; xors[13] = z[11]; xors[14] = c_x[i++]; xors[15] = make_uint2(m133,z[ 3].y); + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //5:{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } + xors[ 0] = c_x[i++]; xors[ 1] = c_x[i++]; xors[ 2] = c_x[i++]; xors[ 3] = c_x[i++]; + xors[ 4] = z[ 2]; xors[ 5] = make_uint2(z[ 6].x,m103); xors[ 6] = z[ 0]; xors[ 7] = c_x[i++]; + + xors[ 8] = c_x[i++]; xors[ 9] = c_x[i++]; xors[10] = make_uint2(m154,z[14].y); xors[11] = c_x[i++]; + xors[12] = make_uint2(m134,z[ 4].y); xors[13] = c_x[i++]; xors[14] = z[15]; xors[15] = m[ 9]^z[ 1]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //6:{12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } + xors[ 0] = z[ 5]; xors[ 1] = c_x[i++]; xors[ 2] = z[13]; xors[ 3] = c_x[i++]; + xors[ 4] = c_x[i++]; xors[ 5] = make_uint2(m155,z[ 1].y); xors[ 6] = make_uint2(m135,z[14].y); xors[ 7] = make_uint2(z[ 4].x,m104); + + xors[ 8] = c_x[i++]; xors[ 9] = c_x[i++]; xors[10] = m[ 9]^z[ 2]; xors[11] = c_x[i++]; + xors[12] = c_x[i++]; xors[13] = c_x[i++]; xors[14] = c_x[i++]; xors[15] = z[ 8]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //7:{13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } + xors[ 0] = make_uint2(m136,z[11].y); xors[ 1] = c_x[i++]; xors[ 2] = z[ 1]; xors[ 3] = c_x[i++]; + xors[ 4] = z[13]; xors[ 5] = z[ 7]; xors[ 6] = c_x[i++]; xors[ 7] = m[ 9]^z[ 3]; + + xors[ 8] = c_x[i++]; xors[ 9] = make_uint2(m156,z[ 4].y); xors[10] = c_x[i++]; xors[11] = c_x[i++]; + xors[12] = c_x[i++]; xors[13] = c_x[i++]; xors[14] = c_x[i++]; xors[15] = make_uint2(z[ 2].x,m105); + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //8:{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } + xors[ 0] = c_x[i++]; xors[ 1] = z[ 9]; xors[ 2] = z[ 3]; xors[ 3] = c_x[i++]; + xors[ 4] = make_uint2(m157,z[ 6].y); xors[ 5] = m[ 9] ^ z[14]; xors[ 6] = c_x[i++]; xors[ 7] = c_x[i++]; + + xors[ 8] = z[ 2]; xors[ 9] = make_uint2(m137,z[ 7].y); xors[10] = c_x[i++]; xors[11] = make_uint2(z[ 5].x,m101); + xors[12] = c_x[i++]; xors[13] = c_x[i++]; xors[14] = c_x[i++]; xors[15] = c_x[i++]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //9:{10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } + xors[ 0] = make_uint2(z[ 2].x,m105); xors[ 1] = c_x[i++]; xors[ 2] = c_x[i++]; xors[ 3] = c_x[i++]; + xors[ 4] = c_x[i++]; xors[ 5] = c_x[i++]; xors[ 6] = c_x[i++]; xors[ 7] = c_x[i++]; + + xors[ 8] = make_uint2(m158,z[11].y); xors[ 9] = m[ 9]^z[14]; xors[10] = c_x[i++]; xors[11] = make_uint2(m138,z[ 0].y); + xors[12] = z[15]; xors[13] = z[ 9]; xors[14] = z[ 3]; xors[15] = c_x[i++]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + //10:{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } + xors[ 0] = c_x[i++]; xors[ 1] = c_x[i++]; xors[ 2] = c_x[i++]; xors[ 3] = c_x[i++]; + xors[ 4] = c_x[i++]; xors[ 5] = c_x[i++]; xors[ 6] = c_x[i++]; xors[ 7] = c_x[i++]; + + xors[ 8] = c_x[i++]; xors[ 9] = make_uint2(z[11].x,m106); xors[10] = z[13]; xors[11] = z[15]; + xors[12] = m[ 9]^z[ 8]; xors[13] = z[10]; xors[14] = make_uint2(m132,z[12].y); xors[15] = make_uint2(m154,z[14].y); + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); +//------------------ + i=0; + //11:{14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } + xors[ 0] = z[10]; xors[ 1] = c_x[i++]; xors[ 2] = m[ 9]^z[15]; xors[ 3] = make_uint2(m130,z[ 6].y); + xors[ 4] = make_uint2(z[14].x,m100); xors[ 5] = c_x[i++]; xors[ 6] = make_uint2(m150,z[9].y); xors[ 7] = c_x[i++]; + + xors[ 8] = c_x[i++]; xors[ 9] = c_x[i++]; xors[10] = z[ 7]; xors[11] = c_x[i++]; + xors[12] = z[ 1]; xors[13] = c_x[i++]; xors[14] = c_x[i++]; xors[15] = c_x[i++]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //12:{11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } + xors[ 0] = z[ 8]; xors[ 1] = z[ 0]; xors[ 2] = c_x[i++]; xors[ 3] = make_uint2(m151,z[13].y); + xors[ 4] = c_x[i++]; xors[ 5] = c_x[i++]; xors[ 6] = c_x[i++]; xors[ 7] = make_uint2(m131,z[15].y); + + xors[ 8] = make_uint2(z[14].x,m100); xors[ 9] = c_x[i++]; xors[10] = c_x[i++]; xors[11] = m[ 9]^z[ 4]; + xors[12] = z[10]; xors[13] = c_x[i++]; xors[14] = c_x[i++]; xors[15] = c_x[i++]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //13:{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } + xors[ 0] = c_x[i++]; xors[ 1] = c_x[i++]; xors[ 2] = make_uint2(m132,z[12].y); xors[ 3] = z[14]; + xors[ 4] = m[ 9]^z[ 7]; xors[ 5] = c_x[i++]; xors[ 6] = z[13]; xors[ 7] = c_x[i++]; + + xors[ 8] = c_x[i++]; xors[ 9] = c_x[i++]; xors[10] = c_x[i++]; xors[11] = make_uint2(m152,z[ 8].y); + xors[12] = c_x[i++]; xors[13] = make_uint2(z[ 5].x,m101); xors[14] = c_x[i++]; xors[15] = c_x[i++]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + //14:{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } + xors[ 0] = m[ 9]^z[ 0]; xors[ 1] = c_x[i++]; xors[ 2] = c_x[i++]; xors[ 3] = make_uint2(z[15].x,m102); + xors[ 4] = c_x[i++]; xors[ 5] = c_x[i++]; xors[ 6] = c_x[i++]; xors[ 7] = make_uint2(m153,z[10].y); + + xors[ 8] = z[ 1]; xors[ 9] = z[12]; xors[10] = c_x[i++]; xors[11] = c_x[i++]; + xors[12] = c_x[i++]; xors[13] = z[11]; xors[14] = c_x[i++]; xors[15] = make_uint2(m133,z[ 3].y); + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + //15:{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } + xors[ 0] = c_x[i++]; xors[ 1] = c_x[i++]; xors[ 2] = c_x[i++]; xors[ 3] = c_x[i++]; + xors[ 4] = z[ 2]; xors[ 5] = make_uint2(z[ 6].x,m103); xors[ 6] = z[ 0]; xors[ 7] = c_x[i++]; + + xors[ 8] = c_x[i++]; xors[ 9] = c_x[i++]; xors[10] = make_uint2(m154,z[14].y); xors[11] = c_x[i++]; + xors[12] = make_uint2(m134,z[ 4].y); xors[13] = c_x[i++]; xors[14] = z[15]; xors[15] = m[ 9]^z[ 1]; + + GSn4(0, 4, 8,12, xors[ 0],xors[ 4], 1, 5, 9,13, xors[ 1],xors[ 5], 2, 6,10,14, xors[ 2],xors[ 6], 3, 7,11,15, xors[ 3],xors[ 7]); + GSn4(0, 5,10,15, xors[ 8],xors[12], 1, 6,11,12, xors[ 9],xors[13], 2, 7, 8,13, xors[10],xors[14], 3, 4, 9,14, xors[11],xors[15]); + + v[0] = cuda_swab64_U2(xor3x(v[0],h[0],v[ 8])); + v[1] = cuda_swab64_U2(xor3x(v[1],h[1],v[ 9])); + v[2] = cuda_swab64_U2(xor3x(v[2],h[2],v[10])); + v[3] = cuda_swab64_U2(xor3x(v[3],h[3],v[11])); + v[4] = cuda_swab64_U2(xor3x(v[4],h[4],v[12])); + v[5] = cuda_swab64_U2(xor3x(v[5],h[5],v[13])); + v[6] = cuda_swab64_U2(xor3x(v[6],h[6],v[14])); + v[7] = cuda_swab64_U2(xor3x(v[7],h[7],v[15])); + + uint2x4* outpt = &g_hash[thread<<1]; + outpt[0] = *(uint2x4*)&v[0]; + outpt[1] = *(uint2x4*)&v[4]; + } +} + +__host__ +void quark_blake512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_outputHash){ + uint32_t tpb = TPB52_64; + int dev_id = device_map[thr_id]; + + if (device_sm[dev_id] <= 500) tpb = TPB50_64; + const dim3 grid((threads + tpb-1)/tpb); + const dim3 block(tpb); + quark_blake512_gpu_hash_64<<>>(threads, d_nonceVector, (uint2*)d_outputHash); +} + +__host__ +void quark_blake512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_outputHash){ + dim3 grid((threads + TPB80-1)/TPB80); + dim3 block(TPB80); + + quark_blake512_gpu_hash_80<<>>(threads, startNounce, (uint2x4*)d_outputHash); +} + +// ---------------------------- END CUDA quark_blake512 functions ------------------------------------ + +// ----------------------------- Host midstate for 80-bytes input ------------------------------------ +__host__ +void quark_blake512_cpu_setBlock_80(int thr_id, uint32_t *endiandata){ + uint64_t m[16],v[16],xors[128]; + memcpy(m, endiandata, 80); + m[10] = 0x8000000000000000ull; + m[11] = 0; + m[12] = 0; + m[13] = 0x01; + m[14] = 0; + m[15] = 0x280; + + for(int i=0;i<10;i++){ + m[ i] = cuda_swab64(m[ i]); + } + + uint64_t h[8] = { + 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, + 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL + }; + + const uint64_t z[16] = { + 0x243f6a8885a308d3ULL, 0x13198a2e03707344ULL, 0xa4093822299f31d0ULL, 0x082efa98ec4e6c89ULL, + 0x452821e638d01377ULL, 0xbe5466cf34e90c6cULL, 0xc0ac29b7c97c50ddULL, 0x3f84d5b5b5470917ULL, + 0x9216d5d98979fb1bULL, 0xd1310ba698dfb5acULL, 0x2ffd72dbd01adfb7ULL, 0xb8e1afed6a267e96ULL, + 0xba7c9045f12c7f99ULL, 0x24a19947b3916cf7ULL, 0x0801f2e2858efc16ULL, 0x636920d871574e69ULL + }; + + for(int i=0;i<8;i++){ + v[ i] = h[ i]; + } + v[ 8] = z[0]; + v[ 9] = z[1]; + v[10] = z[2]; + v[11] = z[3]; + v[12] = z[4] ^ 640; + v[13] = z[5] ^ 640; + v[14] = z[6]; + v[15] = z[7]; + + /* column step */ + GShost( 0, 4, 8,12, 0, 1); + GShost( 1, 5, 9,13, 2, 3); + GShost( 2, 6,10,14, 4, 5); + GShost( 3, 7,11,15, 6, 7); + + GShost( 1, 6,11,12,10,11); + GShost( 2, 7, 8,13,12,13); + GShost( 3, 4, 9,14,14,15); +/* + v[a] += (m[e] ^ z[f]) + v[b]; \ + v[d] = ROTR64(v[d] ^ v[a],32); \ + v[c] += v[d]; \ + v[b] = ROTR64( v[b] ^ v[c], 25); \ + v[a] += (m[f] ^ z[e]) + v[b]; \ + v[d] = ROTR64( v[d] ^ v[a], 16); \ + v[c] += v[d]; + v[b] = ROTR64( v[b] ^ v[c], 11); +*/ + + v[ 0]+= (m[ 8] ^ z[ 9]) + v[ 5]; + v[15] = ROTR64(v[15]^v[ 0],32); + v[10]+= v[15]; + v[ 5] = ROTR64(v[ 5] ^ v[10], 25); + + v[ 0]+= v[ 5]; + + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_m, m, sizeof(m), 0, cudaMemcpyHostToDevice)); + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_v, v, sizeof(m), 0, cudaMemcpyHostToDevice)); + + int i=0; + + xors[i++] = m[ 4]^z[ 8]; + xors[i++] = m[ 8]^z[ 4]; + xors[i++] = m[ 6]^z[13]; + xors[i++] = m[ 1]^z[12]; + xors[i++] = m[ 0]^z[ 2]; + xors[i++] = m[ 5]^z[ 3]; + xors[i++] = m[ 2]^z[ 0]; + xors[i++] = m[ 7]^z[11]; + xors[i++] = m[ 3]^z[ 5]; +//2 + xors[i++] = m[ 5]^z[ 2]; + xors[i++] = m[ 8]^z[11]; + xors[i++] = m[ 0]^z[12]; + xors[i++] = m[ 2]^z[ 5]; + xors[i++] = m[ 3]^z[ 6]; + xors[i++] = m[ 7]^z[ 1]; + xors[i++] = m[ 6]^z[ 3]; + xors[i++] = m[ 1]^z[ 7]; + xors[i++] = m[ 4]^z[ 9]; +//3 + xors[i++] = m[ 7]^z[ 9]; + xors[i++] = m[ 3]^z[ 1]; + xors[i++] = m[ 1]^z[ 3]; + xors[i++] = m[14]^z[11]; + xors[i++] = m[ 2]^z[ 6]; + xors[i++] = m[ 5]^z[10]; + xors[i++] = m[ 4]^z[ 0]; + xors[i++] = m[ 6]^z[ 2]; + xors[i++] = m[ 0]^z[ 4]; + xors[i++] = m[ 8]^z[15]; +//4 + xors[i++] = m[ 5]^z[ 7]; + xors[i++] = m[ 2]^z[ 4]; + xors[i++] = m[ 0]^z[ 9]; + xors[i++] = m[ 7]^z[ 5]; + xors[i++] = m[ 4]^z[ 2]; + xors[i++] = m[ 6]^z[ 8]; + xors[i++] = m[ 3]^z[13]; + xors[i++] = m[ 1]^z[14]; + xors[i++] = m[ 8]^z[ 6]; +//5 + xors[i++] = m[ 2]^z[12]; + xors[i++] = m[ 6]^z[10]; + xors[i++] = m[ 0]^z[11]; + xors[i++] = m[ 8]^z[ 3]; + xors[i++] = m[ 3]^z[ 8]; + xors[i++] = m[ 4]^z[13]; + xors[i++] = m[ 7]^z[ 5]; + xors[i++] = m[ 1]^z[ 9]; + xors[i++] = m[ 5]^z[ 7]; +//6 + xors[i++] = m[ 1]^z[15]; + xors[i++] = m[ 4]^z[10]; + xors[i++] = m[ 5]^z[12]; + xors[i++] = m[ 0]^z[ 7]; + xors[i++] = m[ 6]^z[ 3]; + xors[i++] = m[ 8]^z[11]; + xors[i++] = m[ 7]^z[ 0]; + xors[i++] = m[ 3]^z[ 6]; + xors[i++] = m[ 2]^z[ 9]; +//7 + xors[i++] = m[ 7]^z[14]; + xors[i++] = m[ 3]^z[ 9]; + xors[i++] = m[ 1]^z[12]; + xors[i++] = m[ 5]^z[ 0]; + xors[i++] = m[ 8]^z[ 6]; + xors[i++] = m[ 2]^z[10]; + xors[i++] = m[ 0]^z[ 5]; + xors[i++] = m[ 4]^z[15]; + xors[i++] = m[ 6]^z[ 8]; +//8 + xors[i++] = m[ 6]^z[15]; + xors[i++] = m[ 0]^z[ 8]; + xors[i++] = m[ 3]^z[11]; + xors[i++] = m[ 8]^z[ 0]; + xors[i++] = m[ 1]^z[ 4]; + xors[i++] = m[ 2]^z[12]; + xors[i++] = m[ 7]^z[13]; + xors[i++] = m[ 4]^z[ 1]; + xors[i++] = m[ 5]^z[10]; +//9 + xors[i++] = m[ 8]^z[ 4]; + xors[i++] = m[ 7]^z[ 6]; + xors[i++] = m[ 1]^z[ 5]; + xors[i++] = m[ 2]^z[10]; + xors[i++] = m[ 4]^z[ 8]; + xors[i++] = m[ 6]^z[ 7]; + xors[i++] = m[ 5]^z[ 1]; + xors[i++] = m[ 3]^z[12]; + xors[i++] = m[ 0]^z[13]; +//10 + xors[i++] = m[ 0]^z[ 1]; + xors[i++] = m[ 2]^z[ 3]; + xors[i++] = m[ 4]^z[ 5]; + xors[i++] = m[ 6]^z[ 7]; + xors[i++] = m[ 1]^z[ 0]; + xors[i++] = m[ 3]^z[ 2]; + xors[i++] = m[ 5]^z[ 4]; + xors[i++] = m[ 7]^z[ 6]; + xors[i++] = m[ 8]^z[ 9]; + + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_x,xors, i*sizeof(uint2), 0, cudaMemcpyHostToDevice)); +} diff --git a/quark/cuda_quark_compactionTest.cu b/quark/cuda_quark_compactionTest.cu new file mode 100644 index 0000000..258898d --- /dev/null +++ b/quark/cuda_quark_compactionTest.cu @@ -0,0 +1,326 @@ +#include +#include + +#include "cuda_helper.h" +#include + +static uint32_t *d_tempBranch1Nonces[MAX_GPUS]; +static uint32_t *d_numValid[MAX_GPUS]; +static uint32_t *h_numValid[MAX_GPUS]; + +static uint32_t *d_partSum[2][MAX_GPUS]; // fuer bis zu vier partielle Summen + + +// True/False tester +typedef uint32_t(*cuda_compactTestFunction_t)(uint32_t *inpHash); + +__device__ __forceinline__ uint32_t QuarkTrueTest(uint32_t *inpHash) +{ + return ((inpHash[0] & 0x08) == 0x08); +} + +__device__ __forceinline__ uint32_t QuarkFalseTest(uint32_t *inpHash) +{ + return ((inpHash[0] & 0x08) == 0); +} + +__device__ cuda_compactTestFunction_t d_QuarkTrueFunction = QuarkTrueTest, d_QuarkFalseFunction = QuarkFalseTest; + +cuda_compactTestFunction_t h_QuarkTrueFunction[MAX_GPUS], h_QuarkFalseFunction[MAX_GPUS]; + +// Setup-Funktionen +__host__ void quark_compactTest_cpu_init(int thr_id, uint32_t threads) +{ + cudaMemcpyFromSymbol(&h_QuarkTrueFunction[thr_id], d_QuarkTrueFunction, sizeof(cuda_compactTestFunction_t)); + cudaMemcpyFromSymbol(&h_QuarkFalseFunction[thr_id], d_QuarkFalseFunction, sizeof(cuda_compactTestFunction_t)); + + // wir brauchen auch Speicherplatz auf dem Device + cudaMalloc(&d_tempBranch1Nonces[thr_id], sizeof(uint32_t) * threads * 2); + cudaMalloc(&d_numValid[thr_id], 2*sizeof(uint32_t)); + cudaMallocHost(&h_numValid[thr_id], 2*sizeof(uint32_t)); + + uint32_t s1; + s1 = (threads / 256) * 2; + + cudaMalloc(&d_partSum[0][thr_id], sizeof(uint32_t) * s1); // BLOCKSIZE (Threads/Block) + cudaMalloc(&d_partSum[1][thr_id], sizeof(uint32_t) * s1); // BLOCKSIZE (Threads/Block) +} + +// Because all alloc should have a free... +__host__ +void quark_compactTest_cpu_free(int thr_id) +{ + int dev_id = device_map[thr_id]; + + cudaFreeHost(h_numValid[thr_id]); + + if (cuda_arch[dev_id] >= 300) { + cudaFree(d_tempBranch1Nonces[thr_id]); + cudaFree(d_partSum[0][thr_id]); + cudaFree(d_partSum[1][thr_id]); + } else { + cudaFree(d_tempBranch1Nonces[thr_id]); + } +} + +#if __CUDA_ARCH__ < 300 +/** + * __shfl_up() calculates a source lane ID by subtracting delta from the caller's lane ID, and clamping to the range 0..width-1 + */ +#undef __shfl_up +#define __shfl_up(var, delta, width) (0) +#endif + +// Die Summenfunktion (vom NVIDIA SDK) +__global__ void quark_compactTest_gpu_SCAN(uint32_t *data, int width, uint32_t *partial_sums=NULL,const cuda_compactTestFunction_t testFunc=NULL, uint32_t threads=0, uint32_t *inpHashes=NULL, uint32_t *d_validNonceTable=NULL) +{ + __shared__ uint32_t sums[32]; + int id = ((blockIdx.x * blockDim.x) + threadIdx.x); + //int lane_id = id % warpSize; + int lane_id = id % width; + // determine a warp_id within a block + //int warp_id = threadIdx.x / warpSize; + int warp_id = threadIdx.x / width; + + sums[lane_id] = 0; + + // Below is the basic structure of using a shfl instruction + // for a scan. + // Record "value" as a variable - we accumulate it along the way + uint32_t value; + if(testFunc != NULL) + { + if (id < threads) + { + uint32_t *inpHash; + if(d_validNonceTable == NULL) + { + // keine Nonce-Liste + inpHash = &inpHashes[id<<4]; + }else + { + // Nonce-Liste verfügbar + int nonce = d_validNonceTable[id]; + inpHash = &inpHashes[nonce<<4]; + } + value = (*testFunc)(inpHash); + }else + { + value = 0; + } + }else + { + value = data[id]; + } + + __syncthreads(); + + // Now accumulate in log steps up the chain + // compute sums, with another thread's value who is + // distance delta away (i). Note + // those threads where the thread 'i' away would have + // been out of bounds of the warp are unaffected. This + // creates the scan sum. +#pragma unroll + + for (int i=1; i<=width; i*=2) + { + uint32_t n = __shfl_up((int)value, i, width); + + if (lane_id >= i) value += n; + } + + // value now holds the scan value for the individual thread + // next sum the largest values for each warp + + // write the sum of the warp to smem + //if (threadIdx.x % warpSize == warpSize-1) + if (threadIdx.x % width == width-1) + { + sums[warp_id] = value; + } + + __syncthreads(); + + // + // scan sum the warp sums + // the same shfl scan operation, but performed on warp sums + // + if (warp_id == 0) + { + uint32_t warp_sum = sums[lane_id]; + + for (int i=1; i<=width; i*=2) + { + uint32_t n = __shfl_up((int)warp_sum, i, width); + + if (lane_id >= i) warp_sum += n; + } + + sums[lane_id] = warp_sum; + } + + __syncthreads(); + + // perform a uniform add across warps in the block + // read neighbouring warp's sum and add it to threads value + uint32_t blockSum = 0; + + if (warp_id > 0) + { + blockSum = sums[warp_id-1]; + } + + value += blockSum; + + // Now write out our result + data[id] = value; + + // last thread has sum, write write out the block's sum + if (partial_sums != NULL && threadIdx.x == blockDim.x-1) + { + partial_sums[blockIdx.x] = value; + } +} + +// Uniform add: add partial sums array +__global__ void quark_compactTest_gpu_ADD(uint32_t *data, uint32_t *partial_sums, int len) +{ + __shared__ uint32_t buf; + int id = ((blockIdx.x * blockDim.x) + threadIdx.x); + + if (id > len) return; + + if (threadIdx.x == 0) + { + buf = partial_sums[blockIdx.x]; + } + + __syncthreads(); + data[id] += buf; +} + +// Der Scatter +__global__ +void quark_compactTest_gpu_SCATTER(uint32_t *sum, uint32_t *outp,const cuda_compactTestFunction_t testFunc, uint32_t threads=0, uint32_t *inpHashes=NULL, uint32_t *d_validNonceTable=NULL) +{ + int id = ((blockIdx.x * blockDim.x) + threadIdx.x); + uint32_t actNounce = id; + uint32_t value; + if (id < threads) + { + uint32_t *inpHash; + if(d_validNonceTable == NULL) + { + // keine Nonce-Liste + inpHash = &inpHashes[id<<4]; + }else + { + // Nonce-Liste verfügbar + int nonce = d_validNonceTable[id]; + actNounce = nonce; + inpHash = &inpHashes[nonce<<4]; + } + + value = (*testFunc)(inpHash); + }else + { + value = 0; + } + + if( value ) + { + int idx = sum[id]; + if(idx > 0) + outp[idx-1] = actNounce; + } +} + +__host__ static uint32_t quark_compactTest_roundUpExp(uint32_t val) +{ + if(val == 0) + return 0; + + uint32_t mask = 0x80000000; + while( (val & mask) == 0 ) mask = mask >> 1; + + if( (val & (~mask)) != 0 ) + return mask << 1; + + return mask; +} + +__host__ void quark_compactTest_cpu_singleCompaction(int thr_id, uint32_t threads, uint32_t *nrm, uint32_t *d_nonces1,const cuda_compactTestFunction_t function, uint32_t *inpHashes, uint32_t *d_validNonceTable) +{ + int orgThreads = threads; + threads = (int)quark_compactTest_roundUpExp((uint32_t)threads); + // threadsPerBlock ausrechnen + const int blockSize = 512; + int nSummen = threads / blockSize; + + int thr1 = (threads+blockSize-1) / blockSize; + int thr2 = threads / (blockSize*blockSize); + int blockSize2 = (nSummen < blockSize) ? nSummen : blockSize; + int thr3 = (nSummen + blockSize2-1) / blockSize2; + + bool callThrid = (thr2 > 0) ? true : false; + + // Erster Initialscan + quark_compactTest_gpu_SCAN<<>>( + d_tempBranch1Nonces[thr_id], 32, d_partSum[0][thr_id], function, orgThreads, inpHashes, d_validNonceTable); + + // weitere Scans + if(callThrid) + { + quark_compactTest_gpu_SCAN<<>>(d_partSum[0][thr_id], 32, d_partSum[1][thr_id]); + quark_compactTest_gpu_SCAN<<<1, thr2>>>(d_partSum[1][thr_id], (thr2>32) ? 32 : thr2); + }else + { + quark_compactTest_gpu_SCAN<<>>(d_partSum[0][thr_id], (blockSize2>32) ? 32 : blockSize2); + } + + if(callThrid) + cudaMemcpy(nrm, &(d_partSum[1][thr_id])[thr2-1], sizeof(uint32_t), cudaMemcpyDeviceToHost); + else + cudaMemcpy(nrm, &(d_partSum[0][thr_id])[nSummen-1], sizeof(uint32_t), cudaMemcpyDeviceToHost); + + + // Addieren + if(callThrid) + { + quark_compactTest_gpu_ADD<<>>(d_partSum[0][thr_id]+blockSize, d_partSum[1][thr_id], blockSize*thr2); + } + quark_compactTest_gpu_ADD<<>>(d_tempBranch1Nonces[thr_id]+blockSize, d_partSum[0][thr_id], threads); + + // Scatter + quark_compactTest_gpu_SCATTER<<>>(d_tempBranch1Nonces[thr_id], d_nonces1, function, orgThreads, inpHashes, d_validNonceTable); +} + +////// ACHTUNG: Diese funktion geht aktuell nur mit threads > 65536 (Am besten 256 * 1024 oder 256*2048) +__host__ void quark_compactTest_cpu_dualCompaction(int thr_id, uint32_t threads, uint32_t *nrm, uint32_t *d_nonces1, uint32_t *d_nonces2, uint32_t *inpHashes, uint32_t *d_validNonceTable) +{ + quark_compactTest_cpu_singleCompaction(thr_id, threads, &nrm[0], d_nonces1, h_QuarkTrueFunction[thr_id], inpHashes, d_validNonceTable); + quark_compactTest_cpu_singleCompaction(thr_id, threads, &nrm[1], d_nonces2, h_QuarkFalseFunction[thr_id],inpHashes, d_validNonceTable); +} + +__host__ void quark_compactTest_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *inpHashes, uint32_t *d_validNonceTable, uint32_t *d_nonces1, uint32_t *nrm1, uint32_t *d_nonces2, uint32_t *nrm2) +{ + // Wenn validNonceTable genutzt wird, dann werden auch nur die Nonces betrachtet, die dort enthalten sind + // "threads" ist in diesem Fall auf die Länge dieses Array's zu setzen! + + quark_compactTest_cpu_dualCompaction(thr_id, threads, h_numValid[thr_id], d_nonces1, d_nonces2, inpHashes, d_validNonceTable); + + *nrm1 = h_numValid[thr_id][0]; + *nrm2 = h_numValid[thr_id][1]; +} + +__host__ void quark_compactTest_single_false_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *inpHashes, uint32_t *d_validNonceTable, + uint32_t *d_nonces1, uint32_t *nrm1) +{ + // Wenn validNonceTable genutzt wird, dann werden auch nur die Nonces betrachtet, die dort enthalten sind + // "threads" ist in diesem Fall auf die Länge dieses Array's zu setzen! + + quark_compactTest_cpu_singleCompaction(thr_id, threads, h_numValid[thr_id], d_nonces1, h_QuarkFalseFunction[thr_id], inpHashes, d_validNonceTable); + + *nrm1 = h_numValid[thr_id][0]; +} diff --git a/quark/cuda_quark_groestl512.cu b/quark/cuda_quark_groestl512.cu new file mode 100644 index 0000000..946922d --- /dev/null +++ b/quark/cuda_quark_groestl512.cu @@ -0,0 +1,125 @@ +/* +// Auf QuarkCoin spezialisierte Version von Groestl inkl. Bitslice + Based upon Christians, Tanguy Pruvot's and SP's work + + Provos Alexis - 2016 +*/ + +#include "cuda_vectors.h" +#include "cuda_helper.h" + +#define TPB52 512 +#define TPB50 512 +#define THF 4 + +#include "quark/groestl_functions_quad.h" +#include "quark/groestl_transf_quad.h" + +__constant__ const uint32_t msg[2][4] = { + {0x00000080,0,0,0}, + {0,0,0,0x01000000} + }; + +#if __CUDA_ARCH__ > 500 +__global__ __launch_bounds__(TPB52, 2) +#else +__global__ __launch_bounds__(TPB50, 2) +#endif +void quark_groestl512_gpu_hash_64_quad(uint32_t threads, uint32_t* g_hash, uint32_t* g_nonceVector){ + uint32_t msgBitsliced[8]; + uint32_t state[8]; + uint32_t output[16]; + // durch 4 dividieren, weil jeweils 4 Threads zusammen ein Hash berechnen + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x) >> 2; + if (thread < threads){ + // GROESTL + const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : __ldg(&g_nonceVector[thread]); + + uint32_t *inpHash = &g_hash[hashPosition<<4]; + + const uint32_t thr = threadIdx.x & (THF-1); + + uint32_t message[8] = { + #if __CUDA_ARCH__ > 500 + __ldg(&inpHash[thr]), __ldg(&inpHash[(THF)+thr]), __ldg(&inpHash[(2 * THF) + thr]), __ldg(&inpHash[(3 * THF) + thr]),msg[0][thr], 0, 0, msg[1][thr] + #else + inpHash[thr], inpHash[(THF)+thr], inpHash[(2 * THF) + thr], inpHash[(3 * THF) + thr], msg[0][thr], 0, 0, msg[1][thr] + #endif + }; + + to_bitslice_quad(message, msgBitsliced); + + groestl512_progressMessage_quad(state, msgBitsliced,thr); + + from_bitslice_quad52(state, output); + +#if __CUDA_ARCH__ <= 500 + output[0] = __byte_perm(output[0], __shfl(output[0], (threadIdx.x + 1) & 3, 4), 0x7610); + output[2] = __byte_perm(output[2], __shfl(output[2], (threadIdx.x + 1) & 3, 4), 0x7610); + output[4] = __byte_perm(output[4], __shfl(output[4], (threadIdx.x + 1) & 3, 4), 0x7632); + output[6] = __byte_perm(output[6], __shfl(output[6], (threadIdx.x + 1) & 3, 4), 0x7632); + output[8] = __byte_perm(output[8], __shfl(output[8], (threadIdx.x + 1) & 3, 4), 0x7610); + output[10] = __byte_perm(output[10], __shfl(output[10], (threadIdx.x + 1) & 3, 4), 0x7610); + output[12] = __byte_perm(output[12], __shfl(output[12], (threadIdx.x + 1) & 3, 4), 0x7632); + output[14] = __byte_perm(output[14], __shfl(output[14], (threadIdx.x + 1) & 3, 4), 0x7632); + + if (thr == 0 || thr == 2){ + output[0 + 1] = __shfl(output[0], (threadIdx.x + 2) & 3, 4); + output[2 + 1] = __shfl(output[2], (threadIdx.x + 2) & 3, 4); + output[4 + 1] = __shfl(output[4], (threadIdx.x + 2) & 3, 4); + output[6 + 1] = __shfl(output[6], (threadIdx.x + 2) & 3, 4); + output[8 + 1] = __shfl(output[8], (threadIdx.x + 2) & 3, 4); + output[10 + 1] = __shfl(output[10], (threadIdx.x + 2) & 3, 4); + output[12 + 1] = __shfl(output[12], (threadIdx.x + 2) & 3, 4); + output[14 + 1] = __shfl(output[14], (threadIdx.x + 2) & 3, 4); + if(thr==0){ + *(uint2x4*)&inpHash[0] = *(uint2x4*)&output[0]; + *(uint2x4*)&inpHash[8] = *(uint2x4*)&output[8]; + } + } +#else + output[0] = __byte_perm(output[0], __shfl(output[0], (threadIdx.x + 1) & 3, 4), 0x7610); + output[0 + 1] = __shfl(output[0], (threadIdx.x + 2) & 3, 4); + + output[2] = __byte_perm(output[2], __shfl(output[2], (threadIdx.x + 1) & 3, 4), 0x7610); + output[2 + 1] = __shfl(output[2], (threadIdx.x + 2) & 3, 4); + + output[4] = __byte_perm(output[4], __shfl(output[4], (threadIdx.x + 1) & 3, 4), 0x7632); + output[4 + 1] = __shfl(output[4], (threadIdx.x + 2) & 3, 4); + + output[6] = __byte_perm(output[6], __shfl(output[6], (threadIdx.x + 1) & 3, 4), 0x7632); + output[6 + 1] = __shfl(output[6], (threadIdx.x + 2) & 3, 4); + + output[8] = __byte_perm(output[8], __shfl(output[8], (threadIdx.x + 1) & 3, 4), 0x7610); + output[8 + 1] = __shfl(output[8], (threadIdx.x + 2) & 3, 4); + + output[10] = __byte_perm(output[10], __shfl(output[10], (threadIdx.x + 1) & 3, 4), 0x7610); + output[10 + 1] = __shfl(output[10], (threadIdx.x + 2) & 3, 4); + + output[12] = __byte_perm(output[12], __shfl(output[12], (threadIdx.x + 1) & 3, 4), 0x7632); + output[12 + 1] = __shfl(output[12], (threadIdx.x + 2) & 3, 4); + + output[14] = __byte_perm(output[14], __shfl(output[14], (threadIdx.x + 1) & 3, 4), 0x7632); + output[14 + 1] = __shfl(output[14], (threadIdx.x + 2) & 3, 4); + + if(thr==0){ + *(uint2x4*)&inpHash[0] = *(uint2x4*)&output[0]; + *(uint2x4*)&inpHash[8] = *(uint2x4*)&output[8]; + } +#endif + } +} + +__host__ +void quark_groestl512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash){ + + const int dev_id = device_map[thr_id]; + // Compute 3.0 benutzt die registeroptimierte Quad Variante mit Warp Shuffle + // mit den Quad Funktionen brauchen wir jetzt 4 threads pro Hash, daher Faktor 4 bei der Blockzahl + // berechne wie viele Thread Blocks wir brauchen + uint32_t tpb = (device_sm[dev_id] <= 500) ? TPB50 : TPB52; + + dim3 grid((THF*threads + tpb-1)/tpb); + dim3 block(tpb); + quark_groestl512_gpu_hash_64_quad<<>>(threads, d_hash, d_nonceVector); +} diff --git a/quark/cuda_quark_jh512.cu b/quark/cuda_quark_jh512.cu new file mode 100644 index 0000000..7c81f03 --- /dev/null +++ b/quark/cuda_quark_jh512.cu @@ -0,0 +1,392 @@ +/* + Based on Tanguy Pruvot's repo + Provos Alexis - 2016 +*/ + +#include "cuda_helper.h" +#include "cuda_vectors.h" +#include "miner.h" + +#define TPB 512 + +/* 1344 bytes */ +__constant__ static uint32_t c_E8[42][8] = { + // Round 0 (Function0) + 0xa2ded572, 0x90d6ab81, 0x67f815df, 0xf6875a4d, 0x0a15847b, 0xc54f9f4e, 0x571523b7, 0x402bd1c3, 0xe03a98ea, 0xb4960266, 0x9cfa455c, 0x8a53bbf2, 0x99d2c503, 0x1a1456b5, 0x9a99b266, 0x31a2db88, // 1 + 0x5c5aa303, 0x8019051c, 0xdb0e199a, 0x1d959e84, 0x0ab23f40, 0xadeb336f, 0x1044c187, 0xdccde75e, 0x9213ba10, 0x39812c0a, 0x416bbf02, 0x5078aa37, 0x156578dc, 0xd2bf1a3f, 0xd027bbf7, 0xd3910041, // 3 + 0x0d5a2d42, 0x0ba75c18, 0x907eccf6, 0xac442bc7, 0x9c9f62dd, 0xd665dfd1, 0xce97c092, 0x23fcc663, 0x036c6e97, 0xbb03f1ee, 0x1ab8e09e, 0xfa618e5d, 0x7e450521, 0xb29796fd, 0xa8ec6c44, 0x97818394, // 5 + 0x37858e4a, 0x8173fe8a, 0x2f3003db, 0x6c69b8f8, 0x2d8d672a, 0x4672c78a, 0x956a9ffb, 0x14427fc0, + // Round 7 (Function0) + 0x8f15f4c5, 0xb775de52, 0xc45ec7bd, 0xbc88e4ae, 0xa76f4475, 0x1e00b882, 0x80bb118f, 0xf4a3a698, 0x338ff48e, 0x20edf1b6, 0x1563a3a9, 0xfde05a7c, 0x24565faa, 0x5ae9ca36, 0x89f9b7d5, 0x362c4206, + 0x433529ce, 0x591ff5d0, 0x3d98fe4e, 0x86814e6f, 0x74f93a53, 0x81ad9d0e, 0xa74b9a73, 0x9f5ad8af, 0x670605a7, 0x26077447, 0x6a6234ee, 0x3f1080c6, 0xbe280b8b, 0x6f7ea0e0, 0x2717b96e, 0x7b487ec6, + 0xa50a550d, 0x81727686, 0xc0a4f84a, 0xd48d6050, 0x9fe7e391, 0x415a9e7e, 0x9ef18e97, 0x62b0e5f3, 0xec1f9ffc, 0xf594d74f, 0x7a205440, 0xd895fa9d, 0x001ae4e3, 0x117e2e55, 0x84c9f4ce, 0xa554c324, + 0x2872df5b, 0xef7c8905, 0x286efebd, 0x2ed349ee, 0xe27ff578, 0x85937e44, 0xb2c4a50f, 0x7f5928eb, + // Round 14 (Function0) + 0x37695f70, 0x04771bc7, 0x4a3124b3, 0xe720b951, 0xf128865e, 0xe843fe74, 0x65e4d61d, 0x8a87d423, 0xa3e8297d, 0xfb301b1d, 0xf2947692, 0xe01bdc5b, 0x097acbdd, 0x4f4924da, 0xc1d9309b, 0xbf829cf2, + 0x31bae7a4, 0x32fcae3b, 0xffbf70b4, 0x39d3bb53, 0x0544320d, 0xc1c39f45, 0x48bcf8de, 0xa08b29e0, 0xfd05c9e5, 0x01b771a2, 0x0f09aef7, 0x95ed44e3, 0x12347094, 0x368e3be9, 0x34f19042, 0x4a982f4f, + 0x631d4088, 0xf14abb7e, 0x15f66ca0, 0x30c60ae2, 0x4b44c147, 0xc5b67046, 0xffaf5287, 0xe68c6ecc, 0x56a4d5a4, 0x45ce5773, 0x00ca4fbd, 0xadd16430, 0x4b849dda, 0x68cea6e8, 0xae183ec8, 0x67255c14, + 0xf28cdaa3, 0x20b2601f, 0x16e10ecb, 0x7b846fc2, 0x5806e933, 0x7facced1, 0x9a99949a, 0x1885d1a0, + // Round 21 (Function0) + 0xa15b5932, 0x67633d9f, 0xd319dd8d, 0xba6b04e4, 0xc01c9a50, 0xab19caf6, 0x46b4a5aa, 0x7eee560b, 0xea79b11f, 0x5aac571d, 0x742128a9, 0x76d35075, 0x35f7bde9, 0xfec2463a, 0xee51363b, 0x01707da3, + 0xafc135f7, 0x15638341, 0x42d8a498, 0xa8db3aea, 0x20eced78, 0x4d3bc3fa, 0x79676b9e, 0x832c8332, 0x1f3b40a7, 0x6c4e3ee7, 0xf347271c, 0xfd4f21d2, 0x34f04059, 0x398dfdb8, 0x9a762db7, 0xef5957dc, + 0x490c9b8d, 0xd0ae3b7d, 0xdaeb492b, 0x84558d7a, 0x49d7a25b, 0xf0e9a5f5, 0x0d70f368, 0x658ef8e4, 0xf4a2b8a0, 0x92946891, 0x533b1036, 0x4f88e856, 0x9e07a80c, 0x555cb05b, 0x5aec3e75, 0x4cbcbaf8, + 0x993bbbe3, 0x28acae64, 0x7b9487f3, 0x6db334dc, 0xd6f4da75, 0x50a5346c, 0x5d1c6b72, 0x71db28b8, + // Round 28 (Function0) + 0xf2e261f8, 0xf1bcac1c, 0x2a518d10, 0xa23fce43, 0x3364dbe3, 0x3cd1bb67, 0xfc75dd59, 0xb043e802, 0xca5b0a33, 0xc3943b92, 0x75a12988, 0x1e4d790e, 0x4d19347f, 0xd7757479, 0x5c5316b4, 0x3fafeeb6, + 0xf7d4a8ea, 0x5324a326, 0x21391abe, 0xd23c32ba, 0x097ef45c, 0x4a17a344, 0x5127234c, 0xadd5a66d, 0xa63e1db5, 0xa17cf84c, 0x08c9f2af, 0x4d608672, 0x983d5983, 0xcc3ee246, 0x563c6b91, 0xf6c76e08, + 0xb333982f, 0xe8b6f406, 0x5e76bcb1, 0x36d4c1be, 0xa566d62b, 0x1582ee74, 0x2ae6c4ef, 0x6321efbc, 0x0d4ec1fd, 0x1614c17e, 0x69c953f4, 0x16fae006, 0xc45a7da7, 0x3daf907e, 0x26585806, 0x3f9d6328, + 0xe3f2c9d2, 0x16512a74, 0x0cd29b00, 0x9832e0f2, 0x30ceaa5f, 0xd830eb0d, 0x300cd4b7, 0x9af8cee3, + // Round 35 (Function0) + 0x7b9ec54b, 0x574d239b, 0x9279f1b5, 0x316796e6, 0x6ee651ff, 0xf3a6e6cc, 0xd3688604, 0x05750a17, 0xd98176b1, 0xb3cb2bf4, 0xce6c3213, 0x47154778, 0x8452173c, 0x825446ff, 0x62a205f8, 0x486a9323, + 0x0758df38, 0x442e7031, 0x65655e4e, 0x86ca0bd0, 0x897cfcf2, 0xa20940f0, 0x8e5086fc, 0x4e477830, 0x39eea065, 0x26b29721, 0x8338f7d1, 0x6ff81301, 0x37e95ef7, 0xd1ed44a3, 0xbd3a2ce4, 0xe7de9fef, + 0x15dfa08b, 0x7ceca7d8, 0xd9922576, 0x7eb027ab, 0xf6f7853c, 0xda7d8d53, 0xbe42dc12, 0xdea83eaa, 0x93ce25aa, 0xdaef5fc0, 0xd86902bd, 0xa5194a17, 0xfd43f65a, 0x33664d97, 0xf908731a, 0x6a21fd4c, + 0x3198b435, 0xa163d09a, 0x701541db, 0x72409751, 0xbb0f1eea, 0xbf9d75f6, 0x9b54cded, 0xe26f4791 +}; + +__device__ __forceinline__ void SWAP1(uint32_t &x){ + const uint32_t con = 0x55555555 , z = ((x & con) << 1); + + x>>=1; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %0, %1, %2, 0xEA;" : "+r"(x) : "r"(con),"r"(z)); // 0xEA = (F0 & CC) | AA + #else + x = (x & con) | z; + #endif +} +__device__ __forceinline__ void SWAP2(uint32_t &x){ + const uint32_t con = 0x33333333, z = ((x & con) << 2); + x>>=2; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %0, %1, %2, 0xEA;" : "+r"(x) : "r"(con),"r"(z)); // 0xEA = (F0 & CC) | AA + #else + x = (x & con) | z; + #endif +} +__device__ __forceinline__ void SWAP4(uint32_t &x){ + const uint32_t con = 0x0F0F0F0F, z = ((x & con) << 4); + x>>=4; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %0, %1, %2, 0xEA;" : "+r"(x) : "r"(con),"r"(z)); // 0xEA = (F0 & CC) | AA + #else + x = (x & con) | z; + #endif +} + +//swapping bits 32i||32i+1||......||32i+15 with bits 32i+16||32i+17||......||32i+31 of 32-bit x +#define SWAP16(x) (x) = __byte_perm(x, x, 0x1032); + +//swapping bits 16i||16i+1||......||16i+7 with bits 16i+8||16i+9||......||16i+15 of 32-bit x +#define SWAP8(x) (x) = __byte_perm(x, x, 0x2301); + +//The MDS transform +__device__ __forceinline__ +static void L(uint32_t &m0,uint32_t &m1,uint32_t &m2,uint32_t &m3,uint32_t &m4,uint32_t &m5,uint32_t &m6,uint32_t &m7){ + m4 = m4 ^ m1; + m5 = m5 ^ m2; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %0, %1, %2, 0x96;" : "+r"(m6) : "r"(m0),"r"(m3)); + #else + m6 ^= m0 ^ m3; + #endif + m7 = m7 ^ m0; + m0 = m0 ^ m5; + m1 = m1 ^ m6; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %0, %1, %2, 0x96;" : "+r"(m2) : "r"(m4),"r"(m7)); + #else + m2 ^= m4 ^ m7; + #endif + m3 = m3 ^ m4; +} + +/* The Sbox */ +__device__ __forceinline__ +void Sbox(uint32_t &m0,uint32_t &m1,uint32_t &m2,uint32_t &m3,const uint32_t cc){ + uint32_t temp; + + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %0, %1, %2, 0xD2;" : "+r"(m0) : "r"(m2),"r"(cc)); // 0xD2 = F0 ^ ((~CC)&AA) + asm ("lop3.b32 %0, %1, %2, %3, 0x78;" : "=r"(temp) : "r"(cc),"r"(m0),"r"(m1)); // 0x78 = F0 ^ (CC&AA) + asm ("lop3.b32 %0, %0, %1, %2, 0xB4;" : "+r"(m0) : "r"(m2),"r"(m3)); // 0xB4 = F0 ^ (CC&(~AA)) + asm ("lop3.b32 %0, %0, %1, %2, 0x2D;" : "+r"(m3) : "r"(m1),"r"(m2)); // 0x2D = (~F0) ^ ((~CC)&AA) + asm ("lop3.b32 %0, %0, %1, %2, 0x78;" : "+r"(m1) : "r"(m0),"r"(m2)); // 0x78 = F0 ^ (CC&AA) + asm ("lop3.b32 %0, %0, %1, %2, 0xB4;" : "+r"(m2) : "r"(m0),"r"(m3)); // 0xB4 = F0 ^ (CC&(~AA)) + asm ("lop3.b32 %0, %0, %1, %2, 0x1E;" : "+r"(m0) : "r"(m1),"r"(m3)); // 0x1E = F0 ^ (CC|AA) + asm ("lop3.b32 %0, %0, %1, %2, 0x78;" : "+r"(m3) : "r"(m1),"r"(m2)); // 0x78 = F0 ^ (CC&AA) + asm ("lop3.b32 %0, %0, %1, %2, 0x78;" : "+r"(m1) : "r"(temp),"r"(m0)); // 0x78 = F0 ^ (CC&AA) + #else + m0 = m0 ^ (~(m2)) & cc; + temp = cc ^ (m0 & m1); + m0 = m0 ^ m2 & (~m3); + m3 = (~m3) ^ (~(m1)) & m2; + m1 = m1 ^ (m0 & m2); + m2 = m2 ^ (m0 & (~(m3))); + m0 = m0 ^ (m1 | m3); + m3 = m3 ^ (m1 & m2); + m1 = m1 ^ (temp & m0); + #endif + m2^= temp; +} + +//---------------------------------------------------------------------------------------------------------- + +__device__ __forceinline__ +static void RoundFunction0(uint32_t x[8][4]){ + #pragma unroll 4 + for (int j = 1; j < 8; j += 2) { // 1, 3, 5, 7 (Even) + //SWAP1x4(x[j]); + SWAP1(x[j][0]); SWAP1(x[j][1]); SWAP1(x[j][2]); SWAP1(x[j][3]); + } +} + +__device__ __forceinline__ +static void RoundFunction1(uint32_t x[8][4]){ + #pragma unroll 4 + for (int j = 1; j < 8; j += 2) { + //SWAP2x4(x[j]); + SWAP2(x[j][0]); SWAP2(x[j][1]); SWAP2(x[j][2]); SWAP2(x[j][3]); + } +} + +__device__ __forceinline__ +static void RoundFunction2(uint32_t x[8][4]){ + #pragma unroll 4 + for (int j = 1; j < 8; j += 2) { + //SWAP4x4(x[j]); + SWAP4(x[j][0]); SWAP4(x[j][1]); SWAP4(x[j][2]); SWAP4(x[j][3]); + } +} + +__device__ __forceinline__ +static void RoundFunction3(uint32_t x[8][4]) +{ + //uint32_t* xj = x[j]; + #pragma unroll 4 + for (int j = 1; j < 8; j += 2) { + SWAP8(x[j][0]); + SWAP8(x[j][1]); + SWAP8(x[j][2]); + SWAP8(x[j][3]); + } +} + +__device__ __forceinline__ +static void RoundFunction4(uint32_t x[8][4]) +{ + #pragma unroll 4 + for (int j = 1; j < 8; j += 2) + { + //uint32_t* xj = x[j]; + #pragma unroll + for (int i = 0; i < 4; i++) + SWAP16(x[j][i]); + } +} + +__device__ __forceinline__ +static void RoundFunction5(uint32_t x[8][4]) +{ + #pragma unroll 4 + for (int j = 1; j < 8; j += 2) + { + xchg(x[j][0], x[j][1]); + xchg(x[j][2], x[j][3]); + } +} + +__device__ __forceinline__ +static void RoundFunction6(uint32_t x[8][4]) +{ + #pragma unroll 4 + for (int j = 1; j < 8; j += 2) + { + xchg(x[j][0], x[j][2]); + xchg(x[j][1], x[j][3]); + } +} +__device__ __forceinline__ +static void Sbox_and_MDS_layer(uint32_t x[8][4], const uint32_t rnd) +{ + // Sbox and MDS layer + uint2* cc = (uint2*) &c_E8[rnd]; + #pragma unroll + for (int i = 0; i < 4; i++, ++cc) { + uint2 temp = *cc; + Sbox(x[0][i], x[2][i], x[4][i], x[6][i], temp.x); + Sbox(x[1][i], x[3][i], x[5][i], x[7][i], temp.y); + L(x[0][i], x[2][i], x[4][i], x[6][i], x[1][i], x[3][i], x[5][i], x[7][i]); + } +} +/* The bijective function E8, in bitslice form */ +__device__ +static void E8(uint32_t x[8][4]) +{ + /* perform 6 loops of 7 rounds */ + for (int r = 0; r < 42; r += 7){ + Sbox_and_MDS_layer(x,r); + RoundFunction0(x); + Sbox_and_MDS_layer(x,r+1); + RoundFunction1(x); + Sbox_and_MDS_layer(x,r+2); + RoundFunction2(x); + Sbox_and_MDS_layer(x,r+3); + RoundFunction3(x); + Sbox_and_MDS_layer(x,r+4); + RoundFunction4(x); + Sbox_and_MDS_layer(x,r+5); + RoundFunction5(x); + Sbox_and_MDS_layer(x,r+6); + RoundFunction6(x); + } +} +//---------------------------------------------------------------------------------------------------------- +__global__ __launch_bounds__(TPB) +void quark_jh512_gpu_hash_64(uint32_t threads, uint32_t* g_hash, const uint32_t* __restrict__ g_nonceVector){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + const uint32_t hashPosition = (g_nonceVector != NULL) ? g_nonceVector[thread] : thread; + + uint32_t *Hash = &g_hash[hashPosition<<4]; + + uint32_t hash[16]; + + uint32_t x[8][4] = { /* init */ + { 0x964bd16f, 0x17aa003e, 0x052e6a63, 0x43d5157a },{ 0x8d5e228a, 0x0bef970c, 0x591234e9, 0x61c3b3f2 }, + { 0xc1a01d89, 0x1e806f53, 0x6b05a92a, 0x806d2bea },{ 0xdbcc8e58, 0xa6ba7520, 0x763a0fa9, 0xf73bf8ba }, + { 0x05e66901, 0x694ae341, 0x8e8ab546, 0x5ae66f2e },{ 0xd0a74710, 0x243c84c1, 0xb1716e3b, 0x99c15a2d }, + { 0xecf657cf, 0x56f8b19d, 0x7c8806a7, 0x56b11657 },{ 0xdffcc2e3, 0xfb1785e6, 0x78465a54, 0x4bdd8ccc } + }; + + *(uint2x4*)&hash[0] = __ldg4((uint2x4*)&Hash[0]); + *(uint2x4*)&hash[8] = __ldg4((uint2x4*)&Hash[8]); + + #pragma unroll 16 + for (int i = 0; i < 16; i++) + x[i/4][i & 3] ^= hash[i]; + + E8(x); + + #pragma unroll 16 + for (int i = 0; i < 16; i++) + x[(i+16)/4][i & 3] ^= hash[i]; + + x[0][0] ^= 0x80U; + x[3][3] ^= 0x00020000U; + E8(x); + + x[4][0] ^= 0x80U; + x[7][3] ^= 0x00020000U; + + *(uint2x4*)&Hash[0] = *(uint2x4*)&x[4][0]; + *(uint2x4*)&Hash[8] = *(uint2x4*)&x[6][0]; + } +} + +__global__ __launch_bounds__(TPB) +void quark_jh512_gpu_hash_64_final(uint32_t threads,const uint32_t* __restrict__ g_hash, const uint32_t *const __restrict__ g_nonceVector,uint32_t *resNonce, const uint2 target){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + const uint32_t hashPosition = (g_nonceVector != NULL) ? g_nonceVector[thread] : thread; + + const uint32_t *Hash = &g_hash[hashPosition<<4]; + + uint32_t hash[16]; + + uint32_t x[8][4] = { /* init */ + { 0x964bd16f, 0x17aa003e, 0x052e6a63, 0x43d5157a }, + { 0x8d5e228a, 0x0bef970c, 0x591234e9, 0x61c3b3f2 }, + { 0xc1a01d89, 0x1e806f53, 0x6b05a92a, 0x806d2bea }, + { 0xdbcc8e58, 0xa6ba7520, 0x763a0fa9, 0xf73bf8ba }, + { 0x05e66901, 0x694ae341, 0x8e8ab546, 0x5ae66f2e }, + { 0xd0a74710, 0x243c84c1, 0xb1716e3b, 0x99c15a2d }, + { 0xecf657cf, 0x56f8b19d, 0x7c8806a7, 0x56b11657 }, + { 0xdffcc2e3, 0xfb1785e6, 0x78465a54, 0x4bdd8ccc } + }; + + *(uint2x4*)&hash[0] = __ldg4((uint2x4*)&Hash[0]); + *(uint2x4*)&hash[8] = __ldg4((uint2x4*)&Hash[8]); + + #pragma unroll 16 + for (int i = 0; i < 16; i++) + x[i/4][i & 3] ^= hash[i]; + + E8(x); + + #pragma unroll 16 + for (int i = 0; i < 16; i++) + x[(i+16)/4][i & 3] ^= hash[i]; + + x[0][0] ^= 0x80U; + x[3][3] ^= 0x00020000U; +// E8(x); + /* perform 6 loops of 7 rounds */ + for (int r = 0; r < 35; r += 7){ + Sbox_and_MDS_layer(x,r); + RoundFunction0(x); + Sbox_and_MDS_layer(x,r+1); + RoundFunction1(x); + Sbox_and_MDS_layer(x,r+2); + RoundFunction2(x); + Sbox_and_MDS_layer(x,r+3); + RoundFunction3(x); + Sbox_and_MDS_layer(x,r+4); + RoundFunction4(x); + Sbox_and_MDS_layer(x,r+5); + RoundFunction5(x); + Sbox_and_MDS_layer(x,r+6); + RoundFunction6(x); + } + Sbox_and_MDS_layer(x,35); + RoundFunction0(x); + Sbox_and_MDS_layer(x,36); + RoundFunction1(x); + Sbox_and_MDS_layer(x,37); + RoundFunction2(x); + Sbox_and_MDS_layer(x,38); + RoundFunction3(x); + Sbox_and_MDS_layer(x,39); + RoundFunction4(x); + Sbox_and_MDS_layer(x,40); + +// RoundFunction5(x); +// Sbox_and_MDS_layer(x,41); + uint2* cc = (uint2*) &c_E8[41][2]; + uint2 temp = *cc; + + Sbox(x[0][1], x[2][1], x[4][1], x[6][1], temp.x); + Sbox(x[1][0], x[3][0], x[5][0], x[7][0], temp.y); + + if(xor3x(x[5][0],x[0][1],x[6][1]) <= target.y){ + temp = *(--cc); + Sbox(x[0][0], x[2][0], x[4][0], x[6][0], temp.x); + Sbox(x[1][1], x[3][1], x[5][1], x[7][1], temp.y); + L(x[0][0], x[2][0], x[4][0], x[6][0], x[1][1], x[3][1], x[5][1], x[7][1]); + if(x[5][1] <= target.x){ + const uint32_t tmp = atomicExch(&resNonce[0], hashPosition); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } + } +} + +__host__ +void quark_jh512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash) +{ + dim3 grid((threads + TPB-1)/TPB); + dim3 block(TPB); + + quark_jh512_gpu_hash_64<<>>(threads, d_hash, d_nonceVector); +} + +__host__ +void quark_jh512_cpu_hash_64_final(int thr_id, uint32_t threads,uint32_t *d_nonceVector, uint32_t *d_hash, uint64_t target, uint32_t *d_resNonce){ + dim3 grid((threads + TPB-1)/TPB); + dim3 block(TPB); + + quark_jh512_gpu_hash_64_final<<>>(threads, d_hash, d_nonceVector, d_resNonce, vectorize(target)); +} diff --git a/quark/cuda_quark_keccak512.cu b/quark/cuda_quark_keccak512.cu new file mode 100644 index 0000000..5ad6322 --- /dev/null +++ b/quark/cuda_quark_keccak512.cu @@ -0,0 +1,416 @@ +/* + Based upon Tanguy Pruvot's repo + + Provos Alexis - 2016 +*/ + +#include +#include + +#include "cuda_helper.h" +#include "cuda_vectors.h" +#include "miner.h" + +#define TPB52 128 +#define TPB50 256 + +__constant__ +uint2 keccak_round_constants[24] = { + { 0x00000001, 0x00000000 }, { 0x00008082, 0x00000000 }, { 0x0000808a, 0x80000000 }, { 0x80008000, 0x80000000 }, + { 0x0000808b, 0x00000000 }, { 0x80000001, 0x00000000 }, { 0x80008081, 0x80000000 }, { 0x00008009, 0x80000000 }, + { 0x0000008a, 0x00000000 }, { 0x00000088, 0x00000000 }, { 0x80008009, 0x00000000 }, { 0x8000000a, 0x00000000 }, + { 0x8000808b, 0x00000000 }, { 0x0000008b, 0x80000000 }, { 0x00008089, 0x80000000 }, { 0x00008003, 0x80000000 }, + { 0x00008002, 0x80000000 }, { 0x00000080, 0x80000000 }, { 0x0000800a, 0x00000000 }, { 0x8000000a, 0x80000000 }, + { 0x80008081, 0x80000000 }, { 0x00008080, 0x80000000 }, { 0x80000001, 0x00000000 }, { 0x80008008, 0x80000000 } +}; + +#if __CUDA_ARCH__ > 500 +__global__ __launch_bounds__(TPB52,7) +#else +__global__ __launch_bounds__(TPB50,3) +#endif +void quark_keccak512_gpu_hash_64(uint32_t threads, uint2* g_hash, uint32_t *g_nonceVector){ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint2 t[5], u[5], v, w; + uint2 s[25]; + if (thread < threads){ + + const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : g_nonceVector[thread]; + + uint2x4* d_hash = (uint2x4 *)&g_hash[hashPosition * 8]; + + #if __CUDA_ARCH__ > 500 + *(uint2x4*)&s[ 0] = __ldg4(&d_hash[ 0]); + *(uint2x4*)&s[ 4] = __ldg4(&d_hash[ 1]); + #else + *(uint2x4*)&s[ 0] = d_hash[ 0]; + *(uint2x4*)&s[ 4] = d_hash[ 1]; + #endif + + s[8] = make_uint2(1,0x80000000); + + /*theta*/ + t[ 0] = vectorize(devectorize(s[ 0])^devectorize(s[ 5])); + t[ 1] = vectorize(devectorize(s[ 1])^devectorize(s[ 6])); + t[ 2] = vectorize(devectorize(s[ 2])^devectorize(s[ 7])); + t[ 3] = vectorize(devectorize(s[ 3])^devectorize(s[ 8])); + t[ 4] = s[4]; + + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + + s[ 4] = xor3x(s[ 4], t[3], u[ 0]); + s[24] = s[19] = s[14] = s[ 9] = t[ 3] ^ u[ 0]; + + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[ 5] = xor3x(s[ 5], t[4], u[ 1]); + s[20] = s[15] = s[10] = t[4] ^ u[ 1]; + + s[ 1] = xor3x(s[ 1], t[0], u[ 2]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[21] = s[16] = s[11] = t[0] ^ u[ 2]; + + s[ 2] = xor3x(s[ 2], t[1], u[ 3]); + s[ 7] = xor3x(s[ 7], t[1], u[ 3]); + s[22] = s[17] = s[12] = t[1] ^ u[ 3]; + + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]); + s[23] = s[18] = s[13] = t[2] ^ u[ 4]; + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[ 0]; + + #if __CUDA_ARCH__ > 500 + #pragma unroll 4 + #else + #pragma unroll 3 + #endif + for (int i = 1; i < 23; i++) { + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = vectorize(xor5(devectorize(s[ j]),devectorize(s[j+5]),devectorize(s[j+10]),devectorize(s[j+15]),devectorize(s[j+20]))); + } + + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 4] = xor3x(s[ 4], t[3], u[ 0]);s[ 9] = xor3x(s[ 9], t[3], u[ 0]);s[14] = xor3x(s[14], t[3], u[ 0]);s[19] = xor3x(s[19], t[3], u[ 0]);s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]);s[ 5] = xor3x(s[ 5], t[4], u[ 1]);s[10] = xor3x(s[10], t[4], u[ 1]);s[15] = xor3x(s[15], t[4], u[ 1]);s[20] = xor3x(s[20], t[4], u[ 1]); + s[ 1] = xor3x(s[ 1], t[0], u[ 2]);s[ 6] = xor3x(s[ 6], t[0], u[ 2]);s[11] = xor3x(s[11], t[0], u[ 2]);s[16] = xor3x(s[16], t[0], u[ 2]);s[21] = xor3x(s[21], t[0], u[ 2]); + s[ 2] = xor3x(s[ 2], t[1], u[ 3]);s[ 7] = xor3x(s[ 7], t[1], u[ 3]);s[12] = xor3x(s[12], t[1], u[ 3]);s[17] = xor3x(s[17], t[1], u[ 3]);s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]);s[13] = xor3x(s[13], t[2], u[ 4]);s[18] = xor3x(s[18], t[2], u[ 4]);s[23] = xor3x(s[23], t[2], u[ 4]); + + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[i]; + } + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = xor3x(xor3x(s[j+0],s[j+5],s[j+10]),s[j+15],s[j+20]); + } + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 9] = xor3x(s[ 9], t[3], u[ 0]); + s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[10] = xor3x(s[10], t[4], u[ 1]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[16] = xor3x(s[16], t[0], u[ 2]); + s[12] = xor3x(s[12], t[1], u[ 3]); + s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]); + s[18] = xor3x(s[18], t[2], u[ 4]); + /* rho pi: b[..] = rotl(a[..], ..) */ + s[ 1] = ROL2(s[ 6], 44); + s[ 2] = ROL2(s[12], 43); + s[ 5] = ROL2(s[ 3], 28); + s[ 7] = ROL2(s[10], 3); + s[ 3] = ROL2(s[18], 21); + s[ 4] = ROL2(s[24], 14); + s[ 6] = ROL2(s[ 9], 20); + s[ 8] = ROL2(s[16], 45); + s[ 9] = ROL2(s[22], 61); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + v=s[ 0];w=s[ 1];s[ 0] = chi(v,w,s[ 2]);s[ 1] = chi(w,s[ 2],s[ 3]);s[ 2]=chi(s[ 2],s[ 3],s[ 4]);s[ 3]=chi(s[ 3],s[ 4],v);s[ 4]=chi(s[ 4],v,w); + v=s[ 5];w=s[ 6];s[ 5] = chi(v,w,s[ 7]);s[ 6] = chi(w,s[ 7],s[ 8]);s[ 7]=chi(s[ 7],s[ 8],s[ 9]); + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[23]; + + d_hash[0] = *(uint2x4*)&s[0]; + d_hash[1] = *(uint2x4*)&s[4]; + + } +} + +#if __CUDA_ARCH__ > 500 +__global__ __launch_bounds__(TPB52,6) +#else +__global__ __launch_bounds__(TPB50,3) +#endif +void quark_keccak512_gpu_hash_64_final(uint32_t threads, uint2* g_hash, uint32_t* g_nonceVector, uint32_t *resNonce, const uint64_t target){ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint2 t[5], u[5], v, w; + uint2 s[25]; + if (thread < threads){ + + const uint32_t hashPosition = g_nonceVector[thread]; + + uint2x4* d_hash = (uint2x4 *)&g_hash[hashPosition * 8]; + + #if __CUDA_ARCH__ > 500 + *(uint2x4*)&s[ 0] = __ldg4(&d_hash[ 0]); + *(uint2x4*)&s[ 4] = __ldg4(&d_hash[ 1]); + #else + *(uint2x4*)&s[ 0] = d_hash[ 0]; + *(uint2x4*)&s[ 4] = d_hash[ 1]; + #endif + + s[8] = make_uint2(1,0x80000000); + + /*theta*/ + t[ 0] = vectorize(devectorize(s[ 0])^devectorize(s[ 5])); + t[ 1] = vectorize(devectorize(s[ 1])^devectorize(s[ 6])); + t[ 2] = vectorize(devectorize(s[ 2])^devectorize(s[ 7])); + t[ 3] = vectorize(devectorize(s[ 3])^devectorize(s[ 8])); + t[ 4] = s[4]; + + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + + s[ 4] = xor3x(s[ 4], t[3], u[ 0]); + s[24] = s[19] = s[14] = s[ 9] = t[ 3] ^ u[ 0]; + + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[ 5] = xor3x(s[ 5], t[4], u[ 1]); + s[20] = s[15] = s[10] = t[4] ^ u[ 1]; + + s[ 1] = xor3x(s[ 1], t[0], u[ 2]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[21] = s[16] = s[11] = t[0] ^ u[ 2]; + + s[ 2] = xor3x(s[ 2], t[1], u[ 3]); + s[ 7] = xor3x(s[ 7], t[1], u[ 3]); + s[22] = s[17] = s[12] = t[1] ^ u[ 3]; + + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]); + s[23] = s[18] = s[13] = t[2] ^ u[ 4]; + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[ 0]; + + #if __CUDA_ARCH__ > 500 + #pragma unroll 4 + #else + #pragma unroll 3 + #endif + for (int i = 1; i < 23; i++) { + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = vectorize(xor5(devectorize(s[ j]),devectorize(s[j+5]),devectorize(s[j+10]),devectorize(s[j+15]),devectorize(s[j+20]))); + } + + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 4] = xor3x(s[ 4], t[3], u[ 0]);s[ 9] = xor3x(s[ 9], t[3], u[ 0]);s[14] = xor3x(s[14], t[3], u[ 0]);s[19] = xor3x(s[19], t[3], u[ 0]);s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]);s[ 5] = xor3x(s[ 5], t[4], u[ 1]);s[10] = xor3x(s[10], t[4], u[ 1]);s[15] = xor3x(s[15], t[4], u[ 1]);s[20] = xor3x(s[20], t[4], u[ 1]); + s[ 1] = xor3x(s[ 1], t[0], u[ 2]);s[ 6] = xor3x(s[ 6], t[0], u[ 2]);s[11] = xor3x(s[11], t[0], u[ 2]);s[16] = xor3x(s[16], t[0], u[ 2]);s[21] = xor3x(s[21], t[0], u[ 2]); + s[ 2] = xor3x(s[ 2], t[1], u[ 3]);s[ 7] = xor3x(s[ 7], t[1], u[ 3]);s[12] = xor3x(s[12], t[1], u[ 3]);s[17] = xor3x(s[17], t[1], u[ 3]);s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]);s[13] = xor3x(s[13], t[2], u[ 4]);s[18] = xor3x(s[18], t[2], u[ 4]);s[23] = xor3x(s[23], t[2], u[ 4]); + + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[i]; + } + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = xor3x(xor3x(s[j+0],s[j+5],s[j+10]),s[j+15],s[j+20]); + } + /*theta*/ + u[ 0] = ROL2(t[ 0],1); + u[ 1] = ROL2(t[ 1],1); + s[18] = xor3x(s[18], t[2], ROL2(t[ 4],1)); + s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + /* rho pi: b[..] = rotl(a[..], ..) */ + s[ 3] = ROL2(s[18], 21); + s[ 4] = ROL2(s[24], 14); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + if(devectorize(chi(s[ 3],s[ 4],s[ 0])) <= target){ + const uint32_t tmp = atomicExch(&resNonce[0], hashPosition); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } +} + +__host__ +void quark_keccak512_cpu_init(int thr_id, uint32_t threads) +{ + +} + +__host__ +void quark_keccak512_cpu_hash_64(int thr_id, uint32_t threads,uint32_t *d_nonceVector, uint32_t *d_hash) +{ + uint32_t tpb = TPB52; + int dev_id = device_map[thr_id]; + if (device_sm[dev_id] <= 500) tpb = TPB50; + const dim3 grid((threads + tpb-1)/tpb); + const dim3 block(tpb); + + quark_keccak512_gpu_hash_64<<>>(threads, (uint2*)d_hash, d_nonceVector); +} + +__host__ +void quark_keccak512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash, uint64_t target, uint32_t *d_resNonce) +{ + uint32_t tpb = TPB52; + int dev_id = device_map[thr_id]; + if (device_sm[dev_id] <= 500) tpb = TPB50; + const dim3 grid((threads + tpb-1)/tpb); + const dim3 block(tpb); + + quark_keccak512_gpu_hash_64_final<<>>(threads, (uint2*)d_hash, d_nonceVector, d_resNonce, target); +} diff --git a/quark/cuda_quark_skein512.cu b/quark/cuda_quark_skein512.cu new file mode 100644 index 0000000..5db1873 --- /dev/null +++ b/quark/cuda_quark_skein512.cu @@ -0,0 +1,582 @@ +/* Based on SP's work + * + * Provos Alexis - 2016 + */ + +#include "miner.h" +#include "cuda_vectors.h" +#include "skein/skein_header.h" + +#define TPB52 512 +#define TPB50 512 + +/* ************************ */ +__constant__ const uint2 buffer[152] = { + {0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC33,0xAE18A40B}, + {0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC73,0x9E18A40B},{0x98173EC5,0xCAB2076D}, + {0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC73,0x9E18A40B},{0x98173F04,0xCAB2076D},{0x749C51D0,0x4903ADFF}, + {0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173F04,0xCAB2076D},{0x749C51CE,0x3903ADFF},{0x9746DF06,0x0D95DE39}, + {0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x3903ADFF},{0x9746DF43,0xFD95DE39},{0x27C79BD2,0x8FD19341}, + {0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF43,0xFD95DE39},{0x27C79C0E,0x8FD19341},{0xFF352CB6,0x9A255629}, + {0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79C0E,0x8FD19341},{0xFF352CB1,0x8A255629},{0xDF6CA7B6,0x5DB62599}, + {0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x8A255629},{0xDF6CA7F0,0x4DB62599},{0xA9D5C3FB,0xEABE394C}, + {0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7F0,0x4DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B52B,0x991112C7}, + {0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC3C,0xAE18A40B}, + {0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC73,0x9E18A40B},{0x98173ece,0xcab2076d}, + {0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC73,0x9E18A40B},{0x98173F04,0xCAB2076D},{0x749C51D9,0x4903ADFF}, + {0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173F04,0xCAB2076D},{0x749C51CE,0x3903ADFF},{0x9746DF0F,0x0D95DE39}, + {0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x3903ADFF},{0x9746DF43,0xFD95DE39},{0x27C79BDB,0x8FD19341}, + {0xA9D5C3F4,0xEABE394C},{0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF43,0xFD95DE39},{0x27C79C0E,0x8FD19341},{0xFF352CBF,0x9A255629}, + {0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0x98173EC4,0xCAB2076D},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79C0E,0x8FD19341},{0xFF352CB1,0x8A255629},{0xDF6CA7BF,0x5DB62599}, + {0x660FCC33,0xAE18A40B},{0x98173ec4,0xcab2076d},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x8A255629},{0xDF6CA7F0,0x4DB62599},{0xA9D5C404,0xEABE394C}, + {0x98173ec4,0xcab2076d},{0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7F0,0x4DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B534,0x991112C7}, + {0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C434,0xEABE394C},{0x1A75B523,0x891112C7},{0x660FCC45,0xAE18A40B} +}; + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB52, 3) +#else +__launch_bounds__(TPB50, 3) +#endif +void quark_skein512_gpu_hash_64(const uint32_t threads,uint64_t* g_hash, const uint32_t* g_nonceVector){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + + // Skein + uint2 p[8], h[9]; + + const uint32_t hashPosition = (g_nonceVector == NULL) ? thread : g_nonceVector[thread]; + + uint64_t *Hash = &g_hash[hashPosition<<3]; + + uint2x4 *phash = (uint2x4*)Hash; + *(uint2x4*)&p[0] = __ldg4(&phash[0]); + *(uint2x4*)&p[4] = __ldg4(&phash[1]); + + h[0] = p[0]; h[1] = p[1]; h[2] = p[2]; h[3] = p[3]; + h[4] = p[4]; h[5] = p[5]; h[6] = p[6]; h[7] = p[7]; + + p[0] += buffer[0]; p[1] += buffer[1]; p[2] += buffer[2]; p[3] += buffer[3]; p[4] += buffer[4]; p[5] += buffer[5]; p[6] += buffer[6]; p[7] += buffer[7]; + TFBIGMIX8e(); + p[0] += buffer[8]; p[1] += buffer[9]; p[2] += buffer[10]; p[3] += buffer[11]; p[4] += buffer[12]; p[5] += buffer[13]; p[6] += buffer[14]; p[7] += buffer[15]; + TFBIGMIX8o(); + p[0] += buffer[16]; p[1] += buffer[17]; p[2] += buffer[18]; p[3] += buffer[19]; p[4] += buffer[20]; p[5] += buffer[21]; p[6] += buffer[22]; p[7] += buffer[23]; + TFBIGMIX8e(); + p[0] += buffer[24]; p[1] += buffer[25]; p[2] += buffer[26]; p[3] += buffer[27]; p[4] += buffer[28]; p[5] += buffer[29]; p[6] += buffer[30]; p[7] += buffer[31]; + TFBIGMIX8o(); + p[0] += buffer[32]; p[1] += buffer[33]; p[2] += buffer[34]; p[3] += buffer[35]; p[4] += buffer[36]; p[5] += buffer[37]; p[6] += buffer[38]; p[7] += buffer[39]; + TFBIGMIX8e(); + p[0] += buffer[40]; p[1] += buffer[41]; p[2] += buffer[42]; p[3] += buffer[43]; p[4] += buffer[44]; p[5] += buffer[45]; p[6] += buffer[46]; p[7] += buffer[47]; + TFBIGMIX8o(); + p[0] += buffer[48]; p[1] += buffer[49]; p[2] += buffer[50]; p[3] += buffer[51]; p[4] += buffer[52]; p[5] += buffer[53]; p[6] += buffer[54]; p[7] += buffer[55]; + TFBIGMIX8e(); + p[0] += buffer[56]; p[1] += buffer[57]; p[2] += buffer[58]; p[3] += buffer[59]; p[4] += buffer[60]; p[5] += buffer[61]; p[6] += buffer[62]; p[7] += buffer[63]; + TFBIGMIX8o(); + p[0] += buffer[64]; p[1] += buffer[65]; p[2] += buffer[66]; p[3] += buffer[67]; p[4] += buffer[68]; p[5] += buffer[69]; p[6] += buffer[70]; p[7] += buffer[71]; + TFBIGMIX8e(); + p[0] += buffer[72]; p[1] += buffer[73]; p[2] += buffer[74]; p[3] += buffer[75]; p[4] += buffer[76]; p[5] += buffer[77]; p[6] += buffer[78]; p[7] += buffer[79]; + TFBIGMIX8o(); + p[0] += buffer[80]; p[1] += buffer[81]; p[2] += buffer[82]; p[3] += buffer[83]; p[4] += buffer[84]; p[5] += buffer[85]; p[6] += buffer[86]; p[7] += buffer[87]; + TFBIGMIX8e(); + p[0] += buffer[88]; p[1] += buffer[89]; p[2] += buffer[90]; p[3] += buffer[91]; p[4] += buffer[92]; p[5] += buffer[93]; p[6] += buffer[94]; p[7] += buffer[95]; + TFBIGMIX8o(); + p[0] += buffer[96]; p[1] += buffer[97]; p[2] += buffer[98]; p[3] += buffer[99]; p[4] += buffer[100]; p[5] += buffer[101]; p[6] += buffer[102]; p[7] += buffer[103]; + TFBIGMIX8e(); + p[0] += buffer[104]; p[1] += buffer[105]; p[2] += buffer[106]; p[3] += buffer[107]; p[4] += buffer[108]; p[5] += buffer[109]; p[6] += buffer[110]; p[7] += buffer[111]; + TFBIGMIX8o(); + p[0] += buffer[112]; p[1] += buffer[113]; p[2] += buffer[114]; p[3] += buffer[115]; p[4] += buffer[116]; p[5] += buffer[117]; p[6] += buffer[118]; p[7] += buffer[119]; + TFBIGMIX8e(); + p[0] += buffer[120]; p[1] += buffer[121]; p[2] += buffer[122]; p[3] += buffer[123]; p[4] += buffer[124]; p[5] += buffer[125]; p[6] += buffer[126]; p[7] += buffer[127]; + TFBIGMIX8o(); + p[0] += buffer[128]; p[1] += buffer[129]; p[2] += buffer[130]; p[3] += buffer[131]; p[4] += buffer[132]; p[5] += buffer[133]; p[6] += buffer[134]; p[7] += buffer[135]; + TFBIGMIX8e(); + p[0] += buffer[136]; p[1] += buffer[137]; p[2] += buffer[138]; p[3] += buffer[139]; p[4] += buffer[140]; p[5] += buffer[141]; p[6] += buffer[142]; p[7] += buffer[143]; + TFBIGMIX8o(); + p[0] += buffer[144]; p[1] += buffer[145]; p[2] += buffer[146]; p[3] += buffer[147]; p[4] += buffer[148]; p[5] += buffer[149]; p[6] += buffer[150]; p[7] += buffer[151]; + + h[0]^= p[0]; + h[1]^= p[1]; + h[2]^= p[2]; + h[3]^= p[3]; + h[4]^= p[4]; + h[5]^= p[5]; + h[6]^= p[6]; + h[7]^= p[7]; + + h[8] = h[0] ^ h[1] ^ h[2] ^ h[3] ^ h[4] ^ h[5] ^ h[6] ^ h[7] ^ vectorize(0x1BD11BDAA9FC1A22); + + uint32_t t0; + uint2 t1,t2; + t0 = 8; + t1 = vectorize(0xFF00000000000000); + t2 = t1+t0; + + p[5] = h[5] + 8U; + + p[0] = h[0] + h[1]; + p[1] = ROL2(h[1], 46) ^ p[0]; + p[2] = h[2] + h[3]; + p[3] = ROL2(h[3], 36) ^ p[2]; + p[4] = h[4] + p[5]; + p[5] = ROL2(p[5], 19) ^ p[4]; + p[6] = (h[6] + h[7] + t1); + p[7] = ROL2(h[7], 37) ^ p[6]; + p[2]+= p[1]; + p[1] = ROL2(p[1], 33) ^ p[2]; + p[4]+= p[7]; + p[7] = ROL2(p[7], 27) ^ p[4]; + p[6]+= p[5]; + p[5] = ROL2(p[5], 14) ^ p[6]; + p[0]+= p[3]; + p[3] = ROL2(p[3], 42) ^ p[0]; + p[4]+= p[1]; + p[1] = ROL2(p[1], 17) ^ p[4]; + p[6]+= p[3]; + p[3] = ROL2(p[3], 49) ^ p[6]; + p[0]+= p[5]; + p[5] = ROL2(p[5], 36) ^ p[0]; + p[2]+= p[7]; + p[7] = ROL2(p[7], 39) ^ p[2]; + p[6]+= p[1]; + p[1] = ROL2(p[1], 44) ^ p[6]; + p[0]+= p[7]; + p[7] = ROL2(p[7], 9) ^ p[0]; + p[2]+= p[5]; + p[5] = ROL2(p[5], 54) ^ p[2]; + p[4]+= p[3]; + p[3] = ROR8(p[3]) ^ p[4]; + + p[0]+= h[1]; p[1]+= h[2]; + p[2]+= h[3]; p[3]+= h[4]; + p[4]+= h[5]; p[5]+= h[6] + t1; + p[6]+= h[7] + t2; p[7]+= h[8] + 1U; + TFBIGMIX8o(); + p[0]+= h[2]; p[1]+= h[3]; + p[2]+= h[4]; p[3]+= h[5]; + p[4]+= h[6]; p[5]+= h[7] + t2; + p[6]+= h[8] + t0; p[7]+= h[0] + 2U; + TFBIGMIX8e(); + p[0]+= h[3]; p[1]+= h[4]; + p[2]+= h[5]; p[3]+= h[6]; + p[4]+= h[7]; p[5]+= h[8] + t0; + p[6]+= h[0] + t1; p[7]+= h[1] + 3U; + TFBIGMIX8o(); + p[0]+= h[4]; p[1]+= h[5]; + p[2]+= h[6]; p[3]+= h[7]; + p[4]+= h[8]; p[5]+= h[0] + t1; + p[6]+= h[1] + t2; p[7]+= h[2] + 4U; + TFBIGMIX8e(); + p[0]+= h[5]; p[1]+= h[6]; + p[2]+= h[7]; p[3]+= h[8]; + p[4]+= h[0]; p[5]+= h[1] + t2; + p[6]+= h[2] + t0; p[7]+= h[3] + 5U; + TFBIGMIX8o(); + p[0]+= h[6]; p[1]+= h[7]; + p[2]+= h[8]; p[3]+= h[0]; + p[4]+= h[1]; p[5]+= h[2] + t0; + p[6]+= h[3] + t1; p[7]+= h[4] + 6U; + TFBIGMIX8e(); + p[0]+= h[7]; p[1]+= h[8]; + p[2]+= h[0]; p[3]+= h[1]; + p[4]+= h[2]; p[5]+= h[3] + t1; + p[6]+= h[4] + t2; p[7]+= h[5] + 7U; + TFBIGMIX8o(); + p[0]+= h[8]; p[1]+= h[0]; + p[2]+= h[1]; p[3]+= h[2]; + p[4]+= h[3]; p[5]+= h[4] + t2; + p[6]+= h[5] + t0; p[7]+= h[6] + 8U; + TFBIGMIX8e(); + p[0]+= h[0]; p[1]+= h[1]; + p[2]+= h[2]; p[3]+= h[3]; + p[4]+= h[4]; p[5]+= h[5] + t0; + p[6]+= h[6] + t1; p[7]+= h[7] + 9U; + TFBIGMIX8o(); + p[0] = p[0] + h[1]; p[1] = p[1] + h[2]; + p[2] = p[2] + h[3]; p[3] = p[3] + h[4]; + p[4] = p[4] + h[5]; p[5] = p[5] + h[6] + t1; + p[6] = p[6] + h[7] + t2;p[7] = p[7] + h[8] + 10U; + TFBIGMIX8e(); + p[0] = p[0] + h[2]; p[1] = p[1] + h[3]; + p[2] = p[2] + h[4]; p[3] = p[3] + h[5]; + p[4] = p[4] + h[6]; p[5] = p[5] + h[7] + t2; + p[6] = p[6] + h[8] + t0;p[7] = p[7] + h[0] + 11U; + TFBIGMIX8o(); + p[0] = p[0] + h[3]; p[1] = p[1] + h[4]; + p[2] = p[2] + h[5]; p[3] = p[3] + h[6]; + p[4] = p[4] + h[7]; p[5] = p[5] + h[8] + t0; + p[6] = p[6] + h[0] + t1;p[7] = p[7] + h[1] + 12U; + TFBIGMIX8e(); + p[0] = p[0] + h[4]; p[1] = p[1] + h[5]; + p[2] = p[2] + h[6]; p[3] = p[3] + h[7]; + p[4] = p[4] + h[8]; p[5] = p[5] + h[0] + t1; + p[6] = p[6] + h[1] + t2;p[7] = p[7] + h[2] + 13U; + TFBIGMIX8o(); + p[0] = p[0] + h[5]; p[1] = p[1] + h[6]; + p[2] = p[2] + h[7]; p[3] = p[3] + h[8]; + p[4] = p[4] + h[0]; p[5] = p[5] + h[1] + t2; + p[6] = p[6] + h[2] + t0;p[7] = p[7] + h[3] + 14U; + TFBIGMIX8e(); + p[0] = p[0] + h[6]; p[1] = p[1] + h[7]; + p[2] = p[2] + h[8]; p[3] = p[3] + h[0]; + p[4] = p[4] + h[1]; p[5] = p[5] + h[2] + t0; + p[6] = p[6] + h[3] + t1;p[7] = p[7] + h[4] + 15U; + TFBIGMIX8o(); + p[0] = p[0] + h[7]; p[1] = p[1] + h[8]; + p[2] = p[2] + h[0]; p[3] = p[3] + h[1]; + p[4] = p[4] + h[2]; p[5] = p[5] + h[3] + t1; + p[6] = p[6] + h[4] + t2;p[7] = p[7] + h[5] + 16U; + TFBIGMIX8e(); + p[0] = p[0] + h[8]; p[1] = p[1] + h[0]; + p[2] = p[2] + h[1]; p[3] = p[3] + h[2]; + p[4] = p[4] + h[3]; p[5] = p[5] + h[4] + t2; + p[6] = p[6] + h[5] + t0;p[7] = p[7] + h[6] + 17U; + TFBIGMIX8o(); + p[0] = p[0] + h[0]; p[1] = p[1] + h[1]; + p[2] = p[2] + h[2]; p[3] = p[3] + h[3]; + p[4] = p[4] + h[4]; p[5] = p[5] + h[5] + t0; + p[6] = p[6] + h[6] + t1;p[7] = p[7] + h[7] + 18U; + + phash = (uint2x4*)p; + uint2x4 *outpt = (uint2x4*)Hash; + outpt[0] = phash[0]; + outpt[1] = phash[1]; + + } +} + +__host__ +void quark_skein512_cpu_hash_64(int thr_id,uint32_t threads, uint32_t *d_nonceVector, uint32_t *d_hash) +{ + uint32_t tpb = TPB52; + int dev_id = device_map[thr_id]; + + if (device_sm[dev_id] <= 500) tpb = TPB50; + const dim3 grid((threads + tpb-1)/tpb); + const dim3 block(tpb); + quark_skein512_gpu_hash_64 << > >(threads, (uint64_t*)d_hash, d_nonceVector); + +} + +static __constant__ uint2 c_buffer[120]; // padded message (80 bytes + 72 bytes midstate + align) + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB52, 3) +#else +__launch_bounds__(TPB50, 5) +#endif +void skein512_gpu_hash_80(uint32_t threads, uint32_t startNounce, uint64_t *output64){ + + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + // Skein + uint2 h[9]; + uint2 t0, t1, t2; + + uint32_t nonce = cuda_swab32(startNounce + thread); + uint2 nonce2 = make_uint2(c_buffer[0].x, nonce); + + uint2 p[8]; + p[1] = nonce2; + + h[0] = c_buffer[ 1]; + h[1] = c_buffer[ 2]; + h[2] = c_buffer[ 3]; + h[3] = c_buffer[ 4]; + h[4] = c_buffer[ 5]; + h[5] = c_buffer[ 6]; + h[6] = c_buffer[ 7]; + h[7] = c_buffer[ 8]; + h[8] = c_buffer[ 9]; + + t0 = vectorize(0x50ull); + t1 = vectorize(0xB000000000000000ull); + t2 = t0^t1; + + p[ 1]=nonce2 + h[1]; p[ 0]= c_buffer[10] + p[ 1]; + p[ 2]=c_buffer[11]; + p[ 3]=c_buffer[12]; + p[ 4]=c_buffer[13]; + p[ 5]=c_buffer[14]; + p[ 6]=c_buffer[15]; + p[ 7]=c_buffer[16]; + +// TFBIGMIX8e(); + p[1] = ROL2(p[1], 46) ^ p[0]; + p[2] += p[1]; + p[0] += p[3]; + p[1] = ROL2(p[1], 33) ^ p[2]; + p[3] = c_buffer[17] ^ p[0]; + p[4] += p[1]; + p[6] += p[3]; + p[0] += p[5]; + p[2] += p[7]; + p[1] = ROL2(p[1], 17) ^ p[4]; + p[3] = ROL2(p[3], 49) ^ p[6]; + p[5] = c_buffer[18] ^ p[0]; + p[7] = c_buffer[19] ^ p[2]; + p[6] += p[1]; + p[0] += p[7]; + p[2] += p[5]; + p[4] += p[3]; + p[1] = ROL2(p[1], 44) ^ p[6]; + p[7] = ROL2(p[7], 9) ^ p[0]; + p[5] = ROL2(p[5], 54) ^ p[2]; + p[3] = ROR8(p[3]) ^ p[4]; + + p[ 0]+=h[1]; p[ 1]+=h[2]; p[ 2]+=h[3]; p[ 3]+=h[4]; p[ 4]+=h[5]; p[ 5]+=c_buffer[20]; p[ 7]+=c_buffer[21]; p[ 6]+=c_buffer[22]; + TFBIGMIX8o(); + p[ 0]+=h[2]; p[ 1]+=h[3]; p[ 2]+=h[4]; p[ 3]+=h[5]; p[ 4]+=h[6]; p[ 5]+=c_buffer[22]; p[ 7]+=c_buffer[23]; p[ 6]+=c_buffer[24]; + TFBIGMIX8e(); + p[ 0]+=h[3]; p[ 1]+=h[4]; p[ 2]+=h[5]; p[ 3]+=h[6]; p[ 4]+=h[7]; p[ 5]+=c_buffer[24]; p[ 7]+=c_buffer[25]; p[ 6]+=c_buffer[26]; + TFBIGMIX8o(); + p[ 0]+=h[4]; p[ 1]+=h[5]; p[ 2]+=h[6]; p[ 3]+=h[7]; p[ 4]+=h[8]; p[ 5]+=c_buffer[26]; p[ 7]+=c_buffer[27]; p[ 6]+=c_buffer[28]; + TFBIGMIX8e(); + p[ 0]+=h[5]; p[ 1]+=h[6]; p[ 2]+=h[7]; p[ 3]+=h[8]; p[ 4]+=h[0]; p[ 5]+=c_buffer[28]; p[ 7]+=c_buffer[29]; p[ 6]+=c_buffer[30]; + TFBIGMIX8o(); + p[ 0]+=h[6]; p[ 1]+=h[7]; p[ 2]+=h[8]; p[ 3]+=h[0]; p[ 4]+=h[1]; p[ 5]+=c_buffer[30]; p[ 7]+=c_buffer[31]; p[ 6]+=c_buffer[32]; + TFBIGMIX8e(); + p[ 0]+=h[7]; p[ 1]+=h[8]; p[ 2]+=h[0]; p[ 3]+=h[1]; p[ 4]+=h[2]; p[ 5]+=c_buffer[32]; p[ 7]+=c_buffer[33]; p[ 6]+=c_buffer[34]; + TFBIGMIX8o(); + p[ 0]+=h[8]; p[ 1]+=h[0]; p[ 2]+=h[1]; p[ 3]+=h[2]; p[ 4]+=h[3]; p[ 5]+=c_buffer[34]; p[ 7]+=c_buffer[35]; p[ 6]+=c_buffer[36]; + TFBIGMIX8e(); + p[ 0]+=h[0]; p[ 1]+=h[1]; p[ 2]+=h[2]; p[ 3]+=h[3]; p[ 4]+=h[4]; p[ 5]+=c_buffer[36]; p[ 7]+=c_buffer[37]; p[ 6]+=c_buffer[38]; + TFBIGMIX8o(); + p[ 0]+=h[1]; p[ 1]+=h[2]; p[ 2]+=h[3]; p[ 3]+=h[4]; p[ 4]+=h[5]; p[ 5]+=c_buffer[38]; p[ 7]+=c_buffer[39]; p[ 6]+=c_buffer[40]; + TFBIGMIX8e(); + p[ 0]+=h[2]; p[ 1]+=h[3]; p[ 2]+=h[4]; p[ 3]+=h[5]; p[ 4]+=h[6]; p[ 5]+=c_buffer[40]; p[ 7]+=c_buffer[41]; p[ 6]+=c_buffer[42]; + TFBIGMIX8o(); + p[ 0]+=h[3]; p[ 1]+=h[4]; p[ 2]+=h[5]; p[ 3]+=h[6]; p[ 4]+=h[7]; p[ 5]+=c_buffer[42]; p[ 7]+=c_buffer[43]; p[ 6]+=c_buffer[44]; + TFBIGMIX8e(); + p[ 0]+=h[4]; p[ 1]+=h[5]; p[ 2]+=h[6]; p[ 3]+=h[7]; p[ 4]+=h[8]; p[ 5]+=c_buffer[44]; p[ 7]+=c_buffer[45]; p[ 6]+=c_buffer[46]; + TFBIGMIX8o(); + p[ 0]+=h[5]; p[ 1]+=h[6]; p[ 2]+=h[7]; p[ 3]+=h[8]; p[ 4]+=h[0]; p[ 5]+=c_buffer[46]; p[ 7]+=c_buffer[47]; p[ 6]+=c_buffer[48]; + TFBIGMIX8e(); + p[ 0]+=h[6]; p[ 1]+=h[7]; p[ 2]+=h[8]; p[ 3]+=h[0]; p[ 4]+=h[1]; p[ 5]+=c_buffer[48]; p[ 7]+=c_buffer[49]; p[ 6]+=c_buffer[50]; + TFBIGMIX8o(); + p[ 0]+=h[7]; p[ 1]+=h[8]; p[ 2]+=h[0]; p[ 3]+=h[1]; p[ 4]+=h[2]; p[ 5]+=c_buffer[50]; p[ 7]+=c_buffer[51]; p[ 6]+=c_buffer[52]; + TFBIGMIX8e(); + p[ 0]+=h[8]; p[ 1]+=h[0]; p[ 2]+=h[1]; p[ 3]+=h[2]; p[ 4]+=h[3]; p[ 5]+=c_buffer[52]; p[ 7]+=c_buffer[53]; p[ 6]+=c_buffer[54]; + TFBIGMIX8o(); + p[ 0]+=h[0]; p[ 1]+=h[1]; p[ 2]+=h[2]; p[ 3]+=h[3]; p[ 4]+=h[4]; p[ 5]+=c_buffer[54]; p[ 7]+=c_buffer[55]; p[ 6]+=c_buffer[56]; + + p[0]^= c_buffer[57]; + p[1]^= nonce2; + + t0 = vectorize(8); // extra + t1 = vectorize(0xFF00000000000000ull); // etype + t2 = t0^t1; + + h[0] = p[ 0]; + h[1] = p[ 1]; + h[2] = p[ 2]; + h[3] = p[ 3]; + h[4] = p[ 4]; + h[5] = p[ 5]; + h[6] = p[ 6]; + h[7] = p[ 7]; + + h[8] = h[0] ^ h[1] ^ h[2] ^ h[3] ^ h[4] ^ h[5] ^ h[6] ^ h[7] ^ vectorize(0x1BD11BDAA9FC1A22); + p[ 0] = p[ 1] = p[ 2] = p[ 3] = p[ 4] =p[ 5] =p[ 6] = p[ 7] = vectorize(0); + + #define h0 h[0] + #define h1 h[1] + #define h2 h[2] + #define h3 h[3] + #define h4 h[4] + #define h5 h[5] + #define h6 h[6] + #define h7 h[7] + #define h8 h[8] + + TFBIG_4e_UI2(0); + TFBIG_4o_UI2(1); + TFBIG_4e_UI2(2); + TFBIG_4o_UI2(3); + TFBIG_4e_UI2(4); + TFBIG_4o_UI2(5); + TFBIG_4e_UI2(6); + TFBIG_4o_UI2(7); + TFBIG_4e_UI2(8); + TFBIG_4o_UI2(9); + TFBIG_4e_UI2(10); + TFBIG_4o_UI2(11); + TFBIG_4e_UI2(12); + TFBIG_4o_UI2(13); + TFBIG_4e_UI2(14); + TFBIG_4o_UI2(15); + TFBIG_4e_UI2(16); + TFBIG_4o_UI2(17); + TFBIG_ADDKEY_UI2(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, 18); + + uint64_t *outpHash = &output64[thread<<3]; + #pragma unroll 8 + for (int i = 0; i < 8; i++) + outpHash[i] = devectorize(p[i]); + } + +} + +__host__ +void skein512_cpu_setBlock_80(void *pdata) +{ + uint64_t message[20]; + memcpy(&message[0], pdata, 80); + + uint64_t p[8]; + uint64_t h[9]; + uint64_t t0, t1, t2; + + h[0] = 0x4903ADFF749C51CEull; + h[1] = 0x0D95DE399746DF03ull; + h[2] = 0x8FD1934127C79BCEull; + h[3] = 0x9A255629FF352CB1ull; + h[4] = 0x5DB62599DF6CA7B0ull; + h[5] = 0xEABE394CA9D5C3F4ull; + h[6] = 0x991112C71A75B523ull; + h[7] = 0xAE18A40B660FCC33ull; + // h[8] = h[0] ^ h[1] ^ h[2] ^ h[3] ^ h[4] ^ h[5] ^ h[6] ^ h[7] ^ SPH_C64(0x1BD11BDAA9FC1A22); + h[8] = 0xcab2076d98173ec4ULL; + + t0 = 64; // ptr + t1 = 0x7000000000000000ull; + t2 = 0x7000000000000040ull; + + memcpy(&p[0], &message[0], 64); + + TFBIG_4e_PRE(0); + TFBIG_4o_PRE(1); + TFBIG_4e_PRE(2); + TFBIG_4o_PRE(3); + TFBIG_4e_PRE(4); + TFBIG_4o_PRE(5); + TFBIG_4e_PRE(6); + TFBIG_4o_PRE(7); + TFBIG_4e_PRE(8); + TFBIG_4o_PRE(9); + TFBIG_4e_PRE(10); + TFBIG_4o_PRE(11); + TFBIG_4e_PRE(12); + TFBIG_4o_PRE(13); + TFBIG_4e_PRE(14); + TFBIG_4o_PRE(15); + TFBIG_4e_PRE(16); + TFBIG_4o_PRE(17); + TFBIG_ADDKEY_PRE(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, 18); + + message[10] = message[0] ^ p[0]; + message[11] = message[1] ^ p[1]; + message[12] = message[2] ^ p[2]; + message[13] = message[3] ^ p[3]; + message[14] = message[4] ^ p[4]; + message[15] = message[5] ^ p[5]; + message[16] = message[6] ^ p[6]; + message[17] = message[7] ^ p[7]; + + message[18] = t2; + + uint64_t buffer[128]; + +// buffer[ 0] = message[ 8]; + buffer[ 0] = message[ 9]; + h[0] = buffer[ 1] = message[10]; + h[1] = buffer[ 2] = message[11]; + h[2] = buffer[ 3] = message[12]; + h[3] = buffer[ 4] = message[13]; + h[4] = buffer[ 5] = message[14]; + h[5] = buffer[ 6] = message[15]; + h[6] = buffer[ 7] = message[16]; + h[7] = buffer[ 8] = message[17]; + h[8] = buffer[ 9] = h[0]^h[1]^h[2]^h[3]^h[4]^h[5]^h[6]^h[7]^0x1BD11BDAA9FC1A22ULL; + + t0 = 0x50ull; + t1 = 0xB000000000000000ull; + t2 = t0^t1; + + p[ 0] = message[ 8] + h[0]; p[ 2] = h[2]; p[ 3] = h[3]; p[ 4] = h[4]; + p[ 5] = h[5] + t0; p[ 6] = h[6] + t1; p[ 7] = h[7]; + + p[2] += p[3]; p[4] += p[5]; p[6] += p[7]; + + p[3] = ROTL64(p[3], 36) ^ p[2]; p[5] = ROTL64(p[5], 19) ^ p[4]; p[7] = ROTL64(p[7], 37) ^ p[6]; + + p[4] += p[7]; p[6] += p[5]; + + p[7] = ROTL64(p[7], 27) ^ p[4]; + p[5] = ROTL64(p[5], 14) ^ p[6]; + + buffer[10] = p[ 0]; + buffer[11] = p[ 2]; + buffer[12] = p[ 3]; + buffer[13] = p[ 4]; + buffer[14] = p[ 5]; + buffer[15] = p[ 6]; + buffer[16] = p[ 7]; + buffer[17] = ROTL64(p[3], 42); + buffer[18] = ROTL64(p[5], 36); + buffer[19] = ROTL64(p[7], 39); + + buffer[20]=h[6]+t1; + buffer[21]=h[8]+1; + buffer[22]=h[7]+t2; + buffer[23]=h[0]+2; + buffer[24]=h[8]+t0; + buffer[25]=h[1]+3; + buffer[26]=h[0]+t1; + buffer[27]=h[2]+4; + buffer[28]=h[1]+t2; + buffer[29]=h[3]+5; + buffer[30]=h[2]+t0; + buffer[31] = h[4]+6; + buffer[32] = h[3]+t1; + buffer[33] = h[5]+7; + buffer[34] = h[4]+t2; + buffer[35] = h[6]+8; + buffer[36] = h[5]+t0; + buffer[37] = h[7]+9; + buffer[38] = h[6]+t1; + buffer[39] = h[8]+10; + buffer[40] = h[7]+t2; + buffer[41] = h[0]+11; + buffer[42] = h[8]+t0; + buffer[43] = h[1]+12; + buffer[44] = h[0]+t1; + buffer[45] = h[2]+13; + buffer[46] = h[1]+t2; + buffer[47] = h[3]+14; + buffer[48] = h[2]+t0; + buffer[49] = h[4]+15; + buffer[50] = h[3]+t1; + buffer[51] = h[5]+16; + buffer[52] = h[4]+t2; + buffer[53] = h[6]+17; + buffer[54] = h[5]+t0; + buffer[55] = h[7]+18; + buffer[56] = h[6]+t1; + + buffer[57] = message[ 8]; + + cudaMemcpyToSymbol(c_buffer, buffer, sizeof(buffer), 0, cudaMemcpyHostToDevice); + + CUDA_SAFE_CALL(cudaGetLastError()); +} + +__host__ +void skein512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *g_hash) +{ + uint32_t tpb = TPB52; + int dev_id = device_map[thr_id]; + + if (device_sm[dev_id] <= 500) tpb = TPB50; + const dim3 grid((threads + tpb-1)/tpb); + const dim3 block(tpb); + + uint64_t *d_hash = (uint64_t*) g_hash; + + // hash function is cut in 2 parts to reduce kernel size + skein512_gpu_hash_80 <<< grid, block >>> (threads, startNounce, d_hash); +} diff --git a/quark/groestl_functions_quad.h b/quark/groestl_functions_quad.h new file mode 100644 index 0000000..628795c --- /dev/null +++ b/quark/groestl_functions_quad.h @@ -0,0 +1,363 @@ +#include "cuda_helper.h" +#include "cuda_vectors.h" + +__device__ __forceinline__ +static void G256_AddRoundConstantQ_quad(uint32_t &x7, uint32_t &x6, uint32_t &x5, uint32_t &x4, uint32_t &x3, uint32_t &x2, uint32_t &x1, uint32_t &x0, const int round){ + + const uint32_t andmask = ((-((threadIdx.x & 0x03) == 3)) & 0xffff0000); + + x0 = (~x0) ^ ((-(round & 0x01)) & andmask); + x1 = (~x1) ^ ((-(round & 0x02)) & andmask); + x2 = (~x2) ^ ((-(round & 0x04)) & andmask); + x3 = (~x3) ^ ((-(round & 0x08)) & andmask); + x4 = (~x4) ^ (0xAAAA0000 & andmask); + x5 = (~x5) ^ (0xCCCC0000 & andmask); + x6 = (~x6) ^ (0xF0F00000 & andmask); + x7 = (~x7) ^ (0xFF000000 & andmask); +} + +__device__ __forceinline__ +static void G256_AddRoundConstantP_quad(uint32_t &x7, uint32_t &x6, uint32_t &x5, uint32_t &x4, uint32_t &x3, uint32_t &x2, uint32_t &x1, uint32_t &x0, const int round){ + + const uint32_t andmask1 = ((threadIdx.x & 0x03) - 1) >> 16; + + x0 = x0 ^ ((-(round & 0x01)) & andmask1); + x1 = x1 ^ ((-((round & 0x02) >> 1)) & andmask1); + x2 = x2 ^ ((-((round & 0x04) >> 2)) & andmask1); + x3 = x3 ^ ((-((round & 0x08) >> 3)) & andmask1); + x4 = x4 ^ (0xAAAA & andmask1); + x5 = x5 ^ (0xCCCC & andmask1); + x6 = x6 ^ (0xF0F0 & andmask1); + x7 = x7 ^ (0xFF00 & andmask1); +} + +__device__ __forceinline__ +static void G16mul_quad(uint32_t &x3, uint32_t &x2, uint32_t &x1, uint32_t &x0,const uint32_t &y3, const uint32_t &y2, const uint32_t &y1, const uint32_t &y0) +{ + uint32_t t0,t1,t2; + + t0 = ((x2 ^ x0) ^ (x3 ^ x1)) & ((y2 ^ y0) ^ (y3 ^ y1)); + t1 = ((x2 ^ x0) & (y2 ^ y0)) ^ t0; + t2 = ((x3 ^ x1) & (y3 ^ y1)) ^ t0 ^ t1; + + t0 = (x2^x3) & (y2^y3); + x3 = (x3 & y3) ^ t1 ^ t0; + x2 = (x2 & y2) ^ t2 ^ t0; + + t0 = (x0^x1) & (y0^y1); + x1 = (x1 & y1) ^ t1 ^ t0; + x0 = (x0 & y0) ^ t2 ^ t0; +} + +__device__ __forceinline__ +static void G256_inv_quad(uint32_t &x7, uint32_t &x6, uint32_t &x5, uint32_t &x4, uint32_t &x3, uint32_t &x2, uint32_t &x1, uint32_t &x0){ + + uint32_t t0,t1,t2,t3,t4,t5,t6,a,b; + + t3 = x7; + t2 = x6; + t1 = x5; + t0 = x4; + + G16mul_quad(t3, t2, t1, t0, x3, x2, x1, x0); + + a = (x4 ^ x0); + t0 ^= a; + t2 ^= (x7 ^ x3) ^ (x5 ^ x1); + t1 ^= (x5 ^ x1) ^ a; + t3 ^= (x6 ^ x2) ^ a; + + b = t0 ^ t1; + t4 = (t2 ^ t3) & b; + a = t4 ^ t3 ^ t1; + t5 = (t3 & t1) ^ a; + t6 = (t2 & t0) ^ a ^ (t2 ^ t0); + + t4 = (t5 ^ t6) & b; + t1 = (t6 & t1) ^ t4; + t0 = (t5 & t0) ^ t4; + + t4 = (t5 ^ t6) & (t2^t3); + t3 = (t6 & t3) ^ t4; + t2 = (t2 & t5) ^ t4; + + G16mul_quad(x3, x2, x1, x0, t1, t0, t3, t2); + + G16mul_quad(x7, x6, x5, x4, t1, t0, t3, t2); +} + +__device__ +static void transAtoX_quad(uint32_t &x0, uint32_t &x1, uint32_t &x2, uint32_t &x3, uint32_t &x4, uint32_t &x5, uint32_t &x6, uint32_t &x7){ + + uint32_t t0, t1; + t0 = x0 ^ x1 ^ x2; + t1 = x5 ^ x6; + x2 = x7 ^ t1 ^ t0; + x6 = x6 ^ x3 ^ t0; + x3 = x0 ^ x1 ^ x3 ^ x4 ^ x7; + x4 = x0 ^ x4 ^ t1; + x2 = t0 ^ t1 ^ x7; + x1 = x0 ^ x1 ^ t1; + x7 = x0 ^ t1 ^ x7; + x5 = x0 ^ t1; + +} + +__device__ +static void transXtoA_quad(uint32_t &x0, uint32_t &x1, uint32_t &x2, uint32_t &x3, uint32_t &x4, uint32_t &x5, uint32_t &x6, uint32_t &x7){ + + uint32_t t0,t2,t3,t5; + + x1 ^= x4; + t0 = x1 ^ x6; + x1 ^= x5; + + t2 = x0 ^ x2; + x2 = x3 ^ x5; + t2 ^= x2 ^ x6; + x2 ^= x7; + t3 = x4 ^ x2 ^ x6; + + t5 = x0 ^ x6; + x4 = x3 ^ x7; + x0 = x3 ^ x5; + + x6 = t0; + x3 = t2; + x7 = t3; + x5 = t5; +} + +__device__ +static void G256_ShiftBytesP_quad(uint32_t &x7, uint32_t &x6, uint32_t &x5, uint32_t &x4, uint32_t &x3, uint32_t &x2, uint32_t &x1, uint32_t &x0){ + + uint32_t t0,t1; + + const uint32_t tpos = threadIdx.x & 0x03; + const uint32_t shift1 = tpos << 1; + const uint32_t shift2 = shift1 + 1 + ((tpos == 3) << 2); + + t0 = __byte_perm(x0, 0, 0x1010)>>shift1; + t1 = __byte_perm(x0, 0, 0x3232)>>shift2; + x0 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x1, 0, 0x1010)>>shift1; + t1 = __byte_perm(x1, 0, 0x3232)>>shift2; + x1 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x2, 0, 0x1010)>>shift1; + t1 = __byte_perm(x2, 0, 0x3232)>>shift2; + x2 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x3, 0, 0x1010)>>shift1; + t1 = __byte_perm(x3, 0, 0x3232)>>shift2; + x3 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x4, 0, 0x1010)>>shift1; + t1 = __byte_perm(x4, 0, 0x3232)>>shift2; + x4 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x5, 0, 0x1010)>>shift1; + t1 = __byte_perm(x5, 0, 0x3232)>>shift2; + x5 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x6, 0, 0x1010)>>shift1; + t1 = __byte_perm(x6, 0, 0x3232)>>shift2; + x6 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x7, 0, 0x1010)>>shift1; + t1 = __byte_perm(x7, 0, 0x3232)>>shift2; + x7 = __byte_perm(t0, t1, 0x5410); +} + +__device__ +static void G256_ShiftBytesQ_quad(uint32_t &x7, uint32_t &x6, uint32_t &x5, uint32_t &x4, uint32_t &x3, uint32_t &x2, uint32_t &x1, uint32_t &x0){ + + uint32_t t0,t1; + + const uint32_t tpos = threadIdx.x & 0x03; + const uint32_t shift1 = (1 - (tpos >> 1)) + ((tpos & 0x01) << 2); + const uint32_t shift2 = shift1 + 2 + ((tpos == 1) << 2); + + t0 = __byte_perm(x0, 0, 0x1010)>>shift1; + t1 = __byte_perm(x0, 0, 0x3232)>>shift2; + x0 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x1, 0, 0x1010)>>shift1; + t1 = __byte_perm(x1, 0, 0x3232)>>shift2; + x1 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x2, 0, 0x1010)>>shift1; + t1 = __byte_perm(x2, 0, 0x3232)>>shift2; + x2 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x3, 0, 0x1010)>>shift1; + t1 = __byte_perm(x3, 0, 0x3232)>>shift2; + x3 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x4, 0, 0x1010)>>shift1; + t1 = __byte_perm(x4, 0, 0x3232)>>shift2; + x4 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x5, 0, 0x1010)>>shift1; + t1 = __byte_perm(x5, 0, 0x3232)>>shift2; + x5 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x6, 0, 0x1010)>>shift1; + t1 = __byte_perm(x6, 0, 0x3232)>>shift2; + x6 = __byte_perm(t0, t1, 0x5410); + + t0 = __byte_perm(x7, 0, 0x1010)>>shift1; + t1 = __byte_perm(x7, 0, 0x3232)>>shift2; + x7 = __byte_perm(t0, t1, 0x5410); +} + + +__device__ __forceinline__ +static void G256_MixFunction_quad(uint32_t *const __restrict__ r){ + +#define A(idx, l) __shfl(r[idx], (threadIdx.x+l)&3, 4) +#define S(idx, l) __byte_perm(A(idx,l),A(idx,l+1),0x5432) + + + uint32_t b[8]; + +#if __CUDA_ARCH__ > 500 + + const uint32_t tmp = S(7, 1) ^ S(7, 3) ^ A(7, 2) ^ A(7, 3); + + b[6] = S(6, 1) ^ S(6, 3) ^ A(6, 2) ^ A(6, 3); + + const uint32_t tmp2= b[6] ^ S(7, 3) ^ A(7, 4) ^ S(7, 4) ^ A(7, 5) ^ S(7, 6); + + b[5] = S(5, 1) ^ S(5, 3) ^ A(5, 2) ^ A(5, 3); + b[6] = b[5] ^ S(6, 3) ^ A(6, 4) ^ S(6, 4) ^ A(6, 5) ^ S(6, 6); + r[7] = b[6] ^ S(7, 2) ^ A(7, 2) ^ S(7, 3) ^ A(7, 3) ^ A(7, 5); + + b[4] = S(4, 1) ^ S(4, 3) ^ A(4, 2) ^ A(4, 3); + b[5] = b[4] ^ S(5, 3) ^ A(5, 4) ^ S(5, 4) ^ A(5, 5) ^ S(5, 6); + r[6] = b[5] ^ S(6, 2) ^ A(6, 2) ^ S(6, 3) ^ A(6, 3) ^ A(6, 5); + + b[3] = S(3, 1) ^ S(3, 3) ^ A(3, 2) ^ A(3, 3); + b[4] = b[3] ^ S(4, 3) ^ A(4, 4) ^ S(4, 4) ^ A(4, 5) ^ S(4, 6) ^ tmp; + r[5] = b[4] ^ S(5, 2) ^ A(5, 2) ^ S(5, 3) ^ A(5, 3) ^ A(5, 5); + + b[2] = S(2, 1) ^ S(2, 3) ^ A(2, 2) ^ A(2, 3); + b[3] = b[2] ^ S(3, 3) ^ A(3, 4) ^ S(3, 4) ^ A(3, 5) ^ S(3, 6) ^ tmp; + r[4] = b[3] ^ S(4, 2) ^ A(4, 2) ^ S(4, 3) ^ A(4, 3) ^ A(4, 5) ^ tmp2; + + b[1] = S(1, 1) ^ S(1, 3) ^ A(1, 2) ^ A(1, 3); + b[2] = b[1] ^ S(2, 3) ^ A(2, 4) ^ S(2, 4) ^ A(2, 5) ^ S(2, 6); + r[3] = b[2] ^ S(3, 2) ^ A(3, 2) ^ S(3, 3) ^ A(3, 3) ^ A(3, 5) ^ tmp2; + + b[0] = S(0, 1) ^ S(0, 3) ^ A(0, 2) ^ A(0, 3); + b[1] = b[0] ^ S(1, 3) ^ A(1, 4) ^ S(1, 4) ^ A(1, 5) ^ S(1, 6) ^ tmp; + r[2] = b[1] ^ S(2, 2) ^ A(2, 2) ^ S(2, 3) ^ A(2, 3) ^ A(2, 5); + + b[0] = tmp ^ S(0, 3) ^ A(0, 4) ^ S(0, 4) ^ A(0, 5) ^ S(0, 6); + r[1] = b[0] ^ S(1, 2) ^ A(1, 2) ^ S(1, 3) ^ A(1, 3) ^ A(1, 5)^tmp2; + + r[0] = tmp2 ^ S(0, 2) ^ A(0, 2) ^ S(0, 3) ^ A(0, 3) ^ A(0, 5); + +#else + + b[0] = S(0, 1) ^ A(0, 2) ^ S(0, 3) ^ A(0, 3); + b[1] = S(1, 1) ^ A(1, 2) ^ S(1, 3) ^ A(1, 3); + b[2] = S(2, 1) ^ A(2, 2) ^ S(2, 3) ^ A(2, 3); + b[3] = S(3, 1) ^ A(3, 2) ^ S(3, 3) ^ A(3, 3); + b[4] = S(4, 1) ^ A(4, 2) ^ S(4, 3) ^ A(4, 3); + b[5] = S(5, 1) ^ A(5, 2) ^ S(5, 3) ^ A(5, 3); + b[6] = S(6, 1) ^ A(6, 2) ^ S(6, 3) ^ A(6, 3); + b[7] = S(7, 1) ^ A(7, 2) ^ S(7, 3) ^ A(7, 3); + + uint32_t tmp = b[7]; + b[7] = b[6] ^ S(7, 3) ^ A(7, 4) ^ S(7, 4) ^ A(7, 5) ^ S(7, 6); + b[6] = b[5] ^ S(6, 3) ^ A(6, 4) ^ S(6, 4) ^ A(6, 5) ^ S(6, 6); + b[5] = b[4] ^ S(5, 3) ^ A(5, 4) ^ S(5, 4) ^ A(5, 5) ^ S(5, 6); + b[4] = b[3] ^ S(4, 3) ^ A(4, 4) ^ S(4, 4) ^ A(4, 5) ^ S(4, 6) ^ tmp; + b[3] = b[2] ^ S(3, 3) ^ A(3, 4) ^ S(3, 4) ^ A(3, 5) ^ S(3, 6) ^ tmp; + b[2] = b[1] ^ S(2, 3) ^ A(2, 4) ^ S(2, 4) ^ A(2, 5) ^ S(2, 6); + b[1] = b[0] ^ S(1, 3) ^ A(1, 4) ^ S(1, 4) ^ A(1, 5) ^ S(1, 6) ^ tmp; + b[0] = tmp ^ S(0, 3) ^ A(0, 4) ^ S(0, 4) ^ A(0, 5) ^ S(0, 6); + + tmp = b[7]; + r[7] = b[6] ^ S(7, 2) ^ A(7, 2) ^ S(7, 3) ^ A(7, 3) ^ A(7, 5); + r[6] = b[5] ^ S(6, 2) ^ A(6, 2) ^ S(6, 3) ^ A(6, 3) ^ A(6, 5); + r[5] = b[4] ^ S(5, 2) ^ A(5, 2) ^ S(5, 3) ^ A(5, 3) ^ A(5, 5); + r[4] = b[3] ^ S(4, 2) ^ A(4, 2) ^ S(4, 3) ^ A(4, 3) ^ A(4, 5) ^ tmp; + r[3] = b[2] ^ S(3, 2) ^ A(3, 2) ^ S(3, 3) ^ A(3, 3) ^ A(3, 5) ^ tmp; + r[2] = b[1] ^ S(2, 2) ^ A(2, 2) ^ S(2, 3) ^ A(2, 3) ^ A(2, 5); + r[1] = b[0] ^ S(1, 2) ^ A(1, 2) ^ S(1, 3) ^ A(1, 3) ^ A(1, 5)^tmp; + r[0] = tmp ^ S(0, 2) ^ A(0, 2) ^ S(0, 3) ^ A(0, 3) ^ A(0, 5); + +#endif + +#undef S +#undef A +} + +__device__ __forceinline__ +static void sbox_quad(uint32_t *const __restrict__ r){ + + transAtoX_quad(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7]); + + G256_inv_quad(r[2], r[4], r[1], r[7], r[3], r[0], r[5], r[6]); + + transXtoA_quad(r[7], r[1], r[4], r[2], r[6], r[5], r[0], r[3]); + + r[0] = r[0] ^ 0xFFFFFFFF; + r[1] = r[1] ^ 0xFFFFFFFF; + r[5] = r[5] ^ 0xFFFFFFFF; + r[6] = r[6] ^ 0xFFFFFFFF; +} + +__device__ __forceinline__ +static void groestl512_perm_P_quad(uint32_t *const __restrict__ r){ + + #if __CUDA_ARCH__ >500 + #pragma unroll 10 + #else + #pragma unroll 1 + #endif + for (int round = 0; round<14; round++) + { + G256_AddRoundConstantP_quad(r[7], r[6], r[5], r[4], r[3], r[2], r[1], r[0], round); + sbox_quad(r); + G256_ShiftBytesP_quad(r[7], r[6], r[5], r[4], r[3], r[2], r[1], r[0]); + G256_MixFunction_quad(r); + } +} + +__device__ __forceinline__ +static void groestl512_perm_Q_quad(uint32_t *const __restrict__ r){ + + #if __CUDA_ARCH__ >500 + #pragma unroll 10 + #else + #pragma unroll 1 + #endif + for (int round = 0; round<14; round++) + { + G256_AddRoundConstantQ_quad(r[7], r[6], r[5], r[4], r[3], r[2], r[1], r[0], round); + sbox_quad(r); + G256_ShiftBytesQ_quad(r[7], r[6], r[5], r[4], r[3], r[2], r[1], r[0]); + G256_MixFunction_quad(r); + } +} + +__device__ __forceinline__ +static void groestl512_progressMessage_quad(uint32_t *const __restrict__ state, uint32_t *const __restrict__ message, const uint32_t thr){ + + ((uint8*)state)[0] = ((uint8*)message)[0]; + + if (thr == 3) state[ 1] ^= 0x00008000; + groestl512_perm_P_quad(state); + if (thr == 3) state[ 1] ^= 0x00008000; + groestl512_perm_Q_quad(message); + ((uint8*)state)[0] ^= ((uint8*)message)[0]; + ((uint8*)message)[0] = ((uint8*)state)[0]; + + groestl512_perm_P_quad(message); + + ((uint8*)state)[0] ^= ((uint8*)message)[0]; +} diff --git a/quark/groestl_transf_quad.h b/quark/groestl_transf_quad.h new file mode 100644 index 0000000..d7d01a4 --- /dev/null +++ b/quark/groestl_transf_quad.h @@ -0,0 +1,114 @@ +#define merge8(z,x,y,b)\ + z=__byte_perm(x, y, b); \ + +#define SWAP8(x,y)\ + x=__byte_perm(x, y, 0x5410); \ + y=__byte_perm(y, x, 0x5410); + +#define SWAP4(x,y)\ + t = 0xf0f0f0f0 & (x ^ (y<<4)); \ + x^= t; \ + y^= t>>4; + +#define SWAP2(x,y)\ + t = 0xcccccccc & (x ^ (y<<2)); \ + x^= t; \ + y^= t>>2; + +#define SWAP1(x,y)\ + t = 0xaaaaaaaa & (x ^ (y<<1)); \ + x^= t; \ + y^= t>>1; + +__device__ +static void to_bitslice_quad(uint32_t *const __restrict__ input, uint32_t *const __restrict__ output){ + + uint32_t other[8]; + uint32_t t; + + uint32_t perm = (threadIdx.x & 1) ? 0x7362 : 0x5140; + const uint32_t n = threadIdx.x & 3; + + #pragma unroll 8 + for (uint32_t i = 0; i < 8; i++) + { + input[i] = __shfl(input[i], (n ^ (3 * ((n == 1) || (n == 2)))&3), 4); + other[i] = __shfl(input[i], (threadIdx.x + 1) & 3, 4); + input[i] = __shfl(input[i], threadIdx.x & 2, 4); + other[i] = __shfl(other[i], threadIdx.x & 2, 4); + } + + merge8(output[0], input[0], input[4], perm); + merge8(output[1], other[0], other[4], perm); + merge8(output[2], input[1], input[5], perm); + merge8(output[3], other[1], other[5], perm); + merge8(output[4], input[2], input[6], perm); + merge8(output[5], other[2], other[6], perm); + merge8(output[6], input[3], input[7], perm); + merge8(output[7], other[3], other[7], perm); + + SWAP1(output[0], output[1]); + SWAP1(output[2], output[3]); + SWAP1(output[4], output[5]); + SWAP1(output[6], output[7]); + + SWAP2(output[0], output[2]); + SWAP2(output[1], output[3]); + SWAP2(output[4], output[6]); + SWAP2(output[5], output[7]); + + SWAP4(output[0], output[4]); + SWAP4(output[1], output[5]); + SWAP4(output[2], output[6]); + SWAP4(output[3], output[7]); +} + +__device__ +static void from_bitslice_quad52(const uint32_t *const __restrict__ input, uint32_t *const __restrict__ output) +{ + uint32_t t; + const uint32_t perm = 0x7531;//(threadIdx.x & 1) ? 0x3175 : 0x7531; + + output[0] = __byte_perm(input[0], input[4], perm); + output[2] = __byte_perm(input[1], input[5], perm); + output[8] = __byte_perm(input[2], input[6], perm); + output[10] = __byte_perm(input[3], input[7], perm); + + SWAP1(output[0], output[2]); + SWAP1(output[8], output[10]); + SWAP2(output[0], output[8]); + SWAP2(output[2], output[10]); + + t = __byte_perm(output[0], output[8], 0x5410); + output[8] = __byte_perm(output[0], output[8], 0x7632); + output[0] = t; + + t = __byte_perm(output[2], output[10], 0x5410); + output[10] = __byte_perm(output[2], output[10], 0x7632); + output[2] = t; + + SWAP4(output[0], output[8]); + SWAP4(output[2], output[10]); + + if (threadIdx.x & 1) + { + output[4] = __byte_perm(output[0], 0, 0x3232); + output[0] = __byte_perm(output[0], 0, 0x1032); + + output[6] = __byte_perm(output[2], 0, 0x3232); + output[2] = __byte_perm(output[2], 0, 0x1032); + + output[12] = __byte_perm(output[8], 0, 0x3232); + output[8] = __byte_perm(output[8], 0, 0x1032); + + output[14] = __byte_perm(output[10], 0, 0x3232); + output[10] = __byte_perm(output[10], 0, 0x1032); + } + else + { + output[4] = output[0]; + output[6] = output[2]; + output[12] = output[8]; + output[14] = output[10]; + } +} diff --git a/quark/quarkcoin.cu b/quark/quarkcoin.cu new file mode 100644 index 0000000..5873ad8 --- /dev/null +++ b/quark/quarkcoin.cu @@ -0,0 +1,266 @@ +extern "C" +{ +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" +} + +#include "miner.h" + +#include "cuda_helper.h" +#include "cuda_quark.h" + +#include + +static uint32_t *d_hash[MAX_GPUS]; + +// Speicher zur Generierung der Noncevektoren für die bedingten Hashes +static uint32_t *d_branch1Nonces[MAX_GPUS]; +static uint32_t *d_branch2Nonces[MAX_GPUS]; +static uint32_t *d_branch3Nonces[MAX_GPUS]; + +static uint32_t h_resNonce[MAX_GPUS][4]; +static uint32_t *d_resNonce[MAX_GPUS]; + +// Original Quarkhash Funktion aus einem miner Quelltext +extern "C" void quarkhash(void *state, const void *input) +{ + unsigned char _ALIGN(128) hash[64]; + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, (void*) hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512 (&ctx_bmw, (const void*) hash, 64); + sph_bmw512_close(&ctx_bmw, (void*) hash); + + if (hash[0] & 0x8) + { + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, (void*) hash); + } + else + { + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, (void*) hash); + } + + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, (void*) hash); + + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, (void*) hash); + + if (hash[0] & 0x8) + { + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, (const void*) hash, 64); + sph_blake512_close(&ctx_blake, (void*) hash); + } + else + { + sph_bmw512_init(&ctx_bmw); + sph_bmw512 (&ctx_bmw, (const void*) hash, 64); + sph_bmw512_close(&ctx_bmw, (void*) hash); + } + + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, (void*) hash); + + if (hash[0] & 0x8) + { + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + } + else + { + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, (void*) hash); + } + + memcpy(state, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_quark(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + uint32_t _ALIGN(64) endiandata[20]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + const uint64_t highTarget = *(uint64_t*)&ptarget[6]; + + int dev_id = device_map[thr_id]; + uint32_t default_throughput = 1U << 22; + default_throughput+=3774720; //22.9 + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ptarget[7] = 0x00F; + + if (!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], (size_t) 64 * throughput)); + + quark_compactTest_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_branch1Nonces[thr_id], throughput*sizeof(uint32_t))); + CUDA_SAFE_CALL(cudaMalloc(&d_branch2Nonces[thr_id], throughput*sizeof(uint32_t))); + CUDA_SAFE_CALL(cudaMalloc(&d_branch3Nonces[thr_id], throughput*sizeof(uint32_t))); + + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], 4 * sizeof(uint32_t))); + + init[thr_id] = true; + } + + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + + int rc = 0; + cudaMemset(d_resNonce[thr_id], 0xFFFFFFFF, 4*sizeof(uint32_t)); + do { + uint32_t nrm1=0, nrm2=0, nrm3=0; + + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64_quark(thr_id, throughput, d_hash[thr_id]); + + quark_compactTest_single_false_cpu_hash_64(thr_id, throughput, d_hash[thr_id], NULL, d_branch3Nonces[thr_id], &nrm3); + quark_skein512_cpu_hash_64(thr_id, nrm3, d_branch3Nonces[thr_id], d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, nrm3, d_branch3Nonces[thr_id], d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, nrm3, d_branch3Nonces[thr_id], d_hash[thr_id]); + + quark_compactTest_cpu_hash_64(thr_id, nrm3, d_hash[thr_id], d_branch3Nonces[thr_id], d_branch1Nonces[thr_id], &nrm1, d_branch2Nonces[thr_id], &nrm2); + + quark_blake512_cpu_hash_64(thr_id, nrm1, d_branch1Nonces[thr_id], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, nrm2, d_branch2Nonces[thr_id], d_hash[thr_id]); + quark_keccak_skein512_cpu_hash_64(thr_id, nrm3, d_branch3Nonces[thr_id], d_hash[thr_id]); + + quark_compactTest_cpu_hash_64(thr_id, nrm3, d_hash[thr_id], d_branch3Nonces[thr_id], d_branch1Nonces[thr_id], &nrm1, d_branch2Nonces[thr_id], &nrm2); + + quark_keccak512_cpu_hash_64_final(thr_id, nrm1, d_branch1Nonces[thr_id], d_hash[thr_id],highTarget,&d_resNonce[thr_id][0]); + quark_jh512_cpu_hash_64_final(thr_id, nrm2, d_branch2Nonces[thr_id], d_hash[thr_id],highTarget,&d_resNonce[thr_id][2]); + + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], 4*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + int pos = -1; + if (h_resNonce[thr_id][0] != UINT32_MAX) + pos = 0; + else if (h_resNonce[thr_id][2] != UINT32_MAX) + pos = 2; + + if (pos != -1 ){ + const uint32_t startNounce = pdata[19]; + uint32_t vhash[8]; + be32enc(&endiandata[19], (startNounce+h_resNonce[thr_id][pos])); + quarkhash(vhash, endiandata); + + if (vhash[7] <= ptarget[7] && fulltest(vhash, ptarget)) { + work_set_target_ratio(work, vhash); + *hashes_done = pdata[19] + throughput - first_nonce; + pdata[19] = (startNounce+h_resNonce[thr_id][pos]); +// work->nonces[ 0] = pdata[19]; + rc = 1; + //check for another nonce + for(int i=pos+1;i<4;i++){ + if(h_resNonce[thr_id][i] != UINT32_MAX){ + be32enc(&endiandata[19], (startNounce+h_resNonce[thr_id][i])); + quarkhash(vhash, endiandata); + if (vhash[7] <= ptarget[7] && fulltest(vhash, ptarget)) { +// work_set_target_ratio(work, vhash); + pdata[21] = (startNounce+h_resNonce[thr_id][i]); + if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash); + xchg(pdata[19],pdata[21]); + } +// work->nonces[ 0] = pdata[21]; +// if(!opt_quiet) +// applog(LOG_BLUE,"Found 2nd nonce: %08X",pdata[21]); + rc++; + return rc; + }else{ + gpulog(LOG_WARNING, thr_id, "2nd nonce result for %08x does not validate on CPU!", h_resNonce[thr_id][i]); + applog_hash((uchar*) vhash); + applog_hash((uchar*) ptarget); + break; + } + } + } + return rc; + } + else{ + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][pos]); + cudaMemset(d_resNonce[thr_id], 0xFFFFFFFF, 4*sizeof(uint32_t)); + applog_hash((uchar*) vhash); + applog_hash((uchar*) ptarget); + } + } + pdata[19] += throughput; + + }while(!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce; + + return rc; +} + +// cleanup +extern "C" void free_quark(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + cudaFree(d_hash[thr_id]); + cudaFree(d_resNonce[thr_id]); + //cudaFreeHost(h_resNonce[thr_id]); + + cudaFree(d_branch1Nonces[thr_id]); + cudaFree(d_branch2Nonces[thr_id]); + cudaFree(d_branch3Nonces[thr_id]); + + quark_compactTest_cpu_free(thr_id); + + cuda_check_cpu_free(thr_id); + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/qubit/qubit.cu b/qubit/qubit.cu new file mode 100644 index 0000000..0e0650b --- /dev/null +++ b/qubit/qubit.cu @@ -0,0 +1,172 @@ +/* + * qubit algorithm + * + */ +extern "C" { +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" +} + +#include "miner.h" + +#include "cuda_helper.h" +#include "x11/cuda_x11.h" + +#define NBN 2 + +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +static uint32_t *d_hash[MAX_GPUS]; + +extern void qubit_luffa512_cpu_setBlock_80(void *pdata); +extern void qubit_luffa512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_hash); + +extern "C" void qubithash(void *state, const void *input) +{ + uint8_t _ALIGN(128) hash[64]; + + // luffa1-cubehash2-shavite3-simd4-echo5 + + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + + sph_luffa512_init(&ctx_luffa); + sph_luffa512 (&ctx_luffa, input, 80); + sph_luffa512_close(&ctx_luffa, (void*) hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512 (&ctx_cubehash, (const void*) hash, 64); + sph_cubehash512_close(&ctx_cubehash, (void*) hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512 (&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, (void*) hash); + + sph_simd512_init(&ctx_simd); + sph_simd512 (&ctx_simd, (const void*) hash, 64); + sph_simd512_close(&ctx_simd, (void*) hash); + + sph_echo512_init(&ctx_echo); + sph_echo512 (&ctx_echo, (const void*) hash, 64); + sph_echo512_close(&ctx_echo, (void*) hash); + + memcpy(state, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_qubit(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + int dev_id = device_map[thr_id]; + + uint32_t _ALIGN(64) endiandata[20]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + uint32_t intensity = (device_sm[dev_id] <= 500) ? 20 : 21; + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); // 256*256*8 + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ptarget[7] = 0x007f; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + init[thr_id] = true; + } + + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + qubit_luffa512_cpu_setBlock_80((void*)endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + do { + // Hash with CUDA + qubit_luffa512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id], d_resNonce[thr_id], *(uint64_t*)&ptarget[6]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + qubithash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { +// if (!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce %08x ",h_resNonce[thr_id][1]); + + be32enc(&endiandata[19], startNounce+h_resNonce[thr_id][1]); + qubithash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]) + work_set_target_ratio(work, vhash64); + pdata[21] = startNounce+h_resNonce[thr_id][1]; + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && (uint64_t)max_nonce > (uint64_t)throughput + pdata[19]); + + *hashes_done = pdata[19] - first_nonce; + return 0; +} + +// cleanup +extern "C" void free_qubit(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/qubit/qubit_luffa512.cu b/qubit/qubit_luffa512.cu new file mode 100644 index 0000000..dbc9b5e --- /dev/null +++ b/qubit/qubit_luffa512.cu @@ -0,0 +1,841 @@ +/******************************************************************************* + * luffa512 for 80-bytes input (with midstate precalc based on the work of klausT and SP) + */ + +#include +#include "cuda_helper.h" +#include "cuda_vectors.h" + +static unsigned char PaddedMessage[128]; +__constant__ uint64_t c_PaddedMessage80[10]; // padded message (80 bytes + padding) +__constant__ uint32_t _ALIGN(8) statebufferpre[8]; +__constant__ uint32_t _ALIGN(8) statechainvpre[40]; + +#define MULT0(a) {\ + tmp = a[7]; \ + a[7] = a[6]; \ + a[6] = a[5]; \ + a[5] = a[4]; \ + a[4] = a[3] ^ tmp; \ + a[3] = a[2] ^ tmp; \ + a[2] = a[1]; \ + a[1] = a[0] ^ tmp; \ + a[0] = tmp; \ +} + +#define MULT2(a,j) {\ + tmp = a[7+(8*j)];\ + a[7+(8*j)] = a[6+(8*j)];\ + a[6+(8*j)] = a[5+(8*j)];\ + a[5+(8*j)] = a[4+(8*j)];\ + a[4+(8*j)] = a[3+(8*j)] ^ tmp;\ + a[3+(8*j)] = a[2+(8*j)] ^ tmp;\ + a[2+(8*j)] = a[1+(8*j)];\ + a[1+(8*j)] = a[0+(8*j)] ^ tmp;\ + a[0+(8*j)] = tmp;\ +} + +#define TWEAK(a0,a1,a2,a3,j)\ + a0 = ROTL32(a0,j);\ + a1 = ROTL32(a1,j);\ + a2 = ROTL32(a2,j);\ + a3 = ROTL32(a3,j); + +#define STEP(c0,c1) {\ +\ + uint32_t temp[ 2];\ + temp[ 0] = chainv[0];\ + temp[ 1] = chainv[ 5];\ + chainv[ 2] ^= chainv[ 3];\ + chainv[ 7] ^= chainv[ 4];\ + chainv[ 0] |= chainv[ 1];\ + chainv[ 5] |= chainv[ 6];\ + chainv[ 1] = ~chainv[ 1];\ + chainv[ 6] = ~chainv[ 6];\ + chainv[ 0] ^= chainv[ 3];\ + chainv[ 5] ^= chainv[ 4];\ + chainv[ 3] &= temp[ 0];\ + chainv[ 4] &= temp[ 1];\ + chainv[ 1] ^= chainv[ 3];\ + chainv[ 6] ^= chainv[ 4];\ + chainv[ 3] ^= chainv[ 2];\ + chainv[ 4] ^= chainv[ 7];\ + chainv[ 2] &= chainv[ 0];\ + chainv[ 7] &= chainv[ 5];\ + chainv[ 0] = ~chainv[ 0];\ + chainv[ 5] = ~chainv[ 5];\ + chainv[ 2] ^= chainv[ 1];\ + chainv[ 7] ^= chainv[ 6];\ + chainv[ 1] |= chainv[ 3];\ + chainv[ 6] |= chainv[ 4];\ + temp[ 0] ^= chainv[ 1];\ + temp[ 1] ^= chainv[ 6];\ + chainv[ 3] ^= chainv[ 2];\ + chainv[ 4] ^= chainv[ 7] ^ temp[ 0];\ + chainv[ 2] &= chainv[ 1];\ + chainv[ 7] = (chainv[ 7] & chainv[ 6]) ^ chainv[ 3];\ + chainv[ 1] ^= chainv[ 0];\ + chainv[ 6] ^= chainv[ 5] ^ chainv[ 2];\ + chainv[ 5] = chainv[ 1] ^ temp[ 1];\ + chainv[ 0] = chainv[ 4] ^ ROTL32(temp[ 0],2); \ + chainv[ 1] = chainv[ 5] ^ ROTL32(chainv[ 1],2); \ + chainv[ 2] = chainv[ 6] ^ ROTL32(chainv[ 2],2); \ + chainv[ 3] = chainv[ 7] ^ ROTL32(chainv[ 3],2); \ + chainv[ 4] = chainv[ 0] ^ ROTL32(chainv[ 4],14); \ + chainv[ 5] = chainv[ 1] ^ ROTL32(chainv[ 5],14); \ + chainv[ 6] = chainv[ 2] ^ ROTL32(chainv[ 6],14); \ + chainv[ 7] = chainv[ 3] ^ ROTL32(chainv[ 7],14); \ + chainv[ 0] = chainv[ 4] ^ ROTL32(chainv[ 0],10) ^ c0; \ + chainv[ 1] = chainv[ 5] ^ ROTL32(chainv[ 1],10); \ + chainv[ 2] = chainv[ 6] ^ ROTL32(chainv[ 2],10); \ + chainv[ 3] = chainv[ 7] ^ ROTL32(chainv[ 3],10); \ + chainv[ 4] = ROTL32(chainv[ 4],1) ^ c1; \ + chainv[ 5] = ROTL32(chainv[ 5],1); \ + chainv[ 6] = ROTL32(chainv[ 6],1); \ + chainv[ 7] = ROTL32(chainv[ 7],1); \ +} + +__device__ __forceinline__ +void STEP2(uint32_t *t, const uint2 c0, const uint2 c1){ + uint32_t temp[ 4]; + temp[ 0] = t[ 0]; + temp[ 1] = t[ 5]; + temp[ 2] = t[0+8]; + temp[ 3] = t[8+5]; + t[ 2] ^= t[ 3]; + t[ 7] ^= t[ 4]; + t[8+2] ^= t[8+3]; + t[8+7] ^= t[8+4]; + t[ 0] |= t[ 1]; + t[ 5] |= t[ 6]; + t[8+0]|= t[8+1]; + t[8+5]|= t[8+6]; + t[ 1] = ~t[ 1]; + t[ 6] = ~t[ 6]; + t[8+1] = ~t[8+1]; + t[8+6] = ~t[8+6]; + t[ 0] ^= t[ 3]; + t[ 5] ^= t[ 4]; + t[8+0]^= t[8+3]; + t[8+5]^= t[8+4]; + t[ 3] &= temp[ 0]; + t[ 4] &= temp[ 1]; + t[8+3]&= temp[ 2]; + t[8+4]&= temp[ 3]; + t[ 1] ^= t[ 3]; + t[ 6] ^= t[ 4]; + t[8+1]^= t[8+3]; + t[8+6]^= t[8+4]; + t[ 3] ^= t[ 2]; + t[ 4] ^= t[ 7]; + t[8+3]^= t[8+2]; + t[8+4]^= t[8+7]; + t[ 2] &= t[ 0]; + t[ 7] &= t[ 5]; + t[8+2]&= t[8+0]; + t[8+7]&= t[8+5]; + t[ 0] = ~t[ 0]; + t[ 5] = ~t[ 5]; + t[8+0] = ~t[8+0]; + t[8+5] = ~t[8+5]; + t[ 2] ^= t[ 1]; + t[ 7] ^= t[ 6]; + t[8+2]^= t[8+1]; + t[8+7]^= t[8+6]; + t[ 1] |= t[ 3]; + t[ 6] |= t[ 4]; + t[8+1]|= t[8+3]; + t[8+6]|= t[8+4]; + + temp[ 0] ^= t[ 1]; + temp[ 1] ^= t[ 6]; + temp[ 2] ^= t[8+1]; + temp[ 3] ^= t[8+6]; + + t[ 3] ^= t[ 2]; + t[ 4] ^= t[ 7] ^ temp[ 0]; + t[8+3]^= t[8+2]; + t[8+4]^= t[8+7] ^ temp[ 2]; + t[ 2] &= t[ 1]; + t[ 7] = (t[ 7] & t[ 6]) ^ t[ 3]; + t[8+2]&= t[8+1]; + t[ 1] ^= t[ 0]; + t[8+7] = (t[8+6] & t[8+7]) ^ t[8+3]; + t[ 6] ^= t[ 5] ^ t[ 2]; + t[8+1]^= t[8+0]; + t[8+6]^= t[8+2]^ t[8+5]; + t[ 5] = t[ 1] ^ temp[ 1]; + t[ 0] = t[ 4] ^ ROTL32(temp[ 0],2); + t[8+5] = t[8+1]^ temp[ 3]; + t[8+0] = t[8+4]^ ROTL32(temp[ 2],2); + t[ 1] = t[ 5] ^ ROTL32(t[ 1],2); + t[ 2] = t[ 6] ^ ROTL32(t[ 2],2); + t[8+1] = t[8+5]^ ROTL32(t[8+1],2); + t[8+2] = t[8+6]^ ROTL32(t[8+2],2); + t[ 3] = t[ 7] ^ ROTL32(t[ 3],2); + t[ 4] = t[ 0] ^ ROTL32(t[ 4],14); + t[8+3] = t[8+7] ^ ROTL32(t[8+3],2); + t[8+4] = t[8+0] ^ ROTL32(t[8+4],14); + t[ 5] = t[ 1] ^ ROTL32(t[ 5],14); + t[ 6] = t[ 2] ^ ROTL32(t[ 6],14); + t[8+5] = t[8+1] ^ ROTL32(t[8+5],14); + t[8+6] = t[8+2] ^ ROTL32(t[8+6],14); + t[ 7] = t[ 3] ^ ROTL32(t[ 7],14); + t[ 0] = t[ 4] ^ ROTL32(t[ 0],10) ^ c0.x; + t[8+7] = t[8+3]^ ROTL32(t[8+7],14); + t[8+0] = t[8+4]^ ROTL32(t[8+0],10) ^ c1.x; + t[ 1] = t[ 5] ^ ROTL32(t[ 1],10); + t[ 2] = t[ 6] ^ ROTL32(t[ 2],10); + t[8+1] = t[8+5]^ ROTL32(t[8+1],10); + t[8+2] = t[8+6]^ ROTL32(t[8+2],10); + t[ 3] = t[ 7] ^ ROTL32(t[ 3],10); + t[ 4] = ROTL32(t[ 4],1) ^ c0.y; + t[8+3] = t[8+7] ^ ROTL32(t[8+3],10); + t[8+4] = ROTL32(t[8+4],1) ^ c1.y; + t[ 5] = ROTL32(t[ 5],1); + t[ 6] = ROTL32(t[ 6],1); + t[8+5] = ROTL32(t[8+5],1); + t[8+6] = ROTL32(t[8+6],1); + t[ 7] = ROTL32(t[ 7],1); + t[8+7] = ROTL32(t[8+7],1); +} + +__device__ __forceinline__ +void STEP1(uint32_t *t, const uint2 c){ + uint32_t temp[ 2]; + temp[ 0] = t[ 0]; temp[ 1] = t[ 5]; + t[ 2] ^= t[ 3]; t[ 7] ^= t[ 4]; + t[ 0] |= t[ 1]; t[ 5] |= t[ 6]; + t[ 1] = ~t[ 1]; t[ 6] = ~t[ 6]; + t[ 0] ^= t[ 3]; t[ 5] ^= t[ 4]; + t[ 3] &= temp[ 0]; t[ 4] &= temp[ 1]; + t[ 1] ^= t[ 3]; t[ 6] ^= t[ 4]; + t[ 3] ^= t[ 2]; t[ 4] ^= t[ 7]; + t[ 2] &= t[ 0]; t[ 7] &= t[ 5]; + t[ 0] = ~t[ 0]; t[ 5] = ~t[ 5]; + t[ 2] ^= t[ 1]; t[ 7] ^= t[ 6]; + t[ 1] |= t[ 3]; t[ 6] |= t[ 4]; + temp[ 0] ^= t[ 1]; temp[ 1] ^= t[ 6]; + t[ 3] ^= t[ 2]; t[ 4] ^= t[ 7] ^ temp[ 0]; + t[ 2] &= t[ 1]; t[ 7] = (t[ 7] & t[ 6]) ^ t[ 3]; + t[ 1] ^= t[ 0]; t[ 6] ^= t[ 5] ^ t[ 2]; + t[ 5] = t[ 1] ^ temp[ 1]; t[ 0] = t[ 4] ^ ROTL32(temp[ 0],2); + t[ 1] = t[ 5] ^ ROTL32(t[ 1],2); t[ 2] = t[ 6] ^ ROTL32(t[ 2],2); + t[ 3] = t[ 7] ^ ROTL32(t[ 3],2); t[ 4] = t[ 0] ^ ROTL32(t[ 4],14); + t[ 5] = t[ 1] ^ ROTL32(t[ 5],14); t[ 6] = t[ 2] ^ ROTL32(t[ 6],14); + t[ 7] = t[ 3] ^ ROTL32(t[ 7],14); t[ 0] = t[ 4] ^ ROTL32(t[ 0],10) ^ c.x; + t[ 1] = t[ 5] ^ ROTL32(t[ 1],10); t[ 2] = t[ 6] ^ ROTL32(t[ 2],10); + t[ 3] = t[ 7] ^ ROTL32(t[ 3],10); t[ 4] = ROTL32(t[ 4],1) ^ c.y; + t[ 5] = ROTL32(t[ 5],1); t[ 6] = ROTL32(t[ 6],1); + t[ 7] = ROTL32(t[ 7],1); +} + +/* initial values of chaining variables */ +__constant__ const uint32_t c_CNS[80] = { + 0x303994a6,0xe0337818,0xc0e65299,0x441ba90d, 0x6cc33a12,0x7f34d442,0xdc56983e,0x9389217f, 0x1e00108f,0xe5a8bce6,0x7800423d,0x5274baf4, 0x8f5b7882,0x26889ba7,0x96e1db12,0x9a226e9d, + 0xb6de10ed,0x01685f3d,0x70f47aae,0x05a17cf4, 0x0707a3d4,0xbd09caca,0x1c1e8f51,0xf4272b28, 0x707a3d45,0x144ae5cc,0xaeb28562,0xfaa7ae2b, 0xbaca1589,0x2e48f1c1,0x40a46f3e,0xb923c704, + 0xfc20d9d2,0xe25e72c1,0x34552e25,0xe623bb72, 0x7ad8818f,0x5c58a4a4,0x8438764a,0x1e38e2e7, 0xbb6de032,0x78e38b9d,0xedb780c8,0x27586719, 0xd9847356,0x36eda57f,0xa2c78434,0x703aace7, + 0xb213afa5,0xe028c9bf,0xc84ebe95,0x44756f91, 0x4e608a22,0x7e8fce32,0x56d858fe,0x956548be, 0x343b138f,0xfe191be2,0xd0ec4e3d,0x3cb226e5, 0x2ceb4882,0x5944a28e,0xb3ad2208,0xa1c4c355, + 0xf0d2e9e3,0x5090d577,0xac11d7fa,0x2d1925ab, 0x1bcb66f2,0xb46496ac,0x6f2d9bc9,0xd1925ab0, 0x78602649,0x29131ab6,0x8edae952,0x0fc053c3, 0x3b6ba548,0x3f014f0c,0xedae9520,0xfc053c31 + }; + +static uint32_t h_CNS[80] = { + 0x303994a6,0xe0337818,0xc0e65299,0x441ba90d, 0x6cc33a12,0x7f34d442,0xdc56983e,0x9389217f, 0x1e00108f,0xe5a8bce6,0x7800423d,0x5274baf4, 0x8f5b7882,0x26889ba7,0x96e1db12,0x9a226e9d, + 0xb6de10ed,0x01685f3d,0x70f47aae,0x05a17cf4, 0x0707a3d4,0xbd09caca,0x1c1e8f51,0xf4272b28, 0x707a3d45,0x144ae5cc,0xaeb28562,0xfaa7ae2b, 0xbaca1589,0x2e48f1c1,0x40a46f3e,0xb923c704, + 0xfc20d9d2,0xe25e72c1,0x34552e25,0xe623bb72, 0x7ad8818f,0x5c58a4a4,0x8438764a,0x1e38e2e7, 0xbb6de032,0x78e38b9d,0xedb780c8,0x27586719, 0xd9847356,0x36eda57f,0xa2c78434,0x703aace7, + 0xb213afa5,0xe028c9bf,0xc84ebe95,0x44756f91, 0x4e608a22,0x7e8fce32,0x56d858fe,0x956548be, 0x343b138f,0xfe191be2,0xd0ec4e3d,0x3cb226e5, 0x2ceb4882,0x5944a28e,0xb3ad2208,0xa1c4c355, + 0xf0d2e9e3,0x5090d577,0xac11d7fa,0x2d1925ab, 0x1bcb66f2,0xb46496ac,0x6f2d9bc9,0xd1925ab0, 0x78602649,0x29131ab6,0x8edae952,0x0fc053c3, 0x3b6ba548,0x3f014f0c,0xedae9520,0xfc053c31 + }; + + +__device__ +static void rnd512(uint32_t *const __restrict__ statebuffer, uint32_t *const __restrict__ statechainv){ + uint32_t t[40]; + uint32_t tmp; + + tmp = statechainv[ 7] ^ statechainv[7 + 8] ^ statechainv[7 +16] ^ statechainv[7 +24] ^ statechainv[7 +32]; + t[7] = statechainv[ 6] ^ statechainv[6 + 8] ^ statechainv[6 +16] ^ statechainv[6 +24] ^ statechainv[6 +32]; + t[6] = statechainv[ 5] ^ statechainv[5 + 8] ^ statechainv[5 +16] ^ statechainv[5 +24] ^ statechainv[5 +32]; + t[5] = statechainv[ 4] ^ statechainv[4 + 8] ^ statechainv[4 +16] ^ statechainv[4 +24] ^ statechainv[4 +32]; + t[4] = statechainv[ 3] ^ statechainv[3 + 8] ^ statechainv[3 +16] ^ statechainv[3 +24] ^ statechainv[3 +32] ^ tmp; + t[3] = statechainv[ 2] ^ statechainv[2 + 8] ^ statechainv[2 +16] ^ statechainv[2 +24] ^ statechainv[2 +32] ^ tmp; + t[2] = statechainv[ 1] ^ statechainv[1 + 8] ^ statechainv[1 +16] ^ statechainv[1 +24] ^ statechainv[1 +32]; + t[1] = statechainv[ 0] ^ statechainv[0 + 8] ^ statechainv[0 +16] ^ statechainv[0 +24] ^ statechainv[0 +32] ^ tmp; + t[0] = tmp; + +// *(uint2x4*)statechainv ^= *(uint2x4*)t; + #pragma unroll 8 + for(int i=0;i<8;i++) + statechainv[i] ^= t[i]; + + #pragma unroll 4 + for (int j=1;j<5;j++) { + #pragma unroll 8 + for(int i=0;i<8;i++) + statechainv[i+(j<<3)] ^= t[i]; +// *(uint2x4*)&statechainv[8*j] ^= *(uint2x4*)t; + #pragma unroll 8 + for(int i=0;i<8;i++) + t[i+(j<<3)] = statechainv[i+(j<<3)]; +// *(uint2x4*)&t[8*j] = *(uint2x4*)&statechainv[8*j]; + } + +// *(uint2x4*)t = *(uint2x4*)statechainv; + #pragma unroll 8 + for(int i=0;i<8;i++) + t[i] = statechainv[i]; + + MULT0(statechainv); + + #pragma unroll 4 + for (int j=1;j<5;j++) + MULT2(statechainv, j); + + #pragma unroll 5 + for (int j=0;j<5;j++) + #pragma unroll 8 + for(int i=0;i<8;i++) + statechainv[i+8*j] ^= t[i+(8*((j+1)%5))]; +// *(uint2x4*)&statechainv[8*j] ^= *(uint2x4*)&t[8*((j+1)%5)]; + + #pragma unroll 5 + for (int j=0;j<5;j++) + *(uint2x4*)&t[8*j] = *(uint2x4*)&statechainv[8*j]; + + MULT0(statechainv); + #pragma unroll 4 + for (int j=1;j<5;j++) + MULT2(statechainv, j); + + #pragma unroll 5 + for (int j=0;j<5;j++) + *(uint2x4*)&statechainv[8*j] ^= *(uint2x4*)&t[8*((j+4)%5)]; + + #pragma unroll 5 + for (int j=0;j<5;j++) { + *(uint2x4*)&statechainv[8*j] ^= *(uint2x4*)statebuffer; + MULT0(statebuffer); + } + + TWEAK(statechainv[12], statechainv[13], statechainv[14], statechainv[15], 1); + TWEAK(statechainv[20], statechainv[21], statechainv[22], statechainv[23], 2); + TWEAK(statechainv[28], statechainv[29], statechainv[30], statechainv[31], 3); + TWEAK(statechainv[36], statechainv[37], statechainv[38], statechainv[39], 4); + + for (int i = 0; i<8; i++){ + STEP2( statechainv ,*(uint2*)&c_CNS[(2 * i) + 0], *(uint2*)&c_CNS[(2 * i) + 16]); + STEP2(&statechainv[16],*(uint2*)&c_CNS[(2 * i) + 32], *(uint2*)&c_CNS[(2 * i) + 48]); + STEP1(&statechainv[32],*(uint2*)&c_CNS[(2 * i) + 64]); + } +} + +__device__ +static void rnd512_first(uint32_t *const __restrict__ state, uint32_t *const __restrict__ buffer) +{ + #pragma unroll 5 + for (int j = 0; j<5; j++) { + uint32_t tmp; + #pragma unroll 8 + for(int i=0;i<8;i++) + state[i+(j<<3)] ^= buffer[i]; + MULT0(buffer); + } + TWEAK(state[12], state[13], state[14], state[15], 1); + TWEAK(state[20], state[21], state[22], state[23], 2); + TWEAK(state[28], state[29], state[30], state[31], 3); + TWEAK(state[36], state[37], state[38], state[39], 4); + + for (int i = 0; i<8; i++) { + STEP2(&state[ 0],*(uint2*)&c_CNS[(2 * i) + 0],*(uint2*)&c_CNS[(2 * i) + 16]); + STEP2(&state[16],*(uint2*)&c_CNS[(2 * i) + 32],*(uint2*)&c_CNS[(2 * i) + 48]); + STEP1(&state[32],*(uint2*)&c_CNS[(2 * i) + 64]); + } +} + +__device__ +static void qubit_rnd512_first(uint32_t *const __restrict__ statebuffer, uint32_t *const __restrict__ statechainv){ + + *(uint4*)&statechainv[ 0] ^= *(uint4*)&statebuffer[ 0]; + statechainv[ 4] ^= statebuffer[4]; + + *(uint4*)&statechainv[ 9] ^= *(uint4*)&statebuffer[ 0]; + statechainv[13] ^= statebuffer[4]; + + *(uint4*)&statechainv[18] ^= *(uint4*)&statebuffer[ 0]; + statechainv[22] ^= statebuffer[4]; + + *(uint4*)&statechainv[27] ^= *(uint4*)&statebuffer[ 0]; + statechainv[31] ^= statebuffer[4]; + + statechainv[0 + 8 * 4] ^= statebuffer[4]; + statechainv[1 + 8 * 4] ^= statebuffer[4]; + statechainv[3 + 8 * 4] ^= statebuffer[4]; + statechainv[4 + 8 * 4] ^= statebuffer[4]; + *(uint4*)&statechainv[4 + 8*4] ^= *(uint4*)&statebuffer[ 0]; + + TWEAK(statechainv[12], statechainv[13], statechainv[14], statechainv[15], 1); + TWEAK(statechainv[20], statechainv[21], statechainv[22], statechainv[23], 2); + TWEAK(statechainv[28], statechainv[29], statechainv[30], statechainv[31], 3); + TWEAK(statechainv[36], statechainv[37], statechainv[38], statechainv[39], 4); + + #pragma unroll 8 + for (uint32_t i = 0; i<8; i++){ + STEP2(&statechainv[ 0],*(uint2*)&c_CNS[(2 * i) + 0],*(uint2*)&c_CNS[(2 * i) + 16]); + STEP2(&statechainv[16],*(uint2*)&c_CNS[(2 * i) + 32],*(uint2*)&c_CNS[(2 * i) + 48]); + STEP1(&statechainv[32],*(uint2*)&c_CNS[(2 * i) + 64]); + } +} + + +void rnd512cpu(uint32_t *statebuffer, uint32_t *statechainv) +{ + int i, j; + uint32_t t[40]; + uint32_t chainv[8]; + uint32_t tmp; + + for (i = 0; i<8; i++) + { + t[i] = statechainv[i]; + for (j = 1; j<5; j++) + { + t[i] ^= statechainv[i + 8 * j]; + } + } + + MULT2(t, 0); + + for (j = 0; j<5; j++) + { + for (i = 0; i<8; i++) + { + statechainv[i + 8 * j] ^= t[i]; + } + } + + for (j = 0; j<5; j++) + { + for (i = 0; i<8; i++) + { + t[i + 8 * j] = statechainv[i + 8 * j]; + } + } + + for (j = 0; j<5; j++) + { + MULT2(statechainv, j); + } + + for (j = 0; j<5; j++) + { + for (i = 0; i<8; i++) + { + statechainv[8 * j + i] ^= t[8 * ((j + 1) % 5) + i]; + } + } + + for (j = 0; j<5; j++) + { + for (i = 0; i<8; i++) + { + t[i + 8 * j] = statechainv[i + 8 * j]; + } + } + + for (j = 0; j<5; j++) + { + MULT2(statechainv, j); + } + + for (j = 0; j<5; j++) + { + for (i = 0; i<8; i++) + { + statechainv[8 * j + i] ^= t[8 * ((j + 4) % 5) + i]; + } + } + + for (j = 0; j<5; j++) + { + for (i = 0; i<8; i++) + { + statechainv[i + 8 * j] ^= statebuffer[i]; + } + MULT2(statebuffer, 0); + } + + for (i = 0; i<8; i++) + { + chainv[i] = statechainv[i]; + } + + for (i = 0; i<8; i++) + { + STEP(h_CNS[(2 * i)], h_CNS[(2 * i) + 1]); + } + + for (i = 0; i<8; i++) + { + statechainv[i] = chainv[i]; + chainv[i] = statechainv[i + 8]; + } + + TWEAK(chainv[4], chainv[5], chainv[6], chainv[7], 1); + + + for (i = 0; i<8; i++) + { + STEP(h_CNS[(2 * i) + 16], h_CNS[(2 * i) + 16 + 1]); + } + + for (i = 0; i<8; i++) + { + statechainv[i + 8] = chainv[i]; + chainv[i] = statechainv[i + 16]; + } + + TWEAK(chainv[4], chainv[5], chainv[6], chainv[7], 2); + + for (i = 0; i<8; i++) + { + STEP(h_CNS[(2 * i) + 32], h_CNS[(2 * i) + 32 + 1]); + } + + for (i = 0; i<8; i++) + { + statechainv[i + 16] = chainv[i]; + chainv[i] = statechainv[i + 24]; + } + + TWEAK(chainv[4], chainv[5], chainv[6], chainv[7], 3); + + for (i = 0; i<8; i++) + { + STEP(h_CNS[(2 * i) + 48], h_CNS[(2 * i) + 48 + 1]); + } + + for (i = 0; i<8; i++) + { + statechainv[i + 24] = chainv[i]; + chainv[i] = statechainv[i + 32]; + } + + TWEAK(chainv[4], chainv[5], chainv[6], chainv[7], 4); + + for (i = 0; i<8; i++) + { + STEP(h_CNS[(2 * i) + 64], h_CNS[(2 * i) + 64 + 1]); + } + + for (i = 0; i<8; i++) + { + statechainv[i + 32] = chainv[i]; + } +} + +/***************************************************/ +__device__ __forceinline__ +static void rnd512_nullhash(uint32_t *const __restrict__ state){ + + uint32_t t[40]; + uint32_t tmp; + + tmp = state[ 7] ^ state[7 + 8] ^ state[7 +16] ^ state[7 +24] ^ state[7 +32]; + t[7] = state[ 6] ^ state[6 + 8] ^ state[6 +16] ^ state[6 +24] ^ state[6 +32]; + t[6] = state[ 5] ^ state[5 + 8] ^ state[5 +16] ^ state[5 +24] ^ state[5 +32]; + t[5] = state[ 4] ^ state[4 + 8] ^ state[4 +16] ^ state[4 +24] ^ state[4 +32]; + t[4] = state[ 3] ^ state[3 + 8] ^ state[3 +16] ^ state[3 +24] ^ state[3 +32] ^ tmp; + t[3] = state[ 2] ^ state[2 + 8] ^ state[2 +16] ^ state[2 +24] ^ state[2 +32] ^ tmp; + t[2] = state[ 1] ^ state[1 + 8] ^ state[1 +16] ^ state[1 +24] ^ state[1 +32]; + t[1] = state[ 0] ^ state[0 + 8] ^ state[0 +16] ^ state[0 +24] ^ state[0 +32] ^ tmp; + t[0] = tmp; + + #pragma unroll 5 + for (int j = 0; j<5; j++){ +// #pragma unroll 8 +// for(int i=0;i<8;i++) +// state[i+(j<<3)] ^= t[i]; + *(uint2x4*)&state[8*j] ^= *(uint2x4*)t; + } + + #pragma unroll 5 + for (int j = 0; j<5; j++){ +/// #pragma unroll 8 +/// for(int i=0;i<8;i++) +// t[i+(j<<3)] = state[i+(j<<3)]; + *(uint2x4*)&t[8*j] = *(uint2x4*)&state[8*j]; + } + #pragma unroll 5 + for (int j = 0; j<5; j++) { + MULT2(state, j); + } + + #pragma unroll 5 + for (int j = 0; j<5; j++) { +// #pragma unroll 8 +// for(int i=0;i<8;i++) +// state[i+(j<<3)] ^= t[i + (((j + 1) % 5)<<3)]; + *(uint2x4*)&state[8*j] ^= *(uint2x4*)&t[8 * ((j + 1) % 5)]; + } + + #pragma unroll 5 + for (int j = 0; j<5; j++) { +// #pragma unroll 8 +// for(int i=0;i<8;i++) +// t[i+8*j] = state[i+8*j]; + *(uint2x4*)&t[8*j] = *(uint2x4*)&state[8*j]; + } + + #pragma unroll 5 + for (int j = 0; j<5; j++) { + MULT2(state, j); + } + + #pragma unroll 5 + for (int j = 0; j<5; j++) { + #pragma unroll 8 + for(int i=0;i<8;i++) + state[i+8*j] ^= t[i+(8 * ((j + 4) % 5))]; +// *(uint2x4*)&state[8*j] ^= *(uint2x4*)&t[8 * ((j + 4) % 5)]; + } + + TWEAK(state[12], state[13], state[14], state[15], 1); + TWEAK(state[20], state[21], state[22], state[23], 2); + TWEAK(state[28], state[29], state[30], state[31], 3); + TWEAK(state[36], state[37], state[38], state[39], 4); + +// #pragma unroll 8 + for (int i = 0; i<8; i++) { + STEP2(&state[ 0],*(uint2*)&c_CNS[(2 * i) + 0],*(uint2*)&c_CNS[(2 * i) + 16]); + STEP2(&state[16],*(uint2*)&c_CNS[(2 * i) + 32],*(uint2*)&c_CNS[(2 * i) + 48]); + STEP1(&state[32],*(uint2*)&c_CNS[(2 * i) + 64]); + } +} + + +/***************************************************/ +// Die Hash-Funktion +//#if __CUDA_ARCH__ == 500 +//__launch_bounds__(256, 4) +//#endif + + +__global__ __launch_bounds__(256, 4) +void qubit_luffa512_gpu_hash_80(const uint32_t threads,const uint32_t startNounce, uint32_t *outputHash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + const uint32_t nounce = startNounce + thread; + uint64_t buff[16] = {0}; + + buff[ 8] = c_PaddedMessage80[8]; + buff[ 9] = c_PaddedMessage80[9]; + buff[10] = 0x80; + buff[11] = 0x0100; + buff[15] = 0x8002000000000000; + + // die Nounce durch die thread-spezifische ersetzen + buff[9] = REPLACE_HIDWORD(buff[9], cuda_swab32(nounce)); + + uint32_t statebuffer[8]; + uint32_t statechainv[40]; + + #pragma unroll 4 + for (int i = 0; i<4; i++) + statebuffer[i] = cuda_swab32(((uint32_t*)buff)[i + 16]); + + *(uint4*)&statebuffer[ 4] = *(uint4*)&statebufferpre[ 4]; + + #pragma unroll 40 + for (int i = 0; i<40; i++) + statechainv[i] = statechainvpre[i]; + + statebuffer[4] = 0x80000000; + + qubit_rnd512_first(statebuffer, statechainv); + + uint32_t *outHash = outputHash + (thread<<4); + + rnd512_nullhash(statechainv); + *(uint2x4*)&outHash[ 0] = swapvec(*(uint2x4*)&statechainv[ 0] ^ *(uint2x4*)&statechainv[ 8] ^ *(uint2x4*)&statechainv[16] ^ *(uint2x4*)&statechainv[24] ^ *(uint2x4*)&statechainv[32]); + + rnd512_nullhash(statechainv); + *(uint2x4*)&outHash[ 8] = swapvec(*(uint2x4*)&statechainv[ 0] ^ *(uint2x4*)&statechainv[ 8] ^ *(uint2x4*)&statechainv[16] ^ *(uint2x4*)&statechainv[24] ^ *(uint2x4*)&statechainv[32]); + + + } +} + +__host__ +void qubit_luffa512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_outputHash){ + + const uint32_t threadsperblock = 256; + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + qubit_luffa512_gpu_hash_80 <<>> (threads, startNounce, d_outputHash); +} + +//#if __CUDA_ARCH__ == 500 +// #define __ldg(x) (*x) +//#endif + +__global__ +__launch_bounds__(384,2) +void x11_luffa512_gpu_hash_64(uint32_t threads, uint32_t *g_hash){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint32_t statebuffer[8]; + + if (thread < threads) + { + uint32_t statechainv[40] = { + 0x8bb0a761, 0xc2e4aa8b, 0x2d539bc9, 0x381408f8, 0x478f6633, 0x255a46ff, 0x581c37f7, 0x601c2e8e, + 0x266c5f9d, 0xc34715d8, 0x8900670e, 0x51a540be, 0xe4ce69fb, 0x5089f4d4, 0x3cc0a506, 0x609bcb02, + 0xa4e3cd82, 0xd24fd6ca, 0xc0f196dc, 0xcf41eafe, 0x0ff2e673, 0x303804f2, 0xa7b3cd48, 0x677addd4, + 0x66e66a8a, 0x2303208f, 0x486dafb4, 0xc0d37dc6, 0x634d15af, 0xe5af6747, 0x10af7e38, 0xee7e6428, + 0x01262e5d, 0xc92c2e64, 0x82fee966, 0xcea738d3, 0x867de2b0, 0xe0714818, 0xda6e831f, 0xa7062529 + }; + uint2x4* Hash = (uint2x4*)&g_hash[thread<<4]; + + uint32_t hash[16]; + + *(uint2x4*)&hash[0] = __ldg4(&Hash[0]); + *(uint2x4*)&hash[8] = __ldg4(&Hash[1]); + + #pragma unroll 8 + for(int i=0;i<8;i++){ + statebuffer[i] = cuda_swab32(hash[i]); + } + + rnd512_first(statechainv, statebuffer); + + #pragma unroll 8 + for(int i=0;i<8;i++){ + statebuffer[i] = cuda_swab32(hash[8+i]); + } + + rnd512(statebuffer, statechainv); + + statebuffer[0] = 0x80000000; + #pragma unroll 7 + for(uint32_t i=1;i<8;i++) + statebuffer[i] = 0; + + rnd512(statebuffer, statechainv); + + /*---- blank round with m=0 ----*/ + rnd512_nullhash(statechainv); + + #pragma unroll 8 + for(int i=0;i<8;i++) + hash[i] = cuda_swab32(statechainv[i] ^ statechainv[i+8] ^ statechainv[i+16] ^ statechainv[i+24] ^ statechainv[i+32]); + + rnd512_nullhash(statechainv); + + #pragma unroll 8 + for(int i=0;i<8;i++) + hash[8+i] = cuda_swab32(statechainv[i] ^ statechainv[i+8] ^ statechainv[i+16] ^ statechainv[i+24] ^ statechainv[i+32]); + + Hash[ 0] = *(uint2x4*)&hash[ 0]; + Hash[ 1] = *(uint2x4*)&hash[ 8]; + } +} + +__host__ void qubit_cpu_precalc() +{ + uint32_t tmp,i,j; + uint32_t statebuffer[8]; + uint32_t t[40]; + uint32_t statechainv[40] = + { + 0x6d251e69, 0x44b051e0, 0x4eaa6fb4, 0xdbf78465, 0x6e292011, 0x90152df4, 0xee058139, 0xdef610bb, + 0xc3b44b95, 0xd9d2f256, 0x70eee9a0, 0xde099fa3, 0x5d9b0557, 0x8fc944b3, 0xcf1ccf0e, 0x746cd581, + 0xf7efc89d, 0x5dba5781, 0x04016ce5, 0xad659c05, 0x0306194f, 0x666d1836, 0x24aa230a, 0x8b264ae7, + 0x858075d5, 0x36d79cce, 0xe571f7d7, 0x204b1f67, 0x35870c6a, 0x57e9e923, 0x14bcb808, 0x7cde72ce, + 0x6c68e9be, 0x5ec41e22, 0xc825b7c7, 0xaffb4363, 0xf5df3999, 0x0fc688f1, 0xb07224cc, 0x03e86cea + }; + + for (int i = 0; i<8; i++) + statebuffer[i] = cuda_swab32(*(((uint32_t*)PaddedMessage) + i)); + rnd512cpu(statebuffer, statechainv); + + for (int i = 0; i<8; i++) + statebuffer[i] = cuda_swab32(*(((uint32_t*)PaddedMessage) + i + 8)); + + rnd512cpu(statebuffer, statechainv); + + + for (int i = 0; i<8; i++) + { + t[i] = statechainv[i]; + for (int j = 1; j<5; j++) + { + t[i] ^= statechainv[i + 8 * j]; + } + } + + MULT2(t, 0); + + for (int j = 0; j<5; j++) { + for (int i = 0; i<8; i++) { + statechainv[i + 8 * j] ^= t[i]; + } + } + for (j = 0; j<5; j++) { + for (i = 0; i<8; i++) { + t[i + 8 * j] = statechainv[i + 8 * j]; + } + } + + for (j = 0; j<5; j++) { + MULT2(statechainv, j); + } + + for (j = 0; j<5; j++) { + for (i = 0; i<8; i++) { + statechainv[8 * j + i] ^= t[8 * ((j + 1) % 5) + i]; + } + } + + for (j = 0; j<5; j++) { + for (i = 0; i<8; i++) { + t[i + 8 * j] = statechainv[i + 8 * j]; + } + } + + for (j = 0; j<5; j++) { + MULT2(statechainv, j); + } + + for (j = 0; j<5; j++) { + for (i = 0; i<8; i++) { + statechainv[8 * j + i] ^= t[8 * ((j + 4) % 5) + i]; + } + } + cudaMemcpyToSymbol(statebufferpre, statebuffer, 8 * sizeof(uint32_t), 0, cudaMemcpyHostToDevice); + cudaMemcpyToSymbol(statechainvpre, statechainv, 40 * sizeof(uint32_t), 0, cudaMemcpyHostToDevice); +} + +__host__ +void qubit_luffa512_cpu_setBlock_80(void *pdata) +{ + memcpy(PaddedMessage, pdata, 80); + + CUDA_SAFE_CALL(cudaMemcpyToSymbol( c_PaddedMessage80, PaddedMessage, 10*sizeof(uint64_t), 0, cudaMemcpyHostToDevice)); + qubit_cpu_precalc(); +} + +__host__ +void x11_luffa512_cpu_hash_64(int thr_id, uint32_t threads,uint32_t *d_hash) +{ + const uint32_t threadsperblock = 384; + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x11_luffa512_gpu_hash_64<<>>(threads,d_hash); +} diff --git a/res/ccminer.ico b/res/ccminer.ico new file mode 100644 index 0000000000000000000000000000000000000000..3bd81bbcee5ac2721f5955d28bb1106dd744b7da GIT binary patch literal 99678 zcmeI52e?+%mG_SmOB{97NzqBZ#3U0lnaTL*q**2zjWbR%GqKZq2gQOC#TW~k7_p%= z5$XNHZS*2l6c9lL1VshC6cOp76tV2@|6A|b=brbyZ@U#l_Ves}%6rbnT z4T58W+d53o?gR&^|Xgd5P(Bq2Jf`_lXLRj?) zdevJYJP!tgo484Gt>T~N@*1>?wVT`)dJ<{6&l9p0r3%A!olrVi?&PU=3I z>RtjpuDB?8?5e&&-})PZLBeHti*lU7cU(K+>~s6XHTNo;$Ln2Rj+LphysXt`iY0(gkQl7oZv1;o)eioCJDYabfVpwR3`jja@K0v~%x&y?uKeBD~}Hb`svP zT&(k?e4Vb-<&@{*W!QOGM_eyF9T8pL59tW)@BlCHbTnm`z(ZGDrugdBU`SKhk>W4k zmPfJ;?Ysi!A=VMbX|OHPy^`zm%xT^?eF^m=(u))yk*W(`XW<2&;0+#+rep~`e8s;9 zz3Z*AIJ-c0Q;2^L?Fg9`lI4es$dY-4v+yun!8V3(sc^24JL_I$a+)$C{qgmoCo!L4 zZH#X(LS6Mb08j8nUjkm?`OBUjy5ifx6W7cRhRQa^tKBrrB_m=w!(1|qFchIeG}WlTMD#X;64#%&?quBY0%xAT}?d)e1D=9%jA^u&*mE~L`~;zsf8 z@#lz4h!K&|k(M65>f1I>Mt{g`UcADy#dNfl*nAxKEViBrgTv*1Tn9Lh^gukt{ekxd zNqQi;AS1>Uk=c=u9=WQ1@U;5CjGI=#J{5P`&na(1Ex=Ko5u!$Y#!Xby?dFY%52h2E;tf%DxaQzvjOi9QuF{BG7pVRk?rA}9=-ajngiQz z<6P$JMLT}Y+k1q&bRXVR<#8lpo{pzfzD*B&`F-*B(R zdC_=nI_$&tJuZWEGWs&yi_0LFFF>Zmg~%9LA5Q6!D^CpiH`;6KW^!R~<8iUEnlA&+ z*?5fW0J1?3GPMWDmbFR98krw1>B$B=6Lzmy4;s_@eEdE6DE1X%o48D}>VRZx^GMPG zWPUiLeht=U_W5C(R-vswLgTw^cAo3EiIPcN4-}Wmel+KnL0o3$6Nn4&rLn#N_J-^kF9wUcOpjk(KNz9)uSMSO z73cf$9Gi~~+xa*jM{&=Mdt63w*`WjGOKA&29q{9YU;q|iQWxp5tIiAtYo3ZYBp&Ob zn@QMw%ZwB-+rJ4j}7j%orOK7GMH4wVnDm+?-g)qI#n^U-bC)9y%ks z)rK9#yLvK+%hKxrvbK02j0uUqSX%@(wV8U=?-z_w-@~tsj$%F9Cv;SJ8@)ch>muHd z=4#1clH?b~%V7+StV<ARnuueqYtc|DOMd(tgrfsOK6|4`?#;4BJ7Xm znv+3Xw&r8e0mUURs|Wf|!} z*v?u!ARCPOh4^J*#5@6*)kJ#y+HV9yn+bR67V#eIuPxS>?)g}6^5KO2Et35aoYU$6 zen4$8*jP+1tiTNHs+;;XToAA)vQTBm<2{c(ZBx9RKUA`Z4qN*#IUK3SNy2&Zt>yBz zxInfC7D@4-umUr%t4?~N{x59}4?2}D-ZSiD_#aB_r`+nkIqPoscQfxiBJyC)`i1*p&loant@1~H$ zI3Jo0MV==7OWV1N7WO*Q;diB5RtbOYAB1NwcQ7C(pif|afOydN2ZS9Mf@NjXfW~WV z@15Uohi~zAZ!rkChjA7*c&PHUuHv`7yWmTJf6;p@g}=u7;Td^*`I|3@>45JOT0E#Y z04yt$de#4V!uG?MkMhj#)9*mv4ioH=!Iv5TR2{HbKp6RP0pfLhcftqcKPL2Kqj}MM zzV-FN-}m#6;(w?bnhN%xiob6MqOn2Y@7D`}X+Eh}y{`qsnA;6)KQ-nv+dtIyFaL+# zTb2(fZsUIO{1b-?mO869EB?d-U=zgw@mNq;f+^VMN_`tXWc##=q&xBP{b+pmP+?D- zr_5N>MDbIkxTa9CaFNEkidwmg7xi-=fBva^Ywvcq^206er9GSMxK`I&KHg)$)frH= zR8d;|bNT@F*}#&$cVL?<4QjS8`o=iKKsNi+__%*pfNA?1@H$!F?|;uOLRR!aqy(h?kg(m zTXXMs7cTDO+N>;aPrUP-o4;eN+y3!KwS-vB7F)DsWkTnXNviD81F!)j-wqJ3$74aT z&6fH!_*F1Q^T^R!9^coGwfR<0E#q(eiN{H_U&372UAp8+H)_*MZuh|hX@$D%gH3u? zeItAX{Ue_v`@la+9@3v+0`nO74g81JPf0&coOy@4a8Yk}+nUL4`qnk>gHQISt>;kQ z%#FYJHvDM^gqigR!*&2n!4`}&rT&e_S)b4P`>~iGeZmI4?IY7v{i~5{>|OXxkbf_1 z;l4iWF8A2m^WFZ>4(1g5;@umhx3c-^w|vDFFcE8#anKZCDmzI?1h z?uUau=~Q39NM>U3$T0YV9W&n5Z4d%z+Zcvz*pcWh%2nRW&2sRREiS=CsUy+U_kD|hU)+uTsK>6J}y ze6-aK+_1!TURCTKFMG}nQW-vNGk+AOlCj2=%`aIzkwzCH9no*53(_666=%%p z?*9DNEcZc%I5kuK`P|Qmf20G#3mx$IgQblL%KpI^tmCOqgHwVL@GSj^@Rv_C{G~^f z<#nq{c*ojSdtc?Lo&Uw6$K5BNeV&u`BH@0N@0+und>@## z{S9}C`WwMSwGH?Lbj;)mQx5tUtL{D+_Hrr@7kU|CZem>-}0b{QG4?-F2%=+*2DCyO(yq z>(umDI_>;qpKF00lp-Vf1p25(Pl$C|d3c&7H~3K8_%->kA>ym5DS^LYR(xLCIzxKE z%3?w3s~-=D;y~dK)?n__pk^x)zF#u+bG*L4k9`@xD%0CsRgTlZzLo30;f0*+H`mx+ zP^9r{`e}--j9-p3#UEor^2uk;yU#tK7;xkMT~^-ekKWh##x>Fh>5JL}iw!t3_D7t? z*g&a{)4I4{F7D-emo0R=KTSWDl!?HyeY@O$ywFc&$$!$1^t9!YhtV$jiFKv_-<)%g z#uO^ozlA2lzf^o!y^=+ydaaGcW|gry8{d#k`|&{9c`)~Bc#F>x?S6=V6!+;}!yntP z2L50#AKicBl1!qF?q9IDZvy)nq8&Z=8C_6Z_TvRT9PM*zTKvI=1okt#Nj_xB$Fjc; z?+O2e4hh4_*SU*deA3O`kzf4j>zwlbYIm~wf2LE&$7sxghsVk50lFhSIOqAt-0OR{ z`eJh)D~G@EisKKaHXf+DX#>EV)VI;;!D#%b?j`m6gqe@~OrNTXzuv>=zdbJ}f5^ke z-@Ls1(PHr~ZrG;GzSGA4#?}*W;stx>9gE+vePzaerpN}s%Hu$v#{5Gon^P#Pq)oP4 zH9k@H6v=dk^vlzm>*(#5@kY&8bbhTgr)+qjYWVv$Acj9!gE`ng+4%gRKy(lvMsxhM z{d&)j_4u~N+hSfvU;FTVw_s|Z-`K5rnrmMkqFAqg{C39kmo!FG@0F3_QTonYA^b%;C)t@Ev~mBlY>;#=|M=kl zmJJrY>i5yUSb6#A0MAHH;7Pp&ja*;FshLuh@CU;Pe_`wKPsD)Df&oqMw=sX>>G+tR zjgRYH-|l;#na}YV@uOJh_-F3O#7cDkFKQQpV#RvsPrPi!SnXC9N6)1@dE}jE#hdiG zpn*GgQRUWu5Ysm&rl*Zi91uLC`k|XVLpp(OOuflHy)k#Z>S^n@VUfzy_{wBqNjY(T z(w_5-vh@{Px$n<^z`d+>3z<^U`zwW?>_4BfX@jiY#)fGFq?bMh0BhC;g8jf|gKb=! zw%?EW5i@%Hkp*R?r9TBT{|x;F`Ph{oZOO!n-M2Yg>)(k!|1L-QxT}|s$olSoE`3@) zLwdvbujGBflB$jWyrKB(N6$TEzTf&e)Q>J`J~)9(OLy^-r`#u>f0mUV|Klq4L;hBJ zZ~c%sPZiFEJG9d$(GlIrl`4%t*ntID+E{?>-^K!kHFFtYKe)xrMBFETXls0=C-Jz? zVj1KS>T1rTco%+mX$&-1I+n3k#!itJ<(k|&36Jb!`R6buL`>)3k*~R6N%hwM-@9&> zWTL)eL=QBDbSZZH8_8k8uKdRG7-IOP))H7OYkiQg9FraAvL|9c`JGORjq)9mD0+XD z-V@(mUfHm)_Biwbv;klmjRg_wNe94wXv?L6_x-FHuztUuN{`%o_E zU1P1kG2M@N(Yxk%Zg%@V{WRnI7i+%8#^O9SR%i9`r@|$>HyX~S2flod*;MJNd=>3g zzNzD?67i`1IyMNM_-)1j)V2^`Y&!5kzD3z{Rl{Exdi-r1Kp4}`gE`m_ZMC|_@JC-{ zL+keK%*xj*dp0NRm*?X;toVDJ)>>pr_pF_rh!x`R)FA%UyI*U`zQ5qXgl@*`K_9?T zH2z-kYQCx8#>J9}`WwU;8n^nV=N@)TsyI(r^Y{z<;jPQ;TU}AxFaIC4{osS|r%l8^ zXUVf9AL(_+Jo>W#?^($gJK!D4C3^j=5{*Hdl~{!eCnH~z!kPd;(O-hC;4E93e9ygbxwHlowh zOPv~9K4tdZZs#ZY_YpHzl;;l#{1rE(${-ys-gg=P!qVCRVHCvx(gCm^(PmqX;IBBg zuY6subn@KpYUec$;duyUc}13f{xjR&lI@3aPb#mxUkUs>YyDO*`fAs0?etuv+VA*! zi#O8ND}9vCzZ1?u_X*apQ)tpAIG^T>> zW5cRLb2{s@$nb2lefcY|GjS{`f&Z2RA0~VV?VI!!`_3m_O3cZ;68)7lbqCYCxHWsT zkKN@{Pp)SwkH2I~KLB5zWd9-FV2=-=&tqdhRm5NZd`KQX^;?>|!B!(24ZF_nyewmc zD>Q}>Op?#D@tHL3PbKg_?*;YAn2Ys#B%ks_wd3p?$(4RWpOg7S|E|{qt6%dm#T z12u-fVIBE@#ed*09%vh)zQ5XJ8|7!LxEPWpkjKLbrN3=M-G)_A-YEEwR#~)^W|NIyFhi$NQF;xdb z*=NIl`@wyxNBv&wJEX|Y-j_Ut>(uRUW~Jl3gC8Z@$BgAjrfMrc$T3%ywUR79RvUjm z4*=G*_h3J~^-}Zy#Q%Qm2mXi~qkf-oqR)Z7#1`1zm_STZZW6Y9sf>Lzvl-!#Ixoc?p*s! zref^=T+Izy-!)xXM#~NE*x7&7p0d4J%c;tbhW{klf4aJpcoJ6TXYt*{0KyXf@a;AR zB&=!k!G2iFnTa)ml8@mZ#(y4vAN!@nU**rZ#g%T&?7!oD{#5O}wdHa8B`feFhMKi= zZT#^H=i@d0c^rIAWXxRlJWKV@{*(OGO~U`F3ePiUaN68^#h2prc%4bILI;HZOvOlw z2L^3gTA`fyjm~dOR(+zEchZ#uT^f(b7SG1ZtIT<&@wYx;h`*2j41ZzGToBj~X*t;T zKH(4I_}kc=-u3t+_X_+#kZSXG#lZRR=*JJ#`O-DViI8SzX zFps&?A1!=T&&zhB_rr4W3)rmIL$r}T?bCRCK56ww+ch_!{lBzx&_cUV0VnDR?}L~8 z{l6~i>2@64pS6mf(l48@L(eP7UF9*4E9|GHS(li#;7b0OAO6BA!k_k8G)ML?I>8vM zS?>e(1Dc*66w8nL`|0BUocPD&D!V&gzVXEmwAMOD`ftWp8P_wpf=j3aV1(|X>yqtF zuTOT{4rY(17HjU#=2#4OUyeVjJg*Pv2lFwiv)9IjIVg0B2WOdHCusEL`J>9E?a*At ztR3remQ~#cs*S(J|Dm0OIoLnd?DSx~ zq^mS0omj`Aaw6S~^C=%X0)O$P{&GePJWgQd+yD4FP~Xo7bDu`ES&@hh zX+jrVFT|6uLM&XsOtZU&55n@OF#53g2NSRU8Rbxy-y zfwAyb%zg1ogWQLo9CWW~J=aU}1TVr1T zA^ofCRJ3(fLa&XkbQqwkVMcz~QoQ}Qy+GoNI1tQz8r-69qWzal=>r=6@)>6TDg*!T z`$~D^@9C4w7)y}vJzrzAoAoWGY-xk`cK_GQgF;-<1Jw=YsXTM-v-)|z$T9w#txkS> zYwr$s-jd#-e-XWr-oZy$7i)W^Yu(jm9g37c{=y!)MfiLFPppFf*AdKp8rb}DTNlh2 zsf__hKWzSAZ6{?^3;$4l*f4WHYRB(bJ2R*FR_mJ%zkg*!*mkR}!X~{>FkKKPl*ze# zLAvpuoR#Q-_vOEvzB(@9cNo_(+{3cH-@)cJ&hWMQ_nB|Wr`+0jrds&>u|F_o4LF$l zG@$7zK_R|WGNy09v%U@R_#=DoTPp1X(1B17OqQM8NptUUqc-Q>6Z^p@AG-(MndiQ% zbyLbbxCh;STm_o<=4i; z+3`>D{oekQ`hH>i4%T2EPb1r{x3~}dtq&;qCXE4k{K3)73OlK6zFY4oD{f{!==&P$ znYyjwe!g__V|`Fxjl=v-{l>qWcfaUU8Tgci_lB^HttwA%Uz>&#y`})FpFR48-P2$10QB`M3x~f+zWC4 zf#{i$=XXg`>8h>k?D&IyD*nO_{K3+EJMF*Z4c4h?VDk%u5_}yx0RGYwzI((zcaJ}P z3*Yyv5gkBhkiCwf9-KDs&+6CB*BbEr#{ImkUsc@CJb>-X_WeJzarra+1nmwqgSp4u zABl5AfADWh`nc&i=7D{kb$!f?zsFuj>;HxJ4|ZS(mi`-FU<}sj(%254o32bG4wTGn z9zbQ-9yNRb_=h@BWB7Z&5!xZPNxx3V-^$NV-nJ$$F)z}ZYFnG3b!ZXB9_#oKeZ!a0 z{)GPE1pVIr^$B^+Ipjr5Ej^SQe_;bg=KHaI@W=MWE12R3z&KMH-g;a#N8r~1+B~qz zO6mhh&&-yvC*fC@y73#4|PK}zvAA@uxH|x58spCXj~UNkFxk@ zuMK?%D~mQ?<;fqMsXbrqUN6;N-*;*Wt(q^^@MpXO`9v}gu>cRVP07v2eqcu&Z+pMw z`-$tpI8z$b{8zR%$odM>m#7aQIo1{a5ns|P&nNRa%&QZpt9?H0*+09>v@Z8g`u<0u z#zfvwd^Tmr8wnbT-K=f@lRHl9KEAHK20xKcziQ`JoUu0qO_H8G}(Ed|ne=r0~a0J_2X=tm540r1TNM~q2qBcOj zCAIyp6Z}(kE2a;u?@|B%{ACr_|I{uTbzgdB{J}nszuG|a{ld&S2R@g7L4~Fys!8G4AxW&(dQpF190~9xM zv^YTc`?+BJO*94sJ-W8O7j07=X7m5I%Kisd-@p#@63Xpg@}?i_9Lrk4zWkizKr;@55?o}*Cv1o z*i08je#{5#zz{4en+CW1O)w$UAFoG@Cs-UHJxkJoLy!MO+Fx>{r-_;;v9%HCJ^075 z$1j`hhrZuq28Li+l{C8jn>L1IbHb^8K|c;C9}w>Y*!T^0Sx0%E;{Tal-LJI%<48~A zS^vTM80-IqzBlsyvVFhS1Ah%>*ee)TH4SO`%V0v-cl7!c^#xTQeL>$3IFveI<3wTn zVRO^ab);qZQ%2rNv7h)%8t)6+ePRHx1HAAr6qwNzwuNBw_&b z0UYbd2UtDW!;yx$=Lb2H!CrE;xKHQEK54v1*!!_w<^aI1x@kzuZv;h(A1RMHBaYWIZ^Sb-VX)kGTB<{^tCnLjce zkZ-ZIf%pLFp!opoPqfAR0A`nUh5eCQPiRlprw02Ff3tnb-sbv<`Gkqh+Y2LNelV-a zG`8ahhPBndl9m#ncn!#?cq6Z3%$_ra>B)6iBL6H*L7ojw+f z_Xp9(XiVs+AE>?_WWgR;r|a*54H$t{ZKR=X`bBFBtR0ZA@jBpRfulN51F=pH?2&b9 zoA2W?FsjWorv2t%ru2_>WcVEV8H_o_#|3>mVDSLFgt1E$4;*PRT21jo3=@-=ALohM z{Lt_FaXw^keqUIC3E0$j8q(&>pipa2W{Q?cYHw_vDE$HXo@j0$i~~~fM-QwYP*d_c z(#i?##M?_8f5!T(&Byj7Yy2*<2LrGG6R@d^G^};~V6toA+-gxTj+4!zTk_j2f1*U-Fw{4?!)%pkMGzzF3Ax2 zfjzQC#)oqn+WMGaOvg8EJPNuQCo~*`m~pC4 zNRe&i6VQo6i*5o5%(kAuD8t?2d#qyv?^2w{9?=(R+M?%^k-32l8`q9WXzTP6twDpT_pn>Vdu& zGrux9jV`72GckI+-KSy?FG<*^_?(8a-w%(z{7C;oJ&e;7*}CYBd_DFaw|Vgj&+v{6kOeY9HeZ%Bs{KR3M74Jo z1Ir$eM{1i8#fS04HUJD4ncu=r3ukr*hh2T4AGwjrhqale54 z{oFzvADeSl92UnfuXEn<@mu`pvG#a-JI{bQ^wXy^+==gW4X^MF@5tcGo<_9&cg2UR zf@#P`a%7yy`-5ogNWb|QA)Q|^{~)=Vf8ZF$3EhZen8$hQ`@URs&if*cNp_xM>o$HD zwr}uc?Vb35S9m^}k|i*r-DMi%d^MOVdqJ+q%;E#tjn@M|hUCW*O&270k3$?AuM>t@ zTsLx@`{z@!j^l0fvf!-@E#A(d4_fhK&~CVk7kGj9>#Rg2d(yw%7O=Y zfv2OXauOKP?u=kmhaN%kO?!eV_v*b9Y@pJ!s(mN^#tbMtLH}%NIc^4gm7Gf7@gGOjQnrcr1Bidi2 zwNHJ6@i%NR|2hp!WBOqD2_K8Oy^V%;imhU|WRI!8HlLF6y!Ay?7G);ktvd1T&;Tva zbTrky1ctXeEg0GU3SrPkV<;=k1{p^q-kOeWhQ6Gm$I#onw{w5Z(VmIFqcSLqGO=&! zpf2j9?xX4Olfdw{r>osPU*jsxgw_4Q*z1M{1)XOGg*Pk-if?{hxhyETd9#k&EGN#( z>^Gj_S>EAY%AhRDJOWeVn<)o^;H>!9Q(!c9t)G(~n9ucBq6fkc3g7E**yFJm%6L2o zPVm2Xx69y|@H+Y)aah2oiJybu;=}{H{q?Dd>oR{G7TDcihXwk}kcFuDAg~Ie;=>A} z;)B2{C@X*8Dwtn>Z7g>$zqSffugiZn0%Fx00kP_hfKXV8x6X1dMvf7bdR-PTUj)vN zUyH!h>+bR2MR5EQ0#mM&$Q8k<*Gc4yfz<0HcBBKT*GcS%!Ccp6$@HC&>w13j^Iyqz z-97pFW2$?dT-?#CnwCIy@kxDuelmeM^`$KN`4e(o=hE-g-&5@+^*YtwQm<3(HT62x z-YZ;pk25HLF+YBt#=n%sf0sW>Vn_}(^*V_m`MV?rE_N=7U>tV5d|kTkSvUoKJZu6#`JJ^fX>G;yfY zzYkq`O7Q4azX_hWrd!aj{-|I;!v(>>CToJhO*aNZn{BnsIrsRDXLy!(c=wB#9=Y<| zp!cjb}^&qDoguR_nS&Wo~TJ;$@W*Vdi-@+Qmb$a*6)G zL5coH1-Udw_RsMS?~=WqP&Rc?7j+)$^!PO$jg~_Fe~uDiR!k20jri35^$9-fTh$YD zWd47(f4)@j`Enw8s1E9)PUHX$b)6o$^2}gBlNCk-v>4VQ#?Wl^!w0(>X|36%p*~`Rq zBD4u;gGOkr$uywR0`u$Go7Z*oW3uhK;XB5X5uJ# zs7mT}ZR22EyF@wII{NOhJzRKBrNh$)tMj5Kw6LWs z-tuaEkfzqpH}2mh9)vgl^BFyW7mF3e8$4!8W7N0w?YrqbHY*;gl*2U}g{@ridn;<4 z=XeGDKk1-Eym)=}GJrRDOqcpM?iyilHjl5X3jgApwFTA&sr?;(xts9*>Nt6|e!gz+ z_7wg@e^{;q6~|CUwc1{ey`D$sS?8En)*L$DkDnraD^?$*sFgcLI`fM~Pq-UiEpm6h zIo-8hKE^d&G1hfhRqXD0Yo;5j|L6R|?hS6&!M!yu597a7?LPk>n6)7Af*->U&;fXj zr@jr&vHmo_gT2Q+U*7pYjN+O9;nDb&QSP~2?k)*4;>!jtYVYiGG-`oGuJO%eb0od)z#a)2jzgGc(V@a)sTrhTlfBW6HO z{yo2rChbvcXILv$N}sT!yJ>Za+n?rtJAeN9XYTsdrS5{~9&?wzIMDraQ6Klcd4Cl) z;k)CTYfMXWC{m14EEyKdJ|*}6esO>sx#=ah|FcgjEsk}2cO?8Dc4)MRGJrRDq+N$+ zpGLNRFN$xy-lNYMvuH=Rid(vWezu3(uy1z~jr&CN1M6nHv-Mk0*j)a9RnqVNV*UPI zZt%tz-K9$hNbcBNnDj36=OC>c;;B`G54+^T0X0nGT45cqa92 zaB?tSbxi_$)$6hM@1;9Vl^hFOxb~}xJS)+$+nT8=OFZazvx$+HyOKQo-+|9Qb&tF~ z&z-_rOUc!I343Ot86A@>zN&WpPb&YT&kjcQr8~*Yzc7PGc!g(p@89@Ri}US&W2-J( z7bfhfyFyl6F-^}%Pak}Hep1z&4}R#rHTOQzDZWc2d-dwjOy_xY59j2c=I+uOb+iuTZ|$`jr<;diTE*HR-Nr7_jr2uz@7x} z{BQb_Hm>!`aq*wsiVrut-WwOWH6LwtyFWSL%4GAS_5ZFfUiy@H6Gr3I4yfGop6{9V z|CCSPz9vC8@f=|MKyvyl{(-F|IkeA6UC$GYPfuq!{_?6PUTWo z1zz9{9<2{6eTVlk?Or#ZfGlY%z@5GOQD*I+e$)RM|LD_?eHC`R2K}5Mx+ioLo=+$J z)@bF}gdY=c1zWPmzx_5W7QKqi@%_^GA3y(y>Z<7DI!O1>v0#FpmF@he>fEqDx$S|7 z1pmS$l^3qz5nl0w@LtgV-H3nl7istxO?{-p@$|w68w~S=&-g?9CpTcz67!LUlm3Tu zF8+C$xX0`oTSpc%y1M21-|wmEVfo!Nwdd>k-DRmiMb}yRheyvpypQX!&GZ4gFx?mS z=ogv)%_EOBj z)0~}a?LKYPvD$YNPdBWYl+X+Nzeef#U$u9O{8m%5tC#m|j=%2SmOcklrJMM8Vl3%- z>9*IBp2>BQKmX#rpyRuy544TmUf2Uh9HRE+9~bqkP~AW2ULsDr(KTP490Rpbea-HgXfUzaEuwnf{-j*|-0nUh=EK_{MJeN6C6{3D02zd@psX>`Zbx@Oin9j|xn4 zV*F2)FZDL;b?f6jbZ#D8e_wkJ^MvhhEyd!|Ayza^%j%>o~_H60Y= z#nZNfAGtrNpL?;|w};D~ciq>`awoIz9J{pd=Cb}={K?ln_3n%DSKWi}Je%+>(2a~0 z%MIPUEa{nS7YY6)GcdPruc$7{LLSxz!oTbb-bc0@WwsXSzvrKKl+hvifZx45v_h4Q zUmch51H@J0<0S3V9{ldo3eR1&VzhisqlDby2Rx-4-+J}|_p;)nc>0TCOMIr)i?0^% zgWpZIkNETH&NK3F`}@?s!7Kg+-iNim!*l`vPkiKUCX!ny2Vs1=zC*J7!!1cw_Mz=Y zPwDgM|J9=l$7_!<`hcG#HO5}B1>y){^6xM9cjMBG2{z?9cn2r+Q@U5WwQ|0X`qJ`m z_OEh%3`qI#KBVQPiS|!2!T*`fh-cGL*`6Km(mreDY0%W!-S*Zrs)^EO^tyMkP11!2?OCgTaz}TnzT2>7-}d-pd7m5q z(-hyDj|q7IPt*Spf7(BIAK3h48zaX4J^tSRCCMNx2Ooki=$k{6ww3!eh+C<6<=U0f z^;wehB*kCE#p4^g30sq&^Ng&JF8%Mz@*~6%YHKX(z2>XN`$wvDtjIq)j4uiChgZhM z;hj`?-Fw#FFrGsjLEDG_^Lyiyj(6+6@(h(Bn?L7;UT)5gbrtAbu=5>vuiAmj^#8jD z$S1t9cbj`f{1&RMxZ#bd?*BdaaKaBDC-|4F&RN{cE!*>Mg|aGpBf)>zc0jxNa`6Oj z@JJs3o_!kGu8*||*8hQj{AMQpRi4QMIfOPL+P@=y`fPZ??M)N6UqxSFd{fgKe5v(a z={L}Skw3ibBJkfWANAQPdpN6zN$9#bCj}OqZ=)V2$ckyWd12)6a{wJt@ zLmz0{6u+MLVn28Hx;bvnu61sY`n*jPBU!woGEaW?&+eaJ=G^g0cgmK9ztInl%J5|UAMu~C{qpfo>SJvlsSCUeyO`gD zr)=1JnT%}TF4C1G9gzMT?!pwku1q%GLw{16y!(2*-g1nvm;S?BKB?%2*A0JsCEt{w z9Pb0FDuYbl9IK2Rb3TiY0-F$jXom-M8J_Y@LtB46m?ZnLcZr9D9d;DSppy9Kq`QX7 zGye?lq7|Bnci;hD;HffcWc$Wu2lSWOKW;juvZ=%K6aU8Cp*;8WKpX89wA$Wx(T?AT zm#U-t49w0>b|2i^wo?}w6atJ~`ix*zfmtzLKGp*m^&4KplupuET*#`NHj${^%D zjyp6Otte*4jv8ukV}qjs`waa)|m# zF?%pyB>HMp4xaBc`VI}yf}iFaAJABvX>^CC_T3;qmK@oG*M+csF#eH4XcPHM-_TV13P?amBJZ&{J}cA9L#bb%Pb+XT89VpV0|5W}3Z z$ewR&+r=+-j{Knon(8`@>C`dtjZ@LUd^zz3^gy4*qS!@f8<9L>axotk<1=c<;TNp+ zE`FA>D3h|S4%LO;+qXtV!=X+EoqO1~(hLvefDe`|pb@&gUU->AeQGZs&u7SM9B0a) zEGsj_obNeN=i!zLuJ0O5xOHpJ+i)+GR~J@s^FsTf@B3?(rMX@GS4}ZY?K`v4o!xI1ql>r!4%UPj`Jd zK)>2o4ekv;R&ZAM6@*j6j~VDw2J<0M-zd=I_5uf$7=8@l-tZ#{7prvAS^gM)t-*gM z=F~F#IXJ-|=LeSjcRRk)J#p>7;}RVcw-4RlOmxjpkQC8hmbgB_A5;1Fa`8tmH!sI< z(5_t0^C?hrw*rNO6)0S+0O90u0~q@Pg&x#n_JDp?GTeWxQqEIurR={G(fw>))JA&f z%9De~uDM$KPpvZgY?+|N_JwL)mC>m=H}=M{H!5w`Z|w2)Jn=63YDc%ye!>PLgC3Wk zQC;$~zTfBC`>ZZxZ2NIUx9#K7oC@pr$*kYZmi=?K=Rth3H<+?06HNNldn79jRr&Fe zE50NB)%WI92kUF2ebUe@dRcp4mCU=WTW4REl}XvEV`#JYgGaCYr>c-z;ho2>zA6|k zxtN|HFJ-H@8g!@f>dW(dP#0MAyt-KhdMb0HSG~@`IL)Ub^OBgXS<_q_8NT3!x~Ox! z)@<~y_ovE`96bx|=2KLTmpSFv2Ho*8JrC3g4~6noeJaUAuWSD=u}7FPBnwYBYfI}Q z!;kS1+6Hp$U9U+b+iWL2ul`0bmbJ8^eWGZ$HQ;qbcdBgQ1APJuzTxorH9yQoy8Sk^ zd70tH-bU7Pun#|UwpiiQScA|fy^zFmr*B)nk2*JzmkIh?-qFwx6viM2&UrYMCOSG@2 zCi4Hh__X`xER7kk$C$kx(8j*^C+b!Fw&~MN)Gw30o80v*>j3k~tQlediPpK*M!Ifw zv0@Ch1<2BDTD%NuI<|ryjTK+!XGA;CvTiS9);uQj5&7PpeFc8-G#sN*bMf8toxyts* z;lDD{9`eK9CGBl&v!cLl{rICKx{P1j@26+RHq;*3-)k?%<-(_#_J{w${ipaFx^b!7 zti3h)rigyz25shJg~7)_c}HR?)ts>Te5YdI+Ww>}xUQ2HDvuD`GaXkj& zfw*8u^Zvo`mSc<`lRb2c$9UGBz%H@lHZy4fO~dl`Mx>cx$DiDDo1{VHIg<~rn<2$?JIg};}T!2_Er}pp0lx1 zFwk?*iVlrzGdmd7c9E^i#gE$=*$rma;T*U+(_!>5ksqnrE7 z==iDo+_ha*C|=R~rmk7a9=OHe2nOs)WKEp*iv3XQeHX-dZMstQv*#6hJP+suZPS?c zE9Fbe>^y0YmYxmwX6=uyyZkl#X+_I9@{c~?yup&PXyh{W1ilO1cC#BZGbwR?BC**o6yuiGBNgs!&~&VO*L_il}T%XZRq)i|p& z+9v>w=n(o+*lBA8`k`Ixyid?reLVeWVNcm{GuJ?P`t)nBlnv2O4@o+*2l{4tlU#^ADA!OA2ZUA%%Oi=$9Ieu{0%zB+HkEseq{Y~z6fV} z&$><7TSKkc^@;t<7W=S2T{`U3qk1=(B%Ni?R#8)}i=Xa)a?`Y@)pVV8-Qt5inc0%9 z{kOd#q6^tVBeW*y-zfcGSb=`o)VH7CaPtGxKSJe#wLNY0!oInU{e6F&$=Vujrk24*gz#Y%QDS=D=S* zw3+sA__ST}`sw06(tFvm_UOXT54C^xM(uCyDqqw|dpUb;Smd_FVxzVDcDa98(8GKJ z>%=eB9;kd%)76ENh1v+#8=~7rzi7p0jBL|admS#bHKD{g{05KFT0Gv7&S@R{SM`2; zzvi5s>)fxFJ(a+NJ$u^Ekeaq=uT#6%O7*_l>f+|Avx|F7d)OD zG28^jq;dW6@{i9ef`#^HAnPex*Cdg^p3x^H^9Rco$mh;?tzRo~-&^>o8>hE0tsjxD8STj5=Wq^`Jv8!9 zU)5SG^naE1*!yJrjmBJKF#x{)$BQ0!_rEhww*Ikyq|(Q7`b7uwCq{t&qU$$B@&E8P zt!@1@K7)B#5;W+jWWP=OjsopkL3Y(w=lJ9y~9svyiWzmBVG5#6tf@GW1H`lj*RU%B#Cx^F;Tir+r~UM{335# zQy9uR+qrz(PqlyUXUhh-e^Xml6ZwLd2f5SOe}-RVE*{z@;dfdk?AFumkE1(uPR#L# z7?{35`@MN&J!gFk;ft@Ti9Az!ZuTfyLOZ%Krek+cZrWqf4XYD$&=%l_JO=sjpfxLg zT~f7=)F+uhgU$Vm_L7_4O-pn9=CC#=+qz!s%XmHV82B|cwS5%rem&Mq=$C(BZOX7V zXU0j*cs{b-uM_@MJbV01_f>AS<(dN{(^bg}`$Ol^N&NjN{r{`Vq|qIkm@V+W=K+~i zdEM82Bhu*IMGi%v~zw99P0ozj!@oKh(23G?T=s;KEt#4<*?mOl%?|UG2^bk zBW>L^b#r*TuV@|8gI1TV)k3EvH*6f6gC^t|#jW8v_l#aWW6#1rIrNR=JNMH6*DD_r zuPJ)7l{5DGwpw?!G>I25@p%SqK0YvZ51Qe7iuAkWmgQPkTs7a4jjqc6HbR(;?sQo& z?uI|=|Im&UPtOMvx~!8PZ?kn|6S}+|l-|5JD7tBsp1DhF$bP4FvB~jcW$O%|*TN&M zBGQr}Elj$Y<8JQJB$g!wfnL*#<;OCvPY8nf z9KVusJSOq~YqT&a=+5st)>Y~rR%FLm{qwo6YdebGGOqnme5CT{`Sx<~a`AGCMP}Z;i?vs!^>$JY7e2H?jPU|#XR5cB6by6^_MRR>4y-zT-`68_o+N|{-dn|L# zJ$~bv5qh?!(x}!y&|0rS!I(A&Y)z5>Uof`bNOKMT=eQP` zD`iop%078~=k#(I-S)U(WUJNXb*nFJbAmN+^z*yWpgO)b{-)z9h+#ylp0+*%T5Zlz zecp6y943PWm{cKCw$|>PFsfb8r1}dw{2=c+Z@w&kl7A(Gk%>Z3)hB=`&MZ z&p{h^qh98a;+cC|!|+>uck(fPOO9`jo~w5MLe2Ly);DMG(OmijjiK}1ifn1;!M#?F z@rFK7=Q!0pwtWlZ-On*IU*)sL7cW)4Yd(D6efs(5Zv1=8-2-n-cSANTasA2`x;r#~ zc)sTKZGDT@HeRG}%ssYlUeXw`r)ekrv;Gm@s0$xa(4mFqDf=XN*M0hPK5HKH&TxKm z-j22IJBn|u^G_Q2<^G}`e&s-vPP#1bY-G!Yt8zzi_*f`5= z?zc;xG_qe+d0)|-M`z7dl5W)){I&W%mrwgNhtO4H!pzrne6>IredazBPVM=Ai{y8j z%Im4QTd=eG`F@wxp}Np3>MptdL&L=S7~S0Q8iU*v&d*$^xv_to_h+kaw7!YN{8>HC zRrmybq(Wq*vCN-qY!`x}KV>e&*B}Govo*r0(L*+W#Vb zu=}^WKfamxR@7@6zdl{E`iaJW*Juv>9qCwOeN(K(^5HfQe!7kMcXK~dKkq}$&+={L z(->ctj7F#VrkK@l-*})uLaeSjsk`tx&2z)Q?op<6qk-o8`Ti8&sr{kk|2HbLlXQUZ zkK25iz9IT|>c@1^9L65i4Xxj&zbw7${mz0^*6q5ye)!D8S zF1fKqLjT~OF@RVfO=FE0=^IOh`W_3q{ffT5_(<7v?s|Qn?Xnm8xDzB7aJWmD<@SH_ zKl=8c)nWXLmeQMAD4!%-JZR$(Hb0>HZHzs3lpdTc{;$yd)?JzlyZ5bU+@qQ=TCnRK zvn|hKw&PCu4x78A4#qsFbHdGuIJNZVLFN;{AO3B8mNA6Xe2=TI^;17(97j+BMZQ`vt%$oLlKD)TGTx@C{QJyDbYaJI(EU$eG~u{+ZT zFNa+9Q@5Vw9UJ#kTSr+_Zp+TMuiGCdbv-_qc>&B*1Br1d+7Icmjb}+V{>VKW4^q86%R5u`ZcU{rx5-c5 z);uV_xsT+cn5pY#VYDhQ1*WpCnTVU^`_AyhhDOb-PUwD0a8DrW$ zZT;G$ex+i<)OY>0=sLcjAI=^VLpg=C*7>~yXo8iZ@5nSj_er4 z!%dctR6l5e`{}~RT(RQa4vNuk)|x|~x@nEA#Z|mpdedsgm%lOZetl2>Wp|yvnR&Io zL3+2I8MN^Q*H7`pue7F-|ApjJH|D4rljhxtH$P?P_;R)37pjl&kocuv+d=e>5FekU z{C|aRTDxQKOzQHK+W2#Ao;9iMyvNl)ML#`Gi9FFAI~9}@aJ>6WL>-^ANS z&eLZ6@15?1DYqr`2PK+%+lk5xtWCg2XKK&*jdo+&Z3|ABc~`mqQpU8~PgFbhwD~}z zL%!ITV{MM;!58w(v~J1o^1e^gZa-JFNGETTUUl1RnRD(<>sG;jcWVrIzQ#?v%M+1v LCI1}n@b3Qyy?SC8 literal 0 HcmV?d00001 diff --git a/res/ccminer.rc b/res/ccminer.rc new file mode 100644 index 0000000..c034481 --- /dev/null +++ b/res/ccminer.rc @@ -0,0 +1,105 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Anglais (États-Unis) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "ccminer.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x21L +#else + FILEFLAGS 0x20L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "FileVersion", "1.0" + VALUE "LegalCopyright", "Copyright (C) 2016" + VALUE "ProductName", "ccminer" + VALUE "ProductVersion", "1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // Anglais (États-Unis) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/res/resource.h b/res/resource.h new file mode 100644 index 0000000000000000000000000000000000000000..1b0177d10d13979edf08cbd6a3625a39eb9cf77b GIT binary patch literal 916 zcmb7?;YtEg5QWe0pm$jCXP_Cqz~&lAx<%_s{#t5l%P0-Etsr_}U!wZvUP%*^WVq|x zxie?Z%<=29p@!bESf|PqsjV|k?7Ublb+{$^z;?AmZbN~NHBzoSzBih3?`X{ZL6xqF z1iICX$c(ocHy`V{nyDr#Ifb5i84xR}x}-Ls*B(}1>XVW+;?1%Q>4{A1mt&7a$F6^! zSpHLGENiZ3G0!l55hvrcm@-xqjBTu`eQFGOv4fc2Z*B^kuYg$vQ=96=%~KIAxfM)n zoQ>-%zY|^Q9zQ3yT*C9bN923FKp{#b>MM2ZO`Q(h2TX8+CXuVHF=GMt-!I09U)j8OMon86aL8mh2{kER3qONN2tta#x=Y*F!M~ABlO7h*E!v11 v=n!Nxug0p*>v(&``>?ioH?a;t-45Gt(zMu&Yx`OJhia&AikWhL`@iqsk literal 0 HcmV?d00001 diff --git a/serialize.hpp b/serialize.hpp new file mode 100644 index 0000000..24bba7e --- /dev/null +++ b/serialize.hpp @@ -0,0 +1,861 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2014 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_SERIALIZE_H +#define BITCOIN_SERIALIZE_H + +//#include "compat/endian.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class CScript; + +static const unsigned int MAX_SIZE = 0x02000000; + +/** + * Used to bypass the rule against non-const reference to temporary + * where it makes sense with wrappers such as CFlatData or CTxDB + */ +template +inline T& REF(const T& val) +{ + return const_cast(val); +} + +/** + * Used to acquire a non-const pointer "this" to generate bodies + * of const serialization operations from a template + */ +template +inline T* NCONST_PTR(const T* val) +{ + return const_cast(val); +} + +/** + * Get begin pointer of vector (non-const version). + * @note These functions avoid the undefined case of indexing into an empty + * vector, as well as that of indexing after the end of the vector. + */ +template +inline T* begin_ptr(std::vector& v) +{ + return v.empty() ? NULL : &v[0]; +} +/** Get begin pointer of vector (const version) */ +template +inline const T* begin_ptr(const std::vector& v) +{ + return v.empty() ? NULL : &v[0]; +} +/** Get end pointer of vector (non-const version) */ +template +inline T* end_ptr(std::vector& v) +{ + return v.empty() ? NULL : (&v[0] + v.size()); +} +/** Get end pointer of vector (const version) */ +template +inline const T* end_ptr(const std::vector& v) +{ + return v.empty() ? NULL : (&v[0] + v.size()); +} + +/* + * Lowest-level serialization and conversion. + * @note Sizes of these types are verified in the tests + */ +template inline void ser_writedata8(Stream &s, uint8_t obj) +{ + s.write((char*)&obj, 1); +} +template inline void ser_writedata16(Stream &s, uint16_t obj) +{ + obj = htole16(obj); + s.write((char*)&obj, 2); +} +template inline void ser_writedata32(Stream &s, uint32_t obj) +{ + obj = htole32(obj); + s.write((char*)&obj, 4); +} +template inline void ser_writedata64(Stream &s, uint64_t obj) +{ + obj = htole64(obj); + s.write((char*)&obj, 8); +} +template inline uint8_t ser_readdata8(Stream &s) +{ + uint8_t obj; + s.read((char*)&obj, 1); + return obj; +} +template inline uint16_t ser_readdata16(Stream &s) +{ + uint16_t obj; + s.read((char*)&obj, 2); + return le16toh(obj); +} +template inline uint32_t ser_readdata32(Stream &s) +{ + uint32_t obj; + s.read((char*)&obj, 4); + return le32toh(obj); +} +template inline uint64_t ser_readdata64(Stream &s) +{ + uint64_t obj; + s.read((char*)&obj, 8); + return le64toh(obj); +} +inline uint64_t ser_double_to_uint64(double x) +{ + union { double x; uint64_t y; } tmp; + tmp.x = x; + return tmp.y; +} +inline uint32_t ser_float_to_uint32(float x) +{ + union { float x; uint32_t y; } tmp; + tmp.x = x; + return tmp.y; +} +inline double ser_uint64_to_double(uint64_t y) +{ + union { double x; uint64_t y; } tmp; + tmp.y = y; + return tmp.x; +} +inline float ser_uint32_to_float(uint32_t y) +{ + union { float x; uint32_t y; } tmp; + tmp.y = y; + return tmp.x; +} + + +///////////////////////////////////////////////////////////////// +// +// Templates for serializing to anything that looks like a stream, +// i.e. anything that supports .read(char*, size_t) and .write(char*, size_t) +// + +enum +{ + // primary actions + SER_NETWORK = (1 << 0), + SER_DISK = (1 << 1), + SER_GETHASH = (1 << 2), +}; + +#define READWRITE(obj) (::SerReadWrite(s, (obj), nType, nVersion, ser_action)) + +/** + * Implement three methods for serializable objects. These are actually wrappers over + * "SerializationOp" template, which implements the body of each class' serialization + * code. Adding "ADD_SERIALIZE_METHODS" in the body of the class causes these wrappers to be + * added as members. + */ +#define ADD_SERIALIZE_METHODS \ + size_t GetSerializeSize(int nType, int nVersion) const { \ + CSizeComputer s(nType, nVersion); \ + NCONST_PTR(this)->SerializationOp(s, CSerActionSerialize(), nType, nVersion);\ + return s.size(); \ + } \ + template \ + void Serialize(Stream& s, int nType, int nVersion) const { \ + NCONST_PTR(this)->SerializationOp(s, CSerActionSerialize(), nType, nVersion);\ + } \ + template \ + void Unserialize(Stream& s, int nType, int nVersion) { \ + SerializationOp(s, CSerActionUnserialize(), nType, nVersion); \ + } + +/* + * Basic Types + */ +inline unsigned int GetSerializeSize(char a, int, int=0) { return 1; } +inline unsigned int GetSerializeSize(int8_t a, int, int=0) { return 1; } +inline unsigned int GetSerializeSize(uint8_t a, int, int=0) { return 1; } +inline unsigned int GetSerializeSize(int16_t a, int, int=0) { return 2; } +inline unsigned int GetSerializeSize(uint16_t a, int, int=0) { return 2; } +inline unsigned int GetSerializeSize(int32_t a, int, int=0) { return 4; } +inline unsigned int GetSerializeSize(uint32_t a, int, int=0) { return 4; } +inline unsigned int GetSerializeSize(int64_t a, int, int=0) { return 8; } +inline unsigned int GetSerializeSize(uint64_t a, int, int=0) { return 8; } +inline unsigned int GetSerializeSize(float a, int, int=0) { return 4; } +inline unsigned int GetSerializeSize(double a, int, int=0) { return 8; } + +template inline void Serialize(Stream& s, char a, int, int=0) { ser_writedata8(s, a); } // TODO Get rid of bare char +template inline void Serialize(Stream& s, int8_t a, int, int=0) { ser_writedata8(s, a); } +template inline void Serialize(Stream& s, uint8_t a, int, int=0) { ser_writedata8(s, a); } +template inline void Serialize(Stream& s, int16_t a, int, int=0) { ser_writedata16(s, a); } +template inline void Serialize(Stream& s, uint16_t a, int, int=0) { ser_writedata16(s, a); } +template inline void Serialize(Stream& s, int32_t a, int, int=0) { ser_writedata32(s, a); } +template inline void Serialize(Stream& s, uint32_t a, int, int=0) { ser_writedata32(s, a); } +template inline void Serialize(Stream& s, int64_t a, int, int=0) { ser_writedata64(s, a); } +template inline void Serialize(Stream& s, uint64_t a, int, int=0) { ser_writedata64(s, a); } +template inline void Serialize(Stream& s, float a, int, int=0) { ser_writedata32(s, ser_float_to_uint32(a)); } +template inline void Serialize(Stream& s, double a, int, int=0) { ser_writedata64(s, ser_double_to_uint64(a)); } + +template inline void Unserialize(Stream& s, char& a, int, int=0) { a = ser_readdata8(s); } // TODO Get rid of bare char +template inline void Unserialize(Stream& s, int8_t& a, int, int=0) { a = ser_readdata8(s); } +template inline void Unserialize(Stream& s, uint8_t& a, int, int=0) { a = ser_readdata8(s); } +template inline void Unserialize(Stream& s, int16_t& a, int, int=0) { a = ser_readdata16(s); } +template inline void Unserialize(Stream& s, uint16_t& a, int, int=0) { a = ser_readdata16(s); } +template inline void Unserialize(Stream& s, int32_t& a, int, int=0) { a = ser_readdata32(s); } +template inline void Unserialize(Stream& s, uint32_t& a, int, int=0) { a = ser_readdata32(s); } +template inline void Unserialize(Stream& s, int64_t& a, int, int=0) { a = ser_readdata64(s); } +template inline void Unserialize(Stream& s, uint64_t& a, int, int=0) { a = ser_readdata64(s); } +template inline void Unserialize(Stream& s, float& a, int, int=0) { a = ser_uint32_to_float(ser_readdata32(s)); } +template inline void Unserialize(Stream& s, double& a, int, int=0) { a = ser_uint64_to_double(ser_readdata64(s)); } + +inline unsigned int GetSerializeSize(bool a, int, int=0) { return sizeof(char); } +template inline void Serialize(Stream& s, bool a, int, int=0) { char f=a; ser_writedata8(s, f); } +template inline void Unserialize(Stream& s, bool& a, int, int=0) { char f=ser_readdata8(s); a=f; } + + + + + + +/** + * Compact Size + * size < 253 -- 1 byte + * size <= USHRT_MAX -- 3 bytes (253 + 2 bytes) + * size <= UINT_MAX -- 5 bytes (254 + 4 bytes) + * size > UINT_MAX -- 9 bytes (255 + 8 bytes) + */ +inline unsigned int GetSizeOfCompactSize(uint64_t nSize) +{ + if (nSize < 253) return sizeof(unsigned char); + else if (nSize <= std::numeric_limits::max()) return sizeof(unsigned char) + sizeof(unsigned short); + else if (nSize <= std::numeric_limits::max()) return sizeof(unsigned char) + sizeof(unsigned int); + else return sizeof(unsigned char) + sizeof(uint64_t); +} + +template +void WriteCompactSize(Stream& os, uint64_t nSize) +{ + if (nSize < 253) + { + ser_writedata8(os, nSize); + } + else if (nSize <= std::numeric_limits::max()) + { + ser_writedata8(os, 253); + ser_writedata16(os, nSize); + } + else if (nSize <= std::numeric_limits::max()) + { + ser_writedata8(os, 254); + ser_writedata32(os, nSize); + } + else + { + ser_writedata8(os, 255); + ser_writedata64(os, nSize); + } + return; +} + +template +uint64_t ReadCompactSize(Stream& is) +{ + uint8_t chSize = ser_readdata8(is); + uint64_t nSizeRet = 0; + if (chSize < 253) + { + nSizeRet = chSize; + } + else if (chSize == 253) + { + nSizeRet = ser_readdata16(is); + if (nSizeRet < 253) + throw std::ios_base::failure("non-canonical ReadCompactSize()"); + } + else if (chSize == 254) + { + nSizeRet = ser_readdata32(is); + if (nSizeRet < 0x10000u) + throw std::ios_base::failure("non-canonical ReadCompactSize()"); + } + else + { + nSizeRet = ser_readdata64(is); + if (nSizeRet < 0x100000000ULL) + throw std::ios_base::failure("non-canonical ReadCompactSize()"); + } + if (nSizeRet > (uint64_t)MAX_SIZE) + throw std::ios_base::failure("ReadCompactSize(): size too large"); + return nSizeRet; +} + +/** + * Variable-length integers: bytes are a MSB base-128 encoding of the number. + * The high bit in each byte signifies whether another digit follows. To make + * sure the encoding is one-to-one, one is subtracted from all but the last digit. + * Thus, the byte sequence a[] with length len, where all but the last byte + * has bit 128 set, encodes the number: + * + * (a[len-1] & 0x7F) + sum(i=1..len-1, 128^i*((a[len-i-1] & 0x7F)+1)) + * + * Properties: + * * Very small (0-127: 1 byte, 128-16511: 2 bytes, 16512-2113663: 3 bytes) + * * Every integer has exactly one encoding + * * Encoding does not depend on size of original integer type + * * No redundancy: every (infinite) byte sequence corresponds to a list + * of encoded integers. + * + * 0: [0x00] 256: [0x81 0x00] + * 1: [0x01] 16383: [0xFE 0x7F] + * 127: [0x7F] 16384: [0xFF 0x00] + * 128: [0x80 0x00] 16511: [0x80 0xFF 0x7F] + * 255: [0x80 0x7F] 65535: [0x82 0xFD 0x7F] + * 2^32: [0x8E 0xFE 0xFE 0xFF 0x00] + */ + +template +inline unsigned int GetSizeOfVarInt(I n) +{ + int nRet = 0; + while(true) { + nRet++; + if (n <= 0x7F) + break; + n = (n >> 7) - 1; + } + return nRet; +} + +template +void WriteVarInt(Stream& os, I n) +{ + unsigned char tmp[(sizeof(n)*8+6)/7]; + int len=0; + while(true) { + tmp[len] = (n & 0x7F) | (len ? 0x80 : 0x00); + if (n <= 0x7F) + break; + n = (n >> 7) - 1; + len++; + } + do { + ser_writedata8(os, tmp[len]); + } while(len--); +} + +template +I ReadVarInt(Stream& is) +{ + I n = 0; + while(true) { + unsigned char chData = ser_readdata8(is); + n = (n << 7) | (chData & 0x7F); + if (chData & 0x80) + n++; + else + return n; + } +} + +#define FLATDATA(obj) REF(CFlatData((char*)&(obj), (char*)&(obj) + sizeof(obj))) +#define VARINT(obj) REF(WrapVarInt(REF(obj))) +#define LIMITED_STRING(obj,n) REF(LimitedString< n >(REF(obj))) + +/** + * Wrapper for serializing arrays and POD. + */ +class CFlatData +{ +protected: + char* pbegin; + char* pend; +public: + CFlatData(void* pbeginIn, void* pendIn) : pbegin((char*)pbeginIn), pend((char*)pendIn) { } + template + explicit CFlatData(std::vector &v) + { + pbegin = (char*)begin_ptr(v); + pend = (char*)end_ptr(v); + } + char* begin() { return pbegin; } + const char* begin() const { return pbegin; } + char* end() { return pend; } + const char* end() const { return pend; } + + unsigned int GetSerializeSize(int, int=0) const + { + return (unsigned int) (pend - pbegin); + } + + template + void Serialize(Stream& s, int, int=0) const + { + s.write(pbegin, pend - pbegin); + } + + template + void Unserialize(Stream& s, int, int=0) + { + s.read(pbegin, pend - pbegin); + } +}; + +template +class CVarInt +{ +protected: + I &n; +public: + CVarInt(I& nIn) : n(nIn) { } + + unsigned int GetSerializeSize(int, int) const { + return GetSizeOfVarInt(n); + } + + template + void Serialize(Stream &s, int, int) const { + WriteVarInt(s, n); + } + + template + void Unserialize(Stream& s, int, int) { + n = ReadVarInt(s); + } +}; + +template +class LimitedString +{ +protected: + std::string& string; +public: + LimitedString(std::string& string) : string(string) {} + + template + void Unserialize(Stream& s, int, int=0) + { + size_t size = ReadCompactSize(s); + if (size > Limit) { + throw std::ios_base::failure("String length limit exceeded"); + } + string.resize(size); + if (size != 0) + s.read((char*)&string[0], size); + } + + template + void Serialize(Stream& s, int, int=0) const + { + WriteCompactSize(s, string.size()); + if (!string.empty()) + s.write((char*)&string[0], string.size()); + } + + unsigned int GetSerializeSize(int, int=0) const + { + return GetSizeOfCompactSize(string.size()) + string.size(); + } +}; + +template +CVarInt WrapVarInt(I& n) { return CVarInt(n); } + +/** + * Forward declarations + */ + +/** + * string + */ +template unsigned int GetSerializeSize(const std::basic_string& str, int, int=0); +template void Serialize(Stream& os, const std::basic_string& str, int, int=0); +template void Unserialize(Stream& is, std::basic_string& str, int, int=0); + +/** + * vector + * vectors of unsigned char are a special case and are intended to be serialized as a single opaque blob. + */ +template unsigned int GetSerializeSize_impl(const std::vector& v, int nType, int nVersion, const unsigned char&); +template unsigned int GetSerializeSize_impl(const std::vector& v, int nType, int nVersion, const V&); +template inline unsigned int GetSerializeSize(const std::vector& v, int nType, int nVersion); +template void Serialize_impl(Stream& os, const std::vector& v, int nType, int nVersion, const unsigned char&); +template void Serialize_impl(Stream& os, const std::vector& v, int nType, int nVersion, const V&); +template inline void Serialize(Stream& os, const std::vector& v, int nType, int nVersion); +template void Unserialize_impl(Stream& is, std::vector& v, int nType, int nVersion, const unsigned char&); +template void Unserialize_impl(Stream& is, std::vector& v, int nType, int nVersion, const V&); +template inline void Unserialize(Stream& is, std::vector& v, int nType, int nVersion); + +/** + * others derived from vector + */ +extern inline unsigned int GetSerializeSize(const CScript& v, int nType, int nVersion); +template void Serialize(Stream& os, const CScript& v, int nType, int nVersion); +template void Unserialize(Stream& is, CScript& v, int nType, int nVersion); + +/** + * pair + */ +template unsigned int GetSerializeSize(const std::pair& item, int nType, int nVersion); +template void Serialize(Stream& os, const std::pair& item, int nType, int nVersion); +template void Unserialize(Stream& is, std::pair& item, int nType, int nVersion); + +/** + * map + */ +template unsigned int GetSerializeSize(const std::map& m, int nType, int nVersion); +template void Serialize(Stream& os, const std::map& m, int nType, int nVersion); +template void Unserialize(Stream& is, std::map& m, int nType, int nVersion); + +/** + * set + */ +template unsigned int GetSerializeSize(const std::set& m, int nType, int nVersion); +template void Serialize(Stream& os, const std::set& m, int nType, int nVersion); +template void Unserialize(Stream& is, std::set& m, int nType, int nVersion); + + + + + +/** + * If none of the specialized versions above matched, default to calling member function. + * "int nType" is changed to "long nType" to keep from getting an ambiguous overload error. + * The compiler will only cast int to long if none of the other templates matched. + * Thanks to Boost serialization for this idea. + */ +template +inline unsigned int GetSerializeSize(const T& a, long nType, int nVersion) +{ + return a.GetSerializeSize((int)nType, nVersion); +} + +template +inline void Serialize(Stream& os, const T& a, long nType, int nVersion) +{ + a.Serialize(os, (int)nType, nVersion); +} + +template +inline void Unserialize(Stream& is, T& a, long nType, int nVersion) +{ + a.Unserialize(is, (int)nType, nVersion); +} + + + + + +/** + * string + */ +template +unsigned int GetSerializeSize(const std::basic_string& str, int, int) +{ + return GetSizeOfCompactSize(str.size()) + str.size() * sizeof(str[0]); +} + +template +void Serialize(Stream& os, const std::basic_string& str, int, int) +{ + WriteCompactSize(os, str.size()); + if (!str.empty()) + os.write((char*)&str[0], str.size() * sizeof(str[0])); +} + +template +void Unserialize(Stream& is, std::basic_string& str, int, int) +{ + unsigned int nSize = ReadCompactSize(is); + str.resize(nSize); + if (nSize != 0) + is.read((char*)&str[0], nSize * sizeof(str[0])); +} + + + +/** + * vector + */ +template +unsigned int GetSerializeSize_impl(const std::vector& v, int nType, int nVersion, const unsigned char&) +{ + size_t sz = v.size() + v.size() * sizeof(T); + return (GetSizeOfCompactSize((uint64_t)sz)); +} + +template +unsigned int GetSerializeSize_impl(const std::vector& v, int nType, int nVersion, const V&) +{ + unsigned int nSize = GetSizeOfCompactSize(v.size()); + for (typename std::vector::const_iterator vi = v.begin(); vi != v.end(); ++vi) + nSize += GetSerializeSize((*vi), nType, nVersion); + return nSize; +} + +template +inline unsigned int GetSerializeSize(const std::vector& v, int nType, int nVersion) +{ + return GetSerializeSize_impl(v, nType, nVersion, T()); +} + + +template +void Serialize_impl(Stream& os, const std::vector& v, int nType, int nVersion, const unsigned char&) +{ + WriteCompactSize(os, v.size()); + if (!v.empty()) + os.write((char*)&v[0], v.size() * sizeof(T)); +} + +template +void Serialize_impl(Stream& os, const std::vector& v, int nType, int nVersion, const V&) +{ + WriteCompactSize(os, v.size()); + for (typename std::vector::const_iterator vi = v.begin(); vi != v.end(); ++vi) + ::Serialize(os, (*vi), nType, nVersion); +} + +template +inline void Serialize(Stream& os, const std::vector& v, int nType, int nVersion) +{ + Serialize_impl(os, v, nType, nVersion, T()); +} + + +template +void Unserialize_impl(Stream& is, std::vector& v, int nType, int nVersion, const unsigned char&) +{ + // Limit size per read so bogus size value won't cause out of memory + v.clear(); + unsigned int nSize = ReadCompactSize(is); + unsigned int i = 0; + while (i < nSize) + { + unsigned int blk = std::min(nSize - i, (unsigned int)(1 + 4999999 / sizeof(T))); + v.resize(i + blk); + is.read((char*)&v[i], blk * sizeof(T)); + i += blk; + } +} + +template +void Unserialize_impl(Stream& is, std::vector& v, int nType, int nVersion, const V&) +{ + v.clear(); + unsigned int nSize = ReadCompactSize(is); + unsigned int i = 0; + unsigned int nMid = 0; + while (nMid < nSize) + { + nMid += 5000000 / sizeof(T); + if (nMid > nSize) + nMid = nSize; + v.resize(nMid); + for (; i < nMid; i++) + Unserialize(is, v[i], nType, nVersion); + } +} + +template +inline void Unserialize(Stream& is, std::vector& v, int nType, int nVersion) +{ + Unserialize_impl(is, v, nType, nVersion, T()); +} + + + +/** + * others derived from vector + */ +inline unsigned int GetSerializeSize(const CScript& v, int nType, int nVersion) +{ + return GetSerializeSize((const std::vector&)v, nType, nVersion); +} + +template +void Serialize(Stream& os, const CScript& v, int nType, int nVersion) +{ + Serialize(os, (const std::vector&)v, nType, nVersion); +} + +template +void Unserialize(Stream& is, CScript& v, int nType, int nVersion) +{ + Unserialize(is, (std::vector&)v, nType, nVersion); +} + + + +/** + * pair + */ +template +unsigned int GetSerializeSize(const std::pair& item, int nType, int nVersion) +{ + return GetSerializeSize(item.first, nType, nVersion) + GetSerializeSize(item.second, nType, nVersion); +} + +template +void Serialize(Stream& os, const std::pair& item, int nType, int nVersion) +{ + Serialize(os, item.first, nType, nVersion); + Serialize(os, item.second, nType, nVersion); +} + +template +void Unserialize(Stream& is, std::pair& item, int nType, int nVersion) +{ + Unserialize(is, item.first, nType, nVersion); + Unserialize(is, item.second, nType, nVersion); +} + + + +/** + * map + */ +template +unsigned int GetSerializeSize(const std::map& m, int nType, int nVersion) +{ + unsigned int nSize = GetSizeOfCompactSize(m.size()); + for (typename std::map::const_iterator mi = m.begin(); mi != m.end(); ++mi) + nSize += GetSerializeSize((*mi), nType, nVersion); + return nSize; +} + +template +void Serialize(Stream& os, const std::map& m, int nType, int nVersion) +{ + WriteCompactSize(os, m.size()); + for (typename std::map::const_iterator mi = m.begin(); mi != m.end(); ++mi) + Serialize(os, (*mi), nType, nVersion); +} + +template +void Unserialize(Stream& is, std::map& m, int nType, int nVersion) +{ + m.clear(); + unsigned int nSize = ReadCompactSize(is); + typename std::map::iterator mi = m.begin(); + for (unsigned int i = 0; i < nSize; i++) + { + std::pair item; + Unserialize(is, item, nType, nVersion); + mi = m.insert(mi, item); + } +} + + + +/** + * set + */ +template +unsigned int GetSerializeSize(const std::set& m, int nType, int nVersion) +{ + unsigned int nSize = GetSizeOfCompactSize(m.size()); + for (typename std::set::const_iterator it = m.begin(); it != m.end(); ++it) + nSize += GetSerializeSize((*it), nType, nVersion); + return nSize; +} + +template +void Serialize(Stream& os, const std::set& m, int nType, int nVersion) +{ + WriteCompactSize(os, m.size()); + for (typename std::set::const_iterator it = m.begin(); it != m.end(); ++it) + Serialize(os, (*it), nType, nVersion); +} + +template +void Unserialize(Stream& is, std::set& m, int nType, int nVersion) +{ + m.clear(); + unsigned int nSize = ReadCompactSize(is); + typename std::set::iterator it = m.begin(); + for (unsigned int i = 0; i < nSize; i++) + { + K key; + Unserialize(is, key, nType, nVersion); + it = m.insert(it, key); + } +} + + + +/** + * Support for ADD_SERIALIZE_METHODS and READWRITE macro + */ +struct CSerActionSerialize +{ + bool ForRead() const { return false; } +}; +struct CSerActionUnserialize +{ + bool ForRead() const { return true; } +}; + +template +inline void SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionSerialize ser_action) +{ + ::Serialize(s, obj, nType, nVersion); +} + +template +inline void SerReadWrite(Stream& s, T& obj, int nType, int nVersion, CSerActionUnserialize ser_action) +{ + ::Unserialize(s, obj, nType, nVersion); +} + + + + + + + + + +class CSizeComputer +{ +protected: + size_t nSize; + +public: + int nType; + int nVersion; + + CSizeComputer(int nTypeIn, int nVersionIn) : nSize(0), nType(nTypeIn), nVersion(nVersionIn) {} + + CSizeComputer& write(const char *psz, size_t nSize) + { + this->nSize += nSize; + return *this; + } + + template + CSizeComputer& operator<<(const T& obj) + { + ::Serialize(*this, obj, nType, nVersion); + return (*this); + } + + size_t size() const { + return nSize; + } +}; + +#endif // BITCOIN_SERIALIZE_H diff --git a/sia.cu b/sia.cu new file mode 100644 index 0000000..0b88474 --- /dev/null +++ b/sia.cu @@ -0,0 +1,493 @@ +/** + * Blake2-B CUDA Implementation + * + * tpruvot@github July 2016 + * + */ + +#include + +#include +#include + +#include + +#include +#include + +#define TPB 512 +#define NBN 2 + +static uint32_t *d_resNonces[MAX_GPUS]; +static uint32_t *h_resNonces[MAX_GPUS]; + +static __constant__ uint2 _ALIGN(16) c_data[10]; +static __constant__ uint2 _ALIGN(16) c_v[16]; + +static __constant__ const uint32_t blake2b_sigma[12][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 } , + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } +}; + +extern "C" void blake2b_hash(void *output, const void *input) +{ + uint8_t _ALIGN(64) hash[32]; + blake2b_ctx ctx; + + blake2b_init(&ctx, 32, NULL, 0); + blake2b_update(&ctx, input, 80); + blake2b_final(&ctx, hash); + + memcpy(output, hash, 32); +} + +// ---------------------------------------------------------------- + +__device__ __forceinline__ +static void G(const int r, const int i, uint2 &a, uint2 &b, uint2 &c, uint2 &d,const uint2 m[16]) +{ + a = a + b + m[ blake2b_sigma[r][2*i] ]; + d = SWAPUINT2( d ^ a ); + c = c + d; + b = ROR24( b ^ c ); + a = a + b + m[ blake2b_sigma[r][2*i+1] ]; + d = ROR16( d ^ a ); + c = c + d; + b = ROR2( b ^ c, 63); +} + +#define ROUND(r) \ + G(r, 0, v[0], v[4], v[ 8], v[12], m); \ + G(r, 1, v[1], v[5], v[ 9], v[13], m); \ + G(r, 2, v[2], v[6], v[10], v[14], m); \ + G(r, 3, v[3], v[7], v[11], v[15], m); \ + G(r, 4, v[0], v[5], v[10], v[15], m); \ + G(r, 5, v[1], v[6], v[11], v[12], m); \ + G(r, 6, v[2], v[7], v[ 8], v[13], m); \ + G(r, 7, v[3], v[4], v[ 9], v[14], m); + +__global__ __launch_bounds__(512,1) +void blake2b_gpu_hash(const uint32_t threads, const uint32_t startNonce, uint32_t *resNonce, const uint32_t target6) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if(threaddata; + uint32_t *ptarget = work->target; + + const uint32_t Htarg = ptarget[7]; + const uint32_t first_nonce = pdata[8]; + + int intensity = (device_sm[dev_id] > 500)?29:28; + + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage (linux) + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + //cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,dev_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + CUDA_CALL_OR_RET_X(cudaMalloc(&d_resNonces[thr_id], NBN * sizeof(uint32_t)), -1); + CUDA_CALL_OR_RET_X(cudaMallocHost(&h_resNonces[thr_id], NBN * sizeof(uint32_t)), -1); + + init[thr_id] = true; + } + const dim3 grid((throughput + TPB-1)/TPB); + const dim3 block(TPB); + + memcpy(endiandata, pdata, 80); + endiandata[11] = 0; // nbits + + blake2b_setBlock(endiandata); + + cudaMemset(d_resNonces[thr_id], 0xff, NBN*sizeof(uint32_t)); + + do { + blake2b_gpu_hash <<>> (throughput, pdata[8], d_resNonces[thr_id], ptarget[6]); + + cudaMemcpy(h_resNonces[thr_id], d_resNonces[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonces[thr_id][0] != UINT32_MAX){ + int res = 0; + endiandata[8] = h_resNonces[thr_id][0]; + blake2b_hash(hash, endiandata); + // sia hash target is reversed (start of hash) + swab256(vhashcpu, hash); + if (vhashcpu[7] <= Htarg && fulltest(vhashcpu, ptarget)) { + work_set_target_ratio(work, vhashcpu); + *hashes_done = pdata[8] - first_nonce + throughput +1; + work->nonces[0] = h_resNonces[thr_id][0]; + pdata[8] = h_resNonces[thr_id][0]; + res=1; + if (h_resNonces[thr_id][1] != UINT32_MAX) { + endiandata[8] = h_resNonces[thr_id][1]; + blake2b_hash(hash, endiandata); +// if(!opt_quiet) +// gpulog(LOG_BLUE, dev_id, "Found 2nd nonce: %08x", h_resNonces[thr_id][1]); + swab256(vhashcpu, hash); + work->nonces[1] = h_resNonces[thr_id][1]; + pdata[21] = h_resNonces[thr_id][1]; + if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio[0]) { + work_set_target_ratio(work, vhashcpu); + xchg(work->nonces[0], work->nonces[1]); + xchg(pdata[8], pdata[21]); + } + res=2; + } + return res; + } + } + + pdata[8] += throughput; + + }while(!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[8])); + + *hashes_done = pdata[8] - first_nonce +1; + + return 0; +} + +// cleanup +extern "C" void free_sia(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + cudaFree(d_resNonces[thr_id]); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} + +// ---- SIA LONGPOLL -------------------------------------------------------------------------------- + +struct data_buffer { + void *buf; + size_t len; +}; + +extern void calc_network_diff(struct work *work); + + +size_t sia_data_cb(const void *ptr, size_t size, size_t nmemb, void *user_data){ + struct data_buffer *db = (struct data_buffer *)user_data; + size_t len = size * nmemb; + size_t oldlen, newlen; + void *newmem; + static const uchar zero = 0; + + oldlen = db->len; + newlen = oldlen + len; + + newmem = realloc(db->buf, newlen + 1); + if (!newmem) + return 0; + + db->buf = newmem; + db->len = newlen; + memcpy((char*)db->buf + oldlen, ptr, len); + memcpy((char*)db->buf + newlen, &zero, 1); /* null terminate */ + + return len; +} + +char* sia_getheader(CURL *curl, struct pool_infos *pool) +{ + char curl_err_str[CURL_ERROR_SIZE] = { 0 }; + struct data_buffer all_data = { 0 }; + struct curl_slist *headers = NULL; + char data[256] = { 0 }; + char url[512]; + + // nanopool + snprintf(url, 512, "%s/miner/header?address=%s&worker=%s", //&longpoll + pool->url, pool->user, pool->pass); + + if (opt_protocol) + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_POST, 0); + curl_easy_setopt(curl, CURLOPT_ENCODING, ""); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 0); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, opt_timeout); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, sia_data_cb); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); + + headers = curl_slist_append(headers, "Accept: application/octet-stream"); + headers = curl_slist_append(headers, "Expect:"); // disable Expect hdr + headers = curl_slist_append(headers, "User-Agent: Sia-Agent"); // required for now +// headers = curl_slist_append(headers, "User-Agent: " USER_AGENT); +// headers = curl_slist_append(headers, "X-Mining-Extensions: longpoll"); + + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + + int rc = curl_easy_perform(curl); + if (rc && strlen(curl_err_str)) { + applog(LOG_WARNING, "%s", curl_err_str); + } + + if (all_data.len >= 112) + cbin2hex(data, (const char*) all_data.buf, 112); + if (opt_protocol || all_data.len != 112) + applog(LOG_DEBUG, "received %d bytes: %s", (int) all_data.len, data); + + curl_slist_free_all(headers); + + return rc == 0 && all_data.len ? strdup(data) : NULL; +} + +bool sia_work_decode(const char *hexdata, struct work *work) +{ + uint8_t target[32]; + if (!work) return false; + + hex2bin((uchar*)target, &hexdata[0], 32); + swab256(work->target, target); + work->targetdiff = target_to_diff(work->target); + + hex2bin((uchar*)work->data, &hexdata[64], 80); + // high 16 bits of the 64 bits nonce + work->data[9] = rand() << 16; + + // use work ntime as job id + cbin2hex(work->job_id, (const char*)&work->data[10], 4); + calc_network_diff(work); + + if (stratum_diff != work->targetdiff) { + stratum_diff = work->targetdiff; + applog(LOG_WARNING, "Pool diff set to %g", stratum_diff); + } + + return true; +} + +extern int share_result(int result, int pooln, double sharediff, const char *reason); + +bool sia_submit(CURL *curl, struct pool_infos *pool, struct work *work){ + + char curl_err_str[CURL_ERROR_SIZE] = { 0 }; + struct data_buffer all_data = { 0 }; + struct curl_slist *headers = NULL; + char buf[256] = { 0 }; + char url[512]; + + if (opt_protocol) + applog_hex(work->data, 80); + //applog_hex(&work->data[8], 16); + //applog_hex(&work->data[10], 4); + + // nanopool + snprintf(url, 512, "%s/miner/header?address=%s&worker=%s", + pool->url, pool->user, pool->pass); + + if (opt_protocol) + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_ENCODING, ""); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 0); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10); + + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, sia_data_cb); + + memcpy(buf, work->data, 80); + curl_easy_setopt(curl, CURLOPT_POST, 1); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 80); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, (void*) buf); + +// headers = curl_slist_append(headers, "Content-Type: application/octet-stream"); +// headers = curl_slist_append(headers, "Content-Length: 80"); + headers = curl_slist_append(headers, "Accept:"); // disable Accept hdr + headers = curl_slist_append(headers, "Expect:"); // disable Expect hdr + headers = curl_slist_append(headers, "User-Agent: Sia-Agent"); +// headers = curl_slist_append(headers, "User-Agent: " USER_AGENT); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + + int res = curl_easy_perform(curl) == 0; + long errcode; + CURLcode c = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &errcode); + if (errcode != 204) { + if (strlen(curl_err_str)) + applog(LOG_ERR, "submit err %ld %s", errcode, curl_err_str); + res = 0; + } + share_result(res, work->pooln, work->sharediff[0], res ? NULL : (char*) all_data.buf); + + curl_slist_free_all(headers); + return true; +} diff --git a/skein/skein.cu b/skein/skein.cu new file mode 100644 index 0000000..fe53edb --- /dev/null +++ b/skein/skein.cu @@ -0,0 +1,612 @@ +/** + * SKEIN512 80 + SHA256 64 + * by tpruvot@github - 2015 + * Merged skein512 80 + sha256 64 (in a single kernel) for SM 5+ + * based on sp and klaus work, adapted by tpruvot to keep skein2 compat + * + * Inherited optimum TPB 1024 from sp and klaus work for 2nd generation maxwell + * SP 1.5.80 on ASUS Strix 970: 272.0MH/s - 1290MHz / intensity 28 + * SP 1.5.80 on GB windforce 750ti OC: 90.9MH/s - 1320MHz / intensity 23 + * + * Further improved under CUDA 7.5 + * ASUS Strix 970: 293.5MH/s - 1290MHz / intensity 28 + * GB windforce 750ti OC: 114.1MH/s - 1320MHz / intensity 23 + * + * Both tests carried out, on 970, with --plimit=180W + * -------------------------------------------- + * + * Provos Alexis - 2016 + */ + +#include "sph/sph_skein.h" + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" +#include "skein_header.h" +#include + +/* try 1024 for 970+ */ +#define TPB52 1024 +#define TPB50 768 + +#define maxResults 16 +/* 16 adapters max */ +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +extern "C" void skeincoinhash(void *output, const void *input){ + sph_skein512_context ctx_skein; + SHA256_CTX sha256; + + uint32_t hash[16]; + + sph_skein512_init(&ctx_skein); + sph_skein512(&ctx_skein, input, 80); + sph_skein512_close(&ctx_skein, hash); + + SHA256_Init(&sha256); + SHA256_Update(&sha256, (unsigned char *)hash, 64); + SHA256_Final((unsigned char *)hash, &sha256); + + memcpy(output, hash, 32); +} + +__constant__ uint2 c_message16[2]; + +__constant__ uint2 _ALIGN(16) c_buffer[56]; +__constant__ const uint2 c_t[ 5] = {{8,0},{0,0xFF000000},{8,0xFF000000},{0x50,0},{0,0xB0000000}}; +__constant__ const uint2 c_add[18] = {{1,0},{2,0},{3,0},{4,0},{5,0},{6,0},{7,0},{8,0},{9,0},{10,0},{11,0},{12,0},{13,0},{14,0},{15,0},{16,0},{17,0},{18,0}}; +// precomputed tables for SHA256 + +__constant__ const uint32_t sha256_hashTable[8] = { + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +}; +__constant__ uint32_t _ALIGN(16) sha256_endingTable[64] = { + 0xc28a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf374, + 0x649b69c1, 0xf0fe4786, 0x0fe1edc6, 0x240cf254, 0x4fe9346f, 0x6cc984be, 0x61b9411e, 0x16f988fa, + 0xf2c65152, 0xa88e5a6d, 0xb019fc65, 0xb9d99ec7, 0x9a1231c3, 0xe70eeaa0, 0xfdb1232b, 0xc7353eb0, + 0x3069bad5, 0xcb976d5f, 0x5a0f118f, 0xdc1eeefd, 0x0a35b689, 0xde0b7a04, 0x58f4ca9d, 0xe15d5b16, + 0x007f3e86, 0x37088980, 0xa507ea32, 0x6fab9537, 0x17406110, 0x0d8cd6f1, 0xcdaa3b6d, 0xc0bbbe37, + 0x83613bda, 0xdb48a363, 0x0b02e931, 0x6fd15ca7, 0x521afaca, 0x31338431, 0x6ed41a95, 0x6d437890, + 0xc39c91f2, 0x9eccabbd, 0xb5c9a0e6, 0x532fb63c, 0xd2c741c6, 0x07237ea3, 0xa4954b68, 0x4c191d76 +}; + +__constant__ uint32_t _ALIGN(16) sha256_constantTable[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +/* Elementary defines for SHA256 */ +#define xor3b(a,b,c) ((a ^ b) ^ c) + +#define R(x, n) ((x) >> (n)) +//#define Maj(x, y, z) ((x & (y | z)) | (y & z)) //((b) & (c)) | (((b) | (c)) & (a)); //andor32(a,b,c); +__device__ __forceinline__ +uint32_t Maj(const uint32_t a,const uint32_t b,const uint32_t c){ //Sha256 - Maj - andor + uint32_t result; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0xE8;" : "=r"(result) : "r"(a), "r"(b),"r"(c)); // 0xE8 = ((0xF0 & (0xCC | 0xAA)) | (0xCC & 0xAA)) + #else + result = ((a & (b | c)) | (b & c)); + #endif + return result; +} + +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +__device__ __forceinline__ uint32_t bsg2_0(const uint32_t x) +{ + return xor3b(ROTR32(x,2),ROTR32(x,13),ROTR32(x,22)); +} +__device__ __forceinline__ uint32_t bsg2_1(const uint32_t x) +{ + return xor3b(ROTR32(x,6),ROTR32(x,11),ROTR32(x,25)); +} +__device__ __forceinline__ uint32_t ssg2_0(const uint32_t x) +{ + return xor3b(ROTR32(x,7),ROTR32(x,18),(x>>3)); +} +__device__ __forceinline__ uint32_t ssg2_1(const uint32_t x) +{ + return xor3b(ROTR32(x,17),ROTR32(x,19),(x>>10)); +} + +#if __CUDA_ARCH__ <= 500 +__global__ __launch_bounds__(TPB50) +#else +__global__ __launch_bounds__(TPB52, 1) +#endif +void skeincoin_gpu_hash(uint32_t threads, uint32_t startNonce, uint32_t* resNonce, uint32_t target7) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads) + { + uint32_t nonce = startNonce + thread; + uint2 nonce2 = make_uint2(c_message16[1].x, cuda_swab32(nonce)); + + uint2 h[ 9]; + uint2 p[8]; + + *(uint2x4*)&h[ 0] = *(uint2x4*)&c_buffer[ 0]; + *(uint2x4*)&h[ 4] = *(uint2x4*)&c_buffer[ 4]; + h[ 8] = c_buffer[ 8]; + + int i = 9; + + p[ 1] = nonce2+h[ 1]; + + p[ 0] = c_buffer[i++]+p[ 1]; + p[ 1] = ROL2(p[ 1],46) ^ p[ 0]; + p[ 2] = c_buffer[i++] + p[ 1]; + p[ 3] = c_buffer[i++]; + p[ 4] = c_buffer[i++]; + p[ 5] = c_buffer[i++]; + p[ 6] = c_buffer[i++]; + p[ 7] = c_buffer[i++]; + p[ 1] = ROL2(p[ 1],33) ^ p[ 2]; + p[ 0]+= p[ 3]; + p[ 3] = c_buffer[i++] ^ p[ 0]; + p[ 4]+=p[ 1];p[ 6]+=p[ 3];p[ 0]+=p[ 5];p[ 2]+=p[ 7];p[ 1]=ROL2(p[ 1],17) ^ p[ 4];p[ 3]=ROL2(p[ 3],49) ^ p[ 6];p[ 5]=c_buffer[i++] ^ p[ 0];p[ 7]=c_buffer[i++]^ p[ 2]; + p[ 6]+=p[ 1];p[ 0]+=p[ 7];p[ 2]+=p[ 5];p[ 4]+=p[ 3];p[ 1]=ROL2(p[ 1],44) ^ p[ 6];p[ 7]=ROL2(p[ 7], 9) ^ p[ 0];p[ 5]=ROL2(p[ 5],54) ^ p[ 2];p[ 3]=ROR8(p[ 3]) ^ p[ 4]; + + addwBuff(1,2,3,4,5);TFBIGMIX8o(); + addwBuff(2,3,4,5,6);TFBIGMIX8e(); + addwBuff(3,4,5,6,7);TFBIGMIX8o(); + addwBuff(4,5,6,7,8);TFBIGMIX8e(); + addwBuff(5,6,7,8,0);TFBIGMIX8o(); + addwBuff(6,7,8,0,1);TFBIGMIX8e(); + addwBuff(7,8,0,1,2);TFBIGMIX8o(); + addwBuff(8,0,1,2,3);TFBIGMIX8e(); + addwBuff(0,1,2,3,4);TFBIGMIX8o(); + addwBuff(1,2,3,4,5);TFBIGMIX8e(); + addwBuff(2,3,4,5,6);TFBIGMIX8o(); + addwBuff(3,4,5,6,7);TFBIGMIX8e(); + addwBuff(4,5,6,7,8);TFBIGMIX8o(); + addwBuff(5,6,7,8,0);TFBIGMIX8e(); + addwBuff(6,7,8,0,1);TFBIGMIX8o(); + addwBuff(7,8,0,1,2);TFBIGMIX8e(); + addwBuff(8,0,1,2,3);TFBIGMIX8o(); + + h[ 0] = c_message16[0] ^ (p[0]+h[ 0]); + h[ 1] = nonce2 ^ (p[1]+h[ 1]); + h[ 2]+= p[2]; + h[ 3]+= p[3]; + h[ 4]+= p[4]; + + h[ 5]+= p[5] + c_t[ 3];//make_uint2(0x50,0);// SPH_T64(bcount << 6) + (sph_u64)(extra); + h[ 6]+= p[6] + c_t[ 4];//make_uint2(0,0xB0000000);// (bcount >> 58) + ((sph_u64)(etype) << 55); + h[ 7]+= p[7] + vectorize(18); + + h[ 8] = h[ 0] ^ h[ 1] ^ h[ 2] ^ h[ 3] ^ h[ 4] ^ h[ 5] ^ h[ 6] ^ h[ 7] ^ vectorize(0x1BD11BDAA9FC1A22); + + p[ 0] = h[ 0]; p[ 1] = h[ 1]; p[ 2] = h[ 2]; p[ 3] = h[ 3]; p[ 4] = h[ 4]; p[ 5] = h[ 5] + c_t[ 0]; p[ 6] = h[ 6] + c_t[ 1];p[ 7] = h[ 7]; + TFBIGMIX8e(); + addwCon(1,2,3,4,5,6,7,8, 1,2, 0);TFBIGMIX8o(); + addwCon(2,3,4,5,6,7,8,0, 2,0, 1);TFBIGMIX8e(); + addwCon(3,4,5,6,7,8,0,1, 0,1, 2);TFBIGMIX8o(); + addwCon(4,5,6,7,8,0,1,2, 1,2, 3);TFBIGMIX8e(); + addwCon(5,6,7,8,0,1,2,3, 2,0, 4);TFBIGMIX8o(); + addwCon(6,7,8,0,1,2,3,4, 0,1, 5);TFBIGMIX8e(); + addwCon(7,8,0,1,2,3,4,5, 1,2, 6);TFBIGMIX8o(); + addwCon(8,0,1,2,3,4,5,6, 2,0, 7);TFBIGMIX8e(); + addwCon(0,1,2,3,4,5,6,7, 0,1, 8);TFBIGMIX8o(); + addwCon(1,2,3,4,5,6,7,8, 1,2, 9);TFBIGMIX8e(); + addwCon(2,3,4,5,6,7,8,0, 2,0,10);TFBIGMIX8o(); + addwCon(3,4,5,6,7,8,0,1, 0,1,11);TFBIGMIX8e(); + addwCon(4,5,6,7,8,0,1,2, 1,2,12);TFBIGMIX8o(); + addwCon(5,6,7,8,0,1,2,3, 2,0,13);TFBIGMIX8e(); + addwCon(6,7,8,0,1,2,3,4, 0,1,14);TFBIGMIX8o(); + addwCon(7,8,0,1,2,3,4,5, 1,2,15);TFBIGMIX8e(); + addwCon(8,0,1,2,3,4,5,6, 2,0,16);TFBIGMIX8o(); + addwCon(0,1,2,3,4,5,6,7, 0,1,17); + + uint32_t W1[16]; + uint32_t W2[16]; + uint32_t regs[8]; + uint32_t hash[8]; + + uint32_t T1; + + #pragma unroll 16 + for (int k = 0; k<16; k++) + W1[k] = cuda_swab32(((uint32_t *)&p)[k]); + + // Init with Hash-Table + #pragma unroll 8 + for (int k = 0; k < 8; k++) { + hash[k] = regs[k] = sha256_hashTable[k]; + } + + // Progress W1 + #pragma unroll 16 + for (int j = 0; j<16; j++) + { + T1 = regs[7] + sha256_constantTable[j] + bsg2_1(regs[4]) + Ch(regs[4], regs[5], regs[6]) + W1[j]; + #pragma unroll + for (int k = 6; k >= 0; k--) regs[k + 1] = regs[k]; + regs[0] = T1 + bsg2_0(regs[1]) + Maj(regs[1], regs[2], regs[3]); + regs[4] += T1; + } + + // Progress W2...W3 + + ////// PART 1 + #pragma unroll 2 + for (int j = 0; j<2; j++) + W2[j] = ssg2_1(W1[14 + j]) + W1[9 + j] + ssg2_0(W1[1 + j]) + W1[j]; + #pragma unroll 5 + for (int j = 2; j<7; j++) + W2[j] = ssg2_1(W2[j - 2]) + W1[9 + j] + ssg2_0(W1[1 + j]) + W1[j]; + + #pragma unroll 8 + for (int j = 7; j<15; j++) + W2[j] = ssg2_1(W2[j - 2]) + W2[j - 7] + ssg2_0(W1[1 + j]) + W1[j]; + + W2[15] = ssg2_1(W2[13]) + W2[8] + ssg2_0(W2[0]) + W1[15]; + + // Round function + #pragma unroll + for (int j = 0; j<16; j++) + { + T1 = regs[7] + sha256_constantTable[j + 16] + bsg2_1(regs[4]) + Ch(regs[4], regs[5], regs[6]) + W2[j]; + #pragma unroll + for (int l = 6; l >= 0; l--) regs[l + 1] = regs[l]; + regs[0] = T1 + bsg2_0(regs[1]) + Maj(regs[1], regs[2], regs[3]); + regs[4] += T1; + } + + ////// PART 2 + #pragma unroll + for (int j = 0; j<2; j++) + W1[j] = ssg2_1(W2[14 + j]) + W2[9 + j] + ssg2_0(W2[1 + j]) + W2[j]; + + #pragma unroll + for (int j = 2; j<7; j++) + W1[j] = ssg2_1(W1[j - 2]) + W2[9 + j] + ssg2_0(W2[1 + j]) + W2[j]; + + #pragma unroll + for (int j = 7; j<15; j++) + W1[j] = ssg2_1(W1[j - 2]) + W1[j - 7] + ssg2_0(W2[1 + j]) + W2[j]; + + W1[15] = ssg2_1(W1[13]) + W1[8] + ssg2_0(W1[0]) + W2[15]; + + // Round function + #pragma unroll + for (int j = 0; j<16; j++) + { + T1 = regs[7] + sha256_constantTable[j + 32] + bsg2_1(regs[4]) + Ch(regs[4], regs[5], regs[6]) + W1[j]; + #pragma unroll + for (int l = 6; l >= 0; l--) regs[l + 1] = regs[l]; + regs[0] = T1 + bsg2_0(regs[1]) + Maj(regs[1], regs[2], regs[3]); + regs[4] += T1; + } + + ////// PART 3 + #pragma unroll + for (int j = 0; j<2; j++) + W2[j] = ssg2_1(W1[14 + j]) + W1[9 + j] + ssg2_0(W1[1 + j]) + W1[j]; + + #pragma unroll + for (int j = 2; j<7; j++) + W2[j] = ssg2_1(W2[j - 2]) + W1[9 + j] + ssg2_0(W1[1 + j]) + W1[j]; + + #pragma unroll + for (int j = 7; j<15; j++) + W2[j] = ssg2_1(W2[j - 2]) + W2[j - 7] + ssg2_0(W1[1 + j]) + W1[j]; + + W2[15] = ssg2_1(W2[13]) + W2[8] + ssg2_0(W2[0]) + W1[15]; + + // Round function + #pragma unroll + for (int j = 0; j<16; j++) + { + T1 = regs[7] + sha256_constantTable[j + 48] + bsg2_1(regs[4]) + Ch(regs[4], regs[5], regs[6]) + W2[j]; + #pragma unroll + for (int l = 6; l >= 0; l--) regs[l + 1] = regs[l]; + regs[0] = T1 + bsg2_0(regs[1]) + Maj(regs[1], regs[2], regs[3]); + regs[4] += T1; + } + + #pragma unroll + for (int k = 0; k<8; k++) + regs[k] = (hash[k] += regs[k]); + + ///// + ///// Second Pass (ending) + ///// + + // Progress W1 + #pragma unroll + for (int j = 0; j<56; j++)//62 + { + T1 = regs[7] + sha256_endingTable[j] + bsg2_1(regs[4]) + Ch(regs[4], regs[5], regs[6]); + #pragma unroll + for (int k = 6; k >= 0; k--) + regs[k + 1] = regs[k]; + regs[0] = T1 + bsg2_0(regs[1]) + Maj(regs[1], regs[2], regs[3]); + regs[4] += T1; + } + T1 = regs[7] + sha256_endingTable[56] + bsg2_1(regs[4]) + Ch(regs[4], regs[5], regs[6]); + regs[7] = T1 + bsg2_0(regs[0]) + Maj(regs[0], regs[1], regs[2]); + regs[3]+= T1; + + T1 = regs[6] + sha256_endingTable[57] + bsg2_1(regs[3]) + Ch(regs[3], regs[4], regs[5]); + regs[2]+= T1; + //************ + regs[1]+= regs[5] + sha256_endingTable[58] + bsg2_1(regs[2]) + Ch(regs[2], regs[3], regs[4]); + regs[0]+= regs[4] + sha256_endingTable[59] + bsg2_1(regs[1]) + Ch(regs[1], regs[2], regs[3]); + + uint32_t test = cuda_swab32(hash[7] + sha256_endingTable[60] + regs[7] + regs[3] + bsg2_1(regs[0]) + Ch(regs[0], regs[1], regs[2])); + if (test <= target7){ + uint32_t pos = atomicInc(&resNonce[0],0xffffffff)+1; + if(pos> 58) + ((sph_u64)(etype) << 55); + t2 = 0xB000000000000050ull; + + p[ 0] = message[ 8] + h0; + p[ 2] = h2; + p[ 3] = h3; + p[ 4] = h4; + p[ 5] = h5 + t0; + p[ 6] = h6 + t1; + p[ 7] = h7; + + p[ 2] += p[ 3]; p[ 3] = ROTL64(p[ 3],36) ^ p[ 2]; + p[ 4] += p[ 5]; p[ 5] = ROTL64(p[ 5],19) ^ p[ 4]; + p[ 6] += p[ 7]; p[ 7] = ROTL64(p[ 7],37) ^ p[ 6]; + + p[ 4]+= p[ 7]; p[ 7] = ROTL64(p[ 7],27) ^ p[ 4]; + p[ 6]+= p[ 5]; p[ 5] = ROTL64(p[ 5],14) ^ p[ 6]; + + uint64_t sk_buf[56]; + int i = 0; + sk_buf[i++] = h0; + sk_buf[i++] = h1; + sk_buf[i++] = h2; + sk_buf[i++] = h3; + sk_buf[i++] = h4; + sk_buf[i++] = h5; + sk_buf[i++] = h6; + sk_buf[i++] = h7; + sk_buf[i++] = h8; + sk_buf[i++] = p[ 0];//10 + sk_buf[i++] = p[ 2]; + sk_buf[i++] = p[ 3]; + sk_buf[i++] = p[ 4]; + sk_buf[i++] = p[ 5]; + sk_buf[i++] = p[ 6]; + sk_buf[i++] = p[ 7]; + sk_buf[i++] = ROTL64(p[ 3],42); + sk_buf[i++] = ROTL64(p[ 5],36); + sk_buf[i++] = ROTL64(p[ 7],39); + sk_buf[i++] = h6 + t1;//20 + sk_buf[i++] = h8 + 1; + sk_buf[i++] = h7 + t2; + sk_buf[i++] = h0 + 2; + sk_buf[i++] = h8 + t0; + sk_buf[i++] = h1 + 3; + sk_buf[i++] = h0 + t1; + sk_buf[i++] = h2 + 4; + sk_buf[i++] = h1 + t2; + sk_buf[i++] = h3 + 5; + sk_buf[i++] = h2 + t0; + sk_buf[i++] = h4 + 6; + sk_buf[i++] = h3 + t1; + sk_buf[i++] = h5 + 7; + sk_buf[i++] = h4 + t2; + sk_buf[i++] = h6 + 8; + sk_buf[i++] = h5 + t0; + sk_buf[i++] = h7 + 9; + sk_buf[i++] = h6 + t1; + sk_buf[i++] = h8 + 10; + sk_buf[i++] = h7 + t2; + sk_buf[i++] = h0 + 11; + sk_buf[i++] = h8 + t0; + sk_buf[i++] = h1 + 12; + sk_buf[i++] = h0 + t1; + sk_buf[i++] = h2 + 13; + sk_buf[i++] = h1 + t2; + sk_buf[i++] = h3 + 14; + sk_buf[i++] = h2 + t0; + sk_buf[i++] = h4 + 15; + sk_buf[i++] = h3 + t1; + sk_buf[i++] = h5 + 16; + sk_buf[i++] = h4 + t2; + sk_buf[i++] = h6 + 17; + sk_buf[i++] = h5 + t0; + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_buffer, sk_buf, sizeof(sk_buf), 0, cudaMemcpyHostToDevice)); + +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_skeincoin(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + + const uint32_t first_nonce = pdata[19]; + + int intensity = (device_sm[dev_id] > 500) ? 27 : 23; + uint32_t throughput = cuda_default_throughput(dev_id, 1UL << intensity); + if (init[thr_id]) throughput = min(throughput, (max_nonce - first_nonce)); + + uint32_t target7 = ptarget[7]; + + if (opt_benchmark) + ((uint64_t*)ptarget)[3] = 0; + + if (!init[thr_id]){ + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], maxResults * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(maxResults * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + CUDA_LOG_ERROR(); + init[thr_id] = true; + } + + uint32_t tpb = TPB52; + if (device_sm[dev_id] <= 500) tpb = TPB50; + const dim3 grid((throughput + tpb - 1) / tpb); + const dim3 block(tpb); + + uint32_t _ALIGN(64) endiandata[20]; + for (int k=0; k < 19; k++) + be32enc(&endiandata[k], pdata[k]); + + skeincoin_setBlock_80(thr_id, (void*)endiandata); + int rc=0; + cudaMemset(d_resNonce[thr_id], 0x00, maxResults*sizeof(uint32_t)); + do { + // GPU HASH + skeincoin_gpu_hash <<< grid, block >>> (throughput, pdata[19], d_resNonce[thr_id], target7); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != 0){ + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], maxResults*sizeof(uint32_t), cudaMemcpyDeviceToHost); + cudaMemset(d_resNonce[thr_id], 0x00, sizeof(uint32_t)); + if(h_resNonce[thr_id][0]>(maxResults-1)){ + gpulog(LOG_WARNING,dev_id,"Candidate flood: %u",h_resNonce[thr_id][0]); + h_resNonce[thr_id][0]=maxResults-1; + } + uint32_t i; + for(i=1;i work->shareratio[0]){ + work_set_target_ratio(work, vhash); + xchg(pdata[19],pdata[21]); + } + rc=2; + break; + } + } + return rc; + } + } + } + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && (uint64_t)max_nonce > (uint64_t)throughput + (uint64_t)pdata[19]); + + *hashes_done = pdata[19] - first_nonce + 1; +// MyStreamSynchronize(NULL, 0, device_map[thr_id]); + return rc; +} + +// cleanup +extern "C" void free_skeincoin(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/skein/skein2.cu b/skein/skein2.cu new file mode 100644 index 0000000..1b0de45 --- /dev/null +++ b/skein/skein2.cu @@ -0,0 +1,539 @@ +/* + * Based on: + * SKEIN512 80 + SKEIN512 64 (Woodcoin) + * by tpruvot@github - 2015 + * + * -------------------------------------------- + * Compiled under CUDA7.5 for compute 5.0 - 5.2 + * + * Previous results: + * GTX970 - 1239MHz - 179.5MH/s + * GTX750ti - 1320MHz - 74.5MH/s + * + * Changelog: + * Merged kernels (Higher intensities supported) + * More precomputations (mainly additions) + * Fixed uint2 vector addition (cuda_helper.h / generic fix for all hashing functions) + * Increased register use + * Increased default intensity + * + * Current results: + * GTX970 - 1278MHz - 258.5MH/s + * GTX750ti - 1320MHz - 101.5MH/s + * + * Both tests carried out, on 970, with --plimit=180W + * -------------------------------------------- + * + * Provos Alexis - 2016 + * + */ +#include + +#include "sph/sph_skein.h" + +#include "miner.h" +#include "cuda_helper.h" +#include "skein_header.h" + +#define TPB52 1024 +#define TPB50 768 + +#define NBN 2 + +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +void skein2hash(void *output, const void *input) +{ + uint32_t _ALIGN(64) hash[16]; + sph_skein512_context ctx_skein; + + sph_skein512_init(&ctx_skein); + sph_skein512(&ctx_skein, input, 80); + sph_skein512_close(&ctx_skein, hash); + + sph_skein512_init(&ctx_skein); + sph_skein512(&ctx_skein, hash, 64); + sph_skein512_close(&ctx_skein, hash); + + memcpy(output, (void*) hash, 32); +} + +__constant__ uint2 _ALIGN(16) c_buffer[128]; // padded message (80 bytes + 72 bytes midstate + align) + +__constant__ const uint2 c_h[ 9] = { + {0x749C51CE,0x4903ADFF},{0x9746DF03,0x0D95DE39},{0x27C79BCE,0x8FD19341},{0xFF352CB1,0x9A255629},{0xDF6CA7B0,0x5DB62599},{0xA9D5C3F4,0xEABE394C}, + {0x1A75B523,0x991112C7},{0x660FCC33,0xAE18A40B},{0xA9FC1A22,0x1BD11BDA} + }; + +__constant__ const uint2 c_t[ 5] = { {8,0},{0,0xff000000},{8,0xff000000},{0x50,0},{0,0xB0000000} }; + +__constant__ const uint64_t c_add[18] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; + +__global__ +#if __CUDA_ARCH__ <= 500 +__launch_bounds__(TPB50, 1) +#else +__launch_bounds__(TPB52, 1) +#endif +static void skein2_512_gpu_hash_80(const uint32_t threads,const uint32_t startNounce, uint32_t *resNonce,const uint64_t highTarget){ + + const uint32_t thread = blockDim.x * blockIdx.x + threadIdx.x; + uint2 h[ 9]; + uint2 p[8]; + if (thread < threads){ + + // Skein + #pragma unroll 9 + for(int i=0;i<9;i++){ + h[ i] = c_buffer[ i]; + } + + uint2 nonce = make_uint2(c_buffer[ 9].x, startNounce + thread); + +// TFBIG_4e_UI2(0); + p[ 1] = nonce + h[ 1]; p[ 0] = c_buffer[10] + p[ 1]; + p[ 2] = c_buffer[11]; p[ 3] = c_buffer[12]; + p[ 4] = c_buffer[13]; p[ 5] = c_buffer[14]; + p[ 6] = c_buffer[15]; p[ 7] = c_buffer[16]; + +// TFBIGMIX8e(); + p[ 1]=ROL2(p[ 1],46) ^ p[ 0]; + + p[ 2]+=p[ 1]; p[ 0]+=p[ 3]; + p[ 1]=ROL2(p[ 1],33) ^ p[ 2]; p[ 3]=c_buffer[17] ^ p[ 0]; + + p[ 4]+=p[ 1]; p[ 6]+=p[ 3]; + p[ 0]+=p[ 5]; p[ 2]+=p[ 7]; + p[ 1]=ROL2(p[ 1],17) ^ p[ 4]; p[ 3]=ROL2(p[ 3],49) ^ p[ 6]; + p[ 5]=c_buffer[18] ^ p[ 0]; p[ 7]=c_buffer[19] ^ p[ 2]; + + p[ 6]+=p[ 1]; p[ 0]+=p[ 7]; + p[ 2]+=p[ 5]; p[ 4]+=p[ 3]; + p[ 1]=ROL2(p[ 1],44) ^ p[ 6]; p[ 7]=ROL2(p[ 7], 9) ^ p[ 0]; + p[ 5]=ROL2(p[ 5],54) ^ p[ 2]; p[ 3]=ROR8(p[ 3]) ^ p[ 4]; + + int i=20; + addwBuff(1,2,3,4,5);TFBIGMIX8o(); + addwBuff(2,3,4,5,6);TFBIGMIX8e(); + addwBuff(3,4,5,6,7);TFBIGMIX8o(); + addwBuff(4,5,6,7,8);TFBIGMIX8e(); + addwBuff(5,6,7,8,0);TFBIGMIX8o(); + addwBuff(6,7,8,0,1);TFBIGMIX8e(); + addwBuff(7,8,0,1,2);TFBIGMIX8o(); + addwBuff(8,0,1,2,3);TFBIGMIX8e(); + addwBuff(0,1,2,3,4);TFBIGMIX8o(); + addwBuff(1,2,3,4,5);TFBIGMIX8e(); + addwBuff(2,3,4,5,6);TFBIGMIX8o(); + addwBuff(3,4,5,6,7);TFBIGMIX8e(); + addwBuff(4,5,6,7,8);TFBIGMIX8o(); + addwBuff(5,6,7,8,0);TFBIGMIX8e(); + addwBuff(6,7,8,0,1);TFBIGMIX8o(); + addwBuff(7,8,0,1,2);TFBIGMIX8e(); + addwBuff(8,0,1,2,3);TFBIGMIX8o(); + i++; + h[ 0] = c_buffer[i++] ^ (p[0]+h[ 0]); + h[ 1] = nonce ^ (p[1]+h[ 1]); + h[ 2]+= p[2]; + h[ 3]+= p[3]; + h[ 4]+= p[4]; + h[ 5]+= p[5] + c_t[ 3];// SPH_T64(bcount << 6) + (sph_u64)(extra); + h[ 6]+= p[6] + c_t[ 4];//make_uint2(0,0xB0000000);// (bcount >> 58) + ((sph_u64)(etype) << 55); + h[ 7]+= p[7] + c_add[17]; + + h[ 8] = h[ 0] ^ h[ 1] ^ h[ 2] ^ h[ 3] ^ h[ 4] ^ h[ 5] ^ h[ 6] ^ h[ 7] ^ c_h[ 8]; + + p[ 0] = h[ 0]; p[ 1] = h[ 1]; p[ 2] = h[ 2]; p[ 3] = h[ 3];p[ 4] = h[ 4]; p[ 5] = h[ 5] + c_t[ 0];p[ 6] = h[ 6] + c_t[ 1];p[ 7] = h[ 7]; + TFBIGMIX8e(); + addwCon(1,2,3,4,5,6,7,8, 1,2, 0);TFBIGMIX8o(); + addwCon(2,3,4,5,6,7,8,0, 2,0, 1);TFBIGMIX8e(); + addwCon(3,4,5,6,7,8,0,1, 0,1, 2);TFBIGMIX8o(); + addwCon(4,5,6,7,8,0,1,2, 1,2, 3);TFBIGMIX8e(); + addwCon(5,6,7,8,0,1,2,3, 2,0, 4);TFBIGMIX8o(); + addwCon(6,7,8,0,1,2,3,4, 0,1, 5);TFBIGMIX8e(); + addwCon(7,8,0,1,2,3,4,5, 1,2, 6);TFBIGMIX8o(); + addwCon(8,0,1,2,3,4,5,6, 2,0, 7);TFBIGMIX8e(); + addwCon(0,1,2,3,4,5,6,7, 0,1, 8);TFBIGMIX8o(); + addwCon(1,2,3,4,5,6,7,8, 1,2, 9);TFBIGMIX8e(); + addwCon(2,3,4,5,6,7,8,0, 2,0,10);TFBIGMIX8o(); + addwCon(3,4,5,6,7,8,0,1, 0,1,11);TFBIGMIX8e(); + addwCon(4,5,6,7,8,0,1,2, 1,2,12);TFBIGMIX8o(); + addwCon(5,6,7,8,0,1,2,3, 2,0,13);TFBIGMIX8e(); + addwCon(6,7,8,0,1,2,3,4, 0,1,14);TFBIGMIX8o(); + addwCon(7,8,0,1,2,3,4,5, 1,2,15);TFBIGMIX8e(); + addwCon(8,0,1,2,3,4,5,6, 2,0,16);TFBIGMIX8o(); + addwCon(0,1,2,3,4,5,6,7, 0,1,17); + + // Initialisierung + h[ 0] = c_h[ 0]; h[ 1] = c_h[ 1]; h[ 2] = c_h[ 2]; h[ 3] = c_h[ 3]; + h[ 4] = c_h[ 4]; h[ 5] = c_h[ 5]; h[ 6] = c_h[ 6]; h[ 7] = c_h[ 7]; + + uint2 p2[ 8]; + #pragma unroll + for(int i=0;i<8;i++) + p2[ i] = p[ i]; + + h[ 8] = c_buffer[i++]; + + addwBuff(0,1,2,3,4);TFBIGMIX8e(); + addwBuff(1,2,3,4,5);TFBIGMIX8o(); + addwBuff(2,3,4,5,6);TFBIGMIX8e(); + addwBuff(3,4,5,6,7);TFBIGMIX8o(); + addwBuff(4,5,6,7,8);TFBIGMIX8e(); + addwBuff(5,6,7,8,0);TFBIGMIX8o(); + addwBuff(6,7,8,0,1);TFBIGMIX8e(); + addwBuff(7,8,0,1,2);TFBIGMIX8o(); + addwBuff(8,0,1,2,3);TFBIGMIX8e(); + addwBuff(0,1,2,3,4);TFBIGMIX8o(); + addwBuff(1,2,3,4,5);TFBIGMIX8e(); + addwBuff(2,3,4,5,6);TFBIGMIX8o(); + addwBuff(3,4,5,6,7);TFBIGMIX8e(); + addwBuff(4,5,6,7,8);TFBIGMIX8o(); + addwBuff(5,6,7,8,0);TFBIGMIX8e(); + addwBuff(6,7,8,0,1);TFBIGMIX8o(); + addwBuff(7,8,0,1,2);TFBIGMIX8e(); + addwBuff(8,0,1,2,3);TFBIGMIX8o(); + addwBuff(0,1,2,3,4); + + h[ 0] = p2[0] ^ p[0]; h[ 1] = p2[1] ^ p[1]; h[ 2] = p2[2] ^ p[2]; h[ 3] = p2[3] ^ p[3]; + h[ 4] = p2[4] ^ p[4]; h[ 5] = p2[5] ^ p[5]; h[ 6] = p2[6] ^ p[6]; h[ 7] = p2[7] ^ p[7]; + + h[ 8] = h[ 0] ^ h[ 1] ^ h[ 2] ^ h[ 3] ^ h[ 4] ^ h[ 5] ^ h[ 6] ^ h[ 7] ^ c_h[ 8]; + + p[ 0] = h[ 0]; p[ 1] = h[ 1]; p[ 2] = h[ 2]; p[ 3] = h[ 3]; p[ 4] = h[ 4]; p[ 5] = h[ 5] + c_t[ 0];p[ 6] = h[ 6] + c_t[ 1];p[ 7] = h[ 7]; + TFBIGMIX8e(); + addwCon(1,2,3,4,5,6,7,8, 1,2, 0);TFBIGMIX8o(); + addwCon(2,3,4,5,6,7,8,0, 2,0, 1);TFBIGMIX8e(); + addwCon(3,4,5,6,7,8,0,1, 0,1, 2);TFBIGMIX8o(); + addwCon(4,5,6,7,8,0,1,2, 1,2, 3);TFBIGMIX8e(); + addwCon(5,6,7,8,0,1,2,3, 2,0, 4);TFBIGMIX8o(); + addwCon(6,7,8,0,1,2,3,4, 0,1, 5);TFBIGMIX8e(); + addwCon(7,8,0,1,2,3,4,5, 1,2, 6);TFBIGMIX8o(); + addwCon(8,0,1,2,3,4,5,6, 2,0, 7);TFBIGMIX8e(); + addwCon(0,1,2,3,4,5,6,7, 0,1, 8);TFBIGMIX8o(); + addwCon(1,2,3,4,5,6,7,8, 1,2, 9);TFBIGMIX8e(); + addwCon(2,3,4,5,6,7,8,0, 2,0,10);TFBIGMIX8o(); + addwCon(3,4,5,6,7,8,0,1, 0,1,11);TFBIGMIX8e(); + addwCon(4,5,6,7,8,0,1,2, 1,2,12);TFBIGMIX8o(); + addwCon(5,6,7,8,0,1,2,3, 2,0,13);TFBIGMIX8e(); + addwCon(6,7,8,0,1,2,3,4, 0,1,14);TFBIGMIX8o(); + addwCon(7,8,0,1,2,3,4,5, 1,2,15);TFBIGMIX8e(); + addwCon(8,0,1,2,3,4,5,6, 2,0,16); + +// TFBIGMIX8o(); + p[ 0]+=p[ 1];p[ 2]+=p[ 3];p[ 4]+=p[ 5];p[ 6]+=p[ 7];p[ 1]=ROL2(p[ 1],39) ^ p[ 0];p[ 3]=ROL2(p[ 3],30) ^ p[ 2];p[ 5]=ROL2(p[ 5],34) ^ p[ 4];p[ 7]=ROL24(p[ 7]) ^ p[ 6]; + p[ 2]+=p[ 1];p[ 4]+=p[ 7];p[ 6]+=p[ 5];p[ 0]+=p[ 3]; + + p[ 1]=ROL2(p[ 1],13) ^ p[ 2]; + p[ 3]=ROL2(p[ 3],17) ^ p[ 0]; + + p[ 4]+=p[ 1]; + p[ 6]+=p[ 3]; + + p[ 3]=ROL2(p[ 3],29) ^ p[ 6]; + + p[ 4]+=p[ 3]; + p[ 3]=ROL2(p[ 3],22) ^ p[ 4]; + + if(devectorize(p[3]+h[ 3])<=highTarget){ + uint32_t tmp = atomicExch(&resNonce[0], startNounce + thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } +} +__host__ +void skein2_512_cpu_setBlock_80(void *pdata) +{ + uint64_t message[20]; + uint64_t p[8]; + uint64_t h0, h1, h2, h3, h4, h5, h6, h7, h8; + uint64_t t0, t1, t2; + + memcpy(&message[0], pdata, 80); + + h0 = 0x4903ADFF749C51CEull; + h1 = 0x0D95DE399746DF03ull; + h2 = 0x8FD1934127C79BCEull; + h3 = 0x9A255629FF352CB1ull; + h4 = 0x5DB62599DF6CA7B0ull; + h5 = 0xEABE394CA9D5C3F4ull; + h6 = 0x991112C71A75B523ull; + h7 = 0xAE18A40B660FCC33ull; + // h[ 8] = h[ 0] ^ h[ 1] ^ h[ 2] ^ h[ 3] ^ h[ 4] ^ h[ 5] ^ h[ 6] ^ h[ 7] ^ SPH_C64(0x1BD11BDAA9FC1A22); + h8 = 0xcab2076d98173ec4ULL; + + t0 = 64; // ptr + t1 = 0x7000000000000000ull; + t2 = 0x7000000000000040ull; + + memcpy(&p[0], &message[0], 64); + + TFBIG_4e_PRE(0); + TFBIG_4o_PRE(1); + TFBIG_4e_PRE(2); + TFBIG_4o_PRE(3); + TFBIG_4e_PRE(4); + TFBIG_4o_PRE(5); + TFBIG_4e_PRE(6); + TFBIG_4o_PRE(7); + TFBIG_4e_PRE(8); + TFBIG_4o_PRE(9); + TFBIG_4e_PRE(10); + TFBIG_4o_PRE(11); + TFBIG_4e_PRE(12); + TFBIG_4o_PRE(13); + TFBIG_4e_PRE(14); + TFBIG_4o_PRE(15); + TFBIG_4e_PRE(16); + TFBIG_4o_PRE(17); + TFBIG_ADDKEY_PRE(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, 18); + + h0 = message[0] ^ p[0]; + h1 = message[1] ^ p[1]; + h2 = message[2] ^ p[2]; + h3 = message[3] ^ p[3]; + h4 = message[4] ^ p[4]; + h5 = message[5] ^ p[5]; + h6 = message[6] ^ p[6]; + h7 = message[7] ^ p[7]; + + h8 = ((h0 ^ h1) ^ (h2 ^ h3)) ^ ((h4 ^ h5) ^ (h6 ^ h7)) ^ 0x1BD11BDAA9FC1A22; + + t0 = 0x50ull; + t1 = 0xB000000000000000ull; + t2 = t0^t1; + + p[ 0] = message[ 8]+h0; + p[ 2] = h2; + p[ 3] = h3; + p[ 4] = h4; + p[ 5] = h5 + t0; + p[ 6] = h6 + t1; + p[ 7] = h7; + + p[ 2]+=p[ 3]; p[ 3]=ROTL64(p[ 3],36) ^ p[ 2]; + p[ 4]+=p[ 5]; p[ 5]=ROTL64(p[ 5],19) ^ p[ 4]; + p[ 6]+=p[ 7]; p[ 7]=ROTL64(p[ 7],37) ^ p[ 6]; + + p[ 4]+=p[ 7]; p[ 7]=ROTL64(p[ 7],27) ^ p[ 4]; + p[ 6]+=p[ 5]; p[ 5]=ROTL64(p[ 5],14) ^ p[ 6]; + + uint64_t buffer[128]; + int i=0; + buffer[i++] = h0; + buffer[i++] = h1; + buffer[i++] = h2; + buffer[i++] = h3; + buffer[i++] = h4; + buffer[i++] = h5; + buffer[i++] = h6; + buffer[i++] = h7; + buffer[i++] = h8; + buffer[i++] = message[ 9]; + buffer[i++] = p[ 0]; + buffer[i++] = p[ 2]; + buffer[i++] = p[ 3]; + buffer[i++] = p[ 4]; + buffer[i++] = p[ 5]; + buffer[i++] = p[ 6]; + buffer[i++] = p[ 7]; + buffer[i++] = ROTL64(p[ 3],42); + buffer[i++] = ROTL64(p[ 5],36); + buffer[i++] = ROTL64(p[ 7],39); + buffer[i++] = h6 + t1; + buffer[i++] = h8 + 1; + buffer[i++] = h7 + t2; + buffer[i++] = h0 + 2; + buffer[i++] = h8 + t0; + buffer[i++] = h1 + 3; + buffer[i++] = h0 + t1; + buffer[i++] = h2 + 4; + buffer[i++] = h1 + t2; + buffer[i++] = h3 + 5; + buffer[i++] = h2 + t0; + buffer[i++] = h4 + 6; + buffer[i++] = h3 + t1; + buffer[i++] = h5 + 7; + buffer[i++] = h4 + t2; + buffer[i++] = h6 + 8; + buffer[i++] = h5 + t0; + buffer[i++] = h7 + 9; + buffer[i++] = h6 + t1; + buffer[i++] = h8 + 10; + buffer[i++] = h7 + t2; + buffer[i++] = h0 + 11; + buffer[i++] = h8 + t0; + buffer[i++] = h1 + 12; + buffer[i++] = h0 + t1; + buffer[i++] = h2 + 13; + buffer[i++] = h1 + t2; + buffer[i++] = h3 + 14; + buffer[i++] = h2 + t0; + buffer[i++] = h4 + 15; + buffer[i++] = h3 + t1; + buffer[i++] = h5 + 16; + buffer[i++] = h4 + t2; + buffer[i++] = h6 + 17; + buffer[i++] = h5 + t0; + buffer[i++] = message[ 8];//i=30 + + h0 = 0x4903ADFF749C51CEull; + h1 = 0x0D95DE399746DF03ull; + h2 = 0x8FD1934127C79BCEull; + h3 = 0x9A255629FF352CB1ull; + h4 = 0x5DB62599DF6CA7B0ull; + h5 = 0xEABE394CA9D5C3F4ull; + h6 = 0x991112C71A75B523ull; + h7 = 0xAE18A40B660FCC33ull; + + t0 = 64; // ptr + t1 = 0xf000000000000000ULL;// t1 = vectorize(480ull << 55); // etype + t2 = t0 ^ t1; + h8 = h0 ^ h1 ^ h2 ^ h3 ^ h4 ^ h5 ^ h6 ^ h7 ^ 0x1BD11BDAA9FC1A22; + + buffer[i++] = h8; + buffer[i++] = h5 + t0; + buffer[i++] = h7; + buffer[i++] = h6 + t1; + buffer[i++] = h8 + 1; + buffer[i++] = h7 + t2; + buffer[i++] = h0 + 2; + buffer[i++] = h8 + t0; + buffer[i++] = h1 + 3; + buffer[i++] = h0 + t1; + buffer[i++] = h2 + 4; + buffer[i++] = h1 + t2; + buffer[i++] = h3 + 5; + buffer[i++] = h2 + t0; + buffer[i++] = h4 + 6; + buffer[i++] = h3 + t1; + buffer[i++] = h5 + 7; + buffer[i++] = h4 + t2; + buffer[i++] = h6 + 8; + buffer[i++] = h5 + t0; + buffer[i++] = h7 + 9; + buffer[i++] = h6 + t1; + buffer[i++] = h8 + 10; + buffer[i++] = h7 + t2; + buffer[i++] = h0 + 11; + buffer[i++] = h8 + t0; + buffer[i++] = h1 + 12; + buffer[i++] = h0 + t1; + buffer[i++] = h2 + 13; + buffer[i++] = h1 + t2; + buffer[i++] = h3 + 14; + buffer[i++] = h2 + t0; + buffer[i++] = h4 + 15; + buffer[i++] = h3 + t1; + buffer[i++] = h5 + 16; + buffer[i++] = h4 + t2; + buffer[i++] = h6 + 17; + buffer[i++] = h5 + t0; + buffer[i++] = h7 + 18; + buffer[i++] = h6 + t1; + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_buffer, buffer, i*sizeof(uint64_t), 0)); +} + +static bool init[MAX_GPUS] = { 0 }; + +int scanhash_skein2(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + int dev_id = device_map[thr_id]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + int intensity = (device_sm[dev_id] > 500) ? 27 : 24; + uint32_t throughput = cuda_default_throughput(dev_id, 1UL << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ((uint64_t*)ptarget)[3] = 0; + + const uint64_t highTarget = *(uint64_t*)&ptarget[6]; + + if (!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + uint32_t tpb = TPB52; + if (device_sm[dev_id] <= 500) tpb = TPB50; + const dim3 grid((throughput + tpb-1)/tpb); + const dim3 block(tpb); + + uint32_t endiandata[20]; + for (int k=0; k < 19; k++) + be32enc(&endiandata[k], pdata[k]); + + skein2_512_cpu_setBlock_80((void*)endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + int rc=0; + do { + // Hash with CUDA + skein2_512_gpu_hash_80 <<< grid, block >>> (throughput, pdata[19], d_resNonce[thr_id],highTarget); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + uint32_t _ALIGN(64) vhash64[8]; + endiandata[19] = h_resNonce[thr_id][0]; + skein2hash(vhash64, endiandata); + if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { + *hashes_done = pdata[19] - first_nonce + throughput + 1; + work_set_target_ratio(work, vhash64); + pdata[19] = swab32(h_resNonce[thr_id][0]); + rc = 1; + if (h_resNonce[thr_id][1] != UINT32_MAX) { +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", h_resNonce[thr_id][1]); + endiandata[19] = h_resNonce[thr_id][1]; + skein2hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]) + work_set_target_ratio(work, vhash64); + pdata[21] = swab32(h_resNonce[thr_id][1]); + rc = 2; + } + return rc; + } else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && (uint64_t)max_nonce > (uint64_t)throughput + (uint64_t)pdata[19]); + + *hashes_done = pdata[19] - first_nonce + 1; + return rc; +} + +// cleanup +void free_skein2(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/skein/skein_header.h b/skein/skein_header.h new file mode 100644 index 0000000..4ba28e7 --- /dev/null +++ b/skein/skein_header.h @@ -0,0 +1,383 @@ +/* Elementary defines for SKEIN */ + +/* + * M9_ ## s ## _ ## i evaluates to s+i mod 9 (0 <= s <= 18, 0 <= i <= 7). + */ + +#define M9_0_0 0 +#define M9_0_1 1 +#define M9_0_2 2 +#define M9_0_3 3 +#define M9_0_4 4 +#define M9_0_5 5 +#define M9_0_6 6 +#define M9_0_7 7 + +#define M9_1_0 1 +#define M9_1_1 2 +#define M9_1_2 3 +#define M9_1_3 4 +#define M9_1_4 5 +#define M9_1_5 6 +#define M9_1_6 7 +#define M9_1_7 8 + +#define M9_2_0 2 +#define M9_2_1 3 +#define M9_2_2 4 +#define M9_2_3 5 +#define M9_2_4 6 +#define M9_2_5 7 +#define M9_2_6 8 +#define M9_2_7 0 + +#define M9_3_0 3 +#define M9_3_1 4 +#define M9_3_2 5 +#define M9_3_3 6 +#define M9_3_4 7 +#define M9_3_5 8 +#define M9_3_6 0 +#define M9_3_7 1 + +#define M9_4_0 4 +#define M9_4_1 5 +#define M9_4_2 6 +#define M9_4_3 7 +#define M9_4_4 8 +#define M9_4_5 0 +#define M9_4_6 1 +#define M9_4_7 2 + +#define M9_5_0 5 +#define M9_5_1 6 +#define M9_5_2 7 +#define M9_5_3 8 +#define M9_5_4 0 +#define M9_5_5 1 +#define M9_5_6 2 +#define M9_5_7 3 + +#define M9_6_0 6 +#define M9_6_1 7 +#define M9_6_2 8 +#define M9_6_3 0 +#define M9_6_4 1 +#define M9_6_5 2 +#define M9_6_6 3 +#define M9_6_7 4 + +#define M9_7_0 7 +#define M9_7_1 8 +#define M9_7_2 0 +#define M9_7_3 1 +#define M9_7_4 2 +#define M9_7_5 3 +#define M9_7_6 4 +#define M9_7_7 5 + +#define M9_8_0 8 +#define M9_8_1 0 +#define M9_8_2 1 +#define M9_8_3 2 +#define M9_8_4 3 +#define M9_8_5 4 +#define M9_8_6 5 +#define M9_8_7 6 + +#define M9_9_0 0 +#define M9_9_1 1 +#define M9_9_2 2 +#define M9_9_3 3 +#define M9_9_4 4 +#define M9_9_5 5 +#define M9_9_6 6 +#define M9_9_7 7 + +#define M9_10_0 1 +#define M9_10_1 2 +#define M9_10_2 3 +#define M9_10_3 4 +#define M9_10_4 5 +#define M9_10_5 6 +#define M9_10_6 7 +#define M9_10_7 8 + +#define M9_11_0 2 +#define M9_11_1 3 +#define M9_11_2 4 +#define M9_11_3 5 +#define M9_11_4 6 +#define M9_11_5 7 +#define M9_11_6 8 +#define M9_11_7 0 + +#define M9_12_0 3 +#define M9_12_1 4 +#define M9_12_2 5 +#define M9_12_3 6 +#define M9_12_4 7 +#define M9_12_5 8 +#define M9_12_6 0 +#define M9_12_7 1 + +#define M9_13_0 4 +#define M9_13_1 5 +#define M9_13_2 6 +#define M9_13_3 7 +#define M9_13_4 8 +#define M9_13_5 0 +#define M9_13_6 1 +#define M9_13_7 2 + +#define M9_14_0 5 +#define M9_14_1 6 +#define M9_14_2 7 +#define M9_14_3 8 +#define M9_14_4 0 +#define M9_14_5 1 +#define M9_14_6 2 +#define M9_14_7 3 + +#define M9_15_0 6 +#define M9_15_1 7 +#define M9_15_2 8 +#define M9_15_3 0 +#define M9_15_4 1 +#define M9_15_5 2 +#define M9_15_6 3 +#define M9_15_7 4 + +#define M9_16_0 7 +#define M9_16_1 8 +#define M9_16_2 0 +#define M9_16_3 1 +#define M9_16_4 2 +#define M9_16_5 3 +#define M9_16_6 4 +#define M9_16_7 5 + +#define M9_17_0 8 +#define M9_17_1 0 +#define M9_17_2 1 +#define M9_17_3 2 +#define M9_17_4 3 +#define M9_17_5 4 +#define M9_17_6 5 +#define M9_17_7 6 + +#define M9_18_0 0 +#define M9_18_1 1 +#define M9_18_2 2 +#define M9_18_3 3 +#define M9_18_4 4 +#define M9_18_5 5 +#define M9_18_6 6 +#define M9_18_7 7 + +/* + * M3_ ## s ## _ ## i evaluates to s+i mod 3 (0 <= s <= 18, 0 <= i <= 1). + */ + +#define M3_0_0 0 +#define M3_0_1 1 +#define M3_1_0 1 +#define M3_1_1 2 +#define M3_2_0 2 +#define M3_2_1 0 +#define M3_3_0 0 +#define M3_3_1 1 +#define M3_4_0 1 +#define M3_4_1 2 +#define M3_5_0 2 +#define M3_5_1 0 +#define M3_6_0 0 +#define M3_6_1 1 +#define M3_7_0 1 +#define M3_7_1 2 +#define M3_8_0 2 +#define M3_8_1 0 +#define M3_9_0 0 +#define M3_9_1 1 +#define M3_10_0 1 +#define M3_10_1 2 +#define M3_11_0 2 +#define M3_11_1 0 +#define M3_12_0 0 +#define M3_12_1 1 +#define M3_13_0 1 +#define M3_13_1 2 +#define M3_14_0 2 +#define M3_14_1 0 +#define M3_15_0 0 +#define M3_15_1 1 +#define M3_16_0 1 +#define M3_16_1 2 +#define M3_17_0 2 +#define M3_17_1 0 +#define M3_18_0 0 +#define M3_18_1 1 + +#define XCAT(x, y) XCAT_(x, y) +#define XCAT_(x, y) x ## y + +#define SKBI(k, s, i) XCAT(k, XCAT(XCAT(XCAT(M9_, s), _), i)) +#define SKBT(t, s, v) XCAT(t, XCAT(XCAT(XCAT(M3_, s), _), v)) + +#define TFBIG_ADDKEY(w0, w1, w2, w3, w4, w5, w6, w7, k, t, s) { \ + w0 = (w0 + SKBI(k, s, 0)); \ + w1 = (w1 + SKBI(k, s, 1)); \ + w2 = (w2 + SKBI(k, s, 2)); \ + w3 = (w3 + SKBI(k, s, 3)); \ + w4 = (w4 + SKBI(k, s, 4)); \ + w5 = (w5 + SKBI(k, s, 5) + SKBT(t, s, 0)); \ + w6 = (w6 + SKBI(k, s, 6) + SKBT(t, s, 1)); \ + w7 = (w7 + SKBI(k, s, 7) + make_uint2(s,0); \ + } + +#define TFBIG_MIX(x0, x1, rc) { \ + x0 = x0 + x1; \ + x1 = ROL2(x1, rc) ^ x0; \ + } + +#define TFBIG_MIX8(w0, w1, w2, w3, w4, w5, w6, w7, rc0, rc1, rc2, rc3) { \ + TFBIG_MIX(w0, w1, rc0); \ + TFBIG_MIX(w2, w3, rc1); \ + TFBIG_MIX(w4, w5, rc2); \ + TFBIG_MIX(w6, w7, rc3); \ + } + +#define TFBIG_4e(s) { \ + TFBIG_ADDKEY(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, s); \ + TFBIG_MIX8(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], 46, 36, 19, 37); \ + TFBIG_MIX8(p[2], p[1], p[4], p[7], p[6], p[5], p[0], p[3], 33, 27, 14, 42); \ + TFBIG_MIX8(p[4], p[1], p[6], p[3], p[0], p[5], p[2], p[7], 17, 49, 36, 39); \ + TFBIG_MIX8(p[6], p[1], p[0], p[7], p[2], p[5], p[4], p[3], 44, 9, 54, 56); \ + } + +#define TFBIG_4o(s) { \ + TFBIG_ADDKEY(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, s); \ + TFBIG_MIX8(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], 39, 30, 34, 24); \ + TFBIG_MIX8(p[2], p[1], p[4], p[7], p[6], p[5], p[0], p[3], 13, 50, 10, 17); \ + TFBIG_MIX8(p[4], p[1], p[6], p[3], p[0], p[5], p[2], p[7], 25, 29, 39, 43); \ + TFBIG_MIX8(p[6], p[1], p[0], p[7], p[2], p[5], p[4], p[3], 8, 35, 56, 22); \ + } + +#define TFBIG_KINIT_UI2(k0, k1, k2, k3, k4, k5, k6, k7, k8, t0, t1, t2) { \ + k8 = ((k0 ^ k1) ^ (k2 ^ k3)) ^ ((k4 ^ k5) ^ (k6 ^ k7)) \ + ^ vectorize(0x1BD11BDAA9FC1A22); \ + t2 = t0 ^ t1; \ + } + +#define TFBIG_ADDKEY_UI2(w0, w1, w2, w3, w4, w5, w6, w7, k, t, s) { \ + w0 = (w0 + SKBI(k, s, 0)); \ + w1 = (w1 + SKBI(k, s, 1)); \ + w2 = (w2 + SKBI(k, s, 2)); \ + w3 = (w3 + SKBI(k, s, 3)); \ + w4 = (w4 + SKBI(k, s, 4)); \ + w5 = (w5 + SKBI(k, s, 5) + SKBT(t, s, 0)); \ + w6 = (w6 + SKBI(k, s, 6) + SKBT(t, s, 1)); \ + w7 = (w7 + SKBI(k, s, 7) + vectorize(s)); \ + } + +#define TFBIG_ADDKEY_PRE(w0, w1, w2, w3, w4, w5, w6, w7, k, t, s) { \ + w0 = (w0 + SKBI(k, s, 0)); \ + w1 = (w1 + SKBI(k, s, 1)); \ + w2 = (w2 + SKBI(k, s, 2)); \ + w3 = (w3 + SKBI(k, s, 3)); \ + w4 = (w4 + SKBI(k, s, 4)); \ + w5 = (w5 + SKBI(k, s, 5) + SKBT(t, s, 0)); \ + w6 = (w6 + SKBI(k, s, 6) + SKBT(t, s, 1)); \ + w7 = (w7 + SKBI(k, s, 7) + (s)); \ + } + +#define TFBIG_MIX_UI2(x0, x1, rc) { \ + x0 = x0 + x1; \ + x1 = ROL2(x1, rc) ^ x0; \ + } + +#define TFBIG_MIX_PRE(x0, x1, rc) { \ + x0 = x0 + x1; \ + x1 = ROTL64(x1, rc) ^ x0; \ + } + +#define TFBIG_MIX8_UI2(w0, w1, w2, w3, w4, w5, w6, w7, rc0, rc1, rc2, rc3) { \ + TFBIG_MIX_UI2(w0, w1, rc0); \ + TFBIG_MIX_UI2(w2, w3, rc1); \ + TFBIG_MIX_UI2(w4, w5, rc2); \ + TFBIG_MIX_UI2(w6, w7, rc3); \ + } + +#define TFBIG_MIX8_PRE(w0, w1, w2, w3, w4, w5, w6, w7, rc0, rc1, rc2, rc3) { \ + TFBIG_MIX_PRE(w0, w1, rc0); \ + TFBIG_MIX_PRE(w2, w3, rc1); \ + TFBIG_MIX_PRE(w4, w5, rc2); \ + TFBIG_MIX_PRE(w6, w7, rc3); \ + } + +#define TFBIG_4e_UI2(s) { \ + TFBIG_ADDKEY_UI2(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, s); \ + TFBIG_MIX8_UI2(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], 46, 36, 19, 37); \ + TFBIG_MIX8_UI2(p[2], p[1], p[4], p[7], p[6], p[5], p[0], p[3], 33, 27, 14, 42); \ + TFBIG_MIX8_UI2(p[4], p[1], p[6], p[3], p[0], p[5], p[2], p[7], 17, 49, 36, 39); \ + TFBIG_MIX8_UI2(p[6], p[1], p[0], p[7], p[2], p[5], p[4], p[3], 44, 9, 54, 56); \ + } + +#define TFBIG_4e_PRE(s) { \ + TFBIG_ADDKEY_PRE(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, s); \ + TFBIG_MIX8_PRE(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], 46, 36, 19, 37); \ + TFBIG_MIX8_PRE(p[2], p[1], p[4], p[7], p[6], p[5], p[0], p[3], 33, 27, 14, 42); \ + TFBIG_MIX8_PRE(p[4], p[1], p[6], p[3], p[0], p[5], p[2], p[7], 17, 49, 36, 39); \ + TFBIG_MIX8_PRE(p[6], p[1], p[0], p[7], p[2], p[5], p[4], p[3], 44, 9, 54, 56); \ + } + +#define TFBIG_4o_UI2(s) { \ + TFBIG_ADDKEY_UI2(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, s); \ + TFBIG_MIX8_UI2(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], 39, 30, 34, 24); \ + TFBIG_MIX8_UI2(p[2], p[1], p[4], p[7], p[6], p[5], p[0], p[3], 13, 50, 10, 17); \ + TFBIG_MIX8_UI2(p[4], p[1], p[6], p[3], p[0], p[5], p[2], p[7], 25, 29, 39, 43); \ + TFBIG_MIX8_UI2(p[6], p[1], p[0], p[7], p[2], p[5], p[4], p[3], 8, 35, 56, 22); \ + } + +#define TFBIG_4o_PRE(s) { \ + TFBIG_ADDKEY_PRE(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], h, t, s); \ + TFBIG_MIX8_PRE(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], 39, 30, 34, 24); \ + TFBIG_MIX8_PRE(p[2], p[1], p[4], p[7], p[6], p[5], p[0], p[3], 13, 50, 10, 17); \ + TFBIG_MIX8_PRE(p[4], p[1], p[6], p[3], p[0], p[5], p[2], p[7], 25, 29, 39, 43); \ + TFBIG_MIX8_PRE(p[6], p[1], p[0], p[7], p[2], p[5], p[4], p[3], 8, 35, 56, 22); \ + } + +#define TFBIGMIX8e(){\ + p[ 0]+=p[ 1];p[ 2]+=p[ 3];p[ 4]+=p[ 5];p[ 6]+=p[ 7];p[ 1]=ROL2(p[ 1],46) ^ p[ 0];p[ 3]=ROL2(p[ 3],36) ^ p[ 2];p[ 5]=ROL2(p[ 5],19) ^ p[ 4];p[ 7]=ROL2(p[ 7],37) ^ p[ 6];\ + p[ 2]+=p[ 1];p[ 4]+=p[ 7];p[ 6]+=p[ 5];p[ 0]+=p[ 3];p[ 1]=ROL2(p[ 1],33) ^ p[ 2];p[ 7]=ROL2(p[ 7],27) ^ p[ 4];p[ 5]=ROL2(p[ 5],14) ^ p[ 6];p[ 3]=ROL2(p[ 3],42) ^ p[ 0];\ + p[ 4]+=p[ 1];p[ 6]+=p[ 3];p[ 0]+=p[ 5];p[ 2]+=p[ 7];p[ 1]=ROL2(p[ 1],17) ^ p[ 4];p[ 3]=ROL2(p[ 3],49) ^ p[ 6];p[ 5]=ROL2(p[ 5],36) ^ p[ 0];p[ 7]=ROL2(p[ 7],39) ^ p[ 2];\ + p[ 6]+=p[ 1];p[ 0]+=p[ 7];p[ 2]+=p[ 5];p[ 4]+=p[ 3];p[ 1]=ROL2(p[ 1],44) ^ p[ 6];p[ 7]=ROL2(p[ 7], 9) ^ p[ 0];p[ 5]=ROL2(p[ 5],54) ^ p[ 2];p[ 3]=ROR8(p[ 3]) ^ p[ 4];\ +} +#define TFBIGMIX8o(){\ + p[ 0]+=p[ 1];p[ 2]+=p[ 3];p[ 4]+=p[ 5];p[ 6]+=p[ 7];p[ 1]=ROL2(p[ 1],39) ^ p[ 0];p[ 3]=ROL2(p[ 3],30) ^ p[ 2];p[ 5]=ROL2(p[ 5],34) ^ p[ 4];p[ 7]=ROL24(p[ 7]) ^ p[ 6];\ + p[ 2]+=p[ 1];p[ 4]+=p[ 7];p[ 6]+=p[ 5];p[ 0]+=p[ 3];p[ 1]=ROL2(p[ 1],13) ^ p[ 2];p[ 7]=ROL2(p[ 7],50) ^ p[ 4];p[ 5]=ROL2(p[ 5],10) ^ p[ 6];p[ 3]=ROL2(p[ 3],17) ^ p[ 0];\ + p[ 4]+=p[ 1];p[ 6]+=p[ 3];p[ 0]+=p[ 5];p[ 2]+=p[ 7];p[ 1]=ROL2(p[ 1],25) ^ p[ 4];p[ 3]=ROL2(p[ 3],29) ^ p[ 6];p[ 5]=ROL2(p[ 5],39) ^ p[ 0];p[ 7]=ROL2(p[ 7],43) ^ p[ 2];\ + p[ 6]+=p[ 1];p[ 0]+=p[ 7];p[ 2]+=p[ 5];p[ 4]+=p[ 3];p[ 1]=ROL8(p[ 1]) ^ p[ 6];p[ 7]=ROL2(p[ 7],35) ^ p[ 0];p[ 5]=ROR8(p[ 5]) ^ p[ 2];p[ 3]=ROL2(p[ 3],22) ^ p[ 4];\ +} + +#define addwBuff(x0,x1,x2,x3,x4){\ + p[ 0]+=h[x0];\ + p[ 1]+=h[x1];\ + p[ 2]+=h[x2];\ + p[ 3]+=h[x3];\ + p[ 4]+=h[x4];\ + p[ 5]+=c_buffer[i++];\ + p[ 7]+=c_buffer[i++];\ + p[ 6]+=c_buffer[i];\ +} + +#define addwCon(x0,x1,x2,x3,x4,x5,x6,x7,y0,y1,y2){\ + p[ 0]+= h[x0];\ + p[ 1]+= h[x1];\ + p[ 2]+= h[x2];\ + p[ 3]+= h[x3];\ + p[ 4]+= h[x4];\ + p[ 5]+= h[x5] + c_t[y0];\ + p[ 6]+= h[x6] + c_t[y1];\ + p[ 7]+= h[x7] + c_add[y2];\ +} diff --git a/sph/aes_helper.c b/sph/aes_helper.c new file mode 100644 index 0000000..75b7cc6 --- /dev/null +++ b/sph/aes_helper.c @@ -0,0 +1,392 @@ +/* $Id: aes_helper.c 220 2010-06-09 09:21:50Z tp $ */ +/* + * AES tables. This file is not meant to be compiled by itself; it + * is included by some hash function implementations. It contains + * the precomputed tables and helper macros for evaluating an AES + * round, optionally with a final XOR with a subkey. + * + * By default, this file defines the tables and macros for little-endian + * processing (i.e. it is assumed that the input bytes have been read + * from memory and assembled with the little-endian convention). If + * the 'AES_BIG_ENDIAN' macro is defined (to a non-zero integer value) + * when this file is included, then the tables and macros for big-endian + * processing are defined instead. The big-endian tables and macros have + * names distinct from the little-endian tables and macros, hence it is + * possible to have both simultaneously, by including this file twice + * (with and without the AES_BIG_ENDIAN macro). + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include "sph_types.h" +#ifdef __cplusplus +extern "C"{ +#endif +#if AES_BIG_ENDIAN + +#define AESx(x) ( ((SPH_C32(x) >> 24) & SPH_C32(0x000000FF)) \ + | ((SPH_C32(x) >> 8) & SPH_C32(0x0000FF00)) \ + | ((SPH_C32(x) << 8) & SPH_C32(0x00FF0000)) \ + | ((SPH_C32(x) << 24) & SPH_C32(0xFF000000))) + +#define AES0 AES0_BE +#define AES1 AES1_BE +#define AES2 AES2_BE +#define AES3 AES3_BE + +#define AES_ROUND_BE(X0, X1, X2, X3, K0, K1, K2, K3, Y0, Y1, Y2, Y3) do { \ + (Y0) = AES0[((X0) >> 24) & 0xFF] \ + ^ AES1[((X1) >> 16) & 0xFF] \ + ^ AES2[((X2) >> 8) & 0xFF] \ + ^ AES3[(X3) & 0xFF] ^ (K0); \ + (Y1) = AES0[((X1) >> 24) & 0xFF] \ + ^ AES1[((X2) >> 16) & 0xFF] \ + ^ AES2[((X3) >> 8) & 0xFF] \ + ^ AES3[(X0) & 0xFF] ^ (K1); \ + (Y2) = AES0[((X2) >> 24) & 0xFF] \ + ^ AES1[((X3) >> 16) & 0xFF] \ + ^ AES2[((X0) >> 8) & 0xFF] \ + ^ AES3[(X1) & 0xFF] ^ (K2); \ + (Y3) = AES0[((X3) >> 24) & 0xFF] \ + ^ AES1[((X0) >> 16) & 0xFF] \ + ^ AES2[((X1) >> 8) & 0xFF] \ + ^ AES3[(X2) & 0xFF] ^ (K3); \ + } while (0) + +#define AES_ROUND_NOKEY_BE(X0, X1, X2, X3, Y0, Y1, Y2, Y3) \ + AES_ROUND_BE(X0, X1, X2, X3, 0, 0, 0, 0, Y0, Y1, Y2, Y3) + +#else + +#define AESx(x) SPH_C32(x) +#define AES0 AES0_LE +#define AES1 AES1_LE +#define AES2 AES2_LE +#define AES3 AES3_LE + +#define AES_ROUND_LE(X0, X1, X2, X3, K0, K1, K2, K3, Y0, Y1, Y2, Y3) do { \ + (Y0) = AES0[(X0) & 0xFF] \ + ^ AES1[((X1) >> 8) & 0xFF] \ + ^ AES2[((X2) >> 16) & 0xFF] \ + ^ AES3[((X3) >> 24) & 0xFF] ^ (K0); \ + (Y1) = AES0[(X1) & 0xFF] \ + ^ AES1[((X2) >> 8) & 0xFF] \ + ^ AES2[((X3) >> 16) & 0xFF] \ + ^ AES3[((X0) >> 24) & 0xFF] ^ (K1); \ + (Y2) = AES0[(X2) & 0xFF] \ + ^ AES1[((X3) >> 8) & 0xFF] \ + ^ AES2[((X0) >> 16) & 0xFF] \ + ^ AES3[((X1) >> 24) & 0xFF] ^ (K2); \ + (Y3) = AES0[(X3) & 0xFF] \ + ^ AES1[((X0) >> 8) & 0xFF] \ + ^ AES2[((X1) >> 16) & 0xFF] \ + ^ AES3[((X2) >> 24) & 0xFF] ^ (K3); \ + } while (0) + +#define AES_ROUND_NOKEY_LE(X0, X1, X2, X3, Y0, Y1, Y2, Y3) \ + AES_ROUND_LE(X0, X1, X2, X3, 0, 0, 0, 0, Y0, Y1, Y2, Y3) + +#endif + +/* + * The AES*[] tables allow us to perform a fast evaluation of an AES + * round; table AESi[] combines SubBytes for a byte at row i, and + * MixColumns for the column where that byte goes after ShiftRows. + */ + +static const sph_u32 AES0[256] = { + AESx(0xA56363C6), AESx(0x847C7CF8), AESx(0x997777EE), AESx(0x8D7B7BF6), + AESx(0x0DF2F2FF), AESx(0xBD6B6BD6), AESx(0xB16F6FDE), AESx(0x54C5C591), + AESx(0x50303060), AESx(0x03010102), AESx(0xA96767CE), AESx(0x7D2B2B56), + AESx(0x19FEFEE7), AESx(0x62D7D7B5), AESx(0xE6ABAB4D), AESx(0x9A7676EC), + AESx(0x45CACA8F), AESx(0x9D82821F), AESx(0x40C9C989), AESx(0x877D7DFA), + AESx(0x15FAFAEF), AESx(0xEB5959B2), AESx(0xC947478E), AESx(0x0BF0F0FB), + AESx(0xECADAD41), AESx(0x67D4D4B3), AESx(0xFDA2A25F), AESx(0xEAAFAF45), + AESx(0xBF9C9C23), AESx(0xF7A4A453), AESx(0x967272E4), AESx(0x5BC0C09B), + AESx(0xC2B7B775), AESx(0x1CFDFDE1), AESx(0xAE93933D), AESx(0x6A26264C), + AESx(0x5A36366C), AESx(0x413F3F7E), AESx(0x02F7F7F5), AESx(0x4FCCCC83), + AESx(0x5C343468), AESx(0xF4A5A551), AESx(0x34E5E5D1), AESx(0x08F1F1F9), + AESx(0x937171E2), AESx(0x73D8D8AB), AESx(0x53313162), AESx(0x3F15152A), + AESx(0x0C040408), AESx(0x52C7C795), AESx(0x65232346), AESx(0x5EC3C39D), + AESx(0x28181830), AESx(0xA1969637), AESx(0x0F05050A), AESx(0xB59A9A2F), + AESx(0x0907070E), AESx(0x36121224), AESx(0x9B80801B), AESx(0x3DE2E2DF), + AESx(0x26EBEBCD), AESx(0x6927274E), AESx(0xCDB2B27F), AESx(0x9F7575EA), + AESx(0x1B090912), AESx(0x9E83831D), AESx(0x742C2C58), AESx(0x2E1A1A34), + AESx(0x2D1B1B36), AESx(0xB26E6EDC), AESx(0xEE5A5AB4), AESx(0xFBA0A05B), + AESx(0xF65252A4), AESx(0x4D3B3B76), AESx(0x61D6D6B7), AESx(0xCEB3B37D), + AESx(0x7B292952), AESx(0x3EE3E3DD), AESx(0x712F2F5E), AESx(0x97848413), + AESx(0xF55353A6), AESx(0x68D1D1B9), AESx(0x00000000), AESx(0x2CEDEDC1), + AESx(0x60202040), AESx(0x1FFCFCE3), AESx(0xC8B1B179), AESx(0xED5B5BB6), + AESx(0xBE6A6AD4), AESx(0x46CBCB8D), AESx(0xD9BEBE67), AESx(0x4B393972), + AESx(0xDE4A4A94), AESx(0xD44C4C98), AESx(0xE85858B0), AESx(0x4ACFCF85), + AESx(0x6BD0D0BB), AESx(0x2AEFEFC5), AESx(0xE5AAAA4F), AESx(0x16FBFBED), + AESx(0xC5434386), AESx(0xD74D4D9A), AESx(0x55333366), AESx(0x94858511), + AESx(0xCF45458A), AESx(0x10F9F9E9), AESx(0x06020204), AESx(0x817F7FFE), + AESx(0xF05050A0), AESx(0x443C3C78), AESx(0xBA9F9F25), AESx(0xE3A8A84B), + AESx(0xF35151A2), AESx(0xFEA3A35D), AESx(0xC0404080), AESx(0x8A8F8F05), + AESx(0xAD92923F), AESx(0xBC9D9D21), AESx(0x48383870), AESx(0x04F5F5F1), + AESx(0xDFBCBC63), AESx(0xC1B6B677), AESx(0x75DADAAF), AESx(0x63212142), + AESx(0x30101020), AESx(0x1AFFFFE5), AESx(0x0EF3F3FD), AESx(0x6DD2D2BF), + AESx(0x4CCDCD81), AESx(0x140C0C18), AESx(0x35131326), AESx(0x2FECECC3), + AESx(0xE15F5FBE), AESx(0xA2979735), AESx(0xCC444488), AESx(0x3917172E), + AESx(0x57C4C493), AESx(0xF2A7A755), AESx(0x827E7EFC), AESx(0x473D3D7A), + AESx(0xAC6464C8), AESx(0xE75D5DBA), AESx(0x2B191932), AESx(0x957373E6), + AESx(0xA06060C0), AESx(0x98818119), AESx(0xD14F4F9E), AESx(0x7FDCDCA3), + AESx(0x66222244), AESx(0x7E2A2A54), AESx(0xAB90903B), AESx(0x8388880B), + AESx(0xCA46468C), AESx(0x29EEEEC7), AESx(0xD3B8B86B), AESx(0x3C141428), + AESx(0x79DEDEA7), AESx(0xE25E5EBC), AESx(0x1D0B0B16), AESx(0x76DBDBAD), + AESx(0x3BE0E0DB), AESx(0x56323264), AESx(0x4E3A3A74), AESx(0x1E0A0A14), + AESx(0xDB494992), AESx(0x0A06060C), AESx(0x6C242448), AESx(0xE45C5CB8), + AESx(0x5DC2C29F), AESx(0x6ED3D3BD), AESx(0xEFACAC43), AESx(0xA66262C4), + AESx(0xA8919139), AESx(0xA4959531), AESx(0x37E4E4D3), AESx(0x8B7979F2), + AESx(0x32E7E7D5), AESx(0x43C8C88B), AESx(0x5937376E), AESx(0xB76D6DDA), + AESx(0x8C8D8D01), AESx(0x64D5D5B1), AESx(0xD24E4E9C), AESx(0xE0A9A949), + AESx(0xB46C6CD8), AESx(0xFA5656AC), AESx(0x07F4F4F3), AESx(0x25EAEACF), + AESx(0xAF6565CA), AESx(0x8E7A7AF4), AESx(0xE9AEAE47), AESx(0x18080810), + AESx(0xD5BABA6F), AESx(0x887878F0), AESx(0x6F25254A), AESx(0x722E2E5C), + AESx(0x241C1C38), AESx(0xF1A6A657), AESx(0xC7B4B473), AESx(0x51C6C697), + AESx(0x23E8E8CB), AESx(0x7CDDDDA1), AESx(0x9C7474E8), AESx(0x211F1F3E), + AESx(0xDD4B4B96), AESx(0xDCBDBD61), AESx(0x868B8B0D), AESx(0x858A8A0F), + AESx(0x907070E0), AESx(0x423E3E7C), AESx(0xC4B5B571), AESx(0xAA6666CC), + AESx(0xD8484890), AESx(0x05030306), AESx(0x01F6F6F7), AESx(0x120E0E1C), + AESx(0xA36161C2), AESx(0x5F35356A), AESx(0xF95757AE), AESx(0xD0B9B969), + AESx(0x91868617), AESx(0x58C1C199), AESx(0x271D1D3A), AESx(0xB99E9E27), + AESx(0x38E1E1D9), AESx(0x13F8F8EB), AESx(0xB398982B), AESx(0x33111122), + AESx(0xBB6969D2), AESx(0x70D9D9A9), AESx(0x898E8E07), AESx(0xA7949433), + AESx(0xB69B9B2D), AESx(0x221E1E3C), AESx(0x92878715), AESx(0x20E9E9C9), + AESx(0x49CECE87), AESx(0xFF5555AA), AESx(0x78282850), AESx(0x7ADFDFA5), + AESx(0x8F8C8C03), AESx(0xF8A1A159), AESx(0x80898909), AESx(0x170D0D1A), + AESx(0xDABFBF65), AESx(0x31E6E6D7), AESx(0xC6424284), AESx(0xB86868D0), + AESx(0xC3414182), AESx(0xB0999929), AESx(0x772D2D5A), AESx(0x110F0F1E), + AESx(0xCBB0B07B), AESx(0xFC5454A8), AESx(0xD6BBBB6D), AESx(0x3A16162C) +}; + +static const sph_u32 AES1[256] = { + AESx(0x6363C6A5), AESx(0x7C7CF884), AESx(0x7777EE99), AESx(0x7B7BF68D), + AESx(0xF2F2FF0D), AESx(0x6B6BD6BD), AESx(0x6F6FDEB1), AESx(0xC5C59154), + AESx(0x30306050), AESx(0x01010203), AESx(0x6767CEA9), AESx(0x2B2B567D), + AESx(0xFEFEE719), AESx(0xD7D7B562), AESx(0xABAB4DE6), AESx(0x7676EC9A), + AESx(0xCACA8F45), AESx(0x82821F9D), AESx(0xC9C98940), AESx(0x7D7DFA87), + AESx(0xFAFAEF15), AESx(0x5959B2EB), AESx(0x47478EC9), AESx(0xF0F0FB0B), + AESx(0xADAD41EC), AESx(0xD4D4B367), AESx(0xA2A25FFD), AESx(0xAFAF45EA), + AESx(0x9C9C23BF), AESx(0xA4A453F7), AESx(0x7272E496), AESx(0xC0C09B5B), + AESx(0xB7B775C2), AESx(0xFDFDE11C), AESx(0x93933DAE), AESx(0x26264C6A), + AESx(0x36366C5A), AESx(0x3F3F7E41), AESx(0xF7F7F502), AESx(0xCCCC834F), + AESx(0x3434685C), AESx(0xA5A551F4), AESx(0xE5E5D134), AESx(0xF1F1F908), + AESx(0x7171E293), AESx(0xD8D8AB73), AESx(0x31316253), AESx(0x15152A3F), + AESx(0x0404080C), AESx(0xC7C79552), AESx(0x23234665), AESx(0xC3C39D5E), + AESx(0x18183028), AESx(0x969637A1), AESx(0x05050A0F), AESx(0x9A9A2FB5), + AESx(0x07070E09), AESx(0x12122436), AESx(0x80801B9B), AESx(0xE2E2DF3D), + AESx(0xEBEBCD26), AESx(0x27274E69), AESx(0xB2B27FCD), AESx(0x7575EA9F), + AESx(0x0909121B), AESx(0x83831D9E), AESx(0x2C2C5874), AESx(0x1A1A342E), + AESx(0x1B1B362D), AESx(0x6E6EDCB2), AESx(0x5A5AB4EE), AESx(0xA0A05BFB), + AESx(0x5252A4F6), AESx(0x3B3B764D), AESx(0xD6D6B761), AESx(0xB3B37DCE), + AESx(0x2929527B), AESx(0xE3E3DD3E), AESx(0x2F2F5E71), AESx(0x84841397), + AESx(0x5353A6F5), AESx(0xD1D1B968), AESx(0x00000000), AESx(0xEDEDC12C), + AESx(0x20204060), AESx(0xFCFCE31F), AESx(0xB1B179C8), AESx(0x5B5BB6ED), + AESx(0x6A6AD4BE), AESx(0xCBCB8D46), AESx(0xBEBE67D9), AESx(0x3939724B), + AESx(0x4A4A94DE), AESx(0x4C4C98D4), AESx(0x5858B0E8), AESx(0xCFCF854A), + AESx(0xD0D0BB6B), AESx(0xEFEFC52A), AESx(0xAAAA4FE5), AESx(0xFBFBED16), + AESx(0x434386C5), AESx(0x4D4D9AD7), AESx(0x33336655), AESx(0x85851194), + AESx(0x45458ACF), AESx(0xF9F9E910), AESx(0x02020406), AESx(0x7F7FFE81), + AESx(0x5050A0F0), AESx(0x3C3C7844), AESx(0x9F9F25BA), AESx(0xA8A84BE3), + AESx(0x5151A2F3), AESx(0xA3A35DFE), AESx(0x404080C0), AESx(0x8F8F058A), + AESx(0x92923FAD), AESx(0x9D9D21BC), AESx(0x38387048), AESx(0xF5F5F104), + AESx(0xBCBC63DF), AESx(0xB6B677C1), AESx(0xDADAAF75), AESx(0x21214263), + AESx(0x10102030), AESx(0xFFFFE51A), AESx(0xF3F3FD0E), AESx(0xD2D2BF6D), + AESx(0xCDCD814C), AESx(0x0C0C1814), AESx(0x13132635), AESx(0xECECC32F), + AESx(0x5F5FBEE1), AESx(0x979735A2), AESx(0x444488CC), AESx(0x17172E39), + AESx(0xC4C49357), AESx(0xA7A755F2), AESx(0x7E7EFC82), AESx(0x3D3D7A47), + AESx(0x6464C8AC), AESx(0x5D5DBAE7), AESx(0x1919322B), AESx(0x7373E695), + AESx(0x6060C0A0), AESx(0x81811998), AESx(0x4F4F9ED1), AESx(0xDCDCA37F), + AESx(0x22224466), AESx(0x2A2A547E), AESx(0x90903BAB), AESx(0x88880B83), + AESx(0x46468CCA), AESx(0xEEEEC729), AESx(0xB8B86BD3), AESx(0x1414283C), + AESx(0xDEDEA779), AESx(0x5E5EBCE2), AESx(0x0B0B161D), AESx(0xDBDBAD76), + AESx(0xE0E0DB3B), AESx(0x32326456), AESx(0x3A3A744E), AESx(0x0A0A141E), + AESx(0x494992DB), AESx(0x06060C0A), AESx(0x2424486C), AESx(0x5C5CB8E4), + AESx(0xC2C29F5D), AESx(0xD3D3BD6E), AESx(0xACAC43EF), AESx(0x6262C4A6), + AESx(0x919139A8), AESx(0x959531A4), AESx(0xE4E4D337), AESx(0x7979F28B), + AESx(0xE7E7D532), AESx(0xC8C88B43), AESx(0x37376E59), AESx(0x6D6DDAB7), + AESx(0x8D8D018C), AESx(0xD5D5B164), AESx(0x4E4E9CD2), AESx(0xA9A949E0), + AESx(0x6C6CD8B4), AESx(0x5656ACFA), AESx(0xF4F4F307), AESx(0xEAEACF25), + AESx(0x6565CAAF), AESx(0x7A7AF48E), AESx(0xAEAE47E9), AESx(0x08081018), + AESx(0xBABA6FD5), AESx(0x7878F088), AESx(0x25254A6F), AESx(0x2E2E5C72), + AESx(0x1C1C3824), AESx(0xA6A657F1), AESx(0xB4B473C7), AESx(0xC6C69751), + AESx(0xE8E8CB23), AESx(0xDDDDA17C), AESx(0x7474E89C), AESx(0x1F1F3E21), + AESx(0x4B4B96DD), AESx(0xBDBD61DC), AESx(0x8B8B0D86), AESx(0x8A8A0F85), + AESx(0x7070E090), AESx(0x3E3E7C42), AESx(0xB5B571C4), AESx(0x6666CCAA), + AESx(0x484890D8), AESx(0x03030605), AESx(0xF6F6F701), AESx(0x0E0E1C12), + AESx(0x6161C2A3), AESx(0x35356A5F), AESx(0x5757AEF9), AESx(0xB9B969D0), + AESx(0x86861791), AESx(0xC1C19958), AESx(0x1D1D3A27), AESx(0x9E9E27B9), + AESx(0xE1E1D938), AESx(0xF8F8EB13), AESx(0x98982BB3), AESx(0x11112233), + AESx(0x6969D2BB), AESx(0xD9D9A970), AESx(0x8E8E0789), AESx(0x949433A7), + AESx(0x9B9B2DB6), AESx(0x1E1E3C22), AESx(0x87871592), AESx(0xE9E9C920), + AESx(0xCECE8749), AESx(0x5555AAFF), AESx(0x28285078), AESx(0xDFDFA57A), + AESx(0x8C8C038F), AESx(0xA1A159F8), AESx(0x89890980), AESx(0x0D0D1A17), + AESx(0xBFBF65DA), AESx(0xE6E6D731), AESx(0x424284C6), AESx(0x6868D0B8), + AESx(0x414182C3), AESx(0x999929B0), AESx(0x2D2D5A77), AESx(0x0F0F1E11), + AESx(0xB0B07BCB), AESx(0x5454A8FC), AESx(0xBBBB6DD6), AESx(0x16162C3A) +}; + +static const sph_u32 AES2[256] = { + AESx(0x63C6A563), AESx(0x7CF8847C), AESx(0x77EE9977), AESx(0x7BF68D7B), + AESx(0xF2FF0DF2), AESx(0x6BD6BD6B), AESx(0x6FDEB16F), AESx(0xC59154C5), + AESx(0x30605030), AESx(0x01020301), AESx(0x67CEA967), AESx(0x2B567D2B), + AESx(0xFEE719FE), AESx(0xD7B562D7), AESx(0xAB4DE6AB), AESx(0x76EC9A76), + AESx(0xCA8F45CA), AESx(0x821F9D82), AESx(0xC98940C9), AESx(0x7DFA877D), + AESx(0xFAEF15FA), AESx(0x59B2EB59), AESx(0x478EC947), AESx(0xF0FB0BF0), + AESx(0xAD41ECAD), AESx(0xD4B367D4), AESx(0xA25FFDA2), AESx(0xAF45EAAF), + AESx(0x9C23BF9C), AESx(0xA453F7A4), AESx(0x72E49672), AESx(0xC09B5BC0), + AESx(0xB775C2B7), AESx(0xFDE11CFD), AESx(0x933DAE93), AESx(0x264C6A26), + AESx(0x366C5A36), AESx(0x3F7E413F), AESx(0xF7F502F7), AESx(0xCC834FCC), + AESx(0x34685C34), AESx(0xA551F4A5), AESx(0xE5D134E5), AESx(0xF1F908F1), + AESx(0x71E29371), AESx(0xD8AB73D8), AESx(0x31625331), AESx(0x152A3F15), + AESx(0x04080C04), AESx(0xC79552C7), AESx(0x23466523), AESx(0xC39D5EC3), + AESx(0x18302818), AESx(0x9637A196), AESx(0x050A0F05), AESx(0x9A2FB59A), + AESx(0x070E0907), AESx(0x12243612), AESx(0x801B9B80), AESx(0xE2DF3DE2), + AESx(0xEBCD26EB), AESx(0x274E6927), AESx(0xB27FCDB2), AESx(0x75EA9F75), + AESx(0x09121B09), AESx(0x831D9E83), AESx(0x2C58742C), AESx(0x1A342E1A), + AESx(0x1B362D1B), AESx(0x6EDCB26E), AESx(0x5AB4EE5A), AESx(0xA05BFBA0), + AESx(0x52A4F652), AESx(0x3B764D3B), AESx(0xD6B761D6), AESx(0xB37DCEB3), + AESx(0x29527B29), AESx(0xE3DD3EE3), AESx(0x2F5E712F), AESx(0x84139784), + AESx(0x53A6F553), AESx(0xD1B968D1), AESx(0x00000000), AESx(0xEDC12CED), + AESx(0x20406020), AESx(0xFCE31FFC), AESx(0xB179C8B1), AESx(0x5BB6ED5B), + AESx(0x6AD4BE6A), AESx(0xCB8D46CB), AESx(0xBE67D9BE), AESx(0x39724B39), + AESx(0x4A94DE4A), AESx(0x4C98D44C), AESx(0x58B0E858), AESx(0xCF854ACF), + AESx(0xD0BB6BD0), AESx(0xEFC52AEF), AESx(0xAA4FE5AA), AESx(0xFBED16FB), + AESx(0x4386C543), AESx(0x4D9AD74D), AESx(0x33665533), AESx(0x85119485), + AESx(0x458ACF45), AESx(0xF9E910F9), AESx(0x02040602), AESx(0x7FFE817F), + AESx(0x50A0F050), AESx(0x3C78443C), AESx(0x9F25BA9F), AESx(0xA84BE3A8), + AESx(0x51A2F351), AESx(0xA35DFEA3), AESx(0x4080C040), AESx(0x8F058A8F), + AESx(0x923FAD92), AESx(0x9D21BC9D), AESx(0x38704838), AESx(0xF5F104F5), + AESx(0xBC63DFBC), AESx(0xB677C1B6), AESx(0xDAAF75DA), AESx(0x21426321), + AESx(0x10203010), AESx(0xFFE51AFF), AESx(0xF3FD0EF3), AESx(0xD2BF6DD2), + AESx(0xCD814CCD), AESx(0x0C18140C), AESx(0x13263513), AESx(0xECC32FEC), + AESx(0x5FBEE15F), AESx(0x9735A297), AESx(0x4488CC44), AESx(0x172E3917), + AESx(0xC49357C4), AESx(0xA755F2A7), AESx(0x7EFC827E), AESx(0x3D7A473D), + AESx(0x64C8AC64), AESx(0x5DBAE75D), AESx(0x19322B19), AESx(0x73E69573), + AESx(0x60C0A060), AESx(0x81199881), AESx(0x4F9ED14F), AESx(0xDCA37FDC), + AESx(0x22446622), AESx(0x2A547E2A), AESx(0x903BAB90), AESx(0x880B8388), + AESx(0x468CCA46), AESx(0xEEC729EE), AESx(0xB86BD3B8), AESx(0x14283C14), + AESx(0xDEA779DE), AESx(0x5EBCE25E), AESx(0x0B161D0B), AESx(0xDBAD76DB), + AESx(0xE0DB3BE0), AESx(0x32645632), AESx(0x3A744E3A), AESx(0x0A141E0A), + AESx(0x4992DB49), AESx(0x060C0A06), AESx(0x24486C24), AESx(0x5CB8E45C), + AESx(0xC29F5DC2), AESx(0xD3BD6ED3), AESx(0xAC43EFAC), AESx(0x62C4A662), + AESx(0x9139A891), AESx(0x9531A495), AESx(0xE4D337E4), AESx(0x79F28B79), + AESx(0xE7D532E7), AESx(0xC88B43C8), AESx(0x376E5937), AESx(0x6DDAB76D), + AESx(0x8D018C8D), AESx(0xD5B164D5), AESx(0x4E9CD24E), AESx(0xA949E0A9), + AESx(0x6CD8B46C), AESx(0x56ACFA56), AESx(0xF4F307F4), AESx(0xEACF25EA), + AESx(0x65CAAF65), AESx(0x7AF48E7A), AESx(0xAE47E9AE), AESx(0x08101808), + AESx(0xBA6FD5BA), AESx(0x78F08878), AESx(0x254A6F25), AESx(0x2E5C722E), + AESx(0x1C38241C), AESx(0xA657F1A6), AESx(0xB473C7B4), AESx(0xC69751C6), + AESx(0xE8CB23E8), AESx(0xDDA17CDD), AESx(0x74E89C74), AESx(0x1F3E211F), + AESx(0x4B96DD4B), AESx(0xBD61DCBD), AESx(0x8B0D868B), AESx(0x8A0F858A), + AESx(0x70E09070), AESx(0x3E7C423E), AESx(0xB571C4B5), AESx(0x66CCAA66), + AESx(0x4890D848), AESx(0x03060503), AESx(0xF6F701F6), AESx(0x0E1C120E), + AESx(0x61C2A361), AESx(0x356A5F35), AESx(0x57AEF957), AESx(0xB969D0B9), + AESx(0x86179186), AESx(0xC19958C1), AESx(0x1D3A271D), AESx(0x9E27B99E), + AESx(0xE1D938E1), AESx(0xF8EB13F8), AESx(0x982BB398), AESx(0x11223311), + AESx(0x69D2BB69), AESx(0xD9A970D9), AESx(0x8E07898E), AESx(0x9433A794), + AESx(0x9B2DB69B), AESx(0x1E3C221E), AESx(0x87159287), AESx(0xE9C920E9), + AESx(0xCE8749CE), AESx(0x55AAFF55), AESx(0x28507828), AESx(0xDFA57ADF), + AESx(0x8C038F8C), AESx(0xA159F8A1), AESx(0x89098089), AESx(0x0D1A170D), + AESx(0xBF65DABF), AESx(0xE6D731E6), AESx(0x4284C642), AESx(0x68D0B868), + AESx(0x4182C341), AESx(0x9929B099), AESx(0x2D5A772D), AESx(0x0F1E110F), + AESx(0xB07BCBB0), AESx(0x54A8FC54), AESx(0xBB6DD6BB), AESx(0x162C3A16) +}; + +static const sph_u32 AES3[256] = { + AESx(0xC6A56363), AESx(0xF8847C7C), AESx(0xEE997777), AESx(0xF68D7B7B), + AESx(0xFF0DF2F2), AESx(0xD6BD6B6B), AESx(0xDEB16F6F), AESx(0x9154C5C5), + AESx(0x60503030), AESx(0x02030101), AESx(0xCEA96767), AESx(0x567D2B2B), + AESx(0xE719FEFE), AESx(0xB562D7D7), AESx(0x4DE6ABAB), AESx(0xEC9A7676), + AESx(0x8F45CACA), AESx(0x1F9D8282), AESx(0x8940C9C9), AESx(0xFA877D7D), + AESx(0xEF15FAFA), AESx(0xB2EB5959), AESx(0x8EC94747), AESx(0xFB0BF0F0), + AESx(0x41ECADAD), AESx(0xB367D4D4), AESx(0x5FFDA2A2), AESx(0x45EAAFAF), + AESx(0x23BF9C9C), AESx(0x53F7A4A4), AESx(0xE4967272), AESx(0x9B5BC0C0), + AESx(0x75C2B7B7), AESx(0xE11CFDFD), AESx(0x3DAE9393), AESx(0x4C6A2626), + AESx(0x6C5A3636), AESx(0x7E413F3F), AESx(0xF502F7F7), AESx(0x834FCCCC), + AESx(0x685C3434), AESx(0x51F4A5A5), AESx(0xD134E5E5), AESx(0xF908F1F1), + AESx(0xE2937171), AESx(0xAB73D8D8), AESx(0x62533131), AESx(0x2A3F1515), + AESx(0x080C0404), AESx(0x9552C7C7), AESx(0x46652323), AESx(0x9D5EC3C3), + AESx(0x30281818), AESx(0x37A19696), AESx(0x0A0F0505), AESx(0x2FB59A9A), + AESx(0x0E090707), AESx(0x24361212), AESx(0x1B9B8080), AESx(0xDF3DE2E2), + AESx(0xCD26EBEB), AESx(0x4E692727), AESx(0x7FCDB2B2), AESx(0xEA9F7575), + AESx(0x121B0909), AESx(0x1D9E8383), AESx(0x58742C2C), AESx(0x342E1A1A), + AESx(0x362D1B1B), AESx(0xDCB26E6E), AESx(0xB4EE5A5A), AESx(0x5BFBA0A0), + AESx(0xA4F65252), AESx(0x764D3B3B), AESx(0xB761D6D6), AESx(0x7DCEB3B3), + AESx(0x527B2929), AESx(0xDD3EE3E3), AESx(0x5E712F2F), AESx(0x13978484), + AESx(0xA6F55353), AESx(0xB968D1D1), AESx(0x00000000), AESx(0xC12CEDED), + AESx(0x40602020), AESx(0xE31FFCFC), AESx(0x79C8B1B1), AESx(0xB6ED5B5B), + AESx(0xD4BE6A6A), AESx(0x8D46CBCB), AESx(0x67D9BEBE), AESx(0x724B3939), + AESx(0x94DE4A4A), AESx(0x98D44C4C), AESx(0xB0E85858), AESx(0x854ACFCF), + AESx(0xBB6BD0D0), AESx(0xC52AEFEF), AESx(0x4FE5AAAA), AESx(0xED16FBFB), + AESx(0x86C54343), AESx(0x9AD74D4D), AESx(0x66553333), AESx(0x11948585), + AESx(0x8ACF4545), AESx(0xE910F9F9), AESx(0x04060202), AESx(0xFE817F7F), + AESx(0xA0F05050), AESx(0x78443C3C), AESx(0x25BA9F9F), AESx(0x4BE3A8A8), + AESx(0xA2F35151), AESx(0x5DFEA3A3), AESx(0x80C04040), AESx(0x058A8F8F), + AESx(0x3FAD9292), AESx(0x21BC9D9D), AESx(0x70483838), AESx(0xF104F5F5), + AESx(0x63DFBCBC), AESx(0x77C1B6B6), AESx(0xAF75DADA), AESx(0x42632121), + AESx(0x20301010), AESx(0xE51AFFFF), AESx(0xFD0EF3F3), AESx(0xBF6DD2D2), + AESx(0x814CCDCD), AESx(0x18140C0C), AESx(0x26351313), AESx(0xC32FECEC), + AESx(0xBEE15F5F), AESx(0x35A29797), AESx(0x88CC4444), AESx(0x2E391717), + AESx(0x9357C4C4), AESx(0x55F2A7A7), AESx(0xFC827E7E), AESx(0x7A473D3D), + AESx(0xC8AC6464), AESx(0xBAE75D5D), AESx(0x322B1919), AESx(0xE6957373), + AESx(0xC0A06060), AESx(0x19988181), AESx(0x9ED14F4F), AESx(0xA37FDCDC), + AESx(0x44662222), AESx(0x547E2A2A), AESx(0x3BAB9090), AESx(0x0B838888), + AESx(0x8CCA4646), AESx(0xC729EEEE), AESx(0x6BD3B8B8), AESx(0x283C1414), + AESx(0xA779DEDE), AESx(0xBCE25E5E), AESx(0x161D0B0B), AESx(0xAD76DBDB), + AESx(0xDB3BE0E0), AESx(0x64563232), AESx(0x744E3A3A), AESx(0x141E0A0A), + AESx(0x92DB4949), AESx(0x0C0A0606), AESx(0x486C2424), AESx(0xB8E45C5C), + AESx(0x9F5DC2C2), AESx(0xBD6ED3D3), AESx(0x43EFACAC), AESx(0xC4A66262), + AESx(0x39A89191), AESx(0x31A49595), AESx(0xD337E4E4), AESx(0xF28B7979), + AESx(0xD532E7E7), AESx(0x8B43C8C8), AESx(0x6E593737), AESx(0xDAB76D6D), + AESx(0x018C8D8D), AESx(0xB164D5D5), AESx(0x9CD24E4E), AESx(0x49E0A9A9), + AESx(0xD8B46C6C), AESx(0xACFA5656), AESx(0xF307F4F4), AESx(0xCF25EAEA), + AESx(0xCAAF6565), AESx(0xF48E7A7A), AESx(0x47E9AEAE), AESx(0x10180808), + AESx(0x6FD5BABA), AESx(0xF0887878), AESx(0x4A6F2525), AESx(0x5C722E2E), + AESx(0x38241C1C), AESx(0x57F1A6A6), AESx(0x73C7B4B4), AESx(0x9751C6C6), + AESx(0xCB23E8E8), AESx(0xA17CDDDD), AESx(0xE89C7474), AESx(0x3E211F1F), + AESx(0x96DD4B4B), AESx(0x61DCBDBD), AESx(0x0D868B8B), AESx(0x0F858A8A), + AESx(0xE0907070), AESx(0x7C423E3E), AESx(0x71C4B5B5), AESx(0xCCAA6666), + AESx(0x90D84848), AESx(0x06050303), AESx(0xF701F6F6), AESx(0x1C120E0E), + AESx(0xC2A36161), AESx(0x6A5F3535), AESx(0xAEF95757), AESx(0x69D0B9B9), + AESx(0x17918686), AESx(0x9958C1C1), AESx(0x3A271D1D), AESx(0x27B99E9E), + AESx(0xD938E1E1), AESx(0xEB13F8F8), AESx(0x2BB39898), AESx(0x22331111), + AESx(0xD2BB6969), AESx(0xA970D9D9), AESx(0x07898E8E), AESx(0x33A79494), + AESx(0x2DB69B9B), AESx(0x3C221E1E), AESx(0x15928787), AESx(0xC920E9E9), + AESx(0x8749CECE), AESx(0xAAFF5555), AESx(0x50782828), AESx(0xA57ADFDF), + AESx(0x038F8C8C), AESx(0x59F8A1A1), AESx(0x09808989), AESx(0x1A170D0D), + AESx(0x65DABFBF), AESx(0xD731E6E6), AESx(0x84C64242), AESx(0xD0B86868), + AESx(0x82C34141), AESx(0x29B09999), AESx(0x5A772D2D), AESx(0x1E110F0F), + AESx(0x7BCBB0B0), AESx(0xA8FC5454), AESx(0x6DD6BBBB), AESx(0x2C3A1616) +}; + +#ifdef __cplusplus +} +#endif diff --git a/sph/blake.c b/sph/blake.c new file mode 100644 index 0000000..5863cf5 --- /dev/null +++ b/sph/blake.c @@ -0,0 +1,1131 @@ +/* $Id: blake.c 252 2011-06-07 17:55:14Z tp $ */ +/* + * BLAKE implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include +#include + +#include "sph_blake.h" + +int blake256_rounds = 14; + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_BLAKE +#define SPH_SMALL_FOOTPRINT_BLAKE 1 +#endif + +#if SPH_SMALL_FOOTPRINT_BLAKE +#define SPH_COMPACT_BLAKE_32 1 +#endif + +#if SPH_64 && (SPH_SMALL_FOOTPRINT_BLAKE || !SPH_64_TRUE) +#define SPH_COMPACT_BLAKE_64 1 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +static const sph_u32 IV224[8] = { + SPH_C32(0xC1059ED8), SPH_C32(0x367CD507), + SPH_C32(0x3070DD17), SPH_C32(0xF70E5939), + SPH_C32(0xFFC00B31), SPH_C32(0x68581511), + SPH_C32(0x64F98FA7), SPH_C32(0xBEFA4FA4) +}; + +static const sph_u32 IV256[8] = { + SPH_C32(0x6A09E667), SPH_C32(0xBB67AE85), + SPH_C32(0x3C6EF372), SPH_C32(0xA54FF53A), + SPH_C32(0x510E527F), SPH_C32(0x9B05688C), + SPH_C32(0x1F83D9AB), SPH_C32(0x5BE0CD19) +}; + +#if SPH_64 + +static const sph_u64 IV384[8] = { + SPH_C64(0xCBBB9D5DC1059ED8), SPH_C64(0x629A292A367CD507), + SPH_C64(0x9159015A3070DD17), SPH_C64(0x152FECD8F70E5939), + SPH_C64(0x67332667FFC00B31), SPH_C64(0x8EB44A8768581511), + SPH_C64(0xDB0C2E0D64F98FA7), SPH_C64(0x47B5481DBEFA4FA4) +}; + +static const sph_u64 IV512[8] = { + SPH_C64(0x6A09E667F3BCC908), SPH_C64(0xBB67AE8584CAA73B), + SPH_C64(0x3C6EF372FE94F82B), SPH_C64(0xA54FF53A5F1D36F1), + SPH_C64(0x510E527FADE682D1), SPH_C64(0x9B05688C2B3E6C1F), + SPH_C64(0x1F83D9ABFB41BD6B), SPH_C64(0x5BE0CD19137E2179) +}; + +#endif + +#if SPH_COMPACT_BLAKE_32 || SPH_COMPACT_BLAKE_64 + +static const unsigned sigma[16][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }, + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 }, + { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 }, + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 }, + { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } +}; + +/* + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + 14 10 4 8 9 15 13 6 1 12 0 2 11 7 5 3 + 11 8 12 0 5 2 15 13 10 14 3 6 7 1 9 4 + 7 9 3 1 13 12 11 14 2 6 5 10 4 0 15 8 + 9 0 5 7 2 4 10 15 14 1 11 12 6 8 3 13 + 2 12 6 10 0 11 8 3 4 13 7 5 15 14 1 9 + 12 5 1 15 14 13 4 10 0 7 6 3 9 2 8 11 + 13 11 7 14 12 1 3 9 5 0 15 4 8 6 2 10 + 6 15 14 9 11 3 0 8 12 2 13 7 1 4 10 5 + 10 2 8 4 7 6 1 5 15 11 9 14 3 12 13 0 +*/ +#endif + +#define Z00 0 +#define Z01 1 +#define Z02 2 +#define Z03 3 +#define Z04 4 +#define Z05 5 +#define Z06 6 +#define Z07 7 +#define Z08 8 +#define Z09 9 +#define Z0A A +#define Z0B B +#define Z0C C +#define Z0D D +#define Z0E E +#define Z0F F + +#define Z10 E +#define Z11 A +#define Z12 4 +#define Z13 8 +#define Z14 9 +#define Z15 F +#define Z16 D +#define Z17 6 +#define Z18 1 +#define Z19 C +#define Z1A 0 +#define Z1B 2 +#define Z1C B +#define Z1D 7 +#define Z1E 5 +#define Z1F 3 + +#define Z20 B +#define Z21 8 +#define Z22 C +#define Z23 0 +#define Z24 5 +#define Z25 2 +#define Z26 F +#define Z27 D +#define Z28 A +#define Z29 E +#define Z2A 3 +#define Z2B 6 +#define Z2C 7 +#define Z2D 1 +#define Z2E 9 +#define Z2F 4 + +#define Z30 7 +#define Z31 9 +#define Z32 3 +#define Z33 1 +#define Z34 D +#define Z35 C +#define Z36 B +#define Z37 E +#define Z38 2 +#define Z39 6 +#define Z3A 5 +#define Z3B A +#define Z3C 4 +#define Z3D 0 +#define Z3E F +#define Z3F 8 + +#define Z40 9 +#define Z41 0 +#define Z42 5 +#define Z43 7 +#define Z44 2 +#define Z45 4 +#define Z46 A +#define Z47 F +#define Z48 E +#define Z49 1 +#define Z4A B +#define Z4B C +#define Z4C 6 +#define Z4D 8 +#define Z4E 3 +#define Z4F D + +#define Z50 2 +#define Z51 C +#define Z52 6 +#define Z53 A +#define Z54 0 +#define Z55 B +#define Z56 8 +#define Z57 3 +#define Z58 4 +#define Z59 D +#define Z5A 7 +#define Z5B 5 +#define Z5C F +#define Z5D E +#define Z5E 1 +#define Z5F 9 + +#define Z60 C +#define Z61 5 +#define Z62 1 +#define Z63 F +#define Z64 E +#define Z65 D +#define Z66 4 +#define Z67 A +#define Z68 0 +#define Z69 7 +#define Z6A 6 +#define Z6B 3 +#define Z6C 9 +#define Z6D 2 +#define Z6E 8 +#define Z6F B + +#define Z70 D +#define Z71 B +#define Z72 7 +#define Z73 E +#define Z74 C +#define Z75 1 +#define Z76 3 +#define Z77 9 +#define Z78 5 +#define Z79 0 +#define Z7A F +#define Z7B 4 +#define Z7C 8 +#define Z7D 6 +#define Z7E 2 +#define Z7F A + +#define Z80 6 +#define Z81 F +#define Z82 E +#define Z83 9 +#define Z84 B +#define Z85 3 +#define Z86 0 +#define Z87 8 +#define Z88 C +#define Z89 2 +#define Z8A D +#define Z8B 7 +#define Z8C 1 +#define Z8D 4 +#define Z8E A +#define Z8F 5 + +#define Z90 A +#define Z91 2 +#define Z92 8 +#define Z93 4 +#define Z94 7 +#define Z95 6 +#define Z96 1 +#define Z97 5 +#define Z98 F +#define Z99 B +#define Z9A 9 +#define Z9B E +#define Z9C 3 +#define Z9D C +#define Z9E D +#define Z9F 0 + +#define Mx(r, i) Mx_(Z ## r ## i) +#define Mx_(n) Mx__(n) +#define Mx__(n) M ## n + +#define CSx(r, i) CSx_(Z ## r ## i) +#define CSx_(n) CSx__(n) +#define CSx__(n) CS ## n + +#define CS0 SPH_C32(0x243F6A88) +#define CS1 SPH_C32(0x85A308D3) +#define CS2 SPH_C32(0x13198A2E) +#define CS3 SPH_C32(0x03707344) +#define CS4 SPH_C32(0xA4093822) +#define CS5 SPH_C32(0x299F31D0) +#define CS6 SPH_C32(0x082EFA98) +#define CS7 SPH_C32(0xEC4E6C89) +#define CS8 SPH_C32(0x452821E6) +#define CS9 SPH_C32(0x38D01377) +#define CSA SPH_C32(0xBE5466CF) +#define CSB SPH_C32(0x34E90C6C) +#define CSC SPH_C32(0xC0AC29B7) +#define CSD SPH_C32(0xC97C50DD) +#define CSE SPH_C32(0x3F84D5B5) +#define CSF SPH_C32(0xB5470917) + +#if SPH_COMPACT_BLAKE_32 + +static const sph_u32 CS[16] = { + SPH_C32(0x243F6A88), SPH_C32(0x85A308D3), + SPH_C32(0x13198A2E), SPH_C32(0x03707344), + SPH_C32(0xA4093822), SPH_C32(0x299F31D0), + SPH_C32(0x082EFA98), SPH_C32(0xEC4E6C89), + SPH_C32(0x452821E6), SPH_C32(0x38D01377), + SPH_C32(0xBE5466CF), SPH_C32(0x34E90C6C), + SPH_C32(0xC0AC29B7), SPH_C32(0xC97C50DD), + SPH_C32(0x3F84D5B5), SPH_C32(0xB5470917) +}; + +#endif + +#if SPH_64 + +#define CBx(r, i) CBx_(Z ## r ## i) +#define CBx_(n) CBx__(n) +#define CBx__(n) CB ## n + +#define CB0 SPH_C64(0x243F6A8885A308D3) +#define CB1 SPH_C64(0x13198A2E03707344) +#define CB2 SPH_C64(0xA4093822299F31D0) +#define CB3 SPH_C64(0x082EFA98EC4E6C89) +#define CB4 SPH_C64(0x452821E638D01377) +#define CB5 SPH_C64(0xBE5466CF34E90C6C) +#define CB6 SPH_C64(0xC0AC29B7C97C50DD) +#define CB7 SPH_C64(0x3F84D5B5B5470917) +#define CB8 SPH_C64(0x9216D5D98979FB1B) +#define CB9 SPH_C64(0xD1310BA698DFB5AC) +#define CBA SPH_C64(0x2FFD72DBD01ADFB7) +#define CBB SPH_C64(0xB8E1AFED6A267E96) +#define CBC SPH_C64(0xBA7C9045F12C7F99) +#define CBD SPH_C64(0x24A19947B3916CF7) +#define CBE SPH_C64(0x0801F2E2858EFC16) +#define CBF SPH_C64(0x636920D871574E69) + +#if SPH_COMPACT_BLAKE_64 + +static const sph_u64 CB[16] = { + SPH_C64(0x243F6A8885A308D3), SPH_C64(0x13198A2E03707344), + SPH_C64(0xA4093822299F31D0), SPH_C64(0x082EFA98EC4E6C89), + SPH_C64(0x452821E638D01377), SPH_C64(0xBE5466CF34E90C6C), + SPH_C64(0xC0AC29B7C97C50DD), SPH_C64(0x3F84D5B5B5470917), + SPH_C64(0x9216D5D98979FB1B), SPH_C64(0xD1310BA698DFB5AC), + SPH_C64(0x2FFD72DBD01ADFB7), SPH_C64(0xB8E1AFED6A267E96), + SPH_C64(0xBA7C9045F12C7F99), SPH_C64(0x24A19947B3916CF7), + SPH_C64(0x0801F2E2858EFC16), SPH_C64(0x636920D871574E69) +}; + +#endif + +#endif + +#define GS(m0, m1, c0, c1, a, b, c, d) do { \ + a = SPH_T32(a + b + (m0 ^ c1)); \ + d = SPH_ROTR32(d ^ a, 16); \ + c = SPH_T32(c + d); \ + b = SPH_ROTR32(b ^ c, 12); \ + a = SPH_T32(a + b + (m1 ^ c0)); \ + d = SPH_ROTR32(d ^ a, 8); \ + c = SPH_T32(c + d); \ + b = SPH_ROTR32(b ^ c, 7); \ + } while (0) + +#if SPH_COMPACT_BLAKE_32 + +#define ROUND_S(r) do { \ + GS(M[sigma[r][0x0]], M[sigma[r][0x1]], \ + CS[sigma[r][0x0]], CS[sigma[r][0x1]], V0, V4, V8, VC); \ + GS(M[sigma[r][0x2]], M[sigma[r][0x3]], \ + CS[sigma[r][0x2]], CS[sigma[r][0x3]], V1, V5, V9, VD); \ + GS(M[sigma[r][0x4]], M[sigma[r][0x5]], \ + CS[sigma[r][0x4]], CS[sigma[r][0x5]], V2, V6, VA, VE); \ + GS(M[sigma[r][0x6]], M[sigma[r][0x7]], \ + CS[sigma[r][0x6]], CS[sigma[r][0x7]], V3, V7, VB, VF); \ + GS(M[sigma[r][0x8]], M[sigma[r][0x9]], \ + CS[sigma[r][0x8]], CS[sigma[r][0x9]], V0, V5, VA, VF); \ + GS(M[sigma[r][0xA]], M[sigma[r][0xB]], \ + CS[sigma[r][0xA]], CS[sigma[r][0xB]], V1, V6, VB, VC); \ + GS(M[sigma[r][0xC]], M[sigma[r][0xD]], \ + CS[sigma[r][0xC]], CS[sigma[r][0xD]], V2, V7, V8, VD); \ + GS(M[sigma[r][0xE]], M[sigma[r][0xF]], \ + CS[sigma[r][0xE]], CS[sigma[r][0xF]], V3, V4, V9, VE); \ + } while (0) + +#else + +#define ROUND_S(r) do { \ + GS(Mx(r, 0), Mx(r, 1), CSx(r, 0), CSx(r, 1), V0, V4, V8, VC); \ + GS(Mx(r, 2), Mx(r, 3), CSx(r, 2), CSx(r, 3), V1, V5, V9, VD); \ + GS(Mx(r, 4), Mx(r, 5), CSx(r, 4), CSx(r, 5), V2, V6, VA, VE); \ + GS(Mx(r, 6), Mx(r, 7), CSx(r, 6), CSx(r, 7), V3, V7, VB, VF); \ + GS(Mx(r, 8), Mx(r, 9), CSx(r, 8), CSx(r, 9), V0, V5, VA, VF); \ + GS(Mx(r, A), Mx(r, B), CSx(r, A), CSx(r, B), V1, V6, VB, VC); \ + GS(Mx(r, C), Mx(r, D), CSx(r, C), CSx(r, D), V2, V7, V8, VD); \ + GS(Mx(r, E), Mx(r, F), CSx(r, E), CSx(r, F), V3, V4, V9, VE); \ + } while (0) + +#endif + +#if SPH_64 + +#define GB(m0, m1, c0, c1, a, b, c, d) do { \ + a = SPH_T64(a + b + (m0 ^ c1)); \ + d = SPH_ROTR64(d ^ a, 32); \ + c = SPH_T64(c + d); \ + b = SPH_ROTR64(b ^ c, 25); \ + a = SPH_T64(a + b + (m1 ^ c0)); \ + d = SPH_ROTR64(d ^ a, 16); \ + c = SPH_T64(c + d); \ + b = SPH_ROTR64(b ^ c, 11); \ + } while (0) + +#if SPH_COMPACT_BLAKE_64 + +#define ROUND_B(r) do { \ + GB(M[sigma[r][0x0]], M[sigma[r][0x1]], \ + CB[sigma[r][0x0]], CB[sigma[r][0x1]], V0, V4, V8, VC); \ + GB(M[sigma[r][0x2]], M[sigma[r][0x3]], \ + CB[sigma[r][0x2]], CB[sigma[r][0x3]], V1, V5, V9, VD); \ + GB(M[sigma[r][0x4]], M[sigma[r][0x5]], \ + CB[sigma[r][0x4]], CB[sigma[r][0x5]], V2, V6, VA, VE); \ + GB(M[sigma[r][0x6]], M[sigma[r][0x7]], \ + CB[sigma[r][0x6]], CB[sigma[r][0x7]], V3, V7, VB, VF); \ + GB(M[sigma[r][0x8]], M[sigma[r][0x9]], \ + CB[sigma[r][0x8]], CB[sigma[r][0x9]], V0, V5, VA, VF); \ + GB(M[sigma[r][0xA]], M[sigma[r][0xB]], \ + CB[sigma[r][0xA]], CB[sigma[r][0xB]], V1, V6, VB, VC); \ + GB(M[sigma[r][0xC]], M[sigma[r][0xD]], \ + CB[sigma[r][0xC]], CB[sigma[r][0xD]], V2, V7, V8, VD); \ + GB(M[sigma[r][0xE]], M[sigma[r][0xF]], \ + CB[sigma[r][0xE]], CB[sigma[r][0xF]], V3, V4, V9, VE); \ + } while (0) + +#else + +#define ROUND_B(r) do { \ + GB(Mx(r, 0), Mx(r, 1), CBx(r, 0), CBx(r, 1), V0, V4, V8, VC); \ + GB(Mx(r, 2), Mx(r, 3), CBx(r, 2), CBx(r, 3), V1, V5, V9, VD); \ + GB(Mx(r, 4), Mx(r, 5), CBx(r, 4), CBx(r, 5), V2, V6, VA, VE); \ + GB(Mx(r, 6), Mx(r, 7), CBx(r, 6), CBx(r, 7), V3, V7, VB, VF); \ + GB(Mx(r, 8), Mx(r, 9), CBx(r, 8), CBx(r, 9), V0, V5, VA, VF); \ + GB(Mx(r, A), Mx(r, B), CBx(r, A), CBx(r, B), V1, V6, VB, VC); \ + GB(Mx(r, C), Mx(r, D), CBx(r, C), CBx(r, D), V2, V7, V8, VD); \ + GB(Mx(r, E), Mx(r, F), CBx(r, E), CBx(r, F), V3, V4, V9, VE); \ + } while (0) + +#endif + +#endif + +#define DECL_STATE32 \ + sph_u32 H0, H1, H2, H3, H4, H5, H6, H7; \ + sph_u32 S0, S1, S2, S3, T0, T1; + +#define READ_STATE32(state) do { \ + H0 = (state)->H[0]; \ + H1 = (state)->H[1]; \ + H2 = (state)->H[2]; \ + H3 = (state)->H[3]; \ + H4 = (state)->H[4]; \ + H5 = (state)->H[5]; \ + H6 = (state)->H[6]; \ + H7 = (state)->H[7]; \ + S0 = (state)->S[0]; \ + S1 = (state)->S[1]; \ + S2 = (state)->S[2]; \ + S3 = (state)->S[3]; \ + T0 = (state)->T0; \ + T1 = (state)->T1; \ + } while (0) + +#define WRITE_STATE32(state) do { \ + (state)->H[0] = H0; \ + (state)->H[1] = H1; \ + (state)->H[2] = H2; \ + (state)->H[3] = H3; \ + (state)->H[4] = H4; \ + (state)->H[5] = H5; \ + (state)->H[6] = H6; \ + (state)->H[7] = H7; \ + (state)->S[0] = S0; \ + (state)->S[1] = S1; \ + (state)->S[2] = S2; \ + (state)->S[3] = S3; \ + (state)->T0 = T0; \ + (state)->T1 = T1; \ + } while (0) + +#if SPH_COMPACT_BLAKE_32 + +#define COMPRESS32 do { \ + sph_u32 M[16]; \ + sph_u32 V0, V1, V2, V3, V4, V5, V6, V7; \ + sph_u32 V8, V9, VA, VB, VC, VD, VE, VF; \ + unsigned r; \ + V0 = H0; \ + V1 = H1; \ + V2 = H2; \ + V3 = H3; \ + V4 = H4; \ + V5 = H5; \ + V6 = H6; \ + V7 = H7; \ + V8 = S0 ^ CS0; \ + V9 = S1 ^ CS1; \ + VA = S2 ^ CS2; \ + VB = S3 ^ CS3; \ + VC = T0 ^ CS4; \ + VD = T0 ^ CS5; \ + VE = T1 ^ CS6; \ + VF = T1 ^ CS7; \ + M[0x0] = sph_dec32be_aligned(buf + 0); \ + M[0x1] = sph_dec32be_aligned(buf + 4); \ + M[0x2] = sph_dec32be_aligned(buf + 8); \ + M[0x3] = sph_dec32be_aligned(buf + 12); \ + M[0x4] = sph_dec32be_aligned(buf + 16); \ + M[0x5] = sph_dec32be_aligned(buf + 20); \ + M[0x6] = sph_dec32be_aligned(buf + 24); \ + M[0x7] = sph_dec32be_aligned(buf + 28); \ + M[0x8] = sph_dec32be_aligned(buf + 32); \ + M[0x9] = sph_dec32be_aligned(buf + 36); \ + M[0xA] = sph_dec32be_aligned(buf + 40); \ + M[0xB] = sph_dec32be_aligned(buf + 44); \ + M[0xC] = sph_dec32be_aligned(buf + 48); \ + M[0xD] = sph_dec32be_aligned(buf + 52); \ + M[0xE] = sph_dec32be_aligned(buf + 56); \ + M[0xF] = sph_dec32be_aligned(buf + 60); \ + for (r = 0; r < blake256_rounds; r ++) \ + ROUND_S(r); \ + H0 ^= S0 ^ V0 ^ V8; \ + H1 ^= S1 ^ V1 ^ V9; \ + H2 ^= S2 ^ V2 ^ VA; \ + H3 ^= S3 ^ V3 ^ VB; \ + H4 ^= S0 ^ V4 ^ VC; \ + H5 ^= S1 ^ V5 ^ VD; \ + H6 ^= S2 ^ V6 ^ VE; \ + H7 ^= S3 ^ V7 ^ VF; \ + } while (0) + +#else + +#define COMPRESS32 do { \ + sph_u32 M0, M1, M2, M3, M4, M5, M6, M7; \ + sph_u32 M8, M9, MA, MB, MC, MD, ME, MF; \ + sph_u32 V0, V1, V2, V3, V4, V5, V6, V7; \ + sph_u32 V8, V9, VA, VB, VC, VD, VE, VF; \ + V0 = H0; \ + V1 = H1; \ + V2 = H2; \ + V3 = H3; \ + V4 = H4; \ + V5 = H5; \ + V6 = H6; \ + V7 = H7; \ + V8 = S0 ^ CS0; \ + V9 = S1 ^ CS1; \ + VA = S2 ^ CS2; \ + VB = S3 ^ CS3; \ + VC = T0 ^ CS4; \ + VD = T0 ^ CS5; \ + VE = T1 ^ CS6; \ + VF = T1 ^ CS7; \ + M0 = sph_dec32be_aligned(buf + 0); \ + M1 = sph_dec32be_aligned(buf + 4); \ + M2 = sph_dec32be_aligned(buf + 8); \ + M3 = sph_dec32be_aligned(buf + 12); \ + M4 = sph_dec32be_aligned(buf + 16); \ + M5 = sph_dec32be_aligned(buf + 20); \ + M6 = sph_dec32be_aligned(buf + 24); \ + M7 = sph_dec32be_aligned(buf + 28); \ + M8 = sph_dec32be_aligned(buf + 32); \ + M9 = sph_dec32be_aligned(buf + 36); \ + MA = sph_dec32be_aligned(buf + 40); \ + MB = sph_dec32be_aligned(buf + 44); \ + MC = sph_dec32be_aligned(buf + 48); \ + MD = sph_dec32be_aligned(buf + 52); \ + ME = sph_dec32be_aligned(buf + 56); \ + MF = sph_dec32be_aligned(buf + 60); \ + ROUND_S(0); \ + ROUND_S(1); \ + ROUND_S(2); \ + ROUND_S(3); \ + ROUND_S(4); \ + ROUND_S(5); \ + ROUND_S(6); \ + ROUND_S(7); \ + if (blake256_rounds == 14) { \ + ROUND_S(8); \ + ROUND_S(9); \ + ROUND_S(0); \ + ROUND_S(1); \ + ROUND_S(2); \ + ROUND_S(3); \ + } \ + H0 ^= S0 ^ V0 ^ V8; \ + H1 ^= S1 ^ V1 ^ V9; \ + H2 ^= S2 ^ V2 ^ VA; \ + H3 ^= S3 ^ V3 ^ VB; \ + H4 ^= S0 ^ V4 ^ VC; \ + H5 ^= S1 ^ V5 ^ VD; \ + H6 ^= S2 ^ V6 ^ VE; \ + H7 ^= S3 ^ V7 ^ VF; \ + } while (0) + +#endif + +#if SPH_64 + +#define DECL_STATE64 \ + sph_u64 H0, H1, H2, H3, H4, H5, H6, H7; \ + sph_u64 S0, S1, S2, S3, T0, T1; + +#define READ_STATE64(state) do { \ + H0 = (state)->H[0]; \ + H1 = (state)->H[1]; \ + H2 = (state)->H[2]; \ + H3 = (state)->H[3]; \ + H4 = (state)->H[4]; \ + H5 = (state)->H[5]; \ + H6 = (state)->H[6]; \ + H7 = (state)->H[7]; \ + S0 = (state)->S[0]; \ + S1 = (state)->S[1]; \ + S2 = (state)->S[2]; \ + S3 = (state)->S[3]; \ + T0 = (state)->T0; \ + T1 = (state)->T1; \ + } while (0) + +#define WRITE_STATE64(state) do { \ + (state)->H[0] = H0; \ + (state)->H[1] = H1; \ + (state)->H[2] = H2; \ + (state)->H[3] = H3; \ + (state)->H[4] = H4; \ + (state)->H[5] = H5; \ + (state)->H[6] = H6; \ + (state)->H[7] = H7; \ + (state)->S[0] = S0; \ + (state)->S[1] = S1; \ + (state)->S[2] = S2; \ + (state)->S[3] = S3; \ + (state)->T0 = T0; \ + (state)->T1 = T1; \ + } while (0) + +#if SPH_COMPACT_BLAKE_64 + +#define COMPRESS64 do { \ + sph_u64 M[16]; \ + sph_u64 V0, V1, V2, V3, V4, V5, V6, V7; \ + sph_u64 V8, V9, VA, VB, VC, VD, VE, VF; \ + unsigned r; \ + V0 = H0; \ + V1 = H1; \ + V2 = H2; \ + V3 = H3; \ + V4 = H4; \ + V5 = H5; \ + V6 = H6; \ + V7 = H7; \ + V8 = S0 ^ CB0; \ + V9 = S1 ^ CB1; \ + VA = S2 ^ CB2; \ + VB = S3 ^ CB3; \ + VC = T0 ^ CB4; \ + VD = T0 ^ CB5; \ + VE = T1 ^ CB6; \ + VF = T1 ^ CB7; \ + M[0x0] = sph_dec64be_aligned(buf + 0); \ + M[0x1] = sph_dec64be_aligned(buf + 8); \ + M[0x2] = sph_dec64be_aligned(buf + 16); \ + M[0x3] = sph_dec64be_aligned(buf + 24); \ + M[0x4] = sph_dec64be_aligned(buf + 32); \ + M[0x5] = sph_dec64be_aligned(buf + 40); \ + M[0x6] = sph_dec64be_aligned(buf + 48); \ + M[0x7] = sph_dec64be_aligned(buf + 56); \ + M[0x8] = sph_dec64be_aligned(buf + 64); \ + M[0x9] = sph_dec64be_aligned(buf + 72); \ + M[0xA] = sph_dec64be_aligned(buf + 80); \ + M[0xB] = sph_dec64be_aligned(buf + 88); \ + M[0xC] = sph_dec64be_aligned(buf + 96); \ + M[0xD] = sph_dec64be_aligned(buf + 104); \ + M[0xE] = sph_dec64be_aligned(buf + 112); \ + M[0xF] = sph_dec64be_aligned(buf + 120); \ + for (r = 0; r < 16; r ++) \ + ROUND_B(r); \ + H0 ^= S0 ^ V0 ^ V8; \ + H1 ^= S1 ^ V1 ^ V9; \ + H2 ^= S2 ^ V2 ^ VA; \ + H3 ^= S3 ^ V3 ^ VB; \ + H4 ^= S0 ^ V4 ^ VC; \ + H5 ^= S1 ^ V5 ^ VD; \ + H6 ^= S2 ^ V6 ^ VE; \ + H7 ^= S3 ^ V7 ^ VF; \ + } while (0) + +#else + +#define COMPRESS64 do { \ + sph_u64 M0, M1, M2, M3, M4, M5, M6, M7; \ + sph_u64 M8, M9, MA, MB, MC, MD, ME, MF; \ + sph_u64 V0, V1, V2, V3, V4, V5, V6, V7; \ + sph_u64 V8, V9, VA, VB, VC, VD, VE, VF; \ + V0 = H0; \ + V1 = H1; \ + V2 = H2; \ + V3 = H3; \ + V4 = H4; \ + V5 = H5; \ + V6 = H6; \ + V7 = H7; \ + V8 = S0 ^ CB0; \ + V9 = S1 ^ CB1; \ + VA = S2 ^ CB2; \ + VB = S3 ^ CB3; \ + VC = T0 ^ CB4; \ + VD = T0 ^ CB5; \ + VE = T1 ^ CB6; \ + VF = T1 ^ CB7; \ + M0 = sph_dec64be_aligned(buf + 0); \ + M1 = sph_dec64be_aligned(buf + 8); \ + M2 = sph_dec64be_aligned(buf + 16); \ + M3 = sph_dec64be_aligned(buf + 24); \ + M4 = sph_dec64be_aligned(buf + 32); \ + M5 = sph_dec64be_aligned(buf + 40); \ + M6 = sph_dec64be_aligned(buf + 48); \ + M7 = sph_dec64be_aligned(buf + 56); \ + M8 = sph_dec64be_aligned(buf + 64); \ + M9 = sph_dec64be_aligned(buf + 72); \ + MA = sph_dec64be_aligned(buf + 80); \ + MB = sph_dec64be_aligned(buf + 88); \ + MC = sph_dec64be_aligned(buf + 96); \ + MD = sph_dec64be_aligned(buf + 104); \ + ME = sph_dec64be_aligned(buf + 112); \ + MF = sph_dec64be_aligned(buf + 120); \ + ROUND_B(0); \ + ROUND_B(1); \ + ROUND_B(2); \ + ROUND_B(3); \ + ROUND_B(4); \ + ROUND_B(5); \ + ROUND_B(6); \ + ROUND_B(7); \ + ROUND_B(8); \ + ROUND_B(9); \ + ROUND_B(0); \ + ROUND_B(1); \ + ROUND_B(2); \ + ROUND_B(3); \ + ROUND_B(4); \ + ROUND_B(5); \ + H0 ^= S0 ^ V0 ^ V8; \ + H1 ^= S1 ^ V1 ^ V9; \ + H2 ^= S2 ^ V2 ^ VA; \ + H3 ^= S3 ^ V3 ^ VB; \ + H4 ^= S0 ^ V4 ^ VC; \ + H5 ^= S1 ^ V5 ^ VD; \ + H6 ^= S2 ^ V6 ^ VE; \ + H7 ^= S3 ^ V7 ^ VF; \ + } while (0) + +#endif + +#endif + +static const sph_u32 salt_zero_small[4] = { 0, 0, 0, 0 }; + +static void +blake32_init(sph_blake_small_context *sc, + const sph_u32 *iv, const sph_u32 *salt) +{ + memcpy(sc->H, iv, 8 * sizeof(sph_u32)); + memcpy(sc->S, salt, 4 * sizeof(sph_u32)); + sc->T0 = sc->T1 = 0; + sc->ptr = 0; +} + +static void +blake32(sph_blake_small_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE32 + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE32(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + if ((T0 = SPH_T32(T0 + 512)) < 512) + T1 = SPH_T32(T1 + 1); + COMPRESS32; + ptr = 0; + } + } + WRITE_STATE32(sc); + sc->ptr = ptr; +} + +static void +blake32_close(sph_blake_small_context *sc, + unsigned ub, unsigned n, void *dst, size_t out_size_w32) +{ + union { + unsigned char buf[64]; + sph_u32 dummy; + } u; + size_t ptr, k; + unsigned bit_len; + unsigned z; + sph_u32 th, tl; + unsigned char *out; + + ptr = sc->ptr; + bit_len = ((unsigned)ptr << 3) + n; + z = 0x80 >> n; + u.buf[ptr] = ((ub & -z) | z) & 0xFF; + tl = sc->T0 + bit_len; + th = sc->T1; + if (ptr == 0 && n == 0) { + sc->T0 = SPH_C32(0xFFFFFE00); + sc->T1 = SPH_C32(0xFFFFFFFF); + } else if (sc->T0 == 0) { + sc->T0 = SPH_C32(0xFFFFFE00) + bit_len; + sc->T1 = SPH_T32(sc->T1 - 1); + } else { + sc->T0 -= 512 - bit_len; + } + if (bit_len <= 446) { + memset(u.buf + ptr + 1, 0, 55 - ptr); + if (out_size_w32 == 8) + u.buf[55] |= 1; + sph_enc32be_aligned(u.buf + 56, th); + sph_enc32be_aligned(u.buf + 60, tl); + blake32(sc, u.buf + ptr, 64 - ptr); + } else { + memset(u.buf + ptr + 1, 0, 63 - ptr); + blake32(sc, u.buf + ptr, 64 - ptr); + sc->T0 = SPH_C32(0xFFFFFE00); + sc->T1 = SPH_C32(0xFFFFFFFF); + memset(u.buf, 0, 56); + if (out_size_w32 == 8) + u.buf[55] = 1; + sph_enc32be_aligned(u.buf + 56, th); + sph_enc32be_aligned(u.buf + 60, tl); + blake32(sc, u.buf, 64); + } + out = dst; + for (k = 0; k < out_size_w32; k ++) + sph_enc32be(out + (k << 2), sc->H[k]); +} + +#if SPH_64 + +static const sph_u64 salt_zero_big[4] = { 0, 0, 0, 0 }; + +static void +blake64_init(sph_blake_big_context *sc, + const sph_u64 *iv, const sph_u64 *salt) +{ + memcpy(sc->H, iv, 8 * sizeof(sph_u64)); + memcpy(sc->S, salt, 4 * sizeof(sph_u64)); + sc->T0 = sc->T1 = 0; + sc->ptr = 0; +} + +static void +blake64(sph_blake_big_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE64 + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE64(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + if ((T0 = SPH_T64(T0 + 1024)) < 1024) + T1 = SPH_T64(T1 + 1); + COMPRESS64; + ptr = 0; + } + } + WRITE_STATE64(sc); + sc->ptr = ptr; +} + +static void +blake64_close(sph_blake_big_context *sc, + unsigned ub, unsigned n, void *dst, size_t out_size_w64) +{ + union { + unsigned char buf[128]; + sph_u64 dummy; + } u; + size_t ptr, k; + unsigned bit_len; + unsigned z; + sph_u64 th, tl; + unsigned char *out; + + ptr = sc->ptr; + bit_len = ((unsigned)ptr << 3) + n; + z = 0x80 >> n; + u.buf[ptr] = ((ub & -z) | z) & 0xFF; + tl = sc->T0 + bit_len; + th = sc->T1; + if (ptr == 0 && n == 0) { + sc->T0 = SPH_C64(0xFFFFFFFFFFFFFC00); + sc->T1 = SPH_C64(0xFFFFFFFFFFFFFFFF); + } else if (sc->T0 == 0) { + sc->T0 = SPH_C64(0xFFFFFFFFFFFFFC00) + bit_len; + sc->T1 = SPH_T64(sc->T1 - 1); + } else { + sc->T0 -= 1024 - bit_len; + } + if (bit_len <= 894) { + memset(u.buf + ptr + 1, 0, 111 - ptr); + if (out_size_w64 == 8) + u.buf[111] |= 1; + sph_enc64be_aligned(u.buf + 112, th); + sph_enc64be_aligned(u.buf + 120, tl); + blake64(sc, u.buf + ptr, 128 - ptr); + } else { + memset(u.buf + ptr + 1, 0, 127 - ptr); + blake64(sc, u.buf + ptr, 128 - ptr); + sc->T0 = SPH_C64(0xFFFFFFFFFFFFFC00); + sc->T1 = SPH_C64(0xFFFFFFFFFFFFFFFF); + memset(u.buf, 0, 112); + if (out_size_w64 == 8) + u.buf[111] = 1; + sph_enc64be_aligned(u.buf + 112, th); + sph_enc64be_aligned(u.buf + 120, tl); + blake64(sc, u.buf, 128); + } + out = dst; + for (k = 0; k < out_size_w64; k ++) + sph_enc64be(out + (k << 3), sc->H[k]); +} + +#endif + +/* see sph_blake.h */ +void +sph_blake224_init(void *cc) +{ + blake32_init(cc, IV224, salt_zero_small); +} + +/* see sph_blake.h */ +void +sph_blake224(void *cc, const void *data, size_t len) +{ + blake32(cc, data, len); +} + +/* see sph_blake.h */ +void +sph_blake224_close(void *cc, void *dst) +{ + sph_blake224_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_blake.h */ +void +sph_blake224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + blake32_close(cc, ub, n, dst, 7); + sph_blake224_init(cc); +} + +/* see sph_blake.h */ +void +sph_blake256_init(void *cc) +{ + blake32_init(cc, IV256, salt_zero_small); +} + +/* see sph_blake.h */ +void +sph_blake256(void *cc, const void *data, size_t len) +{ + blake32(cc, data, len); +} + +/* see sph_blake.h */ +void +sph_blake256_close(void *cc, void *dst) +{ + sph_blake256_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_blake.h */ +void +sph_blake256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + blake32_close(cc, ub, n, dst, 8); + sph_blake256_init(cc); +} + +/* see sph_blake.h */ +void +sph_blake256_set_rounds(int rounds) +{ + blake256_rounds = rounds; +} + +#if SPH_64 + +/* see sph_blake.h */ +void +sph_blake384_init(void *cc) +{ + blake64_init(cc, IV384, salt_zero_big); +} + +/* see sph_blake.h */ +void +sph_blake384(void *cc, const void *data, size_t len) +{ + blake64(cc, data, len); +} + +/* see sph_blake.h */ +void +sph_blake384_close(void *cc, void *dst) +{ + sph_blake384_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_blake.h */ +void +sph_blake384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + blake64_close(cc, ub, n, dst, 6); + sph_blake384_init(cc); +} + +/* see sph_blake.h */ +void +sph_blake512_init(void *cc) +{ + blake64_init(cc, IV512, salt_zero_big); +} + +/* see sph_blake.h */ +void +sph_blake512(void *cc, const void *data, size_t len) +{ + blake64(cc, data, len); +} + +/* see sph_blake.h */ +void +sph_blake512_close(void *cc, void *dst) +{ + sph_blake512_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_blake.h */ +void +sph_blake512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + blake64_close(cc, ub, n, dst, 8); + sph_blake512_init(cc); +} + +#endif + +#ifdef __cplusplus +} +#endif diff --git a/sph/blake2b.c b/sph/blake2b.c new file mode 100644 index 0000000..f85c977 --- /dev/null +++ b/sph/blake2b.c @@ -0,0 +1,196 @@ +/* + * Copyright 2009 Colin Percival, 2014 savale + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ + +#include +#include +#include + +#include "sph_types.h" +#include "blake2b.h" + +// Cyclic right rotation. + +#ifndef ROTR64 +#define ROTR64(x, y) (((x) >> (y)) ^ ((x) << (64 - (y)))) +#endif + +// Little-endian byte access. + +#define B2B_GET64(p) \ + (((uint64_t) ((uint8_t *) (p))[0]) ^ \ + (((uint64_t) ((uint8_t *) (p))[1]) << 8) ^ \ + (((uint64_t) ((uint8_t *) (p))[2]) << 16) ^ \ + (((uint64_t) ((uint8_t *) (p))[3]) << 24) ^ \ + (((uint64_t) ((uint8_t *) (p))[4]) << 32) ^ \ + (((uint64_t) ((uint8_t *) (p))[5]) << 40) ^ \ + (((uint64_t) ((uint8_t *) (p))[6]) << 48) ^ \ + (((uint64_t) ((uint8_t *) (p))[7]) << 56)) + +// G Mixing function. + +#define B2B_G(a, b, c, d, x, y) { \ + v[a] = v[a] + v[b] + x; \ + v[d] = ROTR64(v[d] ^ v[a], 32); \ + v[c] = v[c] + v[d]; \ + v[b] = ROTR64(v[b] ^ v[c], 24); \ + v[a] = v[a] + v[b] + y; \ + v[d] = ROTR64(v[d] ^ v[a], 16); \ + v[c] = v[c] + v[d]; \ + v[b] = ROTR64(v[b] ^ v[c], 63); } + +// Initialization Vector. + +static const uint64_t blake2b_iv[8] = { + 0x6A09E667F3BCC908, 0xBB67AE8584CAA73B, + 0x3C6EF372FE94F82B, 0xA54FF53A5F1D36F1, + 0x510E527FADE682D1, 0x9B05688C2B3E6C1F, + 0x1F83D9ABFB41BD6B, 0x5BE0CD19137E2179 +}; + +// Compression function. "last" flag indicates last block. + +static void blake2b_compress(blake2b_ctx *ctx, int last) +{ + const uint8_t sigma[12][16] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }, + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 }, + { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 }, + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 }, + { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } + }; + int i; + uint64_t v[16], m[16]; + + for (i = 0; i < 8; i++) { // init work variables + v[i] = ctx->h[i]; + v[i + 8] = blake2b_iv[i]; + } + + v[12] ^= ctx->t[0]; // low 64 bits of offset + v[13] ^= ctx->t[1]; // high 64 bits + if (last) // last block flag set ? + v[14] = ~v[14]; + + for (i = 0; i < 16; i++) // get little-endian words + m[i] = B2B_GET64(&ctx->b[8 * i]); + + for (i = 0; i < 12; i++) { // twelve rounds + B2B_G( 0, 4, 8, 12, m[sigma[i][ 0]], m[sigma[i][ 1]]); + B2B_G( 1, 5, 9, 13, m[sigma[i][ 2]], m[sigma[i][ 3]]); + B2B_G( 2, 6, 10, 14, m[sigma[i][ 4]], m[sigma[i][ 5]]); + B2B_G( 3, 7, 11, 15, m[sigma[i][ 6]], m[sigma[i][ 7]]); + B2B_G( 0, 5, 10, 15, m[sigma[i][ 8]], m[sigma[i][ 9]]); + B2B_G( 1, 6, 11, 12, m[sigma[i][10]], m[sigma[i][11]]); + B2B_G( 2, 7, 8, 13, m[sigma[i][12]], m[sigma[i][13]]); + B2B_G( 3, 4, 9, 14, m[sigma[i][14]], m[sigma[i][15]]); + } + + for( i = 0; i < 8; ++i ) + ctx->h[i] ^= v[i] ^ v[i + 8]; +} + +// Initialize the hashing context "ctx" with optional key "key". +// 1 <= outlen <= 64 gives the digest size in bytes. +// Secret key (also <= 64 bytes) is optional (keylen = 0). + +int blake2b_init(blake2b_ctx *ctx, size_t outlen, + const void *key, size_t keylen) // (keylen=0: no key) +{ + size_t i; + + if (outlen == 0 || outlen > 64 || keylen > 64) + return -1; // illegal parameters + + for (i = 0; i < 8; i++) // state, "param block" + ctx->h[i] = blake2b_iv[i]; + ctx->h[0] ^= 0x01010000 ^ (keylen << 8) ^ outlen; + + ctx->t[0] = 0; // input count low word + ctx->t[1] = 0; // input count high word + ctx->c = 0; // pointer within buffer + ctx->outlen = outlen; + + for (i = keylen; i < 128; i++) // zero input block + ctx->b[i] = 0; + if (keylen > 0) { + blake2b_update(ctx, key, keylen); + ctx->c = 128; // at the end + } + + return 0; +} + +// Add "inlen" bytes from "in" into the hash. + +void blake2b_update(blake2b_ctx *ctx, + const void *in, size_t inlen) // data bytes +{ + size_t i; + + for (i = 0; i < inlen; i++) { + if (ctx->c == 128) { // buffer full ? + ctx->t[0] += ctx->c; // add counters + if (ctx->t[0] < ctx->c) // carry overflow ? + ctx->t[1]++; // high word + blake2b_compress(ctx, 0); // compress (not last) + ctx->c = 0; // counter to zero + } + ctx->b[ctx->c++] = ((const uint8_t *) in)[i]; + } +} + +// Generate the message digest (size given in init). +// Result placed in "out". + +void blake2b_final(blake2b_ctx *ctx, void *out) +{ + size_t i; + + ctx->t[0] += ctx->c; // mark last block offset + if (ctx->t[0] < ctx->c) // carry overflow + ctx->t[1]++; // high word + + while (ctx->c < 128) // fill up with zeros + ctx->b[ctx->c++] = 0; + blake2b_compress(ctx, 1); // final block flag = 1 + + // little endian convert and store + for (i = 0; i < ctx->outlen; i++) { + ((uint8_t *) out)[i] = + (ctx->h[i >> 3] >> (8 * (i & 7))) & 0xFF; + } +} + diff --git a/sph/blake2b.h b/sph/blake2b.h new file mode 100644 index 0000000..f8652c1 --- /dev/null +++ b/sph/blake2b.h @@ -0,0 +1,41 @@ +#pragma once +#ifndef __BLAKE2B_H__ +#define __BLAKE2B_H__ + +#include +#include + +#if defined(_MSC_VER) +#include +#define inline __inline +#define ALIGN(x) __declspec(align(x)) +#else +#define ALIGN(x) __attribute__((aligned(x))) +#endif + +#if defined(_MSC_VER) || defined(__x86_64__) || defined(__x86__) +#define NATIVE_LITTLE_ENDIAN +#endif + +// state context +ALIGN(64) typedef struct { + uint8_t b[128]; // input buffer + uint64_t h[8]; // chained state + uint64_t t[2]; // total number of bytes + size_t c; // pointer for b[] + size_t outlen; // digest size +} blake2b_ctx; + +#if defined(__cplusplus) +extern "C" { +#endif + +int blake2b_init(blake2b_ctx *ctx, size_t outlen, const void *key, size_t keylen); +void blake2b_update(blake2b_ctx *ctx, const void *in, size_t inlen); +void blake2b_final(blake2b_ctx *ctx, void *out); + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/sph/blake2s.c b/sph/blake2s.c new file mode 100644 index 0000000..086f6e0 --- /dev/null +++ b/sph/blake2s.c @@ -0,0 +1,304 @@ +/** + * BLAKE2 reference source code package - reference C implementations + * + * Written in 2012 by Samuel Neves + * + * To the extent possible under law, the author(s) have dedicated all copyright + * and related and neighboring rights to this software to the public domain + * worldwide. This software is distributed without any warranty. + * + * You should have received a copy of the CC0 Public Domain Dedication along with + * this software. If not, see . + */ + +#include +#include +#include + +#include "sph_types.h" +#include "sph/blake2s.h" + +static const uint32_t blake2s_IV[8] = +{ + 0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL, + 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL +}; + +static const uint8_t blake2s_sigma[10][16] = +{ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , + { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , + { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } , +}; + +static inline int blake2s_set_lastnode( blake2s_state *S ){ + S->f[1] = ~0U; + return 0; +} + +static inline int blake2s_clear_lastnode( blake2s_state *S ){ + S->f[1] = 0U; + return 0; +} + +/* Some helper functions, not necessarily useful */ +static inline int blake2s_set_lastblock( blake2s_state *S ){ + if( S->last_node ) blake2s_set_lastnode( S ); + + S->f[0] = ~0U; + return 0; +} + +static inline int blake2s_clear_lastblock( blake2s_state *S ){ + if( S->last_node ) blake2s_clear_lastnode( S ); + + S->f[0] = 0U; + return 0; +} + +static inline int blake2s_increment_counter( blake2s_state *S, const uint32_t inc ){ + S->t[0] += inc; + S->t[1] += ( S->t[0] < inc ); + return 0; +} + +// Parameter-related functions +static inline int blake2s_param_set_digest_length( blake2s_param *P, const uint8_t digest_length ){ + P->digest_length = digest_length; + return 0; +} + +static inline int blake2s_param_set_fanout( blake2s_param *P, const uint8_t fanout ){ + P->fanout = fanout; + return 0; +} + +static inline int blake2s_param_set_max_depth( blake2s_param *P, const uint8_t depth ){ + P->depth = depth; + return 0; +} + +static inline int blake2s_param_set_leaf_length( blake2s_param *P, const uint32_t leaf_length ){ + store32( &P->leaf_length, leaf_length ); + return 0; +} + +static inline int blake2s_param_set_node_offset( blake2s_param *P, const uint64_t node_offset ){ + store48( P->node_offset, node_offset ); + return 0; +} + +static inline int blake2s_param_set_node_depth( blake2s_param *P, const uint8_t node_depth ){ + P->node_depth = node_depth; + return 0; +} + +static inline int blake2s_param_set_inner_length( blake2s_param *P, const uint8_t inner_length ){ + P->inner_length = inner_length; + return 0; +} + +static inline int blake2s_param_set_salt( blake2s_param *P, const uint8_t salt[BLAKE2S_SALTBYTES] ){ + memcpy( P->salt, salt, BLAKE2S_SALTBYTES ); + return 0; +} + +static inline int blake2s_param_set_personal( blake2s_param *P, const uint8_t personal[BLAKE2S_PERSONALBYTES] ){ + memcpy( P->personal, personal, BLAKE2S_PERSONALBYTES ); + return 0; +} + +static inline int blake2s_init0( blake2s_state *S ){ + memset( S, 0, sizeof( blake2s_state ) ); + + for( int i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i]; + + return 0; +} + +/* init2 xors IV with input parameter block */ +int blake2s_init_param( blake2s_state *S, const blake2s_param *P ){ + blake2s_init0( S ); + uint32_t *p = ( uint32_t * )( P ); +// printf("%u - %u - %u - %u - %u - %u - %u - %u\n",p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]); + /* IV XOR ParamBlock */ + for( size_t i = 0; i < 8; ++i ) + S->h[i] ^= load32( &p[i] ); + + return 0; +} + + +// Sequential blake2s initialization +int blake2s_init( blake2s_state *S, const uint8_t outlen ){ + blake2s_param P[1]; + + /* Move interval verification here? */ + if ( ( !outlen ) || ( outlen > 32 ) ) return -1; + + P->digest_length = outlen; + P->key_length = 0; + P->fanout = 1; + P->depth = 1; + store32( &P->leaf_length, 0 ); + store48( &P->node_offset, 0 ); + P->node_depth = 0; + P->inner_length = 0; + // memset(P->reserved, 0, sizeof(P->reserved) ); + memset( P->salt, 0, sizeof( P->salt ) ); + memset( P->personal, 0, sizeof( P->personal ) ); + return blake2s_init_param( S, P ); +} + +int blake2s_init_key( blake2s_state *S, const uint8_t outlen, const void *key, const uint8_t keylen ){ + blake2s_param P[1]; + + if ( ( !outlen ) || ( outlen > 32 ) ) return -1; + + if ( !key || !keylen || keylen > BLAKE2S_KEYBYTES ) return -1; + + P->digest_length = outlen; + P->key_length = keylen; + P->fanout = 1; + P->depth = 1; + store32( &P->leaf_length, 0 ); + store48( &P->node_offset, 0 ); + P->node_depth = 0; + P->inner_length = 0; + // memset(P->reserved, 0, sizeof(P->reserved) ); + memset( P->salt, 0, sizeof( P->salt ) ); + memset( P->personal, 0, sizeof( P->personal ) ); + + if( blake2s_init_param( S, P ) < 0 ) return -1; + + { + uint8_t block[64]; + memset( block, 0, 64 ); + memcpy( block, key, keylen ); + blake2s_update( S, block, 64 ); + secure_zero_memory( block, 64 ); /* Burn the key from stack */ + } + return 0; +} + +int blake2s_compress( blake2s_state *S, const uint8_t block[64] ){ + uint32_t m[16]; + uint32_t v[16]; + + for( size_t i = 0; i < 16; ++i ) + m[i] = load32( block + i * sizeof( m[i] ) ); + + for( size_t i = 0; i < 8; ++i ) + v[i] = S->h[i]; + + v[ 8] = blake2s_IV[0]; + v[ 9] = blake2s_IV[1]; + v[10] = blake2s_IV[2]; + v[11] = blake2s_IV[3]; + v[12] = S->t[0] ^ blake2s_IV[4]; + v[13] = S->t[1] ^ blake2s_IV[5]; + v[14] = S->f[0] ^ blake2s_IV[6]; + v[15] = S->f[1] ^ blake2s_IV[7]; +#define G(r,i,a,b,c,d) \ + do { \ + a = a + b + m[blake2s_sigma[r][2*i+0]]; \ + d = SPH_ROTR32(d ^ a, 16); \ + c = c + d; \ + b = SPH_ROTR32(b ^ c, 12); \ + a = a + b + m[blake2s_sigma[r][2*i+1]]; \ + d = SPH_ROTR32(d ^ a, 8); \ + c = c + d; \ + b = SPH_ROTR32(b ^ c, 7); \ + } while(0) +#define ROUND(r) \ + do { \ + G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \ + G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \ + G(r,2,v[ 2],v[ 6],v[10],v[14]); \ + G(r,3,v[ 3],v[ 7],v[11],v[15]); \ + G(r,4,v[ 0],v[ 5],v[10],v[15]); \ + G(r,5,v[ 1],v[ 6],v[11],v[12]); \ + G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \ + G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \ + } while(0) + ROUND( 0 ); + ROUND( 1 ); + ROUND( 2 ); + ROUND( 3 ); + ROUND( 4 ); + ROUND( 5 ); + ROUND( 6 ); + ROUND( 7 ); + ROUND( 8 ); + ROUND( 9 ); + + for( size_t i = 0; i < 8; ++i ) + S->h[i] = S->h[i] ^ v[i] ^ v[i + 8]; + +#undef G +#undef ROUND + return 0; +} + + +int blake2s_update( blake2s_state *S, const uint8_t *in, uint64_t inlen ){ + memcpy(S->buf, in, (size_t) inlen); + S->buflen += (size_t) inlen; // Be lazy, do not compress + return 0; +} + +int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen ){ + uint8_t buffer[32]; + + S->t[0] += 64; + S->t[1] += ( S->t[0] < 64 ); + + blake2s_compress( S, S->buf ); + S->buflen -= 64; + memcpy( S->buf, S->buf + 64, S->buflen ); + + S->t[0] += ( uint32_t )S->buflen; + S->t[1] += ( S->t[0] < ( uint32_t )S->buflen ); + + blake2s_set_lastblock( S ); + memset( S->buf + S->buflen, 0, 2 * 64 - S->buflen ); /* Padding */ + blake2s_compress( S, S->buf ); + + for( int i = 0; i < 8; ++i ) /* Output full hash to temp buffer */ + store32( buffer + sizeof( S->h[i] ) * i, S->h[i] ); + + memcpy( out, buffer, outlen ); + return 0; +} + +int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen ) +{ + blake2s_state S[1]; + + /* Verify parameters */ + if ( NULL == in ) return -1; + + if ( NULL == out ) return -1; + + if ( NULL == key ) keylen = 0; /* Fail here instead if keylen != 0 and key == NULL? */ + + if( keylen > 0 ) + { + if( blake2s_init_key( S, outlen, key, keylen ) < 0 ) return -1; + } + else + { + if( blake2s_init( S, outlen ) < 0 ) return -1; + } + + blake2s_update( S, ( uint8_t * )in, inlen ); + blake2s_final( S, out, outlen ); + return 0; +} diff --git a/sph/blake2s.h b/sph/blake2s.h new file mode 100644 index 0000000..2949fa6 --- /dev/null +++ b/sph/blake2s.h @@ -0,0 +1,150 @@ +/** + * BLAKE2 reference source code package - reference C implementations + * + * Written in 2012 by Samuel Neves + * + * To the extent possible under law, the author(s) have dedicated all copyright + * and related and neighboring rights to this software to the public domain + * worldwide. This software is distributed without any warranty. + * + * You should have received a copy of the CC0 Public Domain Dedication along with + * this software. If not, see . + */ +#pragma once +#ifndef __BLAKE2_H__ +#define __BLAKE2_H__ + +#include +#include + +#if defined(_MSC_VER) +#include +#define inline __inline +#define ALIGN(x) __declspec(align(x)) +#else +#define ALIGN(x) __attribute__((aligned(x))) +#endif + +/* blake2-impl.h */ + +static inline uint32_t load32(const void *src) +{ +#if defined(NATIVE_LITTLE_ENDIAN) + return *(uint32_t *)(src); +#else + const uint8_t *p = (uint8_t *)src; + uint32_t w = *p++; + w |= (uint32_t)(*p++) << 8; + w |= (uint32_t)(*p++) << 16; + w |= (uint32_t)(*p++) << 24; + return w; +#endif +} + +static inline void store32(void *dst, uint32_t w) +{ +#if defined(NATIVE_LITTLE_ENDIAN) + *(uint32_t *)(dst) = w; +#else + uint8_t *p = (uint8_t *)dst; + *p++ = (uint8_t)w; w >>= 8; + *p++ = (uint8_t)w; w >>= 8; + *p++ = (uint8_t)w; w >>= 8; + *p++ = (uint8_t)w; +#endif +} + +static inline uint64_t load48(const void *src) +{ + const uint8_t *p = (const uint8_t *)src; + uint64_t w = *p++; + w |= (uint64_t)(*p++) << 8; + w |= (uint64_t)(*p++) << 16; + w |= (uint64_t)(*p++) << 24; + w |= (uint64_t)(*p++) << 32; + w |= (uint64_t)(*p++) << 40; + return w; +} + +static inline void store48(void *dst, uint64_t w) +{ + uint8_t *p = (uint8_t *)dst; + *p++ = (uint8_t)w; w >>= 8; + *p++ = (uint8_t)w; w >>= 8; + *p++ = (uint8_t)w; w >>= 8; + *p++ = (uint8_t)w; w >>= 8; + *p++ = (uint8_t)w; w >>= 8; + *p++ = (uint8_t)w; +} + +/* prevents compiler optimizing out memset() */ +static inline void secure_zero_memory(void *v, size_t n) +{ + volatile uint8_t *p = ( volatile uint8_t * )v; + + while( n-- ) *p++ = 0; +} + +/* blake2.h */ + +#if defined(__cplusplus) +extern "C" { +#endif + + enum blake2s_constant + { + BLAKE2S_BLOCKBYTES = 64, + BLAKE2S_OUTBYTES = 32, + BLAKE2S_KEYBYTES = 32, + BLAKE2S_SALTBYTES = 8, + BLAKE2S_PERSONALBYTES = 8 + }; + +#pragma pack(push, 1) + typedef struct __blake2s_param + { + uint8_t digest_length; // 1 + uint8_t key_length; // 2 + uint8_t fanout; // 3 + uint8_t depth; // 4 + uint32_t leaf_length; // 8 + uint8_t node_offset[6];// 14 + uint8_t node_depth; // 15 + uint8_t inner_length; // 16 + // uint8_t reserved[0]; + uint8_t salt[BLAKE2S_SALTBYTES]; // 24 + uint8_t personal[BLAKE2S_PERSONALBYTES]; // 32 + } blake2s_param; + + ALIGN( 64 ) typedef struct __blake2s_state + { + uint32_t h[8]; + uint32_t t[2]; + uint32_t f[2]; + uint8_t buf[2 * BLAKE2S_BLOCKBYTES]; + size_t buflen; + uint8_t last_node; + } blake2s_state ; +#pragma pack(pop) + + int blake2s_compress( blake2s_state *S, const uint8_t block[BLAKE2S_BLOCKBYTES] ); + + // Streaming API + int blake2s_init( blake2s_state *S, const uint8_t outlen ); + int blake2s_init_key( blake2s_state *S, const uint8_t outlen, const void *key, const uint8_t keylen ); + int blake2s_init_param( blake2s_state *S, const blake2s_param *P ); + int blake2s_update( blake2s_state *S, const uint8_t *in, uint64_t inlen ); + int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen ); + + // Simple API + int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen ); + + // Direct Hash Mining Helpers + #define blake2s_salt32(out, in, inlen, key32) blake2s(out, in, key32, 32, inlen, 32) /* neoscrypt */ + #define blake2s_simple(out, in, inlen) blake2s(out, in, NULL, 32, inlen, 0) + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/sph/bmw.c b/sph/bmw.c new file mode 100644 index 0000000..718191d --- /dev/null +++ b/sph/bmw.c @@ -0,0 +1,957 @@ +/* $Id: bmw.c 227 2010-06-16 17:28:38Z tp $ */ +/* + * BMW implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include +#include + +#include "sph_bmw.h" + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_BMW +#define SPH_SMALL_FOOTPRINT_BMW 1 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +static const sph_u32 IV224[] = { + SPH_C32(0x00010203), SPH_C32(0x04050607), + SPH_C32(0x08090A0B), SPH_C32(0x0C0D0E0F), + SPH_C32(0x10111213), SPH_C32(0x14151617), + SPH_C32(0x18191A1B), SPH_C32(0x1C1D1E1F), + SPH_C32(0x20212223), SPH_C32(0x24252627), + SPH_C32(0x28292A2B), SPH_C32(0x2C2D2E2F), + SPH_C32(0x30313233), SPH_C32(0x34353637), + SPH_C32(0x38393A3B), SPH_C32(0x3C3D3E3F) +}; + +static const sph_u32 IV256[] = { + SPH_C32(0x40414243), SPH_C32(0x44454647), + SPH_C32(0x48494A4B), SPH_C32(0x4C4D4E4F), + SPH_C32(0x50515253), SPH_C32(0x54555657), + SPH_C32(0x58595A5B), SPH_C32(0x5C5D5E5F), + SPH_C32(0x60616263), SPH_C32(0x64656667), + SPH_C32(0x68696A6B), SPH_C32(0x6C6D6E6F), + SPH_C32(0x70717273), SPH_C32(0x74757677), + SPH_C32(0x78797A7B), SPH_C32(0x7C7D7E7F) +}; + +#if SPH_64 + +static const sph_u64 IV384[] = { + SPH_C64(0x0001020304050607), SPH_C64(0x08090A0B0C0D0E0F), + SPH_C64(0x1011121314151617), SPH_C64(0x18191A1B1C1D1E1F), + SPH_C64(0x2021222324252627), SPH_C64(0x28292A2B2C2D2E2F), + SPH_C64(0x3031323334353637), SPH_C64(0x38393A3B3C3D3E3F), + SPH_C64(0x4041424344454647), SPH_C64(0x48494A4B4C4D4E4F), + SPH_C64(0x5051525354555657), SPH_C64(0x58595A5B5C5D5E5F), + SPH_C64(0x6061626364656667), SPH_C64(0x68696A6B6C6D6E6F), + SPH_C64(0x7071727374757677), SPH_C64(0x78797A7B7C7D7E7F) +}; + +static const sph_u64 IV512[] = { + SPH_C64(0x8081828384858687), SPH_C64(0x88898A8B8C8D8E8F), + SPH_C64(0x9091929394959697), SPH_C64(0x98999A9B9C9D9E9F), + SPH_C64(0xA0A1A2A3A4A5A6A7), SPH_C64(0xA8A9AAABACADAEAF), + SPH_C64(0xB0B1B2B3B4B5B6B7), SPH_C64(0xB8B9BABBBCBDBEBF), + SPH_C64(0xC0C1C2C3C4C5C6C7), SPH_C64(0xC8C9CACBCCCDCECF), + SPH_C64(0xD0D1D2D3D4D5D6D7), SPH_C64(0xD8D9DADBDCDDDEDF), + SPH_C64(0xE0E1E2E3E4E5E6E7), SPH_C64(0xE8E9EAEBECEDEEEF), + SPH_C64(0xF0F1F2F3F4F5F6F7), SPH_C64(0xF8F9FAFBFCFDFEFF) +}; + +#endif + +#define XCAT(x, y) XCAT_(x, y) +#define XCAT_(x, y) x ## y + +#define LPAR ( + +#define I16_16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +#define I16_17 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 +#define I16_18 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 +#define I16_19 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 +#define I16_20 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 +#define I16_21 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 +#define I16_22 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 +#define I16_23 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 +#define I16_24 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 +#define I16_25 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 +#define I16_26 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 +#define I16_27 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 +#define I16_28 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 +#define I16_29 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 +#define I16_30 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 +#define I16_31 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 + +#define M16_16 0, 1, 3, 4, 7, 10, 11 +#define M16_17 1, 2, 4, 5, 8, 11, 12 +#define M16_18 2, 3, 5, 6, 9, 12, 13 +#define M16_19 3, 4, 6, 7, 10, 13, 14 +#define M16_20 4, 5, 7, 8, 11, 14, 15 +#define M16_21 5, 6, 8, 9, 12, 15, 16 +#define M16_22 6, 7, 9, 10, 13, 0, 1 +#define M16_23 7, 8, 10, 11, 14, 1, 2 +#define M16_24 8, 9, 11, 12, 15, 2, 3 +#define M16_25 9, 10, 12, 13, 0, 3, 4 +#define M16_26 10, 11, 13, 14, 1, 4, 5 +#define M16_27 11, 12, 14, 15, 2, 5, 6 +#define M16_28 12, 13, 15, 16, 3, 6, 7 +#define M16_29 13, 14, 0, 1, 4, 7, 8 +#define M16_30 14, 15, 1, 2, 5, 8, 9 +#define M16_31 15, 16, 2, 3, 6, 9, 10 + +#define ss0(x) (((x) >> 1) ^ SPH_T32((x) << 3) \ + ^ SPH_ROTL32(x, 4) ^ SPH_ROTL32(x, 19)) +#define ss1(x) (((x) >> 1) ^ SPH_T32((x) << 2) \ + ^ SPH_ROTL32(x, 8) ^ SPH_ROTL32(x, 23)) +#define ss2(x) (((x) >> 2) ^ SPH_T32((x) << 1) \ + ^ SPH_ROTL32(x, 12) ^ SPH_ROTL32(x, 25)) +#define ss3(x) (((x) >> 2) ^ SPH_T32((x) << 2) \ + ^ SPH_ROTL32(x, 15) ^ SPH_ROTL32(x, 29)) +#define ss4(x) (((x) >> 1) ^ (x)) +#define ss5(x) (((x) >> 2) ^ (x)) +#define rs1(x) SPH_ROTL32(x, 3) +#define rs2(x) SPH_ROTL32(x, 7) +#define rs3(x) SPH_ROTL32(x, 13) +#define rs4(x) SPH_ROTL32(x, 16) +#define rs5(x) SPH_ROTL32(x, 19) +#define rs6(x) SPH_ROTL32(x, 23) +#define rs7(x) SPH_ROTL32(x, 27) + +#define Ks(j) SPH_T32((sph_u32)(j) * SPH_C32(0x05555555)) + +#define add_elt_s(mf, hf, j0m, j1m, j3m, j4m, j7m, j10m, j11m, j16) \ + (SPH_T32(SPH_ROTL32(mf(j0m), j1m) + SPH_ROTL32(mf(j3m), j4m) \ + - SPH_ROTL32(mf(j10m), j11m) + Ks(j16)) ^ hf(j7m)) + +#define expand1s_inner(qf, mf, hf, i16, \ + i0, i1, i2, i3, i4, i5, i6, i7, i8, \ + i9, i10, i11, i12, i13, i14, i15, \ + i0m, i1m, i3m, i4m, i7m, i10m, i11m) \ + SPH_T32(ss1(qf(i0)) + ss2(qf(i1)) + ss3(qf(i2)) + ss0(qf(i3)) \ + + ss1(qf(i4)) + ss2(qf(i5)) + ss3(qf(i6)) + ss0(qf(i7)) \ + + ss1(qf(i8)) + ss2(qf(i9)) + ss3(qf(i10)) + ss0(qf(i11)) \ + + ss1(qf(i12)) + ss2(qf(i13)) + ss3(qf(i14)) + ss0(qf(i15)) \ + + add_elt_s(mf, hf, i0m, i1m, i3m, i4m, i7m, i10m, i11m, i16)) + +#define expand1s(qf, mf, hf, i16) \ + expand1s_(qf, mf, hf, i16, I16_ ## i16, M16_ ## i16) +#define expand1s_(qf, mf, hf, i16, ix, iy) \ + expand1s_inner LPAR qf, mf, hf, i16, ix, iy) + +#define expand2s_inner(qf, mf, hf, i16, \ + i0, i1, i2, i3, i4, i5, i6, i7, i8, \ + i9, i10, i11, i12, i13, i14, i15, \ + i0m, i1m, i3m, i4m, i7m, i10m, i11m) \ + SPH_T32(qf(i0) + rs1(qf(i1)) + qf(i2) + rs2(qf(i3)) \ + + qf(i4) + rs3(qf(i5)) + qf(i6) + rs4(qf(i7)) \ + + qf(i8) + rs5(qf(i9)) + qf(i10) + rs6(qf(i11)) \ + + qf(i12) + rs7(qf(i13)) + ss4(qf(i14)) + ss5(qf(i15)) \ + + add_elt_s(mf, hf, i0m, i1m, i3m, i4m, i7m, i10m, i11m, i16)) + +#define expand2s(qf, mf, hf, i16) \ + expand2s_(qf, mf, hf, i16, I16_ ## i16, M16_ ## i16) +#define expand2s_(qf, mf, hf, i16, ix, iy) \ + expand2s_inner LPAR qf, mf, hf, i16, ix, iy) + +#if SPH_64 + +#define sb0(x) (((x) >> 1) ^ SPH_T64((x) << 3) \ + ^ SPH_ROTL64(x, 4) ^ SPH_ROTL64(x, 37)) +#define sb1(x) (((x) >> 1) ^ SPH_T64((x) << 2) \ + ^ SPH_ROTL64(x, 13) ^ SPH_ROTL64(x, 43)) +#define sb2(x) (((x) >> 2) ^ SPH_T64((x) << 1) \ + ^ SPH_ROTL64(x, 19) ^ SPH_ROTL64(x, 53)) +#define sb3(x) (((x) >> 2) ^ SPH_T64((x) << 2) \ + ^ SPH_ROTL64(x, 28) ^ SPH_ROTL64(x, 59)) +#define sb4(x) (((x) >> 1) ^ (x)) +#define sb5(x) (((x) >> 2) ^ (x)) +#define rb1(x) SPH_ROTL64(x, 5) +#define rb2(x) SPH_ROTL64(x, 11) +#define rb3(x) SPH_ROTL64(x, 27) +#define rb4(x) SPH_ROTL64(x, 32) +#define rb5(x) SPH_ROTL64(x, 37) +#define rb6(x) SPH_ROTL64(x, 43) +#define rb7(x) SPH_ROTL64(x, 53) + +#define Kb(j) SPH_T64((sph_u64)(j) * SPH_C64(0x0555555555555555)) + +#if SPH_SMALL_FOOTPRINT_BMW + +static const sph_u64 Kb_tab[] = { + Kb(16), Kb(17), Kb(18), Kb(19), Kb(20), Kb(21), Kb(22), Kb(23), + Kb(24), Kb(25), Kb(26), Kb(27), Kb(28), Kb(29), Kb(30), Kb(31) +}; + +#define rol_off(mf, j, off) \ + SPH_ROTL64(mf(((j) + (off)) & 15), (((j) + (off)) & 15) + 1) + +#define add_elt_b(mf, hf, j) \ + (SPH_T64(rol_off(mf, j, 0) + rol_off(mf, j, 3) \ + - rol_off(mf, j, 10) + Kb_tab[j]) ^ hf(((j) + 7) & 15)) + +#define expand1b(qf, mf, hf, i) \ + SPH_T64(sb1(qf((i) - 16)) + sb2(qf((i) - 15)) \ + + sb3(qf((i) - 14)) + sb0(qf((i) - 13)) \ + + sb1(qf((i) - 12)) + sb2(qf((i) - 11)) \ + + sb3(qf((i) - 10)) + sb0(qf((i) - 9)) \ + + sb1(qf((i) - 8)) + sb2(qf((i) - 7)) \ + + sb3(qf((i) - 6)) + sb0(qf((i) - 5)) \ + + sb1(qf((i) - 4)) + sb2(qf((i) - 3)) \ + + sb3(qf((i) - 2)) + sb0(qf((i) - 1)) \ + + add_elt_b(mf, hf, (i) - 16)) + +#define expand2b(qf, mf, hf, i) \ + SPH_T64(qf((i) - 16) + rb1(qf((i) - 15)) \ + + qf((i) - 14) + rb2(qf((i) - 13)) \ + + qf((i) - 12) + rb3(qf((i) - 11)) \ + + qf((i) - 10) + rb4(qf((i) - 9)) \ + + qf((i) - 8) + rb5(qf((i) - 7)) \ + + qf((i) - 6) + rb6(qf((i) - 5)) \ + + qf((i) - 4) + rb7(qf((i) - 3)) \ + + sb4(qf((i) - 2)) + sb5(qf((i) - 1)) \ + + add_elt_b(mf, hf, (i) - 16)) + +#else + +#define add_elt_b(mf, hf, j0m, j1m, j3m, j4m, j7m, j10m, j11m, j16) \ + (SPH_T64(SPH_ROTL64(mf(j0m), j1m) + SPH_ROTL64(mf(j3m), j4m) \ + - SPH_ROTL64(mf(j10m), j11m) + Kb(j16)) ^ hf(j7m)) + +#define expand1b_inner(qf, mf, hf, i16, \ + i0, i1, i2, i3, i4, i5, i6, i7, i8, \ + i9, i10, i11, i12, i13, i14, i15, \ + i0m, i1m, i3m, i4m, i7m, i10m, i11m) \ + SPH_T64(sb1(qf(i0)) + sb2(qf(i1)) + sb3(qf(i2)) + sb0(qf(i3)) \ + + sb1(qf(i4)) + sb2(qf(i5)) + sb3(qf(i6)) + sb0(qf(i7)) \ + + sb1(qf(i8)) + sb2(qf(i9)) + sb3(qf(i10)) + sb0(qf(i11)) \ + + sb1(qf(i12)) + sb2(qf(i13)) + sb3(qf(i14)) + sb0(qf(i15)) \ + + add_elt_b(mf, hf, i0m, i1m, i3m, i4m, i7m, i10m, i11m, i16)) + +#define expand1b(qf, mf, hf, i16) \ + expand1b_(qf, mf, hf, i16, I16_ ## i16, M16_ ## i16) +#define expand1b_(qf, mf, hf, i16, ix, iy) \ + expand1b_inner LPAR qf, mf, hf, i16, ix, iy) + +#define expand2b_inner(qf, mf, hf, i16, \ + i0, i1, i2, i3, i4, i5, i6, i7, i8, \ + i9, i10, i11, i12, i13, i14, i15, \ + i0m, i1m, i3m, i4m, i7m, i10m, i11m) \ + SPH_T64(qf(i0) + rb1(qf(i1)) + qf(i2) + rb2(qf(i3)) \ + + qf(i4) + rb3(qf(i5)) + qf(i6) + rb4(qf(i7)) \ + + qf(i8) + rb5(qf(i9)) + qf(i10) + rb6(qf(i11)) \ + + qf(i12) + rb7(qf(i13)) + sb4(qf(i14)) + sb5(qf(i15)) \ + + add_elt_b(mf, hf, i0m, i1m, i3m, i4m, i7m, i10m, i11m, i16)) + +#define expand2b(qf, mf, hf, i16) \ + expand2b_(qf, mf, hf, i16, I16_ ## i16, M16_ ## i16) +#define expand2b_(qf, mf, hf, i16, ix, iy) \ + expand2b_inner LPAR qf, mf, hf, i16, ix, iy) + +#endif + +#endif + +#define MAKE_W(tt, i0, op01, i1, op12, i2, op23, i3, op34, i4) \ + tt((M(i0) ^ H(i0)) op01 (M(i1) ^ H(i1)) op12 (M(i2) ^ H(i2)) \ + op23 (M(i3) ^ H(i3)) op34 (M(i4) ^ H(i4))) + +#define Ws0 MAKE_W(SPH_T32, 5, -, 7, +, 10, +, 13, +, 14) +#define Ws1 MAKE_W(SPH_T32, 6, -, 8, +, 11, +, 14, -, 15) +#define Ws2 MAKE_W(SPH_T32, 0, +, 7, +, 9, -, 12, +, 15) +#define Ws3 MAKE_W(SPH_T32, 0, -, 1, +, 8, -, 10, +, 13) +#define Ws4 MAKE_W(SPH_T32, 1, +, 2, +, 9, -, 11, -, 14) +#define Ws5 MAKE_W(SPH_T32, 3, -, 2, +, 10, -, 12, +, 15) +#define Ws6 MAKE_W(SPH_T32, 4, -, 0, -, 3, -, 11, +, 13) +#define Ws7 MAKE_W(SPH_T32, 1, -, 4, -, 5, -, 12, -, 14) +#define Ws8 MAKE_W(SPH_T32, 2, -, 5, -, 6, +, 13, -, 15) +#define Ws9 MAKE_W(SPH_T32, 0, -, 3, +, 6, -, 7, +, 14) +#define Ws10 MAKE_W(SPH_T32, 8, -, 1, -, 4, -, 7, +, 15) +#define Ws11 MAKE_W(SPH_T32, 8, -, 0, -, 2, -, 5, +, 9) +#define Ws12 MAKE_W(SPH_T32, 1, +, 3, -, 6, -, 9, +, 10) +#define Ws13 MAKE_W(SPH_T32, 2, +, 4, +, 7, +, 10, +, 11) +#define Ws14 MAKE_W(SPH_T32, 3, -, 5, +, 8, -, 11, -, 12) +#define Ws15 MAKE_W(SPH_T32, 12, -, 4, -, 6, -, 9, +, 13) + +#if SPH_SMALL_FOOTPRINT_BMW + +#define MAKE_Qas do { \ + unsigned u; \ + sph_u32 Ws[16]; \ + Ws[ 0] = Ws0; \ + Ws[ 1] = Ws1; \ + Ws[ 2] = Ws2; \ + Ws[ 3] = Ws3; \ + Ws[ 4] = Ws4; \ + Ws[ 5] = Ws5; \ + Ws[ 6] = Ws6; \ + Ws[ 7] = Ws7; \ + Ws[ 8] = Ws8; \ + Ws[ 9] = Ws9; \ + Ws[10] = Ws10; \ + Ws[11] = Ws11; \ + Ws[12] = Ws12; \ + Ws[13] = Ws13; \ + Ws[14] = Ws14; \ + Ws[15] = Ws15; \ + for (u = 0; u < 15; u += 5) { \ + qt[u + 0] = SPH_T32(ss0(Ws[u + 0]) + H(u + 1)); \ + qt[u + 1] = SPH_T32(ss1(Ws[u + 1]) + H(u + 2)); \ + qt[u + 2] = SPH_T32(ss2(Ws[u + 2]) + H(u + 3)); \ + qt[u + 3] = SPH_T32(ss3(Ws[u + 3]) + H(u + 4)); \ + qt[u + 4] = SPH_T32(ss4(Ws[u + 4]) + H(u + 5)); \ + } \ + qt[15] = SPH_T32(ss0(Ws[15]) + H(0)); \ + } while (0) + +#define MAKE_Qbs do { \ + qt[16] = expand1s(Qs, M, H, 16); \ + qt[17] = expand1s(Qs, M, H, 17); \ + qt[18] = expand2s(Qs, M, H, 18); \ + qt[19] = expand2s(Qs, M, H, 19); \ + qt[20] = expand2s(Qs, M, H, 20); \ + qt[21] = expand2s(Qs, M, H, 21); \ + qt[22] = expand2s(Qs, M, H, 22); \ + qt[23] = expand2s(Qs, M, H, 23); \ + qt[24] = expand2s(Qs, M, H, 24); \ + qt[25] = expand2s(Qs, M, H, 25); \ + qt[26] = expand2s(Qs, M, H, 26); \ + qt[27] = expand2s(Qs, M, H, 27); \ + qt[28] = expand2s(Qs, M, H, 28); \ + qt[29] = expand2s(Qs, M, H, 29); \ + qt[30] = expand2s(Qs, M, H, 30); \ + qt[31] = expand2s(Qs, M, H, 31); \ + } while (0) + +#else + +#define MAKE_Qas do { \ + qt[ 0] = SPH_T32(ss0(Ws0 ) + H( 1)); \ + qt[ 1] = SPH_T32(ss1(Ws1 ) + H( 2)); \ + qt[ 2] = SPH_T32(ss2(Ws2 ) + H( 3)); \ + qt[ 3] = SPH_T32(ss3(Ws3 ) + H( 4)); \ + qt[ 4] = SPH_T32(ss4(Ws4 ) + H( 5)); \ + qt[ 5] = SPH_T32(ss0(Ws5 ) + H( 6)); \ + qt[ 6] = SPH_T32(ss1(Ws6 ) + H( 7)); \ + qt[ 7] = SPH_T32(ss2(Ws7 ) + H( 8)); \ + qt[ 8] = SPH_T32(ss3(Ws8 ) + H( 9)); \ + qt[ 9] = SPH_T32(ss4(Ws9 ) + H(10)); \ + qt[10] = SPH_T32(ss0(Ws10) + H(11)); \ + qt[11] = SPH_T32(ss1(Ws11) + H(12)); \ + qt[12] = SPH_T32(ss2(Ws12) + H(13)); \ + qt[13] = SPH_T32(ss3(Ws13) + H(14)); \ + qt[14] = SPH_T32(ss4(Ws14) + H(15)); \ + qt[15] = SPH_T32(ss0(Ws15) + H( 0)); \ + } while (0) + +#define MAKE_Qbs do { \ + qt[16] = expand1s(Qs, M, H, 16); \ + qt[17] = expand1s(Qs, M, H, 17); \ + qt[18] = expand2s(Qs, M, H, 18); \ + qt[19] = expand2s(Qs, M, H, 19); \ + qt[20] = expand2s(Qs, M, H, 20); \ + qt[21] = expand2s(Qs, M, H, 21); \ + qt[22] = expand2s(Qs, M, H, 22); \ + qt[23] = expand2s(Qs, M, H, 23); \ + qt[24] = expand2s(Qs, M, H, 24); \ + qt[25] = expand2s(Qs, M, H, 25); \ + qt[26] = expand2s(Qs, M, H, 26); \ + qt[27] = expand2s(Qs, M, H, 27); \ + qt[28] = expand2s(Qs, M, H, 28); \ + qt[29] = expand2s(Qs, M, H, 29); \ + qt[30] = expand2s(Qs, M, H, 30); \ + qt[31] = expand2s(Qs, M, H, 31); \ + } while (0) + +#endif + +#define MAKE_Qs do { \ + MAKE_Qas; \ + MAKE_Qbs; \ + } while (0) + +#define Qs(j) (qt[j]) + +#if SPH_64 + +#define Wb0 MAKE_W(SPH_T64, 5, -, 7, +, 10, +, 13, +, 14) +#define Wb1 MAKE_W(SPH_T64, 6, -, 8, +, 11, +, 14, -, 15) +#define Wb2 MAKE_W(SPH_T64, 0, +, 7, +, 9, -, 12, +, 15) +#define Wb3 MAKE_W(SPH_T64, 0, -, 1, +, 8, -, 10, +, 13) +#define Wb4 MAKE_W(SPH_T64, 1, +, 2, +, 9, -, 11, -, 14) +#define Wb5 MAKE_W(SPH_T64, 3, -, 2, +, 10, -, 12, +, 15) +#define Wb6 MAKE_W(SPH_T64, 4, -, 0, -, 3, -, 11, +, 13) +#define Wb7 MAKE_W(SPH_T64, 1, -, 4, -, 5, -, 12, -, 14) +#define Wb8 MAKE_W(SPH_T64, 2, -, 5, -, 6, +, 13, -, 15) +#define Wb9 MAKE_W(SPH_T64, 0, -, 3, +, 6, -, 7, +, 14) +#define Wb10 MAKE_W(SPH_T64, 8, -, 1, -, 4, -, 7, +, 15) +#define Wb11 MAKE_W(SPH_T64, 8, -, 0, -, 2, -, 5, +, 9) +#define Wb12 MAKE_W(SPH_T64, 1, +, 3, -, 6, -, 9, +, 10) +#define Wb13 MAKE_W(SPH_T64, 2, +, 4, +, 7, +, 10, +, 11) +#define Wb14 MAKE_W(SPH_T64, 3, -, 5, +, 8, -, 11, -, 12) +#define Wb15 MAKE_W(SPH_T64, 12, -, 4, -, 6, -, 9, +, 13) + +#if SPH_SMALL_FOOTPRINT_BMW + +#define MAKE_Qab do { \ + unsigned u; \ + sph_u64 Wb[16]; \ + Wb[ 0] = Wb0; \ + Wb[ 1] = Wb1; \ + Wb[ 2] = Wb2; \ + Wb[ 3] = Wb3; \ + Wb[ 4] = Wb4; \ + Wb[ 5] = Wb5; \ + Wb[ 6] = Wb6; \ + Wb[ 7] = Wb7; \ + Wb[ 8] = Wb8; \ + Wb[ 9] = Wb9; \ + Wb[10] = Wb10; \ + Wb[11] = Wb11; \ + Wb[12] = Wb12; \ + Wb[13] = Wb13; \ + Wb[14] = Wb14; \ + Wb[15] = Wb15; \ + for (u = 0; u < 15; u += 5) { \ + qt[u + 0] = SPH_T64(sb0(Wb[u + 0]) + H(u + 1)); \ + qt[u + 1] = SPH_T64(sb1(Wb[u + 1]) + H(u + 2)); \ + qt[u + 2] = SPH_T64(sb2(Wb[u + 2]) + H(u + 3)); \ + qt[u + 3] = SPH_T64(sb3(Wb[u + 3]) + H(u + 4)); \ + qt[u + 4] = SPH_T64(sb4(Wb[u + 4]) + H(u + 5)); \ + } \ + qt[15] = SPH_T64(sb0(Wb[15]) + H(0)); \ + } while (0) + +#define MAKE_Qbb do { \ + unsigned u; \ + for (u = 16; u < 18; u ++) \ + qt[u] = expand1b(Qb, M, H, u); \ + for (u = 18; u < 32; u ++) \ + qt[u] = expand2b(Qb, M, H, u); \ + } while (0) + +#else + +#define MAKE_Qab do { \ + qt[ 0] = SPH_T64(sb0(Wb0 ) + H( 1)); \ + qt[ 1] = SPH_T64(sb1(Wb1 ) + H( 2)); \ + qt[ 2] = SPH_T64(sb2(Wb2 ) + H( 3)); \ + qt[ 3] = SPH_T64(sb3(Wb3 ) + H( 4)); \ + qt[ 4] = SPH_T64(sb4(Wb4 ) + H( 5)); \ + qt[ 5] = SPH_T64(sb0(Wb5 ) + H( 6)); \ + qt[ 6] = SPH_T64(sb1(Wb6 ) + H( 7)); \ + qt[ 7] = SPH_T64(sb2(Wb7 ) + H( 8)); \ + qt[ 8] = SPH_T64(sb3(Wb8 ) + H( 9)); \ + qt[ 9] = SPH_T64(sb4(Wb9 ) + H(10)); \ + qt[10] = SPH_T64(sb0(Wb10) + H(11)); \ + qt[11] = SPH_T64(sb1(Wb11) + H(12)); \ + qt[12] = SPH_T64(sb2(Wb12) + H(13)); \ + qt[13] = SPH_T64(sb3(Wb13) + H(14)); \ + qt[14] = SPH_T64(sb4(Wb14) + H(15)); \ + qt[15] = SPH_T64(sb0(Wb15) + H( 0)); \ + } while (0) + +#define MAKE_Qbb do { \ + qt[16] = expand1b(Qb, M, H, 16); \ + qt[17] = expand1b(Qb, M, H, 17); \ + qt[18] = expand2b(Qb, M, H, 18); \ + qt[19] = expand2b(Qb, M, H, 19); \ + qt[20] = expand2b(Qb, M, H, 20); \ + qt[21] = expand2b(Qb, M, H, 21); \ + qt[22] = expand2b(Qb, M, H, 22); \ + qt[23] = expand2b(Qb, M, H, 23); \ + qt[24] = expand2b(Qb, M, H, 24); \ + qt[25] = expand2b(Qb, M, H, 25); \ + qt[26] = expand2b(Qb, M, H, 26); \ + qt[27] = expand2b(Qb, M, H, 27); \ + qt[28] = expand2b(Qb, M, H, 28); \ + qt[29] = expand2b(Qb, M, H, 29); \ + qt[30] = expand2b(Qb, M, H, 30); \ + qt[31] = expand2b(Qb, M, H, 31); \ + } while (0) + +#endif + +#define MAKE_Qb do { \ + MAKE_Qab; \ + MAKE_Qbb; \ + } while (0) + +#define Qb(j) (qt[j]) + +#endif + +#define FOLD(type, mkQ, tt, rol, mf, qf, dhf) do { \ + type qt[32], xl, xh; \ + mkQ; \ + xl = qf(16) ^ qf(17) ^ qf(18) ^ qf(19) \ + ^ qf(20) ^ qf(21) ^ qf(22) ^ qf(23); \ + xh = xl ^ qf(24) ^ qf(25) ^ qf(26) ^ qf(27) \ + ^ qf(28) ^ qf(29) ^ qf(30) ^ qf(31); \ + dhf( 0) = tt(((xh << 5) ^ (qf(16) >> 5) ^ mf( 0)) \ + + (xl ^ qf(24) ^ qf( 0))); \ + dhf( 1) = tt(((xh >> 7) ^ (qf(17) << 8) ^ mf( 1)) \ + + (xl ^ qf(25) ^ qf( 1))); \ + dhf( 2) = tt(((xh >> 5) ^ (qf(18) << 5) ^ mf( 2)) \ + + (xl ^ qf(26) ^ qf( 2))); \ + dhf( 3) = tt(((xh >> 1) ^ (qf(19) << 5) ^ mf( 3)) \ + + (xl ^ qf(27) ^ qf( 3))); \ + dhf( 4) = tt(((xh >> 3) ^ (qf(20) << 0) ^ mf( 4)) \ + + (xl ^ qf(28) ^ qf( 4))); \ + dhf( 5) = tt(((xh << 6) ^ (qf(21) >> 6) ^ mf( 5)) \ + + (xl ^ qf(29) ^ qf( 5))); \ + dhf( 6) = tt(((xh >> 4) ^ (qf(22) << 6) ^ mf( 6)) \ + + (xl ^ qf(30) ^ qf( 6))); \ + dhf( 7) = tt(((xh >> 11) ^ (qf(23) << 2) ^ mf( 7)) \ + + (xl ^ qf(31) ^ qf( 7))); \ + dhf( 8) = tt(rol(dhf(4), 9) + (xh ^ qf(24) ^ mf( 8)) \ + + ((xl << 8) ^ qf(23) ^ qf( 8))); \ + dhf( 9) = tt(rol(dhf(5), 10) + (xh ^ qf(25) ^ mf( 9)) \ + + ((xl >> 6) ^ qf(16) ^ qf( 9))); \ + dhf(10) = tt(rol(dhf(6), 11) + (xh ^ qf(26) ^ mf(10)) \ + + ((xl << 6) ^ qf(17) ^ qf(10))); \ + dhf(11) = tt(rol(dhf(7), 12) + (xh ^ qf(27) ^ mf(11)) \ + + ((xl << 4) ^ qf(18) ^ qf(11))); \ + dhf(12) = tt(rol(dhf(0), 13) + (xh ^ qf(28) ^ mf(12)) \ + + ((xl >> 3) ^ qf(19) ^ qf(12))); \ + dhf(13) = tt(rol(dhf(1), 14) + (xh ^ qf(29) ^ mf(13)) \ + + ((xl >> 4) ^ qf(20) ^ qf(13))); \ + dhf(14) = tt(rol(dhf(2), 15) + (xh ^ qf(30) ^ mf(14)) \ + + ((xl >> 7) ^ qf(21) ^ qf(14))); \ + dhf(15) = tt(rol(dhf(3), 16) + (xh ^ qf(31) ^ mf(15)) \ + + ((xl >> 2) ^ qf(22) ^ qf(15))); \ + } while (0) + +#define FOLDs FOLD(sph_u32, MAKE_Qs, SPH_T32, SPH_ROTL32, M, Qs, dH) + +#if SPH_64 + +#define FOLDb FOLD(sph_u64, MAKE_Qb, SPH_T64, SPH_ROTL64, M, Qb, dH) + +#endif + +static void +compress_small(const unsigned char *data, const sph_u32 h[16], sph_u32 dh[16]) +{ +#if SPH_LITTLE_FAST +#define M(x) sph_dec32le_aligned(data + 4 * (x)) +#else + sph_u32 mv[16]; + + mv[ 0] = sph_dec32le_aligned(data + 0); + mv[ 1] = sph_dec32le_aligned(data + 4); + mv[ 2] = sph_dec32le_aligned(data + 8); + mv[ 3] = sph_dec32le_aligned(data + 12); + mv[ 4] = sph_dec32le_aligned(data + 16); + mv[ 5] = sph_dec32le_aligned(data + 20); + mv[ 6] = sph_dec32le_aligned(data + 24); + mv[ 7] = sph_dec32le_aligned(data + 28); + mv[ 8] = sph_dec32le_aligned(data + 32); + mv[ 9] = sph_dec32le_aligned(data + 36); + mv[10] = sph_dec32le_aligned(data + 40); + mv[11] = sph_dec32le_aligned(data + 44); + mv[12] = sph_dec32le_aligned(data + 48); + mv[13] = sph_dec32le_aligned(data + 52); + mv[14] = sph_dec32le_aligned(data + 56); + mv[15] = sph_dec32le_aligned(data + 60); +#define M(x) (mv[x]) +#endif +#define H(x) (h[x]) +#define dH(x) (dh[x]) + + FOLDs; + +#undef M +#undef H +#undef dH +} + +static const sph_u32 final_s[16] = { + SPH_C32(0xaaaaaaa0), SPH_C32(0xaaaaaaa1), SPH_C32(0xaaaaaaa2), + SPH_C32(0xaaaaaaa3), SPH_C32(0xaaaaaaa4), SPH_C32(0xaaaaaaa5), + SPH_C32(0xaaaaaaa6), SPH_C32(0xaaaaaaa7), SPH_C32(0xaaaaaaa8), + SPH_C32(0xaaaaaaa9), SPH_C32(0xaaaaaaaa), SPH_C32(0xaaaaaaab), + SPH_C32(0xaaaaaaac), SPH_C32(0xaaaaaaad), SPH_C32(0xaaaaaaae), + SPH_C32(0xaaaaaaaf) +}; + +static void +bmw32_init(sph_bmw_small_context *sc, const sph_u32 *iv) +{ + memcpy(sc->H, iv, sizeof sc->H); + sc->ptr = 0; +#if SPH_64 + sc->bit_count = 0; +#else + sc->bit_count_high = 0; + sc->bit_count_low = 0; +#endif +} + +static void +bmw32(sph_bmw_small_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + sph_u32 htmp[16]; + sph_u32 *h1, *h2; +#if !SPH_64 + sph_u32 tmp; +#endif + +#if SPH_64 + sc->bit_count += (sph_u64)len << 3; +#else + tmp = sc->bit_count_low; + sc->bit_count_low = SPH_T32(tmp + ((sph_u32)len << 3)); + if (sc->bit_count_low < tmp) + sc->bit_count_high ++; + sc->bit_count_high += len >> 29; +#endif + buf = sc->buf; + ptr = sc->ptr; + h1 = sc->H; + h2 = htmp; + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + data = (const unsigned char *)data + clen; + len -= clen; + ptr += clen; + if (ptr == sizeof sc->buf) { + sph_u32 *ht; + + compress_small(buf, h1, h2); + ht = h1; + h1 = h2; + h2 = ht; + ptr = 0; + } + } + sc->ptr = ptr; + if (h1 != sc->H) + memcpy(sc->H, h1, sizeof sc->H); +} + +static void +bmw32_close(sph_bmw_small_context *sc, unsigned ub, unsigned n, + void *dst, size_t out_size_w32) +{ + unsigned char *buf, *out; + size_t ptr, u, v; + unsigned z; + sph_u32 h1[16], h2[16], *h; + + buf = sc->buf; + ptr = sc->ptr; + z = 0x80 >> n; + buf[ptr ++] = ((ub & -z) | z) & 0xFF; + h = sc->H; + if (ptr > (sizeof sc->buf) - 8) { + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + compress_small(buf, h, h1); + ptr = 0; + h = h1; + } + memset(buf + ptr, 0, (sizeof sc->buf) - 8 - ptr); +#if SPH_64 + sph_enc64le_aligned(buf + (sizeof sc->buf) - 8, + SPH_T64(sc->bit_count + n)); +#else + sph_enc32le_aligned(buf + (sizeof sc->buf) - 8, + sc->bit_count_low + n); + sph_enc32le_aligned(buf + (sizeof sc->buf) - 4, + SPH_T32(sc->bit_count_high)); +#endif + compress_small(buf, h, h2); + for (u = 0; u < 16; u ++) + sph_enc32le_aligned(buf + 4 * u, h2[u]); + compress_small(buf, final_s, h1); + out = dst; + for (u = 0, v = 16 - out_size_w32; u < out_size_w32; u ++, v ++) + sph_enc32le(out + 4 * u, h1[v]); +} + +#if SPH_64 + +static void +compress_big(const unsigned char *data, const sph_u64 h[16], sph_u64 dh[16]) +{ +#if SPH_LITTLE_FAST +#define M(x) sph_dec64le_aligned(data + 8 * (x)) +#else + sph_u64 mv[16]; + + mv[ 0] = sph_dec64le_aligned(data + 0); + mv[ 1] = sph_dec64le_aligned(data + 8); + mv[ 2] = sph_dec64le_aligned(data + 16); + mv[ 3] = sph_dec64le_aligned(data + 24); + mv[ 4] = sph_dec64le_aligned(data + 32); + mv[ 5] = sph_dec64le_aligned(data + 40); + mv[ 6] = sph_dec64le_aligned(data + 48); + mv[ 7] = sph_dec64le_aligned(data + 56); + mv[ 8] = sph_dec64le_aligned(data + 64); + mv[ 9] = sph_dec64le_aligned(data + 72); + mv[10] = sph_dec64le_aligned(data + 80); + mv[11] = sph_dec64le_aligned(data + 88); + mv[12] = sph_dec64le_aligned(data + 96); + mv[13] = sph_dec64le_aligned(data + 104); + mv[14] = sph_dec64le_aligned(data + 112); + mv[15] = sph_dec64le_aligned(data + 120); +#define M(x) (mv[x]) +#endif +#define H(x) (h[x]) +#define dH(x) (dh[x]) + + FOLDb; + +#undef M +#undef H +#undef dH +} + +static const sph_u64 final_b[16] = { + SPH_C64(0xaaaaaaaaaaaaaaa0), SPH_C64(0xaaaaaaaaaaaaaaa1), + SPH_C64(0xaaaaaaaaaaaaaaa2), SPH_C64(0xaaaaaaaaaaaaaaa3), + SPH_C64(0xaaaaaaaaaaaaaaa4), SPH_C64(0xaaaaaaaaaaaaaaa5), + SPH_C64(0xaaaaaaaaaaaaaaa6), SPH_C64(0xaaaaaaaaaaaaaaa7), + SPH_C64(0xaaaaaaaaaaaaaaa8), SPH_C64(0xaaaaaaaaaaaaaaa9), + SPH_C64(0xaaaaaaaaaaaaaaaa), SPH_C64(0xaaaaaaaaaaaaaaab), + SPH_C64(0xaaaaaaaaaaaaaaac), SPH_C64(0xaaaaaaaaaaaaaaad), + SPH_C64(0xaaaaaaaaaaaaaaae), SPH_C64(0xaaaaaaaaaaaaaaaf) +}; + +static void +bmw64_init(sph_bmw_big_context *sc, const sph_u64 *iv) +{ + memcpy(sc->H, iv, sizeof sc->H); + sc->ptr = 0; + sc->bit_count = 0; +} + +static void +bmw64(sph_bmw_big_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + sph_u64 htmp[16]; + sph_u64 *h1, *h2; + + sc->bit_count += (sph_u64)len << 3; + buf = sc->buf; + ptr = sc->ptr; + h1 = sc->H; + h2 = htmp; + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + data = (const unsigned char *)data + clen; + len -= clen; + ptr += clen; + if (ptr == sizeof sc->buf) { + sph_u64 *ht; + + compress_big(buf, h1, h2); + ht = h1; + h1 = h2; + h2 = ht; + ptr = 0; + } + } + sc->ptr = ptr; + if (h1 != sc->H) + memcpy(sc->H, h1, sizeof sc->H); +} + +static void +bmw64_close(sph_bmw_big_context *sc, unsigned ub, unsigned n, + void *dst, size_t out_size_w64) +{ + unsigned char *buf, *out; + size_t ptr, u, v; + unsigned z; + sph_u64 h1[16], h2[16], *h; + + buf = sc->buf; + ptr = sc->ptr; + z = 0x80 >> n; + buf[ptr ++] = ((ub & -z) | z) & 0xFF; + h = sc->H; + if (ptr > (sizeof sc->buf) - 8) { + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + compress_big(buf, h, h1); + ptr = 0; + h = h1; + } + memset(buf + ptr, 0, (sizeof sc->buf) - 8 - ptr); + sph_enc64le_aligned(buf + (sizeof sc->buf) - 8, + SPH_T64(sc->bit_count + n)); + compress_big(buf, h, h2); + for (u = 0; u < 16; u ++) + sph_enc64le_aligned(buf + 8 * u, h2[u]); + compress_big(buf, final_b, h1); + out = dst; + for (u = 0, v = 16 - out_size_w64; u < out_size_w64; u ++, v ++) + sph_enc64le(out + 8 * u, h1[v]); +} + +#endif + +/* see sph_bmw.h */ +void +sph_bmw224_init(void *cc) +{ + bmw32_init(cc, IV224); +} + +/* see sph_bmw.h */ +void +sph_bmw224(void *cc, const void *data, size_t len) +{ + bmw32(cc, data, len); +} + +/* see sph_bmw.h */ +void +sph_bmw224_close(void *cc, void *dst) +{ + sph_bmw224_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_bmw.h */ +void +sph_bmw224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + bmw32_close(cc, ub, n, dst, 7); + sph_bmw224_init(cc); +} + +/* see sph_bmw.h */ +void +sph_bmw256_init(void *cc) +{ + bmw32_init(cc, IV256); +} + +/* see sph_bmw.h */ +void +sph_bmw256(void *cc, const void *data, size_t len) +{ + bmw32(cc, data, len); +} + +/* see sph_bmw.h */ +void +sph_bmw256_close(void *cc, void *dst) +{ + sph_bmw256_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_bmw.h */ +void +sph_bmw256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + bmw32_close(cc, ub, n, dst, 8); + sph_bmw256_init(cc); +} + +#if SPH_64 + +/* see sph_bmw.h */ +void +sph_bmw384_init(void *cc) +{ + bmw64_init(cc, IV384); +} + +/* see sph_bmw.h */ +void +sph_bmw384(void *cc, const void *data, size_t len) +{ + bmw64(cc, data, len); +} + +/* see sph_bmw.h */ +void +sph_bmw384_close(void *cc, void *dst) +{ + sph_bmw384_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_bmw.h */ +void +sph_bmw384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + bmw64_close(cc, ub, n, dst, 6); + sph_bmw384_init(cc); +} + +/* see sph_bmw.h */ +void +sph_bmw512_init(void *cc) +{ + bmw64_init(cc, IV512); +} + +/* see sph_bmw.h */ +void +sph_bmw512(void *cc, const void *data, size_t len) +{ + bmw64(cc, data, len); +} + +/* see sph_bmw.h */ +void +sph_bmw512_close(void *cc, void *dst) +{ + sph_bmw512_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_bmw.h */ +void +sph_bmw512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + bmw64_close(cc, ub, n, dst, 8); + sph_bmw512_init(cc); +} + +#endif diff --git a/sph/cubehash.c b/sph/cubehash.c new file mode 100644 index 0000000..9322fe1 --- /dev/null +++ b/sph/cubehash.c @@ -0,0 +1,723 @@ +/* $Id: cubehash.c 227 2010-06-16 17:28:38Z tp $ */ +/* + * CubeHash implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include +#include + +#include "sph_cubehash.h" +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_CUBEHASH +#define SPH_SMALL_FOOTPRINT_CUBEHASH 1 +#endif + +/* + * Some tests were conducted on an Intel Core2 Q6600 (32-bit and 64-bit + * mode), a PowerPC G3, and a MIPS-compatible CPU (Broadcom BCM3302). + * It appears that the optimal settings are: + * -- full unroll, no state copy on the "big" systems (x86, PowerPC) + * -- unroll to 4 or 8, state copy on the "small" system (MIPS) + */ + +#if SPH_SMALL_FOOTPRINT_CUBEHASH + +#if !defined SPH_CUBEHASH_UNROLL +#define SPH_CUBEHASH_UNROLL 4 +#endif +#if !defined SPH_CUBEHASH_NOCOPY +#define SPH_CUBEHASH_NOCOPY 1 +#endif + +#else + +#if !defined SPH_CUBEHASH_UNROLL +#define SPH_CUBEHASH_UNROLL 0 +#endif +#if !defined SPH_CUBEHASH_NOCOPY +#define SPH_CUBEHASH_NOCOPY 0 +#endif + +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +static const sph_u32 IV224[] = { + SPH_C32(0xB0FC8217), SPH_C32(0x1BEE1A90), SPH_C32(0x829E1A22), + SPH_C32(0x6362C342), SPH_C32(0x24D91C30), SPH_C32(0x03A7AA24), + SPH_C32(0xA63721C8), SPH_C32(0x85B0E2EF), SPH_C32(0xF35D13F3), + SPH_C32(0x41DA807D), SPH_C32(0x21A70CA6), SPH_C32(0x1F4E9774), + SPH_C32(0xB3E1C932), SPH_C32(0xEB0A79A8), SPH_C32(0xCDDAAA66), + SPH_C32(0xE2F6ECAA), SPH_C32(0x0A713362), SPH_C32(0xAA3080E0), + SPH_C32(0xD8F23A32), SPH_C32(0xCEF15E28), SPH_C32(0xDB086314), + SPH_C32(0x7F709DF7), SPH_C32(0xACD228A4), SPH_C32(0x704D6ECE), + SPH_C32(0xAA3EC95F), SPH_C32(0xE387C214), SPH_C32(0x3A6445FF), + SPH_C32(0x9CAB81C3), SPH_C32(0xC73D4B98), SPH_C32(0xD277AEBE), + SPH_C32(0xFD20151C), SPH_C32(0x00CB573E) +}; + +static const sph_u32 IV256[] = { + SPH_C32(0xEA2BD4B4), SPH_C32(0xCCD6F29F), SPH_C32(0x63117E71), + SPH_C32(0x35481EAE), SPH_C32(0x22512D5B), SPH_C32(0xE5D94E63), + SPH_C32(0x7E624131), SPH_C32(0xF4CC12BE), SPH_C32(0xC2D0B696), + SPH_C32(0x42AF2070), SPH_C32(0xD0720C35), SPH_C32(0x3361DA8C), + SPH_C32(0x28CCECA4), SPH_C32(0x8EF8AD83), SPH_C32(0x4680AC00), + SPH_C32(0x40E5FBAB), SPH_C32(0xD89041C3), SPH_C32(0x6107FBD5), + SPH_C32(0x6C859D41), SPH_C32(0xF0B26679), SPH_C32(0x09392549), + SPH_C32(0x5FA25603), SPH_C32(0x65C892FD), SPH_C32(0x93CB6285), + SPH_C32(0x2AF2B5AE), SPH_C32(0x9E4B4E60), SPH_C32(0x774ABFDD), + SPH_C32(0x85254725), SPH_C32(0x15815AEB), SPH_C32(0x4AB6AAD6), + SPH_C32(0x9CDAF8AF), SPH_C32(0xD6032C0A) +}; + +static const sph_u32 IV384[] = { + SPH_C32(0xE623087E), SPH_C32(0x04C00C87), SPH_C32(0x5EF46453), + SPH_C32(0x69524B13), SPH_C32(0x1A05C7A9), SPH_C32(0x3528DF88), + SPH_C32(0x6BDD01B5), SPH_C32(0x5057B792), SPH_C32(0x6AA7A922), + SPH_C32(0x649C7EEE), SPH_C32(0xF426309F), SPH_C32(0xCB629052), + SPH_C32(0xFC8E20ED), SPH_C32(0xB3482BAB), SPH_C32(0xF89E5E7E), + SPH_C32(0xD83D4DE4), SPH_C32(0x44BFC10D), SPH_C32(0x5FC1E63D), + SPH_C32(0x2104E6CB), SPH_C32(0x17958F7F), SPH_C32(0xDBEAEF70), + SPH_C32(0xB4B97E1E), SPH_C32(0x32C195F6), SPH_C32(0x6184A8E4), + SPH_C32(0x796C2543), SPH_C32(0x23DE176D), SPH_C32(0xD33BBAEC), + SPH_C32(0x0C12E5D2), SPH_C32(0x4EB95A7B), SPH_C32(0x2D18BA01), + SPH_C32(0x04EE475F), SPH_C32(0x1FC5F22E) +}; + +static const sph_u32 IV512[] = { + SPH_C32(0x2AEA2A61), SPH_C32(0x50F494D4), SPH_C32(0x2D538B8B), + SPH_C32(0x4167D83E), SPH_C32(0x3FEE2313), SPH_C32(0xC701CF8C), + SPH_C32(0xCC39968E), SPH_C32(0x50AC5695), SPH_C32(0x4D42C787), + SPH_C32(0xA647A8B3), SPH_C32(0x97CF0BEF), SPH_C32(0x825B4537), + SPH_C32(0xEEF864D2), SPH_C32(0xF22090C4), SPH_C32(0xD0E5CD33), + SPH_C32(0xA23911AE), SPH_C32(0xFCD398D9), SPH_C32(0x148FE485), + SPH_C32(0x1B017BEF), SPH_C32(0xB6444532), SPH_C32(0x6A536159), + SPH_C32(0x2FF5781C), SPH_C32(0x91FA7934), SPH_C32(0x0DBADEA9), + SPH_C32(0xD65C8A2B), SPH_C32(0xA5A70E75), SPH_C32(0xB1C62456), + SPH_C32(0xBC796576), SPH_C32(0x1921C8F7), SPH_C32(0xE7989AF1), + SPH_C32(0x7795D246), SPH_C32(0xD43E3B44) +}; + +#define T32 SPH_T32 +#define ROTL32 SPH_ROTL32 + +#if SPH_CUBEHASH_NOCOPY + +#define DECL_STATE +#define READ_STATE(cc) +#define WRITE_STATE(cc) + +#define x0 ((sc)->state[ 0]) +#define x1 ((sc)->state[ 1]) +#define x2 ((sc)->state[ 2]) +#define x3 ((sc)->state[ 3]) +#define x4 ((sc)->state[ 4]) +#define x5 ((sc)->state[ 5]) +#define x6 ((sc)->state[ 6]) +#define x7 ((sc)->state[ 7]) +#define x8 ((sc)->state[ 8]) +#define x9 ((sc)->state[ 9]) +#define xa ((sc)->state[10]) +#define xb ((sc)->state[11]) +#define xc ((sc)->state[12]) +#define xd ((sc)->state[13]) +#define xe ((sc)->state[14]) +#define xf ((sc)->state[15]) +#define xg ((sc)->state[16]) +#define xh ((sc)->state[17]) +#define xi ((sc)->state[18]) +#define xj ((sc)->state[19]) +#define xk ((sc)->state[20]) +#define xl ((sc)->state[21]) +#define xm ((sc)->state[22]) +#define xn ((sc)->state[23]) +#define xo ((sc)->state[24]) +#define xp ((sc)->state[25]) +#define xq ((sc)->state[26]) +#define xr ((sc)->state[27]) +#define xs ((sc)->state[28]) +#define xt ((sc)->state[29]) +#define xu ((sc)->state[30]) +#define xv ((sc)->state[31]) + +#else + +#define DECL_STATE \ + sph_u32 x0, x1, x2, x3, x4, x5, x6, x7; \ + sph_u32 x8, x9, xa, xb, xc, xd, xe, xf; \ + sph_u32 xg, xh, xi, xj, xk, xl, xm, xn; \ + sph_u32 xo, xp, xq, xr, xs, xt, xu, xv; + +#define READ_STATE(cc) do { \ + x0 = (cc)->state[ 0]; \ + x1 = (cc)->state[ 1]; \ + x2 = (cc)->state[ 2]; \ + x3 = (cc)->state[ 3]; \ + x4 = (cc)->state[ 4]; \ + x5 = (cc)->state[ 5]; \ + x6 = (cc)->state[ 6]; \ + x7 = (cc)->state[ 7]; \ + x8 = (cc)->state[ 8]; \ + x9 = (cc)->state[ 9]; \ + xa = (cc)->state[10]; \ + xb = (cc)->state[11]; \ + xc = (cc)->state[12]; \ + xd = (cc)->state[13]; \ + xe = (cc)->state[14]; \ + xf = (cc)->state[15]; \ + xg = (cc)->state[16]; \ + xh = (cc)->state[17]; \ + xi = (cc)->state[18]; \ + xj = (cc)->state[19]; \ + xk = (cc)->state[20]; \ + xl = (cc)->state[21]; \ + xm = (cc)->state[22]; \ + xn = (cc)->state[23]; \ + xo = (cc)->state[24]; \ + xp = (cc)->state[25]; \ + xq = (cc)->state[26]; \ + xr = (cc)->state[27]; \ + xs = (cc)->state[28]; \ + xt = (cc)->state[29]; \ + xu = (cc)->state[30]; \ + xv = (cc)->state[31]; \ + } while (0) + +#define WRITE_STATE(cc) do { \ + (cc)->state[ 0] = x0; \ + (cc)->state[ 1] = x1; \ + (cc)->state[ 2] = x2; \ + (cc)->state[ 3] = x3; \ + (cc)->state[ 4] = x4; \ + (cc)->state[ 5] = x5; \ + (cc)->state[ 6] = x6; \ + (cc)->state[ 7] = x7; \ + (cc)->state[ 8] = x8; \ + (cc)->state[ 9] = x9; \ + (cc)->state[10] = xa; \ + (cc)->state[11] = xb; \ + (cc)->state[12] = xc; \ + (cc)->state[13] = xd; \ + (cc)->state[14] = xe; \ + (cc)->state[15] = xf; \ + (cc)->state[16] = xg; \ + (cc)->state[17] = xh; \ + (cc)->state[18] = xi; \ + (cc)->state[19] = xj; \ + (cc)->state[20] = xk; \ + (cc)->state[21] = xl; \ + (cc)->state[22] = xm; \ + (cc)->state[23] = xn; \ + (cc)->state[24] = xo; \ + (cc)->state[25] = xp; \ + (cc)->state[26] = xq; \ + (cc)->state[27] = xr; \ + (cc)->state[28] = xs; \ + (cc)->state[29] = xt; \ + (cc)->state[30] = xu; \ + (cc)->state[31] = xv; \ + } while (0) + +#endif + +#define INPUT_BLOCK do { \ + x0 ^= sph_dec32le_aligned(buf + 0); \ + x1 ^= sph_dec32le_aligned(buf + 4); \ + x2 ^= sph_dec32le_aligned(buf + 8); \ + x3 ^= sph_dec32le_aligned(buf + 12); \ + x4 ^= sph_dec32le_aligned(buf + 16); \ + x5 ^= sph_dec32le_aligned(buf + 20); \ + x6 ^= sph_dec32le_aligned(buf + 24); \ + x7 ^= sph_dec32le_aligned(buf + 28); \ + } while (0) + +#define ROUND_EVEN do { \ + xg = T32(x0 + xg); \ + x0 = ROTL32(x0, 7); \ + xh = T32(x1 + xh); \ + x1 = ROTL32(x1, 7); \ + xi = T32(x2 + xi); \ + x2 = ROTL32(x2, 7); \ + xj = T32(x3 + xj); \ + x3 = ROTL32(x3, 7); \ + xk = T32(x4 + xk); \ + x4 = ROTL32(x4, 7); \ + xl = T32(x5 + xl); \ + x5 = ROTL32(x5, 7); \ + xm = T32(x6 + xm); \ + x6 = ROTL32(x6, 7); \ + xn = T32(x7 + xn); \ + x7 = ROTL32(x7, 7); \ + xo = T32(x8 + xo); \ + x8 = ROTL32(x8, 7); \ + xp = T32(x9 + xp); \ + x9 = ROTL32(x9, 7); \ + xq = T32(xa + xq); \ + xa = ROTL32(xa, 7); \ + xr = T32(xb + xr); \ + xb = ROTL32(xb, 7); \ + xs = T32(xc + xs); \ + xc = ROTL32(xc, 7); \ + xt = T32(xd + xt); \ + xd = ROTL32(xd, 7); \ + xu = T32(xe + xu); \ + xe = ROTL32(xe, 7); \ + xv = T32(xf + xv); \ + xf = ROTL32(xf, 7); \ + x8 ^= xg; \ + x9 ^= xh; \ + xa ^= xi; \ + xb ^= xj; \ + xc ^= xk; \ + xd ^= xl; \ + xe ^= xm; \ + xf ^= xn; \ + x0 ^= xo; \ + x1 ^= xp; \ + x2 ^= xq; \ + x3 ^= xr; \ + x4 ^= xs; \ + x5 ^= xt; \ + x6 ^= xu; \ + x7 ^= xv; \ + xi = T32(x8 + xi); \ + x8 = ROTL32(x8, 11); \ + xj = T32(x9 + xj); \ + x9 = ROTL32(x9, 11); \ + xg = T32(xa + xg); \ + xa = ROTL32(xa, 11); \ + xh = T32(xb + xh); \ + xb = ROTL32(xb, 11); \ + xm = T32(xc + xm); \ + xc = ROTL32(xc, 11); \ + xn = T32(xd + xn); \ + xd = ROTL32(xd, 11); \ + xk = T32(xe + xk); \ + xe = ROTL32(xe, 11); \ + xl = T32(xf + xl); \ + xf = ROTL32(xf, 11); \ + xq = T32(x0 + xq); \ + x0 = ROTL32(x0, 11); \ + xr = T32(x1 + xr); \ + x1 = ROTL32(x1, 11); \ + xo = T32(x2 + xo); \ + x2 = ROTL32(x2, 11); \ + xp = T32(x3 + xp); \ + x3 = ROTL32(x3, 11); \ + xu = T32(x4 + xu); \ + x4 = ROTL32(x4, 11); \ + xv = T32(x5 + xv); \ + x5 = ROTL32(x5, 11); \ + xs = T32(x6 + xs); \ + x6 = ROTL32(x6, 11); \ + xt = T32(x7 + xt); \ + x7 = ROTL32(x7, 11); \ + xc ^= xi; \ + xd ^= xj; \ + xe ^= xg; \ + xf ^= xh; \ + x8 ^= xm; \ + x9 ^= xn; \ + xa ^= xk; \ + xb ^= xl; \ + x4 ^= xq; \ + x5 ^= xr; \ + x6 ^= xo; \ + x7 ^= xp; \ + x0 ^= xu; \ + x1 ^= xv; \ + x2 ^= xs; \ + x3 ^= xt; \ + } while (0) + +#define ROUND_ODD do { \ + xj = T32(xc + xj); \ + xc = ROTL32(xc, 7); \ + xi = T32(xd + xi); \ + xd = ROTL32(xd, 7); \ + xh = T32(xe + xh); \ + xe = ROTL32(xe, 7); \ + xg = T32(xf + xg); \ + xf = ROTL32(xf, 7); \ + xn = T32(x8 + xn); \ + x8 = ROTL32(x8, 7); \ + xm = T32(x9 + xm); \ + x9 = ROTL32(x9, 7); \ + xl = T32(xa + xl); \ + xa = ROTL32(xa, 7); \ + xk = T32(xb + xk); \ + xb = ROTL32(xb, 7); \ + xr = T32(x4 + xr); \ + x4 = ROTL32(x4, 7); \ + xq = T32(x5 + xq); \ + x5 = ROTL32(x5, 7); \ + xp = T32(x6 + xp); \ + x6 = ROTL32(x6, 7); \ + xo = T32(x7 + xo); \ + x7 = ROTL32(x7, 7); \ + xv = T32(x0 + xv); \ + x0 = ROTL32(x0, 7); \ + xu = T32(x1 + xu); \ + x1 = ROTL32(x1, 7); \ + xt = T32(x2 + xt); \ + x2 = ROTL32(x2, 7); \ + xs = T32(x3 + xs); \ + x3 = ROTL32(x3, 7); \ + x4 ^= xj; \ + x5 ^= xi; \ + x6 ^= xh; \ + x7 ^= xg; \ + x0 ^= xn; \ + x1 ^= xm; \ + x2 ^= xl; \ + x3 ^= xk; \ + xc ^= xr; \ + xd ^= xq; \ + xe ^= xp; \ + xf ^= xo; \ + x8 ^= xv; \ + x9 ^= xu; \ + xa ^= xt; \ + xb ^= xs; \ + xh = T32(x4 + xh); \ + x4 = ROTL32(x4, 11); \ + xg = T32(x5 + xg); \ + x5 = ROTL32(x5, 11); \ + xj = T32(x6 + xj); \ + x6 = ROTL32(x6, 11); \ + xi = T32(x7 + xi); \ + x7 = ROTL32(x7, 11); \ + xl = T32(x0 + xl); \ + x0 = ROTL32(x0, 11); \ + xk = T32(x1 + xk); \ + x1 = ROTL32(x1, 11); \ + xn = T32(x2 + xn); \ + x2 = ROTL32(x2, 11); \ + xm = T32(x3 + xm); \ + x3 = ROTL32(x3, 11); \ + xp = T32(xc + xp); \ + xc = ROTL32(xc, 11); \ + xo = T32(xd + xo); \ + xd = ROTL32(xd, 11); \ + xr = T32(xe + xr); \ + xe = ROTL32(xe, 11); \ + xq = T32(xf + xq); \ + xf = ROTL32(xf, 11); \ + xt = T32(x8 + xt); \ + x8 = ROTL32(x8, 11); \ + xs = T32(x9 + xs); \ + x9 = ROTL32(x9, 11); \ + xv = T32(xa + xv); \ + xa = ROTL32(xa, 11); \ + xu = T32(xb + xu); \ + xb = ROTL32(xb, 11); \ + x0 ^= xh; \ + x1 ^= xg; \ + x2 ^= xj; \ + x3 ^= xi; \ + x4 ^= xl; \ + x5 ^= xk; \ + x6 ^= xn; \ + x7 ^= xm; \ + x8 ^= xp; \ + x9 ^= xo; \ + xa ^= xr; \ + xb ^= xq; \ + xc ^= xt; \ + xd ^= xs; \ + xe ^= xv; \ + xf ^= xu; \ + } while (0) + +/* + * There is no need to unroll all 16 rounds. The word-swapping permutation + * is an involution, so we need to unroll an even number of rounds. On + * "big" systems, unrolling 4 rounds yields about 97% of the speed + * achieved with full unrolling; and it keeps the code more compact + * for small architectures. + */ + +#if SPH_CUBEHASH_UNROLL == 2 + +#define SIXTEEN_ROUNDS do { \ + int j; \ + for (j = 0; j < 8; j ++) { \ + ROUND_EVEN; \ + ROUND_ODD; \ + } \ + } while (0) + +#elif SPH_CUBEHASH_UNROLL == 4 + +#define SIXTEEN_ROUNDS do { \ + int j; \ + for (j = 0; j < 4; j ++) { \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + } \ + } while (0) + +#elif SPH_CUBEHASH_UNROLL == 8 + +#define SIXTEEN_ROUNDS do { \ + int j; \ + for (j = 0; j < 2; j ++) { \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + } \ + } while (0) + +#else + +#define SIXTEEN_ROUNDS do { \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + ROUND_EVEN; \ + ROUND_ODD; \ + } while (0) + +#endif + +static void +cubehash_init(sph_cubehash_context *sc, const sph_u32 *iv) +{ + memcpy(sc->state, iv, sizeof sc->state); + sc->ptr = 0; +} + +static void +cubehash_core(sph_cubehash_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + INPUT_BLOCK; + SIXTEEN_ROUNDS; + ptr = 0; + } + } + WRITE_STATE(sc); + sc->ptr = ptr; +} + +static void +cubehash_close(sph_cubehash_context *sc, unsigned ub, unsigned n, + void *dst, size_t out_size_w32) +{ + unsigned char *buf, *out; + size_t ptr; + unsigned z; + int i; + DECL_STATE + + buf = sc->buf; + ptr = sc->ptr; + z = 0x80 >> n; + buf[ptr ++] = ((ub & -z) | z) & 0xFF; + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + READ_STATE(sc); + INPUT_BLOCK; + for (i = 0; i < 11; i ++) { + SIXTEEN_ROUNDS; + if (i == 0) + xv ^= SPH_C32(1); + } + WRITE_STATE(sc); + out = dst; + for (z = 0; z < out_size_w32; z ++) + sph_enc32le(out + (z << 2), sc->state[z]); +} + +/* see sph_cubehash.h */ +void +sph_cubehash224_init(void *cc) +{ + cubehash_init(cc, IV224); +} + +/* see sph_cubehash.h */ +void +sph_cubehash224(void *cc, const void *data, size_t len) +{ + cubehash_core(cc, data, len); +} + +/* see sph_cubehash.h */ +void +sph_cubehash224_close(void *cc, void *dst) +{ + sph_cubehash224_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_cubehash.h */ +void +sph_cubehash224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + cubehash_close(cc, ub, n, dst, 7); + sph_cubehash224_init(cc); +} + +/* see sph_cubehash.h */ +void +sph_cubehash256_init(void *cc) +{ + cubehash_init(cc, IV256); +} + +/* see sph_cubehash.h */ +void +sph_cubehash256(void *cc, const void *data, size_t len) +{ + cubehash_core(cc, data, len); +} + +/* see sph_cubehash.h */ +void +sph_cubehash256_close(void *cc, void *dst) +{ + sph_cubehash256_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_cubehash.h */ +void +sph_cubehash256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + cubehash_close(cc, ub, n, dst, 8); + sph_cubehash256_init(cc); +} + +/* see sph_cubehash.h */ +void +sph_cubehash384_init(void *cc) +{ + cubehash_init(cc, IV384); +} + +/* see sph_cubehash.h */ +void +sph_cubehash384(void *cc, const void *data, size_t len) +{ + cubehash_core(cc, data, len); +} + +/* see sph_cubehash.h */ +void +sph_cubehash384_close(void *cc, void *dst) +{ + sph_cubehash384_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_cubehash.h */ +void +sph_cubehash384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + cubehash_close(cc, ub, n, dst, 12); + sph_cubehash384_init(cc); +} + +/* see sph_cubehash.h */ +void +sph_cubehash512_init(void *cc) +{ + cubehash_init(cc, IV512); +} + +/* see sph_cubehash.h */ +void +sph_cubehash512(void *cc, const void *data, size_t len) +{ + cubehash_core(cc, data, len); +} + +/* see sph_cubehash.h */ +void +sph_cubehash512_close(void *cc, void *dst) +{ + sph_cubehash512_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_cubehash.h */ +void +sph_cubehash512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + cubehash_close(cc, ub, n, dst, 16); + sph_cubehash512_init(cc); +} +#ifdef __cplusplus +} +#endif diff --git a/sph/echo.c b/sph/echo.c new file mode 100644 index 0000000..667e3f3 --- /dev/null +++ b/sph/echo.c @@ -0,0 +1,1031 @@ +/* $Id: echo.c 227 2010-06-16 17:28:38Z tp $ */ +/* + * ECHO implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include +#include + +#include "sph_echo.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_ECHO +#define SPH_SMALL_FOOTPRINT_ECHO 1 +#endif + +/* + * Some measures tend to show that the 64-bit implementation offers + * better performance only on a "64-bit architectures", those which have + * actual 64-bit registers. + */ +#if !defined SPH_ECHO_64 && SPH_64_TRUE +#define SPH_ECHO_64 1 +#endif + +/* + * We can use a 64-bit implementation only if a 64-bit type is available. + */ +#if !SPH_64 +#undef SPH_ECHO_64 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +#define T32 SPH_T32 +#define C32 SPH_C32 +#if SPH_64 +#define C64 SPH_C64 +#endif + +#define AES_BIG_ENDIAN 0 +#include "aes_helper.c" + +#if SPH_ECHO_64 + +#define DECL_STATE_SMALL \ + sph_u64 W[16][2]; + +#define DECL_STATE_BIG \ + sph_u64 W[16][2]; + +#define INPUT_BLOCK_SMALL(sc) do { \ + unsigned u; \ + memcpy(W, sc->u.Vb, 8 * sizeof(sph_u64)); \ + for (u = 0; u < 12; u ++) { \ + W[u + 4][0] = sph_dec64le_aligned( \ + sc->buf + 16 * u); \ + W[u + 4][1] = sph_dec64le_aligned( \ + sc->buf + 16 * u + 8); \ + } \ + } while (0) + +#define INPUT_BLOCK_BIG(sc) do { \ + unsigned u; \ + memcpy(W, sc->u.Vb, 16 * sizeof(sph_u64)); \ + for (u = 0; u < 8; u ++) { \ + W[u + 8][0] = sph_dec64le_aligned( \ + sc->buf + 16 * u); \ + W[u + 8][1] = sph_dec64le_aligned( \ + sc->buf + 16 * u + 8); \ + } \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_ECHO + +static void +aes_2rounds_all(sph_u64 W[16][2], + sph_u32 *pK0, sph_u32 *pK1, sph_u32 *pK2, sph_u32 *pK3) +{ + int n; + sph_u32 K0 = *pK0; + sph_u32 K1 = *pK1; + sph_u32 K2 = *pK2; + sph_u32 K3 = *pK3; + + for (n = 0; n < 16; n ++) { + sph_u64 Wl = W[n][0]; + sph_u64 Wh = W[n][1]; + sph_u32 X0 = (sph_u32)Wl; + sph_u32 X1 = (sph_u32)(Wl >> 32); + sph_u32 X2 = (sph_u32)Wh; + sph_u32 X3 = (sph_u32)(Wh >> 32); + sph_u32 Y0, Y1, Y2, Y3; \ + AES_ROUND_LE(X0, X1, X2, X3, K0, K1, K2, K3, Y0, Y1, Y2, Y3); + AES_ROUND_NOKEY_LE(Y0, Y1, Y2, Y3, X0, X1, X2, X3); + W[n][0] = (sph_u64)X0 | ((sph_u64)X1 << 32); + W[n][1] = (sph_u64)X2 | ((sph_u64)X3 << 32); + if ((K0 = T32(K0 + 1)) == 0) { + if ((K1 = T32(K1 + 1)) == 0) + if ((K2 = T32(K2 + 1)) == 0) + K3 = T32(K3 + 1); + } + } + *pK0 = K0; + *pK1 = K1; + *pK2 = K2; + *pK3 = K3; +} + +#define BIG_SUB_WORDS do { \ + aes_2rounds_all(W, &K0, &K1, &K2, &K3); \ + } while (0) + +#else + +#define AES_2ROUNDS(X) do { \ + sph_u32 X0 = (sph_u32)(X[0]); \ + sph_u32 X1 = (sph_u32)(X[0] >> 32); \ + sph_u32 X2 = (sph_u32)(X[1]); \ + sph_u32 X3 = (sph_u32)(X[1] >> 32); \ + sph_u32 Y0, Y1, Y2, Y3; \ + AES_ROUND_LE(X0, X1, X2, X3, K0, K1, K2, K3, Y0, Y1, Y2, Y3); \ + AES_ROUND_NOKEY_LE(Y0, Y1, Y2, Y3, X0, X1, X2, X3); \ + X[0] = (sph_u64)X0 | ((sph_u64)X1 << 32); \ + X[1] = (sph_u64)X2 | ((sph_u64)X3 << 32); \ + if ((K0 = T32(K0 + 1)) == 0) { \ + if ((K1 = T32(K1 + 1)) == 0) \ + if ((K2 = T32(K2 + 1)) == 0) \ + K3 = T32(K3 + 1); \ + } \ + } while (0) + +#define BIG_SUB_WORDS do { \ + AES_2ROUNDS(W[ 0]); \ + AES_2ROUNDS(W[ 1]); \ + AES_2ROUNDS(W[ 2]); \ + AES_2ROUNDS(W[ 3]); \ + AES_2ROUNDS(W[ 4]); \ + AES_2ROUNDS(W[ 5]); \ + AES_2ROUNDS(W[ 6]); \ + AES_2ROUNDS(W[ 7]); \ + AES_2ROUNDS(W[ 8]); \ + AES_2ROUNDS(W[ 9]); \ + AES_2ROUNDS(W[10]); \ + AES_2ROUNDS(W[11]); \ + AES_2ROUNDS(W[12]); \ + AES_2ROUNDS(W[13]); \ + AES_2ROUNDS(W[14]); \ + AES_2ROUNDS(W[15]); \ + } while (0) + +#endif + +#define SHIFT_ROW1(a, b, c, d) do { \ + sph_u64 tmp; \ + tmp = W[a][0]; \ + W[a][0] = W[b][0]; \ + W[b][0] = W[c][0]; \ + W[c][0] = W[d][0]; \ + W[d][0] = tmp; \ + tmp = W[a][1]; \ + W[a][1] = W[b][1]; \ + W[b][1] = W[c][1]; \ + W[c][1] = W[d][1]; \ + W[d][1] = tmp; \ + } while (0) + +#define SHIFT_ROW2(a, b, c, d) do { \ + sph_u64 tmp; \ + tmp = W[a][0]; \ + W[a][0] = W[c][0]; \ + W[c][0] = tmp; \ + tmp = W[b][0]; \ + W[b][0] = W[d][0]; \ + W[d][0] = tmp; \ + tmp = W[a][1]; \ + W[a][1] = W[c][1]; \ + W[c][1] = tmp; \ + tmp = W[b][1]; \ + W[b][1] = W[d][1]; \ + W[d][1] = tmp; \ + } while (0) + +#define SHIFT_ROW3(a, b, c, d) SHIFT_ROW1(d, c, b, a) + +#define BIG_SHIFT_ROWS do { \ + SHIFT_ROW1(1, 5, 9, 13); \ + SHIFT_ROW2(2, 6, 10, 14); \ + SHIFT_ROW3(3, 7, 11, 15); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_ECHO + +static void +mix_column(sph_u64 W[16][2], int ia, int ib, int ic, int id) +{ + int n; + + for (n = 0; n < 2; n ++) { + sph_u64 a = W[ia][n]; + sph_u64 b = W[ib][n]; + sph_u64 c = W[ic][n]; + sph_u64 d = W[id][n]; + sph_u64 ab = a ^ b; + sph_u64 bc = b ^ c; + sph_u64 cd = c ^ d; + sph_u64 abx = ((ab & C64(0x8080808080808080)) >> 7) * 27U + ^ ((ab & C64(0x7F7F7F7F7F7F7F7F)) << 1); + sph_u64 bcx = ((bc & C64(0x8080808080808080)) >> 7) * 27U + ^ ((bc & C64(0x7F7F7F7F7F7F7F7F)) << 1); + sph_u64 cdx = ((cd & C64(0x8080808080808080)) >> 7) * 27U + ^ ((cd & C64(0x7F7F7F7F7F7F7F7F)) << 1); + W[ia][n] = abx ^ bc ^ d; + W[ib][n] = bcx ^ a ^ cd; + W[ic][n] = cdx ^ ab ^ d; + W[id][n] = abx ^ bcx ^ cdx ^ ab ^ c; + } +} + +#define MIX_COLUMN(a, b, c, d) mix_column(W, a, b, c, d) + +#else + +#define MIX_COLUMN1(ia, ib, ic, id, n) do { \ + sph_u64 a = W[ia][n]; \ + sph_u64 b = W[ib][n]; \ + sph_u64 c = W[ic][n]; \ + sph_u64 d = W[id][n]; \ + sph_u64 ab = a ^ b; \ + sph_u64 bc = b ^ c; \ + sph_u64 cd = c ^ d; \ + sph_u64 abx = ((ab & C64(0x8080808080808080)) >> 7) * 27U \ + ^ ((ab & C64(0x7F7F7F7F7F7F7F7F)) << 1); \ + sph_u64 bcx = ((bc & C64(0x8080808080808080)) >> 7) * 27U \ + ^ ((bc & C64(0x7F7F7F7F7F7F7F7F)) << 1); \ + sph_u64 cdx = ((cd & C64(0x8080808080808080)) >> 7) * 27U \ + ^ ((cd & C64(0x7F7F7F7F7F7F7F7F)) << 1); \ + W[ia][n] = abx ^ bc ^ d; \ + W[ib][n] = bcx ^ a ^ cd; \ + W[ic][n] = cdx ^ ab ^ d; \ + W[id][n] = abx ^ bcx ^ cdx ^ ab ^ c; \ + } while (0) + +#define MIX_COLUMN(a, b, c, d) do { \ + MIX_COLUMN1(a, b, c, d, 0); \ + MIX_COLUMN1(a, b, c, d, 1); \ + } while (0) + +#endif + +#define BIG_MIX_COLUMNS do { \ + MIX_COLUMN(0, 1, 2, 3); \ + MIX_COLUMN(4, 5, 6, 7); \ + MIX_COLUMN(8, 9, 10, 11); \ + MIX_COLUMN(12, 13, 14, 15); \ + } while (0) + +#define BIG_ROUND do { \ + BIG_SUB_WORDS; \ + BIG_SHIFT_ROWS; \ + BIG_MIX_COLUMNS; \ + } while (0) + +#define FINAL_SMALL do { \ + unsigned u; \ + sph_u64 *VV = &sc->u.Vb[0][0]; \ + sph_u64 *WW = &W[0][0]; \ + for (u = 0; u < 8; u ++) { \ + VV[u] ^= sph_dec64le_aligned(sc->buf + (u * 8)) \ + ^ sph_dec64le_aligned(sc->buf + (u * 8) + 64) \ + ^ sph_dec64le_aligned(sc->buf + (u * 8) + 128) \ + ^ WW[u] ^ WW[u + 8] \ + ^ WW[u + 16] ^ WW[u + 24]; \ + } \ + } while (0) + +#define FINAL_BIG do { \ + unsigned u; \ + sph_u64 *VV = &sc->u.Vb[0][0]; \ + sph_u64 *WW = &W[0][0]; \ + for (u = 0; u < 16; u ++) { \ + VV[u] ^= sph_dec64le_aligned(sc->buf + (u * 8)) \ + ^ WW[u] ^ WW[u + 16]; \ + } \ + } while (0) + +#define COMPRESS_SMALL(sc) do { \ + sph_u32 K0 = sc->C0; \ + sph_u32 K1 = sc->C1; \ + sph_u32 K2 = sc->C2; \ + sph_u32 K3 = sc->C3; \ + unsigned u; \ + INPUT_BLOCK_SMALL(sc); \ + for (u = 0; u < 8; u ++) { \ + BIG_ROUND; \ + } \ + FINAL_SMALL; \ + } while (0) + +#define COMPRESS_BIG(sc) do { \ + sph_u32 K0 = sc->C0; \ + sph_u32 K1 = sc->C1; \ + sph_u32 K2 = sc->C2; \ + sph_u32 K3 = sc->C3; \ + unsigned u; \ + INPUT_BLOCK_BIG(sc); \ + for (u = 0; u < 10; u ++) { \ + BIG_ROUND; \ + } \ + FINAL_BIG; \ + } while (0) + +#else + +#define DECL_STATE_SMALL \ + sph_u32 W[16][4]; + +#define DECL_STATE_BIG \ + sph_u32 W[16][4]; + +#define INPUT_BLOCK_SMALL(sc) do { \ + unsigned u; \ + memcpy(W, sc->u.Vs, 16 * sizeof(sph_u32)); \ + for (u = 0; u < 12; u ++) { \ + W[u + 4][0] = sph_dec32le_aligned( \ + sc->buf + 16 * u); \ + W[u + 4][1] = sph_dec32le_aligned( \ + sc->buf + 16 * u + 4); \ + W[u + 4][2] = sph_dec32le_aligned( \ + sc->buf + 16 * u + 8); \ + W[u + 4][3] = sph_dec32le_aligned( \ + sc->buf + 16 * u + 12); \ + } \ + } while (0) + +#define INPUT_BLOCK_BIG(sc) do { \ + unsigned u; \ + memcpy(W, sc->u.Vs, 32 * sizeof(sph_u32)); \ + for (u = 0; u < 8; u ++) { \ + W[u + 8][0] = sph_dec32le_aligned( \ + sc->buf + 16 * u); \ + W[u + 8][1] = sph_dec32le_aligned( \ + sc->buf + 16 * u + 4); \ + W[u + 8][2] = sph_dec32le_aligned( \ + sc->buf + 16 * u + 8); \ + W[u + 8][3] = sph_dec32le_aligned( \ + sc->buf + 16 * u + 12); \ + } \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_ECHO + +static void +aes_2rounds_all(sph_u32 W[16][4], + sph_u32 *pK0, sph_u32 *pK1, sph_u32 *pK2, sph_u32 *pK3) +{ + int n; + sph_u32 K0 = *pK0; + sph_u32 K1 = *pK1; + sph_u32 K2 = *pK2; + sph_u32 K3 = *pK3; + + for (n = 0; n < 16; n ++) { + sph_u32 *X = W[n]; + sph_u32 Y0, Y1, Y2, Y3; + AES_ROUND_LE(X[0], X[1], X[2], X[3], + K0, K1, K2, K3, Y0, Y1, Y2, Y3); + AES_ROUND_NOKEY_LE(Y0, Y1, Y2, Y3, X[0], X[1], X[2], X[3]); + if ((K0 = T32(K0 + 1)) == 0) { + if ((K1 = T32(K1 + 1)) == 0) + if ((K2 = T32(K2 + 1)) == 0) + K3 = T32(K3 + 1); + } + } + *pK0 = K0; + *pK1 = K1; + *pK2 = K2; + *pK3 = K3; +} + +#define BIG_SUB_WORDS do { \ + aes_2rounds_all(W, &K0, &K1, &K2, &K3); \ + } while (0) + +#else + +#define AES_2ROUNDS(X) do { \ + sph_u32 Y0, Y1, Y2, Y3; \ + AES_ROUND_LE(X[0], X[1], X[2], X[3], \ + K0, K1, K2, K3, Y0, Y1, Y2, Y3); \ + AES_ROUND_NOKEY_LE(Y0, Y1, Y2, Y3, X[0], X[1], X[2], X[3]); \ + if ((K0 = T32(K0 + 1)) == 0) { \ + if ((K1 = T32(K1 + 1)) == 0) \ + if ((K2 = T32(K2 + 1)) == 0) \ + K3 = T32(K3 + 1); \ + } \ + } while (0) + +#define BIG_SUB_WORDS do { \ + AES_2ROUNDS(W[ 0]); \ + AES_2ROUNDS(W[ 1]); \ + AES_2ROUNDS(W[ 2]); \ + AES_2ROUNDS(W[ 3]); \ + AES_2ROUNDS(W[ 4]); \ + AES_2ROUNDS(W[ 5]); \ + AES_2ROUNDS(W[ 6]); \ + AES_2ROUNDS(W[ 7]); \ + AES_2ROUNDS(W[ 8]); \ + AES_2ROUNDS(W[ 9]); \ + AES_2ROUNDS(W[10]); \ + AES_2ROUNDS(W[11]); \ + AES_2ROUNDS(W[12]); \ + AES_2ROUNDS(W[13]); \ + AES_2ROUNDS(W[14]); \ + AES_2ROUNDS(W[15]); \ + } while (0) + +#endif + +#define SHIFT_ROW1(a, b, c, d) do { \ + sph_u32 tmp; \ + tmp = W[a][0]; \ + W[a][0] = W[b][0]; \ + W[b][0] = W[c][0]; \ + W[c][0] = W[d][0]; \ + W[d][0] = tmp; \ + tmp = W[a][1]; \ + W[a][1] = W[b][1]; \ + W[b][1] = W[c][1]; \ + W[c][1] = W[d][1]; \ + W[d][1] = tmp; \ + tmp = W[a][2]; \ + W[a][2] = W[b][2]; \ + W[b][2] = W[c][2]; \ + W[c][2] = W[d][2]; \ + W[d][2] = tmp; \ + tmp = W[a][3]; \ + W[a][3] = W[b][3]; \ + W[b][3] = W[c][3]; \ + W[c][3] = W[d][3]; \ + W[d][3] = tmp; \ + } while (0) + +#define SHIFT_ROW2(a, b, c, d) do { \ + sph_u32 tmp; \ + tmp = W[a][0]; \ + W[a][0] = W[c][0]; \ + W[c][0] = tmp; \ + tmp = W[b][0]; \ + W[b][0] = W[d][0]; \ + W[d][0] = tmp; \ + tmp = W[a][1]; \ + W[a][1] = W[c][1]; \ + W[c][1] = tmp; \ + tmp = W[b][1]; \ + W[b][1] = W[d][1]; \ + W[d][1] = tmp; \ + tmp = W[a][2]; \ + W[a][2] = W[c][2]; \ + W[c][2] = tmp; \ + tmp = W[b][2]; \ + W[b][2] = W[d][2]; \ + W[d][2] = tmp; \ + tmp = W[a][3]; \ + W[a][3] = W[c][3]; \ + W[c][3] = tmp; \ + tmp = W[b][3]; \ + W[b][3] = W[d][3]; \ + W[d][3] = tmp; \ + } while (0) + +#define SHIFT_ROW3(a, b, c, d) SHIFT_ROW1(d, c, b, a) + +#define BIG_SHIFT_ROWS do { \ + SHIFT_ROW1(1, 5, 9, 13); \ + SHIFT_ROW2(2, 6, 10, 14); \ + SHIFT_ROW3(3, 7, 11, 15); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_ECHO + +static void +mix_column(sph_u32 W[16][4], int ia, int ib, int ic, int id) +{ + int n; + + for (n = 0; n < 4; n ++) { + sph_u32 a = W[ia][n]; + sph_u32 b = W[ib][n]; + sph_u32 c = W[ic][n]; + sph_u32 d = W[id][n]; + sph_u32 ab = a ^ b; + sph_u32 bc = b ^ c; + sph_u32 cd = c ^ d; + sph_u32 abx = ((ab & C32(0x80808080)) >> 7) * 27U + ^ ((ab & C32(0x7F7F7F7F)) << 1); + sph_u32 bcx = ((bc & C32(0x80808080)) >> 7) * 27U + ^ ((bc & C32(0x7F7F7F7F)) << 1); + sph_u32 cdx = ((cd & C32(0x80808080)) >> 7) * 27U + ^ ((cd & C32(0x7F7F7F7F)) << 1); + W[ia][n] = abx ^ bc ^ d; + W[ib][n] = bcx ^ a ^ cd; + W[ic][n] = cdx ^ ab ^ d; + W[id][n] = abx ^ bcx ^ cdx ^ ab ^ c; + } +} + +#define MIX_COLUMN(a, b, c, d) mix_column(W, a, b, c, d) + +#else + +#define MIX_COLUMN1(ia, ib, ic, id, n) do { \ + sph_u32 a = W[ia][n]; \ + sph_u32 b = W[ib][n]; \ + sph_u32 c = W[ic][n]; \ + sph_u32 d = W[id][n]; \ + sph_u32 ab = a ^ b; \ + sph_u32 bc = b ^ c; \ + sph_u32 cd = c ^ d; \ + sph_u32 abx = ((ab & C32(0x80808080)) >> 7) * 27U \ + ^ ((ab & C32(0x7F7F7F7F)) << 1); \ + sph_u32 bcx = ((bc & C32(0x80808080)) >> 7) * 27U \ + ^ ((bc & C32(0x7F7F7F7F)) << 1); \ + sph_u32 cdx = ((cd & C32(0x80808080)) >> 7) * 27U \ + ^ ((cd & C32(0x7F7F7F7F)) << 1); \ + W[ia][n] = abx ^ bc ^ d; \ + W[ib][n] = bcx ^ a ^ cd; \ + W[ic][n] = cdx ^ ab ^ d; \ + W[id][n] = abx ^ bcx ^ cdx ^ ab ^ c; \ + } while (0) + +#define MIX_COLUMN(a, b, c, d) do { \ + MIX_COLUMN1(a, b, c, d, 0); \ + MIX_COLUMN1(a, b, c, d, 1); \ + MIX_COLUMN1(a, b, c, d, 2); \ + MIX_COLUMN1(a, b, c, d, 3); \ + } while (0) + +#endif + +#define BIG_MIX_COLUMNS do { \ + MIX_COLUMN(0, 1, 2, 3); \ + MIX_COLUMN(4, 5, 6, 7); \ + MIX_COLUMN(8, 9, 10, 11); \ + MIX_COLUMN(12, 13, 14, 15); \ + } while (0) + +#define BIG_ROUND do { \ + BIG_SUB_WORDS; \ + BIG_SHIFT_ROWS; \ + BIG_MIX_COLUMNS; \ + } while (0) + +#define FINAL_SMALL do { \ + unsigned u; \ + sph_u32 *VV = &sc->u.Vs[0][0]; \ + sph_u32 *WW = &W[0][0]; \ + for (u = 0; u < 16; u ++) { \ + VV[u] ^= sph_dec32le_aligned(sc->buf + (u * 4)) \ + ^ sph_dec32le_aligned(sc->buf + (u * 4) + 64) \ + ^ sph_dec32le_aligned(sc->buf + (u * 4) + 128) \ + ^ WW[u] ^ WW[u + 16] \ + ^ WW[u + 32] ^ WW[u + 48]; \ + } \ + } while (0) + +#define FINAL_BIG do { \ + unsigned u; \ + sph_u32 *VV = &sc->u.Vs[0][0]; \ + sph_u32 *WW = &W[0][0]; \ + for (u = 0; u < 32; u ++) { \ + VV[u] ^= sph_dec32le_aligned(sc->buf + (u * 4)) \ + ^ WW[u] ^ WW[u + 32]; \ + } \ + } while (0) + +#define COMPRESS_SMALL(sc) do { \ + sph_u32 K0 = sc->C0; \ + sph_u32 K1 = sc->C1; \ + sph_u32 K2 = sc->C2; \ + sph_u32 K3 = sc->C3; \ + unsigned u; \ + INPUT_BLOCK_SMALL(sc); \ + for (u = 0; u < 8; u ++) { \ + BIG_ROUND; \ + } \ + FINAL_SMALL; \ + } while (0) + +#define COMPRESS_BIG(sc) do { \ + sph_u32 K0 = sc->C0; \ + sph_u32 K1 = sc->C1; \ + sph_u32 K2 = sc->C2; \ + sph_u32 K3 = sc->C3; \ + unsigned u; \ + INPUT_BLOCK_BIG(sc); \ + for (u = 0; u < 10; u ++) { \ + BIG_ROUND; \ + } \ + FINAL_BIG; \ + } while (0) + +#endif + +#define INCR_COUNTER(sc, val) do { \ + sc->C0 = T32(sc->C0 + (sph_u32)(val)); \ + if (sc->C0 < (sph_u32)(val)) { \ + if ((sc->C1 = T32(sc->C1 + 1)) == 0) \ + if ((sc->C2 = T32(sc->C2 + 1)) == 0) \ + sc->C3 = T32(sc->C3 + 1); \ + } \ + } while (0) + +static void +echo_small_init(sph_echo_small_context *sc, unsigned out_len) +{ +#if SPH_ECHO_64 + sc->u.Vb[0][0] = (sph_u64)out_len; + sc->u.Vb[0][1] = 0; + sc->u.Vb[1][0] = (sph_u64)out_len; + sc->u.Vb[1][1] = 0; + sc->u.Vb[2][0] = (sph_u64)out_len; + sc->u.Vb[2][1] = 0; + sc->u.Vb[3][0] = (sph_u64)out_len; + sc->u.Vb[3][1] = 0; +#else + sc->u.Vs[0][0] = (sph_u32)out_len; + sc->u.Vs[0][1] = sc->u.Vs[0][2] = sc->u.Vs[0][3] = 0; + sc->u.Vs[1][0] = (sph_u32)out_len; + sc->u.Vs[1][1] = sc->u.Vs[1][2] = sc->u.Vs[1][3] = 0; + sc->u.Vs[2][0] = (sph_u32)out_len; + sc->u.Vs[2][1] = sc->u.Vs[2][2] = sc->u.Vs[2][3] = 0; + sc->u.Vs[3][0] = (sph_u32)out_len; + sc->u.Vs[3][1] = sc->u.Vs[3][2] = sc->u.Vs[3][3] = 0; +#endif + sc->ptr = 0; + sc->C0 = sc->C1 = sc->C2 = sc->C3 = 0; +} + +static void +echo_big_init(sph_echo_big_context *sc, unsigned out_len) +{ +#if SPH_ECHO_64 + sc->u.Vb[0][0] = (sph_u64)out_len; + sc->u.Vb[0][1] = 0; + sc->u.Vb[1][0] = (sph_u64)out_len; + sc->u.Vb[1][1] = 0; + sc->u.Vb[2][0] = (sph_u64)out_len; + sc->u.Vb[2][1] = 0; + sc->u.Vb[3][0] = (sph_u64)out_len; + sc->u.Vb[3][1] = 0; + sc->u.Vb[4][0] = (sph_u64)out_len; + sc->u.Vb[4][1] = 0; + sc->u.Vb[5][0] = (sph_u64)out_len; + sc->u.Vb[5][1] = 0; + sc->u.Vb[6][0] = (sph_u64)out_len; + sc->u.Vb[6][1] = 0; + sc->u.Vb[7][0] = (sph_u64)out_len; + sc->u.Vb[7][1] = 0; +#else + sc->u.Vs[0][0] = (sph_u32)out_len; + sc->u.Vs[0][1] = sc->u.Vs[0][2] = sc->u.Vs[0][3] = 0; + sc->u.Vs[1][0] = (sph_u32)out_len; + sc->u.Vs[1][1] = sc->u.Vs[1][2] = sc->u.Vs[1][3] = 0; + sc->u.Vs[2][0] = (sph_u32)out_len; + sc->u.Vs[2][1] = sc->u.Vs[2][2] = sc->u.Vs[2][3] = 0; + sc->u.Vs[3][0] = (sph_u32)out_len; + sc->u.Vs[3][1] = sc->u.Vs[3][2] = sc->u.Vs[3][3] = 0; + sc->u.Vs[4][0] = (sph_u32)out_len; + sc->u.Vs[4][1] = sc->u.Vs[4][2] = sc->u.Vs[4][3] = 0; + sc->u.Vs[5][0] = (sph_u32)out_len; + sc->u.Vs[5][1] = sc->u.Vs[5][2] = sc->u.Vs[5][3] = 0; + sc->u.Vs[6][0] = (sph_u32)out_len; + sc->u.Vs[6][1] = sc->u.Vs[6][2] = sc->u.Vs[6][3] = 0; + sc->u.Vs[7][0] = (sph_u32)out_len; + sc->u.Vs[7][1] = sc->u.Vs[7][2] = sc->u.Vs[7][3] = 0; +#endif + sc->ptr = 0; + sc->C0 = sc->C1 = sc->C2 = sc->C3 = 0; +} + +static void +echo_small_compress(sph_echo_small_context *sc) +{ + DECL_STATE_SMALL + + COMPRESS_SMALL(sc); +} + +static void +echo_big_compress(sph_echo_big_context *sc) +{ + DECL_STATE_BIG + + COMPRESS_BIG(sc); +} + +static void +echo_small_core(sph_echo_small_context *sc, + const unsigned char *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data += clen; + len -= clen; + if (ptr == sizeof sc->buf) { + INCR_COUNTER(sc, 1536); + echo_small_compress(sc); + ptr = 0; + } + } + sc->ptr = ptr; +} + +static void +echo_big_core(sph_echo_big_context *sc, + const unsigned char *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data += clen; + len -= clen; + if (ptr == sizeof sc->buf) { + INCR_COUNTER(sc, 1024); + echo_big_compress(sc); + ptr = 0; + } + } + sc->ptr = ptr; +} + +static void +echo_small_close(sph_echo_small_context *sc, unsigned ub, unsigned n, + void *dst, unsigned out_size_w32) +{ + unsigned char *buf; + size_t ptr; + unsigned z; + unsigned elen; + union { + unsigned char tmp[32]; + sph_u32 dummy; +#if SPH_ECHO_64 + sph_u64 dummy2; +#endif + } u; +#if SPH_ECHO_64 + sph_u64 *VV; +#else + sph_u32 *VV; +#endif + unsigned k; + + buf = sc->buf; + ptr = sc->ptr; + elen = ((unsigned)ptr << 3) + n; + INCR_COUNTER(sc, elen); + sph_enc32le_aligned(u.tmp, sc->C0); + sph_enc32le_aligned(u.tmp + 4, sc->C1); + sph_enc32le_aligned(u.tmp + 8, sc->C2); + sph_enc32le_aligned(u.tmp + 12, sc->C3); + /* + * If elen is zero, then this block actually contains no message + * bit, only the first padding bit. + */ + if (elen == 0) { + sc->C0 = sc->C1 = sc->C2 = sc->C3 = 0; + } + z = 0x80 >> n; + buf[ptr ++] = ((ub & -z) | z) & 0xFF; + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + if (ptr > ((sizeof sc->buf) - 18)) { + echo_small_compress(sc); + sc->C0 = sc->C1 = sc->C2 = sc->C3 = 0; + memset(buf, 0, sizeof sc->buf); + } + sph_enc16le(buf + (sizeof sc->buf) - 18, out_size_w32 << 5); + memcpy(buf + (sizeof sc->buf) - 16, u.tmp, 16); + echo_small_compress(sc); +#if SPH_ECHO_64 + for (VV = &sc->u.Vb[0][0], k = 0; k < ((out_size_w32 + 1) >> 1); k ++) + sph_enc64le_aligned(u.tmp + (k << 3), VV[k]); +#else + for (VV = &sc->u.Vs[0][0], k = 0; k < out_size_w32; k ++) + sph_enc32le_aligned(u.tmp + (k << 2), VV[k]); +#endif + memcpy(dst, u.tmp, out_size_w32 << 2); + echo_small_init(sc, out_size_w32 << 5); +} + +static void +echo_big_close(sph_echo_big_context *sc, unsigned ub, unsigned n, + void *dst, unsigned out_size_w32) +{ + unsigned char *buf; + size_t ptr; + unsigned z; + unsigned elen; + union { + unsigned char tmp[64]; + sph_u32 dummy; +#if SPH_ECHO_64 + sph_u64 dummy2; +#endif + } u; +#if SPH_ECHO_64 + sph_u64 *VV; +#else + sph_u32 *VV; +#endif + unsigned k; + + buf = sc->buf; + ptr = sc->ptr; + elen = ((unsigned)ptr << 3) + n; + INCR_COUNTER(sc, elen); + sph_enc32le_aligned(u.tmp, sc->C0); + sph_enc32le_aligned(u.tmp + 4, sc->C1); + sph_enc32le_aligned(u.tmp + 8, sc->C2); + sph_enc32le_aligned(u.tmp + 12, sc->C3); + /* + * If elen is zero, then this block actually contains no message + * bit, only the first padding bit. + */ + if (elen == 0) { + sc->C0 = sc->C1 = sc->C2 = sc->C3 = 0; + } + z = 0x80 >> n; + buf[ptr ++] = ((ub & -z) | z) & 0xFF; + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + if (ptr > ((sizeof sc->buf) - 18)) { + echo_big_compress(sc); + sc->C0 = sc->C1 = sc->C2 = sc->C3 = 0; + memset(buf, 0, sizeof sc->buf); + } + sph_enc16le(buf + (sizeof sc->buf) - 18, out_size_w32 << 5); + memcpy(buf + (sizeof sc->buf) - 16, u.tmp, 16); + echo_big_compress(sc); +#if SPH_ECHO_64 + for (VV = &sc->u.Vb[0][0], k = 0; k < ((out_size_w32 + 1) >> 1); k ++) + sph_enc64le_aligned(u.tmp + (k << 3), VV[k]); +#else + for (VV = &sc->u.Vs[0][0], k = 0; k < out_size_w32; k ++) + sph_enc32le_aligned(u.tmp + (k << 2), VV[k]); +#endif + memcpy(dst, u.tmp, out_size_w32 << 2); + echo_big_init(sc, out_size_w32 << 5); +} + +/* see sph_echo.h */ +void +sph_echo224_init(void *cc) +{ + echo_small_init(cc, 224); +} + +/* see sph_echo.h */ +void +sph_echo224(void *cc, const void *data, size_t len) +{ + echo_small_core(cc, data, len); +} + +/* see sph_echo.h */ +void +sph_echo224_close(void *cc, void *dst) +{ + echo_small_close(cc, 0, 0, dst, 7); +} + +/* see sph_echo.h */ +void +sph_echo224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + echo_small_close(cc, ub, n, dst, 7); +} + +/* see sph_echo.h */ +void +sph_echo256_init(void *cc) +{ + echo_small_init(cc, 256); +} + +/* see sph_echo.h */ +void +sph_echo256(void *cc, const void *data, size_t len) +{ + echo_small_core(cc, data, len); +} + +/* see sph_echo.h */ +void +sph_echo256_close(void *cc, void *dst) +{ + echo_small_close(cc, 0, 0, dst, 8); +} + +/* see sph_echo.h */ +void +sph_echo256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + echo_small_close(cc, ub, n, dst, 8); +} + +/* see sph_echo.h */ +void +sph_echo384_init(void *cc) +{ + echo_big_init(cc, 384); +} + +/* see sph_echo.h */ +void +sph_echo384(void *cc, const void *data, size_t len) +{ + echo_big_core(cc, data, len); +} + +/* see sph_echo.h */ +void +sph_echo384_close(void *cc, void *dst) +{ + echo_big_close(cc, 0, 0, dst, 12); +} + +/* see sph_echo.h */ +void +sph_echo384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + echo_big_close(cc, ub, n, dst, 12); +} + +/* see sph_echo.h */ +void +sph_echo512_init(void *cc) +{ + echo_big_init(cc, 512); +} + +/* see sph_echo.h */ +void +sph_echo512(void *cc, const void *data, size_t len) +{ + echo_big_core(cc, data, len); +} + +/* see sph_echo.h */ +void +sph_echo512_close(void *cc, void *dst) +{ + echo_big_close(cc, 0, 0, dst, 16); +} + +/* see sph_echo.h */ +void +sph_echo512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + echo_big_close(cc, ub, n, dst, 16); +} +#ifdef __cplusplus +} +#endif diff --git a/sph/fugue.c b/sph/fugue.c new file mode 100644 index 0000000..85767c9 --- /dev/null +++ b/sph/fugue.c @@ -0,0 +1,1208 @@ +#include +#include + +#include "sph_fugue.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +static const sph_u32 IV224[] = { + SPH_C32(0xf4c9120d), SPH_C32(0x6286f757), SPH_C32(0xee39e01c), + SPH_C32(0xe074e3cb), SPH_C32(0xa1127c62), SPH_C32(0x9a43d215), + SPH_C32(0xbd8d679a) +}; + +static const sph_u32 IV256[] = { + SPH_C32(0xe952bdde), SPH_C32(0x6671135f), SPH_C32(0xe0d4f668), + SPH_C32(0xd2b0b594), SPH_C32(0xf96c621d), SPH_C32(0xfbf929de), + SPH_C32(0x9149e899), SPH_C32(0x34f8c248) +}; + +static const sph_u32 IV384[] = { + SPH_C32(0xaa61ec0d), SPH_C32(0x31252e1f), SPH_C32(0xa01db4c7), + SPH_C32(0x00600985), SPH_C32(0x215ef44a), SPH_C32(0x741b5e9c), + SPH_C32(0xfa693e9a), SPH_C32(0x473eb040), SPH_C32(0xe502ae8a), + SPH_C32(0xa99c25e0), SPH_C32(0xbc95517c), SPH_C32(0x5c1095a1) +}; + +static const sph_u32 IV512[] = { + SPH_C32(0x8807a57e), SPH_C32(0xe616af75), SPH_C32(0xc5d3e4db), + SPH_C32(0xac9ab027), SPH_C32(0xd915f117), SPH_C32(0xb6eecc54), + SPH_C32(0x06e8020b), SPH_C32(0x4a92efd1), SPH_C32(0xaac6e2c9), + SPH_C32(0xddb21398), SPH_C32(0xcae65838), SPH_C32(0x437f203f), + SPH_C32(0x25ea78e7), SPH_C32(0x951fddd6), SPH_C32(0xda6ed11d), + SPH_C32(0xe13e3567) +}; + +static const sph_u32 mixtab0[] = { + SPH_C32(0x63633297), SPH_C32(0x7c7c6feb), SPH_C32(0x77775ec7), + SPH_C32(0x7b7b7af7), SPH_C32(0xf2f2e8e5), SPH_C32(0x6b6b0ab7), + SPH_C32(0x6f6f16a7), SPH_C32(0xc5c56d39), SPH_C32(0x303090c0), + SPH_C32(0x01010704), SPH_C32(0x67672e87), SPH_C32(0x2b2bd1ac), + SPH_C32(0xfefeccd5), SPH_C32(0xd7d71371), SPH_C32(0xabab7c9a), + SPH_C32(0x767659c3), SPH_C32(0xcaca4005), SPH_C32(0x8282a33e), + SPH_C32(0xc9c94909), SPH_C32(0x7d7d68ef), SPH_C32(0xfafad0c5), + SPH_C32(0x5959947f), SPH_C32(0x4747ce07), SPH_C32(0xf0f0e6ed), + SPH_C32(0xadad6e82), SPH_C32(0xd4d41a7d), SPH_C32(0xa2a243be), + SPH_C32(0xafaf608a), SPH_C32(0x9c9cf946), SPH_C32(0xa4a451a6), + SPH_C32(0x727245d3), SPH_C32(0xc0c0762d), SPH_C32(0xb7b728ea), + SPH_C32(0xfdfdc5d9), SPH_C32(0x9393d47a), SPH_C32(0x2626f298), + SPH_C32(0x363682d8), SPH_C32(0x3f3fbdfc), SPH_C32(0xf7f7f3f1), + SPH_C32(0xcccc521d), SPH_C32(0x34348cd0), SPH_C32(0xa5a556a2), + SPH_C32(0xe5e58db9), SPH_C32(0xf1f1e1e9), SPH_C32(0x71714cdf), + SPH_C32(0xd8d83e4d), SPH_C32(0x313197c4), SPH_C32(0x15156b54), + SPH_C32(0x04041c10), SPH_C32(0xc7c76331), SPH_C32(0x2323e98c), + SPH_C32(0xc3c37f21), SPH_C32(0x18184860), SPH_C32(0x9696cf6e), + SPH_C32(0x05051b14), SPH_C32(0x9a9aeb5e), SPH_C32(0x0707151c), + SPH_C32(0x12127e48), SPH_C32(0x8080ad36), SPH_C32(0xe2e298a5), + SPH_C32(0xebeba781), SPH_C32(0x2727f59c), SPH_C32(0xb2b233fe), + SPH_C32(0x757550cf), SPH_C32(0x09093f24), SPH_C32(0x8383a43a), + SPH_C32(0x2c2cc4b0), SPH_C32(0x1a1a4668), SPH_C32(0x1b1b416c), + SPH_C32(0x6e6e11a3), SPH_C32(0x5a5a9d73), SPH_C32(0xa0a04db6), + SPH_C32(0x5252a553), SPH_C32(0x3b3ba1ec), SPH_C32(0xd6d61475), + SPH_C32(0xb3b334fa), SPH_C32(0x2929dfa4), SPH_C32(0xe3e39fa1), + SPH_C32(0x2f2fcdbc), SPH_C32(0x8484b126), SPH_C32(0x5353a257), + SPH_C32(0xd1d10169), SPH_C32(0x00000000), SPH_C32(0xededb599), + SPH_C32(0x2020e080), SPH_C32(0xfcfcc2dd), SPH_C32(0xb1b13af2), + SPH_C32(0x5b5b9a77), SPH_C32(0x6a6a0db3), SPH_C32(0xcbcb4701), + SPH_C32(0xbebe17ce), SPH_C32(0x3939afe4), SPH_C32(0x4a4aed33), + SPH_C32(0x4c4cff2b), SPH_C32(0x5858937b), SPH_C32(0xcfcf5b11), + SPH_C32(0xd0d0066d), SPH_C32(0xefefbb91), SPH_C32(0xaaaa7b9e), + SPH_C32(0xfbfbd7c1), SPH_C32(0x4343d217), SPH_C32(0x4d4df82f), + SPH_C32(0x333399cc), SPH_C32(0x8585b622), SPH_C32(0x4545c00f), + SPH_C32(0xf9f9d9c9), SPH_C32(0x02020e08), SPH_C32(0x7f7f66e7), + SPH_C32(0x5050ab5b), SPH_C32(0x3c3cb4f0), SPH_C32(0x9f9ff04a), + SPH_C32(0xa8a87596), SPH_C32(0x5151ac5f), SPH_C32(0xa3a344ba), + SPH_C32(0x4040db1b), SPH_C32(0x8f8f800a), SPH_C32(0x9292d37e), + SPH_C32(0x9d9dfe42), SPH_C32(0x3838a8e0), SPH_C32(0xf5f5fdf9), + SPH_C32(0xbcbc19c6), SPH_C32(0xb6b62fee), SPH_C32(0xdada3045), + SPH_C32(0x2121e784), SPH_C32(0x10107040), SPH_C32(0xffffcbd1), + SPH_C32(0xf3f3efe1), SPH_C32(0xd2d20865), SPH_C32(0xcdcd5519), + SPH_C32(0x0c0c2430), SPH_C32(0x1313794c), SPH_C32(0xececb29d), + SPH_C32(0x5f5f8667), SPH_C32(0x9797c86a), SPH_C32(0x4444c70b), + SPH_C32(0x1717655c), SPH_C32(0xc4c46a3d), SPH_C32(0xa7a758aa), + SPH_C32(0x7e7e61e3), SPH_C32(0x3d3db3f4), SPH_C32(0x6464278b), + SPH_C32(0x5d5d886f), SPH_C32(0x19194f64), SPH_C32(0x737342d7), + SPH_C32(0x60603b9b), SPH_C32(0x8181aa32), SPH_C32(0x4f4ff627), + SPH_C32(0xdcdc225d), SPH_C32(0x2222ee88), SPH_C32(0x2a2ad6a8), + SPH_C32(0x9090dd76), SPH_C32(0x88889516), SPH_C32(0x4646c903), + SPH_C32(0xeeeebc95), SPH_C32(0xb8b805d6), SPH_C32(0x14146c50), + SPH_C32(0xdede2c55), SPH_C32(0x5e5e8163), SPH_C32(0x0b0b312c), + SPH_C32(0xdbdb3741), SPH_C32(0xe0e096ad), SPH_C32(0x32329ec8), + SPH_C32(0x3a3aa6e8), SPH_C32(0x0a0a3628), SPH_C32(0x4949e43f), + SPH_C32(0x06061218), SPH_C32(0x2424fc90), SPH_C32(0x5c5c8f6b), + SPH_C32(0xc2c27825), SPH_C32(0xd3d30f61), SPH_C32(0xacac6986), + SPH_C32(0x62623593), SPH_C32(0x9191da72), SPH_C32(0x9595c662), + SPH_C32(0xe4e48abd), SPH_C32(0x797974ff), SPH_C32(0xe7e783b1), + SPH_C32(0xc8c84e0d), SPH_C32(0x373785dc), SPH_C32(0x6d6d18af), + SPH_C32(0x8d8d8e02), SPH_C32(0xd5d51d79), SPH_C32(0x4e4ef123), + SPH_C32(0xa9a97292), SPH_C32(0x6c6c1fab), SPH_C32(0x5656b943), + SPH_C32(0xf4f4fafd), SPH_C32(0xeaeaa085), SPH_C32(0x6565208f), + SPH_C32(0x7a7a7df3), SPH_C32(0xaeae678e), SPH_C32(0x08083820), + SPH_C32(0xbaba0bde), SPH_C32(0x787873fb), SPH_C32(0x2525fb94), + SPH_C32(0x2e2ecab8), SPH_C32(0x1c1c5470), SPH_C32(0xa6a65fae), + SPH_C32(0xb4b421e6), SPH_C32(0xc6c66435), SPH_C32(0xe8e8ae8d), + SPH_C32(0xdddd2559), SPH_C32(0x747457cb), SPH_C32(0x1f1f5d7c), + SPH_C32(0x4b4bea37), SPH_C32(0xbdbd1ec2), SPH_C32(0x8b8b9c1a), + SPH_C32(0x8a8a9b1e), SPH_C32(0x70704bdb), SPH_C32(0x3e3ebaf8), + SPH_C32(0xb5b526e2), SPH_C32(0x66662983), SPH_C32(0x4848e33b), + SPH_C32(0x0303090c), SPH_C32(0xf6f6f4f5), SPH_C32(0x0e0e2a38), + SPH_C32(0x61613c9f), SPH_C32(0x35358bd4), SPH_C32(0x5757be47), + SPH_C32(0xb9b902d2), SPH_C32(0x8686bf2e), SPH_C32(0xc1c17129), + SPH_C32(0x1d1d5374), SPH_C32(0x9e9ef74e), SPH_C32(0xe1e191a9), + SPH_C32(0xf8f8decd), SPH_C32(0x9898e556), SPH_C32(0x11117744), + SPH_C32(0x696904bf), SPH_C32(0xd9d93949), SPH_C32(0x8e8e870e), + SPH_C32(0x9494c166), SPH_C32(0x9b9bec5a), SPH_C32(0x1e1e5a78), + SPH_C32(0x8787b82a), SPH_C32(0xe9e9a989), SPH_C32(0xcece5c15), + SPH_C32(0x5555b04f), SPH_C32(0x2828d8a0), SPH_C32(0xdfdf2b51), + SPH_C32(0x8c8c8906), SPH_C32(0xa1a14ab2), SPH_C32(0x89899212), + SPH_C32(0x0d0d2334), SPH_C32(0xbfbf10ca), SPH_C32(0xe6e684b5), + SPH_C32(0x4242d513), SPH_C32(0x686803bb), SPH_C32(0x4141dc1f), + SPH_C32(0x9999e252), SPH_C32(0x2d2dc3b4), SPH_C32(0x0f0f2d3c), + SPH_C32(0xb0b03df6), SPH_C32(0x5454b74b), SPH_C32(0xbbbb0cda), + SPH_C32(0x16166258) +}; + +static const sph_u32 mixtab1[] = { + SPH_C32(0x97636332), SPH_C32(0xeb7c7c6f), SPH_C32(0xc777775e), + SPH_C32(0xf77b7b7a), SPH_C32(0xe5f2f2e8), SPH_C32(0xb76b6b0a), + SPH_C32(0xa76f6f16), SPH_C32(0x39c5c56d), SPH_C32(0xc0303090), + SPH_C32(0x04010107), SPH_C32(0x8767672e), SPH_C32(0xac2b2bd1), + SPH_C32(0xd5fefecc), SPH_C32(0x71d7d713), SPH_C32(0x9aabab7c), + SPH_C32(0xc3767659), SPH_C32(0x05caca40), SPH_C32(0x3e8282a3), + SPH_C32(0x09c9c949), SPH_C32(0xef7d7d68), SPH_C32(0xc5fafad0), + SPH_C32(0x7f595994), SPH_C32(0x074747ce), SPH_C32(0xedf0f0e6), + SPH_C32(0x82adad6e), SPH_C32(0x7dd4d41a), SPH_C32(0xbea2a243), + SPH_C32(0x8aafaf60), SPH_C32(0x469c9cf9), SPH_C32(0xa6a4a451), + SPH_C32(0xd3727245), SPH_C32(0x2dc0c076), SPH_C32(0xeab7b728), + SPH_C32(0xd9fdfdc5), SPH_C32(0x7a9393d4), SPH_C32(0x982626f2), + SPH_C32(0xd8363682), SPH_C32(0xfc3f3fbd), SPH_C32(0xf1f7f7f3), + SPH_C32(0x1dcccc52), SPH_C32(0xd034348c), SPH_C32(0xa2a5a556), + SPH_C32(0xb9e5e58d), SPH_C32(0xe9f1f1e1), SPH_C32(0xdf71714c), + SPH_C32(0x4dd8d83e), SPH_C32(0xc4313197), SPH_C32(0x5415156b), + SPH_C32(0x1004041c), SPH_C32(0x31c7c763), SPH_C32(0x8c2323e9), + SPH_C32(0x21c3c37f), SPH_C32(0x60181848), SPH_C32(0x6e9696cf), + SPH_C32(0x1405051b), SPH_C32(0x5e9a9aeb), SPH_C32(0x1c070715), + SPH_C32(0x4812127e), SPH_C32(0x368080ad), SPH_C32(0xa5e2e298), + SPH_C32(0x81ebeba7), SPH_C32(0x9c2727f5), SPH_C32(0xfeb2b233), + SPH_C32(0xcf757550), SPH_C32(0x2409093f), SPH_C32(0x3a8383a4), + SPH_C32(0xb02c2cc4), SPH_C32(0x681a1a46), SPH_C32(0x6c1b1b41), + SPH_C32(0xa36e6e11), SPH_C32(0x735a5a9d), SPH_C32(0xb6a0a04d), + SPH_C32(0x535252a5), SPH_C32(0xec3b3ba1), SPH_C32(0x75d6d614), + SPH_C32(0xfab3b334), SPH_C32(0xa42929df), SPH_C32(0xa1e3e39f), + SPH_C32(0xbc2f2fcd), SPH_C32(0x268484b1), SPH_C32(0x575353a2), + SPH_C32(0x69d1d101), SPH_C32(0x00000000), SPH_C32(0x99ededb5), + SPH_C32(0x802020e0), SPH_C32(0xddfcfcc2), SPH_C32(0xf2b1b13a), + SPH_C32(0x775b5b9a), SPH_C32(0xb36a6a0d), SPH_C32(0x01cbcb47), + SPH_C32(0xcebebe17), SPH_C32(0xe43939af), SPH_C32(0x334a4aed), + SPH_C32(0x2b4c4cff), SPH_C32(0x7b585893), SPH_C32(0x11cfcf5b), + SPH_C32(0x6dd0d006), SPH_C32(0x91efefbb), SPH_C32(0x9eaaaa7b), + SPH_C32(0xc1fbfbd7), SPH_C32(0x174343d2), SPH_C32(0x2f4d4df8), + SPH_C32(0xcc333399), SPH_C32(0x228585b6), SPH_C32(0x0f4545c0), + SPH_C32(0xc9f9f9d9), SPH_C32(0x0802020e), SPH_C32(0xe77f7f66), + SPH_C32(0x5b5050ab), SPH_C32(0xf03c3cb4), SPH_C32(0x4a9f9ff0), + SPH_C32(0x96a8a875), SPH_C32(0x5f5151ac), SPH_C32(0xbaa3a344), + SPH_C32(0x1b4040db), SPH_C32(0x0a8f8f80), SPH_C32(0x7e9292d3), + SPH_C32(0x429d9dfe), SPH_C32(0xe03838a8), SPH_C32(0xf9f5f5fd), + SPH_C32(0xc6bcbc19), SPH_C32(0xeeb6b62f), SPH_C32(0x45dada30), + SPH_C32(0x842121e7), SPH_C32(0x40101070), SPH_C32(0xd1ffffcb), + SPH_C32(0xe1f3f3ef), SPH_C32(0x65d2d208), SPH_C32(0x19cdcd55), + SPH_C32(0x300c0c24), SPH_C32(0x4c131379), SPH_C32(0x9dececb2), + SPH_C32(0x675f5f86), SPH_C32(0x6a9797c8), SPH_C32(0x0b4444c7), + SPH_C32(0x5c171765), SPH_C32(0x3dc4c46a), SPH_C32(0xaaa7a758), + SPH_C32(0xe37e7e61), SPH_C32(0xf43d3db3), SPH_C32(0x8b646427), + SPH_C32(0x6f5d5d88), SPH_C32(0x6419194f), SPH_C32(0xd7737342), + SPH_C32(0x9b60603b), SPH_C32(0x328181aa), SPH_C32(0x274f4ff6), + SPH_C32(0x5ddcdc22), SPH_C32(0x882222ee), SPH_C32(0xa82a2ad6), + SPH_C32(0x769090dd), SPH_C32(0x16888895), SPH_C32(0x034646c9), + SPH_C32(0x95eeeebc), SPH_C32(0xd6b8b805), SPH_C32(0x5014146c), + SPH_C32(0x55dede2c), SPH_C32(0x635e5e81), SPH_C32(0x2c0b0b31), + SPH_C32(0x41dbdb37), SPH_C32(0xade0e096), SPH_C32(0xc832329e), + SPH_C32(0xe83a3aa6), SPH_C32(0x280a0a36), SPH_C32(0x3f4949e4), + SPH_C32(0x18060612), SPH_C32(0x902424fc), SPH_C32(0x6b5c5c8f), + SPH_C32(0x25c2c278), SPH_C32(0x61d3d30f), SPH_C32(0x86acac69), + SPH_C32(0x93626235), SPH_C32(0x729191da), SPH_C32(0x629595c6), + SPH_C32(0xbde4e48a), SPH_C32(0xff797974), SPH_C32(0xb1e7e783), + SPH_C32(0x0dc8c84e), SPH_C32(0xdc373785), SPH_C32(0xaf6d6d18), + SPH_C32(0x028d8d8e), SPH_C32(0x79d5d51d), SPH_C32(0x234e4ef1), + SPH_C32(0x92a9a972), SPH_C32(0xab6c6c1f), SPH_C32(0x435656b9), + SPH_C32(0xfdf4f4fa), SPH_C32(0x85eaeaa0), SPH_C32(0x8f656520), + SPH_C32(0xf37a7a7d), SPH_C32(0x8eaeae67), SPH_C32(0x20080838), + SPH_C32(0xdebaba0b), SPH_C32(0xfb787873), SPH_C32(0x942525fb), + SPH_C32(0xb82e2eca), SPH_C32(0x701c1c54), SPH_C32(0xaea6a65f), + SPH_C32(0xe6b4b421), SPH_C32(0x35c6c664), SPH_C32(0x8de8e8ae), + SPH_C32(0x59dddd25), SPH_C32(0xcb747457), SPH_C32(0x7c1f1f5d), + SPH_C32(0x374b4bea), SPH_C32(0xc2bdbd1e), SPH_C32(0x1a8b8b9c), + SPH_C32(0x1e8a8a9b), SPH_C32(0xdb70704b), SPH_C32(0xf83e3eba), + SPH_C32(0xe2b5b526), SPH_C32(0x83666629), SPH_C32(0x3b4848e3), + SPH_C32(0x0c030309), SPH_C32(0xf5f6f6f4), SPH_C32(0x380e0e2a), + SPH_C32(0x9f61613c), SPH_C32(0xd435358b), SPH_C32(0x475757be), + SPH_C32(0xd2b9b902), SPH_C32(0x2e8686bf), SPH_C32(0x29c1c171), + SPH_C32(0x741d1d53), SPH_C32(0x4e9e9ef7), SPH_C32(0xa9e1e191), + SPH_C32(0xcdf8f8de), SPH_C32(0x569898e5), SPH_C32(0x44111177), + SPH_C32(0xbf696904), SPH_C32(0x49d9d939), SPH_C32(0x0e8e8e87), + SPH_C32(0x669494c1), SPH_C32(0x5a9b9bec), SPH_C32(0x781e1e5a), + SPH_C32(0x2a8787b8), SPH_C32(0x89e9e9a9), SPH_C32(0x15cece5c), + SPH_C32(0x4f5555b0), SPH_C32(0xa02828d8), SPH_C32(0x51dfdf2b), + SPH_C32(0x068c8c89), SPH_C32(0xb2a1a14a), SPH_C32(0x12898992), + SPH_C32(0x340d0d23), SPH_C32(0xcabfbf10), SPH_C32(0xb5e6e684), + SPH_C32(0x134242d5), SPH_C32(0xbb686803), SPH_C32(0x1f4141dc), + SPH_C32(0x529999e2), SPH_C32(0xb42d2dc3), SPH_C32(0x3c0f0f2d), + SPH_C32(0xf6b0b03d), SPH_C32(0x4b5454b7), SPH_C32(0xdabbbb0c), + SPH_C32(0x58161662) +}; + +static const sph_u32 mixtab2[] = { + SPH_C32(0x32976363), SPH_C32(0x6feb7c7c), SPH_C32(0x5ec77777), + SPH_C32(0x7af77b7b), SPH_C32(0xe8e5f2f2), SPH_C32(0x0ab76b6b), + SPH_C32(0x16a76f6f), SPH_C32(0x6d39c5c5), SPH_C32(0x90c03030), + SPH_C32(0x07040101), SPH_C32(0x2e876767), SPH_C32(0xd1ac2b2b), + SPH_C32(0xccd5fefe), SPH_C32(0x1371d7d7), SPH_C32(0x7c9aabab), + SPH_C32(0x59c37676), SPH_C32(0x4005caca), SPH_C32(0xa33e8282), + SPH_C32(0x4909c9c9), SPH_C32(0x68ef7d7d), SPH_C32(0xd0c5fafa), + SPH_C32(0x947f5959), SPH_C32(0xce074747), SPH_C32(0xe6edf0f0), + SPH_C32(0x6e82adad), SPH_C32(0x1a7dd4d4), SPH_C32(0x43bea2a2), + SPH_C32(0x608aafaf), SPH_C32(0xf9469c9c), SPH_C32(0x51a6a4a4), + SPH_C32(0x45d37272), SPH_C32(0x762dc0c0), SPH_C32(0x28eab7b7), + SPH_C32(0xc5d9fdfd), SPH_C32(0xd47a9393), SPH_C32(0xf2982626), + SPH_C32(0x82d83636), SPH_C32(0xbdfc3f3f), SPH_C32(0xf3f1f7f7), + SPH_C32(0x521dcccc), SPH_C32(0x8cd03434), SPH_C32(0x56a2a5a5), + SPH_C32(0x8db9e5e5), SPH_C32(0xe1e9f1f1), SPH_C32(0x4cdf7171), + SPH_C32(0x3e4dd8d8), SPH_C32(0x97c43131), SPH_C32(0x6b541515), + SPH_C32(0x1c100404), SPH_C32(0x6331c7c7), SPH_C32(0xe98c2323), + SPH_C32(0x7f21c3c3), SPH_C32(0x48601818), SPH_C32(0xcf6e9696), + SPH_C32(0x1b140505), SPH_C32(0xeb5e9a9a), SPH_C32(0x151c0707), + SPH_C32(0x7e481212), SPH_C32(0xad368080), SPH_C32(0x98a5e2e2), + SPH_C32(0xa781ebeb), SPH_C32(0xf59c2727), SPH_C32(0x33feb2b2), + SPH_C32(0x50cf7575), SPH_C32(0x3f240909), SPH_C32(0xa43a8383), + SPH_C32(0xc4b02c2c), SPH_C32(0x46681a1a), SPH_C32(0x416c1b1b), + SPH_C32(0x11a36e6e), SPH_C32(0x9d735a5a), SPH_C32(0x4db6a0a0), + SPH_C32(0xa5535252), SPH_C32(0xa1ec3b3b), SPH_C32(0x1475d6d6), + SPH_C32(0x34fab3b3), SPH_C32(0xdfa42929), SPH_C32(0x9fa1e3e3), + SPH_C32(0xcdbc2f2f), SPH_C32(0xb1268484), SPH_C32(0xa2575353), + SPH_C32(0x0169d1d1), SPH_C32(0x00000000), SPH_C32(0xb599eded), + SPH_C32(0xe0802020), SPH_C32(0xc2ddfcfc), SPH_C32(0x3af2b1b1), + SPH_C32(0x9a775b5b), SPH_C32(0x0db36a6a), SPH_C32(0x4701cbcb), + SPH_C32(0x17cebebe), SPH_C32(0xafe43939), SPH_C32(0xed334a4a), + SPH_C32(0xff2b4c4c), SPH_C32(0x937b5858), SPH_C32(0x5b11cfcf), + SPH_C32(0x066dd0d0), SPH_C32(0xbb91efef), SPH_C32(0x7b9eaaaa), + SPH_C32(0xd7c1fbfb), SPH_C32(0xd2174343), SPH_C32(0xf82f4d4d), + SPH_C32(0x99cc3333), SPH_C32(0xb6228585), SPH_C32(0xc00f4545), + SPH_C32(0xd9c9f9f9), SPH_C32(0x0e080202), SPH_C32(0x66e77f7f), + SPH_C32(0xab5b5050), SPH_C32(0xb4f03c3c), SPH_C32(0xf04a9f9f), + SPH_C32(0x7596a8a8), SPH_C32(0xac5f5151), SPH_C32(0x44baa3a3), + SPH_C32(0xdb1b4040), SPH_C32(0x800a8f8f), SPH_C32(0xd37e9292), + SPH_C32(0xfe429d9d), SPH_C32(0xa8e03838), SPH_C32(0xfdf9f5f5), + SPH_C32(0x19c6bcbc), SPH_C32(0x2feeb6b6), SPH_C32(0x3045dada), + SPH_C32(0xe7842121), SPH_C32(0x70401010), SPH_C32(0xcbd1ffff), + SPH_C32(0xefe1f3f3), SPH_C32(0x0865d2d2), SPH_C32(0x5519cdcd), + SPH_C32(0x24300c0c), SPH_C32(0x794c1313), SPH_C32(0xb29decec), + SPH_C32(0x86675f5f), SPH_C32(0xc86a9797), SPH_C32(0xc70b4444), + SPH_C32(0x655c1717), SPH_C32(0x6a3dc4c4), SPH_C32(0x58aaa7a7), + SPH_C32(0x61e37e7e), SPH_C32(0xb3f43d3d), SPH_C32(0x278b6464), + SPH_C32(0x886f5d5d), SPH_C32(0x4f641919), SPH_C32(0x42d77373), + SPH_C32(0x3b9b6060), SPH_C32(0xaa328181), SPH_C32(0xf6274f4f), + SPH_C32(0x225ddcdc), SPH_C32(0xee882222), SPH_C32(0xd6a82a2a), + SPH_C32(0xdd769090), SPH_C32(0x95168888), SPH_C32(0xc9034646), + SPH_C32(0xbc95eeee), SPH_C32(0x05d6b8b8), SPH_C32(0x6c501414), + SPH_C32(0x2c55dede), SPH_C32(0x81635e5e), SPH_C32(0x312c0b0b), + SPH_C32(0x3741dbdb), SPH_C32(0x96ade0e0), SPH_C32(0x9ec83232), + SPH_C32(0xa6e83a3a), SPH_C32(0x36280a0a), SPH_C32(0xe43f4949), + SPH_C32(0x12180606), SPH_C32(0xfc902424), SPH_C32(0x8f6b5c5c), + SPH_C32(0x7825c2c2), SPH_C32(0x0f61d3d3), SPH_C32(0x6986acac), + SPH_C32(0x35936262), SPH_C32(0xda729191), SPH_C32(0xc6629595), + SPH_C32(0x8abde4e4), SPH_C32(0x74ff7979), SPH_C32(0x83b1e7e7), + SPH_C32(0x4e0dc8c8), SPH_C32(0x85dc3737), SPH_C32(0x18af6d6d), + SPH_C32(0x8e028d8d), SPH_C32(0x1d79d5d5), SPH_C32(0xf1234e4e), + SPH_C32(0x7292a9a9), SPH_C32(0x1fab6c6c), SPH_C32(0xb9435656), + SPH_C32(0xfafdf4f4), SPH_C32(0xa085eaea), SPH_C32(0x208f6565), + SPH_C32(0x7df37a7a), SPH_C32(0x678eaeae), SPH_C32(0x38200808), + SPH_C32(0x0bdebaba), SPH_C32(0x73fb7878), SPH_C32(0xfb942525), + SPH_C32(0xcab82e2e), SPH_C32(0x54701c1c), SPH_C32(0x5faea6a6), + SPH_C32(0x21e6b4b4), SPH_C32(0x6435c6c6), SPH_C32(0xae8de8e8), + SPH_C32(0x2559dddd), SPH_C32(0x57cb7474), SPH_C32(0x5d7c1f1f), + SPH_C32(0xea374b4b), SPH_C32(0x1ec2bdbd), SPH_C32(0x9c1a8b8b), + SPH_C32(0x9b1e8a8a), SPH_C32(0x4bdb7070), SPH_C32(0xbaf83e3e), + SPH_C32(0x26e2b5b5), SPH_C32(0x29836666), SPH_C32(0xe33b4848), + SPH_C32(0x090c0303), SPH_C32(0xf4f5f6f6), SPH_C32(0x2a380e0e), + SPH_C32(0x3c9f6161), SPH_C32(0x8bd43535), SPH_C32(0xbe475757), + SPH_C32(0x02d2b9b9), SPH_C32(0xbf2e8686), SPH_C32(0x7129c1c1), + SPH_C32(0x53741d1d), SPH_C32(0xf74e9e9e), SPH_C32(0x91a9e1e1), + SPH_C32(0xdecdf8f8), SPH_C32(0xe5569898), SPH_C32(0x77441111), + SPH_C32(0x04bf6969), SPH_C32(0x3949d9d9), SPH_C32(0x870e8e8e), + SPH_C32(0xc1669494), SPH_C32(0xec5a9b9b), SPH_C32(0x5a781e1e), + SPH_C32(0xb82a8787), SPH_C32(0xa989e9e9), SPH_C32(0x5c15cece), + SPH_C32(0xb04f5555), SPH_C32(0xd8a02828), SPH_C32(0x2b51dfdf), + SPH_C32(0x89068c8c), SPH_C32(0x4ab2a1a1), SPH_C32(0x92128989), + SPH_C32(0x23340d0d), SPH_C32(0x10cabfbf), SPH_C32(0x84b5e6e6), + SPH_C32(0xd5134242), SPH_C32(0x03bb6868), SPH_C32(0xdc1f4141), + SPH_C32(0xe2529999), SPH_C32(0xc3b42d2d), SPH_C32(0x2d3c0f0f), + SPH_C32(0x3df6b0b0), SPH_C32(0xb74b5454), SPH_C32(0x0cdabbbb), + SPH_C32(0x62581616) +}; + +static const sph_u32 mixtab3[] = { + SPH_C32(0x63329763), SPH_C32(0x7c6feb7c), SPH_C32(0x775ec777), + SPH_C32(0x7b7af77b), SPH_C32(0xf2e8e5f2), SPH_C32(0x6b0ab76b), + SPH_C32(0x6f16a76f), SPH_C32(0xc56d39c5), SPH_C32(0x3090c030), + SPH_C32(0x01070401), SPH_C32(0x672e8767), SPH_C32(0x2bd1ac2b), + SPH_C32(0xfeccd5fe), SPH_C32(0xd71371d7), SPH_C32(0xab7c9aab), + SPH_C32(0x7659c376), SPH_C32(0xca4005ca), SPH_C32(0x82a33e82), + SPH_C32(0xc94909c9), SPH_C32(0x7d68ef7d), SPH_C32(0xfad0c5fa), + SPH_C32(0x59947f59), SPH_C32(0x47ce0747), SPH_C32(0xf0e6edf0), + SPH_C32(0xad6e82ad), SPH_C32(0xd41a7dd4), SPH_C32(0xa243bea2), + SPH_C32(0xaf608aaf), SPH_C32(0x9cf9469c), SPH_C32(0xa451a6a4), + SPH_C32(0x7245d372), SPH_C32(0xc0762dc0), SPH_C32(0xb728eab7), + SPH_C32(0xfdc5d9fd), SPH_C32(0x93d47a93), SPH_C32(0x26f29826), + SPH_C32(0x3682d836), SPH_C32(0x3fbdfc3f), SPH_C32(0xf7f3f1f7), + SPH_C32(0xcc521dcc), SPH_C32(0x348cd034), SPH_C32(0xa556a2a5), + SPH_C32(0xe58db9e5), SPH_C32(0xf1e1e9f1), SPH_C32(0x714cdf71), + SPH_C32(0xd83e4dd8), SPH_C32(0x3197c431), SPH_C32(0x156b5415), + SPH_C32(0x041c1004), SPH_C32(0xc76331c7), SPH_C32(0x23e98c23), + SPH_C32(0xc37f21c3), SPH_C32(0x18486018), SPH_C32(0x96cf6e96), + SPH_C32(0x051b1405), SPH_C32(0x9aeb5e9a), SPH_C32(0x07151c07), + SPH_C32(0x127e4812), SPH_C32(0x80ad3680), SPH_C32(0xe298a5e2), + SPH_C32(0xeba781eb), SPH_C32(0x27f59c27), SPH_C32(0xb233feb2), + SPH_C32(0x7550cf75), SPH_C32(0x093f2409), SPH_C32(0x83a43a83), + SPH_C32(0x2cc4b02c), SPH_C32(0x1a46681a), SPH_C32(0x1b416c1b), + SPH_C32(0x6e11a36e), SPH_C32(0x5a9d735a), SPH_C32(0xa04db6a0), + SPH_C32(0x52a55352), SPH_C32(0x3ba1ec3b), SPH_C32(0xd61475d6), + SPH_C32(0xb334fab3), SPH_C32(0x29dfa429), SPH_C32(0xe39fa1e3), + SPH_C32(0x2fcdbc2f), SPH_C32(0x84b12684), SPH_C32(0x53a25753), + SPH_C32(0xd10169d1), SPH_C32(0x00000000), SPH_C32(0xedb599ed), + SPH_C32(0x20e08020), SPH_C32(0xfcc2ddfc), SPH_C32(0xb13af2b1), + SPH_C32(0x5b9a775b), SPH_C32(0x6a0db36a), SPH_C32(0xcb4701cb), + SPH_C32(0xbe17cebe), SPH_C32(0x39afe439), SPH_C32(0x4aed334a), + SPH_C32(0x4cff2b4c), SPH_C32(0x58937b58), SPH_C32(0xcf5b11cf), + SPH_C32(0xd0066dd0), SPH_C32(0xefbb91ef), SPH_C32(0xaa7b9eaa), + SPH_C32(0xfbd7c1fb), SPH_C32(0x43d21743), SPH_C32(0x4df82f4d), + SPH_C32(0x3399cc33), SPH_C32(0x85b62285), SPH_C32(0x45c00f45), + SPH_C32(0xf9d9c9f9), SPH_C32(0x020e0802), SPH_C32(0x7f66e77f), + SPH_C32(0x50ab5b50), SPH_C32(0x3cb4f03c), SPH_C32(0x9ff04a9f), + SPH_C32(0xa87596a8), SPH_C32(0x51ac5f51), SPH_C32(0xa344baa3), + SPH_C32(0x40db1b40), SPH_C32(0x8f800a8f), SPH_C32(0x92d37e92), + SPH_C32(0x9dfe429d), SPH_C32(0x38a8e038), SPH_C32(0xf5fdf9f5), + SPH_C32(0xbc19c6bc), SPH_C32(0xb62feeb6), SPH_C32(0xda3045da), + SPH_C32(0x21e78421), SPH_C32(0x10704010), SPH_C32(0xffcbd1ff), + SPH_C32(0xf3efe1f3), SPH_C32(0xd20865d2), SPH_C32(0xcd5519cd), + SPH_C32(0x0c24300c), SPH_C32(0x13794c13), SPH_C32(0xecb29dec), + SPH_C32(0x5f86675f), SPH_C32(0x97c86a97), SPH_C32(0x44c70b44), + SPH_C32(0x17655c17), SPH_C32(0xc46a3dc4), SPH_C32(0xa758aaa7), + SPH_C32(0x7e61e37e), SPH_C32(0x3db3f43d), SPH_C32(0x64278b64), + SPH_C32(0x5d886f5d), SPH_C32(0x194f6419), SPH_C32(0x7342d773), + SPH_C32(0x603b9b60), SPH_C32(0x81aa3281), SPH_C32(0x4ff6274f), + SPH_C32(0xdc225ddc), SPH_C32(0x22ee8822), SPH_C32(0x2ad6a82a), + SPH_C32(0x90dd7690), SPH_C32(0x88951688), SPH_C32(0x46c90346), + SPH_C32(0xeebc95ee), SPH_C32(0xb805d6b8), SPH_C32(0x146c5014), + SPH_C32(0xde2c55de), SPH_C32(0x5e81635e), SPH_C32(0x0b312c0b), + SPH_C32(0xdb3741db), SPH_C32(0xe096ade0), SPH_C32(0x329ec832), + SPH_C32(0x3aa6e83a), SPH_C32(0x0a36280a), SPH_C32(0x49e43f49), + SPH_C32(0x06121806), SPH_C32(0x24fc9024), SPH_C32(0x5c8f6b5c), + SPH_C32(0xc27825c2), SPH_C32(0xd30f61d3), SPH_C32(0xac6986ac), + SPH_C32(0x62359362), SPH_C32(0x91da7291), SPH_C32(0x95c66295), + SPH_C32(0xe48abde4), SPH_C32(0x7974ff79), SPH_C32(0xe783b1e7), + SPH_C32(0xc84e0dc8), SPH_C32(0x3785dc37), SPH_C32(0x6d18af6d), + SPH_C32(0x8d8e028d), SPH_C32(0xd51d79d5), SPH_C32(0x4ef1234e), + SPH_C32(0xa97292a9), SPH_C32(0x6c1fab6c), SPH_C32(0x56b94356), + SPH_C32(0xf4fafdf4), SPH_C32(0xeaa085ea), SPH_C32(0x65208f65), + SPH_C32(0x7a7df37a), SPH_C32(0xae678eae), SPH_C32(0x08382008), + SPH_C32(0xba0bdeba), SPH_C32(0x7873fb78), SPH_C32(0x25fb9425), + SPH_C32(0x2ecab82e), SPH_C32(0x1c54701c), SPH_C32(0xa65faea6), + SPH_C32(0xb421e6b4), SPH_C32(0xc66435c6), SPH_C32(0xe8ae8de8), + SPH_C32(0xdd2559dd), SPH_C32(0x7457cb74), SPH_C32(0x1f5d7c1f), + SPH_C32(0x4bea374b), SPH_C32(0xbd1ec2bd), SPH_C32(0x8b9c1a8b), + SPH_C32(0x8a9b1e8a), SPH_C32(0x704bdb70), SPH_C32(0x3ebaf83e), + SPH_C32(0xb526e2b5), SPH_C32(0x66298366), SPH_C32(0x48e33b48), + SPH_C32(0x03090c03), SPH_C32(0xf6f4f5f6), SPH_C32(0x0e2a380e), + SPH_C32(0x613c9f61), SPH_C32(0x358bd435), SPH_C32(0x57be4757), + SPH_C32(0xb902d2b9), SPH_C32(0x86bf2e86), SPH_C32(0xc17129c1), + SPH_C32(0x1d53741d), SPH_C32(0x9ef74e9e), SPH_C32(0xe191a9e1), + SPH_C32(0xf8decdf8), SPH_C32(0x98e55698), SPH_C32(0x11774411), + SPH_C32(0x6904bf69), SPH_C32(0xd93949d9), SPH_C32(0x8e870e8e), + SPH_C32(0x94c16694), SPH_C32(0x9bec5a9b), SPH_C32(0x1e5a781e), + SPH_C32(0x87b82a87), SPH_C32(0xe9a989e9), SPH_C32(0xce5c15ce), + SPH_C32(0x55b04f55), SPH_C32(0x28d8a028), SPH_C32(0xdf2b51df), + SPH_C32(0x8c89068c), SPH_C32(0xa14ab2a1), SPH_C32(0x89921289), + SPH_C32(0x0d23340d), SPH_C32(0xbf10cabf), SPH_C32(0xe684b5e6), + SPH_C32(0x42d51342), SPH_C32(0x6803bb68), SPH_C32(0x41dc1f41), + SPH_C32(0x99e25299), SPH_C32(0x2dc3b42d), SPH_C32(0x0f2d3c0f), + SPH_C32(0xb03df6b0), SPH_C32(0x54b74b54), SPH_C32(0xbb0cdabb), + SPH_C32(0x16625816) +}; + +#define TIX2(q, x00, x01, x08, x10, x24) do { \ + x10 ^= x00; \ + x00 = (q); \ + x08 ^= x00; \ + x01 ^= x24; \ + } while (0) + +#define TIX3(q, x00, x01, x04, x08, x16, x27, x30) do { \ + x16 ^= x00; \ + x00 = (q); \ + x08 ^= x00; \ + x01 ^= x27; \ + x04 ^= x30; \ + } while (0) + +#define TIX4(q, x00, x01, x04, x07, x08, x22, x24, x27, x30) do { \ + x22 ^= x00; \ + x00 = (q); \ + x08 ^= x00; \ + x01 ^= x24; \ + x04 ^= x27; \ + x07 ^= x30; \ + } while (0) + +#define CMIX30(x00, x01, x02, x04, x05, x06, x15, x16, x17) do { \ + x00 ^= x04; \ + x01 ^= x05; \ + x02 ^= x06; \ + x15 ^= x04; \ + x16 ^= x05; \ + x17 ^= x06; \ + } while (0) + +#define CMIX36(x00, x01, x02, x04, x05, x06, x18, x19, x20) do { \ + x00 ^= x04; \ + x01 ^= x05; \ + x02 ^= x06; \ + x18 ^= x04; \ + x19 ^= x05; \ + x20 ^= x06; \ + } while (0) + +#define SMIX(x0, x1, x2, x3) do { \ + sph_u32 c0 = 0; \ + sph_u32 c1 = 0; \ + sph_u32 c2 = 0; \ + sph_u32 c3 = 0; \ + sph_u32 r0 = 0; \ + sph_u32 r1 = 0; \ + sph_u32 r2 = 0; \ + sph_u32 r3 = 0; \ + sph_u32 tmp; \ + tmp = mixtab0[x0 >> 24]; \ + c0 ^= tmp; \ + tmp = mixtab1[(x0 >> 16) & 0xFF]; \ + c0 ^= tmp; \ + r1 ^= tmp; \ + tmp = mixtab2[(x0 >> 8) & 0xFF]; \ + c0 ^= tmp; \ + r2 ^= tmp; \ + tmp = mixtab3[x0 & 0xFF]; \ + c0 ^= tmp; \ + r3 ^= tmp; \ + tmp = mixtab0[x1 >> 24]; \ + c1 ^= tmp; \ + r0 ^= tmp; \ + tmp = mixtab1[(x1 >> 16) & 0xFF]; \ + c1 ^= tmp; \ + tmp = mixtab2[(x1 >> 8) & 0xFF]; \ + c1 ^= tmp; \ + r2 ^= tmp; \ + tmp = mixtab3[x1 & 0xFF]; \ + c1 ^= tmp; \ + r3 ^= tmp; \ + tmp = mixtab0[x2 >> 24]; \ + c2 ^= tmp; \ + r0 ^= tmp; \ + tmp = mixtab1[(x2 >> 16) & 0xFF]; \ + c2 ^= tmp; \ + r1 ^= tmp; \ + tmp = mixtab2[(x2 >> 8) & 0xFF]; \ + c2 ^= tmp; \ + tmp = mixtab3[x2 & 0xFF]; \ + c2 ^= tmp; \ + r3 ^= tmp; \ + tmp = mixtab0[x3 >> 24]; \ + c3 ^= tmp; \ + r0 ^= tmp; \ + tmp = mixtab1[(x3 >> 16) & 0xFF]; \ + c3 ^= tmp; \ + r1 ^= tmp; \ + tmp = mixtab2[(x3 >> 8) & 0xFF]; \ + c3 ^= tmp; \ + r2 ^= tmp; \ + tmp = mixtab3[x3 & 0xFF]; \ + c3 ^= tmp; \ + x0 = ((c0 ^ r0) & SPH_C32(0xFF000000)) \ + | ((c1 ^ r1) & SPH_C32(0x00FF0000)) \ + | ((c2 ^ r2) & SPH_C32(0x0000FF00)) \ + | ((c3 ^ r3) & SPH_C32(0x000000FF)); \ + x1 = ((c1 ^ (r0 << 8)) & SPH_C32(0xFF000000)) \ + | ((c2 ^ (r1 << 8)) & SPH_C32(0x00FF0000)) \ + | ((c3 ^ (r2 << 8)) & SPH_C32(0x0000FF00)) \ + | ((c0 ^ (r3 >> 24)) & SPH_C32(0x000000FF)); \ + x2 = ((c2 ^ (r0 << 16)) & SPH_C32(0xFF000000)) \ + | ((c3 ^ (r1 << 16)) & SPH_C32(0x00FF0000)) \ + | ((c0 ^ (r2 >> 16)) & SPH_C32(0x0000FF00)) \ + | ((c1 ^ (r3 >> 16)) & SPH_C32(0x000000FF)); \ + x3 = ((c3 ^ (r0 << 24)) & SPH_C32(0xFF000000)) \ + | ((c0 ^ (r1 >> 8)) & SPH_C32(0x00FF0000)) \ + | ((c1 ^ (r2 >> 8)) & SPH_C32(0x0000FF00)) \ + | ((c2 ^ (r3 >> 8)) & SPH_C32(0x000000FF)); \ + /* */ \ + } while (0) + +#if SPH_FUGUE_NOCOPY + +#define DECL_STATE_SMALL +#define READ_STATE_SMALL(state) +#define WRITE_STATE_SMALL(state) +#define DECL_STATE_BIG +#define READ_STATE_BIG(state) +#define WRITE_STATE_BIG(state) + +#define S00 ((sc)->S[ 0]) +#define S01 ((sc)->S[ 1]) +#define S02 ((sc)->S[ 2]) +#define S03 ((sc)->S[ 3]) +#define S04 ((sc)->S[ 4]) +#define S05 ((sc)->S[ 5]) +#define S06 ((sc)->S[ 6]) +#define S07 ((sc)->S[ 7]) +#define S08 ((sc)->S[ 8]) +#define S09 ((sc)->S[ 9]) +#define S10 ((sc)->S[10]) +#define S11 ((sc)->S[11]) +#define S12 ((sc)->S[12]) +#define S13 ((sc)->S[13]) +#define S14 ((sc)->S[14]) +#define S15 ((sc)->S[15]) +#define S16 ((sc)->S[16]) +#define S17 ((sc)->S[17]) +#define S18 ((sc)->S[18]) +#define S19 ((sc)->S[19]) +#define S20 ((sc)->S[20]) +#define S21 ((sc)->S[21]) +#define S22 ((sc)->S[22]) +#define S23 ((sc)->S[23]) +#define S24 ((sc)->S[24]) +#define S25 ((sc)->S[25]) +#define S26 ((sc)->S[26]) +#define S27 ((sc)->S[27]) +#define S28 ((sc)->S[28]) +#define S29 ((sc)->S[29]) +#define S30 ((sc)->S[30]) +#define S31 ((sc)->S[31]) +#define S32 ((sc)->S[32]) +#define S33 ((sc)->S[33]) +#define S34 ((sc)->S[34]) +#define S35 ((sc)->S[35]) + +#else + +#define DECL_STATE_SMALL \ + sph_u32 S00, S01, S02, S03, S04, S05, S06, S07, S08, S09; \ + sph_u32 S10, S11, S12, S13, S14, S15, S16, S17, S18, S19; \ + sph_u32 S20, S21, S22, S23, S24, S25, S26, S27, S28, S29; + +#define DECL_STATE_BIG \ + DECL_STATE_SMALL \ + sph_u32 S30, S31, S32, S33, S34, S35; + +#define READ_STATE_SMALL(state) do { \ + S00 = (state)->S[ 0]; \ + S01 = (state)->S[ 1]; \ + S02 = (state)->S[ 2]; \ + S03 = (state)->S[ 3]; \ + S04 = (state)->S[ 4]; \ + S05 = (state)->S[ 5]; \ + S06 = (state)->S[ 6]; \ + S07 = (state)->S[ 7]; \ + S08 = (state)->S[ 8]; \ + S09 = (state)->S[ 9]; \ + S10 = (state)->S[10]; \ + S11 = (state)->S[11]; \ + S12 = (state)->S[12]; \ + S13 = (state)->S[13]; \ + S14 = (state)->S[14]; \ + S15 = (state)->S[15]; \ + S16 = (state)->S[16]; \ + S17 = (state)->S[17]; \ + S18 = (state)->S[18]; \ + S19 = (state)->S[19]; \ + S20 = (state)->S[20]; \ + S21 = (state)->S[21]; \ + S22 = (state)->S[22]; \ + S23 = (state)->S[23]; \ + S24 = (state)->S[24]; \ + S25 = (state)->S[25]; \ + S26 = (state)->S[26]; \ + S27 = (state)->S[27]; \ + S28 = (state)->S[28]; \ + S29 = (state)->S[29]; \ + } while (0) + +#define READ_STATE_BIG(state) do { \ + READ_STATE_SMALL(state); \ + S30 = (state)->S[30]; \ + S31 = (state)->S[31]; \ + S32 = (state)->S[32]; \ + S33 = (state)->S[33]; \ + S34 = (state)->S[34]; \ + S35 = (state)->S[35]; \ + } while (0) + +#define WRITE_STATE_SMALL(state) do { \ + (state)->S[ 0] = S00; \ + (state)->S[ 1] = S01; \ + (state)->S[ 2] = S02; \ + (state)->S[ 3] = S03; \ + (state)->S[ 4] = S04; \ + (state)->S[ 5] = S05; \ + (state)->S[ 6] = S06; \ + (state)->S[ 7] = S07; \ + (state)->S[ 8] = S08; \ + (state)->S[ 9] = S09; \ + (state)->S[10] = S10; \ + (state)->S[11] = S11; \ + (state)->S[12] = S12; \ + (state)->S[13] = S13; \ + (state)->S[14] = S14; \ + (state)->S[15] = S15; \ + (state)->S[16] = S16; \ + (state)->S[17] = S17; \ + (state)->S[18] = S18; \ + (state)->S[19] = S19; \ + (state)->S[20] = S20; \ + (state)->S[21] = S21; \ + (state)->S[22] = S22; \ + (state)->S[23] = S23; \ + (state)->S[24] = S24; \ + (state)->S[25] = S25; \ + (state)->S[26] = S26; \ + (state)->S[27] = S27; \ + (state)->S[28] = S28; \ + (state)->S[29] = S29; \ + } while (0) + +#define WRITE_STATE_BIG(state) do { \ + WRITE_STATE_SMALL(state); \ + (state)->S[30] = S30; \ + (state)->S[31] = S31; \ + (state)->S[32] = S32; \ + (state)->S[33] = S33; \ + (state)->S[34] = S34; \ + (state)->S[35] = S35; \ + } while (0) + +#endif + +static void +fugue_init(sph_fugue_context *sc, size_t z_len, + const sph_u32 *iv, size_t iv_len) +{ + size_t u; + + for (u = 0; u < z_len; u ++) + sc->S[u] = 0; + memcpy(&sc->S[z_len], iv, iv_len * sizeof *iv); + sc->partial = 0; + sc->partial_len = 0; + sc->round_shift = 0; +#if SPH_64 + sc->bit_count = 0; +#else + sc->bit_count_high = 0; + sc->bit_count_low = 0; +#endif +} + +#if SPH_64 + +#define INCR_COUNTER do { \ + sc->bit_count += (sph_u64)len << 3; \ + } while (0) + +#else + +#define INCR_COUNTER do { \ + sph_u32 tmp = SPH_T32((sph_u32)len << 3); \ + sc->bit_count_low = SPH_T32(sc->bit_count_low + tmp); \ + if (sc->bit_count_low < tmp) \ + sc->bit_count_high ++; \ + sc->bit_count_high = SPH_T32(sc->bit_count_high \ + + ((sph_u32)len >> 29)); \ + } while (0) + +#endif + +#define CORE_ENTRY \ + sph_u32 p; \ + unsigned plen, rshift; \ + INCR_COUNTER; \ + p = sc->partial; \ + plen = sc->partial_len; \ + if (plen < 4) { \ + unsigned count = 4 - plen; \ + if (len < count) \ + count = len; \ + plen += count; \ + while (count -- > 0) { \ + p = (p << 8) | *(const unsigned char *)data; \ + data = (const unsigned char *)data + 1; \ + len --; \ + } \ + if (len == 0) { \ + sc->partial = p; \ + sc->partial_len = plen; \ + return; \ + } \ + } + +#define CORE_EXIT \ + p = 0; \ + sc->partial_len = (unsigned)len; \ + while (len -- > 0) { \ + p = (p << 8) | *(const unsigned char *)data; \ + data = (const unsigned char *)data + 1; \ + } \ + sc->partial = p; \ + sc->round_shift = rshift; + +/* + * Not in a do..while: the 'break' must exit the outer loop. + */ +#define NEXT(rc) \ + if (len <= 4) { \ + rshift = (rc); \ + break; \ + } \ + p = sph_dec32be(data); \ + data = (const unsigned char *)data + 4; \ + len -= 4 + +static void +fugue2_core(sph_fugue_context *sc, const void *data, size_t len) +{ + DECL_STATE_SMALL + CORE_ENTRY + READ_STATE_SMALL(sc); + rshift = sc->round_shift; + switch (rshift) { + for (;;) { + sph_u32 q; + + case 0: + q = p; + TIX2(q, S00, S01, S08, S10, S24); + CMIX30(S27, S28, S29, S01, S02, S03, S12, S13, S14); + SMIX(S27, S28, S29, S00); + CMIX30(S24, S25, S26, S28, S29, S00, S09, S10, S11); + SMIX(S24, S25, S26, S27); + NEXT(1); + /* fall through */ + case 1: + q = p; + TIX2(q, S24, S25, S02, S04, S18); + CMIX30(S21, S22, S23, S25, S26, S27, S06, S07, S08); + SMIX(S21, S22, S23, S24); + CMIX30(S18, S19, S20, S22, S23, S24, S03, S04, S05); + SMIX(S18, S19, S20, S21); + NEXT(2); + /* fall through */ + case 2: + q = p; + TIX2(q, S18, S19, S26, S28, S12); + CMIX30(S15, S16, S17, S19, S20, S21, S00, S01, S02); + SMIX(S15, S16, S17, S18); + CMIX30(S12, S13, S14, S16, S17, S18, S27, S28, S29); + SMIX(S12, S13, S14, S15); + NEXT(3); + /* fall through */ + case 3: + q = p; + TIX2(q, S12, S13, S20, S22, S06); + CMIX30(S09, S10, S11, S13, S14, S15, S24, S25, S26); + SMIX(S09, S10, S11, S12); + CMIX30(S06, S07, S08, S10, S11, S12, S21, S22, S23); + SMIX(S06, S07, S08, S09); + NEXT(4); + /* fall through */ + case 4: + q = p; + TIX2(q, S06, S07, S14, S16, S00); + CMIX30(S03, S04, S05, S07, S08, S09, S18, S19, S20); + SMIX(S03, S04, S05, S06); + CMIX30(S00, S01, S02, S04, S05, S06, S15, S16, S17); + SMIX(S00, S01, S02, S03); + NEXT(0); + } + } + CORE_EXIT + WRITE_STATE_SMALL(sc); +} + +static void +fugue3_core(sph_fugue_context *sc, const void *data, size_t len) +{ + DECL_STATE_BIG + CORE_ENTRY + READ_STATE_BIG(sc); + rshift = sc->round_shift; + switch (rshift) { + for (;;) { + sph_u32 q; + + case 0: + q = p; + TIX3(q, S00, S01, S04, S08, S16, S27, S30); + CMIX36(S33, S34, S35, S01, S02, S03, S15, S16, S17); + SMIX(S33, S34, S35, S00); + CMIX36(S30, S31, S32, S34, S35, S00, S12, S13, S14); + SMIX(S30, S31, S32, S33); + CMIX36(S27, S28, S29, S31, S32, S33, S09, S10, S11); + SMIX(S27, S28, S29, S30); + NEXT(1); + /* fall through */ + case 1: + q = p; + TIX3(q, S27, S28, S31, S35, S07, S18, S21); + CMIX36(S24, S25, S26, S28, S29, S30, S06, S07, S08); + SMIX(S24, S25, S26, S27); + CMIX36(S21, S22, S23, S25, S26, S27, S03, S04, S05); + SMIX(S21, S22, S23, S24); + CMIX36(S18, S19, S20, S22, S23, S24, S00, S01, S02); + SMIX(S18, S19, S20, S21); + NEXT(2); + /* fall through */ + case 2: + q = p; + TIX3(q, S18, S19, S22, S26, S34, S09, S12); + CMIX36(S15, S16, S17, S19, S20, S21, S33, S34, S35); + SMIX(S15, S16, S17, S18); + CMIX36(S12, S13, S14, S16, S17, S18, S30, S31, S32); + SMIX(S12, S13, S14, S15); + CMIX36(S09, S10, S11, S13, S14, S15, S27, S28, S29); + SMIX(S09, S10, S11, S12); + NEXT(3); + /* fall through */ + case 3: + q = p; + TIX3(q, S09, S10, S13, S17, S25, S00, S03); + CMIX36(S06, S07, S08, S10, S11, S12, S24, S25, S26); + SMIX(S06, S07, S08, S09); + CMIX36(S03, S04, S05, S07, S08, S09, S21, S22, S23); + SMIX(S03, S04, S05, S06); + CMIX36(S00, S01, S02, S04, S05, S06, S18, S19, S20); + SMIX(S00, S01, S02, S03); + NEXT(0); + } + } + CORE_EXIT + WRITE_STATE_BIG(sc); +} + +static void +fugue4_core(sph_fugue_context *sc, const void *data, size_t len) +{ + DECL_STATE_BIG + CORE_ENTRY + READ_STATE_BIG(sc); + rshift = sc->round_shift; + switch (rshift) { + for (;;) { + sph_u32 q; + + case 0: + q = p; + TIX4(q, S00, S01, S04, S07, S08, S22, S24, S27, S30); + CMIX36(S33, S34, S35, S01, S02, S03, S15, S16, S17); + SMIX(S33, S34, S35, S00); + CMIX36(S30, S31, S32, S34, S35, S00, S12, S13, S14); + SMIX(S30, S31, S32, S33); + CMIX36(S27, S28, S29, S31, S32, S33, S09, S10, S11); + SMIX(S27, S28, S29, S30); + CMIX36(S24, S25, S26, S28, S29, S30, S06, S07, S08); + SMIX(S24, S25, S26, S27); + NEXT(1); + /* fall through */ + case 1: + q = p; + TIX4(q, S24, S25, S28, S31, S32, S10, S12, S15, S18); + CMIX36(S21, S22, S23, S25, S26, S27, S03, S04, S05); + SMIX(S21, S22, S23, S24); + CMIX36(S18, S19, S20, S22, S23, S24, S00, S01, S02); + SMIX(S18, S19, S20, S21); + CMIX36(S15, S16, S17, S19, S20, S21, S33, S34, S35); + SMIX(S15, S16, S17, S18); + CMIX36(S12, S13, S14, S16, S17, S18, S30, S31, S32); + SMIX(S12, S13, S14, S15); + NEXT(2); + /* fall through */ + case 2: + q = p; + TIX4(q, S12, S13, S16, S19, S20, S34, S00, S03, S06); + CMIX36(S09, S10, S11, S13, S14, S15, S27, S28, S29); + SMIX(S09, S10, S11, S12); + CMIX36(S06, S07, S08, S10, S11, S12, S24, S25, S26); + SMIX(S06, S07, S08, S09); + CMIX36(S03, S04, S05, S07, S08, S09, S21, S22, S23); + SMIX(S03, S04, S05, S06); + CMIX36(S00, S01, S02, S04, S05, S06, S18, S19, S20); + SMIX(S00, S01, S02, S03); + NEXT(0); + } + } + CORE_EXIT + WRITE_STATE_BIG(sc); +} + +#if SPH_64 + +#define WRITE_COUNTER do { \ + sph_enc64be(buf + 4, sc->bit_count + n); \ + } while (0) + +#else + +#define WRITE_COUNTER do { \ + sph_enc32be(buf + 4, sc->bit_count_high); \ + sph_enc32be(buf + 8, sc->bit_count_low + n); \ + } while (0) + +#endif + +#define CLOSE_ENTRY(s, rcm, core) \ + unsigned char buf[16]; \ + unsigned plen, rms; \ + unsigned char *out; \ + sph_u32 S[s]; \ + plen = sc->partial_len; \ + WRITE_COUNTER; \ + if (plen == 0 && n == 0) { \ + plen = 4; \ + } else if (plen < 4 || n != 0) { \ + unsigned u; \ + \ + if (plen == 4) \ + plen = 0; \ + buf[plen] = ub & ~(0xFFU >> n); \ + for (u = plen + 1; u < 4; u ++) \ + buf[u] = 0; \ + } \ + core(sc, buf + plen, (sizeof buf) - plen); \ + rms = sc->round_shift * (rcm); \ + memcpy(S, sc->S + (s) - rms, rms * sizeof(sph_u32)); \ + memcpy(S + rms, sc->S, ((s) - rms) * sizeof(sph_u32)); + +#define ROR(n, s) do { \ + sph_u32 tmp[n]; \ + memcpy(tmp, S + ((s) - (n)), (n) * sizeof(sph_u32)); \ + memmove(S + (n), S, ((s) - (n)) * sizeof(sph_u32)); \ + memcpy(S, tmp, (n) * sizeof(sph_u32)); \ + } while (0) + +static void +fugue2_close(sph_fugue_context *sc, unsigned ub, unsigned n, + void *dst, size_t out_size_w32) +{ + int i; + + CLOSE_ENTRY(30, 6, fugue2_core) + for (i = 0; i < 10; i ++) { + ROR(3, 30); + CMIX30(S[0], S[1], S[2], S[4], S[5], S[6], S[15], S[16], S[17]); + SMIX(S[0], S[1], S[2], S[3]); + } + for (i = 0; i < 13; i ++) { + S[4] ^= S[0]; + S[15] ^= S[0]; + ROR(15, 30); + SMIX(S[0], S[1], S[2], S[3]); + S[4] ^= S[0]; + S[16] ^= S[0]; + ROR(14, 30); + SMIX(S[0], S[1], S[2], S[3]); + } + S[4] ^= S[0]; + S[15] ^= S[0]; + out = dst; + sph_enc32be(out + 0, S[ 1]); + sph_enc32be(out + 4, S[ 2]); + sph_enc32be(out + 8, S[ 3]); + sph_enc32be(out + 12, S[ 4]); + sph_enc32be(out + 16, S[15]); + sph_enc32be(out + 20, S[16]); + sph_enc32be(out + 24, S[17]); + if (out_size_w32 == 8) { + sph_enc32be(out + 28, S[18]); + sph_fugue256_init(sc); + } else { + sph_fugue224_init(sc); + } +} + +static void +fugue3_close(sph_fugue_context *sc, unsigned ub, unsigned n, void *dst) +{ + int i; + + CLOSE_ENTRY(36, 9, fugue3_core) + for (i = 0; i < 18; i ++) { + ROR(3, 36); + CMIX36(S[0], S[1], S[2], S[4], S[5], S[6], S[18], S[19], S[20]); + SMIX(S[0], S[1], S[2], S[3]); + } + for (i = 0; i < 13; i ++) { + S[4] ^= S[0]; + S[12] ^= S[0]; + S[24] ^= S[0]; + ROR(12, 36); + SMIX(S[0], S[1], S[2], S[3]); + S[4] ^= S[0]; + S[13] ^= S[0]; + S[24] ^= S[0]; + ROR(12, 36); + SMIX(S[0], S[1], S[2], S[3]); + S[4] ^= S[0]; + S[13] ^= S[0]; + S[25] ^= S[0]; + ROR(11, 36); + SMIX(S[0], S[1], S[2], S[3]); + } + S[4] ^= S[0]; + S[12] ^= S[0]; + S[24] ^= S[0]; + out = dst; + sph_enc32be(out + 0, S[ 1]); + sph_enc32be(out + 4, S[ 2]); + sph_enc32be(out + 8, S[ 3]); + sph_enc32be(out + 12, S[ 4]); + sph_enc32be(out + 16, S[12]); + sph_enc32be(out + 20, S[13]); + sph_enc32be(out + 24, S[14]); + sph_enc32be(out + 28, S[15]); + sph_enc32be(out + 32, S[24]); + sph_enc32be(out + 36, S[25]); + sph_enc32be(out + 40, S[26]); + sph_enc32be(out + 44, S[27]); + sph_fugue384_init(sc); +} + +static void +fugue4_close(sph_fugue_context *sc, unsigned ub, unsigned n, void *dst) +{ + int i; + + CLOSE_ENTRY(36, 12, fugue4_core) + for (i = 0; i < 32; i ++) { + ROR(3, 36); + CMIX36(S[0], S[1], S[2], S[4], S[5], S[6], S[18], S[19], S[20]); + SMIX(S[0], S[1], S[2], S[3]); + } + for (i = 0; i < 13; i ++) { + S[4] ^= S[0]; + S[9] ^= S[0]; + S[18] ^= S[0]; + S[27] ^= S[0]; + ROR(9, 36); + SMIX(S[0], S[1], S[2], S[3]); + S[4] ^= S[0]; + S[10] ^= S[0]; + S[18] ^= S[0]; + S[27] ^= S[0]; + ROR(9, 36); + SMIX(S[0], S[1], S[2], S[3]); + S[4] ^= S[0]; + S[10] ^= S[0]; + S[19] ^= S[0]; + S[27] ^= S[0]; + ROR(9, 36); + SMIX(S[0], S[1], S[2], S[3]); + S[4] ^= S[0]; + S[10] ^= S[0]; + S[19] ^= S[0]; + S[28] ^= S[0]; + ROR(8, 36); + SMIX(S[0], S[1], S[2], S[3]); + } + S[4] ^= S[0]; + S[9] ^= S[0]; + S[18] ^= S[0]; + S[27] ^= S[0]; + out = dst; + sph_enc32be(out + 0, S[ 1]); + sph_enc32be(out + 4, S[ 2]); + sph_enc32be(out + 8, S[ 3]); + sph_enc32be(out + 12, S[ 4]); + sph_enc32be(out + 16, S[ 9]); + sph_enc32be(out + 20, S[10]); + sph_enc32be(out + 24, S[11]); + sph_enc32be(out + 28, S[12]); + sph_enc32be(out + 32, S[18]); + sph_enc32be(out + 36, S[19]); + sph_enc32be(out + 40, S[20]); + sph_enc32be(out + 44, S[21]); + sph_enc32be(out + 48, S[27]); + sph_enc32be(out + 52, S[28]); + sph_enc32be(out + 56, S[29]); + sph_enc32be(out + 60, S[30]); + sph_fugue512_init(sc); +} + +void +sph_fugue224_init(void *cc) +{ + fugue_init(cc, 23, IV224, 7); +} + +void +sph_fugue224(void *cc, const void *data, size_t len) +{ + fugue2_core(cc, data, len); +} + +void +sph_fugue224_close(void *cc, void *dst) +{ + fugue2_close(cc, 0, 0, dst, 7); +} + +void +sph_fugue224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + fugue2_close(cc, ub, n, dst, 7); +} + +void +sph_fugue256_init(void *cc) +{ + fugue_init(cc, 22, IV256, 8); +} + +void +sph_fugue256(void *cc, const void *data, size_t len) +{ + fugue2_core(cc, data, len); +} + +void +sph_fugue256_close(void *cc, void *dst) +{ + fugue2_close(cc, 0, 0, dst, 8); +} + +void +sph_fugue256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + fugue2_close(cc, ub, n, dst, 8); +} + +void +sph_fugue384_init(void *cc) +{ + fugue_init(cc, 24, IV384, 12); +} + +void +sph_fugue384(void *cc, const void *data, size_t len) +{ + fugue3_core(cc, data, len); +} + +void +sph_fugue384_close(void *cc, void *dst) +{ + fugue3_close(cc, 0, 0, dst); +} + +void +sph_fugue384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + fugue3_close(cc, ub, n, dst); +} + +void +sph_fugue512_init(void *cc) +{ + fugue_init(cc, 20, IV512, 16); +} + +void +sph_fugue512(void *cc, const void *data, size_t len) +{ + fugue4_core(cc, data, len); +} + +void +sph_fugue512_close(void *cc, void *dst) +{ + fugue4_close(cc, 0, 0, dst); +} + +void +sph_fugue512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + fugue4_close(cc, ub, n, dst); +} +#ifdef __cplusplus +} +#endif diff --git a/sph/groestl.c b/sph/groestl.c new file mode 100644 index 0000000..31b7b03 --- /dev/null +++ b/sph/groestl.c @@ -0,0 +1,3124 @@ +/* $Id: groestl.c 260 2011-07-21 01:02:38Z tp $ */ +/* + * Groestl implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ +#include +#include +#include + +#include "sph_groestl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_GROESTL +#define SPH_SMALL_FOOTPRINT_GROESTL 1 +#endif + +/* + * Apparently, the 32-bit-only version is not faster than the 64-bit + * version unless using the "small footprint" code on a 32-bit machine. + */ +#if !defined SPH_GROESTL_64 +#if SPH_SMALL_FOOTPRINT_GROESTL && !SPH_64_TRUE +#define SPH_GROESTL_64 0 +#else +#define SPH_GROESTL_64 1 +#endif +#endif + +#if !SPH_64 +#undef SPH_GROESTL_64 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +/* + * The internal representation may use either big-endian or + * little-endian. Using the platform default representation speeds up + * encoding and decoding between bytes and the matrix columns. + */ + +#undef USE_LE +#if SPH_GROESTL_LITTLE_ENDIAN +#define USE_LE 1 +#elif SPH_GROESTL_BIG_ENDIAN +#define USE_LE 0 +#elif SPH_LITTLE_ENDIAN +#define USE_LE 1 +#endif + +#if USE_LE + +#define C32e(x) ((SPH_C32(x) >> 24) \ + | ((SPH_C32(x) >> 8) & SPH_C32(0x0000FF00)) \ + | ((SPH_C32(x) << 8) & SPH_C32(0x00FF0000)) \ + | ((SPH_C32(x) << 24) & SPH_C32(0xFF000000))) +#define dec32e_aligned sph_dec32le_aligned +#define enc32e sph_enc32le +#define B32_0(x) ((x) & 0xFF) +#define B32_1(x) (((x) >> 8) & 0xFF) +#define B32_2(x) (((x) >> 16) & 0xFF) +#define B32_3(x) ((x) >> 24) + +#define R32u(u, d) SPH_T32(((u) << 16) | ((d) >> 16)) +#define R32d(u, d) SPH_T32(((u) >> 16) | ((d) << 16)) + +#define PC32up(j, r) ((sph_u32)((j) + (r))) +#define PC32dn(j, r) 0 +#define QC32up(j, r) SPH_C32(0xFFFFFFFF) +#define QC32dn(j, r) (((sph_u32)(r) << 24) ^ SPH_T32(~((sph_u32)(j) << 24))) + +#if SPH_64 +#define C64e(x) ((SPH_C64(x) >> 56) \ + | ((SPH_C64(x) >> 40) & SPH_C64(0x000000000000FF00)) \ + | ((SPH_C64(x) >> 24) & SPH_C64(0x0000000000FF0000)) \ + | ((SPH_C64(x) >> 8) & SPH_C64(0x00000000FF000000)) \ + | ((SPH_C64(x) << 8) & SPH_C64(0x000000FF00000000)) \ + | ((SPH_C64(x) << 24) & SPH_C64(0x0000FF0000000000)) \ + | ((SPH_C64(x) << 40) & SPH_C64(0x00FF000000000000)) \ + | ((SPH_C64(x) << 56) & SPH_C64(0xFF00000000000000))) +#define dec64e_aligned sph_dec64le_aligned +#define enc64e sph_enc64le +#define B64_0(x) ((x) & 0xFF) +#define B64_1(x) (((x) >> 8) & 0xFF) +#define B64_2(x) (((x) >> 16) & 0xFF) +#define B64_3(x) (((x) >> 24) & 0xFF) +#define B64_4(x) (((x) >> 32) & 0xFF) +#define B64_5(x) (((x) >> 40) & 0xFF) +#define B64_6(x) (((x) >> 48) & 0xFF) +#define B64_7(x) ((x) >> 56) +#define R64 SPH_ROTL64 +#define PC64(j, r) ((sph_u64)((j) + (r))) +#define QC64(j, r) (((sph_u64)(r) << 56) ^ SPH_T64(~((sph_u64)(j) << 56))) +#endif + +#else + +#define C32e(x) SPH_C32(x) +#define dec32e_aligned sph_dec32be_aligned +#define enc32e sph_enc32be +#define B32_0(x) ((x) >> 24) +#define B32_1(x) (((x) >> 16) & 0xFF) +#define B32_2(x) (((x) >> 8) & 0xFF) +#define B32_3(x) ((x) & 0xFF) + +#define R32u(u, d) SPH_T32(((u) >> 16) | ((d) << 16)) +#define R32d(u, d) SPH_T32(((u) << 16) | ((d) >> 16)) + +#define PC32up(j, r) ((sph_u32)((j) + (r)) << 24) +#define PC32dn(j, r) 0 +#define QC32up(j, r) SPH_C32(0xFFFFFFFF) +#define QC32dn(j, r) ((sph_u32)(r) ^ SPH_T32(~(sph_u32)(j))) + +#if SPH_64 +#define C64e(x) SPH_C64(x) +#define dec64e_aligned sph_dec64be_aligned +#define enc64e sph_enc64be +#define B64_0(x) ((x) >> 56) +#define B64_1(x) (((x) >> 48) & 0xFF) +#define B64_2(x) (((x) >> 40) & 0xFF) +#define B64_3(x) (((x) >> 32) & 0xFF) +#define B64_4(x) (((x) >> 24) & 0xFF) +#define B64_5(x) (((x) >> 16) & 0xFF) +#define B64_6(x) (((x) >> 8) & 0xFF) +#define B64_7(x) ((x) & 0xFF) +#define R64 SPH_ROTR64 +#define PC64(j, r) ((sph_u64)((j) + (r)) << 56) +#define QC64(j, r) ((sph_u64)(r) ^ SPH_T64(~(sph_u64)(j))) +#endif + +#endif + +#if SPH_GROESTL_64 + +static const sph_u64 T0[] = { + C64e(0xc632f4a5f497a5c6), C64e(0xf86f978497eb84f8), + C64e(0xee5eb099b0c799ee), C64e(0xf67a8c8d8cf78df6), + C64e(0xffe8170d17e50dff), C64e(0xd60adcbddcb7bdd6), + C64e(0xde16c8b1c8a7b1de), C64e(0x916dfc54fc395491), + C64e(0x6090f050f0c05060), C64e(0x0207050305040302), + C64e(0xce2ee0a9e087a9ce), C64e(0x56d1877d87ac7d56), + C64e(0xe7cc2b192bd519e7), C64e(0xb513a662a67162b5), + C64e(0x4d7c31e6319ae64d), C64e(0xec59b59ab5c39aec), + C64e(0x8f40cf45cf05458f), C64e(0x1fa3bc9dbc3e9d1f), + C64e(0x8949c040c0094089), C64e(0xfa68928792ef87fa), + C64e(0xefd03f153fc515ef), C64e(0xb29426eb267febb2), + C64e(0x8ece40c94007c98e), C64e(0xfbe61d0b1ded0bfb), + C64e(0x416e2fec2f82ec41), C64e(0xb31aa967a97d67b3), + C64e(0x5f431cfd1cbefd5f), C64e(0x456025ea258aea45), + C64e(0x23f9dabfda46bf23), C64e(0x535102f702a6f753), + C64e(0xe445a196a1d396e4), C64e(0x9b76ed5bed2d5b9b), + C64e(0x75285dc25deac275), C64e(0xe1c5241c24d91ce1), + C64e(0x3dd4e9aee97aae3d), C64e(0x4cf2be6abe986a4c), + C64e(0x6c82ee5aeed85a6c), C64e(0x7ebdc341c3fc417e), + C64e(0xf5f3060206f102f5), C64e(0x8352d14fd11d4f83), + C64e(0x688ce45ce4d05c68), C64e(0x515607f407a2f451), + C64e(0xd18d5c345cb934d1), C64e(0xf9e1180818e908f9), + C64e(0xe24cae93aedf93e2), C64e(0xab3e9573954d73ab), + C64e(0x6297f553f5c45362), C64e(0x2a6b413f41543f2a), + C64e(0x081c140c14100c08), C64e(0x9563f652f6315295), + C64e(0x46e9af65af8c6546), C64e(0x9d7fe25ee2215e9d), + C64e(0x3048782878602830), C64e(0x37cff8a1f86ea137), + C64e(0x0a1b110f11140f0a), C64e(0x2febc4b5c45eb52f), + C64e(0x0e151b091b1c090e), C64e(0x247e5a365a483624), + C64e(0x1badb69bb6369b1b), C64e(0xdf98473d47a53ddf), + C64e(0xcda76a266a8126cd), C64e(0x4ef5bb69bb9c694e), + C64e(0x7f334ccd4cfecd7f), C64e(0xea50ba9fbacf9fea), + C64e(0x123f2d1b2d241b12), C64e(0x1da4b99eb93a9e1d), + C64e(0x58c49c749cb07458), C64e(0x3446722e72682e34), + C64e(0x3641772d776c2d36), C64e(0xdc11cdb2cda3b2dc), + C64e(0xb49d29ee2973eeb4), C64e(0x5b4d16fb16b6fb5b), + C64e(0xa4a501f60153f6a4), C64e(0x76a1d74dd7ec4d76), + C64e(0xb714a361a37561b7), C64e(0x7d3449ce49face7d), + C64e(0x52df8d7b8da47b52), C64e(0xdd9f423e42a13edd), + C64e(0x5ecd937193bc715e), C64e(0x13b1a297a2269713), + C64e(0xa6a204f50457f5a6), C64e(0xb901b868b86968b9), + C64e(0x0000000000000000), C64e(0xc1b5742c74992cc1), + C64e(0x40e0a060a0806040), C64e(0xe3c2211f21dd1fe3), + C64e(0x793a43c843f2c879), C64e(0xb69a2ced2c77edb6), + C64e(0xd40dd9bed9b3bed4), C64e(0x8d47ca46ca01468d), + C64e(0x671770d970ced967), C64e(0x72afdd4bdde44b72), + C64e(0x94ed79de7933de94), C64e(0x98ff67d4672bd498), + C64e(0xb09323e8237be8b0), C64e(0x855bde4ade114a85), + C64e(0xbb06bd6bbd6d6bbb), C64e(0xc5bb7e2a7e912ac5), + C64e(0x4f7b34e5349ee54f), C64e(0xedd73a163ac116ed), + C64e(0x86d254c55417c586), C64e(0x9af862d7622fd79a), + C64e(0x6699ff55ffcc5566), C64e(0x11b6a794a7229411), + C64e(0x8ac04acf4a0fcf8a), C64e(0xe9d9301030c910e9), + C64e(0x040e0a060a080604), C64e(0xfe66988198e781fe), + C64e(0xa0ab0bf00b5bf0a0), C64e(0x78b4cc44ccf04478), + C64e(0x25f0d5bad54aba25), C64e(0x4b753ee33e96e34b), + C64e(0xa2ac0ef30e5ff3a2), C64e(0x5d4419fe19bafe5d), + C64e(0x80db5bc05b1bc080), C64e(0x0580858a850a8a05), + C64e(0x3fd3ecadec7ead3f), C64e(0x21fedfbcdf42bc21), + C64e(0x70a8d848d8e04870), C64e(0xf1fd0c040cf904f1), + C64e(0x63197adf7ac6df63), C64e(0x772f58c158eec177), + C64e(0xaf309f759f4575af), C64e(0x42e7a563a5846342), + C64e(0x2070503050403020), C64e(0xe5cb2e1a2ed11ae5), + C64e(0xfdef120e12e10efd), C64e(0xbf08b76db7656dbf), + C64e(0x8155d44cd4194c81), C64e(0x18243c143c301418), + C64e(0x26795f355f4c3526), C64e(0xc3b2712f719d2fc3), + C64e(0xbe8638e13867e1be), C64e(0x35c8fda2fd6aa235), + C64e(0x88c74fcc4f0bcc88), C64e(0x2e654b394b5c392e), + C64e(0x936af957f93d5793), C64e(0x55580df20daaf255), + C64e(0xfc619d829de382fc), C64e(0x7ab3c947c9f4477a), + C64e(0xc827efacef8bacc8), C64e(0xba8832e7326fe7ba), + C64e(0x324f7d2b7d642b32), C64e(0xe642a495a4d795e6), + C64e(0xc03bfba0fb9ba0c0), C64e(0x19aab398b3329819), + C64e(0x9ef668d16827d19e), C64e(0xa322817f815d7fa3), + C64e(0x44eeaa66aa886644), C64e(0x54d6827e82a87e54), + C64e(0x3bdde6abe676ab3b), C64e(0x0b959e839e16830b), + C64e(0x8cc945ca4503ca8c), C64e(0xc7bc7b297b9529c7), + C64e(0x6b056ed36ed6d36b), C64e(0x286c443c44503c28), + C64e(0xa72c8b798b5579a7), C64e(0xbc813de23d63e2bc), + C64e(0x1631271d272c1d16), C64e(0xad379a769a4176ad), + C64e(0xdb964d3b4dad3bdb), C64e(0x649efa56fac85664), + C64e(0x74a6d24ed2e84e74), C64e(0x1436221e22281e14), + C64e(0x92e476db763fdb92), C64e(0x0c121e0a1e180a0c), + C64e(0x48fcb46cb4906c48), C64e(0xb88f37e4376be4b8), + C64e(0x9f78e75de7255d9f), C64e(0xbd0fb26eb2616ebd), + C64e(0x43692aef2a86ef43), C64e(0xc435f1a6f193a6c4), + C64e(0x39dae3a8e372a839), C64e(0x31c6f7a4f762a431), + C64e(0xd38a593759bd37d3), C64e(0xf274868b86ff8bf2), + C64e(0xd583563256b132d5), C64e(0x8b4ec543c50d438b), + C64e(0x6e85eb59ebdc596e), C64e(0xda18c2b7c2afb7da), + C64e(0x018e8f8c8f028c01), C64e(0xb11dac64ac7964b1), + C64e(0x9cf16dd26d23d29c), C64e(0x49723be03b92e049), + C64e(0xd81fc7b4c7abb4d8), C64e(0xacb915fa1543faac), + C64e(0xf3fa090709fd07f3), C64e(0xcfa06f256f8525cf), + C64e(0xca20eaafea8fafca), C64e(0xf47d898e89f38ef4), + C64e(0x476720e9208ee947), C64e(0x1038281828201810), + C64e(0x6f0b64d564ded56f), C64e(0xf073838883fb88f0), + C64e(0x4afbb16fb1946f4a), C64e(0x5cca967296b8725c), + C64e(0x38546c246c702438), C64e(0x575f08f108aef157), + C64e(0x732152c752e6c773), C64e(0x9764f351f3355197), + C64e(0xcbae6523658d23cb), C64e(0xa125847c84597ca1), + C64e(0xe857bf9cbfcb9ce8), C64e(0x3e5d6321637c213e), + C64e(0x96ea7cdd7c37dd96), C64e(0x611e7fdc7fc2dc61), + C64e(0x0d9c9186911a860d), C64e(0x0f9b9485941e850f), + C64e(0xe04bab90abdb90e0), C64e(0x7cbac642c6f8427c), + C64e(0x712657c457e2c471), C64e(0xcc29e5aae583aacc), + C64e(0x90e373d8733bd890), C64e(0x06090f050f0c0506), + C64e(0xf7f4030103f501f7), C64e(0x1c2a36123638121c), + C64e(0xc23cfea3fe9fa3c2), C64e(0x6a8be15fe1d45f6a), + C64e(0xaebe10f91047f9ae), C64e(0x69026bd06bd2d069), + C64e(0x17bfa891a82e9117), C64e(0x9971e858e8295899), + C64e(0x3a5369276974273a), C64e(0x27f7d0b9d04eb927), + C64e(0xd991483848a938d9), C64e(0xebde351335cd13eb), + C64e(0x2be5ceb3ce56b32b), C64e(0x2277553355443322), + C64e(0xd204d6bbd6bfbbd2), C64e(0xa9399070904970a9), + C64e(0x07878089800e8907), C64e(0x33c1f2a7f266a733), + C64e(0x2decc1b6c15ab62d), C64e(0x3c5a66226678223c), + C64e(0x15b8ad92ad2a9215), C64e(0xc9a96020608920c9), + C64e(0x875cdb49db154987), C64e(0xaab01aff1a4fffaa), + C64e(0x50d8887888a07850), C64e(0xa52b8e7a8e517aa5), + C64e(0x03898a8f8a068f03), C64e(0x594a13f813b2f859), + C64e(0x09929b809b128009), C64e(0x1a2339173934171a), + C64e(0x651075da75cada65), C64e(0xd784533153b531d7), + C64e(0x84d551c65113c684), C64e(0xd003d3b8d3bbb8d0), + C64e(0x82dc5ec35e1fc382), C64e(0x29e2cbb0cb52b029), + C64e(0x5ac3997799b4775a), C64e(0x1e2d3311333c111e), + C64e(0x7b3d46cb46f6cb7b), C64e(0xa8b71ffc1f4bfca8), + C64e(0x6d0c61d661dad66d), C64e(0x2c624e3a4e583a2c) +}; + +#if !SPH_SMALL_FOOTPRINT_GROESTL + +static const sph_u64 T1[] = { + C64e(0xc6c632f4a5f497a5), C64e(0xf8f86f978497eb84), + C64e(0xeeee5eb099b0c799), C64e(0xf6f67a8c8d8cf78d), + C64e(0xffffe8170d17e50d), C64e(0xd6d60adcbddcb7bd), + C64e(0xdede16c8b1c8a7b1), C64e(0x91916dfc54fc3954), + C64e(0x606090f050f0c050), C64e(0x0202070503050403), + C64e(0xcece2ee0a9e087a9), C64e(0x5656d1877d87ac7d), + C64e(0xe7e7cc2b192bd519), C64e(0xb5b513a662a67162), + C64e(0x4d4d7c31e6319ae6), C64e(0xecec59b59ab5c39a), + C64e(0x8f8f40cf45cf0545), C64e(0x1f1fa3bc9dbc3e9d), + C64e(0x898949c040c00940), C64e(0xfafa68928792ef87), + C64e(0xefefd03f153fc515), C64e(0xb2b29426eb267feb), + C64e(0x8e8ece40c94007c9), C64e(0xfbfbe61d0b1ded0b), + C64e(0x41416e2fec2f82ec), C64e(0xb3b31aa967a97d67), + C64e(0x5f5f431cfd1cbefd), C64e(0x45456025ea258aea), + C64e(0x2323f9dabfda46bf), C64e(0x53535102f702a6f7), + C64e(0xe4e445a196a1d396), C64e(0x9b9b76ed5bed2d5b), + C64e(0x7575285dc25deac2), C64e(0xe1e1c5241c24d91c), + C64e(0x3d3dd4e9aee97aae), C64e(0x4c4cf2be6abe986a), + C64e(0x6c6c82ee5aeed85a), C64e(0x7e7ebdc341c3fc41), + C64e(0xf5f5f3060206f102), C64e(0x838352d14fd11d4f), + C64e(0x68688ce45ce4d05c), C64e(0x51515607f407a2f4), + C64e(0xd1d18d5c345cb934), C64e(0xf9f9e1180818e908), + C64e(0xe2e24cae93aedf93), C64e(0xabab3e9573954d73), + C64e(0x626297f553f5c453), C64e(0x2a2a6b413f41543f), + C64e(0x08081c140c14100c), C64e(0x959563f652f63152), + C64e(0x4646e9af65af8c65), C64e(0x9d9d7fe25ee2215e), + C64e(0x3030487828786028), C64e(0x3737cff8a1f86ea1), + C64e(0x0a0a1b110f11140f), C64e(0x2f2febc4b5c45eb5), + C64e(0x0e0e151b091b1c09), C64e(0x24247e5a365a4836), + C64e(0x1b1badb69bb6369b), C64e(0xdfdf98473d47a53d), + C64e(0xcdcda76a266a8126), C64e(0x4e4ef5bb69bb9c69), + C64e(0x7f7f334ccd4cfecd), C64e(0xeaea50ba9fbacf9f), + C64e(0x12123f2d1b2d241b), C64e(0x1d1da4b99eb93a9e), + C64e(0x5858c49c749cb074), C64e(0x343446722e72682e), + C64e(0x363641772d776c2d), C64e(0xdcdc11cdb2cda3b2), + C64e(0xb4b49d29ee2973ee), C64e(0x5b5b4d16fb16b6fb), + C64e(0xa4a4a501f60153f6), C64e(0x7676a1d74dd7ec4d), + C64e(0xb7b714a361a37561), C64e(0x7d7d3449ce49face), + C64e(0x5252df8d7b8da47b), C64e(0xdddd9f423e42a13e), + C64e(0x5e5ecd937193bc71), C64e(0x1313b1a297a22697), + C64e(0xa6a6a204f50457f5), C64e(0xb9b901b868b86968), + C64e(0x0000000000000000), C64e(0xc1c1b5742c74992c), + C64e(0x4040e0a060a08060), C64e(0xe3e3c2211f21dd1f), + C64e(0x79793a43c843f2c8), C64e(0xb6b69a2ced2c77ed), + C64e(0xd4d40dd9bed9b3be), C64e(0x8d8d47ca46ca0146), + C64e(0x67671770d970ced9), C64e(0x7272afdd4bdde44b), + C64e(0x9494ed79de7933de), C64e(0x9898ff67d4672bd4), + C64e(0xb0b09323e8237be8), C64e(0x85855bde4ade114a), + C64e(0xbbbb06bd6bbd6d6b), C64e(0xc5c5bb7e2a7e912a), + C64e(0x4f4f7b34e5349ee5), C64e(0xededd73a163ac116), + C64e(0x8686d254c55417c5), C64e(0x9a9af862d7622fd7), + C64e(0x666699ff55ffcc55), C64e(0x1111b6a794a72294), + C64e(0x8a8ac04acf4a0fcf), C64e(0xe9e9d9301030c910), + C64e(0x04040e0a060a0806), C64e(0xfefe66988198e781), + C64e(0xa0a0ab0bf00b5bf0), C64e(0x7878b4cc44ccf044), + C64e(0x2525f0d5bad54aba), C64e(0x4b4b753ee33e96e3), + C64e(0xa2a2ac0ef30e5ff3), C64e(0x5d5d4419fe19bafe), + C64e(0x8080db5bc05b1bc0), C64e(0x050580858a850a8a), + C64e(0x3f3fd3ecadec7ead), C64e(0x2121fedfbcdf42bc), + C64e(0x7070a8d848d8e048), C64e(0xf1f1fd0c040cf904), + C64e(0x6363197adf7ac6df), C64e(0x77772f58c158eec1), + C64e(0xafaf309f759f4575), C64e(0x4242e7a563a58463), + C64e(0x2020705030504030), C64e(0xe5e5cb2e1a2ed11a), + C64e(0xfdfdef120e12e10e), C64e(0xbfbf08b76db7656d), + C64e(0x818155d44cd4194c), C64e(0x1818243c143c3014), + C64e(0x2626795f355f4c35), C64e(0xc3c3b2712f719d2f), + C64e(0xbebe8638e13867e1), C64e(0x3535c8fda2fd6aa2), + C64e(0x8888c74fcc4f0bcc), C64e(0x2e2e654b394b5c39), + C64e(0x93936af957f93d57), C64e(0x5555580df20daaf2), + C64e(0xfcfc619d829de382), C64e(0x7a7ab3c947c9f447), + C64e(0xc8c827efacef8bac), C64e(0xbaba8832e7326fe7), + C64e(0x32324f7d2b7d642b), C64e(0xe6e642a495a4d795), + C64e(0xc0c03bfba0fb9ba0), C64e(0x1919aab398b33298), + C64e(0x9e9ef668d16827d1), C64e(0xa3a322817f815d7f), + C64e(0x4444eeaa66aa8866), C64e(0x5454d6827e82a87e), + C64e(0x3b3bdde6abe676ab), C64e(0x0b0b959e839e1683), + C64e(0x8c8cc945ca4503ca), C64e(0xc7c7bc7b297b9529), + C64e(0x6b6b056ed36ed6d3), C64e(0x28286c443c44503c), + C64e(0xa7a72c8b798b5579), C64e(0xbcbc813de23d63e2), + C64e(0x161631271d272c1d), C64e(0xadad379a769a4176), + C64e(0xdbdb964d3b4dad3b), C64e(0x64649efa56fac856), + C64e(0x7474a6d24ed2e84e), C64e(0x141436221e22281e), + C64e(0x9292e476db763fdb), C64e(0x0c0c121e0a1e180a), + C64e(0x4848fcb46cb4906c), C64e(0xb8b88f37e4376be4), + C64e(0x9f9f78e75de7255d), C64e(0xbdbd0fb26eb2616e), + C64e(0x4343692aef2a86ef), C64e(0xc4c435f1a6f193a6), + C64e(0x3939dae3a8e372a8), C64e(0x3131c6f7a4f762a4), + C64e(0xd3d38a593759bd37), C64e(0xf2f274868b86ff8b), + C64e(0xd5d583563256b132), C64e(0x8b8b4ec543c50d43), + C64e(0x6e6e85eb59ebdc59), C64e(0xdada18c2b7c2afb7), + C64e(0x01018e8f8c8f028c), C64e(0xb1b11dac64ac7964), + C64e(0x9c9cf16dd26d23d2), C64e(0x4949723be03b92e0), + C64e(0xd8d81fc7b4c7abb4), C64e(0xacacb915fa1543fa), + C64e(0xf3f3fa090709fd07), C64e(0xcfcfa06f256f8525), + C64e(0xcaca20eaafea8faf), C64e(0xf4f47d898e89f38e), + C64e(0x47476720e9208ee9), C64e(0x1010382818282018), + C64e(0x6f6f0b64d564ded5), C64e(0xf0f073838883fb88), + C64e(0x4a4afbb16fb1946f), C64e(0x5c5cca967296b872), + C64e(0x3838546c246c7024), C64e(0x57575f08f108aef1), + C64e(0x73732152c752e6c7), C64e(0x979764f351f33551), + C64e(0xcbcbae6523658d23), C64e(0xa1a125847c84597c), + C64e(0xe8e857bf9cbfcb9c), C64e(0x3e3e5d6321637c21), + C64e(0x9696ea7cdd7c37dd), C64e(0x61611e7fdc7fc2dc), + C64e(0x0d0d9c9186911a86), C64e(0x0f0f9b9485941e85), + C64e(0xe0e04bab90abdb90), C64e(0x7c7cbac642c6f842), + C64e(0x71712657c457e2c4), C64e(0xcccc29e5aae583aa), + C64e(0x9090e373d8733bd8), C64e(0x0606090f050f0c05), + C64e(0xf7f7f4030103f501), C64e(0x1c1c2a3612363812), + C64e(0xc2c23cfea3fe9fa3), C64e(0x6a6a8be15fe1d45f), + C64e(0xaeaebe10f91047f9), C64e(0x6969026bd06bd2d0), + C64e(0x1717bfa891a82e91), C64e(0x999971e858e82958), + C64e(0x3a3a536927697427), C64e(0x2727f7d0b9d04eb9), + C64e(0xd9d991483848a938), C64e(0xebebde351335cd13), + C64e(0x2b2be5ceb3ce56b3), C64e(0x2222775533554433), + C64e(0xd2d204d6bbd6bfbb), C64e(0xa9a9399070904970), + C64e(0x0707878089800e89), C64e(0x3333c1f2a7f266a7), + C64e(0x2d2decc1b6c15ab6), C64e(0x3c3c5a6622667822), + C64e(0x1515b8ad92ad2a92), C64e(0xc9c9a96020608920), + C64e(0x87875cdb49db1549), C64e(0xaaaab01aff1a4fff), + C64e(0x5050d8887888a078), C64e(0xa5a52b8e7a8e517a), + C64e(0x0303898a8f8a068f), C64e(0x59594a13f813b2f8), + C64e(0x0909929b809b1280), C64e(0x1a1a233917393417), + C64e(0x65651075da75cada), C64e(0xd7d784533153b531), + C64e(0x8484d551c65113c6), C64e(0xd0d003d3b8d3bbb8), + C64e(0x8282dc5ec35e1fc3), C64e(0x2929e2cbb0cb52b0), + C64e(0x5a5ac3997799b477), C64e(0x1e1e2d3311333c11), + C64e(0x7b7b3d46cb46f6cb), C64e(0xa8a8b71ffc1f4bfc), + C64e(0x6d6d0c61d661dad6), C64e(0x2c2c624e3a4e583a) +}; + +static const sph_u64 T2[] = { + C64e(0xa5c6c632f4a5f497), C64e(0x84f8f86f978497eb), + C64e(0x99eeee5eb099b0c7), C64e(0x8df6f67a8c8d8cf7), + C64e(0x0dffffe8170d17e5), C64e(0xbdd6d60adcbddcb7), + C64e(0xb1dede16c8b1c8a7), C64e(0x5491916dfc54fc39), + C64e(0x50606090f050f0c0), C64e(0x0302020705030504), + C64e(0xa9cece2ee0a9e087), C64e(0x7d5656d1877d87ac), + C64e(0x19e7e7cc2b192bd5), C64e(0x62b5b513a662a671), + C64e(0xe64d4d7c31e6319a), C64e(0x9aecec59b59ab5c3), + C64e(0x458f8f40cf45cf05), C64e(0x9d1f1fa3bc9dbc3e), + C64e(0x40898949c040c009), C64e(0x87fafa68928792ef), + C64e(0x15efefd03f153fc5), C64e(0xebb2b29426eb267f), + C64e(0xc98e8ece40c94007), C64e(0x0bfbfbe61d0b1ded), + C64e(0xec41416e2fec2f82), C64e(0x67b3b31aa967a97d), + C64e(0xfd5f5f431cfd1cbe), C64e(0xea45456025ea258a), + C64e(0xbf2323f9dabfda46), C64e(0xf753535102f702a6), + C64e(0x96e4e445a196a1d3), C64e(0x5b9b9b76ed5bed2d), + C64e(0xc27575285dc25dea), C64e(0x1ce1e1c5241c24d9), + C64e(0xae3d3dd4e9aee97a), C64e(0x6a4c4cf2be6abe98), + C64e(0x5a6c6c82ee5aeed8), C64e(0x417e7ebdc341c3fc), + C64e(0x02f5f5f3060206f1), C64e(0x4f838352d14fd11d), + C64e(0x5c68688ce45ce4d0), C64e(0xf451515607f407a2), + C64e(0x34d1d18d5c345cb9), C64e(0x08f9f9e1180818e9), + C64e(0x93e2e24cae93aedf), C64e(0x73abab3e9573954d), + C64e(0x53626297f553f5c4), C64e(0x3f2a2a6b413f4154), + C64e(0x0c08081c140c1410), C64e(0x52959563f652f631), + C64e(0x654646e9af65af8c), C64e(0x5e9d9d7fe25ee221), + C64e(0x2830304878287860), C64e(0xa13737cff8a1f86e), + C64e(0x0f0a0a1b110f1114), C64e(0xb52f2febc4b5c45e), + C64e(0x090e0e151b091b1c), C64e(0x3624247e5a365a48), + C64e(0x9b1b1badb69bb636), C64e(0x3ddfdf98473d47a5), + C64e(0x26cdcda76a266a81), C64e(0x694e4ef5bb69bb9c), + C64e(0xcd7f7f334ccd4cfe), C64e(0x9feaea50ba9fbacf), + C64e(0x1b12123f2d1b2d24), C64e(0x9e1d1da4b99eb93a), + C64e(0x745858c49c749cb0), C64e(0x2e343446722e7268), + C64e(0x2d363641772d776c), C64e(0xb2dcdc11cdb2cda3), + C64e(0xeeb4b49d29ee2973), C64e(0xfb5b5b4d16fb16b6), + C64e(0xf6a4a4a501f60153), C64e(0x4d7676a1d74dd7ec), + C64e(0x61b7b714a361a375), C64e(0xce7d7d3449ce49fa), + C64e(0x7b5252df8d7b8da4), C64e(0x3edddd9f423e42a1), + C64e(0x715e5ecd937193bc), C64e(0x971313b1a297a226), + C64e(0xf5a6a6a204f50457), C64e(0x68b9b901b868b869), + C64e(0x0000000000000000), C64e(0x2cc1c1b5742c7499), + C64e(0x604040e0a060a080), C64e(0x1fe3e3c2211f21dd), + C64e(0xc879793a43c843f2), C64e(0xedb6b69a2ced2c77), + C64e(0xbed4d40dd9bed9b3), C64e(0x468d8d47ca46ca01), + C64e(0xd967671770d970ce), C64e(0x4b7272afdd4bdde4), + C64e(0xde9494ed79de7933), C64e(0xd49898ff67d4672b), + C64e(0xe8b0b09323e8237b), C64e(0x4a85855bde4ade11), + C64e(0x6bbbbb06bd6bbd6d), C64e(0x2ac5c5bb7e2a7e91), + C64e(0xe54f4f7b34e5349e), C64e(0x16ededd73a163ac1), + C64e(0xc58686d254c55417), C64e(0xd79a9af862d7622f), + C64e(0x55666699ff55ffcc), C64e(0x941111b6a794a722), + C64e(0xcf8a8ac04acf4a0f), C64e(0x10e9e9d9301030c9), + C64e(0x0604040e0a060a08), C64e(0x81fefe66988198e7), + C64e(0xf0a0a0ab0bf00b5b), C64e(0x447878b4cc44ccf0), + C64e(0xba2525f0d5bad54a), C64e(0xe34b4b753ee33e96), + C64e(0xf3a2a2ac0ef30e5f), C64e(0xfe5d5d4419fe19ba), + C64e(0xc08080db5bc05b1b), C64e(0x8a050580858a850a), + C64e(0xad3f3fd3ecadec7e), C64e(0xbc2121fedfbcdf42), + C64e(0x487070a8d848d8e0), C64e(0x04f1f1fd0c040cf9), + C64e(0xdf6363197adf7ac6), C64e(0xc177772f58c158ee), + C64e(0x75afaf309f759f45), C64e(0x634242e7a563a584), + C64e(0x3020207050305040), C64e(0x1ae5e5cb2e1a2ed1), + C64e(0x0efdfdef120e12e1), C64e(0x6dbfbf08b76db765), + C64e(0x4c818155d44cd419), C64e(0x141818243c143c30), + C64e(0x352626795f355f4c), C64e(0x2fc3c3b2712f719d), + C64e(0xe1bebe8638e13867), C64e(0xa23535c8fda2fd6a), + C64e(0xcc8888c74fcc4f0b), C64e(0x392e2e654b394b5c), + C64e(0x5793936af957f93d), C64e(0xf25555580df20daa), + C64e(0x82fcfc619d829de3), C64e(0x477a7ab3c947c9f4), + C64e(0xacc8c827efacef8b), C64e(0xe7baba8832e7326f), + C64e(0x2b32324f7d2b7d64), C64e(0x95e6e642a495a4d7), + C64e(0xa0c0c03bfba0fb9b), C64e(0x981919aab398b332), + C64e(0xd19e9ef668d16827), C64e(0x7fa3a322817f815d), + C64e(0x664444eeaa66aa88), C64e(0x7e5454d6827e82a8), + C64e(0xab3b3bdde6abe676), C64e(0x830b0b959e839e16), + C64e(0xca8c8cc945ca4503), C64e(0x29c7c7bc7b297b95), + C64e(0xd36b6b056ed36ed6), C64e(0x3c28286c443c4450), + C64e(0x79a7a72c8b798b55), C64e(0xe2bcbc813de23d63), + C64e(0x1d161631271d272c), C64e(0x76adad379a769a41), + C64e(0x3bdbdb964d3b4dad), C64e(0x5664649efa56fac8), + C64e(0x4e7474a6d24ed2e8), C64e(0x1e141436221e2228), + C64e(0xdb9292e476db763f), C64e(0x0a0c0c121e0a1e18), + C64e(0x6c4848fcb46cb490), C64e(0xe4b8b88f37e4376b), + C64e(0x5d9f9f78e75de725), C64e(0x6ebdbd0fb26eb261), + C64e(0xef4343692aef2a86), C64e(0xa6c4c435f1a6f193), + C64e(0xa83939dae3a8e372), C64e(0xa43131c6f7a4f762), + C64e(0x37d3d38a593759bd), C64e(0x8bf2f274868b86ff), + C64e(0x32d5d583563256b1), C64e(0x438b8b4ec543c50d), + C64e(0x596e6e85eb59ebdc), C64e(0xb7dada18c2b7c2af), + C64e(0x8c01018e8f8c8f02), C64e(0x64b1b11dac64ac79), + C64e(0xd29c9cf16dd26d23), C64e(0xe04949723be03b92), + C64e(0xb4d8d81fc7b4c7ab), C64e(0xfaacacb915fa1543), + C64e(0x07f3f3fa090709fd), C64e(0x25cfcfa06f256f85), + C64e(0xafcaca20eaafea8f), C64e(0x8ef4f47d898e89f3), + C64e(0xe947476720e9208e), C64e(0x1810103828182820), + C64e(0xd56f6f0b64d564de), C64e(0x88f0f073838883fb), + C64e(0x6f4a4afbb16fb194), C64e(0x725c5cca967296b8), + C64e(0x243838546c246c70), C64e(0xf157575f08f108ae), + C64e(0xc773732152c752e6), C64e(0x51979764f351f335), + C64e(0x23cbcbae6523658d), C64e(0x7ca1a125847c8459), + C64e(0x9ce8e857bf9cbfcb), C64e(0x213e3e5d6321637c), + C64e(0xdd9696ea7cdd7c37), C64e(0xdc61611e7fdc7fc2), + C64e(0x860d0d9c9186911a), C64e(0x850f0f9b9485941e), + C64e(0x90e0e04bab90abdb), C64e(0x427c7cbac642c6f8), + C64e(0xc471712657c457e2), C64e(0xaacccc29e5aae583), + C64e(0xd89090e373d8733b), C64e(0x050606090f050f0c), + C64e(0x01f7f7f4030103f5), C64e(0x121c1c2a36123638), + C64e(0xa3c2c23cfea3fe9f), C64e(0x5f6a6a8be15fe1d4), + C64e(0xf9aeaebe10f91047), C64e(0xd06969026bd06bd2), + C64e(0x911717bfa891a82e), C64e(0x58999971e858e829), + C64e(0x273a3a5369276974), C64e(0xb92727f7d0b9d04e), + C64e(0x38d9d991483848a9), C64e(0x13ebebde351335cd), + C64e(0xb32b2be5ceb3ce56), C64e(0x3322227755335544), + C64e(0xbbd2d204d6bbd6bf), C64e(0x70a9a93990709049), + C64e(0x890707878089800e), C64e(0xa73333c1f2a7f266), + C64e(0xb62d2decc1b6c15a), C64e(0x223c3c5a66226678), + C64e(0x921515b8ad92ad2a), C64e(0x20c9c9a960206089), + C64e(0x4987875cdb49db15), C64e(0xffaaaab01aff1a4f), + C64e(0x785050d8887888a0), C64e(0x7aa5a52b8e7a8e51), + C64e(0x8f0303898a8f8a06), C64e(0xf859594a13f813b2), + C64e(0x800909929b809b12), C64e(0x171a1a2339173934), + C64e(0xda65651075da75ca), C64e(0x31d7d784533153b5), + C64e(0xc68484d551c65113), C64e(0xb8d0d003d3b8d3bb), + C64e(0xc38282dc5ec35e1f), C64e(0xb02929e2cbb0cb52), + C64e(0x775a5ac3997799b4), C64e(0x111e1e2d3311333c), + C64e(0xcb7b7b3d46cb46f6), C64e(0xfca8a8b71ffc1f4b), + C64e(0xd66d6d0c61d661da), C64e(0x3a2c2c624e3a4e58) +}; + +static const sph_u64 T3[] = { + C64e(0x97a5c6c632f4a5f4), C64e(0xeb84f8f86f978497), + C64e(0xc799eeee5eb099b0), C64e(0xf78df6f67a8c8d8c), + C64e(0xe50dffffe8170d17), C64e(0xb7bdd6d60adcbddc), + C64e(0xa7b1dede16c8b1c8), C64e(0x395491916dfc54fc), + C64e(0xc050606090f050f0), C64e(0x0403020207050305), + C64e(0x87a9cece2ee0a9e0), C64e(0xac7d5656d1877d87), + C64e(0xd519e7e7cc2b192b), C64e(0x7162b5b513a662a6), + C64e(0x9ae64d4d7c31e631), C64e(0xc39aecec59b59ab5), + C64e(0x05458f8f40cf45cf), C64e(0x3e9d1f1fa3bc9dbc), + C64e(0x0940898949c040c0), C64e(0xef87fafa68928792), + C64e(0xc515efefd03f153f), C64e(0x7febb2b29426eb26), + C64e(0x07c98e8ece40c940), C64e(0xed0bfbfbe61d0b1d), + C64e(0x82ec41416e2fec2f), C64e(0x7d67b3b31aa967a9), + C64e(0xbefd5f5f431cfd1c), C64e(0x8aea45456025ea25), + C64e(0x46bf2323f9dabfda), C64e(0xa6f753535102f702), + C64e(0xd396e4e445a196a1), C64e(0x2d5b9b9b76ed5bed), + C64e(0xeac27575285dc25d), C64e(0xd91ce1e1c5241c24), + C64e(0x7aae3d3dd4e9aee9), C64e(0x986a4c4cf2be6abe), + C64e(0xd85a6c6c82ee5aee), C64e(0xfc417e7ebdc341c3), + C64e(0xf102f5f5f3060206), C64e(0x1d4f838352d14fd1), + C64e(0xd05c68688ce45ce4), C64e(0xa2f451515607f407), + C64e(0xb934d1d18d5c345c), C64e(0xe908f9f9e1180818), + C64e(0xdf93e2e24cae93ae), C64e(0x4d73abab3e957395), + C64e(0xc453626297f553f5), C64e(0x543f2a2a6b413f41), + C64e(0x100c08081c140c14), C64e(0x3152959563f652f6), + C64e(0x8c654646e9af65af), C64e(0x215e9d9d7fe25ee2), + C64e(0x6028303048782878), C64e(0x6ea13737cff8a1f8), + C64e(0x140f0a0a1b110f11), C64e(0x5eb52f2febc4b5c4), + C64e(0x1c090e0e151b091b), C64e(0x483624247e5a365a), + C64e(0x369b1b1badb69bb6), C64e(0xa53ddfdf98473d47), + C64e(0x8126cdcda76a266a), C64e(0x9c694e4ef5bb69bb), + C64e(0xfecd7f7f334ccd4c), C64e(0xcf9feaea50ba9fba), + C64e(0x241b12123f2d1b2d), C64e(0x3a9e1d1da4b99eb9), + C64e(0xb0745858c49c749c), C64e(0x682e343446722e72), + C64e(0x6c2d363641772d77), C64e(0xa3b2dcdc11cdb2cd), + C64e(0x73eeb4b49d29ee29), C64e(0xb6fb5b5b4d16fb16), + C64e(0x53f6a4a4a501f601), C64e(0xec4d7676a1d74dd7), + C64e(0x7561b7b714a361a3), C64e(0xface7d7d3449ce49), + C64e(0xa47b5252df8d7b8d), C64e(0xa13edddd9f423e42), + C64e(0xbc715e5ecd937193), C64e(0x26971313b1a297a2), + C64e(0x57f5a6a6a204f504), C64e(0x6968b9b901b868b8), + C64e(0x0000000000000000), C64e(0x992cc1c1b5742c74), + C64e(0x80604040e0a060a0), C64e(0xdd1fe3e3c2211f21), + C64e(0xf2c879793a43c843), C64e(0x77edb6b69a2ced2c), + C64e(0xb3bed4d40dd9bed9), C64e(0x01468d8d47ca46ca), + C64e(0xced967671770d970), C64e(0xe44b7272afdd4bdd), + C64e(0x33de9494ed79de79), C64e(0x2bd49898ff67d467), + C64e(0x7be8b0b09323e823), C64e(0x114a85855bde4ade), + C64e(0x6d6bbbbb06bd6bbd), C64e(0x912ac5c5bb7e2a7e), + C64e(0x9ee54f4f7b34e534), C64e(0xc116ededd73a163a), + C64e(0x17c58686d254c554), C64e(0x2fd79a9af862d762), + C64e(0xcc55666699ff55ff), C64e(0x22941111b6a794a7), + C64e(0x0fcf8a8ac04acf4a), C64e(0xc910e9e9d9301030), + C64e(0x080604040e0a060a), C64e(0xe781fefe66988198), + C64e(0x5bf0a0a0ab0bf00b), C64e(0xf0447878b4cc44cc), + C64e(0x4aba2525f0d5bad5), C64e(0x96e34b4b753ee33e), + C64e(0x5ff3a2a2ac0ef30e), C64e(0xbafe5d5d4419fe19), + C64e(0x1bc08080db5bc05b), C64e(0x0a8a050580858a85), + C64e(0x7ead3f3fd3ecadec), C64e(0x42bc2121fedfbcdf), + C64e(0xe0487070a8d848d8), C64e(0xf904f1f1fd0c040c), + C64e(0xc6df6363197adf7a), C64e(0xeec177772f58c158), + C64e(0x4575afaf309f759f), C64e(0x84634242e7a563a5), + C64e(0x4030202070503050), C64e(0xd11ae5e5cb2e1a2e), + C64e(0xe10efdfdef120e12), C64e(0x656dbfbf08b76db7), + C64e(0x194c818155d44cd4), C64e(0x30141818243c143c), + C64e(0x4c352626795f355f), C64e(0x9d2fc3c3b2712f71), + C64e(0x67e1bebe8638e138), C64e(0x6aa23535c8fda2fd), + C64e(0x0bcc8888c74fcc4f), C64e(0x5c392e2e654b394b), + C64e(0x3d5793936af957f9), C64e(0xaaf25555580df20d), + C64e(0xe382fcfc619d829d), C64e(0xf4477a7ab3c947c9), + C64e(0x8bacc8c827efacef), C64e(0x6fe7baba8832e732), + C64e(0x642b32324f7d2b7d), C64e(0xd795e6e642a495a4), + C64e(0x9ba0c0c03bfba0fb), C64e(0x32981919aab398b3), + C64e(0x27d19e9ef668d168), C64e(0x5d7fa3a322817f81), + C64e(0x88664444eeaa66aa), C64e(0xa87e5454d6827e82), + C64e(0x76ab3b3bdde6abe6), C64e(0x16830b0b959e839e), + C64e(0x03ca8c8cc945ca45), C64e(0x9529c7c7bc7b297b), + C64e(0xd6d36b6b056ed36e), C64e(0x503c28286c443c44), + C64e(0x5579a7a72c8b798b), C64e(0x63e2bcbc813de23d), + C64e(0x2c1d161631271d27), C64e(0x4176adad379a769a), + C64e(0xad3bdbdb964d3b4d), C64e(0xc85664649efa56fa), + C64e(0xe84e7474a6d24ed2), C64e(0x281e141436221e22), + C64e(0x3fdb9292e476db76), C64e(0x180a0c0c121e0a1e), + C64e(0x906c4848fcb46cb4), C64e(0x6be4b8b88f37e437), + C64e(0x255d9f9f78e75de7), C64e(0x616ebdbd0fb26eb2), + C64e(0x86ef4343692aef2a), C64e(0x93a6c4c435f1a6f1), + C64e(0x72a83939dae3a8e3), C64e(0x62a43131c6f7a4f7), + C64e(0xbd37d3d38a593759), C64e(0xff8bf2f274868b86), + C64e(0xb132d5d583563256), C64e(0x0d438b8b4ec543c5), + C64e(0xdc596e6e85eb59eb), C64e(0xafb7dada18c2b7c2), + C64e(0x028c01018e8f8c8f), C64e(0x7964b1b11dac64ac), + C64e(0x23d29c9cf16dd26d), C64e(0x92e04949723be03b), + C64e(0xabb4d8d81fc7b4c7), C64e(0x43faacacb915fa15), + C64e(0xfd07f3f3fa090709), C64e(0x8525cfcfa06f256f), + C64e(0x8fafcaca20eaafea), C64e(0xf38ef4f47d898e89), + C64e(0x8ee947476720e920), C64e(0x2018101038281828), + C64e(0xded56f6f0b64d564), C64e(0xfb88f0f073838883), + C64e(0x946f4a4afbb16fb1), C64e(0xb8725c5cca967296), + C64e(0x70243838546c246c), C64e(0xaef157575f08f108), + C64e(0xe6c773732152c752), C64e(0x3551979764f351f3), + C64e(0x8d23cbcbae652365), C64e(0x597ca1a125847c84), + C64e(0xcb9ce8e857bf9cbf), C64e(0x7c213e3e5d632163), + C64e(0x37dd9696ea7cdd7c), C64e(0xc2dc61611e7fdc7f), + C64e(0x1a860d0d9c918691), C64e(0x1e850f0f9b948594), + C64e(0xdb90e0e04bab90ab), C64e(0xf8427c7cbac642c6), + C64e(0xe2c471712657c457), C64e(0x83aacccc29e5aae5), + C64e(0x3bd89090e373d873), C64e(0x0c050606090f050f), + C64e(0xf501f7f7f4030103), C64e(0x38121c1c2a361236), + C64e(0x9fa3c2c23cfea3fe), C64e(0xd45f6a6a8be15fe1), + C64e(0x47f9aeaebe10f910), C64e(0xd2d06969026bd06b), + C64e(0x2e911717bfa891a8), C64e(0x2958999971e858e8), + C64e(0x74273a3a53692769), C64e(0x4eb92727f7d0b9d0), + C64e(0xa938d9d991483848), C64e(0xcd13ebebde351335), + C64e(0x56b32b2be5ceb3ce), C64e(0x4433222277553355), + C64e(0xbfbbd2d204d6bbd6), C64e(0x4970a9a939907090), + C64e(0x0e89070787808980), C64e(0x66a73333c1f2a7f2), + C64e(0x5ab62d2decc1b6c1), C64e(0x78223c3c5a662266), + C64e(0x2a921515b8ad92ad), C64e(0x8920c9c9a9602060), + C64e(0x154987875cdb49db), C64e(0x4fffaaaab01aff1a), + C64e(0xa0785050d8887888), C64e(0x517aa5a52b8e7a8e), + C64e(0x068f0303898a8f8a), C64e(0xb2f859594a13f813), + C64e(0x12800909929b809b), C64e(0x34171a1a23391739), + C64e(0xcada65651075da75), C64e(0xb531d7d784533153), + C64e(0x13c68484d551c651), C64e(0xbbb8d0d003d3b8d3), + C64e(0x1fc38282dc5ec35e), C64e(0x52b02929e2cbb0cb), + C64e(0xb4775a5ac3997799), C64e(0x3c111e1e2d331133), + C64e(0xf6cb7b7b3d46cb46), C64e(0x4bfca8a8b71ffc1f), + C64e(0xdad66d6d0c61d661), C64e(0x583a2c2c624e3a4e) +}; + +#endif + +static const sph_u64 T4[] = { + C64e(0xf497a5c6c632f4a5), C64e(0x97eb84f8f86f9784), + C64e(0xb0c799eeee5eb099), C64e(0x8cf78df6f67a8c8d), + C64e(0x17e50dffffe8170d), C64e(0xdcb7bdd6d60adcbd), + C64e(0xc8a7b1dede16c8b1), C64e(0xfc395491916dfc54), + C64e(0xf0c050606090f050), C64e(0x0504030202070503), + C64e(0xe087a9cece2ee0a9), C64e(0x87ac7d5656d1877d), + C64e(0x2bd519e7e7cc2b19), C64e(0xa67162b5b513a662), + C64e(0x319ae64d4d7c31e6), C64e(0xb5c39aecec59b59a), + C64e(0xcf05458f8f40cf45), C64e(0xbc3e9d1f1fa3bc9d), + C64e(0xc00940898949c040), C64e(0x92ef87fafa689287), + C64e(0x3fc515efefd03f15), C64e(0x267febb2b29426eb), + C64e(0x4007c98e8ece40c9), C64e(0x1ded0bfbfbe61d0b), + C64e(0x2f82ec41416e2fec), C64e(0xa97d67b3b31aa967), + C64e(0x1cbefd5f5f431cfd), C64e(0x258aea45456025ea), + C64e(0xda46bf2323f9dabf), C64e(0x02a6f753535102f7), + C64e(0xa1d396e4e445a196), C64e(0xed2d5b9b9b76ed5b), + C64e(0x5deac27575285dc2), C64e(0x24d91ce1e1c5241c), + C64e(0xe97aae3d3dd4e9ae), C64e(0xbe986a4c4cf2be6a), + C64e(0xeed85a6c6c82ee5a), C64e(0xc3fc417e7ebdc341), + C64e(0x06f102f5f5f30602), C64e(0xd11d4f838352d14f), + C64e(0xe4d05c68688ce45c), C64e(0x07a2f451515607f4), + C64e(0x5cb934d1d18d5c34), C64e(0x18e908f9f9e11808), + C64e(0xaedf93e2e24cae93), C64e(0x954d73abab3e9573), + C64e(0xf5c453626297f553), C64e(0x41543f2a2a6b413f), + C64e(0x14100c08081c140c), C64e(0xf63152959563f652), + C64e(0xaf8c654646e9af65), C64e(0xe2215e9d9d7fe25e), + C64e(0x7860283030487828), C64e(0xf86ea13737cff8a1), + C64e(0x11140f0a0a1b110f), C64e(0xc45eb52f2febc4b5), + C64e(0x1b1c090e0e151b09), C64e(0x5a483624247e5a36), + C64e(0xb6369b1b1badb69b), C64e(0x47a53ddfdf98473d), + C64e(0x6a8126cdcda76a26), C64e(0xbb9c694e4ef5bb69), + C64e(0x4cfecd7f7f334ccd), C64e(0xbacf9feaea50ba9f), + C64e(0x2d241b12123f2d1b), C64e(0xb93a9e1d1da4b99e), + C64e(0x9cb0745858c49c74), C64e(0x72682e343446722e), + C64e(0x776c2d363641772d), C64e(0xcda3b2dcdc11cdb2), + C64e(0x2973eeb4b49d29ee), C64e(0x16b6fb5b5b4d16fb), + C64e(0x0153f6a4a4a501f6), C64e(0xd7ec4d7676a1d74d), + C64e(0xa37561b7b714a361), C64e(0x49face7d7d3449ce), + C64e(0x8da47b5252df8d7b), C64e(0x42a13edddd9f423e), + C64e(0x93bc715e5ecd9371), C64e(0xa226971313b1a297), + C64e(0x0457f5a6a6a204f5), C64e(0xb86968b9b901b868), + C64e(0x0000000000000000), C64e(0x74992cc1c1b5742c), + C64e(0xa080604040e0a060), C64e(0x21dd1fe3e3c2211f), + C64e(0x43f2c879793a43c8), C64e(0x2c77edb6b69a2ced), + C64e(0xd9b3bed4d40dd9be), C64e(0xca01468d8d47ca46), + C64e(0x70ced967671770d9), C64e(0xdde44b7272afdd4b), + C64e(0x7933de9494ed79de), C64e(0x672bd49898ff67d4), + C64e(0x237be8b0b09323e8), C64e(0xde114a85855bde4a), + C64e(0xbd6d6bbbbb06bd6b), C64e(0x7e912ac5c5bb7e2a), + C64e(0x349ee54f4f7b34e5), C64e(0x3ac116ededd73a16), + C64e(0x5417c58686d254c5), C64e(0x622fd79a9af862d7), + C64e(0xffcc55666699ff55), C64e(0xa722941111b6a794), + C64e(0x4a0fcf8a8ac04acf), C64e(0x30c910e9e9d93010), + C64e(0x0a080604040e0a06), C64e(0x98e781fefe669881), + C64e(0x0b5bf0a0a0ab0bf0), C64e(0xccf0447878b4cc44), + C64e(0xd54aba2525f0d5ba), C64e(0x3e96e34b4b753ee3), + C64e(0x0e5ff3a2a2ac0ef3), C64e(0x19bafe5d5d4419fe), + C64e(0x5b1bc08080db5bc0), C64e(0x850a8a050580858a), + C64e(0xec7ead3f3fd3ecad), C64e(0xdf42bc2121fedfbc), + C64e(0xd8e0487070a8d848), C64e(0x0cf904f1f1fd0c04), + C64e(0x7ac6df6363197adf), C64e(0x58eec177772f58c1), + C64e(0x9f4575afaf309f75), C64e(0xa584634242e7a563), + C64e(0x5040302020705030), C64e(0x2ed11ae5e5cb2e1a), + C64e(0x12e10efdfdef120e), C64e(0xb7656dbfbf08b76d), + C64e(0xd4194c818155d44c), C64e(0x3c30141818243c14), + C64e(0x5f4c352626795f35), C64e(0x719d2fc3c3b2712f), + C64e(0x3867e1bebe8638e1), C64e(0xfd6aa23535c8fda2), + C64e(0x4f0bcc8888c74fcc), C64e(0x4b5c392e2e654b39), + C64e(0xf93d5793936af957), C64e(0x0daaf25555580df2), + C64e(0x9de382fcfc619d82), C64e(0xc9f4477a7ab3c947), + C64e(0xef8bacc8c827efac), C64e(0x326fe7baba8832e7), + C64e(0x7d642b32324f7d2b), C64e(0xa4d795e6e642a495), + C64e(0xfb9ba0c0c03bfba0), C64e(0xb332981919aab398), + C64e(0x6827d19e9ef668d1), C64e(0x815d7fa3a322817f), + C64e(0xaa88664444eeaa66), C64e(0x82a87e5454d6827e), + C64e(0xe676ab3b3bdde6ab), C64e(0x9e16830b0b959e83), + C64e(0x4503ca8c8cc945ca), C64e(0x7b9529c7c7bc7b29), + C64e(0x6ed6d36b6b056ed3), C64e(0x44503c28286c443c), + C64e(0x8b5579a7a72c8b79), C64e(0x3d63e2bcbc813de2), + C64e(0x272c1d161631271d), C64e(0x9a4176adad379a76), + C64e(0x4dad3bdbdb964d3b), C64e(0xfac85664649efa56), + C64e(0xd2e84e7474a6d24e), C64e(0x22281e141436221e), + C64e(0x763fdb9292e476db), C64e(0x1e180a0c0c121e0a), + C64e(0xb4906c4848fcb46c), C64e(0x376be4b8b88f37e4), + C64e(0xe7255d9f9f78e75d), C64e(0xb2616ebdbd0fb26e), + C64e(0x2a86ef4343692aef), C64e(0xf193a6c4c435f1a6), + C64e(0xe372a83939dae3a8), C64e(0xf762a43131c6f7a4), + C64e(0x59bd37d3d38a5937), C64e(0x86ff8bf2f274868b), + C64e(0x56b132d5d5835632), C64e(0xc50d438b8b4ec543), + C64e(0xebdc596e6e85eb59), C64e(0xc2afb7dada18c2b7), + C64e(0x8f028c01018e8f8c), C64e(0xac7964b1b11dac64), + C64e(0x6d23d29c9cf16dd2), C64e(0x3b92e04949723be0), + C64e(0xc7abb4d8d81fc7b4), C64e(0x1543faacacb915fa), + C64e(0x09fd07f3f3fa0907), C64e(0x6f8525cfcfa06f25), + C64e(0xea8fafcaca20eaaf), C64e(0x89f38ef4f47d898e), + C64e(0x208ee947476720e9), C64e(0x2820181010382818), + C64e(0x64ded56f6f0b64d5), C64e(0x83fb88f0f0738388), + C64e(0xb1946f4a4afbb16f), C64e(0x96b8725c5cca9672), + C64e(0x6c70243838546c24), C64e(0x08aef157575f08f1), + C64e(0x52e6c773732152c7), C64e(0xf33551979764f351), + C64e(0x658d23cbcbae6523), C64e(0x84597ca1a125847c), + C64e(0xbfcb9ce8e857bf9c), C64e(0x637c213e3e5d6321), + C64e(0x7c37dd9696ea7cdd), C64e(0x7fc2dc61611e7fdc), + C64e(0x911a860d0d9c9186), C64e(0x941e850f0f9b9485), + C64e(0xabdb90e0e04bab90), C64e(0xc6f8427c7cbac642), + C64e(0x57e2c471712657c4), C64e(0xe583aacccc29e5aa), + C64e(0x733bd89090e373d8), C64e(0x0f0c050606090f05), + C64e(0x03f501f7f7f40301), C64e(0x3638121c1c2a3612), + C64e(0xfe9fa3c2c23cfea3), C64e(0xe1d45f6a6a8be15f), + C64e(0x1047f9aeaebe10f9), C64e(0x6bd2d06969026bd0), + C64e(0xa82e911717bfa891), C64e(0xe82958999971e858), + C64e(0x6974273a3a536927), C64e(0xd04eb92727f7d0b9), + C64e(0x48a938d9d9914838), C64e(0x35cd13ebebde3513), + C64e(0xce56b32b2be5ceb3), C64e(0x5544332222775533), + C64e(0xd6bfbbd2d204d6bb), C64e(0x904970a9a9399070), + C64e(0x800e890707878089), C64e(0xf266a73333c1f2a7), + C64e(0xc15ab62d2decc1b6), C64e(0x6678223c3c5a6622), + C64e(0xad2a921515b8ad92), C64e(0x608920c9c9a96020), + C64e(0xdb154987875cdb49), C64e(0x1a4fffaaaab01aff), + C64e(0x88a0785050d88878), C64e(0x8e517aa5a52b8e7a), + C64e(0x8a068f0303898a8f), C64e(0x13b2f859594a13f8), + C64e(0x9b12800909929b80), C64e(0x3934171a1a233917), + C64e(0x75cada65651075da), C64e(0x53b531d7d7845331), + C64e(0x5113c68484d551c6), C64e(0xd3bbb8d0d003d3b8), + C64e(0x5e1fc38282dc5ec3), C64e(0xcb52b02929e2cbb0), + C64e(0x99b4775a5ac39977), C64e(0x333c111e1e2d3311), + C64e(0x46f6cb7b7b3d46cb), C64e(0x1f4bfca8a8b71ffc), + C64e(0x61dad66d6d0c61d6), C64e(0x4e583a2c2c624e3a) +}; + +#if !SPH_SMALL_FOOTPRINT_GROESTL + +static const sph_u64 T5[] = { + C64e(0xa5f497a5c6c632f4), C64e(0x8497eb84f8f86f97), + C64e(0x99b0c799eeee5eb0), C64e(0x8d8cf78df6f67a8c), + C64e(0x0d17e50dffffe817), C64e(0xbddcb7bdd6d60adc), + C64e(0xb1c8a7b1dede16c8), C64e(0x54fc395491916dfc), + C64e(0x50f0c050606090f0), C64e(0x0305040302020705), + C64e(0xa9e087a9cece2ee0), C64e(0x7d87ac7d5656d187), + C64e(0x192bd519e7e7cc2b), C64e(0x62a67162b5b513a6), + C64e(0xe6319ae64d4d7c31), C64e(0x9ab5c39aecec59b5), + C64e(0x45cf05458f8f40cf), C64e(0x9dbc3e9d1f1fa3bc), + C64e(0x40c00940898949c0), C64e(0x8792ef87fafa6892), + C64e(0x153fc515efefd03f), C64e(0xeb267febb2b29426), + C64e(0xc94007c98e8ece40), C64e(0x0b1ded0bfbfbe61d), + C64e(0xec2f82ec41416e2f), C64e(0x67a97d67b3b31aa9), + C64e(0xfd1cbefd5f5f431c), C64e(0xea258aea45456025), + C64e(0xbfda46bf2323f9da), C64e(0xf702a6f753535102), + C64e(0x96a1d396e4e445a1), C64e(0x5bed2d5b9b9b76ed), + C64e(0xc25deac27575285d), C64e(0x1c24d91ce1e1c524), + C64e(0xaee97aae3d3dd4e9), C64e(0x6abe986a4c4cf2be), + C64e(0x5aeed85a6c6c82ee), C64e(0x41c3fc417e7ebdc3), + C64e(0x0206f102f5f5f306), C64e(0x4fd11d4f838352d1), + C64e(0x5ce4d05c68688ce4), C64e(0xf407a2f451515607), + C64e(0x345cb934d1d18d5c), C64e(0x0818e908f9f9e118), + C64e(0x93aedf93e2e24cae), C64e(0x73954d73abab3e95), + C64e(0x53f5c453626297f5), C64e(0x3f41543f2a2a6b41), + C64e(0x0c14100c08081c14), C64e(0x52f63152959563f6), + C64e(0x65af8c654646e9af), C64e(0x5ee2215e9d9d7fe2), + C64e(0x2878602830304878), C64e(0xa1f86ea13737cff8), + C64e(0x0f11140f0a0a1b11), C64e(0xb5c45eb52f2febc4), + C64e(0x091b1c090e0e151b), C64e(0x365a483624247e5a), + C64e(0x9bb6369b1b1badb6), C64e(0x3d47a53ddfdf9847), + C64e(0x266a8126cdcda76a), C64e(0x69bb9c694e4ef5bb), + C64e(0xcd4cfecd7f7f334c), C64e(0x9fbacf9feaea50ba), + C64e(0x1b2d241b12123f2d), C64e(0x9eb93a9e1d1da4b9), + C64e(0x749cb0745858c49c), C64e(0x2e72682e34344672), + C64e(0x2d776c2d36364177), C64e(0xb2cda3b2dcdc11cd), + C64e(0xee2973eeb4b49d29), C64e(0xfb16b6fb5b5b4d16), + C64e(0xf60153f6a4a4a501), C64e(0x4dd7ec4d7676a1d7), + C64e(0x61a37561b7b714a3), C64e(0xce49face7d7d3449), + C64e(0x7b8da47b5252df8d), C64e(0x3e42a13edddd9f42), + C64e(0x7193bc715e5ecd93), C64e(0x97a226971313b1a2), + C64e(0xf50457f5a6a6a204), C64e(0x68b86968b9b901b8), + C64e(0x0000000000000000), C64e(0x2c74992cc1c1b574), + C64e(0x60a080604040e0a0), C64e(0x1f21dd1fe3e3c221), + C64e(0xc843f2c879793a43), C64e(0xed2c77edb6b69a2c), + C64e(0xbed9b3bed4d40dd9), C64e(0x46ca01468d8d47ca), + C64e(0xd970ced967671770), C64e(0x4bdde44b7272afdd), + C64e(0xde7933de9494ed79), C64e(0xd4672bd49898ff67), + C64e(0xe8237be8b0b09323), C64e(0x4ade114a85855bde), + C64e(0x6bbd6d6bbbbb06bd), C64e(0x2a7e912ac5c5bb7e), + C64e(0xe5349ee54f4f7b34), C64e(0x163ac116ededd73a), + C64e(0xc55417c58686d254), C64e(0xd7622fd79a9af862), + C64e(0x55ffcc55666699ff), C64e(0x94a722941111b6a7), + C64e(0xcf4a0fcf8a8ac04a), C64e(0x1030c910e9e9d930), + C64e(0x060a080604040e0a), C64e(0x8198e781fefe6698), + C64e(0xf00b5bf0a0a0ab0b), C64e(0x44ccf0447878b4cc), + C64e(0xbad54aba2525f0d5), C64e(0xe33e96e34b4b753e), + C64e(0xf30e5ff3a2a2ac0e), C64e(0xfe19bafe5d5d4419), + C64e(0xc05b1bc08080db5b), C64e(0x8a850a8a05058085), + C64e(0xadec7ead3f3fd3ec), C64e(0xbcdf42bc2121fedf), + C64e(0x48d8e0487070a8d8), C64e(0x040cf904f1f1fd0c), + C64e(0xdf7ac6df6363197a), C64e(0xc158eec177772f58), + C64e(0x759f4575afaf309f), C64e(0x63a584634242e7a5), + C64e(0x3050403020207050), C64e(0x1a2ed11ae5e5cb2e), + C64e(0x0e12e10efdfdef12), C64e(0x6db7656dbfbf08b7), + C64e(0x4cd4194c818155d4), C64e(0x143c30141818243c), + C64e(0x355f4c352626795f), C64e(0x2f719d2fc3c3b271), + C64e(0xe13867e1bebe8638), C64e(0xa2fd6aa23535c8fd), + C64e(0xcc4f0bcc8888c74f), C64e(0x394b5c392e2e654b), + C64e(0x57f93d5793936af9), C64e(0xf20daaf25555580d), + C64e(0x829de382fcfc619d), C64e(0x47c9f4477a7ab3c9), + C64e(0xacef8bacc8c827ef), C64e(0xe7326fe7baba8832), + C64e(0x2b7d642b32324f7d), C64e(0x95a4d795e6e642a4), + C64e(0xa0fb9ba0c0c03bfb), C64e(0x98b332981919aab3), + C64e(0xd16827d19e9ef668), C64e(0x7f815d7fa3a32281), + C64e(0x66aa88664444eeaa), C64e(0x7e82a87e5454d682), + C64e(0xabe676ab3b3bdde6), C64e(0x839e16830b0b959e), + C64e(0xca4503ca8c8cc945), C64e(0x297b9529c7c7bc7b), + C64e(0xd36ed6d36b6b056e), C64e(0x3c44503c28286c44), + C64e(0x798b5579a7a72c8b), C64e(0xe23d63e2bcbc813d), + C64e(0x1d272c1d16163127), C64e(0x769a4176adad379a), + C64e(0x3b4dad3bdbdb964d), C64e(0x56fac85664649efa), + C64e(0x4ed2e84e7474a6d2), C64e(0x1e22281e14143622), + C64e(0xdb763fdb9292e476), C64e(0x0a1e180a0c0c121e), + C64e(0x6cb4906c4848fcb4), C64e(0xe4376be4b8b88f37), + C64e(0x5de7255d9f9f78e7), C64e(0x6eb2616ebdbd0fb2), + C64e(0xef2a86ef4343692a), C64e(0xa6f193a6c4c435f1), + C64e(0xa8e372a83939dae3), C64e(0xa4f762a43131c6f7), + C64e(0x3759bd37d3d38a59), C64e(0x8b86ff8bf2f27486), + C64e(0x3256b132d5d58356), C64e(0x43c50d438b8b4ec5), + C64e(0x59ebdc596e6e85eb), C64e(0xb7c2afb7dada18c2), + C64e(0x8c8f028c01018e8f), C64e(0x64ac7964b1b11dac), + C64e(0xd26d23d29c9cf16d), C64e(0xe03b92e04949723b), + C64e(0xb4c7abb4d8d81fc7), C64e(0xfa1543faacacb915), + C64e(0x0709fd07f3f3fa09), C64e(0x256f8525cfcfa06f), + C64e(0xafea8fafcaca20ea), C64e(0x8e89f38ef4f47d89), + C64e(0xe9208ee947476720), C64e(0x1828201810103828), + C64e(0xd564ded56f6f0b64), C64e(0x8883fb88f0f07383), + C64e(0x6fb1946f4a4afbb1), C64e(0x7296b8725c5cca96), + C64e(0x246c70243838546c), C64e(0xf108aef157575f08), + C64e(0xc752e6c773732152), C64e(0x51f33551979764f3), + C64e(0x23658d23cbcbae65), C64e(0x7c84597ca1a12584), + C64e(0x9cbfcb9ce8e857bf), C64e(0x21637c213e3e5d63), + C64e(0xdd7c37dd9696ea7c), C64e(0xdc7fc2dc61611e7f), + C64e(0x86911a860d0d9c91), C64e(0x85941e850f0f9b94), + C64e(0x90abdb90e0e04bab), C64e(0x42c6f8427c7cbac6), + C64e(0xc457e2c471712657), C64e(0xaae583aacccc29e5), + C64e(0xd8733bd89090e373), C64e(0x050f0c050606090f), + C64e(0x0103f501f7f7f403), C64e(0x123638121c1c2a36), + C64e(0xa3fe9fa3c2c23cfe), C64e(0x5fe1d45f6a6a8be1), + C64e(0xf91047f9aeaebe10), C64e(0xd06bd2d06969026b), + C64e(0x91a82e911717bfa8), C64e(0x58e82958999971e8), + C64e(0x276974273a3a5369), C64e(0xb9d04eb92727f7d0), + C64e(0x3848a938d9d99148), C64e(0x1335cd13ebebde35), + C64e(0xb3ce56b32b2be5ce), C64e(0x3355443322227755), + C64e(0xbbd6bfbbd2d204d6), C64e(0x70904970a9a93990), + C64e(0x89800e8907078780), C64e(0xa7f266a73333c1f2), + C64e(0xb6c15ab62d2decc1), C64e(0x226678223c3c5a66), + C64e(0x92ad2a921515b8ad), C64e(0x20608920c9c9a960), + C64e(0x49db154987875cdb), C64e(0xff1a4fffaaaab01a), + C64e(0x7888a0785050d888), C64e(0x7a8e517aa5a52b8e), + C64e(0x8f8a068f0303898a), C64e(0xf813b2f859594a13), + C64e(0x809b12800909929b), C64e(0x173934171a1a2339), + C64e(0xda75cada65651075), C64e(0x3153b531d7d78453), + C64e(0xc65113c68484d551), C64e(0xb8d3bbb8d0d003d3), + C64e(0xc35e1fc38282dc5e), C64e(0xb0cb52b02929e2cb), + C64e(0x7799b4775a5ac399), C64e(0x11333c111e1e2d33), + C64e(0xcb46f6cb7b7b3d46), C64e(0xfc1f4bfca8a8b71f), + C64e(0xd661dad66d6d0c61), C64e(0x3a4e583a2c2c624e) +}; + +static const sph_u64 T6[] = { + C64e(0xf4a5f497a5c6c632), C64e(0x978497eb84f8f86f), + C64e(0xb099b0c799eeee5e), C64e(0x8c8d8cf78df6f67a), + C64e(0x170d17e50dffffe8), C64e(0xdcbddcb7bdd6d60a), + C64e(0xc8b1c8a7b1dede16), C64e(0xfc54fc395491916d), + C64e(0xf050f0c050606090), C64e(0x0503050403020207), + C64e(0xe0a9e087a9cece2e), C64e(0x877d87ac7d5656d1), + C64e(0x2b192bd519e7e7cc), C64e(0xa662a67162b5b513), + C64e(0x31e6319ae64d4d7c), C64e(0xb59ab5c39aecec59), + C64e(0xcf45cf05458f8f40), C64e(0xbc9dbc3e9d1f1fa3), + C64e(0xc040c00940898949), C64e(0x928792ef87fafa68), + C64e(0x3f153fc515efefd0), C64e(0x26eb267febb2b294), + C64e(0x40c94007c98e8ece), C64e(0x1d0b1ded0bfbfbe6), + C64e(0x2fec2f82ec41416e), C64e(0xa967a97d67b3b31a), + C64e(0x1cfd1cbefd5f5f43), C64e(0x25ea258aea454560), + C64e(0xdabfda46bf2323f9), C64e(0x02f702a6f7535351), + C64e(0xa196a1d396e4e445), C64e(0xed5bed2d5b9b9b76), + C64e(0x5dc25deac2757528), C64e(0x241c24d91ce1e1c5), + C64e(0xe9aee97aae3d3dd4), C64e(0xbe6abe986a4c4cf2), + C64e(0xee5aeed85a6c6c82), C64e(0xc341c3fc417e7ebd), + C64e(0x060206f102f5f5f3), C64e(0xd14fd11d4f838352), + C64e(0xe45ce4d05c68688c), C64e(0x07f407a2f4515156), + C64e(0x5c345cb934d1d18d), C64e(0x180818e908f9f9e1), + C64e(0xae93aedf93e2e24c), C64e(0x9573954d73abab3e), + C64e(0xf553f5c453626297), C64e(0x413f41543f2a2a6b), + C64e(0x140c14100c08081c), C64e(0xf652f63152959563), + C64e(0xaf65af8c654646e9), C64e(0xe25ee2215e9d9d7f), + C64e(0x7828786028303048), C64e(0xf8a1f86ea13737cf), + C64e(0x110f11140f0a0a1b), C64e(0xc4b5c45eb52f2feb), + C64e(0x1b091b1c090e0e15), C64e(0x5a365a483624247e), + C64e(0xb69bb6369b1b1bad), C64e(0x473d47a53ddfdf98), + C64e(0x6a266a8126cdcda7), C64e(0xbb69bb9c694e4ef5), + C64e(0x4ccd4cfecd7f7f33), C64e(0xba9fbacf9feaea50), + C64e(0x2d1b2d241b12123f), C64e(0xb99eb93a9e1d1da4), + C64e(0x9c749cb0745858c4), C64e(0x722e72682e343446), + C64e(0x772d776c2d363641), C64e(0xcdb2cda3b2dcdc11), + C64e(0x29ee2973eeb4b49d), C64e(0x16fb16b6fb5b5b4d), + C64e(0x01f60153f6a4a4a5), C64e(0xd74dd7ec4d7676a1), + C64e(0xa361a37561b7b714), C64e(0x49ce49face7d7d34), + C64e(0x8d7b8da47b5252df), C64e(0x423e42a13edddd9f), + C64e(0x937193bc715e5ecd), C64e(0xa297a226971313b1), + C64e(0x04f50457f5a6a6a2), C64e(0xb868b86968b9b901), + C64e(0x0000000000000000), C64e(0x742c74992cc1c1b5), + C64e(0xa060a080604040e0), C64e(0x211f21dd1fe3e3c2), + C64e(0x43c843f2c879793a), C64e(0x2ced2c77edb6b69a), + C64e(0xd9bed9b3bed4d40d), C64e(0xca46ca01468d8d47), + C64e(0x70d970ced9676717), C64e(0xdd4bdde44b7272af), + C64e(0x79de7933de9494ed), C64e(0x67d4672bd49898ff), + C64e(0x23e8237be8b0b093), C64e(0xde4ade114a85855b), + C64e(0xbd6bbd6d6bbbbb06), C64e(0x7e2a7e912ac5c5bb), + C64e(0x34e5349ee54f4f7b), C64e(0x3a163ac116ededd7), + C64e(0x54c55417c58686d2), C64e(0x62d7622fd79a9af8), + C64e(0xff55ffcc55666699), C64e(0xa794a722941111b6), + C64e(0x4acf4a0fcf8a8ac0), C64e(0x301030c910e9e9d9), + C64e(0x0a060a080604040e), C64e(0x988198e781fefe66), + C64e(0x0bf00b5bf0a0a0ab), C64e(0xcc44ccf0447878b4), + C64e(0xd5bad54aba2525f0), C64e(0x3ee33e96e34b4b75), + C64e(0x0ef30e5ff3a2a2ac), C64e(0x19fe19bafe5d5d44), + C64e(0x5bc05b1bc08080db), C64e(0x858a850a8a050580), + C64e(0xecadec7ead3f3fd3), C64e(0xdfbcdf42bc2121fe), + C64e(0xd848d8e0487070a8), C64e(0x0c040cf904f1f1fd), + C64e(0x7adf7ac6df636319), C64e(0x58c158eec177772f), + C64e(0x9f759f4575afaf30), C64e(0xa563a584634242e7), + C64e(0x5030504030202070), C64e(0x2e1a2ed11ae5e5cb), + C64e(0x120e12e10efdfdef), C64e(0xb76db7656dbfbf08), + C64e(0xd44cd4194c818155), C64e(0x3c143c3014181824), + C64e(0x5f355f4c35262679), C64e(0x712f719d2fc3c3b2), + C64e(0x38e13867e1bebe86), C64e(0xfda2fd6aa23535c8), + C64e(0x4fcc4f0bcc8888c7), C64e(0x4b394b5c392e2e65), + C64e(0xf957f93d5793936a), C64e(0x0df20daaf2555558), + C64e(0x9d829de382fcfc61), C64e(0xc947c9f4477a7ab3), + C64e(0xefacef8bacc8c827), C64e(0x32e7326fe7baba88), + C64e(0x7d2b7d642b32324f), C64e(0xa495a4d795e6e642), + C64e(0xfba0fb9ba0c0c03b), C64e(0xb398b332981919aa), + C64e(0x68d16827d19e9ef6), C64e(0x817f815d7fa3a322), + C64e(0xaa66aa88664444ee), C64e(0x827e82a87e5454d6), + C64e(0xe6abe676ab3b3bdd), C64e(0x9e839e16830b0b95), + C64e(0x45ca4503ca8c8cc9), C64e(0x7b297b9529c7c7bc), + C64e(0x6ed36ed6d36b6b05), C64e(0x443c44503c28286c), + C64e(0x8b798b5579a7a72c), C64e(0x3de23d63e2bcbc81), + C64e(0x271d272c1d161631), C64e(0x9a769a4176adad37), + C64e(0x4d3b4dad3bdbdb96), C64e(0xfa56fac85664649e), + C64e(0xd24ed2e84e7474a6), C64e(0x221e22281e141436), + C64e(0x76db763fdb9292e4), C64e(0x1e0a1e180a0c0c12), + C64e(0xb46cb4906c4848fc), C64e(0x37e4376be4b8b88f), + C64e(0xe75de7255d9f9f78), C64e(0xb26eb2616ebdbd0f), + C64e(0x2aef2a86ef434369), C64e(0xf1a6f193a6c4c435), + C64e(0xe3a8e372a83939da), C64e(0xf7a4f762a43131c6), + C64e(0x593759bd37d3d38a), C64e(0x868b86ff8bf2f274), + C64e(0x563256b132d5d583), C64e(0xc543c50d438b8b4e), + C64e(0xeb59ebdc596e6e85), C64e(0xc2b7c2afb7dada18), + C64e(0x8f8c8f028c01018e), C64e(0xac64ac7964b1b11d), + C64e(0x6dd26d23d29c9cf1), C64e(0x3be03b92e0494972), + C64e(0xc7b4c7abb4d8d81f), C64e(0x15fa1543faacacb9), + C64e(0x090709fd07f3f3fa), C64e(0x6f256f8525cfcfa0), + C64e(0xeaafea8fafcaca20), C64e(0x898e89f38ef4f47d), + C64e(0x20e9208ee9474767), C64e(0x2818282018101038), + C64e(0x64d564ded56f6f0b), C64e(0x838883fb88f0f073), + C64e(0xb16fb1946f4a4afb), C64e(0x967296b8725c5cca), + C64e(0x6c246c7024383854), C64e(0x08f108aef157575f), + C64e(0x52c752e6c7737321), C64e(0xf351f33551979764), + C64e(0x6523658d23cbcbae), C64e(0x847c84597ca1a125), + C64e(0xbf9cbfcb9ce8e857), C64e(0x6321637c213e3e5d), + C64e(0x7cdd7c37dd9696ea), C64e(0x7fdc7fc2dc61611e), + C64e(0x9186911a860d0d9c), C64e(0x9485941e850f0f9b), + C64e(0xab90abdb90e0e04b), C64e(0xc642c6f8427c7cba), + C64e(0x57c457e2c4717126), C64e(0xe5aae583aacccc29), + C64e(0x73d8733bd89090e3), C64e(0x0f050f0c05060609), + C64e(0x030103f501f7f7f4), C64e(0x36123638121c1c2a), + C64e(0xfea3fe9fa3c2c23c), C64e(0xe15fe1d45f6a6a8b), + C64e(0x10f91047f9aeaebe), C64e(0x6bd06bd2d0696902), + C64e(0xa891a82e911717bf), C64e(0xe858e82958999971), + C64e(0x69276974273a3a53), C64e(0xd0b9d04eb92727f7), + C64e(0x483848a938d9d991), C64e(0x351335cd13ebebde), + C64e(0xceb3ce56b32b2be5), C64e(0x5533554433222277), + C64e(0xd6bbd6bfbbd2d204), C64e(0x9070904970a9a939), + C64e(0x8089800e89070787), C64e(0xf2a7f266a73333c1), + C64e(0xc1b6c15ab62d2dec), C64e(0x66226678223c3c5a), + C64e(0xad92ad2a921515b8), C64e(0x6020608920c9c9a9), + C64e(0xdb49db154987875c), C64e(0x1aff1a4fffaaaab0), + C64e(0x887888a0785050d8), C64e(0x8e7a8e517aa5a52b), + C64e(0x8a8f8a068f030389), C64e(0x13f813b2f859594a), + C64e(0x9b809b1280090992), C64e(0x39173934171a1a23), + C64e(0x75da75cada656510), C64e(0x533153b531d7d784), + C64e(0x51c65113c68484d5), C64e(0xd3b8d3bbb8d0d003), + C64e(0x5ec35e1fc38282dc), C64e(0xcbb0cb52b02929e2), + C64e(0x997799b4775a5ac3), C64e(0x3311333c111e1e2d), + C64e(0x46cb46f6cb7b7b3d), C64e(0x1ffc1f4bfca8a8b7), + C64e(0x61d661dad66d6d0c), C64e(0x4e3a4e583a2c2c62) +}; + +static const sph_u64 T7[] = { + C64e(0x32f4a5f497a5c6c6), C64e(0x6f978497eb84f8f8), + C64e(0x5eb099b0c799eeee), C64e(0x7a8c8d8cf78df6f6), + C64e(0xe8170d17e50dffff), C64e(0x0adcbddcb7bdd6d6), + C64e(0x16c8b1c8a7b1dede), C64e(0x6dfc54fc39549191), + C64e(0x90f050f0c0506060), C64e(0x0705030504030202), + C64e(0x2ee0a9e087a9cece), C64e(0xd1877d87ac7d5656), + C64e(0xcc2b192bd519e7e7), C64e(0x13a662a67162b5b5), + C64e(0x7c31e6319ae64d4d), C64e(0x59b59ab5c39aecec), + C64e(0x40cf45cf05458f8f), C64e(0xa3bc9dbc3e9d1f1f), + C64e(0x49c040c009408989), C64e(0x68928792ef87fafa), + C64e(0xd03f153fc515efef), C64e(0x9426eb267febb2b2), + C64e(0xce40c94007c98e8e), C64e(0xe61d0b1ded0bfbfb), + C64e(0x6e2fec2f82ec4141), C64e(0x1aa967a97d67b3b3), + C64e(0x431cfd1cbefd5f5f), C64e(0x6025ea258aea4545), + C64e(0xf9dabfda46bf2323), C64e(0x5102f702a6f75353), + C64e(0x45a196a1d396e4e4), C64e(0x76ed5bed2d5b9b9b), + C64e(0x285dc25deac27575), C64e(0xc5241c24d91ce1e1), + C64e(0xd4e9aee97aae3d3d), C64e(0xf2be6abe986a4c4c), + C64e(0x82ee5aeed85a6c6c), C64e(0xbdc341c3fc417e7e), + C64e(0xf3060206f102f5f5), C64e(0x52d14fd11d4f8383), + C64e(0x8ce45ce4d05c6868), C64e(0x5607f407a2f45151), + C64e(0x8d5c345cb934d1d1), C64e(0xe1180818e908f9f9), + C64e(0x4cae93aedf93e2e2), C64e(0x3e9573954d73abab), + C64e(0x97f553f5c4536262), C64e(0x6b413f41543f2a2a), + C64e(0x1c140c14100c0808), C64e(0x63f652f631529595), + C64e(0xe9af65af8c654646), C64e(0x7fe25ee2215e9d9d), + C64e(0x4878287860283030), C64e(0xcff8a1f86ea13737), + C64e(0x1b110f11140f0a0a), C64e(0xebc4b5c45eb52f2f), + C64e(0x151b091b1c090e0e), C64e(0x7e5a365a48362424), + C64e(0xadb69bb6369b1b1b), C64e(0x98473d47a53ddfdf), + C64e(0xa76a266a8126cdcd), C64e(0xf5bb69bb9c694e4e), + C64e(0x334ccd4cfecd7f7f), C64e(0x50ba9fbacf9feaea), + C64e(0x3f2d1b2d241b1212), C64e(0xa4b99eb93a9e1d1d), + C64e(0xc49c749cb0745858), C64e(0x46722e72682e3434), + C64e(0x41772d776c2d3636), C64e(0x11cdb2cda3b2dcdc), + C64e(0x9d29ee2973eeb4b4), C64e(0x4d16fb16b6fb5b5b), + C64e(0xa501f60153f6a4a4), C64e(0xa1d74dd7ec4d7676), + C64e(0x14a361a37561b7b7), C64e(0x3449ce49face7d7d), + C64e(0xdf8d7b8da47b5252), C64e(0x9f423e42a13edddd), + C64e(0xcd937193bc715e5e), C64e(0xb1a297a226971313), + C64e(0xa204f50457f5a6a6), C64e(0x01b868b86968b9b9), + C64e(0x0000000000000000), C64e(0xb5742c74992cc1c1), + C64e(0xe0a060a080604040), C64e(0xc2211f21dd1fe3e3), + C64e(0x3a43c843f2c87979), C64e(0x9a2ced2c77edb6b6), + C64e(0x0dd9bed9b3bed4d4), C64e(0x47ca46ca01468d8d), + C64e(0x1770d970ced96767), C64e(0xafdd4bdde44b7272), + C64e(0xed79de7933de9494), C64e(0xff67d4672bd49898), + C64e(0x9323e8237be8b0b0), C64e(0x5bde4ade114a8585), + C64e(0x06bd6bbd6d6bbbbb), C64e(0xbb7e2a7e912ac5c5), + C64e(0x7b34e5349ee54f4f), C64e(0xd73a163ac116eded), + C64e(0xd254c55417c58686), C64e(0xf862d7622fd79a9a), + C64e(0x99ff55ffcc556666), C64e(0xb6a794a722941111), + C64e(0xc04acf4a0fcf8a8a), C64e(0xd9301030c910e9e9), + C64e(0x0e0a060a08060404), C64e(0x66988198e781fefe), + C64e(0xab0bf00b5bf0a0a0), C64e(0xb4cc44ccf0447878), + C64e(0xf0d5bad54aba2525), C64e(0x753ee33e96e34b4b), + C64e(0xac0ef30e5ff3a2a2), C64e(0x4419fe19bafe5d5d), + C64e(0xdb5bc05b1bc08080), C64e(0x80858a850a8a0505), + C64e(0xd3ecadec7ead3f3f), C64e(0xfedfbcdf42bc2121), + C64e(0xa8d848d8e0487070), C64e(0xfd0c040cf904f1f1), + C64e(0x197adf7ac6df6363), C64e(0x2f58c158eec17777), + C64e(0x309f759f4575afaf), C64e(0xe7a563a584634242), + C64e(0x7050305040302020), C64e(0xcb2e1a2ed11ae5e5), + C64e(0xef120e12e10efdfd), C64e(0x08b76db7656dbfbf), + C64e(0x55d44cd4194c8181), C64e(0x243c143c30141818), + C64e(0x795f355f4c352626), C64e(0xb2712f719d2fc3c3), + C64e(0x8638e13867e1bebe), C64e(0xc8fda2fd6aa23535), + C64e(0xc74fcc4f0bcc8888), C64e(0x654b394b5c392e2e), + C64e(0x6af957f93d579393), C64e(0x580df20daaf25555), + C64e(0x619d829de382fcfc), C64e(0xb3c947c9f4477a7a), + C64e(0x27efacef8bacc8c8), C64e(0x8832e7326fe7baba), + C64e(0x4f7d2b7d642b3232), C64e(0x42a495a4d795e6e6), + C64e(0x3bfba0fb9ba0c0c0), C64e(0xaab398b332981919), + C64e(0xf668d16827d19e9e), C64e(0x22817f815d7fa3a3), + C64e(0xeeaa66aa88664444), C64e(0xd6827e82a87e5454), + C64e(0xdde6abe676ab3b3b), C64e(0x959e839e16830b0b), + C64e(0xc945ca4503ca8c8c), C64e(0xbc7b297b9529c7c7), + C64e(0x056ed36ed6d36b6b), C64e(0x6c443c44503c2828), + C64e(0x2c8b798b5579a7a7), C64e(0x813de23d63e2bcbc), + C64e(0x31271d272c1d1616), C64e(0x379a769a4176adad), + C64e(0x964d3b4dad3bdbdb), C64e(0x9efa56fac8566464), + C64e(0xa6d24ed2e84e7474), C64e(0x36221e22281e1414), + C64e(0xe476db763fdb9292), C64e(0x121e0a1e180a0c0c), + C64e(0xfcb46cb4906c4848), C64e(0x8f37e4376be4b8b8), + C64e(0x78e75de7255d9f9f), C64e(0x0fb26eb2616ebdbd), + C64e(0x692aef2a86ef4343), C64e(0x35f1a6f193a6c4c4), + C64e(0xdae3a8e372a83939), C64e(0xc6f7a4f762a43131), + C64e(0x8a593759bd37d3d3), C64e(0x74868b86ff8bf2f2), + C64e(0x83563256b132d5d5), C64e(0x4ec543c50d438b8b), + C64e(0x85eb59ebdc596e6e), C64e(0x18c2b7c2afb7dada), + C64e(0x8e8f8c8f028c0101), C64e(0x1dac64ac7964b1b1), + C64e(0xf16dd26d23d29c9c), C64e(0x723be03b92e04949), + C64e(0x1fc7b4c7abb4d8d8), C64e(0xb915fa1543faacac), + C64e(0xfa090709fd07f3f3), C64e(0xa06f256f8525cfcf), + C64e(0x20eaafea8fafcaca), C64e(0x7d898e89f38ef4f4), + C64e(0x6720e9208ee94747), C64e(0x3828182820181010), + C64e(0x0b64d564ded56f6f), C64e(0x73838883fb88f0f0), + C64e(0xfbb16fb1946f4a4a), C64e(0xca967296b8725c5c), + C64e(0x546c246c70243838), C64e(0x5f08f108aef15757), + C64e(0x2152c752e6c77373), C64e(0x64f351f335519797), + C64e(0xae6523658d23cbcb), C64e(0x25847c84597ca1a1), + C64e(0x57bf9cbfcb9ce8e8), C64e(0x5d6321637c213e3e), + C64e(0xea7cdd7c37dd9696), C64e(0x1e7fdc7fc2dc6161), + C64e(0x9c9186911a860d0d), C64e(0x9b9485941e850f0f), + C64e(0x4bab90abdb90e0e0), C64e(0xbac642c6f8427c7c), + C64e(0x2657c457e2c47171), C64e(0x29e5aae583aacccc), + C64e(0xe373d8733bd89090), C64e(0x090f050f0c050606), + C64e(0xf4030103f501f7f7), C64e(0x2a36123638121c1c), + C64e(0x3cfea3fe9fa3c2c2), C64e(0x8be15fe1d45f6a6a), + C64e(0xbe10f91047f9aeae), C64e(0x026bd06bd2d06969), + C64e(0xbfa891a82e911717), C64e(0x71e858e829589999), + C64e(0x5369276974273a3a), C64e(0xf7d0b9d04eb92727), + C64e(0x91483848a938d9d9), C64e(0xde351335cd13ebeb), + C64e(0xe5ceb3ce56b32b2b), C64e(0x7755335544332222), + C64e(0x04d6bbd6bfbbd2d2), C64e(0x399070904970a9a9), + C64e(0x878089800e890707), C64e(0xc1f2a7f266a73333), + C64e(0xecc1b6c15ab62d2d), C64e(0x5a66226678223c3c), + C64e(0xb8ad92ad2a921515), C64e(0xa96020608920c9c9), + C64e(0x5cdb49db15498787), C64e(0xb01aff1a4fffaaaa), + C64e(0xd8887888a0785050), C64e(0x2b8e7a8e517aa5a5), + C64e(0x898a8f8a068f0303), C64e(0x4a13f813b2f85959), + C64e(0x929b809b12800909), C64e(0x2339173934171a1a), + C64e(0x1075da75cada6565), C64e(0x84533153b531d7d7), + C64e(0xd551c65113c68484), C64e(0x03d3b8d3bbb8d0d0), + C64e(0xdc5ec35e1fc38282), C64e(0xe2cbb0cb52b02929), + C64e(0xc3997799b4775a5a), C64e(0x2d3311333c111e1e), + C64e(0x3d46cb46f6cb7b7b), C64e(0xb71ffc1f4bfca8a8), + C64e(0x0c61d661dad66d6d), C64e(0x624e3a4e583a2c2c) +}; + +#endif + +#define DECL_STATE_SMALL \ + sph_u64 H[8]; + +#define READ_STATE_SMALL(sc) do { \ + memcpy(H, (sc)->state.wide, sizeof H); \ + } while (0) + +#define WRITE_STATE_SMALL(sc) do { \ + memcpy((sc)->state.wide, H, sizeof H); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define RSTT(d, a, b0, b1, b2, b3, b4, b5, b6, b7) do { \ + t[d] = T0[B64_0(a[b0])] \ + ^ R64(T0[B64_1(a[b1])], 8) \ + ^ R64(T0[B64_2(a[b2])], 16) \ + ^ R64(T0[B64_3(a[b3])], 24) \ + ^ T4[B64_4(a[b4])] \ + ^ R64(T4[B64_5(a[b5])], 8) \ + ^ R64(T4[B64_6(a[b6])], 16) \ + ^ R64(T4[B64_7(a[b7])], 24); \ + } while (0) + +#else + +#define RSTT(d, a, b0, b1, b2, b3, b4, b5, b6, b7) do { \ + t[d] = T0[B64_0(a[b0])] \ + ^ T1[B64_1(a[b1])] \ + ^ T2[B64_2(a[b2])] \ + ^ T3[B64_3(a[b3])] \ + ^ T4[B64_4(a[b4])] \ + ^ T5[B64_5(a[b5])] \ + ^ T6[B64_6(a[b6])] \ + ^ T7[B64_7(a[b7])]; \ + } while (0) + +#endif + +#define ROUND_SMALL_P(a, r) do { \ + sph_u64 t[8]; \ + a[0] ^= PC64(0x00, r); \ + a[1] ^= PC64(0x10, r); \ + a[2] ^= PC64(0x20, r); \ + a[3] ^= PC64(0x30, r); \ + a[4] ^= PC64(0x40, r); \ + a[5] ^= PC64(0x50, r); \ + a[6] ^= PC64(0x60, r); \ + a[7] ^= PC64(0x70, r); \ + RSTT(0, a, 0, 1, 2, 3, 4, 5, 6, 7); \ + RSTT(1, a, 1, 2, 3, 4, 5, 6, 7, 0); \ + RSTT(2, a, 2, 3, 4, 5, 6, 7, 0, 1); \ + RSTT(3, a, 3, 4, 5, 6, 7, 0, 1, 2); \ + RSTT(4, a, 4, 5, 6, 7, 0, 1, 2, 3); \ + RSTT(5, a, 5, 6, 7, 0, 1, 2, 3, 4); \ + RSTT(6, a, 6, 7, 0, 1, 2, 3, 4, 5); \ + RSTT(7, a, 7, 0, 1, 2, 3, 4, 5, 6); \ + a[0] = t[0]; \ + a[1] = t[1]; \ + a[2] = t[2]; \ + a[3] = t[3]; \ + a[4] = t[4]; \ + a[5] = t[5]; \ + a[6] = t[6]; \ + a[7] = t[7]; \ + } while (0) + +#define ROUND_SMALL_Q(a, r) do { \ + sph_u64 t[8]; \ + a[0] ^= QC64(0x00, r); \ + a[1] ^= QC64(0x10, r); \ + a[2] ^= QC64(0x20, r); \ + a[3] ^= QC64(0x30, r); \ + a[4] ^= QC64(0x40, r); \ + a[5] ^= QC64(0x50, r); \ + a[6] ^= QC64(0x60, r); \ + a[7] ^= QC64(0x70, r); \ + RSTT(0, a, 1, 3, 5, 7, 0, 2, 4, 6); \ + RSTT(1, a, 2, 4, 6, 0, 1, 3, 5, 7); \ + RSTT(2, a, 3, 5, 7, 1, 2, 4, 6, 0); \ + RSTT(3, a, 4, 6, 0, 2, 3, 5, 7, 1); \ + RSTT(4, a, 5, 7, 1, 3, 4, 6, 0, 2); \ + RSTT(5, a, 6, 0, 2, 4, 5, 7, 1, 3); \ + RSTT(6, a, 7, 1, 3, 5, 6, 0, 2, 4); \ + RSTT(7, a, 0, 2, 4, 6, 7, 1, 3, 5); \ + a[0] = t[0]; \ + a[1] = t[1]; \ + a[2] = t[2]; \ + a[3] = t[3]; \ + a[4] = t[4]; \ + a[5] = t[5]; \ + a[6] = t[6]; \ + a[7] = t[7]; \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define PERM_SMALL_P(a) do { \ + int r; \ + for (r = 0; r < 10; r ++) \ + ROUND_SMALL_P(a, r); \ + } while (0) + +#define PERM_SMALL_Q(a) do { \ + int r; \ + for (r = 0; r < 10; r ++) \ + ROUND_SMALL_Q(a, r); \ + } while (0) + +#else + +/* + * Apparently, unrolling more than that confuses GCC, resulting in + * lower performance, even though L1 cache would be no problem. + */ +#define PERM_SMALL_P(a) do { \ + int r; \ + for (r = 0; r < 10; r += 2) { \ + ROUND_SMALL_P(a, r + 0); \ + ROUND_SMALL_P(a, r + 1); \ + } \ + } while (0) + +#define PERM_SMALL_Q(a) do { \ + int r; \ + for (r = 0; r < 10; r += 2) { \ + ROUND_SMALL_Q(a, r + 0); \ + ROUND_SMALL_Q(a, r + 1); \ + } \ + } while (0) + +#endif + +#define COMPRESS_SMALL do { \ + sph_u64 g[8], m[8]; \ + size_t u; \ + for (u = 0; u < 8; u ++) { \ + m[u] = dec64e_aligned(buf + (u << 3)); \ + g[u] = m[u] ^ H[u]; \ + } \ + PERM_SMALL_P(g); \ + PERM_SMALL_Q(m); \ + for (u = 0; u < 8; u ++) \ + H[u] ^= g[u] ^ m[u]; \ + } while (0) + +#define FINAL_SMALL do { \ + sph_u64 x[8]; \ + size_t u; \ + memcpy(x, H, sizeof x); \ + PERM_SMALL_P(x); \ + for (u = 0; u < 8; u ++) \ + H[u] ^= x[u]; \ + } while (0) + +#define DECL_STATE_BIG \ + sph_u64 H[16]; + +#define READ_STATE_BIG(sc) do { \ + memcpy(H, (sc)->state.wide, sizeof H); \ + } while (0) + +#define WRITE_STATE_BIG(sc) do { \ + memcpy((sc)->state.wide, H, sizeof H); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define RBTT(d, a, b0, b1, b2, b3, b4, b5, b6, b7) do { \ + t[d] = T0[B64_0(a[b0])] \ + ^ R64(T0[B64_1(a[b1])], 8) \ + ^ R64(T0[B64_2(a[b2])], 16) \ + ^ R64(T0[B64_3(a[b3])], 24) \ + ^ T4[B64_4(a[b4])] \ + ^ R64(T4[B64_5(a[b5])], 8) \ + ^ R64(T4[B64_6(a[b6])], 16) \ + ^ R64(T4[B64_7(a[b7])], 24); \ + } while (0) + +#else + +#define RBTT(d, a, b0, b1, b2, b3, b4, b5, b6, b7) do { \ + t[d] = T0[B64_0(a[b0])] \ + ^ T1[B64_1(a[b1])] \ + ^ T2[B64_2(a[b2])] \ + ^ T3[B64_3(a[b3])] \ + ^ T4[B64_4(a[b4])] \ + ^ T5[B64_5(a[b5])] \ + ^ T6[B64_6(a[b6])] \ + ^ T7[B64_7(a[b7])]; \ + } while (0) + +#endif + +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define ROUND_BIG_P(a, r) do { \ + sph_u64 t[16]; \ + size_t u; \ + a[0x0] ^= PC64(0x00, r); \ + a[0x1] ^= PC64(0x10, r); \ + a[0x2] ^= PC64(0x20, r); \ + a[0x3] ^= PC64(0x30, r); \ + a[0x4] ^= PC64(0x40, r); \ + a[0x5] ^= PC64(0x50, r); \ + a[0x6] ^= PC64(0x60, r); \ + a[0x7] ^= PC64(0x70, r); \ + a[0x8] ^= PC64(0x80, r); \ + a[0x9] ^= PC64(0x90, r); \ + a[0xA] ^= PC64(0xA0, r); \ + a[0xB] ^= PC64(0xB0, r); \ + a[0xC] ^= PC64(0xC0, r); \ + a[0xD] ^= PC64(0xD0, r); \ + a[0xE] ^= PC64(0xE0, r); \ + a[0xF] ^= PC64(0xF0, r); \ + for (u = 0; u < 16; u += 4) { \ + RBTT(u + 0, a, u + 0, (u + 1) & 0xF, \ + (u + 2) & 0xF, (u + 3) & 0xF, (u + 4) & 0xF, \ + (u + 5) & 0xF, (u + 6) & 0xF, (u + 11) & 0xF); \ + RBTT(u + 1, a, u + 1, (u + 2) & 0xF, \ + (u + 3) & 0xF, (u + 4) & 0xF, (u + 5) & 0xF, \ + (u + 6) & 0xF, (u + 7) & 0xF, (u + 12) & 0xF); \ + RBTT(u + 2, a, u + 2, (u + 3) & 0xF, \ + (u + 4) & 0xF, (u + 5) & 0xF, (u + 6) & 0xF, \ + (u + 7) & 0xF, (u + 8) & 0xF, (u + 13) & 0xF); \ + RBTT(u + 3, a, u + 3, (u + 4) & 0xF, \ + (u + 5) & 0xF, (u + 6) & 0xF, (u + 7) & 0xF, \ + (u + 8) & 0xF, (u + 9) & 0xF, (u + 14) & 0xF); \ + } \ + memcpy(a, t, sizeof t); \ + } while (0) + +#define ROUND_BIG_Q(a, r) do { \ + sph_u64 t[16]; \ + size_t u; \ + a[0x0] ^= QC64(0x00, r); \ + a[0x1] ^= QC64(0x10, r); \ + a[0x2] ^= QC64(0x20, r); \ + a[0x3] ^= QC64(0x30, r); \ + a[0x4] ^= QC64(0x40, r); \ + a[0x5] ^= QC64(0x50, r); \ + a[0x6] ^= QC64(0x60, r); \ + a[0x7] ^= QC64(0x70, r); \ + a[0x8] ^= QC64(0x80, r); \ + a[0x9] ^= QC64(0x90, r); \ + a[0xA] ^= QC64(0xA0, r); \ + a[0xB] ^= QC64(0xB0, r); \ + a[0xC] ^= QC64(0xC0, r); \ + a[0xD] ^= QC64(0xD0, r); \ + a[0xE] ^= QC64(0xE0, r); \ + a[0xF] ^= QC64(0xF0, r); \ + for (u = 0; u < 16; u += 4) { \ + RBTT(u + 0, a, (u + 1) & 0xF, (u + 3) & 0xF, \ + (u + 5) & 0xF, (u + 11) & 0xF, (u + 0) & 0xF, \ + (u + 2) & 0xF, (u + 4) & 0xF, (u + 6) & 0xF); \ + RBTT(u + 1, a, (u + 2) & 0xF, (u + 4) & 0xF, \ + (u + 6) & 0xF, (u + 12) & 0xF, (u + 1) & 0xF, \ + (u + 3) & 0xF, (u + 5) & 0xF, (u + 7) & 0xF); \ + RBTT(u + 2, a, (u + 3) & 0xF, (u + 5) & 0xF, \ + (u + 7) & 0xF, (u + 13) & 0xF, (u + 2) & 0xF, \ + (u + 4) & 0xF, (u + 6) & 0xF, (u + 8) & 0xF); \ + RBTT(u + 3, a, (u + 4) & 0xF, (u + 6) & 0xF, \ + (u + 8) & 0xF, (u + 14) & 0xF, (u + 3) & 0xF, \ + (u + 5) & 0xF, (u + 7) & 0xF, (u + 9) & 0xF); \ + } \ + memcpy(a, t, sizeof t); \ + } while (0) + +#else + +#define ROUND_BIG_P(a, r) do { \ + sph_u64 t[16]; \ + a[0x0] ^= PC64(0x00, r); \ + a[0x1] ^= PC64(0x10, r); \ + a[0x2] ^= PC64(0x20, r); \ + a[0x3] ^= PC64(0x30, r); \ + a[0x4] ^= PC64(0x40, r); \ + a[0x5] ^= PC64(0x50, r); \ + a[0x6] ^= PC64(0x60, r); \ + a[0x7] ^= PC64(0x70, r); \ + a[0x8] ^= PC64(0x80, r); \ + a[0x9] ^= PC64(0x90, r); \ + a[0xA] ^= PC64(0xA0, r); \ + a[0xB] ^= PC64(0xB0, r); \ + a[0xC] ^= PC64(0xC0, r); \ + a[0xD] ^= PC64(0xD0, r); \ + a[0xE] ^= PC64(0xE0, r); \ + a[0xF] ^= PC64(0xF0, r); \ + RBTT(0x0, a, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0xB); \ + RBTT(0x1, a, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0xC); \ + RBTT(0x2, a, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0xD); \ + RBTT(0x3, a, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xE); \ + RBTT(0x4, a, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xF); \ + RBTT(0x5, a, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB, 0x0); \ + RBTT(0x6, a, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB, 0xC, 0x1); \ + RBTT(0x7, a, 0x7, 0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0x2); \ + RBTT(0x8, a, 0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0x3); \ + RBTT(0x9, a, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, 0x4); \ + RBTT(0xA, a, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, 0x0, 0x5); \ + RBTT(0xB, a, 0xB, 0xC, 0xD, 0xE, 0xF, 0x0, 0x1, 0x6); \ + RBTT(0xC, a, 0xC, 0xD, 0xE, 0xF, 0x0, 0x1, 0x2, 0x7); \ + RBTT(0xD, a, 0xD, 0xE, 0xF, 0x0, 0x1, 0x2, 0x3, 0x8); \ + RBTT(0xE, a, 0xE, 0xF, 0x0, 0x1, 0x2, 0x3, 0x4, 0x9); \ + RBTT(0xF, a, 0xF, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0xA); \ + a[0x0] = t[0x0]; \ + a[0x1] = t[0x1]; \ + a[0x2] = t[0x2]; \ + a[0x3] = t[0x3]; \ + a[0x4] = t[0x4]; \ + a[0x5] = t[0x5]; \ + a[0x6] = t[0x6]; \ + a[0x7] = t[0x7]; \ + a[0x8] = t[0x8]; \ + a[0x9] = t[0x9]; \ + a[0xA] = t[0xA]; \ + a[0xB] = t[0xB]; \ + a[0xC] = t[0xC]; \ + a[0xD] = t[0xD]; \ + a[0xE] = t[0xE]; \ + a[0xF] = t[0xF]; \ + } while (0) + +#define ROUND_BIG_Q(a, r) do { \ + sph_u64 t[16]; \ + a[0x0] ^= QC64(0x00, r); \ + a[0x1] ^= QC64(0x10, r); \ + a[0x2] ^= QC64(0x20, r); \ + a[0x3] ^= QC64(0x30, r); \ + a[0x4] ^= QC64(0x40, r); \ + a[0x5] ^= QC64(0x50, r); \ + a[0x6] ^= QC64(0x60, r); \ + a[0x7] ^= QC64(0x70, r); \ + a[0x8] ^= QC64(0x80, r); \ + a[0x9] ^= QC64(0x90, r); \ + a[0xA] ^= QC64(0xA0, r); \ + a[0xB] ^= QC64(0xB0, r); \ + a[0xC] ^= QC64(0xC0, r); \ + a[0xD] ^= QC64(0xD0, r); \ + a[0xE] ^= QC64(0xE0, r); \ + a[0xF] ^= QC64(0xF0, r); \ + RBTT(0x0, a, 0x1, 0x3, 0x5, 0xB, 0x0, 0x2, 0x4, 0x6); \ + RBTT(0x1, a, 0x2, 0x4, 0x6, 0xC, 0x1, 0x3, 0x5, 0x7); \ + RBTT(0x2, a, 0x3, 0x5, 0x7, 0xD, 0x2, 0x4, 0x6, 0x8); \ + RBTT(0x3, a, 0x4, 0x6, 0x8, 0xE, 0x3, 0x5, 0x7, 0x9); \ + RBTT(0x4, a, 0x5, 0x7, 0x9, 0xF, 0x4, 0x6, 0x8, 0xA); \ + RBTT(0x5, a, 0x6, 0x8, 0xA, 0x0, 0x5, 0x7, 0x9, 0xB); \ + RBTT(0x6, a, 0x7, 0x9, 0xB, 0x1, 0x6, 0x8, 0xA, 0xC); \ + RBTT(0x7, a, 0x8, 0xA, 0xC, 0x2, 0x7, 0x9, 0xB, 0xD); \ + RBTT(0x8, a, 0x9, 0xB, 0xD, 0x3, 0x8, 0xA, 0xC, 0xE); \ + RBTT(0x9, a, 0xA, 0xC, 0xE, 0x4, 0x9, 0xB, 0xD, 0xF); \ + RBTT(0xA, a, 0xB, 0xD, 0xF, 0x5, 0xA, 0xC, 0xE, 0x0); \ + RBTT(0xB, a, 0xC, 0xE, 0x0, 0x6, 0xB, 0xD, 0xF, 0x1); \ + RBTT(0xC, a, 0xD, 0xF, 0x1, 0x7, 0xC, 0xE, 0x0, 0x2); \ + RBTT(0xD, a, 0xE, 0x0, 0x2, 0x8, 0xD, 0xF, 0x1, 0x3); \ + RBTT(0xE, a, 0xF, 0x1, 0x3, 0x9, 0xE, 0x0, 0x2, 0x4); \ + RBTT(0xF, a, 0x0, 0x2, 0x4, 0xA, 0xF, 0x1, 0x3, 0x5); \ + a[0x0] = t[0x0]; \ + a[0x1] = t[0x1]; \ + a[0x2] = t[0x2]; \ + a[0x3] = t[0x3]; \ + a[0x4] = t[0x4]; \ + a[0x5] = t[0x5]; \ + a[0x6] = t[0x6]; \ + a[0x7] = t[0x7]; \ + a[0x8] = t[0x8]; \ + a[0x9] = t[0x9]; \ + a[0xA] = t[0xA]; \ + a[0xB] = t[0xB]; \ + a[0xC] = t[0xC]; \ + a[0xD] = t[0xD]; \ + a[0xE] = t[0xE]; \ + a[0xF] = t[0xF]; \ + } while (0) + +#endif + +#define PERM_BIG_P(a) do { \ + int r; \ + for (r = 0; r < 14; r += 2) { \ + ROUND_BIG_P(a, r + 0); \ + ROUND_BIG_P(a, r + 1); \ + } \ + } while (0) + +#define PERM_BIG_Q(a) do { \ + int r; \ + for (r = 0; r < 14; r += 2) { \ + ROUND_BIG_Q(a, r + 0); \ + ROUND_BIG_Q(a, r + 1); \ + } \ + } while (0) + +/* obsolete +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define COMPRESS_BIG do { \ + sph_u64 g[16], m[16], *ya; \ + const sph_u64 *yc; \ + size_t u; \ + int i; \ + for (u = 0; u < 16; u ++) { \ + m[u] = dec64e_aligned(buf + (u << 3)); \ + g[u] = m[u] ^ H[u]; \ + } \ + ya = g; \ + yc = CP; \ + for (i = 0; i < 2; i ++) { \ + PERM_BIG(ya, yc); \ + ya = m; \ + yc = CQ; \ + } \ + for (u = 0; u < 16; u ++) { \ + H[u] ^= g[u] ^ m[u]; \ + } \ + } while (0) + +#else +*/ + +#define COMPRESS_BIG do { \ + sph_u64 g[16], m[16]; \ + size_t u; \ + for (u = 0; u < 16; u ++) { \ + m[u] = dec64e_aligned(buf + (u << 3)); \ + g[u] = m[u] ^ H[u]; \ + } \ + PERM_BIG_P(g); \ + PERM_BIG_Q(m); \ + for (u = 0; u < 16; u ++) { \ + H[u] ^= g[u] ^ m[u]; \ + } \ + } while (0) + +/* obsolete +#endif +*/ + +#define FINAL_BIG do { \ + sph_u64 x[16]; \ + size_t u; \ + memcpy(x, H, sizeof x); \ + PERM_BIG_P(x); \ + for (u = 0; u < 16; u ++) \ + H[u] ^= x[u]; \ + } while (0) + +#else + +static const sph_u32 T0up[] = { + C32e(0xc632f4a5), C32e(0xf86f9784), C32e(0xee5eb099), C32e(0xf67a8c8d), + C32e(0xffe8170d), C32e(0xd60adcbd), C32e(0xde16c8b1), C32e(0x916dfc54), + C32e(0x6090f050), C32e(0x02070503), C32e(0xce2ee0a9), C32e(0x56d1877d), + C32e(0xe7cc2b19), C32e(0xb513a662), C32e(0x4d7c31e6), C32e(0xec59b59a), + C32e(0x8f40cf45), C32e(0x1fa3bc9d), C32e(0x8949c040), C32e(0xfa689287), + C32e(0xefd03f15), C32e(0xb29426eb), C32e(0x8ece40c9), C32e(0xfbe61d0b), + C32e(0x416e2fec), C32e(0xb31aa967), C32e(0x5f431cfd), C32e(0x456025ea), + C32e(0x23f9dabf), C32e(0x535102f7), C32e(0xe445a196), C32e(0x9b76ed5b), + C32e(0x75285dc2), C32e(0xe1c5241c), C32e(0x3dd4e9ae), C32e(0x4cf2be6a), + C32e(0x6c82ee5a), C32e(0x7ebdc341), C32e(0xf5f30602), C32e(0x8352d14f), + C32e(0x688ce45c), C32e(0x515607f4), C32e(0xd18d5c34), C32e(0xf9e11808), + C32e(0xe24cae93), C32e(0xab3e9573), C32e(0x6297f553), C32e(0x2a6b413f), + C32e(0x081c140c), C32e(0x9563f652), C32e(0x46e9af65), C32e(0x9d7fe25e), + C32e(0x30487828), C32e(0x37cff8a1), C32e(0x0a1b110f), C32e(0x2febc4b5), + C32e(0x0e151b09), C32e(0x247e5a36), C32e(0x1badb69b), C32e(0xdf98473d), + C32e(0xcda76a26), C32e(0x4ef5bb69), C32e(0x7f334ccd), C32e(0xea50ba9f), + C32e(0x123f2d1b), C32e(0x1da4b99e), C32e(0x58c49c74), C32e(0x3446722e), + C32e(0x3641772d), C32e(0xdc11cdb2), C32e(0xb49d29ee), C32e(0x5b4d16fb), + C32e(0xa4a501f6), C32e(0x76a1d74d), C32e(0xb714a361), C32e(0x7d3449ce), + C32e(0x52df8d7b), C32e(0xdd9f423e), C32e(0x5ecd9371), C32e(0x13b1a297), + C32e(0xa6a204f5), C32e(0xb901b868), C32e(0x00000000), C32e(0xc1b5742c), + C32e(0x40e0a060), C32e(0xe3c2211f), C32e(0x793a43c8), C32e(0xb69a2ced), + C32e(0xd40dd9be), C32e(0x8d47ca46), C32e(0x671770d9), C32e(0x72afdd4b), + C32e(0x94ed79de), C32e(0x98ff67d4), C32e(0xb09323e8), C32e(0x855bde4a), + C32e(0xbb06bd6b), C32e(0xc5bb7e2a), C32e(0x4f7b34e5), C32e(0xedd73a16), + C32e(0x86d254c5), C32e(0x9af862d7), C32e(0x6699ff55), C32e(0x11b6a794), + C32e(0x8ac04acf), C32e(0xe9d93010), C32e(0x040e0a06), C32e(0xfe669881), + C32e(0xa0ab0bf0), C32e(0x78b4cc44), C32e(0x25f0d5ba), C32e(0x4b753ee3), + C32e(0xa2ac0ef3), C32e(0x5d4419fe), C32e(0x80db5bc0), C32e(0x0580858a), + C32e(0x3fd3ecad), C32e(0x21fedfbc), C32e(0x70a8d848), C32e(0xf1fd0c04), + C32e(0x63197adf), C32e(0x772f58c1), C32e(0xaf309f75), C32e(0x42e7a563), + C32e(0x20705030), C32e(0xe5cb2e1a), C32e(0xfdef120e), C32e(0xbf08b76d), + C32e(0x8155d44c), C32e(0x18243c14), C32e(0x26795f35), C32e(0xc3b2712f), + C32e(0xbe8638e1), C32e(0x35c8fda2), C32e(0x88c74fcc), C32e(0x2e654b39), + C32e(0x936af957), C32e(0x55580df2), C32e(0xfc619d82), C32e(0x7ab3c947), + C32e(0xc827efac), C32e(0xba8832e7), C32e(0x324f7d2b), C32e(0xe642a495), + C32e(0xc03bfba0), C32e(0x19aab398), C32e(0x9ef668d1), C32e(0xa322817f), + C32e(0x44eeaa66), C32e(0x54d6827e), C32e(0x3bdde6ab), C32e(0x0b959e83), + C32e(0x8cc945ca), C32e(0xc7bc7b29), C32e(0x6b056ed3), C32e(0x286c443c), + C32e(0xa72c8b79), C32e(0xbc813de2), C32e(0x1631271d), C32e(0xad379a76), + C32e(0xdb964d3b), C32e(0x649efa56), C32e(0x74a6d24e), C32e(0x1436221e), + C32e(0x92e476db), C32e(0x0c121e0a), C32e(0x48fcb46c), C32e(0xb88f37e4), + C32e(0x9f78e75d), C32e(0xbd0fb26e), C32e(0x43692aef), C32e(0xc435f1a6), + C32e(0x39dae3a8), C32e(0x31c6f7a4), C32e(0xd38a5937), C32e(0xf274868b), + C32e(0xd5835632), C32e(0x8b4ec543), C32e(0x6e85eb59), C32e(0xda18c2b7), + C32e(0x018e8f8c), C32e(0xb11dac64), C32e(0x9cf16dd2), C32e(0x49723be0), + C32e(0xd81fc7b4), C32e(0xacb915fa), C32e(0xf3fa0907), C32e(0xcfa06f25), + C32e(0xca20eaaf), C32e(0xf47d898e), C32e(0x476720e9), C32e(0x10382818), + C32e(0x6f0b64d5), C32e(0xf0738388), C32e(0x4afbb16f), C32e(0x5cca9672), + C32e(0x38546c24), C32e(0x575f08f1), C32e(0x732152c7), C32e(0x9764f351), + C32e(0xcbae6523), C32e(0xa125847c), C32e(0xe857bf9c), C32e(0x3e5d6321), + C32e(0x96ea7cdd), C32e(0x611e7fdc), C32e(0x0d9c9186), C32e(0x0f9b9485), + C32e(0xe04bab90), C32e(0x7cbac642), C32e(0x712657c4), C32e(0xcc29e5aa), + C32e(0x90e373d8), C32e(0x06090f05), C32e(0xf7f40301), C32e(0x1c2a3612), + C32e(0xc23cfea3), C32e(0x6a8be15f), C32e(0xaebe10f9), C32e(0x69026bd0), + C32e(0x17bfa891), C32e(0x9971e858), C32e(0x3a536927), C32e(0x27f7d0b9), + C32e(0xd9914838), C32e(0xebde3513), C32e(0x2be5ceb3), C32e(0x22775533), + C32e(0xd204d6bb), C32e(0xa9399070), C32e(0x07878089), C32e(0x33c1f2a7), + C32e(0x2decc1b6), C32e(0x3c5a6622), C32e(0x15b8ad92), C32e(0xc9a96020), + C32e(0x875cdb49), C32e(0xaab01aff), C32e(0x50d88878), C32e(0xa52b8e7a), + C32e(0x03898a8f), C32e(0x594a13f8), C32e(0x09929b80), C32e(0x1a233917), + C32e(0x651075da), C32e(0xd7845331), C32e(0x84d551c6), C32e(0xd003d3b8), + C32e(0x82dc5ec3), C32e(0x29e2cbb0), C32e(0x5ac39977), C32e(0x1e2d3311), + C32e(0x7b3d46cb), C32e(0xa8b71ffc), C32e(0x6d0c61d6), C32e(0x2c624e3a) +}; + +static const sph_u32 T0dn[] = { + C32e(0xf497a5c6), C32e(0x97eb84f8), C32e(0xb0c799ee), C32e(0x8cf78df6), + C32e(0x17e50dff), C32e(0xdcb7bdd6), C32e(0xc8a7b1de), C32e(0xfc395491), + C32e(0xf0c05060), C32e(0x05040302), C32e(0xe087a9ce), C32e(0x87ac7d56), + C32e(0x2bd519e7), C32e(0xa67162b5), C32e(0x319ae64d), C32e(0xb5c39aec), + C32e(0xcf05458f), C32e(0xbc3e9d1f), C32e(0xc0094089), C32e(0x92ef87fa), + C32e(0x3fc515ef), C32e(0x267febb2), C32e(0x4007c98e), C32e(0x1ded0bfb), + C32e(0x2f82ec41), C32e(0xa97d67b3), C32e(0x1cbefd5f), C32e(0x258aea45), + C32e(0xda46bf23), C32e(0x02a6f753), C32e(0xa1d396e4), C32e(0xed2d5b9b), + C32e(0x5deac275), C32e(0x24d91ce1), C32e(0xe97aae3d), C32e(0xbe986a4c), + C32e(0xeed85a6c), C32e(0xc3fc417e), C32e(0x06f102f5), C32e(0xd11d4f83), + C32e(0xe4d05c68), C32e(0x07a2f451), C32e(0x5cb934d1), C32e(0x18e908f9), + C32e(0xaedf93e2), C32e(0x954d73ab), C32e(0xf5c45362), C32e(0x41543f2a), + C32e(0x14100c08), C32e(0xf6315295), C32e(0xaf8c6546), C32e(0xe2215e9d), + C32e(0x78602830), C32e(0xf86ea137), C32e(0x11140f0a), C32e(0xc45eb52f), + C32e(0x1b1c090e), C32e(0x5a483624), C32e(0xb6369b1b), C32e(0x47a53ddf), + C32e(0x6a8126cd), C32e(0xbb9c694e), C32e(0x4cfecd7f), C32e(0xbacf9fea), + C32e(0x2d241b12), C32e(0xb93a9e1d), C32e(0x9cb07458), C32e(0x72682e34), + C32e(0x776c2d36), C32e(0xcda3b2dc), C32e(0x2973eeb4), C32e(0x16b6fb5b), + C32e(0x0153f6a4), C32e(0xd7ec4d76), C32e(0xa37561b7), C32e(0x49face7d), + C32e(0x8da47b52), C32e(0x42a13edd), C32e(0x93bc715e), C32e(0xa2269713), + C32e(0x0457f5a6), C32e(0xb86968b9), C32e(0x00000000), C32e(0x74992cc1), + C32e(0xa0806040), C32e(0x21dd1fe3), C32e(0x43f2c879), C32e(0x2c77edb6), + C32e(0xd9b3bed4), C32e(0xca01468d), C32e(0x70ced967), C32e(0xdde44b72), + C32e(0x7933de94), C32e(0x672bd498), C32e(0x237be8b0), C32e(0xde114a85), + C32e(0xbd6d6bbb), C32e(0x7e912ac5), C32e(0x349ee54f), C32e(0x3ac116ed), + C32e(0x5417c586), C32e(0x622fd79a), C32e(0xffcc5566), C32e(0xa7229411), + C32e(0x4a0fcf8a), C32e(0x30c910e9), C32e(0x0a080604), C32e(0x98e781fe), + C32e(0x0b5bf0a0), C32e(0xccf04478), C32e(0xd54aba25), C32e(0x3e96e34b), + C32e(0x0e5ff3a2), C32e(0x19bafe5d), C32e(0x5b1bc080), C32e(0x850a8a05), + C32e(0xec7ead3f), C32e(0xdf42bc21), C32e(0xd8e04870), C32e(0x0cf904f1), + C32e(0x7ac6df63), C32e(0x58eec177), C32e(0x9f4575af), C32e(0xa5846342), + C32e(0x50403020), C32e(0x2ed11ae5), C32e(0x12e10efd), C32e(0xb7656dbf), + C32e(0xd4194c81), C32e(0x3c301418), C32e(0x5f4c3526), C32e(0x719d2fc3), + C32e(0x3867e1be), C32e(0xfd6aa235), C32e(0x4f0bcc88), C32e(0x4b5c392e), + C32e(0xf93d5793), C32e(0x0daaf255), C32e(0x9de382fc), C32e(0xc9f4477a), + C32e(0xef8bacc8), C32e(0x326fe7ba), C32e(0x7d642b32), C32e(0xa4d795e6), + C32e(0xfb9ba0c0), C32e(0xb3329819), C32e(0x6827d19e), C32e(0x815d7fa3), + C32e(0xaa886644), C32e(0x82a87e54), C32e(0xe676ab3b), C32e(0x9e16830b), + C32e(0x4503ca8c), C32e(0x7b9529c7), C32e(0x6ed6d36b), C32e(0x44503c28), + C32e(0x8b5579a7), C32e(0x3d63e2bc), C32e(0x272c1d16), C32e(0x9a4176ad), + C32e(0x4dad3bdb), C32e(0xfac85664), C32e(0xd2e84e74), C32e(0x22281e14), + C32e(0x763fdb92), C32e(0x1e180a0c), C32e(0xb4906c48), C32e(0x376be4b8), + C32e(0xe7255d9f), C32e(0xb2616ebd), C32e(0x2a86ef43), C32e(0xf193a6c4), + C32e(0xe372a839), C32e(0xf762a431), C32e(0x59bd37d3), C32e(0x86ff8bf2), + C32e(0x56b132d5), C32e(0xc50d438b), C32e(0xebdc596e), C32e(0xc2afb7da), + C32e(0x8f028c01), C32e(0xac7964b1), C32e(0x6d23d29c), C32e(0x3b92e049), + C32e(0xc7abb4d8), C32e(0x1543faac), C32e(0x09fd07f3), C32e(0x6f8525cf), + C32e(0xea8fafca), C32e(0x89f38ef4), C32e(0x208ee947), C32e(0x28201810), + C32e(0x64ded56f), C32e(0x83fb88f0), C32e(0xb1946f4a), C32e(0x96b8725c), + C32e(0x6c702438), C32e(0x08aef157), C32e(0x52e6c773), C32e(0xf3355197), + C32e(0x658d23cb), C32e(0x84597ca1), C32e(0xbfcb9ce8), C32e(0x637c213e), + C32e(0x7c37dd96), C32e(0x7fc2dc61), C32e(0x911a860d), C32e(0x941e850f), + C32e(0xabdb90e0), C32e(0xc6f8427c), C32e(0x57e2c471), C32e(0xe583aacc), + C32e(0x733bd890), C32e(0x0f0c0506), C32e(0x03f501f7), C32e(0x3638121c), + C32e(0xfe9fa3c2), C32e(0xe1d45f6a), C32e(0x1047f9ae), C32e(0x6bd2d069), + C32e(0xa82e9117), C32e(0xe8295899), C32e(0x6974273a), C32e(0xd04eb927), + C32e(0x48a938d9), C32e(0x35cd13eb), C32e(0xce56b32b), C32e(0x55443322), + C32e(0xd6bfbbd2), C32e(0x904970a9), C32e(0x800e8907), C32e(0xf266a733), + C32e(0xc15ab62d), C32e(0x6678223c), C32e(0xad2a9215), C32e(0x608920c9), + C32e(0xdb154987), C32e(0x1a4fffaa), C32e(0x88a07850), C32e(0x8e517aa5), + C32e(0x8a068f03), C32e(0x13b2f859), C32e(0x9b128009), C32e(0x3934171a), + C32e(0x75cada65), C32e(0x53b531d7), C32e(0x5113c684), C32e(0xd3bbb8d0), + C32e(0x5e1fc382), C32e(0xcb52b029), C32e(0x99b4775a), C32e(0x333c111e), + C32e(0x46f6cb7b), C32e(0x1f4bfca8), C32e(0x61dad66d), C32e(0x4e583a2c) +}; + +static const sph_u32 T1up[] = { + C32e(0xc6c632f4), C32e(0xf8f86f97), C32e(0xeeee5eb0), C32e(0xf6f67a8c), + C32e(0xffffe817), C32e(0xd6d60adc), C32e(0xdede16c8), C32e(0x91916dfc), + C32e(0x606090f0), C32e(0x02020705), C32e(0xcece2ee0), C32e(0x5656d187), + C32e(0xe7e7cc2b), C32e(0xb5b513a6), C32e(0x4d4d7c31), C32e(0xecec59b5), + C32e(0x8f8f40cf), C32e(0x1f1fa3bc), C32e(0x898949c0), C32e(0xfafa6892), + C32e(0xefefd03f), C32e(0xb2b29426), C32e(0x8e8ece40), C32e(0xfbfbe61d), + C32e(0x41416e2f), C32e(0xb3b31aa9), C32e(0x5f5f431c), C32e(0x45456025), + C32e(0x2323f9da), C32e(0x53535102), C32e(0xe4e445a1), C32e(0x9b9b76ed), + C32e(0x7575285d), C32e(0xe1e1c524), C32e(0x3d3dd4e9), C32e(0x4c4cf2be), + C32e(0x6c6c82ee), C32e(0x7e7ebdc3), C32e(0xf5f5f306), C32e(0x838352d1), + C32e(0x68688ce4), C32e(0x51515607), C32e(0xd1d18d5c), C32e(0xf9f9e118), + C32e(0xe2e24cae), C32e(0xabab3e95), C32e(0x626297f5), C32e(0x2a2a6b41), + C32e(0x08081c14), C32e(0x959563f6), C32e(0x4646e9af), C32e(0x9d9d7fe2), + C32e(0x30304878), C32e(0x3737cff8), C32e(0x0a0a1b11), C32e(0x2f2febc4), + C32e(0x0e0e151b), C32e(0x24247e5a), C32e(0x1b1badb6), C32e(0xdfdf9847), + C32e(0xcdcda76a), C32e(0x4e4ef5bb), C32e(0x7f7f334c), C32e(0xeaea50ba), + C32e(0x12123f2d), C32e(0x1d1da4b9), C32e(0x5858c49c), C32e(0x34344672), + C32e(0x36364177), C32e(0xdcdc11cd), C32e(0xb4b49d29), C32e(0x5b5b4d16), + C32e(0xa4a4a501), C32e(0x7676a1d7), C32e(0xb7b714a3), C32e(0x7d7d3449), + C32e(0x5252df8d), C32e(0xdddd9f42), C32e(0x5e5ecd93), C32e(0x1313b1a2), + C32e(0xa6a6a204), C32e(0xb9b901b8), C32e(0x00000000), C32e(0xc1c1b574), + C32e(0x4040e0a0), C32e(0xe3e3c221), C32e(0x79793a43), C32e(0xb6b69a2c), + C32e(0xd4d40dd9), C32e(0x8d8d47ca), C32e(0x67671770), C32e(0x7272afdd), + C32e(0x9494ed79), C32e(0x9898ff67), C32e(0xb0b09323), C32e(0x85855bde), + C32e(0xbbbb06bd), C32e(0xc5c5bb7e), C32e(0x4f4f7b34), C32e(0xededd73a), + C32e(0x8686d254), C32e(0x9a9af862), C32e(0x666699ff), C32e(0x1111b6a7), + C32e(0x8a8ac04a), C32e(0xe9e9d930), C32e(0x04040e0a), C32e(0xfefe6698), + C32e(0xa0a0ab0b), C32e(0x7878b4cc), C32e(0x2525f0d5), C32e(0x4b4b753e), + C32e(0xa2a2ac0e), C32e(0x5d5d4419), C32e(0x8080db5b), C32e(0x05058085), + C32e(0x3f3fd3ec), C32e(0x2121fedf), C32e(0x7070a8d8), C32e(0xf1f1fd0c), + C32e(0x6363197a), C32e(0x77772f58), C32e(0xafaf309f), C32e(0x4242e7a5), + C32e(0x20207050), C32e(0xe5e5cb2e), C32e(0xfdfdef12), C32e(0xbfbf08b7), + C32e(0x818155d4), C32e(0x1818243c), C32e(0x2626795f), C32e(0xc3c3b271), + C32e(0xbebe8638), C32e(0x3535c8fd), C32e(0x8888c74f), C32e(0x2e2e654b), + C32e(0x93936af9), C32e(0x5555580d), C32e(0xfcfc619d), C32e(0x7a7ab3c9), + C32e(0xc8c827ef), C32e(0xbaba8832), C32e(0x32324f7d), C32e(0xe6e642a4), + C32e(0xc0c03bfb), C32e(0x1919aab3), C32e(0x9e9ef668), C32e(0xa3a32281), + C32e(0x4444eeaa), C32e(0x5454d682), C32e(0x3b3bdde6), C32e(0x0b0b959e), + C32e(0x8c8cc945), C32e(0xc7c7bc7b), C32e(0x6b6b056e), C32e(0x28286c44), + C32e(0xa7a72c8b), C32e(0xbcbc813d), C32e(0x16163127), C32e(0xadad379a), + C32e(0xdbdb964d), C32e(0x64649efa), C32e(0x7474a6d2), C32e(0x14143622), + C32e(0x9292e476), C32e(0x0c0c121e), C32e(0x4848fcb4), C32e(0xb8b88f37), + C32e(0x9f9f78e7), C32e(0xbdbd0fb2), C32e(0x4343692a), C32e(0xc4c435f1), + C32e(0x3939dae3), C32e(0x3131c6f7), C32e(0xd3d38a59), C32e(0xf2f27486), + C32e(0xd5d58356), C32e(0x8b8b4ec5), C32e(0x6e6e85eb), C32e(0xdada18c2), + C32e(0x01018e8f), C32e(0xb1b11dac), C32e(0x9c9cf16d), C32e(0x4949723b), + C32e(0xd8d81fc7), C32e(0xacacb915), C32e(0xf3f3fa09), C32e(0xcfcfa06f), + C32e(0xcaca20ea), C32e(0xf4f47d89), C32e(0x47476720), C32e(0x10103828), + C32e(0x6f6f0b64), C32e(0xf0f07383), C32e(0x4a4afbb1), C32e(0x5c5cca96), + C32e(0x3838546c), C32e(0x57575f08), C32e(0x73732152), C32e(0x979764f3), + C32e(0xcbcbae65), C32e(0xa1a12584), C32e(0xe8e857bf), C32e(0x3e3e5d63), + C32e(0x9696ea7c), C32e(0x61611e7f), C32e(0x0d0d9c91), C32e(0x0f0f9b94), + C32e(0xe0e04bab), C32e(0x7c7cbac6), C32e(0x71712657), C32e(0xcccc29e5), + C32e(0x9090e373), C32e(0x0606090f), C32e(0xf7f7f403), C32e(0x1c1c2a36), + C32e(0xc2c23cfe), C32e(0x6a6a8be1), C32e(0xaeaebe10), C32e(0x6969026b), + C32e(0x1717bfa8), C32e(0x999971e8), C32e(0x3a3a5369), C32e(0x2727f7d0), + C32e(0xd9d99148), C32e(0xebebde35), C32e(0x2b2be5ce), C32e(0x22227755), + C32e(0xd2d204d6), C32e(0xa9a93990), C32e(0x07078780), C32e(0x3333c1f2), + C32e(0x2d2decc1), C32e(0x3c3c5a66), C32e(0x1515b8ad), C32e(0xc9c9a960), + C32e(0x87875cdb), C32e(0xaaaab01a), C32e(0x5050d888), C32e(0xa5a52b8e), + C32e(0x0303898a), C32e(0x59594a13), C32e(0x0909929b), C32e(0x1a1a2339), + C32e(0x65651075), C32e(0xd7d78453), C32e(0x8484d551), C32e(0xd0d003d3), + C32e(0x8282dc5e), C32e(0x2929e2cb), C32e(0x5a5ac399), C32e(0x1e1e2d33), + C32e(0x7b7b3d46), C32e(0xa8a8b71f), C32e(0x6d6d0c61), C32e(0x2c2c624e) +}; + +static const sph_u32 T1dn[] = { + C32e(0xa5f497a5), C32e(0x8497eb84), C32e(0x99b0c799), C32e(0x8d8cf78d), + C32e(0x0d17e50d), C32e(0xbddcb7bd), C32e(0xb1c8a7b1), C32e(0x54fc3954), + C32e(0x50f0c050), C32e(0x03050403), C32e(0xa9e087a9), C32e(0x7d87ac7d), + C32e(0x192bd519), C32e(0x62a67162), C32e(0xe6319ae6), C32e(0x9ab5c39a), + C32e(0x45cf0545), C32e(0x9dbc3e9d), C32e(0x40c00940), C32e(0x8792ef87), + C32e(0x153fc515), C32e(0xeb267feb), C32e(0xc94007c9), C32e(0x0b1ded0b), + C32e(0xec2f82ec), C32e(0x67a97d67), C32e(0xfd1cbefd), C32e(0xea258aea), + C32e(0xbfda46bf), C32e(0xf702a6f7), C32e(0x96a1d396), C32e(0x5bed2d5b), + C32e(0xc25deac2), C32e(0x1c24d91c), C32e(0xaee97aae), C32e(0x6abe986a), + C32e(0x5aeed85a), C32e(0x41c3fc41), C32e(0x0206f102), C32e(0x4fd11d4f), + C32e(0x5ce4d05c), C32e(0xf407a2f4), C32e(0x345cb934), C32e(0x0818e908), + C32e(0x93aedf93), C32e(0x73954d73), C32e(0x53f5c453), C32e(0x3f41543f), + C32e(0x0c14100c), C32e(0x52f63152), C32e(0x65af8c65), C32e(0x5ee2215e), + C32e(0x28786028), C32e(0xa1f86ea1), C32e(0x0f11140f), C32e(0xb5c45eb5), + C32e(0x091b1c09), C32e(0x365a4836), C32e(0x9bb6369b), C32e(0x3d47a53d), + C32e(0x266a8126), C32e(0x69bb9c69), C32e(0xcd4cfecd), C32e(0x9fbacf9f), + C32e(0x1b2d241b), C32e(0x9eb93a9e), C32e(0x749cb074), C32e(0x2e72682e), + C32e(0x2d776c2d), C32e(0xb2cda3b2), C32e(0xee2973ee), C32e(0xfb16b6fb), + C32e(0xf60153f6), C32e(0x4dd7ec4d), C32e(0x61a37561), C32e(0xce49face), + C32e(0x7b8da47b), C32e(0x3e42a13e), C32e(0x7193bc71), C32e(0x97a22697), + C32e(0xf50457f5), C32e(0x68b86968), C32e(0x00000000), C32e(0x2c74992c), + C32e(0x60a08060), C32e(0x1f21dd1f), C32e(0xc843f2c8), C32e(0xed2c77ed), + C32e(0xbed9b3be), C32e(0x46ca0146), C32e(0xd970ced9), C32e(0x4bdde44b), + C32e(0xde7933de), C32e(0xd4672bd4), C32e(0xe8237be8), C32e(0x4ade114a), + C32e(0x6bbd6d6b), C32e(0x2a7e912a), C32e(0xe5349ee5), C32e(0x163ac116), + C32e(0xc55417c5), C32e(0xd7622fd7), C32e(0x55ffcc55), C32e(0x94a72294), + C32e(0xcf4a0fcf), C32e(0x1030c910), C32e(0x060a0806), C32e(0x8198e781), + C32e(0xf00b5bf0), C32e(0x44ccf044), C32e(0xbad54aba), C32e(0xe33e96e3), + C32e(0xf30e5ff3), C32e(0xfe19bafe), C32e(0xc05b1bc0), C32e(0x8a850a8a), + C32e(0xadec7ead), C32e(0xbcdf42bc), C32e(0x48d8e048), C32e(0x040cf904), + C32e(0xdf7ac6df), C32e(0xc158eec1), C32e(0x759f4575), C32e(0x63a58463), + C32e(0x30504030), C32e(0x1a2ed11a), C32e(0x0e12e10e), C32e(0x6db7656d), + C32e(0x4cd4194c), C32e(0x143c3014), C32e(0x355f4c35), C32e(0x2f719d2f), + C32e(0xe13867e1), C32e(0xa2fd6aa2), C32e(0xcc4f0bcc), C32e(0x394b5c39), + C32e(0x57f93d57), C32e(0xf20daaf2), C32e(0x829de382), C32e(0x47c9f447), + C32e(0xacef8bac), C32e(0xe7326fe7), C32e(0x2b7d642b), C32e(0x95a4d795), + C32e(0xa0fb9ba0), C32e(0x98b33298), C32e(0xd16827d1), C32e(0x7f815d7f), + C32e(0x66aa8866), C32e(0x7e82a87e), C32e(0xabe676ab), C32e(0x839e1683), + C32e(0xca4503ca), C32e(0x297b9529), C32e(0xd36ed6d3), C32e(0x3c44503c), + C32e(0x798b5579), C32e(0xe23d63e2), C32e(0x1d272c1d), C32e(0x769a4176), + C32e(0x3b4dad3b), C32e(0x56fac856), C32e(0x4ed2e84e), C32e(0x1e22281e), + C32e(0xdb763fdb), C32e(0x0a1e180a), C32e(0x6cb4906c), C32e(0xe4376be4), + C32e(0x5de7255d), C32e(0x6eb2616e), C32e(0xef2a86ef), C32e(0xa6f193a6), + C32e(0xa8e372a8), C32e(0xa4f762a4), C32e(0x3759bd37), C32e(0x8b86ff8b), + C32e(0x3256b132), C32e(0x43c50d43), C32e(0x59ebdc59), C32e(0xb7c2afb7), + C32e(0x8c8f028c), C32e(0x64ac7964), C32e(0xd26d23d2), C32e(0xe03b92e0), + C32e(0xb4c7abb4), C32e(0xfa1543fa), C32e(0x0709fd07), C32e(0x256f8525), + C32e(0xafea8faf), C32e(0x8e89f38e), C32e(0xe9208ee9), C32e(0x18282018), + C32e(0xd564ded5), C32e(0x8883fb88), C32e(0x6fb1946f), C32e(0x7296b872), + C32e(0x246c7024), C32e(0xf108aef1), C32e(0xc752e6c7), C32e(0x51f33551), + C32e(0x23658d23), C32e(0x7c84597c), C32e(0x9cbfcb9c), C32e(0x21637c21), + C32e(0xdd7c37dd), C32e(0xdc7fc2dc), C32e(0x86911a86), C32e(0x85941e85), + C32e(0x90abdb90), C32e(0x42c6f842), C32e(0xc457e2c4), C32e(0xaae583aa), + C32e(0xd8733bd8), C32e(0x050f0c05), C32e(0x0103f501), C32e(0x12363812), + C32e(0xa3fe9fa3), C32e(0x5fe1d45f), C32e(0xf91047f9), C32e(0xd06bd2d0), + C32e(0x91a82e91), C32e(0x58e82958), C32e(0x27697427), C32e(0xb9d04eb9), + C32e(0x3848a938), C32e(0x1335cd13), C32e(0xb3ce56b3), C32e(0x33554433), + C32e(0xbbd6bfbb), C32e(0x70904970), C32e(0x89800e89), C32e(0xa7f266a7), + C32e(0xb6c15ab6), C32e(0x22667822), C32e(0x92ad2a92), C32e(0x20608920), + C32e(0x49db1549), C32e(0xff1a4fff), C32e(0x7888a078), C32e(0x7a8e517a), + C32e(0x8f8a068f), C32e(0xf813b2f8), C32e(0x809b1280), C32e(0x17393417), + C32e(0xda75cada), C32e(0x3153b531), C32e(0xc65113c6), C32e(0xb8d3bbb8), + C32e(0xc35e1fc3), C32e(0xb0cb52b0), C32e(0x7799b477), C32e(0x11333c11), + C32e(0xcb46f6cb), C32e(0xfc1f4bfc), C32e(0xd661dad6), C32e(0x3a4e583a) +}; + +static const sph_u32 T2up[] = { + C32e(0xa5c6c632), C32e(0x84f8f86f), C32e(0x99eeee5e), C32e(0x8df6f67a), + C32e(0x0dffffe8), C32e(0xbdd6d60a), C32e(0xb1dede16), C32e(0x5491916d), + C32e(0x50606090), C32e(0x03020207), C32e(0xa9cece2e), C32e(0x7d5656d1), + C32e(0x19e7e7cc), C32e(0x62b5b513), C32e(0xe64d4d7c), C32e(0x9aecec59), + C32e(0x458f8f40), C32e(0x9d1f1fa3), C32e(0x40898949), C32e(0x87fafa68), + C32e(0x15efefd0), C32e(0xebb2b294), C32e(0xc98e8ece), C32e(0x0bfbfbe6), + C32e(0xec41416e), C32e(0x67b3b31a), C32e(0xfd5f5f43), C32e(0xea454560), + C32e(0xbf2323f9), C32e(0xf7535351), C32e(0x96e4e445), C32e(0x5b9b9b76), + C32e(0xc2757528), C32e(0x1ce1e1c5), C32e(0xae3d3dd4), C32e(0x6a4c4cf2), + C32e(0x5a6c6c82), C32e(0x417e7ebd), C32e(0x02f5f5f3), C32e(0x4f838352), + C32e(0x5c68688c), C32e(0xf4515156), C32e(0x34d1d18d), C32e(0x08f9f9e1), + C32e(0x93e2e24c), C32e(0x73abab3e), C32e(0x53626297), C32e(0x3f2a2a6b), + C32e(0x0c08081c), C32e(0x52959563), C32e(0x654646e9), C32e(0x5e9d9d7f), + C32e(0x28303048), C32e(0xa13737cf), C32e(0x0f0a0a1b), C32e(0xb52f2feb), + C32e(0x090e0e15), C32e(0x3624247e), C32e(0x9b1b1bad), C32e(0x3ddfdf98), + C32e(0x26cdcda7), C32e(0x694e4ef5), C32e(0xcd7f7f33), C32e(0x9feaea50), + C32e(0x1b12123f), C32e(0x9e1d1da4), C32e(0x745858c4), C32e(0x2e343446), + C32e(0x2d363641), C32e(0xb2dcdc11), C32e(0xeeb4b49d), C32e(0xfb5b5b4d), + C32e(0xf6a4a4a5), C32e(0x4d7676a1), C32e(0x61b7b714), C32e(0xce7d7d34), + C32e(0x7b5252df), C32e(0x3edddd9f), C32e(0x715e5ecd), C32e(0x971313b1), + C32e(0xf5a6a6a2), C32e(0x68b9b901), C32e(0x00000000), C32e(0x2cc1c1b5), + C32e(0x604040e0), C32e(0x1fe3e3c2), C32e(0xc879793a), C32e(0xedb6b69a), + C32e(0xbed4d40d), C32e(0x468d8d47), C32e(0xd9676717), C32e(0x4b7272af), + C32e(0xde9494ed), C32e(0xd49898ff), C32e(0xe8b0b093), C32e(0x4a85855b), + C32e(0x6bbbbb06), C32e(0x2ac5c5bb), C32e(0xe54f4f7b), C32e(0x16ededd7), + C32e(0xc58686d2), C32e(0xd79a9af8), C32e(0x55666699), C32e(0x941111b6), + C32e(0xcf8a8ac0), C32e(0x10e9e9d9), C32e(0x0604040e), C32e(0x81fefe66), + C32e(0xf0a0a0ab), C32e(0x447878b4), C32e(0xba2525f0), C32e(0xe34b4b75), + C32e(0xf3a2a2ac), C32e(0xfe5d5d44), C32e(0xc08080db), C32e(0x8a050580), + C32e(0xad3f3fd3), C32e(0xbc2121fe), C32e(0x487070a8), C32e(0x04f1f1fd), + C32e(0xdf636319), C32e(0xc177772f), C32e(0x75afaf30), C32e(0x634242e7), + C32e(0x30202070), C32e(0x1ae5e5cb), C32e(0x0efdfdef), C32e(0x6dbfbf08), + C32e(0x4c818155), C32e(0x14181824), C32e(0x35262679), C32e(0x2fc3c3b2), + C32e(0xe1bebe86), C32e(0xa23535c8), C32e(0xcc8888c7), C32e(0x392e2e65), + C32e(0x5793936a), C32e(0xf2555558), C32e(0x82fcfc61), C32e(0x477a7ab3), + C32e(0xacc8c827), C32e(0xe7baba88), C32e(0x2b32324f), C32e(0x95e6e642), + C32e(0xa0c0c03b), C32e(0x981919aa), C32e(0xd19e9ef6), C32e(0x7fa3a322), + C32e(0x664444ee), C32e(0x7e5454d6), C32e(0xab3b3bdd), C32e(0x830b0b95), + C32e(0xca8c8cc9), C32e(0x29c7c7bc), C32e(0xd36b6b05), C32e(0x3c28286c), + C32e(0x79a7a72c), C32e(0xe2bcbc81), C32e(0x1d161631), C32e(0x76adad37), + C32e(0x3bdbdb96), C32e(0x5664649e), C32e(0x4e7474a6), C32e(0x1e141436), + C32e(0xdb9292e4), C32e(0x0a0c0c12), C32e(0x6c4848fc), C32e(0xe4b8b88f), + C32e(0x5d9f9f78), C32e(0x6ebdbd0f), C32e(0xef434369), C32e(0xa6c4c435), + C32e(0xa83939da), C32e(0xa43131c6), C32e(0x37d3d38a), C32e(0x8bf2f274), + C32e(0x32d5d583), C32e(0x438b8b4e), C32e(0x596e6e85), C32e(0xb7dada18), + C32e(0x8c01018e), C32e(0x64b1b11d), C32e(0xd29c9cf1), C32e(0xe0494972), + C32e(0xb4d8d81f), C32e(0xfaacacb9), C32e(0x07f3f3fa), C32e(0x25cfcfa0), + C32e(0xafcaca20), C32e(0x8ef4f47d), C32e(0xe9474767), C32e(0x18101038), + C32e(0xd56f6f0b), C32e(0x88f0f073), C32e(0x6f4a4afb), C32e(0x725c5cca), + C32e(0x24383854), C32e(0xf157575f), C32e(0xc7737321), C32e(0x51979764), + C32e(0x23cbcbae), C32e(0x7ca1a125), C32e(0x9ce8e857), C32e(0x213e3e5d), + C32e(0xdd9696ea), C32e(0xdc61611e), C32e(0x860d0d9c), C32e(0x850f0f9b), + C32e(0x90e0e04b), C32e(0x427c7cba), C32e(0xc4717126), C32e(0xaacccc29), + C32e(0xd89090e3), C32e(0x05060609), C32e(0x01f7f7f4), C32e(0x121c1c2a), + C32e(0xa3c2c23c), C32e(0x5f6a6a8b), C32e(0xf9aeaebe), C32e(0xd0696902), + C32e(0x911717bf), C32e(0x58999971), C32e(0x273a3a53), C32e(0xb92727f7), + C32e(0x38d9d991), C32e(0x13ebebde), C32e(0xb32b2be5), C32e(0x33222277), + C32e(0xbbd2d204), C32e(0x70a9a939), C32e(0x89070787), C32e(0xa73333c1), + C32e(0xb62d2dec), C32e(0x223c3c5a), C32e(0x921515b8), C32e(0x20c9c9a9), + C32e(0x4987875c), C32e(0xffaaaab0), C32e(0x785050d8), C32e(0x7aa5a52b), + C32e(0x8f030389), C32e(0xf859594a), C32e(0x80090992), C32e(0x171a1a23), + C32e(0xda656510), C32e(0x31d7d784), C32e(0xc68484d5), C32e(0xb8d0d003), + C32e(0xc38282dc), C32e(0xb02929e2), C32e(0x775a5ac3), C32e(0x111e1e2d), + C32e(0xcb7b7b3d), C32e(0xfca8a8b7), C32e(0xd66d6d0c), C32e(0x3a2c2c62) +}; + +static const sph_u32 T2dn[] = { + C32e(0xf4a5f497), C32e(0x978497eb), C32e(0xb099b0c7), C32e(0x8c8d8cf7), + C32e(0x170d17e5), C32e(0xdcbddcb7), C32e(0xc8b1c8a7), C32e(0xfc54fc39), + C32e(0xf050f0c0), C32e(0x05030504), C32e(0xe0a9e087), C32e(0x877d87ac), + C32e(0x2b192bd5), C32e(0xa662a671), C32e(0x31e6319a), C32e(0xb59ab5c3), + C32e(0xcf45cf05), C32e(0xbc9dbc3e), C32e(0xc040c009), C32e(0x928792ef), + C32e(0x3f153fc5), C32e(0x26eb267f), C32e(0x40c94007), C32e(0x1d0b1ded), + C32e(0x2fec2f82), C32e(0xa967a97d), C32e(0x1cfd1cbe), C32e(0x25ea258a), + C32e(0xdabfda46), C32e(0x02f702a6), C32e(0xa196a1d3), C32e(0xed5bed2d), + C32e(0x5dc25dea), C32e(0x241c24d9), C32e(0xe9aee97a), C32e(0xbe6abe98), + C32e(0xee5aeed8), C32e(0xc341c3fc), C32e(0x060206f1), C32e(0xd14fd11d), + C32e(0xe45ce4d0), C32e(0x07f407a2), C32e(0x5c345cb9), C32e(0x180818e9), + C32e(0xae93aedf), C32e(0x9573954d), C32e(0xf553f5c4), C32e(0x413f4154), + C32e(0x140c1410), C32e(0xf652f631), C32e(0xaf65af8c), C32e(0xe25ee221), + C32e(0x78287860), C32e(0xf8a1f86e), C32e(0x110f1114), C32e(0xc4b5c45e), + C32e(0x1b091b1c), C32e(0x5a365a48), C32e(0xb69bb636), C32e(0x473d47a5), + C32e(0x6a266a81), C32e(0xbb69bb9c), C32e(0x4ccd4cfe), C32e(0xba9fbacf), + C32e(0x2d1b2d24), C32e(0xb99eb93a), C32e(0x9c749cb0), C32e(0x722e7268), + C32e(0x772d776c), C32e(0xcdb2cda3), C32e(0x29ee2973), C32e(0x16fb16b6), + C32e(0x01f60153), C32e(0xd74dd7ec), C32e(0xa361a375), C32e(0x49ce49fa), + C32e(0x8d7b8da4), C32e(0x423e42a1), C32e(0x937193bc), C32e(0xa297a226), + C32e(0x04f50457), C32e(0xb868b869), C32e(0x00000000), C32e(0x742c7499), + C32e(0xa060a080), C32e(0x211f21dd), C32e(0x43c843f2), C32e(0x2ced2c77), + C32e(0xd9bed9b3), C32e(0xca46ca01), C32e(0x70d970ce), C32e(0xdd4bdde4), + C32e(0x79de7933), C32e(0x67d4672b), C32e(0x23e8237b), C32e(0xde4ade11), + C32e(0xbd6bbd6d), C32e(0x7e2a7e91), C32e(0x34e5349e), C32e(0x3a163ac1), + C32e(0x54c55417), C32e(0x62d7622f), C32e(0xff55ffcc), C32e(0xa794a722), + C32e(0x4acf4a0f), C32e(0x301030c9), C32e(0x0a060a08), C32e(0x988198e7), + C32e(0x0bf00b5b), C32e(0xcc44ccf0), C32e(0xd5bad54a), C32e(0x3ee33e96), + C32e(0x0ef30e5f), C32e(0x19fe19ba), C32e(0x5bc05b1b), C32e(0x858a850a), + C32e(0xecadec7e), C32e(0xdfbcdf42), C32e(0xd848d8e0), C32e(0x0c040cf9), + C32e(0x7adf7ac6), C32e(0x58c158ee), C32e(0x9f759f45), C32e(0xa563a584), + C32e(0x50305040), C32e(0x2e1a2ed1), C32e(0x120e12e1), C32e(0xb76db765), + C32e(0xd44cd419), C32e(0x3c143c30), C32e(0x5f355f4c), C32e(0x712f719d), + C32e(0x38e13867), C32e(0xfda2fd6a), C32e(0x4fcc4f0b), C32e(0x4b394b5c), + C32e(0xf957f93d), C32e(0x0df20daa), C32e(0x9d829de3), C32e(0xc947c9f4), + C32e(0xefacef8b), C32e(0x32e7326f), C32e(0x7d2b7d64), C32e(0xa495a4d7), + C32e(0xfba0fb9b), C32e(0xb398b332), C32e(0x68d16827), C32e(0x817f815d), + C32e(0xaa66aa88), C32e(0x827e82a8), C32e(0xe6abe676), C32e(0x9e839e16), + C32e(0x45ca4503), C32e(0x7b297b95), C32e(0x6ed36ed6), C32e(0x443c4450), + C32e(0x8b798b55), C32e(0x3de23d63), C32e(0x271d272c), C32e(0x9a769a41), + C32e(0x4d3b4dad), C32e(0xfa56fac8), C32e(0xd24ed2e8), C32e(0x221e2228), + C32e(0x76db763f), C32e(0x1e0a1e18), C32e(0xb46cb490), C32e(0x37e4376b), + C32e(0xe75de725), C32e(0xb26eb261), C32e(0x2aef2a86), C32e(0xf1a6f193), + C32e(0xe3a8e372), C32e(0xf7a4f762), C32e(0x593759bd), C32e(0x868b86ff), + C32e(0x563256b1), C32e(0xc543c50d), C32e(0xeb59ebdc), C32e(0xc2b7c2af), + C32e(0x8f8c8f02), C32e(0xac64ac79), C32e(0x6dd26d23), C32e(0x3be03b92), + C32e(0xc7b4c7ab), C32e(0x15fa1543), C32e(0x090709fd), C32e(0x6f256f85), + C32e(0xeaafea8f), C32e(0x898e89f3), C32e(0x20e9208e), C32e(0x28182820), + C32e(0x64d564de), C32e(0x838883fb), C32e(0xb16fb194), C32e(0x967296b8), + C32e(0x6c246c70), C32e(0x08f108ae), C32e(0x52c752e6), C32e(0xf351f335), + C32e(0x6523658d), C32e(0x847c8459), C32e(0xbf9cbfcb), C32e(0x6321637c), + C32e(0x7cdd7c37), C32e(0x7fdc7fc2), C32e(0x9186911a), C32e(0x9485941e), + C32e(0xab90abdb), C32e(0xc642c6f8), C32e(0x57c457e2), C32e(0xe5aae583), + C32e(0x73d8733b), C32e(0x0f050f0c), C32e(0x030103f5), C32e(0x36123638), + C32e(0xfea3fe9f), C32e(0xe15fe1d4), C32e(0x10f91047), C32e(0x6bd06bd2), + C32e(0xa891a82e), C32e(0xe858e829), C32e(0x69276974), C32e(0xd0b9d04e), + C32e(0x483848a9), C32e(0x351335cd), C32e(0xceb3ce56), C32e(0x55335544), + C32e(0xd6bbd6bf), C32e(0x90709049), C32e(0x8089800e), C32e(0xf2a7f266), + C32e(0xc1b6c15a), C32e(0x66226678), C32e(0xad92ad2a), C32e(0x60206089), + C32e(0xdb49db15), C32e(0x1aff1a4f), C32e(0x887888a0), C32e(0x8e7a8e51), + C32e(0x8a8f8a06), C32e(0x13f813b2), C32e(0x9b809b12), C32e(0x39173934), + C32e(0x75da75ca), C32e(0x533153b5), C32e(0x51c65113), C32e(0xd3b8d3bb), + C32e(0x5ec35e1f), C32e(0xcbb0cb52), C32e(0x997799b4), C32e(0x3311333c), + C32e(0x46cb46f6), C32e(0x1ffc1f4b), C32e(0x61d661da), C32e(0x4e3a4e58) +}; + +static const sph_u32 T3up[] = { + C32e(0x97a5c6c6), C32e(0xeb84f8f8), C32e(0xc799eeee), C32e(0xf78df6f6), + C32e(0xe50dffff), C32e(0xb7bdd6d6), C32e(0xa7b1dede), C32e(0x39549191), + C32e(0xc0506060), C32e(0x04030202), C32e(0x87a9cece), C32e(0xac7d5656), + C32e(0xd519e7e7), C32e(0x7162b5b5), C32e(0x9ae64d4d), C32e(0xc39aecec), + C32e(0x05458f8f), C32e(0x3e9d1f1f), C32e(0x09408989), C32e(0xef87fafa), + C32e(0xc515efef), C32e(0x7febb2b2), C32e(0x07c98e8e), C32e(0xed0bfbfb), + C32e(0x82ec4141), C32e(0x7d67b3b3), C32e(0xbefd5f5f), C32e(0x8aea4545), + C32e(0x46bf2323), C32e(0xa6f75353), C32e(0xd396e4e4), C32e(0x2d5b9b9b), + C32e(0xeac27575), C32e(0xd91ce1e1), C32e(0x7aae3d3d), C32e(0x986a4c4c), + C32e(0xd85a6c6c), C32e(0xfc417e7e), C32e(0xf102f5f5), C32e(0x1d4f8383), + C32e(0xd05c6868), C32e(0xa2f45151), C32e(0xb934d1d1), C32e(0xe908f9f9), + C32e(0xdf93e2e2), C32e(0x4d73abab), C32e(0xc4536262), C32e(0x543f2a2a), + C32e(0x100c0808), C32e(0x31529595), C32e(0x8c654646), C32e(0x215e9d9d), + C32e(0x60283030), C32e(0x6ea13737), C32e(0x140f0a0a), C32e(0x5eb52f2f), + C32e(0x1c090e0e), C32e(0x48362424), C32e(0x369b1b1b), C32e(0xa53ddfdf), + C32e(0x8126cdcd), C32e(0x9c694e4e), C32e(0xfecd7f7f), C32e(0xcf9feaea), + C32e(0x241b1212), C32e(0x3a9e1d1d), C32e(0xb0745858), C32e(0x682e3434), + C32e(0x6c2d3636), C32e(0xa3b2dcdc), C32e(0x73eeb4b4), C32e(0xb6fb5b5b), + C32e(0x53f6a4a4), C32e(0xec4d7676), C32e(0x7561b7b7), C32e(0xface7d7d), + C32e(0xa47b5252), C32e(0xa13edddd), C32e(0xbc715e5e), C32e(0x26971313), + C32e(0x57f5a6a6), C32e(0x6968b9b9), C32e(0x00000000), C32e(0x992cc1c1), + C32e(0x80604040), C32e(0xdd1fe3e3), C32e(0xf2c87979), C32e(0x77edb6b6), + C32e(0xb3bed4d4), C32e(0x01468d8d), C32e(0xced96767), C32e(0xe44b7272), + C32e(0x33de9494), C32e(0x2bd49898), C32e(0x7be8b0b0), C32e(0x114a8585), + C32e(0x6d6bbbbb), C32e(0x912ac5c5), C32e(0x9ee54f4f), C32e(0xc116eded), + C32e(0x17c58686), C32e(0x2fd79a9a), C32e(0xcc556666), C32e(0x22941111), + C32e(0x0fcf8a8a), C32e(0xc910e9e9), C32e(0x08060404), C32e(0xe781fefe), + C32e(0x5bf0a0a0), C32e(0xf0447878), C32e(0x4aba2525), C32e(0x96e34b4b), + C32e(0x5ff3a2a2), C32e(0xbafe5d5d), C32e(0x1bc08080), C32e(0x0a8a0505), + C32e(0x7ead3f3f), C32e(0x42bc2121), C32e(0xe0487070), C32e(0xf904f1f1), + C32e(0xc6df6363), C32e(0xeec17777), C32e(0x4575afaf), C32e(0x84634242), + C32e(0x40302020), C32e(0xd11ae5e5), C32e(0xe10efdfd), C32e(0x656dbfbf), + C32e(0x194c8181), C32e(0x30141818), C32e(0x4c352626), C32e(0x9d2fc3c3), + C32e(0x67e1bebe), C32e(0x6aa23535), C32e(0x0bcc8888), C32e(0x5c392e2e), + C32e(0x3d579393), C32e(0xaaf25555), C32e(0xe382fcfc), C32e(0xf4477a7a), + C32e(0x8bacc8c8), C32e(0x6fe7baba), C32e(0x642b3232), C32e(0xd795e6e6), + C32e(0x9ba0c0c0), C32e(0x32981919), C32e(0x27d19e9e), C32e(0x5d7fa3a3), + C32e(0x88664444), C32e(0xa87e5454), C32e(0x76ab3b3b), C32e(0x16830b0b), + C32e(0x03ca8c8c), C32e(0x9529c7c7), C32e(0xd6d36b6b), C32e(0x503c2828), + C32e(0x5579a7a7), C32e(0x63e2bcbc), C32e(0x2c1d1616), C32e(0x4176adad), + C32e(0xad3bdbdb), C32e(0xc8566464), C32e(0xe84e7474), C32e(0x281e1414), + C32e(0x3fdb9292), C32e(0x180a0c0c), C32e(0x906c4848), C32e(0x6be4b8b8), + C32e(0x255d9f9f), C32e(0x616ebdbd), C32e(0x86ef4343), C32e(0x93a6c4c4), + C32e(0x72a83939), C32e(0x62a43131), C32e(0xbd37d3d3), C32e(0xff8bf2f2), + C32e(0xb132d5d5), C32e(0x0d438b8b), C32e(0xdc596e6e), C32e(0xafb7dada), + C32e(0x028c0101), C32e(0x7964b1b1), C32e(0x23d29c9c), C32e(0x92e04949), + C32e(0xabb4d8d8), C32e(0x43faacac), C32e(0xfd07f3f3), C32e(0x8525cfcf), + C32e(0x8fafcaca), C32e(0xf38ef4f4), C32e(0x8ee94747), C32e(0x20181010), + C32e(0xded56f6f), C32e(0xfb88f0f0), C32e(0x946f4a4a), C32e(0xb8725c5c), + C32e(0x70243838), C32e(0xaef15757), C32e(0xe6c77373), C32e(0x35519797), + C32e(0x8d23cbcb), C32e(0x597ca1a1), C32e(0xcb9ce8e8), C32e(0x7c213e3e), + C32e(0x37dd9696), C32e(0xc2dc6161), C32e(0x1a860d0d), C32e(0x1e850f0f), + C32e(0xdb90e0e0), C32e(0xf8427c7c), C32e(0xe2c47171), C32e(0x83aacccc), + C32e(0x3bd89090), C32e(0x0c050606), C32e(0xf501f7f7), C32e(0x38121c1c), + C32e(0x9fa3c2c2), C32e(0xd45f6a6a), C32e(0x47f9aeae), C32e(0xd2d06969), + C32e(0x2e911717), C32e(0x29589999), C32e(0x74273a3a), C32e(0x4eb92727), + C32e(0xa938d9d9), C32e(0xcd13ebeb), C32e(0x56b32b2b), C32e(0x44332222), + C32e(0xbfbbd2d2), C32e(0x4970a9a9), C32e(0x0e890707), C32e(0x66a73333), + C32e(0x5ab62d2d), C32e(0x78223c3c), C32e(0x2a921515), C32e(0x8920c9c9), + C32e(0x15498787), C32e(0x4fffaaaa), C32e(0xa0785050), C32e(0x517aa5a5), + C32e(0x068f0303), C32e(0xb2f85959), C32e(0x12800909), C32e(0x34171a1a), + C32e(0xcada6565), C32e(0xb531d7d7), C32e(0x13c68484), C32e(0xbbb8d0d0), + C32e(0x1fc38282), C32e(0x52b02929), C32e(0xb4775a5a), C32e(0x3c111e1e), + C32e(0xf6cb7b7b), C32e(0x4bfca8a8), C32e(0xdad66d6d), C32e(0x583a2c2c) +}; + +static const sph_u32 T3dn[] = { + C32e(0x32f4a5f4), C32e(0x6f978497), C32e(0x5eb099b0), C32e(0x7a8c8d8c), + C32e(0xe8170d17), C32e(0x0adcbddc), C32e(0x16c8b1c8), C32e(0x6dfc54fc), + C32e(0x90f050f0), C32e(0x07050305), C32e(0x2ee0a9e0), C32e(0xd1877d87), + C32e(0xcc2b192b), C32e(0x13a662a6), C32e(0x7c31e631), C32e(0x59b59ab5), + C32e(0x40cf45cf), C32e(0xa3bc9dbc), C32e(0x49c040c0), C32e(0x68928792), + C32e(0xd03f153f), C32e(0x9426eb26), C32e(0xce40c940), C32e(0xe61d0b1d), + C32e(0x6e2fec2f), C32e(0x1aa967a9), C32e(0x431cfd1c), C32e(0x6025ea25), + C32e(0xf9dabfda), C32e(0x5102f702), C32e(0x45a196a1), C32e(0x76ed5bed), + C32e(0x285dc25d), C32e(0xc5241c24), C32e(0xd4e9aee9), C32e(0xf2be6abe), + C32e(0x82ee5aee), C32e(0xbdc341c3), C32e(0xf3060206), C32e(0x52d14fd1), + C32e(0x8ce45ce4), C32e(0x5607f407), C32e(0x8d5c345c), C32e(0xe1180818), + C32e(0x4cae93ae), C32e(0x3e957395), C32e(0x97f553f5), C32e(0x6b413f41), + C32e(0x1c140c14), C32e(0x63f652f6), C32e(0xe9af65af), C32e(0x7fe25ee2), + C32e(0x48782878), C32e(0xcff8a1f8), C32e(0x1b110f11), C32e(0xebc4b5c4), + C32e(0x151b091b), C32e(0x7e5a365a), C32e(0xadb69bb6), C32e(0x98473d47), + C32e(0xa76a266a), C32e(0xf5bb69bb), C32e(0x334ccd4c), C32e(0x50ba9fba), + C32e(0x3f2d1b2d), C32e(0xa4b99eb9), C32e(0xc49c749c), C32e(0x46722e72), + C32e(0x41772d77), C32e(0x11cdb2cd), C32e(0x9d29ee29), C32e(0x4d16fb16), + C32e(0xa501f601), C32e(0xa1d74dd7), C32e(0x14a361a3), C32e(0x3449ce49), + C32e(0xdf8d7b8d), C32e(0x9f423e42), C32e(0xcd937193), C32e(0xb1a297a2), + C32e(0xa204f504), C32e(0x01b868b8), C32e(0x00000000), C32e(0xb5742c74), + C32e(0xe0a060a0), C32e(0xc2211f21), C32e(0x3a43c843), C32e(0x9a2ced2c), + C32e(0x0dd9bed9), C32e(0x47ca46ca), C32e(0x1770d970), C32e(0xafdd4bdd), + C32e(0xed79de79), C32e(0xff67d467), C32e(0x9323e823), C32e(0x5bde4ade), + C32e(0x06bd6bbd), C32e(0xbb7e2a7e), C32e(0x7b34e534), C32e(0xd73a163a), + C32e(0xd254c554), C32e(0xf862d762), C32e(0x99ff55ff), C32e(0xb6a794a7), + C32e(0xc04acf4a), C32e(0xd9301030), C32e(0x0e0a060a), C32e(0x66988198), + C32e(0xab0bf00b), C32e(0xb4cc44cc), C32e(0xf0d5bad5), C32e(0x753ee33e), + C32e(0xac0ef30e), C32e(0x4419fe19), C32e(0xdb5bc05b), C32e(0x80858a85), + C32e(0xd3ecadec), C32e(0xfedfbcdf), C32e(0xa8d848d8), C32e(0xfd0c040c), + C32e(0x197adf7a), C32e(0x2f58c158), C32e(0x309f759f), C32e(0xe7a563a5), + C32e(0x70503050), C32e(0xcb2e1a2e), C32e(0xef120e12), C32e(0x08b76db7), + C32e(0x55d44cd4), C32e(0x243c143c), C32e(0x795f355f), C32e(0xb2712f71), + C32e(0x8638e138), C32e(0xc8fda2fd), C32e(0xc74fcc4f), C32e(0x654b394b), + C32e(0x6af957f9), C32e(0x580df20d), C32e(0x619d829d), C32e(0xb3c947c9), + C32e(0x27efacef), C32e(0x8832e732), C32e(0x4f7d2b7d), C32e(0x42a495a4), + C32e(0x3bfba0fb), C32e(0xaab398b3), C32e(0xf668d168), C32e(0x22817f81), + C32e(0xeeaa66aa), C32e(0xd6827e82), C32e(0xdde6abe6), C32e(0x959e839e), + C32e(0xc945ca45), C32e(0xbc7b297b), C32e(0x056ed36e), C32e(0x6c443c44), + C32e(0x2c8b798b), C32e(0x813de23d), C32e(0x31271d27), C32e(0x379a769a), + C32e(0x964d3b4d), C32e(0x9efa56fa), C32e(0xa6d24ed2), C32e(0x36221e22), + C32e(0xe476db76), C32e(0x121e0a1e), C32e(0xfcb46cb4), C32e(0x8f37e437), + C32e(0x78e75de7), C32e(0x0fb26eb2), C32e(0x692aef2a), C32e(0x35f1a6f1), + C32e(0xdae3a8e3), C32e(0xc6f7a4f7), C32e(0x8a593759), C32e(0x74868b86), + C32e(0x83563256), C32e(0x4ec543c5), C32e(0x85eb59eb), C32e(0x18c2b7c2), + C32e(0x8e8f8c8f), C32e(0x1dac64ac), C32e(0xf16dd26d), C32e(0x723be03b), + C32e(0x1fc7b4c7), C32e(0xb915fa15), C32e(0xfa090709), C32e(0xa06f256f), + C32e(0x20eaafea), C32e(0x7d898e89), C32e(0x6720e920), C32e(0x38281828), + C32e(0x0b64d564), C32e(0x73838883), C32e(0xfbb16fb1), C32e(0xca967296), + C32e(0x546c246c), C32e(0x5f08f108), C32e(0x2152c752), C32e(0x64f351f3), + C32e(0xae652365), C32e(0x25847c84), C32e(0x57bf9cbf), C32e(0x5d632163), + C32e(0xea7cdd7c), C32e(0x1e7fdc7f), C32e(0x9c918691), C32e(0x9b948594), + C32e(0x4bab90ab), C32e(0xbac642c6), C32e(0x2657c457), C32e(0x29e5aae5), + C32e(0xe373d873), C32e(0x090f050f), C32e(0xf4030103), C32e(0x2a361236), + C32e(0x3cfea3fe), C32e(0x8be15fe1), C32e(0xbe10f910), C32e(0x026bd06b), + C32e(0xbfa891a8), C32e(0x71e858e8), C32e(0x53692769), C32e(0xf7d0b9d0), + C32e(0x91483848), C32e(0xde351335), C32e(0xe5ceb3ce), C32e(0x77553355), + C32e(0x04d6bbd6), C32e(0x39907090), C32e(0x87808980), C32e(0xc1f2a7f2), + C32e(0xecc1b6c1), C32e(0x5a662266), C32e(0xb8ad92ad), C32e(0xa9602060), + C32e(0x5cdb49db), C32e(0xb01aff1a), C32e(0xd8887888), C32e(0x2b8e7a8e), + C32e(0x898a8f8a), C32e(0x4a13f813), C32e(0x929b809b), C32e(0x23391739), + C32e(0x1075da75), C32e(0x84533153), C32e(0xd551c651), C32e(0x03d3b8d3), + C32e(0xdc5ec35e), C32e(0xe2cbb0cb), C32e(0xc3997799), C32e(0x2d331133), + C32e(0x3d46cb46), C32e(0xb71ffc1f), C32e(0x0c61d661), C32e(0x624e3a4e) +}; + +#define DECL_STATE_SMALL \ + sph_u32 H[16]; + +#define READ_STATE_SMALL(sc) do { \ + memcpy(H, (sc)->state.narrow, sizeof H); \ + } while (0) + +#define WRITE_STATE_SMALL(sc) do { \ + memcpy((sc)->state.narrow, H, sizeof H); \ + } while (0) + +#define XCAT(x, y) XCAT_(x, y) +#define XCAT_(x, y) x ## y + +#define RSTT(d0, d1, a, b0, b1, b2, b3, b4, b5, b6, b7) do { \ + t[d0] = T0up[B32_0(a[b0])] \ + ^ T1up[B32_1(a[b1])] \ + ^ T2up[B32_2(a[b2])] \ + ^ T3up[B32_3(a[b3])] \ + ^ T0dn[B32_0(a[b4])] \ + ^ T1dn[B32_1(a[b5])] \ + ^ T2dn[B32_2(a[b6])] \ + ^ T3dn[B32_3(a[b7])]; \ + t[d1] = T0dn[B32_0(a[b0])] \ + ^ T1dn[B32_1(a[b1])] \ + ^ T2dn[B32_2(a[b2])] \ + ^ T3dn[B32_3(a[b3])] \ + ^ T0up[B32_0(a[b4])] \ + ^ T1up[B32_1(a[b5])] \ + ^ T2up[B32_2(a[b6])] \ + ^ T3up[B32_3(a[b7])]; \ + } while (0) + +#define ROUND_SMALL_P(a, r) do { \ + sph_u32 t[16]; \ + a[0x0] ^= PC32up(0x00, r); \ + a[0x1] ^= PC32dn(0x00, r); \ + a[0x2] ^= PC32up(0x10, r); \ + a[0x3] ^= PC32dn(0x10, r); \ + a[0x4] ^= PC32up(0x20, r); \ + a[0x5] ^= PC32dn(0x20, r); \ + a[0x6] ^= PC32up(0x30, r); \ + a[0x7] ^= PC32dn(0x30, r); \ + a[0x8] ^= PC32up(0x40, r); \ + a[0x9] ^= PC32dn(0x40, r); \ + a[0xA] ^= PC32up(0x50, r); \ + a[0xB] ^= PC32dn(0x50, r); \ + a[0xC] ^= PC32up(0x60, r); \ + a[0xD] ^= PC32dn(0x60, r); \ + a[0xE] ^= PC32up(0x70, r); \ + a[0xF] ^= PC32dn(0x70, r); \ + RSTT(0x0, 0x1, a, 0x0, 0x2, 0x4, 0x6, 0x9, 0xB, 0xD, 0xF); \ + RSTT(0x2, 0x3, a, 0x2, 0x4, 0x6, 0x8, 0xB, 0xD, 0xF, 0x1); \ + RSTT(0x4, 0x5, a, 0x4, 0x6, 0x8, 0xA, 0xD, 0xF, 0x1, 0x3); \ + RSTT(0x6, 0x7, a, 0x6, 0x8, 0xA, 0xC, 0xF, 0x1, 0x3, 0x5); \ + RSTT(0x8, 0x9, a, 0x8, 0xA, 0xC, 0xE, 0x1, 0x3, 0x5, 0x7); \ + RSTT(0xA, 0xB, a, 0xA, 0xC, 0xE, 0x0, 0x3, 0x5, 0x7, 0x9); \ + RSTT(0xC, 0xD, a, 0xC, 0xE, 0x0, 0x2, 0x5, 0x7, 0x9, 0xB); \ + RSTT(0xE, 0xF, a, 0xE, 0x0, 0x2, 0x4, 0x7, 0x9, 0xB, 0xD); \ + memcpy(a, t, sizeof t); \ + } while (0) + +#define ROUND_SMALL_Q(a, r) do { \ + sph_u32 t[16]; \ + a[0x0] ^= QC32up(0x00, r); \ + a[0x1] ^= QC32dn(0x00, r); \ + a[0x2] ^= QC32up(0x10, r); \ + a[0x3] ^= QC32dn(0x10, r); \ + a[0x4] ^= QC32up(0x20, r); \ + a[0x5] ^= QC32dn(0x20, r); \ + a[0x6] ^= QC32up(0x30, r); \ + a[0x7] ^= QC32dn(0x30, r); \ + a[0x8] ^= QC32up(0x40, r); \ + a[0x9] ^= QC32dn(0x40, r); \ + a[0xA] ^= QC32up(0x50, r); \ + a[0xB] ^= QC32dn(0x50, r); \ + a[0xC] ^= QC32up(0x60, r); \ + a[0xD] ^= QC32dn(0x60, r); \ + a[0xE] ^= QC32up(0x70, r); \ + a[0xF] ^= QC32dn(0x70, r); \ + RSTT(0x0, 0x1, a, 0x2, 0x6, 0xA, 0xE, 0x1, 0x5, 0x9, 0xD); \ + RSTT(0x2, 0x3, a, 0x4, 0x8, 0xC, 0x0, 0x3, 0x7, 0xB, 0xF); \ + RSTT(0x4, 0x5, a, 0x6, 0xA, 0xE, 0x2, 0x5, 0x9, 0xD, 0x1); \ + RSTT(0x6, 0x7, a, 0x8, 0xC, 0x0, 0x4, 0x7, 0xB, 0xF, 0x3); \ + RSTT(0x8, 0x9, a, 0xA, 0xE, 0x2, 0x6, 0x9, 0xD, 0x1, 0x5); \ + RSTT(0xA, 0xB, a, 0xC, 0x0, 0x4, 0x8, 0xB, 0xF, 0x3, 0x7); \ + RSTT(0xC, 0xD, a, 0xE, 0x2, 0x6, 0xA, 0xD, 0x1, 0x5, 0x9); \ + RSTT(0xE, 0xF, a, 0x0, 0x4, 0x8, 0xC, 0xF, 0x3, 0x7, 0xB); \ + memcpy(a, t, sizeof t); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define PERM_SMALL_P(a) do { \ + int r; \ + for (r = 0; r < 10; r ++) \ + ROUND_SMALL_P(a, r); \ + } while (0) + +#define PERM_SMALL_Q(a) do { \ + int r; \ + for (r = 0; r < 10; r ++) \ + ROUND_SMALL_Q(a, r); \ + } while (0) + +#else + +#define PERM_SMALL_P(a) do { \ + int r; \ + for (r = 0; r < 10; r += 2) { \ + ROUND_SMALL_P(a, r + 0); \ + ROUND_SMALL_P(a, r + 1); \ + } \ + } while (0) + +#define PERM_SMALL_Q(a) do { \ + int r; \ + for (r = 0; r < 10; r += 2) { \ + ROUND_SMALL_Q(a, r + 0); \ + ROUND_SMALL_Q(a, r + 1); \ + } \ + } while (0) + +#endif + +#define COMPRESS_SMALL do { \ + sph_u32 g[16], m[16]; \ + size_t u; \ + for (u = 0; u < 16; u ++) { \ + m[u] = dec32e_aligned(buf + (u << 2)); \ + g[u] = m[u] ^ H[u]; \ + } \ + PERM_SMALL_P(g); \ + PERM_SMALL_Q(m); \ + for (u = 0; u < 16; u ++) \ + H[u] ^= g[u] ^ m[u]; \ + } while (0) + +#define FINAL_SMALL do { \ + sph_u32 x[16]; \ + size_t u; \ + memcpy(x, H, sizeof x); \ + PERM_SMALL_P(x); \ + for (u = 0; u < 16; u ++) \ + H[u] ^= x[u]; \ + } while (0) + +#define DECL_STATE_BIG \ + sph_u32 H[32]; + +#define READ_STATE_BIG(sc) do { \ + memcpy(H, (sc)->state.narrow, sizeof H); \ + } while (0) + +#define WRITE_STATE_BIG(sc) do { \ + memcpy((sc)->state.narrow, H, sizeof H); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define RBTT(d0, d1, a, b0, b1, b2, b3, b4, b5, b6, b7) do { \ + sph_u32 fu2 = T0up[B32_2(a[b2])]; \ + sph_u32 fd2 = T0dn[B32_2(a[b2])]; \ + sph_u32 fu3 = T1up[B32_3(a[b3])]; \ + sph_u32 fd3 = T1dn[B32_3(a[b3])]; \ + sph_u32 fu6 = T0up[B32_2(a[b6])]; \ + sph_u32 fd6 = T0dn[B32_2(a[b6])]; \ + sph_u32 fu7 = T1up[B32_3(a[b7])]; \ + sph_u32 fd7 = T1dn[B32_3(a[b7])]; \ + t[d0] = T0up[B32_0(a[b0])] \ + ^ T1up[B32_1(a[b1])] \ + ^ R32u(fu2, fd2) \ + ^ R32u(fu3, fd3) \ + ^ T0dn[B32_0(a[b4])] \ + ^ T1dn[B32_1(a[b5])] \ + ^ R32d(fu6, fd6) \ + ^ R32d(fu7, fd7); \ + t[d1] = T0dn[B32_0(a[b0])] \ + ^ T1dn[B32_1(a[b1])] \ + ^ R32d(fu2, fd2) \ + ^ R32d(fu3, fd3) \ + ^ T0up[B32_0(a[b4])] \ + ^ T1up[B32_1(a[b5])] \ + ^ R32u(fu6, fd6) \ + ^ R32u(fu7, fd7); \ + } while (0) + +#else + +#define RBTT(d0, d1, a, b0, b1, b2, b3, b4, b5, b6, b7) do { \ + t[d0] = T0up[B32_0(a[b0])] \ + ^ T1up[B32_1(a[b1])] \ + ^ T2up[B32_2(a[b2])] \ + ^ T3up[B32_3(a[b3])] \ + ^ T0dn[B32_0(a[b4])] \ + ^ T1dn[B32_1(a[b5])] \ + ^ T2dn[B32_2(a[b6])] \ + ^ T3dn[B32_3(a[b7])]; \ + t[d1] = T0dn[B32_0(a[b0])] \ + ^ T1dn[B32_1(a[b1])] \ + ^ T2dn[B32_2(a[b2])] \ + ^ T3dn[B32_3(a[b3])] \ + ^ T0up[B32_0(a[b4])] \ + ^ T1up[B32_1(a[b5])] \ + ^ T2up[B32_2(a[b6])] \ + ^ T3up[B32_3(a[b7])]; \ + } while (0) + +#endif + +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define ROUND_BIG_P(a, r) do { \ + sph_u32 t[32]; \ + size_t u; \ + a[0x00] ^= PC32up(0x00, r); \ + a[0x01] ^= PC32dn(0x00, r); \ + a[0x02] ^= PC32up(0x10, r); \ + a[0x03] ^= PC32dn(0x10, r); \ + a[0x04] ^= PC32up(0x20, r); \ + a[0x05] ^= PC32dn(0x20, r); \ + a[0x06] ^= PC32up(0x30, r); \ + a[0x07] ^= PC32dn(0x30, r); \ + a[0x08] ^= PC32up(0x40, r); \ + a[0x09] ^= PC32dn(0x40, r); \ + a[0x0A] ^= PC32up(0x50, r); \ + a[0x0B] ^= PC32dn(0x50, r); \ + a[0x0C] ^= PC32up(0x60, r); \ + a[0x0D] ^= PC32dn(0x60, r); \ + a[0x0E] ^= PC32up(0x70, r); \ + a[0x0F] ^= PC32dn(0x70, r); \ + a[0x10] ^= PC32up(0x80, r); \ + a[0x11] ^= PC32dn(0x80, r); \ + a[0x12] ^= PC32up(0x90, r); \ + a[0x13] ^= PC32dn(0x90, r); \ + a[0x14] ^= PC32up(0xA0, r); \ + a[0x15] ^= PC32dn(0xA0, r); \ + a[0x16] ^= PC32up(0xB0, r); \ + a[0x17] ^= PC32dn(0xB0, r); \ + a[0x18] ^= PC32up(0xC0, r); \ + a[0x19] ^= PC32dn(0xC0, r); \ + a[0x1A] ^= PC32up(0xD0, r); \ + a[0x1B] ^= PC32dn(0xD0, r); \ + a[0x1C] ^= PC32up(0xE0, r); \ + a[0x1D] ^= PC32dn(0xE0, r); \ + a[0x1E] ^= PC32up(0xF0, r); \ + a[0x1F] ^= PC32dn(0xF0, r); \ + for (u = 0; u < 32; u += 8) { \ + RBTT(u + 0x00, (u + 0x01) & 0x1F, a, \ + u + 0x00, (u + 0x02) & 0x1F, \ + (u + 0x04) & 0x1F, (u + 0x06) & 0x1F, \ + (u + 0x09) & 0x1F, (u + 0x0B) & 0x1F, \ + (u + 0x0D) & 0x1F, (u + 0x17) & 0x1F); \ + RBTT(u + 0x02, (u + 0x03) & 0x1F, a, \ + u + 0x02, (u + 0x04) & 0x1F, \ + (u + 0x06) & 0x1F, (u + 0x08) & 0x1F, \ + (u + 0x0B) & 0x1F, (u + 0x0D) & 0x1F, \ + (u + 0x0F) & 0x1F, (u + 0x19) & 0x1F); \ + RBTT(u + 0x04, (u + 0x05) & 0x1F, a, \ + u + 0x04, (u + 0x06) & 0x1F, \ + (u + 0x08) & 0x1F, (u + 0x0A) & 0x1F, \ + (u + 0x0D) & 0x1F, (u + 0x0F) & 0x1F, \ + (u + 0x11) & 0x1F, (u + 0x1B) & 0x1F); \ + RBTT(u + 0x06, (u + 0x07) & 0x1F, a, \ + u + 0x06, (u + 0x08) & 0x1F, \ + (u + 0x0A) & 0x1F, (u + 0x0C) & 0x1F, \ + (u + 0x0F) & 0x1F, (u + 0x11) & 0x1F, \ + (u + 0x13) & 0x1F, (u + 0x1D) & 0x1F); \ + } \ + memcpy(a, t, sizeof t); \ + } while (0) + +#define ROUND_BIG_Q(a, r) do { \ + sph_u32 t[32]; \ + size_t u; \ + a[0x00] ^= QC32up(0x00, r); \ + a[0x01] ^= QC32dn(0x00, r); \ + a[0x02] ^= QC32up(0x10, r); \ + a[0x03] ^= QC32dn(0x10, r); \ + a[0x04] ^= QC32up(0x20, r); \ + a[0x05] ^= QC32dn(0x20, r); \ + a[0x06] ^= QC32up(0x30, r); \ + a[0x07] ^= QC32dn(0x30, r); \ + a[0x08] ^= QC32up(0x40, r); \ + a[0x09] ^= QC32dn(0x40, r); \ + a[0x0A] ^= QC32up(0x50, r); \ + a[0x0B] ^= QC32dn(0x50, r); \ + a[0x0C] ^= QC32up(0x60, r); \ + a[0x0D] ^= QC32dn(0x60, r); \ + a[0x0E] ^= QC32up(0x70, r); \ + a[0x0F] ^= QC32dn(0x70, r); \ + a[0x10] ^= QC32up(0x80, r); \ + a[0x11] ^= QC32dn(0x80, r); \ + a[0x12] ^= QC32up(0x90, r); \ + a[0x13] ^= QC32dn(0x90, r); \ + a[0x14] ^= QC32up(0xA0, r); \ + a[0x15] ^= QC32dn(0xA0, r); \ + a[0x16] ^= QC32up(0xB0, r); \ + a[0x17] ^= QC32dn(0xB0, r); \ + a[0x18] ^= QC32up(0xC0, r); \ + a[0x19] ^= QC32dn(0xC0, r); \ + a[0x1A] ^= QC32up(0xD0, r); \ + a[0x1B] ^= QC32dn(0xD0, r); \ + a[0x1C] ^= QC32up(0xE0, r); \ + a[0x1D] ^= QC32dn(0xE0, r); \ + a[0x1E] ^= QC32up(0xF0, r); \ + a[0x1F] ^= QC32dn(0xF0, r); \ + for (u = 0; u < 32; u += 8) { \ + RBTT(u + 0x00, (u + 0x01) & 0x1F, a, \ + (u + 0x02) & 0x1F, (u + 0x06) & 0x1F, \ + (u + 0x0A) & 0x1F, (u + 0x16) & 0x1F, \ + (u + 0x01) & 0x1F, (u + 0x05) & 0x1F, \ + (u + 0x09) & 0x1F, (u + 0x0D) & 0x1F); \ + RBTT(u + 0x02, (u + 0x03) & 0x1F, a, \ + (u + 0x04) & 0x1F, (u + 0x08) & 0x1F, \ + (u + 0x0C) & 0x1F, (u + 0x18) & 0x1F, \ + (u + 0x03) & 0x1F, (u + 0x07) & 0x1F, \ + (u + 0x0B) & 0x1F, (u + 0x0F) & 0x1F); \ + RBTT(u + 0x04, (u + 0x05) & 0x1F, a, \ + (u + 0x06) & 0x1F, (u + 0x0A) & 0x1F, \ + (u + 0x0E) & 0x1F, (u + 0x1A) & 0x1F, \ + (u + 0x05) & 0x1F, (u + 0x09) & 0x1F, \ + (u + 0x0D) & 0x1F, (u + 0x11) & 0x1F); \ + RBTT(u + 0x06, (u + 0x07) & 0x1F, a, \ + (u + 0x08) & 0x1F, (u + 0x0C) & 0x1F, \ + (u + 0x10) & 0x1F, (u + 0x1C) & 0x1F, \ + (u + 0x07) & 0x1F, (u + 0x0B) & 0x1F, \ + (u + 0x0F) & 0x1F, (u + 0x13) & 0x1F); \ + } \ + memcpy(a, t, sizeof t); \ + } while (0) + +#else + +#define ROUND_BIG_P(a, r) do { \ + sph_u32 t[32]; \ + a[0x00] ^= PC32up(0x00, r); \ + a[0x01] ^= PC32dn(0x00, r); \ + a[0x02] ^= PC32up(0x10, r); \ + a[0x03] ^= PC32dn(0x10, r); \ + a[0x04] ^= PC32up(0x20, r); \ + a[0x05] ^= PC32dn(0x20, r); \ + a[0x06] ^= PC32up(0x30, r); \ + a[0x07] ^= PC32dn(0x30, r); \ + a[0x08] ^= PC32up(0x40, r); \ + a[0x09] ^= PC32dn(0x40, r); \ + a[0x0A] ^= PC32up(0x50, r); \ + a[0x0B] ^= PC32dn(0x50, r); \ + a[0x0C] ^= PC32up(0x60, r); \ + a[0x0D] ^= PC32dn(0x60, r); \ + a[0x0E] ^= PC32up(0x70, r); \ + a[0x0F] ^= PC32dn(0x70, r); \ + a[0x10] ^= PC32up(0x80, r); \ + a[0x11] ^= PC32dn(0x80, r); \ + a[0x12] ^= PC32up(0x90, r); \ + a[0x13] ^= PC32dn(0x90, r); \ + a[0x14] ^= PC32up(0xA0, r); \ + a[0x15] ^= PC32dn(0xA0, r); \ + a[0x16] ^= PC32up(0xB0, r); \ + a[0x17] ^= PC32dn(0xB0, r); \ + a[0x18] ^= PC32up(0xC0, r); \ + a[0x19] ^= PC32dn(0xC0, r); \ + a[0x1A] ^= PC32up(0xD0, r); \ + a[0x1B] ^= PC32dn(0xD0, r); \ + a[0x1C] ^= PC32up(0xE0, r); \ + a[0x1D] ^= PC32dn(0xE0, r); \ + a[0x1E] ^= PC32up(0xF0, r); \ + a[0x1F] ^= PC32dn(0xF0, r); \ + RBTT(0x00, 0x01, a, \ + 0x00, 0x02, 0x04, 0x06, 0x09, 0x0B, 0x0D, 0x17); \ + RBTT(0x02, 0x03, a, \ + 0x02, 0x04, 0x06, 0x08, 0x0B, 0x0D, 0x0F, 0x19); \ + RBTT(0x04, 0x05, a, \ + 0x04, 0x06, 0x08, 0x0A, 0x0D, 0x0F, 0x11, 0x1B); \ + RBTT(0x06, 0x07, a, \ + 0x06, 0x08, 0x0A, 0x0C, 0x0F, 0x11, 0x13, 0x1D); \ + RBTT(0x08, 0x09, a, \ + 0x08, 0x0A, 0x0C, 0x0E, 0x11, 0x13, 0x15, 0x1F); \ + RBTT(0x0A, 0x0B, a, \ + 0x0A, 0x0C, 0x0E, 0x10, 0x13, 0x15, 0x17, 0x01); \ + RBTT(0x0C, 0x0D, a, \ + 0x0C, 0x0E, 0x10, 0x12, 0x15, 0x17, 0x19, 0x03); \ + RBTT(0x0E, 0x0F, a, \ + 0x0E, 0x10, 0x12, 0x14, 0x17, 0x19, 0x1B, 0x05); \ + RBTT(0x10, 0x11, a, \ + 0x10, 0x12, 0x14, 0x16, 0x19, 0x1B, 0x1D, 0x07); \ + RBTT(0x12, 0x13, a, \ + 0x12, 0x14, 0x16, 0x18, 0x1B, 0x1D, 0x1F, 0x09); \ + RBTT(0x14, 0x15, a, \ + 0x14, 0x16, 0x18, 0x1A, 0x1D, 0x1F, 0x01, 0x0B); \ + RBTT(0x16, 0x17, a, \ + 0x16, 0x18, 0x1A, 0x1C, 0x1F, 0x01, 0x03, 0x0D); \ + RBTT(0x18, 0x19, a, \ + 0x18, 0x1A, 0x1C, 0x1E, 0x01, 0x03, 0x05, 0x0F); \ + RBTT(0x1A, 0x1B, a, \ + 0x1A, 0x1C, 0x1E, 0x00, 0x03, 0x05, 0x07, 0x11); \ + RBTT(0x1C, 0x1D, a, \ + 0x1C, 0x1E, 0x00, 0x02, 0x05, 0x07, 0x09, 0x13); \ + RBTT(0x1E, 0x1F, a, \ + 0x1E, 0x00, 0x02, 0x04, 0x07, 0x09, 0x0B, 0x15); \ + memcpy(a, t, sizeof t); \ + } while (0) + +#define ROUND_BIG_Q(a, r) do { \ + sph_u32 t[32]; \ + a[0x00] ^= QC32up(0x00, r); \ + a[0x01] ^= QC32dn(0x00, r); \ + a[0x02] ^= QC32up(0x10, r); \ + a[0x03] ^= QC32dn(0x10, r); \ + a[0x04] ^= QC32up(0x20, r); \ + a[0x05] ^= QC32dn(0x20, r); \ + a[0x06] ^= QC32up(0x30, r); \ + a[0x07] ^= QC32dn(0x30, r); \ + a[0x08] ^= QC32up(0x40, r); \ + a[0x09] ^= QC32dn(0x40, r); \ + a[0x0A] ^= QC32up(0x50, r); \ + a[0x0B] ^= QC32dn(0x50, r); \ + a[0x0C] ^= QC32up(0x60, r); \ + a[0x0D] ^= QC32dn(0x60, r); \ + a[0x0E] ^= QC32up(0x70, r); \ + a[0x0F] ^= QC32dn(0x70, r); \ + a[0x10] ^= QC32up(0x80, r); \ + a[0x11] ^= QC32dn(0x80, r); \ + a[0x12] ^= QC32up(0x90, r); \ + a[0x13] ^= QC32dn(0x90, r); \ + a[0x14] ^= QC32up(0xA0, r); \ + a[0x15] ^= QC32dn(0xA0, r); \ + a[0x16] ^= QC32up(0xB0, r); \ + a[0x17] ^= QC32dn(0xB0, r); \ + a[0x18] ^= QC32up(0xC0, r); \ + a[0x19] ^= QC32dn(0xC0, r); \ + a[0x1A] ^= QC32up(0xD0, r); \ + a[0x1B] ^= QC32dn(0xD0, r); \ + a[0x1C] ^= QC32up(0xE0, r); \ + a[0x1D] ^= QC32dn(0xE0, r); \ + a[0x1E] ^= QC32up(0xF0, r); \ + a[0x1F] ^= QC32dn(0xF0, r); \ + RBTT(0x00, 0x01, a, \ + 0x02, 0x06, 0x0A, 0x16, 0x01, 0x05, 0x09, 0x0D); \ + RBTT(0x02, 0x03, a, \ + 0x04, 0x08, 0x0C, 0x18, 0x03, 0x07, 0x0B, 0x0F); \ + RBTT(0x04, 0x05, a, \ + 0x06, 0x0A, 0x0E, 0x1A, 0x05, 0x09, 0x0D, 0x11); \ + RBTT(0x06, 0x07, a, \ + 0x08, 0x0C, 0x10, 0x1C, 0x07, 0x0B, 0x0F, 0x13); \ + RBTT(0x08, 0x09, a, \ + 0x0A, 0x0E, 0x12, 0x1E, 0x09, 0x0D, 0x11, 0x15); \ + RBTT(0x0A, 0x0B, a, \ + 0x0C, 0x10, 0x14, 0x00, 0x0B, 0x0F, 0x13, 0x17); \ + RBTT(0x0C, 0x0D, a, \ + 0x0E, 0x12, 0x16, 0x02, 0x0D, 0x11, 0x15, 0x19); \ + RBTT(0x0E, 0x0F, a, \ + 0x10, 0x14, 0x18, 0x04, 0x0F, 0x13, 0x17, 0x1B); \ + RBTT(0x10, 0x11, a, \ + 0x12, 0x16, 0x1A, 0x06, 0x11, 0x15, 0x19, 0x1D); \ + RBTT(0x12, 0x13, a, \ + 0x14, 0x18, 0x1C, 0x08, 0x13, 0x17, 0x1B, 0x1F); \ + RBTT(0x14, 0x15, a, \ + 0x16, 0x1A, 0x1E, 0x0A, 0x15, 0x19, 0x1D, 0x01); \ + RBTT(0x16, 0x17, a, \ + 0x18, 0x1C, 0x00, 0x0C, 0x17, 0x1B, 0x1F, 0x03); \ + RBTT(0x18, 0x19, a, \ + 0x1A, 0x1E, 0x02, 0x0E, 0x19, 0x1D, 0x01, 0x05); \ + RBTT(0x1A, 0x1B, a, \ + 0x1C, 0x00, 0x04, 0x10, 0x1B, 0x1F, 0x03, 0x07); \ + RBTT(0x1C, 0x1D, a, \ + 0x1E, 0x02, 0x06, 0x12, 0x1D, 0x01, 0x05, 0x09); \ + RBTT(0x1E, 0x1F, a, \ + 0x00, 0x04, 0x08, 0x14, 0x1F, 0x03, 0x07, 0x0B); \ + memcpy(a, t, sizeof t); \ + } while (0) + +#endif + +#if SPH_SMALL_FOOTPRINT_GROESTL + +#define PERM_BIG_P(a) do { \ + int r; \ + for (r = 0; r < 14; r ++) \ + ROUND_BIG_P(a, r); \ + } while (0) + +#define PERM_BIG_Q(a) do { \ + int r; \ + for (r = 0; r < 14; r ++) \ + ROUND_BIG_Q(a, r); \ + } while (0) + +#else + +#define PERM_BIG_P(a) do { \ + int r; \ + for (r = 0; r < 14; r += 2) { \ + ROUND_BIG_P(a, r + 0); \ + ROUND_BIG_P(a, r + 1); \ + } \ + } while (0) + +#define PERM_BIG_Q(a) do { \ + int r; \ + for (r = 0; r < 14; r += 2) { \ + ROUND_BIG_Q(a, r + 0); \ + ROUND_BIG_Q(a, r + 1); \ + } \ + } while (0) + +#endif + +#define COMPRESS_BIG do { \ + sph_u32 g[32], m[32]; \ + size_t u; \ + for (u = 0; u < 32; u ++) { \ + m[u] = dec32e_aligned(buf + (u << 2)); \ + g[u] = m[u] ^ H[u]; \ + } \ + PERM_BIG_P(g); \ + PERM_BIG_Q(m); \ + for (u = 0; u < 32; u ++) \ + H[u] ^= g[u] ^ m[u]; \ + } while (0) + +#define FINAL_BIG do { \ + sph_u32 x[32]; \ + size_t u; \ + memcpy(x, H, sizeof x); \ + PERM_BIG_P(x); \ + for (u = 0; u < 32; u ++) \ + H[u] ^= x[u]; \ + } while (0) + +#endif + +static void +groestl_small_init(sph_groestl_small_context *sc, unsigned out_size) +{ + size_t u; + + sc->ptr = 0; +#if SPH_GROESTL_64 + for (u = 0; u < 7; u ++) + sc->state.wide[u] = 0; +#if USE_LE + sc->state.wide[7] = ((sph_u64)(out_size & 0xFF) << 56) + | ((sph_u64)(out_size & 0xFF00) << 40); +#else + sc->state.wide[7] = (sph_u64)out_size; +#endif +#else + for (u = 0; u < 15; u ++) + sc->state.narrow[u] = 0; +#if USE_LE + sc->state.narrow[15] = ((sph_u32)(out_size & 0xFF) << 24) + | ((sph_u32)(out_size & 0xFF00) << 8); +#else + sc->state.narrow[15] = (sph_u32)out_size; +#endif +#endif +#if SPH_64 + sc->count = 0; +#else + sc->count_high = 0; + sc->count_low = 0; +#endif +} + +static void +groestl_small_core(sph_groestl_small_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE_SMALL + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE_SMALL(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + COMPRESS_SMALL; +#if SPH_64 + sc->count ++; +#else + if ((sc->count_low = SPH_T32(sc->count_low + 1)) == 0) + sc->count_high = SPH_T32(sc->count_high + 1); +#endif + ptr = 0; + } + } + WRITE_STATE_SMALL(sc); + sc->ptr = ptr; +} + +static void +groestl_small_close(sph_groestl_small_context *sc, + unsigned ub, unsigned n, void *dst, size_t out_len) +{ + unsigned char *buf; + unsigned char pad[72]; + size_t u, ptr, pad_len; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif + unsigned z; + DECL_STATE_SMALL + + buf = sc->buf; + ptr = sc->ptr; + z = 0x80 >> n; + pad[0] = ((ub & -z) | z) & 0xFF; + if (ptr < 56) { + pad_len = 64 - ptr; +#if SPH_64 + count = SPH_T64(sc->count + 1); +#else + count_low = SPH_T32(sc->count_low + 1); + count_high = SPH_T32(sc->count_high); + if (count_low == 0) + count_high = SPH_T32(count_high + 1); +#endif + } else { + pad_len = 128 - ptr; +#if SPH_64 + count = SPH_T64(sc->count + 2); +#else + count_low = SPH_T32(sc->count_low + 2); + count_high = SPH_T32(sc->count_high); + if (count_low <= 1) + count_high = SPH_T32(count_high + 1); +#endif + } + memset(pad + 1, 0, pad_len - 9); +#if SPH_64 + sph_enc64be(pad + pad_len - 8, count); +#else + sph_enc64be(pad + pad_len - 8, count_high); + sph_enc64be(pad + pad_len - 4, count_low); +#endif + groestl_small_core(sc, pad, pad_len); + READ_STATE_SMALL(sc); + FINAL_SMALL; +#if SPH_GROESTL_64 + for (u = 0; u < 4; u ++) + enc64e(pad + (u << 3), H[u + 4]); +#else + for (u = 0; u < 8; u ++) + enc32e(pad + (u << 2), H[u + 8]); +#endif + memcpy(dst, pad + 32 - out_len, out_len); + groestl_small_init(sc, (unsigned)out_len << 3); +} + +static void +groestl_big_init(sph_groestl_big_context *sc, unsigned out_size) +{ + size_t u; + + sc->ptr = 0; +#if SPH_GROESTL_64 + for (u = 0; u < 15; u ++) + sc->state.wide[u] = 0; +#if USE_LE + sc->state.wide[15] = ((sph_u64)(out_size & 0xFF) << 56) + | ((sph_u64)(out_size & 0xFF00) << 40); +#else + sc->state.wide[15] = (sph_u64)out_size; +#endif +#else + for (u = 0; u < 31; u ++) + sc->state.narrow[u] = 0; +#if USE_LE + sc->state.narrow[31] = ((sph_u32)(out_size & 0xFF) << 24) + | ((sph_u32)(out_size & 0xFF00) << 8); +#else + sc->state.narrow[31] = (sph_u32)out_size; +#endif +#endif +#if SPH_64 + sc->count = 0; +#else + sc->count_high = 0; + sc->count_low = 0; +#endif +} + +static void +groestl_big_core(sph_groestl_big_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE_BIG + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE_BIG(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + COMPRESS_BIG; +#if SPH_64 + sc->count ++; +#else + if ((sc->count_low = SPH_T32(sc->count_low + 1)) == 0) + sc->count_high = SPH_T32(sc->count_high + 1); +#endif + ptr = 0; + } + } + WRITE_STATE_BIG(sc); + sc->ptr = ptr; +} + +static void +groestl_big_close(sph_groestl_big_context *sc, + unsigned ub, unsigned n, void *dst, size_t out_len) +{ + unsigned char *buf; + unsigned char pad[136]; + size_t ptr, pad_len, u; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif + unsigned z; + DECL_STATE_BIG + + buf = sc->buf; + ptr = sc->ptr; + z = 0x80 >> n; + pad[0] = ((ub & -z) | z) & 0xFF; + if (ptr < 120) { + pad_len = 128 - ptr; +#if SPH_64 + count = SPH_T64(sc->count + 1); +#else + count_low = SPH_T32(sc->count_low + 1); + count_high = SPH_T32(sc->count_high); + if (count_low == 0) + count_high = SPH_T32(count_high + 1); +#endif + } else { + pad_len = 256 - ptr; +#if SPH_64 + count = SPH_T64(sc->count + 2); +#else + count_low = SPH_T32(sc->count_low + 2); + count_high = SPH_T32(sc->count_high); + if (count_low <= 1) + count_high = SPH_T32(count_high + 1); +#endif + } + memset(pad + 1, 0, pad_len - 9); + //fprintf(stderr, "%x\n", pad_len); +#if SPH_64 + sph_enc64be(pad + pad_len - 8, count); +#else + sph_enc64be(pad + pad_len - 8, count_high); + sph_enc64be(pad + pad_len - 4, count_low); +#endif + groestl_big_core(sc, pad, pad_len); + READ_STATE_BIG(sc); + FINAL_BIG; +#if SPH_GROESTL_64 + for (u = 0; u < 8; u ++) + enc64e(pad + (u << 3), H[u + 8]); +#else + for (u = 0; u < 16; u ++) + enc32e(pad + (u << 2), H[u + 16]); +#endif + memcpy(dst, pad + 64 - out_len, out_len); + groestl_big_init(sc, (unsigned)out_len << 3); +} + +/* see sph_groestl.h */ +void +sph_groestl224_init(void *cc) +{ + groestl_small_init(cc, 224); +} + +/* see sph_groestl.h */ +void +sph_groestl224(void *cc, const void *data, size_t len) +{ + groestl_small_core(cc, data, len); +} + +/* see sph_groestl.h */ +void +sph_groestl224_close(void *cc, void *dst) +{ + groestl_small_close(cc, 0, 0, dst, 28); +} + +/* see sph_groestl.h */ +void +sph_groestl224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + groestl_small_close(cc, ub, n, dst, 28); +} + +/* see sph_groestl.h */ +void +sph_groestl256_init(void *cc) +{ + groestl_small_init(cc, 256); +} + +/* see sph_groestl.h */ +void +sph_groestl256(void *cc, const void *data, size_t len) +{ + groestl_small_core(cc, data, len); +} + +/* see sph_groestl.h */ +void +sph_groestl256_close(void *cc, void *dst) +{ + groestl_small_close(cc, 0, 0, dst, 32); +} + +/* see sph_groestl.h */ +void +sph_groestl256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + groestl_small_close(cc, ub, n, dst, 32); +} + +/* see sph_groestl.h */ +void +sph_groestl384_init(void *cc) +{ + groestl_big_init(cc, 384); +} + +/* see sph_groestl.h */ +void +sph_groestl384(void *cc, const void *data, size_t len) +{ + groestl_big_core(cc, data, len); +} + +/* see sph_groestl.h */ +void +sph_groestl384_close(void *cc, void *dst) +{ + groestl_big_close(cc, 0, 0, dst, 48); +} + +/* see sph_groestl.h */ +void +sph_groestl384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + groestl_big_close(cc, ub, n, dst, 48); +} + +/* see sph_groestl.h */ +void +sph_groestl512_init(void *cc) +{ + groestl_big_init(cc, 512); +} + +/* see sph_groestl.h */ +void +sph_groestl512(void *cc, const void *data, size_t len) +{ + groestl_big_core(cc, data, len); +} + +/* see sph_groestl.h */ +void +sph_groestl512_close(void *cc, void *dst) +{ + groestl_big_close(cc, 0, 0, dst, 64); +} + +/* see sph_groestl.h */ +void +sph_groestl512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + groestl_big_close(cc, ub, n, dst, 64); +} + +#ifdef __cplusplus +} +#endif diff --git a/sph/hamsi.c b/sph/hamsi.c new file mode 100644 index 0000000..4fdc3bf --- /dev/null +++ b/sph/hamsi.c @@ -0,0 +1,867 @@ +/* $Id: hamsi.c 251 2010-10-19 14:31:51Z tp $ */ +/* + * Hamsi implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_hamsi.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_HAMSI +#define SPH_SMALL_FOOTPRINT_HAMSI 1 +#endif + +/* + * The SPH_HAMSI_EXPAND_* define how many input bits we handle in one + * table lookup during message expansion (1 to 8, inclusive). If we note + * w the number of bits per message word (w=32 for Hamsi-224/256, w=64 + * for Hamsi-384/512), r the size of a "row" in 32-bit words (r=8 for + * Hamsi-224/256, r=16 for Hamsi-384/512), and n the expansion level, + * then we will get t tables (where t=ceil(w/n)) of individual size + * 2^n*r*4 (in bytes). The last table may be shorter (e.g. with w=32 and + * n=5, there are 7 tables, but the last one uses only two bits on + * input, not five). + * + * Also, we read t rows of r words from RAM. Words in a given row are + * concatenated in RAM in that order, so most of the cost is about + * reading the first row word; comparatively, cache misses are thus + * less expensive with Hamsi-512 (r=16) than with Hamsi-256 (r=8). + * + * When n=1, tables are "special" in that we omit the first entry of + * each table (which always contains 0), so that total table size is + * halved. + * + * We thus have the following (size1 is the cumulative table size of + * Hamsi-224/256; size2 is for Hamsi-384/512; similarly, t1 and t2 + * are for Hamsi-224/256 and Hamsi-384/512, respectively). + * + * n size1 size2 t1 t2 + * --------------------------------------- + * 1 1024 4096 32 64 + * 2 2048 8192 16 32 + * 3 2688 10880 11 22 + * 4 4096 16384 8 16 + * 5 6272 25600 7 13 + * 6 10368 41984 6 11 + * 7 16896 73856 5 10 + * 8 32768 131072 4 8 + * + * So there is a trade-off: a lower n makes the tables fit better in + * L1 cache, but increases the number of memory accesses. The optimal + * value depends on the amount of available L1 cache and the relative + * impact of a cache miss. + * + * Experimentally, in ideal benchmark conditions (which are not necessarily + * realistic with regards to L1 cache contention), it seems that n=8 is + * the best value on "big" architectures (those with 32 kB or more of L1 + * cache), while n=4 is better on "small" architectures. This was tested + * on an Intel Core2 Q6600 (both 32-bit and 64-bit mode), a PowerPC G3 + * (32 kB L1 cache, hence "big"), and a MIPS-compatible Broadcom BCM3302 + * (8 kB L1 cache). + * + * Note: with n=1, the 32 tables (actually implemented as one big table) + * are read entirely and sequentially, regardless of the input data, + * thus avoiding any data-dependent table access pattern. + */ + +#if !defined SPH_HAMSI_EXPAND_SMALL +#if SPH_SMALL_FOOTPRINT_HAMSI +#define SPH_HAMSI_EXPAND_SMALL 4 +#else +#define SPH_HAMSI_EXPAND_SMALL 8 +#endif +#endif + +#if !defined SPH_HAMSI_EXPAND_BIG +#define SPH_HAMSI_EXPAND_BIG 8 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +#include "hamsi_helper.c" + +static const sph_u32 IV224[] = { + SPH_C32(0xc3967a67), SPH_C32(0xc3bc6c20), SPH_C32(0x4bc3bcc3), + SPH_C32(0xa7c3bc6b), SPH_C32(0x2c204b61), SPH_C32(0x74686f6c), + SPH_C32(0x69656b65), SPH_C32(0x20556e69) +}; + +/* + * This version is the one used in the Hamsi submission package for + * round 2 of the SHA-3 competition; the UTF-8 encoding is wrong and + * shall soon be corrected in the official Hamsi specification. + * +static const sph_u32 IV224[] = { + SPH_C32(0x3c967a67), SPH_C32(0x3cbc6c20), SPH_C32(0xb4c343c3), + SPH_C32(0xa73cbc6b), SPH_C32(0x2c204b61), SPH_C32(0x74686f6c), + SPH_C32(0x69656b65), SPH_C32(0x20556e69) +}; + */ + +static const sph_u32 IV256[] = { + SPH_C32(0x76657273), SPH_C32(0x69746569), SPH_C32(0x74204c65), + SPH_C32(0x7576656e), SPH_C32(0x2c204465), SPH_C32(0x70617274), + SPH_C32(0x656d656e), SPH_C32(0x7420456c) +}; + +static const sph_u32 IV384[] = { + SPH_C32(0x656b7472), SPH_C32(0x6f746563), SPH_C32(0x686e6965), + SPH_C32(0x6b2c2043), SPH_C32(0x6f6d7075), SPH_C32(0x74657220), + SPH_C32(0x53656375), SPH_C32(0x72697479), SPH_C32(0x20616e64), + SPH_C32(0x20496e64), SPH_C32(0x75737472), SPH_C32(0x69616c20), + SPH_C32(0x43727970), SPH_C32(0x746f6772), SPH_C32(0x61706879), + SPH_C32(0x2c204b61) +}; + +static const sph_u32 IV512[] = { + SPH_C32(0x73746565), SPH_C32(0x6c706172), SPH_C32(0x6b204172), + SPH_C32(0x656e6265), SPH_C32(0x72672031), SPH_C32(0x302c2062), + SPH_C32(0x75732032), SPH_C32(0x3434362c), SPH_C32(0x20422d33), + SPH_C32(0x30303120), SPH_C32(0x4c657576), SPH_C32(0x656e2d48), + SPH_C32(0x65766572), SPH_C32(0x6c65652c), SPH_C32(0x2042656c), + SPH_C32(0x6769756d) +}; + +static const sph_u32 alpha_n[] = { + SPH_C32(0xff00f0f0), SPH_C32(0xccccaaaa), SPH_C32(0xf0f0cccc), + SPH_C32(0xff00aaaa), SPH_C32(0xccccaaaa), SPH_C32(0xf0f0ff00), + SPH_C32(0xaaaacccc), SPH_C32(0xf0f0ff00), SPH_C32(0xf0f0cccc), + SPH_C32(0xaaaaff00), SPH_C32(0xccccff00), SPH_C32(0xaaaaf0f0), + SPH_C32(0xaaaaf0f0), SPH_C32(0xff00cccc), SPH_C32(0xccccf0f0), + SPH_C32(0xff00aaaa), SPH_C32(0xccccaaaa), SPH_C32(0xff00f0f0), + SPH_C32(0xff00aaaa), SPH_C32(0xf0f0cccc), SPH_C32(0xf0f0ff00), + SPH_C32(0xccccaaaa), SPH_C32(0xf0f0ff00), SPH_C32(0xaaaacccc), + SPH_C32(0xaaaaff00), SPH_C32(0xf0f0cccc), SPH_C32(0xaaaaf0f0), + SPH_C32(0xccccff00), SPH_C32(0xff00cccc), SPH_C32(0xaaaaf0f0), + SPH_C32(0xff00aaaa), SPH_C32(0xccccf0f0) +}; + +static const sph_u32 alpha_f[] = { + SPH_C32(0xcaf9639c), SPH_C32(0x0ff0f9c0), SPH_C32(0x639c0ff0), + SPH_C32(0xcaf9f9c0), SPH_C32(0x0ff0f9c0), SPH_C32(0x639ccaf9), + SPH_C32(0xf9c00ff0), SPH_C32(0x639ccaf9), SPH_C32(0x639c0ff0), + SPH_C32(0xf9c0caf9), SPH_C32(0x0ff0caf9), SPH_C32(0xf9c0639c), + SPH_C32(0xf9c0639c), SPH_C32(0xcaf90ff0), SPH_C32(0x0ff0639c), + SPH_C32(0xcaf9f9c0), SPH_C32(0x0ff0f9c0), SPH_C32(0xcaf9639c), + SPH_C32(0xcaf9f9c0), SPH_C32(0x639c0ff0), SPH_C32(0x639ccaf9), + SPH_C32(0x0ff0f9c0), SPH_C32(0x639ccaf9), SPH_C32(0xf9c00ff0), + SPH_C32(0xf9c0caf9), SPH_C32(0x639c0ff0), SPH_C32(0xf9c0639c), + SPH_C32(0x0ff0caf9), SPH_C32(0xcaf90ff0), SPH_C32(0xf9c0639c), + SPH_C32(0xcaf9f9c0), SPH_C32(0x0ff0639c) +}; + +#define DECL_STATE_SMALL \ + sph_u32 c0, c1, c2, c3, c4, c5, c6, c7; + +#define READ_STATE_SMALL(sc) do { \ + c0 = sc->h[0x0]; \ + c1 = sc->h[0x1]; \ + c2 = sc->h[0x2]; \ + c3 = sc->h[0x3]; \ + c4 = sc->h[0x4]; \ + c5 = sc->h[0x5]; \ + c6 = sc->h[0x6]; \ + c7 = sc->h[0x7]; \ + } while (0) + +#define WRITE_STATE_SMALL(sc) do { \ + sc->h[0x0] = c0; \ + sc->h[0x1] = c1; \ + sc->h[0x2] = c2; \ + sc->h[0x3] = c3; \ + sc->h[0x4] = c4; \ + sc->h[0x5] = c5; \ + sc->h[0x6] = c6; \ + sc->h[0x7] = c7; \ + } while (0) + +#define s0 m0 +#define s1 m1 +#define s2 c0 +#define s3 c1 +#define s4 c2 +#define s5 c3 +#define s6 m2 +#define s7 m3 +#define s8 m4 +#define s9 m5 +#define sA c4 +#define sB c5 +#define sC c6 +#define sD c7 +#define sE m6 +#define sF m7 + +#define SBOX(a, b, c, d) do { \ + sph_u32 t; \ + t = (a); \ + (a) &= (c); \ + (a) ^= (d); \ + (c) ^= (b); \ + (c) ^= (a); \ + (d) |= t; \ + (d) ^= (b); \ + t ^= (c); \ + (b) = (d); \ + (d) |= t; \ + (d) ^= (a); \ + (a) &= (b); \ + t ^= (a); \ + (b) ^= (d); \ + (b) ^= t; \ + (a) = (c); \ + (c) = (b); \ + (b) = (d); \ + (d) = SPH_T32(~t); \ + } while (0) + +#define L(a, b, c, d) do { \ + (a) = SPH_ROTL32(a, 13); \ + (c) = SPH_ROTL32(c, 3); \ + (b) ^= (a) ^ (c); \ + (d) ^= (c) ^ SPH_T32((a) << 3); \ + (b) = SPH_ROTL32(b, 1); \ + (d) = SPH_ROTL32(d, 7); \ + (a) ^= (b) ^ (d); \ + (c) ^= (d) ^ SPH_T32((b) << 7); \ + (a) = SPH_ROTL32(a, 5); \ + (c) = SPH_ROTL32(c, 22); \ + } while (0) + +#define ROUND_SMALL(rc, alpha) do { \ + s0 ^= alpha[0x00]; \ + s1 ^= alpha[0x01] ^ (sph_u32)(rc); \ + s2 ^= alpha[0x02]; \ + s3 ^= alpha[0x03]; \ + s4 ^= alpha[0x08]; \ + s5 ^= alpha[0x09]; \ + s6 ^= alpha[0x0A]; \ + s7 ^= alpha[0x0B]; \ + s8 ^= alpha[0x10]; \ + s9 ^= alpha[0x11]; \ + sA ^= alpha[0x12]; \ + sB ^= alpha[0x13]; \ + sC ^= alpha[0x18]; \ + sD ^= alpha[0x19]; \ + sE ^= alpha[0x1A]; \ + sF ^= alpha[0x1B]; \ + SBOX(s0, s4, s8, sC); \ + SBOX(s1, s5, s9, sD); \ + SBOX(s2, s6, sA, sE); \ + SBOX(s3, s7, sB, sF); \ + L(s0, s5, sA, sF); \ + L(s1, s6, sB, sC); \ + L(s2, s7, s8, sD); \ + L(s3, s4, s9, sE); \ + } while (0) + +#define P_SMALL do { \ + ROUND_SMALL(0, alpha_n); \ + ROUND_SMALL(1, alpha_n); \ + ROUND_SMALL(2, alpha_n); \ + } while (0) + +#define PF_SMALL do { \ + ROUND_SMALL(0, alpha_f); \ + ROUND_SMALL(1, alpha_f); \ + ROUND_SMALL(2, alpha_f); \ + ROUND_SMALL(3, alpha_f); \ + ROUND_SMALL(4, alpha_f); \ + ROUND_SMALL(5, alpha_f); \ + } while (0) + +#define T_SMALL do { \ + /* order is important */ \ + c7 = (sc->h[7] ^= sB); \ + c6 = (sc->h[6] ^= sA); \ + c5 = (sc->h[5] ^= s9); \ + c4 = (sc->h[4] ^= s8); \ + c3 = (sc->h[3] ^= s3); \ + c2 = (sc->h[2] ^= s2); \ + c1 = (sc->h[1] ^= s1); \ + c0 = (sc->h[0] ^= s0); \ + } while (0) + +static void +hamsi_small(sph_hamsi_small_context *sc, const unsigned char *buf, size_t num) +{ + DECL_STATE_SMALL +#if !SPH_64 + sph_u32 tmp; +#endif + +#if SPH_64 + sc->count += (sph_u64)num << 5; +#else + tmp = SPH_T32((sph_u32)num << 5); + sc->count_low = SPH_T32(sc->count_low + tmp); + sc->count_high += (sph_u32)((num >> 13) >> 14); + if (sc->count_low < tmp) + sc->count_high ++; +#endif + READ_STATE_SMALL(sc); + while (num -- > 0) { + sph_u32 m0, m1, m2, m3, m4, m5, m6, m7; + + INPUT_SMALL; + P_SMALL; + T_SMALL; + buf += 4; + } + WRITE_STATE_SMALL(sc); +} + +static void +hamsi_small_final(sph_hamsi_small_context *sc, const unsigned char *buf) +{ + sph_u32 m0, m1, m2, m3, m4, m5, m6, m7; + DECL_STATE_SMALL + + READ_STATE_SMALL(sc); + INPUT_SMALL; + PF_SMALL; + T_SMALL; + WRITE_STATE_SMALL(sc); +} + +static void +hamsi_small_init(sph_hamsi_small_context *sc, const sph_u32 *iv) +{ + sc->partial_len = 0; + memcpy(sc->h, iv, sizeof sc->h); +#if SPH_64 + sc->count = 0; +#else + sc->count_high = sc->count_low = 0; +#endif +} + +static void +hamsi_small_core(sph_hamsi_small_context *sc, const void *data, size_t len) +{ + if (sc->partial_len != 0) { + size_t mlen; + + mlen = 4 - sc->partial_len; + if (len < mlen) { + memcpy(sc->partial + sc->partial_len, data, len); + sc->partial_len += len; + return; + } else { + memcpy(sc->partial + sc->partial_len, data, mlen); + len -= mlen; + data = (const unsigned char *)data + mlen; + hamsi_small(sc, sc->partial, 1); + sc->partial_len = 0; + } + } + + hamsi_small(sc, data, (len >> 2)); + data = (const unsigned char *)data + (len & ~(size_t)3); + len &= (size_t)3; + memcpy(sc->partial, data, len); + sc->partial_len = len; +} + +static void +hamsi_small_close(sph_hamsi_small_context *sc, + unsigned ub, unsigned n, void *dst, size_t out_size_w32) +{ + unsigned char pad[12]; + size_t ptr, u; + unsigned z; + unsigned char *out; + + ptr = sc->partial_len; + memcpy(pad, sc->partial, ptr); +#if SPH_64 + sph_enc64be(pad + 4, sc->count + (ptr << 3) + n); +#else + sph_enc32be(pad + 4, sc->count_high); + sph_enc32be(pad + 8, sc->count_low + (ptr << 3) + n); +#endif + z = 0x80 >> n; + pad[ptr ++] = ((ub & -z) | z) & 0xFF; + while (ptr < 4) + pad[ptr ++] = 0; + hamsi_small(sc, pad, 2); + hamsi_small_final(sc, pad + 8); + out = dst; + for (u = 0; u < out_size_w32; u ++) + sph_enc32be(out + (u << 2), sc->h[u]); +} + +#define DECL_STATE_BIG \ + sph_u32 c0, c1, c2, c3, c4, c5, c6, c7; \ + sph_u32 c8, c9, cA, cB, cC, cD, cE, cF; + +#define READ_STATE_BIG(sc) do { \ + c0 = sc->h[0x0]; \ + c1 = sc->h[0x1]; \ + c2 = sc->h[0x2]; \ + c3 = sc->h[0x3]; \ + c4 = sc->h[0x4]; \ + c5 = sc->h[0x5]; \ + c6 = sc->h[0x6]; \ + c7 = sc->h[0x7]; \ + c8 = sc->h[0x8]; \ + c9 = sc->h[0x9]; \ + cA = sc->h[0xA]; \ + cB = sc->h[0xB]; \ + cC = sc->h[0xC]; \ + cD = sc->h[0xD]; \ + cE = sc->h[0xE]; \ + cF = sc->h[0xF]; \ + } while (0) + +#define WRITE_STATE_BIG(sc) do { \ + sc->h[0x0] = c0; \ + sc->h[0x1] = c1; \ + sc->h[0x2] = c2; \ + sc->h[0x3] = c3; \ + sc->h[0x4] = c4; \ + sc->h[0x5] = c5; \ + sc->h[0x6] = c6; \ + sc->h[0x7] = c7; \ + sc->h[0x8] = c8; \ + sc->h[0x9] = c9; \ + sc->h[0xA] = cA; \ + sc->h[0xB] = cB; \ + sc->h[0xC] = cC; \ + sc->h[0xD] = cD; \ + sc->h[0xE] = cE; \ + sc->h[0xF] = cF; \ + } while (0) + +#define s00 m0 +#define s01 m1 +#define s02 c0 +#define s03 c1 +#define s04 m2 +#define s05 m3 +#define s06 c2 +#define s07 c3 +#define s08 c4 +#define s09 c5 +#define s0A m4 +#define s0B m5 +#define s0C c6 +#define s0D c7 +#define s0E m6 +#define s0F m7 +#define s10 m8 +#define s11 m9 +#define s12 c8 +#define s13 c9 +#define s14 mA +#define s15 mB +#define s16 cA +#define s17 cB +#define s18 cC +#define s19 cD +#define s1A mC +#define s1B mD +#define s1C cE +#define s1D cF +#define s1E mE +#define s1F mF + +#define ROUND_BIG(rc, alpha) do { \ + s00 ^= alpha[0x00]; \ + s01 ^= alpha[0x01] ^ (sph_u32)(rc); \ + s02 ^= alpha[0x02]; \ + s03 ^= alpha[0x03]; \ + s04 ^= alpha[0x04]; \ + s05 ^= alpha[0x05]; \ + s06 ^= alpha[0x06]; \ + s07 ^= alpha[0x07]; \ + s08 ^= alpha[0x08]; \ + s09 ^= alpha[0x09]; \ + s0A ^= alpha[0x0A]; \ + s0B ^= alpha[0x0B]; \ + s0C ^= alpha[0x0C]; \ + s0D ^= alpha[0x0D]; \ + s0E ^= alpha[0x0E]; \ + s0F ^= alpha[0x0F]; \ + s10 ^= alpha[0x10]; \ + s11 ^= alpha[0x11]; \ + s12 ^= alpha[0x12]; \ + s13 ^= alpha[0x13]; \ + s14 ^= alpha[0x14]; \ + s15 ^= alpha[0x15]; \ + s16 ^= alpha[0x16]; \ + s17 ^= alpha[0x17]; \ + s18 ^= alpha[0x18]; \ + s19 ^= alpha[0x19]; \ + s1A ^= alpha[0x1A]; \ + s1B ^= alpha[0x1B]; \ + s1C ^= alpha[0x1C]; \ + s1D ^= alpha[0x1D]; \ + s1E ^= alpha[0x1E]; \ + s1F ^= alpha[0x1F]; \ + SBOX(s00, s08, s10, s18); \ + SBOX(s01, s09, s11, s19); \ + SBOX(s02, s0A, s12, s1A); \ + SBOX(s03, s0B, s13, s1B); \ + SBOX(s04, s0C, s14, s1C); \ + SBOX(s05, s0D, s15, s1D); \ + SBOX(s06, s0E, s16, s1E); \ + SBOX(s07, s0F, s17, s1F); \ + L(s00, s09, s12, s1B); \ + L(s01, s0A, s13, s1C); \ + L(s02, s0B, s14, s1D); \ + L(s03, s0C, s15, s1E); \ + L(s04, s0D, s16, s1F); \ + L(s05, s0E, s17, s18); \ + L(s06, s0F, s10, s19); \ + L(s07, s08, s11, s1A); \ + L(s00, s02, s05, s07); \ + L(s10, s13, s15, s16); \ + L(s09, s0B, s0C, s0E); \ + L(s19, s1A, s1C, s1F); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_HAMSI + +#define P_BIG do { \ + unsigned r; \ + for (r = 0; r < 6; r ++) \ + ROUND_BIG(r, alpha_n); \ + } while (0) + +#define PF_BIG do { \ + unsigned r; \ + for (r = 0; r < 12; r ++) \ + ROUND_BIG(r, alpha_f); \ + } while (0) + +#else + +#define P_BIG do { \ + ROUND_BIG(0, alpha_n); \ + ROUND_BIG(1, alpha_n); \ + ROUND_BIG(2, alpha_n); \ + ROUND_BIG(3, alpha_n); \ + ROUND_BIG(4, alpha_n); \ + ROUND_BIG(5, alpha_n); \ + } while (0) + +#define PF_BIG do { \ + ROUND_BIG(0, alpha_f); \ + ROUND_BIG(1, alpha_f); \ + ROUND_BIG(2, alpha_f); \ + ROUND_BIG(3, alpha_f); \ + ROUND_BIG(4, alpha_f); \ + ROUND_BIG(5, alpha_f); \ + ROUND_BIG(6, alpha_f); \ + ROUND_BIG(7, alpha_f); \ + ROUND_BIG(8, alpha_f); \ + ROUND_BIG(9, alpha_f); \ + ROUND_BIG(10, alpha_f); \ + ROUND_BIG(11, alpha_f); \ + } while (0) + +#endif + +#define T_BIG do { \ + /* order is important */ \ + cF = (sc->h[0xF] ^= s17); \ + cE = (sc->h[0xE] ^= s16); \ + cD = (sc->h[0xD] ^= s15); \ + cC = (sc->h[0xC] ^= s14); \ + cB = (sc->h[0xB] ^= s13); \ + cA = (sc->h[0xA] ^= s12); \ + c9 = (sc->h[0x9] ^= s11); \ + c8 = (sc->h[0x8] ^= s10); \ + c7 = (sc->h[0x7] ^= s07); \ + c6 = (sc->h[0x6] ^= s06); \ + c5 = (sc->h[0x5] ^= s05); \ + c4 = (sc->h[0x4] ^= s04); \ + c3 = (sc->h[0x3] ^= s03); \ + c2 = (sc->h[0x2] ^= s02); \ + c1 = (sc->h[0x1] ^= s01); \ + c0 = (sc->h[0x0] ^= s00); \ + } while (0) + +static void +hamsi_big(sph_hamsi_big_context *sc, const unsigned char *buf, size_t num) +{ + DECL_STATE_BIG +#if !SPH_64 + sph_u32 tmp; +#endif + +#if SPH_64 + sc->count += (sph_u64)num << 6; +#else + tmp = SPH_T32((sph_u32)num << 6); + sc->count_low = SPH_T32(sc->count_low + tmp); + sc->count_high += (sph_u32)((num >> 13) >> 13); + if (sc->count_low < tmp) + sc->count_high ++; +#endif + READ_STATE_BIG(sc); + while (num -- > 0) { + sph_u32 m0, m1, m2, m3, m4, m5, m6, m7; + sph_u32 m8, m9, mA, mB, mC, mD, mE, mF; + + INPUT_BIG; + P_BIG; + T_BIG; + buf += 8; + } + WRITE_STATE_BIG(sc); +} + +static void +hamsi_big_final(sph_hamsi_big_context *sc, const unsigned char *buf) +{ + sph_u32 m0, m1, m2, m3, m4, m5, m6, m7; + sph_u32 m8, m9, mA, mB, mC, mD, mE, mF; + DECL_STATE_BIG + + READ_STATE_BIG(sc); + INPUT_BIG; + PF_BIG; + T_BIG; + WRITE_STATE_BIG(sc); +} + +static void +hamsi_big_init(sph_hamsi_big_context *sc, const sph_u32 *iv) +{ + sc->partial_len = 0; + memcpy(sc->h, iv, sizeof sc->h); +#if SPH_64 + sc->count = 0; +#else + sc->count_high = sc->count_low = 0; +#endif +} + +static void +hamsi_big_core(sph_hamsi_big_context *sc, const void *data, size_t len) +{ + if (sc->partial_len != 0) { + size_t mlen; + + mlen = 8 - sc->partial_len; + if (len < mlen) { + memcpy(sc->partial + sc->partial_len, data, len); + sc->partial_len += len; + return; + } else { + memcpy(sc->partial + sc->partial_len, data, mlen); + len -= mlen; + data = (const unsigned char *)data + mlen; + hamsi_big(sc, sc->partial, 1); + sc->partial_len = 0; + } + } + + hamsi_big(sc, data, (len >> 3)); + data = (const unsigned char *)data + (len & ~(size_t)7); + len &= (size_t)7; + memcpy(sc->partial, data, len); + sc->partial_len = len; +} + +static void +hamsi_big_close(sph_hamsi_big_context *sc, + unsigned ub, unsigned n, void *dst, size_t out_size_w32) +{ + unsigned char pad[8]; + size_t ptr, u; + unsigned z; + unsigned char *out; + + ptr = sc->partial_len; +#if SPH_64 + sph_enc64be(pad, sc->count + (ptr << 3) + n); +#else + sph_enc32be(pad, sc->count_high); + sph_enc32be(pad + 4, sc->count_low + (ptr << 3) + n); +#endif + z = 0x80 >> n; + sc->partial[ptr ++] = ((ub & -z) | z) & 0xFF; + while (ptr < 8) + sc->partial[ptr ++] = 0; + hamsi_big(sc, sc->partial, 1); + hamsi_big_final(sc, pad); + out = dst; + if (out_size_w32 == 12) { + sph_enc32be(out + 0, sc->h[ 0]); + sph_enc32be(out + 4, sc->h[ 1]); + sph_enc32be(out + 8, sc->h[ 3]); + sph_enc32be(out + 12, sc->h[ 4]); + sph_enc32be(out + 16, sc->h[ 5]); + sph_enc32be(out + 20, sc->h[ 6]); + sph_enc32be(out + 24, sc->h[ 8]); + sph_enc32be(out + 28, sc->h[ 9]); + sph_enc32be(out + 32, sc->h[10]); + sph_enc32be(out + 36, sc->h[12]); + sph_enc32be(out + 40, sc->h[13]); + sph_enc32be(out + 44, sc->h[15]); + } else { + for (u = 0; u < 16; u ++) + sph_enc32be(out + (u << 2), sc->h[u]); + } +} + +/* see sph_hamsi.h */ +void +sph_hamsi224_init(void *cc) +{ + hamsi_small_init(cc, IV224); +} + +/* see sph_hamsi.h */ +void +sph_hamsi224(void *cc, const void *data, size_t len) +{ + hamsi_small_core(cc, data, len); +} + +/* see sph_hamsi.h */ +void +sph_hamsi224_close(void *cc, void *dst) +{ + hamsi_small_close(cc, 0, 0, dst, 7); + hamsi_small_init(cc, IV224); +} + +/* see sph_hamsi.h */ +void +sph_hamsi224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + hamsi_small_close(cc, ub, n, dst, 7); + hamsi_small_init(cc, IV224); +} + +/* see sph_hamsi.h */ +void +sph_hamsi256_init(void *cc) +{ + hamsi_small_init(cc, IV256); +} + +/* see sph_hamsi.h */ +void +sph_hamsi256(void *cc, const void *data, size_t len) +{ + hamsi_small_core(cc, data, len); +} + +/* see sph_hamsi.h */ +void +sph_hamsi256_close(void *cc, void *dst) +{ + hamsi_small_close(cc, 0, 0, dst, 8); + hamsi_small_init(cc, IV256); +} + +/* see sph_hamsi.h */ +void +sph_hamsi256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + hamsi_small_close(cc, ub, n, dst, 8); + hamsi_small_init(cc, IV256); +} + +/* see sph_hamsi.h */ +void +sph_hamsi384_init(void *cc) +{ + hamsi_big_init(cc, IV384); +} + +/* see sph_hamsi.h */ +void +sph_hamsi384(void *cc, const void *data, size_t len) +{ + hamsi_big_core(cc, data, len); +} + +/* see sph_hamsi.h */ +void +sph_hamsi384_close(void *cc, void *dst) +{ + hamsi_big_close(cc, 0, 0, dst, 12); + hamsi_big_init(cc, IV384); +} + +/* see sph_hamsi.h */ +void +sph_hamsi384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + hamsi_big_close(cc, ub, n, dst, 12); + hamsi_big_init(cc, IV384); +} + +/* see sph_hamsi.h */ +void +sph_hamsi512_init(void *cc) +{ + hamsi_big_init(cc, IV512); +} + +/* see sph_hamsi.h */ +void +sph_hamsi512(void *cc, const void *data, size_t len) +{ + hamsi_big_core(cc, data, len); +} + +/* see sph_hamsi.h */ +void +sph_hamsi512_close(void *cc, void *dst) +{ + hamsi_big_close(cc, 0, 0, dst, 16); + hamsi_big_init(cc, IV512); +} + +/* see sph_hamsi.h */ +void +sph_hamsi512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + hamsi_big_close(cc, ub, n, dst, 16); + hamsi_big_init(cc, IV512); +} + +#ifdef __cplusplus +} +#endif diff --git a/sph/hamsi_helper.c b/sph/hamsi_helper.c new file mode 100644 index 0000000..cdf2fc9 --- /dev/null +++ b/sph/hamsi_helper.c @@ -0,0 +1,39648 @@ +/* $Id: hamsi_helper.c 202 2010-05-31 15:46:48Z tp $ */ +/* + * Helper code for Hamsi (input block expansion). This code is + * automatically generated and includes precomputed tables for + * expansion code which handles 2 to 8 bits at a time. + * + * This file is included from hamsi.c, and is not meant to be compiled + * independently. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_HAMSI_EXPAND_SMALL == 1 + +/* Note: this table lists bits within each byte from least + siginificant to most significant. */ +static const sph_u32 T256[32][8] = { + { SPH_C32(0x74951000), SPH_C32(0x5a2b467e), SPH_C32(0x88fd1d2b), + SPH_C32(0x1ee68292), SPH_C32(0xcba90000), SPH_C32(0x90273769), + SPH_C32(0xbbdcf407), SPH_C32(0xd0f4af61) }, + { SPH_C32(0xcba90000), SPH_C32(0x90273769), SPH_C32(0xbbdcf407), + SPH_C32(0xd0f4af61), SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), + SPH_C32(0x3321e92c), SPH_C32(0xce122df3) }, + { SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), SPH_C32(0x11fa3a57), + SPH_C32(0x3dc90524), SPH_C32(0x97530000), SPH_C32(0x204f6ed3), + SPH_C32(0x77b9e80f), SPH_C32(0xa1ec5ec1) }, + { SPH_C32(0x97530000), SPH_C32(0x204f6ed3), SPH_C32(0x77b9e80f), + SPH_C32(0xa1ec5ec1), SPH_C32(0x7e792000), SPH_C32(0x9418e22f), + SPH_C32(0x6643d258), SPH_C32(0x9c255be5) }, + { SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), SPH_C32(0x8dfacfab), + SPH_C32(0xce36cc72), SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), + SPH_C32(0x848598ba), SPH_C32(0x1041003e) }, + { SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), SPH_C32(0x848598ba), + SPH_C32(0x1041003e), SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), + SPH_C32(0x097f5711), SPH_C32(0xde77cc4c) }, + { SPH_C32(0xe4788000), SPH_C32(0x859673c1), SPH_C32(0xb5fb2452), + SPH_C32(0x29cc5edf), SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), + SPH_C32(0x62fc79d0), SPH_C32(0x731ebdc2) }, + { SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), SPH_C32(0x62fc79d0), + SPH_C32(0x731ebdc2), SPH_C32(0xe0278000), SPH_C32(0x19dce008), + SPH_C32(0xd7075d82), SPH_C32(0x5ad2e31d) }, + { SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), SPH_C32(0x8589d8ab), + SPH_C32(0xe6c46464), SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), + SPH_C32(0xa29d1297), SPH_C32(0x6ee56854) }, + { SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), SPH_C32(0xa29d1297), + SPH_C32(0x6ee56854), SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), + SPH_C32(0x2714ca3c), SPH_C32(0x88210c30) }, + { SPH_C32(0xa7b80200), SPH_C32(0x1f128433), SPH_C32(0x60e5f9f2), + SPH_C32(0x9e147576), SPH_C32(0xee260000), SPH_C32(0x124b683e), + SPH_C32(0x80c2d68f), SPH_C32(0x3bf3ab2c) }, + { SPH_C32(0xee260000), SPH_C32(0x124b683e), SPH_C32(0x80c2d68f), + SPH_C32(0x3bf3ab2c), SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), + SPH_C32(0xe0272f7d), SPH_C32(0xa5e7de5a) }, + { SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), SPH_C32(0x6fc548e1), + SPH_C32(0x898d2cd6), SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), + SPH_C32(0x6a72e5bb), SPH_C32(0x247febe6) }, + { SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), SPH_C32(0x6a72e5bb), + SPH_C32(0x247febe6), SPH_C32(0x9b830400), SPH_C32(0x2227ff88), + SPH_C32(0x05b7ad5a), SPH_C32(0xadf2c730) }, + { SPH_C32(0xde320800), SPH_C32(0x288350fe), SPH_C32(0x71852ac7), + SPH_C32(0xa6bf9f96), SPH_C32(0xe18b0000), SPH_C32(0x5459887d), + SPH_C32(0xbf1283d3), SPH_C32(0x1b666a73) }, + { SPH_C32(0xe18b0000), SPH_C32(0x5459887d), SPH_C32(0xbf1283d3), + SPH_C32(0x1b666a73), SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), + SPH_C32(0xce97a914), SPH_C32(0xbdd9f5e5) }, + { SPH_C32(0x515c0010), SPH_C32(0x40f372fb), SPH_C32(0xfce72602), + SPH_C32(0x71575061), SPH_C32(0x2e390000), SPH_C32(0x64dd6689), + SPH_C32(0x3cd406fc), SPH_C32(0xb1f490bc) }, + { SPH_C32(0x2e390000), SPH_C32(0x64dd6689), SPH_C32(0x3cd406fc), + SPH_C32(0xb1f490bc), SPH_C32(0x7f650010), SPH_C32(0x242e1472), + SPH_C32(0xc03320fe), SPH_C32(0xc0a3c0dd) }, + { SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), SPH_C32(0xf9ce4c04), + SPH_C32(0xe2afa0c0), SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), + SPH_C32(0x79a90df9), SPH_C32(0x63e92178) }, + { SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), SPH_C32(0x79a90df9), + SPH_C32(0x63e92178), SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), + SPH_C32(0x806741fd), SPH_C32(0x814681b8) }, + { SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), SPH_C32(0x36656ba8), + SPH_C32(0x23633a05), SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), + SPH_C32(0x5d5ca0f7), SPH_C32(0x727784cb) }, + { SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), SPH_C32(0x5d5ca0f7), + SPH_C32(0x727784cb), SPH_C32(0x35650040), SPH_C32(0x9b96b64a), + SPH_C32(0x6b39cb5f), SPH_C32(0x5114bece) }, + { SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), SPH_C32(0xc2c46c55), + SPH_C32(0xf362b233), SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), + SPH_C32(0xd14e094b), SPH_C32(0xb772b42b) }, + { SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), SPH_C32(0xd14e094b), + SPH_C32(0xb772b42b), SPH_C32(0x62740080), SPH_C32(0x0fb84b07), + SPH_C32(0x138a651e), SPH_C32(0x44100618) }, + { SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), SPH_C32(0xae0ebb05), + SPH_C32(0xb5a4c63b), SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), + SPH_C32(0x6bf648a4), SPH_C32(0x539cbdbf) }, + { SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), SPH_C32(0x6bf648a4), + SPH_C32(0x539cbdbf), SPH_C32(0x08bf0001), SPH_C32(0x38942792), + SPH_C32(0xc5f8f3a1), SPH_C32(0xe6387b84) }, + { SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), SPH_C32(0x99e585aa), + SPH_C32(0x8d75f7f1), SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), + SPH_C32(0x79e22a4c), SPH_C32(0x1298bd46) }, + { SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), SPH_C32(0x79e22a4c), + SPH_C32(0x1298bd46), SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), + SPH_C32(0xe007afe6), SPH_C32(0x9fed4ab7) }, + { SPH_C32(0xd0080004), SPH_C32(0x8c768f77), SPH_C32(0x9dc5b050), + SPH_C32(0xaf4a29da), SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), + SPH_C32(0x98321c3d), SPH_C32(0x76acc733) }, + { SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), SPH_C32(0x98321c3d), + SPH_C32(0x76acc733), SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), + SPH_C32(0x05f7ac6d), SPH_C32(0xd9e6eee9) }, + { SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), SPH_C32(0xfe739301), + SPH_C32(0xb8a92831), SPH_C32(0x171c0000), SPH_C32(0xb26e3344), + SPH_C32(0x9e6a837e), SPH_C32(0x58f8485f) }, + { SPH_C32(0x171c0000), SPH_C32(0xb26e3344), SPH_C32(0x9e6a837e), + SPH_C32(0x58f8485f), SPH_C32(0xbfb20008), SPH_C32(0x92170a39), + SPH_C32(0x6019107f), SPH_C32(0xe051606e) } +}; + +#define INPUT_SMALL do { \ + const sph_u32 *tp = &T256[0][0]; \ + unsigned u, v; \ + m0 = 0; \ + m1 = 0; \ + m2 = 0; \ + m3 = 0; \ + m4 = 0; \ + m5 = 0; \ + m6 = 0; \ + m7 = 0; \ + for (u = 0; u < 4; u ++) { \ + unsigned db = buf[u]; \ + for (v = 0; v < 8; v ++, db >>= 1) { \ + sph_u32 dm = SPH_T32(-(sph_u32)(db & 1)); \ + m0 ^= dm & *tp ++; \ + m1 ^= dm & *tp ++; \ + m2 ^= dm & *tp ++; \ + m3 ^= dm & *tp ++; \ + m4 ^= dm & *tp ++; \ + m5 ^= dm & *tp ++; \ + m6 ^= dm & *tp ++; \ + m7 ^= dm & *tp ++; \ + } \ + } \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_SMALL == 2 + +static const sph_u32 T256_0[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xe4788000), SPH_C32(0x859673c1), SPH_C32(0xb5fb2452), + SPH_C32(0x29cc5edf), SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), + SPH_C32(0x62fc79d0), SPH_C32(0x731ebdc2) }, + { SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), SPH_C32(0x62fc79d0), + SPH_C32(0x731ebdc2), SPH_C32(0xe0278000), SPH_C32(0x19dce008), + SPH_C32(0xd7075d82), SPH_C32(0x5ad2e31d) }, + { SPH_C32(0xe0278000), SPH_C32(0x19dce008), SPH_C32(0xd7075d82), + SPH_C32(0x5ad2e31d), SPH_C32(0xe4788000), SPH_C32(0x859673c1), + SPH_C32(0xb5fb2452), SPH_C32(0x29cc5edf) } +}; + +static const sph_u32 T256_2[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), SPH_C32(0x8dfacfab), + SPH_C32(0xce36cc72), SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), + SPH_C32(0x848598ba), SPH_C32(0x1041003e) }, + { SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), SPH_C32(0x848598ba), + SPH_C32(0x1041003e), SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), + SPH_C32(0x097f5711), SPH_C32(0xde77cc4c) }, + { SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), SPH_C32(0x097f5711), + SPH_C32(0xde77cc4c), SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), + SPH_C32(0x8dfacfab), SPH_C32(0xce36cc72) } +}; + +static const sph_u32 T256_4[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), SPH_C32(0x11fa3a57), + SPH_C32(0x3dc90524), SPH_C32(0x97530000), SPH_C32(0x204f6ed3), + SPH_C32(0x77b9e80f), SPH_C32(0xa1ec5ec1) }, + { SPH_C32(0x97530000), SPH_C32(0x204f6ed3), SPH_C32(0x77b9e80f), + SPH_C32(0xa1ec5ec1), SPH_C32(0x7e792000), SPH_C32(0x9418e22f), + SPH_C32(0x6643d258), SPH_C32(0x9c255be5) }, + { SPH_C32(0x7e792000), SPH_C32(0x9418e22f), SPH_C32(0x6643d258), + SPH_C32(0x9c255be5), SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), + SPH_C32(0x11fa3a57), SPH_C32(0x3dc90524) } +}; + +static const sph_u32 T256_6[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x74951000), SPH_C32(0x5a2b467e), SPH_C32(0x88fd1d2b), + SPH_C32(0x1ee68292), SPH_C32(0xcba90000), SPH_C32(0x90273769), + SPH_C32(0xbbdcf407), SPH_C32(0xd0f4af61) }, + { SPH_C32(0xcba90000), SPH_C32(0x90273769), SPH_C32(0xbbdcf407), + SPH_C32(0xd0f4af61), SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), + SPH_C32(0x3321e92c), SPH_C32(0xce122df3) }, + { SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), SPH_C32(0x3321e92c), + SPH_C32(0xce122df3), SPH_C32(0x74951000), SPH_C32(0x5a2b467e), + SPH_C32(0x88fd1d2b), SPH_C32(0x1ee68292) } +}; + +static const sph_u32 T256_8[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xde320800), SPH_C32(0x288350fe), SPH_C32(0x71852ac7), + SPH_C32(0xa6bf9f96), SPH_C32(0xe18b0000), SPH_C32(0x5459887d), + SPH_C32(0xbf1283d3), SPH_C32(0x1b666a73) }, + { SPH_C32(0xe18b0000), SPH_C32(0x5459887d), SPH_C32(0xbf1283d3), + SPH_C32(0x1b666a73), SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), + SPH_C32(0xce97a914), SPH_C32(0xbdd9f5e5) }, + { SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), SPH_C32(0xce97a914), + SPH_C32(0xbdd9f5e5), SPH_C32(0xde320800), SPH_C32(0x288350fe), + SPH_C32(0x71852ac7), SPH_C32(0xa6bf9f96) } +}; + +static const sph_u32 T256_10[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), SPH_C32(0x6fc548e1), + SPH_C32(0x898d2cd6), SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), + SPH_C32(0x6a72e5bb), SPH_C32(0x247febe6) }, + { SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), SPH_C32(0x6a72e5bb), + SPH_C32(0x247febe6), SPH_C32(0x9b830400), SPH_C32(0x2227ff88), + SPH_C32(0x05b7ad5a), SPH_C32(0xadf2c730) }, + { SPH_C32(0x9b830400), SPH_C32(0x2227ff88), SPH_C32(0x05b7ad5a), + SPH_C32(0xadf2c730), SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), + SPH_C32(0x6fc548e1), SPH_C32(0x898d2cd6) } +}; + +static const sph_u32 T256_12[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xa7b80200), SPH_C32(0x1f128433), SPH_C32(0x60e5f9f2), + SPH_C32(0x9e147576), SPH_C32(0xee260000), SPH_C32(0x124b683e), + SPH_C32(0x80c2d68f), SPH_C32(0x3bf3ab2c) }, + { SPH_C32(0xee260000), SPH_C32(0x124b683e), SPH_C32(0x80c2d68f), + SPH_C32(0x3bf3ab2c), SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), + SPH_C32(0xe0272f7d), SPH_C32(0xa5e7de5a) }, + { SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), SPH_C32(0xe0272f7d), + SPH_C32(0xa5e7de5a), SPH_C32(0xa7b80200), SPH_C32(0x1f128433), + SPH_C32(0x60e5f9f2), SPH_C32(0x9e147576) } +}; + +static const sph_u32 T256_14[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), SPH_C32(0x8589d8ab), + SPH_C32(0xe6c46464), SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), + SPH_C32(0xa29d1297), SPH_C32(0x6ee56854) }, + { SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), SPH_C32(0xa29d1297), + SPH_C32(0x6ee56854), SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), + SPH_C32(0x2714ca3c), SPH_C32(0x88210c30) }, + { SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), SPH_C32(0x2714ca3c), + SPH_C32(0x88210c30), SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), + SPH_C32(0x8589d8ab), SPH_C32(0xe6c46464) } +}; + +static const sph_u32 T256_16[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), SPH_C32(0xc2c46c55), + SPH_C32(0xf362b233), SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), + SPH_C32(0xd14e094b), SPH_C32(0xb772b42b) }, + { SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), SPH_C32(0xd14e094b), + SPH_C32(0xb772b42b), SPH_C32(0x62740080), SPH_C32(0x0fb84b07), + SPH_C32(0x138a651e), SPH_C32(0x44100618) }, + { SPH_C32(0x62740080), SPH_C32(0x0fb84b07), SPH_C32(0x138a651e), + SPH_C32(0x44100618), SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), + SPH_C32(0xc2c46c55), SPH_C32(0xf362b233) } +}; + +static const sph_u32 T256_18[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), SPH_C32(0x36656ba8), + SPH_C32(0x23633a05), SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), + SPH_C32(0x5d5ca0f7), SPH_C32(0x727784cb) }, + { SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), SPH_C32(0x5d5ca0f7), + SPH_C32(0x727784cb), SPH_C32(0x35650040), SPH_C32(0x9b96b64a), + SPH_C32(0x6b39cb5f), SPH_C32(0x5114bece) }, + { SPH_C32(0x35650040), SPH_C32(0x9b96b64a), SPH_C32(0x6b39cb5f), + SPH_C32(0x5114bece), SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), + SPH_C32(0x36656ba8), SPH_C32(0x23633a05) } +}; + +static const sph_u32 T256_20[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), SPH_C32(0xf9ce4c04), + SPH_C32(0xe2afa0c0), SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), + SPH_C32(0x79a90df9), SPH_C32(0x63e92178) }, + { SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), SPH_C32(0x79a90df9), + SPH_C32(0x63e92178), SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), + SPH_C32(0x806741fd), SPH_C32(0x814681b8) }, + { SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), SPH_C32(0x806741fd), + SPH_C32(0x814681b8), SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), + SPH_C32(0xf9ce4c04), SPH_C32(0xe2afa0c0) } +}; + +static const sph_u32 T256_22[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x515c0010), SPH_C32(0x40f372fb), SPH_C32(0xfce72602), + SPH_C32(0x71575061), SPH_C32(0x2e390000), SPH_C32(0x64dd6689), + SPH_C32(0x3cd406fc), SPH_C32(0xb1f490bc) }, + { SPH_C32(0x2e390000), SPH_C32(0x64dd6689), SPH_C32(0x3cd406fc), + SPH_C32(0xb1f490bc), SPH_C32(0x7f650010), SPH_C32(0x242e1472), + SPH_C32(0xc03320fe), SPH_C32(0xc0a3c0dd) }, + { SPH_C32(0x7f650010), SPH_C32(0x242e1472), SPH_C32(0xc03320fe), + SPH_C32(0xc0a3c0dd), SPH_C32(0x515c0010), SPH_C32(0x40f372fb), + SPH_C32(0xfce72602), SPH_C32(0x71575061) } +}; + +static const sph_u32 T256_24[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), SPH_C32(0xfe739301), + SPH_C32(0xb8a92831), SPH_C32(0x171c0000), SPH_C32(0xb26e3344), + SPH_C32(0x9e6a837e), SPH_C32(0x58f8485f) }, + { SPH_C32(0x171c0000), SPH_C32(0xb26e3344), SPH_C32(0x9e6a837e), + SPH_C32(0x58f8485f), SPH_C32(0xbfb20008), SPH_C32(0x92170a39), + SPH_C32(0x6019107f), SPH_C32(0xe051606e) }, + { SPH_C32(0xbfb20008), SPH_C32(0x92170a39), SPH_C32(0x6019107f), + SPH_C32(0xe051606e), SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), + SPH_C32(0xfe739301), SPH_C32(0xb8a92831) } +}; + +static const sph_u32 T256_26[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xd0080004), SPH_C32(0x8c768f77), SPH_C32(0x9dc5b050), + SPH_C32(0xaf4a29da), SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), + SPH_C32(0x98321c3d), SPH_C32(0x76acc733) }, + { SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), SPH_C32(0x98321c3d), + SPH_C32(0x76acc733), SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), + SPH_C32(0x05f7ac6d), SPH_C32(0xd9e6eee9) }, + { SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), SPH_C32(0x05f7ac6d), + SPH_C32(0xd9e6eee9), SPH_C32(0xd0080004), SPH_C32(0x8c768f77), + SPH_C32(0x9dc5b050), SPH_C32(0xaf4a29da) } +}; + +static const sph_u32 T256_28[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), SPH_C32(0x99e585aa), + SPH_C32(0x8d75f7f1), SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), + SPH_C32(0x79e22a4c), SPH_C32(0x1298bd46) }, + { SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), SPH_C32(0x79e22a4c), + SPH_C32(0x1298bd46), SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), + SPH_C32(0xe007afe6), SPH_C32(0x9fed4ab7) }, + { SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), SPH_C32(0xe007afe6), + SPH_C32(0x9fed4ab7), SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), + SPH_C32(0x99e585aa), SPH_C32(0x8d75f7f1) } +}; + +static const sph_u32 T256_30[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), SPH_C32(0xae0ebb05), + SPH_C32(0xb5a4c63b), SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), + SPH_C32(0x6bf648a4), SPH_C32(0x539cbdbf) }, + { SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), SPH_C32(0x6bf648a4), + SPH_C32(0x539cbdbf), SPH_C32(0x08bf0001), SPH_C32(0x38942792), + SPH_C32(0xc5f8f3a1), SPH_C32(0xe6387b84) }, + { SPH_C32(0x08bf0001), SPH_C32(0x38942792), SPH_C32(0xc5f8f3a1), + SPH_C32(0xe6387b84), SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), + SPH_C32(0xae0ebb05), SPH_C32(0xb5a4c63b) } +}; + +#define INPUT_SMALL do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T256_0[acc >> 6][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + rp = &T256_2[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_4[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_6[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[1]; \ + rp = &T256_8[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_10[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_12[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_14[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[2]; \ + rp = &T256_16[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_18[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_20[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_22[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[3]; \ + rp = &T256_24[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_26[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_28[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_30[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_SMALL == 3 + +static const sph_u32 T256_0[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), SPH_C32(0x848598ba), + SPH_C32(0x1041003e), SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), + SPH_C32(0x097f5711), SPH_C32(0xde77cc4c) }, + { SPH_C32(0xe4788000), SPH_C32(0x859673c1), SPH_C32(0xb5fb2452), + SPH_C32(0x29cc5edf), SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), + SPH_C32(0x62fc79d0), SPH_C32(0x731ebdc2) }, + { SPH_C32(0x022f8000), SPH_C32(0xce2549e4), SPH_C32(0x317ebce8), + SPH_C32(0x398d5ee1), SPH_C32(0xf0134000), SPH_C32(0x8cee7004), + SPH_C32(0x6b832ec1), SPH_C32(0xad69718e) }, + { SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), SPH_C32(0x62fc79d0), + SPH_C32(0x731ebdc2), SPH_C32(0xe0278000), SPH_C32(0x19dce008), + SPH_C32(0xd7075d82), SPH_C32(0x5ad2e31d) }, + { SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), SPH_C32(0xe679e16a), + SPH_C32(0x635fbdfc), SPH_C32(0x146bc000), SPH_C32(0x097803c5), + SPH_C32(0xde780a93), SPH_C32(0x84a52f51) }, + { SPH_C32(0xe0278000), SPH_C32(0x19dce008), SPH_C32(0xd7075d82), + SPH_C32(0x5ad2e31d), SPH_C32(0xe4788000), SPH_C32(0x859673c1), + SPH_C32(0xb5fb2452), SPH_C32(0x29cc5edf) }, + { SPH_C32(0x06708000), SPH_C32(0x526fda2d), SPH_C32(0x5382c538), + SPH_C32(0x4a93e323), SPH_C32(0x1034c000), SPH_C32(0x9532900c), + SPH_C32(0xbc847343), SPH_C32(0xf7bb9293) } +}; + +static const sph_u32 T256_3[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), SPH_C32(0x11fa3a57), + SPH_C32(0x3dc90524), SPH_C32(0x97530000), SPH_C32(0x204f6ed3), + SPH_C32(0x77b9e80f), SPH_C32(0xa1ec5ec1) }, + { SPH_C32(0x97530000), SPH_C32(0x204f6ed3), SPH_C32(0x77b9e80f), + SPH_C32(0xa1ec5ec1), SPH_C32(0x7e792000), SPH_C32(0x9418e22f), + SPH_C32(0x6643d258), SPH_C32(0x9c255be5) }, + { SPH_C32(0x7e792000), SPH_C32(0x9418e22f), SPH_C32(0x6643d258), + SPH_C32(0x9c255be5), SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), + SPH_C32(0x11fa3a57), SPH_C32(0x3dc90524) }, + { SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), SPH_C32(0x8dfacfab), + SPH_C32(0xce36cc72), SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), + SPH_C32(0x848598ba), SPH_C32(0x1041003e) }, + { SPH_C32(0xfb316000), SPH_C32(0xef405514), SPH_C32(0x9c00f5fc), + SPH_C32(0xf3ffc956), SPH_C32(0x71040000), SPH_C32(0x6bfc54f6), + SPH_C32(0xf33c70b5), SPH_C32(0xb1ad5eff) }, + { SPH_C32(0x85484000), SPH_C32(0x7b58b73b), SPH_C32(0xfa4327a4), + SPH_C32(0x6fda92b3), SPH_C32(0x982e2000), SPH_C32(0xdfabd80a), + SPH_C32(0xe2c64ae2), SPH_C32(0x8c645bdb) }, + { SPH_C32(0x6c626000), SPH_C32(0xcf0f3bc7), SPH_C32(0xebb91df3), + SPH_C32(0x52139797), SPH_C32(0x0f7d2000), SPH_C32(0xffe4b6d9), + SPH_C32(0x957fa2ed), SPH_C32(0x2d88051a) } +}; + +static const sph_u32 T256_6[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xe18b0000), SPH_C32(0x5459887d), SPH_C32(0xbf1283d3), + SPH_C32(0x1b666a73), SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), + SPH_C32(0xce97a914), SPH_C32(0xbdd9f5e5) }, + { SPH_C32(0x74951000), SPH_C32(0x5a2b467e), SPH_C32(0x88fd1d2b), + SPH_C32(0x1ee68292), SPH_C32(0xcba90000), SPH_C32(0x90273769), + SPH_C32(0xbbdcf407), SPH_C32(0xd0f4af61) }, + { SPH_C32(0x951e1000), SPH_C32(0x0e72ce03), SPH_C32(0x37ef9ef8), + SPH_C32(0x0580e8e1), SPH_C32(0xf4100800), SPH_C32(0xecfdefea), + SPH_C32(0x754b5d13), SPH_C32(0x6d2d5a84) }, + { SPH_C32(0xcba90000), SPH_C32(0x90273769), SPH_C32(0xbbdcf407), + SPH_C32(0xd0f4af61), SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), + SPH_C32(0x3321e92c), SPH_C32(0xce122df3) }, + { SPH_C32(0x2a220000), SPH_C32(0xc47ebf14), SPH_C32(0x04ce77d4), + SPH_C32(0xcb92c512), SPH_C32(0x80851800), SPH_C32(0xb6d6a994), + SPH_C32(0xfdb64038), SPH_C32(0x73cbd816) }, + { SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), SPH_C32(0x3321e92c), + SPH_C32(0xce122df3), SPH_C32(0x74951000), SPH_C32(0x5a2b467e), + SPH_C32(0x88fd1d2b), SPH_C32(0x1ee68292) }, + { SPH_C32(0x5eb71000), SPH_C32(0x9e55f96a), SPH_C32(0x8c336aff), + SPH_C32(0xd5744780), SPH_C32(0x4b2c1800), SPH_C32(0x26f19efd), + SPH_C32(0x466ab43f), SPH_C32(0xa33f7777) } +}; + +static const sph_u32 T256_9[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), SPH_C32(0x6fc548e1), + SPH_C32(0x898d2cd6), SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), + SPH_C32(0x6a72e5bb), SPH_C32(0x247febe6) }, + { SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), SPH_C32(0x6a72e5bb), + SPH_C32(0x247febe6), SPH_C32(0x9b830400), SPH_C32(0x2227ff88), + SPH_C32(0x05b7ad5a), SPH_C32(0xadf2c730) }, + { SPH_C32(0x9b830400), SPH_C32(0x2227ff88), SPH_C32(0x05b7ad5a), + SPH_C32(0xadf2c730), SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), + SPH_C32(0x6fc548e1), SPH_C32(0x898d2cd6) }, + { SPH_C32(0xde320800), SPH_C32(0x288350fe), SPH_C32(0x71852ac7), + SPH_C32(0xa6bf9f96), SPH_C32(0xe18b0000), SPH_C32(0x5459887d), + SPH_C32(0xbf1283d3), SPH_C32(0x1b666a73) }, + { SPH_C32(0x510c0c00), SPH_C32(0x251e9889), SPH_C32(0x1e406226), + SPH_C32(0x2f32b340), SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), + SPH_C32(0xd5606668), SPH_C32(0x3f198195) }, + { SPH_C32(0xca8f0800), SPH_C32(0x07396701), SPH_C32(0x1bf7cf7c), + SPH_C32(0x82c07470), SPH_C32(0x7a080400), SPH_C32(0x767e77f5), + SPH_C32(0xbaa52e89), SPH_C32(0xb694ad43) }, + { SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), SPH_C32(0x7432879d), + SPH_C32(0x0b4d58a6), SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), + SPH_C32(0xd0d7cb32), SPH_C32(0x92eb46a5) } +}; + +static const sph_u32 T256_12[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), SPH_C32(0xa29d1297), + SPH_C32(0x6ee56854), SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), + SPH_C32(0x2714ca3c), SPH_C32(0x88210c30) }, + { SPH_C32(0xa7b80200), SPH_C32(0x1f128433), SPH_C32(0x60e5f9f2), + SPH_C32(0x9e147576), SPH_C32(0xee260000), SPH_C32(0x124b683e), + SPH_C32(0x80c2d68f), SPH_C32(0x3bf3ab2c) }, + { SPH_C32(0xd4f40200), SPH_C32(0x8a7d23e5), SPH_C32(0xc278eb65), + SPH_C32(0xf0f11d22), SPH_C32(0x2ace0100), SPH_C32(0x0d3bfe30), + SPH_C32(0xa7d61cb3), SPH_C32(0xb3d2a71c) }, + { SPH_C32(0xee260000), SPH_C32(0x124b683e), SPH_C32(0x80c2d68f), + SPH_C32(0x3bf3ab2c), SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), + SPH_C32(0xe0272f7d), SPH_C32(0xa5e7de5a) }, + { SPH_C32(0x9d6a0000), SPH_C32(0x8724cfe8), SPH_C32(0x225fc418), + SPH_C32(0x5516c378), SPH_C32(0x8d760300), SPH_C32(0x12297a03), + SPH_C32(0xc733e541), SPH_C32(0x2dc6d26a) }, + { SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), SPH_C32(0xe0272f7d), + SPH_C32(0xa5e7de5a), SPH_C32(0xa7b80200), SPH_C32(0x1f128433), + SPH_C32(0x60e5f9f2), SPH_C32(0x9e147576) }, + { SPH_C32(0x3ad20200), SPH_C32(0x98364bdb), SPH_C32(0x42ba3dea), + SPH_C32(0xcb02b60e), SPH_C32(0x63500300), SPH_C32(0x0062123d), + SPH_C32(0x47f133ce), SPH_C32(0x16357946) } +}; + +static const sph_u32 T256_15[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), SPH_C32(0xc2c46c55), + SPH_C32(0xf362b233), SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), + SPH_C32(0xd14e094b), SPH_C32(0xb772b42b) }, + { SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), SPH_C32(0xd14e094b), + SPH_C32(0xb772b42b), SPH_C32(0x62740080), SPH_C32(0x0fb84b07), + SPH_C32(0x138a651e), SPH_C32(0x44100618) }, + { SPH_C32(0x62740080), SPH_C32(0x0fb84b07), SPH_C32(0x138a651e), + SPH_C32(0x44100618), SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), + SPH_C32(0xc2c46c55), SPH_C32(0xf362b233) }, + { SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), SPH_C32(0x8589d8ab), + SPH_C32(0xe6c46464), SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), + SPH_C32(0xa29d1297), SPH_C32(0x6ee56854) }, + { SPH_C32(0xec760180), SPH_C32(0xcf102934), SPH_C32(0x474db4fe), + SPH_C32(0x15a6d657), SPH_C32(0x4aea0000), SPH_C32(0xdfd8f43d), + SPH_C32(0x73d31bdc), SPH_C32(0xd997dc7f) }, + { SPH_C32(0x8e020100), SPH_C32(0xc0a86233), SPH_C32(0x54c7d1e0), + SPH_C32(0x51b6d04f), SPH_C32(0x11380080), SPH_C32(0x9ad7ecd1), + SPH_C32(0xb1177789), SPH_C32(0x2af56e4c) }, + { SPH_C32(0xd5d00180), SPH_C32(0x85a77adf), SPH_C32(0x9603bdb5), + SPH_C32(0xa2d4627c), SPH_C32(0x289e0080), SPH_C32(0xd060bf3a), + SPH_C32(0x60597ec2), SPH_C32(0x9d87da67) } +}; + +static const sph_u32 T256_18[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), SPH_C32(0x79a90df9), + SPH_C32(0x63e92178), SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), + SPH_C32(0x806741fd), SPH_C32(0x814681b8) }, + { SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), SPH_C32(0x36656ba8), + SPH_C32(0x23633a05), SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), + SPH_C32(0x5d5ca0f7), SPH_C32(0x727784cb) }, + { SPH_C32(0x11bc0040), SPH_C32(0xf2e1216c), SPH_C32(0x4fcc6651), + SPH_C32(0x408a1b7d), SPH_C32(0x86610020), SPH_C32(0xe89072d0), + SPH_C32(0xdd3be10a), SPH_C32(0xf3310573) }, + { SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), SPH_C32(0x5d5ca0f7), + SPH_C32(0x727784cb), SPH_C32(0x35650040), SPH_C32(0x9b96b64a), + SPH_C32(0x6b39cb5f), SPH_C32(0x5114bece) }, + { SPH_C32(0x24d90000), SPH_C32(0x69779726), SPH_C32(0x24f5ad0e), + SPH_C32(0x119ea5b3), SPH_C32(0xcbaf0060), SPH_C32(0xd3cb9eae), + SPH_C32(0xeb5e8aa2), SPH_C32(0xd0523f76) }, + { SPH_C32(0x35650040), SPH_C32(0x9b96b64a), SPH_C32(0x6b39cb5f), + SPH_C32(0x5114bece), SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), + SPH_C32(0x36656ba8), SPH_C32(0x23633a05) }, + { SPH_C32(0x69170040), SPH_C32(0x522c7b58), SPH_C32(0x1290c6a6), + SPH_C32(0x32fd9fb6), SPH_C32(0xb3040060), SPH_C32(0x7306c49a), + SPH_C32(0xb6022a55), SPH_C32(0xa225bbbd) } +}; + +static const sph_u32 T256_21[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x515c0010), SPH_C32(0x40f372fb), SPH_C32(0xfce72602), + SPH_C32(0x71575061), SPH_C32(0x2e390000), SPH_C32(0x64dd6689), + SPH_C32(0x3cd406fc), SPH_C32(0xb1f490bc) }, + { SPH_C32(0x2e390000), SPH_C32(0x64dd6689), SPH_C32(0x3cd406fc), + SPH_C32(0xb1f490bc), SPH_C32(0x7f650010), SPH_C32(0x242e1472), + SPH_C32(0xc03320fe), SPH_C32(0xc0a3c0dd) }, + { SPH_C32(0x7f650010), SPH_C32(0x242e1472), SPH_C32(0xc03320fe), + SPH_C32(0xc0a3c0dd), SPH_C32(0x515c0010), SPH_C32(0x40f372fb), + SPH_C32(0xfce72602), SPH_C32(0x71575061) }, + { SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), SPH_C32(0xf9ce4c04), + SPH_C32(0xe2afa0c0), SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), + SPH_C32(0x79a90df9), SPH_C32(0x63e92178) }, + { SPH_C32(0xf3e40030), SPH_C32(0xc114970d), SPH_C32(0x05296a06), + SPH_C32(0x93f8f0a1), SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), + SPH_C32(0x457d0b05), SPH_C32(0xd21db1c4) }, + { SPH_C32(0x8c810020), SPH_C32(0xe53a837f), SPH_C32(0xc51a4af8), + SPH_C32(0x535b307c), SPH_C32(0x23170010), SPH_C32(0xed94d960), + SPH_C32(0xb99a2d07), SPH_C32(0xa34ae1a5) }, + { SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), SPH_C32(0x39fd6cfa), + SPH_C32(0x220c601d), SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), + SPH_C32(0x854e2bfb), SPH_C32(0x12be7119) } +}; + +static const sph_u32 T256_24[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), SPH_C32(0x98321c3d), + SPH_C32(0x76acc733), SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), + SPH_C32(0x05f7ac6d), SPH_C32(0xd9e6eee9) }, + { SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), SPH_C32(0xfe739301), + SPH_C32(0xb8a92831), SPH_C32(0x171c0000), SPH_C32(0xb26e3344), + SPH_C32(0x9e6a837e), SPH_C32(0x58f8485f) }, + { SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), SPH_C32(0x66418f3c), + SPH_C32(0xce05ef02), SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), + SPH_C32(0x9b9d2f13), SPH_C32(0x811ea6b6) }, + { SPH_C32(0x171c0000), SPH_C32(0xb26e3344), SPH_C32(0x9e6a837e), + SPH_C32(0x58f8485f), SPH_C32(0xbfb20008), SPH_C32(0x92170a39), + SPH_C32(0x6019107f), SPH_C32(0xe051606e) }, + { SPH_C32(0x7cb50000), SPH_C32(0xf285caee), SPH_C32(0x06589f43), + SPH_C32(0x2e548f6c), SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), + SPH_C32(0x65eebc12), SPH_C32(0x39b78e87) }, + { SPH_C32(0xbfb20008), SPH_C32(0x92170a39), SPH_C32(0x6019107f), + SPH_C32(0xe051606e), SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), + SPH_C32(0xfe739301), SPH_C32(0xb8a92831) }, + { SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), SPH_C32(0xf82b0c42), + SPH_C32(0x96fda75d), SPH_C32(0x130f000c), SPH_C32(0xece44fa0), + SPH_C32(0xfb843f6c), SPH_C32(0x614fc6d8) } +}; + +static const sph_u32 T256_27[8][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), SPH_C32(0x99e585aa), + SPH_C32(0x8d75f7f1), SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), + SPH_C32(0x79e22a4c), SPH_C32(0x1298bd46) }, + { SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), SPH_C32(0x79e22a4c), + SPH_C32(0x1298bd46), SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), + SPH_C32(0xe007afe6), SPH_C32(0x9fed4ab7) }, + { SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), SPH_C32(0xe007afe6), + SPH_C32(0x9fed4ab7), SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), + SPH_C32(0x99e585aa), SPH_C32(0x8d75f7f1) }, + { SPH_C32(0xd0080004), SPH_C32(0x8c768f77), SPH_C32(0x9dc5b050), + SPH_C32(0xaf4a29da), SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), + SPH_C32(0x98321c3d), SPH_C32(0x76acc733) }, + { SPH_C32(0x582b0006), SPH_C32(0xd39128c4), SPH_C32(0x042035fa), + SPH_C32(0x223fde2b), SPH_C32(0x3a050000), SPH_C32(0x6508f6be), + SPH_C32(0xe1d03671), SPH_C32(0x64347a75) }, + { SPH_C32(0x81a40004), SPH_C32(0xa9958063), SPH_C32(0xe4279a1c), + SPH_C32(0xbdd2949c), SPH_C32(0xb2260002), SPH_C32(0x3aef510d), + SPH_C32(0x7835b3db), SPH_C32(0xe9418d84) }, + { SPH_C32(0x09870006), SPH_C32(0xf67227d0), SPH_C32(0x7dc21fb6), + SPH_C32(0x30a7636d), SPH_C32(0xe38a0002), SPH_C32(0x1f0c5e19), + SPH_C32(0x01d79997), SPH_C32(0xfbd930c2) } +}; + +static const sph_u32 T256_30[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), SPH_C32(0xae0ebb05), + SPH_C32(0xb5a4c63b), SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), + SPH_C32(0x6bf648a4), SPH_C32(0x539cbdbf) }, + { SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), SPH_C32(0x6bf648a4), + SPH_C32(0x539cbdbf), SPH_C32(0x08bf0001), SPH_C32(0x38942792), + SPH_C32(0xc5f8f3a1), SPH_C32(0xe6387b84) }, + { SPH_C32(0x08bf0001), SPH_C32(0x38942792), SPH_C32(0xc5f8f3a1), + SPH_C32(0xe6387b84), SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), + SPH_C32(0xae0ebb05), SPH_C32(0xb5a4c63b) } +}; + +#define INPUT_SMALL do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T256_0[acc >> 5][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + rp = &T256_3[(acc >> 2) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = (acc << 8) | buf[1]; \ + rp = &T256_6[(acc >> 7) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_9[(acc >> 4) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_12[(acc >> 1) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = (acc << 8) | buf[2]; \ + rp = &T256_15[(acc >> 6) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_18[(acc >> 3) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_21[acc & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[3]; \ + rp = &T256_24[acc >> 5][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_27[(acc >> 2) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_30[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_SMALL == 4 + +static const sph_u32 T256_0[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), SPH_C32(0x8dfacfab), + SPH_C32(0xce36cc72), SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), + SPH_C32(0x848598ba), SPH_C32(0x1041003e) }, + { SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), SPH_C32(0x848598ba), + SPH_C32(0x1041003e), SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), + SPH_C32(0x097f5711), SPH_C32(0xde77cc4c) }, + { SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), SPH_C32(0x097f5711), + SPH_C32(0xde77cc4c), SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), + SPH_C32(0x8dfacfab), SPH_C32(0xce36cc72) }, + { SPH_C32(0xe4788000), SPH_C32(0x859673c1), SPH_C32(0xb5fb2452), + SPH_C32(0x29cc5edf), SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), + SPH_C32(0x62fc79d0), SPH_C32(0x731ebdc2) }, + { SPH_C32(0xf663c000), SPH_C32(0xde81aa29), SPH_C32(0x3801ebf9), + SPH_C32(0xe7fa92ad), SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), + SPH_C32(0xe679e16a), SPH_C32(0x635fbdfc) }, + { SPH_C32(0x022f8000), SPH_C32(0xce2549e4), SPH_C32(0x317ebce8), + SPH_C32(0x398d5ee1), SPH_C32(0xf0134000), SPH_C32(0x8cee7004), + SPH_C32(0x6b832ec1), SPH_C32(0xad69718e) }, + { SPH_C32(0x1034c000), SPH_C32(0x9532900c), SPH_C32(0xbc847343), + SPH_C32(0xf7bb9293), SPH_C32(0x16444000), SPH_C32(0xc75d4a21), + SPH_C32(0xef06b67b), SPH_C32(0xbd2871b0) }, + { SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), SPH_C32(0x62fc79d0), + SPH_C32(0x731ebdc2), SPH_C32(0xe0278000), SPH_C32(0x19dce008), + SPH_C32(0xd7075d82), SPH_C32(0x5ad2e31d) }, + { SPH_C32(0x16444000), SPH_C32(0xc75d4a21), SPH_C32(0xef06b67b), + SPH_C32(0xbd2871b0), SPH_C32(0x06708000), SPH_C32(0x526fda2d), + SPH_C32(0x5382c538), SPH_C32(0x4a93e323) }, + { SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), SPH_C32(0xe679e16a), + SPH_C32(0x635fbdfc), SPH_C32(0x146bc000), SPH_C32(0x097803c5), + SPH_C32(0xde780a93), SPH_C32(0x84a52f51) }, + { SPH_C32(0xf0134000), SPH_C32(0x8cee7004), SPH_C32(0x6b832ec1), + SPH_C32(0xad69718e), SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), + SPH_C32(0x5afd9229), SPH_C32(0x94e42f6f) }, + { SPH_C32(0xe0278000), SPH_C32(0x19dce008), SPH_C32(0xd7075d82), + SPH_C32(0x5ad2e31d), SPH_C32(0xe4788000), SPH_C32(0x859673c1), + SPH_C32(0xb5fb2452), SPH_C32(0x29cc5edf) }, + { SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), SPH_C32(0x5afd9229), + SPH_C32(0x94e42f6f), SPH_C32(0x022f8000), SPH_C32(0xce2549e4), + SPH_C32(0x317ebce8), SPH_C32(0x398d5ee1) }, + { SPH_C32(0x06708000), SPH_C32(0x526fda2d), SPH_C32(0x5382c538), + SPH_C32(0x4a93e323), SPH_C32(0x1034c000), SPH_C32(0x9532900c), + SPH_C32(0xbc847343), SPH_C32(0xf7bb9293) }, + { SPH_C32(0x146bc000), SPH_C32(0x097803c5), SPH_C32(0xde780a93), + SPH_C32(0x84a52f51), SPH_C32(0xf663c000), SPH_C32(0xde81aa29), + SPH_C32(0x3801ebf9), SPH_C32(0xe7fa92ad) } +}; + +static const sph_u32 T256_4[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x74951000), SPH_C32(0x5a2b467e), SPH_C32(0x88fd1d2b), + SPH_C32(0x1ee68292), SPH_C32(0xcba90000), SPH_C32(0x90273769), + SPH_C32(0xbbdcf407), SPH_C32(0xd0f4af61) }, + { SPH_C32(0xcba90000), SPH_C32(0x90273769), SPH_C32(0xbbdcf407), + SPH_C32(0xd0f4af61), SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), + SPH_C32(0x3321e92c), SPH_C32(0xce122df3) }, + { SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), SPH_C32(0x3321e92c), + SPH_C32(0xce122df3), SPH_C32(0x74951000), SPH_C32(0x5a2b467e), + SPH_C32(0x88fd1d2b), SPH_C32(0x1ee68292) }, + { SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), SPH_C32(0x11fa3a57), + SPH_C32(0x3dc90524), SPH_C32(0x97530000), SPH_C32(0x204f6ed3), + SPH_C32(0x77b9e80f), SPH_C32(0xa1ec5ec1) }, + { SPH_C32(0x9dbf3000), SPH_C32(0xee7cca82), SPH_C32(0x9907277c), + SPH_C32(0x232f87b6), SPH_C32(0x5cfa0000), SPH_C32(0xb06859ba), + SPH_C32(0xcc651c08), SPH_C32(0x7118f1a0) }, + { SPH_C32(0x22832000), SPH_C32(0x2470bb95), SPH_C32(0xaa26ce50), + SPH_C32(0xed3daa45), SPH_C32(0x286f1000), SPH_C32(0xea431fc4), + SPH_C32(0x44980123), SPH_C32(0x6ffe7332) }, + { SPH_C32(0x56163000), SPH_C32(0x7e5bfdeb), SPH_C32(0x22dbd37b), + SPH_C32(0xf3db28d7), SPH_C32(0xe3c61000), SPH_C32(0x7a6428ad), + SPH_C32(0xff44f524), SPH_C32(0xbf0adc53) }, + { SPH_C32(0x97530000), SPH_C32(0x204f6ed3), SPH_C32(0x77b9e80f), + SPH_C32(0xa1ec5ec1), SPH_C32(0x7e792000), SPH_C32(0x9418e22f), + SPH_C32(0x6643d258), SPH_C32(0x9c255be5) }, + { SPH_C32(0xe3c61000), SPH_C32(0x7a6428ad), SPH_C32(0xff44f524), + SPH_C32(0xbf0adc53), SPH_C32(0xb5d02000), SPH_C32(0x043fd546), + SPH_C32(0xdd9f265f), SPH_C32(0x4cd1f484) }, + { SPH_C32(0x5cfa0000), SPH_C32(0xb06859ba), SPH_C32(0xcc651c08), + SPH_C32(0x7118f1a0), SPH_C32(0xc1453000), SPH_C32(0x5e149338), + SPH_C32(0x55623b74), SPH_C32(0x52377616) }, + { SPH_C32(0x286f1000), SPH_C32(0xea431fc4), SPH_C32(0x44980123), + SPH_C32(0x6ffe7332), SPH_C32(0x0aec3000), SPH_C32(0xce33a451), + SPH_C32(0xeebecf73), SPH_C32(0x82c3d977) }, + { SPH_C32(0x7e792000), SPH_C32(0x9418e22f), SPH_C32(0x6643d258), + SPH_C32(0x9c255be5), SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), + SPH_C32(0x11fa3a57), SPH_C32(0x3dc90524) }, + { SPH_C32(0x0aec3000), SPH_C32(0xce33a451), SPH_C32(0xeebecf73), + SPH_C32(0x82c3d977), SPH_C32(0x22832000), SPH_C32(0x2470bb95), + SPH_C32(0xaa26ce50), SPH_C32(0xed3daa45) }, + { SPH_C32(0xb5d02000), SPH_C32(0x043fd546), SPH_C32(0xdd9f265f), + SPH_C32(0x4cd1f484), SPH_C32(0x56163000), SPH_C32(0x7e5bfdeb), + SPH_C32(0x22dbd37b), SPH_C32(0xf3db28d7) }, + { SPH_C32(0xc1453000), SPH_C32(0x5e149338), SPH_C32(0x55623b74), + SPH_C32(0x52377616), SPH_C32(0x9dbf3000), SPH_C32(0xee7cca82), + SPH_C32(0x9907277c), SPH_C32(0x232f87b6) } +}; + +static const sph_u32 T256_8[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), SPH_C32(0x6fc548e1), + SPH_C32(0x898d2cd6), SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), + SPH_C32(0x6a72e5bb), SPH_C32(0x247febe6) }, + { SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), SPH_C32(0x6a72e5bb), + SPH_C32(0x247febe6), SPH_C32(0x9b830400), SPH_C32(0x2227ff88), + SPH_C32(0x05b7ad5a), SPH_C32(0xadf2c730) }, + { SPH_C32(0x9b830400), SPH_C32(0x2227ff88), SPH_C32(0x05b7ad5a), + SPH_C32(0xadf2c730), SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), + SPH_C32(0x6fc548e1), SPH_C32(0x898d2cd6) }, + { SPH_C32(0xde320800), SPH_C32(0x288350fe), SPH_C32(0x71852ac7), + SPH_C32(0xa6bf9f96), SPH_C32(0xe18b0000), SPH_C32(0x5459887d), + SPH_C32(0xbf1283d3), SPH_C32(0x1b666a73) }, + { SPH_C32(0x510c0c00), SPH_C32(0x251e9889), SPH_C32(0x1e406226), + SPH_C32(0x2f32b340), SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), + SPH_C32(0xd5606668), SPH_C32(0x3f198195) }, + { SPH_C32(0xca8f0800), SPH_C32(0x07396701), SPH_C32(0x1bf7cf7c), + SPH_C32(0x82c07470), SPH_C32(0x7a080400), SPH_C32(0x767e77f5), + SPH_C32(0xbaa52e89), SPH_C32(0xb694ad43) }, + { SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), SPH_C32(0x7432879d), + SPH_C32(0x0b4d58a6), SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), + SPH_C32(0xd0d7cb32), SPH_C32(0x92eb46a5) }, + { SPH_C32(0xe18b0000), SPH_C32(0x5459887d), SPH_C32(0xbf1283d3), + SPH_C32(0x1b666a73), SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), + SPH_C32(0xce97a914), SPH_C32(0xbdd9f5e5) }, + { SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), SPH_C32(0xd0d7cb32), + SPH_C32(0x92eb46a5), SPH_C32(0x2b040800), SPH_C32(0x5360ef7c), + SPH_C32(0xa4e54caf), SPH_C32(0x99a61e03) }, + { SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), SPH_C32(0xd5606668), + SPH_C32(0x3f198195), SPH_C32(0xa43a0c00), SPH_C32(0x5efd270b), + SPH_C32(0xcb20044e), SPH_C32(0x102b32d5) }, + { SPH_C32(0x7a080400), SPH_C32(0x767e77f5), SPH_C32(0xbaa52e89), + SPH_C32(0xb694ad43), SPH_C32(0xb0870c00), SPH_C32(0x714710f4), + SPH_C32(0xa152e1f5), SPH_C32(0x3454d933) }, + { SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), SPH_C32(0xce97a914), + SPH_C32(0xbdd9f5e5), SPH_C32(0xde320800), SPH_C32(0x288350fe), + SPH_C32(0x71852ac7), SPH_C32(0xa6bf9f96) }, + { SPH_C32(0xb0870c00), SPH_C32(0x714710f4), SPH_C32(0xa152e1f5), + SPH_C32(0x3454d933), SPH_C32(0xca8f0800), SPH_C32(0x07396701), + SPH_C32(0x1bf7cf7c), SPH_C32(0x82c07470) }, + { SPH_C32(0x2b040800), SPH_C32(0x5360ef7c), SPH_C32(0xa4e54caf), + SPH_C32(0x99a61e03), SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), + SPH_C32(0x7432879d), SPH_C32(0x0b4d58a6) }, + { SPH_C32(0xa43a0c00), SPH_C32(0x5efd270b), SPH_C32(0xcb20044e), + SPH_C32(0x102b32d5), SPH_C32(0x510c0c00), SPH_C32(0x251e9889), + SPH_C32(0x1e406226), SPH_C32(0x2f32b340) } +}; + +static const sph_u32 T256_12[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), SPH_C32(0x8589d8ab), + SPH_C32(0xe6c46464), SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), + SPH_C32(0xa29d1297), SPH_C32(0x6ee56854) }, + { SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), SPH_C32(0xa29d1297), + SPH_C32(0x6ee56854), SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), + SPH_C32(0x2714ca3c), SPH_C32(0x88210c30) }, + { SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), SPH_C32(0x2714ca3c), + SPH_C32(0x88210c30), SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), + SPH_C32(0x8589d8ab), SPH_C32(0xe6c46464) }, + { SPH_C32(0xa7b80200), SPH_C32(0x1f128433), SPH_C32(0x60e5f9f2), + SPH_C32(0x9e147576), SPH_C32(0xee260000), SPH_C32(0x124b683e), + SPH_C32(0x80c2d68f), SPH_C32(0x3bf3ab2c) }, + { SPH_C32(0x101c0300), SPH_C32(0x950db5eb), SPH_C32(0xe56c2159), + SPH_C32(0x78d01112), SPH_C32(0x9d6a0000), SPH_C32(0x8724cfe8), + SPH_C32(0x225fc418), SPH_C32(0x5516c378) }, + { SPH_C32(0xd4f40200), SPH_C32(0x8a7d23e5), SPH_C32(0xc278eb65), + SPH_C32(0xf0f11d22), SPH_C32(0x2ace0100), SPH_C32(0x0d3bfe30), + SPH_C32(0xa7d61cb3), SPH_C32(0xb3d2a71c) }, + { SPH_C32(0x63500300), SPH_C32(0x0062123d), SPH_C32(0x47f133ce), + SPH_C32(0x16357946), SPH_C32(0x59820100), SPH_C32(0x985459e6), + SPH_C32(0x054b0e24), SPH_C32(0xdd37cf48) }, + { SPH_C32(0xee260000), SPH_C32(0x124b683e), SPH_C32(0x80c2d68f), + SPH_C32(0x3bf3ab2c), SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), + SPH_C32(0xe0272f7d), SPH_C32(0xa5e7de5a) }, + { SPH_C32(0x59820100), SPH_C32(0x985459e6), SPH_C32(0x054b0e24), + SPH_C32(0xdd37cf48), SPH_C32(0x3ad20200), SPH_C32(0x98364bdb), + SPH_C32(0x42ba3dea), SPH_C32(0xcb02b60e) }, + { SPH_C32(0x9d6a0000), SPH_C32(0x8724cfe8), SPH_C32(0x225fc418), + SPH_C32(0x5516c378), SPH_C32(0x8d760300), SPH_C32(0x12297a03), + SPH_C32(0xc733e541), SPH_C32(0x2dc6d26a) }, + { SPH_C32(0x2ace0100), SPH_C32(0x0d3bfe30), SPH_C32(0xa7d61cb3), + SPH_C32(0xb3d2a71c), SPH_C32(0xfe3a0300), SPH_C32(0x8746ddd5), + SPH_C32(0x65aef7d6), SPH_C32(0x4323ba3e) }, + { SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), SPH_C32(0xe0272f7d), + SPH_C32(0xa5e7de5a), SPH_C32(0xa7b80200), SPH_C32(0x1f128433), + SPH_C32(0x60e5f9f2), SPH_C32(0x9e147576) }, + { SPH_C32(0xfe3a0300), SPH_C32(0x8746ddd5), SPH_C32(0x65aef7d6), + SPH_C32(0x4323ba3e), SPH_C32(0xd4f40200), SPH_C32(0x8a7d23e5), + SPH_C32(0xc278eb65), SPH_C32(0xf0f11d22) }, + { SPH_C32(0x3ad20200), SPH_C32(0x98364bdb), SPH_C32(0x42ba3dea), + SPH_C32(0xcb02b60e), SPH_C32(0x63500300), SPH_C32(0x0062123d), + SPH_C32(0x47f133ce), SPH_C32(0x16357946) }, + { SPH_C32(0x8d760300), SPH_C32(0x12297a03), SPH_C32(0xc733e541), + SPH_C32(0x2dc6d26a), SPH_C32(0x101c0300), SPH_C32(0x950db5eb), + SPH_C32(0xe56c2159), SPH_C32(0x78d01112) } +}; + +static const sph_u32 T256_16[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), SPH_C32(0x36656ba8), + SPH_C32(0x23633a05), SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), + SPH_C32(0x5d5ca0f7), SPH_C32(0x727784cb) }, + { SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), SPH_C32(0x5d5ca0f7), + SPH_C32(0x727784cb), SPH_C32(0x35650040), SPH_C32(0x9b96b64a), + SPH_C32(0x6b39cb5f), SPH_C32(0x5114bece) }, + { SPH_C32(0x35650040), SPH_C32(0x9b96b64a), SPH_C32(0x6b39cb5f), + SPH_C32(0x5114bece), SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), + SPH_C32(0x36656ba8), SPH_C32(0x23633a05) }, + { SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), SPH_C32(0xc2c46c55), + SPH_C32(0xf362b233), SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), + SPH_C32(0xd14e094b), SPH_C32(0xb772b42b) }, + { SPH_C32(0x161c00c0), SPH_C32(0x7e54f492), SPH_C32(0xf4a107fd), + SPH_C32(0xd0018836), SPH_C32(0x410d0000), SPH_C32(0xea7a09df), + SPH_C32(0x8c12a9bc), SPH_C32(0xc50530e0) }, + { SPH_C32(0x23790080), SPH_C32(0xe5c242d8), SPH_C32(0x9f98cca2), + SPH_C32(0x811536f8), SPH_C32(0x0cc30040), SPH_C32(0xd121e5a1), + SPH_C32(0xba77c214), SPH_C32(0xe6660ae5) }, + { SPH_C32(0x6eb700c0), SPH_C32(0xde99aea6), SPH_C32(0xa9fda70a), + SPH_C32(0xa2760cfd), SPH_C32(0x74680040), SPH_C32(0x71ecbf95), + SPH_C32(0xe72b62e3), SPH_C32(0x94118e2e) }, + { SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), SPH_C32(0xd14e094b), + SPH_C32(0xb772b42b), SPH_C32(0x62740080), SPH_C32(0x0fb84b07), + SPH_C32(0x138a651e), SPH_C32(0x44100618) }, + { SPH_C32(0x74680040), SPH_C32(0x71ecbf95), SPH_C32(0xe72b62e3), + SPH_C32(0x94118e2e), SPH_C32(0x1adf0080), SPH_C32(0xaf751133), + SPH_C32(0x4ed6c5e9), SPH_C32(0x366782d3) }, + { SPH_C32(0x410d0000), SPH_C32(0xea7a09df), SPH_C32(0x8c12a9bc), + SPH_C32(0xc50530e0), SPH_C32(0x571100c0), SPH_C32(0x942efd4d), + SPH_C32(0x78b3ae41), SPH_C32(0x1504b8d6) }, + { SPH_C32(0x0cc30040), SPH_C32(0xd121e5a1), SPH_C32(0xba77c214), + SPH_C32(0xe6660ae5), SPH_C32(0x2fba00c0), SPH_C32(0x34e3a779), + SPH_C32(0x25ef0eb6), SPH_C32(0x67733c1d) }, + { SPH_C32(0x62740080), SPH_C32(0x0fb84b07), SPH_C32(0x138a651e), + SPH_C32(0x44100618), SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), + SPH_C32(0xc2c46c55), SPH_C32(0xf362b233) }, + { SPH_C32(0x2fba00c0), SPH_C32(0x34e3a779), SPH_C32(0x25ef0eb6), + SPH_C32(0x67733c1d), SPH_C32(0x23790080), SPH_C32(0xe5c242d8), + SPH_C32(0x9f98cca2), SPH_C32(0x811536f8) }, + { SPH_C32(0x1adf0080), SPH_C32(0xaf751133), SPH_C32(0x4ed6c5e9), + SPH_C32(0x366782d3), SPH_C32(0x6eb700c0), SPH_C32(0xde99aea6), + SPH_C32(0xa9fda70a), SPH_C32(0xa2760cfd) }, + { SPH_C32(0x571100c0), SPH_C32(0x942efd4d), SPH_C32(0x78b3ae41), + SPH_C32(0x1504b8d6), SPH_C32(0x161c00c0), SPH_C32(0x7e54f492), + SPH_C32(0xf4a107fd), SPH_C32(0xd0018836) } +}; + +static const sph_u32 T256_20[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x515c0010), SPH_C32(0x40f372fb), SPH_C32(0xfce72602), + SPH_C32(0x71575061), SPH_C32(0x2e390000), SPH_C32(0x64dd6689), + SPH_C32(0x3cd406fc), SPH_C32(0xb1f490bc) }, + { SPH_C32(0x2e390000), SPH_C32(0x64dd6689), SPH_C32(0x3cd406fc), + SPH_C32(0xb1f490bc), SPH_C32(0x7f650010), SPH_C32(0x242e1472), + SPH_C32(0xc03320fe), SPH_C32(0xc0a3c0dd) }, + { SPH_C32(0x7f650010), SPH_C32(0x242e1472), SPH_C32(0xc03320fe), + SPH_C32(0xc0a3c0dd), SPH_C32(0x515c0010), SPH_C32(0x40f372fb), + SPH_C32(0xfce72602), SPH_C32(0x71575061) }, + { SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), SPH_C32(0xf9ce4c04), + SPH_C32(0xe2afa0c0), SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), + SPH_C32(0x79a90df9), SPH_C32(0x63e92178) }, + { SPH_C32(0xf3e40030), SPH_C32(0xc114970d), SPH_C32(0x05296a06), + SPH_C32(0x93f8f0a1), SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), + SPH_C32(0x457d0b05), SPH_C32(0xd21db1c4) }, + { SPH_C32(0x8c810020), SPH_C32(0xe53a837f), SPH_C32(0xc51a4af8), + SPH_C32(0x535b307c), SPH_C32(0x23170010), SPH_C32(0xed94d960), + SPH_C32(0xb99a2d07), SPH_C32(0xa34ae1a5) }, + { SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), SPH_C32(0x39fd6cfa), + SPH_C32(0x220c601d), SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), + SPH_C32(0x854e2bfb), SPH_C32(0x12be7119) }, + { SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), SPH_C32(0x79a90df9), + SPH_C32(0x63e92178), SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), + SPH_C32(0x806741fd), SPH_C32(0x814681b8) }, + { SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), SPH_C32(0x854e2bfb), + SPH_C32(0x12be7119), SPH_C32(0xd0f30020), SPH_C32(0x2c804e6d), + SPH_C32(0xbcb34701), SPH_C32(0x30b21104) }, + { SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), SPH_C32(0x457d0b05), + SPH_C32(0xd21db1c4), SPH_C32(0x81af0030), SPH_C32(0x6c733c96), + SPH_C32(0x40546103), SPH_C32(0x41e54165) }, + { SPH_C32(0x23170010), SPH_C32(0xed94d960), SPH_C32(0xb99a2d07), + SPH_C32(0xa34ae1a5), SPH_C32(0xaf960030), SPH_C32(0x08ae5a1f), + SPH_C32(0x7c8067ff), SPH_C32(0xf011d1d9) }, + { SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), SPH_C32(0x806741fd), + SPH_C32(0x814681b8), SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), + SPH_C32(0xf9ce4c04), SPH_C32(0xe2afa0c0) }, + { SPH_C32(0xaf960030), SPH_C32(0x08ae5a1f), SPH_C32(0x7c8067ff), + SPH_C32(0xf011d1d9), SPH_C32(0x8c810020), SPH_C32(0xe53a837f), + SPH_C32(0xc51a4af8), SPH_C32(0x535b307c) }, + { SPH_C32(0xd0f30020), SPH_C32(0x2c804e6d), SPH_C32(0xbcb34701), + SPH_C32(0x30b21104), SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), + SPH_C32(0x39fd6cfa), SPH_C32(0x220c601d) }, + { SPH_C32(0x81af0030), SPH_C32(0x6c733c96), SPH_C32(0x40546103), + SPH_C32(0x41e54165), SPH_C32(0xf3e40030), SPH_C32(0xc114970d), + SPH_C32(0x05296a06), SPH_C32(0x93f8f0a1) } +}; + +static const sph_u32 T256_24[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xd0080004), SPH_C32(0x8c768f77), SPH_C32(0x9dc5b050), + SPH_C32(0xaf4a29da), SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), + SPH_C32(0x98321c3d), SPH_C32(0x76acc733) }, + { SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), SPH_C32(0x98321c3d), + SPH_C32(0x76acc733), SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), + SPH_C32(0x05f7ac6d), SPH_C32(0xd9e6eee9) }, + { SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), SPH_C32(0x05f7ac6d), + SPH_C32(0xd9e6eee9), SPH_C32(0xd0080004), SPH_C32(0x8c768f77), + SPH_C32(0x9dc5b050), SPH_C32(0xaf4a29da) }, + { SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), SPH_C32(0xfe739301), + SPH_C32(0xb8a92831), SPH_C32(0x171c0000), SPH_C32(0xb26e3344), + SPH_C32(0x9e6a837e), SPH_C32(0x58f8485f) }, + { SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), SPH_C32(0x63b62351), + SPH_C32(0x17e301eb), SPH_C32(0x7cb50000), SPH_C32(0xf285caee), + SPH_C32(0x06589f43), SPH_C32(0x2e548f6c) }, + { SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), SPH_C32(0x66418f3c), + SPH_C32(0xce05ef02), SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), + SPH_C32(0x9b9d2f13), SPH_C32(0x811ea6b6) }, + { SPH_C32(0x130f000c), SPH_C32(0xece44fa0), SPH_C32(0xfb843f6c), + SPH_C32(0x614fc6d8), SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), + SPH_C32(0x03af332e), SPH_C32(0xf7b26185) }, + { SPH_C32(0x171c0000), SPH_C32(0xb26e3344), SPH_C32(0x9e6a837e), + SPH_C32(0x58f8485f), SPH_C32(0xbfb20008), SPH_C32(0x92170a39), + SPH_C32(0x6019107f), SPH_C32(0xe051606e) }, + { SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), SPH_C32(0x03af332e), + SPH_C32(0xf7b26185), SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), + SPH_C32(0xf82b0c42), SPH_C32(0x96fda75d) }, + { SPH_C32(0x7cb50000), SPH_C32(0xf285caee), SPH_C32(0x06589f43), + SPH_C32(0x2e548f6c), SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), + SPH_C32(0x65eebc12), SPH_C32(0x39b78e87) }, + { SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), SPH_C32(0x9b9d2f13), + SPH_C32(0x811ea6b6), SPH_C32(0x6fba000c), SPH_C32(0x1e61854e), + SPH_C32(0xfddca02f), SPH_C32(0x4f1b49b4) }, + { SPH_C32(0xbfb20008), SPH_C32(0x92170a39), SPH_C32(0x6019107f), + SPH_C32(0xe051606e), SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), + SPH_C32(0xfe739301), SPH_C32(0xb8a92831) }, + { SPH_C32(0x6fba000c), SPH_C32(0x1e61854e), SPH_C32(0xfddca02f), + SPH_C32(0x4f1b49b4), SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), + SPH_C32(0x66418f3c), SPH_C32(0xce05ef02) }, + { SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), SPH_C32(0xf82b0c42), + SPH_C32(0x96fda75d), SPH_C32(0x130f000c), SPH_C32(0xece44fa0), + SPH_C32(0xfb843f6c), SPH_C32(0x614fc6d8) }, + { SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), SPH_C32(0x65eebc12), + SPH_C32(0x39b78e87), SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), + SPH_C32(0x63b62351), SPH_C32(0x17e301eb) } +}; + +static const sph_u32 T256_28[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), SPH_C32(0xae0ebb05), + SPH_C32(0xb5a4c63b), SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), + SPH_C32(0x6bf648a4), SPH_C32(0x539cbdbf) }, + { SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), SPH_C32(0x6bf648a4), + SPH_C32(0x539cbdbf), SPH_C32(0x08bf0001), SPH_C32(0x38942792), + SPH_C32(0xc5f8f3a1), SPH_C32(0xe6387b84) }, + { SPH_C32(0x08bf0001), SPH_C32(0x38942792), SPH_C32(0xc5f8f3a1), + SPH_C32(0xe6387b84), SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), + SPH_C32(0xae0ebb05), SPH_C32(0xb5a4c63b) }, + { SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), SPH_C32(0x99e585aa), + SPH_C32(0x8d75f7f1), SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), + SPH_C32(0x79e22a4c), SPH_C32(0x1298bd46) }, + { SPH_C32(0x486d0003), SPH_C32(0x6c5e67a3), SPH_C32(0x37eb3eaf), + SPH_C32(0x38d131ca), SPH_C32(0x995d0000), SPH_C32(0x2ecee896), + SPH_C32(0x121462e8), SPH_C32(0x410400f9) }, + { SPH_C32(0x40d20002), SPH_C32(0x54ca4031), SPH_C32(0xf213cd0e), + SPH_C32(0xdee94a4e), SPH_C32(0x59130001), SPH_C32(0x1d772886), + SPH_C32(0xbc1ad9ed), SPH_C32(0xf4a0c6c2) }, + { SPH_C32(0x809c0003), SPH_C32(0x67738021), SPH_C32(0x5c1d760b), + SPH_C32(0x6b4d8c75), SPH_C32(0x91e20001), SPH_C32(0x165acf04), + SPH_C32(0xd7ec9149), SPH_C32(0xa73c7b7d) }, + { SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), SPH_C32(0x79e22a4c), + SPH_C32(0x1298bd46), SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), + SPH_C32(0xe007afe6), SPH_C32(0x9fed4ab7) }, + { SPH_C32(0x91e20001), SPH_C32(0x165acf04), SPH_C32(0xd7ec9149), + SPH_C32(0xa73c7b7d), SPH_C32(0x117e0002), SPH_C32(0x71294f25), + SPH_C32(0x8bf1e742), SPH_C32(0xcc71f708) }, + { SPH_C32(0x995d0000), SPH_C32(0x2ecee896), SPH_C32(0x121462e8), + SPH_C32(0x410400f9), SPH_C32(0xd1300003), SPH_C32(0x42908f35), + SPH_C32(0x25ff5c47), SPH_C32(0x79d53133) }, + { SPH_C32(0x59130001), SPH_C32(0x1d772886), SPH_C32(0xbc1ad9ed), + SPH_C32(0xf4a0c6c2), SPH_C32(0x19c10003), SPH_C32(0x49bd68b7), + SPH_C32(0x4e0914e3), SPH_C32(0x2a498c8c) }, + { SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), SPH_C32(0xe007afe6), + SPH_C32(0x9fed4ab7), SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), + SPH_C32(0x99e585aa), SPH_C32(0x8d75f7f1) }, + { SPH_C32(0x19c10003), SPH_C32(0x49bd68b7), SPH_C32(0x4e0914e3), + SPH_C32(0x2a498c8c), SPH_C32(0x40d20002), SPH_C32(0x54ca4031), + SPH_C32(0xf213cd0e), SPH_C32(0xdee94a4e) }, + { SPH_C32(0x117e0002), SPH_C32(0x71294f25), SPH_C32(0x8bf1e742), + SPH_C32(0xcc71f708), SPH_C32(0x809c0003), SPH_C32(0x67738021), + SPH_C32(0x5c1d760b), SPH_C32(0x6b4d8c75) }, + { SPH_C32(0xd1300003), SPH_C32(0x42908f35), SPH_C32(0x25ff5c47), + SPH_C32(0x79d53133), SPH_C32(0x486d0003), SPH_C32(0x6c5e67a3), + SPH_C32(0x37eb3eaf), SPH_C32(0x38d131ca) } +}; + +#define INPUT_SMALL do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T256_0[acc >> 4][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + rp = &T256_4[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[1]; \ + rp = &T256_8[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_12[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[2]; \ + rp = &T256_16[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_20[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[3]; \ + rp = &T256_24[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_28[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_SMALL == 5 + +static const sph_u32 T256_0[32][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x97530000), SPH_C32(0x204f6ed3), SPH_C32(0x77b9e80f), + SPH_C32(0xa1ec5ec1), SPH_C32(0x7e792000), SPH_C32(0x9418e22f), + SPH_C32(0x6643d258), SPH_C32(0x9c255be5) }, + { SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), SPH_C32(0x8dfacfab), + SPH_C32(0xce36cc72), SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), + SPH_C32(0x848598ba), SPH_C32(0x1041003e) }, + { SPH_C32(0x85484000), SPH_C32(0x7b58b73b), SPH_C32(0xfa4327a4), + SPH_C32(0x6fda92b3), SPH_C32(0x982e2000), SPH_C32(0xdfabd80a), + SPH_C32(0xe2c64ae2), SPH_C32(0x8c645bdb) }, + { SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), SPH_C32(0x848598ba), + SPH_C32(0x1041003e), SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), + SPH_C32(0x097f5711), SPH_C32(0xde77cc4c) }, + { SPH_C32(0x71040000), SPH_C32(0x6bfc54f6), SPH_C32(0xf33c70b5), + SPH_C32(0xb1ad5eff), SPH_C32(0x8a356000), SPH_C32(0x84bc01e2), + SPH_C32(0x6f3c8549), SPH_C32(0x425297a9) }, + { SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), SPH_C32(0x097f5711), + SPH_C32(0xde77cc4c), SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), + SPH_C32(0x8dfacfab), SPH_C32(0xce36cc72) }, + { SPH_C32(0x631f4000), SPH_C32(0x30eb8d1e), SPH_C32(0x7ec6bf1e), + SPH_C32(0x7f9b928d), SPH_C32(0x6c626000), SPH_C32(0xcf0f3bc7), + SPH_C32(0xebb91df3), SPH_C32(0x52139797) }, + { SPH_C32(0xe4788000), SPH_C32(0x859673c1), SPH_C32(0xb5fb2452), + SPH_C32(0x29cc5edf), SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), + SPH_C32(0x62fc79d0), SPH_C32(0x731ebdc2) }, + { SPH_C32(0x732b8000), SPH_C32(0xa5d91d12), SPH_C32(0xc242cc5d), + SPH_C32(0x8820001e), SPH_C32(0x7a262000), SPH_C32(0x085271e6), + SPH_C32(0x04bfab88), SPH_C32(0xef3be627) }, + { SPH_C32(0xf663c000), SPH_C32(0xde81aa29), SPH_C32(0x3801ebf9), + SPH_C32(0xe7fa92ad), SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), + SPH_C32(0xe679e16a), SPH_C32(0x635fbdfc) }, + { SPH_C32(0x6130c000), SPH_C32(0xfecec4fa), SPH_C32(0x4fb803f6), + SPH_C32(0x4616cc6c), SPH_C32(0x9c712000), SPH_C32(0x43e14bc3), + SPH_C32(0x803a3332), SPH_C32(0xff7ae619) }, + { SPH_C32(0x022f8000), SPH_C32(0xce2549e4), SPH_C32(0x317ebce8), + SPH_C32(0x398d5ee1), SPH_C32(0xf0134000), SPH_C32(0x8cee7004), + SPH_C32(0x6b832ec1), SPH_C32(0xad69718e) }, + { SPH_C32(0x957c8000), SPH_C32(0xee6a2737), SPH_C32(0x46c754e7), + SPH_C32(0x98610020), SPH_C32(0x8e6a6000), SPH_C32(0x18f6922b), + SPH_C32(0x0dc0fc99), SPH_C32(0x314c2a6b) }, + { SPH_C32(0x1034c000), SPH_C32(0x9532900c), SPH_C32(0xbc847343), + SPH_C32(0xf7bb9293), SPH_C32(0x16444000), SPH_C32(0xc75d4a21), + SPH_C32(0xef06b67b), SPH_C32(0xbd2871b0) }, + { SPH_C32(0x8767c000), SPH_C32(0xb57dfedf), SPH_C32(0xcb3d9b4c), + SPH_C32(0x5657cc52), SPH_C32(0x683d6000), SPH_C32(0x5345a80e), + SPH_C32(0x89456423), SPH_C32(0x210d2a55) }, + { SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), SPH_C32(0x62fc79d0), + SPH_C32(0x731ebdc2), SPH_C32(0xe0278000), SPH_C32(0x19dce008), + SPH_C32(0xd7075d82), SPH_C32(0x5ad2e31d) }, + { SPH_C32(0x930c0000), SPH_C32(0xbc05fd1a), SPH_C32(0x154591df), + SPH_C32(0xd2f2e303), SPH_C32(0x9e5ea000), SPH_C32(0x8dc40227), + SPH_C32(0xb1448fda), SPH_C32(0xc6f7b8f8) }, + { SPH_C32(0x16444000), SPH_C32(0xc75d4a21), SPH_C32(0xef06b67b), + SPH_C32(0xbd2871b0), SPH_C32(0x06708000), SPH_C32(0x526fda2d), + SPH_C32(0x5382c538), SPH_C32(0x4a93e323) }, + { SPH_C32(0x81174000), SPH_C32(0xe71224f2), SPH_C32(0x98bf5e74), + SPH_C32(0x1cc42f71), SPH_C32(0x7809a000), SPH_C32(0xc6773802), + SPH_C32(0x35c11760), SPH_C32(0xd6b6b8c6) }, + { SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), SPH_C32(0xe679e16a), + SPH_C32(0x635fbdfc), SPH_C32(0x146bc000), SPH_C32(0x097803c5), + SPH_C32(0xde780a93), SPH_C32(0x84a52f51) }, + { SPH_C32(0x755b0000), SPH_C32(0xf7b6c73f), SPH_C32(0x91c00965), + SPH_C32(0xc2b3e33d), SPH_C32(0x6a12e000), SPH_C32(0x9d60e1ea), + SPH_C32(0xb83bd8cb), SPH_C32(0x188074b4) }, + { SPH_C32(0xf0134000), SPH_C32(0x8cee7004), SPH_C32(0x6b832ec1), + SPH_C32(0xad69718e), SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), + SPH_C32(0x5afd9229), SPH_C32(0x94e42f6f) }, + { SPH_C32(0x67404000), SPH_C32(0xaca11ed7), SPH_C32(0x1c3ac6ce), + SPH_C32(0x0c852f4f), SPH_C32(0x8c45e000), SPH_C32(0xd6d3dbcf), + SPH_C32(0x3cbe4071), SPH_C32(0x08c1748a) }, + { SPH_C32(0xe0278000), SPH_C32(0x19dce008), SPH_C32(0xd7075d82), + SPH_C32(0x5ad2e31d), SPH_C32(0xe4788000), SPH_C32(0x859673c1), + SPH_C32(0xb5fb2452), SPH_C32(0x29cc5edf) }, + { SPH_C32(0x77748000), SPH_C32(0x39938edb), SPH_C32(0xa0beb58d), + SPH_C32(0xfb3ebddc), SPH_C32(0x9a01a000), SPH_C32(0x118e91ee), + SPH_C32(0xd3b8f60a), SPH_C32(0xb5e9053a) }, + { SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), SPH_C32(0x5afd9229), + SPH_C32(0x94e42f6f), SPH_C32(0x022f8000), SPH_C32(0xce2549e4), + SPH_C32(0x317ebce8), SPH_C32(0x398d5ee1) }, + { SPH_C32(0x656fc000), SPH_C32(0x62845733), SPH_C32(0x2d447a26), + SPH_C32(0x350871ae), SPH_C32(0x7c56a000), SPH_C32(0x5a3dabcb), + SPH_C32(0x573d6eb0), SPH_C32(0xa5a80504) }, + { SPH_C32(0x06708000), SPH_C32(0x526fda2d), SPH_C32(0x5382c538), + SPH_C32(0x4a93e323), SPH_C32(0x1034c000), SPH_C32(0x9532900c), + SPH_C32(0xbc847343), SPH_C32(0xf7bb9293) }, + { SPH_C32(0x91238000), SPH_C32(0x7220b4fe), SPH_C32(0x243b2d37), + SPH_C32(0xeb7fbde2), SPH_C32(0x6e4de000), SPH_C32(0x012a7223), + SPH_C32(0xdac7a11b), SPH_C32(0x6b9ec976) }, + { SPH_C32(0x146bc000), SPH_C32(0x097803c5), SPH_C32(0xde780a93), + SPH_C32(0x84a52f51), SPH_C32(0xf663c000), SPH_C32(0xde81aa29), + SPH_C32(0x3801ebf9), SPH_C32(0xe7fa92ad) }, + { SPH_C32(0x8338c000), SPH_C32(0x29376d16), SPH_C32(0xa9c1e29c), + SPH_C32(0x25497190), SPH_C32(0x881ae000), SPH_C32(0x4a994806), + SPH_C32(0x5e4239a1), SPH_C32(0x7bdfc948) } +}; + +static const sph_u32 T256_5[32][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xde320800), SPH_C32(0x288350fe), SPH_C32(0x71852ac7), + SPH_C32(0xa6bf9f96), SPH_C32(0xe18b0000), SPH_C32(0x5459887d), + SPH_C32(0xbf1283d3), SPH_C32(0x1b666a73) }, + { SPH_C32(0xe18b0000), SPH_C32(0x5459887d), SPH_C32(0xbf1283d3), + SPH_C32(0x1b666a73), SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), + SPH_C32(0xce97a914), SPH_C32(0xbdd9f5e5) }, + { SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), SPH_C32(0xce97a914), + SPH_C32(0xbdd9f5e5), SPH_C32(0xde320800), SPH_C32(0x288350fe), + SPH_C32(0x71852ac7), SPH_C32(0xa6bf9f96) }, + { SPH_C32(0x74951000), SPH_C32(0x5a2b467e), SPH_C32(0x88fd1d2b), + SPH_C32(0x1ee68292), SPH_C32(0xcba90000), SPH_C32(0x90273769), + SPH_C32(0xbbdcf407), SPH_C32(0xd0f4af61) }, + { SPH_C32(0xaaa71800), SPH_C32(0x72a81680), SPH_C32(0xf97837ec), + SPH_C32(0xb8591d04), SPH_C32(0x2a220000), SPH_C32(0xc47ebf14), + SPH_C32(0x04ce77d4), SPH_C32(0xcb92c512) }, + { SPH_C32(0x951e1000), SPH_C32(0x0e72ce03), SPH_C32(0x37ef9ef8), + SPH_C32(0x0580e8e1), SPH_C32(0xf4100800), SPH_C32(0xecfdefea), + SPH_C32(0x754b5d13), SPH_C32(0x6d2d5a84) }, + { SPH_C32(0x4b2c1800), SPH_C32(0x26f19efd), SPH_C32(0x466ab43f), + SPH_C32(0xa33f7777), SPH_C32(0x159b0800), SPH_C32(0xb8a46797), + SPH_C32(0xca59dec0), SPH_C32(0x764b30f7) }, + { SPH_C32(0xcba90000), SPH_C32(0x90273769), SPH_C32(0xbbdcf407), + SPH_C32(0xd0f4af61), SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), + SPH_C32(0x3321e92c), SPH_C32(0xce122df3) }, + { SPH_C32(0x159b0800), SPH_C32(0xb8a46797), SPH_C32(0xca59dec0), + SPH_C32(0x764b30f7), SPH_C32(0x5eb71000), SPH_C32(0x9e55f96a), + SPH_C32(0x8c336aff), SPH_C32(0xd5744780) }, + { SPH_C32(0x2a220000), SPH_C32(0xc47ebf14), SPH_C32(0x04ce77d4), + SPH_C32(0xcb92c512), SPH_C32(0x80851800), SPH_C32(0xb6d6a994), + SPH_C32(0xfdb64038), SPH_C32(0x73cbd816) }, + { SPH_C32(0xf4100800), SPH_C32(0xecfdefea), SPH_C32(0x754b5d13), + SPH_C32(0x6d2d5a84), SPH_C32(0x610e1800), SPH_C32(0xe28f21e9), + SPH_C32(0x42a4c3eb), SPH_C32(0x68adb265) }, + { SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), SPH_C32(0x3321e92c), + SPH_C32(0xce122df3), SPH_C32(0x74951000), SPH_C32(0x5a2b467e), + SPH_C32(0x88fd1d2b), SPH_C32(0x1ee68292) }, + { SPH_C32(0x610e1800), SPH_C32(0xe28f21e9), SPH_C32(0x42a4c3eb), + SPH_C32(0x68adb265), SPH_C32(0x951e1000), SPH_C32(0x0e72ce03), + SPH_C32(0x37ef9ef8), SPH_C32(0x0580e8e1) }, + { SPH_C32(0x5eb71000), SPH_C32(0x9e55f96a), SPH_C32(0x8c336aff), + SPH_C32(0xd5744780), SPH_C32(0x4b2c1800), SPH_C32(0x26f19efd), + SPH_C32(0x466ab43f), SPH_C32(0xa33f7777) }, + { SPH_C32(0x80851800), SPH_C32(0xb6d6a994), SPH_C32(0xfdb64038), + SPH_C32(0x73cbd816), SPH_C32(0xaaa71800), SPH_C32(0x72a81680), + SPH_C32(0xf97837ec), SPH_C32(0xb8591d04) }, + { SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), SPH_C32(0x11fa3a57), + SPH_C32(0x3dc90524), SPH_C32(0x97530000), SPH_C32(0x204f6ed3), + SPH_C32(0x77b9e80f), SPH_C32(0xa1ec5ec1) }, + { SPH_C32(0x37182800), SPH_C32(0x9cd4dc02), SPH_C32(0x607f1090), + SPH_C32(0x9b769ab2), SPH_C32(0x76d80000), SPH_C32(0x7416e6ae), + SPH_C32(0xc8ab6bdc), SPH_C32(0xba8a34b2) }, + { SPH_C32(0x08a12000), SPH_C32(0xe00e0481), SPH_C32(0xaee8b984), + SPH_C32(0x26af6f57), SPH_C32(0xa8ea0800), SPH_C32(0x5c95b650), + SPH_C32(0xb92e411b), SPH_C32(0x1c35ab24) }, + { SPH_C32(0xd6932800), SPH_C32(0xc88d547f), SPH_C32(0xdf6d9343), + SPH_C32(0x8010f0c1), SPH_C32(0x49610800), SPH_C32(0x08cc3e2d), + SPH_C32(0x063cc2c8), SPH_C32(0x0753c157) }, + { SPH_C32(0x9dbf3000), SPH_C32(0xee7cca82), SPH_C32(0x9907277c), + SPH_C32(0x232f87b6), SPH_C32(0x5cfa0000), SPH_C32(0xb06859ba), + SPH_C32(0xcc651c08), SPH_C32(0x7118f1a0) }, + { SPH_C32(0x438d3800), SPH_C32(0xc6ff9a7c), SPH_C32(0xe8820dbb), + SPH_C32(0x85901820), SPH_C32(0xbd710000), SPH_C32(0xe431d1c7), + SPH_C32(0x73779fdb), SPH_C32(0x6a7e9bd3) }, + { SPH_C32(0x7c343000), SPH_C32(0xba2542ff), SPH_C32(0x2615a4af), + SPH_C32(0x3849edc5), SPH_C32(0x63430800), SPH_C32(0xccb28139), + SPH_C32(0x02f2b51c), SPH_C32(0xccc10445) }, + { SPH_C32(0xa2063800), SPH_C32(0x92a61201), SPH_C32(0x57908e68), + SPH_C32(0x9ef67253), SPH_C32(0x82c80800), SPH_C32(0x98eb0944), + SPH_C32(0xbde036cf), SPH_C32(0xd7a76e36) }, + { SPH_C32(0x22832000), SPH_C32(0x2470bb95), SPH_C32(0xaa26ce50), + SPH_C32(0xed3daa45), SPH_C32(0x286f1000), SPH_C32(0xea431fc4), + SPH_C32(0x44980123), SPH_C32(0x6ffe7332) }, + { SPH_C32(0xfcb12800), SPH_C32(0x0cf3eb6b), SPH_C32(0xdba3e497), + SPH_C32(0x4b8235d3), SPH_C32(0xc9e41000), SPH_C32(0xbe1a97b9), + SPH_C32(0xfb8a82f0), SPH_C32(0x74981941) }, + { SPH_C32(0xc3082000), SPH_C32(0x702933e8), SPH_C32(0x15344d83), + SPH_C32(0xf65bc036), SPH_C32(0x17d61800), SPH_C32(0x9699c747), + SPH_C32(0x8a0fa837), SPH_C32(0xd22786d7) }, + { SPH_C32(0x1d3a2800), SPH_C32(0x58aa6316), SPH_C32(0x64b16744), + SPH_C32(0x50e45fa0), SPH_C32(0xf65d1800), SPH_C32(0xc2c04f3a), + SPH_C32(0x351d2be4), SPH_C32(0xc941eca4) }, + { SPH_C32(0x56163000), SPH_C32(0x7e5bfdeb), SPH_C32(0x22dbd37b), + SPH_C32(0xf3db28d7), SPH_C32(0xe3c61000), SPH_C32(0x7a6428ad), + SPH_C32(0xff44f524), SPH_C32(0xbf0adc53) }, + { SPH_C32(0x88243800), SPH_C32(0x56d8ad15), SPH_C32(0x535ef9bc), + SPH_C32(0x5564b741), SPH_C32(0x024d1000), SPH_C32(0x2e3da0d0), + SPH_C32(0x405676f7), SPH_C32(0xa46cb620) }, + { SPH_C32(0xb79d3000), SPH_C32(0x2a027596), SPH_C32(0x9dc950a8), + SPH_C32(0xe8bd42a4), SPH_C32(0xdc7f1800), SPH_C32(0x06bef02e), + SPH_C32(0x31d35c30), SPH_C32(0x02d329b6) }, + { SPH_C32(0x69af3800), SPH_C32(0x02812568), SPH_C32(0xec4c7a6f), + SPH_C32(0x4e02dd32), SPH_C32(0x3df41800), SPH_C32(0x52e77853), + SPH_C32(0x8ec1dfe3), SPH_C32(0x19b543c5) } +}; + +static const sph_u32 T256_10[32][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), SPH_C32(0xa29d1297), + SPH_C32(0x6ee56854), SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), + SPH_C32(0x2714ca3c), SPH_C32(0x88210c30) }, + { SPH_C32(0xa7b80200), SPH_C32(0x1f128433), SPH_C32(0x60e5f9f2), + SPH_C32(0x9e147576), SPH_C32(0xee260000), SPH_C32(0x124b683e), + SPH_C32(0x80c2d68f), SPH_C32(0x3bf3ab2c) }, + { SPH_C32(0xd4f40200), SPH_C32(0x8a7d23e5), SPH_C32(0xc278eb65), + SPH_C32(0xf0f11d22), SPH_C32(0x2ace0100), SPH_C32(0x0d3bfe30), + SPH_C32(0xa7d61cb3), SPH_C32(0xb3d2a71c) }, + { SPH_C32(0xee260000), SPH_C32(0x124b683e), SPH_C32(0x80c2d68f), + SPH_C32(0x3bf3ab2c), SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), + SPH_C32(0xe0272f7d), SPH_C32(0xa5e7de5a) }, + { SPH_C32(0x9d6a0000), SPH_C32(0x8724cfe8), SPH_C32(0x225fc418), + SPH_C32(0x5516c378), SPH_C32(0x8d760300), SPH_C32(0x12297a03), + SPH_C32(0xc733e541), SPH_C32(0x2dc6d26a) }, + { SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), SPH_C32(0xe0272f7d), + SPH_C32(0xa5e7de5a), SPH_C32(0xa7b80200), SPH_C32(0x1f128433), + SPH_C32(0x60e5f9f2), SPH_C32(0x9e147576) }, + { SPH_C32(0x3ad20200), SPH_C32(0x98364bdb), SPH_C32(0x42ba3dea), + SPH_C32(0xcb02b60e), SPH_C32(0x63500300), SPH_C32(0x0062123d), + SPH_C32(0x47f133ce), SPH_C32(0x16357946) }, + { SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), SPH_C32(0x6fc548e1), + SPH_C32(0x898d2cd6), SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), + SPH_C32(0x6a72e5bb), SPH_C32(0x247febe6) }, + { SPH_C32(0xfc720400), SPH_C32(0x98f26fa1), SPH_C32(0xcd585a76), + SPH_C32(0xe7684482), SPH_C32(0xd0550100), SPH_C32(0x30caa1f1), + SPH_C32(0x4d662f87), SPH_C32(0xac5ee7d6) }, + { SPH_C32(0x28860600), SPH_C32(0x128f4c44), SPH_C32(0x0f20b113), + SPH_C32(0x179959a0), SPH_C32(0xfa9b0000), SPH_C32(0x3df15fc1), + SPH_C32(0xeab03334), SPH_C32(0x1f8c40ca) }, + { SPH_C32(0x5bca0600), SPH_C32(0x87e0eb92), SPH_C32(0xadbda384), + SPH_C32(0x797c31f4), SPH_C32(0x3e730100), SPH_C32(0x2281c9cf), + SPH_C32(0xcda4f908), SPH_C32(0x97ad4cfa) }, + { SPH_C32(0x61180400), SPH_C32(0x1fd6a049), SPH_C32(0xef079e6e), + SPH_C32(0xb27e87fa), SPH_C32(0x5d230200), SPH_C32(0x22e3dbf2), + SPH_C32(0x8a55cac6), SPH_C32(0x819835bc) }, + { SPH_C32(0x12540400), SPH_C32(0x8ab9079f), SPH_C32(0x4d9a8cf9), + SPH_C32(0xdc9befae), SPH_C32(0x99cb0300), SPH_C32(0x3d934dfc), + SPH_C32(0xad4100fa), SPH_C32(0x09b9398c) }, + { SPH_C32(0xc6a00600), SPH_C32(0x00c4247a), SPH_C32(0x8fe2679c), + SPH_C32(0x2c6af28c), SPH_C32(0xb3050200), SPH_C32(0x30a8b3cc), + SPH_C32(0x0a971c49), SPH_C32(0xba6b9e90) }, + { SPH_C32(0xb5ec0600), SPH_C32(0x95ab83ac), SPH_C32(0x2d7f750b), + SPH_C32(0x428f9ad8), SPH_C32(0x77ed0300), SPH_C32(0x2fd825c2), + SPH_C32(0x2d83d675), SPH_C32(0x324a92a0) }, + { SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), SPH_C32(0x6a72e5bb), + SPH_C32(0x247febe6), SPH_C32(0x9b830400), SPH_C32(0x2227ff88), + SPH_C32(0x05b7ad5a), SPH_C32(0xadf2c730) }, + { SPH_C32(0x67f10000), SPH_C32(0xbad59029), SPH_C32(0xc8eff72c), + SPH_C32(0x4a9a83b2), SPH_C32(0x5f6b0500), SPH_C32(0x3d576986), + SPH_C32(0x22a36766), SPH_C32(0x25d3cb00) }, + { SPH_C32(0xb3050200), SPH_C32(0x30a8b3cc), SPH_C32(0x0a971c49), + SPH_C32(0xba6b9e90), SPH_C32(0x75a50400), SPH_C32(0x306c97b6), + SPH_C32(0x85757bd5), SPH_C32(0x96016c1c) }, + { SPH_C32(0xc0490200), SPH_C32(0xa5c7141a), SPH_C32(0xa80a0ede), + SPH_C32(0xd48ef6c4), SPH_C32(0xb14d0500), SPH_C32(0x2f1c01b8), + SPH_C32(0xa261b1e9), SPH_C32(0x1e20602c) }, + { SPH_C32(0xfa9b0000), SPH_C32(0x3df15fc1), SPH_C32(0xeab03334), + SPH_C32(0x1f8c40ca), SPH_C32(0xd21d0600), SPH_C32(0x2f7e1385), + SPH_C32(0xe5908227), SPH_C32(0x0815196a) }, + { SPH_C32(0x89d70000), SPH_C32(0xa89ef817), SPH_C32(0x482d21a3), + SPH_C32(0x7169289e), SPH_C32(0x16f50700), SPH_C32(0x300e858b), + SPH_C32(0xc284481b), SPH_C32(0x8034155a) }, + { SPH_C32(0x5d230200), SPH_C32(0x22e3dbf2), SPH_C32(0x8a55cac6), + SPH_C32(0x819835bc), SPH_C32(0x3c3b0600), SPH_C32(0x3d357bbb), + SPH_C32(0x655254a8), SPH_C32(0x33e6b246) }, + { SPH_C32(0x2e6f0200), SPH_C32(0xb78c7c24), SPH_C32(0x28c8d851), + SPH_C32(0xef7d5de8), SPH_C32(0xf8d30700), SPH_C32(0x2245edb5), + SPH_C32(0x42469e94), SPH_C32(0xbbc7be76) }, + { SPH_C32(0x9b830400), SPH_C32(0x2227ff88), SPH_C32(0x05b7ad5a), + SPH_C32(0xadf2c730), SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), + SPH_C32(0x6fc548e1), SPH_C32(0x898d2cd6) }, + { SPH_C32(0xe8cf0400), SPH_C32(0xb748585e), SPH_C32(0xa72abfcd), + SPH_C32(0xc317af64), SPH_C32(0x4bd60500), SPH_C32(0x12ed5e79), + SPH_C32(0x48d182dd), SPH_C32(0x01ac20e6) }, + { SPH_C32(0x3c3b0600), SPH_C32(0x3d357bbb), SPH_C32(0x655254a8), + SPH_C32(0x33e6b246), SPH_C32(0x61180400), SPH_C32(0x1fd6a049), + SPH_C32(0xef079e6e), SPH_C32(0xb27e87fa) }, + { SPH_C32(0x4f770600), SPH_C32(0xa85adc6d), SPH_C32(0xc7cf463f), + SPH_C32(0x5d03da12), SPH_C32(0xa5f00500), SPH_C32(0x00a63647), + SPH_C32(0xc8135452), SPH_C32(0x3a5f8bca) }, + { SPH_C32(0x75a50400), SPH_C32(0x306c97b6), SPH_C32(0x85757bd5), + SPH_C32(0x96016c1c), SPH_C32(0xc6a00600), SPH_C32(0x00c4247a), + SPH_C32(0x8fe2679c), SPH_C32(0x2c6af28c) }, + { SPH_C32(0x06e90400), SPH_C32(0xa5033060), SPH_C32(0x27e86942), + SPH_C32(0xf8e40448), SPH_C32(0x02480700), SPH_C32(0x1fb4b274), + SPH_C32(0xa8f6ada0), SPH_C32(0xa44bfebc) }, + { SPH_C32(0xd21d0600), SPH_C32(0x2f7e1385), SPH_C32(0xe5908227), + SPH_C32(0x0815196a), SPH_C32(0x28860600), SPH_C32(0x128f4c44), + SPH_C32(0x0f20b113), SPH_C32(0x179959a0) }, + { SPH_C32(0xa1510600), SPH_C32(0xba11b453), SPH_C32(0x470d90b0), + SPH_C32(0x66f0713e), SPH_C32(0xec6e0700), SPH_C32(0x0dffda4a), + SPH_C32(0x28347b2f), SPH_C32(0x9fb85590) } +}; + +static const sph_u32 T256_15[32][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), SPH_C32(0x36656ba8), + SPH_C32(0x23633a05), SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), + SPH_C32(0x5d5ca0f7), SPH_C32(0x727784cb) }, + { SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), SPH_C32(0x5d5ca0f7), + SPH_C32(0x727784cb), SPH_C32(0x35650040), SPH_C32(0x9b96b64a), + SPH_C32(0x6b39cb5f), SPH_C32(0x5114bece) }, + { SPH_C32(0x35650040), SPH_C32(0x9b96b64a), SPH_C32(0x6b39cb5f), + SPH_C32(0x5114bece), SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), + SPH_C32(0x36656ba8), SPH_C32(0x23633a05) }, + { SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), SPH_C32(0xc2c46c55), + SPH_C32(0xf362b233), SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), + SPH_C32(0xd14e094b), SPH_C32(0xb772b42b) }, + { SPH_C32(0x161c00c0), SPH_C32(0x7e54f492), SPH_C32(0xf4a107fd), + SPH_C32(0xd0018836), SPH_C32(0x410d0000), SPH_C32(0xea7a09df), + SPH_C32(0x8c12a9bc), SPH_C32(0xc50530e0) }, + { SPH_C32(0x23790080), SPH_C32(0xe5c242d8), SPH_C32(0x9f98cca2), + SPH_C32(0x811536f8), SPH_C32(0x0cc30040), SPH_C32(0xd121e5a1), + SPH_C32(0xba77c214), SPH_C32(0xe6660ae5) }, + { SPH_C32(0x6eb700c0), SPH_C32(0xde99aea6), SPH_C32(0xa9fda70a), + SPH_C32(0xa2760cfd), SPH_C32(0x74680040), SPH_C32(0x71ecbf95), + SPH_C32(0xe72b62e3), SPH_C32(0x94118e2e) }, + { SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), SPH_C32(0xd14e094b), + SPH_C32(0xb772b42b), SPH_C32(0x62740080), SPH_C32(0x0fb84b07), + SPH_C32(0x138a651e), SPH_C32(0x44100618) }, + { SPH_C32(0x74680040), SPH_C32(0x71ecbf95), SPH_C32(0xe72b62e3), + SPH_C32(0x94118e2e), SPH_C32(0x1adf0080), SPH_C32(0xaf751133), + SPH_C32(0x4ed6c5e9), SPH_C32(0x366782d3) }, + { SPH_C32(0x410d0000), SPH_C32(0xea7a09df), SPH_C32(0x8c12a9bc), + SPH_C32(0xc50530e0), SPH_C32(0x571100c0), SPH_C32(0x942efd4d), + SPH_C32(0x78b3ae41), SPH_C32(0x1504b8d6) }, + { SPH_C32(0x0cc30040), SPH_C32(0xd121e5a1), SPH_C32(0xba77c214), + SPH_C32(0xe6660ae5), SPH_C32(0x2fba00c0), SPH_C32(0x34e3a779), + SPH_C32(0x25ef0eb6), SPH_C32(0x67733c1d) }, + { SPH_C32(0x62740080), SPH_C32(0x0fb84b07), SPH_C32(0x138a651e), + SPH_C32(0x44100618), SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), + SPH_C32(0xc2c46c55), SPH_C32(0xf362b233) }, + { SPH_C32(0x2fba00c0), SPH_C32(0x34e3a779), SPH_C32(0x25ef0eb6), + SPH_C32(0x67733c1d), SPH_C32(0x23790080), SPH_C32(0xe5c242d8), + SPH_C32(0x9f98cca2), SPH_C32(0x811536f8) }, + { SPH_C32(0x1adf0080), SPH_C32(0xaf751133), SPH_C32(0x4ed6c5e9), + SPH_C32(0x366782d3), SPH_C32(0x6eb700c0), SPH_C32(0xde99aea6), + SPH_C32(0xa9fda70a), SPH_C32(0xa2760cfd) }, + { SPH_C32(0x571100c0), SPH_C32(0x942efd4d), SPH_C32(0x78b3ae41), + SPH_C32(0x1504b8d6), SPH_C32(0x161c00c0), SPH_C32(0x7e54f492), + SPH_C32(0xf4a107fd), SPH_C32(0xd0018836) }, + { SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), SPH_C32(0x8589d8ab), + SPH_C32(0xe6c46464), SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), + SPH_C32(0xa29d1297), SPH_C32(0x6ee56854) }, + { SPH_C32(0xfa6a0140), SPH_C32(0xb144dda6), SPH_C32(0xb3ecb303), + SPH_C32(0xc5a75e61), SPH_C32(0x0be70000), SPH_C32(0x35a2fde2), + SPH_C32(0xffc1b260), SPH_C32(0x1c92ec9f) }, + { SPH_C32(0xcf0f0100), SPH_C32(0x2ad26bec), SPH_C32(0xd8d5785c), + SPH_C32(0x94b3e0af), SPH_C32(0x46290040), SPH_C32(0x0ef9119c), + SPH_C32(0xc9a4d9c8), SPH_C32(0x3ff1d69a) }, + { SPH_C32(0x82c10140), SPH_C32(0x11898792), SPH_C32(0xeeb013f4), + SPH_C32(0xb7d0daaa), SPH_C32(0x3e820040), SPH_C32(0xae344ba8), + SPH_C32(0x94f8793f), SPH_C32(0x4d865251) }, + { SPH_C32(0xec760180), SPH_C32(0xcf102934), SPH_C32(0x474db4fe), + SPH_C32(0x15a6d657), SPH_C32(0x4aea0000), SPH_C32(0xdfd8f43d), + SPH_C32(0x73d31bdc), SPH_C32(0xd997dc7f) }, + { SPH_C32(0xa1b801c0), SPH_C32(0xf44bc54a), SPH_C32(0x7128df56), + SPH_C32(0x36c5ec52), SPH_C32(0x32410000), SPH_C32(0x7f15ae09), + SPH_C32(0x2e8fbb2b), SPH_C32(0xabe058b4) }, + { SPH_C32(0x94dd0180), SPH_C32(0x6fdd7300), SPH_C32(0x1a111409), + SPH_C32(0x67d1529c), SPH_C32(0x7f8f0040), SPH_C32(0x444e4277), + SPH_C32(0x18ead083), SPH_C32(0x888362b1) }, + { SPH_C32(0xd91301c0), SPH_C32(0x54869f7e), SPH_C32(0x2c747fa1), + SPH_C32(0x44b26899), SPH_C32(0x07240040), SPH_C32(0xe4831843), + SPH_C32(0x45b67074), SPH_C32(0xfaf4e67a) }, + { SPH_C32(0x8e020100), SPH_C32(0xc0a86233), SPH_C32(0x54c7d1e0), + SPH_C32(0x51b6d04f), SPH_C32(0x11380080), SPH_C32(0x9ad7ecd1), + SPH_C32(0xb1177789), SPH_C32(0x2af56e4c) }, + { SPH_C32(0xc3cc0140), SPH_C32(0xfbf38e4d), SPH_C32(0x62a2ba48), + SPH_C32(0x72d5ea4a), SPH_C32(0x69930080), SPH_C32(0x3a1ab6e5), + SPH_C32(0xec4bd77e), SPH_C32(0x5882ea87) }, + { SPH_C32(0xf6a90100), SPH_C32(0x60653807), SPH_C32(0x099b7117), + SPH_C32(0x23c15484), SPH_C32(0x245d00c0), SPH_C32(0x01415a9b), + SPH_C32(0xda2ebcd6), SPH_C32(0x7be1d082) }, + { SPH_C32(0xbb670140), SPH_C32(0x5b3ed479), SPH_C32(0x3ffe1abf), + SPH_C32(0x00a26e81), SPH_C32(0x5cf600c0), SPH_C32(0xa18c00af), + SPH_C32(0x87721c21), SPH_C32(0x09965449) }, + { SPH_C32(0xd5d00180), SPH_C32(0x85a77adf), SPH_C32(0x9603bdb5), + SPH_C32(0xa2d4627c), SPH_C32(0x289e0080), SPH_C32(0xd060bf3a), + SPH_C32(0x60597ec2), SPH_C32(0x9d87da67) }, + { SPH_C32(0x981e01c0), SPH_C32(0xbefc96a1), SPH_C32(0xa066d61d), + SPH_C32(0x81b75879), SPH_C32(0x50350080), SPH_C32(0x70ade50e), + SPH_C32(0x3d05de35), SPH_C32(0xeff05eac) }, + { SPH_C32(0xad7b0180), SPH_C32(0x256a20eb), SPH_C32(0xcb5f1d42), + SPH_C32(0xd0a3e6b7), SPH_C32(0x1dfb00c0), SPH_C32(0x4bf60970), + SPH_C32(0x0b60b59d), SPH_C32(0xcc9364a9) }, + { SPH_C32(0xe0b501c0), SPH_C32(0x1e31cc95), SPH_C32(0xfd3a76ea), + SPH_C32(0xf3c0dcb2), SPH_C32(0x655000c0), SPH_C32(0xeb3b5344), + SPH_C32(0x563c156a), SPH_C32(0xbee4e062) } +}; + +static const sph_u32 T256_20[32][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x171c0000), SPH_C32(0xb26e3344), SPH_C32(0x9e6a837e), + SPH_C32(0x58f8485f), SPH_C32(0xbfb20008), SPH_C32(0x92170a39), + SPH_C32(0x6019107f), SPH_C32(0xe051606e) }, + { SPH_C32(0x515c0010), SPH_C32(0x40f372fb), SPH_C32(0xfce72602), + SPH_C32(0x71575061), SPH_C32(0x2e390000), SPH_C32(0x64dd6689), + SPH_C32(0x3cd406fc), SPH_C32(0xb1f490bc) }, + { SPH_C32(0x46400010), SPH_C32(0xf29d41bf), SPH_C32(0x628da57c), + SPH_C32(0x29af183e), SPH_C32(0x918b0008), SPH_C32(0xf6ca6cb0), + SPH_C32(0x5ccd1683), SPH_C32(0x51a5f0d2) }, + { SPH_C32(0x2e390000), SPH_C32(0x64dd6689), SPH_C32(0x3cd406fc), + SPH_C32(0xb1f490bc), SPH_C32(0x7f650010), SPH_C32(0x242e1472), + SPH_C32(0xc03320fe), SPH_C32(0xc0a3c0dd) }, + { SPH_C32(0x39250000), SPH_C32(0xd6b355cd), SPH_C32(0xa2be8582), + SPH_C32(0xe90cd8e3), SPH_C32(0xc0d70018), SPH_C32(0xb6391e4b), + SPH_C32(0xa02a3081), SPH_C32(0x20f2a0b3) }, + { SPH_C32(0x7f650010), SPH_C32(0x242e1472), SPH_C32(0xc03320fe), + SPH_C32(0xc0a3c0dd), SPH_C32(0x515c0010), SPH_C32(0x40f372fb), + SPH_C32(0xfce72602), SPH_C32(0x71575061) }, + { SPH_C32(0x68790010), SPH_C32(0x96402736), SPH_C32(0x5e59a380), + SPH_C32(0x985b8882), SPH_C32(0xeeee0018), SPH_C32(0xd2e478c2), + SPH_C32(0x9cfe367d), SPH_C32(0x9106300f) }, + { SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), SPH_C32(0xf9ce4c04), + SPH_C32(0xe2afa0c0), SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), + SPH_C32(0x79a90df9), SPH_C32(0x63e92178) }, + { SPH_C32(0xb5a40020), SPH_C32(0x3389d6b2), SPH_C32(0x67a4cf7a), + SPH_C32(0xba57e89f), SPH_C32(0xe3c00008), SPH_C32(0x5badc72b), + SPH_C32(0x19b01d86), SPH_C32(0x83b84116) }, + { SPH_C32(0xf3e40030), SPH_C32(0xc114970d), SPH_C32(0x05296a06), + SPH_C32(0x93f8f0a1), SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), + SPH_C32(0x457d0b05), SPH_C32(0xd21db1c4) }, + { SPH_C32(0xe4f80030), SPH_C32(0x737aa449), SPH_C32(0x9b43e978), + SPH_C32(0xcb00b8fe), SPH_C32(0xcdf90008), SPH_C32(0x3f70a1a2), + SPH_C32(0x25641b7a), SPH_C32(0x324cd1aa) }, + { SPH_C32(0x8c810020), SPH_C32(0xe53a837f), SPH_C32(0xc51a4af8), + SPH_C32(0x535b307c), SPH_C32(0x23170010), SPH_C32(0xed94d960), + SPH_C32(0xb99a2d07), SPH_C32(0xa34ae1a5) }, + { SPH_C32(0x9b9d0020), SPH_C32(0x5754b03b), SPH_C32(0x5b70c986), + SPH_C32(0x0ba37823), SPH_C32(0x9ca50018), SPH_C32(0x7f83d359), + SPH_C32(0xd9833d78), SPH_C32(0x431b81cb) }, + { SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), SPH_C32(0x39fd6cfa), + SPH_C32(0x220c601d), SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), + SPH_C32(0x854e2bfb), SPH_C32(0x12be7119) }, + { SPH_C32(0xcac10030), SPH_C32(0x17a7c2c0), SPH_C32(0xa797ef84), + SPH_C32(0x7af42842), SPH_C32(0xb29c0018), SPH_C32(0x1b5eb5d0), + SPH_C32(0xe5573b84), SPH_C32(0xf2ef1177) }, + { SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), SPH_C32(0x79a90df9), + SPH_C32(0x63e92178), SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), + SPH_C32(0x806741fd), SPH_C32(0x814681b8) }, + { SPH_C32(0x4b6e0000), SPH_C32(0x7bd4fe56), SPH_C32(0xe7c38e87), + SPH_C32(0x3b116927), SPH_C32(0x41780028), SPH_C32(0xda4a22dd), + SPH_C32(0xe07e5182), SPH_C32(0x6117e1d6) }, + { SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), SPH_C32(0x854e2bfb), + SPH_C32(0x12be7119), SPH_C32(0xd0f30020), SPH_C32(0x2c804e6d), + SPH_C32(0xbcb34701), SPH_C32(0x30b21104) }, + { SPH_C32(0x1a320010), SPH_C32(0x3b278cad), SPH_C32(0x1b24a885), + SPH_C32(0x4a463946), SPH_C32(0x6f410028), SPH_C32(0xbe974454), + SPH_C32(0xdcaa577e), SPH_C32(0xd0e3716a) }, + { SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), SPH_C32(0x457d0b05), + SPH_C32(0xd21db1c4), SPH_C32(0x81af0030), SPH_C32(0x6c733c96), + SPH_C32(0x40546103), SPH_C32(0x41e54165) }, + { SPH_C32(0x65570000), SPH_C32(0x1f0998df), SPH_C32(0xdb17887b), + SPH_C32(0x8ae5f99b), SPH_C32(0x3e1d0038), SPH_C32(0xfe6436af), + SPH_C32(0x204d717c), SPH_C32(0xa1b4210b) }, + { SPH_C32(0x23170010), SPH_C32(0xed94d960), SPH_C32(0xb99a2d07), + SPH_C32(0xa34ae1a5), SPH_C32(0xaf960030), SPH_C32(0x08ae5a1f), + SPH_C32(0x7c8067ff), SPH_C32(0xf011d1d9) }, + { SPH_C32(0x340b0010), SPH_C32(0x5ffaea24), SPH_C32(0x27f0ae79), + SPH_C32(0xfbb2a9fa), SPH_C32(0x10240038), SPH_C32(0x9ab95026), + SPH_C32(0x1c997780), SPH_C32(0x1040b1b7) }, + { SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), SPH_C32(0x806741fd), + SPH_C32(0x814681b8), SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), + SPH_C32(0xf9ce4c04), SPH_C32(0xe2afa0c0) }, + { SPH_C32(0xe9d60020), SPH_C32(0xfa331ba0), SPH_C32(0x1e0dc283), + SPH_C32(0xd9bec9e7), SPH_C32(0x1d0a0028), SPH_C32(0x13f0efcf), + SPH_C32(0x99d75c7b), SPH_C32(0x02fec0ae) }, + { SPH_C32(0xaf960030), SPH_C32(0x08ae5a1f), SPH_C32(0x7c8067ff), + SPH_C32(0xf011d1d9), SPH_C32(0x8c810020), SPH_C32(0xe53a837f), + SPH_C32(0xc51a4af8), SPH_C32(0x535b307c) }, + { SPH_C32(0xb88a0030), SPH_C32(0xbac0695b), SPH_C32(0xe2eae481), + SPH_C32(0xa8e99986), SPH_C32(0x33330028), SPH_C32(0x772d8946), + SPH_C32(0xa5035a87), SPH_C32(0xb30a5012) }, + { SPH_C32(0xd0f30020), SPH_C32(0x2c804e6d), SPH_C32(0xbcb34701), + SPH_C32(0x30b21104), SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), + SPH_C32(0x39fd6cfa), SPH_C32(0x220c601d) }, + { SPH_C32(0xc7ef0020), SPH_C32(0x9eee7d29), SPH_C32(0x22d9c47f), + SPH_C32(0x684a595b), SPH_C32(0x626f0038), SPH_C32(0x37defbbd), + SPH_C32(0x59e47c85), SPH_C32(0xc25d0073) }, + { SPH_C32(0x81af0030), SPH_C32(0x6c733c96), SPH_C32(0x40546103), + SPH_C32(0x41e54165), SPH_C32(0xf3e40030), SPH_C32(0xc114970d), + SPH_C32(0x05296a06), SPH_C32(0x93f8f0a1) }, + { SPH_C32(0x96b30030), SPH_C32(0xde1d0fd2), SPH_C32(0xde3ee27d), + SPH_C32(0x191d093a), SPH_C32(0x4c560038), SPH_C32(0x53039d34), + SPH_C32(0x65307a79), SPH_C32(0x73a990cf) } +}; + +static const sph_u32 T256_25[32][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), SPH_C32(0x99e585aa), + SPH_C32(0x8d75f7f1), SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), + SPH_C32(0x79e22a4c), SPH_C32(0x1298bd46) }, + { SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), SPH_C32(0x79e22a4c), + SPH_C32(0x1298bd46), SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), + SPH_C32(0xe007afe6), SPH_C32(0x9fed4ab7) }, + { SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), SPH_C32(0xe007afe6), + SPH_C32(0x9fed4ab7), SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), + SPH_C32(0x99e585aa), SPH_C32(0x8d75f7f1) }, + { SPH_C32(0xd0080004), SPH_C32(0x8c768f77), SPH_C32(0x9dc5b050), + SPH_C32(0xaf4a29da), SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), + SPH_C32(0x98321c3d), SPH_C32(0x76acc733) }, + { SPH_C32(0x582b0006), SPH_C32(0xd39128c4), SPH_C32(0x042035fa), + SPH_C32(0x223fde2b), SPH_C32(0x3a050000), SPH_C32(0x6508f6be), + SPH_C32(0xe1d03671), SPH_C32(0x64347a75) }, + { SPH_C32(0x81a40004), SPH_C32(0xa9958063), SPH_C32(0xe4279a1c), + SPH_C32(0xbdd2949c), SPH_C32(0xb2260002), SPH_C32(0x3aef510d), + SPH_C32(0x7835b3db), SPH_C32(0xe9418d84) }, + { SPH_C32(0x09870006), SPH_C32(0xf67227d0), SPH_C32(0x7dc21fb6), + SPH_C32(0x30a7636d), SPH_C32(0xe38a0002), SPH_C32(0x1f0c5e19), + SPH_C32(0x01d79997), SPH_C32(0xfbd930c2) }, + { SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), SPH_C32(0x98321c3d), + SPH_C32(0x76acc733), SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), + SPH_C32(0x05f7ac6d), SPH_C32(0xd9e6eee9) }, + { SPH_C32(0xe38a0002), SPH_C32(0x1f0c5e19), SPH_C32(0x01d79997), + SPH_C32(0xfbd930c2), SPH_C32(0xea0d0004), SPH_C32(0xe97e79c9), + SPH_C32(0x7c158621), SPH_C32(0xcb7e53af) }, + { SPH_C32(0x3a050000), SPH_C32(0x6508f6be), SPH_C32(0xe1d03671), + SPH_C32(0x64347a75), SPH_C32(0x622e0006), SPH_C32(0xb699de7a), + SPH_C32(0xe5f0038b), SPH_C32(0x460ba45e) }, + { SPH_C32(0xb2260002), SPH_C32(0x3aef510d), SPH_C32(0x7835b3db), + SPH_C32(0xe9418d84), SPH_C32(0x33820006), SPH_C32(0x937ad16e), + SPH_C32(0x9c1229c7), SPH_C32(0x54931918) }, + { SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), SPH_C32(0x05f7ac6d), + SPH_C32(0xd9e6eee9), SPH_C32(0xd0080004), SPH_C32(0x8c768f77), + SPH_C32(0x9dc5b050), SPH_C32(0xaf4a29da) }, + { SPH_C32(0x33820006), SPH_C32(0x937ad16e), SPH_C32(0x9c1229c7), + SPH_C32(0x54931918), SPH_C32(0x81a40004), SPH_C32(0xa9958063), + SPH_C32(0xe4279a1c), SPH_C32(0xbdd2949c) }, + { SPH_C32(0xea0d0004), SPH_C32(0xe97e79c9), SPH_C32(0x7c158621), + SPH_C32(0xcb7e53af), SPH_C32(0x09870006), SPH_C32(0xf67227d0), + SPH_C32(0x7dc21fb6), SPH_C32(0x30a7636d) }, + { SPH_C32(0x622e0006), SPH_C32(0xb699de7a), SPH_C32(0xe5f0038b), + SPH_C32(0x460ba45e), SPH_C32(0x582b0006), SPH_C32(0xd39128c4), + SPH_C32(0x042035fa), SPH_C32(0x223fde2b) }, + { SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), SPH_C32(0xfe739301), + SPH_C32(0xb8a92831), SPH_C32(0x171c0000), SPH_C32(0xb26e3344), + SPH_C32(0x9e6a837e), SPH_C32(0x58f8485f) }, + { SPH_C32(0x208d000a), SPH_C32(0x7f9e9ece), SPH_C32(0x679616ab), + SPH_C32(0x35dcdfc0), SPH_C32(0x46b00000), SPH_C32(0x978d3c50), + SPH_C32(0xe788a932), SPH_C32(0x4a60f519) }, + { SPH_C32(0xf9020008), SPH_C32(0x059a3669), SPH_C32(0x8791b94d), + SPH_C32(0xaa319577), SPH_C32(0xce930002), SPH_C32(0xc86a9be3), + SPH_C32(0x7e6d2c98), SPH_C32(0xc71502e8) }, + { SPH_C32(0x7121000a), SPH_C32(0x5a7d91da), SPH_C32(0x1e743ce7), + SPH_C32(0x27446286), SPH_C32(0x9f3f0002), SPH_C32(0xed8994f7), + SPH_C32(0x078f06d4), SPH_C32(0xd58dbfae) }, + { SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), SPH_C32(0x63b62351), + SPH_C32(0x17e301eb), SPH_C32(0x7cb50000), SPH_C32(0xf285caee), + SPH_C32(0x06589f43), SPH_C32(0x2e548f6c) }, + { SPH_C32(0xf085000e), SPH_C32(0xf3e811b9), SPH_C32(0xfa53a6fb), + SPH_C32(0x9a96f61a), SPH_C32(0x2d190000), SPH_C32(0xd766c5fa), + SPH_C32(0x7fbab50f), SPH_C32(0x3ccc322a) }, + { SPH_C32(0x290a000c), SPH_C32(0x89ecb91e), SPH_C32(0x1a54091d), + SPH_C32(0x057bbcad), SPH_C32(0xa53a0002), SPH_C32(0x88816249), + SPH_C32(0xe65f30a5), SPH_C32(0xb1b9c5db) }, + { SPH_C32(0xa129000e), SPH_C32(0xd60b1ead), SPH_C32(0x83b18cb7), + SPH_C32(0x880e4b5c), SPH_C32(0xf4960002), SPH_C32(0xad626d5d), + SPH_C32(0x9fbd1ae9), SPH_C32(0xa321789d) }, + { SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), SPH_C32(0x66418f3c), + SPH_C32(0xce05ef02), SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), + SPH_C32(0x9b9d2f13), SPH_C32(0x811ea6b6) }, + { SPH_C32(0x4b24000a), SPH_C32(0x3f756764), SPH_C32(0xffa40a96), + SPH_C32(0x437018f3), SPH_C32(0xfd110004), SPH_C32(0x5b104a8d), + SPH_C32(0xe27f055f), SPH_C32(0x93861bf0) }, + { SPH_C32(0x92ab0008), SPH_C32(0x4571cfc3), SPH_C32(0x1fa3a570), + SPH_C32(0xdc9d5244), SPH_C32(0x75320006), SPH_C32(0x04f7ed3e), + SPH_C32(0x7b9a80f5), SPH_C32(0x1ef3ec01) }, + { SPH_C32(0x1a88000a), SPH_C32(0x1a966870), SPH_C32(0x864620da), + SPH_C32(0x51e8a5b5), SPH_C32(0x249e0006), SPH_C32(0x2114e22a), + SPH_C32(0x0278aab9), SPH_C32(0x0c6b5147) }, + { SPH_C32(0x130f000c), SPH_C32(0xece44fa0), SPH_C32(0xfb843f6c), + SPH_C32(0x614fc6d8), SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), + SPH_C32(0x03af332e), SPH_C32(0xf7b26185) }, + { SPH_C32(0x9b2c000e), SPH_C32(0xb303e813), SPH_C32(0x6261bac6), + SPH_C32(0xec3a3129), SPH_C32(0x96b80004), SPH_C32(0x1bfbb327), + SPH_C32(0x7a4d1962), SPH_C32(0xe52adcc3) }, + { SPH_C32(0x42a3000c), SPH_C32(0xc90740b4), SPH_C32(0x82661520), + SPH_C32(0x73d77b9e), SPH_C32(0x1e9b0006), SPH_C32(0x441c1494), + SPH_C32(0xe3a89cc8), SPH_C32(0x685f2b32) }, + { SPH_C32(0xca80000e), SPH_C32(0x96e0e707), SPH_C32(0x1b83908a), + SPH_C32(0xfea28c6f), SPH_C32(0x4f370006), SPH_C32(0x61ff1b80), + SPH_C32(0x9a4ab684), SPH_C32(0x7ac79674) } +}; + +static const sph_u32 T256_30[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), SPH_C32(0xae0ebb05), + SPH_C32(0xb5a4c63b), SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), + SPH_C32(0x6bf648a4), SPH_C32(0x539cbdbf) }, + { SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), SPH_C32(0x6bf648a4), + SPH_C32(0x539cbdbf), SPH_C32(0x08bf0001), SPH_C32(0x38942792), + SPH_C32(0xc5f8f3a1), SPH_C32(0xe6387b84) }, + { SPH_C32(0x08bf0001), SPH_C32(0x38942792), SPH_C32(0xc5f8f3a1), + SPH_C32(0xe6387b84), SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), + SPH_C32(0xae0ebb05), SPH_C32(0xb5a4c63b) } +}; + +#define INPUT_SMALL do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T256_0[acc >> 3][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + acc = (acc << 8) | buf[1]; \ + rp = &T256_5[(acc >> 6) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_10[(acc >> 1) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = (acc << 8) | buf[2]; \ + rp = &T256_15[(acc >> 4) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = (acc << 8) | buf[3]; \ + rp = &T256_20[(acc >> 7) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_25[(acc >> 2) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_30[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_SMALL == 6 + +static const sph_u32 T256_0[64][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), SPH_C32(0x11fa3a57), + SPH_C32(0x3dc90524), SPH_C32(0x97530000), SPH_C32(0x204f6ed3), + SPH_C32(0x77b9e80f), SPH_C32(0xa1ec5ec1) }, + { SPH_C32(0x97530000), SPH_C32(0x204f6ed3), SPH_C32(0x77b9e80f), + SPH_C32(0xa1ec5ec1), SPH_C32(0x7e792000), SPH_C32(0x9418e22f), + SPH_C32(0x6643d258), SPH_C32(0x9c255be5) }, + { SPH_C32(0x7e792000), SPH_C32(0x9418e22f), SPH_C32(0x6643d258), + SPH_C32(0x9c255be5), SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), + SPH_C32(0x11fa3a57), SPH_C32(0x3dc90524) }, + { SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), SPH_C32(0x8dfacfab), + SPH_C32(0xce36cc72), SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), + SPH_C32(0x848598ba), SPH_C32(0x1041003e) }, + { SPH_C32(0xfb316000), SPH_C32(0xef405514), SPH_C32(0x9c00f5fc), + SPH_C32(0xf3ffc956), SPH_C32(0x71040000), SPH_C32(0x6bfc54f6), + SPH_C32(0xf33c70b5), SPH_C32(0xb1ad5eff) }, + { SPH_C32(0x85484000), SPH_C32(0x7b58b73b), SPH_C32(0xfa4327a4), + SPH_C32(0x6fda92b3), SPH_C32(0x982e2000), SPH_C32(0xdfabd80a), + SPH_C32(0xe2c64ae2), SPH_C32(0x8c645bdb) }, + { SPH_C32(0x6c626000), SPH_C32(0xcf0f3bc7), SPH_C32(0xebb91df3), + SPH_C32(0x52139797), SPH_C32(0x0f7d2000), SPH_C32(0xffe4b6d9), + SPH_C32(0x957fa2ed), SPH_C32(0x2d88051a) }, + { SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), SPH_C32(0x848598ba), + SPH_C32(0x1041003e), SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), + SPH_C32(0x097f5711), SPH_C32(0xde77cc4c) }, + { SPH_C32(0x0f7d2000), SPH_C32(0xffe4b6d9), SPH_C32(0x957fa2ed), + SPH_C32(0x2d88051a), SPH_C32(0x631f4000), SPH_C32(0x30eb8d1e), + SPH_C32(0x7ec6bf1e), SPH_C32(0x7f9b928d) }, + { SPH_C32(0x71040000), SPH_C32(0x6bfc54f6), SPH_C32(0xf33c70b5), + SPH_C32(0xb1ad5eff), SPH_C32(0x8a356000), SPH_C32(0x84bc01e2), + SPH_C32(0x6f3c8549), SPH_C32(0x425297a9) }, + { SPH_C32(0x982e2000), SPH_C32(0xdfabd80a), SPH_C32(0xe2c64ae2), + SPH_C32(0x8c645bdb), SPH_C32(0x1d666000), SPH_C32(0xa4f36f31), + SPH_C32(0x18856d46), SPH_C32(0xe3bec968) }, + { SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), SPH_C32(0x097f5711), + SPH_C32(0xde77cc4c), SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), + SPH_C32(0x8dfacfab), SPH_C32(0xce36cc72) }, + { SPH_C32(0x1d666000), SPH_C32(0xa4f36f31), SPH_C32(0x18856d46), + SPH_C32(0xe3bec968), SPH_C32(0x85484000), SPH_C32(0x7b58b73b), + SPH_C32(0xfa4327a4), SPH_C32(0x6fda92b3) }, + { SPH_C32(0x631f4000), SPH_C32(0x30eb8d1e), SPH_C32(0x7ec6bf1e), + SPH_C32(0x7f9b928d), SPH_C32(0x6c626000), SPH_C32(0xcf0f3bc7), + SPH_C32(0xebb91df3), SPH_C32(0x52139797) }, + { SPH_C32(0x8a356000), SPH_C32(0x84bc01e2), SPH_C32(0x6f3c8549), + SPH_C32(0x425297a9), SPH_C32(0xfb316000), SPH_C32(0xef405514), + SPH_C32(0x9c00f5fc), SPH_C32(0xf3ffc956) }, + { SPH_C32(0xe4788000), SPH_C32(0x859673c1), SPH_C32(0xb5fb2452), + SPH_C32(0x29cc5edf), SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), + SPH_C32(0x62fc79d0), SPH_C32(0x731ebdc2) }, + { SPH_C32(0x0d52a000), SPH_C32(0x31c1ff3d), SPH_C32(0xa4011e05), + SPH_C32(0x14055bfb), SPH_C32(0x930c0000), SPH_C32(0xbc05fd1a), + SPH_C32(0x154591df), SPH_C32(0xd2f2e303) }, + { SPH_C32(0x732b8000), SPH_C32(0xa5d91d12), SPH_C32(0xc242cc5d), + SPH_C32(0x8820001e), SPH_C32(0x7a262000), SPH_C32(0x085271e6), + SPH_C32(0x04bfab88), SPH_C32(0xef3be627) }, + { SPH_C32(0x9a01a000), SPH_C32(0x118e91ee), SPH_C32(0xd3b8f60a), + SPH_C32(0xb5e9053a), SPH_C32(0xed752000), SPH_C32(0x281d1f35), + SPH_C32(0x73064387), SPH_C32(0x4ed7b8e6) }, + { SPH_C32(0xf663c000), SPH_C32(0xde81aa29), SPH_C32(0x3801ebf9), + SPH_C32(0xe7fa92ad), SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), + SPH_C32(0xe679e16a), SPH_C32(0x635fbdfc) }, + { SPH_C32(0x1f49e000), SPH_C32(0x6ad626d5), SPH_C32(0x29fbd1ae), + SPH_C32(0xda339789), SPH_C32(0x755b0000), SPH_C32(0xf7b6c73f), + SPH_C32(0x91c00965), SPH_C32(0xc2b3e33d) }, + { SPH_C32(0x6130c000), SPH_C32(0xfecec4fa), SPH_C32(0x4fb803f6), + SPH_C32(0x4616cc6c), SPH_C32(0x9c712000), SPH_C32(0x43e14bc3), + SPH_C32(0x803a3332), SPH_C32(0xff7ae619) }, + { SPH_C32(0x881ae000), SPH_C32(0x4a994806), SPH_C32(0x5e4239a1), + SPH_C32(0x7bdfc948), SPH_C32(0x0b222000), SPH_C32(0x63ae2510), + SPH_C32(0xf783db3d), SPH_C32(0x5e96b8d8) }, + { SPH_C32(0x022f8000), SPH_C32(0xce2549e4), SPH_C32(0x317ebce8), + SPH_C32(0x398d5ee1), SPH_C32(0xf0134000), SPH_C32(0x8cee7004), + SPH_C32(0x6b832ec1), SPH_C32(0xad69718e) }, + { SPH_C32(0xeb05a000), SPH_C32(0x7a72c518), SPH_C32(0x208486bf), + SPH_C32(0x04445bc5), SPH_C32(0x67404000), SPH_C32(0xaca11ed7), + SPH_C32(0x1c3ac6ce), SPH_C32(0x0c852f4f) }, + { SPH_C32(0x957c8000), SPH_C32(0xee6a2737), SPH_C32(0x46c754e7), + SPH_C32(0x98610020), SPH_C32(0x8e6a6000), SPH_C32(0x18f6922b), + SPH_C32(0x0dc0fc99), SPH_C32(0x314c2a6b) }, + { SPH_C32(0x7c56a000), SPH_C32(0x5a3dabcb), SPH_C32(0x573d6eb0), + SPH_C32(0xa5a80504), SPH_C32(0x19396000), SPH_C32(0x38b9fcf8), + SPH_C32(0x7a791496), SPH_C32(0x90a074aa) }, + { SPH_C32(0x1034c000), SPH_C32(0x9532900c), SPH_C32(0xbc847343), + SPH_C32(0xf7bb9293), SPH_C32(0x16444000), SPH_C32(0xc75d4a21), + SPH_C32(0xef06b67b), SPH_C32(0xbd2871b0) }, + { SPH_C32(0xf91ee000), SPH_C32(0x21651cf0), SPH_C32(0xad7e4914), + SPH_C32(0xca7297b7), SPH_C32(0x81174000), SPH_C32(0xe71224f2), + SPH_C32(0x98bf5e74), SPH_C32(0x1cc42f71) }, + { SPH_C32(0x8767c000), SPH_C32(0xb57dfedf), SPH_C32(0xcb3d9b4c), + SPH_C32(0x5657cc52), SPH_C32(0x683d6000), SPH_C32(0x5345a80e), + SPH_C32(0x89456423), SPH_C32(0x210d2a55) }, + { SPH_C32(0x6e4de000), SPH_C32(0x012a7223), SPH_C32(0xdac7a11b), + SPH_C32(0x6b9ec976), SPH_C32(0xff6e6000), SPH_C32(0x730ac6dd), + SPH_C32(0xfefc8c2c), SPH_C32(0x80e17494) }, + { SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), SPH_C32(0x62fc79d0), + SPH_C32(0x731ebdc2), SPH_C32(0xe0278000), SPH_C32(0x19dce008), + SPH_C32(0xd7075d82), SPH_C32(0x5ad2e31d) }, + { SPH_C32(0xed752000), SPH_C32(0x281d1f35), SPH_C32(0x73064387), + SPH_C32(0x4ed7b8e6), SPH_C32(0x77748000), SPH_C32(0x39938edb), + SPH_C32(0xa0beb58d), SPH_C32(0xfb3ebddc) }, + { SPH_C32(0x930c0000), SPH_C32(0xbc05fd1a), SPH_C32(0x154591df), + SPH_C32(0xd2f2e303), SPH_C32(0x9e5ea000), SPH_C32(0x8dc40227), + SPH_C32(0xb1448fda), SPH_C32(0xc6f7b8f8) }, + { SPH_C32(0x7a262000), SPH_C32(0x085271e6), SPH_C32(0x04bfab88), + SPH_C32(0xef3be627), SPH_C32(0x090da000), SPH_C32(0xad8b6cf4), + SPH_C32(0xc6fd67d5), SPH_C32(0x671be639) }, + { SPH_C32(0x16444000), SPH_C32(0xc75d4a21), SPH_C32(0xef06b67b), + SPH_C32(0xbd2871b0), SPH_C32(0x06708000), SPH_C32(0x526fda2d), + SPH_C32(0x5382c538), SPH_C32(0x4a93e323) }, + { SPH_C32(0xff6e6000), SPH_C32(0x730ac6dd), SPH_C32(0xfefc8c2c), + SPH_C32(0x80e17494), SPH_C32(0x91238000), SPH_C32(0x7220b4fe), + SPH_C32(0x243b2d37), SPH_C32(0xeb7fbde2) }, + { SPH_C32(0x81174000), SPH_C32(0xe71224f2), SPH_C32(0x98bf5e74), + SPH_C32(0x1cc42f71), SPH_C32(0x7809a000), SPH_C32(0xc6773802), + SPH_C32(0x35c11760), SPH_C32(0xd6b6b8c6) }, + { SPH_C32(0x683d6000), SPH_C32(0x5345a80e), SPH_C32(0x89456423), + SPH_C32(0x210d2a55), SPH_C32(0xef5aa000), SPH_C32(0xe63856d1), + SPH_C32(0x4278ff6f), SPH_C32(0x775ae607) }, + { SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), SPH_C32(0xe679e16a), + SPH_C32(0x635fbdfc), SPH_C32(0x146bc000), SPH_C32(0x097803c5), + SPH_C32(0xde780a93), SPH_C32(0x84a52f51) }, + { SPH_C32(0x0b222000), SPH_C32(0x63ae2510), SPH_C32(0xf783db3d), + SPH_C32(0x5e96b8d8), SPH_C32(0x8338c000), SPH_C32(0x29376d16), + SPH_C32(0xa9c1e29c), SPH_C32(0x25497190) }, + { SPH_C32(0x755b0000), SPH_C32(0xf7b6c73f), SPH_C32(0x91c00965), + SPH_C32(0xc2b3e33d), SPH_C32(0x6a12e000), SPH_C32(0x9d60e1ea), + SPH_C32(0xb83bd8cb), SPH_C32(0x188074b4) }, + { SPH_C32(0x9c712000), SPH_C32(0x43e14bc3), SPH_C32(0x803a3332), + SPH_C32(0xff7ae619), SPH_C32(0xfd41e000), SPH_C32(0xbd2f8f39), + SPH_C32(0xcf8230c4), SPH_C32(0xb96c2a75) }, + { SPH_C32(0xf0134000), SPH_C32(0x8cee7004), SPH_C32(0x6b832ec1), + SPH_C32(0xad69718e), SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), + SPH_C32(0x5afd9229), SPH_C32(0x94e42f6f) }, + { SPH_C32(0x19396000), SPH_C32(0x38b9fcf8), SPH_C32(0x7a791496), + SPH_C32(0x90a074aa), SPH_C32(0x656fc000), SPH_C32(0x62845733), + SPH_C32(0x2d447a26), SPH_C32(0x350871ae) }, + { SPH_C32(0x67404000), SPH_C32(0xaca11ed7), SPH_C32(0x1c3ac6ce), + SPH_C32(0x0c852f4f), SPH_C32(0x8c45e000), SPH_C32(0xd6d3dbcf), + SPH_C32(0x3cbe4071), SPH_C32(0x08c1748a) }, + { SPH_C32(0x8e6a6000), SPH_C32(0x18f6922b), SPH_C32(0x0dc0fc99), + SPH_C32(0x314c2a6b), SPH_C32(0x1b16e000), SPH_C32(0xf69cb51c), + SPH_C32(0x4b07a87e), SPH_C32(0xa92d2a4b) }, + { SPH_C32(0xe0278000), SPH_C32(0x19dce008), SPH_C32(0xd7075d82), + SPH_C32(0x5ad2e31d), SPH_C32(0xe4788000), SPH_C32(0x859673c1), + SPH_C32(0xb5fb2452), SPH_C32(0x29cc5edf) }, + { SPH_C32(0x090da000), SPH_C32(0xad8b6cf4), SPH_C32(0xc6fd67d5), + SPH_C32(0x671be639), SPH_C32(0x732b8000), SPH_C32(0xa5d91d12), + SPH_C32(0xc242cc5d), SPH_C32(0x8820001e) }, + { SPH_C32(0x77748000), SPH_C32(0x39938edb), SPH_C32(0xa0beb58d), + SPH_C32(0xfb3ebddc), SPH_C32(0x9a01a000), SPH_C32(0x118e91ee), + SPH_C32(0xd3b8f60a), SPH_C32(0xb5e9053a) }, + { SPH_C32(0x9e5ea000), SPH_C32(0x8dc40227), SPH_C32(0xb1448fda), + SPH_C32(0xc6f7b8f8), SPH_C32(0x0d52a000), SPH_C32(0x31c1ff3d), + SPH_C32(0xa4011e05), SPH_C32(0x14055bfb) }, + { SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), SPH_C32(0x5afd9229), + SPH_C32(0x94e42f6f), SPH_C32(0x022f8000), SPH_C32(0xce2549e4), + SPH_C32(0x317ebce8), SPH_C32(0x398d5ee1) }, + { SPH_C32(0x1b16e000), SPH_C32(0xf69cb51c), SPH_C32(0x4b07a87e), + SPH_C32(0xa92d2a4b), SPH_C32(0x957c8000), SPH_C32(0xee6a2737), + SPH_C32(0x46c754e7), SPH_C32(0x98610020) }, + { SPH_C32(0x656fc000), SPH_C32(0x62845733), SPH_C32(0x2d447a26), + SPH_C32(0x350871ae), SPH_C32(0x7c56a000), SPH_C32(0x5a3dabcb), + SPH_C32(0x573d6eb0), SPH_C32(0xa5a80504) }, + { SPH_C32(0x8c45e000), SPH_C32(0xd6d3dbcf), SPH_C32(0x3cbe4071), + SPH_C32(0x08c1748a), SPH_C32(0xeb05a000), SPH_C32(0x7a72c518), + SPH_C32(0x208486bf), SPH_C32(0x04445bc5) }, + { SPH_C32(0x06708000), SPH_C32(0x526fda2d), SPH_C32(0x5382c538), + SPH_C32(0x4a93e323), SPH_C32(0x1034c000), SPH_C32(0x9532900c), + SPH_C32(0xbc847343), SPH_C32(0xf7bb9293) }, + { SPH_C32(0xef5aa000), SPH_C32(0xe63856d1), SPH_C32(0x4278ff6f), + SPH_C32(0x775ae607), SPH_C32(0x8767c000), SPH_C32(0xb57dfedf), + SPH_C32(0xcb3d9b4c), SPH_C32(0x5657cc52) }, + { SPH_C32(0x91238000), SPH_C32(0x7220b4fe), SPH_C32(0x243b2d37), + SPH_C32(0xeb7fbde2), SPH_C32(0x6e4de000), SPH_C32(0x012a7223), + SPH_C32(0xdac7a11b), SPH_C32(0x6b9ec976) }, + { SPH_C32(0x7809a000), SPH_C32(0xc6773802), SPH_C32(0x35c11760), + SPH_C32(0xd6b6b8c6), SPH_C32(0xf91ee000), SPH_C32(0x21651cf0), + SPH_C32(0xad7e4914), SPH_C32(0xca7297b7) }, + { SPH_C32(0x146bc000), SPH_C32(0x097803c5), SPH_C32(0xde780a93), + SPH_C32(0x84a52f51), SPH_C32(0xf663c000), SPH_C32(0xde81aa29), + SPH_C32(0x3801ebf9), SPH_C32(0xe7fa92ad) }, + { SPH_C32(0xfd41e000), SPH_C32(0xbd2f8f39), SPH_C32(0xcf8230c4), + SPH_C32(0xb96c2a75), SPH_C32(0x6130c000), SPH_C32(0xfecec4fa), + SPH_C32(0x4fb803f6), SPH_C32(0x4616cc6c) }, + { SPH_C32(0x8338c000), SPH_C32(0x29376d16), SPH_C32(0xa9c1e29c), + SPH_C32(0x25497190), SPH_C32(0x881ae000), SPH_C32(0x4a994806), + SPH_C32(0x5e4239a1), SPH_C32(0x7bdfc948) }, + { SPH_C32(0x6a12e000), SPH_C32(0x9d60e1ea), SPH_C32(0xb83bd8cb), + SPH_C32(0x188074b4), SPH_C32(0x1f49e000), SPH_C32(0x6ad626d5), + SPH_C32(0x29fbd1ae), SPH_C32(0xda339789) } +}; + +static const sph_u32 T256_6[64][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), SPH_C32(0x6fc548e1), + SPH_C32(0x898d2cd6), SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), + SPH_C32(0x6a72e5bb), SPH_C32(0x247febe6) }, + { SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), SPH_C32(0x6a72e5bb), + SPH_C32(0x247febe6), SPH_C32(0x9b830400), SPH_C32(0x2227ff88), + SPH_C32(0x05b7ad5a), SPH_C32(0xadf2c730) }, + { SPH_C32(0x9b830400), SPH_C32(0x2227ff88), SPH_C32(0x05b7ad5a), + SPH_C32(0xadf2c730), SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), + SPH_C32(0x6fc548e1), SPH_C32(0x898d2cd6) }, + { SPH_C32(0xde320800), SPH_C32(0x288350fe), SPH_C32(0x71852ac7), + SPH_C32(0xa6bf9f96), SPH_C32(0xe18b0000), SPH_C32(0x5459887d), + SPH_C32(0xbf1283d3), SPH_C32(0x1b666a73) }, + { SPH_C32(0x510c0c00), SPH_C32(0x251e9889), SPH_C32(0x1e406226), + SPH_C32(0x2f32b340), SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), + SPH_C32(0xd5606668), SPH_C32(0x3f198195) }, + { SPH_C32(0xca8f0800), SPH_C32(0x07396701), SPH_C32(0x1bf7cf7c), + SPH_C32(0x82c07470), SPH_C32(0x7a080400), SPH_C32(0x767e77f5), + SPH_C32(0xbaa52e89), SPH_C32(0xb694ad43) }, + { SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), SPH_C32(0x7432879d), + SPH_C32(0x0b4d58a6), SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), + SPH_C32(0xd0d7cb32), SPH_C32(0x92eb46a5) }, + { SPH_C32(0xe18b0000), SPH_C32(0x5459887d), SPH_C32(0xbf1283d3), + SPH_C32(0x1b666a73), SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), + SPH_C32(0xce97a914), SPH_C32(0xbdd9f5e5) }, + { SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), SPH_C32(0xd0d7cb32), + SPH_C32(0x92eb46a5), SPH_C32(0x2b040800), SPH_C32(0x5360ef7c), + SPH_C32(0xa4e54caf), SPH_C32(0x99a61e03) }, + { SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), SPH_C32(0xd5606668), + SPH_C32(0x3f198195), SPH_C32(0xa43a0c00), SPH_C32(0x5efd270b), + SPH_C32(0xcb20044e), SPH_C32(0x102b32d5) }, + { SPH_C32(0x7a080400), SPH_C32(0x767e77f5), SPH_C32(0xbaa52e89), + SPH_C32(0xb694ad43), SPH_C32(0xb0870c00), SPH_C32(0x714710f4), + SPH_C32(0xa152e1f5), SPH_C32(0x3454d933) }, + { SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), SPH_C32(0xce97a914), + SPH_C32(0xbdd9f5e5), SPH_C32(0xde320800), SPH_C32(0x288350fe), + SPH_C32(0x71852ac7), SPH_C32(0xa6bf9f96) }, + { SPH_C32(0xb0870c00), SPH_C32(0x714710f4), SPH_C32(0xa152e1f5), + SPH_C32(0x3454d933), SPH_C32(0xca8f0800), SPH_C32(0x07396701), + SPH_C32(0x1bf7cf7c), SPH_C32(0x82c07470) }, + { SPH_C32(0x2b040800), SPH_C32(0x5360ef7c), SPH_C32(0xa4e54caf), + SPH_C32(0x99a61e03), SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), + SPH_C32(0x7432879d), SPH_C32(0x0b4d58a6) }, + { SPH_C32(0xa43a0c00), SPH_C32(0x5efd270b), SPH_C32(0xcb20044e), + SPH_C32(0x102b32d5), SPH_C32(0x510c0c00), SPH_C32(0x251e9889), + SPH_C32(0x1e406226), SPH_C32(0x2f32b340) }, + { SPH_C32(0x74951000), SPH_C32(0x5a2b467e), SPH_C32(0x88fd1d2b), + SPH_C32(0x1ee68292), SPH_C32(0xcba90000), SPH_C32(0x90273769), + SPH_C32(0xbbdcf407), SPH_C32(0xd0f4af61) }, + { SPH_C32(0xfbab1400), SPH_C32(0x57b68e09), SPH_C32(0xe73855ca), + SPH_C32(0x976bae44), SPH_C32(0xdf140000), SPH_C32(0xbf9d0096), + SPH_C32(0xd1ae11bc), SPH_C32(0xf48b4487) }, + { SPH_C32(0x60281000), SPH_C32(0x75917181), SPH_C32(0xe28ff890), + SPH_C32(0x3a996974), SPH_C32(0x502a0400), SPH_C32(0xb200c8e1), + SPH_C32(0xbe6b595d), SPH_C32(0x7d066851) }, + { SPH_C32(0xef161400), SPH_C32(0x780cb9f6), SPH_C32(0x8d4ab071), + SPH_C32(0xb31445a2), SPH_C32(0x44970400), SPH_C32(0x9dbaff1e), + SPH_C32(0xd419bce6), SPH_C32(0x597983b7) }, + { SPH_C32(0xaaa71800), SPH_C32(0x72a81680), SPH_C32(0xf97837ec), + SPH_C32(0xb8591d04), SPH_C32(0x2a220000), SPH_C32(0xc47ebf14), + SPH_C32(0x04ce77d4), SPH_C32(0xcb92c512) }, + { SPH_C32(0x25991c00), SPH_C32(0x7f35def7), SPH_C32(0x96bd7f0d), + SPH_C32(0x31d431d2), SPH_C32(0x3e9f0000), SPH_C32(0xebc488eb), + SPH_C32(0x6ebc926f), SPH_C32(0xefed2ef4) }, + { SPH_C32(0xbe1a1800), SPH_C32(0x5d12217f), SPH_C32(0x930ad257), + SPH_C32(0x9c26f6e2), SPH_C32(0xb1a10400), SPH_C32(0xe659409c), + SPH_C32(0x0179da8e), SPH_C32(0x66600222) }, + { SPH_C32(0x31241c00), SPH_C32(0x508fe908), SPH_C32(0xfccf9ab6), + SPH_C32(0x15abda34), SPH_C32(0xa51c0400), SPH_C32(0xc9e37763), + SPH_C32(0x6b0b3f35), SPH_C32(0x421fe9c4) }, + { SPH_C32(0x951e1000), SPH_C32(0x0e72ce03), SPH_C32(0x37ef9ef8), + SPH_C32(0x0580e8e1), SPH_C32(0xf4100800), SPH_C32(0xecfdefea), + SPH_C32(0x754b5d13), SPH_C32(0x6d2d5a84) }, + { SPH_C32(0x1a201400), SPH_C32(0x03ef0674), SPH_C32(0x582ad619), + SPH_C32(0x8c0dc437), SPH_C32(0xe0ad0800), SPH_C32(0xc347d815), + SPH_C32(0x1f39b8a8), SPH_C32(0x4952b162) }, + { SPH_C32(0x81a31000), SPH_C32(0x21c8f9fc), SPH_C32(0x5d9d7b43), + SPH_C32(0x21ff0307), SPH_C32(0x6f930c00), SPH_C32(0xceda1062), + SPH_C32(0x70fcf049), SPH_C32(0xc0df9db4) }, + { SPH_C32(0x0e9d1400), SPH_C32(0x2c55318b), SPH_C32(0x325833a2), + SPH_C32(0xa8722fd1), SPH_C32(0x7b2e0c00), SPH_C32(0xe160279d), + SPH_C32(0x1a8e15f2), SPH_C32(0xe4a07652) }, + { SPH_C32(0x4b2c1800), SPH_C32(0x26f19efd), SPH_C32(0x466ab43f), + SPH_C32(0xa33f7777), SPH_C32(0x159b0800), SPH_C32(0xb8a46797), + SPH_C32(0xca59dec0), SPH_C32(0x764b30f7) }, + { SPH_C32(0xc4121c00), SPH_C32(0x2b6c568a), SPH_C32(0x29affcde), + SPH_C32(0x2ab25ba1), SPH_C32(0x01260800), SPH_C32(0x971e5068), + SPH_C32(0xa02b3b7b), SPH_C32(0x5234db11) }, + { SPH_C32(0x5f911800), SPH_C32(0x094ba902), SPH_C32(0x2c185184), + SPH_C32(0x87409c91), SPH_C32(0x8e180c00), SPH_C32(0x9a83981f), + SPH_C32(0xcfee739a), SPH_C32(0xdbb9f7c7) }, + { SPH_C32(0xd0af1c00), SPH_C32(0x04d66175), SPH_C32(0x43dd1965), + SPH_C32(0x0ecdb047), SPH_C32(0x9aa50c00), SPH_C32(0xb539afe0), + SPH_C32(0xa59c9621), SPH_C32(0xffc61c21) }, + { SPH_C32(0xcba90000), SPH_C32(0x90273769), SPH_C32(0xbbdcf407), + SPH_C32(0xd0f4af61), SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), + SPH_C32(0x3321e92c), SPH_C32(0xce122df3) }, + { SPH_C32(0x44970400), SPH_C32(0x9dbaff1e), SPH_C32(0xd419bce6), + SPH_C32(0x597983b7), SPH_C32(0xab811000), SPH_C32(0xe5b646e8), + SPH_C32(0x59530c97), SPH_C32(0xea6dc615) }, + { SPH_C32(0xdf140000), SPH_C32(0xbf9d0096), SPH_C32(0xd1ae11bc), + SPH_C32(0xf48b4487), SPH_C32(0x24bf1400), SPH_C32(0xe82b8e9f), + SPH_C32(0x36964476), SPH_C32(0x63e0eac3) }, + { SPH_C32(0x502a0400), SPH_C32(0xb200c8e1), SPH_C32(0xbe6b595d), + SPH_C32(0x7d066851), SPH_C32(0x30021400), SPH_C32(0xc791b960), + SPH_C32(0x5ce4a1cd), SPH_C32(0x479f0125) }, + { SPH_C32(0x159b0800), SPH_C32(0xb8a46797), SPH_C32(0xca59dec0), + SPH_C32(0x764b30f7), SPH_C32(0x5eb71000), SPH_C32(0x9e55f96a), + SPH_C32(0x8c336aff), SPH_C32(0xd5744780) }, + { SPH_C32(0x9aa50c00), SPH_C32(0xb539afe0), SPH_C32(0xa59c9621), + SPH_C32(0xffc61c21), SPH_C32(0x4a0a1000), SPH_C32(0xb1efce95), + SPH_C32(0xe6418f44), SPH_C32(0xf10bac66) }, + { SPH_C32(0x01260800), SPH_C32(0x971e5068), SPH_C32(0xa02b3b7b), + SPH_C32(0x5234db11), SPH_C32(0xc5341400), SPH_C32(0xbc7206e2), + SPH_C32(0x8984c7a5), SPH_C32(0x788680b0) }, + { SPH_C32(0x8e180c00), SPH_C32(0x9a83981f), SPH_C32(0xcfee739a), + SPH_C32(0xdbb9f7c7), SPH_C32(0xd1891400), SPH_C32(0x93c8311d), + SPH_C32(0xe3f6221e), SPH_C32(0x5cf96b56) }, + { SPH_C32(0x2a220000), SPH_C32(0xc47ebf14), SPH_C32(0x04ce77d4), + SPH_C32(0xcb92c512), SPH_C32(0x80851800), SPH_C32(0xb6d6a994), + SPH_C32(0xfdb64038), SPH_C32(0x73cbd816) }, + { SPH_C32(0xa51c0400), SPH_C32(0xc9e37763), SPH_C32(0x6b0b3f35), + SPH_C32(0x421fe9c4), SPH_C32(0x94381800), SPH_C32(0x996c9e6b), + SPH_C32(0x97c4a583), SPH_C32(0x57b433f0) }, + { SPH_C32(0x3e9f0000), SPH_C32(0xebc488eb), SPH_C32(0x6ebc926f), + SPH_C32(0xefed2ef4), SPH_C32(0x1b061c00), SPH_C32(0x94f1561c), + SPH_C32(0xf801ed62), SPH_C32(0xde391f26) }, + { SPH_C32(0xb1a10400), SPH_C32(0xe659409c), SPH_C32(0x0179da8e), + SPH_C32(0x66600222), SPH_C32(0x0fbb1c00), SPH_C32(0xbb4b61e3), + SPH_C32(0x927308d9), SPH_C32(0xfa46f4c0) }, + { SPH_C32(0xf4100800), SPH_C32(0xecfdefea), SPH_C32(0x754b5d13), + SPH_C32(0x6d2d5a84), SPH_C32(0x610e1800), SPH_C32(0xe28f21e9), + SPH_C32(0x42a4c3eb), SPH_C32(0x68adb265) }, + { SPH_C32(0x7b2e0c00), SPH_C32(0xe160279d), SPH_C32(0x1a8e15f2), + SPH_C32(0xe4a07652), SPH_C32(0x75b31800), SPH_C32(0xcd351616), + SPH_C32(0x28d62650), SPH_C32(0x4cd25983) }, + { SPH_C32(0xe0ad0800), SPH_C32(0xc347d815), SPH_C32(0x1f39b8a8), + SPH_C32(0x4952b162), SPH_C32(0xfa8d1c00), SPH_C32(0xc0a8de61), + SPH_C32(0x47136eb1), SPH_C32(0xc55f7555) }, + { SPH_C32(0x6f930c00), SPH_C32(0xceda1062), SPH_C32(0x70fcf049), + SPH_C32(0xc0df9db4), SPH_C32(0xee301c00), SPH_C32(0xef12e99e), + SPH_C32(0x2d618b0a), SPH_C32(0xe1209eb3) }, + { SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), SPH_C32(0x3321e92c), + SPH_C32(0xce122df3), SPH_C32(0x74951000), SPH_C32(0x5a2b467e), + SPH_C32(0x88fd1d2b), SPH_C32(0x1ee68292) }, + { SPH_C32(0x30021400), SPH_C32(0xc791b960), SPH_C32(0x5ce4a1cd), + SPH_C32(0x479f0125), SPH_C32(0x60281000), SPH_C32(0x75917181), + SPH_C32(0xe28ff890), SPH_C32(0x3a996974) }, + { SPH_C32(0xab811000), SPH_C32(0xe5b646e8), SPH_C32(0x59530c97), + SPH_C32(0xea6dc615), SPH_C32(0xef161400), SPH_C32(0x780cb9f6), + SPH_C32(0x8d4ab071), SPH_C32(0xb31445a2) }, + { SPH_C32(0x24bf1400), SPH_C32(0xe82b8e9f), SPH_C32(0x36964476), + SPH_C32(0x63e0eac3), SPH_C32(0xfbab1400), SPH_C32(0x57b68e09), + SPH_C32(0xe73855ca), SPH_C32(0x976bae44) }, + { SPH_C32(0x610e1800), SPH_C32(0xe28f21e9), SPH_C32(0x42a4c3eb), + SPH_C32(0x68adb265), SPH_C32(0x951e1000), SPH_C32(0x0e72ce03), + SPH_C32(0x37ef9ef8), SPH_C32(0x0580e8e1) }, + { SPH_C32(0xee301c00), SPH_C32(0xef12e99e), SPH_C32(0x2d618b0a), + SPH_C32(0xe1209eb3), SPH_C32(0x81a31000), SPH_C32(0x21c8f9fc), + SPH_C32(0x5d9d7b43), SPH_C32(0x21ff0307) }, + { SPH_C32(0x75b31800), SPH_C32(0xcd351616), SPH_C32(0x28d62650), + SPH_C32(0x4cd25983), SPH_C32(0x0e9d1400), SPH_C32(0x2c55318b), + SPH_C32(0x325833a2), SPH_C32(0xa8722fd1) }, + { SPH_C32(0xfa8d1c00), SPH_C32(0xc0a8de61), SPH_C32(0x47136eb1), + SPH_C32(0xc55f7555), SPH_C32(0x1a201400), SPH_C32(0x03ef0674), + SPH_C32(0x582ad619), SPH_C32(0x8c0dc437) }, + { SPH_C32(0x5eb71000), SPH_C32(0x9e55f96a), SPH_C32(0x8c336aff), + SPH_C32(0xd5744780), SPH_C32(0x4b2c1800), SPH_C32(0x26f19efd), + SPH_C32(0x466ab43f), SPH_C32(0xa33f7777) }, + { SPH_C32(0xd1891400), SPH_C32(0x93c8311d), SPH_C32(0xe3f6221e), + SPH_C32(0x5cf96b56), SPH_C32(0x5f911800), SPH_C32(0x094ba902), + SPH_C32(0x2c185184), SPH_C32(0x87409c91) }, + { SPH_C32(0x4a0a1000), SPH_C32(0xb1efce95), SPH_C32(0xe6418f44), + SPH_C32(0xf10bac66), SPH_C32(0xd0af1c00), SPH_C32(0x04d66175), + SPH_C32(0x43dd1965), SPH_C32(0x0ecdb047) }, + { SPH_C32(0xc5341400), SPH_C32(0xbc7206e2), SPH_C32(0x8984c7a5), + SPH_C32(0x788680b0), SPH_C32(0xc4121c00), SPH_C32(0x2b6c568a), + SPH_C32(0x29affcde), SPH_C32(0x2ab25ba1) }, + { SPH_C32(0x80851800), SPH_C32(0xb6d6a994), SPH_C32(0xfdb64038), + SPH_C32(0x73cbd816), SPH_C32(0xaaa71800), SPH_C32(0x72a81680), + SPH_C32(0xf97837ec), SPH_C32(0xb8591d04) }, + { SPH_C32(0x0fbb1c00), SPH_C32(0xbb4b61e3), SPH_C32(0x927308d9), + SPH_C32(0xfa46f4c0), SPH_C32(0xbe1a1800), SPH_C32(0x5d12217f), + SPH_C32(0x930ad257), SPH_C32(0x9c26f6e2) }, + { SPH_C32(0x94381800), SPH_C32(0x996c9e6b), SPH_C32(0x97c4a583), + SPH_C32(0x57b433f0), SPH_C32(0x31241c00), SPH_C32(0x508fe908), + SPH_C32(0xfccf9ab6), SPH_C32(0x15abda34) }, + { SPH_C32(0x1b061c00), SPH_C32(0x94f1561c), SPH_C32(0xf801ed62), + SPH_C32(0xde391f26), SPH_C32(0x25991c00), SPH_C32(0x7f35def7), + SPH_C32(0x96bd7f0d), SPH_C32(0x31d431d2) } +}; + +static const sph_u32 T256_12[64][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), SPH_C32(0xc2c46c55), + SPH_C32(0xf362b233), SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), + SPH_C32(0xd14e094b), SPH_C32(0xb772b42b) }, + { SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), SPH_C32(0xd14e094b), + SPH_C32(0xb772b42b), SPH_C32(0x62740080), SPH_C32(0x0fb84b07), + SPH_C32(0x138a651e), SPH_C32(0x44100618) }, + { SPH_C32(0x62740080), SPH_C32(0x0fb84b07), SPH_C32(0x138a651e), + SPH_C32(0x44100618), SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), + SPH_C32(0xc2c46c55), SPH_C32(0xf362b233) }, + { SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), SPH_C32(0x8589d8ab), + SPH_C32(0xe6c46464), SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), + SPH_C32(0xa29d1297), SPH_C32(0x6ee56854) }, + { SPH_C32(0xec760180), SPH_C32(0xcf102934), SPH_C32(0x474db4fe), + SPH_C32(0x15a6d657), SPH_C32(0x4aea0000), SPH_C32(0xdfd8f43d), + SPH_C32(0x73d31bdc), SPH_C32(0xd997dc7f) }, + { SPH_C32(0x8e020100), SPH_C32(0xc0a86233), SPH_C32(0x54c7d1e0), + SPH_C32(0x51b6d04f), SPH_C32(0x11380080), SPH_C32(0x9ad7ecd1), + SPH_C32(0xb1177789), SPH_C32(0x2af56e4c) }, + { SPH_C32(0xd5d00180), SPH_C32(0x85a77adf), SPH_C32(0x9603bdb5), + SPH_C32(0xa2d4627c), SPH_C32(0x289e0080), SPH_C32(0xd060bf3a), + SPH_C32(0x60597ec2), SPH_C32(0x9d87da67) }, + { SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), SPH_C32(0xa29d1297), + SPH_C32(0x6ee56854), SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), + SPH_C32(0x2714ca3c), SPH_C32(0x88210c30) }, + { SPH_C32(0x289e0080), SPH_C32(0xd060bf3a), SPH_C32(0x60597ec2), + SPH_C32(0x9d87da67), SPH_C32(0xfd4e0100), SPH_C32(0x55c7c5e5), + SPH_C32(0xf65ac377), SPH_C32(0x3f53b81b) }, + { SPH_C32(0x4aea0000), SPH_C32(0xdfd8f43d), SPH_C32(0x73d31bdc), + SPH_C32(0xd997dc7f), SPH_C32(0xa69c0180), SPH_C32(0x10c8dd09), + SPH_C32(0x349eaf22), SPH_C32(0xcc310a28) }, + { SPH_C32(0x11380080), SPH_C32(0x9ad7ecd1), SPH_C32(0xb1177789), + SPH_C32(0x2af56e4c), SPH_C32(0x9f3a0180), SPH_C32(0x5a7f8ee2), + SPH_C32(0xe5d0a669), SPH_C32(0x7b43be03) }, + { SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), SPH_C32(0x2714ca3c), + SPH_C32(0x88210c30), SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), + SPH_C32(0x8589d8ab), SPH_C32(0xe6c46464) }, + { SPH_C32(0x9f3a0180), SPH_C32(0x5a7f8ee2), SPH_C32(0xe5d0a669), + SPH_C32(0x7b43be03), SPH_C32(0x8e020100), SPH_C32(0xc0a86233), + SPH_C32(0x54c7d1e0), SPH_C32(0x51b6d04f) }, + { SPH_C32(0xfd4e0100), SPH_C32(0x55c7c5e5), SPH_C32(0xf65ac377), + SPH_C32(0x3f53b81b), SPH_C32(0xd5d00180), SPH_C32(0x85a77adf), + SPH_C32(0x9603bdb5), SPH_C32(0xa2d4627c) }, + { SPH_C32(0xa69c0180), SPH_C32(0x10c8dd09), SPH_C32(0x349eaf22), + SPH_C32(0xcc310a28), SPH_C32(0xec760180), SPH_C32(0xcf102934), + SPH_C32(0x474db4fe), SPH_C32(0x15a6d657) }, + { SPH_C32(0xa7b80200), SPH_C32(0x1f128433), SPH_C32(0x60e5f9f2), + SPH_C32(0x9e147576), SPH_C32(0xee260000), SPH_C32(0x124b683e), + SPH_C32(0x80c2d68f), SPH_C32(0x3bf3ab2c) }, + { SPH_C32(0xfc6a0280), SPH_C32(0x5a1d9cdf), SPH_C32(0xa22195a7), + SPH_C32(0x6d76c745), SPH_C32(0xd7800000), SPH_C32(0x58fc3bd5), + SPH_C32(0x518cdfc4), SPH_C32(0x8c811f07) }, + { SPH_C32(0x9e1e0200), SPH_C32(0x55a5d7d8), SPH_C32(0xb1abf0b9), + SPH_C32(0x2966c15d), SPH_C32(0x8c520080), SPH_C32(0x1df32339), + SPH_C32(0x9348b391), SPH_C32(0x7fe3ad34) }, + { SPH_C32(0xc5cc0280), SPH_C32(0x10aacf34), SPH_C32(0x736f9cec), + SPH_C32(0xda04736e), SPH_C32(0xb5f40080), SPH_C32(0x574470d2), + SPH_C32(0x4206bada), SPH_C32(0xc891191f) }, + { SPH_C32(0x101c0300), SPH_C32(0x950db5eb), SPH_C32(0xe56c2159), + SPH_C32(0x78d01112), SPH_C32(0x9d6a0000), SPH_C32(0x8724cfe8), + SPH_C32(0x225fc418), SPH_C32(0x5516c378) }, + { SPH_C32(0x4bce0380), SPH_C32(0xd002ad07), SPH_C32(0x27a84d0c), + SPH_C32(0x8bb2a321), SPH_C32(0xa4cc0000), SPH_C32(0xcd939c03), + SPH_C32(0xf311cd53), SPH_C32(0xe2647753) }, + { SPH_C32(0x29ba0300), SPH_C32(0xdfbae600), SPH_C32(0x34222812), + SPH_C32(0xcfa2a539), SPH_C32(0xff1e0080), SPH_C32(0x889c84ef), + SPH_C32(0x31d5a106), SPH_C32(0x1106c560) }, + { SPH_C32(0x72680380), SPH_C32(0x9ab5feec), SPH_C32(0xf6e64447), + SPH_C32(0x3cc0170a), SPH_C32(0xc6b80080), SPH_C32(0xc22bd704), + SPH_C32(0xe09ba84d), SPH_C32(0xa674714b) }, + { SPH_C32(0xd4f40200), SPH_C32(0x8a7d23e5), SPH_C32(0xc278eb65), + SPH_C32(0xf0f11d22), SPH_C32(0x2ace0100), SPH_C32(0x0d3bfe30), + SPH_C32(0xa7d61cb3), SPH_C32(0xb3d2a71c) }, + { SPH_C32(0x8f260280), SPH_C32(0xcf723b09), SPH_C32(0x00bc8730), + SPH_C32(0x0393af11), SPH_C32(0x13680100), SPH_C32(0x478caddb), + SPH_C32(0x769815f8), SPH_C32(0x04a01337) }, + { SPH_C32(0xed520200), SPH_C32(0xc0ca700e), SPH_C32(0x1336e22e), + SPH_C32(0x4783a909), SPH_C32(0x48ba0180), SPH_C32(0x0283b537), + SPH_C32(0xb45c79ad), SPH_C32(0xf7c2a104) }, + { SPH_C32(0xb6800280), SPH_C32(0x85c568e2), SPH_C32(0xd1f28e7b), + SPH_C32(0xb4e11b3a), SPH_C32(0x711c0180), SPH_C32(0x4834e6dc), + SPH_C32(0x651270e6), SPH_C32(0x40b0152f) }, + { SPH_C32(0x63500300), SPH_C32(0x0062123d), SPH_C32(0x47f133ce), + SPH_C32(0x16357946), SPH_C32(0x59820100), SPH_C32(0x985459e6), + SPH_C32(0x054b0e24), SPH_C32(0xdd37cf48) }, + { SPH_C32(0x38820380), SPH_C32(0x456d0ad1), SPH_C32(0x85355f9b), + SPH_C32(0xe557cb75), SPH_C32(0x60240100), SPH_C32(0xd2e30a0d), + SPH_C32(0xd405076f), SPH_C32(0x6a457b63) }, + { SPH_C32(0x5af60300), SPH_C32(0x4ad541d6), SPH_C32(0x96bf3a85), + SPH_C32(0xa147cd6d), SPH_C32(0x3bf60180), SPH_C32(0x97ec12e1), + SPH_C32(0x16c16b3a), SPH_C32(0x9927c950) }, + { SPH_C32(0x01240380), SPH_C32(0x0fda593a), SPH_C32(0x547b56d0), + SPH_C32(0x52257f5e), SPH_C32(0x02500180), SPH_C32(0xdd5b410a), + SPH_C32(0xc78f6271), SPH_C32(0x2e557d7b) }, + { SPH_C32(0xee260000), SPH_C32(0x124b683e), SPH_C32(0x80c2d68f), + SPH_C32(0x3bf3ab2c), SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), + SPH_C32(0xe0272f7d), SPH_C32(0xa5e7de5a) }, + { SPH_C32(0xb5f40080), SPH_C32(0x574470d2), SPH_C32(0x4206bada), + SPH_C32(0xc891191f), SPH_C32(0x70380200), SPH_C32(0x47eebfe6), + SPH_C32(0x31692636), SPH_C32(0x12956a71) }, + { SPH_C32(0xd7800000), SPH_C32(0x58fc3bd5), SPH_C32(0x518cdfc4), + SPH_C32(0x8c811f07), SPH_C32(0x2bea0280), SPH_C32(0x02e1a70a), + SPH_C32(0xf3ad4a63), SPH_C32(0xe1f7d842) }, + { SPH_C32(0x8c520080), SPH_C32(0x1df32339), SPH_C32(0x9348b391), + SPH_C32(0x7fe3ad34), SPH_C32(0x124c0280), SPH_C32(0x4856f4e1), + SPH_C32(0x22e34328), SPH_C32(0x56856c69) }, + { SPH_C32(0x59820100), SPH_C32(0x985459e6), SPH_C32(0x054b0e24), + SPH_C32(0xdd37cf48), SPH_C32(0x3ad20200), SPH_C32(0x98364bdb), + SPH_C32(0x42ba3dea), SPH_C32(0xcb02b60e) }, + { SPH_C32(0x02500180), SPH_C32(0xdd5b410a), SPH_C32(0xc78f6271), + SPH_C32(0x2e557d7b), SPH_C32(0x03740200), SPH_C32(0xd2811830), + SPH_C32(0x93f434a1), SPH_C32(0x7c700225) }, + { SPH_C32(0x60240100), SPH_C32(0xd2e30a0d), SPH_C32(0xd405076f), + SPH_C32(0x6a457b63), SPH_C32(0x58a60280), SPH_C32(0x978e00dc), + SPH_C32(0x513058f4), SPH_C32(0x8f12b016) }, + { SPH_C32(0x3bf60180), SPH_C32(0x97ec12e1), SPH_C32(0x16c16b3a), + SPH_C32(0x9927c950), SPH_C32(0x61000280), SPH_C32(0xdd395337), + SPH_C32(0x807e51bf), SPH_C32(0x3860043d) }, + { SPH_C32(0x9d6a0000), SPH_C32(0x8724cfe8), SPH_C32(0x225fc418), + SPH_C32(0x5516c378), SPH_C32(0x8d760300), SPH_C32(0x12297a03), + SPH_C32(0xc733e541), SPH_C32(0x2dc6d26a) }, + { SPH_C32(0xc6b80080), SPH_C32(0xc22bd704), SPH_C32(0xe09ba84d), + SPH_C32(0xa674714b), SPH_C32(0xb4d00300), SPH_C32(0x589e29e8), + SPH_C32(0x167dec0a), SPH_C32(0x9ab46641) }, + { SPH_C32(0xa4cc0000), SPH_C32(0xcd939c03), SPH_C32(0xf311cd53), + SPH_C32(0xe2647753), SPH_C32(0xef020380), SPH_C32(0x1d913104), + SPH_C32(0xd4b9805f), SPH_C32(0x69d6d472) }, + { SPH_C32(0xff1e0080), SPH_C32(0x889c84ef), SPH_C32(0x31d5a106), + SPH_C32(0x1106c560), SPH_C32(0xd6a40380), SPH_C32(0x572662ef), + SPH_C32(0x05f78914), SPH_C32(0xdea46059) }, + { SPH_C32(0x2ace0100), SPH_C32(0x0d3bfe30), SPH_C32(0xa7d61cb3), + SPH_C32(0xb3d2a71c), SPH_C32(0xfe3a0300), SPH_C32(0x8746ddd5), + SPH_C32(0x65aef7d6), SPH_C32(0x4323ba3e) }, + { SPH_C32(0x711c0180), SPH_C32(0x4834e6dc), SPH_C32(0x651270e6), + SPH_C32(0x40b0152f), SPH_C32(0xc79c0300), SPH_C32(0xcdf18e3e), + SPH_C32(0xb4e0fe9d), SPH_C32(0xf4510e15) }, + { SPH_C32(0x13680100), SPH_C32(0x478caddb), SPH_C32(0x769815f8), + SPH_C32(0x04a01337), SPH_C32(0x9c4e0380), SPH_C32(0x88fe96d2), + SPH_C32(0x762492c8), SPH_C32(0x0733bc26) }, + { SPH_C32(0x48ba0180), SPH_C32(0x0283b537), SPH_C32(0xb45c79ad), + SPH_C32(0xf7c2a104), SPH_C32(0xa5e80380), SPH_C32(0xc249c539), + SPH_C32(0xa76a9b83), SPH_C32(0xb041080d) }, + { SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), SPH_C32(0xe0272f7d), + SPH_C32(0xa5e7de5a), SPH_C32(0xa7b80200), SPH_C32(0x1f128433), + SPH_C32(0x60e5f9f2), SPH_C32(0x9e147576) }, + { SPH_C32(0x124c0280), SPH_C32(0x4856f4e1), SPH_C32(0x22e34328), + SPH_C32(0x56856c69), SPH_C32(0x9e1e0200), SPH_C32(0x55a5d7d8), + SPH_C32(0xb1abf0b9), SPH_C32(0x2966c15d) }, + { SPH_C32(0x70380200), SPH_C32(0x47eebfe6), SPH_C32(0x31692636), + SPH_C32(0x12956a71), SPH_C32(0xc5cc0280), SPH_C32(0x10aacf34), + SPH_C32(0x736f9cec), SPH_C32(0xda04736e) }, + { SPH_C32(0x2bea0280), SPH_C32(0x02e1a70a), SPH_C32(0xf3ad4a63), + SPH_C32(0xe1f7d842), SPH_C32(0xfc6a0280), SPH_C32(0x5a1d9cdf), + SPH_C32(0xa22195a7), SPH_C32(0x6d76c745) }, + { SPH_C32(0xfe3a0300), SPH_C32(0x8746ddd5), SPH_C32(0x65aef7d6), + SPH_C32(0x4323ba3e), SPH_C32(0xd4f40200), SPH_C32(0x8a7d23e5), + SPH_C32(0xc278eb65), SPH_C32(0xf0f11d22) }, + { SPH_C32(0xa5e80380), SPH_C32(0xc249c539), SPH_C32(0xa76a9b83), + SPH_C32(0xb041080d), SPH_C32(0xed520200), SPH_C32(0xc0ca700e), + SPH_C32(0x1336e22e), SPH_C32(0x4783a909) }, + { SPH_C32(0xc79c0300), SPH_C32(0xcdf18e3e), SPH_C32(0xb4e0fe9d), + SPH_C32(0xf4510e15), SPH_C32(0xb6800280), SPH_C32(0x85c568e2), + SPH_C32(0xd1f28e7b), SPH_C32(0xb4e11b3a) }, + { SPH_C32(0x9c4e0380), SPH_C32(0x88fe96d2), SPH_C32(0x762492c8), + SPH_C32(0x0733bc26), SPH_C32(0x8f260280), SPH_C32(0xcf723b09), + SPH_C32(0x00bc8730), SPH_C32(0x0393af11) }, + { SPH_C32(0x3ad20200), SPH_C32(0x98364bdb), SPH_C32(0x42ba3dea), + SPH_C32(0xcb02b60e), SPH_C32(0x63500300), SPH_C32(0x0062123d), + SPH_C32(0x47f133ce), SPH_C32(0x16357946) }, + { SPH_C32(0x61000280), SPH_C32(0xdd395337), SPH_C32(0x807e51bf), + SPH_C32(0x3860043d), SPH_C32(0x5af60300), SPH_C32(0x4ad541d6), + SPH_C32(0x96bf3a85), SPH_C32(0xa147cd6d) }, + { SPH_C32(0x03740200), SPH_C32(0xd2811830), SPH_C32(0x93f434a1), + SPH_C32(0x7c700225), SPH_C32(0x01240380), SPH_C32(0x0fda593a), + SPH_C32(0x547b56d0), SPH_C32(0x52257f5e) }, + { SPH_C32(0x58a60280), SPH_C32(0x978e00dc), SPH_C32(0x513058f4), + SPH_C32(0x8f12b016), SPH_C32(0x38820380), SPH_C32(0x456d0ad1), + SPH_C32(0x85355f9b), SPH_C32(0xe557cb75) }, + { SPH_C32(0x8d760300), SPH_C32(0x12297a03), SPH_C32(0xc733e541), + SPH_C32(0x2dc6d26a), SPH_C32(0x101c0300), SPH_C32(0x950db5eb), + SPH_C32(0xe56c2159), SPH_C32(0x78d01112) }, + { SPH_C32(0xd6a40380), SPH_C32(0x572662ef), SPH_C32(0x05f78914), + SPH_C32(0xdea46059), SPH_C32(0x29ba0300), SPH_C32(0xdfbae600), + SPH_C32(0x34222812), SPH_C32(0xcfa2a539) }, + { SPH_C32(0xb4d00300), SPH_C32(0x589e29e8), SPH_C32(0x167dec0a), + SPH_C32(0x9ab46641), SPH_C32(0x72680380), SPH_C32(0x9ab5feec), + SPH_C32(0xf6e64447), SPH_C32(0x3cc0170a) }, + { SPH_C32(0xef020380), SPH_C32(0x1d913104), SPH_C32(0xd4b9805f), + SPH_C32(0x69d6d472), SPH_C32(0x4bce0380), SPH_C32(0xd002ad07), + SPH_C32(0x27a84d0c), SPH_C32(0x8bb2a321) } +}; + +static const sph_u32 T256_18[64][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x515c0010), SPH_C32(0x40f372fb), SPH_C32(0xfce72602), + SPH_C32(0x71575061), SPH_C32(0x2e390000), SPH_C32(0x64dd6689), + SPH_C32(0x3cd406fc), SPH_C32(0xb1f490bc) }, + { SPH_C32(0x2e390000), SPH_C32(0x64dd6689), SPH_C32(0x3cd406fc), + SPH_C32(0xb1f490bc), SPH_C32(0x7f650010), SPH_C32(0x242e1472), + SPH_C32(0xc03320fe), SPH_C32(0xc0a3c0dd) }, + { SPH_C32(0x7f650010), SPH_C32(0x242e1472), SPH_C32(0xc03320fe), + SPH_C32(0xc0a3c0dd), SPH_C32(0x515c0010), SPH_C32(0x40f372fb), + SPH_C32(0xfce72602), SPH_C32(0x71575061) }, + { SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), SPH_C32(0xf9ce4c04), + SPH_C32(0xe2afa0c0), SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), + SPH_C32(0x79a90df9), SPH_C32(0x63e92178) }, + { SPH_C32(0xf3e40030), SPH_C32(0xc114970d), SPH_C32(0x05296a06), + SPH_C32(0x93f8f0a1), SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), + SPH_C32(0x457d0b05), SPH_C32(0xd21db1c4) }, + { SPH_C32(0x8c810020), SPH_C32(0xe53a837f), SPH_C32(0xc51a4af8), + SPH_C32(0x535b307c), SPH_C32(0x23170010), SPH_C32(0xed94d960), + SPH_C32(0xb99a2d07), SPH_C32(0xa34ae1a5) }, + { SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), SPH_C32(0x39fd6cfa), + SPH_C32(0x220c601d), SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), + SPH_C32(0x854e2bfb), SPH_C32(0x12be7119) }, + { SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), SPH_C32(0x79a90df9), + SPH_C32(0x63e92178), SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), + SPH_C32(0x806741fd), SPH_C32(0x814681b8) }, + { SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), SPH_C32(0x854e2bfb), + SPH_C32(0x12be7119), SPH_C32(0xd0f30020), SPH_C32(0x2c804e6d), + SPH_C32(0xbcb34701), SPH_C32(0x30b21104) }, + { SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), SPH_C32(0x457d0b05), + SPH_C32(0xd21db1c4), SPH_C32(0x81af0030), SPH_C32(0x6c733c96), + SPH_C32(0x40546103), SPH_C32(0x41e54165) }, + { SPH_C32(0x23170010), SPH_C32(0xed94d960), SPH_C32(0xb99a2d07), + SPH_C32(0xa34ae1a5), SPH_C32(0xaf960030), SPH_C32(0x08ae5a1f), + SPH_C32(0x7c8067ff), SPH_C32(0xf011d1d9) }, + { SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), SPH_C32(0x806741fd), + SPH_C32(0x814681b8), SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), + SPH_C32(0xf9ce4c04), SPH_C32(0xe2afa0c0) }, + { SPH_C32(0xaf960030), SPH_C32(0x08ae5a1f), SPH_C32(0x7c8067ff), + SPH_C32(0xf011d1d9), SPH_C32(0x8c810020), SPH_C32(0xe53a837f), + SPH_C32(0xc51a4af8), SPH_C32(0x535b307c) }, + { SPH_C32(0xd0f30020), SPH_C32(0x2c804e6d), SPH_C32(0xbcb34701), + SPH_C32(0x30b21104), SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), + SPH_C32(0x39fd6cfa), SPH_C32(0x220c601d) }, + { SPH_C32(0x81af0030), SPH_C32(0x6c733c96), SPH_C32(0x40546103), + SPH_C32(0x41e54165), SPH_C32(0xf3e40030), SPH_C32(0xc114970d), + SPH_C32(0x05296a06), SPH_C32(0x93f8f0a1) }, + { SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), SPH_C32(0x36656ba8), + SPH_C32(0x23633a05), SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), + SPH_C32(0x5d5ca0f7), SPH_C32(0x727784cb) }, + { SPH_C32(0x1c920050), SPH_C32(0x7ba89e85), SPH_C32(0xca824daa), + SPH_C32(0x52346a64), SPH_C32(0x56920000), SPH_C32(0xc4103cbd), + SPH_C32(0x6188a60b), SPH_C32(0xc3831477) }, + { SPH_C32(0x63f70040), SPH_C32(0x5f868af7), SPH_C32(0x0ab16d54), + SPH_C32(0x9297aab9), SPH_C32(0x07ce0010), SPH_C32(0x84e34e46), + SPH_C32(0x9d6f8009), SPH_C32(0xb2d44416) }, + { SPH_C32(0x32ab0050), SPH_C32(0x1f75f80c), SPH_C32(0xf6564b56), + SPH_C32(0xe3c0fad8), SPH_C32(0x29f70010), SPH_C32(0xe03e28cf), + SPH_C32(0xa1bb86f5), SPH_C32(0x0320d4aa) }, + { SPH_C32(0xef760060), SPH_C32(0xbabc0988), SPH_C32(0xcfab27ac), + SPH_C32(0xc1cc9ac5), SPH_C32(0x24d90000), SPH_C32(0x69779726), + SPH_C32(0x24f5ad0e), SPH_C32(0x119ea5b3) }, + { SPH_C32(0xbe2a0070), SPH_C32(0xfa4f7b73), SPH_C32(0x334c01ae), + SPH_C32(0xb09bcaa4), SPH_C32(0x0ae00000), SPH_C32(0x0daaf1af), + SPH_C32(0x1821abf2), SPH_C32(0xa06a350f) }, + { SPH_C32(0xc14f0060), SPH_C32(0xde616f01), SPH_C32(0xf37f2150), + SPH_C32(0x70380a79), SPH_C32(0x5bbc0010), SPH_C32(0x4d598354), + SPH_C32(0xe4c68df0), SPH_C32(0xd13d656e) }, + { SPH_C32(0x90130070), SPH_C32(0x9e921dfa), SPH_C32(0x0f980752), + SPH_C32(0x016f5a18), SPH_C32(0x75850010), SPH_C32(0x2984e5dd), + SPH_C32(0xd8128b0c), SPH_C32(0x60c9f5d2) }, + { SPH_C32(0x11bc0040), SPH_C32(0xf2e1216c), SPH_C32(0x4fcc6651), + SPH_C32(0x408a1b7d), SPH_C32(0x86610020), SPH_C32(0xe89072d0), + SPH_C32(0xdd3be10a), SPH_C32(0xf3310573) }, + { SPH_C32(0x40e00050), SPH_C32(0xb2125397), SPH_C32(0xb32b4053), + SPH_C32(0x31dd4b1c), SPH_C32(0xa8580020), SPH_C32(0x8c4d1459), + SPH_C32(0xe1efe7f6), SPH_C32(0x42c595cf) }, + { SPH_C32(0x3f850040), SPH_C32(0x963c47e5), SPH_C32(0x731860ad), + SPH_C32(0xf17e8bc1), SPH_C32(0xf9040030), SPH_C32(0xccbe66a2), + SPH_C32(0x1d08c1f4), SPH_C32(0x3392c5ae) }, + { SPH_C32(0x6ed90050), SPH_C32(0xd6cf351e), SPH_C32(0x8fff46af), + SPH_C32(0x8029dba0), SPH_C32(0xd73d0030), SPH_C32(0xa863002b), + SPH_C32(0x21dcc708), SPH_C32(0x82665512) }, + { SPH_C32(0xb3040060), SPH_C32(0x7306c49a), SPH_C32(0xb6022a55), + SPH_C32(0xa225bbbd), SPH_C32(0xda130020), SPH_C32(0x212abfc2), + SPH_C32(0xa492ecf3), SPH_C32(0x90d8240b) }, + { SPH_C32(0xe2580070), SPH_C32(0x33f5b661), SPH_C32(0x4ae50c57), + SPH_C32(0xd372ebdc), SPH_C32(0xf42a0020), SPH_C32(0x45f7d94b), + SPH_C32(0x9846ea0f), SPH_C32(0x212cb4b7) }, + { SPH_C32(0x9d3d0060), SPH_C32(0x17dba213), SPH_C32(0x8ad62ca9), + SPH_C32(0x13d12b01), SPH_C32(0xa5760030), SPH_C32(0x0504abb0), + SPH_C32(0x64a1cc0d), SPH_C32(0x507be4d6) }, + { SPH_C32(0xcc610070), SPH_C32(0x5728d0e8), SPH_C32(0x76310aab), + SPH_C32(0x62867b60), SPH_C32(0x8b4f0030), SPH_C32(0x61d9cd39), + SPH_C32(0x5875caf1), SPH_C32(0xe18f746a) }, + { SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), SPH_C32(0x5d5ca0f7), + SPH_C32(0x727784cb), SPH_C32(0x35650040), SPH_C32(0x9b96b64a), + SPH_C32(0x6b39cb5f), SPH_C32(0x5114bece) }, + { SPH_C32(0x29f70010), SPH_C32(0xe03e28cf), SPH_C32(0xa1bb86f5), + SPH_C32(0x0320d4aa), SPH_C32(0x1b5c0040), SPH_C32(0xff4bd0c3), + SPH_C32(0x57edcda3), SPH_C32(0xe0e02e72) }, + { SPH_C32(0x56920000), SPH_C32(0xc4103cbd), SPH_C32(0x6188a60b), + SPH_C32(0xc3831477), SPH_C32(0x4a000050), SPH_C32(0xbfb8a238), + SPH_C32(0xab0aeba1), SPH_C32(0x91b77e13) }, + { SPH_C32(0x07ce0010), SPH_C32(0x84e34e46), SPH_C32(0x9d6f8009), + SPH_C32(0xb2d44416), SPH_C32(0x64390050), SPH_C32(0xdb65c4b1), + SPH_C32(0x97deed5d), SPH_C32(0x2043eeaf) }, + { SPH_C32(0xda130020), SPH_C32(0x212abfc2), SPH_C32(0xa492ecf3), + SPH_C32(0x90d8240b), SPH_C32(0x69170040), SPH_C32(0x522c7b58), + SPH_C32(0x1290c6a6), SPH_C32(0x32fd9fb6) }, + { SPH_C32(0x8b4f0030), SPH_C32(0x61d9cd39), SPH_C32(0x5875caf1), + SPH_C32(0xe18f746a), SPH_C32(0x472e0040), SPH_C32(0x36f11dd1), + SPH_C32(0x2e44c05a), SPH_C32(0x83090f0a) }, + { SPH_C32(0xf42a0020), SPH_C32(0x45f7d94b), SPH_C32(0x9846ea0f), + SPH_C32(0x212cb4b7), SPH_C32(0x16720050), SPH_C32(0x76026f2a), + SPH_C32(0xd2a3e658), SPH_C32(0xf25e5f6b) }, + { SPH_C32(0xa5760030), SPH_C32(0x0504abb0), SPH_C32(0x64a1cc0d), + SPH_C32(0x507be4d6), SPH_C32(0x384b0050), SPH_C32(0x12df09a3), + SPH_C32(0xee77e0a4), SPH_C32(0x43aacfd7) }, + { SPH_C32(0x24d90000), SPH_C32(0x69779726), SPH_C32(0x24f5ad0e), + SPH_C32(0x119ea5b3), SPH_C32(0xcbaf0060), SPH_C32(0xd3cb9eae), + SPH_C32(0xeb5e8aa2), SPH_C32(0xd0523f76) }, + { SPH_C32(0x75850010), SPH_C32(0x2984e5dd), SPH_C32(0xd8128b0c), + SPH_C32(0x60c9f5d2), SPH_C32(0xe5960060), SPH_C32(0xb716f827), + SPH_C32(0xd78a8c5e), SPH_C32(0x61a6afca) }, + { SPH_C32(0x0ae00000), SPH_C32(0x0daaf1af), SPH_C32(0x1821abf2), + SPH_C32(0xa06a350f), SPH_C32(0xb4ca0070), SPH_C32(0xf7e58adc), + SPH_C32(0x2b6daa5c), SPH_C32(0x10f1ffab) }, + { SPH_C32(0x5bbc0010), SPH_C32(0x4d598354), SPH_C32(0xe4c68df0), + SPH_C32(0xd13d656e), SPH_C32(0x9af30070), SPH_C32(0x9338ec55), + SPH_C32(0x17b9aca0), SPH_C32(0xa1056f17) }, + { SPH_C32(0x86610020), SPH_C32(0xe89072d0), SPH_C32(0xdd3be10a), + SPH_C32(0xf3310573), SPH_C32(0x97dd0060), SPH_C32(0x1a7153bc), + SPH_C32(0x92f7875b), SPH_C32(0xb3bb1e0e) }, + { SPH_C32(0xd73d0030), SPH_C32(0xa863002b), SPH_C32(0x21dcc708), + SPH_C32(0x82665512), SPH_C32(0xb9e40060), SPH_C32(0x7eac3535), + SPH_C32(0xae2381a7), SPH_C32(0x024f8eb2) }, + { SPH_C32(0xa8580020), SPH_C32(0x8c4d1459), SPH_C32(0xe1efe7f6), + SPH_C32(0x42c595cf), SPH_C32(0xe8b80070), SPH_C32(0x3e5f47ce), + SPH_C32(0x52c4a7a5), SPH_C32(0x7318ded3) }, + { SPH_C32(0xf9040030), SPH_C32(0xccbe66a2), SPH_C32(0x1d08c1f4), + SPH_C32(0x3392c5ae), SPH_C32(0xc6810070), SPH_C32(0x5a822147), + SPH_C32(0x6e10a159), SPH_C32(0xc2ec4e6f) }, + { SPH_C32(0x35650040), SPH_C32(0x9b96b64a), SPH_C32(0x6b39cb5f), + SPH_C32(0x5114bece), SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), + SPH_C32(0x36656ba8), SPH_C32(0x23633a05) }, + { SPH_C32(0x64390050), SPH_C32(0xdb65c4b1), SPH_C32(0x97deed5d), + SPH_C32(0x2043eeaf), SPH_C32(0x63f70040), SPH_C32(0x5f868af7), + SPH_C32(0x0ab16d54), SPH_C32(0x9297aab9) }, + { SPH_C32(0x1b5c0040), SPH_C32(0xff4bd0c3), SPH_C32(0x57edcda3), + SPH_C32(0xe0e02e72), SPH_C32(0x32ab0050), SPH_C32(0x1f75f80c), + SPH_C32(0xf6564b56), SPH_C32(0xe3c0fad8) }, + { SPH_C32(0x4a000050), SPH_C32(0xbfb8a238), SPH_C32(0xab0aeba1), + SPH_C32(0x91b77e13), SPH_C32(0x1c920050), SPH_C32(0x7ba89e85), + SPH_C32(0xca824daa), SPH_C32(0x52346a64) }, + { SPH_C32(0x97dd0060), SPH_C32(0x1a7153bc), SPH_C32(0x92f7875b), + SPH_C32(0xb3bb1e0e), SPH_C32(0x11bc0040), SPH_C32(0xf2e1216c), + SPH_C32(0x4fcc6651), SPH_C32(0x408a1b7d) }, + { SPH_C32(0xc6810070), SPH_C32(0x5a822147), SPH_C32(0x6e10a159), + SPH_C32(0xc2ec4e6f), SPH_C32(0x3f850040), SPH_C32(0x963c47e5), + SPH_C32(0x731860ad), SPH_C32(0xf17e8bc1) }, + { SPH_C32(0xb9e40060), SPH_C32(0x7eac3535), SPH_C32(0xae2381a7), + SPH_C32(0x024f8eb2), SPH_C32(0x6ed90050), SPH_C32(0xd6cf351e), + SPH_C32(0x8fff46af), SPH_C32(0x8029dba0) }, + { SPH_C32(0xe8b80070), SPH_C32(0x3e5f47ce), SPH_C32(0x52c4a7a5), + SPH_C32(0x7318ded3), SPH_C32(0x40e00050), SPH_C32(0xb2125397), + SPH_C32(0xb32b4053), SPH_C32(0x31dd4b1c) }, + { SPH_C32(0x69170040), SPH_C32(0x522c7b58), SPH_C32(0x1290c6a6), + SPH_C32(0x32fd9fb6), SPH_C32(0xb3040060), SPH_C32(0x7306c49a), + SPH_C32(0xb6022a55), SPH_C32(0xa225bbbd) }, + { SPH_C32(0x384b0050), SPH_C32(0x12df09a3), SPH_C32(0xee77e0a4), + SPH_C32(0x43aacfd7), SPH_C32(0x9d3d0060), SPH_C32(0x17dba213), + SPH_C32(0x8ad62ca9), SPH_C32(0x13d12b01) }, + { SPH_C32(0x472e0040), SPH_C32(0x36f11dd1), SPH_C32(0x2e44c05a), + SPH_C32(0x83090f0a), SPH_C32(0xcc610070), SPH_C32(0x5728d0e8), + SPH_C32(0x76310aab), SPH_C32(0x62867b60) }, + { SPH_C32(0x16720050), SPH_C32(0x76026f2a), SPH_C32(0xd2a3e658), + SPH_C32(0xf25e5f6b), SPH_C32(0xe2580070), SPH_C32(0x33f5b661), + SPH_C32(0x4ae50c57), SPH_C32(0xd372ebdc) }, + { SPH_C32(0xcbaf0060), SPH_C32(0xd3cb9eae), SPH_C32(0xeb5e8aa2), + SPH_C32(0xd0523f76), SPH_C32(0xef760060), SPH_C32(0xbabc0988), + SPH_C32(0xcfab27ac), SPH_C32(0xc1cc9ac5) }, + { SPH_C32(0x9af30070), SPH_C32(0x9338ec55), SPH_C32(0x17b9aca0), + SPH_C32(0xa1056f17), SPH_C32(0xc14f0060), SPH_C32(0xde616f01), + SPH_C32(0xf37f2150), SPH_C32(0x70380a79) }, + { SPH_C32(0xe5960060), SPH_C32(0xb716f827), SPH_C32(0xd78a8c5e), + SPH_C32(0x61a6afca), SPH_C32(0x90130070), SPH_C32(0x9e921dfa), + SPH_C32(0x0f980752), SPH_C32(0x016f5a18) }, + { SPH_C32(0xb4ca0070), SPH_C32(0xf7e58adc), SPH_C32(0x2b6daa5c), + SPH_C32(0x10f1ffab), SPH_C32(0xbe2a0070), SPH_C32(0xfa4f7b73), + SPH_C32(0x334c01ae), SPH_C32(0xb09bcaa4) } +}; + +static const sph_u32 T256_24[64][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), SPH_C32(0x99e585aa), + SPH_C32(0x8d75f7f1), SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), + SPH_C32(0x79e22a4c), SPH_C32(0x1298bd46) }, + { SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), SPH_C32(0x79e22a4c), + SPH_C32(0x1298bd46), SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), + SPH_C32(0xe007afe6), SPH_C32(0x9fed4ab7) }, + { SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), SPH_C32(0xe007afe6), + SPH_C32(0x9fed4ab7), SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), + SPH_C32(0x99e585aa), SPH_C32(0x8d75f7f1) }, + { SPH_C32(0xd0080004), SPH_C32(0x8c768f77), SPH_C32(0x9dc5b050), + SPH_C32(0xaf4a29da), SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), + SPH_C32(0x98321c3d), SPH_C32(0x76acc733) }, + { SPH_C32(0x582b0006), SPH_C32(0xd39128c4), SPH_C32(0x042035fa), + SPH_C32(0x223fde2b), SPH_C32(0x3a050000), SPH_C32(0x6508f6be), + SPH_C32(0xe1d03671), SPH_C32(0x64347a75) }, + { SPH_C32(0x81a40004), SPH_C32(0xa9958063), SPH_C32(0xe4279a1c), + SPH_C32(0xbdd2949c), SPH_C32(0xb2260002), SPH_C32(0x3aef510d), + SPH_C32(0x7835b3db), SPH_C32(0xe9418d84) }, + { SPH_C32(0x09870006), SPH_C32(0xf67227d0), SPH_C32(0x7dc21fb6), + SPH_C32(0x30a7636d), SPH_C32(0xe38a0002), SPH_C32(0x1f0c5e19), + SPH_C32(0x01d79997), SPH_C32(0xfbd930c2) }, + { SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), SPH_C32(0x98321c3d), + SPH_C32(0x76acc733), SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), + SPH_C32(0x05f7ac6d), SPH_C32(0xd9e6eee9) }, + { SPH_C32(0xe38a0002), SPH_C32(0x1f0c5e19), SPH_C32(0x01d79997), + SPH_C32(0xfbd930c2), SPH_C32(0xea0d0004), SPH_C32(0xe97e79c9), + SPH_C32(0x7c158621), SPH_C32(0xcb7e53af) }, + { SPH_C32(0x3a050000), SPH_C32(0x6508f6be), SPH_C32(0xe1d03671), + SPH_C32(0x64347a75), SPH_C32(0x622e0006), SPH_C32(0xb699de7a), + SPH_C32(0xe5f0038b), SPH_C32(0x460ba45e) }, + { SPH_C32(0xb2260002), SPH_C32(0x3aef510d), SPH_C32(0x7835b3db), + SPH_C32(0xe9418d84), SPH_C32(0x33820006), SPH_C32(0x937ad16e), + SPH_C32(0x9c1229c7), SPH_C32(0x54931918) }, + { SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), SPH_C32(0x05f7ac6d), + SPH_C32(0xd9e6eee9), SPH_C32(0xd0080004), SPH_C32(0x8c768f77), + SPH_C32(0x9dc5b050), SPH_C32(0xaf4a29da) }, + { SPH_C32(0x33820006), SPH_C32(0x937ad16e), SPH_C32(0x9c1229c7), + SPH_C32(0x54931918), SPH_C32(0x81a40004), SPH_C32(0xa9958063), + SPH_C32(0xe4279a1c), SPH_C32(0xbdd2949c) }, + { SPH_C32(0xea0d0004), SPH_C32(0xe97e79c9), SPH_C32(0x7c158621), + SPH_C32(0xcb7e53af), SPH_C32(0x09870006), SPH_C32(0xf67227d0), + SPH_C32(0x7dc21fb6), SPH_C32(0x30a7636d) }, + { SPH_C32(0x622e0006), SPH_C32(0xb699de7a), SPH_C32(0xe5f0038b), + SPH_C32(0x460ba45e), SPH_C32(0x582b0006), SPH_C32(0xd39128c4), + SPH_C32(0x042035fa), SPH_C32(0x223fde2b) }, + { SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), SPH_C32(0xfe739301), + SPH_C32(0xb8a92831), SPH_C32(0x171c0000), SPH_C32(0xb26e3344), + SPH_C32(0x9e6a837e), SPH_C32(0x58f8485f) }, + { SPH_C32(0x208d000a), SPH_C32(0x7f9e9ece), SPH_C32(0x679616ab), + SPH_C32(0x35dcdfc0), SPH_C32(0x46b00000), SPH_C32(0x978d3c50), + SPH_C32(0xe788a932), SPH_C32(0x4a60f519) }, + { SPH_C32(0xf9020008), SPH_C32(0x059a3669), SPH_C32(0x8791b94d), + SPH_C32(0xaa319577), SPH_C32(0xce930002), SPH_C32(0xc86a9be3), + SPH_C32(0x7e6d2c98), SPH_C32(0xc71502e8) }, + { SPH_C32(0x7121000a), SPH_C32(0x5a7d91da), SPH_C32(0x1e743ce7), + SPH_C32(0x27446286), SPH_C32(0x9f3f0002), SPH_C32(0xed8994f7), + SPH_C32(0x078f06d4), SPH_C32(0xd58dbfae) }, + { SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), SPH_C32(0x63b62351), + SPH_C32(0x17e301eb), SPH_C32(0x7cb50000), SPH_C32(0xf285caee), + SPH_C32(0x06589f43), SPH_C32(0x2e548f6c) }, + { SPH_C32(0xf085000e), SPH_C32(0xf3e811b9), SPH_C32(0xfa53a6fb), + SPH_C32(0x9a96f61a), SPH_C32(0x2d190000), SPH_C32(0xd766c5fa), + SPH_C32(0x7fbab50f), SPH_C32(0x3ccc322a) }, + { SPH_C32(0x290a000c), SPH_C32(0x89ecb91e), SPH_C32(0x1a54091d), + SPH_C32(0x057bbcad), SPH_C32(0xa53a0002), SPH_C32(0x88816249), + SPH_C32(0xe65f30a5), SPH_C32(0xb1b9c5db) }, + { SPH_C32(0xa129000e), SPH_C32(0xd60b1ead), SPH_C32(0x83b18cb7), + SPH_C32(0x880e4b5c), SPH_C32(0xf4960002), SPH_C32(0xad626d5d), + SPH_C32(0x9fbd1ae9), SPH_C32(0xa321789d) }, + { SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), SPH_C32(0x66418f3c), + SPH_C32(0xce05ef02), SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), + SPH_C32(0x9b9d2f13), SPH_C32(0x811ea6b6) }, + { SPH_C32(0x4b24000a), SPH_C32(0x3f756764), SPH_C32(0xffa40a96), + SPH_C32(0x437018f3), SPH_C32(0xfd110004), SPH_C32(0x5b104a8d), + SPH_C32(0xe27f055f), SPH_C32(0x93861bf0) }, + { SPH_C32(0x92ab0008), SPH_C32(0x4571cfc3), SPH_C32(0x1fa3a570), + SPH_C32(0xdc9d5244), SPH_C32(0x75320006), SPH_C32(0x04f7ed3e), + SPH_C32(0x7b9a80f5), SPH_C32(0x1ef3ec01) }, + { SPH_C32(0x1a88000a), SPH_C32(0x1a966870), SPH_C32(0x864620da), + SPH_C32(0x51e8a5b5), SPH_C32(0x249e0006), SPH_C32(0x2114e22a), + SPH_C32(0x0278aab9), SPH_C32(0x0c6b5147) }, + { SPH_C32(0x130f000c), SPH_C32(0xece44fa0), SPH_C32(0xfb843f6c), + SPH_C32(0x614fc6d8), SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), + SPH_C32(0x03af332e), SPH_C32(0xf7b26185) }, + { SPH_C32(0x9b2c000e), SPH_C32(0xb303e813), SPH_C32(0x6261bac6), + SPH_C32(0xec3a3129), SPH_C32(0x96b80004), SPH_C32(0x1bfbb327), + SPH_C32(0x7a4d1962), SPH_C32(0xe52adcc3) }, + { SPH_C32(0x42a3000c), SPH_C32(0xc90740b4), SPH_C32(0x82661520), + SPH_C32(0x73d77b9e), SPH_C32(0x1e9b0006), SPH_C32(0x441c1494), + SPH_C32(0xe3a89cc8), SPH_C32(0x685f2b32) }, + { SPH_C32(0xca80000e), SPH_C32(0x96e0e707), SPH_C32(0x1b83908a), + SPH_C32(0xfea28c6f), SPH_C32(0x4f370006), SPH_C32(0x61ff1b80), + SPH_C32(0x9a4ab684), SPH_C32(0x7ac79674) }, + { SPH_C32(0x171c0000), SPH_C32(0xb26e3344), SPH_C32(0x9e6a837e), + SPH_C32(0x58f8485f), SPH_C32(0xbfb20008), SPH_C32(0x92170a39), + SPH_C32(0x6019107f), SPH_C32(0xe051606e) }, + { SPH_C32(0x9f3f0002), SPH_C32(0xed8994f7), SPH_C32(0x078f06d4), + SPH_C32(0xd58dbfae), SPH_C32(0xee1e0008), SPH_C32(0xb7f4052d), + SPH_C32(0x19fb3a33), SPH_C32(0xf2c9dd28) }, + { SPH_C32(0x46b00000), SPH_C32(0x978d3c50), SPH_C32(0xe788a932), + SPH_C32(0x4a60f519), SPH_C32(0x663d000a), SPH_C32(0xe813a29e), + SPH_C32(0x801ebf99), SPH_C32(0x7fbc2ad9) }, + { SPH_C32(0xce930002), SPH_C32(0xc86a9be3), SPH_C32(0x7e6d2c98), + SPH_C32(0xc71502e8), SPH_C32(0x3791000a), SPH_C32(0xcdf0ad8a), + SPH_C32(0xf9fc95d5), SPH_C32(0x6d24979f) }, + { SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), SPH_C32(0x03af332e), + SPH_C32(0xf7b26185), SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), + SPH_C32(0xf82b0c42), SPH_C32(0x96fda75d) }, + { SPH_C32(0x4f370006), SPH_C32(0x61ff1b80), SPH_C32(0x9a4ab684), + SPH_C32(0x7ac79674), SPH_C32(0x85b70008), SPH_C32(0xf71ffc87), + SPH_C32(0x81c9260e), SPH_C32(0x84651a1b) }, + { SPH_C32(0x96b80004), SPH_C32(0x1bfbb327), SPH_C32(0x7a4d1962), + SPH_C32(0xe52adcc3), SPH_C32(0x0d94000a), SPH_C32(0xa8f85b34), + SPH_C32(0x182ca3a4), SPH_C32(0x0910edea) }, + { SPH_C32(0x1e9b0006), SPH_C32(0x441c1494), SPH_C32(0xe3a89cc8), + SPH_C32(0x685f2b32), SPH_C32(0x5c38000a), SPH_C32(0x8d1b5420), + SPH_C32(0x61ce89e8), SPH_C32(0x1b8850ac) }, + { SPH_C32(0x7cb50000), SPH_C32(0xf285caee), SPH_C32(0x06589f43), + SPH_C32(0x2e548f6c), SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), + SPH_C32(0x65eebc12), SPH_C32(0x39b78e87) }, + { SPH_C32(0xf4960002), SPH_C32(0xad626d5d), SPH_C32(0x9fbd1ae9), + SPH_C32(0xa321789d), SPH_C32(0x55bf000c), SPH_C32(0x7b6973f0), + SPH_C32(0x1c0c965e), SPH_C32(0x2b2f33c1) }, + { SPH_C32(0x2d190000), SPH_C32(0xd766c5fa), SPH_C32(0x7fbab50f), + SPH_C32(0x3ccc322a), SPH_C32(0xdd9c000e), SPH_C32(0x248ed443), + SPH_C32(0x85e913f4), SPH_C32(0xa65ac430) }, + { SPH_C32(0xa53a0002), SPH_C32(0x88816249), SPH_C32(0xe65f30a5), + SPH_C32(0xb1b9c5db), SPH_C32(0x8c30000e), SPH_C32(0x016ddb57), + SPH_C32(0xfc0b39b8), SPH_C32(0xb4c27976) }, + { SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), SPH_C32(0x9b9d2f13), + SPH_C32(0x811ea6b6), SPH_C32(0x6fba000c), SPH_C32(0x1e61854e), + SPH_C32(0xfddca02f), SPH_C32(0x4f1b49b4) }, + { SPH_C32(0x249e0006), SPH_C32(0x2114e22a), SPH_C32(0x0278aab9), + SPH_C32(0x0c6b5147), SPH_C32(0x3e16000c), SPH_C32(0x3b828a5a), + SPH_C32(0x843e8a63), SPH_C32(0x5d83f4f2) }, + { SPH_C32(0xfd110004), SPH_C32(0x5b104a8d), SPH_C32(0xe27f055f), + SPH_C32(0x93861bf0), SPH_C32(0xb635000e), SPH_C32(0x64652de9), + SPH_C32(0x1ddb0fc9), SPH_C32(0xd0f60303) }, + { SPH_C32(0x75320006), SPH_C32(0x04f7ed3e), SPH_C32(0x7b9a80f5), + SPH_C32(0x1ef3ec01), SPH_C32(0xe799000e), SPH_C32(0x418622fd), + SPH_C32(0x64392585), SPH_C32(0xc26ebe45) }, + { SPH_C32(0xbfb20008), SPH_C32(0x92170a39), SPH_C32(0x6019107f), + SPH_C32(0xe051606e), SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), + SPH_C32(0xfe739301), SPH_C32(0xb8a92831) }, + { SPH_C32(0x3791000a), SPH_C32(0xcdf0ad8a), SPH_C32(0xf9fc95d5), + SPH_C32(0x6d24979f), SPH_C32(0xf9020008), SPH_C32(0x059a3669), + SPH_C32(0x8791b94d), SPH_C32(0xaa319577) }, + { SPH_C32(0xee1e0008), SPH_C32(0xb7f4052d), SPH_C32(0x19fb3a33), + SPH_C32(0xf2c9dd28), SPH_C32(0x7121000a), SPH_C32(0x5a7d91da), + SPH_C32(0x1e743ce7), SPH_C32(0x27446286) }, + { SPH_C32(0x663d000a), SPH_C32(0xe813a29e), SPH_C32(0x801ebf99), + SPH_C32(0x7fbc2ad9), SPH_C32(0x208d000a), SPH_C32(0x7f9e9ece), + SPH_C32(0x679616ab), SPH_C32(0x35dcdfc0) }, + { SPH_C32(0x6fba000c), SPH_C32(0x1e61854e), SPH_C32(0xfddca02f), + SPH_C32(0x4f1b49b4), SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), + SPH_C32(0x66418f3c), SPH_C32(0xce05ef02) }, + { SPH_C32(0xe799000e), SPH_C32(0x418622fd), SPH_C32(0x64392585), + SPH_C32(0xc26ebe45), SPH_C32(0x92ab0008), SPH_C32(0x4571cfc3), + SPH_C32(0x1fa3a570), SPH_C32(0xdc9d5244) }, + { SPH_C32(0x3e16000c), SPH_C32(0x3b828a5a), SPH_C32(0x843e8a63), + SPH_C32(0x5d83f4f2), SPH_C32(0x1a88000a), SPH_C32(0x1a966870), + SPH_C32(0x864620da), SPH_C32(0x51e8a5b5) }, + { SPH_C32(0xb635000e), SPH_C32(0x64652de9), SPH_C32(0x1ddb0fc9), + SPH_C32(0xd0f60303), SPH_C32(0x4b24000a), SPH_C32(0x3f756764), + SPH_C32(0xffa40a96), SPH_C32(0x437018f3) }, + { SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), SPH_C32(0xf82b0c42), + SPH_C32(0x96fda75d), SPH_C32(0x130f000c), SPH_C32(0xece44fa0), + SPH_C32(0xfb843f6c), SPH_C32(0x614fc6d8) }, + { SPH_C32(0x5c38000a), SPH_C32(0x8d1b5420), SPH_C32(0x61ce89e8), + SPH_C32(0x1b8850ac), SPH_C32(0x42a3000c), SPH_C32(0xc90740b4), + SPH_C32(0x82661520), SPH_C32(0x73d77b9e) }, + { SPH_C32(0x85b70008), SPH_C32(0xf71ffc87), SPH_C32(0x81c9260e), + SPH_C32(0x84651a1b), SPH_C32(0xca80000e), SPH_C32(0x96e0e707), + SPH_C32(0x1b83908a), SPH_C32(0xfea28c6f) }, + { SPH_C32(0x0d94000a), SPH_C32(0xa8f85b34), SPH_C32(0x182ca3a4), + SPH_C32(0x0910edea), SPH_C32(0x9b2c000e), SPH_C32(0xb303e813), + SPH_C32(0x6261bac6), SPH_C32(0xec3a3129) }, + { SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), SPH_C32(0x65eebc12), + SPH_C32(0x39b78e87), SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), + SPH_C32(0x63b62351), SPH_C32(0x17e301eb) }, + { SPH_C32(0x8c30000e), SPH_C32(0x016ddb57), SPH_C32(0xfc0b39b8), + SPH_C32(0xb4c27976), SPH_C32(0x290a000c), SPH_C32(0x89ecb91e), + SPH_C32(0x1a54091d), SPH_C32(0x057bbcad) }, + { SPH_C32(0x55bf000c), SPH_C32(0x7b6973f0), SPH_C32(0x1c0c965e), + SPH_C32(0x2b2f33c1), SPH_C32(0xa129000e), SPH_C32(0xd60b1ead), + SPH_C32(0x83b18cb7), SPH_C32(0x880e4b5c) }, + { SPH_C32(0xdd9c000e), SPH_C32(0x248ed443), SPH_C32(0x85e913f4), + SPH_C32(0xa65ac430), SPH_C32(0xf085000e), SPH_C32(0xf3e811b9), + SPH_C32(0xfa53a6fb), SPH_C32(0x9a96f61a) } +}; + +static const sph_u32 T256_30[4][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), SPH_C32(0xae0ebb05), + SPH_C32(0xb5a4c63b), SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), + SPH_C32(0x6bf648a4), SPH_C32(0x539cbdbf) }, + { SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), SPH_C32(0x6bf648a4), + SPH_C32(0x539cbdbf), SPH_C32(0x08bf0001), SPH_C32(0x38942792), + SPH_C32(0xc5f8f3a1), SPH_C32(0xe6387b84) }, + { SPH_C32(0x08bf0001), SPH_C32(0x38942792), SPH_C32(0xc5f8f3a1), + SPH_C32(0xe6387b84), SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), + SPH_C32(0xae0ebb05), SPH_C32(0xb5a4c63b) } +}; + +#define INPUT_SMALL do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T256_0[acc >> 2][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + acc = (acc << 8) | buf[1]; \ + rp = &T256_6[(acc >> 4) & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = (acc << 8) | buf[2]; \ + rp = &T256_12[(acc >> 6) & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_18[acc & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[3]; \ + rp = &T256_24[acc >> 2][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_30[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_SMALL == 7 + +static const sph_u32 T256_0[128][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xcba90000), SPH_C32(0x90273769), SPH_C32(0xbbdcf407), + SPH_C32(0xd0f4af61), SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), + SPH_C32(0x3321e92c), SPH_C32(0xce122df3) }, + { SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), SPH_C32(0x11fa3a57), + SPH_C32(0x3dc90524), SPH_C32(0x97530000), SPH_C32(0x204f6ed3), + SPH_C32(0x77b9e80f), SPH_C32(0xa1ec5ec1) }, + { SPH_C32(0x22832000), SPH_C32(0x2470bb95), SPH_C32(0xaa26ce50), + SPH_C32(0xed3daa45), SPH_C32(0x286f1000), SPH_C32(0xea431fc4), + SPH_C32(0x44980123), SPH_C32(0x6ffe7332) }, + { SPH_C32(0x97530000), SPH_C32(0x204f6ed3), SPH_C32(0x77b9e80f), + SPH_C32(0xa1ec5ec1), SPH_C32(0x7e792000), SPH_C32(0x9418e22f), + SPH_C32(0x6643d258), SPH_C32(0x9c255be5) }, + { SPH_C32(0x5cfa0000), SPH_C32(0xb06859ba), SPH_C32(0xcc651c08), + SPH_C32(0x7118f1a0), SPH_C32(0xc1453000), SPH_C32(0x5e149338), + SPH_C32(0x55623b74), SPH_C32(0x52377616) }, + { SPH_C32(0x7e792000), SPH_C32(0x9418e22f), SPH_C32(0x6643d258), + SPH_C32(0x9c255be5), SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), + SPH_C32(0x11fa3a57), SPH_C32(0x3dc90524) }, + { SPH_C32(0xb5d02000), SPH_C32(0x043fd546), SPH_C32(0xdd9f265f), + SPH_C32(0x4cd1f484), SPH_C32(0x56163000), SPH_C32(0x7e5bfdeb), + SPH_C32(0x22dbd37b), SPH_C32(0xf3db28d7) }, + { SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), SPH_C32(0x8dfacfab), + SPH_C32(0xce36cc72), SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), + SPH_C32(0x848598ba), SPH_C32(0x1041003e) }, + { SPH_C32(0xd9b24000), SPH_C32(0xcb30ee81), SPH_C32(0x36263bac), + SPH_C32(0x1ec26313), SPH_C32(0x596b1000), SPH_C32(0x81bf4b32), + SPH_C32(0xb7a47196), SPH_C32(0xde532dcd) }, + { SPH_C32(0xfb316000), SPH_C32(0xef405514), SPH_C32(0x9c00f5fc), + SPH_C32(0xf3ffc956), SPH_C32(0x71040000), SPH_C32(0x6bfc54f6), + SPH_C32(0xf33c70b5), SPH_C32(0xb1ad5eff) }, + { SPH_C32(0x30986000), SPH_C32(0x7f67627d), SPH_C32(0x27dc01fb), + SPH_C32(0x230b6637), SPH_C32(0xce381000), SPH_C32(0xa1f025e1), + SPH_C32(0xc01d9999), SPH_C32(0x7fbf730c) }, + { SPH_C32(0x85484000), SPH_C32(0x7b58b73b), SPH_C32(0xfa4327a4), + SPH_C32(0x6fda92b3), SPH_C32(0x982e2000), SPH_C32(0xdfabd80a), + SPH_C32(0xe2c64ae2), SPH_C32(0x8c645bdb) }, + { SPH_C32(0x4ee14000), SPH_C32(0xeb7f8052), SPH_C32(0x419fd3a3), + SPH_C32(0xbf2e3dd2), SPH_C32(0x27123000), SPH_C32(0x15a7a91d), + SPH_C32(0xd1e7a3ce), SPH_C32(0x42767628) }, + { SPH_C32(0x6c626000), SPH_C32(0xcf0f3bc7), SPH_C32(0xebb91df3), + SPH_C32(0x52139797), SPH_C32(0x0f7d2000), SPH_C32(0xffe4b6d9), + SPH_C32(0x957fa2ed), SPH_C32(0x2d88051a) }, + { SPH_C32(0xa7cb6000), SPH_C32(0x5f280cae), SPH_C32(0x5065e9f4), + SPH_C32(0x82e738f6), SPH_C32(0xb0413000), SPH_C32(0x35e8c7ce), + SPH_C32(0xa65e4bc1), SPH_C32(0xe39a28e9) }, + { SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), SPH_C32(0x848598ba), + SPH_C32(0x1041003e), SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), + SPH_C32(0x097f5711), SPH_C32(0xde77cc4c) }, + { SPH_C32(0x2dfe0000), SPH_C32(0xdb940d4c), SPH_C32(0x3f596cbd), + SPH_C32(0xc0b5af5f), SPH_C32(0x4b705000), SPH_C32(0xdaa892da), + SPH_C32(0x3a5ebe3d), SPH_C32(0x1065e1bf) }, + { SPH_C32(0x0f7d2000), SPH_C32(0xffe4b6d9), SPH_C32(0x957fa2ed), + SPH_C32(0x2d88051a), SPH_C32(0x631f4000), SPH_C32(0x30eb8d1e), + SPH_C32(0x7ec6bf1e), SPH_C32(0x7f9b928d) }, + { SPH_C32(0xc4d42000), SPH_C32(0x6fc381b0), SPH_C32(0x2ea356ea), + SPH_C32(0xfd7caa7b), SPH_C32(0xdc235000), SPH_C32(0xfae7fc09), + SPH_C32(0x4de75632), SPH_C32(0xb189bf7e) }, + { SPH_C32(0x71040000), SPH_C32(0x6bfc54f6), SPH_C32(0xf33c70b5), + SPH_C32(0xb1ad5eff), SPH_C32(0x8a356000), SPH_C32(0x84bc01e2), + SPH_C32(0x6f3c8549), SPH_C32(0x425297a9) }, + { SPH_C32(0xbaad0000), SPH_C32(0xfbdb639f), SPH_C32(0x48e084b2), + SPH_C32(0x6159f19e), SPH_C32(0x35097000), SPH_C32(0x4eb070f5), + SPH_C32(0x5c1d6c65), SPH_C32(0x8c40ba5a) }, + { SPH_C32(0x982e2000), SPH_C32(0xdfabd80a), SPH_C32(0xe2c64ae2), + SPH_C32(0x8c645bdb), SPH_C32(0x1d666000), SPH_C32(0xa4f36f31), + SPH_C32(0x18856d46), SPH_C32(0xe3bec968) }, + { SPH_C32(0x53872000), SPH_C32(0x4f8cef63), SPH_C32(0x591abee5), + SPH_C32(0x5c90f4ba), SPH_C32(0xa25a7000), SPH_C32(0x6eff1e26), + SPH_C32(0x2ba4846a), SPH_C32(0x2dace49b) }, + { SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), SPH_C32(0x097f5711), + SPH_C32(0xde77cc4c), SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), + SPH_C32(0x8dfacfab), SPH_C32(0xce36cc72) }, + { SPH_C32(0x3fe54000), SPH_C32(0x8083d4a4), SPH_C32(0xb2a3a316), + SPH_C32(0x0e83632d), SPH_C32(0xad275000), SPH_C32(0x911ba8ff), + SPH_C32(0xbedb2687), SPH_C32(0x0024e181) }, + { SPH_C32(0x1d666000), SPH_C32(0xa4f36f31), SPH_C32(0x18856d46), + SPH_C32(0xe3bec968), SPH_C32(0x85484000), SPH_C32(0x7b58b73b), + SPH_C32(0xfa4327a4), SPH_C32(0x6fda92b3) }, + { SPH_C32(0xd6cf6000), SPH_C32(0x34d45858), SPH_C32(0xa3599941), + SPH_C32(0x334a6609), SPH_C32(0x3a745000), SPH_C32(0xb154c62c), + SPH_C32(0xc962ce88), SPH_C32(0xa1c8bf40) }, + { SPH_C32(0x631f4000), SPH_C32(0x30eb8d1e), SPH_C32(0x7ec6bf1e), + SPH_C32(0x7f9b928d), SPH_C32(0x6c626000), SPH_C32(0xcf0f3bc7), + SPH_C32(0xebb91df3), SPH_C32(0x52139797) }, + { SPH_C32(0xa8b64000), SPH_C32(0xa0ccba77), SPH_C32(0xc51a4b19), + SPH_C32(0xaf6f3dec), SPH_C32(0xd35e7000), SPH_C32(0x05034ad0), + SPH_C32(0xd898f4df), SPH_C32(0x9c01ba64) }, + { SPH_C32(0x8a356000), SPH_C32(0x84bc01e2), SPH_C32(0x6f3c8549), + SPH_C32(0x425297a9), SPH_C32(0xfb316000), SPH_C32(0xef405514), + SPH_C32(0x9c00f5fc), SPH_C32(0xf3ffc956) }, + { SPH_C32(0x419c6000), SPH_C32(0x149b368b), SPH_C32(0xd4e0714e), + SPH_C32(0x92a638c8), SPH_C32(0x440d7000), SPH_C32(0x254c2403), + SPH_C32(0xaf211cd0), SPH_C32(0x3dede4a5) }, + { SPH_C32(0xe4788000), SPH_C32(0x859673c1), SPH_C32(0xb5fb2452), + SPH_C32(0x29cc5edf), SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), + SPH_C32(0x62fc79d0), SPH_C32(0x731ebdc2) }, + { SPH_C32(0x2fd18000), SPH_C32(0x15b144a8), SPH_C32(0x0e27d055), + SPH_C32(0xf938f1be), SPH_C32(0xbb631000), SPH_C32(0x5646e2de), + SPH_C32(0x51dd90fc), SPH_C32(0xbd0c9031) }, + { SPH_C32(0x0d52a000), SPH_C32(0x31c1ff3d), SPH_C32(0xa4011e05), + SPH_C32(0x14055bfb), SPH_C32(0x930c0000), SPH_C32(0xbc05fd1a), + SPH_C32(0x154591df), SPH_C32(0xd2f2e303) }, + { SPH_C32(0xc6fba000), SPH_C32(0xa1e6c854), SPH_C32(0x1fddea02), + SPH_C32(0xc4f1f49a), SPH_C32(0x2c301000), SPH_C32(0x76098c0d), + SPH_C32(0x266478f3), SPH_C32(0x1ce0cef0) }, + { SPH_C32(0x732b8000), SPH_C32(0xa5d91d12), SPH_C32(0xc242cc5d), + SPH_C32(0x8820001e), SPH_C32(0x7a262000), SPH_C32(0x085271e6), + SPH_C32(0x04bfab88), SPH_C32(0xef3be627) }, + { SPH_C32(0xb8828000), SPH_C32(0x35fe2a7b), SPH_C32(0x799e385a), + SPH_C32(0x58d4af7f), SPH_C32(0xc51a3000), SPH_C32(0xc25e00f1), + SPH_C32(0x379e42a4), SPH_C32(0x2129cbd4) }, + { SPH_C32(0x9a01a000), SPH_C32(0x118e91ee), SPH_C32(0xd3b8f60a), + SPH_C32(0xb5e9053a), SPH_C32(0xed752000), SPH_C32(0x281d1f35), + SPH_C32(0x73064387), SPH_C32(0x4ed7b8e6) }, + { SPH_C32(0x51a8a000), SPH_C32(0x81a9a687), SPH_C32(0x6864020d), + SPH_C32(0x651daa5b), SPH_C32(0x52493000), SPH_C32(0xe2116e22), + SPH_C32(0x4027aaab), SPH_C32(0x80c59515) }, + { SPH_C32(0xf663c000), SPH_C32(0xde81aa29), SPH_C32(0x3801ebf9), + SPH_C32(0xe7fa92ad), SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), + SPH_C32(0xe679e16a), SPH_C32(0x635fbdfc) }, + { SPH_C32(0x3dcac000), SPH_C32(0x4ea69d40), SPH_C32(0x83dd1ffe), + SPH_C32(0x370e3dcc), SPH_C32(0x5d341000), SPH_C32(0x1df5d8fb), + SPH_C32(0xd5580846), SPH_C32(0xad4d900f) }, + { SPH_C32(0x1f49e000), SPH_C32(0x6ad626d5), SPH_C32(0x29fbd1ae), + SPH_C32(0xda339789), SPH_C32(0x755b0000), SPH_C32(0xf7b6c73f), + SPH_C32(0x91c00965), SPH_C32(0xc2b3e33d) }, + { SPH_C32(0xd4e0e000), SPH_C32(0xfaf111bc), SPH_C32(0x922725a9), + SPH_C32(0x0ac738e8), SPH_C32(0xca671000), SPH_C32(0x3dbab628), + SPH_C32(0xa2e1e049), SPH_C32(0x0ca1cece) }, + { SPH_C32(0x6130c000), SPH_C32(0xfecec4fa), SPH_C32(0x4fb803f6), + SPH_C32(0x4616cc6c), SPH_C32(0x9c712000), SPH_C32(0x43e14bc3), + SPH_C32(0x803a3332), SPH_C32(0xff7ae619) }, + { SPH_C32(0xaa99c000), SPH_C32(0x6ee9f393), SPH_C32(0xf464f7f1), + SPH_C32(0x96e2630d), SPH_C32(0x234d3000), SPH_C32(0x89ed3ad4), + SPH_C32(0xb31bda1e), SPH_C32(0x3168cbea) }, + { SPH_C32(0x881ae000), SPH_C32(0x4a994806), SPH_C32(0x5e4239a1), + SPH_C32(0x7bdfc948), SPH_C32(0x0b222000), SPH_C32(0x63ae2510), + SPH_C32(0xf783db3d), SPH_C32(0x5e96b8d8) }, + { SPH_C32(0x43b3e000), SPH_C32(0xdabe7f6f), SPH_C32(0xe59ecda6), + SPH_C32(0xab2b6629), SPH_C32(0xb41e3000), SPH_C32(0xa9a25407), + SPH_C32(0xc4a23211), SPH_C32(0x9084952b) }, + { SPH_C32(0x022f8000), SPH_C32(0xce2549e4), SPH_C32(0x317ebce8), + SPH_C32(0x398d5ee1), SPH_C32(0xf0134000), SPH_C32(0x8cee7004), + SPH_C32(0x6b832ec1), SPH_C32(0xad69718e) }, + { SPH_C32(0xc9868000), SPH_C32(0x5e027e8d), SPH_C32(0x8aa248ef), + SPH_C32(0xe979f180), SPH_C32(0x4f2f5000), SPH_C32(0x46e20113), + SPH_C32(0x58a2c7ed), SPH_C32(0x637b5c7d) }, + { SPH_C32(0xeb05a000), SPH_C32(0x7a72c518), SPH_C32(0x208486bf), + SPH_C32(0x04445bc5), SPH_C32(0x67404000), SPH_C32(0xaca11ed7), + SPH_C32(0x1c3ac6ce), SPH_C32(0x0c852f4f) }, + { SPH_C32(0x20aca000), SPH_C32(0xea55f271), SPH_C32(0x9b5872b8), + SPH_C32(0xd4b0f4a4), SPH_C32(0xd87c5000), SPH_C32(0x66ad6fc0), + SPH_C32(0x2f1b2fe2), SPH_C32(0xc29702bc) }, + { SPH_C32(0x957c8000), SPH_C32(0xee6a2737), SPH_C32(0x46c754e7), + SPH_C32(0x98610020), SPH_C32(0x8e6a6000), SPH_C32(0x18f6922b), + SPH_C32(0x0dc0fc99), SPH_C32(0x314c2a6b) }, + { SPH_C32(0x5ed58000), SPH_C32(0x7e4d105e), SPH_C32(0xfd1ba0e0), + SPH_C32(0x4895af41), SPH_C32(0x31567000), SPH_C32(0xd2fae33c), + SPH_C32(0x3ee115b5), SPH_C32(0xff5e0798) }, + { SPH_C32(0x7c56a000), SPH_C32(0x5a3dabcb), SPH_C32(0x573d6eb0), + SPH_C32(0xa5a80504), SPH_C32(0x19396000), SPH_C32(0x38b9fcf8), + SPH_C32(0x7a791496), SPH_C32(0x90a074aa) }, + { SPH_C32(0xb7ffa000), SPH_C32(0xca1a9ca2), SPH_C32(0xece19ab7), + SPH_C32(0x755caa65), SPH_C32(0xa6057000), SPH_C32(0xf2b58def), + SPH_C32(0x4958fdba), SPH_C32(0x5eb25959) }, + { SPH_C32(0x1034c000), SPH_C32(0x9532900c), SPH_C32(0xbc847343), + SPH_C32(0xf7bb9293), SPH_C32(0x16444000), SPH_C32(0xc75d4a21), + SPH_C32(0xef06b67b), SPH_C32(0xbd2871b0) }, + { SPH_C32(0xdb9dc000), SPH_C32(0x0515a765), SPH_C32(0x07588744), + SPH_C32(0x274f3df2), SPH_C32(0xa9785000), SPH_C32(0x0d513b36), + SPH_C32(0xdc275f57), SPH_C32(0x733a5c43) }, + { SPH_C32(0xf91ee000), SPH_C32(0x21651cf0), SPH_C32(0xad7e4914), + SPH_C32(0xca7297b7), SPH_C32(0x81174000), SPH_C32(0xe71224f2), + SPH_C32(0x98bf5e74), SPH_C32(0x1cc42f71) }, + { SPH_C32(0x32b7e000), SPH_C32(0xb1422b99), SPH_C32(0x16a2bd13), + SPH_C32(0x1a8638d6), SPH_C32(0x3e2b5000), SPH_C32(0x2d1e55e5), + SPH_C32(0xab9eb758), SPH_C32(0xd2d60282) }, + { SPH_C32(0x8767c000), SPH_C32(0xb57dfedf), SPH_C32(0xcb3d9b4c), + SPH_C32(0x5657cc52), SPH_C32(0x683d6000), SPH_C32(0x5345a80e), + SPH_C32(0x89456423), SPH_C32(0x210d2a55) }, + { SPH_C32(0x4ccec000), SPH_C32(0x255ac9b6), SPH_C32(0x70e16f4b), + SPH_C32(0x86a36333), SPH_C32(0xd7017000), SPH_C32(0x9949d919), + SPH_C32(0xba648d0f), SPH_C32(0xef1f07a6) }, + { SPH_C32(0x6e4de000), SPH_C32(0x012a7223), SPH_C32(0xdac7a11b), + SPH_C32(0x6b9ec976), SPH_C32(0xff6e6000), SPH_C32(0x730ac6dd), + SPH_C32(0xfefc8c2c), SPH_C32(0x80e17494) }, + { SPH_C32(0xa5e4e000), SPH_C32(0x910d454a), SPH_C32(0x611b551c), + SPH_C32(0xbb6a6617), SPH_C32(0x40527000), SPH_C32(0xb906b7ca), + SPH_C32(0xcddd6500), SPH_C32(0x4ef35967) }, + { SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), SPH_C32(0x62fc79d0), + SPH_C32(0x731ebdc2), SPH_C32(0xe0278000), SPH_C32(0x19dce008), + SPH_C32(0xd7075d82), SPH_C32(0x5ad2e31d) }, + { SPH_C32(0xcff60000), SPH_C32(0x0c6da4a0), SPH_C32(0xd9208dd7), + SPH_C32(0xa3ea12a3), SPH_C32(0x5f1b9000), SPH_C32(0xd3d0911f), + SPH_C32(0xe426b4ae), SPH_C32(0x94c0ceee) }, + { SPH_C32(0xed752000), SPH_C32(0x281d1f35), SPH_C32(0x73064387), + SPH_C32(0x4ed7b8e6), SPH_C32(0x77748000), SPH_C32(0x39938edb), + SPH_C32(0xa0beb58d), SPH_C32(0xfb3ebddc) }, + { SPH_C32(0x26dc2000), SPH_C32(0xb83a285c), SPH_C32(0xc8dab780), + SPH_C32(0x9e231787), SPH_C32(0xc8489000), SPH_C32(0xf39fffcc), + SPH_C32(0x939f5ca1), SPH_C32(0x352c902f) }, + { SPH_C32(0x930c0000), SPH_C32(0xbc05fd1a), SPH_C32(0x154591df), + SPH_C32(0xd2f2e303), SPH_C32(0x9e5ea000), SPH_C32(0x8dc40227), + SPH_C32(0xb1448fda), SPH_C32(0xc6f7b8f8) }, + { SPH_C32(0x58a50000), SPH_C32(0x2c22ca73), SPH_C32(0xae9965d8), + SPH_C32(0x02064c62), SPH_C32(0x2162b000), SPH_C32(0x47c87330), + SPH_C32(0x826566f6), SPH_C32(0x08e5950b) }, + { SPH_C32(0x7a262000), SPH_C32(0x085271e6), SPH_C32(0x04bfab88), + SPH_C32(0xef3be627), SPH_C32(0x090da000), SPH_C32(0xad8b6cf4), + SPH_C32(0xc6fd67d5), SPH_C32(0x671be639) }, + { SPH_C32(0xb18f2000), SPH_C32(0x9875468f), SPH_C32(0xbf635f8f), + SPH_C32(0x3fcf4946), SPH_C32(0xb631b000), SPH_C32(0x67871de3), + SPH_C32(0xf5dc8ef9), SPH_C32(0xa909cbca) }, + { SPH_C32(0x16444000), SPH_C32(0xc75d4a21), SPH_C32(0xef06b67b), + SPH_C32(0xbd2871b0), SPH_C32(0x06708000), SPH_C32(0x526fda2d), + SPH_C32(0x5382c538), SPH_C32(0x4a93e323) }, + { SPH_C32(0xdded4000), SPH_C32(0x577a7d48), SPH_C32(0x54da427c), + SPH_C32(0x6ddcded1), SPH_C32(0xb94c9000), SPH_C32(0x9863ab3a), + SPH_C32(0x60a32c14), SPH_C32(0x8481ced0) }, + { SPH_C32(0xff6e6000), SPH_C32(0x730ac6dd), SPH_C32(0xfefc8c2c), + SPH_C32(0x80e17494), SPH_C32(0x91238000), SPH_C32(0x7220b4fe), + SPH_C32(0x243b2d37), SPH_C32(0xeb7fbde2) }, + { SPH_C32(0x34c76000), SPH_C32(0xe32df1b4), SPH_C32(0x4520782b), + SPH_C32(0x5015dbf5), SPH_C32(0x2e1f9000), SPH_C32(0xb82cc5e9), + SPH_C32(0x171ac41b), SPH_C32(0x256d9011) }, + { SPH_C32(0x81174000), SPH_C32(0xe71224f2), SPH_C32(0x98bf5e74), + SPH_C32(0x1cc42f71), SPH_C32(0x7809a000), SPH_C32(0xc6773802), + SPH_C32(0x35c11760), SPH_C32(0xd6b6b8c6) }, + { SPH_C32(0x4abe4000), SPH_C32(0x7735139b), SPH_C32(0x2363aa73), + SPH_C32(0xcc308010), SPH_C32(0xc735b000), SPH_C32(0x0c7b4915), + SPH_C32(0x06e0fe4c), SPH_C32(0x18a49535) }, + { SPH_C32(0x683d6000), SPH_C32(0x5345a80e), SPH_C32(0x89456423), + SPH_C32(0x210d2a55), SPH_C32(0xef5aa000), SPH_C32(0xe63856d1), + SPH_C32(0x4278ff6f), SPH_C32(0x775ae607) }, + { SPH_C32(0xa3946000), SPH_C32(0xc3629f67), SPH_C32(0x32999024), + SPH_C32(0xf1f98534), SPH_C32(0x5066b000), SPH_C32(0x2c3427c6), + SPH_C32(0x71591643), SPH_C32(0xb948cbf4) }, + { SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), SPH_C32(0xe679e16a), + SPH_C32(0x635fbdfc), SPH_C32(0x146bc000), SPH_C32(0x097803c5), + SPH_C32(0xde780a93), SPH_C32(0x84a52f51) }, + { SPH_C32(0x29a10000), SPH_C32(0x47de9e85), SPH_C32(0x5da5156d), + SPH_C32(0xb3ab129d), SPH_C32(0xab57d000), SPH_C32(0xc37472d2), + SPH_C32(0xed59e3bf), SPH_C32(0x4ab702a2) }, + { SPH_C32(0x0b222000), SPH_C32(0x63ae2510), SPH_C32(0xf783db3d), + SPH_C32(0x5e96b8d8), SPH_C32(0x8338c000), SPH_C32(0x29376d16), + SPH_C32(0xa9c1e29c), SPH_C32(0x25497190) }, + { SPH_C32(0xc08b2000), SPH_C32(0xf3891279), SPH_C32(0x4c5f2f3a), + SPH_C32(0x8e6217b9), SPH_C32(0x3c04d000), SPH_C32(0xe33b1c01), + SPH_C32(0x9ae00bb0), SPH_C32(0xeb5b5c63) }, + { SPH_C32(0x755b0000), SPH_C32(0xf7b6c73f), SPH_C32(0x91c00965), + SPH_C32(0xc2b3e33d), SPH_C32(0x6a12e000), SPH_C32(0x9d60e1ea), + SPH_C32(0xb83bd8cb), SPH_C32(0x188074b4) }, + { SPH_C32(0xbef20000), SPH_C32(0x6791f056), SPH_C32(0x2a1cfd62), + SPH_C32(0x12474c5c), SPH_C32(0xd52ef000), SPH_C32(0x576c90fd), + SPH_C32(0x8b1a31e7), SPH_C32(0xd6925947) }, + { SPH_C32(0x9c712000), SPH_C32(0x43e14bc3), SPH_C32(0x803a3332), + SPH_C32(0xff7ae619), SPH_C32(0xfd41e000), SPH_C32(0xbd2f8f39), + SPH_C32(0xcf8230c4), SPH_C32(0xb96c2a75) }, + { SPH_C32(0x57d82000), SPH_C32(0xd3c67caa), SPH_C32(0x3be6c735), + SPH_C32(0x2f8e4978), SPH_C32(0x427df000), SPH_C32(0x7723fe2e), + SPH_C32(0xfca3d9e8), SPH_C32(0x777e0786) }, + { SPH_C32(0xf0134000), SPH_C32(0x8cee7004), SPH_C32(0x6b832ec1), + SPH_C32(0xad69718e), SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), + SPH_C32(0x5afd9229), SPH_C32(0x94e42f6f) }, + { SPH_C32(0x3bba4000), SPH_C32(0x1cc9476d), SPH_C32(0xd05fdac6), + SPH_C32(0x7d9ddeef), SPH_C32(0x4d00d000), SPH_C32(0x88c748f7), + SPH_C32(0x69dc7b05), SPH_C32(0x5af6029c) }, + { SPH_C32(0x19396000), SPH_C32(0x38b9fcf8), SPH_C32(0x7a791496), + SPH_C32(0x90a074aa), SPH_C32(0x656fc000), SPH_C32(0x62845733), + SPH_C32(0x2d447a26), SPH_C32(0x350871ae) }, + { SPH_C32(0xd2906000), SPH_C32(0xa89ecb91), SPH_C32(0xc1a5e091), + SPH_C32(0x4054dbcb), SPH_C32(0xda53d000), SPH_C32(0xa8882624), + SPH_C32(0x1e65930a), SPH_C32(0xfb1a5c5d) }, + { SPH_C32(0x67404000), SPH_C32(0xaca11ed7), SPH_C32(0x1c3ac6ce), + SPH_C32(0x0c852f4f), SPH_C32(0x8c45e000), SPH_C32(0xd6d3dbcf), + SPH_C32(0x3cbe4071), SPH_C32(0x08c1748a) }, + { SPH_C32(0xace94000), SPH_C32(0x3c8629be), SPH_C32(0xa7e632c9), + SPH_C32(0xdc71802e), SPH_C32(0x3379f000), SPH_C32(0x1cdfaad8), + SPH_C32(0x0f9fa95d), SPH_C32(0xc6d35979) }, + { SPH_C32(0x8e6a6000), SPH_C32(0x18f6922b), SPH_C32(0x0dc0fc99), + SPH_C32(0x314c2a6b), SPH_C32(0x1b16e000), SPH_C32(0xf69cb51c), + SPH_C32(0x4b07a87e), SPH_C32(0xa92d2a4b) }, + { SPH_C32(0x45c36000), SPH_C32(0x88d1a542), SPH_C32(0xb61c089e), + SPH_C32(0xe1b8850a), SPH_C32(0xa42af000), SPH_C32(0x3c90c40b), + SPH_C32(0x78264152), SPH_C32(0x673f07b8) }, + { SPH_C32(0xe0278000), SPH_C32(0x19dce008), SPH_C32(0xd7075d82), + SPH_C32(0x5ad2e31d), SPH_C32(0xe4788000), SPH_C32(0x859673c1), + SPH_C32(0xb5fb2452), SPH_C32(0x29cc5edf) }, + { SPH_C32(0x2b8e8000), SPH_C32(0x89fbd761), SPH_C32(0x6cdba985), + SPH_C32(0x8a264c7c), SPH_C32(0x5b449000), SPH_C32(0x4f9a02d6), + SPH_C32(0x86dacd7e), SPH_C32(0xe7de732c) }, + { SPH_C32(0x090da000), SPH_C32(0xad8b6cf4), SPH_C32(0xc6fd67d5), + SPH_C32(0x671be639), SPH_C32(0x732b8000), SPH_C32(0xa5d91d12), + SPH_C32(0xc242cc5d), SPH_C32(0x8820001e) }, + { SPH_C32(0xc2a4a000), SPH_C32(0x3dac5b9d), SPH_C32(0x7d2193d2), + SPH_C32(0xb7ef4958), SPH_C32(0xcc179000), SPH_C32(0x6fd56c05), + SPH_C32(0xf1632571), SPH_C32(0x46322ded) }, + { SPH_C32(0x77748000), SPH_C32(0x39938edb), SPH_C32(0xa0beb58d), + SPH_C32(0xfb3ebddc), SPH_C32(0x9a01a000), SPH_C32(0x118e91ee), + SPH_C32(0xd3b8f60a), SPH_C32(0xb5e9053a) }, + { SPH_C32(0xbcdd8000), SPH_C32(0xa9b4b9b2), SPH_C32(0x1b62418a), + SPH_C32(0x2bca12bd), SPH_C32(0x253db000), SPH_C32(0xdb82e0f9), + SPH_C32(0xe0991f26), SPH_C32(0x7bfb28c9) }, + { SPH_C32(0x9e5ea000), SPH_C32(0x8dc40227), SPH_C32(0xb1448fda), + SPH_C32(0xc6f7b8f8), SPH_C32(0x0d52a000), SPH_C32(0x31c1ff3d), + SPH_C32(0xa4011e05), SPH_C32(0x14055bfb) }, + { SPH_C32(0x55f7a000), SPH_C32(0x1de3354e), SPH_C32(0x0a987bdd), + SPH_C32(0x16031799), SPH_C32(0xb26eb000), SPH_C32(0xfbcd8e2a), + SPH_C32(0x9720f729), SPH_C32(0xda177608) }, + { SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), SPH_C32(0x5afd9229), + SPH_C32(0x94e42f6f), SPH_C32(0x022f8000), SPH_C32(0xce2549e4), + SPH_C32(0x317ebce8), SPH_C32(0x398d5ee1) }, + { SPH_C32(0x3995c000), SPH_C32(0xd2ec0e89), SPH_C32(0xe121662e), + SPH_C32(0x4410800e), SPH_C32(0xbd139000), SPH_C32(0x042938f3), + SPH_C32(0x025f55c4), SPH_C32(0xf79f7312) }, + { SPH_C32(0x1b16e000), SPH_C32(0xf69cb51c), SPH_C32(0x4b07a87e), + SPH_C32(0xa92d2a4b), SPH_C32(0x957c8000), SPH_C32(0xee6a2737), + SPH_C32(0x46c754e7), SPH_C32(0x98610020) }, + { SPH_C32(0xd0bfe000), SPH_C32(0x66bb8275), SPH_C32(0xf0db5c79), + SPH_C32(0x79d9852a), SPH_C32(0x2a409000), SPH_C32(0x24665620), + SPH_C32(0x75e6bdcb), SPH_C32(0x56732dd3) }, + { SPH_C32(0x656fc000), SPH_C32(0x62845733), SPH_C32(0x2d447a26), + SPH_C32(0x350871ae), SPH_C32(0x7c56a000), SPH_C32(0x5a3dabcb), + SPH_C32(0x573d6eb0), SPH_C32(0xa5a80504) }, + { SPH_C32(0xaec6c000), SPH_C32(0xf2a3605a), SPH_C32(0x96988e21), + SPH_C32(0xe5fcdecf), SPH_C32(0xc36ab000), SPH_C32(0x9031dadc), + SPH_C32(0x641c879c), SPH_C32(0x6bba28f7) }, + { SPH_C32(0x8c45e000), SPH_C32(0xd6d3dbcf), SPH_C32(0x3cbe4071), + SPH_C32(0x08c1748a), SPH_C32(0xeb05a000), SPH_C32(0x7a72c518), + SPH_C32(0x208486bf), SPH_C32(0x04445bc5) }, + { SPH_C32(0x47ece000), SPH_C32(0x46f4eca6), SPH_C32(0x8762b476), + SPH_C32(0xd835dbeb), SPH_C32(0x5439b000), SPH_C32(0xb07eb40f), + SPH_C32(0x13a56f93), SPH_C32(0xca567636) }, + { SPH_C32(0x06708000), SPH_C32(0x526fda2d), SPH_C32(0x5382c538), + SPH_C32(0x4a93e323), SPH_C32(0x1034c000), SPH_C32(0x9532900c), + SPH_C32(0xbc847343), SPH_C32(0xf7bb9293) }, + { SPH_C32(0xcdd98000), SPH_C32(0xc248ed44), SPH_C32(0xe85e313f), + SPH_C32(0x9a674c42), SPH_C32(0xaf08d000), SPH_C32(0x5f3ee11b), + SPH_C32(0x8fa59a6f), SPH_C32(0x39a9bf60) }, + { SPH_C32(0xef5aa000), SPH_C32(0xe63856d1), SPH_C32(0x4278ff6f), + SPH_C32(0x775ae607), SPH_C32(0x8767c000), SPH_C32(0xb57dfedf), + SPH_C32(0xcb3d9b4c), SPH_C32(0x5657cc52) }, + { SPH_C32(0x24f3a000), SPH_C32(0x761f61b8), SPH_C32(0xf9a40b68), + SPH_C32(0xa7ae4966), SPH_C32(0x385bd000), SPH_C32(0x7f718fc8), + SPH_C32(0xf81c7260), SPH_C32(0x9845e1a1) }, + { SPH_C32(0x91238000), SPH_C32(0x7220b4fe), SPH_C32(0x243b2d37), + SPH_C32(0xeb7fbde2), SPH_C32(0x6e4de000), SPH_C32(0x012a7223), + SPH_C32(0xdac7a11b), SPH_C32(0x6b9ec976) }, + { SPH_C32(0x5a8a8000), SPH_C32(0xe2078397), SPH_C32(0x9fe7d930), + SPH_C32(0x3b8b1283), SPH_C32(0xd171f000), SPH_C32(0xcb260334), + SPH_C32(0xe9e64837), SPH_C32(0xa58ce485) }, + { SPH_C32(0x7809a000), SPH_C32(0xc6773802), SPH_C32(0x35c11760), + SPH_C32(0xd6b6b8c6), SPH_C32(0xf91ee000), SPH_C32(0x21651cf0), + SPH_C32(0xad7e4914), SPH_C32(0xca7297b7) }, + { SPH_C32(0xb3a0a000), SPH_C32(0x56500f6b), SPH_C32(0x8e1de367), + SPH_C32(0x064217a7), SPH_C32(0x4622f000), SPH_C32(0xeb696de7), + SPH_C32(0x9e5fa038), SPH_C32(0x0460ba44) }, + { SPH_C32(0x146bc000), SPH_C32(0x097803c5), SPH_C32(0xde780a93), + SPH_C32(0x84a52f51), SPH_C32(0xf663c000), SPH_C32(0xde81aa29), + SPH_C32(0x3801ebf9), SPH_C32(0xe7fa92ad) }, + { SPH_C32(0xdfc2c000), SPH_C32(0x995f34ac), SPH_C32(0x65a4fe94), + SPH_C32(0x54518030), SPH_C32(0x495fd000), SPH_C32(0x148ddb3e), + SPH_C32(0x0b2002d5), SPH_C32(0x29e8bf5e) }, + { SPH_C32(0xfd41e000), SPH_C32(0xbd2f8f39), SPH_C32(0xcf8230c4), + SPH_C32(0xb96c2a75), SPH_C32(0x6130c000), SPH_C32(0xfecec4fa), + SPH_C32(0x4fb803f6), SPH_C32(0x4616cc6c) }, + { SPH_C32(0x36e8e000), SPH_C32(0x2d08b850), SPH_C32(0x745ec4c3), + SPH_C32(0x69988514), SPH_C32(0xde0cd000), SPH_C32(0x34c2b5ed), + SPH_C32(0x7c99eada), SPH_C32(0x8804e19f) }, + { SPH_C32(0x8338c000), SPH_C32(0x29376d16), SPH_C32(0xa9c1e29c), + SPH_C32(0x25497190), SPH_C32(0x881ae000), SPH_C32(0x4a994806), + SPH_C32(0x5e4239a1), SPH_C32(0x7bdfc948) }, + { SPH_C32(0x4891c000), SPH_C32(0xb9105a7f), SPH_C32(0x121d169b), + SPH_C32(0xf5bddef1), SPH_C32(0x3726f000), SPH_C32(0x80953911), + SPH_C32(0x6d63d08d), SPH_C32(0xb5cde4bb) }, + { SPH_C32(0x6a12e000), SPH_C32(0x9d60e1ea), SPH_C32(0xb83bd8cb), + SPH_C32(0x188074b4), SPH_C32(0x1f49e000), SPH_C32(0x6ad626d5), + SPH_C32(0x29fbd1ae), SPH_C32(0xda339789) }, + { SPH_C32(0xa1bbe000), SPH_C32(0x0d47d683), SPH_C32(0x03e72ccc), + SPH_C32(0xc874dbd5), SPH_C32(0xa075f000), SPH_C32(0xa0da57c2), + SPH_C32(0x1ada3882), SPH_C32(0x1421ba7a) } +}; + +static const sph_u32 T256_7[128][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xa7b80200), SPH_C32(0x1f128433), SPH_C32(0x60e5f9f2), + SPH_C32(0x9e147576), SPH_C32(0xee260000), SPH_C32(0x124b683e), + SPH_C32(0x80c2d68f), SPH_C32(0x3bf3ab2c) }, + { SPH_C32(0xee260000), SPH_C32(0x124b683e), SPH_C32(0x80c2d68f), + SPH_C32(0x3bf3ab2c), SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), + SPH_C32(0xe0272f7d), SPH_C32(0xa5e7de5a) }, + { SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), SPH_C32(0xe0272f7d), + SPH_C32(0xa5e7de5a), SPH_C32(0xa7b80200), SPH_C32(0x1f128433), + SPH_C32(0x60e5f9f2), SPH_C32(0x9e147576) }, + { SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), SPH_C32(0x6fc548e1), + SPH_C32(0x898d2cd6), SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), + SPH_C32(0x6a72e5bb), SPH_C32(0x247febe6) }, + { SPH_C32(0x28860600), SPH_C32(0x128f4c44), SPH_C32(0x0f20b113), + SPH_C32(0x179959a0), SPH_C32(0xfa9b0000), SPH_C32(0x3df15fc1), + SPH_C32(0xeab03334), SPH_C32(0x1f8c40ca) }, + { SPH_C32(0x61180400), SPH_C32(0x1fd6a049), SPH_C32(0xef079e6e), + SPH_C32(0xb27e87fa), SPH_C32(0x5d230200), SPH_C32(0x22e3dbf2), + SPH_C32(0x8a55cac6), SPH_C32(0x819835bc) }, + { SPH_C32(0xc6a00600), SPH_C32(0x00c4247a), SPH_C32(0x8fe2679c), + SPH_C32(0x2c6af28c), SPH_C32(0xb3050200), SPH_C32(0x30a8b3cc), + SPH_C32(0x0a971c49), SPH_C32(0xba6b9e90) }, + { SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), SPH_C32(0x6a72e5bb), + SPH_C32(0x247febe6), SPH_C32(0x9b830400), SPH_C32(0x2227ff88), + SPH_C32(0x05b7ad5a), SPH_C32(0xadf2c730) }, + { SPH_C32(0xb3050200), SPH_C32(0x30a8b3cc), SPH_C32(0x0a971c49), + SPH_C32(0xba6b9e90), SPH_C32(0x75a50400), SPH_C32(0x306c97b6), + SPH_C32(0x85757bd5), SPH_C32(0x96016c1c) }, + { SPH_C32(0xfa9b0000), SPH_C32(0x3df15fc1), SPH_C32(0xeab03334), + SPH_C32(0x1f8c40ca), SPH_C32(0xd21d0600), SPH_C32(0x2f7e1385), + SPH_C32(0xe5908227), SPH_C32(0x0815196a) }, + { SPH_C32(0x5d230200), SPH_C32(0x22e3dbf2), SPH_C32(0x8a55cac6), + SPH_C32(0x819835bc), SPH_C32(0x3c3b0600), SPH_C32(0x3d357bbb), + SPH_C32(0x655254a8), SPH_C32(0x33e6b246) }, + { SPH_C32(0x9b830400), SPH_C32(0x2227ff88), SPH_C32(0x05b7ad5a), + SPH_C32(0xadf2c730), SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), + SPH_C32(0x6fc548e1), SPH_C32(0x898d2cd6) }, + { SPH_C32(0x3c3b0600), SPH_C32(0x3d357bbb), SPH_C32(0x655254a8), + SPH_C32(0x33e6b246), SPH_C32(0x61180400), SPH_C32(0x1fd6a049), + SPH_C32(0xef079e6e), SPH_C32(0xb27e87fa) }, + { SPH_C32(0x75a50400), SPH_C32(0x306c97b6), SPH_C32(0x85757bd5), + SPH_C32(0x96016c1c), SPH_C32(0xc6a00600), SPH_C32(0x00c4247a), + SPH_C32(0x8fe2679c), SPH_C32(0x2c6af28c) }, + { SPH_C32(0xd21d0600), SPH_C32(0x2f7e1385), SPH_C32(0xe5908227), + SPH_C32(0x0815196a), SPH_C32(0x28860600), SPH_C32(0x128f4c44), + SPH_C32(0x0f20b113), SPH_C32(0x179959a0) }, + { SPH_C32(0xde320800), SPH_C32(0x288350fe), SPH_C32(0x71852ac7), + SPH_C32(0xa6bf9f96), SPH_C32(0xe18b0000), SPH_C32(0x5459887d), + SPH_C32(0xbf1283d3), SPH_C32(0x1b666a73) }, + { SPH_C32(0x798a0a00), SPH_C32(0x3791d4cd), SPH_C32(0x1160d335), + SPH_C32(0x38abeae0), SPH_C32(0x0fad0000), SPH_C32(0x4612e043), + SPH_C32(0x3fd0555c), SPH_C32(0x2095c15f) }, + { SPH_C32(0x30140800), SPH_C32(0x3ac838c0), SPH_C32(0xf147fc48), + SPH_C32(0x9d4c34ba), SPH_C32(0xa8150200), SPH_C32(0x59006470), + SPH_C32(0x5f35acae), SPH_C32(0xbe81b429) }, + { SPH_C32(0x97ac0a00), SPH_C32(0x25dabcf3), SPH_C32(0x91a205ba), + SPH_C32(0x035841cc), SPH_C32(0x46330200), SPH_C32(0x4b4b0c4e), + SPH_C32(0xdff77a21), SPH_C32(0x85721f05) }, + { SPH_C32(0x510c0c00), SPH_C32(0x251e9889), SPH_C32(0x1e406226), + SPH_C32(0x2f32b340), SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), + SPH_C32(0xd5606668), SPH_C32(0x3f198195) }, + { SPH_C32(0xf6b40e00), SPH_C32(0x3a0c1cba), SPH_C32(0x7ea59bd4), + SPH_C32(0xb126c636), SPH_C32(0x1b100000), SPH_C32(0x69a8d7bc), + SPH_C32(0x55a2b0e7), SPH_C32(0x04ea2ab9) }, + { SPH_C32(0xbf2a0c00), SPH_C32(0x3755f0b7), SPH_C32(0x9e82b4a9), + SPH_C32(0x14c1186c), SPH_C32(0xbca80200), SPH_C32(0x76ba538f), + SPH_C32(0x35474915), SPH_C32(0x9afe5fcf) }, + { SPH_C32(0x18920e00), SPH_C32(0x28477484), SPH_C32(0xfe674d5b), + SPH_C32(0x8ad56d1a), SPH_C32(0x528e0200), SPH_C32(0x64f13bb1), + SPH_C32(0xb5859f9a), SPH_C32(0xa10df4e3) }, + { SPH_C32(0xca8f0800), SPH_C32(0x07396701), SPH_C32(0x1bf7cf7c), + SPH_C32(0x82c07470), SPH_C32(0x7a080400), SPH_C32(0x767e77f5), + SPH_C32(0xbaa52e89), SPH_C32(0xb694ad43) }, + { SPH_C32(0x6d370a00), SPH_C32(0x182be332), SPH_C32(0x7b12368e), + SPH_C32(0x1cd40106), SPH_C32(0x942e0400), SPH_C32(0x64351fcb), + SPH_C32(0x3a67f806), SPH_C32(0x8d67066f) }, + { SPH_C32(0x24a90800), SPH_C32(0x15720f3f), SPH_C32(0x9b3519f3), + SPH_C32(0xb933df5c), SPH_C32(0x33960600), SPH_C32(0x7b279bf8), + SPH_C32(0x5a8201f4), SPH_C32(0x13737319) }, + { SPH_C32(0x83110a00), SPH_C32(0x0a608b0c), SPH_C32(0xfbd0e001), + SPH_C32(0x2727aa2a), SPH_C32(0xddb00600), SPH_C32(0x696cf3c6), + SPH_C32(0xda40d77b), SPH_C32(0x2880d835) }, + { SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), SPH_C32(0x7432879d), + SPH_C32(0x0b4d58a6), SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), + SPH_C32(0xd0d7cb32), SPH_C32(0x92eb46a5) }, + { SPH_C32(0xe2090e00), SPH_C32(0x15b62b45), SPH_C32(0x14d77e6f), + SPH_C32(0x95592dd0), SPH_C32(0x80930400), SPH_C32(0x4b8f2834), + SPH_C32(0x50151dbd), SPH_C32(0xa918ed89) }, + { SPH_C32(0xab970c00), SPH_C32(0x18efc748), SPH_C32(0xf4f05112), + SPH_C32(0x30bef38a), SPH_C32(0x272b0600), SPH_C32(0x549dac07), + SPH_C32(0x30f0e44f), SPH_C32(0x370c98ff) }, + { SPH_C32(0x0c2f0e00), SPH_C32(0x07fd437b), SPH_C32(0x9415a8e0), + SPH_C32(0xaeaa86fc), SPH_C32(0xc90d0600), SPH_C32(0x46d6c439), + SPH_C32(0xb03232c0), SPH_C32(0x0cff33d3) }, + { SPH_C32(0xe18b0000), SPH_C32(0x5459887d), SPH_C32(0xbf1283d3), + SPH_C32(0x1b666a73), SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), + SPH_C32(0xce97a914), SPH_C32(0xbdd9f5e5) }, + { SPH_C32(0x46330200), SPH_C32(0x4b4b0c4e), SPH_C32(0xdff77a21), + SPH_C32(0x85721f05), SPH_C32(0xd19f0800), SPH_C32(0x6e91b0bd), + SPH_C32(0x4e557f9b), SPH_C32(0x862a5ec9) }, + { SPH_C32(0x0fad0000), SPH_C32(0x4612e043), SPH_C32(0x3fd0555c), + SPH_C32(0x2095c15f), SPH_C32(0x76270a00), SPH_C32(0x7183348e), + SPH_C32(0x2eb08669), SPH_C32(0x183e2bbf) }, + { SPH_C32(0xa8150200), SPH_C32(0x59006470), SPH_C32(0x5f35acae), + SPH_C32(0xbe81b429), SPH_C32(0x98010a00), SPH_C32(0x63c85cb0), + SPH_C32(0xae7250e6), SPH_C32(0x23cd8093) }, + { SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), SPH_C32(0xd0d7cb32), + SPH_C32(0x92eb46a5), SPH_C32(0x2b040800), SPH_C32(0x5360ef7c), + SPH_C32(0xa4e54caf), SPH_C32(0x99a61e03) }, + { SPH_C32(0xc90d0600), SPH_C32(0x46d6c439), SPH_C32(0xb03232c0), + SPH_C32(0x0cff33d3), SPH_C32(0xc5220800), SPH_C32(0x412b8742), + SPH_C32(0x24279a20), SPH_C32(0xa255b52f) }, + { SPH_C32(0x80930400), SPH_C32(0x4b8f2834), SPH_C32(0x50151dbd), + SPH_C32(0xa918ed89), SPH_C32(0x629a0a00), SPH_C32(0x5e390371), + SPH_C32(0x44c263d2), SPH_C32(0x3c41c059) }, + { SPH_C32(0x272b0600), SPH_C32(0x549dac07), SPH_C32(0x30f0e44f), + SPH_C32(0x370c98ff), SPH_C32(0x8cbc0a00), SPH_C32(0x4c726b4f), + SPH_C32(0xc400b55d), SPH_C32(0x07b26b75) }, + { SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), SPH_C32(0xd5606668), + SPH_C32(0x3f198195), SPH_C32(0xa43a0c00), SPH_C32(0x5efd270b), + SPH_C32(0xcb20044e), SPH_C32(0x102b32d5) }, + { SPH_C32(0x528e0200), SPH_C32(0x64f13bb1), SPH_C32(0xb5859f9a), + SPH_C32(0xa10df4e3), SPH_C32(0x4a1c0c00), SPH_C32(0x4cb64f35), + SPH_C32(0x4be2d2c1), SPH_C32(0x2bd899f9) }, + { SPH_C32(0x1b100000), SPH_C32(0x69a8d7bc), SPH_C32(0x55a2b0e7), + SPH_C32(0x04ea2ab9), SPH_C32(0xeda40e00), SPH_C32(0x53a4cb06), + SPH_C32(0x2b072b33), SPH_C32(0xb5ccec8f) }, + { SPH_C32(0xbca80200), SPH_C32(0x76ba538f), SPH_C32(0x35474915), + SPH_C32(0x9afe5fcf), SPH_C32(0x03820e00), SPH_C32(0x41efa338), + SPH_C32(0xabc5fdbc), SPH_C32(0x8e3f47a3) }, + { SPH_C32(0x7a080400), SPH_C32(0x767e77f5), SPH_C32(0xbaa52e89), + SPH_C32(0xb694ad43), SPH_C32(0xb0870c00), SPH_C32(0x714710f4), + SPH_C32(0xa152e1f5), SPH_C32(0x3454d933) }, + { SPH_C32(0xddb00600), SPH_C32(0x696cf3c6), SPH_C32(0xda40d77b), + SPH_C32(0x2880d835), SPH_C32(0x5ea10c00), SPH_C32(0x630c78ca), + SPH_C32(0x2190377a), SPH_C32(0x0fa7721f) }, + { SPH_C32(0x942e0400), SPH_C32(0x64351fcb), SPH_C32(0x3a67f806), + SPH_C32(0x8d67066f), SPH_C32(0xf9190e00), SPH_C32(0x7c1efcf9), + SPH_C32(0x4175ce88), SPH_C32(0x91b30769) }, + { SPH_C32(0x33960600), SPH_C32(0x7b279bf8), SPH_C32(0x5a8201f4), + SPH_C32(0x13737319), SPH_C32(0x173f0e00), SPH_C32(0x6e5594c7), + SPH_C32(0xc1b71807), SPH_C32(0xaa40ac45) }, + { SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), SPH_C32(0xce97a914), + SPH_C32(0xbdd9f5e5), SPH_C32(0xde320800), SPH_C32(0x288350fe), + SPH_C32(0x71852ac7), SPH_C32(0xa6bf9f96) }, + { SPH_C32(0x98010a00), SPH_C32(0x63c85cb0), SPH_C32(0xae7250e6), + SPH_C32(0x23cd8093), SPH_C32(0x30140800), SPH_C32(0x3ac838c0), + SPH_C32(0xf147fc48), SPH_C32(0x9d4c34ba) }, + { SPH_C32(0xd19f0800), SPH_C32(0x6e91b0bd), SPH_C32(0x4e557f9b), + SPH_C32(0x862a5ec9), SPH_C32(0x97ac0a00), SPH_C32(0x25dabcf3), + SPH_C32(0x91a205ba), SPH_C32(0x035841cc) }, + { SPH_C32(0x76270a00), SPH_C32(0x7183348e), SPH_C32(0x2eb08669), + SPH_C32(0x183e2bbf), SPH_C32(0x798a0a00), SPH_C32(0x3791d4cd), + SPH_C32(0x1160d335), SPH_C32(0x38abeae0) }, + { SPH_C32(0xb0870c00), SPH_C32(0x714710f4), SPH_C32(0xa152e1f5), + SPH_C32(0x3454d933), SPH_C32(0xca8f0800), SPH_C32(0x07396701), + SPH_C32(0x1bf7cf7c), SPH_C32(0x82c07470) }, + { SPH_C32(0x173f0e00), SPH_C32(0x6e5594c7), SPH_C32(0xc1b71807), + SPH_C32(0xaa40ac45), SPH_C32(0x24a90800), SPH_C32(0x15720f3f), + SPH_C32(0x9b3519f3), SPH_C32(0xb933df5c) }, + { SPH_C32(0x5ea10c00), SPH_C32(0x630c78ca), SPH_C32(0x2190377a), + SPH_C32(0x0fa7721f), SPH_C32(0x83110a00), SPH_C32(0x0a608b0c), + SPH_C32(0xfbd0e001), SPH_C32(0x2727aa2a) }, + { SPH_C32(0xf9190e00), SPH_C32(0x7c1efcf9), SPH_C32(0x4175ce88), + SPH_C32(0x91b30769), SPH_C32(0x6d370a00), SPH_C32(0x182be332), + SPH_C32(0x7b12368e), SPH_C32(0x1cd40106) }, + { SPH_C32(0x2b040800), SPH_C32(0x5360ef7c), SPH_C32(0xa4e54caf), + SPH_C32(0x99a61e03), SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), + SPH_C32(0x7432879d), SPH_C32(0x0b4d58a6) }, + { SPH_C32(0x8cbc0a00), SPH_C32(0x4c726b4f), SPH_C32(0xc400b55d), + SPH_C32(0x07b26b75), SPH_C32(0xab970c00), SPH_C32(0x18efc748), + SPH_C32(0xf4f05112), SPH_C32(0x30bef38a) }, + { SPH_C32(0xc5220800), SPH_C32(0x412b8742), SPH_C32(0x24279a20), + SPH_C32(0xa255b52f), SPH_C32(0x0c2f0e00), SPH_C32(0x07fd437b), + SPH_C32(0x9415a8e0), SPH_C32(0xaeaa86fc) }, + { SPH_C32(0x629a0a00), SPH_C32(0x5e390371), SPH_C32(0x44c263d2), + SPH_C32(0x3c41c059), SPH_C32(0xe2090e00), SPH_C32(0x15b62b45), + SPH_C32(0x14d77e6f), SPH_C32(0x95592dd0) }, + { SPH_C32(0xa43a0c00), SPH_C32(0x5efd270b), SPH_C32(0xcb20044e), + SPH_C32(0x102b32d5), SPH_C32(0x510c0c00), SPH_C32(0x251e9889), + SPH_C32(0x1e406226), SPH_C32(0x2f32b340) }, + { SPH_C32(0x03820e00), SPH_C32(0x41efa338), SPH_C32(0xabc5fdbc), + SPH_C32(0x8e3f47a3), SPH_C32(0xbf2a0c00), SPH_C32(0x3755f0b7), + SPH_C32(0x9e82b4a9), SPH_C32(0x14c1186c) }, + { SPH_C32(0x4a1c0c00), SPH_C32(0x4cb64f35), SPH_C32(0x4be2d2c1), + SPH_C32(0x2bd899f9), SPH_C32(0x18920e00), SPH_C32(0x28477484), + SPH_C32(0xfe674d5b), SPH_C32(0x8ad56d1a) }, + { SPH_C32(0xeda40e00), SPH_C32(0x53a4cb06), SPH_C32(0x2b072b33), + SPH_C32(0xb5ccec8f), SPH_C32(0xf6b40e00), SPH_C32(0x3a0c1cba), + SPH_C32(0x7ea59bd4), SPH_C32(0xb126c636) }, + { SPH_C32(0x74951000), SPH_C32(0x5a2b467e), SPH_C32(0x88fd1d2b), + SPH_C32(0x1ee68292), SPH_C32(0xcba90000), SPH_C32(0x90273769), + SPH_C32(0xbbdcf407), SPH_C32(0xd0f4af61) }, + { SPH_C32(0xd32d1200), SPH_C32(0x4539c24d), SPH_C32(0xe818e4d9), + SPH_C32(0x80f2f7e4), SPH_C32(0x258f0000), SPH_C32(0x826c5f57), + SPH_C32(0x3b1e2288), SPH_C32(0xeb07044d) }, + { SPH_C32(0x9ab31000), SPH_C32(0x48602e40), SPH_C32(0x083fcba4), + SPH_C32(0x251529be), SPH_C32(0x82370200), SPH_C32(0x9d7edb64), + SPH_C32(0x5bfbdb7a), SPH_C32(0x7513713b) }, + { SPH_C32(0x3d0b1200), SPH_C32(0x5772aa73), SPH_C32(0x68da3256), + SPH_C32(0xbb015cc8), SPH_C32(0x6c110200), SPH_C32(0x8f35b35a), + SPH_C32(0xdb390df5), SPH_C32(0x4ee0da17) }, + { SPH_C32(0xfbab1400), SPH_C32(0x57b68e09), SPH_C32(0xe73855ca), + SPH_C32(0x976bae44), SPH_C32(0xdf140000), SPH_C32(0xbf9d0096), + SPH_C32(0xd1ae11bc), SPH_C32(0xf48b4487) }, + { SPH_C32(0x5c131600), SPH_C32(0x48a40a3a), SPH_C32(0x87ddac38), + SPH_C32(0x097fdb32), SPH_C32(0x31320000), SPH_C32(0xadd668a8), + SPH_C32(0x516cc733), SPH_C32(0xcf78efab) }, + { SPH_C32(0x158d1400), SPH_C32(0x45fde637), SPH_C32(0x67fa8345), + SPH_C32(0xac980568), SPH_C32(0x968a0200), SPH_C32(0xb2c4ec9b), + SPH_C32(0x31893ec1), SPH_C32(0x516c9add) }, + { SPH_C32(0xb2351600), SPH_C32(0x5aef6204), SPH_C32(0x071f7ab7), + SPH_C32(0x328c701e), SPH_C32(0x78ac0200), SPH_C32(0xa08f84a5), + SPH_C32(0xb14be84e), SPH_C32(0x6a9f31f1) }, + { SPH_C32(0x60281000), SPH_C32(0x75917181), SPH_C32(0xe28ff890), + SPH_C32(0x3a996974), SPH_C32(0x502a0400), SPH_C32(0xb200c8e1), + SPH_C32(0xbe6b595d), SPH_C32(0x7d066851) }, + { SPH_C32(0xc7901200), SPH_C32(0x6a83f5b2), SPH_C32(0x826a0162), + SPH_C32(0xa48d1c02), SPH_C32(0xbe0c0400), SPH_C32(0xa04ba0df), + SPH_C32(0x3ea98fd2), SPH_C32(0x46f5c37d) }, + { SPH_C32(0x8e0e1000), SPH_C32(0x67da19bf), SPH_C32(0x624d2e1f), + SPH_C32(0x016ac258), SPH_C32(0x19b40600), SPH_C32(0xbf5924ec), + SPH_C32(0x5e4c7620), SPH_C32(0xd8e1b60b) }, + { SPH_C32(0x29b61200), SPH_C32(0x78c89d8c), SPH_C32(0x02a8d7ed), + SPH_C32(0x9f7eb72e), SPH_C32(0xf7920600), SPH_C32(0xad124cd2), + SPH_C32(0xde8ea0af), SPH_C32(0xe3121d27) }, + { SPH_C32(0xef161400), SPH_C32(0x780cb9f6), SPH_C32(0x8d4ab071), + SPH_C32(0xb31445a2), SPH_C32(0x44970400), SPH_C32(0x9dbaff1e), + SPH_C32(0xd419bce6), SPH_C32(0x597983b7) }, + { SPH_C32(0x48ae1600), SPH_C32(0x671e3dc5), SPH_C32(0xedaf4983), + SPH_C32(0x2d0030d4), SPH_C32(0xaab10400), SPH_C32(0x8ff19720), + SPH_C32(0x54db6a69), SPH_C32(0x628a289b) }, + { SPH_C32(0x01301400), SPH_C32(0x6a47d1c8), SPH_C32(0x0d8866fe), + SPH_C32(0x88e7ee8e), SPH_C32(0x0d090600), SPH_C32(0x90e31313), + SPH_C32(0x343e939b), SPH_C32(0xfc9e5ded) }, + { SPH_C32(0xa6881600), SPH_C32(0x755555fb), SPH_C32(0x6d6d9f0c), + SPH_C32(0x16f39bf8), SPH_C32(0xe32f0600), SPH_C32(0x82a87b2d), + SPH_C32(0xb4fc4514), SPH_C32(0xc76df6c1) }, + { SPH_C32(0xaaa71800), SPH_C32(0x72a81680), SPH_C32(0xf97837ec), + SPH_C32(0xb8591d04), SPH_C32(0x2a220000), SPH_C32(0xc47ebf14), + SPH_C32(0x04ce77d4), SPH_C32(0xcb92c512) }, + { SPH_C32(0x0d1f1a00), SPH_C32(0x6dba92b3), SPH_C32(0x999dce1e), + SPH_C32(0x264d6872), SPH_C32(0xc4040000), SPH_C32(0xd635d72a), + SPH_C32(0x840ca15b), SPH_C32(0xf0616e3e) }, + { SPH_C32(0x44811800), SPH_C32(0x60e37ebe), SPH_C32(0x79bae163), + SPH_C32(0x83aab628), SPH_C32(0x63bc0200), SPH_C32(0xc9275319), + SPH_C32(0xe4e958a9), SPH_C32(0x6e751b48) }, + { SPH_C32(0xe3391a00), SPH_C32(0x7ff1fa8d), SPH_C32(0x195f1891), + SPH_C32(0x1dbec35e), SPH_C32(0x8d9a0200), SPH_C32(0xdb6c3b27), + SPH_C32(0x642b8e26), SPH_C32(0x5586b064) }, + { SPH_C32(0x25991c00), SPH_C32(0x7f35def7), SPH_C32(0x96bd7f0d), + SPH_C32(0x31d431d2), SPH_C32(0x3e9f0000), SPH_C32(0xebc488eb), + SPH_C32(0x6ebc926f), SPH_C32(0xefed2ef4) }, + { SPH_C32(0x82211e00), SPH_C32(0x60275ac4), SPH_C32(0xf65886ff), + SPH_C32(0xafc044a4), SPH_C32(0xd0b90000), SPH_C32(0xf98fe0d5), + SPH_C32(0xee7e44e0), SPH_C32(0xd41e85d8) }, + { SPH_C32(0xcbbf1c00), SPH_C32(0x6d7eb6c9), SPH_C32(0x167fa982), + SPH_C32(0x0a279afe), SPH_C32(0x77010200), SPH_C32(0xe69d64e6), + SPH_C32(0x8e9bbd12), SPH_C32(0x4a0af0ae) }, + { SPH_C32(0x6c071e00), SPH_C32(0x726c32fa), SPH_C32(0x769a5070), + SPH_C32(0x9433ef88), SPH_C32(0x99270200), SPH_C32(0xf4d60cd8), + SPH_C32(0x0e596b9d), SPH_C32(0x71f95b82) }, + { SPH_C32(0xbe1a1800), SPH_C32(0x5d12217f), SPH_C32(0x930ad257), + SPH_C32(0x9c26f6e2), SPH_C32(0xb1a10400), SPH_C32(0xe659409c), + SPH_C32(0x0179da8e), SPH_C32(0x66600222) }, + { SPH_C32(0x19a21a00), SPH_C32(0x4200a54c), SPH_C32(0xf3ef2ba5), + SPH_C32(0x02328394), SPH_C32(0x5f870400), SPH_C32(0xf41228a2), + SPH_C32(0x81bb0c01), SPH_C32(0x5d93a90e) }, + { SPH_C32(0x503c1800), SPH_C32(0x4f594941), SPH_C32(0x13c804d8), + SPH_C32(0xa7d55dce), SPH_C32(0xf83f0600), SPH_C32(0xeb00ac91), + SPH_C32(0xe15ef5f3), SPH_C32(0xc387dc78) }, + { SPH_C32(0xf7841a00), SPH_C32(0x504bcd72), SPH_C32(0x732dfd2a), + SPH_C32(0x39c128b8), SPH_C32(0x16190600), SPH_C32(0xf94bc4af), + SPH_C32(0x619c237c), SPH_C32(0xf8747754) }, + { SPH_C32(0x31241c00), SPH_C32(0x508fe908), SPH_C32(0xfccf9ab6), + SPH_C32(0x15abda34), SPH_C32(0xa51c0400), SPH_C32(0xc9e37763), + SPH_C32(0x6b0b3f35), SPH_C32(0x421fe9c4) }, + { SPH_C32(0x969c1e00), SPH_C32(0x4f9d6d3b), SPH_C32(0x9c2a6344), + SPH_C32(0x8bbfaf42), SPH_C32(0x4b3a0400), SPH_C32(0xdba81f5d), + SPH_C32(0xebc9e9ba), SPH_C32(0x79ec42e8) }, + { SPH_C32(0xdf021c00), SPH_C32(0x42c48136), SPH_C32(0x7c0d4c39), + SPH_C32(0x2e587118), SPH_C32(0xec820600), SPH_C32(0xc4ba9b6e), + SPH_C32(0x8b2c1048), SPH_C32(0xe7f8379e) }, + { SPH_C32(0x78ba1e00), SPH_C32(0x5dd60505), SPH_C32(0x1ce8b5cb), + SPH_C32(0xb04c046e), SPH_C32(0x02a40600), SPH_C32(0xd6f1f350), + SPH_C32(0x0beec6c7), SPH_C32(0xdc0b9cb2) }, + { SPH_C32(0x951e1000), SPH_C32(0x0e72ce03), SPH_C32(0x37ef9ef8), + SPH_C32(0x0580e8e1), SPH_C32(0xf4100800), SPH_C32(0xecfdefea), + SPH_C32(0x754b5d13), SPH_C32(0x6d2d5a84) }, + { SPH_C32(0x32a61200), SPH_C32(0x11604a30), SPH_C32(0x570a670a), + SPH_C32(0x9b949d97), SPH_C32(0x1a360800), SPH_C32(0xfeb687d4), + SPH_C32(0xf5898b9c), SPH_C32(0x56def1a8) }, + { SPH_C32(0x7b381000), SPH_C32(0x1c39a63d), SPH_C32(0xb72d4877), + SPH_C32(0x3e7343cd), SPH_C32(0xbd8e0a00), SPH_C32(0xe1a403e7), + SPH_C32(0x956c726e), SPH_C32(0xc8ca84de) }, + { SPH_C32(0xdc801200), SPH_C32(0x032b220e), SPH_C32(0xd7c8b185), + SPH_C32(0xa06736bb), SPH_C32(0x53a80a00), SPH_C32(0xf3ef6bd9), + SPH_C32(0x15aea4e1), SPH_C32(0xf3392ff2) }, + { SPH_C32(0x1a201400), SPH_C32(0x03ef0674), SPH_C32(0x582ad619), + SPH_C32(0x8c0dc437), SPH_C32(0xe0ad0800), SPH_C32(0xc347d815), + SPH_C32(0x1f39b8a8), SPH_C32(0x4952b162) }, + { SPH_C32(0xbd981600), SPH_C32(0x1cfd8247), SPH_C32(0x38cf2feb), + SPH_C32(0x1219b141), SPH_C32(0x0e8b0800), SPH_C32(0xd10cb02b), + SPH_C32(0x9ffb6e27), SPH_C32(0x72a11a4e) }, + { SPH_C32(0xf4061400), SPH_C32(0x11a46e4a), SPH_C32(0xd8e80096), + SPH_C32(0xb7fe6f1b), SPH_C32(0xa9330a00), SPH_C32(0xce1e3418), + SPH_C32(0xff1e97d5), SPH_C32(0xecb56f38) }, + { SPH_C32(0x53be1600), SPH_C32(0x0eb6ea79), SPH_C32(0xb80df964), + SPH_C32(0x29ea1a6d), SPH_C32(0x47150a00), SPH_C32(0xdc555c26), + SPH_C32(0x7fdc415a), SPH_C32(0xd746c414) }, + { SPH_C32(0x81a31000), SPH_C32(0x21c8f9fc), SPH_C32(0x5d9d7b43), + SPH_C32(0x21ff0307), SPH_C32(0x6f930c00), SPH_C32(0xceda1062), + SPH_C32(0x70fcf049), SPH_C32(0xc0df9db4) }, + { SPH_C32(0x261b1200), SPH_C32(0x3eda7dcf), SPH_C32(0x3d7882b1), + SPH_C32(0xbfeb7671), SPH_C32(0x81b50c00), SPH_C32(0xdc91785c), + SPH_C32(0xf03e26c6), SPH_C32(0xfb2c3698) }, + { SPH_C32(0x6f851000), SPH_C32(0x338391c2), SPH_C32(0xdd5fadcc), + SPH_C32(0x1a0ca82b), SPH_C32(0x260d0e00), SPH_C32(0xc383fc6f), + SPH_C32(0x90dbdf34), SPH_C32(0x653843ee) }, + { SPH_C32(0xc83d1200), SPH_C32(0x2c9115f1), SPH_C32(0xbdba543e), + SPH_C32(0x8418dd5d), SPH_C32(0xc82b0e00), SPH_C32(0xd1c89451), + SPH_C32(0x101909bb), SPH_C32(0x5ecbe8c2) }, + { SPH_C32(0x0e9d1400), SPH_C32(0x2c55318b), SPH_C32(0x325833a2), + SPH_C32(0xa8722fd1), SPH_C32(0x7b2e0c00), SPH_C32(0xe160279d), + SPH_C32(0x1a8e15f2), SPH_C32(0xe4a07652) }, + { SPH_C32(0xa9251600), SPH_C32(0x3347b5b8), SPH_C32(0x52bdca50), + SPH_C32(0x36665aa7), SPH_C32(0x95080c00), SPH_C32(0xf32b4fa3), + SPH_C32(0x9a4cc37d), SPH_C32(0xdf53dd7e) }, + { SPH_C32(0xe0bb1400), SPH_C32(0x3e1e59b5), SPH_C32(0xb29ae52d), + SPH_C32(0x938184fd), SPH_C32(0x32b00e00), SPH_C32(0xec39cb90), + SPH_C32(0xfaa93a8f), SPH_C32(0x4147a808) }, + { SPH_C32(0x47031600), SPH_C32(0x210cdd86), SPH_C32(0xd27f1cdf), + SPH_C32(0x0d95f18b), SPH_C32(0xdc960e00), SPH_C32(0xfe72a3ae), + SPH_C32(0x7a6bec00), SPH_C32(0x7ab40324) }, + { SPH_C32(0x4b2c1800), SPH_C32(0x26f19efd), SPH_C32(0x466ab43f), + SPH_C32(0xa33f7777), SPH_C32(0x159b0800), SPH_C32(0xb8a46797), + SPH_C32(0xca59dec0), SPH_C32(0x764b30f7) }, + { SPH_C32(0xec941a00), SPH_C32(0x39e31ace), SPH_C32(0x268f4dcd), + SPH_C32(0x3d2b0201), SPH_C32(0xfbbd0800), SPH_C32(0xaaef0fa9), + SPH_C32(0x4a9b084f), SPH_C32(0x4db89bdb) }, + { SPH_C32(0xa50a1800), SPH_C32(0x34baf6c3), SPH_C32(0xc6a862b0), + SPH_C32(0x98ccdc5b), SPH_C32(0x5c050a00), SPH_C32(0xb5fd8b9a), + SPH_C32(0x2a7ef1bd), SPH_C32(0xd3aceead) }, + { SPH_C32(0x02b21a00), SPH_C32(0x2ba872f0), SPH_C32(0xa64d9b42), + SPH_C32(0x06d8a92d), SPH_C32(0xb2230a00), SPH_C32(0xa7b6e3a4), + SPH_C32(0xaabc2732), SPH_C32(0xe85f4581) }, + { SPH_C32(0xc4121c00), SPH_C32(0x2b6c568a), SPH_C32(0x29affcde), + SPH_C32(0x2ab25ba1), SPH_C32(0x01260800), SPH_C32(0x971e5068), + SPH_C32(0xa02b3b7b), SPH_C32(0x5234db11) }, + { SPH_C32(0x63aa1e00), SPH_C32(0x347ed2b9), SPH_C32(0x494a052c), + SPH_C32(0xb4a62ed7), SPH_C32(0xef000800), SPH_C32(0x85553856), + SPH_C32(0x20e9edf4), SPH_C32(0x69c7703d) }, + { SPH_C32(0x2a341c00), SPH_C32(0x39273eb4), SPH_C32(0xa96d2a51), + SPH_C32(0x1141f08d), SPH_C32(0x48b80a00), SPH_C32(0x9a47bc65), + SPH_C32(0x400c1406), SPH_C32(0xf7d3054b) }, + { SPH_C32(0x8d8c1e00), SPH_C32(0x2635ba87), SPH_C32(0xc988d3a3), + SPH_C32(0x8f5585fb), SPH_C32(0xa69e0a00), SPH_C32(0x880cd45b), + SPH_C32(0xc0cec289), SPH_C32(0xcc20ae67) }, + { SPH_C32(0x5f911800), SPH_C32(0x094ba902), SPH_C32(0x2c185184), + SPH_C32(0x87409c91), SPH_C32(0x8e180c00), SPH_C32(0x9a83981f), + SPH_C32(0xcfee739a), SPH_C32(0xdbb9f7c7) }, + { SPH_C32(0xf8291a00), SPH_C32(0x16592d31), SPH_C32(0x4cfda876), + SPH_C32(0x1954e9e7), SPH_C32(0x603e0c00), SPH_C32(0x88c8f021), + SPH_C32(0x4f2ca515), SPH_C32(0xe04a5ceb) }, + { SPH_C32(0xb1b71800), SPH_C32(0x1b00c13c), SPH_C32(0xacda870b), + SPH_C32(0xbcb337bd), SPH_C32(0xc7860e00), SPH_C32(0x97da7412), + SPH_C32(0x2fc95ce7), SPH_C32(0x7e5e299d) }, + { SPH_C32(0x160f1a00), SPH_C32(0x0412450f), SPH_C32(0xcc3f7ef9), + SPH_C32(0x22a742cb), SPH_C32(0x29a00e00), SPH_C32(0x85911c2c), + SPH_C32(0xaf0b8a68), SPH_C32(0x45ad82b1) }, + { SPH_C32(0xd0af1c00), SPH_C32(0x04d66175), SPH_C32(0x43dd1965), + SPH_C32(0x0ecdb047), SPH_C32(0x9aa50c00), SPH_C32(0xb539afe0), + SPH_C32(0xa59c9621), SPH_C32(0xffc61c21) }, + { SPH_C32(0x77171e00), SPH_C32(0x1bc4e546), SPH_C32(0x2338e097), + SPH_C32(0x90d9c531), SPH_C32(0x74830c00), SPH_C32(0xa772c7de), + SPH_C32(0x255e40ae), SPH_C32(0xc435b70d) }, + { SPH_C32(0x3e891c00), SPH_C32(0x169d094b), SPH_C32(0xc31fcfea), + SPH_C32(0x353e1b6b), SPH_C32(0xd33b0e00), SPH_C32(0xb86043ed), + SPH_C32(0x45bbb95c), SPH_C32(0x5a21c27b) }, + { SPH_C32(0x99311e00), SPH_C32(0x098f8d78), SPH_C32(0xa3fa3618), + SPH_C32(0xab2a6e1d), SPH_C32(0x3d1d0e00), SPH_C32(0xaa2b2bd3), + SPH_C32(0xc5796fd3), SPH_C32(0x61d26957) } +}; + +static const sph_u32 T256_14[128][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), SPH_C32(0x79a90df9), + SPH_C32(0x63e92178), SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), + SPH_C32(0x806741fd), SPH_C32(0x814681b8) }, + { SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), SPH_C32(0x36656ba8), + SPH_C32(0x23633a05), SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), + SPH_C32(0x5d5ca0f7), SPH_C32(0x727784cb) }, + { SPH_C32(0x11bc0040), SPH_C32(0xf2e1216c), SPH_C32(0x4fcc6651), + SPH_C32(0x408a1b7d), SPH_C32(0x86610020), SPH_C32(0xe89072d0), + SPH_C32(0xdd3be10a), SPH_C32(0xf3310573) }, + { SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), SPH_C32(0x5d5ca0f7), + SPH_C32(0x727784cb), SPH_C32(0x35650040), SPH_C32(0x9b96b64a), + SPH_C32(0x6b39cb5f), SPH_C32(0x5114bece) }, + { SPH_C32(0x24d90000), SPH_C32(0x69779726), SPH_C32(0x24f5ad0e), + SPH_C32(0x119ea5b3), SPH_C32(0xcbaf0060), SPH_C32(0xd3cb9eae), + SPH_C32(0xeb5e8aa2), SPH_C32(0xd0523f76) }, + { SPH_C32(0x35650040), SPH_C32(0x9b96b64a), SPH_C32(0x6b39cb5f), + SPH_C32(0x5114bece), SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), + SPH_C32(0x36656ba8), SPH_C32(0x23633a05) }, + { SPH_C32(0x69170040), SPH_C32(0x522c7b58), SPH_C32(0x1290c6a6), + SPH_C32(0x32fd9fb6), SPH_C32(0xb3040060), SPH_C32(0x7306c49a), + SPH_C32(0xb6022a55), SPH_C32(0xa225bbbd) }, + { SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), SPH_C32(0xc2c46c55), + SPH_C32(0xf362b233), SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), + SPH_C32(0xd14e094b), SPH_C32(0xb772b42b) }, + { SPH_C32(0x07a00080), SPH_C32(0x8cb5d5fe), SPH_C32(0xbb6d61ac), + SPH_C32(0x908b934b), SPH_C32(0xc76c0020), SPH_C32(0x02ea7b0f), + SPH_C32(0x512948b6), SPH_C32(0x36343593) }, + { SPH_C32(0x161c00c0), SPH_C32(0x7e54f492), SPH_C32(0xf4a107fd), + SPH_C32(0xd0018836), SPH_C32(0x410d0000), SPH_C32(0xea7a09df), + SPH_C32(0x8c12a9bc), SPH_C32(0xc50530e0) }, + { SPH_C32(0x4a6e00c0), SPH_C32(0xb7ee3980), SPH_C32(0x8d080a04), + SPH_C32(0xb3e8a94e), SPH_C32(0xbfc70020), SPH_C32(0xa227213b), + SPH_C32(0x0c75e841), SPH_C32(0x4443b158) }, + { SPH_C32(0x23790080), SPH_C32(0xe5c242d8), SPH_C32(0x9f98cca2), + SPH_C32(0x811536f8), SPH_C32(0x0cc30040), SPH_C32(0xd121e5a1), + SPH_C32(0xba77c214), SPH_C32(0xe6660ae5) }, + { SPH_C32(0x7f0b0080), SPH_C32(0x2c788fca), SPH_C32(0xe631c15b), + SPH_C32(0xe2fc1780), SPH_C32(0xf2090060), SPH_C32(0x997ccd45), + SPH_C32(0x3a1083e9), SPH_C32(0x67208b5d) }, + { SPH_C32(0x6eb700c0), SPH_C32(0xde99aea6), SPH_C32(0xa9fda70a), + SPH_C32(0xa2760cfd), SPH_C32(0x74680040), SPH_C32(0x71ecbf95), + SPH_C32(0xe72b62e3), SPH_C32(0x94118e2e) }, + { SPH_C32(0x32c500c0), SPH_C32(0x172363b4), SPH_C32(0xd054aaf3), + SPH_C32(0xc19f2d85), SPH_C32(0x8aa20060), SPH_C32(0x39b19771), + SPH_C32(0x674c231e), SPH_C32(0x15570f96) }, + { SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), SPH_C32(0xd14e094b), + SPH_C32(0xb772b42b), SPH_C32(0x62740080), SPH_C32(0x0fb84b07), + SPH_C32(0x138a651e), SPH_C32(0x44100618) }, + { SPH_C32(0x65d40000), SPH_C32(0x830d9ef9), SPH_C32(0xa8e704b2), + SPH_C32(0xd49b9553), SPH_C32(0x9cbe00a0), SPH_C32(0x47e563e3), + SPH_C32(0x93ed24e3), SPH_C32(0xc55687a0) }, + { SPH_C32(0x74680040), SPH_C32(0x71ecbf95), SPH_C32(0xe72b62e3), + SPH_C32(0x94118e2e), SPH_C32(0x1adf0080), SPH_C32(0xaf751133), + SPH_C32(0x4ed6c5e9), SPH_C32(0x366782d3) }, + { SPH_C32(0x281a0040), SPH_C32(0xb8567287), SPH_C32(0x9e826f1a), + SPH_C32(0xf7f8af56), SPH_C32(0xe41500a0), SPH_C32(0xe72839d7), + SPH_C32(0xceb18414), SPH_C32(0xb721036b) }, + { SPH_C32(0x410d0000), SPH_C32(0xea7a09df), SPH_C32(0x8c12a9bc), + SPH_C32(0xc50530e0), SPH_C32(0x571100c0), SPH_C32(0x942efd4d), + SPH_C32(0x78b3ae41), SPH_C32(0x1504b8d6) }, + { SPH_C32(0x1d7f0000), SPH_C32(0x23c0c4cd), SPH_C32(0xf5bba445), + SPH_C32(0xa6ec1198), SPH_C32(0xa9db00e0), SPH_C32(0xdc73d5a9), + SPH_C32(0xf8d4efbc), SPH_C32(0x9442396e) }, + { SPH_C32(0x0cc30040), SPH_C32(0xd121e5a1), SPH_C32(0xba77c214), + SPH_C32(0xe6660ae5), SPH_C32(0x2fba00c0), SPH_C32(0x34e3a779), + SPH_C32(0x25ef0eb6), SPH_C32(0x67733c1d) }, + { SPH_C32(0x50b10040), SPH_C32(0x189b28b3), SPH_C32(0xc3decfed), + SPH_C32(0x858f2b9d), SPH_C32(0xd17000e0), SPH_C32(0x7cbe8f9d), + SPH_C32(0xa5884f4b), SPH_C32(0xe635bda5) }, + { SPH_C32(0x62740080), SPH_C32(0x0fb84b07), SPH_C32(0x138a651e), + SPH_C32(0x44100618), SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), + SPH_C32(0xc2c46c55), SPH_C32(0xf362b233) }, + { SPH_C32(0x3e060080), SPH_C32(0xc6028615), SPH_C32(0x6a2368e7), + SPH_C32(0x27f92760), SPH_C32(0xa51800a0), SPH_C32(0x0d523008), + SPH_C32(0x42a32da8), SPH_C32(0x7224338b) }, + { SPH_C32(0x2fba00c0), SPH_C32(0x34e3a779), SPH_C32(0x25ef0eb6), + SPH_C32(0x67733c1d), SPH_C32(0x23790080), SPH_C32(0xe5c242d8), + SPH_C32(0x9f98cca2), SPH_C32(0x811536f8) }, + { SPH_C32(0x73c800c0), SPH_C32(0xfd596a6b), SPH_C32(0x5c46034f), + SPH_C32(0x049a1d65), SPH_C32(0xddb300a0), SPH_C32(0xad9f6a3c), + SPH_C32(0x1fff8d5f), SPH_C32(0x0053b740) }, + { SPH_C32(0x1adf0080), SPH_C32(0xaf751133), SPH_C32(0x4ed6c5e9), + SPH_C32(0x366782d3), SPH_C32(0x6eb700c0), SPH_C32(0xde99aea6), + SPH_C32(0xa9fda70a), SPH_C32(0xa2760cfd) }, + { SPH_C32(0x46ad0080), SPH_C32(0x66cfdc21), SPH_C32(0x377fc810), + SPH_C32(0x558ea3ab), SPH_C32(0x907d00e0), SPH_C32(0x96c48642), + SPH_C32(0x299ae6f7), SPH_C32(0x23308d45) }, + { SPH_C32(0x571100c0), SPH_C32(0x942efd4d), SPH_C32(0x78b3ae41), + SPH_C32(0x1504b8d6), SPH_C32(0x161c00c0), SPH_C32(0x7e54f492), + SPH_C32(0xf4a107fd), SPH_C32(0xd0018836) }, + { SPH_C32(0x0b6300c0), SPH_C32(0x5d94305f), SPH_C32(0x011aa3b8), + SPH_C32(0x76ed99ae), SPH_C32(0xe8d600e0), SPH_C32(0x3609dc76), + SPH_C32(0x74c64600), SPH_C32(0x5147098e) }, + { SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), SPH_C32(0x8589d8ab), + SPH_C32(0xe6c46464), SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), + SPH_C32(0xa29d1297), SPH_C32(0x6ee56854) }, + { SPH_C32(0xebd60100), SPH_C32(0x43a5fcca), SPH_C32(0xfc20d552), + SPH_C32(0x852d451c), SPH_C32(0x8d860020), SPH_C32(0xdd328f32), + SPH_C32(0x22fa536a), SPH_C32(0xefa3e9ec) }, + { SPH_C32(0xfa6a0140), SPH_C32(0xb144dda6), SPH_C32(0xb3ecb303), + SPH_C32(0xc5a75e61), SPH_C32(0x0be70000), SPH_C32(0x35a2fde2), + SPH_C32(0xffc1b260), SPH_C32(0x1c92ec9f) }, + { SPH_C32(0xa6180140), SPH_C32(0x78fe10b4), SPH_C32(0xca45befa), + SPH_C32(0xa64e7f19), SPH_C32(0xf52d0020), SPH_C32(0x7dffd506), + SPH_C32(0x7fa6f39d), SPH_C32(0x9dd46d27) }, + { SPH_C32(0xcf0f0100), SPH_C32(0x2ad26bec), SPH_C32(0xd8d5785c), + SPH_C32(0x94b3e0af), SPH_C32(0x46290040), SPH_C32(0x0ef9119c), + SPH_C32(0xc9a4d9c8), SPH_C32(0x3ff1d69a) }, + { SPH_C32(0x937d0100), SPH_C32(0xe368a6fe), SPH_C32(0xa17c75a5), + SPH_C32(0xf75ac1d7), SPH_C32(0xb8e30060), SPH_C32(0x46a43978), + SPH_C32(0x49c39835), SPH_C32(0xbeb75722) }, + { SPH_C32(0x82c10140), SPH_C32(0x11898792), SPH_C32(0xeeb013f4), + SPH_C32(0xb7d0daaa), SPH_C32(0x3e820040), SPH_C32(0xae344ba8), + SPH_C32(0x94f8793f), SPH_C32(0x4d865251) }, + { SPH_C32(0xdeb30140), SPH_C32(0xd8334a80), SPH_C32(0x97191e0d), + SPH_C32(0xd439fbd2), SPH_C32(0xc0480060), SPH_C32(0xe669634c), + SPH_C32(0x149f38c2), SPH_C32(0xccc0d3e9) }, + { SPH_C32(0xec760180), SPH_C32(0xcf102934), SPH_C32(0x474db4fe), + SPH_C32(0x15a6d657), SPH_C32(0x4aea0000), SPH_C32(0xdfd8f43d), + SPH_C32(0x73d31bdc), SPH_C32(0xd997dc7f) }, + { SPH_C32(0xb0040180), SPH_C32(0x06aae426), SPH_C32(0x3ee4b907), + SPH_C32(0x764ff72f), SPH_C32(0xb4200020), SPH_C32(0x9785dcd9), + SPH_C32(0xf3b45a21), SPH_C32(0x58d15dc7) }, + { SPH_C32(0xa1b801c0), SPH_C32(0xf44bc54a), SPH_C32(0x7128df56), + SPH_C32(0x36c5ec52), SPH_C32(0x32410000), SPH_C32(0x7f15ae09), + SPH_C32(0x2e8fbb2b), SPH_C32(0xabe058b4) }, + { SPH_C32(0xfdca01c0), SPH_C32(0x3df10858), SPH_C32(0x0881d2af), + SPH_C32(0x552ccd2a), SPH_C32(0xcc8b0020), SPH_C32(0x374886ed), + SPH_C32(0xaee8fad6), SPH_C32(0x2aa6d90c) }, + { SPH_C32(0x94dd0180), SPH_C32(0x6fdd7300), SPH_C32(0x1a111409), + SPH_C32(0x67d1529c), SPH_C32(0x7f8f0040), SPH_C32(0x444e4277), + SPH_C32(0x18ead083), SPH_C32(0x888362b1) }, + { SPH_C32(0xc8af0180), SPH_C32(0xa667be12), SPH_C32(0x63b819f0), + SPH_C32(0x043873e4), SPH_C32(0x81450060), SPH_C32(0x0c136a93), + SPH_C32(0x988d917e), SPH_C32(0x09c5e309) }, + { SPH_C32(0xd91301c0), SPH_C32(0x54869f7e), SPH_C32(0x2c747fa1), + SPH_C32(0x44b26899), SPH_C32(0x07240040), SPH_C32(0xe4831843), + SPH_C32(0x45b67074), SPH_C32(0xfaf4e67a) }, + { SPH_C32(0x856101c0), SPH_C32(0x9d3c526c), SPH_C32(0x55dd7258), + SPH_C32(0x275b49e1), SPH_C32(0xf9ee0060), SPH_C32(0xacde30a7), + SPH_C32(0xc5d13189), SPH_C32(0x7bb267c2) }, + { SPH_C32(0x8e020100), SPH_C32(0xc0a86233), SPH_C32(0x54c7d1e0), + SPH_C32(0x51b6d04f), SPH_C32(0x11380080), SPH_C32(0x9ad7ecd1), + SPH_C32(0xb1177789), SPH_C32(0x2af56e4c) }, + { SPH_C32(0xd2700100), SPH_C32(0x0912af21), SPH_C32(0x2d6edc19), + SPH_C32(0x325ff137), SPH_C32(0xeff200a0), SPH_C32(0xd28ac435), + SPH_C32(0x31703674), SPH_C32(0xabb3eff4) }, + { SPH_C32(0xc3cc0140), SPH_C32(0xfbf38e4d), SPH_C32(0x62a2ba48), + SPH_C32(0x72d5ea4a), SPH_C32(0x69930080), SPH_C32(0x3a1ab6e5), + SPH_C32(0xec4bd77e), SPH_C32(0x5882ea87) }, + { SPH_C32(0x9fbe0140), SPH_C32(0x3249435f), SPH_C32(0x1b0bb7b1), + SPH_C32(0x113ccb32), SPH_C32(0x975900a0), SPH_C32(0x72479e01), + SPH_C32(0x6c2c9683), SPH_C32(0xd9c46b3f) }, + { SPH_C32(0xf6a90100), SPH_C32(0x60653807), SPH_C32(0x099b7117), + SPH_C32(0x23c15484), SPH_C32(0x245d00c0), SPH_C32(0x01415a9b), + SPH_C32(0xda2ebcd6), SPH_C32(0x7be1d082) }, + { SPH_C32(0xaadb0100), SPH_C32(0xa9dff515), SPH_C32(0x70327cee), + SPH_C32(0x402875fc), SPH_C32(0xda9700e0), SPH_C32(0x491c727f), + SPH_C32(0x5a49fd2b), SPH_C32(0xfaa7513a) }, + { SPH_C32(0xbb670140), SPH_C32(0x5b3ed479), SPH_C32(0x3ffe1abf), + SPH_C32(0x00a26e81), SPH_C32(0x5cf600c0), SPH_C32(0xa18c00af), + SPH_C32(0x87721c21), SPH_C32(0x09965449) }, + { SPH_C32(0xe7150140), SPH_C32(0x9284196b), SPH_C32(0x46571746), + SPH_C32(0x634b4ff9), SPH_C32(0xa23c00e0), SPH_C32(0xe9d1284b), + SPH_C32(0x07155ddc), SPH_C32(0x88d0d5f1) }, + { SPH_C32(0xd5d00180), SPH_C32(0x85a77adf), SPH_C32(0x9603bdb5), + SPH_C32(0xa2d4627c), SPH_C32(0x289e0080), SPH_C32(0xd060bf3a), + SPH_C32(0x60597ec2), SPH_C32(0x9d87da67) }, + { SPH_C32(0x89a20180), SPH_C32(0x4c1db7cd), SPH_C32(0xefaab04c), + SPH_C32(0xc13d4304), SPH_C32(0xd65400a0), SPH_C32(0x983d97de), + SPH_C32(0xe03e3f3f), SPH_C32(0x1cc15bdf) }, + { SPH_C32(0x981e01c0), SPH_C32(0xbefc96a1), SPH_C32(0xa066d61d), + SPH_C32(0x81b75879), SPH_C32(0x50350080), SPH_C32(0x70ade50e), + SPH_C32(0x3d05de35), SPH_C32(0xeff05eac) }, + { SPH_C32(0xc46c01c0), SPH_C32(0x77465bb3), SPH_C32(0xd9cfdbe4), + SPH_C32(0xe25e7901), SPH_C32(0xaeff00a0), SPH_C32(0x38f0cdea), + SPH_C32(0xbd629fc8), SPH_C32(0x6eb6df14) }, + { SPH_C32(0xad7b0180), SPH_C32(0x256a20eb), SPH_C32(0xcb5f1d42), + SPH_C32(0xd0a3e6b7), SPH_C32(0x1dfb00c0), SPH_C32(0x4bf60970), + SPH_C32(0x0b60b59d), SPH_C32(0xcc9364a9) }, + { SPH_C32(0xf1090180), SPH_C32(0xecd0edf9), SPH_C32(0xb2f610bb), + SPH_C32(0xb34ac7cf), SPH_C32(0xe33100e0), SPH_C32(0x03ab2194), + SPH_C32(0x8b07f460), SPH_C32(0x4dd5e511) }, + { SPH_C32(0xe0b501c0), SPH_C32(0x1e31cc95), SPH_C32(0xfd3a76ea), + SPH_C32(0xf3c0dcb2), SPH_C32(0x655000c0), SPH_C32(0xeb3b5344), + SPH_C32(0x563c156a), SPH_C32(0xbee4e062) }, + { SPH_C32(0xbcc701c0), SPH_C32(0xd78b0187), SPH_C32(0x84937b13), + SPH_C32(0x9029fdca), SPH_C32(0x9b9a00e0), SPH_C32(0xa3667ba0), + SPH_C32(0xd65b5497), SPH_C32(0x3fa261da) }, + { SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), SPH_C32(0xa29d1297), + SPH_C32(0x6ee56854), SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), + SPH_C32(0x2714ca3c), SPH_C32(0x88210c30) }, + { SPH_C32(0x2f3e0000), SPH_C32(0x5cd56ac4), SPH_C32(0xdb341f6e), + SPH_C32(0x0d0c492c), SPH_C32(0x3a220120), SPH_C32(0x572dbeea), + SPH_C32(0xa7738bc1), SPH_C32(0x09678d88) }, + { SPH_C32(0x3e820040), SPH_C32(0xae344ba8), SPH_C32(0x94f8793f), + SPH_C32(0x4d865251), SPH_C32(0xbc430100), SPH_C32(0xbfbdcc3a), + SPH_C32(0x7a486acb), SPH_C32(0xfa5688fb) }, + { SPH_C32(0x62f00040), SPH_C32(0x678e86ba), SPH_C32(0xed5174c6), + SPH_C32(0x2e6f7329), SPH_C32(0x42890120), SPH_C32(0xf7e0e4de), + SPH_C32(0xfa2f2b36), SPH_C32(0x7b100943) }, + { SPH_C32(0x0be70000), SPH_C32(0x35a2fde2), SPH_C32(0xffc1b260), + SPH_C32(0x1c92ec9f), SPH_C32(0xf18d0140), SPH_C32(0x84e62044), + SPH_C32(0x4c2d0163), SPH_C32(0xd935b2fe) }, + { SPH_C32(0x57950000), SPH_C32(0xfc1830f0), SPH_C32(0x8668bf99), + SPH_C32(0x7f7bcde7), SPH_C32(0x0f470160), SPH_C32(0xccbb08a0), + SPH_C32(0xcc4a409e), SPH_C32(0x58733346) }, + { SPH_C32(0x46290040), SPH_C32(0x0ef9119c), SPH_C32(0xc9a4d9c8), + SPH_C32(0x3ff1d69a), SPH_C32(0x89260140), SPH_C32(0x242b7a70), + SPH_C32(0x1171a194), SPH_C32(0xab423635) }, + { SPH_C32(0x1a5b0040), SPH_C32(0xc743dc8e), SPH_C32(0xb00dd431), + SPH_C32(0x5c18f7e2), SPH_C32(0x77ec0160), SPH_C32(0x6c765294), + SPH_C32(0x9116e069), SPH_C32(0x2a04b78d) }, + { SPH_C32(0x289e0080), SPH_C32(0xd060bf3a), SPH_C32(0x60597ec2), + SPH_C32(0x9d87da67), SPH_C32(0xfd4e0100), SPH_C32(0x55c7c5e5), + SPH_C32(0xf65ac377), SPH_C32(0x3f53b81b) }, + { SPH_C32(0x74ec0080), SPH_C32(0x19da7228), SPH_C32(0x19f0733b), + SPH_C32(0xfe6efb1f), SPH_C32(0x03840120), SPH_C32(0x1d9aed01), + SPH_C32(0x763d828a), SPH_C32(0xbe1539a3) }, + { SPH_C32(0x655000c0), SPH_C32(0xeb3b5344), SPH_C32(0x563c156a), + SPH_C32(0xbee4e062), SPH_C32(0x85e50100), SPH_C32(0xf50a9fd1), + SPH_C32(0xab066380), SPH_C32(0x4d243cd0) }, + { SPH_C32(0x392200c0), SPH_C32(0x22819e56), SPH_C32(0x2f951893), + SPH_C32(0xdd0dc11a), SPH_C32(0x7b2f0120), SPH_C32(0xbd57b735), + SPH_C32(0x2b61227d), SPH_C32(0xcc62bd68) }, + { SPH_C32(0x50350080), SPH_C32(0x70ade50e), SPH_C32(0x3d05de35), + SPH_C32(0xeff05eac), SPH_C32(0xc82b0140), SPH_C32(0xce5173af), + SPH_C32(0x9d630828), SPH_C32(0x6e4706d5) }, + { SPH_C32(0x0c470080), SPH_C32(0xb917281c), SPH_C32(0x44acd3cc), + SPH_C32(0x8c197fd4), SPH_C32(0x36e10160), SPH_C32(0x860c5b4b), + SPH_C32(0x1d0449d5), SPH_C32(0xef01876d) }, + { SPH_C32(0x1dfb00c0), SPH_C32(0x4bf60970), SPH_C32(0x0b60b59d), + SPH_C32(0xcc9364a9), SPH_C32(0xb0800140), SPH_C32(0x6e9c299b), + SPH_C32(0xc03fa8df), SPH_C32(0x1c30821e) }, + { SPH_C32(0x418900c0), SPH_C32(0x824cc462), SPH_C32(0x72c9b864), + SPH_C32(0xaf7a45d1), SPH_C32(0x4e4a0160), SPH_C32(0x26c1017f), + SPH_C32(0x4058e922), SPH_C32(0x9d7603a6) }, + { SPH_C32(0x4aea0000), SPH_C32(0xdfd8f43d), SPH_C32(0x73d31bdc), + SPH_C32(0xd997dc7f), SPH_C32(0xa69c0180), SPH_C32(0x10c8dd09), + SPH_C32(0x349eaf22), SPH_C32(0xcc310a28) }, + { SPH_C32(0x16980000), SPH_C32(0x1662392f), SPH_C32(0x0a7a1625), + SPH_C32(0xba7efd07), SPH_C32(0x585601a0), SPH_C32(0x5895f5ed), + SPH_C32(0xb4f9eedf), SPH_C32(0x4d778b90) }, + { SPH_C32(0x07240040), SPH_C32(0xe4831843), SPH_C32(0x45b67074), + SPH_C32(0xfaf4e67a), SPH_C32(0xde370180), SPH_C32(0xb005873d), + SPH_C32(0x69c20fd5), SPH_C32(0xbe468ee3) }, + { SPH_C32(0x5b560040), SPH_C32(0x2d39d551), SPH_C32(0x3c1f7d8d), + SPH_C32(0x991dc702), SPH_C32(0x20fd01a0), SPH_C32(0xf858afd9), + SPH_C32(0xe9a54e28), SPH_C32(0x3f000f5b) }, + { SPH_C32(0x32410000), SPH_C32(0x7f15ae09), SPH_C32(0x2e8fbb2b), + SPH_C32(0xabe058b4), SPH_C32(0x93f901c0), SPH_C32(0x8b5e6b43), + SPH_C32(0x5fa7647d), SPH_C32(0x9d25b4e6) }, + { SPH_C32(0x6e330000), SPH_C32(0xb6af631b), SPH_C32(0x5726b6d2), + SPH_C32(0xc80979cc), SPH_C32(0x6d3301e0), SPH_C32(0xc30343a7), + SPH_C32(0xdfc02580), SPH_C32(0x1c63355e) }, + { SPH_C32(0x7f8f0040), SPH_C32(0x444e4277), SPH_C32(0x18ead083), + SPH_C32(0x888362b1), SPH_C32(0xeb5201c0), SPH_C32(0x2b933177), + SPH_C32(0x02fbc48a), SPH_C32(0xef52302d) }, + { SPH_C32(0x23fd0040), SPH_C32(0x8df48f65), SPH_C32(0x6143dd7a), + SPH_C32(0xeb6a43c9), SPH_C32(0x159801e0), SPH_C32(0x63ce1993), + SPH_C32(0x829c8577), SPH_C32(0x6e14b195) }, + { SPH_C32(0x11380080), SPH_C32(0x9ad7ecd1), SPH_C32(0xb1177789), + SPH_C32(0x2af56e4c), SPH_C32(0x9f3a0180), SPH_C32(0x5a7f8ee2), + SPH_C32(0xe5d0a669), SPH_C32(0x7b43be03) }, + { SPH_C32(0x4d4a0080), SPH_C32(0x536d21c3), SPH_C32(0xc8be7a70), + SPH_C32(0x491c4f34), SPH_C32(0x61f001a0), SPH_C32(0x1222a606), + SPH_C32(0x65b7e794), SPH_C32(0xfa053fbb) }, + { SPH_C32(0x5cf600c0), SPH_C32(0xa18c00af), SPH_C32(0x87721c21), + SPH_C32(0x09965449), SPH_C32(0xe7910180), SPH_C32(0xfab2d4d6), + SPH_C32(0xb88c069e), SPH_C32(0x09343ac8) }, + { SPH_C32(0x008400c0), SPH_C32(0x6836cdbd), SPH_C32(0xfedb11d8), + SPH_C32(0x6a7f7531), SPH_C32(0x195b01a0), SPH_C32(0xb2effc32), + SPH_C32(0x38eb4763), SPH_C32(0x8872bb70) }, + { SPH_C32(0x69930080), SPH_C32(0x3a1ab6e5), SPH_C32(0xec4bd77e), + SPH_C32(0x5882ea87), SPH_C32(0xaa5f01c0), SPH_C32(0xc1e938a8), + SPH_C32(0x8ee96d36), SPH_C32(0x2a5700cd) }, + { SPH_C32(0x35e10080), SPH_C32(0xf3a07bf7), SPH_C32(0x95e2da87), + SPH_C32(0x3b6bcbff), SPH_C32(0x549501e0), SPH_C32(0x89b4104c), + SPH_C32(0x0e8e2ccb), SPH_C32(0xab118175) }, + { SPH_C32(0x245d00c0), SPH_C32(0x01415a9b), SPH_C32(0xda2ebcd6), + SPH_C32(0x7be1d082), SPH_C32(0xd2f401c0), SPH_C32(0x6124629c), + SPH_C32(0xd3b5cdc1), SPH_C32(0x58208406) }, + { SPH_C32(0x782f00c0), SPH_C32(0xc8fb9789), SPH_C32(0xa387b12f), + SPH_C32(0x1808f1fa), SPH_C32(0x2c3e01e0), SPH_C32(0x29794a78), + SPH_C32(0x53d28c3c), SPH_C32(0xd96605be) }, + { SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), SPH_C32(0x2714ca3c), + SPH_C32(0x88210c30), SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), + SPH_C32(0x8589d8ab), SPH_C32(0xe6c46464) }, + { SPH_C32(0x989a0100), SPH_C32(0xd6ca5b1c), SPH_C32(0x5ebdc7c5), + SPH_C32(0xebc82d48), SPH_C32(0x496e0120), SPH_C32(0xc242193c), + SPH_C32(0x05ee9956), SPH_C32(0x6782e5dc) }, + { SPH_C32(0x89260140), SPH_C32(0x242b7a70), SPH_C32(0x1171a194), + SPH_C32(0xab423635), SPH_C32(0xcf0f0100), SPH_C32(0x2ad26bec), + SPH_C32(0xd8d5785c), SPH_C32(0x94b3e0af) }, + { SPH_C32(0xd5540140), SPH_C32(0xed91b762), SPH_C32(0x68d8ac6d), + SPH_C32(0xc8ab174d), SPH_C32(0x31c50120), SPH_C32(0x628f4308), + SPH_C32(0x58b239a1), SPH_C32(0x15f56117) }, + { SPH_C32(0xbc430100), SPH_C32(0xbfbdcc3a), SPH_C32(0x7a486acb), + SPH_C32(0xfa5688fb), SPH_C32(0x82c10140), SPH_C32(0x11898792), + SPH_C32(0xeeb013f4), SPH_C32(0xb7d0daaa) }, + { SPH_C32(0xe0310100), SPH_C32(0x76070128), SPH_C32(0x03e16732), + SPH_C32(0x99bfa983), SPH_C32(0x7c0b0160), SPH_C32(0x59d4af76), + SPH_C32(0x6ed75209), SPH_C32(0x36965b12) }, + { SPH_C32(0xf18d0140), SPH_C32(0x84e62044), SPH_C32(0x4c2d0163), + SPH_C32(0xd935b2fe), SPH_C32(0xfa6a0140), SPH_C32(0xb144dda6), + SPH_C32(0xb3ecb303), SPH_C32(0xc5a75e61) }, + { SPH_C32(0xadff0140), SPH_C32(0x4d5ced56), SPH_C32(0x35840c9a), + SPH_C32(0xbadc9386), SPH_C32(0x04a00160), SPH_C32(0xf919f542), + SPH_C32(0x338bf2fe), SPH_C32(0x44e1dfd9) }, + { SPH_C32(0x9f3a0180), SPH_C32(0x5a7f8ee2), SPH_C32(0xe5d0a669), + SPH_C32(0x7b43be03), SPH_C32(0x8e020100), SPH_C32(0xc0a86233), + SPH_C32(0x54c7d1e0), SPH_C32(0x51b6d04f) }, + { SPH_C32(0xc3480180), SPH_C32(0x93c543f0), SPH_C32(0x9c79ab90), + SPH_C32(0x18aa9f7b), SPH_C32(0x70c80120), SPH_C32(0x88f54ad7), + SPH_C32(0xd4a0901d), SPH_C32(0xd0f051f7) }, + { SPH_C32(0xd2f401c0), SPH_C32(0x6124629c), SPH_C32(0xd3b5cdc1), + SPH_C32(0x58208406), SPH_C32(0xf6a90100), SPH_C32(0x60653807), + SPH_C32(0x099b7117), SPH_C32(0x23c15484) }, + { SPH_C32(0x8e8601c0), SPH_C32(0xa89eaf8e), SPH_C32(0xaa1cc038), + SPH_C32(0x3bc9a57e), SPH_C32(0x08630120), SPH_C32(0x283810e3), + SPH_C32(0x89fc30ea), SPH_C32(0xa287d53c) }, + { SPH_C32(0xe7910180), SPH_C32(0xfab2d4d6), SPH_C32(0xb88c069e), + SPH_C32(0x09343ac8), SPH_C32(0xbb670140), SPH_C32(0x5b3ed479), + SPH_C32(0x3ffe1abf), SPH_C32(0x00a26e81) }, + { SPH_C32(0xbbe30180), SPH_C32(0x330819c4), SPH_C32(0xc1250b67), + SPH_C32(0x6add1bb0), SPH_C32(0x45ad0160), SPH_C32(0x1363fc9d), + SPH_C32(0xbf995b42), SPH_C32(0x81e4ef39) }, + { SPH_C32(0xaa5f01c0), SPH_C32(0xc1e938a8), SPH_C32(0x8ee96d36), + SPH_C32(0x2a5700cd), SPH_C32(0xc3cc0140), SPH_C32(0xfbf38e4d), + SPH_C32(0x62a2ba48), SPH_C32(0x72d5ea4a) }, + { SPH_C32(0xf62d01c0), SPH_C32(0x0853f5ba), SPH_C32(0xf74060cf), + SPH_C32(0x49be21b5), SPH_C32(0x3d060160), SPH_C32(0xb3aea6a9), + SPH_C32(0xe2c5fbb5), SPH_C32(0xf3936bf2) }, + { SPH_C32(0xfd4e0100), SPH_C32(0x55c7c5e5), SPH_C32(0xf65ac377), + SPH_C32(0x3f53b81b), SPH_C32(0xd5d00180), SPH_C32(0x85a77adf), + SPH_C32(0x9603bdb5), SPH_C32(0xa2d4627c) }, + { SPH_C32(0xa13c0100), SPH_C32(0x9c7d08f7), SPH_C32(0x8ff3ce8e), + SPH_C32(0x5cba9963), SPH_C32(0x2b1a01a0), SPH_C32(0xcdfa523b), + SPH_C32(0x1664fc48), SPH_C32(0x2392e3c4) }, + { SPH_C32(0xb0800140), SPH_C32(0x6e9c299b), SPH_C32(0xc03fa8df), + SPH_C32(0x1c30821e), SPH_C32(0xad7b0180), SPH_C32(0x256a20eb), + SPH_C32(0xcb5f1d42), SPH_C32(0xd0a3e6b7) }, + { SPH_C32(0xecf20140), SPH_C32(0xa726e489), SPH_C32(0xb996a526), + SPH_C32(0x7fd9a366), SPH_C32(0x53b101a0), SPH_C32(0x6d37080f), + SPH_C32(0x4b385cbf), SPH_C32(0x51e5670f) }, + { SPH_C32(0x85e50100), SPH_C32(0xf50a9fd1), SPH_C32(0xab066380), + SPH_C32(0x4d243cd0), SPH_C32(0xe0b501c0), SPH_C32(0x1e31cc95), + SPH_C32(0xfd3a76ea), SPH_C32(0xf3c0dcb2) }, + { SPH_C32(0xd9970100), SPH_C32(0x3cb052c3), SPH_C32(0xd2af6e79), + SPH_C32(0x2ecd1da8), SPH_C32(0x1e7f01e0), SPH_C32(0x566ce471), + SPH_C32(0x7d5d3717), SPH_C32(0x72865d0a) }, + { SPH_C32(0xc82b0140), SPH_C32(0xce5173af), SPH_C32(0x9d630828), + SPH_C32(0x6e4706d5), SPH_C32(0x981e01c0), SPH_C32(0xbefc96a1), + SPH_C32(0xa066d61d), SPH_C32(0x81b75879) }, + { SPH_C32(0x94590140), SPH_C32(0x07ebbebd), SPH_C32(0xe4ca05d1), + SPH_C32(0x0dae27ad), SPH_C32(0x66d401e0), SPH_C32(0xf6a1be45), + SPH_C32(0x200197e0), SPH_C32(0x00f1d9c1) }, + { SPH_C32(0xa69c0180), SPH_C32(0x10c8dd09), SPH_C32(0x349eaf22), + SPH_C32(0xcc310a28), SPH_C32(0xec760180), SPH_C32(0xcf102934), + SPH_C32(0x474db4fe), SPH_C32(0x15a6d657) }, + { SPH_C32(0xfaee0180), SPH_C32(0xd972101b), SPH_C32(0x4d37a2db), + SPH_C32(0xafd82b50), SPH_C32(0x12bc01a0), SPH_C32(0x874d01d0), + SPH_C32(0xc72af503), SPH_C32(0x94e057ef) }, + { SPH_C32(0xeb5201c0), SPH_C32(0x2b933177), SPH_C32(0x02fbc48a), + SPH_C32(0xef52302d), SPH_C32(0x94dd0180), SPH_C32(0x6fdd7300), + SPH_C32(0x1a111409), SPH_C32(0x67d1529c) }, + { SPH_C32(0xb72001c0), SPH_C32(0xe229fc65), SPH_C32(0x7b52c973), + SPH_C32(0x8cbb1155), SPH_C32(0x6a1701a0), SPH_C32(0x27805be4), + SPH_C32(0x9a7655f4), SPH_C32(0xe697d324) }, + { SPH_C32(0xde370180), SPH_C32(0xb005873d), SPH_C32(0x69c20fd5), + SPH_C32(0xbe468ee3), SPH_C32(0xd91301c0), SPH_C32(0x54869f7e), + SPH_C32(0x2c747fa1), SPH_C32(0x44b26899) }, + { SPH_C32(0x82450180), SPH_C32(0x79bf4a2f), SPH_C32(0x106b022c), + SPH_C32(0xddafaf9b), SPH_C32(0x27d901e0), SPH_C32(0x1cdbb79a), + SPH_C32(0xac133e5c), SPH_C32(0xc5f4e921) }, + { SPH_C32(0x93f901c0), SPH_C32(0x8b5e6b43), SPH_C32(0x5fa7647d), + SPH_C32(0x9d25b4e6), SPH_C32(0xa1b801c0), SPH_C32(0xf44bc54a), + SPH_C32(0x7128df56), SPH_C32(0x36c5ec52) }, + { SPH_C32(0xcf8b01c0), SPH_C32(0x42e4a651), SPH_C32(0x260e6984), + SPH_C32(0xfecc959e), SPH_C32(0x5f7201e0), SPH_C32(0xbc16edae), + SPH_C32(0xf14f9eab), SPH_C32(0xb7836dea) } +}; + +static const sph_u32 T256_21[128][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xd0080004), SPH_C32(0x8c768f77), SPH_C32(0x9dc5b050), + SPH_C32(0xaf4a29da), SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), + SPH_C32(0x98321c3d), SPH_C32(0x76acc733) }, + { SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), SPH_C32(0x98321c3d), + SPH_C32(0x76acc733), SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), + SPH_C32(0x05f7ac6d), SPH_C32(0xd9e6eee9) }, + { SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), SPH_C32(0x05f7ac6d), + SPH_C32(0xd9e6eee9), SPH_C32(0xd0080004), SPH_C32(0x8c768f77), + SPH_C32(0x9dc5b050), SPH_C32(0xaf4a29da) }, + { SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), SPH_C32(0xfe739301), + SPH_C32(0xb8a92831), SPH_C32(0x171c0000), SPH_C32(0xb26e3344), + SPH_C32(0x9e6a837e), SPH_C32(0x58f8485f) }, + { SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), SPH_C32(0x63b62351), + SPH_C32(0x17e301eb), SPH_C32(0x7cb50000), SPH_C32(0xf285caee), + SPH_C32(0x06589f43), SPH_C32(0x2e548f6c) }, + { SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), SPH_C32(0x66418f3c), + SPH_C32(0xce05ef02), SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), + SPH_C32(0x9b9d2f13), SPH_C32(0x811ea6b6) }, + { SPH_C32(0x130f000c), SPH_C32(0xece44fa0), SPH_C32(0xfb843f6c), + SPH_C32(0x614fc6d8), SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), + SPH_C32(0x03af332e), SPH_C32(0xf7b26185) }, + { SPH_C32(0x171c0000), SPH_C32(0xb26e3344), SPH_C32(0x9e6a837e), + SPH_C32(0x58f8485f), SPH_C32(0xbfb20008), SPH_C32(0x92170a39), + SPH_C32(0x6019107f), SPH_C32(0xe051606e) }, + { SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), SPH_C32(0x03af332e), + SPH_C32(0xf7b26185), SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), + SPH_C32(0xf82b0c42), SPH_C32(0x96fda75d) }, + { SPH_C32(0x7cb50000), SPH_C32(0xf285caee), SPH_C32(0x06589f43), + SPH_C32(0x2e548f6c), SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), + SPH_C32(0x65eebc12), SPH_C32(0x39b78e87) }, + { SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), SPH_C32(0x9b9d2f13), + SPH_C32(0x811ea6b6), SPH_C32(0x6fba000c), SPH_C32(0x1e61854e), + SPH_C32(0xfddca02f), SPH_C32(0x4f1b49b4) }, + { SPH_C32(0xbfb20008), SPH_C32(0x92170a39), SPH_C32(0x6019107f), + SPH_C32(0xe051606e), SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), + SPH_C32(0xfe739301), SPH_C32(0xb8a92831) }, + { SPH_C32(0x6fba000c), SPH_C32(0x1e61854e), SPH_C32(0xfddca02f), + SPH_C32(0x4f1b49b4), SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), + SPH_C32(0x66418f3c), SPH_C32(0xce05ef02) }, + { SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), SPH_C32(0xf82b0c42), + SPH_C32(0x96fda75d), SPH_C32(0x130f000c), SPH_C32(0xece44fa0), + SPH_C32(0xfb843f6c), SPH_C32(0x614fc6d8) }, + { SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), SPH_C32(0x65eebc12), + SPH_C32(0x39b78e87), SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), + SPH_C32(0x63b62351), SPH_C32(0x17e301eb) }, + { SPH_C32(0x515c0010), SPH_C32(0x40f372fb), SPH_C32(0xfce72602), + SPH_C32(0x71575061), SPH_C32(0x2e390000), SPH_C32(0x64dd6689), + SPH_C32(0x3cd406fc), SPH_C32(0xb1f490bc) }, + { SPH_C32(0x81540014), SPH_C32(0xcc85fd8c), SPH_C32(0x61229652), + SPH_C32(0xde1d79bb), SPH_C32(0x45900000), SPH_C32(0x24369f23), + SPH_C32(0xa4e61ac1), SPH_C32(0xc758578f) }, + { SPH_C32(0x3af50010), SPH_C32(0x00188b51), SPH_C32(0x64d53a3f), + SPH_C32(0x07fb9752), SPH_C32(0x95980004), SPH_C32(0xa8401054), + SPH_C32(0x3923aa91), SPH_C32(0x68127e55) }, + { SPH_C32(0xeafd0014), SPH_C32(0x8c6e0426), SPH_C32(0xf9108a6f), + SPH_C32(0xa8b1be88), SPH_C32(0xfe310004), SPH_C32(0xe8abe9fe), + SPH_C32(0xa111b6ac), SPH_C32(0x1ebeb966) }, + { SPH_C32(0xf9f20018), SPH_C32(0x608a4b86), SPH_C32(0x0294b503), + SPH_C32(0xc9fe7850), SPH_C32(0x39250000), SPH_C32(0xd6b355cd), + SPH_C32(0xa2be8582), SPH_C32(0xe90cd8e3) }, + { SPH_C32(0x29fa001c), SPH_C32(0xecfcc4f1), SPH_C32(0x9f510553), + SPH_C32(0x66b4518a), SPH_C32(0x528c0000), SPH_C32(0x9658ac67), + SPH_C32(0x3a8c99bf), SPH_C32(0x9fa01fd0) }, + { SPH_C32(0x925b0018), SPH_C32(0x2061b22c), SPH_C32(0x9aa6a93e), + SPH_C32(0xbf52bf63), SPH_C32(0x82840004), SPH_C32(0x1a2e2310), + SPH_C32(0xa74929ef), SPH_C32(0x30ea360a) }, + { SPH_C32(0x4253001c), SPH_C32(0xac173d5b), SPH_C32(0x0763196e), + SPH_C32(0x101896b9), SPH_C32(0xe92d0004), SPH_C32(0x5ac5daba), + SPH_C32(0x3f7b35d2), SPH_C32(0x4646f139) }, + { SPH_C32(0x46400010), SPH_C32(0xf29d41bf), SPH_C32(0x628da57c), + SPH_C32(0x29af183e), SPH_C32(0x918b0008), SPH_C32(0xf6ca6cb0), + SPH_C32(0x5ccd1683), SPH_C32(0x51a5f0d2) }, + { SPH_C32(0x96480014), SPH_C32(0x7eebcec8), SPH_C32(0xff48152c), + SPH_C32(0x86e531e4), SPH_C32(0xfa220008), SPH_C32(0xb621951a), + SPH_C32(0xc4ff0abe), SPH_C32(0x270937e1) }, + { SPH_C32(0x2de90010), SPH_C32(0xb276b815), SPH_C32(0xfabfb941), + SPH_C32(0x5f03df0d), SPH_C32(0x2a2a000c), SPH_C32(0x3a571a6d), + SPH_C32(0x593abaee), SPH_C32(0x88431e3b) }, + { SPH_C32(0xfde10014), SPH_C32(0x3e003762), SPH_C32(0x677a0911), + SPH_C32(0xf049f6d7), SPH_C32(0x4183000c), SPH_C32(0x7abce3c7), + SPH_C32(0xc108a6d3), SPH_C32(0xfeefd908) }, + { SPH_C32(0xeeee0018), SPH_C32(0xd2e478c2), SPH_C32(0x9cfe367d), + SPH_C32(0x9106300f), SPH_C32(0x86970008), SPH_C32(0x44a45ff4), + SPH_C32(0xc2a795fd), SPH_C32(0x095db88d) }, + { SPH_C32(0x3ee6001c), SPH_C32(0x5e92f7b5), SPH_C32(0x013b862d), + SPH_C32(0x3e4c19d5), SPH_C32(0xed3e0008), SPH_C32(0x044fa65e), + SPH_C32(0x5a9589c0), SPH_C32(0x7ff17fbe) }, + { SPH_C32(0x85470018), SPH_C32(0x920f8168), SPH_C32(0x04cc2a40), + SPH_C32(0xe7aaf73c), SPH_C32(0x3d36000c), SPH_C32(0x88392929), + SPH_C32(0xc7503990), SPH_C32(0xd0bb5664) }, + { SPH_C32(0x554f001c), SPH_C32(0x1e790e1f), SPH_C32(0x99099a10), + SPH_C32(0x48e0dee6), SPH_C32(0x569f000c), SPH_C32(0xc8d2d083), + SPH_C32(0x5f6225ad), SPH_C32(0xa6179157) }, + { SPH_C32(0x2e390000), SPH_C32(0x64dd6689), SPH_C32(0x3cd406fc), + SPH_C32(0xb1f490bc), SPH_C32(0x7f650010), SPH_C32(0x242e1472), + SPH_C32(0xc03320fe), SPH_C32(0xc0a3c0dd) }, + { SPH_C32(0xfe310004), SPH_C32(0xe8abe9fe), SPH_C32(0xa111b6ac), + SPH_C32(0x1ebeb966), SPH_C32(0x14cc0010), SPH_C32(0x64c5edd8), + SPH_C32(0x58013cc3), SPH_C32(0xb60f07ee) }, + { SPH_C32(0x45900000), SPH_C32(0x24369f23), SPH_C32(0xa4e61ac1), + SPH_C32(0xc758578f), SPH_C32(0xc4c40014), SPH_C32(0xe8b362af), + SPH_C32(0xc5c48c93), SPH_C32(0x19452e34) }, + { SPH_C32(0x95980004), SPH_C32(0xa8401054), SPH_C32(0x3923aa91), + SPH_C32(0x68127e55), SPH_C32(0xaf6d0014), SPH_C32(0xa8589b05), + SPH_C32(0x5df690ae), SPH_C32(0x6fe9e907) }, + { SPH_C32(0x86970008), SPH_C32(0x44a45ff4), SPH_C32(0xc2a795fd), + SPH_C32(0x095db88d), SPH_C32(0x68790010), SPH_C32(0x96402736), + SPH_C32(0x5e59a380), SPH_C32(0x985b8882) }, + { SPH_C32(0x569f000c), SPH_C32(0xc8d2d083), SPH_C32(0x5f6225ad), + SPH_C32(0xa6179157), SPH_C32(0x03d00010), SPH_C32(0xd6abde9c), + SPH_C32(0xc66bbfbd), SPH_C32(0xeef74fb1) }, + { SPH_C32(0xed3e0008), SPH_C32(0x044fa65e), SPH_C32(0x5a9589c0), + SPH_C32(0x7ff17fbe), SPH_C32(0xd3d80014), SPH_C32(0x5add51eb), + SPH_C32(0x5bae0fed), SPH_C32(0x41bd666b) }, + { SPH_C32(0x3d36000c), SPH_C32(0x88392929), SPH_C32(0xc7503990), + SPH_C32(0xd0bb5664), SPH_C32(0xb8710014), SPH_C32(0x1a36a841), + SPH_C32(0xc39c13d0), SPH_C32(0x3711a158) }, + { SPH_C32(0x39250000), SPH_C32(0xd6b355cd), SPH_C32(0xa2be8582), + SPH_C32(0xe90cd8e3), SPH_C32(0xc0d70018), SPH_C32(0xb6391e4b), + SPH_C32(0xa02a3081), SPH_C32(0x20f2a0b3) }, + { SPH_C32(0xe92d0004), SPH_C32(0x5ac5daba), SPH_C32(0x3f7b35d2), + SPH_C32(0x4646f139), SPH_C32(0xab7e0018), SPH_C32(0xf6d2e7e1), + SPH_C32(0x38182cbc), SPH_C32(0x565e6780) }, + { SPH_C32(0x528c0000), SPH_C32(0x9658ac67), SPH_C32(0x3a8c99bf), + SPH_C32(0x9fa01fd0), SPH_C32(0x7b76001c), SPH_C32(0x7aa46896), + SPH_C32(0xa5dd9cec), SPH_C32(0xf9144e5a) }, + { SPH_C32(0x82840004), SPH_C32(0x1a2e2310), SPH_C32(0xa74929ef), + SPH_C32(0x30ea360a), SPH_C32(0x10df001c), SPH_C32(0x3a4f913c), + SPH_C32(0x3def80d1), SPH_C32(0x8fb88969) }, + { SPH_C32(0x918b0008), SPH_C32(0xf6ca6cb0), SPH_C32(0x5ccd1683), + SPH_C32(0x51a5f0d2), SPH_C32(0xd7cb0018), SPH_C32(0x04572d0f), + SPH_C32(0x3e40b3ff), SPH_C32(0x780ae8ec) }, + { SPH_C32(0x4183000c), SPH_C32(0x7abce3c7), SPH_C32(0xc108a6d3), + SPH_C32(0xfeefd908), SPH_C32(0xbc620018), SPH_C32(0x44bcd4a5), + SPH_C32(0xa672afc2), SPH_C32(0x0ea62fdf) }, + { SPH_C32(0xfa220008), SPH_C32(0xb621951a), SPH_C32(0xc4ff0abe), + SPH_C32(0x270937e1), SPH_C32(0x6c6a001c), SPH_C32(0xc8ca5bd2), + SPH_C32(0x3bb71f92), SPH_C32(0xa1ec0605) }, + { SPH_C32(0x2a2a000c), SPH_C32(0x3a571a6d), SPH_C32(0x593abaee), + SPH_C32(0x88431e3b), SPH_C32(0x07c3001c), SPH_C32(0x8821a278), + SPH_C32(0xa38503af), SPH_C32(0xd740c136) }, + { SPH_C32(0x7f650010), SPH_C32(0x242e1472), SPH_C32(0xc03320fe), + SPH_C32(0xc0a3c0dd), SPH_C32(0x515c0010), SPH_C32(0x40f372fb), + SPH_C32(0xfce72602), SPH_C32(0x71575061) }, + { SPH_C32(0xaf6d0014), SPH_C32(0xa8589b05), SPH_C32(0x5df690ae), + SPH_C32(0x6fe9e907), SPH_C32(0x3af50010), SPH_C32(0x00188b51), + SPH_C32(0x64d53a3f), SPH_C32(0x07fb9752) }, + { SPH_C32(0x14cc0010), SPH_C32(0x64c5edd8), SPH_C32(0x58013cc3), + SPH_C32(0xb60f07ee), SPH_C32(0xeafd0014), SPH_C32(0x8c6e0426), + SPH_C32(0xf9108a6f), SPH_C32(0xa8b1be88) }, + { SPH_C32(0xc4c40014), SPH_C32(0xe8b362af), SPH_C32(0xc5c48c93), + SPH_C32(0x19452e34), SPH_C32(0x81540014), SPH_C32(0xcc85fd8c), + SPH_C32(0x61229652), SPH_C32(0xde1d79bb) }, + { SPH_C32(0xd7cb0018), SPH_C32(0x04572d0f), SPH_C32(0x3e40b3ff), + SPH_C32(0x780ae8ec), SPH_C32(0x46400010), SPH_C32(0xf29d41bf), + SPH_C32(0x628da57c), SPH_C32(0x29af183e) }, + { SPH_C32(0x07c3001c), SPH_C32(0x8821a278), SPH_C32(0xa38503af), + SPH_C32(0xd740c136), SPH_C32(0x2de90010), SPH_C32(0xb276b815), + SPH_C32(0xfabfb941), SPH_C32(0x5f03df0d) }, + { SPH_C32(0xbc620018), SPH_C32(0x44bcd4a5), SPH_C32(0xa672afc2), + SPH_C32(0x0ea62fdf), SPH_C32(0xfde10014), SPH_C32(0x3e003762), + SPH_C32(0x677a0911), SPH_C32(0xf049f6d7) }, + { SPH_C32(0x6c6a001c), SPH_C32(0xc8ca5bd2), SPH_C32(0x3bb71f92), + SPH_C32(0xa1ec0605), SPH_C32(0x96480014), SPH_C32(0x7eebcec8), + SPH_C32(0xff48152c), SPH_C32(0x86e531e4) }, + { SPH_C32(0x68790010), SPH_C32(0x96402736), SPH_C32(0x5e59a380), + SPH_C32(0x985b8882), SPH_C32(0xeeee0018), SPH_C32(0xd2e478c2), + SPH_C32(0x9cfe367d), SPH_C32(0x9106300f) }, + { SPH_C32(0xb8710014), SPH_C32(0x1a36a841), SPH_C32(0xc39c13d0), + SPH_C32(0x3711a158), SPH_C32(0x85470018), SPH_C32(0x920f8168), + SPH_C32(0x04cc2a40), SPH_C32(0xe7aaf73c) }, + { SPH_C32(0x03d00010), SPH_C32(0xd6abde9c), SPH_C32(0xc66bbfbd), + SPH_C32(0xeef74fb1), SPH_C32(0x554f001c), SPH_C32(0x1e790e1f), + SPH_C32(0x99099a10), SPH_C32(0x48e0dee6) }, + { SPH_C32(0xd3d80014), SPH_C32(0x5add51eb), SPH_C32(0x5bae0fed), + SPH_C32(0x41bd666b), SPH_C32(0x3ee6001c), SPH_C32(0x5e92f7b5), + SPH_C32(0x013b862d), SPH_C32(0x3e4c19d5) }, + { SPH_C32(0xc0d70018), SPH_C32(0xb6391e4b), SPH_C32(0xa02a3081), + SPH_C32(0x20f2a0b3), SPH_C32(0xf9f20018), SPH_C32(0x608a4b86), + SPH_C32(0x0294b503), SPH_C32(0xc9fe7850) }, + { SPH_C32(0x10df001c), SPH_C32(0x3a4f913c), SPH_C32(0x3def80d1), + SPH_C32(0x8fb88969), SPH_C32(0x925b0018), SPH_C32(0x2061b22c), + SPH_C32(0x9aa6a93e), SPH_C32(0xbf52bf63) }, + { SPH_C32(0xab7e0018), SPH_C32(0xf6d2e7e1), SPH_C32(0x38182cbc), + SPH_C32(0x565e6780), SPH_C32(0x4253001c), SPH_C32(0xac173d5b), + SPH_C32(0x0763196e), SPH_C32(0x101896b9) }, + { SPH_C32(0x7b76001c), SPH_C32(0x7aa46896), SPH_C32(0xa5dd9cec), + SPH_C32(0xf9144e5a), SPH_C32(0x29fa001c), SPH_C32(0xecfcc4f1), + SPH_C32(0x9f510553), SPH_C32(0x66b4518a) }, + { SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), SPH_C32(0xf9ce4c04), + SPH_C32(0xe2afa0c0), SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), + SPH_C32(0x79a90df9), SPH_C32(0x63e92178) }, + { SPH_C32(0x72b00024), SPH_C32(0x0d916a81), SPH_C32(0x640bfc54), + SPH_C32(0x4de5891a), SPH_C32(0x37db0000), SPH_C32(0x895134b8), + SPH_C32(0xe19b11c4), SPH_C32(0x1545e64b) }, + { SPH_C32(0xc9110020), SPH_C32(0xc10c1c5c), SPH_C32(0x61fc5039), + SPH_C32(0x940367f3), SPH_C32(0xe7d30004), SPH_C32(0x0527bbcf), + SPH_C32(0x7c5ea194), SPH_C32(0xba0fcf91) }, + { SPH_C32(0x19190024), SPH_C32(0x4d7a932b), SPH_C32(0xfc39e069), + SPH_C32(0x3b494e29), SPH_C32(0x8c7a0004), SPH_C32(0x45cc4265), + SPH_C32(0xe46cbda9), SPH_C32(0xcca308a2) }, + { SPH_C32(0x0a160028), SPH_C32(0xa19edc8b), SPH_C32(0x07bddf05), + SPH_C32(0x5a0688f1), SPH_C32(0x4b6e0000), SPH_C32(0x7bd4fe56), + SPH_C32(0xe7c38e87), SPH_C32(0x3b116927) }, + { SPH_C32(0xda1e002c), SPH_C32(0x2de853fc), SPH_C32(0x9a786f55), + SPH_C32(0xf54ca12b), SPH_C32(0x20c70000), SPH_C32(0x3b3f07fc), + SPH_C32(0x7ff192ba), SPH_C32(0x4dbdae14) }, + { SPH_C32(0x61bf0028), SPH_C32(0xe1752521), SPH_C32(0x9f8fc338), + SPH_C32(0x2caa4fc2), SPH_C32(0xf0cf0004), SPH_C32(0xb749888b), + SPH_C32(0xe23422ea), SPH_C32(0xe2f787ce) }, + { SPH_C32(0xb1b7002c), SPH_C32(0x6d03aa56), SPH_C32(0x024a7368), + SPH_C32(0x83e06618), SPH_C32(0x9b660004), SPH_C32(0xf7a27121), + SPH_C32(0x7a063ed7), SPH_C32(0x945b40fd) }, + { SPH_C32(0xb5a40020), SPH_C32(0x3389d6b2), SPH_C32(0x67a4cf7a), + SPH_C32(0xba57e89f), SPH_C32(0xe3c00008), SPH_C32(0x5badc72b), + SPH_C32(0x19b01d86), SPH_C32(0x83b84116) }, + { SPH_C32(0x65ac0024), SPH_C32(0xbfff59c5), SPH_C32(0xfa617f2a), + SPH_C32(0x151dc145), SPH_C32(0x88690008), SPH_C32(0x1b463e81), + SPH_C32(0x818201bb), SPH_C32(0xf5148625) }, + { SPH_C32(0xde0d0020), SPH_C32(0x73622f18), SPH_C32(0xff96d347), + SPH_C32(0xccfb2fac), SPH_C32(0x5861000c), SPH_C32(0x9730b1f6), + SPH_C32(0x1c47b1eb), SPH_C32(0x5a5eafff) }, + { SPH_C32(0x0e050024), SPH_C32(0xff14a06f), SPH_C32(0x62536317), + SPH_C32(0x63b10676), SPH_C32(0x33c8000c), SPH_C32(0xd7db485c), + SPH_C32(0x8475add6), SPH_C32(0x2cf268cc) }, + { SPH_C32(0x1d0a0028), SPH_C32(0x13f0efcf), SPH_C32(0x99d75c7b), + SPH_C32(0x02fec0ae), SPH_C32(0xf4dc0008), SPH_C32(0xe9c3f46f), + SPH_C32(0x87da9ef8), SPH_C32(0xdb400949) }, + { SPH_C32(0xcd02002c), SPH_C32(0x9f8660b8), SPH_C32(0x0412ec2b), + SPH_C32(0xadb4e974), SPH_C32(0x9f750008), SPH_C32(0xa9280dc5), + SPH_C32(0x1fe882c5), SPH_C32(0xadecce7a) }, + { SPH_C32(0x76a30028), SPH_C32(0x531b1665), SPH_C32(0x01e54046), + SPH_C32(0x7452079d), SPH_C32(0x4f7d000c), SPH_C32(0x255e82b2), + SPH_C32(0x822d3295), SPH_C32(0x02a6e7a0) }, + { SPH_C32(0xa6ab002c), SPH_C32(0xdf6d9912), SPH_C32(0x9c20f016), + SPH_C32(0xdb182e47), SPH_C32(0x24d4000c), SPH_C32(0x65b57b18), + SPH_C32(0x1a1f2ea8), SPH_C32(0x740a2093) }, + { SPH_C32(0xf3e40030), SPH_C32(0xc114970d), SPH_C32(0x05296a06), + SPH_C32(0x93f8f0a1), SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), + SPH_C32(0x457d0b05), SPH_C32(0xd21db1c4) }, + { SPH_C32(0x23ec0034), SPH_C32(0x4d62187a), SPH_C32(0x98ecda56), + SPH_C32(0x3cb2d97b), SPH_C32(0x19e20000), SPH_C32(0xed8c5231), + SPH_C32(0xdd4f1738), SPH_C32(0xa4b176f7) }, + { SPH_C32(0x984d0030), SPH_C32(0x81ff6ea7), SPH_C32(0x9d1b763b), + SPH_C32(0xe5543792), SPH_C32(0xc9ea0004), SPH_C32(0x61fadd46), + SPH_C32(0x408aa768), SPH_C32(0x0bfb5f2d) }, + { SPH_C32(0x48450034), SPH_C32(0x0d89e1d0), SPH_C32(0x00dec66b), + SPH_C32(0x4a1e1e48), SPH_C32(0xa2430004), SPH_C32(0x211124ec), + SPH_C32(0xd8b8bb55), SPH_C32(0x7d57981e) }, + { SPH_C32(0x5b4a0038), SPH_C32(0xe16dae70), SPH_C32(0xfb5af907), + SPH_C32(0x2b51d890), SPH_C32(0x65570000), SPH_C32(0x1f0998df), + SPH_C32(0xdb17887b), SPH_C32(0x8ae5f99b) }, + { SPH_C32(0x8b42003c), SPH_C32(0x6d1b2107), SPH_C32(0x669f4957), + SPH_C32(0x841bf14a), SPH_C32(0x0efe0000), SPH_C32(0x5fe26175), + SPH_C32(0x43259446), SPH_C32(0xfc493ea8) }, + { SPH_C32(0x30e30038), SPH_C32(0xa18657da), SPH_C32(0x6368e53a), + SPH_C32(0x5dfd1fa3), SPH_C32(0xdef60004), SPH_C32(0xd394ee02), + SPH_C32(0xdee02416), SPH_C32(0x53031772) }, + { SPH_C32(0xe0eb003c), SPH_C32(0x2df0d8ad), SPH_C32(0xfead556a), + SPH_C32(0xf2b73679), SPH_C32(0xb55f0004), SPH_C32(0x937f17a8), + SPH_C32(0x46d2382b), SPH_C32(0x25afd041) }, + { SPH_C32(0xe4f80030), SPH_C32(0x737aa449), SPH_C32(0x9b43e978), + SPH_C32(0xcb00b8fe), SPH_C32(0xcdf90008), SPH_C32(0x3f70a1a2), + SPH_C32(0x25641b7a), SPH_C32(0x324cd1aa) }, + { SPH_C32(0x34f00034), SPH_C32(0xff0c2b3e), SPH_C32(0x06865928), + SPH_C32(0x644a9124), SPH_C32(0xa6500008), SPH_C32(0x7f9b5808), + SPH_C32(0xbd560747), SPH_C32(0x44e01699) }, + { SPH_C32(0x8f510030), SPH_C32(0x33915de3), SPH_C32(0x0371f545), + SPH_C32(0xbdac7fcd), SPH_C32(0x7658000c), SPH_C32(0xf3edd77f), + SPH_C32(0x2093b717), SPH_C32(0xebaa3f43) }, + { SPH_C32(0x5f590034), SPH_C32(0xbfe7d294), SPH_C32(0x9eb44515), + SPH_C32(0x12e65617), SPH_C32(0x1df1000c), SPH_C32(0xb3062ed5), + SPH_C32(0xb8a1ab2a), SPH_C32(0x9d06f870) }, + { SPH_C32(0x4c560038), SPH_C32(0x53039d34), SPH_C32(0x65307a79), + SPH_C32(0x73a990cf), SPH_C32(0xdae50008), SPH_C32(0x8d1e92e6), + SPH_C32(0xbb0e9804), SPH_C32(0x6ab499f5) }, + { SPH_C32(0x9c5e003c), SPH_C32(0xdf751243), SPH_C32(0xf8f5ca29), + SPH_C32(0xdce3b915), SPH_C32(0xb14c0008), SPH_C32(0xcdf56b4c), + SPH_C32(0x233c8439), SPH_C32(0x1c185ec6) }, + { SPH_C32(0x27ff0038), SPH_C32(0x13e8649e), SPH_C32(0xfd026644), + SPH_C32(0x050557fc), SPH_C32(0x6144000c), SPH_C32(0x4183e43b), + SPH_C32(0xbef93469), SPH_C32(0xb352771c) }, + { SPH_C32(0xf7f7003c), SPH_C32(0x9f9eebe9), SPH_C32(0x60c7d614), + SPH_C32(0xaa4f7e26), SPH_C32(0x0aed000c), SPH_C32(0x01681d91), + SPH_C32(0x26cb2854), SPH_C32(0xc5feb02f) }, + { SPH_C32(0x8c810020), SPH_C32(0xe53a837f), SPH_C32(0xc51a4af8), + SPH_C32(0x535b307c), SPH_C32(0x23170010), SPH_C32(0xed94d960), + SPH_C32(0xb99a2d07), SPH_C32(0xa34ae1a5) }, + { SPH_C32(0x5c890024), SPH_C32(0x694c0c08), SPH_C32(0x58dffaa8), + SPH_C32(0xfc1119a6), SPH_C32(0x48be0010), SPH_C32(0xad7f20ca), + SPH_C32(0x21a8313a), SPH_C32(0xd5e62696) }, + { SPH_C32(0xe7280020), SPH_C32(0xa5d17ad5), SPH_C32(0x5d2856c5), + SPH_C32(0x25f7f74f), SPH_C32(0x98b60014), SPH_C32(0x2109afbd), + SPH_C32(0xbc6d816a), SPH_C32(0x7aac0f4c) }, + { SPH_C32(0x37200024), SPH_C32(0x29a7f5a2), SPH_C32(0xc0ede695), + SPH_C32(0x8abdde95), SPH_C32(0xf31f0014), SPH_C32(0x61e25617), + SPH_C32(0x245f9d57), SPH_C32(0x0c00c87f) }, + { SPH_C32(0x242f0028), SPH_C32(0xc543ba02), SPH_C32(0x3b69d9f9), + SPH_C32(0xebf2184d), SPH_C32(0x340b0010), SPH_C32(0x5ffaea24), + SPH_C32(0x27f0ae79), SPH_C32(0xfbb2a9fa) }, + { SPH_C32(0xf427002c), SPH_C32(0x49353575), SPH_C32(0xa6ac69a9), + SPH_C32(0x44b83197), SPH_C32(0x5fa20010), SPH_C32(0x1f11138e), + SPH_C32(0xbfc2b244), SPH_C32(0x8d1e6ec9) }, + { SPH_C32(0x4f860028), SPH_C32(0x85a843a8), SPH_C32(0xa35bc5c4), + SPH_C32(0x9d5edf7e), SPH_C32(0x8faa0014), SPH_C32(0x93679cf9), + SPH_C32(0x22070214), SPH_C32(0x22544713) }, + { SPH_C32(0x9f8e002c), SPH_C32(0x09deccdf), SPH_C32(0x3e9e7594), + SPH_C32(0x3214f6a4), SPH_C32(0xe4030014), SPH_C32(0xd38c6553), + SPH_C32(0xba351e29), SPH_C32(0x54f88020) }, + { SPH_C32(0x9b9d0020), SPH_C32(0x5754b03b), SPH_C32(0x5b70c986), + SPH_C32(0x0ba37823), SPH_C32(0x9ca50018), SPH_C32(0x7f83d359), + SPH_C32(0xd9833d78), SPH_C32(0x431b81cb) }, + { SPH_C32(0x4b950024), SPH_C32(0xdb223f4c), SPH_C32(0xc6b579d6), + SPH_C32(0xa4e951f9), SPH_C32(0xf70c0018), SPH_C32(0x3f682af3), + SPH_C32(0x41b12145), SPH_C32(0x35b746f8) }, + { SPH_C32(0xf0340020), SPH_C32(0x17bf4991), SPH_C32(0xc342d5bb), + SPH_C32(0x7d0fbf10), SPH_C32(0x2704001c), SPH_C32(0xb31ea584), + SPH_C32(0xdc749115), SPH_C32(0x9afd6f22) }, + { SPH_C32(0x203c0024), SPH_C32(0x9bc9c6e6), SPH_C32(0x5e8765eb), + SPH_C32(0xd24596ca), SPH_C32(0x4cad001c), SPH_C32(0xf3f55c2e), + SPH_C32(0x44468d28), SPH_C32(0xec51a811) }, + { SPH_C32(0x33330028), SPH_C32(0x772d8946), SPH_C32(0xa5035a87), + SPH_C32(0xb30a5012), SPH_C32(0x8bb90018), SPH_C32(0xcdede01d), + SPH_C32(0x47e9be06), SPH_C32(0x1be3c994) }, + { SPH_C32(0xe33b002c), SPH_C32(0xfb5b0631), SPH_C32(0x38c6ead7), + SPH_C32(0x1c4079c8), SPH_C32(0xe0100018), SPH_C32(0x8d0619b7), + SPH_C32(0xdfdba23b), SPH_C32(0x6d4f0ea7) }, + { SPH_C32(0x589a0028), SPH_C32(0x37c670ec), SPH_C32(0x3d3146ba), + SPH_C32(0xc5a69721), SPH_C32(0x3018001c), SPH_C32(0x017096c0), + SPH_C32(0x421e126b), SPH_C32(0xc205277d) }, + { SPH_C32(0x8892002c), SPH_C32(0xbbb0ff9b), SPH_C32(0xa0f4f6ea), + SPH_C32(0x6aecbefb), SPH_C32(0x5bb1001c), SPH_C32(0x419b6f6a), + SPH_C32(0xda2c0e56), SPH_C32(0xb4a9e04e) }, + { SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), SPH_C32(0x39fd6cfa), + SPH_C32(0x220c601d), SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), + SPH_C32(0x854e2bfb), SPH_C32(0x12be7119) }, + { SPH_C32(0x0dd50034), SPH_C32(0x29bf7ef3), SPH_C32(0xa438dcaa), + SPH_C32(0x8d4649c7), SPH_C32(0x66870010), SPH_C32(0xc9a24643), + SPH_C32(0x1d7c37c6), SPH_C32(0x6412b62a) }, + { SPH_C32(0xb6740030), SPH_C32(0xe522082e), SPH_C32(0xa1cf70c7), + SPH_C32(0x54a0a72e), SPH_C32(0xb68f0014), SPH_C32(0x45d4c934), + SPH_C32(0x80b98796), SPH_C32(0xcb589ff0) }, + { SPH_C32(0x667c0034), SPH_C32(0x69548759), SPH_C32(0x3c0ac097), + SPH_C32(0xfbea8ef4), SPH_C32(0xdd260014), SPH_C32(0x053f309e), + SPH_C32(0x188b9bab), SPH_C32(0xbdf458c3) }, + { SPH_C32(0x75730038), SPH_C32(0x85b0c8f9), SPH_C32(0xc78efffb), + SPH_C32(0x9aa5482c), SPH_C32(0x1a320010), SPH_C32(0x3b278cad), + SPH_C32(0x1b24a885), SPH_C32(0x4a463946) }, + { SPH_C32(0xa57b003c), SPH_C32(0x09c6478e), SPH_C32(0x5a4b4fab), + SPH_C32(0x35ef61f6), SPH_C32(0x719b0010), SPH_C32(0x7bcc7507), + SPH_C32(0x8316b4b8), SPH_C32(0x3ceafe75) }, + { SPH_C32(0x1eda0038), SPH_C32(0xc55b3153), SPH_C32(0x5fbce3c6), + SPH_C32(0xec098f1f), SPH_C32(0xa1930014), SPH_C32(0xf7bafa70), + SPH_C32(0x1ed304e8), SPH_C32(0x93a0d7af) }, + { SPH_C32(0xced2003c), SPH_C32(0x492dbe24), SPH_C32(0xc2795396), + SPH_C32(0x4343a6c5), SPH_C32(0xca3a0014), SPH_C32(0xb75103da), + SPH_C32(0x86e118d5), SPH_C32(0xe50c109c) }, + { SPH_C32(0xcac10030), SPH_C32(0x17a7c2c0), SPH_C32(0xa797ef84), + SPH_C32(0x7af42842), SPH_C32(0xb29c0018), SPH_C32(0x1b5eb5d0), + SPH_C32(0xe5573b84), SPH_C32(0xf2ef1177) }, + { SPH_C32(0x1ac90034), SPH_C32(0x9bd14db7), SPH_C32(0x3a525fd4), + SPH_C32(0xd5be0198), SPH_C32(0xd9350018), SPH_C32(0x5bb54c7a), + SPH_C32(0x7d6527b9), SPH_C32(0x8443d644) }, + { SPH_C32(0xa1680030), SPH_C32(0x574c3b6a), SPH_C32(0x3fa5f3b9), + SPH_C32(0x0c58ef71), SPH_C32(0x093d001c), SPH_C32(0xd7c3c30d), + SPH_C32(0xe0a097e9), SPH_C32(0x2b09ff9e) }, + { SPH_C32(0x71600034), SPH_C32(0xdb3ab41d), SPH_C32(0xa26043e9), + SPH_C32(0xa312c6ab), SPH_C32(0x6294001c), SPH_C32(0x97283aa7), + SPH_C32(0x78928bd4), SPH_C32(0x5da538ad) }, + { SPH_C32(0x626f0038), SPH_C32(0x37defbbd), SPH_C32(0x59e47c85), + SPH_C32(0xc25d0073), SPH_C32(0xa5800018), SPH_C32(0xa9308694), + SPH_C32(0x7b3db8fa), SPH_C32(0xaa175928) }, + { SPH_C32(0xb267003c), SPH_C32(0xbba874ca), SPH_C32(0xc421ccd5), + SPH_C32(0x6d1729a9), SPH_C32(0xce290018), SPH_C32(0xe9db7f3e), + SPH_C32(0xe30fa4c7), SPH_C32(0xdcbb9e1b) }, + { SPH_C32(0x09c60038), SPH_C32(0x77350217), SPH_C32(0xc1d660b8), + SPH_C32(0xb4f1c740), SPH_C32(0x1e21001c), SPH_C32(0x65adf049), + SPH_C32(0x7eca1497), SPH_C32(0x73f1b7c1) }, + { SPH_C32(0xd9ce003c), SPH_C32(0xfb438d60), SPH_C32(0x5c13d0e8), + SPH_C32(0x1bbbee9a), SPH_C32(0x7588001c), SPH_C32(0x254609e3), + SPH_C32(0xe6f808aa), SPH_C32(0x055d70f2) } +}; + +static const sph_u32 T256_28[16][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), SPH_C32(0xae0ebb05), + SPH_C32(0xb5a4c63b), SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), + SPH_C32(0x6bf648a4), SPH_C32(0x539cbdbf) }, + { SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), SPH_C32(0x6bf648a4), + SPH_C32(0x539cbdbf), SPH_C32(0x08bf0001), SPH_C32(0x38942792), + SPH_C32(0xc5f8f3a1), SPH_C32(0xe6387b84) }, + { SPH_C32(0x08bf0001), SPH_C32(0x38942792), SPH_C32(0xc5f8f3a1), + SPH_C32(0xe6387b84), SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), + SPH_C32(0xae0ebb05), SPH_C32(0xb5a4c63b) }, + { SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), SPH_C32(0x99e585aa), + SPH_C32(0x8d75f7f1), SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), + SPH_C32(0x79e22a4c), SPH_C32(0x1298bd46) }, + { SPH_C32(0x486d0003), SPH_C32(0x6c5e67a3), SPH_C32(0x37eb3eaf), + SPH_C32(0x38d131ca), SPH_C32(0x995d0000), SPH_C32(0x2ecee896), + SPH_C32(0x121462e8), SPH_C32(0x410400f9) }, + { SPH_C32(0x40d20002), SPH_C32(0x54ca4031), SPH_C32(0xf213cd0e), + SPH_C32(0xdee94a4e), SPH_C32(0x59130001), SPH_C32(0x1d772886), + SPH_C32(0xbc1ad9ed), SPH_C32(0xf4a0c6c2) }, + { SPH_C32(0x809c0003), SPH_C32(0x67738021), SPH_C32(0x5c1d760b), + SPH_C32(0x6b4d8c75), SPH_C32(0x91e20001), SPH_C32(0x165acf04), + SPH_C32(0xd7ec9149), SPH_C32(0xa73c7b7d) }, + { SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), SPH_C32(0x79e22a4c), + SPH_C32(0x1298bd46), SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), + SPH_C32(0xe007afe6), SPH_C32(0x9fed4ab7) }, + { SPH_C32(0x91e20001), SPH_C32(0x165acf04), SPH_C32(0xd7ec9149), + SPH_C32(0xa73c7b7d), SPH_C32(0x117e0002), SPH_C32(0x71294f25), + SPH_C32(0x8bf1e742), SPH_C32(0xcc71f708) }, + { SPH_C32(0x995d0000), SPH_C32(0x2ecee896), SPH_C32(0x121462e8), + SPH_C32(0x410400f9), SPH_C32(0xd1300003), SPH_C32(0x42908f35), + SPH_C32(0x25ff5c47), SPH_C32(0x79d53133) }, + { SPH_C32(0x59130001), SPH_C32(0x1d772886), SPH_C32(0xbc1ad9ed), + SPH_C32(0xf4a0c6c2), SPH_C32(0x19c10003), SPH_C32(0x49bd68b7), + SPH_C32(0x4e0914e3), SPH_C32(0x2a498c8c) }, + { SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), SPH_C32(0xe007afe6), + SPH_C32(0x9fed4ab7), SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), + SPH_C32(0x99e585aa), SPH_C32(0x8d75f7f1) }, + { SPH_C32(0x19c10003), SPH_C32(0x49bd68b7), SPH_C32(0x4e0914e3), + SPH_C32(0x2a498c8c), SPH_C32(0x40d20002), SPH_C32(0x54ca4031), + SPH_C32(0xf213cd0e), SPH_C32(0xdee94a4e) }, + { SPH_C32(0x117e0002), SPH_C32(0x71294f25), SPH_C32(0x8bf1e742), + SPH_C32(0xcc71f708), SPH_C32(0x809c0003), SPH_C32(0x67738021), + SPH_C32(0x5c1d760b), SPH_C32(0x6b4d8c75) }, + { SPH_C32(0xd1300003), SPH_C32(0x42908f35), SPH_C32(0x25ff5c47), + SPH_C32(0x79d53133), SPH_C32(0x486d0003), SPH_C32(0x6c5e67a3), + SPH_C32(0x37eb3eaf), SPH_C32(0x38d131ca) } +}; + +#define INPUT_SMALL do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T256_0[acc >> 1][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + acc = (acc << 8) | buf[1]; \ + rp = &T256_7[(acc >> 2) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = (acc << 8) | buf[2]; \ + rp = &T256_14[(acc >> 3) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = (acc << 8) | buf[3]; \ + rp = &T256_21[(acc >> 4) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + rp = &T256_28[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_SMALL == 8 + +static const sph_u32 T256_0[256][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x74951000), SPH_C32(0x5a2b467e), SPH_C32(0x88fd1d2b), + SPH_C32(0x1ee68292), SPH_C32(0xcba90000), SPH_C32(0x90273769), + SPH_C32(0xbbdcf407), SPH_C32(0xd0f4af61) }, + { SPH_C32(0xcba90000), SPH_C32(0x90273769), SPH_C32(0xbbdcf407), + SPH_C32(0xd0f4af61), SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), + SPH_C32(0x3321e92c), SPH_C32(0xce122df3) }, + { SPH_C32(0xbf3c1000), SPH_C32(0xca0c7117), SPH_C32(0x3321e92c), + SPH_C32(0xce122df3), SPH_C32(0x74951000), SPH_C32(0x5a2b467e), + SPH_C32(0x88fd1d2b), SPH_C32(0x1ee68292) }, + { SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), SPH_C32(0x11fa3a57), + SPH_C32(0x3dc90524), SPH_C32(0x97530000), SPH_C32(0x204f6ed3), + SPH_C32(0x77b9e80f), SPH_C32(0xa1ec5ec1) }, + { SPH_C32(0x9dbf3000), SPH_C32(0xee7cca82), SPH_C32(0x9907277c), + SPH_C32(0x232f87b6), SPH_C32(0x5cfa0000), SPH_C32(0xb06859ba), + SPH_C32(0xcc651c08), SPH_C32(0x7118f1a0) }, + { SPH_C32(0x22832000), SPH_C32(0x2470bb95), SPH_C32(0xaa26ce50), + SPH_C32(0xed3daa45), SPH_C32(0x286f1000), SPH_C32(0xea431fc4), + SPH_C32(0x44980123), SPH_C32(0x6ffe7332) }, + { SPH_C32(0x56163000), SPH_C32(0x7e5bfdeb), SPH_C32(0x22dbd37b), + SPH_C32(0xf3db28d7), SPH_C32(0xe3c61000), SPH_C32(0x7a6428ad), + SPH_C32(0xff44f524), SPH_C32(0xbf0adc53) }, + { SPH_C32(0x97530000), SPH_C32(0x204f6ed3), SPH_C32(0x77b9e80f), + SPH_C32(0xa1ec5ec1), SPH_C32(0x7e792000), SPH_C32(0x9418e22f), + SPH_C32(0x6643d258), SPH_C32(0x9c255be5) }, + { SPH_C32(0xe3c61000), SPH_C32(0x7a6428ad), SPH_C32(0xff44f524), + SPH_C32(0xbf0adc53), SPH_C32(0xb5d02000), SPH_C32(0x043fd546), + SPH_C32(0xdd9f265f), SPH_C32(0x4cd1f484) }, + { SPH_C32(0x5cfa0000), SPH_C32(0xb06859ba), SPH_C32(0xcc651c08), + SPH_C32(0x7118f1a0), SPH_C32(0xc1453000), SPH_C32(0x5e149338), + SPH_C32(0x55623b74), SPH_C32(0x52377616) }, + { SPH_C32(0x286f1000), SPH_C32(0xea431fc4), SPH_C32(0x44980123), + SPH_C32(0x6ffe7332), SPH_C32(0x0aec3000), SPH_C32(0xce33a451), + SPH_C32(0xeebecf73), SPH_C32(0x82c3d977) }, + { SPH_C32(0x7e792000), SPH_C32(0x9418e22f), SPH_C32(0x6643d258), + SPH_C32(0x9c255be5), SPH_C32(0xe92a2000), SPH_C32(0xb4578cfc), + SPH_C32(0x11fa3a57), SPH_C32(0x3dc90524) }, + { SPH_C32(0x0aec3000), SPH_C32(0xce33a451), SPH_C32(0xeebecf73), + SPH_C32(0x82c3d977), SPH_C32(0x22832000), SPH_C32(0x2470bb95), + SPH_C32(0xaa26ce50), SPH_C32(0xed3daa45) }, + { SPH_C32(0xb5d02000), SPH_C32(0x043fd546), SPH_C32(0xdd9f265f), + SPH_C32(0x4cd1f484), SPH_C32(0x56163000), SPH_C32(0x7e5bfdeb), + SPH_C32(0x22dbd37b), SPH_C32(0xf3db28d7) }, + { SPH_C32(0xc1453000), SPH_C32(0x5e149338), SPH_C32(0x55623b74), + SPH_C32(0x52377616), SPH_C32(0x9dbf3000), SPH_C32(0xee7cca82), + SPH_C32(0x9907277c), SPH_C32(0x232f87b6) }, + { SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), SPH_C32(0x8dfacfab), + SPH_C32(0xce36cc72), SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), + SPH_C32(0x848598ba), SPH_C32(0x1041003e) }, + { SPH_C32(0x668e5000), SPH_C32(0x013c9f96), SPH_C32(0x0507d280), + SPH_C32(0xd0d04ee0), SPH_C32(0x2dfe0000), SPH_C32(0xdb940d4c), + SPH_C32(0x3f596cbd), SPH_C32(0xc0b5af5f) }, + { SPH_C32(0xd9b24000), SPH_C32(0xcb30ee81), SPH_C32(0x36263bac), + SPH_C32(0x1ec26313), SPH_C32(0x596b1000), SPH_C32(0x81bf4b32), + SPH_C32(0xb7a47196), SPH_C32(0xde532dcd) }, + { SPH_C32(0xad275000), SPH_C32(0x911ba8ff), SPH_C32(0xbedb2687), + SPH_C32(0x0024e181), SPH_C32(0x92c21000), SPH_C32(0x11987c5b), + SPH_C32(0x0c788591), SPH_C32(0x0ea782ac) }, + { SPH_C32(0xfb316000), SPH_C32(0xef405514), SPH_C32(0x9c00f5fc), + SPH_C32(0xf3ffc956), SPH_C32(0x71040000), SPH_C32(0x6bfc54f6), + SPH_C32(0xf33c70b5), SPH_C32(0xb1ad5eff) }, + { SPH_C32(0x8fa47000), SPH_C32(0xb56b136a), SPH_C32(0x14fde8d7), + SPH_C32(0xed194bc4), SPH_C32(0xbaad0000), SPH_C32(0xfbdb639f), + SPH_C32(0x48e084b2), SPH_C32(0x6159f19e) }, + { SPH_C32(0x30986000), SPH_C32(0x7f67627d), SPH_C32(0x27dc01fb), + SPH_C32(0x230b6637), SPH_C32(0xce381000), SPH_C32(0xa1f025e1), + SPH_C32(0xc01d9999), SPH_C32(0x7fbf730c) }, + { SPH_C32(0x440d7000), SPH_C32(0x254c2403), SPH_C32(0xaf211cd0), + SPH_C32(0x3dede4a5), SPH_C32(0x05911000), SPH_C32(0x31d71288), + SPH_C32(0x7bc16d9e), SPH_C32(0xaf4bdc6d) }, + { SPH_C32(0x85484000), SPH_C32(0x7b58b73b), SPH_C32(0xfa4327a4), + SPH_C32(0x6fda92b3), SPH_C32(0x982e2000), SPH_C32(0xdfabd80a), + SPH_C32(0xe2c64ae2), SPH_C32(0x8c645bdb) }, + { SPH_C32(0xf1dd5000), SPH_C32(0x2173f145), SPH_C32(0x72be3a8f), + SPH_C32(0x713c1021), SPH_C32(0x53872000), SPH_C32(0x4f8cef63), + SPH_C32(0x591abee5), SPH_C32(0x5c90f4ba) }, + { SPH_C32(0x4ee14000), SPH_C32(0xeb7f8052), SPH_C32(0x419fd3a3), + SPH_C32(0xbf2e3dd2), SPH_C32(0x27123000), SPH_C32(0x15a7a91d), + SPH_C32(0xd1e7a3ce), SPH_C32(0x42767628) }, + { SPH_C32(0x3a745000), SPH_C32(0xb154c62c), SPH_C32(0xc962ce88), + SPH_C32(0xa1c8bf40), SPH_C32(0xecbb3000), SPH_C32(0x85809e74), + SPH_C32(0x6a3b57c9), SPH_C32(0x9282d949) }, + { SPH_C32(0x6c626000), SPH_C32(0xcf0f3bc7), SPH_C32(0xebb91df3), + SPH_C32(0x52139797), SPH_C32(0x0f7d2000), SPH_C32(0xffe4b6d9), + SPH_C32(0x957fa2ed), SPH_C32(0x2d88051a) }, + { SPH_C32(0x18f77000), SPH_C32(0x95247db9), SPH_C32(0x634400d8), + SPH_C32(0x4cf51505), SPH_C32(0xc4d42000), SPH_C32(0x6fc381b0), + SPH_C32(0x2ea356ea), SPH_C32(0xfd7caa7b) }, + { SPH_C32(0xa7cb6000), SPH_C32(0x5f280cae), SPH_C32(0x5065e9f4), + SPH_C32(0x82e738f6), SPH_C32(0xb0413000), SPH_C32(0x35e8c7ce), + SPH_C32(0xa65e4bc1), SPH_C32(0xe39a28e9) }, + { SPH_C32(0xd35e7000), SPH_C32(0x05034ad0), SPH_C32(0xd898f4df), + SPH_C32(0x9c01ba64), SPH_C32(0x7be83000), SPH_C32(0xa5cff0a7), + SPH_C32(0x1d82bfc6), SPH_C32(0x336e8788) }, + { SPH_C32(0xe6570000), SPH_C32(0x4bb33a25), SPH_C32(0x848598ba), + SPH_C32(0x1041003e), SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), + SPH_C32(0x097f5711), SPH_C32(0xde77cc4c) }, + { SPH_C32(0x92c21000), SPH_C32(0x11987c5b), SPH_C32(0x0c788591), + SPH_C32(0x0ea782ac), SPH_C32(0x3fe54000), SPH_C32(0x8083d4a4), + SPH_C32(0xb2a3a316), SPH_C32(0x0e83632d) }, + { SPH_C32(0x2dfe0000), SPH_C32(0xdb940d4c), SPH_C32(0x3f596cbd), + SPH_C32(0xc0b5af5f), SPH_C32(0x4b705000), SPH_C32(0xdaa892da), + SPH_C32(0x3a5ebe3d), SPH_C32(0x1065e1bf) }, + { SPH_C32(0x596b1000), SPH_C32(0x81bf4b32), SPH_C32(0xb7a47196), + SPH_C32(0xde532dcd), SPH_C32(0x80d95000), SPH_C32(0x4a8fa5b3), + SPH_C32(0x81824a3a), SPH_C32(0xc0914ede) }, + { SPH_C32(0x0f7d2000), SPH_C32(0xffe4b6d9), SPH_C32(0x957fa2ed), + SPH_C32(0x2d88051a), SPH_C32(0x631f4000), SPH_C32(0x30eb8d1e), + SPH_C32(0x7ec6bf1e), SPH_C32(0x7f9b928d) }, + { SPH_C32(0x7be83000), SPH_C32(0xa5cff0a7), SPH_C32(0x1d82bfc6), + SPH_C32(0x336e8788), SPH_C32(0xa8b64000), SPH_C32(0xa0ccba77), + SPH_C32(0xc51a4b19), SPH_C32(0xaf6f3dec) }, + { SPH_C32(0xc4d42000), SPH_C32(0x6fc381b0), SPH_C32(0x2ea356ea), + SPH_C32(0xfd7caa7b), SPH_C32(0xdc235000), SPH_C32(0xfae7fc09), + SPH_C32(0x4de75632), SPH_C32(0xb189bf7e) }, + { SPH_C32(0xb0413000), SPH_C32(0x35e8c7ce), SPH_C32(0xa65e4bc1), + SPH_C32(0xe39a28e9), SPH_C32(0x178a5000), SPH_C32(0x6ac0cb60), + SPH_C32(0xf63ba235), SPH_C32(0x617d101f) }, + { SPH_C32(0x71040000), SPH_C32(0x6bfc54f6), SPH_C32(0xf33c70b5), + SPH_C32(0xb1ad5eff), SPH_C32(0x8a356000), SPH_C32(0x84bc01e2), + SPH_C32(0x6f3c8549), SPH_C32(0x425297a9) }, + { SPH_C32(0x05911000), SPH_C32(0x31d71288), SPH_C32(0x7bc16d9e), + SPH_C32(0xaf4bdc6d), SPH_C32(0x419c6000), SPH_C32(0x149b368b), + SPH_C32(0xd4e0714e), SPH_C32(0x92a638c8) }, + { SPH_C32(0xbaad0000), SPH_C32(0xfbdb639f), SPH_C32(0x48e084b2), + SPH_C32(0x6159f19e), SPH_C32(0x35097000), SPH_C32(0x4eb070f5), + SPH_C32(0x5c1d6c65), SPH_C32(0x8c40ba5a) }, + { SPH_C32(0xce381000), SPH_C32(0xa1f025e1), SPH_C32(0xc01d9999), + SPH_C32(0x7fbf730c), SPH_C32(0xfea07000), SPH_C32(0xde97479c), + SPH_C32(0xe7c19862), SPH_C32(0x5cb4153b) }, + { SPH_C32(0x982e2000), SPH_C32(0xdfabd80a), SPH_C32(0xe2c64ae2), + SPH_C32(0x8c645bdb), SPH_C32(0x1d666000), SPH_C32(0xa4f36f31), + SPH_C32(0x18856d46), SPH_C32(0xe3bec968) }, + { SPH_C32(0xecbb3000), SPH_C32(0x85809e74), SPH_C32(0x6a3b57c9), + SPH_C32(0x9282d949), SPH_C32(0xd6cf6000), SPH_C32(0x34d45858), + SPH_C32(0xa3599941), SPH_C32(0x334a6609) }, + { SPH_C32(0x53872000), SPH_C32(0x4f8cef63), SPH_C32(0x591abee5), + SPH_C32(0x5c90f4ba), SPH_C32(0xa25a7000), SPH_C32(0x6eff1e26), + SPH_C32(0x2ba4846a), SPH_C32(0x2dace49b) }, + { SPH_C32(0x27123000), SPH_C32(0x15a7a91d), SPH_C32(0xd1e7a3ce), + SPH_C32(0x42767628), SPH_C32(0x69f37000), SPH_C32(0xfed8294f), + SPH_C32(0x9078706d), SPH_C32(0xfd584bfa) }, + { SPH_C32(0xf44c4000), SPH_C32(0x10a4e3cd), SPH_C32(0x097f5711), + SPH_C32(0xde77cc4c), SPH_C32(0x121b4000), SPH_C32(0x5b17d9e8), + SPH_C32(0x8dfacfab), SPH_C32(0xce36cc72) }, + { SPH_C32(0x80d95000), SPH_C32(0x4a8fa5b3), SPH_C32(0x81824a3a), + SPH_C32(0xc0914ede), SPH_C32(0xd9b24000), SPH_C32(0xcb30ee81), + SPH_C32(0x36263bac), SPH_C32(0x1ec26313) }, + { SPH_C32(0x3fe54000), SPH_C32(0x8083d4a4), SPH_C32(0xb2a3a316), + SPH_C32(0x0e83632d), SPH_C32(0xad275000), SPH_C32(0x911ba8ff), + SPH_C32(0xbedb2687), SPH_C32(0x0024e181) }, + { SPH_C32(0x4b705000), SPH_C32(0xdaa892da), SPH_C32(0x3a5ebe3d), + SPH_C32(0x1065e1bf), SPH_C32(0x668e5000), SPH_C32(0x013c9f96), + SPH_C32(0x0507d280), SPH_C32(0xd0d04ee0) }, + { SPH_C32(0x1d666000), SPH_C32(0xa4f36f31), SPH_C32(0x18856d46), + SPH_C32(0xe3bec968), SPH_C32(0x85484000), SPH_C32(0x7b58b73b), + SPH_C32(0xfa4327a4), SPH_C32(0x6fda92b3) }, + { SPH_C32(0x69f37000), SPH_C32(0xfed8294f), SPH_C32(0x9078706d), + SPH_C32(0xfd584bfa), SPH_C32(0x4ee14000), SPH_C32(0xeb7f8052), + SPH_C32(0x419fd3a3), SPH_C32(0xbf2e3dd2) }, + { SPH_C32(0xd6cf6000), SPH_C32(0x34d45858), SPH_C32(0xa3599941), + SPH_C32(0x334a6609), SPH_C32(0x3a745000), SPH_C32(0xb154c62c), + SPH_C32(0xc962ce88), SPH_C32(0xa1c8bf40) }, + { SPH_C32(0xa25a7000), SPH_C32(0x6eff1e26), SPH_C32(0x2ba4846a), + SPH_C32(0x2dace49b), SPH_C32(0xf1dd5000), SPH_C32(0x2173f145), + SPH_C32(0x72be3a8f), SPH_C32(0x713c1021) }, + { SPH_C32(0x631f4000), SPH_C32(0x30eb8d1e), SPH_C32(0x7ec6bf1e), + SPH_C32(0x7f9b928d), SPH_C32(0x6c626000), SPH_C32(0xcf0f3bc7), + SPH_C32(0xebb91df3), SPH_C32(0x52139797) }, + { SPH_C32(0x178a5000), SPH_C32(0x6ac0cb60), SPH_C32(0xf63ba235), + SPH_C32(0x617d101f), SPH_C32(0xa7cb6000), SPH_C32(0x5f280cae), + SPH_C32(0x5065e9f4), SPH_C32(0x82e738f6) }, + { SPH_C32(0xa8b64000), SPH_C32(0xa0ccba77), SPH_C32(0xc51a4b19), + SPH_C32(0xaf6f3dec), SPH_C32(0xd35e7000), SPH_C32(0x05034ad0), + SPH_C32(0xd898f4df), SPH_C32(0x9c01ba64) }, + { SPH_C32(0xdc235000), SPH_C32(0xfae7fc09), SPH_C32(0x4de75632), + SPH_C32(0xb189bf7e), SPH_C32(0x18f77000), SPH_C32(0x95247db9), + SPH_C32(0x634400d8), SPH_C32(0x4cf51505) }, + { SPH_C32(0x8a356000), SPH_C32(0x84bc01e2), SPH_C32(0x6f3c8549), + SPH_C32(0x425297a9), SPH_C32(0xfb316000), SPH_C32(0xef405514), + SPH_C32(0x9c00f5fc), SPH_C32(0xf3ffc956) }, + { SPH_C32(0xfea07000), SPH_C32(0xde97479c), SPH_C32(0xe7c19862), + SPH_C32(0x5cb4153b), SPH_C32(0x30986000), SPH_C32(0x7f67627d), + SPH_C32(0x27dc01fb), SPH_C32(0x230b6637) }, + { SPH_C32(0x419c6000), SPH_C32(0x149b368b), SPH_C32(0xd4e0714e), + SPH_C32(0x92a638c8), SPH_C32(0x440d7000), SPH_C32(0x254c2403), + SPH_C32(0xaf211cd0), SPH_C32(0x3dede4a5) }, + { SPH_C32(0x35097000), SPH_C32(0x4eb070f5), SPH_C32(0x5c1d6c65), + SPH_C32(0x8c40ba5a), SPH_C32(0x8fa47000), SPH_C32(0xb56b136a), + SPH_C32(0x14fde8d7), SPH_C32(0xed194bc4) }, + { SPH_C32(0xe4788000), SPH_C32(0x859673c1), SPH_C32(0xb5fb2452), + SPH_C32(0x29cc5edf), SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), + SPH_C32(0x62fc79d0), SPH_C32(0x731ebdc2) }, + { SPH_C32(0x90ed9000), SPH_C32(0xdfbd35bf), SPH_C32(0x3d063979), + SPH_C32(0x372adc4d), SPH_C32(0xcff60000), SPH_C32(0x0c6da4a0), + SPH_C32(0xd9208dd7), SPH_C32(0xa3ea12a3) }, + { SPH_C32(0x2fd18000), SPH_C32(0x15b144a8), SPH_C32(0x0e27d055), + SPH_C32(0xf938f1be), SPH_C32(0xbb631000), SPH_C32(0x5646e2de), + SPH_C32(0x51dd90fc), SPH_C32(0xbd0c9031) }, + { SPH_C32(0x5b449000), SPH_C32(0x4f9a02d6), SPH_C32(0x86dacd7e), + SPH_C32(0xe7de732c), SPH_C32(0x70ca1000), SPH_C32(0xc661d5b7), + SPH_C32(0xea0164fb), SPH_C32(0x6df83f50) }, + { SPH_C32(0x0d52a000), SPH_C32(0x31c1ff3d), SPH_C32(0xa4011e05), + SPH_C32(0x14055bfb), SPH_C32(0x930c0000), SPH_C32(0xbc05fd1a), + SPH_C32(0x154591df), SPH_C32(0xd2f2e303) }, + { SPH_C32(0x79c7b000), SPH_C32(0x6beab943), SPH_C32(0x2cfc032e), + SPH_C32(0x0ae3d969), SPH_C32(0x58a50000), SPH_C32(0x2c22ca73), + SPH_C32(0xae9965d8), SPH_C32(0x02064c62) }, + { SPH_C32(0xc6fba000), SPH_C32(0xa1e6c854), SPH_C32(0x1fddea02), + SPH_C32(0xc4f1f49a), SPH_C32(0x2c301000), SPH_C32(0x76098c0d), + SPH_C32(0x266478f3), SPH_C32(0x1ce0cef0) }, + { SPH_C32(0xb26eb000), SPH_C32(0xfbcd8e2a), SPH_C32(0x9720f729), + SPH_C32(0xda177608), SPH_C32(0xe7991000), SPH_C32(0xe62ebb64), + SPH_C32(0x9db88cf4), SPH_C32(0xcc146191) }, + { SPH_C32(0x732b8000), SPH_C32(0xa5d91d12), SPH_C32(0xc242cc5d), + SPH_C32(0x8820001e), SPH_C32(0x7a262000), SPH_C32(0x085271e6), + SPH_C32(0x04bfab88), SPH_C32(0xef3be627) }, + { SPH_C32(0x07be9000), SPH_C32(0xfff25b6c), SPH_C32(0x4abfd176), + SPH_C32(0x96c6828c), SPH_C32(0xb18f2000), SPH_C32(0x9875468f), + SPH_C32(0xbf635f8f), SPH_C32(0x3fcf4946) }, + { SPH_C32(0xb8828000), SPH_C32(0x35fe2a7b), SPH_C32(0x799e385a), + SPH_C32(0x58d4af7f), SPH_C32(0xc51a3000), SPH_C32(0xc25e00f1), + SPH_C32(0x379e42a4), SPH_C32(0x2129cbd4) }, + { SPH_C32(0xcc179000), SPH_C32(0x6fd56c05), SPH_C32(0xf1632571), + SPH_C32(0x46322ded), SPH_C32(0x0eb33000), SPH_C32(0x52793798), + SPH_C32(0x8c42b6a3), SPH_C32(0xf1dd64b5) }, + { SPH_C32(0x9a01a000), SPH_C32(0x118e91ee), SPH_C32(0xd3b8f60a), + SPH_C32(0xb5e9053a), SPH_C32(0xed752000), SPH_C32(0x281d1f35), + SPH_C32(0x73064387), SPH_C32(0x4ed7b8e6) }, + { SPH_C32(0xee94b000), SPH_C32(0x4ba5d790), SPH_C32(0x5b45eb21), + SPH_C32(0xab0f87a8), SPH_C32(0x26dc2000), SPH_C32(0xb83a285c), + SPH_C32(0xc8dab780), SPH_C32(0x9e231787) }, + { SPH_C32(0x51a8a000), SPH_C32(0x81a9a687), SPH_C32(0x6864020d), + SPH_C32(0x651daa5b), SPH_C32(0x52493000), SPH_C32(0xe2116e22), + SPH_C32(0x4027aaab), SPH_C32(0x80c59515) }, + { SPH_C32(0x253db000), SPH_C32(0xdb82e0f9), SPH_C32(0xe0991f26), + SPH_C32(0x7bfb28c9), SPH_C32(0x99e03000), SPH_C32(0x7236594b), + SPH_C32(0xfbfb5eac), SPH_C32(0x50313a74) }, + { SPH_C32(0xf663c000), SPH_C32(0xde81aa29), SPH_C32(0x3801ebf9), + SPH_C32(0xe7fa92ad), SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), + SPH_C32(0xe679e16a), SPH_C32(0x635fbdfc) }, + { SPH_C32(0x82f6d000), SPH_C32(0x84aaec57), SPH_C32(0xb0fcf6d2), + SPH_C32(0xf91c103f), SPH_C32(0x29a10000), SPH_C32(0x47de9e85), + SPH_C32(0x5da5156d), SPH_C32(0xb3ab129d) }, + { SPH_C32(0x3dcac000), SPH_C32(0x4ea69d40), SPH_C32(0x83dd1ffe), + SPH_C32(0x370e3dcc), SPH_C32(0x5d341000), SPH_C32(0x1df5d8fb), + SPH_C32(0xd5580846), SPH_C32(0xad4d900f) }, + { SPH_C32(0x495fd000), SPH_C32(0x148ddb3e), SPH_C32(0x0b2002d5), + SPH_C32(0x29e8bf5e), SPH_C32(0x969d1000), SPH_C32(0x8dd2ef92), + SPH_C32(0x6e84fc41), SPH_C32(0x7db93f6e) }, + { SPH_C32(0x1f49e000), SPH_C32(0x6ad626d5), SPH_C32(0x29fbd1ae), + SPH_C32(0xda339789), SPH_C32(0x755b0000), SPH_C32(0xf7b6c73f), + SPH_C32(0x91c00965), SPH_C32(0xc2b3e33d) }, + { SPH_C32(0x6bdcf000), SPH_C32(0x30fd60ab), SPH_C32(0xa106cc85), + SPH_C32(0xc4d5151b), SPH_C32(0xbef20000), SPH_C32(0x6791f056), + SPH_C32(0x2a1cfd62), SPH_C32(0x12474c5c) }, + { SPH_C32(0xd4e0e000), SPH_C32(0xfaf111bc), SPH_C32(0x922725a9), + SPH_C32(0x0ac738e8), SPH_C32(0xca671000), SPH_C32(0x3dbab628), + SPH_C32(0xa2e1e049), SPH_C32(0x0ca1cece) }, + { SPH_C32(0xa075f000), SPH_C32(0xa0da57c2), SPH_C32(0x1ada3882), + SPH_C32(0x1421ba7a), SPH_C32(0x01ce1000), SPH_C32(0xad9d8141), + SPH_C32(0x193d144e), SPH_C32(0xdc5561af) }, + { SPH_C32(0x6130c000), SPH_C32(0xfecec4fa), SPH_C32(0x4fb803f6), + SPH_C32(0x4616cc6c), SPH_C32(0x9c712000), SPH_C32(0x43e14bc3), + SPH_C32(0x803a3332), SPH_C32(0xff7ae619) }, + { SPH_C32(0x15a5d000), SPH_C32(0xa4e58284), SPH_C32(0xc7451edd), + SPH_C32(0x58f04efe), SPH_C32(0x57d82000), SPH_C32(0xd3c67caa), + SPH_C32(0x3be6c735), SPH_C32(0x2f8e4978) }, + { SPH_C32(0xaa99c000), SPH_C32(0x6ee9f393), SPH_C32(0xf464f7f1), + SPH_C32(0x96e2630d), SPH_C32(0x234d3000), SPH_C32(0x89ed3ad4), + SPH_C32(0xb31bda1e), SPH_C32(0x3168cbea) }, + { SPH_C32(0xde0cd000), SPH_C32(0x34c2b5ed), SPH_C32(0x7c99eada), + SPH_C32(0x8804e19f), SPH_C32(0xe8e43000), SPH_C32(0x19ca0dbd), + SPH_C32(0x08c72e19), SPH_C32(0xe19c648b) }, + { SPH_C32(0x881ae000), SPH_C32(0x4a994806), SPH_C32(0x5e4239a1), + SPH_C32(0x7bdfc948), SPH_C32(0x0b222000), SPH_C32(0x63ae2510), + SPH_C32(0xf783db3d), SPH_C32(0x5e96b8d8) }, + { SPH_C32(0xfc8ff000), SPH_C32(0x10b20e78), SPH_C32(0xd6bf248a), + SPH_C32(0x65394bda), SPH_C32(0xc08b2000), SPH_C32(0xf3891279), + SPH_C32(0x4c5f2f3a), SPH_C32(0x8e6217b9) }, + { SPH_C32(0x43b3e000), SPH_C32(0xdabe7f6f), SPH_C32(0xe59ecda6), + SPH_C32(0xab2b6629), SPH_C32(0xb41e3000), SPH_C32(0xa9a25407), + SPH_C32(0xc4a23211), SPH_C32(0x9084952b) }, + { SPH_C32(0x3726f000), SPH_C32(0x80953911), SPH_C32(0x6d63d08d), + SPH_C32(0xb5cde4bb), SPH_C32(0x7fb73000), SPH_C32(0x3985636e), + SPH_C32(0x7f7ec616), SPH_C32(0x40703a4a) }, + { SPH_C32(0x022f8000), SPH_C32(0xce2549e4), SPH_C32(0x317ebce8), + SPH_C32(0x398d5ee1), SPH_C32(0xf0134000), SPH_C32(0x8cee7004), + SPH_C32(0x6b832ec1), SPH_C32(0xad69718e) }, + { SPH_C32(0x76ba9000), SPH_C32(0x940e0f9a), SPH_C32(0xb983a1c3), + SPH_C32(0x276bdc73), SPH_C32(0x3bba4000), SPH_C32(0x1cc9476d), + SPH_C32(0xd05fdac6), SPH_C32(0x7d9ddeef) }, + { SPH_C32(0xc9868000), SPH_C32(0x5e027e8d), SPH_C32(0x8aa248ef), + SPH_C32(0xe979f180), SPH_C32(0x4f2f5000), SPH_C32(0x46e20113), + SPH_C32(0x58a2c7ed), SPH_C32(0x637b5c7d) }, + { SPH_C32(0xbd139000), SPH_C32(0x042938f3), SPH_C32(0x025f55c4), + SPH_C32(0xf79f7312), SPH_C32(0x84865000), SPH_C32(0xd6c5367a), + SPH_C32(0xe37e33ea), SPH_C32(0xb38ff31c) }, + { SPH_C32(0xeb05a000), SPH_C32(0x7a72c518), SPH_C32(0x208486bf), + SPH_C32(0x04445bc5), SPH_C32(0x67404000), SPH_C32(0xaca11ed7), + SPH_C32(0x1c3ac6ce), SPH_C32(0x0c852f4f) }, + { SPH_C32(0x9f90b000), SPH_C32(0x20598366), SPH_C32(0xa8799b94), + SPH_C32(0x1aa2d957), SPH_C32(0xace94000), SPH_C32(0x3c8629be), + SPH_C32(0xa7e632c9), SPH_C32(0xdc71802e) }, + { SPH_C32(0x20aca000), SPH_C32(0xea55f271), SPH_C32(0x9b5872b8), + SPH_C32(0xd4b0f4a4), SPH_C32(0xd87c5000), SPH_C32(0x66ad6fc0), + SPH_C32(0x2f1b2fe2), SPH_C32(0xc29702bc) }, + { SPH_C32(0x5439b000), SPH_C32(0xb07eb40f), SPH_C32(0x13a56f93), + SPH_C32(0xca567636), SPH_C32(0x13d55000), SPH_C32(0xf68a58a9), + SPH_C32(0x94c7dbe5), SPH_C32(0x1263addd) }, + { SPH_C32(0x957c8000), SPH_C32(0xee6a2737), SPH_C32(0x46c754e7), + SPH_C32(0x98610020), SPH_C32(0x8e6a6000), SPH_C32(0x18f6922b), + SPH_C32(0x0dc0fc99), SPH_C32(0x314c2a6b) }, + { SPH_C32(0xe1e99000), SPH_C32(0xb4416149), SPH_C32(0xce3a49cc), + SPH_C32(0x868782b2), SPH_C32(0x45c36000), SPH_C32(0x88d1a542), + SPH_C32(0xb61c089e), SPH_C32(0xe1b8850a) }, + { SPH_C32(0x5ed58000), SPH_C32(0x7e4d105e), SPH_C32(0xfd1ba0e0), + SPH_C32(0x4895af41), SPH_C32(0x31567000), SPH_C32(0xd2fae33c), + SPH_C32(0x3ee115b5), SPH_C32(0xff5e0798) }, + { SPH_C32(0x2a409000), SPH_C32(0x24665620), SPH_C32(0x75e6bdcb), + SPH_C32(0x56732dd3), SPH_C32(0xfaff7000), SPH_C32(0x42ddd455), + SPH_C32(0x853de1b2), SPH_C32(0x2faaa8f9) }, + { SPH_C32(0x7c56a000), SPH_C32(0x5a3dabcb), SPH_C32(0x573d6eb0), + SPH_C32(0xa5a80504), SPH_C32(0x19396000), SPH_C32(0x38b9fcf8), + SPH_C32(0x7a791496), SPH_C32(0x90a074aa) }, + { SPH_C32(0x08c3b000), SPH_C32(0x0016edb5), SPH_C32(0xdfc0739b), + SPH_C32(0xbb4e8796), SPH_C32(0xd2906000), SPH_C32(0xa89ecb91), + SPH_C32(0xc1a5e091), SPH_C32(0x4054dbcb) }, + { SPH_C32(0xb7ffa000), SPH_C32(0xca1a9ca2), SPH_C32(0xece19ab7), + SPH_C32(0x755caa65), SPH_C32(0xa6057000), SPH_C32(0xf2b58def), + SPH_C32(0x4958fdba), SPH_C32(0x5eb25959) }, + { SPH_C32(0xc36ab000), SPH_C32(0x9031dadc), SPH_C32(0x641c879c), + SPH_C32(0x6bba28f7), SPH_C32(0x6dac7000), SPH_C32(0x6292ba86), + SPH_C32(0xf28409bd), SPH_C32(0x8e46f638) }, + { SPH_C32(0x1034c000), SPH_C32(0x9532900c), SPH_C32(0xbc847343), + SPH_C32(0xf7bb9293), SPH_C32(0x16444000), SPH_C32(0xc75d4a21), + SPH_C32(0xef06b67b), SPH_C32(0xbd2871b0) }, + { SPH_C32(0x64a1d000), SPH_C32(0xcf19d672), SPH_C32(0x34796e68), + SPH_C32(0xe95d1001), SPH_C32(0xdded4000), SPH_C32(0x577a7d48), + SPH_C32(0x54da427c), SPH_C32(0x6ddcded1) }, + { SPH_C32(0xdb9dc000), SPH_C32(0x0515a765), SPH_C32(0x07588744), + SPH_C32(0x274f3df2), SPH_C32(0xa9785000), SPH_C32(0x0d513b36), + SPH_C32(0xdc275f57), SPH_C32(0x733a5c43) }, + { SPH_C32(0xaf08d000), SPH_C32(0x5f3ee11b), SPH_C32(0x8fa59a6f), + SPH_C32(0x39a9bf60), SPH_C32(0x62d15000), SPH_C32(0x9d760c5f), + SPH_C32(0x67fbab50), SPH_C32(0xa3cef322) }, + { SPH_C32(0xf91ee000), SPH_C32(0x21651cf0), SPH_C32(0xad7e4914), + SPH_C32(0xca7297b7), SPH_C32(0x81174000), SPH_C32(0xe71224f2), + SPH_C32(0x98bf5e74), SPH_C32(0x1cc42f71) }, + { SPH_C32(0x8d8bf000), SPH_C32(0x7b4e5a8e), SPH_C32(0x2583543f), + SPH_C32(0xd4941525), SPH_C32(0x4abe4000), SPH_C32(0x7735139b), + SPH_C32(0x2363aa73), SPH_C32(0xcc308010) }, + { SPH_C32(0x32b7e000), SPH_C32(0xb1422b99), SPH_C32(0x16a2bd13), + SPH_C32(0x1a8638d6), SPH_C32(0x3e2b5000), SPH_C32(0x2d1e55e5), + SPH_C32(0xab9eb758), SPH_C32(0xd2d60282) }, + { SPH_C32(0x4622f000), SPH_C32(0xeb696de7), SPH_C32(0x9e5fa038), + SPH_C32(0x0460ba44), SPH_C32(0xf5825000), SPH_C32(0xbd39628c), + SPH_C32(0x1042435f), SPH_C32(0x0222ade3) }, + { SPH_C32(0x8767c000), SPH_C32(0xb57dfedf), SPH_C32(0xcb3d9b4c), + SPH_C32(0x5657cc52), SPH_C32(0x683d6000), SPH_C32(0x5345a80e), + SPH_C32(0x89456423), SPH_C32(0x210d2a55) }, + { SPH_C32(0xf3f2d000), SPH_C32(0xef56b8a1), SPH_C32(0x43c08667), + SPH_C32(0x48b14ec0), SPH_C32(0xa3946000), SPH_C32(0xc3629f67), + SPH_C32(0x32999024), SPH_C32(0xf1f98534) }, + { SPH_C32(0x4ccec000), SPH_C32(0x255ac9b6), SPH_C32(0x70e16f4b), + SPH_C32(0x86a36333), SPH_C32(0xd7017000), SPH_C32(0x9949d919), + SPH_C32(0xba648d0f), SPH_C32(0xef1f07a6) }, + { SPH_C32(0x385bd000), SPH_C32(0x7f718fc8), SPH_C32(0xf81c7260), + SPH_C32(0x9845e1a1), SPH_C32(0x1ca87000), SPH_C32(0x096eee70), + SPH_C32(0x01b87908), SPH_C32(0x3feba8c7) }, + { SPH_C32(0x6e4de000), SPH_C32(0x012a7223), SPH_C32(0xdac7a11b), + SPH_C32(0x6b9ec976), SPH_C32(0xff6e6000), SPH_C32(0x730ac6dd), + SPH_C32(0xfefc8c2c), SPH_C32(0x80e17494) }, + { SPH_C32(0x1ad8f000), SPH_C32(0x5b01345d), SPH_C32(0x523abc30), + SPH_C32(0x75784be4), SPH_C32(0x34c76000), SPH_C32(0xe32df1b4), + SPH_C32(0x4520782b), SPH_C32(0x5015dbf5) }, + { SPH_C32(0xa5e4e000), SPH_C32(0x910d454a), SPH_C32(0x611b551c), + SPH_C32(0xbb6a6617), SPH_C32(0x40527000), SPH_C32(0xb906b7ca), + SPH_C32(0xcddd6500), SPH_C32(0x4ef35967) }, + { SPH_C32(0xd171f000), SPH_C32(0xcb260334), SPH_C32(0xe9e64837), + SPH_C32(0xa58ce485), SPH_C32(0x8bfb7000), SPH_C32(0x292180a3), + SPH_C32(0x76019107), SPH_C32(0x9e07f606) }, + { SPH_C32(0x045f0000), SPH_C32(0x9c4a93c9), SPH_C32(0x62fc79d0), + SPH_C32(0x731ebdc2), SPH_C32(0xe0278000), SPH_C32(0x19dce008), + SPH_C32(0xd7075d82), SPH_C32(0x5ad2e31d) }, + { SPH_C32(0x70ca1000), SPH_C32(0xc661d5b7), SPH_C32(0xea0164fb), + SPH_C32(0x6df83f50), SPH_C32(0x2b8e8000), SPH_C32(0x89fbd761), + SPH_C32(0x6cdba985), SPH_C32(0x8a264c7c) }, + { SPH_C32(0xcff60000), SPH_C32(0x0c6da4a0), SPH_C32(0xd9208dd7), + SPH_C32(0xa3ea12a3), SPH_C32(0x5f1b9000), SPH_C32(0xd3d0911f), + SPH_C32(0xe426b4ae), SPH_C32(0x94c0ceee) }, + { SPH_C32(0xbb631000), SPH_C32(0x5646e2de), SPH_C32(0x51dd90fc), + SPH_C32(0xbd0c9031), SPH_C32(0x94b29000), SPH_C32(0x43f7a676), + SPH_C32(0x5ffa40a9), SPH_C32(0x4434618f) }, + { SPH_C32(0xed752000), SPH_C32(0x281d1f35), SPH_C32(0x73064387), + SPH_C32(0x4ed7b8e6), SPH_C32(0x77748000), SPH_C32(0x39938edb), + SPH_C32(0xa0beb58d), SPH_C32(0xfb3ebddc) }, + { SPH_C32(0x99e03000), SPH_C32(0x7236594b), SPH_C32(0xfbfb5eac), + SPH_C32(0x50313a74), SPH_C32(0xbcdd8000), SPH_C32(0xa9b4b9b2), + SPH_C32(0x1b62418a), SPH_C32(0x2bca12bd) }, + { SPH_C32(0x26dc2000), SPH_C32(0xb83a285c), SPH_C32(0xc8dab780), + SPH_C32(0x9e231787), SPH_C32(0xc8489000), SPH_C32(0xf39fffcc), + SPH_C32(0x939f5ca1), SPH_C32(0x352c902f) }, + { SPH_C32(0x52493000), SPH_C32(0xe2116e22), SPH_C32(0x4027aaab), + SPH_C32(0x80c59515), SPH_C32(0x03e19000), SPH_C32(0x63b8c8a5), + SPH_C32(0x2843a8a6), SPH_C32(0xe5d83f4e) }, + { SPH_C32(0x930c0000), SPH_C32(0xbc05fd1a), SPH_C32(0x154591df), + SPH_C32(0xd2f2e303), SPH_C32(0x9e5ea000), SPH_C32(0x8dc40227), + SPH_C32(0xb1448fda), SPH_C32(0xc6f7b8f8) }, + { SPH_C32(0xe7991000), SPH_C32(0xe62ebb64), SPH_C32(0x9db88cf4), + SPH_C32(0xcc146191), SPH_C32(0x55f7a000), SPH_C32(0x1de3354e), + SPH_C32(0x0a987bdd), SPH_C32(0x16031799) }, + { SPH_C32(0x58a50000), SPH_C32(0x2c22ca73), SPH_C32(0xae9965d8), + SPH_C32(0x02064c62), SPH_C32(0x2162b000), SPH_C32(0x47c87330), + SPH_C32(0x826566f6), SPH_C32(0x08e5950b) }, + { SPH_C32(0x2c301000), SPH_C32(0x76098c0d), SPH_C32(0x266478f3), + SPH_C32(0x1ce0cef0), SPH_C32(0xeacbb000), SPH_C32(0xd7ef4459), + SPH_C32(0x39b992f1), SPH_C32(0xd8113a6a) }, + { SPH_C32(0x7a262000), SPH_C32(0x085271e6), SPH_C32(0x04bfab88), + SPH_C32(0xef3be627), SPH_C32(0x090da000), SPH_C32(0xad8b6cf4), + SPH_C32(0xc6fd67d5), SPH_C32(0x671be639) }, + { SPH_C32(0x0eb33000), SPH_C32(0x52793798), SPH_C32(0x8c42b6a3), + SPH_C32(0xf1dd64b5), SPH_C32(0xc2a4a000), SPH_C32(0x3dac5b9d), + SPH_C32(0x7d2193d2), SPH_C32(0xb7ef4958) }, + { SPH_C32(0xb18f2000), SPH_C32(0x9875468f), SPH_C32(0xbf635f8f), + SPH_C32(0x3fcf4946), SPH_C32(0xb631b000), SPH_C32(0x67871de3), + SPH_C32(0xf5dc8ef9), SPH_C32(0xa909cbca) }, + { SPH_C32(0xc51a3000), SPH_C32(0xc25e00f1), SPH_C32(0x379e42a4), + SPH_C32(0x2129cbd4), SPH_C32(0x7d98b000), SPH_C32(0xf7a02a8a), + SPH_C32(0x4e007afe), SPH_C32(0x79fd64ab) }, + { SPH_C32(0x16444000), SPH_C32(0xc75d4a21), SPH_C32(0xef06b67b), + SPH_C32(0xbd2871b0), SPH_C32(0x06708000), SPH_C32(0x526fda2d), + SPH_C32(0x5382c538), SPH_C32(0x4a93e323) }, + { SPH_C32(0x62d15000), SPH_C32(0x9d760c5f), SPH_C32(0x67fbab50), + SPH_C32(0xa3cef322), SPH_C32(0xcdd98000), SPH_C32(0xc248ed44), + SPH_C32(0xe85e313f), SPH_C32(0x9a674c42) }, + { SPH_C32(0xdded4000), SPH_C32(0x577a7d48), SPH_C32(0x54da427c), + SPH_C32(0x6ddcded1), SPH_C32(0xb94c9000), SPH_C32(0x9863ab3a), + SPH_C32(0x60a32c14), SPH_C32(0x8481ced0) }, + { SPH_C32(0xa9785000), SPH_C32(0x0d513b36), SPH_C32(0xdc275f57), + SPH_C32(0x733a5c43), SPH_C32(0x72e59000), SPH_C32(0x08449c53), + SPH_C32(0xdb7fd813), SPH_C32(0x547561b1) }, + { SPH_C32(0xff6e6000), SPH_C32(0x730ac6dd), SPH_C32(0xfefc8c2c), + SPH_C32(0x80e17494), SPH_C32(0x91238000), SPH_C32(0x7220b4fe), + SPH_C32(0x243b2d37), SPH_C32(0xeb7fbde2) }, + { SPH_C32(0x8bfb7000), SPH_C32(0x292180a3), SPH_C32(0x76019107), + SPH_C32(0x9e07f606), SPH_C32(0x5a8a8000), SPH_C32(0xe2078397), + SPH_C32(0x9fe7d930), SPH_C32(0x3b8b1283) }, + { SPH_C32(0x34c76000), SPH_C32(0xe32df1b4), SPH_C32(0x4520782b), + SPH_C32(0x5015dbf5), SPH_C32(0x2e1f9000), SPH_C32(0xb82cc5e9), + SPH_C32(0x171ac41b), SPH_C32(0x256d9011) }, + { SPH_C32(0x40527000), SPH_C32(0xb906b7ca), SPH_C32(0xcddd6500), + SPH_C32(0x4ef35967), SPH_C32(0xe5b69000), SPH_C32(0x280bf280), + SPH_C32(0xacc6301c), SPH_C32(0xf5993f70) }, + { SPH_C32(0x81174000), SPH_C32(0xe71224f2), SPH_C32(0x98bf5e74), + SPH_C32(0x1cc42f71), SPH_C32(0x7809a000), SPH_C32(0xc6773802), + SPH_C32(0x35c11760), SPH_C32(0xd6b6b8c6) }, + { SPH_C32(0xf5825000), SPH_C32(0xbd39628c), SPH_C32(0x1042435f), + SPH_C32(0x0222ade3), SPH_C32(0xb3a0a000), SPH_C32(0x56500f6b), + SPH_C32(0x8e1de367), SPH_C32(0x064217a7) }, + { SPH_C32(0x4abe4000), SPH_C32(0x7735139b), SPH_C32(0x2363aa73), + SPH_C32(0xcc308010), SPH_C32(0xc735b000), SPH_C32(0x0c7b4915), + SPH_C32(0x06e0fe4c), SPH_C32(0x18a49535) }, + { SPH_C32(0x3e2b5000), SPH_C32(0x2d1e55e5), SPH_C32(0xab9eb758), + SPH_C32(0xd2d60282), SPH_C32(0x0c9cb000), SPH_C32(0x9c5c7e7c), + SPH_C32(0xbd3c0a4b), SPH_C32(0xc8503a54) }, + { SPH_C32(0x683d6000), SPH_C32(0x5345a80e), SPH_C32(0x89456423), + SPH_C32(0x210d2a55), SPH_C32(0xef5aa000), SPH_C32(0xe63856d1), + SPH_C32(0x4278ff6f), SPH_C32(0x775ae607) }, + { SPH_C32(0x1ca87000), SPH_C32(0x096eee70), SPH_C32(0x01b87908), + SPH_C32(0x3feba8c7), SPH_C32(0x24f3a000), SPH_C32(0x761f61b8), + SPH_C32(0xf9a40b68), SPH_C32(0xa7ae4966) }, + { SPH_C32(0xa3946000), SPH_C32(0xc3629f67), SPH_C32(0x32999024), + SPH_C32(0xf1f98534), SPH_C32(0x5066b000), SPH_C32(0x2c3427c6), + SPH_C32(0x71591643), SPH_C32(0xb948cbf4) }, + { SPH_C32(0xd7017000), SPH_C32(0x9949d919), SPH_C32(0xba648d0f), + SPH_C32(0xef1f07a6), SPH_C32(0x9bcfb000), SPH_C32(0xbc1310af), + SPH_C32(0xca85e244), SPH_C32(0x69bc6495) }, + { SPH_C32(0xe2080000), SPH_C32(0xd7f9a9ec), SPH_C32(0xe679e16a), + SPH_C32(0x635fbdfc), SPH_C32(0x146bc000), SPH_C32(0x097803c5), + SPH_C32(0xde780a93), SPH_C32(0x84a52f51) }, + { SPH_C32(0x969d1000), SPH_C32(0x8dd2ef92), SPH_C32(0x6e84fc41), + SPH_C32(0x7db93f6e), SPH_C32(0xdfc2c000), SPH_C32(0x995f34ac), + SPH_C32(0x65a4fe94), SPH_C32(0x54518030) }, + { SPH_C32(0x29a10000), SPH_C32(0x47de9e85), SPH_C32(0x5da5156d), + SPH_C32(0xb3ab129d), SPH_C32(0xab57d000), SPH_C32(0xc37472d2), + SPH_C32(0xed59e3bf), SPH_C32(0x4ab702a2) }, + { SPH_C32(0x5d341000), SPH_C32(0x1df5d8fb), SPH_C32(0xd5580846), + SPH_C32(0xad4d900f), SPH_C32(0x60fed000), SPH_C32(0x535345bb), + SPH_C32(0x568517b8), SPH_C32(0x9a43adc3) }, + { SPH_C32(0x0b222000), SPH_C32(0x63ae2510), SPH_C32(0xf783db3d), + SPH_C32(0x5e96b8d8), SPH_C32(0x8338c000), SPH_C32(0x29376d16), + SPH_C32(0xa9c1e29c), SPH_C32(0x25497190) }, + { SPH_C32(0x7fb73000), SPH_C32(0x3985636e), SPH_C32(0x7f7ec616), + SPH_C32(0x40703a4a), SPH_C32(0x4891c000), SPH_C32(0xb9105a7f), + SPH_C32(0x121d169b), SPH_C32(0xf5bddef1) }, + { SPH_C32(0xc08b2000), SPH_C32(0xf3891279), SPH_C32(0x4c5f2f3a), + SPH_C32(0x8e6217b9), SPH_C32(0x3c04d000), SPH_C32(0xe33b1c01), + SPH_C32(0x9ae00bb0), SPH_C32(0xeb5b5c63) }, + { SPH_C32(0xb41e3000), SPH_C32(0xa9a25407), SPH_C32(0xc4a23211), + SPH_C32(0x9084952b), SPH_C32(0xf7add000), SPH_C32(0x731c2b68), + SPH_C32(0x213cffb7), SPH_C32(0x3baff302) }, + { SPH_C32(0x755b0000), SPH_C32(0xf7b6c73f), SPH_C32(0x91c00965), + SPH_C32(0xc2b3e33d), SPH_C32(0x6a12e000), SPH_C32(0x9d60e1ea), + SPH_C32(0xb83bd8cb), SPH_C32(0x188074b4) }, + { SPH_C32(0x01ce1000), SPH_C32(0xad9d8141), SPH_C32(0x193d144e), + SPH_C32(0xdc5561af), SPH_C32(0xa1bbe000), SPH_C32(0x0d47d683), + SPH_C32(0x03e72ccc), SPH_C32(0xc874dbd5) }, + { SPH_C32(0xbef20000), SPH_C32(0x6791f056), SPH_C32(0x2a1cfd62), + SPH_C32(0x12474c5c), SPH_C32(0xd52ef000), SPH_C32(0x576c90fd), + SPH_C32(0x8b1a31e7), SPH_C32(0xd6925947) }, + { SPH_C32(0xca671000), SPH_C32(0x3dbab628), SPH_C32(0xa2e1e049), + SPH_C32(0x0ca1cece), SPH_C32(0x1e87f000), SPH_C32(0xc74ba794), + SPH_C32(0x30c6c5e0), SPH_C32(0x0666f626) }, + { SPH_C32(0x9c712000), SPH_C32(0x43e14bc3), SPH_C32(0x803a3332), + SPH_C32(0xff7ae619), SPH_C32(0xfd41e000), SPH_C32(0xbd2f8f39), + SPH_C32(0xcf8230c4), SPH_C32(0xb96c2a75) }, + { SPH_C32(0xe8e43000), SPH_C32(0x19ca0dbd), SPH_C32(0x08c72e19), + SPH_C32(0xe19c648b), SPH_C32(0x36e8e000), SPH_C32(0x2d08b850), + SPH_C32(0x745ec4c3), SPH_C32(0x69988514) }, + { SPH_C32(0x57d82000), SPH_C32(0xd3c67caa), SPH_C32(0x3be6c735), + SPH_C32(0x2f8e4978), SPH_C32(0x427df000), SPH_C32(0x7723fe2e), + SPH_C32(0xfca3d9e8), SPH_C32(0x777e0786) }, + { SPH_C32(0x234d3000), SPH_C32(0x89ed3ad4), SPH_C32(0xb31bda1e), + SPH_C32(0x3168cbea), SPH_C32(0x89d4f000), SPH_C32(0xe704c947), + SPH_C32(0x477f2def), SPH_C32(0xa78aa8e7) }, + { SPH_C32(0xf0134000), SPH_C32(0x8cee7004), SPH_C32(0x6b832ec1), + SPH_C32(0xad69718e), SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), + SPH_C32(0x5afd9229), SPH_C32(0x94e42f6f) }, + { SPH_C32(0x84865000), SPH_C32(0xd6c5367a), SPH_C32(0xe37e33ea), + SPH_C32(0xb38ff31c), SPH_C32(0x3995c000), SPH_C32(0xd2ec0e89), + SPH_C32(0xe121662e), SPH_C32(0x4410800e) }, + { SPH_C32(0x3bba4000), SPH_C32(0x1cc9476d), SPH_C32(0xd05fdac6), + SPH_C32(0x7d9ddeef), SPH_C32(0x4d00d000), SPH_C32(0x88c748f7), + SPH_C32(0x69dc7b05), SPH_C32(0x5af6029c) }, + { SPH_C32(0x4f2f5000), SPH_C32(0x46e20113), SPH_C32(0x58a2c7ed), + SPH_C32(0x637b5c7d), SPH_C32(0x86a9d000), SPH_C32(0x18e07f9e), + SPH_C32(0xd2008f02), SPH_C32(0x8a02adfd) }, + { SPH_C32(0x19396000), SPH_C32(0x38b9fcf8), SPH_C32(0x7a791496), + SPH_C32(0x90a074aa), SPH_C32(0x656fc000), SPH_C32(0x62845733), + SPH_C32(0x2d447a26), SPH_C32(0x350871ae) }, + { SPH_C32(0x6dac7000), SPH_C32(0x6292ba86), SPH_C32(0xf28409bd), + SPH_C32(0x8e46f638), SPH_C32(0xaec6c000), SPH_C32(0xf2a3605a), + SPH_C32(0x96988e21), SPH_C32(0xe5fcdecf) }, + { SPH_C32(0xd2906000), SPH_C32(0xa89ecb91), SPH_C32(0xc1a5e091), + SPH_C32(0x4054dbcb), SPH_C32(0xda53d000), SPH_C32(0xa8882624), + SPH_C32(0x1e65930a), SPH_C32(0xfb1a5c5d) }, + { SPH_C32(0xa6057000), SPH_C32(0xf2b58def), SPH_C32(0x4958fdba), + SPH_C32(0x5eb25959), SPH_C32(0x11fad000), SPH_C32(0x38af114d), + SPH_C32(0xa5b9670d), SPH_C32(0x2beef33c) }, + { SPH_C32(0x67404000), SPH_C32(0xaca11ed7), SPH_C32(0x1c3ac6ce), + SPH_C32(0x0c852f4f), SPH_C32(0x8c45e000), SPH_C32(0xd6d3dbcf), + SPH_C32(0x3cbe4071), SPH_C32(0x08c1748a) }, + { SPH_C32(0x13d55000), SPH_C32(0xf68a58a9), SPH_C32(0x94c7dbe5), + SPH_C32(0x1263addd), SPH_C32(0x47ece000), SPH_C32(0x46f4eca6), + SPH_C32(0x8762b476), SPH_C32(0xd835dbeb) }, + { SPH_C32(0xace94000), SPH_C32(0x3c8629be), SPH_C32(0xa7e632c9), + SPH_C32(0xdc71802e), SPH_C32(0x3379f000), SPH_C32(0x1cdfaad8), + SPH_C32(0x0f9fa95d), SPH_C32(0xc6d35979) }, + { SPH_C32(0xd87c5000), SPH_C32(0x66ad6fc0), SPH_C32(0x2f1b2fe2), + SPH_C32(0xc29702bc), SPH_C32(0xf8d0f000), SPH_C32(0x8cf89db1), + SPH_C32(0xb4435d5a), SPH_C32(0x1627f618) }, + { SPH_C32(0x8e6a6000), SPH_C32(0x18f6922b), SPH_C32(0x0dc0fc99), + SPH_C32(0x314c2a6b), SPH_C32(0x1b16e000), SPH_C32(0xf69cb51c), + SPH_C32(0x4b07a87e), SPH_C32(0xa92d2a4b) }, + { SPH_C32(0xfaff7000), SPH_C32(0x42ddd455), SPH_C32(0x853de1b2), + SPH_C32(0x2faaa8f9), SPH_C32(0xd0bfe000), SPH_C32(0x66bb8275), + SPH_C32(0xf0db5c79), SPH_C32(0x79d9852a) }, + { SPH_C32(0x45c36000), SPH_C32(0x88d1a542), SPH_C32(0xb61c089e), + SPH_C32(0xe1b8850a), SPH_C32(0xa42af000), SPH_C32(0x3c90c40b), + SPH_C32(0x78264152), SPH_C32(0x673f07b8) }, + { SPH_C32(0x31567000), SPH_C32(0xd2fae33c), SPH_C32(0x3ee115b5), + SPH_C32(0xff5e0798), SPH_C32(0x6f83f000), SPH_C32(0xacb7f362), + SPH_C32(0xc3fab555), SPH_C32(0xb7cba8d9) }, + { SPH_C32(0xe0278000), SPH_C32(0x19dce008), SPH_C32(0xd7075d82), + SPH_C32(0x5ad2e31d), SPH_C32(0xe4788000), SPH_C32(0x859673c1), + SPH_C32(0xb5fb2452), SPH_C32(0x29cc5edf) }, + { SPH_C32(0x94b29000), SPH_C32(0x43f7a676), SPH_C32(0x5ffa40a9), + SPH_C32(0x4434618f), SPH_C32(0x2fd18000), SPH_C32(0x15b144a8), + SPH_C32(0x0e27d055), SPH_C32(0xf938f1be) }, + { SPH_C32(0x2b8e8000), SPH_C32(0x89fbd761), SPH_C32(0x6cdba985), + SPH_C32(0x8a264c7c), SPH_C32(0x5b449000), SPH_C32(0x4f9a02d6), + SPH_C32(0x86dacd7e), SPH_C32(0xe7de732c) }, + { SPH_C32(0x5f1b9000), SPH_C32(0xd3d0911f), SPH_C32(0xe426b4ae), + SPH_C32(0x94c0ceee), SPH_C32(0x90ed9000), SPH_C32(0xdfbd35bf), + SPH_C32(0x3d063979), SPH_C32(0x372adc4d) }, + { SPH_C32(0x090da000), SPH_C32(0xad8b6cf4), SPH_C32(0xc6fd67d5), + SPH_C32(0x671be639), SPH_C32(0x732b8000), SPH_C32(0xa5d91d12), + SPH_C32(0xc242cc5d), SPH_C32(0x8820001e) }, + { SPH_C32(0x7d98b000), SPH_C32(0xf7a02a8a), SPH_C32(0x4e007afe), + SPH_C32(0x79fd64ab), SPH_C32(0xb8828000), SPH_C32(0x35fe2a7b), + SPH_C32(0x799e385a), SPH_C32(0x58d4af7f) }, + { SPH_C32(0xc2a4a000), SPH_C32(0x3dac5b9d), SPH_C32(0x7d2193d2), + SPH_C32(0xb7ef4958), SPH_C32(0xcc179000), SPH_C32(0x6fd56c05), + SPH_C32(0xf1632571), SPH_C32(0x46322ded) }, + { SPH_C32(0xb631b000), SPH_C32(0x67871de3), SPH_C32(0xf5dc8ef9), + SPH_C32(0xa909cbca), SPH_C32(0x07be9000), SPH_C32(0xfff25b6c), + SPH_C32(0x4abfd176), SPH_C32(0x96c6828c) }, + { SPH_C32(0x77748000), SPH_C32(0x39938edb), SPH_C32(0xa0beb58d), + SPH_C32(0xfb3ebddc), SPH_C32(0x9a01a000), SPH_C32(0x118e91ee), + SPH_C32(0xd3b8f60a), SPH_C32(0xb5e9053a) }, + { SPH_C32(0x03e19000), SPH_C32(0x63b8c8a5), SPH_C32(0x2843a8a6), + SPH_C32(0xe5d83f4e), SPH_C32(0x51a8a000), SPH_C32(0x81a9a687), + SPH_C32(0x6864020d), SPH_C32(0x651daa5b) }, + { SPH_C32(0xbcdd8000), SPH_C32(0xa9b4b9b2), SPH_C32(0x1b62418a), + SPH_C32(0x2bca12bd), SPH_C32(0x253db000), SPH_C32(0xdb82e0f9), + SPH_C32(0xe0991f26), SPH_C32(0x7bfb28c9) }, + { SPH_C32(0xc8489000), SPH_C32(0xf39fffcc), SPH_C32(0x939f5ca1), + SPH_C32(0x352c902f), SPH_C32(0xee94b000), SPH_C32(0x4ba5d790), + SPH_C32(0x5b45eb21), SPH_C32(0xab0f87a8) }, + { SPH_C32(0x9e5ea000), SPH_C32(0x8dc40227), SPH_C32(0xb1448fda), + SPH_C32(0xc6f7b8f8), SPH_C32(0x0d52a000), SPH_C32(0x31c1ff3d), + SPH_C32(0xa4011e05), SPH_C32(0x14055bfb) }, + { SPH_C32(0xeacbb000), SPH_C32(0xd7ef4459), SPH_C32(0x39b992f1), + SPH_C32(0xd8113a6a), SPH_C32(0xc6fba000), SPH_C32(0xa1e6c854), + SPH_C32(0x1fddea02), SPH_C32(0xc4f1f49a) }, + { SPH_C32(0x55f7a000), SPH_C32(0x1de3354e), SPH_C32(0x0a987bdd), + SPH_C32(0x16031799), SPH_C32(0xb26eb000), SPH_C32(0xfbcd8e2a), + SPH_C32(0x9720f729), SPH_C32(0xda177608) }, + { SPH_C32(0x2162b000), SPH_C32(0x47c87330), SPH_C32(0x826566f6), + SPH_C32(0x08e5950b), SPH_C32(0x79c7b000), SPH_C32(0x6beab943), + SPH_C32(0x2cfc032e), SPH_C32(0x0ae3d969) }, + { SPH_C32(0xf23cc000), SPH_C32(0x42cb39e0), SPH_C32(0x5afd9229), + SPH_C32(0x94e42f6f), SPH_C32(0x022f8000), SPH_C32(0xce2549e4), + SPH_C32(0x317ebce8), SPH_C32(0x398d5ee1) }, + { SPH_C32(0x86a9d000), SPH_C32(0x18e07f9e), SPH_C32(0xd2008f02), + SPH_C32(0x8a02adfd), SPH_C32(0xc9868000), SPH_C32(0x5e027e8d), + SPH_C32(0x8aa248ef), SPH_C32(0xe979f180) }, + { SPH_C32(0x3995c000), SPH_C32(0xd2ec0e89), SPH_C32(0xe121662e), + SPH_C32(0x4410800e), SPH_C32(0xbd139000), SPH_C32(0x042938f3), + SPH_C32(0x025f55c4), SPH_C32(0xf79f7312) }, + { SPH_C32(0x4d00d000), SPH_C32(0x88c748f7), SPH_C32(0x69dc7b05), + SPH_C32(0x5af6029c), SPH_C32(0x76ba9000), SPH_C32(0x940e0f9a), + SPH_C32(0xb983a1c3), SPH_C32(0x276bdc73) }, + { SPH_C32(0x1b16e000), SPH_C32(0xf69cb51c), SPH_C32(0x4b07a87e), + SPH_C32(0xa92d2a4b), SPH_C32(0x957c8000), SPH_C32(0xee6a2737), + SPH_C32(0x46c754e7), SPH_C32(0x98610020) }, + { SPH_C32(0x6f83f000), SPH_C32(0xacb7f362), SPH_C32(0xc3fab555), + SPH_C32(0xb7cba8d9), SPH_C32(0x5ed58000), SPH_C32(0x7e4d105e), + SPH_C32(0xfd1ba0e0), SPH_C32(0x4895af41) }, + { SPH_C32(0xd0bfe000), SPH_C32(0x66bb8275), SPH_C32(0xf0db5c79), + SPH_C32(0x79d9852a), SPH_C32(0x2a409000), SPH_C32(0x24665620), + SPH_C32(0x75e6bdcb), SPH_C32(0x56732dd3) }, + { SPH_C32(0xa42af000), SPH_C32(0x3c90c40b), SPH_C32(0x78264152), + SPH_C32(0x673f07b8), SPH_C32(0xe1e99000), SPH_C32(0xb4416149), + SPH_C32(0xce3a49cc), SPH_C32(0x868782b2) }, + { SPH_C32(0x656fc000), SPH_C32(0x62845733), SPH_C32(0x2d447a26), + SPH_C32(0x350871ae), SPH_C32(0x7c56a000), SPH_C32(0x5a3dabcb), + SPH_C32(0x573d6eb0), SPH_C32(0xa5a80504) }, + { SPH_C32(0x11fad000), SPH_C32(0x38af114d), SPH_C32(0xa5b9670d), + SPH_C32(0x2beef33c), SPH_C32(0xb7ffa000), SPH_C32(0xca1a9ca2), + SPH_C32(0xece19ab7), SPH_C32(0x755caa65) }, + { SPH_C32(0xaec6c000), SPH_C32(0xf2a3605a), SPH_C32(0x96988e21), + SPH_C32(0xe5fcdecf), SPH_C32(0xc36ab000), SPH_C32(0x9031dadc), + SPH_C32(0x641c879c), SPH_C32(0x6bba28f7) }, + { SPH_C32(0xda53d000), SPH_C32(0xa8882624), SPH_C32(0x1e65930a), + SPH_C32(0xfb1a5c5d), SPH_C32(0x08c3b000), SPH_C32(0x0016edb5), + SPH_C32(0xdfc0739b), SPH_C32(0xbb4e8796) }, + { SPH_C32(0x8c45e000), SPH_C32(0xd6d3dbcf), SPH_C32(0x3cbe4071), + SPH_C32(0x08c1748a), SPH_C32(0xeb05a000), SPH_C32(0x7a72c518), + SPH_C32(0x208486bf), SPH_C32(0x04445bc5) }, + { SPH_C32(0xf8d0f000), SPH_C32(0x8cf89db1), SPH_C32(0xb4435d5a), + SPH_C32(0x1627f618), SPH_C32(0x20aca000), SPH_C32(0xea55f271), + SPH_C32(0x9b5872b8), SPH_C32(0xd4b0f4a4) }, + { SPH_C32(0x47ece000), SPH_C32(0x46f4eca6), SPH_C32(0x8762b476), + SPH_C32(0xd835dbeb), SPH_C32(0x5439b000), SPH_C32(0xb07eb40f), + SPH_C32(0x13a56f93), SPH_C32(0xca567636) }, + { SPH_C32(0x3379f000), SPH_C32(0x1cdfaad8), SPH_C32(0x0f9fa95d), + SPH_C32(0xc6d35979), SPH_C32(0x9f90b000), SPH_C32(0x20598366), + SPH_C32(0xa8799b94), SPH_C32(0x1aa2d957) }, + { SPH_C32(0x06708000), SPH_C32(0x526fda2d), SPH_C32(0x5382c538), + SPH_C32(0x4a93e323), SPH_C32(0x1034c000), SPH_C32(0x9532900c), + SPH_C32(0xbc847343), SPH_C32(0xf7bb9293) }, + { SPH_C32(0x72e59000), SPH_C32(0x08449c53), SPH_C32(0xdb7fd813), + SPH_C32(0x547561b1), SPH_C32(0xdb9dc000), SPH_C32(0x0515a765), + SPH_C32(0x07588744), SPH_C32(0x274f3df2) }, + { SPH_C32(0xcdd98000), SPH_C32(0xc248ed44), SPH_C32(0xe85e313f), + SPH_C32(0x9a674c42), SPH_C32(0xaf08d000), SPH_C32(0x5f3ee11b), + SPH_C32(0x8fa59a6f), SPH_C32(0x39a9bf60) }, + { SPH_C32(0xb94c9000), SPH_C32(0x9863ab3a), SPH_C32(0x60a32c14), + SPH_C32(0x8481ced0), SPH_C32(0x64a1d000), SPH_C32(0xcf19d672), + SPH_C32(0x34796e68), SPH_C32(0xe95d1001) }, + { SPH_C32(0xef5aa000), SPH_C32(0xe63856d1), SPH_C32(0x4278ff6f), + SPH_C32(0x775ae607), SPH_C32(0x8767c000), SPH_C32(0xb57dfedf), + SPH_C32(0xcb3d9b4c), SPH_C32(0x5657cc52) }, + { SPH_C32(0x9bcfb000), SPH_C32(0xbc1310af), SPH_C32(0xca85e244), + SPH_C32(0x69bc6495), SPH_C32(0x4ccec000), SPH_C32(0x255ac9b6), + SPH_C32(0x70e16f4b), SPH_C32(0x86a36333) }, + { SPH_C32(0x24f3a000), SPH_C32(0x761f61b8), SPH_C32(0xf9a40b68), + SPH_C32(0xa7ae4966), SPH_C32(0x385bd000), SPH_C32(0x7f718fc8), + SPH_C32(0xf81c7260), SPH_C32(0x9845e1a1) }, + { SPH_C32(0x5066b000), SPH_C32(0x2c3427c6), SPH_C32(0x71591643), + SPH_C32(0xb948cbf4), SPH_C32(0xf3f2d000), SPH_C32(0xef56b8a1), + SPH_C32(0x43c08667), SPH_C32(0x48b14ec0) }, + { SPH_C32(0x91238000), SPH_C32(0x7220b4fe), SPH_C32(0x243b2d37), + SPH_C32(0xeb7fbde2), SPH_C32(0x6e4de000), SPH_C32(0x012a7223), + SPH_C32(0xdac7a11b), SPH_C32(0x6b9ec976) }, + { SPH_C32(0xe5b69000), SPH_C32(0x280bf280), SPH_C32(0xacc6301c), + SPH_C32(0xf5993f70), SPH_C32(0xa5e4e000), SPH_C32(0x910d454a), + SPH_C32(0x611b551c), SPH_C32(0xbb6a6617) }, + { SPH_C32(0x5a8a8000), SPH_C32(0xe2078397), SPH_C32(0x9fe7d930), + SPH_C32(0x3b8b1283), SPH_C32(0xd171f000), SPH_C32(0xcb260334), + SPH_C32(0xe9e64837), SPH_C32(0xa58ce485) }, + { SPH_C32(0x2e1f9000), SPH_C32(0xb82cc5e9), SPH_C32(0x171ac41b), + SPH_C32(0x256d9011), SPH_C32(0x1ad8f000), SPH_C32(0x5b01345d), + SPH_C32(0x523abc30), SPH_C32(0x75784be4) }, + { SPH_C32(0x7809a000), SPH_C32(0xc6773802), SPH_C32(0x35c11760), + SPH_C32(0xd6b6b8c6), SPH_C32(0xf91ee000), SPH_C32(0x21651cf0), + SPH_C32(0xad7e4914), SPH_C32(0xca7297b7) }, + { SPH_C32(0x0c9cb000), SPH_C32(0x9c5c7e7c), SPH_C32(0xbd3c0a4b), + SPH_C32(0xc8503a54), SPH_C32(0x32b7e000), SPH_C32(0xb1422b99), + SPH_C32(0x16a2bd13), SPH_C32(0x1a8638d6) }, + { SPH_C32(0xb3a0a000), SPH_C32(0x56500f6b), SPH_C32(0x8e1de367), + SPH_C32(0x064217a7), SPH_C32(0x4622f000), SPH_C32(0xeb696de7), + SPH_C32(0x9e5fa038), SPH_C32(0x0460ba44) }, + { SPH_C32(0xc735b000), SPH_C32(0x0c7b4915), SPH_C32(0x06e0fe4c), + SPH_C32(0x18a49535), SPH_C32(0x8d8bf000), SPH_C32(0x7b4e5a8e), + SPH_C32(0x2583543f), SPH_C32(0xd4941525) }, + { SPH_C32(0x146bc000), SPH_C32(0x097803c5), SPH_C32(0xde780a93), + SPH_C32(0x84a52f51), SPH_C32(0xf663c000), SPH_C32(0xde81aa29), + SPH_C32(0x3801ebf9), SPH_C32(0xe7fa92ad) }, + { SPH_C32(0x60fed000), SPH_C32(0x535345bb), SPH_C32(0x568517b8), + SPH_C32(0x9a43adc3), SPH_C32(0x3dcac000), SPH_C32(0x4ea69d40), + SPH_C32(0x83dd1ffe), SPH_C32(0x370e3dcc) }, + { SPH_C32(0xdfc2c000), SPH_C32(0x995f34ac), SPH_C32(0x65a4fe94), + SPH_C32(0x54518030), SPH_C32(0x495fd000), SPH_C32(0x148ddb3e), + SPH_C32(0x0b2002d5), SPH_C32(0x29e8bf5e) }, + { SPH_C32(0xab57d000), SPH_C32(0xc37472d2), SPH_C32(0xed59e3bf), + SPH_C32(0x4ab702a2), SPH_C32(0x82f6d000), SPH_C32(0x84aaec57), + SPH_C32(0xb0fcf6d2), SPH_C32(0xf91c103f) }, + { SPH_C32(0xfd41e000), SPH_C32(0xbd2f8f39), SPH_C32(0xcf8230c4), + SPH_C32(0xb96c2a75), SPH_C32(0x6130c000), SPH_C32(0xfecec4fa), + SPH_C32(0x4fb803f6), SPH_C32(0x4616cc6c) }, + { SPH_C32(0x89d4f000), SPH_C32(0xe704c947), SPH_C32(0x477f2def), + SPH_C32(0xa78aa8e7), SPH_C32(0xaa99c000), SPH_C32(0x6ee9f393), + SPH_C32(0xf464f7f1), SPH_C32(0x96e2630d) }, + { SPH_C32(0x36e8e000), SPH_C32(0x2d08b850), SPH_C32(0x745ec4c3), + SPH_C32(0x69988514), SPH_C32(0xde0cd000), SPH_C32(0x34c2b5ed), + SPH_C32(0x7c99eada), SPH_C32(0x8804e19f) }, + { SPH_C32(0x427df000), SPH_C32(0x7723fe2e), SPH_C32(0xfca3d9e8), + SPH_C32(0x777e0786), SPH_C32(0x15a5d000), SPH_C32(0xa4e58284), + SPH_C32(0xc7451edd), SPH_C32(0x58f04efe) }, + { SPH_C32(0x8338c000), SPH_C32(0x29376d16), SPH_C32(0xa9c1e29c), + SPH_C32(0x25497190), SPH_C32(0x881ae000), SPH_C32(0x4a994806), + SPH_C32(0x5e4239a1), SPH_C32(0x7bdfc948) }, + { SPH_C32(0xf7add000), SPH_C32(0x731c2b68), SPH_C32(0x213cffb7), + SPH_C32(0x3baff302), SPH_C32(0x43b3e000), SPH_C32(0xdabe7f6f), + SPH_C32(0xe59ecda6), SPH_C32(0xab2b6629) }, + { SPH_C32(0x4891c000), SPH_C32(0xb9105a7f), SPH_C32(0x121d169b), + SPH_C32(0xf5bddef1), SPH_C32(0x3726f000), SPH_C32(0x80953911), + SPH_C32(0x6d63d08d), SPH_C32(0xb5cde4bb) }, + { SPH_C32(0x3c04d000), SPH_C32(0xe33b1c01), SPH_C32(0x9ae00bb0), + SPH_C32(0xeb5b5c63), SPH_C32(0xfc8ff000), SPH_C32(0x10b20e78), + SPH_C32(0xd6bf248a), SPH_C32(0x65394bda) }, + { SPH_C32(0x6a12e000), SPH_C32(0x9d60e1ea), SPH_C32(0xb83bd8cb), + SPH_C32(0x188074b4), SPH_C32(0x1f49e000), SPH_C32(0x6ad626d5), + SPH_C32(0x29fbd1ae), SPH_C32(0xda339789) }, + { SPH_C32(0x1e87f000), SPH_C32(0xc74ba794), SPH_C32(0x30c6c5e0), + SPH_C32(0x0666f626), SPH_C32(0xd4e0e000), SPH_C32(0xfaf111bc), + SPH_C32(0x922725a9), SPH_C32(0x0ac738e8) }, + { SPH_C32(0xa1bbe000), SPH_C32(0x0d47d683), SPH_C32(0x03e72ccc), + SPH_C32(0xc874dbd5), SPH_C32(0xa075f000), SPH_C32(0xa0da57c2), + SPH_C32(0x1ada3882), SPH_C32(0x1421ba7a) }, + { SPH_C32(0xd52ef000), SPH_C32(0x576c90fd), SPH_C32(0x8b1a31e7), + SPH_C32(0xd6925947), SPH_C32(0x6bdcf000), SPH_C32(0x30fd60ab), + SPH_C32(0xa106cc85), SPH_C32(0xc4d5151b) } +}; + +static const sph_u32 T256_8[256][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), SPH_C32(0x8589d8ab), + SPH_C32(0xe6c46464), SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), + SPH_C32(0xa29d1297), SPH_C32(0x6ee56854) }, + { SPH_C32(0x734c0000), SPH_C32(0x956fa7d6), SPH_C32(0xa29d1297), + SPH_C32(0x6ee56854), SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), + SPH_C32(0x2714ca3c), SPH_C32(0x88210c30) }, + { SPH_C32(0xc4e80100), SPH_C32(0x1f70960e), SPH_C32(0x2714ca3c), + SPH_C32(0x88210c30), SPH_C32(0xb7a40100), SPH_C32(0x8a1f31d8), + SPH_C32(0x8589d8ab), SPH_C32(0xe6c46464) }, + { SPH_C32(0xa7b80200), SPH_C32(0x1f128433), SPH_C32(0x60e5f9f2), + SPH_C32(0x9e147576), SPH_C32(0xee260000), SPH_C32(0x124b683e), + SPH_C32(0x80c2d68f), SPH_C32(0x3bf3ab2c) }, + { SPH_C32(0x101c0300), SPH_C32(0x950db5eb), SPH_C32(0xe56c2159), + SPH_C32(0x78d01112), SPH_C32(0x9d6a0000), SPH_C32(0x8724cfe8), + SPH_C32(0x225fc418), SPH_C32(0x5516c378) }, + { SPH_C32(0xd4f40200), SPH_C32(0x8a7d23e5), SPH_C32(0xc278eb65), + SPH_C32(0xf0f11d22), SPH_C32(0x2ace0100), SPH_C32(0x0d3bfe30), + SPH_C32(0xa7d61cb3), SPH_C32(0xb3d2a71c) }, + { SPH_C32(0x63500300), SPH_C32(0x0062123d), SPH_C32(0x47f133ce), + SPH_C32(0x16357946), SPH_C32(0x59820100), SPH_C32(0x985459e6), + SPH_C32(0x054b0e24), SPH_C32(0xdd37cf48) }, + { SPH_C32(0xee260000), SPH_C32(0x124b683e), SPH_C32(0x80c2d68f), + SPH_C32(0x3bf3ab2c), SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), + SPH_C32(0xe0272f7d), SPH_C32(0xa5e7de5a) }, + { SPH_C32(0x59820100), SPH_C32(0x985459e6), SPH_C32(0x054b0e24), + SPH_C32(0xdd37cf48), SPH_C32(0x3ad20200), SPH_C32(0x98364bdb), + SPH_C32(0x42ba3dea), SPH_C32(0xcb02b60e) }, + { SPH_C32(0x9d6a0000), SPH_C32(0x8724cfe8), SPH_C32(0x225fc418), + SPH_C32(0x5516c378), SPH_C32(0x8d760300), SPH_C32(0x12297a03), + SPH_C32(0xc733e541), SPH_C32(0x2dc6d26a) }, + { SPH_C32(0x2ace0100), SPH_C32(0x0d3bfe30), SPH_C32(0xa7d61cb3), + SPH_C32(0xb3d2a71c), SPH_C32(0xfe3a0300), SPH_C32(0x8746ddd5), + SPH_C32(0x65aef7d6), SPH_C32(0x4323ba3e) }, + { SPH_C32(0x499e0200), SPH_C32(0x0d59ec0d), SPH_C32(0xe0272f7d), + SPH_C32(0xa5e7de5a), SPH_C32(0xa7b80200), SPH_C32(0x1f128433), + SPH_C32(0x60e5f9f2), SPH_C32(0x9e147576) }, + { SPH_C32(0xfe3a0300), SPH_C32(0x8746ddd5), SPH_C32(0x65aef7d6), + SPH_C32(0x4323ba3e), SPH_C32(0xd4f40200), SPH_C32(0x8a7d23e5), + SPH_C32(0xc278eb65), SPH_C32(0xf0f11d22) }, + { SPH_C32(0x3ad20200), SPH_C32(0x98364bdb), SPH_C32(0x42ba3dea), + SPH_C32(0xcb02b60e), SPH_C32(0x63500300), SPH_C32(0x0062123d), + SPH_C32(0x47f133ce), SPH_C32(0x16357946) }, + { SPH_C32(0x8d760300), SPH_C32(0x12297a03), SPH_C32(0xc733e541), + SPH_C32(0x2dc6d26a), SPH_C32(0x101c0300), SPH_C32(0x950db5eb), + SPH_C32(0xe56c2159), SPH_C32(0x78d01112) }, + { SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), SPH_C32(0x6fc548e1), + SPH_C32(0x898d2cd6), SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), + SPH_C32(0x6a72e5bb), SPH_C32(0x247febe6) }, + { SPH_C32(0x389a0500), SPH_C32(0x8782f9af), SPH_C32(0xea4c904a), + SPH_C32(0x6f4948b2), SPH_C32(0x67f10000), SPH_C32(0xbad59029), + SPH_C32(0xc8eff72c), SPH_C32(0x4a9a83b2) }, + { SPH_C32(0xfc720400), SPH_C32(0x98f26fa1), SPH_C32(0xcd585a76), + SPH_C32(0xe7684482), SPH_C32(0xd0550100), SPH_C32(0x30caa1f1), + SPH_C32(0x4d662f87), SPH_C32(0xac5ee7d6) }, + { SPH_C32(0x4bd60500), SPH_C32(0x12ed5e79), SPH_C32(0x48d182dd), + SPH_C32(0x01ac20e6), SPH_C32(0xa3190100), SPH_C32(0xa5a50627), + SPH_C32(0xeffb3d10), SPH_C32(0xc2bb8f82) }, + { SPH_C32(0x28860600), SPH_C32(0x128f4c44), SPH_C32(0x0f20b113), + SPH_C32(0x179959a0), SPH_C32(0xfa9b0000), SPH_C32(0x3df15fc1), + SPH_C32(0xeab03334), SPH_C32(0x1f8c40ca) }, + { SPH_C32(0x9f220700), SPH_C32(0x98907d9c), SPH_C32(0x8aa969b8), + SPH_C32(0xf15d3dc4), SPH_C32(0x89d70000), SPH_C32(0xa89ef817), + SPH_C32(0x482d21a3), SPH_C32(0x7169289e) }, + { SPH_C32(0x5bca0600), SPH_C32(0x87e0eb92), SPH_C32(0xadbda384), + SPH_C32(0x797c31f4), SPH_C32(0x3e730100), SPH_C32(0x2281c9cf), + SPH_C32(0xcda4f908), SPH_C32(0x97ad4cfa) }, + { SPH_C32(0xec6e0700), SPH_C32(0x0dffda4a), SPH_C32(0x28347b2f), + SPH_C32(0x9fb85590), SPH_C32(0x4d3f0100), SPH_C32(0xb7ee6e19), + SPH_C32(0x6f39eb9f), SPH_C32(0xf94824ae) }, + { SPH_C32(0x61180400), SPH_C32(0x1fd6a049), SPH_C32(0xef079e6e), + SPH_C32(0xb27e87fa), SPH_C32(0x5d230200), SPH_C32(0x22e3dbf2), + SPH_C32(0x8a55cac6), SPH_C32(0x819835bc) }, + { SPH_C32(0xd6bc0500), SPH_C32(0x95c99191), SPH_C32(0x6a8e46c5), + SPH_C32(0x54bae39e), SPH_C32(0x2e6f0200), SPH_C32(0xb78c7c24), + SPH_C32(0x28c8d851), SPH_C32(0xef7d5de8) }, + { SPH_C32(0x12540400), SPH_C32(0x8ab9079f), SPH_C32(0x4d9a8cf9), + SPH_C32(0xdc9befae), SPH_C32(0x99cb0300), SPH_C32(0x3d934dfc), + SPH_C32(0xad4100fa), SPH_C32(0x09b9398c) }, + { SPH_C32(0xa5f00500), SPH_C32(0x00a63647), SPH_C32(0xc8135452), + SPH_C32(0x3a5f8bca), SPH_C32(0xea870300), SPH_C32(0xa8fcea2a), + SPH_C32(0x0fdc126d), SPH_C32(0x675c51d8) }, + { SPH_C32(0xc6a00600), SPH_C32(0x00c4247a), SPH_C32(0x8fe2679c), + SPH_C32(0x2c6af28c), SPH_C32(0xb3050200), SPH_C32(0x30a8b3cc), + SPH_C32(0x0a971c49), SPH_C32(0xba6b9e90) }, + { SPH_C32(0x71040700), SPH_C32(0x8adb15a2), SPH_C32(0x0a6bbf37), + SPH_C32(0xcaae96e8), SPH_C32(0xc0490200), SPH_C32(0xa5c7141a), + SPH_C32(0xa80a0ede), SPH_C32(0xd48ef6c4) }, + { SPH_C32(0xb5ec0600), SPH_C32(0x95ab83ac), SPH_C32(0x2d7f750b), + SPH_C32(0x428f9ad8), SPH_C32(0x77ed0300), SPH_C32(0x2fd825c2), + SPH_C32(0x2d83d675), SPH_C32(0x324a92a0) }, + { SPH_C32(0x02480700), SPH_C32(0x1fb4b274), SPH_C32(0xa8f6ada0), + SPH_C32(0xa44bfebc), SPH_C32(0x04a10300), SPH_C32(0xbab78214), + SPH_C32(0x8f1ec4e2), SPH_C32(0x5caffaf4) }, + { SPH_C32(0x14bd0000), SPH_C32(0x2fba37ff), SPH_C32(0x6a72e5bb), + SPH_C32(0x247febe6), SPH_C32(0x9b830400), SPH_C32(0x2227ff88), + SPH_C32(0x05b7ad5a), SPH_C32(0xadf2c730) }, + { SPH_C32(0xa3190100), SPH_C32(0xa5a50627), SPH_C32(0xeffb3d10), + SPH_C32(0xc2bb8f82), SPH_C32(0xe8cf0400), SPH_C32(0xb748585e), + SPH_C32(0xa72abfcd), SPH_C32(0xc317af64) }, + { SPH_C32(0x67f10000), SPH_C32(0xbad59029), SPH_C32(0xc8eff72c), + SPH_C32(0x4a9a83b2), SPH_C32(0x5f6b0500), SPH_C32(0x3d576986), + SPH_C32(0x22a36766), SPH_C32(0x25d3cb00) }, + { SPH_C32(0xd0550100), SPH_C32(0x30caa1f1), SPH_C32(0x4d662f87), + SPH_C32(0xac5ee7d6), SPH_C32(0x2c270500), SPH_C32(0xa838ce50), + SPH_C32(0x803e75f1), SPH_C32(0x4b36a354) }, + { SPH_C32(0xb3050200), SPH_C32(0x30a8b3cc), SPH_C32(0x0a971c49), + SPH_C32(0xba6b9e90), SPH_C32(0x75a50400), SPH_C32(0x306c97b6), + SPH_C32(0x85757bd5), SPH_C32(0x96016c1c) }, + { SPH_C32(0x04a10300), SPH_C32(0xbab78214), SPH_C32(0x8f1ec4e2), + SPH_C32(0x5caffaf4), SPH_C32(0x06e90400), SPH_C32(0xa5033060), + SPH_C32(0x27e86942), SPH_C32(0xf8e40448) }, + { SPH_C32(0xc0490200), SPH_C32(0xa5c7141a), SPH_C32(0xa80a0ede), + SPH_C32(0xd48ef6c4), SPH_C32(0xb14d0500), SPH_C32(0x2f1c01b8), + SPH_C32(0xa261b1e9), SPH_C32(0x1e20602c) }, + { SPH_C32(0x77ed0300), SPH_C32(0x2fd825c2), SPH_C32(0x2d83d675), + SPH_C32(0x324a92a0), SPH_C32(0xc2010500), SPH_C32(0xba73a66e), + SPH_C32(0x00fca37e), SPH_C32(0x70c50878) }, + { SPH_C32(0xfa9b0000), SPH_C32(0x3df15fc1), SPH_C32(0xeab03334), + SPH_C32(0x1f8c40ca), SPH_C32(0xd21d0600), SPH_C32(0x2f7e1385), + SPH_C32(0xe5908227), SPH_C32(0x0815196a) }, + { SPH_C32(0x4d3f0100), SPH_C32(0xb7ee6e19), SPH_C32(0x6f39eb9f), + SPH_C32(0xf94824ae), SPH_C32(0xa1510600), SPH_C32(0xba11b453), + SPH_C32(0x470d90b0), SPH_C32(0x66f0713e) }, + { SPH_C32(0x89d70000), SPH_C32(0xa89ef817), SPH_C32(0x482d21a3), + SPH_C32(0x7169289e), SPH_C32(0x16f50700), SPH_C32(0x300e858b), + SPH_C32(0xc284481b), SPH_C32(0x8034155a) }, + { SPH_C32(0x3e730100), SPH_C32(0x2281c9cf), SPH_C32(0xcda4f908), + SPH_C32(0x97ad4cfa), SPH_C32(0x65b90700), SPH_C32(0xa561225d), + SPH_C32(0x60195a8c), SPH_C32(0xeed17d0e) }, + { SPH_C32(0x5d230200), SPH_C32(0x22e3dbf2), SPH_C32(0x8a55cac6), + SPH_C32(0x819835bc), SPH_C32(0x3c3b0600), SPH_C32(0x3d357bbb), + SPH_C32(0x655254a8), SPH_C32(0x33e6b246) }, + { SPH_C32(0xea870300), SPH_C32(0xa8fcea2a), SPH_C32(0x0fdc126d), + SPH_C32(0x675c51d8), SPH_C32(0x4f770600), SPH_C32(0xa85adc6d), + SPH_C32(0xc7cf463f), SPH_C32(0x5d03da12) }, + { SPH_C32(0x2e6f0200), SPH_C32(0xb78c7c24), SPH_C32(0x28c8d851), + SPH_C32(0xef7d5de8), SPH_C32(0xf8d30700), SPH_C32(0x2245edb5), + SPH_C32(0x42469e94), SPH_C32(0xbbc7be76) }, + { SPH_C32(0x99cb0300), SPH_C32(0x3d934dfc), SPH_C32(0xad4100fa), + SPH_C32(0x09b9398c), SPH_C32(0x8b9f0700), SPH_C32(0xb72a4a63), + SPH_C32(0xe0db8c03), SPH_C32(0xd522d622) }, + { SPH_C32(0x9b830400), SPH_C32(0x2227ff88), SPH_C32(0x05b7ad5a), + SPH_C32(0xadf2c730), SPH_C32(0x8f3e0400), SPH_C32(0x0d9dc877), + SPH_C32(0x6fc548e1), SPH_C32(0x898d2cd6) }, + { SPH_C32(0x2c270500), SPH_C32(0xa838ce50), SPH_C32(0x803e75f1), + SPH_C32(0x4b36a354), SPH_C32(0xfc720400), SPH_C32(0x98f26fa1), + SPH_C32(0xcd585a76), SPH_C32(0xe7684482) }, + { SPH_C32(0xe8cf0400), SPH_C32(0xb748585e), SPH_C32(0xa72abfcd), + SPH_C32(0xc317af64), SPH_C32(0x4bd60500), SPH_C32(0x12ed5e79), + SPH_C32(0x48d182dd), SPH_C32(0x01ac20e6) }, + { SPH_C32(0x5f6b0500), SPH_C32(0x3d576986), SPH_C32(0x22a36766), + SPH_C32(0x25d3cb00), SPH_C32(0x389a0500), SPH_C32(0x8782f9af), + SPH_C32(0xea4c904a), SPH_C32(0x6f4948b2) }, + { SPH_C32(0x3c3b0600), SPH_C32(0x3d357bbb), SPH_C32(0x655254a8), + SPH_C32(0x33e6b246), SPH_C32(0x61180400), SPH_C32(0x1fd6a049), + SPH_C32(0xef079e6e), SPH_C32(0xb27e87fa) }, + { SPH_C32(0x8b9f0700), SPH_C32(0xb72a4a63), SPH_C32(0xe0db8c03), + SPH_C32(0xd522d622), SPH_C32(0x12540400), SPH_C32(0x8ab9079f), + SPH_C32(0x4d9a8cf9), SPH_C32(0xdc9befae) }, + { SPH_C32(0x4f770600), SPH_C32(0xa85adc6d), SPH_C32(0xc7cf463f), + SPH_C32(0x5d03da12), SPH_C32(0xa5f00500), SPH_C32(0x00a63647), + SPH_C32(0xc8135452), SPH_C32(0x3a5f8bca) }, + { SPH_C32(0xf8d30700), SPH_C32(0x2245edb5), SPH_C32(0x42469e94), + SPH_C32(0xbbc7be76), SPH_C32(0xd6bc0500), SPH_C32(0x95c99191), + SPH_C32(0x6a8e46c5), SPH_C32(0x54bae39e) }, + { SPH_C32(0x75a50400), SPH_C32(0x306c97b6), SPH_C32(0x85757bd5), + SPH_C32(0x96016c1c), SPH_C32(0xc6a00600), SPH_C32(0x00c4247a), + SPH_C32(0x8fe2679c), SPH_C32(0x2c6af28c) }, + { SPH_C32(0xc2010500), SPH_C32(0xba73a66e), SPH_C32(0x00fca37e), + SPH_C32(0x70c50878), SPH_C32(0xb5ec0600), SPH_C32(0x95ab83ac), + SPH_C32(0x2d7f750b), SPH_C32(0x428f9ad8) }, + { SPH_C32(0x06e90400), SPH_C32(0xa5033060), SPH_C32(0x27e86942), + SPH_C32(0xf8e40448), SPH_C32(0x02480700), SPH_C32(0x1fb4b274), + SPH_C32(0xa8f6ada0), SPH_C32(0xa44bfebc) }, + { SPH_C32(0xb14d0500), SPH_C32(0x2f1c01b8), SPH_C32(0xa261b1e9), + SPH_C32(0x1e20602c), SPH_C32(0x71040700), SPH_C32(0x8adb15a2), + SPH_C32(0x0a6bbf37), SPH_C32(0xcaae96e8) }, + { SPH_C32(0xd21d0600), SPH_C32(0x2f7e1385), SPH_C32(0xe5908227), + SPH_C32(0x0815196a), SPH_C32(0x28860600), SPH_C32(0x128f4c44), + SPH_C32(0x0f20b113), SPH_C32(0x179959a0) }, + { SPH_C32(0x65b90700), SPH_C32(0xa561225d), SPH_C32(0x60195a8c), + SPH_C32(0xeed17d0e), SPH_C32(0x5bca0600), SPH_C32(0x87e0eb92), + SPH_C32(0xadbda384), SPH_C32(0x797c31f4) }, + { SPH_C32(0xa1510600), SPH_C32(0xba11b453), SPH_C32(0x470d90b0), + SPH_C32(0x66f0713e), SPH_C32(0xec6e0700), SPH_C32(0x0dffda4a), + SPH_C32(0x28347b2f), SPH_C32(0x9fb85590) }, + { SPH_C32(0x16f50700), SPH_C32(0x300e858b), SPH_C32(0xc284481b), + SPH_C32(0x8034155a), SPH_C32(0x9f220700), SPH_C32(0x98907d9c), + SPH_C32(0x8aa969b8), SPH_C32(0xf15d3dc4) }, + { SPH_C32(0xde320800), SPH_C32(0x288350fe), SPH_C32(0x71852ac7), + SPH_C32(0xa6bf9f96), SPH_C32(0xe18b0000), SPH_C32(0x5459887d), + SPH_C32(0xbf1283d3), SPH_C32(0x1b666a73) }, + { SPH_C32(0x69960900), SPH_C32(0xa29c6126), SPH_C32(0xf40cf26c), + SPH_C32(0x407bfbf2), SPH_C32(0x92c70000), SPH_C32(0xc1362fab), + SPH_C32(0x1d8f9144), SPH_C32(0x75830227) }, + { SPH_C32(0xad7e0800), SPH_C32(0xbdecf728), SPH_C32(0xd3183850), + SPH_C32(0xc85af7c2), SPH_C32(0x25630100), SPH_C32(0x4b291e73), + SPH_C32(0x980649ef), SPH_C32(0x93476643) }, + { SPH_C32(0x1ada0900), SPH_C32(0x37f3c6f0), SPH_C32(0x5691e0fb), + SPH_C32(0x2e9e93a6), SPH_C32(0x562f0100), SPH_C32(0xde46b9a5), + SPH_C32(0x3a9b5b78), SPH_C32(0xfda20e17) }, + { SPH_C32(0x798a0a00), SPH_C32(0x3791d4cd), SPH_C32(0x1160d335), + SPH_C32(0x38abeae0), SPH_C32(0x0fad0000), SPH_C32(0x4612e043), + SPH_C32(0x3fd0555c), SPH_C32(0x2095c15f) }, + { SPH_C32(0xce2e0b00), SPH_C32(0xbd8ee515), SPH_C32(0x94e90b9e), + SPH_C32(0xde6f8e84), SPH_C32(0x7ce10000), SPH_C32(0xd37d4795), + SPH_C32(0x9d4d47cb), SPH_C32(0x4e70a90b) }, + { SPH_C32(0x0ac60a00), SPH_C32(0xa2fe731b), SPH_C32(0xb3fdc1a2), + SPH_C32(0x564e82b4), SPH_C32(0xcb450100), SPH_C32(0x5962764d), + SPH_C32(0x18c49f60), SPH_C32(0xa8b4cd6f) }, + { SPH_C32(0xbd620b00), SPH_C32(0x28e142c3), SPH_C32(0x36741909), + SPH_C32(0xb08ae6d0), SPH_C32(0xb8090100), SPH_C32(0xcc0dd19b), + SPH_C32(0xba598df7), SPH_C32(0xc651a53b) }, + { SPH_C32(0x30140800), SPH_C32(0x3ac838c0), SPH_C32(0xf147fc48), + SPH_C32(0x9d4c34ba), SPH_C32(0xa8150200), SPH_C32(0x59006470), + SPH_C32(0x5f35acae), SPH_C32(0xbe81b429) }, + { SPH_C32(0x87b00900), SPH_C32(0xb0d70918), SPH_C32(0x74ce24e3), + SPH_C32(0x7b8850de), SPH_C32(0xdb590200), SPH_C32(0xcc6fc3a6), + SPH_C32(0xfda8be39), SPH_C32(0xd064dc7d) }, + { SPH_C32(0x43580800), SPH_C32(0xafa79f16), SPH_C32(0x53daeedf), + SPH_C32(0xf3a95cee), SPH_C32(0x6cfd0300), SPH_C32(0x4670f27e), + SPH_C32(0x78216692), SPH_C32(0x36a0b819) }, + { SPH_C32(0xf4fc0900), SPH_C32(0x25b8aece), SPH_C32(0xd6533674), + SPH_C32(0x156d388a), SPH_C32(0x1fb10300), SPH_C32(0xd31f55a8), + SPH_C32(0xdabc7405), SPH_C32(0x5845d04d) }, + { SPH_C32(0x97ac0a00), SPH_C32(0x25dabcf3), SPH_C32(0x91a205ba), + SPH_C32(0x035841cc), SPH_C32(0x46330200), SPH_C32(0x4b4b0c4e), + SPH_C32(0xdff77a21), SPH_C32(0x85721f05) }, + { SPH_C32(0x20080b00), SPH_C32(0xafc58d2b), SPH_C32(0x142bdd11), + SPH_C32(0xe59c25a8), SPH_C32(0x357f0200), SPH_C32(0xde24ab98), + SPH_C32(0x7d6a68b6), SPH_C32(0xeb977751) }, + { SPH_C32(0xe4e00a00), SPH_C32(0xb0b51b25), SPH_C32(0x333f172d), + SPH_C32(0x6dbd2998), SPH_C32(0x82db0300), SPH_C32(0x543b9a40), + SPH_C32(0xf8e3b01d), SPH_C32(0x0d531335) }, + { SPH_C32(0x53440b00), SPH_C32(0x3aaa2afd), SPH_C32(0xb6b6cf86), + SPH_C32(0x8b794dfc), SPH_C32(0xf1970300), SPH_C32(0xc1543d96), + SPH_C32(0x5a7ea28a), SPH_C32(0x63b67b61) }, + { SPH_C32(0x510c0c00), SPH_C32(0x251e9889), SPH_C32(0x1e406226), + SPH_C32(0x2f32b340), SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), + SPH_C32(0xd5606668), SPH_C32(0x3f198195) }, + { SPH_C32(0xe6a80d00), SPH_C32(0xaf01a951), SPH_C32(0x9bc9ba8d), + SPH_C32(0xc9f6d724), SPH_C32(0x867a0000), SPH_C32(0xee8c1854), + SPH_C32(0x77fd74ff), SPH_C32(0x51fce9c1) }, + { SPH_C32(0x22400c00), SPH_C32(0xb0713f5f), SPH_C32(0xbcdd70b1), + SPH_C32(0x41d7db14), SPH_C32(0x31de0100), SPH_C32(0x6493298c), + SPH_C32(0xf274ac54), SPH_C32(0xb7388da5) }, + { SPH_C32(0x95e40d00), SPH_C32(0x3a6e0e87), SPH_C32(0x3954a81a), + SPH_C32(0xa713bf70), SPH_C32(0x42920100), SPH_C32(0xf1fc8e5a), + SPH_C32(0x50e9bec3), SPH_C32(0xd9dde5f1) }, + { SPH_C32(0xf6b40e00), SPH_C32(0x3a0c1cba), SPH_C32(0x7ea59bd4), + SPH_C32(0xb126c636), SPH_C32(0x1b100000), SPH_C32(0x69a8d7bc), + SPH_C32(0x55a2b0e7), SPH_C32(0x04ea2ab9) }, + { SPH_C32(0x41100f00), SPH_C32(0xb0132d62), SPH_C32(0xfb2c437f), + SPH_C32(0x57e2a252), SPH_C32(0x685c0000), SPH_C32(0xfcc7706a), + SPH_C32(0xf73fa270), SPH_C32(0x6a0f42ed) }, + { SPH_C32(0x85f80e00), SPH_C32(0xaf63bb6c), SPH_C32(0xdc388943), + SPH_C32(0xdfc3ae62), SPH_C32(0xdff80100), SPH_C32(0x76d841b2), + SPH_C32(0x72b67adb), SPH_C32(0x8ccb2689) }, + { SPH_C32(0x325c0f00), SPH_C32(0x257c8ab4), SPH_C32(0x59b151e8), + SPH_C32(0x3907ca06), SPH_C32(0xacb40100), SPH_C32(0xe3b7e664), + SPH_C32(0xd02b684c), SPH_C32(0xe22e4edd) }, + { SPH_C32(0xbf2a0c00), SPH_C32(0x3755f0b7), SPH_C32(0x9e82b4a9), + SPH_C32(0x14c1186c), SPH_C32(0xbca80200), SPH_C32(0x76ba538f), + SPH_C32(0x35474915), SPH_C32(0x9afe5fcf) }, + { SPH_C32(0x088e0d00), SPH_C32(0xbd4ac16f), SPH_C32(0x1b0b6c02), + SPH_C32(0xf2057c08), SPH_C32(0xcfe40200), SPH_C32(0xe3d5f459), + SPH_C32(0x97da5b82), SPH_C32(0xf41b379b) }, + { SPH_C32(0xcc660c00), SPH_C32(0xa23a5761), SPH_C32(0x3c1fa63e), + SPH_C32(0x7a247038), SPH_C32(0x78400300), SPH_C32(0x69cac581), + SPH_C32(0x12538329), SPH_C32(0x12df53ff) }, + { SPH_C32(0x7bc20d00), SPH_C32(0x282566b9), SPH_C32(0xb9967e95), + SPH_C32(0x9ce0145c), SPH_C32(0x0b0c0300), SPH_C32(0xfca56257), + SPH_C32(0xb0ce91be), SPH_C32(0x7c3a3bab) }, + { SPH_C32(0x18920e00), SPH_C32(0x28477484), SPH_C32(0xfe674d5b), + SPH_C32(0x8ad56d1a), SPH_C32(0x528e0200), SPH_C32(0x64f13bb1), + SPH_C32(0xb5859f9a), SPH_C32(0xa10df4e3) }, + { SPH_C32(0xaf360f00), SPH_C32(0xa258455c), SPH_C32(0x7bee95f0), + SPH_C32(0x6c11097e), SPH_C32(0x21c20200), SPH_C32(0xf19e9c67), + SPH_C32(0x17188d0d), SPH_C32(0xcfe89cb7) }, + { SPH_C32(0x6bde0e00), SPH_C32(0xbd28d352), SPH_C32(0x5cfa5fcc), + SPH_C32(0xe430054e), SPH_C32(0x96660300), SPH_C32(0x7b81adbf), + SPH_C32(0x929155a6), SPH_C32(0x292cf8d3) }, + { SPH_C32(0xdc7a0f00), SPH_C32(0x3737e28a), SPH_C32(0xd9738767), + SPH_C32(0x02f4612a), SPH_C32(0xe52a0300), SPH_C32(0xeeee0a69), + SPH_C32(0x300c4731), SPH_C32(0x47c99087) }, + { SPH_C32(0xca8f0800), SPH_C32(0x07396701), SPH_C32(0x1bf7cf7c), + SPH_C32(0x82c07470), SPH_C32(0x7a080400), SPH_C32(0x767e77f5), + SPH_C32(0xbaa52e89), SPH_C32(0xb694ad43) }, + { SPH_C32(0x7d2b0900), SPH_C32(0x8d2656d9), SPH_C32(0x9e7e17d7), + SPH_C32(0x64041014), SPH_C32(0x09440400), SPH_C32(0xe311d023), + SPH_C32(0x18383c1e), SPH_C32(0xd871c517) }, + { SPH_C32(0xb9c30800), SPH_C32(0x9256c0d7), SPH_C32(0xb96addeb), + SPH_C32(0xec251c24), SPH_C32(0xbee00500), SPH_C32(0x690ee1fb), + SPH_C32(0x9db1e4b5), SPH_C32(0x3eb5a173) }, + { SPH_C32(0x0e670900), SPH_C32(0x1849f10f), SPH_C32(0x3ce30540), + SPH_C32(0x0ae17840), SPH_C32(0xcdac0500), SPH_C32(0xfc61462d), + SPH_C32(0x3f2cf622), SPH_C32(0x5050c927) }, + { SPH_C32(0x6d370a00), SPH_C32(0x182be332), SPH_C32(0x7b12368e), + SPH_C32(0x1cd40106), SPH_C32(0x942e0400), SPH_C32(0x64351fcb), + SPH_C32(0x3a67f806), SPH_C32(0x8d67066f) }, + { SPH_C32(0xda930b00), SPH_C32(0x9234d2ea), SPH_C32(0xfe9bee25), + SPH_C32(0xfa106562), SPH_C32(0xe7620400), SPH_C32(0xf15ab81d), + SPH_C32(0x98faea91), SPH_C32(0xe3826e3b) }, + { SPH_C32(0x1e7b0a00), SPH_C32(0x8d4444e4), SPH_C32(0xd98f2419), + SPH_C32(0x72316952), SPH_C32(0x50c60500), SPH_C32(0x7b4589c5), + SPH_C32(0x1d73323a), SPH_C32(0x05460a5f) }, + { SPH_C32(0xa9df0b00), SPH_C32(0x075b753c), SPH_C32(0x5c06fcb2), + SPH_C32(0x94f50d36), SPH_C32(0x238a0500), SPH_C32(0xee2a2e13), + SPH_C32(0xbfee20ad), SPH_C32(0x6ba3620b) }, + { SPH_C32(0x24a90800), SPH_C32(0x15720f3f), SPH_C32(0x9b3519f3), + SPH_C32(0xb933df5c), SPH_C32(0x33960600), SPH_C32(0x7b279bf8), + SPH_C32(0x5a8201f4), SPH_C32(0x13737319) }, + { SPH_C32(0x930d0900), SPH_C32(0x9f6d3ee7), SPH_C32(0x1ebcc158), + SPH_C32(0x5ff7bb38), SPH_C32(0x40da0600), SPH_C32(0xee483c2e), + SPH_C32(0xf81f1363), SPH_C32(0x7d961b4d) }, + { SPH_C32(0x57e50800), SPH_C32(0x801da8e9), SPH_C32(0x39a80b64), + SPH_C32(0xd7d6b708), SPH_C32(0xf77e0700), SPH_C32(0x64570df6), + SPH_C32(0x7d96cbc8), SPH_C32(0x9b527f29) }, + { SPH_C32(0xe0410900), SPH_C32(0x0a029931), SPH_C32(0xbc21d3cf), + SPH_C32(0x3112d36c), SPH_C32(0x84320700), SPH_C32(0xf138aa20), + SPH_C32(0xdf0bd95f), SPH_C32(0xf5b7177d) }, + { SPH_C32(0x83110a00), SPH_C32(0x0a608b0c), SPH_C32(0xfbd0e001), + SPH_C32(0x2727aa2a), SPH_C32(0xddb00600), SPH_C32(0x696cf3c6), + SPH_C32(0xda40d77b), SPH_C32(0x2880d835) }, + { SPH_C32(0x34b50b00), SPH_C32(0x807fbad4), SPH_C32(0x7e5938aa), + SPH_C32(0xc1e3ce4e), SPH_C32(0xaefc0600), SPH_C32(0xfc035410), + SPH_C32(0x78ddc5ec), SPH_C32(0x4665b061) }, + { SPH_C32(0xf05d0a00), SPH_C32(0x9f0f2cda), SPH_C32(0x594df296), + SPH_C32(0x49c2c27e), SPH_C32(0x19580700), SPH_C32(0x761c65c8), + SPH_C32(0xfd541d47), SPH_C32(0xa0a1d405) }, + { SPH_C32(0x47f90b00), SPH_C32(0x15101d02), SPH_C32(0xdcc42a3d), + SPH_C32(0xaf06a61a), SPH_C32(0x6a140700), SPH_C32(0xe373c21e), + SPH_C32(0x5fc90fd0), SPH_C32(0xce44bc51) }, + { SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), SPH_C32(0x7432879d), + SPH_C32(0x0b4d58a6), SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), + SPH_C32(0xd0d7cb32), SPH_C32(0x92eb46a5) }, + { SPH_C32(0xf2150d00), SPH_C32(0x80bb9eae), SPH_C32(0xf1bb5f36), + SPH_C32(0xed893cc2), SPH_C32(0x1df90400), SPH_C32(0xccabe7dc), + SPH_C32(0x724ad9a5), SPH_C32(0xfc0e2ef1) }, + { SPH_C32(0x36fd0c00), SPH_C32(0x9fcb08a0), SPH_C32(0xd6af950a), + SPH_C32(0x65a830f2), SPH_C32(0xaa5d0500), SPH_C32(0x46b4d604), + SPH_C32(0xf7c3010e), SPH_C32(0x1aca4a95) }, + { SPH_C32(0x81590d00), SPH_C32(0x15d43978), SPH_C32(0x53264da1), + SPH_C32(0x836c5496), SPH_C32(0xd9110500), SPH_C32(0xd3db71d2), + SPH_C32(0x555e1399), SPH_C32(0x742f22c1) }, + { SPH_C32(0xe2090e00), SPH_C32(0x15b62b45), SPH_C32(0x14d77e6f), + SPH_C32(0x95592dd0), SPH_C32(0x80930400), SPH_C32(0x4b8f2834), + SPH_C32(0x50151dbd), SPH_C32(0xa918ed89) }, + { SPH_C32(0x55ad0f00), SPH_C32(0x9fa91a9d), SPH_C32(0x915ea6c4), + SPH_C32(0x739d49b4), SPH_C32(0xf3df0400), SPH_C32(0xdee08fe2), + SPH_C32(0xf2880f2a), SPH_C32(0xc7fd85dd) }, + { SPH_C32(0x91450e00), SPH_C32(0x80d98c93), SPH_C32(0xb64a6cf8), + SPH_C32(0xfbbc4584), SPH_C32(0x447b0500), SPH_C32(0x54ffbe3a), + SPH_C32(0x7701d781), SPH_C32(0x2139e1b9) }, + { SPH_C32(0x26e10f00), SPH_C32(0x0ac6bd4b), SPH_C32(0x33c3b453), + SPH_C32(0x1d7821e0), SPH_C32(0x37370500), SPH_C32(0xc19019ec), + SPH_C32(0xd59cc516), SPH_C32(0x4fdc89ed) }, + { SPH_C32(0xab970c00), SPH_C32(0x18efc748), SPH_C32(0xf4f05112), + SPH_C32(0x30bef38a), SPH_C32(0x272b0600), SPH_C32(0x549dac07), + SPH_C32(0x30f0e44f), SPH_C32(0x370c98ff) }, + { SPH_C32(0x1c330d00), SPH_C32(0x92f0f690), SPH_C32(0x717989b9), + SPH_C32(0xd67a97ee), SPH_C32(0x54670600), SPH_C32(0xc1f20bd1), + SPH_C32(0x926df6d8), SPH_C32(0x59e9f0ab) }, + { SPH_C32(0xd8db0c00), SPH_C32(0x8d80609e), SPH_C32(0x566d4385), + SPH_C32(0x5e5b9bde), SPH_C32(0xe3c30700), SPH_C32(0x4bed3a09), + SPH_C32(0x17e42e73), SPH_C32(0xbf2d94cf) }, + { SPH_C32(0x6f7f0d00), SPH_C32(0x079f5146), SPH_C32(0xd3e49b2e), + SPH_C32(0xb89fffba), SPH_C32(0x908f0700), SPH_C32(0xde829ddf), + SPH_C32(0xb5793ce4), SPH_C32(0xd1c8fc9b) }, + { SPH_C32(0x0c2f0e00), SPH_C32(0x07fd437b), SPH_C32(0x9415a8e0), + SPH_C32(0xaeaa86fc), SPH_C32(0xc90d0600), SPH_C32(0x46d6c439), + SPH_C32(0xb03232c0), SPH_C32(0x0cff33d3) }, + { SPH_C32(0xbb8b0f00), SPH_C32(0x8de272a3), SPH_C32(0x119c704b), + SPH_C32(0x486ee298), SPH_C32(0xba410600), SPH_C32(0xd3b963ef), + SPH_C32(0x12af2057), SPH_C32(0x621a5b87) }, + { SPH_C32(0x7f630e00), SPH_C32(0x9292e4ad), SPH_C32(0x3688ba77), + SPH_C32(0xc04feea8), SPH_C32(0x0de50700), SPH_C32(0x59a65237), + SPH_C32(0x9726f8fc), SPH_C32(0x84de3fe3) }, + { SPH_C32(0xc8c70f00), SPH_C32(0x188dd575), SPH_C32(0xb30162dc), + SPH_C32(0x268b8acc), SPH_C32(0x7ea90700), SPH_C32(0xccc9f5e1), + SPH_C32(0x35bbea6b), SPH_C32(0xea3b57b7) }, + { SPH_C32(0xe18b0000), SPH_C32(0x5459887d), SPH_C32(0xbf1283d3), + SPH_C32(0x1b666a73), SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), + SPH_C32(0xce97a914), SPH_C32(0xbdd9f5e5) }, + { SPH_C32(0x562f0100), SPH_C32(0xde46b9a5), SPH_C32(0x3a9b5b78), + SPH_C32(0xfda20e17), SPH_C32(0x4cf50800), SPH_C32(0xe9b57f55), + SPH_C32(0x6c0abb83), SPH_C32(0xd33c9db1) }, + { SPH_C32(0x92c70000), SPH_C32(0xc1362fab), SPH_C32(0x1d8f9144), + SPH_C32(0x75830227), SPH_C32(0xfb510900), SPH_C32(0x63aa4e8d), + SPH_C32(0xe9836328), SPH_C32(0x35f8f9d5) }, + { SPH_C32(0x25630100), SPH_C32(0x4b291e73), SPH_C32(0x980649ef), + SPH_C32(0x93476643), SPH_C32(0x881d0900), SPH_C32(0xf6c5e95b), + SPH_C32(0x4b1e71bf), SPH_C32(0x5b1d9181) }, + { SPH_C32(0x46330200), SPH_C32(0x4b4b0c4e), SPH_C32(0xdff77a21), + SPH_C32(0x85721f05), SPH_C32(0xd19f0800), SPH_C32(0x6e91b0bd), + SPH_C32(0x4e557f9b), SPH_C32(0x862a5ec9) }, + { SPH_C32(0xf1970300), SPH_C32(0xc1543d96), SPH_C32(0x5a7ea28a), + SPH_C32(0x63b67b61), SPH_C32(0xa2d30800), SPH_C32(0xfbfe176b), + SPH_C32(0xecc86d0c), SPH_C32(0xe8cf369d) }, + { SPH_C32(0x357f0200), SPH_C32(0xde24ab98), SPH_C32(0x7d6a68b6), + SPH_C32(0xeb977751), SPH_C32(0x15770900), SPH_C32(0x71e126b3), + SPH_C32(0x6941b5a7), SPH_C32(0x0e0b52f9) }, + { SPH_C32(0x82db0300), SPH_C32(0x543b9a40), SPH_C32(0xf8e3b01d), + SPH_C32(0x0d531335), SPH_C32(0x663b0900), SPH_C32(0xe48e8165), + SPH_C32(0xcbdca730), SPH_C32(0x60ee3aad) }, + { SPH_C32(0x0fad0000), SPH_C32(0x4612e043), SPH_C32(0x3fd0555c), + SPH_C32(0x2095c15f), SPH_C32(0x76270a00), SPH_C32(0x7183348e), + SPH_C32(0x2eb08669), SPH_C32(0x183e2bbf) }, + { SPH_C32(0xb8090100), SPH_C32(0xcc0dd19b), SPH_C32(0xba598df7), + SPH_C32(0xc651a53b), SPH_C32(0x056b0a00), SPH_C32(0xe4ec9358), + SPH_C32(0x8c2d94fe), SPH_C32(0x76db43eb) }, + { SPH_C32(0x7ce10000), SPH_C32(0xd37d4795), SPH_C32(0x9d4d47cb), + SPH_C32(0x4e70a90b), SPH_C32(0xb2cf0b00), SPH_C32(0x6ef3a280), + SPH_C32(0x09a44c55), SPH_C32(0x901f278f) }, + { SPH_C32(0xcb450100), SPH_C32(0x5962764d), SPH_C32(0x18c49f60), + SPH_C32(0xa8b4cd6f), SPH_C32(0xc1830b00), SPH_C32(0xfb9c0556), + SPH_C32(0xab395ec2), SPH_C32(0xfefa4fdb) }, + { SPH_C32(0xa8150200), SPH_C32(0x59006470), SPH_C32(0x5f35acae), + SPH_C32(0xbe81b429), SPH_C32(0x98010a00), SPH_C32(0x63c85cb0), + SPH_C32(0xae7250e6), SPH_C32(0x23cd8093) }, + { SPH_C32(0x1fb10300), SPH_C32(0xd31f55a8), SPH_C32(0xdabc7405), + SPH_C32(0x5845d04d), SPH_C32(0xeb4d0a00), SPH_C32(0xf6a7fb66), + SPH_C32(0x0cef4271), SPH_C32(0x4d28e8c7) }, + { SPH_C32(0xdb590200), SPH_C32(0xcc6fc3a6), SPH_C32(0xfda8be39), + SPH_C32(0xd064dc7d), SPH_C32(0x5ce90b00), SPH_C32(0x7cb8cabe), + SPH_C32(0x89669ada), SPH_C32(0xabec8ca3) }, + { SPH_C32(0x6cfd0300), SPH_C32(0x4670f27e), SPH_C32(0x78216692), + SPH_C32(0x36a0b819), SPH_C32(0x2fa50b00), SPH_C32(0xe9d76d68), + SPH_C32(0x2bfb884d), SPH_C32(0xc509e4f7) }, + { SPH_C32(0x6eb50400), SPH_C32(0x59c4400a), SPH_C32(0xd0d7cb32), + SPH_C32(0x92eb46a5), SPH_C32(0x2b040800), SPH_C32(0x5360ef7c), + SPH_C32(0xa4e54caf), SPH_C32(0x99a61e03) }, + { SPH_C32(0xd9110500), SPH_C32(0xd3db71d2), SPH_C32(0x555e1399), + SPH_C32(0x742f22c1), SPH_C32(0x58480800), SPH_C32(0xc60f48aa), + SPH_C32(0x06785e38), SPH_C32(0xf7437657) }, + { SPH_C32(0x1df90400), SPH_C32(0xccabe7dc), SPH_C32(0x724ad9a5), + SPH_C32(0xfc0e2ef1), SPH_C32(0xefec0900), SPH_C32(0x4c107972), + SPH_C32(0x83f18693), SPH_C32(0x11871233) }, + { SPH_C32(0xaa5d0500), SPH_C32(0x46b4d604), SPH_C32(0xf7c3010e), + SPH_C32(0x1aca4a95), SPH_C32(0x9ca00900), SPH_C32(0xd97fdea4), + SPH_C32(0x216c9404), SPH_C32(0x7f627a67) }, + { SPH_C32(0xc90d0600), SPH_C32(0x46d6c439), SPH_C32(0xb03232c0), + SPH_C32(0x0cff33d3), SPH_C32(0xc5220800), SPH_C32(0x412b8742), + SPH_C32(0x24279a20), SPH_C32(0xa255b52f) }, + { SPH_C32(0x7ea90700), SPH_C32(0xccc9f5e1), SPH_C32(0x35bbea6b), + SPH_C32(0xea3b57b7), SPH_C32(0xb66e0800), SPH_C32(0xd4442094), + SPH_C32(0x86ba88b7), SPH_C32(0xccb0dd7b) }, + { SPH_C32(0xba410600), SPH_C32(0xd3b963ef), SPH_C32(0x12af2057), + SPH_C32(0x621a5b87), SPH_C32(0x01ca0900), SPH_C32(0x5e5b114c), + SPH_C32(0x0333501c), SPH_C32(0x2a74b91f) }, + { SPH_C32(0x0de50700), SPH_C32(0x59a65237), SPH_C32(0x9726f8fc), + SPH_C32(0x84de3fe3), SPH_C32(0x72860900), SPH_C32(0xcb34b69a), + SPH_C32(0xa1ae428b), SPH_C32(0x4491d14b) }, + { SPH_C32(0x80930400), SPH_C32(0x4b8f2834), SPH_C32(0x50151dbd), + SPH_C32(0xa918ed89), SPH_C32(0x629a0a00), SPH_C32(0x5e390371), + SPH_C32(0x44c263d2), SPH_C32(0x3c41c059) }, + { SPH_C32(0x37370500), SPH_C32(0xc19019ec), SPH_C32(0xd59cc516), + SPH_C32(0x4fdc89ed), SPH_C32(0x11d60a00), SPH_C32(0xcb56a4a7), + SPH_C32(0xe65f7145), SPH_C32(0x52a4a80d) }, + { SPH_C32(0xf3df0400), SPH_C32(0xdee08fe2), SPH_C32(0xf2880f2a), + SPH_C32(0xc7fd85dd), SPH_C32(0xa6720b00), SPH_C32(0x4149957f), + SPH_C32(0x63d6a9ee), SPH_C32(0xb460cc69) }, + { SPH_C32(0x447b0500), SPH_C32(0x54ffbe3a), SPH_C32(0x7701d781), + SPH_C32(0x2139e1b9), SPH_C32(0xd53e0b00), SPH_C32(0xd42632a9), + SPH_C32(0xc14bbb79), SPH_C32(0xda85a43d) }, + { SPH_C32(0x272b0600), SPH_C32(0x549dac07), SPH_C32(0x30f0e44f), + SPH_C32(0x370c98ff), SPH_C32(0x8cbc0a00), SPH_C32(0x4c726b4f), + SPH_C32(0xc400b55d), SPH_C32(0x07b26b75) }, + { SPH_C32(0x908f0700), SPH_C32(0xde829ddf), SPH_C32(0xb5793ce4), + SPH_C32(0xd1c8fc9b), SPH_C32(0xfff00a00), SPH_C32(0xd91dcc99), + SPH_C32(0x669da7ca), SPH_C32(0x69570321) }, + { SPH_C32(0x54670600), SPH_C32(0xc1f20bd1), SPH_C32(0x926df6d8), + SPH_C32(0x59e9f0ab), SPH_C32(0x48540b00), SPH_C32(0x5302fd41), + SPH_C32(0xe3147f61), SPH_C32(0x8f936745) }, + { SPH_C32(0xe3c30700), SPH_C32(0x4bed3a09), SPH_C32(0x17e42e73), + SPH_C32(0xbf2d94cf), SPH_C32(0x3b180b00), SPH_C32(0xc66d5a97), + SPH_C32(0x41896df6), SPH_C32(0xe1760f11) }, + { SPH_C32(0xf5360000), SPH_C32(0x7be3bf82), SPH_C32(0xd5606668), + SPH_C32(0x3f198195), SPH_C32(0xa43a0c00), SPH_C32(0x5efd270b), + SPH_C32(0xcb20044e), SPH_C32(0x102b32d5) }, + { SPH_C32(0x42920100), SPH_C32(0xf1fc8e5a), SPH_C32(0x50e9bec3), + SPH_C32(0xd9dde5f1), SPH_C32(0xd7760c00), SPH_C32(0xcb9280dd), + SPH_C32(0x69bd16d9), SPH_C32(0x7ece5a81) }, + { SPH_C32(0x867a0000), SPH_C32(0xee8c1854), SPH_C32(0x77fd74ff), + SPH_C32(0x51fce9c1), SPH_C32(0x60d20d00), SPH_C32(0x418db105), + SPH_C32(0xec34ce72), SPH_C32(0x980a3ee5) }, + { SPH_C32(0x31de0100), SPH_C32(0x6493298c), SPH_C32(0xf274ac54), + SPH_C32(0xb7388da5), SPH_C32(0x139e0d00), SPH_C32(0xd4e216d3), + SPH_C32(0x4ea9dce5), SPH_C32(0xf6ef56b1) }, + { SPH_C32(0x528e0200), SPH_C32(0x64f13bb1), SPH_C32(0xb5859f9a), + SPH_C32(0xa10df4e3), SPH_C32(0x4a1c0c00), SPH_C32(0x4cb64f35), + SPH_C32(0x4be2d2c1), SPH_C32(0x2bd899f9) }, + { SPH_C32(0xe52a0300), SPH_C32(0xeeee0a69), SPH_C32(0x300c4731), + SPH_C32(0x47c99087), SPH_C32(0x39500c00), SPH_C32(0xd9d9e8e3), + SPH_C32(0xe97fc056), SPH_C32(0x453df1ad) }, + { SPH_C32(0x21c20200), SPH_C32(0xf19e9c67), SPH_C32(0x17188d0d), + SPH_C32(0xcfe89cb7), SPH_C32(0x8ef40d00), SPH_C32(0x53c6d93b), + SPH_C32(0x6cf618fd), SPH_C32(0xa3f995c9) }, + { SPH_C32(0x96660300), SPH_C32(0x7b81adbf), SPH_C32(0x929155a6), + SPH_C32(0x292cf8d3), SPH_C32(0xfdb80d00), SPH_C32(0xc6a97eed), + SPH_C32(0xce6b0a6a), SPH_C32(0xcd1cfd9d) }, + { SPH_C32(0x1b100000), SPH_C32(0x69a8d7bc), SPH_C32(0x55a2b0e7), + SPH_C32(0x04ea2ab9), SPH_C32(0xeda40e00), SPH_C32(0x53a4cb06), + SPH_C32(0x2b072b33), SPH_C32(0xb5ccec8f) }, + { SPH_C32(0xacb40100), SPH_C32(0xe3b7e664), SPH_C32(0xd02b684c), + SPH_C32(0xe22e4edd), SPH_C32(0x9ee80e00), SPH_C32(0xc6cb6cd0), + SPH_C32(0x899a39a4), SPH_C32(0xdb2984db) }, + { SPH_C32(0x685c0000), SPH_C32(0xfcc7706a), SPH_C32(0xf73fa270), + SPH_C32(0x6a0f42ed), SPH_C32(0x294c0f00), SPH_C32(0x4cd45d08), + SPH_C32(0x0c13e10f), SPH_C32(0x3dede0bf) }, + { SPH_C32(0xdff80100), SPH_C32(0x76d841b2), SPH_C32(0x72b67adb), + SPH_C32(0x8ccb2689), SPH_C32(0x5a000f00), SPH_C32(0xd9bbfade), + SPH_C32(0xae8ef398), SPH_C32(0x530888eb) }, + { SPH_C32(0xbca80200), SPH_C32(0x76ba538f), SPH_C32(0x35474915), + SPH_C32(0x9afe5fcf), SPH_C32(0x03820e00), SPH_C32(0x41efa338), + SPH_C32(0xabc5fdbc), SPH_C32(0x8e3f47a3) }, + { SPH_C32(0x0b0c0300), SPH_C32(0xfca56257), SPH_C32(0xb0ce91be), + SPH_C32(0x7c3a3bab), SPH_C32(0x70ce0e00), SPH_C32(0xd48004ee), + SPH_C32(0x0958ef2b), SPH_C32(0xe0da2ff7) }, + { SPH_C32(0xcfe40200), SPH_C32(0xe3d5f459), SPH_C32(0x97da5b82), + SPH_C32(0xf41b379b), SPH_C32(0xc76a0f00), SPH_C32(0x5e9f3536), + SPH_C32(0x8cd13780), SPH_C32(0x061e4b93) }, + { SPH_C32(0x78400300), SPH_C32(0x69cac581), SPH_C32(0x12538329), + SPH_C32(0x12df53ff), SPH_C32(0xb4260f00), SPH_C32(0xcbf092e0), + SPH_C32(0x2e4c2517), SPH_C32(0x68fb23c7) }, + { SPH_C32(0x7a080400), SPH_C32(0x767e77f5), SPH_C32(0xbaa52e89), + SPH_C32(0xb694ad43), SPH_C32(0xb0870c00), SPH_C32(0x714710f4), + SPH_C32(0xa152e1f5), SPH_C32(0x3454d933) }, + { SPH_C32(0xcdac0500), SPH_C32(0xfc61462d), SPH_C32(0x3f2cf622), + SPH_C32(0x5050c927), SPH_C32(0xc3cb0c00), SPH_C32(0xe428b722), + SPH_C32(0x03cff362), SPH_C32(0x5ab1b167) }, + { SPH_C32(0x09440400), SPH_C32(0xe311d023), SPH_C32(0x18383c1e), + SPH_C32(0xd871c517), SPH_C32(0x746f0d00), SPH_C32(0x6e3786fa), + SPH_C32(0x86462bc9), SPH_C32(0xbc75d503) }, + { SPH_C32(0xbee00500), SPH_C32(0x690ee1fb), SPH_C32(0x9db1e4b5), + SPH_C32(0x3eb5a173), SPH_C32(0x07230d00), SPH_C32(0xfb58212c), + SPH_C32(0x24db395e), SPH_C32(0xd290bd57) }, + { SPH_C32(0xddb00600), SPH_C32(0x696cf3c6), SPH_C32(0xda40d77b), + SPH_C32(0x2880d835), SPH_C32(0x5ea10c00), SPH_C32(0x630c78ca), + SPH_C32(0x2190377a), SPH_C32(0x0fa7721f) }, + { SPH_C32(0x6a140700), SPH_C32(0xe373c21e), SPH_C32(0x5fc90fd0), + SPH_C32(0xce44bc51), SPH_C32(0x2ded0c00), SPH_C32(0xf663df1c), + SPH_C32(0x830d25ed), SPH_C32(0x61421a4b) }, + { SPH_C32(0xaefc0600), SPH_C32(0xfc035410), SPH_C32(0x78ddc5ec), + SPH_C32(0x4665b061), SPH_C32(0x9a490d00), SPH_C32(0x7c7ceec4), + SPH_C32(0x0684fd46), SPH_C32(0x87867e2f) }, + { SPH_C32(0x19580700), SPH_C32(0x761c65c8), SPH_C32(0xfd541d47), + SPH_C32(0xa0a1d405), SPH_C32(0xe9050d00), SPH_C32(0xe9134912), + SPH_C32(0xa419efd1), SPH_C32(0xe963167b) }, + { SPH_C32(0x942e0400), SPH_C32(0x64351fcb), SPH_C32(0x3a67f806), + SPH_C32(0x8d67066f), SPH_C32(0xf9190e00), SPH_C32(0x7c1efcf9), + SPH_C32(0x4175ce88), SPH_C32(0x91b30769) }, + { SPH_C32(0x238a0500), SPH_C32(0xee2a2e13), SPH_C32(0xbfee20ad), + SPH_C32(0x6ba3620b), SPH_C32(0x8a550e00), SPH_C32(0xe9715b2f), + SPH_C32(0xe3e8dc1f), SPH_C32(0xff566f3d) }, + { SPH_C32(0xe7620400), SPH_C32(0xf15ab81d), SPH_C32(0x98faea91), + SPH_C32(0xe3826e3b), SPH_C32(0x3df10f00), SPH_C32(0x636e6af7), + SPH_C32(0x666104b4), SPH_C32(0x19920b59) }, + { SPH_C32(0x50c60500), SPH_C32(0x7b4589c5), SPH_C32(0x1d73323a), + SPH_C32(0x05460a5f), SPH_C32(0x4ebd0f00), SPH_C32(0xf601cd21), + SPH_C32(0xc4fc1623), SPH_C32(0x7777630d) }, + { SPH_C32(0x33960600), SPH_C32(0x7b279bf8), SPH_C32(0x5a8201f4), + SPH_C32(0x13737319), SPH_C32(0x173f0e00), SPH_C32(0x6e5594c7), + SPH_C32(0xc1b71807), SPH_C32(0xaa40ac45) }, + { SPH_C32(0x84320700), SPH_C32(0xf138aa20), SPH_C32(0xdf0bd95f), + SPH_C32(0xf5b7177d), SPH_C32(0x64730e00), SPH_C32(0xfb3a3311), + SPH_C32(0x632a0a90), SPH_C32(0xc4a5c411) }, + { SPH_C32(0x40da0600), SPH_C32(0xee483c2e), SPH_C32(0xf81f1363), + SPH_C32(0x7d961b4d), SPH_C32(0xd3d70f00), SPH_C32(0x712502c9), + SPH_C32(0xe6a3d23b), SPH_C32(0x2261a075) }, + { SPH_C32(0xf77e0700), SPH_C32(0x64570df6), SPH_C32(0x7d96cbc8), + SPH_C32(0x9b527f29), SPH_C32(0xa09b0f00), SPH_C32(0xe44aa51f), + SPH_C32(0x443ec0ac), SPH_C32(0x4c84c821) }, + { SPH_C32(0x3fb90800), SPH_C32(0x7cdad883), SPH_C32(0xce97a914), + SPH_C32(0xbdd9f5e5), SPH_C32(0xde320800), SPH_C32(0x288350fe), + SPH_C32(0x71852ac7), SPH_C32(0xa6bf9f96) }, + { SPH_C32(0x881d0900), SPH_C32(0xf6c5e95b), SPH_C32(0x4b1e71bf), + SPH_C32(0x5b1d9181), SPH_C32(0xad7e0800), SPH_C32(0xbdecf728), + SPH_C32(0xd3183850), SPH_C32(0xc85af7c2) }, + { SPH_C32(0x4cf50800), SPH_C32(0xe9b57f55), SPH_C32(0x6c0abb83), + SPH_C32(0xd33c9db1), SPH_C32(0x1ada0900), SPH_C32(0x37f3c6f0), + SPH_C32(0x5691e0fb), SPH_C32(0x2e9e93a6) }, + { SPH_C32(0xfb510900), SPH_C32(0x63aa4e8d), SPH_C32(0xe9836328), + SPH_C32(0x35f8f9d5), SPH_C32(0x69960900), SPH_C32(0xa29c6126), + SPH_C32(0xf40cf26c), SPH_C32(0x407bfbf2) }, + { SPH_C32(0x98010a00), SPH_C32(0x63c85cb0), SPH_C32(0xae7250e6), + SPH_C32(0x23cd8093), SPH_C32(0x30140800), SPH_C32(0x3ac838c0), + SPH_C32(0xf147fc48), SPH_C32(0x9d4c34ba) }, + { SPH_C32(0x2fa50b00), SPH_C32(0xe9d76d68), SPH_C32(0x2bfb884d), + SPH_C32(0xc509e4f7), SPH_C32(0x43580800), SPH_C32(0xafa79f16), + SPH_C32(0x53daeedf), SPH_C32(0xf3a95cee) }, + { SPH_C32(0xeb4d0a00), SPH_C32(0xf6a7fb66), SPH_C32(0x0cef4271), + SPH_C32(0x4d28e8c7), SPH_C32(0xf4fc0900), SPH_C32(0x25b8aece), + SPH_C32(0xd6533674), SPH_C32(0x156d388a) }, + { SPH_C32(0x5ce90b00), SPH_C32(0x7cb8cabe), SPH_C32(0x89669ada), + SPH_C32(0xabec8ca3), SPH_C32(0x87b00900), SPH_C32(0xb0d70918), + SPH_C32(0x74ce24e3), SPH_C32(0x7b8850de) }, + { SPH_C32(0xd19f0800), SPH_C32(0x6e91b0bd), SPH_C32(0x4e557f9b), + SPH_C32(0x862a5ec9), SPH_C32(0x97ac0a00), SPH_C32(0x25dabcf3), + SPH_C32(0x91a205ba), SPH_C32(0x035841cc) }, + { SPH_C32(0x663b0900), SPH_C32(0xe48e8165), SPH_C32(0xcbdca730), + SPH_C32(0x60ee3aad), SPH_C32(0xe4e00a00), SPH_C32(0xb0b51b25), + SPH_C32(0x333f172d), SPH_C32(0x6dbd2998) }, + { SPH_C32(0xa2d30800), SPH_C32(0xfbfe176b), SPH_C32(0xecc86d0c), + SPH_C32(0xe8cf369d), SPH_C32(0x53440b00), SPH_C32(0x3aaa2afd), + SPH_C32(0xb6b6cf86), SPH_C32(0x8b794dfc) }, + { SPH_C32(0x15770900), SPH_C32(0x71e126b3), SPH_C32(0x6941b5a7), + SPH_C32(0x0e0b52f9), SPH_C32(0x20080b00), SPH_C32(0xafc58d2b), + SPH_C32(0x142bdd11), SPH_C32(0xe59c25a8) }, + { SPH_C32(0x76270a00), SPH_C32(0x7183348e), SPH_C32(0x2eb08669), + SPH_C32(0x183e2bbf), SPH_C32(0x798a0a00), SPH_C32(0x3791d4cd), + SPH_C32(0x1160d335), SPH_C32(0x38abeae0) }, + { SPH_C32(0xc1830b00), SPH_C32(0xfb9c0556), SPH_C32(0xab395ec2), + SPH_C32(0xfefa4fdb), SPH_C32(0x0ac60a00), SPH_C32(0xa2fe731b), + SPH_C32(0xb3fdc1a2), SPH_C32(0x564e82b4) }, + { SPH_C32(0x056b0a00), SPH_C32(0xe4ec9358), SPH_C32(0x8c2d94fe), + SPH_C32(0x76db43eb), SPH_C32(0xbd620b00), SPH_C32(0x28e142c3), + SPH_C32(0x36741909), SPH_C32(0xb08ae6d0) }, + { SPH_C32(0xb2cf0b00), SPH_C32(0x6ef3a280), SPH_C32(0x09a44c55), + SPH_C32(0x901f278f), SPH_C32(0xce2e0b00), SPH_C32(0xbd8ee515), + SPH_C32(0x94e90b9e), SPH_C32(0xde6f8e84) }, + { SPH_C32(0xb0870c00), SPH_C32(0x714710f4), SPH_C32(0xa152e1f5), + SPH_C32(0x3454d933), SPH_C32(0xca8f0800), SPH_C32(0x07396701), + SPH_C32(0x1bf7cf7c), SPH_C32(0x82c07470) }, + { SPH_C32(0x07230d00), SPH_C32(0xfb58212c), SPH_C32(0x24db395e), + SPH_C32(0xd290bd57), SPH_C32(0xb9c30800), SPH_C32(0x9256c0d7), + SPH_C32(0xb96addeb), SPH_C32(0xec251c24) }, + { SPH_C32(0xc3cb0c00), SPH_C32(0xe428b722), SPH_C32(0x03cff362), + SPH_C32(0x5ab1b167), SPH_C32(0x0e670900), SPH_C32(0x1849f10f), + SPH_C32(0x3ce30540), SPH_C32(0x0ae17840) }, + { SPH_C32(0x746f0d00), SPH_C32(0x6e3786fa), SPH_C32(0x86462bc9), + SPH_C32(0xbc75d503), SPH_C32(0x7d2b0900), SPH_C32(0x8d2656d9), + SPH_C32(0x9e7e17d7), SPH_C32(0x64041014) }, + { SPH_C32(0x173f0e00), SPH_C32(0x6e5594c7), SPH_C32(0xc1b71807), + SPH_C32(0xaa40ac45), SPH_C32(0x24a90800), SPH_C32(0x15720f3f), + SPH_C32(0x9b3519f3), SPH_C32(0xb933df5c) }, + { SPH_C32(0xa09b0f00), SPH_C32(0xe44aa51f), SPH_C32(0x443ec0ac), + SPH_C32(0x4c84c821), SPH_C32(0x57e50800), SPH_C32(0x801da8e9), + SPH_C32(0x39a80b64), SPH_C32(0xd7d6b708) }, + { SPH_C32(0x64730e00), SPH_C32(0xfb3a3311), SPH_C32(0x632a0a90), + SPH_C32(0xc4a5c411), SPH_C32(0xe0410900), SPH_C32(0x0a029931), + SPH_C32(0xbc21d3cf), SPH_C32(0x3112d36c) }, + { SPH_C32(0xd3d70f00), SPH_C32(0x712502c9), SPH_C32(0xe6a3d23b), + SPH_C32(0x2261a075), SPH_C32(0x930d0900), SPH_C32(0x9f6d3ee7), + SPH_C32(0x1ebcc158), SPH_C32(0x5ff7bb38) }, + { SPH_C32(0x5ea10c00), SPH_C32(0x630c78ca), SPH_C32(0x2190377a), + SPH_C32(0x0fa7721f), SPH_C32(0x83110a00), SPH_C32(0x0a608b0c), + SPH_C32(0xfbd0e001), SPH_C32(0x2727aa2a) }, + { SPH_C32(0xe9050d00), SPH_C32(0xe9134912), SPH_C32(0xa419efd1), + SPH_C32(0xe963167b), SPH_C32(0xf05d0a00), SPH_C32(0x9f0f2cda), + SPH_C32(0x594df296), SPH_C32(0x49c2c27e) }, + { SPH_C32(0x2ded0c00), SPH_C32(0xf663df1c), SPH_C32(0x830d25ed), + SPH_C32(0x61421a4b), SPH_C32(0x47f90b00), SPH_C32(0x15101d02), + SPH_C32(0xdcc42a3d), SPH_C32(0xaf06a61a) }, + { SPH_C32(0x9a490d00), SPH_C32(0x7c7ceec4), SPH_C32(0x0684fd46), + SPH_C32(0x87867e2f), SPH_C32(0x34b50b00), SPH_C32(0x807fbad4), + SPH_C32(0x7e5938aa), SPH_C32(0xc1e3ce4e) }, + { SPH_C32(0xf9190e00), SPH_C32(0x7c1efcf9), SPH_C32(0x4175ce88), + SPH_C32(0x91b30769), SPH_C32(0x6d370a00), SPH_C32(0x182be332), + SPH_C32(0x7b12368e), SPH_C32(0x1cd40106) }, + { SPH_C32(0x4ebd0f00), SPH_C32(0xf601cd21), SPH_C32(0xc4fc1623), + SPH_C32(0x7777630d), SPH_C32(0x1e7b0a00), SPH_C32(0x8d4444e4), + SPH_C32(0xd98f2419), SPH_C32(0x72316952) }, + { SPH_C32(0x8a550e00), SPH_C32(0xe9715b2f), SPH_C32(0xe3e8dc1f), + SPH_C32(0xff566f3d), SPH_C32(0xa9df0b00), SPH_C32(0x075b753c), + SPH_C32(0x5c06fcb2), SPH_C32(0x94f50d36) }, + { SPH_C32(0x3df10f00), SPH_C32(0x636e6af7), SPH_C32(0x666104b4), + SPH_C32(0x19920b59), SPH_C32(0xda930b00), SPH_C32(0x9234d2ea), + SPH_C32(0xfe9bee25), SPH_C32(0xfa106562) }, + { SPH_C32(0x2b040800), SPH_C32(0x5360ef7c), SPH_C32(0xa4e54caf), + SPH_C32(0x99a61e03), SPH_C32(0x45b10c00), SPH_C32(0x0aa4af76), + SPH_C32(0x7432879d), SPH_C32(0x0b4d58a6) }, + { SPH_C32(0x9ca00900), SPH_C32(0xd97fdea4), SPH_C32(0x216c9404), + SPH_C32(0x7f627a67), SPH_C32(0x36fd0c00), SPH_C32(0x9fcb08a0), + SPH_C32(0xd6af950a), SPH_C32(0x65a830f2) }, + { SPH_C32(0x58480800), SPH_C32(0xc60f48aa), SPH_C32(0x06785e38), + SPH_C32(0xf7437657), SPH_C32(0x81590d00), SPH_C32(0x15d43978), + SPH_C32(0x53264da1), SPH_C32(0x836c5496) }, + { SPH_C32(0xefec0900), SPH_C32(0x4c107972), SPH_C32(0x83f18693), + SPH_C32(0x11871233), SPH_C32(0xf2150d00), SPH_C32(0x80bb9eae), + SPH_C32(0xf1bb5f36), SPH_C32(0xed893cc2) }, + { SPH_C32(0x8cbc0a00), SPH_C32(0x4c726b4f), SPH_C32(0xc400b55d), + SPH_C32(0x07b26b75), SPH_C32(0xab970c00), SPH_C32(0x18efc748), + SPH_C32(0xf4f05112), SPH_C32(0x30bef38a) }, + { SPH_C32(0x3b180b00), SPH_C32(0xc66d5a97), SPH_C32(0x41896df6), + SPH_C32(0xe1760f11), SPH_C32(0xd8db0c00), SPH_C32(0x8d80609e), + SPH_C32(0x566d4385), SPH_C32(0x5e5b9bde) }, + { SPH_C32(0xfff00a00), SPH_C32(0xd91dcc99), SPH_C32(0x669da7ca), + SPH_C32(0x69570321), SPH_C32(0x6f7f0d00), SPH_C32(0x079f5146), + SPH_C32(0xd3e49b2e), SPH_C32(0xb89fffba) }, + { SPH_C32(0x48540b00), SPH_C32(0x5302fd41), SPH_C32(0xe3147f61), + SPH_C32(0x8f936745), SPH_C32(0x1c330d00), SPH_C32(0x92f0f690), + SPH_C32(0x717989b9), SPH_C32(0xd67a97ee) }, + { SPH_C32(0xc5220800), SPH_C32(0x412b8742), SPH_C32(0x24279a20), + SPH_C32(0xa255b52f), SPH_C32(0x0c2f0e00), SPH_C32(0x07fd437b), + SPH_C32(0x9415a8e0), SPH_C32(0xaeaa86fc) }, + { SPH_C32(0x72860900), SPH_C32(0xcb34b69a), SPH_C32(0xa1ae428b), + SPH_C32(0x4491d14b), SPH_C32(0x7f630e00), SPH_C32(0x9292e4ad), + SPH_C32(0x3688ba77), SPH_C32(0xc04feea8) }, + { SPH_C32(0xb66e0800), SPH_C32(0xd4442094), SPH_C32(0x86ba88b7), + SPH_C32(0xccb0dd7b), SPH_C32(0xc8c70f00), SPH_C32(0x188dd575), + SPH_C32(0xb30162dc), SPH_C32(0x268b8acc) }, + { SPH_C32(0x01ca0900), SPH_C32(0x5e5b114c), SPH_C32(0x0333501c), + SPH_C32(0x2a74b91f), SPH_C32(0xbb8b0f00), SPH_C32(0x8de272a3), + SPH_C32(0x119c704b), SPH_C32(0x486ee298) }, + { SPH_C32(0x629a0a00), SPH_C32(0x5e390371), SPH_C32(0x44c263d2), + SPH_C32(0x3c41c059), SPH_C32(0xe2090e00), SPH_C32(0x15b62b45), + SPH_C32(0x14d77e6f), SPH_C32(0x95592dd0) }, + { SPH_C32(0xd53e0b00), SPH_C32(0xd42632a9), SPH_C32(0xc14bbb79), + SPH_C32(0xda85a43d), SPH_C32(0x91450e00), SPH_C32(0x80d98c93), + SPH_C32(0xb64a6cf8), SPH_C32(0xfbbc4584) }, + { SPH_C32(0x11d60a00), SPH_C32(0xcb56a4a7), SPH_C32(0xe65f7145), + SPH_C32(0x52a4a80d), SPH_C32(0x26e10f00), SPH_C32(0x0ac6bd4b), + SPH_C32(0x33c3b453), SPH_C32(0x1d7821e0) }, + { SPH_C32(0xa6720b00), SPH_C32(0x4149957f), SPH_C32(0x63d6a9ee), + SPH_C32(0xb460cc69), SPH_C32(0x55ad0f00), SPH_C32(0x9fa91a9d), + SPH_C32(0x915ea6c4), SPH_C32(0x739d49b4) }, + { SPH_C32(0xa43a0c00), SPH_C32(0x5efd270b), SPH_C32(0xcb20044e), + SPH_C32(0x102b32d5), SPH_C32(0x510c0c00), SPH_C32(0x251e9889), + SPH_C32(0x1e406226), SPH_C32(0x2f32b340) }, + { SPH_C32(0x139e0d00), SPH_C32(0xd4e216d3), SPH_C32(0x4ea9dce5), + SPH_C32(0xf6ef56b1), SPH_C32(0x22400c00), SPH_C32(0xb0713f5f), + SPH_C32(0xbcdd70b1), SPH_C32(0x41d7db14) }, + { SPH_C32(0xd7760c00), SPH_C32(0xcb9280dd), SPH_C32(0x69bd16d9), + SPH_C32(0x7ece5a81), SPH_C32(0x95e40d00), SPH_C32(0x3a6e0e87), + SPH_C32(0x3954a81a), SPH_C32(0xa713bf70) }, + { SPH_C32(0x60d20d00), SPH_C32(0x418db105), SPH_C32(0xec34ce72), + SPH_C32(0x980a3ee5), SPH_C32(0xe6a80d00), SPH_C32(0xaf01a951), + SPH_C32(0x9bc9ba8d), SPH_C32(0xc9f6d724) }, + { SPH_C32(0x03820e00), SPH_C32(0x41efa338), SPH_C32(0xabc5fdbc), + SPH_C32(0x8e3f47a3), SPH_C32(0xbf2a0c00), SPH_C32(0x3755f0b7), + SPH_C32(0x9e82b4a9), SPH_C32(0x14c1186c) }, + { SPH_C32(0xb4260f00), SPH_C32(0xcbf092e0), SPH_C32(0x2e4c2517), + SPH_C32(0x68fb23c7), SPH_C32(0xcc660c00), SPH_C32(0xa23a5761), + SPH_C32(0x3c1fa63e), SPH_C32(0x7a247038) }, + { SPH_C32(0x70ce0e00), SPH_C32(0xd48004ee), SPH_C32(0x0958ef2b), + SPH_C32(0xe0da2ff7), SPH_C32(0x7bc20d00), SPH_C32(0x282566b9), + SPH_C32(0xb9967e95), SPH_C32(0x9ce0145c) }, + { SPH_C32(0xc76a0f00), SPH_C32(0x5e9f3536), SPH_C32(0x8cd13780), + SPH_C32(0x061e4b93), SPH_C32(0x088e0d00), SPH_C32(0xbd4ac16f), + SPH_C32(0x1b0b6c02), SPH_C32(0xf2057c08) }, + { SPH_C32(0x4a1c0c00), SPH_C32(0x4cb64f35), SPH_C32(0x4be2d2c1), + SPH_C32(0x2bd899f9), SPH_C32(0x18920e00), SPH_C32(0x28477484), + SPH_C32(0xfe674d5b), SPH_C32(0x8ad56d1a) }, + { SPH_C32(0xfdb80d00), SPH_C32(0xc6a97eed), SPH_C32(0xce6b0a6a), + SPH_C32(0xcd1cfd9d), SPH_C32(0x6bde0e00), SPH_C32(0xbd28d352), + SPH_C32(0x5cfa5fcc), SPH_C32(0xe430054e) }, + { SPH_C32(0x39500c00), SPH_C32(0xd9d9e8e3), SPH_C32(0xe97fc056), + SPH_C32(0x453df1ad), SPH_C32(0xdc7a0f00), SPH_C32(0x3737e28a), + SPH_C32(0xd9738767), SPH_C32(0x02f4612a) }, + { SPH_C32(0x8ef40d00), SPH_C32(0x53c6d93b), SPH_C32(0x6cf618fd), + SPH_C32(0xa3f995c9), SPH_C32(0xaf360f00), SPH_C32(0xa258455c), + SPH_C32(0x7bee95f0), SPH_C32(0x6c11097e) }, + { SPH_C32(0xeda40e00), SPH_C32(0x53a4cb06), SPH_C32(0x2b072b33), + SPH_C32(0xb5ccec8f), SPH_C32(0xf6b40e00), SPH_C32(0x3a0c1cba), + SPH_C32(0x7ea59bd4), SPH_C32(0xb126c636) }, + { SPH_C32(0x5a000f00), SPH_C32(0xd9bbfade), SPH_C32(0xae8ef398), + SPH_C32(0x530888eb), SPH_C32(0x85f80e00), SPH_C32(0xaf63bb6c), + SPH_C32(0xdc388943), SPH_C32(0xdfc3ae62) }, + { SPH_C32(0x9ee80e00), SPH_C32(0xc6cb6cd0), SPH_C32(0x899a39a4), + SPH_C32(0xdb2984db), SPH_C32(0x325c0f00), SPH_C32(0x257c8ab4), + SPH_C32(0x59b151e8), SPH_C32(0x3907ca06) }, + { SPH_C32(0x294c0f00), SPH_C32(0x4cd45d08), SPH_C32(0x0c13e10f), + SPH_C32(0x3dede0bf), SPH_C32(0x41100f00), SPH_C32(0xb0132d62), + SPH_C32(0xfb2c437f), SPH_C32(0x57e2a252) } +}; + +static const sph_u32 T256_16[256][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0x515c0010), SPH_C32(0x40f372fb), SPH_C32(0xfce72602), + SPH_C32(0x71575061), SPH_C32(0x2e390000), SPH_C32(0x64dd6689), + SPH_C32(0x3cd406fc), SPH_C32(0xb1f490bc) }, + { SPH_C32(0x2e390000), SPH_C32(0x64dd6689), SPH_C32(0x3cd406fc), + SPH_C32(0xb1f490bc), SPH_C32(0x7f650010), SPH_C32(0x242e1472), + SPH_C32(0xc03320fe), SPH_C32(0xc0a3c0dd) }, + { SPH_C32(0x7f650010), SPH_C32(0x242e1472), SPH_C32(0xc03320fe), + SPH_C32(0xc0a3c0dd), SPH_C32(0x515c0010), SPH_C32(0x40f372fb), + SPH_C32(0xfce72602), SPH_C32(0x71575061) }, + { SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), SPH_C32(0xf9ce4c04), + SPH_C32(0xe2afa0c0), SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), + SPH_C32(0x79a90df9), SPH_C32(0x63e92178) }, + { SPH_C32(0xf3e40030), SPH_C32(0xc114970d), SPH_C32(0x05296a06), + SPH_C32(0x93f8f0a1), SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), + SPH_C32(0x457d0b05), SPH_C32(0xd21db1c4) }, + { SPH_C32(0x8c810020), SPH_C32(0xe53a837f), SPH_C32(0xc51a4af8), + SPH_C32(0x535b307c), SPH_C32(0x23170010), SPH_C32(0xed94d960), + SPH_C32(0xb99a2d07), SPH_C32(0xa34ae1a5) }, + { SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), SPH_C32(0x39fd6cfa), + SPH_C32(0x220c601d), SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), + SPH_C32(0x854e2bfb), SPH_C32(0x12be7119) }, + { SPH_C32(0x5c720000), SPH_C32(0xc9bacd12), SPH_C32(0x79a90df9), + SPH_C32(0x63e92178), SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), + SPH_C32(0x806741fd), SPH_C32(0x814681b8) }, + { SPH_C32(0x0d2e0010), SPH_C32(0x8949bfe9), SPH_C32(0x854e2bfb), + SPH_C32(0x12be7119), SPH_C32(0xd0f30020), SPH_C32(0x2c804e6d), + SPH_C32(0xbcb34701), SPH_C32(0x30b21104) }, + { SPH_C32(0x724b0000), SPH_C32(0xad67ab9b), SPH_C32(0x457d0b05), + SPH_C32(0xd21db1c4), SPH_C32(0x81af0030), SPH_C32(0x6c733c96), + SPH_C32(0x40546103), SPH_C32(0x41e54165) }, + { SPH_C32(0x23170010), SPH_C32(0xed94d960), SPH_C32(0xb99a2d07), + SPH_C32(0xa34ae1a5), SPH_C32(0xaf960030), SPH_C32(0x08ae5a1f), + SPH_C32(0x7c8067ff), SPH_C32(0xf011d1d9) }, + { SPH_C32(0xfeca0020), SPH_C32(0x485d28e4), SPH_C32(0x806741fd), + SPH_C32(0x814681b8), SPH_C32(0xa2b80020), SPH_C32(0x81e7e5f6), + SPH_C32(0xf9ce4c04), SPH_C32(0xe2afa0c0) }, + { SPH_C32(0xaf960030), SPH_C32(0x08ae5a1f), SPH_C32(0x7c8067ff), + SPH_C32(0xf011d1d9), SPH_C32(0x8c810020), SPH_C32(0xe53a837f), + SPH_C32(0xc51a4af8), SPH_C32(0x535b307c) }, + { SPH_C32(0xd0f30020), SPH_C32(0x2c804e6d), SPH_C32(0xbcb34701), + SPH_C32(0x30b21104), SPH_C32(0xdddd0030), SPH_C32(0xa5c9f184), + SPH_C32(0x39fd6cfa), SPH_C32(0x220c601d) }, + { SPH_C32(0x81af0030), SPH_C32(0x6c733c96), SPH_C32(0x40546103), + SPH_C32(0x41e54165), SPH_C32(0xf3e40030), SPH_C32(0xc114970d), + SPH_C32(0x05296a06), SPH_C32(0x93f8f0a1) }, + { SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), SPH_C32(0x36656ba8), + SPH_C32(0x23633a05), SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), + SPH_C32(0x5d5ca0f7), SPH_C32(0x727784cb) }, + { SPH_C32(0x1c920050), SPH_C32(0x7ba89e85), SPH_C32(0xca824daa), + SPH_C32(0x52346a64), SPH_C32(0x56920000), SPH_C32(0xc4103cbd), + SPH_C32(0x6188a60b), SPH_C32(0xc3831477) }, + { SPH_C32(0x63f70040), SPH_C32(0x5f868af7), SPH_C32(0x0ab16d54), + SPH_C32(0x9297aab9), SPH_C32(0x07ce0010), SPH_C32(0x84e34e46), + SPH_C32(0x9d6f8009), SPH_C32(0xb2d44416) }, + { SPH_C32(0x32ab0050), SPH_C32(0x1f75f80c), SPH_C32(0xf6564b56), + SPH_C32(0xe3c0fad8), SPH_C32(0x29f70010), SPH_C32(0xe03e28cf), + SPH_C32(0xa1bb86f5), SPH_C32(0x0320d4aa) }, + { SPH_C32(0xef760060), SPH_C32(0xbabc0988), SPH_C32(0xcfab27ac), + SPH_C32(0xc1cc9ac5), SPH_C32(0x24d90000), SPH_C32(0x69779726), + SPH_C32(0x24f5ad0e), SPH_C32(0x119ea5b3) }, + { SPH_C32(0xbe2a0070), SPH_C32(0xfa4f7b73), SPH_C32(0x334c01ae), + SPH_C32(0xb09bcaa4), SPH_C32(0x0ae00000), SPH_C32(0x0daaf1af), + SPH_C32(0x1821abf2), SPH_C32(0xa06a350f) }, + { SPH_C32(0xc14f0060), SPH_C32(0xde616f01), SPH_C32(0xf37f2150), + SPH_C32(0x70380a79), SPH_C32(0x5bbc0010), SPH_C32(0x4d598354), + SPH_C32(0xe4c68df0), SPH_C32(0xd13d656e) }, + { SPH_C32(0x90130070), SPH_C32(0x9e921dfa), SPH_C32(0x0f980752), + SPH_C32(0x016f5a18), SPH_C32(0x75850010), SPH_C32(0x2984e5dd), + SPH_C32(0xd8128b0c), SPH_C32(0x60c9f5d2) }, + { SPH_C32(0x11bc0040), SPH_C32(0xf2e1216c), SPH_C32(0x4fcc6651), + SPH_C32(0x408a1b7d), SPH_C32(0x86610020), SPH_C32(0xe89072d0), + SPH_C32(0xdd3be10a), SPH_C32(0xf3310573) }, + { SPH_C32(0x40e00050), SPH_C32(0xb2125397), SPH_C32(0xb32b4053), + SPH_C32(0x31dd4b1c), SPH_C32(0xa8580020), SPH_C32(0x8c4d1459), + SPH_C32(0xe1efe7f6), SPH_C32(0x42c595cf) }, + { SPH_C32(0x3f850040), SPH_C32(0x963c47e5), SPH_C32(0x731860ad), + SPH_C32(0xf17e8bc1), SPH_C32(0xf9040030), SPH_C32(0xccbe66a2), + SPH_C32(0x1d08c1f4), SPH_C32(0x3392c5ae) }, + { SPH_C32(0x6ed90050), SPH_C32(0xd6cf351e), SPH_C32(0x8fff46af), + SPH_C32(0x8029dba0), SPH_C32(0xd73d0030), SPH_C32(0xa863002b), + SPH_C32(0x21dcc708), SPH_C32(0x82665512) }, + { SPH_C32(0xb3040060), SPH_C32(0x7306c49a), SPH_C32(0xb6022a55), + SPH_C32(0xa225bbbd), SPH_C32(0xda130020), SPH_C32(0x212abfc2), + SPH_C32(0xa492ecf3), SPH_C32(0x90d8240b) }, + { SPH_C32(0xe2580070), SPH_C32(0x33f5b661), SPH_C32(0x4ae50c57), + SPH_C32(0xd372ebdc), SPH_C32(0xf42a0020), SPH_C32(0x45f7d94b), + SPH_C32(0x9846ea0f), SPH_C32(0x212cb4b7) }, + { SPH_C32(0x9d3d0060), SPH_C32(0x17dba213), SPH_C32(0x8ad62ca9), + SPH_C32(0x13d12b01), SPH_C32(0xa5760030), SPH_C32(0x0504abb0), + SPH_C32(0x64a1cc0d), SPH_C32(0x507be4d6) }, + { SPH_C32(0xcc610070), SPH_C32(0x5728d0e8), SPH_C32(0x76310aab), + SPH_C32(0x62867b60), SPH_C32(0x8b4f0030), SPH_C32(0x61d9cd39), + SPH_C32(0x5875caf1), SPH_C32(0xe18f746a) }, + { SPH_C32(0x78ab0000), SPH_C32(0xa0cd5a34), SPH_C32(0x5d5ca0f7), + SPH_C32(0x727784cb), SPH_C32(0x35650040), SPH_C32(0x9b96b64a), + SPH_C32(0x6b39cb5f), SPH_C32(0x5114bece) }, + { SPH_C32(0x29f70010), SPH_C32(0xe03e28cf), SPH_C32(0xa1bb86f5), + SPH_C32(0x0320d4aa), SPH_C32(0x1b5c0040), SPH_C32(0xff4bd0c3), + SPH_C32(0x57edcda3), SPH_C32(0xe0e02e72) }, + { SPH_C32(0x56920000), SPH_C32(0xc4103cbd), SPH_C32(0x6188a60b), + SPH_C32(0xc3831477), SPH_C32(0x4a000050), SPH_C32(0xbfb8a238), + SPH_C32(0xab0aeba1), SPH_C32(0x91b77e13) }, + { SPH_C32(0x07ce0010), SPH_C32(0x84e34e46), SPH_C32(0x9d6f8009), + SPH_C32(0xb2d44416), SPH_C32(0x64390050), SPH_C32(0xdb65c4b1), + SPH_C32(0x97deed5d), SPH_C32(0x2043eeaf) }, + { SPH_C32(0xda130020), SPH_C32(0x212abfc2), SPH_C32(0xa492ecf3), + SPH_C32(0x90d8240b), SPH_C32(0x69170040), SPH_C32(0x522c7b58), + SPH_C32(0x1290c6a6), SPH_C32(0x32fd9fb6) }, + { SPH_C32(0x8b4f0030), SPH_C32(0x61d9cd39), SPH_C32(0x5875caf1), + SPH_C32(0xe18f746a), SPH_C32(0x472e0040), SPH_C32(0x36f11dd1), + SPH_C32(0x2e44c05a), SPH_C32(0x83090f0a) }, + { SPH_C32(0xf42a0020), SPH_C32(0x45f7d94b), SPH_C32(0x9846ea0f), + SPH_C32(0x212cb4b7), SPH_C32(0x16720050), SPH_C32(0x76026f2a), + SPH_C32(0xd2a3e658), SPH_C32(0xf25e5f6b) }, + { SPH_C32(0xa5760030), SPH_C32(0x0504abb0), SPH_C32(0x64a1cc0d), + SPH_C32(0x507be4d6), SPH_C32(0x384b0050), SPH_C32(0x12df09a3), + SPH_C32(0xee77e0a4), SPH_C32(0x43aacfd7) }, + { SPH_C32(0x24d90000), SPH_C32(0x69779726), SPH_C32(0x24f5ad0e), + SPH_C32(0x119ea5b3), SPH_C32(0xcbaf0060), SPH_C32(0xd3cb9eae), + SPH_C32(0xeb5e8aa2), SPH_C32(0xd0523f76) }, + { SPH_C32(0x75850010), SPH_C32(0x2984e5dd), SPH_C32(0xd8128b0c), + SPH_C32(0x60c9f5d2), SPH_C32(0xe5960060), SPH_C32(0xb716f827), + SPH_C32(0xd78a8c5e), SPH_C32(0x61a6afca) }, + { SPH_C32(0x0ae00000), SPH_C32(0x0daaf1af), SPH_C32(0x1821abf2), + SPH_C32(0xa06a350f), SPH_C32(0xb4ca0070), SPH_C32(0xf7e58adc), + SPH_C32(0x2b6daa5c), SPH_C32(0x10f1ffab) }, + { SPH_C32(0x5bbc0010), SPH_C32(0x4d598354), SPH_C32(0xe4c68df0), + SPH_C32(0xd13d656e), SPH_C32(0x9af30070), SPH_C32(0x9338ec55), + SPH_C32(0x17b9aca0), SPH_C32(0xa1056f17) }, + { SPH_C32(0x86610020), SPH_C32(0xe89072d0), SPH_C32(0xdd3be10a), + SPH_C32(0xf3310573), SPH_C32(0x97dd0060), SPH_C32(0x1a7153bc), + SPH_C32(0x92f7875b), SPH_C32(0xb3bb1e0e) }, + { SPH_C32(0xd73d0030), SPH_C32(0xa863002b), SPH_C32(0x21dcc708), + SPH_C32(0x82665512), SPH_C32(0xb9e40060), SPH_C32(0x7eac3535), + SPH_C32(0xae2381a7), SPH_C32(0x024f8eb2) }, + { SPH_C32(0xa8580020), SPH_C32(0x8c4d1459), SPH_C32(0xe1efe7f6), + SPH_C32(0x42c595cf), SPH_C32(0xe8b80070), SPH_C32(0x3e5f47ce), + SPH_C32(0x52c4a7a5), SPH_C32(0x7318ded3) }, + { SPH_C32(0xf9040030), SPH_C32(0xccbe66a2), SPH_C32(0x1d08c1f4), + SPH_C32(0x3392c5ae), SPH_C32(0xc6810070), SPH_C32(0x5a822147), + SPH_C32(0x6e10a159), SPH_C32(0xc2ec4e6f) }, + { SPH_C32(0x35650040), SPH_C32(0x9b96b64a), SPH_C32(0x6b39cb5f), + SPH_C32(0x5114bece), SPH_C32(0x4dce0040), SPH_C32(0x3b5bec7e), + SPH_C32(0x36656ba8), SPH_C32(0x23633a05) }, + { SPH_C32(0x64390050), SPH_C32(0xdb65c4b1), SPH_C32(0x97deed5d), + SPH_C32(0x2043eeaf), SPH_C32(0x63f70040), SPH_C32(0x5f868af7), + SPH_C32(0x0ab16d54), SPH_C32(0x9297aab9) }, + { SPH_C32(0x1b5c0040), SPH_C32(0xff4bd0c3), SPH_C32(0x57edcda3), + SPH_C32(0xe0e02e72), SPH_C32(0x32ab0050), SPH_C32(0x1f75f80c), + SPH_C32(0xf6564b56), SPH_C32(0xe3c0fad8) }, + { SPH_C32(0x4a000050), SPH_C32(0xbfb8a238), SPH_C32(0xab0aeba1), + SPH_C32(0x91b77e13), SPH_C32(0x1c920050), SPH_C32(0x7ba89e85), + SPH_C32(0xca824daa), SPH_C32(0x52346a64) }, + { SPH_C32(0x97dd0060), SPH_C32(0x1a7153bc), SPH_C32(0x92f7875b), + SPH_C32(0xb3bb1e0e), SPH_C32(0x11bc0040), SPH_C32(0xf2e1216c), + SPH_C32(0x4fcc6651), SPH_C32(0x408a1b7d) }, + { SPH_C32(0xc6810070), SPH_C32(0x5a822147), SPH_C32(0x6e10a159), + SPH_C32(0xc2ec4e6f), SPH_C32(0x3f850040), SPH_C32(0x963c47e5), + SPH_C32(0x731860ad), SPH_C32(0xf17e8bc1) }, + { SPH_C32(0xb9e40060), SPH_C32(0x7eac3535), SPH_C32(0xae2381a7), + SPH_C32(0x024f8eb2), SPH_C32(0x6ed90050), SPH_C32(0xd6cf351e), + SPH_C32(0x8fff46af), SPH_C32(0x8029dba0) }, + { SPH_C32(0xe8b80070), SPH_C32(0x3e5f47ce), SPH_C32(0x52c4a7a5), + SPH_C32(0x7318ded3), SPH_C32(0x40e00050), SPH_C32(0xb2125397), + SPH_C32(0xb32b4053), SPH_C32(0x31dd4b1c) }, + { SPH_C32(0x69170040), SPH_C32(0x522c7b58), SPH_C32(0x1290c6a6), + SPH_C32(0x32fd9fb6), SPH_C32(0xb3040060), SPH_C32(0x7306c49a), + SPH_C32(0xb6022a55), SPH_C32(0xa225bbbd) }, + { SPH_C32(0x384b0050), SPH_C32(0x12df09a3), SPH_C32(0xee77e0a4), + SPH_C32(0x43aacfd7), SPH_C32(0x9d3d0060), SPH_C32(0x17dba213), + SPH_C32(0x8ad62ca9), SPH_C32(0x13d12b01) }, + { SPH_C32(0x472e0040), SPH_C32(0x36f11dd1), SPH_C32(0x2e44c05a), + SPH_C32(0x83090f0a), SPH_C32(0xcc610070), SPH_C32(0x5728d0e8), + SPH_C32(0x76310aab), SPH_C32(0x62867b60) }, + { SPH_C32(0x16720050), SPH_C32(0x76026f2a), SPH_C32(0xd2a3e658), + SPH_C32(0xf25e5f6b), SPH_C32(0xe2580070), SPH_C32(0x33f5b661), + SPH_C32(0x4ae50c57), SPH_C32(0xd372ebdc) }, + { SPH_C32(0xcbaf0060), SPH_C32(0xd3cb9eae), SPH_C32(0xeb5e8aa2), + SPH_C32(0xd0523f76), SPH_C32(0xef760060), SPH_C32(0xbabc0988), + SPH_C32(0xcfab27ac), SPH_C32(0xc1cc9ac5) }, + { SPH_C32(0x9af30070), SPH_C32(0x9338ec55), SPH_C32(0x17b9aca0), + SPH_C32(0xa1056f17), SPH_C32(0xc14f0060), SPH_C32(0xde616f01), + SPH_C32(0xf37f2150), SPH_C32(0x70380a79) }, + { SPH_C32(0xe5960060), SPH_C32(0xb716f827), SPH_C32(0xd78a8c5e), + SPH_C32(0x61a6afca), SPH_C32(0x90130070), SPH_C32(0x9e921dfa), + SPH_C32(0x0f980752), SPH_C32(0x016f5a18) }, + { SPH_C32(0xb4ca0070), SPH_C32(0xf7e58adc), SPH_C32(0x2b6daa5c), + SPH_C32(0x10f1ffab), SPH_C32(0xbe2a0070), SPH_C32(0xfa4f7b73), + SPH_C32(0x334c01ae), SPH_C32(0xb09bcaa4) }, + { SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), SPH_C32(0xc2c46c55), + SPH_C32(0xf362b233), SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), + SPH_C32(0xd14e094b), SPH_C32(0xb772b42b) }, + { SPH_C32(0x0a8e0090), SPH_C32(0x05fc6a17), SPH_C32(0x3e234a57), + SPH_C32(0x8235e252), SPH_C32(0x179f0000), SPH_C32(0x2e6a3562), + SPH_C32(0xed9a0fb7), SPH_C32(0x06862497) }, + { SPH_C32(0x75eb0080), SPH_C32(0x21d27e65), SPH_C32(0xfe106aa9), + SPH_C32(0x4296228f), SPH_C32(0x46c30010), SPH_C32(0x6e994799), + SPH_C32(0x117d29b5), SPH_C32(0x77d174f6) }, + { SPH_C32(0x24b70090), SPH_C32(0x61210c9e), SPH_C32(0x02f74cab), + SPH_C32(0x33c172ee), SPH_C32(0x68fa0010), SPH_C32(0x0a442110), + SPH_C32(0x2da92f49), SPH_C32(0xc625e44a) }, + { SPH_C32(0xf96a00a0), SPH_C32(0xc4e8fd1a), SPH_C32(0x3b0a2051), + SPH_C32(0x11cd12f3), SPH_C32(0x65d40000), SPH_C32(0x830d9ef9), + SPH_C32(0xa8e704b2), SPH_C32(0xd49b9553) }, + { SPH_C32(0xa83600b0), SPH_C32(0x841b8fe1), SPH_C32(0xc7ed0653), + SPH_C32(0x609a4292), SPH_C32(0x4bed0000), SPH_C32(0xe7d0f870), + SPH_C32(0x9433024e), SPH_C32(0x656f05ef) }, + { SPH_C32(0xd75300a0), SPH_C32(0xa0359b93), SPH_C32(0x07de26ad), + SPH_C32(0xa039824f), SPH_C32(0x1ab10010), SPH_C32(0xa7238a8b), + SPH_C32(0x68d4244c), SPH_C32(0x1438558e) }, + { SPH_C32(0x860f00b0), SPH_C32(0xe0c6e968), SPH_C32(0xfb3900af), + SPH_C32(0xd16ed22e), SPH_C32(0x34880010), SPH_C32(0xc3feec02), + SPH_C32(0x540022b0), SPH_C32(0xa5ccc532) }, + { SPH_C32(0x07a00080), SPH_C32(0x8cb5d5fe), SPH_C32(0xbb6d61ac), + SPH_C32(0x908b934b), SPH_C32(0xc76c0020), SPH_C32(0x02ea7b0f), + SPH_C32(0x512948b6), SPH_C32(0x36343593) }, + { SPH_C32(0x56fc0090), SPH_C32(0xcc46a705), SPH_C32(0x478a47ae), + SPH_C32(0xe1dcc32a), SPH_C32(0xe9550020), SPH_C32(0x66371d86), + SPH_C32(0x6dfd4e4a), SPH_C32(0x87c0a52f) }, + { SPH_C32(0x29990080), SPH_C32(0xe868b377), SPH_C32(0x87b96750), + SPH_C32(0x217f03f7), SPH_C32(0xb8090030), SPH_C32(0x26c46f7d), + SPH_C32(0x911a6848), SPH_C32(0xf697f54e) }, + { SPH_C32(0x78c50090), SPH_C32(0xa89bc18c), SPH_C32(0x7b5e4152), + SPH_C32(0x50285396), SPH_C32(0x96300030), SPH_C32(0x421909f4), + SPH_C32(0xadce6eb4), SPH_C32(0x476365f2) }, + { SPH_C32(0xa51800a0), SPH_C32(0x0d523008), SPH_C32(0x42a32da8), + SPH_C32(0x7224338b), SPH_C32(0x9b1e0020), SPH_C32(0xcb50b61d), + SPH_C32(0x2880454f), SPH_C32(0x55dd14eb) }, + { SPH_C32(0xf44400b0), SPH_C32(0x4da142f3), SPH_C32(0xbe440baa), + SPH_C32(0x037363ea), SPH_C32(0xb5270020), SPH_C32(0xaf8dd094), + SPH_C32(0x145443b3), SPH_C32(0xe4298457) }, + { SPH_C32(0x8b2100a0), SPH_C32(0x698f5681), SPH_C32(0x7e772b54), + SPH_C32(0xc3d0a337), SPH_C32(0xe47b0030), SPH_C32(0xef7ea26f), + SPH_C32(0xe8b365b1), SPH_C32(0x957ed436) }, + { SPH_C32(0xda7d00b0), SPH_C32(0x297c247a), SPH_C32(0x82900d56), + SPH_C32(0xb287f356), SPH_C32(0xca420030), SPH_C32(0x8ba3c4e6), + SPH_C32(0xd467634d), SPH_C32(0x248a448a) }, + { SPH_C32(0x161c00c0), SPH_C32(0x7e54f492), SPH_C32(0xf4a107fd), + SPH_C32(0xd0018836), SPH_C32(0x410d0000), SPH_C32(0xea7a09df), + SPH_C32(0x8c12a9bc), SPH_C32(0xc50530e0) }, + { SPH_C32(0x474000d0), SPH_C32(0x3ea78669), SPH_C32(0x084621ff), + SPH_C32(0xa156d857), SPH_C32(0x6f340000), SPH_C32(0x8ea76f56), + SPH_C32(0xb0c6af40), SPH_C32(0x74f1a05c) }, + { SPH_C32(0x382500c0), SPH_C32(0x1a89921b), SPH_C32(0xc8750101), + SPH_C32(0x61f5188a), SPH_C32(0x3e680010), SPH_C32(0xce541dad), + SPH_C32(0x4c218942), SPH_C32(0x05a6f03d) }, + { SPH_C32(0x697900d0), SPH_C32(0x5a7ae0e0), SPH_C32(0x34922703), + SPH_C32(0x10a248eb), SPH_C32(0x10510010), SPH_C32(0xaa897b24), + SPH_C32(0x70f58fbe), SPH_C32(0xb4526081) }, + { SPH_C32(0xb4a400e0), SPH_C32(0xffb31164), SPH_C32(0x0d6f4bf9), + SPH_C32(0x32ae28f6), SPH_C32(0x1d7f0000), SPH_C32(0x23c0c4cd), + SPH_C32(0xf5bba445), SPH_C32(0xa6ec1198) }, + { SPH_C32(0xe5f800f0), SPH_C32(0xbf40639f), SPH_C32(0xf1886dfb), + SPH_C32(0x43f97897), SPH_C32(0x33460000), SPH_C32(0x471da244), + SPH_C32(0xc96fa2b9), SPH_C32(0x17188124) }, + { SPH_C32(0x9a9d00e0), SPH_C32(0x9b6e77ed), SPH_C32(0x31bb4d05), + SPH_C32(0x835ab84a), SPH_C32(0x621a0010), SPH_C32(0x07eed0bf), + SPH_C32(0x358884bb), SPH_C32(0x664fd145) }, + { SPH_C32(0xcbc100f0), SPH_C32(0xdb9d0516), SPH_C32(0xcd5c6b07), + SPH_C32(0xf20de82b), SPH_C32(0x4c230010), SPH_C32(0x6333b636), + SPH_C32(0x095c8247), SPH_C32(0xd7bb41f9) }, + { SPH_C32(0x4a6e00c0), SPH_C32(0xb7ee3980), SPH_C32(0x8d080a04), + SPH_C32(0xb3e8a94e), SPH_C32(0xbfc70020), SPH_C32(0xa227213b), + SPH_C32(0x0c75e841), SPH_C32(0x4443b158) }, + { SPH_C32(0x1b3200d0), SPH_C32(0xf71d4b7b), SPH_C32(0x71ef2c06), + SPH_C32(0xc2bff92f), SPH_C32(0x91fe0020), SPH_C32(0xc6fa47b2), + SPH_C32(0x30a1eebd), SPH_C32(0xf5b721e4) }, + { SPH_C32(0x645700c0), SPH_C32(0xd3335f09), SPH_C32(0xb1dc0cf8), + SPH_C32(0x021c39f2), SPH_C32(0xc0a20030), SPH_C32(0x86093549), + SPH_C32(0xcc46c8bf), SPH_C32(0x84e07185) }, + { SPH_C32(0x350b00d0), SPH_C32(0x93c02df2), SPH_C32(0x4d3b2afa), + SPH_C32(0x734b6993), SPH_C32(0xee9b0030), SPH_C32(0xe2d453c0), + SPH_C32(0xf092ce43), SPH_C32(0x3514e139) }, + { SPH_C32(0xe8d600e0), SPH_C32(0x3609dc76), SPH_C32(0x74c64600), + SPH_C32(0x5147098e), SPH_C32(0xe3b50020), SPH_C32(0x6b9dec29), + SPH_C32(0x75dce5b8), SPH_C32(0x27aa9020) }, + { SPH_C32(0xb98a00f0), SPH_C32(0x76faae8d), SPH_C32(0x88216002), + SPH_C32(0x201059ef), SPH_C32(0xcd8c0020), SPH_C32(0x0f408aa0), + SPH_C32(0x4908e344), SPH_C32(0x965e009c) }, + { SPH_C32(0xc6ef00e0), SPH_C32(0x52d4baff), SPH_C32(0x481240fc), + SPH_C32(0xe0b39932), SPH_C32(0x9cd00030), SPH_C32(0x4fb3f85b), + SPH_C32(0xb5efc546), SPH_C32(0xe70950fd) }, + { SPH_C32(0x97b300f0), SPH_C32(0x1227c804), SPH_C32(0xb4f566fe), + SPH_C32(0x91e4c953), SPH_C32(0xb2e90030), SPH_C32(0x2b6e9ed2), + SPH_C32(0x893bc3ba), SPH_C32(0x56fdc041) }, + { SPH_C32(0x23790080), SPH_C32(0xe5c242d8), SPH_C32(0x9f98cca2), + SPH_C32(0x811536f8), SPH_C32(0x0cc30040), SPH_C32(0xd121e5a1), + SPH_C32(0xba77c214), SPH_C32(0xe6660ae5) }, + { SPH_C32(0x72250090), SPH_C32(0xa5313023), SPH_C32(0x637feaa0), + SPH_C32(0xf0426699), SPH_C32(0x22fa0040), SPH_C32(0xb5fc8328), + SPH_C32(0x86a3c4e8), SPH_C32(0x57929a59) }, + { SPH_C32(0x0d400080), SPH_C32(0x811f2451), SPH_C32(0xa34cca5e), + SPH_C32(0x30e1a644), SPH_C32(0x73a60050), SPH_C32(0xf50ff1d3), + SPH_C32(0x7a44e2ea), SPH_C32(0x26c5ca38) }, + { SPH_C32(0x5c1c0090), SPH_C32(0xc1ec56aa), SPH_C32(0x5fabec5c), + SPH_C32(0x41b6f625), SPH_C32(0x5d9f0050), SPH_C32(0x91d2975a), + SPH_C32(0x4690e416), SPH_C32(0x97315a84) }, + { SPH_C32(0x81c100a0), SPH_C32(0x6425a72e), SPH_C32(0x665680a6), + SPH_C32(0x63ba9638), SPH_C32(0x50b10040), SPH_C32(0x189b28b3), + SPH_C32(0xc3decfed), SPH_C32(0x858f2b9d) }, + { SPH_C32(0xd09d00b0), SPH_C32(0x24d6d5d5), SPH_C32(0x9ab1a6a4), + SPH_C32(0x12edc659), SPH_C32(0x7e880040), SPH_C32(0x7c464e3a), + SPH_C32(0xff0ac911), SPH_C32(0x347bbb21) }, + { SPH_C32(0xaff800a0), SPH_C32(0x00f8c1a7), SPH_C32(0x5a82865a), + SPH_C32(0xd24e0684), SPH_C32(0x2fd40050), SPH_C32(0x3cb53cc1), + SPH_C32(0x03edef13), SPH_C32(0x452ceb40) }, + { SPH_C32(0xfea400b0), SPH_C32(0x400bb35c), SPH_C32(0xa665a058), + SPH_C32(0xa31956e5), SPH_C32(0x01ed0050), SPH_C32(0x58685a48), + SPH_C32(0x3f39e9ef), SPH_C32(0xf4d87bfc) }, + { SPH_C32(0x7f0b0080), SPH_C32(0x2c788fca), SPH_C32(0xe631c15b), + SPH_C32(0xe2fc1780), SPH_C32(0xf2090060), SPH_C32(0x997ccd45), + SPH_C32(0x3a1083e9), SPH_C32(0x67208b5d) }, + { SPH_C32(0x2e570090), SPH_C32(0x6c8bfd31), SPH_C32(0x1ad6e759), + SPH_C32(0x93ab47e1), SPH_C32(0xdc300060), SPH_C32(0xfda1abcc), + SPH_C32(0x06c48515), SPH_C32(0xd6d41be1) }, + { SPH_C32(0x51320080), SPH_C32(0x48a5e943), SPH_C32(0xdae5c7a7), + SPH_C32(0x5308873c), SPH_C32(0x8d6c0070), SPH_C32(0xbd52d937), + SPH_C32(0xfa23a317), SPH_C32(0xa7834b80) }, + { SPH_C32(0x006e0090), SPH_C32(0x08569bb8), SPH_C32(0x2602e1a5), + SPH_C32(0x225fd75d), SPH_C32(0xa3550070), SPH_C32(0xd98fbfbe), + SPH_C32(0xc6f7a5eb), SPH_C32(0x1677db3c) }, + { SPH_C32(0xddb300a0), SPH_C32(0xad9f6a3c), SPH_C32(0x1fff8d5f), + SPH_C32(0x0053b740), SPH_C32(0xae7b0060), SPH_C32(0x50c60057), + SPH_C32(0x43b98e10), SPH_C32(0x04c9aa25) }, + { SPH_C32(0x8cef00b0), SPH_C32(0xed6c18c7), SPH_C32(0xe318ab5d), + SPH_C32(0x7104e721), SPH_C32(0x80420060), SPH_C32(0x341b66de), + SPH_C32(0x7f6d88ec), SPH_C32(0xb53d3a99) }, + { SPH_C32(0xf38a00a0), SPH_C32(0xc9420cb5), SPH_C32(0x232b8ba3), + SPH_C32(0xb1a727fc), SPH_C32(0xd11e0070), SPH_C32(0x74e81425), + SPH_C32(0x838aaeee), SPH_C32(0xc46a6af8) }, + { SPH_C32(0xa2d600b0), SPH_C32(0x89b17e4e), SPH_C32(0xdfccada1), + SPH_C32(0xc0f0779d), SPH_C32(0xff270070), SPH_C32(0x103572ac), + SPH_C32(0xbf5ea812), SPH_C32(0x759efa44) }, + { SPH_C32(0x6eb700c0), SPH_C32(0xde99aea6), SPH_C32(0xa9fda70a), + SPH_C32(0xa2760cfd), SPH_C32(0x74680040), SPH_C32(0x71ecbf95), + SPH_C32(0xe72b62e3), SPH_C32(0x94118e2e) }, + { SPH_C32(0x3feb00d0), SPH_C32(0x9e6adc5d), SPH_C32(0x551a8108), + SPH_C32(0xd3215c9c), SPH_C32(0x5a510040), SPH_C32(0x1531d91c), + SPH_C32(0xdbff641f), SPH_C32(0x25e51e92) }, + { SPH_C32(0x408e00c0), SPH_C32(0xba44c82f), SPH_C32(0x9529a1f6), + SPH_C32(0x13829c41), SPH_C32(0x0b0d0050), SPH_C32(0x55c2abe7), + SPH_C32(0x2718421d), SPH_C32(0x54b24ef3) }, + { SPH_C32(0x11d200d0), SPH_C32(0xfab7bad4), SPH_C32(0x69ce87f4), + SPH_C32(0x62d5cc20), SPH_C32(0x25340050), SPH_C32(0x311fcd6e), + SPH_C32(0x1bcc44e1), SPH_C32(0xe546de4f) }, + { SPH_C32(0xcc0f00e0), SPH_C32(0x5f7e4b50), SPH_C32(0x5033eb0e), + SPH_C32(0x40d9ac3d), SPH_C32(0x281a0040), SPH_C32(0xb8567287), + SPH_C32(0x9e826f1a), SPH_C32(0xf7f8af56) }, + { SPH_C32(0x9d5300f0), SPH_C32(0x1f8d39ab), SPH_C32(0xacd4cd0c), + SPH_C32(0x318efc5c), SPH_C32(0x06230040), SPH_C32(0xdc8b140e), + SPH_C32(0xa25669e6), SPH_C32(0x460c3fea) }, + { SPH_C32(0xe23600e0), SPH_C32(0x3ba32dd9), SPH_C32(0x6ce7edf2), + SPH_C32(0xf12d3c81), SPH_C32(0x577f0050), SPH_C32(0x9c7866f5), + SPH_C32(0x5eb14fe4), SPH_C32(0x375b6f8b) }, + { SPH_C32(0xb36a00f0), SPH_C32(0x7b505f22), SPH_C32(0x9000cbf0), + SPH_C32(0x807a6ce0), SPH_C32(0x79460050), SPH_C32(0xf8a5007c), + SPH_C32(0x62654918), SPH_C32(0x86afff37) }, + { SPH_C32(0x32c500c0), SPH_C32(0x172363b4), SPH_C32(0xd054aaf3), + SPH_C32(0xc19f2d85), SPH_C32(0x8aa20060), SPH_C32(0x39b19771), + SPH_C32(0x674c231e), SPH_C32(0x15570f96) }, + { SPH_C32(0x639900d0), SPH_C32(0x57d0114f), SPH_C32(0x2cb38cf1), + SPH_C32(0xb0c87de4), SPH_C32(0xa49b0060), SPH_C32(0x5d6cf1f8), + SPH_C32(0x5b9825e2), SPH_C32(0xa4a39f2a) }, + { SPH_C32(0x1cfc00c0), SPH_C32(0x73fe053d), SPH_C32(0xec80ac0f), + SPH_C32(0x706bbd39), SPH_C32(0xf5c70070), SPH_C32(0x1d9f8303), + SPH_C32(0xa77f03e0), SPH_C32(0xd5f4cf4b) }, + { SPH_C32(0x4da000d0), SPH_C32(0x330d77c6), SPH_C32(0x10678a0d), + SPH_C32(0x013ced58), SPH_C32(0xdbfe0070), SPH_C32(0x7942e58a), + SPH_C32(0x9bab051c), SPH_C32(0x64005ff7) }, + { SPH_C32(0x907d00e0), SPH_C32(0x96c48642), SPH_C32(0x299ae6f7), + SPH_C32(0x23308d45), SPH_C32(0xd6d00060), SPH_C32(0xf00b5a63), + SPH_C32(0x1ee52ee7), SPH_C32(0x76be2eee) }, + { SPH_C32(0xc12100f0), SPH_C32(0xd637f4b9), SPH_C32(0xd57dc0f5), + SPH_C32(0x5267dd24), SPH_C32(0xf8e90060), SPH_C32(0x94d63cea), + SPH_C32(0x2231281b), SPH_C32(0xc74abe52) }, + { SPH_C32(0xbe4400e0), SPH_C32(0xf219e0cb), SPH_C32(0x154ee00b), + SPH_C32(0x92c41df9), SPH_C32(0xa9b50070), SPH_C32(0xd4254e11), + SPH_C32(0xded60e19), SPH_C32(0xb61dee33) }, + { SPH_C32(0xef1800f0), SPH_C32(0xb2ea9230), SPH_C32(0xe9a9c609), + SPH_C32(0xe3934d98), SPH_C32(0x878c0070), SPH_C32(0xb0f82898), + SPH_C32(0xe20208e5), SPH_C32(0x07e97e8f) }, + { SPH_C32(0x39a60000), SPH_C32(0x4ab753eb), SPH_C32(0xd14e094b), + SPH_C32(0xb772b42b), SPH_C32(0x62740080), SPH_C32(0x0fb84b07), + SPH_C32(0x138a651e), SPH_C32(0x44100618) }, + { SPH_C32(0x68fa0010), SPH_C32(0x0a442110), SPH_C32(0x2da92f49), + SPH_C32(0xc625e44a), SPH_C32(0x4c4d0080), SPH_C32(0x6b652d8e), + SPH_C32(0x2f5e63e2), SPH_C32(0xf5e496a4) }, + { SPH_C32(0x179f0000), SPH_C32(0x2e6a3562), SPH_C32(0xed9a0fb7), + SPH_C32(0x06862497), SPH_C32(0x1d110090), SPH_C32(0x2b965f75), + SPH_C32(0xd3b945e0), SPH_C32(0x84b3c6c5) }, + { SPH_C32(0x46c30010), SPH_C32(0x6e994799), SPH_C32(0x117d29b5), + SPH_C32(0x77d174f6), SPH_C32(0x33280090), SPH_C32(0x4f4b39fc), + SPH_C32(0xef6d431c), SPH_C32(0x35475679) }, + { SPH_C32(0x9b1e0020), SPH_C32(0xcb50b61d), SPH_C32(0x2880454f), + SPH_C32(0x55dd14eb), SPH_C32(0x3e060080), SPH_C32(0xc6028615), + SPH_C32(0x6a2368e7), SPH_C32(0x27f92760) }, + { SPH_C32(0xca420030), SPH_C32(0x8ba3c4e6), SPH_C32(0xd467634d), + SPH_C32(0x248a448a), SPH_C32(0x103f0080), SPH_C32(0xa2dfe09c), + SPH_C32(0x56f76e1b), SPH_C32(0x960db7dc) }, + { SPH_C32(0xb5270020), SPH_C32(0xaf8dd094), SPH_C32(0x145443b3), + SPH_C32(0xe4298457), SPH_C32(0x41630090), SPH_C32(0xe22c9267), + SPH_C32(0xaa104819), SPH_C32(0xe75ae7bd) }, + { SPH_C32(0xe47b0030), SPH_C32(0xef7ea26f), SPH_C32(0xe8b365b1), + SPH_C32(0x957ed436), SPH_C32(0x6f5a0090), SPH_C32(0x86f1f4ee), + SPH_C32(0x96c44ee5), SPH_C32(0x56ae7701) }, + { SPH_C32(0x65d40000), SPH_C32(0x830d9ef9), SPH_C32(0xa8e704b2), + SPH_C32(0xd49b9553), SPH_C32(0x9cbe00a0), SPH_C32(0x47e563e3), + SPH_C32(0x93ed24e3), SPH_C32(0xc55687a0) }, + { SPH_C32(0x34880010), SPH_C32(0xc3feec02), SPH_C32(0x540022b0), + SPH_C32(0xa5ccc532), SPH_C32(0xb28700a0), SPH_C32(0x2338056a), + SPH_C32(0xaf39221f), SPH_C32(0x74a2171c) }, + { SPH_C32(0x4bed0000), SPH_C32(0xe7d0f870), SPH_C32(0x9433024e), + SPH_C32(0x656f05ef), SPH_C32(0xe3db00b0), SPH_C32(0x63cb7791), + SPH_C32(0x53de041d), SPH_C32(0x05f5477d) }, + { SPH_C32(0x1ab10010), SPH_C32(0xa7238a8b), SPH_C32(0x68d4244c), + SPH_C32(0x1438558e), SPH_C32(0xcde200b0), SPH_C32(0x07161118), + SPH_C32(0x6f0a02e1), SPH_C32(0xb401d7c1) }, + { SPH_C32(0xc76c0020), SPH_C32(0x02ea7b0f), SPH_C32(0x512948b6), + SPH_C32(0x36343593), SPH_C32(0xc0cc00a0), SPH_C32(0x8e5faef1), + SPH_C32(0xea44291a), SPH_C32(0xa6bfa6d8) }, + { SPH_C32(0x96300030), SPH_C32(0x421909f4), SPH_C32(0xadce6eb4), + SPH_C32(0x476365f2), SPH_C32(0xeef500a0), SPH_C32(0xea82c878), + SPH_C32(0xd6902fe6), SPH_C32(0x174b3664) }, + { SPH_C32(0xe9550020), SPH_C32(0x66371d86), SPH_C32(0x6dfd4e4a), + SPH_C32(0x87c0a52f), SPH_C32(0xbfa900b0), SPH_C32(0xaa71ba83), + SPH_C32(0x2a7709e4), SPH_C32(0x661c6605) }, + { SPH_C32(0xb8090030), SPH_C32(0x26c46f7d), SPH_C32(0x911a6848), + SPH_C32(0xf697f54e), SPH_C32(0x919000b0), SPH_C32(0xceacdc0a), + SPH_C32(0x16a30f18), SPH_C32(0xd7e8f6b9) }, + { SPH_C32(0x74680040), SPH_C32(0x71ecbf95), SPH_C32(0xe72b62e3), + SPH_C32(0x94118e2e), SPH_C32(0x1adf0080), SPH_C32(0xaf751133), + SPH_C32(0x4ed6c5e9), SPH_C32(0x366782d3) }, + { SPH_C32(0x25340050), SPH_C32(0x311fcd6e), SPH_C32(0x1bcc44e1), + SPH_C32(0xe546de4f), SPH_C32(0x34e60080), SPH_C32(0xcba877ba), + SPH_C32(0x7202c315), SPH_C32(0x8793126f) }, + { SPH_C32(0x5a510040), SPH_C32(0x1531d91c), SPH_C32(0xdbff641f), + SPH_C32(0x25e51e92), SPH_C32(0x65ba0090), SPH_C32(0x8b5b0541), + SPH_C32(0x8ee5e517), SPH_C32(0xf6c4420e) }, + { SPH_C32(0x0b0d0050), SPH_C32(0x55c2abe7), SPH_C32(0x2718421d), + SPH_C32(0x54b24ef3), SPH_C32(0x4b830090), SPH_C32(0xef8663c8), + SPH_C32(0xb231e3eb), SPH_C32(0x4730d2b2) }, + { SPH_C32(0xd6d00060), SPH_C32(0xf00b5a63), SPH_C32(0x1ee52ee7), + SPH_C32(0x76be2eee), SPH_C32(0x46ad0080), SPH_C32(0x66cfdc21), + SPH_C32(0x377fc810), SPH_C32(0x558ea3ab) }, + { SPH_C32(0x878c0070), SPH_C32(0xb0f82898), SPH_C32(0xe20208e5), + SPH_C32(0x07e97e8f), SPH_C32(0x68940080), SPH_C32(0x0212baa8), + SPH_C32(0x0babceec), SPH_C32(0xe47a3317) }, + { SPH_C32(0xf8e90060), SPH_C32(0x94d63cea), SPH_C32(0x2231281b), + SPH_C32(0xc74abe52), SPH_C32(0x39c80090), SPH_C32(0x42e1c853), + SPH_C32(0xf74ce8ee), SPH_C32(0x952d6376) }, + { SPH_C32(0xa9b50070), SPH_C32(0xd4254e11), SPH_C32(0xded60e19), + SPH_C32(0xb61dee33), SPH_C32(0x17f10090), SPH_C32(0x263caeda), + SPH_C32(0xcb98ee12), SPH_C32(0x24d9f3ca) }, + { SPH_C32(0x281a0040), SPH_C32(0xb8567287), SPH_C32(0x9e826f1a), + SPH_C32(0xf7f8af56), SPH_C32(0xe41500a0), SPH_C32(0xe72839d7), + SPH_C32(0xceb18414), SPH_C32(0xb721036b) }, + { SPH_C32(0x79460050), SPH_C32(0xf8a5007c), SPH_C32(0x62654918), + SPH_C32(0x86afff37), SPH_C32(0xca2c00a0), SPH_C32(0x83f55f5e), + SPH_C32(0xf26582e8), SPH_C32(0x06d593d7) }, + { SPH_C32(0x06230040), SPH_C32(0xdc8b140e), SPH_C32(0xa25669e6), + SPH_C32(0x460c3fea), SPH_C32(0x9b7000b0), SPH_C32(0xc3062da5), + SPH_C32(0x0e82a4ea), SPH_C32(0x7782c3b6) }, + { SPH_C32(0x577f0050), SPH_C32(0x9c7866f5), SPH_C32(0x5eb14fe4), + SPH_C32(0x375b6f8b), SPH_C32(0xb54900b0), SPH_C32(0xa7db4b2c), + SPH_C32(0x3256a216), SPH_C32(0xc676530a) }, + { SPH_C32(0x8aa20060), SPH_C32(0x39b19771), SPH_C32(0x674c231e), + SPH_C32(0x15570f96), SPH_C32(0xb86700a0), SPH_C32(0x2e92f4c5), + SPH_C32(0xb71889ed), SPH_C32(0xd4c82213) }, + { SPH_C32(0xdbfe0070), SPH_C32(0x7942e58a), SPH_C32(0x9bab051c), + SPH_C32(0x64005ff7), SPH_C32(0x965e00a0), SPH_C32(0x4a4f924c), + SPH_C32(0x8bcc8f11), SPH_C32(0x653cb2af) }, + { SPH_C32(0xa49b0060), SPH_C32(0x5d6cf1f8), SPH_C32(0x5b9825e2), + SPH_C32(0xa4a39f2a), SPH_C32(0xc70200b0), SPH_C32(0x0abce0b7), + SPH_C32(0x772ba913), SPH_C32(0x146be2ce) }, + { SPH_C32(0xf5c70070), SPH_C32(0x1d9f8303), SPH_C32(0xa77f03e0), + SPH_C32(0xd5f4cf4b), SPH_C32(0xe93b00b0), SPH_C32(0x6e61863e), + SPH_C32(0x4bffafef), SPH_C32(0xa59f7272) }, + { SPH_C32(0x410d0000), SPH_C32(0xea7a09df), SPH_C32(0x8c12a9bc), + SPH_C32(0xc50530e0), SPH_C32(0x571100c0), SPH_C32(0x942efd4d), + SPH_C32(0x78b3ae41), SPH_C32(0x1504b8d6) }, + { SPH_C32(0x10510010), SPH_C32(0xaa897b24), SPH_C32(0x70f58fbe), + SPH_C32(0xb4526081), SPH_C32(0x792800c0), SPH_C32(0xf0f39bc4), + SPH_C32(0x4467a8bd), SPH_C32(0xa4f0286a) }, + { SPH_C32(0x6f340000), SPH_C32(0x8ea76f56), SPH_C32(0xb0c6af40), + SPH_C32(0x74f1a05c), SPH_C32(0x287400d0), SPH_C32(0xb000e93f), + SPH_C32(0xb8808ebf), SPH_C32(0xd5a7780b) }, + { SPH_C32(0x3e680010), SPH_C32(0xce541dad), SPH_C32(0x4c218942), + SPH_C32(0x05a6f03d), SPH_C32(0x064d00d0), SPH_C32(0xd4dd8fb6), + SPH_C32(0x84548843), SPH_C32(0x6453e8b7) }, + { SPH_C32(0xe3b50020), SPH_C32(0x6b9dec29), SPH_C32(0x75dce5b8), + SPH_C32(0x27aa9020), SPH_C32(0x0b6300c0), SPH_C32(0x5d94305f), + SPH_C32(0x011aa3b8), SPH_C32(0x76ed99ae) }, + { SPH_C32(0xb2e90030), SPH_C32(0x2b6e9ed2), SPH_C32(0x893bc3ba), + SPH_C32(0x56fdc041), SPH_C32(0x255a00c0), SPH_C32(0x394956d6), + SPH_C32(0x3dcea544), SPH_C32(0xc7190912) }, + { SPH_C32(0xcd8c0020), SPH_C32(0x0f408aa0), SPH_C32(0x4908e344), + SPH_C32(0x965e009c), SPH_C32(0x740600d0), SPH_C32(0x79ba242d), + SPH_C32(0xc1298346), SPH_C32(0xb64e5973) }, + { SPH_C32(0x9cd00030), SPH_C32(0x4fb3f85b), SPH_C32(0xb5efc546), + SPH_C32(0xe70950fd), SPH_C32(0x5a3f00d0), SPH_C32(0x1d6742a4), + SPH_C32(0xfdfd85ba), SPH_C32(0x07bac9cf) }, + { SPH_C32(0x1d7f0000), SPH_C32(0x23c0c4cd), SPH_C32(0xf5bba445), + SPH_C32(0xa6ec1198), SPH_C32(0xa9db00e0), SPH_C32(0xdc73d5a9), + SPH_C32(0xf8d4efbc), SPH_C32(0x9442396e) }, + { SPH_C32(0x4c230010), SPH_C32(0x6333b636), SPH_C32(0x095c8247), + SPH_C32(0xd7bb41f9), SPH_C32(0x87e200e0), SPH_C32(0xb8aeb320), + SPH_C32(0xc400e940), SPH_C32(0x25b6a9d2) }, + { SPH_C32(0x33460000), SPH_C32(0x471da244), SPH_C32(0xc96fa2b9), + SPH_C32(0x17188124), SPH_C32(0xd6be00f0), SPH_C32(0xf85dc1db), + SPH_C32(0x38e7cf42), SPH_C32(0x54e1f9b3) }, + { SPH_C32(0x621a0010), SPH_C32(0x07eed0bf), SPH_C32(0x358884bb), + SPH_C32(0x664fd145), SPH_C32(0xf88700f0), SPH_C32(0x9c80a752), + SPH_C32(0x0433c9be), SPH_C32(0xe515690f) }, + { SPH_C32(0xbfc70020), SPH_C32(0xa227213b), SPH_C32(0x0c75e841), + SPH_C32(0x4443b158), SPH_C32(0xf5a900e0), SPH_C32(0x15c918bb), + SPH_C32(0x817de245), SPH_C32(0xf7ab1816) }, + { SPH_C32(0xee9b0030), SPH_C32(0xe2d453c0), SPH_C32(0xf092ce43), + SPH_C32(0x3514e139), SPH_C32(0xdb9000e0), SPH_C32(0x71147e32), + SPH_C32(0xbda9e4b9), SPH_C32(0x465f88aa) }, + { SPH_C32(0x91fe0020), SPH_C32(0xc6fa47b2), SPH_C32(0x30a1eebd), + SPH_C32(0xf5b721e4), SPH_C32(0x8acc00f0), SPH_C32(0x31e70cc9), + SPH_C32(0x414ec2bb), SPH_C32(0x3708d8cb) }, + { SPH_C32(0xc0a20030), SPH_C32(0x86093549), SPH_C32(0xcc46c8bf), + SPH_C32(0x84e07185), SPH_C32(0xa4f500f0), SPH_C32(0x553a6a40), + SPH_C32(0x7d9ac447), SPH_C32(0x86fc4877) }, + { SPH_C32(0x0cc30040), SPH_C32(0xd121e5a1), SPH_C32(0xba77c214), + SPH_C32(0xe6660ae5), SPH_C32(0x2fba00c0), SPH_C32(0x34e3a779), + SPH_C32(0x25ef0eb6), SPH_C32(0x67733c1d) }, + { SPH_C32(0x5d9f0050), SPH_C32(0x91d2975a), SPH_C32(0x4690e416), + SPH_C32(0x97315a84), SPH_C32(0x018300c0), SPH_C32(0x503ec1f0), + SPH_C32(0x193b084a), SPH_C32(0xd687aca1) }, + { SPH_C32(0x22fa0040), SPH_C32(0xb5fc8328), SPH_C32(0x86a3c4e8), + SPH_C32(0x57929a59), SPH_C32(0x50df00d0), SPH_C32(0x10cdb30b), + SPH_C32(0xe5dc2e48), SPH_C32(0xa7d0fcc0) }, + { SPH_C32(0x73a60050), SPH_C32(0xf50ff1d3), SPH_C32(0x7a44e2ea), + SPH_C32(0x26c5ca38), SPH_C32(0x7ee600d0), SPH_C32(0x7410d582), + SPH_C32(0xd90828b4), SPH_C32(0x16246c7c) }, + { SPH_C32(0xae7b0060), SPH_C32(0x50c60057), SPH_C32(0x43b98e10), + SPH_C32(0x04c9aa25), SPH_C32(0x73c800c0), SPH_C32(0xfd596a6b), + SPH_C32(0x5c46034f), SPH_C32(0x049a1d65) }, + { SPH_C32(0xff270070), SPH_C32(0x103572ac), SPH_C32(0xbf5ea812), + SPH_C32(0x759efa44), SPH_C32(0x5df100c0), SPH_C32(0x99840ce2), + SPH_C32(0x609205b3), SPH_C32(0xb56e8dd9) }, + { SPH_C32(0x80420060), SPH_C32(0x341b66de), SPH_C32(0x7f6d88ec), + SPH_C32(0xb53d3a99), SPH_C32(0x0cad00d0), SPH_C32(0xd9777e19), + SPH_C32(0x9c7523b1), SPH_C32(0xc439ddb8) }, + { SPH_C32(0xd11e0070), SPH_C32(0x74e81425), SPH_C32(0x838aaeee), + SPH_C32(0xc46a6af8), SPH_C32(0x229400d0), SPH_C32(0xbdaa1890), + SPH_C32(0xa0a1254d), SPH_C32(0x75cd4d04) }, + { SPH_C32(0x50b10040), SPH_C32(0x189b28b3), SPH_C32(0xc3decfed), + SPH_C32(0x858f2b9d), SPH_C32(0xd17000e0), SPH_C32(0x7cbe8f9d), + SPH_C32(0xa5884f4b), SPH_C32(0xe635bda5) }, + { SPH_C32(0x01ed0050), SPH_C32(0x58685a48), SPH_C32(0x3f39e9ef), + SPH_C32(0xf4d87bfc), SPH_C32(0xff4900e0), SPH_C32(0x1863e914), + SPH_C32(0x995c49b7), SPH_C32(0x57c12d19) }, + { SPH_C32(0x7e880040), SPH_C32(0x7c464e3a), SPH_C32(0xff0ac911), + SPH_C32(0x347bbb21), SPH_C32(0xae1500f0), SPH_C32(0x58909bef), + SPH_C32(0x65bb6fb5), SPH_C32(0x26967d78) }, + { SPH_C32(0x2fd40050), SPH_C32(0x3cb53cc1), SPH_C32(0x03edef13), + SPH_C32(0x452ceb40), SPH_C32(0x802c00f0), SPH_C32(0x3c4dfd66), + SPH_C32(0x596f6949), SPH_C32(0x9762edc4) }, + { SPH_C32(0xf2090060), SPH_C32(0x997ccd45), SPH_C32(0x3a1083e9), + SPH_C32(0x67208b5d), SPH_C32(0x8d0200e0), SPH_C32(0xb504428f), + SPH_C32(0xdc2142b2), SPH_C32(0x85dc9cdd) }, + { SPH_C32(0xa3550070), SPH_C32(0xd98fbfbe), SPH_C32(0xc6f7a5eb), + SPH_C32(0x1677db3c), SPH_C32(0xa33b00e0), SPH_C32(0xd1d92406), + SPH_C32(0xe0f5444e), SPH_C32(0x34280c61) }, + { SPH_C32(0xdc300060), SPH_C32(0xfda1abcc), SPH_C32(0x06c48515), + SPH_C32(0xd6d41be1), SPH_C32(0xf26700f0), SPH_C32(0x912a56fd), + SPH_C32(0x1c12624c), SPH_C32(0x457f5c00) }, + { SPH_C32(0x8d6c0070), SPH_C32(0xbd52d937), SPH_C32(0xfa23a317), + SPH_C32(0xa7834b80), SPH_C32(0xdc5e00f0), SPH_C32(0xf5f73074), + SPH_C32(0x20c664b0), SPH_C32(0xf48bccbc) }, + { SPH_C32(0x62740080), SPH_C32(0x0fb84b07), SPH_C32(0x138a651e), + SPH_C32(0x44100618), SPH_C32(0x5bd20080), SPH_C32(0x450f18ec), + SPH_C32(0xc2c46c55), SPH_C32(0xf362b233) }, + { SPH_C32(0x33280090), SPH_C32(0x4f4b39fc), SPH_C32(0xef6d431c), + SPH_C32(0x35475679), SPH_C32(0x75eb0080), SPH_C32(0x21d27e65), + SPH_C32(0xfe106aa9), SPH_C32(0x4296228f) }, + { SPH_C32(0x4c4d0080), SPH_C32(0x6b652d8e), SPH_C32(0x2f5e63e2), + SPH_C32(0xf5e496a4), SPH_C32(0x24b70090), SPH_C32(0x61210c9e), + SPH_C32(0x02f74cab), SPH_C32(0x33c172ee) }, + { SPH_C32(0x1d110090), SPH_C32(0x2b965f75), SPH_C32(0xd3b945e0), + SPH_C32(0x84b3c6c5), SPH_C32(0x0a8e0090), SPH_C32(0x05fc6a17), + SPH_C32(0x3e234a57), SPH_C32(0x8235e252) }, + { SPH_C32(0xc0cc00a0), SPH_C32(0x8e5faef1), SPH_C32(0xea44291a), + SPH_C32(0xa6bfa6d8), SPH_C32(0x07a00080), SPH_C32(0x8cb5d5fe), + SPH_C32(0xbb6d61ac), SPH_C32(0x908b934b) }, + { SPH_C32(0x919000b0), SPH_C32(0xceacdc0a), SPH_C32(0x16a30f18), + SPH_C32(0xd7e8f6b9), SPH_C32(0x29990080), SPH_C32(0xe868b377), + SPH_C32(0x87b96750), SPH_C32(0x217f03f7) }, + { SPH_C32(0xeef500a0), SPH_C32(0xea82c878), SPH_C32(0xd6902fe6), + SPH_C32(0x174b3664), SPH_C32(0x78c50090), SPH_C32(0xa89bc18c), + SPH_C32(0x7b5e4152), SPH_C32(0x50285396) }, + { SPH_C32(0xbfa900b0), SPH_C32(0xaa71ba83), SPH_C32(0x2a7709e4), + SPH_C32(0x661c6605), SPH_C32(0x56fc0090), SPH_C32(0xcc46a705), + SPH_C32(0x478a47ae), SPH_C32(0xe1dcc32a) }, + { SPH_C32(0x3e060080), SPH_C32(0xc6028615), SPH_C32(0x6a2368e7), + SPH_C32(0x27f92760), SPH_C32(0xa51800a0), SPH_C32(0x0d523008), + SPH_C32(0x42a32da8), SPH_C32(0x7224338b) }, + { SPH_C32(0x6f5a0090), SPH_C32(0x86f1f4ee), SPH_C32(0x96c44ee5), + SPH_C32(0x56ae7701), SPH_C32(0x8b2100a0), SPH_C32(0x698f5681), + SPH_C32(0x7e772b54), SPH_C32(0xc3d0a337) }, + { SPH_C32(0x103f0080), SPH_C32(0xa2dfe09c), SPH_C32(0x56f76e1b), + SPH_C32(0x960db7dc), SPH_C32(0xda7d00b0), SPH_C32(0x297c247a), + SPH_C32(0x82900d56), SPH_C32(0xb287f356) }, + { SPH_C32(0x41630090), SPH_C32(0xe22c9267), SPH_C32(0xaa104819), + SPH_C32(0xe75ae7bd), SPH_C32(0xf44400b0), SPH_C32(0x4da142f3), + SPH_C32(0xbe440baa), SPH_C32(0x037363ea) }, + { SPH_C32(0x9cbe00a0), SPH_C32(0x47e563e3), SPH_C32(0x93ed24e3), + SPH_C32(0xc55687a0), SPH_C32(0xf96a00a0), SPH_C32(0xc4e8fd1a), + SPH_C32(0x3b0a2051), SPH_C32(0x11cd12f3) }, + { SPH_C32(0xcde200b0), SPH_C32(0x07161118), SPH_C32(0x6f0a02e1), + SPH_C32(0xb401d7c1), SPH_C32(0xd75300a0), SPH_C32(0xa0359b93), + SPH_C32(0x07de26ad), SPH_C32(0xa039824f) }, + { SPH_C32(0xb28700a0), SPH_C32(0x2338056a), SPH_C32(0xaf39221f), + SPH_C32(0x74a2171c), SPH_C32(0x860f00b0), SPH_C32(0xe0c6e968), + SPH_C32(0xfb3900af), SPH_C32(0xd16ed22e) }, + { SPH_C32(0xe3db00b0), SPH_C32(0x63cb7791), SPH_C32(0x53de041d), + SPH_C32(0x05f5477d), SPH_C32(0xa83600b0), SPH_C32(0x841b8fe1), + SPH_C32(0xc7ed0653), SPH_C32(0x609a4292) }, + { SPH_C32(0x2fba00c0), SPH_C32(0x34e3a779), SPH_C32(0x25ef0eb6), + SPH_C32(0x67733c1d), SPH_C32(0x23790080), SPH_C32(0xe5c242d8), + SPH_C32(0x9f98cca2), SPH_C32(0x811536f8) }, + { SPH_C32(0x7ee600d0), SPH_C32(0x7410d582), SPH_C32(0xd90828b4), + SPH_C32(0x16246c7c), SPH_C32(0x0d400080), SPH_C32(0x811f2451), + SPH_C32(0xa34cca5e), SPH_C32(0x30e1a644) }, + { SPH_C32(0x018300c0), SPH_C32(0x503ec1f0), SPH_C32(0x193b084a), + SPH_C32(0xd687aca1), SPH_C32(0x5c1c0090), SPH_C32(0xc1ec56aa), + SPH_C32(0x5fabec5c), SPH_C32(0x41b6f625) }, + { SPH_C32(0x50df00d0), SPH_C32(0x10cdb30b), SPH_C32(0xe5dc2e48), + SPH_C32(0xa7d0fcc0), SPH_C32(0x72250090), SPH_C32(0xa5313023), + SPH_C32(0x637feaa0), SPH_C32(0xf0426699) }, + { SPH_C32(0x8d0200e0), SPH_C32(0xb504428f), SPH_C32(0xdc2142b2), + SPH_C32(0x85dc9cdd), SPH_C32(0x7f0b0080), SPH_C32(0x2c788fca), + SPH_C32(0xe631c15b), SPH_C32(0xe2fc1780) }, + { SPH_C32(0xdc5e00f0), SPH_C32(0xf5f73074), SPH_C32(0x20c664b0), + SPH_C32(0xf48bccbc), SPH_C32(0x51320080), SPH_C32(0x48a5e943), + SPH_C32(0xdae5c7a7), SPH_C32(0x5308873c) }, + { SPH_C32(0xa33b00e0), SPH_C32(0xd1d92406), SPH_C32(0xe0f5444e), + SPH_C32(0x34280c61), SPH_C32(0x006e0090), SPH_C32(0x08569bb8), + SPH_C32(0x2602e1a5), SPH_C32(0x225fd75d) }, + { SPH_C32(0xf26700f0), SPH_C32(0x912a56fd), SPH_C32(0x1c12624c), + SPH_C32(0x457f5c00), SPH_C32(0x2e570090), SPH_C32(0x6c8bfd31), + SPH_C32(0x1ad6e759), SPH_C32(0x93ab47e1) }, + { SPH_C32(0x73c800c0), SPH_C32(0xfd596a6b), SPH_C32(0x5c46034f), + SPH_C32(0x049a1d65), SPH_C32(0xddb300a0), SPH_C32(0xad9f6a3c), + SPH_C32(0x1fff8d5f), SPH_C32(0x0053b740) }, + { SPH_C32(0x229400d0), SPH_C32(0xbdaa1890), SPH_C32(0xa0a1254d), + SPH_C32(0x75cd4d04), SPH_C32(0xf38a00a0), SPH_C32(0xc9420cb5), + SPH_C32(0x232b8ba3), SPH_C32(0xb1a727fc) }, + { SPH_C32(0x5df100c0), SPH_C32(0x99840ce2), SPH_C32(0x609205b3), + SPH_C32(0xb56e8dd9), SPH_C32(0xa2d600b0), SPH_C32(0x89b17e4e), + SPH_C32(0xdfccada1), SPH_C32(0xc0f0779d) }, + { SPH_C32(0x0cad00d0), SPH_C32(0xd9777e19), SPH_C32(0x9c7523b1), + SPH_C32(0xc439ddb8), SPH_C32(0x8cef00b0), SPH_C32(0xed6c18c7), + SPH_C32(0xe318ab5d), SPH_C32(0x7104e721) }, + { SPH_C32(0xd17000e0), SPH_C32(0x7cbe8f9d), SPH_C32(0xa5884f4b), + SPH_C32(0xe635bda5), SPH_C32(0x81c100a0), SPH_C32(0x6425a72e), + SPH_C32(0x665680a6), SPH_C32(0x63ba9638) }, + { SPH_C32(0x802c00f0), SPH_C32(0x3c4dfd66), SPH_C32(0x596f6949), + SPH_C32(0x9762edc4), SPH_C32(0xaff800a0), SPH_C32(0x00f8c1a7), + SPH_C32(0x5a82865a), SPH_C32(0xd24e0684) }, + { SPH_C32(0xff4900e0), SPH_C32(0x1863e914), SPH_C32(0x995c49b7), + SPH_C32(0x57c12d19), SPH_C32(0xfea400b0), SPH_C32(0x400bb35c), + SPH_C32(0xa665a058), SPH_C32(0xa31956e5) }, + { SPH_C32(0xae1500f0), SPH_C32(0x58909bef), SPH_C32(0x65bb6fb5), + SPH_C32(0x26967d78), SPH_C32(0xd09d00b0), SPH_C32(0x24d6d5d5), + SPH_C32(0x9ab1a6a4), SPH_C32(0x12edc659) }, + { SPH_C32(0x1adf0080), SPH_C32(0xaf751133), SPH_C32(0x4ed6c5e9), + SPH_C32(0x366782d3), SPH_C32(0x6eb700c0), SPH_C32(0xde99aea6), + SPH_C32(0xa9fda70a), SPH_C32(0xa2760cfd) }, + { SPH_C32(0x4b830090), SPH_C32(0xef8663c8), SPH_C32(0xb231e3eb), + SPH_C32(0x4730d2b2), SPH_C32(0x408e00c0), SPH_C32(0xba44c82f), + SPH_C32(0x9529a1f6), SPH_C32(0x13829c41) }, + { SPH_C32(0x34e60080), SPH_C32(0xcba877ba), SPH_C32(0x7202c315), + SPH_C32(0x8793126f), SPH_C32(0x11d200d0), SPH_C32(0xfab7bad4), + SPH_C32(0x69ce87f4), SPH_C32(0x62d5cc20) }, + { SPH_C32(0x65ba0090), SPH_C32(0x8b5b0541), SPH_C32(0x8ee5e517), + SPH_C32(0xf6c4420e), SPH_C32(0x3feb00d0), SPH_C32(0x9e6adc5d), + SPH_C32(0x551a8108), SPH_C32(0xd3215c9c) }, + { SPH_C32(0xb86700a0), SPH_C32(0x2e92f4c5), SPH_C32(0xb71889ed), + SPH_C32(0xd4c82213), SPH_C32(0x32c500c0), SPH_C32(0x172363b4), + SPH_C32(0xd054aaf3), SPH_C32(0xc19f2d85) }, + { SPH_C32(0xe93b00b0), SPH_C32(0x6e61863e), SPH_C32(0x4bffafef), + SPH_C32(0xa59f7272), SPH_C32(0x1cfc00c0), SPH_C32(0x73fe053d), + SPH_C32(0xec80ac0f), SPH_C32(0x706bbd39) }, + { SPH_C32(0x965e00a0), SPH_C32(0x4a4f924c), SPH_C32(0x8bcc8f11), + SPH_C32(0x653cb2af), SPH_C32(0x4da000d0), SPH_C32(0x330d77c6), + SPH_C32(0x10678a0d), SPH_C32(0x013ced58) }, + { SPH_C32(0xc70200b0), SPH_C32(0x0abce0b7), SPH_C32(0x772ba913), + SPH_C32(0x146be2ce), SPH_C32(0x639900d0), SPH_C32(0x57d0114f), + SPH_C32(0x2cb38cf1), SPH_C32(0xb0c87de4) }, + { SPH_C32(0x46ad0080), SPH_C32(0x66cfdc21), SPH_C32(0x377fc810), + SPH_C32(0x558ea3ab), SPH_C32(0x907d00e0), SPH_C32(0x96c48642), + SPH_C32(0x299ae6f7), SPH_C32(0x23308d45) }, + { SPH_C32(0x17f10090), SPH_C32(0x263caeda), SPH_C32(0xcb98ee12), + SPH_C32(0x24d9f3ca), SPH_C32(0xbe4400e0), SPH_C32(0xf219e0cb), + SPH_C32(0x154ee00b), SPH_C32(0x92c41df9) }, + { SPH_C32(0x68940080), SPH_C32(0x0212baa8), SPH_C32(0x0babceec), + SPH_C32(0xe47a3317), SPH_C32(0xef1800f0), SPH_C32(0xb2ea9230), + SPH_C32(0xe9a9c609), SPH_C32(0xe3934d98) }, + { SPH_C32(0x39c80090), SPH_C32(0x42e1c853), SPH_C32(0xf74ce8ee), + SPH_C32(0x952d6376), SPH_C32(0xc12100f0), SPH_C32(0xd637f4b9), + SPH_C32(0xd57dc0f5), SPH_C32(0x5267dd24) }, + { SPH_C32(0xe41500a0), SPH_C32(0xe72839d7), SPH_C32(0xceb18414), + SPH_C32(0xb721036b), SPH_C32(0xcc0f00e0), SPH_C32(0x5f7e4b50), + SPH_C32(0x5033eb0e), SPH_C32(0x40d9ac3d) }, + { SPH_C32(0xb54900b0), SPH_C32(0xa7db4b2c), SPH_C32(0x3256a216), + SPH_C32(0xc676530a), SPH_C32(0xe23600e0), SPH_C32(0x3ba32dd9), + SPH_C32(0x6ce7edf2), SPH_C32(0xf12d3c81) }, + { SPH_C32(0xca2c00a0), SPH_C32(0x83f55f5e), SPH_C32(0xf26582e8), + SPH_C32(0x06d593d7), SPH_C32(0xb36a00f0), SPH_C32(0x7b505f22), + SPH_C32(0x9000cbf0), SPH_C32(0x807a6ce0) }, + { SPH_C32(0x9b7000b0), SPH_C32(0xc3062da5), SPH_C32(0x0e82a4ea), + SPH_C32(0x7782c3b6), SPH_C32(0x9d5300f0), SPH_C32(0x1f8d39ab), + SPH_C32(0xacd4cd0c), SPH_C32(0x318efc5c) }, + { SPH_C32(0x571100c0), SPH_C32(0x942efd4d), SPH_C32(0x78b3ae41), + SPH_C32(0x1504b8d6), SPH_C32(0x161c00c0), SPH_C32(0x7e54f492), + SPH_C32(0xf4a107fd), SPH_C32(0xd0018836) }, + { SPH_C32(0x064d00d0), SPH_C32(0xd4dd8fb6), SPH_C32(0x84548843), + SPH_C32(0x6453e8b7), SPH_C32(0x382500c0), SPH_C32(0x1a89921b), + SPH_C32(0xc8750101), SPH_C32(0x61f5188a) }, + { SPH_C32(0x792800c0), SPH_C32(0xf0f39bc4), SPH_C32(0x4467a8bd), + SPH_C32(0xa4f0286a), SPH_C32(0x697900d0), SPH_C32(0x5a7ae0e0), + SPH_C32(0x34922703), SPH_C32(0x10a248eb) }, + { SPH_C32(0x287400d0), SPH_C32(0xb000e93f), SPH_C32(0xb8808ebf), + SPH_C32(0xd5a7780b), SPH_C32(0x474000d0), SPH_C32(0x3ea78669), + SPH_C32(0x084621ff), SPH_C32(0xa156d857) }, + { SPH_C32(0xf5a900e0), SPH_C32(0x15c918bb), SPH_C32(0x817de245), + SPH_C32(0xf7ab1816), SPH_C32(0x4a6e00c0), SPH_C32(0xb7ee3980), + SPH_C32(0x8d080a04), SPH_C32(0xb3e8a94e) }, + { SPH_C32(0xa4f500f0), SPH_C32(0x553a6a40), SPH_C32(0x7d9ac447), + SPH_C32(0x86fc4877), SPH_C32(0x645700c0), SPH_C32(0xd3335f09), + SPH_C32(0xb1dc0cf8), SPH_C32(0x021c39f2) }, + { SPH_C32(0xdb9000e0), SPH_C32(0x71147e32), SPH_C32(0xbda9e4b9), + SPH_C32(0x465f88aa), SPH_C32(0x350b00d0), SPH_C32(0x93c02df2), + SPH_C32(0x4d3b2afa), SPH_C32(0x734b6993) }, + { SPH_C32(0x8acc00f0), SPH_C32(0x31e70cc9), SPH_C32(0x414ec2bb), + SPH_C32(0x3708d8cb), SPH_C32(0x1b3200d0), SPH_C32(0xf71d4b7b), + SPH_C32(0x71ef2c06), SPH_C32(0xc2bff92f) }, + { SPH_C32(0x0b6300c0), SPH_C32(0x5d94305f), SPH_C32(0x011aa3b8), + SPH_C32(0x76ed99ae), SPH_C32(0xe8d600e0), SPH_C32(0x3609dc76), + SPH_C32(0x74c64600), SPH_C32(0x5147098e) }, + { SPH_C32(0x5a3f00d0), SPH_C32(0x1d6742a4), SPH_C32(0xfdfd85ba), + SPH_C32(0x07bac9cf), SPH_C32(0xc6ef00e0), SPH_C32(0x52d4baff), + SPH_C32(0x481240fc), SPH_C32(0xe0b39932) }, + { SPH_C32(0x255a00c0), SPH_C32(0x394956d6), SPH_C32(0x3dcea544), + SPH_C32(0xc7190912), SPH_C32(0x97b300f0), SPH_C32(0x1227c804), + SPH_C32(0xb4f566fe), SPH_C32(0x91e4c953) }, + { SPH_C32(0x740600d0), SPH_C32(0x79ba242d), SPH_C32(0xc1298346), + SPH_C32(0xb64e5973), SPH_C32(0xb98a00f0), SPH_C32(0x76faae8d), + SPH_C32(0x88216002), SPH_C32(0x201059ef) }, + { SPH_C32(0xa9db00e0), SPH_C32(0xdc73d5a9), SPH_C32(0xf8d4efbc), + SPH_C32(0x9442396e), SPH_C32(0xb4a400e0), SPH_C32(0xffb31164), + SPH_C32(0x0d6f4bf9), SPH_C32(0x32ae28f6) }, + { SPH_C32(0xf88700f0), SPH_C32(0x9c80a752), SPH_C32(0x0433c9be), + SPH_C32(0xe515690f), SPH_C32(0x9a9d00e0), SPH_C32(0x9b6e77ed), + SPH_C32(0x31bb4d05), SPH_C32(0x835ab84a) }, + { SPH_C32(0x87e200e0), SPH_C32(0xb8aeb320), SPH_C32(0xc400e940), + SPH_C32(0x25b6a9d2), SPH_C32(0xcbc100f0), SPH_C32(0xdb9d0516), + SPH_C32(0xcd5c6b07), SPH_C32(0xf20de82b) }, + { SPH_C32(0xd6be00f0), SPH_C32(0xf85dc1db), SPH_C32(0x38e7cf42), + SPH_C32(0x54e1f9b3), SPH_C32(0xe5f800f0), SPH_C32(0xbf40639f), + SPH_C32(0xf1886dfb), SPH_C32(0x43f97897) } +}; + +static const sph_u32 T256_24[256][8] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000) }, + { SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), SPH_C32(0xae0ebb05), + SPH_C32(0xb5a4c63b), SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), + SPH_C32(0x6bf648a4), SPH_C32(0x539cbdbf) }, + { SPH_C32(0xc8f10000), SPH_C32(0x0b2de782), SPH_C32(0x6bf648a4), + SPH_C32(0x539cbdbf), SPH_C32(0x08bf0001), SPH_C32(0x38942792), + SPH_C32(0xc5f8f3a1), SPH_C32(0xe6387b84) }, + { SPH_C32(0x08bf0001), SPH_C32(0x38942792), SPH_C32(0xc5f8f3a1), + SPH_C32(0xe6387b84), SPH_C32(0xc04e0001), SPH_C32(0x33b9c010), + SPH_C32(0xae0ebb05), SPH_C32(0xb5a4c63b) }, + { SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), SPH_C32(0x99e585aa), + SPH_C32(0x8d75f7f1), SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), + SPH_C32(0x79e22a4c), SPH_C32(0x1298bd46) }, + { SPH_C32(0x486d0003), SPH_C32(0x6c5e67a3), SPH_C32(0x37eb3eaf), + SPH_C32(0x38d131ca), SPH_C32(0x995d0000), SPH_C32(0x2ecee896), + SPH_C32(0x121462e8), SPH_C32(0x410400f9) }, + { SPH_C32(0x40d20002), SPH_C32(0x54ca4031), SPH_C32(0xf213cd0e), + SPH_C32(0xdee94a4e), SPH_C32(0x59130001), SPH_C32(0x1d772886), + SPH_C32(0xbc1ad9ed), SPH_C32(0xf4a0c6c2) }, + { SPH_C32(0x809c0003), SPH_C32(0x67738021), SPH_C32(0x5c1d760b), + SPH_C32(0x6b4d8c75), SPH_C32(0x91e20001), SPH_C32(0x165acf04), + SPH_C32(0xd7ec9149), SPH_C32(0xa73c7b7d) }, + { SPH_C32(0x51ac0000), SPH_C32(0x25e30f14), SPH_C32(0x79e22a4c), + SPH_C32(0x1298bd46), SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), + SPH_C32(0xe007afe6), SPH_C32(0x9fed4ab7) }, + { SPH_C32(0x91e20001), SPH_C32(0x165acf04), SPH_C32(0xd7ec9149), + SPH_C32(0xa73c7b7d), SPH_C32(0x117e0002), SPH_C32(0x71294f25), + SPH_C32(0x8bf1e742), SPH_C32(0xcc71f708) }, + { SPH_C32(0x995d0000), SPH_C32(0x2ecee896), SPH_C32(0x121462e8), + SPH_C32(0x410400f9), SPH_C32(0xd1300003), SPH_C32(0x42908f35), + SPH_C32(0x25ff5c47), SPH_C32(0x79d53133) }, + { SPH_C32(0x59130001), SPH_C32(0x1d772886), SPH_C32(0xbc1ad9ed), + SPH_C32(0xf4a0c6c2), SPH_C32(0x19c10003), SPH_C32(0x49bd68b7), + SPH_C32(0x4e0914e3), SPH_C32(0x2a498c8c) }, + { SPH_C32(0xd98f0002), SPH_C32(0x7a04a8a7), SPH_C32(0xe007afe6), + SPH_C32(0x9fed4ab7), SPH_C32(0x88230002), SPH_C32(0x5fe7a7b3), + SPH_C32(0x99e585aa), SPH_C32(0x8d75f7f1) }, + { SPH_C32(0x19c10003), SPH_C32(0x49bd68b7), SPH_C32(0x4e0914e3), + SPH_C32(0x2a498c8c), SPH_C32(0x40d20002), SPH_C32(0x54ca4031), + SPH_C32(0xf213cd0e), SPH_C32(0xdee94a4e) }, + { SPH_C32(0x117e0002), SPH_C32(0x71294f25), SPH_C32(0x8bf1e742), + SPH_C32(0xcc71f708), SPH_C32(0x809c0003), SPH_C32(0x67738021), + SPH_C32(0x5c1d760b), SPH_C32(0x6b4d8c75) }, + { SPH_C32(0xd1300003), SPH_C32(0x42908f35), SPH_C32(0x25ff5c47), + SPH_C32(0x79d53133), SPH_C32(0x486d0003), SPH_C32(0x6c5e67a3), + SPH_C32(0x37eb3eaf), SPH_C32(0x38d131ca) }, + { SPH_C32(0xd0080004), SPH_C32(0x8c768f77), SPH_C32(0x9dc5b050), + SPH_C32(0xaf4a29da), SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), + SPH_C32(0x98321c3d), SPH_C32(0x76acc733) }, + { SPH_C32(0x10460005), SPH_C32(0xbfcf4f67), SPH_C32(0x33cb0b55), + SPH_C32(0x1aeeefe1), SPH_C32(0xa3580000), SPH_C32(0x4bc61e28), + SPH_C32(0xf3c45499), SPH_C32(0x25307a8c) }, + { SPH_C32(0x18f90004), SPH_C32(0x875b68f5), SPH_C32(0xf633f8f4), + SPH_C32(0xfcd69465), SPH_C32(0x63160001), SPH_C32(0x787fde38), + SPH_C32(0x5dcaef9c), SPH_C32(0x9094bcb7) }, + { SPH_C32(0xd8b70005), SPH_C32(0xb4e2a8e5), SPH_C32(0x583d43f1), + SPH_C32(0x4972525e), SPH_C32(0xabe70001), SPH_C32(0x735239ba), + SPH_C32(0x363ca738), SPH_C32(0xc3080108) }, + { SPH_C32(0x582b0006), SPH_C32(0xd39128c4), SPH_C32(0x042035fa), + SPH_C32(0x223fde2b), SPH_C32(0x3a050000), SPH_C32(0x6508f6be), + SPH_C32(0xe1d03671), SPH_C32(0x64347a75) }, + { SPH_C32(0x98650007), SPH_C32(0xe028e8d4), SPH_C32(0xaa2e8eff), + SPH_C32(0x979b1810), SPH_C32(0xf2f40000), SPH_C32(0x6e25113c), + SPH_C32(0x8a267ed5), SPH_C32(0x37a8c7ca) }, + { SPH_C32(0x90da0006), SPH_C32(0xd8bccf46), SPH_C32(0x6fd67d5e), + SPH_C32(0x71a36394), SPH_C32(0x32ba0001), SPH_C32(0x5d9cd12c), + SPH_C32(0x2428c5d0), SPH_C32(0x820c01f1) }, + { SPH_C32(0x50940007), SPH_C32(0xeb050f56), SPH_C32(0xc1d8c65b), + SPH_C32(0xc407a5af), SPH_C32(0xfa4b0001), SPH_C32(0x56b136ae), + SPH_C32(0x4fde8d74), SPH_C32(0xd190bc4e) }, + { SPH_C32(0x81a40004), SPH_C32(0xa9958063), SPH_C32(0xe4279a1c), + SPH_C32(0xbdd2949c), SPH_C32(0xb2260002), SPH_C32(0x3aef510d), + SPH_C32(0x7835b3db), SPH_C32(0xe9418d84) }, + { SPH_C32(0x41ea0005), SPH_C32(0x9a2c4073), SPH_C32(0x4a292119), + SPH_C32(0x087652a7), SPH_C32(0x7ad70002), SPH_C32(0x31c2b68f), + SPH_C32(0x13c3fb7f), SPH_C32(0xbadd303b) }, + { SPH_C32(0x49550004), SPH_C32(0xa2b867e1), SPH_C32(0x8fd1d2b8), + SPH_C32(0xee4e2923), SPH_C32(0xba990003), SPH_C32(0x027b769f), + SPH_C32(0xbdcd407a), SPH_C32(0x0f79f600) }, + { SPH_C32(0x891b0005), SPH_C32(0x9101a7f1), SPH_C32(0x21df69bd), + SPH_C32(0x5beaef18), SPH_C32(0x72680003), SPH_C32(0x0956911d), + SPH_C32(0xd63b08de), SPH_C32(0x5ce54bbf) }, + { SPH_C32(0x09870006), SPH_C32(0xf67227d0), SPH_C32(0x7dc21fb6), + SPH_C32(0x30a7636d), SPH_C32(0xe38a0002), SPH_C32(0x1f0c5e19), + SPH_C32(0x01d79997), SPH_C32(0xfbd930c2) }, + { SPH_C32(0xc9c90007), SPH_C32(0xc5cbe7c0), SPH_C32(0xd3cca4b3), + SPH_C32(0x8503a556), SPH_C32(0x2b7b0002), SPH_C32(0x1421b99b), + SPH_C32(0x6a21d133), SPH_C32(0xa8458d7d) }, + { SPH_C32(0xc1760006), SPH_C32(0xfd5fc052), SPH_C32(0x16345712), + SPH_C32(0x633bded2), SPH_C32(0xeb350003), SPH_C32(0x2798798b), + SPH_C32(0xc42f6a36), SPH_C32(0x1de14b46) }, + { SPH_C32(0x01380007), SPH_C32(0xcee60042), SPH_C32(0xb83aec17), + SPH_C32(0xd69f18e9), SPH_C32(0x23c40003), SPH_C32(0x2cb59e09), + SPH_C32(0xafd92292), SPH_C32(0x4e7df6f9) }, + { SPH_C32(0x6ba90000), SPH_C32(0x40ebf9aa), SPH_C32(0x98321c3d), + SPH_C32(0x76acc733), SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), + SPH_C32(0x05f7ac6d), SPH_C32(0xd9e6eee9) }, + { SPH_C32(0xabe70001), SPH_C32(0x735239ba), SPH_C32(0x363ca738), + SPH_C32(0xc3080108), SPH_C32(0x73500004), SPH_C32(0xc7b0915f), + SPH_C32(0x6e01e4c9), SPH_C32(0x8a7a5356) }, + { SPH_C32(0xa3580000), SPH_C32(0x4bc61e28), SPH_C32(0xf3c45499), + SPH_C32(0x25307a8c), SPH_C32(0xb31e0005), SPH_C32(0xf409514f), + SPH_C32(0xc00f5fcc), SPH_C32(0x3fde956d) }, + { SPH_C32(0x63160001), SPH_C32(0x787fde38), SPH_C32(0x5dcaef9c), + SPH_C32(0x9094bcb7), SPH_C32(0x7bef0005), SPH_C32(0xff24b6cd), + SPH_C32(0xabf91768), SPH_C32(0x6c4228d2) }, + { SPH_C32(0xe38a0002), SPH_C32(0x1f0c5e19), SPH_C32(0x01d79997), + SPH_C32(0xfbd930c2), SPH_C32(0xea0d0004), SPH_C32(0xe97e79c9), + SPH_C32(0x7c158621), SPH_C32(0xcb7e53af) }, + { SPH_C32(0x23c40003), SPH_C32(0x2cb59e09), SPH_C32(0xafd92292), + SPH_C32(0x4e7df6f9), SPH_C32(0x22fc0004), SPH_C32(0xe2539e4b), + SPH_C32(0x17e3ce85), SPH_C32(0x98e2ee10) }, + { SPH_C32(0x2b7b0002), SPH_C32(0x1421b99b), SPH_C32(0x6a21d133), + SPH_C32(0xa8458d7d), SPH_C32(0xe2b20005), SPH_C32(0xd1ea5e5b), + SPH_C32(0xb9ed7580), SPH_C32(0x2d46282b) }, + { SPH_C32(0xeb350003), SPH_C32(0x2798798b), SPH_C32(0xc42f6a36), + SPH_C32(0x1de14b46), SPH_C32(0x2a430005), SPH_C32(0xdac7b9d9), + SPH_C32(0xd21b3d24), SPH_C32(0x7eda9594) }, + { SPH_C32(0x3a050000), SPH_C32(0x6508f6be), SPH_C32(0xe1d03671), + SPH_C32(0x64347a75), SPH_C32(0x622e0006), SPH_C32(0xb699de7a), + SPH_C32(0xe5f0038b), SPH_C32(0x460ba45e) }, + { SPH_C32(0xfa4b0001), SPH_C32(0x56b136ae), SPH_C32(0x4fde8d74), + SPH_C32(0xd190bc4e), SPH_C32(0xaadf0006), SPH_C32(0xbdb439f8), + SPH_C32(0x8e064b2f), SPH_C32(0x159719e1) }, + { SPH_C32(0xf2f40000), SPH_C32(0x6e25113c), SPH_C32(0x8a267ed5), + SPH_C32(0x37a8c7ca), SPH_C32(0x6a910007), SPH_C32(0x8e0df9e8), + SPH_C32(0x2008f02a), SPH_C32(0xa033dfda) }, + { SPH_C32(0x32ba0001), SPH_C32(0x5d9cd12c), SPH_C32(0x2428c5d0), + SPH_C32(0x820c01f1), SPH_C32(0xa2600007), SPH_C32(0x85201e6a), + SPH_C32(0x4bfeb88e), SPH_C32(0xf3af6265) }, + { SPH_C32(0xb2260002), SPH_C32(0x3aef510d), SPH_C32(0x7835b3db), + SPH_C32(0xe9418d84), SPH_C32(0x33820006), SPH_C32(0x937ad16e), + SPH_C32(0x9c1229c7), SPH_C32(0x54931918) }, + { SPH_C32(0x72680003), SPH_C32(0x0956911d), SPH_C32(0xd63b08de), + SPH_C32(0x5ce54bbf), SPH_C32(0xfb730006), SPH_C32(0x985736ec), + SPH_C32(0xf7e46163), SPH_C32(0x070fa4a7) }, + { SPH_C32(0x7ad70002), SPH_C32(0x31c2b68f), SPH_C32(0x13c3fb7f), + SPH_C32(0xbadd303b), SPH_C32(0x3b3d0007), SPH_C32(0xabeef6fc), + SPH_C32(0x59eada66), SPH_C32(0xb2ab629c) }, + { SPH_C32(0xba990003), SPH_C32(0x027b769f), SPH_C32(0xbdcd407a), + SPH_C32(0x0f79f600), SPH_C32(0xf3cc0007), SPH_C32(0xa0c3117e), + SPH_C32(0x321c92c2), SPH_C32(0xe137df23) }, + { SPH_C32(0xbba10004), SPH_C32(0xcc9d76dd), SPH_C32(0x05f7ac6d), + SPH_C32(0xd9e6eee9), SPH_C32(0xd0080004), SPH_C32(0x8c768f77), + SPH_C32(0x9dc5b050), SPH_C32(0xaf4a29da) }, + { SPH_C32(0x7bef0005), SPH_C32(0xff24b6cd), SPH_C32(0xabf91768), + SPH_C32(0x6c4228d2), SPH_C32(0x18f90004), SPH_C32(0x875b68f5), + SPH_C32(0xf633f8f4), SPH_C32(0xfcd69465) }, + { SPH_C32(0x73500004), SPH_C32(0xc7b0915f), SPH_C32(0x6e01e4c9), + SPH_C32(0x8a7a5356), SPH_C32(0xd8b70005), SPH_C32(0xb4e2a8e5), + SPH_C32(0x583d43f1), SPH_C32(0x4972525e) }, + { SPH_C32(0xb31e0005), SPH_C32(0xf409514f), SPH_C32(0xc00f5fcc), + SPH_C32(0x3fde956d), SPH_C32(0x10460005), SPH_C32(0xbfcf4f67), + SPH_C32(0x33cb0b55), SPH_C32(0x1aeeefe1) }, + { SPH_C32(0x33820006), SPH_C32(0x937ad16e), SPH_C32(0x9c1229c7), + SPH_C32(0x54931918), SPH_C32(0x81a40004), SPH_C32(0xa9958063), + SPH_C32(0xe4279a1c), SPH_C32(0xbdd2949c) }, + { SPH_C32(0xf3cc0007), SPH_C32(0xa0c3117e), SPH_C32(0x321c92c2), + SPH_C32(0xe137df23), SPH_C32(0x49550004), SPH_C32(0xa2b867e1), + SPH_C32(0x8fd1d2b8), SPH_C32(0xee4e2923) }, + { SPH_C32(0xfb730006), SPH_C32(0x985736ec), SPH_C32(0xf7e46163), + SPH_C32(0x070fa4a7), SPH_C32(0x891b0005), SPH_C32(0x9101a7f1), + SPH_C32(0x21df69bd), SPH_C32(0x5beaef18) }, + { SPH_C32(0x3b3d0007), SPH_C32(0xabeef6fc), SPH_C32(0x59eada66), + SPH_C32(0xb2ab629c), SPH_C32(0x41ea0005), SPH_C32(0x9a2c4073), + SPH_C32(0x4a292119), SPH_C32(0x087652a7) }, + { SPH_C32(0xea0d0004), SPH_C32(0xe97e79c9), SPH_C32(0x7c158621), + SPH_C32(0xcb7e53af), SPH_C32(0x09870006), SPH_C32(0xf67227d0), + SPH_C32(0x7dc21fb6), SPH_C32(0x30a7636d) }, + { SPH_C32(0x2a430005), SPH_C32(0xdac7b9d9), SPH_C32(0xd21b3d24), + SPH_C32(0x7eda9594), SPH_C32(0xc1760006), SPH_C32(0xfd5fc052), + SPH_C32(0x16345712), SPH_C32(0x633bded2) }, + { SPH_C32(0x22fc0004), SPH_C32(0xe2539e4b), SPH_C32(0x17e3ce85), + SPH_C32(0x98e2ee10), SPH_C32(0x01380007), SPH_C32(0xcee60042), + SPH_C32(0xb83aec17), SPH_C32(0xd69f18e9) }, + { SPH_C32(0xe2b20005), SPH_C32(0xd1ea5e5b), SPH_C32(0xb9ed7580), + SPH_C32(0x2d46282b), SPH_C32(0xc9c90007), SPH_C32(0xc5cbe7c0), + SPH_C32(0xd3cca4b3), SPH_C32(0x8503a556) }, + { SPH_C32(0x622e0006), SPH_C32(0xb699de7a), SPH_C32(0xe5f0038b), + SPH_C32(0x460ba45e), SPH_C32(0x582b0006), SPH_C32(0xd39128c4), + SPH_C32(0x042035fa), SPH_C32(0x223fde2b) }, + { SPH_C32(0xa2600007), SPH_C32(0x85201e6a), SPH_C32(0x4bfeb88e), + SPH_C32(0xf3af6265), SPH_C32(0x90da0006), SPH_C32(0xd8bccf46), + SPH_C32(0x6fd67d5e), SPH_C32(0x71a36394) }, + { SPH_C32(0xaadf0006), SPH_C32(0xbdb439f8), SPH_C32(0x8e064b2f), + SPH_C32(0x159719e1), SPH_C32(0x50940007), SPH_C32(0xeb050f56), + SPH_C32(0xc1d8c65b), SPH_C32(0xc407a5af) }, + { SPH_C32(0x6a910007), SPH_C32(0x8e0df9e8), SPH_C32(0x2008f02a), + SPH_C32(0xa033dfda), SPH_C32(0x98650007), SPH_C32(0xe028e8d4), + SPH_C32(0xaa2e8eff), SPH_C32(0x979b1810) }, + { SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), SPH_C32(0xfe739301), + SPH_C32(0xb8a92831), SPH_C32(0x171c0000), SPH_C32(0xb26e3344), + SPH_C32(0x9e6a837e), SPH_C32(0x58f8485f) }, + { SPH_C32(0x68e00009), SPH_C32(0x13c0f96d), SPH_C32(0x507d2804), + SPH_C32(0x0d0dee0a), SPH_C32(0xdfed0000), SPH_C32(0xb943d4c6), + SPH_C32(0xf59ccbda), SPH_C32(0x0b64f5e0) }, + { SPH_C32(0x605f0008), SPH_C32(0x2b54deff), SPH_C32(0x9585dba5), + SPH_C32(0xeb35958e), SPH_C32(0x1fa30001), SPH_C32(0x8afa14d6), + SPH_C32(0x5b9270df), SPH_C32(0xbec033db) }, + { SPH_C32(0xa0110009), SPH_C32(0x18ed1eef), SPH_C32(0x3b8b60a0), + SPH_C32(0x5e9153b5), SPH_C32(0xd7520001), SPH_C32(0x81d7f354), + SPH_C32(0x3064387b), SPH_C32(0xed5c8e64) }, + { SPH_C32(0x208d000a), SPH_C32(0x7f9e9ece), SPH_C32(0x679616ab), + SPH_C32(0x35dcdfc0), SPH_C32(0x46b00000), SPH_C32(0x978d3c50), + SPH_C32(0xe788a932), SPH_C32(0x4a60f519) }, + { SPH_C32(0xe0c3000b), SPH_C32(0x4c275ede), SPH_C32(0xc998adae), + SPH_C32(0x807819fb), SPH_C32(0x8e410000), SPH_C32(0x9ca0dbd2), + SPH_C32(0x8c7ee196), SPH_C32(0x19fc48a6) }, + { SPH_C32(0xe87c000a), SPH_C32(0x74b3794c), SPH_C32(0x0c605e0f), + SPH_C32(0x6640627f), SPH_C32(0x4e0f0001), SPH_C32(0xaf191bc2), + SPH_C32(0x22705a93), SPH_C32(0xac588e9d) }, + { SPH_C32(0x2832000b), SPH_C32(0x470ab95c), SPH_C32(0xa26ee50a), + SPH_C32(0xd3e4a444), SPH_C32(0x86fe0001), SPH_C32(0xa434fc40), + SPH_C32(0x49861237), SPH_C32(0xffc43322) }, + { SPH_C32(0xf9020008), SPH_C32(0x059a3669), SPH_C32(0x8791b94d), + SPH_C32(0xaa319577), SPH_C32(0xce930002), SPH_C32(0xc86a9be3), + SPH_C32(0x7e6d2c98), SPH_C32(0xc71502e8) }, + { SPH_C32(0x394c0009), SPH_C32(0x3623f679), SPH_C32(0x299f0248), + SPH_C32(0x1f95534c), SPH_C32(0x06620002), SPH_C32(0xc3477c61), + SPH_C32(0x159b643c), SPH_C32(0x9489bf57) }, + { SPH_C32(0x31f30008), SPH_C32(0x0eb7d1eb), SPH_C32(0xec67f1e9), + SPH_C32(0xf9ad28c8), SPH_C32(0xc62c0003), SPH_C32(0xf0febc71), + SPH_C32(0xbb95df39), SPH_C32(0x212d796c) }, + { SPH_C32(0xf1bd0009), SPH_C32(0x3d0e11fb), SPH_C32(0x42694aec), + SPH_C32(0x4c09eef3), SPH_C32(0x0edd0003), SPH_C32(0xfbd35bf3), + SPH_C32(0xd063979d), SPH_C32(0x72b1c4d3) }, + { SPH_C32(0x7121000a), SPH_C32(0x5a7d91da), SPH_C32(0x1e743ce7), + SPH_C32(0x27446286), SPH_C32(0x9f3f0002), SPH_C32(0xed8994f7), + SPH_C32(0x078f06d4), SPH_C32(0xd58dbfae) }, + { SPH_C32(0xb16f000b), SPH_C32(0x69c451ca), SPH_C32(0xb07a87e2), + SPH_C32(0x92e0a4bd), SPH_C32(0x57ce0002), SPH_C32(0xe6a47375), + SPH_C32(0x6c794e70), SPH_C32(0x86110211) }, + { SPH_C32(0xb9d0000a), SPH_C32(0x51507658), SPH_C32(0x75827443), + SPH_C32(0x74d8df39), SPH_C32(0x97800003), SPH_C32(0xd51db365), + SPH_C32(0xc277f575), SPH_C32(0x33b5c42a) }, + { SPH_C32(0x799e000b), SPH_C32(0x62e9b648), SPH_C32(0xdb8ccf46), + SPH_C32(0xc17c1902), SPH_C32(0x5f710003), SPH_C32(0xde3054e7), + SPH_C32(0xa981bdd1), SPH_C32(0x60297995) }, + { SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), SPH_C32(0x63b62351), + SPH_C32(0x17e301eb), SPH_C32(0x7cb50000), SPH_C32(0xf285caee), + SPH_C32(0x06589f43), SPH_C32(0x2e548f6c) }, + { SPH_C32(0xb8e8000d), SPH_C32(0x9fb6761a), SPH_C32(0xcdb89854), + SPH_C32(0xa247c7d0), SPH_C32(0xb4440000), SPH_C32(0xf9a82d6c), + SPH_C32(0x6daed7e7), SPH_C32(0x7dc832d3) }, + { SPH_C32(0xb057000c), SPH_C32(0xa7225188), SPH_C32(0x08406bf5), + SPH_C32(0x447fbc54), SPH_C32(0x740a0001), SPH_C32(0xca11ed7c), + SPH_C32(0xc3a06ce2), SPH_C32(0xc86cf4e8) }, + { SPH_C32(0x7019000d), SPH_C32(0x949b9198), SPH_C32(0xa64ed0f0), + SPH_C32(0xf1db7a6f), SPH_C32(0xbcfb0001), SPH_C32(0xc13c0afe), + SPH_C32(0xa8562446), SPH_C32(0x9bf04957) }, + { SPH_C32(0xf085000e), SPH_C32(0xf3e811b9), SPH_C32(0xfa53a6fb), + SPH_C32(0x9a96f61a), SPH_C32(0x2d190000), SPH_C32(0xd766c5fa), + SPH_C32(0x7fbab50f), SPH_C32(0x3ccc322a) }, + { SPH_C32(0x30cb000f), SPH_C32(0xc051d1a9), SPH_C32(0x545d1dfe), + SPH_C32(0x2f323021), SPH_C32(0xe5e80000), SPH_C32(0xdc4b2278), + SPH_C32(0x144cfdab), SPH_C32(0x6f508f95) }, + { SPH_C32(0x3874000e), SPH_C32(0xf8c5f63b), SPH_C32(0x91a5ee5f), + SPH_C32(0xc90a4ba5), SPH_C32(0x25a60001), SPH_C32(0xeff2e268), + SPH_C32(0xba4246ae), SPH_C32(0xdaf449ae) }, + { SPH_C32(0xf83a000f), SPH_C32(0xcb7c362b), SPH_C32(0x3fab555a), + SPH_C32(0x7cae8d9e), SPH_C32(0xed570001), SPH_C32(0xe4df05ea), + SPH_C32(0xd1b40e0a), SPH_C32(0x8968f411) }, + { SPH_C32(0x290a000c), SPH_C32(0x89ecb91e), SPH_C32(0x1a54091d), + SPH_C32(0x057bbcad), SPH_C32(0xa53a0002), SPH_C32(0x88816249), + SPH_C32(0xe65f30a5), SPH_C32(0xb1b9c5db) }, + { SPH_C32(0xe944000d), SPH_C32(0xba55790e), SPH_C32(0xb45ab218), + SPH_C32(0xb0df7a96), SPH_C32(0x6dcb0002), SPH_C32(0x83ac85cb), + SPH_C32(0x8da97801), SPH_C32(0xe2257864) }, + { SPH_C32(0xe1fb000c), SPH_C32(0x82c15e9c), SPH_C32(0x71a241b9), + SPH_C32(0x56e70112), SPH_C32(0xad850003), SPH_C32(0xb01545db), + SPH_C32(0x23a7c304), SPH_C32(0x5781be5f) }, + { SPH_C32(0x21b5000d), SPH_C32(0xb1789e8c), SPH_C32(0xdfacfabc), + SPH_C32(0xe343c729), SPH_C32(0x65740003), SPH_C32(0xbb38a259), + SPH_C32(0x48518ba0), SPH_C32(0x041d03e0) }, + { SPH_C32(0xa129000e), SPH_C32(0xd60b1ead), SPH_C32(0x83b18cb7), + SPH_C32(0x880e4b5c), SPH_C32(0xf4960002), SPH_C32(0xad626d5d), + SPH_C32(0x9fbd1ae9), SPH_C32(0xa321789d) }, + { SPH_C32(0x6167000f), SPH_C32(0xe5b2debd), SPH_C32(0x2dbf37b2), + SPH_C32(0x3daa8d67), SPH_C32(0x3c670002), SPH_C32(0xa64f8adf), + SPH_C32(0xf44b524d), SPH_C32(0xf0bdc522) }, + { SPH_C32(0x69d8000e), SPH_C32(0xdd26f92f), SPH_C32(0xe847c413), + SPH_C32(0xdb92f6e3), SPH_C32(0xfc290003), SPH_C32(0x95f64acf), + SPH_C32(0x5a45e948), SPH_C32(0x45190319) }, + { SPH_C32(0xa996000f), SPH_C32(0xee9f393f), SPH_C32(0x46497f16), + SPH_C32(0x6e3630d8), SPH_C32(0x34d80003), SPH_C32(0x9edbad4d), + SPH_C32(0x31b3a1ec), SPH_C32(0x1685bea6) }, + { SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), SPH_C32(0x66418f3c), + SPH_C32(0xce05ef02), SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), + SPH_C32(0x9b9d2f13), SPH_C32(0x811ea6b6) }, + { SPH_C32(0x03490009), SPH_C32(0x532b00c7), SPH_C32(0xc84f3439), + SPH_C32(0x7ba12939), SPH_C32(0x644c0004), SPH_C32(0x75dea21b), + SPH_C32(0xf06b67b7), SPH_C32(0xd2821b09) }, + { SPH_C32(0x0bf60008), SPH_C32(0x6bbf2755), SPH_C32(0x0db7c798), + SPH_C32(0x9d9952bd), SPH_C32(0xa4020005), SPH_C32(0x4667620b), + SPH_C32(0x5e65dcb2), SPH_C32(0x6726dd32) }, + { SPH_C32(0xcbb80009), SPH_C32(0x5806e745), SPH_C32(0xa3b97c9d), + SPH_C32(0x283d9486), SPH_C32(0x6cf30005), SPH_C32(0x4d4a8589), + SPH_C32(0x35939416), SPH_C32(0x34ba608d) }, + { SPH_C32(0x4b24000a), SPH_C32(0x3f756764), SPH_C32(0xffa40a96), + SPH_C32(0x437018f3), SPH_C32(0xfd110004), SPH_C32(0x5b104a8d), + SPH_C32(0xe27f055f), SPH_C32(0x93861bf0) }, + { SPH_C32(0x8b6a000b), SPH_C32(0x0ccca774), SPH_C32(0x51aab193), + SPH_C32(0xf6d4dec8), SPH_C32(0x35e00004), SPH_C32(0x503dad0f), + SPH_C32(0x89894dfb), SPH_C32(0xc01aa64f) }, + { SPH_C32(0x83d5000a), SPH_C32(0x345880e6), SPH_C32(0x94524232), + SPH_C32(0x10eca54c), SPH_C32(0xf5ae0005), SPH_C32(0x63846d1f), + SPH_C32(0x2787f6fe), SPH_C32(0x75be6074) }, + { SPH_C32(0x439b000b), SPH_C32(0x07e140f6), SPH_C32(0x3a5cf937), + SPH_C32(0xa5486377), SPH_C32(0x3d5f0005), SPH_C32(0x68a98a9d), + SPH_C32(0x4c71be5a), SPH_C32(0x2622ddcb) }, + { SPH_C32(0x92ab0008), SPH_C32(0x4571cfc3), SPH_C32(0x1fa3a570), + SPH_C32(0xdc9d5244), SPH_C32(0x75320006), SPH_C32(0x04f7ed3e), + SPH_C32(0x7b9a80f5), SPH_C32(0x1ef3ec01) }, + { SPH_C32(0x52e50009), SPH_C32(0x76c80fd3), SPH_C32(0xb1ad1e75), + SPH_C32(0x6939947f), SPH_C32(0xbdc30006), SPH_C32(0x0fda0abc), + SPH_C32(0x106cc851), SPH_C32(0x4d6f51be) }, + { SPH_C32(0x5a5a0008), SPH_C32(0x4e5c2841), SPH_C32(0x7455edd4), + SPH_C32(0x8f01effb), SPH_C32(0x7d8d0007), SPH_C32(0x3c63caac), + SPH_C32(0xbe627354), SPH_C32(0xf8cb9785) }, + { SPH_C32(0x9a140009), SPH_C32(0x7de5e851), SPH_C32(0xda5b56d1), + SPH_C32(0x3aa529c0), SPH_C32(0xb57c0007), SPH_C32(0x374e2d2e), + SPH_C32(0xd5943bf0), SPH_C32(0xab572a3a) }, + { SPH_C32(0x1a88000a), SPH_C32(0x1a966870), SPH_C32(0x864620da), + SPH_C32(0x51e8a5b5), SPH_C32(0x249e0006), SPH_C32(0x2114e22a), + SPH_C32(0x0278aab9), SPH_C32(0x0c6b5147) }, + { SPH_C32(0xdac6000b), SPH_C32(0x292fa860), SPH_C32(0x28489bdf), + SPH_C32(0xe44c638e), SPH_C32(0xec6f0006), SPH_C32(0x2a3905a8), + SPH_C32(0x698ee21d), SPH_C32(0x5ff7ecf8) }, + { SPH_C32(0xd279000a), SPH_C32(0x11bb8ff2), SPH_C32(0xedb0687e), + SPH_C32(0x0274180a), SPH_C32(0x2c210007), SPH_C32(0x1980c5b8), + SPH_C32(0xc7805918), SPH_C32(0xea532ac3) }, + { SPH_C32(0x1237000b), SPH_C32(0x22024fe2), SPH_C32(0x43bed37b), + SPH_C32(0xb7d0de31), SPH_C32(0xe4d00007), SPH_C32(0x12ad223a), + SPH_C32(0xac7611bc), SPH_C32(0xb9cf977c) }, + { SPH_C32(0x130f000c), SPH_C32(0xece44fa0), SPH_C32(0xfb843f6c), + SPH_C32(0x614fc6d8), SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), + SPH_C32(0x03af332e), SPH_C32(0xf7b26185) }, + { SPH_C32(0xd341000d), SPH_C32(0xdf5d8fb0), SPH_C32(0x558a8469), + SPH_C32(0xd4eb00e3), SPH_C32(0x0fe50004), SPH_C32(0x35355bb1), + SPH_C32(0x68597b8a), SPH_C32(0xa42edc3a) }, + { SPH_C32(0xdbfe000c), SPH_C32(0xe7c9a822), SPH_C32(0x907277c8), + SPH_C32(0x32d37b67), SPH_C32(0xcfab0005), SPH_C32(0x068c9ba1), + SPH_C32(0xc657c08f), SPH_C32(0x118a1a01) }, + { SPH_C32(0x1bb0000d), SPH_C32(0xd4706832), SPH_C32(0x3e7ccccd), + SPH_C32(0x8777bd5c), SPH_C32(0x075a0005), SPH_C32(0x0da17c23), + SPH_C32(0xada1882b), SPH_C32(0x4216a7be) }, + { SPH_C32(0x9b2c000e), SPH_C32(0xb303e813), SPH_C32(0x6261bac6), + SPH_C32(0xec3a3129), SPH_C32(0x96b80004), SPH_C32(0x1bfbb327), + SPH_C32(0x7a4d1962), SPH_C32(0xe52adcc3) }, + { SPH_C32(0x5b62000f), SPH_C32(0x80ba2803), SPH_C32(0xcc6f01c3), + SPH_C32(0x599ef712), SPH_C32(0x5e490004), SPH_C32(0x10d654a5), + SPH_C32(0x11bb51c6), SPH_C32(0xb6b6617c) }, + { SPH_C32(0x53dd000e), SPH_C32(0xb82e0f91), SPH_C32(0x0997f262), + SPH_C32(0xbfa68c96), SPH_C32(0x9e070005), SPH_C32(0x236f94b5), + SPH_C32(0xbfb5eac3), SPH_C32(0x0312a747) }, + { SPH_C32(0x9393000f), SPH_C32(0x8b97cf81), SPH_C32(0xa7994967), + SPH_C32(0x0a024aad), SPH_C32(0x56f60005), SPH_C32(0x28427337), + SPH_C32(0xd443a267), SPH_C32(0x508e1af8) }, + { SPH_C32(0x42a3000c), SPH_C32(0xc90740b4), SPH_C32(0x82661520), + SPH_C32(0x73d77b9e), SPH_C32(0x1e9b0006), SPH_C32(0x441c1494), + SPH_C32(0xe3a89cc8), SPH_C32(0x685f2b32) }, + { SPH_C32(0x82ed000d), SPH_C32(0xfabe80a4), SPH_C32(0x2c68ae25), + SPH_C32(0xc673bda5), SPH_C32(0xd66a0006), SPH_C32(0x4f31f316), + SPH_C32(0x885ed46c), SPH_C32(0x3bc3968d) }, + { SPH_C32(0x8a52000c), SPH_C32(0xc22aa736), SPH_C32(0xe9905d84), + SPH_C32(0x204bc621), SPH_C32(0x16240007), SPH_C32(0x7c883306), + SPH_C32(0x26506f69), SPH_C32(0x8e6750b6) }, + { SPH_C32(0x4a1c000d), SPH_C32(0xf1936726), SPH_C32(0x479ee681), + SPH_C32(0x95ef001a), SPH_C32(0xded50007), SPH_C32(0x77a5d484), + SPH_C32(0x4da627cd), SPH_C32(0xddfbed09) }, + { SPH_C32(0xca80000e), SPH_C32(0x96e0e707), SPH_C32(0x1b83908a), + SPH_C32(0xfea28c6f), SPH_C32(0x4f370006), SPH_C32(0x61ff1b80), + SPH_C32(0x9a4ab684), SPH_C32(0x7ac79674) }, + { SPH_C32(0x0ace000f), SPH_C32(0xa5592717), SPH_C32(0xb58d2b8f), + SPH_C32(0x4b064a54), SPH_C32(0x87c60006), SPH_C32(0x6ad2fc02), + SPH_C32(0xf1bcfe20), SPH_C32(0x295b2bcb) }, + { SPH_C32(0x0271000e), SPH_C32(0x9dcd0085), SPH_C32(0x7075d82e), + SPH_C32(0xad3e31d0), SPH_C32(0x47880007), SPH_C32(0x596b3c12), + SPH_C32(0x5fb24525), SPH_C32(0x9cffedf0) }, + { SPH_C32(0xc23f000f), SPH_C32(0xae74c095), SPH_C32(0xde7b632b), + SPH_C32(0x189af7eb), SPH_C32(0x8f790007), SPH_C32(0x5246db90), + SPH_C32(0x34440d81), SPH_C32(0xcf63504f) }, + { SPH_C32(0x171c0000), SPH_C32(0xb26e3344), SPH_C32(0x9e6a837e), + SPH_C32(0x58f8485f), SPH_C32(0xbfb20008), SPH_C32(0x92170a39), + SPH_C32(0x6019107f), SPH_C32(0xe051606e) }, + { SPH_C32(0xd7520001), SPH_C32(0x81d7f354), SPH_C32(0x3064387b), + SPH_C32(0xed5c8e64), SPH_C32(0x77430008), SPH_C32(0x993aedbb), + SPH_C32(0x0bef58db), SPH_C32(0xb3cdddd1) }, + { SPH_C32(0xdfed0000), SPH_C32(0xb943d4c6), SPH_C32(0xf59ccbda), + SPH_C32(0x0b64f5e0), SPH_C32(0xb70d0009), SPH_C32(0xaa832dab), + SPH_C32(0xa5e1e3de), SPH_C32(0x06691bea) }, + { SPH_C32(0x1fa30001), SPH_C32(0x8afa14d6), SPH_C32(0x5b9270df), + SPH_C32(0xbec033db), SPH_C32(0x7ffc0009), SPH_C32(0xa1aeca29), + SPH_C32(0xce17ab7a), SPH_C32(0x55f5a655) }, + { SPH_C32(0x9f3f0002), SPH_C32(0xed8994f7), SPH_C32(0x078f06d4), + SPH_C32(0xd58dbfae), SPH_C32(0xee1e0008), SPH_C32(0xb7f4052d), + SPH_C32(0x19fb3a33), SPH_C32(0xf2c9dd28) }, + { SPH_C32(0x5f710003), SPH_C32(0xde3054e7), SPH_C32(0xa981bdd1), + SPH_C32(0x60297995), SPH_C32(0x26ef0008), SPH_C32(0xbcd9e2af), + SPH_C32(0x720d7297), SPH_C32(0xa1556097) }, + { SPH_C32(0x57ce0002), SPH_C32(0xe6a47375), SPH_C32(0x6c794e70), + SPH_C32(0x86110211), SPH_C32(0xe6a10009), SPH_C32(0x8f6022bf), + SPH_C32(0xdc03c992), SPH_C32(0x14f1a6ac) }, + { SPH_C32(0x97800003), SPH_C32(0xd51db365), SPH_C32(0xc277f575), + SPH_C32(0x33b5c42a), SPH_C32(0x2e500009), SPH_C32(0x844dc53d), + SPH_C32(0xb7f58136), SPH_C32(0x476d1b13) }, + { SPH_C32(0x46b00000), SPH_C32(0x978d3c50), SPH_C32(0xe788a932), + SPH_C32(0x4a60f519), SPH_C32(0x663d000a), SPH_C32(0xe813a29e), + SPH_C32(0x801ebf99), SPH_C32(0x7fbc2ad9) }, + { SPH_C32(0x86fe0001), SPH_C32(0xa434fc40), SPH_C32(0x49861237), + SPH_C32(0xffc43322), SPH_C32(0xaecc000a), SPH_C32(0xe33e451c), + SPH_C32(0xebe8f73d), SPH_C32(0x2c209766) }, + { SPH_C32(0x8e410000), SPH_C32(0x9ca0dbd2), SPH_C32(0x8c7ee196), + SPH_C32(0x19fc48a6), SPH_C32(0x6e82000b), SPH_C32(0xd087850c), + SPH_C32(0x45e64c38), SPH_C32(0x9984515d) }, + { SPH_C32(0x4e0f0001), SPH_C32(0xaf191bc2), SPH_C32(0x22705a93), + SPH_C32(0xac588e9d), SPH_C32(0xa673000b), SPH_C32(0xdbaa628e), + SPH_C32(0x2e10049c), SPH_C32(0xca18ece2) }, + { SPH_C32(0xce930002), SPH_C32(0xc86a9be3), SPH_C32(0x7e6d2c98), + SPH_C32(0xc71502e8), SPH_C32(0x3791000a), SPH_C32(0xcdf0ad8a), + SPH_C32(0xf9fc95d5), SPH_C32(0x6d24979f) }, + { SPH_C32(0x0edd0003), SPH_C32(0xfbd35bf3), SPH_C32(0xd063979d), + SPH_C32(0x72b1c4d3), SPH_C32(0xff60000a), SPH_C32(0xc6dd4a08), + SPH_C32(0x920add71), SPH_C32(0x3eb82a20) }, + { SPH_C32(0x06620002), SPH_C32(0xc3477c61), SPH_C32(0x159b643c), + SPH_C32(0x9489bf57), SPH_C32(0x3f2e000b), SPH_C32(0xf5648a18), + SPH_C32(0x3c046674), SPH_C32(0x8b1cec1b) }, + { SPH_C32(0xc62c0003), SPH_C32(0xf0febc71), SPH_C32(0xbb95df39), + SPH_C32(0x212d796c), SPH_C32(0xf7df000b), SPH_C32(0xfe496d9a), + SPH_C32(0x57f22ed0), SPH_C32(0xd88051a4) }, + { SPH_C32(0xc7140004), SPH_C32(0x3e18bc33), SPH_C32(0x03af332e), + SPH_C32(0xf7b26185), SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), + SPH_C32(0xf82b0c42), SPH_C32(0x96fda75d) }, + { SPH_C32(0x075a0005), SPH_C32(0x0da17c23), SPH_C32(0xada1882b), + SPH_C32(0x4216a7be), SPH_C32(0x1cea0008), SPH_C32(0xd9d11411), + SPH_C32(0x93dd44e6), SPH_C32(0xc5611ae2) }, + { SPH_C32(0x0fe50004), SPH_C32(0x35355bb1), SPH_C32(0x68597b8a), + SPH_C32(0xa42edc3a), SPH_C32(0xdca40009), SPH_C32(0xea68d401), + SPH_C32(0x3dd3ffe3), SPH_C32(0x70c5dcd9) }, + { SPH_C32(0xcfab0005), SPH_C32(0x068c9ba1), SPH_C32(0xc657c08f), + SPH_C32(0x118a1a01), SPH_C32(0x14550009), SPH_C32(0xe1453383), + SPH_C32(0x5625b747), SPH_C32(0x23596166) }, + { SPH_C32(0x4f370006), SPH_C32(0x61ff1b80), SPH_C32(0x9a4ab684), + SPH_C32(0x7ac79674), SPH_C32(0x85b70008), SPH_C32(0xf71ffc87), + SPH_C32(0x81c9260e), SPH_C32(0x84651a1b) }, + { SPH_C32(0x8f790007), SPH_C32(0x5246db90), SPH_C32(0x34440d81), + SPH_C32(0xcf63504f), SPH_C32(0x4d460008), SPH_C32(0xfc321b05), + SPH_C32(0xea3f6eaa), SPH_C32(0xd7f9a7a4) }, + { SPH_C32(0x87c60006), SPH_C32(0x6ad2fc02), SPH_C32(0xf1bcfe20), + SPH_C32(0x295b2bcb), SPH_C32(0x8d080009), SPH_C32(0xcf8bdb15), + SPH_C32(0x4431d5af), SPH_C32(0x625d619f) }, + { SPH_C32(0x47880007), SPH_C32(0x596b3c12), SPH_C32(0x5fb24525), + SPH_C32(0x9cffedf0), SPH_C32(0x45f90009), SPH_C32(0xc4a63c97), + SPH_C32(0x2fc79d0b), SPH_C32(0x31c1dc20) }, + { SPH_C32(0x96b80004), SPH_C32(0x1bfbb327), SPH_C32(0x7a4d1962), + SPH_C32(0xe52adcc3), SPH_C32(0x0d94000a), SPH_C32(0xa8f85b34), + SPH_C32(0x182ca3a4), SPH_C32(0x0910edea) }, + { SPH_C32(0x56f60005), SPH_C32(0x28427337), SPH_C32(0xd443a267), + SPH_C32(0x508e1af8), SPH_C32(0xc565000a), SPH_C32(0xa3d5bcb6), + SPH_C32(0x73daeb00), SPH_C32(0x5a8c5055) }, + { SPH_C32(0x5e490004), SPH_C32(0x10d654a5), SPH_C32(0x11bb51c6), + SPH_C32(0xb6b6617c), SPH_C32(0x052b000b), SPH_C32(0x906c7ca6), + SPH_C32(0xddd45005), SPH_C32(0xef28966e) }, + { SPH_C32(0x9e070005), SPH_C32(0x236f94b5), SPH_C32(0xbfb5eac3), + SPH_C32(0x0312a747), SPH_C32(0xcdda000b), SPH_C32(0x9b419b24), + SPH_C32(0xb62218a1), SPH_C32(0xbcb42bd1) }, + { SPH_C32(0x1e9b0006), SPH_C32(0x441c1494), SPH_C32(0xe3a89cc8), + SPH_C32(0x685f2b32), SPH_C32(0x5c38000a), SPH_C32(0x8d1b5420), + SPH_C32(0x61ce89e8), SPH_C32(0x1b8850ac) }, + { SPH_C32(0xded50007), SPH_C32(0x77a5d484), SPH_C32(0x4da627cd), + SPH_C32(0xddfbed09), SPH_C32(0x94c9000a), SPH_C32(0x8636b3a2), + SPH_C32(0x0a38c14c), SPH_C32(0x4814ed13) }, + { SPH_C32(0xd66a0006), SPH_C32(0x4f31f316), SPH_C32(0x885ed46c), + SPH_C32(0x3bc3968d), SPH_C32(0x5487000b), SPH_C32(0xb58f73b2), + SPH_C32(0xa4367a49), SPH_C32(0xfdb02b28) }, + { SPH_C32(0x16240007), SPH_C32(0x7c883306), SPH_C32(0x26506f69), + SPH_C32(0x8e6750b6), SPH_C32(0x9c76000b), SPH_C32(0xbea29430), + SPH_C32(0xcfc032ed), SPH_C32(0xae2c9697) }, + { SPH_C32(0x7cb50000), SPH_C32(0xf285caee), SPH_C32(0x06589f43), + SPH_C32(0x2e548f6c), SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), + SPH_C32(0x65eebc12), SPH_C32(0x39b78e87) }, + { SPH_C32(0xbcfb0001), SPH_C32(0xc13c0afe), SPH_C32(0xa8562446), + SPH_C32(0x9bf04957), SPH_C32(0xcce2000c), SPH_C32(0x55a79b66), + SPH_C32(0x0e18f4b6), SPH_C32(0x6a2b3338) }, + { SPH_C32(0xb4440000), SPH_C32(0xf9a82d6c), SPH_C32(0x6daed7e7), + SPH_C32(0x7dc832d3), SPH_C32(0x0cac000d), SPH_C32(0x661e5b76), + SPH_C32(0xa0164fb3), SPH_C32(0xdf8ff503) }, + { SPH_C32(0x740a0001), SPH_C32(0xca11ed7c), SPH_C32(0xc3a06ce2), + SPH_C32(0xc86cf4e8), SPH_C32(0xc45d000d), SPH_C32(0x6d33bcf4), + SPH_C32(0xcbe00717), SPH_C32(0x8c1348bc) }, + { SPH_C32(0xf4960002), SPH_C32(0xad626d5d), SPH_C32(0x9fbd1ae9), + SPH_C32(0xa321789d), SPH_C32(0x55bf000c), SPH_C32(0x7b6973f0), + SPH_C32(0x1c0c965e), SPH_C32(0x2b2f33c1) }, + { SPH_C32(0x34d80003), SPH_C32(0x9edbad4d), SPH_C32(0x31b3a1ec), + SPH_C32(0x1685bea6), SPH_C32(0x9d4e000c), SPH_C32(0x70449472), + SPH_C32(0x77fadefa), SPH_C32(0x78b38e7e) }, + { SPH_C32(0x3c670002), SPH_C32(0xa64f8adf), SPH_C32(0xf44b524d), + SPH_C32(0xf0bdc522), SPH_C32(0x5d00000d), SPH_C32(0x43fd5462), + SPH_C32(0xd9f465ff), SPH_C32(0xcd174845) }, + { SPH_C32(0xfc290003), SPH_C32(0x95f64acf), SPH_C32(0x5a45e948), + SPH_C32(0x45190319), SPH_C32(0x95f1000d), SPH_C32(0x48d0b3e0), + SPH_C32(0xb2022d5b), SPH_C32(0x9e8bf5fa) }, + { SPH_C32(0x2d190000), SPH_C32(0xd766c5fa), SPH_C32(0x7fbab50f), + SPH_C32(0x3ccc322a), SPH_C32(0xdd9c000e), SPH_C32(0x248ed443), + SPH_C32(0x85e913f4), SPH_C32(0xa65ac430) }, + { SPH_C32(0xed570001), SPH_C32(0xe4df05ea), SPH_C32(0xd1b40e0a), + SPH_C32(0x8968f411), SPH_C32(0x156d000e), SPH_C32(0x2fa333c1), + SPH_C32(0xee1f5b50), SPH_C32(0xf5c6798f) }, + { SPH_C32(0xe5e80000), SPH_C32(0xdc4b2278), SPH_C32(0x144cfdab), + SPH_C32(0x6f508f95), SPH_C32(0xd523000f), SPH_C32(0x1c1af3d1), + SPH_C32(0x4011e055), SPH_C32(0x4062bfb4) }, + { SPH_C32(0x25a60001), SPH_C32(0xeff2e268), SPH_C32(0xba4246ae), + SPH_C32(0xdaf449ae), SPH_C32(0x1dd2000f), SPH_C32(0x17371453), + SPH_C32(0x2be7a8f1), SPH_C32(0x13fe020b) }, + { SPH_C32(0xa53a0002), SPH_C32(0x88816249), SPH_C32(0xe65f30a5), + SPH_C32(0xb1b9c5db), SPH_C32(0x8c30000e), SPH_C32(0x016ddb57), + SPH_C32(0xfc0b39b8), SPH_C32(0xb4c27976) }, + { SPH_C32(0x65740003), SPH_C32(0xbb38a259), SPH_C32(0x48518ba0), + SPH_C32(0x041d03e0), SPH_C32(0x44c1000e), SPH_C32(0x0a403cd5), + SPH_C32(0x97fd711c), SPH_C32(0xe75ec4c9) }, + { SPH_C32(0x6dcb0002), SPH_C32(0x83ac85cb), SPH_C32(0x8da97801), + SPH_C32(0xe2257864), SPH_C32(0x848f000f), SPH_C32(0x39f9fcc5), + SPH_C32(0x39f3ca19), SPH_C32(0x52fa02f2) }, + { SPH_C32(0xad850003), SPH_C32(0xb01545db), SPH_C32(0x23a7c304), + SPH_C32(0x5781be5f), SPH_C32(0x4c7e000f), SPH_C32(0x32d41b47), + SPH_C32(0x520582bd), SPH_C32(0x0166bf4d) }, + { SPH_C32(0xacbd0004), SPH_C32(0x7ef34599), SPH_C32(0x9b9d2f13), + SPH_C32(0x811ea6b6), SPH_C32(0x6fba000c), SPH_C32(0x1e61854e), + SPH_C32(0xfddca02f), SPH_C32(0x4f1b49b4) }, + { SPH_C32(0x6cf30005), SPH_C32(0x4d4a8589), SPH_C32(0x35939416), + SPH_C32(0x34ba608d), SPH_C32(0xa74b000c), SPH_C32(0x154c62cc), + SPH_C32(0x962ae88b), SPH_C32(0x1c87f40b) }, + { SPH_C32(0x644c0004), SPH_C32(0x75dea21b), SPH_C32(0xf06b67b7), + SPH_C32(0xd2821b09), SPH_C32(0x6705000d), SPH_C32(0x26f5a2dc), + SPH_C32(0x3824538e), SPH_C32(0xa9233230) }, + { SPH_C32(0xa4020005), SPH_C32(0x4667620b), SPH_C32(0x5e65dcb2), + SPH_C32(0x6726dd32), SPH_C32(0xaff4000d), SPH_C32(0x2dd8455e), + SPH_C32(0x53d21b2a), SPH_C32(0xfabf8f8f) }, + { SPH_C32(0x249e0006), SPH_C32(0x2114e22a), SPH_C32(0x0278aab9), + SPH_C32(0x0c6b5147), SPH_C32(0x3e16000c), SPH_C32(0x3b828a5a), + SPH_C32(0x843e8a63), SPH_C32(0x5d83f4f2) }, + { SPH_C32(0xe4d00007), SPH_C32(0x12ad223a), SPH_C32(0xac7611bc), + SPH_C32(0xb9cf977c), SPH_C32(0xf6e7000c), SPH_C32(0x30af6dd8), + SPH_C32(0xefc8c2c7), SPH_C32(0x0e1f494d) }, + { SPH_C32(0xec6f0006), SPH_C32(0x2a3905a8), SPH_C32(0x698ee21d), + SPH_C32(0x5ff7ecf8), SPH_C32(0x36a9000d), SPH_C32(0x0316adc8), + SPH_C32(0x41c679c2), SPH_C32(0xbbbb8f76) }, + { SPH_C32(0x2c210007), SPH_C32(0x1980c5b8), SPH_C32(0xc7805918), + SPH_C32(0xea532ac3), SPH_C32(0xfe58000d), SPH_C32(0x083b4a4a), + SPH_C32(0x2a303166), SPH_C32(0xe82732c9) }, + { SPH_C32(0xfd110004), SPH_C32(0x5b104a8d), SPH_C32(0xe27f055f), + SPH_C32(0x93861bf0), SPH_C32(0xb635000e), SPH_C32(0x64652de9), + SPH_C32(0x1ddb0fc9), SPH_C32(0xd0f60303) }, + { SPH_C32(0x3d5f0005), SPH_C32(0x68a98a9d), SPH_C32(0x4c71be5a), + SPH_C32(0x2622ddcb), SPH_C32(0x7ec4000e), SPH_C32(0x6f48ca6b), + SPH_C32(0x762d476d), SPH_C32(0x836abebc) }, + { SPH_C32(0x35e00004), SPH_C32(0x503dad0f), SPH_C32(0x89894dfb), + SPH_C32(0xc01aa64f), SPH_C32(0xbe8a000f), SPH_C32(0x5cf10a7b), + SPH_C32(0xd823fc68), SPH_C32(0x36ce7887) }, + { SPH_C32(0xf5ae0005), SPH_C32(0x63846d1f), SPH_C32(0x2787f6fe), + SPH_C32(0x75be6074), SPH_C32(0x767b000f), SPH_C32(0x57dcedf9), + SPH_C32(0xb3d5b4cc), SPH_C32(0x6552c538) }, + { SPH_C32(0x75320006), SPH_C32(0x04f7ed3e), SPH_C32(0x7b9a80f5), + SPH_C32(0x1ef3ec01), SPH_C32(0xe799000e), SPH_C32(0x418622fd), + SPH_C32(0x64392585), SPH_C32(0xc26ebe45) }, + { SPH_C32(0xb57c0007), SPH_C32(0x374e2d2e), SPH_C32(0xd5943bf0), + SPH_C32(0xab572a3a), SPH_C32(0x2f68000e), SPH_C32(0x4aabc57f), + SPH_C32(0x0fcf6d21), SPH_C32(0x91f203fa) }, + { SPH_C32(0xbdc30006), SPH_C32(0x0fda0abc), SPH_C32(0x106cc851), + SPH_C32(0x4d6f51be), SPH_C32(0xef26000f), SPH_C32(0x7912056f), + SPH_C32(0xa1c1d624), SPH_C32(0x2456c5c1) }, + { SPH_C32(0x7d8d0007), SPH_C32(0x3c63caac), SPH_C32(0xbe627354), + SPH_C32(0xf8cb9785), SPH_C32(0x27d7000f), SPH_C32(0x723fe2ed), + SPH_C32(0xca379e80), SPH_C32(0x77ca787e) }, + { SPH_C32(0xbfb20008), SPH_C32(0x92170a39), SPH_C32(0x6019107f), + SPH_C32(0xe051606e), SPH_C32(0xa8ae0008), SPH_C32(0x2079397d), + SPH_C32(0xfe739301), SPH_C32(0xb8a92831) }, + { SPH_C32(0x7ffc0009), SPH_C32(0xa1aeca29), SPH_C32(0xce17ab7a), + SPH_C32(0x55f5a655), SPH_C32(0x605f0008), SPH_C32(0x2b54deff), + SPH_C32(0x9585dba5), SPH_C32(0xeb35958e) }, + { SPH_C32(0x77430008), SPH_C32(0x993aedbb), SPH_C32(0x0bef58db), + SPH_C32(0xb3cdddd1), SPH_C32(0xa0110009), SPH_C32(0x18ed1eef), + SPH_C32(0x3b8b60a0), SPH_C32(0x5e9153b5) }, + { SPH_C32(0xb70d0009), SPH_C32(0xaa832dab), SPH_C32(0xa5e1e3de), + SPH_C32(0x06691bea), SPH_C32(0x68e00009), SPH_C32(0x13c0f96d), + SPH_C32(0x507d2804), SPH_C32(0x0d0dee0a) }, + { SPH_C32(0x3791000a), SPH_C32(0xcdf0ad8a), SPH_C32(0xf9fc95d5), + SPH_C32(0x6d24979f), SPH_C32(0xf9020008), SPH_C32(0x059a3669), + SPH_C32(0x8791b94d), SPH_C32(0xaa319577) }, + { SPH_C32(0xf7df000b), SPH_C32(0xfe496d9a), SPH_C32(0x57f22ed0), + SPH_C32(0xd88051a4), SPH_C32(0x31f30008), SPH_C32(0x0eb7d1eb), + SPH_C32(0xec67f1e9), SPH_C32(0xf9ad28c8) }, + { SPH_C32(0xff60000a), SPH_C32(0xc6dd4a08), SPH_C32(0x920add71), + SPH_C32(0x3eb82a20), SPH_C32(0xf1bd0009), SPH_C32(0x3d0e11fb), + SPH_C32(0x42694aec), SPH_C32(0x4c09eef3) }, + { SPH_C32(0x3f2e000b), SPH_C32(0xf5648a18), SPH_C32(0x3c046674), + SPH_C32(0x8b1cec1b), SPH_C32(0x394c0009), SPH_C32(0x3623f679), + SPH_C32(0x299f0248), SPH_C32(0x1f95534c) }, + { SPH_C32(0xee1e0008), SPH_C32(0xb7f4052d), SPH_C32(0x19fb3a33), + SPH_C32(0xf2c9dd28), SPH_C32(0x7121000a), SPH_C32(0x5a7d91da), + SPH_C32(0x1e743ce7), SPH_C32(0x27446286) }, + { SPH_C32(0x2e500009), SPH_C32(0x844dc53d), SPH_C32(0xb7f58136), + SPH_C32(0x476d1b13), SPH_C32(0xb9d0000a), SPH_C32(0x51507658), + SPH_C32(0x75827443), SPH_C32(0x74d8df39) }, + { SPH_C32(0x26ef0008), SPH_C32(0xbcd9e2af), SPH_C32(0x720d7297), + SPH_C32(0xa1556097), SPH_C32(0x799e000b), SPH_C32(0x62e9b648), + SPH_C32(0xdb8ccf46), SPH_C32(0xc17c1902) }, + { SPH_C32(0xe6a10009), SPH_C32(0x8f6022bf), SPH_C32(0xdc03c992), + SPH_C32(0x14f1a6ac), SPH_C32(0xb16f000b), SPH_C32(0x69c451ca), + SPH_C32(0xb07a87e2), SPH_C32(0x92e0a4bd) }, + { SPH_C32(0x663d000a), SPH_C32(0xe813a29e), SPH_C32(0x801ebf99), + SPH_C32(0x7fbc2ad9), SPH_C32(0x208d000a), SPH_C32(0x7f9e9ece), + SPH_C32(0x679616ab), SPH_C32(0x35dcdfc0) }, + { SPH_C32(0xa673000b), SPH_C32(0xdbaa628e), SPH_C32(0x2e10049c), + SPH_C32(0xca18ece2), SPH_C32(0xe87c000a), SPH_C32(0x74b3794c), + SPH_C32(0x0c605e0f), SPH_C32(0x6640627f) }, + { SPH_C32(0xaecc000a), SPH_C32(0xe33e451c), SPH_C32(0xebe8f73d), + SPH_C32(0x2c209766), SPH_C32(0x2832000b), SPH_C32(0x470ab95c), + SPH_C32(0xa26ee50a), SPH_C32(0xd3e4a444) }, + { SPH_C32(0x6e82000b), SPH_C32(0xd087850c), SPH_C32(0x45e64c38), + SPH_C32(0x9984515d), SPH_C32(0xe0c3000b), SPH_C32(0x4c275ede), + SPH_C32(0xc998adae), SPH_C32(0x807819fb) }, + { SPH_C32(0x6fba000c), SPH_C32(0x1e61854e), SPH_C32(0xfddca02f), + SPH_C32(0x4f1b49b4), SPH_C32(0xc3070008), SPH_C32(0x6092c0d7), + SPH_C32(0x66418f3c), SPH_C32(0xce05ef02) }, + { SPH_C32(0xaff4000d), SPH_C32(0x2dd8455e), SPH_C32(0x53d21b2a), + SPH_C32(0xfabf8f8f), SPH_C32(0x0bf60008), SPH_C32(0x6bbf2755), + SPH_C32(0x0db7c798), SPH_C32(0x9d9952bd) }, + { SPH_C32(0xa74b000c), SPH_C32(0x154c62cc), SPH_C32(0x962ae88b), + SPH_C32(0x1c87f40b), SPH_C32(0xcbb80009), SPH_C32(0x5806e745), + SPH_C32(0xa3b97c9d), SPH_C32(0x283d9486) }, + { SPH_C32(0x6705000d), SPH_C32(0x26f5a2dc), SPH_C32(0x3824538e), + SPH_C32(0xa9233230), SPH_C32(0x03490009), SPH_C32(0x532b00c7), + SPH_C32(0xc84f3439), SPH_C32(0x7ba12939) }, + { SPH_C32(0xe799000e), SPH_C32(0x418622fd), SPH_C32(0x64392585), + SPH_C32(0xc26ebe45), SPH_C32(0x92ab0008), SPH_C32(0x4571cfc3), + SPH_C32(0x1fa3a570), SPH_C32(0xdc9d5244) }, + { SPH_C32(0x27d7000f), SPH_C32(0x723fe2ed), SPH_C32(0xca379e80), + SPH_C32(0x77ca787e), SPH_C32(0x5a5a0008), SPH_C32(0x4e5c2841), + SPH_C32(0x7455edd4), SPH_C32(0x8f01effb) }, + { SPH_C32(0x2f68000e), SPH_C32(0x4aabc57f), SPH_C32(0x0fcf6d21), + SPH_C32(0x91f203fa), SPH_C32(0x9a140009), SPH_C32(0x7de5e851), + SPH_C32(0xda5b56d1), SPH_C32(0x3aa529c0) }, + { SPH_C32(0xef26000f), SPH_C32(0x7912056f), SPH_C32(0xa1c1d624), + SPH_C32(0x2456c5c1), SPH_C32(0x52e50009), SPH_C32(0x76c80fd3), + SPH_C32(0xb1ad1e75), SPH_C32(0x6939947f) }, + { SPH_C32(0x3e16000c), SPH_C32(0x3b828a5a), SPH_C32(0x843e8a63), + SPH_C32(0x5d83f4f2), SPH_C32(0x1a88000a), SPH_C32(0x1a966870), + SPH_C32(0x864620da), SPH_C32(0x51e8a5b5) }, + { SPH_C32(0xfe58000d), SPH_C32(0x083b4a4a), SPH_C32(0x2a303166), + SPH_C32(0xe82732c9), SPH_C32(0xd279000a), SPH_C32(0x11bb8ff2), + SPH_C32(0xedb0687e), SPH_C32(0x0274180a) }, + { SPH_C32(0xf6e7000c), SPH_C32(0x30af6dd8), SPH_C32(0xefc8c2c7), + SPH_C32(0x0e1f494d), SPH_C32(0x1237000b), SPH_C32(0x22024fe2), + SPH_C32(0x43bed37b), SPH_C32(0xb7d0de31) }, + { SPH_C32(0x36a9000d), SPH_C32(0x0316adc8), SPH_C32(0x41c679c2), + SPH_C32(0xbbbb8f76), SPH_C32(0xdac6000b), SPH_C32(0x292fa860), + SPH_C32(0x28489bdf), SPH_C32(0xe44c638e) }, + { SPH_C32(0xb635000e), SPH_C32(0x64652de9), SPH_C32(0x1ddb0fc9), + SPH_C32(0xd0f60303), SPH_C32(0x4b24000a), SPH_C32(0x3f756764), + SPH_C32(0xffa40a96), SPH_C32(0x437018f3) }, + { SPH_C32(0x767b000f), SPH_C32(0x57dcedf9), SPH_C32(0xb3d5b4cc), + SPH_C32(0x6552c538), SPH_C32(0x83d5000a), SPH_C32(0x345880e6), + SPH_C32(0x94524232), SPH_C32(0x10eca54c) }, + { SPH_C32(0x7ec4000e), SPH_C32(0x6f48ca6b), SPH_C32(0x762d476d), + SPH_C32(0x836abebc), SPH_C32(0x439b000b), SPH_C32(0x07e140f6), + SPH_C32(0x3a5cf937), SPH_C32(0xa5486377) }, + { SPH_C32(0xbe8a000f), SPH_C32(0x5cf10a7b), SPH_C32(0xd823fc68), + SPH_C32(0x36ce7887), SPH_C32(0x8b6a000b), SPH_C32(0x0ccca774), + SPH_C32(0x51aab193), SPH_C32(0xf6d4dec8) }, + { SPH_C32(0xd41b0008), SPH_C32(0xd2fcf393), SPH_C32(0xf82b0c42), + SPH_C32(0x96fda75d), SPH_C32(0x130f000c), SPH_C32(0xece44fa0), + SPH_C32(0xfb843f6c), SPH_C32(0x614fc6d8) }, + { SPH_C32(0x14550009), SPH_C32(0xe1453383), SPH_C32(0x5625b747), + SPH_C32(0x23596166), SPH_C32(0xdbfe000c), SPH_C32(0xe7c9a822), + SPH_C32(0x907277c8), SPH_C32(0x32d37b67) }, + { SPH_C32(0x1cea0008), SPH_C32(0xd9d11411), SPH_C32(0x93dd44e6), + SPH_C32(0xc5611ae2), SPH_C32(0x1bb0000d), SPH_C32(0xd4706832), + SPH_C32(0x3e7ccccd), SPH_C32(0x8777bd5c) }, + { SPH_C32(0xdca40009), SPH_C32(0xea68d401), SPH_C32(0x3dd3ffe3), + SPH_C32(0x70c5dcd9), SPH_C32(0xd341000d), SPH_C32(0xdf5d8fb0), + SPH_C32(0x558a8469), SPH_C32(0xd4eb00e3) }, + { SPH_C32(0x5c38000a), SPH_C32(0x8d1b5420), SPH_C32(0x61ce89e8), + SPH_C32(0x1b8850ac), SPH_C32(0x42a3000c), SPH_C32(0xc90740b4), + SPH_C32(0x82661520), SPH_C32(0x73d77b9e) }, + { SPH_C32(0x9c76000b), SPH_C32(0xbea29430), SPH_C32(0xcfc032ed), + SPH_C32(0xae2c9697), SPH_C32(0x8a52000c), SPH_C32(0xc22aa736), + SPH_C32(0xe9905d84), SPH_C32(0x204bc621) }, + { SPH_C32(0x94c9000a), SPH_C32(0x8636b3a2), SPH_C32(0x0a38c14c), + SPH_C32(0x4814ed13), SPH_C32(0x4a1c000d), SPH_C32(0xf1936726), + SPH_C32(0x479ee681), SPH_C32(0x95ef001a) }, + { SPH_C32(0x5487000b), SPH_C32(0xb58f73b2), SPH_C32(0xa4367a49), + SPH_C32(0xfdb02b28), SPH_C32(0x82ed000d), SPH_C32(0xfabe80a4), + SPH_C32(0x2c68ae25), SPH_C32(0xc673bda5) }, + { SPH_C32(0x85b70008), SPH_C32(0xf71ffc87), SPH_C32(0x81c9260e), + SPH_C32(0x84651a1b), SPH_C32(0xca80000e), SPH_C32(0x96e0e707), + SPH_C32(0x1b83908a), SPH_C32(0xfea28c6f) }, + { SPH_C32(0x45f90009), SPH_C32(0xc4a63c97), SPH_C32(0x2fc79d0b), + SPH_C32(0x31c1dc20), SPH_C32(0x0271000e), SPH_C32(0x9dcd0085), + SPH_C32(0x7075d82e), SPH_C32(0xad3e31d0) }, + { SPH_C32(0x4d460008), SPH_C32(0xfc321b05), SPH_C32(0xea3f6eaa), + SPH_C32(0xd7f9a7a4), SPH_C32(0xc23f000f), SPH_C32(0xae74c095), + SPH_C32(0xde7b632b), SPH_C32(0x189af7eb) }, + { SPH_C32(0x8d080009), SPH_C32(0xcf8bdb15), SPH_C32(0x4431d5af), + SPH_C32(0x625d619f), SPH_C32(0x0ace000f), SPH_C32(0xa5592717), + SPH_C32(0xb58d2b8f), SPH_C32(0x4b064a54) }, + { SPH_C32(0x0d94000a), SPH_C32(0xa8f85b34), SPH_C32(0x182ca3a4), + SPH_C32(0x0910edea), SPH_C32(0x9b2c000e), SPH_C32(0xb303e813), + SPH_C32(0x6261bac6), SPH_C32(0xec3a3129) }, + { SPH_C32(0xcdda000b), SPH_C32(0x9b419b24), SPH_C32(0xb62218a1), + SPH_C32(0xbcb42bd1), SPH_C32(0x53dd000e), SPH_C32(0xb82e0f91), + SPH_C32(0x0997f262), SPH_C32(0xbfa68c96) }, + { SPH_C32(0xc565000a), SPH_C32(0xa3d5bcb6), SPH_C32(0x73daeb00), + SPH_C32(0x5a8c5055), SPH_C32(0x9393000f), SPH_C32(0x8b97cf81), + SPH_C32(0xa7994967), SPH_C32(0x0a024aad) }, + { SPH_C32(0x052b000b), SPH_C32(0x906c7ca6), SPH_C32(0xddd45005), + SPH_C32(0xef28966e), SPH_C32(0x5b62000f), SPH_C32(0x80ba2803), + SPH_C32(0xcc6f01c3), SPH_C32(0x599ef712) }, + { SPH_C32(0x0413000c), SPH_C32(0x5e8a7ce4), SPH_C32(0x65eebc12), + SPH_C32(0x39b78e87), SPH_C32(0x78a6000c), SPH_C32(0xac0fb60a), + SPH_C32(0x63b62351), SPH_C32(0x17e301eb) }, + { SPH_C32(0xc45d000d), SPH_C32(0x6d33bcf4), SPH_C32(0xcbe00717), + SPH_C32(0x8c1348bc), SPH_C32(0xb057000c), SPH_C32(0xa7225188), + SPH_C32(0x08406bf5), SPH_C32(0x447fbc54) }, + { SPH_C32(0xcce2000c), SPH_C32(0x55a79b66), SPH_C32(0x0e18f4b6), + SPH_C32(0x6a2b3338), SPH_C32(0x7019000d), SPH_C32(0x949b9198), + SPH_C32(0xa64ed0f0), SPH_C32(0xf1db7a6f) }, + { SPH_C32(0x0cac000d), SPH_C32(0x661e5b76), SPH_C32(0xa0164fb3), + SPH_C32(0xdf8ff503), SPH_C32(0xb8e8000d), SPH_C32(0x9fb6761a), + SPH_C32(0xcdb89854), SPH_C32(0xa247c7d0) }, + { SPH_C32(0x8c30000e), SPH_C32(0x016ddb57), SPH_C32(0xfc0b39b8), + SPH_C32(0xb4c27976), SPH_C32(0x290a000c), SPH_C32(0x89ecb91e), + SPH_C32(0x1a54091d), SPH_C32(0x057bbcad) }, + { SPH_C32(0x4c7e000f), SPH_C32(0x32d41b47), SPH_C32(0x520582bd), + SPH_C32(0x0166bf4d), SPH_C32(0xe1fb000c), SPH_C32(0x82c15e9c), + SPH_C32(0x71a241b9), SPH_C32(0x56e70112) }, + { SPH_C32(0x44c1000e), SPH_C32(0x0a403cd5), SPH_C32(0x97fd711c), + SPH_C32(0xe75ec4c9), SPH_C32(0x21b5000d), SPH_C32(0xb1789e8c), + SPH_C32(0xdfacfabc), SPH_C32(0xe343c729) }, + { SPH_C32(0x848f000f), SPH_C32(0x39f9fcc5), SPH_C32(0x39f3ca19), + SPH_C32(0x52fa02f2), SPH_C32(0xe944000d), SPH_C32(0xba55790e), + SPH_C32(0xb45ab218), SPH_C32(0xb0df7a96) }, + { SPH_C32(0x55bf000c), SPH_C32(0x7b6973f0), SPH_C32(0x1c0c965e), + SPH_C32(0x2b2f33c1), SPH_C32(0xa129000e), SPH_C32(0xd60b1ead), + SPH_C32(0x83b18cb7), SPH_C32(0x880e4b5c) }, + { SPH_C32(0x95f1000d), SPH_C32(0x48d0b3e0), SPH_C32(0xb2022d5b), + SPH_C32(0x9e8bf5fa), SPH_C32(0x69d8000e), SPH_C32(0xdd26f92f), + SPH_C32(0xe847c413), SPH_C32(0xdb92f6e3) }, + { SPH_C32(0x9d4e000c), SPH_C32(0x70449472), SPH_C32(0x77fadefa), + SPH_C32(0x78b38e7e), SPH_C32(0xa996000f), SPH_C32(0xee9f393f), + SPH_C32(0x46497f16), SPH_C32(0x6e3630d8) }, + { SPH_C32(0x5d00000d), SPH_C32(0x43fd5462), SPH_C32(0xd9f465ff), + SPH_C32(0xcd174845), SPH_C32(0x6167000f), SPH_C32(0xe5b2debd), + SPH_C32(0x2dbf37b2), SPH_C32(0x3daa8d67) }, + { SPH_C32(0xdd9c000e), SPH_C32(0x248ed443), SPH_C32(0x85e913f4), + SPH_C32(0xa65ac430), SPH_C32(0xf085000e), SPH_C32(0xf3e811b9), + SPH_C32(0xfa53a6fb), SPH_C32(0x9a96f61a) }, + { SPH_C32(0x1dd2000f), SPH_C32(0x17371453), SPH_C32(0x2be7a8f1), + SPH_C32(0x13fe020b), SPH_C32(0x3874000e), SPH_C32(0xf8c5f63b), + SPH_C32(0x91a5ee5f), SPH_C32(0xc90a4ba5) }, + { SPH_C32(0x156d000e), SPH_C32(0x2fa333c1), SPH_C32(0xee1f5b50), + SPH_C32(0xf5c6798f), SPH_C32(0xf83a000f), SPH_C32(0xcb7c362b), + SPH_C32(0x3fab555a), SPH_C32(0x7cae8d9e) }, + { SPH_C32(0xd523000f), SPH_C32(0x1c1af3d1), SPH_C32(0x4011e055), + SPH_C32(0x4062bfb4), SPH_C32(0x30cb000f), SPH_C32(0xc051d1a9), + SPH_C32(0x545d1dfe), SPH_C32(0x2f323021) } +}; + +#define INPUT_SMALL do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T256_0[acc][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + acc = buf[1]; \ + rp = &T256_8[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[2]; \ + rp = &T256_16[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + acc = buf[3]; \ + rp = &T256_24[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_BIG == 1 + +/* Note: this table lists bits within each byte from least + siginificant to most significant. */ +static const sph_u32 T512[64][16] = { + { SPH_C32(0xef0b0270), SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), + SPH_C32(0x69490000), SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), + SPH_C32(0x66140a51), SPH_C32(0x924f5d0a), SPH_C32(0xc96b0030), + SPH_C32(0xe7250000), SPH_C32(0x2f840000), SPH_C32(0x264f0000), + SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), SPH_C32(0x509f6984), + SPH_C32(0x9e69af68) }, + { SPH_C32(0xc96b0030), SPH_C32(0xe7250000), SPH_C32(0x2f840000), + SPH_C32(0x264f0000), SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), + SPH_C32(0x509f6984), SPH_C32(0x9e69af68), SPH_C32(0x26600240), + SPH_C32(0xddd80000), SPH_C32(0x722a0000), SPH_C32(0x4f060000), + SPH_C32(0x936667ff), SPH_C32(0x29f944ce), SPH_C32(0x368b63d5), + SPH_C32(0x0c26f262) }, + { SPH_C32(0x145a3c00), SPH_C32(0xb9e90000), SPH_C32(0x61270000), + SPH_C32(0xf1610000), SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), + SPH_C32(0x47a96720), SPH_C32(0xe18e24c5), SPH_C32(0x23671400), + SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), SPH_C32(0xfb750000), + SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), SPH_C32(0x02c40a3f), + SPH_C32(0xdc24e61f) }, + { SPH_C32(0x23671400), SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), + SPH_C32(0xfb750000), SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), + SPH_C32(0x02c40a3f), SPH_C32(0xdc24e61f), SPH_C32(0x373d2800), + SPH_C32(0x71500000), SPH_C32(0x95e00000), SPH_C32(0x0a140000), + SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), SPH_C32(0x456d6d1f), + SPH_C32(0x3daac2da) }, + { SPH_C32(0x54285c00), SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), + SPH_C32(0xa1c50000), SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), + SPH_C32(0x6bb0419d), SPH_C32(0x551b3782), SPH_C32(0x9cbb1800), + SPH_C32(0xb0d30000), SPH_C32(0x92510000), SPH_C32(0xed930000), + SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), SPH_C32(0x430633da), + SPH_C32(0x78cace29) }, + { SPH_C32(0x9cbb1800), SPH_C32(0xb0d30000), SPH_C32(0x92510000), + SPH_C32(0xed930000), SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), + SPH_C32(0x430633da), SPH_C32(0x78cace29), SPH_C32(0xc8934400), + SPH_C32(0x5a3e0000), SPH_C32(0x57870000), SPH_C32(0x4c560000), + SPH_C32(0xea982435), SPH_C32(0x75b11115), SPH_C32(0x28b67247), + SPH_C32(0x2dd1f9ab) }, + { SPH_C32(0x29449c00), SPH_C32(0x64e70000), SPH_C32(0xf24b0000), + SPH_C32(0xc2f30000), SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), + SPH_C32(0xf3e04259), SPH_C32(0x8d0d9ec4), SPH_C32(0x466d0c00), + SPH_C32(0x08620000), SPH_C32(0xdd5d0000), SPH_C32(0xbadd0000), + SPH_C32(0x6a927942), SPH_C32(0x441f2b93), SPH_C32(0x218ace6f), + SPH_C32(0xbf2c0be2) }, + { SPH_C32(0x466d0c00), SPH_C32(0x08620000), SPH_C32(0xdd5d0000), + SPH_C32(0xbadd0000), SPH_C32(0x6a927942), SPH_C32(0x441f2b93), + SPH_C32(0x218ace6f), SPH_C32(0xbf2c0be2), SPH_C32(0x6f299000), + SPH_C32(0x6c850000), SPH_C32(0x2f160000), SPH_C32(0x782e0000), + SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), SPH_C32(0xd26a8c36), + SPH_C32(0x32219526) }, + { SPH_C32(0xf6800005), SPH_C32(0x3443c000), SPH_C32(0x24070000), + SPH_C32(0x8f3d0000), SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), + SPH_C32(0xcdc58b19), SPH_C32(0xd795ba31), SPH_C32(0xa67f0001), + SPH_C32(0x71378000), SPH_C32(0x19fc0000), SPH_C32(0x96db0000), + SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), SPH_C32(0x2c6d478f), + SPH_C32(0xac8e6c88) }, + { SPH_C32(0xa67f0001), SPH_C32(0x71378000), SPH_C32(0x19fc0000), + SPH_C32(0x96db0000), SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), + SPH_C32(0x2c6d478f), SPH_C32(0xac8e6c88), SPH_C32(0x50ff0004), + SPH_C32(0x45744000), SPH_C32(0x3dfb0000), SPH_C32(0x19e60000), + SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), SPH_C32(0xe1a8cc96), + SPH_C32(0x7b1bd6b9) }, + { SPH_C32(0xf7750009), SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), + SPH_C32(0x04920000), SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), + SPH_C32(0x7a87f14e), SPH_C32(0x9e16981a), SPH_C32(0xd46a0000), + SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), SPH_C32(0x4a290000), + SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), SPH_C32(0x98369604), + SPH_C32(0xf746c320) }, + { SPH_C32(0xd46a0000), SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), + SPH_C32(0x4a290000), SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), + SPH_C32(0x98369604), SPH_C32(0xf746c320), SPH_C32(0x231f0009), + SPH_C32(0x42f40000), SPH_C32(0x66790000), SPH_C32(0x4ebb0000), + SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), SPH_C32(0xe2b1674a), + SPH_C32(0x69505b3a) }, + { SPH_C32(0x774400f0), SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), + SPH_C32(0x34140000), SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), + SPH_C32(0x0bc3cd1e), SPH_C32(0xcf3775cb), SPH_C32(0xf46c0050), + SPH_C32(0x96180000), SPH_C32(0x14a50000), SPH_C32(0x031f0000), + SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), SPH_C32(0x9ca470d2), + SPH_C32(0x8a341574) }, + { SPH_C32(0xf46c0050), SPH_C32(0x96180000), SPH_C32(0x14a50000), + SPH_C32(0x031f0000), SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), + SPH_C32(0x9ca470d2), SPH_C32(0x8a341574), SPH_C32(0x832800a0), + SPH_C32(0x67420000), SPH_C32(0xe1170000), SPH_C32(0x370b0000), + SPH_C32(0xcba30034), SPH_C32(0x3c34923c), SPH_C32(0x9767bdcc), + SPH_C32(0x450360bf) }, + { SPH_C32(0xe8870170), SPH_C32(0x9d720000), SPH_C32(0x12db0000), + SPH_C32(0xd4220000), SPH_C32(0xf2886b27), SPH_C32(0xa921e543), + SPH_C32(0x4ef8b518), SPH_C32(0x618813b1), SPH_C32(0xb4370060), + SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), SPH_C32(0x5cae0000), + SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), SPH_C32(0x1b365f3d), + SPH_C32(0xf3d45758) }, + { SPH_C32(0xb4370060), SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), + SPH_C32(0x5cae0000), SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), + SPH_C32(0x1b365f3d), SPH_C32(0xf3d45758), SPH_C32(0x5cb00110), + SPH_C32(0x913e0000), SPH_C32(0x44190000), SPH_C32(0x888c0000), + SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), SPH_C32(0x55ceea25), + SPH_C32(0x925c44e9) }, + { SPH_C32(0x0c720000), SPH_C32(0x49e50f00), SPH_C32(0x42790000), + SPH_C32(0x5cea0000), SPH_C32(0x33aa301a), SPH_C32(0x15822514), + SPH_C32(0x95a34b7b), SPH_C32(0xb44b0090), SPH_C32(0xfe220000), + SPH_C32(0xa7580500), SPH_C32(0x25d10000), SPH_C32(0xf7600000), + SPH_C32(0x893178da), SPH_C32(0x1fd4f860), SPH_C32(0x4ed0a315), + SPH_C32(0xa123ff9f) }, + { SPH_C32(0xfe220000), SPH_C32(0xa7580500), SPH_C32(0x25d10000), + SPH_C32(0xf7600000), SPH_C32(0x893178da), SPH_C32(0x1fd4f860), + SPH_C32(0x4ed0a315), SPH_C32(0xa123ff9f), SPH_C32(0xf2500000), + SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), SPH_C32(0xab8a0000), + SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), SPH_C32(0xdb73e86e), + SPH_C32(0x1568ff0f) }, + { SPH_C32(0x45180000), SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), + SPH_C32(0x3b480000), SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), + SPH_C32(0x16bca6b0), SPH_C32(0xdf33f4df), SPH_C32(0xb83d0000), + SPH_C32(0x16710600), SPH_C32(0x379a0000), SPH_C32(0xf5b10000), + SPH_C32(0x228161ac), SPH_C32(0xae48f145), SPH_C32(0x66241616), + SPH_C32(0xc5c1eb3e) }, + { SPH_C32(0xb83d0000), SPH_C32(0x16710600), SPH_C32(0x379a0000), + SPH_C32(0xf5b10000), SPH_C32(0x228161ac), SPH_C32(0xae48f145), + SPH_C32(0x66241616), SPH_C32(0xc5c1eb3e), SPH_C32(0xfd250000), + SPH_C32(0xb3c41100), SPH_C32(0xcef00000), SPH_C32(0xcef90000), + SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), SPH_C32(0x7098b0a6), + SPH_C32(0x1af21fe1) }, + { SPH_C32(0x75a40000), SPH_C32(0xc28b2700), SPH_C32(0x94a40000), + SPH_C32(0x90f50000), SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), + SPH_C32(0x1767c483), SPH_C32(0xaedf667e), SPH_C32(0xd1660000), + SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), SPH_C32(0xf6940000), + SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), SPH_C32(0xb4431b17), + SPH_C32(0x857f3c2b) }, + { SPH_C32(0xd1660000), SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), + SPH_C32(0xf6940000), SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), + SPH_C32(0xb4431b17), SPH_C32(0x857f3c2b), SPH_C32(0xa4c20000), + SPH_C32(0xd9372400), SPH_C32(0x0a480000), SPH_C32(0x66610000), + SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), SPH_C32(0xa324df94), + SPH_C32(0x2ba05a55) }, + { SPH_C32(0x75c90003), SPH_C32(0x0e10c000), SPH_C32(0xd1200000), + SPH_C32(0xbaea0000), SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), + SPH_C32(0xbb28761d), SPH_C32(0x00b72e2b), SPH_C32(0xeecf0001), + SPH_C32(0x6f564000), SPH_C32(0xf33e0000), SPH_C32(0xa79e0000), + SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), SPH_C32(0x4a3b40ba), + SPH_C32(0xfeabf254) }, + { SPH_C32(0xeecf0001), SPH_C32(0x6f564000), SPH_C32(0xf33e0000), + SPH_C32(0xa79e0000), SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), + SPH_C32(0x4a3b40ba), SPH_C32(0xfeabf254), SPH_C32(0x9b060002), + SPH_C32(0x61468000), SPH_C32(0x221e0000), SPH_C32(0x1d740000), + SPH_C32(0x36715d27), SPH_C32(0x30495c92), SPH_C32(0xf11336a7), + SPH_C32(0xfe1cdc7f) }, + { SPH_C32(0x86790000), SPH_C32(0x3f390002), SPH_C32(0xe19ae000), + SPH_C32(0x98560000), SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), + SPH_C32(0xd3dd4944), SPH_C32(0x161ddab9), SPH_C32(0x30b70000), + SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), SPH_C32(0x42c40000), + SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), SPH_C32(0x21afa1ea), + SPH_C32(0xb0a51834) }, + { SPH_C32(0x30b70000), SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), + SPH_C32(0x42c40000), SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), + SPH_C32(0x21afa1ea), SPH_C32(0xb0a51834), SPH_C32(0xb6ce0000), + SPH_C32(0xdae90002), SPH_C32(0x156e8000), SPH_C32(0xda920000), + SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), SPH_C32(0xf272e8ae), + SPH_C32(0xa6b8c28d) }, + { SPH_C32(0x14190000), SPH_C32(0x23ca003c), SPH_C32(0x50df0000), + SPH_C32(0x44b60000), SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), + SPH_C32(0x61e610b0), SPH_C32(0xdbcadb80), SPH_C32(0xe3430000), + SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), SPH_C32(0xaa4e0000), + SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), SPH_C32(0x123db156), + SPH_C32(0x3a4e99d7) }, + { SPH_C32(0xe3430000), SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), + SPH_C32(0xaa4e0000), SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), + SPH_C32(0x123db156), SPH_C32(0x3a4e99d7), SPH_C32(0xf75a0000), + SPH_C32(0x19840028), SPH_C32(0xa2190000), SPH_C32(0xeef80000), + SPH_C32(0xc0722516), SPH_C32(0x19981260), SPH_C32(0x73dba1e6), + SPH_C32(0xe1844257) }, + { SPH_C32(0x54500000), SPH_C32(0x0671005c), SPH_C32(0x25ae0000), + SPH_C32(0x6a1e0000), SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), + SPH_C32(0xbfba18c3), SPH_C32(0x7e715d17), SPH_C32(0xbc8d0000), + SPH_C32(0xfc3b0018), SPH_C32(0x19830000), SPH_C32(0xd10b0000), + SPH_C32(0xae1878c4), SPH_C32(0x42a69856), SPH_C32(0x0012da37), + SPH_C32(0x2c3b504e) }, + { SPH_C32(0xbc8d0000), SPH_C32(0xfc3b0018), SPH_C32(0x19830000), + SPH_C32(0xd10b0000), SPH_C32(0xae1878c4), SPH_C32(0x42a69856), + SPH_C32(0x0012da37), SPH_C32(0x2c3b504e), SPH_C32(0xe8dd0000), + SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), SPH_C32(0xbb150000), + SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), SPH_C32(0xbfa8c2f4), + SPH_C32(0x524a0d59) }, + { SPH_C32(0x69510000), SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), + SPH_C32(0xac2f0000), SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), + SPH_C32(0x87ec287c), SPH_C32(0xbce1a3ce), SPH_C32(0xc6730000), + SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), SPH_C32(0x218d0000), + SPH_C32(0x23111587), SPH_C32(0x7913512f), SPH_C32(0x1d28ac88), + SPH_C32(0x378dd173) }, + { SPH_C32(0xc6730000), SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), + SPH_C32(0x218d0000), SPH_C32(0x23111587), SPH_C32(0x7913512f), + SPH_C32(0x1d28ac88), SPH_C32(0x378dd173), SPH_C32(0xaf220000), + SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), SPH_C32(0x8da20000), + SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), SPH_C32(0x9ac484f4), + SPH_C32(0x8b6c72bd) }, + { SPH_C32(0xcc140000), SPH_C32(0xa5630000), SPH_C32(0x5ab90780), + SPH_C32(0x3b500000), SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), + SPH_C32(0x694348c1), SPH_C32(0xca5a87fe), SPH_C32(0x819e0000), + SPH_C32(0xec570000), SPH_C32(0x66320280), SPH_C32(0x95f30000), + SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), SPH_C32(0xe65aa22d), + SPH_C32(0x8e67b7fa) }, + { SPH_C32(0x819e0000), SPH_C32(0xec570000), SPH_C32(0x66320280), + SPH_C32(0x95f30000), SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), + SPH_C32(0xe65aa22d), SPH_C32(0x8e67b7fa), SPH_C32(0x4d8a0000), + SPH_C32(0x49340000), SPH_C32(0x3c8b0500), SPH_C32(0xaea30000), + SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), SPH_C32(0x8f19eaec), + SPH_C32(0x443d3004) }, + { SPH_C32(0x78230000), SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), + SPH_C32(0x90a50000), SPH_C32(0x713e2879), SPH_C32(0x7ee98924), + SPH_C32(0xf08ca062), SPH_C32(0x636f8bab), SPH_C32(0x02af0000), + SPH_C32(0xb7280000), SPH_C32(0xba1c0300), SPH_C32(0x56980000), + SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), SPH_C32(0xa95c149a), + SPH_C32(0xf4f6ea7b) }, + { SPH_C32(0x02af0000), SPH_C32(0xb7280000), SPH_C32(0xba1c0300), + SPH_C32(0x56980000), SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), + SPH_C32(0xa95c149a), SPH_C32(0xf4f6ea7b), SPH_C32(0x7a8c0000), + SPH_C32(0xa5d40000), SPH_C32(0x13260880), SPH_C32(0xc63d0000), + SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), SPH_C32(0x59d0b4f8), + SPH_C32(0x979961d0) }, + { SPH_C32(0xac480000), SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), + SPH_C32(0x03430000), SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), + SPH_C32(0xfe72c7fe), SPH_C32(0x91e478f6), SPH_C32(0x1e4e0000), + SPH_C32(0xdecf0000), SPH_C32(0x6df80180), SPH_C32(0x77240000), + SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), SPH_C32(0xcda31812), + SPH_C32(0x98aa496e) }, + { SPH_C32(0x1e4e0000), SPH_C32(0xdecf0000), SPH_C32(0x6df80180), + SPH_C32(0x77240000), SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), + SPH_C32(0xcda31812), SPH_C32(0x98aa496e), SPH_C32(0xb2060000), + SPH_C32(0xc5690000), SPH_C32(0x28031200), SPH_C32(0x74670000), + SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), SPH_C32(0x33d1dfec), + SPH_C32(0x094e3198) }, + { SPH_C32(0xaec30000), SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), + SPH_C32(0x2c150000), SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), + SPH_C32(0xab92f78f), SPH_C32(0xa312567b), SPH_C32(0xdb250000), + SPH_C32(0x09290000), SPH_C32(0x49aac000), SPH_C32(0x81e10000), + SPH_C32(0xcafe6b59), SPH_C32(0x42793431), SPH_C32(0x43566b76), + SPH_C32(0xe86cba2e) }, + { SPH_C32(0xdb250000), SPH_C32(0x09290000), SPH_C32(0x49aac000), + SPH_C32(0x81e10000), SPH_C32(0xcafe6b59), SPH_C32(0x42793431), + SPH_C32(0x43566b76), SPH_C32(0xe86cba2e), SPH_C32(0x75e60000), + SPH_C32(0x95660001), SPH_C32(0x307b2000), SPH_C32(0xadf40000), + SPH_C32(0x8f321eea), SPH_C32(0x24298307), SPH_C32(0xe8c49cf9), + SPH_C32(0x4b7eec55) }, + { SPH_C32(0x58430000), SPH_C32(0x807e0000), SPH_C32(0x78330001), + SPH_C32(0xc66b3800), SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), + SPH_C32(0xac73fe6f), SPH_C32(0x3a4479b1), SPH_C32(0x1d5a0000), + SPH_C32(0x2b720000), SPH_C32(0x488d0000), SPH_C32(0xaf611800), + SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), SPH_C32(0x81a20429), + SPH_C32(0x1e7536a6) }, + { SPH_C32(0x1d5a0000), SPH_C32(0x2b720000), SPH_C32(0x488d0000), + SPH_C32(0xaf611800), SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), + SPH_C32(0x81a20429), SPH_C32(0x1e7536a6), SPH_C32(0x45190000), + SPH_C32(0xab0c0000), SPH_C32(0x30be0001), SPH_C32(0x690a2000), + SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), SPH_C32(0x2dd1fa46), + SPH_C32(0x24314f17) }, + { SPH_C32(0xa53b0000), SPH_C32(0x14260000), SPH_C32(0x4e30001e), + SPH_C32(0x7cae0000), SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), + SPH_C32(0xf73168d8), SPH_C32(0x0b1b4946), SPH_C32(0x07ed0000), + SPH_C32(0xb2500000), SPH_C32(0x8774000a), SPH_C32(0x970d0000), + SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), SPH_C32(0xf4786222), + SPH_C32(0x9075b1ce) }, + { SPH_C32(0x07ed0000), SPH_C32(0xb2500000), SPH_C32(0x8774000a), + SPH_C32(0x970d0000), SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), + SPH_C32(0xf4786222), SPH_C32(0x9075b1ce), SPH_C32(0xa2d60000), + SPH_C32(0xa6760000), SPH_C32(0xc9440014), SPH_C32(0xeba30000), + SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), SPH_C32(0x03490afa), + SPH_C32(0x9b6ef888) }, + { SPH_C32(0x88980000), SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), + SPH_C32(0xfb4e0000), SPH_C32(0xf158079a), SPH_C32(0x61ae9167), + SPH_C32(0xa895706c), SPH_C32(0xe6107494), SPH_C32(0x0bc20000), + SPH_C32(0xdb630000), SPH_C32(0x7e88000c), SPH_C32(0x15860000), + SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), SPH_C32(0xf460449e), + SPH_C32(0xd8b61463) }, + { SPH_C32(0x0bc20000), SPH_C32(0xdb630000), SPH_C32(0x7e88000c), + SPH_C32(0x15860000), SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), + SPH_C32(0xf460449e), SPH_C32(0xd8b61463), SPH_C32(0x835a0000), + SPH_C32(0xc4f70000), SPH_C32(0x01470022), SPH_C32(0xeec80000), + SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), SPH_C32(0x5cf534f2), + SPH_C32(0x3ea660f7) }, + { SPH_C32(0x52500000), SPH_C32(0x29540000), SPH_C32(0x6a61004e), + SPH_C32(0xf0ff0000), SPH_C32(0x9a317eec), SPH_C32(0x452341ce), + SPH_C32(0xcf568fe5), SPH_C32(0x5303130f), SPH_C32(0x538d0000), + SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), SPH_C32(0x56ff0000), + SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), SPH_C32(0xa9444018), + SPH_C32(0x7f975691) }, + { SPH_C32(0x538d0000), SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), + SPH_C32(0x56ff0000), SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), + SPH_C32(0xa9444018), SPH_C32(0x7f975691), SPH_C32(0x01dd0000), + SPH_C32(0x80a80000), SPH_C32(0xf4960048), SPH_C32(0xa6000000), + SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), SPH_C32(0x6612cffd), + SPH_C32(0x2c94459e) }, + { SPH_C32(0xe6280000), SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), + SPH_C32(0xd3d002e0), SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), + SPH_C32(0x289506b4), SPH_C32(0xd75a4897), SPH_C32(0xf0c50000), + SPH_C32(0x59230000), SPH_C32(0x45820000), SPH_C32(0xe18d00c0), + SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), SPH_C32(0xcbe0fe1c), + SPH_C32(0x56a7b19f) }, + { SPH_C32(0xf0c50000), SPH_C32(0x59230000), SPH_C32(0x45820000), + SPH_C32(0xe18d00c0), SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), + SPH_C32(0xcbe0fe1c), SPH_C32(0x56a7b19f), SPH_C32(0x16ed0000), + SPH_C32(0x15680000), SPH_C32(0xedd70000), SPH_C32(0x325d0220), + SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), SPH_C32(0xe375f8a8), + SPH_C32(0x81fdf908) }, + { SPH_C32(0xb4310000), SPH_C32(0x77330000), SPH_C32(0xb15d0000), + SPH_C32(0x7fd004e0), SPH_C32(0x78a26138), SPH_C32(0xd116c35d), + SPH_C32(0xd256d489), SPH_C32(0x4e6f74de), SPH_C32(0xe3060000), + SPH_C32(0xbdc10000), SPH_C32(0x87130000), SPH_C32(0xbff20060), + SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), SPH_C32(0x73c5ab06), + SPH_C32(0x5bd61539) }, + { SPH_C32(0xe3060000), SPH_C32(0xbdc10000), SPH_C32(0x87130000), + SPH_C32(0xbff20060), SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), + SPH_C32(0x73c5ab06), SPH_C32(0x5bd61539), SPH_C32(0x57370000), + SPH_C32(0xcaf20000), SPH_C32(0x364e0000), SPH_C32(0xc0220480), + SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), SPH_C32(0xa1937f8f), + SPH_C32(0x15b961e7) }, + { SPH_C32(0x02f20000), SPH_C32(0xa2810000), SPH_C32(0x873f0000), + SPH_C32(0xe36c7800), SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), + SPH_C32(0xc4c23237), SPH_C32(0x7f32259e), SPH_C32(0xbadd0000), + SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), SPH_C32(0xf7282800), + SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), SPH_C32(0xea5a8d14), + SPH_C32(0x2a2c18f0) }, + { SPH_C32(0xbadd0000), SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), + SPH_C32(0xf7282800), SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), + SPH_C32(0xea5a8d14), SPH_C32(0x2a2c18f0), SPH_C32(0xb82f0000), + SPH_C32(0xb12c0000), SPH_C32(0x30d80000), SPH_C32(0x14445000), + SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), SPH_C32(0x2e98bf23), + SPH_C32(0x551e3d6e) }, + { SPH_C32(0x1e6c0000), SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), + SPH_C32(0xbcb6b800), SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), + SPH_C32(0x6a0c1bc8), SPH_C32(0xb99dc2eb), SPH_C32(0x92560000), + SPH_C32(0x1eda0000), SPH_C32(0xea510000), SPH_C32(0xe8b13000), + SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), SPH_C32(0xb15c2254), + SPH_C32(0x33c5244f) }, + { SPH_C32(0x92560000), SPH_C32(0x1eda0000), SPH_C32(0xea510000), + SPH_C32(0xe8b13000), SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), + SPH_C32(0xb15c2254), SPH_C32(0x33c5244f), SPH_C32(0x8c3a0000), + SPH_C32(0xda980000), SPH_C32(0x607f0000), SPH_C32(0x54078800), + SPH_C32(0x85714513), SPH_C32(0x6006b243), SPH_C32(0xdb50399c), + SPH_C32(0x8a58e6a4) }, + { SPH_C32(0x033d0000), SPH_C32(0x08b30000), SPH_C32(0xf33a0000), + SPH_C32(0x3ac20007), SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), + SPH_C32(0x0ea5cfe3), SPH_C32(0xe6da7ffe), SPH_C32(0xa8da0000), + SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), SPH_C32(0x07da0002), + SPH_C32(0x7d669583), SPH_C32(0x1f98708a), SPH_C32(0xbb668808), + SPH_C32(0xda878000) }, + { SPH_C32(0xa8da0000), SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), + SPH_C32(0x07da0002), SPH_C32(0x7d669583), SPH_C32(0x1f98708a), + SPH_C32(0xbb668808), SPH_C32(0xda878000), SPH_C32(0xabe70000), + SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), SPH_C32(0x3d180005), + SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), SPH_C32(0xb5c347eb), + SPH_C32(0x3c5dfffe) }, + { SPH_C32(0x01930000), SPH_C32(0xe7820000), SPH_C32(0xedfb0000), + SPH_C32(0xcf0c000b), SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), + SPH_C32(0x063661e1), SPH_C32(0x536f9e7b), SPH_C32(0x92280000), + SPH_C32(0xdc850000), SPH_C32(0x57fa0000), SPH_C32(0x56dc0003), + SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), SPH_C32(0x90cef752), + SPH_C32(0x7b1675d7) }, + { SPH_C32(0x92280000), SPH_C32(0xdc850000), SPH_C32(0x57fa0000), + SPH_C32(0x56dc0003), SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), + SPH_C32(0x90cef752), SPH_C32(0x7b1675d7), SPH_C32(0x93bb0000), + SPH_C32(0x3b070000), SPH_C32(0xba010000), SPH_C32(0x99d00008), + SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), SPH_C32(0x96f896b3), + SPH_C32(0x2879ebac) }, + { SPH_C32(0x5fa80000), SPH_C32(0x56030000), SPH_C32(0x43ae0000), + SPH_C32(0x64f30013), SPH_C32(0x257e86bf), SPH_C32(0x1311944e), + SPH_C32(0x541e95bf), SPH_C32(0x8ea4db69), SPH_C32(0x00440000), + SPH_C32(0x7f480000), SPH_C32(0xda7c0000), SPH_C32(0x2a230001), + SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), SPH_C32(0x030a9e60), + SPH_C32(0xbe0a679e) }, + { SPH_C32(0x00440000), SPH_C32(0x7f480000), SPH_C32(0xda7c0000), + SPH_C32(0x2a230001), SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), + SPH_C32(0x030a9e60), SPH_C32(0xbe0a679e), SPH_C32(0x5fec0000), + SPH_C32(0x294b0000), SPH_C32(0x99d20000), SPH_C32(0x4ed00012), + SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), SPH_C32(0x57140bdf), + SPH_C32(0x30aebcf7) }, + { SPH_C32(0xee930000), SPH_C32(0xd6070000), SPH_C32(0x92c10000), + SPH_C32(0x2b9801e0), SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), + SPH_C32(0x45312374), SPH_C32(0x201f6a64), SPH_C32(0x7b280000), + SPH_C32(0x57420000), SPH_C32(0xa9e50000), SPH_C32(0x634300a0), + SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), SPH_C32(0x27f83b03), + SPH_C32(0xc7ff60f0) }, + { SPH_C32(0x7b280000), SPH_C32(0x57420000), SPH_C32(0xa9e50000), + SPH_C32(0x634300a0), SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), + SPH_C32(0x27f83b03), SPH_C32(0xc7ff60f0), SPH_C32(0x95bb0000), + SPH_C32(0x81450000), SPH_C32(0x3b240000), SPH_C32(0x48db0140), + SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), SPH_C32(0x62c91877), + SPH_C32(0xe7e00a94) } +}; + +#define INPUT_BIG do { \ + const sph_u32 *tp = &T512[0][0]; \ + unsigned u, v; \ + m0 = 0; \ + m1 = 0; \ + m2 = 0; \ + m3 = 0; \ + m4 = 0; \ + m5 = 0; \ + m6 = 0; \ + m7 = 0; \ + m8 = 0; \ + m9 = 0; \ + mA = 0; \ + mB = 0; \ + mC = 0; \ + mD = 0; \ + mE = 0; \ + mF = 0; \ + for (u = 0; u < 8; u ++) { \ + unsigned db = buf[u]; \ + for (v = 0; v < 8; v ++, db >>= 1) { \ + sph_u32 dm = SPH_T32(-(sph_u32)(db & 1)); \ + m0 ^= dm & *tp ++; \ + m1 ^= dm & *tp ++; \ + m2 ^= dm & *tp ++; \ + m3 ^= dm & *tp ++; \ + m4 ^= dm & *tp ++; \ + m5 ^= dm & *tp ++; \ + m6 ^= dm & *tp ++; \ + m7 ^= dm & *tp ++; \ + m8 ^= dm & *tp ++; \ + m9 ^= dm & *tp ++; \ + mA ^= dm & *tp ++; \ + mB ^= dm & *tp ++; \ + mC ^= dm & *tp ++; \ + mD ^= dm & *tp ++; \ + mE ^= dm & *tp ++; \ + mF ^= dm & *tp ++; \ + } \ + } \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_BIG == 2 + +static const sph_u32 T512_0[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x29449c00), SPH_C32(0x64e70000), SPH_C32(0xf24b0000), + SPH_C32(0xc2f30000), SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), + SPH_C32(0xf3e04259), SPH_C32(0x8d0d9ec4), SPH_C32(0x466d0c00), + SPH_C32(0x08620000), SPH_C32(0xdd5d0000), SPH_C32(0xbadd0000), + SPH_C32(0x6a927942), SPH_C32(0x441f2b93), SPH_C32(0x218ace6f), + SPH_C32(0xbf2c0be2) }, + { SPH_C32(0x466d0c00), SPH_C32(0x08620000), SPH_C32(0xdd5d0000), + SPH_C32(0xbadd0000), SPH_C32(0x6a927942), SPH_C32(0x441f2b93), + SPH_C32(0x218ace6f), SPH_C32(0xbf2c0be2), SPH_C32(0x6f299000), + SPH_C32(0x6c850000), SPH_C32(0x2f160000), SPH_C32(0x782e0000), + SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), SPH_C32(0xd26a8c36), + SPH_C32(0x32219526) }, + { SPH_C32(0x6f299000), SPH_C32(0x6c850000), SPH_C32(0x2f160000), + SPH_C32(0x782e0000), SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), + SPH_C32(0xd26a8c36), SPH_C32(0x32219526), SPH_C32(0x29449c00), + SPH_C32(0x64e70000), SPH_C32(0xf24b0000), SPH_C32(0xc2f30000), + SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), SPH_C32(0xf3e04259), + SPH_C32(0x8d0d9ec4) } +}; + +static const sph_u32 T512_2[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x54285c00), SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), + SPH_C32(0xa1c50000), SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), + SPH_C32(0x6bb0419d), SPH_C32(0x551b3782), SPH_C32(0x9cbb1800), + SPH_C32(0xb0d30000), SPH_C32(0x92510000), SPH_C32(0xed930000), + SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), SPH_C32(0x430633da), + SPH_C32(0x78cace29) }, + { SPH_C32(0x9cbb1800), SPH_C32(0xb0d30000), SPH_C32(0x92510000), + SPH_C32(0xed930000), SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), + SPH_C32(0x430633da), SPH_C32(0x78cace29), SPH_C32(0xc8934400), + SPH_C32(0x5a3e0000), SPH_C32(0x57870000), SPH_C32(0x4c560000), + SPH_C32(0xea982435), SPH_C32(0x75b11115), SPH_C32(0x28b67247), + SPH_C32(0x2dd1f9ab) }, + { SPH_C32(0xc8934400), SPH_C32(0x5a3e0000), SPH_C32(0x57870000), + SPH_C32(0x4c560000), SPH_C32(0xea982435), SPH_C32(0x75b11115), + SPH_C32(0x28b67247), SPH_C32(0x2dd1f9ab), SPH_C32(0x54285c00), + SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), SPH_C32(0xa1c50000), + SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), SPH_C32(0x6bb0419d), + SPH_C32(0x551b3782) } +}; + +static const sph_u32 T512_4[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x145a3c00), SPH_C32(0xb9e90000), SPH_C32(0x61270000), + SPH_C32(0xf1610000), SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), + SPH_C32(0x47a96720), SPH_C32(0xe18e24c5), SPH_C32(0x23671400), + SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), SPH_C32(0xfb750000), + SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), SPH_C32(0x02c40a3f), + SPH_C32(0xdc24e61f) }, + { SPH_C32(0x23671400), SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), + SPH_C32(0xfb750000), SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), + SPH_C32(0x02c40a3f), SPH_C32(0xdc24e61f), SPH_C32(0x373d2800), + SPH_C32(0x71500000), SPH_C32(0x95e00000), SPH_C32(0x0a140000), + SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), SPH_C32(0x456d6d1f), + SPH_C32(0x3daac2da) }, + { SPH_C32(0x373d2800), SPH_C32(0x71500000), SPH_C32(0x95e00000), + SPH_C32(0x0a140000), SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), + SPH_C32(0x456d6d1f), SPH_C32(0x3daac2da), SPH_C32(0x145a3c00), + SPH_C32(0xb9e90000), SPH_C32(0x61270000), SPH_C32(0xf1610000), + SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), SPH_C32(0x47a96720), + SPH_C32(0xe18e24c5) } +}; + +static const sph_u32 T512_6[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xef0b0270), SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), + SPH_C32(0x69490000), SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), + SPH_C32(0x66140a51), SPH_C32(0x924f5d0a), SPH_C32(0xc96b0030), + SPH_C32(0xe7250000), SPH_C32(0x2f840000), SPH_C32(0x264f0000), + SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), SPH_C32(0x509f6984), + SPH_C32(0x9e69af68) }, + { SPH_C32(0xc96b0030), SPH_C32(0xe7250000), SPH_C32(0x2f840000), + SPH_C32(0x264f0000), SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), + SPH_C32(0x509f6984), SPH_C32(0x9e69af68), SPH_C32(0x26600240), + SPH_C32(0xddd80000), SPH_C32(0x722a0000), SPH_C32(0x4f060000), + SPH_C32(0x936667ff), SPH_C32(0x29f944ce), SPH_C32(0x368b63d5), + SPH_C32(0x0c26f262) }, + { SPH_C32(0x26600240), SPH_C32(0xddd80000), SPH_C32(0x722a0000), + SPH_C32(0x4f060000), SPH_C32(0x936667ff), SPH_C32(0x29f944ce), + SPH_C32(0x368b63d5), SPH_C32(0x0c26f262), SPH_C32(0xef0b0270), + SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), SPH_C32(0x69490000), + SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), SPH_C32(0x66140a51), + SPH_C32(0x924f5d0a) } +}; + +static const sph_u32 T512_8[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xe8870170), SPH_C32(0x9d720000), SPH_C32(0x12db0000), + SPH_C32(0xd4220000), SPH_C32(0xf2886b27), SPH_C32(0xa921e543), + SPH_C32(0x4ef8b518), SPH_C32(0x618813b1), SPH_C32(0xb4370060), + SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), SPH_C32(0x5cae0000), + SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), SPH_C32(0x1b365f3d), + SPH_C32(0xf3d45758) }, + { SPH_C32(0xb4370060), SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), + SPH_C32(0x5cae0000), SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), + SPH_C32(0x1b365f3d), SPH_C32(0xf3d45758), SPH_C32(0x5cb00110), + SPH_C32(0x913e0000), SPH_C32(0x44190000), SPH_C32(0x888c0000), + SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), SPH_C32(0x55ceea25), + SPH_C32(0x925c44e9) }, + { SPH_C32(0x5cb00110), SPH_C32(0x913e0000), SPH_C32(0x44190000), + SPH_C32(0x888c0000), SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), + SPH_C32(0x55ceea25), SPH_C32(0x925c44e9), SPH_C32(0xe8870170), + SPH_C32(0x9d720000), SPH_C32(0x12db0000), SPH_C32(0xd4220000), + SPH_C32(0xf2886b27), SPH_C32(0xa921e543), SPH_C32(0x4ef8b518), + SPH_C32(0x618813b1) } +}; + +static const sph_u32 T512_10[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x774400f0), SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), + SPH_C32(0x34140000), SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), + SPH_C32(0x0bc3cd1e), SPH_C32(0xcf3775cb), SPH_C32(0xf46c0050), + SPH_C32(0x96180000), SPH_C32(0x14a50000), SPH_C32(0x031f0000), + SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), SPH_C32(0x9ca470d2), + SPH_C32(0x8a341574) }, + { SPH_C32(0xf46c0050), SPH_C32(0x96180000), SPH_C32(0x14a50000), + SPH_C32(0x031f0000), SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), + SPH_C32(0x9ca470d2), SPH_C32(0x8a341574), SPH_C32(0x832800a0), + SPH_C32(0x67420000), SPH_C32(0xe1170000), SPH_C32(0x370b0000), + SPH_C32(0xcba30034), SPH_C32(0x3c34923c), SPH_C32(0x9767bdcc), + SPH_C32(0x450360bf) }, + { SPH_C32(0x832800a0), SPH_C32(0x67420000), SPH_C32(0xe1170000), + SPH_C32(0x370b0000), SPH_C32(0xcba30034), SPH_C32(0x3c34923c), + SPH_C32(0x9767bdcc), SPH_C32(0x450360bf), SPH_C32(0x774400f0), + SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), SPH_C32(0x34140000), + SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), SPH_C32(0x0bc3cd1e), + SPH_C32(0xcf3775cb) } +}; + +static const sph_u32 T512_12[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xf7750009), SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), + SPH_C32(0x04920000), SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), + SPH_C32(0x7a87f14e), SPH_C32(0x9e16981a), SPH_C32(0xd46a0000), + SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), SPH_C32(0x4a290000), + SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), SPH_C32(0x98369604), + SPH_C32(0xf746c320) }, + { SPH_C32(0xd46a0000), SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), + SPH_C32(0x4a290000), SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), + SPH_C32(0x98369604), SPH_C32(0xf746c320), SPH_C32(0x231f0009), + SPH_C32(0x42f40000), SPH_C32(0x66790000), SPH_C32(0x4ebb0000), + SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), SPH_C32(0xe2b1674a), + SPH_C32(0x69505b3a) }, + { SPH_C32(0x231f0009), SPH_C32(0x42f40000), SPH_C32(0x66790000), + SPH_C32(0x4ebb0000), SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), + SPH_C32(0xe2b1674a), SPH_C32(0x69505b3a), SPH_C32(0xf7750009), + SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), SPH_C32(0x04920000), + SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), SPH_C32(0x7a87f14e), + SPH_C32(0x9e16981a) } +}; + +static const sph_u32 T512_14[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xf6800005), SPH_C32(0x3443c000), SPH_C32(0x24070000), + SPH_C32(0x8f3d0000), SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), + SPH_C32(0xcdc58b19), SPH_C32(0xd795ba31), SPH_C32(0xa67f0001), + SPH_C32(0x71378000), SPH_C32(0x19fc0000), SPH_C32(0x96db0000), + SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), SPH_C32(0x2c6d478f), + SPH_C32(0xac8e6c88) }, + { SPH_C32(0xa67f0001), SPH_C32(0x71378000), SPH_C32(0x19fc0000), + SPH_C32(0x96db0000), SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), + SPH_C32(0x2c6d478f), SPH_C32(0xac8e6c88), SPH_C32(0x50ff0004), + SPH_C32(0x45744000), SPH_C32(0x3dfb0000), SPH_C32(0x19e60000), + SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), SPH_C32(0xe1a8cc96), + SPH_C32(0x7b1bd6b9) }, + { SPH_C32(0x50ff0004), SPH_C32(0x45744000), SPH_C32(0x3dfb0000), + SPH_C32(0x19e60000), SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), + SPH_C32(0xe1a8cc96), SPH_C32(0x7b1bd6b9), SPH_C32(0xf6800005), + SPH_C32(0x3443c000), SPH_C32(0x24070000), SPH_C32(0x8f3d0000), + SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), SPH_C32(0xcdc58b19), + SPH_C32(0xd795ba31) } +}; + +static const sph_u32 T512_16[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x75c90003), SPH_C32(0x0e10c000), SPH_C32(0xd1200000), + SPH_C32(0xbaea0000), SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), + SPH_C32(0xbb28761d), SPH_C32(0x00b72e2b), SPH_C32(0xeecf0001), + SPH_C32(0x6f564000), SPH_C32(0xf33e0000), SPH_C32(0xa79e0000), + SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), SPH_C32(0x4a3b40ba), + SPH_C32(0xfeabf254) }, + { SPH_C32(0xeecf0001), SPH_C32(0x6f564000), SPH_C32(0xf33e0000), + SPH_C32(0xa79e0000), SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), + SPH_C32(0x4a3b40ba), SPH_C32(0xfeabf254), SPH_C32(0x9b060002), + SPH_C32(0x61468000), SPH_C32(0x221e0000), SPH_C32(0x1d740000), + SPH_C32(0x36715d27), SPH_C32(0x30495c92), SPH_C32(0xf11336a7), + SPH_C32(0xfe1cdc7f) }, + { SPH_C32(0x9b060002), SPH_C32(0x61468000), SPH_C32(0x221e0000), + SPH_C32(0x1d740000), SPH_C32(0x36715d27), SPH_C32(0x30495c92), + SPH_C32(0xf11336a7), SPH_C32(0xfe1cdc7f), SPH_C32(0x75c90003), + SPH_C32(0x0e10c000), SPH_C32(0xd1200000), SPH_C32(0xbaea0000), + SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), SPH_C32(0xbb28761d), + SPH_C32(0x00b72e2b) } +}; + +static const sph_u32 T512_18[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x75a40000), SPH_C32(0xc28b2700), SPH_C32(0x94a40000), + SPH_C32(0x90f50000), SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), + SPH_C32(0x1767c483), SPH_C32(0xaedf667e), SPH_C32(0xd1660000), + SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), SPH_C32(0xf6940000), + SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), SPH_C32(0xb4431b17), + SPH_C32(0x857f3c2b) }, + { SPH_C32(0xd1660000), SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), + SPH_C32(0xf6940000), SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), + SPH_C32(0xb4431b17), SPH_C32(0x857f3c2b), SPH_C32(0xa4c20000), + SPH_C32(0xd9372400), SPH_C32(0x0a480000), SPH_C32(0x66610000), + SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), SPH_C32(0xa324df94), + SPH_C32(0x2ba05a55) }, + { SPH_C32(0xa4c20000), SPH_C32(0xd9372400), SPH_C32(0x0a480000), + SPH_C32(0x66610000), SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), + SPH_C32(0xa324df94), SPH_C32(0x2ba05a55), SPH_C32(0x75a40000), + SPH_C32(0xc28b2700), SPH_C32(0x94a40000), SPH_C32(0x90f50000), + SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), SPH_C32(0x1767c483), + SPH_C32(0xaedf667e) } +}; + +static const sph_u32 T512_20[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x45180000), SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), + SPH_C32(0x3b480000), SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), + SPH_C32(0x16bca6b0), SPH_C32(0xdf33f4df), SPH_C32(0xb83d0000), + SPH_C32(0x16710600), SPH_C32(0x379a0000), SPH_C32(0xf5b10000), + SPH_C32(0x228161ac), SPH_C32(0xae48f145), SPH_C32(0x66241616), + SPH_C32(0xc5c1eb3e) }, + { SPH_C32(0xb83d0000), SPH_C32(0x16710600), SPH_C32(0x379a0000), + SPH_C32(0xf5b10000), SPH_C32(0x228161ac), SPH_C32(0xae48f145), + SPH_C32(0x66241616), SPH_C32(0xc5c1eb3e), SPH_C32(0xfd250000), + SPH_C32(0xb3c41100), SPH_C32(0xcef00000), SPH_C32(0xcef90000), + SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), SPH_C32(0x7098b0a6), + SPH_C32(0x1af21fe1) }, + { SPH_C32(0xfd250000), SPH_C32(0xb3c41100), SPH_C32(0xcef00000), + SPH_C32(0xcef90000), SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), + SPH_C32(0x7098b0a6), SPH_C32(0x1af21fe1), SPH_C32(0x45180000), + SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), SPH_C32(0x3b480000), + SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), SPH_C32(0x16bca6b0), + SPH_C32(0xdf33f4df) } +}; + +static const sph_u32 T512_22[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x0c720000), SPH_C32(0x49e50f00), SPH_C32(0x42790000), + SPH_C32(0x5cea0000), SPH_C32(0x33aa301a), SPH_C32(0x15822514), + SPH_C32(0x95a34b7b), SPH_C32(0xb44b0090), SPH_C32(0xfe220000), + SPH_C32(0xa7580500), SPH_C32(0x25d10000), SPH_C32(0xf7600000), + SPH_C32(0x893178da), SPH_C32(0x1fd4f860), SPH_C32(0x4ed0a315), + SPH_C32(0xa123ff9f) }, + { SPH_C32(0xfe220000), SPH_C32(0xa7580500), SPH_C32(0x25d10000), + SPH_C32(0xf7600000), SPH_C32(0x893178da), SPH_C32(0x1fd4f860), + SPH_C32(0x4ed0a315), SPH_C32(0xa123ff9f), SPH_C32(0xf2500000), + SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), SPH_C32(0xab8a0000), + SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), SPH_C32(0xdb73e86e), + SPH_C32(0x1568ff0f) }, + { SPH_C32(0xf2500000), SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), + SPH_C32(0xab8a0000), SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), + SPH_C32(0xdb73e86e), SPH_C32(0x1568ff0f), SPH_C32(0x0c720000), + SPH_C32(0x49e50f00), SPH_C32(0x42790000), SPH_C32(0x5cea0000), + SPH_C32(0x33aa301a), SPH_C32(0x15822514), SPH_C32(0x95a34b7b), + SPH_C32(0xb44b0090) } +}; + +static const sph_u32 T512_24[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x69510000), SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), + SPH_C32(0xac2f0000), SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), + SPH_C32(0x87ec287c), SPH_C32(0xbce1a3ce), SPH_C32(0xc6730000), + SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), SPH_C32(0x218d0000), + SPH_C32(0x23111587), SPH_C32(0x7913512f), SPH_C32(0x1d28ac88), + SPH_C32(0x378dd173) }, + { SPH_C32(0xc6730000), SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), + SPH_C32(0x218d0000), SPH_C32(0x23111587), SPH_C32(0x7913512f), + SPH_C32(0x1d28ac88), SPH_C32(0x378dd173), SPH_C32(0xaf220000), + SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), SPH_C32(0x8da20000), + SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), SPH_C32(0x9ac484f4), + SPH_C32(0x8b6c72bd) }, + { SPH_C32(0xaf220000), SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), + SPH_C32(0x8da20000), SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), + SPH_C32(0x9ac484f4), SPH_C32(0x8b6c72bd), SPH_C32(0x69510000), + SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), SPH_C32(0xac2f0000), + SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), SPH_C32(0x87ec287c), + SPH_C32(0xbce1a3ce) } +}; + +static const sph_u32 T512_26[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x54500000), SPH_C32(0x0671005c), SPH_C32(0x25ae0000), + SPH_C32(0x6a1e0000), SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), + SPH_C32(0xbfba18c3), SPH_C32(0x7e715d17), SPH_C32(0xbc8d0000), + SPH_C32(0xfc3b0018), SPH_C32(0x19830000), SPH_C32(0xd10b0000), + SPH_C32(0xae1878c4), SPH_C32(0x42a69856), SPH_C32(0x0012da37), + SPH_C32(0x2c3b504e) }, + { SPH_C32(0xbc8d0000), SPH_C32(0xfc3b0018), SPH_C32(0x19830000), + SPH_C32(0xd10b0000), SPH_C32(0xae1878c4), SPH_C32(0x42a69856), + SPH_C32(0x0012da37), SPH_C32(0x2c3b504e), SPH_C32(0xe8dd0000), + SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), SPH_C32(0xbb150000), + SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), SPH_C32(0xbfa8c2f4), + SPH_C32(0x524a0d59) }, + { SPH_C32(0xe8dd0000), SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), + SPH_C32(0xbb150000), SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), + SPH_C32(0xbfa8c2f4), SPH_C32(0x524a0d59), SPH_C32(0x54500000), + SPH_C32(0x0671005c), SPH_C32(0x25ae0000), SPH_C32(0x6a1e0000), + SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), SPH_C32(0xbfba18c3), + SPH_C32(0x7e715d17) } +}; + +static const sph_u32 T512_28[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x14190000), SPH_C32(0x23ca003c), SPH_C32(0x50df0000), + SPH_C32(0x44b60000), SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), + SPH_C32(0x61e610b0), SPH_C32(0xdbcadb80), SPH_C32(0xe3430000), + SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), SPH_C32(0xaa4e0000), + SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), SPH_C32(0x123db156), + SPH_C32(0x3a4e99d7) }, + { SPH_C32(0xe3430000), SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), + SPH_C32(0xaa4e0000), SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), + SPH_C32(0x123db156), SPH_C32(0x3a4e99d7), SPH_C32(0xf75a0000), + SPH_C32(0x19840028), SPH_C32(0xa2190000), SPH_C32(0xeef80000), + SPH_C32(0xc0722516), SPH_C32(0x19981260), SPH_C32(0x73dba1e6), + SPH_C32(0xe1844257) }, + { SPH_C32(0xf75a0000), SPH_C32(0x19840028), SPH_C32(0xa2190000), + SPH_C32(0xeef80000), SPH_C32(0xc0722516), SPH_C32(0x19981260), + SPH_C32(0x73dba1e6), SPH_C32(0xe1844257), SPH_C32(0x14190000), + SPH_C32(0x23ca003c), SPH_C32(0x50df0000), SPH_C32(0x44b60000), + SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), SPH_C32(0x61e610b0), + SPH_C32(0xdbcadb80) } +}; + +static const sph_u32 T512_30[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x86790000), SPH_C32(0x3f390002), SPH_C32(0xe19ae000), + SPH_C32(0x98560000), SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), + SPH_C32(0xd3dd4944), SPH_C32(0x161ddab9), SPH_C32(0x30b70000), + SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), SPH_C32(0x42c40000), + SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), SPH_C32(0x21afa1ea), + SPH_C32(0xb0a51834) }, + { SPH_C32(0x30b70000), SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), + SPH_C32(0x42c40000), SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), + SPH_C32(0x21afa1ea), SPH_C32(0xb0a51834), SPH_C32(0xb6ce0000), + SPH_C32(0xdae90002), SPH_C32(0x156e8000), SPH_C32(0xda920000), + SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), SPH_C32(0xf272e8ae), + SPH_C32(0xa6b8c28d) }, + { SPH_C32(0xb6ce0000), SPH_C32(0xdae90002), SPH_C32(0x156e8000), + SPH_C32(0xda920000), SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), + SPH_C32(0xf272e8ae), SPH_C32(0xa6b8c28d), SPH_C32(0x86790000), + SPH_C32(0x3f390002), SPH_C32(0xe19ae000), SPH_C32(0x98560000), + SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), SPH_C32(0xd3dd4944), + SPH_C32(0x161ddab9) } +}; + +static const sph_u32 T512_32[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xaec30000), SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), + SPH_C32(0x2c150000), SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), + SPH_C32(0xab92f78f), SPH_C32(0xa312567b), SPH_C32(0xdb250000), + SPH_C32(0x09290000), SPH_C32(0x49aac000), SPH_C32(0x81e10000), + SPH_C32(0xcafe6b59), SPH_C32(0x42793431), SPH_C32(0x43566b76), + SPH_C32(0xe86cba2e) }, + { SPH_C32(0xdb250000), SPH_C32(0x09290000), SPH_C32(0x49aac000), + SPH_C32(0x81e10000), SPH_C32(0xcafe6b59), SPH_C32(0x42793431), + SPH_C32(0x43566b76), SPH_C32(0xe86cba2e), SPH_C32(0x75e60000), + SPH_C32(0x95660001), SPH_C32(0x307b2000), SPH_C32(0xadf40000), + SPH_C32(0x8f321eea), SPH_C32(0x24298307), SPH_C32(0xe8c49cf9), + SPH_C32(0x4b7eec55) }, + { SPH_C32(0x75e60000), SPH_C32(0x95660001), SPH_C32(0x307b2000), + SPH_C32(0xadf40000), SPH_C32(0x8f321eea), SPH_C32(0x24298307), + SPH_C32(0xe8c49cf9), SPH_C32(0x4b7eec55), SPH_C32(0xaec30000), + SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), SPH_C32(0x2c150000), + SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), SPH_C32(0xab92f78f), + SPH_C32(0xa312567b) } +}; + +static const sph_u32 T512_34[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xac480000), SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), + SPH_C32(0x03430000), SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), + SPH_C32(0xfe72c7fe), SPH_C32(0x91e478f6), SPH_C32(0x1e4e0000), + SPH_C32(0xdecf0000), SPH_C32(0x6df80180), SPH_C32(0x77240000), + SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), SPH_C32(0xcda31812), + SPH_C32(0x98aa496e) }, + { SPH_C32(0x1e4e0000), SPH_C32(0xdecf0000), SPH_C32(0x6df80180), + SPH_C32(0x77240000), SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), + SPH_C32(0xcda31812), SPH_C32(0x98aa496e), SPH_C32(0xb2060000), + SPH_C32(0xc5690000), SPH_C32(0x28031200), SPH_C32(0x74670000), + SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), SPH_C32(0x33d1dfec), + SPH_C32(0x094e3198) }, + { SPH_C32(0xb2060000), SPH_C32(0xc5690000), SPH_C32(0x28031200), + SPH_C32(0x74670000), SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), + SPH_C32(0x33d1dfec), SPH_C32(0x094e3198), SPH_C32(0xac480000), + SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), SPH_C32(0x03430000), + SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), SPH_C32(0xfe72c7fe), + SPH_C32(0x91e478f6) } +}; + +static const sph_u32 T512_36[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x78230000), SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), + SPH_C32(0x90a50000), SPH_C32(0x713e2879), SPH_C32(0x7ee98924), + SPH_C32(0xf08ca062), SPH_C32(0x636f8bab), SPH_C32(0x02af0000), + SPH_C32(0xb7280000), SPH_C32(0xba1c0300), SPH_C32(0x56980000), + SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), SPH_C32(0xa95c149a), + SPH_C32(0xf4f6ea7b) }, + { SPH_C32(0x02af0000), SPH_C32(0xb7280000), SPH_C32(0xba1c0300), + SPH_C32(0x56980000), SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), + SPH_C32(0xa95c149a), SPH_C32(0xf4f6ea7b), SPH_C32(0x7a8c0000), + SPH_C32(0xa5d40000), SPH_C32(0x13260880), SPH_C32(0xc63d0000), + SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), SPH_C32(0x59d0b4f8), + SPH_C32(0x979961d0) }, + { SPH_C32(0x7a8c0000), SPH_C32(0xa5d40000), SPH_C32(0x13260880), + SPH_C32(0xc63d0000), SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), + SPH_C32(0x59d0b4f8), SPH_C32(0x979961d0), SPH_C32(0x78230000), + SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), SPH_C32(0x90a50000), + SPH_C32(0x713e2879), SPH_C32(0x7ee98924), SPH_C32(0xf08ca062), + SPH_C32(0x636f8bab) } +}; + +static const sph_u32 T512_38[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xcc140000), SPH_C32(0xa5630000), SPH_C32(0x5ab90780), + SPH_C32(0x3b500000), SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), + SPH_C32(0x694348c1), SPH_C32(0xca5a87fe), SPH_C32(0x819e0000), + SPH_C32(0xec570000), SPH_C32(0x66320280), SPH_C32(0x95f30000), + SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), SPH_C32(0xe65aa22d), + SPH_C32(0x8e67b7fa) }, + { SPH_C32(0x819e0000), SPH_C32(0xec570000), SPH_C32(0x66320280), + SPH_C32(0x95f30000), SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), + SPH_C32(0xe65aa22d), SPH_C32(0x8e67b7fa), SPH_C32(0x4d8a0000), + SPH_C32(0x49340000), SPH_C32(0x3c8b0500), SPH_C32(0xaea30000), + SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), SPH_C32(0x8f19eaec), + SPH_C32(0x443d3004) }, + { SPH_C32(0x4d8a0000), SPH_C32(0x49340000), SPH_C32(0x3c8b0500), + SPH_C32(0xaea30000), SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), + SPH_C32(0x8f19eaec), SPH_C32(0x443d3004), SPH_C32(0xcc140000), + SPH_C32(0xa5630000), SPH_C32(0x5ab90780), SPH_C32(0x3b500000), + SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), SPH_C32(0x694348c1), + SPH_C32(0xca5a87fe) } +}; + +static const sph_u32 T512_40[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x52500000), SPH_C32(0x29540000), SPH_C32(0x6a61004e), + SPH_C32(0xf0ff0000), SPH_C32(0x9a317eec), SPH_C32(0x452341ce), + SPH_C32(0xcf568fe5), SPH_C32(0x5303130f), SPH_C32(0x538d0000), + SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), SPH_C32(0x56ff0000), + SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), SPH_C32(0xa9444018), + SPH_C32(0x7f975691) }, + { SPH_C32(0x538d0000), SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), + SPH_C32(0x56ff0000), SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), + SPH_C32(0xa9444018), SPH_C32(0x7f975691), SPH_C32(0x01dd0000), + SPH_C32(0x80a80000), SPH_C32(0xf4960048), SPH_C32(0xa6000000), + SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), SPH_C32(0x6612cffd), + SPH_C32(0x2c94459e) }, + { SPH_C32(0x01dd0000), SPH_C32(0x80a80000), SPH_C32(0xf4960048), + SPH_C32(0xa6000000), SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), + SPH_C32(0x6612cffd), SPH_C32(0x2c94459e), SPH_C32(0x52500000), + SPH_C32(0x29540000), SPH_C32(0x6a61004e), SPH_C32(0xf0ff0000), + SPH_C32(0x9a317eec), SPH_C32(0x452341ce), SPH_C32(0xcf568fe5), + SPH_C32(0x5303130f) } +}; + +static const sph_u32 T512_42[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x88980000), SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), + SPH_C32(0xfb4e0000), SPH_C32(0xf158079a), SPH_C32(0x61ae9167), + SPH_C32(0xa895706c), SPH_C32(0xe6107494), SPH_C32(0x0bc20000), + SPH_C32(0xdb630000), SPH_C32(0x7e88000c), SPH_C32(0x15860000), + SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), SPH_C32(0xf460449e), + SPH_C32(0xd8b61463) }, + { SPH_C32(0x0bc20000), SPH_C32(0xdb630000), SPH_C32(0x7e88000c), + SPH_C32(0x15860000), SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), + SPH_C32(0xf460449e), SPH_C32(0xd8b61463), SPH_C32(0x835a0000), + SPH_C32(0xc4f70000), SPH_C32(0x01470022), SPH_C32(0xeec80000), + SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), SPH_C32(0x5cf534f2), + SPH_C32(0x3ea660f7) }, + { SPH_C32(0x835a0000), SPH_C32(0xc4f70000), SPH_C32(0x01470022), + SPH_C32(0xeec80000), SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), + SPH_C32(0x5cf534f2), SPH_C32(0x3ea660f7), SPH_C32(0x88980000), + SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), SPH_C32(0xfb4e0000), + SPH_C32(0xf158079a), SPH_C32(0x61ae9167), SPH_C32(0xa895706c), + SPH_C32(0xe6107494) } +}; + +static const sph_u32 T512_44[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xa53b0000), SPH_C32(0x14260000), SPH_C32(0x4e30001e), + SPH_C32(0x7cae0000), SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), + SPH_C32(0xf73168d8), SPH_C32(0x0b1b4946), SPH_C32(0x07ed0000), + SPH_C32(0xb2500000), SPH_C32(0x8774000a), SPH_C32(0x970d0000), + SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), SPH_C32(0xf4786222), + SPH_C32(0x9075b1ce) }, + { SPH_C32(0x07ed0000), SPH_C32(0xb2500000), SPH_C32(0x8774000a), + SPH_C32(0x970d0000), SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), + SPH_C32(0xf4786222), SPH_C32(0x9075b1ce), SPH_C32(0xa2d60000), + SPH_C32(0xa6760000), SPH_C32(0xc9440014), SPH_C32(0xeba30000), + SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), SPH_C32(0x03490afa), + SPH_C32(0x9b6ef888) }, + { SPH_C32(0xa2d60000), SPH_C32(0xa6760000), SPH_C32(0xc9440014), + SPH_C32(0xeba30000), SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), + SPH_C32(0x03490afa), SPH_C32(0x9b6ef888), SPH_C32(0xa53b0000), + SPH_C32(0x14260000), SPH_C32(0x4e30001e), SPH_C32(0x7cae0000), + SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), SPH_C32(0xf73168d8), + SPH_C32(0x0b1b4946) } +}; + +static const sph_u32 T512_46[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x58430000), SPH_C32(0x807e0000), SPH_C32(0x78330001), + SPH_C32(0xc66b3800), SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), + SPH_C32(0xac73fe6f), SPH_C32(0x3a4479b1), SPH_C32(0x1d5a0000), + SPH_C32(0x2b720000), SPH_C32(0x488d0000), SPH_C32(0xaf611800), + SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), SPH_C32(0x81a20429), + SPH_C32(0x1e7536a6) }, + { SPH_C32(0x1d5a0000), SPH_C32(0x2b720000), SPH_C32(0x488d0000), + SPH_C32(0xaf611800), SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), + SPH_C32(0x81a20429), SPH_C32(0x1e7536a6), SPH_C32(0x45190000), + SPH_C32(0xab0c0000), SPH_C32(0x30be0001), SPH_C32(0x690a2000), + SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), SPH_C32(0x2dd1fa46), + SPH_C32(0x24314f17) }, + { SPH_C32(0x45190000), SPH_C32(0xab0c0000), SPH_C32(0x30be0001), + SPH_C32(0x690a2000), SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), + SPH_C32(0x2dd1fa46), SPH_C32(0x24314f17), SPH_C32(0x58430000), + SPH_C32(0x807e0000), SPH_C32(0x78330001), SPH_C32(0xc66b3800), + SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), SPH_C32(0xac73fe6f), + SPH_C32(0x3a4479b1) } +}; + +static const sph_u32 T512_48[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x1e6c0000), SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), + SPH_C32(0xbcb6b800), SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), + SPH_C32(0x6a0c1bc8), SPH_C32(0xb99dc2eb), SPH_C32(0x92560000), + SPH_C32(0x1eda0000), SPH_C32(0xea510000), SPH_C32(0xe8b13000), + SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), SPH_C32(0xb15c2254), + SPH_C32(0x33c5244f) }, + { SPH_C32(0x92560000), SPH_C32(0x1eda0000), SPH_C32(0xea510000), + SPH_C32(0xe8b13000), SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), + SPH_C32(0xb15c2254), SPH_C32(0x33c5244f), SPH_C32(0x8c3a0000), + SPH_C32(0xda980000), SPH_C32(0x607f0000), SPH_C32(0x54078800), + SPH_C32(0x85714513), SPH_C32(0x6006b243), SPH_C32(0xdb50399c), + SPH_C32(0x8a58e6a4) }, + { SPH_C32(0x8c3a0000), SPH_C32(0xda980000), SPH_C32(0x607f0000), + SPH_C32(0x54078800), SPH_C32(0x85714513), SPH_C32(0x6006b243), + SPH_C32(0xdb50399c), SPH_C32(0x8a58e6a4), SPH_C32(0x1e6c0000), + SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), SPH_C32(0xbcb6b800), + SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), SPH_C32(0x6a0c1bc8), + SPH_C32(0xb99dc2eb) } +}; + +static const sph_u32 T512_50[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x02f20000), SPH_C32(0xa2810000), SPH_C32(0x873f0000), + SPH_C32(0xe36c7800), SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), + SPH_C32(0xc4c23237), SPH_C32(0x7f32259e), SPH_C32(0xbadd0000), + SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), SPH_C32(0xf7282800), + SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), SPH_C32(0xea5a8d14), + SPH_C32(0x2a2c18f0) }, + { SPH_C32(0xbadd0000), SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), + SPH_C32(0xf7282800), SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), + SPH_C32(0xea5a8d14), SPH_C32(0x2a2c18f0), SPH_C32(0xb82f0000), + SPH_C32(0xb12c0000), SPH_C32(0x30d80000), SPH_C32(0x14445000), + SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), SPH_C32(0x2e98bf23), + SPH_C32(0x551e3d6e) }, + { SPH_C32(0xb82f0000), SPH_C32(0xb12c0000), SPH_C32(0x30d80000), + SPH_C32(0x14445000), SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), + SPH_C32(0x2e98bf23), SPH_C32(0x551e3d6e), SPH_C32(0x02f20000), + SPH_C32(0xa2810000), SPH_C32(0x873f0000), SPH_C32(0xe36c7800), + SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), SPH_C32(0xc4c23237), + SPH_C32(0x7f32259e) } +}; + +static const sph_u32 T512_52[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xb4310000), SPH_C32(0x77330000), SPH_C32(0xb15d0000), + SPH_C32(0x7fd004e0), SPH_C32(0x78a26138), SPH_C32(0xd116c35d), + SPH_C32(0xd256d489), SPH_C32(0x4e6f74de), SPH_C32(0xe3060000), + SPH_C32(0xbdc10000), SPH_C32(0x87130000), SPH_C32(0xbff20060), + SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), SPH_C32(0x73c5ab06), + SPH_C32(0x5bd61539) }, + { SPH_C32(0xe3060000), SPH_C32(0xbdc10000), SPH_C32(0x87130000), + SPH_C32(0xbff20060), SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), + SPH_C32(0x73c5ab06), SPH_C32(0x5bd61539), SPH_C32(0x57370000), + SPH_C32(0xcaf20000), SPH_C32(0x364e0000), SPH_C32(0xc0220480), + SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), SPH_C32(0xa1937f8f), + SPH_C32(0x15b961e7) }, + { SPH_C32(0x57370000), SPH_C32(0xcaf20000), SPH_C32(0x364e0000), + SPH_C32(0xc0220480), SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), + SPH_C32(0xa1937f8f), SPH_C32(0x15b961e7), SPH_C32(0xb4310000), + SPH_C32(0x77330000), SPH_C32(0xb15d0000), SPH_C32(0x7fd004e0), + SPH_C32(0x78a26138), SPH_C32(0xd116c35d), SPH_C32(0xd256d489), + SPH_C32(0x4e6f74de) } +}; + +static const sph_u32 T512_54[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xe6280000), SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), + SPH_C32(0xd3d002e0), SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), + SPH_C32(0x289506b4), SPH_C32(0xd75a4897), SPH_C32(0xf0c50000), + SPH_C32(0x59230000), SPH_C32(0x45820000), SPH_C32(0xe18d00c0), + SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), SPH_C32(0xcbe0fe1c), + SPH_C32(0x56a7b19f) }, + { SPH_C32(0xf0c50000), SPH_C32(0x59230000), SPH_C32(0x45820000), + SPH_C32(0xe18d00c0), SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), + SPH_C32(0xcbe0fe1c), SPH_C32(0x56a7b19f), SPH_C32(0x16ed0000), + SPH_C32(0x15680000), SPH_C32(0xedd70000), SPH_C32(0x325d0220), + SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), SPH_C32(0xe375f8a8), + SPH_C32(0x81fdf908) }, + { SPH_C32(0x16ed0000), SPH_C32(0x15680000), SPH_C32(0xedd70000), + SPH_C32(0x325d0220), SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), + SPH_C32(0xe375f8a8), SPH_C32(0x81fdf908), SPH_C32(0xe6280000), + SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), SPH_C32(0xd3d002e0), + SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), SPH_C32(0x289506b4), + SPH_C32(0xd75a4897) } +}; + +static const sph_u32 T512_56[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xee930000), SPH_C32(0xd6070000), SPH_C32(0x92c10000), + SPH_C32(0x2b9801e0), SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), + SPH_C32(0x45312374), SPH_C32(0x201f6a64), SPH_C32(0x7b280000), + SPH_C32(0x57420000), SPH_C32(0xa9e50000), SPH_C32(0x634300a0), + SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), SPH_C32(0x27f83b03), + SPH_C32(0xc7ff60f0) }, + { SPH_C32(0x7b280000), SPH_C32(0x57420000), SPH_C32(0xa9e50000), + SPH_C32(0x634300a0), SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), + SPH_C32(0x27f83b03), SPH_C32(0xc7ff60f0), SPH_C32(0x95bb0000), + SPH_C32(0x81450000), SPH_C32(0x3b240000), SPH_C32(0x48db0140), + SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), SPH_C32(0x62c91877), + SPH_C32(0xe7e00a94) }, + { SPH_C32(0x95bb0000), SPH_C32(0x81450000), SPH_C32(0x3b240000), + SPH_C32(0x48db0140), SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), + SPH_C32(0x62c91877), SPH_C32(0xe7e00a94), SPH_C32(0xee930000), + SPH_C32(0xd6070000), SPH_C32(0x92c10000), SPH_C32(0x2b9801e0), + SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), SPH_C32(0x45312374), + SPH_C32(0x201f6a64) } +}; + +static const sph_u32 T512_58[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x5fa80000), SPH_C32(0x56030000), SPH_C32(0x43ae0000), + SPH_C32(0x64f30013), SPH_C32(0x257e86bf), SPH_C32(0x1311944e), + SPH_C32(0x541e95bf), SPH_C32(0x8ea4db69), SPH_C32(0x00440000), + SPH_C32(0x7f480000), SPH_C32(0xda7c0000), SPH_C32(0x2a230001), + SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), SPH_C32(0x030a9e60), + SPH_C32(0xbe0a679e) }, + { SPH_C32(0x00440000), SPH_C32(0x7f480000), SPH_C32(0xda7c0000), + SPH_C32(0x2a230001), SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), + SPH_C32(0x030a9e60), SPH_C32(0xbe0a679e), SPH_C32(0x5fec0000), + SPH_C32(0x294b0000), SPH_C32(0x99d20000), SPH_C32(0x4ed00012), + SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), SPH_C32(0x57140bdf), + SPH_C32(0x30aebcf7) }, + { SPH_C32(0x5fec0000), SPH_C32(0x294b0000), SPH_C32(0x99d20000), + SPH_C32(0x4ed00012), SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), + SPH_C32(0x57140bdf), SPH_C32(0x30aebcf7), SPH_C32(0x5fa80000), + SPH_C32(0x56030000), SPH_C32(0x43ae0000), SPH_C32(0x64f30013), + SPH_C32(0x257e86bf), SPH_C32(0x1311944e), SPH_C32(0x541e95bf), + SPH_C32(0x8ea4db69) } +}; + +static const sph_u32 T512_60[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x01930000), SPH_C32(0xe7820000), SPH_C32(0xedfb0000), + SPH_C32(0xcf0c000b), SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), + SPH_C32(0x063661e1), SPH_C32(0x536f9e7b), SPH_C32(0x92280000), + SPH_C32(0xdc850000), SPH_C32(0x57fa0000), SPH_C32(0x56dc0003), + SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), SPH_C32(0x90cef752), + SPH_C32(0x7b1675d7) }, + { SPH_C32(0x92280000), SPH_C32(0xdc850000), SPH_C32(0x57fa0000), + SPH_C32(0x56dc0003), SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), + SPH_C32(0x90cef752), SPH_C32(0x7b1675d7), SPH_C32(0x93bb0000), + SPH_C32(0x3b070000), SPH_C32(0xba010000), SPH_C32(0x99d00008), + SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), SPH_C32(0x96f896b3), + SPH_C32(0x2879ebac) }, + { SPH_C32(0x93bb0000), SPH_C32(0x3b070000), SPH_C32(0xba010000), + SPH_C32(0x99d00008), SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), + SPH_C32(0x96f896b3), SPH_C32(0x2879ebac), SPH_C32(0x01930000), + SPH_C32(0xe7820000), SPH_C32(0xedfb0000), SPH_C32(0xcf0c000b), + SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), SPH_C32(0x063661e1), + SPH_C32(0x536f9e7b) } +}; + +static const sph_u32 T512_62[4][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x033d0000), SPH_C32(0x08b30000), SPH_C32(0xf33a0000), + SPH_C32(0x3ac20007), SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), + SPH_C32(0x0ea5cfe3), SPH_C32(0xe6da7ffe), SPH_C32(0xa8da0000), + SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), SPH_C32(0x07da0002), + SPH_C32(0x7d669583), SPH_C32(0x1f98708a), SPH_C32(0xbb668808), + SPH_C32(0xda878000) }, + { SPH_C32(0xa8da0000), SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), + SPH_C32(0x07da0002), SPH_C32(0x7d669583), SPH_C32(0x1f98708a), + SPH_C32(0xbb668808), SPH_C32(0xda878000), SPH_C32(0xabe70000), + SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), SPH_C32(0x3d180005), + SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), SPH_C32(0xb5c347eb), + SPH_C32(0x3c5dfffe) }, + { SPH_C32(0xabe70000), SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), + SPH_C32(0x3d180005), SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), + SPH_C32(0xb5c347eb), SPH_C32(0x3c5dfffe), SPH_C32(0x033d0000), + SPH_C32(0x08b30000), SPH_C32(0xf33a0000), SPH_C32(0x3ac20007), + SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), SPH_C32(0x0ea5cfe3), + SPH_C32(0xe6da7ffe) } +}; + +#define INPUT_BIG do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T512_0[acc >> 6][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + m8 = rp[8]; \ + m9 = rp[9]; \ + mA = rp[10]; \ + mB = rp[11]; \ + mC = rp[12]; \ + mD = rp[13]; \ + mE = rp[14]; \ + mF = rp[15]; \ + rp = &T512_2[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_4[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_6[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[1]; \ + rp = &T512_8[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_10[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_12[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_14[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[2]; \ + rp = &T512_16[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_18[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_20[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_22[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[3]; \ + rp = &T512_24[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_26[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_28[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_30[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[4]; \ + rp = &T512_32[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_34[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_36[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_38[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[5]; \ + rp = &T512_40[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_42[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_44[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_46[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[6]; \ + rp = &T512_48[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_50[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_52[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_54[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[7]; \ + rp = &T512_56[acc >> 6][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_58[(acc >> 4) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_60[(acc >> 2) & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_62[acc & 0x03][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_BIG == 3 + +static const sph_u32 T512_0[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x9cbb1800), SPH_C32(0xb0d30000), SPH_C32(0x92510000), + SPH_C32(0xed930000), SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), + SPH_C32(0x430633da), SPH_C32(0x78cace29), SPH_C32(0xc8934400), + SPH_C32(0x5a3e0000), SPH_C32(0x57870000), SPH_C32(0x4c560000), + SPH_C32(0xea982435), SPH_C32(0x75b11115), SPH_C32(0x28b67247), + SPH_C32(0x2dd1f9ab) }, + { SPH_C32(0x29449c00), SPH_C32(0x64e70000), SPH_C32(0xf24b0000), + SPH_C32(0xc2f30000), SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), + SPH_C32(0xf3e04259), SPH_C32(0x8d0d9ec4), SPH_C32(0x466d0c00), + SPH_C32(0x08620000), SPH_C32(0xdd5d0000), SPH_C32(0xbadd0000), + SPH_C32(0x6a927942), SPH_C32(0x441f2b93), SPH_C32(0x218ace6f), + SPH_C32(0xbf2c0be2) }, + { SPH_C32(0xb5ff8400), SPH_C32(0xd4340000), SPH_C32(0x601a0000), + SPH_C32(0x2f600000), SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), + SPH_C32(0xb0e67183), SPH_C32(0xf5c750ed), SPH_C32(0x8efe4800), + SPH_C32(0x525c0000), SPH_C32(0x8ada0000), SPH_C32(0xf68b0000), + SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), SPH_C32(0x093cbc28), + SPH_C32(0x92fdf249) }, + { SPH_C32(0x466d0c00), SPH_C32(0x08620000), SPH_C32(0xdd5d0000), + SPH_C32(0xbadd0000), SPH_C32(0x6a927942), SPH_C32(0x441f2b93), + SPH_C32(0x218ace6f), SPH_C32(0xbf2c0be2), SPH_C32(0x6f299000), + SPH_C32(0x6c850000), SPH_C32(0x2f160000), SPH_C32(0x782e0000), + SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), SPH_C32(0xd26a8c36), + SPH_C32(0x32219526) }, + { SPH_C32(0xdad61400), SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), + SPH_C32(0x574e0000), SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), + SPH_C32(0x628cfdb5), SPH_C32(0xc7e6c5cb), SPH_C32(0xa7bad400), + SPH_C32(0x36bb0000), SPH_C32(0x78910000), SPH_C32(0x34780000), + SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), SPH_C32(0xfadcfe71), + SPH_C32(0x1ff06c8d) }, + { SPH_C32(0x6f299000), SPH_C32(0x6c850000), SPH_C32(0x2f160000), + SPH_C32(0x782e0000), SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), + SPH_C32(0xd26a8c36), SPH_C32(0x32219526), SPH_C32(0x29449c00), + SPH_C32(0x64e70000), SPH_C32(0xf24b0000), SPH_C32(0xc2f30000), + SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), SPH_C32(0xf3e04259), + SPH_C32(0x8d0d9ec4) }, + { SPH_C32(0xf3928800), SPH_C32(0xdc560000), SPH_C32(0xbd470000), + SPH_C32(0x95bd0000), SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), + SPH_C32(0x916cbfec), SPH_C32(0x4aeb5b0f), SPH_C32(0xe1d7d800), + SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), SPH_C32(0x8ea50000), + SPH_C32(0xe4466aba), SPH_C32(0x23732650), SPH_C32(0xdb56301e), + SPH_C32(0xa0dc676f) } +}; + +static const sph_u32 T512_3[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x145a3c00), SPH_C32(0xb9e90000), SPH_C32(0x61270000), + SPH_C32(0xf1610000), SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), + SPH_C32(0x47a96720), SPH_C32(0xe18e24c5), SPH_C32(0x23671400), + SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), SPH_C32(0xfb750000), + SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), SPH_C32(0x02c40a3f), + SPH_C32(0xdc24e61f) }, + { SPH_C32(0x23671400), SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), + SPH_C32(0xfb750000), SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), + SPH_C32(0x02c40a3f), SPH_C32(0xdc24e61f), SPH_C32(0x373d2800), + SPH_C32(0x71500000), SPH_C32(0x95e00000), SPH_C32(0x0a140000), + SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), SPH_C32(0x456d6d1f), + SPH_C32(0x3daac2da) }, + { SPH_C32(0x373d2800), SPH_C32(0x71500000), SPH_C32(0x95e00000), + SPH_C32(0x0a140000), SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), + SPH_C32(0x456d6d1f), SPH_C32(0x3daac2da), SPH_C32(0x145a3c00), + SPH_C32(0xb9e90000), SPH_C32(0x61270000), SPH_C32(0xf1610000), + SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), SPH_C32(0x47a96720), + SPH_C32(0xe18e24c5) }, + { SPH_C32(0x54285c00), SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), + SPH_C32(0xa1c50000), SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), + SPH_C32(0x6bb0419d), SPH_C32(0x551b3782), SPH_C32(0x9cbb1800), + SPH_C32(0xb0d30000), SPH_C32(0x92510000), SPH_C32(0xed930000), + SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), SPH_C32(0x430633da), + SPH_C32(0x78cace29) }, + { SPH_C32(0x40726000), SPH_C32(0x53040000), SPH_C32(0xa4f10000), + SPH_C32(0x50a40000), SPH_C32(0x7dc35a1c), SPH_C32(0x24ecf999), + SPH_C32(0x2c1926bd), SPH_C32(0xb4951347), SPH_C32(0xbfdc0c00), + SPH_C32(0x786a0000), SPH_C32(0x66960000), SPH_C32(0x16e60000), + SPH_C32(0x2af76720), SPH_C32(0x19b270bd), SPH_C32(0x41c239e5), + SPH_C32(0xa4ee2836) }, + { SPH_C32(0x774f4800), SPH_C32(0x22540000), SPH_C32(0x31110000), + SPH_C32(0x5ab00000), SPH_C32(0xc06f4315), SPH_C32(0x6c0361a8), + SPH_C32(0x69744ba2), SPH_C32(0x893fd19d), SPH_C32(0xab863000), + SPH_C32(0xc1830000), SPH_C32(0x07b10000), SPH_C32(0xe7870000), + SPH_C32(0xe4965a4c), SPH_C32(0xa9fb4dc5), SPH_C32(0x066b5ec5), + SPH_C32(0x45600cf3) }, + { SPH_C32(0x63157400), SPH_C32(0x9bbd0000), SPH_C32(0x50360000), + SPH_C32(0xabd10000), SPH_C32(0x0e0e7e79), SPH_C32(0xdc4a5cd0), + SPH_C32(0x2edd2c82), SPH_C32(0x68b1f558), SPH_C32(0x88e12400), + SPH_C32(0x093a0000), SPH_C32(0xf3760000), SPH_C32(0x1cf20000), + SPH_C32(0x975b7e29), SPH_C32(0x515de88c), SPH_C32(0x04af54fa), + SPH_C32(0x9944eaec) } +}; + +static const sph_u32 T512_6[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xb4370060), SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), + SPH_C32(0x5cae0000), SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), + SPH_C32(0x1b365f3d), SPH_C32(0xf3d45758), SPH_C32(0x5cb00110), + SPH_C32(0x913e0000), SPH_C32(0x44190000), SPH_C32(0x888c0000), + SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), SPH_C32(0x55ceea25), + SPH_C32(0x925c44e9) }, + { SPH_C32(0xef0b0270), SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), + SPH_C32(0x69490000), SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), + SPH_C32(0x66140a51), SPH_C32(0x924f5d0a), SPH_C32(0xc96b0030), + SPH_C32(0xe7250000), SPH_C32(0x2f840000), SPH_C32(0x264f0000), + SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), SPH_C32(0x509f6984), + SPH_C32(0x9e69af68) }, + { SPH_C32(0x5b3c0210), SPH_C32(0x36b10000), SPH_C32(0x0b6c0000), + SPH_C32(0x35e70000), SPH_C32(0x0f5b2339), SPH_C32(0x7f3b4ddc), + SPH_C32(0x7d22556c), SPH_C32(0x619b0a52), SPH_C32(0x95db0120), + SPH_C32(0x761b0000), SPH_C32(0x6b9d0000), SPH_C32(0xaec30000), + SPH_C32(0x6eb52fe1), SPH_C32(0xffe3ec51), SPH_C32(0x055183a1), + SPH_C32(0x0c35eb81) }, + { SPH_C32(0xc96b0030), SPH_C32(0xe7250000), SPH_C32(0x2f840000), + SPH_C32(0x264f0000), SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), + SPH_C32(0x509f6984), SPH_C32(0x9e69af68), SPH_C32(0x26600240), + SPH_C32(0xddd80000), SPH_C32(0x722a0000), SPH_C32(0x4f060000), + SPH_C32(0x936667ff), SPH_C32(0x29f944ce), SPH_C32(0x368b63d5), + SPH_C32(0x0c26f262) }, + { SPH_C32(0x7d5c0050), SPH_C32(0xeb690000), SPH_C32(0x79460000), + SPH_C32(0x7ae10000), SPH_C32(0x9c3d44c6), SPH_C32(0x56c20912), + SPH_C32(0x4ba936b9), SPH_C32(0x6dbdf830), SPH_C32(0x7ad00350), + SPH_C32(0x4ce60000), SPH_C32(0x36330000), SPH_C32(0xc78a0000), + SPH_C32(0xf5ba13e7), SPH_C32(0xbbe659a8), SPH_C32(0x634589f0), + SPH_C32(0x9e7ab68b) }, + { SPH_C32(0x26600240), SPH_C32(0xddd80000), SPH_C32(0x722a0000), + SPH_C32(0x4f060000), SPH_C32(0x936667ff), SPH_C32(0x29f944ce), + SPH_C32(0x368b63d5), SPH_C32(0x0c26f262), SPH_C32(0xef0b0270), + SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), SPH_C32(0x69490000), + SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), SPH_C32(0x66140a51), + SPH_C32(0x924f5d0a) }, + { SPH_C32(0x92570220), SPH_C32(0xd1940000), SPH_C32(0x24e80000), + SPH_C32(0x13a80000), SPH_C32(0x073278c0), SPH_C32(0x12c7bceb), + SPH_C32(0x2dbd3ce8), SPH_C32(0xfff2a53a), SPH_C32(0xb3bb0360), + SPH_C32(0xabc30000), SPH_C32(0x19b70000), SPH_C32(0xe1c50000), + SPH_C32(0xfdd3481e), SPH_C32(0xd61aa89f), SPH_C32(0x33dae074), + SPH_C32(0x001319e3) } +}; + +static const sph_u32 T512_9[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x774400f0), SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), + SPH_C32(0x34140000), SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), + SPH_C32(0x0bc3cd1e), SPH_C32(0xcf3775cb), SPH_C32(0xf46c0050), + SPH_C32(0x96180000), SPH_C32(0x14a50000), SPH_C32(0x031f0000), + SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), SPH_C32(0x9ca470d2), + SPH_C32(0x8a341574) }, + { SPH_C32(0xf46c0050), SPH_C32(0x96180000), SPH_C32(0x14a50000), + SPH_C32(0x031f0000), SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), + SPH_C32(0x9ca470d2), SPH_C32(0x8a341574), SPH_C32(0x832800a0), + SPH_C32(0x67420000), SPH_C32(0xe1170000), SPH_C32(0x370b0000), + SPH_C32(0xcba30034), SPH_C32(0x3c34923c), SPH_C32(0x9767bdcc), + SPH_C32(0x450360bf) }, + { SPH_C32(0x832800a0), SPH_C32(0x67420000), SPH_C32(0xe1170000), + SPH_C32(0x370b0000), SPH_C32(0xcba30034), SPH_C32(0x3c34923c), + SPH_C32(0x9767bdcc), SPH_C32(0x450360bf), SPH_C32(0x774400f0), + SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), SPH_C32(0x34140000), + SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), SPH_C32(0x0bc3cd1e), + SPH_C32(0xcf3775cb) }, + { SPH_C32(0xe8870170), SPH_C32(0x9d720000), SPH_C32(0x12db0000), + SPH_C32(0xd4220000), SPH_C32(0xf2886b27), SPH_C32(0xa921e543), + SPH_C32(0x4ef8b518), SPH_C32(0x618813b1), SPH_C32(0xb4370060), + SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), SPH_C32(0x5cae0000), + SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), SPH_C32(0x1b365f3d), + SPH_C32(0xf3d45758) }, + { SPH_C32(0x9fc30180), SPH_C32(0x6c280000), SPH_C32(0xe7690000), + SPH_C32(0xe0360000), SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), + SPH_C32(0x453b7806), SPH_C32(0xaebf667a), SPH_C32(0x405b0030), + SPH_C32(0x9a540000), SPH_C32(0x42670000), SPH_C32(0x5fb10000), + SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), SPH_C32(0x87922fef), + SPH_C32(0x79e0422c) }, + { SPH_C32(0x1ceb0120), SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), + SPH_C32(0xd73d0000), SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), + SPH_C32(0xd25cc5ca), SPH_C32(0xebbc06c5), SPH_C32(0x371f00c0), + SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), SPH_C32(0x6ba50000), + SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), SPH_C32(0x8c51e2f1), + SPH_C32(0xb6d737e7) }, + { SPH_C32(0x6baf01d0), SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), + SPH_C32(0xe3290000), SPH_C32(0x392b6b13), SPH_C32(0x9515777f), + SPH_C32(0xd99f08d4), SPH_C32(0x248b730e), SPH_C32(0xc3730090), + SPH_C32(0xfd160000), SPH_C32(0xa3700000), SPH_C32(0x68ba0000), + SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), SPH_C32(0x10f59223), + SPH_C32(0x3ce32293) } +}; + +static const sph_u32 T512_12[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xa67f0001), SPH_C32(0x71378000), SPH_C32(0x19fc0000), + SPH_C32(0x96db0000), SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), + SPH_C32(0x2c6d478f), SPH_C32(0xac8e6c88), SPH_C32(0x50ff0004), + SPH_C32(0x45744000), SPH_C32(0x3dfb0000), SPH_C32(0x19e60000), + SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), SPH_C32(0xe1a8cc96), + SPH_C32(0x7b1bd6b9) }, + { SPH_C32(0xf7750009), SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), + SPH_C32(0x04920000), SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), + SPH_C32(0x7a87f14e), SPH_C32(0x9e16981a), SPH_C32(0xd46a0000), + SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), SPH_C32(0x4a290000), + SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), SPH_C32(0x98369604), + SPH_C32(0xf746c320) }, + { SPH_C32(0x510a0008), SPH_C32(0xbe0b4000), SPH_C32(0xda2a0000), + SPH_C32(0x92490000), SPH_C32(0x381e7454), SPH_C32(0x13229849), + SPH_C32(0x56eab6c1), SPH_C32(0x3298f492), SPH_C32(0x84950004), + SPH_C32(0xc8bc8000), SPH_C32(0x98540000), SPH_C32(0x53cf0000), + SPH_C32(0xe7f2147c), SPH_C32(0x28c6fd31), SPH_C32(0x799e5a92), + SPH_C32(0x8c5d1599) }, + { SPH_C32(0xd46a0000), SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), + SPH_C32(0x4a290000), SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), + SPH_C32(0x98369604), SPH_C32(0xf746c320), SPH_C32(0x231f0009), + SPH_C32(0x42f40000), SPH_C32(0x66790000), SPH_C32(0x4ebb0000), + SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), SPH_C32(0xe2b1674a), + SPH_C32(0x69505b3a) }, + { SPH_C32(0x72150001), SPH_C32(0xfcff4000), SPH_C32(0xbc530000), + SPH_C32(0xdcf20000), SPH_C32(0xc6c52f87), SPH_C32(0x227e289f), + SPH_C32(0xb45bd18b), SPH_C32(0x5bc8afa8), SPH_C32(0x73e0000d), + SPH_C32(0x07804000), SPH_C32(0x5b820000), SPH_C32(0x575d0000), + SPH_C32(0xe5670dd5), SPH_C32(0xd02ecb8b), SPH_C32(0x0319abdc), + SPH_C32(0x124b8d83) }, + { SPH_C32(0x231f0009), SPH_C32(0x42f40000), SPH_C32(0x66790000), + SPH_C32(0x4ebb0000), SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), + SPH_C32(0xe2b1674a), SPH_C32(0x69505b3a), SPH_C32(0xf7750009), + SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), SPH_C32(0x04920000), + SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), SPH_C32(0x7a87f14e), + SPH_C32(0x9e16981a) }, + { SPH_C32(0x85600008), SPH_C32(0x33c38000), SPH_C32(0x7f850000), + SPH_C32(0xd8600000), SPH_C32(0xc450362e), SPH_C32(0xda961e25), + SPH_C32(0xcedc20c5), SPH_C32(0xc5de37b2), SPH_C32(0xa78a000d), + SPH_C32(0x8a488000), SPH_C32(0xfe2d0000), SPH_C32(0x1d740000), + SPH_C32(0x19294faf), SPH_C32(0x199a4de7), SPH_C32(0x9b2f3dd8), + SPH_C32(0xe50d4ea3) } +}; + +static const sph_u32 T512_15[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x75c90003), SPH_C32(0x0e10c000), SPH_C32(0xd1200000), + SPH_C32(0xbaea0000), SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), + SPH_C32(0xbb28761d), SPH_C32(0x00b72e2b), SPH_C32(0xeecf0001), + SPH_C32(0x6f564000), SPH_C32(0xf33e0000), SPH_C32(0xa79e0000), + SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), SPH_C32(0x4a3b40ba), + SPH_C32(0xfeabf254) }, + { SPH_C32(0xeecf0001), SPH_C32(0x6f564000), SPH_C32(0xf33e0000), + SPH_C32(0xa79e0000), SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), + SPH_C32(0x4a3b40ba), SPH_C32(0xfeabf254), SPH_C32(0x9b060002), + SPH_C32(0x61468000), SPH_C32(0x221e0000), SPH_C32(0x1d740000), + SPH_C32(0x36715d27), SPH_C32(0x30495c92), SPH_C32(0xf11336a7), + SPH_C32(0xfe1cdc7f) }, + { SPH_C32(0x9b060002), SPH_C32(0x61468000), SPH_C32(0x221e0000), + SPH_C32(0x1d740000), SPH_C32(0x36715d27), SPH_C32(0x30495c92), + SPH_C32(0xf11336a7), SPH_C32(0xfe1cdc7f), SPH_C32(0x75c90003), + SPH_C32(0x0e10c000), SPH_C32(0xd1200000), SPH_C32(0xbaea0000), + SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), SPH_C32(0xbb28761d), + SPH_C32(0x00b72e2b) }, + { SPH_C32(0xf6800005), SPH_C32(0x3443c000), SPH_C32(0x24070000), + SPH_C32(0x8f3d0000), SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), + SPH_C32(0xcdc58b19), SPH_C32(0xd795ba31), SPH_C32(0xa67f0001), + SPH_C32(0x71378000), SPH_C32(0x19fc0000), SPH_C32(0x96db0000), + SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), SPH_C32(0x2c6d478f), + SPH_C32(0xac8e6c88) }, + { SPH_C32(0x83490006), SPH_C32(0x3a530000), SPH_C32(0xf5270000), + SPH_C32(0x35d70000), SPH_C32(0xaaf314c5), SPH_C32(0x8de062f9), + SPH_C32(0x76edfd04), SPH_C32(0xd722941a), SPH_C32(0x48b00000), + SPH_C32(0x1e61c000), SPH_C32(0xeac20000), SPH_C32(0x31450000), + SPH_C32(0x873e1fe4), SPH_C32(0x5cdb4536), SPH_C32(0x66560735), + SPH_C32(0x52259edc) }, + { SPH_C32(0x184f0004), SPH_C32(0x5b158000), SPH_C32(0xd7390000), + SPH_C32(0x28a30000), SPH_C32(0x9c8249e2), SPH_C32(0xbda93e6b), + SPH_C32(0x87fecba3), SPH_C32(0x293e4865), SPH_C32(0x3d790003), + SPH_C32(0x10710000), SPH_C32(0x3be20000), SPH_C32(0x8baf0000), + SPH_C32(0x0cfa30da), SPH_C32(0xdb83f261), SPH_C32(0xdd7e7128), + SPH_C32(0x5292b0f7) }, + { SPH_C32(0x6d860007), SPH_C32(0x55054000), SPH_C32(0x06190000), + SPH_C32(0x92490000), SPH_C32(0x174666dc), SPH_C32(0x3af1893c), + SPH_C32(0x3cd6bdbe), SPH_C32(0x2989664e), SPH_C32(0xd3b60002), + SPH_C32(0x7f274000), SPH_C32(0xc8dc0000), SPH_C32(0x2c310000), + SPH_C32(0xb14f42c3), SPH_C32(0x6c9219a4), SPH_C32(0x97453192), + SPH_C32(0xac3942a3) } +}; + +static const sph_u32 T512_18[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xb83d0000), SPH_C32(0x16710600), SPH_C32(0x379a0000), + SPH_C32(0xf5b10000), SPH_C32(0x228161ac), SPH_C32(0xae48f145), + SPH_C32(0x66241616), SPH_C32(0xc5c1eb3e), SPH_C32(0xfd250000), + SPH_C32(0xb3c41100), SPH_C32(0xcef00000), SPH_C32(0xcef90000), + SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), SPH_C32(0x7098b0a6), + SPH_C32(0x1af21fe1) }, + { SPH_C32(0x75a40000), SPH_C32(0xc28b2700), SPH_C32(0x94a40000), + SPH_C32(0x90f50000), SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), + SPH_C32(0x1767c483), SPH_C32(0xaedf667e), SPH_C32(0xd1660000), + SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), SPH_C32(0xf6940000), + SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), SPH_C32(0xb4431b17), + SPH_C32(0x857f3c2b) }, + { SPH_C32(0xcd990000), SPH_C32(0xd4fa2100), SPH_C32(0xa33e0000), + SPH_C32(0x65440000), SPH_C32(0xd9f9364c), SPH_C32(0xe786faeb), + SPH_C32(0x7143d295), SPH_C32(0x6b1e8d40), SPH_C32(0x2c430000), + SPH_C32(0xa8781200), SPH_C32(0x501c0000), SPH_C32(0x386d0000), + SPH_C32(0x3f4f30a7), SPH_C32(0x422b9861), SPH_C32(0xc4dbabb1), + SPH_C32(0x9f8d23ca) }, + { SPH_C32(0xd1660000), SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), + SPH_C32(0xf6940000), SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), + SPH_C32(0xb4431b17), SPH_C32(0x857f3c2b), SPH_C32(0xa4c20000), + SPH_C32(0xd9372400), SPH_C32(0x0a480000), SPH_C32(0x66610000), + SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), SPH_C32(0xa324df94), + SPH_C32(0x2ba05a55) }, + { SPH_C32(0x695b0000), SPH_C32(0x0dcd0500), SPH_C32(0xa9760000), + SPH_C32(0x03250000), SPH_C32(0x2183248b), SPH_C32(0x61380db7), + SPH_C32(0xd2670d01), SPH_C32(0x40bed715), SPH_C32(0x59e70000), + SPH_C32(0x6af33500), SPH_C32(0xc4b80000), SPH_C32(0xa8980000), + SPH_C32(0xc4376747), SPH_C32(0x0be593cf), SPH_C32(0xd3bc6f32), + SPH_C32(0x315245b4) }, + { SPH_C32(0xa4c20000), SPH_C32(0xd9372400), SPH_C32(0x0a480000), + SPH_C32(0x66610000), SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), + SPH_C32(0xa324df94), SPH_C32(0x2ba05a55), SPH_C32(0x75a40000), + SPH_C32(0xc28b2700), SPH_C32(0x94a40000), SPH_C32(0x90f50000), + SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), SPH_C32(0x1767c483), + SPH_C32(0xaedf667e) }, + { SPH_C32(0x1cff0000), SPH_C32(0xcf462200), SPH_C32(0x3dd20000), + SPH_C32(0x93d00000), SPH_C32(0xdafb736b), SPH_C32(0x28f60619), + SPH_C32(0xc500c982), SPH_C32(0xee61b16b), SPH_C32(0x88810000), + SPH_C32(0x714f3600), SPH_C32(0x5a540000), SPH_C32(0x5e0c0000), + SPH_C32(0xc7352260), SPH_C32(0xc4956f3d), SPH_C32(0x67ff7425), + SPH_C32(0xb42d799f) } +}; + +static const sph_u32 T512_21[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x0c720000), SPH_C32(0x49e50f00), SPH_C32(0x42790000), + SPH_C32(0x5cea0000), SPH_C32(0x33aa301a), SPH_C32(0x15822514), + SPH_C32(0x95a34b7b), SPH_C32(0xb44b0090), SPH_C32(0xfe220000), + SPH_C32(0xa7580500), SPH_C32(0x25d10000), SPH_C32(0xf7600000), + SPH_C32(0x893178da), SPH_C32(0x1fd4f860), SPH_C32(0x4ed0a315), + SPH_C32(0xa123ff9f) }, + { SPH_C32(0xfe220000), SPH_C32(0xa7580500), SPH_C32(0x25d10000), + SPH_C32(0xf7600000), SPH_C32(0x893178da), SPH_C32(0x1fd4f860), + SPH_C32(0x4ed0a315), SPH_C32(0xa123ff9f), SPH_C32(0xf2500000), + SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), SPH_C32(0xab8a0000), + SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), SPH_C32(0xdb73e86e), + SPH_C32(0x1568ff0f) }, + { SPH_C32(0xf2500000), SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), + SPH_C32(0xab8a0000), SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), + SPH_C32(0xdb73e86e), SPH_C32(0x1568ff0f), SPH_C32(0x0c720000), + SPH_C32(0x49e50f00), SPH_C32(0x42790000), SPH_C32(0x5cea0000), + SPH_C32(0x33aa301a), SPH_C32(0x15822514), SPH_C32(0x95a34b7b), + SPH_C32(0xb44b0090) }, + { SPH_C32(0x45180000), SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), + SPH_C32(0x3b480000), SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), + SPH_C32(0x16bca6b0), SPH_C32(0xdf33f4df), SPH_C32(0xb83d0000), + SPH_C32(0x16710600), SPH_C32(0x379a0000), SPH_C32(0xf5b10000), + SPH_C32(0x228161ac), SPH_C32(0xae48f145), SPH_C32(0x66241616), + SPH_C32(0xc5c1eb3e) }, + { SPH_C32(0x496a0000), SPH_C32(0xec501800), SPH_C32(0xbb130000), + SPH_C32(0x67a20000), SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), + SPH_C32(0x831fedcb), SPH_C32(0x6b78f44f), SPH_C32(0x461f0000), + SPH_C32(0xb1290300), SPH_C32(0x124b0000), SPH_C32(0x02d10000), + SPH_C32(0xabb01976), SPH_C32(0xb19c0925), SPH_C32(0x28f4b503), + SPH_C32(0x64e214a1) }, + { SPH_C32(0xbb3a0000), SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), + SPH_C32(0xcc280000), SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), + SPH_C32(0x586c05a5), SPH_C32(0x7e100b40), SPH_C32(0x4a6d0000), + SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), SPH_C32(0x5e3b0000), + SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), SPH_C32(0xbd57fe78), + SPH_C32(0xd0a91431) }, + { SPH_C32(0xb7480000), SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), + SPH_C32(0x90c20000), SPH_C32(0xa4575cec), SPH_C32(0x294548a2), + SPH_C32(0xcdcf4ede), SPH_C32(0xca5b0bd0), SPH_C32(0xb44f0000), + SPH_C32(0x5f940900), SPH_C32(0x75e30000), SPH_C32(0xa95b0000), + SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), SPH_C32(0xf3875d6d), + SPH_C32(0x718aebae) } +}; + +static const sph_u32 T512_24[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xbc8d0000), SPH_C32(0xfc3b0018), SPH_C32(0x19830000), + SPH_C32(0xd10b0000), SPH_C32(0xae1878c4), SPH_C32(0x42a69856), + SPH_C32(0x0012da37), SPH_C32(0x2c3b504e), SPH_C32(0xe8dd0000), + SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), SPH_C32(0xbb150000), + SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), SPH_C32(0xbfa8c2f4), + SPH_C32(0x524a0d59) }, + { SPH_C32(0x69510000), SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), + SPH_C32(0xac2f0000), SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), + SPH_C32(0x87ec287c), SPH_C32(0xbce1a3ce), SPH_C32(0xc6730000), + SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), SPH_C32(0x218d0000), + SPH_C32(0x23111587), SPH_C32(0x7913512f), SPH_C32(0x1d28ac88), + SPH_C32(0x378dd173) }, + { SPH_C32(0xd5dc0000), SPH_C32(0x28da0084), SPH_C32(0xdaa00000), + SPH_C32(0x7d240000), SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), + SPH_C32(0x87fef24b), SPH_C32(0x90daf380), SPH_C32(0x2eae0000), + SPH_C32(0x55c70048), SPH_C32(0x98ec0000), SPH_C32(0x9a980000), + SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), SPH_C32(0xa2806e7c), + SPH_C32(0x65c7dc2a) }, + { SPH_C32(0xc6730000), SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), + SPH_C32(0x218d0000), SPH_C32(0x23111587), SPH_C32(0x7913512f), + SPH_C32(0x1d28ac88), SPH_C32(0x378dd173), SPH_C32(0xaf220000), + SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), SPH_C32(0x8da20000), + SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), SPH_C32(0x9ac484f4), + SPH_C32(0x8b6c72bd) }, + { SPH_C32(0x7afe0000), SPH_C32(0x53b60014), SPH_C32(0xbd420000), + SPH_C32(0xf0860000), SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), + SPH_C32(0x1d3a76bf), SPH_C32(0x1bb6813d), SPH_C32(0x47ff0000), + SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), SPH_C32(0x36b70000), + SPH_C32(0x47392832), SPH_C32(0x935f59b7), SPH_C32(0x256c4600), + SPH_C32(0xd9267fe4) }, + { SPH_C32(0xaf220000), SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), + SPH_C32(0x8da20000), SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), + SPH_C32(0x9ac484f4), SPH_C32(0x8b6c72bd), SPH_C32(0x69510000), + SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), SPH_C32(0xac2f0000), + SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), SPH_C32(0x87ec287c), + SPH_C32(0xbce1a3ce) }, + { SPH_C32(0x13af0000), SPH_C32(0x87570088), SPH_C32(0x7e610000), + SPH_C32(0x5ca90000), SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), + SPH_C32(0x9ad65ec3), SPH_C32(0xa75722f3), SPH_C32(0x818c0000), + SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), SPH_C32(0x173a0000), + SPH_C32(0x64283db5), SPH_C32(0xea4c0898), SPH_C32(0x3844ea88), + SPH_C32(0xeeabae97) } +}; + +static const sph_u32 T512_27[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x14190000), SPH_C32(0x23ca003c), SPH_C32(0x50df0000), + SPH_C32(0x44b60000), SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), + SPH_C32(0x61e610b0), SPH_C32(0xdbcadb80), SPH_C32(0xe3430000), + SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), SPH_C32(0xaa4e0000), + SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), SPH_C32(0x123db156), + SPH_C32(0x3a4e99d7) }, + { SPH_C32(0xe3430000), SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), + SPH_C32(0xaa4e0000), SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), + SPH_C32(0x123db156), SPH_C32(0x3a4e99d7), SPH_C32(0xf75a0000), + SPH_C32(0x19840028), SPH_C32(0xa2190000), SPH_C32(0xeef80000), + SPH_C32(0xc0722516), SPH_C32(0x19981260), SPH_C32(0x73dba1e6), + SPH_C32(0xe1844257) }, + { SPH_C32(0xf75a0000), SPH_C32(0x19840028), SPH_C32(0xa2190000), + SPH_C32(0xeef80000), SPH_C32(0xc0722516), SPH_C32(0x19981260), + SPH_C32(0x73dba1e6), SPH_C32(0xe1844257), SPH_C32(0x14190000), + SPH_C32(0x23ca003c), SPH_C32(0x50df0000), SPH_C32(0x44b60000), + SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), SPH_C32(0x61e610b0), + SPH_C32(0xdbcadb80) }, + { SPH_C32(0x54500000), SPH_C32(0x0671005c), SPH_C32(0x25ae0000), + SPH_C32(0x6a1e0000), SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), + SPH_C32(0xbfba18c3), SPH_C32(0x7e715d17), SPH_C32(0xbc8d0000), + SPH_C32(0xfc3b0018), SPH_C32(0x19830000), SPH_C32(0xd10b0000), + SPH_C32(0xae1878c4), SPH_C32(0x42a69856), SPH_C32(0x0012da37), + SPH_C32(0x2c3b504e) }, + { SPH_C32(0x40490000), SPH_C32(0x25bb0060), SPH_C32(0x75710000), + SPH_C32(0x2ea80000), SPH_C32(0x35c9296f), SPH_C32(0x5abd2967), + SPH_C32(0xde5c0873), SPH_C32(0xa5bb8697), SPH_C32(0x5fce0000), + SPH_C32(0xc675000c), SPH_C32(0xeb450000), SPH_C32(0x7b450000), + SPH_C32(0x75063a62), SPH_C32(0x67cd2643), SPH_C32(0x122f6b61), + SPH_C32(0x1675c999) }, + { SPH_C32(0xb7130000), SPH_C32(0x3c3f0048), SPH_C32(0xd7680000), + SPH_C32(0xc0500000), SPH_C32(0xf5bb0c79), SPH_C32(0x43253b07), + SPH_C32(0xad87a995), SPH_C32(0x443fc4c0), SPH_C32(0x4bd70000), + SPH_C32(0xe5bf0030), SPH_C32(0xbb9a0000), SPH_C32(0x3ff30000), + SPH_C32(0x6e6a5dd2), SPH_C32(0x5b3e8a36), SPH_C32(0x73c97bd1), + SPH_C32(0xcdbf1219) }, + { SPH_C32(0xa30a0000), SPH_C32(0x1ff50074), SPH_C32(0x87b70000), + SPH_C32(0x84e60000), SPH_C32(0xeed76bc9), SPH_C32(0x7fd69772), + SPH_C32(0xcc61b925), SPH_C32(0x9ff51f40), SPH_C32(0xa8940000), + SPH_C32(0xdff10024), SPH_C32(0x495c0000), SPH_C32(0x95bd0000), + SPH_C32(0xb5741f74), SPH_C32(0x7e553423), SPH_C32(0x61f4ca87), + SPH_C32(0xf7f18bce) } +}; + +static const sph_u32 T512_30[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xdb250000), SPH_C32(0x09290000), SPH_C32(0x49aac000), + SPH_C32(0x81e10000), SPH_C32(0xcafe6b59), SPH_C32(0x42793431), + SPH_C32(0x43566b76), SPH_C32(0xe86cba2e), SPH_C32(0x75e60000), + SPH_C32(0x95660001), SPH_C32(0x307b2000), SPH_C32(0xadf40000), + SPH_C32(0x8f321eea), SPH_C32(0x24298307), SPH_C32(0xe8c49cf9), + SPH_C32(0x4b7eec55) }, + { SPH_C32(0x86790000), SPH_C32(0x3f390002), SPH_C32(0xe19ae000), + SPH_C32(0x98560000), SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), + SPH_C32(0xd3dd4944), SPH_C32(0x161ddab9), SPH_C32(0x30b70000), + SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), SPH_C32(0x42c40000), + SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), SPH_C32(0x21afa1ea), + SPH_C32(0xb0a51834) }, + { SPH_C32(0x5d5c0000), SPH_C32(0x36100002), SPH_C32(0xa8302000), + SPH_C32(0x19b70000), SPH_C32(0x5f9b0c57), SPH_C32(0x0cf1fcdb), + SPH_C32(0x908b2232), SPH_C32(0xfe716097), SPH_C32(0x45510000), + SPH_C32(0x70b60001), SPH_C32(0xc48f4000), SPH_C32(0xef300000), + SPH_C32(0xec8a2380), SPH_C32(0x5c931767), SPH_C32(0xc96b3d13), + SPH_C32(0xfbdbf461) }, + { SPH_C32(0x30b70000), SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), + SPH_C32(0x42c40000), SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), + SPH_C32(0x21afa1ea), SPH_C32(0xb0a51834), SPH_C32(0xb6ce0000), + SPH_C32(0xdae90002), SPH_C32(0x156e8000), SPH_C32(0xda920000), + SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), SPH_C32(0xf272e8ae), + SPH_C32(0xa6b8c28d) }, + { SPH_C32(0xeb920000), SPH_C32(0xecf90000), SPH_C32(0xbd5ea000), + SPH_C32(0xc3250000), SPH_C32(0xa9465633), SPH_C32(0x3ac3a051), + SPH_C32(0x62f9ca9c), SPH_C32(0x58c9a21a), SPH_C32(0xc3280000), + SPH_C32(0x4f8f0003), SPH_C32(0x2515a000), SPH_C32(0x77660000), + SPH_C32(0x79ef448e), SPH_C32(0x121bdf8d), SPH_C32(0x1ab67457), + SPH_C32(0xedc62ed8) }, + { SPH_C32(0xb6ce0000), SPH_C32(0xdae90002), SPH_C32(0x156e8000), + SPH_C32(0xda920000), SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), + SPH_C32(0xf272e8ae), SPH_C32(0xa6b8c28d), SPH_C32(0x86790000), + SPH_C32(0x3f390002), SPH_C32(0xe19ae000), SPH_C32(0x98560000), + SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), SPH_C32(0xd3dd4944), + SPH_C32(0x161ddab9) }, + { SPH_C32(0x6deb0000), SPH_C32(0xd3c00002), SPH_C32(0x5cc44000), + SPH_C32(0x5b730000), SPH_C32(0x3c23313d), SPH_C32(0x744b68bb), + SPH_C32(0xb12483d8), SPH_C32(0x4ed478a3), SPH_C32(0xf39f0000), + SPH_C32(0xaa5f0003), SPH_C32(0xd1e1c000), SPH_C32(0x35a20000), + SPH_C32(0x1a5779e4), SPH_C32(0x6aa14bed), SPH_C32(0x3b19d5bd), + SPH_C32(0x5d6336ec) } +}; + +static const sph_u32 T512_33[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xac480000), SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), + SPH_C32(0x03430000), SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), + SPH_C32(0xfe72c7fe), SPH_C32(0x91e478f6), SPH_C32(0x1e4e0000), + SPH_C32(0xdecf0000), SPH_C32(0x6df80180), SPH_C32(0x77240000), + SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), SPH_C32(0xcda31812), + SPH_C32(0x98aa496e) }, + { SPH_C32(0x1e4e0000), SPH_C32(0xdecf0000), SPH_C32(0x6df80180), + SPH_C32(0x77240000), SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), + SPH_C32(0xcda31812), SPH_C32(0x98aa496e), SPH_C32(0xb2060000), + SPH_C32(0xc5690000), SPH_C32(0x28031200), SPH_C32(0x74670000), + SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), SPH_C32(0x33d1dfec), + SPH_C32(0x094e3198) }, + { SPH_C32(0xb2060000), SPH_C32(0xc5690000), SPH_C32(0x28031200), + SPH_C32(0x74670000), SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), + SPH_C32(0x33d1dfec), SPH_C32(0x094e3198), SPH_C32(0xac480000), + SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), SPH_C32(0x03430000), + SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), SPH_C32(0xfe72c7fe), + SPH_C32(0x91e478f6) }, + { SPH_C32(0xaec30000), SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), + SPH_C32(0x2c150000), SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), + SPH_C32(0xab92f78f), SPH_C32(0xa312567b), SPH_C32(0xdb250000), + SPH_C32(0x09290000), SPH_C32(0x49aac000), SPH_C32(0x81e10000), + SPH_C32(0xcafe6b59), SPH_C32(0x42793431), SPH_C32(0x43566b76), + SPH_C32(0xe86cba2e) }, + { SPH_C32(0x028b0000), SPH_C32(0x87e90001), SPH_C32(0x3c2af380), + SPH_C32(0x2f560000), SPH_C32(0x1f4944d9), SPH_C32(0x79e2e780), + SPH_C32(0x55e03071), SPH_C32(0x32f62e8d), SPH_C32(0xc56b0000), + SPH_C32(0xd7e60000), SPH_C32(0x2452c180), SPH_C32(0xf6c50000), + SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), SPH_C32(0x8ef57364), + SPH_C32(0x70c6f340) }, + { SPH_C32(0xb08d0000), SPH_C32(0x42800001), SPH_C32(0x1429e180), + SPH_C32(0x5b310000), SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), + SPH_C32(0x6631ef9d), SPH_C32(0x3bb81f15), SPH_C32(0x69230000), + SPH_C32(0xcc400000), SPH_C32(0x61a9d200), SPH_C32(0xf5860000), + SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), SPH_C32(0x7087b49a), + SPH_C32(0xe1228bb6) }, + { SPH_C32(0x1cc50000), SPH_C32(0x59260001), SPH_C32(0x51d2f200), + SPH_C32(0x58720000), SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), + SPH_C32(0x98432863), SPH_C32(0xaa5c67e3), SPH_C32(0x776d0000), + SPH_C32(0x128f0000), SPH_C32(0x0c51d380), SPH_C32(0x82a20000), + SPH_C32(0x907b5a33), SPH_C32(0x5dcb6487), SPH_C32(0xbd24ac88), + SPH_C32(0x7988c2d8) } +}; + +static const sph_u32 T512_36[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x819e0000), SPH_C32(0xec570000), SPH_C32(0x66320280), + SPH_C32(0x95f30000), SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), + SPH_C32(0xe65aa22d), SPH_C32(0x8e67b7fa), SPH_C32(0x4d8a0000), + SPH_C32(0x49340000), SPH_C32(0x3c8b0500), SPH_C32(0xaea30000), + SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), SPH_C32(0x8f19eaec), + SPH_C32(0x443d3004) }, + { SPH_C32(0x78230000), SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), + SPH_C32(0x90a50000), SPH_C32(0x713e2879), SPH_C32(0x7ee98924), + SPH_C32(0xf08ca062), SPH_C32(0x636f8bab), SPH_C32(0x02af0000), + SPH_C32(0xb7280000), SPH_C32(0xba1c0300), SPH_C32(0x56980000), + SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), SPH_C32(0xa95c149a), + SPH_C32(0xf4f6ea7b) }, + { SPH_C32(0xf9bd0000), SPH_C32(0xfeab0000), SPH_C32(0xcf080900), + SPH_C32(0x05560000), SPH_C32(0x2c97007b), SPH_C32(0x361db598), + SPH_C32(0x16d6024f), SPH_C32(0xed083c51), SPH_C32(0x4f250000), + SPH_C32(0xfe1c0000), SPH_C32(0x86970600), SPH_C32(0xf83b0000), + SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), SPH_C32(0x2645fe76), + SPH_C32(0xb0cbda7f) }, + { SPH_C32(0x02af0000), SPH_C32(0xb7280000), SPH_C32(0xba1c0300), + SPH_C32(0x56980000), SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), + SPH_C32(0xa95c149a), SPH_C32(0xf4f6ea7b), SPH_C32(0x7a8c0000), + SPH_C32(0xa5d40000), SPH_C32(0x13260880), SPH_C32(0xc63d0000), + SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), SPH_C32(0x59d0b4f8), + SPH_C32(0x979961d0) }, + { SPH_C32(0x83310000), SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), + SPH_C32(0xc36b0000), SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), + SPH_C32(0x4f06b6b7), SPH_C32(0x7a915d81), SPH_C32(0x37060000), + SPH_C32(0xece00000), SPH_C32(0x2fad0d80), SPH_C32(0x689e0000), + SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), SPH_C32(0xd6c95e14), + SPH_C32(0xd3a451d4) }, + { SPH_C32(0x7a8c0000), SPH_C32(0xa5d40000), SPH_C32(0x13260880), + SPH_C32(0xc63d0000), SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), + SPH_C32(0x59d0b4f8), SPH_C32(0x979961d0), SPH_C32(0x78230000), + SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), SPH_C32(0x90a50000), + SPH_C32(0x713e2879), SPH_C32(0x7ee98924), SPH_C32(0xf08ca062), + SPH_C32(0x636f8bab) }, + { SPH_C32(0xfb120000), SPH_C32(0x49830000), SPH_C32(0x75140a00), + SPH_C32(0x53ce0000), SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), + SPH_C32(0xbf8a16d5), SPH_C32(0x19fed62a), SPH_C32(0x35a90000), + SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), SPH_C32(0x3e060000), + SPH_C32(0x67471384), SPH_C32(0xb1868180), SPH_C32(0x7f954a8e), + SPH_C32(0x2752bbaf) } +}; + +static const sph_u32 T512_39[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x52500000), SPH_C32(0x29540000), SPH_C32(0x6a61004e), + SPH_C32(0xf0ff0000), SPH_C32(0x9a317eec), SPH_C32(0x452341ce), + SPH_C32(0xcf568fe5), SPH_C32(0x5303130f), SPH_C32(0x538d0000), + SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), SPH_C32(0x56ff0000), + SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), SPH_C32(0xa9444018), + SPH_C32(0x7f975691) }, + { SPH_C32(0x538d0000), SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), + SPH_C32(0x56ff0000), SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), + SPH_C32(0xa9444018), SPH_C32(0x7f975691), SPH_C32(0x01dd0000), + SPH_C32(0x80a80000), SPH_C32(0xf4960048), SPH_C32(0xa6000000), + SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), SPH_C32(0x6612cffd), + SPH_C32(0x2c94459e) }, + { SPH_C32(0x01dd0000), SPH_C32(0x80a80000), SPH_C32(0xf4960048), + SPH_C32(0xa6000000), SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), + SPH_C32(0x6612cffd), SPH_C32(0x2c94459e), SPH_C32(0x52500000), + SPH_C32(0x29540000), SPH_C32(0x6a61004e), SPH_C32(0xf0ff0000), + SPH_C32(0x9a317eec), SPH_C32(0x452341ce), SPH_C32(0xcf568fe5), + SPH_C32(0x5303130f) }, + { SPH_C32(0xcc140000), SPH_C32(0xa5630000), SPH_C32(0x5ab90780), + SPH_C32(0x3b500000), SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), + SPH_C32(0x694348c1), SPH_C32(0xca5a87fe), SPH_C32(0x819e0000), + SPH_C32(0xec570000), SPH_C32(0x66320280), SPH_C32(0x95f30000), + SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), SPH_C32(0xe65aa22d), + SPH_C32(0x8e67b7fa) }, + { SPH_C32(0x9e440000), SPH_C32(0x8c370000), SPH_C32(0x30d807ce), + SPH_C32(0xcbaf0000), SPH_C32(0xd1e16d13), SPH_C32(0xc2b875d6), + SPH_C32(0xa615c724), SPH_C32(0x995994f1), SPH_C32(0xd2130000), + SPH_C32(0x45ab0000), SPH_C32(0xf8c50286), SPH_C32(0xc30c0000), + SPH_C32(0x574d284c), SPH_C32(0xda31f145), SPH_C32(0x4f1ee235), + SPH_C32(0xf1f0e16b) }, + { SPH_C32(0x9f990000), SPH_C32(0x0c9f0000), SPH_C32(0xc44e0786), + SPH_C32(0x6daf0000), SPH_C32(0x413413b1), SPH_C32(0x155ef9e1), + SPH_C32(0xc00708d9), SPH_C32(0xb5cdd16f), SPH_C32(0x80430000), + SPH_C32(0x6cff0000), SPH_C32(0x92a402c8), SPH_C32(0x33f30000), + SPH_C32(0xcd7c56a0), SPH_C32(0x9f12b08b), SPH_C32(0x80486dd0), + SPH_C32(0xa2f3f264) }, + { SPH_C32(0xcdc90000), SPH_C32(0x25cb0000), SPH_C32(0xae2f07c8), + SPH_C32(0x9d500000), SPH_C32(0xdb056d5d), SPH_C32(0x507db82f), + SPH_C32(0x0f51873c), SPH_C32(0xe6cec260), SPH_C32(0xd3ce0000), + SPH_C32(0xc5030000), SPH_C32(0x0c5302ce), SPH_C32(0x650c0000), + SPH_C32(0xc79856ee), SPH_C32(0x0dd77d72), SPH_C32(0x290c2dc8), + SPH_C32(0xdd64a4f5) } +}; + +static const sph_u32 T512_42[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x07ed0000), SPH_C32(0xb2500000), SPH_C32(0x8774000a), + SPH_C32(0x970d0000), SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), + SPH_C32(0xf4786222), SPH_C32(0x9075b1ce), SPH_C32(0xa2d60000), + SPH_C32(0xa6760000), SPH_C32(0xc9440014), SPH_C32(0xeba30000), + SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), SPH_C32(0x03490afa), + SPH_C32(0x9b6ef888) }, + { SPH_C32(0x88980000), SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), + SPH_C32(0xfb4e0000), SPH_C32(0xf158079a), SPH_C32(0x61ae9167), + SPH_C32(0xa895706c), SPH_C32(0xe6107494), SPH_C32(0x0bc20000), + SPH_C32(0xdb630000), SPH_C32(0x7e88000c), SPH_C32(0x15860000), + SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), SPH_C32(0xf460449e), + SPH_C32(0xd8b61463) }, + { SPH_C32(0x8f750000), SPH_C32(0xadc40000), SPH_C32(0xf8bb0024), + SPH_C32(0x6c430000), SPH_C32(0xb22a2434), SPH_C32(0x2969ffc3), + SPH_C32(0x5ced124e), SPH_C32(0x7665c55a), SPH_C32(0xa9140000), + SPH_C32(0x7d150000), SPH_C32(0xb7cc0018), SPH_C32(0xfe250000), + SPH_C32(0x5d116688), SPH_C32(0x45997fda), SPH_C32(0xf7294e64), + SPH_C32(0x43d8eceb) }, + { SPH_C32(0x0bc20000), SPH_C32(0xdb630000), SPH_C32(0x7e88000c), + SPH_C32(0x15860000), SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), + SPH_C32(0xf460449e), SPH_C32(0xd8b61463), SPH_C32(0x835a0000), + SPH_C32(0xc4f70000), SPH_C32(0x01470022), SPH_C32(0xeec80000), + SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), SPH_C32(0x5cf534f2), + SPH_C32(0x3ea660f7) }, + { SPH_C32(0x0c2f0000), SPH_C32(0x69330000), SPH_C32(0xf9fc0006), + SPH_C32(0x828b0000), SPH_C32(0xd28f6b5d), SPH_C32(0x3d46d5e7), + SPH_C32(0x001826bc), SPH_C32(0x48c3a5ad), SPH_C32(0x218c0000), + SPH_C32(0x62810000), SPH_C32(0xc8030036), SPH_C32(0x056b0000), + SPH_C32(0xac496112), SPH_C32(0x2437eebd), SPH_C32(0x5fbc3e08), + SPH_C32(0xa5c8987f) }, + { SPH_C32(0x835a0000), SPH_C32(0xc4f70000), SPH_C32(0x01470022), + SPH_C32(0xeec80000), SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), + SPH_C32(0x5cf534f2), SPH_C32(0x3ea660f7), SPH_C32(0x88980000), + SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), SPH_C32(0xfb4e0000), + SPH_C32(0xf158079a), SPH_C32(0x61ae9167), SPH_C32(0xa895706c), + SPH_C32(0xe6107494) }, + { SPH_C32(0x84b70000), SPH_C32(0x76a70000), SPH_C32(0x86330028), + SPH_C32(0x79c50000), SPH_C32(0x23d76cc7), SPH_C32(0x5ce84480), + SPH_C32(0xa88d56d0), SPH_C32(0xaed3d139), SPH_C32(0x2a4e0000), + SPH_C32(0xb9e20000), SPH_C32(0xb68b003a), SPH_C32(0x10ed0000), + SPH_C32(0x3db429e1), SPH_C32(0x51b655fe), SPH_C32(0xabdc7a96), + SPH_C32(0x7d7e8c1c) } +}; + +static const sph_u32 T512_45[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x58430000), SPH_C32(0x807e0000), SPH_C32(0x78330001), + SPH_C32(0xc66b3800), SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), + SPH_C32(0xac73fe6f), SPH_C32(0x3a4479b1), SPH_C32(0x1d5a0000), + SPH_C32(0x2b720000), SPH_C32(0x488d0000), SPH_C32(0xaf611800), + SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), SPH_C32(0x81a20429), + SPH_C32(0x1e7536a6) }, + { SPH_C32(0x1d5a0000), SPH_C32(0x2b720000), SPH_C32(0x488d0000), + SPH_C32(0xaf611800), SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), + SPH_C32(0x81a20429), SPH_C32(0x1e7536a6), SPH_C32(0x45190000), + SPH_C32(0xab0c0000), SPH_C32(0x30be0001), SPH_C32(0x690a2000), + SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), SPH_C32(0x2dd1fa46), + SPH_C32(0x24314f17) }, + { SPH_C32(0x45190000), SPH_C32(0xab0c0000), SPH_C32(0x30be0001), + SPH_C32(0x690a2000), SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), + SPH_C32(0x2dd1fa46), SPH_C32(0x24314f17), SPH_C32(0x58430000), + SPH_C32(0x807e0000), SPH_C32(0x78330001), SPH_C32(0xc66b3800), + SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), SPH_C32(0xac73fe6f), + SPH_C32(0x3a4479b1) }, + { SPH_C32(0xa53b0000), SPH_C32(0x14260000), SPH_C32(0x4e30001e), + SPH_C32(0x7cae0000), SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), + SPH_C32(0xf73168d8), SPH_C32(0x0b1b4946), SPH_C32(0x07ed0000), + SPH_C32(0xb2500000), SPH_C32(0x8774000a), SPH_C32(0x970d0000), + SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), SPH_C32(0xf4786222), + SPH_C32(0x9075b1ce) }, + { SPH_C32(0xfd780000), SPH_C32(0x94580000), SPH_C32(0x3603001f), + SPH_C32(0xbac53800), SPH_C32(0x68a95109), SPH_C32(0x017295e0), + SPH_C32(0x5b4296b7), SPH_C32(0x315f30f7), SPH_C32(0x1ab70000), + SPH_C32(0x99220000), SPH_C32(0xcff9000a), SPH_C32(0x386c1800), + SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), SPH_C32(0x75da660b), + SPH_C32(0x8e008768) }, + { SPH_C32(0xb8610000), SPH_C32(0x3f540000), SPH_C32(0x06bd001e), + SPH_C32(0xd3cf1800), SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), + SPH_C32(0x76936cf1), SPH_C32(0x156e7fe0), SPH_C32(0x42f40000), + SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), SPH_C32(0xfe072000), + SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), SPH_C32(0xd9a99864), + SPH_C32(0xb444fed9) }, + { SPH_C32(0xe0220000), SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), + SPH_C32(0x15a42000), SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), + SPH_C32(0xdae0929e), SPH_C32(0x2f2a0651), SPH_C32(0x5fae0000), + SPH_C32(0x322e0000), SPH_C32(0xff47000b), SPH_C32(0x51663800), + SPH_C32(0xa4457f72), SPH_C32(0x316a5179), SPH_C32(0x580b9c4d), + SPH_C32(0xaa31c87f) } +}; + +static const sph_u32 T512_48[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xbadd0000), SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), + SPH_C32(0xf7282800), SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), + SPH_C32(0xea5a8d14), SPH_C32(0x2a2c18f0), SPH_C32(0xb82f0000), + SPH_C32(0xb12c0000), SPH_C32(0x30d80000), SPH_C32(0x14445000), + SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), SPH_C32(0x2e98bf23), + SPH_C32(0x551e3d6e) }, + { SPH_C32(0x1e6c0000), SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), + SPH_C32(0xbcb6b800), SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), + SPH_C32(0x6a0c1bc8), SPH_C32(0xb99dc2eb), SPH_C32(0x92560000), + SPH_C32(0x1eda0000), SPH_C32(0xea510000), SPH_C32(0xe8b13000), + SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), SPH_C32(0xb15c2254), + SPH_C32(0x33c5244f) }, + { SPH_C32(0xa4b10000), SPH_C32(0xd7ef0000), SPH_C32(0x3dc90000), + SPH_C32(0x4b9e9000), SPH_C32(0xf30107fb), SPH_C32(0xbde710e0), + SPH_C32(0x805696dc), SPH_C32(0x93b1da1b), SPH_C32(0x2a790000), + SPH_C32(0xaff60000), SPH_C32(0xda890000), SPH_C32(0xfcf56000), + SPH_C32(0x686d3607), SPH_C32(0xdadc8975), SPH_C32(0x9fc49d77), + SPH_C32(0x66db1921) }, + { SPH_C32(0x92560000), SPH_C32(0x1eda0000), SPH_C32(0xea510000), + SPH_C32(0xe8b13000), SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), + SPH_C32(0xb15c2254), SPH_C32(0x33c5244f), SPH_C32(0x8c3a0000), + SPH_C32(0xda980000), SPH_C32(0x607f0000), SPH_C32(0x54078800), + SPH_C32(0x85714513), SPH_C32(0x6006b243), SPH_C32(0xdb50399c), + SPH_C32(0x8a58e6a4) }, + { SPH_C32(0x288b0000), SPH_C32(0x0d770000), SPH_C32(0x5db60000), + SPH_C32(0x1f991800), SPH_C32(0x767042e8), SPH_C32(0xdde1a2a3), + SPH_C32(0x5b06af40), SPH_C32(0x19e93cbf), SPH_C32(0x34150000), + SPH_C32(0x6bb40000), SPH_C32(0x50a70000), SPH_C32(0x4043d800), + SPH_C32(0x442925b1), SPH_C32(0x51215aaf), SPH_C32(0xf5c886bf), + SPH_C32(0xdf46dbca) }, + { SPH_C32(0x8c3a0000), SPH_C32(0xda980000), SPH_C32(0x607f0000), + SPH_C32(0x54078800), SPH_C32(0x85714513), SPH_C32(0x6006b243), + SPH_C32(0xdb50399c), SPH_C32(0x8a58e6a4), SPH_C32(0x1e6c0000), + SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), SPH_C32(0xbcb6b800), + SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), SPH_C32(0x6a0c1bc8), + SPH_C32(0xb99dc2eb) }, + { SPH_C32(0x36e70000), SPH_C32(0xc9350000), SPH_C32(0xd7980000), + SPH_C32(0xa32fa000), SPH_C32(0x5a34515e), SPH_C32(0x561c7179), + SPH_C32(0x310ab488), SPH_C32(0xa074fe54), SPH_C32(0xa6430000), + SPH_C32(0x756e0000), SPH_C32(0xbaf60000), SPH_C32(0xa8f2e800), + SPH_C32(0xed1c7314), SPH_C32(0xbada3b36), SPH_C32(0x4494a4eb), + SPH_C32(0xec83ff85) } +}; + +static const sph_u32 T512_51[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xb4310000), SPH_C32(0x77330000), SPH_C32(0xb15d0000), + SPH_C32(0x7fd004e0), SPH_C32(0x78a26138), SPH_C32(0xd116c35d), + SPH_C32(0xd256d489), SPH_C32(0x4e6f74de), SPH_C32(0xe3060000), + SPH_C32(0xbdc10000), SPH_C32(0x87130000), SPH_C32(0xbff20060), + SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), SPH_C32(0x73c5ab06), + SPH_C32(0x5bd61539) }, + { SPH_C32(0xe3060000), SPH_C32(0xbdc10000), SPH_C32(0x87130000), + SPH_C32(0xbff20060), SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), + SPH_C32(0x73c5ab06), SPH_C32(0x5bd61539), SPH_C32(0x57370000), + SPH_C32(0xcaf20000), SPH_C32(0x364e0000), SPH_C32(0xc0220480), + SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), SPH_C32(0xa1937f8f), + SPH_C32(0x15b961e7) }, + { SPH_C32(0x57370000), SPH_C32(0xcaf20000), SPH_C32(0x364e0000), + SPH_C32(0xc0220480), SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), + SPH_C32(0xa1937f8f), SPH_C32(0x15b961e7), SPH_C32(0xb4310000), + SPH_C32(0x77330000), SPH_C32(0xb15d0000), SPH_C32(0x7fd004e0), + SPH_C32(0x78a26138), SPH_C32(0xd116c35d), SPH_C32(0xd256d489), + SPH_C32(0x4e6f74de) }, + { SPH_C32(0x02f20000), SPH_C32(0xa2810000), SPH_C32(0x873f0000), + SPH_C32(0xe36c7800), SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), + SPH_C32(0xc4c23237), SPH_C32(0x7f32259e), SPH_C32(0xbadd0000), + SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), SPH_C32(0xf7282800), + SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), SPH_C32(0xea5a8d14), + SPH_C32(0x2a2c18f0) }, + { SPH_C32(0xb6c30000), SPH_C32(0xd5b20000), SPH_C32(0x36620000), + SPH_C32(0x9cbc7ce0), SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), + SPH_C32(0x1694e6be), SPH_C32(0x315d5140), SPH_C32(0x59db0000), + SPH_C32(0xae6c0000), SPH_C32(0x30f40000), SPH_C32(0x48da2860), + SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), SPH_C32(0x999f2612), + SPH_C32(0x71fa0dc9) }, + { SPH_C32(0xe1f40000), SPH_C32(0x1f400000), SPH_C32(0x002c0000), + SPH_C32(0x5c9e7860), SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), + SPH_C32(0xb7079931), SPH_C32(0x24e430a7), SPH_C32(0xedea0000), + SPH_C32(0xd95f0000), SPH_C32(0x81a90000), SPH_C32(0x370a2c80), + SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), SPH_C32(0x4bc9f29b), + SPH_C32(0x3f957917) }, + { SPH_C32(0x55c50000), SPH_C32(0x68730000), SPH_C32(0xb1710000), + SPH_C32(0x234e7c80), SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), + SPH_C32(0x65514db8), SPH_C32(0x6a8b4479), SPH_C32(0x0eec0000), + SPH_C32(0x649e0000), SPH_C32(0x06ba0000), SPH_C32(0x88f82ce0), + SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), SPH_C32(0x380c599d), + SPH_C32(0x64436c2e) } +}; + +static const sph_u32 T512_54[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x7b280000), SPH_C32(0x57420000), SPH_C32(0xa9e50000), + SPH_C32(0x634300a0), SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), + SPH_C32(0x27f83b03), SPH_C32(0xc7ff60f0), SPH_C32(0x95bb0000), + SPH_C32(0x81450000), SPH_C32(0x3b240000), SPH_C32(0x48db0140), + SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), SPH_C32(0x62c91877), + SPH_C32(0xe7e00a94) }, + { SPH_C32(0xe6280000), SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), + SPH_C32(0xd3d002e0), SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), + SPH_C32(0x289506b4), SPH_C32(0xd75a4897), SPH_C32(0xf0c50000), + SPH_C32(0x59230000), SPH_C32(0x45820000), SPH_C32(0xe18d00c0), + SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), SPH_C32(0xcbe0fe1c), + SPH_C32(0x56a7b19f) }, + { SPH_C32(0x9d000000), SPH_C32(0x1b090000), SPH_C32(0x01b00000), + SPH_C32(0xb0930240), SPH_C32(0x46ba7497), SPH_C32(0xf53e2561), + SPH_C32(0x0f6d3db7), SPH_C32(0x10a52867), SPH_C32(0x657e0000), + SPH_C32(0xd8660000), SPH_C32(0x7ea60000), SPH_C32(0xa9560180), + SPH_C32(0x31e76a62), SPH_C32(0x94183875), SPH_C32(0xa929e66b), + SPH_C32(0xb147bb0b) }, + { SPH_C32(0xf0c50000), SPH_C32(0x59230000), SPH_C32(0x45820000), + SPH_C32(0xe18d00c0), SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), + SPH_C32(0xcbe0fe1c), SPH_C32(0x56a7b19f), SPH_C32(0x16ed0000), + SPH_C32(0x15680000), SPH_C32(0xedd70000), SPH_C32(0x325d0220), + SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), SPH_C32(0xe375f8a8), + SPH_C32(0x81fdf908) }, + { SPH_C32(0x8bed0000), SPH_C32(0x0e610000), SPH_C32(0xec670000), + SPH_C32(0x82ce0060), SPH_C32(0xa5b6421e), SPH_C32(0xaf74c322), + SPH_C32(0xec18c51f), SPH_C32(0x9158d16f), SPH_C32(0x83560000), + SPH_C32(0x942d0000), SPH_C32(0xd6f30000), SPH_C32(0x7a860360), + SPH_C32(0xe9865ada), SPH_C32(0x0cbf88af), SPH_C32(0x81bce0df), + SPH_C32(0x661df39c) }, + { SPH_C32(0x16ed0000), SPH_C32(0x15680000), SPH_C32(0xedd70000), + SPH_C32(0x325d0220), SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), + SPH_C32(0xe375f8a8), SPH_C32(0x81fdf908), SPH_C32(0xe6280000), + SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), SPH_C32(0xd3d002e0), + SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), SPH_C32(0x289506b4), + SPH_C32(0xd75a4897) }, + { SPH_C32(0x6dc50000), SPH_C32(0x422a0000), SPH_C32(0x44320000), + SPH_C32(0x511e0280), SPH_C32(0x7dd772a6), SPH_C32(0x37d373f8), + SPH_C32(0xc48dc3ab), SPH_C32(0x460299f8), SPH_C32(0x73930000), + SPH_C32(0xcd0e0000), SPH_C32(0x93710000), SPH_C32(0x9b0b03a0), + SPH_C32(0xd2eb5ceb), SPH_C32(0xce52de36), SPH_C32(0x4a5c1ec3), + SPH_C32(0x30ba4203) } +}; + +static const sph_u32 T512_57[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x5fa80000), SPH_C32(0x56030000), SPH_C32(0x43ae0000), + SPH_C32(0x64f30013), SPH_C32(0x257e86bf), SPH_C32(0x1311944e), + SPH_C32(0x541e95bf), SPH_C32(0x8ea4db69), SPH_C32(0x00440000), + SPH_C32(0x7f480000), SPH_C32(0xda7c0000), SPH_C32(0x2a230001), + SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), SPH_C32(0x030a9e60), + SPH_C32(0xbe0a679e) }, + { SPH_C32(0x00440000), SPH_C32(0x7f480000), SPH_C32(0xda7c0000), + SPH_C32(0x2a230001), SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), + SPH_C32(0x030a9e60), SPH_C32(0xbe0a679e), SPH_C32(0x5fec0000), + SPH_C32(0x294b0000), SPH_C32(0x99d20000), SPH_C32(0x4ed00012), + SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), SPH_C32(0x57140bdf), + SPH_C32(0x30aebcf7) }, + { SPH_C32(0x5fec0000), SPH_C32(0x294b0000), SPH_C32(0x99d20000), + SPH_C32(0x4ed00012), SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), + SPH_C32(0x57140bdf), SPH_C32(0x30aebcf7), SPH_C32(0x5fa80000), + SPH_C32(0x56030000), SPH_C32(0x43ae0000), SPH_C32(0x64f30013), + SPH_C32(0x257e86bf), SPH_C32(0x1311944e), SPH_C32(0x541e95bf), + SPH_C32(0x8ea4db69) }, + { SPH_C32(0xee930000), SPH_C32(0xd6070000), SPH_C32(0x92c10000), + SPH_C32(0x2b9801e0), SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), + SPH_C32(0x45312374), SPH_C32(0x201f6a64), SPH_C32(0x7b280000), + SPH_C32(0x57420000), SPH_C32(0xa9e50000), SPH_C32(0x634300a0), + SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), SPH_C32(0x27f83b03), + SPH_C32(0xc7ff60f0) }, + { SPH_C32(0xb13b0000), SPH_C32(0x80040000), SPH_C32(0xd16f0000), + SPH_C32(0x4f6b01f3), SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), + SPH_C32(0x112fb6cb), SPH_C32(0xaebbb10d), SPH_C32(0x7b6c0000), + SPH_C32(0x280a0000), SPH_C32(0x73990000), SPH_C32(0x496000a1), + SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), SPH_C32(0x24f2a563), + SPH_C32(0x79f5076e) }, + { SPH_C32(0xeed70000), SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), + SPH_C32(0x01bb01e1), SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), + SPH_C32(0x463bbd14), SPH_C32(0x9e150dfa), SPH_C32(0x24c40000), + SPH_C32(0x7e090000), SPH_C32(0x30370000), SPH_C32(0x2d9300b2), + SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), SPH_C32(0x70ec30dc), + SPH_C32(0xf751dc07) }, + { SPH_C32(0xb17f0000), SPH_C32(0xff4c0000), SPH_C32(0x0b130000), + SPH_C32(0x654801f2), SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), + SPH_C32(0x122528ab), SPH_C32(0x10b1d693), SPH_C32(0x24800000), + SPH_C32(0x01410000), SPH_C32(0xea4b0000), SPH_C32(0x07b000b3), + SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), SPH_C32(0x73e6aebc), + SPH_C32(0x495bbb99) } +}; + +static const sph_u32 T512_60[8][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xa8da0000), SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), + SPH_C32(0x07da0002), SPH_C32(0x7d669583), SPH_C32(0x1f98708a), + SPH_C32(0xbb668808), SPH_C32(0xda878000), SPH_C32(0xabe70000), + SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), SPH_C32(0x3d180005), + SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), SPH_C32(0xb5c347eb), + SPH_C32(0x3c5dfffe) }, + { SPH_C32(0x01930000), SPH_C32(0xe7820000), SPH_C32(0xedfb0000), + SPH_C32(0xcf0c000b), SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), + SPH_C32(0x063661e1), SPH_C32(0x536f9e7b), SPH_C32(0x92280000), + SPH_C32(0xdc850000), SPH_C32(0x57fa0000), SPH_C32(0x56dc0003), + SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), SPH_C32(0x90cef752), + SPH_C32(0x7b1675d7) }, + { SPH_C32(0xa9490000), SPH_C32(0x713c0000), SPH_C32(0xb1e60000), + SPH_C32(0xc8d60009), SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), + SPH_C32(0xbd50e9e9), SPH_C32(0x89e81e7b), SPH_C32(0x39cf0000), + SPH_C32(0x42880000), SPH_C32(0xf8dd0000), SPH_C32(0x6bc40006), + SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), SPH_C32(0x250db0b9), + SPH_C32(0x474b8a29) }, + { SPH_C32(0x92280000), SPH_C32(0xdc850000), SPH_C32(0x57fa0000), + SPH_C32(0x56dc0003), SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), + SPH_C32(0x90cef752), SPH_C32(0x7b1675d7), SPH_C32(0x93bb0000), + SPH_C32(0x3b070000), SPH_C32(0xba010000), SPH_C32(0x99d00008), + SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), SPH_C32(0x96f896b3), + SPH_C32(0x2879ebac) }, + { SPH_C32(0x3af20000), SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), + SPH_C32(0x51060001), SPH_C32(0xc78fb695), SPH_C32(0x4577d386), + SPH_C32(0x2ba87f5a), SPH_C32(0xa191f5d7), SPH_C32(0x385c0000), + SPH_C32(0xa50a0000), SPH_C32(0x15260000), SPH_C32(0xa4c8000d), + SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), SPH_C32(0x233bd158), + SPH_C32(0x14241452) }, + { SPH_C32(0x93bb0000), SPH_C32(0x3b070000), SPH_C32(0xba010000), + SPH_C32(0x99d00008), SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), + SPH_C32(0x96f896b3), SPH_C32(0x2879ebac), SPH_C32(0x01930000), + SPH_C32(0xe7820000), SPH_C32(0xedfb0000), SPH_C32(0xcf0c000b), + SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), SPH_C32(0x063661e1), + SPH_C32(0x536f9e7b) }, + { SPH_C32(0x3b610000), SPH_C32(0xadb90000), SPH_C32(0xe61c0000), + SPH_C32(0x9e0a000a), SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), + SPH_C32(0x2d9e1ebb), SPH_C32(0xf2fe6bac), SPH_C32(0xaa740000), + SPH_C32(0x798f0000), SPH_C32(0x42dc0000), SPH_C32(0xf214000e), + SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), SPH_C32(0xb3f5260a), + SPH_C32(0x6f326185) } +}; + +static const sph_u32 T512_63[2][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x033d0000), SPH_C32(0x08b30000), SPH_C32(0xf33a0000), + SPH_C32(0x3ac20007), SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), + SPH_C32(0x0ea5cfe3), SPH_C32(0xe6da7ffe), SPH_C32(0xa8da0000), + SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), SPH_C32(0x07da0002), + SPH_C32(0x7d669583), SPH_C32(0x1f98708a), SPH_C32(0xbb668808), + SPH_C32(0xda878000) } +}; + +#define INPUT_BIG do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T512_0[acc >> 5][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + m8 = rp[8]; \ + m9 = rp[9]; \ + mA = rp[10]; \ + mB = rp[11]; \ + mC = rp[12]; \ + mD = rp[13]; \ + mE = rp[14]; \ + mF = rp[15]; \ + rp = &T512_3[(acc >> 2) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[1]; \ + rp = &T512_6[(acc >> 7) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_9[(acc >> 4) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_12[(acc >> 1) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[2]; \ + rp = &T512_15[(acc >> 6) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_18[(acc >> 3) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_21[acc & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[3]; \ + rp = &T512_24[acc >> 5][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_27[(acc >> 2) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[4]; \ + rp = &T512_30[(acc >> 7) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_33[(acc >> 4) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_36[(acc >> 1) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[5]; \ + rp = &T512_39[(acc >> 6) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_42[(acc >> 3) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_45[acc & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[6]; \ + rp = &T512_48[acc >> 5][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_51[(acc >> 2) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[7]; \ + rp = &T512_54[(acc >> 7) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_57[(acc >> 4) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_60[(acc >> 1) & 0x07][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_63[acc & 0x01][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_BIG == 4 + +static const sph_u32 T512_0[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x54285c00), SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), + SPH_C32(0xa1c50000), SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), + SPH_C32(0x6bb0419d), SPH_C32(0x551b3782), SPH_C32(0x9cbb1800), + SPH_C32(0xb0d30000), SPH_C32(0x92510000), SPH_C32(0xed930000), + SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), SPH_C32(0x430633da), + SPH_C32(0x78cace29) }, + { SPH_C32(0x9cbb1800), SPH_C32(0xb0d30000), SPH_C32(0x92510000), + SPH_C32(0xed930000), SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), + SPH_C32(0x430633da), SPH_C32(0x78cace29), SPH_C32(0xc8934400), + SPH_C32(0x5a3e0000), SPH_C32(0x57870000), SPH_C32(0x4c560000), + SPH_C32(0xea982435), SPH_C32(0x75b11115), SPH_C32(0x28b67247), + SPH_C32(0x2dd1f9ab) }, + { SPH_C32(0xc8934400), SPH_C32(0x5a3e0000), SPH_C32(0x57870000), + SPH_C32(0x4c560000), SPH_C32(0xea982435), SPH_C32(0x75b11115), + SPH_C32(0x28b67247), SPH_C32(0x2dd1f9ab), SPH_C32(0x54285c00), + SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), SPH_C32(0xa1c50000), + SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), SPH_C32(0x6bb0419d), + SPH_C32(0x551b3782) }, + { SPH_C32(0x29449c00), SPH_C32(0x64e70000), SPH_C32(0xf24b0000), + SPH_C32(0xc2f30000), SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), + SPH_C32(0xf3e04259), SPH_C32(0x8d0d9ec4), SPH_C32(0x466d0c00), + SPH_C32(0x08620000), SPH_C32(0xdd5d0000), SPH_C32(0xbadd0000), + SPH_C32(0x6a927942), SPH_C32(0x441f2b93), SPH_C32(0x218ace6f), + SPH_C32(0xbf2c0be2) }, + { SPH_C32(0x7d6cc000), SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), + SPH_C32(0x63360000), SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), + SPH_C32(0x985003c4), SPH_C32(0xd816a946), SPH_C32(0xdad61400), + SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), SPH_C32(0x574e0000), + SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), SPH_C32(0x628cfdb5), + SPH_C32(0xc7e6c5cb) }, + { SPH_C32(0xb5ff8400), SPH_C32(0xd4340000), SPH_C32(0x601a0000), + SPH_C32(0x2f600000), SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), + SPH_C32(0xb0e67183), SPH_C32(0xf5c750ed), SPH_C32(0x8efe4800), + SPH_C32(0x525c0000), SPH_C32(0x8ada0000), SPH_C32(0xf68b0000), + SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), SPH_C32(0x093cbc28), + SPH_C32(0x92fdf249) }, + { SPH_C32(0xe1d7d800), SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), + SPH_C32(0x8ea50000), SPH_C32(0xe4466aba), SPH_C32(0x23732650), + SPH_C32(0xdb56301e), SPH_C32(0xa0dc676f), SPH_C32(0x12455000), + SPH_C32(0xe28f0000), SPH_C32(0x188b0000), SPH_C32(0x1b180000), + SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), SPH_C32(0x4a3a8ff2), + SPH_C32(0xea373c60) }, + { SPH_C32(0x466d0c00), SPH_C32(0x08620000), SPH_C32(0xdd5d0000), + SPH_C32(0xbadd0000), SPH_C32(0x6a927942), SPH_C32(0x441f2b93), + SPH_C32(0x218ace6f), SPH_C32(0xbf2c0be2), SPH_C32(0x6f299000), + SPH_C32(0x6c850000), SPH_C32(0x2f160000), SPH_C32(0x782e0000), + SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), SPH_C32(0xd26a8c36), + SPH_C32(0x32219526) }, + { SPH_C32(0x12455000), SPH_C32(0xe28f0000), SPH_C32(0x188b0000), + SPH_C32(0x1b180000), SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), + SPH_C32(0x4a3a8ff2), SPH_C32(0xea373c60), SPH_C32(0xf3928800), + SPH_C32(0xdc560000), SPH_C32(0xbd470000), SPH_C32(0x95bd0000), + SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), SPH_C32(0x916cbfec), + SPH_C32(0x4aeb5b0f) }, + { SPH_C32(0xdad61400), SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), + SPH_C32(0x574e0000), SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), + SPH_C32(0x628cfdb5), SPH_C32(0xc7e6c5cb), SPH_C32(0xa7bad400), + SPH_C32(0x36bb0000), SPH_C32(0x78910000), SPH_C32(0x34780000), + SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), SPH_C32(0xfadcfe71), + SPH_C32(0x1ff06c8d) }, + { SPH_C32(0x8efe4800), SPH_C32(0x525c0000), SPH_C32(0x8ada0000), + SPH_C32(0xf68b0000), SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), + SPH_C32(0x093cbc28), SPH_C32(0x92fdf249), SPH_C32(0x3b01cc00), + SPH_C32(0x86680000), SPH_C32(0xeac00000), SPH_C32(0xd9eb0000), + SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), SPH_C32(0xb9dacdab), + SPH_C32(0x673aa2a4) }, + { SPH_C32(0x6f299000), SPH_C32(0x6c850000), SPH_C32(0x2f160000), + SPH_C32(0x782e0000), SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), + SPH_C32(0xd26a8c36), SPH_C32(0x32219526), SPH_C32(0x29449c00), + SPH_C32(0x64e70000), SPH_C32(0xf24b0000), SPH_C32(0xc2f30000), + SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), SPH_C32(0xf3e04259), + SPH_C32(0x8d0d9ec4) }, + { SPH_C32(0x3b01cc00), SPH_C32(0x86680000), SPH_C32(0xeac00000), + SPH_C32(0xd9eb0000), SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), + SPH_C32(0xb9dacdab), SPH_C32(0x673aa2a4), SPH_C32(0xb5ff8400), + SPH_C32(0xd4340000), SPH_C32(0x601a0000), SPH_C32(0x2f600000), + SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), SPH_C32(0xb0e67183), + SPH_C32(0xf5c750ed) }, + { SPH_C32(0xf3928800), SPH_C32(0xdc560000), SPH_C32(0xbd470000), + SPH_C32(0x95bd0000), SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), + SPH_C32(0x916cbfec), SPH_C32(0x4aeb5b0f), SPH_C32(0xe1d7d800), + SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), SPH_C32(0x8ea50000), + SPH_C32(0xe4466aba), SPH_C32(0x23732650), SPH_C32(0xdb56301e), + SPH_C32(0xa0dc676f) }, + { SPH_C32(0xa7bad400), SPH_C32(0x36bb0000), SPH_C32(0x78910000), + SPH_C32(0x34780000), SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), + SPH_C32(0xfadcfe71), SPH_C32(0x1ff06c8d), SPH_C32(0x7d6cc000), + SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), SPH_C32(0x63360000), + SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), SPH_C32(0x985003c4), + SPH_C32(0xd816a946) } +}; + +static const sph_u32 T512_4[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xef0b0270), SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), + SPH_C32(0x69490000), SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), + SPH_C32(0x66140a51), SPH_C32(0x924f5d0a), SPH_C32(0xc96b0030), + SPH_C32(0xe7250000), SPH_C32(0x2f840000), SPH_C32(0x264f0000), + SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), SPH_C32(0x509f6984), + SPH_C32(0x9e69af68) }, + { SPH_C32(0xc96b0030), SPH_C32(0xe7250000), SPH_C32(0x2f840000), + SPH_C32(0x264f0000), SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), + SPH_C32(0x509f6984), SPH_C32(0x9e69af68), SPH_C32(0x26600240), + SPH_C32(0xddd80000), SPH_C32(0x722a0000), SPH_C32(0x4f060000), + SPH_C32(0x936667ff), SPH_C32(0x29f944ce), SPH_C32(0x368b63d5), + SPH_C32(0x0c26f262) }, + { SPH_C32(0x26600240), SPH_C32(0xddd80000), SPH_C32(0x722a0000), + SPH_C32(0x4f060000), SPH_C32(0x936667ff), SPH_C32(0x29f944ce), + SPH_C32(0x368b63d5), SPH_C32(0x0c26f262), SPH_C32(0xef0b0270), + SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), SPH_C32(0x69490000), + SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), SPH_C32(0x66140a51), + SPH_C32(0x924f5d0a) }, + { SPH_C32(0x145a3c00), SPH_C32(0xb9e90000), SPH_C32(0x61270000), + SPH_C32(0xf1610000), SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), + SPH_C32(0x47a96720), SPH_C32(0xe18e24c5), SPH_C32(0x23671400), + SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), SPH_C32(0xfb750000), + SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), SPH_C32(0x02c40a3f), + SPH_C32(0xdc24e61f) }, + { SPH_C32(0xfb513e70), SPH_C32(0x83140000), SPH_C32(0x3c890000), + SPH_C32(0x98280000), SPH_C32(0x556e016a), SPH_C32(0xf44c8881), + SPH_C32(0x21bd6d71), SPH_C32(0x73c179cf), SPH_C32(0xea0c1430), + SPH_C32(0x2f9c0000), SPH_C32(0xdb430000), SPH_C32(0xdd3a0000), + SPH_C32(0x7ba47f9c), SPH_C32(0x955a547e), SPH_C32(0x525b63bb), + SPH_C32(0x424d4977) }, + { SPH_C32(0xdd313c30), SPH_C32(0x5ecc0000), SPH_C32(0x4ea30000), + SPH_C32(0xd72e0000), SPH_C32(0xc6086695), SPH_C32(0xddb5cc4f), + SPH_C32(0x17360ea4), SPH_C32(0x7fe78bad), SPH_C32(0x05071640), + SPH_C32(0x15610000), SPH_C32(0x86ed0000), SPH_C32(0xb4730000), + SPH_C32(0xe0ab439a), SPH_C32(0xd15fe187), SPH_C32(0x344f69ea), + SPH_C32(0xd002147d) }, + { SPH_C32(0x323a3e40), SPH_C32(0x64310000), SPH_C32(0x130d0000), + SPH_C32(0xbe670000), SPH_C32(0x5d075a93), SPH_C32(0x99b079b6), + SPH_C32(0x712204f5), SPH_C32(0xeda8d6a7), SPH_C32(0xcc6c1670), + SPH_C32(0xf2440000), SPH_C32(0xa9690000), SPH_C32(0x923c0000), + SPH_C32(0xe8c21863), SPH_C32(0xbca310b0), SPH_C32(0x64d0006e), + SPH_C32(0x4e6bbb15) }, + { SPH_C32(0x23671400), SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), + SPH_C32(0xfb750000), SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), + SPH_C32(0x02c40a3f), SPH_C32(0xdc24e61f), SPH_C32(0x373d2800), + SPH_C32(0x71500000), SPH_C32(0x95e00000), SPH_C32(0x0a140000), + SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), SPH_C32(0x456d6d1f), + SPH_C32(0x3daac2da) }, + { SPH_C32(0xcc6c1670), SPH_C32(0xf2440000), SPH_C32(0xa9690000), + SPH_C32(0x923c0000), SPH_C32(0xe8c21863), SPH_C32(0xbca310b0), + SPH_C32(0x64d0006e), SPH_C32(0x4e6bbb15), SPH_C32(0xfe562830), + SPH_C32(0x96750000), SPH_C32(0xba640000), SPH_C32(0x2c5b0000), + SPH_C32(0xb5c542f0), SPH_C32(0x25136906), SPH_C32(0x15f2049b), + SPH_C32(0xa3c36db2) }, + { SPH_C32(0xea0c1430), SPH_C32(0x2f9c0000), SPH_C32(0xdb430000), + SPH_C32(0xdd3a0000), SPH_C32(0x7ba47f9c), SPH_C32(0x955a547e), + SPH_C32(0x525b63bb), SPH_C32(0x424d4977), SPH_C32(0x115d2a40), + SPH_C32(0xac880000), SPH_C32(0xe7ca0000), SPH_C32(0x45120000), + SPH_C32(0x2eca7ef6), SPH_C32(0x6116dcff), SPH_C32(0x73e60eca), + SPH_C32(0x318c30b8) }, + { SPH_C32(0x05071640), SPH_C32(0x15610000), SPH_C32(0x86ed0000), + SPH_C32(0xb4730000), SPH_C32(0xe0ab439a), SPH_C32(0xd15fe187), + SPH_C32(0x344f69ea), SPH_C32(0xd002147d), SPH_C32(0xd8362a70), + SPH_C32(0x4bad0000), SPH_C32(0xc84e0000), SPH_C32(0x635d0000), + SPH_C32(0x26a3250f), SPH_C32(0x0cea2dc8), SPH_C32(0x2379674e), + SPH_C32(0xafe59fd0) }, + { SPH_C32(0x373d2800), SPH_C32(0x71500000), SPH_C32(0x95e00000), + SPH_C32(0x0a140000), SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), + SPH_C32(0x456d6d1f), SPH_C32(0x3daac2da), SPH_C32(0x145a3c00), + SPH_C32(0xb9e90000), SPH_C32(0x61270000), SPH_C32(0xf1610000), + SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), SPH_C32(0x47a96720), + SPH_C32(0xe18e24c5) }, + { SPH_C32(0xd8362a70), SPH_C32(0x4bad0000), SPH_C32(0xc84e0000), + SPH_C32(0x635d0000), SPH_C32(0x26a3250f), SPH_C32(0x0cea2dc8), + SPH_C32(0x2379674e), SPH_C32(0xafe59fd0), SPH_C32(0xdd313c30), + SPH_C32(0x5ecc0000), SPH_C32(0x4ea30000), SPH_C32(0xd72e0000), + SPH_C32(0xc6086695), SPH_C32(0xddb5cc4f), SPH_C32(0x17360ea4), + SPH_C32(0x7fe78bad) }, + { SPH_C32(0xfe562830), SPH_C32(0x96750000), SPH_C32(0xba640000), + SPH_C32(0x2c5b0000), SPH_C32(0xb5c542f0), SPH_C32(0x25136906), + SPH_C32(0x15f2049b), SPH_C32(0xa3c36db2), SPH_C32(0x323a3e40), + SPH_C32(0x64310000), SPH_C32(0x130d0000), SPH_C32(0xbe670000), + SPH_C32(0x5d075a93), SPH_C32(0x99b079b6), SPH_C32(0x712204f5), + SPH_C32(0xeda8d6a7) }, + { SPH_C32(0x115d2a40), SPH_C32(0xac880000), SPH_C32(0xe7ca0000), + SPH_C32(0x45120000), SPH_C32(0x2eca7ef6), SPH_C32(0x6116dcff), + SPH_C32(0x73e60eca), SPH_C32(0x318c30b8), SPH_C32(0xfb513e70), + SPH_C32(0x83140000), SPH_C32(0x3c890000), SPH_C32(0x98280000), + SPH_C32(0x556e016a), SPH_C32(0xf44c8881), SPH_C32(0x21bd6d71), + SPH_C32(0x73c179cf) } +}; + +static const sph_u32 T512_8[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x774400f0), SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), + SPH_C32(0x34140000), SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), + SPH_C32(0x0bc3cd1e), SPH_C32(0xcf3775cb), SPH_C32(0xf46c0050), + SPH_C32(0x96180000), SPH_C32(0x14a50000), SPH_C32(0x031f0000), + SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), SPH_C32(0x9ca470d2), + SPH_C32(0x8a341574) }, + { SPH_C32(0xf46c0050), SPH_C32(0x96180000), SPH_C32(0x14a50000), + SPH_C32(0x031f0000), SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), + SPH_C32(0x9ca470d2), SPH_C32(0x8a341574), SPH_C32(0x832800a0), + SPH_C32(0x67420000), SPH_C32(0xe1170000), SPH_C32(0x370b0000), + SPH_C32(0xcba30034), SPH_C32(0x3c34923c), SPH_C32(0x9767bdcc), + SPH_C32(0x450360bf) }, + { SPH_C32(0x832800a0), SPH_C32(0x67420000), SPH_C32(0xe1170000), + SPH_C32(0x370b0000), SPH_C32(0xcba30034), SPH_C32(0x3c34923c), + SPH_C32(0x9767bdcc), SPH_C32(0x450360bf), SPH_C32(0x774400f0), + SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), SPH_C32(0x34140000), + SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), SPH_C32(0x0bc3cd1e), + SPH_C32(0xcf3775cb) }, + { SPH_C32(0xe8870170), SPH_C32(0x9d720000), SPH_C32(0x12db0000), + SPH_C32(0xd4220000), SPH_C32(0xf2886b27), SPH_C32(0xa921e543), + SPH_C32(0x4ef8b518), SPH_C32(0x618813b1), SPH_C32(0xb4370060), + SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), SPH_C32(0x5cae0000), + SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), SPH_C32(0x1b365f3d), + SPH_C32(0xf3d45758) }, + { SPH_C32(0x9fc30180), SPH_C32(0x6c280000), SPH_C32(0xe7690000), + SPH_C32(0xe0360000), SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), + SPH_C32(0x453b7806), SPH_C32(0xaebf667a), SPH_C32(0x405b0030), + SPH_C32(0x9a540000), SPH_C32(0x42670000), SPH_C32(0x5fb10000), + SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), SPH_C32(0x87922fef), + SPH_C32(0x79e0422c) }, + { SPH_C32(0x1ceb0120), SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), + SPH_C32(0xd73d0000), SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), + SPH_C32(0xd25cc5ca), SPH_C32(0xebbc06c5), SPH_C32(0x371f00c0), + SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), SPH_C32(0x6ba50000), + SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), SPH_C32(0x8c51e2f1), + SPH_C32(0xb6d737e7) }, + { SPH_C32(0x6baf01d0), SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), + SPH_C32(0xe3290000), SPH_C32(0x392b6b13), SPH_C32(0x9515777f), + SPH_C32(0xd99f08d4), SPH_C32(0x248b730e), SPH_C32(0xc3730090), + SPH_C32(0xfd160000), SPH_C32(0xa3700000), SPH_C32(0x68ba0000), + SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), SPH_C32(0x10f59223), + SPH_C32(0x3ce32293) }, + { SPH_C32(0xb4370060), SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), + SPH_C32(0x5cae0000), SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), + SPH_C32(0x1b365f3d), SPH_C32(0xf3d45758), SPH_C32(0x5cb00110), + SPH_C32(0x913e0000), SPH_C32(0x44190000), SPH_C32(0x888c0000), + SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), SPH_C32(0x55ceea25), + SPH_C32(0x925c44e9) }, + { SPH_C32(0xc3730090), SPH_C32(0xfd160000), SPH_C32(0xa3700000), + SPH_C32(0x68ba0000), SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), + SPH_C32(0x10f59223), SPH_C32(0x3ce32293), SPH_C32(0xa8dc0140), + SPH_C32(0x07260000), SPH_C32(0x50bc0000), SPH_C32(0x8b930000), + SPH_C32(0x24480aa0), SPH_C32(0xf4a0637f), SPH_C32(0xc96a9af7), + SPH_C32(0x1868519d) }, + { SPH_C32(0x405b0030), SPH_C32(0x9a540000), SPH_C32(0x42670000), + SPH_C32(0x5fb10000), SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), + SPH_C32(0x87922fef), SPH_C32(0x79e0422c), SPH_C32(0xdf9801b0), + SPH_C32(0xf67c0000), SPH_C32(0xa50e0000), SPH_C32(0xbf870000), + SPH_C32(0xad7f742c), SPH_C32(0xae2b8f5a), SPH_C32(0xc2a957e9), + SPH_C32(0xd75f2456) }, + { SPH_C32(0x371f00c0), SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), + SPH_C32(0x6ba50000), SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), + SPH_C32(0x8c51e2f1), SPH_C32(0xb6d737e7), SPH_C32(0x2bf401e0), + SPH_C32(0x60640000), SPH_C32(0xb1ab0000), SPH_C32(0xbc980000), + SPH_C32(0xefeb0a94), SPH_C32(0xc894f143), SPH_C32(0x5e0d273b), + SPH_C32(0x5d6b3122) }, + { SPH_C32(0x5cb00110), SPH_C32(0x913e0000), SPH_C32(0x44190000), + SPH_C32(0x888c0000), SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), + SPH_C32(0x55ceea25), SPH_C32(0x925c44e9), SPH_C32(0xe8870170), + SPH_C32(0x9d720000), SPH_C32(0x12db0000), SPH_C32(0xd4220000), + SPH_C32(0xf2886b27), SPH_C32(0xa921e543), SPH_C32(0x4ef8b518), + SPH_C32(0x618813b1) }, + { SPH_C32(0x2bf401e0), SPH_C32(0x60640000), SPH_C32(0xb1ab0000), + SPH_C32(0xbc980000), SPH_C32(0xefeb0a94), SPH_C32(0xc894f143), + SPH_C32(0x5e0d273b), SPH_C32(0x5d6b3122), SPH_C32(0x1ceb0120), + SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), SPH_C32(0xd73d0000), + SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), SPH_C32(0xd25cc5ca), + SPH_C32(0xebbc06c5) }, + { SPH_C32(0xa8dc0140), SPH_C32(0x07260000), SPH_C32(0x50bc0000), + SPH_C32(0x8b930000), SPH_C32(0x24480aa0), SPH_C32(0xf4a0637f), + SPH_C32(0xc96a9af7), SPH_C32(0x1868519d), SPH_C32(0x6baf01d0), + SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), SPH_C32(0xe3290000), + SPH_C32(0x392b6b13), SPH_C32(0x9515777f), SPH_C32(0xd99f08d4), + SPH_C32(0x248b730e) }, + { SPH_C32(0xdf9801b0), SPH_C32(0xf67c0000), SPH_C32(0xa50e0000), + SPH_C32(0xbf870000), SPH_C32(0xad7f742c), SPH_C32(0xae2b8f5a), + SPH_C32(0xc2a957e9), SPH_C32(0xd75f2456), SPH_C32(0x9fc30180), + SPH_C32(0x6c280000), SPH_C32(0xe7690000), SPH_C32(0xe0360000), + SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), SPH_C32(0x453b7806), + SPH_C32(0xaebf667a) } +}; + +static const sph_u32 T512_12[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xf6800005), SPH_C32(0x3443c000), SPH_C32(0x24070000), + SPH_C32(0x8f3d0000), SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), + SPH_C32(0xcdc58b19), SPH_C32(0xd795ba31), SPH_C32(0xa67f0001), + SPH_C32(0x71378000), SPH_C32(0x19fc0000), SPH_C32(0x96db0000), + SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), SPH_C32(0x2c6d478f), + SPH_C32(0xac8e6c88) }, + { SPH_C32(0xa67f0001), SPH_C32(0x71378000), SPH_C32(0x19fc0000), + SPH_C32(0x96db0000), SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), + SPH_C32(0x2c6d478f), SPH_C32(0xac8e6c88), SPH_C32(0x50ff0004), + SPH_C32(0x45744000), SPH_C32(0x3dfb0000), SPH_C32(0x19e60000), + SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), SPH_C32(0xe1a8cc96), + SPH_C32(0x7b1bd6b9) }, + { SPH_C32(0x50ff0004), SPH_C32(0x45744000), SPH_C32(0x3dfb0000), + SPH_C32(0x19e60000), SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), + SPH_C32(0xe1a8cc96), SPH_C32(0x7b1bd6b9), SPH_C32(0xf6800005), + SPH_C32(0x3443c000), SPH_C32(0x24070000), SPH_C32(0x8f3d0000), + SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), SPH_C32(0xcdc58b19), + SPH_C32(0xd795ba31) }, + { SPH_C32(0xf7750009), SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), + SPH_C32(0x04920000), SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), + SPH_C32(0x7a87f14e), SPH_C32(0x9e16981a), SPH_C32(0xd46a0000), + SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), SPH_C32(0x4a290000), + SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), SPH_C32(0x98369604), + SPH_C32(0xf746c320) }, + { SPH_C32(0x01f5000c), SPH_C32(0xfb7f0000), SPH_C32(0xe7d10000), + SPH_C32(0x8baf0000), SPH_C32(0x23a22252), SPH_C32(0xf250e314), + SPH_C32(0xb7427a57), SPH_C32(0x4983222b), SPH_C32(0x72150001), + SPH_C32(0xfcff4000), SPH_C32(0xbc530000), SPH_C32(0xdcf20000), + SPH_C32(0xc6c52f87), SPH_C32(0x227e289f), SPH_C32(0xb45bd18b), + SPH_C32(0x5bc8afa8) }, + { SPH_C32(0x510a0008), SPH_C32(0xbe0b4000), SPH_C32(0xda2a0000), + SPH_C32(0x92490000), SPH_C32(0x381e7454), SPH_C32(0x13229849), + SPH_C32(0x56eab6c1), SPH_C32(0x3298f492), SPH_C32(0x84950004), + SPH_C32(0xc8bc8000), SPH_C32(0x98540000), SPH_C32(0x53cf0000), + SPH_C32(0xe7f2147c), SPH_C32(0x28c6fd31), SPH_C32(0x799e5a92), + SPH_C32(0x8c5d1599) }, + { SPH_C32(0xa78a000d), SPH_C32(0x8a488000), SPH_C32(0xfe2d0000), + SPH_C32(0x1d740000), SPH_C32(0x19294faf), SPH_C32(0x199a4de7), + SPH_C32(0x9b2f3dd8), SPH_C32(0xe50d4ea3), SPH_C32(0x22ea0005), + SPH_C32(0xb98b0000), SPH_C32(0x81a80000), SPH_C32(0xc5140000), + SPH_C32(0xdd797981), SPH_C32(0xc30c53c2), SPH_C32(0x55f31d1d), + SPH_C32(0x20d37911) }, + { SPH_C32(0xd46a0000), SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), + SPH_C32(0x4a290000), SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), + SPH_C32(0x98369604), SPH_C32(0xf746c320), SPH_C32(0x231f0009), + SPH_C32(0x42f40000), SPH_C32(0x66790000), SPH_C32(0x4ebb0000), + SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), SPH_C32(0xe2b1674a), + SPH_C32(0x69505b3a) }, + { SPH_C32(0x22ea0005), SPH_C32(0xb98b0000), SPH_C32(0x81a80000), + SPH_C32(0xc5140000), SPH_C32(0xdd797981), SPH_C32(0xc30c53c2), + SPH_C32(0x55f31d1d), SPH_C32(0x20d37911), SPH_C32(0x85600008), + SPH_C32(0x33c38000), SPH_C32(0x7f850000), SPH_C32(0xd8600000), + SPH_C32(0xc450362e), SPH_C32(0xda961e25), SPH_C32(0xcedc20c5), + SPH_C32(0xc5de37b2) }, + { SPH_C32(0x72150001), SPH_C32(0xfcff4000), SPH_C32(0xbc530000), + SPH_C32(0xdcf20000), SPH_C32(0xc6c52f87), SPH_C32(0x227e289f), + SPH_C32(0xb45bd18b), SPH_C32(0x5bc8afa8), SPH_C32(0x73e0000d), + SPH_C32(0x07804000), SPH_C32(0x5b820000), SPH_C32(0x575d0000), + SPH_C32(0xe5670dd5), SPH_C32(0xd02ecb8b), SPH_C32(0x0319abdc), + SPH_C32(0x124b8d83) }, + { SPH_C32(0x84950004), SPH_C32(0xc8bc8000), SPH_C32(0x98540000), + SPH_C32(0x53cf0000), SPH_C32(0xe7f2147c), SPH_C32(0x28c6fd31), + SPH_C32(0x799e5a92), SPH_C32(0x8c5d1599), SPH_C32(0xd59f000c), + SPH_C32(0x76b7c000), SPH_C32(0x427e0000), SPH_C32(0xc1860000), + SPH_C32(0xdfec6028), SPH_C32(0x3be46578), SPH_C32(0x2f74ec53), + SPH_C32(0xbec5e10b) }, + { SPH_C32(0x231f0009), SPH_C32(0x42f40000), SPH_C32(0x66790000), + SPH_C32(0x4ebb0000), SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), + SPH_C32(0xe2b1674a), SPH_C32(0x69505b3a), SPH_C32(0xf7750009), + SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), SPH_C32(0x04920000), + SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), SPH_C32(0x7a87f14e), + SPH_C32(0x9e16981a) }, + { SPH_C32(0xd59f000c), SPH_C32(0x76b7c000), SPH_C32(0x427e0000), + SPH_C32(0xc1860000), SPH_C32(0xdfec6028), SPH_C32(0x3be46578), + SPH_C32(0x2f74ec53), SPH_C32(0xbec5e10b), SPH_C32(0x510a0008), + SPH_C32(0xbe0b4000), SPH_C32(0xda2a0000), SPH_C32(0x92490000), + SPH_C32(0x381e7454), SPH_C32(0x13229849), SPH_C32(0x56eab6c1), + SPH_C32(0x3298f492) }, + { SPH_C32(0x85600008), SPH_C32(0x33c38000), SPH_C32(0x7f850000), + SPH_C32(0xd8600000), SPH_C32(0xc450362e), SPH_C32(0xda961e25), + SPH_C32(0xcedc20c5), SPH_C32(0xc5de37b2), SPH_C32(0xa78a000d), + SPH_C32(0x8a488000), SPH_C32(0xfe2d0000), SPH_C32(0x1d740000), + SPH_C32(0x19294faf), SPH_C32(0x199a4de7), SPH_C32(0x9b2f3dd8), + SPH_C32(0xe50d4ea3) }, + { SPH_C32(0x73e0000d), SPH_C32(0x07804000), SPH_C32(0x5b820000), + SPH_C32(0x575d0000), SPH_C32(0xe5670dd5), SPH_C32(0xd02ecb8b), + SPH_C32(0x0319abdc), SPH_C32(0x124b8d83), SPH_C32(0x01f5000c), + SPH_C32(0xfb7f0000), SPH_C32(0xe7d10000), SPH_C32(0x8baf0000), + SPH_C32(0x23a22252), SPH_C32(0xf250e314), SPH_C32(0xb7427a57), + SPH_C32(0x4983222b) } +}; + +static const sph_u32 T512_16[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x75a40000), SPH_C32(0xc28b2700), SPH_C32(0x94a40000), + SPH_C32(0x90f50000), SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), + SPH_C32(0x1767c483), SPH_C32(0xaedf667e), SPH_C32(0xd1660000), + SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), SPH_C32(0xf6940000), + SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), SPH_C32(0xb4431b17), + SPH_C32(0x857f3c2b) }, + { SPH_C32(0xd1660000), SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), + SPH_C32(0xf6940000), SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), + SPH_C32(0xb4431b17), SPH_C32(0x857f3c2b), SPH_C32(0xa4c20000), + SPH_C32(0xd9372400), SPH_C32(0x0a480000), SPH_C32(0x66610000), + SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), SPH_C32(0xa324df94), + SPH_C32(0x2ba05a55) }, + { SPH_C32(0xa4c20000), SPH_C32(0xd9372400), SPH_C32(0x0a480000), + SPH_C32(0x66610000), SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), + SPH_C32(0xa324df94), SPH_C32(0x2ba05a55), SPH_C32(0x75a40000), + SPH_C32(0xc28b2700), SPH_C32(0x94a40000), SPH_C32(0x90f50000), + SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), SPH_C32(0x1767c483), + SPH_C32(0xaedf667e) }, + { SPH_C32(0x75c90003), SPH_C32(0x0e10c000), SPH_C32(0xd1200000), + SPH_C32(0xbaea0000), SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), + SPH_C32(0xbb28761d), SPH_C32(0x00b72e2b), SPH_C32(0xeecf0001), + SPH_C32(0x6f564000), SPH_C32(0xf33e0000), SPH_C32(0xa79e0000), + SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), SPH_C32(0x4a3b40ba), + SPH_C32(0xfeabf254) }, + { SPH_C32(0x006d0003), SPH_C32(0xcc9be700), SPH_C32(0x45840000), + SPH_C32(0x2a1f0000), SPH_C32(0x70bc78de), SPH_C32(0xce96bcf9), + SPH_C32(0xac4fb29e), SPH_C32(0xae684855), SPH_C32(0x3fa90001), + SPH_C32(0x74ea4300), SPH_C32(0x6dd20000), SPH_C32(0x510a0000), + SPH_C32(0xbeb7373e), SPH_C32(0x78611737), SPH_C32(0xfe785bad), + SPH_C32(0x7bd4ce7f) }, + { SPH_C32(0xa4af0003), SPH_C32(0x15acc300), SPH_C32(0x4fcc0000), + SPH_C32(0x4c7e0000), SPH_C32(0x88c66a19), SPH_C32(0x48284ba5), + SPH_C32(0x0f6b6d0a), SPH_C32(0x85c81200), SPH_C32(0x4a0d0001), + SPH_C32(0xb6616400), SPH_C32(0xf9760000), SPH_C32(0xc1ff0000), + SPH_C32(0x45cf60de), SPH_C32(0x31af1c99), SPH_C32(0xe91f9f2e), + SPH_C32(0xd50ba801) }, + { SPH_C32(0xd10b0003), SPH_C32(0xd727e400), SPH_C32(0xdb680000), + SPH_C32(0xdc8b0000), SPH_C32(0x73be3df9), SPH_C32(0x01e6400b), + SPH_C32(0x180ca989), SPH_C32(0x2b17747e), SPH_C32(0x9b6b0001), + SPH_C32(0xaddd6700), SPH_C32(0x679a0000), SPH_C32(0x376b0000), + SPH_C32(0x46cd25f9), SPH_C32(0xfedfe06b), SPH_C32(0x5d5c8439), + SPH_C32(0x5074942a) }, + { SPH_C32(0xeecf0001), SPH_C32(0x6f564000), SPH_C32(0xf33e0000), + SPH_C32(0xa79e0000), SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), + SPH_C32(0x4a3b40ba), SPH_C32(0xfeabf254), SPH_C32(0x9b060002), + SPH_C32(0x61468000), SPH_C32(0x221e0000), SPH_C32(0x1d740000), + SPH_C32(0x36715d27), SPH_C32(0x30495c92), SPH_C32(0xf11336a7), + SPH_C32(0xfe1cdc7f) }, + { SPH_C32(0x9b6b0001), SPH_C32(0xaddd6700), SPH_C32(0x679a0000), + SPH_C32(0x376b0000), SPH_C32(0x46cd25f9), SPH_C32(0xfedfe06b), + SPH_C32(0x5d5c8439), SPH_C32(0x5074942a), SPH_C32(0x4a600002), + SPH_C32(0x7afa8300), SPH_C32(0xbcf20000), SPH_C32(0xebe00000), + SPH_C32(0x35731800), SPH_C32(0xff39a060), SPH_C32(0x45502db0), + SPH_C32(0x7b63e054) }, + { SPH_C32(0x3fa90001), SPH_C32(0x74ea4300), SPH_C32(0x6dd20000), + SPH_C32(0x510a0000), SPH_C32(0xbeb7373e), SPH_C32(0x78611737), + SPH_C32(0xfe785bad), SPH_C32(0x7bd4ce7f), SPH_C32(0x3fc40002), + SPH_C32(0xb871a400), SPH_C32(0x28560000), SPH_C32(0x7b150000), + SPH_C32(0xce0b4fe0), SPH_C32(0xb6f7abce), SPH_C32(0x5237e933), + SPH_C32(0xd5bc862a) }, + { SPH_C32(0x4a0d0001), SPH_C32(0xb6616400), SPH_C32(0xf9760000), + SPH_C32(0xc1ff0000), SPH_C32(0x45cf60de), SPH_C32(0x31af1c99), + SPH_C32(0xe91f9f2e), SPH_C32(0xd50ba801), SPH_C32(0xeea20002), + SPH_C32(0xa3cda700), SPH_C32(0xb6ba0000), SPH_C32(0x8d810000), + SPH_C32(0xcd090ac7), SPH_C32(0x7987573c), SPH_C32(0xe674f224), + SPH_C32(0x50c3ba01) }, + { SPH_C32(0x9b060002), SPH_C32(0x61468000), SPH_C32(0x221e0000), + SPH_C32(0x1d740000), SPH_C32(0x36715d27), SPH_C32(0x30495c92), + SPH_C32(0xf11336a7), SPH_C32(0xfe1cdc7f), SPH_C32(0x75c90003), + SPH_C32(0x0e10c000), SPH_C32(0xd1200000), SPH_C32(0xbaea0000), + SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), SPH_C32(0xbb28761d), + SPH_C32(0x00b72e2b) }, + { SPH_C32(0xeea20002), SPH_C32(0xa3cda700), SPH_C32(0xb6ba0000), + SPH_C32(0x8d810000), SPH_C32(0xcd090ac7), SPH_C32(0x7987573c), + SPH_C32(0xe674f224), SPH_C32(0x50c3ba01), SPH_C32(0xa4af0003), + SPH_C32(0x15acc300), SPH_C32(0x4fcc0000), SPH_C32(0x4c7e0000), + SPH_C32(0x88c66a19), SPH_C32(0x48284ba5), SPH_C32(0x0f6b6d0a), + SPH_C32(0x85c81200) }, + { SPH_C32(0x4a600002), SPH_C32(0x7afa8300), SPH_C32(0xbcf20000), + SPH_C32(0xebe00000), SPH_C32(0x35731800), SPH_C32(0xff39a060), + SPH_C32(0x45502db0), SPH_C32(0x7b63e054), SPH_C32(0xd10b0003), + SPH_C32(0xd727e400), SPH_C32(0xdb680000), SPH_C32(0xdc8b0000), + SPH_C32(0x73be3df9), SPH_C32(0x01e6400b), SPH_C32(0x180ca989), + SPH_C32(0x2b17747e) }, + { SPH_C32(0x3fc40002), SPH_C32(0xb871a400), SPH_C32(0x28560000), + SPH_C32(0x7b150000), SPH_C32(0xce0b4fe0), SPH_C32(0xb6f7abce), + SPH_C32(0x5237e933), SPH_C32(0xd5bc862a), SPH_C32(0x006d0003), + SPH_C32(0xcc9be700), SPH_C32(0x45840000), SPH_C32(0x2a1f0000), + SPH_C32(0x70bc78de), SPH_C32(0xce96bcf9), SPH_C32(0xac4fb29e), + SPH_C32(0xae684855) } +}; + +static const sph_u32 T512_20[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x0c720000), SPH_C32(0x49e50f00), SPH_C32(0x42790000), + SPH_C32(0x5cea0000), SPH_C32(0x33aa301a), SPH_C32(0x15822514), + SPH_C32(0x95a34b7b), SPH_C32(0xb44b0090), SPH_C32(0xfe220000), + SPH_C32(0xa7580500), SPH_C32(0x25d10000), SPH_C32(0xf7600000), + SPH_C32(0x893178da), SPH_C32(0x1fd4f860), SPH_C32(0x4ed0a315), + SPH_C32(0xa123ff9f) }, + { SPH_C32(0xfe220000), SPH_C32(0xa7580500), SPH_C32(0x25d10000), + SPH_C32(0xf7600000), SPH_C32(0x893178da), SPH_C32(0x1fd4f860), + SPH_C32(0x4ed0a315), SPH_C32(0xa123ff9f), SPH_C32(0xf2500000), + SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), SPH_C32(0xab8a0000), + SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), SPH_C32(0xdb73e86e), + SPH_C32(0x1568ff0f) }, + { SPH_C32(0xf2500000), SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), + SPH_C32(0xab8a0000), SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), + SPH_C32(0xdb73e86e), SPH_C32(0x1568ff0f), SPH_C32(0x0c720000), + SPH_C32(0x49e50f00), SPH_C32(0x42790000), SPH_C32(0x5cea0000), + SPH_C32(0x33aa301a), SPH_C32(0x15822514), SPH_C32(0x95a34b7b), + SPH_C32(0xb44b0090) }, + { SPH_C32(0x45180000), SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), + SPH_C32(0x3b480000), SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), + SPH_C32(0x16bca6b0), SPH_C32(0xdf33f4df), SPH_C32(0xb83d0000), + SPH_C32(0x16710600), SPH_C32(0x379a0000), SPH_C32(0xf5b10000), + SPH_C32(0x228161ac), SPH_C32(0xae48f145), SPH_C32(0x66241616), + SPH_C32(0xc5c1eb3e) }, + { SPH_C32(0x496a0000), SPH_C32(0xec501800), SPH_C32(0xbb130000), + SPH_C32(0x67a20000), SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), + SPH_C32(0x831fedcb), SPH_C32(0x6b78f44f), SPH_C32(0x461f0000), + SPH_C32(0xb1290300), SPH_C32(0x124b0000), SPH_C32(0x02d10000), + SPH_C32(0xabb01976), SPH_C32(0xb19c0925), SPH_C32(0x28f4b503), + SPH_C32(0x64e214a1) }, + { SPH_C32(0xbb3a0000), SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), + SPH_C32(0xcc280000), SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), + SPH_C32(0x586c05a5), SPH_C32(0x7e100b40), SPH_C32(0x4a6d0000), + SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), SPH_C32(0x5e3b0000), + SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), SPH_C32(0xbd57fe78), + SPH_C32(0xd0a91431) }, + { SPH_C32(0xb7480000), SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), + SPH_C32(0x90c20000), SPH_C32(0xa4575cec), SPH_C32(0x294548a2), + SPH_C32(0xcdcf4ede), SPH_C32(0xca5b0bd0), SPH_C32(0xb44f0000), + SPH_C32(0x5f940900), SPH_C32(0x75e30000), SPH_C32(0xa95b0000), + SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), SPH_C32(0xf3875d6d), + SPH_C32(0x718aebae) }, + { SPH_C32(0xb83d0000), SPH_C32(0x16710600), SPH_C32(0x379a0000), + SPH_C32(0xf5b10000), SPH_C32(0x228161ac), SPH_C32(0xae48f145), + SPH_C32(0x66241616), SPH_C32(0xc5c1eb3e), SPH_C32(0xfd250000), + SPH_C32(0xb3c41100), SPH_C32(0xcef00000), SPH_C32(0xcef90000), + SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), SPH_C32(0x7098b0a6), + SPH_C32(0x1af21fe1) }, + { SPH_C32(0xb44f0000), SPH_C32(0x5f940900), SPH_C32(0x75e30000), + SPH_C32(0xa95b0000), SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), + SPH_C32(0xf3875d6d), SPH_C32(0x718aebae), SPH_C32(0x03070000), + SPH_C32(0x149c1400), SPH_C32(0xeb210000), SPH_C32(0x39990000), + SPH_C32(0xb57c0d5a), SPH_C32(0x928f9cf3), SPH_C32(0x3e4813b3), + SPH_C32(0xbbd1e07e) }, + { SPH_C32(0x461f0000), SPH_C32(0xb1290300), SPH_C32(0x124b0000), + SPH_C32(0x02d10000), SPH_C32(0xabb01976), SPH_C32(0xb19c0925), + SPH_C32(0x28f4b503), SPH_C32(0x64e214a1), SPH_C32(0x0f750000), + SPH_C32(0x5d791b00), SPH_C32(0xa9580000), SPH_C32(0x65730000), + SPH_C32(0x86d63d40), SPH_C32(0x870db9e7), SPH_C32(0xabeb58c8), + SPH_C32(0x0f9ae0ee) }, + { SPH_C32(0x4a6d0000), SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), + SPH_C32(0x5e3b0000), SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), + SPH_C32(0xbd57fe78), SPH_C32(0xd0a91431), SPH_C32(0xf1570000), + SPH_C32(0xfa211e00), SPH_C32(0x8c890000), SPH_C32(0x92130000), + SPH_C32(0x0fe7459a), SPH_C32(0x98d94187), SPH_C32(0xe53bfbdd), + SPH_C32(0xaeb91f71) }, + { SPH_C32(0xfd250000), SPH_C32(0xb3c41100), SPH_C32(0xcef00000), + SPH_C32(0xcef90000), SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), + SPH_C32(0x7098b0a6), SPH_C32(0x1af21fe1), SPH_C32(0x45180000), + SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), SPH_C32(0x3b480000), + SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), SPH_C32(0x16bca6b0), + SPH_C32(0xdf33f4df) }, + { SPH_C32(0xf1570000), SPH_C32(0xfa211e00), SPH_C32(0x8c890000), + SPH_C32(0x92130000), SPH_C32(0x0fe7459a), SPH_C32(0x98d94187), + SPH_C32(0xe53bfbdd), SPH_C32(0xaeb91f71), SPH_C32(0xbb3a0000), + SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), SPH_C32(0xcc280000), + SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), SPH_C32(0x586c05a5), + SPH_C32(0x7e100b40) }, + { SPH_C32(0x03070000), SPH_C32(0x149c1400), SPH_C32(0xeb210000), + SPH_C32(0x39990000), SPH_C32(0xb57c0d5a), SPH_C32(0x928f9cf3), + SPH_C32(0x3e4813b3), SPH_C32(0xbbd1e07e), SPH_C32(0xb7480000), + SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), SPH_C32(0x90c20000), + SPH_C32(0xa4575cec), SPH_C32(0x294548a2), SPH_C32(0xcdcf4ede), + SPH_C32(0xca5b0bd0) }, + { SPH_C32(0x0f750000), SPH_C32(0x5d791b00), SPH_C32(0xa9580000), + SPH_C32(0x65730000), SPH_C32(0x86d63d40), SPH_C32(0x870db9e7), + SPH_C32(0xabeb58c8), SPH_C32(0x0f9ae0ee), SPH_C32(0x496a0000), + SPH_C32(0xec501800), SPH_C32(0xbb130000), SPH_C32(0x67a20000), + SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), SPH_C32(0x831fedcb), + SPH_C32(0x6b78f44f) } +}; + +static const sph_u32 T512_24[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x54500000), SPH_C32(0x0671005c), SPH_C32(0x25ae0000), + SPH_C32(0x6a1e0000), SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), + SPH_C32(0xbfba18c3), SPH_C32(0x7e715d17), SPH_C32(0xbc8d0000), + SPH_C32(0xfc3b0018), SPH_C32(0x19830000), SPH_C32(0xd10b0000), + SPH_C32(0xae1878c4), SPH_C32(0x42a69856), SPH_C32(0x0012da37), + SPH_C32(0x2c3b504e) }, + { SPH_C32(0xbc8d0000), SPH_C32(0xfc3b0018), SPH_C32(0x19830000), + SPH_C32(0xd10b0000), SPH_C32(0xae1878c4), SPH_C32(0x42a69856), + SPH_C32(0x0012da37), SPH_C32(0x2c3b504e), SPH_C32(0xe8dd0000), + SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), SPH_C32(0xbb150000), + SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), SPH_C32(0xbfa8c2f4), + SPH_C32(0x524a0d59) }, + { SPH_C32(0xe8dd0000), SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), + SPH_C32(0xbb150000), SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), + SPH_C32(0xbfa8c2f4), SPH_C32(0x524a0d59), SPH_C32(0x54500000), + SPH_C32(0x0671005c), SPH_C32(0x25ae0000), SPH_C32(0x6a1e0000), + SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), SPH_C32(0xbfba18c3), + SPH_C32(0x7e715d17) }, + { SPH_C32(0x69510000), SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), + SPH_C32(0xac2f0000), SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), + SPH_C32(0x87ec287c), SPH_C32(0xbce1a3ce), SPH_C32(0xc6730000), + SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), SPH_C32(0x218d0000), + SPH_C32(0x23111587), SPH_C32(0x7913512f), SPH_C32(0x1d28ac88), + SPH_C32(0x378dd173) }, + { SPH_C32(0x3d010000), SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), + SPH_C32(0xc6310000), SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), + SPH_C32(0x385630bf), SPH_C32(0xc290fed9), SPH_C32(0x7afe0000), + SPH_C32(0x53b60014), SPH_C32(0xbd420000), SPH_C32(0xf0860000), + SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), SPH_C32(0x1d3a76bf), + SPH_C32(0x1bb6813d) }, + { SPH_C32(0xd5dc0000), SPH_C32(0x28da0084), SPH_C32(0xdaa00000), + SPH_C32(0x7d240000), SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), + SPH_C32(0x87fef24b), SPH_C32(0x90daf380), SPH_C32(0x2eae0000), + SPH_C32(0x55c70048), SPH_C32(0x98ec0000), SPH_C32(0x9a980000), + SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), SPH_C32(0xa2806e7c), + SPH_C32(0x65c7dc2a) }, + { SPH_C32(0x818c0000), SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), + SPH_C32(0x173a0000), SPH_C32(0x64283db5), SPH_C32(0xea4c0898), + SPH_C32(0x3844ea88), SPH_C32(0xeeabae97), SPH_C32(0x92230000), + SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), SPH_C32(0x4b930000), + SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), SPH_C32(0xa292b44b), + SPH_C32(0x49fc8c64) }, + { SPH_C32(0xc6730000), SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), + SPH_C32(0x218d0000), SPH_C32(0x23111587), SPH_C32(0x7913512f), + SPH_C32(0x1d28ac88), SPH_C32(0x378dd173), SPH_C32(0xaf220000), + SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), SPH_C32(0x8da20000), + SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), SPH_C32(0x9ac484f4), + SPH_C32(0x8b6c72bd) }, + { SPH_C32(0x92230000), SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), + SPH_C32(0x4b930000), SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), + SPH_C32(0xa292b44b), SPH_C32(0x49fc8c64), SPH_C32(0x13af0000), + SPH_C32(0x87570088), SPH_C32(0x7e610000), SPH_C32(0x5ca90000), + SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), SPH_C32(0x9ad65ec3), + SPH_C32(0xa75722f3) }, + { SPH_C32(0x7afe0000), SPH_C32(0x53b60014), SPH_C32(0xbd420000), + SPH_C32(0xf0860000), SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), + SPH_C32(0x1d3a76bf), SPH_C32(0x1bb6813d), SPH_C32(0x47ff0000), + SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), SPH_C32(0x36b70000), + SPH_C32(0x47392832), SPH_C32(0x935f59b7), SPH_C32(0x256c4600), + SPH_C32(0xd9267fe4) }, + { SPH_C32(0x2eae0000), SPH_C32(0x55c70048), SPH_C32(0x98ec0000), + SPH_C32(0x9a980000), SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), + SPH_C32(0xa2806e7c), SPH_C32(0x65c7dc2a), SPH_C32(0xfb720000), + SPH_C32(0x7d1d00cc), SPH_C32(0x424c0000), SPH_C32(0xe7bc0000), + SPH_C32(0xe92150f6), SPH_C32(0xd1f9c1e1), SPH_C32(0x257e9c37), + SPH_C32(0xf51d2faa) }, + { SPH_C32(0xaf220000), SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), + SPH_C32(0x8da20000), SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), + SPH_C32(0x9ac484f4), SPH_C32(0x8b6c72bd), SPH_C32(0x69510000), + SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), SPH_C32(0xac2f0000), + SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), SPH_C32(0x87ec287c), + SPH_C32(0xbce1a3ce) }, + { SPH_C32(0xfb720000), SPH_C32(0x7d1d00cc), SPH_C32(0x424c0000), + SPH_C32(0xe7bc0000), SPH_C32(0xe92150f6), SPH_C32(0xd1f9c1e1), + SPH_C32(0x257e9c37), SPH_C32(0xf51d2faa), SPH_C32(0xd5dc0000), + SPH_C32(0x28da0084), SPH_C32(0xdaa00000), SPH_C32(0x7d240000), + SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), SPH_C32(0x87fef24b), + SPH_C32(0x90daf380) }, + { SPH_C32(0x13af0000), SPH_C32(0x87570088), SPH_C32(0x7e610000), + SPH_C32(0x5ca90000), SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), + SPH_C32(0x9ad65ec3), SPH_C32(0xa75722f3), SPH_C32(0x818c0000), + SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), SPH_C32(0x173a0000), + SPH_C32(0x64283db5), SPH_C32(0xea4c0898), SPH_C32(0x3844ea88), + SPH_C32(0xeeabae97) }, + { SPH_C32(0x47ff0000), SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), + SPH_C32(0x36b70000), SPH_C32(0x47392832), SPH_C32(0x935f59b7), + SPH_C32(0x256c4600), SPH_C32(0xd9267fe4), SPH_C32(0x3d010000), + SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), SPH_C32(0xc6310000), + SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), SPH_C32(0x385630bf), + SPH_C32(0xc290fed9) } +}; + +static const sph_u32 T512_28[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x86790000), SPH_C32(0x3f390002), SPH_C32(0xe19ae000), + SPH_C32(0x98560000), SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), + SPH_C32(0xd3dd4944), SPH_C32(0x161ddab9), SPH_C32(0x30b70000), + SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), SPH_C32(0x42c40000), + SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), SPH_C32(0x21afa1ea), + SPH_C32(0xb0a51834) }, + { SPH_C32(0x30b70000), SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), + SPH_C32(0x42c40000), SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), + SPH_C32(0x21afa1ea), SPH_C32(0xb0a51834), SPH_C32(0xb6ce0000), + SPH_C32(0xdae90002), SPH_C32(0x156e8000), SPH_C32(0xda920000), + SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), SPH_C32(0xf272e8ae), + SPH_C32(0xa6b8c28d) }, + { SPH_C32(0xb6ce0000), SPH_C32(0xdae90002), SPH_C32(0x156e8000), + SPH_C32(0xda920000), SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), + SPH_C32(0xf272e8ae), SPH_C32(0xa6b8c28d), SPH_C32(0x86790000), + SPH_C32(0x3f390002), SPH_C32(0xe19ae000), SPH_C32(0x98560000), + SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), SPH_C32(0xd3dd4944), + SPH_C32(0x161ddab9) }, + { SPH_C32(0x14190000), SPH_C32(0x23ca003c), SPH_C32(0x50df0000), + SPH_C32(0x44b60000), SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), + SPH_C32(0x61e610b0), SPH_C32(0xdbcadb80), SPH_C32(0xe3430000), + SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), SPH_C32(0xaa4e0000), + SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), SPH_C32(0x123db156), + SPH_C32(0x3a4e99d7) }, + { SPH_C32(0x92600000), SPH_C32(0x1cf3003e), SPH_C32(0xb145e000), + SPH_C32(0xdce00000), SPH_C32(0x8e0900be), SPH_C32(0x727b649f), + SPH_C32(0xb23b59f4), SPH_C32(0xcdd70139), SPH_C32(0xd3f40000), + SPH_C32(0xdf9e0014), SPH_C32(0x06326000), SPH_C32(0xe88a0000), + SPH_C32(0xb8a67fcc), SPH_C32(0x5dd12a75), SPH_C32(0x339210bc), + SPH_C32(0x8aeb81e3) }, + { SPH_C32(0x24ae0000), SPH_C32(0xc61a003c), SPH_C32(0xa42b6000), + SPH_C32(0x06720000), SPH_C32(0x78d45ada), SPH_C32(0x44493815), + SPH_C32(0x4049b15a), SPH_C32(0x6b6fc3b4), SPH_C32(0x558d0000), + SPH_C32(0xe0a70016), SPH_C32(0xe7a88000), SPH_C32(0x70dc0000), + SPH_C32(0x2dc318c2), SPH_C32(0x1359e29f), SPH_C32(0xe04f59f8), + SPH_C32(0x9cf65b5a) }, + { SPH_C32(0xa2d70000), SPH_C32(0xf923003e), SPH_C32(0x45b18000), + SPH_C32(0x9e240000), SPH_C32(0xedb13dd4), SPH_C32(0x0ac1f0ff), + SPH_C32(0x9394f81e), SPH_C32(0x7d72190d), SPH_C32(0x653a0000), + SPH_C32(0x05770016), SPH_C32(0x135ce000), SPH_C32(0x32180000), + SPH_C32(0x4e7b25a8), SPH_C32(0x6be376ff), SPH_C32(0xc1e0f812), + SPH_C32(0x2c53436e) }, + { SPH_C32(0xe3430000), SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), + SPH_C32(0xaa4e0000), SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), + SPH_C32(0x123db156), SPH_C32(0x3a4e99d7), SPH_C32(0xf75a0000), + SPH_C32(0x19840028), SPH_C32(0xa2190000), SPH_C32(0xeef80000), + SPH_C32(0xc0722516), SPH_C32(0x19981260), SPH_C32(0x73dba1e6), + SPH_C32(0xe1844257) }, + { SPH_C32(0x653a0000), SPH_C32(0x05770016), SPH_C32(0x135ce000), + SPH_C32(0x32180000), SPH_C32(0x4e7b25a8), SPH_C32(0x6be376ff), + SPH_C32(0xc1e0f812), SPH_C32(0x2c53436e), SPH_C32(0xc7ed0000), + SPH_C32(0xfc540028), SPH_C32(0x56ed6000), SPH_C32(0xac3c0000), + SPH_C32(0xa3ca187c), SPH_C32(0x61228600), SPH_C32(0x5274000c), + SPH_C32(0x51215a63) }, + { SPH_C32(0xd3f40000), SPH_C32(0xdf9e0014), SPH_C32(0x06326000), + SPH_C32(0xe88a0000), SPH_C32(0xb8a67fcc), SPH_C32(0x5dd12a75), + SPH_C32(0x339210bc), SPH_C32(0x8aeb81e3), SPH_C32(0x41940000), + SPH_C32(0xc36d002a), SPH_C32(0xb7778000), SPH_C32(0x346a0000), + SPH_C32(0x36af7f72), SPH_C32(0x2faa4eea), SPH_C32(0x81a94948), + SPH_C32(0x473c80da) }, + { SPH_C32(0x558d0000), SPH_C32(0xe0a70016), SPH_C32(0xe7a88000), + SPH_C32(0x70dc0000), SPH_C32(0x2dc318c2), SPH_C32(0x1359e29f), + SPH_C32(0xe04f59f8), SPH_C32(0x9cf65b5a), SPH_C32(0x71230000), + SPH_C32(0x26bd002a), SPH_C32(0x4383e000), SPH_C32(0x76ae0000), + SPH_C32(0x55174218), SPH_C32(0x5710da8a), SPH_C32(0xa006e8a2), + SPH_C32(0xf79998ee) }, + { SPH_C32(0xf75a0000), SPH_C32(0x19840028), SPH_C32(0xa2190000), + SPH_C32(0xeef80000), SPH_C32(0xc0722516), SPH_C32(0x19981260), + SPH_C32(0x73dba1e6), SPH_C32(0xe1844257), SPH_C32(0x14190000), + SPH_C32(0x23ca003c), SPH_C32(0x50df0000), SPH_C32(0x44b60000), + SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), SPH_C32(0x61e610b0), + SPH_C32(0xdbcadb80) }, + { SPH_C32(0x71230000), SPH_C32(0x26bd002a), SPH_C32(0x4383e000), + SPH_C32(0x76ae0000), SPH_C32(0x55174218), SPH_C32(0x5710da8a), + SPH_C32(0xa006e8a2), SPH_C32(0xf79998ee), SPH_C32(0x24ae0000), + SPH_C32(0xc61a003c), SPH_C32(0xa42b6000), SPH_C32(0x06720000), + SPH_C32(0x78d45ada), SPH_C32(0x44493815), SPH_C32(0x4049b15a), + SPH_C32(0x6b6fc3b4) }, + { SPH_C32(0xc7ed0000), SPH_C32(0xfc540028), SPH_C32(0x56ed6000), + SPH_C32(0xac3c0000), SPH_C32(0xa3ca187c), SPH_C32(0x61228600), + SPH_C32(0x5274000c), SPH_C32(0x51215a63), SPH_C32(0xa2d70000), + SPH_C32(0xf923003e), SPH_C32(0x45b18000), SPH_C32(0x9e240000), + SPH_C32(0xedb13dd4), SPH_C32(0x0ac1f0ff), SPH_C32(0x9394f81e), + SPH_C32(0x7d72190d) }, + { SPH_C32(0x41940000), SPH_C32(0xc36d002a), SPH_C32(0xb7778000), + SPH_C32(0x346a0000), SPH_C32(0x36af7f72), SPH_C32(0x2faa4eea), + SPH_C32(0x81a94948), SPH_C32(0x473c80da), SPH_C32(0x92600000), + SPH_C32(0x1cf3003e), SPH_C32(0xb145e000), SPH_C32(0xdce00000), + SPH_C32(0x8e0900be), SPH_C32(0x727b649f), SPH_C32(0xb23b59f4), + SPH_C32(0xcdd70139) } +}; + +static const sph_u32 T512_32[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xac480000), SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), + SPH_C32(0x03430000), SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), + SPH_C32(0xfe72c7fe), SPH_C32(0x91e478f6), SPH_C32(0x1e4e0000), + SPH_C32(0xdecf0000), SPH_C32(0x6df80180), SPH_C32(0x77240000), + SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), SPH_C32(0xcda31812), + SPH_C32(0x98aa496e) }, + { SPH_C32(0x1e4e0000), SPH_C32(0xdecf0000), SPH_C32(0x6df80180), + SPH_C32(0x77240000), SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), + SPH_C32(0xcda31812), SPH_C32(0x98aa496e), SPH_C32(0xb2060000), + SPH_C32(0xc5690000), SPH_C32(0x28031200), SPH_C32(0x74670000), + SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), SPH_C32(0x33d1dfec), + SPH_C32(0x094e3198) }, + { SPH_C32(0xb2060000), SPH_C32(0xc5690000), SPH_C32(0x28031200), + SPH_C32(0x74670000), SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), + SPH_C32(0x33d1dfec), SPH_C32(0x094e3198), SPH_C32(0xac480000), + SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), SPH_C32(0x03430000), + SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), SPH_C32(0xfe72c7fe), + SPH_C32(0x91e478f6) }, + { SPH_C32(0xaec30000), SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), + SPH_C32(0x2c150000), SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), + SPH_C32(0xab92f78f), SPH_C32(0xa312567b), SPH_C32(0xdb250000), + SPH_C32(0x09290000), SPH_C32(0x49aac000), SPH_C32(0x81e10000), + SPH_C32(0xcafe6b59), SPH_C32(0x42793431), SPH_C32(0x43566b76), + SPH_C32(0xe86cba2e) }, + { SPH_C32(0x028b0000), SPH_C32(0x87e90001), SPH_C32(0x3c2af380), + SPH_C32(0x2f560000), SPH_C32(0x1f4944d9), SPH_C32(0x79e2e780), + SPH_C32(0x55e03071), SPH_C32(0x32f62e8d), SPH_C32(0xc56b0000), + SPH_C32(0xd7e60000), SPH_C32(0x2452c180), SPH_C32(0xf6c50000), + SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), SPH_C32(0x8ef57364), + SPH_C32(0x70c6f340) }, + { SPH_C32(0xb08d0000), SPH_C32(0x42800001), SPH_C32(0x1429e180), + SPH_C32(0x5b310000), SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), + SPH_C32(0x6631ef9d), SPH_C32(0x3bb81f15), SPH_C32(0x69230000), + SPH_C32(0xcc400000), SPH_C32(0x61a9d200), SPH_C32(0xf5860000), + SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), SPH_C32(0x7087b49a), + SPH_C32(0xe1228bb6) }, + { SPH_C32(0x1cc50000), SPH_C32(0x59260001), SPH_C32(0x51d2f200), + SPH_C32(0x58720000), SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), + SPH_C32(0x98432863), SPH_C32(0xaa5c67e3), SPH_C32(0x776d0000), + SPH_C32(0x128f0000), SPH_C32(0x0c51d380), SPH_C32(0x82a20000), + SPH_C32(0x907b5a33), SPH_C32(0x5dcb6487), SPH_C32(0xbd24ac88), + SPH_C32(0x7988c2d8) }, + { SPH_C32(0xdb250000), SPH_C32(0x09290000), SPH_C32(0x49aac000), + SPH_C32(0x81e10000), SPH_C32(0xcafe6b59), SPH_C32(0x42793431), + SPH_C32(0x43566b76), SPH_C32(0xe86cba2e), SPH_C32(0x75e60000), + SPH_C32(0x95660001), SPH_C32(0x307b2000), SPH_C32(0xadf40000), + SPH_C32(0x8f321eea), SPH_C32(0x24298307), SPH_C32(0xe8c49cf9), + SPH_C32(0x4b7eec55) }, + { SPH_C32(0x776d0000), SPH_C32(0x128f0000), SPH_C32(0x0c51d380), + SPH_C32(0x82a20000), SPH_C32(0x907b5a33), SPH_C32(0x5dcb6487), + SPH_C32(0xbd24ac88), SPH_C32(0x7988c2d8), SPH_C32(0x6ba80000), + SPH_C32(0x4ba90001), SPH_C32(0x5d832180), SPH_C32(0xdad00000), + SPH_C32(0x63751974), SPH_C32(0xd089ea49), SPH_C32(0x256784eb), + SPH_C32(0xd3d4a53b) }, + { SPH_C32(0xc56b0000), SPH_C32(0xd7e60000), SPH_C32(0x2452c180), + SPH_C32(0xf6c50000), SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), + SPH_C32(0x8ef57364), SPH_C32(0x70c6f340), SPH_C32(0xc7e00000), + SPH_C32(0x500f0001), SPH_C32(0x18783200), SPH_C32(0xd9930000), + SPH_C32(0x39f0281e), SPH_C32(0xcf3bbaff), SPH_C32(0xdb154315), + SPH_C32(0x4230ddcd) }, + { SPH_C32(0x69230000), SPH_C32(0xcc400000), SPH_C32(0x61a9d200), + SPH_C32(0xf5860000), SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), + SPH_C32(0x7087b49a), SPH_C32(0xe1228bb6), SPH_C32(0xd9ae0000), + SPH_C32(0x8ec00001), SPH_C32(0x75803380), SPH_C32(0xaeb70000), + SPH_C32(0xd5b72f80), SPH_C32(0x3b9bd3b1), SPH_C32(0x16b65b07), + SPH_C32(0xda9a94a3) }, + { SPH_C32(0x75e60000), SPH_C32(0x95660001), SPH_C32(0x307b2000), + SPH_C32(0xadf40000), SPH_C32(0x8f321eea), SPH_C32(0x24298307), + SPH_C32(0xe8c49cf9), SPH_C32(0x4b7eec55), SPH_C32(0xaec30000), + SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), SPH_C32(0x2c150000), + SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), SPH_C32(0xab92f78f), + SPH_C32(0xa312567b) }, + { SPH_C32(0xd9ae0000), SPH_C32(0x8ec00001), SPH_C32(0x75803380), + SPH_C32(0xaeb70000), SPH_C32(0xd5b72f80), SPH_C32(0x3b9bd3b1), + SPH_C32(0x16b65b07), SPH_C32(0xda9a94a3), SPH_C32(0xb08d0000), + SPH_C32(0x42800001), SPH_C32(0x1429e180), SPH_C32(0x5b310000), + SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), SPH_C32(0x6631ef9d), + SPH_C32(0x3bb81f15) }, + { SPH_C32(0x6ba80000), SPH_C32(0x4ba90001), SPH_C32(0x5d832180), + SPH_C32(0xdad00000), SPH_C32(0x63751974), SPH_C32(0xd089ea49), + SPH_C32(0x256784eb), SPH_C32(0xd3d4a53b), SPH_C32(0x1cc50000), + SPH_C32(0x59260001), SPH_C32(0x51d2f200), SPH_C32(0x58720000), + SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), SPH_C32(0x98432863), + SPH_C32(0xaa5c67e3) }, + { SPH_C32(0xc7e00000), SPH_C32(0x500f0001), SPH_C32(0x18783200), + SPH_C32(0xd9930000), SPH_C32(0x39f0281e), SPH_C32(0xcf3bbaff), + SPH_C32(0xdb154315), SPH_C32(0x4230ddcd), SPH_C32(0x028b0000), + SPH_C32(0x87e90001), SPH_C32(0x3c2af380), SPH_C32(0x2f560000), + SPH_C32(0x1f4944d9), SPH_C32(0x79e2e780), SPH_C32(0x55e03071), + SPH_C32(0x32f62e8d) } +}; + +static const sph_u32 T512_36[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xcc140000), SPH_C32(0xa5630000), SPH_C32(0x5ab90780), + SPH_C32(0x3b500000), SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), + SPH_C32(0x694348c1), SPH_C32(0xca5a87fe), SPH_C32(0x819e0000), + SPH_C32(0xec570000), SPH_C32(0x66320280), SPH_C32(0x95f30000), + SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), SPH_C32(0xe65aa22d), + SPH_C32(0x8e67b7fa) }, + { SPH_C32(0x819e0000), SPH_C32(0xec570000), SPH_C32(0x66320280), + SPH_C32(0x95f30000), SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), + SPH_C32(0xe65aa22d), SPH_C32(0x8e67b7fa), SPH_C32(0x4d8a0000), + SPH_C32(0x49340000), SPH_C32(0x3c8b0500), SPH_C32(0xaea30000), + SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), SPH_C32(0x8f19eaec), + SPH_C32(0x443d3004) }, + { SPH_C32(0x4d8a0000), SPH_C32(0x49340000), SPH_C32(0x3c8b0500), + SPH_C32(0xaea30000), SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), + SPH_C32(0x8f19eaec), SPH_C32(0x443d3004), SPH_C32(0xcc140000), + SPH_C32(0xa5630000), SPH_C32(0x5ab90780), SPH_C32(0x3b500000), + SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), SPH_C32(0x694348c1), + SPH_C32(0xca5a87fe) }, + { SPH_C32(0x78230000), SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), + SPH_C32(0x90a50000), SPH_C32(0x713e2879), SPH_C32(0x7ee98924), + SPH_C32(0xf08ca062), SPH_C32(0x636f8bab), SPH_C32(0x02af0000), + SPH_C32(0xb7280000), SPH_C32(0xba1c0300), SPH_C32(0x56980000), + SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), SPH_C32(0xa95c149a), + SPH_C32(0xf4f6ea7b) }, + { SPH_C32(0xb4370000), SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), + SPH_C32(0xabf50000), SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), + SPH_C32(0x99cfe8a3), SPH_C32(0xa9350c55), SPH_C32(0x83310000), + SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), SPH_C32(0xc36b0000), + SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), SPH_C32(0x4f06b6b7), + SPH_C32(0x7a915d81) }, + { SPH_C32(0xf9bd0000), SPH_C32(0xfeab0000), SPH_C32(0xcf080900), + SPH_C32(0x05560000), SPH_C32(0x2c97007b), SPH_C32(0x361db598), + SPH_C32(0x16d6024f), SPH_C32(0xed083c51), SPH_C32(0x4f250000), + SPH_C32(0xfe1c0000), SPH_C32(0x86970600), SPH_C32(0xf83b0000), + SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), SPH_C32(0x2645fe76), + SPH_C32(0xb0cbda7f) }, + { SPH_C32(0x35a90000), SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), + SPH_C32(0x3e060000), SPH_C32(0x67471384), SPH_C32(0xb1868180), + SPH_C32(0x7f954a8e), SPH_C32(0x2752bbaf), SPH_C32(0xcebb0000), + SPH_C32(0x124b0000), SPH_C32(0xe0a50480), SPH_C32(0x6dc80000), + SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), SPH_C32(0xc01f5c5b), + SPH_C32(0x3eac6d85) }, + { SPH_C32(0x02af0000), SPH_C32(0xb7280000), SPH_C32(0xba1c0300), + SPH_C32(0x56980000), SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), + SPH_C32(0xa95c149a), SPH_C32(0xf4f6ea7b), SPH_C32(0x7a8c0000), + SPH_C32(0xa5d40000), SPH_C32(0x13260880), SPH_C32(0xc63d0000), + SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), SPH_C32(0x59d0b4f8), + SPH_C32(0x979961d0) }, + { SPH_C32(0xcebb0000), SPH_C32(0x124b0000), SPH_C32(0xe0a50480), + SPH_C32(0x6dc80000), SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), + SPH_C32(0xc01f5c5b), SPH_C32(0x3eac6d85), SPH_C32(0xfb120000), + SPH_C32(0x49830000), SPH_C32(0x75140a00), SPH_C32(0x53ce0000), + SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), SPH_C32(0xbf8a16d5), + SPH_C32(0x19fed62a) }, + { SPH_C32(0x83310000), SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), + SPH_C32(0xc36b0000), SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), + SPH_C32(0x4f06b6b7), SPH_C32(0x7a915d81), SPH_C32(0x37060000), + SPH_C32(0xece00000), SPH_C32(0x2fad0d80), SPH_C32(0x689e0000), + SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), SPH_C32(0xd6c95e14), + SPH_C32(0xd3a451d4) }, + { SPH_C32(0x4f250000), SPH_C32(0xfe1c0000), SPH_C32(0x86970600), + SPH_C32(0xf83b0000), SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), + SPH_C32(0x2645fe76), SPH_C32(0xb0cbda7f), SPH_C32(0xb6980000), + SPH_C32(0x00b70000), SPH_C32(0x499f0f00), SPH_C32(0xfd6d0000), + SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), SPH_C32(0x3093fc39), + SPH_C32(0x5dc3e62e) }, + { SPH_C32(0x7a8c0000), SPH_C32(0xa5d40000), SPH_C32(0x13260880), + SPH_C32(0xc63d0000), SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), + SPH_C32(0x59d0b4f8), SPH_C32(0x979961d0), SPH_C32(0x78230000), + SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), SPH_C32(0x90a50000), + SPH_C32(0x713e2879), SPH_C32(0x7ee98924), SPH_C32(0xf08ca062), + SPH_C32(0x636f8bab) }, + { SPH_C32(0xb6980000), SPH_C32(0x00b70000), SPH_C32(0x499f0f00), + SPH_C32(0xfd6d0000), SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), + SPH_C32(0x3093fc39), SPH_C32(0x5dc3e62e), SPH_C32(0xf9bd0000), + SPH_C32(0xfeab0000), SPH_C32(0xcf080900), SPH_C32(0x05560000), + SPH_C32(0x2c97007b), SPH_C32(0x361db598), SPH_C32(0x16d6024f), + SPH_C32(0xed083c51) }, + { SPH_C32(0xfb120000), SPH_C32(0x49830000), SPH_C32(0x75140a00), + SPH_C32(0x53ce0000), SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), + SPH_C32(0xbf8a16d5), SPH_C32(0x19fed62a), SPH_C32(0x35a90000), + SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), SPH_C32(0x3e060000), + SPH_C32(0x67471384), SPH_C32(0xb1868180), SPH_C32(0x7f954a8e), + SPH_C32(0x2752bbaf) }, + { SPH_C32(0x37060000), SPH_C32(0xece00000), SPH_C32(0x2fad0d80), + SPH_C32(0x689e0000), SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), + SPH_C32(0xd6c95e14), SPH_C32(0xd3a451d4), SPH_C32(0xb4370000), + SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), SPH_C32(0xabf50000), + SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), SPH_C32(0x99cfe8a3), + SPH_C32(0xa9350c55) } +}; + +static const sph_u32 T512_40[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x88980000), SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), + SPH_C32(0xfb4e0000), SPH_C32(0xf158079a), SPH_C32(0x61ae9167), + SPH_C32(0xa895706c), SPH_C32(0xe6107494), SPH_C32(0x0bc20000), + SPH_C32(0xdb630000), SPH_C32(0x7e88000c), SPH_C32(0x15860000), + SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), SPH_C32(0xf460449e), + SPH_C32(0xd8b61463) }, + { SPH_C32(0x0bc20000), SPH_C32(0xdb630000), SPH_C32(0x7e88000c), + SPH_C32(0x15860000), SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), + SPH_C32(0xf460449e), SPH_C32(0xd8b61463), SPH_C32(0x835a0000), + SPH_C32(0xc4f70000), SPH_C32(0x01470022), SPH_C32(0xeec80000), + SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), SPH_C32(0x5cf534f2), + SPH_C32(0x3ea660f7) }, + { SPH_C32(0x835a0000), SPH_C32(0xc4f70000), SPH_C32(0x01470022), + SPH_C32(0xeec80000), SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), + SPH_C32(0x5cf534f2), SPH_C32(0x3ea660f7), SPH_C32(0x88980000), + SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), SPH_C32(0xfb4e0000), + SPH_C32(0xf158079a), SPH_C32(0x61ae9167), SPH_C32(0xa895706c), + SPH_C32(0xe6107494) }, + { SPH_C32(0x52500000), SPH_C32(0x29540000), SPH_C32(0x6a61004e), + SPH_C32(0xf0ff0000), SPH_C32(0x9a317eec), SPH_C32(0x452341ce), + SPH_C32(0xcf568fe5), SPH_C32(0x5303130f), SPH_C32(0x538d0000), + SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), SPH_C32(0x56ff0000), + SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), SPH_C32(0xa9444018), + SPH_C32(0x7f975691) }, + { SPH_C32(0xdac80000), SPH_C32(0x36c00000), SPH_C32(0x15ae0060), + SPH_C32(0x0bb10000), SPH_C32(0x6b697976), SPH_C32(0x248dd0a9), + SPH_C32(0x67c3ff89), SPH_C32(0xb513679b), SPH_C32(0x584f0000), + SPH_C32(0x729f0000), SPH_C32(0xe07f000a), SPH_C32(0x43790000), + SPH_C32(0x9b1948bd), SPH_C32(0xe74476ba), SPH_C32(0x5d240486), + SPH_C32(0xa72142f2) }, + { SPH_C32(0x59920000), SPH_C32(0xf2370000), SPH_C32(0x14e90042), + SPH_C32(0xe5790000), SPH_C32(0x0bcc361f), SPH_C32(0x30a2fa8d), + SPH_C32(0x3b36cb7b), SPH_C32(0x8bb5076c), SPH_C32(0xd0d70000), + SPH_C32(0x6d0b0000), SPH_C32(0x9fb00024), SPH_C32(0xb8370000), + SPH_C32(0x6a414f27), SPH_C32(0x86eae7dd), SPH_C32(0xf5b174ea), + SPH_C32(0x41313666) }, + { SPH_C32(0xd10a0000), SPH_C32(0xeda30000), SPH_C32(0x6b26006c), + SPH_C32(0x1e370000), SPH_C32(0xfa943185), SPH_C32(0x510c6bea), + SPH_C32(0x93a3bb17), SPH_C32(0x6da573f8), SPH_C32(0xdb150000), + SPH_C32(0xb6680000), SPH_C32(0xe1380028), SPH_C32(0xadb10000), + SPH_C32(0xfbbc07d4), SPH_C32(0xf36b5c9e), SPH_C32(0x01d13074), + SPH_C32(0x99872205) }, + { SPH_C32(0x538d0000), SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), + SPH_C32(0x56ff0000), SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), + SPH_C32(0xa9444018), SPH_C32(0x7f975691), SPH_C32(0x01dd0000), + SPH_C32(0x80a80000), SPH_C32(0xf4960048), SPH_C32(0xa6000000), + SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), SPH_C32(0x6612cffd), + SPH_C32(0x2c94459e) }, + { SPH_C32(0xdb150000), SPH_C32(0xb6680000), SPH_C32(0xe1380028), + SPH_C32(0xadb10000), SPH_C32(0xfbbc07d4), SPH_C32(0xf36b5c9e), + SPH_C32(0x01d13074), SPH_C32(0x99872205), SPH_C32(0x0a1f0000), + SPH_C32(0x5bcb0000), SPH_C32(0x8a1e0044), SPH_C32(0xb3860000), + SPH_C32(0x01283651), SPH_C32(0xa2673774), SPH_C32(0x92728b63), + SPH_C32(0xf42251fd) }, + { SPH_C32(0x584f0000), SPH_C32(0x729f0000), SPH_C32(0xe07f000a), + SPH_C32(0x43790000), SPH_C32(0x9b1948bd), SPH_C32(0xe74476ba), + SPH_C32(0x5d240486), SPH_C32(0xa72142f2), SPH_C32(0x82870000), + SPH_C32(0x445f0000), SPH_C32(0xf5d1006a), SPH_C32(0x48c80000), + SPH_C32(0xf07031cb), SPH_C32(0xc3c9a613), SPH_C32(0x3ae7fb0f), + SPH_C32(0x12322569) }, + { SPH_C32(0xd0d70000), SPH_C32(0x6d0b0000), SPH_C32(0x9fb00024), + SPH_C32(0xb8370000), SPH_C32(0x6a414f27), SPH_C32(0x86eae7dd), + SPH_C32(0xf5b174ea), SPH_C32(0x41313666), SPH_C32(0x89450000), + SPH_C32(0x9f3c0000), SPH_C32(0x8b590066), SPH_C32(0x5d4e0000), + SPH_C32(0x618d7938), SPH_C32(0xb6481d50), SPH_C32(0xce87bf91), + SPH_C32(0xca84310a) }, + { SPH_C32(0x01dd0000), SPH_C32(0x80a80000), SPH_C32(0xf4960048), + SPH_C32(0xa6000000), SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), + SPH_C32(0x6612cffd), SPH_C32(0x2c94459e), SPH_C32(0x52500000), + SPH_C32(0x29540000), SPH_C32(0x6a61004e), SPH_C32(0xf0ff0000), + SPH_C32(0x9a317eec), SPH_C32(0x452341ce), SPH_C32(0xcf568fe5), + SPH_C32(0x5303130f) }, + { SPH_C32(0x89450000), SPH_C32(0x9f3c0000), SPH_C32(0x8b590066), + SPH_C32(0x5d4e0000), SPH_C32(0x618d7938), SPH_C32(0xb6481d50), + SPH_C32(0xce87bf91), SPH_C32(0xca84310a), SPH_C32(0x59920000), + SPH_C32(0xf2370000), SPH_C32(0x14e90042), SPH_C32(0xe5790000), + SPH_C32(0x0bcc361f), SPH_C32(0x30a2fa8d), SPH_C32(0x3b36cb7b), + SPH_C32(0x8bb5076c) }, + { SPH_C32(0x0a1f0000), SPH_C32(0x5bcb0000), SPH_C32(0x8a1e0044), + SPH_C32(0xb3860000), SPH_C32(0x01283651), SPH_C32(0xa2673774), + SPH_C32(0x92728b63), SPH_C32(0xf42251fd), SPH_C32(0xd10a0000), + SPH_C32(0xeda30000), SPH_C32(0x6b26006c), SPH_C32(0x1e370000), + SPH_C32(0xfa943185), SPH_C32(0x510c6bea), SPH_C32(0x93a3bb17), + SPH_C32(0x6da573f8) }, + { SPH_C32(0x82870000), SPH_C32(0x445f0000), SPH_C32(0xf5d1006a), + SPH_C32(0x48c80000), SPH_C32(0xf07031cb), SPH_C32(0xc3c9a613), + SPH_C32(0x3ae7fb0f), SPH_C32(0x12322569), SPH_C32(0xdac80000), + SPH_C32(0x36c00000), SPH_C32(0x15ae0060), SPH_C32(0x0bb10000), + SPH_C32(0x6b697976), SPH_C32(0x248dd0a9), SPH_C32(0x67c3ff89), + SPH_C32(0xb513679b) } +}; + +static const sph_u32 T512_44[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x58430000), SPH_C32(0x807e0000), SPH_C32(0x78330001), + SPH_C32(0xc66b3800), SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), + SPH_C32(0xac73fe6f), SPH_C32(0x3a4479b1), SPH_C32(0x1d5a0000), + SPH_C32(0x2b720000), SPH_C32(0x488d0000), SPH_C32(0xaf611800), + SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), SPH_C32(0x81a20429), + SPH_C32(0x1e7536a6) }, + { SPH_C32(0x1d5a0000), SPH_C32(0x2b720000), SPH_C32(0x488d0000), + SPH_C32(0xaf611800), SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), + SPH_C32(0x81a20429), SPH_C32(0x1e7536a6), SPH_C32(0x45190000), + SPH_C32(0xab0c0000), SPH_C32(0x30be0001), SPH_C32(0x690a2000), + SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), SPH_C32(0x2dd1fa46), + SPH_C32(0x24314f17) }, + { SPH_C32(0x45190000), SPH_C32(0xab0c0000), SPH_C32(0x30be0001), + SPH_C32(0x690a2000), SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), + SPH_C32(0x2dd1fa46), SPH_C32(0x24314f17), SPH_C32(0x58430000), + SPH_C32(0x807e0000), SPH_C32(0x78330001), SPH_C32(0xc66b3800), + SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), SPH_C32(0xac73fe6f), + SPH_C32(0x3a4479b1) }, + { SPH_C32(0xa53b0000), SPH_C32(0x14260000), SPH_C32(0x4e30001e), + SPH_C32(0x7cae0000), SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), + SPH_C32(0xf73168d8), SPH_C32(0x0b1b4946), SPH_C32(0x07ed0000), + SPH_C32(0xb2500000), SPH_C32(0x8774000a), SPH_C32(0x970d0000), + SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), SPH_C32(0xf4786222), + SPH_C32(0x9075b1ce) }, + { SPH_C32(0xfd780000), SPH_C32(0x94580000), SPH_C32(0x3603001f), + SPH_C32(0xbac53800), SPH_C32(0x68a95109), SPH_C32(0x017295e0), + SPH_C32(0x5b4296b7), SPH_C32(0x315f30f7), SPH_C32(0x1ab70000), + SPH_C32(0x99220000), SPH_C32(0xcff9000a), SPH_C32(0x386c1800), + SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), SPH_C32(0x75da660b), + SPH_C32(0x8e008768) }, + { SPH_C32(0xb8610000), SPH_C32(0x3f540000), SPH_C32(0x06bd001e), + SPH_C32(0xd3cf1800), SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), + SPH_C32(0x76936cf1), SPH_C32(0x156e7fe0), SPH_C32(0x42f40000), + SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), SPH_C32(0xfe072000), + SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), SPH_C32(0xd9a99864), + SPH_C32(0xb444fed9) }, + { SPH_C32(0xe0220000), SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), + SPH_C32(0x15a42000), SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), + SPH_C32(0xdae0929e), SPH_C32(0x2f2a0651), SPH_C32(0x5fae0000), + SPH_C32(0x322e0000), SPH_C32(0xff47000b), SPH_C32(0x51663800), + SPH_C32(0xa4457f72), SPH_C32(0x316a5179), SPH_C32(0x580b9c4d), + SPH_C32(0xaa31c87f) }, + { SPH_C32(0x07ed0000), SPH_C32(0xb2500000), SPH_C32(0x8774000a), + SPH_C32(0x970d0000), SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), + SPH_C32(0xf4786222), SPH_C32(0x9075b1ce), SPH_C32(0xa2d60000), + SPH_C32(0xa6760000), SPH_C32(0xc9440014), SPH_C32(0xeba30000), + SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), SPH_C32(0x03490afa), + SPH_C32(0x9b6ef888) }, + { SPH_C32(0x5fae0000), SPH_C32(0x322e0000), SPH_C32(0xff47000b), + SPH_C32(0x51663800), SPH_C32(0xa4457f72), SPH_C32(0x316a5179), + SPH_C32(0x580b9c4d), SPH_C32(0xaa31c87f), SPH_C32(0xbf8c0000), + SPH_C32(0x8d040000), SPH_C32(0x81c90014), SPH_C32(0x44c21800), + SPH_C32(0xe92700be), SPH_C32(0xf8617b49), SPH_C32(0x82eb0ed3), + SPH_C32(0x851bce2e) }, + { SPH_C32(0x1ab70000), SPH_C32(0x99220000), SPH_C32(0xcff9000a), + SPH_C32(0x386c1800), SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), + SPH_C32(0x75da660b), SPH_C32(0x8e008768), SPH_C32(0xe7cf0000), + SPH_C32(0x0d7a0000), SPH_C32(0xf9fa0015), SPH_C32(0x82a92000), + SPH_C32(0x0e105c62), SPH_C32(0x81cc4494), SPH_C32(0x2e98f0bc), + SPH_C32(0xbf5fb79f) }, + { SPH_C32(0x42f40000), SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), + SPH_C32(0xfe072000), SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), + SPH_C32(0xd9a99864), SPH_C32(0xb444fed9), SPH_C32(0xfa950000), + SPH_C32(0x26080000), SPH_C32(0xb1770015), SPH_C32(0x2dc83800), + SPH_C32(0x2bdb72a7), SPH_C32(0x49b5fb44), SPH_C32(0xaf3af495), + SPH_C32(0xa12a8139) }, + { SPH_C32(0xa2d60000), SPH_C32(0xa6760000), SPH_C32(0xc9440014), + SPH_C32(0xeba30000), SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), + SPH_C32(0x03490afa), SPH_C32(0x9b6ef888), SPH_C32(0xa53b0000), + SPH_C32(0x14260000), SPH_C32(0x4e30001e), SPH_C32(0x7cae0000), + SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), SPH_C32(0xf73168d8), + SPH_C32(0x0b1b4946) }, + { SPH_C32(0xfa950000), SPH_C32(0x26080000), SPH_C32(0xb1770015), + SPH_C32(0x2dc83800), SPH_C32(0x2bdb72a7), SPH_C32(0x49b5fb44), + SPH_C32(0xaf3af495), SPH_C32(0xa12a8139), SPH_C32(0xb8610000), + SPH_C32(0x3f540000), SPH_C32(0x06bd001e), SPH_C32(0xd3cf1800), + SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), SPH_C32(0x76936cf1), + SPH_C32(0x156e7fe0) }, + { SPH_C32(0xbf8c0000), SPH_C32(0x8d040000), SPH_C32(0x81c90014), + SPH_C32(0x44c21800), SPH_C32(0xe92700be), SPH_C32(0xf8617b49), + SPH_C32(0x82eb0ed3), SPH_C32(0x851bce2e), SPH_C32(0xe0220000), + SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), SPH_C32(0x15a42000), + SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), SPH_C32(0xdae0929e), + SPH_C32(0x2f2a0651) }, + { SPH_C32(0xe7cf0000), SPH_C32(0x0d7a0000), SPH_C32(0xf9fa0015), + SPH_C32(0x82a92000), SPH_C32(0x0e105c62), SPH_C32(0x81cc4494), + SPH_C32(0x2e98f0bc), SPH_C32(0xbf5fb79f), SPH_C32(0xfd780000), + SPH_C32(0x94580000), SPH_C32(0x3603001f), SPH_C32(0xbac53800), + SPH_C32(0x68a95109), SPH_C32(0x017295e0), SPH_C32(0x5b4296b7), + SPH_C32(0x315f30f7) } +}; + +static const sph_u32 T512_48[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x02f20000), SPH_C32(0xa2810000), SPH_C32(0x873f0000), + SPH_C32(0xe36c7800), SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), + SPH_C32(0xc4c23237), SPH_C32(0x7f32259e), SPH_C32(0xbadd0000), + SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), SPH_C32(0xf7282800), + SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), SPH_C32(0xea5a8d14), + SPH_C32(0x2a2c18f0) }, + { SPH_C32(0xbadd0000), SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), + SPH_C32(0xf7282800), SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), + SPH_C32(0xea5a8d14), SPH_C32(0x2a2c18f0), SPH_C32(0xb82f0000), + SPH_C32(0xb12c0000), SPH_C32(0x30d80000), SPH_C32(0x14445000), + SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), SPH_C32(0x2e98bf23), + SPH_C32(0x551e3d6e) }, + { SPH_C32(0xb82f0000), SPH_C32(0xb12c0000), SPH_C32(0x30d80000), + SPH_C32(0x14445000), SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), + SPH_C32(0x2e98bf23), SPH_C32(0x551e3d6e), SPH_C32(0x02f20000), + SPH_C32(0xa2810000), SPH_C32(0x873f0000), SPH_C32(0xe36c7800), + SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), SPH_C32(0xc4c23237), + SPH_C32(0x7f32259e) }, + { SPH_C32(0x1e6c0000), SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), + SPH_C32(0xbcb6b800), SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), + SPH_C32(0x6a0c1bc8), SPH_C32(0xb99dc2eb), SPH_C32(0x92560000), + SPH_C32(0x1eda0000), SPH_C32(0xea510000), SPH_C32(0xe8b13000), + SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), SPH_C32(0xb15c2254), + SPH_C32(0x33c5244f) }, + { SPH_C32(0x1c9e0000), SPH_C32(0x66c30000), SPH_C32(0x0d110000), + SPH_C32(0x5fdac000), SPH_C32(0x32596759), SPH_C32(0x8cc0f80c), + SPH_C32(0xaece29ff), SPH_C32(0xc6afe775), SPH_C32(0x288b0000), + SPH_C32(0x0d770000), SPH_C32(0x5db60000), SPH_C32(0x1f991800), + SPH_C32(0x767042e8), SPH_C32(0xdde1a2a3), SPH_C32(0x5b06af40), + SPH_C32(0x19e93cbf) }, + { SPH_C32(0xa4b10000), SPH_C32(0xd7ef0000), SPH_C32(0x3dc90000), + SPH_C32(0x4b9e9000), SPH_C32(0xf30107fb), SPH_C32(0xbde710e0), + SPH_C32(0x805696dc), SPH_C32(0x93b1da1b), SPH_C32(0x2a790000), + SPH_C32(0xaff60000), SPH_C32(0xda890000), SPH_C32(0xfcf56000), + SPH_C32(0x686d3607), SPH_C32(0xdadc8975), SPH_C32(0x9fc49d77), + SPH_C32(0x66db1921) }, + { SPH_C32(0xa6430000), SPH_C32(0x756e0000), SPH_C32(0xbaf60000), + SPH_C32(0xa8f2e800), SPH_C32(0xed1c7314), SPH_C32(0xbada3b36), + SPH_C32(0x4494a4eb), SPH_C32(0xec83ff85), SPH_C32(0x90a40000), + SPH_C32(0xbc5b0000), SPH_C32(0x6d6e0000), SPH_C32(0x0bdd4800), + SPH_C32(0xb728224a), SPH_C32(0xecc64a4f), SPH_C32(0x759e1063), + SPH_C32(0x4cf701d1) }, + { SPH_C32(0x92560000), SPH_C32(0x1eda0000), SPH_C32(0xea510000), + SPH_C32(0xe8b13000), SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), + SPH_C32(0xb15c2254), SPH_C32(0x33c5244f), SPH_C32(0x8c3a0000), + SPH_C32(0xda980000), SPH_C32(0x607f0000), SPH_C32(0x54078800), + SPH_C32(0x85714513), SPH_C32(0x6006b243), SPH_C32(0xdb50399c), + SPH_C32(0x8a58e6a4) }, + { SPH_C32(0x90a40000), SPH_C32(0xbc5b0000), SPH_C32(0x6d6e0000), + SPH_C32(0x0bdd4800), SPH_C32(0xb728224a), SPH_C32(0xecc64a4f), + SPH_C32(0x759e1063), SPH_C32(0x4cf701d1), SPH_C32(0x36e70000), + SPH_C32(0xc9350000), SPH_C32(0xd7980000), SPH_C32(0xa32fa000), + SPH_C32(0x5a34515e), SPH_C32(0x561c7179), SPH_C32(0x310ab488), + SPH_C32(0xa074fe54) }, + { SPH_C32(0x288b0000), SPH_C32(0x0d770000), SPH_C32(0x5db60000), + SPH_C32(0x1f991800), SPH_C32(0x767042e8), SPH_C32(0xdde1a2a3), + SPH_C32(0x5b06af40), SPH_C32(0x19e93cbf), SPH_C32(0x34150000), + SPH_C32(0x6bb40000), SPH_C32(0x50a70000), SPH_C32(0x4043d800), + SPH_C32(0x442925b1), SPH_C32(0x51215aaf), SPH_C32(0xf5c886bf), + SPH_C32(0xdf46dbca) }, + { SPH_C32(0x2a790000), SPH_C32(0xaff60000), SPH_C32(0xda890000), + SPH_C32(0xfcf56000), SPH_C32(0x686d3607), SPH_C32(0xdadc8975), + SPH_C32(0x9fc49d77), SPH_C32(0x66db1921), SPH_C32(0x8ec80000), + SPH_C32(0x78190000), SPH_C32(0xe7400000), SPH_C32(0xb76bf000), + SPH_C32(0x9b6c31fc), SPH_C32(0x673b9995), SPH_C32(0x1f920bab), + SPH_C32(0xf56ac33a) }, + { SPH_C32(0x8c3a0000), SPH_C32(0xda980000), SPH_C32(0x607f0000), + SPH_C32(0x54078800), SPH_C32(0x85714513), SPH_C32(0x6006b243), + SPH_C32(0xdb50399c), SPH_C32(0x8a58e6a4), SPH_C32(0x1e6c0000), + SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), SPH_C32(0xbcb6b800), + SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), SPH_C32(0x6a0c1bc8), + SPH_C32(0xb99dc2eb) }, + { SPH_C32(0x8ec80000), SPH_C32(0x78190000), SPH_C32(0xe7400000), + SPH_C32(0xb76bf000), SPH_C32(0x9b6c31fc), SPH_C32(0x673b9995), + SPH_C32(0x1f920bab), SPH_C32(0xf56ac33a), SPH_C32(0xa4b10000), + SPH_C32(0xd7ef0000), SPH_C32(0x3dc90000), SPH_C32(0x4b9e9000), + SPH_C32(0xf30107fb), SPH_C32(0xbde710e0), SPH_C32(0x805696dc), + SPH_C32(0x93b1da1b) }, + { SPH_C32(0x36e70000), SPH_C32(0xc9350000), SPH_C32(0xd7980000), + SPH_C32(0xa32fa000), SPH_C32(0x5a34515e), SPH_C32(0x561c7179), + SPH_C32(0x310ab488), SPH_C32(0xa074fe54), SPH_C32(0xa6430000), + SPH_C32(0x756e0000), SPH_C32(0xbaf60000), SPH_C32(0xa8f2e800), + SPH_C32(0xed1c7314), SPH_C32(0xbada3b36), SPH_C32(0x4494a4eb), + SPH_C32(0xec83ff85) }, + { SPH_C32(0x34150000), SPH_C32(0x6bb40000), SPH_C32(0x50a70000), + SPH_C32(0x4043d800), SPH_C32(0x442925b1), SPH_C32(0x51215aaf), + SPH_C32(0xf5c886bf), SPH_C32(0xdf46dbca), SPH_C32(0x1c9e0000), + SPH_C32(0x66c30000), SPH_C32(0x0d110000), SPH_C32(0x5fdac000), + SPH_C32(0x32596759), SPH_C32(0x8cc0f80c), SPH_C32(0xaece29ff), + SPH_C32(0xc6afe775) } +}; + +static const sph_u32 T512_52[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xe6280000), SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), + SPH_C32(0xd3d002e0), SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), + SPH_C32(0x289506b4), SPH_C32(0xd75a4897), SPH_C32(0xf0c50000), + SPH_C32(0x59230000), SPH_C32(0x45820000), SPH_C32(0xe18d00c0), + SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), SPH_C32(0xcbe0fe1c), + SPH_C32(0x56a7b19f) }, + { SPH_C32(0xf0c50000), SPH_C32(0x59230000), SPH_C32(0x45820000), + SPH_C32(0xe18d00c0), SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), + SPH_C32(0xcbe0fe1c), SPH_C32(0x56a7b19f), SPH_C32(0x16ed0000), + SPH_C32(0x15680000), SPH_C32(0xedd70000), SPH_C32(0x325d0220), + SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), SPH_C32(0xe375f8a8), + SPH_C32(0x81fdf908) }, + { SPH_C32(0x16ed0000), SPH_C32(0x15680000), SPH_C32(0xedd70000), + SPH_C32(0x325d0220), SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), + SPH_C32(0xe375f8a8), SPH_C32(0x81fdf908), SPH_C32(0xe6280000), + SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), SPH_C32(0xd3d002e0), + SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), SPH_C32(0x289506b4), + SPH_C32(0xd75a4897) }, + { SPH_C32(0xb4310000), SPH_C32(0x77330000), SPH_C32(0xb15d0000), + SPH_C32(0x7fd004e0), SPH_C32(0x78a26138), SPH_C32(0xd116c35d), + SPH_C32(0xd256d489), SPH_C32(0x4e6f74de), SPH_C32(0xe3060000), + SPH_C32(0xbdc10000), SPH_C32(0x87130000), SPH_C32(0xbff20060), + SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), SPH_C32(0x73c5ab06), + SPH_C32(0x5bd61539) }, + { SPH_C32(0x52190000), SPH_C32(0x3b780000), SPH_C32(0x19080000), + SPH_C32(0xac000600), SPH_C32(0xa0c35180), SPH_C32(0x49b17387), + SPH_C32(0xfac3d23d), SPH_C32(0x99353c49), SPH_C32(0x13c30000), + SPH_C32(0xe4e20000), SPH_C32(0xc2910000), SPH_C32(0x5e7f00a0), + SPH_C32(0x15d70c2b), SPH_C32(0x4f5861c8), SPH_C32(0xb825551a), + SPH_C32(0x0d71a4a6) }, + { SPH_C32(0x44f40000), SPH_C32(0x2e100000), SPH_C32(0xf4df0000), + SPH_C32(0x9e5d0420), SPH_C32(0x43cf6709), SPH_C32(0x13fb95c4), + SPH_C32(0x19b62a95), SPH_C32(0x18c8c541), SPH_C32(0xf5eb0000), + SPH_C32(0xa8a90000), SPH_C32(0x6ac40000), SPH_C32(0x8daf0240), + SPH_C32(0xcdb63c93), SPH_C32(0xd7ffd112), SPH_C32(0x90b053ae), + SPH_C32(0xda2bec31) }, + { SPH_C32(0xa2dc0000), SPH_C32(0x625b0000), SPH_C32(0x5c8a0000), + SPH_C32(0x4d8d06c0), SPH_C32(0x9bae57b1), SPH_C32(0x8b5c251e), + SPH_C32(0x31232c21), SPH_C32(0xcf928dd6), SPH_C32(0x052e0000), + SPH_C32(0xf18a0000), SPH_C32(0x2f460000), SPH_C32(0x6c220280), + SPH_C32(0xf6db3aa2), SPH_C32(0x1512878b), SPH_C32(0x5b50adb2), + SPH_C32(0x8c8c5dae) }, + { SPH_C32(0xe3060000), SPH_C32(0xbdc10000), SPH_C32(0x87130000), + SPH_C32(0xbff20060), SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), + SPH_C32(0x73c5ab06), SPH_C32(0x5bd61539), SPH_C32(0x57370000), + SPH_C32(0xcaf20000), SPH_C32(0x364e0000), SPH_C32(0xc0220480), + SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), SPH_C32(0xa1937f8f), + SPH_C32(0x15b961e7) }, + { SPH_C32(0x052e0000), SPH_C32(0xf18a0000), SPH_C32(0x2f460000), + SPH_C32(0x6c220280), SPH_C32(0xf6db3aa2), SPH_C32(0x1512878b), + SPH_C32(0x5b50adb2), SPH_C32(0x8c8c5dae), SPH_C32(0xa7f20000), + SPH_C32(0x93d10000), SPH_C32(0x73cc0000), SPH_C32(0x21af0440), + SPH_C32(0x6d756d13), SPH_C32(0x9e4ea295), SPH_C32(0x6a738193), + SPH_C32(0x431ed078) }, + { SPH_C32(0x13c30000), SPH_C32(0xe4e20000), SPH_C32(0xc2910000), + SPH_C32(0x5e7f00a0), SPH_C32(0x15d70c2b), SPH_C32(0x4f5861c8), + SPH_C32(0xb825551a), SPH_C32(0x0d71a4a6), SPH_C32(0x41da0000), + SPH_C32(0xdf9a0000), SPH_C32(0xdb990000), SPH_C32(0xf27f06a0), + SPH_C32(0xb5145dab), SPH_C32(0x06e9124f), SPH_C32(0x42e68727), + SPH_C32(0x944498ef) }, + { SPH_C32(0xf5eb0000), SPH_C32(0xa8a90000), SPH_C32(0x6ac40000), + SPH_C32(0x8daf0240), SPH_C32(0xcdb63c93), SPH_C32(0xd7ffd112), + SPH_C32(0x90b053ae), SPH_C32(0xda2bec31), SPH_C32(0xb11f0000), + SPH_C32(0x86b90000), SPH_C32(0x9e1b0000), SPH_C32(0x13f20660), + SPH_C32(0x8e795b9a), SPH_C32(0xc40444d6), SPH_C32(0x8906793b), + SPH_C32(0xc2e32970) }, + { SPH_C32(0x57370000), SPH_C32(0xcaf20000), SPH_C32(0x364e0000), + SPH_C32(0xc0220480), SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), + SPH_C32(0xa1937f8f), SPH_C32(0x15b961e7), SPH_C32(0xb4310000), + SPH_C32(0x77330000), SPH_C32(0xb15d0000), SPH_C32(0x7fd004e0), + SPH_C32(0x78a26138), SPH_C32(0xd116c35d), SPH_C32(0xd256d489), + SPH_C32(0x4e6f74de) }, + { SPH_C32(0xb11f0000), SPH_C32(0x86b90000), SPH_C32(0x9e1b0000), + SPH_C32(0x13f20660), SPH_C32(0x8e795b9a), SPH_C32(0xc40444d6), + SPH_C32(0x8906793b), SPH_C32(0xc2e32970), SPH_C32(0x44f40000), + SPH_C32(0x2e100000), SPH_C32(0xf4df0000), SPH_C32(0x9e5d0420), + SPH_C32(0x43cf6709), SPH_C32(0x13fb95c4), SPH_C32(0x19b62a95), + SPH_C32(0x18c8c541) }, + { SPH_C32(0xa7f20000), SPH_C32(0x93d10000), SPH_C32(0x73cc0000), + SPH_C32(0x21af0440), SPH_C32(0x6d756d13), SPH_C32(0x9e4ea295), + SPH_C32(0x6a738193), SPH_C32(0x431ed078), SPH_C32(0xa2dc0000), + SPH_C32(0x625b0000), SPH_C32(0x5c8a0000), SPH_C32(0x4d8d06c0), + SPH_C32(0x9bae57b1), SPH_C32(0x8b5c251e), SPH_C32(0x31232c21), + SPH_C32(0xcf928dd6) }, + { SPH_C32(0x41da0000), SPH_C32(0xdf9a0000), SPH_C32(0xdb990000), + SPH_C32(0xf27f06a0), SPH_C32(0xb5145dab), SPH_C32(0x06e9124f), + SPH_C32(0x42e68727), SPH_C32(0x944498ef), SPH_C32(0x52190000), + SPH_C32(0x3b780000), SPH_C32(0x19080000), SPH_C32(0xac000600), + SPH_C32(0xa0c35180), SPH_C32(0x49b17387), SPH_C32(0xfac3d23d), + SPH_C32(0x99353c49) } +}; + +static const sph_u32 T512_56[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x5fa80000), SPH_C32(0x56030000), SPH_C32(0x43ae0000), + SPH_C32(0x64f30013), SPH_C32(0x257e86bf), SPH_C32(0x1311944e), + SPH_C32(0x541e95bf), SPH_C32(0x8ea4db69), SPH_C32(0x00440000), + SPH_C32(0x7f480000), SPH_C32(0xda7c0000), SPH_C32(0x2a230001), + SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), SPH_C32(0x030a9e60), + SPH_C32(0xbe0a679e) }, + { SPH_C32(0x00440000), SPH_C32(0x7f480000), SPH_C32(0xda7c0000), + SPH_C32(0x2a230001), SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), + SPH_C32(0x030a9e60), SPH_C32(0xbe0a679e), SPH_C32(0x5fec0000), + SPH_C32(0x294b0000), SPH_C32(0x99d20000), SPH_C32(0x4ed00012), + SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), SPH_C32(0x57140bdf), + SPH_C32(0x30aebcf7) }, + { SPH_C32(0x5fec0000), SPH_C32(0x294b0000), SPH_C32(0x99d20000), + SPH_C32(0x4ed00012), SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), + SPH_C32(0x57140bdf), SPH_C32(0x30aebcf7), SPH_C32(0x5fa80000), + SPH_C32(0x56030000), SPH_C32(0x43ae0000), SPH_C32(0x64f30013), + SPH_C32(0x257e86bf), SPH_C32(0x1311944e), SPH_C32(0x541e95bf), + SPH_C32(0x8ea4db69) }, + { SPH_C32(0xee930000), SPH_C32(0xd6070000), SPH_C32(0x92c10000), + SPH_C32(0x2b9801e0), SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), + SPH_C32(0x45312374), SPH_C32(0x201f6a64), SPH_C32(0x7b280000), + SPH_C32(0x57420000), SPH_C32(0xa9e50000), SPH_C32(0x634300a0), + SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), SPH_C32(0x27f83b03), + SPH_C32(0xc7ff60f0) }, + { SPH_C32(0xb13b0000), SPH_C32(0x80040000), SPH_C32(0xd16f0000), + SPH_C32(0x4f6b01f3), SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), + SPH_C32(0x112fb6cb), SPH_C32(0xaebbb10d), SPH_C32(0x7b6c0000), + SPH_C32(0x280a0000), SPH_C32(0x73990000), SPH_C32(0x496000a1), + SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), SPH_C32(0x24f2a563), + SPH_C32(0x79f5076e) }, + { SPH_C32(0xeed70000), SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), + SPH_C32(0x01bb01e1), SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), + SPH_C32(0x463bbd14), SPH_C32(0x9e150dfa), SPH_C32(0x24c40000), + SPH_C32(0x7e090000), SPH_C32(0x30370000), SPH_C32(0x2d9300b2), + SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), SPH_C32(0x70ec30dc), + SPH_C32(0xf751dc07) }, + { SPH_C32(0xb17f0000), SPH_C32(0xff4c0000), SPH_C32(0x0b130000), + SPH_C32(0x654801f2), SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), + SPH_C32(0x122528ab), SPH_C32(0x10b1d693), SPH_C32(0x24800000), + SPH_C32(0x01410000), SPH_C32(0xea4b0000), SPH_C32(0x07b000b3), + SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), SPH_C32(0x73e6aebc), + SPH_C32(0x495bbb99) }, + { SPH_C32(0x7b280000), SPH_C32(0x57420000), SPH_C32(0xa9e50000), + SPH_C32(0x634300a0), SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), + SPH_C32(0x27f83b03), SPH_C32(0xc7ff60f0), SPH_C32(0x95bb0000), + SPH_C32(0x81450000), SPH_C32(0x3b240000), SPH_C32(0x48db0140), + SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), SPH_C32(0x62c91877), + SPH_C32(0xe7e00a94) }, + { SPH_C32(0x24800000), SPH_C32(0x01410000), SPH_C32(0xea4b0000), + SPH_C32(0x07b000b3), SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), + SPH_C32(0x73e6aebc), SPH_C32(0x495bbb99), SPH_C32(0x95ff0000), + SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), SPH_C32(0x62f80141), + SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), SPH_C32(0x61c38617), + SPH_C32(0x59ea6d0a) }, + { SPH_C32(0x7b6c0000), SPH_C32(0x280a0000), SPH_C32(0x73990000), + SPH_C32(0x496000a1), SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), + SPH_C32(0x24f2a563), SPH_C32(0x79f5076e), SPH_C32(0xca570000), + SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), SPH_C32(0x060b0152), + SPH_C32(0x14592320), SPH_C32(0xec526625), SPH_C32(0x35dd13a8), + SPH_C32(0xd74eb663) }, + { SPH_C32(0x24c40000), SPH_C32(0x7e090000), SPH_C32(0x30370000), + SPH_C32(0x2d9300b2), SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), + SPH_C32(0x70ec30dc), SPH_C32(0xf751dc07), SPH_C32(0xca130000), + SPH_C32(0xd7460000), SPH_C32(0x788a0000), SPH_C32(0x2c280153), + SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), SPH_C32(0x36d78dc8), + SPH_C32(0x6944d1fd) }, + { SPH_C32(0x95bb0000), SPH_C32(0x81450000), SPH_C32(0x3b240000), + SPH_C32(0x48db0140), SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), + SPH_C32(0x62c91877), SPH_C32(0xe7e00a94), SPH_C32(0xee930000), + SPH_C32(0xd6070000), SPH_C32(0x92c10000), SPH_C32(0x2b9801e0), + SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), SPH_C32(0x45312374), + SPH_C32(0x201f6a64) }, + { SPH_C32(0xca130000), SPH_C32(0xd7460000), SPH_C32(0x788a0000), + SPH_C32(0x2c280153), SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), + SPH_C32(0x36d78dc8), SPH_C32(0x6944d1fd), SPH_C32(0xeed70000), + SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), SPH_C32(0x01bb01e1), + SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), SPH_C32(0x463bbd14), + SPH_C32(0x9e150dfa) }, + { SPH_C32(0x95ff0000), SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), + SPH_C32(0x62f80141), SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), + SPH_C32(0x61c38617), SPH_C32(0x59ea6d0a), SPH_C32(0xb17f0000), + SPH_C32(0xff4c0000), SPH_C32(0x0b130000), SPH_C32(0x654801f2), + SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), SPH_C32(0x122528ab), + SPH_C32(0x10b1d693) }, + { SPH_C32(0xca570000), SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), + SPH_C32(0x060b0152), SPH_C32(0x14592320), SPH_C32(0xec526625), + SPH_C32(0x35dd13a8), SPH_C32(0xd74eb663), SPH_C32(0xb13b0000), + SPH_C32(0x80040000), SPH_C32(0xd16f0000), SPH_C32(0x4f6b01f3), + SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), SPH_C32(0x112fb6cb), + SPH_C32(0xaebbb10d) } +}; + +static const sph_u32 T512_60[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x033d0000), SPH_C32(0x08b30000), SPH_C32(0xf33a0000), + SPH_C32(0x3ac20007), SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), + SPH_C32(0x0ea5cfe3), SPH_C32(0xe6da7ffe), SPH_C32(0xa8da0000), + SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), SPH_C32(0x07da0002), + SPH_C32(0x7d669583), SPH_C32(0x1f98708a), SPH_C32(0xbb668808), + SPH_C32(0xda878000) }, + { SPH_C32(0xa8da0000), SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), + SPH_C32(0x07da0002), SPH_C32(0x7d669583), SPH_C32(0x1f98708a), + SPH_C32(0xbb668808), SPH_C32(0xda878000), SPH_C32(0xabe70000), + SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), SPH_C32(0x3d180005), + SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), SPH_C32(0xb5c347eb), + SPH_C32(0x3c5dfffe) }, + { SPH_C32(0xabe70000), SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), + SPH_C32(0x3d180005), SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), + SPH_C32(0xb5c347eb), SPH_C32(0x3c5dfffe), SPH_C32(0x033d0000), + SPH_C32(0x08b30000), SPH_C32(0xf33a0000), SPH_C32(0x3ac20007), + SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), SPH_C32(0x0ea5cfe3), + SPH_C32(0xe6da7ffe) }, + { SPH_C32(0x01930000), SPH_C32(0xe7820000), SPH_C32(0xedfb0000), + SPH_C32(0xcf0c000b), SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), + SPH_C32(0x063661e1), SPH_C32(0x536f9e7b), SPH_C32(0x92280000), + SPH_C32(0xdc850000), SPH_C32(0x57fa0000), SPH_C32(0x56dc0003), + SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), SPH_C32(0x90cef752), + SPH_C32(0x7b1675d7) }, + { SPH_C32(0x02ae0000), SPH_C32(0xef310000), SPH_C32(0x1ec10000), + SPH_C32(0xf5ce000c), SPH_C32(0xdcf90708), SPH_C32(0xd7cdd231), + SPH_C32(0x0893ae02), SPH_C32(0xb5b5e185), SPH_C32(0x3af20000), + SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), SPH_C32(0x51060001), + SPH_C32(0xc78fb695), SPH_C32(0x4577d386), SPH_C32(0x2ba87f5a), + SPH_C32(0xa191f5d7) }, + { SPH_C32(0xa9490000), SPH_C32(0x713c0000), SPH_C32(0xb1e60000), + SPH_C32(0xc8d60009), SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), + SPH_C32(0xbd50e9e9), SPH_C32(0x89e81e7b), SPH_C32(0x39cf0000), + SPH_C32(0x42880000), SPH_C32(0xf8dd0000), SPH_C32(0x6bc40006), + SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), SPH_C32(0x250db0b9), + SPH_C32(0x474b8a29) }, + { SPH_C32(0xaa740000), SPH_C32(0x798f0000), SPH_C32(0x42dc0000), + SPH_C32(0xf214000e), SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), + SPH_C32(0xb3f5260a), SPH_C32(0x6f326185), SPH_C32(0x91150000), + SPH_C32(0xd4360000), SPH_C32(0xa4c00000), SPH_C32(0x6c1e0004), + SPH_C32(0xebc0a946), SPH_C32(0x3181c513), SPH_C32(0x9e6b38b1), + SPH_C32(0x9dcc0a29) }, + { SPH_C32(0x92280000), SPH_C32(0xdc850000), SPH_C32(0x57fa0000), + SPH_C32(0x56dc0003), SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), + SPH_C32(0x90cef752), SPH_C32(0x7b1675d7), SPH_C32(0x93bb0000), + SPH_C32(0x3b070000), SPH_C32(0xba010000), SPH_C32(0x99d00008), + SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), SPH_C32(0x96f896b3), + SPH_C32(0x2879ebac) }, + { SPH_C32(0x91150000), SPH_C32(0xd4360000), SPH_C32(0xa4c00000), + SPH_C32(0x6c1e0004), SPH_C32(0xebc0a946), SPH_C32(0x3181c513), + SPH_C32(0x9e6b38b1), SPH_C32(0x9dcc0a29), SPH_C32(0x3b610000), + SPH_C32(0xadb90000), SPH_C32(0xe61c0000), SPH_C32(0x9e0a000a), + SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), SPH_C32(0x2d9e1ebb), + SPH_C32(0xf2fe6bac) }, + { SPH_C32(0x3af20000), SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), + SPH_C32(0x51060001), SPH_C32(0xc78fb695), SPH_C32(0x4577d386), + SPH_C32(0x2ba87f5a), SPH_C32(0xa191f5d7), SPH_C32(0x385c0000), + SPH_C32(0xa50a0000), SPH_C32(0x15260000), SPH_C32(0xa4c8000d), + SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), SPH_C32(0x233bd158), + SPH_C32(0x14241452) }, + { SPH_C32(0x39cf0000), SPH_C32(0x42880000), SPH_C32(0xf8dd0000), + SPH_C32(0x6bc40006), SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), + SPH_C32(0x250db0b9), SPH_C32(0x474b8a29), SPH_C32(0x90860000), + SPH_C32(0x33b40000), SPH_C32(0x493b0000), SPH_C32(0xa312000f), + SPH_C32(0x6610241e), SPH_C32(0x8d22713d), SPH_C32(0x985d5950), + SPH_C32(0xcea39452) }, + { SPH_C32(0x93bb0000), SPH_C32(0x3b070000), SPH_C32(0xba010000), + SPH_C32(0x99d00008), SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), + SPH_C32(0x96f896b3), SPH_C32(0x2879ebac), SPH_C32(0x01930000), + SPH_C32(0xe7820000), SPH_C32(0xedfb0000), SPH_C32(0xcf0c000b), + SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), SPH_C32(0x063661e1), + SPH_C32(0x536f9e7b) }, + { SPH_C32(0x90860000), SPH_C32(0x33b40000), SPH_C32(0x493b0000), + SPH_C32(0xa312000f), SPH_C32(0x6610241e), SPH_C32(0x8d22713d), + SPH_C32(0x985d5950), SPH_C32(0xcea39452), SPH_C32(0xa9490000), + SPH_C32(0x713c0000), SPH_C32(0xb1e60000), SPH_C32(0xc8d60009), + SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), SPH_C32(0xbd50e9e9), + SPH_C32(0x89e81e7b) }, + { SPH_C32(0x3b610000), SPH_C32(0xadb90000), SPH_C32(0xe61c0000), + SPH_C32(0x9e0a000a), SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), + SPH_C32(0x2d9e1ebb), SPH_C32(0xf2fe6bac), SPH_C32(0xaa740000), + SPH_C32(0x798f0000), SPH_C32(0x42dc0000), SPH_C32(0xf214000e), + SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), SPH_C32(0xb3f5260a), + SPH_C32(0x6f326185) }, + { SPH_C32(0x385c0000), SPH_C32(0xa50a0000), SPH_C32(0x15260000), + SPH_C32(0xa4c8000d), SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), + SPH_C32(0x233bd158), SPH_C32(0x14241452), SPH_C32(0x02ae0000), + SPH_C32(0xef310000), SPH_C32(0x1ec10000), SPH_C32(0xf5ce000c), + SPH_C32(0xdcf90708), SPH_C32(0xd7cdd231), SPH_C32(0x0893ae02), + SPH_C32(0xb5b5e185) } +}; + +#define INPUT_BIG do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T512_0[acc >> 4][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + m8 = rp[8]; \ + m9 = rp[9]; \ + mA = rp[10]; \ + mB = rp[11]; \ + mC = rp[12]; \ + mD = rp[13]; \ + mE = rp[14]; \ + mF = rp[15]; \ + rp = &T512_4[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[1]; \ + rp = &T512_8[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_12[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[2]; \ + rp = &T512_16[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_20[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[3]; \ + rp = &T512_24[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_28[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[4]; \ + rp = &T512_32[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_36[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[5]; \ + rp = &T512_40[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_44[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[6]; \ + rp = &T512_48[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_52[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[7]; \ + rp = &T512_56[acc >> 4][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_60[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_BIG == 5 + +static const sph_u32 T512_0[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x23671400), SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), + SPH_C32(0xfb750000), SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), + SPH_C32(0x02c40a3f), SPH_C32(0xdc24e61f), SPH_C32(0x373d2800), + SPH_C32(0x71500000), SPH_C32(0x95e00000), SPH_C32(0x0a140000), + SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), SPH_C32(0x456d6d1f), + SPH_C32(0x3daac2da) }, + { SPH_C32(0x54285c00), SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), + SPH_C32(0xa1c50000), SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), + SPH_C32(0x6bb0419d), SPH_C32(0x551b3782), SPH_C32(0x9cbb1800), + SPH_C32(0xb0d30000), SPH_C32(0x92510000), SPH_C32(0xed930000), + SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), SPH_C32(0x430633da), + SPH_C32(0x78cace29) }, + { SPH_C32(0x774f4800), SPH_C32(0x22540000), SPH_C32(0x31110000), + SPH_C32(0x5ab00000), SPH_C32(0xc06f4315), SPH_C32(0x6c0361a8), + SPH_C32(0x69744ba2), SPH_C32(0x893fd19d), SPH_C32(0xab863000), + SPH_C32(0xc1830000), SPH_C32(0x07b10000), SPH_C32(0xe7870000), + SPH_C32(0xe4965a4c), SPH_C32(0xa9fb4dc5), SPH_C32(0x066b5ec5), + SPH_C32(0x45600cf3) }, + { SPH_C32(0x9cbb1800), SPH_C32(0xb0d30000), SPH_C32(0x92510000), + SPH_C32(0xed930000), SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), + SPH_C32(0x430633da), SPH_C32(0x78cace29), SPH_C32(0xc8934400), + SPH_C32(0x5a3e0000), SPH_C32(0x57870000), SPH_C32(0x4c560000), + SPH_C32(0xea982435), SPH_C32(0x75b11115), SPH_C32(0x28b67247), + SPH_C32(0x2dd1f9ab) }, + { SPH_C32(0xbfdc0c00), SPH_C32(0x786a0000), SPH_C32(0x66960000), + SPH_C32(0x16e60000), SPH_C32(0x2af76720), SPH_C32(0x19b270bd), + SPH_C32(0x41c239e5), SPH_C32(0xa4ee2836), SPH_C32(0xffae6c00), + SPH_C32(0x2b6e0000), SPH_C32(0xc2670000), SPH_C32(0x46420000), + SPH_C32(0x57343d3c), SPH_C32(0x3d5e8924), SPH_C32(0x6ddb1f58), + SPH_C32(0x107b3b71) }, + { SPH_C32(0xc8934400), SPH_C32(0x5a3e0000), SPH_C32(0x57870000), + SPH_C32(0x4c560000), SPH_C32(0xea982435), SPH_C32(0x75b11115), + SPH_C32(0x28b67247), SPH_C32(0x2dd1f9ab), SPH_C32(0x54285c00), + SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), SPH_C32(0xa1c50000), + SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), SPH_C32(0x6bb0419d), + SPH_C32(0x551b3782) }, + { SPH_C32(0xebf45000), SPH_C32(0x92870000), SPH_C32(0xa3400000), + SPH_C32(0xb7230000), SPH_C32(0x99550050), SPH_C32(0x8d17b45c), + SPH_C32(0x2a727878), SPH_C32(0xf1f51fb4), SPH_C32(0x63157400), + SPH_C32(0x9bbd0000), SPH_C32(0x50360000), SPH_C32(0xabd10000), + SPH_C32(0x0e0e7e79), SPH_C32(0xdc4a5cd0), SPH_C32(0x2edd2c82), + SPH_C32(0x68b1f558) }, + { SPH_C32(0x29449c00), SPH_C32(0x64e70000), SPH_C32(0xf24b0000), + SPH_C32(0xc2f30000), SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), + SPH_C32(0xf3e04259), SPH_C32(0x8d0d9ec4), SPH_C32(0x466d0c00), + SPH_C32(0x08620000), SPH_C32(0xdd5d0000), SPH_C32(0xbadd0000), + SPH_C32(0x6a927942), SPH_C32(0x441f2b93), SPH_C32(0x218ace6f), + SPH_C32(0xbf2c0be2) }, + { SPH_C32(0x0a238800), SPH_C32(0xac5e0000), SPH_C32(0x068c0000), + SPH_C32(0x39860000), SPH_C32(0x7d136aea), SPH_C32(0xae64920c), + SPH_C32(0xf1244866), SPH_C32(0x512978db), SPH_C32(0x71502400), + SPH_C32(0x79320000), SPH_C32(0x48bd0000), SPH_C32(0xb0c90000), + SPH_C32(0xd73e604b), SPH_C32(0x0cf0b3a2), SPH_C32(0x64e7a370), + SPH_C32(0x8286c938) }, + { SPH_C32(0x7d6cc000), SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), + SPH_C32(0x63360000), SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), + SPH_C32(0x985003c4), SPH_C32(0xd816a946), SPH_C32(0xdad61400), + SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), SPH_C32(0x574e0000), + SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), SPH_C32(0x628cfdb5), + SPH_C32(0xc7e6c5cb) }, + { SPH_C32(0x5e0bd400), SPH_C32(0x46b30000), SPH_C32(0xc35a0000), + SPH_C32(0x98430000), SPH_C32(0xceb10d9a), SPH_C32(0x3ac156ed), + SPH_C32(0x9a9409fb), SPH_C32(0x04324f59), SPH_C32(0xedeb3c00), + SPH_C32(0xc9e10000), SPH_C32(0xdaec0000), SPH_C32(0x5d5a0000), + SPH_C32(0x8e04230e), SPH_C32(0xede46656), SPH_C32(0x27e190aa), + SPH_C32(0xfa4c0711) }, + { SPH_C32(0xb5ff8400), SPH_C32(0xd4340000), SPH_C32(0x601a0000), + SPH_C32(0x2f600000), SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), + SPH_C32(0xb0e67183), SPH_C32(0xf5c750ed), SPH_C32(0x8efe4800), + SPH_C32(0x525c0000), SPH_C32(0x8ada0000), SPH_C32(0xf68b0000), + SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), SPH_C32(0x093cbc28), + SPH_C32(0x92fdf249) }, + { SPH_C32(0x96989000), SPH_C32(0x1c8d0000), SPH_C32(0x94dd0000), + SPH_C32(0xd4150000), SPH_C32(0x242929af), SPH_C32(0x4f7047f8), + SPH_C32(0xb2227bbc), SPH_C32(0x29e3b6f2), SPH_C32(0xb9c36000), + SPH_C32(0x230c0000), SPH_C32(0x1f3a0000), SPH_C32(0xfc9f0000), + SPH_C32(0x3da6447e), SPH_C32(0x7941a2b7), SPH_C32(0x4c51d137), + SPH_C32(0xaf573093) }, + { SPH_C32(0xe1d7d800), SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), + SPH_C32(0x8ea50000), SPH_C32(0xe4466aba), SPH_C32(0x23732650), + SPH_C32(0xdb56301e), SPH_C32(0xa0dc676f), SPH_C32(0x12455000), + SPH_C32(0xe28f0000), SPH_C32(0x188b0000), SPH_C32(0x1b180000), + SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), SPH_C32(0x4a3a8ff2), + SPH_C32(0xea373c60) }, + { SPH_C32(0xc2b0cc00), SPH_C32(0xf6600000), SPH_C32(0x510b0000), + SPH_C32(0x75d00000), SPH_C32(0x978b4edf), SPH_C32(0xdbd58319), + SPH_C32(0xd9923a21), SPH_C32(0x7cf88170), SPH_C32(0x25787800), + SPH_C32(0x93df0000), SPH_C32(0x8d6b0000), SPH_C32(0x110c0000), + SPH_C32(0x649c073b), SPH_C32(0x98557743), SPH_C32(0x0f57e2ed), + SPH_C32(0xd79dfeba) }, + { SPH_C32(0x466d0c00), SPH_C32(0x08620000), SPH_C32(0xdd5d0000), + SPH_C32(0xbadd0000), SPH_C32(0x6a927942), SPH_C32(0x441f2b93), + SPH_C32(0x218ace6f), SPH_C32(0xbf2c0be2), SPH_C32(0x6f299000), + SPH_C32(0x6c850000), SPH_C32(0x2f160000), SPH_C32(0x782e0000), + SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), SPH_C32(0xd26a8c36), + SPH_C32(0x32219526) }, + { SPH_C32(0x650a1800), SPH_C32(0xc0db0000), SPH_C32(0x299a0000), + SPH_C32(0x41a80000), SPH_C32(0x195f5d27), SPH_C32(0xbcb98eda), + SPH_C32(0x234ec450), SPH_C32(0x6308edfd), SPH_C32(0x5814b800), + SPH_C32(0x1dd50000), SPH_C32(0xbaf60000), SPH_C32(0x723a0000), + SPH_C32(0xd9e02ec4), SPH_C32(0x5a3284e7), SPH_C32(0x9707e129), + SPH_C32(0x0f8b57fc) }, + { SPH_C32(0x12455000), SPH_C32(0xe28f0000), SPH_C32(0x188b0000), + SPH_C32(0x1b180000), SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), + SPH_C32(0x4a3a8ff2), SPH_C32(0xea373c60), SPH_C32(0xf3928800), + SPH_C32(0xdc560000), SPH_C32(0xbd470000), SPH_C32(0x95bd0000), + SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), SPH_C32(0x916cbfec), + SPH_C32(0x4aeb5b0f) }, + { SPH_C32(0x31224400), SPH_C32(0x2a360000), SPH_C32(0xec4c0000), + SPH_C32(0xe06d0000), SPH_C32(0xaafd3a57), SPH_C32(0x281c4a3b), + SPH_C32(0x48fe85cd), SPH_C32(0x3613da7f), SPH_C32(0xc4afa000), + SPH_C32(0xad060000), SPH_C32(0x28a70000), SPH_C32(0x9fa90000), + SPH_C32(0x80da6d81), SPH_C32(0xbb265113), SPH_C32(0xd401d2f3), + SPH_C32(0x774199d5) }, + { SPH_C32(0xdad61400), SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), + SPH_C32(0x574e0000), SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), + SPH_C32(0x628cfdb5), SPH_C32(0xc7e6c5cb), SPH_C32(0xa7bad400), + SPH_C32(0x36bb0000), SPH_C32(0x78910000), SPH_C32(0x34780000), + SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), SPH_C32(0xfadcfe71), + SPH_C32(0x1ff06c8d) }, + { SPH_C32(0xf9b10000), SPH_C32(0x70080000), SPH_C32(0xbbcb0000), + SPH_C32(0xac3b0000), SPH_C32(0x40651e62), SPH_C32(0x5dad5b2e), + SPH_C32(0x6048f78a), SPH_C32(0x1bc223d4), SPH_C32(0x9087fc00), + SPH_C32(0x47eb0000), SPH_C32(0xed710000), SPH_C32(0x3e6c0000), + SPH_C32(0x33780af1), SPH_C32(0x2f8395f2), SPH_C32(0xbfb1936e), + SPH_C32(0x225aae57) }, + { SPH_C32(0x8efe4800), SPH_C32(0x525c0000), SPH_C32(0x8ada0000), + SPH_C32(0xf68b0000), SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), + SPH_C32(0x093cbc28), SPH_C32(0x92fdf249), SPH_C32(0x3b01cc00), + SPH_C32(0x86680000), SPH_C32(0xeac00000), SPH_C32(0xd9eb0000), + SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), SPH_C32(0xb9dacdab), + SPH_C32(0x673aa2a4) }, + { SPH_C32(0xad995c00), SPH_C32(0x9ae50000), SPH_C32(0x7e1d0000), + SPH_C32(0x0dfe0000), SPH_C32(0xf3c77912), SPH_C32(0xc9089fcf), + SPH_C32(0x0bf8b617), SPH_C32(0x4ed91456), SPH_C32(0x0c3ce400), + SPH_C32(0xf7380000), SPH_C32(0x7f200000), SPH_C32(0xd3ff0000), + SPH_C32(0x6a4249b4), SPH_C32(0xce974006), SPH_C32(0xfcb7a0b4), + SPH_C32(0x5a90607e) }, + { SPH_C32(0x6f299000), SPH_C32(0x6c850000), SPH_C32(0x2f160000), + SPH_C32(0x782e0000), SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), + SPH_C32(0xd26a8c36), SPH_C32(0x32219526), SPH_C32(0x29449c00), + SPH_C32(0x64e70000), SPH_C32(0xf24b0000), SPH_C32(0xc2f30000), + SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), SPH_C32(0xf3e04259), + SPH_C32(0x8d0d9ec4) }, + { SPH_C32(0x4c4e8400), SPH_C32(0xa43c0000), SPH_C32(0xdbd10000), + SPH_C32(0x835b0000), SPH_C32(0x178113a8), SPH_C32(0xea7bb99f), + SPH_C32(0xd0ae8609), SPH_C32(0xee057339), SPH_C32(0x1e79b400), + SPH_C32(0x15b70000), SPH_C32(0x67ab0000), SPH_C32(0xc8e70000), + SPH_C32(0xb3725786), SPH_C32(0x1e2daf74), SPH_C32(0xb68d2f46), + SPH_C32(0xb0a75c1e) }, + { SPH_C32(0x3b01cc00), SPH_C32(0x86680000), SPH_C32(0xeac00000), + SPH_C32(0xd9eb0000), SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), + SPH_C32(0xb9dacdab), SPH_C32(0x673aa2a4), SPH_C32(0xb5ff8400), + SPH_C32(0xd4340000), SPH_C32(0x601a0000), SPH_C32(0x2f600000), + SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), SPH_C32(0xb0e67183), + SPH_C32(0xf5c750ed) }, + { SPH_C32(0x1866d800), SPH_C32(0x4ed10000), SPH_C32(0x1e070000), + SPH_C32(0x229e0000), SPH_C32(0xa42374d8), SPH_C32(0x7ede7d7e), + SPH_C32(0xbb1ec794), SPH_C32(0xbb1e44bb), SPH_C32(0x82c2ac00), + SPH_C32(0xa5640000), SPH_C32(0xf5fa0000), SPH_C32(0x25740000), + SPH_C32(0xea4814c3), SPH_C32(0xff397a80), SPH_C32(0xf58b1c9c), + SPH_C32(0xc86d9237) }, + { SPH_C32(0xf3928800), SPH_C32(0xdc560000), SPH_C32(0xbd470000), + SPH_C32(0x95bd0000), SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), + SPH_C32(0x916cbfec), SPH_C32(0x4aeb5b0f), SPH_C32(0xe1d7d800), + SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), SPH_C32(0x8ea50000), + SPH_C32(0xe4466aba), SPH_C32(0x23732650), SPH_C32(0xdb56301e), + SPH_C32(0xa0dc676f) }, + { SPH_C32(0xd0f59c00), SPH_C32(0x14ef0000), SPH_C32(0x49800000), + SPH_C32(0x6ec80000), SPH_C32(0x4ebb50ed), SPH_C32(0x0b6f6c6b), + SPH_C32(0x93a8b5d3), SPH_C32(0x96cfbd10), SPH_C32(0xd6eaf000), + SPH_C32(0x4f890000), SPH_C32(0x302c0000), SPH_C32(0x84b10000), + SPH_C32(0x59ea73b3), SPH_C32(0x6b9cbe61), SPH_C32(0x9e3b5d01), + SPH_C32(0x9d76a5b5) }, + { SPH_C32(0xa7bad400), SPH_C32(0x36bb0000), SPH_C32(0x78910000), + SPH_C32(0x34780000), SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), + SPH_C32(0xfadcfe71), SPH_C32(0x1ff06c8d), SPH_C32(0x7d6cc000), + SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), SPH_C32(0x63360000), + SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), SPH_C32(0x985003c4), + SPH_C32(0xd816a946) }, + { SPH_C32(0x84ddc000), SPH_C32(0xfe020000), SPH_C32(0x8c560000), + SPH_C32(0xcf0d0000), SPH_C32(0xfd19379d), SPH_C32(0x9fcaa88a), + SPH_C32(0xf818f44e), SPH_C32(0xc3d48a92), SPH_C32(0x4a51e800), + SPH_C32(0xff5a0000), SPH_C32(0xa27d0000), SPH_C32(0x69220000), + SPH_C32(0x00d030f6), SPH_C32(0x8a886b95), SPH_C32(0xdd3d6edb), + SPH_C32(0xe5bc6b9c) } +}; + +static const sph_u32 T512_5[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xe8870170), SPH_C32(0x9d720000), SPH_C32(0x12db0000), + SPH_C32(0xd4220000), SPH_C32(0xf2886b27), SPH_C32(0xa921e543), + SPH_C32(0x4ef8b518), SPH_C32(0x618813b1), SPH_C32(0xb4370060), + SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), SPH_C32(0x5cae0000), + SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), SPH_C32(0x1b365f3d), + SPH_C32(0xf3d45758) }, + { SPH_C32(0xb4370060), SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), + SPH_C32(0x5cae0000), SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), + SPH_C32(0x1b365f3d), SPH_C32(0xf3d45758), SPH_C32(0x5cb00110), + SPH_C32(0x913e0000), SPH_C32(0x44190000), SPH_C32(0x888c0000), + SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), SPH_C32(0x55ceea25), + SPH_C32(0x925c44e9) }, + { SPH_C32(0x5cb00110), SPH_C32(0x913e0000), SPH_C32(0x44190000), + SPH_C32(0x888c0000), SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), + SPH_C32(0x55ceea25), SPH_C32(0x925c44e9), SPH_C32(0xe8870170), + SPH_C32(0x9d720000), SPH_C32(0x12db0000), SPH_C32(0xd4220000), + SPH_C32(0xf2886b27), SPH_C32(0xa921e543), SPH_C32(0x4ef8b518), + SPH_C32(0x618813b1) }, + { SPH_C32(0xef0b0270), SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), + SPH_C32(0x69490000), SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), + SPH_C32(0x66140a51), SPH_C32(0x924f5d0a), SPH_C32(0xc96b0030), + SPH_C32(0xe7250000), SPH_C32(0x2f840000), SPH_C32(0x264f0000), + SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), SPH_C32(0x509f6984), + SPH_C32(0x9e69af68) }, + { SPH_C32(0x078c0300), SPH_C32(0xa78f0000), SPH_C32(0x4f750000), + SPH_C32(0xbd6b0000), SPH_C32(0x69875721), SPH_C32(0xed2450ba), + SPH_C32(0x28ecbf49), SPH_C32(0xf3c74ebb), SPH_C32(0x7d5c0050), + SPH_C32(0xeb690000), SPH_C32(0x79460000), SPH_C32(0x7ae10000), + SPH_C32(0x9c3d44c6), SPH_C32(0x56c20912), SPH_C32(0x4ba936b9), + SPH_C32(0x6dbdf830) }, + { SPH_C32(0x5b3c0210), SPH_C32(0x36b10000), SPH_C32(0x0b6c0000), + SPH_C32(0x35e70000), SPH_C32(0x0f5b2339), SPH_C32(0x7f3b4ddc), + SPH_C32(0x7d22556c), SPH_C32(0x619b0a52), SPH_C32(0x95db0120), + SPH_C32(0x761b0000), SPH_C32(0x6b9d0000), SPH_C32(0xaec30000), + SPH_C32(0x6eb52fe1), SPH_C32(0xffe3ec51), SPH_C32(0x055183a1), + SPH_C32(0x0c35eb81) }, + { SPH_C32(0xb3bb0360), SPH_C32(0xabc30000), SPH_C32(0x19b70000), + SPH_C32(0xe1c50000), SPH_C32(0xfdd3481e), SPH_C32(0xd61aa89f), + SPH_C32(0x33dae074), SPH_C32(0x001319e3), SPH_C32(0x21ec0140), + SPH_C32(0x7a570000), SPH_C32(0x3d5f0000), SPH_C32(0xf26d0000), + SPH_C32(0xfae130de), SPH_C32(0xc4dd1474), SPH_C32(0x1e67dc9c), + SPH_C32(0xffe1bcd9) }, + { SPH_C32(0xc96b0030), SPH_C32(0xe7250000), SPH_C32(0x2f840000), + SPH_C32(0x264f0000), SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), + SPH_C32(0x509f6984), SPH_C32(0x9e69af68), SPH_C32(0x26600240), + SPH_C32(0xddd80000), SPH_C32(0x722a0000), SPH_C32(0x4f060000), + SPH_C32(0x936667ff), SPH_C32(0x29f944ce), SPH_C32(0x368b63d5), + SPH_C32(0x0c26f262) }, + { SPH_C32(0x21ec0140), SPH_C32(0x7a570000), SPH_C32(0x3d5f0000), + SPH_C32(0xf26d0000), SPH_C32(0xfae130de), SPH_C32(0xc4dd1474), + SPH_C32(0x1e67dc9c), SPH_C32(0xffe1bcd9), SPH_C32(0x92570220), + SPH_C32(0xd1940000), SPH_C32(0x24e80000), SPH_C32(0x13a80000), + SPH_C32(0x073278c0), SPH_C32(0x12c7bceb), SPH_C32(0x2dbd3ce8), + SPH_C32(0xfff2a53a) }, + { SPH_C32(0x7d5c0050), SPH_C32(0xeb690000), SPH_C32(0x79460000), + SPH_C32(0x7ae10000), SPH_C32(0x9c3d44c6), SPH_C32(0x56c20912), + SPH_C32(0x4ba936b9), SPH_C32(0x6dbdf830), SPH_C32(0x7ad00350), + SPH_C32(0x4ce60000), SPH_C32(0x36330000), SPH_C32(0xc78a0000), + SPH_C32(0xf5ba13e7), SPH_C32(0xbbe659a8), SPH_C32(0x634589f0), + SPH_C32(0x9e7ab68b) }, + { SPH_C32(0x95db0120), SPH_C32(0x761b0000), SPH_C32(0x6b9d0000), + SPH_C32(0xaec30000), SPH_C32(0x6eb52fe1), SPH_C32(0xffe3ec51), + SPH_C32(0x055183a1), SPH_C32(0x0c35eb81), SPH_C32(0xcee70330), + SPH_C32(0x40aa0000), SPH_C32(0x60f10000), SPH_C32(0x9b240000), + SPH_C32(0x61ee0cd8), SPH_C32(0x80d8a18d), SPH_C32(0x7873d6cd), + SPH_C32(0x6daee1d3) }, + { SPH_C32(0x26600240), SPH_C32(0xddd80000), SPH_C32(0x722a0000), + SPH_C32(0x4f060000), SPH_C32(0x936667ff), SPH_C32(0x29f944ce), + SPH_C32(0x368b63d5), SPH_C32(0x0c26f262), SPH_C32(0xef0b0270), + SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), SPH_C32(0x69490000), + SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), SPH_C32(0x66140a51), + SPH_C32(0x924f5d0a) }, + { SPH_C32(0xcee70330), SPH_C32(0x40aa0000), SPH_C32(0x60f10000), + SPH_C32(0x9b240000), SPH_C32(0x61ee0cd8), SPH_C32(0x80d8a18d), + SPH_C32(0x7873d6cd), SPH_C32(0x6daee1d3), SPH_C32(0x5b3c0210), + SPH_C32(0x36b10000), SPH_C32(0x0b6c0000), SPH_C32(0x35e70000), + SPH_C32(0x0f5b2339), SPH_C32(0x7f3b4ddc), SPH_C32(0x7d22556c), + SPH_C32(0x619b0a52) }, + { SPH_C32(0x92570220), SPH_C32(0xd1940000), SPH_C32(0x24e80000), + SPH_C32(0x13a80000), SPH_C32(0x073278c0), SPH_C32(0x12c7bceb), + SPH_C32(0x2dbd3ce8), SPH_C32(0xfff2a53a), SPH_C32(0xb3bb0360), + SPH_C32(0xabc30000), SPH_C32(0x19b70000), SPH_C32(0xe1c50000), + SPH_C32(0xfdd3481e), SPH_C32(0xd61aa89f), SPH_C32(0x33dae074), + SPH_C32(0x001319e3) }, + { SPH_C32(0x7ad00350), SPH_C32(0x4ce60000), SPH_C32(0x36330000), + SPH_C32(0xc78a0000), SPH_C32(0xf5ba13e7), SPH_C32(0xbbe659a8), + SPH_C32(0x634589f0), SPH_C32(0x9e7ab68b), SPH_C32(0x078c0300), + SPH_C32(0xa78f0000), SPH_C32(0x4f750000), SPH_C32(0xbd6b0000), + SPH_C32(0x69875721), SPH_C32(0xed2450ba), SPH_C32(0x28ecbf49), + SPH_C32(0xf3c74ebb) }, + { SPH_C32(0x145a3c00), SPH_C32(0xb9e90000), SPH_C32(0x61270000), + SPH_C32(0xf1610000), SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), + SPH_C32(0x47a96720), SPH_C32(0xe18e24c5), SPH_C32(0x23671400), + SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), SPH_C32(0xfb750000), + SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), SPH_C32(0x02c40a3f), + SPH_C32(0xdc24e61f) }, + { SPH_C32(0xfcdd3d70), SPH_C32(0x249b0000), SPH_C32(0x73fc0000), + SPH_C32(0x25430000), SPH_C32(0x3ce9564b), SPH_C32(0x1968d83b), + SPH_C32(0x0951d238), SPH_C32(0x80063774), SPH_C32(0x97501460), + SPH_C32(0xc4f50000), SPH_C32(0xa2050000), SPH_C32(0xa7db0000), + SPH_C32(0xe7993b5a), SPH_C32(0xc3985d6c), SPH_C32(0x19f25502), + SPH_C32(0x2ff0b147) }, + { SPH_C32(0xa06d3c60), SPH_C32(0xb5a50000), SPH_C32(0x37e50000), + SPH_C32(0xadcf0000), SPH_C32(0x5a352253), SPH_C32(0x8b77c55d), + SPH_C32(0x5c9f381d), SPH_C32(0x125a739d), SPH_C32(0x7fd71510), + SPH_C32(0x59870000), SPH_C32(0xb0de0000), SPH_C32(0x73f90000), + SPH_C32(0x1511507d), SPH_C32(0x6ab9b82f), SPH_C32(0x570ae01a), + SPH_C32(0x4e78a2f6) }, + { SPH_C32(0x48ea3d10), SPH_C32(0x28d70000), SPH_C32(0x253e0000), + SPH_C32(0x79ed0000), SPH_C32(0xa8bd4974), SPH_C32(0x2256201e), + SPH_C32(0x12678d05), SPH_C32(0x73d2602c), SPH_C32(0xcbe01570), + SPH_C32(0x55cb0000), SPH_C32(0xe61c0000), SPH_C32(0x2f570000), + SPH_C32(0x81454f42), SPH_C32(0x5187400a), SPH_C32(0x4c3cbf27), + SPH_C32(0xbdacf5ae) }, + { SPH_C32(0xfb513e70), SPH_C32(0x83140000), SPH_C32(0x3c890000), + SPH_C32(0x98280000), SPH_C32(0x556e016a), SPH_C32(0xf44c8881), + SPH_C32(0x21bd6d71), SPH_C32(0x73c179cf), SPH_C32(0xea0c1430), + SPH_C32(0x2f9c0000), SPH_C32(0xdb430000), SPH_C32(0xdd3a0000), + SPH_C32(0x7ba47f9c), SPH_C32(0x955a547e), SPH_C32(0x525b63bb), + SPH_C32(0x424d4977) }, + { SPH_C32(0x13d63f00), SPH_C32(0x1e660000), SPH_C32(0x2e520000), + SPH_C32(0x4c0a0000), SPH_C32(0xa7e66a4d), SPH_C32(0x5d6d6dc2), + SPH_C32(0x6f45d869), SPH_C32(0x12496a7e), SPH_C32(0x5e3b1450), + SPH_C32(0x23d00000), SPH_C32(0x8d810000), SPH_C32(0x81940000), + SPH_C32(0xeff060a3), SPH_C32(0xae64ac5b), SPH_C32(0x496d3c86), + SPH_C32(0xb1991e2f) }, + { SPH_C32(0x4f663e10), SPH_C32(0x8f580000), SPH_C32(0x6a4b0000), + SPH_C32(0xc4860000), SPH_C32(0xc13a1e55), SPH_C32(0xcf7270a4), + SPH_C32(0x3a8b324c), SPH_C32(0x80152e97), SPH_C32(0xb6bc1520), + SPH_C32(0xbea20000), SPH_C32(0x9f5a0000), SPH_C32(0x55b60000), + SPH_C32(0x1d780b84), SPH_C32(0x07454918), SPH_C32(0x0795899e), + SPH_C32(0xd0110d9e) }, + { SPH_C32(0xa7e13f60), SPH_C32(0x122a0000), SPH_C32(0x78900000), + SPH_C32(0x10a40000), SPH_C32(0x33b27572), SPH_C32(0x665395e7), + SPH_C32(0x74738754), SPH_C32(0xe19d3d26), SPH_C32(0x028b1540), + SPH_C32(0xb2ee0000), SPH_C32(0xc9980000), SPH_C32(0x09180000), + SPH_C32(0x892c14bb), SPH_C32(0x3c7bb13d), SPH_C32(0x1ca3d6a3), + SPH_C32(0x23c55ac6) }, + { SPH_C32(0xdd313c30), SPH_C32(0x5ecc0000), SPH_C32(0x4ea30000), + SPH_C32(0xd72e0000), SPH_C32(0xc6086695), SPH_C32(0xddb5cc4f), + SPH_C32(0x17360ea4), SPH_C32(0x7fe78bad), SPH_C32(0x05071640), + SPH_C32(0x15610000), SPH_C32(0x86ed0000), SPH_C32(0xb4730000), + SPH_C32(0xe0ab439a), SPH_C32(0xd15fe187), SPH_C32(0x344f69ea), + SPH_C32(0xd002147d) }, + { SPH_C32(0x35b63d40), SPH_C32(0xc3be0000), SPH_C32(0x5c780000), + SPH_C32(0x030c0000), SPH_C32(0x34800db2), SPH_C32(0x7494290c), + SPH_C32(0x59cebbbc), SPH_C32(0x1e6f981c), SPH_C32(0xb1301620), + SPH_C32(0x192d0000), SPH_C32(0xd02f0000), SPH_C32(0xe8dd0000), + SPH_C32(0x74ff5ca5), SPH_C32(0xea6119a2), SPH_C32(0x2f7936d7), + SPH_C32(0x23d64325) }, + { SPH_C32(0x69063c50), SPH_C32(0x52800000), SPH_C32(0x18610000), + SPH_C32(0x8b800000), SPH_C32(0x525c79aa), SPH_C32(0xe68b346a), + SPH_C32(0x0c005199), SPH_C32(0x8c33dcf5), SPH_C32(0x59b71750), + SPH_C32(0x845f0000), SPH_C32(0xc2f40000), SPH_C32(0x3cff0000), + SPH_C32(0x86773782), SPH_C32(0x4340fce1), SPH_C32(0x618183cf), + SPH_C32(0x425e5094) }, + { SPH_C32(0x81813d20), SPH_C32(0xcff20000), SPH_C32(0x0aba0000), + SPH_C32(0x5fa20000), SPH_C32(0xa0d4128d), SPH_C32(0x4faad129), + SPH_C32(0x42f8e481), SPH_C32(0xedbbcf44), SPH_C32(0xed801730), + SPH_C32(0x88130000), SPH_C32(0x94360000), SPH_C32(0x60510000), + SPH_C32(0x122328bd), SPH_C32(0x787e04c4), SPH_C32(0x7ab7dcf2), + SPH_C32(0xb18a07cc) }, + { SPH_C32(0x323a3e40), SPH_C32(0x64310000), SPH_C32(0x130d0000), + SPH_C32(0xbe670000), SPH_C32(0x5d075a93), SPH_C32(0x99b079b6), + SPH_C32(0x712204f5), SPH_C32(0xeda8d6a7), SPH_C32(0xcc6c1670), + SPH_C32(0xf2440000), SPH_C32(0xa9690000), SPH_C32(0x923c0000), + SPH_C32(0xe8c21863), SPH_C32(0xbca310b0), SPH_C32(0x64d0006e), + SPH_C32(0x4e6bbb15) }, + { SPH_C32(0xdabd3f30), SPH_C32(0xf9430000), SPH_C32(0x01d60000), + SPH_C32(0x6a450000), SPH_C32(0xaf8f31b4), SPH_C32(0x30919cf5), + SPH_C32(0x3fdab1ed), SPH_C32(0x8c20c516), SPH_C32(0x785b1610), + SPH_C32(0xfe080000), SPH_C32(0xffab0000), SPH_C32(0xce920000), + SPH_C32(0x7c96075c), SPH_C32(0x879de895), SPH_C32(0x7fe65f53), + SPH_C32(0xbdbfec4d) }, + { SPH_C32(0x860d3e20), SPH_C32(0x687d0000), SPH_C32(0x45cf0000), + SPH_C32(0xe2c90000), SPH_C32(0xc95345ac), SPH_C32(0xa28e8193), + SPH_C32(0x6a145bc8), SPH_C32(0x1e7c81ff), SPH_C32(0x90dc1760), + SPH_C32(0x637a0000), SPH_C32(0xed700000), SPH_C32(0x1ab00000), + SPH_C32(0x8e1e6c7b), SPH_C32(0x2ebc0dd6), SPH_C32(0x311eea4b), + SPH_C32(0xdc37fffc) }, + { SPH_C32(0x6e8a3f50), SPH_C32(0xf50f0000), SPH_C32(0x57140000), + SPH_C32(0x36eb0000), SPH_C32(0x3bdb2e8b), SPH_C32(0x0baf64d0), + SPH_C32(0x24eceed0), SPH_C32(0x7ff4924e), SPH_C32(0x24eb1700), + SPH_C32(0x6f360000), SPH_C32(0xbbb20000), SPH_C32(0x461e0000), + SPH_C32(0x1a4a7344), SPH_C32(0x1582f5f3), SPH_C32(0x2a28b576), + SPH_C32(0x2fe3a8a4) } +}; + +static const sph_u32 T512_10[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xa67f0001), SPH_C32(0x71378000), SPH_C32(0x19fc0000), + SPH_C32(0x96db0000), SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), + SPH_C32(0x2c6d478f), SPH_C32(0xac8e6c88), SPH_C32(0x50ff0004), + SPH_C32(0x45744000), SPH_C32(0x3dfb0000), SPH_C32(0x19e60000), + SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), SPH_C32(0xe1a8cc96), + SPH_C32(0x7b1bd6b9) }, + { SPH_C32(0xf7750009), SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), + SPH_C32(0x04920000), SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), + SPH_C32(0x7a87f14e), SPH_C32(0x9e16981a), SPH_C32(0xd46a0000), + SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), SPH_C32(0x4a290000), + SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), SPH_C32(0x98369604), + SPH_C32(0xf746c320) }, + { SPH_C32(0x510a0008), SPH_C32(0xbe0b4000), SPH_C32(0xda2a0000), + SPH_C32(0x92490000), SPH_C32(0x381e7454), SPH_C32(0x13229849), + SPH_C32(0x56eab6c1), SPH_C32(0x3298f492), SPH_C32(0x84950004), + SPH_C32(0xc8bc8000), SPH_C32(0x98540000), SPH_C32(0x53cf0000), + SPH_C32(0xe7f2147c), SPH_C32(0x28c6fd31), SPH_C32(0x799e5a92), + SPH_C32(0x8c5d1599) }, + { SPH_C32(0xd46a0000), SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), + SPH_C32(0x4a290000), SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), + SPH_C32(0x98369604), SPH_C32(0xf746c320), SPH_C32(0x231f0009), + SPH_C32(0x42f40000), SPH_C32(0x66790000), SPH_C32(0x4ebb0000), + SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), SPH_C32(0xe2b1674a), + SPH_C32(0x69505b3a) }, + { SPH_C32(0x72150001), SPH_C32(0xfcff4000), SPH_C32(0xbc530000), + SPH_C32(0xdcf20000), SPH_C32(0xc6c52f87), SPH_C32(0x227e289f), + SPH_C32(0xb45bd18b), SPH_C32(0x5bc8afa8), SPH_C32(0x73e0000d), + SPH_C32(0x07804000), SPH_C32(0x5b820000), SPH_C32(0x575d0000), + SPH_C32(0xe5670dd5), SPH_C32(0xd02ecb8b), SPH_C32(0x0319abdc), + SPH_C32(0x124b8d83) }, + { SPH_C32(0x231f0009), SPH_C32(0x42f40000), SPH_C32(0x66790000), + SPH_C32(0x4ebb0000), SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), + SPH_C32(0xe2b1674a), SPH_C32(0x69505b3a), SPH_C32(0xf7750009), + SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), SPH_C32(0x04920000), + SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), SPH_C32(0x7a87f14e), + SPH_C32(0x9e16981a) }, + { SPH_C32(0x85600008), SPH_C32(0x33c38000), SPH_C32(0x7f850000), + SPH_C32(0xd8600000), SPH_C32(0xc450362e), SPH_C32(0xda961e25), + SPH_C32(0xcedc20c5), SPH_C32(0xc5de37b2), SPH_C32(0xa78a000d), + SPH_C32(0x8a488000), SPH_C32(0xfe2d0000), SPH_C32(0x1d740000), + SPH_C32(0x19294faf), SPH_C32(0x199a4de7), SPH_C32(0x9b2f3dd8), + SPH_C32(0xe50d4ea3) }, + { SPH_C32(0x774400f0), SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), + SPH_C32(0x34140000), SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), + SPH_C32(0x0bc3cd1e), SPH_C32(0xcf3775cb), SPH_C32(0xf46c0050), + SPH_C32(0x96180000), SPH_C32(0x14a50000), SPH_C32(0x031f0000), + SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), SPH_C32(0x9ca470d2), + SPH_C32(0x8a341574) }, + { SPH_C32(0xd13b00f1), SPH_C32(0x806d8000), SPH_C32(0xec4e0000), + SPH_C32(0xa2cf0000), SPH_C32(0xb3bc1371), SPH_C32(0xb14142d6), + SPH_C32(0x27ae8a91), SPH_C32(0x63b91943), SPH_C32(0xa4930054), + SPH_C32(0xd36c4000), SPH_C32(0x295e0000), SPH_C32(0x1af90000), + SPH_C32(0x592828be), SPH_C32(0x87cd0544), SPH_C32(0x7d0cbc44), + SPH_C32(0xf12fc3cd) }, + { SPH_C32(0x803100f9), SPH_C32(0x3e66c000), SPH_C32(0x36640000), + SPH_C32(0x30860000), SPH_C32(0x8ba26725), SPH_C32(0xa263da9f), + SPH_C32(0x71443c50), SPH_C32(0x5121edd1), SPH_C32(0x20060050), + SPH_C32(0x1bd0c000), SPH_C32(0xb10a0000), SPH_C32(0x49360000), + SPH_C32(0xbeda3cc2), SPH_C32(0xaf0bf875), SPH_C32(0x0492e6d6), + SPH_C32(0x7d72d654) }, + { SPH_C32(0x264e00f8), SPH_C32(0x4f514000), SPH_C32(0x2f980000), + SPH_C32(0xa65d0000), SPH_C32(0xb1290ad8), SPH_C32(0x49a9746c), + SPH_C32(0x5d297bdf), SPH_C32(0xfdaf8159), SPH_C32(0x70f90054), + SPH_C32(0x5ea48000), SPH_C32(0x8cf10000), SPH_C32(0x50d00000), + SPH_C32(0xa5666ac4), SPH_C32(0x4e798328), SPH_C32(0xe53a2a40), + SPH_C32(0x066900ed) }, + { SPH_C32(0xa32e00f0), SPH_C32(0x7c92c000), SPH_C32(0x501d0000), + SPH_C32(0x7e3d0000), SPH_C32(0x75793cf6), SPH_C32(0x933f6a49), + SPH_C32(0x93f55b1a), SPH_C32(0x3871b6eb), SPH_C32(0xd7730059), + SPH_C32(0xd4ec0000), SPH_C32(0x72dc0000), SPH_C32(0x4da40000), + SPH_C32(0xbc4f256b), SPH_C32(0x57e3cecf), SPH_C32(0x7e151798), + SPH_C32(0xe3644e4e) }, + { SPH_C32(0x055100f1), SPH_C32(0x0da54000), SPH_C32(0x49e10000), + SPH_C32(0xe8e60000), SPH_C32(0x4ff2510b), SPH_C32(0x78f5c4ba), + SPH_C32(0xbf981c95), SPH_C32(0x94ffda63), SPH_C32(0x878c005d), + SPH_C32(0x91984000), SPH_C32(0x4f270000), SPH_C32(0x54420000), + SPH_C32(0xa7f3736d), SPH_C32(0xb691b592), SPH_C32(0x9fbddb0e), + SPH_C32(0x987f98f7) }, + { SPH_C32(0x545b00f9), SPH_C32(0xb3ae0000), SPH_C32(0x93cb0000), + SPH_C32(0x7aaf0000), SPH_C32(0x77ec255f), SPH_C32(0x6bd75cf3), + SPH_C32(0xe972aa54), SPH_C32(0xa6672ef1), SPH_C32(0x03190059), + SPH_C32(0x5924c000), SPH_C32(0xd7730000), SPH_C32(0x078d0000), + SPH_C32(0x40016711), SPH_C32(0x9e5748a3), SPH_C32(0xe623819c), + SPH_C32(0x14228d6e) }, + { SPH_C32(0xf22400f8), SPH_C32(0xc2998000), SPH_C32(0x8a370000), + SPH_C32(0xec740000), SPH_C32(0x4d6748a2), SPH_C32(0x801df200), + SPH_C32(0xc51feddb), SPH_C32(0x0ae94279), SPH_C32(0x53e6005d), + SPH_C32(0x1c508000), SPH_C32(0xea880000), SPH_C32(0x1e6b0000), + SPH_C32(0x5bbd3117), SPH_C32(0x7f2533fe), SPH_C32(0x078b4d0a), + SPH_C32(0x6f395bd7) }, + { SPH_C32(0xf46c0050), SPH_C32(0x96180000), SPH_C32(0x14a50000), + SPH_C32(0x031f0000), SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), + SPH_C32(0x9ca470d2), SPH_C32(0x8a341574), SPH_C32(0x832800a0), + SPH_C32(0x67420000), SPH_C32(0xe1170000), SPH_C32(0x370b0000), + SPH_C32(0xcba30034), SPH_C32(0x3c34923c), SPH_C32(0x9767bdcc), + SPH_C32(0x450360bf) }, + { SPH_C32(0x52130051), SPH_C32(0xe72f8000), SPH_C32(0x0d590000), + SPH_C32(0x95c40000), SPH_C32(0x781f1345), SPH_C32(0x8d75d0ea), + SPH_C32(0xb0c9375d), SPH_C32(0x26ba79fc), SPH_C32(0xd3d700a4), + SPH_C32(0x22364000), SPH_C32(0xdcec0000), SPH_C32(0x2eed0000), + SPH_C32(0xd01f5632), SPH_C32(0xdd46e961), SPH_C32(0x76cf715a), + SPH_C32(0x3e18b606) }, + { SPH_C32(0x03190059), SPH_C32(0x5924c000), SPH_C32(0xd7730000), + SPH_C32(0x078d0000), SPH_C32(0x40016711), SPH_C32(0x9e5748a3), + SPH_C32(0xe623819c), SPH_C32(0x14228d6e), SPH_C32(0x574200a0), + SPH_C32(0xea8ac000), SPH_C32(0x44b80000), SPH_C32(0x7d220000), + SPH_C32(0x37ed424e), SPH_C32(0xf5801450), SPH_C32(0x0f512bc8), + SPH_C32(0xb245a39f) }, + { SPH_C32(0xa5660058), SPH_C32(0x28134000), SPH_C32(0xce8f0000), + SPH_C32(0x91560000), SPH_C32(0x7a8a0aec), SPH_C32(0x759de650), + SPH_C32(0xca4ec613), SPH_C32(0xb8ace1e6), SPH_C32(0x07bd00a4), + SPH_C32(0xaffe8000), SPH_C32(0x79430000), SPH_C32(0x64c40000), + SPH_C32(0x2c511448), SPH_C32(0x14f26f0d), SPH_C32(0xeef9e75e), + SPH_C32(0xc95e7526) }, + { SPH_C32(0x20060050), SPH_C32(0x1bd0c000), SPH_C32(0xb10a0000), + SPH_C32(0x49360000), SPH_C32(0xbeda3cc2), SPH_C32(0xaf0bf875), + SPH_C32(0x0492e6d6), SPH_C32(0x7d72d654), SPH_C32(0xa03700a9), + SPH_C32(0x25b60000), SPH_C32(0x876e0000), SPH_C32(0x79b00000), + SPH_C32(0x35785be7), SPH_C32(0x0d6822ea), SPH_C32(0x75d6da86), + SPH_C32(0x2c533b85) }, + { SPH_C32(0x86790051), SPH_C32(0x6ae74000), SPH_C32(0xa8f60000), + SPH_C32(0xdfed0000), SPH_C32(0x8451513f), SPH_C32(0x44c15686), + SPH_C32(0x28ffa159), SPH_C32(0xd1fcbadc), SPH_C32(0xf0c800ad), + SPH_C32(0x60c24000), SPH_C32(0xba950000), SPH_C32(0x60560000), + SPH_C32(0x2ec40de1), SPH_C32(0xec1a59b7), SPH_C32(0x947e1610), + SPH_C32(0x5748ed3c) }, + { SPH_C32(0xd7730059), SPH_C32(0xd4ec0000), SPH_C32(0x72dc0000), + SPH_C32(0x4da40000), SPH_C32(0xbc4f256b), SPH_C32(0x57e3cecf), + SPH_C32(0x7e151798), SPH_C32(0xe3644e4e), SPH_C32(0x745d00a9), + SPH_C32(0xa87ec000), SPH_C32(0x22c10000), SPH_C32(0x33990000), + SPH_C32(0xc936199d), SPH_C32(0xc4dca486), SPH_C32(0xede04c82), + SPH_C32(0xdb15f8a5) }, + { SPH_C32(0x710c0058), SPH_C32(0xa5db8000), SPH_C32(0x6b200000), + SPH_C32(0xdb7f0000), SPH_C32(0x86c44896), SPH_C32(0xbc29603c), + SPH_C32(0x52785017), SPH_C32(0x4fea22c6), SPH_C32(0x24a200ad), + SPH_C32(0xed0a8000), SPH_C32(0x1f3a0000), SPH_C32(0x2a7f0000), + SPH_C32(0xd28a4f9b), SPH_C32(0x25aedfdb), SPH_C32(0x0c488014), + SPH_C32(0xa00e2e1c) }, + { SPH_C32(0x832800a0), SPH_C32(0x67420000), SPH_C32(0xe1170000), + SPH_C32(0x370b0000), SPH_C32(0xcba30034), SPH_C32(0x3c34923c), + SPH_C32(0x9767bdcc), SPH_C32(0x450360bf), SPH_C32(0x774400f0), + SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), SPH_C32(0x34140000), + SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), SPH_C32(0x0bc3cd1e), + SPH_C32(0xcf3775cb) }, + { SPH_C32(0x255700a1), SPH_C32(0x16758000), SPH_C32(0xf8eb0000), + SPH_C32(0xa1d00000), SPH_C32(0xf1286dc9), SPH_C32(0xd7fe3ccf), + SPH_C32(0xbb0afa43), SPH_C32(0xe98d0c37), SPH_C32(0x27bb00f4), + SPH_C32(0xb42e4000), SPH_C32(0xc8490000), SPH_C32(0x2df20000), + SPH_C32(0x928b288a), SPH_C32(0xbbf99778), SPH_C32(0xea6b0188), + SPH_C32(0xb42ca372) }, + { SPH_C32(0x745d00a9), SPH_C32(0xa87ec000), SPH_C32(0x22c10000), + SPH_C32(0x33990000), SPH_C32(0xc936199d), SPH_C32(0xc4dca486), + SPH_C32(0xede04c82), SPH_C32(0xdb15f8a5), SPH_C32(0xa32e00f0), + SPH_C32(0x7c92c000), SPH_C32(0x501d0000), SPH_C32(0x7e3d0000), + SPH_C32(0x75793cf6), SPH_C32(0x933f6a49), SPH_C32(0x93f55b1a), + SPH_C32(0x3871b6eb) }, + { SPH_C32(0xd22200a8), SPH_C32(0xd9494000), SPH_C32(0x3b3d0000), + SPH_C32(0xa5420000), SPH_C32(0xf3bd7460), SPH_C32(0x2f160a75), + SPH_C32(0xc18d0b0d), SPH_C32(0x779b942d), SPH_C32(0xf3d100f4), + SPH_C32(0x39e68000), SPH_C32(0x6de60000), SPH_C32(0x67db0000), + SPH_C32(0x6ec56af0), SPH_C32(0x724d1114), SPH_C32(0x725d978c), + SPH_C32(0x436a6052) }, + { SPH_C32(0x574200a0), SPH_C32(0xea8ac000), SPH_C32(0x44b80000), + SPH_C32(0x7d220000), SPH_C32(0x37ed424e), SPH_C32(0xf5801450), + SPH_C32(0x0f512bc8), SPH_C32(0xb245a39f), SPH_C32(0x545b00f9), + SPH_C32(0xb3ae0000), SPH_C32(0x93cb0000), SPH_C32(0x7aaf0000), + SPH_C32(0x77ec255f), SPH_C32(0x6bd75cf3), SPH_C32(0xe972aa54), + SPH_C32(0xa6672ef1) }, + { SPH_C32(0xf13d00a1), SPH_C32(0x9bbd4000), SPH_C32(0x5d440000), + SPH_C32(0xebf90000), SPH_C32(0x0d662fb3), SPH_C32(0x1e4abaa3), + SPH_C32(0x233c6c47), SPH_C32(0x1ecbcf17), SPH_C32(0x04a400fd), + SPH_C32(0xf6da4000), SPH_C32(0xae300000), SPH_C32(0x63490000), + SPH_C32(0x6c507359), SPH_C32(0x8aa527ae), SPH_C32(0x08da66c2), + SPH_C32(0xdd7cf848) }, + { SPH_C32(0xa03700a9), SPH_C32(0x25b60000), SPH_C32(0x876e0000), + SPH_C32(0x79b00000), SPH_C32(0x35785be7), SPH_C32(0x0d6822ea), + SPH_C32(0x75d6da86), SPH_C32(0x2c533b85), SPH_C32(0x803100f9), + SPH_C32(0x3e66c000), SPH_C32(0x36640000), SPH_C32(0x30860000), + SPH_C32(0x8ba26725), SPH_C32(0xa263da9f), SPH_C32(0x71443c50), + SPH_C32(0x5121edd1) }, + { SPH_C32(0x064800a8), SPH_C32(0x54818000), SPH_C32(0x9e920000), + SPH_C32(0xef6b0000), SPH_C32(0x0ff3361a), SPH_C32(0xe6a28c19), + SPH_C32(0x59bb9d09), SPH_C32(0x80dd570d), SPH_C32(0xd0ce00fd), + SPH_C32(0x7b128000), SPH_C32(0x0b9f0000), SPH_C32(0x29600000), + SPH_C32(0x901e3123), SPH_C32(0x4311a1c2), SPH_C32(0x90ecf0c6), + SPH_C32(0x2a3a3b68) } +}; + +static const sph_u32 T512_15[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x75a40000), SPH_C32(0xc28b2700), SPH_C32(0x94a40000), + SPH_C32(0x90f50000), SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), + SPH_C32(0x1767c483), SPH_C32(0xaedf667e), SPH_C32(0xd1660000), + SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), SPH_C32(0xf6940000), + SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), SPH_C32(0xb4431b17), + SPH_C32(0x857f3c2b) }, + { SPH_C32(0xd1660000), SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), + SPH_C32(0xf6940000), SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), + SPH_C32(0xb4431b17), SPH_C32(0x857f3c2b), SPH_C32(0xa4c20000), + SPH_C32(0xd9372400), SPH_C32(0x0a480000), SPH_C32(0x66610000), + SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), SPH_C32(0xa324df94), + SPH_C32(0x2ba05a55) }, + { SPH_C32(0xa4c20000), SPH_C32(0xd9372400), SPH_C32(0x0a480000), + SPH_C32(0x66610000), SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), + SPH_C32(0xa324df94), SPH_C32(0x2ba05a55), SPH_C32(0x75a40000), + SPH_C32(0xc28b2700), SPH_C32(0x94a40000), SPH_C32(0x90f50000), + SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), SPH_C32(0x1767c483), + SPH_C32(0xaedf667e) }, + { SPH_C32(0x75c90003), SPH_C32(0x0e10c000), SPH_C32(0xd1200000), + SPH_C32(0xbaea0000), SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), + SPH_C32(0xbb28761d), SPH_C32(0x00b72e2b), SPH_C32(0xeecf0001), + SPH_C32(0x6f564000), SPH_C32(0xf33e0000), SPH_C32(0xa79e0000), + SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), SPH_C32(0x4a3b40ba), + SPH_C32(0xfeabf254) }, + { SPH_C32(0x006d0003), SPH_C32(0xcc9be700), SPH_C32(0x45840000), + SPH_C32(0x2a1f0000), SPH_C32(0x70bc78de), SPH_C32(0xce96bcf9), + SPH_C32(0xac4fb29e), SPH_C32(0xae684855), SPH_C32(0x3fa90001), + SPH_C32(0x74ea4300), SPH_C32(0x6dd20000), SPH_C32(0x510a0000), + SPH_C32(0xbeb7373e), SPH_C32(0x78611737), SPH_C32(0xfe785bad), + SPH_C32(0x7bd4ce7f) }, + { SPH_C32(0xa4af0003), SPH_C32(0x15acc300), SPH_C32(0x4fcc0000), + SPH_C32(0x4c7e0000), SPH_C32(0x88c66a19), SPH_C32(0x48284ba5), + SPH_C32(0x0f6b6d0a), SPH_C32(0x85c81200), SPH_C32(0x4a0d0001), + SPH_C32(0xb6616400), SPH_C32(0xf9760000), SPH_C32(0xc1ff0000), + SPH_C32(0x45cf60de), SPH_C32(0x31af1c99), SPH_C32(0xe91f9f2e), + SPH_C32(0xd50ba801) }, + { SPH_C32(0xd10b0003), SPH_C32(0xd727e400), SPH_C32(0xdb680000), + SPH_C32(0xdc8b0000), SPH_C32(0x73be3df9), SPH_C32(0x01e6400b), + SPH_C32(0x180ca989), SPH_C32(0x2b17747e), SPH_C32(0x9b6b0001), + SPH_C32(0xaddd6700), SPH_C32(0x679a0000), SPH_C32(0x376b0000), + SPH_C32(0x46cd25f9), SPH_C32(0xfedfe06b), SPH_C32(0x5d5c8439), + SPH_C32(0x5074942a) }, + { SPH_C32(0xeecf0001), SPH_C32(0x6f564000), SPH_C32(0xf33e0000), + SPH_C32(0xa79e0000), SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), + SPH_C32(0x4a3b40ba), SPH_C32(0xfeabf254), SPH_C32(0x9b060002), + SPH_C32(0x61468000), SPH_C32(0x221e0000), SPH_C32(0x1d740000), + SPH_C32(0x36715d27), SPH_C32(0x30495c92), SPH_C32(0xf11336a7), + SPH_C32(0xfe1cdc7f) }, + { SPH_C32(0x9b6b0001), SPH_C32(0xaddd6700), SPH_C32(0x679a0000), + SPH_C32(0x376b0000), SPH_C32(0x46cd25f9), SPH_C32(0xfedfe06b), + SPH_C32(0x5d5c8439), SPH_C32(0x5074942a), SPH_C32(0x4a600002), + SPH_C32(0x7afa8300), SPH_C32(0xbcf20000), SPH_C32(0xebe00000), + SPH_C32(0x35731800), SPH_C32(0xff39a060), SPH_C32(0x45502db0), + SPH_C32(0x7b63e054) }, + { SPH_C32(0x3fa90001), SPH_C32(0x74ea4300), SPH_C32(0x6dd20000), + SPH_C32(0x510a0000), SPH_C32(0xbeb7373e), SPH_C32(0x78611737), + SPH_C32(0xfe785bad), SPH_C32(0x7bd4ce7f), SPH_C32(0x3fc40002), + SPH_C32(0xb871a400), SPH_C32(0x28560000), SPH_C32(0x7b150000), + SPH_C32(0xce0b4fe0), SPH_C32(0xb6f7abce), SPH_C32(0x5237e933), + SPH_C32(0xd5bc862a) }, + { SPH_C32(0x4a0d0001), SPH_C32(0xb6616400), SPH_C32(0xf9760000), + SPH_C32(0xc1ff0000), SPH_C32(0x45cf60de), SPH_C32(0x31af1c99), + SPH_C32(0xe91f9f2e), SPH_C32(0xd50ba801), SPH_C32(0xeea20002), + SPH_C32(0xa3cda700), SPH_C32(0xb6ba0000), SPH_C32(0x8d810000), + SPH_C32(0xcd090ac7), SPH_C32(0x7987573c), SPH_C32(0xe674f224), + SPH_C32(0x50c3ba01) }, + { SPH_C32(0x9b060002), SPH_C32(0x61468000), SPH_C32(0x221e0000), + SPH_C32(0x1d740000), SPH_C32(0x36715d27), SPH_C32(0x30495c92), + SPH_C32(0xf11336a7), SPH_C32(0xfe1cdc7f), SPH_C32(0x75c90003), + SPH_C32(0x0e10c000), SPH_C32(0xd1200000), SPH_C32(0xbaea0000), + SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), SPH_C32(0xbb28761d), + SPH_C32(0x00b72e2b) }, + { SPH_C32(0xeea20002), SPH_C32(0xa3cda700), SPH_C32(0xb6ba0000), + SPH_C32(0x8d810000), SPH_C32(0xcd090ac7), SPH_C32(0x7987573c), + SPH_C32(0xe674f224), SPH_C32(0x50c3ba01), SPH_C32(0xa4af0003), + SPH_C32(0x15acc300), SPH_C32(0x4fcc0000), SPH_C32(0x4c7e0000), + SPH_C32(0x88c66a19), SPH_C32(0x48284ba5), SPH_C32(0x0f6b6d0a), + SPH_C32(0x85c81200) }, + { SPH_C32(0x4a600002), SPH_C32(0x7afa8300), SPH_C32(0xbcf20000), + SPH_C32(0xebe00000), SPH_C32(0x35731800), SPH_C32(0xff39a060), + SPH_C32(0x45502db0), SPH_C32(0x7b63e054), SPH_C32(0xd10b0003), + SPH_C32(0xd727e400), SPH_C32(0xdb680000), SPH_C32(0xdc8b0000), + SPH_C32(0x73be3df9), SPH_C32(0x01e6400b), SPH_C32(0x180ca989), + SPH_C32(0x2b17747e) }, + { SPH_C32(0x3fc40002), SPH_C32(0xb871a400), SPH_C32(0x28560000), + SPH_C32(0x7b150000), SPH_C32(0xce0b4fe0), SPH_C32(0xb6f7abce), + SPH_C32(0x5237e933), SPH_C32(0xd5bc862a), SPH_C32(0x006d0003), + SPH_C32(0xcc9be700), SPH_C32(0x45840000), SPH_C32(0x2a1f0000), + SPH_C32(0x70bc78de), SPH_C32(0xce96bcf9), SPH_C32(0xac4fb29e), + SPH_C32(0xae684855) }, + { SPH_C32(0xf6800005), SPH_C32(0x3443c000), SPH_C32(0x24070000), + SPH_C32(0x8f3d0000), SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), + SPH_C32(0xcdc58b19), SPH_C32(0xd795ba31), SPH_C32(0xa67f0001), + SPH_C32(0x71378000), SPH_C32(0x19fc0000), SPH_C32(0x96db0000), + SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), SPH_C32(0x2c6d478f), + SPH_C32(0xac8e6c88) }, + { SPH_C32(0x83240005), SPH_C32(0xf6c8e700), SPH_C32(0xb0a30000), + SPH_C32(0x1fc80000), SPH_C32(0xda4f6c1b), SPH_C32(0x4376de00), + SPH_C32(0xdaa24f9a), SPH_C32(0x794adc4f), SPH_C32(0x77190001), + SPH_C32(0x6a8b8300), SPH_C32(0x87100000), SPH_C32(0x604f0000), + SPH_C32(0x398928da), SPH_C32(0x24ba5201), SPH_C32(0x982e5c98), + SPH_C32(0x29f150a3) }, + { SPH_C32(0x27e60005), SPH_C32(0x2fffc300), SPH_C32(0xbaeb0000), + SPH_C32(0x79a90000), SPH_C32(0x22357edc), SPH_C32(0xc5c8295c), + SPH_C32(0x7986900e), SPH_C32(0x52ea861a), SPH_C32(0x02bd0001), + SPH_C32(0xa800a400), SPH_C32(0x13b40000), SPH_C32(0xf0ba0000), + SPH_C32(0xc2f17f3a), SPH_C32(0x6d7459af), SPH_C32(0x8f49981b), + SPH_C32(0x872e36dd) }, + { SPH_C32(0x52420005), SPH_C32(0xed74e400), SPH_C32(0x2e4f0000), + SPH_C32(0xe95c0000), SPH_C32(0xd94d293c), SPH_C32(0x8c0622f2), + SPH_C32(0x6ee1548d), SPH_C32(0xfc35e064), SPH_C32(0xd3db0001), + SPH_C32(0xb3bca700), SPH_C32(0x8d580000), SPH_C32(0x062e0000), + SPH_C32(0xc1f33a1d), SPH_C32(0xa204a55d), SPH_C32(0x3b0a830c), + SPH_C32(0x02510af6) }, + { SPH_C32(0x83490006), SPH_C32(0x3a530000), SPH_C32(0xf5270000), + SPH_C32(0x35d70000), SPH_C32(0xaaf314c5), SPH_C32(0x8de062f9), + SPH_C32(0x76edfd04), SPH_C32(0xd722941a), SPH_C32(0x48b00000), + SPH_C32(0x1e61c000), SPH_C32(0xeac20000), SPH_C32(0x31450000), + SPH_C32(0x873e1fe4), SPH_C32(0x5cdb4536), SPH_C32(0x66560735), + SPH_C32(0x52259edc) }, + { SPH_C32(0xf6ed0006), SPH_C32(0xf8d82700), SPH_C32(0x61830000), + SPH_C32(0xa5220000), SPH_C32(0x518b4325), SPH_C32(0xc42e6957), + SPH_C32(0x618a3987), SPH_C32(0x79fdf264), SPH_C32(0x99d60000), + SPH_C32(0x05ddc300), SPH_C32(0x742e0000), SPH_C32(0xc7d10000), + SPH_C32(0x843c5ac3), SPH_C32(0x93abb9c4), SPH_C32(0xd2151c22), + SPH_C32(0xd75aa2f7) }, + { SPH_C32(0x522f0006), SPH_C32(0x21ef0300), SPH_C32(0x6bcb0000), + SPH_C32(0xc3430000), SPH_C32(0xa9f151e2), SPH_C32(0x42909e0b), + SPH_C32(0xc2aee613), SPH_C32(0x525da831), SPH_C32(0xec720000), + SPH_C32(0xc756e400), SPH_C32(0xe08a0000), SPH_C32(0x57240000), + SPH_C32(0x7f440d23), SPH_C32(0xda65b26a), SPH_C32(0xc572d8a1), + SPH_C32(0x7985c489) }, + { SPH_C32(0x278b0006), SPH_C32(0xe3642400), SPH_C32(0xff6f0000), + SPH_C32(0x53b60000), SPH_C32(0x52890602), SPH_C32(0x0b5e95a5), + SPH_C32(0xd5c92290), SPH_C32(0xfc82ce4f), SPH_C32(0x3d140000), + SPH_C32(0xdceae700), SPH_C32(0x7e660000), SPH_C32(0xa1b00000), + SPH_C32(0x7c464804), SPH_C32(0x15154e98), SPH_C32(0x7131c3b6), + SPH_C32(0xfcfaf8a2) }, + { SPH_C32(0x184f0004), SPH_C32(0x5b158000), SPH_C32(0xd7390000), + SPH_C32(0x28a30000), SPH_C32(0x9c8249e2), SPH_C32(0xbda93e6b), + SPH_C32(0x87fecba3), SPH_C32(0x293e4865), SPH_C32(0x3d790003), + SPH_C32(0x10710000), SPH_C32(0x3be20000), SPH_C32(0x8baf0000), + SPH_C32(0x0cfa30da), SPH_C32(0xdb83f261), SPH_C32(0xdd7e7128), + SPH_C32(0x5292b0f7) }, + { SPH_C32(0x6deb0004), SPH_C32(0x999ea700), SPH_C32(0x439d0000), + SPH_C32(0xb8560000), SPH_C32(0x67fa1e02), SPH_C32(0xf46735c5), + SPH_C32(0x90990f20), SPH_C32(0x87e12e1b), SPH_C32(0xec1f0003), + SPH_C32(0x0bcd0300), SPH_C32(0xa50e0000), SPH_C32(0x7d3b0000), + SPH_C32(0x0ff875fd), SPH_C32(0x14f30e93), SPH_C32(0x693d6a3f), + SPH_C32(0xd7ed8cdc) }, + { SPH_C32(0xc9290004), SPH_C32(0x40a98300), SPH_C32(0x49d50000), + SPH_C32(0xde370000), SPH_C32(0x9f800cc5), SPH_C32(0x72d9c299), + SPH_C32(0x33bdd0b4), SPH_C32(0xac41744e), SPH_C32(0x99bb0003), + SPH_C32(0xc9462400), SPH_C32(0x31aa0000), SPH_C32(0xedce0000), + SPH_C32(0xf480221d), SPH_C32(0x5d3d053d), SPH_C32(0x7e5aaebc), + SPH_C32(0x7932eaa2) }, + { SPH_C32(0xbc8d0004), SPH_C32(0x8222a400), SPH_C32(0xdd710000), + SPH_C32(0x4ec20000), SPH_C32(0x64f85b25), SPH_C32(0x3b17c937), + SPH_C32(0x24da1437), SPH_C32(0x029e1230), SPH_C32(0x48dd0003), + SPH_C32(0xd2fa2700), SPH_C32(0xaf460000), SPH_C32(0x1b5a0000), + SPH_C32(0xf782673a), SPH_C32(0x924df9cf), SPH_C32(0xca19b5ab), + SPH_C32(0xfc4dd689) }, + { SPH_C32(0x6d860007), SPH_C32(0x55054000), SPH_C32(0x06190000), + SPH_C32(0x92490000), SPH_C32(0x174666dc), SPH_C32(0x3af1893c), + SPH_C32(0x3cd6bdbe), SPH_C32(0x2989664e), SPH_C32(0xd3b60002), + SPH_C32(0x7f274000), SPH_C32(0xc8dc0000), SPH_C32(0x2c310000), + SPH_C32(0xb14f42c3), SPH_C32(0x6c9219a4), SPH_C32(0x97453192), + SPH_C32(0xac3942a3) }, + { SPH_C32(0x18220007), SPH_C32(0x978e6700), SPH_C32(0x92bd0000), + SPH_C32(0x02bc0000), SPH_C32(0xec3e313c), SPH_C32(0x733f8292), + SPH_C32(0x2bb1793d), SPH_C32(0x87560030), SPH_C32(0x02d00002), + SPH_C32(0x649b4300), SPH_C32(0x56300000), SPH_C32(0xdaa50000), + SPH_C32(0xb24d07e4), SPH_C32(0xa3e2e556), SPH_C32(0x23062a85), + SPH_C32(0x29467e88) }, + { SPH_C32(0xbce00007), SPH_C32(0x4eb94300), SPH_C32(0x98f50000), + SPH_C32(0x64dd0000), SPH_C32(0x144423fb), SPH_C32(0xf58175ce), + SPH_C32(0x8895a6a9), SPH_C32(0xacf65a65), SPH_C32(0x77740002), + SPH_C32(0xa6106400), SPH_C32(0xc2940000), SPH_C32(0x4a500000), + SPH_C32(0x49355004), SPH_C32(0xea2ceef8), SPH_C32(0x3461ee06), + SPH_C32(0x879918f6) }, + { SPH_C32(0xc9440007), SPH_C32(0x8c326400), SPH_C32(0x0c510000), + SPH_C32(0xf4280000), SPH_C32(0xef3c741b), SPH_C32(0xbc4f7e60), + SPH_C32(0x9ff2622a), SPH_C32(0x02293c1b), SPH_C32(0xa6120002), + SPH_C32(0xbdac6700), SPH_C32(0x5c780000), SPH_C32(0xbcc40000), + SPH_C32(0x4a371523), SPH_C32(0x255c120a), SPH_C32(0x8022f511), + SPH_C32(0x02e624dd) } +}; + +static const sph_u32 T512_20[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xc6730000), SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), + SPH_C32(0x218d0000), SPH_C32(0x23111587), SPH_C32(0x7913512f), + SPH_C32(0x1d28ac88), SPH_C32(0x378dd173), SPH_C32(0xaf220000), + SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), SPH_C32(0x8da20000), + SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), SPH_C32(0x9ac484f4), + SPH_C32(0x8b6c72bd) }, + { SPH_C32(0x0c720000), SPH_C32(0x49e50f00), SPH_C32(0x42790000), + SPH_C32(0x5cea0000), SPH_C32(0x33aa301a), SPH_C32(0x15822514), + SPH_C32(0x95a34b7b), SPH_C32(0xb44b0090), SPH_C32(0xfe220000), + SPH_C32(0xa7580500), SPH_C32(0x25d10000), SPH_C32(0xf7600000), + SPH_C32(0x893178da), SPH_C32(0x1fd4f860), SPH_C32(0x4ed0a315), + SPH_C32(0xa123ff9f) }, + { SPH_C32(0xca010000), SPH_C32(0xe6680f0c), SPH_C32(0xe6b80000), + SPH_C32(0x7d670000), SPH_C32(0x10bb259d), SPH_C32(0x6c91743b), + SPH_C32(0x888be7f3), SPH_C32(0x83c6d1e3), SPH_C32(0x51000000), + SPH_C32(0xdc340590), SPH_C32(0x42330000), SPH_C32(0x7ac20000), + SPH_C32(0x4eb566f3), SPH_C32(0xa863bc93), SPH_C32(0xd41427e1), + SPH_C32(0x2a4f8d22) }, + { SPH_C32(0xfe220000), SPH_C32(0xa7580500), SPH_C32(0x25d10000), + SPH_C32(0xf7600000), SPH_C32(0x893178da), SPH_C32(0x1fd4f860), + SPH_C32(0x4ed0a315), SPH_C32(0xa123ff9f), SPH_C32(0xf2500000), + SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), SPH_C32(0xab8a0000), + SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), SPH_C32(0xdb73e86e), + SPH_C32(0x1568ff0f) }, + { SPH_C32(0x38510000), SPH_C32(0x08d5050c), SPH_C32(0x81100000), + SPH_C32(0xd6ed0000), SPH_C32(0xaa206d5d), SPH_C32(0x66c7a94f), + SPH_C32(0x53f80f9d), SPH_C32(0x96ae2eec), SPH_C32(0x5d720000), + SPH_C32(0x95d10a90), SPH_C32(0x004a0000), SPH_C32(0x26280000), + SPH_C32(0x7d1f56e9), SPH_C32(0xbde19987), SPH_C32(0x41b76c9a), + SPH_C32(0x9e048db2) }, + { SPH_C32(0xf2500000), SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), + SPH_C32(0xab8a0000), SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), + SPH_C32(0xdb73e86e), SPH_C32(0x1568ff0f), SPH_C32(0x0c720000), + SPH_C32(0x49e50f00), SPH_C32(0x42790000), SPH_C32(0x5cea0000), + SPH_C32(0x33aa301a), SPH_C32(0x15822514), SPH_C32(0x95a34b7b), + SPH_C32(0xb44b0090) }, + { SPH_C32(0x34230000), SPH_C32(0x41300a0c), SPH_C32(0xc3690000), + SPH_C32(0x8a070000), SPH_C32(0x998a5d47), SPH_C32(0x73458c5b), + SPH_C32(0xc65b44e6), SPH_C32(0x22e52e7c), SPH_C32(0xa3500000), + SPH_C32(0x32890f90), SPH_C32(0x259b0000), SPH_C32(0xd1480000), + SPH_C32(0xf42e2e33), SPH_C32(0xa23561e7), SPH_C32(0x0f67cf8f), + SPH_C32(0x3f27722d) }, + { SPH_C32(0x45180000), SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), + SPH_C32(0x3b480000), SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), + SPH_C32(0x16bca6b0), SPH_C32(0xdf33f4df), SPH_C32(0xb83d0000), + SPH_C32(0x16710600), SPH_C32(0x379a0000), SPH_C32(0xf5b10000), + SPH_C32(0x228161ac), SPH_C32(0xae48f145), SPH_C32(0x66241616), + SPH_C32(0xc5c1eb3e) }, + { SPH_C32(0x836b0000), SPH_C32(0x0a38170c), SPH_C32(0x5dab0000), + SPH_C32(0x1ac50000), SPH_C32(0x3ddd01ab), SPH_C32(0x5a00c4f9), + SPH_C32(0x0b940a38), SPH_C32(0xe8be25ac), SPH_C32(0x171f0000), + SPH_C32(0x6d1d0690), SPH_C32(0x50780000), SPH_C32(0x78130000), + SPH_C32(0xe5057f85), SPH_C32(0x19ffb5b6), SPH_C32(0xfce092e2), + SPH_C32(0x4ead9983) }, + { SPH_C32(0x496a0000), SPH_C32(0xec501800), SPH_C32(0xbb130000), + SPH_C32(0x67a20000), SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), + SPH_C32(0x831fedcb), SPH_C32(0x6b78f44f), SPH_C32(0x461f0000), + SPH_C32(0xb1290300), SPH_C32(0x124b0000), SPH_C32(0x02d10000), + SPH_C32(0xabb01976), SPH_C32(0xb19c0925), SPH_C32(0x28f4b503), + SPH_C32(0x64e214a1) }, + { SPH_C32(0x8f190000), SPH_C32(0x43dd180c), SPH_C32(0x1fd20000), + SPH_C32(0x462f0000), SPH_C32(0x0e7731b1), SPH_C32(0x4f82e1ed), + SPH_C32(0x9e374143), SPH_C32(0x5cf5253c), SPH_C32(0xe93d0000), + SPH_C32(0xca450390), SPH_C32(0x75a90000), SPH_C32(0x8f730000), + SPH_C32(0x6c34075f), SPH_C32(0x062b4dd6), SPH_C32(0xb23031f7), + SPH_C32(0xef8e661c) }, + { SPH_C32(0xbb3a0000), SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), + SPH_C32(0xcc280000), SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), + SPH_C32(0x586c05a5), SPH_C32(0x7e100b40), SPH_C32(0x4a6d0000), + SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), SPH_C32(0x5e3b0000), + SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), SPH_C32(0xbd57fe78), + SPH_C32(0xd0a91431) }, + { SPH_C32(0x7d490000), SPH_C32(0xad60120c), SPH_C32(0x787a0000), + SPH_C32(0xeda50000), SPH_C32(0xb4ec7971), SPH_C32(0x45d43c99), + SPH_C32(0x4544a92d), SPH_C32(0x499dda33), SPH_C32(0xe54f0000), + SPH_C32(0x83a00c90), SPH_C32(0x37d00000), SPH_C32(0xd3990000), + SPH_C32(0x5f9e3745), SPH_C32(0x13a968c2), SPH_C32(0x27937a8c), + SPH_C32(0x5bc5668c) }, + { SPH_C32(0xb7480000), SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), + SPH_C32(0x90c20000), SPH_C32(0xa4575cec), SPH_C32(0x294548a2), + SPH_C32(0xcdcf4ede), SPH_C32(0xca5b0bd0), SPH_C32(0xb44f0000), + SPH_C32(0x5f940900), SPH_C32(0x75e30000), SPH_C32(0xa95b0000), + SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), SPH_C32(0xf3875d6d), + SPH_C32(0x718aebae) }, + { SPH_C32(0x713b0000), SPH_C32(0xe4851d0c), SPH_C32(0x3a030000), + SPH_C32(0xb14f0000), SPH_C32(0x8746496b), SPH_C32(0x5056198d), + SPH_C32(0xd0e7e256), SPH_C32(0xfdd6daa3), SPH_C32(0x1b6d0000), + SPH_C32(0x24f80990), SPH_C32(0x12010000), SPH_C32(0x24f90000), + SPH_C32(0xd6af4f9f), SPH_C32(0x0c7d90a2), SPH_C32(0x6943d999), + SPH_C32(0xfae69913) }, + { SPH_C32(0xb83d0000), SPH_C32(0x16710600), SPH_C32(0x379a0000), + SPH_C32(0xf5b10000), SPH_C32(0x228161ac), SPH_C32(0xae48f145), + SPH_C32(0x66241616), SPH_C32(0xc5c1eb3e), SPH_C32(0xfd250000), + SPH_C32(0xb3c41100), SPH_C32(0xcef00000), SPH_C32(0xcef90000), + SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), SPH_C32(0x7098b0a6), + SPH_C32(0x1af21fe1) }, + { SPH_C32(0x7e4e0000), SPH_C32(0xb9fc060c), SPH_C32(0x935b0000), + SPH_C32(0xd43c0000), SPH_C32(0x0190742b), SPH_C32(0xd75ba06a), + SPH_C32(0x7b0cba9e), SPH_C32(0xf24c3a4d), SPH_C32(0x52070000), + SPH_C32(0xc8a81190), SPH_C32(0xa9120000), SPH_C32(0x435b0000), + SPH_C32(0xfbc96ba9), SPH_C32(0x3aec2060), SPH_C32(0xea5c3452), + SPH_C32(0x919e6d5c) }, + { SPH_C32(0xb44f0000), SPH_C32(0x5f940900), SPH_C32(0x75e30000), + SPH_C32(0xa95b0000), SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), + SPH_C32(0xf3875d6d), SPH_C32(0x718aebae), SPH_C32(0x03070000), + SPH_C32(0x149c1400), SPH_C32(0xeb210000), SPH_C32(0x39990000), + SPH_C32(0xb57c0d5a), SPH_C32(0x928f9cf3), SPH_C32(0x3e4813b3), + SPH_C32(0xbbd1e07e) }, + { SPH_C32(0x723c0000), SPH_C32(0xf019090c), SPH_C32(0xd1220000), + SPH_C32(0x88d60000), SPH_C32(0x323a4431), SPH_C32(0xc2d9857e), + SPH_C32(0xeeaff1e5), SPH_C32(0x46073add), SPH_C32(0xac250000), + SPH_C32(0x6ff01490), SPH_C32(0x8cc30000), SPH_C32(0xb43b0000), + SPH_C32(0x72f81373), SPH_C32(0x2538d800), SPH_C32(0xa48c9747), + SPH_C32(0x30bd92c3) }, + { SPH_C32(0x461f0000), SPH_C32(0xb1290300), SPH_C32(0x124b0000), + SPH_C32(0x02d10000), SPH_C32(0xabb01976), SPH_C32(0xb19c0925), + SPH_C32(0x28f4b503), SPH_C32(0x64e214a1), SPH_C32(0x0f750000), + SPH_C32(0x5d791b00), SPH_C32(0xa9580000), SPH_C32(0x65730000), + SPH_C32(0x86d63d40), SPH_C32(0x870db9e7), SPH_C32(0xabeb58c8), + SPH_C32(0x0f9ae0ee) }, + { SPH_C32(0x806c0000), SPH_C32(0x1ea4030c), SPH_C32(0xb68a0000), + SPH_C32(0x235c0000), SPH_C32(0x88a10cf1), SPH_C32(0xc88f580a), + SPH_C32(0x35dc198b), SPH_C32(0x536fc5d2), SPH_C32(0xa0570000), + SPH_C32(0x26151b90), SPH_C32(0xceba0000), SPH_C32(0xe8d10000), + SPH_C32(0x41522369), SPH_C32(0x30bafd14), SPH_C32(0x312fdc3c), + SPH_C32(0x84f69253) }, + { SPH_C32(0x4a6d0000), SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), + SPH_C32(0x5e3b0000), SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), + SPH_C32(0xbd57fe78), SPH_C32(0xd0a91431), SPH_C32(0xf1570000), + SPH_C32(0xfa211e00), SPH_C32(0x8c890000), SPH_C32(0x92130000), + SPH_C32(0x0fe7459a), SPH_C32(0x98d94187), SPH_C32(0xe53bfbdd), + SPH_C32(0xaeb91f71) }, + { SPH_C32(0x8c1e0000), SPH_C32(0x57410c0c), SPH_C32(0xf4f30000), + SPH_C32(0x7fb60000), SPH_C32(0xbb0b3ceb), SPH_C32(0xdd0d7d1e), + SPH_C32(0xa07f52f0), SPH_C32(0xe724c542), SPH_C32(0x5e750000), + SPH_C32(0x814d1e90), SPH_C32(0xeb6b0000), SPH_C32(0x1fb10000), + SPH_C32(0xc8635bb3), SPH_C32(0x2f6e0574), SPH_C32(0x7fff7f29), + SPH_C32(0x25d56dcc) }, + { SPH_C32(0xfd250000), SPH_C32(0xb3c41100), SPH_C32(0xcef00000), + SPH_C32(0xcef90000), SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), + SPH_C32(0x7098b0a6), SPH_C32(0x1af21fe1), SPH_C32(0x45180000), + SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), SPH_C32(0x3b480000), + SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), SPH_C32(0x16bca6b0), + SPH_C32(0xdf33f4df) }, + { SPH_C32(0x3b560000), SPH_C32(0x1c49110c), SPH_C32(0x6a310000), + SPH_C32(0xef740000), SPH_C32(0x1f5c6007), SPH_C32(0xf44835bc), + SPH_C32(0x6db01c2e), SPH_C32(0x2d7fce92), SPH_C32(0xea3a0000), + SPH_C32(0xded91790), SPH_C32(0x9e880000), SPH_C32(0xb6ea0000), + SPH_C32(0xd9480a05), SPH_C32(0x94a4d125), SPH_C32(0x8c782244), + SPH_C32(0x545f8662) }, + { SPH_C32(0xf1570000), SPH_C32(0xfa211e00), SPH_C32(0x8c890000), + SPH_C32(0x92130000), SPH_C32(0x0fe7459a), SPH_C32(0x98d94187), + SPH_C32(0xe53bfbdd), SPH_C32(0xaeb91f71), SPH_C32(0xbb3a0000), + SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), SPH_C32(0xcc280000), + SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), SPH_C32(0x586c05a5), + SPH_C32(0x7e100b40) }, + { SPH_C32(0x37240000), SPH_C32(0x55ac1e0c), SPH_C32(0x28480000), + SPH_C32(0xb39e0000), SPH_C32(0x2cf6501d), SPH_C32(0xe1ca10a8), + SPH_C32(0xf8135755), SPH_C32(0x9934ce02), SPH_C32(0x14180000), + SPH_C32(0x79811290), SPH_C32(0xbb590000), SPH_C32(0x418a0000), + SPH_C32(0x507972df), SPH_C32(0x8b702945), SPH_C32(0xc2a88151), + SPH_C32(0xf57c79fd) }, + { SPH_C32(0x03070000), SPH_C32(0x149c1400), SPH_C32(0xeb210000), + SPH_C32(0x39990000), SPH_C32(0xb57c0d5a), SPH_C32(0x928f9cf3), + SPH_C32(0x3e4813b3), SPH_C32(0xbbd1e07e), SPH_C32(0xb7480000), + SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), SPH_C32(0x90c20000), + SPH_C32(0xa4575cec), SPH_C32(0x294548a2), SPH_C32(0xcdcf4ede), + SPH_C32(0xca5b0bd0) }, + { SPH_C32(0xc5740000), SPH_C32(0xbb11140c), SPH_C32(0x4fe00000), + SPH_C32(0x18140000), SPH_C32(0x966d18dd), SPH_C32(0xeb9ccddc), + SPH_C32(0x2360bf3b), SPH_C32(0x8c5c310d), SPH_C32(0x186a0000), + SPH_C32(0x30641d90), SPH_C32(0xf9200000), SPH_C32(0x1d600000), + SPH_C32(0x63d342c5), SPH_C32(0x9ef20c51), SPH_C32(0x570bca2a), + SPH_C32(0x4137796d) }, + { SPH_C32(0x0f750000), SPH_C32(0x5d791b00), SPH_C32(0xa9580000), + SPH_C32(0x65730000), SPH_C32(0x86d63d40), SPH_C32(0x870db9e7), + SPH_C32(0xabeb58c8), SPH_C32(0x0f9ae0ee), SPH_C32(0x496a0000), + SPH_C32(0xec501800), SPH_C32(0xbb130000), SPH_C32(0x67a20000), + SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), SPH_C32(0x831fedcb), + SPH_C32(0x6b78f44f) }, + { SPH_C32(0xc9060000), SPH_C32(0xf2f41b0c), SPH_C32(0x0d990000), + SPH_C32(0x44fe0000), SPH_C32(0xa5c728c7), SPH_C32(0xfe1ee8c8), + SPH_C32(0xb6c3f440), SPH_C32(0x3817319d), SPH_C32(0xe6480000), + SPH_C32(0x973c1890), SPH_C32(0xdcf10000), SPH_C32(0xea000000), + SPH_C32(0xeae23a1f), SPH_C32(0x8126f431), SPH_C32(0x19db693f), + SPH_C32(0xe01486f2) } +}; + +static const sph_u32 T512_25[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x14190000), SPH_C32(0x23ca003c), SPH_C32(0x50df0000), + SPH_C32(0x44b60000), SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), + SPH_C32(0x61e610b0), SPH_C32(0xdbcadb80), SPH_C32(0xe3430000), + SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), SPH_C32(0xaa4e0000), + SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), SPH_C32(0x123db156), + SPH_C32(0x3a4e99d7) }, + { SPH_C32(0xe3430000), SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), + SPH_C32(0xaa4e0000), SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), + SPH_C32(0x123db156), SPH_C32(0x3a4e99d7), SPH_C32(0xf75a0000), + SPH_C32(0x19840028), SPH_C32(0xa2190000), SPH_C32(0xeef80000), + SPH_C32(0xc0722516), SPH_C32(0x19981260), SPH_C32(0x73dba1e6), + SPH_C32(0xe1844257) }, + { SPH_C32(0xf75a0000), SPH_C32(0x19840028), SPH_C32(0xa2190000), + SPH_C32(0xeef80000), SPH_C32(0xc0722516), SPH_C32(0x19981260), + SPH_C32(0x73dba1e6), SPH_C32(0xe1844257), SPH_C32(0x14190000), + SPH_C32(0x23ca003c), SPH_C32(0x50df0000), SPH_C32(0x44b60000), + SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), SPH_C32(0x61e610b0), + SPH_C32(0xdbcadb80) }, + { SPH_C32(0x54500000), SPH_C32(0x0671005c), SPH_C32(0x25ae0000), + SPH_C32(0x6a1e0000), SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), + SPH_C32(0xbfba18c3), SPH_C32(0x7e715d17), SPH_C32(0xbc8d0000), + SPH_C32(0xfc3b0018), SPH_C32(0x19830000), SPH_C32(0xd10b0000), + SPH_C32(0xae1878c4), SPH_C32(0x42a69856), SPH_C32(0x0012da37), + SPH_C32(0x2c3b504e) }, + { SPH_C32(0x40490000), SPH_C32(0x25bb0060), SPH_C32(0x75710000), + SPH_C32(0x2ea80000), SPH_C32(0x35c9296f), SPH_C32(0x5abd2967), + SPH_C32(0xde5c0873), SPH_C32(0xa5bb8697), SPH_C32(0x5fce0000), + SPH_C32(0xc675000c), SPH_C32(0xeb450000), SPH_C32(0x7b450000), + SPH_C32(0x75063a62), SPH_C32(0x67cd2643), SPH_C32(0x122f6b61), + SPH_C32(0x1675c999) }, + { SPH_C32(0xb7130000), SPH_C32(0x3c3f0048), SPH_C32(0xd7680000), + SPH_C32(0xc0500000), SPH_C32(0xf5bb0c79), SPH_C32(0x43253b07), + SPH_C32(0xad87a995), SPH_C32(0x443fc4c0), SPH_C32(0x4bd70000), + SPH_C32(0xe5bf0030), SPH_C32(0xbb9a0000), SPH_C32(0x3ff30000), + SPH_C32(0x6e6a5dd2), SPH_C32(0x5b3e8a36), SPH_C32(0x73c97bd1), + SPH_C32(0xcdbf1219) }, + { SPH_C32(0xa30a0000), SPH_C32(0x1ff50074), SPH_C32(0x87b70000), + SPH_C32(0x84e60000), SPH_C32(0xeed76bc9), SPH_C32(0x7fd69772), + SPH_C32(0xcc61b925), SPH_C32(0x9ff51f40), SPH_C32(0xa8940000), + SPH_C32(0xdff10024), SPH_C32(0x495c0000), SPH_C32(0x95bd0000), + SPH_C32(0xb5741f74), SPH_C32(0x7e553423), SPH_C32(0x61f4ca87), + SPH_C32(0xf7f18bce) }, + { SPH_C32(0xbc8d0000), SPH_C32(0xfc3b0018), SPH_C32(0x19830000), + SPH_C32(0xd10b0000), SPH_C32(0xae1878c4), SPH_C32(0x42a69856), + SPH_C32(0x0012da37), SPH_C32(0x2c3b504e), SPH_C32(0xe8dd0000), + SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), SPH_C32(0xbb150000), + SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), SPH_C32(0xbfa8c2f4), + SPH_C32(0x524a0d59) }, + { SPH_C32(0xa8940000), SPH_C32(0xdff10024), SPH_C32(0x495c0000), + SPH_C32(0x95bd0000), SPH_C32(0xb5741f74), SPH_C32(0x7e553423), + SPH_C32(0x61f4ca87), SPH_C32(0xf7f18bce), SPH_C32(0x0b9e0000), + SPH_C32(0xc0040050), SPH_C32(0xceeb0000), SPH_C32(0x115b0000), + SPH_C32(0x5ba374bd), SPH_C32(0x0183a351), SPH_C32(0xad9573a2), + SPH_C32(0x6804948e) }, + { SPH_C32(0x5fce0000), SPH_C32(0xc675000c), SPH_C32(0xeb450000), + SPH_C32(0x7b450000), SPH_C32(0x75063a62), SPH_C32(0x67cd2643), + SPH_C32(0x122f6b61), SPH_C32(0x1675c999), SPH_C32(0x1f870000), + SPH_C32(0xe3ce006c), SPH_C32(0x9e340000), SPH_C32(0x55ed0000), + SPH_C32(0x40cf130d), SPH_C32(0x3d700f24), SPH_C32(0xcc736312), + SPH_C32(0xb3ce4f0e) }, + { SPH_C32(0x4bd70000), SPH_C32(0xe5bf0030), SPH_C32(0xbb9a0000), + SPH_C32(0x3ff30000), SPH_C32(0x6e6a5dd2), SPH_C32(0x5b3e8a36), + SPH_C32(0x73c97bd1), SPH_C32(0xcdbf1219), SPH_C32(0xfcc40000), + SPH_C32(0xd9800078), SPH_C32(0x6cf20000), SPH_C32(0xffa30000), + SPH_C32(0x9bd151ab), SPH_C32(0x181bb131), SPH_C32(0xde4ed244), + SPH_C32(0x8980d6d9) }, + { SPH_C32(0xe8dd0000), SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), + SPH_C32(0xbb150000), SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), + SPH_C32(0xbfa8c2f4), SPH_C32(0x524a0d59), SPH_C32(0x54500000), + SPH_C32(0x0671005c), SPH_C32(0x25ae0000), SPH_C32(0x6a1e0000), + SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), SPH_C32(0xbfba18c3), + SPH_C32(0x7e715d17) }, + { SPH_C32(0xfcc40000), SPH_C32(0xd9800078), SPH_C32(0x6cf20000), + SPH_C32(0xffa30000), SPH_C32(0x9bd151ab), SPH_C32(0x181bb131), + SPH_C32(0xde4ed244), SPH_C32(0x8980d6d9), SPH_C32(0xb7130000), + SPH_C32(0x3c3f0048), SPH_C32(0xd7680000), SPH_C32(0xc0500000), + SPH_C32(0xf5bb0c79), SPH_C32(0x43253b07), SPH_C32(0xad87a995), + SPH_C32(0x443fc4c0) }, + { SPH_C32(0x0b9e0000), SPH_C32(0xc0040050), SPH_C32(0xceeb0000), + SPH_C32(0x115b0000), SPH_C32(0x5ba374bd), SPH_C32(0x0183a351), + SPH_C32(0xad9573a2), SPH_C32(0x6804948e), SPH_C32(0xa30a0000), + SPH_C32(0x1ff50074), SPH_C32(0x87b70000), SPH_C32(0x84e60000), + SPH_C32(0xeed76bc9), SPH_C32(0x7fd69772), SPH_C32(0xcc61b925), + SPH_C32(0x9ff51f40) }, + { SPH_C32(0x1f870000), SPH_C32(0xe3ce006c), SPH_C32(0x9e340000), + SPH_C32(0x55ed0000), SPH_C32(0x40cf130d), SPH_C32(0x3d700f24), + SPH_C32(0xcc736312), SPH_C32(0xb3ce4f0e), SPH_C32(0x40490000), + SPH_C32(0x25bb0060), SPH_C32(0x75710000), SPH_C32(0x2ea80000), + SPH_C32(0x35c9296f), SPH_C32(0x5abd2967), SPH_C32(0xde5c0873), + SPH_C32(0xa5bb8697) }, + { SPH_C32(0x69510000), SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), + SPH_C32(0xac2f0000), SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), + SPH_C32(0x87ec287c), SPH_C32(0xbce1a3ce), SPH_C32(0xc6730000), + SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), SPH_C32(0x218d0000), + SPH_C32(0x23111587), SPH_C32(0x7913512f), SPH_C32(0x1d28ac88), + SPH_C32(0x378dd173) }, + { SPH_C32(0x7d480000), SPH_C32(0xf72b00a0), SPH_C32(0x93fc0000), + SPH_C32(0xe8990000), SPH_C32(0xfff96c1e), SPH_C32(0xf257b9a9), + SPH_C32(0xe60a38cc), SPH_C32(0x672b784e), SPH_C32(0x25300000), + SPH_C32(0x95c30018), SPH_C32(0x56070000), SPH_C32(0x8bc30000), + SPH_C32(0xf80f5721), SPH_C32(0x5c78ef3a), SPH_C32(0x0f151dde), + SPH_C32(0x0dc348a4) }, + { SPH_C32(0x8a120000), SPH_C32(0xeeaf0088), SPH_C32(0x31e50000), + SPH_C32(0x06610000), SPH_C32(0x3f8b4908), SPH_C32(0xebcfabc9), + SPH_C32(0x95d1992a), SPH_C32(0x86af3a19), SPH_C32(0x31290000), + SPH_C32(0xb6090024), SPH_C32(0x06d80000), SPH_C32(0xcf750000), + SPH_C32(0xe3633091), SPH_C32(0x608b434f), SPH_C32(0x6ef30d6e), + SPH_C32(0xd6099324) }, + { SPH_C32(0x9e0b0000), SPH_C32(0xcd6500b4), SPH_C32(0x613a0000), + SPH_C32(0x42d70000), SPH_C32(0x24e72eb8), SPH_C32(0xd73c07bc), + SPH_C32(0xf437899a), SPH_C32(0x5d65e199), SPH_C32(0xd26a0000), + SPH_C32(0x8c470030), SPH_C32(0xf41e0000), SPH_C32(0x653b0000), + SPH_C32(0x387d7237), SPH_C32(0x45e0fd5a), SPH_C32(0x7ccebc38), + SPH_C32(0xec470af3) }, + { SPH_C32(0x3d010000), SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), + SPH_C32(0xc6310000), SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), + SPH_C32(0x385630bf), SPH_C32(0xc290fed9), SPH_C32(0x7afe0000), + SPH_C32(0x53b60014), SPH_C32(0xbd420000), SPH_C32(0xf0860000), + SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), SPH_C32(0x1d3a76bf), + SPH_C32(0x1bb6813d) }, + { SPH_C32(0x29180000), SPH_C32(0xf15a00fc), SPH_C32(0xb6520000), + SPH_C32(0x82870000), SPH_C32(0xd15c22c1), SPH_C32(0x94193cbb), + SPH_C32(0x59b0200f), SPH_C32(0x195a2559), SPH_C32(0x99bd0000), + SPH_C32(0x69f80000), SPH_C32(0x4f840000), SPH_C32(0x5ac80000), + SPH_C32(0x56172fe5), SPH_C32(0x1ede776c), SPH_C32(0x0f07c7e9), + SPH_C32(0x21f818ea) }, + { SPH_C32(0xde420000), SPH_C32(0xe8de00d4), SPH_C32(0x144b0000), + SPH_C32(0x6c7f0000), SPH_C32(0x112e07d7), SPH_C32(0x8d812edb), + SPH_C32(0x2a6b81e9), SPH_C32(0xf8de670e), SPH_C32(0x8da40000), + SPH_C32(0x4a32003c), SPH_C32(0x1f5b0000), SPH_C32(0x1e7e0000), + SPH_C32(0x4d7b4855), SPH_C32(0x222ddb19), SPH_C32(0x6ee1d759), + SPH_C32(0xfa32c36a) }, + { SPH_C32(0xca5b0000), SPH_C32(0xcb1400e8), SPH_C32(0x44940000), + SPH_C32(0x28c90000), SPH_C32(0x0a426067), SPH_C32(0xb17282ae), + SPH_C32(0x4b8d9159), SPH_C32(0x2314bc8e), SPH_C32(0x6ee70000), + SPH_C32(0x707c0028), SPH_C32(0xed9d0000), SPH_C32(0xb4300000), + SPH_C32(0x96650af3), SPH_C32(0x0746650c), SPH_C32(0x7cdc660f), + SPH_C32(0xc07c5abd) }, + { SPH_C32(0xd5dc0000), SPH_C32(0x28da0084), SPH_C32(0xdaa00000), + SPH_C32(0x7d240000), SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), + SPH_C32(0x87fef24b), SPH_C32(0x90daf380), SPH_C32(0x2eae0000), + SPH_C32(0x55c70048), SPH_C32(0x98ec0000), SPH_C32(0x9a980000), + SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), SPH_C32(0xa2806e7c), + SPH_C32(0x65c7dc2a) }, + { SPH_C32(0xc1c50000), SPH_C32(0x0b1000b8), SPH_C32(0x8a7f0000), + SPH_C32(0x39920000), SPH_C32(0x51e114da), SPH_C32(0xb0f121ff), + SPH_C32(0xe618e2fb), SPH_C32(0x4b102800), SPH_C32(0xcded0000), + SPH_C32(0x6f89005c), SPH_C32(0x6a2a0000), SPH_C32(0x30d60000), + SPH_C32(0x78b2613a), SPH_C32(0x7890f27e), SPH_C32(0xb0bddf2a), + SPH_C32(0x5f8945fd) }, + { SPH_C32(0x369f0000), SPH_C32(0x12940090), SPH_C32(0x28660000), + SPH_C32(0xd76a0000), SPH_C32(0x919331cc), SPH_C32(0xa969339f), + SPH_C32(0x95c3431d), SPH_C32(0xaa946a57), SPH_C32(0xd9f40000), + SPH_C32(0x4c430060), SPH_C32(0x3af50000), SPH_C32(0x74600000), + SPH_C32(0x63de068a), SPH_C32(0x44635e0b), SPH_C32(0xd15bcf9a), + SPH_C32(0x84439e7d) }, + { SPH_C32(0x22860000), SPH_C32(0x315e00ac), SPH_C32(0x78b90000), + SPH_C32(0x93dc0000), SPH_C32(0x8aff567c), SPH_C32(0x959a9fea), + SPH_C32(0xf42553ad), SPH_C32(0x715eb1d7), SPH_C32(0x3ab70000), + SPH_C32(0x760d0074), SPH_C32(0xc8330000), SPH_C32(0xde2e0000), + SPH_C32(0xb8c0442c), SPH_C32(0x6108e01e), SPH_C32(0xc3667ecc), + SPH_C32(0xbe0d07aa) }, + { SPH_C32(0x818c0000), SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), + SPH_C32(0x173a0000), SPH_C32(0x64283db5), SPH_C32(0xea4c0898), + SPH_C32(0x3844ea88), SPH_C32(0xeeabae97), SPH_C32(0x92230000), + SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), SPH_C32(0x4b930000), + SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), SPH_C32(0xa292b44b), + SPH_C32(0x49fc8c64) }, + { SPH_C32(0x95950000), SPH_C32(0x0d6100e4), SPH_C32(0xafd10000), + SPH_C32(0x538c0000), SPH_C32(0x7f445a05), SPH_C32(0xd6bfa4ed), + SPH_C32(0x59a2fa38), SPH_C32(0x35617517), SPH_C32(0x71600000), + SPH_C32(0x93b20044), SPH_C32(0x73a90000), SPH_C32(0xe1dd0000), + SPH_C32(0xd6aa19fe), SPH_C32(0x3a366a28), SPH_C32(0xb0af051d), + SPH_C32(0x73b215b3) }, + { SPH_C32(0x62cf0000), SPH_C32(0x14e500cc), SPH_C32(0x0dc80000), + SPH_C32(0xbd740000), SPH_C32(0xbf367f13), SPH_C32(0xcf27b68d), + SPH_C32(0x2a795bde), SPH_C32(0xd4e53740), SPH_C32(0x65790000), + SPH_C32(0xb0780078), SPH_C32(0x23760000), SPH_C32(0xa56b0000), + SPH_C32(0xcdc67e4e), SPH_C32(0x06c5c65d), SPH_C32(0xd14915ad), + SPH_C32(0xa878ce33) }, + { SPH_C32(0x76d60000), SPH_C32(0x372f00f0), SPH_C32(0x5d170000), + SPH_C32(0xf9c20000), SPH_C32(0xa45a18a3), SPH_C32(0xf3d41af8), + SPH_C32(0x4b9f4b6e), SPH_C32(0x0f2fecc0), SPH_C32(0x863a0000), + SPH_C32(0x8a36006c), SPH_C32(0xd1b00000), SPH_C32(0x0f250000), + SPH_C32(0x16d83ce8), SPH_C32(0x23ae7848), SPH_C32(0xc374a4fb), + SPH_C32(0x923657e4) } +}; + +static const sph_u32 T512_30[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x1e4e0000), SPH_C32(0xdecf0000), SPH_C32(0x6df80180), + SPH_C32(0x77240000), SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), + SPH_C32(0xcda31812), SPH_C32(0x98aa496e), SPH_C32(0xb2060000), + SPH_C32(0xc5690000), SPH_C32(0x28031200), SPH_C32(0x74670000), + SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), SPH_C32(0x33d1dfec), + SPH_C32(0x094e3198) }, + { SPH_C32(0xaec30000), SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), + SPH_C32(0x2c150000), SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), + SPH_C32(0xab92f78f), SPH_C32(0xa312567b), SPH_C32(0xdb250000), + SPH_C32(0x09290000), SPH_C32(0x49aac000), SPH_C32(0x81e10000), + SPH_C32(0xcafe6b59), SPH_C32(0x42793431), SPH_C32(0x43566b76), + SPH_C32(0xe86cba2e) }, + { SPH_C32(0xb08d0000), SPH_C32(0x42800001), SPH_C32(0x1429e180), + SPH_C32(0x5b310000), SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), + SPH_C32(0x6631ef9d), SPH_C32(0x3bb81f15), SPH_C32(0x69230000), + SPH_C32(0xcc400000), SPH_C32(0x61a9d200), SPH_C32(0xf5860000), + SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), SPH_C32(0x7087b49a), + SPH_C32(0xe1228bb6) }, + { SPH_C32(0xdb250000), SPH_C32(0x09290000), SPH_C32(0x49aac000), + SPH_C32(0x81e10000), SPH_C32(0xcafe6b59), SPH_C32(0x42793431), + SPH_C32(0x43566b76), SPH_C32(0xe86cba2e), SPH_C32(0x75e60000), + SPH_C32(0x95660001), SPH_C32(0x307b2000), SPH_C32(0xadf40000), + SPH_C32(0x8f321eea), SPH_C32(0x24298307), SPH_C32(0xe8c49cf9), + SPH_C32(0x4b7eec55) }, + { SPH_C32(0xc56b0000), SPH_C32(0xd7e60000), SPH_C32(0x2452c180), + SPH_C32(0xf6c50000), SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), + SPH_C32(0x8ef57364), SPH_C32(0x70c6f340), SPH_C32(0xc7e00000), + SPH_C32(0x500f0001), SPH_C32(0x18783200), SPH_C32(0xd9930000), + SPH_C32(0x39f0281e), SPH_C32(0xcf3bbaff), SPH_C32(0xdb154315), + SPH_C32(0x4230ddcd) }, + { SPH_C32(0x75e60000), SPH_C32(0x95660001), SPH_C32(0x307b2000), + SPH_C32(0xadf40000), SPH_C32(0x8f321eea), SPH_C32(0x24298307), + SPH_C32(0xe8c49cf9), SPH_C32(0x4b7eec55), SPH_C32(0xaec30000), + SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), SPH_C32(0x2c150000), + SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), SPH_C32(0xab92f78f), + SPH_C32(0xa312567b) }, + { SPH_C32(0x6ba80000), SPH_C32(0x4ba90001), SPH_C32(0x5d832180), + SPH_C32(0xdad00000), SPH_C32(0x63751974), SPH_C32(0xd089ea49), + SPH_C32(0x256784eb), SPH_C32(0xd3d4a53b), SPH_C32(0x1cc50000), + SPH_C32(0x59260001), SPH_C32(0x51d2f200), SPH_C32(0x58720000), + SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), SPH_C32(0x98432863), + SPH_C32(0xaa5c67e3) }, + { SPH_C32(0x86790000), SPH_C32(0x3f390002), SPH_C32(0xe19ae000), + SPH_C32(0x98560000), SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), + SPH_C32(0xd3dd4944), SPH_C32(0x161ddab9), SPH_C32(0x30b70000), + SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), SPH_C32(0x42c40000), + SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), SPH_C32(0x21afa1ea), + SPH_C32(0xb0a51834) }, + { SPH_C32(0x98370000), SPH_C32(0xe1f60002), SPH_C32(0x8c62e180), + SPH_C32(0xef720000), SPH_C32(0x79226090), SPH_C32(0xba28a1a4), + SPH_C32(0x1e7e5156), SPH_C32(0x8eb793d7), SPH_C32(0x82b10000), + SPH_C32(0x20b90000), SPH_C32(0xdcf77200), SPH_C32(0x36a30000), + SPH_C32(0xd57a0b9e), SPH_C32(0x93a8ad98), SPH_C32(0x127e7e06), + SPH_C32(0xb9eb29ac) }, + { SPH_C32(0x28ba0000), SPH_C32(0xa3760003), SPH_C32(0x984b0000), + SPH_C32(0xb4430000), SPH_C32(0xd0a912bd), SPH_C32(0x28d87fdc), + SPH_C32(0x784fbecb), SPH_C32(0xb50f8cc2), SPH_C32(0xeb920000), + SPH_C32(0xecf90000), SPH_C32(0xbd5ea000), SPH_C32(0xc3250000), + SPH_C32(0xa9465633), SPH_C32(0x3ac3a051), SPH_C32(0x62f9ca9c), + SPH_C32(0x58c9a21a) }, + { SPH_C32(0x36f40000), SPH_C32(0x7db90003), SPH_C32(0xf5b30180), + SPH_C32(0xc3670000), SPH_C32(0x3cee1523), SPH_C32(0xdc781692), + SPH_C32(0xb5eca6d9), SPH_C32(0x2da5c5ac), SPH_C32(0x59940000), + SPH_C32(0x29900000), SPH_C32(0x955db200), SPH_C32(0xb7420000), + SPH_C32(0x1f8460c7), SPH_C32(0xd1d199a9), SPH_C32(0x51281570), + SPH_C32(0x51879382) }, + { SPH_C32(0x5d5c0000), SPH_C32(0x36100002), SPH_C32(0xa8302000), + SPH_C32(0x19b70000), SPH_C32(0x5f9b0c57), SPH_C32(0x0cf1fcdb), + SPH_C32(0x908b2232), SPH_C32(0xfe716097), SPH_C32(0x45510000), + SPH_C32(0x70b60001), SPH_C32(0xc48f4000), SPH_C32(0xef300000), + SPH_C32(0xec8a2380), SPH_C32(0x5c931767), SPH_C32(0xc96b3d13), + SPH_C32(0xfbdbf461) }, + { SPH_C32(0x43120000), SPH_C32(0xe8df0002), SPH_C32(0xc5c82180), + SPH_C32(0x6e930000), SPH_C32(0xb3dc0bc9), SPH_C32(0xf8519595), + SPH_C32(0x5d283a20), SPH_C32(0x66db29f9), SPH_C32(0xf7570000), + SPH_C32(0xb5df0001), SPH_C32(0xec8c5200), SPH_C32(0x9b570000), + SPH_C32(0x5a481574), SPH_C32(0xb7812e9f), SPH_C32(0xfabae2ff), + SPH_C32(0xf295c5f9) }, + { SPH_C32(0xf39f0000), SPH_C32(0xaa5f0003), SPH_C32(0xd1e1c000), + SPH_C32(0x35a20000), SPH_C32(0x1a5779e4), SPH_C32(0x6aa14bed), + SPH_C32(0x3b19d5bd), SPH_C32(0x5d6336ec), SPH_C32(0x9e740000), + SPH_C32(0x799f0001), SPH_C32(0x8d258000), SPH_C32(0x6ed10000), + SPH_C32(0x267448d9), SPH_C32(0x1eea2356), SPH_C32(0x8a3d5665), + SPH_C32(0x13b74e4f) }, + { SPH_C32(0xedd10000), SPH_C32(0x74900003), SPH_C32(0xbc19c180), + SPH_C32(0x42860000), SPH_C32(0xf6107e7a), SPH_C32(0x9e0122a3), + SPH_C32(0xf6bacdaf), SPH_C32(0xc5c97f82), SPH_C32(0x2c720000), + SPH_C32(0xbcf60001), SPH_C32(0xa5269200), SPH_C32(0x1ab60000), + SPH_C32(0x90b67e2d), SPH_C32(0xf5f81aae), SPH_C32(0xb9ec8989), + SPH_C32(0x1af97fd7) }, + { SPH_C32(0x30b70000), SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), + SPH_C32(0x42c40000), SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), + SPH_C32(0x21afa1ea), SPH_C32(0xb0a51834), SPH_C32(0xb6ce0000), + SPH_C32(0xdae90002), SPH_C32(0x156e8000), SPH_C32(0xda920000), + SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), SPH_C32(0xf272e8ae), + SPH_C32(0xa6b8c28d) }, + { SPH_C32(0x2ef90000), SPH_C32(0x3b1f0000), SPH_C32(0x990c6180), + SPH_C32(0x35e00000), SPH_C32(0x8fff3af4), SPH_C32(0x8c1afd2e), + SPH_C32(0xec0cb9f8), SPH_C32(0x280f515a), SPH_C32(0x04c80000), + SPH_C32(0x1f800002), SPH_C32(0x3d6d9200), SPH_C32(0xaef50000), + SPH_C32(0x401f6c90), SPH_C32(0xdd206572), SPH_C32(0xc1a33742), + SPH_C32(0xaff6f315) }, + { SPH_C32(0x9e740000), SPH_C32(0x799f0001), SPH_C32(0x8d258000), + SPH_C32(0x6ed10000), SPH_C32(0x267448d9), SPH_C32(0x1eea2356), + SPH_C32(0x8a3d5665), SPH_C32(0x13b74e4f), SPH_C32(0x6deb0000), + SPH_C32(0xd3c00002), SPH_C32(0x5cc44000), SPH_C32(0x5b730000), + SPH_C32(0x3c23313d), SPH_C32(0x744b68bb), SPH_C32(0xb12483d8), + SPH_C32(0x4ed478a3) }, + { SPH_C32(0x803a0000), SPH_C32(0xa7500001), SPH_C32(0xe0dd8180), + SPH_C32(0x19f50000), SPH_C32(0xca334f47), SPH_C32(0xea4a4a18), + SPH_C32(0x479e4e77), SPH_C32(0x8b1d0721), SPH_C32(0xdfed0000), + SPH_C32(0x16a90002), SPH_C32(0x74c75200), SPH_C32(0x2f140000), + SPH_C32(0x8ae107c9), SPH_C32(0x9f595143), SPH_C32(0x82f55c34), + SPH_C32(0x479a493b) }, + { SPH_C32(0xeb920000), SPH_C32(0xecf90000), SPH_C32(0xbd5ea000), + SPH_C32(0xc3250000), SPH_C32(0xa9465633), SPH_C32(0x3ac3a051), + SPH_C32(0x62f9ca9c), SPH_C32(0x58c9a21a), SPH_C32(0xc3280000), + SPH_C32(0x4f8f0003), SPH_C32(0x2515a000), SPH_C32(0x77660000), + SPH_C32(0x79ef448e), SPH_C32(0x121bdf8d), SPH_C32(0x1ab67457), + SPH_C32(0xedc62ed8) }, + { SPH_C32(0xf5dc0000), SPH_C32(0x32360000), SPH_C32(0xd0a6a180), + SPH_C32(0xb4010000), SPH_C32(0x450151ad), SPH_C32(0xce63c91f), + SPH_C32(0xaf5ad28e), SPH_C32(0xc063eb74), SPH_C32(0x712e0000), + SPH_C32(0x8ae60003), SPH_C32(0x0d16b200), SPH_C32(0x03010000), + SPH_C32(0xcf2d727a), SPH_C32(0xf909e675), SPH_C32(0x2967abbb), + SPH_C32(0xe4881f40) }, + { SPH_C32(0x45510000), SPH_C32(0x70b60001), SPH_C32(0xc48f4000), + SPH_C32(0xef300000), SPH_C32(0xec8a2380), SPH_C32(0x5c931767), + SPH_C32(0xc96b3d13), SPH_C32(0xfbdbf461), SPH_C32(0x180d0000), + SPH_C32(0x46a60003), SPH_C32(0x6cbf6000), SPH_C32(0xf6870000), + SPH_C32(0xb3112fd7), SPH_C32(0x5062ebbc), SPH_C32(0x59e01f21), + SPH_C32(0x05aa94f6) }, + { SPH_C32(0x5b1f0000), SPH_C32(0xae790001), SPH_C32(0xa9774180), + SPH_C32(0x98140000), SPH_C32(0x00cd241e), SPH_C32(0xa8337e29), + SPH_C32(0x04c82501), SPH_C32(0x6371bd0f), SPH_C32(0xaa0b0000), + SPH_C32(0x83cf0003), SPH_C32(0x44bc7200), SPH_C32(0x82e00000), + SPH_C32(0x05d31923), SPH_C32(0xbb70d244), SPH_C32(0x6a31c0cd), + SPH_C32(0x0ce4a56e) }, + { SPH_C32(0xb6ce0000), SPH_C32(0xdae90002), SPH_C32(0x156e8000), + SPH_C32(0xda920000), SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), + SPH_C32(0xf272e8ae), SPH_C32(0xa6b8c28d), SPH_C32(0x86790000), + SPH_C32(0x3f390002), SPH_C32(0xe19ae000), SPH_C32(0x98560000), + SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), SPH_C32(0xd3dd4944), + SPH_C32(0x161ddab9) }, + { SPH_C32(0xa8800000), SPH_C32(0x04260002), SPH_C32(0x78968180), + SPH_C32(0xadb60000), SPH_C32(0x1a9a5dfa), SPH_C32(0xc29235c4), + SPH_C32(0x3fd1f0bc), SPH_C32(0x3e128be3), SPH_C32(0x347f0000), + SPH_C32(0xfa500002), SPH_C32(0xc999f200), SPH_C32(0xec310000), + SPH_C32(0x23a751fa), SPH_C32(0xa59af112), SPH_C32(0xe00c96a8), + SPH_C32(0x1f53eb21) }, + { SPH_C32(0x180d0000), SPH_C32(0x46a60003), SPH_C32(0x6cbf6000), + SPH_C32(0xf6870000), SPH_C32(0xb3112fd7), SPH_C32(0x5062ebbc), + SPH_C32(0x59e01f21), SPH_C32(0x05aa94f6), SPH_C32(0x5d5c0000), + SPH_C32(0x36100002), SPH_C32(0xa8302000), SPH_C32(0x19b70000), + SPH_C32(0x5f9b0c57), SPH_C32(0x0cf1fcdb), SPH_C32(0x908b2232), + SPH_C32(0xfe716097) }, + { SPH_C32(0x06430000), SPH_C32(0x98690003), SPH_C32(0x01476180), + SPH_C32(0x81a30000), SPH_C32(0x5f562849), SPH_C32(0xa4c282f2), + SPH_C32(0x94430733), SPH_C32(0x9d00dd98), SPH_C32(0xef5a0000), + SPH_C32(0xf3790002), SPH_C32(0x80333200), SPH_C32(0x6dd00000), + SPH_C32(0xe9593aa3), SPH_C32(0xe7e3c523), SPH_C32(0xa35afdde), + SPH_C32(0xf73f510f) }, + { SPH_C32(0x6deb0000), SPH_C32(0xd3c00002), SPH_C32(0x5cc44000), + SPH_C32(0x5b730000), SPH_C32(0x3c23313d), SPH_C32(0x744b68bb), + SPH_C32(0xb12483d8), SPH_C32(0x4ed478a3), SPH_C32(0xf39f0000), + SPH_C32(0xaa5f0003), SPH_C32(0xd1e1c000), SPH_C32(0x35a20000), + SPH_C32(0x1a5779e4), SPH_C32(0x6aa14bed), SPH_C32(0x3b19d5bd), + SPH_C32(0x5d6336ec) }, + { SPH_C32(0x73a50000), SPH_C32(0x0d0f0002), SPH_C32(0x313c4180), + SPH_C32(0x2c570000), SPH_C32(0xd06436a3), SPH_C32(0x80eb01f5), + SPH_C32(0x7c879bca), SPH_C32(0xd67e31cd), SPH_C32(0x41990000), + SPH_C32(0x6f360003), SPH_C32(0xf9e2d200), SPH_C32(0x41c50000), + SPH_C32(0xac954f10), SPH_C32(0x81b37215), SPH_C32(0x08c80a51), + SPH_C32(0x542d0774) }, + { SPH_C32(0xc3280000), SPH_C32(0x4f8f0003), SPH_C32(0x2515a000), + SPH_C32(0x77660000), SPH_C32(0x79ef448e), SPH_C32(0x121bdf8d), + SPH_C32(0x1ab67457), SPH_C32(0xedc62ed8), SPH_C32(0x28ba0000), + SPH_C32(0xa3760003), SPH_C32(0x984b0000), SPH_C32(0xb4430000), + SPH_C32(0xd0a912bd), SPH_C32(0x28d87fdc), SPH_C32(0x784fbecb), + SPH_C32(0xb50f8cc2) }, + { SPH_C32(0xdd660000), SPH_C32(0x91400003), SPH_C32(0x48eda180), + SPH_C32(0x00420000), SPH_C32(0x95a84310), SPH_C32(0xe6bbb6c3), + SPH_C32(0xd7156c45), SPH_C32(0x756c67b6), SPH_C32(0x9abc0000), + SPH_C32(0x661f0003), SPH_C32(0xb0481200), SPH_C32(0xc0240000), + SPH_C32(0x666b2449), SPH_C32(0xc3ca4624), SPH_C32(0x4b9e6127), + SPH_C32(0xbc41bd5a) } +}; + +static const sph_u32 T512_35[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xcc140000), SPH_C32(0xa5630000), SPH_C32(0x5ab90780), + SPH_C32(0x3b500000), SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), + SPH_C32(0x694348c1), SPH_C32(0xca5a87fe), SPH_C32(0x819e0000), + SPH_C32(0xec570000), SPH_C32(0x66320280), SPH_C32(0x95f30000), + SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), SPH_C32(0xe65aa22d), + SPH_C32(0x8e67b7fa) }, + { SPH_C32(0x819e0000), SPH_C32(0xec570000), SPH_C32(0x66320280), + SPH_C32(0x95f30000), SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), + SPH_C32(0xe65aa22d), SPH_C32(0x8e67b7fa), SPH_C32(0x4d8a0000), + SPH_C32(0x49340000), SPH_C32(0x3c8b0500), SPH_C32(0xaea30000), + SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), SPH_C32(0x8f19eaec), + SPH_C32(0x443d3004) }, + { SPH_C32(0x4d8a0000), SPH_C32(0x49340000), SPH_C32(0x3c8b0500), + SPH_C32(0xaea30000), SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), + SPH_C32(0x8f19eaec), SPH_C32(0x443d3004), SPH_C32(0xcc140000), + SPH_C32(0xa5630000), SPH_C32(0x5ab90780), SPH_C32(0x3b500000), + SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), SPH_C32(0x694348c1), + SPH_C32(0xca5a87fe) }, + { SPH_C32(0x78230000), SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), + SPH_C32(0x90a50000), SPH_C32(0x713e2879), SPH_C32(0x7ee98924), + SPH_C32(0xf08ca062), SPH_C32(0x636f8bab), SPH_C32(0x02af0000), + SPH_C32(0xb7280000), SPH_C32(0xba1c0300), SPH_C32(0x56980000), + SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), SPH_C32(0xa95c149a), + SPH_C32(0xf4f6ea7b) }, + { SPH_C32(0xb4370000), SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), + SPH_C32(0xabf50000), SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), + SPH_C32(0x99cfe8a3), SPH_C32(0xa9350c55), SPH_C32(0x83310000), + SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), SPH_C32(0xc36b0000), + SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), SPH_C32(0x4f06b6b7), + SPH_C32(0x7a915d81) }, + { SPH_C32(0xf9bd0000), SPH_C32(0xfeab0000), SPH_C32(0xcf080900), + SPH_C32(0x05560000), SPH_C32(0x2c97007b), SPH_C32(0x361db598), + SPH_C32(0x16d6024f), SPH_C32(0xed083c51), SPH_C32(0x4f250000), + SPH_C32(0xfe1c0000), SPH_C32(0x86970600), SPH_C32(0xf83b0000), + SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), SPH_C32(0x2645fe76), + SPH_C32(0xb0cbda7f) }, + { SPH_C32(0x35a90000), SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), + SPH_C32(0x3e060000), SPH_C32(0x67471384), SPH_C32(0xb1868180), + SPH_C32(0x7f954a8e), SPH_C32(0x2752bbaf), SPH_C32(0xcebb0000), + SPH_C32(0x124b0000), SPH_C32(0xe0a50480), SPH_C32(0x6dc80000), + SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), SPH_C32(0xc01f5c5b), + SPH_C32(0x3eac6d85) }, + { SPH_C32(0x02af0000), SPH_C32(0xb7280000), SPH_C32(0xba1c0300), + SPH_C32(0x56980000), SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), + SPH_C32(0xa95c149a), SPH_C32(0xf4f6ea7b), SPH_C32(0x7a8c0000), + SPH_C32(0xa5d40000), SPH_C32(0x13260880), SPH_C32(0xc63d0000), + SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), SPH_C32(0x59d0b4f8), + SPH_C32(0x979961d0) }, + { SPH_C32(0xcebb0000), SPH_C32(0x124b0000), SPH_C32(0xe0a50480), + SPH_C32(0x6dc80000), SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), + SPH_C32(0xc01f5c5b), SPH_C32(0x3eac6d85), SPH_C32(0xfb120000), + SPH_C32(0x49830000), SPH_C32(0x75140a00), SPH_C32(0x53ce0000), + SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), SPH_C32(0xbf8a16d5), + SPH_C32(0x19fed62a) }, + { SPH_C32(0x83310000), SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), + SPH_C32(0xc36b0000), SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), + SPH_C32(0x4f06b6b7), SPH_C32(0x7a915d81), SPH_C32(0x37060000), + SPH_C32(0xece00000), SPH_C32(0x2fad0d80), SPH_C32(0x689e0000), + SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), SPH_C32(0xd6c95e14), + SPH_C32(0xd3a451d4) }, + { SPH_C32(0x4f250000), SPH_C32(0xfe1c0000), SPH_C32(0x86970600), + SPH_C32(0xf83b0000), SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), + SPH_C32(0x2645fe76), SPH_C32(0xb0cbda7f), SPH_C32(0xb6980000), + SPH_C32(0x00b70000), SPH_C32(0x499f0f00), SPH_C32(0xfd6d0000), + SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), SPH_C32(0x3093fc39), + SPH_C32(0x5dc3e62e) }, + { SPH_C32(0x7a8c0000), SPH_C32(0xa5d40000), SPH_C32(0x13260880), + SPH_C32(0xc63d0000), SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), + SPH_C32(0x59d0b4f8), SPH_C32(0x979961d0), SPH_C32(0x78230000), + SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), SPH_C32(0x90a50000), + SPH_C32(0x713e2879), SPH_C32(0x7ee98924), SPH_C32(0xf08ca062), + SPH_C32(0x636f8bab) }, + { SPH_C32(0xb6980000), SPH_C32(0x00b70000), SPH_C32(0x499f0f00), + SPH_C32(0xfd6d0000), SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), + SPH_C32(0x3093fc39), SPH_C32(0x5dc3e62e), SPH_C32(0xf9bd0000), + SPH_C32(0xfeab0000), SPH_C32(0xcf080900), SPH_C32(0x05560000), + SPH_C32(0x2c97007b), SPH_C32(0x361db598), SPH_C32(0x16d6024f), + SPH_C32(0xed083c51) }, + { SPH_C32(0xfb120000), SPH_C32(0x49830000), SPH_C32(0x75140a00), + SPH_C32(0x53ce0000), SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), + SPH_C32(0xbf8a16d5), SPH_C32(0x19fed62a), SPH_C32(0x35a90000), + SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), SPH_C32(0x3e060000), + SPH_C32(0x67471384), SPH_C32(0xb1868180), SPH_C32(0x7f954a8e), + SPH_C32(0x2752bbaf) }, + { SPH_C32(0x37060000), SPH_C32(0xece00000), SPH_C32(0x2fad0d80), + SPH_C32(0x689e0000), SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), + SPH_C32(0xd6c95e14), SPH_C32(0xd3a451d4), SPH_C32(0xb4370000), + SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), SPH_C32(0xabf50000), + SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), SPH_C32(0x99cfe8a3), + SPH_C32(0xa9350c55) }, + { SPH_C32(0xac480000), SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), + SPH_C32(0x03430000), SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), + SPH_C32(0xfe72c7fe), SPH_C32(0x91e478f6), SPH_C32(0x1e4e0000), + SPH_C32(0xdecf0000), SPH_C32(0x6df80180), SPH_C32(0x77240000), + SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), SPH_C32(0xcda31812), + SPH_C32(0x98aa496e) }, + { SPH_C32(0x605c0000), SPH_C32(0xbec50000), SPH_C32(0x1f421400), + SPH_C32(0x38130000), SPH_C32(0x11552295), SPH_C32(0x982964ae), + SPH_C32(0x97318f3f), SPH_C32(0x5bbeff08), SPH_C32(0x9fd00000), + SPH_C32(0x32980000), SPH_C32(0x0bca0300), SPH_C32(0xe2d70000), + SPH_C32(0xb1ee2f9c), SPH_C32(0xbc5455f2), SPH_C32(0x2bf9ba3f), + SPH_C32(0x16cdfe94) }, + { SPH_C32(0x2dd60000), SPH_C32(0xf7f10000), SPH_C32(0x23c91100), + SPH_C32(0x96b00000), SPH_C32(0x072c1968), SPH_C32(0x57466c0a), + SPH_C32(0x182865d3), SPH_C32(0x1f83cf0c), SPH_C32(0x53c40000), + SPH_C32(0x97fb0000), SPH_C32(0x51730480), SPH_C32(0xd9870000), + SPH_C32(0xfa3e3c63), SPH_C32(0x3bcf61ea), SPH_C32(0x42baf2fe), + SPH_C32(0xdc97796a) }, + { SPH_C32(0xe1c20000), SPH_C32(0x52920000), SPH_C32(0x79701680), + SPH_C32(0xade00000), SPH_C32(0x4cfc0a97), SPH_C32(0xd0dd5812), + SPH_C32(0x716b2d12), SPH_C32(0xd5d948f2), SPH_C32(0xd25a0000), + SPH_C32(0x7bac0000), SPH_C32(0x37410600), SPH_C32(0x4c740000), + SPH_C32(0xa7971461), SPH_C32(0x733b5d56), SPH_C32(0xa4e050d3), + SPH_C32(0x52f0ce90) }, + { SPH_C32(0xd46b0000), SPH_C32(0x095a0000), SPH_C32(0xecc11800), + SPH_C32(0x93e60000), SPH_C32(0x2bbb1913), SPH_C32(0x615bd992), + SPH_C32(0x0efe679c), SPH_C32(0xf28bf35d), SPH_C32(0x1ce10000), + SPH_C32(0x69e70000), SPH_C32(0xd7e40280), SPH_C32(0x21bc0000), + SPH_C32(0x56ca424d), SPH_C32(0x74e8af29), SPH_C32(0x64ff0c88), + SPH_C32(0x6c5ca315) }, + { SPH_C32(0x187f0000), SPH_C32(0xac390000), SPH_C32(0xb6781f80), + SPH_C32(0xa8b60000), SPH_C32(0x606b0aec), SPH_C32(0xe6c0ed8a), + SPH_C32(0x67bd2f5d), SPH_C32(0x38d174a3), SPH_C32(0x9d7f0000), + SPH_C32(0x85b00000), SPH_C32(0xb1d60000), SPH_C32(0xb44f0000), + SPH_C32(0x0b636a4f), SPH_C32(0x3c1c9395), SPH_C32(0x82a5aea5), + SPH_C32(0xe23b14ef) }, + { SPH_C32(0x55f50000), SPH_C32(0xe50d0000), SPH_C32(0x8af31a80), + SPH_C32(0x06150000), SPH_C32(0x76123111), SPH_C32(0x29afe52e), + SPH_C32(0xe8a4c5b1), SPH_C32(0x7cec44a7), SPH_C32(0x516b0000), + SPH_C32(0x20d30000), SPH_C32(0xeb6f0780), SPH_C32(0x8f1f0000), + SPH_C32(0x40b379b0), SPH_C32(0xbb87a78d), SPH_C32(0xebe6e664), + SPH_C32(0x28619311) }, + { SPH_C32(0x99e10000), SPH_C32(0x406e0000), SPH_C32(0xd04a1d00), + SPH_C32(0x3d450000), SPH_C32(0x3dc222ee), SPH_C32(0xae34d136), + SPH_C32(0x81e78d70), SPH_C32(0xb6b6c359), SPH_C32(0xd0f50000), + SPH_C32(0xcc840000), SPH_C32(0x8d5d0500), SPH_C32(0x1aec0000), + SPH_C32(0x1d1a51b2), SPH_C32(0xf3739b31), SPH_C32(0x0dbc4449), + SPH_C32(0xa60624eb) }, + { SPH_C32(0xaee70000), SPH_C32(0xac8e0000), SPH_C32(0xffe71080), + SPH_C32(0x55db0000), SPH_C32(0xe00874b9), SPH_C32(0x9ffa96d1), + SPH_C32(0x572ed364), SPH_C32(0x6512928d), SPH_C32(0x64c20000), + SPH_C32(0x7b1b0000), SPH_C32(0x7ede0900), SPH_C32(0xb1190000), + SPH_C32(0x27f46a34), SPH_C32(0x0a01260d), SPH_C32(0x9473acea), + SPH_C32(0x0f3328be) }, + { SPH_C32(0x62f30000), SPH_C32(0x09ed0000), SPH_C32(0xa55e1700), + SPH_C32(0x6e8b0000), SPH_C32(0xabd86746), SPH_C32(0x1861a2c9), + SPH_C32(0x3e6d9ba5), SPH_C32(0xaf481573), SPH_C32(0xe55c0000), + SPH_C32(0x974c0000), SPH_C32(0x18ec0b80), SPH_C32(0x24ea0000), + SPH_C32(0x7a5d4236), SPH_C32(0x42f51ab1), SPH_C32(0x72290ec7), + SPH_C32(0x81549f44) }, + { SPH_C32(0x2f790000), SPH_C32(0x40d90000), SPH_C32(0x99d51200), + SPH_C32(0xc0280000), SPH_C32(0xbda15cbb), SPH_C32(0xd70eaa6d), + SPH_C32(0xb1747149), SPH_C32(0xeb752577), SPH_C32(0x29480000), + SPH_C32(0x322f0000), SPH_C32(0x42550c00), SPH_C32(0x1fba0000), + SPH_C32(0x318d51c9), SPH_C32(0xc56e2ea9), SPH_C32(0x1b6a4606), + SPH_C32(0x4b0e18ba) }, + { SPH_C32(0xe36d0000), SPH_C32(0xe5ba0000), SPH_C32(0xc36c1580), + SPH_C32(0xfb780000), SPH_C32(0xf6714f44), SPH_C32(0x50959e75), + SPH_C32(0xd8373988), SPH_C32(0x212fa289), SPH_C32(0xa8d60000), + SPH_C32(0xde780000), SPH_C32(0x24670e80), SPH_C32(0x8a490000), + SPH_C32(0x6c2479cb), SPH_C32(0x8d9a1215), SPH_C32(0xfd30e42b), + SPH_C32(0xc569af40) }, + { SPH_C32(0xd6c40000), SPH_C32(0xbe720000), SPH_C32(0x56dd1b00), + SPH_C32(0xc57e0000), SPH_C32(0x91365cc0), SPH_C32(0xe1131ff5), + SPH_C32(0xa7a27306), SPH_C32(0x067d1926), SPH_C32(0x666d0000), + SPH_C32(0xcc330000), SPH_C32(0xc4c20a00), SPH_C32(0xe7810000), + SPH_C32(0x9d792fe7), SPH_C32(0x8a49e06a), SPH_C32(0x3d2fb870), + SPH_C32(0xfbc5c2c5) }, + { SPH_C32(0x1ad00000), SPH_C32(0x1b110000), SPH_C32(0x0c641c80), + SPH_C32(0xfe2e0000), SPH_C32(0xdae64f3f), SPH_C32(0x66882bed), + SPH_C32(0xcee13bc7), SPH_C32(0xcc279ed8), SPH_C32(0xe7f30000), + SPH_C32(0x20640000), SPH_C32(0xa2f00880), SPH_C32(0x72720000), + SPH_C32(0xc0d007e5), SPH_C32(0xc2bddcd6), SPH_C32(0xdb751a5d), + SPH_C32(0x75a2753f) }, + { SPH_C32(0x575a0000), SPH_C32(0x52250000), SPH_C32(0x30ef1980), + SPH_C32(0x508d0000), SPH_C32(0xcc9f74c2), SPH_C32(0xa9e72349), + SPH_C32(0x41f8d12b), SPH_C32(0x881aaedc), SPH_C32(0x2be70000), + SPH_C32(0x85070000), SPH_C32(0xf8490f00), SPH_C32(0x49220000), + SPH_C32(0x8b00141a), SPH_C32(0x4526e8ce), SPH_C32(0xb236529c), + SPH_C32(0xbff8f2c1) }, + { SPH_C32(0x9b4e0000), SPH_C32(0xf7460000), SPH_C32(0x6a561e00), + SPH_C32(0x6bdd0000), SPH_C32(0x874f673d), SPH_C32(0x2e7c1751), + SPH_C32(0x28bb99ea), SPH_C32(0x42402922), SPH_C32(0xaa790000), + SPH_C32(0x69500000), SPH_C32(0x9e7b0d80), SPH_C32(0xdcd10000), + SPH_C32(0xd6a93c18), SPH_C32(0x0dd2d472), SPH_C32(0x546cf0b1), + SPH_C32(0x319f453b) } +}; + +static const sph_u32 T512_40[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x07ed0000), SPH_C32(0xb2500000), SPH_C32(0x8774000a), + SPH_C32(0x970d0000), SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), + SPH_C32(0xf4786222), SPH_C32(0x9075b1ce), SPH_C32(0xa2d60000), + SPH_C32(0xa6760000), SPH_C32(0xc9440014), SPH_C32(0xeba30000), + SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), SPH_C32(0x03490afa), + SPH_C32(0x9b6ef888) }, + { SPH_C32(0x88980000), SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), + SPH_C32(0xfb4e0000), SPH_C32(0xf158079a), SPH_C32(0x61ae9167), + SPH_C32(0xa895706c), SPH_C32(0xe6107494), SPH_C32(0x0bc20000), + SPH_C32(0xdb630000), SPH_C32(0x7e88000c), SPH_C32(0x15860000), + SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), SPH_C32(0xf460449e), + SPH_C32(0xd8b61463) }, + { SPH_C32(0x8f750000), SPH_C32(0xadc40000), SPH_C32(0xf8bb0024), + SPH_C32(0x6c430000), SPH_C32(0xb22a2434), SPH_C32(0x2969ffc3), + SPH_C32(0x5ced124e), SPH_C32(0x7665c55a), SPH_C32(0xa9140000), + SPH_C32(0x7d150000), SPH_C32(0xb7cc0018), SPH_C32(0xfe250000), + SPH_C32(0x5d116688), SPH_C32(0x45997fda), SPH_C32(0xf7294e64), + SPH_C32(0x43d8eceb) }, + { SPH_C32(0x0bc20000), SPH_C32(0xdb630000), SPH_C32(0x7e88000c), + SPH_C32(0x15860000), SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), + SPH_C32(0xf460449e), SPH_C32(0xd8b61463), SPH_C32(0x835a0000), + SPH_C32(0xc4f70000), SPH_C32(0x01470022), SPH_C32(0xeec80000), + SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), SPH_C32(0x5cf534f2), + SPH_C32(0x3ea660f7) }, + { SPH_C32(0x0c2f0000), SPH_C32(0x69330000), SPH_C32(0xf9fc0006), + SPH_C32(0x828b0000), SPH_C32(0xd28f6b5d), SPH_C32(0x3d46d5e7), + SPH_C32(0x001826bc), SPH_C32(0x48c3a5ad), SPH_C32(0x218c0000), + SPH_C32(0x62810000), SPH_C32(0xc8030036), SPH_C32(0x056b0000), + SPH_C32(0xac496112), SPH_C32(0x2437eebd), SPH_C32(0x5fbc3e08), + SPH_C32(0xa5c8987f) }, + { SPH_C32(0x835a0000), SPH_C32(0xc4f70000), SPH_C32(0x01470022), + SPH_C32(0xeec80000), SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), + SPH_C32(0x5cf534f2), SPH_C32(0x3ea660f7), SPH_C32(0x88980000), + SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), SPH_C32(0xfb4e0000), + SPH_C32(0xf158079a), SPH_C32(0x61ae9167), SPH_C32(0xa895706c), + SPH_C32(0xe6107494) }, + { SPH_C32(0x84b70000), SPH_C32(0x76a70000), SPH_C32(0x86330028), + SPH_C32(0x79c50000), SPH_C32(0x23d76cc7), SPH_C32(0x5ce84480), + SPH_C32(0xa88d56d0), SPH_C32(0xaed3d139), SPH_C32(0x2a4e0000), + SPH_C32(0xb9e20000), SPH_C32(0xb68b003a), SPH_C32(0x10ed0000), + SPH_C32(0x3db429e1), SPH_C32(0x51b655fe), SPH_C32(0xabdc7a96), + SPH_C32(0x7d7e8c1c) }, + { SPH_C32(0x52500000), SPH_C32(0x29540000), SPH_C32(0x6a61004e), + SPH_C32(0xf0ff0000), SPH_C32(0x9a317eec), SPH_C32(0x452341ce), + SPH_C32(0xcf568fe5), SPH_C32(0x5303130f), SPH_C32(0x538d0000), + SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), SPH_C32(0x56ff0000), + SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), SPH_C32(0xa9444018), + SPH_C32(0x7f975691) }, + { SPH_C32(0x55bd0000), SPH_C32(0x9b040000), SPH_C32(0xed150044), + SPH_C32(0x67f20000), SPH_C32(0xd9435d42), SPH_C32(0x0de42f6a), + SPH_C32(0x3b2eedc7), SPH_C32(0xc376a2c1), SPH_C32(0xf15b0000), + SPH_C32(0x0f8a0000), SPH_C32(0x57b30012), SPH_C32(0xbd5c0000), + SPH_C32(0xc6082e35), SPH_C32(0xa2dd0960), SPH_C32(0xaa0d4ae2), + SPH_C32(0xe4f9ae19) }, + { SPH_C32(0xdac80000), SPH_C32(0x36c00000), SPH_C32(0x15ae0060), + SPH_C32(0x0bb10000), SPH_C32(0x6b697976), SPH_C32(0x248dd0a9), + SPH_C32(0x67c3ff89), SPH_C32(0xb513679b), SPH_C32(0x584f0000), + SPH_C32(0x729f0000), SPH_C32(0xe07f000a), SPH_C32(0x43790000), + SPH_C32(0x9b1948bd), SPH_C32(0xe74476ba), SPH_C32(0x5d240486), + SPH_C32(0xa72142f2) }, + { SPH_C32(0xdd250000), SPH_C32(0x84900000), SPH_C32(0x92da006a), + SPH_C32(0x9cbc0000), SPH_C32(0x281b5ad8), SPH_C32(0x6c4abe0d), + SPH_C32(0x93bb9dab), SPH_C32(0x2566d655), SPH_C32(0xfa990000), + SPH_C32(0xd4e90000), SPH_C32(0x293b001e), SPH_C32(0xa8da0000), + SPH_C32(0x57f566c6), SPH_C32(0xd75cb223), SPH_C32(0x5e6d0e7c), + SPH_C32(0x3c4fba7a) }, + { SPH_C32(0x59920000), SPH_C32(0xf2370000), SPH_C32(0x14e90042), + SPH_C32(0xe5790000), SPH_C32(0x0bcc361f), SPH_C32(0x30a2fa8d), + SPH_C32(0x3b36cb7b), SPH_C32(0x8bb5076c), SPH_C32(0xd0d70000), + SPH_C32(0x6d0b0000), SPH_C32(0x9fb00024), SPH_C32(0xb8370000), + SPH_C32(0x6a414f27), SPH_C32(0x86eae7dd), SPH_C32(0xf5b174ea), + SPH_C32(0x41313666) }, + { SPH_C32(0x5e7f0000), SPH_C32(0x40670000), SPH_C32(0x939d0048), + SPH_C32(0x72740000), SPH_C32(0x48be15b1), SPH_C32(0x78659429), + SPH_C32(0xcf4ea959), SPH_C32(0x1bc0b6a2), SPH_C32(0x72010000), + SPH_C32(0xcb7d0000), SPH_C32(0x56f40030), SPH_C32(0x53940000), + SPH_C32(0xa6ad615c), SPH_C32(0xb6f22344), SPH_C32(0xf6f87e10), + SPH_C32(0xda5fceee) }, + { SPH_C32(0xd10a0000), SPH_C32(0xeda30000), SPH_C32(0x6b26006c), + SPH_C32(0x1e370000), SPH_C32(0xfa943185), SPH_C32(0x510c6bea), + SPH_C32(0x93a3bb17), SPH_C32(0x6da573f8), SPH_C32(0xdb150000), + SPH_C32(0xb6680000), SPH_C32(0xe1380028), SPH_C32(0xadb10000), + SPH_C32(0xfbbc07d4), SPH_C32(0xf36b5c9e), SPH_C32(0x01d13074), + SPH_C32(0x99872205) }, + { SPH_C32(0xd6e70000), SPH_C32(0x5ff30000), SPH_C32(0xec520066), + SPH_C32(0x893a0000), SPH_C32(0xb9e6122b), SPH_C32(0x19cb054e), + SPH_C32(0x67dbd935), SPH_C32(0xfdd0c236), SPH_C32(0x79c30000), + SPH_C32(0x101e0000), SPH_C32(0x287c003c), SPH_C32(0x46120000), + SPH_C32(0x375029af), SPH_C32(0xc3739807), SPH_C32(0x02983a8e), + SPH_C32(0x02e9da8d) }, + { SPH_C32(0x538d0000), SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), + SPH_C32(0x56ff0000), SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), + SPH_C32(0xa9444018), SPH_C32(0x7f975691), SPH_C32(0x01dd0000), + SPH_C32(0x80a80000), SPH_C32(0xf4960048), SPH_C32(0xa6000000), + SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), SPH_C32(0x6612cffd), + SPH_C32(0x2c94459e) }, + { SPH_C32(0x54600000), SPH_C32(0x1bac0000), SPH_C32(0x1983000c), + SPH_C32(0xc1f20000), SPH_C32(0x499623e0), SPH_C32(0xda02a35d), + SPH_C32(0x5d3c223a), SPH_C32(0xefe2e75f), SPH_C32(0xa30b0000), + SPH_C32(0x26de0000), SPH_C32(0x3dd2005c), SPH_C32(0x4da30000), + SPH_C32(0x5c3950d9), SPH_C32(0xe7fe48ae), SPH_C32(0x655bc507), + SPH_C32(0xb7fabd16) }, + { SPH_C32(0xdb150000), SPH_C32(0xb6680000), SPH_C32(0xe1380028), + SPH_C32(0xadb10000), SPH_C32(0xfbbc07d4), SPH_C32(0xf36b5c9e), + SPH_C32(0x01d13074), SPH_C32(0x99872205), SPH_C32(0x0a1f0000), + SPH_C32(0x5bcb0000), SPH_C32(0x8a1e0044), SPH_C32(0xb3860000), + SPH_C32(0x01283651), SPH_C32(0xa2673774), SPH_C32(0x92728b63), + SPH_C32(0xf42251fd) }, + { SPH_C32(0xdcf80000), SPH_C32(0x04380000), SPH_C32(0x664c0022), + SPH_C32(0x3abc0000), SPH_C32(0xb8ce247a), SPH_C32(0xbbac323a), + SPH_C32(0xf5a95256), SPH_C32(0x09f293cb), SPH_C32(0xa8c90000), + SPH_C32(0xfdbd0000), SPH_C32(0x435a0050), SPH_C32(0x58250000), + SPH_C32(0xcdc4182a), SPH_C32(0x927ff3ed), SPH_C32(0x913b8199), + SPH_C32(0x6f4ca975) }, + { SPH_C32(0x584f0000), SPH_C32(0x729f0000), SPH_C32(0xe07f000a), + SPH_C32(0x43790000), SPH_C32(0x9b1948bd), SPH_C32(0xe74476ba), + SPH_C32(0x5d240486), SPH_C32(0xa72142f2), SPH_C32(0x82870000), + SPH_C32(0x445f0000), SPH_C32(0xf5d1006a), SPH_C32(0x48c80000), + SPH_C32(0xf07031cb), SPH_C32(0xc3c9a613), SPH_C32(0x3ae7fb0f), + SPH_C32(0x12322569) }, + { SPH_C32(0x5fa20000), SPH_C32(0xc0cf0000), SPH_C32(0x670b0000), + SPH_C32(0xd4740000), SPH_C32(0xd86b6b13), SPH_C32(0xaf83181e), + SPH_C32(0xa95c66a4), SPH_C32(0x3754f33c), SPH_C32(0x20510000), + SPH_C32(0xe2290000), SPH_C32(0x3c95007e), SPH_C32(0xa36b0000), + SPH_C32(0x3c9c1fb0), SPH_C32(0xf3d1628a), SPH_C32(0x39aef1f5), + SPH_C32(0x895cdde1) }, + { SPH_C32(0xd0d70000), SPH_C32(0x6d0b0000), SPH_C32(0x9fb00024), + SPH_C32(0xb8370000), SPH_C32(0x6a414f27), SPH_C32(0x86eae7dd), + SPH_C32(0xf5b174ea), SPH_C32(0x41313666), SPH_C32(0x89450000), + SPH_C32(0x9f3c0000), SPH_C32(0x8b590066), SPH_C32(0x5d4e0000), + SPH_C32(0x618d7938), SPH_C32(0xb6481d50), SPH_C32(0xce87bf91), + SPH_C32(0xca84310a) }, + { SPH_C32(0xd73a0000), SPH_C32(0xdf5b0000), SPH_C32(0x18c4002e), + SPH_C32(0x2f3a0000), SPH_C32(0x29336c89), SPH_C32(0xce2d8979), + SPH_C32(0x01c916c8), SPH_C32(0xd14487a8), SPH_C32(0x2b930000), + SPH_C32(0x394a0000), SPH_C32(0x421d0072), SPH_C32(0xb6ed0000), + SPH_C32(0xad615743), SPH_C32(0x8650d9c9), SPH_C32(0xcdceb56b), + SPH_C32(0x51eac982) }, + { SPH_C32(0x01dd0000), SPH_C32(0x80a80000), SPH_C32(0xf4960048), + SPH_C32(0xa6000000), SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), + SPH_C32(0x6612cffd), SPH_C32(0x2c94459e), SPH_C32(0x52500000), + SPH_C32(0x29540000), SPH_C32(0x6a61004e), SPH_C32(0xf0ff0000), + SPH_C32(0x9a317eec), SPH_C32(0x452341ce), SPH_C32(0xcf568fe5), + SPH_C32(0x5303130f) }, + { SPH_C32(0x06300000), SPH_C32(0x32f80000), SPH_C32(0x73e20042), + SPH_C32(0x310d0000), SPH_C32(0xd3a75d0c), SPH_C32(0x9f21e293), + SPH_C32(0x926aaddf), SPH_C32(0xbce1f450), SPH_C32(0xf0860000), + SPH_C32(0x8f220000), SPH_C32(0xa325005a), SPH_C32(0x1b5c0000), + SPH_C32(0x56dd5097), SPH_C32(0x753b8557), SPH_C32(0xcc1f851f), + SPH_C32(0xc86deb87) }, + { SPH_C32(0x89450000), SPH_C32(0x9f3c0000), SPH_C32(0x8b590066), + SPH_C32(0x5d4e0000), SPH_C32(0x618d7938), SPH_C32(0xb6481d50), + SPH_C32(0xce87bf91), SPH_C32(0xca84310a), SPH_C32(0x59920000), + SPH_C32(0xf2370000), SPH_C32(0x14e90042), SPH_C32(0xe5790000), + SPH_C32(0x0bcc361f), SPH_C32(0x30a2fa8d), SPH_C32(0x3b36cb7b), + SPH_C32(0x8bb5076c) }, + { SPH_C32(0x8ea80000), SPH_C32(0x2d6c0000), SPH_C32(0x0c2d006c), + SPH_C32(0xca430000), SPH_C32(0x22ff5a96), SPH_C32(0xfe8f73f4), + SPH_C32(0x3affddb3), SPH_C32(0x5af180c4), SPH_C32(0xfb440000), + SPH_C32(0x54410000), SPH_C32(0xddad0056), SPH_C32(0x0eda0000), + SPH_C32(0xc7201864), SPH_C32(0x00ba3e14), SPH_C32(0x387fc181), + SPH_C32(0x10dbffe4) }, + { SPH_C32(0x0a1f0000), SPH_C32(0x5bcb0000), SPH_C32(0x8a1e0044), + SPH_C32(0xb3860000), SPH_C32(0x01283651), SPH_C32(0xa2673774), + SPH_C32(0x92728b63), SPH_C32(0xf42251fd), SPH_C32(0xd10a0000), + SPH_C32(0xeda30000), SPH_C32(0x6b26006c), SPH_C32(0x1e370000), + SPH_C32(0xfa943185), SPH_C32(0x510c6bea), SPH_C32(0x93a3bb17), + SPH_C32(0x6da573f8) }, + { SPH_C32(0x0df20000), SPH_C32(0xe99b0000), SPH_C32(0x0d6a004e), + SPH_C32(0x248b0000), SPH_C32(0x425a15ff), SPH_C32(0xeaa059d0), + SPH_C32(0x660ae941), SPH_C32(0x6457e033), SPH_C32(0x73dc0000), + SPH_C32(0x4bd50000), SPH_C32(0xa2620078), SPH_C32(0xf5940000), + SPH_C32(0x36781ffe), SPH_C32(0x6114af73), SPH_C32(0x90eab1ed), + SPH_C32(0xf6cb8b70) }, + { SPH_C32(0x82870000), SPH_C32(0x445f0000), SPH_C32(0xf5d1006a), + SPH_C32(0x48c80000), SPH_C32(0xf07031cb), SPH_C32(0xc3c9a613), + SPH_C32(0x3ae7fb0f), SPH_C32(0x12322569), SPH_C32(0xdac80000), + SPH_C32(0x36c00000), SPH_C32(0x15ae0060), SPH_C32(0x0bb10000), + SPH_C32(0x6b697976), SPH_C32(0x248dd0a9), SPH_C32(0x67c3ff89), + SPH_C32(0xb513679b) }, + { SPH_C32(0x856a0000), SPH_C32(0xf60f0000), SPH_C32(0x72a50060), + SPH_C32(0xdfc50000), SPH_C32(0xb3021265), SPH_C32(0x8b0ec8b7), + SPH_C32(0xce9f992d), SPH_C32(0x824794a7), SPH_C32(0x781e0000), + SPH_C32(0x90b60000), SPH_C32(0xdcea0074), SPH_C32(0xe0120000), + SPH_C32(0xa785570d), SPH_C32(0x14951430), SPH_C32(0x648af573), + SPH_C32(0x2e7d9f13) } +}; + +static const sph_u32 T512_45[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x1e6c0000), SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), + SPH_C32(0xbcb6b800), SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), + SPH_C32(0x6a0c1bc8), SPH_C32(0xb99dc2eb), SPH_C32(0x92560000), + SPH_C32(0x1eda0000), SPH_C32(0xea510000), SPH_C32(0xe8b13000), + SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), SPH_C32(0xb15c2254), + SPH_C32(0x33c5244f) }, + { SPH_C32(0x92560000), SPH_C32(0x1eda0000), SPH_C32(0xea510000), + SPH_C32(0xe8b13000), SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), + SPH_C32(0xb15c2254), SPH_C32(0x33c5244f), SPH_C32(0x8c3a0000), + SPH_C32(0xda980000), SPH_C32(0x607f0000), SPH_C32(0x54078800), + SPH_C32(0x85714513), SPH_C32(0x6006b243), SPH_C32(0xdb50399c), + SPH_C32(0x8a58e6a4) }, + { SPH_C32(0x8c3a0000), SPH_C32(0xda980000), SPH_C32(0x607f0000), + SPH_C32(0x54078800), SPH_C32(0x85714513), SPH_C32(0x6006b243), + SPH_C32(0xdb50399c), SPH_C32(0x8a58e6a4), SPH_C32(0x1e6c0000), + SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), SPH_C32(0xbcb6b800), + SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), SPH_C32(0x6a0c1bc8), + SPH_C32(0xb99dc2eb) }, + { SPH_C32(0x58430000), SPH_C32(0x807e0000), SPH_C32(0x78330001), + SPH_C32(0xc66b3800), SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), + SPH_C32(0xac73fe6f), SPH_C32(0x3a4479b1), SPH_C32(0x1d5a0000), + SPH_C32(0x2b720000), SPH_C32(0x488d0000), SPH_C32(0xaf611800), + SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), SPH_C32(0x81a20429), + SPH_C32(0x1e7536a6) }, + { SPH_C32(0x462f0000), SPH_C32(0x443c0000), SPH_C32(0xf21d0001), + SPH_C32(0x7add8000), SPH_C32(0xcb734f6a), SPH_C32(0xf250ec07), + SPH_C32(0xc67fe5a7), SPH_C32(0x83d9bb5a), SPH_C32(0x8f0c0000), + SPH_C32(0x35a80000), SPH_C32(0xa2dc0000), SPH_C32(0x47d02800), + SPH_C32(0x8cfe7860), SPH_C32(0x2382de49), SPH_C32(0x30fe267d), + SPH_C32(0x2db012e9) }, + { SPH_C32(0xca150000), SPH_C32(0x9ea40000), SPH_C32(0x92620001), + SPH_C32(0x2eda0800), SPH_C32(0x4e020a79), SPH_C32(0x92565e44), + SPH_C32(0x1d2fdc3b), SPH_C32(0x09815dfe), SPH_C32(0x91600000), + SPH_C32(0xf1ea0000), SPH_C32(0x28f20000), SPH_C32(0xfb669000), + SPH_C32(0xa0ba6bd6), SPH_C32(0xa87f0d93), SPH_C32(0x5af23db5), + SPH_C32(0x942dd002) }, + { SPH_C32(0xd4790000), SPH_C32(0x5ae60000), SPH_C32(0x184c0001), + SPH_C32(0x926cb000), SPH_C32(0x624619cf), SPH_C32(0x19ab8d9e), + SPH_C32(0x7723c7f3), SPH_C32(0xb01c9f15), SPH_C32(0x03360000), + SPH_C32(0xef300000), SPH_C32(0xc2a30000), SPH_C32(0x13d7a000), + SPH_C32(0x098f3d73), SPH_C32(0x43846c0a), SPH_C32(0xebae1fe1), + SPH_C32(0xa7e8f44d) }, + { SPH_C32(0x1d5a0000), SPH_C32(0x2b720000), SPH_C32(0x488d0000), + SPH_C32(0xaf611800), SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), + SPH_C32(0x81a20429), SPH_C32(0x1e7536a6), SPH_C32(0x45190000), + SPH_C32(0xab0c0000), SPH_C32(0x30be0001), SPH_C32(0x690a2000), + SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), SPH_C32(0x2dd1fa46), + SPH_C32(0x24314f17) }, + { SPH_C32(0x03360000), SPH_C32(0xef300000), SPH_C32(0xc2a30000), + SPH_C32(0x13d7a000), SPH_C32(0x098f3d73), SPH_C32(0x43846c0a), + SPH_C32(0xebae1fe1), SPH_C32(0xa7e8f44d), SPH_C32(0xd74f0000), + SPH_C32(0xb5d60000), SPH_C32(0xdaef0001), SPH_C32(0x81bb1000), + SPH_C32(0x6bc924bc), SPH_C32(0x5a2fe194), SPH_C32(0x9c8dd812), + SPH_C32(0x17f46b58) }, + { SPH_C32(0x8f0c0000), SPH_C32(0x35a80000), SPH_C32(0xa2dc0000), + SPH_C32(0x47d02800), SPH_C32(0x8cfe7860), SPH_C32(0x2382de49), + SPH_C32(0x30fe267d), SPH_C32(0x2db012e9), SPH_C32(0xc9230000), + SPH_C32(0x71940000), SPH_C32(0x50c10001), SPH_C32(0x3d0da800), + SPH_C32(0x478d370a), SPH_C32(0xd1d2324e), SPH_C32(0xf681c3da), + SPH_C32(0xae69a9b3) }, + { SPH_C32(0x91600000), SPH_C32(0xf1ea0000), SPH_C32(0x28f20000), + SPH_C32(0xfb669000), SPH_C32(0xa0ba6bd6), SPH_C32(0xa87f0d93), + SPH_C32(0x5af23db5), SPH_C32(0x942dd002), SPH_C32(0x5b750000), + SPH_C32(0x6f4e0000), SPH_C32(0xba900001), SPH_C32(0xd5bc9800), + SPH_C32(0xeeb861af), SPH_C32(0x3a2953d7), SPH_C32(0x47dde18e), + SPH_C32(0x9dac8dfc) }, + { SPH_C32(0x45190000), SPH_C32(0xab0c0000), SPH_C32(0x30be0001), + SPH_C32(0x690a2000), SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), + SPH_C32(0x2dd1fa46), SPH_C32(0x24314f17), SPH_C32(0x58430000), + SPH_C32(0x807e0000), SPH_C32(0x78330001), SPH_C32(0xc66b3800), + SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), SPH_C32(0xac73fe6f), + SPH_C32(0x3a4479b1) }, + { SPH_C32(0x5b750000), SPH_C32(0x6f4e0000), SPH_C32(0xba900001), + SPH_C32(0xd5bc9800), SPH_C32(0xeeb861af), SPH_C32(0x3a2953d7), + SPH_C32(0x47dde18e), SPH_C32(0x9dac8dfc), SPH_C32(0xca150000), + SPH_C32(0x9ea40000), SPH_C32(0x92620001), SPH_C32(0x2eda0800), + SPH_C32(0x4e020a79), SPH_C32(0x92565e44), SPH_C32(0x1d2fdc3b), + SPH_C32(0x09815dfe) }, + { SPH_C32(0xd74f0000), SPH_C32(0xb5d60000), SPH_C32(0xdaef0001), + SPH_C32(0x81bb1000), SPH_C32(0x6bc924bc), SPH_C32(0x5a2fe194), + SPH_C32(0x9c8dd812), SPH_C32(0x17f46b58), SPH_C32(0xd4790000), + SPH_C32(0x5ae60000), SPH_C32(0x184c0001), SPH_C32(0x926cb000), + SPH_C32(0x624619cf), SPH_C32(0x19ab8d9e), SPH_C32(0x7723c7f3), + SPH_C32(0xb01c9f15) }, + { SPH_C32(0xc9230000), SPH_C32(0x71940000), SPH_C32(0x50c10001), + SPH_C32(0x3d0da800), SPH_C32(0x478d370a), SPH_C32(0xd1d2324e), + SPH_C32(0xf681c3da), SPH_C32(0xae69a9b3), SPH_C32(0x462f0000), + SPH_C32(0x443c0000), SPH_C32(0xf21d0001), SPH_C32(0x7add8000), + SPH_C32(0xcb734f6a), SPH_C32(0xf250ec07), SPH_C32(0xc67fe5a7), + SPH_C32(0x83d9bb5a) }, + { SPH_C32(0xa53b0000), SPH_C32(0x14260000), SPH_C32(0x4e30001e), + SPH_C32(0x7cae0000), SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), + SPH_C32(0xf73168d8), SPH_C32(0x0b1b4946), SPH_C32(0x07ed0000), + SPH_C32(0xb2500000), SPH_C32(0x8774000a), SPH_C32(0x970d0000), + SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), SPH_C32(0xf4786222), + SPH_C32(0x9075b1ce) }, + { SPH_C32(0xbb570000), SPH_C32(0xd0640000), SPH_C32(0xc41e001e), + SPH_C32(0xc018b800), SPH_C32(0xa3da1e63), SPH_C32(0xf32279e7), + SPH_C32(0x9d3d7310), SPH_C32(0xb2868bad), SPH_C32(0x95bb0000), + SPH_C32(0xac8a0000), SPH_C32(0x6d25000a), SPH_C32(0x7fbc3000), + SPH_C32(0xea47750b), SPH_C32(0xa33c0f3d), SPH_C32(0x45244076), + SPH_C32(0xa3b09581) }, + { SPH_C32(0x376d0000), SPH_C32(0x0afc0000), SPH_C32(0xa461001e), + SPH_C32(0x941f3000), SPH_C32(0x26ab5b70), SPH_C32(0x9324cba4), + SPH_C32(0x466d4a8c), SPH_C32(0x38de6d09), SPH_C32(0x8bd70000), + SPH_C32(0x68c80000), SPH_C32(0xe70b000a), SPH_C32(0xc30a8800), + SPH_C32(0xc60366bd), SPH_C32(0x28c1dce7), SPH_C32(0x2f285bbe), + SPH_C32(0x1a2d576a) }, + { SPH_C32(0x29010000), SPH_C32(0xcebe0000), SPH_C32(0x2e4f001e), + SPH_C32(0x28a98800), SPH_C32(0x0aef48c6), SPH_C32(0x18d9187e), + SPH_C32(0x2c615144), SPH_C32(0x8143afe2), SPH_C32(0x19810000), + SPH_C32(0x76120000), SPH_C32(0x0d5a000a), SPH_C32(0x2bbbb800), + SPH_C32(0x6f363018), SPH_C32(0xc33abd7e), SPH_C32(0x9e7479ea), + SPH_C32(0x29e87325) }, + { SPH_C32(0xfd780000), SPH_C32(0x94580000), SPH_C32(0x3603001f), + SPH_C32(0xbac53800), SPH_C32(0x68a95109), SPH_C32(0x017295e0), + SPH_C32(0x5b4296b7), SPH_C32(0x315f30f7), SPH_C32(0x1ab70000), + SPH_C32(0x99220000), SPH_C32(0xcff9000a), SPH_C32(0x386c1800), + SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), SPH_C32(0x75da660b), + SPH_C32(0x8e008768) }, + { SPH_C32(0xe3140000), SPH_C32(0x501a0000), SPH_C32(0xbc2d001f), + SPH_C32(0x06738000), SPH_C32(0x44ed42bf), SPH_C32(0x8a8f463a), + SPH_C32(0x314e8d7f), SPH_C32(0x88c2f21c), SPH_C32(0x88e10000), + SPH_C32(0x87f80000), SPH_C32(0x25a8000a), SPH_C32(0xd0dd2800), + SPH_C32(0xcf8c5bce), SPH_C32(0x6b45b0ed), SPH_C32(0xc486445f), + SPH_C32(0xbdc5a327) }, + { SPH_C32(0x6f2e0000), SPH_C32(0x8a820000), SPH_C32(0xdc52001f), + SPH_C32(0x52740800), SPH_C32(0xc19c07ac), SPH_C32(0xea89f479), + SPH_C32(0xea1eb4e3), SPH_C32(0x029a14b8), SPH_C32(0x968d0000), + SPH_C32(0x43ba0000), SPH_C32(0xaf86000a), SPH_C32(0x6c6b9000), + SPH_C32(0xe3c84878), SPH_C32(0xe0b86337), SPH_C32(0xae8a5f97), + SPH_C32(0x045861cc) }, + { SPH_C32(0x71420000), SPH_C32(0x4ec00000), SPH_C32(0x567c001f), + SPH_C32(0xeec2b000), SPH_C32(0xedd8141a), SPH_C32(0x617427a3), + SPH_C32(0x8012af2b), SPH_C32(0xbb07d653), SPH_C32(0x04db0000), + SPH_C32(0x5d600000), SPH_C32(0x45d7000a), SPH_C32(0x84daa000), + SPH_C32(0x4afd1edd), SPH_C32(0x0b4302ae), SPH_C32(0x1fd67dc3), + SPH_C32(0x379d4583) }, + { SPH_C32(0xb8610000), SPH_C32(0x3f540000), SPH_C32(0x06bd001e), + SPH_C32(0xd3cf1800), SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), + SPH_C32(0x76936cf1), SPH_C32(0x156e7fe0), SPH_C32(0x42f40000), + SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), SPH_C32(0xfe072000), + SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), SPH_C32(0xd9a99864), + SPH_C32(0xb444fed9) }, + { SPH_C32(0xa60d0000), SPH_C32(0xfb160000), SPH_C32(0x8c93001e), + SPH_C32(0x6f79a000), SPH_C32(0x861130a6), SPH_C32(0x3b5bc637), + SPH_C32(0x1c9f7739), SPH_C32(0xacf3bd0b), SPH_C32(0xd0a20000), + SPH_C32(0x07860000), SPH_C32(0x5d9b000b), SPH_C32(0x16b61000), + SPH_C32(0x28bb0712), SPH_C32(0x12e88f30), SPH_C32(0x68f5ba30), + SPH_C32(0x8781da96) }, + { SPH_C32(0x2a370000), SPH_C32(0x218e0000), SPH_C32(0xecec001e), + SPH_C32(0x3b7e2800), SPH_C32(0x036075b5), SPH_C32(0x5b5d7474), + SPH_C32(0xc7cf4ea5), SPH_C32(0x26ab5baf), SPH_C32(0xcece0000), + SPH_C32(0xc3c40000), SPH_C32(0xd7b5000b), SPH_C32(0xaa00a800), + SPH_C32(0x04ff14a4), SPH_C32(0x99155cea), SPH_C32(0x02f9a1f8), + SPH_C32(0x3e1c187d) }, + { SPH_C32(0x345b0000), SPH_C32(0xe5cc0000), SPH_C32(0x66c2001e), + SPH_C32(0x87c89000), SPH_C32(0x2f246603), SPH_C32(0xd0a0a7ae), + SPH_C32(0xadc3556d), SPH_C32(0x9f369944), SPH_C32(0x5c980000), + SPH_C32(0xdd1e0000), SPH_C32(0x3de4000b), SPH_C32(0x42b19800), + SPH_C32(0xadca4201), SPH_C32(0x72ee3d73), SPH_C32(0xb3a583ac), + SPH_C32(0x0dd93c32) }, + { SPH_C32(0xe0220000), SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), + SPH_C32(0x15a42000), SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), + SPH_C32(0xdae0929e), SPH_C32(0x2f2a0651), SPH_C32(0x5fae0000), + SPH_C32(0x322e0000), SPH_C32(0xff47000b), SPH_C32(0x51663800), + SPH_C32(0xa4457f72), SPH_C32(0x316a5179), SPH_C32(0x580b9c4d), + SPH_C32(0xaa31c87f) }, + { SPH_C32(0xfe4e0000), SPH_C32(0x7b680000), SPH_C32(0xf4a0001f), + SPH_C32(0xa9129800), SPH_C32(0x61266c7a), SPH_C32(0x42f6f9ea), + SPH_C32(0xb0ec8956), SPH_C32(0x96b7c4ba), SPH_C32(0xcdf80000), + SPH_C32(0x2cf40000), SPH_C32(0x1516000b), SPH_C32(0xb9d70800), + SPH_C32(0x0d7029d7), SPH_C32(0xda9130e0), SPH_C32(0xe957be19), + SPH_C32(0x99f4ec30) }, + { SPH_C32(0x72740000), SPH_C32(0xa1f00000), SPH_C32(0x94df001f), + SPH_C32(0xfd151000), SPH_C32(0xe4572969), SPH_C32(0x22f04ba9), + SPH_C32(0x6bbcb0ca), SPH_C32(0x1cef221e), SPH_C32(0xd3940000), + SPH_C32(0xe8b60000), SPH_C32(0x9f38000b), SPH_C32(0x0561b000), + SPH_C32(0x21343a61), SPH_C32(0x516ce33a), SPH_C32(0x835ba5d1), + SPH_C32(0x20692edb) }, + { SPH_C32(0x6c180000), SPH_C32(0x65b20000), SPH_C32(0x1ef1001f), + SPH_C32(0x41a3a800), SPH_C32(0xc8133adf), SPH_C32(0xa90d9873), + SPH_C32(0x01b0ab02), SPH_C32(0xa572e0f5), SPH_C32(0x41c20000), + SPH_C32(0xf66c0000), SPH_C32(0x7569000b), SPH_C32(0xedd08000), + SPH_C32(0x88016cc4), SPH_C32(0xba9782a3), SPH_C32(0x32078785), + SPH_C32(0x13ac0a94) } +}; + +static const sph_u32 T512_50[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xf0c50000), SPH_C32(0x59230000), SPH_C32(0x45820000), + SPH_C32(0xe18d00c0), SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), + SPH_C32(0xcbe0fe1c), SPH_C32(0x56a7b19f), SPH_C32(0x16ed0000), + SPH_C32(0x15680000), SPH_C32(0xedd70000), SPH_C32(0x325d0220), + SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), SPH_C32(0xe375f8a8), + SPH_C32(0x81fdf908) }, + { SPH_C32(0xb4310000), SPH_C32(0x77330000), SPH_C32(0xb15d0000), + SPH_C32(0x7fd004e0), SPH_C32(0x78a26138), SPH_C32(0xd116c35d), + SPH_C32(0xd256d489), SPH_C32(0x4e6f74de), SPH_C32(0xe3060000), + SPH_C32(0xbdc10000), SPH_C32(0x87130000), SPH_C32(0xbff20060), + SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), SPH_C32(0x73c5ab06), + SPH_C32(0x5bd61539) }, + { SPH_C32(0x44f40000), SPH_C32(0x2e100000), SPH_C32(0xf4df0000), + SPH_C32(0x9e5d0420), SPH_C32(0x43cf6709), SPH_C32(0x13fb95c4), + SPH_C32(0x19b62a95), SPH_C32(0x18c8c541), SPH_C32(0xf5eb0000), + SPH_C32(0xa8a90000), SPH_C32(0x6ac40000), SPH_C32(0x8daf0240), + SPH_C32(0xcdb63c93), SPH_C32(0xd7ffd112), SPH_C32(0x90b053ae), + SPH_C32(0xda2bec31) }, + { SPH_C32(0xe3060000), SPH_C32(0xbdc10000), SPH_C32(0x87130000), + SPH_C32(0xbff20060), SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), + SPH_C32(0x73c5ab06), SPH_C32(0x5bd61539), SPH_C32(0x57370000), + SPH_C32(0xcaf20000), SPH_C32(0x364e0000), SPH_C32(0xc0220480), + SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), SPH_C32(0xa1937f8f), + SPH_C32(0x15b961e7) }, + { SPH_C32(0x13c30000), SPH_C32(0xe4e20000), SPH_C32(0xc2910000), + SPH_C32(0x5e7f00a0), SPH_C32(0x15d70c2b), SPH_C32(0x4f5861c8), + SPH_C32(0xb825551a), SPH_C32(0x0d71a4a6), SPH_C32(0x41da0000), + SPH_C32(0xdf9a0000), SPH_C32(0xdb990000), SPH_C32(0xf27f06a0), + SPH_C32(0xb5145dab), SPH_C32(0x06e9124f), SPH_C32(0x42e68727), + SPH_C32(0x944498ef) }, + { SPH_C32(0x57370000), SPH_C32(0xcaf20000), SPH_C32(0x364e0000), + SPH_C32(0xc0220480), SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), + SPH_C32(0xa1937f8f), SPH_C32(0x15b961e7), SPH_C32(0xb4310000), + SPH_C32(0x77330000), SPH_C32(0xb15d0000), SPH_C32(0x7fd004e0), + SPH_C32(0x78a26138), SPH_C32(0xd116c35d), SPH_C32(0xd256d489), + SPH_C32(0x4e6f74de) }, + { SPH_C32(0xa7f20000), SPH_C32(0x93d10000), SPH_C32(0x73cc0000), + SPH_C32(0x21af0440), SPH_C32(0x6d756d13), SPH_C32(0x9e4ea295), + SPH_C32(0x6a738193), SPH_C32(0x431ed078), SPH_C32(0xa2dc0000), + SPH_C32(0x625b0000), SPH_C32(0x5c8a0000), SPH_C32(0x4d8d06c0), + SPH_C32(0x9bae57b1), SPH_C32(0x8b5c251e), SPH_C32(0x31232c21), + SPH_C32(0xcf928dd6) }, + { SPH_C32(0x02f20000), SPH_C32(0xa2810000), SPH_C32(0x873f0000), + SPH_C32(0xe36c7800), SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), + SPH_C32(0xc4c23237), SPH_C32(0x7f32259e), SPH_C32(0xbadd0000), + SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), SPH_C32(0xf7282800), + SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), SPH_C32(0xea5a8d14), + SPH_C32(0x2a2c18f0) }, + { SPH_C32(0xf2370000), SPH_C32(0xfba20000), SPH_C32(0xc2bd0000), + SPH_C32(0x02e178c0), SPH_C32(0x257072de), SPH_C32(0xc5d07d4f), + SPH_C32(0x0f22cc2b), SPH_C32(0x29959401), SPH_C32(0xac300000), + SPH_C32(0x06c50000), SPH_C32(0x5a300000), SPH_C32(0xc5752a20), + SPH_C32(0x3c4922c4), SPH_C32(0x6c502579), SPH_C32(0x092f75bc), + SPH_C32(0xabd1e1f8) }, + { SPH_C32(0xb6c30000), SPH_C32(0xd5b20000), SPH_C32(0x36620000), + SPH_C32(0x9cbc7ce0), SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), + SPH_C32(0x1694e6be), SPH_C32(0x315d5140), SPH_C32(0x59db0000), + SPH_C32(0xae6c0000), SPH_C32(0x30f40000), SPH_C32(0x48da2860), + SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), SPH_C32(0x999f2612), + SPH_C32(0x71fa0dc9) }, + { SPH_C32(0x46060000), SPH_C32(0x8c910000), SPH_C32(0x73e00000), + SPH_C32(0x7d317c20), SPH_C32(0x5dd213e6), SPH_C32(0x14c6be12), + SPH_C32(0xdd7418a2), SPH_C32(0x67fae0df), SPH_C32(0x4f360000), + SPH_C32(0xbb040000), SPH_C32(0xdd230000), SPH_C32(0x7a872a40), + SPH_C32(0x12f328de), SPH_C32(0xe1e51228), SPH_C32(0x7aeadeba), + SPH_C32(0xf007f4c1) }, + { SPH_C32(0xe1f40000), SPH_C32(0x1f400000), SPH_C32(0x002c0000), + SPH_C32(0x5c9e7860), SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), + SPH_C32(0xb7079931), SPH_C32(0x24e430a7), SPH_C32(0xedea0000), + SPH_C32(0xd95f0000), SPH_C32(0x81a90000), SPH_C32(0x370a2c80), + SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), SPH_C32(0x4bc9f29b), + SPH_C32(0x3f957917) }, + { SPH_C32(0x11310000), SPH_C32(0x46630000), SPH_C32(0x45ae0000), + SPH_C32(0xbd1378a0), SPH_C32(0x0bca78c4), SPH_C32(0x48654a1e), + SPH_C32(0x7ce7672d), SPH_C32(0x72438138), SPH_C32(0xfb070000), + SPH_C32(0xcc370000), SPH_C32(0x6c7e0000), SPH_C32(0x05572ea0), + SPH_C32(0x6a5149e6), SPH_C32(0x30f3d175), SPH_C32(0xa8bc0a33), + SPH_C32(0xbe68801f) }, + { SPH_C32(0x55c50000), SPH_C32(0x68730000), SPH_C32(0xb1710000), + SPH_C32(0x234e7c80), SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), + SPH_C32(0x65514db8), SPH_C32(0x6a8b4479), SPH_C32(0x0eec0000), + SPH_C32(0x649e0000), SPH_C32(0x06ba0000), SPH_C32(0x88f82ce0), + SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), SPH_C32(0x380c599d), + SPH_C32(0x64436c2e) }, + { SPH_C32(0xa5000000), SPH_C32(0x31500000), SPH_C32(0xf4f30000), + SPH_C32(0xc2c37c40), SPH_C32(0x736819fc), SPH_C32(0x99738943), + SPH_C32(0xaeb1b3a4), SPH_C32(0x3c2cf5e6), SPH_C32(0x18010000), + SPH_C32(0x71f60000), SPH_C32(0xeb6d0000), SPH_C32(0xbaa52ec0), + SPH_C32(0x44eb43fc), SPH_C32(0xbd46e624), SPH_C32(0xdb79a135), + SPH_C32(0xe5be9526) }, + { SPH_C32(0xbadd0000), SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), + SPH_C32(0xf7282800), SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), + SPH_C32(0xea5a8d14), SPH_C32(0x2a2c18f0), SPH_C32(0xb82f0000), + SPH_C32(0xb12c0000), SPH_C32(0x30d80000), SPH_C32(0x14445000), + SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), SPH_C32(0x2e98bf23), + SPH_C32(0x551e3d6e) }, + { SPH_C32(0x4a180000), SPH_C32(0x4a8e0000), SPH_C32(0xf2650000), + SPH_C32(0x16a528c0), SPH_C32(0xe428127c), SPH_C32(0xf4f795a3), + SPH_C32(0x21ba7308), SPH_C32(0x7c8ba96f), SPH_C32(0xaec20000), + SPH_C32(0xa4440000), SPH_C32(0xdd0f0000), SPH_C32(0x26195220), + SPH_C32(0x2254562b), SPH_C32(0x6b6d0eaf), SPH_C32(0xcded478b), + SPH_C32(0xd4e3c466) }, + { SPH_C32(0x0eec0000), SPH_C32(0x649e0000), SPH_C32(0x06ba0000), + SPH_C32(0x88f82ce0), SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), + SPH_C32(0x380c599d), SPH_C32(0x64436c2e), SPH_C32(0x5b290000), + SPH_C32(0x0ced0000), SPH_C32(0xb7cb0000), SPH_C32(0xabb65060), + SPH_C32(0xefe26ab8), SPH_C32(0xbc92dfbd), SPH_C32(0x5d5d1425), + SPH_C32(0x0ec82857) }, + { SPH_C32(0xfe290000), SPH_C32(0x3dbd0000), SPH_C32(0x43380000), + SPH_C32(0x69752c20), SPH_C32(0x9c8a7344), SPH_C32(0x25e156fe), + SPH_C32(0xf3eca781), SPH_C32(0x32e4ddb1), SPH_C32(0x4dc40000), + SPH_C32(0x19850000), SPH_C32(0x5a1c0000), SPH_C32(0x99eb5240), + SPH_C32(0x0cee5c31), SPH_C32(0xe6d839fe), SPH_C32(0xbe28ec8d), + SPH_C32(0x8f35d15f) }, + { SPH_C32(0x59db0000), SPH_C32(0xae6c0000), SPH_C32(0x30f40000), + SPH_C32(0x48da2860), SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), + SPH_C32(0x999f2612), SPH_C32(0x71fa0dc9), SPH_C32(0xef180000), + SPH_C32(0x7bde0000), SPH_C32(0x06960000), SPH_C32(0xd4665480), + SPH_C32(0x97400b80), SPH_C32(0x6d841ce0), SPH_C32(0x8f0bc0ac), + SPH_C32(0x40a75c89) }, + { SPH_C32(0xa91e0000), SPH_C32(0xf74f0000), SPH_C32(0x75760000), + SPH_C32(0xa95728a0), SPH_C32(0xca921866), SPH_C32(0x7942a2f2), + SPH_C32(0x527fd80e), SPH_C32(0x275dbc56), SPH_C32(0xf9f50000), + SPH_C32(0x6eb60000), SPH_C32(0xeb410000), SPH_C32(0xe63b56a0), + SPH_C32(0x744c3d09), SPH_C32(0x37cefaa3), SPH_C32(0x6c7e3804), + SPH_C32(0xc15aa581) }, + { SPH_C32(0xedea0000), SPH_C32(0xd95f0000), SPH_C32(0x81a90000), + SPH_C32(0x370a2c80), SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), + SPH_C32(0x4bc9f29b), SPH_C32(0x3f957917), SPH_C32(0x0c1e0000), + SPH_C32(0xc61f0000), SPH_C32(0x81850000), SPH_C32(0x6b9454e0), + SPH_C32(0xb9fa019a), SPH_C32(0xe0312bb1), SPH_C32(0xfcce6baa), + SPH_C32(0x1b7149b0) }, + { SPH_C32(0x1d2f0000), SPH_C32(0x807c0000), SPH_C32(0xc42b0000), + SPH_C32(0xd6872c40), SPH_C32(0xb230795e), SPH_C32(0xa85461af), + SPH_C32(0x80290c87), SPH_C32(0x6932c888), SPH_C32(0x1af30000), + SPH_C32(0xd3770000), SPH_C32(0x6c520000), SPH_C32(0x59c956c0), + SPH_C32(0x5af63713), SPH_C32(0xba7bcdf2), SPH_C32(0x1fbb9302), + SPH_C32(0x9a8cb0b8) }, + { SPH_C32(0xb82f0000), SPH_C32(0xb12c0000), SPH_C32(0x30d80000), + SPH_C32(0x14445000), SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), + SPH_C32(0x2e98bf23), SPH_C32(0x551e3d6e), SPH_C32(0x02f20000), + SPH_C32(0xa2810000), SPH_C32(0x873f0000), SPH_C32(0xe36c7800), + SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), SPH_C32(0xc4c23237), + SPH_C32(0x7f32259e) }, + { SPH_C32(0x48ea0000), SPH_C32(0xe80f0000), SPH_C32(0x755a0000), + SPH_C32(0xf5c950c0), SPH_C32(0xfa356693), SPH_C32(0xf3cabe75), + SPH_C32(0xe578413f), SPH_C32(0x03b98cf1), SPH_C32(0x141f0000), + SPH_C32(0xb7e90000), SPH_C32(0x6ae80000), SPH_C32(0xd1317a20), + SPH_C32(0xfd114266), SPH_C32(0x5d77cd95), SPH_C32(0x27b7ca9f), + SPH_C32(0xfecfdc96) }, + { SPH_C32(0x0c1e0000), SPH_C32(0xc61f0000), SPH_C32(0x81850000), + SPH_C32(0x6b9454e0), SPH_C32(0xb9fa019a), SPH_C32(0xe0312bb1), + SPH_C32(0xfcce6baa), SPH_C32(0x1b7149b0), SPH_C32(0xe1f40000), + SPH_C32(0x1f400000), SPH_C32(0x002c0000), SPH_C32(0x5c9e7860), + SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), SPH_C32(0xb7079931), + SPH_C32(0x24e430a7) }, + { SPH_C32(0xfcdb0000), SPH_C32(0x9f3c0000), SPH_C32(0xc4070000), + SPH_C32(0x8a195420), SPH_C32(0x829707ab), SPH_C32(0x22dc7d28), + SPH_C32(0x372e95b6), SPH_C32(0x4dd6f82f), SPH_C32(0xf7190000), + SPH_C32(0x0a280000), SPH_C32(0xedfb0000), SPH_C32(0x6ec37a40), + SPH_C32(0xd3ab487c), SPH_C32(0xd0c2fac4), SPH_C32(0x54726199), + SPH_C32(0xa519c9af) }, + { SPH_C32(0x5b290000), SPH_C32(0x0ced0000), SPH_C32(0xb7cb0000), + SPH_C32(0xabb65060), SPH_C32(0xefe26ab8), SPH_C32(0xbc92dfbd), + SPH_C32(0x5d5d1425), SPH_C32(0x0ec82857), SPH_C32(0x55c50000), + SPH_C32(0x68730000), SPH_C32(0xb1710000), SPH_C32(0x234e7c80), + SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), SPH_C32(0x65514db8), + SPH_C32(0x6a8b4479) }, + { SPH_C32(0xabec0000), SPH_C32(0x55ce0000), SPH_C32(0xf2490000), + SPH_C32(0x4a3b50a0), SPH_C32(0xd48f6c89), SPH_C32(0x7e7f8924), + SPH_C32(0x96bdea39), SPH_C32(0x586f99c8), SPH_C32(0x43280000), + SPH_C32(0x7d1b0000), SPH_C32(0x5ca60000), SPH_C32(0x11137ea0), + SPH_C32(0xab092944), SPH_C32(0x01d43999), SPH_C32(0x8624b510), + SPH_C32(0xeb76bd71) }, + { SPH_C32(0xef180000), SPH_C32(0x7bde0000), SPH_C32(0x06960000), + SPH_C32(0xd4665480), SPH_C32(0x97400b80), SPH_C32(0x6d841ce0), + SPH_C32(0x8f0bc0ac), SPH_C32(0x40a75c89), SPH_C32(0xb6c30000), + SPH_C32(0xd5b20000), SPH_C32(0x36620000), SPH_C32(0x9cbc7ce0), + SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), SPH_C32(0x1694e6be), + SPH_C32(0x315d5140) }, + { SPH_C32(0x1fdd0000), SPH_C32(0x22fd0000), SPH_C32(0x43140000), + SPH_C32(0x35eb5440), SPH_C32(0xac2d0db1), SPH_C32(0xaf694a79), + SPH_C32(0x44eb3eb0), SPH_C32(0x1600ed16), SPH_C32(0xa02e0000), + SPH_C32(0xc0da0000), SPH_C32(0xdbb50000), SPH_C32(0xaee17ec0), + SPH_C32(0x85b3235e), SPH_C32(0x8c610ec8), SPH_C32(0xf5e11e16), + SPH_C32(0xb0a0a848) } +}; + +static const sph_u32 T512_55[32][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x5fa80000), SPH_C32(0x56030000), SPH_C32(0x43ae0000), + SPH_C32(0x64f30013), SPH_C32(0x257e86bf), SPH_C32(0x1311944e), + SPH_C32(0x541e95bf), SPH_C32(0x8ea4db69), SPH_C32(0x00440000), + SPH_C32(0x7f480000), SPH_C32(0xda7c0000), SPH_C32(0x2a230001), + SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), SPH_C32(0x030a9e60), + SPH_C32(0xbe0a679e) }, + { SPH_C32(0x00440000), SPH_C32(0x7f480000), SPH_C32(0xda7c0000), + SPH_C32(0x2a230001), SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), + SPH_C32(0x030a9e60), SPH_C32(0xbe0a679e), SPH_C32(0x5fec0000), + SPH_C32(0x294b0000), SPH_C32(0x99d20000), SPH_C32(0x4ed00012), + SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), SPH_C32(0x57140bdf), + SPH_C32(0x30aebcf7) }, + { SPH_C32(0x5fec0000), SPH_C32(0x294b0000), SPH_C32(0x99d20000), + SPH_C32(0x4ed00012), SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), + SPH_C32(0x57140bdf), SPH_C32(0x30aebcf7), SPH_C32(0x5fa80000), + SPH_C32(0x56030000), SPH_C32(0x43ae0000), SPH_C32(0x64f30013), + SPH_C32(0x257e86bf), SPH_C32(0x1311944e), SPH_C32(0x541e95bf), + SPH_C32(0x8ea4db69) }, + { SPH_C32(0xee930000), SPH_C32(0xd6070000), SPH_C32(0x92c10000), + SPH_C32(0x2b9801e0), SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), + SPH_C32(0x45312374), SPH_C32(0x201f6a64), SPH_C32(0x7b280000), + SPH_C32(0x57420000), SPH_C32(0xa9e50000), SPH_C32(0x634300a0), + SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), SPH_C32(0x27f83b03), + SPH_C32(0xc7ff60f0) }, + { SPH_C32(0xb13b0000), SPH_C32(0x80040000), SPH_C32(0xd16f0000), + SPH_C32(0x4f6b01f3), SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), + SPH_C32(0x112fb6cb), SPH_C32(0xaebbb10d), SPH_C32(0x7b6c0000), + SPH_C32(0x280a0000), SPH_C32(0x73990000), SPH_C32(0x496000a1), + SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), SPH_C32(0x24f2a563), + SPH_C32(0x79f5076e) }, + { SPH_C32(0xeed70000), SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), + SPH_C32(0x01bb01e1), SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), + SPH_C32(0x463bbd14), SPH_C32(0x9e150dfa), SPH_C32(0x24c40000), + SPH_C32(0x7e090000), SPH_C32(0x30370000), SPH_C32(0x2d9300b2), + SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), SPH_C32(0x70ec30dc), + SPH_C32(0xf751dc07) }, + { SPH_C32(0xb17f0000), SPH_C32(0xff4c0000), SPH_C32(0x0b130000), + SPH_C32(0x654801f2), SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), + SPH_C32(0x122528ab), SPH_C32(0x10b1d693), SPH_C32(0x24800000), + SPH_C32(0x01410000), SPH_C32(0xea4b0000), SPH_C32(0x07b000b3), + SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), SPH_C32(0x73e6aebc), + SPH_C32(0x495bbb99) }, + { SPH_C32(0x7b280000), SPH_C32(0x57420000), SPH_C32(0xa9e50000), + SPH_C32(0x634300a0), SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), + SPH_C32(0x27f83b03), SPH_C32(0xc7ff60f0), SPH_C32(0x95bb0000), + SPH_C32(0x81450000), SPH_C32(0x3b240000), SPH_C32(0x48db0140), + SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), SPH_C32(0x62c91877), + SPH_C32(0xe7e00a94) }, + { SPH_C32(0x24800000), SPH_C32(0x01410000), SPH_C32(0xea4b0000), + SPH_C32(0x07b000b3), SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), + SPH_C32(0x73e6aebc), SPH_C32(0x495bbb99), SPH_C32(0x95ff0000), + SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), SPH_C32(0x62f80141), + SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), SPH_C32(0x61c38617), + SPH_C32(0x59ea6d0a) }, + { SPH_C32(0x7b6c0000), SPH_C32(0x280a0000), SPH_C32(0x73990000), + SPH_C32(0x496000a1), SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), + SPH_C32(0x24f2a563), SPH_C32(0x79f5076e), SPH_C32(0xca570000), + SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), SPH_C32(0x060b0152), + SPH_C32(0x14592320), SPH_C32(0xec526625), SPH_C32(0x35dd13a8), + SPH_C32(0xd74eb663) }, + { SPH_C32(0x24c40000), SPH_C32(0x7e090000), SPH_C32(0x30370000), + SPH_C32(0x2d9300b2), SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), + SPH_C32(0x70ec30dc), SPH_C32(0xf751dc07), SPH_C32(0xca130000), + SPH_C32(0xd7460000), SPH_C32(0x788a0000), SPH_C32(0x2c280153), + SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), SPH_C32(0x36d78dc8), + SPH_C32(0x6944d1fd) }, + { SPH_C32(0x95bb0000), SPH_C32(0x81450000), SPH_C32(0x3b240000), + SPH_C32(0x48db0140), SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), + SPH_C32(0x62c91877), SPH_C32(0xe7e00a94), SPH_C32(0xee930000), + SPH_C32(0xd6070000), SPH_C32(0x92c10000), SPH_C32(0x2b9801e0), + SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), SPH_C32(0x45312374), + SPH_C32(0x201f6a64) }, + { SPH_C32(0xca130000), SPH_C32(0xd7460000), SPH_C32(0x788a0000), + SPH_C32(0x2c280153), SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), + SPH_C32(0x36d78dc8), SPH_C32(0x6944d1fd), SPH_C32(0xeed70000), + SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), SPH_C32(0x01bb01e1), + SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), SPH_C32(0x463bbd14), + SPH_C32(0x9e150dfa) }, + { SPH_C32(0x95ff0000), SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), + SPH_C32(0x62f80141), SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), + SPH_C32(0x61c38617), SPH_C32(0x59ea6d0a), SPH_C32(0xb17f0000), + SPH_C32(0xff4c0000), SPH_C32(0x0b130000), SPH_C32(0x654801f2), + SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), SPH_C32(0x122528ab), + SPH_C32(0x10b1d693) }, + { SPH_C32(0xca570000), SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), + SPH_C32(0x060b0152), SPH_C32(0x14592320), SPH_C32(0xec526625), + SPH_C32(0x35dd13a8), SPH_C32(0xd74eb663), SPH_C32(0xb13b0000), + SPH_C32(0x80040000), SPH_C32(0xd16f0000), SPH_C32(0x4f6b01f3), + SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), SPH_C32(0x112fb6cb), + SPH_C32(0xaebbb10d) }, + { SPH_C32(0xe6280000), SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), + SPH_C32(0xd3d002e0), SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), + SPH_C32(0x289506b4), SPH_C32(0xd75a4897), SPH_C32(0xf0c50000), + SPH_C32(0x59230000), SPH_C32(0x45820000), SPH_C32(0xe18d00c0), + SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), SPH_C32(0xcbe0fe1c), + SPH_C32(0x56a7b19f) }, + { SPH_C32(0xb9800000), SPH_C32(0x1a480000), SPH_C32(0xebfb0000), + SPH_C32(0xb72302f3), SPH_C32(0xfd1fb607), SPH_C32(0x8bb62494), + SPH_C32(0x7c8b930b), SPH_C32(0x59fe93fe), SPH_C32(0xf0810000), + SPH_C32(0x266b0000), SPH_C32(0x9ffe0000), SPH_C32(0xcbae00c1), + SPH_C32(0x00c0cffd), SPH_C32(0x6b5bca1e), SPH_C32(0xc8ea607c), + SPH_C32(0xe8add601) }, + { SPH_C32(0xe66c0000), SPH_C32(0x33030000), SPH_C32(0x72290000), + SPH_C32(0xf9f302e1), SPH_C32(0xe3ccf974), SPH_C32(0x31112c5d), + SPH_C32(0x2b9f98d4), SPH_C32(0x69502f09), SPH_C32(0xaf290000), + SPH_C32(0x70680000), SPH_C32(0xdc500000), SPH_C32(0xaf5d00d2), + SPH_C32(0x25be4942), SPH_C32(0x784a5e50), SPH_C32(0x9cf4f5c3), + SPH_C32(0x66090d68) }, + { SPH_C32(0xb9c40000), SPH_C32(0x65000000), SPH_C32(0x31870000), + SPH_C32(0x9d0002f2), SPH_C32(0xc6b27fcb), SPH_C32(0x2200b813), + SPH_C32(0x7f810d6b), SPH_C32(0xe7f4f460), SPH_C32(0xaf6d0000), + SPH_C32(0x0f200000), SPH_C32(0x062c0000), SPH_C32(0x857e00d3), + SPH_C32(0x1e13808e), SPH_C32(0xd1fcc2d7), SPH_C32(0x9ffe6ba3), + SPH_C32(0xd8036af6) }, + { SPH_C32(0x08bb0000), SPH_C32(0x9a4c0000), SPH_C32(0x3a940000), + SPH_C32(0xf8480300), SPH_C32(0x4c3018c4), SPH_C32(0xa3cb4b8d), + SPH_C32(0x6da425c0), SPH_C32(0xf74522f3), SPH_C32(0x8bed0000), + SPH_C32(0x0e610000), SPH_C32(0xec670000), SPH_C32(0x82ce0060), + SPH_C32(0xa5b6421e), SPH_C32(0xaf74c322), SPH_C32(0xec18c51f), + SPH_C32(0x9158d16f) }, + { SPH_C32(0x57130000), SPH_C32(0xcc4f0000), SPH_C32(0x793a0000), + SPH_C32(0x9cbb0313), SPH_C32(0x694e9e7b), SPH_C32(0xb0dadfc3), + SPH_C32(0x39bab07f), SPH_C32(0x79e1f99a), SPH_C32(0x8ba90000), + SPH_C32(0x71290000), SPH_C32(0x361b0000), SPH_C32(0xa8ed0061), + SPH_C32(0x9e1b8bd2), SPH_C32(0x06c25fa5), SPH_C32(0xef125b7f), + SPH_C32(0x2f52b6f1) }, + { SPH_C32(0x08ff0000), SPH_C32(0xe5040000), SPH_C32(0xe0e80000), + SPH_C32(0xd26b0301), SPH_C32(0x779dd108), SPH_C32(0x0a7dd70a), + SPH_C32(0x6eaebba0), SPH_C32(0x494f456d), SPH_C32(0xd4010000), + SPH_C32(0x272a0000), SPH_C32(0x75b50000), SPH_C32(0xcc1e0072), + SPH_C32(0xbb650d6d), SPH_C32(0x15d3cbeb), SPH_C32(0xbb0ccec0), + SPH_C32(0xa1f66d98) }, + { SPH_C32(0x57570000), SPH_C32(0xb3070000), SPH_C32(0xa3460000), + SPH_C32(0xb6980312), SPH_C32(0x52e357b7), SPH_C32(0x196c4344), + SPH_C32(0x3ab02e1f), SPH_C32(0xc7eb9e04), SPH_C32(0xd4450000), + SPH_C32(0x58620000), SPH_C32(0xafc90000), SPH_C32(0xe63d0073), + SPH_C32(0x80c8c4a1), SPH_C32(0xbc65576c), SPH_C32(0xb80650a0), + SPH_C32(0x1ffc0a06) }, + { SPH_C32(0x9d000000), SPH_C32(0x1b090000), SPH_C32(0x01b00000), + SPH_C32(0xb0930240), SPH_C32(0x46ba7497), SPH_C32(0xf53e2561), + SPH_C32(0x0f6d3db7), SPH_C32(0x10a52867), SPH_C32(0x657e0000), + SPH_C32(0xd8660000), SPH_C32(0x7ea60000), SPH_C32(0xa9560180), + SPH_C32(0x31e76a62), SPH_C32(0x94183875), SPH_C32(0xa929e66b), + SPH_C32(0xb147bb0b) }, + { SPH_C32(0xc2a80000), SPH_C32(0x4d0a0000), SPH_C32(0x421e0000), + SPH_C32(0xd4600253), SPH_C32(0x63c4f228), SPH_C32(0xe62fb12f), + SPH_C32(0x5b73a808), SPH_C32(0x9e01f30e), SPH_C32(0x653a0000), + SPH_C32(0xa72e0000), SPH_C32(0xa4da0000), SPH_C32(0x83750181), + SPH_C32(0x0a4aa3ae), SPH_C32(0x3daea4f2), SPH_C32(0xaa23780b), + SPH_C32(0x0f4ddc95) }, + { SPH_C32(0x9d440000), SPH_C32(0x64410000), SPH_C32(0xdbcc0000), + SPH_C32(0x9ab00241), SPH_C32(0x7d17bd5b), SPH_C32(0x5c88b9e6), + SPH_C32(0x0c67a3d7), SPH_C32(0xaeaf4ff9), SPH_C32(0x3a920000), + SPH_C32(0xf12d0000), SPH_C32(0xe7740000), SPH_C32(0xe7860192), + SPH_C32(0x2f342511), SPH_C32(0x2ebf30bc), SPH_C32(0xfe3dedb4), + SPH_C32(0x81e907fc) }, + { SPH_C32(0xc2ec0000), SPH_C32(0x32420000), SPH_C32(0x98620000), + SPH_C32(0xfe430252), SPH_C32(0x58693be4), SPH_C32(0x4f992da8), + SPH_C32(0x58793668), SPH_C32(0x200b9490), SPH_C32(0x3ad60000), + SPH_C32(0x8e650000), SPH_C32(0x3d080000), SPH_C32(0xcda50193), + SPH_C32(0x1499ecdd), SPH_C32(0x8709ac3b), SPH_C32(0xfd3773d4), + SPH_C32(0x3fe36062) }, + { SPH_C32(0x73930000), SPH_C32(0xcd0e0000), SPH_C32(0x93710000), + SPH_C32(0x9b0b03a0), SPH_C32(0xd2eb5ceb), SPH_C32(0xce52de36), + SPH_C32(0x4a5c1ec3), SPH_C32(0x30ba4203), SPH_C32(0x1e560000), + SPH_C32(0x8f240000), SPH_C32(0xd7430000), SPH_C32(0xca150120), + SPH_C32(0xaf3c2e4d), SPH_C32(0xf981adce), SPH_C32(0x8ed1dd68), + SPH_C32(0x76b8dbfb) }, + { SPH_C32(0x2c3b0000), SPH_C32(0x9b0d0000), SPH_C32(0xd0df0000), + SPH_C32(0xfff803b3), SPH_C32(0xf795da54), SPH_C32(0xdd434a78), + SPH_C32(0x1e428b7c), SPH_C32(0xbe1e996a), SPH_C32(0x1e120000), + SPH_C32(0xf06c0000), SPH_C32(0x0d3f0000), SPH_C32(0xe0360121), + SPH_C32(0x9491e781), SPH_C32(0x50373149), SPH_C32(0x8ddb4308), + SPH_C32(0xc8b2bc65) }, + { SPH_C32(0x73d70000), SPH_C32(0xb2460000), SPH_C32(0x490d0000), + SPH_C32(0xb12803a1), SPH_C32(0xe9469527), SPH_C32(0x67e442b1), + SPH_C32(0x495680a3), SPH_C32(0x8eb0259d), SPH_C32(0x41ba0000), + SPH_C32(0xa66f0000), SPH_C32(0x4e910000), SPH_C32(0x84c50132), + SPH_C32(0xb1ef613e), SPH_C32(0x4326a507), SPH_C32(0xd9c5d6b7), + SPH_C32(0x4616670c) }, + { SPH_C32(0x2c7f0000), SPH_C32(0xe4450000), SPH_C32(0x0aa30000), + SPH_C32(0xd5db03b2), SPH_C32(0xcc381398), SPH_C32(0x74f5d6ff), + SPH_C32(0x1d48151c), SPH_C32(0x0014fef4), SPH_C32(0x41fe0000), + SPH_C32(0xd9270000), SPH_C32(0x94ed0000), SPH_C32(0xaee60133), + SPH_C32(0x8a42a8f2), SPH_C32(0xea903980), SPH_C32(0xdacf48d7), + SPH_C32(0xf81c0092) } +}; + +static const sph_u32 T512_60[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x033d0000), SPH_C32(0x08b30000), SPH_C32(0xf33a0000), + SPH_C32(0x3ac20007), SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), + SPH_C32(0x0ea5cfe3), SPH_C32(0xe6da7ffe), SPH_C32(0xa8da0000), + SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), SPH_C32(0x07da0002), + SPH_C32(0x7d669583), SPH_C32(0x1f98708a), SPH_C32(0xbb668808), + SPH_C32(0xda878000) }, + { SPH_C32(0xa8da0000), SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), + SPH_C32(0x07da0002), SPH_C32(0x7d669583), SPH_C32(0x1f98708a), + SPH_C32(0xbb668808), SPH_C32(0xda878000), SPH_C32(0xabe70000), + SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), SPH_C32(0x3d180005), + SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), SPH_C32(0xb5c347eb), + SPH_C32(0x3c5dfffe) }, + { SPH_C32(0xabe70000), SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), + SPH_C32(0x3d180005), SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), + SPH_C32(0xb5c347eb), SPH_C32(0x3c5dfffe), SPH_C32(0x033d0000), + SPH_C32(0x08b30000), SPH_C32(0xf33a0000), SPH_C32(0x3ac20007), + SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), SPH_C32(0x0ea5cfe3), + SPH_C32(0xe6da7ffe) }, + { SPH_C32(0x01930000), SPH_C32(0xe7820000), SPH_C32(0xedfb0000), + SPH_C32(0xcf0c000b), SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), + SPH_C32(0x063661e1), SPH_C32(0x536f9e7b), SPH_C32(0x92280000), + SPH_C32(0xdc850000), SPH_C32(0x57fa0000), SPH_C32(0x56dc0003), + SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), SPH_C32(0x90cef752), + SPH_C32(0x7b1675d7) }, + { SPH_C32(0x02ae0000), SPH_C32(0xef310000), SPH_C32(0x1ec10000), + SPH_C32(0xf5ce000c), SPH_C32(0xdcf90708), SPH_C32(0xd7cdd231), + SPH_C32(0x0893ae02), SPH_C32(0xb5b5e185), SPH_C32(0x3af20000), + SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), SPH_C32(0x51060001), + SPH_C32(0xc78fb695), SPH_C32(0x4577d386), SPH_C32(0x2ba87f5a), + SPH_C32(0xa191f5d7) }, + { SPH_C32(0xa9490000), SPH_C32(0x713c0000), SPH_C32(0xb1e60000), + SPH_C32(0xc8d60009), SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), + SPH_C32(0xbd50e9e9), SPH_C32(0x89e81e7b), SPH_C32(0x39cf0000), + SPH_C32(0x42880000), SPH_C32(0xf8dd0000), SPH_C32(0x6bc40006), + SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), SPH_C32(0x250db0b9), + SPH_C32(0x474b8a29) }, + { SPH_C32(0xaa740000), SPH_C32(0x798f0000), SPH_C32(0x42dc0000), + SPH_C32(0xf214000e), SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), + SPH_C32(0xb3f5260a), SPH_C32(0x6f326185), SPH_C32(0x91150000), + SPH_C32(0xd4360000), SPH_C32(0xa4c00000), SPH_C32(0x6c1e0004), + SPH_C32(0xebc0a946), SPH_C32(0x3181c513), SPH_C32(0x9e6b38b1), + SPH_C32(0x9dcc0a29) }, + { SPH_C32(0x92280000), SPH_C32(0xdc850000), SPH_C32(0x57fa0000), + SPH_C32(0x56dc0003), SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), + SPH_C32(0x90cef752), SPH_C32(0x7b1675d7), SPH_C32(0x93bb0000), + SPH_C32(0x3b070000), SPH_C32(0xba010000), SPH_C32(0x99d00008), + SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), SPH_C32(0x96f896b3), + SPH_C32(0x2879ebac) }, + { SPH_C32(0x91150000), SPH_C32(0xd4360000), SPH_C32(0xa4c00000), + SPH_C32(0x6c1e0004), SPH_C32(0xebc0a946), SPH_C32(0x3181c513), + SPH_C32(0x9e6b38b1), SPH_C32(0x9dcc0a29), SPH_C32(0x3b610000), + SPH_C32(0xadb90000), SPH_C32(0xe61c0000), SPH_C32(0x9e0a000a), + SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), SPH_C32(0x2d9e1ebb), + SPH_C32(0xf2fe6bac) }, + { SPH_C32(0x3af20000), SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), + SPH_C32(0x51060001), SPH_C32(0xc78fb695), SPH_C32(0x4577d386), + SPH_C32(0x2ba87f5a), SPH_C32(0xa191f5d7), SPH_C32(0x385c0000), + SPH_C32(0xa50a0000), SPH_C32(0x15260000), SPH_C32(0xa4c8000d), + SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), SPH_C32(0x233bd158), + SPH_C32(0x14241452) }, + { SPH_C32(0x39cf0000), SPH_C32(0x42880000), SPH_C32(0xf8dd0000), + SPH_C32(0x6bc40006), SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), + SPH_C32(0x250db0b9), SPH_C32(0x474b8a29), SPH_C32(0x90860000), + SPH_C32(0x33b40000), SPH_C32(0x493b0000), SPH_C32(0xa312000f), + SPH_C32(0x6610241e), SPH_C32(0x8d22713d), SPH_C32(0x985d5950), + SPH_C32(0xcea39452) }, + { SPH_C32(0x93bb0000), SPH_C32(0x3b070000), SPH_C32(0xba010000), + SPH_C32(0x99d00008), SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), + SPH_C32(0x96f896b3), SPH_C32(0x2879ebac), SPH_C32(0x01930000), + SPH_C32(0xe7820000), SPH_C32(0xedfb0000), SPH_C32(0xcf0c000b), + SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), SPH_C32(0x063661e1), + SPH_C32(0x536f9e7b) }, + { SPH_C32(0x90860000), SPH_C32(0x33b40000), SPH_C32(0x493b0000), + SPH_C32(0xa312000f), SPH_C32(0x6610241e), SPH_C32(0x8d22713d), + SPH_C32(0x985d5950), SPH_C32(0xcea39452), SPH_C32(0xa9490000), + SPH_C32(0x713c0000), SPH_C32(0xb1e60000), SPH_C32(0xc8d60009), + SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), SPH_C32(0xbd50e9e9), + SPH_C32(0x89e81e7b) }, + { SPH_C32(0x3b610000), SPH_C32(0xadb90000), SPH_C32(0xe61c0000), + SPH_C32(0x9e0a000a), SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), + SPH_C32(0x2d9e1ebb), SPH_C32(0xf2fe6bac), SPH_C32(0xaa740000), + SPH_C32(0x798f0000), SPH_C32(0x42dc0000), SPH_C32(0xf214000e), + SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), SPH_C32(0xb3f5260a), + SPH_C32(0x6f326185) }, + { SPH_C32(0x385c0000), SPH_C32(0xa50a0000), SPH_C32(0x15260000), + SPH_C32(0xa4c8000d), SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), + SPH_C32(0x233bd158), SPH_C32(0x14241452), SPH_C32(0x02ae0000), + SPH_C32(0xef310000), SPH_C32(0x1ec10000), SPH_C32(0xf5ce000c), + SPH_C32(0xdcf90708), SPH_C32(0xd7cdd231), SPH_C32(0x0893ae02), + SPH_C32(0xb5b5e185) } +}; + +#define INPUT_BIG do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T512_0[acc >> 3][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + m8 = rp[8]; \ + m9 = rp[9]; \ + mA = rp[10]; \ + mB = rp[11]; \ + mC = rp[12]; \ + mD = rp[13]; \ + mE = rp[14]; \ + mF = rp[15]; \ + acc = (acc << 8) | buf[1]; \ + rp = &T512_5[(acc >> 6) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_10[(acc >> 1) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[2]; \ + rp = &T512_15[(acc >> 4) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[3]; \ + rp = &T512_20[(acc >> 7) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_25[(acc >> 2) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[4]; \ + rp = &T512_30[(acc >> 5) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_35[acc & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[5]; \ + rp = &T512_40[acc >> 3][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[6]; \ + rp = &T512_45[(acc >> 6) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_50[(acc >> 1) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[7]; \ + rp = &T512_55[(acc >> 4) & 0x1f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_60[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_BIG == 6 + +static const sph_u32 T512_0[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x145a3c00), SPH_C32(0xb9e90000), SPH_C32(0x61270000), + SPH_C32(0xf1610000), SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), + SPH_C32(0x47a96720), SPH_C32(0xe18e24c5), SPH_C32(0x23671400), + SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), SPH_C32(0xfb750000), + SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), SPH_C32(0x02c40a3f), + SPH_C32(0xdc24e61f) }, + { SPH_C32(0x23671400), SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), + SPH_C32(0xfb750000), SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), + SPH_C32(0x02c40a3f), SPH_C32(0xdc24e61f), SPH_C32(0x373d2800), + SPH_C32(0x71500000), SPH_C32(0x95e00000), SPH_C32(0x0a140000), + SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), SPH_C32(0x456d6d1f), + SPH_C32(0x3daac2da) }, + { SPH_C32(0x373d2800), SPH_C32(0x71500000), SPH_C32(0x95e00000), + SPH_C32(0x0a140000), SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), + SPH_C32(0x456d6d1f), SPH_C32(0x3daac2da), SPH_C32(0x145a3c00), + SPH_C32(0xb9e90000), SPH_C32(0x61270000), SPH_C32(0xf1610000), + SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), SPH_C32(0x47a96720), + SPH_C32(0xe18e24c5) }, + { SPH_C32(0x54285c00), SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), + SPH_C32(0xa1c50000), SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), + SPH_C32(0x6bb0419d), SPH_C32(0x551b3782), SPH_C32(0x9cbb1800), + SPH_C32(0xb0d30000), SPH_C32(0x92510000), SPH_C32(0xed930000), + SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), SPH_C32(0x430633da), + SPH_C32(0x78cace29) }, + { SPH_C32(0x40726000), SPH_C32(0x53040000), SPH_C32(0xa4f10000), + SPH_C32(0x50a40000), SPH_C32(0x7dc35a1c), SPH_C32(0x24ecf999), + SPH_C32(0x2c1926bd), SPH_C32(0xb4951347), SPH_C32(0xbfdc0c00), + SPH_C32(0x786a0000), SPH_C32(0x66960000), SPH_C32(0x16e60000), + SPH_C32(0x2af76720), SPH_C32(0x19b270bd), SPH_C32(0x41c239e5), + SPH_C32(0xa4ee2836) }, + { SPH_C32(0x774f4800), SPH_C32(0x22540000), SPH_C32(0x31110000), + SPH_C32(0x5ab00000), SPH_C32(0xc06f4315), SPH_C32(0x6c0361a8), + SPH_C32(0x69744ba2), SPH_C32(0x893fd19d), SPH_C32(0xab863000), + SPH_C32(0xc1830000), SPH_C32(0x07b10000), SPH_C32(0xe7870000), + SPH_C32(0xe4965a4c), SPH_C32(0xa9fb4dc5), SPH_C32(0x066b5ec5), + SPH_C32(0x45600cf3) }, + { SPH_C32(0x63157400), SPH_C32(0x9bbd0000), SPH_C32(0x50360000), + SPH_C32(0xabd10000), SPH_C32(0x0e0e7e79), SPH_C32(0xdc4a5cd0), + SPH_C32(0x2edd2c82), SPH_C32(0x68b1f558), SPH_C32(0x88e12400), + SPH_C32(0x093a0000), SPH_C32(0xf3760000), SPH_C32(0x1cf20000), + SPH_C32(0x975b7e29), SPH_C32(0x515de88c), SPH_C32(0x04af54fa), + SPH_C32(0x9944eaec) }, + { SPH_C32(0x9cbb1800), SPH_C32(0xb0d30000), SPH_C32(0x92510000), + SPH_C32(0xed930000), SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), + SPH_C32(0x430633da), SPH_C32(0x78cace29), SPH_C32(0xc8934400), + SPH_C32(0x5a3e0000), SPH_C32(0x57870000), SPH_C32(0x4c560000), + SPH_C32(0xea982435), SPH_C32(0x75b11115), SPH_C32(0x28b67247), + SPH_C32(0x2dd1f9ab) }, + { SPH_C32(0x88e12400), SPH_C32(0x093a0000), SPH_C32(0xf3760000), + SPH_C32(0x1cf20000), SPH_C32(0x975b7e29), SPH_C32(0x515de88c), + SPH_C32(0x04af54fa), SPH_C32(0x9944eaec), SPH_C32(0xebf45000), + SPH_C32(0x92870000), SPH_C32(0xa3400000), SPH_C32(0xb7230000), + SPH_C32(0x99550050), SPH_C32(0x8d17b45c), SPH_C32(0x2a727878), + SPH_C32(0xf1f51fb4) }, + { SPH_C32(0xbfdc0c00), SPH_C32(0x786a0000), SPH_C32(0x66960000), + SPH_C32(0x16e60000), SPH_C32(0x2af76720), SPH_C32(0x19b270bd), + SPH_C32(0x41c239e5), SPH_C32(0xa4ee2836), SPH_C32(0xffae6c00), + SPH_C32(0x2b6e0000), SPH_C32(0xc2670000), SPH_C32(0x46420000), + SPH_C32(0x57343d3c), SPH_C32(0x3d5e8924), SPH_C32(0x6ddb1f58), + SPH_C32(0x107b3b71) }, + { SPH_C32(0xab863000), SPH_C32(0xc1830000), SPH_C32(0x07b10000), + SPH_C32(0xe7870000), SPH_C32(0xe4965a4c), SPH_C32(0xa9fb4dc5), + SPH_C32(0x066b5ec5), SPH_C32(0x45600cf3), SPH_C32(0xdcc97800), + SPH_C32(0xe3d70000), SPH_C32(0x36a00000), SPH_C32(0xbd370000), + SPH_C32(0x24f91959), SPH_C32(0xc5f82c6d), SPH_C32(0x6f1f1567), + SPH_C32(0xcc5fdd6e) }, + { SPH_C32(0xc8934400), SPH_C32(0x5a3e0000), SPH_C32(0x57870000), + SPH_C32(0x4c560000), SPH_C32(0xea982435), SPH_C32(0x75b11115), + SPH_C32(0x28b67247), SPH_C32(0x2dd1f9ab), SPH_C32(0x54285c00), + SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), SPH_C32(0xa1c50000), + SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), SPH_C32(0x6bb0419d), + SPH_C32(0x551b3782) }, + { SPH_C32(0xdcc97800), SPH_C32(0xe3d70000), SPH_C32(0x36a00000), + SPH_C32(0xbd370000), SPH_C32(0x24f91959), SPH_C32(0xc5f82c6d), + SPH_C32(0x6f1f1567), SPH_C32(0xcc5fdd6e), SPH_C32(0x774f4800), + SPH_C32(0x22540000), SPH_C32(0x31110000), SPH_C32(0x5ab00000), + SPH_C32(0xc06f4315), SPH_C32(0x6c0361a8), SPH_C32(0x69744ba2), + SPH_C32(0x893fd19d) }, + { SPH_C32(0xebf45000), SPH_C32(0x92870000), SPH_C32(0xa3400000), + SPH_C32(0xb7230000), SPH_C32(0x99550050), SPH_C32(0x8d17b45c), + SPH_C32(0x2a727878), SPH_C32(0xf1f51fb4), SPH_C32(0x63157400), + SPH_C32(0x9bbd0000), SPH_C32(0x50360000), SPH_C32(0xabd10000), + SPH_C32(0x0e0e7e79), SPH_C32(0xdc4a5cd0), SPH_C32(0x2edd2c82), + SPH_C32(0x68b1f558) }, + { SPH_C32(0xffae6c00), SPH_C32(0x2b6e0000), SPH_C32(0xc2670000), + SPH_C32(0x46420000), SPH_C32(0x57343d3c), SPH_C32(0x3d5e8924), + SPH_C32(0x6ddb1f58), SPH_C32(0x107b3b71), SPH_C32(0x40726000), + SPH_C32(0x53040000), SPH_C32(0xa4f10000), SPH_C32(0x50a40000), + SPH_C32(0x7dc35a1c), SPH_C32(0x24ecf999), SPH_C32(0x2c1926bd), + SPH_C32(0xb4951347) }, + { SPH_C32(0x29449c00), SPH_C32(0x64e70000), SPH_C32(0xf24b0000), + SPH_C32(0xc2f30000), SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), + SPH_C32(0xf3e04259), SPH_C32(0x8d0d9ec4), SPH_C32(0x466d0c00), + SPH_C32(0x08620000), SPH_C32(0xdd5d0000), SPH_C32(0xbadd0000), + SPH_C32(0x6a927942), SPH_C32(0x441f2b93), SPH_C32(0x218ace6f), + SPH_C32(0xbf2c0be2) }, + { SPH_C32(0x3d1ea000), SPH_C32(0xdd0e0000), SPH_C32(0x936c0000), + SPH_C32(0x33920000), SPH_C32(0xc0bf73e3), SPH_C32(0xe68b0a3d), + SPH_C32(0xb4492579), SPH_C32(0x6c83ba01), SPH_C32(0x650a1800), + SPH_C32(0xc0db0000), SPH_C32(0x299a0000), SPH_C32(0x41a80000), + SPH_C32(0x195f5d27), SPH_C32(0xbcb98eda), SPH_C32(0x234ec450), + SPH_C32(0x6308edfd) }, + { SPH_C32(0x0a238800), SPH_C32(0xac5e0000), SPH_C32(0x068c0000), + SPH_C32(0x39860000), SPH_C32(0x7d136aea), SPH_C32(0xae64920c), + SPH_C32(0xf1244866), SPH_C32(0x512978db), SPH_C32(0x71502400), + SPH_C32(0x79320000), SPH_C32(0x48bd0000), SPH_C32(0xb0c90000), + SPH_C32(0xd73e604b), SPH_C32(0x0cf0b3a2), SPH_C32(0x64e7a370), + SPH_C32(0x8286c938) }, + { SPH_C32(0x1e79b400), SPH_C32(0x15b70000), SPH_C32(0x67ab0000), + SPH_C32(0xc8e70000), SPH_C32(0xb3725786), SPH_C32(0x1e2daf74), + SPH_C32(0xb68d2f46), SPH_C32(0xb0a75c1e), SPH_C32(0x52373000), + SPH_C32(0xb18b0000), SPH_C32(0xbc7a0000), SPH_C32(0x4bbc0000), + SPH_C32(0xa4f3442e), SPH_C32(0xf45616eb), SPH_C32(0x6623a94f), + SPH_C32(0x5ea22f27) }, + { SPH_C32(0x7d6cc000), SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), + SPH_C32(0x63360000), SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), + SPH_C32(0x985003c4), SPH_C32(0xd816a946), SPH_C32(0xdad61400), + SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), SPH_C32(0x574e0000), + SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), SPH_C32(0x628cfdb5), + SPH_C32(0xc7e6c5cb) }, + { SPH_C32(0x6936fc00), SPH_C32(0x37e30000), SPH_C32(0x56ba0000), + SPH_C32(0x92570000), SPH_C32(0x731d1493), SPH_C32(0x722ecedc), + SPH_C32(0xdff964e4), SPH_C32(0x39988d83), SPH_C32(0xf9b10000), + SPH_C32(0x70080000), SPH_C32(0xbbcb0000), SPH_C32(0xac3b0000), + SPH_C32(0x40651e62), SPH_C32(0x5dad5b2e), SPH_C32(0x6048f78a), + SPH_C32(0x1bc223d4) }, + { SPH_C32(0x5e0bd400), SPH_C32(0x46b30000), SPH_C32(0xc35a0000), + SPH_C32(0x98430000), SPH_C32(0xceb10d9a), SPH_C32(0x3ac156ed), + SPH_C32(0x9a9409fb), SPH_C32(0x04324f59), SPH_C32(0xedeb3c00), + SPH_C32(0xc9e10000), SPH_C32(0xdaec0000), SPH_C32(0x5d5a0000), + SPH_C32(0x8e04230e), SPH_C32(0xede46656), SPH_C32(0x27e190aa), + SPH_C32(0xfa4c0711) }, + { SPH_C32(0x4a51e800), SPH_C32(0xff5a0000), SPH_C32(0xa27d0000), + SPH_C32(0x69220000), SPH_C32(0x00d030f6), SPH_C32(0x8a886b95), + SPH_C32(0xdd3d6edb), SPH_C32(0xe5bc6b9c), SPH_C32(0xce8c2800), + SPH_C32(0x01580000), SPH_C32(0x2e2b0000), SPH_C32(0xa62f0000), + SPH_C32(0xfdc9076b), SPH_C32(0x1542c31f), SPH_C32(0x25259a95), + SPH_C32(0x2668e10e) }, + { SPH_C32(0xb5ff8400), SPH_C32(0xd4340000), SPH_C32(0x601a0000), + SPH_C32(0x2f600000), SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), + SPH_C32(0xb0e67183), SPH_C32(0xf5c750ed), SPH_C32(0x8efe4800), + SPH_C32(0x525c0000), SPH_C32(0x8ada0000), SPH_C32(0xf68b0000), + SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), SPH_C32(0x093cbc28), + SPH_C32(0x92fdf249) }, + { SPH_C32(0xa1a5b800), SPH_C32(0x6ddd0000), SPH_C32(0x013d0000), + SPH_C32(0xde010000), SPH_C32(0x998530a6), SPH_C32(0x079fdfc9), + SPH_C32(0xf74f16a3), SPH_C32(0x14497428), SPH_C32(0xad995c00), + SPH_C32(0x9ae50000), SPH_C32(0x7e1d0000), SPH_C32(0x0dfe0000), + SPH_C32(0xf3c77912), SPH_C32(0xc9089fcf), SPH_C32(0x0bf8b617), + SPH_C32(0x4ed91456) }, + { SPH_C32(0x96989000), SPH_C32(0x1c8d0000), SPH_C32(0x94dd0000), + SPH_C32(0xd4150000), SPH_C32(0x242929af), SPH_C32(0x4f7047f8), + SPH_C32(0xb2227bbc), SPH_C32(0x29e3b6f2), SPH_C32(0xb9c36000), + SPH_C32(0x230c0000), SPH_C32(0x1f3a0000), SPH_C32(0xfc9f0000), + SPH_C32(0x3da6447e), SPH_C32(0x7941a2b7), SPH_C32(0x4c51d137), + SPH_C32(0xaf573093) }, + { SPH_C32(0x82c2ac00), SPH_C32(0xa5640000), SPH_C32(0xf5fa0000), + SPH_C32(0x25740000), SPH_C32(0xea4814c3), SPH_C32(0xff397a80), + SPH_C32(0xf58b1c9c), SPH_C32(0xc86d9237), SPH_C32(0x9aa47400), + SPH_C32(0xebb50000), SPH_C32(0xebfd0000), SPH_C32(0x07ea0000), + SPH_C32(0x4e6b601b), SPH_C32(0x81e707fe), SPH_C32(0x4e95db08), + SPH_C32(0x7373d68c) }, + { SPH_C32(0xe1d7d800), SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), + SPH_C32(0x8ea50000), SPH_C32(0xe4466aba), SPH_C32(0x23732650), + SPH_C32(0xdb56301e), SPH_C32(0xa0dc676f), SPH_C32(0x12455000), + SPH_C32(0xe28f0000), SPH_C32(0x188b0000), SPH_C32(0x1b180000), + SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), SPH_C32(0x4a3a8ff2), + SPH_C32(0xea373c60) }, + { SPH_C32(0xf58de400), SPH_C32(0x87300000), SPH_C32(0xc4eb0000), + SPH_C32(0x7fc40000), SPH_C32(0x2a2757d6), SPH_C32(0x933a1b28), + SPH_C32(0x9cff573e), SPH_C32(0x415243aa), SPH_C32(0x31224400), + SPH_C32(0x2a360000), SPH_C32(0xec4c0000), SPH_C32(0xe06d0000), + SPH_C32(0xaafd3a57), SPH_C32(0x281c4a3b), SPH_C32(0x48fe85cd), + SPH_C32(0x3613da7f) }, + { SPH_C32(0xc2b0cc00), SPH_C32(0xf6600000), SPH_C32(0x510b0000), + SPH_C32(0x75d00000), SPH_C32(0x978b4edf), SPH_C32(0xdbd58319), + SPH_C32(0xd9923a21), SPH_C32(0x7cf88170), SPH_C32(0x25787800), + SPH_C32(0x93df0000), SPH_C32(0x8d6b0000), SPH_C32(0x110c0000), + SPH_C32(0x649c073b), SPH_C32(0x98557743), SPH_C32(0x0f57e2ed), + SPH_C32(0xd79dfeba) }, + { SPH_C32(0xd6eaf000), SPH_C32(0x4f890000), SPH_C32(0x302c0000), + SPH_C32(0x84b10000), SPH_C32(0x59ea73b3), SPH_C32(0x6b9cbe61), + SPH_C32(0x9e3b5d01), SPH_C32(0x9d76a5b5), SPH_C32(0x061f6c00), + SPH_C32(0x5b660000), SPH_C32(0x79ac0000), SPH_C32(0xea790000), + SPH_C32(0x1751235e), SPH_C32(0x60f3d20a), SPH_C32(0x0d93e8d2), + SPH_C32(0x0bb918a5) }, + { SPH_C32(0x466d0c00), SPH_C32(0x08620000), SPH_C32(0xdd5d0000), + SPH_C32(0xbadd0000), SPH_C32(0x6a927942), SPH_C32(0x441f2b93), + SPH_C32(0x218ace6f), SPH_C32(0xbf2c0be2), SPH_C32(0x6f299000), + SPH_C32(0x6c850000), SPH_C32(0x2f160000), SPH_C32(0x782e0000), + SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), SPH_C32(0xd26a8c36), + SPH_C32(0x32219526) }, + { SPH_C32(0x52373000), SPH_C32(0xb18b0000), SPH_C32(0xbc7a0000), + SPH_C32(0x4bbc0000), SPH_C32(0xa4f3442e), SPH_C32(0xf45616eb), + SPH_C32(0x6623a94f), SPH_C32(0x5ea22f27), SPH_C32(0x4c4e8400), + SPH_C32(0xa43c0000), SPH_C32(0xdbd10000), SPH_C32(0x835b0000), + SPH_C32(0x178113a8), SPH_C32(0xea7bb99f), SPH_C32(0xd0ae8609), + SPH_C32(0xee057339) }, + { SPH_C32(0x650a1800), SPH_C32(0xc0db0000), SPH_C32(0x299a0000), + SPH_C32(0x41a80000), SPH_C32(0x195f5d27), SPH_C32(0xbcb98eda), + SPH_C32(0x234ec450), SPH_C32(0x6308edfd), SPH_C32(0x5814b800), + SPH_C32(0x1dd50000), SPH_C32(0xbaf60000), SPH_C32(0x723a0000), + SPH_C32(0xd9e02ec4), SPH_C32(0x5a3284e7), SPH_C32(0x9707e129), + SPH_C32(0x0f8b57fc) }, + { SPH_C32(0x71502400), SPH_C32(0x79320000), SPH_C32(0x48bd0000), + SPH_C32(0xb0c90000), SPH_C32(0xd73e604b), SPH_C32(0x0cf0b3a2), + SPH_C32(0x64e7a370), SPH_C32(0x8286c938), SPH_C32(0x7b73ac00), + SPH_C32(0xd56c0000), SPH_C32(0x4e310000), SPH_C32(0x894f0000), + SPH_C32(0xaa2d0aa1), SPH_C32(0xa29421ae), SPH_C32(0x95c3eb16), + SPH_C32(0xd3afb1e3) }, + { SPH_C32(0x12455000), SPH_C32(0xe28f0000), SPH_C32(0x188b0000), + SPH_C32(0x1b180000), SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), + SPH_C32(0x4a3a8ff2), SPH_C32(0xea373c60), SPH_C32(0xf3928800), + SPH_C32(0xdc560000), SPH_C32(0xbd470000), SPH_C32(0x95bd0000), + SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), SPH_C32(0x916cbfec), + SPH_C32(0x4aeb5b0f) }, + { SPH_C32(0x061f6c00), SPH_C32(0x5b660000), SPH_C32(0x79ac0000), + SPH_C32(0xea790000), SPH_C32(0x1751235e), SPH_C32(0x60f3d20a), + SPH_C32(0x0d93e8d2), SPH_C32(0x0bb918a5), SPH_C32(0xd0f59c00), + SPH_C32(0x14ef0000), SPH_C32(0x49800000), SPH_C32(0x6ec80000), + SPH_C32(0x4ebb50ed), SPH_C32(0x0b6f6c6b), SPH_C32(0x93a8b5d3), + SPH_C32(0x96cfbd10) }, + { SPH_C32(0x31224400), SPH_C32(0x2a360000), SPH_C32(0xec4c0000), + SPH_C32(0xe06d0000), SPH_C32(0xaafd3a57), SPH_C32(0x281c4a3b), + SPH_C32(0x48fe85cd), SPH_C32(0x3613da7f), SPH_C32(0xc4afa000), + SPH_C32(0xad060000), SPH_C32(0x28a70000), SPH_C32(0x9fa90000), + SPH_C32(0x80da6d81), SPH_C32(0xbb265113), SPH_C32(0xd401d2f3), + SPH_C32(0x774199d5) }, + { SPH_C32(0x25787800), SPH_C32(0x93df0000), SPH_C32(0x8d6b0000), + SPH_C32(0x110c0000), SPH_C32(0x649c073b), SPH_C32(0x98557743), + SPH_C32(0x0f57e2ed), SPH_C32(0xd79dfeba), SPH_C32(0xe7c8b400), + SPH_C32(0x65bf0000), SPH_C32(0xdc600000), SPH_C32(0x64dc0000), + SPH_C32(0xf31749e4), SPH_C32(0x4380f45a), SPH_C32(0xd6c5d8cc), + SPH_C32(0xab657fca) }, + { SPH_C32(0xdad61400), SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), + SPH_C32(0x574e0000), SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), + SPH_C32(0x628cfdb5), SPH_C32(0xc7e6c5cb), SPH_C32(0xa7bad400), + SPH_C32(0x36bb0000), SPH_C32(0x78910000), SPH_C32(0x34780000), + SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), SPH_C32(0xfadcfe71), + SPH_C32(0x1ff06c8d) }, + { SPH_C32(0xce8c2800), SPH_C32(0x01580000), SPH_C32(0x2e2b0000), + SPH_C32(0xa62f0000), SPH_C32(0xfdc9076b), SPH_C32(0x1542c31f), + SPH_C32(0x25259a95), SPH_C32(0x2668e10e), SPH_C32(0x84ddc000), + SPH_C32(0xfe020000), SPH_C32(0x8c560000), SPH_C32(0xcf0d0000), + SPH_C32(0xfd19379d), SPH_C32(0x9fcaa88a), SPH_C32(0xf818f44e), + SPH_C32(0xc3d48a92) }, + { SPH_C32(0xf9b10000), SPH_C32(0x70080000), SPH_C32(0xbbcb0000), + SPH_C32(0xac3b0000), SPH_C32(0x40651e62), SPH_C32(0x5dad5b2e), + SPH_C32(0x6048f78a), SPH_C32(0x1bc223d4), SPH_C32(0x9087fc00), + SPH_C32(0x47eb0000), SPH_C32(0xed710000), SPH_C32(0x3e6c0000), + SPH_C32(0x33780af1), SPH_C32(0x2f8395f2), SPH_C32(0xbfb1936e), + SPH_C32(0x225aae57) }, + { SPH_C32(0xedeb3c00), SPH_C32(0xc9e10000), SPH_C32(0xdaec0000), + SPH_C32(0x5d5a0000), SPH_C32(0x8e04230e), SPH_C32(0xede46656), + SPH_C32(0x27e190aa), SPH_C32(0xfa4c0711), SPH_C32(0xb3e0e800), + SPH_C32(0x8f520000), SPH_C32(0x19b60000), SPH_C32(0xc5190000), + SPH_C32(0x40b52e94), SPH_C32(0xd72530bb), SPH_C32(0xbd759951), + SPH_C32(0xfe7e4848) }, + { SPH_C32(0x8efe4800), SPH_C32(0x525c0000), SPH_C32(0x8ada0000), + SPH_C32(0xf68b0000), SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), + SPH_C32(0x093cbc28), SPH_C32(0x92fdf249), SPH_C32(0x3b01cc00), + SPH_C32(0x86680000), SPH_C32(0xeac00000), SPH_C32(0xd9eb0000), + SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), SPH_C32(0xb9dacdab), + SPH_C32(0x673aa2a4) }, + { SPH_C32(0x9aa47400), SPH_C32(0xebb50000), SPH_C32(0xebfd0000), + SPH_C32(0x07ea0000), SPH_C32(0x4e6b601b), SPH_C32(0x81e707fe), + SPH_C32(0x4e95db08), SPH_C32(0x7373d68c), SPH_C32(0x1866d800), + SPH_C32(0x4ed10000), SPH_C32(0x1e070000), SPH_C32(0x229e0000), + SPH_C32(0xa42374d8), SPH_C32(0x7ede7d7e), SPH_C32(0xbb1ec794), + SPH_C32(0xbb1e44bb) }, + { SPH_C32(0xad995c00), SPH_C32(0x9ae50000), SPH_C32(0x7e1d0000), + SPH_C32(0x0dfe0000), SPH_C32(0xf3c77912), SPH_C32(0xc9089fcf), + SPH_C32(0x0bf8b617), SPH_C32(0x4ed91456), SPH_C32(0x0c3ce400), + SPH_C32(0xf7380000), SPH_C32(0x7f200000), SPH_C32(0xd3ff0000), + SPH_C32(0x6a4249b4), SPH_C32(0xce974006), SPH_C32(0xfcb7a0b4), + SPH_C32(0x5a90607e) }, + { SPH_C32(0xb9c36000), SPH_C32(0x230c0000), SPH_C32(0x1f3a0000), + SPH_C32(0xfc9f0000), SPH_C32(0x3da6447e), SPH_C32(0x7941a2b7), + SPH_C32(0x4c51d137), SPH_C32(0xaf573093), SPH_C32(0x2f5bf000), + SPH_C32(0x3f810000), SPH_C32(0x8be70000), SPH_C32(0x288a0000), + SPH_C32(0x198f6dd1), SPH_C32(0x3631e54f), SPH_C32(0xfe73aa8b), + SPH_C32(0x86b48661) }, + { SPH_C32(0x6f299000), SPH_C32(0x6c850000), SPH_C32(0x2f160000), + SPH_C32(0x782e0000), SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), + SPH_C32(0xd26a8c36), SPH_C32(0x32219526), SPH_C32(0x29449c00), + SPH_C32(0x64e70000), SPH_C32(0xf24b0000), SPH_C32(0xc2f30000), + SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), SPH_C32(0xf3e04259), + SPH_C32(0x8d0d9ec4) }, + { SPH_C32(0x7b73ac00), SPH_C32(0xd56c0000), SPH_C32(0x4e310000), + SPH_C32(0x894f0000), SPH_C32(0xaa2d0aa1), SPH_C32(0xa29421ae), + SPH_C32(0x95c3eb16), SPH_C32(0xd3afb1e3), SPH_C32(0x0a238800), + SPH_C32(0xac5e0000), SPH_C32(0x068c0000), SPH_C32(0x39860000), + SPH_C32(0x7d136aea), SPH_C32(0xae64920c), SPH_C32(0xf1244866), + SPH_C32(0x512978db) }, + { SPH_C32(0x4c4e8400), SPH_C32(0xa43c0000), SPH_C32(0xdbd10000), + SPH_C32(0x835b0000), SPH_C32(0x178113a8), SPH_C32(0xea7bb99f), + SPH_C32(0xd0ae8609), SPH_C32(0xee057339), SPH_C32(0x1e79b400), + SPH_C32(0x15b70000), SPH_C32(0x67ab0000), SPH_C32(0xc8e70000), + SPH_C32(0xb3725786), SPH_C32(0x1e2daf74), SPH_C32(0xb68d2f46), + SPH_C32(0xb0a75c1e) }, + { SPH_C32(0x5814b800), SPH_C32(0x1dd50000), SPH_C32(0xbaf60000), + SPH_C32(0x723a0000), SPH_C32(0xd9e02ec4), SPH_C32(0x5a3284e7), + SPH_C32(0x9707e129), SPH_C32(0x0f8b57fc), SPH_C32(0x3d1ea000), + SPH_C32(0xdd0e0000), SPH_C32(0x936c0000), SPH_C32(0x33920000), + SPH_C32(0xc0bf73e3), SPH_C32(0xe68b0a3d), SPH_C32(0xb4492579), + SPH_C32(0x6c83ba01) }, + { SPH_C32(0x3b01cc00), SPH_C32(0x86680000), SPH_C32(0xeac00000), + SPH_C32(0xd9eb0000), SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), + SPH_C32(0xb9dacdab), SPH_C32(0x673aa2a4), SPH_C32(0xb5ff8400), + SPH_C32(0xd4340000), SPH_C32(0x601a0000), SPH_C32(0x2f600000), + SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), SPH_C32(0xb0e67183), + SPH_C32(0xf5c750ed) }, + { SPH_C32(0x2f5bf000), SPH_C32(0x3f810000), SPH_C32(0x8be70000), + SPH_C32(0x288a0000), SPH_C32(0x198f6dd1), SPH_C32(0x3631e54f), + SPH_C32(0xfe73aa8b), SPH_C32(0x86b48661), SPH_C32(0x96989000), + SPH_C32(0x1c8d0000), SPH_C32(0x94dd0000), SPH_C32(0xd4150000), + SPH_C32(0x242929af), SPH_C32(0x4f7047f8), SPH_C32(0xb2227bbc), + SPH_C32(0x29e3b6f2) }, + { SPH_C32(0x1866d800), SPH_C32(0x4ed10000), SPH_C32(0x1e070000), + SPH_C32(0x229e0000), SPH_C32(0xa42374d8), SPH_C32(0x7ede7d7e), + SPH_C32(0xbb1ec794), SPH_C32(0xbb1e44bb), SPH_C32(0x82c2ac00), + SPH_C32(0xa5640000), SPH_C32(0xf5fa0000), SPH_C32(0x25740000), + SPH_C32(0xea4814c3), SPH_C32(0xff397a80), SPH_C32(0xf58b1c9c), + SPH_C32(0xc86d9237) }, + { SPH_C32(0x0c3ce400), SPH_C32(0xf7380000), SPH_C32(0x7f200000), + SPH_C32(0xd3ff0000), SPH_C32(0x6a4249b4), SPH_C32(0xce974006), + SPH_C32(0xfcb7a0b4), SPH_C32(0x5a90607e), SPH_C32(0xa1a5b800), + SPH_C32(0x6ddd0000), SPH_C32(0x013d0000), SPH_C32(0xde010000), + SPH_C32(0x998530a6), SPH_C32(0x079fdfc9), SPH_C32(0xf74f16a3), + SPH_C32(0x14497428) }, + { SPH_C32(0xf3928800), SPH_C32(0xdc560000), SPH_C32(0xbd470000), + SPH_C32(0x95bd0000), SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), + SPH_C32(0x916cbfec), SPH_C32(0x4aeb5b0f), SPH_C32(0xe1d7d800), + SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), SPH_C32(0x8ea50000), + SPH_C32(0xe4466aba), SPH_C32(0x23732650), SPH_C32(0xdb56301e), + SPH_C32(0xa0dc676f) }, + { SPH_C32(0xe7c8b400), SPH_C32(0x65bf0000), SPH_C32(0xdc600000), + SPH_C32(0x64dc0000), SPH_C32(0xf31749e4), SPH_C32(0x4380f45a), + SPH_C32(0xd6c5d8cc), SPH_C32(0xab657fca), SPH_C32(0xc2b0cc00), + SPH_C32(0xf6600000), SPH_C32(0x510b0000), SPH_C32(0x75d00000), + SPH_C32(0x978b4edf), SPH_C32(0xdbd58319), SPH_C32(0xd9923a21), + SPH_C32(0x7cf88170) }, + { SPH_C32(0xd0f59c00), SPH_C32(0x14ef0000), SPH_C32(0x49800000), + SPH_C32(0x6ec80000), SPH_C32(0x4ebb50ed), SPH_C32(0x0b6f6c6b), + SPH_C32(0x93a8b5d3), SPH_C32(0x96cfbd10), SPH_C32(0xd6eaf000), + SPH_C32(0x4f890000), SPH_C32(0x302c0000), SPH_C32(0x84b10000), + SPH_C32(0x59ea73b3), SPH_C32(0x6b9cbe61), SPH_C32(0x9e3b5d01), + SPH_C32(0x9d76a5b5) }, + { SPH_C32(0xc4afa000), SPH_C32(0xad060000), SPH_C32(0x28a70000), + SPH_C32(0x9fa90000), SPH_C32(0x80da6d81), SPH_C32(0xbb265113), + SPH_C32(0xd401d2f3), SPH_C32(0x774199d5), SPH_C32(0xf58de400), + SPH_C32(0x87300000), SPH_C32(0xc4eb0000), SPH_C32(0x7fc40000), + SPH_C32(0x2a2757d6), SPH_C32(0x933a1b28), SPH_C32(0x9cff573e), + SPH_C32(0x415243aa) }, + { SPH_C32(0xa7bad400), SPH_C32(0x36bb0000), SPH_C32(0x78910000), + SPH_C32(0x34780000), SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), + SPH_C32(0xfadcfe71), SPH_C32(0x1ff06c8d), SPH_C32(0x7d6cc000), + SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), SPH_C32(0x63360000), + SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), SPH_C32(0x985003c4), + SPH_C32(0xd816a946) }, + { SPH_C32(0xb3e0e800), SPH_C32(0x8f520000), SPH_C32(0x19b60000), + SPH_C32(0xc5190000), SPH_C32(0x40b52e94), SPH_C32(0xd72530bb), + SPH_C32(0xbd759951), SPH_C32(0xfe7e4848), SPH_C32(0x5e0bd400), + SPH_C32(0x46b30000), SPH_C32(0xc35a0000), SPH_C32(0x98430000), + SPH_C32(0xceb10d9a), SPH_C32(0x3ac156ed), SPH_C32(0x9a9409fb), + SPH_C32(0x04324f59) }, + { SPH_C32(0x84ddc000), SPH_C32(0xfe020000), SPH_C32(0x8c560000), + SPH_C32(0xcf0d0000), SPH_C32(0xfd19379d), SPH_C32(0x9fcaa88a), + SPH_C32(0xf818f44e), SPH_C32(0xc3d48a92), SPH_C32(0x4a51e800), + SPH_C32(0xff5a0000), SPH_C32(0xa27d0000), SPH_C32(0x69220000), + SPH_C32(0x00d030f6), SPH_C32(0x8a886b95), SPH_C32(0xdd3d6edb), + SPH_C32(0xe5bc6b9c) }, + { SPH_C32(0x9087fc00), SPH_C32(0x47eb0000), SPH_C32(0xed710000), + SPH_C32(0x3e6c0000), SPH_C32(0x33780af1), SPH_C32(0x2f8395f2), + SPH_C32(0xbfb1936e), SPH_C32(0x225aae57), SPH_C32(0x6936fc00), + SPH_C32(0x37e30000), SPH_C32(0x56ba0000), SPH_C32(0x92570000), + SPH_C32(0x731d1493), SPH_C32(0x722ecedc), SPH_C32(0xdff964e4), + SPH_C32(0x39988d83) } +}; + +static const sph_u32 T512_6[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x774400f0), SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), + SPH_C32(0x34140000), SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), + SPH_C32(0x0bc3cd1e), SPH_C32(0xcf3775cb), SPH_C32(0xf46c0050), + SPH_C32(0x96180000), SPH_C32(0x14a50000), SPH_C32(0x031f0000), + SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), SPH_C32(0x9ca470d2), + SPH_C32(0x8a341574) }, + { SPH_C32(0xf46c0050), SPH_C32(0x96180000), SPH_C32(0x14a50000), + SPH_C32(0x031f0000), SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), + SPH_C32(0x9ca470d2), SPH_C32(0x8a341574), SPH_C32(0x832800a0), + SPH_C32(0x67420000), SPH_C32(0xe1170000), SPH_C32(0x370b0000), + SPH_C32(0xcba30034), SPH_C32(0x3c34923c), SPH_C32(0x9767bdcc), + SPH_C32(0x450360bf) }, + { SPH_C32(0x832800a0), SPH_C32(0x67420000), SPH_C32(0xe1170000), + SPH_C32(0x370b0000), SPH_C32(0xcba30034), SPH_C32(0x3c34923c), + SPH_C32(0x9767bdcc), SPH_C32(0x450360bf), SPH_C32(0x774400f0), + SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), SPH_C32(0x34140000), + SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), SPH_C32(0x0bc3cd1e), + SPH_C32(0xcf3775cb) }, + { SPH_C32(0xe8870170), SPH_C32(0x9d720000), SPH_C32(0x12db0000), + SPH_C32(0xd4220000), SPH_C32(0xf2886b27), SPH_C32(0xa921e543), + SPH_C32(0x4ef8b518), SPH_C32(0x618813b1), SPH_C32(0xb4370060), + SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), SPH_C32(0x5cae0000), + SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), SPH_C32(0x1b365f3d), + SPH_C32(0xf3d45758) }, + { SPH_C32(0x9fc30180), SPH_C32(0x6c280000), SPH_C32(0xe7690000), + SPH_C32(0xe0360000), SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), + SPH_C32(0x453b7806), SPH_C32(0xaebf667a), SPH_C32(0x405b0030), + SPH_C32(0x9a540000), SPH_C32(0x42670000), SPH_C32(0x5fb10000), + SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), SPH_C32(0x87922fef), + SPH_C32(0x79e0422c) }, + { SPH_C32(0x1ceb0120), SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), + SPH_C32(0xd73d0000), SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), + SPH_C32(0xd25cc5ca), SPH_C32(0xebbc06c5), SPH_C32(0x371f00c0), + SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), SPH_C32(0x6ba50000), + SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), SPH_C32(0x8c51e2f1), + SPH_C32(0xb6d737e7) }, + { SPH_C32(0x6baf01d0), SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), + SPH_C32(0xe3290000), SPH_C32(0x392b6b13), SPH_C32(0x9515777f), + SPH_C32(0xd99f08d4), SPH_C32(0x248b730e), SPH_C32(0xc3730090), + SPH_C32(0xfd160000), SPH_C32(0xa3700000), SPH_C32(0x68ba0000), + SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), SPH_C32(0x10f59223), + SPH_C32(0x3ce32293) }, + { SPH_C32(0xb4370060), SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), + SPH_C32(0x5cae0000), SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), + SPH_C32(0x1b365f3d), SPH_C32(0xf3d45758), SPH_C32(0x5cb00110), + SPH_C32(0x913e0000), SPH_C32(0x44190000), SPH_C32(0x888c0000), + SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), SPH_C32(0x55ceea25), + SPH_C32(0x925c44e9) }, + { SPH_C32(0xc3730090), SPH_C32(0xfd160000), SPH_C32(0xa3700000), + SPH_C32(0x68ba0000), SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), + SPH_C32(0x10f59223), SPH_C32(0x3ce32293), SPH_C32(0xa8dc0140), + SPH_C32(0x07260000), SPH_C32(0x50bc0000), SPH_C32(0x8b930000), + SPH_C32(0x24480aa0), SPH_C32(0xf4a0637f), SPH_C32(0xc96a9af7), + SPH_C32(0x1868519d) }, + { SPH_C32(0x405b0030), SPH_C32(0x9a540000), SPH_C32(0x42670000), + SPH_C32(0x5fb10000), SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), + SPH_C32(0x87922fef), SPH_C32(0x79e0422c), SPH_C32(0xdf9801b0), + SPH_C32(0xf67c0000), SPH_C32(0xa50e0000), SPH_C32(0xbf870000), + SPH_C32(0xad7f742c), SPH_C32(0xae2b8f5a), SPH_C32(0xc2a957e9), + SPH_C32(0xd75f2456) }, + { SPH_C32(0x371f00c0), SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), + SPH_C32(0x6ba50000), SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), + SPH_C32(0x8c51e2f1), SPH_C32(0xb6d737e7), SPH_C32(0x2bf401e0), + SPH_C32(0x60640000), SPH_C32(0xb1ab0000), SPH_C32(0xbc980000), + SPH_C32(0xefeb0a94), SPH_C32(0xc894f143), SPH_C32(0x5e0d273b), + SPH_C32(0x5d6b3122) }, + { SPH_C32(0x5cb00110), SPH_C32(0x913e0000), SPH_C32(0x44190000), + SPH_C32(0x888c0000), SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), + SPH_C32(0x55ceea25), SPH_C32(0x925c44e9), SPH_C32(0xe8870170), + SPH_C32(0x9d720000), SPH_C32(0x12db0000), SPH_C32(0xd4220000), + SPH_C32(0xf2886b27), SPH_C32(0xa921e543), SPH_C32(0x4ef8b518), + SPH_C32(0x618813b1) }, + { SPH_C32(0x2bf401e0), SPH_C32(0x60640000), SPH_C32(0xb1ab0000), + SPH_C32(0xbc980000), SPH_C32(0xefeb0a94), SPH_C32(0xc894f143), + SPH_C32(0x5e0d273b), SPH_C32(0x5d6b3122), SPH_C32(0x1ceb0120), + SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), SPH_C32(0xd73d0000), + SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), SPH_C32(0xd25cc5ca), + SPH_C32(0xebbc06c5) }, + { SPH_C32(0xa8dc0140), SPH_C32(0x07260000), SPH_C32(0x50bc0000), + SPH_C32(0x8b930000), SPH_C32(0x24480aa0), SPH_C32(0xf4a0637f), + SPH_C32(0xc96a9af7), SPH_C32(0x1868519d), SPH_C32(0x6baf01d0), + SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), SPH_C32(0xe3290000), + SPH_C32(0x392b6b13), SPH_C32(0x9515777f), SPH_C32(0xd99f08d4), + SPH_C32(0x248b730e) }, + { SPH_C32(0xdf9801b0), SPH_C32(0xf67c0000), SPH_C32(0xa50e0000), + SPH_C32(0xbf870000), SPH_C32(0xad7f742c), SPH_C32(0xae2b8f5a), + SPH_C32(0xc2a957e9), SPH_C32(0xd75f2456), SPH_C32(0x9fc30180), + SPH_C32(0x6c280000), SPH_C32(0xe7690000), SPH_C32(0xe0360000), + SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), SPH_C32(0x453b7806), + SPH_C32(0xaebf667a) }, + { SPH_C32(0xef0b0270), SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), + SPH_C32(0x69490000), SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), + SPH_C32(0x66140a51), SPH_C32(0x924f5d0a), SPH_C32(0xc96b0030), + SPH_C32(0xe7250000), SPH_C32(0x2f840000), SPH_C32(0x264f0000), + SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), SPH_C32(0x509f6984), + SPH_C32(0x9e69af68) }, + { SPH_C32(0x984f0280), SPH_C32(0xcba70000), SPH_C32(0xa81c0000), + SPH_C32(0x5d5d0000), SPH_C32(0x1238428a), SPH_C32(0x1e8e59dc), + SPH_C32(0x6dd7c74f), SPH_C32(0x5d7828c1), SPH_C32(0x3d070060), + SPH_C32(0x713d0000), SPH_C32(0x3b210000), SPH_C32(0x25500000), + SPH_C32(0x4afd2541), SPH_C32(0x0b438f2e), SPH_C32(0xcc3b1956), + SPH_C32(0x145dba1c) }, + { SPH_C32(0x1b670220), SPH_C32(0xace50000), SPH_C32(0x490b0000), + SPH_C32(0x6a560000), SPH_C32(0xd99b42be), SPH_C32(0x22bacbe0), + SPH_C32(0xfab07a83), SPH_C32(0x187b487e), SPH_C32(0x4a430090), + SPH_C32(0x80670000), SPH_C32(0xce930000), SPH_C32(0x11440000), + SPH_C32(0xc3ca5bcd), SPH_C32(0x51c8630b), SPH_C32(0xc7f8d448), + SPH_C32(0xdb6acfd7) }, + { SPH_C32(0x6c2302d0), SPH_C32(0x5dbf0000), SPH_C32(0xbcb90000), + SPH_C32(0x5e420000), SPH_C32(0x50ac3c32), SPH_C32(0x783127c5), + SPH_C32(0xf173b79d), SPH_C32(0xd74c3db5), SPH_C32(0xbe2f00c0), + SPH_C32(0x167f0000), SPH_C32(0xda360000), SPH_C32(0x125b0000), + SPH_C32(0x815e2575), SPH_C32(0x37771d12), SPH_C32(0x5b5ca49a), + SPH_C32(0x515edaa3) }, + { SPH_C32(0x078c0300), SPH_C32(0xa78f0000), SPH_C32(0x4f750000), + SPH_C32(0xbd6b0000), SPH_C32(0x69875721), SPH_C32(0xed2450ba), + SPH_C32(0x28ecbf49), SPH_C32(0xf3c74ebb), SPH_C32(0x7d5c0050), + SPH_C32(0xeb690000), SPH_C32(0x79460000), SPH_C32(0x7ae10000), + SPH_C32(0x9c3d44c6), SPH_C32(0x56c20912), SPH_C32(0x4ba936b9), + SPH_C32(0x6dbdf830) }, + { SPH_C32(0x70c803f0), SPH_C32(0x56d50000), SPH_C32(0xbac70000), + SPH_C32(0x897f0000), SPH_C32(0xe0b029ad), SPH_C32(0xb7afbc9f), + SPH_C32(0x232f7257), SPH_C32(0x3cf03b70), SPH_C32(0x89300000), + SPH_C32(0x7d710000), SPH_C32(0x6de30000), SPH_C32(0x79fe0000), + SPH_C32(0xdea93a7e), SPH_C32(0x307d770b), SPH_C32(0xd70d466b), + SPH_C32(0xe789ed44) }, + { SPH_C32(0xf3e00350), SPH_C32(0x31970000), SPH_C32(0x5bd00000), + SPH_C32(0xbe740000), SPH_C32(0x2b132999), SPH_C32(0x8b9b2ea3), + SPH_C32(0xb448cf9b), SPH_C32(0x79f35bcf), SPH_C32(0xfe7400f0), + SPH_C32(0x8c2b0000), SPH_C32(0x98510000), SPH_C32(0x4dea0000), + SPH_C32(0x579e44f2), SPH_C32(0x6af69b2e), SPH_C32(0xdcce8b75), + SPH_C32(0x28be988f) }, + { SPH_C32(0x84a403a0), SPH_C32(0xc0cd0000), SPH_C32(0xae620000), + SPH_C32(0x8a600000), SPH_C32(0xa2245715), SPH_C32(0xd110c286), + SPH_C32(0xbf8b0285), SPH_C32(0xb6c42e04), SPH_C32(0x0a1800a0), + SPH_C32(0x1a330000), SPH_C32(0x8cf40000), SPH_C32(0x4ef50000), + SPH_C32(0x150a3a4a), SPH_C32(0x0c49e537), SPH_C32(0x406afba7), + SPH_C32(0xa28a8dfb) }, + { SPH_C32(0x5b3c0210), SPH_C32(0x36b10000), SPH_C32(0x0b6c0000), + SPH_C32(0x35e70000), SPH_C32(0x0f5b2339), SPH_C32(0x7f3b4ddc), + SPH_C32(0x7d22556c), SPH_C32(0x619b0a52), SPH_C32(0x95db0120), + SPH_C32(0x761b0000), SPH_C32(0x6b9d0000), SPH_C32(0xaec30000), + SPH_C32(0x6eb52fe1), SPH_C32(0xffe3ec51), SPH_C32(0x055183a1), + SPH_C32(0x0c35eb81) }, + { SPH_C32(0x2c7802e0), SPH_C32(0xc7eb0000), SPH_C32(0xfede0000), + SPH_C32(0x01f30000), SPH_C32(0x866c5db5), SPH_C32(0x25b0a1f9), + SPH_C32(0x76e19872), SPH_C32(0xaeac7f99), SPH_C32(0x61b70170), + SPH_C32(0xe0030000), SPH_C32(0x7f380000), SPH_C32(0xaddc0000), + SPH_C32(0x2c215159), SPH_C32(0x995c9248), SPH_C32(0x99f5f373), + SPH_C32(0x8601fef5) }, + { SPH_C32(0xaf500240), SPH_C32(0xa0a90000), SPH_C32(0x1fc90000), + SPH_C32(0x36f80000), SPH_C32(0x4dcf5d81), SPH_C32(0x198433c5), + SPH_C32(0xe18625be), SPH_C32(0xebaf1f26), SPH_C32(0x16f30180), + SPH_C32(0x11590000), SPH_C32(0x8a8a0000), SPH_C32(0x99c80000), + SPH_C32(0xa5162fd5), SPH_C32(0xc3d77e6d), SPH_C32(0x92363e6d), + SPH_C32(0x49368b3e) }, + { SPH_C32(0xd81402b0), SPH_C32(0x51f30000), SPH_C32(0xea7b0000), + SPH_C32(0x02ec0000), SPH_C32(0xc4f8230d), SPH_C32(0x430fdfe0), + SPH_C32(0xea45e8a0), SPH_C32(0x24986aed), SPH_C32(0xe29f01d0), + SPH_C32(0x87410000), SPH_C32(0x9e2f0000), SPH_C32(0x9ad70000), + SPH_C32(0xe782516d), SPH_C32(0xa5680074), SPH_C32(0x0e924ebf), + SPH_C32(0xc3029e4a) }, + { SPH_C32(0xb3bb0360), SPH_C32(0xabc30000), SPH_C32(0x19b70000), + SPH_C32(0xe1c50000), SPH_C32(0xfdd3481e), SPH_C32(0xd61aa89f), + SPH_C32(0x33dae074), SPH_C32(0x001319e3), SPH_C32(0x21ec0140), + SPH_C32(0x7a570000), SPH_C32(0x3d5f0000), SPH_C32(0xf26d0000), + SPH_C32(0xfae130de), SPH_C32(0xc4dd1474), SPH_C32(0x1e67dc9c), + SPH_C32(0xffe1bcd9) }, + { SPH_C32(0xc4ff0390), SPH_C32(0x5a990000), SPH_C32(0xec050000), + SPH_C32(0xd5d10000), SPH_C32(0x74e43692), SPH_C32(0x8c9144ba), + SPH_C32(0x38192d6a), SPH_C32(0xcf246c28), SPH_C32(0xd5800110), + SPH_C32(0xec4f0000), SPH_C32(0x29fa0000), SPH_C32(0xf1720000), + SPH_C32(0xb8754e66), SPH_C32(0xa2626a6d), SPH_C32(0x82c3ac4e), + SPH_C32(0x75d5a9ad) }, + { SPH_C32(0x47d70330), SPH_C32(0x3ddb0000), SPH_C32(0x0d120000), + SPH_C32(0xe2da0000), SPH_C32(0xbf4736a6), SPH_C32(0xb0a5d686), + SPH_C32(0xaf7e90a6), SPH_C32(0x8a270c97), SPH_C32(0xa2c401e0), + SPH_C32(0x1d150000), SPH_C32(0xdc480000), SPH_C32(0xc5660000), + SPH_C32(0x314230ea), SPH_C32(0xf8e98648), SPH_C32(0x89006150), + SPH_C32(0xbae2dc66) }, + { SPH_C32(0x309303c0), SPH_C32(0xcc810000), SPH_C32(0xf8a00000), + SPH_C32(0xd6ce0000), SPH_C32(0x3670482a), SPH_C32(0xea2e3aa3), + SPH_C32(0xa4bd5db8), SPH_C32(0x4510795c), SPH_C32(0x56a801b0), + SPH_C32(0x8b0d0000), SPH_C32(0xc8ed0000), SPH_C32(0xc6790000), + SPH_C32(0x73d64e52), SPH_C32(0x9e56f851), SPH_C32(0x15a41182), + SPH_C32(0x30d6c912) }, + { SPH_C32(0xc96b0030), SPH_C32(0xe7250000), SPH_C32(0x2f840000), + SPH_C32(0x264f0000), SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), + SPH_C32(0x509f6984), SPH_C32(0x9e69af68), SPH_C32(0x26600240), + SPH_C32(0xddd80000), SPH_C32(0x722a0000), SPH_C32(0x4f060000), + SPH_C32(0x936667ff), SPH_C32(0x29f944ce), SPH_C32(0x368b63d5), + SPH_C32(0x0c26f262) }, + { SPH_C32(0xbe2f00c0), SPH_C32(0x167f0000), SPH_C32(0xda360000), + SPH_C32(0x125b0000), SPH_C32(0x815e2575), SPH_C32(0x37771d12), + SPH_C32(0x5b5ca49a), SPH_C32(0x515edaa3), SPH_C32(0xd20c0210), + SPH_C32(0x4bc00000), SPH_C32(0x668f0000), SPH_C32(0x4c190000), + SPH_C32(0xd1f21947), SPH_C32(0x4f463ad7), SPH_C32(0xaa2f1307), + SPH_C32(0x8612e716) }, + { SPH_C32(0x3d070060), SPH_C32(0x713d0000), SPH_C32(0x3b210000), + SPH_C32(0x25500000), SPH_C32(0x4afd2541), SPH_C32(0x0b438f2e), + SPH_C32(0xcc3b1956), SPH_C32(0x145dba1c), SPH_C32(0xa54802e0), + SPH_C32(0xba9a0000), SPH_C32(0x933d0000), SPH_C32(0x780d0000), + SPH_C32(0x58c567cb), SPH_C32(0x15cdd6f2), SPH_C32(0xa1ecde19), + SPH_C32(0x492592dd) }, + { SPH_C32(0x4a430090), SPH_C32(0x80670000), SPH_C32(0xce930000), + SPH_C32(0x11440000), SPH_C32(0xc3ca5bcd), SPH_C32(0x51c8630b), + SPH_C32(0xc7f8d448), SPH_C32(0xdb6acfd7), SPH_C32(0x512402b0), + SPH_C32(0x2c820000), SPH_C32(0x87980000), SPH_C32(0x7b120000), + SPH_C32(0x1a511973), SPH_C32(0x7372a8eb), SPH_C32(0x3d48aecb), + SPH_C32(0xc31187a9) }, + { SPH_C32(0x21ec0140), SPH_C32(0x7a570000), SPH_C32(0x3d5f0000), + SPH_C32(0xf26d0000), SPH_C32(0xfae130de), SPH_C32(0xc4dd1474), + SPH_C32(0x1e67dc9c), SPH_C32(0xffe1bcd9), SPH_C32(0x92570220), + SPH_C32(0xd1940000), SPH_C32(0x24e80000), SPH_C32(0x13a80000), + SPH_C32(0x073278c0), SPH_C32(0x12c7bceb), SPH_C32(0x2dbd3ce8), + SPH_C32(0xfff2a53a) }, + { SPH_C32(0x56a801b0), SPH_C32(0x8b0d0000), SPH_C32(0xc8ed0000), + SPH_C32(0xc6790000), SPH_C32(0x73d64e52), SPH_C32(0x9e56f851), + SPH_C32(0x15a41182), SPH_C32(0x30d6c912), SPH_C32(0x663b0270), + SPH_C32(0x478c0000), SPH_C32(0x304d0000), SPH_C32(0x10b70000), + SPH_C32(0x45a60678), SPH_C32(0x7478c2f2), SPH_C32(0xb1194c3a), + SPH_C32(0x75c6b04e) }, + { SPH_C32(0xd5800110), SPH_C32(0xec4f0000), SPH_C32(0x29fa0000), + SPH_C32(0xf1720000), SPH_C32(0xb8754e66), SPH_C32(0xa2626a6d), + SPH_C32(0x82c3ac4e), SPH_C32(0x75d5a9ad), SPH_C32(0x117f0280), + SPH_C32(0xb6d60000), SPH_C32(0xc5ff0000), SPH_C32(0x24a30000), + SPH_C32(0xcc9178f4), SPH_C32(0x2ef32ed7), SPH_C32(0xbada8124), + SPH_C32(0xbaf1c585) }, + { SPH_C32(0xa2c401e0), SPH_C32(0x1d150000), SPH_C32(0xdc480000), + SPH_C32(0xc5660000), SPH_C32(0x314230ea), SPH_C32(0xf8e98648), + SPH_C32(0x89006150), SPH_C32(0xbae2dc66), SPH_C32(0xe51302d0), + SPH_C32(0x20ce0000), SPH_C32(0xd15a0000), SPH_C32(0x27bc0000), + SPH_C32(0x8e05064c), SPH_C32(0x484c50ce), SPH_C32(0x267ef1f6), + SPH_C32(0x30c5d0f1) }, + { SPH_C32(0x7d5c0050), SPH_C32(0xeb690000), SPH_C32(0x79460000), + SPH_C32(0x7ae10000), SPH_C32(0x9c3d44c6), SPH_C32(0x56c20912), + SPH_C32(0x4ba936b9), SPH_C32(0x6dbdf830), SPH_C32(0x7ad00350), + SPH_C32(0x4ce60000), SPH_C32(0x36330000), SPH_C32(0xc78a0000), + SPH_C32(0xf5ba13e7), SPH_C32(0xbbe659a8), SPH_C32(0x634589f0), + SPH_C32(0x9e7ab68b) }, + { SPH_C32(0x0a1800a0), SPH_C32(0x1a330000), SPH_C32(0x8cf40000), + SPH_C32(0x4ef50000), SPH_C32(0x150a3a4a), SPH_C32(0x0c49e537), + SPH_C32(0x406afba7), SPH_C32(0xa28a8dfb), SPH_C32(0x8ebc0300), + SPH_C32(0xdafe0000), SPH_C32(0x22960000), SPH_C32(0xc4950000), + SPH_C32(0xb72e6d5f), SPH_C32(0xdd5927b1), SPH_C32(0xffe1f922), + SPH_C32(0x144ea3ff) }, + { SPH_C32(0x89300000), SPH_C32(0x7d710000), SPH_C32(0x6de30000), + SPH_C32(0x79fe0000), SPH_C32(0xdea93a7e), SPH_C32(0x307d770b), + SPH_C32(0xd70d466b), SPH_C32(0xe789ed44), SPH_C32(0xf9f803f0), + SPH_C32(0x2ba40000), SPH_C32(0xd7240000), SPH_C32(0xf0810000), + SPH_C32(0x3e1913d3), SPH_C32(0x87d2cb94), SPH_C32(0xf422343c), + SPH_C32(0xdb79d634) }, + { SPH_C32(0xfe7400f0), SPH_C32(0x8c2b0000), SPH_C32(0x98510000), + SPH_C32(0x4dea0000), SPH_C32(0x579e44f2), SPH_C32(0x6af69b2e), + SPH_C32(0xdcce8b75), SPH_C32(0x28be988f), SPH_C32(0x0d9403a0), + SPH_C32(0xbdbc0000), SPH_C32(0xc3810000), SPH_C32(0xf39e0000), + SPH_C32(0x7c8d6d6b), SPH_C32(0xe16db58d), SPH_C32(0x688644ee), + SPH_C32(0x514dc340) }, + { SPH_C32(0x95db0120), SPH_C32(0x761b0000), SPH_C32(0x6b9d0000), + SPH_C32(0xaec30000), SPH_C32(0x6eb52fe1), SPH_C32(0xffe3ec51), + SPH_C32(0x055183a1), SPH_C32(0x0c35eb81), SPH_C32(0xcee70330), + SPH_C32(0x40aa0000), SPH_C32(0x60f10000), SPH_C32(0x9b240000), + SPH_C32(0x61ee0cd8), SPH_C32(0x80d8a18d), SPH_C32(0x7873d6cd), + SPH_C32(0x6daee1d3) }, + { SPH_C32(0xe29f01d0), SPH_C32(0x87410000), SPH_C32(0x9e2f0000), + SPH_C32(0x9ad70000), SPH_C32(0xe782516d), SPH_C32(0xa5680074), + SPH_C32(0x0e924ebf), SPH_C32(0xc3029e4a), SPH_C32(0x3a8b0360), + SPH_C32(0xd6b20000), SPH_C32(0x74540000), SPH_C32(0x983b0000), + SPH_C32(0x237a7260), SPH_C32(0xe667df94), SPH_C32(0xe4d7a61f), + SPH_C32(0xe79af4a7) }, + { SPH_C32(0x61b70170), SPH_C32(0xe0030000), SPH_C32(0x7f380000), + SPH_C32(0xaddc0000), SPH_C32(0x2c215159), SPH_C32(0x995c9248), + SPH_C32(0x99f5f373), SPH_C32(0x8601fef5), SPH_C32(0x4dcf0390), + SPH_C32(0x27e80000), SPH_C32(0x81e60000), SPH_C32(0xac2f0000), + SPH_C32(0xaa4d0cec), SPH_C32(0xbcec33b1), SPH_C32(0xef146b01), + SPH_C32(0x28ad816c) }, + { SPH_C32(0x16f30180), SPH_C32(0x11590000), SPH_C32(0x8a8a0000), + SPH_C32(0x99c80000), SPH_C32(0xa5162fd5), SPH_C32(0xc3d77e6d), + SPH_C32(0x92363e6d), SPH_C32(0x49368b3e), SPH_C32(0xb9a303c0), + SPH_C32(0xb1f00000), SPH_C32(0x95430000), SPH_C32(0xaf300000), + SPH_C32(0xe8d97254), SPH_C32(0xda534da8), SPH_C32(0x73b01bd3), + SPH_C32(0xa2999418) }, + { SPH_C32(0x26600240), SPH_C32(0xddd80000), SPH_C32(0x722a0000), + SPH_C32(0x4f060000), SPH_C32(0x936667ff), SPH_C32(0x29f944ce), + SPH_C32(0x368b63d5), SPH_C32(0x0c26f262), SPH_C32(0xef0b0270), + SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), SPH_C32(0x69490000), + SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), SPH_C32(0x66140a51), + SPH_C32(0x924f5d0a) }, + { SPH_C32(0x512402b0), SPH_C32(0x2c820000), SPH_C32(0x87980000), + SPH_C32(0x7b120000), SPH_C32(0x1a511973), SPH_C32(0x7372a8eb), + SPH_C32(0x3d48aecb), SPH_C32(0xc31187a9), SPH_C32(0x1b670220), + SPH_C32(0xace50000), SPH_C32(0x490b0000), SPH_C32(0x6a560000), + SPH_C32(0xd99b42be), SPH_C32(0x22bacbe0), SPH_C32(0xfab07a83), + SPH_C32(0x187b487e) }, + { SPH_C32(0xd20c0210), SPH_C32(0x4bc00000), SPH_C32(0x668f0000), + SPH_C32(0x4c190000), SPH_C32(0xd1f21947), SPH_C32(0x4f463ad7), + SPH_C32(0xaa2f1307), SPH_C32(0x8612e716), SPH_C32(0x6c2302d0), + SPH_C32(0x5dbf0000), SPH_C32(0xbcb90000), SPH_C32(0x5e420000), + SPH_C32(0x50ac3c32), SPH_C32(0x783127c5), SPH_C32(0xf173b79d), + SPH_C32(0xd74c3db5) }, + { SPH_C32(0xa54802e0), SPH_C32(0xba9a0000), SPH_C32(0x933d0000), + SPH_C32(0x780d0000), SPH_C32(0x58c567cb), SPH_C32(0x15cdd6f2), + SPH_C32(0xa1ecde19), SPH_C32(0x492592dd), SPH_C32(0x984f0280), + SPH_C32(0xcba70000), SPH_C32(0xa81c0000), SPH_C32(0x5d5d0000), + SPH_C32(0x1238428a), SPH_C32(0x1e8e59dc), SPH_C32(0x6dd7c74f), + SPH_C32(0x5d7828c1) }, + { SPH_C32(0xcee70330), SPH_C32(0x40aa0000), SPH_C32(0x60f10000), + SPH_C32(0x9b240000), SPH_C32(0x61ee0cd8), SPH_C32(0x80d8a18d), + SPH_C32(0x7873d6cd), SPH_C32(0x6daee1d3), SPH_C32(0x5b3c0210), + SPH_C32(0x36b10000), SPH_C32(0x0b6c0000), SPH_C32(0x35e70000), + SPH_C32(0x0f5b2339), SPH_C32(0x7f3b4ddc), SPH_C32(0x7d22556c), + SPH_C32(0x619b0a52) }, + { SPH_C32(0xb9a303c0), SPH_C32(0xb1f00000), SPH_C32(0x95430000), + SPH_C32(0xaf300000), SPH_C32(0xe8d97254), SPH_C32(0xda534da8), + SPH_C32(0x73b01bd3), SPH_C32(0xa2999418), SPH_C32(0xaf500240), + SPH_C32(0xa0a90000), SPH_C32(0x1fc90000), SPH_C32(0x36f80000), + SPH_C32(0x4dcf5d81), SPH_C32(0x198433c5), SPH_C32(0xe18625be), + SPH_C32(0xebaf1f26) }, + { SPH_C32(0x3a8b0360), SPH_C32(0xd6b20000), SPH_C32(0x74540000), + SPH_C32(0x983b0000), SPH_C32(0x237a7260), SPH_C32(0xe667df94), + SPH_C32(0xe4d7a61f), SPH_C32(0xe79af4a7), SPH_C32(0xd81402b0), + SPH_C32(0x51f30000), SPH_C32(0xea7b0000), SPH_C32(0x02ec0000), + SPH_C32(0xc4f8230d), SPH_C32(0x430fdfe0), SPH_C32(0xea45e8a0), + SPH_C32(0x24986aed) }, + { SPH_C32(0x4dcf0390), SPH_C32(0x27e80000), SPH_C32(0x81e60000), + SPH_C32(0xac2f0000), SPH_C32(0xaa4d0cec), SPH_C32(0xbcec33b1), + SPH_C32(0xef146b01), SPH_C32(0x28ad816c), SPH_C32(0x2c7802e0), + SPH_C32(0xc7eb0000), SPH_C32(0xfede0000), SPH_C32(0x01f30000), + SPH_C32(0x866c5db5), SPH_C32(0x25b0a1f9), SPH_C32(0x76e19872), + SPH_C32(0xaeac7f99) }, + { SPH_C32(0x92570220), SPH_C32(0xd1940000), SPH_C32(0x24e80000), + SPH_C32(0x13a80000), SPH_C32(0x073278c0), SPH_C32(0x12c7bceb), + SPH_C32(0x2dbd3ce8), SPH_C32(0xfff2a53a), SPH_C32(0xb3bb0360), + SPH_C32(0xabc30000), SPH_C32(0x19b70000), SPH_C32(0xe1c50000), + SPH_C32(0xfdd3481e), SPH_C32(0xd61aa89f), SPH_C32(0x33dae074), + SPH_C32(0x001319e3) }, + { SPH_C32(0xe51302d0), SPH_C32(0x20ce0000), SPH_C32(0xd15a0000), + SPH_C32(0x27bc0000), SPH_C32(0x8e05064c), SPH_C32(0x484c50ce), + SPH_C32(0x267ef1f6), SPH_C32(0x30c5d0f1), SPH_C32(0x47d70330), + SPH_C32(0x3ddb0000), SPH_C32(0x0d120000), SPH_C32(0xe2da0000), + SPH_C32(0xbf4736a6), SPH_C32(0xb0a5d686), SPH_C32(0xaf7e90a6), + SPH_C32(0x8a270c97) }, + { SPH_C32(0x663b0270), SPH_C32(0x478c0000), SPH_C32(0x304d0000), + SPH_C32(0x10b70000), SPH_C32(0x45a60678), SPH_C32(0x7478c2f2), + SPH_C32(0xb1194c3a), SPH_C32(0x75c6b04e), SPH_C32(0x309303c0), + SPH_C32(0xcc810000), SPH_C32(0xf8a00000), SPH_C32(0xd6ce0000), + SPH_C32(0x3670482a), SPH_C32(0xea2e3aa3), SPH_C32(0xa4bd5db8), + SPH_C32(0x4510795c) }, + { SPH_C32(0x117f0280), SPH_C32(0xb6d60000), SPH_C32(0xc5ff0000), + SPH_C32(0x24a30000), SPH_C32(0xcc9178f4), SPH_C32(0x2ef32ed7), + SPH_C32(0xbada8124), SPH_C32(0xbaf1c585), SPH_C32(0xc4ff0390), + SPH_C32(0x5a990000), SPH_C32(0xec050000), SPH_C32(0xd5d10000), + SPH_C32(0x74e43692), SPH_C32(0x8c9144ba), SPH_C32(0x38192d6a), + SPH_C32(0xcf246c28) }, + { SPH_C32(0x7ad00350), SPH_C32(0x4ce60000), SPH_C32(0x36330000), + SPH_C32(0xc78a0000), SPH_C32(0xf5ba13e7), SPH_C32(0xbbe659a8), + SPH_C32(0x634589f0), SPH_C32(0x9e7ab68b), SPH_C32(0x078c0300), + SPH_C32(0xa78f0000), SPH_C32(0x4f750000), SPH_C32(0xbd6b0000), + SPH_C32(0x69875721), SPH_C32(0xed2450ba), SPH_C32(0x28ecbf49), + SPH_C32(0xf3c74ebb) }, + { SPH_C32(0x0d9403a0), SPH_C32(0xbdbc0000), SPH_C32(0xc3810000), + SPH_C32(0xf39e0000), SPH_C32(0x7c8d6d6b), SPH_C32(0xe16db58d), + SPH_C32(0x688644ee), SPH_C32(0x514dc340), SPH_C32(0xf3e00350), + SPH_C32(0x31970000), SPH_C32(0x5bd00000), SPH_C32(0xbe740000), + SPH_C32(0x2b132999), SPH_C32(0x8b9b2ea3), SPH_C32(0xb448cf9b), + SPH_C32(0x79f35bcf) }, + { SPH_C32(0x8ebc0300), SPH_C32(0xdafe0000), SPH_C32(0x22960000), + SPH_C32(0xc4950000), SPH_C32(0xb72e6d5f), SPH_C32(0xdd5927b1), + SPH_C32(0xffe1f922), SPH_C32(0x144ea3ff), SPH_C32(0x84a403a0), + SPH_C32(0xc0cd0000), SPH_C32(0xae620000), SPH_C32(0x8a600000), + SPH_C32(0xa2245715), SPH_C32(0xd110c286), SPH_C32(0xbf8b0285), + SPH_C32(0xb6c42e04) }, + { SPH_C32(0xf9f803f0), SPH_C32(0x2ba40000), SPH_C32(0xd7240000), + SPH_C32(0xf0810000), SPH_C32(0x3e1913d3), SPH_C32(0x87d2cb94), + SPH_C32(0xf422343c), SPH_C32(0xdb79d634), SPH_C32(0x70c803f0), + SPH_C32(0x56d50000), SPH_C32(0xbac70000), SPH_C32(0x897f0000), + SPH_C32(0xe0b029ad), SPH_C32(0xb7afbc9f), SPH_C32(0x232f7257), + SPH_C32(0x3cf03b70) } +}; + +static const sph_u32 T512_12[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x75c90003), SPH_C32(0x0e10c000), SPH_C32(0xd1200000), + SPH_C32(0xbaea0000), SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), + SPH_C32(0xbb28761d), SPH_C32(0x00b72e2b), SPH_C32(0xeecf0001), + SPH_C32(0x6f564000), SPH_C32(0xf33e0000), SPH_C32(0xa79e0000), + SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), SPH_C32(0x4a3b40ba), + SPH_C32(0xfeabf254) }, + { SPH_C32(0xeecf0001), SPH_C32(0x6f564000), SPH_C32(0xf33e0000), + SPH_C32(0xa79e0000), SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), + SPH_C32(0x4a3b40ba), SPH_C32(0xfeabf254), SPH_C32(0x9b060002), + SPH_C32(0x61468000), SPH_C32(0x221e0000), SPH_C32(0x1d740000), + SPH_C32(0x36715d27), SPH_C32(0x30495c92), SPH_C32(0xf11336a7), + SPH_C32(0xfe1cdc7f) }, + { SPH_C32(0x9b060002), SPH_C32(0x61468000), SPH_C32(0x221e0000), + SPH_C32(0x1d740000), SPH_C32(0x36715d27), SPH_C32(0x30495c92), + SPH_C32(0xf11336a7), SPH_C32(0xfe1cdc7f), SPH_C32(0x75c90003), + SPH_C32(0x0e10c000), SPH_C32(0xd1200000), SPH_C32(0xbaea0000), + SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), SPH_C32(0xbb28761d), + SPH_C32(0x00b72e2b) }, + { SPH_C32(0xf6800005), SPH_C32(0x3443c000), SPH_C32(0x24070000), + SPH_C32(0x8f3d0000), SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), + SPH_C32(0xcdc58b19), SPH_C32(0xd795ba31), SPH_C32(0xa67f0001), + SPH_C32(0x71378000), SPH_C32(0x19fc0000), SPH_C32(0x96db0000), + SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), SPH_C32(0x2c6d478f), + SPH_C32(0xac8e6c88) }, + { SPH_C32(0x83490006), SPH_C32(0x3a530000), SPH_C32(0xf5270000), + SPH_C32(0x35d70000), SPH_C32(0xaaf314c5), SPH_C32(0x8de062f9), + SPH_C32(0x76edfd04), SPH_C32(0xd722941a), SPH_C32(0x48b00000), + SPH_C32(0x1e61c000), SPH_C32(0xeac20000), SPH_C32(0x31450000), + SPH_C32(0x873e1fe4), SPH_C32(0x5cdb4536), SPH_C32(0x66560735), + SPH_C32(0x52259edc) }, + { SPH_C32(0x184f0004), SPH_C32(0x5b158000), SPH_C32(0xd7390000), + SPH_C32(0x28a30000), SPH_C32(0x9c8249e2), SPH_C32(0xbda93e6b), + SPH_C32(0x87fecba3), SPH_C32(0x293e4865), SPH_C32(0x3d790003), + SPH_C32(0x10710000), SPH_C32(0x3be20000), SPH_C32(0x8baf0000), + SPH_C32(0x0cfa30da), SPH_C32(0xdb83f261), SPH_C32(0xdd7e7128), + SPH_C32(0x5292b0f7) }, + { SPH_C32(0x6d860007), SPH_C32(0x55054000), SPH_C32(0x06190000), + SPH_C32(0x92490000), SPH_C32(0x174666dc), SPH_C32(0x3af1893c), + SPH_C32(0x3cd6bdbe), SPH_C32(0x2989664e), SPH_C32(0xd3b60002), + SPH_C32(0x7f274000), SPH_C32(0xc8dc0000), SPH_C32(0x2c310000), + SPH_C32(0xb14f42c3), SPH_C32(0x6c9219a4), SPH_C32(0x97453192), + SPH_C32(0xac3942a3) }, + { SPH_C32(0xa67f0001), SPH_C32(0x71378000), SPH_C32(0x19fc0000), + SPH_C32(0x96db0000), SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), + SPH_C32(0x2c6d478f), SPH_C32(0xac8e6c88), SPH_C32(0x50ff0004), + SPH_C32(0x45744000), SPH_C32(0x3dfb0000), SPH_C32(0x19e60000), + SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), SPH_C32(0xe1a8cc96), + SPH_C32(0x7b1bd6b9) }, + { SPH_C32(0xd3b60002), SPH_C32(0x7f274000), SPH_C32(0xc8dc0000), + SPH_C32(0x2c310000), SPH_C32(0xb14f42c3), SPH_C32(0x6c9219a4), + SPH_C32(0x97453192), SPH_C32(0xac3942a3), SPH_C32(0xbe300005), + SPH_C32(0x2a220000), SPH_C32(0xcec50000), SPH_C32(0xbe780000), + SPH_C32(0xa609241f), SPH_C32(0x56639098), SPH_C32(0xab938c2c), + SPH_C32(0x85b024ed) }, + { SPH_C32(0x48b00000), SPH_C32(0x1e61c000), SPH_C32(0xeac20000), + SPH_C32(0x31450000), SPH_C32(0x873e1fe4), SPH_C32(0x5cdb4536), + SPH_C32(0x66560735), SPH_C32(0x52259edc), SPH_C32(0xcbf90006), + SPH_C32(0x2432c000), SPH_C32(0x1fe50000), SPH_C32(0x04920000), + SPH_C32(0x2dcd0b21), SPH_C32(0xd13b27cf), SPH_C32(0x10bbfa31), + SPH_C32(0x85070ac6) }, + { SPH_C32(0x3d790003), SPH_C32(0x10710000), SPH_C32(0x3be20000), + SPH_C32(0x8baf0000), SPH_C32(0x0cfa30da), SPH_C32(0xdb83f261), + SPH_C32(0xdd7e7128), SPH_C32(0x5292b0f7), SPH_C32(0x25360007), + SPH_C32(0x4b648000), SPH_C32(0xecdb0000), SPH_C32(0xa30c0000), + SPH_C32(0x90787938), SPH_C32(0x662acc0a), SPH_C32(0x5a80ba8b), + SPH_C32(0x7bacf892) }, + { SPH_C32(0x50ff0004), SPH_C32(0x45744000), SPH_C32(0x3dfb0000), + SPH_C32(0x19e60000), SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), + SPH_C32(0xe1a8cc96), SPH_C32(0x7b1bd6b9), SPH_C32(0xf6800005), + SPH_C32(0x3443c000), SPH_C32(0x24070000), SPH_C32(0x8f3d0000), + SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), SPH_C32(0xcdc58b19), + SPH_C32(0xd795ba31) }, + { SPH_C32(0x25360007), SPH_C32(0x4b648000), SPH_C32(0xecdb0000), + SPH_C32(0xa30c0000), SPH_C32(0x90787938), SPH_C32(0x662acc0a), + SPH_C32(0x5a80ba8b), SPH_C32(0x7bacf892), SPH_C32(0x184f0004), + SPH_C32(0x5b158000), SPH_C32(0xd7390000), SPH_C32(0x28a30000), + SPH_C32(0x9c8249e2), SPH_C32(0xbda93e6b), SPH_C32(0x87fecba3), + SPH_C32(0x293e4865) }, + { SPH_C32(0xbe300005), SPH_C32(0x2a220000), SPH_C32(0xcec50000), + SPH_C32(0xbe780000), SPH_C32(0xa609241f), SPH_C32(0x56639098), + SPH_C32(0xab938c2c), SPH_C32(0x85b024ed), SPH_C32(0x6d860007), + SPH_C32(0x55054000), SPH_C32(0x06190000), SPH_C32(0x92490000), + SPH_C32(0x174666dc), SPH_C32(0x3af1893c), SPH_C32(0x3cd6bdbe), + SPH_C32(0x2989664e) }, + { SPH_C32(0xcbf90006), SPH_C32(0x2432c000), SPH_C32(0x1fe50000), + SPH_C32(0x04920000), SPH_C32(0x2dcd0b21), SPH_C32(0xd13b27cf), + SPH_C32(0x10bbfa31), SPH_C32(0x85070ac6), SPH_C32(0x83490006), + SPH_C32(0x3a530000), SPH_C32(0xf5270000), SPH_C32(0x35d70000), + SPH_C32(0xaaf314c5), SPH_C32(0x8de062f9), SPH_C32(0x76edfd04), + SPH_C32(0xd722941a) }, + { SPH_C32(0xf7750009), SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), + SPH_C32(0x04920000), SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), + SPH_C32(0x7a87f14e), SPH_C32(0x9e16981a), SPH_C32(0xd46a0000), + SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), SPH_C32(0x4a290000), + SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), SPH_C32(0x98369604), + SPH_C32(0xf746c320) }, + { SPH_C32(0x82bc000a), SPH_C32(0xc12c0000), SPH_C32(0x12f60000), + SPH_C32(0xbe780000), SPH_C32(0x89513697), SPH_C32(0x7fb081ed), + SPH_C32(0xc1af8753), SPH_C32(0x9ea1b631), SPH_C32(0x3aa50001), + SPH_C32(0xe29e8000), SPH_C32(0x56910000), SPH_C32(0xedb70000), + SPH_C32(0x41fb3063), SPH_C32(0x7ea56da9), SPH_C32(0xd20dd6be), + SPH_C32(0x09ed3174) }, + { SPH_C32(0x19ba0008), SPH_C32(0xa06a8000), SPH_C32(0x30e80000), + SPH_C32(0xa30c0000), SPH_C32(0xbf206bb0), SPH_C32(0x4ff9dd7f), + SPH_C32(0x30bcb1f4), SPH_C32(0x60bd6a4e), SPH_C32(0x4f6c0002), + SPH_C32(0xec8e4000), SPH_C32(0x87b10000), SPH_C32(0x575d0000), + SPH_C32(0xca3f1f5d), SPH_C32(0xf9fddafe), SPH_C32(0x6925a0a3), + SPH_C32(0x095a1f5f) }, + { SPH_C32(0x6c73000b), SPH_C32(0xae7a4000), SPH_C32(0xe1c80000), + SPH_C32(0x19e60000), SPH_C32(0x34e4448e), SPH_C32(0xc8a16a28), + SPH_C32(0x8b94c7e9), SPH_C32(0x600a4465), SPH_C32(0xa1a30003), + SPH_C32(0x83d80000), SPH_C32(0x748f0000), SPH_C32(0xf0c30000), + SPH_C32(0x778a6d44), SPH_C32(0x4eec313b), SPH_C32(0x231ee019), + SPH_C32(0xf7f1ed0b) }, + { SPH_C32(0x01f5000c), SPH_C32(0xfb7f0000), SPH_C32(0xe7d10000), + SPH_C32(0x8baf0000), SPH_C32(0x23a22252), SPH_C32(0xf250e314), + SPH_C32(0xb7427a57), SPH_C32(0x4983222b), SPH_C32(0x72150001), + SPH_C32(0xfcff4000), SPH_C32(0xbc530000), SPH_C32(0xdcf20000), + SPH_C32(0xc6c52f87), SPH_C32(0x227e289f), SPH_C32(0xb45bd18b), + SPH_C32(0x5bc8afa8) }, + { SPH_C32(0x743c000f), SPH_C32(0xf56fc000), SPH_C32(0x36f10000), + SPH_C32(0x31450000), SPH_C32(0xa8660d6c), SPH_C32(0x75085443), + SPH_C32(0x0c6a0c4a), SPH_C32(0x49340c00), SPH_C32(0x9cda0000), + SPH_C32(0x93a90000), SPH_C32(0x4f6d0000), SPH_C32(0x7b6c0000), + SPH_C32(0x7b705d9e), SPH_C32(0x956fc35a), SPH_C32(0xfe609131), + SPH_C32(0xa5635dfc) }, + { SPH_C32(0xef3a000d), SPH_C32(0x94294000), SPH_C32(0x14ef0000), + SPH_C32(0x2c310000), SPH_C32(0x9e17504b), SPH_C32(0x454108d1), + SPH_C32(0xfd793aed), SPH_C32(0xb728d07f), SPH_C32(0xe9130003), + SPH_C32(0x9db9c000), SPH_C32(0x9e4d0000), SPH_C32(0xc1860000), + SPH_C32(0xf0b472a0), SPH_C32(0x1237740d), SPH_C32(0x4548e72c), + SPH_C32(0xa5d473d7) }, + { SPH_C32(0x9af3000e), SPH_C32(0x9a398000), SPH_C32(0xc5cf0000), + SPH_C32(0x96db0000), SPH_C32(0x15d37f75), SPH_C32(0xc219bf86), + SPH_C32(0x46514cf0), SPH_C32(0xb79ffe54), SPH_C32(0x07dc0002), + SPH_C32(0xf2ef8000), SPH_C32(0x6d730000), SPH_C32(0x66180000), + SPH_C32(0x4d0100b9), SPH_C32(0xa5269fc8), SPH_C32(0x0f73a796), + SPH_C32(0x5b7f8183) }, + { SPH_C32(0x510a0008), SPH_C32(0xbe0b4000), SPH_C32(0xda2a0000), + SPH_C32(0x92490000), SPH_C32(0x381e7454), SPH_C32(0x13229849), + SPH_C32(0x56eab6c1), SPH_C32(0x3298f492), SPH_C32(0x84950004), + SPH_C32(0xc8bc8000), SPH_C32(0x98540000), SPH_C32(0x53cf0000), + SPH_C32(0xe7f2147c), SPH_C32(0x28c6fd31), SPH_C32(0x799e5a92), + SPH_C32(0x8c5d1599) }, + { SPH_C32(0x24c3000b), SPH_C32(0xb01b8000), SPH_C32(0x0b0a0000), + SPH_C32(0x28a30000), SPH_C32(0xb3da5b6a), SPH_C32(0x947a2f1e), + SPH_C32(0xedc2c0dc), SPH_C32(0x322fdab9), SPH_C32(0x6a5a0005), + SPH_C32(0xa7eac000), SPH_C32(0x6b6a0000), SPH_C32(0xf4510000), + SPH_C32(0x5a476665), SPH_C32(0x9fd716f4), SPH_C32(0x33a51a28), + SPH_C32(0x72f6e7cd) }, + { SPH_C32(0xbfc50009), SPH_C32(0xd15d0000), SPH_C32(0x29140000), + SPH_C32(0x35d70000), SPH_C32(0x85ab064d), SPH_C32(0xa433738c), + SPH_C32(0x1cd1f67b), SPH_C32(0xcc3306c6), SPH_C32(0x1f930006), + SPH_C32(0xa9fa0000), SPH_C32(0xba4a0000), SPH_C32(0x4ebb0000), + SPH_C32(0xd183495b), SPH_C32(0x188fa1a3), SPH_C32(0x888d6c35), + SPH_C32(0x7241c9e6) }, + { SPH_C32(0xca0c000a), SPH_C32(0xdf4dc000), SPH_C32(0xf8340000), + SPH_C32(0x8f3d0000), SPH_C32(0x0e6f2973), SPH_C32(0x236bc4db), + SPH_C32(0xa7f98066), SPH_C32(0xcc8428ed), SPH_C32(0xf15c0007), + SPH_C32(0xc6ac4000), SPH_C32(0x49740000), SPH_C32(0xe9250000), + SPH_C32(0x6c363b42), SPH_C32(0xaf9e4a66), SPH_C32(0xc2b62c8f), + SPH_C32(0x8cea3bb2) }, + { SPH_C32(0xa78a000d), SPH_C32(0x8a488000), SPH_C32(0xfe2d0000), + SPH_C32(0x1d740000), SPH_C32(0x19294faf), SPH_C32(0x199a4de7), + SPH_C32(0x9b2f3dd8), SPH_C32(0xe50d4ea3), SPH_C32(0x22ea0005), + SPH_C32(0xb98b0000), SPH_C32(0x81a80000), SPH_C32(0xc5140000), + SPH_C32(0xdd797981), SPH_C32(0xc30c53c2), SPH_C32(0x55f31d1d), + SPH_C32(0x20d37911) }, + { SPH_C32(0xd243000e), SPH_C32(0x84584000), SPH_C32(0x2f0d0000), + SPH_C32(0xa79e0000), SPH_C32(0x92ed6091), SPH_C32(0x9ec2fab0), + SPH_C32(0x20074bc5), SPH_C32(0xe5ba6088), SPH_C32(0xcc250004), + SPH_C32(0xd6dd4000), SPH_C32(0x72960000), SPH_C32(0x628a0000), + SPH_C32(0x60cc0b98), SPH_C32(0x741db807), SPH_C32(0x1fc85da7), + SPH_C32(0xde788b45) }, + { SPH_C32(0x4945000c), SPH_C32(0xe51ec000), SPH_C32(0x0d130000), + SPH_C32(0xbaea0000), SPH_C32(0xa49c3db6), SPH_C32(0xae8ba622), + SPH_C32(0xd1147d62), SPH_C32(0x1ba6bcf7), SPH_C32(0xb9ec0007), + SPH_C32(0xd8cd8000), SPH_C32(0xa3b60000), SPH_C32(0xd8600000), + SPH_C32(0xeb0824a6), SPH_C32(0xf3450f50), SPH_C32(0xa4e02bba), + SPH_C32(0xdecfa56e) }, + { SPH_C32(0x3c8c000f), SPH_C32(0xeb0e0000), SPH_C32(0xdc330000), + SPH_C32(0x00000000), SPH_C32(0x2f581288), SPH_C32(0x29d31175), + SPH_C32(0x6a3c0b7f), SPH_C32(0x1b1192dc), SPH_C32(0x57230006), + SPH_C32(0xb79bc000), SPH_C32(0x50880000), SPH_C32(0x7ffe0000), + SPH_C32(0x56bd56bf), SPH_C32(0x4454e495), SPH_C32(0xeedb6b00), + SPH_C32(0x2064573a) }, + { SPH_C32(0xd46a0000), SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), + SPH_C32(0x4a290000), SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), + SPH_C32(0x98369604), SPH_C32(0xf746c320), SPH_C32(0x231f0009), + SPH_C32(0x42f40000), SPH_C32(0x66790000), SPH_C32(0x4ebb0000), + SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), SPH_C32(0xe2b1674a), + SPH_C32(0x69505b3a) }, + { SPH_C32(0xa1a30003), SPH_C32(0x83d80000), SPH_C32(0x748f0000), + SPH_C32(0xf0c30000), SPH_C32(0x778a6d44), SPH_C32(0x4eec313b), + SPH_C32(0x231ee019), SPH_C32(0xf7f1ed0b), SPH_C32(0xcdd00008), + SPH_C32(0x2da24000), SPH_C32(0x95470000), SPH_C32(0xe9250000), + SPH_C32(0x436e29ca), SPH_C32(0x864d5b13), SPH_C32(0xa88a27f0), + SPH_C32(0x97fba96e) }, + { SPH_C32(0x3aa50001), SPH_C32(0xe29e8000), SPH_C32(0x56910000), + SPH_C32(0xedb70000), SPH_C32(0x41fb3063), SPH_C32(0x7ea56da9), + SPH_C32(0xd20dd6be), SPH_C32(0x09ed3174), SPH_C32(0xb819000b), + SPH_C32(0x23b28000), SPH_C32(0x44670000), SPH_C32(0x53cf0000), + SPH_C32(0xc8aa06f4), SPH_C32(0x0115ec44), SPH_C32(0x13a251ed), + SPH_C32(0x974c8745) }, + { SPH_C32(0x4f6c0002), SPH_C32(0xec8e4000), SPH_C32(0x87b10000), + SPH_C32(0x575d0000), SPH_C32(0xca3f1f5d), SPH_C32(0xf9fddafe), + SPH_C32(0x6925a0a3), SPH_C32(0x095a1f5f), SPH_C32(0x56d6000a), + SPH_C32(0x4ce4c000), SPH_C32(0xb7590000), SPH_C32(0xf4510000), + SPH_C32(0x751f74ed), SPH_C32(0xb6040781), SPH_C32(0x59991157), + SPH_C32(0x69e77511) }, + { SPH_C32(0x22ea0005), SPH_C32(0xb98b0000), SPH_C32(0x81a80000), + SPH_C32(0xc5140000), SPH_C32(0xdd797981), SPH_C32(0xc30c53c2), + SPH_C32(0x55f31d1d), SPH_C32(0x20d37911), SPH_C32(0x85600008), + SPH_C32(0x33c38000), SPH_C32(0x7f850000), SPH_C32(0xd8600000), + SPH_C32(0xc450362e), SPH_C32(0xda961e25), SPH_C32(0xcedc20c5), + SPH_C32(0xc5de37b2) }, + { SPH_C32(0x57230006), SPH_C32(0xb79bc000), SPH_C32(0x50880000), + SPH_C32(0x7ffe0000), SPH_C32(0x56bd56bf), SPH_C32(0x4454e495), + SPH_C32(0xeedb6b00), SPH_C32(0x2064573a), SPH_C32(0x6baf0009), + SPH_C32(0x5c95c000), SPH_C32(0x8cbb0000), SPH_C32(0x7ffe0000), + SPH_C32(0x79e54437), SPH_C32(0x6d87f5e0), SPH_C32(0x84e7607f), + SPH_C32(0x3b75c5e6) }, + { SPH_C32(0xcc250004), SPH_C32(0xd6dd4000), SPH_C32(0x72960000), + SPH_C32(0x628a0000), SPH_C32(0x60cc0b98), SPH_C32(0x741db807), + SPH_C32(0x1fc85da7), SPH_C32(0xde788b45), SPH_C32(0x1e66000a), + SPH_C32(0x52850000), SPH_C32(0x5d9b0000), SPH_C32(0xc5140000), + SPH_C32(0xf2216b09), SPH_C32(0xeadf42b7), SPH_C32(0x3fcf1662), + SPH_C32(0x3bc2ebcd) }, + { SPH_C32(0xb9ec0007), SPH_C32(0xd8cd8000), SPH_C32(0xa3b60000), + SPH_C32(0xd8600000), SPH_C32(0xeb0824a6), SPH_C32(0xf3450f50), + SPH_C32(0xa4e02bba), SPH_C32(0xdecfa56e), SPH_C32(0xf0a9000b), + SPH_C32(0x3dd34000), SPH_C32(0xaea50000), SPH_C32(0x628a0000), + SPH_C32(0x4f941910), SPH_C32(0x5dcea972), SPH_C32(0x75f456d8), + SPH_C32(0xc5691999) }, + { SPH_C32(0x72150001), SPH_C32(0xfcff4000), SPH_C32(0xbc530000), + SPH_C32(0xdcf20000), SPH_C32(0xc6c52f87), SPH_C32(0x227e289f), + SPH_C32(0xb45bd18b), SPH_C32(0x5bc8afa8), SPH_C32(0x73e0000d), + SPH_C32(0x07804000), SPH_C32(0x5b820000), SPH_C32(0x575d0000), + SPH_C32(0xe5670dd5), SPH_C32(0xd02ecb8b), SPH_C32(0x0319abdc), + SPH_C32(0x124b8d83) }, + { SPH_C32(0x07dc0002), SPH_C32(0xf2ef8000), SPH_C32(0x6d730000), + SPH_C32(0x66180000), SPH_C32(0x4d0100b9), SPH_C32(0xa5269fc8), + SPH_C32(0x0f73a796), SPH_C32(0x5b7f8183), SPH_C32(0x9d2f000c), + SPH_C32(0x68d60000), SPH_C32(0xa8bc0000), SPH_C32(0xf0c30000), + SPH_C32(0x58d27fcc), SPH_C32(0x673f204e), SPH_C32(0x4922eb66), + SPH_C32(0xece07fd7) }, + { SPH_C32(0x9cda0000), SPH_C32(0x93a90000), SPH_C32(0x4f6d0000), + SPH_C32(0x7b6c0000), SPH_C32(0x7b705d9e), SPH_C32(0x956fc35a), + SPH_C32(0xfe609131), SPH_C32(0xa5635dfc), SPH_C32(0xe8e6000f), + SPH_C32(0x66c6c000), SPH_C32(0x799c0000), SPH_C32(0x4a290000), + SPH_C32(0xd31650f2), SPH_C32(0xe0679719), SPH_C32(0xf20a9d7b), + SPH_C32(0xec5751fc) }, + { SPH_C32(0xe9130003), SPH_C32(0x9db9c000), SPH_C32(0x9e4d0000), + SPH_C32(0xc1860000), SPH_C32(0xf0b472a0), SPH_C32(0x1237740d), + SPH_C32(0x4548e72c), SPH_C32(0xa5d473d7), SPH_C32(0x0629000e), + SPH_C32(0x09908000), SPH_C32(0x8aa20000), SPH_C32(0xedb70000), + SPH_C32(0x6ea322eb), SPH_C32(0x57767cdc), SPH_C32(0xb831ddc1), + SPH_C32(0x12fca3a8) }, + { SPH_C32(0x84950004), SPH_C32(0xc8bc8000), SPH_C32(0x98540000), + SPH_C32(0x53cf0000), SPH_C32(0xe7f2147c), SPH_C32(0x28c6fd31), + SPH_C32(0x799e5a92), SPH_C32(0x8c5d1599), SPH_C32(0xd59f000c), + SPH_C32(0x76b7c000), SPH_C32(0x427e0000), SPH_C32(0xc1860000), + SPH_C32(0xdfec6028), SPH_C32(0x3be46578), SPH_C32(0x2f74ec53), + SPH_C32(0xbec5e10b) }, + { SPH_C32(0xf15c0007), SPH_C32(0xc6ac4000), SPH_C32(0x49740000), + SPH_C32(0xe9250000), SPH_C32(0x6c363b42), SPH_C32(0xaf9e4a66), + SPH_C32(0xc2b62c8f), SPH_C32(0x8cea3bb2), SPH_C32(0x3b50000d), + SPH_C32(0x19e18000), SPH_C32(0xb1400000), SPH_C32(0x66180000), + SPH_C32(0x62591231), SPH_C32(0x8cf58ebd), SPH_C32(0x654face9), + SPH_C32(0x406e135f) }, + { SPH_C32(0x6a5a0005), SPH_C32(0xa7eac000), SPH_C32(0x6b6a0000), + SPH_C32(0xf4510000), SPH_C32(0x5a476665), SPH_C32(0x9fd716f4), + SPH_C32(0x33a51a28), SPH_C32(0x72f6e7cd), SPH_C32(0x4e99000e), + SPH_C32(0x17f14000), SPH_C32(0x60600000), SPH_C32(0xdcf20000), + SPH_C32(0xe99d3d0f), SPH_C32(0x0bad39ea), SPH_C32(0xde67daf4), + SPH_C32(0x40d93d74) }, + { SPH_C32(0x1f930006), SPH_C32(0xa9fa0000), SPH_C32(0xba4a0000), + SPH_C32(0x4ebb0000), SPH_C32(0xd183495b), SPH_C32(0x188fa1a3), + SPH_C32(0x888d6c35), SPH_C32(0x7241c9e6), SPH_C32(0xa056000f), + SPH_C32(0x78a70000), SPH_C32(0x935e0000), SPH_C32(0x7b6c0000), + SPH_C32(0x54284f16), SPH_C32(0xbcbcd22f), SPH_C32(0x945c9a4e), + SPH_C32(0xbe72cf20) }, + { SPH_C32(0x231f0009), SPH_C32(0x42f40000), SPH_C32(0x66790000), + SPH_C32(0x4ebb0000), SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), + SPH_C32(0xe2b1674a), SPH_C32(0x69505b3a), SPH_C32(0xf7750009), + SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), SPH_C32(0x04920000), + SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), SPH_C32(0x7a87f14e), + SPH_C32(0x9e16981a) }, + { SPH_C32(0x56d6000a), SPH_C32(0x4ce4c000), SPH_C32(0xb7590000), + SPH_C32(0xf4510000), SPH_C32(0x751f74ed), SPH_C32(0xb6040781), + SPH_C32(0x59991157), SPH_C32(0x69e77511), SPH_C32(0x19ba0008), + SPH_C32(0xa06a8000), SPH_C32(0x30e80000), SPH_C32(0xa30c0000), + SPH_C32(0xbf206bb0), SPH_C32(0x4ff9dd7f), SPH_C32(0x30bcb1f4), + SPH_C32(0x60bd6a4e) }, + { SPH_C32(0xcdd00008), SPH_C32(0x2da24000), SPH_C32(0x95470000), + SPH_C32(0xe9250000), SPH_C32(0x436e29ca), SPH_C32(0x864d5b13), + SPH_C32(0xa88a27f0), SPH_C32(0x97fba96e), SPH_C32(0x6c73000b), + SPH_C32(0xae7a4000), SPH_C32(0xe1c80000), SPH_C32(0x19e60000), + SPH_C32(0x34e4448e), SPH_C32(0xc8a16a28), SPH_C32(0x8b94c7e9), + SPH_C32(0x600a4465) }, + { SPH_C32(0xb819000b), SPH_C32(0x23b28000), SPH_C32(0x44670000), + SPH_C32(0x53cf0000), SPH_C32(0xc8aa06f4), SPH_C32(0x0115ec44), + SPH_C32(0x13a251ed), SPH_C32(0x974c8745), SPH_C32(0x82bc000a), + SPH_C32(0xc12c0000), SPH_C32(0x12f60000), SPH_C32(0xbe780000), + SPH_C32(0x89513697), SPH_C32(0x7fb081ed), SPH_C32(0xc1af8753), + SPH_C32(0x9ea1b631) }, + { SPH_C32(0xd59f000c), SPH_C32(0x76b7c000), SPH_C32(0x427e0000), + SPH_C32(0xc1860000), SPH_C32(0xdfec6028), SPH_C32(0x3be46578), + SPH_C32(0x2f74ec53), SPH_C32(0xbec5e10b), SPH_C32(0x510a0008), + SPH_C32(0xbe0b4000), SPH_C32(0xda2a0000), SPH_C32(0x92490000), + SPH_C32(0x381e7454), SPH_C32(0x13229849), SPH_C32(0x56eab6c1), + SPH_C32(0x3298f492) }, + { SPH_C32(0xa056000f), SPH_C32(0x78a70000), SPH_C32(0x935e0000), + SPH_C32(0x7b6c0000), SPH_C32(0x54284f16), SPH_C32(0xbcbcd22f), + SPH_C32(0x945c9a4e), SPH_C32(0xbe72cf20), SPH_C32(0xbfc50009), + SPH_C32(0xd15d0000), SPH_C32(0x29140000), SPH_C32(0x35d70000), + SPH_C32(0x85ab064d), SPH_C32(0xa433738c), SPH_C32(0x1cd1f67b), + SPH_C32(0xcc3306c6) }, + { SPH_C32(0x3b50000d), SPH_C32(0x19e18000), SPH_C32(0xb1400000), + SPH_C32(0x66180000), SPH_C32(0x62591231), SPH_C32(0x8cf58ebd), + SPH_C32(0x654face9), SPH_C32(0x406e135f), SPH_C32(0xca0c000a), + SPH_C32(0xdf4dc000), SPH_C32(0xf8340000), SPH_C32(0x8f3d0000), + SPH_C32(0x0e6f2973), SPH_C32(0x236bc4db), SPH_C32(0xa7f98066), + SPH_C32(0xcc8428ed) }, + { SPH_C32(0x4e99000e), SPH_C32(0x17f14000), SPH_C32(0x60600000), + SPH_C32(0xdcf20000), SPH_C32(0xe99d3d0f), SPH_C32(0x0bad39ea), + SPH_C32(0xde67daf4), SPH_C32(0x40d93d74), SPH_C32(0x24c3000b), + SPH_C32(0xb01b8000), SPH_C32(0x0b0a0000), SPH_C32(0x28a30000), + SPH_C32(0xb3da5b6a), SPH_C32(0x947a2f1e), SPH_C32(0xedc2c0dc), + SPH_C32(0x322fdab9) }, + { SPH_C32(0x85600008), SPH_C32(0x33c38000), SPH_C32(0x7f850000), + SPH_C32(0xd8600000), SPH_C32(0xc450362e), SPH_C32(0xda961e25), + SPH_C32(0xcedc20c5), SPH_C32(0xc5de37b2), SPH_C32(0xa78a000d), + SPH_C32(0x8a488000), SPH_C32(0xfe2d0000), SPH_C32(0x1d740000), + SPH_C32(0x19294faf), SPH_C32(0x199a4de7), SPH_C32(0x9b2f3dd8), + SPH_C32(0xe50d4ea3) }, + { SPH_C32(0xf0a9000b), SPH_C32(0x3dd34000), SPH_C32(0xaea50000), + SPH_C32(0x628a0000), SPH_C32(0x4f941910), SPH_C32(0x5dcea972), + SPH_C32(0x75f456d8), SPH_C32(0xc5691999), SPH_C32(0x4945000c), + SPH_C32(0xe51ec000), SPH_C32(0x0d130000), SPH_C32(0xbaea0000), + SPH_C32(0xa49c3db6), SPH_C32(0xae8ba622), SPH_C32(0xd1147d62), + SPH_C32(0x1ba6bcf7) }, + { SPH_C32(0x6baf0009), SPH_C32(0x5c95c000), SPH_C32(0x8cbb0000), + SPH_C32(0x7ffe0000), SPH_C32(0x79e54437), SPH_C32(0x6d87f5e0), + SPH_C32(0x84e7607f), SPH_C32(0x3b75c5e6), SPH_C32(0x3c8c000f), + SPH_C32(0xeb0e0000), SPH_C32(0xdc330000), SPH_C32(0x00000000), + SPH_C32(0x2f581288), SPH_C32(0x29d31175), SPH_C32(0x6a3c0b7f), + SPH_C32(0x1b1192dc) }, + { SPH_C32(0x1e66000a), SPH_C32(0x52850000), SPH_C32(0x5d9b0000), + SPH_C32(0xc5140000), SPH_C32(0xf2216b09), SPH_C32(0xeadf42b7), + SPH_C32(0x3fcf1662), SPH_C32(0x3bc2ebcd), SPH_C32(0xd243000e), + SPH_C32(0x84584000), SPH_C32(0x2f0d0000), SPH_C32(0xa79e0000), + SPH_C32(0x92ed6091), SPH_C32(0x9ec2fab0), SPH_C32(0x20074bc5), + SPH_C32(0xe5ba6088) }, + { SPH_C32(0x73e0000d), SPH_C32(0x07804000), SPH_C32(0x5b820000), + SPH_C32(0x575d0000), SPH_C32(0xe5670dd5), SPH_C32(0xd02ecb8b), + SPH_C32(0x0319abdc), SPH_C32(0x124b8d83), SPH_C32(0x01f5000c), + SPH_C32(0xfb7f0000), SPH_C32(0xe7d10000), SPH_C32(0x8baf0000), + SPH_C32(0x23a22252), SPH_C32(0xf250e314), SPH_C32(0xb7427a57), + SPH_C32(0x4983222b) }, + { SPH_C32(0x0629000e), SPH_C32(0x09908000), SPH_C32(0x8aa20000), + SPH_C32(0xedb70000), SPH_C32(0x6ea322eb), SPH_C32(0x57767cdc), + SPH_C32(0xb831ddc1), SPH_C32(0x12fca3a8), SPH_C32(0xef3a000d), + SPH_C32(0x94294000), SPH_C32(0x14ef0000), SPH_C32(0x2c310000), + SPH_C32(0x9e17504b), SPH_C32(0x454108d1), SPH_C32(0xfd793aed), + SPH_C32(0xb728d07f) }, + { SPH_C32(0x9d2f000c), SPH_C32(0x68d60000), SPH_C32(0xa8bc0000), + SPH_C32(0xf0c30000), SPH_C32(0x58d27fcc), SPH_C32(0x673f204e), + SPH_C32(0x4922eb66), SPH_C32(0xece07fd7), SPH_C32(0x9af3000e), + SPH_C32(0x9a398000), SPH_C32(0xc5cf0000), SPH_C32(0x96db0000), + SPH_C32(0x15d37f75), SPH_C32(0xc219bf86), SPH_C32(0x46514cf0), + SPH_C32(0xb79ffe54) }, + { SPH_C32(0xe8e6000f), SPH_C32(0x66c6c000), SPH_C32(0x799c0000), + SPH_C32(0x4a290000), SPH_C32(0xd31650f2), SPH_C32(0xe0679719), + SPH_C32(0xf20a9d7b), SPH_C32(0xec5751fc), SPH_C32(0x743c000f), + SPH_C32(0xf56fc000), SPH_C32(0x36f10000), SPH_C32(0x31450000), + SPH_C32(0xa8660d6c), SPH_C32(0x75085443), SPH_C32(0x0c6a0c4a), + SPH_C32(0x49340c00) } +}; + +static const sph_u32 T512_18[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x0c720000), SPH_C32(0x49e50f00), SPH_C32(0x42790000), + SPH_C32(0x5cea0000), SPH_C32(0x33aa301a), SPH_C32(0x15822514), + SPH_C32(0x95a34b7b), SPH_C32(0xb44b0090), SPH_C32(0xfe220000), + SPH_C32(0xa7580500), SPH_C32(0x25d10000), SPH_C32(0xf7600000), + SPH_C32(0x893178da), SPH_C32(0x1fd4f860), SPH_C32(0x4ed0a315), + SPH_C32(0xa123ff9f) }, + { SPH_C32(0xfe220000), SPH_C32(0xa7580500), SPH_C32(0x25d10000), + SPH_C32(0xf7600000), SPH_C32(0x893178da), SPH_C32(0x1fd4f860), + SPH_C32(0x4ed0a315), SPH_C32(0xa123ff9f), SPH_C32(0xf2500000), + SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), SPH_C32(0xab8a0000), + SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), SPH_C32(0xdb73e86e), + SPH_C32(0x1568ff0f) }, + { SPH_C32(0xf2500000), SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), + SPH_C32(0xab8a0000), SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), + SPH_C32(0xdb73e86e), SPH_C32(0x1568ff0f), SPH_C32(0x0c720000), + SPH_C32(0x49e50f00), SPH_C32(0x42790000), SPH_C32(0x5cea0000), + SPH_C32(0x33aa301a), SPH_C32(0x15822514), SPH_C32(0x95a34b7b), + SPH_C32(0xb44b0090) }, + { SPH_C32(0x45180000), SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), + SPH_C32(0x3b480000), SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), + SPH_C32(0x16bca6b0), SPH_C32(0xdf33f4df), SPH_C32(0xb83d0000), + SPH_C32(0x16710600), SPH_C32(0x379a0000), SPH_C32(0xf5b10000), + SPH_C32(0x228161ac), SPH_C32(0xae48f145), SPH_C32(0x66241616), + SPH_C32(0xc5c1eb3e) }, + { SPH_C32(0x496a0000), SPH_C32(0xec501800), SPH_C32(0xbb130000), + SPH_C32(0x67a20000), SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), + SPH_C32(0x831fedcb), SPH_C32(0x6b78f44f), SPH_C32(0x461f0000), + SPH_C32(0xb1290300), SPH_C32(0x124b0000), SPH_C32(0x02d10000), + SPH_C32(0xabb01976), SPH_C32(0xb19c0925), SPH_C32(0x28f4b503), + SPH_C32(0x64e214a1) }, + { SPH_C32(0xbb3a0000), SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), + SPH_C32(0xcc280000), SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), + SPH_C32(0x586c05a5), SPH_C32(0x7e100b40), SPH_C32(0x4a6d0000), + SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), SPH_C32(0x5e3b0000), + SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), SPH_C32(0xbd57fe78), + SPH_C32(0xd0a91431) }, + { SPH_C32(0xb7480000), SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), + SPH_C32(0x90c20000), SPH_C32(0xa4575cec), SPH_C32(0x294548a2), + SPH_C32(0xcdcf4ede), SPH_C32(0xca5b0bd0), SPH_C32(0xb44f0000), + SPH_C32(0x5f940900), SPH_C32(0x75e30000), SPH_C32(0xa95b0000), + SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), SPH_C32(0xf3875d6d), + SPH_C32(0x718aebae) }, + { SPH_C32(0xb83d0000), SPH_C32(0x16710600), SPH_C32(0x379a0000), + SPH_C32(0xf5b10000), SPH_C32(0x228161ac), SPH_C32(0xae48f145), + SPH_C32(0x66241616), SPH_C32(0xc5c1eb3e), SPH_C32(0xfd250000), + SPH_C32(0xb3c41100), SPH_C32(0xcef00000), SPH_C32(0xcef90000), + SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), SPH_C32(0x7098b0a6), + SPH_C32(0x1af21fe1) }, + { SPH_C32(0xb44f0000), SPH_C32(0x5f940900), SPH_C32(0x75e30000), + SPH_C32(0xa95b0000), SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), + SPH_C32(0xf3875d6d), SPH_C32(0x718aebae), SPH_C32(0x03070000), + SPH_C32(0x149c1400), SPH_C32(0xeb210000), SPH_C32(0x39990000), + SPH_C32(0xb57c0d5a), SPH_C32(0x928f9cf3), SPH_C32(0x3e4813b3), + SPH_C32(0xbbd1e07e) }, + { SPH_C32(0x461f0000), SPH_C32(0xb1290300), SPH_C32(0x124b0000), + SPH_C32(0x02d10000), SPH_C32(0xabb01976), SPH_C32(0xb19c0925), + SPH_C32(0x28f4b503), SPH_C32(0x64e214a1), SPH_C32(0x0f750000), + SPH_C32(0x5d791b00), SPH_C32(0xa9580000), SPH_C32(0x65730000), + SPH_C32(0x86d63d40), SPH_C32(0x870db9e7), SPH_C32(0xabeb58c8), + SPH_C32(0x0f9ae0ee) }, + { SPH_C32(0x4a6d0000), SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), + SPH_C32(0x5e3b0000), SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), + SPH_C32(0xbd57fe78), SPH_C32(0xd0a91431), SPH_C32(0xf1570000), + SPH_C32(0xfa211e00), SPH_C32(0x8c890000), SPH_C32(0x92130000), + SPH_C32(0x0fe7459a), SPH_C32(0x98d94187), SPH_C32(0xe53bfbdd), + SPH_C32(0xaeb91f71) }, + { SPH_C32(0xfd250000), SPH_C32(0xb3c41100), SPH_C32(0xcef00000), + SPH_C32(0xcef90000), SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), + SPH_C32(0x7098b0a6), SPH_C32(0x1af21fe1), SPH_C32(0x45180000), + SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), SPH_C32(0x3b480000), + SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), SPH_C32(0x16bca6b0), + SPH_C32(0xdf33f4df) }, + { SPH_C32(0xf1570000), SPH_C32(0xfa211e00), SPH_C32(0x8c890000), + SPH_C32(0x92130000), SPH_C32(0x0fe7459a), SPH_C32(0x98d94187), + SPH_C32(0xe53bfbdd), SPH_C32(0xaeb91f71), SPH_C32(0xbb3a0000), + SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), SPH_C32(0xcc280000), + SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), SPH_C32(0x586c05a5), + SPH_C32(0x7e100b40) }, + { SPH_C32(0x03070000), SPH_C32(0x149c1400), SPH_C32(0xeb210000), + SPH_C32(0x39990000), SPH_C32(0xb57c0d5a), SPH_C32(0x928f9cf3), + SPH_C32(0x3e4813b3), SPH_C32(0xbbd1e07e), SPH_C32(0xb7480000), + SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), SPH_C32(0x90c20000), + SPH_C32(0xa4575cec), SPH_C32(0x294548a2), SPH_C32(0xcdcf4ede), + SPH_C32(0xca5b0bd0) }, + { SPH_C32(0x0f750000), SPH_C32(0x5d791b00), SPH_C32(0xa9580000), + SPH_C32(0x65730000), SPH_C32(0x86d63d40), SPH_C32(0x870db9e7), + SPH_C32(0xabeb58c8), SPH_C32(0x0f9ae0ee), SPH_C32(0x496a0000), + SPH_C32(0xec501800), SPH_C32(0xbb130000), SPH_C32(0x67a20000), + SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), SPH_C32(0x831fedcb), + SPH_C32(0x6b78f44f) }, + { SPH_C32(0x75a40000), SPH_C32(0xc28b2700), SPH_C32(0x94a40000), + SPH_C32(0x90f50000), SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), + SPH_C32(0x1767c483), SPH_C32(0xaedf667e), SPH_C32(0xd1660000), + SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), SPH_C32(0xf6940000), + SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), SPH_C32(0xb4431b17), + SPH_C32(0x857f3c2b) }, + { SPH_C32(0x79d60000), SPH_C32(0x8b6e2800), SPH_C32(0xd6dd0000), + SPH_C32(0xcc1f0000), SPH_C32(0xc8d267fa), SPH_C32(0x5c4c2eba), + SPH_C32(0x82c48ff8), SPH_C32(0x1a9466ee), SPH_C32(0x2f440000), + SPH_C32(0xbce40600), SPH_C32(0xbb3d0000), SPH_C32(0x01f40000), + SPH_C32(0x8a333dfd), SPH_C32(0xd0a40492), SPH_C32(0xfa93b802), + SPH_C32(0x245cc3b4) }, + { SPH_C32(0x8b860000), SPH_C32(0x65d32200), SPH_C32(0xb1750000), + SPH_C32(0x67950000), SPH_C32(0x72492f3a), SPH_C32(0x561af3ce), + SPH_C32(0x59b76796), SPH_C32(0x0ffc99e1), SPH_C32(0x23360000), + SPH_C32(0xf5010900), SPH_C32(0xf9440000), SPH_C32(0x5d1e0000), + SPH_C32(0xb9990de7), SPH_C32(0xc5262186), SPH_C32(0x6f30f379), + SPH_C32(0x9017c324) }, + { SPH_C32(0x87f40000), SPH_C32(0x2c362d00), SPH_C32(0xf30c0000), + SPH_C32(0x3b7f0000), SPH_C32(0x41e31f20), SPH_C32(0x4398d6da), + SPH_C32(0xcc142ced), SPH_C32(0xbbb79971), SPH_C32(0xdd140000), + SPH_C32(0x52590c00), SPH_C32(0xdc950000), SPH_C32(0xaa7e0000), + SPH_C32(0x30a8753d), SPH_C32(0xdaf2d9e6), SPH_C32(0x21e0506c), + SPH_C32(0x31343cbb) }, + { SPH_C32(0x30bc0000), SPH_C32(0x673e3000), SPH_C32(0x6dce0000), + SPH_C32(0xabbd0000), SPH_C32(0xe5b443cc), SPH_C32(0x6add9e78), + SPH_C32(0x01db6233), SPH_C32(0x71ec92a1), SPH_C32(0x695b0000), + SPH_C32(0x0dcd0500), SPH_C32(0xa9760000), SPH_C32(0x03250000), + SPH_C32(0x2183248b), SPH_C32(0x61380db7), SPH_C32(0xd2670d01), + SPH_C32(0x40bed715) }, + { SPH_C32(0x3cce0000), SPH_C32(0x2edb3f00), SPH_C32(0x2fb70000), + SPH_C32(0xf7570000), SPH_C32(0xd61e73d6), SPH_C32(0x7f5fbb6c), + SPH_C32(0x94782948), SPH_C32(0xc5a79231), SPH_C32(0x97790000), + SPH_C32(0xaa950000), SPH_C32(0x8ca70000), SPH_C32(0xf4450000), + SPH_C32(0xa8b25c51), SPH_C32(0x7eecf5d7), SPH_C32(0x9cb7ae14), + SPH_C32(0xe19d288a) }, + { SPH_C32(0xce9e0000), SPH_C32(0xc0663500), SPH_C32(0x481f0000), + SPH_C32(0x5cdd0000), SPH_C32(0x6c853b16), SPH_C32(0x75096618), + SPH_C32(0x4f0bc126), SPH_C32(0xd0cf6d3e), SPH_C32(0x9b0b0000), + SPH_C32(0xe3700f00), SPH_C32(0xcede0000), SPH_C32(0xa8af0000), + SPH_C32(0x9b186c4b), SPH_C32(0x6b6ed0c3), SPH_C32(0x0914e56f), + SPH_C32(0x55d6281a) }, + { SPH_C32(0xc2ec0000), SPH_C32(0x89833a00), SPH_C32(0x0a660000), + SPH_C32(0x00370000), SPH_C32(0x5f2f0b0c), SPH_C32(0x608b430c), + SPH_C32(0xdaa88a5d), SPH_C32(0x64846dae), SPH_C32(0x65290000), + SPH_C32(0x44280a00), SPH_C32(0xeb0f0000), SPH_C32(0x5fcf0000), + SPH_C32(0x12291491), SPH_C32(0x74ba28a3), SPH_C32(0x47c4467a), + SPH_C32(0xf4f5d785) }, + { SPH_C32(0xcd990000), SPH_C32(0xd4fa2100), SPH_C32(0xa33e0000), + SPH_C32(0x65440000), SPH_C32(0xd9f9364c), SPH_C32(0xe786faeb), + SPH_C32(0x7143d295), SPH_C32(0x6b1e8d40), SPH_C32(0x2c430000), + SPH_C32(0xa8781200), SPH_C32(0x501c0000), SPH_C32(0x386d0000), + SPH_C32(0x3f4f30a7), SPH_C32(0x422b9861), SPH_C32(0xc4dbabb1), + SPH_C32(0x9f8d23ca) }, + { SPH_C32(0xc1eb0000), SPH_C32(0x9d1f2e00), SPH_C32(0xe1470000), + SPH_C32(0x39ae0000), SPH_C32(0xea530656), SPH_C32(0xf204dfff), + SPH_C32(0xe4e099ee), SPH_C32(0xdf558dd0), SPH_C32(0xd2610000), + SPH_C32(0x0f201700), SPH_C32(0x75cd0000), SPH_C32(0xcf0d0000), + SPH_C32(0xb67e487d), SPH_C32(0x5dff6001), SPH_C32(0x8a0b08a4), + SPH_C32(0x3eaedc55) }, + { SPH_C32(0x33bb0000), SPH_C32(0x73a22400), SPH_C32(0x86ef0000), + SPH_C32(0x92240000), SPH_C32(0x50c84e96), SPH_C32(0xf852028b), + SPH_C32(0x3f937180), SPH_C32(0xca3d72df), SPH_C32(0xde130000), + SPH_C32(0x46c51800), SPH_C32(0x37b40000), SPH_C32(0x93e70000), + SPH_C32(0x85d47867), SPH_C32(0x487d4515), SPH_C32(0x1fa843df), + SPH_C32(0x8ae5dcc5) }, + { SPH_C32(0x3fc90000), SPH_C32(0x3a472b00), SPH_C32(0xc4960000), + SPH_C32(0xcece0000), SPH_C32(0x63627e8c), SPH_C32(0xedd0279f), + SPH_C32(0xaa303afb), SPH_C32(0x7e76724f), SPH_C32(0x20310000), + SPH_C32(0xe19d1d00), SPH_C32(0x12650000), SPH_C32(0x64870000), + SPH_C32(0x0ce500bd), SPH_C32(0x57a9bd75), SPH_C32(0x5178e0ca), + SPH_C32(0x2bc6235a) }, + { SPH_C32(0x88810000), SPH_C32(0x714f3600), SPH_C32(0x5a540000), + SPH_C32(0x5e0c0000), SPH_C32(0xc7352260), SPH_C32(0xc4956f3d), + SPH_C32(0x67ff7425), SPH_C32(0xb42d799f), SPH_C32(0x947e0000), + SPH_C32(0xbe091400), SPH_C32(0x67860000), SPH_C32(0xcddc0000), + SPH_C32(0x1dce510b), SPH_C32(0xec636924), SPH_C32(0xa2ffbda7), + SPH_C32(0x5a4cc8f4) }, + { SPH_C32(0x84f30000), SPH_C32(0x38aa3900), SPH_C32(0x182d0000), + SPH_C32(0x02e60000), SPH_C32(0xf49f127a), SPH_C32(0xd1174a29), + SPH_C32(0xf25c3f5e), SPH_C32(0x0066790f), SPH_C32(0x6a5c0000), + SPH_C32(0x19511100), SPH_C32(0x42570000), SPH_C32(0x3abc0000), + SPH_C32(0x94ff29d1), SPH_C32(0xf3b79144), SPH_C32(0xec2f1eb2), + SPH_C32(0xfb6f376b) }, + { SPH_C32(0x76a30000), SPH_C32(0xd6173300), SPH_C32(0x7f850000), + SPH_C32(0xa96c0000), SPH_C32(0x4e045aba), SPH_C32(0xdb41975d), + SPH_C32(0x292fd730), SPH_C32(0x150e8600), SPH_C32(0x662e0000), + SPH_C32(0x50b41e00), SPH_C32(0x002e0000), SPH_C32(0x66560000), + SPH_C32(0xa75519cb), SPH_C32(0xe635b450), SPH_C32(0x798c55c9), + SPH_C32(0x4f2437fb) }, + { SPH_C32(0x7ad10000), SPH_C32(0x9ff23c00), SPH_C32(0x3dfc0000), + SPH_C32(0xf5860000), SPH_C32(0x7dae6aa0), SPH_C32(0xcec3b249), + SPH_C32(0xbc8c9c4b), SPH_C32(0xa1458690), SPH_C32(0x980c0000), + SPH_C32(0xf7ec1b00), SPH_C32(0x25ff0000), SPH_C32(0x91360000), + SPH_C32(0x2e646111), SPH_C32(0xf9e14c30), SPH_C32(0x375cf6dc), + SPH_C32(0xee07c864) }, + { SPH_C32(0xd1660000), SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), + SPH_C32(0xf6940000), SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), + SPH_C32(0xb4431b17), SPH_C32(0x857f3c2b), SPH_C32(0xa4c20000), + SPH_C32(0xd9372400), SPH_C32(0x0a480000), SPH_C32(0x66610000), + SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), SPH_C32(0xa324df94), + SPH_C32(0x2ba05a55) }, + { SPH_C32(0xdd140000), SPH_C32(0x52590c00), SPH_C32(0xdc950000), + SPH_C32(0xaa7e0000), SPH_C32(0x30a8753d), SPH_C32(0xdaf2d9e6), + SPH_C32(0x21e0506c), SPH_C32(0x31343cbb), SPH_C32(0x5ae00000), + SPH_C32(0x7e6f2100), SPH_C32(0x2f990000), SPH_C32(0x91010000), + SPH_C32(0x714b6a1d), SPH_C32(0x996a0f3c), SPH_C32(0xedf47c81), + SPH_C32(0x8a83a5ca) }, + { SPH_C32(0x2f440000), SPH_C32(0xbce40600), SPH_C32(0xbb3d0000), + SPH_C32(0x01f40000), SPH_C32(0x8a333dfd), SPH_C32(0xd0a40492), + SPH_C32(0xfa93b802), SPH_C32(0x245cc3b4), SPH_C32(0x56920000), + SPH_C32(0x378a2e00), SPH_C32(0x6de00000), SPH_C32(0xcdeb0000), + SPH_C32(0x42e15a07), SPH_C32(0x8ce82a28), SPH_C32(0x785737fa), + SPH_C32(0x3ec8a55a) }, + { SPH_C32(0x23360000), SPH_C32(0xf5010900), SPH_C32(0xf9440000), + SPH_C32(0x5d1e0000), SPH_C32(0xb9990de7), SPH_C32(0xc5262186), + SPH_C32(0x6f30f379), SPH_C32(0x9017c324), SPH_C32(0xa8b00000), + SPH_C32(0x90d22b00), SPH_C32(0x48310000), SPH_C32(0x3a8b0000), + SPH_C32(0xcbd022dd), SPH_C32(0x933cd248), SPH_C32(0x368794ef), + SPH_C32(0x9feb5ac5) }, + { SPH_C32(0x947e0000), SPH_C32(0xbe091400), SPH_C32(0x67860000), + SPH_C32(0xcddc0000), SPH_C32(0x1dce510b), SPH_C32(0xec636924), + SPH_C32(0xa2ffbda7), SPH_C32(0x5a4cc8f4), SPH_C32(0x1cff0000), + SPH_C32(0xcf462200), SPH_C32(0x3dd20000), SPH_C32(0x93d00000), + SPH_C32(0xdafb736b), SPH_C32(0x28f60619), SPH_C32(0xc500c982), + SPH_C32(0xee61b16b) }, + { SPH_C32(0x980c0000), SPH_C32(0xf7ec1b00), SPH_C32(0x25ff0000), + SPH_C32(0x91360000), SPH_C32(0x2e646111), SPH_C32(0xf9e14c30), + SPH_C32(0x375cf6dc), SPH_C32(0xee07c864), SPH_C32(0xe2dd0000), + SPH_C32(0x681e2700), SPH_C32(0x18030000), SPH_C32(0x64b00000), + SPH_C32(0x53ca0bb1), SPH_C32(0x3722fe79), SPH_C32(0x8bd06a97), + SPH_C32(0x4f424ef4) }, + { SPH_C32(0x6a5c0000), SPH_C32(0x19511100), SPH_C32(0x42570000), + SPH_C32(0x3abc0000), SPH_C32(0x94ff29d1), SPH_C32(0xf3b79144), + SPH_C32(0xec2f1eb2), SPH_C32(0xfb6f376b), SPH_C32(0xeeaf0000), + SPH_C32(0x21fb2800), SPH_C32(0x5a7a0000), SPH_C32(0x385a0000), + SPH_C32(0x60603bab), SPH_C32(0x22a0db6d), SPH_C32(0x1e7321ec), + SPH_C32(0xfb094e64) }, + { SPH_C32(0x662e0000), SPH_C32(0x50b41e00), SPH_C32(0x002e0000), + SPH_C32(0x66560000), SPH_C32(0xa75519cb), SPH_C32(0xe635b450), + SPH_C32(0x798c55c9), SPH_C32(0x4f2437fb), SPH_C32(0x108d0000), + SPH_C32(0x86a32d00), SPH_C32(0x7fab0000), SPH_C32(0xcf3a0000), + SPH_C32(0xe9514371), SPH_C32(0x3d74230d), SPH_C32(0x50a382f9), + SPH_C32(0x5a2ab1fb) }, + { SPH_C32(0x695b0000), SPH_C32(0x0dcd0500), SPH_C32(0xa9760000), + SPH_C32(0x03250000), SPH_C32(0x2183248b), SPH_C32(0x61380db7), + SPH_C32(0xd2670d01), SPH_C32(0x40bed715), SPH_C32(0x59e70000), + SPH_C32(0x6af33500), SPH_C32(0xc4b80000), SPH_C32(0xa8980000), + SPH_C32(0xc4376747), SPH_C32(0x0be593cf), SPH_C32(0xd3bc6f32), + SPH_C32(0x315245b4) }, + { SPH_C32(0x65290000), SPH_C32(0x44280a00), SPH_C32(0xeb0f0000), + SPH_C32(0x5fcf0000), SPH_C32(0x12291491), SPH_C32(0x74ba28a3), + SPH_C32(0x47c4467a), SPH_C32(0xf4f5d785), SPH_C32(0xa7c50000), + SPH_C32(0xcdab3000), SPH_C32(0xe1690000), SPH_C32(0x5ff80000), + SPH_C32(0x4d061f9d), SPH_C32(0x14316baf), SPH_C32(0x9d6ccc27), + SPH_C32(0x9071ba2b) }, + { SPH_C32(0x97790000), SPH_C32(0xaa950000), SPH_C32(0x8ca70000), + SPH_C32(0xf4450000), SPH_C32(0xa8b25c51), SPH_C32(0x7eecf5d7), + SPH_C32(0x9cb7ae14), SPH_C32(0xe19d288a), SPH_C32(0xabb70000), + SPH_C32(0x844e3f00), SPH_C32(0xa3100000), SPH_C32(0x03120000), + SPH_C32(0x7eac2f87), SPH_C32(0x01b34ebb), SPH_C32(0x08cf875c), + SPH_C32(0x243ababb) }, + { SPH_C32(0x9b0b0000), SPH_C32(0xe3700f00), SPH_C32(0xcede0000), + SPH_C32(0xa8af0000), SPH_C32(0x9b186c4b), SPH_C32(0x6b6ed0c3), + SPH_C32(0x0914e56f), SPH_C32(0x55d6281a), SPH_C32(0x55950000), + SPH_C32(0x23163a00), SPH_C32(0x86c10000), SPH_C32(0xf4720000), + SPH_C32(0xf79d575d), SPH_C32(0x1e67b6db), SPH_C32(0x461f2449), + SPH_C32(0x85194524) }, + { SPH_C32(0x2c430000), SPH_C32(0xa8781200), SPH_C32(0x501c0000), + SPH_C32(0x386d0000), SPH_C32(0x3f4f30a7), SPH_C32(0x422b9861), + SPH_C32(0xc4dbabb1), SPH_C32(0x9f8d23ca), SPH_C32(0xe1da0000), + SPH_C32(0x7c823300), SPH_C32(0xf3220000), SPH_C32(0x5d290000), + SPH_C32(0xe6b606eb), SPH_C32(0xa5ad628a), SPH_C32(0xb5987924), + SPH_C32(0xf493ae8a) }, + { SPH_C32(0x20310000), SPH_C32(0xe19d1d00), SPH_C32(0x12650000), + SPH_C32(0x64870000), SPH_C32(0x0ce500bd), SPH_C32(0x57a9bd75), + SPH_C32(0x5178e0ca), SPH_C32(0x2bc6235a), SPH_C32(0x1ff80000), + SPH_C32(0xdbda3600), SPH_C32(0xd6f30000), SPH_C32(0xaa490000), + SPH_C32(0x6f877e31), SPH_C32(0xba799aea), SPH_C32(0xfb48da31), + SPH_C32(0x55b05115) }, + { SPH_C32(0xd2610000), SPH_C32(0x0f201700), SPH_C32(0x75cd0000), + SPH_C32(0xcf0d0000), SPH_C32(0xb67e487d), SPH_C32(0x5dff6001), + SPH_C32(0x8a0b08a4), SPH_C32(0x3eaedc55), SPH_C32(0x138a0000), + SPH_C32(0x923f3900), SPH_C32(0x948a0000), SPH_C32(0xf6a30000), + SPH_C32(0x5c2d4e2b), SPH_C32(0xaffbbffe), SPH_C32(0x6eeb914a), + SPH_C32(0xe1fb5185) }, + { SPH_C32(0xde130000), SPH_C32(0x46c51800), SPH_C32(0x37b40000), + SPH_C32(0x93e70000), SPH_C32(0x85d47867), SPH_C32(0x487d4515), + SPH_C32(0x1fa843df), SPH_C32(0x8ae5dcc5), SPH_C32(0xeda80000), + SPH_C32(0x35673c00), SPH_C32(0xb15b0000), SPH_C32(0x01c30000), + SPH_C32(0xd51c36f1), SPH_C32(0xb02f479e), SPH_C32(0x203b325f), + SPH_C32(0x40d8ae1a) }, + { SPH_C32(0xa4c20000), SPH_C32(0xd9372400), SPH_C32(0x0a480000), + SPH_C32(0x66610000), SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), + SPH_C32(0xa324df94), SPH_C32(0x2ba05a55), SPH_C32(0x75a40000), + SPH_C32(0xc28b2700), SPH_C32(0x94a40000), SPH_C32(0x90f50000), + SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), SPH_C32(0x1767c483), + SPH_C32(0xaedf667e) }, + { SPH_C32(0xa8b00000), SPH_C32(0x90d22b00), SPH_C32(0x48310000), + SPH_C32(0x3a8b0000), SPH_C32(0xcbd022dd), SPH_C32(0x933cd248), + SPH_C32(0x368794ef), SPH_C32(0x9feb5ac5), SPH_C32(0x8b860000), + SPH_C32(0x65d32200), SPH_C32(0xb1750000), SPH_C32(0x67950000), + SPH_C32(0x72492f3a), SPH_C32(0x561af3ce), SPH_C32(0x59b76796), + SPH_C32(0x0ffc99e1) }, + { SPH_C32(0x5ae00000), SPH_C32(0x7e6f2100), SPH_C32(0x2f990000), + SPH_C32(0x91010000), SPH_C32(0x714b6a1d), SPH_C32(0x996a0f3c), + SPH_C32(0xedf47c81), SPH_C32(0x8a83a5ca), SPH_C32(0x87f40000), + SPH_C32(0x2c362d00), SPH_C32(0xf30c0000), SPH_C32(0x3b7f0000), + SPH_C32(0x41e31f20), SPH_C32(0x4398d6da), SPH_C32(0xcc142ced), + SPH_C32(0xbbb79971) }, + { SPH_C32(0x56920000), SPH_C32(0x378a2e00), SPH_C32(0x6de00000), + SPH_C32(0xcdeb0000), SPH_C32(0x42e15a07), SPH_C32(0x8ce82a28), + SPH_C32(0x785737fa), SPH_C32(0x3ec8a55a), SPH_C32(0x79d60000), + SPH_C32(0x8b6e2800), SPH_C32(0xd6dd0000), SPH_C32(0xcc1f0000), + SPH_C32(0xc8d267fa), SPH_C32(0x5c4c2eba), SPH_C32(0x82c48ff8), + SPH_C32(0x1a9466ee) }, + { SPH_C32(0xe1da0000), SPH_C32(0x7c823300), SPH_C32(0xf3220000), + SPH_C32(0x5d290000), SPH_C32(0xe6b606eb), SPH_C32(0xa5ad628a), + SPH_C32(0xb5987924), SPH_C32(0xf493ae8a), SPH_C32(0xcd990000), + SPH_C32(0xd4fa2100), SPH_C32(0xa33e0000), SPH_C32(0x65440000), + SPH_C32(0xd9f9364c), SPH_C32(0xe786faeb), SPH_C32(0x7143d295), + SPH_C32(0x6b1e8d40) }, + { SPH_C32(0xeda80000), SPH_C32(0x35673c00), SPH_C32(0xb15b0000), + SPH_C32(0x01c30000), SPH_C32(0xd51c36f1), SPH_C32(0xb02f479e), + SPH_C32(0x203b325f), SPH_C32(0x40d8ae1a), SPH_C32(0x33bb0000), + SPH_C32(0x73a22400), SPH_C32(0x86ef0000), SPH_C32(0x92240000), + SPH_C32(0x50c84e96), SPH_C32(0xf852028b), SPH_C32(0x3f937180), + SPH_C32(0xca3d72df) }, + { SPH_C32(0x1ff80000), SPH_C32(0xdbda3600), SPH_C32(0xd6f30000), + SPH_C32(0xaa490000), SPH_C32(0x6f877e31), SPH_C32(0xba799aea), + SPH_C32(0xfb48da31), SPH_C32(0x55b05115), SPH_C32(0x3fc90000), + SPH_C32(0x3a472b00), SPH_C32(0xc4960000), SPH_C32(0xcece0000), + SPH_C32(0x63627e8c), SPH_C32(0xedd0279f), SPH_C32(0xaa303afb), + SPH_C32(0x7e76724f) }, + { SPH_C32(0x138a0000), SPH_C32(0x923f3900), SPH_C32(0x948a0000), + SPH_C32(0xf6a30000), SPH_C32(0x5c2d4e2b), SPH_C32(0xaffbbffe), + SPH_C32(0x6eeb914a), SPH_C32(0xe1fb5185), SPH_C32(0xc1eb0000), + SPH_C32(0x9d1f2e00), SPH_C32(0xe1470000), SPH_C32(0x39ae0000), + SPH_C32(0xea530656), SPH_C32(0xf204dfff), SPH_C32(0xe4e099ee), + SPH_C32(0xdf558dd0) }, + { SPH_C32(0x1cff0000), SPH_C32(0xcf462200), SPH_C32(0x3dd20000), + SPH_C32(0x93d00000), SPH_C32(0xdafb736b), SPH_C32(0x28f60619), + SPH_C32(0xc500c982), SPH_C32(0xee61b16b), SPH_C32(0x88810000), + SPH_C32(0x714f3600), SPH_C32(0x5a540000), SPH_C32(0x5e0c0000), + SPH_C32(0xc7352260), SPH_C32(0xc4956f3d), SPH_C32(0x67ff7425), + SPH_C32(0xb42d799f) }, + { SPH_C32(0x108d0000), SPH_C32(0x86a32d00), SPH_C32(0x7fab0000), + SPH_C32(0xcf3a0000), SPH_C32(0xe9514371), SPH_C32(0x3d74230d), + SPH_C32(0x50a382f9), SPH_C32(0x5a2ab1fb), SPH_C32(0x76a30000), + SPH_C32(0xd6173300), SPH_C32(0x7f850000), SPH_C32(0xa96c0000), + SPH_C32(0x4e045aba), SPH_C32(0xdb41975d), SPH_C32(0x292fd730), + SPH_C32(0x150e8600) }, + { SPH_C32(0xe2dd0000), SPH_C32(0x681e2700), SPH_C32(0x18030000), + SPH_C32(0x64b00000), SPH_C32(0x53ca0bb1), SPH_C32(0x3722fe79), + SPH_C32(0x8bd06a97), SPH_C32(0x4f424ef4), SPH_C32(0x7ad10000), + SPH_C32(0x9ff23c00), SPH_C32(0x3dfc0000), SPH_C32(0xf5860000), + SPH_C32(0x7dae6aa0), SPH_C32(0xcec3b249), SPH_C32(0xbc8c9c4b), + SPH_C32(0xa1458690) }, + { SPH_C32(0xeeaf0000), SPH_C32(0x21fb2800), SPH_C32(0x5a7a0000), + SPH_C32(0x385a0000), SPH_C32(0x60603bab), SPH_C32(0x22a0db6d), + SPH_C32(0x1e7321ec), SPH_C32(0xfb094e64), SPH_C32(0x84f30000), + SPH_C32(0x38aa3900), SPH_C32(0x182d0000), SPH_C32(0x02e60000), + SPH_C32(0xf49f127a), SPH_C32(0xd1174a29), SPH_C32(0xf25c3f5e), + SPH_C32(0x0066790f) }, + { SPH_C32(0x59e70000), SPH_C32(0x6af33500), SPH_C32(0xc4b80000), + SPH_C32(0xa8980000), SPH_C32(0xc4376747), SPH_C32(0x0be593cf), + SPH_C32(0xd3bc6f32), SPH_C32(0x315245b4), SPH_C32(0x30bc0000), + SPH_C32(0x673e3000), SPH_C32(0x6dce0000), SPH_C32(0xabbd0000), + SPH_C32(0xe5b443cc), SPH_C32(0x6add9e78), SPH_C32(0x01db6233), + SPH_C32(0x71ec92a1) }, + { SPH_C32(0x55950000), SPH_C32(0x23163a00), SPH_C32(0x86c10000), + SPH_C32(0xf4720000), SPH_C32(0xf79d575d), SPH_C32(0x1e67b6db), + SPH_C32(0x461f2449), SPH_C32(0x85194524), SPH_C32(0xce9e0000), + SPH_C32(0xc0663500), SPH_C32(0x481f0000), SPH_C32(0x5cdd0000), + SPH_C32(0x6c853b16), SPH_C32(0x75096618), SPH_C32(0x4f0bc126), + SPH_C32(0xd0cf6d3e) }, + { SPH_C32(0xa7c50000), SPH_C32(0xcdab3000), SPH_C32(0xe1690000), + SPH_C32(0x5ff80000), SPH_C32(0x4d061f9d), SPH_C32(0x14316baf), + SPH_C32(0x9d6ccc27), SPH_C32(0x9071ba2b), SPH_C32(0xc2ec0000), + SPH_C32(0x89833a00), SPH_C32(0x0a660000), SPH_C32(0x00370000), + SPH_C32(0x5f2f0b0c), SPH_C32(0x608b430c), SPH_C32(0xdaa88a5d), + SPH_C32(0x64846dae) }, + { SPH_C32(0xabb70000), SPH_C32(0x844e3f00), SPH_C32(0xa3100000), + SPH_C32(0x03120000), SPH_C32(0x7eac2f87), SPH_C32(0x01b34ebb), + SPH_C32(0x08cf875c), SPH_C32(0x243ababb), SPH_C32(0x3cce0000), + SPH_C32(0x2edb3f00), SPH_C32(0x2fb70000), SPH_C32(0xf7570000), + SPH_C32(0xd61e73d6), SPH_C32(0x7f5fbb6c), SPH_C32(0x94782948), + SPH_C32(0xc5a79231) } +}; + +static const sph_u32 T512_24[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x14190000), SPH_C32(0x23ca003c), SPH_C32(0x50df0000), + SPH_C32(0x44b60000), SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), + SPH_C32(0x61e610b0), SPH_C32(0xdbcadb80), SPH_C32(0xe3430000), + SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), SPH_C32(0xaa4e0000), + SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), SPH_C32(0x123db156), + SPH_C32(0x3a4e99d7) }, + { SPH_C32(0xe3430000), SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), + SPH_C32(0xaa4e0000), SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), + SPH_C32(0x123db156), SPH_C32(0x3a4e99d7), SPH_C32(0xf75a0000), + SPH_C32(0x19840028), SPH_C32(0xa2190000), SPH_C32(0xeef80000), + SPH_C32(0xc0722516), SPH_C32(0x19981260), SPH_C32(0x73dba1e6), + SPH_C32(0xe1844257) }, + { SPH_C32(0xf75a0000), SPH_C32(0x19840028), SPH_C32(0xa2190000), + SPH_C32(0xeef80000), SPH_C32(0xc0722516), SPH_C32(0x19981260), + SPH_C32(0x73dba1e6), SPH_C32(0xe1844257), SPH_C32(0x14190000), + SPH_C32(0x23ca003c), SPH_C32(0x50df0000), SPH_C32(0x44b60000), + SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), SPH_C32(0x61e610b0), + SPH_C32(0xdbcadb80) }, + { SPH_C32(0x54500000), SPH_C32(0x0671005c), SPH_C32(0x25ae0000), + SPH_C32(0x6a1e0000), SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), + SPH_C32(0xbfba18c3), SPH_C32(0x7e715d17), SPH_C32(0xbc8d0000), + SPH_C32(0xfc3b0018), SPH_C32(0x19830000), SPH_C32(0xd10b0000), + SPH_C32(0xae1878c4), SPH_C32(0x42a69856), SPH_C32(0x0012da37), + SPH_C32(0x2c3b504e) }, + { SPH_C32(0x40490000), SPH_C32(0x25bb0060), SPH_C32(0x75710000), + SPH_C32(0x2ea80000), SPH_C32(0x35c9296f), SPH_C32(0x5abd2967), + SPH_C32(0xde5c0873), SPH_C32(0xa5bb8697), SPH_C32(0x5fce0000), + SPH_C32(0xc675000c), SPH_C32(0xeb450000), SPH_C32(0x7b450000), + SPH_C32(0x75063a62), SPH_C32(0x67cd2643), SPH_C32(0x122f6b61), + SPH_C32(0x1675c999) }, + { SPH_C32(0xb7130000), SPH_C32(0x3c3f0048), SPH_C32(0xd7680000), + SPH_C32(0xc0500000), SPH_C32(0xf5bb0c79), SPH_C32(0x43253b07), + SPH_C32(0xad87a995), SPH_C32(0x443fc4c0), SPH_C32(0x4bd70000), + SPH_C32(0xe5bf0030), SPH_C32(0xbb9a0000), SPH_C32(0x3ff30000), + SPH_C32(0x6e6a5dd2), SPH_C32(0x5b3e8a36), SPH_C32(0x73c97bd1), + SPH_C32(0xcdbf1219) }, + { SPH_C32(0xa30a0000), SPH_C32(0x1ff50074), SPH_C32(0x87b70000), + SPH_C32(0x84e60000), SPH_C32(0xeed76bc9), SPH_C32(0x7fd69772), + SPH_C32(0xcc61b925), SPH_C32(0x9ff51f40), SPH_C32(0xa8940000), + SPH_C32(0xdff10024), SPH_C32(0x495c0000), SPH_C32(0x95bd0000), + SPH_C32(0xb5741f74), SPH_C32(0x7e553423), SPH_C32(0x61f4ca87), + SPH_C32(0xf7f18bce) }, + { SPH_C32(0xbc8d0000), SPH_C32(0xfc3b0018), SPH_C32(0x19830000), + SPH_C32(0xd10b0000), SPH_C32(0xae1878c4), SPH_C32(0x42a69856), + SPH_C32(0x0012da37), SPH_C32(0x2c3b504e), SPH_C32(0xe8dd0000), + SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), SPH_C32(0xbb150000), + SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), SPH_C32(0xbfa8c2f4), + SPH_C32(0x524a0d59) }, + { SPH_C32(0xa8940000), SPH_C32(0xdff10024), SPH_C32(0x495c0000), + SPH_C32(0x95bd0000), SPH_C32(0xb5741f74), SPH_C32(0x7e553423), + SPH_C32(0x61f4ca87), SPH_C32(0xf7f18bce), SPH_C32(0x0b9e0000), + SPH_C32(0xc0040050), SPH_C32(0xceeb0000), SPH_C32(0x115b0000), + SPH_C32(0x5ba374bd), SPH_C32(0x0183a351), SPH_C32(0xad9573a2), + SPH_C32(0x6804948e) }, + { SPH_C32(0x5fce0000), SPH_C32(0xc675000c), SPH_C32(0xeb450000), + SPH_C32(0x7b450000), SPH_C32(0x75063a62), SPH_C32(0x67cd2643), + SPH_C32(0x122f6b61), SPH_C32(0x1675c999), SPH_C32(0x1f870000), + SPH_C32(0xe3ce006c), SPH_C32(0x9e340000), SPH_C32(0x55ed0000), + SPH_C32(0x40cf130d), SPH_C32(0x3d700f24), SPH_C32(0xcc736312), + SPH_C32(0xb3ce4f0e) }, + { SPH_C32(0x4bd70000), SPH_C32(0xe5bf0030), SPH_C32(0xbb9a0000), + SPH_C32(0x3ff30000), SPH_C32(0x6e6a5dd2), SPH_C32(0x5b3e8a36), + SPH_C32(0x73c97bd1), SPH_C32(0xcdbf1219), SPH_C32(0xfcc40000), + SPH_C32(0xd9800078), SPH_C32(0x6cf20000), SPH_C32(0xffa30000), + SPH_C32(0x9bd151ab), SPH_C32(0x181bb131), SPH_C32(0xde4ed244), + SPH_C32(0x8980d6d9) }, + { SPH_C32(0xe8dd0000), SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), + SPH_C32(0xbb150000), SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), + SPH_C32(0xbfa8c2f4), SPH_C32(0x524a0d59), SPH_C32(0x54500000), + SPH_C32(0x0671005c), SPH_C32(0x25ae0000), SPH_C32(0x6a1e0000), + SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), SPH_C32(0xbfba18c3), + SPH_C32(0x7e715d17) }, + { SPH_C32(0xfcc40000), SPH_C32(0xd9800078), SPH_C32(0x6cf20000), + SPH_C32(0xffa30000), SPH_C32(0x9bd151ab), SPH_C32(0x181bb131), + SPH_C32(0xde4ed244), SPH_C32(0x8980d6d9), SPH_C32(0xb7130000), + SPH_C32(0x3c3f0048), SPH_C32(0xd7680000), SPH_C32(0xc0500000), + SPH_C32(0xf5bb0c79), SPH_C32(0x43253b07), SPH_C32(0xad87a995), + SPH_C32(0x443fc4c0) }, + { SPH_C32(0x0b9e0000), SPH_C32(0xc0040050), SPH_C32(0xceeb0000), + SPH_C32(0x115b0000), SPH_C32(0x5ba374bd), SPH_C32(0x0183a351), + SPH_C32(0xad9573a2), SPH_C32(0x6804948e), SPH_C32(0xa30a0000), + SPH_C32(0x1ff50074), SPH_C32(0x87b70000), SPH_C32(0x84e60000), + SPH_C32(0xeed76bc9), SPH_C32(0x7fd69772), SPH_C32(0xcc61b925), + SPH_C32(0x9ff51f40) }, + { SPH_C32(0x1f870000), SPH_C32(0xe3ce006c), SPH_C32(0x9e340000), + SPH_C32(0x55ed0000), SPH_C32(0x40cf130d), SPH_C32(0x3d700f24), + SPH_C32(0xcc736312), SPH_C32(0xb3ce4f0e), SPH_C32(0x40490000), + SPH_C32(0x25bb0060), SPH_C32(0x75710000), SPH_C32(0x2ea80000), + SPH_C32(0x35c9296f), SPH_C32(0x5abd2967), SPH_C32(0xde5c0873), + SPH_C32(0xa5bb8697) }, + { SPH_C32(0x69510000), SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), + SPH_C32(0xac2f0000), SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), + SPH_C32(0x87ec287c), SPH_C32(0xbce1a3ce), SPH_C32(0xc6730000), + SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), SPH_C32(0x218d0000), + SPH_C32(0x23111587), SPH_C32(0x7913512f), SPH_C32(0x1d28ac88), + SPH_C32(0x378dd173) }, + { SPH_C32(0x7d480000), SPH_C32(0xf72b00a0), SPH_C32(0x93fc0000), + SPH_C32(0xe8990000), SPH_C32(0xfff96c1e), SPH_C32(0xf257b9a9), + SPH_C32(0xe60a38cc), SPH_C32(0x672b784e), SPH_C32(0x25300000), + SPH_C32(0x95c30018), SPH_C32(0x56070000), SPH_C32(0x8bc30000), + SPH_C32(0xf80f5721), SPH_C32(0x5c78ef3a), SPH_C32(0x0f151dde), + SPH_C32(0x0dc348a4) }, + { SPH_C32(0x8a120000), SPH_C32(0xeeaf0088), SPH_C32(0x31e50000), + SPH_C32(0x06610000), SPH_C32(0x3f8b4908), SPH_C32(0xebcfabc9), + SPH_C32(0x95d1992a), SPH_C32(0x86af3a19), SPH_C32(0x31290000), + SPH_C32(0xb6090024), SPH_C32(0x06d80000), SPH_C32(0xcf750000), + SPH_C32(0xe3633091), SPH_C32(0x608b434f), SPH_C32(0x6ef30d6e), + SPH_C32(0xd6099324) }, + { SPH_C32(0x9e0b0000), SPH_C32(0xcd6500b4), SPH_C32(0x613a0000), + SPH_C32(0x42d70000), SPH_C32(0x24e72eb8), SPH_C32(0xd73c07bc), + SPH_C32(0xf437899a), SPH_C32(0x5d65e199), SPH_C32(0xd26a0000), + SPH_C32(0x8c470030), SPH_C32(0xf41e0000), SPH_C32(0x653b0000), + SPH_C32(0x387d7237), SPH_C32(0x45e0fd5a), SPH_C32(0x7ccebc38), + SPH_C32(0xec470af3) }, + { SPH_C32(0x3d010000), SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), + SPH_C32(0xc6310000), SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), + SPH_C32(0x385630bf), SPH_C32(0xc290fed9), SPH_C32(0x7afe0000), + SPH_C32(0x53b60014), SPH_C32(0xbd420000), SPH_C32(0xf0860000), + SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), SPH_C32(0x1d3a76bf), + SPH_C32(0x1bb6813d) }, + { SPH_C32(0x29180000), SPH_C32(0xf15a00fc), SPH_C32(0xb6520000), + SPH_C32(0x82870000), SPH_C32(0xd15c22c1), SPH_C32(0x94193cbb), + SPH_C32(0x59b0200f), SPH_C32(0x195a2559), SPH_C32(0x99bd0000), + SPH_C32(0x69f80000), SPH_C32(0x4f840000), SPH_C32(0x5ac80000), + SPH_C32(0x56172fe5), SPH_C32(0x1ede776c), SPH_C32(0x0f07c7e9), + SPH_C32(0x21f818ea) }, + { SPH_C32(0xde420000), SPH_C32(0xe8de00d4), SPH_C32(0x144b0000), + SPH_C32(0x6c7f0000), SPH_C32(0x112e07d7), SPH_C32(0x8d812edb), + SPH_C32(0x2a6b81e9), SPH_C32(0xf8de670e), SPH_C32(0x8da40000), + SPH_C32(0x4a32003c), SPH_C32(0x1f5b0000), SPH_C32(0x1e7e0000), + SPH_C32(0x4d7b4855), SPH_C32(0x222ddb19), SPH_C32(0x6ee1d759), + SPH_C32(0xfa32c36a) }, + { SPH_C32(0xca5b0000), SPH_C32(0xcb1400e8), SPH_C32(0x44940000), + SPH_C32(0x28c90000), SPH_C32(0x0a426067), SPH_C32(0xb17282ae), + SPH_C32(0x4b8d9159), SPH_C32(0x2314bc8e), SPH_C32(0x6ee70000), + SPH_C32(0x707c0028), SPH_C32(0xed9d0000), SPH_C32(0xb4300000), + SPH_C32(0x96650af3), SPH_C32(0x0746650c), SPH_C32(0x7cdc660f), + SPH_C32(0xc07c5abd) }, + { SPH_C32(0xd5dc0000), SPH_C32(0x28da0084), SPH_C32(0xdaa00000), + SPH_C32(0x7d240000), SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), + SPH_C32(0x87fef24b), SPH_C32(0x90daf380), SPH_C32(0x2eae0000), + SPH_C32(0x55c70048), SPH_C32(0x98ec0000), SPH_C32(0x9a980000), + SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), SPH_C32(0xa2806e7c), + SPH_C32(0x65c7dc2a) }, + { SPH_C32(0xc1c50000), SPH_C32(0x0b1000b8), SPH_C32(0x8a7f0000), + SPH_C32(0x39920000), SPH_C32(0x51e114da), SPH_C32(0xb0f121ff), + SPH_C32(0xe618e2fb), SPH_C32(0x4b102800), SPH_C32(0xcded0000), + SPH_C32(0x6f89005c), SPH_C32(0x6a2a0000), SPH_C32(0x30d60000), + SPH_C32(0x78b2613a), SPH_C32(0x7890f27e), SPH_C32(0xb0bddf2a), + SPH_C32(0x5f8945fd) }, + { SPH_C32(0x369f0000), SPH_C32(0x12940090), SPH_C32(0x28660000), + SPH_C32(0xd76a0000), SPH_C32(0x919331cc), SPH_C32(0xa969339f), + SPH_C32(0x95c3431d), SPH_C32(0xaa946a57), SPH_C32(0xd9f40000), + SPH_C32(0x4c430060), SPH_C32(0x3af50000), SPH_C32(0x74600000), + SPH_C32(0x63de068a), SPH_C32(0x44635e0b), SPH_C32(0xd15bcf9a), + SPH_C32(0x84439e7d) }, + { SPH_C32(0x22860000), SPH_C32(0x315e00ac), SPH_C32(0x78b90000), + SPH_C32(0x93dc0000), SPH_C32(0x8aff567c), SPH_C32(0x959a9fea), + SPH_C32(0xf42553ad), SPH_C32(0x715eb1d7), SPH_C32(0x3ab70000), + SPH_C32(0x760d0074), SPH_C32(0xc8330000), SPH_C32(0xde2e0000), + SPH_C32(0xb8c0442c), SPH_C32(0x6108e01e), SPH_C32(0xc3667ecc), + SPH_C32(0xbe0d07aa) }, + { SPH_C32(0x818c0000), SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), + SPH_C32(0x173a0000), SPH_C32(0x64283db5), SPH_C32(0xea4c0898), + SPH_C32(0x3844ea88), SPH_C32(0xeeabae97), SPH_C32(0x92230000), + SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), SPH_C32(0x4b930000), + SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), SPH_C32(0xa292b44b), + SPH_C32(0x49fc8c64) }, + { SPH_C32(0x95950000), SPH_C32(0x0d6100e4), SPH_C32(0xafd10000), + SPH_C32(0x538c0000), SPH_C32(0x7f445a05), SPH_C32(0xd6bfa4ed), + SPH_C32(0x59a2fa38), SPH_C32(0x35617517), SPH_C32(0x71600000), + SPH_C32(0x93b20044), SPH_C32(0x73a90000), SPH_C32(0xe1dd0000), + SPH_C32(0xd6aa19fe), SPH_C32(0x3a366a28), SPH_C32(0xb0af051d), + SPH_C32(0x73b215b3) }, + { SPH_C32(0x62cf0000), SPH_C32(0x14e500cc), SPH_C32(0x0dc80000), + SPH_C32(0xbd740000), SPH_C32(0xbf367f13), SPH_C32(0xcf27b68d), + SPH_C32(0x2a795bde), SPH_C32(0xd4e53740), SPH_C32(0x65790000), + SPH_C32(0xb0780078), SPH_C32(0x23760000), SPH_C32(0xa56b0000), + SPH_C32(0xcdc67e4e), SPH_C32(0x06c5c65d), SPH_C32(0xd14915ad), + SPH_C32(0xa878ce33) }, + { SPH_C32(0x76d60000), SPH_C32(0x372f00f0), SPH_C32(0x5d170000), + SPH_C32(0xf9c20000), SPH_C32(0xa45a18a3), SPH_C32(0xf3d41af8), + SPH_C32(0x4b9f4b6e), SPH_C32(0x0f2fecc0), SPH_C32(0x863a0000), + SPH_C32(0x8a36006c), SPH_C32(0xd1b00000), SPH_C32(0x0f250000), + SPH_C32(0x16d83ce8), SPH_C32(0x23ae7848), SPH_C32(0xc374a4fb), + SPH_C32(0x923657e4) }, + { SPH_C32(0xc6730000), SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), + SPH_C32(0x218d0000), SPH_C32(0x23111587), SPH_C32(0x7913512f), + SPH_C32(0x1d28ac88), SPH_C32(0x378dd173), SPH_C32(0xaf220000), + SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), SPH_C32(0x8da20000), + SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), SPH_C32(0x9ac484f4), + SPH_C32(0x8b6c72bd) }, + { SPH_C32(0xd26a0000), SPH_C32(0x8c470030), SPH_C32(0xf41e0000), + SPH_C32(0x653b0000), SPH_C32(0x387d7237), SPH_C32(0x45e0fd5a), + SPH_C32(0x7ccebc38), SPH_C32(0xec470af3), SPH_C32(0x4c610000), + SPH_C32(0x41220084), SPH_C32(0x95240000), SPH_C32(0x27ec0000), + SPH_C32(0x1c9a5c8f), SPH_C32(0x92dcfae6), SPH_C32(0x88f935a2), + SPH_C32(0xb122eb6a) }, + { SPH_C32(0x25300000), SPH_C32(0x95c30018), SPH_C32(0x56070000), + SPH_C32(0x8bc30000), SPH_C32(0xf80f5721), SPH_C32(0x5c78ef3a), + SPH_C32(0x0f151dde), SPH_C32(0x0dc348a4), SPH_C32(0x58780000), + SPH_C32(0x62e800b8), SPH_C32(0xc5fb0000), SPH_C32(0x635a0000), + SPH_C32(0x07f63b3f), SPH_C32(0xae2f5693), SPH_C32(0xe91f2512), + SPH_C32(0x6ae830ea) }, + { SPH_C32(0x31290000), SPH_C32(0xb6090024), SPH_C32(0x06d80000), + SPH_C32(0xcf750000), SPH_C32(0xe3633091), SPH_C32(0x608b434f), + SPH_C32(0x6ef30d6e), SPH_C32(0xd6099324), SPH_C32(0xbb3b0000), + SPH_C32(0x58a600ac), SPH_C32(0x373d0000), SPH_C32(0xc9140000), + SPH_C32(0xdce87999), SPH_C32(0x8b44e886), SPH_C32(0xfb229444), + SPH_C32(0x50a6a93d) }, + { SPH_C32(0x92230000), SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), + SPH_C32(0x4b930000), SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), + SPH_C32(0xa292b44b), SPH_C32(0x49fc8c64), SPH_C32(0x13af0000), + SPH_C32(0x87570088), SPH_C32(0x7e610000), SPH_C32(0x5ca90000), + SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), SPH_C32(0x9ad65ec3), + SPH_C32(0xa75722f3) }, + { SPH_C32(0x863a0000), SPH_C32(0x8a36006c), SPH_C32(0xd1b00000), + SPH_C32(0x0f250000), SPH_C32(0x16d83ce8), SPH_C32(0x23ae7848), + SPH_C32(0xc374a4fb), SPH_C32(0x923657e4), SPH_C32(0xf0ec0000), + SPH_C32(0xbd19009c), SPH_C32(0x8ca70000), SPH_C32(0xf6e70000), + SPH_C32(0xb282244b), SPH_C32(0xd07a62b0), SPH_C32(0x88ebef95), + SPH_C32(0x9d19bb24) }, + { SPH_C32(0x71600000), SPH_C32(0x93b20044), SPH_C32(0x73a90000), + SPH_C32(0xe1dd0000), SPH_C32(0xd6aa19fe), SPH_C32(0x3a366a28), + SPH_C32(0xb0af051d), SPH_C32(0x73b215b3), SPH_C32(0xe4f50000), + SPH_C32(0x9ed300a0), SPH_C32(0xdc780000), SPH_C32(0xb2510000), + SPH_C32(0xa9ee43fb), SPH_C32(0xec89cec5), SPH_C32(0xe90dff25), + SPH_C32(0x46d360a4) }, + { SPH_C32(0x65790000), SPH_C32(0xb0780078), SPH_C32(0x23760000), + SPH_C32(0xa56b0000), SPH_C32(0xcdc67e4e), SPH_C32(0x06c5c65d), + SPH_C32(0xd14915ad), SPH_C32(0xa878ce33), SPH_C32(0x07b60000), + SPH_C32(0xa49d00b4), SPH_C32(0x2ebe0000), SPH_C32(0x181f0000), + SPH_C32(0x72f0015d), SPH_C32(0xc9e270d0), SPH_C32(0xfb304e73), + SPH_C32(0x7c9df973) }, + { SPH_C32(0x7afe0000), SPH_C32(0x53b60014), SPH_C32(0xbd420000), + SPH_C32(0xf0860000), SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), + SPH_C32(0x1d3a76bf), SPH_C32(0x1bb6813d), SPH_C32(0x47ff0000), + SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), SPH_C32(0x36b70000), + SPH_C32(0x47392832), SPH_C32(0x935f59b7), SPH_C32(0x256c4600), + SPH_C32(0xd9267fe4) }, + { SPH_C32(0x6ee70000), SPH_C32(0x707c0028), SPH_C32(0xed9d0000), + SPH_C32(0xb4300000), SPH_C32(0x96650af3), SPH_C32(0x0746650c), + SPH_C32(0x7cdc660f), SPH_C32(0xc07c5abd), SPH_C32(0xa4bc0000), + SPH_C32(0xbb6800c0), SPH_C32(0xa9090000), SPH_C32(0x9cf90000), + SPH_C32(0x9c276a94), SPH_C32(0xb634e7a2), SPH_C32(0x3751f756), + SPH_C32(0xe368e633) }, + { SPH_C32(0x99bd0000), SPH_C32(0x69f80000), SPH_C32(0x4f840000), + SPH_C32(0x5ac80000), SPH_C32(0x56172fe5), SPH_C32(0x1ede776c), + SPH_C32(0x0f07c7e9), SPH_C32(0x21f818ea), SPH_C32(0xb0a50000), + SPH_C32(0x98a200fc), SPH_C32(0xf9d60000), SPH_C32(0xd84f0000), + SPH_C32(0x874b0d24), SPH_C32(0x8ac74bd7), SPH_C32(0x56b7e7e6), + SPH_C32(0x38a23db3) }, + { SPH_C32(0x8da40000), SPH_C32(0x4a32003c), SPH_C32(0x1f5b0000), + SPH_C32(0x1e7e0000), SPH_C32(0x4d7b4855), SPH_C32(0x222ddb19), + SPH_C32(0x6ee1d759), SPH_C32(0xfa32c36a), SPH_C32(0x53e60000), + SPH_C32(0xa2ec00e8), SPH_C32(0x0b100000), SPH_C32(0x72010000), + SPH_C32(0x5c554f82), SPH_C32(0xafacf5c2), SPH_C32(0x448a56b0), + SPH_C32(0x02eca464) }, + { SPH_C32(0x2eae0000), SPH_C32(0x55c70048), SPH_C32(0x98ec0000), + SPH_C32(0x9a980000), SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), + SPH_C32(0xa2806e7c), SPH_C32(0x65c7dc2a), SPH_C32(0xfb720000), + SPH_C32(0x7d1d00cc), SPH_C32(0x424c0000), SPH_C32(0xe7bc0000), + SPH_C32(0xe92150f6), SPH_C32(0xd1f9c1e1), SPH_C32(0x257e9c37), + SPH_C32(0xf51d2faa) }, + { SPH_C32(0x3ab70000), SPH_C32(0x760d0074), SPH_C32(0xc8330000), + SPH_C32(0xde2e0000), SPH_C32(0xb8c0442c), SPH_C32(0x6108e01e), + SPH_C32(0xc3667ecc), SPH_C32(0xbe0d07aa), SPH_C32(0x18310000), + SPH_C32(0x475300d8), SPH_C32(0xb08a0000), SPH_C32(0x4df20000), + SPH_C32(0x323f1250), SPH_C32(0xf4927ff4), SPH_C32(0x37432d61), + SPH_C32(0xcf53b67d) }, + { SPH_C32(0xcded0000), SPH_C32(0x6f89005c), SPH_C32(0x6a2a0000), + SPH_C32(0x30d60000), SPH_C32(0x78b2613a), SPH_C32(0x7890f27e), + SPH_C32(0xb0bddf2a), SPH_C32(0x5f8945fd), SPH_C32(0x0c280000), + SPH_C32(0x649900e4), SPH_C32(0xe0550000), SPH_C32(0x09440000), + SPH_C32(0x295375e0), SPH_C32(0xc861d381), SPH_C32(0x56a53dd1), + SPH_C32(0x14996dfd) }, + { SPH_C32(0xd9f40000), SPH_C32(0x4c430060), SPH_C32(0x3af50000), + SPH_C32(0x74600000), SPH_C32(0x63de068a), SPH_C32(0x44635e0b), + SPH_C32(0xd15bcf9a), SPH_C32(0x84439e7d), SPH_C32(0xef6b0000), + SPH_C32(0x5ed700f0), SPH_C32(0x12930000), SPH_C32(0xa30a0000), + SPH_C32(0xf24d3746), SPH_C32(0xed0a6d94), SPH_C32(0x44988c87), + SPH_C32(0x2ed7f42a) }, + { SPH_C32(0xaf220000), SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), + SPH_C32(0x8da20000), SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), + SPH_C32(0x9ac484f4), SPH_C32(0x8b6c72bd), SPH_C32(0x69510000), + SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), SPH_C32(0xac2f0000), + SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), SPH_C32(0x87ec287c), + SPH_C32(0xbce1a3ce) }, + { SPH_C32(0xbb3b0000), SPH_C32(0x58a600ac), SPH_C32(0x373d0000), + SPH_C32(0xc9140000), SPH_C32(0xdce87999), SPH_C32(0x8b44e886), + SPH_C32(0xfb229444), SPH_C32(0x50a6a93d), SPH_C32(0x8a120000), + SPH_C32(0xeeaf0088), SPH_C32(0x31e50000), SPH_C32(0x06610000), + SPH_C32(0x3f8b4908), SPH_C32(0xebcfabc9), SPH_C32(0x95d1992a), + SPH_C32(0x86af3a19) }, + { SPH_C32(0x4c610000), SPH_C32(0x41220084), SPH_C32(0x95240000), + SPH_C32(0x27ec0000), SPH_C32(0x1c9a5c8f), SPH_C32(0x92dcfae6), + SPH_C32(0x88f935a2), SPH_C32(0xb122eb6a), SPH_C32(0x9e0b0000), + SPH_C32(0xcd6500b4), SPH_C32(0x613a0000), SPH_C32(0x42d70000), + SPH_C32(0x24e72eb8), SPH_C32(0xd73c07bc), SPH_C32(0xf437899a), + SPH_C32(0x5d65e199) }, + { SPH_C32(0x58780000), SPH_C32(0x62e800b8), SPH_C32(0xc5fb0000), + SPH_C32(0x635a0000), SPH_C32(0x07f63b3f), SPH_C32(0xae2f5693), + SPH_C32(0xe91f2512), SPH_C32(0x6ae830ea), SPH_C32(0x7d480000), + SPH_C32(0xf72b00a0), SPH_C32(0x93fc0000), SPH_C32(0xe8990000), + SPH_C32(0xfff96c1e), SPH_C32(0xf257b9a9), SPH_C32(0xe60a38cc), + SPH_C32(0x672b784e) }, + { SPH_C32(0xfb720000), SPH_C32(0x7d1d00cc), SPH_C32(0x424c0000), + SPH_C32(0xe7bc0000), SPH_C32(0xe92150f6), SPH_C32(0xd1f9c1e1), + SPH_C32(0x257e9c37), SPH_C32(0xf51d2faa), SPH_C32(0xd5dc0000), + SPH_C32(0x28da0084), SPH_C32(0xdaa00000), SPH_C32(0x7d240000), + SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), SPH_C32(0x87fef24b), + SPH_C32(0x90daf380) }, + { SPH_C32(0xef6b0000), SPH_C32(0x5ed700f0), SPH_C32(0x12930000), + SPH_C32(0xa30a0000), SPH_C32(0xf24d3746), SPH_C32(0xed0a6d94), + SPH_C32(0x44988c87), SPH_C32(0x2ed7f42a), SPH_C32(0x369f0000), + SPH_C32(0x12940090), SPH_C32(0x28660000), SPH_C32(0xd76a0000), + SPH_C32(0x919331cc), SPH_C32(0xa969339f), SPH_C32(0x95c3431d), + SPH_C32(0xaa946a57) }, + { SPH_C32(0x18310000), SPH_C32(0x475300d8), SPH_C32(0xb08a0000), + SPH_C32(0x4df20000), SPH_C32(0x323f1250), SPH_C32(0xf4927ff4), + SPH_C32(0x37432d61), SPH_C32(0xcf53b67d), SPH_C32(0x22860000), + SPH_C32(0x315e00ac), SPH_C32(0x78b90000), SPH_C32(0x93dc0000), + SPH_C32(0x8aff567c), SPH_C32(0x959a9fea), SPH_C32(0xf42553ad), + SPH_C32(0x715eb1d7) }, + { SPH_C32(0x0c280000), SPH_C32(0x649900e4), SPH_C32(0xe0550000), + SPH_C32(0x09440000), SPH_C32(0x295375e0), SPH_C32(0xc861d381), + SPH_C32(0x56a53dd1), SPH_C32(0x14996dfd), SPH_C32(0xc1c50000), + SPH_C32(0x0b1000b8), SPH_C32(0x8a7f0000), SPH_C32(0x39920000), + SPH_C32(0x51e114da), SPH_C32(0xb0f121ff), SPH_C32(0xe618e2fb), + SPH_C32(0x4b102800) }, + { SPH_C32(0x13af0000), SPH_C32(0x87570088), SPH_C32(0x7e610000), + SPH_C32(0x5ca90000), SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), + SPH_C32(0x9ad65ec3), SPH_C32(0xa75722f3), SPH_C32(0x818c0000), + SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), SPH_C32(0x173a0000), + SPH_C32(0x64283db5), SPH_C32(0xea4c0898), SPH_C32(0x3844ea88), + SPH_C32(0xeeabae97) }, + { SPH_C32(0x07b60000), SPH_C32(0xa49d00b4), SPH_C32(0x2ebe0000), + SPH_C32(0x181f0000), SPH_C32(0x72f0015d), SPH_C32(0xc9e270d0), + SPH_C32(0xfb304e73), SPH_C32(0x7c9df973), SPH_C32(0x62cf0000), + SPH_C32(0x14e500cc), SPH_C32(0x0dc80000), SPH_C32(0xbd740000), + SPH_C32(0xbf367f13), SPH_C32(0xcf27b68d), SPH_C32(0x2a795bde), + SPH_C32(0xd4e53740) }, + { SPH_C32(0xf0ec0000), SPH_C32(0xbd19009c), SPH_C32(0x8ca70000), + SPH_C32(0xf6e70000), SPH_C32(0xb282244b), SPH_C32(0xd07a62b0), + SPH_C32(0x88ebef95), SPH_C32(0x9d19bb24), SPH_C32(0x76d60000), + SPH_C32(0x372f00f0), SPH_C32(0x5d170000), SPH_C32(0xf9c20000), + SPH_C32(0xa45a18a3), SPH_C32(0xf3d41af8), SPH_C32(0x4b9f4b6e), + SPH_C32(0x0f2fecc0) }, + { SPH_C32(0xe4f50000), SPH_C32(0x9ed300a0), SPH_C32(0xdc780000), + SPH_C32(0xb2510000), SPH_C32(0xa9ee43fb), SPH_C32(0xec89cec5), + SPH_C32(0xe90dff25), SPH_C32(0x46d360a4), SPH_C32(0x95950000), + SPH_C32(0x0d6100e4), SPH_C32(0xafd10000), SPH_C32(0x538c0000), + SPH_C32(0x7f445a05), SPH_C32(0xd6bfa4ed), SPH_C32(0x59a2fa38), + SPH_C32(0x35617517) }, + { SPH_C32(0x47ff0000), SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), + SPH_C32(0x36b70000), SPH_C32(0x47392832), SPH_C32(0x935f59b7), + SPH_C32(0x256c4600), SPH_C32(0xd9267fe4), SPH_C32(0x3d010000), + SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), SPH_C32(0xc6310000), + SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), SPH_C32(0x385630bf), + SPH_C32(0xc290fed9) }, + { SPH_C32(0x53e60000), SPH_C32(0xa2ec00e8), SPH_C32(0x0b100000), + SPH_C32(0x72010000), SPH_C32(0x5c554f82), SPH_C32(0xafacf5c2), + SPH_C32(0x448a56b0), SPH_C32(0x02eca464), SPH_C32(0xde420000), + SPH_C32(0xe8de00d4), SPH_C32(0x144b0000), SPH_C32(0x6c7f0000), + SPH_C32(0x112e07d7), SPH_C32(0x8d812edb), SPH_C32(0x2a6b81e9), + SPH_C32(0xf8de670e) }, + { SPH_C32(0xa4bc0000), SPH_C32(0xbb6800c0), SPH_C32(0xa9090000), + SPH_C32(0x9cf90000), SPH_C32(0x9c276a94), SPH_C32(0xb634e7a2), + SPH_C32(0x3751f756), SPH_C32(0xe368e633), SPH_C32(0xca5b0000), + SPH_C32(0xcb1400e8), SPH_C32(0x44940000), SPH_C32(0x28c90000), + SPH_C32(0x0a426067), SPH_C32(0xb17282ae), SPH_C32(0x4b8d9159), + SPH_C32(0x2314bc8e) }, + { SPH_C32(0xb0a50000), SPH_C32(0x98a200fc), SPH_C32(0xf9d60000), + SPH_C32(0xd84f0000), SPH_C32(0x874b0d24), SPH_C32(0x8ac74bd7), + SPH_C32(0x56b7e7e6), SPH_C32(0x38a23db3), SPH_C32(0x29180000), + SPH_C32(0xf15a00fc), SPH_C32(0xb6520000), SPH_C32(0x82870000), + SPH_C32(0xd15c22c1), SPH_C32(0x94193cbb), SPH_C32(0x59b0200f), + SPH_C32(0x195a2559) } +}; + +static const sph_u32 T512_30[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xac480000), SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), + SPH_C32(0x03430000), SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), + SPH_C32(0xfe72c7fe), SPH_C32(0x91e478f6), SPH_C32(0x1e4e0000), + SPH_C32(0xdecf0000), SPH_C32(0x6df80180), SPH_C32(0x77240000), + SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), SPH_C32(0xcda31812), + SPH_C32(0x98aa496e) }, + { SPH_C32(0x1e4e0000), SPH_C32(0xdecf0000), SPH_C32(0x6df80180), + SPH_C32(0x77240000), SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), + SPH_C32(0xcda31812), SPH_C32(0x98aa496e), SPH_C32(0xb2060000), + SPH_C32(0xc5690000), SPH_C32(0x28031200), SPH_C32(0x74670000), + SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), SPH_C32(0x33d1dfec), + SPH_C32(0x094e3198) }, + { SPH_C32(0xb2060000), SPH_C32(0xc5690000), SPH_C32(0x28031200), + SPH_C32(0x74670000), SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), + SPH_C32(0x33d1dfec), SPH_C32(0x094e3198), SPH_C32(0xac480000), + SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), SPH_C32(0x03430000), + SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), SPH_C32(0xfe72c7fe), + SPH_C32(0x91e478f6) }, + { SPH_C32(0xaec30000), SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), + SPH_C32(0x2c150000), SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), + SPH_C32(0xab92f78f), SPH_C32(0xa312567b), SPH_C32(0xdb250000), + SPH_C32(0x09290000), SPH_C32(0x49aac000), SPH_C32(0x81e10000), + SPH_C32(0xcafe6b59), SPH_C32(0x42793431), SPH_C32(0x43566b76), + SPH_C32(0xe86cba2e) }, + { SPH_C32(0x028b0000), SPH_C32(0x87e90001), SPH_C32(0x3c2af380), + SPH_C32(0x2f560000), SPH_C32(0x1f4944d9), SPH_C32(0x79e2e780), + SPH_C32(0x55e03071), SPH_C32(0x32f62e8d), SPH_C32(0xc56b0000), + SPH_C32(0xd7e60000), SPH_C32(0x2452c180), SPH_C32(0xf6c50000), + SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), SPH_C32(0x8ef57364), + SPH_C32(0x70c6f340) }, + { SPH_C32(0xb08d0000), SPH_C32(0x42800001), SPH_C32(0x1429e180), + SPH_C32(0x5b310000), SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), + SPH_C32(0x6631ef9d), SPH_C32(0x3bb81f15), SPH_C32(0x69230000), + SPH_C32(0xcc400000), SPH_C32(0x61a9d200), SPH_C32(0xf5860000), + SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), SPH_C32(0x7087b49a), + SPH_C32(0xe1228bb6) }, + { SPH_C32(0x1cc50000), SPH_C32(0x59260001), SPH_C32(0x51d2f200), + SPH_C32(0x58720000), SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), + SPH_C32(0x98432863), SPH_C32(0xaa5c67e3), SPH_C32(0x776d0000), + SPH_C32(0x128f0000), SPH_C32(0x0c51d380), SPH_C32(0x82a20000), + SPH_C32(0x907b5a33), SPH_C32(0x5dcb6487), SPH_C32(0xbd24ac88), + SPH_C32(0x7988c2d8) }, + { SPH_C32(0xdb250000), SPH_C32(0x09290000), SPH_C32(0x49aac000), + SPH_C32(0x81e10000), SPH_C32(0xcafe6b59), SPH_C32(0x42793431), + SPH_C32(0x43566b76), SPH_C32(0xe86cba2e), SPH_C32(0x75e60000), + SPH_C32(0x95660001), SPH_C32(0x307b2000), SPH_C32(0xadf40000), + SPH_C32(0x8f321eea), SPH_C32(0x24298307), SPH_C32(0xe8c49cf9), + SPH_C32(0x4b7eec55) }, + { SPH_C32(0x776d0000), SPH_C32(0x128f0000), SPH_C32(0x0c51d380), + SPH_C32(0x82a20000), SPH_C32(0x907b5a33), SPH_C32(0x5dcb6487), + SPH_C32(0xbd24ac88), SPH_C32(0x7988c2d8), SPH_C32(0x6ba80000), + SPH_C32(0x4ba90001), SPH_C32(0x5d832180), SPH_C32(0xdad00000), + SPH_C32(0x63751974), SPH_C32(0xd089ea49), SPH_C32(0x256784eb), + SPH_C32(0xd3d4a53b) }, + { SPH_C32(0xc56b0000), SPH_C32(0xd7e60000), SPH_C32(0x2452c180), + SPH_C32(0xf6c50000), SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), + SPH_C32(0x8ef57364), SPH_C32(0x70c6f340), SPH_C32(0xc7e00000), + SPH_C32(0x500f0001), SPH_C32(0x18783200), SPH_C32(0xd9930000), + SPH_C32(0x39f0281e), SPH_C32(0xcf3bbaff), SPH_C32(0xdb154315), + SPH_C32(0x4230ddcd) }, + { SPH_C32(0x69230000), SPH_C32(0xcc400000), SPH_C32(0x61a9d200), + SPH_C32(0xf5860000), SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), + SPH_C32(0x7087b49a), SPH_C32(0xe1228bb6), SPH_C32(0xd9ae0000), + SPH_C32(0x8ec00001), SPH_C32(0x75803380), SPH_C32(0xaeb70000), + SPH_C32(0xd5b72f80), SPH_C32(0x3b9bd3b1), SPH_C32(0x16b65b07), + SPH_C32(0xda9a94a3) }, + { SPH_C32(0x75e60000), SPH_C32(0x95660001), SPH_C32(0x307b2000), + SPH_C32(0xadf40000), SPH_C32(0x8f321eea), SPH_C32(0x24298307), + SPH_C32(0xe8c49cf9), SPH_C32(0x4b7eec55), SPH_C32(0xaec30000), + SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), SPH_C32(0x2c150000), + SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), SPH_C32(0xab92f78f), + SPH_C32(0xa312567b) }, + { SPH_C32(0xd9ae0000), SPH_C32(0x8ec00001), SPH_C32(0x75803380), + SPH_C32(0xaeb70000), SPH_C32(0xd5b72f80), SPH_C32(0x3b9bd3b1), + SPH_C32(0x16b65b07), SPH_C32(0xda9a94a3), SPH_C32(0xb08d0000), + SPH_C32(0x42800001), SPH_C32(0x1429e180), SPH_C32(0x5b310000), + SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), SPH_C32(0x6631ef9d), + SPH_C32(0x3bb81f15) }, + { SPH_C32(0x6ba80000), SPH_C32(0x4ba90001), SPH_C32(0x5d832180), + SPH_C32(0xdad00000), SPH_C32(0x63751974), SPH_C32(0xd089ea49), + SPH_C32(0x256784eb), SPH_C32(0xd3d4a53b), SPH_C32(0x1cc50000), + SPH_C32(0x59260001), SPH_C32(0x51d2f200), SPH_C32(0x58720000), + SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), SPH_C32(0x98432863), + SPH_C32(0xaa5c67e3) }, + { SPH_C32(0xc7e00000), SPH_C32(0x500f0001), SPH_C32(0x18783200), + SPH_C32(0xd9930000), SPH_C32(0x39f0281e), SPH_C32(0xcf3bbaff), + SPH_C32(0xdb154315), SPH_C32(0x4230ddcd), SPH_C32(0x028b0000), + SPH_C32(0x87e90001), SPH_C32(0x3c2af380), SPH_C32(0x2f560000), + SPH_C32(0x1f4944d9), SPH_C32(0x79e2e780), SPH_C32(0x55e03071), + SPH_C32(0x32f62e8d) }, + { SPH_C32(0x86790000), SPH_C32(0x3f390002), SPH_C32(0xe19ae000), + SPH_C32(0x98560000), SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), + SPH_C32(0xd3dd4944), SPH_C32(0x161ddab9), SPH_C32(0x30b70000), + SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), SPH_C32(0x42c40000), + SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), SPH_C32(0x21afa1ea), + SPH_C32(0xb0a51834) }, + { SPH_C32(0x2a310000), SPH_C32(0x249f0002), SPH_C32(0xa461f380), + SPH_C32(0x9b150000), SPH_C32(0xcfe05664), SPH_C32(0x513a985c), + SPH_C32(0x2daf8eba), SPH_C32(0x87f9a24f), SPH_C32(0x2ef90000), + SPH_C32(0x3b1f0000), SPH_C32(0x990c6180), SPH_C32(0x35e00000), + SPH_C32(0x8fff3af4), SPH_C32(0x8c1afd2e), SPH_C32(0xec0cb9f8), + SPH_C32(0x280f515a) }, + { SPH_C32(0x98370000), SPH_C32(0xe1f60002), SPH_C32(0x8c62e180), + SPH_C32(0xef720000), SPH_C32(0x79226090), SPH_C32(0xba28a1a4), + SPH_C32(0x1e7e5156), SPH_C32(0x8eb793d7), SPH_C32(0x82b10000), + SPH_C32(0x20b90000), SPH_C32(0xdcf77200), SPH_C32(0x36a30000), + SPH_C32(0xd57a0b9e), SPH_C32(0x93a8ad98), SPH_C32(0x127e7e06), + SPH_C32(0xb9eb29ac) }, + { SPH_C32(0x347f0000), SPH_C32(0xfa500002), SPH_C32(0xc999f200), + SPH_C32(0xec310000), SPH_C32(0x23a751fa), SPH_C32(0xa59af112), + SPH_C32(0xe00c96a8), SPH_C32(0x1f53eb21), SPH_C32(0x9cff0000), + SPH_C32(0xfe760000), SPH_C32(0xb10f7380), SPH_C32(0x41870000), + SPH_C32(0x393d0c00), SPH_C32(0x6708c4d6), SPH_C32(0xdfdd6614), + SPH_C32(0x214160c2) }, + { SPH_C32(0x28ba0000), SPH_C32(0xa3760003), SPH_C32(0x984b0000), + SPH_C32(0xb4430000), SPH_C32(0xd0a912bd), SPH_C32(0x28d87fdc), + SPH_C32(0x784fbecb), SPH_C32(0xb50f8cc2), SPH_C32(0xeb920000), + SPH_C32(0xecf90000), SPH_C32(0xbd5ea000), SPH_C32(0xc3250000), + SPH_C32(0xa9465633), SPH_C32(0x3ac3a051), SPH_C32(0x62f9ca9c), + SPH_C32(0x58c9a21a) }, + { SPH_C32(0x84f20000), SPH_C32(0xb8d00003), SPH_C32(0xddb01380), + SPH_C32(0xb7000000), SPH_C32(0x8a2c23d7), SPH_C32(0x376a2f6a), + SPH_C32(0x863d7935), SPH_C32(0x24ebf434), SPH_C32(0xf5dc0000), + SPH_C32(0x32360000), SPH_C32(0xd0a6a180), SPH_C32(0xb4010000), + SPH_C32(0x450151ad), SPH_C32(0xce63c91f), SPH_C32(0xaf5ad28e), + SPH_C32(0xc063eb74) }, + { SPH_C32(0x36f40000), SPH_C32(0x7db90003), SPH_C32(0xf5b30180), + SPH_C32(0xc3670000), SPH_C32(0x3cee1523), SPH_C32(0xdc781692), + SPH_C32(0xb5eca6d9), SPH_C32(0x2da5c5ac), SPH_C32(0x59940000), + SPH_C32(0x29900000), SPH_C32(0x955db200), SPH_C32(0xb7420000), + SPH_C32(0x1f8460c7), SPH_C32(0xd1d199a9), SPH_C32(0x51281570), + SPH_C32(0x51879382) }, + { SPH_C32(0x9abc0000), SPH_C32(0x661f0003), SPH_C32(0xb0481200), + SPH_C32(0xc0240000), SPH_C32(0x666b2449), SPH_C32(0xc3ca4624), + SPH_C32(0x4b9e6127), SPH_C32(0xbc41bd5a), SPH_C32(0x47da0000), + SPH_C32(0xf75f0000), SPH_C32(0xf8a5b380), SPH_C32(0xc0660000), + SPH_C32(0xf3c36759), SPH_C32(0x2571f0e7), SPH_C32(0x9c8b0d62), + SPH_C32(0xc92ddaec) }, + { SPH_C32(0x5d5c0000), SPH_C32(0x36100002), SPH_C32(0xa8302000), + SPH_C32(0x19b70000), SPH_C32(0x5f9b0c57), SPH_C32(0x0cf1fcdb), + SPH_C32(0x908b2232), SPH_C32(0xfe716097), SPH_C32(0x45510000), + SPH_C32(0x70b60001), SPH_C32(0xc48f4000), SPH_C32(0xef300000), + SPH_C32(0xec8a2380), SPH_C32(0x5c931767), SPH_C32(0xc96b3d13), + SPH_C32(0xfbdbf461) }, + { SPH_C32(0xf1140000), SPH_C32(0x2db60002), SPH_C32(0xedcb3380), + SPH_C32(0x1af40000), SPH_C32(0x051e3d3d), SPH_C32(0x1343ac6d), + SPH_C32(0x6ef9e5cc), SPH_C32(0x6f951861), SPH_C32(0x5b1f0000), + SPH_C32(0xae790001), SPH_C32(0xa9774180), SPH_C32(0x98140000), + SPH_C32(0x00cd241e), SPH_C32(0xa8337e29), SPH_C32(0x04c82501), + SPH_C32(0x6371bd0f) }, + { SPH_C32(0x43120000), SPH_C32(0xe8df0002), SPH_C32(0xc5c82180), + SPH_C32(0x6e930000), SPH_C32(0xb3dc0bc9), SPH_C32(0xf8519595), + SPH_C32(0x5d283a20), SPH_C32(0x66db29f9), SPH_C32(0xf7570000), + SPH_C32(0xb5df0001), SPH_C32(0xec8c5200), SPH_C32(0x9b570000), + SPH_C32(0x5a481574), SPH_C32(0xb7812e9f), SPH_C32(0xfabae2ff), + SPH_C32(0xf295c5f9) }, + { SPH_C32(0xef5a0000), SPH_C32(0xf3790002), SPH_C32(0x80333200), + SPH_C32(0x6dd00000), SPH_C32(0xe9593aa3), SPH_C32(0xe7e3c523), + SPH_C32(0xa35afdde), SPH_C32(0xf73f510f), SPH_C32(0xe9190000), + SPH_C32(0x6b100001), SPH_C32(0x81745380), SPH_C32(0xec730000), + SPH_C32(0xb60f12ea), SPH_C32(0x432147d1), SPH_C32(0x3719faed), + SPH_C32(0x6a3f8c97) }, + { SPH_C32(0xf39f0000), SPH_C32(0xaa5f0003), SPH_C32(0xd1e1c000), + SPH_C32(0x35a20000), SPH_C32(0x1a5779e4), SPH_C32(0x6aa14bed), + SPH_C32(0x3b19d5bd), SPH_C32(0x5d6336ec), SPH_C32(0x9e740000), + SPH_C32(0x799f0001), SPH_C32(0x8d258000), SPH_C32(0x6ed10000), + SPH_C32(0x267448d9), SPH_C32(0x1eea2356), SPH_C32(0x8a3d5665), + SPH_C32(0x13b74e4f) }, + { SPH_C32(0x5fd70000), SPH_C32(0xb1f90003), SPH_C32(0x941ad380), + SPH_C32(0x36e10000), SPH_C32(0x40d2488e), SPH_C32(0x75131b5b), + SPH_C32(0xc56b1243), SPH_C32(0xcc874e1a), SPH_C32(0x803a0000), + SPH_C32(0xa7500001), SPH_C32(0xe0dd8180), SPH_C32(0x19f50000), + SPH_C32(0xca334f47), SPH_C32(0xea4a4a18), SPH_C32(0x479e4e77), + SPH_C32(0x8b1d0721) }, + { SPH_C32(0xedd10000), SPH_C32(0x74900003), SPH_C32(0xbc19c180), + SPH_C32(0x42860000), SPH_C32(0xf6107e7a), SPH_C32(0x9e0122a3), + SPH_C32(0xf6bacdaf), SPH_C32(0xc5c97f82), SPH_C32(0x2c720000), + SPH_C32(0xbcf60001), SPH_C32(0xa5269200), SPH_C32(0x1ab60000), + SPH_C32(0x90b67e2d), SPH_C32(0xf5f81aae), SPH_C32(0xb9ec8989), + SPH_C32(0x1af97fd7) }, + { SPH_C32(0x41990000), SPH_C32(0x6f360003), SPH_C32(0xf9e2d200), + SPH_C32(0x41c50000), SPH_C32(0xac954f10), SPH_C32(0x81b37215), + SPH_C32(0x08c80a51), SPH_C32(0x542d0774), SPH_C32(0x323c0000), + SPH_C32(0x62390001), SPH_C32(0xc8de9380), SPH_C32(0x6d920000), + SPH_C32(0x7cf179b3), SPH_C32(0x015873e0), SPH_C32(0x744f919b), + SPH_C32(0x825336b9) }, + { SPH_C32(0x30b70000), SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), + SPH_C32(0x42c40000), SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), + SPH_C32(0x21afa1ea), SPH_C32(0xb0a51834), SPH_C32(0xb6ce0000), + SPH_C32(0xdae90002), SPH_C32(0x156e8000), SPH_C32(0xda920000), + SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), SPH_C32(0xf272e8ae), + SPH_C32(0xa6b8c28d) }, + { SPH_C32(0x9cff0000), SPH_C32(0xfe760000), SPH_C32(0xb10f7380), + SPH_C32(0x41870000), SPH_C32(0x393d0c00), SPH_C32(0x6708c4d6), + SPH_C32(0xdfdd6614), SPH_C32(0x214160c2), SPH_C32(0xa8800000), + SPH_C32(0x04260002), SPH_C32(0x78968180), SPH_C32(0xadb60000), + SPH_C32(0x1a9a5dfa), SPH_C32(0xc29235c4), SPH_C32(0x3fd1f0bc), + SPH_C32(0x3e128be3) }, + { SPH_C32(0x2ef90000), SPH_C32(0x3b1f0000), SPH_C32(0x990c6180), + SPH_C32(0x35e00000), SPH_C32(0x8fff3af4), SPH_C32(0x8c1afd2e), + SPH_C32(0xec0cb9f8), SPH_C32(0x280f515a), SPH_C32(0x04c80000), + SPH_C32(0x1f800002), SPH_C32(0x3d6d9200), SPH_C32(0xaef50000), + SPH_C32(0x401f6c90), SPH_C32(0xdd206572), SPH_C32(0xc1a33742), + SPH_C32(0xaff6f315) }, + { SPH_C32(0x82b10000), SPH_C32(0x20b90000), SPH_C32(0xdcf77200), + SPH_C32(0x36a30000), SPH_C32(0xd57a0b9e), SPH_C32(0x93a8ad98), + SPH_C32(0x127e7e06), SPH_C32(0xb9eb29ac), SPH_C32(0x1a860000), + SPH_C32(0xc14f0002), SPH_C32(0x50959380), SPH_C32(0xd9d10000), + SPH_C32(0xac586b0e), SPH_C32(0x29800c3c), SPH_C32(0x0c002f50), + SPH_C32(0x375cba7b) }, + { SPH_C32(0x9e740000), SPH_C32(0x799f0001), SPH_C32(0x8d258000), + SPH_C32(0x6ed10000), SPH_C32(0x267448d9), SPH_C32(0x1eea2356), + SPH_C32(0x8a3d5665), SPH_C32(0x13b74e4f), SPH_C32(0x6deb0000), + SPH_C32(0xd3c00002), SPH_C32(0x5cc44000), SPH_C32(0x5b730000), + SPH_C32(0x3c23313d), SPH_C32(0x744b68bb), SPH_C32(0xb12483d8), + SPH_C32(0x4ed478a3) }, + { SPH_C32(0x323c0000), SPH_C32(0x62390001), SPH_C32(0xc8de9380), + SPH_C32(0x6d920000), SPH_C32(0x7cf179b3), SPH_C32(0x015873e0), + SPH_C32(0x744f919b), SPH_C32(0x825336b9), SPH_C32(0x73a50000), + SPH_C32(0x0d0f0002), SPH_C32(0x313c4180), SPH_C32(0x2c570000), + SPH_C32(0xd06436a3), SPH_C32(0x80eb01f5), SPH_C32(0x7c879bca), + SPH_C32(0xd67e31cd) }, + { SPH_C32(0x803a0000), SPH_C32(0xa7500001), SPH_C32(0xe0dd8180), + SPH_C32(0x19f50000), SPH_C32(0xca334f47), SPH_C32(0xea4a4a18), + SPH_C32(0x479e4e77), SPH_C32(0x8b1d0721), SPH_C32(0xdfed0000), + SPH_C32(0x16a90002), SPH_C32(0x74c75200), SPH_C32(0x2f140000), + SPH_C32(0x8ae107c9), SPH_C32(0x9f595143), SPH_C32(0x82f55c34), + SPH_C32(0x479a493b) }, + { SPH_C32(0x2c720000), SPH_C32(0xbcf60001), SPH_C32(0xa5269200), + SPH_C32(0x1ab60000), SPH_C32(0x90b67e2d), SPH_C32(0xf5f81aae), + SPH_C32(0xb9ec8989), SPH_C32(0x1af97fd7), SPH_C32(0xc1a30000), + SPH_C32(0xc8660002), SPH_C32(0x193f5380), SPH_C32(0x58300000), + SPH_C32(0x66a60057), SPH_C32(0x6bf9380d), SPH_C32(0x4f564426), + SPH_C32(0xdf300055) }, + { SPH_C32(0xeb920000), SPH_C32(0xecf90000), SPH_C32(0xbd5ea000), + SPH_C32(0xc3250000), SPH_C32(0xa9465633), SPH_C32(0x3ac3a051), + SPH_C32(0x62f9ca9c), SPH_C32(0x58c9a21a), SPH_C32(0xc3280000), + SPH_C32(0x4f8f0003), SPH_C32(0x2515a000), SPH_C32(0x77660000), + SPH_C32(0x79ef448e), SPH_C32(0x121bdf8d), SPH_C32(0x1ab67457), + SPH_C32(0xedc62ed8) }, + { SPH_C32(0x47da0000), SPH_C32(0xf75f0000), SPH_C32(0xf8a5b380), + SPH_C32(0xc0660000), SPH_C32(0xf3c36759), SPH_C32(0x2571f0e7), + SPH_C32(0x9c8b0d62), SPH_C32(0xc92ddaec), SPH_C32(0xdd660000), + SPH_C32(0x91400003), SPH_C32(0x48eda180), SPH_C32(0x00420000), + SPH_C32(0x95a84310), SPH_C32(0xe6bbb6c3), SPH_C32(0xd7156c45), + SPH_C32(0x756c67b6) }, + { SPH_C32(0xf5dc0000), SPH_C32(0x32360000), SPH_C32(0xd0a6a180), + SPH_C32(0xb4010000), SPH_C32(0x450151ad), SPH_C32(0xce63c91f), + SPH_C32(0xaf5ad28e), SPH_C32(0xc063eb74), SPH_C32(0x712e0000), + SPH_C32(0x8ae60003), SPH_C32(0x0d16b200), SPH_C32(0x03010000), + SPH_C32(0xcf2d727a), SPH_C32(0xf909e675), SPH_C32(0x2967abbb), + SPH_C32(0xe4881f40) }, + { SPH_C32(0x59940000), SPH_C32(0x29900000), SPH_C32(0x955db200), + SPH_C32(0xb7420000), SPH_C32(0x1f8460c7), SPH_C32(0xd1d199a9), + SPH_C32(0x51281570), SPH_C32(0x51879382), SPH_C32(0x6f600000), + SPH_C32(0x54290003), SPH_C32(0x60eeb380), SPH_C32(0x74250000), + SPH_C32(0x236a75e4), SPH_C32(0x0da98f3b), SPH_C32(0xe4c4b3a9), + SPH_C32(0x7c22562e) }, + { SPH_C32(0x45510000), SPH_C32(0x70b60001), SPH_C32(0xc48f4000), + SPH_C32(0xef300000), SPH_C32(0xec8a2380), SPH_C32(0x5c931767), + SPH_C32(0xc96b3d13), SPH_C32(0xfbdbf461), SPH_C32(0x180d0000), + SPH_C32(0x46a60003), SPH_C32(0x6cbf6000), SPH_C32(0xf6870000), + SPH_C32(0xb3112fd7), SPH_C32(0x5062ebbc), SPH_C32(0x59e01f21), + SPH_C32(0x05aa94f6) }, + { SPH_C32(0xe9190000), SPH_C32(0x6b100001), SPH_C32(0x81745380), + SPH_C32(0xec730000), SPH_C32(0xb60f12ea), SPH_C32(0x432147d1), + SPH_C32(0x3719faed), SPH_C32(0x6a3f8c97), SPH_C32(0x06430000), + SPH_C32(0x98690003), SPH_C32(0x01476180), SPH_C32(0x81a30000), + SPH_C32(0x5f562849), SPH_C32(0xa4c282f2), SPH_C32(0x94430733), + SPH_C32(0x9d00dd98) }, + { SPH_C32(0x5b1f0000), SPH_C32(0xae790001), SPH_C32(0xa9774180), + SPH_C32(0x98140000), SPH_C32(0x00cd241e), SPH_C32(0xa8337e29), + SPH_C32(0x04c82501), SPH_C32(0x6371bd0f), SPH_C32(0xaa0b0000), + SPH_C32(0x83cf0003), SPH_C32(0x44bc7200), SPH_C32(0x82e00000), + SPH_C32(0x05d31923), SPH_C32(0xbb70d244), SPH_C32(0x6a31c0cd), + SPH_C32(0x0ce4a56e) }, + { SPH_C32(0xf7570000), SPH_C32(0xb5df0001), SPH_C32(0xec8c5200), + SPH_C32(0x9b570000), SPH_C32(0x5a481574), SPH_C32(0xb7812e9f), + SPH_C32(0xfabae2ff), SPH_C32(0xf295c5f9), SPH_C32(0xb4450000), + SPH_C32(0x5d000003), SPH_C32(0x29447380), SPH_C32(0xf5c40000), + SPH_C32(0xe9941ebd), SPH_C32(0x4fd0bb0a), SPH_C32(0xa792d8df), + SPH_C32(0x944eec00) }, + { SPH_C32(0xb6ce0000), SPH_C32(0xdae90002), SPH_C32(0x156e8000), + SPH_C32(0xda920000), SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), + SPH_C32(0xf272e8ae), SPH_C32(0xa6b8c28d), SPH_C32(0x86790000), + SPH_C32(0x3f390002), SPH_C32(0xe19ae000), SPH_C32(0x98560000), + SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), SPH_C32(0xd3dd4944), + SPH_C32(0x161ddab9) }, + { SPH_C32(0x1a860000), SPH_C32(0xc14f0002), SPH_C32(0x50959380), + SPH_C32(0xd9d10000), SPH_C32(0xac586b0e), SPH_C32(0x29800c3c), + SPH_C32(0x0c002f50), SPH_C32(0x375cba7b), SPH_C32(0x98370000), + SPH_C32(0xe1f60002), SPH_C32(0x8c62e180), SPH_C32(0xef720000), + SPH_C32(0x79226090), SPH_C32(0xba28a1a4), SPH_C32(0x1e7e5156), + SPH_C32(0x8eb793d7) }, + { SPH_C32(0xa8800000), SPH_C32(0x04260002), SPH_C32(0x78968180), + SPH_C32(0xadb60000), SPH_C32(0x1a9a5dfa), SPH_C32(0xc29235c4), + SPH_C32(0x3fd1f0bc), SPH_C32(0x3e128be3), SPH_C32(0x347f0000), + SPH_C32(0xfa500002), SPH_C32(0xc999f200), SPH_C32(0xec310000), + SPH_C32(0x23a751fa), SPH_C32(0xa59af112), SPH_C32(0xe00c96a8), + SPH_C32(0x1f53eb21) }, + { SPH_C32(0x04c80000), SPH_C32(0x1f800002), SPH_C32(0x3d6d9200), + SPH_C32(0xaef50000), SPH_C32(0x401f6c90), SPH_C32(0xdd206572), + SPH_C32(0xc1a33742), SPH_C32(0xaff6f315), SPH_C32(0x2a310000), + SPH_C32(0x249f0002), SPH_C32(0xa461f380), SPH_C32(0x9b150000), + SPH_C32(0xcfe05664), SPH_C32(0x513a985c), SPH_C32(0x2daf8eba), + SPH_C32(0x87f9a24f) }, + { SPH_C32(0x180d0000), SPH_C32(0x46a60003), SPH_C32(0x6cbf6000), + SPH_C32(0xf6870000), SPH_C32(0xb3112fd7), SPH_C32(0x5062ebbc), + SPH_C32(0x59e01f21), SPH_C32(0x05aa94f6), SPH_C32(0x5d5c0000), + SPH_C32(0x36100002), SPH_C32(0xa8302000), SPH_C32(0x19b70000), + SPH_C32(0x5f9b0c57), SPH_C32(0x0cf1fcdb), SPH_C32(0x908b2232), + SPH_C32(0xfe716097) }, + { SPH_C32(0xb4450000), SPH_C32(0x5d000003), SPH_C32(0x29447380), + SPH_C32(0xf5c40000), SPH_C32(0xe9941ebd), SPH_C32(0x4fd0bb0a), + SPH_C32(0xa792d8df), SPH_C32(0x944eec00), SPH_C32(0x43120000), + SPH_C32(0xe8df0002), SPH_C32(0xc5c82180), SPH_C32(0x6e930000), + SPH_C32(0xb3dc0bc9), SPH_C32(0xf8519595), SPH_C32(0x5d283a20), + SPH_C32(0x66db29f9) }, + { SPH_C32(0x06430000), SPH_C32(0x98690003), SPH_C32(0x01476180), + SPH_C32(0x81a30000), SPH_C32(0x5f562849), SPH_C32(0xa4c282f2), + SPH_C32(0x94430733), SPH_C32(0x9d00dd98), SPH_C32(0xef5a0000), + SPH_C32(0xf3790002), SPH_C32(0x80333200), SPH_C32(0x6dd00000), + SPH_C32(0xe9593aa3), SPH_C32(0xe7e3c523), SPH_C32(0xa35afdde), + SPH_C32(0xf73f510f) }, + { SPH_C32(0xaa0b0000), SPH_C32(0x83cf0003), SPH_C32(0x44bc7200), + SPH_C32(0x82e00000), SPH_C32(0x05d31923), SPH_C32(0xbb70d244), + SPH_C32(0x6a31c0cd), SPH_C32(0x0ce4a56e), SPH_C32(0xf1140000), + SPH_C32(0x2db60002), SPH_C32(0xedcb3380), SPH_C32(0x1af40000), + SPH_C32(0x051e3d3d), SPH_C32(0x1343ac6d), SPH_C32(0x6ef9e5cc), + SPH_C32(0x6f951861) }, + { SPH_C32(0x6deb0000), SPH_C32(0xd3c00002), SPH_C32(0x5cc44000), + SPH_C32(0x5b730000), SPH_C32(0x3c23313d), SPH_C32(0x744b68bb), + SPH_C32(0xb12483d8), SPH_C32(0x4ed478a3), SPH_C32(0xf39f0000), + SPH_C32(0xaa5f0003), SPH_C32(0xd1e1c000), SPH_C32(0x35a20000), + SPH_C32(0x1a5779e4), SPH_C32(0x6aa14bed), SPH_C32(0x3b19d5bd), + SPH_C32(0x5d6336ec) }, + { SPH_C32(0xc1a30000), SPH_C32(0xc8660002), SPH_C32(0x193f5380), + SPH_C32(0x58300000), SPH_C32(0x66a60057), SPH_C32(0x6bf9380d), + SPH_C32(0x4f564426), SPH_C32(0xdf300055), SPH_C32(0xedd10000), + SPH_C32(0x74900003), SPH_C32(0xbc19c180), SPH_C32(0x42860000), + SPH_C32(0xf6107e7a), SPH_C32(0x9e0122a3), SPH_C32(0xf6bacdaf), + SPH_C32(0xc5c97f82) }, + { SPH_C32(0x73a50000), SPH_C32(0x0d0f0002), SPH_C32(0x313c4180), + SPH_C32(0x2c570000), SPH_C32(0xd06436a3), SPH_C32(0x80eb01f5), + SPH_C32(0x7c879bca), SPH_C32(0xd67e31cd), SPH_C32(0x41990000), + SPH_C32(0x6f360003), SPH_C32(0xf9e2d200), SPH_C32(0x41c50000), + SPH_C32(0xac954f10), SPH_C32(0x81b37215), SPH_C32(0x08c80a51), + SPH_C32(0x542d0774) }, + { SPH_C32(0xdfed0000), SPH_C32(0x16a90002), SPH_C32(0x74c75200), + SPH_C32(0x2f140000), SPH_C32(0x8ae107c9), SPH_C32(0x9f595143), + SPH_C32(0x82f55c34), SPH_C32(0x479a493b), SPH_C32(0x5fd70000), + SPH_C32(0xb1f90003), SPH_C32(0x941ad380), SPH_C32(0x36e10000), + SPH_C32(0x40d2488e), SPH_C32(0x75131b5b), SPH_C32(0xc56b1243), + SPH_C32(0xcc874e1a) }, + { SPH_C32(0xc3280000), SPH_C32(0x4f8f0003), SPH_C32(0x2515a000), + SPH_C32(0x77660000), SPH_C32(0x79ef448e), SPH_C32(0x121bdf8d), + SPH_C32(0x1ab67457), SPH_C32(0xedc62ed8), SPH_C32(0x28ba0000), + SPH_C32(0xa3760003), SPH_C32(0x984b0000), SPH_C32(0xb4430000), + SPH_C32(0xd0a912bd), SPH_C32(0x28d87fdc), SPH_C32(0x784fbecb), + SPH_C32(0xb50f8cc2) }, + { SPH_C32(0x6f600000), SPH_C32(0x54290003), SPH_C32(0x60eeb380), + SPH_C32(0x74250000), SPH_C32(0x236a75e4), SPH_C32(0x0da98f3b), + SPH_C32(0xe4c4b3a9), SPH_C32(0x7c22562e), SPH_C32(0x36f40000), + SPH_C32(0x7db90003), SPH_C32(0xf5b30180), SPH_C32(0xc3670000), + SPH_C32(0x3cee1523), SPH_C32(0xdc781692), SPH_C32(0xb5eca6d9), + SPH_C32(0x2da5c5ac) }, + { SPH_C32(0xdd660000), SPH_C32(0x91400003), SPH_C32(0x48eda180), + SPH_C32(0x00420000), SPH_C32(0x95a84310), SPH_C32(0xe6bbb6c3), + SPH_C32(0xd7156c45), SPH_C32(0x756c67b6), SPH_C32(0x9abc0000), + SPH_C32(0x661f0003), SPH_C32(0xb0481200), SPH_C32(0xc0240000), + SPH_C32(0x666b2449), SPH_C32(0xc3ca4624), SPH_C32(0x4b9e6127), + SPH_C32(0xbc41bd5a) }, + { SPH_C32(0x712e0000), SPH_C32(0x8ae60003), SPH_C32(0x0d16b200), + SPH_C32(0x03010000), SPH_C32(0xcf2d727a), SPH_C32(0xf909e675), + SPH_C32(0x2967abbb), SPH_C32(0xe4881f40), SPH_C32(0x84f20000), + SPH_C32(0xb8d00003), SPH_C32(0xddb01380), SPH_C32(0xb7000000), + SPH_C32(0x8a2c23d7), SPH_C32(0x376a2f6a), SPH_C32(0x863d7935), + SPH_C32(0x24ebf434) } +}; + +static const sph_u32 T512_36[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x52500000), SPH_C32(0x29540000), SPH_C32(0x6a61004e), + SPH_C32(0xf0ff0000), SPH_C32(0x9a317eec), SPH_C32(0x452341ce), + SPH_C32(0xcf568fe5), SPH_C32(0x5303130f), SPH_C32(0x538d0000), + SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), SPH_C32(0x56ff0000), + SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), SPH_C32(0xa9444018), + SPH_C32(0x7f975691) }, + { SPH_C32(0x538d0000), SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), + SPH_C32(0x56ff0000), SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), + SPH_C32(0xa9444018), SPH_C32(0x7f975691), SPH_C32(0x01dd0000), + SPH_C32(0x80a80000), SPH_C32(0xf4960048), SPH_C32(0xa6000000), + SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), SPH_C32(0x6612cffd), + SPH_C32(0x2c94459e) }, + { SPH_C32(0x01dd0000), SPH_C32(0x80a80000), SPH_C32(0xf4960048), + SPH_C32(0xa6000000), SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), + SPH_C32(0x6612cffd), SPH_C32(0x2c94459e), SPH_C32(0x52500000), + SPH_C32(0x29540000), SPH_C32(0x6a61004e), SPH_C32(0xf0ff0000), + SPH_C32(0x9a317eec), SPH_C32(0x452341ce), SPH_C32(0xcf568fe5), + SPH_C32(0x5303130f) }, + { SPH_C32(0xcc140000), SPH_C32(0xa5630000), SPH_C32(0x5ab90780), + SPH_C32(0x3b500000), SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), + SPH_C32(0x694348c1), SPH_C32(0xca5a87fe), SPH_C32(0x819e0000), + SPH_C32(0xec570000), SPH_C32(0x66320280), SPH_C32(0x95f30000), + SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), SPH_C32(0xe65aa22d), + SPH_C32(0x8e67b7fa) }, + { SPH_C32(0x9e440000), SPH_C32(0x8c370000), SPH_C32(0x30d807ce), + SPH_C32(0xcbaf0000), SPH_C32(0xd1e16d13), SPH_C32(0xc2b875d6), + SPH_C32(0xa615c724), SPH_C32(0x995994f1), SPH_C32(0xd2130000), + SPH_C32(0x45ab0000), SPH_C32(0xf8c50286), SPH_C32(0xc30c0000), + SPH_C32(0x574d284c), SPH_C32(0xda31f145), SPH_C32(0x4f1ee235), + SPH_C32(0xf1f0e16b) }, + { SPH_C32(0x9f990000), SPH_C32(0x0c9f0000), SPH_C32(0xc44e0786), + SPH_C32(0x6daf0000), SPH_C32(0x413413b1), SPH_C32(0x155ef9e1), + SPH_C32(0xc00708d9), SPH_C32(0xb5cdd16f), SPH_C32(0x80430000), + SPH_C32(0x6cff0000), SPH_C32(0x92a402c8), SPH_C32(0x33f30000), + SPH_C32(0xcd7c56a0), SPH_C32(0x9f12b08b), SPH_C32(0x80486dd0), + SPH_C32(0xa2f3f264) }, + { SPH_C32(0xcdc90000), SPH_C32(0x25cb0000), SPH_C32(0xae2f07c8), + SPH_C32(0x9d500000), SPH_C32(0xdb056d5d), SPH_C32(0x507db82f), + SPH_C32(0x0f51873c), SPH_C32(0xe6cec260), SPH_C32(0xd3ce0000), + SPH_C32(0xc5030000), SPH_C32(0x0c5302ce), SPH_C32(0x650c0000), + SPH_C32(0xc79856ee), SPH_C32(0x0dd77d72), SPH_C32(0x290c2dc8), + SPH_C32(0xdd64a4f5) }, + { SPH_C32(0x819e0000), SPH_C32(0xec570000), SPH_C32(0x66320280), + SPH_C32(0x95f30000), SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), + SPH_C32(0xe65aa22d), SPH_C32(0x8e67b7fa), SPH_C32(0x4d8a0000), + SPH_C32(0x49340000), SPH_C32(0x3c8b0500), SPH_C32(0xaea30000), + SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), SPH_C32(0x8f19eaec), + SPH_C32(0x443d3004) }, + { SPH_C32(0xd3ce0000), SPH_C32(0xc5030000), SPH_C32(0x0c5302ce), + SPH_C32(0x650c0000), SPH_C32(0xc79856ee), SPH_C32(0x0dd77d72), + SPH_C32(0x290c2dc8), SPH_C32(0xdd64a4f5), SPH_C32(0x1e070000), + SPH_C32(0xe0c80000), SPH_C32(0xa27c0506), SPH_C32(0xf85c0000), + SPH_C32(0x1c9d3bb3), SPH_C32(0x5daac55d), SPH_C32(0x265daaf4), + SPH_C32(0x3baa6695) }, + { SPH_C32(0xd2130000), SPH_C32(0x45ab0000), SPH_C32(0xf8c50286), + SPH_C32(0xc30c0000), SPH_C32(0x574d284c), SPH_C32(0xda31f145), + SPH_C32(0x4f1ee235), SPH_C32(0xf1f0e16b), SPH_C32(0x4c570000), + SPH_C32(0xc99c0000), SPH_C32(0xc81d0548), SPH_C32(0x08a30000), + SPH_C32(0x86ac455f), SPH_C32(0x18898493), SPH_C32(0xe90b2511), + SPH_C32(0x68a9759a) }, + { SPH_C32(0x80430000), SPH_C32(0x6cff0000), SPH_C32(0x92a402c8), + SPH_C32(0x33f30000), SPH_C32(0xcd7c56a0), SPH_C32(0x9f12b08b), + SPH_C32(0x80486dd0), SPH_C32(0xa2f3f264), SPH_C32(0x1fda0000), + SPH_C32(0x60600000), SPH_C32(0x56ea054e), SPH_C32(0x5e5c0000), + SPH_C32(0x8c484511), SPH_C32(0x8a4c496a), SPH_C32(0x404f6509), + SPH_C32(0x173e230b) }, + { SPH_C32(0x4d8a0000), SPH_C32(0x49340000), SPH_C32(0x3c8b0500), + SPH_C32(0xaea30000), SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), + SPH_C32(0x8f19eaec), SPH_C32(0x443d3004), SPH_C32(0xcc140000), + SPH_C32(0xa5630000), SPH_C32(0x5ab90780), SPH_C32(0x3b500000), + SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), SPH_C32(0x694348c1), + SPH_C32(0xca5a87fe) }, + { SPH_C32(0x1fda0000), SPH_C32(0x60600000), SPH_C32(0x56ea054e), + SPH_C32(0x5e5c0000), SPH_C32(0x8c484511), SPH_C32(0x8a4c496a), + SPH_C32(0x404f6509), SPH_C32(0x173e230b), SPH_C32(0x9f990000), + SPH_C32(0x0c9f0000), SPH_C32(0xc44e0786), SPH_C32(0x6daf0000), + SPH_C32(0x413413b1), SPH_C32(0x155ef9e1), SPH_C32(0xc00708d9), + SPH_C32(0xb5cdd16f) }, + { SPH_C32(0x1e070000), SPH_C32(0xe0c80000), SPH_C32(0xa27c0506), + SPH_C32(0xf85c0000), SPH_C32(0x1c9d3bb3), SPH_C32(0x5daac55d), + SPH_C32(0x265daaf4), SPH_C32(0x3baa6695), SPH_C32(0xcdc90000), + SPH_C32(0x25cb0000), SPH_C32(0xae2f07c8), SPH_C32(0x9d500000), + SPH_C32(0xdb056d5d), SPH_C32(0x507db82f), SPH_C32(0x0f51873c), + SPH_C32(0xe6cec260) }, + { SPH_C32(0x4c570000), SPH_C32(0xc99c0000), SPH_C32(0xc81d0548), + SPH_C32(0x08a30000), SPH_C32(0x86ac455f), SPH_C32(0x18898493), + SPH_C32(0xe90b2511), SPH_C32(0x68a9759a), SPH_C32(0x9e440000), + SPH_C32(0x8c370000), SPH_C32(0x30d807ce), SPH_C32(0xcbaf0000), + SPH_C32(0xd1e16d13), SPH_C32(0xc2b875d6), SPH_C32(0xa615c724), + SPH_C32(0x995994f1) }, + { SPH_C32(0x78230000), SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), + SPH_C32(0x90a50000), SPH_C32(0x713e2879), SPH_C32(0x7ee98924), + SPH_C32(0xf08ca062), SPH_C32(0x636f8bab), SPH_C32(0x02af0000), + SPH_C32(0xb7280000), SPH_C32(0xba1c0300), SPH_C32(0x56980000), + SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), SPH_C32(0xa95c149a), + SPH_C32(0xf4f6ea7b) }, + { SPH_C32(0x2a730000), SPH_C32(0x3ba80000), SPH_C32(0xc35b0bce), + SPH_C32(0x605a0000), SPH_C32(0xeb0f5695), SPH_C32(0x3bcac8ea), + SPH_C32(0x3fda2f87), SPH_C32(0x306c98a4), SPH_C32(0x51220000), + SPH_C32(0x1ed40000), SPH_C32(0x24eb0306), SPH_C32(0x00670000), + SPH_C32(0xb069459d), SPH_C32(0x128d0b9e), SPH_C32(0x00185482), + SPH_C32(0x8b61bcea) }, + { SPH_C32(0x2bae0000), SPH_C32(0xbb000000), SPH_C32(0x37cd0b86), + SPH_C32(0xc65a0000), SPH_C32(0x7bda2837), SPH_C32(0xec2c44dd), + SPH_C32(0x59c8e07a), SPH_C32(0x1cf8dd3a), SPH_C32(0x03720000), + SPH_C32(0x37800000), SPH_C32(0x4e8a0348), SPH_C32(0xf0980000), + SPH_C32(0x2a583b71), SPH_C32(0x57ae4a50), SPH_C32(0xcf4edb67), + SPH_C32(0xd862afe5) }, + { SPH_C32(0x79fe0000), SPH_C32(0x92540000), SPH_C32(0x5dac0bc8), + SPH_C32(0x36a50000), SPH_C32(0xe1eb56db), SPH_C32(0xa90f0513), + SPH_C32(0x969e6f9f), SPH_C32(0x4ffbce35), SPH_C32(0x50ff0000), + SPH_C32(0x9e7c0000), SPH_C32(0xd07d034e), SPH_C32(0xa6670000), + SPH_C32(0x20bc3b3f), SPH_C32(0xc56b87a9), SPH_C32(0x660a9b7f), + SPH_C32(0xa7f5f974) }, + { SPH_C32(0xb4370000), SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), + SPH_C32(0xabf50000), SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), + SPH_C32(0x99cfe8a3), SPH_C32(0xa9350c55), SPH_C32(0x83310000), + SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), SPH_C32(0xc36b0000), + SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), SPH_C32(0x4f06b6b7), + SPH_C32(0x7a915d81) }, + { SPH_C32(0xe6670000), SPH_C32(0x9ecb0000), SPH_C32(0x99e20c4e), + SPH_C32(0x5b0a0000), SPH_C32(0xa0df456a), SPH_C32(0xbc51fcf2), + SPH_C32(0x56996746), SPH_C32(0xfa361f5a), SPH_C32(0xd0bc0000), + SPH_C32(0xf2830000), SPH_C32(0x42d90186), SPH_C32(0x95940000), + SPH_C32(0xedc06d9f), SPH_C32(0x5a793722), SPH_C32(0xe642f6af), + SPH_C32(0x05060b10) }, + { SPH_C32(0xe7ba0000), SPH_C32(0x1e630000), SPH_C32(0x6d740c06), + SPH_C32(0xfd0a0000), SPH_C32(0x300a3bc8), SPH_C32(0x6bb770c5), + SPH_C32(0x308ba8bb), SPH_C32(0xd6a25ac4), SPH_C32(0x82ec0000), + SPH_C32(0xdbd70000), SPH_C32(0x28b801c8), SPH_C32(0x656b0000), + SPH_C32(0x77f11373), SPH_C32(0x1f5a76ec), SPH_C32(0x2914794a), + SPH_C32(0x5605181f) }, + { SPH_C32(0xb5ea0000), SPH_C32(0x37370000), SPH_C32(0x07150c48), + SPH_C32(0x0df50000), SPH_C32(0xaa3b4524), SPH_C32(0x2e94310b), + SPH_C32(0xffdd275e), SPH_C32(0x85a149cb), SPH_C32(0xd1610000), + SPH_C32(0x722b0000), SPH_C32(0xb64f01ce), SPH_C32(0x33940000), + SPH_C32(0x7d15133d), SPH_C32(0x8d9fbb15), SPH_C32(0x80503952), + SPH_C32(0x29924e8e) }, + { SPH_C32(0xf9bd0000), SPH_C32(0xfeab0000), SPH_C32(0xcf080900), + SPH_C32(0x05560000), SPH_C32(0x2c97007b), SPH_C32(0x361db598), + SPH_C32(0x16d6024f), SPH_C32(0xed083c51), SPH_C32(0x4f250000), + SPH_C32(0xfe1c0000), SPH_C32(0x86970600), SPH_C32(0xf83b0000), + SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), SPH_C32(0x2645fe76), + SPH_C32(0xb0cbda7f) }, + { SPH_C32(0xabed0000), SPH_C32(0xd7ff0000), SPH_C32(0xa569094e), + SPH_C32(0xf5a90000), SPH_C32(0xb6a67e97), SPH_C32(0x733ef456), + SPH_C32(0xd9808daa), SPH_C32(0xbe0b2f5e), SPH_C32(0x1ca80000), + SPH_C32(0x57e00000), SPH_C32(0x18600606), SPH_C32(0xaec40000), + SPH_C32(0xa6107e60), SPH_C32(0xdde2033a), SPH_C32(0x8f01be6e), + SPH_C32(0xcf5c8cee) }, + { SPH_C32(0xaa300000), SPH_C32(0x57570000), SPH_C32(0x51ff0906), + SPH_C32(0x53a90000), SPH_C32(0x26730035), SPH_C32(0xa4d87861), + SPH_C32(0xbf924257), SPH_C32(0x929f6ac0), SPH_C32(0x4ef80000), + SPH_C32(0x7eb40000), SPH_C32(0x72010648), SPH_C32(0x5e3b0000), + SPH_C32(0x3c21008c), SPH_C32(0x98c142f4), SPH_C32(0x4057318b), + SPH_C32(0x9c5f9fe1) }, + { SPH_C32(0xf8600000), SPH_C32(0x7e030000), SPH_C32(0x3b9e0948), + SPH_C32(0xa3560000), SPH_C32(0xbc427ed9), SPH_C32(0xe1fb39af), + SPH_C32(0x70c4cdb2), SPH_C32(0xc19c79cf), SPH_C32(0x1d750000), + SPH_C32(0xd7480000), SPH_C32(0xecf6064e), SPH_C32(0x08c40000), + SPH_C32(0x36c500c2), SPH_C32(0x0a048f0d), SPH_C32(0xe9137193), + SPH_C32(0xe3c8c970) }, + { SPH_C32(0x35a90000), SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), + SPH_C32(0x3e060000), SPH_C32(0x67471384), SPH_C32(0xb1868180), + SPH_C32(0x7f954a8e), SPH_C32(0x2752bbaf), SPH_C32(0xcebb0000), + SPH_C32(0x124b0000), SPH_C32(0xe0a50480), SPH_C32(0x6dc80000), + SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), SPH_C32(0xc01f5c5b), + SPH_C32(0x3eac6d85) }, + { SPH_C32(0x67f90000), SPH_C32(0x729c0000), SPH_C32(0xffd00ece), + SPH_C32(0xcef90000), SPH_C32(0xfd766d68), SPH_C32(0xf4a5c04e), + SPH_C32(0xb0c3c56b), SPH_C32(0x7451a8a0), SPH_C32(0x9d360000), + SPH_C32(0xbbb70000), SPH_C32(0x7e520486), SPH_C32(0x3b370000), + SPH_C32(0xfbb95662), SPH_C32(0x95163f86), SPH_C32(0x695b1c43), + SPH_C32(0x413b3b14) }, + { SPH_C32(0x66240000), SPH_C32(0xf2340000), SPH_C32(0x0b460e86), + SPH_C32(0x68f90000), SPH_C32(0x6da313ca), SPH_C32(0x23434c79), + SPH_C32(0xd6d10a96), SPH_C32(0x58c5ed3e), SPH_C32(0xcf660000), + SPH_C32(0x92e30000), SPH_C32(0x143304c8), SPH_C32(0xcbc80000), + SPH_C32(0x6188288e), SPH_C32(0xd0357e48), SPH_C32(0xa60d93a6), + SPH_C32(0x1238281b) }, + { SPH_C32(0x34740000), SPH_C32(0xdb600000), SPH_C32(0x61270ec8), + SPH_C32(0x98060000), SPH_C32(0xf7926d26), SPH_C32(0x66600db7), + SPH_C32(0x19878573), SPH_C32(0x0bc6fe31), SPH_C32(0x9ceb0000), + SPH_C32(0x3b1f0000), SPH_C32(0x8ac404ce), SPH_C32(0x9d370000), + SPH_C32(0x6b6c28c0), SPH_C32(0x42f0b3b1), SPH_C32(0x0f49d3be), + SPH_C32(0x6daf7e8a) }, + { SPH_C32(0x02af0000), SPH_C32(0xb7280000), SPH_C32(0xba1c0300), + SPH_C32(0x56980000), SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), + SPH_C32(0xa95c149a), SPH_C32(0xf4f6ea7b), SPH_C32(0x7a8c0000), + SPH_C32(0xa5d40000), SPH_C32(0x13260880), SPH_C32(0xc63d0000), + SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), SPH_C32(0x59d0b4f8), + SPH_C32(0x979961d0) }, + { SPH_C32(0x50ff0000), SPH_C32(0x9e7c0000), SPH_C32(0xd07d034e), + SPH_C32(0xa6670000), SPH_C32(0x20bc3b3f), SPH_C32(0xc56b87a9), + SPH_C32(0x660a9b7f), SPH_C32(0xa7f5f974), SPH_C32(0x29010000), + SPH_C32(0x0c280000), SPH_C32(0x8dd10886), SPH_C32(0x90c20000), + SPH_C32(0xc1576de4), SPH_C32(0x6c6482ba), SPH_C32(0xf094f4e0), + SPH_C32(0xe80e3741) }, + { SPH_C32(0x51220000), SPH_C32(0x1ed40000), SPH_C32(0x24eb0306), + SPH_C32(0x00670000), SPH_C32(0xb069459d), SPH_C32(0x128d0b9e), + SPH_C32(0x00185482), SPH_C32(0x8b61bcea), SPH_C32(0x7b510000), + SPH_C32(0x257c0000), SPH_C32(0xe7b008c8), SPH_C32(0x603d0000), + SPH_C32(0x5b661308), SPH_C32(0x2947c374), SPH_C32(0x3fc27b05), + SPH_C32(0xbb0d244e) }, + { SPH_C32(0x03720000), SPH_C32(0x37800000), SPH_C32(0x4e8a0348), + SPH_C32(0xf0980000), SPH_C32(0x2a583b71), SPH_C32(0x57ae4a50), + SPH_C32(0xcf4edb67), SPH_C32(0xd862afe5), SPH_C32(0x28dc0000), + SPH_C32(0x8c800000), SPH_C32(0x794708ce), SPH_C32(0x36c20000), + SPH_C32(0x51821346), SPH_C32(0xbb820e8d), SPH_C32(0x96863b1d), + SPH_C32(0xc49a72df) }, + { SPH_C32(0xcebb0000), SPH_C32(0x124b0000), SPH_C32(0xe0a50480), + SPH_C32(0x6dc80000), SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), + SPH_C32(0xc01f5c5b), SPH_C32(0x3eac6d85), SPH_C32(0xfb120000), + SPH_C32(0x49830000), SPH_C32(0x75140a00), SPH_C32(0x53ce0000), + SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), SPH_C32(0xbf8a16d5), + SPH_C32(0x19fed62a) }, + { SPH_C32(0x9ceb0000), SPH_C32(0x3b1f0000), SPH_C32(0x8ac404ce), + SPH_C32(0x9d370000), SPH_C32(0x6b6c28c0), SPH_C32(0x42f0b3b1), + SPH_C32(0x0f49d3be), SPH_C32(0x6daf7e8a), SPH_C32(0xa89f0000), + SPH_C32(0xe07f0000), SPH_C32(0xebe30a06), SPH_C32(0x05310000), + SPH_C32(0x9cfe45e6), SPH_C32(0x2490be06), SPH_C32(0x16ce56cd), + SPH_C32(0x666980bb) }, + { SPH_C32(0x9d360000), SPH_C32(0xbbb70000), SPH_C32(0x7e520486), + SPH_C32(0x3b370000), SPH_C32(0xfbb95662), SPH_C32(0x95163f86), + SPH_C32(0x695b1c43), SPH_C32(0x413b3b14), SPH_C32(0xfacf0000), + SPH_C32(0xc92b0000), SPH_C32(0x81820a48), SPH_C32(0xf5ce0000), + SPH_C32(0x06cf3b0a), SPH_C32(0x61b3ffc8), SPH_C32(0xd998d928), + SPH_C32(0x356a93b4) }, + { SPH_C32(0xcf660000), SPH_C32(0x92e30000), SPH_C32(0x143304c8), + SPH_C32(0xcbc80000), SPH_C32(0x6188288e), SPH_C32(0xd0357e48), + SPH_C32(0xa60d93a6), SPH_C32(0x1238281b), SPH_C32(0xa9420000), + SPH_C32(0x60d70000), SPH_C32(0x1f750a4e), SPH_C32(0xa3310000), + SPH_C32(0x0c2b3b44), SPH_C32(0xf3763231), SPH_C32(0x70dc9930), + SPH_C32(0x4afdc525) }, + { SPH_C32(0x83310000), SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), + SPH_C32(0xc36b0000), SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), + SPH_C32(0x4f06b6b7), SPH_C32(0x7a915d81), SPH_C32(0x37060000), + SPH_C32(0xece00000), SPH_C32(0x2fad0d80), SPH_C32(0x689e0000), + SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), SPH_C32(0xd6c95e14), + SPH_C32(0xd3a451d4) }, + { SPH_C32(0xd1610000), SPH_C32(0x722b0000), SPH_C32(0xb64f01ce), + SPH_C32(0x33940000), SPH_C32(0x7d15133d), SPH_C32(0x8d9fbb15), + SPH_C32(0x80503952), SPH_C32(0x29924e8e), SPH_C32(0x648b0000), + SPH_C32(0x451c0000), SPH_C32(0xb15a0d86), SPH_C32(0x3e610000), + SPH_C32(0xd72e5619), SPH_C32(0xa30b8a1e), SPH_C32(0x7f8d1e0c), + SPH_C32(0xac330745) }, + { SPH_C32(0xd0bc0000), SPH_C32(0xf2830000), SPH_C32(0x42d90186), + SPH_C32(0x95940000), SPH_C32(0xedc06d9f), SPH_C32(0x5a793722), + SPH_C32(0xe642f6af), SPH_C32(0x05060b10), SPH_C32(0x36db0000), + SPH_C32(0x6c480000), SPH_C32(0xdb3b0dc8), SPH_C32(0xce9e0000), + SPH_C32(0x4d1f28f5), SPH_C32(0xe628cbd0), SPH_C32(0xb0db91e9), + SPH_C32(0xff30144a) }, + { SPH_C32(0x82ec0000), SPH_C32(0xdbd70000), SPH_C32(0x28b801c8), + SPH_C32(0x656b0000), SPH_C32(0x77f11373), SPH_C32(0x1f5a76ec), + SPH_C32(0x2914794a), SPH_C32(0x5605181f), SPH_C32(0x65560000), + SPH_C32(0xc5b40000), SPH_C32(0x45cc0dce), SPH_C32(0x98610000), + SPH_C32(0x47fb28bb), SPH_C32(0x74ed0629), SPH_C32(0x199fd1f1), + SPH_C32(0x80a742db) }, + { SPH_C32(0x4f250000), SPH_C32(0xfe1c0000), SPH_C32(0x86970600), + SPH_C32(0xf83b0000), SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), + SPH_C32(0x2645fe76), SPH_C32(0xb0cbda7f), SPH_C32(0xb6980000), + SPH_C32(0x00b70000), SPH_C32(0x499f0f00), SPH_C32(0xfd6d0000), + SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), SPH_C32(0x3093fc39), + SPH_C32(0x5dc3e62e) }, + { SPH_C32(0x1d750000), SPH_C32(0xd7480000), SPH_C32(0xecf6064e), + SPH_C32(0x08c40000), SPH_C32(0x36c500c2), SPH_C32(0x0a048f0d), + SPH_C32(0xe9137193), SPH_C32(0xe3c8c970), SPH_C32(0xe5150000), + SPH_C32(0xa94b0000), SPH_C32(0xd7680f06), SPH_C32(0xab920000), + SPH_C32(0x8a877e1b), SPH_C32(0xebffb6a2), SPH_C32(0x99d7bc21), + SPH_C32(0x2254b0bf) }, + { SPH_C32(0x1ca80000), SPH_C32(0x57e00000), SPH_C32(0x18600606), + SPH_C32(0xaec40000), SPH_C32(0xa6107e60), SPH_C32(0xdde2033a), + SPH_C32(0x8f01be6e), SPH_C32(0xcf5c8cee), SPH_C32(0xb7450000), + SPH_C32(0x801f0000), SPH_C32(0xbd090f48), SPH_C32(0x5b6d0000), + SPH_C32(0x10b600f7), SPH_C32(0xaedcf76c), SPH_C32(0x568133c4), + SPH_C32(0x7157a3b0) }, + { SPH_C32(0x4ef80000), SPH_C32(0x7eb40000), SPH_C32(0x72010648), + SPH_C32(0x5e3b0000), SPH_C32(0x3c21008c), SPH_C32(0x98c142f4), + SPH_C32(0x4057318b), SPH_C32(0x9c5f9fe1), SPH_C32(0xe4c80000), + SPH_C32(0x29e30000), SPH_C32(0x23fe0f4e), SPH_C32(0x0d920000), + SPH_C32(0x1a5200b9), SPH_C32(0x3c193a95), SPH_C32(0xffc573dc), + SPH_C32(0x0ec0f521) }, + { SPH_C32(0x7a8c0000), SPH_C32(0xa5d40000), SPH_C32(0x13260880), + SPH_C32(0xc63d0000), SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), + SPH_C32(0x59d0b4f8), SPH_C32(0x979961d0), SPH_C32(0x78230000), + SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), SPH_C32(0x90a50000), + SPH_C32(0x713e2879), SPH_C32(0x7ee98924), SPH_C32(0xf08ca062), + SPH_C32(0x636f8bab) }, + { SPH_C32(0x28dc0000), SPH_C32(0x8c800000), SPH_C32(0x794708ce), + SPH_C32(0x36c20000), SPH_C32(0x51821346), SPH_C32(0xbb820e8d), + SPH_C32(0x96863b1d), SPH_C32(0xc49a72df), SPH_C32(0x2bae0000), + SPH_C32(0xbb000000), SPH_C32(0x37cd0b86), SPH_C32(0xc65a0000), + SPH_C32(0x7bda2837), SPH_C32(0xec2c44dd), SPH_C32(0x59c8e07a), + SPH_C32(0x1cf8dd3a) }, + { SPH_C32(0x29010000), SPH_C32(0x0c280000), SPH_C32(0x8dd10886), + SPH_C32(0x90c20000), SPH_C32(0xc1576de4), SPH_C32(0x6c6482ba), + SPH_C32(0xf094f4e0), SPH_C32(0xe80e3741), SPH_C32(0x79fe0000), + SPH_C32(0x92540000), SPH_C32(0x5dac0bc8), SPH_C32(0x36a50000), + SPH_C32(0xe1eb56db), SPH_C32(0xa90f0513), SPH_C32(0x969e6f9f), + SPH_C32(0x4ffbce35) }, + { SPH_C32(0x7b510000), SPH_C32(0x257c0000), SPH_C32(0xe7b008c8), + SPH_C32(0x603d0000), SPH_C32(0x5b661308), SPH_C32(0x2947c374), + SPH_C32(0x3fc27b05), SPH_C32(0xbb0d244e), SPH_C32(0x2a730000), + SPH_C32(0x3ba80000), SPH_C32(0xc35b0bce), SPH_C32(0x605a0000), + SPH_C32(0xeb0f5695), SPH_C32(0x3bcac8ea), SPH_C32(0x3fda2f87), + SPH_C32(0x306c98a4) }, + { SPH_C32(0xb6980000), SPH_C32(0x00b70000), SPH_C32(0x499f0f00), + SPH_C32(0xfd6d0000), SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), + SPH_C32(0x3093fc39), SPH_C32(0x5dc3e62e), SPH_C32(0xf9bd0000), + SPH_C32(0xfeab0000), SPH_C32(0xcf080900), SPH_C32(0x05560000), + SPH_C32(0x2c97007b), SPH_C32(0x361db598), SPH_C32(0x16d6024f), + SPH_C32(0xed083c51) }, + { SPH_C32(0xe4c80000), SPH_C32(0x29e30000), SPH_C32(0x23fe0f4e), + SPH_C32(0x0d920000), SPH_C32(0x1a5200b9), SPH_C32(0x3c193a95), + SPH_C32(0xffc573dc), SPH_C32(0x0ec0f521), SPH_C32(0xaa300000), + SPH_C32(0x57570000), SPH_C32(0x51ff0906), SPH_C32(0x53a90000), + SPH_C32(0x26730035), SPH_C32(0xa4d87861), SPH_C32(0xbf924257), + SPH_C32(0x929f6ac0) }, + { SPH_C32(0xe5150000), SPH_C32(0xa94b0000), SPH_C32(0xd7680f06), + SPH_C32(0xab920000), SPH_C32(0x8a877e1b), SPH_C32(0xebffb6a2), + SPH_C32(0x99d7bc21), SPH_C32(0x2254b0bf), SPH_C32(0xf8600000), + SPH_C32(0x7e030000), SPH_C32(0x3b9e0948), SPH_C32(0xa3560000), + SPH_C32(0xbc427ed9), SPH_C32(0xe1fb39af), SPH_C32(0x70c4cdb2), + SPH_C32(0xc19c79cf) }, + { SPH_C32(0xb7450000), SPH_C32(0x801f0000), SPH_C32(0xbd090f48), + SPH_C32(0x5b6d0000), SPH_C32(0x10b600f7), SPH_C32(0xaedcf76c), + SPH_C32(0x568133c4), SPH_C32(0x7157a3b0), SPH_C32(0xabed0000), + SPH_C32(0xd7ff0000), SPH_C32(0xa569094e), SPH_C32(0xf5a90000), + SPH_C32(0xb6a67e97), SPH_C32(0x733ef456), SPH_C32(0xd9808daa), + SPH_C32(0xbe0b2f5e) }, + { SPH_C32(0xfb120000), SPH_C32(0x49830000), SPH_C32(0x75140a00), + SPH_C32(0x53ce0000), SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), + SPH_C32(0xbf8a16d5), SPH_C32(0x19fed62a), SPH_C32(0x35a90000), + SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), SPH_C32(0x3e060000), + SPH_C32(0x67471384), SPH_C32(0xb1868180), SPH_C32(0x7f954a8e), + SPH_C32(0x2752bbaf) }, + { SPH_C32(0xa9420000), SPH_C32(0x60d70000), SPH_C32(0x1f750a4e), + SPH_C32(0xa3310000), SPH_C32(0x0c2b3b44), SPH_C32(0xf3763231), + SPH_C32(0x70dc9930), SPH_C32(0x4afdc525), SPH_C32(0x66240000), + SPH_C32(0xf2340000), SPH_C32(0x0b460e86), SPH_C32(0x68f90000), + SPH_C32(0x6da313ca), SPH_C32(0x23434c79), SPH_C32(0xd6d10a96), + SPH_C32(0x58c5ed3e) }, + { SPH_C32(0xa89f0000), SPH_C32(0xe07f0000), SPH_C32(0xebe30a06), + SPH_C32(0x05310000), SPH_C32(0x9cfe45e6), SPH_C32(0x2490be06), + SPH_C32(0x16ce56cd), SPH_C32(0x666980bb), SPH_C32(0x34740000), + SPH_C32(0xdb600000), SPH_C32(0x61270ec8), SPH_C32(0x98060000), + SPH_C32(0xf7926d26), SPH_C32(0x66600db7), SPH_C32(0x19878573), + SPH_C32(0x0bc6fe31) }, + { SPH_C32(0xfacf0000), SPH_C32(0xc92b0000), SPH_C32(0x81820a48), + SPH_C32(0xf5ce0000), SPH_C32(0x06cf3b0a), SPH_C32(0x61b3ffc8), + SPH_C32(0xd998d928), SPH_C32(0x356a93b4), SPH_C32(0x67f90000), + SPH_C32(0x729c0000), SPH_C32(0xffd00ece), SPH_C32(0xcef90000), + SPH_C32(0xfd766d68), SPH_C32(0xf4a5c04e), SPH_C32(0xb0c3c56b), + SPH_C32(0x7451a8a0) }, + { SPH_C32(0x37060000), SPH_C32(0xece00000), SPH_C32(0x2fad0d80), + SPH_C32(0x689e0000), SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), + SPH_C32(0xd6c95e14), SPH_C32(0xd3a451d4), SPH_C32(0xb4370000), + SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), SPH_C32(0xabf50000), + SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), SPH_C32(0x99cfe8a3), + SPH_C32(0xa9350c55) }, + { SPH_C32(0x65560000), SPH_C32(0xc5b40000), SPH_C32(0x45cc0dce), + SPH_C32(0x98610000), SPH_C32(0x47fb28bb), SPH_C32(0x74ed0629), + SPH_C32(0x199fd1f1), SPH_C32(0x80a742db), SPH_C32(0xe7ba0000), + SPH_C32(0x1e630000), SPH_C32(0x6d740c06), SPH_C32(0xfd0a0000), + SPH_C32(0x300a3bc8), SPH_C32(0x6bb770c5), SPH_C32(0x308ba8bb), + SPH_C32(0xd6a25ac4) }, + { SPH_C32(0x648b0000), SPH_C32(0x451c0000), SPH_C32(0xb15a0d86), + SPH_C32(0x3e610000), SPH_C32(0xd72e5619), SPH_C32(0xa30b8a1e), + SPH_C32(0x7f8d1e0c), SPH_C32(0xac330745), SPH_C32(0xb5ea0000), + SPH_C32(0x37370000), SPH_C32(0x07150c48), SPH_C32(0x0df50000), + SPH_C32(0xaa3b4524), SPH_C32(0x2e94310b), SPH_C32(0xffdd275e), + SPH_C32(0x85a149cb) }, + { SPH_C32(0x36db0000), SPH_C32(0x6c480000), SPH_C32(0xdb3b0dc8), + SPH_C32(0xce9e0000), SPH_C32(0x4d1f28f5), SPH_C32(0xe628cbd0), + SPH_C32(0xb0db91e9), SPH_C32(0xff30144a), SPH_C32(0xe6670000), + SPH_C32(0x9ecb0000), SPH_C32(0x99e20c4e), SPH_C32(0x5b0a0000), + SPH_C32(0xa0df456a), SPH_C32(0xbc51fcf2), SPH_C32(0x56996746), + SPH_C32(0xfa361f5a) } +}; + +static const sph_u32 T512_42[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x58430000), SPH_C32(0x807e0000), SPH_C32(0x78330001), + SPH_C32(0xc66b3800), SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), + SPH_C32(0xac73fe6f), SPH_C32(0x3a4479b1), SPH_C32(0x1d5a0000), + SPH_C32(0x2b720000), SPH_C32(0x488d0000), SPH_C32(0xaf611800), + SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), SPH_C32(0x81a20429), + SPH_C32(0x1e7536a6) }, + { SPH_C32(0x1d5a0000), SPH_C32(0x2b720000), SPH_C32(0x488d0000), + SPH_C32(0xaf611800), SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), + SPH_C32(0x81a20429), SPH_C32(0x1e7536a6), SPH_C32(0x45190000), + SPH_C32(0xab0c0000), SPH_C32(0x30be0001), SPH_C32(0x690a2000), + SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), SPH_C32(0x2dd1fa46), + SPH_C32(0x24314f17) }, + { SPH_C32(0x45190000), SPH_C32(0xab0c0000), SPH_C32(0x30be0001), + SPH_C32(0x690a2000), SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), + SPH_C32(0x2dd1fa46), SPH_C32(0x24314f17), SPH_C32(0x58430000), + SPH_C32(0x807e0000), SPH_C32(0x78330001), SPH_C32(0xc66b3800), + SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), SPH_C32(0xac73fe6f), + SPH_C32(0x3a4479b1) }, + { SPH_C32(0xa53b0000), SPH_C32(0x14260000), SPH_C32(0x4e30001e), + SPH_C32(0x7cae0000), SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), + SPH_C32(0xf73168d8), SPH_C32(0x0b1b4946), SPH_C32(0x07ed0000), + SPH_C32(0xb2500000), SPH_C32(0x8774000a), SPH_C32(0x970d0000), + SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), SPH_C32(0xf4786222), + SPH_C32(0x9075b1ce) }, + { SPH_C32(0xfd780000), SPH_C32(0x94580000), SPH_C32(0x3603001f), + SPH_C32(0xbac53800), SPH_C32(0x68a95109), SPH_C32(0x017295e0), + SPH_C32(0x5b4296b7), SPH_C32(0x315f30f7), SPH_C32(0x1ab70000), + SPH_C32(0x99220000), SPH_C32(0xcff9000a), SPH_C32(0x386c1800), + SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), SPH_C32(0x75da660b), + SPH_C32(0x8e008768) }, + { SPH_C32(0xb8610000), SPH_C32(0x3f540000), SPH_C32(0x06bd001e), + SPH_C32(0xd3cf1800), SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), + SPH_C32(0x76936cf1), SPH_C32(0x156e7fe0), SPH_C32(0x42f40000), + SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), SPH_C32(0xfe072000), + SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), SPH_C32(0xd9a99864), + SPH_C32(0xb444fed9) }, + { SPH_C32(0xe0220000), SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), + SPH_C32(0x15a42000), SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), + SPH_C32(0xdae0929e), SPH_C32(0x2f2a0651), SPH_C32(0x5fae0000), + SPH_C32(0x322e0000), SPH_C32(0xff47000b), SPH_C32(0x51663800), + SPH_C32(0xa4457f72), SPH_C32(0x316a5179), SPH_C32(0x580b9c4d), + SPH_C32(0xaa31c87f) }, + { SPH_C32(0x07ed0000), SPH_C32(0xb2500000), SPH_C32(0x8774000a), + SPH_C32(0x970d0000), SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), + SPH_C32(0xf4786222), SPH_C32(0x9075b1ce), SPH_C32(0xa2d60000), + SPH_C32(0xa6760000), SPH_C32(0xc9440014), SPH_C32(0xeba30000), + SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), SPH_C32(0x03490afa), + SPH_C32(0x9b6ef888) }, + { SPH_C32(0x5fae0000), SPH_C32(0x322e0000), SPH_C32(0xff47000b), + SPH_C32(0x51663800), SPH_C32(0xa4457f72), SPH_C32(0x316a5179), + SPH_C32(0x580b9c4d), SPH_C32(0xaa31c87f), SPH_C32(0xbf8c0000), + SPH_C32(0x8d040000), SPH_C32(0x81c90014), SPH_C32(0x44c21800), + SPH_C32(0xe92700be), SPH_C32(0xf8617b49), SPH_C32(0x82eb0ed3), + SPH_C32(0x851bce2e) }, + { SPH_C32(0x1ab70000), SPH_C32(0x99220000), SPH_C32(0xcff9000a), + SPH_C32(0x386c1800), SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), + SPH_C32(0x75da660b), SPH_C32(0x8e008768), SPH_C32(0xe7cf0000), + SPH_C32(0x0d7a0000), SPH_C32(0xf9fa0015), SPH_C32(0x82a92000), + SPH_C32(0x0e105c62), SPH_C32(0x81cc4494), SPH_C32(0x2e98f0bc), + SPH_C32(0xbf5fb79f) }, + { SPH_C32(0x42f40000), SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), + SPH_C32(0xfe072000), SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), + SPH_C32(0xd9a99864), SPH_C32(0xb444fed9), SPH_C32(0xfa950000), + SPH_C32(0x26080000), SPH_C32(0xb1770015), SPH_C32(0x2dc83800), + SPH_C32(0x2bdb72a7), SPH_C32(0x49b5fb44), SPH_C32(0xaf3af495), + SPH_C32(0xa12a8139) }, + { SPH_C32(0xa2d60000), SPH_C32(0xa6760000), SPH_C32(0xc9440014), + SPH_C32(0xeba30000), SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), + SPH_C32(0x03490afa), SPH_C32(0x9b6ef888), SPH_C32(0xa53b0000), + SPH_C32(0x14260000), SPH_C32(0x4e30001e), SPH_C32(0x7cae0000), + SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), SPH_C32(0xf73168d8), + SPH_C32(0x0b1b4946) }, + { SPH_C32(0xfa950000), SPH_C32(0x26080000), SPH_C32(0xb1770015), + SPH_C32(0x2dc83800), SPH_C32(0x2bdb72a7), SPH_C32(0x49b5fb44), + SPH_C32(0xaf3af495), SPH_C32(0xa12a8139), SPH_C32(0xb8610000), + SPH_C32(0x3f540000), SPH_C32(0x06bd001e), SPH_C32(0xd3cf1800), + SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), SPH_C32(0x76936cf1), + SPH_C32(0x156e7fe0) }, + { SPH_C32(0xbf8c0000), SPH_C32(0x8d040000), SPH_C32(0x81c90014), + SPH_C32(0x44c21800), SPH_C32(0xe92700be), SPH_C32(0xf8617b49), + SPH_C32(0x82eb0ed3), SPH_C32(0x851bce2e), SPH_C32(0xe0220000), + SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), SPH_C32(0x15a42000), + SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), SPH_C32(0xdae0929e), + SPH_C32(0x2f2a0651) }, + { SPH_C32(0xe7cf0000), SPH_C32(0x0d7a0000), SPH_C32(0xf9fa0015), + SPH_C32(0x82a92000), SPH_C32(0x0e105c62), SPH_C32(0x81cc4494), + SPH_C32(0x2e98f0bc), SPH_C32(0xbf5fb79f), SPH_C32(0xfd780000), + SPH_C32(0x94580000), SPH_C32(0x3603001f), SPH_C32(0xbac53800), + SPH_C32(0x68a95109), SPH_C32(0x017295e0), SPH_C32(0x5b4296b7), + SPH_C32(0x315f30f7) }, + { SPH_C32(0x88980000), SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), + SPH_C32(0xfb4e0000), SPH_C32(0xf158079a), SPH_C32(0x61ae9167), + SPH_C32(0xa895706c), SPH_C32(0xe6107494), SPH_C32(0x0bc20000), + SPH_C32(0xdb630000), SPH_C32(0x7e88000c), SPH_C32(0x15860000), + SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), SPH_C32(0xf460449e), + SPH_C32(0xd8b61463) }, + { SPH_C32(0xd0db0000), SPH_C32(0x9fea0000), SPH_C32(0x07fc002f), + SPH_C32(0x3d253800), SPH_C32(0x166f5b46), SPH_C32(0x1803aeba), + SPH_C32(0x04e68e03), SPH_C32(0xdc540d25), SPH_C32(0x16980000), + SPH_C32(0xf0110000), SPH_C32(0x3605000c), SPH_C32(0xbae71800), + SPH_C32(0xb4366636), SPH_C32(0xbdf80493), SPH_C32(0x75c240b7), + SPH_C32(0xc6c322c5) }, + { SPH_C32(0x95c20000), SPH_C32(0x34e60000), SPH_C32(0x3742002e), + SPH_C32(0x542f1800), SPH_C32(0xd493295f), SPH_C32(0xa9d72eb7), + SPH_C32(0x29377445), SPH_C32(0xf8654232), SPH_C32(0x4edb0000), + SPH_C32(0x706f0000), SPH_C32(0x4e36000d), SPH_C32(0x7c8c2000), + SPH_C32(0x53013aea), SPH_C32(0xc4553b4e), SPH_C32(0xd9b1bed8), + SPH_C32(0xfc875b74) }, + { SPH_C32(0xcd810000), SPH_C32(0xb4980000), SPH_C32(0x4f71002f), + SPH_C32(0x92442000), SPH_C32(0x33a47583), SPH_C32(0xd07a116a), + SPH_C32(0x85448a2a), SPH_C32(0xc2213b83), SPH_C32(0x53810000), + SPH_C32(0x5b1d0000), SPH_C32(0x06bb000d), SPH_C32(0xd3ed3800), + SPH_C32(0x76ca142f), SPH_C32(0x0c2c849e), SPH_C32(0x5813baf1), + SPH_C32(0xe2f26dd2) }, + { SPH_C32(0x2da30000), SPH_C32(0x0bb20000), SPH_C32(0x31ff0030), + SPH_C32(0x87e00000), SPH_C32(0x7ec60a4f), SPH_C32(0x19713b5a), + SPH_C32(0x5fa418b4), SPH_C32(0xed0b3dd2), SPH_C32(0x0c2f0000), + SPH_C32(0x69330000), SPH_C32(0xf9fc0006), SPH_C32(0x828b0000), + SPH_C32(0xd28f6b5d), SPH_C32(0x3d46d5e7), SPH_C32(0x001826bc), + SPH_C32(0x48c3a5ad) }, + { SPH_C32(0x75e00000), SPH_C32(0x8bcc0000), SPH_C32(0x49cc0031), + SPH_C32(0x418b3800), SPH_C32(0x99f15693), SPH_C32(0x60dc0487), + SPH_C32(0xf3d7e6db), SPH_C32(0xd74f4463), SPH_C32(0x11750000), + SPH_C32(0x42410000), SPH_C32(0xb1710006), SPH_C32(0x2dea1800), + SPH_C32(0xf7444598), SPH_C32(0xf53f6a37), SPH_C32(0x81ba2295), + SPH_C32(0x56b6930b) }, + { SPH_C32(0x30f90000), SPH_C32(0x20c00000), SPH_C32(0x79720030), + SPH_C32(0x28811800), SPH_C32(0x5b0d248a), SPH_C32(0xd108848a), + SPH_C32(0xde061c9d), SPH_C32(0xf37e0b74), SPH_C32(0x49360000), + SPH_C32(0xc23f0000), SPH_C32(0xc9420007), SPH_C32(0xeb812000), + SPH_C32(0x10731944), SPH_C32(0x8c9255ea), SPH_C32(0x2dc9dcfa), + SPH_C32(0x6cf2eaba) }, + { SPH_C32(0x68ba0000), SPH_C32(0xa0be0000), SPH_C32(0x01410031), + SPH_C32(0xeeea2000), SPH_C32(0xbc3a7856), SPH_C32(0xa8a5bb57), + SPH_C32(0x7275e2f2), SPH_C32(0xc93a72c5), SPH_C32(0x546c0000), + SPH_C32(0xe94d0000), SPH_C32(0x81cf0007), SPH_C32(0x44e03800), + SPH_C32(0x35b83781), SPH_C32(0x44ebea3a), SPH_C32(0xac6bd8d3), + SPH_C32(0x7287dc1c) }, + { SPH_C32(0x8f750000), SPH_C32(0xadc40000), SPH_C32(0xf8bb0024), + SPH_C32(0x6c430000), SPH_C32(0xb22a2434), SPH_C32(0x2969ffc3), + SPH_C32(0x5ced124e), SPH_C32(0x7665c55a), SPH_C32(0xa9140000), + SPH_C32(0x7d150000), SPH_C32(0xb7cc0018), SPH_C32(0xfe250000), + SPH_C32(0x5d116688), SPH_C32(0x45997fda), SPH_C32(0xf7294e64), + SPH_C32(0x43d8eceb) }, + { SPH_C32(0xd7360000), SPH_C32(0x2dba0000), SPH_C32(0x80880025), + SPH_C32(0xaa283800), SPH_C32(0x551d78e8), SPH_C32(0x50c4c01e), + SPH_C32(0xf09eec21), SPH_C32(0x4c21bceb), SPH_C32(0xb44e0000), + SPH_C32(0x56670000), SPH_C32(0xff410018), SPH_C32(0x51441800), + SPH_C32(0x78da484d), SPH_C32(0x8de0c00a), SPH_C32(0x768b4a4d), + SPH_C32(0x5dadda4d) }, + { SPH_C32(0x922f0000), SPH_C32(0x86b60000), SPH_C32(0xb0360024), + SPH_C32(0xc3221800), SPH_C32(0x97e10af1), SPH_C32(0xe1104013), + SPH_C32(0xdd4f1667), SPH_C32(0x6810f3fc), SPH_C32(0xec0d0000), + SPH_C32(0xd6190000), SPH_C32(0x87720019), SPH_C32(0x972f2000), + SPH_C32(0x9fed1491), SPH_C32(0xf44dffd7), SPH_C32(0xdaf8b422), + SPH_C32(0x67e9a3fc) }, + { SPH_C32(0xca6c0000), SPH_C32(0x06c80000), SPH_C32(0xc8050025), + SPH_C32(0x05492000), SPH_C32(0x70d6562d), SPH_C32(0x98bd7fce), + SPH_C32(0x713ce808), SPH_C32(0x52548a4d), SPH_C32(0xf1570000), + SPH_C32(0xfd6b0000), SPH_C32(0xcfff0019), SPH_C32(0x384e3800), + SPH_C32(0xba263a54), SPH_C32(0x3c344007), SPH_C32(0x5b5ab00b), + SPH_C32(0x799c955a) }, + { SPH_C32(0x2a4e0000), SPH_C32(0xb9e20000), SPH_C32(0xb68b003a), + SPH_C32(0x10ed0000), SPH_C32(0x3db429e1), SPH_C32(0x51b655fe), + SPH_C32(0xabdc7a96), SPH_C32(0x7d7e8c1c), SPH_C32(0xaef90000), + SPH_C32(0xcf450000), SPH_C32(0x30b80012), SPH_C32(0x69280000), + SPH_C32(0x1e634526), SPH_C32(0x0d5e117e), SPH_C32(0x03512c46), + SPH_C32(0xd3ad5d25) }, + { SPH_C32(0x720d0000), SPH_C32(0x399c0000), SPH_C32(0xceb8003b), + SPH_C32(0xd6863800), SPH_C32(0xda83753d), SPH_C32(0x281b6a23), + SPH_C32(0x07af84f9), SPH_C32(0x473af5ad), SPH_C32(0xb3a30000), + SPH_C32(0xe4370000), SPH_C32(0x78350012), SPH_C32(0xc6491800), + SPH_C32(0x3ba86be3), SPH_C32(0xc527aeae), SPH_C32(0x82f3286f), + SPH_C32(0xcdd86b83) }, + { SPH_C32(0x37140000), SPH_C32(0x92900000), SPH_C32(0xfe06003a), + SPH_C32(0xbf8c1800), SPH_C32(0x187f0724), SPH_C32(0x99cfea2e), + SPH_C32(0x2a7e7ebf), SPH_C32(0x630bbaba), SPH_C32(0xebe00000), + SPH_C32(0x64490000), SPH_C32(0x00060013), SPH_C32(0x00222000), + SPH_C32(0xdc9f373f), SPH_C32(0xbc8a9173), SPH_C32(0x2e80d600), + SPH_C32(0xf79c1232) }, + { SPH_C32(0x6f570000), SPH_C32(0x12ee0000), SPH_C32(0x8635003b), + SPH_C32(0x79e72000), SPH_C32(0xff485bf8), SPH_C32(0xe062d5f3), + SPH_C32(0x860d80d0), SPH_C32(0x594fc30b), SPH_C32(0xf6ba0000), + SPH_C32(0x4f3b0000), SPH_C32(0x488b0013), SPH_C32(0xaf433800), + SPH_C32(0xf95419fa), SPH_C32(0x74f32ea3), SPH_C32(0xaf22d229), + SPH_C32(0xe9e92494) }, + { SPH_C32(0x0bc20000), SPH_C32(0xdb630000), SPH_C32(0x7e88000c), + SPH_C32(0x15860000), SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), + SPH_C32(0xf460449e), SPH_C32(0xd8b61463), SPH_C32(0x835a0000), + SPH_C32(0xc4f70000), SPH_C32(0x01470022), SPH_C32(0xeec80000), + SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), SPH_C32(0x5cf534f2), + SPH_C32(0x3ea660f7) }, + { SPH_C32(0x53810000), SPH_C32(0x5b1d0000), SPH_C32(0x06bb000d), + SPH_C32(0xd3ed3800), SPH_C32(0x76ca142f), SPH_C32(0x0c2c849e), + SPH_C32(0x5813baf1), SPH_C32(0xe2f26dd2), SPH_C32(0x9e000000), + SPH_C32(0xef850000), SPH_C32(0x49ca0022), SPH_C32(0x41a91800), + SPH_C32(0x456e61ac), SPH_C32(0xdc5695f4), SPH_C32(0xdd5730db), + SPH_C32(0x20d35651) }, + { SPH_C32(0x16980000), SPH_C32(0xf0110000), SPH_C32(0x3605000c), + SPH_C32(0xbae71800), SPH_C32(0xb4366636), SPH_C32(0xbdf80493), + SPH_C32(0x75c240b7), SPH_C32(0xc6c322c5), SPH_C32(0xc6430000), + SPH_C32(0x6ffb0000), SPH_C32(0x31f90023), SPH_C32(0x87c22000), + SPH_C32(0xa2593d70), SPH_C32(0xa5fbaa29), SPH_C32(0x7124ceb4), + SPH_C32(0x1a972fe0) }, + { SPH_C32(0x4edb0000), SPH_C32(0x706f0000), SPH_C32(0x4e36000d), + SPH_C32(0x7c8c2000), SPH_C32(0x53013aea), SPH_C32(0xc4553b4e), + SPH_C32(0xd9b1bed8), SPH_C32(0xfc875b74), SPH_C32(0xdb190000), + SPH_C32(0x44890000), SPH_C32(0x79740023), SPH_C32(0x28a33800), + SPH_C32(0x879213b5), SPH_C32(0x6d8215f9), SPH_C32(0xf086ca9d), + SPH_C32(0x04e21946) }, + { SPH_C32(0xaef90000), SPH_C32(0xcf450000), SPH_C32(0x30b80012), + SPH_C32(0x69280000), SPH_C32(0x1e634526), SPH_C32(0x0d5e117e), + SPH_C32(0x03512c46), SPH_C32(0xd3ad5d25), SPH_C32(0x84b70000), + SPH_C32(0x76a70000), SPH_C32(0x86330028), SPH_C32(0x79c50000), + SPH_C32(0x23d76cc7), SPH_C32(0x5ce84480), SPH_C32(0xa88d56d0), + SPH_C32(0xaed3d139) }, + { SPH_C32(0xf6ba0000), SPH_C32(0x4f3b0000), SPH_C32(0x488b0013), + SPH_C32(0xaf433800), SPH_C32(0xf95419fa), SPH_C32(0x74f32ea3), + SPH_C32(0xaf22d229), SPH_C32(0xe9e92494), SPH_C32(0x99ed0000), + SPH_C32(0x5dd50000), SPH_C32(0xcebe0028), SPH_C32(0xd6a41800), + SPH_C32(0x061c4202), SPH_C32(0x9491fb50), SPH_C32(0x292f52f9), + SPH_C32(0xb0a6e79f) }, + { SPH_C32(0xb3a30000), SPH_C32(0xe4370000), SPH_C32(0x78350012), + SPH_C32(0xc6491800), SPH_C32(0x3ba86be3), SPH_C32(0xc527aeae), + SPH_C32(0x82f3286f), SPH_C32(0xcdd86b83), SPH_C32(0xc1ae0000), + SPH_C32(0xddab0000), SPH_C32(0xb68d0029), SPH_C32(0x10cf2000), + SPH_C32(0xe12b1ede), SPH_C32(0xed3cc48d), SPH_C32(0x855cac96), + SPH_C32(0x8ae29e2e) }, + { SPH_C32(0xebe00000), SPH_C32(0x64490000), SPH_C32(0x00060013), + SPH_C32(0x00222000), SPH_C32(0xdc9f373f), SPH_C32(0xbc8a9173), + SPH_C32(0x2e80d600), SPH_C32(0xf79c1232), SPH_C32(0xdcf40000), + SPH_C32(0xf6d90000), SPH_C32(0xfe000029), SPH_C32(0xbfae3800), + SPH_C32(0xc4e0301b), SPH_C32(0x25457b5d), SPH_C32(0x04fea8bf), + SPH_C32(0x9497a888) }, + { SPH_C32(0x0c2f0000), SPH_C32(0x69330000), SPH_C32(0xf9fc0006), + SPH_C32(0x828b0000), SPH_C32(0xd28f6b5d), SPH_C32(0x3d46d5e7), + SPH_C32(0x001826bc), SPH_C32(0x48c3a5ad), SPH_C32(0x218c0000), + SPH_C32(0x62810000), SPH_C32(0xc8030036), SPH_C32(0x056b0000), + SPH_C32(0xac496112), SPH_C32(0x2437eebd), SPH_C32(0x5fbc3e08), + SPH_C32(0xa5c8987f) }, + { SPH_C32(0x546c0000), SPH_C32(0xe94d0000), SPH_C32(0x81cf0007), + SPH_C32(0x44e03800), SPH_C32(0x35b83781), SPH_C32(0x44ebea3a), + SPH_C32(0xac6bd8d3), SPH_C32(0x7287dc1c), SPH_C32(0x3cd60000), + SPH_C32(0x49f30000), SPH_C32(0x808e0036), SPH_C32(0xaa0a1800), + SPH_C32(0x89824fd7), SPH_C32(0xec4e516d), SPH_C32(0xde1e3a21), + SPH_C32(0xbbbdaed9) }, + { SPH_C32(0x11750000), SPH_C32(0x42410000), SPH_C32(0xb1710006), + SPH_C32(0x2dea1800), SPH_C32(0xf7444598), SPH_C32(0xf53f6a37), + SPH_C32(0x81ba2295), SPH_C32(0x56b6930b), SPH_C32(0x64950000), + SPH_C32(0xc98d0000), SPH_C32(0xf8bd0037), SPH_C32(0x6c612000), + SPH_C32(0x6eb5130b), SPH_C32(0x95e36eb0), SPH_C32(0x726dc44e), + SPH_C32(0x81f9d768) }, + { SPH_C32(0x49360000), SPH_C32(0xc23f0000), SPH_C32(0xc9420007), + SPH_C32(0xeb812000), SPH_C32(0x10731944), SPH_C32(0x8c9255ea), + SPH_C32(0x2dc9dcfa), SPH_C32(0x6cf2eaba), SPH_C32(0x79cf0000), + SPH_C32(0xe2ff0000), SPH_C32(0xb0300037), SPH_C32(0xc3003800), + SPH_C32(0x4b7e3dce), SPH_C32(0x5d9ad160), SPH_C32(0xf3cfc067), + SPH_C32(0x9f8ce1ce) }, + { SPH_C32(0xa9140000), SPH_C32(0x7d150000), SPH_C32(0xb7cc0018), + SPH_C32(0xfe250000), SPH_C32(0x5d116688), SPH_C32(0x45997fda), + SPH_C32(0xf7294e64), SPH_C32(0x43d8eceb), SPH_C32(0x26610000), + SPH_C32(0xd0d10000), SPH_C32(0x4f77003c), SPH_C32(0x92660000), + SPH_C32(0xef3b42bc), SPH_C32(0x6cf08019), SPH_C32(0xabc45c2a), + SPH_C32(0x35bd29b1) }, + { SPH_C32(0xf1570000), SPH_C32(0xfd6b0000), SPH_C32(0xcfff0019), + SPH_C32(0x384e3800), SPH_C32(0xba263a54), SPH_C32(0x3c344007), + SPH_C32(0x5b5ab00b), SPH_C32(0x799c955a), SPH_C32(0x3b3b0000), + SPH_C32(0xfba30000), SPH_C32(0x07fa003c), SPH_C32(0x3d071800), + SPH_C32(0xcaf06c79), SPH_C32(0xa4893fc9), SPH_C32(0x2a665803), + SPH_C32(0x2bc81f17) }, + { SPH_C32(0xb44e0000), SPH_C32(0x56670000), SPH_C32(0xff410018), + SPH_C32(0x51441800), SPH_C32(0x78da484d), SPH_C32(0x8de0c00a), + SPH_C32(0x768b4a4d), SPH_C32(0x5dadda4d), SPH_C32(0x63780000), + SPH_C32(0x7bdd0000), SPH_C32(0x7fc9003d), SPH_C32(0xfb6c2000), + SPH_C32(0x2dc730a5), SPH_C32(0xdd240014), SPH_C32(0x8615a66c), + SPH_C32(0x118c66a6) }, + { SPH_C32(0xec0d0000), SPH_C32(0xd6190000), SPH_C32(0x87720019), + SPH_C32(0x972f2000), SPH_C32(0x9fed1491), SPH_C32(0xf44dffd7), + SPH_C32(0xdaf8b422), SPH_C32(0x67e9a3fc), SPH_C32(0x7e220000), + SPH_C32(0x50af0000), SPH_C32(0x3744003d), SPH_C32(0x540d3800), + SPH_C32(0x080c1e60), SPH_C32(0x155dbfc4), SPH_C32(0x07b7a245), + SPH_C32(0x0ff95000) }, + { SPH_C32(0x835a0000), SPH_C32(0xc4f70000), SPH_C32(0x01470022), + SPH_C32(0xeec80000), SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), + SPH_C32(0x5cf534f2), SPH_C32(0x3ea660f7), SPH_C32(0x88980000), + SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), SPH_C32(0xfb4e0000), + SPH_C32(0xf158079a), SPH_C32(0x61ae9167), SPH_C32(0xa895706c), + SPH_C32(0xe6107494) }, + { SPH_C32(0xdb190000), SPH_C32(0x44890000), SPH_C32(0x79740023), + SPH_C32(0x28a33800), SPH_C32(0x879213b5), SPH_C32(0x6d8215f9), + SPH_C32(0xf086ca9d), SPH_C32(0x04e21946), SPH_C32(0x95c20000), + SPH_C32(0x34e60000), SPH_C32(0x3742002e), SPH_C32(0x542f1800), + SPH_C32(0xd493295f), SPH_C32(0xa9d72eb7), SPH_C32(0x29377445), + SPH_C32(0xf8654232) }, + { SPH_C32(0x9e000000), SPH_C32(0xef850000), SPH_C32(0x49ca0022), + SPH_C32(0x41a91800), SPH_C32(0x456e61ac), SPH_C32(0xdc5695f4), + SPH_C32(0xdd5730db), SPH_C32(0x20d35651), SPH_C32(0xcd810000), + SPH_C32(0xb4980000), SPH_C32(0x4f71002f), SPH_C32(0x92442000), + SPH_C32(0x33a47583), SPH_C32(0xd07a116a), SPH_C32(0x85448a2a), + SPH_C32(0xc2213b83) }, + { SPH_C32(0xc6430000), SPH_C32(0x6ffb0000), SPH_C32(0x31f90023), + SPH_C32(0x87c22000), SPH_C32(0xa2593d70), SPH_C32(0xa5fbaa29), + SPH_C32(0x7124ceb4), SPH_C32(0x1a972fe0), SPH_C32(0xd0db0000), + SPH_C32(0x9fea0000), SPH_C32(0x07fc002f), SPH_C32(0x3d253800), + SPH_C32(0x166f5b46), SPH_C32(0x1803aeba), SPH_C32(0x04e68e03), + SPH_C32(0xdc540d25) }, + { SPH_C32(0x26610000), SPH_C32(0xd0d10000), SPH_C32(0x4f77003c), + SPH_C32(0x92660000), SPH_C32(0xef3b42bc), SPH_C32(0x6cf08019), + SPH_C32(0xabc45c2a), SPH_C32(0x35bd29b1), SPH_C32(0x8f750000), + SPH_C32(0xadc40000), SPH_C32(0xf8bb0024), SPH_C32(0x6c430000), + SPH_C32(0xb22a2434), SPH_C32(0x2969ffc3), SPH_C32(0x5ced124e), + SPH_C32(0x7665c55a) }, + { SPH_C32(0x7e220000), SPH_C32(0x50af0000), SPH_C32(0x3744003d), + SPH_C32(0x540d3800), SPH_C32(0x080c1e60), SPH_C32(0x155dbfc4), + SPH_C32(0x07b7a245), SPH_C32(0x0ff95000), SPH_C32(0x922f0000), + SPH_C32(0x86b60000), SPH_C32(0xb0360024), SPH_C32(0xc3221800), + SPH_C32(0x97e10af1), SPH_C32(0xe1104013), SPH_C32(0xdd4f1667), + SPH_C32(0x6810f3fc) }, + { SPH_C32(0x3b3b0000), SPH_C32(0xfba30000), SPH_C32(0x07fa003c), + SPH_C32(0x3d071800), SPH_C32(0xcaf06c79), SPH_C32(0xa4893fc9), + SPH_C32(0x2a665803), SPH_C32(0x2bc81f17), SPH_C32(0xca6c0000), + SPH_C32(0x06c80000), SPH_C32(0xc8050025), SPH_C32(0x05492000), + SPH_C32(0x70d6562d), SPH_C32(0x98bd7fce), SPH_C32(0x713ce808), + SPH_C32(0x52548a4d) }, + { SPH_C32(0x63780000), SPH_C32(0x7bdd0000), SPH_C32(0x7fc9003d), + SPH_C32(0xfb6c2000), SPH_C32(0x2dc730a5), SPH_C32(0xdd240014), + SPH_C32(0x8615a66c), SPH_C32(0x118c66a6), SPH_C32(0xd7360000), + SPH_C32(0x2dba0000), SPH_C32(0x80880025), SPH_C32(0xaa283800), + SPH_C32(0x551d78e8), SPH_C32(0x50c4c01e), SPH_C32(0xf09eec21), + SPH_C32(0x4c21bceb) }, + { SPH_C32(0x84b70000), SPH_C32(0x76a70000), SPH_C32(0x86330028), + SPH_C32(0x79c50000), SPH_C32(0x23d76cc7), SPH_C32(0x5ce84480), + SPH_C32(0xa88d56d0), SPH_C32(0xaed3d139), SPH_C32(0x2a4e0000), + SPH_C32(0xb9e20000), SPH_C32(0xb68b003a), SPH_C32(0x10ed0000), + SPH_C32(0x3db429e1), SPH_C32(0x51b655fe), SPH_C32(0xabdc7a96), + SPH_C32(0x7d7e8c1c) }, + { SPH_C32(0xdcf40000), SPH_C32(0xf6d90000), SPH_C32(0xfe000029), + SPH_C32(0xbfae3800), SPH_C32(0xc4e0301b), SPH_C32(0x25457b5d), + SPH_C32(0x04fea8bf), SPH_C32(0x9497a888), SPH_C32(0x37140000), + SPH_C32(0x92900000), SPH_C32(0xfe06003a), SPH_C32(0xbf8c1800), + SPH_C32(0x187f0724), SPH_C32(0x99cfea2e), SPH_C32(0x2a7e7ebf), + SPH_C32(0x630bbaba) }, + { SPH_C32(0x99ed0000), SPH_C32(0x5dd50000), SPH_C32(0xcebe0028), + SPH_C32(0xd6a41800), SPH_C32(0x061c4202), SPH_C32(0x9491fb50), + SPH_C32(0x292f52f9), SPH_C32(0xb0a6e79f), SPH_C32(0x6f570000), + SPH_C32(0x12ee0000), SPH_C32(0x8635003b), SPH_C32(0x79e72000), + SPH_C32(0xff485bf8), SPH_C32(0xe062d5f3), SPH_C32(0x860d80d0), + SPH_C32(0x594fc30b) }, + { SPH_C32(0xc1ae0000), SPH_C32(0xddab0000), SPH_C32(0xb68d0029), + SPH_C32(0x10cf2000), SPH_C32(0xe12b1ede), SPH_C32(0xed3cc48d), + SPH_C32(0x855cac96), SPH_C32(0x8ae29e2e), SPH_C32(0x720d0000), + SPH_C32(0x399c0000), SPH_C32(0xceb8003b), SPH_C32(0xd6863800), + SPH_C32(0xda83753d), SPH_C32(0x281b6a23), SPH_C32(0x07af84f9), + SPH_C32(0x473af5ad) }, + { SPH_C32(0x218c0000), SPH_C32(0x62810000), SPH_C32(0xc8030036), + SPH_C32(0x056b0000), SPH_C32(0xac496112), SPH_C32(0x2437eebd), + SPH_C32(0x5fbc3e08), SPH_C32(0xa5c8987f), SPH_C32(0x2da30000), + SPH_C32(0x0bb20000), SPH_C32(0x31ff0030), SPH_C32(0x87e00000), + SPH_C32(0x7ec60a4f), SPH_C32(0x19713b5a), SPH_C32(0x5fa418b4), + SPH_C32(0xed0b3dd2) }, + { SPH_C32(0x79cf0000), SPH_C32(0xe2ff0000), SPH_C32(0xb0300037), + SPH_C32(0xc3003800), SPH_C32(0x4b7e3dce), SPH_C32(0x5d9ad160), + SPH_C32(0xf3cfc067), SPH_C32(0x9f8ce1ce), SPH_C32(0x30f90000), + SPH_C32(0x20c00000), SPH_C32(0x79720030), SPH_C32(0x28811800), + SPH_C32(0x5b0d248a), SPH_C32(0xd108848a), SPH_C32(0xde061c9d), + SPH_C32(0xf37e0b74) }, + { SPH_C32(0x3cd60000), SPH_C32(0x49f30000), SPH_C32(0x808e0036), + SPH_C32(0xaa0a1800), SPH_C32(0x89824fd7), SPH_C32(0xec4e516d), + SPH_C32(0xde1e3a21), SPH_C32(0xbbbdaed9), SPH_C32(0x68ba0000), + SPH_C32(0xa0be0000), SPH_C32(0x01410031), SPH_C32(0xeeea2000), + SPH_C32(0xbc3a7856), SPH_C32(0xa8a5bb57), SPH_C32(0x7275e2f2), + SPH_C32(0xc93a72c5) }, + { SPH_C32(0x64950000), SPH_C32(0xc98d0000), SPH_C32(0xf8bd0037), + SPH_C32(0x6c612000), SPH_C32(0x6eb5130b), SPH_C32(0x95e36eb0), + SPH_C32(0x726dc44e), SPH_C32(0x81f9d768), SPH_C32(0x75e00000), + SPH_C32(0x8bcc0000), SPH_C32(0x49cc0031), SPH_C32(0x418b3800), + SPH_C32(0x99f15693), SPH_C32(0x60dc0487), SPH_C32(0xf3d7e6db), + SPH_C32(0xd74f4463) } +}; + +static const sph_u32 T512_48[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xb4310000), SPH_C32(0x77330000), SPH_C32(0xb15d0000), + SPH_C32(0x7fd004e0), SPH_C32(0x78a26138), SPH_C32(0xd116c35d), + SPH_C32(0xd256d489), SPH_C32(0x4e6f74de), SPH_C32(0xe3060000), + SPH_C32(0xbdc10000), SPH_C32(0x87130000), SPH_C32(0xbff20060), + SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), SPH_C32(0x73c5ab06), + SPH_C32(0x5bd61539) }, + { SPH_C32(0xe3060000), SPH_C32(0xbdc10000), SPH_C32(0x87130000), + SPH_C32(0xbff20060), SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), + SPH_C32(0x73c5ab06), SPH_C32(0x5bd61539), SPH_C32(0x57370000), + SPH_C32(0xcaf20000), SPH_C32(0x364e0000), SPH_C32(0xc0220480), + SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), SPH_C32(0xa1937f8f), + SPH_C32(0x15b961e7) }, + { SPH_C32(0x57370000), SPH_C32(0xcaf20000), SPH_C32(0x364e0000), + SPH_C32(0xc0220480), SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), + SPH_C32(0xa1937f8f), SPH_C32(0x15b961e7), SPH_C32(0xb4310000), + SPH_C32(0x77330000), SPH_C32(0xb15d0000), SPH_C32(0x7fd004e0), + SPH_C32(0x78a26138), SPH_C32(0xd116c35d), SPH_C32(0xd256d489), + SPH_C32(0x4e6f74de) }, + { SPH_C32(0x02f20000), SPH_C32(0xa2810000), SPH_C32(0x873f0000), + SPH_C32(0xe36c7800), SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), + SPH_C32(0xc4c23237), SPH_C32(0x7f32259e), SPH_C32(0xbadd0000), + SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), SPH_C32(0xf7282800), + SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), SPH_C32(0xea5a8d14), + SPH_C32(0x2a2c18f0) }, + { SPH_C32(0xb6c30000), SPH_C32(0xd5b20000), SPH_C32(0x36620000), + SPH_C32(0x9cbc7ce0), SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), + SPH_C32(0x1694e6be), SPH_C32(0x315d5140), SPH_C32(0x59db0000), + SPH_C32(0xae6c0000), SPH_C32(0x30f40000), SPH_C32(0x48da2860), + SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), SPH_C32(0x999f2612), + SPH_C32(0x71fa0dc9) }, + { SPH_C32(0xe1f40000), SPH_C32(0x1f400000), SPH_C32(0x002c0000), + SPH_C32(0x5c9e7860), SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), + SPH_C32(0xb7079931), SPH_C32(0x24e430a7), SPH_C32(0xedea0000), + SPH_C32(0xd95f0000), SPH_C32(0x81a90000), SPH_C32(0x370a2c80), + SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), SPH_C32(0x4bc9f29b), + SPH_C32(0x3f957917) }, + { SPH_C32(0x55c50000), SPH_C32(0x68730000), SPH_C32(0xb1710000), + SPH_C32(0x234e7c80), SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), + SPH_C32(0x65514db8), SPH_C32(0x6a8b4479), SPH_C32(0x0eec0000), + SPH_C32(0x649e0000), SPH_C32(0x06ba0000), SPH_C32(0x88f82ce0), + SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), SPH_C32(0x380c599d), + SPH_C32(0x64436c2e) }, + { SPH_C32(0xbadd0000), SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), + SPH_C32(0xf7282800), SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), + SPH_C32(0xea5a8d14), SPH_C32(0x2a2c18f0), SPH_C32(0xb82f0000), + SPH_C32(0xb12c0000), SPH_C32(0x30d80000), SPH_C32(0x14445000), + SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), SPH_C32(0x2e98bf23), + SPH_C32(0x551e3d6e) }, + { SPH_C32(0x0eec0000), SPH_C32(0x649e0000), SPH_C32(0x06ba0000), + SPH_C32(0x88f82ce0), SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), + SPH_C32(0x380c599d), SPH_C32(0x64436c2e), SPH_C32(0x5b290000), + SPH_C32(0x0ced0000), SPH_C32(0xb7cb0000), SPH_C32(0xabb65060), + SPH_C32(0xefe26ab8), SPH_C32(0xbc92dfbd), SPH_C32(0x5d5d1425), + SPH_C32(0x0ec82857) }, + { SPH_C32(0x59db0000), SPH_C32(0xae6c0000), SPH_C32(0x30f40000), + SPH_C32(0x48da2860), SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), + SPH_C32(0x999f2612), SPH_C32(0x71fa0dc9), SPH_C32(0xef180000), + SPH_C32(0x7bde0000), SPH_C32(0x06960000), SPH_C32(0xd4665480), + SPH_C32(0x97400b80), SPH_C32(0x6d841ce0), SPH_C32(0x8f0bc0ac), + SPH_C32(0x40a75c89) }, + { SPH_C32(0xedea0000), SPH_C32(0xd95f0000), SPH_C32(0x81a90000), + SPH_C32(0x370a2c80), SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), + SPH_C32(0x4bc9f29b), SPH_C32(0x3f957917), SPH_C32(0x0c1e0000), + SPH_C32(0xc61f0000), SPH_C32(0x81850000), SPH_C32(0x6b9454e0), + SPH_C32(0xb9fa019a), SPH_C32(0xe0312bb1), SPH_C32(0xfcce6baa), + SPH_C32(0x1b7149b0) }, + { SPH_C32(0xb82f0000), SPH_C32(0xb12c0000), SPH_C32(0x30d80000), + SPH_C32(0x14445000), SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), + SPH_C32(0x2e98bf23), SPH_C32(0x551e3d6e), SPH_C32(0x02f20000), + SPH_C32(0xa2810000), SPH_C32(0x873f0000), SPH_C32(0xe36c7800), + SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), SPH_C32(0xc4c23237), + SPH_C32(0x7f32259e) }, + { SPH_C32(0x0c1e0000), SPH_C32(0xc61f0000), SPH_C32(0x81850000), + SPH_C32(0x6b9454e0), SPH_C32(0xb9fa019a), SPH_C32(0xe0312bb1), + SPH_C32(0xfcce6baa), SPH_C32(0x1b7149b0), SPH_C32(0xe1f40000), + SPH_C32(0x1f400000), SPH_C32(0x002c0000), SPH_C32(0x5c9e7860), + SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), SPH_C32(0xb7079931), + SPH_C32(0x24e430a7) }, + { SPH_C32(0x5b290000), SPH_C32(0x0ced0000), SPH_C32(0xb7cb0000), + SPH_C32(0xabb65060), SPH_C32(0xefe26ab8), SPH_C32(0xbc92dfbd), + SPH_C32(0x5d5d1425), SPH_C32(0x0ec82857), SPH_C32(0x55c50000), + SPH_C32(0x68730000), SPH_C32(0xb1710000), SPH_C32(0x234e7c80), + SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), SPH_C32(0x65514db8), + SPH_C32(0x6a8b4479) }, + { SPH_C32(0xef180000), SPH_C32(0x7bde0000), SPH_C32(0x06960000), + SPH_C32(0xd4665480), SPH_C32(0x97400b80), SPH_C32(0x6d841ce0), + SPH_C32(0x8f0bc0ac), SPH_C32(0x40a75c89), SPH_C32(0xb6c30000), + SPH_C32(0xd5b20000), SPH_C32(0x36620000), SPH_C32(0x9cbc7ce0), + SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), SPH_C32(0x1694e6be), + SPH_C32(0x315d5140) }, + { SPH_C32(0x1e6c0000), SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), + SPH_C32(0xbcb6b800), SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), + SPH_C32(0x6a0c1bc8), SPH_C32(0xb99dc2eb), SPH_C32(0x92560000), + SPH_C32(0x1eda0000), SPH_C32(0xea510000), SPH_C32(0xe8b13000), + SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), SPH_C32(0xb15c2254), + SPH_C32(0x33c5244f) }, + { SPH_C32(0xaa5d0000), SPH_C32(0xb3710000), SPH_C32(0x3b730000), + SPH_C32(0xc366bce0), SPH_C32(0x54e6728e), SPH_C32(0x5aeb1087), + SPH_C32(0xb85acf41), SPH_C32(0xf7f2b635), SPH_C32(0x71500000), + SPH_C32(0xa31b0000), SPH_C32(0x6d420000), SPH_C32(0x57433060), + SPH_C32(0x878f5cbf), SPH_C32(0x664e56c8), SPH_C32(0xc2998952), + SPH_C32(0x68133176) }, + { SPH_C32(0xfd6a0000), SPH_C32(0x79830000), SPH_C32(0x0d3d0000), + SPH_C32(0x0344b860), SPH_C32(0x02fe19ac), SPH_C32(0x0648e48b), + SPH_C32(0x19c9b0ce), SPH_C32(0xe24bd7d2), SPH_C32(0xc5610000), + SPH_C32(0xd4280000), SPH_C32(0xdc1f0000), SPH_C32(0x28933480), + SPH_C32(0xff2d3d87), SPH_C32(0xb7589595), SPH_C32(0x10cf5ddb), + SPH_C32(0x267c45a8) }, + { SPH_C32(0x495b0000), SPH_C32(0x0eb00000), SPH_C32(0xbc600000), + SPH_C32(0x7c94bc80), SPH_C32(0x7a5c7894), SPH_C32(0xd75e27d6), + SPH_C32(0xcb9f6447), SPH_C32(0xac24a30c), SPH_C32(0x26670000), + SPH_C32(0x69e90000), SPH_C32(0x5b0c0000), SPH_C32(0x976134e0), + SPH_C32(0xd197379d), SPH_C32(0x3aeda2c4), SPH_C32(0x630af6dd), + SPH_C32(0x7daa5091) }, + { SPH_C32(0x1c9e0000), SPH_C32(0x66c30000), SPH_C32(0x0d110000), + SPH_C32(0x5fdac000), SPH_C32(0x32596759), SPH_C32(0x8cc0f80c), + SPH_C32(0xaece29ff), SPH_C32(0xc6afe775), SPH_C32(0x288b0000), + SPH_C32(0x0d770000), SPH_C32(0x5db60000), SPH_C32(0x1f991800), + SPH_C32(0x767042e8), SPH_C32(0xdde1a2a3), SPH_C32(0x5b06af40), + SPH_C32(0x19e93cbf) }, + { SPH_C32(0xa8af0000), SPH_C32(0x11f00000), SPH_C32(0xbc4c0000), + SPH_C32(0x200ac4e0), SPH_C32(0x4afb0661), SPH_C32(0x5dd63b51), + SPH_C32(0x7c98fd76), SPH_C32(0x88c093ab), SPH_C32(0xcb8d0000), + SPH_C32(0xb0b60000), SPH_C32(0xdaa50000), SPH_C32(0xa06b1860), + SPH_C32(0x58ca48f2), SPH_C32(0x505495f2), SPH_C32(0x28c30446), + SPH_C32(0x423f2986) }, + { SPH_C32(0xff980000), SPH_C32(0xdb020000), SPH_C32(0x8a020000), + SPH_C32(0xe028c060), SPH_C32(0x1ce36d43), SPH_C32(0x0175cf5d), + SPH_C32(0xdd0b82f9), SPH_C32(0x9d79f24c), SPH_C32(0x7fbc0000), + SPH_C32(0xc7850000), SPH_C32(0x6bf80000), SPH_C32(0xdfbb1c80), + SPH_C32(0x206829ca), SPH_C32(0x814256af), SPH_C32(0xfa95d0cf), + SPH_C32(0x0c505d58) }, + { SPH_C32(0x4ba90000), SPH_C32(0xac310000), SPH_C32(0x3b5f0000), + SPH_C32(0x9ff8c480), SPH_C32(0x64410c7b), SPH_C32(0xd0630c00), + SPH_C32(0x0f5d5670), SPH_C32(0xd3168692), SPH_C32(0x9cba0000), + SPH_C32(0x7a440000), SPH_C32(0xeceb0000), SPH_C32(0x60491ce0), + SPH_C32(0x0ed223d0), SPH_C32(0x0cf761fe), SPH_C32(0x89507bc9), + SPH_C32(0x57864861) }, + { SPH_C32(0xa4b10000), SPH_C32(0xd7ef0000), SPH_C32(0x3dc90000), + SPH_C32(0x4b9e9000), SPH_C32(0xf30107fb), SPH_C32(0xbde710e0), + SPH_C32(0x805696dc), SPH_C32(0x93b1da1b), SPH_C32(0x2a790000), + SPH_C32(0xaff60000), SPH_C32(0xda890000), SPH_C32(0xfcf56000), + SPH_C32(0x686d3607), SPH_C32(0xdadc8975), SPH_C32(0x9fc49d77), + SPH_C32(0x66db1921) }, + { SPH_C32(0x10800000), SPH_C32(0xa0dc0000), SPH_C32(0x8c940000), + SPH_C32(0x344e94e0), SPH_C32(0x8ba366c3), SPH_C32(0x6cf1d3bd), + SPH_C32(0x52004255), SPH_C32(0xdddeaec5), SPH_C32(0xc97f0000), + SPH_C32(0x12370000), SPH_C32(0x5d9a0000), SPH_C32(0x43076060), + SPH_C32(0x46d73c1d), SPH_C32(0x5769be24), SPH_C32(0xec013671), + SPH_C32(0x3d0d0c18) }, + { SPH_C32(0x47b70000), SPH_C32(0x6a2e0000), SPH_C32(0xbada0000), + SPH_C32(0xf46c9060), SPH_C32(0xddbb0de1), SPH_C32(0x305227b1), + SPH_C32(0xf3933dda), SPH_C32(0xc867cf22), SPH_C32(0x7d4e0000), + SPH_C32(0x65040000), SPH_C32(0xecc70000), SPH_C32(0x3cd76480), + SPH_C32(0x3e755d25), SPH_C32(0x867f7d79), SPH_C32(0x3e57e2f8), + SPH_C32(0x736278c6) }, + { SPH_C32(0xf3860000), SPH_C32(0x1d1d0000), SPH_C32(0x0b870000), + SPH_C32(0x8bbc9480), SPH_C32(0xa5196cd9), SPH_C32(0xe144e4ec), + SPH_C32(0x21c5e953), SPH_C32(0x8608bbfc), SPH_C32(0x9e480000), + SPH_C32(0xd8c50000), SPH_C32(0x6bd40000), SPH_C32(0x832564e0), + SPH_C32(0x10cf573f), SPH_C32(0x0bca4a28), SPH_C32(0x4d9249fe), + SPH_C32(0x28b46dff) }, + { SPH_C32(0xa6430000), SPH_C32(0x756e0000), SPH_C32(0xbaf60000), + SPH_C32(0xa8f2e800), SPH_C32(0xed1c7314), SPH_C32(0xbada3b36), + SPH_C32(0x4494a4eb), SPH_C32(0xec83ff85), SPH_C32(0x90a40000), + SPH_C32(0xbc5b0000), SPH_C32(0x6d6e0000), SPH_C32(0x0bdd4800), + SPH_C32(0xb728224a), SPH_C32(0xecc64a4f), SPH_C32(0x759e1063), + SPH_C32(0x4cf701d1) }, + { SPH_C32(0x12720000), SPH_C32(0x025d0000), SPH_C32(0x0bab0000), + SPH_C32(0xd722ece0), SPH_C32(0x95be122c), SPH_C32(0x6bccf86b), + SPH_C32(0x96c27062), SPH_C32(0xa2ec8b5b), SPH_C32(0x73a20000), + SPH_C32(0x019a0000), SPH_C32(0xea7d0000), SPH_C32(0xb42f4860), + SPH_C32(0x99922850), SPH_C32(0x61737d1e), SPH_C32(0x065bbb65), + SPH_C32(0x172114e8) }, + { SPH_C32(0x45450000), SPH_C32(0xc8af0000), SPH_C32(0x3de50000), + SPH_C32(0x1700e860), SPH_C32(0xc3a6790e), SPH_C32(0x376f0c67), + SPH_C32(0x37510fed), SPH_C32(0xb755eabc), SPH_C32(0xc7930000), + SPH_C32(0x76a90000), SPH_C32(0x5b200000), SPH_C32(0xcbff4c80), + SPH_C32(0xe1304968), SPH_C32(0xb065be43), SPH_C32(0xd40d6fec), + SPH_C32(0x594e6036) }, + { SPH_C32(0xf1740000), SPH_C32(0xbf9c0000), SPH_C32(0x8cb80000), + SPH_C32(0x68d0ec80), SPH_C32(0xbb041836), SPH_C32(0xe679cf3a), + SPH_C32(0xe507db64), SPH_C32(0xf93a9e62), SPH_C32(0x24950000), + SPH_C32(0xcb680000), SPH_C32(0xdc330000), SPH_C32(0x740d4ce0), + SPH_C32(0xcf8a4372), SPH_C32(0x3dd08912), SPH_C32(0xa7c8c4ea), + SPH_C32(0x0298750f) }, + { SPH_C32(0x92560000), SPH_C32(0x1eda0000), SPH_C32(0xea510000), + SPH_C32(0xe8b13000), SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), + SPH_C32(0xb15c2254), SPH_C32(0x33c5244f), SPH_C32(0x8c3a0000), + SPH_C32(0xda980000), SPH_C32(0x607f0000), SPH_C32(0x54078800), + SPH_C32(0x85714513), SPH_C32(0x6006b243), SPH_C32(0xdb50399c), + SPH_C32(0x8a58e6a4) }, + { SPH_C32(0x26670000), SPH_C32(0x69e90000), SPH_C32(0x5b0c0000), + SPH_C32(0x976134e0), SPH_C32(0xd197379d), SPH_C32(0x3aeda2c4), + SPH_C32(0x630af6dd), SPH_C32(0x7daa5091), SPH_C32(0x6f3c0000), + SPH_C32(0x67590000), SPH_C32(0xe76c0000), SPH_C32(0xebf58860), + SPH_C32(0xabcb4f09), SPH_C32(0xedb38512), SPH_C32(0xa895929a), + SPH_C32(0xd18ef39d) }, + { SPH_C32(0x71500000), SPH_C32(0xa31b0000), SPH_C32(0x6d420000), + SPH_C32(0x57433060), SPH_C32(0x878f5cbf), SPH_C32(0x664e56c8), + SPH_C32(0xc2998952), SPH_C32(0x68133176), SPH_C32(0xdb0d0000), + SPH_C32(0x106a0000), SPH_C32(0x56310000), SPH_C32(0x94258c80), + SPH_C32(0xd3692e31), SPH_C32(0x3ca5464f), SPH_C32(0x7ac34613), + SPH_C32(0x9fe18743) }, + { SPH_C32(0xc5610000), SPH_C32(0xd4280000), SPH_C32(0xdc1f0000), + SPH_C32(0x28933480), SPH_C32(0xff2d3d87), SPH_C32(0xb7589595), + SPH_C32(0x10cf5ddb), SPH_C32(0x267c45a8), SPH_C32(0x380b0000), + SPH_C32(0xadab0000), SPH_C32(0xd1220000), SPH_C32(0x2bd78ce0), + SPH_C32(0xfdd3242b), SPH_C32(0xb110711e), SPH_C32(0x0906ed15), + SPH_C32(0xc437927a) }, + { SPH_C32(0x90a40000), SPH_C32(0xbc5b0000), SPH_C32(0x6d6e0000), + SPH_C32(0x0bdd4800), SPH_C32(0xb728224a), SPH_C32(0xecc64a4f), + SPH_C32(0x759e1063), SPH_C32(0x4cf701d1), SPH_C32(0x36e70000), + SPH_C32(0xc9350000), SPH_C32(0xd7980000), SPH_C32(0xa32fa000), + SPH_C32(0x5a34515e), SPH_C32(0x561c7179), SPH_C32(0x310ab488), + SPH_C32(0xa074fe54) }, + { SPH_C32(0x24950000), SPH_C32(0xcb680000), SPH_C32(0xdc330000), + SPH_C32(0x740d4ce0), SPH_C32(0xcf8a4372), SPH_C32(0x3dd08912), + SPH_C32(0xa7c8c4ea), SPH_C32(0x0298750f), SPH_C32(0xd5e10000), + SPH_C32(0x74f40000), SPH_C32(0x508b0000), SPH_C32(0x1cdda060), + SPH_C32(0x748e5b44), SPH_C32(0xdba94628), SPH_C32(0x42cf1f8e), + SPH_C32(0xfba2eb6d) }, + { SPH_C32(0x73a20000), SPH_C32(0x019a0000), SPH_C32(0xea7d0000), + SPH_C32(0xb42f4860), SPH_C32(0x99922850), SPH_C32(0x61737d1e), + SPH_C32(0x065bbb65), SPH_C32(0x172114e8), SPH_C32(0x61d00000), + SPH_C32(0x03c70000), SPH_C32(0xe1d60000), SPH_C32(0x630da480), + SPH_C32(0x0c2c3a7c), SPH_C32(0x0abf8575), SPH_C32(0x9099cb07), + SPH_C32(0xb5cd9fb3) }, + { SPH_C32(0xc7930000), SPH_C32(0x76a90000), SPH_C32(0x5b200000), + SPH_C32(0xcbff4c80), SPH_C32(0xe1304968), SPH_C32(0xb065be43), + SPH_C32(0xd40d6fec), SPH_C32(0x594e6036), SPH_C32(0x82d60000), + SPH_C32(0xbe060000), SPH_C32(0x66c50000), SPH_C32(0xdcffa4e0), + SPH_C32(0x22963066), SPH_C32(0x870ab224), SPH_C32(0xe35c6001), + SPH_C32(0xee1b8a8a) }, + { SPH_C32(0x288b0000), SPH_C32(0x0d770000), SPH_C32(0x5db60000), + SPH_C32(0x1f991800), SPH_C32(0x767042e8), SPH_C32(0xdde1a2a3), + SPH_C32(0x5b06af40), SPH_C32(0x19e93cbf), SPH_C32(0x34150000), + SPH_C32(0x6bb40000), SPH_C32(0x50a70000), SPH_C32(0x4043d800), + SPH_C32(0x442925b1), SPH_C32(0x51215aaf), SPH_C32(0xf5c886bf), + SPH_C32(0xdf46dbca) }, + { SPH_C32(0x9cba0000), SPH_C32(0x7a440000), SPH_C32(0xeceb0000), + SPH_C32(0x60491ce0), SPH_C32(0x0ed223d0), SPH_C32(0x0cf761fe), + SPH_C32(0x89507bc9), SPH_C32(0x57864861), SPH_C32(0xd7130000), + SPH_C32(0xd6750000), SPH_C32(0xd7b40000), SPH_C32(0xffb1d860), + SPH_C32(0x6a932fab), SPH_C32(0xdc946dfe), SPH_C32(0x860d2db9), + SPH_C32(0x8490cef3) }, + { SPH_C32(0xcb8d0000), SPH_C32(0xb0b60000), SPH_C32(0xdaa50000), + SPH_C32(0xa06b1860), SPH_C32(0x58ca48f2), SPH_C32(0x505495f2), + SPH_C32(0x28c30446), SPH_C32(0x423f2986), SPH_C32(0x63220000), + SPH_C32(0xa1460000), SPH_C32(0x66e90000), SPH_C32(0x8061dc80), + SPH_C32(0x12314e93), SPH_C32(0x0d82aea3), SPH_C32(0x545bf930), + SPH_C32(0xcaffba2d) }, + { SPH_C32(0x7fbc0000), SPH_C32(0xc7850000), SPH_C32(0x6bf80000), + SPH_C32(0xdfbb1c80), SPH_C32(0x206829ca), SPH_C32(0x814256af), + SPH_C32(0xfa95d0cf), SPH_C32(0x0c505d58), SPH_C32(0x80240000), + SPH_C32(0x1c870000), SPH_C32(0xe1fa0000), SPH_C32(0x3f93dce0), + SPH_C32(0x3c8b4489), SPH_C32(0x803799f2), SPH_C32(0x279e5236), + SPH_C32(0x9129af14) }, + { SPH_C32(0x2a790000), SPH_C32(0xaff60000), SPH_C32(0xda890000), + SPH_C32(0xfcf56000), SPH_C32(0x686d3607), SPH_C32(0xdadc8975), + SPH_C32(0x9fc49d77), SPH_C32(0x66db1921), SPH_C32(0x8ec80000), + SPH_C32(0x78190000), SPH_C32(0xe7400000), SPH_C32(0xb76bf000), + SPH_C32(0x9b6c31fc), SPH_C32(0x673b9995), SPH_C32(0x1f920bab), + SPH_C32(0xf56ac33a) }, + { SPH_C32(0x9e480000), SPH_C32(0xd8c50000), SPH_C32(0x6bd40000), + SPH_C32(0x832564e0), SPH_C32(0x10cf573f), SPH_C32(0x0bca4a28), + SPH_C32(0x4d9249fe), SPH_C32(0x28b46dff), SPH_C32(0x6dce0000), + SPH_C32(0xc5d80000), SPH_C32(0x60530000), SPH_C32(0x0899f060), + SPH_C32(0xb5d63be6), SPH_C32(0xea8eaec4), SPH_C32(0x6c57a0ad), + SPH_C32(0xaebcd603) }, + { SPH_C32(0xc97f0000), SPH_C32(0x12370000), SPH_C32(0x5d9a0000), + SPH_C32(0x43076060), SPH_C32(0x46d73c1d), SPH_C32(0x5769be24), + SPH_C32(0xec013671), SPH_C32(0x3d0d0c18), SPH_C32(0xd9ff0000), + SPH_C32(0xb2eb0000), SPH_C32(0xd10e0000), SPH_C32(0x7749f480), + SPH_C32(0xcd745ade), SPH_C32(0x3b986d99), SPH_C32(0xbe017424), + SPH_C32(0xe0d3a2dd) }, + { SPH_C32(0x7d4e0000), SPH_C32(0x65040000), SPH_C32(0xecc70000), + SPH_C32(0x3cd76480), SPH_C32(0x3e755d25), SPH_C32(0x867f7d79), + SPH_C32(0x3e57e2f8), SPH_C32(0x736278c6), SPH_C32(0x3af90000), + SPH_C32(0x0f2a0000), SPH_C32(0x561d0000), SPH_C32(0xc8bbf4e0), + SPH_C32(0xe3ce50c4), SPH_C32(0xb62d5ac8), SPH_C32(0xcdc4df22), + SPH_C32(0xbb05b7e4) }, + { SPH_C32(0x8c3a0000), SPH_C32(0xda980000), SPH_C32(0x607f0000), + SPH_C32(0x54078800), SPH_C32(0x85714513), SPH_C32(0x6006b243), + SPH_C32(0xdb50399c), SPH_C32(0x8a58e6a4), SPH_C32(0x1e6c0000), + SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), SPH_C32(0xbcb6b800), + SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), SPH_C32(0x6a0c1bc8), + SPH_C32(0xb99dc2eb) }, + { SPH_C32(0x380b0000), SPH_C32(0xadab0000), SPH_C32(0xd1220000), + SPH_C32(0x2bd78ce0), SPH_C32(0xfdd3242b), SPH_C32(0xb110711e), + SPH_C32(0x0906ed15), SPH_C32(0xc437927a), SPH_C32(0xfd6a0000), + SPH_C32(0x79830000), SPH_C32(0x0d3d0000), SPH_C32(0x0344b860), + SPH_C32(0x02fe19ac), SPH_C32(0x0648e48b), SPH_C32(0x19c9b0ce), + SPH_C32(0xe24bd7d2) }, + { SPH_C32(0x6f3c0000), SPH_C32(0x67590000), SPH_C32(0xe76c0000), + SPH_C32(0xebf58860), SPH_C32(0xabcb4f09), SPH_C32(0xedb38512), + SPH_C32(0xa895929a), SPH_C32(0xd18ef39d), SPH_C32(0x495b0000), + SPH_C32(0x0eb00000), SPH_C32(0xbc600000), SPH_C32(0x7c94bc80), + SPH_C32(0x7a5c7894), SPH_C32(0xd75e27d6), SPH_C32(0xcb9f6447), + SPH_C32(0xac24a30c) }, + { SPH_C32(0xdb0d0000), SPH_C32(0x106a0000), SPH_C32(0x56310000), + SPH_C32(0x94258c80), SPH_C32(0xd3692e31), SPH_C32(0x3ca5464f), + SPH_C32(0x7ac34613), SPH_C32(0x9fe18743), SPH_C32(0xaa5d0000), + SPH_C32(0xb3710000), SPH_C32(0x3b730000), SPH_C32(0xc366bce0), + SPH_C32(0x54e6728e), SPH_C32(0x5aeb1087), SPH_C32(0xb85acf41), + SPH_C32(0xf7f2b635) }, + { SPH_C32(0x8ec80000), SPH_C32(0x78190000), SPH_C32(0xe7400000), + SPH_C32(0xb76bf000), SPH_C32(0x9b6c31fc), SPH_C32(0x673b9995), + SPH_C32(0x1f920bab), SPH_C32(0xf56ac33a), SPH_C32(0xa4b10000), + SPH_C32(0xd7ef0000), SPH_C32(0x3dc90000), SPH_C32(0x4b9e9000), + SPH_C32(0xf30107fb), SPH_C32(0xbde710e0), SPH_C32(0x805696dc), + SPH_C32(0x93b1da1b) }, + { SPH_C32(0x3af90000), SPH_C32(0x0f2a0000), SPH_C32(0x561d0000), + SPH_C32(0xc8bbf4e0), SPH_C32(0xe3ce50c4), SPH_C32(0xb62d5ac8), + SPH_C32(0xcdc4df22), SPH_C32(0xbb05b7e4), SPH_C32(0x47b70000), + SPH_C32(0x6a2e0000), SPH_C32(0xbada0000), SPH_C32(0xf46c9060), + SPH_C32(0xddbb0de1), SPH_C32(0x305227b1), SPH_C32(0xf3933dda), + SPH_C32(0xc867cf22) }, + { SPH_C32(0x6dce0000), SPH_C32(0xc5d80000), SPH_C32(0x60530000), + SPH_C32(0x0899f060), SPH_C32(0xb5d63be6), SPH_C32(0xea8eaec4), + SPH_C32(0x6c57a0ad), SPH_C32(0xaebcd603), SPH_C32(0xf3860000), + SPH_C32(0x1d1d0000), SPH_C32(0x0b870000), SPH_C32(0x8bbc9480), + SPH_C32(0xa5196cd9), SPH_C32(0xe144e4ec), SPH_C32(0x21c5e953), + SPH_C32(0x8608bbfc) }, + { SPH_C32(0xd9ff0000), SPH_C32(0xb2eb0000), SPH_C32(0xd10e0000), + SPH_C32(0x7749f480), SPH_C32(0xcd745ade), SPH_C32(0x3b986d99), + SPH_C32(0xbe017424), SPH_C32(0xe0d3a2dd), SPH_C32(0x10800000), + SPH_C32(0xa0dc0000), SPH_C32(0x8c940000), SPH_C32(0x344e94e0), + SPH_C32(0x8ba366c3), SPH_C32(0x6cf1d3bd), SPH_C32(0x52004255), + SPH_C32(0xdddeaec5) }, + { SPH_C32(0x36e70000), SPH_C32(0xc9350000), SPH_C32(0xd7980000), + SPH_C32(0xa32fa000), SPH_C32(0x5a34515e), SPH_C32(0x561c7179), + SPH_C32(0x310ab488), SPH_C32(0xa074fe54), SPH_C32(0xa6430000), + SPH_C32(0x756e0000), SPH_C32(0xbaf60000), SPH_C32(0xa8f2e800), + SPH_C32(0xed1c7314), SPH_C32(0xbada3b36), SPH_C32(0x4494a4eb), + SPH_C32(0xec83ff85) }, + { SPH_C32(0x82d60000), SPH_C32(0xbe060000), SPH_C32(0x66c50000), + SPH_C32(0xdcffa4e0), SPH_C32(0x22963066), SPH_C32(0x870ab224), + SPH_C32(0xe35c6001), SPH_C32(0xee1b8a8a), SPH_C32(0x45450000), + SPH_C32(0xc8af0000), SPH_C32(0x3de50000), SPH_C32(0x1700e860), + SPH_C32(0xc3a6790e), SPH_C32(0x376f0c67), SPH_C32(0x37510fed), + SPH_C32(0xb755eabc) }, + { SPH_C32(0xd5e10000), SPH_C32(0x74f40000), SPH_C32(0x508b0000), + SPH_C32(0x1cdda060), SPH_C32(0x748e5b44), SPH_C32(0xdba94628), + SPH_C32(0x42cf1f8e), SPH_C32(0xfba2eb6d), SPH_C32(0xf1740000), + SPH_C32(0xbf9c0000), SPH_C32(0x8cb80000), SPH_C32(0x68d0ec80), + SPH_C32(0xbb041836), SPH_C32(0xe679cf3a), SPH_C32(0xe507db64), + SPH_C32(0xf93a9e62) }, + { SPH_C32(0x61d00000), SPH_C32(0x03c70000), SPH_C32(0xe1d60000), + SPH_C32(0x630da480), SPH_C32(0x0c2c3a7c), SPH_C32(0x0abf8575), + SPH_C32(0x9099cb07), SPH_C32(0xb5cd9fb3), SPH_C32(0x12720000), + SPH_C32(0x025d0000), SPH_C32(0x0bab0000), SPH_C32(0xd722ece0), + SPH_C32(0x95be122c), SPH_C32(0x6bccf86b), SPH_C32(0x96c27062), + SPH_C32(0xa2ec8b5b) }, + { SPH_C32(0x34150000), SPH_C32(0x6bb40000), SPH_C32(0x50a70000), + SPH_C32(0x4043d800), SPH_C32(0x442925b1), SPH_C32(0x51215aaf), + SPH_C32(0xf5c886bf), SPH_C32(0xdf46dbca), SPH_C32(0x1c9e0000), + SPH_C32(0x66c30000), SPH_C32(0x0d110000), SPH_C32(0x5fdac000), + SPH_C32(0x32596759), SPH_C32(0x8cc0f80c), SPH_C32(0xaece29ff), + SPH_C32(0xc6afe775) }, + { SPH_C32(0x80240000), SPH_C32(0x1c870000), SPH_C32(0xe1fa0000), + SPH_C32(0x3f93dce0), SPH_C32(0x3c8b4489), SPH_C32(0x803799f2), + SPH_C32(0x279e5236), SPH_C32(0x9129af14), SPH_C32(0xff980000), + SPH_C32(0xdb020000), SPH_C32(0x8a020000), SPH_C32(0xe028c060), + SPH_C32(0x1ce36d43), SPH_C32(0x0175cf5d), SPH_C32(0xdd0b82f9), + SPH_C32(0x9d79f24c) }, + { SPH_C32(0xd7130000), SPH_C32(0xd6750000), SPH_C32(0xd7b40000), + SPH_C32(0xffb1d860), SPH_C32(0x6a932fab), SPH_C32(0xdc946dfe), + SPH_C32(0x860d2db9), SPH_C32(0x8490cef3), SPH_C32(0x4ba90000), + SPH_C32(0xac310000), SPH_C32(0x3b5f0000), SPH_C32(0x9ff8c480), + SPH_C32(0x64410c7b), SPH_C32(0xd0630c00), SPH_C32(0x0f5d5670), + SPH_C32(0xd3168692) }, + { SPH_C32(0x63220000), SPH_C32(0xa1460000), SPH_C32(0x66e90000), + SPH_C32(0x8061dc80), SPH_C32(0x12314e93), SPH_C32(0x0d82aea3), + SPH_C32(0x545bf930), SPH_C32(0xcaffba2d), SPH_C32(0xa8af0000), + SPH_C32(0x11f00000), SPH_C32(0xbc4c0000), SPH_C32(0x200ac4e0), + SPH_C32(0x4afb0661), SPH_C32(0x5dd63b51), SPH_C32(0x7c98fd76), + SPH_C32(0x88c093ab) } +}; + +static const sph_u32 T512_54[64][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x5fa80000), SPH_C32(0x56030000), SPH_C32(0x43ae0000), + SPH_C32(0x64f30013), SPH_C32(0x257e86bf), SPH_C32(0x1311944e), + SPH_C32(0x541e95bf), SPH_C32(0x8ea4db69), SPH_C32(0x00440000), + SPH_C32(0x7f480000), SPH_C32(0xda7c0000), SPH_C32(0x2a230001), + SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), SPH_C32(0x030a9e60), + SPH_C32(0xbe0a679e) }, + { SPH_C32(0x00440000), SPH_C32(0x7f480000), SPH_C32(0xda7c0000), + SPH_C32(0x2a230001), SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), + SPH_C32(0x030a9e60), SPH_C32(0xbe0a679e), SPH_C32(0x5fec0000), + SPH_C32(0x294b0000), SPH_C32(0x99d20000), SPH_C32(0x4ed00012), + SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), SPH_C32(0x57140bdf), + SPH_C32(0x30aebcf7) }, + { SPH_C32(0x5fec0000), SPH_C32(0x294b0000), SPH_C32(0x99d20000), + SPH_C32(0x4ed00012), SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), + SPH_C32(0x57140bdf), SPH_C32(0x30aebcf7), SPH_C32(0x5fa80000), + SPH_C32(0x56030000), SPH_C32(0x43ae0000), SPH_C32(0x64f30013), + SPH_C32(0x257e86bf), SPH_C32(0x1311944e), SPH_C32(0x541e95bf), + SPH_C32(0x8ea4db69) }, + { SPH_C32(0xee930000), SPH_C32(0xd6070000), SPH_C32(0x92c10000), + SPH_C32(0x2b9801e0), SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), + SPH_C32(0x45312374), SPH_C32(0x201f6a64), SPH_C32(0x7b280000), + SPH_C32(0x57420000), SPH_C32(0xa9e50000), SPH_C32(0x634300a0), + SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), SPH_C32(0x27f83b03), + SPH_C32(0xc7ff60f0) }, + { SPH_C32(0xb13b0000), SPH_C32(0x80040000), SPH_C32(0xd16f0000), + SPH_C32(0x4f6b01f3), SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), + SPH_C32(0x112fb6cb), SPH_C32(0xaebbb10d), SPH_C32(0x7b6c0000), + SPH_C32(0x280a0000), SPH_C32(0x73990000), SPH_C32(0x496000a1), + SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), SPH_C32(0x24f2a563), + SPH_C32(0x79f5076e) }, + { SPH_C32(0xeed70000), SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), + SPH_C32(0x01bb01e1), SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), + SPH_C32(0x463bbd14), SPH_C32(0x9e150dfa), SPH_C32(0x24c40000), + SPH_C32(0x7e090000), SPH_C32(0x30370000), SPH_C32(0x2d9300b2), + SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), SPH_C32(0x70ec30dc), + SPH_C32(0xf751dc07) }, + { SPH_C32(0xb17f0000), SPH_C32(0xff4c0000), SPH_C32(0x0b130000), + SPH_C32(0x654801f2), SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), + SPH_C32(0x122528ab), SPH_C32(0x10b1d693), SPH_C32(0x24800000), + SPH_C32(0x01410000), SPH_C32(0xea4b0000), SPH_C32(0x07b000b3), + SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), SPH_C32(0x73e6aebc), + SPH_C32(0x495bbb99) }, + { SPH_C32(0x7b280000), SPH_C32(0x57420000), SPH_C32(0xa9e50000), + SPH_C32(0x634300a0), SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), + SPH_C32(0x27f83b03), SPH_C32(0xc7ff60f0), SPH_C32(0x95bb0000), + SPH_C32(0x81450000), SPH_C32(0x3b240000), SPH_C32(0x48db0140), + SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), SPH_C32(0x62c91877), + SPH_C32(0xe7e00a94) }, + { SPH_C32(0x24800000), SPH_C32(0x01410000), SPH_C32(0xea4b0000), + SPH_C32(0x07b000b3), SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), + SPH_C32(0x73e6aebc), SPH_C32(0x495bbb99), SPH_C32(0x95ff0000), + SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), SPH_C32(0x62f80141), + SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), SPH_C32(0x61c38617), + SPH_C32(0x59ea6d0a) }, + { SPH_C32(0x7b6c0000), SPH_C32(0x280a0000), SPH_C32(0x73990000), + SPH_C32(0x496000a1), SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), + SPH_C32(0x24f2a563), SPH_C32(0x79f5076e), SPH_C32(0xca570000), + SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), SPH_C32(0x060b0152), + SPH_C32(0x14592320), SPH_C32(0xec526625), SPH_C32(0x35dd13a8), + SPH_C32(0xd74eb663) }, + { SPH_C32(0x24c40000), SPH_C32(0x7e090000), SPH_C32(0x30370000), + SPH_C32(0x2d9300b2), SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), + SPH_C32(0x70ec30dc), SPH_C32(0xf751dc07), SPH_C32(0xca130000), + SPH_C32(0xd7460000), SPH_C32(0x788a0000), SPH_C32(0x2c280153), + SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), SPH_C32(0x36d78dc8), + SPH_C32(0x6944d1fd) }, + { SPH_C32(0x95bb0000), SPH_C32(0x81450000), SPH_C32(0x3b240000), + SPH_C32(0x48db0140), SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), + SPH_C32(0x62c91877), SPH_C32(0xe7e00a94), SPH_C32(0xee930000), + SPH_C32(0xd6070000), SPH_C32(0x92c10000), SPH_C32(0x2b9801e0), + SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), SPH_C32(0x45312374), + SPH_C32(0x201f6a64) }, + { SPH_C32(0xca130000), SPH_C32(0xd7460000), SPH_C32(0x788a0000), + SPH_C32(0x2c280153), SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), + SPH_C32(0x36d78dc8), SPH_C32(0x6944d1fd), SPH_C32(0xeed70000), + SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), SPH_C32(0x01bb01e1), + SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), SPH_C32(0x463bbd14), + SPH_C32(0x9e150dfa) }, + { SPH_C32(0x95ff0000), SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), + SPH_C32(0x62f80141), SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), + SPH_C32(0x61c38617), SPH_C32(0x59ea6d0a), SPH_C32(0xb17f0000), + SPH_C32(0xff4c0000), SPH_C32(0x0b130000), SPH_C32(0x654801f2), + SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), SPH_C32(0x122528ab), + SPH_C32(0x10b1d693) }, + { SPH_C32(0xca570000), SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), + SPH_C32(0x060b0152), SPH_C32(0x14592320), SPH_C32(0xec526625), + SPH_C32(0x35dd13a8), SPH_C32(0xd74eb663), SPH_C32(0xb13b0000), + SPH_C32(0x80040000), SPH_C32(0xd16f0000), SPH_C32(0x4f6b01f3), + SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), SPH_C32(0x112fb6cb), + SPH_C32(0xaebbb10d) }, + { SPH_C32(0xe6280000), SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), + SPH_C32(0xd3d002e0), SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), + SPH_C32(0x289506b4), SPH_C32(0xd75a4897), SPH_C32(0xf0c50000), + SPH_C32(0x59230000), SPH_C32(0x45820000), SPH_C32(0xe18d00c0), + SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), SPH_C32(0xcbe0fe1c), + SPH_C32(0x56a7b19f) }, + { SPH_C32(0xb9800000), SPH_C32(0x1a480000), SPH_C32(0xebfb0000), + SPH_C32(0xb72302f3), SPH_C32(0xfd1fb607), SPH_C32(0x8bb62494), + SPH_C32(0x7c8b930b), SPH_C32(0x59fe93fe), SPH_C32(0xf0810000), + SPH_C32(0x266b0000), SPH_C32(0x9ffe0000), SPH_C32(0xcbae00c1), + SPH_C32(0x00c0cffd), SPH_C32(0x6b5bca1e), SPH_C32(0xc8ea607c), + SPH_C32(0xe8add601) }, + { SPH_C32(0xe66c0000), SPH_C32(0x33030000), SPH_C32(0x72290000), + SPH_C32(0xf9f302e1), SPH_C32(0xe3ccf974), SPH_C32(0x31112c5d), + SPH_C32(0x2b9f98d4), SPH_C32(0x69502f09), SPH_C32(0xaf290000), + SPH_C32(0x70680000), SPH_C32(0xdc500000), SPH_C32(0xaf5d00d2), + SPH_C32(0x25be4942), SPH_C32(0x784a5e50), SPH_C32(0x9cf4f5c3), + SPH_C32(0x66090d68) }, + { SPH_C32(0xb9c40000), SPH_C32(0x65000000), SPH_C32(0x31870000), + SPH_C32(0x9d0002f2), SPH_C32(0xc6b27fcb), SPH_C32(0x2200b813), + SPH_C32(0x7f810d6b), SPH_C32(0xe7f4f460), SPH_C32(0xaf6d0000), + SPH_C32(0x0f200000), SPH_C32(0x062c0000), SPH_C32(0x857e00d3), + SPH_C32(0x1e13808e), SPH_C32(0xd1fcc2d7), SPH_C32(0x9ffe6ba3), + SPH_C32(0xd8036af6) }, + { SPH_C32(0x08bb0000), SPH_C32(0x9a4c0000), SPH_C32(0x3a940000), + SPH_C32(0xf8480300), SPH_C32(0x4c3018c4), SPH_C32(0xa3cb4b8d), + SPH_C32(0x6da425c0), SPH_C32(0xf74522f3), SPH_C32(0x8bed0000), + SPH_C32(0x0e610000), SPH_C32(0xec670000), SPH_C32(0x82ce0060), + SPH_C32(0xa5b6421e), SPH_C32(0xaf74c322), SPH_C32(0xec18c51f), + SPH_C32(0x9158d16f) }, + { SPH_C32(0x57130000), SPH_C32(0xcc4f0000), SPH_C32(0x793a0000), + SPH_C32(0x9cbb0313), SPH_C32(0x694e9e7b), SPH_C32(0xb0dadfc3), + SPH_C32(0x39bab07f), SPH_C32(0x79e1f99a), SPH_C32(0x8ba90000), + SPH_C32(0x71290000), SPH_C32(0x361b0000), SPH_C32(0xa8ed0061), + SPH_C32(0x9e1b8bd2), SPH_C32(0x06c25fa5), SPH_C32(0xef125b7f), + SPH_C32(0x2f52b6f1) }, + { SPH_C32(0x08ff0000), SPH_C32(0xe5040000), SPH_C32(0xe0e80000), + SPH_C32(0xd26b0301), SPH_C32(0x779dd108), SPH_C32(0x0a7dd70a), + SPH_C32(0x6eaebba0), SPH_C32(0x494f456d), SPH_C32(0xd4010000), + SPH_C32(0x272a0000), SPH_C32(0x75b50000), SPH_C32(0xcc1e0072), + SPH_C32(0xbb650d6d), SPH_C32(0x15d3cbeb), SPH_C32(0xbb0ccec0), + SPH_C32(0xa1f66d98) }, + { SPH_C32(0x57570000), SPH_C32(0xb3070000), SPH_C32(0xa3460000), + SPH_C32(0xb6980312), SPH_C32(0x52e357b7), SPH_C32(0x196c4344), + SPH_C32(0x3ab02e1f), SPH_C32(0xc7eb9e04), SPH_C32(0xd4450000), + SPH_C32(0x58620000), SPH_C32(0xafc90000), SPH_C32(0xe63d0073), + SPH_C32(0x80c8c4a1), SPH_C32(0xbc65576c), SPH_C32(0xb80650a0), + SPH_C32(0x1ffc0a06) }, + { SPH_C32(0x9d000000), SPH_C32(0x1b090000), SPH_C32(0x01b00000), + SPH_C32(0xb0930240), SPH_C32(0x46ba7497), SPH_C32(0xf53e2561), + SPH_C32(0x0f6d3db7), SPH_C32(0x10a52867), SPH_C32(0x657e0000), + SPH_C32(0xd8660000), SPH_C32(0x7ea60000), SPH_C32(0xa9560180), + SPH_C32(0x31e76a62), SPH_C32(0x94183875), SPH_C32(0xa929e66b), + SPH_C32(0xb147bb0b) }, + { SPH_C32(0xc2a80000), SPH_C32(0x4d0a0000), SPH_C32(0x421e0000), + SPH_C32(0xd4600253), SPH_C32(0x63c4f228), SPH_C32(0xe62fb12f), + SPH_C32(0x5b73a808), SPH_C32(0x9e01f30e), SPH_C32(0x653a0000), + SPH_C32(0xa72e0000), SPH_C32(0xa4da0000), SPH_C32(0x83750181), + SPH_C32(0x0a4aa3ae), SPH_C32(0x3daea4f2), SPH_C32(0xaa23780b), + SPH_C32(0x0f4ddc95) }, + { SPH_C32(0x9d440000), SPH_C32(0x64410000), SPH_C32(0xdbcc0000), + SPH_C32(0x9ab00241), SPH_C32(0x7d17bd5b), SPH_C32(0x5c88b9e6), + SPH_C32(0x0c67a3d7), SPH_C32(0xaeaf4ff9), SPH_C32(0x3a920000), + SPH_C32(0xf12d0000), SPH_C32(0xe7740000), SPH_C32(0xe7860192), + SPH_C32(0x2f342511), SPH_C32(0x2ebf30bc), SPH_C32(0xfe3dedb4), + SPH_C32(0x81e907fc) }, + { SPH_C32(0xc2ec0000), SPH_C32(0x32420000), SPH_C32(0x98620000), + SPH_C32(0xfe430252), SPH_C32(0x58693be4), SPH_C32(0x4f992da8), + SPH_C32(0x58793668), SPH_C32(0x200b9490), SPH_C32(0x3ad60000), + SPH_C32(0x8e650000), SPH_C32(0x3d080000), SPH_C32(0xcda50193), + SPH_C32(0x1499ecdd), SPH_C32(0x8709ac3b), SPH_C32(0xfd3773d4), + SPH_C32(0x3fe36062) }, + { SPH_C32(0x73930000), SPH_C32(0xcd0e0000), SPH_C32(0x93710000), + SPH_C32(0x9b0b03a0), SPH_C32(0xd2eb5ceb), SPH_C32(0xce52de36), + SPH_C32(0x4a5c1ec3), SPH_C32(0x30ba4203), SPH_C32(0x1e560000), + SPH_C32(0x8f240000), SPH_C32(0xd7430000), SPH_C32(0xca150120), + SPH_C32(0xaf3c2e4d), SPH_C32(0xf981adce), SPH_C32(0x8ed1dd68), + SPH_C32(0x76b8dbfb) }, + { SPH_C32(0x2c3b0000), SPH_C32(0x9b0d0000), SPH_C32(0xd0df0000), + SPH_C32(0xfff803b3), SPH_C32(0xf795da54), SPH_C32(0xdd434a78), + SPH_C32(0x1e428b7c), SPH_C32(0xbe1e996a), SPH_C32(0x1e120000), + SPH_C32(0xf06c0000), SPH_C32(0x0d3f0000), SPH_C32(0xe0360121), + SPH_C32(0x9491e781), SPH_C32(0x50373149), SPH_C32(0x8ddb4308), + SPH_C32(0xc8b2bc65) }, + { SPH_C32(0x73d70000), SPH_C32(0xb2460000), SPH_C32(0x490d0000), + SPH_C32(0xb12803a1), SPH_C32(0xe9469527), SPH_C32(0x67e442b1), + SPH_C32(0x495680a3), SPH_C32(0x8eb0259d), SPH_C32(0x41ba0000), + SPH_C32(0xa66f0000), SPH_C32(0x4e910000), SPH_C32(0x84c50132), + SPH_C32(0xb1ef613e), SPH_C32(0x4326a507), SPH_C32(0xd9c5d6b7), + SPH_C32(0x4616670c) }, + { SPH_C32(0x2c7f0000), SPH_C32(0xe4450000), SPH_C32(0x0aa30000), + SPH_C32(0xd5db03b2), SPH_C32(0xcc381398), SPH_C32(0x74f5d6ff), + SPH_C32(0x1d48151c), SPH_C32(0x0014fef4), SPH_C32(0x41fe0000), + SPH_C32(0xd9270000), SPH_C32(0x94ed0000), SPH_C32(0xaee60133), + SPH_C32(0x8a42a8f2), SPH_C32(0xea903980), SPH_C32(0xdacf48d7), + SPH_C32(0xf81c0092) }, + { SPH_C32(0xf0c50000), SPH_C32(0x59230000), SPH_C32(0x45820000), + SPH_C32(0xe18d00c0), SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), + SPH_C32(0xcbe0fe1c), SPH_C32(0x56a7b19f), SPH_C32(0x16ed0000), + SPH_C32(0x15680000), SPH_C32(0xedd70000), SPH_C32(0x325d0220), + SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), SPH_C32(0xe375f8a8), + SPH_C32(0x81fdf908) }, + { SPH_C32(0xaf6d0000), SPH_C32(0x0f200000), SPH_C32(0x062c0000), + SPH_C32(0x857e00d3), SPH_C32(0x1e13808e), SPH_C32(0xd1fcc2d7), + SPH_C32(0x9ffe6ba3), SPH_C32(0xd8036af6), SPH_C32(0x16a90000), + SPH_C32(0x6a200000), SPH_C32(0x37ab0000), SPH_C32(0x187e0221), + SPH_C32(0xd8a1ff45), SPH_C32(0xf3fc7ac4), SPH_C32(0xe07f66c8), + SPH_C32(0x3ff79e96) }, + { SPH_C32(0xf0810000), SPH_C32(0x266b0000), SPH_C32(0x9ffe0000), + SPH_C32(0xcbae00c1), SPH_C32(0x00c0cffd), SPH_C32(0x6b5bca1e), + SPH_C32(0xc8ea607c), SPH_C32(0xe8add601), SPH_C32(0x49010000), + SPH_C32(0x3c230000), SPH_C32(0x74050000), SPH_C32(0x7c8d0232), + SPH_C32(0xfddf79fa), SPH_C32(0xe0edee8a), SPH_C32(0xb461f377), + SPH_C32(0xb15345ff) }, + { SPH_C32(0xaf290000), SPH_C32(0x70680000), SPH_C32(0xdc500000), + SPH_C32(0xaf5d00d2), SPH_C32(0x25be4942), SPH_C32(0x784a5e50), + SPH_C32(0x9cf4f5c3), SPH_C32(0x66090d68), SPH_C32(0x49450000), + SPH_C32(0x436b0000), SPH_C32(0xae790000), SPH_C32(0x56ae0233), + SPH_C32(0xc672b036), SPH_C32(0x495b720d), SPH_C32(0xb76b6d17), + SPH_C32(0x0f592261) }, + { SPH_C32(0x1e560000), SPH_C32(0x8f240000), SPH_C32(0xd7430000), + SPH_C32(0xca150120), SPH_C32(0xaf3c2e4d), SPH_C32(0xf981adce), + SPH_C32(0x8ed1dd68), SPH_C32(0x76b8dbfb), SPH_C32(0x6dc50000), + SPH_C32(0x422a0000), SPH_C32(0x44320000), SPH_C32(0x511e0280), + SPH_C32(0x7dd772a6), SPH_C32(0x37d373f8), SPH_C32(0xc48dc3ab), + SPH_C32(0x460299f8) }, + { SPH_C32(0x41fe0000), SPH_C32(0xd9270000), SPH_C32(0x94ed0000), + SPH_C32(0xaee60133), SPH_C32(0x8a42a8f2), SPH_C32(0xea903980), + SPH_C32(0xdacf48d7), SPH_C32(0xf81c0092), SPH_C32(0x6d810000), + SPH_C32(0x3d620000), SPH_C32(0x9e4e0000), SPH_C32(0x7b3d0281), + SPH_C32(0x467abb6a), SPH_C32(0x9e65ef7f), SPH_C32(0xc7875dcb), + SPH_C32(0xf808fe66) }, + { SPH_C32(0x1e120000), SPH_C32(0xf06c0000), SPH_C32(0x0d3f0000), + SPH_C32(0xe0360121), SPH_C32(0x9491e781), SPH_C32(0x50373149), + SPH_C32(0x8ddb4308), SPH_C32(0xc8b2bc65), SPH_C32(0x32290000), + SPH_C32(0x6b610000), SPH_C32(0xdde00000), SPH_C32(0x1fce0292), + SPH_C32(0x63043dd5), SPH_C32(0x8d747b31), SPH_C32(0x9399c874), + SPH_C32(0x76ac250f) }, + { SPH_C32(0x41ba0000), SPH_C32(0xa66f0000), SPH_C32(0x4e910000), + SPH_C32(0x84c50132), SPH_C32(0xb1ef613e), SPH_C32(0x4326a507), + SPH_C32(0xd9c5d6b7), SPH_C32(0x4616670c), SPH_C32(0x326d0000), + SPH_C32(0x14290000), SPH_C32(0x079c0000), SPH_C32(0x35ed0293), + SPH_C32(0x58a9f419), SPH_C32(0x24c2e7b6), SPH_C32(0x90935614), + SPH_C32(0xc8a64291) }, + { SPH_C32(0x8bed0000), SPH_C32(0x0e610000), SPH_C32(0xec670000), + SPH_C32(0x82ce0060), SPH_C32(0xa5b6421e), SPH_C32(0xaf74c322), + SPH_C32(0xec18c51f), SPH_C32(0x9158d16f), SPH_C32(0x83560000), + SPH_C32(0x942d0000), SPH_C32(0xd6f30000), SPH_C32(0x7a860360), + SPH_C32(0xe9865ada), SPH_C32(0x0cbf88af), SPH_C32(0x81bce0df), + SPH_C32(0x661df39c) }, + { SPH_C32(0xd4450000), SPH_C32(0x58620000), SPH_C32(0xafc90000), + SPH_C32(0xe63d0073), SPH_C32(0x80c8c4a1), SPH_C32(0xbc65576c), + SPH_C32(0xb80650a0), SPH_C32(0x1ffc0a06), SPH_C32(0x83120000), + SPH_C32(0xeb650000), SPH_C32(0x0c8f0000), SPH_C32(0x50a50361), + SPH_C32(0xd22b9316), SPH_C32(0xa5091428), SPH_C32(0x82b67ebf), + SPH_C32(0xd8179402) }, + { SPH_C32(0x8ba90000), SPH_C32(0x71290000), SPH_C32(0x361b0000), + SPH_C32(0xa8ed0061), SPH_C32(0x9e1b8bd2), SPH_C32(0x06c25fa5), + SPH_C32(0xef125b7f), SPH_C32(0x2f52b6f1), SPH_C32(0xdcba0000), + SPH_C32(0xbd660000), SPH_C32(0x4f210000), SPH_C32(0x34560372), + SPH_C32(0xf75515a9), SPH_C32(0xb6188066), SPH_C32(0xd6a8eb00), + SPH_C32(0x56b34f6b) }, + { SPH_C32(0xd4010000), SPH_C32(0x272a0000), SPH_C32(0x75b50000), + SPH_C32(0xcc1e0072), SPH_C32(0xbb650d6d), SPH_C32(0x15d3cbeb), + SPH_C32(0xbb0ccec0), SPH_C32(0xa1f66d98), SPH_C32(0xdcfe0000), + SPH_C32(0xc22e0000), SPH_C32(0x955d0000), SPH_C32(0x1e750373), + SPH_C32(0xccf8dc65), SPH_C32(0x1fae1ce1), SPH_C32(0xd5a27560), + SPH_C32(0xe8b928f5) }, + { SPH_C32(0x657e0000), SPH_C32(0xd8660000), SPH_C32(0x7ea60000), + SPH_C32(0xa9560180), SPH_C32(0x31e76a62), SPH_C32(0x94183875), + SPH_C32(0xa929e66b), SPH_C32(0xb147bb0b), SPH_C32(0xf87e0000), + SPH_C32(0xc36f0000), SPH_C32(0x7f160000), SPH_C32(0x19c503c0), + SPH_C32(0x775d1ef5), SPH_C32(0x61261d14), SPH_C32(0xa644dbdc), + SPH_C32(0xa1e2936c) }, + { SPH_C32(0x3ad60000), SPH_C32(0x8e650000), SPH_C32(0x3d080000), + SPH_C32(0xcda50193), SPH_C32(0x1499ecdd), SPH_C32(0x8709ac3b), + SPH_C32(0xfd3773d4), SPH_C32(0x3fe36062), SPH_C32(0xf83a0000), + SPH_C32(0xbc270000), SPH_C32(0xa56a0000), SPH_C32(0x33e603c1), + SPH_C32(0x4cf0d739), SPH_C32(0xc8908193), SPH_C32(0xa54e45bc), + SPH_C32(0x1fe8f4f2) }, + { SPH_C32(0x653a0000), SPH_C32(0xa72e0000), SPH_C32(0xa4da0000), + SPH_C32(0x83750181), SPH_C32(0x0a4aa3ae), SPH_C32(0x3daea4f2), + SPH_C32(0xaa23780b), SPH_C32(0x0f4ddc95), SPH_C32(0xa7920000), + SPH_C32(0xea240000), SPH_C32(0xe6c40000), SPH_C32(0x571503d2), + SPH_C32(0x698e5186), SPH_C32(0xdb8115dd), SPH_C32(0xf150d003), + SPH_C32(0x914c2f9b) }, + { SPH_C32(0x3a920000), SPH_C32(0xf12d0000), SPH_C32(0xe7740000), + SPH_C32(0xe7860192), SPH_C32(0x2f342511), SPH_C32(0x2ebf30bc), + SPH_C32(0xfe3dedb4), SPH_C32(0x81e907fc), SPH_C32(0xa7d60000), + SPH_C32(0x956c0000), SPH_C32(0x3cb80000), SPH_C32(0x7d3603d3), + SPH_C32(0x5223984a), SPH_C32(0x7237895a), SPH_C32(0xf25a4e63), + SPH_C32(0x2f464805) }, + { SPH_C32(0x16ed0000), SPH_C32(0x15680000), SPH_C32(0xedd70000), + SPH_C32(0x325d0220), SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), + SPH_C32(0xe375f8a8), SPH_C32(0x81fdf908), SPH_C32(0xe6280000), + SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), SPH_C32(0xd3d002e0), + SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), SPH_C32(0x289506b4), + SPH_C32(0xd75a4897) }, + { SPH_C32(0x49450000), SPH_C32(0x436b0000), SPH_C32(0xae790000), + SPH_C32(0x56ae0233), SPH_C32(0xc672b036), SPH_C32(0x495b720d), + SPH_C32(0xb76b6d17), SPH_C32(0x0f592261), SPH_C32(0xe66c0000), + SPH_C32(0x33030000), SPH_C32(0x72290000), SPH_C32(0xf9f302e1), + SPH_C32(0xe3ccf974), SPH_C32(0x31112c5d), SPH_C32(0x2b9f98d4), + SPH_C32(0x69502f09) }, + { SPH_C32(0x16a90000), SPH_C32(0x6a200000), SPH_C32(0x37ab0000), + SPH_C32(0x187e0221), SPH_C32(0xd8a1ff45), SPH_C32(0xf3fc7ac4), + SPH_C32(0xe07f66c8), SPH_C32(0x3ff79e96), SPH_C32(0xb9c40000), + SPH_C32(0x65000000), SPH_C32(0x31870000), SPH_C32(0x9d0002f2), + SPH_C32(0xc6b27fcb), SPH_C32(0x2200b813), SPH_C32(0x7f810d6b), + SPH_C32(0xe7f4f460) }, + { SPH_C32(0x49010000), SPH_C32(0x3c230000), SPH_C32(0x74050000), + SPH_C32(0x7c8d0232), SPH_C32(0xfddf79fa), SPH_C32(0xe0edee8a), + SPH_C32(0xb461f377), SPH_C32(0xb15345ff), SPH_C32(0xb9800000), + SPH_C32(0x1a480000), SPH_C32(0xebfb0000), SPH_C32(0xb72302f3), + SPH_C32(0xfd1fb607), SPH_C32(0x8bb62494), SPH_C32(0x7c8b930b), + SPH_C32(0x59fe93fe) }, + { SPH_C32(0xf87e0000), SPH_C32(0xc36f0000), SPH_C32(0x7f160000), + SPH_C32(0x19c503c0), SPH_C32(0x775d1ef5), SPH_C32(0x61261d14), + SPH_C32(0xa644dbdc), SPH_C32(0xa1e2936c), SPH_C32(0x9d000000), + SPH_C32(0x1b090000), SPH_C32(0x01b00000), SPH_C32(0xb0930240), + SPH_C32(0x46ba7497), SPH_C32(0xf53e2561), SPH_C32(0x0f6d3db7), + SPH_C32(0x10a52867) }, + { SPH_C32(0xa7d60000), SPH_C32(0x956c0000), SPH_C32(0x3cb80000), + SPH_C32(0x7d3603d3), SPH_C32(0x5223984a), SPH_C32(0x7237895a), + SPH_C32(0xf25a4e63), SPH_C32(0x2f464805), SPH_C32(0x9d440000), + SPH_C32(0x64410000), SPH_C32(0xdbcc0000), SPH_C32(0x9ab00241), + SPH_C32(0x7d17bd5b), SPH_C32(0x5c88b9e6), SPH_C32(0x0c67a3d7), + SPH_C32(0xaeaf4ff9) }, + { SPH_C32(0xf83a0000), SPH_C32(0xbc270000), SPH_C32(0xa56a0000), + SPH_C32(0x33e603c1), SPH_C32(0x4cf0d739), SPH_C32(0xc8908193), + SPH_C32(0xa54e45bc), SPH_C32(0x1fe8f4f2), SPH_C32(0xc2ec0000), + SPH_C32(0x32420000), SPH_C32(0x98620000), SPH_C32(0xfe430252), + SPH_C32(0x58693be4), SPH_C32(0x4f992da8), SPH_C32(0x58793668), + SPH_C32(0x200b9490) }, + { SPH_C32(0xa7920000), SPH_C32(0xea240000), SPH_C32(0xe6c40000), + SPH_C32(0x571503d2), SPH_C32(0x698e5186), SPH_C32(0xdb8115dd), + SPH_C32(0xf150d003), SPH_C32(0x914c2f9b), SPH_C32(0xc2a80000), + SPH_C32(0x4d0a0000), SPH_C32(0x421e0000), SPH_C32(0xd4600253), + SPH_C32(0x63c4f228), SPH_C32(0xe62fb12f), SPH_C32(0x5b73a808), + SPH_C32(0x9e01f30e) }, + { SPH_C32(0x6dc50000), SPH_C32(0x422a0000), SPH_C32(0x44320000), + SPH_C32(0x511e0280), SPH_C32(0x7dd772a6), SPH_C32(0x37d373f8), + SPH_C32(0xc48dc3ab), SPH_C32(0x460299f8), SPH_C32(0x73930000), + SPH_C32(0xcd0e0000), SPH_C32(0x93710000), SPH_C32(0x9b0b03a0), + SPH_C32(0xd2eb5ceb), SPH_C32(0xce52de36), SPH_C32(0x4a5c1ec3), + SPH_C32(0x30ba4203) }, + { SPH_C32(0x326d0000), SPH_C32(0x14290000), SPH_C32(0x079c0000), + SPH_C32(0x35ed0293), SPH_C32(0x58a9f419), SPH_C32(0x24c2e7b6), + SPH_C32(0x90935614), SPH_C32(0xc8a64291), SPH_C32(0x73d70000), + SPH_C32(0xb2460000), SPH_C32(0x490d0000), SPH_C32(0xb12803a1), + SPH_C32(0xe9469527), SPH_C32(0x67e442b1), SPH_C32(0x495680a3), + SPH_C32(0x8eb0259d) }, + { SPH_C32(0x6d810000), SPH_C32(0x3d620000), SPH_C32(0x9e4e0000), + SPH_C32(0x7b3d0281), SPH_C32(0x467abb6a), SPH_C32(0x9e65ef7f), + SPH_C32(0xc7875dcb), SPH_C32(0xf808fe66), SPH_C32(0x2c7f0000), + SPH_C32(0xe4450000), SPH_C32(0x0aa30000), SPH_C32(0xd5db03b2), + SPH_C32(0xcc381398), SPH_C32(0x74f5d6ff), SPH_C32(0x1d48151c), + SPH_C32(0x0014fef4) }, + { SPH_C32(0x32290000), SPH_C32(0x6b610000), SPH_C32(0xdde00000), + SPH_C32(0x1fce0292), SPH_C32(0x63043dd5), SPH_C32(0x8d747b31), + SPH_C32(0x9399c874), SPH_C32(0x76ac250f), SPH_C32(0x2c3b0000), + SPH_C32(0x9b0d0000), SPH_C32(0xd0df0000), SPH_C32(0xfff803b3), + SPH_C32(0xf795da54), SPH_C32(0xdd434a78), SPH_C32(0x1e428b7c), + SPH_C32(0xbe1e996a) }, + { SPH_C32(0x83560000), SPH_C32(0x942d0000), SPH_C32(0xd6f30000), + SPH_C32(0x7a860360), SPH_C32(0xe9865ada), SPH_C32(0x0cbf88af), + SPH_C32(0x81bce0df), SPH_C32(0x661df39c), SPH_C32(0x08bb0000), + SPH_C32(0x9a4c0000), SPH_C32(0x3a940000), SPH_C32(0xf8480300), + SPH_C32(0x4c3018c4), SPH_C32(0xa3cb4b8d), SPH_C32(0x6da425c0), + SPH_C32(0xf74522f3) }, + { SPH_C32(0xdcfe0000), SPH_C32(0xc22e0000), SPH_C32(0x955d0000), + SPH_C32(0x1e750373), SPH_C32(0xccf8dc65), SPH_C32(0x1fae1ce1), + SPH_C32(0xd5a27560), SPH_C32(0xe8b928f5), SPH_C32(0x08ff0000), + SPH_C32(0xe5040000), SPH_C32(0xe0e80000), SPH_C32(0xd26b0301), + SPH_C32(0x779dd108), SPH_C32(0x0a7dd70a), SPH_C32(0x6eaebba0), + SPH_C32(0x494f456d) }, + { SPH_C32(0x83120000), SPH_C32(0xeb650000), SPH_C32(0x0c8f0000), + SPH_C32(0x50a50361), SPH_C32(0xd22b9316), SPH_C32(0xa5091428), + SPH_C32(0x82b67ebf), SPH_C32(0xd8179402), SPH_C32(0x57570000), + SPH_C32(0xb3070000), SPH_C32(0xa3460000), SPH_C32(0xb6980312), + SPH_C32(0x52e357b7), SPH_C32(0x196c4344), SPH_C32(0x3ab02e1f), + SPH_C32(0xc7eb9e04) }, + { SPH_C32(0xdcba0000), SPH_C32(0xbd660000), SPH_C32(0x4f210000), + SPH_C32(0x34560372), SPH_C32(0xf75515a9), SPH_C32(0xb6188066), + SPH_C32(0xd6a8eb00), SPH_C32(0x56b34f6b), SPH_C32(0x57130000), + SPH_C32(0xcc4f0000), SPH_C32(0x793a0000), SPH_C32(0x9cbb0313), + SPH_C32(0x694e9e7b), SPH_C32(0xb0dadfc3), SPH_C32(0x39bab07f), + SPH_C32(0x79e1f99a) } +}; + +static const sph_u32 T512_60[16][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x033d0000), SPH_C32(0x08b30000), SPH_C32(0xf33a0000), + SPH_C32(0x3ac20007), SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), + SPH_C32(0x0ea5cfe3), SPH_C32(0xe6da7ffe), SPH_C32(0xa8da0000), + SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), SPH_C32(0x07da0002), + SPH_C32(0x7d669583), SPH_C32(0x1f98708a), SPH_C32(0xbb668808), + SPH_C32(0xda878000) }, + { SPH_C32(0xa8da0000), SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), + SPH_C32(0x07da0002), SPH_C32(0x7d669583), SPH_C32(0x1f98708a), + SPH_C32(0xbb668808), SPH_C32(0xda878000), SPH_C32(0xabe70000), + SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), SPH_C32(0x3d180005), + SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), SPH_C32(0xb5c347eb), + SPH_C32(0x3c5dfffe) }, + { SPH_C32(0xabe70000), SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), + SPH_C32(0x3d180005), SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), + SPH_C32(0xb5c347eb), SPH_C32(0x3c5dfffe), SPH_C32(0x033d0000), + SPH_C32(0x08b30000), SPH_C32(0xf33a0000), SPH_C32(0x3ac20007), + SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), SPH_C32(0x0ea5cfe3), + SPH_C32(0xe6da7ffe) }, + { SPH_C32(0x01930000), SPH_C32(0xe7820000), SPH_C32(0xedfb0000), + SPH_C32(0xcf0c000b), SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), + SPH_C32(0x063661e1), SPH_C32(0x536f9e7b), SPH_C32(0x92280000), + SPH_C32(0xdc850000), SPH_C32(0x57fa0000), SPH_C32(0x56dc0003), + SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), SPH_C32(0x90cef752), + SPH_C32(0x7b1675d7) }, + { SPH_C32(0x02ae0000), SPH_C32(0xef310000), SPH_C32(0x1ec10000), + SPH_C32(0xf5ce000c), SPH_C32(0xdcf90708), SPH_C32(0xd7cdd231), + SPH_C32(0x0893ae02), SPH_C32(0xb5b5e185), SPH_C32(0x3af20000), + SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), SPH_C32(0x51060001), + SPH_C32(0xc78fb695), SPH_C32(0x4577d386), SPH_C32(0x2ba87f5a), + SPH_C32(0xa191f5d7) }, + { SPH_C32(0xa9490000), SPH_C32(0x713c0000), SPH_C32(0xb1e60000), + SPH_C32(0xc8d60009), SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), + SPH_C32(0xbd50e9e9), SPH_C32(0x89e81e7b), SPH_C32(0x39cf0000), + SPH_C32(0x42880000), SPH_C32(0xf8dd0000), SPH_C32(0x6bc40006), + SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), SPH_C32(0x250db0b9), + SPH_C32(0x474b8a29) }, + { SPH_C32(0xaa740000), SPH_C32(0x798f0000), SPH_C32(0x42dc0000), + SPH_C32(0xf214000e), SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), + SPH_C32(0xb3f5260a), SPH_C32(0x6f326185), SPH_C32(0x91150000), + SPH_C32(0xd4360000), SPH_C32(0xa4c00000), SPH_C32(0x6c1e0004), + SPH_C32(0xebc0a946), SPH_C32(0x3181c513), SPH_C32(0x9e6b38b1), + SPH_C32(0x9dcc0a29) }, + { SPH_C32(0x92280000), SPH_C32(0xdc850000), SPH_C32(0x57fa0000), + SPH_C32(0x56dc0003), SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), + SPH_C32(0x90cef752), SPH_C32(0x7b1675d7), SPH_C32(0x93bb0000), + SPH_C32(0x3b070000), SPH_C32(0xba010000), SPH_C32(0x99d00008), + SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), SPH_C32(0x96f896b3), + SPH_C32(0x2879ebac) }, + { SPH_C32(0x91150000), SPH_C32(0xd4360000), SPH_C32(0xa4c00000), + SPH_C32(0x6c1e0004), SPH_C32(0xebc0a946), SPH_C32(0x3181c513), + SPH_C32(0x9e6b38b1), SPH_C32(0x9dcc0a29), SPH_C32(0x3b610000), + SPH_C32(0xadb90000), SPH_C32(0xe61c0000), SPH_C32(0x9e0a000a), + SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), SPH_C32(0x2d9e1ebb), + SPH_C32(0xf2fe6bac) }, + { SPH_C32(0x3af20000), SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), + SPH_C32(0x51060001), SPH_C32(0xc78fb695), SPH_C32(0x4577d386), + SPH_C32(0x2ba87f5a), SPH_C32(0xa191f5d7), SPH_C32(0x385c0000), + SPH_C32(0xa50a0000), SPH_C32(0x15260000), SPH_C32(0xa4c8000d), + SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), SPH_C32(0x233bd158), + SPH_C32(0x14241452) }, + { SPH_C32(0x39cf0000), SPH_C32(0x42880000), SPH_C32(0xf8dd0000), + SPH_C32(0x6bc40006), SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), + SPH_C32(0x250db0b9), SPH_C32(0x474b8a29), SPH_C32(0x90860000), + SPH_C32(0x33b40000), SPH_C32(0x493b0000), SPH_C32(0xa312000f), + SPH_C32(0x6610241e), SPH_C32(0x8d22713d), SPH_C32(0x985d5950), + SPH_C32(0xcea39452) }, + { SPH_C32(0x93bb0000), SPH_C32(0x3b070000), SPH_C32(0xba010000), + SPH_C32(0x99d00008), SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), + SPH_C32(0x96f896b3), SPH_C32(0x2879ebac), SPH_C32(0x01930000), + SPH_C32(0xe7820000), SPH_C32(0xedfb0000), SPH_C32(0xcf0c000b), + SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), SPH_C32(0x063661e1), + SPH_C32(0x536f9e7b) }, + { SPH_C32(0x90860000), SPH_C32(0x33b40000), SPH_C32(0x493b0000), + SPH_C32(0xa312000f), SPH_C32(0x6610241e), SPH_C32(0x8d22713d), + SPH_C32(0x985d5950), SPH_C32(0xcea39452), SPH_C32(0xa9490000), + SPH_C32(0x713c0000), SPH_C32(0xb1e60000), SPH_C32(0xc8d60009), + SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), SPH_C32(0xbd50e9e9), + SPH_C32(0x89e81e7b) }, + { SPH_C32(0x3b610000), SPH_C32(0xadb90000), SPH_C32(0xe61c0000), + SPH_C32(0x9e0a000a), SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), + SPH_C32(0x2d9e1ebb), SPH_C32(0xf2fe6bac), SPH_C32(0xaa740000), + SPH_C32(0x798f0000), SPH_C32(0x42dc0000), SPH_C32(0xf214000e), + SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), SPH_C32(0xb3f5260a), + SPH_C32(0x6f326185) }, + { SPH_C32(0x385c0000), SPH_C32(0xa50a0000), SPH_C32(0x15260000), + SPH_C32(0xa4c8000d), SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), + SPH_C32(0x233bd158), SPH_C32(0x14241452), SPH_C32(0x02ae0000), + SPH_C32(0xef310000), SPH_C32(0x1ec10000), SPH_C32(0xf5ce000c), + SPH_C32(0xdcf90708), SPH_C32(0xd7cdd231), SPH_C32(0x0893ae02), + SPH_C32(0xb5b5e185) } +}; + +#define INPUT_BIG do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T512_0[acc >> 2][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + m8 = rp[8]; \ + m9 = rp[9]; \ + mA = rp[10]; \ + mB = rp[11]; \ + mC = rp[12]; \ + mD = rp[13]; \ + mE = rp[14]; \ + mF = rp[15]; \ + acc = (acc << 8) | buf[1]; \ + rp = &T512_6[(acc >> 4) & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[2]; \ + rp = &T512_12[(acc >> 6) & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_18[acc & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[3]; \ + rp = &T512_24[acc >> 2][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[4]; \ + rp = &T512_30[(acc >> 4) & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[5]; \ + rp = &T512_36[(acc >> 6) & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_42[acc & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[6]; \ + rp = &T512_48[acc >> 2][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[7]; \ + rp = &T512_54[(acc >> 4) & 0x3f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_60[acc & 0x0f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_BIG == 7 + +static const sph_u32 T512_0[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xc96b0030), SPH_C32(0xe7250000), SPH_C32(0x2f840000), + SPH_C32(0x264f0000), SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), + SPH_C32(0x509f6984), SPH_C32(0x9e69af68), SPH_C32(0x26600240), + SPH_C32(0xddd80000), SPH_C32(0x722a0000), SPH_C32(0x4f060000), + SPH_C32(0x936667ff), SPH_C32(0x29f944ce), SPH_C32(0x368b63d5), + SPH_C32(0x0c26f262) }, + { SPH_C32(0x145a3c00), SPH_C32(0xb9e90000), SPH_C32(0x61270000), + SPH_C32(0xf1610000), SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), + SPH_C32(0x47a96720), SPH_C32(0xe18e24c5), SPH_C32(0x23671400), + SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), SPH_C32(0xfb750000), + SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), SPH_C32(0x02c40a3f), + SPH_C32(0xdc24e61f) }, + { SPH_C32(0xdd313c30), SPH_C32(0x5ecc0000), SPH_C32(0x4ea30000), + SPH_C32(0xd72e0000), SPH_C32(0xc6086695), SPH_C32(0xddb5cc4f), + SPH_C32(0x17360ea4), SPH_C32(0x7fe78bad), SPH_C32(0x05071640), + SPH_C32(0x15610000), SPH_C32(0x86ed0000), SPH_C32(0xb4730000), + SPH_C32(0xe0ab439a), SPH_C32(0xd15fe187), SPH_C32(0x344f69ea), + SPH_C32(0xd002147d) }, + { SPH_C32(0x23671400), SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), + SPH_C32(0xfb750000), SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), + SPH_C32(0x02c40a3f), SPH_C32(0xdc24e61f), SPH_C32(0x373d2800), + SPH_C32(0x71500000), SPH_C32(0x95e00000), SPH_C32(0x0a140000), + SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), SPH_C32(0x456d6d1f), + SPH_C32(0x3daac2da) }, + { SPH_C32(0xea0c1430), SPH_C32(0x2f9c0000), SPH_C32(0xdb430000), + SPH_C32(0xdd3a0000), SPH_C32(0x7ba47f9c), SPH_C32(0x955a547e), + SPH_C32(0x525b63bb), SPH_C32(0x424d4977), SPH_C32(0x115d2a40), + SPH_C32(0xac880000), SPH_C32(0xe7ca0000), SPH_C32(0x45120000), + SPH_C32(0x2eca7ef6), SPH_C32(0x6116dcff), SPH_C32(0x73e60eca), + SPH_C32(0x318c30b8) }, + { SPH_C32(0x373d2800), SPH_C32(0x71500000), SPH_C32(0x95e00000), + SPH_C32(0x0a140000), SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), + SPH_C32(0x456d6d1f), SPH_C32(0x3daac2da), SPH_C32(0x145a3c00), + SPH_C32(0xb9e90000), SPH_C32(0x61270000), SPH_C32(0xf1610000), + SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), SPH_C32(0x47a96720), + SPH_C32(0xe18e24c5) }, + { SPH_C32(0xfe562830), SPH_C32(0x96750000), SPH_C32(0xba640000), + SPH_C32(0x2c5b0000), SPH_C32(0xb5c542f0), SPH_C32(0x25136906), + SPH_C32(0x15f2049b), SPH_C32(0xa3c36db2), SPH_C32(0x323a3e40), + SPH_C32(0x64310000), SPH_C32(0x130d0000), SPH_C32(0xbe670000), + SPH_C32(0x5d075a93), SPH_C32(0x99b079b6), SPH_C32(0x712204f5), + SPH_C32(0xeda8d6a7) }, + { SPH_C32(0x54285c00), SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), + SPH_C32(0xa1c50000), SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), + SPH_C32(0x6bb0419d), SPH_C32(0x551b3782), SPH_C32(0x9cbb1800), + SPH_C32(0xb0d30000), SPH_C32(0x92510000), SPH_C32(0xed930000), + SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), SPH_C32(0x430633da), + SPH_C32(0x78cace29) }, + { SPH_C32(0x9d435c30), SPH_C32(0x0dc80000), SPH_C32(0xea520000), + SPH_C32(0x878a0000), SPH_C32(0xbbcb3c89), SPH_C32(0xf95935d6), + SPH_C32(0x3b2f2819), SPH_C32(0xcb7298ea), SPH_C32(0xbadb1a40), + SPH_C32(0x6d0b0000), SPH_C32(0xe07b0000), SPH_C32(0xa2950000), + SPH_C32(0xca5c24ba), SPH_C32(0xc8ed913a), SPH_C32(0x758d500f), + SPH_C32(0x74ec3c4b) }, + { SPH_C32(0x40726000), SPH_C32(0x53040000), SPH_C32(0xa4f10000), + SPH_C32(0x50a40000), SPH_C32(0x7dc35a1c), SPH_C32(0x24ecf999), + SPH_C32(0x2c1926bd), SPH_C32(0xb4951347), SPH_C32(0xbfdc0c00), + SPH_C32(0x786a0000), SPH_C32(0x66960000), SPH_C32(0x16e60000), + SPH_C32(0x2af76720), SPH_C32(0x19b270bd), SPH_C32(0x41c239e5), + SPH_C32(0xa4ee2836) }, + { SPH_C32(0x89196030), SPH_C32(0xb4210000), SPH_C32(0x8b750000), + SPH_C32(0x76eb0000), SPH_C32(0x75aa01e5), SPH_C32(0x491008ae), + SPH_C32(0x7c864f39), SPH_C32(0x2afcbc2f), SPH_C32(0x99bc0e40), + SPH_C32(0xa5b20000), SPH_C32(0x14bc0000), SPH_C32(0x59e00000), + SPH_C32(0xb99100df), SPH_C32(0x304b3473), SPH_C32(0x77495a30), + SPH_C32(0xa8c8da54) }, + { SPH_C32(0x774f4800), SPH_C32(0x22540000), SPH_C32(0x31110000), + SPH_C32(0x5ab00000), SPH_C32(0xc06f4315), SPH_C32(0x6c0361a8), + SPH_C32(0x69744ba2), SPH_C32(0x893fd19d), SPH_C32(0xab863000), + SPH_C32(0xc1830000), SPH_C32(0x07b10000), SPH_C32(0xe7870000), + SPH_C32(0xe4965a4c), SPH_C32(0xa9fb4dc5), SPH_C32(0x066b5ec5), + SPH_C32(0x45600cf3) }, + { SPH_C32(0xbe244830), SPH_C32(0xc5710000), SPH_C32(0x1e950000), + SPH_C32(0x7cff0000), SPH_C32(0xc80618ec), SPH_C32(0x01ff909f), + SPH_C32(0x39eb2226), SPH_C32(0x17567ef5), SPH_C32(0x8de63240), + SPH_C32(0x1c5b0000), SPH_C32(0x759b0000), SPH_C32(0xa8810000), + SPH_C32(0x77f03db3), SPH_C32(0x8002090b), SPH_C32(0x30e03d10), + SPH_C32(0x4946fe91) }, + { SPH_C32(0x63157400), SPH_C32(0x9bbd0000), SPH_C32(0x50360000), + SPH_C32(0xabd10000), SPH_C32(0x0e0e7e79), SPH_C32(0xdc4a5cd0), + SPH_C32(0x2edd2c82), SPH_C32(0x68b1f558), SPH_C32(0x88e12400), + SPH_C32(0x093a0000), SPH_C32(0xf3760000), SPH_C32(0x1cf20000), + SPH_C32(0x975b7e29), SPH_C32(0x515de88c), SPH_C32(0x04af54fa), + SPH_C32(0x9944eaec) }, + { SPH_C32(0xaa7e7430), SPH_C32(0x7c980000), SPH_C32(0x7fb20000), + SPH_C32(0x8d9e0000), SPH_C32(0x06672580), SPH_C32(0xb1b6ade7), + SPH_C32(0x7e424506), SPH_C32(0xf6d85a30), SPH_C32(0xae812640), + SPH_C32(0xd4e20000), SPH_C32(0x815c0000), SPH_C32(0x53f40000), + SPH_C32(0x043d19d6), SPH_C32(0x78a4ac42), SPH_C32(0x3224372f), + SPH_C32(0x9562188e) }, + { SPH_C32(0x9cbb1800), SPH_C32(0xb0d30000), SPH_C32(0x92510000), + SPH_C32(0xed930000), SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), + SPH_C32(0x430633da), SPH_C32(0x78cace29), SPH_C32(0xc8934400), + SPH_C32(0x5a3e0000), SPH_C32(0x57870000), SPH_C32(0x4c560000), + SPH_C32(0xea982435), SPH_C32(0x75b11115), SPH_C32(0x28b67247), + SPH_C32(0x2dd1f9ab) }, + { SPH_C32(0x55d01830), SPH_C32(0x57f60000), SPH_C32(0xbdd50000), + SPH_C32(0xcbdc0000), SPH_C32(0x515318bc), SPH_C32(0x8ce824c3), + SPH_C32(0x13995a5e), SPH_C32(0xe6a36141), SPH_C32(0xeef34640), + SPH_C32(0x87e60000), SPH_C32(0x25ad0000), SPH_C32(0x03500000), + SPH_C32(0x79fe43ca), SPH_C32(0x5c4855db), SPH_C32(0x1e3d1192), + SPH_C32(0x21f70bc9) }, + { SPH_C32(0x88e12400), SPH_C32(0x093a0000), SPH_C32(0xf3760000), + SPH_C32(0x1cf20000), SPH_C32(0x975b7e29), SPH_C32(0x515de88c), + SPH_C32(0x04af54fa), SPH_C32(0x9944eaec), SPH_C32(0xebf45000), + SPH_C32(0x92870000), SPH_C32(0xa3400000), SPH_C32(0xb7230000), + SPH_C32(0x99550050), SPH_C32(0x8d17b45c), SPH_C32(0x2a727878), + SPH_C32(0xf1f51fb4) }, + { SPH_C32(0x418a2430), SPH_C32(0xee1f0000), SPH_C32(0xdcf20000), + SPH_C32(0x3abd0000), SPH_C32(0x9f3225d0), SPH_C32(0x3ca119bb), + SPH_C32(0x54303d7e), SPH_C32(0x072d4584), SPH_C32(0xcd945240), + SPH_C32(0x4f5f0000), SPH_C32(0xd16a0000), SPH_C32(0xf8250000), + SPH_C32(0x0a3367af), SPH_C32(0xa4eef092), SPH_C32(0x1cf91bad), + SPH_C32(0xfdd3edd6) }, + { SPH_C32(0xbfdc0c00), SPH_C32(0x786a0000), SPH_C32(0x66960000), + SPH_C32(0x16e60000), SPH_C32(0x2af76720), SPH_C32(0x19b270bd), + SPH_C32(0x41c239e5), SPH_C32(0xa4ee2836), SPH_C32(0xffae6c00), + SPH_C32(0x2b6e0000), SPH_C32(0xc2670000), SPH_C32(0x46420000), + SPH_C32(0x57343d3c), SPH_C32(0x3d5e8924), SPH_C32(0x6ddb1f58), + SPH_C32(0x107b3b71) }, + { SPH_C32(0x76b70c30), SPH_C32(0x9f4f0000), SPH_C32(0x49120000), + SPH_C32(0x30a90000), SPH_C32(0x229e3cd9), SPH_C32(0x744e818a), + SPH_C32(0x115d5061), SPH_C32(0x3a87875e), SPH_C32(0xd9ce6e40), + SPH_C32(0xf6b60000), SPH_C32(0xb04d0000), SPH_C32(0x09440000), + SPH_C32(0xc4525ac3), SPH_C32(0x14a7cdea), SPH_C32(0x5b507c8d), + SPH_C32(0x1c5dc913) }, + { SPH_C32(0xab863000), SPH_C32(0xc1830000), SPH_C32(0x07b10000), + SPH_C32(0xe7870000), SPH_C32(0xe4965a4c), SPH_C32(0xa9fb4dc5), + SPH_C32(0x066b5ec5), SPH_C32(0x45600cf3), SPH_C32(0xdcc97800), + SPH_C32(0xe3d70000), SPH_C32(0x36a00000), SPH_C32(0xbd370000), + SPH_C32(0x24f91959), SPH_C32(0xc5f82c6d), SPH_C32(0x6f1f1567), + SPH_C32(0xcc5fdd6e) }, + { SPH_C32(0x62ed3030), SPH_C32(0x26a60000), SPH_C32(0x28350000), + SPH_C32(0xc1c80000), SPH_C32(0xecff01b5), SPH_C32(0xc407bcf2), + SPH_C32(0x56f43741), SPH_C32(0xdb09a39b), SPH_C32(0xfaa97a40), + SPH_C32(0x3e0f0000), SPH_C32(0x448a0000), SPH_C32(0xf2310000), + SPH_C32(0xb79f7ea6), SPH_C32(0xec0168a3), SPH_C32(0x599476b2), + SPH_C32(0xc0792f0c) }, + { SPH_C32(0xc8934400), SPH_C32(0x5a3e0000), SPH_C32(0x57870000), + SPH_C32(0x4c560000), SPH_C32(0xea982435), SPH_C32(0x75b11115), + SPH_C32(0x28b67247), SPH_C32(0x2dd1f9ab), SPH_C32(0x54285c00), + SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), SPH_C32(0xa1c50000), + SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), SPH_C32(0x6bb0419d), + SPH_C32(0x551b3782) }, + { SPH_C32(0x01f84430), SPH_C32(0xbd1b0000), SPH_C32(0x78030000), + SPH_C32(0x6a190000), SPH_C32(0xe2f17fcc), SPH_C32(0x184de022), + SPH_C32(0x78291bc3), SPH_C32(0xb3b856c3), SPH_C32(0x72485e40), + SPH_C32(0x37350000), SPH_C32(0xb7fc0000), SPH_C32(0xeec30000), + SPH_C32(0x20c4008f), SPH_C32(0xbd5c802f), SPH_C32(0x5d3b2248), + SPH_C32(0x593dc5e0) }, + { SPH_C32(0xdcc97800), SPH_C32(0xe3d70000), SPH_C32(0x36a00000), + SPH_C32(0xbd370000), SPH_C32(0x24f91959), SPH_C32(0xc5f82c6d), + SPH_C32(0x6f1f1567), SPH_C32(0xcc5fdd6e), SPH_C32(0x774f4800), + SPH_C32(0x22540000), SPH_C32(0x31110000), SPH_C32(0x5ab00000), + SPH_C32(0xc06f4315), SPH_C32(0x6c0361a8), SPH_C32(0x69744ba2), + SPH_C32(0x893fd19d) }, + { SPH_C32(0x15a27830), SPH_C32(0x04f20000), SPH_C32(0x19240000), + SPH_C32(0x9b780000), SPH_C32(0x2c9042a0), SPH_C32(0xa804dd5a), + SPH_C32(0x3f807ce3), SPH_C32(0x52367206), SPH_C32(0x512f4a40), + SPH_C32(0xff8c0000), SPH_C32(0x433b0000), SPH_C32(0x15b60000), + SPH_C32(0x530924ea), SPH_C32(0x45fa2566), SPH_C32(0x5fff2877), + SPH_C32(0x851923ff) }, + { SPH_C32(0xebf45000), SPH_C32(0x92870000), SPH_C32(0xa3400000), + SPH_C32(0xb7230000), SPH_C32(0x99550050), SPH_C32(0x8d17b45c), + SPH_C32(0x2a727878), SPH_C32(0xf1f51fb4), SPH_C32(0x63157400), + SPH_C32(0x9bbd0000), SPH_C32(0x50360000), SPH_C32(0xabd10000), + SPH_C32(0x0e0e7e79), SPH_C32(0xdc4a5cd0), SPH_C32(0x2edd2c82), + SPH_C32(0x68b1f558) }, + { SPH_C32(0x229f5030), SPH_C32(0x75a20000), SPH_C32(0x8cc40000), + SPH_C32(0x916c0000), SPH_C32(0x913c5ba9), SPH_C32(0xe0eb456b), + SPH_C32(0x7aed11fc), SPH_C32(0x6f9cb0dc), SPH_C32(0x45757640), + SPH_C32(0x46650000), SPH_C32(0x221c0000), SPH_C32(0xe4d70000), + SPH_C32(0x9d681986), SPH_C32(0xf5b3181e), SPH_C32(0x18564f57), + SPH_C32(0x6497073a) }, + { SPH_C32(0xffae6c00), SPH_C32(0x2b6e0000), SPH_C32(0xc2670000), + SPH_C32(0x46420000), SPH_C32(0x57343d3c), SPH_C32(0x3d5e8924), + SPH_C32(0x6ddb1f58), SPH_C32(0x107b3b71), SPH_C32(0x40726000), + SPH_C32(0x53040000), SPH_C32(0xa4f10000), SPH_C32(0x50a40000), + SPH_C32(0x7dc35a1c), SPH_C32(0x24ecf999), SPH_C32(0x2c1926bd), + SPH_C32(0xb4951347) }, + { SPH_C32(0x36c56c30), SPH_C32(0xcc4b0000), SPH_C32(0xede30000), + SPH_C32(0x600d0000), SPH_C32(0x5f5d66c5), SPH_C32(0x50a27813), + SPH_C32(0x3d4476dc), SPH_C32(0x8e129419), SPH_C32(0x66126240), + SPH_C32(0x8edc0000), SPH_C32(0xd6db0000), SPH_C32(0x1fa20000), + SPH_C32(0xeea53de3), SPH_C32(0x0d15bd57), SPH_C32(0x1a924568), + SPH_C32(0xb8b3e125) }, + { SPH_C32(0x29449c00), SPH_C32(0x64e70000), SPH_C32(0xf24b0000), + SPH_C32(0xc2f30000), SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), + SPH_C32(0xf3e04259), SPH_C32(0x8d0d9ec4), SPH_C32(0x466d0c00), + SPH_C32(0x08620000), SPH_C32(0xdd5d0000), SPH_C32(0xbadd0000), + SPH_C32(0x6a927942), SPH_C32(0x441f2b93), SPH_C32(0x218ace6f), + SPH_C32(0xbf2c0be2) }, + { SPH_C32(0xe02f9c30), SPH_C32(0x83c20000), SPH_C32(0xddcf0000), + SPH_C32(0xe4bc0000), SPH_C32(0x06b71576), SPH_C32(0x3b3ec672), + SPH_C32(0xa37f2bdd), SPH_C32(0x136431ac), SPH_C32(0x600d0e40), + SPH_C32(0xd5ba0000), SPH_C32(0xaf770000), SPH_C32(0xf5db0000), + SPH_C32(0xf9f41ebd), SPH_C32(0x6de66f5d), SPH_C32(0x1701adba), + SPH_C32(0xb30af980) }, + { SPH_C32(0x3d1ea000), SPH_C32(0xdd0e0000), SPH_C32(0x936c0000), + SPH_C32(0x33920000), SPH_C32(0xc0bf73e3), SPH_C32(0xe68b0a3d), + SPH_C32(0xb4492579), SPH_C32(0x6c83ba01), SPH_C32(0x650a1800), + SPH_C32(0xc0db0000), SPH_C32(0x299a0000), SPH_C32(0x41a80000), + SPH_C32(0x195f5d27), SPH_C32(0xbcb98eda), SPH_C32(0x234ec450), + SPH_C32(0x6308edfd) }, + { SPH_C32(0xf475a030), SPH_C32(0x3a2b0000), SPH_C32(0xbce80000), + SPH_C32(0x15dd0000), SPH_C32(0xc8d6281a), SPH_C32(0x8b77fb0a), + SPH_C32(0xe4d64cfd), SPH_C32(0xf2ea1569), SPH_C32(0x436a1a40), + SPH_C32(0x1d030000), SPH_C32(0x5bb00000), SPH_C32(0x0eae0000), + SPH_C32(0x8a393ad8), SPH_C32(0x9540ca14), SPH_C32(0x15c5a785), + SPH_C32(0x6f2e1f9f) }, + { SPH_C32(0x0a238800), SPH_C32(0xac5e0000), SPH_C32(0x068c0000), + SPH_C32(0x39860000), SPH_C32(0x7d136aea), SPH_C32(0xae64920c), + SPH_C32(0xf1244866), SPH_C32(0x512978db), SPH_C32(0x71502400), + SPH_C32(0x79320000), SPH_C32(0x48bd0000), SPH_C32(0xb0c90000), + SPH_C32(0xd73e604b), SPH_C32(0x0cf0b3a2), SPH_C32(0x64e7a370), + SPH_C32(0x8286c938) }, + { SPH_C32(0xc3488830), SPH_C32(0x4b7b0000), SPH_C32(0x29080000), + SPH_C32(0x1fc90000), SPH_C32(0x757a3113), SPH_C32(0xc398633b), + SPH_C32(0xa1bb21e2), SPH_C32(0xcf40d7b3), SPH_C32(0x57302640), + SPH_C32(0xa4ea0000), SPH_C32(0x3a970000), SPH_C32(0xffcf0000), + SPH_C32(0x445807b4), SPH_C32(0x2509f76c), SPH_C32(0x526cc0a5), + SPH_C32(0x8ea03b5a) }, + { SPH_C32(0x1e79b400), SPH_C32(0x15b70000), SPH_C32(0x67ab0000), + SPH_C32(0xc8e70000), SPH_C32(0xb3725786), SPH_C32(0x1e2daf74), + SPH_C32(0xb68d2f46), SPH_C32(0xb0a75c1e), SPH_C32(0x52373000), + SPH_C32(0xb18b0000), SPH_C32(0xbc7a0000), SPH_C32(0x4bbc0000), + SPH_C32(0xa4f3442e), SPH_C32(0xf45616eb), SPH_C32(0x6623a94f), + SPH_C32(0x5ea22f27) }, + { SPH_C32(0xd712b430), SPH_C32(0xf2920000), SPH_C32(0x482f0000), + SPH_C32(0xeea80000), SPH_C32(0xbb1b0c7f), SPH_C32(0x73d15e43), + SPH_C32(0xe61246c2), SPH_C32(0x2ecef376), SPH_C32(0x74573240), + SPH_C32(0x6c530000), SPH_C32(0xce500000), SPH_C32(0x04ba0000), + SPH_C32(0x379523d1), SPH_C32(0xddaf5225), SPH_C32(0x50a8ca9a), + SPH_C32(0x5284dd45) }, + { SPH_C32(0x7d6cc000), SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), + SPH_C32(0x63360000), SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), + SPH_C32(0x985003c4), SPH_C32(0xd816a946), SPH_C32(0xdad61400), + SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), SPH_C32(0x574e0000), + SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), SPH_C32(0x628cfdb5), + SPH_C32(0xc7e6c5cb) }, + { SPH_C32(0xb407c030), SPH_C32(0x692f0000), SPH_C32(0x18190000), + SPH_C32(0x45790000), SPH_C32(0xb5157206), SPH_C32(0xaf9b0293), + SPH_C32(0xc8cf6a40), SPH_C32(0x467f062e), SPH_C32(0xfcb61640), + SPH_C32(0x65690000), SPH_C32(0x3d260000), SPH_C32(0x18480000), + SPH_C32(0xa0ce5df8), SPH_C32(0x8cf2baa9), SPH_C32(0x54079e60), + SPH_C32(0xcbc037a9) }, + { SPH_C32(0x6936fc00), SPH_C32(0x37e30000), SPH_C32(0x56ba0000), + SPH_C32(0x92570000), SPH_C32(0x731d1493), SPH_C32(0x722ecedc), + SPH_C32(0xdff964e4), SPH_C32(0x39988d83), SPH_C32(0xf9b10000), + SPH_C32(0x70080000), SPH_C32(0xbbcb0000), SPH_C32(0xac3b0000), + SPH_C32(0x40651e62), SPH_C32(0x5dad5b2e), SPH_C32(0x6048f78a), + SPH_C32(0x1bc223d4) }, + { SPH_C32(0xa05dfc30), SPH_C32(0xd0c60000), SPH_C32(0x793e0000), + SPH_C32(0xb4180000), SPH_C32(0x7b744f6a), SPH_C32(0x1fd23feb), + SPH_C32(0x8f660d60), SPH_C32(0xa7f122eb), SPH_C32(0xdfd10240), + SPH_C32(0xadd00000), SPH_C32(0xc9e10000), SPH_C32(0xe33d0000), + SPH_C32(0xd303799d), SPH_C32(0x74541fe0), SPH_C32(0x56c3945f), + SPH_C32(0x17e4d1b6) }, + { SPH_C32(0x5e0bd400), SPH_C32(0x46b30000), SPH_C32(0xc35a0000), + SPH_C32(0x98430000), SPH_C32(0xceb10d9a), SPH_C32(0x3ac156ed), + SPH_C32(0x9a9409fb), SPH_C32(0x04324f59), SPH_C32(0xedeb3c00), + SPH_C32(0xc9e10000), SPH_C32(0xdaec0000), SPH_C32(0x5d5a0000), + SPH_C32(0x8e04230e), SPH_C32(0xede46656), SPH_C32(0x27e190aa), + SPH_C32(0xfa4c0711) }, + { SPH_C32(0x9760d430), SPH_C32(0xa1960000), SPH_C32(0xecde0000), + SPH_C32(0xbe0c0000), SPH_C32(0xc6d85663), SPH_C32(0x573da7da), + SPH_C32(0xca0b607f), SPH_C32(0x9a5be031), SPH_C32(0xcb8b3e40), + SPH_C32(0x14390000), SPH_C32(0xa8c60000), SPH_C32(0x125c0000), + SPH_C32(0x1d6244f1), SPH_C32(0xc41d2298), SPH_C32(0x116af37f), + SPH_C32(0xf66af573) }, + { SPH_C32(0x4a51e800), SPH_C32(0xff5a0000), SPH_C32(0xa27d0000), + SPH_C32(0x69220000), SPH_C32(0x00d030f6), SPH_C32(0x8a886b95), + SPH_C32(0xdd3d6edb), SPH_C32(0xe5bc6b9c), SPH_C32(0xce8c2800), + SPH_C32(0x01580000), SPH_C32(0x2e2b0000), SPH_C32(0xa62f0000), + SPH_C32(0xfdc9076b), SPH_C32(0x1542c31f), SPH_C32(0x25259a95), + SPH_C32(0x2668e10e) }, + { SPH_C32(0x833ae830), SPH_C32(0x187f0000), SPH_C32(0x8df90000), + SPH_C32(0x4f6d0000), SPH_C32(0x08b96b0f), SPH_C32(0xe7749aa2), + SPH_C32(0x8da2075f), SPH_C32(0x7bd5c4f4), SPH_C32(0xe8ec2a40), + SPH_C32(0xdc800000), SPH_C32(0x5c010000), SPH_C32(0xe9290000), + SPH_C32(0x6eaf6094), SPH_C32(0x3cbb87d1), SPH_C32(0x13aef940), + SPH_C32(0x2a4e136c) }, + { SPH_C32(0xb5ff8400), SPH_C32(0xd4340000), SPH_C32(0x601a0000), + SPH_C32(0x2f600000), SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), + SPH_C32(0xb0e67183), SPH_C32(0xf5c750ed), SPH_C32(0x8efe4800), + SPH_C32(0x525c0000), SPH_C32(0x8ada0000), SPH_C32(0xf68b0000), + SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), SPH_C32(0x093cbc28), + SPH_C32(0x92fdf249) }, + { SPH_C32(0x7c948430), SPH_C32(0x33110000), SPH_C32(0x4f9e0000), + SPH_C32(0x092f0000), SPH_C32(0x5f8d5633), SPH_C32(0xda2a1386), + SPH_C32(0xe0791807), SPH_C32(0x6baeff85), SPH_C32(0xa89e4a40), + SPH_C32(0x8f840000), SPH_C32(0xf8f00000), SPH_C32(0xb98d0000), + SPH_C32(0x136c3a88), SPH_C32(0x18577e48), SPH_C32(0x3fb7dffd), + SPH_C32(0x9edb002b) }, + { SPH_C32(0xa1a5b800), SPH_C32(0x6ddd0000), SPH_C32(0x013d0000), + SPH_C32(0xde010000), SPH_C32(0x998530a6), SPH_C32(0x079fdfc9), + SPH_C32(0xf74f16a3), SPH_C32(0x14497428), SPH_C32(0xad995c00), + SPH_C32(0x9ae50000), SPH_C32(0x7e1d0000), SPH_C32(0x0dfe0000), + SPH_C32(0xf3c77912), SPH_C32(0xc9089fcf), SPH_C32(0x0bf8b617), + SPH_C32(0x4ed91456) }, + { SPH_C32(0x68ceb830), SPH_C32(0x8af80000), SPH_C32(0x2eb90000), + SPH_C32(0xf84e0000), SPH_C32(0x91ec6b5f), SPH_C32(0x6a632efe), + SPH_C32(0xa7d07f27), SPH_C32(0x8a20db40), SPH_C32(0x8bf95e40), + SPH_C32(0x473d0000), SPH_C32(0x0c370000), SPH_C32(0x42f80000), + SPH_C32(0x60a11eed), SPH_C32(0xe0f1db01), SPH_C32(0x3d73d5c2), + SPH_C32(0x42ffe634) }, + { SPH_C32(0x96989000), SPH_C32(0x1c8d0000), SPH_C32(0x94dd0000), + SPH_C32(0xd4150000), SPH_C32(0x242929af), SPH_C32(0x4f7047f8), + SPH_C32(0xb2227bbc), SPH_C32(0x29e3b6f2), SPH_C32(0xb9c36000), + SPH_C32(0x230c0000), SPH_C32(0x1f3a0000), SPH_C32(0xfc9f0000), + SPH_C32(0x3da6447e), SPH_C32(0x7941a2b7), SPH_C32(0x4c51d137), + SPH_C32(0xaf573093) }, + { SPH_C32(0x5ff39030), SPH_C32(0xfba80000), SPH_C32(0xbb590000), + SPH_C32(0xf25a0000), SPH_C32(0x2c407256), SPH_C32(0x228cb6cf), + SPH_C32(0xe2bd1238), SPH_C32(0xb78a199a), SPH_C32(0x9fa36240), + SPH_C32(0xfed40000), SPH_C32(0x6d100000), SPH_C32(0xb3990000), + SPH_C32(0xaec02381), SPH_C32(0x50b8e679), SPH_C32(0x7adab2e2), + SPH_C32(0xa371c2f1) }, + { SPH_C32(0x82c2ac00), SPH_C32(0xa5640000), SPH_C32(0xf5fa0000), + SPH_C32(0x25740000), SPH_C32(0xea4814c3), SPH_C32(0xff397a80), + SPH_C32(0xf58b1c9c), SPH_C32(0xc86d9237), SPH_C32(0x9aa47400), + SPH_C32(0xebb50000), SPH_C32(0xebfd0000), SPH_C32(0x07ea0000), + SPH_C32(0x4e6b601b), SPH_C32(0x81e707fe), SPH_C32(0x4e95db08), + SPH_C32(0x7373d68c) }, + { SPH_C32(0x4ba9ac30), SPH_C32(0x42410000), SPH_C32(0xda7e0000), + SPH_C32(0x033b0000), SPH_C32(0xe2214f3a), SPH_C32(0x92c58bb7), + SPH_C32(0xa5147518), SPH_C32(0x56043d5f), SPH_C32(0xbcc47640), + SPH_C32(0x366d0000), SPH_C32(0x99d70000), SPH_C32(0x48ec0000), + SPH_C32(0xdd0d07e4), SPH_C32(0xa81e4330), SPH_C32(0x781eb8dd), + SPH_C32(0x7f5524ee) }, + { SPH_C32(0xe1d7d800), SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), + SPH_C32(0x8ea50000), SPH_C32(0xe4466aba), SPH_C32(0x23732650), + SPH_C32(0xdb56301e), SPH_C32(0xa0dc676f), SPH_C32(0x12455000), + SPH_C32(0xe28f0000), SPH_C32(0x188b0000), SPH_C32(0x1b180000), + SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), SPH_C32(0x4a3a8ff2), + SPH_C32(0xea373c60) }, + { SPH_C32(0x28bcd830), SPH_C32(0xd9fc0000), SPH_C32(0x8a480000), + SPH_C32(0xa8ea0000), SPH_C32(0xec2f3143), SPH_C32(0x4e8fd767), + SPH_C32(0x8bc9599a), SPH_C32(0x3eb5c807), SPH_C32(0x34255240), + SPH_C32(0x3f570000), SPH_C32(0x6aa10000), SPH_C32(0x541e0000), + SPH_C32(0x4a5679cd), SPH_C32(0xf943abbc), SPH_C32(0x7cb1ec27), + SPH_C32(0xe611ce02) }, + { SPH_C32(0xf58de400), SPH_C32(0x87300000), SPH_C32(0xc4eb0000), + SPH_C32(0x7fc40000), SPH_C32(0x2a2757d6), SPH_C32(0x933a1b28), + SPH_C32(0x9cff573e), SPH_C32(0x415243aa), SPH_C32(0x31224400), + SPH_C32(0x2a360000), SPH_C32(0xec4c0000), SPH_C32(0xe06d0000), + SPH_C32(0xaafd3a57), SPH_C32(0x281c4a3b), SPH_C32(0x48fe85cd), + SPH_C32(0x3613da7f) }, + { SPH_C32(0x3ce6e430), SPH_C32(0x60150000), SPH_C32(0xeb6f0000), + SPH_C32(0x598b0000), SPH_C32(0x224e0c2f), SPH_C32(0xfec6ea1f), + SPH_C32(0xcc603eba), SPH_C32(0xdf3becc2), SPH_C32(0x17424640), + SPH_C32(0xf7ee0000), SPH_C32(0x9e660000), SPH_C32(0xaf6b0000), + SPH_C32(0x399b5da8), SPH_C32(0x01e50ef5), SPH_C32(0x7e75e618), + SPH_C32(0x3a35281d) }, + { SPH_C32(0xc2b0cc00), SPH_C32(0xf6600000), SPH_C32(0x510b0000), + SPH_C32(0x75d00000), SPH_C32(0x978b4edf), SPH_C32(0xdbd58319), + SPH_C32(0xd9923a21), SPH_C32(0x7cf88170), SPH_C32(0x25787800), + SPH_C32(0x93df0000), SPH_C32(0x8d6b0000), SPH_C32(0x110c0000), + SPH_C32(0x649c073b), SPH_C32(0x98557743), SPH_C32(0x0f57e2ed), + SPH_C32(0xd79dfeba) }, + { SPH_C32(0x0bdbcc30), SPH_C32(0x11450000), SPH_C32(0x7e8f0000), + SPH_C32(0x539f0000), SPH_C32(0x9fe21526), SPH_C32(0xb629722e), + SPH_C32(0x890d53a5), SPH_C32(0xe2912e18), SPH_C32(0x03187a40), + SPH_C32(0x4e070000), SPH_C32(0xff410000), SPH_C32(0x5e0a0000), + SPH_C32(0xf7fa60c4), SPH_C32(0xb1ac338d), SPH_C32(0x39dc8138), + SPH_C32(0xdbbb0cd8) }, + { SPH_C32(0xd6eaf000), SPH_C32(0x4f890000), SPH_C32(0x302c0000), + SPH_C32(0x84b10000), SPH_C32(0x59ea73b3), SPH_C32(0x6b9cbe61), + SPH_C32(0x9e3b5d01), SPH_C32(0x9d76a5b5), SPH_C32(0x061f6c00), + SPH_C32(0x5b660000), SPH_C32(0x79ac0000), SPH_C32(0xea790000), + SPH_C32(0x1751235e), SPH_C32(0x60f3d20a), SPH_C32(0x0d93e8d2), + SPH_C32(0x0bb918a5) }, + { SPH_C32(0x1f81f030), SPH_C32(0xa8ac0000), SPH_C32(0x1fa80000), + SPH_C32(0xa2fe0000), SPH_C32(0x5183284a), SPH_C32(0x06604f56), + SPH_C32(0xcea43485), SPH_C32(0x031f0add), SPH_C32(0x207f6e40), + SPH_C32(0x86be0000), SPH_C32(0x0b860000), SPH_C32(0xa57f0000), + SPH_C32(0x843744a1), SPH_C32(0x490a96c4), SPH_C32(0x3b188b07), + SPH_C32(0x079feac7) }, + { SPH_C32(0x466d0c00), SPH_C32(0x08620000), SPH_C32(0xdd5d0000), + SPH_C32(0xbadd0000), SPH_C32(0x6a927942), SPH_C32(0x441f2b93), + SPH_C32(0x218ace6f), SPH_C32(0xbf2c0be2), SPH_C32(0x6f299000), + SPH_C32(0x6c850000), SPH_C32(0x2f160000), SPH_C32(0x782e0000), + SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), SPH_C32(0xd26a8c36), + SPH_C32(0x32219526) }, + { SPH_C32(0x8f060c30), SPH_C32(0xef470000), SPH_C32(0xf2d90000), + SPH_C32(0x9c920000), SPH_C32(0x62fb22bb), SPH_C32(0x29e3daa4), + SPH_C32(0x7115a7eb), SPH_C32(0x2145a48a), SPH_C32(0x49499240), + SPH_C32(0xb15d0000), SPH_C32(0x5d3c0000), SPH_C32(0x37280000), + SPH_C32(0xf72a5032), SPH_C32(0x3b245818), SPH_C32(0xe4e1efe3), + SPH_C32(0x3e076744) }, + { SPH_C32(0x52373000), SPH_C32(0xb18b0000), SPH_C32(0xbc7a0000), + SPH_C32(0x4bbc0000), SPH_C32(0xa4f3442e), SPH_C32(0xf45616eb), + SPH_C32(0x6623a94f), SPH_C32(0x5ea22f27), SPH_C32(0x4c4e8400), + SPH_C32(0xa43c0000), SPH_C32(0xdbd10000), SPH_C32(0x835b0000), + SPH_C32(0x178113a8), SPH_C32(0xea7bb99f), SPH_C32(0xd0ae8609), + SPH_C32(0xee057339) }, + { SPH_C32(0x9b5c3030), SPH_C32(0x56ae0000), SPH_C32(0x93fe0000), + SPH_C32(0x6df30000), SPH_C32(0xac9a1fd7), SPH_C32(0x99aae7dc), + SPH_C32(0x36bcc0cb), SPH_C32(0xc0cb804f), SPH_C32(0x6a2e8640), + SPH_C32(0x79e40000), SPH_C32(0xa9fb0000), SPH_C32(0xcc5d0000), + SPH_C32(0x84e77457), SPH_C32(0xc382fd51), SPH_C32(0xe625e5dc), + SPH_C32(0xe223815b) }, + { SPH_C32(0x650a1800), SPH_C32(0xc0db0000), SPH_C32(0x299a0000), + SPH_C32(0x41a80000), SPH_C32(0x195f5d27), SPH_C32(0xbcb98eda), + SPH_C32(0x234ec450), SPH_C32(0x6308edfd), SPH_C32(0x5814b800), + SPH_C32(0x1dd50000), SPH_C32(0xbaf60000), SPH_C32(0x723a0000), + SPH_C32(0xd9e02ec4), SPH_C32(0x5a3284e7), SPH_C32(0x9707e129), + SPH_C32(0x0f8b57fc) }, + { SPH_C32(0xac611830), SPH_C32(0x27fe0000), SPH_C32(0x061e0000), + SPH_C32(0x67e70000), SPH_C32(0x113606de), SPH_C32(0xd1457fed), + SPH_C32(0x73d1add4), SPH_C32(0xfd614295), SPH_C32(0x7e74ba40), + SPH_C32(0xc00d0000), SPH_C32(0xc8dc0000), SPH_C32(0x3d3c0000), + SPH_C32(0x4a86493b), SPH_C32(0x73cbc029), SPH_C32(0xa18c82fc), + SPH_C32(0x03ada59e) }, + { SPH_C32(0x71502400), SPH_C32(0x79320000), SPH_C32(0x48bd0000), + SPH_C32(0xb0c90000), SPH_C32(0xd73e604b), SPH_C32(0x0cf0b3a2), + SPH_C32(0x64e7a370), SPH_C32(0x8286c938), SPH_C32(0x7b73ac00), + SPH_C32(0xd56c0000), SPH_C32(0x4e310000), SPH_C32(0x894f0000), + SPH_C32(0xaa2d0aa1), SPH_C32(0xa29421ae), SPH_C32(0x95c3eb16), + SPH_C32(0xd3afb1e3) }, + { SPH_C32(0xb83b2430), SPH_C32(0x9e170000), SPH_C32(0x67390000), + SPH_C32(0x96860000), SPH_C32(0xdf573bb2), SPH_C32(0x610c4295), + SPH_C32(0x3478caf4), SPH_C32(0x1cef6650), SPH_C32(0x5d13ae40), + SPH_C32(0x08b40000), SPH_C32(0x3c1b0000), SPH_C32(0xc6490000), + SPH_C32(0x394b6d5e), SPH_C32(0x8b6d6560), SPH_C32(0xa34888c3), + SPH_C32(0xdf894381) }, + { SPH_C32(0x12455000), SPH_C32(0xe28f0000), SPH_C32(0x188b0000), + SPH_C32(0x1b180000), SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), + SPH_C32(0x4a3a8ff2), SPH_C32(0xea373c60), SPH_C32(0xf3928800), + SPH_C32(0xdc560000), SPH_C32(0xbd470000), SPH_C32(0x95bd0000), + SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), SPH_C32(0x916cbfec), + SPH_C32(0x4aeb5b0f) }, + { SPH_C32(0xdb2e5030), SPH_C32(0x05aa0000), SPH_C32(0x370f0000), + SPH_C32(0x3d570000), SPH_C32(0xd15945cb), SPH_C32(0xbd461e45), + SPH_C32(0x1aa5e676), SPH_C32(0x745e9308), SPH_C32(0xd5f28a40), + SPH_C32(0x018e0000), SPH_C32(0xcf6d0000), SPH_C32(0xdabb0000), + SPH_C32(0xae101377), SPH_C32(0xda308dec), SPH_C32(0xa7e7dc39), + SPH_C32(0x46cda96d) }, + { SPH_C32(0x061f6c00), SPH_C32(0x5b660000), SPH_C32(0x79ac0000), + SPH_C32(0xea790000), SPH_C32(0x1751235e), SPH_C32(0x60f3d20a), + SPH_C32(0x0d93e8d2), SPH_C32(0x0bb918a5), SPH_C32(0xd0f59c00), + SPH_C32(0x14ef0000), SPH_C32(0x49800000), SPH_C32(0x6ec80000), + SPH_C32(0x4ebb50ed), SPH_C32(0x0b6f6c6b), SPH_C32(0x93a8b5d3), + SPH_C32(0x96cfbd10) }, + { SPH_C32(0xcf746c30), SPH_C32(0xbc430000), SPH_C32(0x56280000), + SPH_C32(0xcc360000), SPH_C32(0x1f3878a7), SPH_C32(0x0d0f233d), + SPH_C32(0x5d0c8156), SPH_C32(0x95d0b7cd), SPH_C32(0xf6959e40), + SPH_C32(0xc9370000), SPH_C32(0x3baa0000), SPH_C32(0x21ce0000), + SPH_C32(0xdddd3712), SPH_C32(0x229628a5), SPH_C32(0xa523d606), + SPH_C32(0x9ae94f72) }, + { SPH_C32(0x31224400), SPH_C32(0x2a360000), SPH_C32(0xec4c0000), + SPH_C32(0xe06d0000), SPH_C32(0xaafd3a57), SPH_C32(0x281c4a3b), + SPH_C32(0x48fe85cd), SPH_C32(0x3613da7f), SPH_C32(0xc4afa000), + SPH_C32(0xad060000), SPH_C32(0x28a70000), SPH_C32(0x9fa90000), + SPH_C32(0x80da6d81), SPH_C32(0xbb265113), SPH_C32(0xd401d2f3), + SPH_C32(0x774199d5) }, + { SPH_C32(0xf8494430), SPH_C32(0xcd130000), SPH_C32(0xc3c80000), + SPH_C32(0xc6220000), SPH_C32(0xa29461ae), SPH_C32(0x45e0bb0c), + SPH_C32(0x1861ec49), SPH_C32(0xa87a7517), SPH_C32(0xe2cfa240), + SPH_C32(0x70de0000), SPH_C32(0x5a8d0000), SPH_C32(0xd0af0000), + SPH_C32(0x13bc0a7e), SPH_C32(0x92df15dd), SPH_C32(0xe28ab126), + SPH_C32(0x7b676bb7) }, + { SPH_C32(0x25787800), SPH_C32(0x93df0000), SPH_C32(0x8d6b0000), + SPH_C32(0x110c0000), SPH_C32(0x649c073b), SPH_C32(0x98557743), + SPH_C32(0x0f57e2ed), SPH_C32(0xd79dfeba), SPH_C32(0xe7c8b400), + SPH_C32(0x65bf0000), SPH_C32(0xdc600000), SPH_C32(0x64dc0000), + SPH_C32(0xf31749e4), SPH_C32(0x4380f45a), SPH_C32(0xd6c5d8cc), + SPH_C32(0xab657fca) }, + { SPH_C32(0xec137830), SPH_C32(0x74fa0000), SPH_C32(0xa2ef0000), + SPH_C32(0x37430000), SPH_C32(0x6cf55cc2), SPH_C32(0xf5a98674), + SPH_C32(0x5fc88b69), SPH_C32(0x49f451d2), SPH_C32(0xc1a8b640), + SPH_C32(0xb8670000), SPH_C32(0xae4a0000), SPH_C32(0x2bda0000), + SPH_C32(0x60712e1b), SPH_C32(0x6a79b094), SPH_C32(0xe04ebb19), + SPH_C32(0xa7438da8) }, + { SPH_C32(0xdad61400), SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), + SPH_C32(0x574e0000), SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), + SPH_C32(0x628cfdb5), SPH_C32(0xc7e6c5cb), SPH_C32(0xa7bad400), + SPH_C32(0x36bb0000), SPH_C32(0x78910000), SPH_C32(0x34780000), + SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), SPH_C32(0xfadcfe71), + SPH_C32(0x1ff06c8d) }, + { SPH_C32(0x13bd1430), SPH_C32(0x5f940000), SPH_C32(0x60880000), + SPH_C32(0x71010000), SPH_C32(0x3bc161fe), SPH_C32(0xc8f70f50), + SPH_C32(0x32139431), SPH_C32(0x598f6aa3), SPH_C32(0x81dad640), + SPH_C32(0xeb630000), SPH_C32(0x0abb0000), SPH_C32(0x7b7e0000), + SPH_C32(0x1db27407), SPH_C32(0x4e95490d), SPH_C32(0xcc579da4), + SPH_C32(0x13d69eef) }, + { SPH_C32(0xce8c2800), SPH_C32(0x01580000), SPH_C32(0x2e2b0000), + SPH_C32(0xa62f0000), SPH_C32(0xfdc9076b), SPH_C32(0x1542c31f), + SPH_C32(0x25259a95), SPH_C32(0x2668e10e), SPH_C32(0x84ddc000), + SPH_C32(0xfe020000), SPH_C32(0x8c560000), SPH_C32(0xcf0d0000), + SPH_C32(0xfd19379d), SPH_C32(0x9fcaa88a), SPH_C32(0xf818f44e), + SPH_C32(0xc3d48a92) }, + { SPH_C32(0x07e72830), SPH_C32(0xe67d0000), SPH_C32(0x01af0000), + SPH_C32(0x80600000), SPH_C32(0xf5a05c92), SPH_C32(0x78be3228), + SPH_C32(0x75baf311), SPH_C32(0xb8014e66), SPH_C32(0xa2bdc240), + SPH_C32(0x23da0000), SPH_C32(0xfe7c0000), SPH_C32(0x800b0000), + SPH_C32(0x6e7f5062), SPH_C32(0xb633ec44), SPH_C32(0xce93979b), + SPH_C32(0xcff278f0) }, + { SPH_C32(0xf9b10000), SPH_C32(0x70080000), SPH_C32(0xbbcb0000), + SPH_C32(0xac3b0000), SPH_C32(0x40651e62), SPH_C32(0x5dad5b2e), + SPH_C32(0x6048f78a), SPH_C32(0x1bc223d4), SPH_C32(0x9087fc00), + SPH_C32(0x47eb0000), SPH_C32(0xed710000), SPH_C32(0x3e6c0000), + SPH_C32(0x33780af1), SPH_C32(0x2f8395f2), SPH_C32(0xbfb1936e), + SPH_C32(0x225aae57) }, + { SPH_C32(0x30da0030), SPH_C32(0x972d0000), SPH_C32(0x944f0000), + SPH_C32(0x8a740000), SPH_C32(0x480c459b), SPH_C32(0x3051aa19), + SPH_C32(0x30d79e0e), SPH_C32(0x85ab8cbc), SPH_C32(0xb6e7fe40), + SPH_C32(0x9a330000), SPH_C32(0x9f5b0000), SPH_C32(0x716a0000), + SPH_C32(0xa01e6d0e), SPH_C32(0x067ad13c), SPH_C32(0x893af0bb), + SPH_C32(0x2e7c5c35) }, + { SPH_C32(0xedeb3c00), SPH_C32(0xc9e10000), SPH_C32(0xdaec0000), + SPH_C32(0x5d5a0000), SPH_C32(0x8e04230e), SPH_C32(0xede46656), + SPH_C32(0x27e190aa), SPH_C32(0xfa4c0711), SPH_C32(0xb3e0e800), + SPH_C32(0x8f520000), SPH_C32(0x19b60000), SPH_C32(0xc5190000), + SPH_C32(0x40b52e94), SPH_C32(0xd72530bb), SPH_C32(0xbd759951), + SPH_C32(0xfe7e4848) }, + { SPH_C32(0x24803c30), SPH_C32(0x2ec40000), SPH_C32(0xf5680000), + SPH_C32(0x7b150000), SPH_C32(0x866d78f7), SPH_C32(0x80189761), + SPH_C32(0x777ef92e), SPH_C32(0x6425a879), SPH_C32(0x9580ea40), + SPH_C32(0x528a0000), SPH_C32(0x6b9c0000), SPH_C32(0x8a1f0000), + SPH_C32(0xd3d3496b), SPH_C32(0xfedc7475), SPH_C32(0x8bfefa84), + SPH_C32(0xf258ba2a) }, + { SPH_C32(0x8efe4800), SPH_C32(0x525c0000), SPH_C32(0x8ada0000), + SPH_C32(0xf68b0000), SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), + SPH_C32(0x093cbc28), SPH_C32(0x92fdf249), SPH_C32(0x3b01cc00), + SPH_C32(0x86680000), SPH_C32(0xeac00000), SPH_C32(0xd9eb0000), + SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), SPH_C32(0xb9dacdab), + SPH_C32(0x673aa2a4) }, + { SPH_C32(0x47954830), SPH_C32(0xb5790000), SPH_C32(0xa55e0000), + SPH_C32(0xd0c40000), SPH_C32(0x8863068e), SPH_C32(0x5c52cbb1), + SPH_C32(0x59a3d5ac), SPH_C32(0x0c945d21), SPH_C32(0x1d61ce40), + SPH_C32(0x5bb00000), SPH_C32(0x98ea0000), SPH_C32(0x96ed0000), + SPH_C32(0x44883742), SPH_C32(0xaf819cf9), SPH_C32(0x8f51ae7e), + SPH_C32(0x6b1c50c6) }, + { SPH_C32(0x9aa47400), SPH_C32(0xebb50000), SPH_C32(0xebfd0000), + SPH_C32(0x07ea0000), SPH_C32(0x4e6b601b), SPH_C32(0x81e707fe), + SPH_C32(0x4e95db08), SPH_C32(0x7373d68c), SPH_C32(0x1866d800), + SPH_C32(0x4ed10000), SPH_C32(0x1e070000), SPH_C32(0x229e0000), + SPH_C32(0xa42374d8), SPH_C32(0x7ede7d7e), SPH_C32(0xbb1ec794), + SPH_C32(0xbb1e44bb) }, + { SPH_C32(0x53cf7430), SPH_C32(0x0c900000), SPH_C32(0xc4790000), + SPH_C32(0x21a50000), SPH_C32(0x46023be2), SPH_C32(0xec1bf6c9), + SPH_C32(0x1e0ab28c), SPH_C32(0xed1a79e4), SPH_C32(0x3e06da40), + SPH_C32(0x93090000), SPH_C32(0x6c2d0000), SPH_C32(0x6d980000), + SPH_C32(0x37451327), SPH_C32(0x572739b0), SPH_C32(0x8d95a441), + SPH_C32(0xb738b6d9) }, + { SPH_C32(0xad995c00), SPH_C32(0x9ae50000), SPH_C32(0x7e1d0000), + SPH_C32(0x0dfe0000), SPH_C32(0xf3c77912), SPH_C32(0xc9089fcf), + SPH_C32(0x0bf8b617), SPH_C32(0x4ed91456), SPH_C32(0x0c3ce400), + SPH_C32(0xf7380000), SPH_C32(0x7f200000), SPH_C32(0xd3ff0000), + SPH_C32(0x6a4249b4), SPH_C32(0xce974006), SPH_C32(0xfcb7a0b4), + SPH_C32(0x5a90607e) }, + { SPH_C32(0x64f25c30), SPH_C32(0x7dc00000), SPH_C32(0x51990000), + SPH_C32(0x2bb10000), SPH_C32(0xfbae22eb), SPH_C32(0xa4f46ef8), + SPH_C32(0x5b67df93), SPH_C32(0xd0b0bb3e), SPH_C32(0x2a5ce640), + SPH_C32(0x2ae00000), SPH_C32(0x0d0a0000), SPH_C32(0x9cf90000), + SPH_C32(0xf9242e4b), SPH_C32(0xe76e04c8), SPH_C32(0xca3cc361), + SPH_C32(0x56b6921c) }, + { SPH_C32(0xb9c36000), SPH_C32(0x230c0000), SPH_C32(0x1f3a0000), + SPH_C32(0xfc9f0000), SPH_C32(0x3da6447e), SPH_C32(0x7941a2b7), + SPH_C32(0x4c51d137), SPH_C32(0xaf573093), SPH_C32(0x2f5bf000), + SPH_C32(0x3f810000), SPH_C32(0x8be70000), SPH_C32(0x288a0000), + SPH_C32(0x198f6dd1), SPH_C32(0x3631e54f), SPH_C32(0xfe73aa8b), + SPH_C32(0x86b48661) }, + { SPH_C32(0x70a86030), SPH_C32(0xc4290000), SPH_C32(0x30be0000), + SPH_C32(0xdad00000), SPH_C32(0x35cf1f87), SPH_C32(0x14bd5380), + SPH_C32(0x1cceb8b3), SPH_C32(0x313e9ffb), SPH_C32(0x093bf240), + SPH_C32(0xe2590000), SPH_C32(0xf9cd0000), SPH_C32(0x678c0000), + SPH_C32(0x8ae90a2e), SPH_C32(0x1fc8a181), SPH_C32(0xc8f8c95e), + SPH_C32(0x8a927403) }, + { SPH_C32(0x6f299000), SPH_C32(0x6c850000), SPH_C32(0x2f160000), + SPH_C32(0x782e0000), SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), + SPH_C32(0xd26a8c36), SPH_C32(0x32219526), SPH_C32(0x29449c00), + SPH_C32(0x64e70000), SPH_C32(0xf24b0000), SPH_C32(0xc2f30000), + SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), SPH_C32(0xf3e04259), + SPH_C32(0x8d0d9ec4) }, + { SPH_C32(0xa6429030), SPH_C32(0x8ba00000), SPH_C32(0x00920000), + SPH_C32(0x5e610000), SPH_C32(0x6c256c34), SPH_C32(0x7f21ede1), + SPH_C32(0x82f5e5b2), SPH_C32(0xac483a4e), SPH_C32(0x0f249e40), + SPH_C32(0xb93f0000), SPH_C32(0x80610000), SPH_C32(0x8df50000), + SPH_C32(0x9db82970), SPH_C32(0x7f3b738b), SPH_C32(0xc56b218c), + SPH_C32(0x812b6ca6) }, + { SPH_C32(0x7b73ac00), SPH_C32(0xd56c0000), SPH_C32(0x4e310000), + SPH_C32(0x894f0000), SPH_C32(0xaa2d0aa1), SPH_C32(0xa29421ae), + SPH_C32(0x95c3eb16), SPH_C32(0xd3afb1e3), SPH_C32(0x0a238800), + SPH_C32(0xac5e0000), SPH_C32(0x068c0000), SPH_C32(0x39860000), + SPH_C32(0x7d136aea), SPH_C32(0xae64920c), SPH_C32(0xf1244866), + SPH_C32(0x512978db) }, + { SPH_C32(0xb218ac30), SPH_C32(0x32490000), SPH_C32(0x61b50000), + SPH_C32(0xaf000000), SPH_C32(0xa2445158), SPH_C32(0xcf68d099), + SPH_C32(0xc55c8292), SPH_C32(0x4dc61e8b), SPH_C32(0x2c438a40), + SPH_C32(0x71860000), SPH_C32(0x74a60000), SPH_C32(0x76800000), + SPH_C32(0xee750d15), SPH_C32(0x879dd6c2), SPH_C32(0xc7af2bb3), + SPH_C32(0x5d0f8ab9) }, + { SPH_C32(0x4c4e8400), SPH_C32(0xa43c0000), SPH_C32(0xdbd10000), + SPH_C32(0x835b0000), SPH_C32(0x178113a8), SPH_C32(0xea7bb99f), + SPH_C32(0xd0ae8609), SPH_C32(0xee057339), SPH_C32(0x1e79b400), + SPH_C32(0x15b70000), SPH_C32(0x67ab0000), SPH_C32(0xc8e70000), + SPH_C32(0xb3725786), SPH_C32(0x1e2daf74), SPH_C32(0xb68d2f46), + SPH_C32(0xb0a75c1e) }, + { SPH_C32(0x85258430), SPH_C32(0x43190000), SPH_C32(0xf4550000), + SPH_C32(0xa5140000), SPH_C32(0x1fe84851), SPH_C32(0x878748a8), + SPH_C32(0x8031ef8d), SPH_C32(0x706cdc51), SPH_C32(0x3819b640), + SPH_C32(0xc86f0000), SPH_C32(0x15810000), SPH_C32(0x87e10000), + SPH_C32(0x20143079), SPH_C32(0x37d4ebba), SPH_C32(0x80064c93), + SPH_C32(0xbc81ae7c) }, + { SPH_C32(0x5814b800), SPH_C32(0x1dd50000), SPH_C32(0xbaf60000), + SPH_C32(0x723a0000), SPH_C32(0xd9e02ec4), SPH_C32(0x5a3284e7), + SPH_C32(0x9707e129), SPH_C32(0x0f8b57fc), SPH_C32(0x3d1ea000), + SPH_C32(0xdd0e0000), SPH_C32(0x936c0000), SPH_C32(0x33920000), + SPH_C32(0xc0bf73e3), SPH_C32(0xe68b0a3d), SPH_C32(0xb4492579), + SPH_C32(0x6c83ba01) }, + { SPH_C32(0x917fb830), SPH_C32(0xfaf00000), SPH_C32(0x95720000), + SPH_C32(0x54750000), SPH_C32(0xd189753d), SPH_C32(0x37ce75d0), + SPH_C32(0xc79888ad), SPH_C32(0x91e2f894), SPH_C32(0x1b7ea240), + SPH_C32(0x00d60000), SPH_C32(0xe1460000), SPH_C32(0x7c940000), + SPH_C32(0x53d9141c), SPH_C32(0xcf724ef3), SPH_C32(0x82c246ac), + SPH_C32(0x60a54863) }, + { SPH_C32(0x3b01cc00), SPH_C32(0x86680000), SPH_C32(0xeac00000), + SPH_C32(0xd9eb0000), SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), + SPH_C32(0xb9dacdab), SPH_C32(0x673aa2a4), SPH_C32(0xb5ff8400), + SPH_C32(0xd4340000), SPH_C32(0x601a0000), SPH_C32(0x2f600000), + SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), SPH_C32(0xb0e67183), + SPH_C32(0xf5c750ed) }, + { SPH_C32(0xf26acc30), SPH_C32(0x614d0000), SPH_C32(0xc5440000), + SPH_C32(0xffa40000), SPH_C32(0xdf870b44), SPH_C32(0xeb842900), + SPH_C32(0xe945a42f), SPH_C32(0xf9530dcc), SPH_C32(0x939f8640), + SPH_C32(0x09ec0000), SPH_C32(0x12300000), SPH_C32(0x60660000), + SPH_C32(0xc4826a35), SPH_C32(0x9e2fa67f), SPH_C32(0x866d1256), + SPH_C32(0xf9e1a28f) }, + { SPH_C32(0x2f5bf000), SPH_C32(0x3f810000), SPH_C32(0x8be70000), + SPH_C32(0x288a0000), SPH_C32(0x198f6dd1), SPH_C32(0x3631e54f), + SPH_C32(0xfe73aa8b), SPH_C32(0x86b48661), SPH_C32(0x96989000), + SPH_C32(0x1c8d0000), SPH_C32(0x94dd0000), SPH_C32(0xd4150000), + SPH_C32(0x242929af), SPH_C32(0x4f7047f8), SPH_C32(0xb2227bbc), + SPH_C32(0x29e3b6f2) }, + { SPH_C32(0xe630f030), SPH_C32(0xd8a40000), SPH_C32(0xa4630000), + SPH_C32(0x0ec50000), SPH_C32(0x11e63628), SPH_C32(0x5bcd1478), + SPH_C32(0xaeecc30f), SPH_C32(0x18dd2909), SPH_C32(0xb0f89240), + SPH_C32(0xc1550000), SPH_C32(0xe6f70000), SPH_C32(0x9b130000), + SPH_C32(0xb74f4e50), SPH_C32(0x66890336), SPH_C32(0x84a91869), + SPH_C32(0x25c54490) }, + { SPH_C32(0x1866d800), SPH_C32(0x4ed10000), SPH_C32(0x1e070000), + SPH_C32(0x229e0000), SPH_C32(0xa42374d8), SPH_C32(0x7ede7d7e), + SPH_C32(0xbb1ec794), SPH_C32(0xbb1e44bb), SPH_C32(0x82c2ac00), + SPH_C32(0xa5640000), SPH_C32(0xf5fa0000), SPH_C32(0x25740000), + SPH_C32(0xea4814c3), SPH_C32(0xff397a80), SPH_C32(0xf58b1c9c), + SPH_C32(0xc86d9237) }, + { SPH_C32(0xd10dd830), SPH_C32(0xa9f40000), SPH_C32(0x31830000), + SPH_C32(0x04d10000), SPH_C32(0xac4a2f21), SPH_C32(0x13228c49), + SPH_C32(0xeb81ae10), SPH_C32(0x2577ebd3), SPH_C32(0xa4a2ae40), + SPH_C32(0x78bc0000), SPH_C32(0x87d00000), SPH_C32(0x6a720000), + SPH_C32(0x792e733c), SPH_C32(0xd6c03e4e), SPH_C32(0xc3007f49), + SPH_C32(0xc44b6055) }, + { SPH_C32(0x0c3ce400), SPH_C32(0xf7380000), SPH_C32(0x7f200000), + SPH_C32(0xd3ff0000), SPH_C32(0x6a4249b4), SPH_C32(0xce974006), + SPH_C32(0xfcb7a0b4), SPH_C32(0x5a90607e), SPH_C32(0xa1a5b800), + SPH_C32(0x6ddd0000), SPH_C32(0x013d0000), SPH_C32(0xde010000), + SPH_C32(0x998530a6), SPH_C32(0x079fdfc9), SPH_C32(0xf74f16a3), + SPH_C32(0x14497428) }, + { SPH_C32(0xc557e430), SPH_C32(0x101d0000), SPH_C32(0x50a40000), + SPH_C32(0xf5b00000), SPH_C32(0x622b124d), SPH_C32(0xa36bb131), + SPH_C32(0xac28c930), SPH_C32(0xc4f9cf16), SPH_C32(0x87c5ba40), + SPH_C32(0xb0050000), SPH_C32(0x73170000), SPH_C32(0x91070000), + SPH_C32(0x0ae35759), SPH_C32(0x2e669b07), SPH_C32(0xc1c47576), + SPH_C32(0x186f864a) }, + { SPH_C32(0xf3928800), SPH_C32(0xdc560000), SPH_C32(0xbd470000), + SPH_C32(0x95bd0000), SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), + SPH_C32(0x916cbfec), SPH_C32(0x4aeb5b0f), SPH_C32(0xe1d7d800), + SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), SPH_C32(0x8ea50000), + SPH_C32(0xe4466aba), SPH_C32(0x23732650), SPH_C32(0xdb56301e), + SPH_C32(0xa0dc676f) }, + { SPH_C32(0x3af98830), SPH_C32(0x3b730000), SPH_C32(0x92c30000), + SPH_C32(0xb3f20000), SPH_C32(0x351f2f71), SPH_C32(0x9e353815), + SPH_C32(0xc1f3d668), SPH_C32(0xd482f467), SPH_C32(0xc7b7da40), + SPH_C32(0xe3010000), SPH_C32(0xd7e60000), SPH_C32(0xc1a30000), + SPH_C32(0x77200d45), SPH_C32(0x0a8a629e), SPH_C32(0xeddd53cb), + SPH_C32(0xacfa950d) }, + { SPH_C32(0xe7c8b400), SPH_C32(0x65bf0000), SPH_C32(0xdc600000), + SPH_C32(0x64dc0000), SPH_C32(0xf31749e4), SPH_C32(0x4380f45a), + SPH_C32(0xd6c5d8cc), SPH_C32(0xab657fca), SPH_C32(0xc2b0cc00), + SPH_C32(0xf6600000), SPH_C32(0x510b0000), SPH_C32(0x75d00000), + SPH_C32(0x978b4edf), SPH_C32(0xdbd58319), SPH_C32(0xd9923a21), + SPH_C32(0x7cf88170) }, + { SPH_C32(0x2ea3b430), SPH_C32(0x829a0000), SPH_C32(0xf3e40000), + SPH_C32(0x42930000), SPH_C32(0xfb7e121d), SPH_C32(0x2e7c056d), + SPH_C32(0x865ab148), SPH_C32(0x350cd0a2), SPH_C32(0xe4d0ce40), + SPH_C32(0x2bb80000), SPH_C32(0x23210000), SPH_C32(0x3ad60000), + SPH_C32(0x04ed2920), SPH_C32(0xf22cc7d7), SPH_C32(0xef1959f4), + SPH_C32(0x70de7312) }, + { SPH_C32(0xd0f59c00), SPH_C32(0x14ef0000), SPH_C32(0x49800000), + SPH_C32(0x6ec80000), SPH_C32(0x4ebb50ed), SPH_C32(0x0b6f6c6b), + SPH_C32(0x93a8b5d3), SPH_C32(0x96cfbd10), SPH_C32(0xd6eaf000), + SPH_C32(0x4f890000), SPH_C32(0x302c0000), SPH_C32(0x84b10000), + SPH_C32(0x59ea73b3), SPH_C32(0x6b9cbe61), SPH_C32(0x9e3b5d01), + SPH_C32(0x9d76a5b5) }, + { SPH_C32(0x199e9c30), SPH_C32(0xf3ca0000), SPH_C32(0x66040000), + SPH_C32(0x48870000), SPH_C32(0x46d20b14), SPH_C32(0x66939d5c), + SPH_C32(0xc337dc57), SPH_C32(0x08a61278), SPH_C32(0xf08af240), + SPH_C32(0x92510000), SPH_C32(0x42060000), SPH_C32(0xcbb70000), + SPH_C32(0xca8c144c), SPH_C32(0x4265faaf), SPH_C32(0xa8b03ed4), + SPH_C32(0x915057d7) }, + { SPH_C32(0xc4afa000), SPH_C32(0xad060000), SPH_C32(0x28a70000), + SPH_C32(0x9fa90000), SPH_C32(0x80da6d81), SPH_C32(0xbb265113), + SPH_C32(0xd401d2f3), SPH_C32(0x774199d5), SPH_C32(0xf58de400), + SPH_C32(0x87300000), SPH_C32(0xc4eb0000), SPH_C32(0x7fc40000), + SPH_C32(0x2a2757d6), SPH_C32(0x933a1b28), SPH_C32(0x9cff573e), + SPH_C32(0x415243aa) }, + { SPH_C32(0x0dc4a030), SPH_C32(0x4a230000), SPH_C32(0x07230000), + SPH_C32(0xb9e60000), SPH_C32(0x88b33678), SPH_C32(0xd6daa024), + SPH_C32(0x849ebb77), SPH_C32(0xe92836bd), SPH_C32(0xd3ede640), + SPH_C32(0x5ae80000), SPH_C32(0xb6c10000), SPH_C32(0x30c20000), + SPH_C32(0xb9413029), SPH_C32(0xbac35fe6), SPH_C32(0xaa7434eb), + SPH_C32(0x4d74b1c8) }, + { SPH_C32(0xa7bad400), SPH_C32(0x36bb0000), SPH_C32(0x78910000), + SPH_C32(0x34780000), SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), + SPH_C32(0xfadcfe71), SPH_C32(0x1ff06c8d), SPH_C32(0x7d6cc000), + SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), SPH_C32(0x63360000), + SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), SPH_C32(0x985003c4), + SPH_C32(0xd816a946) }, + { SPH_C32(0x6ed1d430), SPH_C32(0xd19e0000), SPH_C32(0x57150000), + SPH_C32(0x12370000), SPH_C32(0x86bd4801), SPH_C32(0x0a90fcf4), + SPH_C32(0xaa4397f5), SPH_C32(0x8199c3e5), SPH_C32(0x5b0cc240), + SPH_C32(0x53d20000), SPH_C32(0x45b70000), SPH_C32(0x2c300000), + SPH_C32(0x2e1a4e00), SPH_C32(0xeb9eb76a), SPH_C32(0xaedb6011), + SPH_C32(0xd4305b24) }, + { SPH_C32(0xb3e0e800), SPH_C32(0x8f520000), SPH_C32(0x19b60000), + SPH_C32(0xc5190000), SPH_C32(0x40b52e94), SPH_C32(0xd72530bb), + SPH_C32(0xbd759951), SPH_C32(0xfe7e4848), SPH_C32(0x5e0bd400), + SPH_C32(0x46b30000), SPH_C32(0xc35a0000), SPH_C32(0x98430000), + SPH_C32(0xceb10d9a), SPH_C32(0x3ac156ed), SPH_C32(0x9a9409fb), + SPH_C32(0x04324f59) }, + { SPH_C32(0x7a8be830), SPH_C32(0x68770000), SPH_C32(0x36320000), + SPH_C32(0xe3560000), SPH_C32(0x48dc756d), SPH_C32(0xbad9c18c), + SPH_C32(0xedeaf0d5), SPH_C32(0x6017e720), SPH_C32(0x786bd640), + SPH_C32(0x9b6b0000), SPH_C32(0xb1700000), SPH_C32(0xd7450000), + SPH_C32(0x5dd76a65), SPH_C32(0x13381223), SPH_C32(0xac1f6a2e), + SPH_C32(0x0814bd3b) }, + { SPH_C32(0x84ddc000), SPH_C32(0xfe020000), SPH_C32(0x8c560000), + SPH_C32(0xcf0d0000), SPH_C32(0xfd19379d), SPH_C32(0x9fcaa88a), + SPH_C32(0xf818f44e), SPH_C32(0xc3d48a92), SPH_C32(0x4a51e800), + SPH_C32(0xff5a0000), SPH_C32(0xa27d0000), SPH_C32(0x69220000), + SPH_C32(0x00d030f6), SPH_C32(0x8a886b95), SPH_C32(0xdd3d6edb), + SPH_C32(0xe5bc6b9c) }, + { SPH_C32(0x4db6c030), SPH_C32(0x19270000), SPH_C32(0xa3d20000), + SPH_C32(0xe9420000), SPH_C32(0xf5706c64), SPH_C32(0xf23659bd), + SPH_C32(0xa8879dca), SPH_C32(0x5dbd25fa), SPH_C32(0x6c31ea40), + SPH_C32(0x22820000), SPH_C32(0xd0570000), SPH_C32(0x26240000), + SPH_C32(0x93b65709), SPH_C32(0xa3712f5b), SPH_C32(0xebb60d0e), + SPH_C32(0xe99a99fe) }, + { SPH_C32(0x9087fc00), SPH_C32(0x47eb0000), SPH_C32(0xed710000), + SPH_C32(0x3e6c0000), SPH_C32(0x33780af1), SPH_C32(0x2f8395f2), + SPH_C32(0xbfb1936e), SPH_C32(0x225aae57), SPH_C32(0x6936fc00), + SPH_C32(0x37e30000), SPH_C32(0x56ba0000), SPH_C32(0x92570000), + SPH_C32(0x731d1493), SPH_C32(0x722ecedc), SPH_C32(0xdff964e4), + SPH_C32(0x39988d83) }, + { SPH_C32(0x59ecfc30), SPH_C32(0xa0ce0000), SPH_C32(0xc2f50000), + SPH_C32(0x18230000), SPH_C32(0x3b115108), SPH_C32(0x427f64c5), + SPH_C32(0xef2efaea), SPH_C32(0xbc33013f), SPH_C32(0x4f56fe40), + SPH_C32(0xea3b0000), SPH_C32(0x24900000), SPH_C32(0xdd510000), + SPH_C32(0xe07b736c), SPH_C32(0x5bd78a12), SPH_C32(0xe9720731), + SPH_C32(0x35be7fe1) } +}; + +static const sph_u32 T512_7[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xf7750009), SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), + SPH_C32(0x04920000), SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), + SPH_C32(0x7a87f14e), SPH_C32(0x9e16981a), SPH_C32(0xd46a0000), + SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), SPH_C32(0x4a290000), + SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), SPH_C32(0x98369604), + SPH_C32(0xf746c320) }, + { SPH_C32(0xd46a0000), SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), + SPH_C32(0x4a290000), SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), + SPH_C32(0x98369604), SPH_C32(0xf746c320), SPH_C32(0x231f0009), + SPH_C32(0x42f40000), SPH_C32(0x66790000), SPH_C32(0x4ebb0000), + SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), SPH_C32(0xe2b1674a), + SPH_C32(0x69505b3a) }, + { SPH_C32(0x231f0009), SPH_C32(0x42f40000), SPH_C32(0x66790000), + SPH_C32(0x4ebb0000), SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), + SPH_C32(0xe2b1674a), SPH_C32(0x69505b3a), SPH_C32(0xf7750009), + SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), SPH_C32(0x04920000), + SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), SPH_C32(0x7a87f14e), + SPH_C32(0x9e16981a) }, + { SPH_C32(0x774400f0), SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), + SPH_C32(0x34140000), SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), + SPH_C32(0x0bc3cd1e), SPH_C32(0xcf3775cb), SPH_C32(0xf46c0050), + SPH_C32(0x96180000), SPH_C32(0x14a50000), SPH_C32(0x031f0000), + SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), SPH_C32(0x9ca470d2), + SPH_C32(0x8a341574) }, + { SPH_C32(0x803100f9), SPH_C32(0x3e66c000), SPH_C32(0x36640000), + SPH_C32(0x30860000), SPH_C32(0x8ba26725), SPH_C32(0xa263da9f), + SPH_C32(0x71443c50), SPH_C32(0x5121edd1), SPH_C32(0x20060050), + SPH_C32(0x1bd0c000), SPH_C32(0xb10a0000), SPH_C32(0x49360000), + SPH_C32(0xbeda3cc2), SPH_C32(0xaf0bf875), SPH_C32(0x0492e6d6), + SPH_C32(0x7d72d654) }, + { SPH_C32(0xa32e00f0), SPH_C32(0x7c92c000), SPH_C32(0x501d0000), + SPH_C32(0x7e3d0000), SPH_C32(0x75793cf6), SPH_C32(0x933f6a49), + SPH_C32(0x93f55b1a), SPH_C32(0x3871b6eb), SPH_C32(0xd7730059), + SPH_C32(0xd4ec0000), SPH_C32(0x72dc0000), SPH_C32(0x4da40000), + SPH_C32(0xbc4f256b), SPH_C32(0x57e3cecf), SPH_C32(0x7e151798), + SPH_C32(0xe3644e4e) }, + { SPH_C32(0x545b00f9), SPH_C32(0xb3ae0000), SPH_C32(0x93cb0000), + SPH_C32(0x7aaf0000), SPH_C32(0x77ec255f), SPH_C32(0x6bd75cf3), + SPH_C32(0xe972aa54), SPH_C32(0xa6672ef1), SPH_C32(0x03190059), + SPH_C32(0x5924c000), SPH_C32(0xd7730000), SPH_C32(0x078d0000), + SPH_C32(0x40016711), SPH_C32(0x9e5748a3), SPH_C32(0xe623819c), + SPH_C32(0x14228d6e) }, + { SPH_C32(0xf46c0050), SPH_C32(0x96180000), SPH_C32(0x14a50000), + SPH_C32(0x031f0000), SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), + SPH_C32(0x9ca470d2), SPH_C32(0x8a341574), SPH_C32(0x832800a0), + SPH_C32(0x67420000), SPH_C32(0xe1170000), SPH_C32(0x370b0000), + SPH_C32(0xcba30034), SPH_C32(0x3c34923c), SPH_C32(0x9767bdcc), + SPH_C32(0x450360bf) }, + { SPH_C32(0x03190059), SPH_C32(0x5924c000), SPH_C32(0xd7730000), + SPH_C32(0x078d0000), SPH_C32(0x40016711), SPH_C32(0x9e5748a3), + SPH_C32(0xe623819c), SPH_C32(0x14228d6e), SPH_C32(0x574200a0), + SPH_C32(0xea8ac000), SPH_C32(0x44b80000), SPH_C32(0x7d220000), + SPH_C32(0x37ed424e), SPH_C32(0xf5801450), SPH_C32(0x0f512bc8), + SPH_C32(0xb245a39f) }, + { SPH_C32(0x20060050), SPH_C32(0x1bd0c000), SPH_C32(0xb10a0000), + SPH_C32(0x49360000), SPH_C32(0xbeda3cc2), SPH_C32(0xaf0bf875), + SPH_C32(0x0492e6d6), SPH_C32(0x7d72d654), SPH_C32(0xa03700a9), + SPH_C32(0x25b60000), SPH_C32(0x876e0000), SPH_C32(0x79b00000), + SPH_C32(0x35785be7), SPH_C32(0x0d6822ea), SPH_C32(0x75d6da86), + SPH_C32(0x2c533b85) }, + { SPH_C32(0xd7730059), SPH_C32(0xd4ec0000), SPH_C32(0x72dc0000), + SPH_C32(0x4da40000), SPH_C32(0xbc4f256b), SPH_C32(0x57e3cecf), + SPH_C32(0x7e151798), SPH_C32(0xe3644e4e), SPH_C32(0x745d00a9), + SPH_C32(0xa87ec000), SPH_C32(0x22c10000), SPH_C32(0x33990000), + SPH_C32(0xc936199d), SPH_C32(0xc4dca486), SPH_C32(0xede04c82), + SPH_C32(0xdb15f8a5) }, + { SPH_C32(0x832800a0), SPH_C32(0x67420000), SPH_C32(0xe1170000), + SPH_C32(0x370b0000), SPH_C32(0xcba30034), SPH_C32(0x3c34923c), + SPH_C32(0x9767bdcc), SPH_C32(0x450360bf), SPH_C32(0x774400f0), + SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), SPH_C32(0x34140000), + SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), SPH_C32(0x0bc3cd1e), + SPH_C32(0xcf3775cb) }, + { SPH_C32(0x745d00a9), SPH_C32(0xa87ec000), SPH_C32(0x22c10000), + SPH_C32(0x33990000), SPH_C32(0xc936199d), SPH_C32(0xc4dca486), + SPH_C32(0xede04c82), SPH_C32(0xdb15f8a5), SPH_C32(0xa32e00f0), + SPH_C32(0x7c92c000), SPH_C32(0x501d0000), SPH_C32(0x7e3d0000), + SPH_C32(0x75793cf6), SPH_C32(0x933f6a49), SPH_C32(0x93f55b1a), + SPH_C32(0x3871b6eb) }, + { SPH_C32(0x574200a0), SPH_C32(0xea8ac000), SPH_C32(0x44b80000), + SPH_C32(0x7d220000), SPH_C32(0x37ed424e), SPH_C32(0xf5801450), + SPH_C32(0x0f512bc8), SPH_C32(0xb245a39f), SPH_C32(0x545b00f9), + SPH_C32(0xb3ae0000), SPH_C32(0x93cb0000), SPH_C32(0x7aaf0000), + SPH_C32(0x77ec255f), SPH_C32(0x6bd75cf3), SPH_C32(0xe972aa54), + SPH_C32(0xa6672ef1) }, + { SPH_C32(0xa03700a9), SPH_C32(0x25b60000), SPH_C32(0x876e0000), + SPH_C32(0x79b00000), SPH_C32(0x35785be7), SPH_C32(0x0d6822ea), + SPH_C32(0x75d6da86), SPH_C32(0x2c533b85), SPH_C32(0x803100f9), + SPH_C32(0x3e66c000), SPH_C32(0x36640000), SPH_C32(0x30860000), + SPH_C32(0x8ba26725), SPH_C32(0xa263da9f), SPH_C32(0x71443c50), + SPH_C32(0x5121edd1) }, + { SPH_C32(0xe8870170), SPH_C32(0x9d720000), SPH_C32(0x12db0000), + SPH_C32(0xd4220000), SPH_C32(0xf2886b27), SPH_C32(0xa921e543), + SPH_C32(0x4ef8b518), SPH_C32(0x618813b1), SPH_C32(0xb4370060), + SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), SPH_C32(0x5cae0000), + SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), SPH_C32(0x1b365f3d), + SPH_C32(0xf3d45758) }, + { SPH_C32(0x1ff20179), SPH_C32(0x524ec000), SPH_C32(0xd10d0000), + SPH_C32(0xd0b00000), SPH_C32(0xf01d728e), SPH_C32(0x51c9d3f9), + SPH_C32(0x347f4456), SPH_C32(0xff9e8bab), SPH_C32(0x605d0060), + SPH_C32(0x8184c000), SPH_C32(0xf36d0000), SPH_C32(0x16870000), + SPH_C32(0x681a5d45), SPH_C32(0xf28a7e49), SPH_C32(0x8300c939), + SPH_C32(0x04929478) }, + { SPH_C32(0x3ced0170), SPH_C32(0x10bac000), SPH_C32(0xb7740000), + SPH_C32(0x9e0b0000), SPH_C32(0x0ec6295d), SPH_C32(0x6095632f), + SPH_C32(0xd6ce231c), SPH_C32(0x96ced091), SPH_C32(0x97280069), + SPH_C32(0x4eb80000), SPH_C32(0x30bb0000), SPH_C32(0x12150000), + SPH_C32(0x6a8f44ec), SPH_C32(0x0a6248f3), SPH_C32(0xf9873877), + SPH_C32(0x9a840c62) }, + { SPH_C32(0xcb980179), SPH_C32(0xdf860000), SPH_C32(0x74a20000), + SPH_C32(0x9a990000), SPH_C32(0x0c5330f4), SPH_C32(0x987d5595), + SPH_C32(0xac49d252), SPH_C32(0x08d8488b), SPH_C32(0x43420069), + SPH_C32(0xc370c000), SPH_C32(0x95140000), SPH_C32(0x583c0000), + SPH_C32(0x96c10696), SPH_C32(0xc3d6ce9f), SPH_C32(0x61b1ae73), + SPH_C32(0x6dc2cf42) }, + { SPH_C32(0x9fc30180), SPH_C32(0x6c280000), SPH_C32(0xe7690000), + SPH_C32(0xe0360000), SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), + SPH_C32(0x453b7806), SPH_C32(0xaebf667a), SPH_C32(0x405b0030), + SPH_C32(0x9a540000), SPH_C32(0x42670000), SPH_C32(0x5fb10000), + SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), SPH_C32(0x87922fef), + SPH_C32(0x79e0422c) }, + { SPH_C32(0x68b60189), SPH_C32(0xa314c000), SPH_C32(0x24bf0000), + SPH_C32(0xe4a40000), SPH_C32(0x792a0c02), SPH_C32(0x0b423fdc), + SPH_C32(0x3fbc8948), SPH_C32(0x30a9fe60), SPH_C32(0x94310030), + SPH_C32(0x179cc000), SPH_C32(0xe7c80000), SPH_C32(0x15980000), + SPH_C32(0x2a8e23fd), SPH_C32(0x94350050), SPH_C32(0x1fa4b9eb), + SPH_C32(0x8ea6810c) }, + { SPH_C32(0x4ba90180), SPH_C32(0xe1e0c000), SPH_C32(0x42c60000), + SPH_C32(0xaa1f0000), SPH_C32(0x87f157d1), SPH_C32(0x3a1e8f0a), + SPH_C32(0xdd0dee02), SPH_C32(0x59f9a55a), SPH_C32(0x63440039), + SPH_C32(0xd8a00000), SPH_C32(0x241e0000), SPH_C32(0x110a0000), + SPH_C32(0x281b3a54), SPH_C32(0x6cdd36ea), SPH_C32(0x652348a5), + SPH_C32(0x10b01916) }, + { SPH_C32(0xbcdc0189), SPH_C32(0x2edc0000), SPH_C32(0x81100000), + SPH_C32(0xae8d0000), SPH_C32(0x85644e78), SPH_C32(0xc2f6b9b0), + SPH_C32(0xa78a1f4c), SPH_C32(0xc7ef3d40), SPH_C32(0xb72e0039), + SPH_C32(0x5568c000), SPH_C32(0x81b10000), SPH_C32(0x5b230000), + SPH_C32(0xd455782e), SPH_C32(0xa569b086), SPH_C32(0xfd15dea1), + SPH_C32(0xe7f6da36) }, + { SPH_C32(0x1ceb0120), SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), + SPH_C32(0xd73d0000), SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), + SPH_C32(0xd25cc5ca), SPH_C32(0xebbc06c5), SPH_C32(0x371f00c0), + SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), SPH_C32(0x6ba50000), + SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), SPH_C32(0x8c51e2f1), + SPH_C32(0xb6d737e7) }, + { SPH_C32(0xeb9e0129), SPH_C32(0xc456c000), SPH_C32(0xc5a80000), + SPH_C32(0xd3af0000), SPH_C32(0xb2890c36), SPH_C32(0x3776ade0), + SPH_C32(0xa8db3484), SPH_C32(0x75aa9edf), SPH_C32(0xe37500c0), + SPH_C32(0xe6c6c000), SPH_C32(0x127a0000), SPH_C32(0x218c0000), + SPH_C32(0xa3b95d71), SPH_C32(0xcebeec75), SPH_C32(0x146774f5), + SPH_C32(0x4191f4c7) }, + { SPH_C32(0xc8810120), SPH_C32(0x86a2c000), SPH_C32(0xa3d10000), + SPH_C32(0x9d140000), SPH_C32(0x4c5257e5), SPH_C32(0x062a1d36), + SPH_C32(0x4a6a53ce), SPH_C32(0x1cfac5e5), SPH_C32(0x140000c9), + SPH_C32(0x29fa0000), SPH_C32(0xd1ac0000), SPH_C32(0x251e0000), + SPH_C32(0xa12c44d8), SPH_C32(0x3656dacf), SPH_C32(0x6ee085bb), + SPH_C32(0xdf876cdd) }, + { SPH_C32(0x3ff40129), SPH_C32(0x499e0000), SPH_C32(0x60070000), + SPH_C32(0x99860000), SPH_C32(0x4ec74e4c), SPH_C32(0xfec22b8c), + SPH_C32(0x30eda280), SPH_C32(0x82ec5dff), SPH_C32(0xc06a00c9), + SPH_C32(0xa432c000), SPH_C32(0x74030000), SPH_C32(0x6f370000), + SPH_C32(0x5d6206a2), SPH_C32(0xffe25ca3), SPH_C32(0xf6d613bf), + SPH_C32(0x28c1affd) }, + { SPH_C32(0x6baf01d0), SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), + SPH_C32(0xe3290000), SPH_C32(0x392b6b13), SPH_C32(0x9515777f), + SPH_C32(0xd99f08d4), SPH_C32(0x248b730e), SPH_C32(0xc3730090), + SPH_C32(0xfd160000), SPH_C32(0xa3700000), SPH_C32(0x68ba0000), + SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), SPH_C32(0x10f59223), + SPH_C32(0x3ce32293) }, + { SPH_C32(0x9cda01d9), SPH_C32(0x350cc000), SPH_C32(0x301a0000), + SPH_C32(0xe7bb0000), SPH_C32(0x3bbe72ba), SPH_C32(0x6dfd41c5), + SPH_C32(0xa318f99a), SPH_C32(0xba9deb14), SPH_C32(0x17190090), + SPH_C32(0x70dec000), SPH_C32(0x06df0000), SPH_C32(0x22930000), + SPH_C32(0xe12d23c9), SPH_C32(0xa801926c), SPH_C32(0x88c30427), + SPH_C32(0xcba5e1b3) }, + { SPH_C32(0xbfc501d0), SPH_C32(0x77f8c000), SPH_C32(0x56630000), + SPH_C32(0xa9000000), SPH_C32(0xc5652969), SPH_C32(0x5ca1f113), + SPH_C32(0x41a99ed0), SPH_C32(0xd3cdb02e), SPH_C32(0xe06c0099), + SPH_C32(0xbfe20000), SPH_C32(0xc5090000), SPH_C32(0x26010000), + SPH_C32(0xe3b83a60), SPH_C32(0x50e9a4d6), SPH_C32(0xf244f569), + SPH_C32(0x55b379a9) }, + { SPH_C32(0x48b001d9), SPH_C32(0xb8c40000), SPH_C32(0x95b50000), + SPH_C32(0xad920000), SPH_C32(0xc7f030c0), SPH_C32(0xa449c7a9), + SPH_C32(0x3b2e6f9e), SPH_C32(0x4ddb2834), SPH_C32(0x34060099), + SPH_C32(0x322ac000), SPH_C32(0x60a60000), SPH_C32(0x6c280000), + SPH_C32(0x1ff6781a), SPH_C32(0x995d22ba), SPH_C32(0x6a72636d), + SPH_C32(0xa2f5ba89) }, + { SPH_C32(0xb4370060), SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), + SPH_C32(0x5cae0000), SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), + SPH_C32(0x1b365f3d), SPH_C32(0xf3d45758), SPH_C32(0x5cb00110), + SPH_C32(0x913e0000), SPH_C32(0x44190000), SPH_C32(0x888c0000), + SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), SPH_C32(0x55ceea25), + SPH_C32(0x925c44e9) }, + { SPH_C32(0x43420069), SPH_C32(0xc370c000), SPH_C32(0x95140000), + SPH_C32(0x583c0000), SPH_C32(0x96c10696), SPH_C32(0xc3d6ce9f), + SPH_C32(0x61b1ae73), SPH_C32(0x6dc2cf42), SPH_C32(0x88da0110), + SPH_C32(0x1cf6c000), SPH_C32(0xe1b60000), SPH_C32(0xc2a50000), + SPH_C32(0x9a923662), SPH_C32(0x5bab9b0a), SPH_C32(0xcdf87c21), + SPH_C32(0x651a87c9) }, + { SPH_C32(0x605d0060), SPH_C32(0x8184c000), SPH_C32(0xf36d0000), + SPH_C32(0x16870000), SPH_C32(0x681a5d45), SPH_C32(0xf28a7e49), + SPH_C32(0x8300c939), SPH_C32(0x04929478), SPH_C32(0x7faf0119), + SPH_C32(0xd3ca0000), SPH_C32(0x22600000), SPH_C32(0xc6370000), + SPH_C32(0x98072fcb), SPH_C32(0xa343adb0), SPH_C32(0xb77f8d6f), + SPH_C32(0xfb0c1fd3) }, + { SPH_C32(0x97280069), SPH_C32(0x4eb80000), SPH_C32(0x30bb0000), + SPH_C32(0x12150000), SPH_C32(0x6a8f44ec), SPH_C32(0x0a6248f3), + SPH_C32(0xf9873877), SPH_C32(0x9a840c62), SPH_C32(0xabc50119), + SPH_C32(0x5e02c000), SPH_C32(0x87cf0000), SPH_C32(0x8c1e0000), + SPH_C32(0x64496db1), SPH_C32(0x6af72bdc), SPH_C32(0x2f491b6b), + SPH_C32(0x0c4adcf3) }, + { SPH_C32(0xc3730090), SPH_C32(0xfd160000), SPH_C32(0xa3700000), + SPH_C32(0x68ba0000), SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), + SPH_C32(0x10f59223), SPH_C32(0x3ce32293), SPH_C32(0xa8dc0140), + SPH_C32(0x07260000), SPH_C32(0x50bc0000), SPH_C32(0x8b930000), + SPH_C32(0x24480aa0), SPH_C32(0xf4a0637f), SPH_C32(0xc96a9af7), + SPH_C32(0x1868519d) }, + { SPH_C32(0x34060099), SPH_C32(0x322ac000), SPH_C32(0x60a60000), + SPH_C32(0x6c280000), SPH_C32(0x1ff6781a), SPH_C32(0x995d22ba), + SPH_C32(0x6a72636d), SPH_C32(0xa2f5ba89), SPH_C32(0x7cb60140), + SPH_C32(0x8aeec000), SPH_C32(0xf5130000), SPH_C32(0xc1ba0000), + SPH_C32(0xd80648da), SPH_C32(0x3d14e513), SPH_C32(0x515c0cf3), + SPH_C32(0xef2e92bd) }, + { SPH_C32(0x17190090), SPH_C32(0x70dec000), SPH_C32(0x06df0000), + SPH_C32(0x22930000), SPH_C32(0xe12d23c9), SPH_C32(0xa801926c), + SPH_C32(0x88c30427), SPH_C32(0xcba5e1b3), SPH_C32(0x8bc30149), + SPH_C32(0x45d20000), SPH_C32(0x36c50000), SPH_C32(0xc5280000), + SPH_C32(0xda935173), SPH_C32(0xc5fcd3a9), SPH_C32(0x2bdbfdbd), + SPH_C32(0x71380aa7) }, + { SPH_C32(0xe06c0099), SPH_C32(0xbfe20000), SPH_C32(0xc5090000), + SPH_C32(0x26010000), SPH_C32(0xe3b83a60), SPH_C32(0x50e9a4d6), + SPH_C32(0xf244f569), SPH_C32(0x55b379a9), SPH_C32(0x5fa90149), + SPH_C32(0xc81ac000), SPH_C32(0x936a0000), SPH_C32(0x8f010000), + SPH_C32(0x26dd1309), SPH_C32(0x0c4855c5), SPH_C32(0xb3ed6bb9), + SPH_C32(0x867ec987) }, + { SPH_C32(0x405b0030), SPH_C32(0x9a540000), SPH_C32(0x42670000), + SPH_C32(0x5fb10000), SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), + SPH_C32(0x87922fef), SPH_C32(0x79e0422c), SPH_C32(0xdf9801b0), + SPH_C32(0xf67c0000), SPH_C32(0xa50e0000), SPH_C32(0xbf870000), + SPH_C32(0xad7f742c), SPH_C32(0xae2b8f5a), SPH_C32(0xc2a957e9), + SPH_C32(0xd75f2456) }, + { SPH_C32(0xb72e0039), SPH_C32(0x5568c000), SPH_C32(0x81b10000), + SPH_C32(0x5b230000), SPH_C32(0xd455782e), SPH_C32(0xa569b086), + SPH_C32(0xfd15dea1), SPH_C32(0xe7f6da36), SPH_C32(0x0bf201b0), + SPH_C32(0x7bb4c000), SPH_C32(0x00a10000), SPH_C32(0xf5ae0000), + SPH_C32(0x51313656), SPH_C32(0x679f0936), SPH_C32(0x5a9fc1ed), + SPH_C32(0x2019e776) }, + { SPH_C32(0x94310030), SPH_C32(0x179cc000), SPH_C32(0xe7c80000), + SPH_C32(0x15980000), SPH_C32(0x2a8e23fd), SPH_C32(0x94350050), + SPH_C32(0x1fa4b9eb), SPH_C32(0x8ea6810c), SPH_C32(0xfc8701b9), + SPH_C32(0xb4880000), SPH_C32(0xc3770000), SPH_C32(0xf13c0000), + SPH_C32(0x53a42fff), SPH_C32(0x9f773f8c), SPH_C32(0x201830a3), + SPH_C32(0xbe0f7f6c) }, + { SPH_C32(0x63440039), SPH_C32(0xd8a00000), SPH_C32(0x241e0000), + SPH_C32(0x110a0000), SPH_C32(0x281b3a54), SPH_C32(0x6cdd36ea), + SPH_C32(0x652348a5), SPH_C32(0x10b01916), SPH_C32(0x28ed01b9), + SPH_C32(0x3940c000), SPH_C32(0x66d80000), SPH_C32(0xbb150000), + SPH_C32(0xafea6d85), SPH_C32(0x56c3b9e0), SPH_C32(0xb82ea6a7), + SPH_C32(0x4949bc4c) }, + { SPH_C32(0x371f00c0), SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), + SPH_C32(0x6ba50000), SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), + SPH_C32(0x8c51e2f1), SPH_C32(0xb6d737e7), SPH_C32(0x2bf401e0), + SPH_C32(0x60640000), SPH_C32(0xb1ab0000), SPH_C32(0xbc980000), + SPH_C32(0xefeb0a94), SPH_C32(0xc894f143), SPH_C32(0x5e0d273b), + SPH_C32(0x5d6b3122) }, + { SPH_C32(0xc06a00c9), SPH_C32(0xa432c000), SPH_C32(0x74030000), + SPH_C32(0x6f370000), SPH_C32(0x5d6206a2), SPH_C32(0xffe25ca3), + SPH_C32(0xf6d613bf), SPH_C32(0x28c1affd), SPH_C32(0xff9e01e0), + SPH_C32(0xedacc000), SPH_C32(0x14040000), SPH_C32(0xf6b10000), + SPH_C32(0x13a548ee), SPH_C32(0x0120772f), SPH_C32(0xc63bb13f), + SPH_C32(0xaa2df202) }, + { SPH_C32(0xe37500c0), SPH_C32(0xe6c6c000), SPH_C32(0x127a0000), + SPH_C32(0x218c0000), SPH_C32(0xa3b95d71), SPH_C32(0xcebeec75), + SPH_C32(0x146774f5), SPH_C32(0x4191f4c7), SPH_C32(0x08eb01e9), + SPH_C32(0x22900000), SPH_C32(0xd7d20000), SPH_C32(0xf2230000), + SPH_C32(0x11305147), SPH_C32(0xf9c84195), SPH_C32(0xbcbc4071), + SPH_C32(0x343b6a18) }, + { SPH_C32(0x140000c9), SPH_C32(0x29fa0000), SPH_C32(0xd1ac0000), + SPH_C32(0x251e0000), SPH_C32(0xa12c44d8), SPH_C32(0x3656dacf), + SPH_C32(0x6ee085bb), SPH_C32(0xdf876cdd), SPH_C32(0xdc8101e9), + SPH_C32(0xaf58c000), SPH_C32(0x727d0000), SPH_C32(0xb80a0000), + SPH_C32(0xed7e133d), SPH_C32(0x307cc7f9), SPH_C32(0x248ad675), + SPH_C32(0xc37da938) }, + { SPH_C32(0x5cb00110), SPH_C32(0x913e0000), SPH_C32(0x44190000), + SPH_C32(0x888c0000), SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), + SPH_C32(0x55ceea25), SPH_C32(0x925c44e9), SPH_C32(0xe8870170), + SPH_C32(0x9d720000), SPH_C32(0x12db0000), SPH_C32(0xd4220000), + SPH_C32(0xf2886b27), SPH_C32(0xa921e543), SPH_C32(0x4ef8b518), + SPH_C32(0x618813b1) }, + { SPH_C32(0xabc50119), SPH_C32(0x5e02c000), SPH_C32(0x87cf0000), + SPH_C32(0x8c1e0000), SPH_C32(0x64496db1), SPH_C32(0x6af72bdc), + SPH_C32(0x2f491b6b), SPH_C32(0x0c4adcf3), SPH_C32(0x3ced0170), + SPH_C32(0x10bac000), SPH_C32(0xb7740000), SPH_C32(0x9e0b0000), + SPH_C32(0x0ec6295d), SPH_C32(0x6095632f), SPH_C32(0xd6ce231c), + SPH_C32(0x96ced091) }, + { SPH_C32(0x88da0110), SPH_C32(0x1cf6c000), SPH_C32(0xe1b60000), + SPH_C32(0xc2a50000), SPH_C32(0x9a923662), SPH_C32(0x5bab9b0a), + SPH_C32(0xcdf87c21), SPH_C32(0x651a87c9), SPH_C32(0xcb980179), + SPH_C32(0xdf860000), SPH_C32(0x74a20000), SPH_C32(0x9a990000), + SPH_C32(0x0c5330f4), SPH_C32(0x987d5595), SPH_C32(0xac49d252), + SPH_C32(0x08d8488b) }, + { SPH_C32(0x7faf0119), SPH_C32(0xd3ca0000), SPH_C32(0x22600000), + SPH_C32(0xc6370000), SPH_C32(0x98072fcb), SPH_C32(0xa343adb0), + SPH_C32(0xb77f8d6f), SPH_C32(0xfb0c1fd3), SPH_C32(0x1ff20179), + SPH_C32(0x524ec000), SPH_C32(0xd10d0000), SPH_C32(0xd0b00000), + SPH_C32(0xf01d728e), SPH_C32(0x51c9d3f9), SPH_C32(0x347f4456), + SPH_C32(0xff9e8bab) }, + { SPH_C32(0x2bf401e0), SPH_C32(0x60640000), SPH_C32(0xb1ab0000), + SPH_C32(0xbc980000), SPH_C32(0xefeb0a94), SPH_C32(0xc894f143), + SPH_C32(0x5e0d273b), SPH_C32(0x5d6b3122), SPH_C32(0x1ceb0120), + SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), SPH_C32(0xd73d0000), + SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), SPH_C32(0xd25cc5ca), + SPH_C32(0xebbc06c5) }, + { SPH_C32(0xdc8101e9), SPH_C32(0xaf58c000), SPH_C32(0x727d0000), + SPH_C32(0xb80a0000), SPH_C32(0xed7e133d), SPH_C32(0x307cc7f9), + SPH_C32(0x248ad675), SPH_C32(0xc37da938), SPH_C32(0xc8810120), + SPH_C32(0x86a2c000), SPH_C32(0xa3d10000), SPH_C32(0x9d140000), + SPH_C32(0x4c5257e5), SPH_C32(0x062a1d36), SPH_C32(0x4a6a53ce), + SPH_C32(0x1cfac5e5) }, + { SPH_C32(0xff9e01e0), SPH_C32(0xedacc000), SPH_C32(0x14040000), + SPH_C32(0xf6b10000), SPH_C32(0x13a548ee), SPH_C32(0x0120772f), + SPH_C32(0xc63bb13f), SPH_C32(0xaa2df202), SPH_C32(0x3ff40129), + SPH_C32(0x499e0000), SPH_C32(0x60070000), SPH_C32(0x99860000), + SPH_C32(0x4ec74e4c), SPH_C32(0xfec22b8c), SPH_C32(0x30eda280), + SPH_C32(0x82ec5dff) }, + { SPH_C32(0x08eb01e9), SPH_C32(0x22900000), SPH_C32(0xd7d20000), + SPH_C32(0xf2230000), SPH_C32(0x11305147), SPH_C32(0xf9c84195), + SPH_C32(0xbcbc4071), SPH_C32(0x343b6a18), SPH_C32(0xeb9e0129), + SPH_C32(0xc456c000), SPH_C32(0xc5a80000), SPH_C32(0xd3af0000), + SPH_C32(0xb2890c36), SPH_C32(0x3776ade0), SPH_C32(0xa8db3484), + SPH_C32(0x75aa9edf) }, + { SPH_C32(0xa8dc0140), SPH_C32(0x07260000), SPH_C32(0x50bc0000), + SPH_C32(0x8b930000), SPH_C32(0x24480aa0), SPH_C32(0xf4a0637f), + SPH_C32(0xc96a9af7), SPH_C32(0x1868519d), SPH_C32(0x6baf01d0), + SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), SPH_C32(0xe3290000), + SPH_C32(0x392b6b13), SPH_C32(0x9515777f), SPH_C32(0xd99f08d4), + SPH_C32(0x248b730e) }, + { SPH_C32(0x5fa90149), SPH_C32(0xc81ac000), SPH_C32(0x936a0000), + SPH_C32(0x8f010000), SPH_C32(0x26dd1309), SPH_C32(0x0c4855c5), + SPH_C32(0xb3ed6bb9), SPH_C32(0x867ec987), SPH_C32(0xbfc501d0), + SPH_C32(0x77f8c000), SPH_C32(0x56630000), SPH_C32(0xa9000000), + SPH_C32(0xc5652969), SPH_C32(0x5ca1f113), SPH_C32(0x41a99ed0), + SPH_C32(0xd3cdb02e) }, + { SPH_C32(0x7cb60140), SPH_C32(0x8aeec000), SPH_C32(0xf5130000), + SPH_C32(0xc1ba0000), SPH_C32(0xd80648da), SPH_C32(0x3d14e513), + SPH_C32(0x515c0cf3), SPH_C32(0xef2e92bd), SPH_C32(0x48b001d9), + SPH_C32(0xb8c40000), SPH_C32(0x95b50000), SPH_C32(0xad920000), + SPH_C32(0xc7f030c0), SPH_C32(0xa449c7a9), SPH_C32(0x3b2e6f9e), + SPH_C32(0x4ddb2834) }, + { SPH_C32(0x8bc30149), SPH_C32(0x45d20000), SPH_C32(0x36c50000), + SPH_C32(0xc5280000), SPH_C32(0xda935173), SPH_C32(0xc5fcd3a9), + SPH_C32(0x2bdbfdbd), SPH_C32(0x71380aa7), SPH_C32(0x9cda01d9), + SPH_C32(0x350cc000), SPH_C32(0x301a0000), SPH_C32(0xe7bb0000), + SPH_C32(0x3bbe72ba), SPH_C32(0x6dfd41c5), SPH_C32(0xa318f99a), + SPH_C32(0xba9deb14) }, + { SPH_C32(0xdf9801b0), SPH_C32(0xf67c0000), SPH_C32(0xa50e0000), + SPH_C32(0xbf870000), SPH_C32(0xad7f742c), SPH_C32(0xae2b8f5a), + SPH_C32(0xc2a957e9), SPH_C32(0xd75f2456), SPH_C32(0x9fc30180), + SPH_C32(0x6c280000), SPH_C32(0xe7690000), SPH_C32(0xe0360000), + SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), SPH_C32(0x453b7806), + SPH_C32(0xaebf667a) }, + { SPH_C32(0x28ed01b9), SPH_C32(0x3940c000), SPH_C32(0x66d80000), + SPH_C32(0xbb150000), SPH_C32(0xafea6d85), SPH_C32(0x56c3b9e0), + SPH_C32(0xb82ea6a7), SPH_C32(0x4949bc4c), SPH_C32(0x4ba90180), + SPH_C32(0xe1e0c000), SPH_C32(0x42c60000), SPH_C32(0xaa1f0000), + SPH_C32(0x87f157d1), SPH_C32(0x3a1e8f0a), SPH_C32(0xdd0dee02), + SPH_C32(0x59f9a55a) }, + { SPH_C32(0x0bf201b0), SPH_C32(0x7bb4c000), SPH_C32(0x00a10000), + SPH_C32(0xf5ae0000), SPH_C32(0x51313656), SPH_C32(0x679f0936), + SPH_C32(0x5a9fc1ed), SPH_C32(0x2019e776), SPH_C32(0xbcdc0189), + SPH_C32(0x2edc0000), SPH_C32(0x81100000), SPH_C32(0xae8d0000), + SPH_C32(0x85644e78), SPH_C32(0xc2f6b9b0), SPH_C32(0xa78a1f4c), + SPH_C32(0xc7ef3d40) }, + { SPH_C32(0xfc8701b9), SPH_C32(0xb4880000), SPH_C32(0xc3770000), + SPH_C32(0xf13c0000), SPH_C32(0x53a42fff), SPH_C32(0x9f773f8c), + SPH_C32(0x201830a3), SPH_C32(0xbe0f7f6c), SPH_C32(0x68b60189), + SPH_C32(0xa314c000), SPH_C32(0x24bf0000), SPH_C32(0xe4a40000), + SPH_C32(0x792a0c02), SPH_C32(0x0b423fdc), SPH_C32(0x3fbc8948), + SPH_C32(0x30a9fe60) }, + { SPH_C32(0xef0b0270), SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), + SPH_C32(0x69490000), SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), + SPH_C32(0x66140a51), SPH_C32(0x924f5d0a), SPH_C32(0xc96b0030), + SPH_C32(0xe7250000), SPH_C32(0x2f840000), SPH_C32(0x264f0000), + SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), SPH_C32(0x509f6984), + SPH_C32(0x9e69af68) }, + { SPH_C32(0x187e0279), SPH_C32(0xf5c1c000), SPH_C32(0x9e780000), + SPH_C32(0x6ddb0000), SPH_C32(0x999a25af), SPH_C32(0xbced8343), + SPH_C32(0x1c93fb1f), SPH_C32(0x0c59c510), SPH_C32(0x1d010030), + SPH_C32(0x6aedc000), SPH_C32(0x8a2b0000), SPH_C32(0x6c660000), + SPH_C32(0xf4271983), SPH_C32(0xa448775b), SPH_C32(0xc8a9ff80), + SPH_C32(0x692f6c48) }, + { SPH_C32(0x3b610270), SPH_C32(0xb735c000), SPH_C32(0xf8010000), + SPH_C32(0x23600000), SPH_C32(0x67417e7c), SPH_C32(0x8db13395), + SPH_C32(0xfe229c55), SPH_C32(0x65099e2a), SPH_C32(0xea740039), + SPH_C32(0xa5d10000), SPH_C32(0x49fd0000), SPH_C32(0x68f40000), + SPH_C32(0xf6b2002a), SPH_C32(0x5ca041e1), SPH_C32(0xb22e0ece), + SPH_C32(0xf739f452) }, + { SPH_C32(0xcc140279), SPH_C32(0x78090000), SPH_C32(0x3bd70000), + SPH_C32(0x27f20000), SPH_C32(0x65d467d5), SPH_C32(0x7559052f), + SPH_C32(0x84a56d1b), SPH_C32(0xfb1f0630), SPH_C32(0x3e1e0039), + SPH_C32(0x2819c000), SPH_C32(0xec520000), SPH_C32(0x22dd0000), + SPH_C32(0x0afc4250), SPH_C32(0x9514c78d), SPH_C32(0x2a1898ca), + SPH_C32(0x007f3772) }, + { SPH_C32(0x984f0280), SPH_C32(0xcba70000), SPH_C32(0xa81c0000), + SPH_C32(0x5d5d0000), SPH_C32(0x1238428a), SPH_C32(0x1e8e59dc), + SPH_C32(0x6dd7c74f), SPH_C32(0x5d7828c1), SPH_C32(0x3d070060), + SPH_C32(0x713d0000), SPH_C32(0x3b210000), SPH_C32(0x25500000), + SPH_C32(0x4afd2541), SPH_C32(0x0b438f2e), SPH_C32(0xcc3b1956), + SPH_C32(0x145dba1c) }, + { SPH_C32(0x6f3a0289), SPH_C32(0x049bc000), SPH_C32(0x6bca0000), + SPH_C32(0x59cf0000), SPH_C32(0x10ad5b23), SPH_C32(0xe6666f66), + SPH_C32(0x17503601), SPH_C32(0xc36eb0db), SPH_C32(0xe96d0060), + SPH_C32(0xfcf5c000), SPH_C32(0x9e8e0000), SPH_C32(0x6f790000), + SPH_C32(0xb6b3673b), SPH_C32(0xc2f70942), SPH_C32(0x540d8f52), + SPH_C32(0xe31b793c) }, + { SPH_C32(0x4c250280), SPH_C32(0x466fc000), SPH_C32(0x0db30000), + SPH_C32(0x17740000), SPH_C32(0xee7600f0), SPH_C32(0xd73adfb0), + SPH_C32(0xf5e1514b), SPH_C32(0xaa3eebe1), SPH_C32(0x1e180069), + SPH_C32(0x33c90000), SPH_C32(0x5d580000), SPH_C32(0x6beb0000), + SPH_C32(0xb4267e92), SPH_C32(0x3a1f3ff8), SPH_C32(0x2e8a7e1c), + SPH_C32(0x7d0de126) }, + { SPH_C32(0xbb500289), SPH_C32(0x89530000), SPH_C32(0xce650000), + SPH_C32(0x13e60000), SPH_C32(0xece31959), SPH_C32(0x2fd2e90a), + SPH_C32(0x8f66a005), SPH_C32(0x342873fb), SPH_C32(0xca720069), + SPH_C32(0xbe01c000), SPH_C32(0xf8f70000), SPH_C32(0x21c20000), + SPH_C32(0x48683ce8), SPH_C32(0xf3abb994), SPH_C32(0xb6bce818), + SPH_C32(0x8a4b2206) }, + { SPH_C32(0x1b670220), SPH_C32(0xace50000), SPH_C32(0x490b0000), + SPH_C32(0x6a560000), SPH_C32(0xd99b42be), SPH_C32(0x22bacbe0), + SPH_C32(0xfab07a83), SPH_C32(0x187b487e), SPH_C32(0x4a430090), + SPH_C32(0x80670000), SPH_C32(0xce930000), SPH_C32(0x11440000), + SPH_C32(0xc3ca5bcd), SPH_C32(0x51c8630b), SPH_C32(0xc7f8d448), + SPH_C32(0xdb6acfd7) }, + { SPH_C32(0xec120229), SPH_C32(0x63d9c000), SPH_C32(0x8add0000), + SPH_C32(0x6ec40000), SPH_C32(0xdb0e5b17), SPH_C32(0xda52fd5a), + SPH_C32(0x80378bcd), SPH_C32(0x866dd064), SPH_C32(0x9e290090), + SPH_C32(0x0dafc000), SPH_C32(0x6b3c0000), SPH_C32(0x5b6d0000), + SPH_C32(0x3f8419b7), SPH_C32(0x987ce567), SPH_C32(0x5fce424c), + SPH_C32(0x2c2c0cf7) }, + { SPH_C32(0xcf0d0220), SPH_C32(0x212dc000), SPH_C32(0xeca40000), + SPH_C32(0x207f0000), SPH_C32(0x25d500c4), SPH_C32(0xeb0e4d8c), + SPH_C32(0x6286ec87), SPH_C32(0xef3d8b5e), SPH_C32(0x695c0099), + SPH_C32(0xc2930000), SPH_C32(0xa8ea0000), SPH_C32(0x5fff0000), + SPH_C32(0x3d11001e), SPH_C32(0x6094d3dd), SPH_C32(0x2549b302), + SPH_C32(0xb23a94ed) }, + { SPH_C32(0x38780229), SPH_C32(0xee110000), SPH_C32(0x2f720000), + SPH_C32(0x24ed0000), SPH_C32(0x2740196d), SPH_C32(0x13e67b36), + SPH_C32(0x18011dc9), SPH_C32(0x712b1344), SPH_C32(0xbd360099), + SPH_C32(0x4f5bc000), SPH_C32(0x0d450000), SPH_C32(0x15d60000), + SPH_C32(0xc15f4264), SPH_C32(0xa92055b1), SPH_C32(0xbd7f2506), + SPH_C32(0x457c57cd) }, + { SPH_C32(0x6c2302d0), SPH_C32(0x5dbf0000), SPH_C32(0xbcb90000), + SPH_C32(0x5e420000), SPH_C32(0x50ac3c32), SPH_C32(0x783127c5), + SPH_C32(0xf173b79d), SPH_C32(0xd74c3db5), SPH_C32(0xbe2f00c0), + SPH_C32(0x167f0000), SPH_C32(0xda360000), SPH_C32(0x125b0000), + SPH_C32(0x815e2575), SPH_C32(0x37771d12), SPH_C32(0x5b5ca49a), + SPH_C32(0x515edaa3) }, + { SPH_C32(0x9b5602d9), SPH_C32(0x9283c000), SPH_C32(0x7f6f0000), + SPH_C32(0x5ad00000), SPH_C32(0x5239259b), SPH_C32(0x80d9117f), + SPH_C32(0x8bf446d3), SPH_C32(0x495aa5af), SPH_C32(0x6a4500c0), + SPH_C32(0x9bb7c000), SPH_C32(0x7f990000), SPH_C32(0x58720000), + SPH_C32(0x7d10670f), SPH_C32(0xfec39b7e), SPH_C32(0xc36a329e), + SPH_C32(0xa6181983) }, + { SPH_C32(0xb84902d0), SPH_C32(0xd077c000), SPH_C32(0x19160000), + SPH_C32(0x146b0000), SPH_C32(0xace27e48), SPH_C32(0xb185a1a9), + SPH_C32(0x69452199), SPH_C32(0x200afe95), SPH_C32(0x9d3000c9), + SPH_C32(0x548b0000), SPH_C32(0xbc4f0000), SPH_C32(0x5ce00000), + SPH_C32(0x7f857ea6), SPH_C32(0x062badc4), SPH_C32(0xb9edc3d0), + SPH_C32(0x380e8199) }, + { SPH_C32(0x4f3c02d9), SPH_C32(0x1f4b0000), SPH_C32(0xdac00000), + SPH_C32(0x10f90000), SPH_C32(0xae7767e1), SPH_C32(0x496d9713), + SPH_C32(0x13c2d0d7), SPH_C32(0xbe1c668f), SPH_C32(0x495a00c9), + SPH_C32(0xd943c000), SPH_C32(0x19e00000), SPH_C32(0x16c90000), + SPH_C32(0x83cb3cdc), SPH_C32(0xcf9f2ba8), SPH_C32(0x21db55d4), + SPH_C32(0xcf4842b9) }, + { SPH_C32(0x078c0300), SPH_C32(0xa78f0000), SPH_C32(0x4f750000), + SPH_C32(0xbd6b0000), SPH_C32(0x69875721), SPH_C32(0xed2450ba), + SPH_C32(0x28ecbf49), SPH_C32(0xf3c74ebb), SPH_C32(0x7d5c0050), + SPH_C32(0xeb690000), SPH_C32(0x79460000), SPH_C32(0x7ae10000), + SPH_C32(0x9c3d44c6), SPH_C32(0x56c20912), SPH_C32(0x4ba936b9), + SPH_C32(0x6dbdf830) }, + { SPH_C32(0xf0f90309), SPH_C32(0x68b3c000), SPH_C32(0x8ca30000), + SPH_C32(0xb9f90000), SPH_C32(0x6b124e88), SPH_C32(0x15cc6600), + SPH_C32(0x526b4e07), SPH_C32(0x6dd1d6a1), SPH_C32(0xa9360050), + SPH_C32(0x66a1c000), SPH_C32(0xdce90000), SPH_C32(0x30c80000), + SPH_C32(0x607306bc), SPH_C32(0x9f768f7e), SPH_C32(0xd39fa0bd), + SPH_C32(0x9afb3b10) }, + { SPH_C32(0xd3e60300), SPH_C32(0x2a47c000), SPH_C32(0xeada0000), + SPH_C32(0xf7420000), SPH_C32(0x95c9155b), SPH_C32(0x2490d6d6), + SPH_C32(0xb0da294d), SPH_C32(0x04818d9b), SPH_C32(0x5e430059), + SPH_C32(0xa99d0000), SPH_C32(0x1f3f0000), SPH_C32(0x345a0000), + SPH_C32(0x62e61f15), SPH_C32(0x679eb9c4), SPH_C32(0xa91851f3), + SPH_C32(0x04eda30a) }, + { SPH_C32(0x24930309), SPH_C32(0xe57b0000), SPH_C32(0x290c0000), + SPH_C32(0xf3d00000), SPH_C32(0x975c0cf2), SPH_C32(0xdc78e06c), + SPH_C32(0xca5dd803), SPH_C32(0x9a971581), SPH_C32(0x8a290059), + SPH_C32(0x2455c000), SPH_C32(0xba900000), SPH_C32(0x7e730000), + SPH_C32(0x9ea85d6f), SPH_C32(0xae2a3fa8), SPH_C32(0x312ec7f7), + SPH_C32(0xf3ab602a) }, + { SPH_C32(0x70c803f0), SPH_C32(0x56d50000), SPH_C32(0xbac70000), + SPH_C32(0x897f0000), SPH_C32(0xe0b029ad), SPH_C32(0xb7afbc9f), + SPH_C32(0x232f7257), SPH_C32(0x3cf03b70), SPH_C32(0x89300000), + SPH_C32(0x7d710000), SPH_C32(0x6de30000), SPH_C32(0x79fe0000), + SPH_C32(0xdea93a7e), SPH_C32(0x307d770b), SPH_C32(0xd70d466b), + SPH_C32(0xe789ed44) }, + { SPH_C32(0x87bd03f9), SPH_C32(0x99e9c000), SPH_C32(0x79110000), + SPH_C32(0x8ded0000), SPH_C32(0xe2253004), SPH_C32(0x4f478a25), + SPH_C32(0x59a88319), SPH_C32(0xa2e6a36a), SPH_C32(0x5d5a0000), + SPH_C32(0xf0b9c000), SPH_C32(0xc84c0000), SPH_C32(0x33d70000), + SPH_C32(0x22e77804), SPH_C32(0xf9c9f167), SPH_C32(0x4f3bd06f), + SPH_C32(0x10cf2e64) }, + { SPH_C32(0xa4a203f0), SPH_C32(0xdb1dc000), SPH_C32(0x1f680000), + SPH_C32(0xc3560000), SPH_C32(0x1cfe6bd7), SPH_C32(0x7e1b3af3), + SPH_C32(0xbb19e453), SPH_C32(0xcbb6f850), SPH_C32(0xaa2f0009), + SPH_C32(0x3f850000), SPH_C32(0x0b9a0000), SPH_C32(0x37450000), + SPH_C32(0x207261ad), SPH_C32(0x0121c7dd), SPH_C32(0x35bc2121), + SPH_C32(0x8ed9b67e) }, + { SPH_C32(0x53d703f9), SPH_C32(0x14210000), SPH_C32(0xdcbe0000), + SPH_C32(0xc7c40000), SPH_C32(0x1e6b727e), SPH_C32(0x86f30c49), + SPH_C32(0xc19e151d), SPH_C32(0x55a0604a), SPH_C32(0x7e450009), + SPH_C32(0xb24dc000), SPH_C32(0xae350000), SPH_C32(0x7d6c0000), + SPH_C32(0xdc3c23d7), SPH_C32(0xc89541b1), SPH_C32(0xad8ab725), + SPH_C32(0x799f755e) }, + { SPH_C32(0xf3e00350), SPH_C32(0x31970000), SPH_C32(0x5bd00000), + SPH_C32(0xbe740000), SPH_C32(0x2b132999), SPH_C32(0x8b9b2ea3), + SPH_C32(0xb448cf9b), SPH_C32(0x79f35bcf), SPH_C32(0xfe7400f0), + SPH_C32(0x8c2b0000), SPH_C32(0x98510000), SPH_C32(0x4dea0000), + SPH_C32(0x579e44f2), SPH_C32(0x6af69b2e), SPH_C32(0xdcce8b75), + SPH_C32(0x28be988f) }, + { SPH_C32(0x04950359), SPH_C32(0xfeabc000), SPH_C32(0x98060000), + SPH_C32(0xbae60000), SPH_C32(0x29863030), SPH_C32(0x73731819), + SPH_C32(0xcecf3ed5), SPH_C32(0xe7e5c3d5), SPH_C32(0x2a1e00f0), + SPH_C32(0x01e3c000), SPH_C32(0x3dfe0000), SPH_C32(0x07c30000), + SPH_C32(0xabd00688), SPH_C32(0xa3421d42), SPH_C32(0x44f81d71), + SPH_C32(0xdff85baf) }, + { SPH_C32(0x278a0350), SPH_C32(0xbc5fc000), SPH_C32(0xfe7f0000), + SPH_C32(0xf45d0000), SPH_C32(0xd75d6be3), SPH_C32(0x422fa8cf), + SPH_C32(0x2c7e599f), SPH_C32(0x8eb598ef), SPH_C32(0xdd6b00f9), + SPH_C32(0xcedf0000), SPH_C32(0xfe280000), SPH_C32(0x03510000), + SPH_C32(0xa9451f21), SPH_C32(0x5baa2bf8), SPH_C32(0x3e7fec3f), + SPH_C32(0x41eec3b5) }, + { SPH_C32(0xd0ff0359), SPH_C32(0x73630000), SPH_C32(0x3da90000), + SPH_C32(0xf0cf0000), SPH_C32(0xd5c8724a), SPH_C32(0xbac79e75), + SPH_C32(0x56f9a8d1), SPH_C32(0x10a300f5), SPH_C32(0x090100f9), + SPH_C32(0x4317c000), SPH_C32(0x5b870000), SPH_C32(0x49780000), + SPH_C32(0x550b5d5b), SPH_C32(0x921ead94), SPH_C32(0xa6497a3b), + SPH_C32(0xb6a80095) }, + { SPH_C32(0x84a403a0), SPH_C32(0xc0cd0000), SPH_C32(0xae620000), + SPH_C32(0x8a600000), SPH_C32(0xa2245715), SPH_C32(0xd110c286), + SPH_C32(0xbf8b0285), SPH_C32(0xb6c42e04), SPH_C32(0x0a1800a0), + SPH_C32(0x1a330000), SPH_C32(0x8cf40000), SPH_C32(0x4ef50000), + SPH_C32(0x150a3a4a), SPH_C32(0x0c49e537), SPH_C32(0x406afba7), + SPH_C32(0xa28a8dfb) }, + { SPH_C32(0x73d103a9), SPH_C32(0x0ff1c000), SPH_C32(0x6db40000), + SPH_C32(0x8ef20000), SPH_C32(0xa0b14ebc), SPH_C32(0x29f8f43c), + SPH_C32(0xc50cf3cb), SPH_C32(0x28d2b61e), SPH_C32(0xde7200a0), + SPH_C32(0x97fbc000), SPH_C32(0x295b0000), SPH_C32(0x04dc0000), + SPH_C32(0xe9447830), SPH_C32(0xc5fd635b), SPH_C32(0xd85c6da3), + SPH_C32(0x55cc4edb) }, + { SPH_C32(0x50ce03a0), SPH_C32(0x4d05c000), SPH_C32(0x0bcd0000), + SPH_C32(0xc0490000), SPH_C32(0x5e6a156f), SPH_C32(0x18a444ea), + SPH_C32(0x27bd9481), SPH_C32(0x4182ed24), SPH_C32(0x290700a9), + SPH_C32(0x58c70000), SPH_C32(0xea8d0000), SPH_C32(0x004e0000), + SPH_C32(0xebd16199), SPH_C32(0x3d1555e1), SPH_C32(0xa2db9ced), + SPH_C32(0xcbdad6c1) }, + { SPH_C32(0xa7bb03a9), SPH_C32(0x82390000), SPH_C32(0xc81b0000), + SPH_C32(0xc4db0000), SPH_C32(0x5cff0cc6), SPH_C32(0xe04c7250), + SPH_C32(0x5d3a65cf), SPH_C32(0xdf94753e), SPH_C32(0xfd6d00a9), + SPH_C32(0xd50fc000), SPH_C32(0x4f220000), SPH_C32(0x4a670000), + SPH_C32(0x179f23e3), SPH_C32(0xf4a1d38d), SPH_C32(0x3aed0ae9), + SPH_C32(0x3c9c15e1) }, + { SPH_C32(0x5b3c0210), SPH_C32(0x36b10000), SPH_C32(0x0b6c0000), + SPH_C32(0x35e70000), SPH_C32(0x0f5b2339), SPH_C32(0x7f3b4ddc), + SPH_C32(0x7d22556c), SPH_C32(0x619b0a52), SPH_C32(0x95db0120), + SPH_C32(0x761b0000), SPH_C32(0x6b9d0000), SPH_C32(0xaec30000), + SPH_C32(0x6eb52fe1), SPH_C32(0xffe3ec51), SPH_C32(0x055183a1), + SPH_C32(0x0c35eb81) }, + { SPH_C32(0xac490219), SPH_C32(0xf98dc000), SPH_C32(0xc8ba0000), + SPH_C32(0x31750000), SPH_C32(0x0dce3a90), SPH_C32(0x87d37b66), + SPH_C32(0x07a5a422), SPH_C32(0xff8d9248), SPH_C32(0x41b10120), + SPH_C32(0xfbd3c000), SPH_C32(0xce320000), SPH_C32(0xe4ea0000), + SPH_C32(0x92fb6d9b), SPH_C32(0x36576a3d), SPH_C32(0x9d6715a5), + SPH_C32(0xfb7328a1) }, + { SPH_C32(0x8f560210), SPH_C32(0xbb79c000), SPH_C32(0xaec30000), + SPH_C32(0x7fce0000), SPH_C32(0xf3156143), SPH_C32(0xb68fcbb0), + SPH_C32(0xe514c368), SPH_C32(0x96ddc972), SPH_C32(0xb6c40129), + SPH_C32(0x34ef0000), SPH_C32(0x0de40000), SPH_C32(0xe0780000), + SPH_C32(0x906e7432), SPH_C32(0xcebf5c87), SPH_C32(0xe7e0e4eb), + SPH_C32(0x6565b0bb) }, + { SPH_C32(0x78230219), SPH_C32(0x74450000), SPH_C32(0x6d150000), + SPH_C32(0x7b5c0000), SPH_C32(0xf18078ea), SPH_C32(0x4e67fd0a), + SPH_C32(0x9f933226), SPH_C32(0x08cb5168), SPH_C32(0x62ae0129), + SPH_C32(0xb927c000), SPH_C32(0xa84b0000), SPH_C32(0xaa510000), + SPH_C32(0x6c203648), SPH_C32(0x070bdaeb), SPH_C32(0x7fd672ef), + SPH_C32(0x9223739b) }, + { SPH_C32(0x2c7802e0), SPH_C32(0xc7eb0000), SPH_C32(0xfede0000), + SPH_C32(0x01f30000), SPH_C32(0x866c5db5), SPH_C32(0x25b0a1f9), + SPH_C32(0x76e19872), SPH_C32(0xaeac7f99), SPH_C32(0x61b70170), + SPH_C32(0xe0030000), SPH_C32(0x7f380000), SPH_C32(0xaddc0000), + SPH_C32(0x2c215159), SPH_C32(0x995c9248), SPH_C32(0x99f5f373), + SPH_C32(0x8601fef5) }, + { SPH_C32(0xdb0d02e9), SPH_C32(0x08d7c000), SPH_C32(0x3d080000), + SPH_C32(0x05610000), SPH_C32(0x84f9441c), SPH_C32(0xdd589743), + SPH_C32(0x0c66693c), SPH_C32(0x30bae783), SPH_C32(0xb5dd0170), + SPH_C32(0x6dcbc000), SPH_C32(0xda970000), SPH_C32(0xe7f50000), + SPH_C32(0xd06f1323), SPH_C32(0x50e81424), SPH_C32(0x01c36577), + SPH_C32(0x71473dd5) }, + { SPH_C32(0xf81202e0), SPH_C32(0x4a23c000), SPH_C32(0x5b710000), + SPH_C32(0x4bda0000), SPH_C32(0x7a221fcf), SPH_C32(0xec042795), + SPH_C32(0xeed70e76), SPH_C32(0x59eabcb9), SPH_C32(0x42a80179), + SPH_C32(0xa2f70000), SPH_C32(0x19410000), SPH_C32(0xe3670000), + SPH_C32(0xd2fa0a8a), SPH_C32(0xa800229e), SPH_C32(0x7b449439), + SPH_C32(0xef51a5cf) }, + { SPH_C32(0x0f6702e9), SPH_C32(0x851f0000), SPH_C32(0x98a70000), + SPH_C32(0x4f480000), SPH_C32(0x78b70666), SPH_C32(0x14ec112f), + SPH_C32(0x9450ff38), SPH_C32(0xc7fc24a3), SPH_C32(0x96c20179), + SPH_C32(0x2f3fc000), SPH_C32(0xbcee0000), SPH_C32(0xa94e0000), + SPH_C32(0x2eb448f0), SPH_C32(0x61b4a4f2), SPH_C32(0xe372023d), + SPH_C32(0x181766ef) }, + { SPH_C32(0xaf500240), SPH_C32(0xa0a90000), SPH_C32(0x1fc90000), + SPH_C32(0x36f80000), SPH_C32(0x4dcf5d81), SPH_C32(0x198433c5), + SPH_C32(0xe18625be), SPH_C32(0xebaf1f26), SPH_C32(0x16f30180), + SPH_C32(0x11590000), SPH_C32(0x8a8a0000), SPH_C32(0x99c80000), + SPH_C32(0xa5162fd5), SPH_C32(0xc3d77e6d), SPH_C32(0x92363e6d), + SPH_C32(0x49368b3e) }, + { SPH_C32(0x58250249), SPH_C32(0x6f95c000), SPH_C32(0xdc1f0000), + SPH_C32(0x326a0000), SPH_C32(0x4f5a4428), SPH_C32(0xe16c057f), + SPH_C32(0x9b01d4f0), SPH_C32(0x75b9873c), SPH_C32(0xc2990180), + SPH_C32(0x9c91c000), SPH_C32(0x2f250000), SPH_C32(0xd3e10000), + SPH_C32(0x59586daf), SPH_C32(0x0a63f801), SPH_C32(0x0a00a869), + SPH_C32(0xbe70481e) }, + { SPH_C32(0x7b3a0240), SPH_C32(0x2d61c000), SPH_C32(0xba660000), + SPH_C32(0x7cd10000), SPH_C32(0xb1811ffb), SPH_C32(0xd030b5a9), + SPH_C32(0x79b0b3ba), SPH_C32(0x1ce9dc06), SPH_C32(0x35ec0189), + SPH_C32(0x53ad0000), SPH_C32(0xecf30000), SPH_C32(0xd7730000), + SPH_C32(0x5bcd7406), SPH_C32(0xf28bcebb), SPH_C32(0x70875927), + SPH_C32(0x2066d004) }, + { SPH_C32(0x8c4f0249), SPH_C32(0xe25d0000), SPH_C32(0x79b00000), + SPH_C32(0x78430000), SPH_C32(0xb3140652), SPH_C32(0x28d88313), + SPH_C32(0x033742f4), SPH_C32(0x82ff441c), SPH_C32(0xe1860189), + SPH_C32(0xde65c000), SPH_C32(0x495c0000), SPH_C32(0x9d5a0000), + SPH_C32(0xa783367c), SPH_C32(0x3b3f48d7), SPH_C32(0xe8b1cf23), + SPH_C32(0xd7201324) }, + { SPH_C32(0xd81402b0), SPH_C32(0x51f30000), SPH_C32(0xea7b0000), + SPH_C32(0x02ec0000), SPH_C32(0xc4f8230d), SPH_C32(0x430fdfe0), + SPH_C32(0xea45e8a0), SPH_C32(0x24986aed), SPH_C32(0xe29f01d0), + SPH_C32(0x87410000), SPH_C32(0x9e2f0000), SPH_C32(0x9ad70000), + SPH_C32(0xe782516d), SPH_C32(0xa5680074), SPH_C32(0x0e924ebf), + SPH_C32(0xc3029e4a) }, + { SPH_C32(0x2f6102b9), SPH_C32(0x9ecfc000), SPH_C32(0x29ad0000), + SPH_C32(0x067e0000), SPH_C32(0xc66d3aa4), SPH_C32(0xbbe7e95a), + SPH_C32(0x90c219ee), SPH_C32(0xba8ef2f7), SPH_C32(0x36f501d0), + SPH_C32(0x0a89c000), SPH_C32(0x3b800000), SPH_C32(0xd0fe0000), + SPH_C32(0x1bcc1317), SPH_C32(0x6cdc8618), SPH_C32(0x96a4d8bb), + SPH_C32(0x34445d6a) }, + { SPH_C32(0x0c7e02b0), SPH_C32(0xdc3bc000), SPH_C32(0x4fd40000), + SPH_C32(0x48c50000), SPH_C32(0x38b66177), SPH_C32(0x8abb598c), + SPH_C32(0x72737ea4), SPH_C32(0xd3dea9cd), SPH_C32(0xc18001d9), + SPH_C32(0xc5b50000), SPH_C32(0xf8560000), SPH_C32(0xd46c0000), + SPH_C32(0x19590abe), SPH_C32(0x9434b0a2), SPH_C32(0xec2329f5), + SPH_C32(0xaa52c570) }, + { SPH_C32(0xfb0b02b9), SPH_C32(0x13070000), SPH_C32(0x8c020000), + SPH_C32(0x4c570000), SPH_C32(0x3a2378de), SPH_C32(0x72536f36), + SPH_C32(0x08f48fea), SPH_C32(0x4dc831d7), SPH_C32(0x15ea01d9), + SPH_C32(0x487dc000), SPH_C32(0x5df90000), SPH_C32(0x9e450000), + SPH_C32(0xe51748c4), SPH_C32(0x5d8036ce), SPH_C32(0x7415bff1), + SPH_C32(0x5d140650) }, + { SPH_C32(0xb3bb0360), SPH_C32(0xabc30000), SPH_C32(0x19b70000), + SPH_C32(0xe1c50000), SPH_C32(0xfdd3481e), SPH_C32(0xd61aa89f), + SPH_C32(0x33dae074), SPH_C32(0x001319e3), SPH_C32(0x21ec0140), + SPH_C32(0x7a570000), SPH_C32(0x3d5f0000), SPH_C32(0xf26d0000), + SPH_C32(0xfae130de), SPH_C32(0xc4dd1474), SPH_C32(0x1e67dc9c), + SPH_C32(0xffe1bcd9) }, + { SPH_C32(0x44ce0369), SPH_C32(0x64ffc000), SPH_C32(0xda610000), + SPH_C32(0xe5570000), SPH_C32(0xff4651b7), SPH_C32(0x2ef29e25), + SPH_C32(0x495d113a), SPH_C32(0x9e0581f9), SPH_C32(0xf5860140), + SPH_C32(0xf79fc000), SPH_C32(0x98f00000), SPH_C32(0xb8440000), + SPH_C32(0x06af72a4), SPH_C32(0x0d699218), SPH_C32(0x86514a98), + SPH_C32(0x08a77ff9) }, + { SPH_C32(0x67d10360), SPH_C32(0x260bc000), SPH_C32(0xbc180000), + SPH_C32(0xabec0000), SPH_C32(0x019d0a64), SPH_C32(0x1fae2ef3), + SPH_C32(0xabec7670), SPH_C32(0xf755dac3), SPH_C32(0x02f30149), + SPH_C32(0x38a30000), SPH_C32(0x5b260000), SPH_C32(0xbcd60000), + SPH_C32(0x043a6b0d), SPH_C32(0xf581a4a2), SPH_C32(0xfcd6bbd6), + SPH_C32(0x96b1e7e3) }, + { SPH_C32(0x90a40369), SPH_C32(0xe9370000), SPH_C32(0x7fce0000), + SPH_C32(0xaf7e0000), SPH_C32(0x030813cd), SPH_C32(0xe7461849), + SPH_C32(0xd16b873e), SPH_C32(0x694342d9), SPH_C32(0xd6990149), + SPH_C32(0xb56bc000), SPH_C32(0xfe890000), SPH_C32(0xf6ff0000), + SPH_C32(0xf8742977), SPH_C32(0x3c3522ce), SPH_C32(0x64e02dd2), + SPH_C32(0x61f724c3) }, + { SPH_C32(0xc4ff0390), SPH_C32(0x5a990000), SPH_C32(0xec050000), + SPH_C32(0xd5d10000), SPH_C32(0x74e43692), SPH_C32(0x8c9144ba), + SPH_C32(0x38192d6a), SPH_C32(0xcf246c28), SPH_C32(0xd5800110), + SPH_C32(0xec4f0000), SPH_C32(0x29fa0000), SPH_C32(0xf1720000), + SPH_C32(0xb8754e66), SPH_C32(0xa2626a6d), SPH_C32(0x82c3ac4e), + SPH_C32(0x75d5a9ad) }, + { SPH_C32(0x338a0399), SPH_C32(0x95a5c000), SPH_C32(0x2fd30000), + SPH_C32(0xd1430000), SPH_C32(0x76712f3b), SPH_C32(0x74797200), + SPH_C32(0x429edc24), SPH_C32(0x5132f432), SPH_C32(0x01ea0110), + SPH_C32(0x6187c000), SPH_C32(0x8c550000), SPH_C32(0xbb5b0000), + SPH_C32(0x443b0c1c), SPH_C32(0x6bd6ec01), SPH_C32(0x1af53a4a), + SPH_C32(0x82936a8d) }, + { SPH_C32(0x10950390), SPH_C32(0xd751c000), SPH_C32(0x49aa0000), + SPH_C32(0x9ff80000), SPH_C32(0x88aa74e8), SPH_C32(0x4525c2d6), + SPH_C32(0xa02fbb6e), SPH_C32(0x3862af08), SPH_C32(0xf69f0119), + SPH_C32(0xaebb0000), SPH_C32(0x4f830000), SPH_C32(0xbfc90000), + SPH_C32(0x46ae15b5), SPH_C32(0x933edabb), SPH_C32(0x6072cb04), + SPH_C32(0x1c85f297) }, + { SPH_C32(0xe7e00399), SPH_C32(0x186d0000), SPH_C32(0x8a7c0000), + SPH_C32(0x9b6a0000), SPH_C32(0x8a3f6d41), SPH_C32(0xbdcdf46c), + SPH_C32(0xdaa84a20), SPH_C32(0xa6743712), SPH_C32(0x22f50119), + SPH_C32(0x2373c000), SPH_C32(0xea2c0000), SPH_C32(0xf5e00000), + SPH_C32(0xbae057cf), SPH_C32(0x5a8a5cd7), SPH_C32(0xf8445d00), + SPH_C32(0xebc331b7) }, + { SPH_C32(0x47d70330), SPH_C32(0x3ddb0000), SPH_C32(0x0d120000), + SPH_C32(0xe2da0000), SPH_C32(0xbf4736a6), SPH_C32(0xb0a5d686), + SPH_C32(0xaf7e90a6), SPH_C32(0x8a270c97), SPH_C32(0xa2c401e0), + SPH_C32(0x1d150000), SPH_C32(0xdc480000), SPH_C32(0xc5660000), + SPH_C32(0x314230ea), SPH_C32(0xf8e98648), SPH_C32(0x89006150), + SPH_C32(0xbae2dc66) }, + { SPH_C32(0xb0a20339), SPH_C32(0xf2e7c000), SPH_C32(0xcec40000), + SPH_C32(0xe6480000), SPH_C32(0xbdd22f0f), SPH_C32(0x484de03c), + SPH_C32(0xd5f961e8), SPH_C32(0x1431948d), SPH_C32(0x76ae01e0), + SPH_C32(0x90ddc000), SPH_C32(0x79e70000), SPH_C32(0x8f4f0000), + SPH_C32(0xcd0c7290), SPH_C32(0x315d0024), SPH_C32(0x1136f754), + SPH_C32(0x4da41f46) }, + { SPH_C32(0x93bd0330), SPH_C32(0xb013c000), SPH_C32(0xa8bd0000), + SPH_C32(0xa8f30000), SPH_C32(0x430974dc), SPH_C32(0x791150ea), + SPH_C32(0x374806a2), SPH_C32(0x7d61cfb7), SPH_C32(0x81db01e9), + SPH_C32(0x5fe10000), SPH_C32(0xba310000), SPH_C32(0x8bdd0000), + SPH_C32(0xcf996b39), SPH_C32(0xc9b5369e), SPH_C32(0x6bb1061a), + SPH_C32(0xd3b2875c) }, + { SPH_C32(0x64c80339), SPH_C32(0x7f2f0000), SPH_C32(0x6b6b0000), + SPH_C32(0xac610000), SPH_C32(0x419c6d75), SPH_C32(0x81f96650), + SPH_C32(0x4dcff7ec), SPH_C32(0xe37757ad), SPH_C32(0x55b101e9), + SPH_C32(0xd229c000), SPH_C32(0x1f9e0000), SPH_C32(0xc1f40000), + SPH_C32(0x33d72943), SPH_C32(0x0001b0f2), SPH_C32(0xf387901e), + SPH_C32(0x24f4447c) }, + { SPH_C32(0x309303c0), SPH_C32(0xcc810000), SPH_C32(0xf8a00000), + SPH_C32(0xd6ce0000), SPH_C32(0x3670482a), SPH_C32(0xea2e3aa3), + SPH_C32(0xa4bd5db8), SPH_C32(0x4510795c), SPH_C32(0x56a801b0), + SPH_C32(0x8b0d0000), SPH_C32(0xc8ed0000), SPH_C32(0xc6790000), + SPH_C32(0x73d64e52), SPH_C32(0x9e56f851), SPH_C32(0x15a41182), + SPH_C32(0x30d6c912) }, + { SPH_C32(0xc7e603c9), SPH_C32(0x03bdc000), SPH_C32(0x3b760000), + SPH_C32(0xd25c0000), SPH_C32(0x34e55183), SPH_C32(0x12c60c19), + SPH_C32(0xde3aacf6), SPH_C32(0xdb06e146), SPH_C32(0x82c201b0), + SPH_C32(0x06c5c000), SPH_C32(0x6d420000), SPH_C32(0x8c500000), + SPH_C32(0x8f980c28), SPH_C32(0x57e27e3d), SPH_C32(0x8d928786), + SPH_C32(0xc7900a32) }, + { SPH_C32(0xe4f903c0), SPH_C32(0x4149c000), SPH_C32(0x5d0f0000), + SPH_C32(0x9ce70000), SPH_C32(0xca3e0a50), SPH_C32(0x239abccf), + SPH_C32(0x3c8bcbbc), SPH_C32(0xb256ba7c), SPH_C32(0x75b701b9), + SPH_C32(0xc9f90000), SPH_C32(0xae940000), SPH_C32(0x88c20000), + SPH_C32(0x8d0d1581), SPH_C32(0xaf0a4887), SPH_C32(0xf71576c8), + SPH_C32(0x59869228) }, + { SPH_C32(0x138c03c9), SPH_C32(0x8e750000), SPH_C32(0x9ed90000), + SPH_C32(0x98750000), SPH_C32(0xc8ab13f9), SPH_C32(0xdb728a75), + SPH_C32(0x460c3af2), SPH_C32(0x2c402266), SPH_C32(0xa1dd01b9), + SPH_C32(0x4431c000), SPH_C32(0x0b3b0000), SPH_C32(0xc2eb0000), + SPH_C32(0x714357fb), SPH_C32(0x66beceeb), SPH_C32(0x6f23e0cc), + SPH_C32(0xaec05108) } +}; + +static const sph_u32 T512_14[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xb83d0000), SPH_C32(0x16710600), SPH_C32(0x379a0000), + SPH_C32(0xf5b10000), SPH_C32(0x228161ac), SPH_C32(0xae48f145), + SPH_C32(0x66241616), SPH_C32(0xc5c1eb3e), SPH_C32(0xfd250000), + SPH_C32(0xb3c41100), SPH_C32(0xcef00000), SPH_C32(0xcef90000), + SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), SPH_C32(0x7098b0a6), + SPH_C32(0x1af21fe1) }, + { SPH_C32(0x75a40000), SPH_C32(0xc28b2700), SPH_C32(0x94a40000), + SPH_C32(0x90f50000), SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), + SPH_C32(0x1767c483), SPH_C32(0xaedf667e), SPH_C32(0xd1660000), + SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), SPH_C32(0xf6940000), + SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), SPH_C32(0xb4431b17), + SPH_C32(0x857f3c2b) }, + { SPH_C32(0xcd990000), SPH_C32(0xd4fa2100), SPH_C32(0xa33e0000), + SPH_C32(0x65440000), SPH_C32(0xd9f9364c), SPH_C32(0xe786faeb), + SPH_C32(0x7143d295), SPH_C32(0x6b1e8d40), SPH_C32(0x2c430000), + SPH_C32(0xa8781200), SPH_C32(0x501c0000), SPH_C32(0x386d0000), + SPH_C32(0x3f4f30a7), SPH_C32(0x422b9861), SPH_C32(0xc4dbabb1), + SPH_C32(0x9f8d23ca) }, + { SPH_C32(0xd1660000), SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), + SPH_C32(0xf6940000), SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), + SPH_C32(0xb4431b17), SPH_C32(0x857f3c2b), SPH_C32(0xa4c20000), + SPH_C32(0xd9372400), SPH_C32(0x0a480000), SPH_C32(0x66610000), + SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), SPH_C32(0xa324df94), + SPH_C32(0x2ba05a55) }, + { SPH_C32(0x695b0000), SPH_C32(0x0dcd0500), SPH_C32(0xa9760000), + SPH_C32(0x03250000), SPH_C32(0x2183248b), SPH_C32(0x61380db7), + SPH_C32(0xd2670d01), SPH_C32(0x40bed715), SPH_C32(0x59e70000), + SPH_C32(0x6af33500), SPH_C32(0xc4b80000), SPH_C32(0xa8980000), + SPH_C32(0xc4376747), SPH_C32(0x0be593cf), SPH_C32(0xd3bc6f32), + SPH_C32(0x315245b4) }, + { SPH_C32(0xa4c20000), SPH_C32(0xd9372400), SPH_C32(0x0a480000), + SPH_C32(0x66610000), SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), + SPH_C32(0xa324df94), SPH_C32(0x2ba05a55), SPH_C32(0x75a40000), + SPH_C32(0xc28b2700), SPH_C32(0x94a40000), SPH_C32(0x90f50000), + SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), SPH_C32(0x1767c483), + SPH_C32(0xaedf667e) }, + { SPH_C32(0x1cff0000), SPH_C32(0xcf462200), SPH_C32(0x3dd20000), + SPH_C32(0x93d00000), SPH_C32(0xdafb736b), SPH_C32(0x28f60619), + SPH_C32(0xc500c982), SPH_C32(0xee61b16b), SPH_C32(0x88810000), + SPH_C32(0x714f3600), SPH_C32(0x5a540000), SPH_C32(0x5e0c0000), + SPH_C32(0xc7352260), SPH_C32(0xc4956f3d), SPH_C32(0x67ff7425), + SPH_C32(0xb42d799f) }, + { SPH_C32(0x75c90003), SPH_C32(0x0e10c000), SPH_C32(0xd1200000), + SPH_C32(0xbaea0000), SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), + SPH_C32(0xbb28761d), SPH_C32(0x00b72e2b), SPH_C32(0xeecf0001), + SPH_C32(0x6f564000), SPH_C32(0xf33e0000), SPH_C32(0xa79e0000), + SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), SPH_C32(0x4a3b40ba), + SPH_C32(0xfeabf254) }, + { SPH_C32(0xcdf40003), SPH_C32(0x1861c600), SPH_C32(0xe6ba0000), + SPH_C32(0x4f5b0000), SPH_C32(0xa9454e92), SPH_C32(0x29104612), + SPH_C32(0xdd0c600b), SPH_C32(0xc576c515), SPH_C32(0x13ea0001), + SPH_C32(0xdc925100), SPH_C32(0x3dce0000), SPH_C32(0x69670000), + SPH_C32(0x81f80799), SPH_C32(0x3a4a8f56), SPH_C32(0x3aa3f01c), + SPH_C32(0xe459edb5) }, + { SPH_C32(0x006d0003), SPH_C32(0xcc9be700), SPH_C32(0x45840000), + SPH_C32(0x2a1f0000), SPH_C32(0x70bc78de), SPH_C32(0xce96bcf9), + SPH_C32(0xac4fb29e), SPH_C32(0xae684855), SPH_C32(0x3fa90001), + SPH_C32(0x74ea4300), SPH_C32(0x6dd20000), SPH_C32(0x510a0000), + SPH_C32(0xbeb7373e), SPH_C32(0x78611737), SPH_C32(0xfe785bad), + SPH_C32(0x7bd4ce7f) }, + { SPH_C32(0xb8500003), SPH_C32(0xdaeae100), SPH_C32(0x721e0000), + SPH_C32(0xdfae0000), SPH_C32(0x523d1972), SPH_C32(0x60de4dbc), + SPH_C32(0xca6ba488), SPH_C32(0x6ba9a36b), SPH_C32(0xc28c0001), + SPH_C32(0xc72e5200), SPH_C32(0xa3220000), SPH_C32(0x9ff30000), + SPH_C32(0x82fa42be), SPH_C32(0xf53a73a4), SPH_C32(0x8ee0eb0b), + SPH_C32(0x6126d19e) }, + { SPH_C32(0xa4af0003), SPH_C32(0x15acc300), SPH_C32(0x4fcc0000), + SPH_C32(0x4c7e0000), SPH_C32(0x88c66a19), SPH_C32(0x48284ba5), + SPH_C32(0x0f6b6d0a), SPH_C32(0x85c81200), SPH_C32(0x4a0d0001), + SPH_C32(0xb6616400), SPH_C32(0xf9760000), SPH_C32(0xc1ff0000), + SPH_C32(0x45cf60de), SPH_C32(0x31af1c99), SPH_C32(0xe91f9f2e), + SPH_C32(0xd50ba801) }, + { SPH_C32(0x1c920003), SPH_C32(0x03ddc500), SPH_C32(0x78560000), + SPH_C32(0xb9cf0000), SPH_C32(0xaa470bb5), SPH_C32(0xe660bae0), + SPH_C32(0x694f7b1c), SPH_C32(0x4009f93e), SPH_C32(0xb7280001), + SPH_C32(0x05a57500), SPH_C32(0x37860000), SPH_C32(0x0f060000), + SPH_C32(0x7982155e), SPH_C32(0xbcf4780a), SPH_C32(0x99872f88), + SPH_C32(0xcff9b7e0) }, + { SPH_C32(0xd10b0003), SPH_C32(0xd727e400), SPH_C32(0xdb680000), + SPH_C32(0xdc8b0000), SPH_C32(0x73be3df9), SPH_C32(0x01e6400b), + SPH_C32(0x180ca989), SPH_C32(0x2b17747e), SPH_C32(0x9b6b0001), + SPH_C32(0xaddd6700), SPH_C32(0x679a0000), SPH_C32(0x376b0000), + SPH_C32(0x46cd25f9), SPH_C32(0xfedfe06b), SPH_C32(0x5d5c8439), + SPH_C32(0x5074942a) }, + { SPH_C32(0x69360003), SPH_C32(0xc156e200), SPH_C32(0xecf20000), + SPH_C32(0x293a0000), SPH_C32(0x513f5c55), SPH_C32(0xafaeb14e), + SPH_C32(0x7e28bf9f), SPH_C32(0xeed69f40), SPH_C32(0x664e0001), + SPH_C32(0x1e197600), SPH_C32(0xa96a0000), SPH_C32(0xf9920000), + SPH_C32(0x7a805079), SPH_C32(0x738484f8), SPH_C32(0x2dc4349f), + SPH_C32(0x4a868bcb) }, + { SPH_C32(0xeecf0001), SPH_C32(0x6f564000), SPH_C32(0xf33e0000), + SPH_C32(0xa79e0000), SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), + SPH_C32(0x4a3b40ba), SPH_C32(0xfeabf254), SPH_C32(0x9b060002), + SPH_C32(0x61468000), SPH_C32(0x221e0000), SPH_C32(0x1d740000), + SPH_C32(0x36715d27), SPH_C32(0x30495c92), SPH_C32(0xf11336a7), + SPH_C32(0xfe1cdc7f) }, + { SPH_C32(0x56f20001), SPH_C32(0x79274600), SPH_C32(0xc4a40000), + SPH_C32(0x522f0000), SPH_C32(0x9f3413b5), SPH_C32(0x19591a80), + SPH_C32(0x2c1f56ac), SPH_C32(0x3b6a196a), SPH_C32(0x66230002), + SPH_C32(0xd2829100), SPH_C32(0xecee0000), SPH_C32(0xd38d0000), + SPH_C32(0x0a3c28a7), SPH_C32(0xbd123801), SPH_C32(0x818b8601), + SPH_C32(0xe4eec39e) }, + { SPH_C32(0x9b6b0001), SPH_C32(0xaddd6700), SPH_C32(0x679a0000), + SPH_C32(0x376b0000), SPH_C32(0x46cd25f9), SPH_C32(0xfedfe06b), + SPH_C32(0x5d5c8439), SPH_C32(0x5074942a), SPH_C32(0x4a600002), + SPH_C32(0x7afa8300), SPH_C32(0xbcf20000), SPH_C32(0xebe00000), + SPH_C32(0x35731800), SPH_C32(0xff39a060), SPH_C32(0x45502db0), + SPH_C32(0x7b63e054) }, + { SPH_C32(0x23560001), SPH_C32(0xbbac6100), SPH_C32(0x50000000), + SPH_C32(0xc2da0000), SPH_C32(0x644c4455), SPH_C32(0x5097112e), + SPH_C32(0x3b78922f), SPH_C32(0x95b57f14), SPH_C32(0xb7450002), + SPH_C32(0xc93e9200), SPH_C32(0x72020000), SPH_C32(0x25190000), + SPH_C32(0x093e6d80), SPH_C32(0x7262c4f3), SPH_C32(0x35c89d16), + SPH_C32(0x6191ffb5) }, + { SPH_C32(0x3fa90001), SPH_C32(0x74ea4300), SPH_C32(0x6dd20000), + SPH_C32(0x510a0000), SPH_C32(0xbeb7373e), SPH_C32(0x78611737), + SPH_C32(0xfe785bad), SPH_C32(0x7bd4ce7f), SPH_C32(0x3fc40002), + SPH_C32(0xb871a400), SPH_C32(0x28560000), SPH_C32(0x7b150000), + SPH_C32(0xce0b4fe0), SPH_C32(0xb6f7abce), SPH_C32(0x5237e933), + SPH_C32(0xd5bc862a) }, + { SPH_C32(0x87940001), SPH_C32(0x629b4500), SPH_C32(0x5a480000), + SPH_C32(0xa4bb0000), SPH_C32(0x9c365692), SPH_C32(0xd629e672), + SPH_C32(0x985c4dbb), SPH_C32(0xbe152541), SPH_C32(0xc2e10002), + SPH_C32(0x0bb5b500), SPH_C32(0xe6a60000), SPH_C32(0xb5ec0000), + SPH_C32(0xf2463a60), SPH_C32(0x3baccf5d), SPH_C32(0x22af5995), + SPH_C32(0xcf4e99cb) }, + { SPH_C32(0x4a0d0001), SPH_C32(0xb6616400), SPH_C32(0xf9760000), + SPH_C32(0xc1ff0000), SPH_C32(0x45cf60de), SPH_C32(0x31af1c99), + SPH_C32(0xe91f9f2e), SPH_C32(0xd50ba801), SPH_C32(0xeea20002), + SPH_C32(0xa3cda700), SPH_C32(0xb6ba0000), SPH_C32(0x8d810000), + SPH_C32(0xcd090ac7), SPH_C32(0x7987573c), SPH_C32(0xe674f224), + SPH_C32(0x50c3ba01) }, + { SPH_C32(0xf2300001), SPH_C32(0xa0106200), SPH_C32(0xceec0000), + SPH_C32(0x344e0000), SPH_C32(0x674e0172), SPH_C32(0x9fe7eddc), + SPH_C32(0x8f3b8938), SPH_C32(0x10ca433f), SPH_C32(0x13870002), + SPH_C32(0x1009b600), SPH_C32(0x784a0000), SPH_C32(0x43780000), + SPH_C32(0xf1447f47), SPH_C32(0xf4dc33af), SPH_C32(0x96ec4282), + SPH_C32(0x4a31a5e0) }, + { SPH_C32(0x9b060002), SPH_C32(0x61468000), SPH_C32(0x221e0000), + SPH_C32(0x1d740000), SPH_C32(0x36715d27), SPH_C32(0x30495c92), + SPH_C32(0xf11336a7), SPH_C32(0xfe1cdc7f), SPH_C32(0x75c90003), + SPH_C32(0x0e10c000), SPH_C32(0xd1200000), SPH_C32(0xbaea0000), + SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), SPH_C32(0xbb28761d), + SPH_C32(0x00b72e2b) }, + { SPH_C32(0x233b0002), SPH_C32(0x77378600), SPH_C32(0x15840000), + SPH_C32(0xe8c50000), SPH_C32(0x14f03c8b), SPH_C32(0x9e01add7), + SPH_C32(0x973720b1), SPH_C32(0x3bdd3741), SPH_C32(0x88ec0003), + SPH_C32(0xbdd4d100), SPH_C32(0x1fd00000), SPH_C32(0x74130000), + SPH_C32(0xb7895abe), SPH_C32(0x0a03d3c4), SPH_C32(0xcbb0c6bb), + SPH_C32(0x1a4531ca) }, + { SPH_C32(0xeea20002), SPH_C32(0xa3cda700), SPH_C32(0xb6ba0000), + SPH_C32(0x8d810000), SPH_C32(0xcd090ac7), SPH_C32(0x7987573c), + SPH_C32(0xe674f224), SPH_C32(0x50c3ba01), SPH_C32(0xa4af0003), + SPH_C32(0x15acc300), SPH_C32(0x4fcc0000), SPH_C32(0x4c7e0000), + SPH_C32(0x88c66a19), SPH_C32(0x48284ba5), SPH_C32(0x0f6b6d0a), + SPH_C32(0x85c81200) }, + { SPH_C32(0x569f0002), SPH_C32(0xb5bca100), SPH_C32(0x81200000), + SPH_C32(0x78300000), SPH_C32(0xef886b6b), SPH_C32(0xd7cfa679), + SPH_C32(0x8050e432), SPH_C32(0x9502513f), SPH_C32(0x598a0003), + SPH_C32(0xa668d200), SPH_C32(0x813c0000), SPH_C32(0x82870000), + SPH_C32(0xb48b1f99), SPH_C32(0xc5732f36), SPH_C32(0x7ff3ddac), + SPH_C32(0x9f3a0de1) }, + { SPH_C32(0x4a600002), SPH_C32(0x7afa8300), SPH_C32(0xbcf20000), + SPH_C32(0xebe00000), SPH_C32(0x35731800), SPH_C32(0xff39a060), + SPH_C32(0x45502db0), SPH_C32(0x7b63e054), SPH_C32(0xd10b0003), + SPH_C32(0xd727e400), SPH_C32(0xdb680000), SPH_C32(0xdc8b0000), + SPH_C32(0x73be3df9), SPH_C32(0x01e6400b), SPH_C32(0x180ca989), + SPH_C32(0x2b17747e) }, + { SPH_C32(0xf25d0002), SPH_C32(0x6c8b8500), SPH_C32(0x8b680000), + SPH_C32(0x1e510000), SPH_C32(0x17f279ac), SPH_C32(0x51715125), + SPH_C32(0x23743ba6), SPH_C32(0xbea20b6a), SPH_C32(0x2c2e0003), + SPH_C32(0x64e3f500), SPH_C32(0x15980000), SPH_C32(0x12720000), + SPH_C32(0x4ff34879), SPH_C32(0x8cbd2498), SPH_C32(0x6894192f), + SPH_C32(0x31e56b9f) }, + { SPH_C32(0x3fc40002), SPH_C32(0xb871a400), SPH_C32(0x28560000), + SPH_C32(0x7b150000), SPH_C32(0xce0b4fe0), SPH_C32(0xb6f7abce), + SPH_C32(0x5237e933), SPH_C32(0xd5bc862a), SPH_C32(0x006d0003), + SPH_C32(0xcc9be700), SPH_C32(0x45840000), SPH_C32(0x2a1f0000), + SPH_C32(0x70bc78de), SPH_C32(0xce96bcf9), SPH_C32(0xac4fb29e), + SPH_C32(0xae684855) }, + { SPH_C32(0x87f90002), SPH_C32(0xae00a200), SPH_C32(0x1fcc0000), + SPH_C32(0x8ea40000), SPH_C32(0xec8a2e4c), SPH_C32(0x18bf5a8b), + SPH_C32(0x3413ff25), SPH_C32(0x107d6d14), SPH_C32(0xfd480003), + SPH_C32(0x7f5ff600), SPH_C32(0x8b740000), SPH_C32(0xe4e60000), + SPH_C32(0x4cf10d5e), SPH_C32(0x43cdd86a), SPH_C32(0xdcd70238), + SPH_C32(0xb49a57b4) }, + { SPH_C32(0xf6800005), SPH_C32(0x3443c000), SPH_C32(0x24070000), + SPH_C32(0x8f3d0000), SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), + SPH_C32(0xcdc58b19), SPH_C32(0xd795ba31), SPH_C32(0xa67f0001), + SPH_C32(0x71378000), SPH_C32(0x19fc0000), SPH_C32(0x96db0000), + SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), SPH_C32(0x2c6d478f), + SPH_C32(0xac8e6c88) }, + { SPH_C32(0x4ebd0005), SPH_C32(0x2232c600), SPH_C32(0x139d0000), + SPH_C32(0x7a8c0000), SPH_C32(0x03b65a57), SPH_C32(0xa4f024eb), + SPH_C32(0xabe19d0f), SPH_C32(0x1254510f), SPH_C32(0x5b5a0001), + SPH_C32(0xc2f39100), SPH_C32(0xd70c0000), SPH_C32(0x58220000), + SPH_C32(0x06c6187d), SPH_C32(0x6691ca60), SPH_C32(0x5cf5f729), + SPH_C32(0xb67c7369) }, + { SPH_C32(0x83240005), SPH_C32(0xf6c8e700), SPH_C32(0xb0a30000), + SPH_C32(0x1fc80000), SPH_C32(0xda4f6c1b), SPH_C32(0x4376de00), + SPH_C32(0xdaa24f9a), SPH_C32(0x794adc4f), SPH_C32(0x77190001), + SPH_C32(0x6a8b8300), SPH_C32(0x87100000), SPH_C32(0x604f0000), + SPH_C32(0x398928da), SPH_C32(0x24ba5201), SPH_C32(0x982e5c98), + SPH_C32(0x29f150a3) }, + { SPH_C32(0x3b190005), SPH_C32(0xe0b9e100), SPH_C32(0x87390000), + SPH_C32(0xea790000), SPH_C32(0xf8ce0db7), SPH_C32(0xed3e2f45), + SPH_C32(0xbc86598c), SPH_C32(0xbc8b3771), SPH_C32(0x8a3c0001), + SPH_C32(0xd94f9200), SPH_C32(0x49e00000), SPH_C32(0xaeb60000), + SPH_C32(0x05c45d5a), SPH_C32(0xa9e13692), SPH_C32(0xe8b6ec3e), + SPH_C32(0x33034f42) }, + { SPH_C32(0x27e60005), SPH_C32(0x2fffc300), SPH_C32(0xbaeb0000), + SPH_C32(0x79a90000), SPH_C32(0x22357edc), SPH_C32(0xc5c8295c), + SPH_C32(0x7986900e), SPH_C32(0x52ea861a), SPH_C32(0x02bd0001), + SPH_C32(0xa800a400), SPH_C32(0x13b40000), SPH_C32(0xf0ba0000), + SPH_C32(0xc2f17f3a), SPH_C32(0x6d7459af), SPH_C32(0x8f49981b), + SPH_C32(0x872e36dd) }, + { SPH_C32(0x9fdb0005), SPH_C32(0x398ec500), SPH_C32(0x8d710000), + SPH_C32(0x8c180000), SPH_C32(0x00b41f70), SPH_C32(0x6b80d819), + SPH_C32(0x1fa28618), SPH_C32(0x972b6d24), SPH_C32(0xff980001), + SPH_C32(0x1bc4b500), SPH_C32(0xdd440000), SPH_C32(0x3e430000), + SPH_C32(0xfebc0aba), SPH_C32(0xe02f3d3c), SPH_C32(0xffd128bd), + SPH_C32(0x9ddc293c) }, + { SPH_C32(0x52420005), SPH_C32(0xed74e400), SPH_C32(0x2e4f0000), + SPH_C32(0xe95c0000), SPH_C32(0xd94d293c), SPH_C32(0x8c0622f2), + SPH_C32(0x6ee1548d), SPH_C32(0xfc35e064), SPH_C32(0xd3db0001), + SPH_C32(0xb3bca700), SPH_C32(0x8d580000), SPH_C32(0x062e0000), + SPH_C32(0xc1f33a1d), SPH_C32(0xa204a55d), SPH_C32(0x3b0a830c), + SPH_C32(0x02510af6) }, + { SPH_C32(0xea7f0005), SPH_C32(0xfb05e200), SPH_C32(0x19d50000), + SPH_C32(0x1ced0000), SPH_C32(0xfbcc4890), SPH_C32(0x224ed3b7), + SPH_C32(0x08c5429b), SPH_C32(0x39f40b5a), SPH_C32(0x2efe0001), + SPH_C32(0x0078b600), SPH_C32(0x43a80000), SPH_C32(0xc8d70000), + SPH_C32(0xfdbe4f9d), SPH_C32(0x2f5fc1ce), SPH_C32(0x4b9233aa), + SPH_C32(0x18a31517) }, + { SPH_C32(0x83490006), SPH_C32(0x3a530000), SPH_C32(0xf5270000), + SPH_C32(0x35d70000), SPH_C32(0xaaf314c5), SPH_C32(0x8de062f9), + SPH_C32(0x76edfd04), SPH_C32(0xd722941a), SPH_C32(0x48b00000), + SPH_C32(0x1e61c000), SPH_C32(0xeac20000), SPH_C32(0x31450000), + SPH_C32(0x873e1fe4), SPH_C32(0x5cdb4536), SPH_C32(0x66560735), + SPH_C32(0x52259edc) }, + { SPH_C32(0x3b740006), SPH_C32(0x2c220600), SPH_C32(0xc2bd0000), + SPH_C32(0xc0660000), SPH_C32(0x88727569), SPH_C32(0x23a893bc), + SPH_C32(0x10c9eb12), SPH_C32(0x12e37f24), SPH_C32(0xb5950000), + SPH_C32(0xada5d100), SPH_C32(0x24320000), SPH_C32(0xffbc0000), + SPH_C32(0xbb736a64), SPH_C32(0xd18021a5), SPH_C32(0x16ceb793), + SPH_C32(0x48d7813d) }, + { SPH_C32(0xf6ed0006), SPH_C32(0xf8d82700), SPH_C32(0x61830000), + SPH_C32(0xa5220000), SPH_C32(0x518b4325), SPH_C32(0xc42e6957), + SPH_C32(0x618a3987), SPH_C32(0x79fdf264), SPH_C32(0x99d60000), + SPH_C32(0x05ddc300), SPH_C32(0x742e0000), SPH_C32(0xc7d10000), + SPH_C32(0x843c5ac3), SPH_C32(0x93abb9c4), SPH_C32(0xd2151c22), + SPH_C32(0xd75aa2f7) }, + { SPH_C32(0x4ed00006), SPH_C32(0xeea92100), SPH_C32(0x56190000), + SPH_C32(0x50930000), SPH_C32(0x730a2289), SPH_C32(0x6a669812), + SPH_C32(0x07ae2f91), SPH_C32(0xbc3c195a), SPH_C32(0x64f30000), + SPH_C32(0xb619d200), SPH_C32(0xbade0000), SPH_C32(0x09280000), + SPH_C32(0xb8712f43), SPH_C32(0x1ef0dd57), SPH_C32(0xa28dac84), + SPH_C32(0xcda8bd16) }, + { SPH_C32(0x522f0006), SPH_C32(0x21ef0300), SPH_C32(0x6bcb0000), + SPH_C32(0xc3430000), SPH_C32(0xa9f151e2), SPH_C32(0x42909e0b), + SPH_C32(0xc2aee613), SPH_C32(0x525da831), SPH_C32(0xec720000), + SPH_C32(0xc756e400), SPH_C32(0xe08a0000), SPH_C32(0x57240000), + SPH_C32(0x7f440d23), SPH_C32(0xda65b26a), SPH_C32(0xc572d8a1), + SPH_C32(0x7985c489) }, + { SPH_C32(0xea120006), SPH_C32(0x379e0500), SPH_C32(0x5c510000), + SPH_C32(0x36f20000), SPH_C32(0x8b70304e), SPH_C32(0xecd86f4e), + SPH_C32(0xa48af005), SPH_C32(0x979c430f), SPH_C32(0x11570000), + SPH_C32(0x7492f500), SPH_C32(0x2e7a0000), SPH_C32(0x99dd0000), + SPH_C32(0x430978a3), SPH_C32(0x573ed6f9), SPH_C32(0xb5ea6807), + SPH_C32(0x6377db68) }, + { SPH_C32(0x278b0006), SPH_C32(0xe3642400), SPH_C32(0xff6f0000), + SPH_C32(0x53b60000), SPH_C32(0x52890602), SPH_C32(0x0b5e95a5), + SPH_C32(0xd5c92290), SPH_C32(0xfc82ce4f), SPH_C32(0x3d140000), + SPH_C32(0xdceae700), SPH_C32(0x7e660000), SPH_C32(0xa1b00000), + SPH_C32(0x7c464804), SPH_C32(0x15154e98), SPH_C32(0x7131c3b6), + SPH_C32(0xfcfaf8a2) }, + { SPH_C32(0x9fb60006), SPH_C32(0xf5152200), SPH_C32(0xc8f50000), + SPH_C32(0xa6070000), SPH_C32(0x700867ae), SPH_C32(0xa51664e0), + SPH_C32(0xb3ed3486), SPH_C32(0x39432571), SPH_C32(0xc0310000), + SPH_C32(0x6f2ef600), SPH_C32(0xb0960000), SPH_C32(0x6f490000), + SPH_C32(0x400b3d84), SPH_C32(0x984e2a0b), SPH_C32(0x01a97310), + SPH_C32(0xe608e743) }, + { SPH_C32(0x184f0004), SPH_C32(0x5b158000), SPH_C32(0xd7390000), + SPH_C32(0x28a30000), SPH_C32(0x9c8249e2), SPH_C32(0xbda93e6b), + SPH_C32(0x87fecba3), SPH_C32(0x293e4865), SPH_C32(0x3d790003), + SPH_C32(0x10710000), SPH_C32(0x3be20000), SPH_C32(0x8baf0000), + SPH_C32(0x0cfa30da), SPH_C32(0xdb83f261), SPH_C32(0xdd7e7128), + SPH_C32(0x5292b0f7) }, + { SPH_C32(0xa0720004), SPH_C32(0x4d648600), SPH_C32(0xe0a30000), + SPH_C32(0xdd120000), SPH_C32(0xbe03284e), SPH_C32(0x13e1cf2e), + SPH_C32(0xe1daddb5), SPH_C32(0xecffa35b), SPH_C32(0xc05c0003), + SPH_C32(0xa3b51100), SPH_C32(0xf5120000), SPH_C32(0x45560000), + SPH_C32(0x30b7455a), SPH_C32(0x56d896f2), SPH_C32(0xade6c18e), + SPH_C32(0x4860af16) }, + { SPH_C32(0x6deb0004), SPH_C32(0x999ea700), SPH_C32(0x439d0000), + SPH_C32(0xb8560000), SPH_C32(0x67fa1e02), SPH_C32(0xf46735c5), + SPH_C32(0x90990f20), SPH_C32(0x87e12e1b), SPH_C32(0xec1f0003), + SPH_C32(0x0bcd0300), SPH_C32(0xa50e0000), SPH_C32(0x7d3b0000), + SPH_C32(0x0ff875fd), SPH_C32(0x14f30e93), SPH_C32(0x693d6a3f), + SPH_C32(0xd7ed8cdc) }, + { SPH_C32(0xd5d60004), SPH_C32(0x8fefa100), SPH_C32(0x74070000), + SPH_C32(0x4de70000), SPH_C32(0x457b7fae), SPH_C32(0x5a2fc480), + SPH_C32(0xf6bd1936), SPH_C32(0x4220c525), SPH_C32(0x113a0003), + SPH_C32(0xb8091200), SPH_C32(0x6bfe0000), SPH_C32(0xb3c20000), + SPH_C32(0x33b5007d), SPH_C32(0x99a86a00), SPH_C32(0x19a5da99), + SPH_C32(0xcd1f933d) }, + { SPH_C32(0xc9290004), SPH_C32(0x40a98300), SPH_C32(0x49d50000), + SPH_C32(0xde370000), SPH_C32(0x9f800cc5), SPH_C32(0x72d9c299), + SPH_C32(0x33bdd0b4), SPH_C32(0xac41744e), SPH_C32(0x99bb0003), + SPH_C32(0xc9462400), SPH_C32(0x31aa0000), SPH_C32(0xedce0000), + SPH_C32(0xf480221d), SPH_C32(0x5d3d053d), SPH_C32(0x7e5aaebc), + SPH_C32(0x7932eaa2) }, + { SPH_C32(0x71140004), SPH_C32(0x56d88500), SPH_C32(0x7e4f0000), + SPH_C32(0x2b860000), SPH_C32(0xbd016d69), SPH_C32(0xdc9133dc), + SPH_C32(0x5599c6a2), SPH_C32(0x69809f70), SPH_C32(0x649e0003), + SPH_C32(0x7a823500), SPH_C32(0xff5a0000), SPH_C32(0x23370000), + SPH_C32(0xc8cd579d), SPH_C32(0xd06661ae), SPH_C32(0x0ec21e1a), + SPH_C32(0x63c0f543) }, + { SPH_C32(0xbc8d0004), SPH_C32(0x8222a400), SPH_C32(0xdd710000), + SPH_C32(0x4ec20000), SPH_C32(0x64f85b25), SPH_C32(0x3b17c937), + SPH_C32(0x24da1437), SPH_C32(0x029e1230), SPH_C32(0x48dd0003), + SPH_C32(0xd2fa2700), SPH_C32(0xaf460000), SPH_C32(0x1b5a0000), + SPH_C32(0xf782673a), SPH_C32(0x924df9cf), SPH_C32(0xca19b5ab), + SPH_C32(0xfc4dd689) }, + { SPH_C32(0x04b00004), SPH_C32(0x9453a200), SPH_C32(0xeaeb0000), + SPH_C32(0xbb730000), SPH_C32(0x46793a89), SPH_C32(0x955f3872), + SPH_C32(0x42fe0221), SPH_C32(0xc75ff90e), SPH_C32(0xb5f80003), + SPH_C32(0x613e3600), SPH_C32(0x61b60000), SPH_C32(0xd5a30000), + SPH_C32(0xcbcf12ba), SPH_C32(0x1f169d5c), SPH_C32(0xba81050d), + SPH_C32(0xe6bfc968) }, + { SPH_C32(0x6d860007), SPH_C32(0x55054000), SPH_C32(0x06190000), + SPH_C32(0x92490000), SPH_C32(0x174666dc), SPH_C32(0x3af1893c), + SPH_C32(0x3cd6bdbe), SPH_C32(0x2989664e), SPH_C32(0xd3b60002), + SPH_C32(0x7f274000), SPH_C32(0xc8dc0000), SPH_C32(0x2c310000), + SPH_C32(0xb14f42c3), SPH_C32(0x6c9219a4), SPH_C32(0x97453192), + SPH_C32(0xac3942a3) }, + { SPH_C32(0xd5bb0007), SPH_C32(0x43744600), SPH_C32(0x31830000), + SPH_C32(0x67f80000), SPH_C32(0x35c70770), SPH_C32(0x94b97879), + SPH_C32(0x5af2aba8), SPH_C32(0xec488d70), SPH_C32(0x2e930002), + SPH_C32(0xcce35100), SPH_C32(0x062c0000), SPH_C32(0xe2c80000), + SPH_C32(0x8d023743), SPH_C32(0xe1c97d37), SPH_C32(0xe7dd8134), + SPH_C32(0xb6cb5d42) }, + { SPH_C32(0x18220007), SPH_C32(0x978e6700), SPH_C32(0x92bd0000), + SPH_C32(0x02bc0000), SPH_C32(0xec3e313c), SPH_C32(0x733f8292), + SPH_C32(0x2bb1793d), SPH_C32(0x87560030), SPH_C32(0x02d00002), + SPH_C32(0x649b4300), SPH_C32(0x56300000), SPH_C32(0xdaa50000), + SPH_C32(0xb24d07e4), SPH_C32(0xa3e2e556), SPH_C32(0x23062a85), + SPH_C32(0x29467e88) }, + { SPH_C32(0xa01f0007), SPH_C32(0x81ff6100), SPH_C32(0xa5270000), + SPH_C32(0xf70d0000), SPH_C32(0xcebf5090), SPH_C32(0xdd7773d7), + SPH_C32(0x4d956f2b), SPH_C32(0x4297eb0e), SPH_C32(0xfff50002), + SPH_C32(0xd75f5200), SPH_C32(0x98c00000), SPH_C32(0x145c0000), + SPH_C32(0x8e007264), SPH_C32(0x2eb981c5), SPH_C32(0x539e9a23), + SPH_C32(0x33b46169) }, + { SPH_C32(0xbce00007), SPH_C32(0x4eb94300), SPH_C32(0x98f50000), + SPH_C32(0x64dd0000), SPH_C32(0x144423fb), SPH_C32(0xf58175ce), + SPH_C32(0x8895a6a9), SPH_C32(0xacf65a65), SPH_C32(0x77740002), + SPH_C32(0xa6106400), SPH_C32(0xc2940000), SPH_C32(0x4a500000), + SPH_C32(0x49355004), SPH_C32(0xea2ceef8), SPH_C32(0x3461ee06), + SPH_C32(0x879918f6) }, + { SPH_C32(0x04dd0007), SPH_C32(0x58c84500), SPH_C32(0xaf6f0000), + SPH_C32(0x916c0000), SPH_C32(0x36c54257), SPH_C32(0x5bc9848b), + SPH_C32(0xeeb1b0bf), SPH_C32(0x6937b15b), SPH_C32(0x8a510002), + SPH_C32(0x15d47500), SPH_C32(0x0c640000), SPH_C32(0x84a90000), + SPH_C32(0x75782584), SPH_C32(0x67778a6b), SPH_C32(0x44f95ea0), + SPH_C32(0x9d6b0717) }, + { SPH_C32(0xc9440007), SPH_C32(0x8c326400), SPH_C32(0x0c510000), + SPH_C32(0xf4280000), SPH_C32(0xef3c741b), SPH_C32(0xbc4f7e60), + SPH_C32(0x9ff2622a), SPH_C32(0x02293c1b), SPH_C32(0xa6120002), + SPH_C32(0xbdac6700), SPH_C32(0x5c780000), SPH_C32(0xbcc40000), + SPH_C32(0x4a371523), SPH_C32(0x255c120a), SPH_C32(0x8022f511), + SPH_C32(0x02e624dd) }, + { SPH_C32(0x71790007), SPH_C32(0x9a436200), SPH_C32(0x3bcb0000), + SPH_C32(0x01990000), SPH_C32(0xcdbd15b7), SPH_C32(0x12078f25), + SPH_C32(0xf9d6743c), SPH_C32(0xc7e8d725), SPH_C32(0x5b370002), + SPH_C32(0x0e687600), SPH_C32(0x92880000), SPH_C32(0x723d0000), + SPH_C32(0x767a60a3), SPH_C32(0xa8077699), SPH_C32(0xf0ba45b7), + SPH_C32(0x18143b3c) }, + { SPH_C32(0xa67f0001), SPH_C32(0x71378000), SPH_C32(0x19fc0000), + SPH_C32(0x96db0000), SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), + SPH_C32(0x2c6d478f), SPH_C32(0xac8e6c88), SPH_C32(0x50ff0004), + SPH_C32(0x45744000), SPH_C32(0x3dfb0000), SPH_C32(0x19e60000), + SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), SPH_C32(0xe1a8cc96), + SPH_C32(0x7b1bd6b9) }, + { SPH_C32(0x1e420001), SPH_C32(0x67468600), SPH_C32(0x2e660000), + SPH_C32(0x636a0000), SPH_C32(0x180a0c51), SPH_C32(0x45825fb6), + SPH_C32(0x4a495199), SPH_C32(0x694f87b6), SPH_C32(0xadda0004), + SPH_C32(0xf6b05100), SPH_C32(0xf30b0000), SPH_C32(0xd71f0000), + SPH_C32(0x27f12386), SPH_C32(0x6c291fce), SPH_C32(0x91307c30), + SPH_C32(0x61e9c958) }, + { SPH_C32(0xd3db0001), SPH_C32(0xb3bca700), SPH_C32(0x8d580000), + SPH_C32(0x062e0000), SPH_C32(0xc1f33a1d), SPH_C32(0xa204a55d), + SPH_C32(0x3b0a830c), SPH_C32(0x02510af6), SPH_C32(0x81990004), + SPH_C32(0x5ec84300), SPH_C32(0xa3170000), SPH_C32(0xef720000), + SPH_C32(0x18be1321), SPH_C32(0x2e0287af), SPH_C32(0x55ebd781), + SPH_C32(0xfe64ea92) }, + { SPH_C32(0x6be60001), SPH_C32(0xa5cda100), SPH_C32(0xbac20000), + SPH_C32(0xf39f0000), SPH_C32(0xe3725bb1), SPH_C32(0x0c4c5418), + SPH_C32(0x5d2e951a), SPH_C32(0xc790e1c8), SPH_C32(0x7cbc0004), + SPH_C32(0xed0c5200), SPH_C32(0x6de70000), SPH_C32(0x218b0000), + SPH_C32(0x24f366a1), SPH_C32(0xa359e33c), SPH_C32(0x25736727), + SPH_C32(0xe496f573) }, + { SPH_C32(0x77190001), SPH_C32(0x6a8b8300), SPH_C32(0x87100000), + SPH_C32(0x604f0000), SPH_C32(0x398928da), SPH_C32(0x24ba5201), + SPH_C32(0x982e5c98), SPH_C32(0x29f150a3), SPH_C32(0xf43d0004), + SPH_C32(0x9c436400), SPH_C32(0x37b30000), SPH_C32(0x7f870000), + SPH_C32(0xe3c644c1), SPH_C32(0x67cc8c01), SPH_C32(0x428c1302), + SPH_C32(0x50bb8cec) }, + { SPH_C32(0xcf240001), SPH_C32(0x7cfa8500), SPH_C32(0xb08a0000), + SPH_C32(0x95fe0000), SPH_C32(0x1b084976), SPH_C32(0x8af2a344), + SPH_C32(0xfe0a4a8e), SPH_C32(0xec30bb9d), SPH_C32(0x09180004), + SPH_C32(0x2f877500), SPH_C32(0xf9430000), SPH_C32(0xb17e0000), + SPH_C32(0xdf8b3141), SPH_C32(0xea97e892), SPH_C32(0x3214a3a4), + SPH_C32(0x4a49930d) }, + { SPH_C32(0x02bd0001), SPH_C32(0xa800a400), SPH_C32(0x13b40000), + SPH_C32(0xf0ba0000), SPH_C32(0xc2f17f3a), SPH_C32(0x6d7459af), + SPH_C32(0x8f49981b), SPH_C32(0x872e36dd), SPH_C32(0x255b0004), + SPH_C32(0x87ff6700), SPH_C32(0xa95f0000), SPH_C32(0x89130000), + SPH_C32(0xe0c401e6), SPH_C32(0xa8bc70f3), SPH_C32(0xf6cf0815), + SPH_C32(0xd5c4b0c7) }, + { SPH_C32(0xba800001), SPH_C32(0xbe71a200), SPH_C32(0x242e0000), + SPH_C32(0x050b0000), SPH_C32(0xe0701e96), SPH_C32(0xc33ca8ea), + SPH_C32(0xe96d8e0d), SPH_C32(0x42efdde3), SPH_C32(0xd87e0004), + SPH_C32(0x343b7600), SPH_C32(0x67af0000), SPH_C32(0x47ea0000), + SPH_C32(0xdc897466), SPH_C32(0x25e71460), SPH_C32(0x8657b8b3), + SPH_C32(0xcf36af26) }, + { SPH_C32(0xd3b60002), SPH_C32(0x7f274000), SPH_C32(0xc8dc0000), + SPH_C32(0x2c310000), SPH_C32(0xb14f42c3), SPH_C32(0x6c9219a4), + SPH_C32(0x97453192), SPH_C32(0xac3942a3), SPH_C32(0xbe300005), + SPH_C32(0x2a220000), SPH_C32(0xcec50000), SPH_C32(0xbe780000), + SPH_C32(0xa609241f), SPH_C32(0x56639098), SPH_C32(0xab938c2c), + SPH_C32(0x85b024ed) }, + { SPH_C32(0x6b8b0002), SPH_C32(0x69564600), SPH_C32(0xff460000), + SPH_C32(0xd9800000), SPH_C32(0x93ce236f), SPH_C32(0xc2dae8e1), + SPH_C32(0xf1612784), SPH_C32(0x69f8a99d), SPH_C32(0x43150005), + SPH_C32(0x99e61100), SPH_C32(0x00350000), SPH_C32(0x70810000), + SPH_C32(0x9a44519f), SPH_C32(0xdb38f40b), SPH_C32(0xdb0b3c8a), + SPH_C32(0x9f423b0c) }, + { SPH_C32(0xa6120002), SPH_C32(0xbdac6700), SPH_C32(0x5c780000), + SPH_C32(0xbcc40000), SPH_C32(0x4a371523), SPH_C32(0x255c120a), + SPH_C32(0x8022f511), SPH_C32(0x02e624dd), SPH_C32(0x6f560005), + SPH_C32(0x319e0300), SPH_C32(0x50290000), SPH_C32(0x48ec0000), + SPH_C32(0xa50b6138), SPH_C32(0x99136c6a), SPH_C32(0x1fd0973b), + SPH_C32(0x00cf18c6) }, + { SPH_C32(0x1e2f0002), SPH_C32(0xabdd6100), SPH_C32(0x6be20000), + SPH_C32(0x49750000), SPH_C32(0x68b6748f), SPH_C32(0x8b14e34f), + SPH_C32(0xe606e307), SPH_C32(0xc727cfe3), SPH_C32(0x92730005), + SPH_C32(0x825a1200), SPH_C32(0x9ed90000), SPH_C32(0x86150000), + SPH_C32(0x994614b8), SPH_C32(0x144808f9), SPH_C32(0x6f48279d), + SPH_C32(0x1a3d0727) }, + { SPH_C32(0x02d00002), SPH_C32(0x649b4300), SPH_C32(0x56300000), + SPH_C32(0xdaa50000), SPH_C32(0xb24d07e4), SPH_C32(0xa3e2e556), + SPH_C32(0x23062a85), SPH_C32(0x29467e88), SPH_C32(0x1af20005), + SPH_C32(0xf3152400), SPH_C32(0xc48d0000), SPH_C32(0xd8190000), + SPH_C32(0x5e7336d8), SPH_C32(0xd0dd67c4), SPH_C32(0x08b753b8), + SPH_C32(0xae107eb8) }, + { SPH_C32(0xbaed0002), SPH_C32(0x72ea4500), SPH_C32(0x61aa0000), + SPH_C32(0x2f140000), SPH_C32(0x90cc6648), SPH_C32(0x0daa1413), + SPH_C32(0x45223c93), SPH_C32(0xec8795b6), SPH_C32(0xe7d70005), + SPH_C32(0x40d13500), SPH_C32(0x0a7d0000), SPH_C32(0x16e00000), + SPH_C32(0x623e4358), SPH_C32(0x5d860357), SPH_C32(0x782fe31e), + SPH_C32(0xb4e26159) }, + { SPH_C32(0x77740002), SPH_C32(0xa6106400), SPH_C32(0xc2940000), + SPH_C32(0x4a500000), SPH_C32(0x49355004), SPH_C32(0xea2ceef8), + SPH_C32(0x3461ee06), SPH_C32(0x879918f6), SPH_C32(0xcb940005), + SPH_C32(0xe8a92700), SPH_C32(0x5a610000), SPH_C32(0x2e8d0000), + SPH_C32(0x5d7173ff), SPH_C32(0x1fad9b36), SPH_C32(0xbcf448af), + SPH_C32(0x2b6f4293) }, + { SPH_C32(0xcf490002), SPH_C32(0xb0616200), SPH_C32(0xf50e0000), + SPH_C32(0xbfe10000), SPH_C32(0x6bb431a8), SPH_C32(0x44641fbd), + SPH_C32(0x5245f810), SPH_C32(0x4258f3c8), SPH_C32(0x36b10005), + SPH_C32(0x5b6d3600), SPH_C32(0x94910000), SPH_C32(0xe0740000), + SPH_C32(0x613c067f), SPH_C32(0x92f6ffa5), SPH_C32(0xcc6cf809), + SPH_C32(0x319d5d72) }, + { SPH_C32(0x48b00000), SPH_C32(0x1e61c000), SPH_C32(0xeac20000), + SPH_C32(0x31450000), SPH_C32(0x873e1fe4), SPH_C32(0x5cdb4536), + SPH_C32(0x66560735), SPH_C32(0x52259edc), SPH_C32(0xcbf90006), + SPH_C32(0x2432c000), SPH_C32(0x1fe50000), SPH_C32(0x04920000), + SPH_C32(0x2dcd0b21), SPH_C32(0xd13b27cf), SPH_C32(0x10bbfa31), + SPH_C32(0x85070ac6) }, + { SPH_C32(0xf08d0000), SPH_C32(0x0810c600), SPH_C32(0xdd580000), + SPH_C32(0xc4f40000), SPH_C32(0xa5bf7e48), SPH_C32(0xf293b473), + SPH_C32(0x00721123), SPH_C32(0x97e475e2), SPH_C32(0x36dc0006), + SPH_C32(0x97f6d100), SPH_C32(0xd1150000), SPH_C32(0xca6b0000), + SPH_C32(0x11807ea1), SPH_C32(0x5c60435c), SPH_C32(0x60234a97), + SPH_C32(0x9ff51527) }, + { SPH_C32(0x3d140000), SPH_C32(0xdceae700), SPH_C32(0x7e660000), + SPH_C32(0xa1b00000), SPH_C32(0x7c464804), SPH_C32(0x15154e98), + SPH_C32(0x7131c3b6), SPH_C32(0xfcfaf8a2), SPH_C32(0x1a9f0006), + SPH_C32(0x3f8ec300), SPH_C32(0x81090000), SPH_C32(0xf2060000), + SPH_C32(0x2ecf4e06), SPH_C32(0x1e4bdb3d), SPH_C32(0xa4f8e126), + SPH_C32(0x007836ed) }, + { SPH_C32(0x85290000), SPH_C32(0xca9be100), SPH_C32(0x49fc0000), + SPH_C32(0x54010000), SPH_C32(0x5ec729a8), SPH_C32(0xbb5dbfdd), + SPH_C32(0x1715d5a0), SPH_C32(0x393b139c), SPH_C32(0xe7ba0006), + SPH_C32(0x8c4ad200), SPH_C32(0x4ff90000), SPH_C32(0x3cff0000), + SPH_C32(0x12823b86), SPH_C32(0x9310bfae), SPH_C32(0xd4605180), + SPH_C32(0x1a8a290c) }, + { SPH_C32(0x99d60000), SPH_C32(0x05ddc300), SPH_C32(0x742e0000), + SPH_C32(0xc7d10000), SPH_C32(0x843c5ac3), SPH_C32(0x93abb9c4), + SPH_C32(0xd2151c22), SPH_C32(0xd75aa2f7), SPH_C32(0x6f3b0006), + SPH_C32(0xfd05e400), SPH_C32(0x15ad0000), SPH_C32(0x62f30000), + SPH_C32(0xd5b719e6), SPH_C32(0x5785d093), SPH_C32(0xb39f25a5), + SPH_C32(0xaea75093) }, + { SPH_C32(0x21eb0000), SPH_C32(0x13acc500), SPH_C32(0x43b40000), + SPH_C32(0x32600000), SPH_C32(0xa6bd3b6f), SPH_C32(0x3de34881), + SPH_C32(0xb4310a34), SPH_C32(0x129b49c9), SPH_C32(0x921e0006), + SPH_C32(0x4ec1f500), SPH_C32(0xdb5d0000), SPH_C32(0xac0a0000), + SPH_C32(0xe9fa6c66), SPH_C32(0xdadeb400), SPH_C32(0xc3079503), + SPH_C32(0xb4554f72) }, + { SPH_C32(0xec720000), SPH_C32(0xc756e400), SPH_C32(0xe08a0000), + SPH_C32(0x57240000), SPH_C32(0x7f440d23), SPH_C32(0xda65b26a), + SPH_C32(0xc572d8a1), SPH_C32(0x7985c489), SPH_C32(0xbe5d0006), + SPH_C32(0xe6b9e700), SPH_C32(0x8b410000), SPH_C32(0x94670000), + SPH_C32(0xd6b55cc1), SPH_C32(0x98f52c61), SPH_C32(0x07dc3eb2), + SPH_C32(0x2bd86cb8) }, + { SPH_C32(0x544f0000), SPH_C32(0xd127e200), SPH_C32(0xd7100000), + SPH_C32(0xa2950000), SPH_C32(0x5dc56c8f), SPH_C32(0x742d432f), + SPH_C32(0xa356ceb7), SPH_C32(0xbc442fb7), SPH_C32(0x43780006), + SPH_C32(0x557df600), SPH_C32(0x45b10000), SPH_C32(0x5a9e0000), + SPH_C32(0xeaf82941), SPH_C32(0x15ae48f2), SPH_C32(0x77448e14), + SPH_C32(0x312a7359) }, + { SPH_C32(0x3d790003), SPH_C32(0x10710000), SPH_C32(0x3be20000), + SPH_C32(0x8baf0000), SPH_C32(0x0cfa30da), SPH_C32(0xdb83f261), + SPH_C32(0xdd7e7128), SPH_C32(0x5292b0f7), SPH_C32(0x25360007), + SPH_C32(0x4b648000), SPH_C32(0xecdb0000), SPH_C32(0xa30c0000), + SPH_C32(0x90787938), SPH_C32(0x662acc0a), SPH_C32(0x5a80ba8b), + SPH_C32(0x7bacf892) }, + { SPH_C32(0x85440003), SPH_C32(0x06000600), SPH_C32(0x0c780000), + SPH_C32(0x7e1e0000), SPH_C32(0x2e7b5176), SPH_C32(0x75cb0324), + SPH_C32(0xbb5a673e), SPH_C32(0x97535bc9), SPH_C32(0xd8130007), + SPH_C32(0xf8a09100), SPH_C32(0x222b0000), SPH_C32(0x6df50000), + SPH_C32(0xac350cb8), SPH_C32(0xeb71a899), SPH_C32(0x2a180a2d), + SPH_C32(0x615ee773) }, + { SPH_C32(0x48dd0003), SPH_C32(0xd2fa2700), SPH_C32(0xaf460000), + SPH_C32(0x1b5a0000), SPH_C32(0xf782673a), SPH_C32(0x924df9cf), + SPH_C32(0xca19b5ab), SPH_C32(0xfc4dd689), SPH_C32(0xf4500007), + SPH_C32(0x50d88300), SPH_C32(0x72370000), SPH_C32(0x55980000), + SPH_C32(0x937a3c1f), SPH_C32(0xa95a30f8), SPH_C32(0xeec3a19c), + SPH_C32(0xfed3c4b9) }, + { SPH_C32(0xf0e00003), SPH_C32(0xc48b2100), SPH_C32(0x98dc0000), + SPH_C32(0xeeeb0000), SPH_C32(0xd5030696), SPH_C32(0x3c05088a), + SPH_C32(0xac3da3bd), SPH_C32(0x398c3db7), SPH_C32(0x09750007), + SPH_C32(0xe31c9200), SPH_C32(0xbcc70000), SPH_C32(0x9b610000), + SPH_C32(0xaf37499f), SPH_C32(0x2401546b), SPH_C32(0x9e5b113a), + SPH_C32(0xe421db58) }, + { SPH_C32(0xec1f0003), SPH_C32(0x0bcd0300), SPH_C32(0xa50e0000), + SPH_C32(0x7d3b0000), SPH_C32(0x0ff875fd), SPH_C32(0x14f30e93), + SPH_C32(0x693d6a3f), SPH_C32(0xd7ed8cdc), SPH_C32(0x81f40007), + SPH_C32(0x9253a400), SPH_C32(0xe6930000), SPH_C32(0xc56d0000), + SPH_C32(0x68026bff), SPH_C32(0xe0943b56), SPH_C32(0xf9a4651f), + SPH_C32(0x500ca2c7) }, + { SPH_C32(0x54220003), SPH_C32(0x1dbc0500), SPH_C32(0x92940000), + SPH_C32(0x888a0000), SPH_C32(0x2d791451), SPH_C32(0xbabbffd6), + SPH_C32(0x0f197c29), SPH_C32(0x122c67e2), SPH_C32(0x7cd10007), + SPH_C32(0x2197b500), SPH_C32(0x28630000), SPH_C32(0x0b940000), + SPH_C32(0x544f1e7f), SPH_C32(0x6dcf5fc5), SPH_C32(0x893cd5b9), + SPH_C32(0x4afebd26) }, + { SPH_C32(0x99bb0003), SPH_C32(0xc9462400), SPH_C32(0x31aa0000), + SPH_C32(0xedce0000), SPH_C32(0xf480221d), SPH_C32(0x5d3d053d), + SPH_C32(0x7e5aaebc), SPH_C32(0x7932eaa2), SPH_C32(0x50920007), + SPH_C32(0x89efa700), SPH_C32(0x787f0000), SPH_C32(0x33f90000), + SPH_C32(0x6b002ed8), SPH_C32(0x2fe4c7a4), SPH_C32(0x4de77e08), + SPH_C32(0xd5739eec) }, + { SPH_C32(0x21860003), SPH_C32(0xdf372200), SPH_C32(0x06300000), + SPH_C32(0x187f0000), SPH_C32(0xd60143b1), SPH_C32(0xf375f478), + SPH_C32(0x187eb8aa), SPH_C32(0xbcf3019c), SPH_C32(0xadb70007), + SPH_C32(0x3a2bb600), SPH_C32(0xb68f0000), SPH_C32(0xfd000000), + SPH_C32(0x574d5b58), SPH_C32(0xa2bfa337), SPH_C32(0x3d7fceae), + SPH_C32(0xcf81810d) }, + { SPH_C32(0x50ff0004), SPH_C32(0x45744000), SPH_C32(0x3dfb0000), + SPH_C32(0x19e60000), SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), + SPH_C32(0xe1a8cc96), SPH_C32(0x7b1bd6b9), SPH_C32(0xf6800005), + SPH_C32(0x3443c000), SPH_C32(0x24070000), SPH_C32(0x8f3d0000), + SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), SPH_C32(0xcdc58b19), + SPH_C32(0xd795ba31) }, + { SPH_C32(0xe8c20004), SPH_C32(0x53054600), SPH_C32(0x0a610000), + SPH_C32(0xec570000), SPH_C32(0x393d37aa), SPH_C32(0x4f3a8a18), + SPH_C32(0x878cda80), SPH_C32(0xbeda3d87), SPH_C32(0x0ba50005), + SPH_C32(0x8787d100), SPH_C32(0xeaf70000), SPH_C32(0x41c40000), + SPH_C32(0x1d7a4e7b), SPH_C32(0x87e3b13d), SPH_C32(0xbd5d3bbf), + SPH_C32(0xcd67a5d0) }, + { SPH_C32(0x255b0004), SPH_C32(0x87ff6700), SPH_C32(0xa95f0000), + SPH_C32(0x89130000), SPH_C32(0xe0c401e6), SPH_C32(0xa8bc70f3), + SPH_C32(0xf6cf0815), SPH_C32(0xd5c4b0c7), SPH_C32(0x27e60005), + SPH_C32(0x2fffc300), SPH_C32(0xbaeb0000), SPH_C32(0x79a90000), + SPH_C32(0x22357edc), SPH_C32(0xc5c8295c), SPH_C32(0x7986900e), + SPH_C32(0x52ea861a) }, + { SPH_C32(0x9d660004), SPH_C32(0x918e6100), SPH_C32(0x9ec50000), + SPH_C32(0x7ca20000), SPH_C32(0xc245604a), SPH_C32(0x06f481b6), + SPH_C32(0x90eb1e03), SPH_C32(0x10055bf9), SPH_C32(0xdac30005), + SPH_C32(0x9c3bd200), SPH_C32(0x741b0000), SPH_C32(0xb7500000), + SPH_C32(0x1e780b5c), SPH_C32(0x48934dcf), SPH_C32(0x091e20a8), + SPH_C32(0x481899fb) }, + { SPH_C32(0x81990004), SPH_C32(0x5ec84300), SPH_C32(0xa3170000), + SPH_C32(0xef720000), SPH_C32(0x18be1321), SPH_C32(0x2e0287af), + SPH_C32(0x55ebd781), SPH_C32(0xfe64ea92), SPH_C32(0x52420005), + SPH_C32(0xed74e400), SPH_C32(0x2e4f0000), SPH_C32(0xe95c0000), + SPH_C32(0xd94d293c), SPH_C32(0x8c0622f2), SPH_C32(0x6ee1548d), + SPH_C32(0xfc35e064) }, + { SPH_C32(0x39a40004), SPH_C32(0x48b94500), SPH_C32(0x948d0000), + SPH_C32(0x1ac30000), SPH_C32(0x3a3f728d), SPH_C32(0x804a76ea), + SPH_C32(0x33cfc197), SPH_C32(0x3ba501ac), SPH_C32(0xaf670005), + SPH_C32(0x5eb0f500), SPH_C32(0xe0bf0000), SPH_C32(0x27a50000), + SPH_C32(0xe5005cbc), SPH_C32(0x015d4661), SPH_C32(0x1e79e42b), + SPH_C32(0xe6c7ff85) }, + { SPH_C32(0xf43d0004), SPH_C32(0x9c436400), SPH_C32(0x37b30000), + SPH_C32(0x7f870000), SPH_C32(0xe3c644c1), SPH_C32(0x67cc8c01), + SPH_C32(0x428c1302), SPH_C32(0x50bb8cec), SPH_C32(0x83240005), + SPH_C32(0xf6c8e700), SPH_C32(0xb0a30000), SPH_C32(0x1fc80000), + SPH_C32(0xda4f6c1b), SPH_C32(0x4376de00), SPH_C32(0xdaa24f9a), + SPH_C32(0x794adc4f) }, + { SPH_C32(0x4c000004), SPH_C32(0x8a326200), SPH_C32(0x00290000), + SPH_C32(0x8a360000), SPH_C32(0xc147256d), SPH_C32(0xc9847d44), + SPH_C32(0x24a80514), SPH_C32(0x957a67d2), SPH_C32(0x7e010005), + SPH_C32(0x450cf600), SPH_C32(0x7e530000), SPH_C32(0xd1310000), + SPH_C32(0xe602199b), SPH_C32(0xce2dba93), SPH_C32(0xaa3aff3c), + SPH_C32(0x63b8c3ae) }, + { SPH_C32(0x25360007), SPH_C32(0x4b648000), SPH_C32(0xecdb0000), + SPH_C32(0xa30c0000), SPH_C32(0x90787938), SPH_C32(0x662acc0a), + SPH_C32(0x5a80ba8b), SPH_C32(0x7bacf892), SPH_C32(0x184f0004), + SPH_C32(0x5b158000), SPH_C32(0xd7390000), SPH_C32(0x28a30000), + SPH_C32(0x9c8249e2), SPH_C32(0xbda93e6b), SPH_C32(0x87fecba3), + SPH_C32(0x293e4865) }, + { SPH_C32(0x9d0b0007), SPH_C32(0x5d158600), SPH_C32(0xdb410000), + SPH_C32(0x56bd0000), SPH_C32(0xb2f91894), SPH_C32(0xc8623d4f), + SPH_C32(0x3ca4ac9d), SPH_C32(0xbe6d13ac), SPH_C32(0xe56a0004), + SPH_C32(0xe8d19100), SPH_C32(0x19c90000), SPH_C32(0xe65a0000), + SPH_C32(0xa0cf3c62), SPH_C32(0x30f25af8), SPH_C32(0xf7667b05), + SPH_C32(0x33cc5784) }, + { SPH_C32(0x50920007), SPH_C32(0x89efa700), SPH_C32(0x787f0000), + SPH_C32(0x33f90000), SPH_C32(0x6b002ed8), SPH_C32(0x2fe4c7a4), + SPH_C32(0x4de77e08), SPH_C32(0xd5739eec), SPH_C32(0xc9290004), + SPH_C32(0x40a98300), SPH_C32(0x49d50000), SPH_C32(0xde370000), + SPH_C32(0x9f800cc5), SPH_C32(0x72d9c299), SPH_C32(0x33bdd0b4), + SPH_C32(0xac41744e) }, + { SPH_C32(0xe8af0007), SPH_C32(0x9f9ea100), SPH_C32(0x4fe50000), + SPH_C32(0xc6480000), SPH_C32(0x49814f74), SPH_C32(0x81ac36e1), + SPH_C32(0x2bc3681e), SPH_C32(0x10b275d2), SPH_C32(0x340c0004), + SPH_C32(0xf36d9200), SPH_C32(0x87250000), SPH_C32(0x10ce0000), + SPH_C32(0xa3cd7945), SPH_C32(0xff82a60a), SPH_C32(0x43256012), + SPH_C32(0xb6b36baf) }, + { SPH_C32(0xf4500007), SPH_C32(0x50d88300), SPH_C32(0x72370000), + SPH_C32(0x55980000), SPH_C32(0x937a3c1f), SPH_C32(0xa95a30f8), + SPH_C32(0xeec3a19c), SPH_C32(0xfed3c4b9), SPH_C32(0xbc8d0004), + SPH_C32(0x8222a400), SPH_C32(0xdd710000), SPH_C32(0x4ec20000), + SPH_C32(0x64f85b25), SPH_C32(0x3b17c937), SPH_C32(0x24da1437), + SPH_C32(0x029e1230) }, + { SPH_C32(0x4c6d0007), SPH_C32(0x46a98500), SPH_C32(0x45ad0000), + SPH_C32(0xa0290000), SPH_C32(0xb1fb5db3), SPH_C32(0x0712c1bd), + SPH_C32(0x88e7b78a), SPH_C32(0x3b122f87), SPH_C32(0x41a80004), + SPH_C32(0x31e6b500), SPH_C32(0x13810000), SPH_C32(0x803b0000), + SPH_C32(0x58b52ea5), SPH_C32(0xb64cada4), SPH_C32(0x5442a491), + SPH_C32(0x186c0dd1) }, + { SPH_C32(0x81f40007), SPH_C32(0x9253a400), SPH_C32(0xe6930000), + SPH_C32(0xc56d0000), SPH_C32(0x68026bff), SPH_C32(0xe0943b56), + SPH_C32(0xf9a4651f), SPH_C32(0x500ca2c7), SPH_C32(0x6deb0004), + SPH_C32(0x999ea700), SPH_C32(0x439d0000), SPH_C32(0xb8560000), + SPH_C32(0x67fa1e02), SPH_C32(0xf46735c5), SPH_C32(0x90990f20), + SPH_C32(0x87e12e1b) }, + { SPH_C32(0x39c90007), SPH_C32(0x8422a200), SPH_C32(0xd1090000), + SPH_C32(0x30dc0000), SPH_C32(0x4a830a53), SPH_C32(0x4edcca13), + SPH_C32(0x9f807309), SPH_C32(0x95cd49f9), SPH_C32(0x90ce0004), + SPH_C32(0x2a5ab600), SPH_C32(0x8d6d0000), SPH_C32(0x76af0000), + SPH_C32(0x5bb76b82), SPH_C32(0x793c5156), SPH_C32(0xe001bf86), + SPH_C32(0x9d1331fa) }, + { SPH_C32(0xbe300005), SPH_C32(0x2a220000), SPH_C32(0xcec50000), + SPH_C32(0xbe780000), SPH_C32(0xa609241f), SPH_C32(0x56639098), + SPH_C32(0xab938c2c), SPH_C32(0x85b024ed), SPH_C32(0x6d860007), + SPH_C32(0x55054000), SPH_C32(0x06190000), SPH_C32(0x92490000), + SPH_C32(0x174666dc), SPH_C32(0x3af1893c), SPH_C32(0x3cd6bdbe), + SPH_C32(0x2989664e) }, + { SPH_C32(0x060d0005), SPH_C32(0x3c530600), SPH_C32(0xf95f0000), + SPH_C32(0x4bc90000), SPH_C32(0x848845b3), SPH_C32(0xf82b61dd), + SPH_C32(0xcdb79a3a), SPH_C32(0x4071cfd3), SPH_C32(0x90a30007), + SPH_C32(0xe6c15100), SPH_C32(0xc8e90000), SPH_C32(0x5cb00000), + SPH_C32(0x2b0b135c), SPH_C32(0xb7aaedaf), SPH_C32(0x4c4e0d18), + SPH_C32(0x337b79af) }, + { SPH_C32(0xcb940005), SPH_C32(0xe8a92700), SPH_C32(0x5a610000), + SPH_C32(0x2e8d0000), SPH_C32(0x5d7173ff), SPH_C32(0x1fad9b36), + SPH_C32(0xbcf448af), SPH_C32(0x2b6f4293), SPH_C32(0xbce00007), + SPH_C32(0x4eb94300), SPH_C32(0x98f50000), SPH_C32(0x64dd0000), + SPH_C32(0x144423fb), SPH_C32(0xf58175ce), SPH_C32(0x8895a6a9), + SPH_C32(0xacf65a65) }, + { SPH_C32(0x73a90005), SPH_C32(0xfed82100), SPH_C32(0x6dfb0000), + SPH_C32(0xdb3c0000), SPH_C32(0x7ff01253), SPH_C32(0xb1e56a73), + SPH_C32(0xdad05eb9), SPH_C32(0xeeaea9ad), SPH_C32(0x41c50007), + SPH_C32(0xfd7d5200), SPH_C32(0x56050000), SPH_C32(0xaa240000), + SPH_C32(0x2809567b), SPH_C32(0x78da115d), SPH_C32(0xf80d160f), + SPH_C32(0xb6044584) }, + { SPH_C32(0x6f560005), SPH_C32(0x319e0300), SPH_C32(0x50290000), + SPH_C32(0x48ec0000), SPH_C32(0xa50b6138), SPH_C32(0x99136c6a), + SPH_C32(0x1fd0973b), SPH_C32(0x00cf18c6), SPH_C32(0xc9440007), + SPH_C32(0x8c326400), SPH_C32(0x0c510000), SPH_C32(0xf4280000), + SPH_C32(0xef3c741b), SPH_C32(0xbc4f7e60), SPH_C32(0x9ff2622a), + SPH_C32(0x02293c1b) }, + { SPH_C32(0xd76b0005), SPH_C32(0x27ef0500), SPH_C32(0x67b30000), + SPH_C32(0xbd5d0000), SPH_C32(0x878a0094), SPH_C32(0x375b9d2f), + SPH_C32(0x79f4812d), SPH_C32(0xc50ef3f8), SPH_C32(0x34610007), + SPH_C32(0x3ff67500), SPH_C32(0xc2a10000), SPH_C32(0x3ad10000), + SPH_C32(0xd371019b), SPH_C32(0x31141af3), SPH_C32(0xef6ad28c), + SPH_C32(0x18db23fa) }, + { SPH_C32(0x1af20005), SPH_C32(0xf3152400), SPH_C32(0xc48d0000), + SPH_C32(0xd8190000), SPH_C32(0x5e7336d8), SPH_C32(0xd0dd67c4), + SPH_C32(0x08b753b8), SPH_C32(0xae107eb8), SPH_C32(0x18220007), + SPH_C32(0x978e6700), SPH_C32(0x92bd0000), SPH_C32(0x02bc0000), + SPH_C32(0xec3e313c), SPH_C32(0x733f8292), SPH_C32(0x2bb1793d), + SPH_C32(0x87560030) }, + { SPH_C32(0xa2cf0005), SPH_C32(0xe5642200), SPH_C32(0xf3170000), + SPH_C32(0x2da80000), SPH_C32(0x7cf25774), SPH_C32(0x7e959681), + SPH_C32(0x6e9345ae), SPH_C32(0x6bd19586), SPH_C32(0xe5070007), + SPH_C32(0x244a7600), SPH_C32(0x5c4d0000), SPH_C32(0xcc450000), + SPH_C32(0xd07344bc), SPH_C32(0xfe64e601), SPH_C32(0x5b29c99b), + SPH_C32(0x9da41fd1) }, + { SPH_C32(0xcbf90006), SPH_C32(0x2432c000), SPH_C32(0x1fe50000), + SPH_C32(0x04920000), SPH_C32(0x2dcd0b21), SPH_C32(0xd13b27cf), + SPH_C32(0x10bbfa31), SPH_C32(0x85070ac6), SPH_C32(0x83490006), + SPH_C32(0x3a530000), SPH_C32(0xf5270000), SPH_C32(0x35d70000), + SPH_C32(0xaaf314c5), SPH_C32(0x8de062f9), SPH_C32(0x76edfd04), + SPH_C32(0xd722941a) }, + { SPH_C32(0x73c40006), SPH_C32(0x3243c600), SPH_C32(0x287f0000), + SPH_C32(0xf1230000), SPH_C32(0x0f4c6a8d), SPH_C32(0x7f73d68a), + SPH_C32(0x769fec27), SPH_C32(0x40c6e1f8), SPH_C32(0x7e6c0006), + SPH_C32(0x89971100), SPH_C32(0x3bd70000), SPH_C32(0xfb2e0000), + SPH_C32(0x96be6145), SPH_C32(0x00bb066a), SPH_C32(0x06754da2), + SPH_C32(0xcdd08bfb) }, + { SPH_C32(0xbe5d0006), SPH_C32(0xe6b9e700), SPH_C32(0x8b410000), + SPH_C32(0x94670000), SPH_C32(0xd6b55cc1), SPH_C32(0x98f52c61), + SPH_C32(0x07dc3eb2), SPH_C32(0x2bd86cb8), SPH_C32(0x522f0006), + SPH_C32(0x21ef0300), SPH_C32(0x6bcb0000), SPH_C32(0xc3430000), + SPH_C32(0xa9f151e2), SPH_C32(0x42909e0b), SPH_C32(0xc2aee613), + SPH_C32(0x525da831) }, + { SPH_C32(0x06600006), SPH_C32(0xf0c8e100), SPH_C32(0xbcdb0000), + SPH_C32(0x61d60000), SPH_C32(0xf4343d6d), SPH_C32(0x36bddd24), + SPH_C32(0x61f828a4), SPH_C32(0xee198786), SPH_C32(0xaf0a0006), + SPH_C32(0x922b1200), SPH_C32(0xa53b0000), SPH_C32(0x0dba0000), + SPH_C32(0x95bc2462), SPH_C32(0xcfcbfa98), SPH_C32(0xb23656b5), + SPH_C32(0x48afb7d0) }, + { SPH_C32(0x1a9f0006), SPH_C32(0x3f8ec300), SPH_C32(0x81090000), + SPH_C32(0xf2060000), SPH_C32(0x2ecf4e06), SPH_C32(0x1e4bdb3d), + SPH_C32(0xa4f8e126), SPH_C32(0x007836ed), SPH_C32(0x278b0006), + SPH_C32(0xe3642400), SPH_C32(0xff6f0000), SPH_C32(0x53b60000), + SPH_C32(0x52890602), SPH_C32(0x0b5e95a5), SPH_C32(0xd5c92290), + SPH_C32(0xfc82ce4f) }, + { SPH_C32(0xa2a20006), SPH_C32(0x29ffc500), SPH_C32(0xb6930000), + SPH_C32(0x07b70000), SPH_C32(0x0c4e2faa), SPH_C32(0xb0032a78), + SPH_C32(0xc2dcf730), SPH_C32(0xc5b9ddd3), SPH_C32(0xdaae0006), + SPH_C32(0x50a03500), SPH_C32(0x319f0000), SPH_C32(0x9d4f0000), + SPH_C32(0x6ec47382), SPH_C32(0x8605f136), SPH_C32(0xa5519236), + SPH_C32(0xe670d1ae) }, + { SPH_C32(0x6f3b0006), SPH_C32(0xfd05e400), SPH_C32(0x15ad0000), + SPH_C32(0x62f30000), SPH_C32(0xd5b719e6), SPH_C32(0x5785d093), + SPH_C32(0xb39f25a5), SPH_C32(0xaea75093), SPH_C32(0xf6ed0006), + SPH_C32(0xf8d82700), SPH_C32(0x61830000), SPH_C32(0xa5220000), + SPH_C32(0x518b4325), SPH_C32(0xc42e6957), SPH_C32(0x618a3987), + SPH_C32(0x79fdf264) }, + { SPH_C32(0xd7060006), SPH_C32(0xeb74e200), SPH_C32(0x22370000), + SPH_C32(0x97420000), SPH_C32(0xf736784a), SPH_C32(0xf9cd21d6), + SPH_C32(0xd5bb33b3), SPH_C32(0x6b66bbad), SPH_C32(0x0bc80006), + SPH_C32(0x4b1c3600), SPH_C32(0xaf730000), SPH_C32(0x6bdb0000), + SPH_C32(0x6dc636a5), SPH_C32(0x49750dc4), SPH_C32(0x11128921), + SPH_C32(0x630fed85) } +}; + +static const sph_u32 T512_21[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x54500000), SPH_C32(0x0671005c), SPH_C32(0x25ae0000), + SPH_C32(0x6a1e0000), SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), + SPH_C32(0xbfba18c3), SPH_C32(0x7e715d17), SPH_C32(0xbc8d0000), + SPH_C32(0xfc3b0018), SPH_C32(0x19830000), SPH_C32(0xd10b0000), + SPH_C32(0xae1878c4), SPH_C32(0x42a69856), SPH_C32(0x0012da37), + SPH_C32(0x2c3b504e) }, + { SPH_C32(0xbc8d0000), SPH_C32(0xfc3b0018), SPH_C32(0x19830000), + SPH_C32(0xd10b0000), SPH_C32(0xae1878c4), SPH_C32(0x42a69856), + SPH_C32(0x0012da37), SPH_C32(0x2c3b504e), SPH_C32(0xe8dd0000), + SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), SPH_C32(0xbb150000), + SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), SPH_C32(0xbfa8c2f4), + SPH_C32(0x524a0d59) }, + { SPH_C32(0xe8dd0000), SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), + SPH_C32(0xbb150000), SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), + SPH_C32(0xbfa8c2f4), SPH_C32(0x524a0d59), SPH_C32(0x54500000), + SPH_C32(0x0671005c), SPH_C32(0x25ae0000), SPH_C32(0x6a1e0000), + SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), SPH_C32(0xbfba18c3), + SPH_C32(0x7e715d17) }, + { SPH_C32(0x69510000), SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), + SPH_C32(0xac2f0000), SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), + SPH_C32(0x87ec287c), SPH_C32(0xbce1a3ce), SPH_C32(0xc6730000), + SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), SPH_C32(0x218d0000), + SPH_C32(0x23111587), SPH_C32(0x7913512f), SPH_C32(0x1d28ac88), + SPH_C32(0x378dd173) }, + { SPH_C32(0x3d010000), SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), + SPH_C32(0xc6310000), SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), + SPH_C32(0x385630bf), SPH_C32(0xc290fed9), SPH_C32(0x7afe0000), + SPH_C32(0x53b60014), SPH_C32(0xbd420000), SPH_C32(0xf0860000), + SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), SPH_C32(0x1d3a76bf), + SPH_C32(0x1bb6813d) }, + { SPH_C32(0xd5dc0000), SPH_C32(0x28da0084), SPH_C32(0xdaa00000), + SPH_C32(0x7d240000), SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), + SPH_C32(0x87fef24b), SPH_C32(0x90daf380), SPH_C32(0x2eae0000), + SPH_C32(0x55c70048), SPH_C32(0x98ec0000), SPH_C32(0x9a980000), + SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), SPH_C32(0xa2806e7c), + SPH_C32(0x65c7dc2a) }, + { SPH_C32(0x818c0000), SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), + SPH_C32(0x173a0000), SPH_C32(0x64283db5), SPH_C32(0xea4c0898), + SPH_C32(0x3844ea88), SPH_C32(0xeeabae97), SPH_C32(0x92230000), + SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), SPH_C32(0x4b930000), + SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), SPH_C32(0xa292b44b), + SPH_C32(0x49fc8c64) }, + { SPH_C32(0xc6730000), SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), + SPH_C32(0x218d0000), SPH_C32(0x23111587), SPH_C32(0x7913512f), + SPH_C32(0x1d28ac88), SPH_C32(0x378dd173), SPH_C32(0xaf220000), + SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), SPH_C32(0x8da20000), + SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), SPH_C32(0x9ac484f4), + SPH_C32(0x8b6c72bd) }, + { SPH_C32(0x92230000), SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), + SPH_C32(0x4b930000), SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), + SPH_C32(0xa292b44b), SPH_C32(0x49fc8c64), SPH_C32(0x13af0000), + SPH_C32(0x87570088), SPH_C32(0x7e610000), SPH_C32(0x5ca90000), + SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), SPH_C32(0x9ad65ec3), + SPH_C32(0xa75722f3) }, + { SPH_C32(0x7afe0000), SPH_C32(0x53b60014), SPH_C32(0xbd420000), + SPH_C32(0xf0860000), SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), + SPH_C32(0x1d3a76bf), SPH_C32(0x1bb6813d), SPH_C32(0x47ff0000), + SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), SPH_C32(0x36b70000), + SPH_C32(0x47392832), SPH_C32(0x935f59b7), SPH_C32(0x256c4600), + SPH_C32(0xd9267fe4) }, + { SPH_C32(0x2eae0000), SPH_C32(0x55c70048), SPH_C32(0x98ec0000), + SPH_C32(0x9a980000), SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), + SPH_C32(0xa2806e7c), SPH_C32(0x65c7dc2a), SPH_C32(0xfb720000), + SPH_C32(0x7d1d00cc), SPH_C32(0x424c0000), SPH_C32(0xe7bc0000), + SPH_C32(0xe92150f6), SPH_C32(0xd1f9c1e1), SPH_C32(0x257e9c37), + SPH_C32(0xf51d2faa) }, + { SPH_C32(0xaf220000), SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), + SPH_C32(0x8da20000), SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), + SPH_C32(0x9ac484f4), SPH_C32(0x8b6c72bd), SPH_C32(0x69510000), + SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), SPH_C32(0xac2f0000), + SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), SPH_C32(0x87ec287c), + SPH_C32(0xbce1a3ce) }, + { SPH_C32(0xfb720000), SPH_C32(0x7d1d00cc), SPH_C32(0x424c0000), + SPH_C32(0xe7bc0000), SPH_C32(0xe92150f6), SPH_C32(0xd1f9c1e1), + SPH_C32(0x257e9c37), SPH_C32(0xf51d2faa), SPH_C32(0xd5dc0000), + SPH_C32(0x28da0084), SPH_C32(0xdaa00000), SPH_C32(0x7d240000), + SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), SPH_C32(0x87fef24b), + SPH_C32(0x90daf380) }, + { SPH_C32(0x13af0000), SPH_C32(0x87570088), SPH_C32(0x7e610000), + SPH_C32(0x5ca90000), SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), + SPH_C32(0x9ad65ec3), SPH_C32(0xa75722f3), SPH_C32(0x818c0000), + SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), SPH_C32(0x173a0000), + SPH_C32(0x64283db5), SPH_C32(0xea4c0898), SPH_C32(0x3844ea88), + SPH_C32(0xeeabae97) }, + { SPH_C32(0x47ff0000), SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), + SPH_C32(0x36b70000), SPH_C32(0x47392832), SPH_C32(0x935f59b7), + SPH_C32(0x256c4600), SPH_C32(0xd9267fe4), SPH_C32(0x3d010000), + SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), SPH_C32(0xc6310000), + SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), SPH_C32(0x385630bf), + SPH_C32(0xc290fed9) }, + { SPH_C32(0x0c720000), SPH_C32(0x49e50f00), SPH_C32(0x42790000), + SPH_C32(0x5cea0000), SPH_C32(0x33aa301a), SPH_C32(0x15822514), + SPH_C32(0x95a34b7b), SPH_C32(0xb44b0090), SPH_C32(0xfe220000), + SPH_C32(0xa7580500), SPH_C32(0x25d10000), SPH_C32(0xf7600000), + SPH_C32(0x893178da), SPH_C32(0x1fd4f860), SPH_C32(0x4ed0a315), + SPH_C32(0xa123ff9f) }, + { SPH_C32(0x58220000), SPH_C32(0x4f940f5c), SPH_C32(0x67d70000), + SPH_C32(0x36f40000), SPH_C32(0x1d0f7ec5), SPH_C32(0x73cca006), + SPH_C32(0x2a1953b8), SPH_C32(0xca3a5d87), SPH_C32(0x42af0000), + SPH_C32(0x5b630518), SPH_C32(0x3c520000), SPH_C32(0x266b0000), + SPH_C32(0x2729001e), SPH_C32(0x5d726036), SPH_C32(0x4ec27922), + SPH_C32(0x8d18afd1) }, + { SPH_C32(0xb0ff0000), SPH_C32(0xb5de0f18), SPH_C32(0x5bfa0000), + SPH_C32(0x8de10000), SPH_C32(0x9db248de), SPH_C32(0x5724bd42), + SPH_C32(0x95b1914c), SPH_C32(0x987050de), SPH_C32(0x16ff0000), + SPH_C32(0x5d120544), SPH_C32(0x19fc0000), SPH_C32(0x4c750000), + SPH_C32(0x098c4ec1), SPH_C32(0x3b3ce524), SPH_C32(0xf17861e1), + SPH_C32(0xf369f2c6) }, + { SPH_C32(0xe4af0000), SPH_C32(0xb3af0f44), SPH_C32(0x7e540000), + SPH_C32(0xe7ff0000), SPH_C32(0xb3170601), SPH_C32(0x316a3850), + SPH_C32(0x2a0b898f), SPH_C32(0xe6010dc9), SPH_C32(0xaa720000), + SPH_C32(0xa129055c), SPH_C32(0x007f0000), SPH_C32(0x9d7e0000), + SPH_C32(0xa7943605), SPH_C32(0x799a7d72), SPH_C32(0xf16abbd6), + SPH_C32(0xdf52a288) }, + { SPH_C32(0x65230000), SPH_C32(0x9d040f9c), SPH_C32(0x815a0000), + SPH_C32(0xf0c50000), SPH_C32(0xd73f3bb4), SPH_C32(0xdb2630c8), + SPH_C32(0x124f6307), SPH_C32(0x08aaa35e), SPH_C32(0x38510000), + SPH_C32(0x08d5050c), SPH_C32(0x81100000), SPH_C32(0xd6ed0000), + SPH_C32(0xaa206d5d), SPH_C32(0x66c7a94f), SPH_C32(0x53f80f9d), + SPH_C32(0x96ae2eec) }, + { SPH_C32(0x31730000), SPH_C32(0x9b750fc0), SPH_C32(0xa4f40000), + SPH_C32(0x9adb0000), SPH_C32(0xf99a756b), SPH_C32(0xbd68b5da), + SPH_C32(0xadf57bc4), SPH_C32(0x76dbfe49), SPH_C32(0x84dc0000), + SPH_C32(0xf4ee0514), SPH_C32(0x98930000), SPH_C32(0x07e60000), + SPH_C32(0x04381599), SPH_C32(0x24613119), SPH_C32(0x53ead5aa), + SPH_C32(0xba957ea2) }, + { SPH_C32(0xd9ae0000), SPH_C32(0x613f0f84), SPH_C32(0x98d90000), + SPH_C32(0x21ce0000), SPH_C32(0x79274370), SPH_C32(0x9980a89e), + SPH_C32(0x125db930), SPH_C32(0x2491f310), SPH_C32(0xd08c0000), + SPH_C32(0xf29f0548), SPH_C32(0xbd3d0000), SPH_C32(0x6df80000), + SPH_C32(0x2a9d5b46), SPH_C32(0x422fb40b), SPH_C32(0xec50cd69), + SPH_C32(0xc4e423b5) }, + { SPH_C32(0x8dfe0000), SPH_C32(0x674e0fd8), SPH_C32(0xbd770000), + SPH_C32(0x4bd00000), SPH_C32(0x57820daf), SPH_C32(0xffce2d8c), + SPH_C32(0xade7a1f3), SPH_C32(0x5ae0ae07), SPH_C32(0x6c010000), + SPH_C32(0x0ea40550), SPH_C32(0xa4be0000), SPH_C32(0xbcf30000), + SPH_C32(0x84852382), SPH_C32(0x00892c5d), SPH_C32(0xec42175e), + SPH_C32(0xe8df73fb) }, + { SPH_C32(0xca010000), SPH_C32(0xe6680f0c), SPH_C32(0xe6b80000), + SPH_C32(0x7d670000), SPH_C32(0x10bb259d), SPH_C32(0x6c91743b), + SPH_C32(0x888be7f3), SPH_C32(0x83c6d1e3), SPH_C32(0x51000000), + SPH_C32(0xdc340590), SPH_C32(0x42330000), SPH_C32(0x7ac20000), + SPH_C32(0x4eb566f3), SPH_C32(0xa863bc93), SPH_C32(0xd41427e1), + SPH_C32(0x2a4f8d22) }, + { SPH_C32(0x9e510000), SPH_C32(0xe0190f50), SPH_C32(0xc3160000), + SPH_C32(0x17790000), SPH_C32(0x3e1e6b42), SPH_C32(0x0adff129), + SPH_C32(0x3731ff30), SPH_C32(0xfdb78cf4), SPH_C32(0xed8d0000), + SPH_C32(0x200f0588), SPH_C32(0x5bb00000), SPH_C32(0xabc90000), + SPH_C32(0xe0ad1e37), SPH_C32(0xeac524c5), SPH_C32(0xd406fdd6), + SPH_C32(0x0674dd6c) }, + { SPH_C32(0x768c0000), SPH_C32(0x1a530f14), SPH_C32(0xff3b0000), + SPH_C32(0xac6c0000), SPH_C32(0xbea35d59), SPH_C32(0x2e37ec6d), + SPH_C32(0x88993dc4), SPH_C32(0xaffd81ad), SPH_C32(0xb9dd0000), + SPH_C32(0x267e05d4), SPH_C32(0x7e1e0000), SPH_C32(0xc1d70000), + SPH_C32(0xce0850e8), SPH_C32(0x8c8ba1d7), SPH_C32(0x6bbce515), + SPH_C32(0x7805807b) }, + { SPH_C32(0x22dc0000), SPH_C32(0x1c220f48), SPH_C32(0xda950000), + SPH_C32(0xc6720000), SPH_C32(0x90061386), SPH_C32(0x4879697f), + SPH_C32(0x37232507), SPH_C32(0xd18cdcba), SPH_C32(0x05500000), + SPH_C32(0xda4505cc), SPH_C32(0x679d0000), SPH_C32(0x10dc0000), + SPH_C32(0x6010282c), SPH_C32(0xce2d3981), SPH_C32(0x6bae3f22), + SPH_C32(0x543ed035) }, + { SPH_C32(0xa3500000), SPH_C32(0x32890f90), SPH_C32(0x259b0000), + SPH_C32(0xd1480000), SPH_C32(0xf42e2e33), SPH_C32(0xa23561e7), + SPH_C32(0x0f67cf8f), SPH_C32(0x3f27722d), SPH_C32(0x97730000), + SPH_C32(0x73b9059c), SPH_C32(0xe6f20000), SPH_C32(0x5b4f0000), + SPH_C32(0x6da47374), SPH_C32(0xd170edbc), SPH_C32(0xc93c8b69), + SPH_C32(0x1dc25c51) }, + { SPH_C32(0xf7000000), SPH_C32(0x34f80fcc), SPH_C32(0x00350000), + SPH_C32(0xbb560000), SPH_C32(0xda8b60ec), SPH_C32(0xc47be4f5), + SPH_C32(0xb0ddd74c), SPH_C32(0x41562f3a), SPH_C32(0x2bfe0000), + SPH_C32(0x8f820584), SPH_C32(0xff710000), SPH_C32(0x8a440000), + SPH_C32(0xc3bc0bb0), SPH_C32(0x93d675ea), SPH_C32(0xc92e515e), + SPH_C32(0x31f90c1f) }, + { SPH_C32(0x1fdd0000), SPH_C32(0xceb20f88), SPH_C32(0x3c180000), + SPH_C32(0x00430000), SPH_C32(0x5a3656f7), SPH_C32(0xe093f9b1), + SPH_C32(0x0f7515b8), SPH_C32(0x131c2263), SPH_C32(0x7fae0000), + SPH_C32(0x89f305d8), SPH_C32(0xdadf0000), SPH_C32(0xe05a0000), + SPH_C32(0xed19456f), SPH_C32(0xf598f0f8), SPH_C32(0x7694499d), + SPH_C32(0x4f885108) }, + { SPH_C32(0x4b8d0000), SPH_C32(0xc8c30fd4), SPH_C32(0x19b60000), + SPH_C32(0x6a5d0000), SPH_C32(0x74931828), SPH_C32(0x86dd7ca3), + SPH_C32(0xb0cf0d7b), SPH_C32(0x6d6d7f74), SPH_C32(0xc3230000), + SPH_C32(0x75c805c0), SPH_C32(0xc35c0000), SPH_C32(0x31510000), + SPH_C32(0x43013dab), SPH_C32(0xb73e68ae), SPH_C32(0x768693aa), + SPH_C32(0x63b30146) }, + { SPH_C32(0xfe220000), SPH_C32(0xa7580500), SPH_C32(0x25d10000), + SPH_C32(0xf7600000), SPH_C32(0x893178da), SPH_C32(0x1fd4f860), + SPH_C32(0x4ed0a315), SPH_C32(0xa123ff9f), SPH_C32(0xf2500000), + SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), SPH_C32(0xab8a0000), + SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), SPH_C32(0xdb73e86e), + SPH_C32(0x1568ff0f) }, + { SPH_C32(0xaa720000), SPH_C32(0xa129055c), SPH_C32(0x007f0000), + SPH_C32(0x9d7e0000), SPH_C32(0xa7943605), SPH_C32(0x799a7d72), + SPH_C32(0xf16abbd6), SPH_C32(0xdf52a288), SPH_C32(0x4edd0000), + SPH_C32(0x12860a18), SPH_C32(0x7e2b0000), SPH_C32(0x7a810000), + SPH_C32(0x14833004), SPH_C32(0x48f04522), SPH_C32(0xdb613259), + SPH_C32(0x3953af41) }, + { SPH_C32(0x42af0000), SPH_C32(0x5b630518), SPH_C32(0x3c520000), + SPH_C32(0x266b0000), SPH_C32(0x2729001e), SPH_C32(0x5d726036), + SPH_C32(0x4ec27922), SPH_C32(0x8d18afd1), SPH_C32(0x1a8d0000), + SPH_C32(0x14f70a44), SPH_C32(0x5b850000), SPH_C32(0x109f0000), + SPH_C32(0x3a267edb), SPH_C32(0x2ebec030), SPH_C32(0x64db2a9a), + SPH_C32(0x4722f256) }, + { SPH_C32(0x16ff0000), SPH_C32(0x5d120544), SPH_C32(0x19fc0000), + SPH_C32(0x4c750000), SPH_C32(0x098c4ec1), SPH_C32(0x3b3ce524), + SPH_C32(0xf17861e1), SPH_C32(0xf369f2c6), SPH_C32(0xa6000000), + SPH_C32(0xe8cc0a5c), SPH_C32(0x42060000), SPH_C32(0xc1940000), + SPH_C32(0x943e061f), SPH_C32(0x6c185866), SPH_C32(0x64c9f0ad), + SPH_C32(0x6b19a218) }, + { SPH_C32(0x97730000), SPH_C32(0x73b9059c), SPH_C32(0xe6f20000), + SPH_C32(0x5b4f0000), SPH_C32(0x6da47374), SPH_C32(0xd170edbc), + SPH_C32(0xc93c8b69), SPH_C32(0x1dc25c51), SPH_C32(0x34230000), + SPH_C32(0x41300a0c), SPH_C32(0xc3690000), SPH_C32(0x8a070000), + SPH_C32(0x998a5d47), SPH_C32(0x73458c5b), SPH_C32(0xc65b44e6), + SPH_C32(0x22e52e7c) }, + { SPH_C32(0xc3230000), SPH_C32(0x75c805c0), SPH_C32(0xc35c0000), + SPH_C32(0x31510000), SPH_C32(0x43013dab), SPH_C32(0xb73e68ae), + SPH_C32(0x768693aa), SPH_C32(0x63b30146), SPH_C32(0x88ae0000), + SPH_C32(0xbd0b0a14), SPH_C32(0xdaea0000), SPH_C32(0x5b0c0000), + SPH_C32(0x37922583), SPH_C32(0x31e3140d), SPH_C32(0xc6499ed1), + SPH_C32(0x0ede7e32) }, + { SPH_C32(0x2bfe0000), SPH_C32(0x8f820584), SPH_C32(0xff710000), + SPH_C32(0x8a440000), SPH_C32(0xc3bc0bb0), SPH_C32(0x93d675ea), + SPH_C32(0xc92e515e), SPH_C32(0x31f90c1f), SPH_C32(0xdcfe0000), + SPH_C32(0xbb7a0a48), SPH_C32(0xff440000), SPH_C32(0x31120000), + SPH_C32(0x19376b5c), SPH_C32(0x57ad911f), SPH_C32(0x79f38612), + SPH_C32(0x70af2325) }, + { SPH_C32(0x7fae0000), SPH_C32(0x89f305d8), SPH_C32(0xdadf0000), + SPH_C32(0xe05a0000), SPH_C32(0xed19456f), SPH_C32(0xf598f0f8), + SPH_C32(0x7694499d), SPH_C32(0x4f885108), SPH_C32(0x60730000), + SPH_C32(0x47410a50), SPH_C32(0xe6c70000), SPH_C32(0xe0190000), + SPH_C32(0xb72f1398), SPH_C32(0x150b0949), SPH_C32(0x79e15c25), + SPH_C32(0x5c94736b) }, + { SPH_C32(0x38510000), SPH_C32(0x08d5050c), SPH_C32(0x81100000), + SPH_C32(0xd6ed0000), SPH_C32(0xaa206d5d), SPH_C32(0x66c7a94f), + SPH_C32(0x53f80f9d), SPH_C32(0x96ae2eec), SPH_C32(0x5d720000), + SPH_C32(0x95d10a90), SPH_C32(0x004a0000), SPH_C32(0x26280000), + SPH_C32(0x7d1f56e9), SPH_C32(0xbde19987), SPH_C32(0x41b76c9a), + SPH_C32(0x9e048db2) }, + { SPH_C32(0x6c010000), SPH_C32(0x0ea40550), SPH_C32(0xa4be0000), + SPH_C32(0xbcf30000), SPH_C32(0x84852382), SPH_C32(0x00892c5d), + SPH_C32(0xec42175e), SPH_C32(0xe8df73fb), SPH_C32(0xe1ff0000), + SPH_C32(0x69ea0a88), SPH_C32(0x19c90000), SPH_C32(0xf7230000), + SPH_C32(0xd3072e2d), SPH_C32(0xff4701d1), SPH_C32(0x41a5b6ad), + SPH_C32(0xb23fddfc) }, + { SPH_C32(0x84dc0000), SPH_C32(0xf4ee0514), SPH_C32(0x98930000), + SPH_C32(0x07e60000), SPH_C32(0x04381599), SPH_C32(0x24613119), + SPH_C32(0x53ead5aa), SPH_C32(0xba957ea2), SPH_C32(0xb5af0000), + SPH_C32(0x6f9b0ad4), SPH_C32(0x3c670000), SPH_C32(0x9d3d0000), + SPH_C32(0xfda260f2), SPH_C32(0x990984c3), SPH_C32(0xfe1fae6e), + SPH_C32(0xcc4e80eb) }, + { SPH_C32(0xd08c0000), SPH_C32(0xf29f0548), SPH_C32(0xbd3d0000), + SPH_C32(0x6df80000), SPH_C32(0x2a9d5b46), SPH_C32(0x422fb40b), + SPH_C32(0xec50cd69), SPH_C32(0xc4e423b5), SPH_C32(0x09220000), + SPH_C32(0x93a00acc), SPH_C32(0x25e40000), SPH_C32(0x4c360000), + SPH_C32(0x53ba1836), SPH_C32(0xdbaf1c95), SPH_C32(0xfe0d7459), + SPH_C32(0xe075d0a5) }, + { SPH_C32(0x51000000), SPH_C32(0xdc340590), SPH_C32(0x42330000), + SPH_C32(0x7ac20000), SPH_C32(0x4eb566f3), SPH_C32(0xa863bc93), + SPH_C32(0xd41427e1), SPH_C32(0x2a4f8d22), SPH_C32(0x9b010000), + SPH_C32(0x3a5c0a9c), SPH_C32(0xa48b0000), SPH_C32(0x07a50000), + SPH_C32(0x5e0e436e), SPH_C32(0xc4f2c8a8), SPH_C32(0x5c9fc012), + SPH_C32(0xa9895cc1) }, + { SPH_C32(0x05500000), SPH_C32(0xda4505cc), SPH_C32(0x679d0000), + SPH_C32(0x10dc0000), SPH_C32(0x6010282c), SPH_C32(0xce2d3981), + SPH_C32(0x6bae3f22), SPH_C32(0x543ed035), SPH_C32(0x278c0000), + SPH_C32(0xc6670a84), SPH_C32(0xbd080000), SPH_C32(0xd6ae0000), + SPH_C32(0xf0163baa), SPH_C32(0x865450fe), SPH_C32(0x5c8d1a25), + SPH_C32(0x85b20c8f) }, + { SPH_C32(0xed8d0000), SPH_C32(0x200f0588), SPH_C32(0x5bb00000), + SPH_C32(0xabc90000), SPH_C32(0xe0ad1e37), SPH_C32(0xeac524c5), + SPH_C32(0xd406fdd6), SPH_C32(0x0674dd6c), SPH_C32(0x73dc0000), + SPH_C32(0xc0160ad8), SPH_C32(0x98a60000), SPH_C32(0xbcb00000), + SPH_C32(0xdeb37575), SPH_C32(0xe01ad5ec), SPH_C32(0xe33702e6), + SPH_C32(0xfbc35198) }, + { SPH_C32(0xb9dd0000), SPH_C32(0x267e05d4), SPH_C32(0x7e1e0000), + SPH_C32(0xc1d70000), SPH_C32(0xce0850e8), SPH_C32(0x8c8ba1d7), + SPH_C32(0x6bbce515), SPH_C32(0x7805807b), SPH_C32(0xcf510000), + SPH_C32(0x3c2d0ac0), SPH_C32(0x81250000), SPH_C32(0x6dbb0000), + SPH_C32(0x70ab0db1), SPH_C32(0xa2bc4dba), SPH_C32(0xe325d8d1), + SPH_C32(0xd7f801d6) }, + { SPH_C32(0xf2500000), SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), + SPH_C32(0xab8a0000), SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), + SPH_C32(0xdb73e86e), SPH_C32(0x1568ff0f), SPH_C32(0x0c720000), + SPH_C32(0x49e50f00), SPH_C32(0x42790000), SPH_C32(0x5cea0000), + SPH_C32(0x33aa301a), SPH_C32(0x15822514), SPH_C32(0x95a34b7b), + SPH_C32(0xb44b0090) }, + { SPH_C32(0xa6000000), SPH_C32(0xe8cc0a5c), SPH_C32(0x42060000), + SPH_C32(0xc1940000), SPH_C32(0x943e061f), SPH_C32(0x6c185866), + SPH_C32(0x64c9f0ad), SPH_C32(0x6b19a218), SPH_C32(0xb0ff0000), + SPH_C32(0xb5de0f18), SPH_C32(0x5bfa0000), SPH_C32(0x8de10000), + SPH_C32(0x9db248de), SPH_C32(0x5724bd42), SPH_C32(0x95b1914c), + SPH_C32(0x987050de) }, + { SPH_C32(0x4edd0000), SPH_C32(0x12860a18), SPH_C32(0x7e2b0000), + SPH_C32(0x7a810000), SPH_C32(0x14833004), SPH_C32(0x48f04522), + SPH_C32(0xdb613259), SPH_C32(0x3953af41), SPH_C32(0xe4af0000), + SPH_C32(0xb3af0f44), SPH_C32(0x7e540000), SPH_C32(0xe7ff0000), + SPH_C32(0xb3170601), SPH_C32(0x316a3850), SPH_C32(0x2a0b898f), + SPH_C32(0xe6010dc9) }, + { SPH_C32(0x1a8d0000), SPH_C32(0x14f70a44), SPH_C32(0x5b850000), + SPH_C32(0x109f0000), SPH_C32(0x3a267edb), SPH_C32(0x2ebec030), + SPH_C32(0x64db2a9a), SPH_C32(0x4722f256), SPH_C32(0x58220000), + SPH_C32(0x4f940f5c), SPH_C32(0x67d70000), SPH_C32(0x36f40000), + SPH_C32(0x1d0f7ec5), SPH_C32(0x73cca006), SPH_C32(0x2a1953b8), + SPH_C32(0xca3a5d87) }, + { SPH_C32(0x9b010000), SPH_C32(0x3a5c0a9c), SPH_C32(0xa48b0000), + SPH_C32(0x07a50000), SPH_C32(0x5e0e436e), SPH_C32(0xc4f2c8a8), + SPH_C32(0x5c9fc012), SPH_C32(0xa9895cc1), SPH_C32(0xca010000), + SPH_C32(0xe6680f0c), SPH_C32(0xe6b80000), SPH_C32(0x7d670000), + SPH_C32(0x10bb259d), SPH_C32(0x6c91743b), SPH_C32(0x888be7f3), + SPH_C32(0x83c6d1e3) }, + { SPH_C32(0xcf510000), SPH_C32(0x3c2d0ac0), SPH_C32(0x81250000), + SPH_C32(0x6dbb0000), SPH_C32(0x70ab0db1), SPH_C32(0xa2bc4dba), + SPH_C32(0xe325d8d1), SPH_C32(0xd7f801d6), SPH_C32(0x768c0000), + SPH_C32(0x1a530f14), SPH_C32(0xff3b0000), SPH_C32(0xac6c0000), + SPH_C32(0xbea35d59), SPH_C32(0x2e37ec6d), SPH_C32(0x88993dc4), + SPH_C32(0xaffd81ad) }, + { SPH_C32(0x278c0000), SPH_C32(0xc6670a84), SPH_C32(0xbd080000), + SPH_C32(0xd6ae0000), SPH_C32(0xf0163baa), SPH_C32(0x865450fe), + SPH_C32(0x5c8d1a25), SPH_C32(0x85b20c8f), SPH_C32(0x22dc0000), + SPH_C32(0x1c220f48), SPH_C32(0xda950000), SPH_C32(0xc6720000), + SPH_C32(0x90061386), SPH_C32(0x4879697f), SPH_C32(0x37232507), + SPH_C32(0xd18cdcba) }, + { SPH_C32(0x73dc0000), SPH_C32(0xc0160ad8), SPH_C32(0x98a60000), + SPH_C32(0xbcb00000), SPH_C32(0xdeb37575), SPH_C32(0xe01ad5ec), + SPH_C32(0xe33702e6), SPH_C32(0xfbc35198), SPH_C32(0x9e510000), + SPH_C32(0xe0190f50), SPH_C32(0xc3160000), SPH_C32(0x17790000), + SPH_C32(0x3e1e6b42), SPH_C32(0x0adff129), SPH_C32(0x3731ff30), + SPH_C32(0xfdb78cf4) }, + { SPH_C32(0x34230000), SPH_C32(0x41300a0c), SPH_C32(0xc3690000), + SPH_C32(0x8a070000), SPH_C32(0x998a5d47), SPH_C32(0x73458c5b), + SPH_C32(0xc65b44e6), SPH_C32(0x22e52e7c), SPH_C32(0xa3500000), + SPH_C32(0x32890f90), SPH_C32(0x259b0000), SPH_C32(0xd1480000), + SPH_C32(0xf42e2e33), SPH_C32(0xa23561e7), SPH_C32(0x0f67cf8f), + SPH_C32(0x3f27722d) }, + { SPH_C32(0x60730000), SPH_C32(0x47410a50), SPH_C32(0xe6c70000), + SPH_C32(0xe0190000), SPH_C32(0xb72f1398), SPH_C32(0x150b0949), + SPH_C32(0x79e15c25), SPH_C32(0x5c94736b), SPH_C32(0x1fdd0000), + SPH_C32(0xceb20f88), SPH_C32(0x3c180000), SPH_C32(0x00430000), + SPH_C32(0x5a3656f7), SPH_C32(0xe093f9b1), SPH_C32(0x0f7515b8), + SPH_C32(0x131c2263) }, + { SPH_C32(0x88ae0000), SPH_C32(0xbd0b0a14), SPH_C32(0xdaea0000), + SPH_C32(0x5b0c0000), SPH_C32(0x37922583), SPH_C32(0x31e3140d), + SPH_C32(0xc6499ed1), SPH_C32(0x0ede7e32), SPH_C32(0x4b8d0000), + SPH_C32(0xc8c30fd4), SPH_C32(0x19b60000), SPH_C32(0x6a5d0000), + SPH_C32(0x74931828), SPH_C32(0x86dd7ca3), SPH_C32(0xb0cf0d7b), + SPH_C32(0x6d6d7f74) }, + { SPH_C32(0xdcfe0000), SPH_C32(0xbb7a0a48), SPH_C32(0xff440000), + SPH_C32(0x31120000), SPH_C32(0x19376b5c), SPH_C32(0x57ad911f), + SPH_C32(0x79f38612), SPH_C32(0x70af2325), SPH_C32(0xf7000000), + SPH_C32(0x34f80fcc), SPH_C32(0x00350000), SPH_C32(0xbb560000), + SPH_C32(0xda8b60ec), SPH_C32(0xc47be4f5), SPH_C32(0xb0ddd74c), + SPH_C32(0x41562f3a) }, + { SPH_C32(0x5d720000), SPH_C32(0x95d10a90), SPH_C32(0x004a0000), + SPH_C32(0x26280000), SPH_C32(0x7d1f56e9), SPH_C32(0xbde19987), + SPH_C32(0x41b76c9a), SPH_C32(0x9e048db2), SPH_C32(0x65230000), + SPH_C32(0x9d040f9c), SPH_C32(0x815a0000), SPH_C32(0xf0c50000), + SPH_C32(0xd73f3bb4), SPH_C32(0xdb2630c8), SPH_C32(0x124f6307), + SPH_C32(0x08aaa35e) }, + { SPH_C32(0x09220000), SPH_C32(0x93a00acc), SPH_C32(0x25e40000), + SPH_C32(0x4c360000), SPH_C32(0x53ba1836), SPH_C32(0xdbaf1c95), + SPH_C32(0xfe0d7459), SPH_C32(0xe075d0a5), SPH_C32(0xd9ae0000), + SPH_C32(0x613f0f84), SPH_C32(0x98d90000), SPH_C32(0x21ce0000), + SPH_C32(0x79274370), SPH_C32(0x9980a89e), SPH_C32(0x125db930), + SPH_C32(0x2491f310) }, + { SPH_C32(0xe1ff0000), SPH_C32(0x69ea0a88), SPH_C32(0x19c90000), + SPH_C32(0xf7230000), SPH_C32(0xd3072e2d), SPH_C32(0xff4701d1), + SPH_C32(0x41a5b6ad), SPH_C32(0xb23fddfc), SPH_C32(0x8dfe0000), + SPH_C32(0x674e0fd8), SPH_C32(0xbd770000), SPH_C32(0x4bd00000), + SPH_C32(0x57820daf), SPH_C32(0xffce2d8c), SPH_C32(0xade7a1f3), + SPH_C32(0x5ae0ae07) }, + { SPH_C32(0xb5af0000), SPH_C32(0x6f9b0ad4), SPH_C32(0x3c670000), + SPH_C32(0x9d3d0000), SPH_C32(0xfda260f2), SPH_C32(0x990984c3), + SPH_C32(0xfe1fae6e), SPH_C32(0xcc4e80eb), SPH_C32(0x31730000), + SPH_C32(0x9b750fc0), SPH_C32(0xa4f40000), SPH_C32(0x9adb0000), + SPH_C32(0xf99a756b), SPH_C32(0xbd68b5da), SPH_C32(0xadf57bc4), + SPH_C32(0x76dbfe49) }, + { SPH_C32(0x45180000), SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), + SPH_C32(0x3b480000), SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), + SPH_C32(0x16bca6b0), SPH_C32(0xdf33f4df), SPH_C32(0xb83d0000), + SPH_C32(0x16710600), SPH_C32(0x379a0000), SPH_C32(0xf5b10000), + SPH_C32(0x228161ac), SPH_C32(0xae48f145), SPH_C32(0x66241616), + SPH_C32(0xc5c1eb3e) }, + { SPH_C32(0x11480000), SPH_C32(0xa3c4175c), SPH_C32(0xdcc40000), + SPH_C32(0x51560000), SPH_C32(0x30695af3), SPH_C32(0x455d10c4), + SPH_C32(0xa906be73), SPH_C32(0xa142a9c8), SPH_C32(0x04b00000), + SPH_C32(0xea4a0618), SPH_C32(0x2e190000), SPH_C32(0x24ba0000), + SPH_C32(0x8c991968), SPH_C32(0xecee6913), SPH_C32(0x6636cc21), + SPH_C32(0xe9fabb70) }, + { SPH_C32(0xf9950000), SPH_C32(0x598e1718), SPH_C32(0xe0e90000), + SPH_C32(0xea430000), SPH_C32(0xb0d46ce8), SPH_C32(0x61b50d80), + SPH_C32(0x16ae7c87), SPH_C32(0xf308a491), SPH_C32(0x50e00000), + SPH_C32(0xec3b0644), SPH_C32(0x0bb70000), SPH_C32(0x4ea40000), + SPH_C32(0xa23c57b7), SPH_C32(0x8aa0ec01), SPH_C32(0xd98cd4e2), + SPH_C32(0x978be667) }, + { SPH_C32(0xadc50000), SPH_C32(0x5fff1744), SPH_C32(0xc5470000), + SPH_C32(0x805d0000), SPH_C32(0x9e712237), SPH_C32(0x07fb8892), + SPH_C32(0xa9146444), SPH_C32(0x8d79f986), SPH_C32(0xec6d0000), + SPH_C32(0x1000065c), SPH_C32(0x12340000), SPH_C32(0x9faf0000), + SPH_C32(0x0c242f73), SPH_C32(0xc8067457), SPH_C32(0xd99e0ed5), + SPH_C32(0xbbb0b629) }, + { SPH_C32(0x2c490000), SPH_C32(0x7154179c), SPH_C32(0x3a490000), + SPH_C32(0x97670000), SPH_C32(0xfa591f82), SPH_C32(0xedb7800a), + SPH_C32(0x91508ecc), SPH_C32(0x63d25711), SPH_C32(0x7e4e0000), + SPH_C32(0xb9fc060c), SPH_C32(0x935b0000), SPH_C32(0xd43c0000), + SPH_C32(0x0190742b), SPH_C32(0xd75ba06a), SPH_C32(0x7b0cba9e), + SPH_C32(0xf24c3a4d) }, + { SPH_C32(0x78190000), SPH_C32(0x772517c0), SPH_C32(0x1fe70000), + SPH_C32(0xfd790000), SPH_C32(0xd4fc515d), SPH_C32(0x8bf90518), + SPH_C32(0x2eea960f), SPH_C32(0x1da30a06), SPH_C32(0xc2c30000), + SPH_C32(0x45c70614), SPH_C32(0x8ad80000), SPH_C32(0x05370000), + SPH_C32(0xaf880cef), SPH_C32(0x95fd383c), SPH_C32(0x7b1e60a9), + SPH_C32(0xde776a03) }, + { SPH_C32(0x90c40000), SPH_C32(0x8d6f1784), SPH_C32(0x23ca0000), + SPH_C32(0x466c0000), SPH_C32(0x54416746), SPH_C32(0xaf11185c), + SPH_C32(0x914254fb), SPH_C32(0x4fe9075f), SPH_C32(0x96930000), + SPH_C32(0x43b60648), SPH_C32(0xaf760000), SPH_C32(0x6f290000), + SPH_C32(0x812d4230), SPH_C32(0xf3b3bd2e), SPH_C32(0xc4a4786a), + SPH_C32(0xa0063714) }, + { SPH_C32(0xc4940000), SPH_C32(0x8b1e17d8), SPH_C32(0x06640000), + SPH_C32(0x2c720000), SPH_C32(0x7ae42999), SPH_C32(0xc95f9d4e), + SPH_C32(0x2ef84c38), SPH_C32(0x31985a48), SPH_C32(0x2a1e0000), + SPH_C32(0xbf8d0650), SPH_C32(0xb6f50000), SPH_C32(0xbe220000), + SPH_C32(0x2f353af4), SPH_C32(0xb1152578), SPH_C32(0xc4b6a25d), + SPH_C32(0x8c3d675a) }, + { SPH_C32(0x836b0000), SPH_C32(0x0a38170c), SPH_C32(0x5dab0000), + SPH_C32(0x1ac50000), SPH_C32(0x3ddd01ab), SPH_C32(0x5a00c4f9), + SPH_C32(0x0b940a38), SPH_C32(0xe8be25ac), SPH_C32(0x171f0000), + SPH_C32(0x6d1d0690), SPH_C32(0x50780000), SPH_C32(0x78130000), + SPH_C32(0xe5057f85), SPH_C32(0x19ffb5b6), SPH_C32(0xfce092e2), + SPH_C32(0x4ead9983) }, + { SPH_C32(0xd73b0000), SPH_C32(0x0c491750), SPH_C32(0x78050000), + SPH_C32(0x70db0000), SPH_C32(0x13784f74), SPH_C32(0x3c4e41eb), + SPH_C32(0xb42e12fb), SPH_C32(0x96cf78bb), SPH_C32(0xab920000), + SPH_C32(0x91260688), SPH_C32(0x49fb0000), SPH_C32(0xa9180000), + SPH_C32(0x4b1d0741), SPH_C32(0x5b592de0), SPH_C32(0xfcf248d5), + SPH_C32(0x6296c9cd) }, + { SPH_C32(0x3fe60000), SPH_C32(0xf6031714), SPH_C32(0x44280000), + SPH_C32(0xcbce0000), SPH_C32(0x93c5796f), SPH_C32(0x18a65caf), + SPH_C32(0x0b86d00f), SPH_C32(0xc48575e2), SPH_C32(0xffc20000), + SPH_C32(0x975706d4), SPH_C32(0x6c550000), SPH_C32(0xc3060000), + SPH_C32(0x65b8499e), SPH_C32(0x3d17a8f2), SPH_C32(0x43485016), + SPH_C32(0x1ce794da) }, + { SPH_C32(0x6bb60000), SPH_C32(0xf0721748), SPH_C32(0x61860000), + SPH_C32(0xa1d00000), SPH_C32(0xbd6037b0), SPH_C32(0x7ee8d9bd), + SPH_C32(0xb43cc8cc), SPH_C32(0xbaf428f5), SPH_C32(0x434f0000), + SPH_C32(0x6b6c06cc), SPH_C32(0x75d60000), SPH_C32(0x120d0000), + SPH_C32(0xcba0315a), SPH_C32(0x7fb130a4), SPH_C32(0x435a8a21), + SPH_C32(0x30dcc494) }, + { SPH_C32(0xea3a0000), SPH_C32(0xded91790), SPH_C32(0x9e880000), + SPH_C32(0xb6ea0000), SPH_C32(0xd9480a05), SPH_C32(0x94a4d125), + SPH_C32(0x8c782244), SPH_C32(0x545f8662), SPH_C32(0xd16c0000), + SPH_C32(0xc290069c), SPH_C32(0xf4b90000), SPH_C32(0x599e0000), + SPH_C32(0xc6146a02), SPH_C32(0x60ece499), SPH_C32(0xe1c83e6a), + SPH_C32(0x792048f0) }, + { SPH_C32(0xbe6a0000), SPH_C32(0xd8a817cc), SPH_C32(0xbb260000), + SPH_C32(0xdcf40000), SPH_C32(0xf7ed44da), SPH_C32(0xf2ea5437), + SPH_C32(0x33c23a87), SPH_C32(0x2a2edb75), SPH_C32(0x6de10000), + SPH_C32(0x3eab0684), SPH_C32(0xed3a0000), SPH_C32(0x88950000), + SPH_C32(0x680c12c6), SPH_C32(0x224a7ccf), SPH_C32(0xe1dae45d), + SPH_C32(0x551b18be) }, + { SPH_C32(0x56b70000), SPH_C32(0x22e21788), SPH_C32(0x870b0000), + SPH_C32(0x67e10000), SPH_C32(0x775072c1), SPH_C32(0xd6024973), + SPH_C32(0x8c6af873), SPH_C32(0x7864d62c), SPH_C32(0x39b10000), + SPH_C32(0x38da06d8), SPH_C32(0xc8940000), SPH_C32(0xe28b0000), + SPH_C32(0x46a95c19), SPH_C32(0x4404f9dd), SPH_C32(0x5e60fc9e), + SPH_C32(0x2b6a45a9) }, + { SPH_C32(0x02e70000), SPH_C32(0x249317d4), SPH_C32(0xa2a50000), + SPH_C32(0x0dff0000), SPH_C32(0x59f53c1e), SPH_C32(0xb04ccc61), + SPH_C32(0x33d0e0b0), SPH_C32(0x06158b3b), SPH_C32(0x853c0000), + SPH_C32(0xc4e106c0), SPH_C32(0xd1170000), SPH_C32(0x33800000), + SPH_C32(0xe8b124dd), SPH_C32(0x06a2618b), SPH_C32(0x5e7226a9), + SPH_C32(0x075115e7) }, + { SPH_C32(0x496a0000), SPH_C32(0xec501800), SPH_C32(0xbb130000), + SPH_C32(0x67a20000), SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), + SPH_C32(0x831fedcb), SPH_C32(0x6b78f44f), SPH_C32(0x461f0000), + SPH_C32(0xb1290300), SPH_C32(0x124b0000), SPH_C32(0x02d10000), + SPH_C32(0xabb01976), SPH_C32(0xb19c0925), SPH_C32(0x28f4b503), + SPH_C32(0x64e214a1) }, + { SPH_C32(0x1d3a0000), SPH_C32(0xea21185c), SPH_C32(0x9ebd0000), + SPH_C32(0x0dbc0000), SPH_C32(0x03c36ae9), SPH_C32(0x50df35d0), + SPH_C32(0x3ca5f508), SPH_C32(0x1509a958), SPH_C32(0xfa920000), + SPH_C32(0x4d120318), SPH_C32(0x0bc80000), SPH_C32(0xd3da0000), + SPH_C32(0x05a861b2), SPH_C32(0xf33a9173), SPH_C32(0x28e66f34), + SPH_C32(0x48d944ef) }, + { SPH_C32(0xf5e70000), SPH_C32(0x106b1818), SPH_C32(0xa2900000), + SPH_C32(0xb6a90000), SPH_C32(0x837e5cf2), SPH_C32(0x74372894), + SPH_C32(0x830d37fc), SPH_C32(0x4743a401), SPH_C32(0xaec20000), + SPH_C32(0x4b630344), SPH_C32(0x2e660000), SPH_C32(0xb9c40000), + SPH_C32(0x2b0d2f6d), SPH_C32(0x95741461), SPH_C32(0x975c77f7), + SPH_C32(0x36a819f8) }, + { SPH_C32(0xa1b70000), SPH_C32(0x161a1844), SPH_C32(0x873e0000), + SPH_C32(0xdcb70000), SPH_C32(0xaddb122d), SPH_C32(0x1279ad86), + SPH_C32(0x3cb72f3f), SPH_C32(0x3932f916), SPH_C32(0x124f0000), + SPH_C32(0xb758035c), SPH_C32(0x37e50000), SPH_C32(0x68cf0000), + SPH_C32(0x851557a9), SPH_C32(0xd7d28c37), SPH_C32(0x974eadc0), + SPH_C32(0x1a9349b6) }, + { SPH_C32(0x203b0000), SPH_C32(0x38b1189c), SPH_C32(0x78300000), + SPH_C32(0xcb8d0000), SPH_C32(0xc9f32f98), SPH_C32(0xf835a51e), + SPH_C32(0x04f3c5b7), SPH_C32(0xd7995781), SPH_C32(0x806c0000), + SPH_C32(0x1ea4030c), SPH_C32(0xb68a0000), SPH_C32(0x235c0000), + SPH_C32(0x88a10cf1), SPH_C32(0xc88f580a), SPH_C32(0x35dc198b), + SPH_C32(0x536fc5d2) }, + { SPH_C32(0x746b0000), SPH_C32(0x3ec018c0), SPH_C32(0x5d9e0000), + SPH_C32(0xa1930000), SPH_C32(0xe7566147), SPH_C32(0x9e7b200c), + SPH_C32(0xbb49dd74), SPH_C32(0xa9e80a96), SPH_C32(0x3ce10000), + SPH_C32(0xe29f0314), SPH_C32(0xaf090000), SPH_C32(0xf2570000), + SPH_C32(0x26b97435), SPH_C32(0x8a29c05c), SPH_C32(0x35cec3bc), + SPH_C32(0x7f54959c) }, + { SPH_C32(0x9cb60000), SPH_C32(0xc48a1884), SPH_C32(0x61b30000), + SPH_C32(0x1a860000), SPH_C32(0x67eb575c), SPH_C32(0xba933d48), + SPH_C32(0x04e11f80), SPH_C32(0xfba207cf), SPH_C32(0x68b10000), + SPH_C32(0xe4ee0348), SPH_C32(0x8aa70000), SPH_C32(0x98490000), + SPH_C32(0x081c3aea), SPH_C32(0xec67454e), SPH_C32(0x8a74db7f), + SPH_C32(0x0125c88b) }, + { SPH_C32(0xc8e60000), SPH_C32(0xc2fb18d8), SPH_C32(0x441d0000), + SPH_C32(0x70980000), SPH_C32(0x494e1983), SPH_C32(0xdcddb85a), + SPH_C32(0xbb5b0743), SPH_C32(0x85d35ad8), SPH_C32(0xd43c0000), + SPH_C32(0x18d50350), SPH_C32(0x93240000), SPH_C32(0x49420000), + SPH_C32(0xa604422e), SPH_C32(0xaec1dd18), SPH_C32(0x8a660148), + SPH_C32(0x2d1e98c5) }, + { SPH_C32(0x8f190000), SPH_C32(0x43dd180c), SPH_C32(0x1fd20000), + SPH_C32(0x462f0000), SPH_C32(0x0e7731b1), SPH_C32(0x4f82e1ed), + SPH_C32(0x9e374143), SPH_C32(0x5cf5253c), SPH_C32(0xe93d0000), + SPH_C32(0xca450390), SPH_C32(0x75a90000), SPH_C32(0x8f730000), + SPH_C32(0x6c34075f), SPH_C32(0x062b4dd6), SPH_C32(0xb23031f7), + SPH_C32(0xef8e661c) }, + { SPH_C32(0xdb490000), SPH_C32(0x45ac1850), SPH_C32(0x3a7c0000), + SPH_C32(0x2c310000), SPH_C32(0x20d27f6e), SPH_C32(0x29cc64ff), + SPH_C32(0x218d5980), SPH_C32(0x2284782b), SPH_C32(0x55b00000), + SPH_C32(0x367e0388), SPH_C32(0x6c2a0000), SPH_C32(0x5e780000), + SPH_C32(0xc22c7f9b), SPH_C32(0x448dd580), SPH_C32(0xb222ebc0), + SPH_C32(0xc3b53652) }, + { SPH_C32(0x33940000), SPH_C32(0xbfe61814), SPH_C32(0x06510000), + SPH_C32(0x97240000), SPH_C32(0xa06f4975), SPH_C32(0x0d2479bb), + SPH_C32(0x9e259b74), SPH_C32(0x70ce7572), SPH_C32(0x01e00000), + SPH_C32(0x300f03d4), SPH_C32(0x49840000), SPH_C32(0x34660000), + SPH_C32(0xec893144), SPH_C32(0x22c35092), SPH_C32(0x0d98f303), + SPH_C32(0xbdc46b45) }, + { SPH_C32(0x67c40000), SPH_C32(0xb9971848), SPH_C32(0x23ff0000), + SPH_C32(0xfd3a0000), SPH_C32(0x8eca07aa), SPH_C32(0x6b6afca9), + SPH_C32(0x219f83b7), SPH_C32(0x0ebf2865), SPH_C32(0xbd6d0000), + SPH_C32(0xcc3403cc), SPH_C32(0x50070000), SPH_C32(0xe56d0000), + SPH_C32(0x42914980), SPH_C32(0x6065c8c4), SPH_C32(0x0d8a2934), + SPH_C32(0x91ff3b0b) }, + { SPH_C32(0xe6480000), SPH_C32(0x973c1890), SPH_C32(0xdcf10000), + SPH_C32(0xea000000), SPH_C32(0xeae23a1f), SPH_C32(0x8126f431), + SPH_C32(0x19db693f), SPH_C32(0xe01486f2), SPH_C32(0x2f4e0000), + SPH_C32(0x65c8039c), SPH_C32(0xd1680000), SPH_C32(0xaefe0000), + SPH_C32(0x4f2512d8), SPH_C32(0x7f381cf9), SPH_C32(0xaf189d7f), + SPH_C32(0xd803b76f) }, + { SPH_C32(0xb2180000), SPH_C32(0x914d18cc), SPH_C32(0xf95f0000), + SPH_C32(0x801e0000), SPH_C32(0xc44774c0), SPH_C32(0xe7687123), + SPH_C32(0xa66171fc), SPH_C32(0x9e65dbe5), SPH_C32(0x93c30000), + SPH_C32(0x99f30384), SPH_C32(0xc8eb0000), SPH_C32(0x7ff50000), + SPH_C32(0xe13d6a1c), SPH_C32(0x3d9e84af), SPH_C32(0xaf0a4748), + SPH_C32(0xf438e721) }, + { SPH_C32(0x5ac50000), SPH_C32(0x6b071888), SPH_C32(0xc5720000), + SPH_C32(0x3b0b0000), SPH_C32(0x44fa42db), SPH_C32(0xc3806c67), + SPH_C32(0x19c9b308), SPH_C32(0xcc2fd6bc), SPH_C32(0xc7930000), + SPH_C32(0x9f8203d8), SPH_C32(0xed450000), SPH_C32(0x15eb0000), + SPH_C32(0xcf9824c3), SPH_C32(0x5bd001bd), SPH_C32(0x10b05f8b), + SPH_C32(0x8a49ba36) }, + { SPH_C32(0x0e950000), SPH_C32(0x6d7618d4), SPH_C32(0xe0dc0000), + SPH_C32(0x51150000), SPH_C32(0x6a5f0c04), SPH_C32(0xa5cee975), + SPH_C32(0xa673abcb), SPH_C32(0xb25e8bab), SPH_C32(0x7b1e0000), + SPH_C32(0x63b903c0), SPH_C32(0xf4c60000), SPH_C32(0xc4e00000), + SPH_C32(0x61805c07), SPH_C32(0x197699eb), SPH_C32(0x10a285bc), + SPH_C32(0xa672ea78) }, + { SPH_C32(0xbb3a0000), SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), + SPH_C32(0xcc280000), SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), + SPH_C32(0x586c05a5), SPH_C32(0x7e100b40), SPH_C32(0x4a6d0000), + SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), SPH_C32(0x5e3b0000), + SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), SPH_C32(0xbd57fe78), + SPH_C32(0xd0a91431) }, + { SPH_C32(0xef6a0000), SPH_C32(0x049c125c), SPH_C32(0xf9150000), + SPH_C32(0xa6360000), SPH_C32(0xb9582229), SPH_C32(0x5a89e8a4), + SPH_C32(0xe7d61d66), SPH_C32(0x00615657), SPH_C32(0xf6e00000), + SPH_C32(0x04f70c18), SPH_C32(0x49b10000), SPH_C32(0x8f300000), + SPH_C32(0x360251a8), SPH_C32(0xe6b8b467), SPH_C32(0xbd45244f), + SPH_C32(0xfc92447f) }, + { SPH_C32(0x07b70000), SPH_C32(0xfed61218), SPH_C32(0xc5380000), + SPH_C32(0x1d230000), SPH_C32(0x39e51432), SPH_C32(0x7e61f5e0), + SPH_C32(0x587edf92), SPH_C32(0x522b5b0e), SPH_C32(0xa2b00000), + SPH_C32(0x02860c44), SPH_C32(0x6c1f0000), SPH_C32(0xe52e0000), + SPH_C32(0x18a71f77), SPH_C32(0x80f63175), SPH_C32(0x02ff3c8c), + SPH_C32(0x82e31968) }, + { SPH_C32(0x53e70000), SPH_C32(0xf8a71244), SPH_C32(0xe0960000), + SPH_C32(0x773d0000), SPH_C32(0x17405aed), SPH_C32(0x182f70f2), + SPH_C32(0xe7c4c751), SPH_C32(0x2c5a0619), SPH_C32(0x1e3d0000), + SPH_C32(0xfebd0c5c), SPH_C32(0x759c0000), SPH_C32(0x34250000), + SPH_C32(0xb6bf67b3), SPH_C32(0xc250a923), SPH_C32(0x02ede6bb), + SPH_C32(0xaed84926) }, + { SPH_C32(0xd26b0000), SPH_C32(0xd60c129c), SPH_C32(0x1f980000), + SPH_C32(0x60070000), SPH_C32(0x73686758), SPH_C32(0xf263786a), + SPH_C32(0xdf802dd9), SPH_C32(0xc2f1a88e), SPH_C32(0x8c1e0000), + SPH_C32(0x57410c0c), SPH_C32(0xf4f30000), SPH_C32(0x7fb60000), + SPH_C32(0xbb0b3ceb), SPH_C32(0xdd0d7d1e), SPH_C32(0xa07f52f0), + SPH_C32(0xe724c542) }, + { SPH_C32(0x863b0000), SPH_C32(0xd07d12c0), SPH_C32(0x3a360000), + SPH_C32(0x0a190000), SPH_C32(0x5dcd2987), SPH_C32(0x942dfd78), + SPH_C32(0x603a351a), SPH_C32(0xbc80f599), SPH_C32(0x30930000), + SPH_C32(0xab7a0c14), SPH_C32(0xed700000), SPH_C32(0xaebd0000), + SPH_C32(0x1513442f), SPH_C32(0x9fabe548), SPH_C32(0xa06d88c7), + SPH_C32(0xcb1f950c) }, + { SPH_C32(0x6ee60000), SPH_C32(0x2a371284), SPH_C32(0x061b0000), + SPH_C32(0xb10c0000), SPH_C32(0xdd701f9c), SPH_C32(0xb0c5e03c), + SPH_C32(0xdf92f7ee), SPH_C32(0xeecaf8c0), SPH_C32(0x64c30000), + SPH_C32(0xad0b0c48), SPH_C32(0xc8de0000), SPH_C32(0xc4a30000), + SPH_C32(0x3bb60af0), SPH_C32(0xf9e5605a), SPH_C32(0x1fd79004), + SPH_C32(0xb56ec81b) }, + { SPH_C32(0x3ab60000), SPH_C32(0x2c4612d8), SPH_C32(0x23b50000), + SPH_C32(0xdb120000), SPH_C32(0xf3d55143), SPH_C32(0xd68b652e), + SPH_C32(0x6028ef2d), SPH_C32(0x90bba5d7), SPH_C32(0xd84e0000), + SPH_C32(0x51300c50), SPH_C32(0xd15d0000), SPH_C32(0x15a80000), + SPH_C32(0x95ae7234), SPH_C32(0xbb43f80c), SPH_C32(0x1fc54a33), + SPH_C32(0x99559855) }, + { SPH_C32(0x7d490000), SPH_C32(0xad60120c), SPH_C32(0x787a0000), + SPH_C32(0xeda50000), SPH_C32(0xb4ec7971), SPH_C32(0x45d43c99), + SPH_C32(0x4544a92d), SPH_C32(0x499dda33), SPH_C32(0xe54f0000), + SPH_C32(0x83a00c90), SPH_C32(0x37d00000), SPH_C32(0xd3990000), + SPH_C32(0x5f9e3745), SPH_C32(0x13a968c2), SPH_C32(0x27937a8c), + SPH_C32(0x5bc5668c) }, + { SPH_C32(0x29190000), SPH_C32(0xab111250), SPH_C32(0x5dd40000), + SPH_C32(0x87bb0000), SPH_C32(0x9a4937ae), SPH_C32(0x239ab98b), + SPH_C32(0xfafeb1ee), SPH_C32(0x37ec8724), SPH_C32(0x59c20000), + SPH_C32(0x7f9b0c88), SPH_C32(0x2e530000), SPH_C32(0x02920000), + SPH_C32(0xf1864f81), SPH_C32(0x510ff094), SPH_C32(0x2781a0bb), + SPH_C32(0x77fe36c2) }, + { SPH_C32(0xc1c40000), SPH_C32(0x515b1214), SPH_C32(0x61f90000), + SPH_C32(0x3cae0000), SPH_C32(0x1af401b5), SPH_C32(0x0772a4cf), + SPH_C32(0x4556731a), SPH_C32(0x65a68a7d), SPH_C32(0x0d920000), + SPH_C32(0x79ea0cd4), SPH_C32(0x0bfd0000), SPH_C32(0x688c0000), + SPH_C32(0xdf23015e), SPH_C32(0x37417586), SPH_C32(0x983bb878), + SPH_C32(0x098f6bd5) }, + { SPH_C32(0x95940000), SPH_C32(0x572a1248), SPH_C32(0x44570000), + SPH_C32(0x56b00000), SPH_C32(0x34514f6a), SPH_C32(0x613c21dd), + SPH_C32(0xfaec6bd9), SPH_C32(0x1bd7d76a), SPH_C32(0xb11f0000), + SPH_C32(0x85d10ccc), SPH_C32(0x127e0000), SPH_C32(0xb9870000), + SPH_C32(0x713b799a), SPH_C32(0x75e7edd0), SPH_C32(0x9829624f), + SPH_C32(0x25b43b9b) }, + { SPH_C32(0x14180000), SPH_C32(0x79811290), SPH_C32(0xbb590000), + SPH_C32(0x418a0000), SPH_C32(0x507972df), SPH_C32(0x8b702945), + SPH_C32(0xc2a88151), SPH_C32(0xf57c79fd), SPH_C32(0x233c0000), + SPH_C32(0x2c2d0c9c), SPH_C32(0x93110000), SPH_C32(0xf2140000), + SPH_C32(0x7c8f22c2), SPH_C32(0x6aba39ed), SPH_C32(0x3abbd604), + SPH_C32(0x6c48b7ff) }, + { SPH_C32(0x40480000), SPH_C32(0x7ff012cc), SPH_C32(0x9ef70000), + SPH_C32(0x2b940000), SPH_C32(0x7edc3c00), SPH_C32(0xed3eac57), + SPH_C32(0x7d129992), SPH_C32(0x8b0d24ea), SPH_C32(0x9fb10000), + SPH_C32(0xd0160c84), SPH_C32(0x8a920000), SPH_C32(0x231f0000), + SPH_C32(0xd2975a06), SPH_C32(0x281ca1bb), SPH_C32(0x3aa90c33), + SPH_C32(0x4073e7b1) }, + { SPH_C32(0xa8950000), SPH_C32(0x85ba1288), SPH_C32(0xa2da0000), + SPH_C32(0x90810000), SPH_C32(0xfe610a1b), SPH_C32(0xc9d6b113), + SPH_C32(0xc2ba5b66), SPH_C32(0xd94729b3), SPH_C32(0xcbe10000), + SPH_C32(0xd6670cd8), SPH_C32(0xaf3c0000), SPH_C32(0x49010000), + SPH_C32(0xfc3214d9), SPH_C32(0x4e5224a9), SPH_C32(0x851314f0), + SPH_C32(0x3e02baa6) }, + { SPH_C32(0xfcc50000), SPH_C32(0x83cb12d4), SPH_C32(0x87740000), + SPH_C32(0xfa9f0000), SPH_C32(0xd0c444c4), SPH_C32(0xaf983401), + SPH_C32(0x7d0043a5), SPH_C32(0xa73674a4), SPH_C32(0x776c0000), + SPH_C32(0x2a5c0cc0), SPH_C32(0xb6bf0000), SPH_C32(0x980a0000), + SPH_C32(0x522a6c1d), SPH_C32(0x0cf4bcff), SPH_C32(0x8501cec7), + SPH_C32(0x1239eae8) }, + { SPH_C32(0xb7480000), SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), + SPH_C32(0x90c20000), SPH_C32(0xa4575cec), SPH_C32(0x294548a2), + SPH_C32(0xcdcf4ede), SPH_C32(0xca5b0bd0), SPH_C32(0xb44f0000), + SPH_C32(0x5f940900), SPH_C32(0x75e30000), SPH_C32(0xa95b0000), + SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), SPH_C32(0xf3875d6d), + SPH_C32(0x718aebae) }, + { SPH_C32(0xe3180000), SPH_C32(0x4d791d5c), SPH_C32(0xbb6c0000), + SPH_C32(0xfadc0000), SPH_C32(0x8af21233), SPH_C32(0x4f0bcdb0), + SPH_C32(0x7275561d), SPH_C32(0xb42a56c7), SPH_C32(0x08c20000), + SPH_C32(0xa3af0918), SPH_C32(0x6c600000), SPH_C32(0x78500000), + SPH_C32(0xbf332972), SPH_C32(0xf96c4c07), SPH_C32(0xf395875a), + SPH_C32(0x5db1bbe0) }, + { SPH_C32(0x0bc50000), SPH_C32(0xb7331d18), SPH_C32(0x87410000), + SPH_C32(0x41c90000), SPH_C32(0x0a4f2428), SPH_C32(0x6be3d0f4), + SPH_C32(0xcddd94e9), SPH_C32(0xe6605b9e), SPH_C32(0x5c920000), + SPH_C32(0xa5de0944), SPH_C32(0x49ce0000), SPH_C32(0x124e0000), + SPH_C32(0x919667ad), SPH_C32(0x9f22c915), SPH_C32(0x4c2f9f99), + SPH_C32(0x23c0e6f7) }, + { SPH_C32(0x5f950000), SPH_C32(0xb1421d44), SPH_C32(0xa2ef0000), + SPH_C32(0x2bd70000), SPH_C32(0x24ea6af7), SPH_C32(0x0dad55e6), + SPH_C32(0x72678c2a), SPH_C32(0x98110689), SPH_C32(0xe01f0000), + SPH_C32(0x59e5095c), SPH_C32(0x504d0000), SPH_C32(0xc3450000), + SPH_C32(0x3f8e1f69), SPH_C32(0xdd845143), SPH_C32(0x4c3d45ae), + SPH_C32(0x0ffbb6b9) }, + { SPH_C32(0xde190000), SPH_C32(0x9fe91d9c), SPH_C32(0x5de10000), + SPH_C32(0x3ced0000), SPH_C32(0x40c25742), SPH_C32(0xe7e15d7e), + SPH_C32(0x4a2366a2), SPH_C32(0x76baa81e), SPH_C32(0x723c0000), + SPH_C32(0xf019090c), SPH_C32(0xd1220000), SPH_C32(0x88d60000), + SPH_C32(0x323a4431), SPH_C32(0xc2d9857e), SPH_C32(0xeeaff1e5), + SPH_C32(0x46073add) }, + { SPH_C32(0x8a490000), SPH_C32(0x99981dc0), SPH_C32(0x784f0000), + SPH_C32(0x56f30000), SPH_C32(0x6e67199d), SPH_C32(0x81afd86c), + SPH_C32(0xf5997e61), SPH_C32(0x08cbf509), SPH_C32(0xceb10000), + SPH_C32(0x0c220914), SPH_C32(0xc8a10000), SPH_C32(0x59dd0000), + SPH_C32(0x9c223cf5), SPH_C32(0x807f1d28), SPH_C32(0xeebd2bd2), + SPH_C32(0x6a3c6a93) }, + { SPH_C32(0x62940000), SPH_C32(0x63d21d84), SPH_C32(0x44620000), + SPH_C32(0xede60000), SPH_C32(0xeeda2f86), SPH_C32(0xa547c528), + SPH_C32(0x4a31bc95), SPH_C32(0x5a81f850), SPH_C32(0x9ae10000), + SPH_C32(0x0a530948), SPH_C32(0xed0f0000), SPH_C32(0x33c30000), + SPH_C32(0xb287722a), SPH_C32(0xe631983a), SPH_C32(0x51073311), + SPH_C32(0x144d3784) }, + { SPH_C32(0x36c40000), SPH_C32(0x65a31dd8), SPH_C32(0x61cc0000), + SPH_C32(0x87f80000), SPH_C32(0xc07f6159), SPH_C32(0xc309403a), + SPH_C32(0xf58ba456), SPH_C32(0x24f0a547), SPH_C32(0x266c0000), + SPH_C32(0xf6680950), SPH_C32(0xf48c0000), SPH_C32(0xe2c80000), + SPH_C32(0x1c9f0aee), SPH_C32(0xa497006c), SPH_C32(0x5115e926), + SPH_C32(0x387667ca) }, + { SPH_C32(0x713b0000), SPH_C32(0xe4851d0c), SPH_C32(0x3a030000), + SPH_C32(0xb14f0000), SPH_C32(0x8746496b), SPH_C32(0x5056198d), + SPH_C32(0xd0e7e256), SPH_C32(0xfdd6daa3), SPH_C32(0x1b6d0000), + SPH_C32(0x24f80990), SPH_C32(0x12010000), SPH_C32(0x24f90000), + SPH_C32(0xd6af4f9f), SPH_C32(0x0c7d90a2), SPH_C32(0x6943d999), + SPH_C32(0xfae69913) }, + { SPH_C32(0x256b0000), SPH_C32(0xe2f41d50), SPH_C32(0x1fad0000), + SPH_C32(0xdb510000), SPH_C32(0xa9e307b4), SPH_C32(0x36189c9f), + SPH_C32(0x6f5dfa95), SPH_C32(0x83a787b4), SPH_C32(0xa7e00000), + SPH_C32(0xd8c30988), SPH_C32(0x0b820000), SPH_C32(0xf5f20000), + SPH_C32(0x78b7375b), SPH_C32(0x4edb08f4), SPH_C32(0x695103ae), + SPH_C32(0xd6ddc95d) }, + { SPH_C32(0xcdb60000), SPH_C32(0x18be1d14), SPH_C32(0x23800000), + SPH_C32(0x60440000), SPH_C32(0x295e31af), SPH_C32(0x12f081db), + SPH_C32(0xd0f53861), SPH_C32(0xd1ed8aed), SPH_C32(0xf3b00000), + SPH_C32(0xdeb209d4), SPH_C32(0x2e2c0000), SPH_C32(0x9fec0000), + SPH_C32(0x56127984), SPH_C32(0x28958de6), SPH_C32(0xd6eb1b6d), + SPH_C32(0xa8ac944a) }, + { SPH_C32(0x99e60000), SPH_C32(0x1ecf1d48), SPH_C32(0x062e0000), + SPH_C32(0x0a5a0000), SPH_C32(0x07fb7f70), SPH_C32(0x74be04c9), + SPH_C32(0x6f4f20a2), SPH_C32(0xaf9cd7fa), SPH_C32(0x4f3d0000), + SPH_C32(0x228909cc), SPH_C32(0x37af0000), SPH_C32(0x4ee70000), + SPH_C32(0xf80a0140), SPH_C32(0x6a3315b0), SPH_C32(0xd6f9c15a), + SPH_C32(0x8497c404) }, + { SPH_C32(0x186a0000), SPH_C32(0x30641d90), SPH_C32(0xf9200000), + SPH_C32(0x1d600000), SPH_C32(0x63d342c5), SPH_C32(0x9ef20c51), + SPH_C32(0x570bca2a), SPH_C32(0x4137796d), SPH_C32(0xdd1e0000), + SPH_C32(0x8b75099c), SPH_C32(0xb6c00000), SPH_C32(0x05740000), + SPH_C32(0xf5be5a18), SPH_C32(0x756ec18d), SPH_C32(0x746b7511), + SPH_C32(0xcd6b4860) }, + { SPH_C32(0x4c3a0000), SPH_C32(0x36151dcc), SPH_C32(0xdc8e0000), + SPH_C32(0x777e0000), SPH_C32(0x4d760c1a), SPH_C32(0xf8bc8943), + SPH_C32(0xe8b1d2e9), SPH_C32(0x3f46247a), SPH_C32(0x61930000), + SPH_C32(0x774e0984), SPH_C32(0xaf430000), SPH_C32(0xd47f0000), + SPH_C32(0x5ba622dc), SPH_C32(0x37c859db), SPH_C32(0x7479af26), + SPH_C32(0xe150182e) }, + { SPH_C32(0xa4e70000), SPH_C32(0xcc5f1d88), SPH_C32(0xe0a30000), + SPH_C32(0xcc6b0000), SPH_C32(0xcdcb3a01), SPH_C32(0xdc549407), + SPH_C32(0x5719101d), SPH_C32(0x6d0c2923), SPH_C32(0x35c30000), + SPH_C32(0x713f09d8), SPH_C32(0x8aed0000), SPH_C32(0xbe610000), + SPH_C32(0x75036c03), SPH_C32(0x5186dcc9), SPH_C32(0xcbc3b7e5), + SPH_C32(0x9f214539) }, + { SPH_C32(0xf0b70000), SPH_C32(0xca2e1dd4), SPH_C32(0xc50d0000), + SPH_C32(0xa6750000), SPH_C32(0xe36e74de), SPH_C32(0xba1a1115), + SPH_C32(0xe8a308de), SPH_C32(0x137d7434), SPH_C32(0x894e0000), + SPH_C32(0x8d0409c0), SPH_C32(0x936e0000), SPH_C32(0x6f6a0000), + SPH_C32(0xdb1b14c7), SPH_C32(0x1320449f), SPH_C32(0xcbd16dd2), + SPH_C32(0xb31a1577) } +}; + +static const sph_u32 T512_28[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x1e4e0000), SPH_C32(0xdecf0000), SPH_C32(0x6df80180), + SPH_C32(0x77240000), SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), + SPH_C32(0xcda31812), SPH_C32(0x98aa496e), SPH_C32(0xb2060000), + SPH_C32(0xc5690000), SPH_C32(0x28031200), SPH_C32(0x74670000), + SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), SPH_C32(0x33d1dfec), + SPH_C32(0x094e3198) }, + { SPH_C32(0xaec30000), SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), + SPH_C32(0x2c150000), SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), + SPH_C32(0xab92f78f), SPH_C32(0xa312567b), SPH_C32(0xdb250000), + SPH_C32(0x09290000), SPH_C32(0x49aac000), SPH_C32(0x81e10000), + SPH_C32(0xcafe6b59), SPH_C32(0x42793431), SPH_C32(0x43566b76), + SPH_C32(0xe86cba2e) }, + { SPH_C32(0xb08d0000), SPH_C32(0x42800001), SPH_C32(0x1429e180), + SPH_C32(0x5b310000), SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), + SPH_C32(0x6631ef9d), SPH_C32(0x3bb81f15), SPH_C32(0x69230000), + SPH_C32(0xcc400000), SPH_C32(0x61a9d200), SPH_C32(0xf5860000), + SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), SPH_C32(0x7087b49a), + SPH_C32(0xe1228bb6) }, + { SPH_C32(0xdb250000), SPH_C32(0x09290000), SPH_C32(0x49aac000), + SPH_C32(0x81e10000), SPH_C32(0xcafe6b59), SPH_C32(0x42793431), + SPH_C32(0x43566b76), SPH_C32(0xe86cba2e), SPH_C32(0x75e60000), + SPH_C32(0x95660001), SPH_C32(0x307b2000), SPH_C32(0xadf40000), + SPH_C32(0x8f321eea), SPH_C32(0x24298307), SPH_C32(0xe8c49cf9), + SPH_C32(0x4b7eec55) }, + { SPH_C32(0xc56b0000), SPH_C32(0xd7e60000), SPH_C32(0x2452c180), + SPH_C32(0xf6c50000), SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), + SPH_C32(0x8ef57364), SPH_C32(0x70c6f340), SPH_C32(0xc7e00000), + SPH_C32(0x500f0001), SPH_C32(0x18783200), SPH_C32(0xd9930000), + SPH_C32(0x39f0281e), SPH_C32(0xcf3bbaff), SPH_C32(0xdb154315), + SPH_C32(0x4230ddcd) }, + { SPH_C32(0x75e60000), SPH_C32(0x95660001), SPH_C32(0x307b2000), + SPH_C32(0xadf40000), SPH_C32(0x8f321eea), SPH_C32(0x24298307), + SPH_C32(0xe8c49cf9), SPH_C32(0x4b7eec55), SPH_C32(0xaec30000), + SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), SPH_C32(0x2c150000), + SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), SPH_C32(0xab92f78f), + SPH_C32(0xa312567b) }, + { SPH_C32(0x6ba80000), SPH_C32(0x4ba90001), SPH_C32(0x5d832180), + SPH_C32(0xdad00000), SPH_C32(0x63751974), SPH_C32(0xd089ea49), + SPH_C32(0x256784eb), SPH_C32(0xd3d4a53b), SPH_C32(0x1cc50000), + SPH_C32(0x59260001), SPH_C32(0x51d2f200), SPH_C32(0x58720000), + SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), SPH_C32(0x98432863), + SPH_C32(0xaa5c67e3) }, + { SPH_C32(0x86790000), SPH_C32(0x3f390002), SPH_C32(0xe19ae000), + SPH_C32(0x98560000), SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), + SPH_C32(0xd3dd4944), SPH_C32(0x161ddab9), SPH_C32(0x30b70000), + SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), SPH_C32(0x42c40000), + SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), SPH_C32(0x21afa1ea), + SPH_C32(0xb0a51834) }, + { SPH_C32(0x98370000), SPH_C32(0xe1f60002), SPH_C32(0x8c62e180), + SPH_C32(0xef720000), SPH_C32(0x79226090), SPH_C32(0xba28a1a4), + SPH_C32(0x1e7e5156), SPH_C32(0x8eb793d7), SPH_C32(0x82b10000), + SPH_C32(0x20b90000), SPH_C32(0xdcf77200), SPH_C32(0x36a30000), + SPH_C32(0xd57a0b9e), SPH_C32(0x93a8ad98), SPH_C32(0x127e7e06), + SPH_C32(0xb9eb29ac) }, + { SPH_C32(0x28ba0000), SPH_C32(0xa3760003), SPH_C32(0x984b0000), + SPH_C32(0xb4430000), SPH_C32(0xd0a912bd), SPH_C32(0x28d87fdc), + SPH_C32(0x784fbecb), SPH_C32(0xb50f8cc2), SPH_C32(0xeb920000), + SPH_C32(0xecf90000), SPH_C32(0xbd5ea000), SPH_C32(0xc3250000), + SPH_C32(0xa9465633), SPH_C32(0x3ac3a051), SPH_C32(0x62f9ca9c), + SPH_C32(0x58c9a21a) }, + { SPH_C32(0x36f40000), SPH_C32(0x7db90003), SPH_C32(0xf5b30180), + SPH_C32(0xc3670000), SPH_C32(0x3cee1523), SPH_C32(0xdc781692), + SPH_C32(0xb5eca6d9), SPH_C32(0x2da5c5ac), SPH_C32(0x59940000), + SPH_C32(0x29900000), SPH_C32(0x955db200), SPH_C32(0xb7420000), + SPH_C32(0x1f8460c7), SPH_C32(0xd1d199a9), SPH_C32(0x51281570), + SPH_C32(0x51879382) }, + { SPH_C32(0x5d5c0000), SPH_C32(0x36100002), SPH_C32(0xa8302000), + SPH_C32(0x19b70000), SPH_C32(0x5f9b0c57), SPH_C32(0x0cf1fcdb), + SPH_C32(0x908b2232), SPH_C32(0xfe716097), SPH_C32(0x45510000), + SPH_C32(0x70b60001), SPH_C32(0xc48f4000), SPH_C32(0xef300000), + SPH_C32(0xec8a2380), SPH_C32(0x5c931767), SPH_C32(0xc96b3d13), + SPH_C32(0xfbdbf461) }, + { SPH_C32(0x43120000), SPH_C32(0xe8df0002), SPH_C32(0xc5c82180), + SPH_C32(0x6e930000), SPH_C32(0xb3dc0bc9), SPH_C32(0xf8519595), + SPH_C32(0x5d283a20), SPH_C32(0x66db29f9), SPH_C32(0xf7570000), + SPH_C32(0xb5df0001), SPH_C32(0xec8c5200), SPH_C32(0x9b570000), + SPH_C32(0x5a481574), SPH_C32(0xb7812e9f), SPH_C32(0xfabae2ff), + SPH_C32(0xf295c5f9) }, + { SPH_C32(0xf39f0000), SPH_C32(0xaa5f0003), SPH_C32(0xd1e1c000), + SPH_C32(0x35a20000), SPH_C32(0x1a5779e4), SPH_C32(0x6aa14bed), + SPH_C32(0x3b19d5bd), SPH_C32(0x5d6336ec), SPH_C32(0x9e740000), + SPH_C32(0x799f0001), SPH_C32(0x8d258000), SPH_C32(0x6ed10000), + SPH_C32(0x267448d9), SPH_C32(0x1eea2356), SPH_C32(0x8a3d5665), + SPH_C32(0x13b74e4f) }, + { SPH_C32(0xedd10000), SPH_C32(0x74900003), SPH_C32(0xbc19c180), + SPH_C32(0x42860000), SPH_C32(0xf6107e7a), SPH_C32(0x9e0122a3), + SPH_C32(0xf6bacdaf), SPH_C32(0xc5c97f82), SPH_C32(0x2c720000), + SPH_C32(0xbcf60001), SPH_C32(0xa5269200), SPH_C32(0x1ab60000), + SPH_C32(0x90b67e2d), SPH_C32(0xf5f81aae), SPH_C32(0xb9ec8989), + SPH_C32(0x1af97fd7) }, + { SPH_C32(0x30b70000), SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), + SPH_C32(0x42c40000), SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), + SPH_C32(0x21afa1ea), SPH_C32(0xb0a51834), SPH_C32(0xb6ce0000), + SPH_C32(0xdae90002), SPH_C32(0x156e8000), SPH_C32(0xda920000), + SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), SPH_C32(0xf272e8ae), + SPH_C32(0xa6b8c28d) }, + { SPH_C32(0x2ef90000), SPH_C32(0x3b1f0000), SPH_C32(0x990c6180), + SPH_C32(0x35e00000), SPH_C32(0x8fff3af4), SPH_C32(0x8c1afd2e), + SPH_C32(0xec0cb9f8), SPH_C32(0x280f515a), SPH_C32(0x04c80000), + SPH_C32(0x1f800002), SPH_C32(0x3d6d9200), SPH_C32(0xaef50000), + SPH_C32(0x401f6c90), SPH_C32(0xdd206572), SPH_C32(0xc1a33742), + SPH_C32(0xaff6f315) }, + { SPH_C32(0x9e740000), SPH_C32(0x799f0001), SPH_C32(0x8d258000), + SPH_C32(0x6ed10000), SPH_C32(0x267448d9), SPH_C32(0x1eea2356), + SPH_C32(0x8a3d5665), SPH_C32(0x13b74e4f), SPH_C32(0x6deb0000), + SPH_C32(0xd3c00002), SPH_C32(0x5cc44000), SPH_C32(0x5b730000), + SPH_C32(0x3c23313d), SPH_C32(0x744b68bb), SPH_C32(0xb12483d8), + SPH_C32(0x4ed478a3) }, + { SPH_C32(0x803a0000), SPH_C32(0xa7500001), SPH_C32(0xe0dd8180), + SPH_C32(0x19f50000), SPH_C32(0xca334f47), SPH_C32(0xea4a4a18), + SPH_C32(0x479e4e77), SPH_C32(0x8b1d0721), SPH_C32(0xdfed0000), + SPH_C32(0x16a90002), SPH_C32(0x74c75200), SPH_C32(0x2f140000), + SPH_C32(0x8ae107c9), SPH_C32(0x9f595143), SPH_C32(0x82f55c34), + SPH_C32(0x479a493b) }, + { SPH_C32(0xeb920000), SPH_C32(0xecf90000), SPH_C32(0xbd5ea000), + SPH_C32(0xc3250000), SPH_C32(0xa9465633), SPH_C32(0x3ac3a051), + SPH_C32(0x62f9ca9c), SPH_C32(0x58c9a21a), SPH_C32(0xc3280000), + SPH_C32(0x4f8f0003), SPH_C32(0x2515a000), SPH_C32(0x77660000), + SPH_C32(0x79ef448e), SPH_C32(0x121bdf8d), SPH_C32(0x1ab67457), + SPH_C32(0xedc62ed8) }, + { SPH_C32(0xf5dc0000), SPH_C32(0x32360000), SPH_C32(0xd0a6a180), + SPH_C32(0xb4010000), SPH_C32(0x450151ad), SPH_C32(0xce63c91f), + SPH_C32(0xaf5ad28e), SPH_C32(0xc063eb74), SPH_C32(0x712e0000), + SPH_C32(0x8ae60003), SPH_C32(0x0d16b200), SPH_C32(0x03010000), + SPH_C32(0xcf2d727a), SPH_C32(0xf909e675), SPH_C32(0x2967abbb), + SPH_C32(0xe4881f40) }, + { SPH_C32(0x45510000), SPH_C32(0x70b60001), SPH_C32(0xc48f4000), + SPH_C32(0xef300000), SPH_C32(0xec8a2380), SPH_C32(0x5c931767), + SPH_C32(0xc96b3d13), SPH_C32(0xfbdbf461), SPH_C32(0x180d0000), + SPH_C32(0x46a60003), SPH_C32(0x6cbf6000), SPH_C32(0xf6870000), + SPH_C32(0xb3112fd7), SPH_C32(0x5062ebbc), SPH_C32(0x59e01f21), + SPH_C32(0x05aa94f6) }, + { SPH_C32(0x5b1f0000), SPH_C32(0xae790001), SPH_C32(0xa9774180), + SPH_C32(0x98140000), SPH_C32(0x00cd241e), SPH_C32(0xa8337e29), + SPH_C32(0x04c82501), SPH_C32(0x6371bd0f), SPH_C32(0xaa0b0000), + SPH_C32(0x83cf0003), SPH_C32(0x44bc7200), SPH_C32(0x82e00000), + SPH_C32(0x05d31923), SPH_C32(0xbb70d244), SPH_C32(0x6a31c0cd), + SPH_C32(0x0ce4a56e) }, + { SPH_C32(0xb6ce0000), SPH_C32(0xdae90002), SPH_C32(0x156e8000), + SPH_C32(0xda920000), SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), + SPH_C32(0xf272e8ae), SPH_C32(0xa6b8c28d), SPH_C32(0x86790000), + SPH_C32(0x3f390002), SPH_C32(0xe19ae000), SPH_C32(0x98560000), + SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), SPH_C32(0xd3dd4944), + SPH_C32(0x161ddab9) }, + { SPH_C32(0xa8800000), SPH_C32(0x04260002), SPH_C32(0x78968180), + SPH_C32(0xadb60000), SPH_C32(0x1a9a5dfa), SPH_C32(0xc29235c4), + SPH_C32(0x3fd1f0bc), SPH_C32(0x3e128be3), SPH_C32(0x347f0000), + SPH_C32(0xfa500002), SPH_C32(0xc999f200), SPH_C32(0xec310000), + SPH_C32(0x23a751fa), SPH_C32(0xa59af112), SPH_C32(0xe00c96a8), + SPH_C32(0x1f53eb21) }, + { SPH_C32(0x180d0000), SPH_C32(0x46a60003), SPH_C32(0x6cbf6000), + SPH_C32(0xf6870000), SPH_C32(0xb3112fd7), SPH_C32(0x5062ebbc), + SPH_C32(0x59e01f21), SPH_C32(0x05aa94f6), SPH_C32(0x5d5c0000), + SPH_C32(0x36100002), SPH_C32(0xa8302000), SPH_C32(0x19b70000), + SPH_C32(0x5f9b0c57), SPH_C32(0x0cf1fcdb), SPH_C32(0x908b2232), + SPH_C32(0xfe716097) }, + { SPH_C32(0x06430000), SPH_C32(0x98690003), SPH_C32(0x01476180), + SPH_C32(0x81a30000), SPH_C32(0x5f562849), SPH_C32(0xa4c282f2), + SPH_C32(0x94430733), SPH_C32(0x9d00dd98), SPH_C32(0xef5a0000), + SPH_C32(0xf3790002), SPH_C32(0x80333200), SPH_C32(0x6dd00000), + SPH_C32(0xe9593aa3), SPH_C32(0xe7e3c523), SPH_C32(0xa35afdde), + SPH_C32(0xf73f510f) }, + { SPH_C32(0x6deb0000), SPH_C32(0xd3c00002), SPH_C32(0x5cc44000), + SPH_C32(0x5b730000), SPH_C32(0x3c23313d), SPH_C32(0x744b68bb), + SPH_C32(0xb12483d8), SPH_C32(0x4ed478a3), SPH_C32(0xf39f0000), + SPH_C32(0xaa5f0003), SPH_C32(0xd1e1c000), SPH_C32(0x35a20000), + SPH_C32(0x1a5779e4), SPH_C32(0x6aa14bed), SPH_C32(0x3b19d5bd), + SPH_C32(0x5d6336ec) }, + { SPH_C32(0x73a50000), SPH_C32(0x0d0f0002), SPH_C32(0x313c4180), + SPH_C32(0x2c570000), SPH_C32(0xd06436a3), SPH_C32(0x80eb01f5), + SPH_C32(0x7c879bca), SPH_C32(0xd67e31cd), SPH_C32(0x41990000), + SPH_C32(0x6f360003), SPH_C32(0xf9e2d200), SPH_C32(0x41c50000), + SPH_C32(0xac954f10), SPH_C32(0x81b37215), SPH_C32(0x08c80a51), + SPH_C32(0x542d0774) }, + { SPH_C32(0xc3280000), SPH_C32(0x4f8f0003), SPH_C32(0x2515a000), + SPH_C32(0x77660000), SPH_C32(0x79ef448e), SPH_C32(0x121bdf8d), + SPH_C32(0x1ab67457), SPH_C32(0xedc62ed8), SPH_C32(0x28ba0000), + SPH_C32(0xa3760003), SPH_C32(0x984b0000), SPH_C32(0xb4430000), + SPH_C32(0xd0a912bd), SPH_C32(0x28d87fdc), SPH_C32(0x784fbecb), + SPH_C32(0xb50f8cc2) }, + { SPH_C32(0xdd660000), SPH_C32(0x91400003), SPH_C32(0x48eda180), + SPH_C32(0x00420000), SPH_C32(0x95a84310), SPH_C32(0xe6bbb6c3), + SPH_C32(0xd7156c45), SPH_C32(0x756c67b6), SPH_C32(0x9abc0000), + SPH_C32(0x661f0003), SPH_C32(0xb0481200), SPH_C32(0xc0240000), + SPH_C32(0x666b2449), SPH_C32(0xc3ca4624), SPH_C32(0x4b9e6127), + SPH_C32(0xbc41bd5a) }, + { SPH_C32(0x14190000), SPH_C32(0x23ca003c), SPH_C32(0x50df0000), + SPH_C32(0x44b60000), SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), + SPH_C32(0x61e610b0), SPH_C32(0xdbcadb80), SPH_C32(0xe3430000), + SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), SPH_C32(0xaa4e0000), + SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), SPH_C32(0x123db156), + SPH_C32(0x3a4e99d7) }, + { SPH_C32(0x0a570000), SPH_C32(0xfd05003c), SPH_C32(0x3d270180), + SPH_C32(0x33920000), SPH_C32(0xf72b602e), SPH_C32(0xc853c53b), + SPH_C32(0xac4508a2), SPH_C32(0x436092ee), SPH_C32(0x51450000), + SPH_C32(0xff270014), SPH_C32(0xdac51200), SPH_C32(0xde290000), + SPH_C32(0x6ddc7452), SPH_C32(0xce7987ed), SPH_C32(0x21ec6eba), + SPH_C32(0x3300a84f) }, + { SPH_C32(0xbada0000), SPH_C32(0xbf85003d), SPH_C32(0x290ee000), + SPH_C32(0x68a30000), SPH_C32(0x5ea01203), SPH_C32(0x5aa31b43), + SPH_C32(0xca74e73f), SPH_C32(0x78d88dfb), SPH_C32(0x38660000), + SPH_C32(0x33670014), SPH_C32(0xbb6cc000), SPH_C32(0x2baf0000), + SPH_C32(0x11e029ff), SPH_C32(0x67128a24), SPH_C32(0x516bda20), + SPH_C32(0xd22223f9) }, + { SPH_C32(0xa4940000), SPH_C32(0x614a003d), SPH_C32(0x44f6e180), + SPH_C32(0x1f870000), SPH_C32(0xb2e7159d), SPH_C32(0xae03720d), + SPH_C32(0x07d7ff2d), SPH_C32(0xe072c495), SPH_C32(0x8a600000), + SPH_C32(0xf60e0014), SPH_C32(0x936fd200), SPH_C32(0x5fc80000), + SPH_C32(0xa7221f0b), SPH_C32(0x8c00b3dc), SPH_C32(0x62ba05cc), + SPH_C32(0xdb6c1261) }, + { SPH_C32(0xcf3c0000), SPH_C32(0x2ae3003c), SPH_C32(0x1975c000), + SPH_C32(0xc5570000), SPH_C32(0xd1920ce9), SPH_C32(0x7e8a9844), + SPH_C32(0x22b07bc6), SPH_C32(0x33a661ae), SPH_C32(0x96a50000), + SPH_C32(0xaf280015), SPH_C32(0xc2bd2000), SPH_C32(0x07ba0000), + SPH_C32(0x542c5c4c), SPH_C32(0x01423d12), SPH_C32(0xfaf92daf), + SPH_C32(0x71307582) }, + { SPH_C32(0xd1720000), SPH_C32(0xf42c003c), SPH_C32(0x748dc180), + SPH_C32(0xb2730000), SPH_C32(0x3dd50b77), SPH_C32(0x8a2af10a), + SPH_C32(0xef1363d4), SPH_C32(0xab0c28c0), SPH_C32(0x24a30000), + SPH_C32(0x6a410015), SPH_C32(0xeabe3200), SPH_C32(0x73dd0000), + SPH_C32(0xe2ee6ab8), SPH_C32(0xea5004ea), SPH_C32(0xc928f243), + SPH_C32(0x787e441a) }, + { SPH_C32(0x61ff0000), SPH_C32(0xb6ac003d), SPH_C32(0x60a42000), + SPH_C32(0xe9420000), SPH_C32(0x945e795a), SPH_C32(0x18da2f72), + SPH_C32(0x89228c49), SPH_C32(0x90b437d5), SPH_C32(0x4d800000), + SPH_C32(0xa6010015), SPH_C32(0x8b17e000), SPH_C32(0x865b0000), + SPH_C32(0x9ed23715), SPH_C32(0x433b0923), SPH_C32(0xb9af46d9), + SPH_C32(0x995ccfac) }, + { SPH_C32(0x7fb10000), SPH_C32(0x6863003d), SPH_C32(0x0d5c2180), + SPH_C32(0x9e660000), SPH_C32(0x78197ec4), SPH_C32(0xec7a463c), + SPH_C32(0x4481945b), SPH_C32(0x081e7ebb), SPH_C32(0xff860000), + SPH_C32(0x63680015), SPH_C32(0xa314f200), SPH_C32(0xf23c0000), + SPH_C32(0x281001e1), SPH_C32(0xa82930db), SPH_C32(0x8a7e9935), + SPH_C32(0x9012fe34) }, + { SPH_C32(0x92600000), SPH_C32(0x1cf3003e), SPH_C32(0xb145e000), + SPH_C32(0xdce00000), SPH_C32(0x8e0900be), SPH_C32(0x727b649f), + SPH_C32(0xb23b59f4), SPH_C32(0xcdd70139), SPH_C32(0xd3f40000), + SPH_C32(0xdf9e0014), SPH_C32(0x06326000), SPH_C32(0xe88a0000), + SPH_C32(0xb8a67fcc), SPH_C32(0x5dd12a75), SPH_C32(0x339210bc), + SPH_C32(0x8aeb81e3) }, + { SPH_C32(0x8c2e0000), SPH_C32(0xc23c003e), SPH_C32(0xdcbde180), + SPH_C32(0xabc40000), SPH_C32(0x624e0720), SPH_C32(0x86db0dd1), + SPH_C32(0x7f9841e6), SPH_C32(0x557d4857), SPH_C32(0x61f20000), + SPH_C32(0x1af70014), SPH_C32(0x2e317200), SPH_C32(0x9ced0000), + SPH_C32(0x0e644938), SPH_C32(0xb6c3138d), SPH_C32(0x0043cf50), + SPH_C32(0x83a5b07b) }, + { SPH_C32(0x3ca30000), SPH_C32(0x80bc003f), SPH_C32(0xc8940000), + SPH_C32(0xf0f50000), SPH_C32(0xcbc5750d), SPH_C32(0x142bd3a9), + SPH_C32(0x19a9ae7b), SPH_C32(0x6ec55742), SPH_C32(0x08d10000), + SPH_C32(0xd6b70014), SPH_C32(0x4f98a000), SPH_C32(0x696b0000), + SPH_C32(0x72581495), SPH_C32(0x1fa81e44), SPH_C32(0x70c47bca), + SPH_C32(0x62873bcd) }, + { SPH_C32(0x22ed0000), SPH_C32(0x5e73003f), SPH_C32(0xa56c0180), + SPH_C32(0x87d10000), SPH_C32(0x27827293), SPH_C32(0xe08bbae7), + SPH_C32(0xd40ab669), SPH_C32(0xf66f1e2c), SPH_C32(0xbad70000), + SPH_C32(0x13de0014), SPH_C32(0x679bb200), SPH_C32(0x1d0c0000), + SPH_C32(0xc49a2261), SPH_C32(0xf4ba27bc), SPH_C32(0x4315a426), + SPH_C32(0x6bc90a55) }, + { SPH_C32(0x49450000), SPH_C32(0x15da003e), SPH_C32(0xf8ef2000), + SPH_C32(0x5d010000), SPH_C32(0x44f76be7), SPH_C32(0x300250ae), + SPH_C32(0xf16d3282), SPH_C32(0x25bbbb17), SPH_C32(0xa6120000), + SPH_C32(0x4af80015), SPH_C32(0x36494000), SPH_C32(0x457e0000), + SPH_C32(0x37946126), SPH_C32(0x79f8a972), SPH_C32(0xdb568c45), + SPH_C32(0xc1956db6) }, + { SPH_C32(0x570b0000), SPH_C32(0xcb15003e), SPH_C32(0x95172180), + SPH_C32(0x2a250000), SPH_C32(0xa8b06c79), SPH_C32(0xc4a239e0), + SPH_C32(0x3cce2a90), SPH_C32(0xbd11f279), SPH_C32(0x14140000), + SPH_C32(0x8f910015), SPH_C32(0x1e4a5200), SPH_C32(0x31190000), + SPH_C32(0x815657d2), SPH_C32(0x92ea908a), SPH_C32(0xe88753a9), + SPH_C32(0xc8db5c2e) }, + { SPH_C32(0xe7860000), SPH_C32(0x8995003f), SPH_C32(0x813ec000), + SPH_C32(0x71140000), SPH_C32(0x013b1e54), SPH_C32(0x5652e798), + SPH_C32(0x5affc50d), SPH_C32(0x86a9ed6c), SPH_C32(0x7d370000), + SPH_C32(0x43d10015), SPH_C32(0x7fe38000), SPH_C32(0xc49f0000), + SPH_C32(0xfd6a0a7f), SPH_C32(0x3b819d43), SPH_C32(0x9800e733), + SPH_C32(0x29f9d798) }, + { SPH_C32(0xf9c80000), SPH_C32(0x575a003f), SPH_C32(0xecc6c180), + SPH_C32(0x06300000), SPH_C32(0xed7c19ca), SPH_C32(0xa2f28ed6), + SPH_C32(0x975cdd1f), SPH_C32(0x1e03a402), SPH_C32(0xcf310000), + SPH_C32(0x86b80015), SPH_C32(0x57e09200), SPH_C32(0xb0f80000), + SPH_C32(0x4ba83c8b), SPH_C32(0xd093a4bb), SPH_C32(0xabd138df), + SPH_C32(0x20b7e600) }, + { SPH_C32(0x24ae0000), SPH_C32(0xc61a003c), SPH_C32(0xa42b6000), + SPH_C32(0x06720000), SPH_C32(0x78d45ada), SPH_C32(0x44493815), + SPH_C32(0x4049b15a), SPH_C32(0x6b6fc3b4), SPH_C32(0x558d0000), + SPH_C32(0xe0a70016), SPH_C32(0xe7a88000), SPH_C32(0x70dc0000), + SPH_C32(0x2dc318c2), SPH_C32(0x1359e29f), SPH_C32(0xe04f59f8), + SPH_C32(0x9cf65b5a) }, + { SPH_C32(0x3ae00000), SPH_C32(0x18d5003c), SPH_C32(0xc9d36180), + SPH_C32(0x71560000), SPH_C32(0x94935d44), SPH_C32(0xb0e9515b), + SPH_C32(0x8deaa948), SPH_C32(0xf3c58ada), SPH_C32(0xe78b0000), + SPH_C32(0x25ce0016), SPH_C32(0xcfab9200), SPH_C32(0x04bb0000), + SPH_C32(0x9b012e36), SPH_C32(0xf84bdb67), SPH_C32(0xd39e8614), + SPH_C32(0x95b86ac2) }, + { SPH_C32(0x8a6d0000), SPH_C32(0x5a55003d), SPH_C32(0xddfa8000), + SPH_C32(0x2a670000), SPH_C32(0x3d182f69), SPH_C32(0x22198f23), + SPH_C32(0xebdb46d5), SPH_C32(0xc87d95cf), SPH_C32(0x8ea80000), + SPH_C32(0xe98e0016), SPH_C32(0xae024000), SPH_C32(0xf13d0000), + SPH_C32(0xe73d739b), SPH_C32(0x5120d6ae), SPH_C32(0xa319328e), + SPH_C32(0x749ae174) }, + { SPH_C32(0x94230000), SPH_C32(0x849a003d), SPH_C32(0xb0028180), + SPH_C32(0x5d430000), SPH_C32(0xd15f28f7), SPH_C32(0xd6b9e66d), + SPH_C32(0x26785ec7), SPH_C32(0x50d7dca1), SPH_C32(0x3cae0000), + SPH_C32(0x2ce70016), SPH_C32(0x86015200), SPH_C32(0x855a0000), + SPH_C32(0x51ff456f), SPH_C32(0xba32ef56), SPH_C32(0x90c8ed62), + SPH_C32(0x7dd4d0ec) }, + { SPH_C32(0xff8b0000), SPH_C32(0xcf33003c), SPH_C32(0xed81a000), + SPH_C32(0x87930000), SPH_C32(0xb22a3183), SPH_C32(0x06300c24), + SPH_C32(0x031fda2c), SPH_C32(0x8303799a), SPH_C32(0x206b0000), + SPH_C32(0x75c10017), SPH_C32(0xd7d3a000), SPH_C32(0xdd280000), + SPH_C32(0xa2f10628), SPH_C32(0x37706198), SPH_C32(0x088bc501), + SPH_C32(0xd788b70f) }, + { SPH_C32(0xe1c50000), SPH_C32(0x11fc003c), SPH_C32(0x8079a180), + SPH_C32(0xf0b70000), SPH_C32(0x5e6d361d), SPH_C32(0xf290656a), + SPH_C32(0xcebcc23e), SPH_C32(0x1ba930f4), SPH_C32(0x926d0000), + SPH_C32(0xb0a80017), SPH_C32(0xffd0b200), SPH_C32(0xa94f0000), + SPH_C32(0x143330dc), SPH_C32(0xdc625860), SPH_C32(0x3b5a1aed), + SPH_C32(0xdec68697) }, + { SPH_C32(0x51480000), SPH_C32(0x537c003d), SPH_C32(0x94504000), + SPH_C32(0xab860000), SPH_C32(0xf7e64430), SPH_C32(0x6060bb12), + SPH_C32(0xa88d2da3), SPH_C32(0x20112fe1), SPH_C32(0xfb4e0000), + SPH_C32(0x7ce80017), SPH_C32(0x9e796000), SPH_C32(0x5cc90000), + SPH_C32(0x680f6d71), SPH_C32(0x750955a9), SPH_C32(0x4bddae77), + SPH_C32(0x3fe40d21) }, + { SPH_C32(0x4f060000), SPH_C32(0x8db3003d), SPH_C32(0xf9a84180), + SPH_C32(0xdca20000), SPH_C32(0x1ba143ae), SPH_C32(0x94c0d25c), + SPH_C32(0x652e35b1), SPH_C32(0xb8bb668f), SPH_C32(0x49480000), + SPH_C32(0xb9810017), SPH_C32(0xb67a7200), SPH_C32(0x28ae0000), + SPH_C32(0xdecd5b85), SPH_C32(0x9e1b6c51), SPH_C32(0x780c719b), + SPH_C32(0x36aa3cb9) }, + { SPH_C32(0xa2d70000), SPH_C32(0xf923003e), SPH_C32(0x45b18000), + SPH_C32(0x9e240000), SPH_C32(0xedb13dd4), SPH_C32(0x0ac1f0ff), + SPH_C32(0x9394f81e), SPH_C32(0x7d72190d), SPH_C32(0x653a0000), + SPH_C32(0x05770016), SPH_C32(0x135ce000), SPH_C32(0x32180000), + SPH_C32(0x4e7b25a8), SPH_C32(0x6be376ff), SPH_C32(0xc1e0f812), + SPH_C32(0x2c53436e) }, + { SPH_C32(0xbc990000), SPH_C32(0x27ec003e), SPH_C32(0x28498180), + SPH_C32(0xe9000000), SPH_C32(0x01f63a4a), SPH_C32(0xfe6199b1), + SPH_C32(0x5e37e00c), SPH_C32(0xe5d85063), SPH_C32(0xd73c0000), + SPH_C32(0xc01e0016), SPH_C32(0x3b5ff200), SPH_C32(0x467f0000), + SPH_C32(0xf8b9135c), SPH_C32(0x80f14f07), SPH_C32(0xf23127fe), + SPH_C32(0x251d72f6) }, + { SPH_C32(0x0c140000), SPH_C32(0x656c003f), SPH_C32(0x3c606000), + SPH_C32(0xb2310000), SPH_C32(0xa87d4867), SPH_C32(0x6c9147c9), + SPH_C32(0x38060f91), SPH_C32(0xde604f76), SPH_C32(0xbe1f0000), + SPH_C32(0x0c5e0016), SPH_C32(0x5af62000), SPH_C32(0xb3f90000), + SPH_C32(0x84854ef1), SPH_C32(0x299a42ce), SPH_C32(0x82b69364), + SPH_C32(0xc43ff940) }, + { SPH_C32(0x125a0000), SPH_C32(0xbba3003f), SPH_C32(0x51986180), + SPH_C32(0xc5150000), SPH_C32(0x443a4ff9), SPH_C32(0x98312e87), + SPH_C32(0xf5a51783), SPH_C32(0x46ca0618), SPH_C32(0x0c190000), + SPH_C32(0xc9370016), SPH_C32(0x72f53200), SPH_C32(0xc79e0000), + SPH_C32(0x32477805), SPH_C32(0xc2887b36), SPH_C32(0xb1674c88), + SPH_C32(0xcd71c8d8) }, + { SPH_C32(0x79f20000), SPH_C32(0xf00a003e), SPH_C32(0x0c1b4000), + SPH_C32(0x1fc50000), SPH_C32(0x274f568d), SPH_C32(0x48b8c4ce), + SPH_C32(0xd0c29368), SPH_C32(0x951ea323), SPH_C32(0x10dc0000), + SPH_C32(0x90110017), SPH_C32(0x2327c000), SPH_C32(0x9fec0000), + SPH_C32(0xc1493b42), SPH_C32(0x4fcaf5f8), SPH_C32(0x292464eb), + SPH_C32(0x672daf3b) }, + { SPH_C32(0x67bc0000), SPH_C32(0x2ec5003e), SPH_C32(0x61e34180), + SPH_C32(0x68e10000), SPH_C32(0xcb085113), SPH_C32(0xbc18ad80), + SPH_C32(0x1d618b7a), SPH_C32(0x0db4ea4d), SPH_C32(0xa2da0000), + SPH_C32(0x55780017), SPH_C32(0x0b24d200), SPH_C32(0xeb8b0000), + SPH_C32(0x778b0db6), SPH_C32(0xa4d8cc00), SPH_C32(0x1af5bb07), + SPH_C32(0x6e639ea3) }, + { SPH_C32(0xd7310000), SPH_C32(0x6c45003f), SPH_C32(0x75caa000), + SPH_C32(0x33d00000), SPH_C32(0x6283233e), SPH_C32(0x2ee873f8), + SPH_C32(0x7b5064e7), SPH_C32(0x360cf558), SPH_C32(0xcbf90000), + SPH_C32(0x99380017), SPH_C32(0x6a8d0000), SPH_C32(0x1e0d0000), + SPH_C32(0x0bb7501b), SPH_C32(0x0db3c1c9), SPH_C32(0x6a720f9d), + SPH_C32(0x8f411515) }, + { SPH_C32(0xc97f0000), SPH_C32(0xb28a003f), SPH_C32(0x1832a180), + SPH_C32(0x44f40000), SPH_C32(0x8ec424a0), SPH_C32(0xda481ab6), + SPH_C32(0xb6f37cf5), SPH_C32(0xaea6bc36), SPH_C32(0x79ff0000), + SPH_C32(0x5c510017), SPH_C32(0x428e1200), SPH_C32(0x6a6a0000), + SPH_C32(0xbd7566ef), SPH_C32(0xe6a1f831), SPH_C32(0x59a3d071), + SPH_C32(0x860f248d) }, + { SPH_C32(0xe3430000), SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), + SPH_C32(0xaa4e0000), SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), + SPH_C32(0x123db156), SPH_C32(0x3a4e99d7), SPH_C32(0xf75a0000), + SPH_C32(0x19840028), SPH_C32(0xa2190000), SPH_C32(0xeef80000), + SPH_C32(0xc0722516), SPH_C32(0x19981260), SPH_C32(0x73dba1e6), + SPH_C32(0xe1844257) }, + { SPH_C32(0xfd0d0000), SPH_C32(0xe4810014), SPH_C32(0x9f3e0180), + SPH_C32(0xdd6a0000), SPH_C32(0x37594538), SPH_C32(0xd1cbd75b), + SPH_C32(0xdf9ea944), SPH_C32(0xa2e4d0b9), SPH_C32(0x455c0000), + SPH_C32(0xdced0028), SPH_C32(0x8a1a1200), SPH_C32(0x9a9f0000), + SPH_C32(0x76b013e2), SPH_C32(0xf28a2b98), SPH_C32(0x400a7e0a), + SPH_C32(0xe8ca73cf) }, + { SPH_C32(0x4d800000), SPH_C32(0xa6010015), SPH_C32(0x8b17e000), + SPH_C32(0x865b0000), SPH_C32(0x9ed23715), SPH_C32(0x433b0923), + SPH_C32(0xb9af46d9), SPH_C32(0x995ccfac), SPH_C32(0x2c7f0000), + SPH_C32(0x10ad0028), SPH_C32(0xebb3c000), SPH_C32(0x6f190000), + SPH_C32(0x0a8c4e4f), SPH_C32(0x5be12651), SPH_C32(0x308dca90), + SPH_C32(0x09e8f879) }, + { SPH_C32(0x53ce0000), SPH_C32(0x78ce0015), SPH_C32(0xe6efe180), + SPH_C32(0xf17f0000), SPH_C32(0x7295308b), SPH_C32(0xb79b606d), + SPH_C32(0x740c5ecb), SPH_C32(0x01f686c2), SPH_C32(0x9e790000), + SPH_C32(0xd5c40028), SPH_C32(0xc3b0d200), SPH_C32(0x1b7e0000), + SPH_C32(0xbc4e78bb), SPH_C32(0xb0f31fa9), SPH_C32(0x035c157c), + SPH_C32(0x00a6c9e1) }, + { SPH_C32(0x38660000), SPH_C32(0x33670014), SPH_C32(0xbb6cc000), + SPH_C32(0x2baf0000), SPH_C32(0x11e029ff), SPH_C32(0x67128a24), + SPH_C32(0x516bda20), SPH_C32(0xd22223f9), SPH_C32(0x82bc0000), + SPH_C32(0x8ce20029), SPH_C32(0x92622000), SPH_C32(0x430c0000), + SPH_C32(0x4f403bfc), SPH_C32(0x3db19167), SPH_C32(0x9b1f3d1f), + SPH_C32(0xaafaae02) }, + { SPH_C32(0x26280000), SPH_C32(0xeda80014), SPH_C32(0xd694c180), + SPH_C32(0x5c8b0000), SPH_C32(0xfda72e61), SPH_C32(0x93b2e36a), + SPH_C32(0x9cc8c232), SPH_C32(0x4a886a97), SPH_C32(0x30ba0000), + SPH_C32(0x498b0029), SPH_C32(0xba613200), SPH_C32(0x376b0000), + SPH_C32(0xf9820d08), SPH_C32(0xd6a3a89f), SPH_C32(0xa8cee2f3), + SPH_C32(0xa3b49f9a) }, + { SPH_C32(0x96a50000), SPH_C32(0xaf280015), SPH_C32(0xc2bd2000), + SPH_C32(0x07ba0000), SPH_C32(0x542c5c4c), SPH_C32(0x01423d12), + SPH_C32(0xfaf92daf), SPH_C32(0x71307582), SPH_C32(0x59990000), + SPH_C32(0x85cb0029), SPH_C32(0xdbc8e000), SPH_C32(0xc2ed0000), + SPH_C32(0x85be50a5), SPH_C32(0x7fc8a556), SPH_C32(0xd8495669), + SPH_C32(0x4296142c) }, + { SPH_C32(0x88eb0000), SPH_C32(0x71e70015), SPH_C32(0xaf452180), + SPH_C32(0x709e0000), SPH_C32(0xb86b5bd2), SPH_C32(0xf5e2545c), + SPH_C32(0x375a35bd), SPH_C32(0xe99a3cec), SPH_C32(0xeb9f0000), + SPH_C32(0x40a20029), SPH_C32(0xf3cbf200), SPH_C32(0xb68a0000), + SPH_C32(0x337c6651), SPH_C32(0x94da9cae), SPH_C32(0xeb988985), + SPH_C32(0x4bd825b4) }, + { SPH_C32(0x653a0000), SPH_C32(0x05770016), SPH_C32(0x135ce000), + SPH_C32(0x32180000), SPH_C32(0x4e7b25a8), SPH_C32(0x6be376ff), + SPH_C32(0xc1e0f812), SPH_C32(0x2c53436e), SPH_C32(0xc7ed0000), + SPH_C32(0xfc540028), SPH_C32(0x56ed6000), SPH_C32(0xac3c0000), + SPH_C32(0xa3ca187c), SPH_C32(0x61228600), SPH_C32(0x5274000c), + SPH_C32(0x51215a63) }, + { SPH_C32(0x7b740000), SPH_C32(0xdbb80016), SPH_C32(0x7ea4e180), + SPH_C32(0x453c0000), SPH_C32(0xa23c2236), SPH_C32(0x9f431fb1), + SPH_C32(0x0c43e000), SPH_C32(0xb4f90a00), SPH_C32(0x75eb0000), + SPH_C32(0x393d0028), SPH_C32(0x7eee7200), SPH_C32(0xd85b0000), + SPH_C32(0x15082e88), SPH_C32(0x8a30bff8), SPH_C32(0x61a5dfe0), + SPH_C32(0x586f6bfb) }, + { SPH_C32(0xcbf90000), SPH_C32(0x99380017), SPH_C32(0x6a8d0000), + SPH_C32(0x1e0d0000), SPH_C32(0x0bb7501b), SPH_C32(0x0db3c1c9), + SPH_C32(0x6a720f9d), SPH_C32(0x8f411515), SPH_C32(0x1cc80000), + SPH_C32(0xf57d0028), SPH_C32(0x1f47a000), SPH_C32(0x2ddd0000), + SPH_C32(0x69347325), SPH_C32(0x235bb231), SPH_C32(0x11226b7a), + SPH_C32(0xb94de04d) }, + { SPH_C32(0xd5b70000), SPH_C32(0x47f70017), SPH_C32(0x07750180), + SPH_C32(0x69290000), SPH_C32(0xe7f05785), SPH_C32(0xf913a887), + SPH_C32(0xa7d1178f), SPH_C32(0x17eb5c7b), SPH_C32(0xaece0000), + SPH_C32(0x30140028), SPH_C32(0x3744b200), SPH_C32(0x59ba0000), + SPH_C32(0xdff645d1), SPH_C32(0xc8498bc9), SPH_C32(0x22f3b496), + SPH_C32(0xb003d1d5) }, + { SPH_C32(0xbe1f0000), SPH_C32(0x0c5e0016), SPH_C32(0x5af62000), + SPH_C32(0xb3f90000), SPH_C32(0x84854ef1), SPH_C32(0x299a42ce), + SPH_C32(0x82b69364), SPH_C32(0xc43ff940), SPH_C32(0xb20b0000), + SPH_C32(0x69320029), SPH_C32(0x66964000), SPH_C32(0x01c80000), + SPH_C32(0x2cf80696), SPH_C32(0x450b0507), SPH_C32(0xbab09cf5), + SPH_C32(0x1a5fb636) }, + { SPH_C32(0xa0510000), SPH_C32(0xd2910016), SPH_C32(0x370e2180), + SPH_C32(0xc4dd0000), SPH_C32(0x68c2496f), SPH_C32(0xdd3a2b80), + SPH_C32(0x4f158b76), SPH_C32(0x5c95b02e), SPH_C32(0x000d0000), + SPH_C32(0xac5b0029), SPH_C32(0x4e955200), SPH_C32(0x75af0000), + SPH_C32(0x9a3a3062), SPH_C32(0xae193cff), SPH_C32(0x89614319), + SPH_C32(0x131187ae) }, + { SPH_C32(0x10dc0000), SPH_C32(0x90110017), SPH_C32(0x2327c000), + SPH_C32(0x9fec0000), SPH_C32(0xc1493b42), SPH_C32(0x4fcaf5f8), + SPH_C32(0x292464eb), SPH_C32(0x672daf3b), SPH_C32(0x692e0000), + SPH_C32(0x601b0029), SPH_C32(0x2f3c8000), SPH_C32(0x80290000), + SPH_C32(0xe6066dcf), SPH_C32(0x07723136), SPH_C32(0xf9e6f783), + SPH_C32(0xf2330c18) }, + { SPH_C32(0x0e920000), SPH_C32(0x4ede0017), SPH_C32(0x4edfc180), + SPH_C32(0xe8c80000), SPH_C32(0x2d0e3cdc), SPH_C32(0xbb6a9cb6), + SPH_C32(0xe4877cf9), SPH_C32(0xff87e655), SPH_C32(0xdb280000), + SPH_C32(0xa5720029), SPH_C32(0x073f9200), SPH_C32(0xf44e0000), + SPH_C32(0x50c45b3b), SPH_C32(0xec6008ce), SPH_C32(0xca37286f), + SPH_C32(0xfb7d3d80) }, + { SPH_C32(0xd3f40000), SPH_C32(0xdf9e0014), SPH_C32(0x06326000), + SPH_C32(0xe88a0000), SPH_C32(0xb8a67fcc), SPH_C32(0x5dd12a75), + SPH_C32(0x339210bc), SPH_C32(0x8aeb81e3), SPH_C32(0x41940000), + SPH_C32(0xc36d002a), SPH_C32(0xb7778000), SPH_C32(0x346a0000), + SPH_C32(0x36af7f72), SPH_C32(0x2faa4eea), SPH_C32(0x81a94948), + SPH_C32(0x473c80da) }, + { SPH_C32(0xcdba0000), SPH_C32(0x01510014), SPH_C32(0x6bca6180), + SPH_C32(0x9fae0000), SPH_C32(0x54e17852), SPH_C32(0xa971433b), + SPH_C32(0xfe3108ae), SPH_C32(0x1241c88d), SPH_C32(0xf3920000), + SPH_C32(0x0604002a), SPH_C32(0x9f749200), SPH_C32(0x400d0000), + SPH_C32(0x806d4986), SPH_C32(0xc4b87712), SPH_C32(0xb27896a4), + SPH_C32(0x4e72b142) }, + { SPH_C32(0x7d370000), SPH_C32(0x43d10015), SPH_C32(0x7fe38000), + SPH_C32(0xc49f0000), SPH_C32(0xfd6a0a7f), SPH_C32(0x3b819d43), + SPH_C32(0x9800e733), SPH_C32(0x29f9d798), SPH_C32(0x9ab10000), + SPH_C32(0xca44002a), SPH_C32(0xfedd4000), SPH_C32(0xb58b0000), + SPH_C32(0xfc51142b), SPH_C32(0x6dd37adb), SPH_C32(0xc2ff223e), + SPH_C32(0xaf503af4) }, + { SPH_C32(0x63790000), SPH_C32(0x9d1e0015), SPH_C32(0x121b8180), + SPH_C32(0xb3bb0000), SPH_C32(0x112d0de1), SPH_C32(0xcf21f40d), + SPH_C32(0x55a3ff21), SPH_C32(0xb1539ef6), SPH_C32(0x28b70000), + SPH_C32(0x0f2d002a), SPH_C32(0xd6de5200), SPH_C32(0xc1ec0000), + SPH_C32(0x4a9322df), SPH_C32(0x86c14323), SPH_C32(0xf12efdd2), + SPH_C32(0xa61e0b6c) }, + { SPH_C32(0x08d10000), SPH_C32(0xd6b70014), SPH_C32(0x4f98a000), + SPH_C32(0x696b0000), SPH_C32(0x72581495), SPH_C32(0x1fa81e44), + SPH_C32(0x70c47bca), SPH_C32(0x62873bcd), SPH_C32(0x34720000), + SPH_C32(0x560b002b), SPH_C32(0x870ca000), SPH_C32(0x999e0000), + SPH_C32(0xb99d6198), SPH_C32(0x0b83cded), SPH_C32(0x696dd5b1), + SPH_C32(0x0c426c8f) }, + { SPH_C32(0x169f0000), SPH_C32(0x08780014), SPH_C32(0x2260a180), + SPH_C32(0x1e4f0000), SPH_C32(0x9e1f130b), SPH_C32(0xeb08770a), + SPH_C32(0xbd6763d8), SPH_C32(0xfa2d72a3), SPH_C32(0x86740000), + SPH_C32(0x9362002b), SPH_C32(0xaf0fb200), SPH_C32(0xedf90000), + SPH_C32(0x0f5f576c), SPH_C32(0xe091f415), SPH_C32(0x5abc0a5d), + SPH_C32(0x050c5d17) }, + { SPH_C32(0xa6120000), SPH_C32(0x4af80015), SPH_C32(0x36494000), + SPH_C32(0x457e0000), SPH_C32(0x37946126), SPH_C32(0x79f8a972), + SPH_C32(0xdb568c45), SPH_C32(0xc1956db6), SPH_C32(0xef570000), + SPH_C32(0x5f22002b), SPH_C32(0xcea66000), SPH_C32(0x187f0000), + SPH_C32(0x73630ac1), SPH_C32(0x49faf9dc), SPH_C32(0x2a3bbec7), + SPH_C32(0xe42ed6a1) }, + { SPH_C32(0xb85c0000), SPH_C32(0x94370015), SPH_C32(0x5bb14180), + SPH_C32(0x325a0000), SPH_C32(0xdbd366b8), SPH_C32(0x8d58c03c), + SPH_C32(0x16f59457), SPH_C32(0x593f24d8), SPH_C32(0x5d510000), + SPH_C32(0x9a4b002b), SPH_C32(0xe6a57200), SPH_C32(0x6c180000), + SPH_C32(0xc5a13c35), SPH_C32(0xa2e8c024), SPH_C32(0x19ea612b), + SPH_C32(0xed60e739) }, + { SPH_C32(0x558d0000), SPH_C32(0xe0a70016), SPH_C32(0xe7a88000), + SPH_C32(0x70dc0000), SPH_C32(0x2dc318c2), SPH_C32(0x1359e29f), + SPH_C32(0xe04f59f8), SPH_C32(0x9cf65b5a), SPH_C32(0x71230000), + SPH_C32(0x26bd002a), SPH_C32(0x4383e000), SPH_C32(0x76ae0000), + SPH_C32(0x55174218), SPH_C32(0x5710da8a), SPH_C32(0xa006e8a2), + SPH_C32(0xf79998ee) }, + { SPH_C32(0x4bc30000), SPH_C32(0x3e680016), SPH_C32(0x8a508180), + SPH_C32(0x07f80000), SPH_C32(0xc1841f5c), SPH_C32(0xe7f98bd1), + SPH_C32(0x2dec41ea), SPH_C32(0x045c1234), SPH_C32(0xc3250000), + SPH_C32(0xe3d4002a), SPH_C32(0x6b80f200), SPH_C32(0x02c90000), + SPH_C32(0xe3d574ec), SPH_C32(0xbc02e372), SPH_C32(0x93d7374e), + SPH_C32(0xfed7a976) }, + { SPH_C32(0xfb4e0000), SPH_C32(0x7ce80017), SPH_C32(0x9e796000), + SPH_C32(0x5cc90000), SPH_C32(0x680f6d71), SPH_C32(0x750955a9), + SPH_C32(0x4bddae77), SPH_C32(0x3fe40d21), SPH_C32(0xaa060000), + SPH_C32(0x2f94002a), SPH_C32(0x0a292000), SPH_C32(0xf74f0000), + SPH_C32(0x9fe92941), SPH_C32(0x1569eebb), SPH_C32(0xe35083d4), + SPH_C32(0x1ff522c0) }, + { SPH_C32(0xe5000000), SPH_C32(0xa2270017), SPH_C32(0xf3816180), + SPH_C32(0x2bed0000), SPH_C32(0x84486aef), SPH_C32(0x81a93ce7), + SPH_C32(0x867eb665), SPH_C32(0xa74e444f), SPH_C32(0x18000000), + SPH_C32(0xeafd002a), SPH_C32(0x222a3200), SPH_C32(0x83280000), + SPH_C32(0x292b1fb5), SPH_C32(0xfe7bd743), SPH_C32(0xd0815c38), + SPH_C32(0x16bb1358) }, + { SPH_C32(0x8ea80000), SPH_C32(0xe98e0016), SPH_C32(0xae024000), + SPH_C32(0xf13d0000), SPH_C32(0xe73d739b), SPH_C32(0x5120d6ae), + SPH_C32(0xa319328e), SPH_C32(0x749ae174), SPH_C32(0x04c50000), + SPH_C32(0xb3db002b), SPH_C32(0x73f8c000), SPH_C32(0xdb5a0000), + SPH_C32(0xda255cf2), SPH_C32(0x7339598d), SPH_C32(0x48c2745b), + SPH_C32(0xbce774bb) }, + { SPH_C32(0x90e60000), SPH_C32(0x37410016), SPH_C32(0xc3fa4180), + SPH_C32(0x86190000), SPH_C32(0x0b7a7405), SPH_C32(0xa580bfe0), + SPH_C32(0x6eba2a9c), SPH_C32(0xec30a81a), SPH_C32(0xb6c30000), + SPH_C32(0x76b2002b), SPH_C32(0x5bfbd200), SPH_C32(0xaf3d0000), + SPH_C32(0x6ce76a06), SPH_C32(0x982b6075), SPH_C32(0x7b13abb7), + SPH_C32(0xb5a94523) }, + { SPH_C32(0x206b0000), SPH_C32(0x75c10017), SPH_C32(0xd7d3a000), + SPH_C32(0xdd280000), SPH_C32(0xa2f10628), SPH_C32(0x37706198), + SPH_C32(0x088bc501), SPH_C32(0xd788b70f), SPH_C32(0xdfe00000), + SPH_C32(0xbaf2002b), SPH_C32(0x3a520000), SPH_C32(0x5abb0000), + SPH_C32(0x10db37ab), SPH_C32(0x31406dbc), SPH_C32(0x0b941f2d), + SPH_C32(0x548bce95) }, + { SPH_C32(0x3e250000), SPH_C32(0xab0e0017), SPH_C32(0xba2ba180), + SPH_C32(0xaa0c0000), SPH_C32(0x4eb601b6), SPH_C32(0xc3d008d6), + SPH_C32(0xc528dd13), SPH_C32(0x4f22fe61), SPH_C32(0x6de60000), + SPH_C32(0x7f9b002b), SPH_C32(0x12511200), SPH_C32(0x2edc0000), + SPH_C32(0xa619015f), SPH_C32(0xda525444), SPH_C32(0x3845c0c1), + SPH_C32(0x5dc5ff0d) }, + { SPH_C32(0xf75a0000), SPH_C32(0x19840028), SPH_C32(0xa2190000), + SPH_C32(0xeef80000), SPH_C32(0xc0722516), SPH_C32(0x19981260), + SPH_C32(0x73dba1e6), SPH_C32(0xe1844257), SPH_C32(0x14190000), + SPH_C32(0x23ca003c), SPH_C32(0x50df0000), SPH_C32(0x44b60000), + SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), SPH_C32(0x61e610b0), + SPH_C32(0xdbcadb80) }, + { SPH_C32(0xe9140000), SPH_C32(0xc74b0028), SPH_C32(0xcfe10180), + SPH_C32(0x99dc0000), SPH_C32(0x2c352288), SPH_C32(0xed387b2e), + SPH_C32(0xbe78b9f4), SPH_C32(0x792e0b39), SPH_C32(0xa61f0000), + SPH_C32(0xe6a3003c), SPH_C32(0x78dc1200), SPH_C32(0x30d10000), + SPH_C32(0xadae5144), SPH_C32(0xd7e1958d), SPH_C32(0x5237cf5c), + SPH_C32(0xd284ea18) }, + { SPH_C32(0x59990000), SPH_C32(0x85cb0029), SPH_C32(0xdbc8e000), + SPH_C32(0xc2ed0000), SPH_C32(0x85be50a5), SPH_C32(0x7fc8a556), + SPH_C32(0xd8495669), SPH_C32(0x4296142c), SPH_C32(0xcf3c0000), + SPH_C32(0x2ae3003c), SPH_C32(0x1975c000), SPH_C32(0xc5570000), + SPH_C32(0xd1920ce9), SPH_C32(0x7e8a9844), SPH_C32(0x22b07bc6), + SPH_C32(0x33a661ae) }, + { SPH_C32(0x47d70000), SPH_C32(0x5b040029), SPH_C32(0xb630e180), + SPH_C32(0xb5c90000), SPH_C32(0x69f9573b), SPH_C32(0x8b68cc18), + SPH_C32(0x15ea4e7b), SPH_C32(0xda3c5d42), SPH_C32(0x7d3a0000), + SPH_C32(0xef8a003c), SPH_C32(0x3176d200), SPH_C32(0xb1300000), + SPH_C32(0x67503a1d), SPH_C32(0x9598a1bc), SPH_C32(0x1161a42a), + SPH_C32(0x3ae85036) }, + { SPH_C32(0x2c7f0000), SPH_C32(0x10ad0028), SPH_C32(0xebb3c000), + SPH_C32(0x6f190000), SPH_C32(0x0a8c4e4f), SPH_C32(0x5be12651), + SPH_C32(0x308dca90), SPH_C32(0x09e8f879), SPH_C32(0x61ff0000), + SPH_C32(0xb6ac003d), SPH_C32(0x60a42000), SPH_C32(0xe9420000), + SPH_C32(0x945e795a), SPH_C32(0x18da2f72), SPH_C32(0x89228c49), + SPH_C32(0x90b437d5) }, + { SPH_C32(0x32310000), SPH_C32(0xce620028), SPH_C32(0x864bc180), + SPH_C32(0x183d0000), SPH_C32(0xe6cb49d1), SPH_C32(0xaf414f1f), + SPH_C32(0xfd2ed282), SPH_C32(0x9142b117), SPH_C32(0xd3f90000), + SPH_C32(0x73c5003d), SPH_C32(0x48a73200), SPH_C32(0x9d250000), + SPH_C32(0x229c4fae), SPH_C32(0xf3c8168a), SPH_C32(0xbaf353a5), + SPH_C32(0x99fa064d) }, + { SPH_C32(0x82bc0000), SPH_C32(0x8ce20029), SPH_C32(0x92622000), + SPH_C32(0x430c0000), SPH_C32(0x4f403bfc), SPH_C32(0x3db19167), + SPH_C32(0x9b1f3d1f), SPH_C32(0xaafaae02), SPH_C32(0xbada0000), + SPH_C32(0xbf85003d), SPH_C32(0x290ee000), SPH_C32(0x68a30000), + SPH_C32(0x5ea01203), SPH_C32(0x5aa31b43), SPH_C32(0xca74e73f), + SPH_C32(0x78d88dfb) }, + { SPH_C32(0x9cf20000), SPH_C32(0x522d0029), SPH_C32(0xff9a2180), + SPH_C32(0x34280000), SPH_C32(0xa3073c62), SPH_C32(0xc911f829), + SPH_C32(0x56bc250d), SPH_C32(0x3250e76c), SPH_C32(0x08dc0000), + SPH_C32(0x7aec003d), SPH_C32(0x010df200), SPH_C32(0x1cc40000), + SPH_C32(0xe86224f7), SPH_C32(0xb1b122bb), SPH_C32(0xf9a538d3), + SPH_C32(0x7196bc63) }, + { SPH_C32(0x71230000), SPH_C32(0x26bd002a), SPH_C32(0x4383e000), + SPH_C32(0x76ae0000), SPH_C32(0x55174218), SPH_C32(0x5710da8a), + SPH_C32(0xa006e8a2), SPH_C32(0xf79998ee), SPH_C32(0x24ae0000), + SPH_C32(0xc61a003c), SPH_C32(0xa42b6000), SPH_C32(0x06720000), + SPH_C32(0x78d45ada), SPH_C32(0x44493815), SPH_C32(0x4049b15a), + SPH_C32(0x6b6fc3b4) }, + { SPH_C32(0x6f6d0000), SPH_C32(0xf872002a), SPH_C32(0x2e7be180), + SPH_C32(0x018a0000), SPH_C32(0xb9504586), SPH_C32(0xa3b0b3c4), + SPH_C32(0x6da5f0b0), SPH_C32(0x6f33d180), SPH_C32(0x96a80000), + SPH_C32(0x0373003c), SPH_C32(0x8c287200), SPH_C32(0x72150000), + SPH_C32(0xce166c2e), SPH_C32(0xaf5b01ed), SPH_C32(0x73986eb6), + SPH_C32(0x6221f22c) }, + { SPH_C32(0xdfe00000), SPH_C32(0xbaf2002b), SPH_C32(0x3a520000), + SPH_C32(0x5abb0000), SPH_C32(0x10db37ab), SPH_C32(0x31406dbc), + SPH_C32(0x0b941f2d), SPH_C32(0x548bce95), SPH_C32(0xff8b0000), + SPH_C32(0xcf33003c), SPH_C32(0xed81a000), SPH_C32(0x87930000), + SPH_C32(0xb22a3183), SPH_C32(0x06300c24), SPH_C32(0x031fda2c), + SPH_C32(0x8303799a) }, + { SPH_C32(0xc1ae0000), SPH_C32(0x643d002b), SPH_C32(0x57aa0180), + SPH_C32(0x2d9f0000), SPH_C32(0xfc9c3035), SPH_C32(0xc5e004f2), + SPH_C32(0xc637073f), SPH_C32(0xcc2187fb), SPH_C32(0x4d8d0000), + SPH_C32(0x0a5a003c), SPH_C32(0xc582b200), SPH_C32(0xf3f40000), + SPH_C32(0x04e80777), SPH_C32(0xed2235dc), SPH_C32(0x30ce05c0), + SPH_C32(0x8a4d4802) }, + { SPH_C32(0xaa060000), SPH_C32(0x2f94002a), SPH_C32(0x0a292000), + SPH_C32(0xf74f0000), SPH_C32(0x9fe92941), SPH_C32(0x1569eebb), + SPH_C32(0xe35083d4), SPH_C32(0x1ff522c0), SPH_C32(0x51480000), + SPH_C32(0x537c003d), SPH_C32(0x94504000), SPH_C32(0xab860000), + SPH_C32(0xf7e64430), SPH_C32(0x6060bb12), SPH_C32(0xa88d2da3), + SPH_C32(0x20112fe1) }, + { SPH_C32(0xb4480000), SPH_C32(0xf15b002a), SPH_C32(0x67d12180), + SPH_C32(0x806b0000), SPH_C32(0x73ae2edf), SPH_C32(0xe1c987f5), + SPH_C32(0x2ef39bc6), SPH_C32(0x875f6bae), SPH_C32(0xe34e0000), + SPH_C32(0x9615003d), SPH_C32(0xbc535200), SPH_C32(0xdfe10000), + SPH_C32(0x412472c4), SPH_C32(0x8b7282ea), SPH_C32(0x9b5cf24f), + SPH_C32(0x295f1e79) }, + { SPH_C32(0x04c50000), SPH_C32(0xb3db002b), SPH_C32(0x73f8c000), + SPH_C32(0xdb5a0000), SPH_C32(0xda255cf2), SPH_C32(0x7339598d), + SPH_C32(0x48c2745b), SPH_C32(0xbce774bb), SPH_C32(0x8a6d0000), + SPH_C32(0x5a55003d), SPH_C32(0xddfa8000), SPH_C32(0x2a670000), + SPH_C32(0x3d182f69), SPH_C32(0x22198f23), SPH_C32(0xebdb46d5), + SPH_C32(0xc87d95cf) }, + { SPH_C32(0x1a8b0000), SPH_C32(0x6d14002b), SPH_C32(0x1e00c180), + SPH_C32(0xac7e0000), SPH_C32(0x36625b6c), SPH_C32(0x879930c3), + SPH_C32(0x85616c49), SPH_C32(0x244d3dd5), SPH_C32(0x386b0000), + SPH_C32(0x9f3c003d), SPH_C32(0xf5f99200), SPH_C32(0x5e000000), + SPH_C32(0x8bda199d), SPH_C32(0xc90bb6db), SPH_C32(0xd80a9939), + SPH_C32(0xc133a457) }, + { SPH_C32(0xc7ed0000), SPH_C32(0xfc540028), SPH_C32(0x56ed6000), + SPH_C32(0xac3c0000), SPH_C32(0xa3ca187c), SPH_C32(0x61228600), + SPH_C32(0x5274000c), SPH_C32(0x51215a63), SPH_C32(0xa2d70000), + SPH_C32(0xf923003e), SPH_C32(0x45b18000), SPH_C32(0x9e240000), + SPH_C32(0xedb13dd4), SPH_C32(0x0ac1f0ff), SPH_C32(0x9394f81e), + SPH_C32(0x7d72190d) }, + { SPH_C32(0xd9a30000), SPH_C32(0x229b0028), SPH_C32(0x3b156180), + SPH_C32(0xdb180000), SPH_C32(0x4f8d1fe2), SPH_C32(0x9582ef4e), + SPH_C32(0x9fd7181e), SPH_C32(0xc98b130d), SPH_C32(0x10d10000), + SPH_C32(0x3c4a003e), SPH_C32(0x6db29200), SPH_C32(0xea430000), + SPH_C32(0x5b730b20), SPH_C32(0xe1d3c907), SPH_C32(0xa04527f2), + SPH_C32(0x743c2895) }, + { SPH_C32(0x692e0000), SPH_C32(0x601b0029), SPH_C32(0x2f3c8000), + SPH_C32(0x80290000), SPH_C32(0xe6066dcf), SPH_C32(0x07723136), + SPH_C32(0xf9e6f783), SPH_C32(0xf2330c18), SPH_C32(0x79f20000), + SPH_C32(0xf00a003e), SPH_C32(0x0c1b4000), SPH_C32(0x1fc50000), + SPH_C32(0x274f568d), SPH_C32(0x48b8c4ce), SPH_C32(0xd0c29368), + SPH_C32(0x951ea323) }, + { SPH_C32(0x77600000), SPH_C32(0xbed40029), SPH_C32(0x42c48180), + SPH_C32(0xf70d0000), SPH_C32(0x0a416a51), SPH_C32(0xf3d25878), + SPH_C32(0x3445ef91), SPH_C32(0x6a994576), SPH_C32(0xcbf40000), + SPH_C32(0x3563003e), SPH_C32(0x24185200), SPH_C32(0x6ba20000), + SPH_C32(0x918d6079), SPH_C32(0xa3aafd36), SPH_C32(0xe3134c84), + SPH_C32(0x9c5092bb) }, + { SPH_C32(0x1cc80000), SPH_C32(0xf57d0028), SPH_C32(0x1f47a000), + SPH_C32(0x2ddd0000), SPH_C32(0x69347325), SPH_C32(0x235bb231), + SPH_C32(0x11226b7a), SPH_C32(0xb94de04d), SPH_C32(0xd7310000), + SPH_C32(0x6c45003f), SPH_C32(0x75caa000), SPH_C32(0x33d00000), + SPH_C32(0x6283233e), SPH_C32(0x2ee873f8), SPH_C32(0x7b5064e7), + SPH_C32(0x360cf558) }, + { SPH_C32(0x02860000), SPH_C32(0x2bb20028), SPH_C32(0x72bfa180), + SPH_C32(0x5af90000), SPH_C32(0x857374bb), SPH_C32(0xd7fbdb7f), + SPH_C32(0xdc817368), SPH_C32(0x21e7a923), SPH_C32(0x65370000), + SPH_C32(0xa92c003f), SPH_C32(0x5dc9b200), SPH_C32(0x47b70000), + SPH_C32(0xd44115ca), SPH_C32(0xc5fa4a00), SPH_C32(0x4881bb0b), + SPH_C32(0x3f42c4c0) }, + { SPH_C32(0xb20b0000), SPH_C32(0x69320029), SPH_C32(0x66964000), + SPH_C32(0x01c80000), SPH_C32(0x2cf80696), SPH_C32(0x450b0507), + SPH_C32(0xbab09cf5), SPH_C32(0x1a5fb636), SPH_C32(0x0c140000), + SPH_C32(0x656c003f), SPH_C32(0x3c606000), SPH_C32(0xb2310000), + SPH_C32(0xa87d4867), SPH_C32(0x6c9147c9), SPH_C32(0x38060f91), + SPH_C32(0xde604f76) }, + { SPH_C32(0xac450000), SPH_C32(0xb7fd0029), SPH_C32(0x0b6e4180), + SPH_C32(0x76ec0000), SPH_C32(0xc0bf0108), SPH_C32(0xb1ab6c49), + SPH_C32(0x771384e7), SPH_C32(0x82f5ff58), SPH_C32(0xbe120000), + SPH_C32(0xa005003f), SPH_C32(0x14637200), SPH_C32(0xc6560000), + SPH_C32(0x1ebf7e93), SPH_C32(0x87837e31), SPH_C32(0x0bd7d07d), + SPH_C32(0xd72e7eee) }, + { SPH_C32(0x41940000), SPH_C32(0xc36d002a), SPH_C32(0xb7778000), + SPH_C32(0x346a0000), SPH_C32(0x36af7f72), SPH_C32(0x2faa4eea), + SPH_C32(0x81a94948), SPH_C32(0x473c80da), SPH_C32(0x92600000), + SPH_C32(0x1cf3003e), SPH_C32(0xb145e000), SPH_C32(0xdce00000), + SPH_C32(0x8e0900be), SPH_C32(0x727b649f), SPH_C32(0xb23b59f4), + SPH_C32(0xcdd70139) }, + { SPH_C32(0x5fda0000), SPH_C32(0x1da2002a), SPH_C32(0xda8f8180), + SPH_C32(0x434e0000), SPH_C32(0xdae878ec), SPH_C32(0xdb0a27a4), + SPH_C32(0x4c0a515a), SPH_C32(0xdf96c9b4), SPH_C32(0x20660000), + SPH_C32(0xd99a003e), SPH_C32(0x9946f200), SPH_C32(0xa8870000), + SPH_C32(0x38cb364a), SPH_C32(0x99695d67), SPH_C32(0x81ea8618), + SPH_C32(0xc49930a1) }, + { SPH_C32(0xef570000), SPH_C32(0x5f22002b), SPH_C32(0xcea66000), + SPH_C32(0x187f0000), SPH_C32(0x73630ac1), SPH_C32(0x49faf9dc), + SPH_C32(0x2a3bbec7), SPH_C32(0xe42ed6a1), SPH_C32(0x49450000), + SPH_C32(0x15da003e), SPH_C32(0xf8ef2000), SPH_C32(0x5d010000), + SPH_C32(0x44f76be7), SPH_C32(0x300250ae), SPH_C32(0xf16d3282), + SPH_C32(0x25bbbb17) }, + { SPH_C32(0xf1190000), SPH_C32(0x81ed002b), SPH_C32(0xa35e6180), + SPH_C32(0x6f5b0000), SPH_C32(0x9f240d5f), SPH_C32(0xbd5a9092), + SPH_C32(0xe798a6d5), SPH_C32(0x7c849fcf), SPH_C32(0xfb430000), + SPH_C32(0xd0b3003e), SPH_C32(0xd0ec3200), SPH_C32(0x29660000), + SPH_C32(0xf2355d13), SPH_C32(0xdb106956), SPH_C32(0xc2bced6e), + SPH_C32(0x2cf58a8f) }, + { SPH_C32(0x9ab10000), SPH_C32(0xca44002a), SPH_C32(0xfedd4000), + SPH_C32(0xb58b0000), SPH_C32(0xfc51142b), SPH_C32(0x6dd37adb), + SPH_C32(0xc2ff223e), SPH_C32(0xaf503af4), SPH_C32(0xe7860000), + SPH_C32(0x8995003f), SPH_C32(0x813ec000), SPH_C32(0x71140000), + SPH_C32(0x013b1e54), SPH_C32(0x5652e798), SPH_C32(0x5affc50d), + SPH_C32(0x86a9ed6c) }, + { SPH_C32(0x84ff0000), SPH_C32(0x148b002a), SPH_C32(0x93254180), + SPH_C32(0xc2af0000), SPH_C32(0x101613b5), SPH_C32(0x99731395), + SPH_C32(0x0f5c3a2c), SPH_C32(0x37fa739a), SPH_C32(0x55800000), + SPH_C32(0x4cfc003f), SPH_C32(0xa93dd200), SPH_C32(0x05730000), + SPH_C32(0xb7f928a0), SPH_C32(0xbd40de60), SPH_C32(0x692e1ae1), + SPH_C32(0x8fe7dcf4) }, + { SPH_C32(0x34720000), SPH_C32(0x560b002b), SPH_C32(0x870ca000), + SPH_C32(0x999e0000), SPH_C32(0xb99d6198), SPH_C32(0x0b83cded), + SPH_C32(0x696dd5b1), SPH_C32(0x0c426c8f), SPH_C32(0x3ca30000), + SPH_C32(0x80bc003f), SPH_C32(0xc8940000), SPH_C32(0xf0f50000), + SPH_C32(0xcbc5750d), SPH_C32(0x142bd3a9), SPH_C32(0x19a9ae7b), + SPH_C32(0x6ec55742) }, + { SPH_C32(0x2a3c0000), SPH_C32(0x88c4002b), SPH_C32(0xeaf4a180), + SPH_C32(0xeeba0000), SPH_C32(0x55da6606), SPH_C32(0xff23a4a3), + SPH_C32(0xa4cecda3), SPH_C32(0x94e825e1), SPH_C32(0x8ea50000), + SPH_C32(0x45d5003f), SPH_C32(0xe0971200), SPH_C32(0x84920000), + SPH_C32(0x7d0743f9), SPH_C32(0xff39ea51), SPH_C32(0x2a787197), + SPH_C32(0x678b66da) } +}; + +static const sph_u32 T512_35[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x52500000), SPH_C32(0x29540000), SPH_C32(0x6a61004e), + SPH_C32(0xf0ff0000), SPH_C32(0x9a317eec), SPH_C32(0x452341ce), + SPH_C32(0xcf568fe5), SPH_C32(0x5303130f), SPH_C32(0x538d0000), + SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), SPH_C32(0x56ff0000), + SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), SPH_C32(0xa9444018), + SPH_C32(0x7f975691) }, + { SPH_C32(0x538d0000), SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), + SPH_C32(0x56ff0000), SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), + SPH_C32(0xa9444018), SPH_C32(0x7f975691), SPH_C32(0x01dd0000), + SPH_C32(0x80a80000), SPH_C32(0xf4960048), SPH_C32(0xa6000000), + SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), SPH_C32(0x6612cffd), + SPH_C32(0x2c94459e) }, + { SPH_C32(0x01dd0000), SPH_C32(0x80a80000), SPH_C32(0xf4960048), + SPH_C32(0xa6000000), SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), + SPH_C32(0x6612cffd), SPH_C32(0x2c94459e), SPH_C32(0x52500000), + SPH_C32(0x29540000), SPH_C32(0x6a61004e), SPH_C32(0xf0ff0000), + SPH_C32(0x9a317eec), SPH_C32(0x452341ce), SPH_C32(0xcf568fe5), + SPH_C32(0x5303130f) }, + { SPH_C32(0xcc140000), SPH_C32(0xa5630000), SPH_C32(0x5ab90780), + SPH_C32(0x3b500000), SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), + SPH_C32(0x694348c1), SPH_C32(0xca5a87fe), SPH_C32(0x819e0000), + SPH_C32(0xec570000), SPH_C32(0x66320280), SPH_C32(0x95f30000), + SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), SPH_C32(0xe65aa22d), + SPH_C32(0x8e67b7fa) }, + { SPH_C32(0x9e440000), SPH_C32(0x8c370000), SPH_C32(0x30d807ce), + SPH_C32(0xcbaf0000), SPH_C32(0xd1e16d13), SPH_C32(0xc2b875d6), + SPH_C32(0xa615c724), SPH_C32(0x995994f1), SPH_C32(0xd2130000), + SPH_C32(0x45ab0000), SPH_C32(0xf8c50286), SPH_C32(0xc30c0000), + SPH_C32(0x574d284c), SPH_C32(0xda31f145), SPH_C32(0x4f1ee235), + SPH_C32(0xf1f0e16b) }, + { SPH_C32(0x9f990000), SPH_C32(0x0c9f0000), SPH_C32(0xc44e0786), + SPH_C32(0x6daf0000), SPH_C32(0x413413b1), SPH_C32(0x155ef9e1), + SPH_C32(0xc00708d9), SPH_C32(0xb5cdd16f), SPH_C32(0x80430000), + SPH_C32(0x6cff0000), SPH_C32(0x92a402c8), SPH_C32(0x33f30000), + SPH_C32(0xcd7c56a0), SPH_C32(0x9f12b08b), SPH_C32(0x80486dd0), + SPH_C32(0xa2f3f264) }, + { SPH_C32(0xcdc90000), SPH_C32(0x25cb0000), SPH_C32(0xae2f07c8), + SPH_C32(0x9d500000), SPH_C32(0xdb056d5d), SPH_C32(0x507db82f), + SPH_C32(0x0f51873c), SPH_C32(0xe6cec260), SPH_C32(0xd3ce0000), + SPH_C32(0xc5030000), SPH_C32(0x0c5302ce), SPH_C32(0x650c0000), + SPH_C32(0xc79856ee), SPH_C32(0x0dd77d72), SPH_C32(0x290c2dc8), + SPH_C32(0xdd64a4f5) }, + { SPH_C32(0x819e0000), SPH_C32(0xec570000), SPH_C32(0x66320280), + SPH_C32(0x95f30000), SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), + SPH_C32(0xe65aa22d), SPH_C32(0x8e67b7fa), SPH_C32(0x4d8a0000), + SPH_C32(0x49340000), SPH_C32(0x3c8b0500), SPH_C32(0xaea30000), + SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), SPH_C32(0x8f19eaec), + SPH_C32(0x443d3004) }, + { SPH_C32(0xd3ce0000), SPH_C32(0xc5030000), SPH_C32(0x0c5302ce), + SPH_C32(0x650c0000), SPH_C32(0xc79856ee), SPH_C32(0x0dd77d72), + SPH_C32(0x290c2dc8), SPH_C32(0xdd64a4f5), SPH_C32(0x1e070000), + SPH_C32(0xe0c80000), SPH_C32(0xa27c0506), SPH_C32(0xf85c0000), + SPH_C32(0x1c9d3bb3), SPH_C32(0x5daac55d), SPH_C32(0x265daaf4), + SPH_C32(0x3baa6695) }, + { SPH_C32(0xd2130000), SPH_C32(0x45ab0000), SPH_C32(0xf8c50286), + SPH_C32(0xc30c0000), SPH_C32(0x574d284c), SPH_C32(0xda31f145), + SPH_C32(0x4f1ee235), SPH_C32(0xf1f0e16b), SPH_C32(0x4c570000), + SPH_C32(0xc99c0000), SPH_C32(0xc81d0548), SPH_C32(0x08a30000), + SPH_C32(0x86ac455f), SPH_C32(0x18898493), SPH_C32(0xe90b2511), + SPH_C32(0x68a9759a) }, + { SPH_C32(0x80430000), SPH_C32(0x6cff0000), SPH_C32(0x92a402c8), + SPH_C32(0x33f30000), SPH_C32(0xcd7c56a0), SPH_C32(0x9f12b08b), + SPH_C32(0x80486dd0), SPH_C32(0xa2f3f264), SPH_C32(0x1fda0000), + SPH_C32(0x60600000), SPH_C32(0x56ea054e), SPH_C32(0x5e5c0000), + SPH_C32(0x8c484511), SPH_C32(0x8a4c496a), SPH_C32(0x404f6509), + SPH_C32(0x173e230b) }, + { SPH_C32(0x4d8a0000), SPH_C32(0x49340000), SPH_C32(0x3c8b0500), + SPH_C32(0xaea30000), SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), + SPH_C32(0x8f19eaec), SPH_C32(0x443d3004), SPH_C32(0xcc140000), + SPH_C32(0xa5630000), SPH_C32(0x5ab90780), SPH_C32(0x3b500000), + SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), SPH_C32(0x694348c1), + SPH_C32(0xca5a87fe) }, + { SPH_C32(0x1fda0000), SPH_C32(0x60600000), SPH_C32(0x56ea054e), + SPH_C32(0x5e5c0000), SPH_C32(0x8c484511), SPH_C32(0x8a4c496a), + SPH_C32(0x404f6509), SPH_C32(0x173e230b), SPH_C32(0x9f990000), + SPH_C32(0x0c9f0000), SPH_C32(0xc44e0786), SPH_C32(0x6daf0000), + SPH_C32(0x413413b1), SPH_C32(0x155ef9e1), SPH_C32(0xc00708d9), + SPH_C32(0xb5cdd16f) }, + { SPH_C32(0x1e070000), SPH_C32(0xe0c80000), SPH_C32(0xa27c0506), + SPH_C32(0xf85c0000), SPH_C32(0x1c9d3bb3), SPH_C32(0x5daac55d), + SPH_C32(0x265daaf4), SPH_C32(0x3baa6695), SPH_C32(0xcdc90000), + SPH_C32(0x25cb0000), SPH_C32(0xae2f07c8), SPH_C32(0x9d500000), + SPH_C32(0xdb056d5d), SPH_C32(0x507db82f), SPH_C32(0x0f51873c), + SPH_C32(0xe6cec260) }, + { SPH_C32(0x4c570000), SPH_C32(0xc99c0000), SPH_C32(0xc81d0548), + SPH_C32(0x08a30000), SPH_C32(0x86ac455f), SPH_C32(0x18898493), + SPH_C32(0xe90b2511), SPH_C32(0x68a9759a), SPH_C32(0x9e440000), + SPH_C32(0x8c370000), SPH_C32(0x30d807ce), SPH_C32(0xcbaf0000), + SPH_C32(0xd1e16d13), SPH_C32(0xc2b875d6), SPH_C32(0xa615c724), + SPH_C32(0x995994f1) }, + { SPH_C32(0x78230000), SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), + SPH_C32(0x90a50000), SPH_C32(0x713e2879), SPH_C32(0x7ee98924), + SPH_C32(0xf08ca062), SPH_C32(0x636f8bab), SPH_C32(0x02af0000), + SPH_C32(0xb7280000), SPH_C32(0xba1c0300), SPH_C32(0x56980000), + SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), SPH_C32(0xa95c149a), + SPH_C32(0xf4f6ea7b) }, + { SPH_C32(0x2a730000), SPH_C32(0x3ba80000), SPH_C32(0xc35b0bce), + SPH_C32(0x605a0000), SPH_C32(0xeb0f5695), SPH_C32(0x3bcac8ea), + SPH_C32(0x3fda2f87), SPH_C32(0x306c98a4), SPH_C32(0x51220000), + SPH_C32(0x1ed40000), SPH_C32(0x24eb0306), SPH_C32(0x00670000), + SPH_C32(0xb069459d), SPH_C32(0x128d0b9e), SPH_C32(0x00185482), + SPH_C32(0x8b61bcea) }, + { SPH_C32(0x2bae0000), SPH_C32(0xbb000000), SPH_C32(0x37cd0b86), + SPH_C32(0xc65a0000), SPH_C32(0x7bda2837), SPH_C32(0xec2c44dd), + SPH_C32(0x59c8e07a), SPH_C32(0x1cf8dd3a), SPH_C32(0x03720000), + SPH_C32(0x37800000), SPH_C32(0x4e8a0348), SPH_C32(0xf0980000), + SPH_C32(0x2a583b71), SPH_C32(0x57ae4a50), SPH_C32(0xcf4edb67), + SPH_C32(0xd862afe5) }, + { SPH_C32(0x79fe0000), SPH_C32(0x92540000), SPH_C32(0x5dac0bc8), + SPH_C32(0x36a50000), SPH_C32(0xe1eb56db), SPH_C32(0xa90f0513), + SPH_C32(0x969e6f9f), SPH_C32(0x4ffbce35), SPH_C32(0x50ff0000), + SPH_C32(0x9e7c0000), SPH_C32(0xd07d034e), SPH_C32(0xa6670000), + SPH_C32(0x20bc3b3f), SPH_C32(0xc56b87a9), SPH_C32(0x660a9b7f), + SPH_C32(0xa7f5f974) }, + { SPH_C32(0xb4370000), SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), + SPH_C32(0xabf50000), SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), + SPH_C32(0x99cfe8a3), SPH_C32(0xa9350c55), SPH_C32(0x83310000), + SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), SPH_C32(0xc36b0000), + SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), SPH_C32(0x4f06b6b7), + SPH_C32(0x7a915d81) }, + { SPH_C32(0xe6670000), SPH_C32(0x9ecb0000), SPH_C32(0x99e20c4e), + SPH_C32(0x5b0a0000), SPH_C32(0xa0df456a), SPH_C32(0xbc51fcf2), + SPH_C32(0x56996746), SPH_C32(0xfa361f5a), SPH_C32(0xd0bc0000), + SPH_C32(0xf2830000), SPH_C32(0x42d90186), SPH_C32(0x95940000), + SPH_C32(0xedc06d9f), SPH_C32(0x5a793722), SPH_C32(0xe642f6af), + SPH_C32(0x05060b10) }, + { SPH_C32(0xe7ba0000), SPH_C32(0x1e630000), SPH_C32(0x6d740c06), + SPH_C32(0xfd0a0000), SPH_C32(0x300a3bc8), SPH_C32(0x6bb770c5), + SPH_C32(0x308ba8bb), SPH_C32(0xd6a25ac4), SPH_C32(0x82ec0000), + SPH_C32(0xdbd70000), SPH_C32(0x28b801c8), SPH_C32(0x656b0000), + SPH_C32(0x77f11373), SPH_C32(0x1f5a76ec), SPH_C32(0x2914794a), + SPH_C32(0x5605181f) }, + { SPH_C32(0xb5ea0000), SPH_C32(0x37370000), SPH_C32(0x07150c48), + SPH_C32(0x0df50000), SPH_C32(0xaa3b4524), SPH_C32(0x2e94310b), + SPH_C32(0xffdd275e), SPH_C32(0x85a149cb), SPH_C32(0xd1610000), + SPH_C32(0x722b0000), SPH_C32(0xb64f01ce), SPH_C32(0x33940000), + SPH_C32(0x7d15133d), SPH_C32(0x8d9fbb15), SPH_C32(0x80503952), + SPH_C32(0x29924e8e) }, + { SPH_C32(0xf9bd0000), SPH_C32(0xfeab0000), SPH_C32(0xcf080900), + SPH_C32(0x05560000), SPH_C32(0x2c97007b), SPH_C32(0x361db598), + SPH_C32(0x16d6024f), SPH_C32(0xed083c51), SPH_C32(0x4f250000), + SPH_C32(0xfe1c0000), SPH_C32(0x86970600), SPH_C32(0xf83b0000), + SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), SPH_C32(0x2645fe76), + SPH_C32(0xb0cbda7f) }, + { SPH_C32(0xabed0000), SPH_C32(0xd7ff0000), SPH_C32(0xa569094e), + SPH_C32(0xf5a90000), SPH_C32(0xb6a67e97), SPH_C32(0x733ef456), + SPH_C32(0xd9808daa), SPH_C32(0xbe0b2f5e), SPH_C32(0x1ca80000), + SPH_C32(0x57e00000), SPH_C32(0x18600606), SPH_C32(0xaec40000), + SPH_C32(0xa6107e60), SPH_C32(0xdde2033a), SPH_C32(0x8f01be6e), + SPH_C32(0xcf5c8cee) }, + { SPH_C32(0xaa300000), SPH_C32(0x57570000), SPH_C32(0x51ff0906), + SPH_C32(0x53a90000), SPH_C32(0x26730035), SPH_C32(0xa4d87861), + SPH_C32(0xbf924257), SPH_C32(0x929f6ac0), SPH_C32(0x4ef80000), + SPH_C32(0x7eb40000), SPH_C32(0x72010648), SPH_C32(0x5e3b0000), + SPH_C32(0x3c21008c), SPH_C32(0x98c142f4), SPH_C32(0x4057318b), + SPH_C32(0x9c5f9fe1) }, + { SPH_C32(0xf8600000), SPH_C32(0x7e030000), SPH_C32(0x3b9e0948), + SPH_C32(0xa3560000), SPH_C32(0xbc427ed9), SPH_C32(0xe1fb39af), + SPH_C32(0x70c4cdb2), SPH_C32(0xc19c79cf), SPH_C32(0x1d750000), + SPH_C32(0xd7480000), SPH_C32(0xecf6064e), SPH_C32(0x08c40000), + SPH_C32(0x36c500c2), SPH_C32(0x0a048f0d), SPH_C32(0xe9137193), + SPH_C32(0xe3c8c970) }, + { SPH_C32(0x35a90000), SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), + SPH_C32(0x3e060000), SPH_C32(0x67471384), SPH_C32(0xb1868180), + SPH_C32(0x7f954a8e), SPH_C32(0x2752bbaf), SPH_C32(0xcebb0000), + SPH_C32(0x124b0000), SPH_C32(0xe0a50480), SPH_C32(0x6dc80000), + SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), SPH_C32(0xc01f5c5b), + SPH_C32(0x3eac6d85) }, + { SPH_C32(0x67f90000), SPH_C32(0x729c0000), SPH_C32(0xffd00ece), + SPH_C32(0xcef90000), SPH_C32(0xfd766d68), SPH_C32(0xf4a5c04e), + SPH_C32(0xb0c3c56b), SPH_C32(0x7451a8a0), SPH_C32(0x9d360000), + SPH_C32(0xbbb70000), SPH_C32(0x7e520486), SPH_C32(0x3b370000), + SPH_C32(0xfbb95662), SPH_C32(0x95163f86), SPH_C32(0x695b1c43), + SPH_C32(0x413b3b14) }, + { SPH_C32(0x66240000), SPH_C32(0xf2340000), SPH_C32(0x0b460e86), + SPH_C32(0x68f90000), SPH_C32(0x6da313ca), SPH_C32(0x23434c79), + SPH_C32(0xd6d10a96), SPH_C32(0x58c5ed3e), SPH_C32(0xcf660000), + SPH_C32(0x92e30000), SPH_C32(0x143304c8), SPH_C32(0xcbc80000), + SPH_C32(0x6188288e), SPH_C32(0xd0357e48), SPH_C32(0xa60d93a6), + SPH_C32(0x1238281b) }, + { SPH_C32(0x34740000), SPH_C32(0xdb600000), SPH_C32(0x61270ec8), + SPH_C32(0x98060000), SPH_C32(0xf7926d26), SPH_C32(0x66600db7), + SPH_C32(0x19878573), SPH_C32(0x0bc6fe31), SPH_C32(0x9ceb0000), + SPH_C32(0x3b1f0000), SPH_C32(0x8ac404ce), SPH_C32(0x9d370000), + SPH_C32(0x6b6c28c0), SPH_C32(0x42f0b3b1), SPH_C32(0x0f49d3be), + SPH_C32(0x6daf7e8a) }, + { SPH_C32(0x02af0000), SPH_C32(0xb7280000), SPH_C32(0xba1c0300), + SPH_C32(0x56980000), SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), + SPH_C32(0xa95c149a), SPH_C32(0xf4f6ea7b), SPH_C32(0x7a8c0000), + SPH_C32(0xa5d40000), SPH_C32(0x13260880), SPH_C32(0xc63d0000), + SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), SPH_C32(0x59d0b4f8), + SPH_C32(0x979961d0) }, + { SPH_C32(0x50ff0000), SPH_C32(0x9e7c0000), SPH_C32(0xd07d034e), + SPH_C32(0xa6670000), SPH_C32(0x20bc3b3f), SPH_C32(0xc56b87a9), + SPH_C32(0x660a9b7f), SPH_C32(0xa7f5f974), SPH_C32(0x29010000), + SPH_C32(0x0c280000), SPH_C32(0x8dd10886), SPH_C32(0x90c20000), + SPH_C32(0xc1576de4), SPH_C32(0x6c6482ba), SPH_C32(0xf094f4e0), + SPH_C32(0xe80e3741) }, + { SPH_C32(0x51220000), SPH_C32(0x1ed40000), SPH_C32(0x24eb0306), + SPH_C32(0x00670000), SPH_C32(0xb069459d), SPH_C32(0x128d0b9e), + SPH_C32(0x00185482), SPH_C32(0x8b61bcea), SPH_C32(0x7b510000), + SPH_C32(0x257c0000), SPH_C32(0xe7b008c8), SPH_C32(0x603d0000), + SPH_C32(0x5b661308), SPH_C32(0x2947c374), SPH_C32(0x3fc27b05), + SPH_C32(0xbb0d244e) }, + { SPH_C32(0x03720000), SPH_C32(0x37800000), SPH_C32(0x4e8a0348), + SPH_C32(0xf0980000), SPH_C32(0x2a583b71), SPH_C32(0x57ae4a50), + SPH_C32(0xcf4edb67), SPH_C32(0xd862afe5), SPH_C32(0x28dc0000), + SPH_C32(0x8c800000), SPH_C32(0x794708ce), SPH_C32(0x36c20000), + SPH_C32(0x51821346), SPH_C32(0xbb820e8d), SPH_C32(0x96863b1d), + SPH_C32(0xc49a72df) }, + { SPH_C32(0xcebb0000), SPH_C32(0x124b0000), SPH_C32(0xe0a50480), + SPH_C32(0x6dc80000), SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), + SPH_C32(0xc01f5c5b), SPH_C32(0x3eac6d85), SPH_C32(0xfb120000), + SPH_C32(0x49830000), SPH_C32(0x75140a00), SPH_C32(0x53ce0000), + SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), SPH_C32(0xbf8a16d5), + SPH_C32(0x19fed62a) }, + { SPH_C32(0x9ceb0000), SPH_C32(0x3b1f0000), SPH_C32(0x8ac404ce), + SPH_C32(0x9d370000), SPH_C32(0x6b6c28c0), SPH_C32(0x42f0b3b1), + SPH_C32(0x0f49d3be), SPH_C32(0x6daf7e8a), SPH_C32(0xa89f0000), + SPH_C32(0xe07f0000), SPH_C32(0xebe30a06), SPH_C32(0x05310000), + SPH_C32(0x9cfe45e6), SPH_C32(0x2490be06), SPH_C32(0x16ce56cd), + SPH_C32(0x666980bb) }, + { SPH_C32(0x9d360000), SPH_C32(0xbbb70000), SPH_C32(0x7e520486), + SPH_C32(0x3b370000), SPH_C32(0xfbb95662), SPH_C32(0x95163f86), + SPH_C32(0x695b1c43), SPH_C32(0x413b3b14), SPH_C32(0xfacf0000), + SPH_C32(0xc92b0000), SPH_C32(0x81820a48), SPH_C32(0xf5ce0000), + SPH_C32(0x06cf3b0a), SPH_C32(0x61b3ffc8), SPH_C32(0xd998d928), + SPH_C32(0x356a93b4) }, + { SPH_C32(0xcf660000), SPH_C32(0x92e30000), SPH_C32(0x143304c8), + SPH_C32(0xcbc80000), SPH_C32(0x6188288e), SPH_C32(0xd0357e48), + SPH_C32(0xa60d93a6), SPH_C32(0x1238281b), SPH_C32(0xa9420000), + SPH_C32(0x60d70000), SPH_C32(0x1f750a4e), SPH_C32(0xa3310000), + SPH_C32(0x0c2b3b44), SPH_C32(0xf3763231), SPH_C32(0x70dc9930), + SPH_C32(0x4afdc525) }, + { SPH_C32(0x83310000), SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), + SPH_C32(0xc36b0000), SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), + SPH_C32(0x4f06b6b7), SPH_C32(0x7a915d81), SPH_C32(0x37060000), + SPH_C32(0xece00000), SPH_C32(0x2fad0d80), SPH_C32(0x689e0000), + SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), SPH_C32(0xd6c95e14), + SPH_C32(0xd3a451d4) }, + { SPH_C32(0xd1610000), SPH_C32(0x722b0000), SPH_C32(0xb64f01ce), + SPH_C32(0x33940000), SPH_C32(0x7d15133d), SPH_C32(0x8d9fbb15), + SPH_C32(0x80503952), SPH_C32(0x29924e8e), SPH_C32(0x648b0000), + SPH_C32(0x451c0000), SPH_C32(0xb15a0d86), SPH_C32(0x3e610000), + SPH_C32(0xd72e5619), SPH_C32(0xa30b8a1e), SPH_C32(0x7f8d1e0c), + SPH_C32(0xac330745) }, + { SPH_C32(0xd0bc0000), SPH_C32(0xf2830000), SPH_C32(0x42d90186), + SPH_C32(0x95940000), SPH_C32(0xedc06d9f), SPH_C32(0x5a793722), + SPH_C32(0xe642f6af), SPH_C32(0x05060b10), SPH_C32(0x36db0000), + SPH_C32(0x6c480000), SPH_C32(0xdb3b0dc8), SPH_C32(0xce9e0000), + SPH_C32(0x4d1f28f5), SPH_C32(0xe628cbd0), SPH_C32(0xb0db91e9), + SPH_C32(0xff30144a) }, + { SPH_C32(0x82ec0000), SPH_C32(0xdbd70000), SPH_C32(0x28b801c8), + SPH_C32(0x656b0000), SPH_C32(0x77f11373), SPH_C32(0x1f5a76ec), + SPH_C32(0x2914794a), SPH_C32(0x5605181f), SPH_C32(0x65560000), + SPH_C32(0xc5b40000), SPH_C32(0x45cc0dce), SPH_C32(0x98610000), + SPH_C32(0x47fb28bb), SPH_C32(0x74ed0629), SPH_C32(0x199fd1f1), + SPH_C32(0x80a742db) }, + { SPH_C32(0x4f250000), SPH_C32(0xfe1c0000), SPH_C32(0x86970600), + SPH_C32(0xf83b0000), SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), + SPH_C32(0x2645fe76), SPH_C32(0xb0cbda7f), SPH_C32(0xb6980000), + SPH_C32(0x00b70000), SPH_C32(0x499f0f00), SPH_C32(0xfd6d0000), + SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), SPH_C32(0x3093fc39), + SPH_C32(0x5dc3e62e) }, + { SPH_C32(0x1d750000), SPH_C32(0xd7480000), SPH_C32(0xecf6064e), + SPH_C32(0x08c40000), SPH_C32(0x36c500c2), SPH_C32(0x0a048f0d), + SPH_C32(0xe9137193), SPH_C32(0xe3c8c970), SPH_C32(0xe5150000), + SPH_C32(0xa94b0000), SPH_C32(0xd7680f06), SPH_C32(0xab920000), + SPH_C32(0x8a877e1b), SPH_C32(0xebffb6a2), SPH_C32(0x99d7bc21), + SPH_C32(0x2254b0bf) }, + { SPH_C32(0x1ca80000), SPH_C32(0x57e00000), SPH_C32(0x18600606), + SPH_C32(0xaec40000), SPH_C32(0xa6107e60), SPH_C32(0xdde2033a), + SPH_C32(0x8f01be6e), SPH_C32(0xcf5c8cee), SPH_C32(0xb7450000), + SPH_C32(0x801f0000), SPH_C32(0xbd090f48), SPH_C32(0x5b6d0000), + SPH_C32(0x10b600f7), SPH_C32(0xaedcf76c), SPH_C32(0x568133c4), + SPH_C32(0x7157a3b0) }, + { SPH_C32(0x4ef80000), SPH_C32(0x7eb40000), SPH_C32(0x72010648), + SPH_C32(0x5e3b0000), SPH_C32(0x3c21008c), SPH_C32(0x98c142f4), + SPH_C32(0x4057318b), SPH_C32(0x9c5f9fe1), SPH_C32(0xe4c80000), + SPH_C32(0x29e30000), SPH_C32(0x23fe0f4e), SPH_C32(0x0d920000), + SPH_C32(0x1a5200b9), SPH_C32(0x3c193a95), SPH_C32(0xffc573dc), + SPH_C32(0x0ec0f521) }, + { SPH_C32(0x7a8c0000), SPH_C32(0xa5d40000), SPH_C32(0x13260880), + SPH_C32(0xc63d0000), SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), + SPH_C32(0x59d0b4f8), SPH_C32(0x979961d0), SPH_C32(0x78230000), + SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), SPH_C32(0x90a50000), + SPH_C32(0x713e2879), SPH_C32(0x7ee98924), SPH_C32(0xf08ca062), + SPH_C32(0x636f8bab) }, + { SPH_C32(0x28dc0000), SPH_C32(0x8c800000), SPH_C32(0x794708ce), + SPH_C32(0x36c20000), SPH_C32(0x51821346), SPH_C32(0xbb820e8d), + SPH_C32(0x96863b1d), SPH_C32(0xc49a72df), SPH_C32(0x2bae0000), + SPH_C32(0xbb000000), SPH_C32(0x37cd0b86), SPH_C32(0xc65a0000), + SPH_C32(0x7bda2837), SPH_C32(0xec2c44dd), SPH_C32(0x59c8e07a), + SPH_C32(0x1cf8dd3a) }, + { SPH_C32(0x29010000), SPH_C32(0x0c280000), SPH_C32(0x8dd10886), + SPH_C32(0x90c20000), SPH_C32(0xc1576de4), SPH_C32(0x6c6482ba), + SPH_C32(0xf094f4e0), SPH_C32(0xe80e3741), SPH_C32(0x79fe0000), + SPH_C32(0x92540000), SPH_C32(0x5dac0bc8), SPH_C32(0x36a50000), + SPH_C32(0xe1eb56db), SPH_C32(0xa90f0513), SPH_C32(0x969e6f9f), + SPH_C32(0x4ffbce35) }, + { SPH_C32(0x7b510000), SPH_C32(0x257c0000), SPH_C32(0xe7b008c8), + SPH_C32(0x603d0000), SPH_C32(0x5b661308), SPH_C32(0x2947c374), + SPH_C32(0x3fc27b05), SPH_C32(0xbb0d244e), SPH_C32(0x2a730000), + SPH_C32(0x3ba80000), SPH_C32(0xc35b0bce), SPH_C32(0x605a0000), + SPH_C32(0xeb0f5695), SPH_C32(0x3bcac8ea), SPH_C32(0x3fda2f87), + SPH_C32(0x306c98a4) }, + { SPH_C32(0xb6980000), SPH_C32(0x00b70000), SPH_C32(0x499f0f00), + SPH_C32(0xfd6d0000), SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), + SPH_C32(0x3093fc39), SPH_C32(0x5dc3e62e), SPH_C32(0xf9bd0000), + SPH_C32(0xfeab0000), SPH_C32(0xcf080900), SPH_C32(0x05560000), + SPH_C32(0x2c97007b), SPH_C32(0x361db598), SPH_C32(0x16d6024f), + SPH_C32(0xed083c51) }, + { SPH_C32(0xe4c80000), SPH_C32(0x29e30000), SPH_C32(0x23fe0f4e), + SPH_C32(0x0d920000), SPH_C32(0x1a5200b9), SPH_C32(0x3c193a95), + SPH_C32(0xffc573dc), SPH_C32(0x0ec0f521), SPH_C32(0xaa300000), + SPH_C32(0x57570000), SPH_C32(0x51ff0906), SPH_C32(0x53a90000), + SPH_C32(0x26730035), SPH_C32(0xa4d87861), SPH_C32(0xbf924257), + SPH_C32(0x929f6ac0) }, + { SPH_C32(0xe5150000), SPH_C32(0xa94b0000), SPH_C32(0xd7680f06), + SPH_C32(0xab920000), SPH_C32(0x8a877e1b), SPH_C32(0xebffb6a2), + SPH_C32(0x99d7bc21), SPH_C32(0x2254b0bf), SPH_C32(0xf8600000), + SPH_C32(0x7e030000), SPH_C32(0x3b9e0948), SPH_C32(0xa3560000), + SPH_C32(0xbc427ed9), SPH_C32(0xe1fb39af), SPH_C32(0x70c4cdb2), + SPH_C32(0xc19c79cf) }, + { SPH_C32(0xb7450000), SPH_C32(0x801f0000), SPH_C32(0xbd090f48), + SPH_C32(0x5b6d0000), SPH_C32(0x10b600f7), SPH_C32(0xaedcf76c), + SPH_C32(0x568133c4), SPH_C32(0x7157a3b0), SPH_C32(0xabed0000), + SPH_C32(0xd7ff0000), SPH_C32(0xa569094e), SPH_C32(0xf5a90000), + SPH_C32(0xb6a67e97), SPH_C32(0x733ef456), SPH_C32(0xd9808daa), + SPH_C32(0xbe0b2f5e) }, + { SPH_C32(0xfb120000), SPH_C32(0x49830000), SPH_C32(0x75140a00), + SPH_C32(0x53ce0000), SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), + SPH_C32(0xbf8a16d5), SPH_C32(0x19fed62a), SPH_C32(0x35a90000), + SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), SPH_C32(0x3e060000), + SPH_C32(0x67471384), SPH_C32(0xb1868180), SPH_C32(0x7f954a8e), + SPH_C32(0x2752bbaf) }, + { SPH_C32(0xa9420000), SPH_C32(0x60d70000), SPH_C32(0x1f750a4e), + SPH_C32(0xa3310000), SPH_C32(0x0c2b3b44), SPH_C32(0xf3763231), + SPH_C32(0x70dc9930), SPH_C32(0x4afdc525), SPH_C32(0x66240000), + SPH_C32(0xf2340000), SPH_C32(0x0b460e86), SPH_C32(0x68f90000), + SPH_C32(0x6da313ca), SPH_C32(0x23434c79), SPH_C32(0xd6d10a96), + SPH_C32(0x58c5ed3e) }, + { SPH_C32(0xa89f0000), SPH_C32(0xe07f0000), SPH_C32(0xebe30a06), + SPH_C32(0x05310000), SPH_C32(0x9cfe45e6), SPH_C32(0x2490be06), + SPH_C32(0x16ce56cd), SPH_C32(0x666980bb), SPH_C32(0x34740000), + SPH_C32(0xdb600000), SPH_C32(0x61270ec8), SPH_C32(0x98060000), + SPH_C32(0xf7926d26), SPH_C32(0x66600db7), SPH_C32(0x19878573), + SPH_C32(0x0bc6fe31) }, + { SPH_C32(0xfacf0000), SPH_C32(0xc92b0000), SPH_C32(0x81820a48), + SPH_C32(0xf5ce0000), SPH_C32(0x06cf3b0a), SPH_C32(0x61b3ffc8), + SPH_C32(0xd998d928), SPH_C32(0x356a93b4), SPH_C32(0x67f90000), + SPH_C32(0x729c0000), SPH_C32(0xffd00ece), SPH_C32(0xcef90000), + SPH_C32(0xfd766d68), SPH_C32(0xf4a5c04e), SPH_C32(0xb0c3c56b), + SPH_C32(0x7451a8a0) }, + { SPH_C32(0x37060000), SPH_C32(0xece00000), SPH_C32(0x2fad0d80), + SPH_C32(0x689e0000), SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), + SPH_C32(0xd6c95e14), SPH_C32(0xd3a451d4), SPH_C32(0xb4370000), + SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), SPH_C32(0xabf50000), + SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), SPH_C32(0x99cfe8a3), + SPH_C32(0xa9350c55) }, + { SPH_C32(0x65560000), SPH_C32(0xc5b40000), SPH_C32(0x45cc0dce), + SPH_C32(0x98610000), SPH_C32(0x47fb28bb), SPH_C32(0x74ed0629), + SPH_C32(0x199fd1f1), SPH_C32(0x80a742db), SPH_C32(0xe7ba0000), + SPH_C32(0x1e630000), SPH_C32(0x6d740c06), SPH_C32(0xfd0a0000), + SPH_C32(0x300a3bc8), SPH_C32(0x6bb770c5), SPH_C32(0x308ba8bb), + SPH_C32(0xd6a25ac4) }, + { SPH_C32(0x648b0000), SPH_C32(0x451c0000), SPH_C32(0xb15a0d86), + SPH_C32(0x3e610000), SPH_C32(0xd72e5619), SPH_C32(0xa30b8a1e), + SPH_C32(0x7f8d1e0c), SPH_C32(0xac330745), SPH_C32(0xb5ea0000), + SPH_C32(0x37370000), SPH_C32(0x07150c48), SPH_C32(0x0df50000), + SPH_C32(0xaa3b4524), SPH_C32(0x2e94310b), SPH_C32(0xffdd275e), + SPH_C32(0x85a149cb) }, + { SPH_C32(0x36db0000), SPH_C32(0x6c480000), SPH_C32(0xdb3b0dc8), + SPH_C32(0xce9e0000), SPH_C32(0x4d1f28f5), SPH_C32(0xe628cbd0), + SPH_C32(0xb0db91e9), SPH_C32(0xff30144a), SPH_C32(0xe6670000), + SPH_C32(0x9ecb0000), SPH_C32(0x99e20c4e), SPH_C32(0x5b0a0000), + SPH_C32(0xa0df456a), SPH_C32(0xbc51fcf2), SPH_C32(0x56996746), + SPH_C32(0xfa361f5a) }, + { SPH_C32(0xac480000), SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), + SPH_C32(0x03430000), SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), + SPH_C32(0xfe72c7fe), SPH_C32(0x91e478f6), SPH_C32(0x1e4e0000), + SPH_C32(0xdecf0000), SPH_C32(0x6df80180), SPH_C32(0x77240000), + SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), SPH_C32(0xcda31812), + SPH_C32(0x98aa496e) }, + { SPH_C32(0xfe180000), SPH_C32(0x32f20000), SPH_C32(0x2f9a13ce), + SPH_C32(0xf3bc0000), SPH_C32(0xc0b44f86), SPH_C32(0x5a911178), + SPH_C32(0x3124481b), SPH_C32(0xc2e76bf9), SPH_C32(0x4dc30000), + SPH_C32(0x77330000), SPH_C32(0xf30f0186), SPH_C32(0x21db0000), + SPH_C32(0xe6a307d0), SPH_C32(0x6665a4b7), SPH_C32(0x64e7580a), + SPH_C32(0xe73d1fff) }, + { SPH_C32(0xffc50000), SPH_C32(0xb25a0000), SPH_C32(0xdb0c1386), + SPH_C32(0x55bc0000), SPH_C32(0x50613124), SPH_C32(0x8d779d4f), + SPH_C32(0x573687e6), SPH_C32(0xee732e67), SPH_C32(0x1f930000), + SPH_C32(0x5e670000), SPH_C32(0x996e01c8), SPH_C32(0xd1240000), + SPH_C32(0x7c92793c), SPH_C32(0x2346e579), SPH_C32(0xabb1d7ef), + SPH_C32(0xb43e0cf0) }, + { SPH_C32(0xad950000), SPH_C32(0x9b0e0000), SPH_C32(0xb16d13c8), + SPH_C32(0xa5430000), SPH_C32(0xca504fc8), SPH_C32(0xc854dc81), + SPH_C32(0x98600803), SPH_C32(0xbd703d68), SPH_C32(0x4c1e0000), + SPH_C32(0xf79b0000), SPH_C32(0x079901ce), SPH_C32(0x87db0000), + SPH_C32(0x76767972), SPH_C32(0xb1832880), SPH_C32(0x02f597f7), + SPH_C32(0xcba95a61) }, + { SPH_C32(0x605c0000), SPH_C32(0xbec50000), SPH_C32(0x1f421400), + SPH_C32(0x38130000), SPH_C32(0x11552295), SPH_C32(0x982964ae), + SPH_C32(0x97318f3f), SPH_C32(0x5bbeff08), SPH_C32(0x9fd00000), + SPH_C32(0x32980000), SPH_C32(0x0bca0300), SPH_C32(0xe2d70000), + SPH_C32(0xb1ee2f9c), SPH_C32(0xbc5455f2), SPH_C32(0x2bf9ba3f), + SPH_C32(0x16cdfe94) }, + { SPH_C32(0x320c0000), SPH_C32(0x97910000), SPH_C32(0x7523144e), + SPH_C32(0xc8ec0000), SPH_C32(0x8b645c79), SPH_C32(0xdd0a2560), + SPH_C32(0x586700da), SPH_C32(0x08bdec07), SPH_C32(0xcc5d0000), + SPH_C32(0x9b640000), SPH_C32(0x953d0306), SPH_C32(0xb4280000), + SPH_C32(0xbb0a2fd2), SPH_C32(0x2e91980b), SPH_C32(0x82bdfa27), + SPH_C32(0x695aa805) }, + { SPH_C32(0x33d10000), SPH_C32(0x17390000), SPH_C32(0x81b51406), + SPH_C32(0x6eec0000), SPH_C32(0x1bb122db), SPH_C32(0x0aeca957), + SPH_C32(0x3e75cf27), SPH_C32(0x2429a999), SPH_C32(0x9e0d0000), + SPH_C32(0xb2300000), SPH_C32(0xff5c0348), SPH_C32(0x44d70000), + SPH_C32(0x213b513e), SPH_C32(0x6bb2d9c5), SPH_C32(0x4deb75c2), + SPH_C32(0x3a59bb0a) }, + { SPH_C32(0x61810000), SPH_C32(0x3e6d0000), SPH_C32(0xebd41448), + SPH_C32(0x9e130000), SPH_C32(0x81805c37), SPH_C32(0x4fcfe899), + SPH_C32(0xf12340c2), SPH_C32(0x772aba96), SPH_C32(0xcd800000), + SPH_C32(0x1bcc0000), SPH_C32(0x61ab034e), SPH_C32(0x12280000), + SPH_C32(0x2bdf5170), SPH_C32(0xf977143c), SPH_C32(0xe4af35da), + SPH_C32(0x45ceed9b) }, + { SPH_C32(0x2dd60000), SPH_C32(0xf7f10000), SPH_C32(0x23c91100), + SPH_C32(0x96b00000), SPH_C32(0x072c1968), SPH_C32(0x57466c0a), + SPH_C32(0x182865d3), SPH_C32(0x1f83cf0c), SPH_C32(0x53c40000), + SPH_C32(0x97fb0000), SPH_C32(0x51730480), SPH_C32(0xd9870000), + SPH_C32(0xfa3e3c63), SPH_C32(0x3bcf61ea), SPH_C32(0x42baf2fe), + SPH_C32(0xdc97796a) }, + { SPH_C32(0x7f860000), SPH_C32(0xdea50000), SPH_C32(0x49a8114e), + SPH_C32(0x664f0000), SPH_C32(0x9d1d6784), SPH_C32(0x12652dc4), + SPH_C32(0xd77eea36), SPH_C32(0x4c80dc03), SPH_C32(0x00490000), + SPH_C32(0x3e070000), SPH_C32(0xcf840486), SPH_C32(0x8f780000), + SPH_C32(0xf0da3c2d), SPH_C32(0xa90aac13), SPH_C32(0xebfeb2e6), + SPH_C32(0xa3002ffb) }, + { SPH_C32(0x7e5b0000), SPH_C32(0x5e0d0000), SPH_C32(0xbd3e1106), + SPH_C32(0xc04f0000), SPH_C32(0x0dc81926), SPH_C32(0xc583a1f3), + SPH_C32(0xb16c25cb), SPH_C32(0x6014999d), SPH_C32(0x52190000), + SPH_C32(0x17530000), SPH_C32(0xa5e504c8), SPH_C32(0x7f870000), + SPH_C32(0x6aeb42c1), SPH_C32(0xec29eddd), SPH_C32(0x24a83d03), + SPH_C32(0xf0033cf4) }, + { SPH_C32(0x2c0b0000), SPH_C32(0x77590000), SPH_C32(0xd75f1148), + SPH_C32(0x30b00000), SPH_C32(0x97f967ca), SPH_C32(0x80a0e03d), + SPH_C32(0x7e3aaa2e), SPH_C32(0x33178a92), SPH_C32(0x01940000), + SPH_C32(0xbeaf0000), SPH_C32(0x3b1204ce), SPH_C32(0x29780000), + SPH_C32(0x600f428f), SPH_C32(0x7eec2024), SPH_C32(0x8dec7d1b), + SPH_C32(0x8f946a65) }, + { SPH_C32(0xe1c20000), SPH_C32(0x52920000), SPH_C32(0x79701680), + SPH_C32(0xade00000), SPH_C32(0x4cfc0a97), SPH_C32(0xd0dd5812), + SPH_C32(0x716b2d12), SPH_C32(0xd5d948f2), SPH_C32(0xd25a0000), + SPH_C32(0x7bac0000), SPH_C32(0x37410600), SPH_C32(0x4c740000), + SPH_C32(0xa7971461), SPH_C32(0x733b5d56), SPH_C32(0xa4e050d3), + SPH_C32(0x52f0ce90) }, + { SPH_C32(0xb3920000), SPH_C32(0x7bc60000), SPH_C32(0x131116ce), + SPH_C32(0x5d1f0000), SPH_C32(0xd6cd747b), SPH_C32(0x95fe19dc), + SPH_C32(0xbe3da2f7), SPH_C32(0x86da5bfd), SPH_C32(0x81d70000), + SPH_C32(0xd2500000), SPH_C32(0xa9b60606), SPH_C32(0x1a8b0000), + SPH_C32(0xad73142f), SPH_C32(0xe1fe90af), SPH_C32(0x0da410cb), + SPH_C32(0x2d679801) }, + { SPH_C32(0xb24f0000), SPH_C32(0xfb6e0000), SPH_C32(0xe7871686), + SPH_C32(0xfb1f0000), SPH_C32(0x46180ad9), SPH_C32(0x421895eb), + SPH_C32(0xd82f6d0a), SPH_C32(0xaa4e1e63), SPH_C32(0xd3870000), + SPH_C32(0xfb040000), SPH_C32(0xc3d70648), SPH_C32(0xea740000), + SPH_C32(0x37426ac3), SPH_C32(0xa4ddd161), SPH_C32(0xc2f29f2e), + SPH_C32(0x7e648b0e) }, + { SPH_C32(0xe01f0000), SPH_C32(0xd23a0000), SPH_C32(0x8de616c8), + SPH_C32(0x0be00000), SPH_C32(0xdc297435), SPH_C32(0x073bd425), + SPH_C32(0x1779e2ef), SPH_C32(0xf94d0d6c), SPH_C32(0x800a0000), + SPH_C32(0x52f80000), SPH_C32(0x5d20064e), SPH_C32(0xbc8b0000), + SPH_C32(0x3da66a8d), SPH_C32(0x36181c98), SPH_C32(0x6bb6df36), + SPH_C32(0x01f3dd9f) }, + { SPH_C32(0xd46b0000), SPH_C32(0x095a0000), SPH_C32(0xecc11800), + SPH_C32(0x93e60000), SPH_C32(0x2bbb1913), SPH_C32(0x615bd992), + SPH_C32(0x0efe679c), SPH_C32(0xf28bf35d), SPH_C32(0x1ce10000), + SPH_C32(0x69e70000), SPH_C32(0xd7e40280), SPH_C32(0x21bc0000), + SPH_C32(0x56ca424d), SPH_C32(0x74e8af29), SPH_C32(0x64ff0c88), + SPH_C32(0x6c5ca315) }, + { SPH_C32(0x863b0000), SPH_C32(0x200e0000), SPH_C32(0x86a0184e), + SPH_C32(0x63190000), SPH_C32(0xb18a67ff), SPH_C32(0x2478985c), + SPH_C32(0xc1a8e879), SPH_C32(0xa188e052), SPH_C32(0x4f6c0000), + SPH_C32(0xc01b0000), SPH_C32(0x49130286), SPH_C32(0x77430000), + SPH_C32(0x5c2e4203), SPH_C32(0xe62d62d0), SPH_C32(0xcdbb4c90), + SPH_C32(0x13cbf584) }, + { SPH_C32(0x87e60000), SPH_C32(0xa0a60000), SPH_C32(0x72361806), + SPH_C32(0xc5190000), SPH_C32(0x215f195d), SPH_C32(0xf39e146b), + SPH_C32(0xa7ba2784), SPH_C32(0x8d1ca5cc), SPH_C32(0x1d3c0000), + SPH_C32(0xe94f0000), SPH_C32(0x237202c8), SPH_C32(0x87bc0000), + SPH_C32(0xc61f3cef), SPH_C32(0xa30e231e), SPH_C32(0x02edc375), + SPH_C32(0x40c8e68b) }, + { SPH_C32(0xd5b60000), SPH_C32(0x89f20000), SPH_C32(0x18571848), + SPH_C32(0x35e60000), SPH_C32(0xbb6e67b1), SPH_C32(0xb6bd55a5), + SPH_C32(0x68eca861), SPH_C32(0xde1fb6c3), SPH_C32(0x4eb10000), + SPH_C32(0x40b30000), SPH_C32(0xbd8502ce), SPH_C32(0xd1430000), + SPH_C32(0xccfb3ca1), SPH_C32(0x31cbeee7), SPH_C32(0xaba9836d), + SPH_C32(0x3f5fb01a) }, + { SPH_C32(0x187f0000), SPH_C32(0xac390000), SPH_C32(0xb6781f80), + SPH_C32(0xa8b60000), SPH_C32(0x606b0aec), SPH_C32(0xe6c0ed8a), + SPH_C32(0x67bd2f5d), SPH_C32(0x38d174a3), SPH_C32(0x9d7f0000), + SPH_C32(0x85b00000), SPH_C32(0xb1d60000), SPH_C32(0xb44f0000), + SPH_C32(0x0b636a4f), SPH_C32(0x3c1c9395), SPH_C32(0x82a5aea5), + SPH_C32(0xe23b14ef) }, + { SPH_C32(0x4a2f0000), SPH_C32(0x856d0000), SPH_C32(0xdc191fce), + SPH_C32(0x58490000), SPH_C32(0xfa5a7400), SPH_C32(0xa3e3ac44), + SPH_C32(0xa8eba0b8), SPH_C32(0x6bd267ac), SPH_C32(0xcef20000), + SPH_C32(0x2c4c0000), SPH_C32(0x2f210006), SPH_C32(0xe2b00000), + SPH_C32(0x01876a01), SPH_C32(0xaed95e6c), SPH_C32(0x2be1eebd), + SPH_C32(0x9dac427e) }, + { SPH_C32(0x4bf20000), SPH_C32(0x05c50000), SPH_C32(0x288f1f86), + SPH_C32(0xfe490000), SPH_C32(0x6a8f0aa2), SPH_C32(0x74052073), + SPH_C32(0xcef96f45), SPH_C32(0x47462232), SPH_C32(0x9ca20000), + SPH_C32(0x05180000), SPH_C32(0x45400048), SPH_C32(0x124f0000), + SPH_C32(0x9bb614ed), SPH_C32(0xebfa1fa2), SPH_C32(0xe4b76158), + SPH_C32(0xceaf5171) }, + { SPH_C32(0x19a20000), SPH_C32(0x2c910000), SPH_C32(0x42ee1fc8), + SPH_C32(0x0eb60000), SPH_C32(0xf0be744e), SPH_C32(0x312661bd), + SPH_C32(0x01afe0a0), SPH_C32(0x1445313d), SPH_C32(0xcf2f0000), + SPH_C32(0xace40000), SPH_C32(0xdbb7004e), SPH_C32(0x44b00000), + SPH_C32(0x915214a3), SPH_C32(0x793fd25b), SPH_C32(0x4df32140), + SPH_C32(0xb13807e0) }, + { SPH_C32(0x55f50000), SPH_C32(0xe50d0000), SPH_C32(0x8af31a80), + SPH_C32(0x06150000), SPH_C32(0x76123111), SPH_C32(0x29afe52e), + SPH_C32(0xe8a4c5b1), SPH_C32(0x7cec44a7), SPH_C32(0x516b0000), + SPH_C32(0x20d30000), SPH_C32(0xeb6f0780), SPH_C32(0x8f1f0000), + SPH_C32(0x40b379b0), SPH_C32(0xbb87a78d), SPH_C32(0xebe6e664), + SPH_C32(0x28619311) }, + { SPH_C32(0x07a50000), SPH_C32(0xcc590000), SPH_C32(0xe0921ace), + SPH_C32(0xf6ea0000), SPH_C32(0xec234ffd), SPH_C32(0x6c8ca4e0), + SPH_C32(0x27f24a54), SPH_C32(0x2fef57a8), SPH_C32(0x02e60000), + SPH_C32(0x892f0000), SPH_C32(0x75980786), SPH_C32(0xd9e00000), + SPH_C32(0x4a5779fe), SPH_C32(0x29426a74), SPH_C32(0x42a2a67c), + SPH_C32(0x57f6c580) }, + { SPH_C32(0x06780000), SPH_C32(0x4cf10000), SPH_C32(0x14041a86), + SPH_C32(0x50ea0000), SPH_C32(0x7cf6315f), SPH_C32(0xbb6a28d7), + SPH_C32(0x41e085a9), SPH_C32(0x037b1236), SPH_C32(0x50b60000), + SPH_C32(0xa07b0000), SPH_C32(0x1ff907c8), SPH_C32(0x291f0000), + SPH_C32(0xd0660712), SPH_C32(0x6c612bba), SPH_C32(0x8df42999), + SPH_C32(0x04f5d68f) }, + { SPH_C32(0x54280000), SPH_C32(0x65a50000), SPH_C32(0x7e651ac8), + SPH_C32(0xa0150000), SPH_C32(0xe6c74fb3), SPH_C32(0xfe496919), + SPH_C32(0x8eb60a4c), SPH_C32(0x50780139), SPH_C32(0x033b0000), + SPH_C32(0x09870000), SPH_C32(0x810e07ce), SPH_C32(0x7fe00000), + SPH_C32(0xda82075c), SPH_C32(0xfea4e643), SPH_C32(0x24b06981), + SPH_C32(0x7b62801e) }, + { SPH_C32(0x99e10000), SPH_C32(0x406e0000), SPH_C32(0xd04a1d00), + SPH_C32(0x3d450000), SPH_C32(0x3dc222ee), SPH_C32(0xae34d136), + SPH_C32(0x81e78d70), SPH_C32(0xb6b6c359), SPH_C32(0xd0f50000), + SPH_C32(0xcc840000), SPH_C32(0x8d5d0500), SPH_C32(0x1aec0000), + SPH_C32(0x1d1a51b2), SPH_C32(0xf3739b31), SPH_C32(0x0dbc4449), + SPH_C32(0xa60624eb) }, + { SPH_C32(0xcbb10000), SPH_C32(0x693a0000), SPH_C32(0xba2b1d4e), + SPH_C32(0xcdba0000), SPH_C32(0xa7f35c02), SPH_C32(0xeb1790f8), + SPH_C32(0x4eb10295), SPH_C32(0xe5b5d056), SPH_C32(0x83780000), + SPH_C32(0x65780000), SPH_C32(0x13aa0506), SPH_C32(0x4c130000), + SPH_C32(0x17fe51fc), SPH_C32(0x61b656c8), SPH_C32(0xa4f80451), + SPH_C32(0xd991727a) }, + { SPH_C32(0xca6c0000), SPH_C32(0xe9920000), SPH_C32(0x4ebd1d06), + SPH_C32(0x6bba0000), SPH_C32(0x372622a0), SPH_C32(0x3cf11ccf), + SPH_C32(0x28a3cd68), SPH_C32(0xc92195c8), SPH_C32(0xd1280000), + SPH_C32(0x4c2c0000), SPH_C32(0x79cb0548), SPH_C32(0xbcec0000), + SPH_C32(0x8dcf2f10), SPH_C32(0x24951706), SPH_C32(0x6bae8bb4), + SPH_C32(0x8a926175) }, + { SPH_C32(0x983c0000), SPH_C32(0xc0c60000), SPH_C32(0x24dc1d48), + SPH_C32(0x9b450000), SPH_C32(0xad175c4c), SPH_C32(0x79d25d01), + SPH_C32(0xe7f5428d), SPH_C32(0x9a2286c7), SPH_C32(0x82a50000), + SPH_C32(0xe5d00000), SPH_C32(0xe73c054e), SPH_C32(0xea130000), + SPH_C32(0x872b2f5e), SPH_C32(0xb650daff), SPH_C32(0xc2eacbac), + SPH_C32(0xf50537e4) }, + { SPH_C32(0xaee70000), SPH_C32(0xac8e0000), SPH_C32(0xffe71080), + SPH_C32(0x55db0000), SPH_C32(0xe00874b9), SPH_C32(0x9ffa96d1), + SPH_C32(0x572ed364), SPH_C32(0x6512928d), SPH_C32(0x64c20000), + SPH_C32(0x7b1b0000), SPH_C32(0x7ede0900), SPH_C32(0xb1190000), + SPH_C32(0x27f46a34), SPH_C32(0x0a01260d), SPH_C32(0x9473acea), + SPH_C32(0x0f3328be) }, + { SPH_C32(0xfcb70000), SPH_C32(0x85da0000), SPH_C32(0x958610ce), + SPH_C32(0xa5240000), SPH_C32(0x7a390a55), SPH_C32(0xdad9d71f), + SPH_C32(0x98785c81), SPH_C32(0x36118182), SPH_C32(0x374f0000), + SPH_C32(0xd2e70000), SPH_C32(0xe0290906), SPH_C32(0xe7e60000), + SPH_C32(0x2d106a7a), SPH_C32(0x98c4ebf4), SPH_C32(0x3d37ecf2), + SPH_C32(0x70a47e2f) }, + { SPH_C32(0xfd6a0000), SPH_C32(0x05720000), SPH_C32(0x61101086), + SPH_C32(0x03240000), SPH_C32(0xeaec74f7), SPH_C32(0x0d3f5b28), + SPH_C32(0xfe6a937c), SPH_C32(0x1a85c41c), SPH_C32(0x651f0000), + SPH_C32(0xfbb30000), SPH_C32(0x8a480948), SPH_C32(0x17190000), + SPH_C32(0xb7211496), SPH_C32(0xdde7aa3a), SPH_C32(0xf2616317), + SPH_C32(0x23a76d20) }, + { SPH_C32(0xaf3a0000), SPH_C32(0x2c260000), SPH_C32(0x0b7110c8), + SPH_C32(0xf3db0000), SPH_C32(0x70dd0a1b), SPH_C32(0x481c1ae6), + SPH_C32(0x313c1c99), SPH_C32(0x4986d713), SPH_C32(0x36920000), + SPH_C32(0x524f0000), SPH_C32(0x14bf094e), SPH_C32(0x41e60000), + SPH_C32(0xbdc514d8), SPH_C32(0x4f2267c3), SPH_C32(0x5b25230f), + SPH_C32(0x5c303bb1) }, + { SPH_C32(0x62f30000), SPH_C32(0x09ed0000), SPH_C32(0xa55e1700), + SPH_C32(0x6e8b0000), SPH_C32(0xabd86746), SPH_C32(0x1861a2c9), + SPH_C32(0x3e6d9ba5), SPH_C32(0xaf481573), SPH_C32(0xe55c0000), + SPH_C32(0x974c0000), SPH_C32(0x18ec0b80), SPH_C32(0x24ea0000), + SPH_C32(0x7a5d4236), SPH_C32(0x42f51ab1), SPH_C32(0x72290ec7), + SPH_C32(0x81549f44) }, + { SPH_C32(0x30a30000), SPH_C32(0x20b90000), SPH_C32(0xcf3f174e), + SPH_C32(0x9e740000), SPH_C32(0x31e919aa), SPH_C32(0x5d42e307), + SPH_C32(0xf13b1440), SPH_C32(0xfc4b067c), SPH_C32(0xb6d10000), + SPH_C32(0x3eb00000), SPH_C32(0x861b0b86), SPH_C32(0x72150000), + SPH_C32(0x70b94278), SPH_C32(0xd030d748), SPH_C32(0xdb6d4edf), + SPH_C32(0xfec3c9d5) }, + { SPH_C32(0x317e0000), SPH_C32(0xa0110000), SPH_C32(0x3ba91706), + SPH_C32(0x38740000), SPH_C32(0xa13c6708), SPH_C32(0x8aa46f30), + SPH_C32(0x9729dbbd), SPH_C32(0xd0df43e2), SPH_C32(0xe4810000), + SPH_C32(0x17e40000), SPH_C32(0xec7a0bc8), SPH_C32(0x82ea0000), + SPH_C32(0xea883c94), SPH_C32(0x95139686), SPH_C32(0x143bc13a), + SPH_C32(0xadc0dada) }, + { SPH_C32(0x632e0000), SPH_C32(0x89450000), SPH_C32(0x51c81748), + SPH_C32(0xc88b0000), SPH_C32(0x3b0d19e4), SPH_C32(0xcf872efe), + SPH_C32(0x587f5458), SPH_C32(0x83dc50ed), SPH_C32(0xb70c0000), + SPH_C32(0xbe180000), SPH_C32(0x728d0bce), SPH_C32(0xd4150000), + SPH_C32(0xe06c3cda), SPH_C32(0x07d65b7f), SPH_C32(0xbd7f8122), + SPH_C32(0xd2578c4b) }, + { SPH_C32(0x2f790000), SPH_C32(0x40d90000), SPH_C32(0x99d51200), + SPH_C32(0xc0280000), SPH_C32(0xbda15cbb), SPH_C32(0xd70eaa6d), + SPH_C32(0xb1747149), SPH_C32(0xeb752577), SPH_C32(0x29480000), + SPH_C32(0x322f0000), SPH_C32(0x42550c00), SPH_C32(0x1fba0000), + SPH_C32(0x318d51c9), SPH_C32(0xc56e2ea9), SPH_C32(0x1b6a4606), + SPH_C32(0x4b0e18ba) }, + { SPH_C32(0x7d290000), SPH_C32(0x698d0000), SPH_C32(0xf3b4124e), + SPH_C32(0x30d70000), SPH_C32(0x27902257), SPH_C32(0x922deba3), + SPH_C32(0x7e22feac), SPH_C32(0xb8763678), SPH_C32(0x7ac50000), + SPH_C32(0x9bd30000), SPH_C32(0xdca20c06), SPH_C32(0x49450000), + SPH_C32(0x3b695187), SPH_C32(0x57abe350), SPH_C32(0xb22e061e), + SPH_C32(0x34994e2b) }, + { SPH_C32(0x7cf40000), SPH_C32(0xe9250000), SPH_C32(0x07221206), + SPH_C32(0x96d70000), SPH_C32(0xb7455cf5), SPH_C32(0x45cb6794), + SPH_C32(0x18303151), SPH_C32(0x94e273e6), SPH_C32(0x28950000), + SPH_C32(0xb2870000), SPH_C32(0xb6c30c48), SPH_C32(0xb9ba0000), + SPH_C32(0xa1582f6b), SPH_C32(0x1288a29e), SPH_C32(0x7d7889fb), + SPH_C32(0x679a5d24) }, + { SPH_C32(0x2ea40000), SPH_C32(0xc0710000), SPH_C32(0x6d431248), + SPH_C32(0x66280000), SPH_C32(0x2d742219), SPH_C32(0x00e8265a), + SPH_C32(0xd766beb4), SPH_C32(0xc7e160e9), SPH_C32(0x7b180000), + SPH_C32(0x1b7b0000), SPH_C32(0x28340c4e), SPH_C32(0xef450000), + SPH_C32(0xabbc2f25), SPH_C32(0x804d6f67), SPH_C32(0xd43cc9e3), + SPH_C32(0x180d0bb5) }, + { SPH_C32(0xe36d0000), SPH_C32(0xe5ba0000), SPH_C32(0xc36c1580), + SPH_C32(0xfb780000), SPH_C32(0xf6714f44), SPH_C32(0x50959e75), + SPH_C32(0xd8373988), SPH_C32(0x212fa289), SPH_C32(0xa8d60000), + SPH_C32(0xde780000), SPH_C32(0x24670e80), SPH_C32(0x8a490000), + SPH_C32(0x6c2479cb), SPH_C32(0x8d9a1215), SPH_C32(0xfd30e42b), + SPH_C32(0xc569af40) }, + { SPH_C32(0xb13d0000), SPH_C32(0xccee0000), SPH_C32(0xa90d15ce), + SPH_C32(0x0b870000), SPH_C32(0x6c4031a8), SPH_C32(0x15b6dfbb), + SPH_C32(0x1761b66d), SPH_C32(0x722cb186), SPH_C32(0xfb5b0000), + SPH_C32(0x77840000), SPH_C32(0xba900e86), SPH_C32(0xdcb60000), + SPH_C32(0x66c07985), SPH_C32(0x1f5fdfec), SPH_C32(0x5474a433), + SPH_C32(0xbafef9d1) }, + { SPH_C32(0xb0e00000), SPH_C32(0x4c460000), SPH_C32(0x5d9b1586), + SPH_C32(0xad870000), SPH_C32(0xfc954f0a), SPH_C32(0xc250538c), + SPH_C32(0x71737990), SPH_C32(0x5eb8f418), SPH_C32(0xa90b0000), + SPH_C32(0x5ed00000), SPH_C32(0xd0f10ec8), SPH_C32(0x2c490000), + SPH_C32(0xfcf10769), SPH_C32(0x5a7c9e22), SPH_C32(0x9b222bd6), + SPH_C32(0xe9fdeade) }, + { SPH_C32(0xe2b00000), SPH_C32(0x65120000), SPH_C32(0x37fa15c8), + SPH_C32(0x5d780000), SPH_C32(0x66a431e6), SPH_C32(0x87731242), + SPH_C32(0xbe25f675), SPH_C32(0x0dbbe717), SPH_C32(0xfa860000), + SPH_C32(0xf72c0000), SPH_C32(0x4e060ece), SPH_C32(0x7ab60000), + SPH_C32(0xf6150727), SPH_C32(0xc8b953db), SPH_C32(0x32666bce), + SPH_C32(0x966abc4f) }, + { SPH_C32(0xd6c40000), SPH_C32(0xbe720000), SPH_C32(0x56dd1b00), + SPH_C32(0xc57e0000), SPH_C32(0x91365cc0), SPH_C32(0xe1131ff5), + SPH_C32(0xa7a27306), SPH_C32(0x067d1926), SPH_C32(0x666d0000), + SPH_C32(0xcc330000), SPH_C32(0xc4c20a00), SPH_C32(0xe7810000), + SPH_C32(0x9d792fe7), SPH_C32(0x8a49e06a), SPH_C32(0x3d2fb870), + SPH_C32(0xfbc5c2c5) }, + { SPH_C32(0x84940000), SPH_C32(0x97260000), SPH_C32(0x3cbc1b4e), + SPH_C32(0x35810000), SPH_C32(0x0b07222c), SPH_C32(0xa4305e3b), + SPH_C32(0x68f4fce3), SPH_C32(0x557e0a29), SPH_C32(0x35e00000), + SPH_C32(0x65cf0000), SPH_C32(0x5a350a06), SPH_C32(0xb17e0000), + SPH_C32(0x979d2fa9), SPH_C32(0x188c2d93), SPH_C32(0x946bf868), + SPH_C32(0x84529454) }, + { SPH_C32(0x85490000), SPH_C32(0x178e0000), SPH_C32(0xc82a1b06), + SPH_C32(0x93810000), SPH_C32(0x9bd25c8e), SPH_C32(0x73d6d20c), + SPH_C32(0x0ee6331e), SPH_C32(0x79ea4fb7), SPH_C32(0x67b00000), + SPH_C32(0x4c9b0000), SPH_C32(0x30540a48), SPH_C32(0x41810000), + SPH_C32(0x0dac5145), SPH_C32(0x5daf6c5d), SPH_C32(0x5b3d778d), + SPH_C32(0xd751875b) }, + { SPH_C32(0xd7190000), SPH_C32(0x3eda0000), SPH_C32(0xa24b1b48), + SPH_C32(0x637e0000), SPH_C32(0x01e32262), SPH_C32(0x36f593c2), + SPH_C32(0xc1b0bcfb), SPH_C32(0x2ae95cb8), SPH_C32(0x343d0000), + SPH_C32(0xe5670000), SPH_C32(0xaea30a4e), SPH_C32(0x177e0000), + SPH_C32(0x0748510b), SPH_C32(0xcf6aa1a4), SPH_C32(0xf2793795), + SPH_C32(0xa8c6d1ca) }, + { SPH_C32(0x1ad00000), SPH_C32(0x1b110000), SPH_C32(0x0c641c80), + SPH_C32(0xfe2e0000), SPH_C32(0xdae64f3f), SPH_C32(0x66882bed), + SPH_C32(0xcee13bc7), SPH_C32(0xcc279ed8), SPH_C32(0xe7f30000), + SPH_C32(0x20640000), SPH_C32(0xa2f00880), SPH_C32(0x72720000), + SPH_C32(0xc0d007e5), SPH_C32(0xc2bddcd6), SPH_C32(0xdb751a5d), + SPH_C32(0x75a2753f) }, + { SPH_C32(0x48800000), SPH_C32(0x32450000), SPH_C32(0x66051cce), + SPH_C32(0x0ed10000), SPH_C32(0x40d731d3), SPH_C32(0x23ab6a23), + SPH_C32(0x01b7b422), SPH_C32(0x9f248dd7), SPH_C32(0xb47e0000), + SPH_C32(0x89980000), SPH_C32(0x3c070886), SPH_C32(0x248d0000), + SPH_C32(0xca3407ab), SPH_C32(0x5078112f), SPH_C32(0x72315a45), + SPH_C32(0x0a3523ae) }, + { SPH_C32(0x495d0000), SPH_C32(0xb2ed0000), SPH_C32(0x92931c86), + SPH_C32(0xa8d10000), SPH_C32(0xd0024f71), SPH_C32(0xf44de614), + SPH_C32(0x67a57bdf), SPH_C32(0xb3b0c849), SPH_C32(0xe62e0000), + SPH_C32(0xa0cc0000), SPH_C32(0x566608c8), SPH_C32(0xd4720000), + SPH_C32(0x50057947), SPH_C32(0x155b50e1), SPH_C32(0xbd67d5a0), + SPH_C32(0x593630a1) }, + { SPH_C32(0x1b0d0000), SPH_C32(0x9bb90000), SPH_C32(0xf8f21cc8), + SPH_C32(0x582e0000), SPH_C32(0x4a33319d), SPH_C32(0xb16ea7da), + SPH_C32(0xa8f3f43a), SPH_C32(0xe0b3db46), SPH_C32(0xb5a30000), + SPH_C32(0x09300000), SPH_C32(0xc89108ce), SPH_C32(0x828d0000), + SPH_C32(0x5ae17909), SPH_C32(0x879e9d18), SPH_C32(0x142395b8), + SPH_C32(0x26a16630) }, + { SPH_C32(0x575a0000), SPH_C32(0x52250000), SPH_C32(0x30ef1980), + SPH_C32(0x508d0000), SPH_C32(0xcc9f74c2), SPH_C32(0xa9e72349), + SPH_C32(0x41f8d12b), SPH_C32(0x881aaedc), SPH_C32(0x2be70000), + SPH_C32(0x85070000), SPH_C32(0xf8490f00), SPH_C32(0x49220000), + SPH_C32(0x8b00141a), SPH_C32(0x4526e8ce), SPH_C32(0xb236529c), + SPH_C32(0xbff8f2c1) }, + { SPH_C32(0x050a0000), SPH_C32(0x7b710000), SPH_C32(0x5a8e19ce), + SPH_C32(0xa0720000), SPH_C32(0x56ae0a2e), SPH_C32(0xecc46287), + SPH_C32(0x8eae5ece), SPH_C32(0xdb19bdd3), SPH_C32(0x786a0000), + SPH_C32(0x2cfb0000), SPH_C32(0x66be0f06), SPH_C32(0x1fdd0000), + SPH_C32(0x81e41454), SPH_C32(0xd7e32537), SPH_C32(0x1b721284), + SPH_C32(0xc06fa450) }, + { SPH_C32(0x04d70000), SPH_C32(0xfbd90000), SPH_C32(0xae181986), + SPH_C32(0x06720000), SPH_C32(0xc67b748c), SPH_C32(0x3b22eeb0), + SPH_C32(0xe8bc9133), SPH_C32(0xf78df84d), SPH_C32(0x2a3a0000), + SPH_C32(0x05af0000), SPH_C32(0x0cdf0f48), SPH_C32(0xef220000), + SPH_C32(0x1bd56ab8), SPH_C32(0x92c064f9), SPH_C32(0xd4249d61), + SPH_C32(0x936cb75f) }, + { SPH_C32(0x56870000), SPH_C32(0xd28d0000), SPH_C32(0xc47919c8), + SPH_C32(0xf68d0000), SPH_C32(0x5c4a0a60), SPH_C32(0x7e01af7e), + SPH_C32(0x27ea1ed6), SPH_C32(0xa48eeb42), SPH_C32(0x79b70000), + SPH_C32(0xac530000), SPH_C32(0x92280f4e), SPH_C32(0xb9dd0000), + SPH_C32(0x11316af6), SPH_C32(0x0005a900), SPH_C32(0x7d60dd79), + SPH_C32(0xecfbe1ce) }, + { SPH_C32(0x9b4e0000), SPH_C32(0xf7460000), SPH_C32(0x6a561e00), + SPH_C32(0x6bdd0000), SPH_C32(0x874f673d), SPH_C32(0x2e7c1751), + SPH_C32(0x28bb99ea), SPH_C32(0x42402922), SPH_C32(0xaa790000), + SPH_C32(0x69500000), SPH_C32(0x9e7b0d80), SPH_C32(0xdcd10000), + SPH_C32(0xd6a93c18), SPH_C32(0x0dd2d472), SPH_C32(0x546cf0b1), + SPH_C32(0x319f453b) }, + { SPH_C32(0xc91e0000), SPH_C32(0xde120000), SPH_C32(0x00371e4e), + SPH_C32(0x9b220000), SPH_C32(0x1d7e19d1), SPH_C32(0x6b5f569f), + SPH_C32(0xe7ed160f), SPH_C32(0x11433a2d), SPH_C32(0xf9f40000), + SPH_C32(0xc0ac0000), SPH_C32(0x008c0d86), SPH_C32(0x8a2e0000), + SPH_C32(0xdc4d3c56), SPH_C32(0x9f17198b), SPH_C32(0xfd28b0a9), + SPH_C32(0x4e0813aa) }, + { SPH_C32(0xc8c30000), SPH_C32(0x5eba0000), SPH_C32(0xf4a11e06), + SPH_C32(0x3d220000), SPH_C32(0x8dab6773), SPH_C32(0xbcb9daa8), + SPH_C32(0x81ffd9f2), SPH_C32(0x3dd77fb3), SPH_C32(0xaba40000), + SPH_C32(0xe9f80000), SPH_C32(0x6aed0dc8), SPH_C32(0x7ad10000), + SPH_C32(0x467c42ba), SPH_C32(0xda345845), SPH_C32(0x327e3f4c), + SPH_C32(0x1d0b00a5) }, + { SPH_C32(0x9a930000), SPH_C32(0x77ee0000), SPH_C32(0x9ec01e48), + SPH_C32(0xcddd0000), SPH_C32(0x179a199f), SPH_C32(0xf99a9b66), + SPH_C32(0x4ea95617), SPH_C32(0x6ed46cbc), SPH_C32(0xf8290000), + SPH_C32(0x40040000), SPH_C32(0xf41a0dce), SPH_C32(0x2c2e0000), + SPH_C32(0x4c9842f4), SPH_C32(0x48f195bc), SPH_C32(0x9b3a7f54), + SPH_C32(0x629c5634) } +}; + +static const sph_u32 T512_42[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x92560000), SPH_C32(0x1eda0000), SPH_C32(0xea510000), + SPH_C32(0xe8b13000), SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), + SPH_C32(0xb15c2254), SPH_C32(0x33c5244f), SPH_C32(0x8c3a0000), + SPH_C32(0xda980000), SPH_C32(0x607f0000), SPH_C32(0x54078800), + SPH_C32(0x85714513), SPH_C32(0x6006b243), SPH_C32(0xdb50399c), + SPH_C32(0x8a58e6a4) }, + { SPH_C32(0x58430000), SPH_C32(0x807e0000), SPH_C32(0x78330001), + SPH_C32(0xc66b3800), SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), + SPH_C32(0xac73fe6f), SPH_C32(0x3a4479b1), SPH_C32(0x1d5a0000), + SPH_C32(0x2b720000), SPH_C32(0x488d0000), SPH_C32(0xaf611800), + SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), SPH_C32(0x81a20429), + SPH_C32(0x1e7536a6) }, + { SPH_C32(0xca150000), SPH_C32(0x9ea40000), SPH_C32(0x92620001), + SPH_C32(0x2eda0800), SPH_C32(0x4e020a79), SPH_C32(0x92565e44), + SPH_C32(0x1d2fdc3b), SPH_C32(0x09815dfe), SPH_C32(0x91600000), + SPH_C32(0xf1ea0000), SPH_C32(0x28f20000), SPH_C32(0xfb669000), + SPH_C32(0xa0ba6bd6), SPH_C32(0xa87f0d93), SPH_C32(0x5af23db5), + SPH_C32(0x942dd002) }, + { SPH_C32(0x1d5a0000), SPH_C32(0x2b720000), SPH_C32(0x488d0000), + SPH_C32(0xaf611800), SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), + SPH_C32(0x81a20429), SPH_C32(0x1e7536a6), SPH_C32(0x45190000), + SPH_C32(0xab0c0000), SPH_C32(0x30be0001), SPH_C32(0x690a2000), + SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), SPH_C32(0x2dd1fa46), + SPH_C32(0x24314f17) }, + { SPH_C32(0x8f0c0000), SPH_C32(0x35a80000), SPH_C32(0xa2dc0000), + SPH_C32(0x47d02800), SPH_C32(0x8cfe7860), SPH_C32(0x2382de49), + SPH_C32(0x30fe267d), SPH_C32(0x2db012e9), SPH_C32(0xc9230000), + SPH_C32(0x71940000), SPH_C32(0x50c10001), SPH_C32(0x3d0da800), + SPH_C32(0x478d370a), SPH_C32(0xd1d2324e), SPH_C32(0xf681c3da), + SPH_C32(0xae69a9b3) }, + { SPH_C32(0x45190000), SPH_C32(0xab0c0000), SPH_C32(0x30be0001), + SPH_C32(0x690a2000), SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), + SPH_C32(0x2dd1fa46), SPH_C32(0x24314f17), SPH_C32(0x58430000), + SPH_C32(0x807e0000), SPH_C32(0x78330001), SPH_C32(0xc66b3800), + SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), SPH_C32(0xac73fe6f), + SPH_C32(0x3a4479b1) }, + { SPH_C32(0xd74f0000), SPH_C32(0xb5d60000), SPH_C32(0xdaef0001), + SPH_C32(0x81bb1000), SPH_C32(0x6bc924bc), SPH_C32(0x5a2fe194), + SPH_C32(0x9c8dd812), SPH_C32(0x17f46b58), SPH_C32(0xd4790000), + SPH_C32(0x5ae60000), SPH_C32(0x184c0001), SPH_C32(0x926cb000), + SPH_C32(0x624619cf), SPH_C32(0x19ab8d9e), SPH_C32(0x7723c7f3), + SPH_C32(0xb01c9f15) }, + { SPH_C32(0xa53b0000), SPH_C32(0x14260000), SPH_C32(0x4e30001e), + SPH_C32(0x7cae0000), SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), + SPH_C32(0xf73168d8), SPH_C32(0x0b1b4946), SPH_C32(0x07ed0000), + SPH_C32(0xb2500000), SPH_C32(0x8774000a), SPH_C32(0x970d0000), + SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), SPH_C32(0xf4786222), + SPH_C32(0x9075b1ce) }, + { SPH_C32(0x376d0000), SPH_C32(0x0afc0000), SPH_C32(0xa461001e), + SPH_C32(0x941f3000), SPH_C32(0x26ab5b70), SPH_C32(0x9324cba4), + SPH_C32(0x466d4a8c), SPH_C32(0x38de6d09), SPH_C32(0x8bd70000), + SPH_C32(0x68c80000), SPH_C32(0xe70b000a), SPH_C32(0xc30a8800), + SPH_C32(0xc60366bd), SPH_C32(0x28c1dce7), SPH_C32(0x2f285bbe), + SPH_C32(0x1a2d576a) }, + { SPH_C32(0xfd780000), SPH_C32(0x94580000), SPH_C32(0x3603001f), + SPH_C32(0xbac53800), SPH_C32(0x68a95109), SPH_C32(0x017295e0), + SPH_C32(0x5b4296b7), SPH_C32(0x315f30f7), SPH_C32(0x1ab70000), + SPH_C32(0x99220000), SPH_C32(0xcff9000a), SPH_C32(0x386c1800), + SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), SPH_C32(0x75da660b), + SPH_C32(0x8e008768) }, + { SPH_C32(0x6f2e0000), SPH_C32(0x8a820000), SPH_C32(0xdc52001f), + SPH_C32(0x52740800), SPH_C32(0xc19c07ac), SPH_C32(0xea89f479), + SPH_C32(0xea1eb4e3), SPH_C32(0x029a14b8), SPH_C32(0x968d0000), + SPH_C32(0x43ba0000), SPH_C32(0xaf86000a), SPH_C32(0x6c6b9000), + SPH_C32(0xe3c84878), SPH_C32(0xe0b86337), SPH_C32(0xae8a5f97), + SPH_C32(0x045861cc) }, + { SPH_C32(0xb8610000), SPH_C32(0x3f540000), SPH_C32(0x06bd001e), + SPH_C32(0xd3cf1800), SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), + SPH_C32(0x76936cf1), SPH_C32(0x156e7fe0), SPH_C32(0x42f40000), + SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), SPH_C32(0xfe072000), + SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), SPH_C32(0xd9a99864), + SPH_C32(0xb444fed9) }, + { SPH_C32(0x2a370000), SPH_C32(0x218e0000), SPH_C32(0xecec001e), + SPH_C32(0x3b7e2800), SPH_C32(0x036075b5), SPH_C32(0x5b5d7474), + SPH_C32(0xc7cf4ea5), SPH_C32(0x26ab5baf), SPH_C32(0xcece0000), + SPH_C32(0xc3c40000), SPH_C32(0xd7b5000b), SPH_C32(0xaa00a800), + SPH_C32(0x04ff14a4), SPH_C32(0x99155cea), SPH_C32(0x02f9a1f8), + SPH_C32(0x3e1c187d) }, + { SPH_C32(0xe0220000), SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), + SPH_C32(0x15a42000), SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), + SPH_C32(0xdae0929e), SPH_C32(0x2f2a0651), SPH_C32(0x5fae0000), + SPH_C32(0x322e0000), SPH_C32(0xff47000b), SPH_C32(0x51663800), + SPH_C32(0xa4457f72), SPH_C32(0x316a5179), SPH_C32(0x580b9c4d), + SPH_C32(0xaa31c87f) }, + { SPH_C32(0x72740000), SPH_C32(0xa1f00000), SPH_C32(0x94df001f), + SPH_C32(0xfd151000), SPH_C32(0xe4572969), SPH_C32(0x22f04ba9), + SPH_C32(0x6bbcb0ca), SPH_C32(0x1cef221e), SPH_C32(0xd3940000), + SPH_C32(0xe8b60000), SPH_C32(0x9f38000b), SPH_C32(0x0561b000), + SPH_C32(0x21343a61), SPH_C32(0x516ce33a), SPH_C32(0x835ba5d1), + SPH_C32(0x20692edb) }, + { SPH_C32(0x07ed0000), SPH_C32(0xb2500000), SPH_C32(0x8774000a), + SPH_C32(0x970d0000), SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), + SPH_C32(0xf4786222), SPH_C32(0x9075b1ce), SPH_C32(0xa2d60000), + SPH_C32(0xa6760000), SPH_C32(0xc9440014), SPH_C32(0xeba30000), + SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), SPH_C32(0x03490afa), + SPH_C32(0x9b6ef888) }, + { SPH_C32(0x95bb0000), SPH_C32(0xac8a0000), SPH_C32(0x6d25000a), + SPH_C32(0x7fbc3000), SPH_C32(0xea47750b), SPH_C32(0xa33c0f3d), + SPH_C32(0x45244076), SPH_C32(0xa3b09581), SPH_C32(0x2eec0000), + SPH_C32(0x7cee0000), SPH_C32(0xa93b0014), SPH_C32(0xbfa48800), + SPH_C32(0x499d6b68), SPH_C32(0x501e76da), SPH_C32(0xd8193366), + SPH_C32(0x11361e2c) }, + { SPH_C32(0x5fae0000), SPH_C32(0x322e0000), SPH_C32(0xff47000b), + SPH_C32(0x51663800), SPH_C32(0xa4457f72), SPH_C32(0x316a5179), + SPH_C32(0x580b9c4d), SPH_C32(0xaa31c87f), SPH_C32(0xbf8c0000), + SPH_C32(0x8d040000), SPH_C32(0x81c90014), SPH_C32(0x44c21800), + SPH_C32(0xe92700be), SPH_C32(0xf8617b49), SPH_C32(0x82eb0ed3), + SPH_C32(0x851bce2e) }, + { SPH_C32(0xcdf80000), SPH_C32(0x2cf40000), SPH_C32(0x1516000b), + SPH_C32(0xb9d70800), SPH_C32(0x0d7029d7), SPH_C32(0xda9130e0), + SPH_C32(0xe957be19), SPH_C32(0x99f4ec30), SPH_C32(0x33b60000), + SPH_C32(0x579c0000), SPH_C32(0xe1b60014), SPH_C32(0x10c59000), + SPH_C32(0x6c5645ad), SPH_C32(0x9867c90a), SPH_C32(0x59bb374f), + SPH_C32(0x0f43288a) }, + { SPH_C32(0x1ab70000), SPH_C32(0x99220000), SPH_C32(0xcff9000a), + SPH_C32(0x386c1800), SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), + SPH_C32(0x75da660b), SPH_C32(0x8e008768), SPH_C32(0xe7cf0000), + SPH_C32(0x0d7a0000), SPH_C32(0xf9fa0015), SPH_C32(0x82a92000), + SPH_C32(0x0e105c62), SPH_C32(0x81cc4494), SPH_C32(0x2e98f0bc), + SPH_C32(0xbf5fb79f) }, + { SPH_C32(0x88e10000), SPH_C32(0x87f80000), SPH_C32(0x25a8000a), + SPH_C32(0xd0dd2800), SPH_C32(0xcf8c5bce), SPH_C32(0x6b45b0ed), + SPH_C32(0xc486445f), SPH_C32(0xbdc5a327), SPH_C32(0x6bf50000), + SPH_C32(0xd7e20000), SPH_C32(0x99850015), SPH_C32(0xd6aea800), + SPH_C32(0x8b611971), SPH_C32(0xe1caf6d7), SPH_C32(0xf5c8c920), + SPH_C32(0x3507513b) }, + { SPH_C32(0x42f40000), SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), + SPH_C32(0xfe072000), SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), + SPH_C32(0xd9a99864), SPH_C32(0xb444fed9), SPH_C32(0xfa950000), + SPH_C32(0x26080000), SPH_C32(0xb1770015), SPH_C32(0x2dc83800), + SPH_C32(0x2bdb72a7), SPH_C32(0x49b5fb44), SPH_C32(0xaf3af495), + SPH_C32(0xa12a8139) }, + { SPH_C32(0xd0a20000), SPH_C32(0x07860000), SPH_C32(0x5d9b000b), + SPH_C32(0x16b61000), SPH_C32(0x28bb0712), SPH_C32(0x12e88f30), + SPH_C32(0x68f5ba30), SPH_C32(0x8781da96), SPH_C32(0x76af0000), + SPH_C32(0xfc900000), SPH_C32(0xd1080015), SPH_C32(0x79cfb000), + SPH_C32(0xaeaa37b4), SPH_C32(0x29b34907), SPH_C32(0x746acd09), + SPH_C32(0x2b72679d) }, + { SPH_C32(0xa2d60000), SPH_C32(0xa6760000), SPH_C32(0xc9440014), + SPH_C32(0xeba30000), SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), + SPH_C32(0x03490afa), SPH_C32(0x9b6ef888), SPH_C32(0xa53b0000), + SPH_C32(0x14260000), SPH_C32(0x4e30001e), SPH_C32(0x7cae0000), + SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), SPH_C32(0xf73168d8), + SPH_C32(0x0b1b4946) }, + { SPH_C32(0x30800000), SPH_C32(0xb8ac0000), SPH_C32(0x23150014), + SPH_C32(0x03123000), SPH_C32(0x65d978de), SPH_C32(0xdbe3a500), + SPH_C32(0xb21528ae), SPH_C32(0xa8abdcc7), SPH_C32(0x29010000), + SPH_C32(0xcebe0000), SPH_C32(0x2e4f001e), SPH_C32(0x28a98800), + SPH_C32(0x0aef48c6), SPH_C32(0x18d9187e), SPH_C32(0x2c615144), + SPH_C32(0x8143afe2) }, + { SPH_C32(0xfa950000), SPH_C32(0x26080000), SPH_C32(0xb1770015), + SPH_C32(0x2dc83800), SPH_C32(0x2bdb72a7), SPH_C32(0x49b5fb44), + SPH_C32(0xaf3af495), SPH_C32(0xa12a8139), SPH_C32(0xb8610000), + SPH_C32(0x3f540000), SPH_C32(0x06bd001e), SPH_C32(0xd3cf1800), + SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), SPH_C32(0x76936cf1), + SPH_C32(0x156e7fe0) }, + { SPH_C32(0x68c30000), SPH_C32(0x38d20000), SPH_C32(0x5b260015), + SPH_C32(0xc5790800), SPH_C32(0x82ee2402), SPH_C32(0xa24e9add), + SPH_C32(0x1e66d6c1), SPH_C32(0x92efa576), SPH_C32(0x345b0000), + SPH_C32(0xe5cc0000), SPH_C32(0x66c2001e), SPH_C32(0x87c89000), + SPH_C32(0x2f246603), SPH_C32(0xd0a0a7ae), SPH_C32(0xadc3556d), + SPH_C32(0x9f369944) }, + { SPH_C32(0xbf8c0000), SPH_C32(0x8d040000), SPH_C32(0x81c90014), + SPH_C32(0x44c21800), SPH_C32(0xe92700be), SPH_C32(0xf8617b49), + SPH_C32(0x82eb0ed3), SPH_C32(0x851bce2e), SPH_C32(0xe0220000), + SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), SPH_C32(0x15a42000), + SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), SPH_C32(0xdae0929e), + SPH_C32(0x2f2a0651) }, + { SPH_C32(0x2dda0000), SPH_C32(0x93de0000), SPH_C32(0x6b980014), + SPH_C32(0xac732800), SPH_C32(0x4012561b), SPH_C32(0x139a1ad0), + SPH_C32(0x33b72c87), SPH_C32(0xb6deea61), SPH_C32(0x6c180000), + SPH_C32(0x65b20000), SPH_C32(0x1ef1001f), SPH_C32(0x41a3a800), + SPH_C32(0xc8133adf), SPH_C32(0xa90d9873), SPH_C32(0x01b0ab02), + SPH_C32(0xa572e0f5) }, + { SPH_C32(0xe7cf0000), SPH_C32(0x0d7a0000), SPH_C32(0xf9fa0015), + SPH_C32(0x82a92000), SPH_C32(0x0e105c62), SPH_C32(0x81cc4494), + SPH_C32(0x2e98f0bc), SPH_C32(0xbf5fb79f), SPH_C32(0xfd780000), + SPH_C32(0x94580000), SPH_C32(0x3603001f), SPH_C32(0xbac53800), + SPH_C32(0x68a95109), SPH_C32(0x017295e0), SPH_C32(0x5b4296b7), + SPH_C32(0x315f30f7) }, + { SPH_C32(0x75990000), SPH_C32(0x13a00000), SPH_C32(0x13ab0015), + SPH_C32(0x6a181000), SPH_C32(0xa7250ac7), SPH_C32(0x6a37250d), + SPH_C32(0x9fc4d2e8), SPH_C32(0x8c9a93d0), SPH_C32(0x71420000), + SPH_C32(0x4ec00000), SPH_C32(0x567c001f), SPH_C32(0xeec2b000), + SPH_C32(0xedd8141a), SPH_C32(0x617427a3), SPH_C32(0x8012af2b), + SPH_C32(0xbb07d653) }, + { SPH_C32(0x88980000), SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), + SPH_C32(0xfb4e0000), SPH_C32(0xf158079a), SPH_C32(0x61ae9167), + SPH_C32(0xa895706c), SPH_C32(0xe6107494), SPH_C32(0x0bc20000), + SPH_C32(0xdb630000), SPH_C32(0x7e88000c), SPH_C32(0x15860000), + SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), SPH_C32(0xf460449e), + SPH_C32(0xd8b61463) }, + { SPH_C32(0x1ace0000), SPH_C32(0x014e0000), SPH_C32(0x959e002e), + SPH_C32(0x13ff3000), SPH_C32(0x586d513f), SPH_C32(0x8a55f0fe), + SPH_C32(0x19c95238), SPH_C32(0xd5d550db), SPH_C32(0x87f80000), + SPH_C32(0x01fb0000), SPH_C32(0x1ef7000c), SPH_C32(0x41818800), + SPH_C32(0x148c0de0), SPH_C32(0x15870900), SPH_C32(0x2f307d02), + SPH_C32(0x52eef2c7) }, + { SPH_C32(0xd0db0000), SPH_C32(0x9fea0000), SPH_C32(0x07fc002f), + SPH_C32(0x3d253800), SPH_C32(0x166f5b46), SPH_C32(0x1803aeba), + SPH_C32(0x04e68e03), SPH_C32(0xdc540d25), SPH_C32(0x16980000), + SPH_C32(0xf0110000), SPH_C32(0x3605000c), SPH_C32(0xbae71800), + SPH_C32(0xb4366636), SPH_C32(0xbdf80493), SPH_C32(0x75c240b7), + SPH_C32(0xc6c322c5) }, + { SPH_C32(0x428d0000), SPH_C32(0x81300000), SPH_C32(0xedad002f), + SPH_C32(0xd5940800), SPH_C32(0xbf5a0de3), SPH_C32(0xf3f8cf23), + SPH_C32(0xb5baac57), SPH_C32(0xef91296a), SPH_C32(0x9aa20000), + SPH_C32(0x2a890000), SPH_C32(0x567a000c), SPH_C32(0xeee09000), + SPH_C32(0x31472325), SPH_C32(0xddfeb6d0), SPH_C32(0xae92792b), + SPH_C32(0x4c9bc461) }, + { SPH_C32(0x95c20000), SPH_C32(0x34e60000), SPH_C32(0x3742002e), + SPH_C32(0x542f1800), SPH_C32(0xd493295f), SPH_C32(0xa9d72eb7), + SPH_C32(0x29377445), SPH_C32(0xf8654232), SPH_C32(0x4edb0000), + SPH_C32(0x706f0000), SPH_C32(0x4e36000d), SPH_C32(0x7c8c2000), + SPH_C32(0x53013aea), SPH_C32(0xc4553b4e), SPH_C32(0xd9b1bed8), + SPH_C32(0xfc875b74) }, + { SPH_C32(0x07940000), SPH_C32(0x2a3c0000), SPH_C32(0xdd13002e), + SPH_C32(0xbc9e2800), SPH_C32(0x7da67ffa), SPH_C32(0x422c4f2e), + SPH_C32(0x986b5611), SPH_C32(0xcba0667d), SPH_C32(0xc2e10000), + SPH_C32(0xaaf70000), SPH_C32(0x2e49000d), SPH_C32(0x288ba800), + SPH_C32(0xd6707ff9), SPH_C32(0xa453890d), SPH_C32(0x02e18744), + SPH_C32(0x76dfbdd0) }, + { SPH_C32(0xcd810000), SPH_C32(0xb4980000), SPH_C32(0x4f71002f), + SPH_C32(0x92442000), SPH_C32(0x33a47583), SPH_C32(0xd07a116a), + SPH_C32(0x85448a2a), SPH_C32(0xc2213b83), SPH_C32(0x53810000), + SPH_C32(0x5b1d0000), SPH_C32(0x06bb000d), SPH_C32(0xd3ed3800), + SPH_C32(0x76ca142f), SPH_C32(0x0c2c849e), SPH_C32(0x5813baf1), + SPH_C32(0xe2f26dd2) }, + { SPH_C32(0x5fd70000), SPH_C32(0xaa420000), SPH_C32(0xa520002f), + SPH_C32(0x7af51000), SPH_C32(0x9a912326), SPH_C32(0x3b8170f3), + SPH_C32(0x3418a87e), SPH_C32(0xf1e41fcc), SPH_C32(0xdfbb0000), + SPH_C32(0x81850000), SPH_C32(0x66c4000d), SPH_C32(0x87eab000), + SPH_C32(0xf3bb513c), SPH_C32(0x6c2a36dd), SPH_C32(0x8343836d), + SPH_C32(0x68aa8b76) }, + { SPH_C32(0x2da30000), SPH_C32(0x0bb20000), SPH_C32(0x31ff0030), + SPH_C32(0x87e00000), SPH_C32(0x7ec60a4f), SPH_C32(0x19713b5a), + SPH_C32(0x5fa418b4), SPH_C32(0xed0b3dd2), SPH_C32(0x0c2f0000), + SPH_C32(0x69330000), SPH_C32(0xf9fc0006), SPH_C32(0x828b0000), + SPH_C32(0xd28f6b5d), SPH_C32(0x3d46d5e7), SPH_C32(0x001826bc), + SPH_C32(0x48c3a5ad) }, + { SPH_C32(0xbff50000), SPH_C32(0x15680000), SPH_C32(0xdbae0030), + SPH_C32(0x6f513000), SPH_C32(0xd7f35cea), SPH_C32(0xf28a5ac3), + SPH_C32(0xeef83ae0), SPH_C32(0xdece199d), SPH_C32(0x80150000), + SPH_C32(0xb3ab0000), SPH_C32(0x99830006), SPH_C32(0xd68c8800), + SPH_C32(0x57fe2e4e), SPH_C32(0x5d4067a4), SPH_C32(0xdb481f20), + SPH_C32(0xc29b4309) }, + { SPH_C32(0x75e00000), SPH_C32(0x8bcc0000), SPH_C32(0x49cc0031), + SPH_C32(0x418b3800), SPH_C32(0x99f15693), SPH_C32(0x60dc0487), + SPH_C32(0xf3d7e6db), SPH_C32(0xd74f4463), SPH_C32(0x11750000), + SPH_C32(0x42410000), SPH_C32(0xb1710006), SPH_C32(0x2dea1800), + SPH_C32(0xf7444598), SPH_C32(0xf53f6a37), SPH_C32(0x81ba2295), + SPH_C32(0x56b6930b) }, + { SPH_C32(0xe7b60000), SPH_C32(0x95160000), SPH_C32(0xa39d0031), + SPH_C32(0xa93a0800), SPH_C32(0x30c40036), SPH_C32(0x8b27651e), + SPH_C32(0x428bc48f), SPH_C32(0xe48a602c), SPH_C32(0x9d4f0000), + SPH_C32(0x98d90000), SPH_C32(0xd10e0006), SPH_C32(0x79ed9000), + SPH_C32(0x7235008b), SPH_C32(0x9539d874), SPH_C32(0x5aea1b09), + SPH_C32(0xdcee75af) }, + { SPH_C32(0x30f90000), SPH_C32(0x20c00000), SPH_C32(0x79720030), + SPH_C32(0x28811800), SPH_C32(0x5b0d248a), SPH_C32(0xd108848a), + SPH_C32(0xde061c9d), SPH_C32(0xf37e0b74), SPH_C32(0x49360000), + SPH_C32(0xc23f0000), SPH_C32(0xc9420007), SPH_C32(0xeb812000), + SPH_C32(0x10731944), SPH_C32(0x8c9255ea), SPH_C32(0x2dc9dcfa), + SPH_C32(0x6cf2eaba) }, + { SPH_C32(0xa2af0000), SPH_C32(0x3e1a0000), SPH_C32(0x93230030), + SPH_C32(0xc0302800), SPH_C32(0xf238722f), SPH_C32(0x3af3e513), + SPH_C32(0x6f5a3ec9), SPH_C32(0xc0bb2f3b), SPH_C32(0xc50c0000), + SPH_C32(0x18a70000), SPH_C32(0xa93d0007), SPH_C32(0xbf86a800), + SPH_C32(0x95025c57), SPH_C32(0xec94e7a9), SPH_C32(0xf699e566), + SPH_C32(0xe6aa0c1e) }, + { SPH_C32(0x68ba0000), SPH_C32(0xa0be0000), SPH_C32(0x01410031), + SPH_C32(0xeeea2000), SPH_C32(0xbc3a7856), SPH_C32(0xa8a5bb57), + SPH_C32(0x7275e2f2), SPH_C32(0xc93a72c5), SPH_C32(0x546c0000), + SPH_C32(0xe94d0000), SPH_C32(0x81cf0007), SPH_C32(0x44e03800), + SPH_C32(0x35b83781), SPH_C32(0x44ebea3a), SPH_C32(0xac6bd8d3), + SPH_C32(0x7287dc1c) }, + { SPH_C32(0xfaec0000), SPH_C32(0xbe640000), SPH_C32(0xeb100031), + SPH_C32(0x065b1000), SPH_C32(0x150f2ef3), SPH_C32(0x435edace), + SPH_C32(0xc329c0a6), SPH_C32(0xfaff568a), SPH_C32(0xd8560000), + SPH_C32(0x33d50000), SPH_C32(0xe1b00007), SPH_C32(0x10e7b000), + SPH_C32(0xb0c97292), SPH_C32(0x24ed5879), SPH_C32(0x773be14f), + SPH_C32(0xf8df3ab8) }, + { SPH_C32(0x8f750000), SPH_C32(0xadc40000), SPH_C32(0xf8bb0024), + SPH_C32(0x6c430000), SPH_C32(0xb22a2434), SPH_C32(0x2969ffc3), + SPH_C32(0x5ced124e), SPH_C32(0x7665c55a), SPH_C32(0xa9140000), + SPH_C32(0x7d150000), SPH_C32(0xb7cc0018), SPH_C32(0xfe250000), + SPH_C32(0x5d116688), SPH_C32(0x45997fda), SPH_C32(0xf7294e64), + SPH_C32(0x43d8eceb) }, + { SPH_C32(0x1d230000), SPH_C32(0xb31e0000), SPH_C32(0x12ea0024), + SPH_C32(0x84f23000), SPH_C32(0x1b1f7291), SPH_C32(0xc2929e5a), + SPH_C32(0xedb1301a), SPH_C32(0x45a0e115), SPH_C32(0x252e0000), + SPH_C32(0xa78d0000), SPH_C32(0xd7b30018), SPH_C32(0xaa228800), + SPH_C32(0xd860239b), SPH_C32(0x259fcd99), SPH_C32(0x2c7977f8), + SPH_C32(0xc9800a4f) }, + { SPH_C32(0xd7360000), SPH_C32(0x2dba0000), SPH_C32(0x80880025), + SPH_C32(0xaa283800), SPH_C32(0x551d78e8), SPH_C32(0x50c4c01e), + SPH_C32(0xf09eec21), SPH_C32(0x4c21bceb), SPH_C32(0xb44e0000), + SPH_C32(0x56670000), SPH_C32(0xff410018), SPH_C32(0x51441800), + SPH_C32(0x78da484d), SPH_C32(0x8de0c00a), SPH_C32(0x768b4a4d), + SPH_C32(0x5dadda4d) }, + { SPH_C32(0x45600000), SPH_C32(0x33600000), SPH_C32(0x6ad90025), + SPH_C32(0x42990800), SPH_C32(0xfc282e4d), SPH_C32(0xbb3fa187), + SPH_C32(0x41c2ce75), SPH_C32(0x7fe498a4), SPH_C32(0x38740000), + SPH_C32(0x8cff0000), SPH_C32(0x9f3e0018), SPH_C32(0x05439000), + SPH_C32(0xfdab0d5e), SPH_C32(0xede67249), SPH_C32(0xaddb73d1), + SPH_C32(0xd7f53ce9) }, + { SPH_C32(0x922f0000), SPH_C32(0x86b60000), SPH_C32(0xb0360024), + SPH_C32(0xc3221800), SPH_C32(0x97e10af1), SPH_C32(0xe1104013), + SPH_C32(0xdd4f1667), SPH_C32(0x6810f3fc), SPH_C32(0xec0d0000), + SPH_C32(0xd6190000), SPH_C32(0x87720019), SPH_C32(0x972f2000), + SPH_C32(0x9fed1491), SPH_C32(0xf44dffd7), SPH_C32(0xdaf8b422), + SPH_C32(0x67e9a3fc) }, + { SPH_C32(0x00790000), SPH_C32(0x986c0000), SPH_C32(0x5a670024), + SPH_C32(0x2b932800), SPH_C32(0x3ed45c54), SPH_C32(0x0aeb218a), + SPH_C32(0x6c133433), SPH_C32(0x5bd5d7b3), SPH_C32(0x60370000), + SPH_C32(0x0c810000), SPH_C32(0xe70d0019), SPH_C32(0xc328a800), + SPH_C32(0x1a9c5182), SPH_C32(0x944b4d94), SPH_C32(0x01a88dbe), + SPH_C32(0xedb14558) }, + { SPH_C32(0xca6c0000), SPH_C32(0x06c80000), SPH_C32(0xc8050025), + SPH_C32(0x05492000), SPH_C32(0x70d6562d), SPH_C32(0x98bd7fce), + SPH_C32(0x713ce808), SPH_C32(0x52548a4d), SPH_C32(0xf1570000), + SPH_C32(0xfd6b0000), SPH_C32(0xcfff0019), SPH_C32(0x384e3800), + SPH_C32(0xba263a54), SPH_C32(0x3c344007), SPH_C32(0x5b5ab00b), + SPH_C32(0x799c955a) }, + { SPH_C32(0x583a0000), SPH_C32(0x18120000), SPH_C32(0x22540025), + SPH_C32(0xedf81000), SPH_C32(0xd9e30088), SPH_C32(0x73461e57), + SPH_C32(0xc060ca5c), SPH_C32(0x6191ae02), SPH_C32(0x7d6d0000), + SPH_C32(0x27f30000), SPH_C32(0xaf800019), SPH_C32(0x6c49b000), + SPH_C32(0x3f577f47), SPH_C32(0x5c32f244), SPH_C32(0x800a8997), + SPH_C32(0xf3c473fe) }, + { SPH_C32(0x2a4e0000), SPH_C32(0xb9e20000), SPH_C32(0xb68b003a), + SPH_C32(0x10ed0000), SPH_C32(0x3db429e1), SPH_C32(0x51b655fe), + SPH_C32(0xabdc7a96), SPH_C32(0x7d7e8c1c), SPH_C32(0xaef90000), + SPH_C32(0xcf450000), SPH_C32(0x30b80012), SPH_C32(0x69280000), + SPH_C32(0x1e634526), SPH_C32(0x0d5e117e), SPH_C32(0x03512c46), + SPH_C32(0xd3ad5d25) }, + { SPH_C32(0xb8180000), SPH_C32(0xa7380000), SPH_C32(0x5cda003a), + SPH_C32(0xf85c3000), SPH_C32(0x94817f44), SPH_C32(0xba4d3467), + SPH_C32(0x1a8058c2), SPH_C32(0x4ebba853), SPH_C32(0x22c30000), + SPH_C32(0x15dd0000), SPH_C32(0x50c70012), SPH_C32(0x3d2f8800), + SPH_C32(0x9b120035), SPH_C32(0x6d58a33d), SPH_C32(0xd80115da), + SPH_C32(0x59f5bb81) }, + { SPH_C32(0x720d0000), SPH_C32(0x399c0000), SPH_C32(0xceb8003b), + SPH_C32(0xd6863800), SPH_C32(0xda83753d), SPH_C32(0x281b6a23), + SPH_C32(0x07af84f9), SPH_C32(0x473af5ad), SPH_C32(0xb3a30000), + SPH_C32(0xe4370000), SPH_C32(0x78350012), SPH_C32(0xc6491800), + SPH_C32(0x3ba86be3), SPH_C32(0xc527aeae), SPH_C32(0x82f3286f), + SPH_C32(0xcdd86b83) }, + { SPH_C32(0xe05b0000), SPH_C32(0x27460000), SPH_C32(0x24e9003b), + SPH_C32(0x3e370800), SPH_C32(0x73b62398), SPH_C32(0xc3e00bba), + SPH_C32(0xb6f3a6ad), SPH_C32(0x74ffd1e2), SPH_C32(0x3f990000), + SPH_C32(0x3eaf0000), SPH_C32(0x184a0012), SPH_C32(0x924e9000), + SPH_C32(0xbed92ef0), SPH_C32(0xa5211ced), SPH_C32(0x59a311f3), + SPH_C32(0x47808d27) }, + { SPH_C32(0x37140000), SPH_C32(0x92900000), SPH_C32(0xfe06003a), + SPH_C32(0xbf8c1800), SPH_C32(0x187f0724), SPH_C32(0x99cfea2e), + SPH_C32(0x2a7e7ebf), SPH_C32(0x630bbaba), SPH_C32(0xebe00000), + SPH_C32(0x64490000), SPH_C32(0x00060013), SPH_C32(0x00222000), + SPH_C32(0xdc9f373f), SPH_C32(0xbc8a9173), SPH_C32(0x2e80d600), + SPH_C32(0xf79c1232) }, + { SPH_C32(0xa5420000), SPH_C32(0x8c4a0000), SPH_C32(0x1457003a), + SPH_C32(0x573d2800), SPH_C32(0xb14a5181), SPH_C32(0x72348bb7), + SPH_C32(0x9b225ceb), SPH_C32(0x50ce9ef5), SPH_C32(0x67da0000), + SPH_C32(0xbed10000), SPH_C32(0x60790013), SPH_C32(0x5425a800), + SPH_C32(0x59ee722c), SPH_C32(0xdc8c2330), SPH_C32(0xf5d0ef9c), + SPH_C32(0x7dc4f496) }, + { SPH_C32(0x6f570000), SPH_C32(0x12ee0000), SPH_C32(0x8635003b), + SPH_C32(0x79e72000), SPH_C32(0xff485bf8), SPH_C32(0xe062d5f3), + SPH_C32(0x860d80d0), SPH_C32(0x594fc30b), SPH_C32(0xf6ba0000), + SPH_C32(0x4f3b0000), SPH_C32(0x488b0013), SPH_C32(0xaf433800), + SPH_C32(0xf95419fa), SPH_C32(0x74f32ea3), SPH_C32(0xaf22d229), + SPH_C32(0xe9e92494) }, + { SPH_C32(0xfd010000), SPH_C32(0x0c340000), SPH_C32(0x6c64003b), + SPH_C32(0x91561000), SPH_C32(0x567d0d5d), SPH_C32(0x0b99b46a), + SPH_C32(0x3751a284), SPH_C32(0x6a8ae744), SPH_C32(0x7a800000), + SPH_C32(0x95a30000), SPH_C32(0x28f40013), SPH_C32(0xfb44b000), + SPH_C32(0x7c255ce9), SPH_C32(0x14f59ce0), SPH_C32(0x7472ebb5), + SPH_C32(0x63b1c230) }, + { SPH_C32(0x0bc20000), SPH_C32(0xdb630000), SPH_C32(0x7e88000c), + SPH_C32(0x15860000), SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), + SPH_C32(0xf460449e), SPH_C32(0xd8b61463), SPH_C32(0x835a0000), + SPH_C32(0xc4f70000), SPH_C32(0x01470022), SPH_C32(0xeec80000), + SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), SPH_C32(0x5cf534f2), + SPH_C32(0x3ea660f7) }, + { SPH_C32(0x99940000), SPH_C32(0xc5b90000), SPH_C32(0x94d9000c), + SPH_C32(0xfd373000), SPH_C32(0x38c81e56), SPH_C32(0x9e7adada), + SPH_C32(0x453c66ca), SPH_C32(0xeb73302c), SPH_C32(0x0f600000), + SPH_C32(0x1e6f0000), SPH_C32(0x61380022), SPH_C32(0xbacf8800), + SPH_C32(0xe5d40a7a), SPH_C32(0x74299867), SPH_C32(0x87a50d6e), + SPH_C32(0xb4fe8653) }, + { SPH_C32(0x53810000), SPH_C32(0x5b1d0000), SPH_C32(0x06bb000d), + SPH_C32(0xd3ed3800), SPH_C32(0x76ca142f), SPH_C32(0x0c2c849e), + SPH_C32(0x5813baf1), SPH_C32(0xe2f26dd2), SPH_C32(0x9e000000), + SPH_C32(0xef850000), SPH_C32(0x49ca0022), SPH_C32(0x41a91800), + SPH_C32(0x456e61ac), SPH_C32(0xdc5695f4), SPH_C32(0xdd5730db), + SPH_C32(0x20d35651) }, + { SPH_C32(0xc1d70000), SPH_C32(0x45c70000), SPH_C32(0xecea000d), + SPH_C32(0x3b5c0800), SPH_C32(0xdfff428a), SPH_C32(0xe7d7e507), + SPH_C32(0xe94f98a5), SPH_C32(0xd137499d), SPH_C32(0x123a0000), + SPH_C32(0x351d0000), SPH_C32(0x29b50022), SPH_C32(0x15ae9000), + SPH_C32(0xc01f24bf), SPH_C32(0xbc5027b7), SPH_C32(0x06070947), + SPH_C32(0xaa8bb0f5) }, + { SPH_C32(0x16980000), SPH_C32(0xf0110000), SPH_C32(0x3605000c), + SPH_C32(0xbae71800), SPH_C32(0xb4366636), SPH_C32(0xbdf80493), + SPH_C32(0x75c240b7), SPH_C32(0xc6c322c5), SPH_C32(0xc6430000), + SPH_C32(0x6ffb0000), SPH_C32(0x31f90023), SPH_C32(0x87c22000), + SPH_C32(0xa2593d70), SPH_C32(0xa5fbaa29), SPH_C32(0x7124ceb4), + SPH_C32(0x1a972fe0) }, + { SPH_C32(0x84ce0000), SPH_C32(0xeecb0000), SPH_C32(0xdc54000c), + SPH_C32(0x52562800), SPH_C32(0x1d033093), SPH_C32(0x5603650a), + SPH_C32(0xc49e62e3), SPH_C32(0xf506068a), SPH_C32(0x4a790000), + SPH_C32(0xb5630000), SPH_C32(0x51860023), SPH_C32(0xd3c5a800), + SPH_C32(0x27287863), SPH_C32(0xc5fd186a), SPH_C32(0xaa74f728), + SPH_C32(0x90cfc944) }, + { SPH_C32(0x4edb0000), SPH_C32(0x706f0000), SPH_C32(0x4e36000d), + SPH_C32(0x7c8c2000), SPH_C32(0x53013aea), SPH_C32(0xc4553b4e), + SPH_C32(0xd9b1bed8), SPH_C32(0xfc875b74), SPH_C32(0xdb190000), + SPH_C32(0x44890000), SPH_C32(0x79740023), SPH_C32(0x28a33800), + SPH_C32(0x879213b5), SPH_C32(0x6d8215f9), SPH_C32(0xf086ca9d), + SPH_C32(0x04e21946) }, + { SPH_C32(0xdc8d0000), SPH_C32(0x6eb50000), SPH_C32(0xa467000d), + SPH_C32(0x943d1000), SPH_C32(0xfa346c4f), SPH_C32(0x2fae5ad7), + SPH_C32(0x68ed9c8c), SPH_C32(0xcf427f3b), SPH_C32(0x57230000), + SPH_C32(0x9e110000), SPH_C32(0x190b0023), SPH_C32(0x7ca4b000), + SPH_C32(0x02e356a6), SPH_C32(0x0d84a7ba), SPH_C32(0x2bd6f301), + SPH_C32(0x8ebaffe2) }, + { SPH_C32(0xaef90000), SPH_C32(0xcf450000), SPH_C32(0x30b80012), + SPH_C32(0x69280000), SPH_C32(0x1e634526), SPH_C32(0x0d5e117e), + SPH_C32(0x03512c46), SPH_C32(0xd3ad5d25), SPH_C32(0x84b70000), + SPH_C32(0x76a70000), SPH_C32(0x86330028), SPH_C32(0x79c50000), + SPH_C32(0x23d76cc7), SPH_C32(0x5ce84480), SPH_C32(0xa88d56d0), + SPH_C32(0xaed3d139) }, + { SPH_C32(0x3caf0000), SPH_C32(0xd19f0000), SPH_C32(0xdae90012), + SPH_C32(0x81993000), SPH_C32(0xb7561383), SPH_C32(0xe6a570e7), + SPH_C32(0xb20d0e12), SPH_C32(0xe068796a), SPH_C32(0x088d0000), + SPH_C32(0xac3f0000), SPH_C32(0xe64c0028), SPH_C32(0x2dc28800), + SPH_C32(0xa6a629d4), SPH_C32(0x3ceef6c3), SPH_C32(0x73dd6f4c), + SPH_C32(0x248b379d) }, + { SPH_C32(0xf6ba0000), SPH_C32(0x4f3b0000), SPH_C32(0x488b0013), + SPH_C32(0xaf433800), SPH_C32(0xf95419fa), SPH_C32(0x74f32ea3), + SPH_C32(0xaf22d229), SPH_C32(0xe9e92494), SPH_C32(0x99ed0000), + SPH_C32(0x5dd50000), SPH_C32(0xcebe0028), SPH_C32(0xd6a41800), + SPH_C32(0x061c4202), SPH_C32(0x9491fb50), SPH_C32(0x292f52f9), + SPH_C32(0xb0a6e79f) }, + { SPH_C32(0x64ec0000), SPH_C32(0x51e10000), SPH_C32(0xa2da0013), + SPH_C32(0x47f20800), SPH_C32(0x50614f5f), SPH_C32(0x9f084f3a), + SPH_C32(0x1e7ef07d), SPH_C32(0xda2c00db), SPH_C32(0x15d70000), + SPH_C32(0x874d0000), SPH_C32(0xaec10028), SPH_C32(0x82a39000), + SPH_C32(0x836d0711), SPH_C32(0xf4974913), SPH_C32(0xf27f6b65), + SPH_C32(0x3afe013b) }, + { SPH_C32(0xb3a30000), SPH_C32(0xe4370000), SPH_C32(0x78350012), + SPH_C32(0xc6491800), SPH_C32(0x3ba86be3), SPH_C32(0xc527aeae), + SPH_C32(0x82f3286f), SPH_C32(0xcdd86b83), SPH_C32(0xc1ae0000), + SPH_C32(0xddab0000), SPH_C32(0xb68d0029), SPH_C32(0x10cf2000), + SPH_C32(0xe12b1ede), SPH_C32(0xed3cc48d), SPH_C32(0x855cac96), + SPH_C32(0x8ae29e2e) }, + { SPH_C32(0x21f50000), SPH_C32(0xfaed0000), SPH_C32(0x92640012), + SPH_C32(0x2ef82800), SPH_C32(0x929d3d46), SPH_C32(0x2edccf37), + SPH_C32(0x33af0a3b), SPH_C32(0xfe1d4fcc), SPH_C32(0x4d940000), + SPH_C32(0x07330000), SPH_C32(0xd6f20029), SPH_C32(0x44c8a800), + SPH_C32(0x645a5bcd), SPH_C32(0x8d3a76ce), SPH_C32(0x5e0c950a), + SPH_C32(0x00ba788a) }, + { SPH_C32(0xebe00000), SPH_C32(0x64490000), SPH_C32(0x00060013), + SPH_C32(0x00222000), SPH_C32(0xdc9f373f), SPH_C32(0xbc8a9173), + SPH_C32(0x2e80d600), SPH_C32(0xf79c1232), SPH_C32(0xdcf40000), + SPH_C32(0xf6d90000), SPH_C32(0xfe000029), SPH_C32(0xbfae3800), + SPH_C32(0xc4e0301b), SPH_C32(0x25457b5d), SPH_C32(0x04fea8bf), + SPH_C32(0x9497a888) }, + { SPH_C32(0x79b60000), SPH_C32(0x7a930000), SPH_C32(0xea570013), + SPH_C32(0xe8931000), SPH_C32(0x75aa619a), SPH_C32(0x5771f0ea), + SPH_C32(0x9fdcf454), SPH_C32(0xc459367d), SPH_C32(0x50ce0000), + SPH_C32(0x2c410000), SPH_C32(0x9e7f0029), SPH_C32(0xeba9b000), + SPH_C32(0x41917508), SPH_C32(0x4543c91e), SPH_C32(0xdfae9123), + SPH_C32(0x1ecf4e2c) }, + { SPH_C32(0x0c2f0000), SPH_C32(0x69330000), SPH_C32(0xf9fc0006), + SPH_C32(0x828b0000), SPH_C32(0xd28f6b5d), SPH_C32(0x3d46d5e7), + SPH_C32(0x001826bc), SPH_C32(0x48c3a5ad), SPH_C32(0x218c0000), + SPH_C32(0x62810000), SPH_C32(0xc8030036), SPH_C32(0x056b0000), + SPH_C32(0xac496112), SPH_C32(0x2437eebd), SPH_C32(0x5fbc3e08), + SPH_C32(0xa5c8987f) }, + { SPH_C32(0x9e790000), SPH_C32(0x77e90000), SPH_C32(0x13ad0006), + SPH_C32(0x6a3a3000), SPH_C32(0x7bba3df8), SPH_C32(0xd6bdb47e), + SPH_C32(0xb14404e8), SPH_C32(0x7b0681e2), SPH_C32(0xadb60000), + SPH_C32(0xb8190000), SPH_C32(0xa87c0036), SPH_C32(0x516c8800), + SPH_C32(0x29382401), SPH_C32(0x44315cfe), SPH_C32(0x84ec0794), + SPH_C32(0x2f907edb) }, + { SPH_C32(0x546c0000), SPH_C32(0xe94d0000), SPH_C32(0x81cf0007), + SPH_C32(0x44e03800), SPH_C32(0x35b83781), SPH_C32(0x44ebea3a), + SPH_C32(0xac6bd8d3), SPH_C32(0x7287dc1c), SPH_C32(0x3cd60000), + SPH_C32(0x49f30000), SPH_C32(0x808e0036), SPH_C32(0xaa0a1800), + SPH_C32(0x89824fd7), SPH_C32(0xec4e516d), SPH_C32(0xde1e3a21), + SPH_C32(0xbbbdaed9) }, + { SPH_C32(0xc63a0000), SPH_C32(0xf7970000), SPH_C32(0x6b9e0007), + SPH_C32(0xac510800), SPH_C32(0x9c8d6124), SPH_C32(0xaf108ba3), + SPH_C32(0x1d37fa87), SPH_C32(0x4142f853), SPH_C32(0xb0ec0000), + SPH_C32(0x936b0000), SPH_C32(0xe0f10036), SPH_C32(0xfe0d9000), + SPH_C32(0x0cf30ac4), SPH_C32(0x8c48e32e), SPH_C32(0x054e03bd), + SPH_C32(0x31e5487d) }, + { SPH_C32(0x11750000), SPH_C32(0x42410000), SPH_C32(0xb1710006), + SPH_C32(0x2dea1800), SPH_C32(0xf7444598), SPH_C32(0xf53f6a37), + SPH_C32(0x81ba2295), SPH_C32(0x56b6930b), SPH_C32(0x64950000), + SPH_C32(0xc98d0000), SPH_C32(0xf8bd0037), SPH_C32(0x6c612000), + SPH_C32(0x6eb5130b), SPH_C32(0x95e36eb0), SPH_C32(0x726dc44e), + SPH_C32(0x81f9d768) }, + { SPH_C32(0x83230000), SPH_C32(0x5c9b0000), SPH_C32(0x5b200006), + SPH_C32(0xc55b2800), SPH_C32(0x5e71133d), SPH_C32(0x1ec40bae), + SPH_C32(0x30e600c1), SPH_C32(0x6573b744), SPH_C32(0xe8af0000), + SPH_C32(0x13150000), SPH_C32(0x98c20037), SPH_C32(0x3866a800), + SPH_C32(0xebc45618), SPH_C32(0xf5e5dcf3), SPH_C32(0xa93dfdd2), + SPH_C32(0x0ba131cc) }, + { SPH_C32(0x49360000), SPH_C32(0xc23f0000), SPH_C32(0xc9420007), + SPH_C32(0xeb812000), SPH_C32(0x10731944), SPH_C32(0x8c9255ea), + SPH_C32(0x2dc9dcfa), SPH_C32(0x6cf2eaba), SPH_C32(0x79cf0000), + SPH_C32(0xe2ff0000), SPH_C32(0xb0300037), SPH_C32(0xc3003800), + SPH_C32(0x4b7e3dce), SPH_C32(0x5d9ad160), SPH_C32(0xf3cfc067), + SPH_C32(0x9f8ce1ce) }, + { SPH_C32(0xdb600000), SPH_C32(0xdce50000), SPH_C32(0x23130007), + SPH_C32(0x03301000), SPH_C32(0xb9464fe1), SPH_C32(0x67693473), + SPH_C32(0x9c95feae), SPH_C32(0x5f37cef5), SPH_C32(0xf5f50000), + SPH_C32(0x38670000), SPH_C32(0xd04f0037), SPH_C32(0x9707b000), + SPH_C32(0xce0f78dd), SPH_C32(0x3d9c6323), SPH_C32(0x289ff9fb), + SPH_C32(0x15d4076a) }, + { SPH_C32(0xa9140000), SPH_C32(0x7d150000), SPH_C32(0xb7cc0018), + SPH_C32(0xfe250000), SPH_C32(0x5d116688), SPH_C32(0x45997fda), + SPH_C32(0xf7294e64), SPH_C32(0x43d8eceb), SPH_C32(0x26610000), + SPH_C32(0xd0d10000), SPH_C32(0x4f77003c), SPH_C32(0x92660000), + SPH_C32(0xef3b42bc), SPH_C32(0x6cf08019), SPH_C32(0xabc45c2a), + SPH_C32(0x35bd29b1) }, + { SPH_C32(0x3b420000), SPH_C32(0x63cf0000), SPH_C32(0x5d9d0018), + SPH_C32(0x16943000), SPH_C32(0xf424302d), SPH_C32(0xae621e43), + SPH_C32(0x46756c30), SPH_C32(0x701dc8a4), SPH_C32(0xaa5b0000), + SPH_C32(0x0a490000), SPH_C32(0x2f08003c), SPH_C32(0xc6618800), + SPH_C32(0x6a4a07af), SPH_C32(0x0cf6325a), SPH_C32(0x709465b6), + SPH_C32(0xbfe5cf15) }, + { SPH_C32(0xf1570000), SPH_C32(0xfd6b0000), SPH_C32(0xcfff0019), + SPH_C32(0x384e3800), SPH_C32(0xba263a54), SPH_C32(0x3c344007), + SPH_C32(0x5b5ab00b), SPH_C32(0x799c955a), SPH_C32(0x3b3b0000), + SPH_C32(0xfba30000), SPH_C32(0x07fa003c), SPH_C32(0x3d071800), + SPH_C32(0xcaf06c79), SPH_C32(0xa4893fc9), SPH_C32(0x2a665803), + SPH_C32(0x2bc81f17) }, + { SPH_C32(0x63010000), SPH_C32(0xe3b10000), SPH_C32(0x25ae0019), + SPH_C32(0xd0ff0800), SPH_C32(0x13136cf1), SPH_C32(0xd7cf219e), + SPH_C32(0xea06925f), SPH_C32(0x4a59b115), SPH_C32(0xb7010000), + SPH_C32(0x213b0000), SPH_C32(0x6785003c), SPH_C32(0x69009000), + SPH_C32(0x4f81296a), SPH_C32(0xc48f8d8a), SPH_C32(0xf136619f), + SPH_C32(0xa190f9b3) }, + { SPH_C32(0xb44e0000), SPH_C32(0x56670000), SPH_C32(0xff410018), + SPH_C32(0x51441800), SPH_C32(0x78da484d), SPH_C32(0x8de0c00a), + SPH_C32(0x768b4a4d), SPH_C32(0x5dadda4d), SPH_C32(0x63780000), + SPH_C32(0x7bdd0000), SPH_C32(0x7fc9003d), SPH_C32(0xfb6c2000), + SPH_C32(0x2dc730a5), SPH_C32(0xdd240014), SPH_C32(0x8615a66c), + SPH_C32(0x118c66a6) }, + { SPH_C32(0x26180000), SPH_C32(0x48bd0000), SPH_C32(0x15100018), + SPH_C32(0xb9f52800), SPH_C32(0xd1ef1ee8), SPH_C32(0x661ba193), + SPH_C32(0xc7d76819), SPH_C32(0x6e68fe02), SPH_C32(0xef420000), + SPH_C32(0xa1450000), SPH_C32(0x1fb6003d), SPH_C32(0xaf6ba800), + SPH_C32(0xa8b675b6), SPH_C32(0xbd22b257), SPH_C32(0x5d459ff0), + SPH_C32(0x9bd48002) }, + { SPH_C32(0xec0d0000), SPH_C32(0xd6190000), SPH_C32(0x87720019), + SPH_C32(0x972f2000), SPH_C32(0x9fed1491), SPH_C32(0xf44dffd7), + SPH_C32(0xdaf8b422), SPH_C32(0x67e9a3fc), SPH_C32(0x7e220000), + SPH_C32(0x50af0000), SPH_C32(0x3744003d), SPH_C32(0x540d3800), + SPH_C32(0x080c1e60), SPH_C32(0x155dbfc4), SPH_C32(0x07b7a245), + SPH_C32(0x0ff95000) }, + { SPH_C32(0x7e5b0000), SPH_C32(0xc8c30000), SPH_C32(0x6d230019), + SPH_C32(0x7f9e1000), SPH_C32(0x36d84234), SPH_C32(0x1fb69e4e), + SPH_C32(0x6ba49676), SPH_C32(0x542c87b3), SPH_C32(0xf2180000), + SPH_C32(0x8a370000), SPH_C32(0x573b003d), SPH_C32(0x000ab000), + SPH_C32(0x8d7d5b73), SPH_C32(0x755b0d87), SPH_C32(0xdce79bd9), + SPH_C32(0x85a1b6a4) }, + { SPH_C32(0x835a0000), SPH_C32(0xc4f70000), SPH_C32(0x01470022), + SPH_C32(0xeec80000), SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), + SPH_C32(0x5cf534f2), SPH_C32(0x3ea660f7), SPH_C32(0x88980000), + SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), SPH_C32(0xfb4e0000), + SPH_C32(0xf158079a), SPH_C32(0x61ae9167), SPH_C32(0xa895706c), + SPH_C32(0xe6107494) }, + { SPH_C32(0x110c0000), SPH_C32(0xda2d0000), SPH_C32(0xeb160022), + SPH_C32(0x06793000), SPH_C32(0xc99019cc), SPH_C32(0xffd44bbd), + SPH_C32(0xeda916a6), SPH_C32(0x0d6344b8), SPH_C32(0x04a20000), + SPH_C32(0xc50c0000), SPH_C32(0x1fb0002e), SPH_C32(0xaf498800), + SPH_C32(0x74294289), SPH_C32(0x01a82324), SPH_C32(0x73c549f0), + SPH_C32(0x6c489230) }, + { SPH_C32(0xdb190000), SPH_C32(0x44890000), SPH_C32(0x79740023), + SPH_C32(0x28a33800), SPH_C32(0x879213b5), SPH_C32(0x6d8215f9), + SPH_C32(0xf086ca9d), SPH_C32(0x04e21946), SPH_C32(0x95c20000), + SPH_C32(0x34e60000), SPH_C32(0x3742002e), SPH_C32(0x542f1800), + SPH_C32(0xd493295f), SPH_C32(0xa9d72eb7), SPH_C32(0x29377445), + SPH_C32(0xf8654232) }, + { SPH_C32(0x494f0000), SPH_C32(0x5a530000), SPH_C32(0x93250023), + SPH_C32(0xc0120800), SPH_C32(0x2ea74510), SPH_C32(0x86797460), + SPH_C32(0x41dae8c9), SPH_C32(0x37273d09), SPH_C32(0x19f80000), + SPH_C32(0xee7e0000), SPH_C32(0x573d002e), SPH_C32(0x00289000), + SPH_C32(0x51e26c4c), SPH_C32(0xc9d19cf4), SPH_C32(0xf2674dd9), + SPH_C32(0x723da496) }, + { SPH_C32(0x9e000000), SPH_C32(0xef850000), SPH_C32(0x49ca0022), + SPH_C32(0x41a91800), SPH_C32(0x456e61ac), SPH_C32(0xdc5695f4), + SPH_C32(0xdd5730db), SPH_C32(0x20d35651), SPH_C32(0xcd810000), + SPH_C32(0xb4980000), SPH_C32(0x4f71002f), SPH_C32(0x92442000), + SPH_C32(0x33a47583), SPH_C32(0xd07a116a), SPH_C32(0x85448a2a), + SPH_C32(0xc2213b83) }, + { SPH_C32(0x0c560000), SPH_C32(0xf15f0000), SPH_C32(0xa39b0022), + SPH_C32(0xa9182800), SPH_C32(0xec5b3709), SPH_C32(0x37adf46d), + SPH_C32(0x6c0b128f), SPH_C32(0x1316721e), SPH_C32(0x41bb0000), + SPH_C32(0x6e000000), SPH_C32(0x2f0e002f), SPH_C32(0xc643a800), + SPH_C32(0xb6d53090), SPH_C32(0xb07ca329), SPH_C32(0x5e14b3b6), + SPH_C32(0x4879dd27) }, + { SPH_C32(0xc6430000), SPH_C32(0x6ffb0000), SPH_C32(0x31f90023), + SPH_C32(0x87c22000), SPH_C32(0xa2593d70), SPH_C32(0xa5fbaa29), + SPH_C32(0x7124ceb4), SPH_C32(0x1a972fe0), SPH_C32(0xd0db0000), + SPH_C32(0x9fea0000), SPH_C32(0x07fc002f), SPH_C32(0x3d253800), + SPH_C32(0x166f5b46), SPH_C32(0x1803aeba), SPH_C32(0x04e68e03), + SPH_C32(0xdc540d25) }, + { SPH_C32(0x54150000), SPH_C32(0x71210000), SPH_C32(0xdba80023), + SPH_C32(0x6f731000), SPH_C32(0x0b6c6bd5), SPH_C32(0x4e00cbb0), + SPH_C32(0xc078ece0), SPH_C32(0x29520baf), SPH_C32(0x5ce10000), + SPH_C32(0x45720000), SPH_C32(0x6783002f), SPH_C32(0x6922b000), + SPH_C32(0x931e1e55), SPH_C32(0x78051cf9), SPH_C32(0xdfb6b79f), + SPH_C32(0x560ceb81) }, + { SPH_C32(0x26610000), SPH_C32(0xd0d10000), SPH_C32(0x4f77003c), + SPH_C32(0x92660000), SPH_C32(0xef3b42bc), SPH_C32(0x6cf08019), + SPH_C32(0xabc45c2a), SPH_C32(0x35bd29b1), SPH_C32(0x8f750000), + SPH_C32(0xadc40000), SPH_C32(0xf8bb0024), SPH_C32(0x6c430000), + SPH_C32(0xb22a2434), SPH_C32(0x2969ffc3), SPH_C32(0x5ced124e), + SPH_C32(0x7665c55a) }, + { SPH_C32(0xb4370000), SPH_C32(0xce0b0000), SPH_C32(0xa526003c), + SPH_C32(0x7ad73000), SPH_C32(0x460e1419), SPH_C32(0x870be180), + SPH_C32(0x1a987e7e), SPH_C32(0x06780dfe), SPH_C32(0x034f0000), + SPH_C32(0x775c0000), SPH_C32(0x98c40024), SPH_C32(0x38448800), + SPH_C32(0x375b6127), SPH_C32(0x496f4d80), SPH_C32(0x87bd2bd2), + SPH_C32(0xfc3d23fe) }, + { SPH_C32(0x7e220000), SPH_C32(0x50af0000), SPH_C32(0x3744003d), + SPH_C32(0x540d3800), SPH_C32(0x080c1e60), SPH_C32(0x155dbfc4), + SPH_C32(0x07b7a245), SPH_C32(0x0ff95000), SPH_C32(0x922f0000), + SPH_C32(0x86b60000), SPH_C32(0xb0360024), SPH_C32(0xc3221800), + SPH_C32(0x97e10af1), SPH_C32(0xe1104013), SPH_C32(0xdd4f1667), + SPH_C32(0x6810f3fc) }, + { SPH_C32(0xec740000), SPH_C32(0x4e750000), SPH_C32(0xdd15003d), + SPH_C32(0xbcbc0800), SPH_C32(0xa13948c5), SPH_C32(0xfea6de5d), + SPH_C32(0xb6eb8011), SPH_C32(0x3c3c744f), SPH_C32(0x1e150000), + SPH_C32(0x5c2e0000), SPH_C32(0xd0490024), SPH_C32(0x97259000), + SPH_C32(0x12904fe2), SPH_C32(0x8116f250), SPH_C32(0x061f2ffb), + SPH_C32(0xe2481558) }, + { SPH_C32(0x3b3b0000), SPH_C32(0xfba30000), SPH_C32(0x07fa003c), + SPH_C32(0x3d071800), SPH_C32(0xcaf06c79), SPH_C32(0xa4893fc9), + SPH_C32(0x2a665803), SPH_C32(0x2bc81f17), SPH_C32(0xca6c0000), + SPH_C32(0x06c80000), SPH_C32(0xc8050025), SPH_C32(0x05492000), + SPH_C32(0x70d6562d), SPH_C32(0x98bd7fce), SPH_C32(0x713ce808), + SPH_C32(0x52548a4d) }, + { SPH_C32(0xa96d0000), SPH_C32(0xe5790000), SPH_C32(0xedab003c), + SPH_C32(0xd5b62800), SPH_C32(0x63c53adc), SPH_C32(0x4f725e50), + SPH_C32(0x9b3a7a57), SPH_C32(0x180d3b58), SPH_C32(0x46560000), + SPH_C32(0xdc500000), SPH_C32(0xa87a0025), SPH_C32(0x514ea800), + SPH_C32(0xf5a7133e), SPH_C32(0xf8bbcd8d), SPH_C32(0xaa6cd194), + SPH_C32(0xd80c6ce9) }, + { SPH_C32(0x63780000), SPH_C32(0x7bdd0000), SPH_C32(0x7fc9003d), + SPH_C32(0xfb6c2000), SPH_C32(0x2dc730a5), SPH_C32(0xdd240014), + SPH_C32(0x8615a66c), SPH_C32(0x118c66a6), SPH_C32(0xd7360000), + SPH_C32(0x2dba0000), SPH_C32(0x80880025), SPH_C32(0xaa283800), + SPH_C32(0x551d78e8), SPH_C32(0x50c4c01e), SPH_C32(0xf09eec21), + SPH_C32(0x4c21bceb) }, + { SPH_C32(0xf12e0000), SPH_C32(0x65070000), SPH_C32(0x9598003d), + SPH_C32(0x13dd1000), SPH_C32(0x84f26600), SPH_C32(0x36df618d), + SPH_C32(0x37498438), SPH_C32(0x224942e9), SPH_C32(0x5b0c0000), + SPH_C32(0xf7220000), SPH_C32(0xe0f70025), SPH_C32(0xfe2fb000), + SPH_C32(0xd06c3dfb), SPH_C32(0x30c2725d), SPH_C32(0x2bced5bd), + SPH_C32(0xc6795a4f) }, + { SPH_C32(0x84b70000), SPH_C32(0x76a70000), SPH_C32(0x86330028), + SPH_C32(0x79c50000), SPH_C32(0x23d76cc7), SPH_C32(0x5ce84480), + SPH_C32(0xa88d56d0), SPH_C32(0xaed3d139), SPH_C32(0x2a4e0000), + SPH_C32(0xb9e20000), SPH_C32(0xb68b003a), SPH_C32(0x10ed0000), + SPH_C32(0x3db429e1), SPH_C32(0x51b655fe), SPH_C32(0xabdc7a96), + SPH_C32(0x7d7e8c1c) }, + { SPH_C32(0x16e10000), SPH_C32(0x687d0000), SPH_C32(0x6c620028), + SPH_C32(0x91743000), SPH_C32(0x8ae23a62), SPH_C32(0xb7132519), + SPH_C32(0x19d17484), SPH_C32(0x9d16f576), SPH_C32(0xa6740000), + SPH_C32(0x637a0000), SPH_C32(0xd6f4003a), SPH_C32(0x44ea8800), + SPH_C32(0xb8c56cf2), SPH_C32(0x31b0e7bd), SPH_C32(0x708c430a), + SPH_C32(0xf7266ab8) }, + { SPH_C32(0xdcf40000), SPH_C32(0xf6d90000), SPH_C32(0xfe000029), + SPH_C32(0xbfae3800), SPH_C32(0xc4e0301b), SPH_C32(0x25457b5d), + SPH_C32(0x04fea8bf), SPH_C32(0x9497a888), SPH_C32(0x37140000), + SPH_C32(0x92900000), SPH_C32(0xfe06003a), SPH_C32(0xbf8c1800), + SPH_C32(0x187f0724), SPH_C32(0x99cfea2e), SPH_C32(0x2a7e7ebf), + SPH_C32(0x630bbaba) }, + { SPH_C32(0x4ea20000), SPH_C32(0xe8030000), SPH_C32(0x14510029), + SPH_C32(0x571f0800), SPH_C32(0x6dd566be), SPH_C32(0xcebe1ac4), + SPH_C32(0xb5a28aeb), SPH_C32(0xa7528cc7), SPH_C32(0xbb2e0000), + SPH_C32(0x48080000), SPH_C32(0x9e79003a), SPH_C32(0xeb8b9000), + SPH_C32(0x9d0e4237), SPH_C32(0xf9c9586d), SPH_C32(0xf12e4723), + SPH_C32(0xe9535c1e) }, + { SPH_C32(0x99ed0000), SPH_C32(0x5dd50000), SPH_C32(0xcebe0028), + SPH_C32(0xd6a41800), SPH_C32(0x061c4202), SPH_C32(0x9491fb50), + SPH_C32(0x292f52f9), SPH_C32(0xb0a6e79f), SPH_C32(0x6f570000), + SPH_C32(0x12ee0000), SPH_C32(0x8635003b), SPH_C32(0x79e72000), + SPH_C32(0xff485bf8), SPH_C32(0xe062d5f3), SPH_C32(0x860d80d0), + SPH_C32(0x594fc30b) }, + { SPH_C32(0x0bbb0000), SPH_C32(0x430f0000), SPH_C32(0x24ef0028), + SPH_C32(0x3e152800), SPH_C32(0xaf2914a7), SPH_C32(0x7f6a9ac9), + SPH_C32(0x987370ad), SPH_C32(0x8363c3d0), SPH_C32(0xe36d0000), + SPH_C32(0xc8760000), SPH_C32(0xe64a003b), SPH_C32(0x2de0a800), + SPH_C32(0x7a391eeb), SPH_C32(0x806467b0), SPH_C32(0x5d5db94c), + SPH_C32(0xd31725af) }, + { SPH_C32(0xc1ae0000), SPH_C32(0xddab0000), SPH_C32(0xb68d0029), + SPH_C32(0x10cf2000), SPH_C32(0xe12b1ede), SPH_C32(0xed3cc48d), + SPH_C32(0x855cac96), SPH_C32(0x8ae29e2e), SPH_C32(0x720d0000), + SPH_C32(0x399c0000), SPH_C32(0xceb8003b), SPH_C32(0xd6863800), + SPH_C32(0xda83753d), SPH_C32(0x281b6a23), SPH_C32(0x07af84f9), + SPH_C32(0x473af5ad) }, + { SPH_C32(0x53f80000), SPH_C32(0xc3710000), SPH_C32(0x5cdc0029), + SPH_C32(0xf87e1000), SPH_C32(0x481e487b), SPH_C32(0x06c7a514), + SPH_C32(0x34008ec2), SPH_C32(0xb927ba61), SPH_C32(0xfe370000), + SPH_C32(0xe3040000), SPH_C32(0xaec7003b), SPH_C32(0x8281b000), + SPH_C32(0x5ff2302e), SPH_C32(0x481dd860), SPH_C32(0xdcffbd65), + SPH_C32(0xcd621309) }, + { SPH_C32(0x218c0000), SPH_C32(0x62810000), SPH_C32(0xc8030036), + SPH_C32(0x056b0000), SPH_C32(0xac496112), SPH_C32(0x2437eebd), + SPH_C32(0x5fbc3e08), SPH_C32(0xa5c8987f), SPH_C32(0x2da30000), + SPH_C32(0x0bb20000), SPH_C32(0x31ff0030), SPH_C32(0x87e00000), + SPH_C32(0x7ec60a4f), SPH_C32(0x19713b5a), SPH_C32(0x5fa418b4), + SPH_C32(0xed0b3dd2) }, + { SPH_C32(0xb3da0000), SPH_C32(0x7c5b0000), SPH_C32(0x22520036), + SPH_C32(0xedda3000), SPH_C32(0x057c37b7), SPH_C32(0xcfcc8f24), + SPH_C32(0xeee01c5c), SPH_C32(0x960dbc30), SPH_C32(0xa1990000), + SPH_C32(0xd12a0000), SPH_C32(0x51800030), SPH_C32(0xd3e78800), + SPH_C32(0xfbb74f5c), SPH_C32(0x79778919), SPH_C32(0x84f42128), + SPH_C32(0x6753db76) }, + { SPH_C32(0x79cf0000), SPH_C32(0xe2ff0000), SPH_C32(0xb0300037), + SPH_C32(0xc3003800), SPH_C32(0x4b7e3dce), SPH_C32(0x5d9ad160), + SPH_C32(0xf3cfc067), SPH_C32(0x9f8ce1ce), SPH_C32(0x30f90000), + SPH_C32(0x20c00000), SPH_C32(0x79720030), SPH_C32(0x28811800), + SPH_C32(0x5b0d248a), SPH_C32(0xd108848a), SPH_C32(0xde061c9d), + SPH_C32(0xf37e0b74) }, + { SPH_C32(0xeb990000), SPH_C32(0xfc250000), SPH_C32(0x5a610037), + SPH_C32(0x2bb10800), SPH_C32(0xe24b6b6b), SPH_C32(0xb661b0f9), + SPH_C32(0x4293e233), SPH_C32(0xac49c581), SPH_C32(0xbcc30000), + SPH_C32(0xfa580000), SPH_C32(0x190d0030), SPH_C32(0x7c869000), + SPH_C32(0xde7c6199), SPH_C32(0xb10e36c9), SPH_C32(0x05562501), + SPH_C32(0x7926edd0) }, + { SPH_C32(0x3cd60000), SPH_C32(0x49f30000), SPH_C32(0x808e0036), + SPH_C32(0xaa0a1800), SPH_C32(0x89824fd7), SPH_C32(0xec4e516d), + SPH_C32(0xde1e3a21), SPH_C32(0xbbbdaed9), SPH_C32(0x68ba0000), + SPH_C32(0xa0be0000), SPH_C32(0x01410031), SPH_C32(0xeeea2000), + SPH_C32(0xbc3a7856), SPH_C32(0xa8a5bb57), SPH_C32(0x7275e2f2), + SPH_C32(0xc93a72c5) }, + { SPH_C32(0xae800000), SPH_C32(0x57290000), SPH_C32(0x6adf0036), + SPH_C32(0x42bb2800), SPH_C32(0x20b71972), SPH_C32(0x07b530f4), + SPH_C32(0x6f421875), SPH_C32(0x88788a96), SPH_C32(0xe4800000), + SPH_C32(0x7a260000), SPH_C32(0x613e0031), SPH_C32(0xbaeda800), + SPH_C32(0x394b3d45), SPH_C32(0xc8a30914), SPH_C32(0xa925db6e), + SPH_C32(0x43629461) }, + { SPH_C32(0x64950000), SPH_C32(0xc98d0000), SPH_C32(0xf8bd0037), + SPH_C32(0x6c612000), SPH_C32(0x6eb5130b), SPH_C32(0x95e36eb0), + SPH_C32(0x726dc44e), SPH_C32(0x81f9d768), SPH_C32(0x75e00000), + SPH_C32(0x8bcc0000), SPH_C32(0x49cc0031), SPH_C32(0x418b3800), + SPH_C32(0x99f15693), SPH_C32(0x60dc0487), SPH_C32(0xf3d7e6db), + SPH_C32(0xd74f4463) }, + { SPH_C32(0xf6c30000), SPH_C32(0xd7570000), SPH_C32(0x12ec0037), + SPH_C32(0x84d01000), SPH_C32(0xc78045ae), SPH_C32(0x7e180f29), + SPH_C32(0xc331e61a), SPH_C32(0xb23cf327), SPH_C32(0xf9da0000), + SPH_C32(0x51540000), SPH_C32(0x29b30031), SPH_C32(0x158cb000), + SPH_C32(0x1c801380), SPH_C32(0x00dab6c4), SPH_C32(0x2887df47), + SPH_C32(0x5d17a2c7) } +}; + +static const sph_u32 T512_49[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xe6280000), SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), + SPH_C32(0xd3d002e0), SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), + SPH_C32(0x289506b4), SPH_C32(0xd75a4897), SPH_C32(0xf0c50000), + SPH_C32(0x59230000), SPH_C32(0x45820000), SPH_C32(0xe18d00c0), + SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), SPH_C32(0xcbe0fe1c), + SPH_C32(0x56a7b19f) }, + { SPH_C32(0xf0c50000), SPH_C32(0x59230000), SPH_C32(0x45820000), + SPH_C32(0xe18d00c0), SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), + SPH_C32(0xcbe0fe1c), SPH_C32(0x56a7b19f), SPH_C32(0x16ed0000), + SPH_C32(0x15680000), SPH_C32(0xedd70000), SPH_C32(0x325d0220), + SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), SPH_C32(0xe375f8a8), + SPH_C32(0x81fdf908) }, + { SPH_C32(0x16ed0000), SPH_C32(0x15680000), SPH_C32(0xedd70000), + SPH_C32(0x325d0220), SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), + SPH_C32(0xe375f8a8), SPH_C32(0x81fdf908), SPH_C32(0xe6280000), + SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), SPH_C32(0xd3d002e0), + SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), SPH_C32(0x289506b4), + SPH_C32(0xd75a4897) }, + { SPH_C32(0xb4310000), SPH_C32(0x77330000), SPH_C32(0xb15d0000), + SPH_C32(0x7fd004e0), SPH_C32(0x78a26138), SPH_C32(0xd116c35d), + SPH_C32(0xd256d489), SPH_C32(0x4e6f74de), SPH_C32(0xe3060000), + SPH_C32(0xbdc10000), SPH_C32(0x87130000), SPH_C32(0xbff20060), + SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), SPH_C32(0x73c5ab06), + SPH_C32(0x5bd61539) }, + { SPH_C32(0x52190000), SPH_C32(0x3b780000), SPH_C32(0x19080000), + SPH_C32(0xac000600), SPH_C32(0xa0c35180), SPH_C32(0x49b17387), + SPH_C32(0xfac3d23d), SPH_C32(0x99353c49), SPH_C32(0x13c30000), + SPH_C32(0xe4e20000), SPH_C32(0xc2910000), SPH_C32(0x5e7f00a0), + SPH_C32(0x15d70c2b), SPH_C32(0x4f5861c8), SPH_C32(0xb825551a), + SPH_C32(0x0d71a4a6) }, + { SPH_C32(0x44f40000), SPH_C32(0x2e100000), SPH_C32(0xf4df0000), + SPH_C32(0x9e5d0420), SPH_C32(0x43cf6709), SPH_C32(0x13fb95c4), + SPH_C32(0x19b62a95), SPH_C32(0x18c8c541), SPH_C32(0xf5eb0000), + SPH_C32(0xa8a90000), SPH_C32(0x6ac40000), SPH_C32(0x8daf0240), + SPH_C32(0xcdb63c93), SPH_C32(0xd7ffd112), SPH_C32(0x90b053ae), + SPH_C32(0xda2bec31) }, + { SPH_C32(0xa2dc0000), SPH_C32(0x625b0000), SPH_C32(0x5c8a0000), + SPH_C32(0x4d8d06c0), SPH_C32(0x9bae57b1), SPH_C32(0x8b5c251e), + SPH_C32(0x31232c21), SPH_C32(0xcf928dd6), SPH_C32(0x052e0000), + SPH_C32(0xf18a0000), SPH_C32(0x2f460000), SPH_C32(0x6c220280), + SPH_C32(0xf6db3aa2), SPH_C32(0x1512878b), SPH_C32(0x5b50adb2), + SPH_C32(0x8c8c5dae) }, + { SPH_C32(0xe3060000), SPH_C32(0xbdc10000), SPH_C32(0x87130000), + SPH_C32(0xbff20060), SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), + SPH_C32(0x73c5ab06), SPH_C32(0x5bd61539), SPH_C32(0x57370000), + SPH_C32(0xcaf20000), SPH_C32(0x364e0000), SPH_C32(0xc0220480), + SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), SPH_C32(0xa1937f8f), + SPH_C32(0x15b961e7) }, + { SPH_C32(0x052e0000), SPH_C32(0xf18a0000), SPH_C32(0x2f460000), + SPH_C32(0x6c220280), SPH_C32(0xf6db3aa2), SPH_C32(0x1512878b), + SPH_C32(0x5b50adb2), SPH_C32(0x8c8c5dae), SPH_C32(0xa7f20000), + SPH_C32(0x93d10000), SPH_C32(0x73cc0000), SPH_C32(0x21af0440), + SPH_C32(0x6d756d13), SPH_C32(0x9e4ea295), SPH_C32(0x6a738193), + SPH_C32(0x431ed078) }, + { SPH_C32(0x13c30000), SPH_C32(0xe4e20000), SPH_C32(0xc2910000), + SPH_C32(0x5e7f00a0), SPH_C32(0x15d70c2b), SPH_C32(0x4f5861c8), + SPH_C32(0xb825551a), SPH_C32(0x0d71a4a6), SPH_C32(0x41da0000), + SPH_C32(0xdf9a0000), SPH_C32(0xdb990000), SPH_C32(0xf27f06a0), + SPH_C32(0xb5145dab), SPH_C32(0x06e9124f), SPH_C32(0x42e68727), + SPH_C32(0x944498ef) }, + { SPH_C32(0xf5eb0000), SPH_C32(0xa8a90000), SPH_C32(0x6ac40000), + SPH_C32(0x8daf0240), SPH_C32(0xcdb63c93), SPH_C32(0xd7ffd112), + SPH_C32(0x90b053ae), SPH_C32(0xda2bec31), SPH_C32(0xb11f0000), + SPH_C32(0x86b90000), SPH_C32(0x9e1b0000), SPH_C32(0x13f20660), + SPH_C32(0x8e795b9a), SPH_C32(0xc40444d6), SPH_C32(0x8906793b), + SPH_C32(0xc2e32970) }, + { SPH_C32(0x57370000), SPH_C32(0xcaf20000), SPH_C32(0x364e0000), + SPH_C32(0xc0220480), SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), + SPH_C32(0xa1937f8f), SPH_C32(0x15b961e7), SPH_C32(0xb4310000), + SPH_C32(0x77330000), SPH_C32(0xb15d0000), SPH_C32(0x7fd004e0), + SPH_C32(0x78a26138), SPH_C32(0xd116c35d), SPH_C32(0xd256d489), + SPH_C32(0x4e6f74de) }, + { SPH_C32(0xb11f0000), SPH_C32(0x86b90000), SPH_C32(0x9e1b0000), + SPH_C32(0x13f20660), SPH_C32(0x8e795b9a), SPH_C32(0xc40444d6), + SPH_C32(0x8906793b), SPH_C32(0xc2e32970), SPH_C32(0x44f40000), + SPH_C32(0x2e100000), SPH_C32(0xf4df0000), SPH_C32(0x9e5d0420), + SPH_C32(0x43cf6709), SPH_C32(0x13fb95c4), SPH_C32(0x19b62a95), + SPH_C32(0x18c8c541) }, + { SPH_C32(0xa7f20000), SPH_C32(0x93d10000), SPH_C32(0x73cc0000), + SPH_C32(0x21af0440), SPH_C32(0x6d756d13), SPH_C32(0x9e4ea295), + SPH_C32(0x6a738193), SPH_C32(0x431ed078), SPH_C32(0xa2dc0000), + SPH_C32(0x625b0000), SPH_C32(0x5c8a0000), SPH_C32(0x4d8d06c0), + SPH_C32(0x9bae57b1), SPH_C32(0x8b5c251e), SPH_C32(0x31232c21), + SPH_C32(0xcf928dd6) }, + { SPH_C32(0x41da0000), SPH_C32(0xdf9a0000), SPH_C32(0xdb990000), + SPH_C32(0xf27f06a0), SPH_C32(0xb5145dab), SPH_C32(0x06e9124f), + SPH_C32(0x42e68727), SPH_C32(0x944498ef), SPH_C32(0x52190000), + SPH_C32(0x3b780000), SPH_C32(0x19080000), SPH_C32(0xac000600), + SPH_C32(0xa0c35180), SPH_C32(0x49b17387), SPH_C32(0xfac3d23d), + SPH_C32(0x99353c49) }, + { SPH_C32(0x02f20000), SPH_C32(0xa2810000), SPH_C32(0x873f0000), + SPH_C32(0xe36c7800), SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), + SPH_C32(0xc4c23237), SPH_C32(0x7f32259e), SPH_C32(0xbadd0000), + SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), SPH_C32(0xf7282800), + SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), SPH_C32(0xea5a8d14), + SPH_C32(0x2a2c18f0) }, + { SPH_C32(0xe4da0000), SPH_C32(0xeeca0000), SPH_C32(0x2f6a0000), + SPH_C32(0x30bc7ae0), SPH_C32(0xc67c4457), SPH_C32(0x9f9a9b0c), + SPH_C32(0xec573483), SPH_C32(0xa8686d09), SPH_C32(0x4a180000), + SPH_C32(0x4a8e0000), SPH_C32(0xf2650000), SPH_C32(0x16a528c0), + SPH_C32(0xe428127c), SPH_C32(0xf4f795a3), SPH_C32(0x21ba7308), + SPH_C32(0x7c8ba96f) }, + { SPH_C32(0xf2370000), SPH_C32(0xfba20000), SPH_C32(0xc2bd0000), + SPH_C32(0x02e178c0), SPH_C32(0x257072de), SPH_C32(0xc5d07d4f), + SPH_C32(0x0f22cc2b), SPH_C32(0x29959401), SPH_C32(0xac300000), + SPH_C32(0x06c50000), SPH_C32(0x5a300000), SPH_C32(0xc5752a20), + SPH_C32(0x3c4922c4), SPH_C32(0x6c502579), SPH_C32(0x092f75bc), + SPH_C32(0xabd1e1f8) }, + { SPH_C32(0x141f0000), SPH_C32(0xb7e90000), SPH_C32(0x6ae80000), + SPH_C32(0xd1317a20), SPH_C32(0xfd114266), SPH_C32(0x5d77cd95), + SPH_C32(0x27b7ca9f), SPH_C32(0xfecfdc96), SPH_C32(0x5cf50000), + SPH_C32(0x5fe60000), SPH_C32(0x1fb20000), SPH_C32(0x24f82ae0), + SPH_C32(0x072424f5), SPH_C32(0xaebd73e0), SPH_C32(0xc2cf8ba0), + SPH_C32(0xfd765067) }, + { SPH_C32(0xb6c30000), SPH_C32(0xd5b20000), SPH_C32(0x36620000), + SPH_C32(0x9cbc7ce0), SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), + SPH_C32(0x1694e6be), SPH_C32(0x315d5140), SPH_C32(0x59db0000), + SPH_C32(0xae6c0000), SPH_C32(0x30f40000), SPH_C32(0x48da2860), + SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), SPH_C32(0x999f2612), + SPH_C32(0x71fa0dc9) }, + { SPH_C32(0x50eb0000), SPH_C32(0x99f90000), SPH_C32(0x9e370000), + SPH_C32(0x4f6c7e00), SPH_C32(0xbede256f), SPH_C32(0x4e8c5851), + SPH_C32(0x3e01e00a), SPH_C32(0xe60719d7), SPH_C32(0xa91e0000), + SPH_C32(0xf74f0000), SPH_C32(0x75760000), SPH_C32(0xa95728a0), + SPH_C32(0xca921866), SPH_C32(0x7942a2f2), SPH_C32(0x527fd80e), + SPH_C32(0x275dbc56) }, + { SPH_C32(0x46060000), SPH_C32(0x8c910000), SPH_C32(0x73e00000), + SPH_C32(0x7d317c20), SPH_C32(0x5dd213e6), SPH_C32(0x14c6be12), + SPH_C32(0xdd7418a2), SPH_C32(0x67fae0df), SPH_C32(0x4f360000), + SPH_C32(0xbb040000), SPH_C32(0xdd230000), SPH_C32(0x7a872a40), + SPH_C32(0x12f328de), SPH_C32(0xe1e51228), SPH_C32(0x7aeadeba), + SPH_C32(0xf007f4c1) }, + { SPH_C32(0xa02e0000), SPH_C32(0xc0da0000), SPH_C32(0xdbb50000), + SPH_C32(0xaee17ec0), SPH_C32(0x85b3235e), SPH_C32(0x8c610ec8), + SPH_C32(0xf5e11e16), SPH_C32(0xb0a0a848), SPH_C32(0xbff30000), + SPH_C32(0xe2270000), SPH_C32(0x98a10000), SPH_C32(0x9b0a2a80), + SPH_C32(0x299e2eef), SPH_C32(0x230844b1), SPH_C32(0xb10a20a6), + SPH_C32(0xa6a0455e) }, + { SPH_C32(0xe1f40000), SPH_C32(0x1f400000), SPH_C32(0x002c0000), + SPH_C32(0x5c9e7860), SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), + SPH_C32(0xb7079931), SPH_C32(0x24e430a7), SPH_C32(0xedea0000), + SPH_C32(0xd95f0000), SPH_C32(0x81a90000), SPH_C32(0x370a2c80), + SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), SPH_C32(0x4bc9f29b), + SPH_C32(0x3f957917) }, + { SPH_C32(0x07dc0000), SPH_C32(0x530b0000), SPH_C32(0xa8790000), + SPH_C32(0x8f4e7a80), SPH_C32(0xe8c64e4d), SPH_C32(0x122fac5d), + SPH_C32(0x9f929f85), SPH_C32(0xf3be7830), SPH_C32(0x1d2f0000), + SPH_C32(0x807c0000), SPH_C32(0xc42b0000), SPH_C32(0xd6872c40), + SPH_C32(0xb230795e), SPH_C32(0xa85461af), SPH_C32(0x80290c87), + SPH_C32(0x6932c888) }, + { SPH_C32(0x11310000), SPH_C32(0x46630000), SPH_C32(0x45ae0000), + SPH_C32(0xbd1378a0), SPH_C32(0x0bca78c4), SPH_C32(0x48654a1e), + SPH_C32(0x7ce7672d), SPH_C32(0x72438138), SPH_C32(0xfb070000), + SPH_C32(0xcc370000), SPH_C32(0x6c7e0000), SPH_C32(0x05572ea0), + SPH_C32(0x6a5149e6), SPH_C32(0x30f3d175), SPH_C32(0xa8bc0a33), + SPH_C32(0xbe68801f) }, + { SPH_C32(0xf7190000), SPH_C32(0x0a280000), SPH_C32(0xedfb0000), + SPH_C32(0x6ec37a40), SPH_C32(0xd3ab487c), SPH_C32(0xd0c2fac4), + SPH_C32(0x54726199), SPH_C32(0xa519c9af), SPH_C32(0x0bc20000), + SPH_C32(0x95140000), SPH_C32(0x29fc0000), SPH_C32(0xe4da2e60), + SPH_C32(0x513c4fd7), SPH_C32(0xf21e87ec), SPH_C32(0x635cf42f), + SPH_C32(0xe8cf3180) }, + { SPH_C32(0x55c50000), SPH_C32(0x68730000), SPH_C32(0xb1710000), + SPH_C32(0x234e7c80), SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), + SPH_C32(0x65514db8), SPH_C32(0x6a8b4479), SPH_C32(0x0eec0000), + SPH_C32(0x649e0000), SPH_C32(0x06ba0000), SPH_C32(0x88f82ce0), + SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), SPH_C32(0x380c599d), + SPH_C32(0x64436c2e) }, + { SPH_C32(0xb3ed0000), SPH_C32(0x24380000), SPH_C32(0x19240000), + SPH_C32(0xf09e7e60), SPH_C32(0x90642f75), SPH_C32(0xc3396f00), + SPH_C32(0x4dc44b0c), SPH_C32(0xbdd10cee), SPH_C32(0xfe290000), + SPH_C32(0x3dbd0000), SPH_C32(0x43380000), SPH_C32(0x69752c20), + SPH_C32(0x9c8a7344), SPH_C32(0x25e156fe), SPH_C32(0xf3eca781), + SPH_C32(0x32e4ddb1) }, + { SPH_C32(0xa5000000), SPH_C32(0x31500000), SPH_C32(0xf4f30000), + SPH_C32(0xc2c37c40), SPH_C32(0x736819fc), SPH_C32(0x99738943), + SPH_C32(0xaeb1b3a4), SPH_C32(0x3c2cf5e6), SPH_C32(0x18010000), + SPH_C32(0x71f60000), SPH_C32(0xeb6d0000), SPH_C32(0xbaa52ec0), + SPH_C32(0x44eb43fc), SPH_C32(0xbd46e624), SPH_C32(0xdb79a135), + SPH_C32(0xe5be9526) }, + { SPH_C32(0x43280000), SPH_C32(0x7d1b0000), SPH_C32(0x5ca60000), + SPH_C32(0x11137ea0), SPH_C32(0xab092944), SPH_C32(0x01d43999), + SPH_C32(0x8624b510), SPH_C32(0xeb76bd71), SPH_C32(0xe8c40000), + SPH_C32(0x28d50000), SPH_C32(0xaeef0000), SPH_C32(0x5b282e00), + SPH_C32(0x7f8645cd), SPH_C32(0x7fabb0bd), SPH_C32(0x10995f29), + SPH_C32(0xb31924b9) }, + { SPH_C32(0xbadd0000), SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), + SPH_C32(0xf7282800), SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), + SPH_C32(0xea5a8d14), SPH_C32(0x2a2c18f0), SPH_C32(0xb82f0000), + SPH_C32(0xb12c0000), SPH_C32(0x30d80000), SPH_C32(0x14445000), + SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), SPH_C32(0x2e98bf23), + SPH_C32(0x551e3d6e) }, + { SPH_C32(0x5cf50000), SPH_C32(0x5fe60000), SPH_C32(0x1fb20000), + SPH_C32(0x24f82ae0), SPH_C32(0x072424f5), SPH_C32(0xaebd73e0), + SPH_C32(0xc2cf8ba0), SPH_C32(0xfd765067), SPH_C32(0x48ea0000), + SPH_C32(0xe80f0000), SPH_C32(0x755a0000), SPH_C32(0xf5c950c0), + SPH_C32(0xfa356693), SPH_C32(0xf3cabe75), SPH_C32(0xe578413f), + SPH_C32(0x03b98cf1) }, + { SPH_C32(0x4a180000), SPH_C32(0x4a8e0000), SPH_C32(0xf2650000), + SPH_C32(0x16a528c0), SPH_C32(0xe428127c), SPH_C32(0xf4f795a3), + SPH_C32(0x21ba7308), SPH_C32(0x7c8ba96f), SPH_C32(0xaec20000), + SPH_C32(0xa4440000), SPH_C32(0xdd0f0000), SPH_C32(0x26195220), + SPH_C32(0x2254562b), SPH_C32(0x6b6d0eaf), SPH_C32(0xcded478b), + SPH_C32(0xd4e3c466) }, + { SPH_C32(0xac300000), SPH_C32(0x06c50000), SPH_C32(0x5a300000), + SPH_C32(0xc5752a20), SPH_C32(0x3c4922c4), SPH_C32(0x6c502579), + SPH_C32(0x092f75bc), SPH_C32(0xabd1e1f8), SPH_C32(0x5e070000), + SPH_C32(0xfd670000), SPH_C32(0x988d0000), SPH_C32(0xc79452e0), + SPH_C32(0x1939501a), SPH_C32(0xa9805836), SPH_C32(0x060db997), + SPH_C32(0x824475f9) }, + { SPH_C32(0x0eec0000), SPH_C32(0x649e0000), SPH_C32(0x06ba0000), + SPH_C32(0x88f82ce0), SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), + SPH_C32(0x380c599d), SPH_C32(0x64436c2e), SPH_C32(0x5b290000), + SPH_C32(0x0ced0000), SPH_C32(0xb7cb0000), SPH_C32(0xabb65060), + SPH_C32(0xefe26ab8), SPH_C32(0xbc92dfbd), SPH_C32(0x5d5d1425), + SPH_C32(0x0ec82857) }, + { SPH_C32(0xe8c40000), SPH_C32(0x28d50000), SPH_C32(0xaeef0000), + SPH_C32(0x5b282e00), SPH_C32(0x7f8645cd), SPH_C32(0x7fabb0bd), + SPH_C32(0x10995f29), SPH_C32(0xb31924b9), SPH_C32(0xabec0000), + SPH_C32(0x55ce0000), SPH_C32(0xf2490000), SPH_C32(0x4a3b50a0), + SPH_C32(0xd48f6c89), SPH_C32(0x7e7f8924), SPH_C32(0x96bdea39), + SPH_C32(0x586f99c8) }, + { SPH_C32(0xfe290000), SPH_C32(0x3dbd0000), SPH_C32(0x43380000), + SPH_C32(0x69752c20), SPH_C32(0x9c8a7344), SPH_C32(0x25e156fe), + SPH_C32(0xf3eca781), SPH_C32(0x32e4ddb1), SPH_C32(0x4dc40000), + SPH_C32(0x19850000), SPH_C32(0x5a1c0000), SPH_C32(0x99eb5240), + SPH_C32(0x0cee5c31), SPH_C32(0xe6d839fe), SPH_C32(0xbe28ec8d), + SPH_C32(0x8f35d15f) }, + { SPH_C32(0x18010000), SPH_C32(0x71f60000), SPH_C32(0xeb6d0000), + SPH_C32(0xbaa52ec0), SPH_C32(0x44eb43fc), SPH_C32(0xbd46e624), + SPH_C32(0xdb79a135), SPH_C32(0xe5be9526), SPH_C32(0xbd010000), + SPH_C32(0x40a60000), SPH_C32(0x1f9e0000), SPH_C32(0x78665280), + SPH_C32(0x37835a00), SPH_C32(0x24356f67), SPH_C32(0x75c81291), + SPH_C32(0xd99260c0) }, + { SPH_C32(0x59db0000), SPH_C32(0xae6c0000), SPH_C32(0x30f40000), + SPH_C32(0x48da2860), SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), + SPH_C32(0x999f2612), SPH_C32(0x71fa0dc9), SPH_C32(0xef180000), + SPH_C32(0x7bde0000), SPH_C32(0x06960000), SPH_C32(0xd4665480), + SPH_C32(0x97400b80), SPH_C32(0x6d841ce0), SPH_C32(0x8f0bc0ac), + SPH_C32(0x40a75c89) }, + { SPH_C32(0xbff30000), SPH_C32(0xe2270000), SPH_C32(0x98a10000), + SPH_C32(0x9b0a2a80), SPH_C32(0x299e2eef), SPH_C32(0x230844b1), + SPH_C32(0xb10a20a6), SPH_C32(0xa6a0455e), SPH_C32(0x1fdd0000), + SPH_C32(0x22fd0000), SPH_C32(0x43140000), SPH_C32(0x35eb5440), + SPH_C32(0xac2d0db1), SPH_C32(0xaf694a79), SPH_C32(0x44eb3eb0), + SPH_C32(0x1600ed16) }, + { SPH_C32(0xa91e0000), SPH_C32(0xf74f0000), SPH_C32(0x75760000), + SPH_C32(0xa95728a0), SPH_C32(0xca921866), SPH_C32(0x7942a2f2), + SPH_C32(0x527fd80e), SPH_C32(0x275dbc56), SPH_C32(0xf9f50000), + SPH_C32(0x6eb60000), SPH_C32(0xeb410000), SPH_C32(0xe63b56a0), + SPH_C32(0x744c3d09), SPH_C32(0x37cefaa3), SPH_C32(0x6c7e3804), + SPH_C32(0xc15aa581) }, + { SPH_C32(0x4f360000), SPH_C32(0xbb040000), SPH_C32(0xdd230000), + SPH_C32(0x7a872a40), SPH_C32(0x12f328de), SPH_C32(0xe1e51228), + SPH_C32(0x7aeadeba), SPH_C32(0xf007f4c1), SPH_C32(0x09300000), + SPH_C32(0x37950000), SPH_C32(0xaec30000), SPH_C32(0x07b65660), + SPH_C32(0x4f213b38), SPH_C32(0xf523ac3a), SPH_C32(0xa79ec618), + SPH_C32(0x97fd141e) }, + { SPH_C32(0xedea0000), SPH_C32(0xd95f0000), SPH_C32(0x81a90000), + SPH_C32(0x370a2c80), SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), + SPH_C32(0x4bc9f29b), SPH_C32(0x3f957917), SPH_C32(0x0c1e0000), + SPH_C32(0xc61f0000), SPH_C32(0x81850000), SPH_C32(0x6b9454e0), + SPH_C32(0xb9fa019a), SPH_C32(0xe0312bb1), SPH_C32(0xfcce6baa), + SPH_C32(0x1b7149b0) }, + { SPH_C32(0x0bc20000), SPH_C32(0x95140000), SPH_C32(0x29fc0000), + SPH_C32(0xe4da2e60), SPH_C32(0x513c4fd7), SPH_C32(0xf21e87ec), + SPH_C32(0x635cf42f), SPH_C32(0xe8cf3180), SPH_C32(0xfcdb0000), + SPH_C32(0x9f3c0000), SPH_C32(0xc4070000), SPH_C32(0x8a195420), + SPH_C32(0x829707ab), SPH_C32(0x22dc7d28), SPH_C32(0x372e95b6), + SPH_C32(0x4dd6f82f) }, + { SPH_C32(0x1d2f0000), SPH_C32(0x807c0000), SPH_C32(0xc42b0000), + SPH_C32(0xd6872c40), SPH_C32(0xb230795e), SPH_C32(0xa85461af), + SPH_C32(0x80290c87), SPH_C32(0x6932c888), SPH_C32(0x1af30000), + SPH_C32(0xd3770000), SPH_C32(0x6c520000), SPH_C32(0x59c956c0), + SPH_C32(0x5af63713), SPH_C32(0xba7bcdf2), SPH_C32(0x1fbb9302), + SPH_C32(0x9a8cb0b8) }, + { SPH_C32(0xfb070000), SPH_C32(0xcc370000), SPH_C32(0x6c7e0000), + SPH_C32(0x05572ea0), SPH_C32(0x6a5149e6), SPH_C32(0x30f3d175), + SPH_C32(0xa8bc0a33), SPH_C32(0xbe68801f), SPH_C32(0xea360000), + SPH_C32(0x8a540000), SPH_C32(0x29d00000), SPH_C32(0xb8445600), + SPH_C32(0x619b3122), SPH_C32(0x78969b6b), SPH_C32(0xd45b6d1e), + SPH_C32(0xcc2b0127) }, + { SPH_C32(0xb82f0000), SPH_C32(0xb12c0000), SPH_C32(0x30d80000), + SPH_C32(0x14445000), SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), + SPH_C32(0x2e98bf23), SPH_C32(0x551e3d6e), SPH_C32(0x02f20000), + SPH_C32(0xa2810000), SPH_C32(0x873f0000), SPH_C32(0xe36c7800), + SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), SPH_C32(0xc4c23237), + SPH_C32(0x7f32259e) }, + { SPH_C32(0x5e070000), SPH_C32(0xfd670000), SPH_C32(0x988d0000), + SPH_C32(0xc79452e0), SPH_C32(0x1939501a), SPH_C32(0xa9805836), + SPH_C32(0x060db997), SPH_C32(0x824475f9), SPH_C32(0xf2370000), + SPH_C32(0xfba20000), SPH_C32(0xc2bd0000), SPH_C32(0x02e178c0), + SPH_C32(0x257072de), SPH_C32(0xc5d07d4f), SPH_C32(0x0f22cc2b), + SPH_C32(0x29959401) }, + { SPH_C32(0x48ea0000), SPH_C32(0xe80f0000), SPH_C32(0x755a0000), + SPH_C32(0xf5c950c0), SPH_C32(0xfa356693), SPH_C32(0xf3cabe75), + SPH_C32(0xe578413f), SPH_C32(0x03b98cf1), SPH_C32(0x141f0000), + SPH_C32(0xb7e90000), SPH_C32(0x6ae80000), SPH_C32(0xd1317a20), + SPH_C32(0xfd114266), SPH_C32(0x5d77cd95), SPH_C32(0x27b7ca9f), + SPH_C32(0xfecfdc96) }, + { SPH_C32(0xaec20000), SPH_C32(0xa4440000), SPH_C32(0xdd0f0000), + SPH_C32(0x26195220), SPH_C32(0x2254562b), SPH_C32(0x6b6d0eaf), + SPH_C32(0xcded478b), SPH_C32(0xd4e3c466), SPH_C32(0xe4da0000), + SPH_C32(0xeeca0000), SPH_C32(0x2f6a0000), SPH_C32(0x30bc7ae0), + SPH_C32(0xc67c4457), SPH_C32(0x9f9a9b0c), SPH_C32(0xec573483), + SPH_C32(0xa8686d09) }, + { SPH_C32(0x0c1e0000), SPH_C32(0xc61f0000), SPH_C32(0x81850000), + SPH_C32(0x6b9454e0), SPH_C32(0xb9fa019a), SPH_C32(0xe0312bb1), + SPH_C32(0xfcce6baa), SPH_C32(0x1b7149b0), SPH_C32(0xe1f40000), + SPH_C32(0x1f400000), SPH_C32(0x002c0000), SPH_C32(0x5c9e7860), + SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), SPH_C32(0xb7079931), + SPH_C32(0x24e430a7) }, + { SPH_C32(0xea360000), SPH_C32(0x8a540000), SPH_C32(0x29d00000), + SPH_C32(0xb8445600), SPH_C32(0x619b3122), SPH_C32(0x78969b6b), + SPH_C32(0xd45b6d1e), SPH_C32(0xcc2b0127), SPH_C32(0x11310000), + SPH_C32(0x46630000), SPH_C32(0x45ae0000), SPH_C32(0xbd1378a0), + SPH_C32(0x0bca78c4), SPH_C32(0x48654a1e), SPH_C32(0x7ce7672d), + SPH_C32(0x72438138) }, + { SPH_C32(0xfcdb0000), SPH_C32(0x9f3c0000), SPH_C32(0xc4070000), + SPH_C32(0x8a195420), SPH_C32(0x829707ab), SPH_C32(0x22dc7d28), + SPH_C32(0x372e95b6), SPH_C32(0x4dd6f82f), SPH_C32(0xf7190000), + SPH_C32(0x0a280000), SPH_C32(0xedfb0000), SPH_C32(0x6ec37a40), + SPH_C32(0xd3ab487c), SPH_C32(0xd0c2fac4), SPH_C32(0x54726199), + SPH_C32(0xa519c9af) }, + { SPH_C32(0x1af30000), SPH_C32(0xd3770000), SPH_C32(0x6c520000), + SPH_C32(0x59c956c0), SPH_C32(0x5af63713), SPH_C32(0xba7bcdf2), + SPH_C32(0x1fbb9302), SPH_C32(0x9a8cb0b8), SPH_C32(0x07dc0000), + SPH_C32(0x530b0000), SPH_C32(0xa8790000), SPH_C32(0x8f4e7a80), + SPH_C32(0xe8c64e4d), SPH_C32(0x122fac5d), SPH_C32(0x9f929f85), + SPH_C32(0xf3be7830) }, + { SPH_C32(0x5b290000), SPH_C32(0x0ced0000), SPH_C32(0xb7cb0000), + SPH_C32(0xabb65060), SPH_C32(0xefe26ab8), SPH_C32(0xbc92dfbd), + SPH_C32(0x5d5d1425), SPH_C32(0x0ec82857), SPH_C32(0x55c50000), + SPH_C32(0x68730000), SPH_C32(0xb1710000), SPH_C32(0x234e7c80), + SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), SPH_C32(0x65514db8), + SPH_C32(0x6a8b4479) }, + { SPH_C32(0xbd010000), SPH_C32(0x40a60000), SPH_C32(0x1f9e0000), + SPH_C32(0x78665280), SPH_C32(0x37835a00), SPH_C32(0x24356f67), + SPH_C32(0x75c81291), SPH_C32(0xd99260c0), SPH_C32(0xa5000000), + SPH_C32(0x31500000), SPH_C32(0xf4f30000), SPH_C32(0xc2c37c40), + SPH_C32(0x736819fc), SPH_C32(0x99738943), SPH_C32(0xaeb1b3a4), + SPH_C32(0x3c2cf5e6) }, + { SPH_C32(0xabec0000), SPH_C32(0x55ce0000), SPH_C32(0xf2490000), + SPH_C32(0x4a3b50a0), SPH_C32(0xd48f6c89), SPH_C32(0x7e7f8924), + SPH_C32(0x96bdea39), SPH_C32(0x586f99c8), SPH_C32(0x43280000), + SPH_C32(0x7d1b0000), SPH_C32(0x5ca60000), SPH_C32(0x11137ea0), + SPH_C32(0xab092944), SPH_C32(0x01d43999), SPH_C32(0x8624b510), + SPH_C32(0xeb76bd71) }, + { SPH_C32(0x4dc40000), SPH_C32(0x19850000), SPH_C32(0x5a1c0000), + SPH_C32(0x99eb5240), SPH_C32(0x0cee5c31), SPH_C32(0xe6d839fe), + SPH_C32(0xbe28ec8d), SPH_C32(0x8f35d15f), SPH_C32(0xb3ed0000), + SPH_C32(0x24380000), SPH_C32(0x19240000), SPH_C32(0xf09e7e60), + SPH_C32(0x90642f75), SPH_C32(0xc3396f00), SPH_C32(0x4dc44b0c), + SPH_C32(0xbdd10cee) }, + { SPH_C32(0xef180000), SPH_C32(0x7bde0000), SPH_C32(0x06960000), + SPH_C32(0xd4665480), SPH_C32(0x97400b80), SPH_C32(0x6d841ce0), + SPH_C32(0x8f0bc0ac), SPH_C32(0x40a75c89), SPH_C32(0xb6c30000), + SPH_C32(0xd5b20000), SPH_C32(0x36620000), SPH_C32(0x9cbc7ce0), + SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), SPH_C32(0x1694e6be), + SPH_C32(0x315d5140) }, + { SPH_C32(0x09300000), SPH_C32(0x37950000), SPH_C32(0xaec30000), + SPH_C32(0x07b65660), SPH_C32(0x4f213b38), SPH_C32(0xf523ac3a), + SPH_C32(0xa79ec618), SPH_C32(0x97fd141e), SPH_C32(0x46060000), + SPH_C32(0x8c910000), SPH_C32(0x73e00000), SPH_C32(0x7d317c20), + SPH_C32(0x5dd213e6), SPH_C32(0x14c6be12), SPH_C32(0xdd7418a2), + SPH_C32(0x67fae0df) }, + { SPH_C32(0x1fdd0000), SPH_C32(0x22fd0000), SPH_C32(0x43140000), + SPH_C32(0x35eb5440), SPH_C32(0xac2d0db1), SPH_C32(0xaf694a79), + SPH_C32(0x44eb3eb0), SPH_C32(0x1600ed16), SPH_C32(0xa02e0000), + SPH_C32(0xc0da0000), SPH_C32(0xdbb50000), SPH_C32(0xaee17ec0), + SPH_C32(0x85b3235e), SPH_C32(0x8c610ec8), SPH_C32(0xf5e11e16), + SPH_C32(0xb0a0a848) }, + { SPH_C32(0xf9f50000), SPH_C32(0x6eb60000), SPH_C32(0xeb410000), + SPH_C32(0xe63b56a0), SPH_C32(0x744c3d09), SPH_C32(0x37cefaa3), + SPH_C32(0x6c7e3804), SPH_C32(0xc15aa581), SPH_C32(0x50eb0000), + SPH_C32(0x99f90000), SPH_C32(0x9e370000), SPH_C32(0x4f6c7e00), + SPH_C32(0xbede256f), SPH_C32(0x4e8c5851), SPH_C32(0x3e01e00a), + SPH_C32(0xe60719d7) }, + { SPH_C32(0x1e6c0000), SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), + SPH_C32(0xbcb6b800), SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), + SPH_C32(0x6a0c1bc8), SPH_C32(0xb99dc2eb), SPH_C32(0x92560000), + SPH_C32(0x1eda0000), SPH_C32(0xea510000), SPH_C32(0xe8b13000), + SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), SPH_C32(0xb15c2254), + SPH_C32(0x33c5244f) }, + { SPH_C32(0xf8440000), SPH_C32(0x88090000), SPH_C32(0x227b0000), + SPH_C32(0x6f66bae0), SPH_C32(0xf425230e), SPH_C32(0x135a6300), + SPH_C32(0x42991d7c), SPH_C32(0x6ec78a7c), SPH_C32(0x62930000), + SPH_C32(0x47f90000), SPH_C32(0xafd30000), SPH_C32(0x093c30c0), + SPH_C32(0x92585094), SPH_C32(0x29163700), SPH_C32(0x7abcdc48), + SPH_C32(0x656295d0) }, + { SPH_C32(0xeea90000), SPH_C32(0x9d610000), SPH_C32(0xcfac0000), + SPH_C32(0x5d3bb8c0), SPH_C32(0x17291587), SPH_C32(0x49108543), + SPH_C32(0xa1ece5d4), SPH_C32(0xef3a7374), SPH_C32(0x84bb0000), + SPH_C32(0x0bb20000), SPH_C32(0x07860000), SPH_C32(0xdaec3220), + SPH_C32(0x4a39602c), SPH_C32(0xb1b187da), SPH_C32(0x5229dafc), + SPH_C32(0xb238dd47) }, + { SPH_C32(0x08810000), SPH_C32(0xd12a0000), SPH_C32(0x67f90000), + SPH_C32(0x8eebba20), SPH_C32(0xcf48253f), SPH_C32(0xd1b73599), + SPH_C32(0x8979e360), SPH_C32(0x38603be3), SPH_C32(0x747e0000), + SPH_C32(0x52910000), SPH_C32(0x42040000), SPH_C32(0x3b6132e0), + SPH_C32(0x7154661d), SPH_C32(0x735cd143), SPH_C32(0x99c924e0), + SPH_C32(0xe49f6cd8) }, + { SPH_C32(0xaa5d0000), SPH_C32(0xb3710000), SPH_C32(0x3b730000), + SPH_C32(0xc366bce0), SPH_C32(0x54e6728e), SPH_C32(0x5aeb1087), + SPH_C32(0xb85acf41), SPH_C32(0xf7f2b635), SPH_C32(0x71500000), + SPH_C32(0xa31b0000), SPH_C32(0x6d420000), SPH_C32(0x57433060), + SPH_C32(0x878f5cbf), SPH_C32(0x664e56c8), SPH_C32(0xc2998952), + SPH_C32(0x68133176) }, + { SPH_C32(0x4c750000), SPH_C32(0xff3a0000), SPH_C32(0x93260000), + SPH_C32(0x10b6be00), SPH_C32(0x8c874236), SPH_C32(0xc24ca05d), + SPH_C32(0x90cfc9f5), SPH_C32(0x20a8fea2), SPH_C32(0x81950000), + SPH_C32(0xfa380000), SPH_C32(0x28c00000), SPH_C32(0xb6ce30a0), + SPH_C32(0xbce25a8e), SPH_C32(0xa4a30051), SPH_C32(0x0979774e), + SPH_C32(0x3eb480e9) }, + { SPH_C32(0x5a980000), SPH_C32(0xea520000), SPH_C32(0x7ef10000), + SPH_C32(0x22ebbc20), SPH_C32(0x6f8b74bf), SPH_C32(0x9806461e), + SPH_C32(0x73ba315d), SPH_C32(0xa15507aa), SPH_C32(0x67bd0000), + SPH_C32(0xb6730000), SPH_C32(0x80950000), SPH_C32(0x651e3240), + SPH_C32(0x64836a36), SPH_C32(0x3c04b08b), SPH_C32(0x21ec71fa), + SPH_C32(0xe9eec87e) }, + { SPH_C32(0xbcb00000), SPH_C32(0xa6190000), SPH_C32(0xd6a40000), + SPH_C32(0xf13bbec0), SPH_C32(0xb7ea4407), SPH_C32(0x00a1f6c4), + SPH_C32(0x5b2f37e9), SPH_C32(0x760f4f3d), SPH_C32(0x97780000), + SPH_C32(0xef500000), SPH_C32(0xc5170000), SPH_C32(0x84933280), + SPH_C32(0x5fee6c07), SPH_C32(0xfee9e612), SPH_C32(0xea0c8fe6), + SPH_C32(0xbf4979e1) }, + { SPH_C32(0xfd6a0000), SPH_C32(0x79830000), SPH_C32(0x0d3d0000), + SPH_C32(0x0344b860), SPH_C32(0x02fe19ac), SPH_C32(0x0648e48b), + SPH_C32(0x19c9b0ce), SPH_C32(0xe24bd7d2), SPH_C32(0xc5610000), + SPH_C32(0xd4280000), SPH_C32(0xdc1f0000), SPH_C32(0x28933480), + SPH_C32(0xff2d3d87), SPH_C32(0xb7589595), SPH_C32(0x10cf5ddb), + SPH_C32(0x267c45a8) }, + { SPH_C32(0x1b420000), SPH_C32(0x35c80000), SPH_C32(0xa5680000), + SPH_C32(0xd094ba80), SPH_C32(0xda9f2914), SPH_C32(0x9eef5451), + SPH_C32(0x315cb67a), SPH_C32(0x35119f45), SPH_C32(0x35a40000), + SPH_C32(0x8d0b0000), SPH_C32(0x999d0000), SPH_C32(0xc91e3440), + SPH_C32(0xc4403bb6), SPH_C32(0x75b5c30c), SPH_C32(0xdb2fa3c7), + SPH_C32(0x70dbf437) }, + { SPH_C32(0x0daf0000), SPH_C32(0x20a00000), SPH_C32(0x48bf0000), + SPH_C32(0xe2c9b8a0), SPH_C32(0x39931f9d), SPH_C32(0xc4a5b212), + SPH_C32(0xd2294ed2), SPH_C32(0xb4ec664d), SPH_C32(0xd38c0000), + SPH_C32(0xc1400000), SPH_C32(0x31c80000), SPH_C32(0x1ace36a0), + SPH_C32(0x1c210b0e), SPH_C32(0xed1273d6), SPH_C32(0xf3baa573), + SPH_C32(0xa781bca0) }, + { SPH_C32(0xeb870000), SPH_C32(0x6ceb0000), SPH_C32(0xe0ea0000), + SPH_C32(0x3119ba40), SPH_C32(0xe1f22f25), SPH_C32(0x5c0202c8), + SPH_C32(0xfabc4866), SPH_C32(0x63b62eda), SPH_C32(0x23490000), + SPH_C32(0x98630000), SPH_C32(0x744a0000), SPH_C32(0xfb433660), + SPH_C32(0x274c0d3f), SPH_C32(0x2fff254f), SPH_C32(0x385a5b6f), + SPH_C32(0xf1260d3f) }, + { SPH_C32(0x495b0000), SPH_C32(0x0eb00000), SPH_C32(0xbc600000), + SPH_C32(0x7c94bc80), SPH_C32(0x7a5c7894), SPH_C32(0xd75e27d6), + SPH_C32(0xcb9f6447), SPH_C32(0xac24a30c), SPH_C32(0x26670000), + SPH_C32(0x69e90000), SPH_C32(0x5b0c0000), SPH_C32(0x976134e0), + SPH_C32(0xd197379d), SPH_C32(0x3aeda2c4), SPH_C32(0x630af6dd), + SPH_C32(0x7daa5091) }, + { SPH_C32(0xaf730000), SPH_C32(0x42fb0000), SPH_C32(0x14350000), + SPH_C32(0xaf44be60), SPH_C32(0xa23d482c), SPH_C32(0x4ff9970c), + SPH_C32(0xe30a62f3), SPH_C32(0x7b7eeb9b), SPH_C32(0xd6a20000), + SPH_C32(0x30ca0000), SPH_C32(0x1e8e0000), SPH_C32(0x76ec3420), + SPH_C32(0xeafa31ac), SPH_C32(0xf800f45d), SPH_C32(0xa8ea08c1), + SPH_C32(0x2b0de10e) }, + { SPH_C32(0xb99e0000), SPH_C32(0x57930000), SPH_C32(0xf9e20000), + SPH_C32(0x9d19bc40), SPH_C32(0x41317ea5), SPH_C32(0x15b3714f), + SPH_C32(0x007f9a5b), SPH_C32(0xfa831293), SPH_C32(0x308a0000), + SPH_C32(0x7c810000), SPH_C32(0xb6db0000), SPH_C32(0xa53c36c0), + SPH_C32(0x329b0114), SPH_C32(0x60a74487), SPH_C32(0x807f0e75), + SPH_C32(0xfc57a999) }, + { SPH_C32(0x5fb60000), SPH_C32(0x1bd80000), SPH_C32(0x51b70000), + SPH_C32(0x4ec9bea0), SPH_C32(0x99504e1d), SPH_C32(0x8d14c195), + SPH_C32(0x28ea9cef), SPH_C32(0x2dd95a04), SPH_C32(0xc04f0000), + SPH_C32(0x25a20000), SPH_C32(0xf3590000), SPH_C32(0x44b13600), + SPH_C32(0x09f60725), SPH_C32(0xa24a121e), SPH_C32(0x4b9ff069), + SPH_C32(0xaaf01806) }, + { SPH_C32(0x1c9e0000), SPH_C32(0x66c30000), SPH_C32(0x0d110000), + SPH_C32(0x5fdac000), SPH_C32(0x32596759), SPH_C32(0x8cc0f80c), + SPH_C32(0xaece29ff), SPH_C32(0xc6afe775), SPH_C32(0x288b0000), + SPH_C32(0x0d770000), SPH_C32(0x5db60000), SPH_C32(0x1f991800), + SPH_C32(0x767042e8), SPH_C32(0xdde1a2a3), SPH_C32(0x5b06af40), + SPH_C32(0x19e93cbf) }, + { SPH_C32(0xfab60000), SPH_C32(0x2a880000), SPH_C32(0xa5440000), + SPH_C32(0x8c0ac2e0), SPH_C32(0xea3857e1), SPH_C32(0x146748d6), + SPH_C32(0x865b2f4b), SPH_C32(0x11f5afe2), SPH_C32(0xd84e0000), + SPH_C32(0x54540000), SPH_C32(0x18340000), SPH_C32(0xfe1418c0), + SPH_C32(0x4d1d44d9), SPH_C32(0x1f0cf43a), SPH_C32(0x90e6515c), + SPH_C32(0x4f4e8d20) }, + { SPH_C32(0xec5b0000), SPH_C32(0x3fe00000), SPH_C32(0x48930000), + SPH_C32(0xbe57c0c0), SPH_C32(0x09346168), SPH_C32(0x4e2dae95), + SPH_C32(0x652ed7e3), SPH_C32(0x900856ea), SPH_C32(0x3e660000), + SPH_C32(0x181f0000), SPH_C32(0xb0610000), SPH_C32(0x2dc41a20), + SPH_C32(0x957c7461), SPH_C32(0x87ab44e0), SPH_C32(0xb87357e8), + SPH_C32(0x9814c5b7) }, + { SPH_C32(0x0a730000), SPH_C32(0x73ab0000), SPH_C32(0xe0c60000), + SPH_C32(0x6d87c220), SPH_C32(0xd15551d0), SPH_C32(0xd68a1e4f), + SPH_C32(0x4dbbd157), SPH_C32(0x47521e7d), SPH_C32(0xcea30000), + SPH_C32(0x413c0000), SPH_C32(0xf5e30000), SPH_C32(0xcc491ae0), + SPH_C32(0xae117250), SPH_C32(0x45461279), SPH_C32(0x7393a9f4), + SPH_C32(0xceb37428) }, + { SPH_C32(0xa8af0000), SPH_C32(0x11f00000), SPH_C32(0xbc4c0000), + SPH_C32(0x200ac4e0), SPH_C32(0x4afb0661), SPH_C32(0x5dd63b51), + SPH_C32(0x7c98fd76), SPH_C32(0x88c093ab), SPH_C32(0xcb8d0000), + SPH_C32(0xb0b60000), SPH_C32(0xdaa50000), SPH_C32(0xa06b1860), + SPH_C32(0x58ca48f2), SPH_C32(0x505495f2), SPH_C32(0x28c30446), + SPH_C32(0x423f2986) }, + { SPH_C32(0x4e870000), SPH_C32(0x5dbb0000), SPH_C32(0x14190000), + SPH_C32(0xf3dac600), SPH_C32(0x929a36d9), SPH_C32(0xc5718b8b), + SPH_C32(0x540dfbc2), SPH_C32(0x5f9adb3c), SPH_C32(0x3b480000), + SPH_C32(0xe9950000), SPH_C32(0x9f270000), SPH_C32(0x41e618a0), + SPH_C32(0x63a74ec3), SPH_C32(0x92b9c36b), SPH_C32(0xe323fa5a), + SPH_C32(0x14989819) }, + { SPH_C32(0x586a0000), SPH_C32(0x48d30000), SPH_C32(0xf9ce0000), + SPH_C32(0xc187c420), SPH_C32(0x71960050), SPH_C32(0x9f3b6dc8), + SPH_C32(0xb778036a), SPH_C32(0xde672234), SPH_C32(0xdd600000), + SPH_C32(0xa5de0000), SPH_C32(0x37720000), SPH_C32(0x92361a40), + SPH_C32(0xbbc67e7b), SPH_C32(0x0a1e73b1), SPH_C32(0xcbb6fcee), + SPH_C32(0xc3c2d08e) }, + { SPH_C32(0xbe420000), SPH_C32(0x04980000), SPH_C32(0x519b0000), + SPH_C32(0x1257c6c0), SPH_C32(0xa9f730e8), SPH_C32(0x079cdd12), + SPH_C32(0x9fed05de), SPH_C32(0x093d6aa3), SPH_C32(0x2da50000), + SPH_C32(0xfcfd0000), SPH_C32(0x72f00000), SPH_C32(0x73bb1a80), + SPH_C32(0x80ab784a), SPH_C32(0xc8f32528), SPH_C32(0x005602f2), + SPH_C32(0x95656111) }, + { SPH_C32(0xff980000), SPH_C32(0xdb020000), SPH_C32(0x8a020000), + SPH_C32(0xe028c060), SPH_C32(0x1ce36d43), SPH_C32(0x0175cf5d), + SPH_C32(0xdd0b82f9), SPH_C32(0x9d79f24c), SPH_C32(0x7fbc0000), + SPH_C32(0xc7850000), SPH_C32(0x6bf80000), SPH_C32(0xdfbb1c80), + SPH_C32(0x206829ca), SPH_C32(0x814256af), SPH_C32(0xfa95d0cf), + SPH_C32(0x0c505d58) }, + { SPH_C32(0x19b00000), SPH_C32(0x97490000), SPH_C32(0x22570000), + SPH_C32(0x33f8c280), SPH_C32(0xc4825dfb), SPH_C32(0x99d27f87), + SPH_C32(0xf59e844d), SPH_C32(0x4a23badb), SPH_C32(0x8f790000), + SPH_C32(0x9ea60000), SPH_C32(0x2e7a0000), SPH_C32(0x3e361c40), + SPH_C32(0x1b052ffb), SPH_C32(0x43af0036), SPH_C32(0x31752ed3), + SPH_C32(0x5af7ecc7) }, + { SPH_C32(0x0f5d0000), SPH_C32(0x82210000), SPH_C32(0xcf800000), + SPH_C32(0x01a5c0a0), SPH_C32(0x278e6b72), SPH_C32(0xc39899c4), + SPH_C32(0x16eb7ce5), SPH_C32(0xcbde43d3), SPH_C32(0x69510000), + SPH_C32(0xd2ed0000), SPH_C32(0x862f0000), SPH_C32(0xede61ea0), + SPH_C32(0xc3641f43), SPH_C32(0xdb08b0ec), SPH_C32(0x19e02867), + SPH_C32(0x8dada450) }, + { SPH_C32(0xe9750000), SPH_C32(0xce6a0000), SPH_C32(0x67d50000), + SPH_C32(0xd275c240), SPH_C32(0xffef5bca), SPH_C32(0x5b3f291e), + SPH_C32(0x3e7e7a51), SPH_C32(0x1c840b44), SPH_C32(0x99940000), + SPH_C32(0x8bce0000), SPH_C32(0xc3ad0000), SPH_C32(0x0c6b1e60), + SPH_C32(0xf8091972), SPH_C32(0x19e5e675), SPH_C32(0xd200d67b), + SPH_C32(0xdb0a15cf) }, + { SPH_C32(0x4ba90000), SPH_C32(0xac310000), SPH_C32(0x3b5f0000), + SPH_C32(0x9ff8c480), SPH_C32(0x64410c7b), SPH_C32(0xd0630c00), + SPH_C32(0x0f5d5670), SPH_C32(0xd3168692), SPH_C32(0x9cba0000), + SPH_C32(0x7a440000), SPH_C32(0xeceb0000), SPH_C32(0x60491ce0), + SPH_C32(0x0ed223d0), SPH_C32(0x0cf761fe), SPH_C32(0x89507bc9), + SPH_C32(0x57864861) }, + { SPH_C32(0xad810000), SPH_C32(0xe07a0000), SPH_C32(0x930a0000), + SPH_C32(0x4c28c660), SPH_C32(0xbc203cc3), SPH_C32(0x48c4bcda), + SPH_C32(0x27c850c4), SPH_C32(0x044cce05), SPH_C32(0x6c7f0000), + SPH_C32(0x23670000), SPH_C32(0xa9690000), SPH_C32(0x81c41c20), + SPH_C32(0x35bf25e1), SPH_C32(0xce1a3767), SPH_C32(0x42b085d5), + SPH_C32(0x0121f9fe) }, + { SPH_C32(0xbb6c0000), SPH_C32(0xf5120000), SPH_C32(0x7edd0000), + SPH_C32(0x7e75c440), SPH_C32(0x5f2c0a4a), SPH_C32(0x128e5a99), + SPH_C32(0xc4bda86c), SPH_C32(0x85b1370d), SPH_C32(0x8a570000), + SPH_C32(0x6f2c0000), SPH_C32(0x013c0000), SPH_C32(0x52141ec0), + SPH_C32(0xedde1559), SPH_C32(0x56bd87bd), SPH_C32(0x6a258361), + SPH_C32(0xd67bb169) }, + { SPH_C32(0x5d440000), SPH_C32(0xb9590000), SPH_C32(0xd6880000), + SPH_C32(0xada5c6a0), SPH_C32(0x874d3af2), SPH_C32(0x8a29ea43), + SPH_C32(0xec28aed8), SPH_C32(0x52eb7f9a), SPH_C32(0x7a920000), + SPH_C32(0x360f0000), SPH_C32(0x44be0000), SPH_C32(0xb3991e00), + SPH_C32(0xd6b31368), SPH_C32(0x9450d124), SPH_C32(0xa1c57d7d), + SPH_C32(0x80dc00f6) }, + { SPH_C32(0xa4b10000), SPH_C32(0xd7ef0000), SPH_C32(0x3dc90000), + SPH_C32(0x4b9e9000), SPH_C32(0xf30107fb), SPH_C32(0xbde710e0), + SPH_C32(0x805696dc), SPH_C32(0x93b1da1b), SPH_C32(0x2a790000), + SPH_C32(0xaff60000), SPH_C32(0xda890000), SPH_C32(0xfcf56000), + SPH_C32(0x686d3607), SPH_C32(0xdadc8975), SPH_C32(0x9fc49d77), + SPH_C32(0x66db1921) }, + { SPH_C32(0x42990000), SPH_C32(0x9ba40000), SPH_C32(0x959c0000), + SPH_C32(0x984e92e0), SPH_C32(0x2b603743), SPH_C32(0x2540a03a), + SPH_C32(0xa8c39068), SPH_C32(0x44eb928c), SPH_C32(0xdabc0000), + SPH_C32(0xf6d50000), SPH_C32(0x9f0b0000), SPH_C32(0x1d7860c0), + SPH_C32(0x53003036), SPH_C32(0x1831dfec), SPH_C32(0x5424636b), + SPH_C32(0x307ca8be) }, + { SPH_C32(0x54740000), SPH_C32(0x8ecc0000), SPH_C32(0x784b0000), + SPH_C32(0xaa1390c0), SPH_C32(0xc86c01ca), SPH_C32(0x7f0a4679), + SPH_C32(0x4bb668c0), SPH_C32(0xc5166b84), SPH_C32(0x3c940000), + SPH_C32(0xba9e0000), SPH_C32(0x375e0000), SPH_C32(0xcea86220), + SPH_C32(0x8b61008e), SPH_C32(0x80966f36), SPH_C32(0x7cb165df), + SPH_C32(0xe726e029) }, + { SPH_C32(0xb25c0000), SPH_C32(0xc2870000), SPH_C32(0xd01e0000), + SPH_C32(0x79c39220), SPH_C32(0x100d3172), SPH_C32(0xe7adf6a3), + SPH_C32(0x63236e74), SPH_C32(0x124c2313), SPH_C32(0xcc510000), + SPH_C32(0xe3bd0000), SPH_C32(0x72dc0000), SPH_C32(0x2f2562e0), + SPH_C32(0xb00c06bf), SPH_C32(0x427b39af), SPH_C32(0xb7519bc3), + SPH_C32(0xb18151b6) }, + { SPH_C32(0x10800000), SPH_C32(0xa0dc0000), SPH_C32(0x8c940000), + SPH_C32(0x344e94e0), SPH_C32(0x8ba366c3), SPH_C32(0x6cf1d3bd), + SPH_C32(0x52004255), SPH_C32(0xdddeaec5), SPH_C32(0xc97f0000), + SPH_C32(0x12370000), SPH_C32(0x5d9a0000), SPH_C32(0x43076060), + SPH_C32(0x46d73c1d), SPH_C32(0x5769be24), SPH_C32(0xec013671), + SPH_C32(0x3d0d0c18) }, + { SPH_C32(0xf6a80000), SPH_C32(0xec970000), SPH_C32(0x24c10000), + SPH_C32(0xe79e9600), SPH_C32(0x53c2567b), SPH_C32(0xf4566367), + SPH_C32(0x7a9544e1), SPH_C32(0x0a84e652), SPH_C32(0x39ba0000), + SPH_C32(0x4b140000), SPH_C32(0x18180000), SPH_C32(0xa28a60a0), + SPH_C32(0x7dba3a2c), SPH_C32(0x9584e8bd), SPH_C32(0x27e1c86d), + SPH_C32(0x6baabd87) }, + { SPH_C32(0xe0450000), SPH_C32(0xf9ff0000), SPH_C32(0xc9160000), + SPH_C32(0xd5c39420), SPH_C32(0xb0ce60f2), SPH_C32(0xae1c8524), + SPH_C32(0x99e0bc49), SPH_C32(0x8b791f5a), SPH_C32(0xdf920000), + SPH_C32(0x075f0000), SPH_C32(0xb04d0000), SPH_C32(0x715a6240), + SPH_C32(0xa5db0a94), SPH_C32(0x0d235867), SPH_C32(0x0f74ced9), + SPH_C32(0xbcf0f510) }, + { SPH_C32(0x066d0000), SPH_C32(0xb5b40000), SPH_C32(0x61430000), + SPH_C32(0x061396c0), SPH_C32(0x68af504a), SPH_C32(0x36bb35fe), + SPH_C32(0xb175bafd), SPH_C32(0x5c2357cd), SPH_C32(0x2f570000), + SPH_C32(0x5e7c0000), SPH_C32(0xf5cf0000), SPH_C32(0x90d76280), + SPH_C32(0x9eb60ca5), SPH_C32(0xcfce0efe), SPH_C32(0xc49430c5), + SPH_C32(0xea57448f) }, + { SPH_C32(0x47b70000), SPH_C32(0x6a2e0000), SPH_C32(0xbada0000), + SPH_C32(0xf46c9060), SPH_C32(0xddbb0de1), SPH_C32(0x305227b1), + SPH_C32(0xf3933dda), SPH_C32(0xc867cf22), SPH_C32(0x7d4e0000), + SPH_C32(0x65040000), SPH_C32(0xecc70000), SPH_C32(0x3cd76480), + SPH_C32(0x3e755d25), SPH_C32(0x867f7d79), SPH_C32(0x3e57e2f8), + SPH_C32(0x736278c6) }, + { SPH_C32(0xa19f0000), SPH_C32(0x26650000), SPH_C32(0x128f0000), + SPH_C32(0x27bc9280), SPH_C32(0x05da3d59), SPH_C32(0xa8f5976b), + SPH_C32(0xdb063b6e), SPH_C32(0x1f3d87b5), SPH_C32(0x8d8b0000), + SPH_C32(0x3c270000), SPH_C32(0xa9450000), SPH_C32(0xdd5a6440), + SPH_C32(0x05185b14), SPH_C32(0x44922be0), SPH_C32(0xf5b71ce4), + SPH_C32(0x25c5c959) }, + { SPH_C32(0xb7720000), SPH_C32(0x330d0000), SPH_C32(0xff580000), + SPH_C32(0x15e190a0), SPH_C32(0xe6d60bd0), SPH_C32(0xf2bf7128), + SPH_C32(0x3873c3c6), SPH_C32(0x9ec07ebd), SPH_C32(0x6ba30000), + SPH_C32(0x706c0000), SPH_C32(0x01100000), SPH_C32(0x0e8a66a0), + SPH_C32(0xdd796bac), SPH_C32(0xdc359b3a), SPH_C32(0xdd221a50), + SPH_C32(0xf29f81ce) }, + { SPH_C32(0x515a0000), SPH_C32(0x7f460000), SPH_C32(0x570d0000), + SPH_C32(0xc6319240), SPH_C32(0x3eb73b68), SPH_C32(0x6a18c1f2), + SPH_C32(0x10e6c572), SPH_C32(0x499a362a), SPH_C32(0x9b660000), + SPH_C32(0x294f0000), SPH_C32(0x44920000), SPH_C32(0xef076660), + SPH_C32(0xe6146d9d), SPH_C32(0x1ed8cda3), SPH_C32(0x16c2e44c), + SPH_C32(0xa4383051) }, + { SPH_C32(0xf3860000), SPH_C32(0x1d1d0000), SPH_C32(0x0b870000), + SPH_C32(0x8bbc9480), SPH_C32(0xa5196cd9), SPH_C32(0xe144e4ec), + SPH_C32(0x21c5e953), SPH_C32(0x8608bbfc), SPH_C32(0x9e480000), + SPH_C32(0xd8c50000), SPH_C32(0x6bd40000), SPH_C32(0x832564e0), + SPH_C32(0x10cf573f), SPH_C32(0x0bca4a28), SPH_C32(0x4d9249fe), + SPH_C32(0x28b46dff) }, + { SPH_C32(0x15ae0000), SPH_C32(0x51560000), SPH_C32(0xa3d20000), + SPH_C32(0x586c9660), SPH_C32(0x7d785c61), SPH_C32(0x79e35436), + SPH_C32(0x0950efe7), SPH_C32(0x5152f36b), SPH_C32(0x6e8d0000), + SPH_C32(0x81e60000), SPH_C32(0x2e560000), SPH_C32(0x62a86420), + SPH_C32(0x2ba2510e), SPH_C32(0xc9271cb1), SPH_C32(0x8672b7e2), + SPH_C32(0x7e13dc60) }, + { SPH_C32(0x03430000), SPH_C32(0x443e0000), SPH_C32(0x4e050000), + SPH_C32(0x6a319440), SPH_C32(0x9e746ae8), SPH_C32(0x23a9b275), + SPH_C32(0xea25174f), SPH_C32(0xd0af0a63), SPH_C32(0x88a50000), + SPH_C32(0xcdad0000), SPH_C32(0x86030000), SPH_C32(0xb17866c0), + SPH_C32(0xf3c361b6), SPH_C32(0x5180ac6b), SPH_C32(0xaee7b156), + SPH_C32(0xa94994f7) }, + { SPH_C32(0xe56b0000), SPH_C32(0x08750000), SPH_C32(0xe6500000), + SPH_C32(0xb9e196a0), SPH_C32(0x46155a50), SPH_C32(0xbb0e02af), + SPH_C32(0xc2b011fb), SPH_C32(0x07f542f4), SPH_C32(0x78600000), + SPH_C32(0x948e0000), SPH_C32(0xc3810000), SPH_C32(0x50f56600), + SPH_C32(0xc8ae6787), SPH_C32(0x936dfaf2), SPH_C32(0x65074f4a), + SPH_C32(0xffee2568) }, + { SPH_C32(0xa6430000), SPH_C32(0x756e0000), SPH_C32(0xbaf60000), + SPH_C32(0xa8f2e800), SPH_C32(0xed1c7314), SPH_C32(0xbada3b36), + SPH_C32(0x4494a4eb), SPH_C32(0xec83ff85), SPH_C32(0x90a40000), + SPH_C32(0xbc5b0000), SPH_C32(0x6d6e0000), SPH_C32(0x0bdd4800), + SPH_C32(0xb728224a), SPH_C32(0xecc64a4f), SPH_C32(0x759e1063), + SPH_C32(0x4cf701d1) }, + { SPH_C32(0x406b0000), SPH_C32(0x39250000), SPH_C32(0x12a30000), + SPH_C32(0x7b22eae0), SPH_C32(0x357d43ac), SPH_C32(0x227d8bec), + SPH_C32(0x6c01a25f), SPH_C32(0x3bd9b712), SPH_C32(0x60610000), + SPH_C32(0xe5780000), SPH_C32(0x28ec0000), SPH_C32(0xea5048c0), + SPH_C32(0x8c45247b), SPH_C32(0x2e2b1cd6), SPH_C32(0xbe7eee7f), + SPH_C32(0x1a50b04e) }, + { SPH_C32(0x56860000), SPH_C32(0x2c4d0000), SPH_C32(0xff740000), + SPH_C32(0x497fe8c0), SPH_C32(0xd6717525), SPH_C32(0x78376daf), + SPH_C32(0x8f745af7), SPH_C32(0xba244e1a), SPH_C32(0x86490000), + SPH_C32(0xa9330000), SPH_C32(0x80b90000), SPH_C32(0x39804a20), + SPH_C32(0x542414c3), SPH_C32(0xb68cac0c), SPH_C32(0x96ebe8cb), + SPH_C32(0xcd0af8d9) }, + { SPH_C32(0xb0ae0000), SPH_C32(0x60060000), SPH_C32(0x57210000), + SPH_C32(0x9aafea20), SPH_C32(0x0e10459d), SPH_C32(0xe090dd75), + SPH_C32(0xa7e15c43), SPH_C32(0x6d7e068d), SPH_C32(0x768c0000), + SPH_C32(0xf0100000), SPH_C32(0xc53b0000), SPH_C32(0xd80d4ae0), + SPH_C32(0x6f4912f2), SPH_C32(0x7461fa95), SPH_C32(0x5d0b16d7), + SPH_C32(0x9bad4946) }, + { SPH_C32(0x12720000), SPH_C32(0x025d0000), SPH_C32(0x0bab0000), + SPH_C32(0xd722ece0), SPH_C32(0x95be122c), SPH_C32(0x6bccf86b), + SPH_C32(0x96c27062), SPH_C32(0xa2ec8b5b), SPH_C32(0x73a20000), + SPH_C32(0x019a0000), SPH_C32(0xea7d0000), SPH_C32(0xb42f4860), + SPH_C32(0x99922850), SPH_C32(0x61737d1e), SPH_C32(0x065bbb65), + SPH_C32(0x172114e8) }, + { SPH_C32(0xf45a0000), SPH_C32(0x4e160000), SPH_C32(0xa3fe0000), + SPH_C32(0x04f2ee00), SPH_C32(0x4ddf2294), SPH_C32(0xf36b48b1), + SPH_C32(0xbe5776d6), SPH_C32(0x75b6c3cc), SPH_C32(0x83670000), + SPH_C32(0x58b90000), SPH_C32(0xafff0000), SPH_C32(0x55a248a0), + SPH_C32(0xa2ff2e61), SPH_C32(0xa39e2b87), SPH_C32(0xcdbb4579), + SPH_C32(0x4186a577) }, + { SPH_C32(0xe2b70000), SPH_C32(0x5b7e0000), SPH_C32(0x4e290000), + SPH_C32(0x36afec20), SPH_C32(0xaed3141d), SPH_C32(0xa921aef2), + SPH_C32(0x5d228e7e), SPH_C32(0xf44b3ac4), SPH_C32(0x654f0000), + SPH_C32(0x14f20000), SPH_C32(0x07aa0000), SPH_C32(0x86724a40), + SPH_C32(0x7a9e1ed9), SPH_C32(0x3b399b5d), SPH_C32(0xe52e43cd), + SPH_C32(0x96dcede0) }, + { SPH_C32(0x049f0000), SPH_C32(0x17350000), SPH_C32(0xe67c0000), + SPH_C32(0xe57feec0), SPH_C32(0x76b224a5), SPH_C32(0x31861e28), + SPH_C32(0x75b788ca), SPH_C32(0x23117253), SPH_C32(0x958a0000), + SPH_C32(0x4dd10000), SPH_C32(0x42280000), SPH_C32(0x67ff4a80), + SPH_C32(0x41f318e8), SPH_C32(0xf9d4cdc4), SPH_C32(0x2ecebdd1), + SPH_C32(0xc07b5c7f) }, + { SPH_C32(0x45450000), SPH_C32(0xc8af0000), SPH_C32(0x3de50000), + SPH_C32(0x1700e860), SPH_C32(0xc3a6790e), SPH_C32(0x376f0c67), + SPH_C32(0x37510fed), SPH_C32(0xb755eabc), SPH_C32(0xc7930000), + SPH_C32(0x76a90000), SPH_C32(0x5b200000), SPH_C32(0xcbff4c80), + SPH_C32(0xe1304968), SPH_C32(0xb065be43), SPH_C32(0xd40d6fec), + SPH_C32(0x594e6036) }, + { SPH_C32(0xa36d0000), SPH_C32(0x84e40000), SPH_C32(0x95b00000), + SPH_C32(0xc4d0ea80), SPH_C32(0x1bc749b6), SPH_C32(0xafc8bcbd), + SPH_C32(0x1fc40959), SPH_C32(0x600fa22b), SPH_C32(0x37560000), + SPH_C32(0x2f8a0000), SPH_C32(0x1ea20000), SPH_C32(0x2a724c40), + SPH_C32(0xda5d4f59), SPH_C32(0x7288e8da), SPH_C32(0x1fed91f0), + SPH_C32(0x0fe9d1a9) }, + { SPH_C32(0xb5800000), SPH_C32(0x918c0000), SPH_C32(0x78670000), + SPH_C32(0xf68de8a0), SPH_C32(0xf8cb7f3f), SPH_C32(0xf5825afe), + SPH_C32(0xfcb1f1f1), SPH_C32(0xe1f25b23), SPH_C32(0xd17e0000), + SPH_C32(0x63c10000), SPH_C32(0xb6f70000), SPH_C32(0xf9a24ea0), + SPH_C32(0x023c7fe1), SPH_C32(0xea2f5800), SPH_C32(0x37789744), + SPH_C32(0xd8b3993e) }, + { SPH_C32(0x53a80000), SPH_C32(0xddc70000), SPH_C32(0xd0320000), + SPH_C32(0x255dea40), SPH_C32(0x20aa4f87), SPH_C32(0x6d25ea24), + SPH_C32(0xd424f745), SPH_C32(0x36a813b4), SPH_C32(0x21bb0000), + SPH_C32(0x3ae20000), SPH_C32(0xf3750000), SPH_C32(0x182f4e60), + SPH_C32(0x395179d0), SPH_C32(0x28c20e99), SPH_C32(0xfc986958), + SPH_C32(0x8e1428a1) }, + { SPH_C32(0xf1740000), SPH_C32(0xbf9c0000), SPH_C32(0x8cb80000), + SPH_C32(0x68d0ec80), SPH_C32(0xbb041836), SPH_C32(0xe679cf3a), + SPH_C32(0xe507db64), SPH_C32(0xf93a9e62), SPH_C32(0x24950000), + SPH_C32(0xcb680000), SPH_C32(0xdc330000), SPH_C32(0x740d4ce0), + SPH_C32(0xcf8a4372), SPH_C32(0x3dd08912), SPH_C32(0xa7c8c4ea), + SPH_C32(0x0298750f) }, + { SPH_C32(0x175c0000), SPH_C32(0xf3d70000), SPH_C32(0x24ed0000), + SPH_C32(0xbb00ee60), SPH_C32(0x6365288e), SPH_C32(0x7ede7fe0), + SPH_C32(0xcd92ddd0), SPH_C32(0x2e60d6f5), SPH_C32(0xd4500000), + SPH_C32(0x924b0000), SPH_C32(0x99b10000), SPH_C32(0x95804c20), + SPH_C32(0xf4e74543), SPH_C32(0xff3ddf8b), SPH_C32(0x6c283af6), + SPH_C32(0x543fc490) }, + { SPH_C32(0x01b10000), SPH_C32(0xe6bf0000), SPH_C32(0xc93a0000), + SPH_C32(0x895dec40), SPH_C32(0x80691e07), SPH_C32(0x249499a3), + SPH_C32(0x2ee72578), SPH_C32(0xaf9d2ffd), SPH_C32(0x32780000), + SPH_C32(0xde000000), SPH_C32(0x31e40000), SPH_C32(0x46504ec0), + SPH_C32(0x2c8675fb), SPH_C32(0x679a6f51), SPH_C32(0x44bd3c42), + SPH_C32(0x83658c07) }, + { SPH_C32(0xe7990000), SPH_C32(0xaaf40000), SPH_C32(0x616f0000), + SPH_C32(0x5a8deea0), SPH_C32(0x58082ebf), SPH_C32(0xbc332979), + SPH_C32(0x067223cc), SPH_C32(0x78c7676a), SPH_C32(0xc2bd0000), + SPH_C32(0x87230000), SPH_C32(0x74660000), SPH_C32(0xa7dd4e00), + SPH_C32(0x17eb73ca), SPH_C32(0xa57739c8), SPH_C32(0x8f5dc25e), + SPH_C32(0xd5c23d98) } +}; + +static const sph_u32 T512_56[128][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xa8da0000), SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), + SPH_C32(0x07da0002), SPH_C32(0x7d669583), SPH_C32(0x1f98708a), + SPH_C32(0xbb668808), SPH_C32(0xda878000), SPH_C32(0xabe70000), + SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), SPH_C32(0x3d180005), + SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), SPH_C32(0xb5c347eb), + SPH_C32(0x3c5dfffe) }, + { SPH_C32(0x01930000), SPH_C32(0xe7820000), SPH_C32(0xedfb0000), + SPH_C32(0xcf0c000b), SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), + SPH_C32(0x063661e1), SPH_C32(0x536f9e7b), SPH_C32(0x92280000), + SPH_C32(0xdc850000), SPH_C32(0x57fa0000), SPH_C32(0x56dc0003), + SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), SPH_C32(0x90cef752), + SPH_C32(0x7b1675d7) }, + { SPH_C32(0xa9490000), SPH_C32(0x713c0000), SPH_C32(0xb1e60000), + SPH_C32(0xc8d60009), SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), + SPH_C32(0xbd50e9e9), SPH_C32(0x89e81e7b), SPH_C32(0x39cf0000), + SPH_C32(0x42880000), SPH_C32(0xf8dd0000), SPH_C32(0x6bc40006), + SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), SPH_C32(0x250db0b9), + SPH_C32(0x474b8a29) }, + { SPH_C32(0x92280000), SPH_C32(0xdc850000), SPH_C32(0x57fa0000), + SPH_C32(0x56dc0003), SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), + SPH_C32(0x90cef752), SPH_C32(0x7b1675d7), SPH_C32(0x93bb0000), + SPH_C32(0x3b070000), SPH_C32(0xba010000), SPH_C32(0x99d00008), + SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), SPH_C32(0x96f896b3), + SPH_C32(0x2879ebac) }, + { SPH_C32(0x3af20000), SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), + SPH_C32(0x51060001), SPH_C32(0xc78fb695), SPH_C32(0x4577d386), + SPH_C32(0x2ba87f5a), SPH_C32(0xa191f5d7), SPH_C32(0x385c0000), + SPH_C32(0xa50a0000), SPH_C32(0x15260000), SPH_C32(0xa4c8000d), + SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), SPH_C32(0x233bd158), + SPH_C32(0x14241452) }, + { SPH_C32(0x93bb0000), SPH_C32(0x3b070000), SPH_C32(0xba010000), + SPH_C32(0x99d00008), SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), + SPH_C32(0x96f896b3), SPH_C32(0x2879ebac), SPH_C32(0x01930000), + SPH_C32(0xe7820000), SPH_C32(0xedfb0000), SPH_C32(0xcf0c000b), + SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), SPH_C32(0x063661e1), + SPH_C32(0x536f9e7b) }, + { SPH_C32(0x3b610000), SPH_C32(0xadb90000), SPH_C32(0xe61c0000), + SPH_C32(0x9e0a000a), SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), + SPH_C32(0x2d9e1ebb), SPH_C32(0xf2fe6bac), SPH_C32(0xaa740000), + SPH_C32(0x798f0000), SPH_C32(0x42dc0000), SPH_C32(0xf214000e), + SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), SPH_C32(0xb3f5260a), + SPH_C32(0x6f326185) }, + { SPH_C32(0x5fa80000), SPH_C32(0x56030000), SPH_C32(0x43ae0000), + SPH_C32(0x64f30013), SPH_C32(0x257e86bf), SPH_C32(0x1311944e), + SPH_C32(0x541e95bf), SPH_C32(0x8ea4db69), SPH_C32(0x00440000), + SPH_C32(0x7f480000), SPH_C32(0xda7c0000), SPH_C32(0x2a230001), + SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), SPH_C32(0x030a9e60), + SPH_C32(0xbe0a679e) }, + { SPH_C32(0xf7720000), SPH_C32(0xc0bd0000), SPH_C32(0x1fb30000), + SPH_C32(0x63290011), SPH_C32(0x5818133c), SPH_C32(0x0c89e4c4), + SPH_C32(0xef781db7), SPH_C32(0x54235b69), SPH_C32(0xaba30000), + SPH_C32(0xe1450000), SPH_C32(0x755b0000), SPH_C32(0x173b0004), + SPH_C32(0x17e2d61f), SPH_C32(0xdd408a12), SPH_C32(0xb6c9d98b), + SPH_C32(0x82579860) }, + { SPH_C32(0x5e3b0000), SPH_C32(0xb1810000), SPH_C32(0xae550000), + SPH_C32(0xabff0018), SPH_C32(0xa8ae0be7), SPH_C32(0xafb22060), + SPH_C32(0x5228f45e), SPH_C32(0xddcb4512), SPH_C32(0x926c0000), + SPH_C32(0xa3cd0000), SPH_C32(0x8d860000), SPH_C32(0x7cff0002), + SPH_C32(0x8144eada), SPH_C32(0xf3593f8b), SPH_C32(0x93c46932), + SPH_C32(0xc51c1249) }, + { SPH_C32(0xf6e10000), SPH_C32(0x273f0000), SPH_C32(0xf2480000), + SPH_C32(0xac25001a), SPH_C32(0xd5c89e64), SPH_C32(0xb02a50ea), + SPH_C32(0xe94e7c56), SPH_C32(0x074cc512), SPH_C32(0x398b0000), + SPH_C32(0x3dc00000), SPH_C32(0x22a10000), SPH_C32(0x41e70007), + SPH_C32(0xad0bf509), SPH_C32(0x87af291e), SPH_C32(0x26072ed9), + SPH_C32(0xf941edb7) }, + { SPH_C32(0xcd800000), SPH_C32(0x8a860000), SPH_C32(0x14540000), + SPH_C32(0x322f0010), SPH_C32(0x9f97a5a9), SPH_C32(0x49fe3742), + SPH_C32(0xc4d062ed), SPH_C32(0xf5b2aebe), SPH_C32(0x93ff0000), + SPH_C32(0x444f0000), SPH_C32(0x607d0000), SPH_C32(0xb3f30009), + SPH_C32(0x0c946782), SPH_C32(0x4ffa8ba5), SPH_C32(0x95f208d3), + SPH_C32(0x96738c32) }, + { SPH_C32(0x655a0000), SPH_C32(0x1c380000), SPH_C32(0x48490000), + SPH_C32(0x35f50012), SPH_C32(0xe2f1302a), SPH_C32(0x566647c8), + SPH_C32(0x7fb6eae5), SPH_C32(0x2f352ebe), SPH_C32(0x38180000), + SPH_C32(0xda420000), SPH_C32(0xcf5a0000), SPH_C32(0x8eeb000c), + SPH_C32(0x20db7851), SPH_C32(0x3b0c9d30), SPH_C32(0x20314f38), + SPH_C32(0xaa2e73cc) }, + { SPH_C32(0xcc130000), SPH_C32(0x6d040000), SPH_C32(0xf9af0000), + SPH_C32(0xfd23001b), SPH_C32(0x124728f1), SPH_C32(0xf55d836c), + SPH_C32(0xc2e6030c), SPH_C32(0xa6dd30c5), SPH_C32(0x01d70000), + SPH_C32(0x98ca0000), SPH_C32(0x37870000), SPH_C32(0xe52f000a), + SPH_C32(0xb67d4494), SPH_C32(0x151528a9), SPH_C32(0x053cff81), + SPH_C32(0xed65f9e5) }, + { SPH_C32(0x64c90000), SPH_C32(0xfbba0000), SPH_C32(0xa5b20000), + SPH_C32(0xfaf90019), SPH_C32(0x6f21bd72), SPH_C32(0xeac5f3e6), + SPH_C32(0x79808b04), SPH_C32(0x7c5ab0c5), SPH_C32(0xaa300000), + SPH_C32(0x06c70000), SPH_C32(0x98a00000), SPH_C32(0xd837000f), + SPH_C32(0x9a325b47), SPH_C32(0x61e33e3c), SPH_C32(0xb0ffb86a), + SPH_C32(0xd138061b) }, + { SPH_C32(0x00440000), SPH_C32(0x7f480000), SPH_C32(0xda7c0000), + SPH_C32(0x2a230001), SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), + SPH_C32(0x030a9e60), SPH_C32(0xbe0a679e), SPH_C32(0x5fec0000), + SPH_C32(0x294b0000), SPH_C32(0x99d20000), SPH_C32(0x4ed00012), + SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), SPH_C32(0x57140bdf), + SPH_C32(0x30aebcf7) }, + { SPH_C32(0xa89e0000), SPH_C32(0xe9f60000), SPH_C32(0x86610000), + SPH_C32(0x2df90003), SPH_C32(0x46cb5c4f), SPH_C32(0xb62eec0d), + SPH_C32(0xb86c1668), SPH_C32(0x648de79e), SPH_C32(0xf40b0000), + SPH_C32(0xb7460000), SPH_C32(0x36f50000), SPH_C32(0x73c80017), + SPH_C32(0x329c50a0), SPH_C32(0xce511e5c), SPH_C32(0xe2d74c34), + SPH_C32(0x0cf34309) }, + { SPH_C32(0x01d70000), SPH_C32(0x98ca0000), SPH_C32(0x37870000), + SPH_C32(0xe52f000a), SPH_C32(0xb67d4494), SPH_C32(0x151528a9), + SPH_C32(0x053cff81), SPH_C32(0xed65f9e5), SPH_C32(0xcdc40000), + SPH_C32(0xf5ce0000), SPH_C32(0xce280000), SPH_C32(0x180c0011), + SPH_C32(0xa43a6c65), SPH_C32(0xe048abc5), SPH_C32(0xc7dafc8d), + SPH_C32(0x4bb8c920) }, + { SPH_C32(0xa90d0000), SPH_C32(0x0e740000), SPH_C32(0x6b9a0000), + SPH_C32(0xe2f50008), SPH_C32(0xcb1bd117), SPH_C32(0x0a8d5823), + SPH_C32(0xbe5a7789), SPH_C32(0x37e279e5), SPH_C32(0x66230000), + SPH_C32(0x6bc30000), SPH_C32(0x610f0000), SPH_C32(0x25140014), + SPH_C32(0x887573b6), SPH_C32(0x94bebd50), SPH_C32(0x7219bb66), + SPH_C32(0x77e536de) }, + { SPH_C32(0x926c0000), SPH_C32(0xa3cd0000), SPH_C32(0x8d860000), + SPH_C32(0x7cff0002), SPH_C32(0x8144eada), SPH_C32(0xf3593f8b), + SPH_C32(0x93c46932), SPH_C32(0xc51c1249), SPH_C32(0xcc570000), + SPH_C32(0x124c0000), SPH_C32(0x23d30000), SPH_C32(0xd700001a), + SPH_C32(0x29eae13d), SPH_C32(0x5ceb1feb), SPH_C32(0xc1ec9d6c), + SPH_C32(0x18d7575b) }, + { SPH_C32(0x3ab60000), SPH_C32(0x35730000), SPH_C32(0xd19b0000), + SPH_C32(0x7b250000), SPH_C32(0xfc227f59), SPH_C32(0xecc14f01), + SPH_C32(0x28a2e13a), SPH_C32(0x1f9b9249), SPH_C32(0x67b00000), + SPH_C32(0x8c410000), SPH_C32(0x8cf40000), SPH_C32(0xea18001f), + SPH_C32(0x05a5feee), SPH_C32(0x281d097e), SPH_C32(0x742fda87), + SPH_C32(0x248aa8a5) }, + { SPH_C32(0x93ff0000), SPH_C32(0x444f0000), SPH_C32(0x607d0000), + SPH_C32(0xb3f30009), SPH_C32(0x0c946782), SPH_C32(0x4ffa8ba5), + SPH_C32(0x95f208d3), SPH_C32(0x96738c32), SPH_C32(0x5e7f0000), + SPH_C32(0xcec90000), SPH_C32(0x74290000), SPH_C32(0x81dc0019), + SPH_C32(0x9303c22b), SPH_C32(0x0604bce7), SPH_C32(0x51226a3e), + SPH_C32(0x63c1228c) }, + { SPH_C32(0x3b250000), SPH_C32(0xd2f10000), SPH_C32(0x3c600000), + SPH_C32(0xb429000b), SPH_C32(0x71f2f201), SPH_C32(0x5062fb2f), + SPH_C32(0x2e9480db), SPH_C32(0x4cf40c32), SPH_C32(0xf5980000), + SPH_C32(0x50c40000), SPH_C32(0xdb0e0000), SPH_C32(0xbcc4001c), + SPH_C32(0xbf4cddf8), SPH_C32(0x72f2aa72), SPH_C32(0xe4e12dd5), + SPH_C32(0x5f9cdd72) }, + { SPH_C32(0x5fec0000), SPH_C32(0x294b0000), SPH_C32(0x99d20000), + SPH_C32(0x4ed00012), SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), + SPH_C32(0x57140bdf), SPH_C32(0x30aebcf7), SPH_C32(0x5fa80000), + SPH_C32(0x56030000), SPH_C32(0x43ae0000), SPH_C32(0x64f30013), + SPH_C32(0x257e86bf), SPH_C32(0x1311944e), SPH_C32(0x541e95bf), + SPH_C32(0x8ea4db69) }, + { SPH_C32(0xf7360000), SPH_C32(0xbff50000), SPH_C32(0xc5cf0000), + SPH_C32(0x490a0010), SPH_C32(0x63b5daf0), SPH_C32(0xa53f7843), + SPH_C32(0xec7283d7), SPH_C32(0xea293cf7), SPH_C32(0xf44f0000), + SPH_C32(0xc80e0000), SPH_C32(0xec890000), SPH_C32(0x59eb0016), + SPH_C32(0x0931996c), SPH_C32(0x67e782db), SPH_C32(0xe1ddd254), + SPH_C32(0xb2f92497) }, + { SPH_C32(0x5e7f0000), SPH_C32(0xcec90000), SPH_C32(0x74290000), + SPH_C32(0x81dc0019), SPH_C32(0x9303c22b), SPH_C32(0x0604bce7), + SPH_C32(0x51226a3e), SPH_C32(0x63c1228c), SPH_C32(0xcd800000), + SPH_C32(0x8a860000), SPH_C32(0x14540000), SPH_C32(0x322f0010), + SPH_C32(0x9f97a5a9), SPH_C32(0x49fe3742), SPH_C32(0xc4d062ed), + SPH_C32(0xf5b2aebe) }, + { SPH_C32(0xf6a50000), SPH_C32(0x58770000), SPH_C32(0x28340000), + SPH_C32(0x8606001b), SPH_C32(0xee6557a8), SPH_C32(0x199ccc6d), + SPH_C32(0xea44e236), SPH_C32(0xb946a28c), SPH_C32(0x66670000), + SPH_C32(0x148b0000), SPH_C32(0xbb730000), SPH_C32(0x0f370015), + SPH_C32(0xb3d8ba7a), SPH_C32(0x3d0821d7), SPH_C32(0x71132506), + SPH_C32(0xc9ef5140) }, + { SPH_C32(0xcdc40000), SPH_C32(0xf5ce0000), SPH_C32(0xce280000), + SPH_C32(0x180c0011), SPH_C32(0xa43a6c65), SPH_C32(0xe048abc5), + SPH_C32(0xc7dafc8d), SPH_C32(0x4bb8c920), SPH_C32(0xcc130000), + SPH_C32(0x6d040000), SPH_C32(0xf9af0000), SPH_C32(0xfd23001b), + SPH_C32(0x124728f1), SPH_C32(0xf55d836c), SPH_C32(0xc2e6030c), + SPH_C32(0xa6dd30c5) }, + { SPH_C32(0x651e0000), SPH_C32(0x63700000), SPH_C32(0x92350000), + SPH_C32(0x1fd60013), SPH_C32(0xd95cf9e6), SPH_C32(0xffd0db4f), + SPH_C32(0x7cbc7485), SPH_C32(0x913f4920), SPH_C32(0x67f40000), + SPH_C32(0xf3090000), SPH_C32(0x56880000), SPH_C32(0xc03b001e), + SPH_C32(0x3e083722), SPH_C32(0x81ab95f9), SPH_C32(0x772544e7), + SPH_C32(0x9a80cf3b) }, + { SPH_C32(0xcc570000), SPH_C32(0x124c0000), SPH_C32(0x23d30000), + SPH_C32(0xd700001a), SPH_C32(0x29eae13d), SPH_C32(0x5ceb1feb), + SPH_C32(0xc1ec9d6c), SPH_C32(0x18d7575b), SPH_C32(0x5e3b0000), + SPH_C32(0xb1810000), SPH_C32(0xae550000), SPH_C32(0xabff0018), + SPH_C32(0xa8ae0be7), SPH_C32(0xafb22060), SPH_C32(0x5228f45e), + SPH_C32(0xddcb4512) }, + { SPH_C32(0x648d0000), SPH_C32(0x84f20000), SPH_C32(0x7fce0000), + SPH_C32(0xd0da0018), SPH_C32(0x548c74be), SPH_C32(0x43736f61), + SPH_C32(0x7a8a1564), SPH_C32(0xc250d75b), SPH_C32(0xf5dc0000), + SPH_C32(0x2f8c0000), SPH_C32(0x01720000), SPH_C32(0x96e7001d), + SPH_C32(0x84e11434), SPH_C32(0xdb4436f5), SPH_C32(0xe7ebb3b5), + SPH_C32(0xe196baec) }, + { SPH_C32(0xee930000), SPH_C32(0xd6070000), SPH_C32(0x92c10000), + SPH_C32(0x2b9801e0), SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), + SPH_C32(0x45312374), SPH_C32(0x201f6a64), SPH_C32(0x7b280000), + SPH_C32(0x57420000), SPH_C32(0xa9e50000), SPH_C32(0x634300a0), + SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), SPH_C32(0x27f83b03), + SPH_C32(0xc7ff60f0) }, + { SPH_C32(0x46490000), SPH_C32(0x40b90000), SPH_C32(0xcedc0000), + SPH_C32(0x2c4201e2), SPH_C32(0xe937bdff), SPH_C32(0x24f48bdd), + SPH_C32(0xfe57ab7c), SPH_C32(0xfa98ea64), SPH_C32(0xd0cf0000), + SPH_C32(0xc94f0000), SPH_C32(0x06c20000), SPH_C32(0x5e5b00a5), + SPH_C32(0xb2945bfc), SPH_C32(0x196f832e), SPH_C32(0x923b7ce8), + SPH_C32(0xfba29f0e) }, + { SPH_C32(0xef000000), SPH_C32(0x31850000), SPH_C32(0x7f3a0000), + SPH_C32(0xe49401eb), SPH_C32(0x1981a524), SPH_C32(0x87cf4f79), + SPH_C32(0x43074295), SPH_C32(0x7370f41f), SPH_C32(0xe9000000), + SPH_C32(0x8bc70000), SPH_C32(0xfe1f0000), SPH_C32(0x359f00a3), + SPH_C32(0x24326739), SPH_C32(0x377636b7), SPH_C32(0xb736cc51), + SPH_C32(0xbce91527) }, + { SPH_C32(0x47da0000), SPH_C32(0xa73b0000), SPH_C32(0x23270000), + SPH_C32(0xe34e01e9), SPH_C32(0x64e730a7), SPH_C32(0x98573ff3), + SPH_C32(0xf861ca9d), SPH_C32(0xa9f7741f), SPH_C32(0x42e70000), + SPH_C32(0x15ca0000), SPH_C32(0x51380000), SPH_C32(0x088700a6), + SPH_C32(0x087d78ea), SPH_C32(0x43802022), SPH_C32(0x02f58bba), + SPH_C32(0x80b4ead9) }, + { SPH_C32(0x7cbb0000), SPH_C32(0x0a820000), SPH_C32(0xc53b0000), + SPH_C32(0x7d4401e3), SPH_C32(0x2eb80b6a), SPH_C32(0x6183585b), + SPH_C32(0xd5ffd426), SPH_C32(0x5b091fb3), SPH_C32(0xe8930000), + SPH_C32(0x6c450000), SPH_C32(0x13e40000), SPH_C32(0xfa9300a8), + SPH_C32(0xa9e2ea61), SPH_C32(0x8bd58299), SPH_C32(0xb100adb0), + SPH_C32(0xef868b5c) }, + { SPH_C32(0xd4610000), SPH_C32(0x9c3c0000), SPH_C32(0x99260000), + SPH_C32(0x7a9e01e1), SPH_C32(0x53de9ee9), SPH_C32(0x7e1b28d1), + SPH_C32(0x6e995c2e), SPH_C32(0x818e9fb3), SPH_C32(0x43740000), + SPH_C32(0xf2480000), SPH_C32(0xbcc30000), SPH_C32(0xc78b00ad), + SPH_C32(0x85adf5b2), SPH_C32(0xff23940c), SPH_C32(0x04c3ea5b), + SPH_C32(0xd3db74a2) }, + { SPH_C32(0x7d280000), SPH_C32(0xed000000), SPH_C32(0x28c00000), + SPH_C32(0xb24801e8), SPH_C32(0xa3688632), SPH_C32(0xdd20ec75), + SPH_C32(0xd3c9b5c7), SPH_C32(0x086681c8), SPH_C32(0x7abb0000), + SPH_C32(0xb0c00000), SPH_C32(0x441e0000), SPH_C32(0xac4f00ab), + SPH_C32(0x130bc977), SPH_C32(0xd13a2195), SPH_C32(0x21ce5ae2), + SPH_C32(0x9490fe8b) }, + { SPH_C32(0xd5f20000), SPH_C32(0x7bbe0000), SPH_C32(0x74dd0000), + SPH_C32(0xb59201ea), SPH_C32(0xde0e13b1), SPH_C32(0xc2b89cff), + SPH_C32(0x68af3dcf), SPH_C32(0xd2e101c8), SPH_C32(0xd15c0000), + SPH_C32(0x2ecd0000), SPH_C32(0xeb390000), SPH_C32(0x915700ae), + SPH_C32(0x3f44d6a4), SPH_C32(0xa5cc3700), SPH_C32(0x940d1d09), + SPH_C32(0xa8cd0175) }, + { SPH_C32(0xb13b0000), SPH_C32(0x80040000), SPH_C32(0xd16f0000), + SPH_C32(0x4f6b01f3), SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), + SPH_C32(0x112fb6cb), SPH_C32(0xaebbb10d), SPH_C32(0x7b6c0000), + SPH_C32(0x280a0000), SPH_C32(0x73990000), SPH_C32(0x496000a1), + SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), SPH_C32(0x24f2a563), + SPH_C32(0x79f5076e) }, + { SPH_C32(0x19e10000), SPH_C32(0x16ba0000), SPH_C32(0x8d720000), + SPH_C32(0x48b101f1), SPH_C32(0xcc493b40), SPH_C32(0x37e51f93), + SPH_C32(0xaa493ec3), SPH_C32(0x743c310d), SPH_C32(0xd08b0000), + SPH_C32(0xb6070000), SPH_C32(0xdcbe0000), SPH_C32(0x747800a4), + SPH_C32(0x89399230), SPH_C32(0xb0d91fa9), SPH_C32(0x9131e288), + SPH_C32(0x45a8f890) }, + { SPH_C32(0xb0a80000), SPH_C32(0x67860000), SPH_C32(0x3c940000), + SPH_C32(0x806701f8), SPH_C32(0x3cff239b), SPH_C32(0x94dedb37), + SPH_C32(0x1719d72a), SPH_C32(0xfdd42f76), SPH_C32(0xe9440000), + SPH_C32(0xf48f0000), SPH_C32(0x24630000), SPH_C32(0x1fbc00a2), + SPH_C32(0x1f9faef5), SPH_C32(0x9ec0aa30), SPH_C32(0xb43c5231), + SPH_C32(0x02e372b9) }, + { SPH_C32(0x18720000), SPH_C32(0xf1380000), SPH_C32(0x60890000), + SPH_C32(0x87bd01fa), SPH_C32(0x4199b618), SPH_C32(0x8b46abbd), + SPH_C32(0xac7f5f22), SPH_C32(0x2753af76), SPH_C32(0x42a30000), + SPH_C32(0x6a820000), SPH_C32(0x8b440000), SPH_C32(0x22a400a7), + SPH_C32(0x33d0b126), SPH_C32(0xea36bca5), SPH_C32(0x01ff15da), + SPH_C32(0x3ebe8d47) }, + { SPH_C32(0x23130000), SPH_C32(0x5c810000), SPH_C32(0x86950000), + SPH_C32(0x19b701f0), SPH_C32(0x0bc68dd5), SPH_C32(0x7292cc15), + SPH_C32(0x81e14199), SPH_C32(0xd5adc4da), SPH_C32(0xe8d70000), + SPH_C32(0x130d0000), SPH_C32(0xc9980000), SPH_C32(0xd0b000a9), + SPH_C32(0x924f23ad), SPH_C32(0x22631e1e), SPH_C32(0xb20a33d0), + SPH_C32(0x518cecc2) }, + { SPH_C32(0x8bc90000), SPH_C32(0xca3f0000), SPH_C32(0xda880000), + SPH_C32(0x1e6d01f2), SPH_C32(0x76a01856), SPH_C32(0x6d0abc9f), + SPH_C32(0x3a87c991), SPH_C32(0x0f2a44da), SPH_C32(0x43300000), + SPH_C32(0x8d000000), SPH_C32(0x66bf0000), SPH_C32(0xeda800ac), + SPH_C32(0xbe003c7e), SPH_C32(0x5695088b), SPH_C32(0x07c9743b), + SPH_C32(0x6dd1133c) }, + { SPH_C32(0x22800000), SPH_C32(0xbb030000), SPH_C32(0x6b6e0000), + SPH_C32(0xd6bb01fb), SPH_C32(0x8616008d), SPH_C32(0xce31783b), + SPH_C32(0x87d72078), SPH_C32(0x86c25aa1), SPH_C32(0x7aff0000), + SPH_C32(0xcf880000), SPH_C32(0x9e620000), SPH_C32(0x866c00aa), + SPH_C32(0x28a600bb), SPH_C32(0x788cbd12), SPH_C32(0x22c4c482), + SPH_C32(0x2a9a9915) }, + { SPH_C32(0x8a5a0000), SPH_C32(0x2dbd0000), SPH_C32(0x37730000), + SPH_C32(0xd16101f9), SPH_C32(0xfb70950e), SPH_C32(0xd1a908b1), + SPH_C32(0x3cb1a870), SPH_C32(0x5c45daa1), SPH_C32(0xd1180000), + SPH_C32(0x51850000), SPH_C32(0x31450000), SPH_C32(0xbb7400af), + SPH_C32(0x04e91f68), SPH_C32(0x0c7aab87), SPH_C32(0x97078369), + SPH_C32(0x16c766eb) }, + { SPH_C32(0xeed70000), SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), + SPH_C32(0x01bb01e1), SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), + SPH_C32(0x463bbd14), SPH_C32(0x9e150dfa), SPH_C32(0x24c40000), + SPH_C32(0x7e090000), SPH_C32(0x30370000), SPH_C32(0x2d9300b2), + SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), SPH_C32(0x70ec30dc), + SPH_C32(0xf751dc07) }, + { SPH_C32(0x460d0000), SPH_C32(0x3ff10000), SPH_C32(0x14a00000), + SPH_C32(0x066101e3), SPH_C32(0xd29a7433), SPH_C32(0x8d42175a), + SPH_C32(0xfd5d351c), SPH_C32(0x44928dfa), SPH_C32(0x8f230000), + SPH_C32(0xe0040000), SPH_C32(0x9f100000), SPH_C32(0x108b00b7), + SPH_C32(0xac47148f), SPH_C32(0xa3c88be7), SPH_C32(0xc52f7737), + SPH_C32(0xcb0c23f9) }, + { SPH_C32(0xef440000), SPH_C32(0x4ecd0000), SPH_C32(0xa5460000), + SPH_C32(0xceb701ea), SPH_C32(0x222c6ce8), SPH_C32(0x2e79d3fe), + SPH_C32(0x400ddcf5), SPH_C32(0xcd7a9381), SPH_C32(0xb6ec0000), + SPH_C32(0xa28c0000), SPH_C32(0x67cd0000), SPH_C32(0x7b4f00b1), + SPH_C32(0x3ae1284a), SPH_C32(0x8dd13e7e), SPH_C32(0xe022c78e), + SPH_C32(0x8c47a9d0) }, + { SPH_C32(0x479e0000), SPH_C32(0xd8730000), SPH_C32(0xf95b0000), + SPH_C32(0xc96d01e8), SPH_C32(0x5f4af96b), SPH_C32(0x31e1a374), + SPH_C32(0xfb6b54fd), SPH_C32(0x17fd1381), SPH_C32(0x1d0b0000), + SPH_C32(0x3c810000), SPH_C32(0xc8ea0000), SPH_C32(0x465700b4), + SPH_C32(0x16ae3799), SPH_C32(0xf92728eb), SPH_C32(0x55e18065), + SPH_C32(0xb01a562e) }, + { SPH_C32(0x7cff0000), SPH_C32(0x75ca0000), SPH_C32(0x1f470000), + SPH_C32(0x576701e2), SPH_C32(0x1515c2a6), SPH_C32(0xc835c4dc), + SPH_C32(0xd6f54a46), SPH_C32(0xe503782d), SPH_C32(0xb77f0000), + SPH_C32(0x450e0000), SPH_C32(0x8a360000), SPH_C32(0xb44300ba), + SPH_C32(0xb731a512), SPH_C32(0x31728a50), SPH_C32(0xe614a66f), + SPH_C32(0xdf2837ab) }, + { SPH_C32(0xd4250000), SPH_C32(0xe3740000), SPH_C32(0x435a0000), + SPH_C32(0x50bd01e0), SPH_C32(0x68735725), SPH_C32(0xd7adb456), + SPH_C32(0x6d93c24e), SPH_C32(0x3f84f82d), SPH_C32(0x1c980000), + SPH_C32(0xdb030000), SPH_C32(0x25110000), SPH_C32(0x895b00bf), + SPH_C32(0x9b7ebac1), SPH_C32(0x45849cc5), SPH_C32(0x53d7e184), + SPH_C32(0xe375c855) }, + { SPH_C32(0x7d6c0000), SPH_C32(0x92480000), SPH_C32(0xf2bc0000), + SPH_C32(0x986b01e9), SPH_C32(0x98c54ffe), SPH_C32(0x749670f2), + SPH_C32(0xd0c32ba7), SPH_C32(0xb66ce656), SPH_C32(0x25570000), + SPH_C32(0x998b0000), SPH_C32(0xddcc0000), SPH_C32(0xe29f00b9), + SPH_C32(0x0dd88604), SPH_C32(0x6b9d295c), SPH_C32(0x76da513d), + SPH_C32(0xa43e427c) }, + { SPH_C32(0xd5b60000), SPH_C32(0x04f60000), SPH_C32(0xaea10000), + SPH_C32(0x9fb101eb), SPH_C32(0xe5a3da7d), SPH_C32(0x6b0e0078), + SPH_C32(0x6ba5a3af), SPH_C32(0x6ceb6656), SPH_C32(0x8eb00000), + SPH_C32(0x07860000), SPH_C32(0x72eb0000), SPH_C32(0xdf8700bc), + SPH_C32(0x219799d7), SPH_C32(0x1f6b3fc9), SPH_C32(0xc31916d6), + SPH_C32(0x9863bd82) }, + { SPH_C32(0xb17f0000), SPH_C32(0xff4c0000), SPH_C32(0x0b130000), + SPH_C32(0x654801f2), SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), + SPH_C32(0x122528ab), SPH_C32(0x10b1d693), SPH_C32(0x24800000), + SPH_C32(0x01410000), SPH_C32(0xea4b0000), SPH_C32(0x07b000b3), + SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), SPH_C32(0x73e6aebc), + SPH_C32(0x495bbb99) }, + { SPH_C32(0x19a50000), SPH_C32(0x69f20000), SPH_C32(0x570e0000), + SPH_C32(0x629201f0), SPH_C32(0xf7e4f28c), SPH_C32(0x9e538314), + SPH_C32(0xa943a0a3), SPH_C32(0xca365693), SPH_C32(0x8f670000), + SPH_C32(0x9f4c0000), SPH_C32(0x456c0000), SPH_C32(0x3aa800b6), + SPH_C32(0x97eadd43), SPH_C32(0x0a7e1760), SPH_C32(0xc625e957), + SPH_C32(0x75064467) }, + { SPH_C32(0xb0ec0000), SPH_C32(0x18ce0000), SPH_C32(0xe6e80000), + SPH_C32(0xaa4401f9), SPH_C32(0x0752ea57), SPH_C32(0x3d6847b0), + SPH_C32(0x1413494a), SPH_C32(0x43de48e8), SPH_C32(0xb6a80000), + SPH_C32(0xddc40000), SPH_C32(0xbdb10000), SPH_C32(0x516c00b0), + SPH_C32(0x014ce186), SPH_C32(0x2467a2f9), SPH_C32(0xe32859ee), + SPH_C32(0x324dce4e) }, + { SPH_C32(0x18360000), SPH_C32(0x8e700000), SPH_C32(0xbaf50000), + SPH_C32(0xad9e01fb), SPH_C32(0x7a347fd4), SPH_C32(0x22f0373a), + SPH_C32(0xaf75c142), SPH_C32(0x9959c8e8), SPH_C32(0x1d4f0000), + SPH_C32(0x43c90000), SPH_C32(0x12960000), SPH_C32(0x6c7400b5), + SPH_C32(0x2d03fe55), SPH_C32(0x5091b46c), SPH_C32(0x56eb1e05), + SPH_C32(0x0e1031b0) }, + { SPH_C32(0x23570000), SPH_C32(0x23c90000), SPH_C32(0x5ce90000), + SPH_C32(0x339401f1), SPH_C32(0x306b4419), SPH_C32(0xdb245092), + SPH_C32(0x82ebdff9), SPH_C32(0x6ba7a344), SPH_C32(0xb73b0000), + SPH_C32(0x3a460000), SPH_C32(0x504a0000), SPH_C32(0x9e6000bb), + SPH_C32(0x8c9c6cde), SPH_C32(0x98c416d7), SPH_C32(0xe51e380f), + SPH_C32(0x61225035) }, + { SPH_C32(0x8b8d0000), SPH_C32(0xb5770000), SPH_C32(0x00f40000), + SPH_C32(0x344e01f3), SPH_C32(0x4d0dd19a), SPH_C32(0xc4bc2018), + SPH_C32(0x398d57f1), SPH_C32(0xb1202344), SPH_C32(0x1cdc0000), + SPH_C32(0xa44b0000), SPH_C32(0xff6d0000), SPH_C32(0xa37800be), + SPH_C32(0xa0d3730d), SPH_C32(0xec320042), SPH_C32(0x50dd7fe4), + SPH_C32(0x5d7fafcb) }, + { SPH_C32(0x22c40000), SPH_C32(0xc44b0000), SPH_C32(0xb1120000), + SPH_C32(0xfc9801fa), SPH_C32(0xbdbbc941), SPH_C32(0x6787e4bc), + SPH_C32(0x84ddbe18), SPH_C32(0x38c83d3f), SPH_C32(0x25130000), + SPH_C32(0xe6c30000), SPH_C32(0x07b00000), SPH_C32(0xc8bc00b8), + SPH_C32(0x36754fc8), SPH_C32(0xc22bb5db), SPH_C32(0x75d0cf5d), + SPH_C32(0x1a3425e2) }, + { SPH_C32(0x8a1e0000), SPH_C32(0x52f50000), SPH_C32(0xed0f0000), + SPH_C32(0xfb4201f8), SPH_C32(0xc0dd5cc2), SPH_C32(0x781f9436), + SPH_C32(0x3fbb3610), SPH_C32(0xe24fbd3f), SPH_C32(0x8ef40000), + SPH_C32(0x78ce0000), SPH_C32(0xa8970000), SPH_C32(0xf5a400bd), + SPH_C32(0x1a3a501b), SPH_C32(0xb6dda34e), SPH_C32(0xc01388b6), + SPH_C32(0x2669da1c) }, + { SPH_C32(0x7b280000), SPH_C32(0x57420000), SPH_C32(0xa9e50000), + SPH_C32(0x634300a0), SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), + SPH_C32(0x27f83b03), SPH_C32(0xc7ff60f0), SPH_C32(0x95bb0000), + SPH_C32(0x81450000), SPH_C32(0x3b240000), SPH_C32(0x48db0140), + SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), SPH_C32(0x62c91877), + SPH_C32(0xe7e00a94) }, + { SPH_C32(0xd3f20000), SPH_C32(0xc1fc0000), SPH_C32(0xf5f80000), + SPH_C32(0x649900a2), SPH_C32(0xe3bdd1ac), SPH_C32(0x7201e531), + SPH_C32(0x9c9eb30b), SPH_C32(0x1d78e0f0), SPH_C32(0x3e5c0000), + SPH_C32(0x1f480000), SPH_C32(0x94030000), SPH_C32(0x75c30145), + SPH_C32(0x26c57380), SPH_C32(0x22037879), SPH_C32(0xd70a5f9c), + SPH_C32(0xdbbdf56a) }, + { SPH_C32(0x7abb0000), SPH_C32(0xb0c00000), SPH_C32(0x441e0000), + SPH_C32(0xac4f00ab), SPH_C32(0x130bc977), SPH_C32(0xd13a2195), + SPH_C32(0x21ce5ae2), SPH_C32(0x9490fe8b), SPH_C32(0x07930000), + SPH_C32(0x5dc00000), SPH_C32(0x6cde0000), SPH_C32(0x1e070143), + SPH_C32(0xb0634f45), SPH_C32(0x0c1acde0), SPH_C32(0xf207ef25), + SPH_C32(0x9cf67f43) }, + { SPH_C32(0xd2610000), SPH_C32(0x267e0000), SPH_C32(0x18030000), + SPH_C32(0xab9500a9), SPH_C32(0x6e6d5cf4), SPH_C32(0xcea2511f), + SPH_C32(0x9aa8d2ea), SPH_C32(0x4e177e8b), SPH_C32(0xac740000), + SPH_C32(0xc3cd0000), SPH_C32(0xc3f90000), SPH_C32(0x231f0146), + SPH_C32(0x9c2c5096), SPH_C32(0x78ecdb75), SPH_C32(0x47c4a8ce), + SPH_C32(0xa0ab80bd) }, + { SPH_C32(0xe9000000), SPH_C32(0x8bc70000), SPH_C32(0xfe1f0000), + SPH_C32(0x359f00a3), SPH_C32(0x24326739), SPH_C32(0x377636b7), + SPH_C32(0xb736cc51), SPH_C32(0xbce91527), SPH_C32(0x06000000), + SPH_C32(0xba420000), SPH_C32(0x81250000), SPH_C32(0xd10b0148), + SPH_C32(0x3db3c21d), SPH_C32(0xb0b979ce), SPH_C32(0xf4318ec4), + SPH_C32(0xcf99e138) }, + { SPH_C32(0x41da0000), SPH_C32(0x1d790000), SPH_C32(0xa2020000), + SPH_C32(0x324500a1), SPH_C32(0x5954f2ba), SPH_C32(0x28ee463d), + SPH_C32(0x0c504459), SPH_C32(0x666e9527), SPH_C32(0xade70000), + SPH_C32(0x244f0000), SPH_C32(0x2e020000), SPH_C32(0xec13014d), + SPH_C32(0x11fcddce), SPH_C32(0xc44f6f5b), SPH_C32(0x41f2c92f), + SPH_C32(0xf3c41ec6) }, + { SPH_C32(0xe8930000), SPH_C32(0x6c450000), SPH_C32(0x13e40000), + SPH_C32(0xfa9300a8), SPH_C32(0xa9e2ea61), SPH_C32(0x8bd58299), + SPH_C32(0xb100adb0), SPH_C32(0xef868b5c), SPH_C32(0x94280000), + SPH_C32(0x66c70000), SPH_C32(0xd6df0000), SPH_C32(0x87d7014b), + SPH_C32(0x875ae10b), SPH_C32(0xea56dac2), SPH_C32(0x64ff7996), + SPH_C32(0xb48f94ef) }, + { SPH_C32(0x40490000), SPH_C32(0xfafb0000), SPH_C32(0x4ff90000), + SPH_C32(0xfd4900aa), SPH_C32(0xd4847fe2), SPH_C32(0x944df213), + SPH_C32(0x0a6625b8), SPH_C32(0x35010b5c), SPH_C32(0x3fcf0000), + SPH_C32(0xf8ca0000), SPH_C32(0x79f80000), SPH_C32(0xbacf014e), + SPH_C32(0xab15fed8), SPH_C32(0x9ea0cc57), SPH_C32(0xd13c3e7d), + SPH_C32(0x88d26b11) }, + { SPH_C32(0x24800000), SPH_C32(0x01410000), SPH_C32(0xea4b0000), + SPH_C32(0x07b000b3), SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), + SPH_C32(0x73e6aebc), SPH_C32(0x495bbb99), SPH_C32(0x95ff0000), + SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), SPH_C32(0x62f80141), + SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), SPH_C32(0x61c38617), + SPH_C32(0x59ea6d0a) }, + { SPH_C32(0x8c5a0000), SPH_C32(0x97ff0000), SPH_C32(0xb6560000), + SPH_C32(0x006a00b1), SPH_C32(0xc6c35713), SPH_C32(0x6110717f), + SPH_C32(0xc88026b4), SPH_C32(0x93dc3b99), SPH_C32(0x3e180000), + SPH_C32(0x60000000), SPH_C32(0x4e7f0000), SPH_C32(0x5fe00144), + SPH_C32(0x1d68ba4c), SPH_C32(0x8bb5e4fe), SPH_C32(0xd400c1fc), + SPH_C32(0x65b792f4) }, + { SPH_C32(0x25130000), SPH_C32(0xe6c30000), SPH_C32(0x07b00000), + SPH_C32(0xc8bc00b8), SPH_C32(0x36754fc8), SPH_C32(0xc22bb5db), + SPH_C32(0x75d0cf5d), SPH_C32(0x1a3425e2), SPH_C32(0x07d70000), + SPH_C32(0x22880000), SPH_C32(0xb6a20000), SPH_C32(0x34240142), + SPH_C32(0x8bce8689), SPH_C32(0xa5ac5167), SPH_C32(0xf10d7145), + SPH_C32(0x22fc18dd) }, + { SPH_C32(0x8dc90000), SPH_C32(0x707d0000), SPH_C32(0x5bad0000), + SPH_C32(0xcf6600ba), SPH_C32(0x4b13da4b), SPH_C32(0xddb3c551), + SPH_C32(0xceb64755), SPH_C32(0xc0b3a5e2), SPH_C32(0xac300000), + SPH_C32(0xbc850000), SPH_C32(0x19850000), SPH_C32(0x093c0147), + SPH_C32(0xa781995a), SPH_C32(0xd15a47f2), SPH_C32(0x44ce36ae), + SPH_C32(0x1ea1e723) }, + { SPH_C32(0xb6a80000), SPH_C32(0xddc40000), SPH_C32(0xbdb10000), + SPH_C32(0x516c00b0), SPH_C32(0x014ce186), SPH_C32(0x2467a2f9), + SPH_C32(0xe32859ee), SPH_C32(0x324dce4e), SPH_C32(0x06440000), + SPH_C32(0xc50a0000), SPH_C32(0x5b590000), SPH_C32(0xfb280149), + SPH_C32(0x061e0bd1), SPH_C32(0x190fe549), SPH_C32(0xf73b10a4), + SPH_C32(0x719386a6) }, + { SPH_C32(0x1e720000), SPH_C32(0x4b7a0000), SPH_C32(0xe1ac0000), + SPH_C32(0x56b600b2), SPH_C32(0x7c2a7405), SPH_C32(0x3bffd273), + SPH_C32(0x584ed1e6), SPH_C32(0xe8ca4e4e), SPH_C32(0xada30000), + SPH_C32(0x5b070000), SPH_C32(0xf47e0000), SPH_C32(0xc630014c), + SPH_C32(0x2a511402), SPH_C32(0x6df9f3dc), SPH_C32(0x42f8574f), + SPH_C32(0x4dce7958) }, + { SPH_C32(0xb73b0000), SPH_C32(0x3a460000), SPH_C32(0x504a0000), + SPH_C32(0x9e6000bb), SPH_C32(0x8c9c6cde), SPH_C32(0x98c416d7), + SPH_C32(0xe51e380f), SPH_C32(0x61225035), SPH_C32(0x946c0000), + SPH_C32(0x198f0000), SPH_C32(0x0ca30000), SPH_C32(0xadf4014a), + SPH_C32(0xbcf728c7), SPH_C32(0x43e04645), SPH_C32(0x67f5e7f6), + SPH_C32(0x0a85f371) }, + { SPH_C32(0x1fe10000), SPH_C32(0xacf80000), SPH_C32(0x0c570000), + SPH_C32(0x99ba00b9), SPH_C32(0xf1faf95d), SPH_C32(0x875c665d), + SPH_C32(0x5e78b007), SPH_C32(0xbba5d035), SPH_C32(0x3f8b0000), + SPH_C32(0x87820000), SPH_C32(0xa3840000), SPH_C32(0x90ec014f), + SPH_C32(0x90b83714), SPH_C32(0x371650d0), SPH_C32(0xd236a01d), + SPH_C32(0x36d80c8f) }, + { SPH_C32(0x7b6c0000), SPH_C32(0x280a0000), SPH_C32(0x73990000), + SPH_C32(0x496000a1), SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), + SPH_C32(0x24f2a563), SPH_C32(0x79f5076e), SPH_C32(0xca570000), + SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), SPH_C32(0x060b0152), + SPH_C32(0x14592320), SPH_C32(0xec526625), SPH_C32(0x35dd13a8), + SPH_C32(0xd74eb663) }, + { SPH_C32(0xd3b60000), SPH_C32(0xbeb40000), SPH_C32(0x2f840000), + SPH_C32(0x4eba00a3), SPH_C32(0xd8101860), SPH_C32(0xdbb779b6), + SPH_C32(0x9f942d6b), SPH_C32(0xa372876e), SPH_C32(0x61b00000), + SPH_C32(0x36030000), SPH_C32(0x0dd10000), SPH_C32(0x3b130157), + SPH_C32(0x38163cf3), SPH_C32(0x98a470b0), SPH_C32(0x801e5443), + SPH_C32(0xeb13499d) }, + { SPH_C32(0x7aff0000), SPH_C32(0xcf880000), SPH_C32(0x9e620000), + SPH_C32(0x866c00aa), SPH_C32(0x28a600bb), SPH_C32(0x788cbd12), + SPH_C32(0x22c4c482), SPH_C32(0x2a9a9915), SPH_C32(0x587f0000), + SPH_C32(0x748b0000), SPH_C32(0xf50c0000), SPH_C32(0x50d70151), + SPH_C32(0xaeb00036), SPH_C32(0xb6bdc529), SPH_C32(0xa513e4fa), + SPH_C32(0xac58c3b4) }, + { SPH_C32(0xd2250000), SPH_C32(0x59360000), SPH_C32(0xc27f0000), + SPH_C32(0x81b600a8), SPH_C32(0x55c09538), SPH_C32(0x6714cd98), + SPH_C32(0x99a24c8a), SPH_C32(0xf01d1915), SPH_C32(0xf3980000), + SPH_C32(0xea860000), SPH_C32(0x5a2b0000), SPH_C32(0x6dcf0154), + SPH_C32(0x82ff1fe5), SPH_C32(0xc24bd3bc), SPH_C32(0x10d0a311), + SPH_C32(0x90053c4a) }, + { SPH_C32(0xe9440000), SPH_C32(0xf48f0000), SPH_C32(0x24630000), + SPH_C32(0x1fbc00a2), SPH_C32(0x1f9faef5), SPH_C32(0x9ec0aa30), + SPH_C32(0xb43c5231), SPH_C32(0x02e372b9), SPH_C32(0x59ec0000), + SPH_C32(0x93090000), SPH_C32(0x18f70000), SPH_C32(0x9fdb015a), + SPH_C32(0x23608d6e), SPH_C32(0x0a1e7107), SPH_C32(0xa325851b), + SPH_C32(0xff375dcf) }, + { SPH_C32(0x419e0000), SPH_C32(0x62310000), SPH_C32(0x787e0000), + SPH_C32(0x186600a0), SPH_C32(0x62f93b76), SPH_C32(0x8158daba), + SPH_C32(0x0f5ada39), SPH_C32(0xd864f2b9), SPH_C32(0xf20b0000), + SPH_C32(0x0d040000), SPH_C32(0xb7d00000), SPH_C32(0xa2c3015f), + SPH_C32(0x0f2f92bd), SPH_C32(0x7ee86792), SPH_C32(0x16e6c2f0), + SPH_C32(0xc36aa231) }, + { SPH_C32(0xe8d70000), SPH_C32(0x130d0000), SPH_C32(0xc9980000), + SPH_C32(0xd0b000a9), SPH_C32(0x924f23ad), SPH_C32(0x22631e1e), + SPH_C32(0xb20a33d0), SPH_C32(0x518cecc2), SPH_C32(0xcbc40000), + SPH_C32(0x4f8c0000), SPH_C32(0x4f0d0000), SPH_C32(0xc9070159), + SPH_C32(0x9989ae78), SPH_C32(0x50f1d20b), SPH_C32(0x33eb7249), + SPH_C32(0x84212818) }, + { SPH_C32(0x400d0000), SPH_C32(0x85b30000), SPH_C32(0x95850000), + SPH_C32(0xd76a00ab), SPH_C32(0xef29b62e), SPH_C32(0x3dfb6e94), + SPH_C32(0x096cbbd8), SPH_C32(0x8b0b6cc2), SPH_C32(0x60230000), + SPH_C32(0xd1810000), SPH_C32(0xe02a0000), SPH_C32(0xf41f015c), + SPH_C32(0xb5c6b1ab), SPH_C32(0x2407c49e), SPH_C32(0x862835a2), + SPH_C32(0xb87cd7e6) }, + { SPH_C32(0x24c40000), SPH_C32(0x7e090000), SPH_C32(0x30370000), + SPH_C32(0x2d9300b2), SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), + SPH_C32(0x70ec30dc), SPH_C32(0xf751dc07), SPH_C32(0xca130000), + SPH_C32(0xd7460000), SPH_C32(0x788a0000), SPH_C32(0x2c280153), + SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), SPH_C32(0x36d78dc8), + SPH_C32(0x6944d1fd) }, + { SPH_C32(0x8c1e0000), SPH_C32(0xe8b70000), SPH_C32(0x6c2a0000), + SPH_C32(0x2a4900b0), SPH_C32(0xfd6e9edf), SPH_C32(0xc8a6edf8), + SPH_C32(0xcb8ab8d4), SPH_C32(0x2dd65c07), SPH_C32(0x61f40000), + SPH_C32(0x494b0000), SPH_C32(0xd7ad0000), SPH_C32(0x11300156), + SPH_C32(0x03bbf53f), SPH_C32(0x3112ec37), SPH_C32(0x8314ca23), + SPH_C32(0x55192e03) }, + { SPH_C32(0x25570000), SPH_C32(0x998b0000), SPH_C32(0xddcc0000), + SPH_C32(0xe29f00b9), SPH_C32(0x0dd88604), SPH_C32(0x6b9d295c), + SPH_C32(0x76da513d), SPH_C32(0xa43e427c), SPH_C32(0x583b0000), + SPH_C32(0x0bc30000), SPH_C32(0x2f700000), SPH_C32(0x7af40150), + SPH_C32(0x951dc9fa), SPH_C32(0x1f0b59ae), SPH_C32(0xa6197a9a), + SPH_C32(0x1252a42a) }, + { SPH_C32(0x8d8d0000), SPH_C32(0x0f350000), SPH_C32(0x81d10000), + SPH_C32(0xe54500bb), SPH_C32(0x70be1387), SPH_C32(0x740559d6), + SPH_C32(0xcdbcd935), SPH_C32(0x7eb9c27c), SPH_C32(0xf3dc0000), + SPH_C32(0x95ce0000), SPH_C32(0x80570000), SPH_C32(0x47ec0155), + SPH_C32(0xb952d629), SPH_C32(0x6bfd4f3b), SPH_C32(0x13da3d71), + SPH_C32(0x2e0f5bd4) }, + { SPH_C32(0xb6ec0000), SPH_C32(0xa28c0000), SPH_C32(0x67cd0000), + SPH_C32(0x7b4f00b1), SPH_C32(0x3ae1284a), SPH_C32(0x8dd13e7e), + SPH_C32(0xe022c78e), SPH_C32(0x8c47a9d0), SPH_C32(0x59a80000), + SPH_C32(0xec410000), SPH_C32(0xc28b0000), SPH_C32(0xb5f8015b), + SPH_C32(0x18cd44a2), SPH_C32(0xa3a8ed80), SPH_C32(0xa02f1b7b), + SPH_C32(0x413d3a51) }, + { SPH_C32(0x1e360000), SPH_C32(0x34320000), SPH_C32(0x3bd00000), + SPH_C32(0x7c9500b3), SPH_C32(0x4787bdc9), SPH_C32(0x92494ef4), + SPH_C32(0x5b444f86), SPH_C32(0x56c029d0), SPH_C32(0xf24f0000), + SPH_C32(0x724c0000), SPH_C32(0x6dac0000), SPH_C32(0x88e0015e), + SPH_C32(0x34825b71), SPH_C32(0xd75efb15), SPH_C32(0x15ec5c90), + SPH_C32(0x7d60c5af) }, + { SPH_C32(0xb77f0000), SPH_C32(0x450e0000), SPH_C32(0x8a360000), + SPH_C32(0xb44300ba), SPH_C32(0xb731a512), SPH_C32(0x31728a50), + SPH_C32(0xe614a66f), SPH_C32(0xdf2837ab), SPH_C32(0xcb800000), + SPH_C32(0x30c40000), SPH_C32(0x95710000), SPH_C32(0xe3240158), + SPH_C32(0xa22467b4), SPH_C32(0xf9474e8c), SPH_C32(0x30e1ec29), + SPH_C32(0x3a2b4f86) }, + { SPH_C32(0x1fa50000), SPH_C32(0xd3b00000), SPH_C32(0xd62b0000), + SPH_C32(0xb39900b8), SPH_C32(0xca573091), SPH_C32(0x2eeafada), + SPH_C32(0x5d722e67), SPH_C32(0x05afb7ab), SPH_C32(0x60670000), + SPH_C32(0xaec90000), SPH_C32(0x3a560000), SPH_C32(0xde3c015d), + SPH_C32(0x8e6b7867), SPH_C32(0x8db15819), SPH_C32(0x8522abc2), + SPH_C32(0x0676b078) }, + { SPH_C32(0x95bb0000), SPH_C32(0x81450000), SPH_C32(0x3b240000), + SPH_C32(0x48db0140), SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), + SPH_C32(0x62c91877), SPH_C32(0xe7e00a94), SPH_C32(0xee930000), + SPH_C32(0xd6070000), SPH_C32(0x92c10000), SPH_C32(0x2b9801e0), + SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), SPH_C32(0x45312374), + SPH_C32(0x201f6a64) }, + { SPH_C32(0x3d610000), SPH_C32(0x17fb0000), SPH_C32(0x67390000), + SPH_C32(0x4f010142), SPH_C32(0x77ecf9d0), SPH_C32(0x496d1e66), + SPH_C32(0xd9af907f), SPH_C32(0x3d678a94), SPH_C32(0x45740000), + SPH_C32(0x480a0000), SPH_C32(0x3de60000), SPH_C32(0x168001e5), + SPH_C32(0xb81e37af), SPH_C32(0x4f9aedc2), SPH_C32(0xf0f2649f), + SPH_C32(0x1c42959a) }, + { SPH_C32(0x94280000), SPH_C32(0x66c70000), SPH_C32(0xd6df0000), + SPH_C32(0x87d7014b), SPH_C32(0x875ae10b), SPH_C32(0xea56dac2), + SPH_C32(0x64ff7996), SPH_C32(0xb48f94ef), SPH_C32(0x7cbb0000), + SPH_C32(0x0a820000), SPH_C32(0xc53b0000), SPH_C32(0x7d4401e3), + SPH_C32(0x2eb80b6a), SPH_C32(0x6183585b), SPH_C32(0xd5ffd426), + SPH_C32(0x5b091fb3) }, + { SPH_C32(0x3cf20000), SPH_C32(0xf0790000), SPH_C32(0x8ac20000), + SPH_C32(0x800d0149), SPH_C32(0xfa3c7488), SPH_C32(0xf5ceaa48), + SPH_C32(0xdf99f19e), SPH_C32(0x6e0814ef), SPH_C32(0xd75c0000), + SPH_C32(0x948f0000), SPH_C32(0x6a1c0000), SPH_C32(0x405c01e6), + SPH_C32(0x02f714b9), SPH_C32(0x15754ece), SPH_C32(0x603c93cd), + SPH_C32(0x6754e04d) }, + { SPH_C32(0x07930000), SPH_C32(0x5dc00000), SPH_C32(0x6cde0000), + SPH_C32(0x1e070143), SPH_C32(0xb0634f45), SPH_C32(0x0c1acde0), + SPH_C32(0xf207ef25), SPH_C32(0x9cf67f43), SPH_C32(0x7d280000), + SPH_C32(0xed000000), SPH_C32(0x28c00000), SPH_C32(0xb24801e8), + SPH_C32(0xa3688632), SPH_C32(0xdd20ec75), SPH_C32(0xd3c9b5c7), + SPH_C32(0x086681c8) }, + { SPH_C32(0xaf490000), SPH_C32(0xcb7e0000), SPH_C32(0x30c30000), + SPH_C32(0x19dd0141), SPH_C32(0xcd05dac6), SPH_C32(0x1382bd6a), + SPH_C32(0x4961672d), SPH_C32(0x4671ff43), SPH_C32(0xd6cf0000), + SPH_C32(0x730d0000), SPH_C32(0x87e70000), SPH_C32(0x8f5001ed), + SPH_C32(0x8f2799e1), SPH_C32(0xa9d6fae0), SPH_C32(0x660af22c), + SPH_C32(0x343b7e36) }, + { SPH_C32(0x06000000), SPH_C32(0xba420000), SPH_C32(0x81250000), + SPH_C32(0xd10b0148), SPH_C32(0x3db3c21d), SPH_C32(0xb0b979ce), + SPH_C32(0xf4318ec4), SPH_C32(0xcf99e138), SPH_C32(0xef000000), + SPH_C32(0x31850000), SPH_C32(0x7f3a0000), SPH_C32(0xe49401eb), + SPH_C32(0x1981a524), SPH_C32(0x87cf4f79), SPH_C32(0x43074295), + SPH_C32(0x7370f41f) }, + { SPH_C32(0xaeda0000), SPH_C32(0x2cfc0000), SPH_C32(0xdd380000), + SPH_C32(0xd6d1014a), SPH_C32(0x40d5579e), SPH_C32(0xaf210944), + SPH_C32(0x4f5706cc), SPH_C32(0x151e6138), SPH_C32(0x44e70000), + SPH_C32(0xaf880000), SPH_C32(0xd01d0000), SPH_C32(0xd98c01ee), + SPH_C32(0x35cebaf7), SPH_C32(0xf33959ec), SPH_C32(0xf6c4057e), + SPH_C32(0x4f2d0be1) }, + { SPH_C32(0xca130000), SPH_C32(0xd7460000), SPH_C32(0x788a0000), + SPH_C32(0x2c280153), SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), + SPH_C32(0x36d78dc8), SPH_C32(0x6944d1fd), SPH_C32(0xeed70000), + SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), SPH_C32(0x01bb01e1), + SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), SPH_C32(0x463bbd14), + SPH_C32(0x9e150dfa) }, + { SPH_C32(0x62c90000), SPH_C32(0x41f80000), SPH_C32(0x24970000), + SPH_C32(0x2bf20151), SPH_C32(0x52927f6f), SPH_C32(0x5a7c8a28), + SPH_C32(0x8db105c0), SPH_C32(0xb3c351fd), SPH_C32(0x45300000), + SPH_C32(0x37420000), SPH_C32(0xe79a0000), SPH_C32(0x3ca301e4), + SPH_C32(0x83b3fe63), SPH_C32(0xe62c7145), SPH_C32(0xf3f8faff), + SPH_C32(0xa248f204) }, + { SPH_C32(0xcb800000), SPH_C32(0x30c40000), SPH_C32(0x95710000), + SPH_C32(0xe3240158), SPH_C32(0xa22467b4), SPH_C32(0xf9474e8c), + SPH_C32(0x30e1ec29), SPH_C32(0x3a2b4f86), SPH_C32(0x7cff0000), + SPH_C32(0x75ca0000), SPH_C32(0x1f470000), SPH_C32(0x576701e2), + SPH_C32(0x1515c2a6), SPH_C32(0xc835c4dc), SPH_C32(0xd6f54a46), + SPH_C32(0xe503782d) }, + { SPH_C32(0x635a0000), SPH_C32(0xa67a0000), SPH_C32(0xc96c0000), + SPH_C32(0xe4fe015a), SPH_C32(0xdf42f237), SPH_C32(0xe6df3e06), + SPH_C32(0x8b876421), SPH_C32(0xe0accf86), SPH_C32(0xd7180000), + SPH_C32(0xebc70000), SPH_C32(0xb0600000), SPH_C32(0x6a7f01e7), + SPH_C32(0x395add75), SPH_C32(0xbcc3d249), SPH_C32(0x63360dad), + SPH_C32(0xd95e87d3) }, + { SPH_C32(0x583b0000), SPH_C32(0x0bc30000), SPH_C32(0x2f700000), + SPH_C32(0x7af40150), SPH_C32(0x951dc9fa), SPH_C32(0x1f0b59ae), + SPH_C32(0xa6197a9a), SPH_C32(0x1252a42a), SPH_C32(0x7d6c0000), + SPH_C32(0x92480000), SPH_C32(0xf2bc0000), SPH_C32(0x986b01e9), + SPH_C32(0x98c54ffe), SPH_C32(0x749670f2), SPH_C32(0xd0c32ba7), + SPH_C32(0xb66ce656) }, + { SPH_C32(0xf0e10000), SPH_C32(0x9d7d0000), SPH_C32(0x736d0000), + SPH_C32(0x7d2e0152), SPH_C32(0xe87b5c79), SPH_C32(0x00932924), + SPH_C32(0x1d7ff292), SPH_C32(0xc8d5242a), SPH_C32(0xd68b0000), + SPH_C32(0x0c450000), SPH_C32(0x5d9b0000), SPH_C32(0xa57301ec), + SPH_C32(0xb48a502d), SPH_C32(0x00606667), SPH_C32(0x65006c4c), + SPH_C32(0x8a3119a8) }, + { SPH_C32(0x59a80000), SPH_C32(0xec410000), SPH_C32(0xc28b0000), + SPH_C32(0xb5f8015b), SPH_C32(0x18cd44a2), SPH_C32(0xa3a8ed80), + SPH_C32(0xa02f1b7b), SPH_C32(0x413d3a51), SPH_C32(0xef440000), + SPH_C32(0x4ecd0000), SPH_C32(0xa5460000), SPH_C32(0xceb701ea), + SPH_C32(0x222c6ce8), SPH_C32(0x2e79d3fe), SPH_C32(0x400ddcf5), + SPH_C32(0xcd7a9381) }, + { SPH_C32(0xf1720000), SPH_C32(0x7aff0000), SPH_C32(0x9e960000), + SPH_C32(0xb2220159), SPH_C32(0x65abd121), SPH_C32(0xbc309d0a), + SPH_C32(0x1b499373), SPH_C32(0x9bbaba51), SPH_C32(0x44a30000), + SPH_C32(0xd0c00000), SPH_C32(0x0a610000), SPH_C32(0xf3af01ef), + SPH_C32(0x0e63733b), SPH_C32(0x5a8fc56b), SPH_C32(0xf5ce9b1e), + SPH_C32(0xf1276c7f) }, + { SPH_C32(0x95ff0000), SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), + SPH_C32(0x62f80141), SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), + SPH_C32(0x61c38617), SPH_C32(0x59ea6d0a), SPH_C32(0xb17f0000), + SPH_C32(0xff4c0000), SPH_C32(0x0b130000), SPH_C32(0x654801f2), + SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), SPH_C32(0x122528ab), + SPH_C32(0x10b1d693) }, + { SPH_C32(0x3d250000), SPH_C32(0x68b30000), SPH_C32(0xbd450000), + SPH_C32(0x65220143), SPH_C32(0x4c41301c), SPH_C32(0xe0db82e1), + SPH_C32(0xdaa50e1f), SPH_C32(0x836ded0a), SPH_C32(0x1a980000), + SPH_C32(0x61410000), SPH_C32(0xa4340000), SPH_C32(0x585001f7), + SPH_C32(0xa6cd78dc), SPH_C32(0xf53de50b), SPH_C32(0xa7e66f40), + SPH_C32(0x2cec296d) }, + { SPH_C32(0x946c0000), SPH_C32(0x198f0000), SPH_C32(0x0ca30000), + SPH_C32(0xadf4014a), SPH_C32(0xbcf728c7), SPH_C32(0x43e04645), + SPH_C32(0x67f5e7f6), SPH_C32(0x0a85f371), SPH_C32(0x23570000), + SPH_C32(0x23c90000), SPH_C32(0x5ce90000), SPH_C32(0x339401f1), + SPH_C32(0x306b4419), SPH_C32(0xdb245092), SPH_C32(0x82ebdff9), + SPH_C32(0x6ba7a344) }, + { SPH_C32(0x3cb60000), SPH_C32(0x8f310000), SPH_C32(0x50be0000), + SPH_C32(0xaa2e0148), SPH_C32(0xc191bd44), SPH_C32(0x5c7836cf), + SPH_C32(0xdc936ffe), SPH_C32(0xd0027371), SPH_C32(0x88b00000), + SPH_C32(0xbdc40000), SPH_C32(0xf3ce0000), SPH_C32(0x0e8c01f4), + SPH_C32(0x1c245bca), SPH_C32(0xafd24607), SPH_C32(0x37289812), + SPH_C32(0x57fa5cba) }, + { SPH_C32(0x07d70000), SPH_C32(0x22880000), SPH_C32(0xb6a20000), + SPH_C32(0x34240142), SPH_C32(0x8bce8689), SPH_C32(0xa5ac5167), + SPH_C32(0xf10d7145), SPH_C32(0x22fc18dd), SPH_C32(0x22c40000), + SPH_C32(0xc44b0000), SPH_C32(0xb1120000), SPH_C32(0xfc9801fa), + SPH_C32(0xbdbbc941), SPH_C32(0x6787e4bc), SPH_C32(0x84ddbe18), + SPH_C32(0x38c83d3f) }, + { SPH_C32(0xaf0d0000), SPH_C32(0xb4360000), SPH_C32(0xeabf0000), + SPH_C32(0x33fe0140), SPH_C32(0xf6a8130a), SPH_C32(0xba3421ed), + SPH_C32(0x4a6bf94d), SPH_C32(0xf87b98dd), SPH_C32(0x89230000), + SPH_C32(0x5a460000), SPH_C32(0x1e350000), SPH_C32(0xc18001ff), + SPH_C32(0x91f4d692), SPH_C32(0x1371f229), SPH_C32(0x311ef9f3), + SPH_C32(0x0495c2c1) }, + { SPH_C32(0x06440000), SPH_C32(0xc50a0000), SPH_C32(0x5b590000), + SPH_C32(0xfb280149), SPH_C32(0x061e0bd1), SPH_C32(0x190fe549), + SPH_C32(0xf73b10a4), SPH_C32(0x719386a6), SPH_C32(0xb0ec0000), + SPH_C32(0x18ce0000), SPH_C32(0xe6e80000), SPH_C32(0xaa4401f9), + SPH_C32(0x0752ea57), SPH_C32(0x3d6847b0), SPH_C32(0x1413494a), + SPH_C32(0x43de48e8) }, + { SPH_C32(0xae9e0000), SPH_C32(0x53b40000), SPH_C32(0x07440000), + SPH_C32(0xfcf2014b), SPH_C32(0x7b789e52), SPH_C32(0x069795c3), + SPH_C32(0x4c5d98ac), SPH_C32(0xab1406a6), SPH_C32(0x1b0b0000), + SPH_C32(0x86c30000), SPH_C32(0x49cf0000), SPH_C32(0x975c01fc), + SPH_C32(0x2b1df584), SPH_C32(0x499e5125), SPH_C32(0xa1d00ea1), + SPH_C32(0x7f83b716) }, + { SPH_C32(0xca570000), SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), + SPH_C32(0x060b0152), SPH_C32(0x14592320), SPH_C32(0xec526625), + SPH_C32(0x35dd13a8), SPH_C32(0xd74eb663), SPH_C32(0xb13b0000), + SPH_C32(0x80040000), SPH_C32(0xd16f0000), SPH_C32(0x4f6b01f3), + SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), SPH_C32(0x112fb6cb), + SPH_C32(0xaebbb10d) }, + { SPH_C32(0x628d0000), SPH_C32(0x3eb00000), SPH_C32(0xfeeb0000), + SPH_C32(0x01d10150), SPH_C32(0x693fb6a3), SPH_C32(0xf3ca16af), + SPH_C32(0x8ebb9ba0), SPH_C32(0x0dc93663), SPH_C32(0x1adc0000), + SPH_C32(0x1e090000), SPH_C32(0x7e480000), SPH_C32(0x727301f6), + SPH_C32(0x9d60b110), SPH_C32(0x5c8b798c), SPH_C32(0xa4ecf120), + SPH_C32(0x92e64ef3) }, + { SPH_C32(0xcbc40000), SPH_C32(0x4f8c0000), SPH_C32(0x4f0d0000), + SPH_C32(0xc9070159), SPH_C32(0x9989ae78), SPH_C32(0x50f1d20b), + SPH_C32(0x33eb7249), SPH_C32(0x84212818), SPH_C32(0x23130000), + SPH_C32(0x5c810000), SPH_C32(0x86950000), SPH_C32(0x19b701f0), + SPH_C32(0x0bc68dd5), SPH_C32(0x7292cc15), SPH_C32(0x81e14199), + SPH_C32(0xd5adc4da) }, + { SPH_C32(0x631e0000), SPH_C32(0xd9320000), SPH_C32(0x13100000), + SPH_C32(0xcedd015b), SPH_C32(0xe4ef3bfb), SPH_C32(0x4f69a281), + SPH_C32(0x888dfa41), SPH_C32(0x5ea6a818), SPH_C32(0x88f40000), + SPH_C32(0xc28c0000), SPH_C32(0x29b20000), SPH_C32(0x24af01f5), + SPH_C32(0x27899206), SPH_C32(0x0664da80), SPH_C32(0x34220672), + SPH_C32(0xe9f03b24) }, + { SPH_C32(0x587f0000), SPH_C32(0x748b0000), SPH_C32(0xf50c0000), + SPH_C32(0x50d70151), SPH_C32(0xaeb00036), SPH_C32(0xb6bdc529), + SPH_C32(0xa513e4fa), SPH_C32(0xac58c3b4), SPH_C32(0x22800000), + SPH_C32(0xbb030000), SPH_C32(0x6b6e0000), SPH_C32(0xd6bb01fb), + SPH_C32(0x8616008d), SPH_C32(0xce31783b), SPH_C32(0x87d72078), + SPH_C32(0x86c25aa1) }, + { SPH_C32(0xf0a50000), SPH_C32(0xe2350000), SPH_C32(0xa9110000), + SPH_C32(0x570d0153), SPH_C32(0xd3d695b5), SPH_C32(0xa925b5a3), + SPH_C32(0x1e756cf2), SPH_C32(0x76df43b4), SPH_C32(0x89670000), + SPH_C32(0x250e0000), SPH_C32(0xc4490000), SPH_C32(0xeba301fe), + SPH_C32(0xaa591f5e), SPH_C32(0xbac76eae), SPH_C32(0x32146793), + SPH_C32(0xba9fa55f) }, + { SPH_C32(0x59ec0000), SPH_C32(0x93090000), SPH_C32(0x18f70000), + SPH_C32(0x9fdb015a), SPH_C32(0x23608d6e), SPH_C32(0x0a1e7107), + SPH_C32(0xa325851b), SPH_C32(0xff375dcf), SPH_C32(0xb0a80000), + SPH_C32(0x67860000), SPH_C32(0x3c940000), SPH_C32(0x806701f8), + SPH_C32(0x3cff239b), SPH_C32(0x94dedb37), SPH_C32(0x1719d72a), + SPH_C32(0xfdd42f76) }, + { SPH_C32(0xf1360000), SPH_C32(0x05b70000), SPH_C32(0x44ea0000), + SPH_C32(0x98010158), SPH_C32(0x5e0618ed), SPH_C32(0x1586018d), + SPH_C32(0x18430d13), SPH_C32(0x25b0ddcf), SPH_C32(0x1b4f0000), + SPH_C32(0xf98b0000), SPH_C32(0x93b30000), SPH_C32(0xbd7f01fd), + SPH_C32(0x10b03c48), SPH_C32(0xe028cda2), SPH_C32(0xa2da90c1), + SPH_C32(0xc189d088) } +}; + +static const sph_u32 T512_63[2][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x033d0000), SPH_C32(0x08b30000), SPH_C32(0xf33a0000), + SPH_C32(0x3ac20007), SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), + SPH_C32(0x0ea5cfe3), SPH_C32(0xe6da7ffe), SPH_C32(0xa8da0000), + SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), SPH_C32(0x07da0002), + SPH_C32(0x7d669583), SPH_C32(0x1f98708a), SPH_C32(0xbb668808), + SPH_C32(0xda878000) } +}; + +#define INPUT_BIG do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T512_0[acc >> 1][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + m8 = rp[8]; \ + m9 = rp[9]; \ + mA = rp[10]; \ + mB = rp[11]; \ + mC = rp[12]; \ + mD = rp[13]; \ + mE = rp[14]; \ + mF = rp[15]; \ + acc = (acc << 8) | buf[1]; \ + rp = &T512_7[(acc >> 2) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[2]; \ + rp = &T512_14[(acc >> 3) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[3]; \ + rp = &T512_21[(acc >> 4) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[4]; \ + rp = &T512_28[(acc >> 5) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[5]; \ + rp = &T512_35[(acc >> 6) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = (acc << 8) | buf[6]; \ + rp = &T512_42[(acc >> 7) & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_49[acc & 0x7f][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[7]; \ + rp = &T512_56[acc >> 1][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + rp = &T512_63[acc & 0x01][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + } while (0) + +#endif + +#if SPH_HAMSI_EXPAND_BIG == 8 + +static const sph_u32 T512_0[256][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xef0b0270), SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), + SPH_C32(0x69490000), SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), + SPH_C32(0x66140a51), SPH_C32(0x924f5d0a), SPH_C32(0xc96b0030), + SPH_C32(0xe7250000), SPH_C32(0x2f840000), SPH_C32(0x264f0000), + SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), SPH_C32(0x509f6984), + SPH_C32(0x9e69af68) }, + { SPH_C32(0xc96b0030), SPH_C32(0xe7250000), SPH_C32(0x2f840000), + SPH_C32(0x264f0000), SPH_C32(0x08695bf9), SPH_C32(0x6dfcf137), + SPH_C32(0x509f6984), SPH_C32(0x9e69af68), SPH_C32(0x26600240), + SPH_C32(0xddd80000), SPH_C32(0x722a0000), SPH_C32(0x4f060000), + SPH_C32(0x936667ff), SPH_C32(0x29f944ce), SPH_C32(0x368b63d5), + SPH_C32(0x0c26f262) }, + { SPH_C32(0x26600240), SPH_C32(0xddd80000), SPH_C32(0x722a0000), + SPH_C32(0x4f060000), SPH_C32(0x936667ff), SPH_C32(0x29f944ce), + SPH_C32(0x368b63d5), SPH_C32(0x0c26f262), SPH_C32(0xef0b0270), + SPH_C32(0x3afd0000), SPH_C32(0x5dae0000), SPH_C32(0x69490000), + SPH_C32(0x9b0f3c06), SPH_C32(0x4405b5f9), SPH_C32(0x66140a51), + SPH_C32(0x924f5d0a) }, + { SPH_C32(0x145a3c00), SPH_C32(0xb9e90000), SPH_C32(0x61270000), + SPH_C32(0xf1610000), SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), + SPH_C32(0x47a96720), SPH_C32(0xe18e24c5), SPH_C32(0x23671400), + SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), SPH_C32(0xfb750000), + SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), SPH_C32(0x02c40a3f), + SPH_C32(0xdc24e61f) }, + { SPH_C32(0xfb513e70), SPH_C32(0x83140000), SPH_C32(0x3c890000), + SPH_C32(0x98280000), SPH_C32(0x556e016a), SPH_C32(0xf44c8881), + SPH_C32(0x21bd6d71), SPH_C32(0x73c179cf), SPH_C32(0xea0c1430), + SPH_C32(0x2f9c0000), SPH_C32(0xdb430000), SPH_C32(0xdd3a0000), + SPH_C32(0x7ba47f9c), SPH_C32(0x955a547e), SPH_C32(0x525b63bb), + SPH_C32(0x424d4977) }, + { SPH_C32(0xdd313c30), SPH_C32(0x5ecc0000), SPH_C32(0x4ea30000), + SPH_C32(0xd72e0000), SPH_C32(0xc6086695), SPH_C32(0xddb5cc4f), + SPH_C32(0x17360ea4), SPH_C32(0x7fe78bad), SPH_C32(0x05071640), + SPH_C32(0x15610000), SPH_C32(0x86ed0000), SPH_C32(0xb4730000), + SPH_C32(0xe0ab439a), SPH_C32(0xd15fe187), SPH_C32(0x344f69ea), + SPH_C32(0xd002147d) }, + { SPH_C32(0x323a3e40), SPH_C32(0x64310000), SPH_C32(0x130d0000), + SPH_C32(0xbe670000), SPH_C32(0x5d075a93), SPH_C32(0x99b079b6), + SPH_C32(0x712204f5), SPH_C32(0xeda8d6a7), SPH_C32(0xcc6c1670), + SPH_C32(0xf2440000), SPH_C32(0xa9690000), SPH_C32(0x923c0000), + SPH_C32(0xe8c21863), SPH_C32(0xbca310b0), SPH_C32(0x64d0006e), + SPH_C32(0x4e6bbb15) }, + { SPH_C32(0x23671400), SPH_C32(0xc8b90000), SPH_C32(0xf4c70000), + SPH_C32(0xfb750000), SPH_C32(0x73cd2465), SPH_C32(0xf8a6a549), + SPH_C32(0x02c40a3f), SPH_C32(0xdc24e61f), SPH_C32(0x373d2800), + SPH_C32(0x71500000), SPH_C32(0x95e00000), SPH_C32(0x0a140000), + SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), SPH_C32(0x456d6d1f), + SPH_C32(0x3daac2da) }, + { SPH_C32(0xcc6c1670), SPH_C32(0xf2440000), SPH_C32(0xa9690000), + SPH_C32(0x923c0000), SPH_C32(0xe8c21863), SPH_C32(0xbca310b0), + SPH_C32(0x64d0006e), SPH_C32(0x4e6bbb15), SPH_C32(0xfe562830), + SPH_C32(0x96750000), SPH_C32(0xba640000), SPH_C32(0x2c5b0000), + SPH_C32(0xb5c542f0), SPH_C32(0x25136906), SPH_C32(0x15f2049b), + SPH_C32(0xa3c36db2) }, + { SPH_C32(0xea0c1430), SPH_C32(0x2f9c0000), SPH_C32(0xdb430000), + SPH_C32(0xdd3a0000), SPH_C32(0x7ba47f9c), SPH_C32(0x955a547e), + SPH_C32(0x525b63bb), SPH_C32(0x424d4977), SPH_C32(0x115d2a40), + SPH_C32(0xac880000), SPH_C32(0xe7ca0000), SPH_C32(0x45120000), + SPH_C32(0x2eca7ef6), SPH_C32(0x6116dcff), SPH_C32(0x73e60eca), + SPH_C32(0x318c30b8) }, + { SPH_C32(0x05071640), SPH_C32(0x15610000), SPH_C32(0x86ed0000), + SPH_C32(0xb4730000), SPH_C32(0xe0ab439a), SPH_C32(0xd15fe187), + SPH_C32(0x344f69ea), SPH_C32(0xd002147d), SPH_C32(0xd8362a70), + SPH_C32(0x4bad0000), SPH_C32(0xc84e0000), SPH_C32(0x635d0000), + SPH_C32(0x26a3250f), SPH_C32(0x0cea2dc8), SPH_C32(0x2379674e), + SPH_C32(0xafe59fd0) }, + { SPH_C32(0x373d2800), SPH_C32(0x71500000), SPH_C32(0x95e00000), + SPH_C32(0x0a140000), SPH_C32(0xbdac1909), SPH_C32(0x48ef9831), + SPH_C32(0x456d6d1f), SPH_C32(0x3daac2da), SPH_C32(0x145a3c00), + SPH_C32(0xb9e90000), SPH_C32(0x61270000), SPH_C32(0xf1610000), + SPH_C32(0xce613d6c), SPH_C32(0xb0493d78), SPH_C32(0x47a96720), + SPH_C32(0xe18e24c5) }, + { SPH_C32(0xd8362a70), SPH_C32(0x4bad0000), SPH_C32(0xc84e0000), + SPH_C32(0x635d0000), SPH_C32(0x26a3250f), SPH_C32(0x0cea2dc8), + SPH_C32(0x2379674e), SPH_C32(0xafe59fd0), SPH_C32(0xdd313c30), + SPH_C32(0x5ecc0000), SPH_C32(0x4ea30000), SPH_C32(0xd72e0000), + SPH_C32(0xc6086695), SPH_C32(0xddb5cc4f), SPH_C32(0x17360ea4), + SPH_C32(0x7fe78bad) }, + { SPH_C32(0xfe562830), SPH_C32(0x96750000), SPH_C32(0xba640000), + SPH_C32(0x2c5b0000), SPH_C32(0xb5c542f0), SPH_C32(0x25136906), + SPH_C32(0x15f2049b), SPH_C32(0xa3c36db2), SPH_C32(0x323a3e40), + SPH_C32(0x64310000), SPH_C32(0x130d0000), SPH_C32(0xbe670000), + SPH_C32(0x5d075a93), SPH_C32(0x99b079b6), SPH_C32(0x712204f5), + SPH_C32(0xeda8d6a7) }, + { SPH_C32(0x115d2a40), SPH_C32(0xac880000), SPH_C32(0xe7ca0000), + SPH_C32(0x45120000), SPH_C32(0x2eca7ef6), SPH_C32(0x6116dcff), + SPH_C32(0x73e60eca), SPH_C32(0x318c30b8), SPH_C32(0xfb513e70), + SPH_C32(0x83140000), SPH_C32(0x3c890000), SPH_C32(0x98280000), + SPH_C32(0x556e016a), SPH_C32(0xf44c8881), SPH_C32(0x21bd6d71), + SPH_C32(0x73c179cf) }, + { SPH_C32(0x54285c00), SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), + SPH_C32(0xa1c50000), SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), + SPH_C32(0x6bb0419d), SPH_C32(0x551b3782), SPH_C32(0x9cbb1800), + SPH_C32(0xb0d30000), SPH_C32(0x92510000), SPH_C32(0xed930000), + SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), SPH_C32(0x430633da), + SPH_C32(0x78cace29) }, + { SPH_C32(0xbb235e70), SPH_C32(0xd0100000), SPH_C32(0x98780000), + SPH_C32(0xc88c0000), SPH_C32(0x28ad5b76), SPH_C32(0xd0a07118), + SPH_C32(0x0da44bcc), SPH_C32(0xc7546a88), SPH_C32(0x55d01830), + SPH_C32(0x57f60000), SPH_C32(0xbdd50000), SPH_C32(0xcbdc0000), + SPH_C32(0x515318bc), SPH_C32(0x8ce824c3), SPH_C32(0x13995a5e), + SPH_C32(0xe6a36141) }, + { SPH_C32(0x9d435c30), SPH_C32(0x0dc80000), SPH_C32(0xea520000), + SPH_C32(0x878a0000), SPH_C32(0xbbcb3c89), SPH_C32(0xf95935d6), + SPH_C32(0x3b2f2819), SPH_C32(0xcb7298ea), SPH_C32(0xbadb1a40), + SPH_C32(0x6d0b0000), SPH_C32(0xe07b0000), SPH_C32(0xa2950000), + SPH_C32(0xca5c24ba), SPH_C32(0xc8ed913a), SPH_C32(0x758d500f), + SPH_C32(0x74ec3c4b) }, + { SPH_C32(0x72485e40), SPH_C32(0x37350000), SPH_C32(0xb7fc0000), + SPH_C32(0xeec30000), SPH_C32(0x20c4008f), SPH_C32(0xbd5c802f), + SPH_C32(0x5d3b2248), SPH_C32(0x593dc5e0), SPH_C32(0x73b01a70), + SPH_C32(0x8a2e0000), SPH_C32(0xcfff0000), SPH_C32(0x84da0000), + SPH_C32(0xc2357f43), SPH_C32(0xa511600d), SPH_C32(0x2512398b), + SPH_C32(0xea859323) }, + { SPH_C32(0x40726000), SPH_C32(0x53040000), SPH_C32(0xa4f10000), + SPH_C32(0x50a40000), SPH_C32(0x7dc35a1c), SPH_C32(0x24ecf999), + SPH_C32(0x2c1926bd), SPH_C32(0xb4951347), SPH_C32(0xbfdc0c00), + SPH_C32(0x786a0000), SPH_C32(0x66960000), SPH_C32(0x16e60000), + SPH_C32(0x2af76720), SPH_C32(0x19b270bd), SPH_C32(0x41c239e5), + SPH_C32(0xa4ee2836) }, + { SPH_C32(0xaf796270), SPH_C32(0x69f90000), SPH_C32(0xf95f0000), + SPH_C32(0x39ed0000), SPH_C32(0xe6cc661a), SPH_C32(0x60e94c60), + SPH_C32(0x4a0d2cec), SPH_C32(0x26da4e4d), SPH_C32(0x76b70c30), + SPH_C32(0x9f4f0000), SPH_C32(0x49120000), SPH_C32(0x30a90000), + SPH_C32(0x229e3cd9), SPH_C32(0x744e818a), SPH_C32(0x115d5061), + SPH_C32(0x3a87875e) }, + { SPH_C32(0x89196030), SPH_C32(0xb4210000), SPH_C32(0x8b750000), + SPH_C32(0x76eb0000), SPH_C32(0x75aa01e5), SPH_C32(0x491008ae), + SPH_C32(0x7c864f39), SPH_C32(0x2afcbc2f), SPH_C32(0x99bc0e40), + SPH_C32(0xa5b20000), SPH_C32(0x14bc0000), SPH_C32(0x59e00000), + SPH_C32(0xb99100df), SPH_C32(0x304b3473), SPH_C32(0x77495a30), + SPH_C32(0xa8c8da54) }, + { SPH_C32(0x66126240), SPH_C32(0x8edc0000), SPH_C32(0xd6db0000), + SPH_C32(0x1fa20000), SPH_C32(0xeea53de3), SPH_C32(0x0d15bd57), + SPH_C32(0x1a924568), SPH_C32(0xb8b3e125), SPH_C32(0x50d70e70), + SPH_C32(0x42970000), SPH_C32(0x3b380000), SPH_C32(0x7faf0000), + SPH_C32(0xb1f85b26), SPH_C32(0x5db7c544), SPH_C32(0x27d633b4), + SPH_C32(0x36a1753c) }, + { SPH_C32(0x774f4800), SPH_C32(0x22540000), SPH_C32(0x31110000), + SPH_C32(0x5ab00000), SPH_C32(0xc06f4315), SPH_C32(0x6c0361a8), + SPH_C32(0x69744ba2), SPH_C32(0x893fd19d), SPH_C32(0xab863000), + SPH_C32(0xc1830000), SPH_C32(0x07b10000), SPH_C32(0xe7870000), + SPH_C32(0xe4965a4c), SPH_C32(0xa9fb4dc5), SPH_C32(0x066b5ec5), + SPH_C32(0x45600cf3) }, + { SPH_C32(0x98444a70), SPH_C32(0x18a90000), SPH_C32(0x6cbf0000), + SPH_C32(0x33f90000), SPH_C32(0x5b607f13), SPH_C32(0x2806d451), + SPH_C32(0x0f6041f3), SPH_C32(0x1b708c97), SPH_C32(0x62ed3030), + SPH_C32(0x26a60000), SPH_C32(0x28350000), SPH_C32(0xc1c80000), + SPH_C32(0xecff01b5), SPH_C32(0xc407bcf2), SPH_C32(0x56f43741), + SPH_C32(0xdb09a39b) }, + { SPH_C32(0xbe244830), SPH_C32(0xc5710000), SPH_C32(0x1e950000), + SPH_C32(0x7cff0000), SPH_C32(0xc80618ec), SPH_C32(0x01ff909f), + SPH_C32(0x39eb2226), SPH_C32(0x17567ef5), SPH_C32(0x8de63240), + SPH_C32(0x1c5b0000), SPH_C32(0x759b0000), SPH_C32(0xa8810000), + SPH_C32(0x77f03db3), SPH_C32(0x8002090b), SPH_C32(0x30e03d10), + SPH_C32(0x4946fe91) }, + { SPH_C32(0x512f4a40), SPH_C32(0xff8c0000), SPH_C32(0x433b0000), + SPH_C32(0x15b60000), SPH_C32(0x530924ea), SPH_C32(0x45fa2566), + SPH_C32(0x5fff2877), SPH_C32(0x851923ff), SPH_C32(0x448d3270), + SPH_C32(0xfb7e0000), SPH_C32(0x5a1f0000), SPH_C32(0x8ece0000), + SPH_C32(0x7f99664a), SPH_C32(0xedfef83c), SPH_C32(0x607f5494), + SPH_C32(0xd72f51f9) }, + { SPH_C32(0x63157400), SPH_C32(0x9bbd0000), SPH_C32(0x50360000), + SPH_C32(0xabd10000), SPH_C32(0x0e0e7e79), SPH_C32(0xdc4a5cd0), + SPH_C32(0x2edd2c82), SPH_C32(0x68b1f558), SPH_C32(0x88e12400), + SPH_C32(0x093a0000), SPH_C32(0xf3760000), SPH_C32(0x1cf20000), + SPH_C32(0x975b7e29), SPH_C32(0x515de88c), SPH_C32(0x04af54fa), + SPH_C32(0x9944eaec) }, + { SPH_C32(0x8c1e7670), SPH_C32(0xa1400000), SPH_C32(0x0d980000), + SPH_C32(0xc2980000), SPH_C32(0x9501427f), SPH_C32(0x984fe929), + SPH_C32(0x48c926d3), SPH_C32(0xfafea852), SPH_C32(0x418a2430), + SPH_C32(0xee1f0000), SPH_C32(0xdcf20000), SPH_C32(0x3abd0000), + SPH_C32(0x9f3225d0), SPH_C32(0x3ca119bb), SPH_C32(0x54303d7e), + SPH_C32(0x072d4584) }, + { SPH_C32(0xaa7e7430), SPH_C32(0x7c980000), SPH_C32(0x7fb20000), + SPH_C32(0x8d9e0000), SPH_C32(0x06672580), SPH_C32(0xb1b6ade7), + SPH_C32(0x7e424506), SPH_C32(0xf6d85a30), SPH_C32(0xae812640), + SPH_C32(0xd4e20000), SPH_C32(0x815c0000), SPH_C32(0x53f40000), + SPH_C32(0x043d19d6), SPH_C32(0x78a4ac42), SPH_C32(0x3224372f), + SPH_C32(0x9562188e) }, + { SPH_C32(0x45757640), SPH_C32(0x46650000), SPH_C32(0x221c0000), + SPH_C32(0xe4d70000), SPH_C32(0x9d681986), SPH_C32(0xf5b3181e), + SPH_C32(0x18564f57), SPH_C32(0x6497073a), SPH_C32(0x67ea2670), + SPH_C32(0x33c70000), SPH_C32(0xaed80000), SPH_C32(0x75bb0000), + SPH_C32(0x0c54422f), SPH_C32(0x15585d75), SPH_C32(0x62bb5eab), + SPH_C32(0x0b0bb7e6) }, + { SPH_C32(0x9cbb1800), SPH_C32(0xb0d30000), SPH_C32(0x92510000), + SPH_C32(0xed930000), SPH_C32(0x593a4345), SPH_C32(0xe114d5f4), + SPH_C32(0x430633da), SPH_C32(0x78cace29), SPH_C32(0xc8934400), + SPH_C32(0x5a3e0000), SPH_C32(0x57870000), SPH_C32(0x4c560000), + SPH_C32(0xea982435), SPH_C32(0x75b11115), SPH_C32(0x28b67247), + SPH_C32(0x2dd1f9ab) }, + { SPH_C32(0x73b01a70), SPH_C32(0x8a2e0000), SPH_C32(0xcfff0000), + SPH_C32(0x84da0000), SPH_C32(0xc2357f43), SPH_C32(0xa511600d), + SPH_C32(0x2512398b), SPH_C32(0xea859323), SPH_C32(0x01f84430), + SPH_C32(0xbd1b0000), SPH_C32(0x78030000), SPH_C32(0x6a190000), + SPH_C32(0xe2f17fcc), SPH_C32(0x184de022), SPH_C32(0x78291bc3), + SPH_C32(0xb3b856c3) }, + { SPH_C32(0x55d01830), SPH_C32(0x57f60000), SPH_C32(0xbdd50000), + SPH_C32(0xcbdc0000), SPH_C32(0x515318bc), SPH_C32(0x8ce824c3), + SPH_C32(0x13995a5e), SPH_C32(0xe6a36141), SPH_C32(0xeef34640), + SPH_C32(0x87e60000), SPH_C32(0x25ad0000), SPH_C32(0x03500000), + SPH_C32(0x79fe43ca), SPH_C32(0x5c4855db), SPH_C32(0x1e3d1192), + SPH_C32(0x21f70bc9) }, + { SPH_C32(0xbadb1a40), SPH_C32(0x6d0b0000), SPH_C32(0xe07b0000), + SPH_C32(0xa2950000), SPH_C32(0xca5c24ba), SPH_C32(0xc8ed913a), + SPH_C32(0x758d500f), SPH_C32(0x74ec3c4b), SPH_C32(0x27984670), + SPH_C32(0x60c30000), SPH_C32(0x0a290000), SPH_C32(0x251f0000), + SPH_C32(0x71971833), SPH_C32(0x31b4a4ec), SPH_C32(0x4ea27816), + SPH_C32(0xbf9ea4a1) }, + { SPH_C32(0x88e12400), SPH_C32(0x093a0000), SPH_C32(0xf3760000), + SPH_C32(0x1cf20000), SPH_C32(0x975b7e29), SPH_C32(0x515de88c), + SPH_C32(0x04af54fa), SPH_C32(0x9944eaec), SPH_C32(0xebf45000), + SPH_C32(0x92870000), SPH_C32(0xa3400000), SPH_C32(0xb7230000), + SPH_C32(0x99550050), SPH_C32(0x8d17b45c), SPH_C32(0x2a727878), + SPH_C32(0xf1f51fb4) }, + { SPH_C32(0x67ea2670), SPH_C32(0x33c70000), SPH_C32(0xaed80000), + SPH_C32(0x75bb0000), SPH_C32(0x0c54422f), SPH_C32(0x15585d75), + SPH_C32(0x62bb5eab), SPH_C32(0x0b0bb7e6), SPH_C32(0x229f5030), + SPH_C32(0x75a20000), SPH_C32(0x8cc40000), SPH_C32(0x916c0000), + SPH_C32(0x913c5ba9), SPH_C32(0xe0eb456b), SPH_C32(0x7aed11fc), + SPH_C32(0x6f9cb0dc) }, + { SPH_C32(0x418a2430), SPH_C32(0xee1f0000), SPH_C32(0xdcf20000), + SPH_C32(0x3abd0000), SPH_C32(0x9f3225d0), SPH_C32(0x3ca119bb), + SPH_C32(0x54303d7e), SPH_C32(0x072d4584), SPH_C32(0xcd945240), + SPH_C32(0x4f5f0000), SPH_C32(0xd16a0000), SPH_C32(0xf8250000), + SPH_C32(0x0a3367af), SPH_C32(0xa4eef092), SPH_C32(0x1cf91bad), + SPH_C32(0xfdd3edd6) }, + { SPH_C32(0xae812640), SPH_C32(0xd4e20000), SPH_C32(0x815c0000), + SPH_C32(0x53f40000), SPH_C32(0x043d19d6), SPH_C32(0x78a4ac42), + SPH_C32(0x3224372f), SPH_C32(0x9562188e), SPH_C32(0x04ff5270), + SPH_C32(0xa87a0000), SPH_C32(0xfeee0000), SPH_C32(0xde6a0000), + SPH_C32(0x025a3c56), SPH_C32(0xc91201a5), SPH_C32(0x4c667229), + SPH_C32(0x63ba42be) }, + { SPH_C32(0xbfdc0c00), SPH_C32(0x786a0000), SPH_C32(0x66960000), + SPH_C32(0x16e60000), SPH_C32(0x2af76720), SPH_C32(0x19b270bd), + SPH_C32(0x41c239e5), SPH_C32(0xa4ee2836), SPH_C32(0xffae6c00), + SPH_C32(0x2b6e0000), SPH_C32(0xc2670000), SPH_C32(0x46420000), + SPH_C32(0x57343d3c), SPH_C32(0x3d5e8924), SPH_C32(0x6ddb1f58), + SPH_C32(0x107b3b71) }, + { SPH_C32(0x50d70e70), SPH_C32(0x42970000), SPH_C32(0x3b380000), + SPH_C32(0x7faf0000), SPH_C32(0xb1f85b26), SPH_C32(0x5db7c544), + SPH_C32(0x27d633b4), SPH_C32(0x36a1753c), SPH_C32(0x36c56c30), + SPH_C32(0xcc4b0000), SPH_C32(0xede30000), SPH_C32(0x600d0000), + SPH_C32(0x5f5d66c5), SPH_C32(0x50a27813), SPH_C32(0x3d4476dc), + SPH_C32(0x8e129419) }, + { SPH_C32(0x76b70c30), SPH_C32(0x9f4f0000), SPH_C32(0x49120000), + SPH_C32(0x30a90000), SPH_C32(0x229e3cd9), SPH_C32(0x744e818a), + SPH_C32(0x115d5061), SPH_C32(0x3a87875e), SPH_C32(0xd9ce6e40), + SPH_C32(0xf6b60000), SPH_C32(0xb04d0000), SPH_C32(0x09440000), + SPH_C32(0xc4525ac3), SPH_C32(0x14a7cdea), SPH_C32(0x5b507c8d), + SPH_C32(0x1c5dc913) }, + { SPH_C32(0x99bc0e40), SPH_C32(0xa5b20000), SPH_C32(0x14bc0000), + SPH_C32(0x59e00000), SPH_C32(0xb99100df), SPH_C32(0x304b3473), + SPH_C32(0x77495a30), SPH_C32(0xa8c8da54), SPH_C32(0x10a56e70), + SPH_C32(0x11930000), SPH_C32(0x9fc90000), SPH_C32(0x2f0b0000), + SPH_C32(0xcc3b013a), SPH_C32(0x795b3cdd), SPH_C32(0x0bcf1509), + SPH_C32(0x8234667b) }, + { SPH_C32(0xab863000), SPH_C32(0xc1830000), SPH_C32(0x07b10000), + SPH_C32(0xe7870000), SPH_C32(0xe4965a4c), SPH_C32(0xa9fb4dc5), + SPH_C32(0x066b5ec5), SPH_C32(0x45600cf3), SPH_C32(0xdcc97800), + SPH_C32(0xe3d70000), SPH_C32(0x36a00000), SPH_C32(0xbd370000), + SPH_C32(0x24f91959), SPH_C32(0xc5f82c6d), SPH_C32(0x6f1f1567), + SPH_C32(0xcc5fdd6e) }, + { SPH_C32(0x448d3270), SPH_C32(0xfb7e0000), SPH_C32(0x5a1f0000), + SPH_C32(0x8ece0000), SPH_C32(0x7f99664a), SPH_C32(0xedfef83c), + SPH_C32(0x607f5494), SPH_C32(0xd72f51f9), SPH_C32(0x15a27830), + SPH_C32(0x04f20000), SPH_C32(0x19240000), SPH_C32(0x9b780000), + SPH_C32(0x2c9042a0), SPH_C32(0xa804dd5a), SPH_C32(0x3f807ce3), + SPH_C32(0x52367206) }, + { SPH_C32(0x62ed3030), SPH_C32(0x26a60000), SPH_C32(0x28350000), + SPH_C32(0xc1c80000), SPH_C32(0xecff01b5), SPH_C32(0xc407bcf2), + SPH_C32(0x56f43741), SPH_C32(0xdb09a39b), SPH_C32(0xfaa97a40), + SPH_C32(0x3e0f0000), SPH_C32(0x448a0000), SPH_C32(0xf2310000), + SPH_C32(0xb79f7ea6), SPH_C32(0xec0168a3), SPH_C32(0x599476b2), + SPH_C32(0xc0792f0c) }, + { SPH_C32(0x8de63240), SPH_C32(0x1c5b0000), SPH_C32(0x759b0000), + SPH_C32(0xa8810000), SPH_C32(0x77f03db3), SPH_C32(0x8002090b), + SPH_C32(0x30e03d10), SPH_C32(0x4946fe91), SPH_C32(0x33c27a70), + SPH_C32(0xd92a0000), SPH_C32(0x6b0e0000), SPH_C32(0xd47e0000), + SPH_C32(0xbff6255f), SPH_C32(0x81fd9994), SPH_C32(0x090b1f36), + SPH_C32(0x5e108064) }, + { SPH_C32(0xc8934400), SPH_C32(0x5a3e0000), SPH_C32(0x57870000), + SPH_C32(0x4c560000), SPH_C32(0xea982435), SPH_C32(0x75b11115), + SPH_C32(0x28b67247), SPH_C32(0x2dd1f9ab), SPH_C32(0x54285c00), + SPH_C32(0xeaed0000), SPH_C32(0xc5d60000), SPH_C32(0xa1c50000), + SPH_C32(0xb3a26770), SPH_C32(0x94a5c4e1), SPH_C32(0x6bb0419d), + SPH_C32(0x551b3782) }, + { SPH_C32(0x27984670), SPH_C32(0x60c30000), SPH_C32(0x0a290000), + SPH_C32(0x251f0000), SPH_C32(0x71971833), SPH_C32(0x31b4a4ec), + SPH_C32(0x4ea27816), SPH_C32(0xbf9ea4a1), SPH_C32(0x9d435c30), + SPH_C32(0x0dc80000), SPH_C32(0xea520000), SPH_C32(0x878a0000), + SPH_C32(0xbbcb3c89), SPH_C32(0xf95935d6), SPH_C32(0x3b2f2819), + SPH_C32(0xcb7298ea) }, + { SPH_C32(0x01f84430), SPH_C32(0xbd1b0000), SPH_C32(0x78030000), + SPH_C32(0x6a190000), SPH_C32(0xe2f17fcc), SPH_C32(0x184de022), + SPH_C32(0x78291bc3), SPH_C32(0xb3b856c3), SPH_C32(0x72485e40), + SPH_C32(0x37350000), SPH_C32(0xb7fc0000), SPH_C32(0xeec30000), + SPH_C32(0x20c4008f), SPH_C32(0xbd5c802f), SPH_C32(0x5d3b2248), + SPH_C32(0x593dc5e0) }, + { SPH_C32(0xeef34640), SPH_C32(0x87e60000), SPH_C32(0x25ad0000), + SPH_C32(0x03500000), SPH_C32(0x79fe43ca), SPH_C32(0x5c4855db), + SPH_C32(0x1e3d1192), SPH_C32(0x21f70bc9), SPH_C32(0xbb235e70), + SPH_C32(0xd0100000), SPH_C32(0x98780000), SPH_C32(0xc88c0000), + SPH_C32(0x28ad5b76), SPH_C32(0xd0a07118), SPH_C32(0x0da44bcc), + SPH_C32(0xc7546a88) }, + { SPH_C32(0xdcc97800), SPH_C32(0xe3d70000), SPH_C32(0x36a00000), + SPH_C32(0xbd370000), SPH_C32(0x24f91959), SPH_C32(0xc5f82c6d), + SPH_C32(0x6f1f1567), SPH_C32(0xcc5fdd6e), SPH_C32(0x774f4800), + SPH_C32(0x22540000), SPH_C32(0x31110000), SPH_C32(0x5ab00000), + SPH_C32(0xc06f4315), SPH_C32(0x6c0361a8), SPH_C32(0x69744ba2), + SPH_C32(0x893fd19d) }, + { SPH_C32(0x33c27a70), SPH_C32(0xd92a0000), SPH_C32(0x6b0e0000), + SPH_C32(0xd47e0000), SPH_C32(0xbff6255f), SPH_C32(0x81fd9994), + SPH_C32(0x090b1f36), SPH_C32(0x5e108064), SPH_C32(0xbe244830), + SPH_C32(0xc5710000), SPH_C32(0x1e950000), SPH_C32(0x7cff0000), + SPH_C32(0xc80618ec), SPH_C32(0x01ff909f), SPH_C32(0x39eb2226), + SPH_C32(0x17567ef5) }, + { SPH_C32(0x15a27830), SPH_C32(0x04f20000), SPH_C32(0x19240000), + SPH_C32(0x9b780000), SPH_C32(0x2c9042a0), SPH_C32(0xa804dd5a), + SPH_C32(0x3f807ce3), SPH_C32(0x52367206), SPH_C32(0x512f4a40), + SPH_C32(0xff8c0000), SPH_C32(0x433b0000), SPH_C32(0x15b60000), + SPH_C32(0x530924ea), SPH_C32(0x45fa2566), SPH_C32(0x5fff2877), + SPH_C32(0x851923ff) }, + { SPH_C32(0xfaa97a40), SPH_C32(0x3e0f0000), SPH_C32(0x448a0000), + SPH_C32(0xf2310000), SPH_C32(0xb79f7ea6), SPH_C32(0xec0168a3), + SPH_C32(0x599476b2), SPH_C32(0xc0792f0c), SPH_C32(0x98444a70), + SPH_C32(0x18a90000), SPH_C32(0x6cbf0000), SPH_C32(0x33f90000), + SPH_C32(0x5b607f13), SPH_C32(0x2806d451), SPH_C32(0x0f6041f3), + SPH_C32(0x1b708c97) }, + { SPH_C32(0xebf45000), SPH_C32(0x92870000), SPH_C32(0xa3400000), + SPH_C32(0xb7230000), SPH_C32(0x99550050), SPH_C32(0x8d17b45c), + SPH_C32(0x2a727878), SPH_C32(0xf1f51fb4), SPH_C32(0x63157400), + SPH_C32(0x9bbd0000), SPH_C32(0x50360000), SPH_C32(0xabd10000), + SPH_C32(0x0e0e7e79), SPH_C32(0xdc4a5cd0), SPH_C32(0x2edd2c82), + SPH_C32(0x68b1f558) }, + { SPH_C32(0x04ff5270), SPH_C32(0xa87a0000), SPH_C32(0xfeee0000), + SPH_C32(0xde6a0000), SPH_C32(0x025a3c56), SPH_C32(0xc91201a5), + SPH_C32(0x4c667229), SPH_C32(0x63ba42be), SPH_C32(0xaa7e7430), + SPH_C32(0x7c980000), SPH_C32(0x7fb20000), SPH_C32(0x8d9e0000), + SPH_C32(0x06672580), SPH_C32(0xb1b6ade7), SPH_C32(0x7e424506), + SPH_C32(0xf6d85a30) }, + { SPH_C32(0x229f5030), SPH_C32(0x75a20000), SPH_C32(0x8cc40000), + SPH_C32(0x916c0000), SPH_C32(0x913c5ba9), SPH_C32(0xe0eb456b), + SPH_C32(0x7aed11fc), SPH_C32(0x6f9cb0dc), SPH_C32(0x45757640), + SPH_C32(0x46650000), SPH_C32(0x221c0000), SPH_C32(0xe4d70000), + SPH_C32(0x9d681986), SPH_C32(0xf5b3181e), SPH_C32(0x18564f57), + SPH_C32(0x6497073a) }, + { SPH_C32(0xcd945240), SPH_C32(0x4f5f0000), SPH_C32(0xd16a0000), + SPH_C32(0xf8250000), SPH_C32(0x0a3367af), SPH_C32(0xa4eef092), + SPH_C32(0x1cf91bad), SPH_C32(0xfdd3edd6), SPH_C32(0x8c1e7670), + SPH_C32(0xa1400000), SPH_C32(0x0d980000), SPH_C32(0xc2980000), + SPH_C32(0x9501427f), SPH_C32(0x984fe929), SPH_C32(0x48c926d3), + SPH_C32(0xfafea852) }, + { SPH_C32(0xffae6c00), SPH_C32(0x2b6e0000), SPH_C32(0xc2670000), + SPH_C32(0x46420000), SPH_C32(0x57343d3c), SPH_C32(0x3d5e8924), + SPH_C32(0x6ddb1f58), SPH_C32(0x107b3b71), SPH_C32(0x40726000), + SPH_C32(0x53040000), SPH_C32(0xa4f10000), SPH_C32(0x50a40000), + SPH_C32(0x7dc35a1c), SPH_C32(0x24ecf999), SPH_C32(0x2c1926bd), + SPH_C32(0xb4951347) }, + { SPH_C32(0x10a56e70), SPH_C32(0x11930000), SPH_C32(0x9fc90000), + SPH_C32(0x2f0b0000), SPH_C32(0xcc3b013a), SPH_C32(0x795b3cdd), + SPH_C32(0x0bcf1509), SPH_C32(0x8234667b), SPH_C32(0x89196030), + SPH_C32(0xb4210000), SPH_C32(0x8b750000), SPH_C32(0x76eb0000), + SPH_C32(0x75aa01e5), SPH_C32(0x491008ae), SPH_C32(0x7c864f39), + SPH_C32(0x2afcbc2f) }, + { SPH_C32(0x36c56c30), SPH_C32(0xcc4b0000), SPH_C32(0xede30000), + SPH_C32(0x600d0000), SPH_C32(0x5f5d66c5), SPH_C32(0x50a27813), + SPH_C32(0x3d4476dc), SPH_C32(0x8e129419), SPH_C32(0x66126240), + SPH_C32(0x8edc0000), SPH_C32(0xd6db0000), SPH_C32(0x1fa20000), + SPH_C32(0xeea53de3), SPH_C32(0x0d15bd57), SPH_C32(0x1a924568), + SPH_C32(0xb8b3e125) }, + { SPH_C32(0xd9ce6e40), SPH_C32(0xf6b60000), SPH_C32(0xb04d0000), + SPH_C32(0x09440000), SPH_C32(0xc4525ac3), SPH_C32(0x14a7cdea), + SPH_C32(0x5b507c8d), SPH_C32(0x1c5dc913), SPH_C32(0xaf796270), + SPH_C32(0x69f90000), SPH_C32(0xf95f0000), SPH_C32(0x39ed0000), + SPH_C32(0xe6cc661a), SPH_C32(0x60e94c60), SPH_C32(0x4a0d2cec), + SPH_C32(0x26da4e4d) }, + { SPH_C32(0x29449c00), SPH_C32(0x64e70000), SPH_C32(0xf24b0000), + SPH_C32(0xc2f30000), SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), + SPH_C32(0xf3e04259), SPH_C32(0x8d0d9ec4), SPH_C32(0x466d0c00), + SPH_C32(0x08620000), SPH_C32(0xdd5d0000), SPH_C32(0xbadd0000), + SPH_C32(0x6a927942), SPH_C32(0x441f2b93), SPH_C32(0x218ace6f), + SPH_C32(0xbf2c0be2) }, + { SPH_C32(0xc64f9e70), SPH_C32(0x5e1a0000), SPH_C32(0xafe50000), + SPH_C32(0xabba0000), SPH_C32(0x95d17289), SPH_C32(0x12c782bc), + SPH_C32(0x95f44808), SPH_C32(0x1f42c3ce), SPH_C32(0x8f060c30), + SPH_C32(0xef470000), SPH_C32(0xf2d90000), SPH_C32(0x9c920000), + SPH_C32(0x62fb22bb), SPH_C32(0x29e3daa4), SPH_C32(0x7115a7eb), + SPH_C32(0x2145a48a) }, + { SPH_C32(0xe02f9c30), SPH_C32(0x83c20000), SPH_C32(0xddcf0000), + SPH_C32(0xe4bc0000), SPH_C32(0x06b71576), SPH_C32(0x3b3ec672), + SPH_C32(0xa37f2bdd), SPH_C32(0x136431ac), SPH_C32(0x600d0e40), + SPH_C32(0xd5ba0000), SPH_C32(0xaf770000), SPH_C32(0xf5db0000), + SPH_C32(0xf9f41ebd), SPH_C32(0x6de66f5d), SPH_C32(0x1701adba), + SPH_C32(0xb30af980) }, + { SPH_C32(0x0f249e40), SPH_C32(0xb93f0000), SPH_C32(0x80610000), + SPH_C32(0x8df50000), SPH_C32(0x9db82970), SPH_C32(0x7f3b738b), + SPH_C32(0xc56b218c), SPH_C32(0x812b6ca6), SPH_C32(0xa9660e70), + SPH_C32(0x329f0000), SPH_C32(0x80f30000), SPH_C32(0xd3940000), + SPH_C32(0xf19d4544), SPH_C32(0x001a9e6a), SPH_C32(0x479ec43e), + SPH_C32(0x2d6356e8) }, + { SPH_C32(0x3d1ea000), SPH_C32(0xdd0e0000), SPH_C32(0x936c0000), + SPH_C32(0x33920000), SPH_C32(0xc0bf73e3), SPH_C32(0xe68b0a3d), + SPH_C32(0xb4492579), SPH_C32(0x6c83ba01), SPH_C32(0x650a1800), + SPH_C32(0xc0db0000), SPH_C32(0x299a0000), SPH_C32(0x41a80000), + SPH_C32(0x195f5d27), SPH_C32(0xbcb98eda), SPH_C32(0x234ec450), + SPH_C32(0x6308edfd) }, + { SPH_C32(0xd215a270), SPH_C32(0xe7f30000), SPH_C32(0xcec20000), + SPH_C32(0x5adb0000), SPH_C32(0x5bb04fe5), SPH_C32(0xa28ebfc4), + SPH_C32(0xd25d2f28), SPH_C32(0xfecce70b), SPH_C32(0xac611830), + SPH_C32(0x27fe0000), SPH_C32(0x061e0000), SPH_C32(0x67e70000), + SPH_C32(0x113606de), SPH_C32(0xd1457fed), SPH_C32(0x73d1add4), + SPH_C32(0xfd614295) }, + { SPH_C32(0xf475a030), SPH_C32(0x3a2b0000), SPH_C32(0xbce80000), + SPH_C32(0x15dd0000), SPH_C32(0xc8d6281a), SPH_C32(0x8b77fb0a), + SPH_C32(0xe4d64cfd), SPH_C32(0xf2ea1569), SPH_C32(0x436a1a40), + SPH_C32(0x1d030000), SPH_C32(0x5bb00000), SPH_C32(0x0eae0000), + SPH_C32(0x8a393ad8), SPH_C32(0x9540ca14), SPH_C32(0x15c5a785), + SPH_C32(0x6f2e1f9f) }, + { SPH_C32(0x1b7ea240), SPH_C32(0x00d60000), SPH_C32(0xe1460000), + SPH_C32(0x7c940000), SPH_C32(0x53d9141c), SPH_C32(0xcf724ef3), + SPH_C32(0x82c246ac), SPH_C32(0x60a54863), SPH_C32(0x8a011a70), + SPH_C32(0xfa260000), SPH_C32(0x74340000), SPH_C32(0x28e10000), + SPH_C32(0x82506121), SPH_C32(0xf8bc3b23), SPH_C32(0x455ace01), + SPH_C32(0xf147b0f7) }, + { SPH_C32(0x0a238800), SPH_C32(0xac5e0000), SPH_C32(0x068c0000), + SPH_C32(0x39860000), SPH_C32(0x7d136aea), SPH_C32(0xae64920c), + SPH_C32(0xf1244866), SPH_C32(0x512978db), SPH_C32(0x71502400), + SPH_C32(0x79320000), SPH_C32(0x48bd0000), SPH_C32(0xb0c90000), + SPH_C32(0xd73e604b), SPH_C32(0x0cf0b3a2), SPH_C32(0x64e7a370), + SPH_C32(0x8286c938) }, + { SPH_C32(0xe5288a70), SPH_C32(0x96a30000), SPH_C32(0x5b220000), + SPH_C32(0x50cf0000), SPH_C32(0xe61c56ec), SPH_C32(0xea6127f5), + SPH_C32(0x97304237), SPH_C32(0xc36625d1), SPH_C32(0xb83b2430), + SPH_C32(0x9e170000), SPH_C32(0x67390000), SPH_C32(0x96860000), + SPH_C32(0xdf573bb2), SPH_C32(0x610c4295), SPH_C32(0x3478caf4), + SPH_C32(0x1cef6650) }, + { SPH_C32(0xc3488830), SPH_C32(0x4b7b0000), SPH_C32(0x29080000), + SPH_C32(0x1fc90000), SPH_C32(0x757a3113), SPH_C32(0xc398633b), + SPH_C32(0xa1bb21e2), SPH_C32(0xcf40d7b3), SPH_C32(0x57302640), + SPH_C32(0xa4ea0000), SPH_C32(0x3a970000), SPH_C32(0xffcf0000), + SPH_C32(0x445807b4), SPH_C32(0x2509f76c), SPH_C32(0x526cc0a5), + SPH_C32(0x8ea03b5a) }, + { SPH_C32(0x2c438a40), SPH_C32(0x71860000), SPH_C32(0x74a60000), + SPH_C32(0x76800000), SPH_C32(0xee750d15), SPH_C32(0x879dd6c2), + SPH_C32(0xc7af2bb3), SPH_C32(0x5d0f8ab9), SPH_C32(0x9e5b2670), + SPH_C32(0x43cf0000), SPH_C32(0x15130000), SPH_C32(0xd9800000), + SPH_C32(0x4c315c4d), SPH_C32(0x48f5065b), SPH_C32(0x02f3a921), + SPH_C32(0x10c99432) }, + { SPH_C32(0x1e79b400), SPH_C32(0x15b70000), SPH_C32(0x67ab0000), + SPH_C32(0xc8e70000), SPH_C32(0xb3725786), SPH_C32(0x1e2daf74), + SPH_C32(0xb68d2f46), SPH_C32(0xb0a75c1e), SPH_C32(0x52373000), + SPH_C32(0xb18b0000), SPH_C32(0xbc7a0000), SPH_C32(0x4bbc0000), + SPH_C32(0xa4f3442e), SPH_C32(0xf45616eb), SPH_C32(0x6623a94f), + SPH_C32(0x5ea22f27) }, + { SPH_C32(0xf172b670), SPH_C32(0x2f4a0000), SPH_C32(0x3a050000), + SPH_C32(0xa1ae0000), SPH_C32(0x287d6b80), SPH_C32(0x5a281a8d), + SPH_C32(0xd0992517), SPH_C32(0x22e80114), SPH_C32(0x9b5c3030), + SPH_C32(0x56ae0000), SPH_C32(0x93fe0000), SPH_C32(0x6df30000), + SPH_C32(0xac9a1fd7), SPH_C32(0x99aae7dc), SPH_C32(0x36bcc0cb), + SPH_C32(0xc0cb804f) }, + { SPH_C32(0xd712b430), SPH_C32(0xf2920000), SPH_C32(0x482f0000), + SPH_C32(0xeea80000), SPH_C32(0xbb1b0c7f), SPH_C32(0x73d15e43), + SPH_C32(0xe61246c2), SPH_C32(0x2ecef376), SPH_C32(0x74573240), + SPH_C32(0x6c530000), SPH_C32(0xce500000), SPH_C32(0x04ba0000), + SPH_C32(0x379523d1), SPH_C32(0xddaf5225), SPH_C32(0x50a8ca9a), + SPH_C32(0x5284dd45) }, + { SPH_C32(0x3819b640), SPH_C32(0xc86f0000), SPH_C32(0x15810000), + SPH_C32(0x87e10000), SPH_C32(0x20143079), SPH_C32(0x37d4ebba), + SPH_C32(0x80064c93), SPH_C32(0xbc81ae7c), SPH_C32(0xbd3c3270), + SPH_C32(0x8b760000), SPH_C32(0xe1d40000), SPH_C32(0x22f50000), + SPH_C32(0x3ffc7828), SPH_C32(0xb053a312), SPH_C32(0x0037a31e), + SPH_C32(0xcced722d) }, + { SPH_C32(0x7d6cc000), SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), + SPH_C32(0x63360000), SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), + SPH_C32(0x985003c4), SPH_C32(0xd816a946), SPH_C32(0xdad61400), + SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), SPH_C32(0x574e0000), + SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), SPH_C32(0x628cfdb5), + SPH_C32(0xc7e6c5cb) }, + { SPH_C32(0x9267c270), SPH_C32(0xb4f70000), SPH_C32(0x6a330000), + SPH_C32(0x0a7f0000), SPH_C32(0x267315f9), SPH_C32(0x8662465d), + SPH_C32(0xfe440995), SPH_C32(0x4a59f44c), SPH_C32(0x13bd1430), + SPH_C32(0x5f940000), SPH_C32(0x60880000), SPH_C32(0x71010000), + SPH_C32(0x3bc161fe), SPH_C32(0xc8f70f50), SPH_C32(0x32139431), + SPH_C32(0x598f6aa3) }, + { SPH_C32(0xb407c030), SPH_C32(0x692f0000), SPH_C32(0x18190000), + SPH_C32(0x45790000), SPH_C32(0xb5157206), SPH_C32(0xaf9b0293), + SPH_C32(0xc8cf6a40), SPH_C32(0x467f062e), SPH_C32(0xfcb61640), + SPH_C32(0x65690000), SPH_C32(0x3d260000), SPH_C32(0x18480000), + SPH_C32(0xa0ce5df8), SPH_C32(0x8cf2baa9), SPH_C32(0x54079e60), + SPH_C32(0xcbc037a9) }, + { SPH_C32(0x5b0cc240), SPH_C32(0x53d20000), SPH_C32(0x45b70000), + SPH_C32(0x2c300000), SPH_C32(0x2e1a4e00), SPH_C32(0xeb9eb76a), + SPH_C32(0xaedb6011), SPH_C32(0xd4305b24), SPH_C32(0x35dd1670), + SPH_C32(0x824c0000), SPH_C32(0x12a20000), SPH_C32(0x3e070000), + SPH_C32(0xa8a70601), SPH_C32(0xe10e4b9e), SPH_C32(0x0498f7e4), + SPH_C32(0x55a998c1) }, + { SPH_C32(0x6936fc00), SPH_C32(0x37e30000), SPH_C32(0x56ba0000), + SPH_C32(0x92570000), SPH_C32(0x731d1493), SPH_C32(0x722ecedc), + SPH_C32(0xdff964e4), SPH_C32(0x39988d83), SPH_C32(0xf9b10000), + SPH_C32(0x70080000), SPH_C32(0xbbcb0000), SPH_C32(0xac3b0000), + SPH_C32(0x40651e62), SPH_C32(0x5dad5b2e), SPH_C32(0x6048f78a), + SPH_C32(0x1bc223d4) }, + { SPH_C32(0x863dfe70), SPH_C32(0x0d1e0000), SPH_C32(0x0b140000), + SPH_C32(0xfb1e0000), SPH_C32(0xe8122895), SPH_C32(0x362b7b25), + SPH_C32(0xb9ed6eb5), SPH_C32(0xabd7d089), SPH_C32(0x30da0030), + SPH_C32(0x972d0000), SPH_C32(0x944f0000), SPH_C32(0x8a740000), + SPH_C32(0x480c459b), SPH_C32(0x3051aa19), SPH_C32(0x30d79e0e), + SPH_C32(0x85ab8cbc) }, + { SPH_C32(0xa05dfc30), SPH_C32(0xd0c60000), SPH_C32(0x793e0000), + SPH_C32(0xb4180000), SPH_C32(0x7b744f6a), SPH_C32(0x1fd23feb), + SPH_C32(0x8f660d60), SPH_C32(0xa7f122eb), SPH_C32(0xdfd10240), + SPH_C32(0xadd00000), SPH_C32(0xc9e10000), SPH_C32(0xe33d0000), + SPH_C32(0xd303799d), SPH_C32(0x74541fe0), SPH_C32(0x56c3945f), + SPH_C32(0x17e4d1b6) }, + { SPH_C32(0x4f56fe40), SPH_C32(0xea3b0000), SPH_C32(0x24900000), + SPH_C32(0xdd510000), SPH_C32(0xe07b736c), SPH_C32(0x5bd78a12), + SPH_C32(0xe9720731), SPH_C32(0x35be7fe1), SPH_C32(0x16ba0270), + SPH_C32(0x4af50000), SPH_C32(0xe6650000), SPH_C32(0xc5720000), + SPH_C32(0xdb6a2264), SPH_C32(0x19a8eed7), SPH_C32(0x065cfddb), + SPH_C32(0x898d7ede) }, + { SPH_C32(0x5e0bd400), SPH_C32(0x46b30000), SPH_C32(0xc35a0000), + SPH_C32(0x98430000), SPH_C32(0xceb10d9a), SPH_C32(0x3ac156ed), + SPH_C32(0x9a9409fb), SPH_C32(0x04324f59), SPH_C32(0xedeb3c00), + SPH_C32(0xc9e10000), SPH_C32(0xdaec0000), SPH_C32(0x5d5a0000), + SPH_C32(0x8e04230e), SPH_C32(0xede46656), SPH_C32(0x27e190aa), + SPH_C32(0xfa4c0711) }, + { SPH_C32(0xb100d670), SPH_C32(0x7c4e0000), SPH_C32(0x9ef40000), + SPH_C32(0xf10a0000), SPH_C32(0x55be319c), SPH_C32(0x7ec4e314), + SPH_C32(0xfc8003aa), SPH_C32(0x967d1253), SPH_C32(0x24803c30), + SPH_C32(0x2ec40000), SPH_C32(0xf5680000), SPH_C32(0x7b150000), + SPH_C32(0x866d78f7), SPH_C32(0x80189761), SPH_C32(0x777ef92e), + SPH_C32(0x6425a879) }, + { SPH_C32(0x9760d430), SPH_C32(0xa1960000), SPH_C32(0xecde0000), + SPH_C32(0xbe0c0000), SPH_C32(0xc6d85663), SPH_C32(0x573da7da), + SPH_C32(0xca0b607f), SPH_C32(0x9a5be031), SPH_C32(0xcb8b3e40), + SPH_C32(0x14390000), SPH_C32(0xa8c60000), SPH_C32(0x125c0000), + SPH_C32(0x1d6244f1), SPH_C32(0xc41d2298), SPH_C32(0x116af37f), + SPH_C32(0xf66af573) }, + { SPH_C32(0x786bd640), SPH_C32(0x9b6b0000), SPH_C32(0xb1700000), + SPH_C32(0xd7450000), SPH_C32(0x5dd76a65), SPH_C32(0x13381223), + SPH_C32(0xac1f6a2e), SPH_C32(0x0814bd3b), SPH_C32(0x02e03e70), + SPH_C32(0xf31c0000), SPH_C32(0x87420000), SPH_C32(0x34130000), + SPH_C32(0x150b1f08), SPH_C32(0xa9e1d3af), SPH_C32(0x41f59afb), + SPH_C32(0x68035a1b) }, + { SPH_C32(0x4a51e800), SPH_C32(0xff5a0000), SPH_C32(0xa27d0000), + SPH_C32(0x69220000), SPH_C32(0x00d030f6), SPH_C32(0x8a886b95), + SPH_C32(0xdd3d6edb), SPH_C32(0xe5bc6b9c), SPH_C32(0xce8c2800), + SPH_C32(0x01580000), SPH_C32(0x2e2b0000), SPH_C32(0xa62f0000), + SPH_C32(0xfdc9076b), SPH_C32(0x1542c31f), SPH_C32(0x25259a95), + SPH_C32(0x2668e10e) }, + { SPH_C32(0xa55aea70), SPH_C32(0xc5a70000), SPH_C32(0xffd30000), + SPH_C32(0x006b0000), SPH_C32(0x9bdf0cf0), SPH_C32(0xce8dde6c), + SPH_C32(0xbb29648a), SPH_C32(0x77f33696), SPH_C32(0x07e72830), + SPH_C32(0xe67d0000), SPH_C32(0x01af0000), SPH_C32(0x80600000), + SPH_C32(0xf5a05c92), SPH_C32(0x78be3228), SPH_C32(0x75baf311), + SPH_C32(0xb8014e66) }, + { SPH_C32(0x833ae830), SPH_C32(0x187f0000), SPH_C32(0x8df90000), + SPH_C32(0x4f6d0000), SPH_C32(0x08b96b0f), SPH_C32(0xe7749aa2), + SPH_C32(0x8da2075f), SPH_C32(0x7bd5c4f4), SPH_C32(0xe8ec2a40), + SPH_C32(0xdc800000), SPH_C32(0x5c010000), SPH_C32(0xe9290000), + SPH_C32(0x6eaf6094), SPH_C32(0x3cbb87d1), SPH_C32(0x13aef940), + SPH_C32(0x2a4e136c) }, + { SPH_C32(0x6c31ea40), SPH_C32(0x22820000), SPH_C32(0xd0570000), + SPH_C32(0x26240000), SPH_C32(0x93b65709), SPH_C32(0xa3712f5b), + SPH_C32(0xebb60d0e), SPH_C32(0xe99a99fe), SPH_C32(0x21872a70), + SPH_C32(0x3ba50000), SPH_C32(0x73850000), SPH_C32(0xcf660000), + SPH_C32(0x66c63b6d), SPH_C32(0x514776e6), SPH_C32(0x433190c4), + SPH_C32(0xb427bc04) }, + { SPH_C32(0xb5ff8400), SPH_C32(0xd4340000), SPH_C32(0x601a0000), + SPH_C32(0x2f600000), SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), + SPH_C32(0xb0e67183), SPH_C32(0xf5c750ed), SPH_C32(0x8efe4800), + SPH_C32(0x525c0000), SPH_C32(0x8ada0000), SPH_C32(0xf68b0000), + SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), SPH_C32(0x093cbc28), + SPH_C32(0x92fdf249) }, + { SPH_C32(0x5af48670), SPH_C32(0xeec90000), SPH_C32(0x3db40000), + SPH_C32(0x46290000), SPH_C32(0xcceb31cc), SPH_C32(0xf3d35748), + SPH_C32(0xd6f27bd2), SPH_C32(0x67880de7), SPH_C32(0x47954830), + SPH_C32(0xb5790000), SPH_C32(0xa55e0000), SPH_C32(0xd0c40000), + SPH_C32(0x8863068e), SPH_C32(0x5c52cbb1), SPH_C32(0x59a3d5ac), + SPH_C32(0x0c945d21) }, + { SPH_C32(0x7c948430), SPH_C32(0x33110000), SPH_C32(0x4f9e0000), + SPH_C32(0x092f0000), SPH_C32(0x5f8d5633), SPH_C32(0xda2a1386), + SPH_C32(0xe0791807), SPH_C32(0x6baeff85), SPH_C32(0xa89e4a40), + SPH_C32(0x8f840000), SPH_C32(0xf8f00000), SPH_C32(0xb98d0000), + SPH_C32(0x136c3a88), SPH_C32(0x18577e48), SPH_C32(0x3fb7dffd), + SPH_C32(0x9edb002b) }, + { SPH_C32(0x939f8640), SPH_C32(0x09ec0000), SPH_C32(0x12300000), + SPH_C32(0x60660000), SPH_C32(0xc4826a35), SPH_C32(0x9e2fa67f), + SPH_C32(0x866d1256), SPH_C32(0xf9e1a28f), SPH_C32(0x61f54a70), + SPH_C32(0x68a10000), SPH_C32(0xd7740000), SPH_C32(0x9fc20000), + SPH_C32(0x1b056171), SPH_C32(0x75ab8f7f), SPH_C32(0x6f28b679), + SPH_C32(0x00b2af43) }, + { SPH_C32(0xa1a5b800), SPH_C32(0x6ddd0000), SPH_C32(0x013d0000), + SPH_C32(0xde010000), SPH_C32(0x998530a6), SPH_C32(0x079fdfc9), + SPH_C32(0xf74f16a3), SPH_C32(0x14497428), SPH_C32(0xad995c00), + SPH_C32(0x9ae50000), SPH_C32(0x7e1d0000), SPH_C32(0x0dfe0000), + SPH_C32(0xf3c77912), SPH_C32(0xc9089fcf), SPH_C32(0x0bf8b617), + SPH_C32(0x4ed91456) }, + { SPH_C32(0x4eaeba70), SPH_C32(0x57200000), SPH_C32(0x5c930000), + SPH_C32(0xb7480000), SPH_C32(0x028a0ca0), SPH_C32(0x439a6a30), + SPH_C32(0x915b1cf2), SPH_C32(0x86062922), SPH_C32(0x64f25c30), + SPH_C32(0x7dc00000), SPH_C32(0x51990000), SPH_C32(0x2bb10000), + SPH_C32(0xfbae22eb), SPH_C32(0xa4f46ef8), SPH_C32(0x5b67df93), + SPH_C32(0xd0b0bb3e) }, + { SPH_C32(0x68ceb830), SPH_C32(0x8af80000), SPH_C32(0x2eb90000), + SPH_C32(0xf84e0000), SPH_C32(0x91ec6b5f), SPH_C32(0x6a632efe), + SPH_C32(0xa7d07f27), SPH_C32(0x8a20db40), SPH_C32(0x8bf95e40), + SPH_C32(0x473d0000), SPH_C32(0x0c370000), SPH_C32(0x42f80000), + SPH_C32(0x60a11eed), SPH_C32(0xe0f1db01), SPH_C32(0x3d73d5c2), + SPH_C32(0x42ffe634) }, + { SPH_C32(0x87c5ba40), SPH_C32(0xb0050000), SPH_C32(0x73170000), + SPH_C32(0x91070000), SPH_C32(0x0ae35759), SPH_C32(0x2e669b07), + SPH_C32(0xc1c47576), SPH_C32(0x186f864a), SPH_C32(0x42925e70), + SPH_C32(0xa0180000), SPH_C32(0x23b30000), SPH_C32(0x64b70000), + SPH_C32(0x68c84514), SPH_C32(0x8d0d2a36), SPH_C32(0x6decbc46), + SPH_C32(0xdc96495c) }, + { SPH_C32(0x96989000), SPH_C32(0x1c8d0000), SPH_C32(0x94dd0000), + SPH_C32(0xd4150000), SPH_C32(0x242929af), SPH_C32(0x4f7047f8), + SPH_C32(0xb2227bbc), SPH_C32(0x29e3b6f2), SPH_C32(0xb9c36000), + SPH_C32(0x230c0000), SPH_C32(0x1f3a0000), SPH_C32(0xfc9f0000), + SPH_C32(0x3da6447e), SPH_C32(0x7941a2b7), SPH_C32(0x4c51d137), + SPH_C32(0xaf573093) }, + { SPH_C32(0x79939270), SPH_C32(0x26700000), SPH_C32(0xc9730000), + SPH_C32(0xbd5c0000), SPH_C32(0xbf2615a9), SPH_C32(0x0b75f201), + SPH_C32(0xd43671ed), SPH_C32(0xbbacebf8), SPH_C32(0x70a86030), + SPH_C32(0xc4290000), SPH_C32(0x30be0000), SPH_C32(0xdad00000), + SPH_C32(0x35cf1f87), SPH_C32(0x14bd5380), SPH_C32(0x1cceb8b3), + SPH_C32(0x313e9ffb) }, + { SPH_C32(0x5ff39030), SPH_C32(0xfba80000), SPH_C32(0xbb590000), + SPH_C32(0xf25a0000), SPH_C32(0x2c407256), SPH_C32(0x228cb6cf), + SPH_C32(0xe2bd1238), SPH_C32(0xb78a199a), SPH_C32(0x9fa36240), + SPH_C32(0xfed40000), SPH_C32(0x6d100000), SPH_C32(0xb3990000), + SPH_C32(0xaec02381), SPH_C32(0x50b8e679), SPH_C32(0x7adab2e2), + SPH_C32(0xa371c2f1) }, + { SPH_C32(0xb0f89240), SPH_C32(0xc1550000), SPH_C32(0xe6f70000), + SPH_C32(0x9b130000), SPH_C32(0xb74f4e50), SPH_C32(0x66890336), + SPH_C32(0x84a91869), SPH_C32(0x25c54490), SPH_C32(0x56c86270), + SPH_C32(0x19f10000), SPH_C32(0x42940000), SPH_C32(0x95d60000), + SPH_C32(0xa6a97878), SPH_C32(0x3d44174e), SPH_C32(0x2a45db66), + SPH_C32(0x3d186d99) }, + { SPH_C32(0x82c2ac00), SPH_C32(0xa5640000), SPH_C32(0xf5fa0000), + SPH_C32(0x25740000), SPH_C32(0xea4814c3), SPH_C32(0xff397a80), + SPH_C32(0xf58b1c9c), SPH_C32(0xc86d9237), SPH_C32(0x9aa47400), + SPH_C32(0xebb50000), SPH_C32(0xebfd0000), SPH_C32(0x07ea0000), + SPH_C32(0x4e6b601b), SPH_C32(0x81e707fe), SPH_C32(0x4e95db08), + SPH_C32(0x7373d68c) }, + { SPH_C32(0x6dc9ae70), SPH_C32(0x9f990000), SPH_C32(0xa8540000), + SPH_C32(0x4c3d0000), SPH_C32(0x714728c5), SPH_C32(0xbb3ccf79), + SPH_C32(0x939f16cd), SPH_C32(0x5a22cf3d), SPH_C32(0x53cf7430), + SPH_C32(0x0c900000), SPH_C32(0xc4790000), SPH_C32(0x21a50000), + SPH_C32(0x46023be2), SPH_C32(0xec1bf6c9), SPH_C32(0x1e0ab28c), + SPH_C32(0xed1a79e4) }, + { SPH_C32(0x4ba9ac30), SPH_C32(0x42410000), SPH_C32(0xda7e0000), + SPH_C32(0x033b0000), SPH_C32(0xe2214f3a), SPH_C32(0x92c58bb7), + SPH_C32(0xa5147518), SPH_C32(0x56043d5f), SPH_C32(0xbcc47640), + SPH_C32(0x366d0000), SPH_C32(0x99d70000), SPH_C32(0x48ec0000), + SPH_C32(0xdd0d07e4), SPH_C32(0xa81e4330), SPH_C32(0x781eb8dd), + SPH_C32(0x7f5524ee) }, + { SPH_C32(0xa4a2ae40), SPH_C32(0x78bc0000), SPH_C32(0x87d00000), + SPH_C32(0x6a720000), SPH_C32(0x792e733c), SPH_C32(0xd6c03e4e), + SPH_C32(0xc3007f49), SPH_C32(0xc44b6055), SPH_C32(0x75af7670), + SPH_C32(0xd1480000), SPH_C32(0xb6530000), SPH_C32(0x6ea30000), + SPH_C32(0xd5645c1d), SPH_C32(0xc5e2b207), SPH_C32(0x2881d159), + SPH_C32(0xe13c8b86) }, + { SPH_C32(0xe1d7d800), SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), + SPH_C32(0x8ea50000), SPH_C32(0xe4466aba), SPH_C32(0x23732650), + SPH_C32(0xdb56301e), SPH_C32(0xa0dc676f), SPH_C32(0x12455000), + SPH_C32(0xe28f0000), SPH_C32(0x188b0000), SPH_C32(0x1b180000), + SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), SPH_C32(0x4a3a8ff2), + SPH_C32(0xea373c60) }, + { SPH_C32(0x0edcda70), SPH_C32(0x04240000), SPH_C32(0xf8620000), + SPH_C32(0xe7ec0000), SPH_C32(0x7f4956bc), SPH_C32(0x677693a9), + SPH_C32(0xbd423a4f), SPH_C32(0x32933a65), SPH_C32(0xdb2e5030), + SPH_C32(0x05aa0000), SPH_C32(0x370f0000), SPH_C32(0x3d570000), + SPH_C32(0xd15945cb), SPH_C32(0xbd461e45), SPH_C32(0x1aa5e676), + SPH_C32(0x745e9308) }, + { SPH_C32(0x28bcd830), SPH_C32(0xd9fc0000), SPH_C32(0x8a480000), + SPH_C32(0xa8ea0000), SPH_C32(0xec2f3143), SPH_C32(0x4e8fd767), + SPH_C32(0x8bc9599a), SPH_C32(0x3eb5c807), SPH_C32(0x34255240), + SPH_C32(0x3f570000), SPH_C32(0x6aa10000), SPH_C32(0x541e0000), + SPH_C32(0x4a5679cd), SPH_C32(0xf943abbc), SPH_C32(0x7cb1ec27), + SPH_C32(0xe611ce02) }, + { SPH_C32(0xc7b7da40), SPH_C32(0xe3010000), SPH_C32(0xd7e60000), + SPH_C32(0xc1a30000), SPH_C32(0x77200d45), SPH_C32(0x0a8a629e), + SPH_C32(0xeddd53cb), SPH_C32(0xacfa950d), SPH_C32(0xfd4e5270), + SPH_C32(0xd8720000), SPH_C32(0x45250000), SPH_C32(0x72510000), + SPH_C32(0x423f2234), SPH_C32(0x94bf5a8b), SPH_C32(0x2c2e85a3), + SPH_C32(0x7878616a) }, + { SPH_C32(0xf58de400), SPH_C32(0x87300000), SPH_C32(0xc4eb0000), + SPH_C32(0x7fc40000), SPH_C32(0x2a2757d6), SPH_C32(0x933a1b28), + SPH_C32(0x9cff573e), SPH_C32(0x415243aa), SPH_C32(0x31224400), + SPH_C32(0x2a360000), SPH_C32(0xec4c0000), SPH_C32(0xe06d0000), + SPH_C32(0xaafd3a57), SPH_C32(0x281c4a3b), SPH_C32(0x48fe85cd), + SPH_C32(0x3613da7f) }, + { SPH_C32(0x1a86e670), SPH_C32(0xbdcd0000), SPH_C32(0x99450000), + SPH_C32(0x168d0000), SPH_C32(0xb1286bd0), SPH_C32(0xd73faed1), + SPH_C32(0xfaeb5d6f), SPH_C32(0xd31d1ea0), SPH_C32(0xf8494430), + SPH_C32(0xcd130000), SPH_C32(0xc3c80000), SPH_C32(0xc6220000), + SPH_C32(0xa29461ae), SPH_C32(0x45e0bb0c), SPH_C32(0x1861ec49), + SPH_C32(0xa87a7517) }, + { SPH_C32(0x3ce6e430), SPH_C32(0x60150000), SPH_C32(0xeb6f0000), + SPH_C32(0x598b0000), SPH_C32(0x224e0c2f), SPH_C32(0xfec6ea1f), + SPH_C32(0xcc603eba), SPH_C32(0xdf3becc2), SPH_C32(0x17424640), + SPH_C32(0xf7ee0000), SPH_C32(0x9e660000), SPH_C32(0xaf6b0000), + SPH_C32(0x399b5da8), SPH_C32(0x01e50ef5), SPH_C32(0x7e75e618), + SPH_C32(0x3a35281d) }, + { SPH_C32(0xd3ede640), SPH_C32(0x5ae80000), SPH_C32(0xb6c10000), + SPH_C32(0x30c20000), SPH_C32(0xb9413029), SPH_C32(0xbac35fe6), + SPH_C32(0xaa7434eb), SPH_C32(0x4d74b1c8), SPH_C32(0xde294670), + SPH_C32(0x10cb0000), SPH_C32(0xb1e20000), SPH_C32(0x89240000), + SPH_C32(0x31f20651), SPH_C32(0x6c19ffc2), SPH_C32(0x2eea8f9c), + SPH_C32(0xa45c8775) }, + { SPH_C32(0xc2b0cc00), SPH_C32(0xf6600000), SPH_C32(0x510b0000), + SPH_C32(0x75d00000), SPH_C32(0x978b4edf), SPH_C32(0xdbd58319), + SPH_C32(0xd9923a21), SPH_C32(0x7cf88170), SPH_C32(0x25787800), + SPH_C32(0x93df0000), SPH_C32(0x8d6b0000), SPH_C32(0x110c0000), + SPH_C32(0x649c073b), SPH_C32(0x98557743), SPH_C32(0x0f57e2ed), + SPH_C32(0xd79dfeba) }, + { SPH_C32(0x2dbbce70), SPH_C32(0xcc9d0000), SPH_C32(0x0ca50000), + SPH_C32(0x1c990000), SPH_C32(0x0c8472d9), SPH_C32(0x9fd036e0), + SPH_C32(0xbf863070), SPH_C32(0xeeb7dc7a), SPH_C32(0xec137830), + SPH_C32(0x74fa0000), SPH_C32(0xa2ef0000), SPH_C32(0x37430000), + SPH_C32(0x6cf55cc2), SPH_C32(0xf5a98674), SPH_C32(0x5fc88b69), + SPH_C32(0x49f451d2) }, + { SPH_C32(0x0bdbcc30), SPH_C32(0x11450000), SPH_C32(0x7e8f0000), + SPH_C32(0x539f0000), SPH_C32(0x9fe21526), SPH_C32(0xb629722e), + SPH_C32(0x890d53a5), SPH_C32(0xe2912e18), SPH_C32(0x03187a40), + SPH_C32(0x4e070000), SPH_C32(0xff410000), SPH_C32(0x5e0a0000), + SPH_C32(0xf7fa60c4), SPH_C32(0xb1ac338d), SPH_C32(0x39dc8138), + SPH_C32(0xdbbb0cd8) }, + { SPH_C32(0xe4d0ce40), SPH_C32(0x2bb80000), SPH_C32(0x23210000), + SPH_C32(0x3ad60000), SPH_C32(0x04ed2920), SPH_C32(0xf22cc7d7), + SPH_C32(0xef1959f4), SPH_C32(0x70de7312), SPH_C32(0xca737a70), + SPH_C32(0xa9220000), SPH_C32(0xd0c50000), SPH_C32(0x78450000), + SPH_C32(0xff933b3d), SPH_C32(0xdc50c2ba), SPH_C32(0x6943e8bc), + SPH_C32(0x45d2a3b0) }, + { SPH_C32(0xd6eaf000), SPH_C32(0x4f890000), SPH_C32(0x302c0000), + SPH_C32(0x84b10000), SPH_C32(0x59ea73b3), SPH_C32(0x6b9cbe61), + SPH_C32(0x9e3b5d01), SPH_C32(0x9d76a5b5), SPH_C32(0x061f6c00), + SPH_C32(0x5b660000), SPH_C32(0x79ac0000), SPH_C32(0xea790000), + SPH_C32(0x1751235e), SPH_C32(0x60f3d20a), SPH_C32(0x0d93e8d2), + SPH_C32(0x0bb918a5) }, + { SPH_C32(0x39e1f270), SPH_C32(0x75740000), SPH_C32(0x6d820000), + SPH_C32(0xedf80000), SPH_C32(0xc2e54fb5), SPH_C32(0x2f990b98), + SPH_C32(0xf82f5750), SPH_C32(0x0f39f8bf), SPH_C32(0xcf746c30), + SPH_C32(0xbc430000), SPH_C32(0x56280000), SPH_C32(0xcc360000), + SPH_C32(0x1f3878a7), SPH_C32(0x0d0f233d), SPH_C32(0x5d0c8156), + SPH_C32(0x95d0b7cd) }, + { SPH_C32(0x1f81f030), SPH_C32(0xa8ac0000), SPH_C32(0x1fa80000), + SPH_C32(0xa2fe0000), SPH_C32(0x5183284a), SPH_C32(0x06604f56), + SPH_C32(0xcea43485), SPH_C32(0x031f0add), SPH_C32(0x207f6e40), + SPH_C32(0x86be0000), SPH_C32(0x0b860000), SPH_C32(0xa57f0000), + SPH_C32(0x843744a1), SPH_C32(0x490a96c4), SPH_C32(0x3b188b07), + SPH_C32(0x079feac7) }, + { SPH_C32(0xf08af240), SPH_C32(0x92510000), SPH_C32(0x42060000), + SPH_C32(0xcbb70000), SPH_C32(0xca8c144c), SPH_C32(0x4265faaf), + SPH_C32(0xa8b03ed4), SPH_C32(0x915057d7), SPH_C32(0xe9146e70), + SPH_C32(0x619b0000), SPH_C32(0x24020000), SPH_C32(0x83300000), + SPH_C32(0x8c5e1f58), SPH_C32(0x24f667f3), SPH_C32(0x6b87e283), + SPH_C32(0x99f645af) }, + { SPH_C32(0x466d0c00), SPH_C32(0x08620000), SPH_C32(0xdd5d0000), + SPH_C32(0xbadd0000), SPH_C32(0x6a927942), SPH_C32(0x441f2b93), + SPH_C32(0x218ace6f), SPH_C32(0xbf2c0be2), SPH_C32(0x6f299000), + SPH_C32(0x6c850000), SPH_C32(0x2f160000), SPH_C32(0x782e0000), + SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), SPH_C32(0xd26a8c36), + SPH_C32(0x32219526) }, + { SPH_C32(0xa9660e70), SPH_C32(0x329f0000), SPH_C32(0x80f30000), + SPH_C32(0xd3940000), SPH_C32(0xf19d4544), SPH_C32(0x001a9e6a), + SPH_C32(0x479ec43e), SPH_C32(0x2d6356e8), SPH_C32(0xa6429030), + SPH_C32(0x8ba00000), SPH_C32(0x00920000), SPH_C32(0x5e610000), + SPH_C32(0x6c256c34), SPH_C32(0x7f21ede1), SPH_C32(0x82f5e5b2), + SPH_C32(0xac483a4e) }, + { SPH_C32(0x8f060c30), SPH_C32(0xef470000), SPH_C32(0xf2d90000), + SPH_C32(0x9c920000), SPH_C32(0x62fb22bb), SPH_C32(0x29e3daa4), + SPH_C32(0x7115a7eb), SPH_C32(0x2145a48a), SPH_C32(0x49499240), + SPH_C32(0xb15d0000), SPH_C32(0x5d3c0000), SPH_C32(0x37280000), + SPH_C32(0xf72a5032), SPH_C32(0x3b245818), SPH_C32(0xe4e1efe3), + SPH_C32(0x3e076744) }, + { SPH_C32(0x600d0e40), SPH_C32(0xd5ba0000), SPH_C32(0xaf770000), + SPH_C32(0xf5db0000), SPH_C32(0xf9f41ebd), SPH_C32(0x6de66f5d), + SPH_C32(0x1701adba), SPH_C32(0xb30af980), SPH_C32(0x80229270), + SPH_C32(0x56780000), SPH_C32(0x72b80000), SPH_C32(0x11670000), + SPH_C32(0xff430bcb), SPH_C32(0x56d8a92f), SPH_C32(0xb47e8667), + SPH_C32(0xa06ec82c) }, + { SPH_C32(0x52373000), SPH_C32(0xb18b0000), SPH_C32(0xbc7a0000), + SPH_C32(0x4bbc0000), SPH_C32(0xa4f3442e), SPH_C32(0xf45616eb), + SPH_C32(0x6623a94f), SPH_C32(0x5ea22f27), SPH_C32(0x4c4e8400), + SPH_C32(0xa43c0000), SPH_C32(0xdbd10000), SPH_C32(0x835b0000), + SPH_C32(0x178113a8), SPH_C32(0xea7bb99f), SPH_C32(0xd0ae8609), + SPH_C32(0xee057339) }, + { SPH_C32(0xbd3c3270), SPH_C32(0x8b760000), SPH_C32(0xe1d40000), + SPH_C32(0x22f50000), SPH_C32(0x3ffc7828), SPH_C32(0xb053a312), + SPH_C32(0x0037a31e), SPH_C32(0xcced722d), SPH_C32(0x85258430), + SPH_C32(0x43190000), SPH_C32(0xf4550000), SPH_C32(0xa5140000), + SPH_C32(0x1fe84851), SPH_C32(0x878748a8), SPH_C32(0x8031ef8d), + SPH_C32(0x706cdc51) }, + { SPH_C32(0x9b5c3030), SPH_C32(0x56ae0000), SPH_C32(0x93fe0000), + SPH_C32(0x6df30000), SPH_C32(0xac9a1fd7), SPH_C32(0x99aae7dc), + SPH_C32(0x36bcc0cb), SPH_C32(0xc0cb804f), SPH_C32(0x6a2e8640), + SPH_C32(0x79e40000), SPH_C32(0xa9fb0000), SPH_C32(0xcc5d0000), + SPH_C32(0x84e77457), SPH_C32(0xc382fd51), SPH_C32(0xe625e5dc), + SPH_C32(0xe223815b) }, + { SPH_C32(0x74573240), SPH_C32(0x6c530000), SPH_C32(0xce500000), + SPH_C32(0x04ba0000), SPH_C32(0x379523d1), SPH_C32(0xddaf5225), + SPH_C32(0x50a8ca9a), SPH_C32(0x5284dd45), SPH_C32(0xa3458670), + SPH_C32(0x9ec10000), SPH_C32(0x867f0000), SPH_C32(0xea120000), + SPH_C32(0x8c8e2fae), SPH_C32(0xae7e0c66), SPH_C32(0xb6ba8c58), + SPH_C32(0x7c4a2e33) }, + { SPH_C32(0x650a1800), SPH_C32(0xc0db0000), SPH_C32(0x299a0000), + SPH_C32(0x41a80000), SPH_C32(0x195f5d27), SPH_C32(0xbcb98eda), + SPH_C32(0x234ec450), SPH_C32(0x6308edfd), SPH_C32(0x5814b800), + SPH_C32(0x1dd50000), SPH_C32(0xbaf60000), SPH_C32(0x723a0000), + SPH_C32(0xd9e02ec4), SPH_C32(0x5a3284e7), SPH_C32(0x9707e129), + SPH_C32(0x0f8b57fc) }, + { SPH_C32(0x8a011a70), SPH_C32(0xfa260000), SPH_C32(0x74340000), + SPH_C32(0x28e10000), SPH_C32(0x82506121), SPH_C32(0xf8bc3b23), + SPH_C32(0x455ace01), SPH_C32(0xf147b0f7), SPH_C32(0x917fb830), + SPH_C32(0xfaf00000), SPH_C32(0x95720000), SPH_C32(0x54750000), + SPH_C32(0xd189753d), SPH_C32(0x37ce75d0), SPH_C32(0xc79888ad), + SPH_C32(0x91e2f894) }, + { SPH_C32(0xac611830), SPH_C32(0x27fe0000), SPH_C32(0x061e0000), + SPH_C32(0x67e70000), SPH_C32(0x113606de), SPH_C32(0xd1457fed), + SPH_C32(0x73d1add4), SPH_C32(0xfd614295), SPH_C32(0x7e74ba40), + SPH_C32(0xc00d0000), SPH_C32(0xc8dc0000), SPH_C32(0x3d3c0000), + SPH_C32(0x4a86493b), SPH_C32(0x73cbc029), SPH_C32(0xa18c82fc), + SPH_C32(0x03ada59e) }, + { SPH_C32(0x436a1a40), SPH_C32(0x1d030000), SPH_C32(0x5bb00000), + SPH_C32(0x0eae0000), SPH_C32(0x8a393ad8), SPH_C32(0x9540ca14), + SPH_C32(0x15c5a785), SPH_C32(0x6f2e1f9f), SPH_C32(0xb71fba70), + SPH_C32(0x27280000), SPH_C32(0xe7580000), SPH_C32(0x1b730000), + SPH_C32(0x42ef12c2), SPH_C32(0x1e37311e), SPH_C32(0xf113eb78), + SPH_C32(0x9dc40af6) }, + { SPH_C32(0x71502400), SPH_C32(0x79320000), SPH_C32(0x48bd0000), + SPH_C32(0xb0c90000), SPH_C32(0xd73e604b), SPH_C32(0x0cf0b3a2), + SPH_C32(0x64e7a370), SPH_C32(0x8286c938), SPH_C32(0x7b73ac00), + SPH_C32(0xd56c0000), SPH_C32(0x4e310000), SPH_C32(0x894f0000), + SPH_C32(0xaa2d0aa1), SPH_C32(0xa29421ae), SPH_C32(0x95c3eb16), + SPH_C32(0xd3afb1e3) }, + { SPH_C32(0x9e5b2670), SPH_C32(0x43cf0000), SPH_C32(0x15130000), + SPH_C32(0xd9800000), SPH_C32(0x4c315c4d), SPH_C32(0x48f5065b), + SPH_C32(0x02f3a921), SPH_C32(0x10c99432), SPH_C32(0xb218ac30), + SPH_C32(0x32490000), SPH_C32(0x61b50000), SPH_C32(0xaf000000), + SPH_C32(0xa2445158), SPH_C32(0xcf68d099), SPH_C32(0xc55c8292), + SPH_C32(0x4dc61e8b) }, + { SPH_C32(0xb83b2430), SPH_C32(0x9e170000), SPH_C32(0x67390000), + SPH_C32(0x96860000), SPH_C32(0xdf573bb2), SPH_C32(0x610c4295), + SPH_C32(0x3478caf4), SPH_C32(0x1cef6650), SPH_C32(0x5d13ae40), + SPH_C32(0x08b40000), SPH_C32(0x3c1b0000), SPH_C32(0xc6490000), + SPH_C32(0x394b6d5e), SPH_C32(0x8b6d6560), SPH_C32(0xa34888c3), + SPH_C32(0xdf894381) }, + { SPH_C32(0x57302640), SPH_C32(0xa4ea0000), SPH_C32(0x3a970000), + SPH_C32(0xffcf0000), SPH_C32(0x445807b4), SPH_C32(0x2509f76c), + SPH_C32(0x526cc0a5), SPH_C32(0x8ea03b5a), SPH_C32(0x9478ae70), + SPH_C32(0xef910000), SPH_C32(0x139f0000), SPH_C32(0xe0060000), + SPH_C32(0x312236a7), SPH_C32(0xe6919457), SPH_C32(0xf3d7e147), + SPH_C32(0x41e0ece9) }, + { SPH_C32(0x12455000), SPH_C32(0xe28f0000), SPH_C32(0x188b0000), + SPH_C32(0x1b180000), SPH_C32(0xd9301e32), SPH_C32(0xd0baef72), + SPH_C32(0x4a3a8ff2), SPH_C32(0xea373c60), SPH_C32(0xf3928800), + SPH_C32(0xdc560000), SPH_C32(0xbd470000), SPH_C32(0x95bd0000), + SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), SPH_C32(0x916cbfec), + SPH_C32(0x4aeb5b0f) }, + { SPH_C32(0xfd4e5270), SPH_C32(0xd8720000), SPH_C32(0x45250000), + SPH_C32(0x72510000), SPH_C32(0x423f2234), SPH_C32(0x94bf5a8b), + SPH_C32(0x2c2e85a3), SPH_C32(0x7878616a), SPH_C32(0x3af98830), + SPH_C32(0x3b730000), SPH_C32(0x92c30000), SPH_C32(0xb3f20000), + SPH_C32(0x351f2f71), SPH_C32(0x9e353815), SPH_C32(0xc1f3d668), + SPH_C32(0xd482f467) }, + { SPH_C32(0xdb2e5030), SPH_C32(0x05aa0000), SPH_C32(0x370f0000), + SPH_C32(0x3d570000), SPH_C32(0xd15945cb), SPH_C32(0xbd461e45), + SPH_C32(0x1aa5e676), SPH_C32(0x745e9308), SPH_C32(0xd5f28a40), + SPH_C32(0x018e0000), SPH_C32(0xcf6d0000), SPH_C32(0xdabb0000), + SPH_C32(0xae101377), SPH_C32(0xda308dec), SPH_C32(0xa7e7dc39), + SPH_C32(0x46cda96d) }, + { SPH_C32(0x34255240), SPH_C32(0x3f570000), SPH_C32(0x6aa10000), + SPH_C32(0x541e0000), SPH_C32(0x4a5679cd), SPH_C32(0xf943abbc), + SPH_C32(0x7cb1ec27), SPH_C32(0xe611ce02), SPH_C32(0x1c998a70), + SPH_C32(0xe6ab0000), SPH_C32(0xe0e90000), SPH_C32(0xfcf40000), + SPH_C32(0xa679488e), SPH_C32(0xb7cc7cdb), SPH_C32(0xf778b5bd), + SPH_C32(0xd8a40605) }, + { SPH_C32(0x061f6c00), SPH_C32(0x5b660000), SPH_C32(0x79ac0000), + SPH_C32(0xea790000), SPH_C32(0x1751235e), SPH_C32(0x60f3d20a), + SPH_C32(0x0d93e8d2), SPH_C32(0x0bb918a5), SPH_C32(0xd0f59c00), + SPH_C32(0x14ef0000), SPH_C32(0x49800000), SPH_C32(0x6ec80000), + SPH_C32(0x4ebb50ed), SPH_C32(0x0b6f6c6b), SPH_C32(0x93a8b5d3), + SPH_C32(0x96cfbd10) }, + { SPH_C32(0xe9146e70), SPH_C32(0x619b0000), SPH_C32(0x24020000), + SPH_C32(0x83300000), SPH_C32(0x8c5e1f58), SPH_C32(0x24f667f3), + SPH_C32(0x6b87e283), SPH_C32(0x99f645af), SPH_C32(0x199e9c30), + SPH_C32(0xf3ca0000), SPH_C32(0x66040000), SPH_C32(0x48870000), + SPH_C32(0x46d20b14), SPH_C32(0x66939d5c), SPH_C32(0xc337dc57), + SPH_C32(0x08a61278) }, + { SPH_C32(0xcf746c30), SPH_C32(0xbc430000), SPH_C32(0x56280000), + SPH_C32(0xcc360000), SPH_C32(0x1f3878a7), SPH_C32(0x0d0f233d), + SPH_C32(0x5d0c8156), SPH_C32(0x95d0b7cd), SPH_C32(0xf6959e40), + SPH_C32(0xc9370000), SPH_C32(0x3baa0000), SPH_C32(0x21ce0000), + SPH_C32(0xdddd3712), SPH_C32(0x229628a5), SPH_C32(0xa523d606), + SPH_C32(0x9ae94f72) }, + { SPH_C32(0x207f6e40), SPH_C32(0x86be0000), SPH_C32(0x0b860000), + SPH_C32(0xa57f0000), SPH_C32(0x843744a1), SPH_C32(0x490a96c4), + SPH_C32(0x3b188b07), SPH_C32(0x079feac7), SPH_C32(0x3ffe9e70), + SPH_C32(0x2e120000), SPH_C32(0x142e0000), SPH_C32(0x07810000), + SPH_C32(0xd5b46ceb), SPH_C32(0x4f6ad992), SPH_C32(0xf5bcbf82), + SPH_C32(0x0480e01a) }, + { SPH_C32(0x31224400), SPH_C32(0x2a360000), SPH_C32(0xec4c0000), + SPH_C32(0xe06d0000), SPH_C32(0xaafd3a57), SPH_C32(0x281c4a3b), + SPH_C32(0x48fe85cd), SPH_C32(0x3613da7f), SPH_C32(0xc4afa000), + SPH_C32(0xad060000), SPH_C32(0x28a70000), SPH_C32(0x9fa90000), + SPH_C32(0x80da6d81), SPH_C32(0xbb265113), SPH_C32(0xd401d2f3), + SPH_C32(0x774199d5) }, + { SPH_C32(0xde294670), SPH_C32(0x10cb0000), SPH_C32(0xb1e20000), + SPH_C32(0x89240000), SPH_C32(0x31f20651), SPH_C32(0x6c19ffc2), + SPH_C32(0x2eea8f9c), SPH_C32(0xa45c8775), SPH_C32(0x0dc4a030), + SPH_C32(0x4a230000), SPH_C32(0x07230000), SPH_C32(0xb9e60000), + SPH_C32(0x88b33678), SPH_C32(0xd6daa024), SPH_C32(0x849ebb77), + SPH_C32(0xe92836bd) }, + { SPH_C32(0xf8494430), SPH_C32(0xcd130000), SPH_C32(0xc3c80000), + SPH_C32(0xc6220000), SPH_C32(0xa29461ae), SPH_C32(0x45e0bb0c), + SPH_C32(0x1861ec49), SPH_C32(0xa87a7517), SPH_C32(0xe2cfa240), + SPH_C32(0x70de0000), SPH_C32(0x5a8d0000), SPH_C32(0xd0af0000), + SPH_C32(0x13bc0a7e), SPH_C32(0x92df15dd), SPH_C32(0xe28ab126), + SPH_C32(0x7b676bb7) }, + { SPH_C32(0x17424640), SPH_C32(0xf7ee0000), SPH_C32(0x9e660000), + SPH_C32(0xaf6b0000), SPH_C32(0x399b5da8), SPH_C32(0x01e50ef5), + SPH_C32(0x7e75e618), SPH_C32(0x3a35281d), SPH_C32(0x2ba4a270), + SPH_C32(0x97fb0000), SPH_C32(0x75090000), SPH_C32(0xf6e00000), + SPH_C32(0x1bd55187), SPH_C32(0xff23e4ea), SPH_C32(0xb215d8a2), + SPH_C32(0xe50ec4df) }, + { SPH_C32(0x25787800), SPH_C32(0x93df0000), SPH_C32(0x8d6b0000), + SPH_C32(0x110c0000), SPH_C32(0x649c073b), SPH_C32(0x98557743), + SPH_C32(0x0f57e2ed), SPH_C32(0xd79dfeba), SPH_C32(0xe7c8b400), + SPH_C32(0x65bf0000), SPH_C32(0xdc600000), SPH_C32(0x64dc0000), + SPH_C32(0xf31749e4), SPH_C32(0x4380f45a), SPH_C32(0xd6c5d8cc), + SPH_C32(0xab657fca) }, + { SPH_C32(0xca737a70), SPH_C32(0xa9220000), SPH_C32(0xd0c50000), + SPH_C32(0x78450000), SPH_C32(0xff933b3d), SPH_C32(0xdc50c2ba), + SPH_C32(0x6943e8bc), SPH_C32(0x45d2a3b0), SPH_C32(0x2ea3b430), + SPH_C32(0x829a0000), SPH_C32(0xf3e40000), SPH_C32(0x42930000), + SPH_C32(0xfb7e121d), SPH_C32(0x2e7c056d), SPH_C32(0x865ab148), + SPH_C32(0x350cd0a2) }, + { SPH_C32(0xec137830), SPH_C32(0x74fa0000), SPH_C32(0xa2ef0000), + SPH_C32(0x37430000), SPH_C32(0x6cf55cc2), SPH_C32(0xf5a98674), + SPH_C32(0x5fc88b69), SPH_C32(0x49f451d2), SPH_C32(0xc1a8b640), + SPH_C32(0xb8670000), SPH_C32(0xae4a0000), SPH_C32(0x2bda0000), + SPH_C32(0x60712e1b), SPH_C32(0x6a79b094), SPH_C32(0xe04ebb19), + SPH_C32(0xa7438da8) }, + { SPH_C32(0x03187a40), SPH_C32(0x4e070000), SPH_C32(0xff410000), + SPH_C32(0x5e0a0000), SPH_C32(0xf7fa60c4), SPH_C32(0xb1ac338d), + SPH_C32(0x39dc8138), SPH_C32(0xdbbb0cd8), SPH_C32(0x08c3b670), + SPH_C32(0x5f420000), SPH_C32(0x81ce0000), SPH_C32(0x0d950000), + SPH_C32(0x681875e2), SPH_C32(0x078541a3), SPH_C32(0xb0d1d29d), + SPH_C32(0x392a22c0) }, + { SPH_C32(0xdad61400), SPH_C32(0xb8b10000), SPH_C32(0x4f0c0000), + SPH_C32(0x574e0000), SPH_C32(0x33a83a07), SPH_C32(0xa50bfe67), + SPH_C32(0x628cfdb5), SPH_C32(0xc7e6c5cb), SPH_C32(0xa7bad400), + SPH_C32(0x36bb0000), SPH_C32(0x78910000), SPH_C32(0x34780000), + SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), SPH_C32(0xfadcfe71), + SPH_C32(0x1ff06c8d) }, + { SPH_C32(0x35dd1670), SPH_C32(0x824c0000), SPH_C32(0x12a20000), + SPH_C32(0x3e070000), SPH_C32(0xa8a70601), SPH_C32(0xe10e4b9e), + SPH_C32(0x0498f7e4), SPH_C32(0x55a998c1), SPH_C32(0x6ed1d430), + SPH_C32(0xd19e0000), SPH_C32(0x57150000), SPH_C32(0x12370000), + SPH_C32(0x86bd4801), SPH_C32(0x0a90fcf4), SPH_C32(0xaa4397f5), + SPH_C32(0x8199c3e5) }, + { SPH_C32(0x13bd1430), SPH_C32(0x5f940000), SPH_C32(0x60880000), + SPH_C32(0x71010000), SPH_C32(0x3bc161fe), SPH_C32(0xc8f70f50), + SPH_C32(0x32139431), SPH_C32(0x598f6aa3), SPH_C32(0x81dad640), + SPH_C32(0xeb630000), SPH_C32(0x0abb0000), SPH_C32(0x7b7e0000), + SPH_C32(0x1db27407), SPH_C32(0x4e95490d), SPH_C32(0xcc579da4), + SPH_C32(0x13d69eef) }, + { SPH_C32(0xfcb61640), SPH_C32(0x65690000), SPH_C32(0x3d260000), + SPH_C32(0x18480000), SPH_C32(0xa0ce5df8), SPH_C32(0x8cf2baa9), + SPH_C32(0x54079e60), SPH_C32(0xcbc037a9), SPH_C32(0x48b1d670), + SPH_C32(0x0c460000), SPH_C32(0x253f0000), SPH_C32(0x5d310000), + SPH_C32(0x15db2ffe), SPH_C32(0x2369b83a), SPH_C32(0x9cc8f420), + SPH_C32(0x8dbf3187) }, + { SPH_C32(0xce8c2800), SPH_C32(0x01580000), SPH_C32(0x2e2b0000), + SPH_C32(0xa62f0000), SPH_C32(0xfdc9076b), SPH_C32(0x1542c31f), + SPH_C32(0x25259a95), SPH_C32(0x2668e10e), SPH_C32(0x84ddc000), + SPH_C32(0xfe020000), SPH_C32(0x8c560000), SPH_C32(0xcf0d0000), + SPH_C32(0xfd19379d), SPH_C32(0x9fcaa88a), SPH_C32(0xf818f44e), + SPH_C32(0xc3d48a92) }, + { SPH_C32(0x21872a70), SPH_C32(0x3ba50000), SPH_C32(0x73850000), + SPH_C32(0xcf660000), SPH_C32(0x66c63b6d), SPH_C32(0x514776e6), + SPH_C32(0x433190c4), SPH_C32(0xb427bc04), SPH_C32(0x4db6c030), + SPH_C32(0x19270000), SPH_C32(0xa3d20000), SPH_C32(0xe9420000), + SPH_C32(0xf5706c64), SPH_C32(0xf23659bd), SPH_C32(0xa8879dca), + SPH_C32(0x5dbd25fa) }, + { SPH_C32(0x07e72830), SPH_C32(0xe67d0000), SPH_C32(0x01af0000), + SPH_C32(0x80600000), SPH_C32(0xf5a05c92), SPH_C32(0x78be3228), + SPH_C32(0x75baf311), SPH_C32(0xb8014e66), SPH_C32(0xa2bdc240), + SPH_C32(0x23da0000), SPH_C32(0xfe7c0000), SPH_C32(0x800b0000), + SPH_C32(0x6e7f5062), SPH_C32(0xb633ec44), SPH_C32(0xce93979b), + SPH_C32(0xcff278f0) }, + { SPH_C32(0xe8ec2a40), SPH_C32(0xdc800000), SPH_C32(0x5c010000), + SPH_C32(0xe9290000), SPH_C32(0x6eaf6094), SPH_C32(0x3cbb87d1), + SPH_C32(0x13aef940), SPH_C32(0x2a4e136c), SPH_C32(0x6bd6c270), + SPH_C32(0xc4ff0000), SPH_C32(0xd1f80000), SPH_C32(0xa6440000), + SPH_C32(0x66160b9b), SPH_C32(0xdbcf1d73), SPH_C32(0x9e0cfe1f), + SPH_C32(0x519bd798) }, + { SPH_C32(0xf9b10000), SPH_C32(0x70080000), SPH_C32(0xbbcb0000), + SPH_C32(0xac3b0000), SPH_C32(0x40651e62), SPH_C32(0x5dad5b2e), + SPH_C32(0x6048f78a), SPH_C32(0x1bc223d4), SPH_C32(0x9087fc00), + SPH_C32(0x47eb0000), SPH_C32(0xed710000), SPH_C32(0x3e6c0000), + SPH_C32(0x33780af1), SPH_C32(0x2f8395f2), SPH_C32(0xbfb1936e), + SPH_C32(0x225aae57) }, + { SPH_C32(0x16ba0270), SPH_C32(0x4af50000), SPH_C32(0xe6650000), + SPH_C32(0xc5720000), SPH_C32(0xdb6a2264), SPH_C32(0x19a8eed7), + SPH_C32(0x065cfddb), SPH_C32(0x898d7ede), SPH_C32(0x59ecfc30), + SPH_C32(0xa0ce0000), SPH_C32(0xc2f50000), SPH_C32(0x18230000), + SPH_C32(0x3b115108), SPH_C32(0x427f64c5), SPH_C32(0xef2efaea), + SPH_C32(0xbc33013f) }, + { SPH_C32(0x30da0030), SPH_C32(0x972d0000), SPH_C32(0x944f0000), + SPH_C32(0x8a740000), SPH_C32(0x480c459b), SPH_C32(0x3051aa19), + SPH_C32(0x30d79e0e), SPH_C32(0x85ab8cbc), SPH_C32(0xb6e7fe40), + SPH_C32(0x9a330000), SPH_C32(0x9f5b0000), SPH_C32(0x716a0000), + SPH_C32(0xa01e6d0e), SPH_C32(0x067ad13c), SPH_C32(0x893af0bb), + SPH_C32(0x2e7c5c35) }, + { SPH_C32(0xdfd10240), SPH_C32(0xadd00000), SPH_C32(0xc9e10000), + SPH_C32(0xe33d0000), SPH_C32(0xd303799d), SPH_C32(0x74541fe0), + SPH_C32(0x56c3945f), SPH_C32(0x17e4d1b6), SPH_C32(0x7f8cfe70), + SPH_C32(0x7d160000), SPH_C32(0xb0df0000), SPH_C32(0x57250000), + SPH_C32(0xa87736f7), SPH_C32(0x6b86200b), SPH_C32(0xd9a5993f), + SPH_C32(0xb015f35d) }, + { SPH_C32(0xedeb3c00), SPH_C32(0xc9e10000), SPH_C32(0xdaec0000), + SPH_C32(0x5d5a0000), SPH_C32(0x8e04230e), SPH_C32(0xede46656), + SPH_C32(0x27e190aa), SPH_C32(0xfa4c0711), SPH_C32(0xb3e0e800), + SPH_C32(0x8f520000), SPH_C32(0x19b60000), SPH_C32(0xc5190000), + SPH_C32(0x40b52e94), SPH_C32(0xd72530bb), SPH_C32(0xbd759951), + SPH_C32(0xfe7e4848) }, + { SPH_C32(0x02e03e70), SPH_C32(0xf31c0000), SPH_C32(0x87420000), + SPH_C32(0x34130000), SPH_C32(0x150b1f08), SPH_C32(0xa9e1d3af), + SPH_C32(0x41f59afb), SPH_C32(0x68035a1b), SPH_C32(0x7a8be830), + SPH_C32(0x68770000), SPH_C32(0x36320000), SPH_C32(0xe3560000), + SPH_C32(0x48dc756d), SPH_C32(0xbad9c18c), SPH_C32(0xedeaf0d5), + SPH_C32(0x6017e720) }, + { SPH_C32(0x24803c30), SPH_C32(0x2ec40000), SPH_C32(0xf5680000), + SPH_C32(0x7b150000), SPH_C32(0x866d78f7), SPH_C32(0x80189761), + SPH_C32(0x777ef92e), SPH_C32(0x6425a879), SPH_C32(0x9580ea40), + SPH_C32(0x528a0000), SPH_C32(0x6b9c0000), SPH_C32(0x8a1f0000), + SPH_C32(0xd3d3496b), SPH_C32(0xfedc7475), SPH_C32(0x8bfefa84), + SPH_C32(0xf258ba2a) }, + { SPH_C32(0xcb8b3e40), SPH_C32(0x14390000), SPH_C32(0xa8c60000), + SPH_C32(0x125c0000), SPH_C32(0x1d6244f1), SPH_C32(0xc41d2298), + SPH_C32(0x116af37f), SPH_C32(0xf66af573), SPH_C32(0x5cebea70), + SPH_C32(0xb5af0000), SPH_C32(0x44180000), SPH_C32(0xac500000), + SPH_C32(0xdbba1292), SPH_C32(0x93208542), SPH_C32(0xdb619300), + SPH_C32(0x6c311542) }, + { SPH_C32(0x8efe4800), SPH_C32(0x525c0000), SPH_C32(0x8ada0000), + SPH_C32(0xf68b0000), SPH_C32(0x800a5d77), SPH_C32(0x31ae3a86), + SPH_C32(0x093cbc28), SPH_C32(0x92fdf249), SPH_C32(0x3b01cc00), + SPH_C32(0x86680000), SPH_C32(0xeac00000), SPH_C32(0xd9eb0000), + SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), SPH_C32(0xb9dacdab), + SPH_C32(0x673aa2a4) }, + { SPH_C32(0x61f54a70), SPH_C32(0x68a10000), SPH_C32(0xd7740000), + SPH_C32(0x9fc20000), SPH_C32(0x1b056171), SPH_C32(0x75ab8f7f), + SPH_C32(0x6f28b679), SPH_C32(0x00b2af43), SPH_C32(0xf26acc30), + SPH_C32(0x614d0000), SPH_C32(0xc5440000), SPH_C32(0xffa40000), + SPH_C32(0xdf870b44), SPH_C32(0xeb842900), SPH_C32(0xe945a42f), + SPH_C32(0xf9530dcc) }, + { SPH_C32(0x47954830), SPH_C32(0xb5790000), SPH_C32(0xa55e0000), + SPH_C32(0xd0c40000), SPH_C32(0x8863068e), SPH_C32(0x5c52cbb1), + SPH_C32(0x59a3d5ac), SPH_C32(0x0c945d21), SPH_C32(0x1d61ce40), + SPH_C32(0x5bb00000), SPH_C32(0x98ea0000), SPH_C32(0x96ed0000), + SPH_C32(0x44883742), SPH_C32(0xaf819cf9), SPH_C32(0x8f51ae7e), + SPH_C32(0x6b1c50c6) }, + { SPH_C32(0xa89e4a40), SPH_C32(0x8f840000), SPH_C32(0xf8f00000), + SPH_C32(0xb98d0000), SPH_C32(0x136c3a88), SPH_C32(0x18577e48), + SPH_C32(0x3fb7dffd), SPH_C32(0x9edb002b), SPH_C32(0xd40ace70), + SPH_C32(0xbc950000), SPH_C32(0xb76e0000), SPH_C32(0xb0a20000), + SPH_C32(0x4ce16cbb), SPH_C32(0xc27d6dce), SPH_C32(0xdfcec7fa), + SPH_C32(0xf575ffae) }, + { SPH_C32(0x9aa47400), SPH_C32(0xebb50000), SPH_C32(0xebfd0000), + SPH_C32(0x07ea0000), SPH_C32(0x4e6b601b), SPH_C32(0x81e707fe), + SPH_C32(0x4e95db08), SPH_C32(0x7373d68c), SPH_C32(0x1866d800), + SPH_C32(0x4ed10000), SPH_C32(0x1e070000), SPH_C32(0x229e0000), + SPH_C32(0xa42374d8), SPH_C32(0x7ede7d7e), SPH_C32(0xbb1ec794), + SPH_C32(0xbb1e44bb) }, + { SPH_C32(0x75af7670), SPH_C32(0xd1480000), SPH_C32(0xb6530000), + SPH_C32(0x6ea30000), SPH_C32(0xd5645c1d), SPH_C32(0xc5e2b207), + SPH_C32(0x2881d159), SPH_C32(0xe13c8b86), SPH_C32(0xd10dd830), + SPH_C32(0xa9f40000), SPH_C32(0x31830000), SPH_C32(0x04d10000), + SPH_C32(0xac4a2f21), SPH_C32(0x13228c49), SPH_C32(0xeb81ae10), + SPH_C32(0x2577ebd3) }, + { SPH_C32(0x53cf7430), SPH_C32(0x0c900000), SPH_C32(0xc4790000), + SPH_C32(0x21a50000), SPH_C32(0x46023be2), SPH_C32(0xec1bf6c9), + SPH_C32(0x1e0ab28c), SPH_C32(0xed1a79e4), SPH_C32(0x3e06da40), + SPH_C32(0x93090000), SPH_C32(0x6c2d0000), SPH_C32(0x6d980000), + SPH_C32(0x37451327), SPH_C32(0x572739b0), SPH_C32(0x8d95a441), + SPH_C32(0xb738b6d9) }, + { SPH_C32(0xbcc47640), SPH_C32(0x366d0000), SPH_C32(0x99d70000), + SPH_C32(0x48ec0000), SPH_C32(0xdd0d07e4), SPH_C32(0xa81e4330), + SPH_C32(0x781eb8dd), SPH_C32(0x7f5524ee), SPH_C32(0xf76dda70), + SPH_C32(0x742c0000), SPH_C32(0x43a90000), SPH_C32(0x4bd70000), + SPH_C32(0x3f2c48de), SPH_C32(0x3adbc887), SPH_C32(0xdd0acdc5), + SPH_C32(0x295119b1) }, + { SPH_C32(0xad995c00), SPH_C32(0x9ae50000), SPH_C32(0x7e1d0000), + SPH_C32(0x0dfe0000), SPH_C32(0xf3c77912), SPH_C32(0xc9089fcf), + SPH_C32(0x0bf8b617), SPH_C32(0x4ed91456), SPH_C32(0x0c3ce400), + SPH_C32(0xf7380000), SPH_C32(0x7f200000), SPH_C32(0xd3ff0000), + SPH_C32(0x6a4249b4), SPH_C32(0xce974006), SPH_C32(0xfcb7a0b4), + SPH_C32(0x5a90607e) }, + { SPH_C32(0x42925e70), SPH_C32(0xa0180000), SPH_C32(0x23b30000), + SPH_C32(0x64b70000), SPH_C32(0x68c84514), SPH_C32(0x8d0d2a36), + SPH_C32(0x6decbc46), SPH_C32(0xdc96495c), SPH_C32(0xc557e430), + SPH_C32(0x101d0000), SPH_C32(0x50a40000), SPH_C32(0xf5b00000), + SPH_C32(0x622b124d), SPH_C32(0xa36bb131), SPH_C32(0xac28c930), + SPH_C32(0xc4f9cf16) }, + { SPH_C32(0x64f25c30), SPH_C32(0x7dc00000), SPH_C32(0x51990000), + SPH_C32(0x2bb10000), SPH_C32(0xfbae22eb), SPH_C32(0xa4f46ef8), + SPH_C32(0x5b67df93), SPH_C32(0xd0b0bb3e), SPH_C32(0x2a5ce640), + SPH_C32(0x2ae00000), SPH_C32(0x0d0a0000), SPH_C32(0x9cf90000), + SPH_C32(0xf9242e4b), SPH_C32(0xe76e04c8), SPH_C32(0xca3cc361), + SPH_C32(0x56b6921c) }, + { SPH_C32(0x8bf95e40), SPH_C32(0x473d0000), SPH_C32(0x0c370000), + SPH_C32(0x42f80000), SPH_C32(0x60a11eed), SPH_C32(0xe0f1db01), + SPH_C32(0x3d73d5c2), SPH_C32(0x42ffe634), SPH_C32(0xe337e670), + SPH_C32(0xcdc50000), SPH_C32(0x228e0000), SPH_C32(0xbab60000), + SPH_C32(0xf14d75b2), SPH_C32(0x8a92f5ff), SPH_C32(0x9aa3aae5), + SPH_C32(0xc8df3d74) }, + { SPH_C32(0xb9c36000), SPH_C32(0x230c0000), SPH_C32(0x1f3a0000), + SPH_C32(0xfc9f0000), SPH_C32(0x3da6447e), SPH_C32(0x7941a2b7), + SPH_C32(0x4c51d137), SPH_C32(0xaf573093), SPH_C32(0x2f5bf000), + SPH_C32(0x3f810000), SPH_C32(0x8be70000), SPH_C32(0x288a0000), + SPH_C32(0x198f6dd1), SPH_C32(0x3631e54f), SPH_C32(0xfe73aa8b), + SPH_C32(0x86b48661) }, + { SPH_C32(0x56c86270), SPH_C32(0x19f10000), SPH_C32(0x42940000), + SPH_C32(0x95d60000), SPH_C32(0xa6a97878), SPH_C32(0x3d44174e), + SPH_C32(0x2a45db66), SPH_C32(0x3d186d99), SPH_C32(0xe630f030), + SPH_C32(0xd8a40000), SPH_C32(0xa4630000), SPH_C32(0x0ec50000), + SPH_C32(0x11e63628), SPH_C32(0x5bcd1478), SPH_C32(0xaeecc30f), + SPH_C32(0x18dd2909) }, + { SPH_C32(0x70a86030), SPH_C32(0xc4290000), SPH_C32(0x30be0000), + SPH_C32(0xdad00000), SPH_C32(0x35cf1f87), SPH_C32(0x14bd5380), + SPH_C32(0x1cceb8b3), SPH_C32(0x313e9ffb), SPH_C32(0x093bf240), + SPH_C32(0xe2590000), SPH_C32(0xf9cd0000), SPH_C32(0x678c0000), + SPH_C32(0x8ae90a2e), SPH_C32(0x1fc8a181), SPH_C32(0xc8f8c95e), + SPH_C32(0x8a927403) }, + { SPH_C32(0x9fa36240), SPH_C32(0xfed40000), SPH_C32(0x6d100000), + SPH_C32(0xb3990000), SPH_C32(0xaec02381), SPH_C32(0x50b8e679), + SPH_C32(0x7adab2e2), SPH_C32(0xa371c2f1), SPH_C32(0xc050f270), + SPH_C32(0x057c0000), SPH_C32(0xd6490000), SPH_C32(0x41c30000), + SPH_C32(0x828051d7), SPH_C32(0x723450b6), SPH_C32(0x9867a0da), + SPH_C32(0x14fbdb6b) }, + { SPH_C32(0x6f299000), SPH_C32(0x6c850000), SPH_C32(0x2f160000), + SPH_C32(0x782e0000), SPH_C32(0x644c37cd), SPH_C32(0x12dd1cd6), + SPH_C32(0xd26a8c36), SPH_C32(0x32219526), SPH_C32(0x29449c00), + SPH_C32(0x64e70000), SPH_C32(0xf24b0000), SPH_C32(0xc2f30000), + SPH_C32(0x0ede4e8f), SPH_C32(0x56c23745), SPH_C32(0xf3e04259), + SPH_C32(0x8d0d9ec4) }, + { SPH_C32(0x80229270), SPH_C32(0x56780000), SPH_C32(0x72b80000), + SPH_C32(0x11670000), SPH_C32(0xff430bcb), SPH_C32(0x56d8a92f), + SPH_C32(0xb47e8667), SPH_C32(0xa06ec82c), SPH_C32(0xe02f9c30), + SPH_C32(0x83c20000), SPH_C32(0xddcf0000), SPH_C32(0xe4bc0000), + SPH_C32(0x06b71576), SPH_C32(0x3b3ec672), SPH_C32(0xa37f2bdd), + SPH_C32(0x136431ac) }, + { SPH_C32(0xa6429030), SPH_C32(0x8ba00000), SPH_C32(0x00920000), + SPH_C32(0x5e610000), SPH_C32(0x6c256c34), SPH_C32(0x7f21ede1), + SPH_C32(0x82f5e5b2), SPH_C32(0xac483a4e), SPH_C32(0x0f249e40), + SPH_C32(0xb93f0000), SPH_C32(0x80610000), SPH_C32(0x8df50000), + SPH_C32(0x9db82970), SPH_C32(0x7f3b738b), SPH_C32(0xc56b218c), + SPH_C32(0x812b6ca6) }, + { SPH_C32(0x49499240), SPH_C32(0xb15d0000), SPH_C32(0x5d3c0000), + SPH_C32(0x37280000), SPH_C32(0xf72a5032), SPH_C32(0x3b245818), + SPH_C32(0xe4e1efe3), SPH_C32(0x3e076744), SPH_C32(0xc64f9e70), + SPH_C32(0x5e1a0000), SPH_C32(0xafe50000), SPH_C32(0xabba0000), + SPH_C32(0x95d17289), SPH_C32(0x12c782bc), SPH_C32(0x95f44808), + SPH_C32(0x1f42c3ce) }, + { SPH_C32(0x7b73ac00), SPH_C32(0xd56c0000), SPH_C32(0x4e310000), + SPH_C32(0x894f0000), SPH_C32(0xaa2d0aa1), SPH_C32(0xa29421ae), + SPH_C32(0x95c3eb16), SPH_C32(0xd3afb1e3), SPH_C32(0x0a238800), + SPH_C32(0xac5e0000), SPH_C32(0x068c0000), SPH_C32(0x39860000), + SPH_C32(0x7d136aea), SPH_C32(0xae64920c), SPH_C32(0xf1244866), + SPH_C32(0x512978db) }, + { SPH_C32(0x9478ae70), SPH_C32(0xef910000), SPH_C32(0x139f0000), + SPH_C32(0xe0060000), SPH_C32(0x312236a7), SPH_C32(0xe6919457), + SPH_C32(0xf3d7e147), SPH_C32(0x41e0ece9), SPH_C32(0xc3488830), + SPH_C32(0x4b7b0000), SPH_C32(0x29080000), SPH_C32(0x1fc90000), + SPH_C32(0x757a3113), SPH_C32(0xc398633b), SPH_C32(0xa1bb21e2), + SPH_C32(0xcf40d7b3) }, + { SPH_C32(0xb218ac30), SPH_C32(0x32490000), SPH_C32(0x61b50000), + SPH_C32(0xaf000000), SPH_C32(0xa2445158), SPH_C32(0xcf68d099), + SPH_C32(0xc55c8292), SPH_C32(0x4dc61e8b), SPH_C32(0x2c438a40), + SPH_C32(0x71860000), SPH_C32(0x74a60000), SPH_C32(0x76800000), + SPH_C32(0xee750d15), SPH_C32(0x879dd6c2), SPH_C32(0xc7af2bb3), + SPH_C32(0x5d0f8ab9) }, + { SPH_C32(0x5d13ae40), SPH_C32(0x08b40000), SPH_C32(0x3c1b0000), + SPH_C32(0xc6490000), SPH_C32(0x394b6d5e), SPH_C32(0x8b6d6560), + SPH_C32(0xa34888c3), SPH_C32(0xdf894381), SPH_C32(0xe5288a70), + SPH_C32(0x96a30000), SPH_C32(0x5b220000), SPH_C32(0x50cf0000), + SPH_C32(0xe61c56ec), SPH_C32(0xea6127f5), SPH_C32(0x97304237), + SPH_C32(0xc36625d1) }, + { SPH_C32(0x4c4e8400), SPH_C32(0xa43c0000), SPH_C32(0xdbd10000), + SPH_C32(0x835b0000), SPH_C32(0x178113a8), SPH_C32(0xea7bb99f), + SPH_C32(0xd0ae8609), SPH_C32(0xee057339), SPH_C32(0x1e79b400), + SPH_C32(0x15b70000), SPH_C32(0x67ab0000), SPH_C32(0xc8e70000), + SPH_C32(0xb3725786), SPH_C32(0x1e2daf74), SPH_C32(0xb68d2f46), + SPH_C32(0xb0a75c1e) }, + { SPH_C32(0xa3458670), SPH_C32(0x9ec10000), SPH_C32(0x867f0000), + SPH_C32(0xea120000), SPH_C32(0x8c8e2fae), SPH_C32(0xae7e0c66), + SPH_C32(0xb6ba8c58), SPH_C32(0x7c4a2e33), SPH_C32(0xd712b430), + SPH_C32(0xf2920000), SPH_C32(0x482f0000), SPH_C32(0xeea80000), + SPH_C32(0xbb1b0c7f), SPH_C32(0x73d15e43), SPH_C32(0xe61246c2), + SPH_C32(0x2ecef376) }, + { SPH_C32(0x85258430), SPH_C32(0x43190000), SPH_C32(0xf4550000), + SPH_C32(0xa5140000), SPH_C32(0x1fe84851), SPH_C32(0x878748a8), + SPH_C32(0x8031ef8d), SPH_C32(0x706cdc51), SPH_C32(0x3819b640), + SPH_C32(0xc86f0000), SPH_C32(0x15810000), SPH_C32(0x87e10000), + SPH_C32(0x20143079), SPH_C32(0x37d4ebba), SPH_C32(0x80064c93), + SPH_C32(0xbc81ae7c) }, + { SPH_C32(0x6a2e8640), SPH_C32(0x79e40000), SPH_C32(0xa9fb0000), + SPH_C32(0xcc5d0000), SPH_C32(0x84e77457), SPH_C32(0xc382fd51), + SPH_C32(0xe625e5dc), SPH_C32(0xe223815b), SPH_C32(0xf172b670), + SPH_C32(0x2f4a0000), SPH_C32(0x3a050000), SPH_C32(0xa1ae0000), + SPH_C32(0x287d6b80), SPH_C32(0x5a281a8d), SPH_C32(0xd0992517), + SPH_C32(0x22e80114) }, + { SPH_C32(0x5814b800), SPH_C32(0x1dd50000), SPH_C32(0xbaf60000), + SPH_C32(0x723a0000), SPH_C32(0xd9e02ec4), SPH_C32(0x5a3284e7), + SPH_C32(0x9707e129), SPH_C32(0x0f8b57fc), SPH_C32(0x3d1ea000), + SPH_C32(0xdd0e0000), SPH_C32(0x936c0000), SPH_C32(0x33920000), + SPH_C32(0xc0bf73e3), SPH_C32(0xe68b0a3d), SPH_C32(0xb4492579), + SPH_C32(0x6c83ba01) }, + { SPH_C32(0xb71fba70), SPH_C32(0x27280000), SPH_C32(0xe7580000), + SPH_C32(0x1b730000), SPH_C32(0x42ef12c2), SPH_C32(0x1e37311e), + SPH_C32(0xf113eb78), SPH_C32(0x9dc40af6), SPH_C32(0xf475a030), + SPH_C32(0x3a2b0000), SPH_C32(0xbce80000), SPH_C32(0x15dd0000), + SPH_C32(0xc8d6281a), SPH_C32(0x8b77fb0a), SPH_C32(0xe4d64cfd), + SPH_C32(0xf2ea1569) }, + { SPH_C32(0x917fb830), SPH_C32(0xfaf00000), SPH_C32(0x95720000), + SPH_C32(0x54750000), SPH_C32(0xd189753d), SPH_C32(0x37ce75d0), + SPH_C32(0xc79888ad), SPH_C32(0x91e2f894), SPH_C32(0x1b7ea240), + SPH_C32(0x00d60000), SPH_C32(0xe1460000), SPH_C32(0x7c940000), + SPH_C32(0x53d9141c), SPH_C32(0xcf724ef3), SPH_C32(0x82c246ac), + SPH_C32(0x60a54863) }, + { SPH_C32(0x7e74ba40), SPH_C32(0xc00d0000), SPH_C32(0xc8dc0000), + SPH_C32(0x3d3c0000), SPH_C32(0x4a86493b), SPH_C32(0x73cbc029), + SPH_C32(0xa18c82fc), SPH_C32(0x03ada59e), SPH_C32(0xd215a270), + SPH_C32(0xe7f30000), SPH_C32(0xcec20000), SPH_C32(0x5adb0000), + SPH_C32(0x5bb04fe5), SPH_C32(0xa28ebfc4), SPH_C32(0xd25d2f28), + SPH_C32(0xfecce70b) }, + { SPH_C32(0x3b01cc00), SPH_C32(0x86680000), SPH_C32(0xeac00000), + SPH_C32(0xd9eb0000), SPH_C32(0xd7ee50bd), SPH_C32(0x8678d837), + SPH_C32(0xb9dacdab), SPH_C32(0x673aa2a4), SPH_C32(0xb5ff8400), + SPH_C32(0xd4340000), SPH_C32(0x601a0000), SPH_C32(0x2f600000), + SPH_C32(0x57e40dca), SPH_C32(0xb7d6e2b1), SPH_C32(0xb0e67183), + SPH_C32(0xf5c750ed) }, + { SPH_C32(0xd40ace70), SPH_C32(0xbc950000), SPH_C32(0xb76e0000), + SPH_C32(0xb0a20000), SPH_C32(0x4ce16cbb), SPH_C32(0xc27d6dce), + SPH_C32(0xdfcec7fa), SPH_C32(0xf575ffae), SPH_C32(0x7c948430), + SPH_C32(0x33110000), SPH_C32(0x4f9e0000), SPH_C32(0x092f0000), + SPH_C32(0x5f8d5633), SPH_C32(0xda2a1386), SPH_C32(0xe0791807), + SPH_C32(0x6baeff85) }, + { SPH_C32(0xf26acc30), SPH_C32(0x614d0000), SPH_C32(0xc5440000), + SPH_C32(0xffa40000), SPH_C32(0xdf870b44), SPH_C32(0xeb842900), + SPH_C32(0xe945a42f), SPH_C32(0xf9530dcc), SPH_C32(0x939f8640), + SPH_C32(0x09ec0000), SPH_C32(0x12300000), SPH_C32(0x60660000), + SPH_C32(0xc4826a35), SPH_C32(0x9e2fa67f), SPH_C32(0x866d1256), + SPH_C32(0xf9e1a28f) }, + { SPH_C32(0x1d61ce40), SPH_C32(0x5bb00000), SPH_C32(0x98ea0000), + SPH_C32(0x96ed0000), SPH_C32(0x44883742), SPH_C32(0xaf819cf9), + SPH_C32(0x8f51ae7e), SPH_C32(0x6b1c50c6), SPH_C32(0x5af48670), + SPH_C32(0xeec90000), SPH_C32(0x3db40000), SPH_C32(0x46290000), + SPH_C32(0xcceb31cc), SPH_C32(0xf3d35748), SPH_C32(0xd6f27bd2), + SPH_C32(0x67880de7) }, + { SPH_C32(0x2f5bf000), SPH_C32(0x3f810000), SPH_C32(0x8be70000), + SPH_C32(0x288a0000), SPH_C32(0x198f6dd1), SPH_C32(0x3631e54f), + SPH_C32(0xfe73aa8b), SPH_C32(0x86b48661), SPH_C32(0x96989000), + SPH_C32(0x1c8d0000), SPH_C32(0x94dd0000), SPH_C32(0xd4150000), + SPH_C32(0x242929af), SPH_C32(0x4f7047f8), SPH_C32(0xb2227bbc), + SPH_C32(0x29e3b6f2) }, + { SPH_C32(0xc050f270), SPH_C32(0x057c0000), SPH_C32(0xd6490000), + SPH_C32(0x41c30000), SPH_C32(0x828051d7), SPH_C32(0x723450b6), + SPH_C32(0x9867a0da), SPH_C32(0x14fbdb6b), SPH_C32(0x5ff39030), + SPH_C32(0xfba80000), SPH_C32(0xbb590000), SPH_C32(0xf25a0000), + SPH_C32(0x2c407256), SPH_C32(0x228cb6cf), SPH_C32(0xe2bd1238), + SPH_C32(0xb78a199a) }, + { SPH_C32(0xe630f030), SPH_C32(0xd8a40000), SPH_C32(0xa4630000), + SPH_C32(0x0ec50000), SPH_C32(0x11e63628), SPH_C32(0x5bcd1478), + SPH_C32(0xaeecc30f), SPH_C32(0x18dd2909), SPH_C32(0xb0f89240), + SPH_C32(0xc1550000), SPH_C32(0xe6f70000), SPH_C32(0x9b130000), + SPH_C32(0xb74f4e50), SPH_C32(0x66890336), SPH_C32(0x84a91869), + SPH_C32(0x25c54490) }, + { SPH_C32(0x093bf240), SPH_C32(0xe2590000), SPH_C32(0xf9cd0000), + SPH_C32(0x678c0000), SPH_C32(0x8ae90a2e), SPH_C32(0x1fc8a181), + SPH_C32(0xc8f8c95e), SPH_C32(0x8a927403), SPH_C32(0x79939270), + SPH_C32(0x26700000), SPH_C32(0xc9730000), SPH_C32(0xbd5c0000), + SPH_C32(0xbf2615a9), SPH_C32(0x0b75f201), SPH_C32(0xd43671ed), + SPH_C32(0xbbacebf8) }, + { SPH_C32(0x1866d800), SPH_C32(0x4ed10000), SPH_C32(0x1e070000), + SPH_C32(0x229e0000), SPH_C32(0xa42374d8), SPH_C32(0x7ede7d7e), + SPH_C32(0xbb1ec794), SPH_C32(0xbb1e44bb), SPH_C32(0x82c2ac00), + SPH_C32(0xa5640000), SPH_C32(0xf5fa0000), SPH_C32(0x25740000), + SPH_C32(0xea4814c3), SPH_C32(0xff397a80), SPH_C32(0xf58b1c9c), + SPH_C32(0xc86d9237) }, + { SPH_C32(0xf76dda70), SPH_C32(0x742c0000), SPH_C32(0x43a90000), + SPH_C32(0x4bd70000), SPH_C32(0x3f2c48de), SPH_C32(0x3adbc887), + SPH_C32(0xdd0acdc5), SPH_C32(0x295119b1), SPH_C32(0x4ba9ac30), + SPH_C32(0x42410000), SPH_C32(0xda7e0000), SPH_C32(0x033b0000), + SPH_C32(0xe2214f3a), SPH_C32(0x92c58bb7), SPH_C32(0xa5147518), + SPH_C32(0x56043d5f) }, + { SPH_C32(0xd10dd830), SPH_C32(0xa9f40000), SPH_C32(0x31830000), + SPH_C32(0x04d10000), SPH_C32(0xac4a2f21), SPH_C32(0x13228c49), + SPH_C32(0xeb81ae10), SPH_C32(0x2577ebd3), SPH_C32(0xa4a2ae40), + SPH_C32(0x78bc0000), SPH_C32(0x87d00000), SPH_C32(0x6a720000), + SPH_C32(0x792e733c), SPH_C32(0xd6c03e4e), SPH_C32(0xc3007f49), + SPH_C32(0xc44b6055) }, + { SPH_C32(0x3e06da40), SPH_C32(0x93090000), SPH_C32(0x6c2d0000), + SPH_C32(0x6d980000), SPH_C32(0x37451327), SPH_C32(0x572739b0), + SPH_C32(0x8d95a441), SPH_C32(0xb738b6d9), SPH_C32(0x6dc9ae70), + SPH_C32(0x9f990000), SPH_C32(0xa8540000), SPH_C32(0x4c3d0000), + SPH_C32(0x714728c5), SPH_C32(0xbb3ccf79), SPH_C32(0x939f16cd), + SPH_C32(0x5a22cf3d) }, + { SPH_C32(0x0c3ce400), SPH_C32(0xf7380000), SPH_C32(0x7f200000), + SPH_C32(0xd3ff0000), SPH_C32(0x6a4249b4), SPH_C32(0xce974006), + SPH_C32(0xfcb7a0b4), SPH_C32(0x5a90607e), SPH_C32(0xa1a5b800), + SPH_C32(0x6ddd0000), SPH_C32(0x013d0000), SPH_C32(0xde010000), + SPH_C32(0x998530a6), SPH_C32(0x079fdfc9), SPH_C32(0xf74f16a3), + SPH_C32(0x14497428) }, + { SPH_C32(0xe337e670), SPH_C32(0xcdc50000), SPH_C32(0x228e0000), + SPH_C32(0xbab60000), SPH_C32(0xf14d75b2), SPH_C32(0x8a92f5ff), + SPH_C32(0x9aa3aae5), SPH_C32(0xc8df3d74), SPH_C32(0x68ceb830), + SPH_C32(0x8af80000), SPH_C32(0x2eb90000), SPH_C32(0xf84e0000), + SPH_C32(0x91ec6b5f), SPH_C32(0x6a632efe), SPH_C32(0xa7d07f27), + SPH_C32(0x8a20db40) }, + { SPH_C32(0xc557e430), SPH_C32(0x101d0000), SPH_C32(0x50a40000), + SPH_C32(0xf5b00000), SPH_C32(0x622b124d), SPH_C32(0xa36bb131), + SPH_C32(0xac28c930), SPH_C32(0xc4f9cf16), SPH_C32(0x87c5ba40), + SPH_C32(0xb0050000), SPH_C32(0x73170000), SPH_C32(0x91070000), + SPH_C32(0x0ae35759), SPH_C32(0x2e669b07), SPH_C32(0xc1c47576), + SPH_C32(0x186f864a) }, + { SPH_C32(0x2a5ce640), SPH_C32(0x2ae00000), SPH_C32(0x0d0a0000), + SPH_C32(0x9cf90000), SPH_C32(0xf9242e4b), SPH_C32(0xe76e04c8), + SPH_C32(0xca3cc361), SPH_C32(0x56b6921c), SPH_C32(0x4eaeba70), + SPH_C32(0x57200000), SPH_C32(0x5c930000), SPH_C32(0xb7480000), + SPH_C32(0x028a0ca0), SPH_C32(0x439a6a30), SPH_C32(0x915b1cf2), + SPH_C32(0x86062922) }, + { SPH_C32(0xf3928800), SPH_C32(0xdc560000), SPH_C32(0xbd470000), + SPH_C32(0x95bd0000), SPH_C32(0x3d767488), SPH_C32(0xf3c9c922), + SPH_C32(0x916cbfec), SPH_C32(0x4aeb5b0f), SPH_C32(0xe1d7d800), + SPH_C32(0x3ed90000), SPH_C32(0xa5cc0000), SPH_C32(0x8ea50000), + SPH_C32(0xe4466aba), SPH_C32(0x23732650), SPH_C32(0xdb56301e), + SPH_C32(0xa0dc676f) }, + { SPH_C32(0x1c998a70), SPH_C32(0xe6ab0000), SPH_C32(0xe0e90000), + SPH_C32(0xfcf40000), SPH_C32(0xa679488e), SPH_C32(0xb7cc7cdb), + SPH_C32(0xf778b5bd), SPH_C32(0xd8a40605), SPH_C32(0x28bcd830), + SPH_C32(0xd9fc0000), SPH_C32(0x8a480000), SPH_C32(0xa8ea0000), + SPH_C32(0xec2f3143), SPH_C32(0x4e8fd767), SPH_C32(0x8bc9599a), + SPH_C32(0x3eb5c807) }, + { SPH_C32(0x3af98830), SPH_C32(0x3b730000), SPH_C32(0x92c30000), + SPH_C32(0xb3f20000), SPH_C32(0x351f2f71), SPH_C32(0x9e353815), + SPH_C32(0xc1f3d668), SPH_C32(0xd482f467), SPH_C32(0xc7b7da40), + SPH_C32(0xe3010000), SPH_C32(0xd7e60000), SPH_C32(0xc1a30000), + SPH_C32(0x77200d45), SPH_C32(0x0a8a629e), SPH_C32(0xeddd53cb), + SPH_C32(0xacfa950d) }, + { SPH_C32(0xd5f28a40), SPH_C32(0x018e0000), SPH_C32(0xcf6d0000), + SPH_C32(0xdabb0000), SPH_C32(0xae101377), SPH_C32(0xda308dec), + SPH_C32(0xa7e7dc39), SPH_C32(0x46cda96d), SPH_C32(0x0edcda70), + SPH_C32(0x04240000), SPH_C32(0xf8620000), SPH_C32(0xe7ec0000), + SPH_C32(0x7f4956bc), SPH_C32(0x677693a9), SPH_C32(0xbd423a4f), + SPH_C32(0x32933a65) }, + { SPH_C32(0xe7c8b400), SPH_C32(0x65bf0000), SPH_C32(0xdc600000), + SPH_C32(0x64dc0000), SPH_C32(0xf31749e4), SPH_C32(0x4380f45a), + SPH_C32(0xd6c5d8cc), SPH_C32(0xab657fca), SPH_C32(0xc2b0cc00), + SPH_C32(0xf6600000), SPH_C32(0x510b0000), SPH_C32(0x75d00000), + SPH_C32(0x978b4edf), SPH_C32(0xdbd58319), SPH_C32(0xd9923a21), + SPH_C32(0x7cf88170) }, + { SPH_C32(0x08c3b670), SPH_C32(0x5f420000), SPH_C32(0x81ce0000), + SPH_C32(0x0d950000), SPH_C32(0x681875e2), SPH_C32(0x078541a3), + SPH_C32(0xb0d1d29d), SPH_C32(0x392a22c0), SPH_C32(0x0bdbcc30), + SPH_C32(0x11450000), SPH_C32(0x7e8f0000), SPH_C32(0x539f0000), + SPH_C32(0x9fe21526), SPH_C32(0xb629722e), SPH_C32(0x890d53a5), + SPH_C32(0xe2912e18) }, + { SPH_C32(0x2ea3b430), SPH_C32(0x829a0000), SPH_C32(0xf3e40000), + SPH_C32(0x42930000), SPH_C32(0xfb7e121d), SPH_C32(0x2e7c056d), + SPH_C32(0x865ab148), SPH_C32(0x350cd0a2), SPH_C32(0xe4d0ce40), + SPH_C32(0x2bb80000), SPH_C32(0x23210000), SPH_C32(0x3ad60000), + SPH_C32(0x04ed2920), SPH_C32(0xf22cc7d7), SPH_C32(0xef1959f4), + SPH_C32(0x70de7312) }, + { SPH_C32(0xc1a8b640), SPH_C32(0xb8670000), SPH_C32(0xae4a0000), + SPH_C32(0x2bda0000), SPH_C32(0x60712e1b), SPH_C32(0x6a79b094), + SPH_C32(0xe04ebb19), SPH_C32(0xa7438da8), SPH_C32(0x2dbbce70), + SPH_C32(0xcc9d0000), SPH_C32(0x0ca50000), SPH_C32(0x1c990000), + SPH_C32(0x0c8472d9), SPH_C32(0x9fd036e0), SPH_C32(0xbf863070), + SPH_C32(0xeeb7dc7a) }, + { SPH_C32(0xd0f59c00), SPH_C32(0x14ef0000), SPH_C32(0x49800000), + SPH_C32(0x6ec80000), SPH_C32(0x4ebb50ed), SPH_C32(0x0b6f6c6b), + SPH_C32(0x93a8b5d3), SPH_C32(0x96cfbd10), SPH_C32(0xd6eaf000), + SPH_C32(0x4f890000), SPH_C32(0x302c0000), SPH_C32(0x84b10000), + SPH_C32(0x59ea73b3), SPH_C32(0x6b9cbe61), SPH_C32(0x9e3b5d01), + SPH_C32(0x9d76a5b5) }, + { SPH_C32(0x3ffe9e70), SPH_C32(0x2e120000), SPH_C32(0x142e0000), + SPH_C32(0x07810000), SPH_C32(0xd5b46ceb), SPH_C32(0x4f6ad992), + SPH_C32(0xf5bcbf82), SPH_C32(0x0480e01a), SPH_C32(0x1f81f030), + SPH_C32(0xa8ac0000), SPH_C32(0x1fa80000), SPH_C32(0xa2fe0000), + SPH_C32(0x5183284a), SPH_C32(0x06604f56), SPH_C32(0xcea43485), + SPH_C32(0x031f0add) }, + { SPH_C32(0x199e9c30), SPH_C32(0xf3ca0000), SPH_C32(0x66040000), + SPH_C32(0x48870000), SPH_C32(0x46d20b14), SPH_C32(0x66939d5c), + SPH_C32(0xc337dc57), SPH_C32(0x08a61278), SPH_C32(0xf08af240), + SPH_C32(0x92510000), SPH_C32(0x42060000), SPH_C32(0xcbb70000), + SPH_C32(0xca8c144c), SPH_C32(0x4265faaf), SPH_C32(0xa8b03ed4), + SPH_C32(0x915057d7) }, + { SPH_C32(0xf6959e40), SPH_C32(0xc9370000), SPH_C32(0x3baa0000), + SPH_C32(0x21ce0000), SPH_C32(0xdddd3712), SPH_C32(0x229628a5), + SPH_C32(0xa523d606), SPH_C32(0x9ae94f72), SPH_C32(0x39e1f270), + SPH_C32(0x75740000), SPH_C32(0x6d820000), SPH_C32(0xedf80000), + SPH_C32(0xc2e54fb5), SPH_C32(0x2f990b98), SPH_C32(0xf82f5750), + SPH_C32(0x0f39f8bf) }, + { SPH_C32(0xc4afa000), SPH_C32(0xad060000), SPH_C32(0x28a70000), + SPH_C32(0x9fa90000), SPH_C32(0x80da6d81), SPH_C32(0xbb265113), + SPH_C32(0xd401d2f3), SPH_C32(0x774199d5), SPH_C32(0xf58de400), + SPH_C32(0x87300000), SPH_C32(0xc4eb0000), SPH_C32(0x7fc40000), + SPH_C32(0x2a2757d6), SPH_C32(0x933a1b28), SPH_C32(0x9cff573e), + SPH_C32(0x415243aa) }, + { SPH_C32(0x2ba4a270), SPH_C32(0x97fb0000), SPH_C32(0x75090000), + SPH_C32(0xf6e00000), SPH_C32(0x1bd55187), SPH_C32(0xff23e4ea), + SPH_C32(0xb215d8a2), SPH_C32(0xe50ec4df), SPH_C32(0x3ce6e430), + SPH_C32(0x60150000), SPH_C32(0xeb6f0000), SPH_C32(0x598b0000), + SPH_C32(0x224e0c2f), SPH_C32(0xfec6ea1f), SPH_C32(0xcc603eba), + SPH_C32(0xdf3becc2) }, + { SPH_C32(0x0dc4a030), SPH_C32(0x4a230000), SPH_C32(0x07230000), + SPH_C32(0xb9e60000), SPH_C32(0x88b33678), SPH_C32(0xd6daa024), + SPH_C32(0x849ebb77), SPH_C32(0xe92836bd), SPH_C32(0xd3ede640), + SPH_C32(0x5ae80000), SPH_C32(0xb6c10000), SPH_C32(0x30c20000), + SPH_C32(0xb9413029), SPH_C32(0xbac35fe6), SPH_C32(0xaa7434eb), + SPH_C32(0x4d74b1c8) }, + { SPH_C32(0xe2cfa240), SPH_C32(0x70de0000), SPH_C32(0x5a8d0000), + SPH_C32(0xd0af0000), SPH_C32(0x13bc0a7e), SPH_C32(0x92df15dd), + SPH_C32(0xe28ab126), SPH_C32(0x7b676bb7), SPH_C32(0x1a86e670), + SPH_C32(0xbdcd0000), SPH_C32(0x99450000), SPH_C32(0x168d0000), + SPH_C32(0xb1286bd0), SPH_C32(0xd73faed1), SPH_C32(0xfaeb5d6f), + SPH_C32(0xd31d1ea0) }, + { SPH_C32(0xa7bad400), SPH_C32(0x36bb0000), SPH_C32(0x78910000), + SPH_C32(0x34780000), SPH_C32(0x8ed413f8), SPH_C32(0x676c0dc3), + SPH_C32(0xfadcfe71), SPH_C32(0x1ff06c8d), SPH_C32(0x7d6cc000), + SPH_C32(0x8e0a0000), SPH_C32(0x379d0000), SPH_C32(0x63360000), + SPH_C32(0xbd7c29ff), SPH_C32(0xc267f3a4), SPH_C32(0x985003c4), + SPH_C32(0xd816a946) }, + { SPH_C32(0x48b1d670), SPH_C32(0x0c460000), SPH_C32(0x253f0000), + SPH_C32(0x5d310000), SPH_C32(0x15db2ffe), SPH_C32(0x2369b83a), + SPH_C32(0x9cc8f420), SPH_C32(0x8dbf3187), SPH_C32(0xb407c030), + SPH_C32(0x692f0000), SPH_C32(0x18190000), SPH_C32(0x45790000), + SPH_C32(0xb5157206), SPH_C32(0xaf9b0293), SPH_C32(0xc8cf6a40), + SPH_C32(0x467f062e) }, + { SPH_C32(0x6ed1d430), SPH_C32(0xd19e0000), SPH_C32(0x57150000), + SPH_C32(0x12370000), SPH_C32(0x86bd4801), SPH_C32(0x0a90fcf4), + SPH_C32(0xaa4397f5), SPH_C32(0x8199c3e5), SPH_C32(0x5b0cc240), + SPH_C32(0x53d20000), SPH_C32(0x45b70000), SPH_C32(0x2c300000), + SPH_C32(0x2e1a4e00), SPH_C32(0xeb9eb76a), SPH_C32(0xaedb6011), + SPH_C32(0xd4305b24) }, + { SPH_C32(0x81dad640), SPH_C32(0xeb630000), SPH_C32(0x0abb0000), + SPH_C32(0x7b7e0000), SPH_C32(0x1db27407), SPH_C32(0x4e95490d), + SPH_C32(0xcc579da4), SPH_C32(0x13d69eef), SPH_C32(0x9267c270), + SPH_C32(0xb4f70000), SPH_C32(0x6a330000), SPH_C32(0x0a7f0000), + SPH_C32(0x267315f9), SPH_C32(0x8662465d), SPH_C32(0xfe440995), + SPH_C32(0x4a59f44c) }, + { SPH_C32(0xb3e0e800), SPH_C32(0x8f520000), SPH_C32(0x19b60000), + SPH_C32(0xc5190000), SPH_C32(0x40b52e94), SPH_C32(0xd72530bb), + SPH_C32(0xbd759951), SPH_C32(0xfe7e4848), SPH_C32(0x5e0bd400), + SPH_C32(0x46b30000), SPH_C32(0xc35a0000), SPH_C32(0x98430000), + SPH_C32(0xceb10d9a), SPH_C32(0x3ac156ed), SPH_C32(0x9a9409fb), + SPH_C32(0x04324f59) }, + { SPH_C32(0x5cebea70), SPH_C32(0xb5af0000), SPH_C32(0x44180000), + SPH_C32(0xac500000), SPH_C32(0xdbba1292), SPH_C32(0x93208542), + SPH_C32(0xdb619300), SPH_C32(0x6c311542), SPH_C32(0x9760d430), + SPH_C32(0xa1960000), SPH_C32(0xecde0000), SPH_C32(0xbe0c0000), + SPH_C32(0xc6d85663), SPH_C32(0x573da7da), SPH_C32(0xca0b607f), + SPH_C32(0x9a5be031) }, + { SPH_C32(0x7a8be830), SPH_C32(0x68770000), SPH_C32(0x36320000), + SPH_C32(0xe3560000), SPH_C32(0x48dc756d), SPH_C32(0xbad9c18c), + SPH_C32(0xedeaf0d5), SPH_C32(0x6017e720), SPH_C32(0x786bd640), + SPH_C32(0x9b6b0000), SPH_C32(0xb1700000), SPH_C32(0xd7450000), + SPH_C32(0x5dd76a65), SPH_C32(0x13381223), SPH_C32(0xac1f6a2e), + SPH_C32(0x0814bd3b) }, + { SPH_C32(0x9580ea40), SPH_C32(0x528a0000), SPH_C32(0x6b9c0000), + SPH_C32(0x8a1f0000), SPH_C32(0xd3d3496b), SPH_C32(0xfedc7475), + SPH_C32(0x8bfefa84), SPH_C32(0xf258ba2a), SPH_C32(0xb100d670), + SPH_C32(0x7c4e0000), SPH_C32(0x9ef40000), SPH_C32(0xf10a0000), + SPH_C32(0x55be319c), SPH_C32(0x7ec4e314), SPH_C32(0xfc8003aa), + SPH_C32(0x967d1253) }, + { SPH_C32(0x84ddc000), SPH_C32(0xfe020000), SPH_C32(0x8c560000), + SPH_C32(0xcf0d0000), SPH_C32(0xfd19379d), SPH_C32(0x9fcaa88a), + SPH_C32(0xf818f44e), SPH_C32(0xc3d48a92), SPH_C32(0x4a51e800), + SPH_C32(0xff5a0000), SPH_C32(0xa27d0000), SPH_C32(0x69220000), + SPH_C32(0x00d030f6), SPH_C32(0x8a886b95), SPH_C32(0xdd3d6edb), + SPH_C32(0xe5bc6b9c) }, + { SPH_C32(0x6bd6c270), SPH_C32(0xc4ff0000), SPH_C32(0xd1f80000), + SPH_C32(0xa6440000), SPH_C32(0x66160b9b), SPH_C32(0xdbcf1d73), + SPH_C32(0x9e0cfe1f), SPH_C32(0x519bd798), SPH_C32(0x833ae830), + SPH_C32(0x187f0000), SPH_C32(0x8df90000), SPH_C32(0x4f6d0000), + SPH_C32(0x08b96b0f), SPH_C32(0xe7749aa2), SPH_C32(0x8da2075f), + SPH_C32(0x7bd5c4f4) }, + { SPH_C32(0x4db6c030), SPH_C32(0x19270000), SPH_C32(0xa3d20000), + SPH_C32(0xe9420000), SPH_C32(0xf5706c64), SPH_C32(0xf23659bd), + SPH_C32(0xa8879dca), SPH_C32(0x5dbd25fa), SPH_C32(0x6c31ea40), + SPH_C32(0x22820000), SPH_C32(0xd0570000), SPH_C32(0x26240000), + SPH_C32(0x93b65709), SPH_C32(0xa3712f5b), SPH_C32(0xebb60d0e), + SPH_C32(0xe99a99fe) }, + { SPH_C32(0xa2bdc240), SPH_C32(0x23da0000), SPH_C32(0xfe7c0000), + SPH_C32(0x800b0000), SPH_C32(0x6e7f5062), SPH_C32(0xb633ec44), + SPH_C32(0xce93979b), SPH_C32(0xcff278f0), SPH_C32(0xa55aea70), + SPH_C32(0xc5a70000), SPH_C32(0xffd30000), SPH_C32(0x006b0000), + SPH_C32(0x9bdf0cf0), SPH_C32(0xce8dde6c), SPH_C32(0xbb29648a), + SPH_C32(0x77f33696) }, + { SPH_C32(0x9087fc00), SPH_C32(0x47eb0000), SPH_C32(0xed710000), + SPH_C32(0x3e6c0000), SPH_C32(0x33780af1), SPH_C32(0x2f8395f2), + SPH_C32(0xbfb1936e), SPH_C32(0x225aae57), SPH_C32(0x6936fc00), + SPH_C32(0x37e30000), SPH_C32(0x56ba0000), SPH_C32(0x92570000), + SPH_C32(0x731d1493), SPH_C32(0x722ecedc), SPH_C32(0xdff964e4), + SPH_C32(0x39988d83) }, + { SPH_C32(0x7f8cfe70), SPH_C32(0x7d160000), SPH_C32(0xb0df0000), + SPH_C32(0x57250000), SPH_C32(0xa87736f7), SPH_C32(0x6b86200b), + SPH_C32(0xd9a5993f), SPH_C32(0xb015f35d), SPH_C32(0xa05dfc30), + SPH_C32(0xd0c60000), SPH_C32(0x793e0000), SPH_C32(0xb4180000), + SPH_C32(0x7b744f6a), SPH_C32(0x1fd23feb), SPH_C32(0x8f660d60), + SPH_C32(0xa7f122eb) }, + { SPH_C32(0x59ecfc30), SPH_C32(0xa0ce0000), SPH_C32(0xc2f50000), + SPH_C32(0x18230000), SPH_C32(0x3b115108), SPH_C32(0x427f64c5), + SPH_C32(0xef2efaea), SPH_C32(0xbc33013f), SPH_C32(0x4f56fe40), + SPH_C32(0xea3b0000), SPH_C32(0x24900000), SPH_C32(0xdd510000), + SPH_C32(0xe07b736c), SPH_C32(0x5bd78a12), SPH_C32(0xe9720731), + SPH_C32(0x35be7fe1) }, + { SPH_C32(0xb6e7fe40), SPH_C32(0x9a330000), SPH_C32(0x9f5b0000), + SPH_C32(0x716a0000), SPH_C32(0xa01e6d0e), SPH_C32(0x067ad13c), + SPH_C32(0x893af0bb), SPH_C32(0x2e7c5c35), SPH_C32(0x863dfe70), + SPH_C32(0x0d1e0000), SPH_C32(0x0b140000), SPH_C32(0xfb1e0000), + SPH_C32(0xe8122895), SPH_C32(0x362b7b25), SPH_C32(0xb9ed6eb5), + SPH_C32(0xabd7d089) } +}; + +static const sph_u32 T512_8[256][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xf6800005), SPH_C32(0x3443c000), SPH_C32(0x24070000), + SPH_C32(0x8f3d0000), SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), + SPH_C32(0xcdc58b19), SPH_C32(0xd795ba31), SPH_C32(0xa67f0001), + SPH_C32(0x71378000), SPH_C32(0x19fc0000), SPH_C32(0x96db0000), + SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), SPH_C32(0x2c6d478f), + SPH_C32(0xac8e6c88) }, + { SPH_C32(0xa67f0001), SPH_C32(0x71378000), SPH_C32(0x19fc0000), + SPH_C32(0x96db0000), SPH_C32(0x3a8b6dfd), SPH_C32(0xebcaaef3), + SPH_C32(0x2c6d478f), SPH_C32(0xac8e6c88), SPH_C32(0x50ff0004), + SPH_C32(0x45744000), SPH_C32(0x3dfb0000), SPH_C32(0x19e60000), + SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), SPH_C32(0xe1a8cc96), + SPH_C32(0x7b1bd6b9) }, + { SPH_C32(0x50ff0004), SPH_C32(0x45744000), SPH_C32(0x3dfb0000), + SPH_C32(0x19e60000), SPH_C32(0x1bbc5606), SPH_C32(0xe1727b5d), + SPH_C32(0xe1a8cc96), SPH_C32(0x7b1bd6b9), SPH_C32(0xf6800005), + SPH_C32(0x3443c000), SPH_C32(0x24070000), SPH_C32(0x8f3d0000), + SPH_C32(0x21373bfb), SPH_C32(0x0ab8d5ae), SPH_C32(0xcdc58b19), + SPH_C32(0xd795ba31) }, + { SPH_C32(0xf7750009), SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), + SPH_C32(0x04920000), SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), + SPH_C32(0x7a87f14e), SPH_C32(0x9e16981a), SPH_C32(0xd46a0000), + SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), SPH_C32(0x4a290000), + SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), SPH_C32(0x98369604), + SPH_C32(0xf746c320) }, + { SPH_C32(0x01f5000c), SPH_C32(0xfb7f0000), SPH_C32(0xe7d10000), + SPH_C32(0x8baf0000), SPH_C32(0x23a22252), SPH_C32(0xf250e314), + SPH_C32(0xb7427a57), SPH_C32(0x4983222b), SPH_C32(0x72150001), + SPH_C32(0xfcff4000), SPH_C32(0xbc530000), SPH_C32(0xdcf20000), + SPH_C32(0xc6c52f87), SPH_C32(0x227e289f), SPH_C32(0xb45bd18b), + SPH_C32(0x5bc8afa8) }, + { SPH_C32(0x510a0008), SPH_C32(0xbe0b4000), SPH_C32(0xda2a0000), + SPH_C32(0x92490000), SPH_C32(0x381e7454), SPH_C32(0x13229849), + SPH_C32(0x56eab6c1), SPH_C32(0x3298f492), SPH_C32(0x84950004), + SPH_C32(0xc8bc8000), SPH_C32(0x98540000), SPH_C32(0x53cf0000), + SPH_C32(0xe7f2147c), SPH_C32(0x28c6fd31), SPH_C32(0x799e5a92), + SPH_C32(0x8c5d1599) }, + { SPH_C32(0xa78a000d), SPH_C32(0x8a488000), SPH_C32(0xfe2d0000), + SPH_C32(0x1d740000), SPH_C32(0x19294faf), SPH_C32(0x199a4de7), + SPH_C32(0x9b2f3dd8), SPH_C32(0xe50d4ea3), SPH_C32(0x22ea0005), + SPH_C32(0xb98b0000), SPH_C32(0x81a80000), SPH_C32(0xc5140000), + SPH_C32(0xdd797981), SPH_C32(0xc30c53c2), SPH_C32(0x55f31d1d), + SPH_C32(0x20d37911) }, + { SPH_C32(0xd46a0000), SPH_C32(0x8dc8c000), SPH_C32(0xa5af0000), + SPH_C32(0x4a290000), SPH_C32(0xfc4e427a), SPH_C32(0xc9b4866c), + SPH_C32(0x98369604), SPH_C32(0xf746c320), SPH_C32(0x231f0009), + SPH_C32(0x42f40000), SPH_C32(0x66790000), SPH_C32(0x4ebb0000), + SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), SPH_C32(0xe2b1674a), + SPH_C32(0x69505b3a) }, + { SPH_C32(0x22ea0005), SPH_C32(0xb98b0000), SPH_C32(0x81a80000), + SPH_C32(0xc5140000), SPH_C32(0xdd797981), SPH_C32(0xc30c53c2), + SPH_C32(0x55f31d1d), SPH_C32(0x20d37911), SPH_C32(0x85600008), + SPH_C32(0x33c38000), SPH_C32(0x7f850000), SPH_C32(0xd8600000), + SPH_C32(0xc450362e), SPH_C32(0xda961e25), SPH_C32(0xcedc20c5), + SPH_C32(0xc5de37b2) }, + { SPH_C32(0x72150001), SPH_C32(0xfcff4000), SPH_C32(0xbc530000), + SPH_C32(0xdcf20000), SPH_C32(0xc6c52f87), SPH_C32(0x227e289f), + SPH_C32(0xb45bd18b), SPH_C32(0x5bc8afa8), SPH_C32(0x73e0000d), + SPH_C32(0x07804000), SPH_C32(0x5b820000), SPH_C32(0x575d0000), + SPH_C32(0xe5670dd5), SPH_C32(0xd02ecb8b), SPH_C32(0x0319abdc), + SPH_C32(0x124b8d83) }, + { SPH_C32(0x84950004), SPH_C32(0xc8bc8000), SPH_C32(0x98540000), + SPH_C32(0x53cf0000), SPH_C32(0xe7f2147c), SPH_C32(0x28c6fd31), + SPH_C32(0x799e5a92), SPH_C32(0x8c5d1599), SPH_C32(0xd59f000c), + SPH_C32(0x76b7c000), SPH_C32(0x427e0000), SPH_C32(0xc1860000), + SPH_C32(0xdfec6028), SPH_C32(0x3be46578), SPH_C32(0x2f74ec53), + SPH_C32(0xbec5e10b) }, + { SPH_C32(0x231f0009), SPH_C32(0x42f40000), SPH_C32(0x66790000), + SPH_C32(0x4ebb0000), SPH_C32(0xfedb5bd3), SPH_C32(0x315cb0d6), + SPH_C32(0xe2b1674a), SPH_C32(0x69505b3a), SPH_C32(0xf7750009), + SPH_C32(0xcf3cc000), SPH_C32(0xc3d60000), SPH_C32(0x04920000), + SPH_C32(0x029519a9), SPH_C32(0xf8e836ba), SPH_C32(0x7a87f14e), + SPH_C32(0x9e16981a) }, + { SPH_C32(0xd59f000c), SPH_C32(0x76b7c000), SPH_C32(0x427e0000), + SPH_C32(0xc1860000), SPH_C32(0xdfec6028), SPH_C32(0x3be46578), + SPH_C32(0x2f74ec53), SPH_C32(0xbec5e10b), SPH_C32(0x510a0008), + SPH_C32(0xbe0b4000), SPH_C32(0xda2a0000), SPH_C32(0x92490000), + SPH_C32(0x381e7454), SPH_C32(0x13229849), SPH_C32(0x56eab6c1), + SPH_C32(0x3298f492) }, + { SPH_C32(0x85600008), SPH_C32(0x33c38000), SPH_C32(0x7f850000), + SPH_C32(0xd8600000), SPH_C32(0xc450362e), SPH_C32(0xda961e25), + SPH_C32(0xcedc20c5), SPH_C32(0xc5de37b2), SPH_C32(0xa78a000d), + SPH_C32(0x8a488000), SPH_C32(0xfe2d0000), SPH_C32(0x1d740000), + SPH_C32(0x19294faf), SPH_C32(0x199a4de7), SPH_C32(0x9b2f3dd8), + SPH_C32(0xe50d4ea3) }, + { SPH_C32(0x73e0000d), SPH_C32(0x07804000), SPH_C32(0x5b820000), + SPH_C32(0x575d0000), SPH_C32(0xe5670dd5), SPH_C32(0xd02ecb8b), + SPH_C32(0x0319abdc), SPH_C32(0x124b8d83), SPH_C32(0x01f5000c), + SPH_C32(0xfb7f0000), SPH_C32(0xe7d10000), SPH_C32(0x8baf0000), + SPH_C32(0x23a22252), SPH_C32(0xf250e314), SPH_C32(0xb7427a57), + SPH_C32(0x4983222b) }, + { SPH_C32(0x774400f0), SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), + SPH_C32(0x34140000), SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), + SPH_C32(0x0bc3cd1e), SPH_C32(0xcf3775cb), SPH_C32(0xf46c0050), + SPH_C32(0x96180000), SPH_C32(0x14a50000), SPH_C32(0x031f0000), + SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), SPH_C32(0x9ca470d2), + SPH_C32(0x8a341574) }, + { SPH_C32(0x81c400f5), SPH_C32(0xc519c000), SPH_C32(0xd1b50000), + SPH_C32(0xbb290000), SPH_C32(0xa8004577), SPH_C32(0x5033398b), + SPH_C32(0xc6064607), SPH_C32(0x18a2cffa), SPH_C32(0x52130051), + SPH_C32(0xe72f8000), SPH_C32(0x0d590000), SPH_C32(0x95c40000), + SPH_C32(0x781f1345), SPH_C32(0x8d75d0ea), SPH_C32(0xb0c9375d), + SPH_C32(0x26ba79fc) }, + { SPH_C32(0xd13b00f1), SPH_C32(0x806d8000), SPH_C32(0xec4e0000), + SPH_C32(0xa2cf0000), SPH_C32(0xb3bc1371), SPH_C32(0xb14142d6), + SPH_C32(0x27ae8a91), SPH_C32(0x63b91943), SPH_C32(0xa4930054), + SPH_C32(0xd36c4000), SPH_C32(0x295e0000), SPH_C32(0x1af90000), + SPH_C32(0x592828be), SPH_C32(0x87cd0544), SPH_C32(0x7d0cbc44), + SPH_C32(0xf12fc3cd) }, + { SPH_C32(0x27bb00f4), SPH_C32(0xb42e4000), SPH_C32(0xc8490000), + SPH_C32(0x2df20000), SPH_C32(0x928b288a), SPH_C32(0xbbf99778), + SPH_C32(0xea6b0188), SPH_C32(0xb42ca372), SPH_C32(0x02ec0055), + SPH_C32(0xa25bc000), SPH_C32(0x30a20000), SPH_C32(0x8c220000), + SPH_C32(0x63a34543), SPH_C32(0x6c07abb7), SPH_C32(0x5161fbcb), + SPH_C32(0x5da1af45) }, + { SPH_C32(0x803100f9), SPH_C32(0x3e66c000), SPH_C32(0x36640000), + SPH_C32(0x30860000), SPH_C32(0x8ba26725), SPH_C32(0xa263da9f), + SPH_C32(0x71443c50), SPH_C32(0x5121edd1), SPH_C32(0x20060050), + SPH_C32(0x1bd0c000), SPH_C32(0xb10a0000), SPH_C32(0x49360000), + SPH_C32(0xbeda3cc2), SPH_C32(0xaf0bf875), SPH_C32(0x0492e6d6), + SPH_C32(0x7d72d654) }, + { SPH_C32(0x76b100fc), SPH_C32(0x0a250000), SPH_C32(0x12630000), + SPH_C32(0xbfbb0000), SPH_C32(0xaa955cde), SPH_C32(0xa8db0f31), + SPH_C32(0xbc81b749), SPH_C32(0x86b457e0), SPH_C32(0x86790051), + SPH_C32(0x6ae74000), SPH_C32(0xa8f60000), SPH_C32(0xdfed0000), + SPH_C32(0x8451513f), SPH_C32(0x44c15686), SPH_C32(0x28ffa159), + SPH_C32(0xd1fcbadc) }, + { SPH_C32(0x264e00f8), SPH_C32(0x4f514000), SPH_C32(0x2f980000), + SPH_C32(0xa65d0000), SPH_C32(0xb1290ad8), SPH_C32(0x49a9746c), + SPH_C32(0x5d297bdf), SPH_C32(0xfdaf8159), SPH_C32(0x70f90054), + SPH_C32(0x5ea48000), SPH_C32(0x8cf10000), SPH_C32(0x50d00000), + SPH_C32(0xa5666ac4), SPH_C32(0x4e798328), SPH_C32(0xe53a2a40), + SPH_C32(0x066900ed) }, + { SPH_C32(0xd0ce00fd), SPH_C32(0x7b128000), SPH_C32(0x0b9f0000), + SPH_C32(0x29600000), SPH_C32(0x901e3123), SPH_C32(0x4311a1c2), + SPH_C32(0x90ecf0c6), SPH_C32(0x2a3a3b68), SPH_C32(0xd6860055), + SPH_C32(0x2f930000), SPH_C32(0x950d0000), SPH_C32(0xc60b0000), + SPH_C32(0x9fed0739), SPH_C32(0xa5b32ddb), SPH_C32(0xc9576dcf), + SPH_C32(0xaae76c65) }, + { SPH_C32(0xa32e00f0), SPH_C32(0x7c92c000), SPH_C32(0x501d0000), + SPH_C32(0x7e3d0000), SPH_C32(0x75793cf6), SPH_C32(0x933f6a49), + SPH_C32(0x93f55b1a), SPH_C32(0x3871b6eb), SPH_C32(0xd7730059), + SPH_C32(0xd4ec0000), SPH_C32(0x72dc0000), SPH_C32(0x4da40000), + SPH_C32(0xbc4f256b), SPH_C32(0x57e3cecf), SPH_C32(0x7e151798), + SPH_C32(0xe3644e4e) }, + { SPH_C32(0x55ae00f5), SPH_C32(0x48d10000), SPH_C32(0x741a0000), + SPH_C32(0xf1000000), SPH_C32(0x544e070d), SPH_C32(0x9987bfe7), + SPH_C32(0x5e30d003), SPH_C32(0xefe40cda), SPH_C32(0x710c0058), + SPH_C32(0xa5db8000), SPH_C32(0x6b200000), SPH_C32(0xdb7f0000), + SPH_C32(0x86c44896), SPH_C32(0xbc29603c), SPH_C32(0x52785017), + SPH_C32(0x4fea22c6) }, + { SPH_C32(0x055100f1), SPH_C32(0x0da54000), SPH_C32(0x49e10000), + SPH_C32(0xe8e60000), SPH_C32(0x4ff2510b), SPH_C32(0x78f5c4ba), + SPH_C32(0xbf981c95), SPH_C32(0x94ffda63), SPH_C32(0x878c005d), + SPH_C32(0x91984000), SPH_C32(0x4f270000), SPH_C32(0x54420000), + SPH_C32(0xa7f3736d), SPH_C32(0xb691b592), SPH_C32(0x9fbddb0e), + SPH_C32(0x987f98f7) }, + { SPH_C32(0xf3d100f4), SPH_C32(0x39e68000), SPH_C32(0x6de60000), + SPH_C32(0x67db0000), SPH_C32(0x6ec56af0), SPH_C32(0x724d1114), + SPH_C32(0x725d978c), SPH_C32(0x436a6052), SPH_C32(0x21f3005c), + SPH_C32(0xe0afc000), SPH_C32(0x56db0000), SPH_C32(0xc2990000), + SPH_C32(0x9d781e90), SPH_C32(0x5d5b1b61), SPH_C32(0xb3d09c81), + SPH_C32(0x34f1f47f) }, + { SPH_C32(0x545b00f9), SPH_C32(0xb3ae0000), SPH_C32(0x93cb0000), + SPH_C32(0x7aaf0000), SPH_C32(0x77ec255f), SPH_C32(0x6bd75cf3), + SPH_C32(0xe972aa54), SPH_C32(0xa6672ef1), SPH_C32(0x03190059), + SPH_C32(0x5924c000), SPH_C32(0xd7730000), SPH_C32(0x078d0000), + SPH_C32(0x40016711), SPH_C32(0x9e5748a3), SPH_C32(0xe623819c), + SPH_C32(0x14228d6e) }, + { SPH_C32(0xa2db00fc), SPH_C32(0x87edc000), SPH_C32(0xb7cc0000), + SPH_C32(0xf5920000), SPH_C32(0x56db1ea4), SPH_C32(0x616f895d), + SPH_C32(0x24b7214d), SPH_C32(0x71f294c0), SPH_C32(0xa5660058), + SPH_C32(0x28134000), SPH_C32(0xce8f0000), SPH_C32(0x91560000), + SPH_C32(0x7a8a0aec), SPH_C32(0x759de650), SPH_C32(0xca4ec613), + SPH_C32(0xb8ace1e6) }, + { SPH_C32(0xf22400f8), SPH_C32(0xc2998000), SPH_C32(0x8a370000), + SPH_C32(0xec740000), SPH_C32(0x4d6748a2), SPH_C32(0x801df200), + SPH_C32(0xc51feddb), SPH_C32(0x0ae94279), SPH_C32(0x53e6005d), + SPH_C32(0x1c508000), SPH_C32(0xea880000), SPH_C32(0x1e6b0000), + SPH_C32(0x5bbd3117), SPH_C32(0x7f2533fe), SPH_C32(0x078b4d0a), + SPH_C32(0x6f395bd7) }, + { SPH_C32(0x04a400fd), SPH_C32(0xf6da4000), SPH_C32(0xae300000), + SPH_C32(0x63490000), SPH_C32(0x6c507359), SPH_C32(0x8aa527ae), + SPH_C32(0x08da66c2), SPH_C32(0xdd7cf848), SPH_C32(0xf599005c), + SPH_C32(0x6d670000), SPH_C32(0xf3740000), SPH_C32(0x88b00000), + SPH_C32(0x61365cea), SPH_C32(0x94ef9d0d), SPH_C32(0x2be60a85), + SPH_C32(0xc3b7375f) }, + { SPH_C32(0xf46c0050), SPH_C32(0x96180000), SPH_C32(0x14a50000), + SPH_C32(0x031f0000), SPH_C32(0x42947eb8), SPH_C32(0x66bf7e19), + SPH_C32(0x9ca470d2), SPH_C32(0x8a341574), SPH_C32(0x832800a0), + SPH_C32(0x67420000), SPH_C32(0xe1170000), SPH_C32(0x370b0000), + SPH_C32(0xcba30034), SPH_C32(0x3c34923c), SPH_C32(0x9767bdcc), + SPH_C32(0x450360bf) }, + { SPH_C32(0x02ec0055), SPH_C32(0xa25bc000), SPH_C32(0x30a20000), + SPH_C32(0x8c220000), SPH_C32(0x63a34543), SPH_C32(0x6c07abb7), + SPH_C32(0x5161fbcb), SPH_C32(0x5da1af45), SPH_C32(0x255700a1), + SPH_C32(0x16758000), SPH_C32(0xf8eb0000), SPH_C32(0xa1d00000), + SPH_C32(0xf1286dc9), SPH_C32(0xd7fe3ccf), SPH_C32(0xbb0afa43), + SPH_C32(0xe98d0c37) }, + { SPH_C32(0x52130051), SPH_C32(0xe72f8000), SPH_C32(0x0d590000), + SPH_C32(0x95c40000), SPH_C32(0x781f1345), SPH_C32(0x8d75d0ea), + SPH_C32(0xb0c9375d), SPH_C32(0x26ba79fc), SPH_C32(0xd3d700a4), + SPH_C32(0x22364000), SPH_C32(0xdcec0000), SPH_C32(0x2eed0000), + SPH_C32(0xd01f5632), SPH_C32(0xdd46e961), SPH_C32(0x76cf715a), + SPH_C32(0x3e18b606) }, + { SPH_C32(0xa4930054), SPH_C32(0xd36c4000), SPH_C32(0x295e0000), + SPH_C32(0x1af90000), SPH_C32(0x592828be), SPH_C32(0x87cd0544), + SPH_C32(0x7d0cbc44), SPH_C32(0xf12fc3cd), SPH_C32(0x75a800a5), + SPH_C32(0x5301c000), SPH_C32(0xc5100000), SPH_C32(0xb8360000), + SPH_C32(0xea943bcf), SPH_C32(0x368c4792), SPH_C32(0x5aa236d5), + SPH_C32(0x9296da8e) }, + { SPH_C32(0x03190059), SPH_C32(0x5924c000), SPH_C32(0xd7730000), + SPH_C32(0x078d0000), SPH_C32(0x40016711), SPH_C32(0x9e5748a3), + SPH_C32(0xe623819c), SPH_C32(0x14228d6e), SPH_C32(0x574200a0), + SPH_C32(0xea8ac000), SPH_C32(0x44b80000), SPH_C32(0x7d220000), + SPH_C32(0x37ed424e), SPH_C32(0xf5801450), SPH_C32(0x0f512bc8), + SPH_C32(0xb245a39f) }, + { SPH_C32(0xf599005c), SPH_C32(0x6d670000), SPH_C32(0xf3740000), + SPH_C32(0x88b00000), SPH_C32(0x61365cea), SPH_C32(0x94ef9d0d), + SPH_C32(0x2be60a85), SPH_C32(0xc3b7375f), SPH_C32(0xf13d00a1), + SPH_C32(0x9bbd4000), SPH_C32(0x5d440000), SPH_C32(0xebf90000), + SPH_C32(0x0d662fb3), SPH_C32(0x1e4abaa3), SPH_C32(0x233c6c47), + SPH_C32(0x1ecbcf17) }, + { SPH_C32(0xa5660058), SPH_C32(0x28134000), SPH_C32(0xce8f0000), + SPH_C32(0x91560000), SPH_C32(0x7a8a0aec), SPH_C32(0x759de650), + SPH_C32(0xca4ec613), SPH_C32(0xb8ace1e6), SPH_C32(0x07bd00a4), + SPH_C32(0xaffe8000), SPH_C32(0x79430000), SPH_C32(0x64c40000), + SPH_C32(0x2c511448), SPH_C32(0x14f26f0d), SPH_C32(0xeef9e75e), + SPH_C32(0xc95e7526) }, + { SPH_C32(0x53e6005d), SPH_C32(0x1c508000), SPH_C32(0xea880000), + SPH_C32(0x1e6b0000), SPH_C32(0x5bbd3117), SPH_C32(0x7f2533fe), + SPH_C32(0x078b4d0a), SPH_C32(0x6f395bd7), SPH_C32(0xa1c200a5), + SPH_C32(0xdec90000), SPH_C32(0x60bf0000), SPH_C32(0xf21f0000), + SPH_C32(0x16da79b5), SPH_C32(0xff38c1fe), SPH_C32(0xc294a0d1), + SPH_C32(0x65d019ae) }, + { SPH_C32(0x20060050), SPH_C32(0x1bd0c000), SPH_C32(0xb10a0000), + SPH_C32(0x49360000), SPH_C32(0xbeda3cc2), SPH_C32(0xaf0bf875), + SPH_C32(0x0492e6d6), SPH_C32(0x7d72d654), SPH_C32(0xa03700a9), + SPH_C32(0x25b60000), SPH_C32(0x876e0000), SPH_C32(0x79b00000), + SPH_C32(0x35785be7), SPH_C32(0x0d6822ea), SPH_C32(0x75d6da86), + SPH_C32(0x2c533b85) }, + { SPH_C32(0xd6860055), SPH_C32(0x2f930000), SPH_C32(0x950d0000), + SPH_C32(0xc60b0000), SPH_C32(0x9fed0739), SPH_C32(0xa5b32ddb), + SPH_C32(0xc9576dcf), SPH_C32(0xaae76c65), SPH_C32(0x064800a8), + SPH_C32(0x54818000), SPH_C32(0x9e920000), SPH_C32(0xef6b0000), + SPH_C32(0x0ff3361a), SPH_C32(0xe6a28c19), SPH_C32(0x59bb9d09), + SPH_C32(0x80dd570d) }, + { SPH_C32(0x86790051), SPH_C32(0x6ae74000), SPH_C32(0xa8f60000), + SPH_C32(0xdfed0000), SPH_C32(0x8451513f), SPH_C32(0x44c15686), + SPH_C32(0x28ffa159), SPH_C32(0xd1fcbadc), SPH_C32(0xf0c800ad), + SPH_C32(0x60c24000), SPH_C32(0xba950000), SPH_C32(0x60560000), + SPH_C32(0x2ec40de1), SPH_C32(0xec1a59b7), SPH_C32(0x947e1610), + SPH_C32(0x5748ed3c) }, + { SPH_C32(0x70f90054), SPH_C32(0x5ea48000), SPH_C32(0x8cf10000), + SPH_C32(0x50d00000), SPH_C32(0xa5666ac4), SPH_C32(0x4e798328), + SPH_C32(0xe53a2a40), SPH_C32(0x066900ed), SPH_C32(0x56b700ac), + SPH_C32(0x11f5c000), SPH_C32(0xa3690000), SPH_C32(0xf68d0000), + SPH_C32(0x144f601c), SPH_C32(0x07d0f744), SPH_C32(0xb813519f), + SPH_C32(0xfbc681b4) }, + { SPH_C32(0xd7730059), SPH_C32(0xd4ec0000), SPH_C32(0x72dc0000), + SPH_C32(0x4da40000), SPH_C32(0xbc4f256b), SPH_C32(0x57e3cecf), + SPH_C32(0x7e151798), SPH_C32(0xe3644e4e), SPH_C32(0x745d00a9), + SPH_C32(0xa87ec000), SPH_C32(0x22c10000), SPH_C32(0x33990000), + SPH_C32(0xc936199d), SPH_C32(0xc4dca486), SPH_C32(0xede04c82), + SPH_C32(0xdb15f8a5) }, + { SPH_C32(0x21f3005c), SPH_C32(0xe0afc000), SPH_C32(0x56db0000), + SPH_C32(0xc2990000), SPH_C32(0x9d781e90), SPH_C32(0x5d5b1b61), + SPH_C32(0xb3d09c81), SPH_C32(0x34f1f47f), SPH_C32(0xd22200a8), + SPH_C32(0xd9494000), SPH_C32(0x3b3d0000), SPH_C32(0xa5420000), + SPH_C32(0xf3bd7460), SPH_C32(0x2f160a75), SPH_C32(0xc18d0b0d), + SPH_C32(0x779b942d) }, + { SPH_C32(0x710c0058), SPH_C32(0xa5db8000), SPH_C32(0x6b200000), + SPH_C32(0xdb7f0000), SPH_C32(0x86c44896), SPH_C32(0xbc29603c), + SPH_C32(0x52785017), SPH_C32(0x4fea22c6), SPH_C32(0x24a200ad), + SPH_C32(0xed0a8000), SPH_C32(0x1f3a0000), SPH_C32(0x2a7f0000), + SPH_C32(0xd28a4f9b), SPH_C32(0x25aedfdb), SPH_C32(0x0c488014), + SPH_C32(0xa00e2e1c) }, + { SPH_C32(0x878c005d), SPH_C32(0x91984000), SPH_C32(0x4f270000), + SPH_C32(0x54420000), SPH_C32(0xa7f3736d), SPH_C32(0xb691b592), + SPH_C32(0x9fbddb0e), SPH_C32(0x987f98f7), SPH_C32(0x82dd00ac), + SPH_C32(0x9c3d0000), SPH_C32(0x06c60000), SPH_C32(0xbca40000), + SPH_C32(0xe8012266), SPH_C32(0xce647128), SPH_C32(0x2025c79b), + SPH_C32(0x0c804294) }, + { SPH_C32(0x832800a0), SPH_C32(0x67420000), SPH_C32(0xe1170000), + SPH_C32(0x370b0000), SPH_C32(0xcba30034), SPH_C32(0x3c34923c), + SPH_C32(0x9767bdcc), SPH_C32(0x450360bf), SPH_C32(0x774400f0), + SPH_C32(0xf15a0000), SPH_C32(0xf5b20000), SPH_C32(0x34140000), + SPH_C32(0x89377e8c), SPH_C32(0x5a8bec25), SPH_C32(0x0bc3cd1e), + SPH_C32(0xcf3775cb) }, + { SPH_C32(0x75a800a5), SPH_C32(0x5301c000), SPH_C32(0xc5100000), + SPH_C32(0xb8360000), SPH_C32(0xea943bcf), SPH_C32(0x368c4792), + SPH_C32(0x5aa236d5), SPH_C32(0x9296da8e), SPH_C32(0xd13b00f1), + SPH_C32(0x806d8000), SPH_C32(0xec4e0000), SPH_C32(0xa2cf0000), + SPH_C32(0xb3bc1371), SPH_C32(0xb14142d6), SPH_C32(0x27ae8a91), + SPH_C32(0x63b91943) }, + { SPH_C32(0x255700a1), SPH_C32(0x16758000), SPH_C32(0xf8eb0000), + SPH_C32(0xa1d00000), SPH_C32(0xf1286dc9), SPH_C32(0xd7fe3ccf), + SPH_C32(0xbb0afa43), SPH_C32(0xe98d0c37), SPH_C32(0x27bb00f4), + SPH_C32(0xb42e4000), SPH_C32(0xc8490000), SPH_C32(0x2df20000), + SPH_C32(0x928b288a), SPH_C32(0xbbf99778), SPH_C32(0xea6b0188), + SPH_C32(0xb42ca372) }, + { SPH_C32(0xd3d700a4), SPH_C32(0x22364000), SPH_C32(0xdcec0000), + SPH_C32(0x2eed0000), SPH_C32(0xd01f5632), SPH_C32(0xdd46e961), + SPH_C32(0x76cf715a), SPH_C32(0x3e18b606), SPH_C32(0x81c400f5), + SPH_C32(0xc519c000), SPH_C32(0xd1b50000), SPH_C32(0xbb290000), + SPH_C32(0xa8004577), SPH_C32(0x5033398b), SPH_C32(0xc6064607), + SPH_C32(0x18a2cffa) }, + { SPH_C32(0x745d00a9), SPH_C32(0xa87ec000), SPH_C32(0x22c10000), + SPH_C32(0x33990000), SPH_C32(0xc936199d), SPH_C32(0xc4dca486), + SPH_C32(0xede04c82), SPH_C32(0xdb15f8a5), SPH_C32(0xa32e00f0), + SPH_C32(0x7c92c000), SPH_C32(0x501d0000), SPH_C32(0x7e3d0000), + SPH_C32(0x75793cf6), SPH_C32(0x933f6a49), SPH_C32(0x93f55b1a), + SPH_C32(0x3871b6eb) }, + { SPH_C32(0x82dd00ac), SPH_C32(0x9c3d0000), SPH_C32(0x06c60000), + SPH_C32(0xbca40000), SPH_C32(0xe8012266), SPH_C32(0xce647128), + SPH_C32(0x2025c79b), SPH_C32(0x0c804294), SPH_C32(0x055100f1), + SPH_C32(0x0da54000), SPH_C32(0x49e10000), SPH_C32(0xe8e60000), + SPH_C32(0x4ff2510b), SPH_C32(0x78f5c4ba), SPH_C32(0xbf981c95), + SPH_C32(0x94ffda63) }, + { SPH_C32(0xd22200a8), SPH_C32(0xd9494000), SPH_C32(0x3b3d0000), + SPH_C32(0xa5420000), SPH_C32(0xf3bd7460), SPH_C32(0x2f160a75), + SPH_C32(0xc18d0b0d), SPH_C32(0x779b942d), SPH_C32(0xf3d100f4), + SPH_C32(0x39e68000), SPH_C32(0x6de60000), SPH_C32(0x67db0000), + SPH_C32(0x6ec56af0), SPH_C32(0x724d1114), SPH_C32(0x725d978c), + SPH_C32(0x436a6052) }, + { SPH_C32(0x24a200ad), SPH_C32(0xed0a8000), SPH_C32(0x1f3a0000), + SPH_C32(0x2a7f0000), SPH_C32(0xd28a4f9b), SPH_C32(0x25aedfdb), + SPH_C32(0x0c488014), SPH_C32(0xa00e2e1c), SPH_C32(0x55ae00f5), + SPH_C32(0x48d10000), SPH_C32(0x741a0000), SPH_C32(0xf1000000), + SPH_C32(0x544e070d), SPH_C32(0x9987bfe7), SPH_C32(0x5e30d003), + SPH_C32(0xefe40cda) }, + { SPH_C32(0x574200a0), SPH_C32(0xea8ac000), SPH_C32(0x44b80000), + SPH_C32(0x7d220000), SPH_C32(0x37ed424e), SPH_C32(0xf5801450), + SPH_C32(0x0f512bc8), SPH_C32(0xb245a39f), SPH_C32(0x545b00f9), + SPH_C32(0xb3ae0000), SPH_C32(0x93cb0000), SPH_C32(0x7aaf0000), + SPH_C32(0x77ec255f), SPH_C32(0x6bd75cf3), SPH_C32(0xe972aa54), + SPH_C32(0xa6672ef1) }, + { SPH_C32(0xa1c200a5), SPH_C32(0xdec90000), SPH_C32(0x60bf0000), + SPH_C32(0xf21f0000), SPH_C32(0x16da79b5), SPH_C32(0xff38c1fe), + SPH_C32(0xc294a0d1), SPH_C32(0x65d019ae), SPH_C32(0xf22400f8), + SPH_C32(0xc2998000), SPH_C32(0x8a370000), SPH_C32(0xec740000), + SPH_C32(0x4d6748a2), SPH_C32(0x801df200), SPH_C32(0xc51feddb), + SPH_C32(0x0ae94279) }, + { SPH_C32(0xf13d00a1), SPH_C32(0x9bbd4000), SPH_C32(0x5d440000), + SPH_C32(0xebf90000), SPH_C32(0x0d662fb3), SPH_C32(0x1e4abaa3), + SPH_C32(0x233c6c47), SPH_C32(0x1ecbcf17), SPH_C32(0x04a400fd), + SPH_C32(0xf6da4000), SPH_C32(0xae300000), SPH_C32(0x63490000), + SPH_C32(0x6c507359), SPH_C32(0x8aa527ae), SPH_C32(0x08da66c2), + SPH_C32(0xdd7cf848) }, + { SPH_C32(0x07bd00a4), SPH_C32(0xaffe8000), SPH_C32(0x79430000), + SPH_C32(0x64c40000), SPH_C32(0x2c511448), SPH_C32(0x14f26f0d), + SPH_C32(0xeef9e75e), SPH_C32(0xc95e7526), SPH_C32(0xa2db00fc), + SPH_C32(0x87edc000), SPH_C32(0xb7cc0000), SPH_C32(0xf5920000), + SPH_C32(0x56db1ea4), SPH_C32(0x616f895d), SPH_C32(0x24b7214d), + SPH_C32(0x71f294c0) }, + { SPH_C32(0xa03700a9), SPH_C32(0x25b60000), SPH_C32(0x876e0000), + SPH_C32(0x79b00000), SPH_C32(0x35785be7), SPH_C32(0x0d6822ea), + SPH_C32(0x75d6da86), SPH_C32(0x2c533b85), SPH_C32(0x803100f9), + SPH_C32(0x3e66c000), SPH_C32(0x36640000), SPH_C32(0x30860000), + SPH_C32(0x8ba26725), SPH_C32(0xa263da9f), SPH_C32(0x71443c50), + SPH_C32(0x5121edd1) }, + { SPH_C32(0x56b700ac), SPH_C32(0x11f5c000), SPH_C32(0xa3690000), + SPH_C32(0xf68d0000), SPH_C32(0x144f601c), SPH_C32(0x07d0f744), + SPH_C32(0xb813519f), SPH_C32(0xfbc681b4), SPH_C32(0x264e00f8), + SPH_C32(0x4f514000), SPH_C32(0x2f980000), SPH_C32(0xa65d0000), + SPH_C32(0xb1290ad8), SPH_C32(0x49a9746c), SPH_C32(0x5d297bdf), + SPH_C32(0xfdaf8159) }, + { SPH_C32(0x064800a8), SPH_C32(0x54818000), SPH_C32(0x9e920000), + SPH_C32(0xef6b0000), SPH_C32(0x0ff3361a), SPH_C32(0xe6a28c19), + SPH_C32(0x59bb9d09), SPH_C32(0x80dd570d), SPH_C32(0xd0ce00fd), + SPH_C32(0x7b128000), SPH_C32(0x0b9f0000), SPH_C32(0x29600000), + SPH_C32(0x901e3123), SPH_C32(0x4311a1c2), SPH_C32(0x90ecf0c6), + SPH_C32(0x2a3a3b68) }, + { SPH_C32(0xf0c800ad), SPH_C32(0x60c24000), SPH_C32(0xba950000), + SPH_C32(0x60560000), SPH_C32(0x2ec40de1), SPH_C32(0xec1a59b7), + SPH_C32(0x947e1610), SPH_C32(0x5748ed3c), SPH_C32(0x76b100fc), + SPH_C32(0x0a250000), SPH_C32(0x12630000), SPH_C32(0xbfbb0000), + SPH_C32(0xaa955cde), SPH_C32(0xa8db0f31), SPH_C32(0xbc81b749), + SPH_C32(0x86b457e0) }, + { SPH_C32(0xe8870170), SPH_C32(0x9d720000), SPH_C32(0x12db0000), + SPH_C32(0xd4220000), SPH_C32(0xf2886b27), SPH_C32(0xa921e543), + SPH_C32(0x4ef8b518), SPH_C32(0x618813b1), SPH_C32(0xb4370060), + SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), SPH_C32(0x5cae0000), + SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), SPH_C32(0x1b365f3d), + SPH_C32(0xf3d45758) }, + { SPH_C32(0x1e070175), SPH_C32(0xa931c000), SPH_C32(0x36dc0000), + SPH_C32(0x5b1f0000), SPH_C32(0xd3bf50dc), SPH_C32(0xa39930ed), + SPH_C32(0x833d3e01), SPH_C32(0xb61da980), SPH_C32(0x12480061), + SPH_C32(0x7d7b8000), SPH_C32(0x4f3e0000), SPH_C32(0xca750000), + SPH_C32(0xaedf72c2), SPH_C32(0xd0f456d6), SPH_C32(0x375b18b2), + SPH_C32(0x5f5a3bd0) }, + { SPH_C32(0x4ef80171), SPH_C32(0xec458000), SPH_C32(0x0b270000), + SPH_C32(0x42f90000), SPH_C32(0xc80306da), SPH_C32(0x42eb4bb0), + SPH_C32(0x6295f297), SPH_C32(0xcd067f39), SPH_C32(0xe4c80064), + SPH_C32(0x49384000), SPH_C32(0x6b390000), SPH_C32(0x45480000), + SPH_C32(0x8fe84939), SPH_C32(0xda4c8378), SPH_C32(0xfa9e93ab), + SPH_C32(0x88cf81e1) }, + { SPH_C32(0xb8780174), SPH_C32(0xd8064000), SPH_C32(0x2f200000), + SPH_C32(0xcdc40000), SPH_C32(0xe9343d21), SPH_C32(0x48539e1e), + SPH_C32(0xaf50798e), SPH_C32(0x1a93c508), SPH_C32(0x42b70065), + SPH_C32(0x380fc000), SPH_C32(0x72c50000), SPH_C32(0xd3930000), + SPH_C32(0xb56324c4), SPH_C32(0x31862d8b), SPH_C32(0xd6f3d424), + SPH_C32(0x2441ed69) }, + { SPH_C32(0x1ff20179), SPH_C32(0x524ec000), SPH_C32(0xd10d0000), + SPH_C32(0xd0b00000), SPH_C32(0xf01d728e), SPH_C32(0x51c9d3f9), + SPH_C32(0x347f4456), SPH_C32(0xff9e8bab), SPH_C32(0x605d0060), + SPH_C32(0x8184c000), SPH_C32(0xf36d0000), SPH_C32(0x16870000), + SPH_C32(0x681a5d45), SPH_C32(0xf28a7e49), SPH_C32(0x8300c939), + SPH_C32(0x04929478) }, + { SPH_C32(0xe972017c), SPH_C32(0x660d0000), SPH_C32(0xf50a0000), + SPH_C32(0x5f8d0000), SPH_C32(0xd12a4975), SPH_C32(0x5b710657), + SPH_C32(0xf9bacf4f), SPH_C32(0x280b319a), SPH_C32(0xc6220061), + SPH_C32(0xf0b34000), SPH_C32(0xea910000), SPH_C32(0x805c0000), + SPH_C32(0x529130b8), SPH_C32(0x1940d0ba), SPH_C32(0xaf6d8eb6), + SPH_C32(0xa81cf8f0) }, + { SPH_C32(0xb98d0178), SPH_C32(0x23794000), SPH_C32(0xc8f10000), + SPH_C32(0x466b0000), SPH_C32(0xca961f73), SPH_C32(0xba037d0a), + SPH_C32(0x181203d9), SPH_C32(0x5310e723), SPH_C32(0x30a20064), + SPH_C32(0xc4f08000), SPH_C32(0xce960000), SPH_C32(0x0f610000), + SPH_C32(0x73a60b43), SPH_C32(0x13f80514), SPH_C32(0x62a805af), + SPH_C32(0x7f8942c1) }, + { SPH_C32(0x4f0d017d), SPH_C32(0x173a8000), SPH_C32(0xecf60000), + SPH_C32(0xc9560000), SPH_C32(0xeba12488), SPH_C32(0xb0bba8a4), + SPH_C32(0xd5d788c0), SPH_C32(0x84855d12), SPH_C32(0x96dd0065), + SPH_C32(0xb5c70000), SPH_C32(0xd76a0000), SPH_C32(0x99ba0000), + SPH_C32(0x492d66be), SPH_C32(0xf832abe7), SPH_C32(0x4ec54220), + SPH_C32(0xd3072e49) }, + { SPH_C32(0x3ced0170), SPH_C32(0x10bac000), SPH_C32(0xb7740000), + SPH_C32(0x9e0b0000), SPH_C32(0x0ec6295d), SPH_C32(0x6095632f), + SPH_C32(0xd6ce231c), SPH_C32(0x96ced091), SPH_C32(0x97280069), + SPH_C32(0x4eb80000), SPH_C32(0x30bb0000), SPH_C32(0x12150000), + SPH_C32(0x6a8f44ec), SPH_C32(0x0a6248f3), SPH_C32(0xf9873877), + SPH_C32(0x9a840c62) }, + { SPH_C32(0xca6d0175), SPH_C32(0x24f90000), SPH_C32(0x93730000), + SPH_C32(0x11360000), SPH_C32(0x2ff112a6), SPH_C32(0x6a2db681), + SPH_C32(0x1b0ba805), SPH_C32(0x415b6aa0), SPH_C32(0x31570068), + SPH_C32(0x3f8f8000), SPH_C32(0x29470000), SPH_C32(0x84ce0000), + SPH_C32(0x50042911), SPH_C32(0xe1a8e600), SPH_C32(0xd5ea7ff8), + SPH_C32(0x360a60ea) }, + { SPH_C32(0x9a920171), SPH_C32(0x618d4000), SPH_C32(0xae880000), + SPH_C32(0x08d00000), SPH_C32(0x344d44a0), SPH_C32(0x8b5fcddc), + SPH_C32(0xfaa36493), SPH_C32(0x3a40bc19), SPH_C32(0xc7d7006d), + SPH_C32(0x0bcc4000), SPH_C32(0x0d400000), SPH_C32(0x0bf30000), + SPH_C32(0x713312ea), SPH_C32(0xeb1033ae), SPH_C32(0x182ff4e1), + SPH_C32(0xe19fdadb) }, + { SPH_C32(0x6c120174), SPH_C32(0x55ce8000), SPH_C32(0x8a8f0000), + SPH_C32(0x87ed0000), SPH_C32(0x157a7f5b), SPH_C32(0x81e71872), + SPH_C32(0x3766ef8a), SPH_C32(0xedd50628), SPH_C32(0x61a8006c), + SPH_C32(0x7afbc000), SPH_C32(0x14bc0000), SPH_C32(0x9d280000), + SPH_C32(0x4bb87f17), SPH_C32(0x00da9d5d), SPH_C32(0x3442b36e), + SPH_C32(0x4d11b653) }, + { SPH_C32(0xcb980179), SPH_C32(0xdf860000), SPH_C32(0x74a20000), + SPH_C32(0x9a990000), SPH_C32(0x0c5330f4), SPH_C32(0x987d5595), + SPH_C32(0xac49d252), SPH_C32(0x08d8488b), SPH_C32(0x43420069), + SPH_C32(0xc370c000), SPH_C32(0x95140000), SPH_C32(0x583c0000), + SPH_C32(0x96c10696), SPH_C32(0xc3d6ce9f), SPH_C32(0x61b1ae73), + SPH_C32(0x6dc2cf42) }, + { SPH_C32(0x3d18017c), SPH_C32(0xebc5c000), SPH_C32(0x50a50000), + SPH_C32(0x15a40000), SPH_C32(0x2d640b0f), SPH_C32(0x92c5803b), + SPH_C32(0x618c594b), SPH_C32(0xdf4df2ba), SPH_C32(0xe53d0068), + SPH_C32(0xb2474000), SPH_C32(0x8ce80000), SPH_C32(0xcee70000), + SPH_C32(0xac4a6b6b), SPH_C32(0x281c606c), SPH_C32(0x4ddce9fc), + SPH_C32(0xc14ca3ca) }, + { SPH_C32(0x6de70178), SPH_C32(0xaeb18000), SPH_C32(0x6d5e0000), + SPH_C32(0x0c420000), SPH_C32(0x36d85d09), SPH_C32(0x73b7fb66), + SPH_C32(0x802495dd), SPH_C32(0xa4562403), SPH_C32(0x13bd006d), + SPH_C32(0x86048000), SPH_C32(0xa8ef0000), SPH_C32(0x41da0000), + SPH_C32(0x8d7d5090), SPH_C32(0x22a4b5c2), SPH_C32(0x801962e5), + SPH_C32(0x16d919fb) }, + { SPH_C32(0x9b67017d), SPH_C32(0x9af24000), SPH_C32(0x49590000), + SPH_C32(0x837f0000), SPH_C32(0x17ef66f2), SPH_C32(0x790f2ec8), + SPH_C32(0x4de11ec4), SPH_C32(0x73c39e32), SPH_C32(0xb5c2006c), + SPH_C32(0xf7330000), SPH_C32(0xb1130000), SPH_C32(0xd7010000), + SPH_C32(0xb7f63d6d), SPH_C32(0xc96e1b31), SPH_C32(0xac74256a), + SPH_C32(0xba577573) }, + { SPH_C32(0x9fc30180), SPH_C32(0x6c280000), SPH_C32(0xe7690000), + SPH_C32(0xe0360000), SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), + SPH_C32(0x453b7806), SPH_C32(0xaebf667a), SPH_C32(0x405b0030), + SPH_C32(0x9a540000), SPH_C32(0x42670000), SPH_C32(0x5fb10000), + SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), SPH_C32(0x87922fef), + SPH_C32(0x79e0422c) }, + { SPH_C32(0x69430185), SPH_C32(0x586bc000), SPH_C32(0xc36e0000), + SPH_C32(0x6f0b0000), SPH_C32(0x5a882e50), SPH_C32(0xf912dcc8), + SPH_C32(0x88fef31f), SPH_C32(0x792adc4b), SPH_C32(0xe6240031), + SPH_C32(0xeb638000), SPH_C32(0x5b9b0000), SPH_C32(0xc96a0000), + SPH_C32(0xec4b0c7a), SPH_C32(0xb64b28cf), SPH_C32(0xabff6860), + SPH_C32(0xd56e2ea4) }, + { SPH_C32(0x39bc0181), SPH_C32(0x1d1f8000), SPH_C32(0xfe950000), + SPH_C32(0x76ed0000), SPH_C32(0x41347856), SPH_C32(0x1860a795), + SPH_C32(0x69563f89), SPH_C32(0x02310af2), SPH_C32(0x10a40034), + SPH_C32(0xdf204000), SPH_C32(0x7f9c0000), SPH_C32(0x46570000), + SPH_C32(0xcd7c3781), SPH_C32(0xbcf3fd61), SPH_C32(0x663ae379), + SPH_C32(0x02fb9495) }, + { SPH_C32(0xcf3c0184), SPH_C32(0x295c4000), SPH_C32(0xda920000), + SPH_C32(0xf9d00000), SPH_C32(0x600343ad), SPH_C32(0x12d8723b), + SPH_C32(0xa493b490), SPH_C32(0xd5a4b0c3), SPH_C32(0xb6db0035), + SPH_C32(0xae17c000), SPH_C32(0x66600000), SPH_C32(0xd08c0000), + SPH_C32(0xf7f75a7c), SPH_C32(0x57395392), SPH_C32(0x4a57a4f6), + SPH_C32(0xae75f81d) }, + { SPH_C32(0x68b60189), SPH_C32(0xa314c000), SPH_C32(0x24bf0000), + SPH_C32(0xe4a40000), SPH_C32(0x792a0c02), SPH_C32(0x0b423fdc), + SPH_C32(0x3fbc8948), SPH_C32(0x30a9fe60), SPH_C32(0x94310030), + SPH_C32(0x179cc000), SPH_C32(0xe7c80000), SPH_C32(0x15980000), + SPH_C32(0x2a8e23fd), SPH_C32(0x94350050), SPH_C32(0x1fa4b9eb), + SPH_C32(0x8ea6810c) }, + { SPH_C32(0x9e36018c), SPH_C32(0x97570000), SPH_C32(0x00b80000), + SPH_C32(0x6b990000), SPH_C32(0x581d37f9), SPH_C32(0x01faea72), + SPH_C32(0xf2790251), SPH_C32(0xe73c4451), SPH_C32(0x324e0031), + SPH_C32(0x66ab4000), SPH_C32(0xfe340000), SPH_C32(0x83430000), + SPH_C32(0x10054e00), SPH_C32(0x7fffaea3), SPH_C32(0x33c9fe64), + SPH_C32(0x2228ed84) }, + { SPH_C32(0xcec90188), SPH_C32(0xd2234000), SPH_C32(0x3d430000), + SPH_C32(0x727f0000), SPH_C32(0x43a161ff), SPH_C32(0xe088912f), + SPH_C32(0x13d1cec7), SPH_C32(0x9c2792e8), SPH_C32(0xc4ce0034), + SPH_C32(0x52e88000), SPH_C32(0xda330000), SPH_C32(0x0c7e0000), + SPH_C32(0x313275fb), SPH_C32(0x75477b0d), SPH_C32(0xfe0c757d), + SPH_C32(0xf5bd57b5) }, + { SPH_C32(0x3849018d), SPH_C32(0xe6608000), SPH_C32(0x19440000), + SPH_C32(0xfd420000), SPH_C32(0x62965a04), SPH_C32(0xea304481), + SPH_C32(0xde1445de), SPH_C32(0x4bb228d9), SPH_C32(0x62b10035), + SPH_C32(0x23df0000), SPH_C32(0xc3cf0000), SPH_C32(0x9aa50000), + SPH_C32(0x0bb91806), SPH_C32(0x9e8dd5fe), SPH_C32(0xd26132f2), + SPH_C32(0x59333b3d) }, + { SPH_C32(0x4ba90180), SPH_C32(0xe1e0c000), SPH_C32(0x42c60000), + SPH_C32(0xaa1f0000), SPH_C32(0x87f157d1), SPH_C32(0x3a1e8f0a), + SPH_C32(0xdd0dee02), SPH_C32(0x59f9a55a), SPH_C32(0x63440039), + SPH_C32(0xd8a00000), SPH_C32(0x241e0000), SPH_C32(0x110a0000), + SPH_C32(0x281b3a54), SPH_C32(0x6cdd36ea), SPH_C32(0x652348a5), + SPH_C32(0x10b01916) }, + { SPH_C32(0xbd290185), SPH_C32(0xd5a30000), SPH_C32(0x66c10000), + SPH_C32(0x25220000), SPH_C32(0xa6c66c2a), SPH_C32(0x30a65aa4), + SPH_C32(0x10c8651b), SPH_C32(0x8e6c1f6b), SPH_C32(0xc53b0038), + SPH_C32(0xa9978000), SPH_C32(0x3de20000), SPH_C32(0x87d10000), + SPH_C32(0x129057a9), SPH_C32(0x87179819), SPH_C32(0x494e0f2a), + SPH_C32(0xbc3e759e) }, + { SPH_C32(0xedd60181), SPH_C32(0x90d74000), SPH_C32(0x5b3a0000), + SPH_C32(0x3cc40000), SPH_C32(0xbd7a3a2c), SPH_C32(0xd1d421f9), + SPH_C32(0xf160a98d), SPH_C32(0xf577c9d2), SPH_C32(0x33bb003d), + SPH_C32(0x9dd44000), SPH_C32(0x19e50000), SPH_C32(0x08ec0000), + SPH_C32(0x33a76c52), SPH_C32(0x8daf4db7), SPH_C32(0x848b8433), + SPH_C32(0x6babcfaf) }, + { SPH_C32(0x1b560184), SPH_C32(0xa4948000), SPH_C32(0x7f3d0000), + SPH_C32(0xb3f90000), SPH_C32(0x9c4d01d7), SPH_C32(0xdb6cf457), + SPH_C32(0x3ca52294), SPH_C32(0x22e273e3), SPH_C32(0x95c4003c), + SPH_C32(0xece3c000), SPH_C32(0x00190000), SPH_C32(0x9e370000), + SPH_C32(0x092c01af), SPH_C32(0x6665e344), SPH_C32(0xa8e6c3bc), + SPH_C32(0xc725a327) }, + { SPH_C32(0xbcdc0189), SPH_C32(0x2edc0000), SPH_C32(0x81100000), + SPH_C32(0xae8d0000), SPH_C32(0x85644e78), SPH_C32(0xc2f6b9b0), + SPH_C32(0xa78a1f4c), SPH_C32(0xc7ef3d40), SPH_C32(0xb72e0039), + SPH_C32(0x5568c000), SPH_C32(0x81b10000), SPH_C32(0x5b230000), + SPH_C32(0xd455782e), SPH_C32(0xa569b086), SPH_C32(0xfd15dea1), + SPH_C32(0xe7f6da36) }, + { SPH_C32(0x4a5c018c), SPH_C32(0x1a9fc000), SPH_C32(0xa5170000), + SPH_C32(0x21b00000), SPH_C32(0xa4537583), SPH_C32(0xc84e6c1e), + SPH_C32(0x6a4f9455), SPH_C32(0x107a8771), SPH_C32(0x11510038), + SPH_C32(0x245f4000), SPH_C32(0x984d0000), SPH_C32(0xcdf80000), + SPH_C32(0xeede15d3), SPH_C32(0x4ea31e75), SPH_C32(0xd178992e), + SPH_C32(0x4b78b6be) }, + { SPH_C32(0x1aa30188), SPH_C32(0x5feb8000), SPH_C32(0x98ec0000), + SPH_C32(0x38560000), SPH_C32(0xbfef2385), SPH_C32(0x293c1743), + SPH_C32(0x8be758c3), SPH_C32(0x6b6151c8), SPH_C32(0xe7d1003d), + SPH_C32(0x101c8000), SPH_C32(0xbc4a0000), SPH_C32(0x42c50000), + SPH_C32(0xcfe92e28), SPH_C32(0x441bcbdb), SPH_C32(0x1cbd1237), + SPH_C32(0x9ced0c8f) }, + { SPH_C32(0xec23018d), SPH_C32(0x6ba84000), SPH_C32(0xbceb0000), + SPH_C32(0xb76b0000), SPH_C32(0x9ed8187e), SPH_C32(0x2384c2ed), + SPH_C32(0x4622d3da), SPH_C32(0xbcf4ebf9), SPH_C32(0x41ae003c), + SPH_C32(0x612b0000), SPH_C32(0xa5b60000), SPH_C32(0xd41e0000), + SPH_C32(0xf56243d5), SPH_C32(0xafd16528), SPH_C32(0x30d055b8), + SPH_C32(0x30636007) }, + { SPH_C32(0x1ceb0120), SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), + SPH_C32(0xd73d0000), SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), + SPH_C32(0xd25cc5ca), SPH_C32(0xebbc06c5), SPH_C32(0x371f00c0), + SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), SPH_C32(0x6ba50000), + SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), SPH_C32(0x8c51e2f1), + SPH_C32(0xb6d737e7) }, + { SPH_C32(0xea6b0125), SPH_C32(0x3f29c000), SPH_C32(0x22790000), + SPH_C32(0x58000000), SPH_C32(0x912b2e64), SPH_C32(0xc5264ef4), + SPH_C32(0x1f994ed3), SPH_C32(0x3c29bcf4), SPH_C32(0x916000c1), + SPH_C32(0x1a398000), SPH_C32(0xae290000), SPH_C32(0xfd7e0000), + SPH_C32(0x657c72f6), SPH_C32(0xecc0c4ea), SPH_C32(0xa03ca57e), + SPH_C32(0x1a595b6f) }, + { SPH_C32(0xba940121), SPH_C32(0x7a5d8000), SPH_C32(0x1f820000), + SPH_C32(0x41e60000), SPH_C32(0x8a977862), SPH_C32(0x245435a9), + SPH_C32(0xfe318245), SPH_C32(0x47326a4d), SPH_C32(0x67e000c4), + SPH_C32(0x2e7a4000), SPH_C32(0x8a2e0000), SPH_C32(0x72430000), + SPH_C32(0x444b490d), SPH_C32(0xe6781144), SPH_C32(0x6df92e67), + SPH_C32(0xcdcce15e) }, + { SPH_C32(0x4c140124), SPH_C32(0x4e1e4000), SPH_C32(0x3b850000), + SPH_C32(0xcedb0000), SPH_C32(0xaba04399), SPH_C32(0x2eece007), + SPH_C32(0x33f4095c), SPH_C32(0x90a7d07c), SPH_C32(0xc19f00c5), + SPH_C32(0x5f4dc000), SPH_C32(0x93d20000), SPH_C32(0xe4980000), + SPH_C32(0x7ec024f0), SPH_C32(0x0db2bfb7), SPH_C32(0x419469e8), + SPH_C32(0x61428dd6) }, + { SPH_C32(0xeb9e0129), SPH_C32(0xc456c000), SPH_C32(0xc5a80000), + SPH_C32(0xd3af0000), SPH_C32(0xb2890c36), SPH_C32(0x3776ade0), + SPH_C32(0xa8db3484), SPH_C32(0x75aa9edf), SPH_C32(0xe37500c0), + SPH_C32(0xe6c6c000), SPH_C32(0x127a0000), SPH_C32(0x218c0000), + SPH_C32(0xa3b95d71), SPH_C32(0xcebeec75), SPH_C32(0x146774f5), + SPH_C32(0x4191f4c7) }, + { SPH_C32(0x1d1e012c), SPH_C32(0xf0150000), SPH_C32(0xe1af0000), + SPH_C32(0x5c920000), SPH_C32(0x93be37cd), SPH_C32(0x3dce784e), + SPH_C32(0x651ebf9d), SPH_C32(0xa23f24ee), SPH_C32(0x450a00c1), + SPH_C32(0x97f14000), SPH_C32(0x0b860000), SPH_C32(0xb7570000), + SPH_C32(0x9932308c), SPH_C32(0x25744286), SPH_C32(0x380a337a), + SPH_C32(0xed1f984f) }, + { SPH_C32(0x4de10128), SPH_C32(0xb5614000), SPH_C32(0xdc540000), + SPH_C32(0x45740000), SPH_C32(0x880261cb), SPH_C32(0xdcbc0313), + SPH_C32(0x84b6730b), SPH_C32(0xd924f257), SPH_C32(0xb38a00c4), + SPH_C32(0xa3b28000), SPH_C32(0x2f810000), SPH_C32(0x386a0000), + SPH_C32(0xb8050b77), SPH_C32(0x2fcc9728), SPH_C32(0xf5cfb863), + SPH_C32(0x3a8a227e) }, + { SPH_C32(0xbb61012d), SPH_C32(0x81228000), SPH_C32(0xf8530000), + SPH_C32(0xca490000), SPH_C32(0xa9355a30), SPH_C32(0xd604d6bd), + SPH_C32(0x4973f812), SPH_C32(0x0eb14866), SPH_C32(0x15f500c5), + SPH_C32(0xd2850000), SPH_C32(0x367d0000), SPH_C32(0xaeb10000), + SPH_C32(0x828e668a), SPH_C32(0xc40639db), SPH_C32(0xd9a2ffec), + SPH_C32(0x96044ef6) }, + { SPH_C32(0xc8810120), SPH_C32(0x86a2c000), SPH_C32(0xa3d10000), + SPH_C32(0x9d140000), SPH_C32(0x4c5257e5), SPH_C32(0x062a1d36), + SPH_C32(0x4a6a53ce), SPH_C32(0x1cfac5e5), SPH_C32(0x140000c9), + SPH_C32(0x29fa0000), SPH_C32(0xd1ac0000), SPH_C32(0x251e0000), + SPH_C32(0xa12c44d8), SPH_C32(0x3656dacf), SPH_C32(0x6ee085bb), + SPH_C32(0xdf876cdd) }, + { SPH_C32(0x3e010125), SPH_C32(0xb2e10000), SPH_C32(0x87d60000), + SPH_C32(0x12290000), SPH_C32(0x6d656c1e), SPH_C32(0x0c92c898), + SPH_C32(0x87afd8d7), SPH_C32(0xcb6f7fd4), SPH_C32(0xb27f00c8), + SPH_C32(0x58cd8000), SPH_C32(0xc8500000), SPH_C32(0xb3c50000), + SPH_C32(0x9ba72925), SPH_C32(0xdd9c743c), SPH_C32(0x428dc234), + SPH_C32(0x73090055) }, + { SPH_C32(0x6efe0121), SPH_C32(0xf7954000), SPH_C32(0xba2d0000), + SPH_C32(0x0bcf0000), SPH_C32(0x76d93a18), SPH_C32(0xede0b3c5), + SPH_C32(0x66071441), SPH_C32(0xb074a96d), SPH_C32(0x44ff00cd), + SPH_C32(0x6c8e4000), SPH_C32(0xec570000), SPH_C32(0x3cf80000), + SPH_C32(0xba9012de), SPH_C32(0xd724a192), SPH_C32(0x8f48492d), + SPH_C32(0xa49cba64) }, + { SPH_C32(0x987e0124), SPH_C32(0xc3d68000), SPH_C32(0x9e2a0000), + SPH_C32(0x84f20000), SPH_C32(0x57ee01e3), SPH_C32(0xe758666b), + SPH_C32(0xabc29f58), SPH_C32(0x67e1135c), SPH_C32(0xe28000cc), + SPH_C32(0x1db9c000), SPH_C32(0xf5ab0000), SPH_C32(0xaa230000), + SPH_C32(0x801b7f23), SPH_C32(0x3cee0f61), SPH_C32(0xa3250ea2), + SPH_C32(0x0812d6ec) }, + { SPH_C32(0x3ff40129), SPH_C32(0x499e0000), SPH_C32(0x60070000), + SPH_C32(0x99860000), SPH_C32(0x4ec74e4c), SPH_C32(0xfec22b8c), + SPH_C32(0x30eda280), SPH_C32(0x82ec5dff), SPH_C32(0xc06a00c9), + SPH_C32(0xa432c000), SPH_C32(0x74030000), SPH_C32(0x6f370000), + SPH_C32(0x5d6206a2), SPH_C32(0xffe25ca3), SPH_C32(0xf6d613bf), + SPH_C32(0x28c1affd) }, + { SPH_C32(0xc974012c), SPH_C32(0x7dddc000), SPH_C32(0x44000000), + SPH_C32(0x16bb0000), SPH_C32(0x6ff075b7), SPH_C32(0xf47afe22), + SPH_C32(0xfd282999), SPH_C32(0x5579e7ce), SPH_C32(0x661500c8), + SPH_C32(0xd5054000), SPH_C32(0x6dff0000), SPH_C32(0xf9ec0000), + SPH_C32(0x67e96b5f), SPH_C32(0x1428f250), SPH_C32(0xdabb5430), + SPH_C32(0x844fc375) }, + { SPH_C32(0x998b0128), SPH_C32(0x38a98000), SPH_C32(0x79fb0000), + SPH_C32(0x0f5d0000), SPH_C32(0x744c23b1), SPH_C32(0x1508857f), + SPH_C32(0x1c80e50f), SPH_C32(0x2e623177), SPH_C32(0x909500cd), + SPH_C32(0xe1468000), SPH_C32(0x49f80000), SPH_C32(0x76d10000), + SPH_C32(0x46de50a4), SPH_C32(0x1e9027fe), SPH_C32(0x177edf29), + SPH_C32(0x53da7944) }, + { SPH_C32(0x6f0b012d), SPH_C32(0x0cea4000), SPH_C32(0x5dfc0000), + SPH_C32(0x80600000), SPH_C32(0x557b184a), SPH_C32(0x1fb050d1), + SPH_C32(0xd1456e16), SPH_C32(0xf9f78b46), SPH_C32(0x36ea00cc), + SPH_C32(0x90710000), SPH_C32(0x50040000), SPH_C32(0xe00a0000), + SPH_C32(0x7c553d59), SPH_C32(0xf55a890d), SPH_C32(0x3b1398a6), + SPH_C32(0xff5415cc) }, + { SPH_C32(0x6baf01d0), SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), + SPH_C32(0xe3290000), SPH_C32(0x392b6b13), SPH_C32(0x9515777f), + SPH_C32(0xd99f08d4), SPH_C32(0x248b730e), SPH_C32(0xc3730090), + SPH_C32(0xfd160000), SPH_C32(0xa3700000), SPH_C32(0x68ba0000), + SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), SPH_C32(0x10f59223), + SPH_C32(0x3ce32293) }, + { SPH_C32(0x9d2f01d5), SPH_C32(0xce73c000), SPH_C32(0xd7cb0000), + SPH_C32(0x6c140000), SPH_C32(0x181c50e8), SPH_C32(0x9fada2d1), + SPH_C32(0x145a83cd), SPH_C32(0xf31ec93f), SPH_C32(0x650c0091), + SPH_C32(0x8c218000), SPH_C32(0xba8c0000), SPH_C32(0xfe610000), + SPH_C32(0x27e80c4e), SPH_C32(0x8a7fbaf3), SPH_C32(0x3c98d5ac), + SPH_C32(0x906d4e1b) }, + { SPH_C32(0xcdd001d1), SPH_C32(0x8b078000), SPH_C32(0xea300000), + SPH_C32(0x75f20000), SPH_C32(0x03a006ee), SPH_C32(0x7edfd98c), + SPH_C32(0xf5f24f5b), SPH_C32(0x88051f86), SPH_C32(0x938c0094), + SPH_C32(0xb8624000), SPH_C32(0x9e8b0000), SPH_C32(0x715c0000), + SPH_C32(0x06df37b5), SPH_C32(0x80c76f5d), SPH_C32(0xf15d5eb5), + SPH_C32(0x47f8f42a) }, + { SPH_C32(0x3b5001d4), SPH_C32(0xbf444000), SPH_C32(0xce370000), + SPH_C32(0xfacf0000), SPH_C32(0x22973d15), SPH_C32(0x74670c22), + SPH_C32(0x3837c442), SPH_C32(0x5f90a5b7), SPH_C32(0x35f30095), + SPH_C32(0xc955c000), SPH_C32(0x87770000), SPH_C32(0xe7870000), + SPH_C32(0x3c545a48), SPH_C32(0x6b0dc1ae), SPH_C32(0xdd30193a), + SPH_C32(0xeb7698a2) }, + { SPH_C32(0x9cda01d9), SPH_C32(0x350cc000), SPH_C32(0x301a0000), + SPH_C32(0xe7bb0000), SPH_C32(0x3bbe72ba), SPH_C32(0x6dfd41c5), + SPH_C32(0xa318f99a), SPH_C32(0xba9deb14), SPH_C32(0x17190090), + SPH_C32(0x70dec000), SPH_C32(0x06df0000), SPH_C32(0x22930000), + SPH_C32(0xe12d23c9), SPH_C32(0xa801926c), SPH_C32(0x88c30427), + SPH_C32(0xcba5e1b3) }, + { SPH_C32(0x6a5a01dc), SPH_C32(0x014f0000), SPH_C32(0x141d0000), + SPH_C32(0x68860000), SPH_C32(0x1a894941), SPH_C32(0x6745946b), + SPH_C32(0x6edd7283), SPH_C32(0x6d085125), SPH_C32(0xb1660091), + SPH_C32(0x01e94000), SPH_C32(0x1f230000), SPH_C32(0xb4480000), + SPH_C32(0xdba64e34), SPH_C32(0x43cb3c9f), SPH_C32(0xa4ae43a8), + SPH_C32(0x672b8d3b) }, + { SPH_C32(0x3aa501d8), SPH_C32(0x443b4000), SPH_C32(0x29e60000), + SPH_C32(0x71600000), SPH_C32(0x01351f47), SPH_C32(0x8637ef36), + SPH_C32(0x8f75be15), SPH_C32(0x1613879c), SPH_C32(0x47e60094), + SPH_C32(0x35aa8000), SPH_C32(0x3b240000), SPH_C32(0x3b750000), + SPH_C32(0xfa9175cf), SPH_C32(0x4973e931), SPH_C32(0x696bc8b1), + SPH_C32(0xb0be370a) }, + { SPH_C32(0xcc2501dd), SPH_C32(0x70788000), SPH_C32(0x0de10000), + SPH_C32(0xfe5d0000), SPH_C32(0x200224bc), SPH_C32(0x8c8f3a98), + SPH_C32(0x42b0350c), SPH_C32(0xc1863dad), SPH_C32(0xe1990095), + SPH_C32(0x449d0000), SPH_C32(0x22d80000), SPH_C32(0xadae0000), + SPH_C32(0xc01a1832), SPH_C32(0xa2b947c2), SPH_C32(0x45068f3e), + SPH_C32(0x1c305b82) }, + { SPH_C32(0xbfc501d0), SPH_C32(0x77f8c000), SPH_C32(0x56630000), + SPH_C32(0xa9000000), SPH_C32(0xc5652969), SPH_C32(0x5ca1f113), + SPH_C32(0x41a99ed0), SPH_C32(0xd3cdb02e), SPH_C32(0xe06c0099), + SPH_C32(0xbfe20000), SPH_C32(0xc5090000), SPH_C32(0x26010000), + SPH_C32(0xe3b83a60), SPH_C32(0x50e9a4d6), SPH_C32(0xf244f569), + SPH_C32(0x55b379a9) }, + { SPH_C32(0x494501d5), SPH_C32(0x43bb0000), SPH_C32(0x72640000), + SPH_C32(0x263d0000), SPH_C32(0xe4521292), SPH_C32(0x561924bd), + SPH_C32(0x8c6c15c9), SPH_C32(0x04580a1f), SPH_C32(0x46130098), + SPH_C32(0xced58000), SPH_C32(0xdcf50000), SPH_C32(0xb0da0000), + SPH_C32(0xd933579d), SPH_C32(0xbb230a25), SPH_C32(0xde29b2e6), + SPH_C32(0xf93d1521) }, + { SPH_C32(0x19ba01d1), SPH_C32(0x06cf4000), SPH_C32(0x4f9f0000), + SPH_C32(0x3fdb0000), SPH_C32(0xffee4494), SPH_C32(0xb76b5fe0), + SPH_C32(0x6dc4d95f), SPH_C32(0x7f43dca6), SPH_C32(0xb093009d), + SPH_C32(0xfa964000), SPH_C32(0xf8f20000), SPH_C32(0x3fe70000), + SPH_C32(0xf8046c66), SPH_C32(0xb19bdf8b), SPH_C32(0x13ec39ff), + SPH_C32(0x2ea8af10) }, + { SPH_C32(0xef3a01d4), SPH_C32(0x328c8000), SPH_C32(0x6b980000), + SPH_C32(0xb0e60000), SPH_C32(0xded97f6f), SPH_C32(0xbdd38a4e), + SPH_C32(0xa0015246), SPH_C32(0xa8d66697), SPH_C32(0x16ec009c), + SPH_C32(0x8ba1c000), SPH_C32(0xe10e0000), SPH_C32(0xa93c0000), + SPH_C32(0xc28f019b), SPH_C32(0x5a517178), SPH_C32(0x3f817e70), + SPH_C32(0x8226c398) }, + { SPH_C32(0x48b001d9), SPH_C32(0xb8c40000), SPH_C32(0x95b50000), + SPH_C32(0xad920000), SPH_C32(0xc7f030c0), SPH_C32(0xa449c7a9), + SPH_C32(0x3b2e6f9e), SPH_C32(0x4ddb2834), SPH_C32(0x34060099), + SPH_C32(0x322ac000), SPH_C32(0x60a60000), SPH_C32(0x6c280000), + SPH_C32(0x1ff6781a), SPH_C32(0x995d22ba), SPH_C32(0x6a72636d), + SPH_C32(0xa2f5ba89) }, + { SPH_C32(0xbe3001dc), SPH_C32(0x8c87c000), SPH_C32(0xb1b20000), + SPH_C32(0x22af0000), SPH_C32(0xe6c70b3b), SPH_C32(0xaef11207), + SPH_C32(0xf6ebe487), SPH_C32(0x9a4e9205), SPH_C32(0x92790098), + SPH_C32(0x431d4000), SPH_C32(0x795a0000), SPH_C32(0xfaf30000), + SPH_C32(0x257d15e7), SPH_C32(0x72978c49), SPH_C32(0x461f24e2), + SPH_C32(0x0e7bd601) }, + { SPH_C32(0xeecf01d8), SPH_C32(0xc9f38000), SPH_C32(0x8c490000), + SPH_C32(0x3b490000), SPH_C32(0xfd7b5d3d), SPH_C32(0x4f83695a), + SPH_C32(0x17432811), SPH_C32(0xe15544bc), SPH_C32(0x64f9009d), + SPH_C32(0x775e8000), SPH_C32(0x5d5d0000), SPH_C32(0x75ce0000), + SPH_C32(0x044a2e1c), SPH_C32(0x782f59e7), SPH_C32(0x8bdaaffb), + SPH_C32(0xd9ee6c30) }, + { SPH_C32(0x184f01dd), SPH_C32(0xfdb04000), SPH_C32(0xa84e0000), + SPH_C32(0xb4740000), SPH_C32(0xdc4c66c6), SPH_C32(0x453bbcf4), + SPH_C32(0xda86a308), SPH_C32(0x36c0fe8d), SPH_C32(0xc286009c), + SPH_C32(0x06690000), SPH_C32(0x44a10000), SPH_C32(0xe3150000), + SPH_C32(0x3ec143e1), SPH_C32(0x93e5f714), SPH_C32(0xa7b7e874), + SPH_C32(0x756000b8) }, + { SPH_C32(0xb4370060), SPH_C32(0x0c4c0000), SPH_C32(0x56c20000), + SPH_C32(0x5cae0000), SPH_C32(0x94541f3f), SPH_C32(0x3b3ef825), + SPH_C32(0x1b365f3d), SPH_C32(0xf3d45758), SPH_C32(0x5cb00110), + SPH_C32(0x913e0000), SPH_C32(0x44190000), SPH_C32(0x888c0000), + SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), SPH_C32(0x55ceea25), + SPH_C32(0x925c44e9) }, + { SPH_C32(0x42b70065), SPH_C32(0x380fc000), SPH_C32(0x72c50000), + SPH_C32(0xd3930000), SPH_C32(0xb56324c4), SPH_C32(0x31862d8b), + SPH_C32(0xd6f3d424), SPH_C32(0x2441ed69), SPH_C32(0xfacf0111), + SPH_C32(0xe0098000), SPH_C32(0x5de50000), SPH_C32(0x1e570000), + SPH_C32(0x5c5719e5), SPH_C32(0x79d5b395), SPH_C32(0x79a3adaa), + SPH_C32(0x3ed22861) }, + { SPH_C32(0x12480061), SPH_C32(0x7d7b8000), SPH_C32(0x4f3e0000), + SPH_C32(0xca750000), SPH_C32(0xaedf72c2), SPH_C32(0xd0f456d6), + SPH_C32(0x375b18b2), SPH_C32(0x5f5a3bd0), SPH_C32(0x0c4f0114), + SPH_C32(0xd44a4000), SPH_C32(0x79e20000), SPH_C32(0x916a0000), + SPH_C32(0x7d60221e), SPH_C32(0x736d663b), SPH_C32(0xb46626b3), + SPH_C32(0xe9479250) }, + { SPH_C32(0xe4c80064), SPH_C32(0x49384000), SPH_C32(0x6b390000), + SPH_C32(0x45480000), SPH_C32(0x8fe84939), SPH_C32(0xda4c8378), + SPH_C32(0xfa9e93ab), SPH_C32(0x88cf81e1), SPH_C32(0xaa300115), + SPH_C32(0xa57dc000), SPH_C32(0x601e0000), SPH_C32(0x07b10000), + SPH_C32(0x47eb4fe3), SPH_C32(0x98a7c8c8), SPH_C32(0x980b613c), + SPH_C32(0x45c9fed8) }, + { SPH_C32(0x43420069), SPH_C32(0xc370c000), SPH_C32(0x95140000), + SPH_C32(0x583c0000), SPH_C32(0x96c10696), SPH_C32(0xc3d6ce9f), + SPH_C32(0x61b1ae73), SPH_C32(0x6dc2cf42), SPH_C32(0x88da0110), + SPH_C32(0x1cf6c000), SPH_C32(0xe1b60000), SPH_C32(0xc2a50000), + SPH_C32(0x9a923662), SPH_C32(0x5bab9b0a), SPH_C32(0xcdf87c21), + SPH_C32(0x651a87c9) }, + { SPH_C32(0xb5c2006c), SPH_C32(0xf7330000), SPH_C32(0xb1130000), + SPH_C32(0xd7010000), SPH_C32(0xb7f63d6d), SPH_C32(0xc96e1b31), + SPH_C32(0xac74256a), SPH_C32(0xba577573), SPH_C32(0x2ea50111), + SPH_C32(0x6dc14000), SPH_C32(0xf84a0000), SPH_C32(0x547e0000), + SPH_C32(0xa0195b9f), SPH_C32(0xb06135f9), SPH_C32(0xe1953bae), + SPH_C32(0xc994eb41) }, + { SPH_C32(0xe53d0068), SPH_C32(0xb2474000), SPH_C32(0x8ce80000), + SPH_C32(0xcee70000), SPH_C32(0xac4a6b6b), SPH_C32(0x281c606c), + SPH_C32(0x4ddce9fc), SPH_C32(0xc14ca3ca), SPH_C32(0xd8250114), + SPH_C32(0x59828000), SPH_C32(0xdc4d0000), SPH_C32(0xdb430000), + SPH_C32(0x812e6064), SPH_C32(0xbad9e057), SPH_C32(0x2c50b0b7), + SPH_C32(0x1e015170) }, + { SPH_C32(0x13bd006d), SPH_C32(0x86048000), SPH_C32(0xa8ef0000), + SPH_C32(0x41da0000), SPH_C32(0x8d7d5090), SPH_C32(0x22a4b5c2), + SPH_C32(0x801962e5), SPH_C32(0x16d919fb), SPH_C32(0x7e5a0115), + SPH_C32(0x28b50000), SPH_C32(0xc5b10000), SPH_C32(0x4d980000), + SPH_C32(0xbba50d99), SPH_C32(0x51134ea4), SPH_C32(0x003df738), + SPH_C32(0xb28f3df8) }, + { SPH_C32(0x605d0060), SPH_C32(0x8184c000), SPH_C32(0xf36d0000), + SPH_C32(0x16870000), SPH_C32(0x681a5d45), SPH_C32(0xf28a7e49), + SPH_C32(0x8300c939), SPH_C32(0x04929478), SPH_C32(0x7faf0119), + SPH_C32(0xd3ca0000), SPH_C32(0x22600000), SPH_C32(0xc6370000), + SPH_C32(0x98072fcb), SPH_C32(0xa343adb0), SPH_C32(0xb77f8d6f), + SPH_C32(0xfb0c1fd3) }, + { SPH_C32(0x96dd0065), SPH_C32(0xb5c70000), SPH_C32(0xd76a0000), + SPH_C32(0x99ba0000), SPH_C32(0x492d66be), SPH_C32(0xf832abe7), + SPH_C32(0x4ec54220), SPH_C32(0xd3072e49), SPH_C32(0xd9d00118), + SPH_C32(0xa2fd8000), SPH_C32(0x3b9c0000), SPH_C32(0x50ec0000), + SPH_C32(0xa28c4236), SPH_C32(0x48890343), SPH_C32(0x9b12cae0), + SPH_C32(0x5782735b) }, + { SPH_C32(0xc6220061), SPH_C32(0xf0b34000), SPH_C32(0xea910000), + SPH_C32(0x805c0000), SPH_C32(0x529130b8), SPH_C32(0x1940d0ba), + SPH_C32(0xaf6d8eb6), SPH_C32(0xa81cf8f0), SPH_C32(0x2f50011d), + SPH_C32(0x96be4000), SPH_C32(0x1f9b0000), SPH_C32(0xdfd10000), + SPH_C32(0x83bb79cd), SPH_C32(0x4231d6ed), SPH_C32(0x56d741f9), + SPH_C32(0x8017c96a) }, + { SPH_C32(0x30a20064), SPH_C32(0xc4f08000), SPH_C32(0xce960000), + SPH_C32(0x0f610000), SPH_C32(0x73a60b43), SPH_C32(0x13f80514), + SPH_C32(0x62a805af), SPH_C32(0x7f8942c1), SPH_C32(0x892f011c), + SPH_C32(0xe789c000), SPH_C32(0x06670000), SPH_C32(0x490a0000), + SPH_C32(0xb9301430), SPH_C32(0xa9fb781e), SPH_C32(0x7aba0676), + SPH_C32(0x2c99a5e2) }, + { SPH_C32(0x97280069), SPH_C32(0x4eb80000), SPH_C32(0x30bb0000), + SPH_C32(0x12150000), SPH_C32(0x6a8f44ec), SPH_C32(0x0a6248f3), + SPH_C32(0xf9873877), SPH_C32(0x9a840c62), SPH_C32(0xabc50119), + SPH_C32(0x5e02c000), SPH_C32(0x87cf0000), SPH_C32(0x8c1e0000), + SPH_C32(0x64496db1), SPH_C32(0x6af72bdc), SPH_C32(0x2f491b6b), + SPH_C32(0x0c4adcf3) }, + { SPH_C32(0x61a8006c), SPH_C32(0x7afbc000), SPH_C32(0x14bc0000), + SPH_C32(0x9d280000), SPH_C32(0x4bb87f17), SPH_C32(0x00da9d5d), + SPH_C32(0x3442b36e), SPH_C32(0x4d11b653), SPH_C32(0x0dba0118), + SPH_C32(0x2f354000), SPH_C32(0x9e330000), SPH_C32(0x1ac50000), + SPH_C32(0x5ec2004c), SPH_C32(0x813d852f), SPH_C32(0x03245ce4), + SPH_C32(0xa0c4b07b) }, + { SPH_C32(0x31570068), SPH_C32(0x3f8f8000), SPH_C32(0x29470000), + SPH_C32(0x84ce0000), SPH_C32(0x50042911), SPH_C32(0xe1a8e600), + SPH_C32(0xd5ea7ff8), SPH_C32(0x360a60ea), SPH_C32(0xfb3a011d), + SPH_C32(0x1b768000), SPH_C32(0xba340000), SPH_C32(0x95f80000), + SPH_C32(0x7ff53bb7), SPH_C32(0x8b855081), SPH_C32(0xcee1d7fd), + SPH_C32(0x77510a4a) }, + { SPH_C32(0xc7d7006d), SPH_C32(0x0bcc4000), SPH_C32(0x0d400000), + SPH_C32(0x0bf30000), SPH_C32(0x713312ea), SPH_C32(0xeb1033ae), + SPH_C32(0x182ff4e1), SPH_C32(0xe19fdadb), SPH_C32(0x5d45011c), + SPH_C32(0x6a410000), SPH_C32(0xa3c80000), SPH_C32(0x03230000), + SPH_C32(0x457e564a), SPH_C32(0x604ffe72), SPH_C32(0xe28c9072), + SPH_C32(0xdbdf66c2) }, + { SPH_C32(0xc3730090), SPH_C32(0xfd160000), SPH_C32(0xa3700000), + SPH_C32(0x68ba0000), SPH_C32(0x1d6361b3), SPH_C32(0x61b51400), + SPH_C32(0x10f59223), SPH_C32(0x3ce32293), SPH_C32(0xa8dc0140), + SPH_C32(0x07260000), SPH_C32(0x50bc0000), SPH_C32(0x8b930000), + SPH_C32(0x24480aa0), SPH_C32(0xf4a0637f), SPH_C32(0xc96a9af7), + SPH_C32(0x1868519d) }, + { SPH_C32(0x35f30095), SPH_C32(0xc955c000), SPH_C32(0x87770000), + SPH_C32(0xe7870000), SPH_C32(0x3c545a48), SPH_C32(0x6b0dc1ae), + SPH_C32(0xdd30193a), SPH_C32(0xeb7698a2), SPH_C32(0x0ea30141), + SPH_C32(0x76118000), SPH_C32(0x49400000), SPH_C32(0x1d480000), + SPH_C32(0x1ec3675d), SPH_C32(0x1f6acd8c), SPH_C32(0xe507dd78), + SPH_C32(0xb4e63d15) }, + { SPH_C32(0x650c0091), SPH_C32(0x8c218000), SPH_C32(0xba8c0000), + SPH_C32(0xfe610000), SPH_C32(0x27e80c4e), SPH_C32(0x8a7fbaf3), + SPH_C32(0x3c98d5ac), SPH_C32(0x906d4e1b), SPH_C32(0xf8230144), + SPH_C32(0x42524000), SPH_C32(0x6d470000), SPH_C32(0x92750000), + SPH_C32(0x3ff45ca6), SPH_C32(0x15d21822), SPH_C32(0x28c25661), + SPH_C32(0x63738724) }, + { SPH_C32(0x938c0094), SPH_C32(0xb8624000), SPH_C32(0x9e8b0000), + SPH_C32(0x715c0000), SPH_C32(0x06df37b5), SPH_C32(0x80c76f5d), + SPH_C32(0xf15d5eb5), SPH_C32(0x47f8f42a), SPH_C32(0x5e5c0145), + SPH_C32(0x3365c000), SPH_C32(0x74bb0000), SPH_C32(0x04ae0000), + SPH_C32(0x057f315b), SPH_C32(0xfe18b6d1), SPH_C32(0x04af11ee), + SPH_C32(0xcffdebac) }, + { SPH_C32(0x34060099), SPH_C32(0x322ac000), SPH_C32(0x60a60000), + SPH_C32(0x6c280000), SPH_C32(0x1ff6781a), SPH_C32(0x995d22ba), + SPH_C32(0x6a72636d), SPH_C32(0xa2f5ba89), SPH_C32(0x7cb60140), + SPH_C32(0x8aeec000), SPH_C32(0xf5130000), SPH_C32(0xc1ba0000), + SPH_C32(0xd80648da), SPH_C32(0x3d14e513), SPH_C32(0x515c0cf3), + SPH_C32(0xef2e92bd) }, + { SPH_C32(0xc286009c), SPH_C32(0x06690000), SPH_C32(0x44a10000), + SPH_C32(0xe3150000), SPH_C32(0x3ec143e1), SPH_C32(0x93e5f714), + SPH_C32(0xa7b7e874), SPH_C32(0x756000b8), SPH_C32(0xdac90141), + SPH_C32(0xfbd94000), SPH_C32(0xecef0000), SPH_C32(0x57610000), + SPH_C32(0xe28d2527), SPH_C32(0xd6de4be0), SPH_C32(0x7d314b7c), + SPH_C32(0x43a0fe35) }, + { SPH_C32(0x92790098), SPH_C32(0x431d4000), SPH_C32(0x795a0000), + SPH_C32(0xfaf30000), SPH_C32(0x257d15e7), SPH_C32(0x72978c49), + SPH_C32(0x461f24e2), SPH_C32(0x0e7bd601), SPH_C32(0x2c490144), + SPH_C32(0xcf9a8000), SPH_C32(0xc8e80000), SPH_C32(0xd85c0000), + SPH_C32(0xc3ba1edc), SPH_C32(0xdc669e4e), SPH_C32(0xb0f4c065), + SPH_C32(0x94354404) }, + { SPH_C32(0x64f9009d), SPH_C32(0x775e8000), SPH_C32(0x5d5d0000), + SPH_C32(0x75ce0000), SPH_C32(0x044a2e1c), SPH_C32(0x782f59e7), + SPH_C32(0x8bdaaffb), SPH_C32(0xd9ee6c30), SPH_C32(0x8a360145), + SPH_C32(0xbead0000), SPH_C32(0xd1140000), SPH_C32(0x4e870000), + SPH_C32(0xf9317321), SPH_C32(0x37ac30bd), SPH_C32(0x9c9987ea), + SPH_C32(0x38bb288c) }, + { SPH_C32(0x17190090), SPH_C32(0x70dec000), SPH_C32(0x06df0000), + SPH_C32(0x22930000), SPH_C32(0xe12d23c9), SPH_C32(0xa801926c), + SPH_C32(0x88c30427), SPH_C32(0xcba5e1b3), SPH_C32(0x8bc30149), + SPH_C32(0x45d20000), SPH_C32(0x36c50000), SPH_C32(0xc5280000), + SPH_C32(0xda935173), SPH_C32(0xc5fcd3a9), SPH_C32(0x2bdbfdbd), + SPH_C32(0x71380aa7) }, + { SPH_C32(0xe1990095), SPH_C32(0x449d0000), SPH_C32(0x22d80000), + SPH_C32(0xadae0000), SPH_C32(0xc01a1832), SPH_C32(0xa2b947c2), + SPH_C32(0x45068f3e), SPH_C32(0x1c305b82), SPH_C32(0x2dbc0148), + SPH_C32(0x34e58000), SPH_C32(0x2f390000), SPH_C32(0x53f30000), + SPH_C32(0xe0183c8e), SPH_C32(0x2e367d5a), SPH_C32(0x07b6ba32), + SPH_C32(0xddb6662f) }, + { SPH_C32(0xb1660091), SPH_C32(0x01e94000), SPH_C32(0x1f230000), + SPH_C32(0xb4480000), SPH_C32(0xdba64e34), SPH_C32(0x43cb3c9f), + SPH_C32(0xa4ae43a8), SPH_C32(0x672b8d3b), SPH_C32(0xdb3c014d), + SPH_C32(0x00a64000), SPH_C32(0x0b3e0000), SPH_C32(0xdcce0000), + SPH_C32(0xc12f0775), SPH_C32(0x248ea8f4), SPH_C32(0xca73312b), + SPH_C32(0x0a23dc1e) }, + { SPH_C32(0x47e60094), SPH_C32(0x35aa8000), SPH_C32(0x3b240000), + SPH_C32(0x3b750000), SPH_C32(0xfa9175cf), SPH_C32(0x4973e931), + SPH_C32(0x696bc8b1), SPH_C32(0xb0be370a), SPH_C32(0x7d43014c), + SPH_C32(0x7191c000), SPH_C32(0x12c20000), SPH_C32(0x4a150000), + SPH_C32(0xfba46a88), SPH_C32(0xcf440607), SPH_C32(0xe61e76a4), + SPH_C32(0xa6adb096) }, + { SPH_C32(0xe06c0099), SPH_C32(0xbfe20000), SPH_C32(0xc5090000), + SPH_C32(0x26010000), SPH_C32(0xe3b83a60), SPH_C32(0x50e9a4d6), + SPH_C32(0xf244f569), SPH_C32(0x55b379a9), SPH_C32(0x5fa90149), + SPH_C32(0xc81ac000), SPH_C32(0x936a0000), SPH_C32(0x8f010000), + SPH_C32(0x26dd1309), SPH_C32(0x0c4855c5), SPH_C32(0xb3ed6bb9), + SPH_C32(0x867ec987) }, + { SPH_C32(0x16ec009c), SPH_C32(0x8ba1c000), SPH_C32(0xe10e0000), + SPH_C32(0xa93c0000), SPH_C32(0xc28f019b), SPH_C32(0x5a517178), + SPH_C32(0x3f817e70), SPH_C32(0x8226c398), SPH_C32(0xf9d60148), + SPH_C32(0xb92d4000), SPH_C32(0x8a960000), SPH_C32(0x19da0000), + SPH_C32(0x1c567ef4), SPH_C32(0xe782fb36), SPH_C32(0x9f802c36), + SPH_C32(0x2af0a50f) }, + { SPH_C32(0x46130098), SPH_C32(0xced58000), SPH_C32(0xdcf50000), + SPH_C32(0xb0da0000), SPH_C32(0xd933579d), SPH_C32(0xbb230a25), + SPH_C32(0xde29b2e6), SPH_C32(0xf93d1521), SPH_C32(0x0f56014d), + SPH_C32(0x8d6e8000), SPH_C32(0xae910000), SPH_C32(0x96e70000), + SPH_C32(0x3d61450f), SPH_C32(0xed3a2e98), SPH_C32(0x5245a72f), + SPH_C32(0xfd651f3e) }, + { SPH_C32(0xb093009d), SPH_C32(0xfa964000), SPH_C32(0xf8f20000), + SPH_C32(0x3fe70000), SPH_C32(0xf8046c66), SPH_C32(0xb19bdf8b), + SPH_C32(0x13ec39ff), SPH_C32(0x2ea8af10), SPH_C32(0xa929014c), + SPH_C32(0xfc590000), SPH_C32(0xb76d0000), SPH_C32(0x003c0000), + SPH_C32(0x07ea28f2), SPH_C32(0x06f0806b), SPH_C32(0x7e28e0a0), + SPH_C32(0x51eb73b6) }, + { SPH_C32(0x405b0030), SPH_C32(0x9a540000), SPH_C32(0x42670000), + SPH_C32(0x5fb10000), SPH_C32(0xd6c06187), SPH_C32(0x5d81863c), + SPH_C32(0x87922fef), SPH_C32(0x79e0422c), SPH_C32(0xdf9801b0), + SPH_C32(0xf67c0000), SPH_C32(0xa50e0000), SPH_C32(0xbf870000), + SPH_C32(0xad7f742c), SPH_C32(0xae2b8f5a), SPH_C32(0xc2a957e9), + SPH_C32(0xd75f2456) }, + { SPH_C32(0xb6db0035), SPH_C32(0xae17c000), SPH_C32(0x66600000), + SPH_C32(0xd08c0000), SPH_C32(0xf7f75a7c), SPH_C32(0x57395392), + SPH_C32(0x4a57a4f6), SPH_C32(0xae75f81d), SPH_C32(0x79e701b1), + SPH_C32(0x874b8000), SPH_C32(0xbcf20000), SPH_C32(0x295c0000), + SPH_C32(0x97f419d1), SPH_C32(0x45e121a9), SPH_C32(0xeec41066), + SPH_C32(0x7bd148de) }, + { SPH_C32(0xe6240031), SPH_C32(0xeb638000), SPH_C32(0x5b9b0000), + SPH_C32(0xc96a0000), SPH_C32(0xec4b0c7a), SPH_C32(0xb64b28cf), + SPH_C32(0xabff6860), SPH_C32(0xd56e2ea4), SPH_C32(0x8f6701b4), + SPH_C32(0xb3084000), SPH_C32(0x98f50000), SPH_C32(0xa6610000), + SPH_C32(0xb6c3222a), SPH_C32(0x4f59f407), SPH_C32(0x23019b7f), + SPH_C32(0xac44f2ef) }, + { SPH_C32(0x10a40034), SPH_C32(0xdf204000), SPH_C32(0x7f9c0000), + SPH_C32(0x46570000), SPH_C32(0xcd7c3781), SPH_C32(0xbcf3fd61), + SPH_C32(0x663ae379), SPH_C32(0x02fb9495), SPH_C32(0x291801b5), + SPH_C32(0xc23fc000), SPH_C32(0x81090000), SPH_C32(0x30ba0000), + SPH_C32(0x8c484fd7), SPH_C32(0xa4935af4), SPH_C32(0x0f6cdcf0), + SPH_C32(0x00ca9e67) }, + { SPH_C32(0xb72e0039), SPH_C32(0x5568c000), SPH_C32(0x81b10000), + SPH_C32(0x5b230000), SPH_C32(0xd455782e), SPH_C32(0xa569b086), + SPH_C32(0xfd15dea1), SPH_C32(0xe7f6da36), SPH_C32(0x0bf201b0), + SPH_C32(0x7bb4c000), SPH_C32(0x00a10000), SPH_C32(0xf5ae0000), + SPH_C32(0x51313656), SPH_C32(0x679f0936), SPH_C32(0x5a9fc1ed), + SPH_C32(0x2019e776) }, + { SPH_C32(0x41ae003c), SPH_C32(0x612b0000), SPH_C32(0xa5b60000), + SPH_C32(0xd41e0000), SPH_C32(0xf56243d5), SPH_C32(0xafd16528), + SPH_C32(0x30d055b8), SPH_C32(0x30636007), SPH_C32(0xad8d01b1), + SPH_C32(0x0a834000), SPH_C32(0x195d0000), SPH_C32(0x63750000), + SPH_C32(0x6bba5bab), SPH_C32(0x8c55a7c5), SPH_C32(0x76f28662), + SPH_C32(0x8c978bfe) }, + { SPH_C32(0x11510038), SPH_C32(0x245f4000), SPH_C32(0x984d0000), + SPH_C32(0xcdf80000), SPH_C32(0xeede15d3), SPH_C32(0x4ea31e75), + SPH_C32(0xd178992e), SPH_C32(0x4b78b6be), SPH_C32(0x5b0d01b4), + SPH_C32(0x3ec08000), SPH_C32(0x3d5a0000), SPH_C32(0xec480000), + SPH_C32(0x4a8d6050), SPH_C32(0x86ed726b), SPH_C32(0xbb370d7b), + SPH_C32(0x5b0231cf) }, + { SPH_C32(0xe7d1003d), SPH_C32(0x101c8000), SPH_C32(0xbc4a0000), + SPH_C32(0x42c50000), SPH_C32(0xcfe92e28), SPH_C32(0x441bcbdb), + SPH_C32(0x1cbd1237), SPH_C32(0x9ced0c8f), SPH_C32(0xfd7201b5), + SPH_C32(0x4ff70000), SPH_C32(0x24a60000), SPH_C32(0x7a930000), + SPH_C32(0x70060dad), SPH_C32(0x6d27dc98), SPH_C32(0x975a4af4), + SPH_C32(0xf78c5d47) }, + { SPH_C32(0x94310030), SPH_C32(0x179cc000), SPH_C32(0xe7c80000), + SPH_C32(0x15980000), SPH_C32(0x2a8e23fd), SPH_C32(0x94350050), + SPH_C32(0x1fa4b9eb), SPH_C32(0x8ea6810c), SPH_C32(0xfc8701b9), + SPH_C32(0xb4880000), SPH_C32(0xc3770000), SPH_C32(0xf13c0000), + SPH_C32(0x53a42fff), SPH_C32(0x9f773f8c), SPH_C32(0x201830a3), + SPH_C32(0xbe0f7f6c) }, + { SPH_C32(0x62b10035), SPH_C32(0x23df0000), SPH_C32(0xc3cf0000), + SPH_C32(0x9aa50000), SPH_C32(0x0bb91806), SPH_C32(0x9e8dd5fe), + SPH_C32(0xd26132f2), SPH_C32(0x59333b3d), SPH_C32(0x5af801b8), + SPH_C32(0xc5bf8000), SPH_C32(0xda8b0000), SPH_C32(0x67e70000), + SPH_C32(0x692f4202), SPH_C32(0x74bd917f), SPH_C32(0x0c75772c), + SPH_C32(0x128113e4) }, + { SPH_C32(0x324e0031), SPH_C32(0x66ab4000), SPH_C32(0xfe340000), + SPH_C32(0x83430000), SPH_C32(0x10054e00), SPH_C32(0x7fffaea3), + SPH_C32(0x33c9fe64), SPH_C32(0x2228ed84), SPH_C32(0xac7801bd), + SPH_C32(0xf1fc4000), SPH_C32(0xfe8c0000), SPH_C32(0xe8da0000), + SPH_C32(0x481879f9), SPH_C32(0x7e0544d1), SPH_C32(0xc1b0fc35), + SPH_C32(0xc514a9d5) }, + { SPH_C32(0xc4ce0034), SPH_C32(0x52e88000), SPH_C32(0xda330000), + SPH_C32(0x0c7e0000), SPH_C32(0x313275fb), SPH_C32(0x75477b0d), + SPH_C32(0xfe0c757d), SPH_C32(0xf5bd57b5), SPH_C32(0x0a0701bc), + SPH_C32(0x80cbc000), SPH_C32(0xe7700000), SPH_C32(0x7e010000), + SPH_C32(0x72931404), SPH_C32(0x95cfea22), SPH_C32(0xedddbbba), + SPH_C32(0x699ac55d) }, + { SPH_C32(0x63440039), SPH_C32(0xd8a00000), SPH_C32(0x241e0000), + SPH_C32(0x110a0000), SPH_C32(0x281b3a54), SPH_C32(0x6cdd36ea), + SPH_C32(0x652348a5), SPH_C32(0x10b01916), SPH_C32(0x28ed01b9), + SPH_C32(0x3940c000), SPH_C32(0x66d80000), SPH_C32(0xbb150000), + SPH_C32(0xafea6d85), SPH_C32(0x56c3b9e0), SPH_C32(0xb82ea6a7), + SPH_C32(0x4949bc4c) }, + { SPH_C32(0x95c4003c), SPH_C32(0xece3c000), SPH_C32(0x00190000), + SPH_C32(0x9e370000), SPH_C32(0x092c01af), SPH_C32(0x6665e344), + SPH_C32(0xa8e6c3bc), SPH_C32(0xc725a327), SPH_C32(0x8e9201b8), + SPH_C32(0x48774000), SPH_C32(0x7f240000), SPH_C32(0x2dce0000), + SPH_C32(0x95610078), SPH_C32(0xbd091713), SPH_C32(0x9443e128), + SPH_C32(0xe5c7d0c4) }, + { SPH_C32(0xc53b0038), SPH_C32(0xa9978000), SPH_C32(0x3de20000), + SPH_C32(0x87d10000), SPH_C32(0x129057a9), SPH_C32(0x87179819), + SPH_C32(0x494e0f2a), SPH_C32(0xbc3e759e), SPH_C32(0x781201bd), + SPH_C32(0x7c348000), SPH_C32(0x5b230000), SPH_C32(0xa2f30000), + SPH_C32(0xb4563b83), SPH_C32(0xb7b1c2bd), SPH_C32(0x59866a31), + SPH_C32(0x32526af5) }, + { SPH_C32(0x33bb003d), SPH_C32(0x9dd44000), SPH_C32(0x19e50000), + SPH_C32(0x08ec0000), SPH_C32(0x33a76c52), SPH_C32(0x8daf4db7), + SPH_C32(0x848b8433), SPH_C32(0x6babcfaf), SPH_C32(0xde6d01bc), + SPH_C32(0x0d030000), SPH_C32(0x42df0000), SPH_C32(0x34280000), + SPH_C32(0x8edd567e), SPH_C32(0x5c7b6c4e), SPH_C32(0x75eb2dbe), + SPH_C32(0x9edc067d) }, + { SPH_C32(0x371f00c0), SPH_C32(0x6b0e0000), SPH_C32(0xb7d50000), + SPH_C32(0x6ba50000), SPH_C32(0x5ff71f0b), SPH_C32(0x070a6a19), + SPH_C32(0x8c51e2f1), SPH_C32(0xb6d737e7), SPH_C32(0x2bf401e0), + SPH_C32(0x60640000), SPH_C32(0xb1ab0000), SPH_C32(0xbc980000), + SPH_C32(0xefeb0a94), SPH_C32(0xc894f143), SPH_C32(0x5e0d273b), + SPH_C32(0x5d6b3122) }, + { SPH_C32(0xc19f00c5), SPH_C32(0x5f4dc000), SPH_C32(0x93d20000), + SPH_C32(0xe4980000), SPH_C32(0x7ec024f0), SPH_C32(0x0db2bfb7), + SPH_C32(0x419469e8), SPH_C32(0x61428dd6), SPH_C32(0x8d8b01e1), + SPH_C32(0x11538000), SPH_C32(0xa8570000), SPH_C32(0x2a430000), + SPH_C32(0xd5606769), SPH_C32(0x235e5fb0), SPH_C32(0x726060b4), + SPH_C32(0xf1e55daa) }, + { SPH_C32(0x916000c1), SPH_C32(0x1a398000), SPH_C32(0xae290000), + SPH_C32(0xfd7e0000), SPH_C32(0x657c72f6), SPH_C32(0xecc0c4ea), + SPH_C32(0xa03ca57e), SPH_C32(0x1a595b6f), SPH_C32(0x7b0b01e4), + SPH_C32(0x25104000), SPH_C32(0x8c500000), SPH_C32(0xa57e0000), + SPH_C32(0xf4575c92), SPH_C32(0x29e68a1e), SPH_C32(0xbfa5ebad), + SPH_C32(0x2670e79b) }, + { SPH_C32(0x67e000c4), SPH_C32(0x2e7a4000), SPH_C32(0x8a2e0000), + SPH_C32(0x72430000), SPH_C32(0x444b490d), SPH_C32(0xe6781144), + SPH_C32(0x6df92e67), SPH_C32(0xcdcce15e), SPH_C32(0xdd7401e5), + SPH_C32(0x5427c000), SPH_C32(0x95ac0000), SPH_C32(0x33a50000), + SPH_C32(0xcedc316f), SPH_C32(0xc22c24ed), SPH_C32(0x93c8ac22), + SPH_C32(0x8afe8b13) }, + { SPH_C32(0xc06a00c9), SPH_C32(0xa432c000), SPH_C32(0x74030000), + SPH_C32(0x6f370000), SPH_C32(0x5d6206a2), SPH_C32(0xffe25ca3), + SPH_C32(0xf6d613bf), SPH_C32(0x28c1affd), SPH_C32(0xff9e01e0), + SPH_C32(0xedacc000), SPH_C32(0x14040000), SPH_C32(0xf6b10000), + SPH_C32(0x13a548ee), SPH_C32(0x0120772f), SPH_C32(0xc63bb13f), + SPH_C32(0xaa2df202) }, + { SPH_C32(0x36ea00cc), SPH_C32(0x90710000), SPH_C32(0x50040000), + SPH_C32(0xe00a0000), SPH_C32(0x7c553d59), SPH_C32(0xf55a890d), + SPH_C32(0x3b1398a6), SPH_C32(0xff5415cc), SPH_C32(0x59e101e1), + SPH_C32(0x9c9b4000), SPH_C32(0x0df80000), SPH_C32(0x606a0000), + SPH_C32(0x292e2513), SPH_C32(0xeaead9dc), SPH_C32(0xea56f6b0), + SPH_C32(0x06a39e8a) }, + { SPH_C32(0x661500c8), SPH_C32(0xd5054000), SPH_C32(0x6dff0000), + SPH_C32(0xf9ec0000), SPH_C32(0x67e96b5f), SPH_C32(0x1428f250), + SPH_C32(0xdabb5430), SPH_C32(0x844fc375), SPH_C32(0xaf6101e4), + SPH_C32(0xa8d88000), SPH_C32(0x29ff0000), SPH_C32(0xef570000), + SPH_C32(0x08191ee8), SPH_C32(0xe0520c72), SPH_C32(0x27937da9), + SPH_C32(0xd13624bb) }, + { SPH_C32(0x909500cd), SPH_C32(0xe1468000), SPH_C32(0x49f80000), + SPH_C32(0x76d10000), SPH_C32(0x46de50a4), SPH_C32(0x1e9027fe), + SPH_C32(0x177edf29), SPH_C32(0x53da7944), SPH_C32(0x091e01e5), + SPH_C32(0xd9ef0000), SPH_C32(0x30030000), SPH_C32(0x798c0000), + SPH_C32(0x32927315), SPH_C32(0x0b98a281), SPH_C32(0x0bfe3a26), + SPH_C32(0x7db84833) }, + { SPH_C32(0xe37500c0), SPH_C32(0xe6c6c000), SPH_C32(0x127a0000), + SPH_C32(0x218c0000), SPH_C32(0xa3b95d71), SPH_C32(0xcebeec75), + SPH_C32(0x146774f5), SPH_C32(0x4191f4c7), SPH_C32(0x08eb01e9), + SPH_C32(0x22900000), SPH_C32(0xd7d20000), SPH_C32(0xf2230000), + SPH_C32(0x11305147), SPH_C32(0xf9c84195), SPH_C32(0xbcbc4071), + SPH_C32(0x343b6a18) }, + { SPH_C32(0x15f500c5), SPH_C32(0xd2850000), SPH_C32(0x367d0000), + SPH_C32(0xaeb10000), SPH_C32(0x828e668a), SPH_C32(0xc40639db), + SPH_C32(0xd9a2ffec), SPH_C32(0x96044ef6), SPH_C32(0xae9401e8), + SPH_C32(0x53a78000), SPH_C32(0xce2e0000), SPH_C32(0x64f80000), + SPH_C32(0x2bbb3cba), SPH_C32(0x1202ef66), SPH_C32(0x90d107fe), + SPH_C32(0x98b50690) }, + { SPH_C32(0x450a00c1), SPH_C32(0x97f14000), SPH_C32(0x0b860000), + SPH_C32(0xb7570000), SPH_C32(0x9932308c), SPH_C32(0x25744286), + SPH_C32(0x380a337a), SPH_C32(0xed1f984f), SPH_C32(0x581401ed), + SPH_C32(0x67e44000), SPH_C32(0xea290000), SPH_C32(0xebc50000), + SPH_C32(0x0a8c0741), SPH_C32(0x18ba3ac8), SPH_C32(0x5d148ce7), + SPH_C32(0x4f20bca1) }, + { SPH_C32(0xb38a00c4), SPH_C32(0xa3b28000), SPH_C32(0x2f810000), + SPH_C32(0x386a0000), SPH_C32(0xb8050b77), SPH_C32(0x2fcc9728), + SPH_C32(0xf5cfb863), SPH_C32(0x3a8a227e), SPH_C32(0xfe6b01ec), + SPH_C32(0x16d3c000), SPH_C32(0xf3d50000), SPH_C32(0x7d1e0000), + SPH_C32(0x30076abc), SPH_C32(0xf370943b), SPH_C32(0x7179cb68), + SPH_C32(0xe3aed029) }, + { SPH_C32(0x140000c9), SPH_C32(0x29fa0000), SPH_C32(0xd1ac0000), + SPH_C32(0x251e0000), SPH_C32(0xa12c44d8), SPH_C32(0x3656dacf), + SPH_C32(0x6ee085bb), SPH_C32(0xdf876cdd), SPH_C32(0xdc8101e9), + SPH_C32(0xaf58c000), SPH_C32(0x727d0000), SPH_C32(0xb80a0000), + SPH_C32(0xed7e133d), SPH_C32(0x307cc7f9), SPH_C32(0x248ad675), + SPH_C32(0xc37da938) }, + { SPH_C32(0xe28000cc), SPH_C32(0x1db9c000), SPH_C32(0xf5ab0000), + SPH_C32(0xaa230000), SPH_C32(0x801b7f23), SPH_C32(0x3cee0f61), + SPH_C32(0xa3250ea2), SPH_C32(0x0812d6ec), SPH_C32(0x7afe01e8), + SPH_C32(0xde6f4000), SPH_C32(0x6b810000), SPH_C32(0x2ed10000), + SPH_C32(0xd7f57ec0), SPH_C32(0xdbb6690a), SPH_C32(0x08e791fa), + SPH_C32(0x6ff3c5b0) }, + { SPH_C32(0xb27f00c8), SPH_C32(0x58cd8000), SPH_C32(0xc8500000), + SPH_C32(0xb3c50000), SPH_C32(0x9ba72925), SPH_C32(0xdd9c743c), + SPH_C32(0x428dc234), SPH_C32(0x73090055), SPH_C32(0x8c7e01ed), + SPH_C32(0xea2c8000), SPH_C32(0x4f860000), SPH_C32(0xa1ec0000), + SPH_C32(0xf6c2453b), SPH_C32(0xd10ebca4), SPH_C32(0xc5221ae3), + SPH_C32(0xb8667f81) }, + { SPH_C32(0x44ff00cd), SPH_C32(0x6c8e4000), SPH_C32(0xec570000), + SPH_C32(0x3cf80000), SPH_C32(0xba9012de), SPH_C32(0xd724a192), + SPH_C32(0x8f48492d), SPH_C32(0xa49cba64), SPH_C32(0x2a0101ec), + SPH_C32(0x9b1b0000), SPH_C32(0x567a0000), SPH_C32(0x37370000), + SPH_C32(0xcc4928c6), SPH_C32(0x3ac41257), SPH_C32(0xe94f5d6c), + SPH_C32(0x14e81309) }, + { SPH_C32(0x5cb00110), SPH_C32(0x913e0000), SPH_C32(0x44190000), + SPH_C32(0x888c0000), SPH_C32(0x66dc7418), SPH_C32(0x921f1d66), + SPH_C32(0x55ceea25), SPH_C32(0x925c44e9), SPH_C32(0xe8870170), + SPH_C32(0x9d720000), SPH_C32(0x12db0000), SPH_C32(0xd4220000), + SPH_C32(0xf2886b27), SPH_C32(0xa921e543), SPH_C32(0x4ef8b518), + SPH_C32(0x618813b1) }, + { SPH_C32(0xaa300115), SPH_C32(0xa57dc000), SPH_C32(0x601e0000), + SPH_C32(0x07b10000), SPH_C32(0x47eb4fe3), SPH_C32(0x98a7c8c8), + SPH_C32(0x980b613c), SPH_C32(0x45c9fed8), SPH_C32(0x4ef80171), + SPH_C32(0xec458000), SPH_C32(0x0b270000), SPH_C32(0x42f90000), + SPH_C32(0xc80306da), SPH_C32(0x42eb4bb0), SPH_C32(0x6295f297), + SPH_C32(0xcd067f39) }, + { SPH_C32(0xfacf0111), SPH_C32(0xe0098000), SPH_C32(0x5de50000), + SPH_C32(0x1e570000), SPH_C32(0x5c5719e5), SPH_C32(0x79d5b395), + SPH_C32(0x79a3adaa), SPH_C32(0x3ed22861), SPH_C32(0xb8780174), + SPH_C32(0xd8064000), SPH_C32(0x2f200000), SPH_C32(0xcdc40000), + SPH_C32(0xe9343d21), SPH_C32(0x48539e1e), SPH_C32(0xaf50798e), + SPH_C32(0x1a93c508) }, + { SPH_C32(0x0c4f0114), SPH_C32(0xd44a4000), SPH_C32(0x79e20000), + SPH_C32(0x916a0000), SPH_C32(0x7d60221e), SPH_C32(0x736d663b), + SPH_C32(0xb46626b3), SPH_C32(0xe9479250), SPH_C32(0x1e070175), + SPH_C32(0xa931c000), SPH_C32(0x36dc0000), SPH_C32(0x5b1f0000), + SPH_C32(0xd3bf50dc), SPH_C32(0xa39930ed), SPH_C32(0x833d3e01), + SPH_C32(0xb61da980) }, + { SPH_C32(0xabc50119), SPH_C32(0x5e02c000), SPH_C32(0x87cf0000), + SPH_C32(0x8c1e0000), SPH_C32(0x64496db1), SPH_C32(0x6af72bdc), + SPH_C32(0x2f491b6b), SPH_C32(0x0c4adcf3), SPH_C32(0x3ced0170), + SPH_C32(0x10bac000), SPH_C32(0xb7740000), SPH_C32(0x9e0b0000), + SPH_C32(0x0ec6295d), SPH_C32(0x6095632f), SPH_C32(0xd6ce231c), + SPH_C32(0x96ced091) }, + { SPH_C32(0x5d45011c), SPH_C32(0x6a410000), SPH_C32(0xa3c80000), + SPH_C32(0x03230000), SPH_C32(0x457e564a), SPH_C32(0x604ffe72), + SPH_C32(0xe28c9072), SPH_C32(0xdbdf66c2), SPH_C32(0x9a920171), + SPH_C32(0x618d4000), SPH_C32(0xae880000), SPH_C32(0x08d00000), + SPH_C32(0x344d44a0), SPH_C32(0x8b5fcddc), SPH_C32(0xfaa36493), + SPH_C32(0x3a40bc19) }, + { SPH_C32(0x0dba0118), SPH_C32(0x2f354000), SPH_C32(0x9e330000), + SPH_C32(0x1ac50000), SPH_C32(0x5ec2004c), SPH_C32(0x813d852f), + SPH_C32(0x03245ce4), SPH_C32(0xa0c4b07b), SPH_C32(0x6c120174), + SPH_C32(0x55ce8000), SPH_C32(0x8a8f0000), SPH_C32(0x87ed0000), + SPH_C32(0x157a7f5b), SPH_C32(0x81e71872), SPH_C32(0x3766ef8a), + SPH_C32(0xedd50628) }, + { SPH_C32(0xfb3a011d), SPH_C32(0x1b768000), SPH_C32(0xba340000), + SPH_C32(0x95f80000), SPH_C32(0x7ff53bb7), SPH_C32(0x8b855081), + SPH_C32(0xcee1d7fd), SPH_C32(0x77510a4a), SPH_C32(0xca6d0175), + SPH_C32(0x24f90000), SPH_C32(0x93730000), SPH_C32(0x11360000), + SPH_C32(0x2ff112a6), SPH_C32(0x6a2db681), SPH_C32(0x1b0ba805), + SPH_C32(0x415b6aa0) }, + { SPH_C32(0x88da0110), SPH_C32(0x1cf6c000), SPH_C32(0xe1b60000), + SPH_C32(0xc2a50000), SPH_C32(0x9a923662), SPH_C32(0x5bab9b0a), + SPH_C32(0xcdf87c21), SPH_C32(0x651a87c9), SPH_C32(0xcb980179), + SPH_C32(0xdf860000), SPH_C32(0x74a20000), SPH_C32(0x9a990000), + SPH_C32(0x0c5330f4), SPH_C32(0x987d5595), SPH_C32(0xac49d252), + SPH_C32(0x08d8488b) }, + { SPH_C32(0x7e5a0115), SPH_C32(0x28b50000), SPH_C32(0xc5b10000), + SPH_C32(0x4d980000), SPH_C32(0xbba50d99), SPH_C32(0x51134ea4), + SPH_C32(0x003df738), SPH_C32(0xb28f3df8), SPH_C32(0x6de70178), + SPH_C32(0xaeb18000), SPH_C32(0x6d5e0000), SPH_C32(0x0c420000), + SPH_C32(0x36d85d09), SPH_C32(0x73b7fb66), SPH_C32(0x802495dd), + SPH_C32(0xa4562403) }, + { SPH_C32(0x2ea50111), SPH_C32(0x6dc14000), SPH_C32(0xf84a0000), + SPH_C32(0x547e0000), SPH_C32(0xa0195b9f), SPH_C32(0xb06135f9), + SPH_C32(0xe1953bae), SPH_C32(0xc994eb41), SPH_C32(0x9b67017d), + SPH_C32(0x9af24000), SPH_C32(0x49590000), SPH_C32(0x837f0000), + SPH_C32(0x17ef66f2), SPH_C32(0x790f2ec8), SPH_C32(0x4de11ec4), + SPH_C32(0x73c39e32) }, + { SPH_C32(0xd8250114), SPH_C32(0x59828000), SPH_C32(0xdc4d0000), + SPH_C32(0xdb430000), SPH_C32(0x812e6064), SPH_C32(0xbad9e057), + SPH_C32(0x2c50b0b7), SPH_C32(0x1e015170), SPH_C32(0x3d18017c), + SPH_C32(0xebc5c000), SPH_C32(0x50a50000), SPH_C32(0x15a40000), + SPH_C32(0x2d640b0f), SPH_C32(0x92c5803b), SPH_C32(0x618c594b), + SPH_C32(0xdf4df2ba) }, + { SPH_C32(0x7faf0119), SPH_C32(0xd3ca0000), SPH_C32(0x22600000), + SPH_C32(0xc6370000), SPH_C32(0x98072fcb), SPH_C32(0xa343adb0), + SPH_C32(0xb77f8d6f), SPH_C32(0xfb0c1fd3), SPH_C32(0x1ff20179), + SPH_C32(0x524ec000), SPH_C32(0xd10d0000), SPH_C32(0xd0b00000), + SPH_C32(0xf01d728e), SPH_C32(0x51c9d3f9), SPH_C32(0x347f4456), + SPH_C32(0xff9e8bab) }, + { SPH_C32(0x892f011c), SPH_C32(0xe789c000), SPH_C32(0x06670000), + SPH_C32(0x490a0000), SPH_C32(0xb9301430), SPH_C32(0xa9fb781e), + SPH_C32(0x7aba0676), SPH_C32(0x2c99a5e2), SPH_C32(0xb98d0178), + SPH_C32(0x23794000), SPH_C32(0xc8f10000), SPH_C32(0x466b0000), + SPH_C32(0xca961f73), SPH_C32(0xba037d0a), SPH_C32(0x181203d9), + SPH_C32(0x5310e723) }, + { SPH_C32(0xd9d00118), SPH_C32(0xa2fd8000), SPH_C32(0x3b9c0000), + SPH_C32(0x50ec0000), SPH_C32(0xa28c4236), SPH_C32(0x48890343), + SPH_C32(0x9b12cae0), SPH_C32(0x5782735b), SPH_C32(0x4f0d017d), + SPH_C32(0x173a8000), SPH_C32(0xecf60000), SPH_C32(0xc9560000), + SPH_C32(0xeba12488), SPH_C32(0xb0bba8a4), SPH_C32(0xd5d788c0), + SPH_C32(0x84855d12) }, + { SPH_C32(0x2f50011d), SPH_C32(0x96be4000), SPH_C32(0x1f9b0000), + SPH_C32(0xdfd10000), SPH_C32(0x83bb79cd), SPH_C32(0x4231d6ed), + SPH_C32(0x56d741f9), SPH_C32(0x8017c96a), SPH_C32(0xe972017c), + SPH_C32(0x660d0000), SPH_C32(0xf50a0000), SPH_C32(0x5f8d0000), + SPH_C32(0xd12a4975), SPH_C32(0x5b710657), SPH_C32(0xf9bacf4f), + SPH_C32(0x280b319a) }, + { SPH_C32(0x2bf401e0), SPH_C32(0x60640000), SPH_C32(0xb1ab0000), + SPH_C32(0xbc980000), SPH_C32(0xefeb0a94), SPH_C32(0xc894f143), + SPH_C32(0x5e0d273b), SPH_C32(0x5d6b3122), SPH_C32(0x1ceb0120), + SPH_C32(0x0b6a0000), SPH_C32(0x067e0000), SPH_C32(0xd73d0000), + SPH_C32(0xb01c159f), SPH_C32(0xcf9e9b5a), SPH_C32(0xd25cc5ca), + SPH_C32(0xebbc06c5) }, + { SPH_C32(0xdd7401e5), SPH_C32(0x5427c000), SPH_C32(0x95ac0000), + SPH_C32(0x33a50000), SPH_C32(0xcedc316f), SPH_C32(0xc22c24ed), + SPH_C32(0x93c8ac22), SPH_C32(0x8afe8b13), SPH_C32(0xba940121), + SPH_C32(0x7a5d8000), SPH_C32(0x1f820000), SPH_C32(0x41e60000), + SPH_C32(0x8a977862), SPH_C32(0x245435a9), SPH_C32(0xfe318245), + SPH_C32(0x47326a4d) }, + { SPH_C32(0x8d8b01e1), SPH_C32(0x11538000), SPH_C32(0xa8570000), + SPH_C32(0x2a430000), SPH_C32(0xd5606769), SPH_C32(0x235e5fb0), + SPH_C32(0x726060b4), SPH_C32(0xf1e55daa), SPH_C32(0x4c140124), + SPH_C32(0x4e1e4000), SPH_C32(0x3b850000), SPH_C32(0xcedb0000), + SPH_C32(0xaba04399), SPH_C32(0x2eece007), SPH_C32(0x33f4095c), + SPH_C32(0x90a7d07c) }, + { SPH_C32(0x7b0b01e4), SPH_C32(0x25104000), SPH_C32(0x8c500000), + SPH_C32(0xa57e0000), SPH_C32(0xf4575c92), SPH_C32(0x29e68a1e), + SPH_C32(0xbfa5ebad), SPH_C32(0x2670e79b), SPH_C32(0xea6b0125), + SPH_C32(0x3f29c000), SPH_C32(0x22790000), SPH_C32(0x58000000), + SPH_C32(0x912b2e64), SPH_C32(0xc5264ef4), SPH_C32(0x1f994ed3), + SPH_C32(0x3c29bcf4) }, + { SPH_C32(0xdc8101e9), SPH_C32(0xaf58c000), SPH_C32(0x727d0000), + SPH_C32(0xb80a0000), SPH_C32(0xed7e133d), SPH_C32(0x307cc7f9), + SPH_C32(0x248ad675), SPH_C32(0xc37da938), SPH_C32(0xc8810120), + SPH_C32(0x86a2c000), SPH_C32(0xa3d10000), SPH_C32(0x9d140000), + SPH_C32(0x4c5257e5), SPH_C32(0x062a1d36), SPH_C32(0x4a6a53ce), + SPH_C32(0x1cfac5e5) }, + { SPH_C32(0x2a0101ec), SPH_C32(0x9b1b0000), SPH_C32(0x567a0000), + SPH_C32(0x37370000), SPH_C32(0xcc4928c6), SPH_C32(0x3ac41257), + SPH_C32(0xe94f5d6c), SPH_C32(0x14e81309), SPH_C32(0x6efe0121), + SPH_C32(0xf7954000), SPH_C32(0xba2d0000), SPH_C32(0x0bcf0000), + SPH_C32(0x76d93a18), SPH_C32(0xede0b3c5), SPH_C32(0x66071441), + SPH_C32(0xb074a96d) }, + { SPH_C32(0x7afe01e8), SPH_C32(0xde6f4000), SPH_C32(0x6b810000), + SPH_C32(0x2ed10000), SPH_C32(0xd7f57ec0), SPH_C32(0xdbb6690a), + SPH_C32(0x08e791fa), SPH_C32(0x6ff3c5b0), SPH_C32(0x987e0124), + SPH_C32(0xc3d68000), SPH_C32(0x9e2a0000), SPH_C32(0x84f20000), + SPH_C32(0x57ee01e3), SPH_C32(0xe758666b), SPH_C32(0xabc29f58), + SPH_C32(0x67e1135c) }, + { SPH_C32(0x8c7e01ed), SPH_C32(0xea2c8000), SPH_C32(0x4f860000), + SPH_C32(0xa1ec0000), SPH_C32(0xf6c2453b), SPH_C32(0xd10ebca4), + SPH_C32(0xc5221ae3), SPH_C32(0xb8667f81), SPH_C32(0x3e010125), + SPH_C32(0xb2e10000), SPH_C32(0x87d60000), SPH_C32(0x12290000), + SPH_C32(0x6d656c1e), SPH_C32(0x0c92c898), SPH_C32(0x87afd8d7), + SPH_C32(0xcb6f7fd4) }, + { SPH_C32(0xff9e01e0), SPH_C32(0xedacc000), SPH_C32(0x14040000), + SPH_C32(0xf6b10000), SPH_C32(0x13a548ee), SPH_C32(0x0120772f), + SPH_C32(0xc63bb13f), SPH_C32(0xaa2df202), SPH_C32(0x3ff40129), + SPH_C32(0x499e0000), SPH_C32(0x60070000), SPH_C32(0x99860000), + SPH_C32(0x4ec74e4c), SPH_C32(0xfec22b8c), SPH_C32(0x30eda280), + SPH_C32(0x82ec5dff) }, + { SPH_C32(0x091e01e5), SPH_C32(0xd9ef0000), SPH_C32(0x30030000), + SPH_C32(0x798c0000), SPH_C32(0x32927315), SPH_C32(0x0b98a281), + SPH_C32(0x0bfe3a26), SPH_C32(0x7db84833), SPH_C32(0x998b0128), + SPH_C32(0x38a98000), SPH_C32(0x79fb0000), SPH_C32(0x0f5d0000), + SPH_C32(0x744c23b1), SPH_C32(0x1508857f), SPH_C32(0x1c80e50f), + SPH_C32(0x2e623177) }, + { SPH_C32(0x59e101e1), SPH_C32(0x9c9b4000), SPH_C32(0x0df80000), + SPH_C32(0x606a0000), SPH_C32(0x292e2513), SPH_C32(0xeaead9dc), + SPH_C32(0xea56f6b0), SPH_C32(0x06a39e8a), SPH_C32(0x6f0b012d), + SPH_C32(0x0cea4000), SPH_C32(0x5dfc0000), SPH_C32(0x80600000), + SPH_C32(0x557b184a), SPH_C32(0x1fb050d1), SPH_C32(0xd1456e16), + SPH_C32(0xf9f78b46) }, + { SPH_C32(0xaf6101e4), SPH_C32(0xa8d88000), SPH_C32(0x29ff0000), + SPH_C32(0xef570000), SPH_C32(0x08191ee8), SPH_C32(0xe0520c72), + SPH_C32(0x27937da9), SPH_C32(0xd13624bb), SPH_C32(0xc974012c), + SPH_C32(0x7dddc000), SPH_C32(0x44000000), SPH_C32(0x16bb0000), + SPH_C32(0x6ff075b7), SPH_C32(0xf47afe22), SPH_C32(0xfd282999), + SPH_C32(0x5579e7ce) }, + { SPH_C32(0x08eb01e9), SPH_C32(0x22900000), SPH_C32(0xd7d20000), + SPH_C32(0xf2230000), SPH_C32(0x11305147), SPH_C32(0xf9c84195), + SPH_C32(0xbcbc4071), SPH_C32(0x343b6a18), SPH_C32(0xeb9e0129), + SPH_C32(0xc456c000), SPH_C32(0xc5a80000), SPH_C32(0xd3af0000), + SPH_C32(0xb2890c36), SPH_C32(0x3776ade0), SPH_C32(0xa8db3484), + SPH_C32(0x75aa9edf) }, + { SPH_C32(0xfe6b01ec), SPH_C32(0x16d3c000), SPH_C32(0xf3d50000), + SPH_C32(0x7d1e0000), SPH_C32(0x30076abc), SPH_C32(0xf370943b), + SPH_C32(0x7179cb68), SPH_C32(0xe3aed029), SPH_C32(0x4de10128), + SPH_C32(0xb5614000), SPH_C32(0xdc540000), SPH_C32(0x45740000), + SPH_C32(0x880261cb), SPH_C32(0xdcbc0313), SPH_C32(0x84b6730b), + SPH_C32(0xd924f257) }, + { SPH_C32(0xae9401e8), SPH_C32(0x53a78000), SPH_C32(0xce2e0000), + SPH_C32(0x64f80000), SPH_C32(0x2bbb3cba), SPH_C32(0x1202ef66), + SPH_C32(0x90d107fe), SPH_C32(0x98b50690), SPH_C32(0xbb61012d), + SPH_C32(0x81228000), SPH_C32(0xf8530000), SPH_C32(0xca490000), + SPH_C32(0xa9355a30), SPH_C32(0xd604d6bd), SPH_C32(0x4973f812), + SPH_C32(0x0eb14866) }, + { SPH_C32(0x581401ed), SPH_C32(0x67e44000), SPH_C32(0xea290000), + SPH_C32(0xebc50000), SPH_C32(0x0a8c0741), SPH_C32(0x18ba3ac8), + SPH_C32(0x5d148ce7), SPH_C32(0x4f20bca1), SPH_C32(0x1d1e012c), + SPH_C32(0xf0150000), SPH_C32(0xe1af0000), SPH_C32(0x5c920000), + SPH_C32(0x93be37cd), SPH_C32(0x3dce784e), SPH_C32(0x651ebf9d), + SPH_C32(0xa23f24ee) }, + { SPH_C32(0xa8dc0140), SPH_C32(0x07260000), SPH_C32(0x50bc0000), + SPH_C32(0x8b930000), SPH_C32(0x24480aa0), SPH_C32(0xf4a0637f), + SPH_C32(0xc96a9af7), SPH_C32(0x1868519d), SPH_C32(0x6baf01d0), + SPH_C32(0xfa300000), SPH_C32(0xf3cc0000), SPH_C32(0xe3290000), + SPH_C32(0x392b6b13), SPH_C32(0x9515777f), SPH_C32(0xd99f08d4), + SPH_C32(0x248b730e) }, + { SPH_C32(0x5e5c0145), SPH_C32(0x3365c000), SPH_C32(0x74bb0000), + SPH_C32(0x04ae0000), SPH_C32(0x057f315b), SPH_C32(0xfe18b6d1), + SPH_C32(0x04af11ee), SPH_C32(0xcffdebac), SPH_C32(0xcdd001d1), + SPH_C32(0x8b078000), SPH_C32(0xea300000), SPH_C32(0x75f20000), + SPH_C32(0x03a006ee), SPH_C32(0x7edfd98c), SPH_C32(0xf5f24f5b), + SPH_C32(0x88051f86) }, + { SPH_C32(0x0ea30141), SPH_C32(0x76118000), SPH_C32(0x49400000), + SPH_C32(0x1d480000), SPH_C32(0x1ec3675d), SPH_C32(0x1f6acd8c), + SPH_C32(0xe507dd78), SPH_C32(0xb4e63d15), SPH_C32(0x3b5001d4), + SPH_C32(0xbf444000), SPH_C32(0xce370000), SPH_C32(0xfacf0000), + SPH_C32(0x22973d15), SPH_C32(0x74670c22), SPH_C32(0x3837c442), + SPH_C32(0x5f90a5b7) }, + { SPH_C32(0xf8230144), SPH_C32(0x42524000), SPH_C32(0x6d470000), + SPH_C32(0x92750000), SPH_C32(0x3ff45ca6), SPH_C32(0x15d21822), + SPH_C32(0x28c25661), SPH_C32(0x63738724), SPH_C32(0x9d2f01d5), + SPH_C32(0xce73c000), SPH_C32(0xd7cb0000), SPH_C32(0x6c140000), + SPH_C32(0x181c50e8), SPH_C32(0x9fada2d1), SPH_C32(0x145a83cd), + SPH_C32(0xf31ec93f) }, + { SPH_C32(0x5fa90149), SPH_C32(0xc81ac000), SPH_C32(0x936a0000), + SPH_C32(0x8f010000), SPH_C32(0x26dd1309), SPH_C32(0x0c4855c5), + SPH_C32(0xb3ed6bb9), SPH_C32(0x867ec987), SPH_C32(0xbfc501d0), + SPH_C32(0x77f8c000), SPH_C32(0x56630000), SPH_C32(0xa9000000), + SPH_C32(0xc5652969), SPH_C32(0x5ca1f113), SPH_C32(0x41a99ed0), + SPH_C32(0xd3cdb02e) }, + { SPH_C32(0xa929014c), SPH_C32(0xfc590000), SPH_C32(0xb76d0000), + SPH_C32(0x003c0000), SPH_C32(0x07ea28f2), SPH_C32(0x06f0806b), + SPH_C32(0x7e28e0a0), SPH_C32(0x51eb73b6), SPH_C32(0x19ba01d1), + SPH_C32(0x06cf4000), SPH_C32(0x4f9f0000), SPH_C32(0x3fdb0000), + SPH_C32(0xffee4494), SPH_C32(0xb76b5fe0), SPH_C32(0x6dc4d95f), + SPH_C32(0x7f43dca6) }, + { SPH_C32(0xf9d60148), SPH_C32(0xb92d4000), SPH_C32(0x8a960000), + SPH_C32(0x19da0000), SPH_C32(0x1c567ef4), SPH_C32(0xe782fb36), + SPH_C32(0x9f802c36), SPH_C32(0x2af0a50f), SPH_C32(0xef3a01d4), + SPH_C32(0x328c8000), SPH_C32(0x6b980000), SPH_C32(0xb0e60000), + SPH_C32(0xded97f6f), SPH_C32(0xbdd38a4e), SPH_C32(0xa0015246), + SPH_C32(0xa8d66697) }, + { SPH_C32(0x0f56014d), SPH_C32(0x8d6e8000), SPH_C32(0xae910000), + SPH_C32(0x96e70000), SPH_C32(0x3d61450f), SPH_C32(0xed3a2e98), + SPH_C32(0x5245a72f), SPH_C32(0xfd651f3e), SPH_C32(0x494501d5), + SPH_C32(0x43bb0000), SPH_C32(0x72640000), SPH_C32(0x263d0000), + SPH_C32(0xe4521292), SPH_C32(0x561924bd), SPH_C32(0x8c6c15c9), + SPH_C32(0x04580a1f) }, + { SPH_C32(0x7cb60140), SPH_C32(0x8aeec000), SPH_C32(0xf5130000), + SPH_C32(0xc1ba0000), SPH_C32(0xd80648da), SPH_C32(0x3d14e513), + SPH_C32(0x515c0cf3), SPH_C32(0xef2e92bd), SPH_C32(0x48b001d9), + SPH_C32(0xb8c40000), SPH_C32(0x95b50000), SPH_C32(0xad920000), + SPH_C32(0xc7f030c0), SPH_C32(0xa449c7a9), SPH_C32(0x3b2e6f9e), + SPH_C32(0x4ddb2834) }, + { SPH_C32(0x8a360145), SPH_C32(0xbead0000), SPH_C32(0xd1140000), + SPH_C32(0x4e870000), SPH_C32(0xf9317321), SPH_C32(0x37ac30bd), + SPH_C32(0x9c9987ea), SPH_C32(0x38bb288c), SPH_C32(0xeecf01d8), + SPH_C32(0xc9f38000), SPH_C32(0x8c490000), SPH_C32(0x3b490000), + SPH_C32(0xfd7b5d3d), SPH_C32(0x4f83695a), SPH_C32(0x17432811), + SPH_C32(0xe15544bc) }, + { SPH_C32(0xdac90141), SPH_C32(0xfbd94000), SPH_C32(0xecef0000), + SPH_C32(0x57610000), SPH_C32(0xe28d2527), SPH_C32(0xd6de4be0), + SPH_C32(0x7d314b7c), SPH_C32(0x43a0fe35), SPH_C32(0x184f01dd), + SPH_C32(0xfdb04000), SPH_C32(0xa84e0000), SPH_C32(0xb4740000), + SPH_C32(0xdc4c66c6), SPH_C32(0x453bbcf4), SPH_C32(0xda86a308), + SPH_C32(0x36c0fe8d) }, + { SPH_C32(0x2c490144), SPH_C32(0xcf9a8000), SPH_C32(0xc8e80000), + SPH_C32(0xd85c0000), SPH_C32(0xc3ba1edc), SPH_C32(0xdc669e4e), + SPH_C32(0xb0f4c065), SPH_C32(0x94354404), SPH_C32(0xbe3001dc), + SPH_C32(0x8c87c000), SPH_C32(0xb1b20000), SPH_C32(0x22af0000), + SPH_C32(0xe6c70b3b), SPH_C32(0xaef11207), SPH_C32(0xf6ebe487), + SPH_C32(0x9a4e9205) }, + { SPH_C32(0x8bc30149), SPH_C32(0x45d20000), SPH_C32(0x36c50000), + SPH_C32(0xc5280000), SPH_C32(0xda935173), SPH_C32(0xc5fcd3a9), + SPH_C32(0x2bdbfdbd), SPH_C32(0x71380aa7), SPH_C32(0x9cda01d9), + SPH_C32(0x350cc000), SPH_C32(0x301a0000), SPH_C32(0xe7bb0000), + SPH_C32(0x3bbe72ba), SPH_C32(0x6dfd41c5), SPH_C32(0xa318f99a), + SPH_C32(0xba9deb14) }, + { SPH_C32(0x7d43014c), SPH_C32(0x7191c000), SPH_C32(0x12c20000), + SPH_C32(0x4a150000), SPH_C32(0xfba46a88), SPH_C32(0xcf440607), + SPH_C32(0xe61e76a4), SPH_C32(0xa6adb096), SPH_C32(0x3aa501d8), + SPH_C32(0x443b4000), SPH_C32(0x29e60000), SPH_C32(0x71600000), + SPH_C32(0x01351f47), SPH_C32(0x8637ef36), SPH_C32(0x8f75be15), + SPH_C32(0x1613879c) }, + { SPH_C32(0x2dbc0148), SPH_C32(0x34e58000), SPH_C32(0x2f390000), + SPH_C32(0x53f30000), SPH_C32(0xe0183c8e), SPH_C32(0x2e367d5a), + SPH_C32(0x07b6ba32), SPH_C32(0xddb6662f), SPH_C32(0xcc2501dd), + SPH_C32(0x70788000), SPH_C32(0x0de10000), SPH_C32(0xfe5d0000), + SPH_C32(0x200224bc), SPH_C32(0x8c8f3a98), SPH_C32(0x42b0350c), + SPH_C32(0xc1863dad) }, + { SPH_C32(0xdb3c014d), SPH_C32(0x00a64000), SPH_C32(0x0b3e0000), + SPH_C32(0xdcce0000), SPH_C32(0xc12f0775), SPH_C32(0x248ea8f4), + SPH_C32(0xca73312b), SPH_C32(0x0a23dc1e), SPH_C32(0x6a5a01dc), + SPH_C32(0x014f0000), SPH_C32(0x141d0000), SPH_C32(0x68860000), + SPH_C32(0x1a894941), SPH_C32(0x6745946b), SPH_C32(0x6edd7283), + SPH_C32(0x6d085125) }, + { SPH_C32(0xdf9801b0), SPH_C32(0xf67c0000), SPH_C32(0xa50e0000), + SPH_C32(0xbf870000), SPH_C32(0xad7f742c), SPH_C32(0xae2b8f5a), + SPH_C32(0xc2a957e9), SPH_C32(0xd75f2456), SPH_C32(0x9fc30180), + SPH_C32(0x6c280000), SPH_C32(0xe7690000), SPH_C32(0xe0360000), + SPH_C32(0x7bbf15ab), SPH_C32(0xf3aa0966), SPH_C32(0x453b7806), + SPH_C32(0xaebf667a) }, + { SPH_C32(0x291801b5), SPH_C32(0xc23fc000), SPH_C32(0x81090000), + SPH_C32(0x30ba0000), SPH_C32(0x8c484fd7), SPH_C32(0xa4935af4), + SPH_C32(0x0f6cdcf0), SPH_C32(0x00ca9e67), SPH_C32(0x39bc0181), + SPH_C32(0x1d1f8000), SPH_C32(0xfe950000), SPH_C32(0x76ed0000), + SPH_C32(0x41347856), SPH_C32(0x1860a795), SPH_C32(0x69563f89), + SPH_C32(0x02310af2) }, + { SPH_C32(0x79e701b1), SPH_C32(0x874b8000), SPH_C32(0xbcf20000), + SPH_C32(0x295c0000), SPH_C32(0x97f419d1), SPH_C32(0x45e121a9), + SPH_C32(0xeec41066), SPH_C32(0x7bd148de), SPH_C32(0xcf3c0184), + SPH_C32(0x295c4000), SPH_C32(0xda920000), SPH_C32(0xf9d00000), + SPH_C32(0x600343ad), SPH_C32(0x12d8723b), SPH_C32(0xa493b490), + SPH_C32(0xd5a4b0c3) }, + { SPH_C32(0x8f6701b4), SPH_C32(0xb3084000), SPH_C32(0x98f50000), + SPH_C32(0xa6610000), SPH_C32(0xb6c3222a), SPH_C32(0x4f59f407), + SPH_C32(0x23019b7f), SPH_C32(0xac44f2ef), SPH_C32(0x69430185), + SPH_C32(0x586bc000), SPH_C32(0xc36e0000), SPH_C32(0x6f0b0000), + SPH_C32(0x5a882e50), SPH_C32(0xf912dcc8), SPH_C32(0x88fef31f), + SPH_C32(0x792adc4b) }, + { SPH_C32(0x28ed01b9), SPH_C32(0x3940c000), SPH_C32(0x66d80000), + SPH_C32(0xbb150000), SPH_C32(0xafea6d85), SPH_C32(0x56c3b9e0), + SPH_C32(0xb82ea6a7), SPH_C32(0x4949bc4c), SPH_C32(0x4ba90180), + SPH_C32(0xe1e0c000), SPH_C32(0x42c60000), SPH_C32(0xaa1f0000), + SPH_C32(0x87f157d1), SPH_C32(0x3a1e8f0a), SPH_C32(0xdd0dee02), + SPH_C32(0x59f9a55a) }, + { SPH_C32(0xde6d01bc), SPH_C32(0x0d030000), SPH_C32(0x42df0000), + SPH_C32(0x34280000), SPH_C32(0x8edd567e), SPH_C32(0x5c7b6c4e), + SPH_C32(0x75eb2dbe), SPH_C32(0x9edc067d), SPH_C32(0xedd60181), + SPH_C32(0x90d74000), SPH_C32(0x5b3a0000), SPH_C32(0x3cc40000), + SPH_C32(0xbd7a3a2c), SPH_C32(0xd1d421f9), SPH_C32(0xf160a98d), + SPH_C32(0xf577c9d2) }, + { SPH_C32(0x8e9201b8), SPH_C32(0x48774000), SPH_C32(0x7f240000), + SPH_C32(0x2dce0000), SPH_C32(0x95610078), SPH_C32(0xbd091713), + SPH_C32(0x9443e128), SPH_C32(0xe5c7d0c4), SPH_C32(0x1b560184), + SPH_C32(0xa4948000), SPH_C32(0x7f3d0000), SPH_C32(0xb3f90000), + SPH_C32(0x9c4d01d7), SPH_C32(0xdb6cf457), SPH_C32(0x3ca52294), + SPH_C32(0x22e273e3) }, + { SPH_C32(0x781201bd), SPH_C32(0x7c348000), SPH_C32(0x5b230000), + SPH_C32(0xa2f30000), SPH_C32(0xb4563b83), SPH_C32(0xb7b1c2bd), + SPH_C32(0x59866a31), SPH_C32(0x32526af5), SPH_C32(0xbd290185), + SPH_C32(0xd5a30000), SPH_C32(0x66c10000), SPH_C32(0x25220000), + SPH_C32(0xa6c66c2a), SPH_C32(0x30a65aa4), SPH_C32(0x10c8651b), + SPH_C32(0x8e6c1f6b) }, + { SPH_C32(0x0bf201b0), SPH_C32(0x7bb4c000), SPH_C32(0x00a10000), + SPH_C32(0xf5ae0000), SPH_C32(0x51313656), SPH_C32(0x679f0936), + SPH_C32(0x5a9fc1ed), SPH_C32(0x2019e776), SPH_C32(0xbcdc0189), + SPH_C32(0x2edc0000), SPH_C32(0x81100000), SPH_C32(0xae8d0000), + SPH_C32(0x85644e78), SPH_C32(0xc2f6b9b0), SPH_C32(0xa78a1f4c), + SPH_C32(0xc7ef3d40) }, + { SPH_C32(0xfd7201b5), SPH_C32(0x4ff70000), SPH_C32(0x24a60000), + SPH_C32(0x7a930000), SPH_C32(0x70060dad), SPH_C32(0x6d27dc98), + SPH_C32(0x975a4af4), SPH_C32(0xf78c5d47), SPH_C32(0x1aa30188), + SPH_C32(0x5feb8000), SPH_C32(0x98ec0000), SPH_C32(0x38560000), + SPH_C32(0xbfef2385), SPH_C32(0x293c1743), SPH_C32(0x8be758c3), + SPH_C32(0x6b6151c8) }, + { SPH_C32(0xad8d01b1), SPH_C32(0x0a834000), SPH_C32(0x195d0000), + SPH_C32(0x63750000), SPH_C32(0x6bba5bab), SPH_C32(0x8c55a7c5), + SPH_C32(0x76f28662), SPH_C32(0x8c978bfe), SPH_C32(0xec23018d), + SPH_C32(0x6ba84000), SPH_C32(0xbceb0000), SPH_C32(0xb76b0000), + SPH_C32(0x9ed8187e), SPH_C32(0x2384c2ed), SPH_C32(0x4622d3da), + SPH_C32(0xbcf4ebf9) }, + { SPH_C32(0x5b0d01b4), SPH_C32(0x3ec08000), SPH_C32(0x3d5a0000), + SPH_C32(0xec480000), SPH_C32(0x4a8d6050), SPH_C32(0x86ed726b), + SPH_C32(0xbb370d7b), SPH_C32(0x5b0231cf), SPH_C32(0x4a5c018c), + SPH_C32(0x1a9fc000), SPH_C32(0xa5170000), SPH_C32(0x21b00000), + SPH_C32(0xa4537583), SPH_C32(0xc84e6c1e), SPH_C32(0x6a4f9455), + SPH_C32(0x107a8771) }, + { SPH_C32(0xfc8701b9), SPH_C32(0xb4880000), SPH_C32(0xc3770000), + SPH_C32(0xf13c0000), SPH_C32(0x53a42fff), SPH_C32(0x9f773f8c), + SPH_C32(0x201830a3), SPH_C32(0xbe0f7f6c), SPH_C32(0x68b60189), + SPH_C32(0xa314c000), SPH_C32(0x24bf0000), SPH_C32(0xe4a40000), + SPH_C32(0x792a0c02), SPH_C32(0x0b423fdc), SPH_C32(0x3fbc8948), + SPH_C32(0x30a9fe60) }, + { SPH_C32(0x0a0701bc), SPH_C32(0x80cbc000), SPH_C32(0xe7700000), + SPH_C32(0x7e010000), SPH_C32(0x72931404), SPH_C32(0x95cfea22), + SPH_C32(0xedddbbba), SPH_C32(0x699ac55d), SPH_C32(0xcec90188), + SPH_C32(0xd2234000), SPH_C32(0x3d430000), SPH_C32(0x727f0000), + SPH_C32(0x43a161ff), SPH_C32(0xe088912f), SPH_C32(0x13d1cec7), + SPH_C32(0x9c2792e8) }, + { SPH_C32(0x5af801b8), SPH_C32(0xc5bf8000), SPH_C32(0xda8b0000), + SPH_C32(0x67e70000), SPH_C32(0x692f4202), SPH_C32(0x74bd917f), + SPH_C32(0x0c75772c), SPH_C32(0x128113e4), SPH_C32(0x3849018d), + SPH_C32(0xe6608000), SPH_C32(0x19440000), SPH_C32(0xfd420000), + SPH_C32(0x62965a04), SPH_C32(0xea304481), SPH_C32(0xde1445de), + SPH_C32(0x4bb228d9) }, + { SPH_C32(0xac7801bd), SPH_C32(0xf1fc4000), SPH_C32(0xfe8c0000), + SPH_C32(0xe8da0000), SPH_C32(0x481879f9), SPH_C32(0x7e0544d1), + SPH_C32(0xc1b0fc35), SPH_C32(0xc514a9d5), SPH_C32(0x9e36018c), + SPH_C32(0x97570000), SPH_C32(0x00b80000), SPH_C32(0x6b990000), + SPH_C32(0x581d37f9), SPH_C32(0x01faea72), SPH_C32(0xf2790251), + SPH_C32(0xe73c4451) } +}; + +static const sph_u32 T512_16[256][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x0c720000), SPH_C32(0x49e50f00), SPH_C32(0x42790000), + SPH_C32(0x5cea0000), SPH_C32(0x33aa301a), SPH_C32(0x15822514), + SPH_C32(0x95a34b7b), SPH_C32(0xb44b0090), SPH_C32(0xfe220000), + SPH_C32(0xa7580500), SPH_C32(0x25d10000), SPH_C32(0xf7600000), + SPH_C32(0x893178da), SPH_C32(0x1fd4f860), SPH_C32(0x4ed0a315), + SPH_C32(0xa123ff9f) }, + { SPH_C32(0xfe220000), SPH_C32(0xa7580500), SPH_C32(0x25d10000), + SPH_C32(0xf7600000), SPH_C32(0x893178da), SPH_C32(0x1fd4f860), + SPH_C32(0x4ed0a315), SPH_C32(0xa123ff9f), SPH_C32(0xf2500000), + SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), SPH_C32(0xab8a0000), + SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), SPH_C32(0xdb73e86e), + SPH_C32(0x1568ff0f) }, + { SPH_C32(0xf2500000), SPH_C32(0xeebd0a00), SPH_C32(0x67a80000), + SPH_C32(0xab8a0000), SPH_C32(0xba9b48c0), SPH_C32(0x0a56dd74), + SPH_C32(0xdb73e86e), SPH_C32(0x1568ff0f), SPH_C32(0x0c720000), + SPH_C32(0x49e50f00), SPH_C32(0x42790000), SPH_C32(0x5cea0000), + SPH_C32(0x33aa301a), SPH_C32(0x15822514), SPH_C32(0x95a34b7b), + SPH_C32(0xb44b0090) }, + { SPH_C32(0x45180000), SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), + SPH_C32(0x3b480000), SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), + SPH_C32(0x16bca6b0), SPH_C32(0xdf33f4df), SPH_C32(0xb83d0000), + SPH_C32(0x16710600), SPH_C32(0x379a0000), SPH_C32(0xf5b10000), + SPH_C32(0x228161ac), SPH_C32(0xae48f145), SPH_C32(0x66241616), + SPH_C32(0xc5c1eb3e) }, + { SPH_C32(0x496a0000), SPH_C32(0xec501800), SPH_C32(0xbb130000), + SPH_C32(0x67a20000), SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), + SPH_C32(0x831fedcb), SPH_C32(0x6b78f44f), SPH_C32(0x461f0000), + SPH_C32(0xb1290300), SPH_C32(0x124b0000), SPH_C32(0x02d10000), + SPH_C32(0xabb01976), SPH_C32(0xb19c0925), SPH_C32(0x28f4b503), + SPH_C32(0x64e214a1) }, + { SPH_C32(0xbb3a0000), SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), + SPH_C32(0xcc280000), SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), + SPH_C32(0x586c05a5), SPH_C32(0x7e100b40), SPH_C32(0x4a6d0000), + SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), SPH_C32(0x5e3b0000), + SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), SPH_C32(0xbd57fe78), + SPH_C32(0xd0a91431) }, + { SPH_C32(0xb7480000), SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), + SPH_C32(0x90c20000), SPH_C32(0xa4575cec), SPH_C32(0x294548a2), + SPH_C32(0xcdcf4ede), SPH_C32(0xca5b0bd0), SPH_C32(0xb44f0000), + SPH_C32(0x5f940900), SPH_C32(0x75e30000), SPH_C32(0xa95b0000), + SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), SPH_C32(0xf3875d6d), + SPH_C32(0x718aebae) }, + { SPH_C32(0xb83d0000), SPH_C32(0x16710600), SPH_C32(0x379a0000), + SPH_C32(0xf5b10000), SPH_C32(0x228161ac), SPH_C32(0xae48f145), + SPH_C32(0x66241616), SPH_C32(0xc5c1eb3e), SPH_C32(0xfd250000), + SPH_C32(0xb3c41100), SPH_C32(0xcef00000), SPH_C32(0xcef90000), + SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), SPH_C32(0x7098b0a6), + SPH_C32(0x1af21fe1) }, + { SPH_C32(0xb44f0000), SPH_C32(0x5f940900), SPH_C32(0x75e30000), + SPH_C32(0xa95b0000), SPH_C32(0x112b51b6), SPH_C32(0xbbcad451), + SPH_C32(0xf3875d6d), SPH_C32(0x718aebae), SPH_C32(0x03070000), + SPH_C32(0x149c1400), SPH_C32(0xeb210000), SPH_C32(0x39990000), + SPH_C32(0xb57c0d5a), SPH_C32(0x928f9cf3), SPH_C32(0x3e4813b3), + SPH_C32(0xbbd1e07e) }, + { SPH_C32(0x461f0000), SPH_C32(0xb1290300), SPH_C32(0x124b0000), + SPH_C32(0x02d10000), SPH_C32(0xabb01976), SPH_C32(0xb19c0925), + SPH_C32(0x28f4b503), SPH_C32(0x64e214a1), SPH_C32(0x0f750000), + SPH_C32(0x5d791b00), SPH_C32(0xa9580000), SPH_C32(0x65730000), + SPH_C32(0x86d63d40), SPH_C32(0x870db9e7), SPH_C32(0xabeb58c8), + SPH_C32(0x0f9ae0ee) }, + { SPH_C32(0x4a6d0000), SPH_C32(0xf8cc0c00), SPH_C32(0x50320000), + SPH_C32(0x5e3b0000), SPH_C32(0x981a296c), SPH_C32(0xa41e2c31), + SPH_C32(0xbd57fe78), SPH_C32(0xd0a91431), SPH_C32(0xf1570000), + SPH_C32(0xfa211e00), SPH_C32(0x8c890000), SPH_C32(0x92130000), + SPH_C32(0x0fe7459a), SPH_C32(0x98d94187), SPH_C32(0xe53bfbdd), + SPH_C32(0xaeb91f71) }, + { SPH_C32(0xfd250000), SPH_C32(0xb3c41100), SPH_C32(0xcef00000), + SPH_C32(0xcef90000), SPH_C32(0x3c4d7580), SPH_C32(0x8d5b6493), + SPH_C32(0x7098b0a6), SPH_C32(0x1af21fe1), SPH_C32(0x45180000), + SPH_C32(0xa5b51700), SPH_C32(0xf96a0000), SPH_C32(0x3b480000), + SPH_C32(0x1ecc142c), SPH_C32(0x231395d6), SPH_C32(0x16bca6b0), + SPH_C32(0xdf33f4df) }, + { SPH_C32(0xf1570000), SPH_C32(0xfa211e00), SPH_C32(0x8c890000), + SPH_C32(0x92130000), SPH_C32(0x0fe7459a), SPH_C32(0x98d94187), + SPH_C32(0xe53bfbdd), SPH_C32(0xaeb91f71), SPH_C32(0xbb3a0000), + SPH_C32(0x02ed1200), SPH_C32(0xdcbb0000), SPH_C32(0xcc280000), + SPH_C32(0x97fd6cf6), SPH_C32(0x3cc76db6), SPH_C32(0x586c05a5), + SPH_C32(0x7e100b40) }, + { SPH_C32(0x03070000), SPH_C32(0x149c1400), SPH_C32(0xeb210000), + SPH_C32(0x39990000), SPH_C32(0xb57c0d5a), SPH_C32(0x928f9cf3), + SPH_C32(0x3e4813b3), SPH_C32(0xbbd1e07e), SPH_C32(0xb7480000), + SPH_C32(0x4b081d00), SPH_C32(0x9ec20000), SPH_C32(0x90c20000), + SPH_C32(0xa4575cec), SPH_C32(0x294548a2), SPH_C32(0xcdcf4ede), + SPH_C32(0xca5b0bd0) }, + { SPH_C32(0x0f750000), SPH_C32(0x5d791b00), SPH_C32(0xa9580000), + SPH_C32(0x65730000), SPH_C32(0x86d63d40), SPH_C32(0x870db9e7), + SPH_C32(0xabeb58c8), SPH_C32(0x0f9ae0ee), SPH_C32(0x496a0000), + SPH_C32(0xec501800), SPH_C32(0xbb130000), SPH_C32(0x67a20000), + SPH_C32(0x2d662436), SPH_C32(0x3691b0c2), SPH_C32(0x831fedcb), + SPH_C32(0x6b78f44f) }, + { SPH_C32(0x75a40000), SPH_C32(0xc28b2700), SPH_C32(0x94a40000), + SPH_C32(0x90f50000), SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), + SPH_C32(0x1767c483), SPH_C32(0xaedf667e), SPH_C32(0xd1660000), + SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), SPH_C32(0xf6940000), + SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), SPH_C32(0xb4431b17), + SPH_C32(0x857f3c2b) }, + { SPH_C32(0x79d60000), SPH_C32(0x8b6e2800), SPH_C32(0xd6dd0000), + SPH_C32(0xcc1f0000), SPH_C32(0xc8d267fa), SPH_C32(0x5c4c2eba), + SPH_C32(0x82c48ff8), SPH_C32(0x1a9466ee), SPH_C32(0x2f440000), + SPH_C32(0xbce40600), SPH_C32(0xbb3d0000), SPH_C32(0x01f40000), + SPH_C32(0x8a333dfd), SPH_C32(0xd0a40492), SPH_C32(0xfa93b802), + SPH_C32(0x245cc3b4) }, + { SPH_C32(0x8b860000), SPH_C32(0x65d32200), SPH_C32(0xb1750000), + SPH_C32(0x67950000), SPH_C32(0x72492f3a), SPH_C32(0x561af3ce), + SPH_C32(0x59b76796), SPH_C32(0x0ffc99e1), SPH_C32(0x23360000), + SPH_C32(0xf5010900), SPH_C32(0xf9440000), SPH_C32(0x5d1e0000), + SPH_C32(0xb9990de7), SPH_C32(0xc5262186), SPH_C32(0x6f30f379), + SPH_C32(0x9017c324) }, + { SPH_C32(0x87f40000), SPH_C32(0x2c362d00), SPH_C32(0xf30c0000), + SPH_C32(0x3b7f0000), SPH_C32(0x41e31f20), SPH_C32(0x4398d6da), + SPH_C32(0xcc142ced), SPH_C32(0xbbb79971), SPH_C32(0xdd140000), + SPH_C32(0x52590c00), SPH_C32(0xdc950000), SPH_C32(0xaa7e0000), + SPH_C32(0x30a8753d), SPH_C32(0xdaf2d9e6), SPH_C32(0x21e0506c), + SPH_C32(0x31343cbb) }, + { SPH_C32(0x30bc0000), SPH_C32(0x673e3000), SPH_C32(0x6dce0000), + SPH_C32(0xabbd0000), SPH_C32(0xe5b443cc), SPH_C32(0x6add9e78), + SPH_C32(0x01db6233), SPH_C32(0x71ec92a1), SPH_C32(0x695b0000), + SPH_C32(0x0dcd0500), SPH_C32(0xa9760000), SPH_C32(0x03250000), + SPH_C32(0x2183248b), SPH_C32(0x61380db7), SPH_C32(0xd2670d01), + SPH_C32(0x40bed715) }, + { SPH_C32(0x3cce0000), SPH_C32(0x2edb3f00), SPH_C32(0x2fb70000), + SPH_C32(0xf7570000), SPH_C32(0xd61e73d6), SPH_C32(0x7f5fbb6c), + SPH_C32(0x94782948), SPH_C32(0xc5a79231), SPH_C32(0x97790000), + SPH_C32(0xaa950000), SPH_C32(0x8ca70000), SPH_C32(0xf4450000), + SPH_C32(0xa8b25c51), SPH_C32(0x7eecf5d7), SPH_C32(0x9cb7ae14), + SPH_C32(0xe19d288a) }, + { SPH_C32(0xce9e0000), SPH_C32(0xc0663500), SPH_C32(0x481f0000), + SPH_C32(0x5cdd0000), SPH_C32(0x6c853b16), SPH_C32(0x75096618), + SPH_C32(0x4f0bc126), SPH_C32(0xd0cf6d3e), SPH_C32(0x9b0b0000), + SPH_C32(0xe3700f00), SPH_C32(0xcede0000), SPH_C32(0xa8af0000), + SPH_C32(0x9b186c4b), SPH_C32(0x6b6ed0c3), SPH_C32(0x0914e56f), + SPH_C32(0x55d6281a) }, + { SPH_C32(0xc2ec0000), SPH_C32(0x89833a00), SPH_C32(0x0a660000), + SPH_C32(0x00370000), SPH_C32(0x5f2f0b0c), SPH_C32(0x608b430c), + SPH_C32(0xdaa88a5d), SPH_C32(0x64846dae), SPH_C32(0x65290000), + SPH_C32(0x44280a00), SPH_C32(0xeb0f0000), SPH_C32(0x5fcf0000), + SPH_C32(0x12291491), SPH_C32(0x74ba28a3), SPH_C32(0x47c4467a), + SPH_C32(0xf4f5d785) }, + { SPH_C32(0xcd990000), SPH_C32(0xd4fa2100), SPH_C32(0xa33e0000), + SPH_C32(0x65440000), SPH_C32(0xd9f9364c), SPH_C32(0xe786faeb), + SPH_C32(0x7143d295), SPH_C32(0x6b1e8d40), SPH_C32(0x2c430000), + SPH_C32(0xa8781200), SPH_C32(0x501c0000), SPH_C32(0x386d0000), + SPH_C32(0x3f4f30a7), SPH_C32(0x422b9861), SPH_C32(0xc4dbabb1), + SPH_C32(0x9f8d23ca) }, + { SPH_C32(0xc1eb0000), SPH_C32(0x9d1f2e00), SPH_C32(0xe1470000), + SPH_C32(0x39ae0000), SPH_C32(0xea530656), SPH_C32(0xf204dfff), + SPH_C32(0xe4e099ee), SPH_C32(0xdf558dd0), SPH_C32(0xd2610000), + SPH_C32(0x0f201700), SPH_C32(0x75cd0000), SPH_C32(0xcf0d0000), + SPH_C32(0xb67e487d), SPH_C32(0x5dff6001), SPH_C32(0x8a0b08a4), + SPH_C32(0x3eaedc55) }, + { SPH_C32(0x33bb0000), SPH_C32(0x73a22400), SPH_C32(0x86ef0000), + SPH_C32(0x92240000), SPH_C32(0x50c84e96), SPH_C32(0xf852028b), + SPH_C32(0x3f937180), SPH_C32(0xca3d72df), SPH_C32(0xde130000), + SPH_C32(0x46c51800), SPH_C32(0x37b40000), SPH_C32(0x93e70000), + SPH_C32(0x85d47867), SPH_C32(0x487d4515), SPH_C32(0x1fa843df), + SPH_C32(0x8ae5dcc5) }, + { SPH_C32(0x3fc90000), SPH_C32(0x3a472b00), SPH_C32(0xc4960000), + SPH_C32(0xcece0000), SPH_C32(0x63627e8c), SPH_C32(0xedd0279f), + SPH_C32(0xaa303afb), SPH_C32(0x7e76724f), SPH_C32(0x20310000), + SPH_C32(0xe19d1d00), SPH_C32(0x12650000), SPH_C32(0x64870000), + SPH_C32(0x0ce500bd), SPH_C32(0x57a9bd75), SPH_C32(0x5178e0ca), + SPH_C32(0x2bc6235a) }, + { SPH_C32(0x88810000), SPH_C32(0x714f3600), SPH_C32(0x5a540000), + SPH_C32(0x5e0c0000), SPH_C32(0xc7352260), SPH_C32(0xc4956f3d), + SPH_C32(0x67ff7425), SPH_C32(0xb42d799f), SPH_C32(0x947e0000), + SPH_C32(0xbe091400), SPH_C32(0x67860000), SPH_C32(0xcddc0000), + SPH_C32(0x1dce510b), SPH_C32(0xec636924), SPH_C32(0xa2ffbda7), + SPH_C32(0x5a4cc8f4) }, + { SPH_C32(0x84f30000), SPH_C32(0x38aa3900), SPH_C32(0x182d0000), + SPH_C32(0x02e60000), SPH_C32(0xf49f127a), SPH_C32(0xd1174a29), + SPH_C32(0xf25c3f5e), SPH_C32(0x0066790f), SPH_C32(0x6a5c0000), + SPH_C32(0x19511100), SPH_C32(0x42570000), SPH_C32(0x3abc0000), + SPH_C32(0x94ff29d1), SPH_C32(0xf3b79144), SPH_C32(0xec2f1eb2), + SPH_C32(0xfb6f376b) }, + { SPH_C32(0x76a30000), SPH_C32(0xd6173300), SPH_C32(0x7f850000), + SPH_C32(0xa96c0000), SPH_C32(0x4e045aba), SPH_C32(0xdb41975d), + SPH_C32(0x292fd730), SPH_C32(0x150e8600), SPH_C32(0x662e0000), + SPH_C32(0x50b41e00), SPH_C32(0x002e0000), SPH_C32(0x66560000), + SPH_C32(0xa75519cb), SPH_C32(0xe635b450), SPH_C32(0x798c55c9), + SPH_C32(0x4f2437fb) }, + { SPH_C32(0x7ad10000), SPH_C32(0x9ff23c00), SPH_C32(0x3dfc0000), + SPH_C32(0xf5860000), SPH_C32(0x7dae6aa0), SPH_C32(0xcec3b249), + SPH_C32(0xbc8c9c4b), SPH_C32(0xa1458690), SPH_C32(0x980c0000), + SPH_C32(0xf7ec1b00), SPH_C32(0x25ff0000), SPH_C32(0x91360000), + SPH_C32(0x2e646111), SPH_C32(0xf9e14c30), SPH_C32(0x375cf6dc), + SPH_C32(0xee07c864) }, + { SPH_C32(0xd1660000), SPH_C32(0x1bbc0300), SPH_C32(0x9eec0000), + SPH_C32(0xf6940000), SPH_C32(0x03024527), SPH_C32(0xcf70fcf2), + SPH_C32(0xb4431b17), SPH_C32(0x857f3c2b), SPH_C32(0xa4c20000), + SPH_C32(0xd9372400), SPH_C32(0x0a480000), SPH_C32(0x66610000), + SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), SPH_C32(0xa324df94), + SPH_C32(0x2ba05a55) }, + { SPH_C32(0xdd140000), SPH_C32(0x52590c00), SPH_C32(0xdc950000), + SPH_C32(0xaa7e0000), SPH_C32(0x30a8753d), SPH_C32(0xdaf2d9e6), + SPH_C32(0x21e0506c), SPH_C32(0x31343cbb), SPH_C32(0x5ae00000), + SPH_C32(0x7e6f2100), SPH_C32(0x2f990000), SPH_C32(0x91010000), + SPH_C32(0x714b6a1d), SPH_C32(0x996a0f3c), SPH_C32(0xedf47c81), + SPH_C32(0x8a83a5ca) }, + { SPH_C32(0x2f440000), SPH_C32(0xbce40600), SPH_C32(0xbb3d0000), + SPH_C32(0x01f40000), SPH_C32(0x8a333dfd), SPH_C32(0xd0a40492), + SPH_C32(0xfa93b802), SPH_C32(0x245cc3b4), SPH_C32(0x56920000), + SPH_C32(0x378a2e00), SPH_C32(0x6de00000), SPH_C32(0xcdeb0000), + SPH_C32(0x42e15a07), SPH_C32(0x8ce82a28), SPH_C32(0x785737fa), + SPH_C32(0x3ec8a55a) }, + { SPH_C32(0x23360000), SPH_C32(0xf5010900), SPH_C32(0xf9440000), + SPH_C32(0x5d1e0000), SPH_C32(0xb9990de7), SPH_C32(0xc5262186), + SPH_C32(0x6f30f379), SPH_C32(0x9017c324), SPH_C32(0xa8b00000), + SPH_C32(0x90d22b00), SPH_C32(0x48310000), SPH_C32(0x3a8b0000), + SPH_C32(0xcbd022dd), SPH_C32(0x933cd248), SPH_C32(0x368794ef), + SPH_C32(0x9feb5ac5) }, + { SPH_C32(0x947e0000), SPH_C32(0xbe091400), SPH_C32(0x67860000), + SPH_C32(0xcddc0000), SPH_C32(0x1dce510b), SPH_C32(0xec636924), + SPH_C32(0xa2ffbda7), SPH_C32(0x5a4cc8f4), SPH_C32(0x1cff0000), + SPH_C32(0xcf462200), SPH_C32(0x3dd20000), SPH_C32(0x93d00000), + SPH_C32(0xdafb736b), SPH_C32(0x28f60619), SPH_C32(0xc500c982), + SPH_C32(0xee61b16b) }, + { SPH_C32(0x980c0000), SPH_C32(0xf7ec1b00), SPH_C32(0x25ff0000), + SPH_C32(0x91360000), SPH_C32(0x2e646111), SPH_C32(0xf9e14c30), + SPH_C32(0x375cf6dc), SPH_C32(0xee07c864), SPH_C32(0xe2dd0000), + SPH_C32(0x681e2700), SPH_C32(0x18030000), SPH_C32(0x64b00000), + SPH_C32(0x53ca0bb1), SPH_C32(0x3722fe79), SPH_C32(0x8bd06a97), + SPH_C32(0x4f424ef4) }, + { SPH_C32(0x6a5c0000), SPH_C32(0x19511100), SPH_C32(0x42570000), + SPH_C32(0x3abc0000), SPH_C32(0x94ff29d1), SPH_C32(0xf3b79144), + SPH_C32(0xec2f1eb2), SPH_C32(0xfb6f376b), SPH_C32(0xeeaf0000), + SPH_C32(0x21fb2800), SPH_C32(0x5a7a0000), SPH_C32(0x385a0000), + SPH_C32(0x60603bab), SPH_C32(0x22a0db6d), SPH_C32(0x1e7321ec), + SPH_C32(0xfb094e64) }, + { SPH_C32(0x662e0000), SPH_C32(0x50b41e00), SPH_C32(0x002e0000), + SPH_C32(0x66560000), SPH_C32(0xa75519cb), SPH_C32(0xe635b450), + SPH_C32(0x798c55c9), SPH_C32(0x4f2437fb), SPH_C32(0x108d0000), + SPH_C32(0x86a32d00), SPH_C32(0x7fab0000), SPH_C32(0xcf3a0000), + SPH_C32(0xe9514371), SPH_C32(0x3d74230d), SPH_C32(0x50a382f9), + SPH_C32(0x5a2ab1fb) }, + { SPH_C32(0x695b0000), SPH_C32(0x0dcd0500), SPH_C32(0xa9760000), + SPH_C32(0x03250000), SPH_C32(0x2183248b), SPH_C32(0x61380db7), + SPH_C32(0xd2670d01), SPH_C32(0x40bed715), SPH_C32(0x59e70000), + SPH_C32(0x6af33500), SPH_C32(0xc4b80000), SPH_C32(0xa8980000), + SPH_C32(0xc4376747), SPH_C32(0x0be593cf), SPH_C32(0xd3bc6f32), + SPH_C32(0x315245b4) }, + { SPH_C32(0x65290000), SPH_C32(0x44280a00), SPH_C32(0xeb0f0000), + SPH_C32(0x5fcf0000), SPH_C32(0x12291491), SPH_C32(0x74ba28a3), + SPH_C32(0x47c4467a), SPH_C32(0xf4f5d785), SPH_C32(0xa7c50000), + SPH_C32(0xcdab3000), SPH_C32(0xe1690000), SPH_C32(0x5ff80000), + SPH_C32(0x4d061f9d), SPH_C32(0x14316baf), SPH_C32(0x9d6ccc27), + SPH_C32(0x9071ba2b) }, + { SPH_C32(0x97790000), SPH_C32(0xaa950000), SPH_C32(0x8ca70000), + SPH_C32(0xf4450000), SPH_C32(0xa8b25c51), SPH_C32(0x7eecf5d7), + SPH_C32(0x9cb7ae14), SPH_C32(0xe19d288a), SPH_C32(0xabb70000), + SPH_C32(0x844e3f00), SPH_C32(0xa3100000), SPH_C32(0x03120000), + SPH_C32(0x7eac2f87), SPH_C32(0x01b34ebb), SPH_C32(0x08cf875c), + SPH_C32(0x243ababb) }, + { SPH_C32(0x9b0b0000), SPH_C32(0xe3700f00), SPH_C32(0xcede0000), + SPH_C32(0xa8af0000), SPH_C32(0x9b186c4b), SPH_C32(0x6b6ed0c3), + SPH_C32(0x0914e56f), SPH_C32(0x55d6281a), SPH_C32(0x55950000), + SPH_C32(0x23163a00), SPH_C32(0x86c10000), SPH_C32(0xf4720000), + SPH_C32(0xf79d575d), SPH_C32(0x1e67b6db), SPH_C32(0x461f2449), + SPH_C32(0x85194524) }, + { SPH_C32(0x2c430000), SPH_C32(0xa8781200), SPH_C32(0x501c0000), + SPH_C32(0x386d0000), SPH_C32(0x3f4f30a7), SPH_C32(0x422b9861), + SPH_C32(0xc4dbabb1), SPH_C32(0x9f8d23ca), SPH_C32(0xe1da0000), + SPH_C32(0x7c823300), SPH_C32(0xf3220000), SPH_C32(0x5d290000), + SPH_C32(0xe6b606eb), SPH_C32(0xa5ad628a), SPH_C32(0xb5987924), + SPH_C32(0xf493ae8a) }, + { SPH_C32(0x20310000), SPH_C32(0xe19d1d00), SPH_C32(0x12650000), + SPH_C32(0x64870000), SPH_C32(0x0ce500bd), SPH_C32(0x57a9bd75), + SPH_C32(0x5178e0ca), SPH_C32(0x2bc6235a), SPH_C32(0x1ff80000), + SPH_C32(0xdbda3600), SPH_C32(0xd6f30000), SPH_C32(0xaa490000), + SPH_C32(0x6f877e31), SPH_C32(0xba799aea), SPH_C32(0xfb48da31), + SPH_C32(0x55b05115) }, + { SPH_C32(0xd2610000), SPH_C32(0x0f201700), SPH_C32(0x75cd0000), + SPH_C32(0xcf0d0000), SPH_C32(0xb67e487d), SPH_C32(0x5dff6001), + SPH_C32(0x8a0b08a4), SPH_C32(0x3eaedc55), SPH_C32(0x138a0000), + SPH_C32(0x923f3900), SPH_C32(0x948a0000), SPH_C32(0xf6a30000), + SPH_C32(0x5c2d4e2b), SPH_C32(0xaffbbffe), SPH_C32(0x6eeb914a), + SPH_C32(0xe1fb5185) }, + { SPH_C32(0xde130000), SPH_C32(0x46c51800), SPH_C32(0x37b40000), + SPH_C32(0x93e70000), SPH_C32(0x85d47867), SPH_C32(0x487d4515), + SPH_C32(0x1fa843df), SPH_C32(0x8ae5dcc5), SPH_C32(0xeda80000), + SPH_C32(0x35673c00), SPH_C32(0xb15b0000), SPH_C32(0x01c30000), + SPH_C32(0xd51c36f1), SPH_C32(0xb02f479e), SPH_C32(0x203b325f), + SPH_C32(0x40d8ae1a) }, + { SPH_C32(0xa4c20000), SPH_C32(0xd9372400), SPH_C32(0x0a480000), + SPH_C32(0x66610000), SPH_C32(0xf87a12c7), SPH_C32(0x86bef75c), + SPH_C32(0xa324df94), SPH_C32(0x2ba05a55), SPH_C32(0x75a40000), + SPH_C32(0xc28b2700), SPH_C32(0x94a40000), SPH_C32(0x90f50000), + SPH_C32(0xfb7857e0), SPH_C32(0x49ce0bae), SPH_C32(0x1767c483), + SPH_C32(0xaedf667e) }, + { SPH_C32(0xa8b00000), SPH_C32(0x90d22b00), SPH_C32(0x48310000), + SPH_C32(0x3a8b0000), SPH_C32(0xcbd022dd), SPH_C32(0x933cd248), + SPH_C32(0x368794ef), SPH_C32(0x9feb5ac5), SPH_C32(0x8b860000), + SPH_C32(0x65d32200), SPH_C32(0xb1750000), SPH_C32(0x67950000), + SPH_C32(0x72492f3a), SPH_C32(0x561af3ce), SPH_C32(0x59b76796), + SPH_C32(0x0ffc99e1) }, + { SPH_C32(0x5ae00000), SPH_C32(0x7e6f2100), SPH_C32(0x2f990000), + SPH_C32(0x91010000), SPH_C32(0x714b6a1d), SPH_C32(0x996a0f3c), + SPH_C32(0xedf47c81), SPH_C32(0x8a83a5ca), SPH_C32(0x87f40000), + SPH_C32(0x2c362d00), SPH_C32(0xf30c0000), SPH_C32(0x3b7f0000), + SPH_C32(0x41e31f20), SPH_C32(0x4398d6da), SPH_C32(0xcc142ced), + SPH_C32(0xbbb79971) }, + { SPH_C32(0x56920000), SPH_C32(0x378a2e00), SPH_C32(0x6de00000), + SPH_C32(0xcdeb0000), SPH_C32(0x42e15a07), SPH_C32(0x8ce82a28), + SPH_C32(0x785737fa), SPH_C32(0x3ec8a55a), SPH_C32(0x79d60000), + SPH_C32(0x8b6e2800), SPH_C32(0xd6dd0000), SPH_C32(0xcc1f0000), + SPH_C32(0xc8d267fa), SPH_C32(0x5c4c2eba), SPH_C32(0x82c48ff8), + SPH_C32(0x1a9466ee) }, + { SPH_C32(0xe1da0000), SPH_C32(0x7c823300), SPH_C32(0xf3220000), + SPH_C32(0x5d290000), SPH_C32(0xe6b606eb), SPH_C32(0xa5ad628a), + SPH_C32(0xb5987924), SPH_C32(0xf493ae8a), SPH_C32(0xcd990000), + SPH_C32(0xd4fa2100), SPH_C32(0xa33e0000), SPH_C32(0x65440000), + SPH_C32(0xd9f9364c), SPH_C32(0xe786faeb), SPH_C32(0x7143d295), + SPH_C32(0x6b1e8d40) }, + { SPH_C32(0xeda80000), SPH_C32(0x35673c00), SPH_C32(0xb15b0000), + SPH_C32(0x01c30000), SPH_C32(0xd51c36f1), SPH_C32(0xb02f479e), + SPH_C32(0x203b325f), SPH_C32(0x40d8ae1a), SPH_C32(0x33bb0000), + SPH_C32(0x73a22400), SPH_C32(0x86ef0000), SPH_C32(0x92240000), + SPH_C32(0x50c84e96), SPH_C32(0xf852028b), SPH_C32(0x3f937180), + SPH_C32(0xca3d72df) }, + { SPH_C32(0x1ff80000), SPH_C32(0xdbda3600), SPH_C32(0xd6f30000), + SPH_C32(0xaa490000), SPH_C32(0x6f877e31), SPH_C32(0xba799aea), + SPH_C32(0xfb48da31), SPH_C32(0x55b05115), SPH_C32(0x3fc90000), + SPH_C32(0x3a472b00), SPH_C32(0xc4960000), SPH_C32(0xcece0000), + SPH_C32(0x63627e8c), SPH_C32(0xedd0279f), SPH_C32(0xaa303afb), + SPH_C32(0x7e76724f) }, + { SPH_C32(0x138a0000), SPH_C32(0x923f3900), SPH_C32(0x948a0000), + SPH_C32(0xf6a30000), SPH_C32(0x5c2d4e2b), SPH_C32(0xaffbbffe), + SPH_C32(0x6eeb914a), SPH_C32(0xe1fb5185), SPH_C32(0xc1eb0000), + SPH_C32(0x9d1f2e00), SPH_C32(0xe1470000), SPH_C32(0x39ae0000), + SPH_C32(0xea530656), SPH_C32(0xf204dfff), SPH_C32(0xe4e099ee), + SPH_C32(0xdf558dd0) }, + { SPH_C32(0x1cff0000), SPH_C32(0xcf462200), SPH_C32(0x3dd20000), + SPH_C32(0x93d00000), SPH_C32(0xdafb736b), SPH_C32(0x28f60619), + SPH_C32(0xc500c982), SPH_C32(0xee61b16b), SPH_C32(0x88810000), + SPH_C32(0x714f3600), SPH_C32(0x5a540000), SPH_C32(0x5e0c0000), + SPH_C32(0xc7352260), SPH_C32(0xc4956f3d), SPH_C32(0x67ff7425), + SPH_C32(0xb42d799f) }, + { SPH_C32(0x108d0000), SPH_C32(0x86a32d00), SPH_C32(0x7fab0000), + SPH_C32(0xcf3a0000), SPH_C32(0xe9514371), SPH_C32(0x3d74230d), + SPH_C32(0x50a382f9), SPH_C32(0x5a2ab1fb), SPH_C32(0x76a30000), + SPH_C32(0xd6173300), SPH_C32(0x7f850000), SPH_C32(0xa96c0000), + SPH_C32(0x4e045aba), SPH_C32(0xdb41975d), SPH_C32(0x292fd730), + SPH_C32(0x150e8600) }, + { SPH_C32(0xe2dd0000), SPH_C32(0x681e2700), SPH_C32(0x18030000), + SPH_C32(0x64b00000), SPH_C32(0x53ca0bb1), SPH_C32(0x3722fe79), + SPH_C32(0x8bd06a97), SPH_C32(0x4f424ef4), SPH_C32(0x7ad10000), + SPH_C32(0x9ff23c00), SPH_C32(0x3dfc0000), SPH_C32(0xf5860000), + SPH_C32(0x7dae6aa0), SPH_C32(0xcec3b249), SPH_C32(0xbc8c9c4b), + SPH_C32(0xa1458690) }, + { SPH_C32(0xeeaf0000), SPH_C32(0x21fb2800), SPH_C32(0x5a7a0000), + SPH_C32(0x385a0000), SPH_C32(0x60603bab), SPH_C32(0x22a0db6d), + SPH_C32(0x1e7321ec), SPH_C32(0xfb094e64), SPH_C32(0x84f30000), + SPH_C32(0x38aa3900), SPH_C32(0x182d0000), SPH_C32(0x02e60000), + SPH_C32(0xf49f127a), SPH_C32(0xd1174a29), SPH_C32(0xf25c3f5e), + SPH_C32(0x0066790f) }, + { SPH_C32(0x59e70000), SPH_C32(0x6af33500), SPH_C32(0xc4b80000), + SPH_C32(0xa8980000), SPH_C32(0xc4376747), SPH_C32(0x0be593cf), + SPH_C32(0xd3bc6f32), SPH_C32(0x315245b4), SPH_C32(0x30bc0000), + SPH_C32(0x673e3000), SPH_C32(0x6dce0000), SPH_C32(0xabbd0000), + SPH_C32(0xe5b443cc), SPH_C32(0x6add9e78), SPH_C32(0x01db6233), + SPH_C32(0x71ec92a1) }, + { SPH_C32(0x55950000), SPH_C32(0x23163a00), SPH_C32(0x86c10000), + SPH_C32(0xf4720000), SPH_C32(0xf79d575d), SPH_C32(0x1e67b6db), + SPH_C32(0x461f2449), SPH_C32(0x85194524), SPH_C32(0xce9e0000), + SPH_C32(0xc0663500), SPH_C32(0x481f0000), SPH_C32(0x5cdd0000), + SPH_C32(0x6c853b16), SPH_C32(0x75096618), SPH_C32(0x4f0bc126), + SPH_C32(0xd0cf6d3e) }, + { SPH_C32(0xa7c50000), SPH_C32(0xcdab3000), SPH_C32(0xe1690000), + SPH_C32(0x5ff80000), SPH_C32(0x4d061f9d), SPH_C32(0x14316baf), + SPH_C32(0x9d6ccc27), SPH_C32(0x9071ba2b), SPH_C32(0xc2ec0000), + SPH_C32(0x89833a00), SPH_C32(0x0a660000), SPH_C32(0x00370000), + SPH_C32(0x5f2f0b0c), SPH_C32(0x608b430c), SPH_C32(0xdaa88a5d), + SPH_C32(0x64846dae) }, + { SPH_C32(0xabb70000), SPH_C32(0x844e3f00), SPH_C32(0xa3100000), + SPH_C32(0x03120000), SPH_C32(0x7eac2f87), SPH_C32(0x01b34ebb), + SPH_C32(0x08cf875c), SPH_C32(0x243ababb), SPH_C32(0x3cce0000), + SPH_C32(0x2edb3f00), SPH_C32(0x2fb70000), SPH_C32(0xf7570000), + SPH_C32(0xd61e73d6), SPH_C32(0x7f5fbb6c), SPH_C32(0x94782948), + SPH_C32(0xc5a79231) }, + { SPH_C32(0x75c90003), SPH_C32(0x0e10c000), SPH_C32(0xd1200000), + SPH_C32(0xbaea0000), SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), + SPH_C32(0xbb28761d), SPH_C32(0x00b72e2b), SPH_C32(0xeecf0001), + SPH_C32(0x6f564000), SPH_C32(0xf33e0000), SPH_C32(0xa79e0000), + SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), SPH_C32(0x4a3b40ba), + SPH_C32(0xfeabf254) }, + { SPH_C32(0x79bb0003), SPH_C32(0x47f5cf00), SPH_C32(0x93590000), + SPH_C32(0xe6000000), SPH_C32(0xb86e1f24), SPH_C32(0x92da9243), + SPH_C32(0x2e8b3d66), SPH_C32(0xb4fc2ebb), SPH_C32(0x10ed0001), + SPH_C32(0xc80e4500), SPH_C32(0xd6ef0000), SPH_C32(0x50fe0000), + SPH_C32(0x34840ac3), SPH_C32(0xa8c513a5), SPH_C32(0x04ebe3af), + SPH_C32(0x5f880dcb) }, + { SPH_C32(0x8beb0003), SPH_C32(0xa948c500), SPH_C32(0xf4f10000), + SPH_C32(0x4d8a0000), SPH_C32(0x02f557e4), SPH_C32(0x988c4f37), + SPH_C32(0xf5f8d508), SPH_C32(0xa194d1b4), SPH_C32(0x1c9f0001), + SPH_C32(0x81eb4a00), SPH_C32(0x94960000), SPH_C32(0x0c140000), + SPH_C32(0x072e3ad9), SPH_C32(0xbd4736b1), SPH_C32(0x9148a8d4), + SPH_C32(0xebc30d5b) }, + { SPH_C32(0x87990003), SPH_C32(0xe0adca00), SPH_C32(0xb6880000), + SPH_C32(0x11600000), SPH_C32(0x315f67fe), SPH_C32(0x8d0e6a23), + SPH_C32(0x605b9e73), SPH_C32(0x15dfd124), SPH_C32(0xe2bd0001), + SPH_C32(0x26b34f00), SPH_C32(0xb1470000), SPH_C32(0xfb740000), + SPH_C32(0x8e1f4203), SPH_C32(0xa293ced1), SPH_C32(0xdf980bc1), + SPH_C32(0x4ae0f2c4) }, + { SPH_C32(0x30d10003), SPH_C32(0xaba5d700), SPH_C32(0x284a0000), + SPH_C32(0x81a20000), SPH_C32(0x95083b12), SPH_C32(0xa44b2281), + SPH_C32(0xad94d0ad), SPH_C32(0xdf84daf4), SPH_C32(0x56f20001), + SPH_C32(0x79274600), SPH_C32(0xc4a40000), SPH_C32(0x522f0000), + SPH_C32(0x9f3413b5), SPH_C32(0x19591a80), SPH_C32(0x2c1f56ac), + SPH_C32(0x3b6a196a) }, + { SPH_C32(0x3ca30003), SPH_C32(0xe240d800), SPH_C32(0x6a330000), + SPH_C32(0xdd480000), SPH_C32(0xa6a20b08), SPH_C32(0xb1c90795), + SPH_C32(0x38379bd6), SPH_C32(0x6bcfda64), SPH_C32(0xa8d00001), + SPH_C32(0xde7f4300), SPH_C32(0xe1750000), SPH_C32(0xa54f0000), + SPH_C32(0x16056b6f), SPH_C32(0x068de2e0), SPH_C32(0x62cff5b9), + SPH_C32(0x9a49e6f5) }, + { SPH_C32(0xcef30003), SPH_C32(0x0cfdd200), SPH_C32(0x0d9b0000), + SPH_C32(0x76c20000), SPH_C32(0x1c3943c8), SPH_C32(0xbb9fdae1), + SPH_C32(0xe34473b8), SPH_C32(0x7ea7256b), SPH_C32(0xa4a20001), + SPH_C32(0x979a4c00), SPH_C32(0xa30c0000), SPH_C32(0xf9a50000), + SPH_C32(0x25af5b75), SPH_C32(0x130fc7f4), SPH_C32(0xf76cbec2), + SPH_C32(0x2e02e665) }, + { SPH_C32(0xc2810003), SPH_C32(0x4518dd00), SPH_C32(0x4fe20000), + SPH_C32(0x2a280000), SPH_C32(0x2f9373d2), SPH_C32(0xae1dfff5), + SPH_C32(0x76e738c3), SPH_C32(0xcaec25fb), SPH_C32(0x5a800001), + SPH_C32(0x30c24900), SPH_C32(0x86dd0000), SPH_C32(0x0ec50000), + SPH_C32(0xac9e23af), SPH_C32(0x0cdb3f94), SPH_C32(0xb9bc1dd7), + SPH_C32(0x8f2119fa) }, + { SPH_C32(0xcdf40003), SPH_C32(0x1861c600), SPH_C32(0xe6ba0000), + SPH_C32(0x4f5b0000), SPH_C32(0xa9454e92), SPH_C32(0x29104612), + SPH_C32(0xdd0c600b), SPH_C32(0xc576c515), SPH_C32(0x13ea0001), + SPH_C32(0xdc925100), SPH_C32(0x3dce0000), SPH_C32(0x69670000), + SPH_C32(0x81f80799), SPH_C32(0x3a4a8f56), SPH_C32(0x3aa3f01c), + SPH_C32(0xe459edb5) }, + { SPH_C32(0xc1860003), SPH_C32(0x5184c900), SPH_C32(0xa4c30000), + SPH_C32(0x13b10000), SPH_C32(0x9aef7e88), SPH_C32(0x3c926306), + SPH_C32(0x48af2b70), SPH_C32(0x713dc585), SPH_C32(0xedc80001), + SPH_C32(0x7bca5400), SPH_C32(0x181f0000), SPH_C32(0x9e070000), + SPH_C32(0x08c97f43), SPH_C32(0x259e7736), SPH_C32(0x74735309), + SPH_C32(0x457a122a) }, + { SPH_C32(0x33d60003), SPH_C32(0xbf39c300), SPH_C32(0xc36b0000), + SPH_C32(0xb83b0000), SPH_C32(0x20743648), SPH_C32(0x36c4be72), + SPH_C32(0x93dcc31e), SPH_C32(0x64553a8a), SPH_C32(0xe1ba0001), + SPH_C32(0x322f5b00), SPH_C32(0x5a660000), SPH_C32(0xc2ed0000), + SPH_C32(0x3b634f59), SPH_C32(0x301c5222), SPH_C32(0xe1d01872), + SPH_C32(0xf13112ba) }, + { SPH_C32(0x3fa40003), SPH_C32(0xf6dccc00), SPH_C32(0x81120000), + SPH_C32(0xe4d10000), SPH_C32(0x13de0652), SPH_C32(0x23469b66), + SPH_C32(0x067f8865), SPH_C32(0xd01e3a1a), SPH_C32(0x1f980001), + SPH_C32(0x95775e00), SPH_C32(0x7fb70000), SPH_C32(0x358d0000), + SPH_C32(0xb2523783), SPH_C32(0x2fc8aa42), SPH_C32(0xaf00bb67), + SPH_C32(0x5012ed25) }, + { SPH_C32(0x88ec0003), SPH_C32(0xbdd4d100), SPH_C32(0x1fd00000), + SPH_C32(0x74130000), SPH_C32(0xb7895abe), SPH_C32(0x0a03d3c4), + SPH_C32(0xcbb0c6bb), SPH_C32(0x1a4531ca), SPH_C32(0xabd70001), + SPH_C32(0xcae35700), SPH_C32(0x0a540000), SPH_C32(0x9cd60000), + SPH_C32(0xa3796635), SPH_C32(0x94027e13), SPH_C32(0x5c87e60a), + SPH_C32(0x2198068b) }, + { SPH_C32(0x849e0003), SPH_C32(0xf431de00), SPH_C32(0x5da90000), + SPH_C32(0x28f90000), SPH_C32(0x84236aa4), SPH_C32(0x1f81f6d0), + SPH_C32(0x5e138dc0), SPH_C32(0xae0e315a), SPH_C32(0x55f50001), + SPH_C32(0x6dbb5200), SPH_C32(0x2f850000), SPH_C32(0x6bb60000), + SPH_C32(0x2a481eef), SPH_C32(0x8bd68673), SPH_C32(0x1257451f), + SPH_C32(0x80bbf914) }, + { SPH_C32(0x76ce0003), SPH_C32(0x1a8cd400), SPH_C32(0x3a010000), + SPH_C32(0x83730000), SPH_C32(0x3eb82264), SPH_C32(0x15d72ba4), + SPH_C32(0x856065ae), SPH_C32(0xbb66ce55), SPH_C32(0x59870001), + SPH_C32(0x245e5d00), SPH_C32(0x6dfc0000), SPH_C32(0x375c0000), + SPH_C32(0x19e22ef5), SPH_C32(0x9e54a367), SPH_C32(0x87f40e64), + SPH_C32(0x34f0f984) }, + { SPH_C32(0x7abc0003), SPH_C32(0x5369db00), SPH_C32(0x78780000), + SPH_C32(0xdf990000), SPH_C32(0x0d12127e), SPH_C32(0x00550eb0), + SPH_C32(0x10c32ed5), SPH_C32(0x0f2dcec5), SPH_C32(0xa7a50001), + SPH_C32(0x83065800), SPH_C32(0x482d0000), SPH_C32(0xc03c0000), + SPH_C32(0x90d3562f), SPH_C32(0x81805b07), SPH_C32(0xc924ad71), + SPH_C32(0x95d3061b) }, + { SPH_C32(0x006d0003), SPH_C32(0xcc9be700), SPH_C32(0x45840000), + SPH_C32(0x2a1f0000), SPH_C32(0x70bc78de), SPH_C32(0xce96bcf9), + SPH_C32(0xac4fb29e), SPH_C32(0xae684855), SPH_C32(0x3fa90001), + SPH_C32(0x74ea4300), SPH_C32(0x6dd20000), SPH_C32(0x510a0000), + SPH_C32(0xbeb7373e), SPH_C32(0x78611737), SPH_C32(0xfe785bad), + SPH_C32(0x7bd4ce7f) }, + { SPH_C32(0x0c1f0003), SPH_C32(0x857ee800), SPH_C32(0x07fd0000), + SPH_C32(0x76f50000), SPH_C32(0x431648c4), SPH_C32(0xdb1499ed), + SPH_C32(0x39ecf9e5), SPH_C32(0x1a2348c5), SPH_C32(0xc18b0001), + SPH_C32(0xd3b24600), SPH_C32(0x48030000), SPH_C32(0xa66a0000), + SPH_C32(0x37864fe4), SPH_C32(0x67b5ef57), SPH_C32(0xb0a8f8b8), + SPH_C32(0xdaf731e0) }, + { SPH_C32(0xfe4f0003), SPH_C32(0x6bc3e200), SPH_C32(0x60550000), + SPH_C32(0xdd7f0000), SPH_C32(0xf98d0004), SPH_C32(0xd1424499), + SPH_C32(0xe29f118b), SPH_C32(0x0f4bb7ca), SPH_C32(0xcdf90001), + SPH_C32(0x9a574900), SPH_C32(0x0a7a0000), SPH_C32(0xfa800000), + SPH_C32(0x042c7ffe), SPH_C32(0x7237ca43), SPH_C32(0x250bb3c3), + SPH_C32(0x6ebc3170) }, + { SPH_C32(0xf23d0003), SPH_C32(0x2226ed00), SPH_C32(0x222c0000), + SPH_C32(0x81950000), SPH_C32(0xca27301e), SPH_C32(0xc4c0618d), + SPH_C32(0x773c5af0), SPH_C32(0xbb00b75a), SPH_C32(0x33db0001), + SPH_C32(0x3d0f4c00), SPH_C32(0x2fab0000), SPH_C32(0x0de00000), + SPH_C32(0x8d1d0724), SPH_C32(0x6de33223), SPH_C32(0x6bdb10d6), + SPH_C32(0xcf9fceef) }, + { SPH_C32(0x45750003), SPH_C32(0x692ef000), SPH_C32(0xbcee0000), + SPH_C32(0x11570000), SPH_C32(0x6e706cf2), SPH_C32(0xed85292f), + SPH_C32(0xbaf3142e), SPH_C32(0x715bbc8a), SPH_C32(0x87940001), + SPH_C32(0x629b4500), SPH_C32(0x5a480000), SPH_C32(0xa4bb0000), + SPH_C32(0x9c365692), SPH_C32(0xd629e672), SPH_C32(0x985c4dbb), + SPH_C32(0xbe152541) }, + { SPH_C32(0x49070003), SPH_C32(0x20cbff00), SPH_C32(0xfe970000), + SPH_C32(0x4dbd0000), SPH_C32(0x5dda5ce8), SPH_C32(0xf8070c3b), + SPH_C32(0x2f505f55), SPH_C32(0xc510bc1a), SPH_C32(0x79b60001), + SPH_C32(0xc5c34000), SPH_C32(0x7f990000), SPH_C32(0x53db0000), + SPH_C32(0x15072e48), SPH_C32(0xc9fd1e12), SPH_C32(0xd68ceeae), + SPH_C32(0x1f36dade) }, + { SPH_C32(0xbb570003), SPH_C32(0xce76f500), SPH_C32(0x993f0000), + SPH_C32(0xe6370000), SPH_C32(0xe7411428), SPH_C32(0xf251d14f), + SPH_C32(0xf423b73b), SPH_C32(0xd0784315), SPH_C32(0x75c40001), + SPH_C32(0x8c264f00), SPH_C32(0x3de00000), SPH_C32(0x0f310000), + SPH_C32(0x26ad1e52), SPH_C32(0xdc7f3b06), SPH_C32(0x432fa5d5), + SPH_C32(0xab7dda4e) }, + { SPH_C32(0xb7250003), SPH_C32(0x8793fa00), SPH_C32(0xdb460000), + SPH_C32(0xbadd0000), SPH_C32(0xd4eb2432), SPH_C32(0xe7d3f45b), + SPH_C32(0x6180fc40), SPH_C32(0x64334385), SPH_C32(0x8be60001), + SPH_C32(0x2b7e4a00), SPH_C32(0x18310000), SPH_C32(0xf8510000), + SPH_C32(0xaf9c6688), SPH_C32(0xc3abc366), SPH_C32(0x0dff06c0), + SPH_C32(0x0a5e25d1) }, + { SPH_C32(0xb8500003), SPH_C32(0xdaeae100), SPH_C32(0x721e0000), + SPH_C32(0xdfae0000), SPH_C32(0x523d1972), SPH_C32(0x60de4dbc), + SPH_C32(0xca6ba488), SPH_C32(0x6ba9a36b), SPH_C32(0xc28c0001), + SPH_C32(0xc72e5200), SPH_C32(0xa3220000), SPH_C32(0x9ff30000), + SPH_C32(0x82fa42be), SPH_C32(0xf53a73a4), SPH_C32(0x8ee0eb0b), + SPH_C32(0x6126d19e) }, + { SPH_C32(0xb4220003), SPH_C32(0x930fee00), SPH_C32(0x30670000), + SPH_C32(0x83440000), SPH_C32(0x61972968), SPH_C32(0x755c68a8), + SPH_C32(0x5fc8eff3), SPH_C32(0xdfe2a3fb), SPH_C32(0x3cae0001), + SPH_C32(0x60765700), SPH_C32(0x86f30000), SPH_C32(0x68930000), + SPH_C32(0x0bcb3a64), SPH_C32(0xeaee8bc4), SPH_C32(0xc030481e), + SPH_C32(0xc0052e01) }, + { SPH_C32(0x46720003), SPH_C32(0x7db2e400), SPH_C32(0x57cf0000), + SPH_C32(0x28ce0000), SPH_C32(0xdb0c61a8), SPH_C32(0x7f0ab5dc), + SPH_C32(0x84bb079d), SPH_C32(0xca8a5cf4), SPH_C32(0x30dc0001), + SPH_C32(0x29935800), SPH_C32(0xc48a0000), SPH_C32(0x34790000), + SPH_C32(0x38610a7e), SPH_C32(0xff6caed0), SPH_C32(0x55930365), + SPH_C32(0x744e2e91) }, + { SPH_C32(0x4a000003), SPH_C32(0x3457eb00), SPH_C32(0x15b60000), + SPH_C32(0x74240000), SPH_C32(0xe8a651b2), SPH_C32(0x6a8890c8), + SPH_C32(0x11184ce6), SPH_C32(0x7ec15c64), SPH_C32(0xcefe0001), + SPH_C32(0x8ecb5d00), SPH_C32(0xe15b0000), SPH_C32(0xc3190000), + SPH_C32(0xb15072a4), SPH_C32(0xe0b856b0), SPH_C32(0x1b43a070), + SPH_C32(0xd56dd10e) }, + { SPH_C32(0xfd480003), SPH_C32(0x7f5ff600), SPH_C32(0x8b740000), + SPH_C32(0xe4e60000), SPH_C32(0x4cf10d5e), SPH_C32(0x43cdd86a), + SPH_C32(0xdcd70238), SPH_C32(0xb49a57b4), SPH_C32(0x7ab10001), + SPH_C32(0xd15f5400), SPH_C32(0x94b80000), SPH_C32(0x6a420000), + SPH_C32(0xa07b2312), SPH_C32(0x5b7282e1), SPH_C32(0xe8c4fd1d), + SPH_C32(0xa4e73aa0) }, + { SPH_C32(0xf13a0003), SPH_C32(0x36baf900), SPH_C32(0xc90d0000), + SPH_C32(0xb80c0000), SPH_C32(0x7f5b3d44), SPH_C32(0x564ffd7e), + SPH_C32(0x49744943), SPH_C32(0x00d15724), SPH_C32(0x84930001), + SPH_C32(0x76075100), SPH_C32(0xb1690000), SPH_C32(0x9d220000), + SPH_C32(0x294a5bc8), SPH_C32(0x44a67a81), SPH_C32(0xa6145e08), + SPH_C32(0x05c4c53f) }, + { SPH_C32(0x036a0003), SPH_C32(0xd807f300), SPH_C32(0xaea50000), + SPH_C32(0x13860000), SPH_C32(0xc5c07584), SPH_C32(0x5c19200a), + SPH_C32(0x9207a12d), SPH_C32(0x15b9a82b), SPH_C32(0x88e10001), + SPH_C32(0x3fe25e00), SPH_C32(0xf3100000), SPH_C32(0xc1c80000), + SPH_C32(0x1ae06bd2), SPH_C32(0x51245f95), SPH_C32(0x33b71573), + SPH_C32(0xb18fc5af) }, + { SPH_C32(0x0f180003), SPH_C32(0x91e2fc00), SPH_C32(0xecdc0000), + SPH_C32(0x4f6c0000), SPH_C32(0xf66a459e), SPH_C32(0x499b051e), + SPH_C32(0x07a4ea56), SPH_C32(0xa1f2a8bb), SPH_C32(0x76c30001), + SPH_C32(0x98ba5b00), SPH_C32(0xd6c10000), SPH_C32(0x36a80000), + SPH_C32(0x93d11308), SPH_C32(0x4ef0a7f5), SPH_C32(0x7d67b666), + SPH_C32(0x10ac3a30) }, + { SPH_C32(0xa4af0003), SPH_C32(0x15acc300), SPH_C32(0x4fcc0000), + SPH_C32(0x4c7e0000), SPH_C32(0x88c66a19), SPH_C32(0x48284ba5), + SPH_C32(0x0f6b6d0a), SPH_C32(0x85c81200), SPH_C32(0x4a0d0001), + SPH_C32(0xb6616400), SPH_C32(0xf9760000), SPH_C32(0xc1ff0000), + SPH_C32(0x45cf60de), SPH_C32(0x31af1c99), SPH_C32(0xe91f9f2e), + SPH_C32(0xd50ba801) }, + { SPH_C32(0xa8dd0003), SPH_C32(0x5c49cc00), SPH_C32(0x0db50000), + SPH_C32(0x10940000), SPH_C32(0xbb6c5a03), SPH_C32(0x5daa6eb1), + SPH_C32(0x9ac82671), SPH_C32(0x31831290), SPH_C32(0xb42f0001), + SPH_C32(0x11396100), SPH_C32(0xdca70000), SPH_C32(0x369f0000), + SPH_C32(0xccfe1804), SPH_C32(0x2e7be4f9), SPH_C32(0xa7cf3c3b), + SPH_C32(0x7428579e) }, + { SPH_C32(0x5a8d0003), SPH_C32(0xb2f4c600), SPH_C32(0x6a1d0000), + SPH_C32(0xbb1e0000), SPH_C32(0x01f712c3), SPH_C32(0x57fcb3c5), + SPH_C32(0x41bbce1f), SPH_C32(0x24ebed9f), SPH_C32(0xb85d0001), + SPH_C32(0x58dc6e00), SPH_C32(0x9ede0000), SPH_C32(0x6a750000), + SPH_C32(0xff54281e), SPH_C32(0x3bf9c1ed), SPH_C32(0x326c7740), + SPH_C32(0xc063570e) }, + { SPH_C32(0x56ff0003), SPH_C32(0xfb11c900), SPH_C32(0x28640000), + SPH_C32(0xe7f40000), SPH_C32(0x325d22d9), SPH_C32(0x427e96d1), + SPH_C32(0xd4188564), SPH_C32(0x90a0ed0f), SPH_C32(0x467f0001), + SPH_C32(0xff846b00), SPH_C32(0xbb0f0000), SPH_C32(0x9d150000), + SPH_C32(0x766550c4), SPH_C32(0x242d398d), SPH_C32(0x7cbcd455), + SPH_C32(0x6140a891) }, + { SPH_C32(0xe1b70003), SPH_C32(0xb019d400), SPH_C32(0xb6a60000), + SPH_C32(0x77360000), SPH_C32(0x960a7e35), SPH_C32(0x6b3bde73), + SPH_C32(0x19d7cbba), SPH_C32(0x5afbe6df), SPH_C32(0xf2300001), + SPH_C32(0xa0106200), SPH_C32(0xceec0000), SPH_C32(0x344e0000), + SPH_C32(0x674e0172), SPH_C32(0x9fe7eddc), SPH_C32(0x8f3b8938), + SPH_C32(0x10ca433f) }, + { SPH_C32(0xedc50003), SPH_C32(0xf9fcdb00), SPH_C32(0xf4df0000), + SPH_C32(0x2bdc0000), SPH_C32(0xa5a04e2f), SPH_C32(0x7eb9fb67), + SPH_C32(0x8c7480c1), SPH_C32(0xeeb0e64f), SPH_C32(0x0c120001), + SPH_C32(0x07486700), SPH_C32(0xeb3d0000), SPH_C32(0xc32e0000), + SPH_C32(0xee7f79a8), SPH_C32(0x803315bc), SPH_C32(0xc1eb2a2d), + SPH_C32(0xb1e9bca0) }, + { SPH_C32(0x1f950003), SPH_C32(0x1741d100), SPH_C32(0x93770000), + SPH_C32(0x80560000), SPH_C32(0x1f3b06ef), SPH_C32(0x74ef2613), + SPH_C32(0x570768af), SPH_C32(0xfbd81940), SPH_C32(0x00600001), + SPH_C32(0x4ead6800), SPH_C32(0xa9440000), SPH_C32(0x9fc40000), + SPH_C32(0xddd549b2), SPH_C32(0x95b130a8), SPH_C32(0x54486156), + SPH_C32(0x05a2bc30) }, + { SPH_C32(0x13e70003), SPH_C32(0x5ea4de00), SPH_C32(0xd10e0000), + SPH_C32(0xdcbc0000), SPH_C32(0x2c9136f5), SPH_C32(0x616d0307), + SPH_C32(0xc2a423d4), SPH_C32(0x4f9319d0), SPH_C32(0xfe420001), + SPH_C32(0xe9f56d00), SPH_C32(0x8c950000), SPH_C32(0x68a40000), + SPH_C32(0x54e43168), SPH_C32(0x8a65c8c8), SPH_C32(0x1a98c243), + SPH_C32(0xa48143af) }, + { SPH_C32(0x1c920003), SPH_C32(0x03ddc500), SPH_C32(0x78560000), + SPH_C32(0xb9cf0000), SPH_C32(0xaa470bb5), SPH_C32(0xe660bae0), + SPH_C32(0x694f7b1c), SPH_C32(0x4009f93e), SPH_C32(0xb7280001), + SPH_C32(0x05a57500), SPH_C32(0x37860000), SPH_C32(0x0f060000), + SPH_C32(0x7982155e), SPH_C32(0xbcf4780a), SPH_C32(0x99872f88), + SPH_C32(0xcff9b7e0) }, + { SPH_C32(0x10e00003), SPH_C32(0x4a38ca00), SPH_C32(0x3a2f0000), + SPH_C32(0xe5250000), SPH_C32(0x99ed3baf), SPH_C32(0xf3e29ff4), + SPH_C32(0xfcec3067), SPH_C32(0xf442f9ae), SPH_C32(0x490a0001), + SPH_C32(0xa2fd7000), SPH_C32(0x12570000), SPH_C32(0xf8660000), + SPH_C32(0xf0b36d84), SPH_C32(0xa320806a), SPH_C32(0xd7578c9d), + SPH_C32(0x6eda487f) }, + { SPH_C32(0xe2b00003), SPH_C32(0xa485c000), SPH_C32(0x5d870000), + SPH_C32(0x4eaf0000), SPH_C32(0x2376736f), SPH_C32(0xf9b44280), + SPH_C32(0x279fd809), SPH_C32(0xe12a06a1), SPH_C32(0x45780001), + SPH_C32(0xeb187f00), SPH_C32(0x502e0000), SPH_C32(0xa48c0000), + SPH_C32(0xc3195d9e), SPH_C32(0xb6a2a57e), SPH_C32(0x42f4c7e6), + SPH_C32(0xda9148ef) }, + { SPH_C32(0xeec20003), SPH_C32(0xed60cf00), SPH_C32(0x1ffe0000), + SPH_C32(0x12450000), SPH_C32(0x10dc4375), SPH_C32(0xec366794), + SPH_C32(0xb23c9372), SPH_C32(0x55610631), SPH_C32(0xbb5a0001), + SPH_C32(0x4c407a00), SPH_C32(0x75ff0000), SPH_C32(0x53ec0000), + SPH_C32(0x4a282544), SPH_C32(0xa9765d1e), SPH_C32(0x0c2464f3), + SPH_C32(0x7bb2b770) }, + { SPH_C32(0x598a0003), SPH_C32(0xa668d200), SPH_C32(0x813c0000), + SPH_C32(0x82870000), SPH_C32(0xb48b1f99), SPH_C32(0xc5732f36), + SPH_C32(0x7ff3ddac), SPH_C32(0x9f3a0de1), SPH_C32(0x0f150001), + SPH_C32(0x13d47300), SPH_C32(0x001c0000), SPH_C32(0xfab70000), + SPH_C32(0x5b0374f2), SPH_C32(0x12bc894f), SPH_C32(0xffa3399e), + SPH_C32(0x0a385cde) }, + { SPH_C32(0x55f80003), SPH_C32(0xef8ddd00), SPH_C32(0xc3450000), + SPH_C32(0xde6d0000), SPH_C32(0x87212f83), SPH_C32(0xd0f10a22), + SPH_C32(0xea5096d7), SPH_C32(0x2b710d71), SPH_C32(0xf1370001), + SPH_C32(0xb48c7600), SPH_C32(0x25cd0000), SPH_C32(0x0dd70000), + SPH_C32(0xd2320c28), SPH_C32(0x0d68712f), SPH_C32(0xb1739a8b), + SPH_C32(0xab1ba341) }, + { SPH_C32(0xa7a80003), SPH_C32(0x0130d700), SPH_C32(0xa4ed0000), + SPH_C32(0x75e70000), SPH_C32(0x3dba6743), SPH_C32(0xdaa7d756), + SPH_C32(0x31237eb9), SPH_C32(0x3e19f27e), SPH_C32(0xfd450001), + SPH_C32(0xfd697900), SPH_C32(0x67b40000), SPH_C32(0x513d0000), + SPH_C32(0xe1983c32), SPH_C32(0x18ea543b), SPH_C32(0x24d0d1f0), + SPH_C32(0x1f50a3d1) }, + { SPH_C32(0xabda0003), SPH_C32(0x48d5d800), SPH_C32(0xe6940000), + SPH_C32(0x290d0000), SPH_C32(0x0e105759), SPH_C32(0xcf25f242), + SPH_C32(0xa48035c2), SPH_C32(0x8a52f2ee), SPH_C32(0x03670001), + SPH_C32(0x5a317c00), SPH_C32(0x42650000), SPH_C32(0xa65d0000), + SPH_C32(0x68a944e8), SPH_C32(0x073eac5b), SPH_C32(0x6a0072e5), + SPH_C32(0xbe735c4e) }, + { SPH_C32(0xd10b0003), SPH_C32(0xd727e400), SPH_C32(0xdb680000), + SPH_C32(0xdc8b0000), SPH_C32(0x73be3df9), SPH_C32(0x01e6400b), + SPH_C32(0x180ca989), SPH_C32(0x2b17747e), SPH_C32(0x9b6b0001), + SPH_C32(0xaddd6700), SPH_C32(0x679a0000), SPH_C32(0x376b0000), + SPH_C32(0x46cd25f9), SPH_C32(0xfedfe06b), SPH_C32(0x5d5c8439), + SPH_C32(0x5074942a) }, + { SPH_C32(0xdd790003), SPH_C32(0x9ec2eb00), SPH_C32(0x99110000), + SPH_C32(0x80610000), SPH_C32(0x40140de3), SPH_C32(0x1464651f), + SPH_C32(0x8dafe2f2), SPH_C32(0x9f5c74ee), SPH_C32(0x65490001), + SPH_C32(0x0a856200), SPH_C32(0x424b0000), SPH_C32(0xc00b0000), + SPH_C32(0xcffc5d23), SPH_C32(0xe10b180b), SPH_C32(0x138c272c), + SPH_C32(0xf1576bb5) }, + { SPH_C32(0x2f290003), SPH_C32(0x707fe100), SPH_C32(0xfeb90000), + SPH_C32(0x2beb0000), SPH_C32(0xfa8f4523), SPH_C32(0x1e32b86b), + SPH_C32(0x56dc0a9c), SPH_C32(0x8a348be1), SPH_C32(0x693b0001), + SPH_C32(0x43606d00), SPH_C32(0x00320000), SPH_C32(0x9ce10000), + SPH_C32(0xfc566d39), SPH_C32(0xf4893d1f), SPH_C32(0x862f6c57), + SPH_C32(0x451c6b25) }, + { SPH_C32(0x235b0003), SPH_C32(0x399aee00), SPH_C32(0xbcc00000), + SPH_C32(0x77010000), SPH_C32(0xc9257539), SPH_C32(0x0bb09d7f), + SPH_C32(0xc37f41e7), SPH_C32(0x3e7f8b71), SPH_C32(0x97190001), + SPH_C32(0xe4386800), SPH_C32(0x25e30000), SPH_C32(0x6b810000), + SPH_C32(0x756715e3), SPH_C32(0xeb5dc57f), SPH_C32(0xc8ffcf42), + SPH_C32(0xe43f94ba) }, + { SPH_C32(0x94130003), SPH_C32(0x7292f300), SPH_C32(0x22020000), + SPH_C32(0xe7c30000), SPH_C32(0x6d7229d5), SPH_C32(0x22f5d5dd), + SPH_C32(0x0eb00f39), SPH_C32(0xf42480a1), SPH_C32(0x23560001), + SPH_C32(0xbbac6100), SPH_C32(0x50000000), SPH_C32(0xc2da0000), + SPH_C32(0x644c4455), SPH_C32(0x5097112e), SPH_C32(0x3b78922f), + SPH_C32(0x95b57f14) }, + { SPH_C32(0x98610003), SPH_C32(0x3b77fc00), SPH_C32(0x607b0000), + SPH_C32(0xbb290000), SPH_C32(0x5ed819cf), SPH_C32(0x3777f0c9), + SPH_C32(0x9b134442), SPH_C32(0x406f8031), SPH_C32(0xdd740001), + SPH_C32(0x1cf46400), SPH_C32(0x75d10000), SPH_C32(0x35ba0000), + SPH_C32(0xed7d3c8f), SPH_C32(0x4f43e94e), SPH_C32(0x75a8313a), + SPH_C32(0x3496808b) }, + { SPH_C32(0x6a310003), SPH_C32(0xd5caf600), SPH_C32(0x07d30000), + SPH_C32(0x10a30000), SPH_C32(0xe443510f), SPH_C32(0x3d212dbd), + SPH_C32(0x4060ac2c), SPH_C32(0x55077f3e), SPH_C32(0xd1060001), + SPH_C32(0x55116b00), SPH_C32(0x37a80000), SPH_C32(0x69500000), + SPH_C32(0xded70c95), SPH_C32(0x5ac1cc5a), SPH_C32(0xe00b7a41), + SPH_C32(0x80dd801b) }, + { SPH_C32(0x66430003), SPH_C32(0x9c2ff900), SPH_C32(0x45aa0000), + SPH_C32(0x4c490000), SPH_C32(0xd7e96115), SPH_C32(0x28a308a9), + SPH_C32(0xd5c3e757), SPH_C32(0xe14c7fae), SPH_C32(0x2f240001), + SPH_C32(0xf2496e00), SPH_C32(0x12790000), SPH_C32(0x9e300000), + SPH_C32(0x57e6744f), SPH_C32(0x4515343a), SPH_C32(0xaedbd954), + SPH_C32(0x21fe7f84) }, + { SPH_C32(0x69360003), SPH_C32(0xc156e200), SPH_C32(0xecf20000), + SPH_C32(0x293a0000), SPH_C32(0x513f5c55), SPH_C32(0xafaeb14e), + SPH_C32(0x7e28bf9f), SPH_C32(0xeed69f40), SPH_C32(0x664e0001), + SPH_C32(0x1e197600), SPH_C32(0xa96a0000), SPH_C32(0xf9920000), + SPH_C32(0x7a805079), SPH_C32(0x738484f8), SPH_C32(0x2dc4349f), + SPH_C32(0x4a868bcb) }, + { SPH_C32(0x65440003), SPH_C32(0x88b3ed00), SPH_C32(0xae8b0000), + SPH_C32(0x75d00000), SPH_C32(0x62956c4f), SPH_C32(0xba2c945a), + SPH_C32(0xeb8bf4e4), SPH_C32(0x5a9d9fd0), SPH_C32(0x986c0001), + SPH_C32(0xb9417300), SPH_C32(0x8cbb0000), SPH_C32(0x0ef20000), + SPH_C32(0xf3b128a3), SPH_C32(0x6c507c98), SPH_C32(0x6314978a), + SPH_C32(0xeba57454) }, + { SPH_C32(0x97140003), SPH_C32(0x660ee700), SPH_C32(0xc9230000), + SPH_C32(0xde5a0000), SPH_C32(0xd80e248f), SPH_C32(0xb07a492e), + SPH_C32(0x30f81c8a), SPH_C32(0x4ff560df), SPH_C32(0x941e0001), + SPH_C32(0xf0a47c00), SPH_C32(0xcec20000), SPH_C32(0x52180000), + SPH_C32(0xc01b18b9), SPH_C32(0x79d2598c), SPH_C32(0xf6b7dcf1), + SPH_C32(0x5fee74c4) }, + { SPH_C32(0x9b660003), SPH_C32(0x2febe800), SPH_C32(0x8b5a0000), + SPH_C32(0x82b00000), SPH_C32(0xeba41495), SPH_C32(0xa5f86c3a), + SPH_C32(0xa55b57f1), SPH_C32(0xfbbe604f), SPH_C32(0x6a3c0001), + SPH_C32(0x57fc7900), SPH_C32(0xeb130000), SPH_C32(0xa5780000), + SPH_C32(0x492a6063), SPH_C32(0x6606a1ec), SPH_C32(0xb8677fe4), + SPH_C32(0xfecd8b5b) }, + { SPH_C32(0x2c2e0003), SPH_C32(0x64e3f500), SPH_C32(0x15980000), + SPH_C32(0x12720000), SPH_C32(0x4ff34879), SPH_C32(0x8cbd2498), + SPH_C32(0x6894192f), SPH_C32(0x31e56b9f), SPH_C32(0xde730001), + SPH_C32(0x08687000), SPH_C32(0x9ef00000), SPH_C32(0x0c230000), + SPH_C32(0x580131d5), SPH_C32(0xddcc75bd), SPH_C32(0x4be02289), + SPH_C32(0x8f4760f5) }, + { SPH_C32(0x205c0003), SPH_C32(0x2d06fa00), SPH_C32(0x57e10000), + SPH_C32(0x4e980000), SPH_C32(0x7c597863), SPH_C32(0x993f018c), + SPH_C32(0xfd375254), SPH_C32(0x85ae6b0f), SPH_C32(0x20510001), + SPH_C32(0xaf307500), SPH_C32(0xbb210000), SPH_C32(0xfb430000), + SPH_C32(0xd130490f), SPH_C32(0xc2188ddd), SPH_C32(0x0530819c), + SPH_C32(0x2e649f6a) }, + { SPH_C32(0xd20c0003), SPH_C32(0xc3bbf000), SPH_C32(0x30490000), + SPH_C32(0xe5120000), SPH_C32(0xc6c230a3), SPH_C32(0x9369dcf8), + SPH_C32(0x2644ba3a), SPH_C32(0x90c69400), SPH_C32(0x2c230001), + SPH_C32(0xe6d57a00), SPH_C32(0xf9580000), SPH_C32(0xa7a90000), + SPH_C32(0xe29a7915), SPH_C32(0xd79aa8c9), SPH_C32(0x9093cae7), + SPH_C32(0x9a2f9ffa) }, + { SPH_C32(0xde7e0003), SPH_C32(0x8a5eff00), SPH_C32(0x72300000), + SPH_C32(0xb9f80000), SPH_C32(0xf56800b9), SPH_C32(0x86ebf9ec), + SPH_C32(0xb3e7f141), SPH_C32(0x248d9490), SPH_C32(0xd2010001), + SPH_C32(0x418d7f00), SPH_C32(0xdc890000), SPH_C32(0x50c90000), + SPH_C32(0x6bab01cf), SPH_C32(0xc84e50a9), SPH_C32(0xde4369f2), + SPH_C32(0x3b0c6065) }, + { SPH_C32(0xeecf0001), SPH_C32(0x6f564000), SPH_C32(0xf33e0000), + SPH_C32(0xa79e0000), SPH_C32(0xbdb57219), SPH_C32(0xb711ebc5), + SPH_C32(0x4a3b40ba), SPH_C32(0xfeabf254), SPH_C32(0x9b060002), + SPH_C32(0x61468000), SPH_C32(0x221e0000), SPH_C32(0x1d740000), + SPH_C32(0x36715d27), SPH_C32(0x30495c92), SPH_C32(0xf11336a7), + SPH_C32(0xfe1cdc7f) }, + { SPH_C32(0xe2bd0001), SPH_C32(0x26b34f00), SPH_C32(0xb1470000), + SPH_C32(0xfb740000), SPH_C32(0x8e1f4203), SPH_C32(0xa293ced1), + SPH_C32(0xdf980bc1), SPH_C32(0x4ae0f2c4), SPH_C32(0x65240002), + SPH_C32(0xc61e8500), SPH_C32(0x07cf0000), SPH_C32(0xea140000), + SPH_C32(0xbf4025fd), SPH_C32(0x2f9da4f2), SPH_C32(0xbfc395b2), + SPH_C32(0x5f3f23e0) }, + { SPH_C32(0x10ed0001), SPH_C32(0xc80e4500), SPH_C32(0xd6ef0000), + SPH_C32(0x50fe0000), SPH_C32(0x34840ac3), SPH_C32(0xa8c513a5), + SPH_C32(0x04ebe3af), SPH_C32(0x5f880dcb), SPH_C32(0x69560002), + SPH_C32(0x8ffb8a00), SPH_C32(0x45b60000), SPH_C32(0xb6fe0000), + SPH_C32(0x8cea15e7), SPH_C32(0x3a1f81e6), SPH_C32(0x2a60dec9), + SPH_C32(0xeb742370) }, + { SPH_C32(0x1c9f0001), SPH_C32(0x81eb4a00), SPH_C32(0x94960000), + SPH_C32(0x0c140000), SPH_C32(0x072e3ad9), SPH_C32(0xbd4736b1), + SPH_C32(0x9148a8d4), SPH_C32(0xebc30d5b), SPH_C32(0x97740002), + SPH_C32(0x28a38f00), SPH_C32(0x60670000), SPH_C32(0x419e0000), + SPH_C32(0x05db6d3d), SPH_C32(0x25cb7986), SPH_C32(0x64b07ddc), + SPH_C32(0x4a57dcef) }, + { SPH_C32(0xabd70001), SPH_C32(0xcae35700), SPH_C32(0x0a540000), + SPH_C32(0x9cd60000), SPH_C32(0xa3796635), SPH_C32(0x94027e13), + SPH_C32(0x5c87e60a), SPH_C32(0x2198068b), SPH_C32(0x233b0002), + SPH_C32(0x77378600), SPH_C32(0x15840000), SPH_C32(0xe8c50000), + SPH_C32(0x14f03c8b), SPH_C32(0x9e01add7), SPH_C32(0x973720b1), + SPH_C32(0x3bdd3741) }, + { SPH_C32(0xa7a50001), SPH_C32(0x83065800), SPH_C32(0x482d0000), + SPH_C32(0xc03c0000), SPH_C32(0x90d3562f), SPH_C32(0x81805b07), + SPH_C32(0xc924ad71), SPH_C32(0x95d3061b), SPH_C32(0xdd190002), + SPH_C32(0xd06f8300), SPH_C32(0x30550000), SPH_C32(0x1fa50000), + SPH_C32(0x9dc14451), SPH_C32(0x81d555b7), SPH_C32(0xd9e783a4), + SPH_C32(0x9afec8de) }, + { SPH_C32(0x55f50001), SPH_C32(0x6dbb5200), SPH_C32(0x2f850000), + SPH_C32(0x6bb60000), SPH_C32(0x2a481eef), SPH_C32(0x8bd68673), + SPH_C32(0x1257451f), SPH_C32(0x80bbf914), SPH_C32(0xd16b0002), + SPH_C32(0x998a8c00), SPH_C32(0x722c0000), SPH_C32(0x434f0000), + SPH_C32(0xae6b744b), SPH_C32(0x945770a3), SPH_C32(0x4c44c8df), + SPH_C32(0x2eb5c84e) }, + { SPH_C32(0x59870001), SPH_C32(0x245e5d00), SPH_C32(0x6dfc0000), + SPH_C32(0x375c0000), SPH_C32(0x19e22ef5), SPH_C32(0x9e54a367), + SPH_C32(0x87f40e64), SPH_C32(0x34f0f984), SPH_C32(0x2f490002), + SPH_C32(0x3ed28900), SPH_C32(0x57fd0000), SPH_C32(0xb42f0000), + SPH_C32(0x275a0c91), SPH_C32(0x8b8388c3), SPH_C32(0x02946bca), + SPH_C32(0x8f9637d1) }, + { SPH_C32(0x56f20001), SPH_C32(0x79274600), SPH_C32(0xc4a40000), + SPH_C32(0x522f0000), SPH_C32(0x9f3413b5), SPH_C32(0x19591a80), + SPH_C32(0x2c1f56ac), SPH_C32(0x3b6a196a), SPH_C32(0x66230002), + SPH_C32(0xd2829100), SPH_C32(0xecee0000), SPH_C32(0xd38d0000), + SPH_C32(0x0a3c28a7), SPH_C32(0xbd123801), SPH_C32(0x818b8601), + SPH_C32(0xe4eec39e) }, + { SPH_C32(0x5a800001), SPH_C32(0x30c24900), SPH_C32(0x86dd0000), + SPH_C32(0x0ec50000), SPH_C32(0xac9e23af), SPH_C32(0x0cdb3f94), + SPH_C32(0xb9bc1dd7), SPH_C32(0x8f2119fa), SPH_C32(0x98010002), + SPH_C32(0x75da9400), SPH_C32(0xc93f0000), SPH_C32(0x24ed0000), + SPH_C32(0x830d507d), SPH_C32(0xa2c6c061), SPH_C32(0xcf5b2514), + SPH_C32(0x45cd3c01) }, + { SPH_C32(0xa8d00001), SPH_C32(0xde7f4300), SPH_C32(0xe1750000), + SPH_C32(0xa54f0000), SPH_C32(0x16056b6f), SPH_C32(0x068de2e0), + SPH_C32(0x62cff5b9), SPH_C32(0x9a49e6f5), SPH_C32(0x94730002), + SPH_C32(0x3c3f9b00), SPH_C32(0x8b460000), SPH_C32(0x78070000), + SPH_C32(0xb0a76067), SPH_C32(0xb744e575), SPH_C32(0x5af86e6f), + SPH_C32(0xf1863c91) }, + { SPH_C32(0xa4a20001), SPH_C32(0x979a4c00), SPH_C32(0xa30c0000), + SPH_C32(0xf9a50000), SPH_C32(0x25af5b75), SPH_C32(0x130fc7f4), + SPH_C32(0xf76cbec2), SPH_C32(0x2e02e665), SPH_C32(0x6a510002), + SPH_C32(0x9b679e00), SPH_C32(0xae970000), SPH_C32(0x8f670000), + SPH_C32(0x399618bd), SPH_C32(0xa8901d15), SPH_C32(0x1428cd7a), + SPH_C32(0x50a5c30e) }, + { SPH_C32(0x13ea0001), SPH_C32(0xdc925100), SPH_C32(0x3dce0000), + SPH_C32(0x69670000), SPH_C32(0x81f80799), SPH_C32(0x3a4a8f56), + SPH_C32(0x3aa3f01c), SPH_C32(0xe459edb5), SPH_C32(0xde1e0002), + SPH_C32(0xc4f39700), SPH_C32(0xdb740000), SPH_C32(0x263c0000), + SPH_C32(0x28bd490b), SPH_C32(0x135ac944), SPH_C32(0xe7af9017), + SPH_C32(0x212f28a0) }, + { SPH_C32(0x1f980001), SPH_C32(0x95775e00), SPH_C32(0x7fb70000), + SPH_C32(0x358d0000), SPH_C32(0xb2523783), SPH_C32(0x2fc8aa42), + SPH_C32(0xaf00bb67), SPH_C32(0x5012ed25), SPH_C32(0x203c0002), + SPH_C32(0x63ab9200), SPH_C32(0xfea50000), SPH_C32(0xd15c0000), + SPH_C32(0xa18c31d1), SPH_C32(0x0c8e3124), SPH_C32(0xa97f3302), + SPH_C32(0x800cd73f) }, + { SPH_C32(0xedc80001), SPH_C32(0x7bca5400), SPH_C32(0x181f0000), + SPH_C32(0x9e070000), SPH_C32(0x08c97f43), SPH_C32(0x259e7736), + SPH_C32(0x74735309), SPH_C32(0x457a122a), SPH_C32(0x2c4e0002), + SPH_C32(0x2a4e9d00), SPH_C32(0xbcdc0000), SPH_C32(0x8db60000), + SPH_C32(0x922601cb), SPH_C32(0x190c1430), SPH_C32(0x3cdc7879), + SPH_C32(0x3447d7af) }, + { SPH_C32(0xe1ba0001), SPH_C32(0x322f5b00), SPH_C32(0x5a660000), + SPH_C32(0xc2ed0000), SPH_C32(0x3b634f59), SPH_C32(0x301c5222), + SPH_C32(0xe1d01872), SPH_C32(0xf13112ba), SPH_C32(0xd26c0002), + SPH_C32(0x8d169800), SPH_C32(0x990d0000), SPH_C32(0x7ad60000), + SPH_C32(0x1b177911), SPH_C32(0x06d8ec50), SPH_C32(0x720cdb6c), + SPH_C32(0x95642830) }, + { SPH_C32(0x9b6b0001), SPH_C32(0xaddd6700), SPH_C32(0x679a0000), + SPH_C32(0x376b0000), SPH_C32(0x46cd25f9), SPH_C32(0xfedfe06b), + SPH_C32(0x5d5c8439), SPH_C32(0x5074942a), SPH_C32(0x4a600002), + SPH_C32(0x7afa8300), SPH_C32(0xbcf20000), SPH_C32(0xebe00000), + SPH_C32(0x35731800), SPH_C32(0xff39a060), SPH_C32(0x45502db0), + SPH_C32(0x7b63e054) }, + { SPH_C32(0x97190001), SPH_C32(0xe4386800), SPH_C32(0x25e30000), + SPH_C32(0x6b810000), SPH_C32(0x756715e3), SPH_C32(0xeb5dc57f), + SPH_C32(0xc8ffcf42), SPH_C32(0xe43f94ba), SPH_C32(0xb4420002), + SPH_C32(0xdda28600), SPH_C32(0x99230000), SPH_C32(0x1c800000), + SPH_C32(0xbc4260da), SPH_C32(0xe0ed5800), SPH_C32(0x0b808ea5), + SPH_C32(0xda401fcb) }, + { SPH_C32(0x65490001), SPH_C32(0x0a856200), SPH_C32(0x424b0000), + SPH_C32(0xc00b0000), SPH_C32(0xcffc5d23), SPH_C32(0xe10b180b), + SPH_C32(0x138c272c), SPH_C32(0xf1576bb5), SPH_C32(0xb8300002), + SPH_C32(0x94478900), SPH_C32(0xdb5a0000), SPH_C32(0x406a0000), + SPH_C32(0x8fe850c0), SPH_C32(0xf56f7d14), SPH_C32(0x9e23c5de), + SPH_C32(0x6e0b1f5b) }, + { SPH_C32(0x693b0001), SPH_C32(0x43606d00), SPH_C32(0x00320000), + SPH_C32(0x9ce10000), SPH_C32(0xfc566d39), SPH_C32(0xf4893d1f), + SPH_C32(0x862f6c57), SPH_C32(0x451c6b25), SPH_C32(0x46120002), + SPH_C32(0x331f8c00), SPH_C32(0xfe8b0000), SPH_C32(0xb70a0000), + SPH_C32(0x06d9281a), SPH_C32(0xeabb8574), SPH_C32(0xd0f366cb), + SPH_C32(0xcf28e0c4) }, + { SPH_C32(0xde730001), SPH_C32(0x08687000), SPH_C32(0x9ef00000), + SPH_C32(0x0c230000), SPH_C32(0x580131d5), SPH_C32(0xddcc75bd), + SPH_C32(0x4be02289), SPH_C32(0x8f4760f5), SPH_C32(0xf25d0002), + SPH_C32(0x6c8b8500), SPH_C32(0x8b680000), SPH_C32(0x1e510000), + SPH_C32(0x17f279ac), SPH_C32(0x51715125), SPH_C32(0x23743ba6), + SPH_C32(0xbea20b6a) }, + { SPH_C32(0xd2010001), SPH_C32(0x418d7f00), SPH_C32(0xdc890000), + SPH_C32(0x50c90000), SPH_C32(0x6bab01cf), SPH_C32(0xc84e50a9), + SPH_C32(0xde4369f2), SPH_C32(0x3b0c6065), SPH_C32(0x0c7f0002), + SPH_C32(0xcbd38000), SPH_C32(0xaeb90000), SPH_C32(0xe9310000), + SPH_C32(0x9ec30176), SPH_C32(0x4ea5a945), SPH_C32(0x6da498b3), + SPH_C32(0x1f81f4f5) }, + { SPH_C32(0x20510001), SPH_C32(0xaf307500), SPH_C32(0xbb210000), + SPH_C32(0xfb430000), SPH_C32(0xd130490f), SPH_C32(0xc2188ddd), + SPH_C32(0x0530819c), SPH_C32(0x2e649f6a), SPH_C32(0x000d0002), + SPH_C32(0x82368f00), SPH_C32(0xecc00000), SPH_C32(0xb5db0000), + SPH_C32(0xad69316c), SPH_C32(0x5b278c51), SPH_C32(0xf807d3c8), + SPH_C32(0xabcaf465) }, + { SPH_C32(0x2c230001), SPH_C32(0xe6d57a00), SPH_C32(0xf9580000), + SPH_C32(0xa7a90000), SPH_C32(0xe29a7915), SPH_C32(0xd79aa8c9), + SPH_C32(0x9093cae7), SPH_C32(0x9a2f9ffa), SPH_C32(0xfe2f0002), + SPH_C32(0x256e8a00), SPH_C32(0xc9110000), SPH_C32(0x42bb0000), + SPH_C32(0x245849b6), SPH_C32(0x44f37431), SPH_C32(0xb6d770dd), + SPH_C32(0x0ae90bfa) }, + { SPH_C32(0x23560001), SPH_C32(0xbbac6100), SPH_C32(0x50000000), + SPH_C32(0xc2da0000), SPH_C32(0x644c4455), SPH_C32(0x5097112e), + SPH_C32(0x3b78922f), SPH_C32(0x95b57f14), SPH_C32(0xb7450002), + SPH_C32(0xc93e9200), SPH_C32(0x72020000), SPH_C32(0x25190000), + SPH_C32(0x093e6d80), SPH_C32(0x7262c4f3), SPH_C32(0x35c89d16), + SPH_C32(0x6191ffb5) }, + { SPH_C32(0x2f240001), SPH_C32(0xf2496e00), SPH_C32(0x12790000), + SPH_C32(0x9e300000), SPH_C32(0x57e6744f), SPH_C32(0x4515343a), + SPH_C32(0xaedbd954), SPH_C32(0x21fe7f84), SPH_C32(0x49670002), + SPH_C32(0x6e669700), SPH_C32(0x57d30000), SPH_C32(0xd2790000), + SPH_C32(0x800f155a), SPH_C32(0x6db63c93), SPH_C32(0x7b183e03), + SPH_C32(0xc0b2002a) }, + { SPH_C32(0xdd740001), SPH_C32(0x1cf46400), SPH_C32(0x75d10000), + SPH_C32(0x35ba0000), SPH_C32(0xed7d3c8f), SPH_C32(0x4f43e94e), + SPH_C32(0x75a8313a), SPH_C32(0x3496808b), SPH_C32(0x45150002), + SPH_C32(0x27839800), SPH_C32(0x15aa0000), SPH_C32(0x8e930000), + SPH_C32(0xb3a52540), SPH_C32(0x78341987), SPH_C32(0xeebb7578), + SPH_C32(0x74f900ba) }, + { SPH_C32(0xd1060001), SPH_C32(0x55116b00), SPH_C32(0x37a80000), + SPH_C32(0x69500000), SPH_C32(0xded70c95), SPH_C32(0x5ac1cc5a), + SPH_C32(0xe00b7a41), SPH_C32(0x80dd801b), SPH_C32(0xbb370002), + SPH_C32(0x80db9d00), SPH_C32(0x307b0000), SPH_C32(0x79f30000), + SPH_C32(0x3a945d9a), SPH_C32(0x67e0e1e7), SPH_C32(0xa06bd66d), + SPH_C32(0xd5daff25) }, + { SPH_C32(0x664e0001), SPH_C32(0x1e197600), SPH_C32(0xa96a0000), + SPH_C32(0xf9920000), SPH_C32(0x7a805079), SPH_C32(0x738484f8), + SPH_C32(0x2dc4349f), SPH_C32(0x4a868bcb), SPH_C32(0x0f780002), + SPH_C32(0xdf4f9400), SPH_C32(0x45980000), SPH_C32(0xd0a80000), + SPH_C32(0x2bbf0c2c), SPH_C32(0xdc2a35b6), SPH_C32(0x53ec8b00), + SPH_C32(0xa450148b) }, + { SPH_C32(0x6a3c0001), SPH_C32(0x57fc7900), SPH_C32(0xeb130000), + SPH_C32(0xa5780000), SPH_C32(0x492a6063), SPH_C32(0x6606a1ec), + SPH_C32(0xb8677fe4), SPH_C32(0xfecd8b5b), SPH_C32(0xf15a0002), + SPH_C32(0x78179100), SPH_C32(0x60490000), SPH_C32(0x27c80000), + SPH_C32(0xa28e74f6), SPH_C32(0xc3fecdd6), SPH_C32(0x1d3c2815), + SPH_C32(0x0573eb14) }, + { SPH_C32(0x986c0001), SPH_C32(0xb9417300), SPH_C32(0x8cbb0000), + SPH_C32(0x0ef20000), SPH_C32(0xf3b128a3), SPH_C32(0x6c507c98), + SPH_C32(0x6314978a), SPH_C32(0xeba57454), SPH_C32(0xfd280002), + SPH_C32(0x31f29e00), SPH_C32(0x22300000), SPH_C32(0x7b220000), + SPH_C32(0x912444ec), SPH_C32(0xd67ce8c2), SPH_C32(0x889f636e), + SPH_C32(0xb138eb84) }, + { SPH_C32(0x941e0001), SPH_C32(0xf0a47c00), SPH_C32(0xcec20000), + SPH_C32(0x52180000), SPH_C32(0xc01b18b9), SPH_C32(0x79d2598c), + SPH_C32(0xf6b7dcf1), SPH_C32(0x5fee74c4), SPH_C32(0x030a0002), + SPH_C32(0x96aa9b00), SPH_C32(0x07e10000), SPH_C32(0x8c420000), + SPH_C32(0x18153c36), SPH_C32(0xc9a810a2), SPH_C32(0xc64fc07b), + SPH_C32(0x101b141b) }, + { SPH_C32(0x3fa90001), SPH_C32(0x74ea4300), SPH_C32(0x6dd20000), + SPH_C32(0x510a0000), SPH_C32(0xbeb7373e), SPH_C32(0x78611737), + SPH_C32(0xfe785bad), SPH_C32(0x7bd4ce7f), SPH_C32(0x3fc40002), + SPH_C32(0xb871a400), SPH_C32(0x28560000), SPH_C32(0x7b150000), + SPH_C32(0xce0b4fe0), SPH_C32(0xb6f7abce), SPH_C32(0x5237e933), + SPH_C32(0xd5bc862a) }, + { SPH_C32(0x33db0001), SPH_C32(0x3d0f4c00), SPH_C32(0x2fab0000), + SPH_C32(0x0de00000), SPH_C32(0x8d1d0724), SPH_C32(0x6de33223), + SPH_C32(0x6bdb10d6), SPH_C32(0xcf9fceef), SPH_C32(0xc1e60002), + SPH_C32(0x1f29a100), SPH_C32(0x0d870000), SPH_C32(0x8c750000), + SPH_C32(0x473a373a), SPH_C32(0xa92353ae), SPH_C32(0x1ce74a26), + SPH_C32(0x749f79b5) }, + { SPH_C32(0xc18b0001), SPH_C32(0xd3b24600), SPH_C32(0x48030000), + SPH_C32(0xa66a0000), SPH_C32(0x37864fe4), SPH_C32(0x67b5ef57), + SPH_C32(0xb0a8f8b8), SPH_C32(0xdaf731e0), SPH_C32(0xcd940002), + SPH_C32(0x56ccae00), SPH_C32(0x4ffe0000), SPH_C32(0xd09f0000), + SPH_C32(0x74900720), SPH_C32(0xbca176ba), SPH_C32(0x8944015d), + SPH_C32(0xc0d47925) }, + { SPH_C32(0xcdf90001), SPH_C32(0x9a574900), SPH_C32(0x0a7a0000), + SPH_C32(0xfa800000), SPH_C32(0x042c7ffe), SPH_C32(0x7237ca43), + SPH_C32(0x250bb3c3), SPH_C32(0x6ebc3170), SPH_C32(0x33b60002), + SPH_C32(0xf194ab00), SPH_C32(0x6a2f0000), SPH_C32(0x27ff0000), + SPH_C32(0xfda17ffa), SPH_C32(0xa3758eda), SPH_C32(0xc794a248), + SPH_C32(0x61f786ba) }, + { SPH_C32(0x7ab10001), SPH_C32(0xd15f5400), SPH_C32(0x94b80000), + SPH_C32(0x6a420000), SPH_C32(0xa07b2312), SPH_C32(0x5b7282e1), + SPH_C32(0xe8c4fd1d), SPH_C32(0xa4e73aa0), SPH_C32(0x87f90002), + SPH_C32(0xae00a200), SPH_C32(0x1fcc0000), SPH_C32(0x8ea40000), + SPH_C32(0xec8a2e4c), SPH_C32(0x18bf5a8b), SPH_C32(0x3413ff25), + SPH_C32(0x107d6d14) }, + { SPH_C32(0x76c30001), SPH_C32(0x98ba5b00), SPH_C32(0xd6c10000), + SPH_C32(0x36a80000), SPH_C32(0x93d11308), SPH_C32(0x4ef0a7f5), + SPH_C32(0x7d67b666), SPH_C32(0x10ac3a30), SPH_C32(0x79db0002), + SPH_C32(0x0958a700), SPH_C32(0x3a1d0000), SPH_C32(0x79c40000), + SPH_C32(0x65bb5696), SPH_C32(0x076ba2eb), SPH_C32(0x7ac35c30), + SPH_C32(0xb15e928b) }, + { SPH_C32(0x84930001), SPH_C32(0x76075100), SPH_C32(0xb1690000), + SPH_C32(0x9d220000), SPH_C32(0x294a5bc8), SPH_C32(0x44a67a81), + SPH_C32(0xa6145e08), SPH_C32(0x05c4c53f), SPH_C32(0x75a90002), + SPH_C32(0x40bda800), SPH_C32(0x78640000), SPH_C32(0x252e0000), + SPH_C32(0x5611668c), SPH_C32(0x12e987ff), SPH_C32(0xef60174b), + SPH_C32(0x0515921b) }, + { SPH_C32(0x88e10001), SPH_C32(0x3fe25e00), SPH_C32(0xf3100000), + SPH_C32(0xc1c80000), SPH_C32(0x1ae06bd2), SPH_C32(0x51245f95), + SPH_C32(0x33b71573), SPH_C32(0xb18fc5af), SPH_C32(0x8b8b0002), + SPH_C32(0xe7e5ad00), SPH_C32(0x5db50000), SPH_C32(0xd24e0000), + SPH_C32(0xdf201e56), SPH_C32(0x0d3d7f9f), SPH_C32(0xa1b0b45e), + SPH_C32(0xa4366d84) }, + { SPH_C32(0x87940001), SPH_C32(0x629b4500), SPH_C32(0x5a480000), + SPH_C32(0xa4bb0000), SPH_C32(0x9c365692), SPH_C32(0xd629e672), + SPH_C32(0x985c4dbb), SPH_C32(0xbe152541), SPH_C32(0xc2e10002), + SPH_C32(0x0bb5b500), SPH_C32(0xe6a60000), SPH_C32(0xb5ec0000), + SPH_C32(0xf2463a60), SPH_C32(0x3baccf5d), SPH_C32(0x22af5995), + SPH_C32(0xcf4e99cb) }, + { SPH_C32(0x8be60001), SPH_C32(0x2b7e4a00), SPH_C32(0x18310000), + SPH_C32(0xf8510000), SPH_C32(0xaf9c6688), SPH_C32(0xc3abc366), + SPH_C32(0x0dff06c0), SPH_C32(0x0a5e25d1), SPH_C32(0x3cc30002), + SPH_C32(0xacedb000), SPH_C32(0xc3770000), SPH_C32(0x428c0000), + SPH_C32(0x7b7742ba), SPH_C32(0x2478373d), SPH_C32(0x6c7ffa80), + SPH_C32(0x6e6d6654) }, + { SPH_C32(0x79b60001), SPH_C32(0xc5c34000), SPH_C32(0x7f990000), + SPH_C32(0x53db0000), SPH_C32(0x15072e48), SPH_C32(0xc9fd1e12), + SPH_C32(0xd68ceeae), SPH_C32(0x1f36dade), SPH_C32(0x30b10002), + SPH_C32(0xe508bf00), SPH_C32(0x810e0000), SPH_C32(0x1e660000), + SPH_C32(0x48dd72a0), SPH_C32(0x31fa1229), SPH_C32(0xf9dcb1fb), + SPH_C32(0xda2666c4) }, + { SPH_C32(0x75c40001), SPH_C32(0x8c264f00), SPH_C32(0x3de00000), + SPH_C32(0x0f310000), SPH_C32(0x26ad1e52), SPH_C32(0xdc7f3b06), + SPH_C32(0x432fa5d5), SPH_C32(0xab7dda4e), SPH_C32(0xce930002), + SPH_C32(0x4250ba00), SPH_C32(0xa4df0000), SPH_C32(0xe9060000), + SPH_C32(0xc1ec0a7a), SPH_C32(0x2e2eea49), SPH_C32(0xb70c12ee), + SPH_C32(0x7b05995b) }, + { SPH_C32(0xc28c0001), SPH_C32(0xc72e5200), SPH_C32(0xa3220000), + SPH_C32(0x9ff30000), SPH_C32(0x82fa42be), SPH_C32(0xf53a73a4), + SPH_C32(0x8ee0eb0b), SPH_C32(0x6126d19e), SPH_C32(0x7adc0002), + SPH_C32(0x1dc4b300), SPH_C32(0xd13c0000), SPH_C32(0x405d0000), + SPH_C32(0xd0c75bcc), SPH_C32(0x95e43e18), SPH_C32(0x448b4f83), + SPH_C32(0x0a8f72f5) }, + { SPH_C32(0xcefe0001), SPH_C32(0x8ecb5d00), SPH_C32(0xe15b0000), + SPH_C32(0xc3190000), SPH_C32(0xb15072a4), SPH_C32(0xe0b856b0), + SPH_C32(0x1b43a070), SPH_C32(0xd56dd10e), SPH_C32(0x84fe0002), + SPH_C32(0xba9cb600), SPH_C32(0xf4ed0000), SPH_C32(0xb73d0000), + SPH_C32(0x59f62316), SPH_C32(0x8a30c678), SPH_C32(0x0a5bec96), + SPH_C32(0xabac8d6a) }, + { SPH_C32(0x3cae0001), SPH_C32(0x60765700), SPH_C32(0x86f30000), + SPH_C32(0x68930000), SPH_C32(0x0bcb3a64), SPH_C32(0xeaee8bc4), + SPH_C32(0xc030481e), SPH_C32(0xc0052e01), SPH_C32(0x888c0002), + SPH_C32(0xf379b900), SPH_C32(0xb6940000), SPH_C32(0xebd70000), + SPH_C32(0x6a5c130c), SPH_C32(0x9fb2e36c), SPH_C32(0x9ff8a7ed), + SPH_C32(0x1fe78dfa) }, + { SPH_C32(0x30dc0001), SPH_C32(0x29935800), SPH_C32(0xc48a0000), + SPH_C32(0x34790000), SPH_C32(0x38610a7e), SPH_C32(0xff6caed0), + SPH_C32(0x55930365), SPH_C32(0x744e2e91), SPH_C32(0x76ae0002), + SPH_C32(0x5421bc00), SPH_C32(0x93450000), SPH_C32(0x1cb70000), + SPH_C32(0xe36d6bd6), SPH_C32(0x80661b0c), SPH_C32(0xd12804f8), + SPH_C32(0xbec47265) }, + { SPH_C32(0x4a0d0001), SPH_C32(0xb6616400), SPH_C32(0xf9760000), + SPH_C32(0xc1ff0000), SPH_C32(0x45cf60de), SPH_C32(0x31af1c99), + SPH_C32(0xe91f9f2e), SPH_C32(0xd50ba801), SPH_C32(0xeea20002), + SPH_C32(0xa3cda700), SPH_C32(0xb6ba0000), SPH_C32(0x8d810000), + SPH_C32(0xcd090ac7), SPH_C32(0x7987573c), SPH_C32(0xe674f224), + SPH_C32(0x50c3ba01) }, + { SPH_C32(0x467f0001), SPH_C32(0xff846b00), SPH_C32(0xbb0f0000), + SPH_C32(0x9d150000), SPH_C32(0x766550c4), SPH_C32(0x242d398d), + SPH_C32(0x7cbcd455), SPH_C32(0x6140a891), SPH_C32(0x10800002), + SPH_C32(0x0495a200), SPH_C32(0x936b0000), SPH_C32(0x7ae10000), + SPH_C32(0x4438721d), SPH_C32(0x6653af5c), SPH_C32(0xa8a45131), + SPH_C32(0xf1e0459e) }, + { SPH_C32(0xb42f0001), SPH_C32(0x11396100), SPH_C32(0xdca70000), + SPH_C32(0x369f0000), SPH_C32(0xccfe1804), SPH_C32(0x2e7be4f9), + SPH_C32(0xa7cf3c3b), SPH_C32(0x7428579e), SPH_C32(0x1cf20002), + SPH_C32(0x4d70ad00), SPH_C32(0xd1120000), SPH_C32(0x260b0000), + SPH_C32(0x77924207), SPH_C32(0x73d18a48), SPH_C32(0x3d071a4a), + SPH_C32(0x45ab450e) }, + { SPH_C32(0xb85d0001), SPH_C32(0x58dc6e00), SPH_C32(0x9ede0000), + SPH_C32(0x6a750000), SPH_C32(0xff54281e), SPH_C32(0x3bf9c1ed), + SPH_C32(0x326c7740), SPH_C32(0xc063570e), SPH_C32(0xe2d00002), + SPH_C32(0xea28a800), SPH_C32(0xf4c30000), SPH_C32(0xd16b0000), + SPH_C32(0xfea33add), SPH_C32(0x6c057228), SPH_C32(0x73d7b95f), + SPH_C32(0xe488ba91) }, + { SPH_C32(0x0f150001), SPH_C32(0x13d47300), SPH_C32(0x001c0000), + SPH_C32(0xfab70000), SPH_C32(0x5b0374f2), SPH_C32(0x12bc894f), + SPH_C32(0xffa3399e), SPH_C32(0x0a385cde), SPH_C32(0x569f0002), + SPH_C32(0xb5bca100), SPH_C32(0x81200000), SPH_C32(0x78300000), + SPH_C32(0xef886b6b), SPH_C32(0xd7cfa679), SPH_C32(0x8050e432), + SPH_C32(0x9502513f) }, + { SPH_C32(0x03670001), SPH_C32(0x5a317c00), SPH_C32(0x42650000), + SPH_C32(0xa65d0000), SPH_C32(0x68a944e8), SPH_C32(0x073eac5b), + SPH_C32(0x6a0072e5), SPH_C32(0xbe735c4e), SPH_C32(0xa8bd0002), + SPH_C32(0x12e4a400), SPH_C32(0xa4f10000), SPH_C32(0x8f500000), + SPH_C32(0x66b913b1), SPH_C32(0xc81b5e19), SPH_C32(0xce804727), + SPH_C32(0x3421aea0) }, + { SPH_C32(0xf1370001), SPH_C32(0xb48c7600), SPH_C32(0x25cd0000), + SPH_C32(0x0dd70000), SPH_C32(0xd2320c28), SPH_C32(0x0d68712f), + SPH_C32(0xb1739a8b), SPH_C32(0xab1ba341), SPH_C32(0xa4cf0002), + SPH_C32(0x5b01ab00), SPH_C32(0xe6880000), SPH_C32(0xd3ba0000), + SPH_C32(0x551323ab), SPH_C32(0xdd997b0d), SPH_C32(0x5b230c5c), + SPH_C32(0x806aae30) }, + { SPH_C32(0xfd450001), SPH_C32(0xfd697900), SPH_C32(0x67b40000), + SPH_C32(0x513d0000), SPH_C32(0xe1983c32), SPH_C32(0x18ea543b), + SPH_C32(0x24d0d1f0), SPH_C32(0x1f50a3d1), SPH_C32(0x5aed0002), + SPH_C32(0xfc59ae00), SPH_C32(0xc3590000), SPH_C32(0x24da0000), + SPH_C32(0xdc225b71), SPH_C32(0xc24d836d), SPH_C32(0x15f3af49), + SPH_C32(0x214951af) }, + { SPH_C32(0xf2300001), SPH_C32(0xa0106200), SPH_C32(0xceec0000), + SPH_C32(0x344e0000), SPH_C32(0x674e0172), SPH_C32(0x9fe7eddc), + SPH_C32(0x8f3b8938), SPH_C32(0x10ca433f), SPH_C32(0x13870002), + SPH_C32(0x1009b600), SPH_C32(0x784a0000), SPH_C32(0x43780000), + SPH_C32(0xf1447f47), SPH_C32(0xf4dc33af), SPH_C32(0x96ec4282), + SPH_C32(0x4a31a5e0) }, + { SPH_C32(0xfe420001), SPH_C32(0xe9f56d00), SPH_C32(0x8c950000), + SPH_C32(0x68a40000), SPH_C32(0x54e43168), SPH_C32(0x8a65c8c8), + SPH_C32(0x1a98c243), SPH_C32(0xa48143af), SPH_C32(0xeda50002), + SPH_C32(0xb751b300), SPH_C32(0x5d9b0000), SPH_C32(0xb4180000), + SPH_C32(0x7875079d), SPH_C32(0xeb08cbcf), SPH_C32(0xd83ce197), + SPH_C32(0xeb125a7f) }, + { SPH_C32(0x0c120001), SPH_C32(0x07486700), SPH_C32(0xeb3d0000), + SPH_C32(0xc32e0000), SPH_C32(0xee7f79a8), SPH_C32(0x803315bc), + SPH_C32(0xc1eb2a2d), SPH_C32(0xb1e9bca0), SPH_C32(0xe1d70002), + SPH_C32(0xfeb4bc00), SPH_C32(0x1fe20000), SPH_C32(0xe8f20000), + SPH_C32(0x4bdf3787), SPH_C32(0xfe8aeedb), SPH_C32(0x4d9faaec), + SPH_C32(0x5f595aef) }, + { SPH_C32(0x00600001), SPH_C32(0x4ead6800), SPH_C32(0xa9440000), + SPH_C32(0x9fc40000), SPH_C32(0xddd549b2), SPH_C32(0x95b130a8), + SPH_C32(0x54486156), SPH_C32(0x05a2bc30), SPH_C32(0x1ff50002), + SPH_C32(0x59ecb900), SPH_C32(0x3a330000), SPH_C32(0x1f920000), + SPH_C32(0xc2ee4f5d), SPH_C32(0xe15e16bb), SPH_C32(0x034f09f9), + SPH_C32(0xfe7aa570) }, + { SPH_C32(0xb7280001), SPH_C32(0x05a57500), SPH_C32(0x37860000), + SPH_C32(0x0f060000), SPH_C32(0x7982155e), SPH_C32(0xbcf4780a), + SPH_C32(0x99872f88), SPH_C32(0xcff9b7e0), SPH_C32(0xabba0002), + SPH_C32(0x0678b000), SPH_C32(0x4fd00000), SPH_C32(0xb6c90000), + SPH_C32(0xd3c51eeb), SPH_C32(0x5a94c2ea), SPH_C32(0xf0c85494), + SPH_C32(0x8ff04ede) }, + { SPH_C32(0xbb5a0001), SPH_C32(0x4c407a00), SPH_C32(0x75ff0000), + SPH_C32(0x53ec0000), SPH_C32(0x4a282544), SPH_C32(0xa9765d1e), + SPH_C32(0x0c2464f3), SPH_C32(0x7bb2b770), SPH_C32(0x55980002), + SPH_C32(0xa120b500), SPH_C32(0x6a010000), SPH_C32(0x41a90000), + SPH_C32(0x5af46631), SPH_C32(0x45403a8a), SPH_C32(0xbe18f781), + SPH_C32(0x2ed3b141) }, + { SPH_C32(0x490a0001), SPH_C32(0xa2fd7000), SPH_C32(0x12570000), + SPH_C32(0xf8660000), SPH_C32(0xf0b36d84), SPH_C32(0xa320806a), + SPH_C32(0xd7578c9d), SPH_C32(0x6eda487f), SPH_C32(0x59ea0002), + SPH_C32(0xe8c5ba00), SPH_C32(0x28780000), SPH_C32(0x1d430000), + SPH_C32(0x695e562b), SPH_C32(0x50c21f9e), SPH_C32(0x2bbbbcfa), + SPH_C32(0x9a98b1d1) }, + { SPH_C32(0x45780001), SPH_C32(0xeb187f00), SPH_C32(0x502e0000), + SPH_C32(0xa48c0000), SPH_C32(0xc3195d9e), SPH_C32(0xb6a2a57e), + SPH_C32(0x42f4c7e6), SPH_C32(0xda9148ef), SPH_C32(0xa7c80002), + SPH_C32(0x4f9dbf00), SPH_C32(0x0da90000), SPH_C32(0xea230000), + SPH_C32(0xe06f2ef1), SPH_C32(0x4f16e7fe), SPH_C32(0x656b1fef), + SPH_C32(0x3bbb4e4e) }, + { SPH_C32(0x9b060002), SPH_C32(0x61468000), SPH_C32(0x221e0000), + SPH_C32(0x1d740000), SPH_C32(0x36715d27), SPH_C32(0x30495c92), + SPH_C32(0xf11336a7), SPH_C32(0xfe1cdc7f), SPH_C32(0x75c90003), + SPH_C32(0x0e10c000), SPH_C32(0xd1200000), SPH_C32(0xbaea0000), + SPH_C32(0x8bc42f3e), SPH_C32(0x8758b757), SPH_C32(0xbb28761d), + SPH_C32(0x00b72e2b) }, + { SPH_C32(0x97740002), SPH_C32(0x28a38f00), SPH_C32(0x60670000), + SPH_C32(0x419e0000), SPH_C32(0x05db6d3d), SPH_C32(0x25cb7986), + SPH_C32(0x64b07ddc), SPH_C32(0x4a57dcef), SPH_C32(0x8beb0003), + SPH_C32(0xa948c500), SPH_C32(0xf4f10000), SPH_C32(0x4d8a0000), + SPH_C32(0x02f557e4), SPH_C32(0x988c4f37), SPH_C32(0xf5f8d508), + SPH_C32(0xa194d1b4) }, + { SPH_C32(0x65240002), SPH_C32(0xc61e8500), SPH_C32(0x07cf0000), + SPH_C32(0xea140000), SPH_C32(0xbf4025fd), SPH_C32(0x2f9da4f2), + SPH_C32(0xbfc395b2), SPH_C32(0x5f3f23e0), SPH_C32(0x87990003), + SPH_C32(0xe0adca00), SPH_C32(0xb6880000), SPH_C32(0x11600000), + SPH_C32(0x315f67fe), SPH_C32(0x8d0e6a23), SPH_C32(0x605b9e73), + SPH_C32(0x15dfd124) }, + { SPH_C32(0x69560002), SPH_C32(0x8ffb8a00), SPH_C32(0x45b60000), + SPH_C32(0xb6fe0000), SPH_C32(0x8cea15e7), SPH_C32(0x3a1f81e6), + SPH_C32(0x2a60dec9), SPH_C32(0xeb742370), SPH_C32(0x79bb0003), + SPH_C32(0x47f5cf00), SPH_C32(0x93590000), SPH_C32(0xe6000000), + SPH_C32(0xb86e1f24), SPH_C32(0x92da9243), SPH_C32(0x2e8b3d66), + SPH_C32(0xb4fc2ebb) }, + { SPH_C32(0xde1e0002), SPH_C32(0xc4f39700), SPH_C32(0xdb740000), + SPH_C32(0x263c0000), SPH_C32(0x28bd490b), SPH_C32(0x135ac944), + SPH_C32(0xe7af9017), SPH_C32(0x212f28a0), SPH_C32(0xcdf40003), + SPH_C32(0x1861c600), SPH_C32(0xe6ba0000), SPH_C32(0x4f5b0000), + SPH_C32(0xa9454e92), SPH_C32(0x29104612), SPH_C32(0xdd0c600b), + SPH_C32(0xc576c515) }, + { SPH_C32(0xd26c0002), SPH_C32(0x8d169800), SPH_C32(0x990d0000), + SPH_C32(0x7ad60000), SPH_C32(0x1b177911), SPH_C32(0x06d8ec50), + SPH_C32(0x720cdb6c), SPH_C32(0x95642830), SPH_C32(0x33d60003), + SPH_C32(0xbf39c300), SPH_C32(0xc36b0000), SPH_C32(0xb83b0000), + SPH_C32(0x20743648), SPH_C32(0x36c4be72), SPH_C32(0x93dcc31e), + SPH_C32(0x64553a8a) }, + { SPH_C32(0x203c0002), SPH_C32(0x63ab9200), SPH_C32(0xfea50000), + SPH_C32(0xd15c0000), SPH_C32(0xa18c31d1), SPH_C32(0x0c8e3124), + SPH_C32(0xa97f3302), SPH_C32(0x800cd73f), SPH_C32(0x3fa40003), + SPH_C32(0xf6dccc00), SPH_C32(0x81120000), SPH_C32(0xe4d10000), + SPH_C32(0x13de0652), SPH_C32(0x23469b66), SPH_C32(0x067f8865), + SPH_C32(0xd01e3a1a) }, + { SPH_C32(0x2c4e0002), SPH_C32(0x2a4e9d00), SPH_C32(0xbcdc0000), + SPH_C32(0x8db60000), SPH_C32(0x922601cb), SPH_C32(0x190c1430), + SPH_C32(0x3cdc7879), SPH_C32(0x3447d7af), SPH_C32(0xc1860003), + SPH_C32(0x5184c900), SPH_C32(0xa4c30000), SPH_C32(0x13b10000), + SPH_C32(0x9aef7e88), SPH_C32(0x3c926306), SPH_C32(0x48af2b70), + SPH_C32(0x713dc585) }, + { SPH_C32(0x233b0002), SPH_C32(0x77378600), SPH_C32(0x15840000), + SPH_C32(0xe8c50000), SPH_C32(0x14f03c8b), SPH_C32(0x9e01add7), + SPH_C32(0x973720b1), SPH_C32(0x3bdd3741), SPH_C32(0x88ec0003), + SPH_C32(0xbdd4d100), SPH_C32(0x1fd00000), SPH_C32(0x74130000), + SPH_C32(0xb7895abe), SPH_C32(0x0a03d3c4), SPH_C32(0xcbb0c6bb), + SPH_C32(0x1a4531ca) }, + { SPH_C32(0x2f490002), SPH_C32(0x3ed28900), SPH_C32(0x57fd0000), + SPH_C32(0xb42f0000), SPH_C32(0x275a0c91), SPH_C32(0x8b8388c3), + SPH_C32(0x02946bca), SPH_C32(0x8f9637d1), SPH_C32(0x76ce0003), + SPH_C32(0x1a8cd400), SPH_C32(0x3a010000), SPH_C32(0x83730000), + SPH_C32(0x3eb82264), SPH_C32(0x15d72ba4), SPH_C32(0x856065ae), + SPH_C32(0xbb66ce55) }, + { SPH_C32(0xdd190002), SPH_C32(0xd06f8300), SPH_C32(0x30550000), + SPH_C32(0x1fa50000), SPH_C32(0x9dc14451), SPH_C32(0x81d555b7), + SPH_C32(0xd9e783a4), SPH_C32(0x9afec8de), SPH_C32(0x7abc0003), + SPH_C32(0x5369db00), SPH_C32(0x78780000), SPH_C32(0xdf990000), + SPH_C32(0x0d12127e), SPH_C32(0x00550eb0), SPH_C32(0x10c32ed5), + SPH_C32(0x0f2dcec5) }, + { SPH_C32(0xd16b0002), SPH_C32(0x998a8c00), SPH_C32(0x722c0000), + SPH_C32(0x434f0000), SPH_C32(0xae6b744b), SPH_C32(0x945770a3), + SPH_C32(0x4c44c8df), SPH_C32(0x2eb5c84e), SPH_C32(0x849e0003), + SPH_C32(0xf431de00), SPH_C32(0x5da90000), SPH_C32(0x28f90000), + SPH_C32(0x84236aa4), SPH_C32(0x1f81f6d0), SPH_C32(0x5e138dc0), + SPH_C32(0xae0e315a) }, + { SPH_C32(0x66230002), SPH_C32(0xd2829100), SPH_C32(0xecee0000), + SPH_C32(0xd38d0000), SPH_C32(0x0a3c28a7), SPH_C32(0xbd123801), + SPH_C32(0x818b8601), SPH_C32(0xe4eec39e), SPH_C32(0x30d10003), + SPH_C32(0xaba5d700), SPH_C32(0x284a0000), SPH_C32(0x81a20000), + SPH_C32(0x95083b12), SPH_C32(0xa44b2281), SPH_C32(0xad94d0ad), + SPH_C32(0xdf84daf4) }, + { SPH_C32(0x6a510002), SPH_C32(0x9b679e00), SPH_C32(0xae970000), + SPH_C32(0x8f670000), SPH_C32(0x399618bd), SPH_C32(0xa8901d15), + SPH_C32(0x1428cd7a), SPH_C32(0x50a5c30e), SPH_C32(0xcef30003), + SPH_C32(0x0cfdd200), SPH_C32(0x0d9b0000), SPH_C32(0x76c20000), + SPH_C32(0x1c3943c8), SPH_C32(0xbb9fdae1), SPH_C32(0xe34473b8), + SPH_C32(0x7ea7256b) }, + { SPH_C32(0x98010002), SPH_C32(0x75da9400), SPH_C32(0xc93f0000), + SPH_C32(0x24ed0000), SPH_C32(0x830d507d), SPH_C32(0xa2c6c061), + SPH_C32(0xcf5b2514), SPH_C32(0x45cd3c01), SPH_C32(0xc2810003), + SPH_C32(0x4518dd00), SPH_C32(0x4fe20000), SPH_C32(0x2a280000), + SPH_C32(0x2f9373d2), SPH_C32(0xae1dfff5), SPH_C32(0x76e738c3), + SPH_C32(0xcaec25fb) }, + { SPH_C32(0x94730002), SPH_C32(0x3c3f9b00), SPH_C32(0x8b460000), + SPH_C32(0x78070000), SPH_C32(0xb0a76067), SPH_C32(0xb744e575), + SPH_C32(0x5af86e6f), SPH_C32(0xf1863c91), SPH_C32(0x3ca30003), + SPH_C32(0xe240d800), SPH_C32(0x6a330000), SPH_C32(0xdd480000), + SPH_C32(0xa6a20b08), SPH_C32(0xb1c90795), SPH_C32(0x38379bd6), + SPH_C32(0x6bcfda64) }, + { SPH_C32(0xeea20002), SPH_C32(0xa3cda700), SPH_C32(0xb6ba0000), + SPH_C32(0x8d810000), SPH_C32(0xcd090ac7), SPH_C32(0x7987573c), + SPH_C32(0xe674f224), SPH_C32(0x50c3ba01), SPH_C32(0xa4af0003), + SPH_C32(0x15acc300), SPH_C32(0x4fcc0000), SPH_C32(0x4c7e0000), + SPH_C32(0x88c66a19), SPH_C32(0x48284ba5), SPH_C32(0x0f6b6d0a), + SPH_C32(0x85c81200) }, + { SPH_C32(0xe2d00002), SPH_C32(0xea28a800), SPH_C32(0xf4c30000), + SPH_C32(0xd16b0000), SPH_C32(0xfea33add), SPH_C32(0x6c057228), + SPH_C32(0x73d7b95f), SPH_C32(0xe488ba91), SPH_C32(0x5a8d0003), + SPH_C32(0xb2f4c600), SPH_C32(0x6a1d0000), SPH_C32(0xbb1e0000), + SPH_C32(0x01f712c3), SPH_C32(0x57fcb3c5), SPH_C32(0x41bbce1f), + SPH_C32(0x24ebed9f) }, + { SPH_C32(0x10800002), SPH_C32(0x0495a200), SPH_C32(0x936b0000), + SPH_C32(0x7ae10000), SPH_C32(0x4438721d), SPH_C32(0x6653af5c), + SPH_C32(0xa8a45131), SPH_C32(0xf1e0459e), SPH_C32(0x56ff0003), + SPH_C32(0xfb11c900), SPH_C32(0x28640000), SPH_C32(0xe7f40000), + SPH_C32(0x325d22d9), SPH_C32(0x427e96d1), SPH_C32(0xd4188564), + SPH_C32(0x90a0ed0f) }, + { SPH_C32(0x1cf20002), SPH_C32(0x4d70ad00), SPH_C32(0xd1120000), + SPH_C32(0x260b0000), SPH_C32(0x77924207), SPH_C32(0x73d18a48), + SPH_C32(0x3d071a4a), SPH_C32(0x45ab450e), SPH_C32(0xa8dd0003), + SPH_C32(0x5c49cc00), SPH_C32(0x0db50000), SPH_C32(0x10940000), + SPH_C32(0xbb6c5a03), SPH_C32(0x5daa6eb1), SPH_C32(0x9ac82671), + SPH_C32(0x31831290) }, + { SPH_C32(0xabba0002), SPH_C32(0x0678b000), SPH_C32(0x4fd00000), + SPH_C32(0xb6c90000), SPH_C32(0xd3c51eeb), SPH_C32(0x5a94c2ea), + SPH_C32(0xf0c85494), SPH_C32(0x8ff04ede), SPH_C32(0x1c920003), + SPH_C32(0x03ddc500), SPH_C32(0x78560000), SPH_C32(0xb9cf0000), + SPH_C32(0xaa470bb5), SPH_C32(0xe660bae0), SPH_C32(0x694f7b1c), + SPH_C32(0x4009f93e) }, + { SPH_C32(0xa7c80002), SPH_C32(0x4f9dbf00), SPH_C32(0x0da90000), + SPH_C32(0xea230000), SPH_C32(0xe06f2ef1), SPH_C32(0x4f16e7fe), + SPH_C32(0x656b1fef), SPH_C32(0x3bbb4e4e), SPH_C32(0xe2b00003), + SPH_C32(0xa485c000), SPH_C32(0x5d870000), SPH_C32(0x4eaf0000), + SPH_C32(0x2376736f), SPH_C32(0xf9b44280), SPH_C32(0x279fd809), + SPH_C32(0xe12a06a1) }, + { SPH_C32(0x55980002), SPH_C32(0xa120b500), SPH_C32(0x6a010000), + SPH_C32(0x41a90000), SPH_C32(0x5af46631), SPH_C32(0x45403a8a), + SPH_C32(0xbe18f781), SPH_C32(0x2ed3b141), SPH_C32(0xeec20003), + SPH_C32(0xed60cf00), SPH_C32(0x1ffe0000), SPH_C32(0x12450000), + SPH_C32(0x10dc4375), SPH_C32(0xec366794), SPH_C32(0xb23c9372), + SPH_C32(0x55610631) }, + { SPH_C32(0x59ea0002), SPH_C32(0xe8c5ba00), SPH_C32(0x28780000), + SPH_C32(0x1d430000), SPH_C32(0x695e562b), SPH_C32(0x50c21f9e), + SPH_C32(0x2bbbbcfa), SPH_C32(0x9a98b1d1), SPH_C32(0x10e00003), + SPH_C32(0x4a38ca00), SPH_C32(0x3a2f0000), SPH_C32(0xe5250000), + SPH_C32(0x99ed3baf), SPH_C32(0xf3e29ff4), SPH_C32(0xfcec3067), + SPH_C32(0xf442f9ae) }, + { SPH_C32(0x569f0002), SPH_C32(0xb5bca100), SPH_C32(0x81200000), + SPH_C32(0x78300000), SPH_C32(0xef886b6b), SPH_C32(0xd7cfa679), + SPH_C32(0x8050e432), SPH_C32(0x9502513f), SPH_C32(0x598a0003), + SPH_C32(0xa668d200), SPH_C32(0x813c0000), SPH_C32(0x82870000), + SPH_C32(0xb48b1f99), SPH_C32(0xc5732f36), SPH_C32(0x7ff3ddac), + SPH_C32(0x9f3a0de1) }, + { SPH_C32(0x5aed0002), SPH_C32(0xfc59ae00), SPH_C32(0xc3590000), + SPH_C32(0x24da0000), SPH_C32(0xdc225b71), SPH_C32(0xc24d836d), + SPH_C32(0x15f3af49), SPH_C32(0x214951af), SPH_C32(0xa7a80003), + SPH_C32(0x0130d700), SPH_C32(0xa4ed0000), SPH_C32(0x75e70000), + SPH_C32(0x3dba6743), SPH_C32(0xdaa7d756), SPH_C32(0x31237eb9), + SPH_C32(0x3e19f27e) }, + { SPH_C32(0xa8bd0002), SPH_C32(0x12e4a400), SPH_C32(0xa4f10000), + SPH_C32(0x8f500000), SPH_C32(0x66b913b1), SPH_C32(0xc81b5e19), + SPH_C32(0xce804727), SPH_C32(0x3421aea0), SPH_C32(0xabda0003), + SPH_C32(0x48d5d800), SPH_C32(0xe6940000), SPH_C32(0x290d0000), + SPH_C32(0x0e105759), SPH_C32(0xcf25f242), SPH_C32(0xa48035c2), + SPH_C32(0x8a52f2ee) }, + { SPH_C32(0xa4cf0002), SPH_C32(0x5b01ab00), SPH_C32(0xe6880000), + SPH_C32(0xd3ba0000), SPH_C32(0x551323ab), SPH_C32(0xdd997b0d), + SPH_C32(0x5b230c5c), SPH_C32(0x806aae30), SPH_C32(0x55f80003), + SPH_C32(0xef8ddd00), SPH_C32(0xc3450000), SPH_C32(0xde6d0000), + SPH_C32(0x87212f83), SPH_C32(0xd0f10a22), SPH_C32(0xea5096d7), + SPH_C32(0x2b710d71) }, + { SPH_C32(0x13870002), SPH_C32(0x1009b600), SPH_C32(0x784a0000), + SPH_C32(0x43780000), SPH_C32(0xf1447f47), SPH_C32(0xf4dc33af), + SPH_C32(0x96ec4282), SPH_C32(0x4a31a5e0), SPH_C32(0xe1b70003), + SPH_C32(0xb019d400), SPH_C32(0xb6a60000), SPH_C32(0x77360000), + SPH_C32(0x960a7e35), SPH_C32(0x6b3bde73), SPH_C32(0x19d7cbba), + SPH_C32(0x5afbe6df) }, + { SPH_C32(0x1ff50002), SPH_C32(0x59ecb900), SPH_C32(0x3a330000), + SPH_C32(0x1f920000), SPH_C32(0xc2ee4f5d), SPH_C32(0xe15e16bb), + SPH_C32(0x034f09f9), SPH_C32(0xfe7aa570), SPH_C32(0x1f950003), + SPH_C32(0x1741d100), SPH_C32(0x93770000), SPH_C32(0x80560000), + SPH_C32(0x1f3b06ef), SPH_C32(0x74ef2613), SPH_C32(0x570768af), + SPH_C32(0xfbd81940) }, + { SPH_C32(0xeda50002), SPH_C32(0xb751b300), SPH_C32(0x5d9b0000), + SPH_C32(0xb4180000), SPH_C32(0x7875079d), SPH_C32(0xeb08cbcf), + SPH_C32(0xd83ce197), SPH_C32(0xeb125a7f), SPH_C32(0x13e70003), + SPH_C32(0x5ea4de00), SPH_C32(0xd10e0000), SPH_C32(0xdcbc0000), + SPH_C32(0x2c9136f5), SPH_C32(0x616d0307), SPH_C32(0xc2a423d4), + SPH_C32(0x4f9319d0) }, + { SPH_C32(0xe1d70002), SPH_C32(0xfeb4bc00), SPH_C32(0x1fe20000), + SPH_C32(0xe8f20000), SPH_C32(0x4bdf3787), SPH_C32(0xfe8aeedb), + SPH_C32(0x4d9faaec), SPH_C32(0x5f595aef), SPH_C32(0xedc50003), + SPH_C32(0xf9fcdb00), SPH_C32(0xf4df0000), SPH_C32(0x2bdc0000), + SPH_C32(0xa5a04e2f), SPH_C32(0x7eb9fb67), SPH_C32(0x8c7480c1), + SPH_C32(0xeeb0e64f) }, + { SPH_C32(0x4a600002), SPH_C32(0x7afa8300), SPH_C32(0xbcf20000), + SPH_C32(0xebe00000), SPH_C32(0x35731800), SPH_C32(0xff39a060), + SPH_C32(0x45502db0), SPH_C32(0x7b63e054), SPH_C32(0xd10b0003), + SPH_C32(0xd727e400), SPH_C32(0xdb680000), SPH_C32(0xdc8b0000), + SPH_C32(0x73be3df9), SPH_C32(0x01e6400b), SPH_C32(0x180ca989), + SPH_C32(0x2b17747e) }, + { SPH_C32(0x46120002), SPH_C32(0x331f8c00), SPH_C32(0xfe8b0000), + SPH_C32(0xb70a0000), SPH_C32(0x06d9281a), SPH_C32(0xeabb8574), + SPH_C32(0xd0f366cb), SPH_C32(0xcf28e0c4), SPH_C32(0x2f290003), + SPH_C32(0x707fe100), SPH_C32(0xfeb90000), SPH_C32(0x2beb0000), + SPH_C32(0xfa8f4523), SPH_C32(0x1e32b86b), SPH_C32(0x56dc0a9c), + SPH_C32(0x8a348be1) }, + { SPH_C32(0xb4420002), SPH_C32(0xdda28600), SPH_C32(0x99230000), + SPH_C32(0x1c800000), SPH_C32(0xbc4260da), SPH_C32(0xe0ed5800), + SPH_C32(0x0b808ea5), SPH_C32(0xda401fcb), SPH_C32(0x235b0003), + SPH_C32(0x399aee00), SPH_C32(0xbcc00000), SPH_C32(0x77010000), + SPH_C32(0xc9257539), SPH_C32(0x0bb09d7f), SPH_C32(0xc37f41e7), + SPH_C32(0x3e7f8b71) }, + { SPH_C32(0xb8300002), SPH_C32(0x94478900), SPH_C32(0xdb5a0000), + SPH_C32(0x406a0000), SPH_C32(0x8fe850c0), SPH_C32(0xf56f7d14), + SPH_C32(0x9e23c5de), SPH_C32(0x6e0b1f5b), SPH_C32(0xdd790003), + SPH_C32(0x9ec2eb00), SPH_C32(0x99110000), SPH_C32(0x80610000), + SPH_C32(0x40140de3), SPH_C32(0x1464651f), SPH_C32(0x8dafe2f2), + SPH_C32(0x9f5c74ee) }, + { SPH_C32(0x0f780002), SPH_C32(0xdf4f9400), SPH_C32(0x45980000), + SPH_C32(0xd0a80000), SPH_C32(0x2bbf0c2c), SPH_C32(0xdc2a35b6), + SPH_C32(0x53ec8b00), SPH_C32(0xa450148b), SPH_C32(0x69360003), + SPH_C32(0xc156e200), SPH_C32(0xecf20000), SPH_C32(0x293a0000), + SPH_C32(0x513f5c55), SPH_C32(0xafaeb14e), SPH_C32(0x7e28bf9f), + SPH_C32(0xeed69f40) }, + { SPH_C32(0x030a0002), SPH_C32(0x96aa9b00), SPH_C32(0x07e10000), + SPH_C32(0x8c420000), SPH_C32(0x18153c36), SPH_C32(0xc9a810a2), + SPH_C32(0xc64fc07b), SPH_C32(0x101b141b), SPH_C32(0x97140003), + SPH_C32(0x660ee700), SPH_C32(0xc9230000), SPH_C32(0xde5a0000), + SPH_C32(0xd80e248f), SPH_C32(0xb07a492e), SPH_C32(0x30f81c8a), + SPH_C32(0x4ff560df) }, + { SPH_C32(0xf15a0002), SPH_C32(0x78179100), SPH_C32(0x60490000), + SPH_C32(0x27c80000), SPH_C32(0xa28e74f6), SPH_C32(0xc3fecdd6), + SPH_C32(0x1d3c2815), SPH_C32(0x0573eb14), SPH_C32(0x9b660003), + SPH_C32(0x2febe800), SPH_C32(0x8b5a0000), SPH_C32(0x82b00000), + SPH_C32(0xeba41495), SPH_C32(0xa5f86c3a), SPH_C32(0xa55b57f1), + SPH_C32(0xfbbe604f) }, + { SPH_C32(0xfd280002), SPH_C32(0x31f29e00), SPH_C32(0x22300000), + SPH_C32(0x7b220000), SPH_C32(0x912444ec), SPH_C32(0xd67ce8c2), + SPH_C32(0x889f636e), SPH_C32(0xb138eb84), SPH_C32(0x65440003), + SPH_C32(0x88b3ed00), SPH_C32(0xae8b0000), SPH_C32(0x75d00000), + SPH_C32(0x62956c4f), SPH_C32(0xba2c945a), SPH_C32(0xeb8bf4e4), + SPH_C32(0x5a9d9fd0) }, + { SPH_C32(0xf25d0002), SPH_C32(0x6c8b8500), SPH_C32(0x8b680000), + SPH_C32(0x1e510000), SPH_C32(0x17f279ac), SPH_C32(0x51715125), + SPH_C32(0x23743ba6), SPH_C32(0xbea20b6a), SPH_C32(0x2c2e0003), + SPH_C32(0x64e3f500), SPH_C32(0x15980000), SPH_C32(0x12720000), + SPH_C32(0x4ff34879), SPH_C32(0x8cbd2498), SPH_C32(0x6894192f), + SPH_C32(0x31e56b9f) }, + { SPH_C32(0xfe2f0002), SPH_C32(0x256e8a00), SPH_C32(0xc9110000), + SPH_C32(0x42bb0000), SPH_C32(0x245849b6), SPH_C32(0x44f37431), + SPH_C32(0xb6d770dd), SPH_C32(0x0ae90bfa), SPH_C32(0xd20c0003), + SPH_C32(0xc3bbf000), SPH_C32(0x30490000), SPH_C32(0xe5120000), + SPH_C32(0xc6c230a3), SPH_C32(0x9369dcf8), SPH_C32(0x2644ba3a), + SPH_C32(0x90c69400) }, + { SPH_C32(0x0c7f0002), SPH_C32(0xcbd38000), SPH_C32(0xaeb90000), + SPH_C32(0xe9310000), SPH_C32(0x9ec30176), SPH_C32(0x4ea5a945), + SPH_C32(0x6da498b3), SPH_C32(0x1f81f4f5), SPH_C32(0xde7e0003), + SPH_C32(0x8a5eff00), SPH_C32(0x72300000), SPH_C32(0xb9f80000), + SPH_C32(0xf56800b9), SPH_C32(0x86ebf9ec), SPH_C32(0xb3e7f141), + SPH_C32(0x248d9490) }, + { SPH_C32(0x000d0002), SPH_C32(0x82368f00), SPH_C32(0xecc00000), + SPH_C32(0xb5db0000), SPH_C32(0xad69316c), SPH_C32(0x5b278c51), + SPH_C32(0xf807d3c8), SPH_C32(0xabcaf465), SPH_C32(0x205c0003), + SPH_C32(0x2d06fa00), SPH_C32(0x57e10000), SPH_C32(0x4e980000), + SPH_C32(0x7c597863), SPH_C32(0x993f018c), SPH_C32(0xfd375254), + SPH_C32(0x85ae6b0f) }, + { SPH_C32(0xb7450002), SPH_C32(0xc93e9200), SPH_C32(0x72020000), + SPH_C32(0x25190000), SPH_C32(0x093e6d80), SPH_C32(0x7262c4f3), + SPH_C32(0x35c89d16), SPH_C32(0x6191ffb5), SPH_C32(0x94130003), + SPH_C32(0x7292f300), SPH_C32(0x22020000), SPH_C32(0xe7c30000), + SPH_C32(0x6d7229d5), SPH_C32(0x22f5d5dd), SPH_C32(0x0eb00f39), + SPH_C32(0xf42480a1) }, + { SPH_C32(0xbb370002), SPH_C32(0x80db9d00), SPH_C32(0x307b0000), + SPH_C32(0x79f30000), SPH_C32(0x3a945d9a), SPH_C32(0x67e0e1e7), + SPH_C32(0xa06bd66d), SPH_C32(0xd5daff25), SPH_C32(0x6a310003), + SPH_C32(0xd5caf600), SPH_C32(0x07d30000), SPH_C32(0x10a30000), + SPH_C32(0xe443510f), SPH_C32(0x3d212dbd), SPH_C32(0x4060ac2c), + SPH_C32(0x55077f3e) }, + { SPH_C32(0x49670002), SPH_C32(0x6e669700), SPH_C32(0x57d30000), + SPH_C32(0xd2790000), SPH_C32(0x800f155a), SPH_C32(0x6db63c93), + SPH_C32(0x7b183e03), SPH_C32(0xc0b2002a), SPH_C32(0x66430003), + SPH_C32(0x9c2ff900), SPH_C32(0x45aa0000), SPH_C32(0x4c490000), + SPH_C32(0xd7e96115), SPH_C32(0x28a308a9), SPH_C32(0xd5c3e757), + SPH_C32(0xe14c7fae) }, + { SPH_C32(0x45150002), SPH_C32(0x27839800), SPH_C32(0x15aa0000), + SPH_C32(0x8e930000), SPH_C32(0xb3a52540), SPH_C32(0x78341987), + SPH_C32(0xeebb7578), SPH_C32(0x74f900ba), SPH_C32(0x98610003), + SPH_C32(0x3b77fc00), SPH_C32(0x607b0000), SPH_C32(0xbb290000), + SPH_C32(0x5ed819cf), SPH_C32(0x3777f0c9), SPH_C32(0x9b134442), + SPH_C32(0x406f8031) }, + { SPH_C32(0x3fc40002), SPH_C32(0xb871a400), SPH_C32(0x28560000), + SPH_C32(0x7b150000), SPH_C32(0xce0b4fe0), SPH_C32(0xb6f7abce), + SPH_C32(0x5237e933), SPH_C32(0xd5bc862a), SPH_C32(0x006d0003), + SPH_C32(0xcc9be700), SPH_C32(0x45840000), SPH_C32(0x2a1f0000), + SPH_C32(0x70bc78de), SPH_C32(0xce96bcf9), SPH_C32(0xac4fb29e), + SPH_C32(0xae684855) }, + { SPH_C32(0x33b60002), SPH_C32(0xf194ab00), SPH_C32(0x6a2f0000), + SPH_C32(0x27ff0000), SPH_C32(0xfda17ffa), SPH_C32(0xa3758eda), + SPH_C32(0xc794a248), SPH_C32(0x61f786ba), SPH_C32(0xfe4f0003), + SPH_C32(0x6bc3e200), SPH_C32(0x60550000), SPH_C32(0xdd7f0000), + SPH_C32(0xf98d0004), SPH_C32(0xd1424499), SPH_C32(0xe29f118b), + SPH_C32(0x0f4bb7ca) }, + { SPH_C32(0xc1e60002), SPH_C32(0x1f29a100), SPH_C32(0x0d870000), + SPH_C32(0x8c750000), SPH_C32(0x473a373a), SPH_C32(0xa92353ae), + SPH_C32(0x1ce74a26), SPH_C32(0x749f79b5), SPH_C32(0xf23d0003), + SPH_C32(0x2226ed00), SPH_C32(0x222c0000), SPH_C32(0x81950000), + SPH_C32(0xca27301e), SPH_C32(0xc4c0618d), SPH_C32(0x773c5af0), + SPH_C32(0xbb00b75a) }, + { SPH_C32(0xcd940002), SPH_C32(0x56ccae00), SPH_C32(0x4ffe0000), + SPH_C32(0xd09f0000), SPH_C32(0x74900720), SPH_C32(0xbca176ba), + SPH_C32(0x8944015d), SPH_C32(0xc0d47925), SPH_C32(0x0c1f0003), + SPH_C32(0x857ee800), SPH_C32(0x07fd0000), SPH_C32(0x76f50000), + SPH_C32(0x431648c4), SPH_C32(0xdb1499ed), SPH_C32(0x39ecf9e5), + SPH_C32(0x1a2348c5) }, + { SPH_C32(0x7adc0002), SPH_C32(0x1dc4b300), SPH_C32(0xd13c0000), + SPH_C32(0x405d0000), SPH_C32(0xd0c75bcc), SPH_C32(0x95e43e18), + SPH_C32(0x448b4f83), SPH_C32(0x0a8f72f5), SPH_C32(0xb8500003), + SPH_C32(0xdaeae100), SPH_C32(0x721e0000), SPH_C32(0xdfae0000), + SPH_C32(0x523d1972), SPH_C32(0x60de4dbc), SPH_C32(0xca6ba488), + SPH_C32(0x6ba9a36b) }, + { SPH_C32(0x76ae0002), SPH_C32(0x5421bc00), SPH_C32(0x93450000), + SPH_C32(0x1cb70000), SPH_C32(0xe36d6bd6), SPH_C32(0x80661b0c), + SPH_C32(0xd12804f8), SPH_C32(0xbec47265), SPH_C32(0x46720003), + SPH_C32(0x7db2e400), SPH_C32(0x57cf0000), SPH_C32(0x28ce0000), + SPH_C32(0xdb0c61a8), SPH_C32(0x7f0ab5dc), SPH_C32(0x84bb079d), + SPH_C32(0xca8a5cf4) }, + { SPH_C32(0x84fe0002), SPH_C32(0xba9cb600), SPH_C32(0xf4ed0000), + SPH_C32(0xb73d0000), SPH_C32(0x59f62316), SPH_C32(0x8a30c678), + SPH_C32(0x0a5bec96), SPH_C32(0xabac8d6a), SPH_C32(0x4a000003), + SPH_C32(0x3457eb00), SPH_C32(0x15b60000), SPH_C32(0x74240000), + SPH_C32(0xe8a651b2), SPH_C32(0x6a8890c8), SPH_C32(0x11184ce6), + SPH_C32(0x7ec15c64) }, + { SPH_C32(0x888c0002), SPH_C32(0xf379b900), SPH_C32(0xb6940000), + SPH_C32(0xebd70000), SPH_C32(0x6a5c130c), SPH_C32(0x9fb2e36c), + SPH_C32(0x9ff8a7ed), SPH_C32(0x1fe78dfa), SPH_C32(0xb4220003), + SPH_C32(0x930fee00), SPH_C32(0x30670000), SPH_C32(0x83440000), + SPH_C32(0x61972968), SPH_C32(0x755c68a8), SPH_C32(0x5fc8eff3), + SPH_C32(0xdfe2a3fb) }, + { SPH_C32(0x87f90002), SPH_C32(0xae00a200), SPH_C32(0x1fcc0000), + SPH_C32(0x8ea40000), SPH_C32(0xec8a2e4c), SPH_C32(0x18bf5a8b), + SPH_C32(0x3413ff25), SPH_C32(0x107d6d14), SPH_C32(0xfd480003), + SPH_C32(0x7f5ff600), SPH_C32(0x8b740000), SPH_C32(0xe4e60000), + SPH_C32(0x4cf10d5e), SPH_C32(0x43cdd86a), SPH_C32(0xdcd70238), + SPH_C32(0xb49a57b4) }, + { SPH_C32(0x8b8b0002), SPH_C32(0xe7e5ad00), SPH_C32(0x5db50000), + SPH_C32(0xd24e0000), SPH_C32(0xdf201e56), SPH_C32(0x0d3d7f9f), + SPH_C32(0xa1b0b45e), SPH_C32(0xa4366d84), SPH_C32(0x036a0003), + SPH_C32(0xd807f300), SPH_C32(0xaea50000), SPH_C32(0x13860000), + SPH_C32(0xc5c07584), SPH_C32(0x5c19200a), SPH_C32(0x9207a12d), + SPH_C32(0x15b9a82b) }, + { SPH_C32(0x79db0002), SPH_C32(0x0958a700), SPH_C32(0x3a1d0000), + SPH_C32(0x79c40000), SPH_C32(0x65bb5696), SPH_C32(0x076ba2eb), + SPH_C32(0x7ac35c30), SPH_C32(0xb15e928b), SPH_C32(0x0f180003), + SPH_C32(0x91e2fc00), SPH_C32(0xecdc0000), SPH_C32(0x4f6c0000), + SPH_C32(0xf66a459e), SPH_C32(0x499b051e), SPH_C32(0x07a4ea56), + SPH_C32(0xa1f2a8bb) }, + { SPH_C32(0x75a90002), SPH_C32(0x40bda800), SPH_C32(0x78640000), + SPH_C32(0x252e0000), SPH_C32(0x5611668c), SPH_C32(0x12e987ff), + SPH_C32(0xef60174b), SPH_C32(0x0515921b), SPH_C32(0xf13a0003), + SPH_C32(0x36baf900), SPH_C32(0xc90d0000), SPH_C32(0xb80c0000), + SPH_C32(0x7f5b3d44), SPH_C32(0x564ffd7e), SPH_C32(0x49744943), + SPH_C32(0x00d15724) }, + { SPH_C32(0xc2e10002), SPH_C32(0x0bb5b500), SPH_C32(0xe6a60000), + SPH_C32(0xb5ec0000), SPH_C32(0xf2463a60), SPH_C32(0x3baccf5d), + SPH_C32(0x22af5995), SPH_C32(0xcf4e99cb), SPH_C32(0x45750003), + SPH_C32(0x692ef000), SPH_C32(0xbcee0000), SPH_C32(0x11570000), + SPH_C32(0x6e706cf2), SPH_C32(0xed85292f), SPH_C32(0xbaf3142e), + SPH_C32(0x715bbc8a) }, + { SPH_C32(0xce930002), SPH_C32(0x4250ba00), SPH_C32(0xa4df0000), + SPH_C32(0xe9060000), SPH_C32(0xc1ec0a7a), SPH_C32(0x2e2eea49), + SPH_C32(0xb70c12ee), SPH_C32(0x7b05995b), SPH_C32(0xbb570003), + SPH_C32(0xce76f500), SPH_C32(0x993f0000), SPH_C32(0xe6370000), + SPH_C32(0xe7411428), SPH_C32(0xf251d14f), SPH_C32(0xf423b73b), + SPH_C32(0xd0784315) }, + { SPH_C32(0x3cc30002), SPH_C32(0xacedb000), SPH_C32(0xc3770000), + SPH_C32(0x428c0000), SPH_C32(0x7b7742ba), SPH_C32(0x2478373d), + SPH_C32(0x6c7ffa80), SPH_C32(0x6e6d6654), SPH_C32(0xb7250003), + SPH_C32(0x8793fa00), SPH_C32(0xdb460000), SPH_C32(0xbadd0000), + SPH_C32(0xd4eb2432), SPH_C32(0xe7d3f45b), SPH_C32(0x6180fc40), + SPH_C32(0x64334385) }, + { SPH_C32(0x30b10002), SPH_C32(0xe508bf00), SPH_C32(0x810e0000), + SPH_C32(0x1e660000), SPH_C32(0x48dd72a0), SPH_C32(0x31fa1229), + SPH_C32(0xf9dcb1fb), SPH_C32(0xda2666c4), SPH_C32(0x49070003), + SPH_C32(0x20cbff00), SPH_C32(0xfe970000), SPH_C32(0x4dbd0000), + SPH_C32(0x5dda5ce8), SPH_C32(0xf8070c3b), SPH_C32(0x2f505f55), + SPH_C32(0xc510bc1a) } +}; + +static const sph_u32 T512_24[256][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x86790000), SPH_C32(0x3f390002), SPH_C32(0xe19ae000), + SPH_C32(0x98560000), SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), + SPH_C32(0xd3dd4944), SPH_C32(0x161ddab9), SPH_C32(0x30b70000), + SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), SPH_C32(0x42c40000), + SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), SPH_C32(0x21afa1ea), + SPH_C32(0xb0a51834) }, + { SPH_C32(0x30b70000), SPH_C32(0xe5d00000), SPH_C32(0xf4f46000), + SPH_C32(0x42c40000), SPH_C32(0x63b83d6a), SPH_C32(0x78ba9460), + SPH_C32(0x21afa1ea), SPH_C32(0xb0a51834), SPH_C32(0xb6ce0000), + SPH_C32(0xdae90002), SPH_C32(0x156e8000), SPH_C32(0xda920000), + SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), SPH_C32(0xf272e8ae), + SPH_C32(0xa6b8c28d) }, + { SPH_C32(0xb6ce0000), SPH_C32(0xdae90002), SPH_C32(0x156e8000), + SPH_C32(0xda920000), SPH_C32(0xf6dd5a64), SPH_C32(0x36325c8a), + SPH_C32(0xf272e8ae), SPH_C32(0xa6b8c28d), SPH_C32(0x86790000), + SPH_C32(0x3f390002), SPH_C32(0xe19ae000), SPH_C32(0x98560000), + SPH_C32(0x9565670e), SPH_C32(0x4e88c8ea), SPH_C32(0xd3dd4944), + SPH_C32(0x161ddab9) }, + { SPH_C32(0x14190000), SPH_C32(0x23ca003c), SPH_C32(0x50df0000), + SPH_C32(0x44b60000), SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), + SPH_C32(0x61e610b0), SPH_C32(0xdbcadb80), SPH_C32(0xe3430000), + SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), SPH_C32(0xaa4e0000), + SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), SPH_C32(0x123db156), + SPH_C32(0x3a4e99d7) }, + { SPH_C32(0x92600000), SPH_C32(0x1cf3003e), SPH_C32(0xb145e000), + SPH_C32(0xdce00000), SPH_C32(0x8e0900be), SPH_C32(0x727b649f), + SPH_C32(0xb23b59f4), SPH_C32(0xcdd70139), SPH_C32(0xd3f40000), + SPH_C32(0xdf9e0014), SPH_C32(0x06326000), SPH_C32(0xe88a0000), + SPH_C32(0xb8a67fcc), SPH_C32(0x5dd12a75), SPH_C32(0x339210bc), + SPH_C32(0x8aeb81e3) }, + { SPH_C32(0x24ae0000), SPH_C32(0xc61a003c), SPH_C32(0xa42b6000), + SPH_C32(0x06720000), SPH_C32(0x78d45ada), SPH_C32(0x44493815), + SPH_C32(0x4049b15a), SPH_C32(0x6b6fc3b4), SPH_C32(0x558d0000), + SPH_C32(0xe0a70016), SPH_C32(0xe7a88000), SPH_C32(0x70dc0000), + SPH_C32(0x2dc318c2), SPH_C32(0x1359e29f), SPH_C32(0xe04f59f8), + SPH_C32(0x9cf65b5a) }, + { SPH_C32(0xa2d70000), SPH_C32(0xf923003e), SPH_C32(0x45b18000), + SPH_C32(0x9e240000), SPH_C32(0xedb13dd4), SPH_C32(0x0ac1f0ff), + SPH_C32(0x9394f81e), SPH_C32(0x7d72190d), SPH_C32(0x653a0000), + SPH_C32(0x05770016), SPH_C32(0x135ce000), SPH_C32(0x32180000), + SPH_C32(0x4e7b25a8), SPH_C32(0x6be376ff), SPH_C32(0xc1e0f812), + SPH_C32(0x2c53436e) }, + { SPH_C32(0xe3430000), SPH_C32(0x3a4e0014), SPH_C32(0xf2c60000), + SPH_C32(0xaa4e0000), SPH_C32(0xdb1e42a6), SPH_C32(0x256bbe15), + SPH_C32(0x123db156), SPH_C32(0x3a4e99d7), SPH_C32(0xf75a0000), + SPH_C32(0x19840028), SPH_C32(0xa2190000), SPH_C32(0xeef80000), + SPH_C32(0xc0722516), SPH_C32(0x19981260), SPH_C32(0x73dba1e6), + SPH_C32(0xe1844257) }, + { SPH_C32(0x653a0000), SPH_C32(0x05770016), SPH_C32(0x135ce000), + SPH_C32(0x32180000), SPH_C32(0x4e7b25a8), SPH_C32(0x6be376ff), + SPH_C32(0xc1e0f812), SPH_C32(0x2c53436e), SPH_C32(0xc7ed0000), + SPH_C32(0xfc540028), SPH_C32(0x56ed6000), SPH_C32(0xac3c0000), + SPH_C32(0xa3ca187c), SPH_C32(0x61228600), SPH_C32(0x5274000c), + SPH_C32(0x51215a63) }, + { SPH_C32(0xd3f40000), SPH_C32(0xdf9e0014), SPH_C32(0x06326000), + SPH_C32(0xe88a0000), SPH_C32(0xb8a67fcc), SPH_C32(0x5dd12a75), + SPH_C32(0x339210bc), SPH_C32(0x8aeb81e3), SPH_C32(0x41940000), + SPH_C32(0xc36d002a), SPH_C32(0xb7778000), SPH_C32(0x346a0000), + SPH_C32(0x36af7f72), SPH_C32(0x2faa4eea), SPH_C32(0x81a94948), + SPH_C32(0x473c80da) }, + { SPH_C32(0x558d0000), SPH_C32(0xe0a70016), SPH_C32(0xe7a88000), + SPH_C32(0x70dc0000), SPH_C32(0x2dc318c2), SPH_C32(0x1359e29f), + SPH_C32(0xe04f59f8), SPH_C32(0x9cf65b5a), SPH_C32(0x71230000), + SPH_C32(0x26bd002a), SPH_C32(0x4383e000), SPH_C32(0x76ae0000), + SPH_C32(0x55174218), SPH_C32(0x5710da8a), SPH_C32(0xa006e8a2), + SPH_C32(0xf79998ee) }, + { SPH_C32(0xf75a0000), SPH_C32(0x19840028), SPH_C32(0xa2190000), + SPH_C32(0xeef80000), SPH_C32(0xc0722516), SPH_C32(0x19981260), + SPH_C32(0x73dba1e6), SPH_C32(0xe1844257), SPH_C32(0x14190000), + SPH_C32(0x23ca003c), SPH_C32(0x50df0000), SPH_C32(0x44b60000), + SPH_C32(0x1b6c67b0), SPH_C32(0x3cf3ac75), SPH_C32(0x61e610b0), + SPH_C32(0xdbcadb80) }, + { SPH_C32(0x71230000), SPH_C32(0x26bd002a), SPH_C32(0x4383e000), + SPH_C32(0x76ae0000), SPH_C32(0x55174218), SPH_C32(0x5710da8a), + SPH_C32(0xa006e8a2), SPH_C32(0xf79998ee), SPH_C32(0x24ae0000), + SPH_C32(0xc61a003c), SPH_C32(0xa42b6000), SPH_C32(0x06720000), + SPH_C32(0x78d45ada), SPH_C32(0x44493815), SPH_C32(0x4049b15a), + SPH_C32(0x6b6fc3b4) }, + { SPH_C32(0xc7ed0000), SPH_C32(0xfc540028), SPH_C32(0x56ed6000), + SPH_C32(0xac3c0000), SPH_C32(0xa3ca187c), SPH_C32(0x61228600), + SPH_C32(0x5274000c), SPH_C32(0x51215a63), SPH_C32(0xa2d70000), + SPH_C32(0xf923003e), SPH_C32(0x45b18000), SPH_C32(0x9e240000), + SPH_C32(0xedb13dd4), SPH_C32(0x0ac1f0ff), SPH_C32(0x9394f81e), + SPH_C32(0x7d72190d) }, + { SPH_C32(0x41940000), SPH_C32(0xc36d002a), SPH_C32(0xb7778000), + SPH_C32(0x346a0000), SPH_C32(0x36af7f72), SPH_C32(0x2faa4eea), + SPH_C32(0x81a94948), SPH_C32(0x473c80da), SPH_C32(0x92600000), + SPH_C32(0x1cf3003e), SPH_C32(0xb145e000), SPH_C32(0xdce00000), + SPH_C32(0x8e0900be), SPH_C32(0x727b649f), SPH_C32(0xb23b59f4), + SPH_C32(0xcdd70139) }, + { SPH_C32(0x54500000), SPH_C32(0x0671005c), SPH_C32(0x25ae0000), + SPH_C32(0x6a1e0000), SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), + SPH_C32(0xbfba18c3), SPH_C32(0x7e715d17), SPH_C32(0xbc8d0000), + SPH_C32(0xfc3b0018), SPH_C32(0x19830000), SPH_C32(0xd10b0000), + SPH_C32(0xae1878c4), SPH_C32(0x42a69856), SPH_C32(0x0012da37), + SPH_C32(0x2c3b504e) }, + { SPH_C32(0xd2290000), SPH_C32(0x3948005e), SPH_C32(0xc434e000), + SPH_C32(0xf2480000), SPH_C32(0xbbc029d1), SPH_C32(0x28c64df8), + SPH_C32(0x6c675187), SPH_C32(0x686c87ae), SPH_C32(0x8c3a0000), + SPH_C32(0x19eb0018), SPH_C32(0xed776000), SPH_C32(0x93cf0000), + SPH_C32(0xcda045ae), SPH_C32(0x3a1c0c36), SPH_C32(0x21bd7bdd), + SPH_C32(0x9c9e487a) }, + { SPH_C32(0x64e70000), SPH_C32(0xe3a1005c), SPH_C32(0xd15a6000), + SPH_C32(0x28da0000), SPH_C32(0x4d1d73b5), SPH_C32(0x1ef41172), + SPH_C32(0x9e15b929), SPH_C32(0xced44523), SPH_C32(0x0a430000), + SPH_C32(0x26d2001a), SPH_C32(0x0ced8000), SPH_C32(0x0b990000), + SPH_C32(0x58c522a0), SPH_C32(0x7494c4dc), SPH_C32(0xf2603299), + SPH_C32(0x8a8392c3) }, + { SPH_C32(0xe29e0000), SPH_C32(0xdc98005e), SPH_C32(0x30c08000), + SPH_C32(0xb08c0000), SPH_C32(0xd87814bb), SPH_C32(0x507cd998), + SPH_C32(0x4dc8f06d), SPH_C32(0xd8c99f9a), SPH_C32(0x3af40000), + SPH_C32(0xc302001a), SPH_C32(0xf819e000), SPH_C32(0x495d0000), + SPH_C32(0x3b7d1fca), SPH_C32(0x0c2e50bc), SPH_C32(0xd3cf9373), + SPH_C32(0x3a268af7) }, + { SPH_C32(0x40490000), SPH_C32(0x25bb0060), SPH_C32(0x75710000), + SPH_C32(0x2ea80000), SPH_C32(0x35c9296f), SPH_C32(0x5abd2967), + SPH_C32(0xde5c0873), SPH_C32(0xa5bb8697), SPH_C32(0x5fce0000), + SPH_C32(0xc675000c), SPH_C32(0xeb450000), SPH_C32(0x7b450000), + SPH_C32(0x75063a62), SPH_C32(0x67cd2643), SPH_C32(0x122f6b61), + SPH_C32(0x1675c999) }, + { SPH_C32(0xc6300000), SPH_C32(0x1a820062), SPH_C32(0x94ebe000), + SPH_C32(0xb6fe0000), SPH_C32(0xa0ac4e61), SPH_C32(0x1435e18d), + SPH_C32(0x0d814137), SPH_C32(0xb3a65c2e), SPH_C32(0x6f790000), + SPH_C32(0x23a5000c), SPH_C32(0x1fb16000), SPH_C32(0x39810000), + SPH_C32(0x16be0708), SPH_C32(0x1f77b223), SPH_C32(0x3380ca8b), + SPH_C32(0xa6d0d1ad) }, + { SPH_C32(0x70fe0000), SPH_C32(0xc06b0060), SPH_C32(0x81856000), + SPH_C32(0x6c6c0000), SPH_C32(0x56711405), SPH_C32(0x2207bd07), + SPH_C32(0xfff3a999), SPH_C32(0x151e9ea3), SPH_C32(0xe9000000), + SPH_C32(0x1c9c000e), SPH_C32(0xfe2b8000), SPH_C32(0xa1d70000), + SPH_C32(0x83db6006), SPH_C32(0x51ff7ac9), SPH_C32(0xe05d83cf), + SPH_C32(0xb0cd0b14) }, + { SPH_C32(0xf6870000), SPH_C32(0xff520062), SPH_C32(0x601f8000), + SPH_C32(0xf43a0000), SPH_C32(0xc314730b), SPH_C32(0x6c8f75ed), + SPH_C32(0x2c2ee0dd), SPH_C32(0x0303441a), SPH_C32(0xd9b70000), + SPH_C32(0xf94c000e), SPH_C32(0x0adfe000), SPH_C32(0xe3130000), + SPH_C32(0xe0635d6c), SPH_C32(0x2945eea9), SPH_C32(0xc1f22225), + SPH_C32(0x00681320) }, + { SPH_C32(0xb7130000), SPH_C32(0x3c3f0048), SPH_C32(0xd7680000), + SPH_C32(0xc0500000), SPH_C32(0xf5bb0c79), SPH_C32(0x43253b07), + SPH_C32(0xad87a995), SPH_C32(0x443fc4c0), SPH_C32(0x4bd70000), + SPH_C32(0xe5bf0030), SPH_C32(0xbb9a0000), SPH_C32(0x3ff30000), + SPH_C32(0x6e6a5dd2), SPH_C32(0x5b3e8a36), SPH_C32(0x73c97bd1), + SPH_C32(0xcdbf1219) }, + { SPH_C32(0x316a0000), SPH_C32(0x0306004a), SPH_C32(0x36f2e000), + SPH_C32(0x58060000), SPH_C32(0x60de6b77), SPH_C32(0x0dadf3ed), + SPH_C32(0x7e5ae0d1), SPH_C32(0x52221e79), SPH_C32(0x7b600000), + SPH_C32(0x006f0030), SPH_C32(0x4f6e6000), SPH_C32(0x7d370000), + SPH_C32(0x0dd260b8), SPH_C32(0x23841e56), SPH_C32(0x5266da3b), + SPH_C32(0x7d1a0a2d) }, + { SPH_C32(0x87a40000), SPH_C32(0xd9ef0048), SPH_C32(0x239c6000), + SPH_C32(0x82940000), SPH_C32(0x96033113), SPH_C32(0x3b9faf67), + SPH_C32(0x8c28087f), SPH_C32(0xf49adcf4), SPH_C32(0xfd190000), + SPH_C32(0x3f560032), SPH_C32(0xaef48000), SPH_C32(0xe5610000), + SPH_C32(0x98b707b6), SPH_C32(0x6d0cd6bc), SPH_C32(0x81bb937f), + SPH_C32(0x6b07d094) }, + { SPH_C32(0x01dd0000), SPH_C32(0xe6d6004a), SPH_C32(0xc2068000), + SPH_C32(0x1ac20000), SPH_C32(0x0366561d), SPH_C32(0x7517678d), + SPH_C32(0x5ff5413b), SPH_C32(0xe287064d), SPH_C32(0xcdae0000), + SPH_C32(0xda860032), SPH_C32(0x5a00e000), SPH_C32(0xa7a50000), + SPH_C32(0xfb0f3adc), SPH_C32(0x15b642dc), SPH_C32(0xa0143295), + SPH_C32(0xdba2c8a0) }, + { SPH_C32(0xa30a0000), SPH_C32(0x1ff50074), SPH_C32(0x87b70000), + SPH_C32(0x84e60000), SPH_C32(0xeed76bc9), SPH_C32(0x7fd69772), + SPH_C32(0xcc61b925), SPH_C32(0x9ff51f40), SPH_C32(0xa8940000), + SPH_C32(0xdff10024), SPH_C32(0x495c0000), SPH_C32(0x95bd0000), + SPH_C32(0xb5741f74), SPH_C32(0x7e553423), SPH_C32(0x61f4ca87), + SPH_C32(0xf7f18bce) }, + { SPH_C32(0x25730000), SPH_C32(0x20cc0076), SPH_C32(0x662de000), + SPH_C32(0x1cb00000), SPH_C32(0x7bb20cc7), SPH_C32(0x315e5f98), + SPH_C32(0x1fbcf061), SPH_C32(0x89e8c5f9), SPH_C32(0x98230000), + SPH_C32(0x3a210024), SPH_C32(0xbda86000), SPH_C32(0xd7790000), + SPH_C32(0xd6cc221e), SPH_C32(0x06efa043), SPH_C32(0x405b6b6d), + SPH_C32(0x475493fa) }, + { SPH_C32(0x93bd0000), SPH_C32(0xfa250074), SPH_C32(0x73436000), + SPH_C32(0xc6220000), SPH_C32(0x8d6f56a3), SPH_C32(0x076c0312), + SPH_C32(0xedce18cf), SPH_C32(0x2f500774), SPH_C32(0x1e5a0000), + SPH_C32(0x05180026), SPH_C32(0x5c328000), SPH_C32(0x4f2f0000), + SPH_C32(0x43a94510), SPH_C32(0x486768a9), SPH_C32(0x93862229), + SPH_C32(0x51494943) }, + { SPH_C32(0x15c40000), SPH_C32(0xc51c0076), SPH_C32(0x92d98000), + SPH_C32(0x5e740000), SPH_C32(0x180a31ad), SPH_C32(0x49e4cbf8), + SPH_C32(0x3e13518b), SPH_C32(0x394dddcd), SPH_C32(0x2eed0000), + SPH_C32(0xe0c80026), SPH_C32(0xa8c6e000), SPH_C32(0x0deb0000), + SPH_C32(0x2011787a), SPH_C32(0x30ddfcc9), SPH_C32(0xb22983c3), + SPH_C32(0xe1ec5177) }, + { SPH_C32(0xbc8d0000), SPH_C32(0xfc3b0018), SPH_C32(0x19830000), + SPH_C32(0xd10b0000), SPH_C32(0xae1878c4), SPH_C32(0x42a69856), + SPH_C32(0x0012da37), SPH_C32(0x2c3b504e), SPH_C32(0xe8dd0000), + SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), SPH_C32(0xbb150000), + SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), SPH_C32(0xbfa8c2f4), + SPH_C32(0x524a0d59) }, + { SPH_C32(0x3af40000), SPH_C32(0xc302001a), SPH_C32(0xf819e000), + SPH_C32(0x495d0000), SPH_C32(0x3b7d1fca), SPH_C32(0x0c2e50bc), + SPH_C32(0xd3cf9373), SPH_C32(0x3a268af7), SPH_C32(0xd86a0000), + SPH_C32(0x1f9a0044), SPH_C32(0xc8d96000), SPH_C32(0xf9d10000), + SPH_C32(0xe3050b71), SPH_C32(0x5c528924), SPH_C32(0x9e07631e), + SPH_C32(0xe2ef156d) }, + { SPH_C32(0x8c3a0000), SPH_C32(0x19eb0018), SPH_C32(0xed776000), + SPH_C32(0x93cf0000), SPH_C32(0xcda045ae), SPH_C32(0x3a1c0c36), + SPH_C32(0x21bd7bdd), SPH_C32(0x9c9e487a), SPH_C32(0x5e130000), + SPH_C32(0x20a30046), SPH_C32(0x29438000), SPH_C32(0x61870000), + SPH_C32(0x76606c7f), SPH_C32(0x12da41ce), SPH_C32(0x4dda2a5a), + SPH_C32(0xf4f2cfd4) }, + { SPH_C32(0x0a430000), SPH_C32(0x26d2001a), SPH_C32(0x0ced8000), + SPH_C32(0x0b990000), SPH_C32(0x58c522a0), SPH_C32(0x7494c4dc), + SPH_C32(0xf2603299), SPH_C32(0x8a8392c3), SPH_C32(0x6ea40000), + SPH_C32(0xc5730046), SPH_C32(0xddb7e000), SPH_C32(0x23430000), + SPH_C32(0x15d85115), SPH_C32(0x6a60d5ae), SPH_C32(0x6c758bb0), + SPH_C32(0x4457d7e0) }, + { SPH_C32(0xa8940000), SPH_C32(0xdff10024), SPH_C32(0x495c0000), + SPH_C32(0x95bd0000), SPH_C32(0xb5741f74), SPH_C32(0x7e553423), + SPH_C32(0x61f4ca87), SPH_C32(0xf7f18bce), SPH_C32(0x0b9e0000), + SPH_C32(0xc0040050), SPH_C32(0xceeb0000), SPH_C32(0x115b0000), + SPH_C32(0x5ba374bd), SPH_C32(0x0183a351), SPH_C32(0xad9573a2), + SPH_C32(0x6804948e) }, + { SPH_C32(0x2eed0000), SPH_C32(0xe0c80026), SPH_C32(0xa8c6e000), + SPH_C32(0x0deb0000), SPH_C32(0x2011787a), SPH_C32(0x30ddfcc9), + SPH_C32(0xb22983c3), SPH_C32(0xe1ec5177), SPH_C32(0x3b290000), + SPH_C32(0x25d40050), SPH_C32(0x3a1f6000), SPH_C32(0x539f0000), + SPH_C32(0x381b49d7), SPH_C32(0x79393731), SPH_C32(0x8c3ad248), + SPH_C32(0xd8a18cba) }, + { SPH_C32(0x98230000), SPH_C32(0x3a210024), SPH_C32(0xbda86000), + SPH_C32(0xd7790000), SPH_C32(0xd6cc221e), SPH_C32(0x06efa043), + SPH_C32(0x405b6b6d), SPH_C32(0x475493fa), SPH_C32(0xbd500000), + SPH_C32(0x1aed0052), SPH_C32(0xdb858000), SPH_C32(0xcbc90000), + SPH_C32(0xad7e2ed9), SPH_C32(0x37b1ffdb), SPH_C32(0x5fe79b0c), + SPH_C32(0xcebc5603) }, + { SPH_C32(0x1e5a0000), SPH_C32(0x05180026), SPH_C32(0x5c328000), + SPH_C32(0x4f2f0000), SPH_C32(0x43a94510), SPH_C32(0x486768a9), + SPH_C32(0x93862229), SPH_C32(0x51494943), SPH_C32(0x8de70000), + SPH_C32(0xff3d0052), SPH_C32(0x2f71e000), SPH_C32(0x890d0000), + SPH_C32(0xcec613b3), SPH_C32(0x4f0b6bbb), SPH_C32(0x7e483ae6), + SPH_C32(0x7e194e37) }, + { SPH_C32(0x5fce0000), SPH_C32(0xc675000c), SPH_C32(0xeb450000), + SPH_C32(0x7b450000), SPH_C32(0x75063a62), SPH_C32(0x67cd2643), + SPH_C32(0x122f6b61), SPH_C32(0x1675c999), SPH_C32(0x1f870000), + SPH_C32(0xe3ce006c), SPH_C32(0x9e340000), SPH_C32(0x55ed0000), + SPH_C32(0x40cf130d), SPH_C32(0x3d700f24), SPH_C32(0xcc736312), + SPH_C32(0xb3ce4f0e) }, + { SPH_C32(0xd9b70000), SPH_C32(0xf94c000e), SPH_C32(0x0adfe000), + SPH_C32(0xe3130000), SPH_C32(0xe0635d6c), SPH_C32(0x2945eea9), + SPH_C32(0xc1f22225), SPH_C32(0x00681320), SPH_C32(0x2f300000), + SPH_C32(0x061e006c), SPH_C32(0x6ac06000), SPH_C32(0x17290000), + SPH_C32(0x23772e67), SPH_C32(0x45ca9b44), SPH_C32(0xeddcc2f8), + SPH_C32(0x036b573a) }, + { SPH_C32(0x6f790000), SPH_C32(0x23a5000c), SPH_C32(0x1fb16000), + SPH_C32(0x39810000), SPH_C32(0x16be0708), SPH_C32(0x1f77b223), + SPH_C32(0x3380ca8b), SPH_C32(0xa6d0d1ad), SPH_C32(0xa9490000), + SPH_C32(0x3927006e), SPH_C32(0x8b5a8000), SPH_C32(0x8f7f0000), + SPH_C32(0xb6124969), SPH_C32(0x0b4253ae), SPH_C32(0x3e018bbc), + SPH_C32(0x15768d83) }, + { SPH_C32(0xe9000000), SPH_C32(0x1c9c000e), SPH_C32(0xfe2b8000), + SPH_C32(0xa1d70000), SPH_C32(0x83db6006), SPH_C32(0x51ff7ac9), + SPH_C32(0xe05d83cf), SPH_C32(0xb0cd0b14), SPH_C32(0x99fe0000), + SPH_C32(0xdcf7006e), SPH_C32(0x7faee000), SPH_C32(0xcdbb0000), + SPH_C32(0xd5aa7403), SPH_C32(0x73f8c7ce), SPH_C32(0x1fae2a56), + SPH_C32(0xa5d395b7) }, + { SPH_C32(0x4bd70000), SPH_C32(0xe5bf0030), SPH_C32(0xbb9a0000), + SPH_C32(0x3ff30000), SPH_C32(0x6e6a5dd2), SPH_C32(0x5b3e8a36), + SPH_C32(0x73c97bd1), SPH_C32(0xcdbf1219), SPH_C32(0xfcc40000), + SPH_C32(0xd9800078), SPH_C32(0x6cf20000), SPH_C32(0xffa30000), + SPH_C32(0x9bd151ab), SPH_C32(0x181bb131), SPH_C32(0xde4ed244), + SPH_C32(0x8980d6d9) }, + { SPH_C32(0xcdae0000), SPH_C32(0xda860032), SPH_C32(0x5a00e000), + SPH_C32(0xa7a50000), SPH_C32(0xfb0f3adc), SPH_C32(0x15b642dc), + SPH_C32(0xa0143295), SPH_C32(0xdba2c8a0), SPH_C32(0xcc730000), + SPH_C32(0x3c500078), SPH_C32(0x98066000), SPH_C32(0xbd670000), + SPH_C32(0xf8696cc1), SPH_C32(0x60a12551), SPH_C32(0xffe173ae), + SPH_C32(0x3925ceed) }, + { SPH_C32(0x7b600000), SPH_C32(0x006f0030), SPH_C32(0x4f6e6000), + SPH_C32(0x7d370000), SPH_C32(0x0dd260b8), SPH_C32(0x23841e56), + SPH_C32(0x5266da3b), SPH_C32(0x7d1a0a2d), SPH_C32(0x4a0a0000), + SPH_C32(0x0369007a), SPH_C32(0x799c8000), SPH_C32(0x25310000), + SPH_C32(0x6d0c0bcf), SPH_C32(0x2e29edbb), SPH_C32(0x2c3c3aea), + SPH_C32(0x2f381454) }, + { SPH_C32(0xfd190000), SPH_C32(0x3f560032), SPH_C32(0xaef48000), + SPH_C32(0xe5610000), SPH_C32(0x98b707b6), SPH_C32(0x6d0cd6bc), + SPH_C32(0x81bb937f), SPH_C32(0x6b07d094), SPH_C32(0x7abd0000), + SPH_C32(0xe6b9007a), SPH_C32(0x8d68e000), SPH_C32(0x67f50000), + SPH_C32(0x0eb436a5), SPH_C32(0x569379db), SPH_C32(0x0d939b00), + SPH_C32(0x9f9d0c60) }, + { SPH_C32(0xe8dd0000), SPH_C32(0xfa4a0044), SPH_C32(0x3c2d0000), + SPH_C32(0xbb150000), SPH_C32(0x80bd361b), SPH_C32(0x24e81d44), + SPH_C32(0xbfa8c2f4), SPH_C32(0x524a0d59), SPH_C32(0x54500000), + SPH_C32(0x0671005c), SPH_C32(0x25ae0000), SPH_C32(0x6a1e0000), + SPH_C32(0x2ea54edf), SPH_C32(0x664e8512), SPH_C32(0xbfba18c3), + SPH_C32(0x7e715d17) }, + { SPH_C32(0x6ea40000), SPH_C32(0xc5730046), SPH_C32(0xddb7e000), + SPH_C32(0x23430000), SPH_C32(0x15d85115), SPH_C32(0x6a60d5ae), + SPH_C32(0x6c758bb0), SPH_C32(0x4457d7e0), SPH_C32(0x64e70000), + SPH_C32(0xe3a1005c), SPH_C32(0xd15a6000), SPH_C32(0x28da0000), + SPH_C32(0x4d1d73b5), SPH_C32(0x1ef41172), SPH_C32(0x9e15b929), + SPH_C32(0xced44523) }, + { SPH_C32(0xd86a0000), SPH_C32(0x1f9a0044), SPH_C32(0xc8d96000), + SPH_C32(0xf9d10000), SPH_C32(0xe3050b71), SPH_C32(0x5c528924), + SPH_C32(0x9e07631e), SPH_C32(0xe2ef156d), SPH_C32(0xe29e0000), + SPH_C32(0xdc98005e), SPH_C32(0x30c08000), SPH_C32(0xb08c0000), + SPH_C32(0xd87814bb), SPH_C32(0x507cd998), SPH_C32(0x4dc8f06d), + SPH_C32(0xd8c99f9a) }, + { SPH_C32(0x5e130000), SPH_C32(0x20a30046), SPH_C32(0x29438000), + SPH_C32(0x61870000), SPH_C32(0x76606c7f), SPH_C32(0x12da41ce), + SPH_C32(0x4dda2a5a), SPH_C32(0xf4f2cfd4), SPH_C32(0xd2290000), + SPH_C32(0x3948005e), SPH_C32(0xc434e000), SPH_C32(0xf2480000), + SPH_C32(0xbbc029d1), SPH_C32(0x28c64df8), SPH_C32(0x6c675187), + SPH_C32(0x686c87ae) }, + { SPH_C32(0xfcc40000), SPH_C32(0xd9800078), SPH_C32(0x6cf20000), + SPH_C32(0xffa30000), SPH_C32(0x9bd151ab), SPH_C32(0x181bb131), + SPH_C32(0xde4ed244), SPH_C32(0x8980d6d9), SPH_C32(0xb7130000), + SPH_C32(0x3c3f0048), SPH_C32(0xd7680000), SPH_C32(0xc0500000), + SPH_C32(0xf5bb0c79), SPH_C32(0x43253b07), SPH_C32(0xad87a995), + SPH_C32(0x443fc4c0) }, + { SPH_C32(0x7abd0000), SPH_C32(0xe6b9007a), SPH_C32(0x8d68e000), + SPH_C32(0x67f50000), SPH_C32(0x0eb436a5), SPH_C32(0x569379db), + SPH_C32(0x0d939b00), SPH_C32(0x9f9d0c60), SPH_C32(0x87a40000), + SPH_C32(0xd9ef0048), SPH_C32(0x239c6000), SPH_C32(0x82940000), + SPH_C32(0x96033113), SPH_C32(0x3b9faf67), SPH_C32(0x8c28087f), + SPH_C32(0xf49adcf4) }, + { SPH_C32(0xcc730000), SPH_C32(0x3c500078), SPH_C32(0x98066000), + SPH_C32(0xbd670000), SPH_C32(0xf8696cc1), SPH_C32(0x60a12551), + SPH_C32(0xffe173ae), SPH_C32(0x3925ceed), SPH_C32(0x01dd0000), + SPH_C32(0xe6d6004a), SPH_C32(0xc2068000), SPH_C32(0x1ac20000), + SPH_C32(0x0366561d), SPH_C32(0x7517678d), SPH_C32(0x5ff5413b), + SPH_C32(0xe287064d) }, + { SPH_C32(0x4a0a0000), SPH_C32(0x0369007a), SPH_C32(0x799c8000), + SPH_C32(0x25310000), SPH_C32(0x6d0c0bcf), SPH_C32(0x2e29edbb), + SPH_C32(0x2c3c3aea), SPH_C32(0x2f381454), SPH_C32(0x316a0000), + SPH_C32(0x0306004a), SPH_C32(0x36f2e000), SPH_C32(0x58060000), + SPH_C32(0x60de6b77), SPH_C32(0x0dadf3ed), SPH_C32(0x7e5ae0d1), + SPH_C32(0x52221e79) }, + { SPH_C32(0x0b9e0000), SPH_C32(0xc0040050), SPH_C32(0xceeb0000), + SPH_C32(0x115b0000), SPH_C32(0x5ba374bd), SPH_C32(0x0183a351), + SPH_C32(0xad9573a2), SPH_C32(0x6804948e), SPH_C32(0xa30a0000), + SPH_C32(0x1ff50074), SPH_C32(0x87b70000), SPH_C32(0x84e60000), + SPH_C32(0xeed76bc9), SPH_C32(0x7fd69772), SPH_C32(0xcc61b925), + SPH_C32(0x9ff51f40) }, + { SPH_C32(0x8de70000), SPH_C32(0xff3d0052), SPH_C32(0x2f71e000), + SPH_C32(0x890d0000), SPH_C32(0xcec613b3), SPH_C32(0x4f0b6bbb), + SPH_C32(0x7e483ae6), SPH_C32(0x7e194e37), SPH_C32(0x93bd0000), + SPH_C32(0xfa250074), SPH_C32(0x73436000), SPH_C32(0xc6220000), + SPH_C32(0x8d6f56a3), SPH_C32(0x076c0312), SPH_C32(0xedce18cf), + SPH_C32(0x2f500774) }, + { SPH_C32(0x3b290000), SPH_C32(0x25d40050), SPH_C32(0x3a1f6000), + SPH_C32(0x539f0000), SPH_C32(0x381b49d7), SPH_C32(0x79393731), + SPH_C32(0x8c3ad248), SPH_C32(0xd8a18cba), SPH_C32(0x15c40000), + SPH_C32(0xc51c0076), SPH_C32(0x92d98000), SPH_C32(0x5e740000), + SPH_C32(0x180a31ad), SPH_C32(0x49e4cbf8), SPH_C32(0x3e13518b), + SPH_C32(0x394dddcd) }, + { SPH_C32(0xbd500000), SPH_C32(0x1aed0052), SPH_C32(0xdb858000), + SPH_C32(0xcbc90000), SPH_C32(0xad7e2ed9), SPH_C32(0x37b1ffdb), + SPH_C32(0x5fe79b0c), SPH_C32(0xcebc5603), SPH_C32(0x25730000), + SPH_C32(0x20cc0076), SPH_C32(0x662de000), SPH_C32(0x1cb00000), + SPH_C32(0x7bb20cc7), SPH_C32(0x315e5f98), SPH_C32(0x1fbcf061), + SPH_C32(0x89e8c5f9) }, + { SPH_C32(0x1f870000), SPH_C32(0xe3ce006c), SPH_C32(0x9e340000), + SPH_C32(0x55ed0000), SPH_C32(0x40cf130d), SPH_C32(0x3d700f24), + SPH_C32(0xcc736312), SPH_C32(0xb3ce4f0e), SPH_C32(0x40490000), + SPH_C32(0x25bb0060), SPH_C32(0x75710000), SPH_C32(0x2ea80000), + SPH_C32(0x35c9296f), SPH_C32(0x5abd2967), SPH_C32(0xde5c0873), + SPH_C32(0xa5bb8697) }, + { SPH_C32(0x99fe0000), SPH_C32(0xdcf7006e), SPH_C32(0x7faee000), + SPH_C32(0xcdbb0000), SPH_C32(0xd5aa7403), SPH_C32(0x73f8c7ce), + SPH_C32(0x1fae2a56), SPH_C32(0xa5d395b7), SPH_C32(0x70fe0000), + SPH_C32(0xc06b0060), SPH_C32(0x81856000), SPH_C32(0x6c6c0000), + SPH_C32(0x56711405), SPH_C32(0x2207bd07), SPH_C32(0xfff3a999), + SPH_C32(0x151e9ea3) }, + { SPH_C32(0x2f300000), SPH_C32(0x061e006c), SPH_C32(0x6ac06000), + SPH_C32(0x17290000), SPH_C32(0x23772e67), SPH_C32(0x45ca9b44), + SPH_C32(0xeddcc2f8), SPH_C32(0x036b573a), SPH_C32(0xf6870000), + SPH_C32(0xff520062), SPH_C32(0x601f8000), SPH_C32(0xf43a0000), + SPH_C32(0xc314730b), SPH_C32(0x6c8f75ed), SPH_C32(0x2c2ee0dd), + SPH_C32(0x0303441a) }, + { SPH_C32(0xa9490000), SPH_C32(0x3927006e), SPH_C32(0x8b5a8000), + SPH_C32(0x8f7f0000), SPH_C32(0xb6124969), SPH_C32(0x0b4253ae), + SPH_C32(0x3e018bbc), SPH_C32(0x15768d83), SPH_C32(0xc6300000), + SPH_C32(0x1a820062), SPH_C32(0x94ebe000), SPH_C32(0xb6fe0000), + SPH_C32(0xa0ac4e61), SPH_C32(0x1435e18d), SPH_C32(0x0d814137), + SPH_C32(0xb3a65c2e) }, + { SPH_C32(0x69510000), SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), + SPH_C32(0xac2f0000), SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), + SPH_C32(0x87ec287c), SPH_C32(0xbce1a3ce), SPH_C32(0xc6730000), + SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), SPH_C32(0x218d0000), + SPH_C32(0x23111587), SPH_C32(0x7913512f), SPH_C32(0x1d28ac88), + SPH_C32(0x378dd173) }, + { SPH_C32(0xef280000), SPH_C32(0xebd8009e), SPH_C32(0x22b9e000), + SPH_C32(0x34790000), SPH_C32(0x71f06ca0), SPH_C32(0x802cdd36), + SPH_C32(0x54316138), SPH_C32(0xaafc7977), SPH_C32(0xf6c40000), + SPH_C32(0x4a5d000c), SPH_C32(0x50356000), SPH_C32(0x63490000), + SPH_C32(0x40a928ed), SPH_C32(0x01a9c54f), SPH_C32(0x3c870d62), + SPH_C32(0x8728c947) }, + { SPH_C32(0x59e60000), SPH_C32(0x3131009c), SPH_C32(0x37d76000), + SPH_C32(0xeeeb0000), SPH_C32(0x872d36c4), SPH_C32(0xb61e81bc), + SPH_C32(0xa6438996), SPH_C32(0x0c44bbfa), SPH_C32(0x70bd0000), + SPH_C32(0x7564000e), SPH_C32(0xb1af8000), SPH_C32(0xfb1f0000), + SPH_C32(0xd5cc4fe3), SPH_C32(0x4f210da5), SPH_C32(0xef5a4426), + SPH_C32(0x913513fe) }, + { SPH_C32(0xdf9f0000), SPH_C32(0x0e08009e), SPH_C32(0xd64d8000), + SPH_C32(0x76bd0000), SPH_C32(0x124851ca), SPH_C32(0xf8964956), + SPH_C32(0x759ec0d2), SPH_C32(0x1a596143), SPH_C32(0x400a0000), + SPH_C32(0x90b4000e), SPH_C32(0x455be000), SPH_C32(0xb9db0000), + SPH_C32(0xb6747289), SPH_C32(0x379b99c5), SPH_C32(0xcef5e5cc), + SPH_C32(0x21900bca) }, + { SPH_C32(0x7d480000), SPH_C32(0xf72b00a0), SPH_C32(0x93fc0000), + SPH_C32(0xe8990000), SPH_C32(0xfff96c1e), SPH_C32(0xf257b9a9), + SPH_C32(0xe60a38cc), SPH_C32(0x672b784e), SPH_C32(0x25300000), + SPH_C32(0x95c30018), SPH_C32(0x56070000), SPH_C32(0x8bc30000), + SPH_C32(0xf80f5721), SPH_C32(0x5c78ef3a), SPH_C32(0x0f151dde), + SPH_C32(0x0dc348a4) }, + { SPH_C32(0xfb310000), SPH_C32(0xc81200a2), SPH_C32(0x7266e000), + SPH_C32(0x70cf0000), SPH_C32(0x6a9c0b10), SPH_C32(0xbcdf7143), + SPH_C32(0x35d77188), SPH_C32(0x7136a2f7), SPH_C32(0x15870000), + SPH_C32(0x70130018), SPH_C32(0xa2f36000), SPH_C32(0xc9070000), + SPH_C32(0x9bb76a4b), SPH_C32(0x24c27b5a), SPH_C32(0x2ebabc34), + SPH_C32(0xbd665090) }, + { SPH_C32(0x4dff0000), SPH_C32(0x12fb00a0), SPH_C32(0x67086000), + SPH_C32(0xaa5d0000), SPH_C32(0x9c415174), SPH_C32(0x8aed2dc9), + SPH_C32(0xc7a59926), SPH_C32(0xd78e607a), SPH_C32(0x93fe0000), + SPH_C32(0x4f2a001a), SPH_C32(0x43698000), SPH_C32(0x51510000), + SPH_C32(0x0ed20d45), SPH_C32(0x6a4ab3b0), SPH_C32(0xfd67f570), + SPH_C32(0xab7b8a29) }, + { SPH_C32(0xcb860000), SPH_C32(0x2dc200a2), SPH_C32(0x86928000), + SPH_C32(0x320b0000), SPH_C32(0x0924367a), SPH_C32(0xc465e523), + SPH_C32(0x1478d062), SPH_C32(0xc193bac3), SPH_C32(0xa3490000), + SPH_C32(0xaafa001a), SPH_C32(0xb79de000), SPH_C32(0x13950000), + SPH_C32(0x6d6a302f), SPH_C32(0x12f027d0), SPH_C32(0xdcc8549a), + SPH_C32(0x1bde921d) }, + { SPH_C32(0x8a120000), SPH_C32(0xeeaf0088), SPH_C32(0x31e50000), + SPH_C32(0x06610000), SPH_C32(0x3f8b4908), SPH_C32(0xebcfabc9), + SPH_C32(0x95d1992a), SPH_C32(0x86af3a19), SPH_C32(0x31290000), + SPH_C32(0xb6090024), SPH_C32(0x06d80000), SPH_C32(0xcf750000), + SPH_C32(0xe3633091), SPH_C32(0x608b434f), SPH_C32(0x6ef30d6e), + SPH_C32(0xd6099324) }, + { SPH_C32(0x0c6b0000), SPH_C32(0xd196008a), SPH_C32(0xd07fe000), + SPH_C32(0x9e370000), SPH_C32(0xaaee2e06), SPH_C32(0xa5476323), + SPH_C32(0x460cd06e), SPH_C32(0x90b2e0a0), SPH_C32(0x019e0000), + SPH_C32(0x53d90024), SPH_C32(0xf22c6000), SPH_C32(0x8db10000), + SPH_C32(0x80db0dfb), SPH_C32(0x1831d72f), SPH_C32(0x4f5cac84), + SPH_C32(0x66ac8b10) }, + { SPH_C32(0xbaa50000), SPH_C32(0x0b7f0088), SPH_C32(0xc5116000), + SPH_C32(0x44a50000), SPH_C32(0x5c337462), SPH_C32(0x93753fa9), + SPH_C32(0xb47e38c0), SPH_C32(0x360a222d), SPH_C32(0x87e70000), + SPH_C32(0x6ce00026), SPH_C32(0x13b68000), SPH_C32(0x15e70000), + SPH_C32(0x15be6af5), SPH_C32(0x56b91fc5), SPH_C32(0x9c81e5c0), + SPH_C32(0x70b151a9) }, + { SPH_C32(0x3cdc0000), SPH_C32(0x3446008a), SPH_C32(0x248b8000), + SPH_C32(0xdcf30000), SPH_C32(0xc956136c), SPH_C32(0xddfdf743), + SPH_C32(0x67a37184), SPH_C32(0x2017f894), SPH_C32(0xb7500000), + SPH_C32(0x89300026), SPH_C32(0xe742e000), SPH_C32(0x57230000), + SPH_C32(0x7606579f), SPH_C32(0x2e038ba5), SPH_C32(0xbd2e442a), + SPH_C32(0xc014499d) }, + { SPH_C32(0x9e0b0000), SPH_C32(0xcd6500b4), SPH_C32(0x613a0000), + SPH_C32(0x42d70000), SPH_C32(0x24e72eb8), SPH_C32(0xd73c07bc), + SPH_C32(0xf437899a), SPH_C32(0x5d65e199), SPH_C32(0xd26a0000), + SPH_C32(0x8c470030), SPH_C32(0xf41e0000), SPH_C32(0x653b0000), + SPH_C32(0x387d7237), SPH_C32(0x45e0fd5a), SPH_C32(0x7ccebc38), + SPH_C32(0xec470af3) }, + { SPH_C32(0x18720000), SPH_C32(0xf25c00b6), SPH_C32(0x80a0e000), + SPH_C32(0xda810000), SPH_C32(0xb18249b6), SPH_C32(0x99b4cf56), + SPH_C32(0x27eac0de), SPH_C32(0x4b783b20), SPH_C32(0xe2dd0000), + SPH_C32(0x69970030), SPH_C32(0x00ea6000), SPH_C32(0x27ff0000), + SPH_C32(0x5bc54f5d), SPH_C32(0x3d5a693a), SPH_C32(0x5d611dd2), + SPH_C32(0x5ce212c7) }, + { SPH_C32(0xaebc0000), SPH_C32(0x28b500b4), SPH_C32(0x95ce6000), + SPH_C32(0x00130000), SPH_C32(0x475f13d2), SPH_C32(0xaf8693dc), + SPH_C32(0xd5982870), SPH_C32(0xedc0f9ad), SPH_C32(0x64a40000), + SPH_C32(0x56ae0032), SPH_C32(0xe1708000), SPH_C32(0xbfa90000), + SPH_C32(0xcea02853), SPH_C32(0x73d2a1d0), SPH_C32(0x8ebc5496), + SPH_C32(0x4affc87e) }, + { SPH_C32(0x28c50000), SPH_C32(0x178c00b6), SPH_C32(0x74548000), + SPH_C32(0x98450000), SPH_C32(0xd23a74dc), SPH_C32(0xe10e5b36), + SPH_C32(0x06456134), SPH_C32(0xfbdd2314), SPH_C32(0x54130000), + SPH_C32(0xb37e0032), SPH_C32(0x1584e000), SPH_C32(0xfd6d0000), + SPH_C32(0xad181539), SPH_C32(0x0b6835b0), SPH_C32(0xaf13f57c), + SPH_C32(0xfa5ad04a) }, + { SPH_C32(0x3d010000), SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), + SPH_C32(0xc6310000), SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), + SPH_C32(0x385630bf), SPH_C32(0xc290fed9), SPH_C32(0x7afe0000), + SPH_C32(0x53b60014), SPH_C32(0xbd420000), SPH_C32(0xf0860000), + SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), SPH_C32(0x1d3a76bf), + SPH_C32(0x1bb6813d) }, + { SPH_C32(0xbb780000), SPH_C32(0xeda900c2), SPH_C32(0x0717e000), + SPH_C32(0x5e670000), SPH_C32(0x5f55227f), SPH_C32(0xe6625824), + SPH_C32(0xeb8b79fb), SPH_C32(0xd48d2460), SPH_C32(0x4a490000), + SPH_C32(0xb6660014), SPH_C32(0x49b66000), SPH_C32(0xb2420000), + SPH_C32(0xeeb15029), SPH_C32(0x430f5d19), SPH_C32(0x3c95d755), + SPH_C32(0xab139909) }, + { SPH_C32(0x0db60000), SPH_C32(0x374000c0), SPH_C32(0x12796000), + SPH_C32(0x84f50000), SPH_C32(0xa988781b), SPH_C32(0xd05004ae), + SPH_C32(0x19f99155), SPH_C32(0x7235e6ed), SPH_C32(0xcc300000), + SPH_C32(0x895f0016), SPH_C32(0xa82c8000), SPH_C32(0x2a140000), + SPH_C32(0x7bd43727), SPH_C32(0x0d8795f3), SPH_C32(0xef489e11), + SPH_C32(0xbd0e43b0) }, + { SPH_C32(0x8bcf0000), SPH_C32(0x087900c2), SPH_C32(0xf3e38000), + SPH_C32(0x1ca30000), SPH_C32(0x3ced1f15), SPH_C32(0x9ed8cc44), + SPH_C32(0xca24d811), SPH_C32(0x64283c54), SPH_C32(0xfc870000), + SPH_C32(0x6c8f0016), SPH_C32(0x5cd8e000), SPH_C32(0x68d00000), + SPH_C32(0x186c0a4d), SPH_C32(0x753d0193), SPH_C32(0xcee73ffb), + SPH_C32(0x0dab5b84) }, + { SPH_C32(0x29180000), SPH_C32(0xf15a00fc), SPH_C32(0xb6520000), + SPH_C32(0x82870000), SPH_C32(0xd15c22c1), SPH_C32(0x94193cbb), + SPH_C32(0x59b0200f), SPH_C32(0x195a2559), SPH_C32(0x99bd0000), + SPH_C32(0x69f80000), SPH_C32(0x4f840000), SPH_C32(0x5ac80000), + SPH_C32(0x56172fe5), SPH_C32(0x1ede776c), SPH_C32(0x0f07c7e9), + SPH_C32(0x21f818ea) }, + { SPH_C32(0xaf610000), SPH_C32(0xce6300fe), SPH_C32(0x57c8e000), + SPH_C32(0x1ad10000), SPH_C32(0x443945cf), SPH_C32(0xda91f451), + SPH_C32(0x8a6d694b), SPH_C32(0x0f47ffe0), SPH_C32(0xa90a0000), + SPH_C32(0x8c280000), SPH_C32(0xbb706000), SPH_C32(0x180c0000), + SPH_C32(0x35af128f), SPH_C32(0x6664e30c), SPH_C32(0x2ea86603), + SPH_C32(0x915d00de) }, + { SPH_C32(0x19af0000), SPH_C32(0x148a00fc), SPH_C32(0x42a66000), + SPH_C32(0xc0430000), SPH_C32(0xb2e41fab), SPH_C32(0xeca3a8db), + SPH_C32(0x781f81e5), SPH_C32(0xa9ff3d6d), SPH_C32(0x2f730000), + SPH_C32(0xb3110002), SPH_C32(0x5aea8000), SPH_C32(0x805a0000), + SPH_C32(0xa0ca7581), SPH_C32(0x28ec2be6), SPH_C32(0xfd752f47), + SPH_C32(0x8740da67) }, + { SPH_C32(0x9fd60000), SPH_C32(0x2bb300fe), SPH_C32(0xa33c8000), + SPH_C32(0x58150000), SPH_C32(0x278178a5), SPH_C32(0xa22b6031), + SPH_C32(0xabc2c8a1), SPH_C32(0xbfe2e7d4), SPH_C32(0x1fc40000), + SPH_C32(0x56c10002), SPH_C32(0xae1ee000), SPH_C32(0xc29e0000), + SPH_C32(0xc37248eb), SPH_C32(0x5056bf86), SPH_C32(0xdcda8ead), + SPH_C32(0x37e5c253) }, + { SPH_C32(0xde420000), SPH_C32(0xe8de00d4), SPH_C32(0x144b0000), + SPH_C32(0x6c7f0000), SPH_C32(0x112e07d7), SPH_C32(0x8d812edb), + SPH_C32(0x2a6b81e9), SPH_C32(0xf8de670e), SPH_C32(0x8da40000), + SPH_C32(0x4a32003c), SPH_C32(0x1f5b0000), SPH_C32(0x1e7e0000), + SPH_C32(0x4d7b4855), SPH_C32(0x222ddb19), SPH_C32(0x6ee1d759), + SPH_C32(0xfa32c36a) }, + { SPH_C32(0x583b0000), SPH_C32(0xd7e700d6), SPH_C32(0xf5d1e000), + SPH_C32(0xf4290000), SPH_C32(0x844b60d9), SPH_C32(0xc309e631), + SPH_C32(0xf9b6c8ad), SPH_C32(0xeec3bdb7), SPH_C32(0xbd130000), + SPH_C32(0xafe2003c), SPH_C32(0xebaf6000), SPH_C32(0x5cba0000), + SPH_C32(0x2ec3753f), SPH_C32(0x5a974f79), SPH_C32(0x4f4e76b3), + SPH_C32(0x4a97db5e) }, + { SPH_C32(0xeef50000), SPH_C32(0x0d0e00d4), SPH_C32(0xe0bf6000), + SPH_C32(0x2ebb0000), SPH_C32(0x72963abd), SPH_C32(0xf53bbabb), + SPH_C32(0x0bc42003), SPH_C32(0x487b7f3a), SPH_C32(0x3b6a0000), + SPH_C32(0x90db003e), SPH_C32(0x0a358000), SPH_C32(0xc4ec0000), + SPH_C32(0xbba61231), SPH_C32(0x141f8793), SPH_C32(0x9c933ff7), + SPH_C32(0x5c8a01e7) }, + { SPH_C32(0x688c0000), SPH_C32(0x323700d6), SPH_C32(0x01258000), + SPH_C32(0xb6ed0000), SPH_C32(0xe7f35db3), SPH_C32(0xbbb37251), + SPH_C32(0xd8196947), SPH_C32(0x5e66a583), SPH_C32(0x0bdd0000), + SPH_C32(0x750b003e), SPH_C32(0xfec1e000), SPH_C32(0x86280000), + SPH_C32(0xd81e2f5b), SPH_C32(0x6ca513f3), SPH_C32(0xbd3c9e1d), + SPH_C32(0xec2f19d3) }, + { SPH_C32(0xca5b0000), SPH_C32(0xcb1400e8), SPH_C32(0x44940000), + SPH_C32(0x28c90000), SPH_C32(0x0a426067), SPH_C32(0xb17282ae), + SPH_C32(0x4b8d9159), SPH_C32(0x2314bc8e), SPH_C32(0x6ee70000), + SPH_C32(0x707c0028), SPH_C32(0xed9d0000), SPH_C32(0xb4300000), + SPH_C32(0x96650af3), SPH_C32(0x0746650c), SPH_C32(0x7cdc660f), + SPH_C32(0xc07c5abd) }, + { SPH_C32(0x4c220000), SPH_C32(0xf42d00ea), SPH_C32(0xa50ee000), + SPH_C32(0xb09f0000), SPH_C32(0x9f270769), SPH_C32(0xfffa4a44), + SPH_C32(0x9850d81d), SPH_C32(0x35096637), SPH_C32(0x5e500000), + SPH_C32(0x95ac0028), SPH_C32(0x19696000), SPH_C32(0xf6f40000), + SPH_C32(0xf5dd3799), SPH_C32(0x7ffcf16c), SPH_C32(0x5d73c7e5), + SPH_C32(0x70d94289) }, + { SPH_C32(0xfaec0000), SPH_C32(0x2ec400e8), SPH_C32(0xb0606000), + SPH_C32(0x6a0d0000), SPH_C32(0x69fa5d0d), SPH_C32(0xc9c816ce), + SPH_C32(0x6a2230b3), SPH_C32(0x93b1a4ba), SPH_C32(0xd8290000), + SPH_C32(0xaa95002a), SPH_C32(0xf8f38000), SPH_C32(0x6ea20000), + SPH_C32(0x60b85097), SPH_C32(0x31743986), SPH_C32(0x8eae8ea1), + SPH_C32(0x66c49830) }, + { SPH_C32(0x7c950000), SPH_C32(0x11fd00ea), SPH_C32(0x51fa8000), + SPH_C32(0xf25b0000), SPH_C32(0xfc9f3a03), SPH_C32(0x8740de24), + SPH_C32(0xb9ff79f7), SPH_C32(0x85ac7e03), SPH_C32(0xe89e0000), + SPH_C32(0x4f45002a), SPH_C32(0x0c07e000), SPH_C32(0x2c660000), + SPH_C32(0x03006dfd), SPH_C32(0x49ceade6), SPH_C32(0xaf012f4b), + SPH_C32(0xd6618004) }, + { SPH_C32(0xd5dc0000), SPH_C32(0x28da0084), SPH_C32(0xdaa00000), + SPH_C32(0x7d240000), SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), + SPH_C32(0x87fef24b), SPH_C32(0x90daf380), SPH_C32(0x2eae0000), + SPH_C32(0x55c70048), SPH_C32(0x98ec0000), SPH_C32(0x9a980000), + SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), SPH_C32(0xa2806e7c), + SPH_C32(0x65c7dc2a) }, + { SPH_C32(0x53a50000), SPH_C32(0x17e30086), SPH_C32(0x3b3ae000), + SPH_C32(0xe5720000), SPH_C32(0xdfe81464), SPH_C32(0xc28a4560), + SPH_C32(0x5423bb0f), SPH_C32(0x86c72939), SPH_C32(0x1e190000), + SPH_C32(0xb0170048), SPH_C32(0x6c186000), SPH_C32(0xd85c0000), + SPH_C32(0xc0141ef6), SPH_C32(0x2541d80b), SPH_C32(0x832fcf96), + SPH_C32(0xd562c41e) }, + { SPH_C32(0xe56b0000), SPH_C32(0xcd0a0084), SPH_C32(0x2e546000), + SPH_C32(0x3fe00000), SPH_C32(0x29354e00), SPH_C32(0xf4b819ea), + SPH_C32(0xa65153a1), SPH_C32(0x207febb4), SPH_C32(0x98600000), + SPH_C32(0x8f2e004a), SPH_C32(0x8d828000), SPH_C32(0x400a0000), + SPH_C32(0x557179f8), SPH_C32(0x6bc910e1), SPH_C32(0x50f286d2), + SPH_C32(0xc37f1ea7) }, + { SPH_C32(0x63120000), SPH_C32(0xf2330086), SPH_C32(0xcfce8000), + SPH_C32(0xa7b60000), SPH_C32(0xbc50290e), SPH_C32(0xba30d100), + SPH_C32(0x758c1ae5), SPH_C32(0x3662310d), SPH_C32(0xa8d70000), + SPH_C32(0x6afe004a), SPH_C32(0x7976e000), SPH_C32(0x02ce0000), + SPH_C32(0x36c94492), SPH_C32(0x13738481), SPH_C32(0x715d2738), + SPH_C32(0x73da0693) }, + { SPH_C32(0xc1c50000), SPH_C32(0x0b1000b8), SPH_C32(0x8a7f0000), + SPH_C32(0x39920000), SPH_C32(0x51e114da), SPH_C32(0xb0f121ff), + SPH_C32(0xe618e2fb), SPH_C32(0x4b102800), SPH_C32(0xcded0000), + SPH_C32(0x6f89005c), SPH_C32(0x6a2a0000), SPH_C32(0x30d60000), + SPH_C32(0x78b2613a), SPH_C32(0x7890f27e), SPH_C32(0xb0bddf2a), + SPH_C32(0x5f8945fd) }, + { SPH_C32(0x47bc0000), SPH_C32(0x342900ba), SPH_C32(0x6be5e000), + SPH_C32(0xa1c40000), SPH_C32(0xc48473d4), SPH_C32(0xfe79e915), + SPH_C32(0x35c5abbf), SPH_C32(0x5d0df2b9), SPH_C32(0xfd5a0000), + SPH_C32(0x8a59005c), SPH_C32(0x9ede6000), SPH_C32(0x72120000), + SPH_C32(0x1b0a5c50), SPH_C32(0x002a661e), SPH_C32(0x91127ec0), + SPH_C32(0xef2c5dc9) }, + { SPH_C32(0xf1720000), SPH_C32(0xeec000b8), SPH_C32(0x7e8b6000), + SPH_C32(0x7b560000), SPH_C32(0x325929b0), SPH_C32(0xc84bb59f), + SPH_C32(0xc7b74311), SPH_C32(0xfbb53034), SPH_C32(0x7b230000), + SPH_C32(0xb560005e), SPH_C32(0x7f448000), SPH_C32(0xea440000), + SPH_C32(0x8e6f3b5e), SPH_C32(0x4ea2aef4), SPH_C32(0x42cf3784), + SPH_C32(0xf9318770) }, + { SPH_C32(0x770b0000), SPH_C32(0xd1f900ba), SPH_C32(0x9f118000), + SPH_C32(0xe3000000), SPH_C32(0xa73c4ebe), SPH_C32(0x86c37d75), + SPH_C32(0x146a0a55), SPH_C32(0xeda8ea8d), SPH_C32(0x4b940000), + SPH_C32(0x50b0005e), SPH_C32(0x8bb0e000), SPH_C32(0xa8800000), + SPH_C32(0xedd70634), SPH_C32(0x36183a94), SPH_C32(0x6360966e), + SPH_C32(0x49949f44) }, + { SPH_C32(0x369f0000), SPH_C32(0x12940090), SPH_C32(0x28660000), + SPH_C32(0xd76a0000), SPH_C32(0x919331cc), SPH_C32(0xa969339f), + SPH_C32(0x95c3431d), SPH_C32(0xaa946a57), SPH_C32(0xd9f40000), + SPH_C32(0x4c430060), SPH_C32(0x3af50000), SPH_C32(0x74600000), + SPH_C32(0x63de068a), SPH_C32(0x44635e0b), SPH_C32(0xd15bcf9a), + SPH_C32(0x84439e7d) }, + { SPH_C32(0xb0e60000), SPH_C32(0x2dad0092), SPH_C32(0xc9fce000), + SPH_C32(0x4f3c0000), SPH_C32(0x04f656c2), SPH_C32(0xe7e1fb75), + SPH_C32(0x461e0a59), SPH_C32(0xbc89b0ee), SPH_C32(0xe9430000), + SPH_C32(0xa9930060), SPH_C32(0xce016000), SPH_C32(0x36a40000), + SPH_C32(0x00663be0), SPH_C32(0x3cd9ca6b), SPH_C32(0xf0f46e70), + SPH_C32(0x34e68649) }, + { SPH_C32(0x06280000), SPH_C32(0xf7440090), SPH_C32(0xdc926000), + SPH_C32(0x95ae0000), SPH_C32(0xf22b0ca6), SPH_C32(0xd1d3a7ff), + SPH_C32(0xb46ce2f7), SPH_C32(0x1a317263), SPH_C32(0x6f3a0000), + SPH_C32(0x96aa0062), SPH_C32(0x2f9b8000), SPH_C32(0xaef20000), + SPH_C32(0x95035cee), SPH_C32(0x72510281), SPH_C32(0x23292734), + SPH_C32(0x22fb5cf0) }, + { SPH_C32(0x80510000), SPH_C32(0xc87d0092), SPH_C32(0x3d088000), + SPH_C32(0x0df80000), SPH_C32(0x674e6ba8), SPH_C32(0x9f5b6f15), + SPH_C32(0x67b1abb3), SPH_C32(0x0c2ca8da), SPH_C32(0x5f8d0000), + SPH_C32(0x737a0062), SPH_C32(0xdb6fe000), SPH_C32(0xec360000), + SPH_C32(0xf6bb6184), SPH_C32(0x0aeb96e1), SPH_C32(0x028686de), + SPH_C32(0x925e44c4) }, + { SPH_C32(0x22860000), SPH_C32(0x315e00ac), SPH_C32(0x78b90000), + SPH_C32(0x93dc0000), SPH_C32(0x8aff567c), SPH_C32(0x959a9fea), + SPH_C32(0xf42553ad), SPH_C32(0x715eb1d7), SPH_C32(0x3ab70000), + SPH_C32(0x760d0074), SPH_C32(0xc8330000), SPH_C32(0xde2e0000), + SPH_C32(0xb8c0442c), SPH_C32(0x6108e01e), SPH_C32(0xc3667ecc), + SPH_C32(0xbe0d07aa) }, + { SPH_C32(0xa4ff0000), SPH_C32(0x0e6700ae), SPH_C32(0x9923e000), + SPH_C32(0x0b8a0000), SPH_C32(0x1f9a3172), SPH_C32(0xdb125700), + SPH_C32(0x27f81ae9), SPH_C32(0x67436b6e), SPH_C32(0x0a000000), + SPH_C32(0x93dd0074), SPH_C32(0x3cc76000), SPH_C32(0x9cea0000), + SPH_C32(0xdb787946), SPH_C32(0x19b2747e), SPH_C32(0xe2c9df26), + SPH_C32(0x0ea81f9e) }, + { SPH_C32(0x12310000), SPH_C32(0xd48e00ac), SPH_C32(0x8c4d6000), + SPH_C32(0xd1180000), SPH_C32(0xe9476b16), SPH_C32(0xed200b8a), + SPH_C32(0xd58af247), SPH_C32(0xc1fba9e3), SPH_C32(0x8c790000), + SPH_C32(0xace40076), SPH_C32(0xdd5d8000), SPH_C32(0x04bc0000), + SPH_C32(0x4e1d1e48), SPH_C32(0x573abc94), SPH_C32(0x31149662), + SPH_C32(0x18b5c527) }, + { SPH_C32(0x94480000), SPH_C32(0xebb700ae), SPH_C32(0x6dd78000), + SPH_C32(0x494e0000), SPH_C32(0x7c220c18), SPH_C32(0xa3a8c360), + SPH_C32(0x0657bb03), SPH_C32(0xd7e6735a), SPH_C32(0xbcce0000), + SPH_C32(0x49340076), SPH_C32(0x29a9e000), SPH_C32(0x46780000), + SPH_C32(0x2da52322), SPH_C32(0x2f8028f4), SPH_C32(0x10bb3788), + SPH_C32(0xa810dd13) }, + { SPH_C32(0x818c0000), SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), + SPH_C32(0x173a0000), SPH_C32(0x64283db5), SPH_C32(0xea4c0898), + SPH_C32(0x3844ea88), SPH_C32(0xeeabae97), SPH_C32(0x92230000), + SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), SPH_C32(0x4b930000), + SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), SPH_C32(0xa292b44b), + SPH_C32(0x49fc8c64) }, + { SPH_C32(0x07f50000), SPH_C32(0x119200da), SPH_C32(0x1e94e000), + SPH_C32(0x8f6c0000), SPH_C32(0xf14d5abb), SPH_C32(0xa4c4c072), + SPH_C32(0xeb99a3cc), SPH_C32(0xf8b6742e), SPH_C32(0xa2940000), + SPH_C32(0x4c2c0050), SPH_C32(0x759b6000), SPH_C32(0x09570000), + SPH_C32(0x6e0c6632), SPH_C32(0x67e7405d), SPH_C32(0x833d15a1), + SPH_C32(0xf9599450) }, + { SPH_C32(0xb13b0000), SPH_C32(0xcb7b00d8), SPH_C32(0x0bfa6000), + SPH_C32(0x55fe0000), SPH_C32(0x079000df), SPH_C32(0x92f69cf8), + SPH_C32(0x19eb4b62), SPH_C32(0x5e0eb6a3), SPH_C32(0x24ed0000), + SPH_C32(0x73150052), SPH_C32(0x94018000), SPH_C32(0x91010000), + SPH_C32(0xfb69013c), SPH_C32(0x296f88b7), SPH_C32(0x50e05ce5), + SPH_C32(0xef444ee9) }, + { SPH_C32(0x37420000), SPH_C32(0xf44200da), SPH_C32(0xea608000), + SPH_C32(0xcda80000), SPH_C32(0x92f567d1), SPH_C32(0xdc7e5412), + SPH_C32(0xca360226), SPH_C32(0x48136c1a), SPH_C32(0x145a0000), + SPH_C32(0x96c50052), SPH_C32(0x60f5e000), SPH_C32(0xd3c50000), + SPH_C32(0x98d13c56), SPH_C32(0x51d51cd7), SPH_C32(0x714ffd0f), + SPH_C32(0x5fe156dd) }, + { SPH_C32(0x95950000), SPH_C32(0x0d6100e4), SPH_C32(0xafd10000), + SPH_C32(0x538c0000), SPH_C32(0x7f445a05), SPH_C32(0xd6bfa4ed), + SPH_C32(0x59a2fa38), SPH_C32(0x35617517), SPH_C32(0x71600000), + SPH_C32(0x93b20044), SPH_C32(0x73a90000), SPH_C32(0xe1dd0000), + SPH_C32(0xd6aa19fe), SPH_C32(0x3a366a28), SPH_C32(0xb0af051d), + SPH_C32(0x73b215b3) }, + { SPH_C32(0x13ec0000), SPH_C32(0x325800e6), SPH_C32(0x4e4be000), + SPH_C32(0xcbda0000), SPH_C32(0xea213d0b), SPH_C32(0x98376c07), + SPH_C32(0x8a7fb37c), SPH_C32(0x237cafae), SPH_C32(0x41d70000), + SPH_C32(0x76620044), SPH_C32(0x875d6000), SPH_C32(0xa3190000), + SPH_C32(0xb5122494), SPH_C32(0x428cfe48), SPH_C32(0x9100a4f7), + SPH_C32(0xc3170d87) }, + { SPH_C32(0xa5220000), SPH_C32(0xe8b100e4), SPH_C32(0x5b256000), + SPH_C32(0x11480000), SPH_C32(0x1cfc676f), SPH_C32(0xae05308d), + SPH_C32(0x780d5bd2), SPH_C32(0x85c46d23), SPH_C32(0xc7ae0000), + SPH_C32(0x495b0046), SPH_C32(0x66c78000), SPH_C32(0x3b4f0000), + SPH_C32(0x2077439a), SPH_C32(0x0c0436a2), SPH_C32(0x42ddedb3), + SPH_C32(0xd50ad73e) }, + { SPH_C32(0x235b0000), SPH_C32(0xd78800e6), SPH_C32(0xbabf8000), + SPH_C32(0x891e0000), SPH_C32(0x89990061), SPH_C32(0xe08df867), + SPH_C32(0xabd01296), SPH_C32(0x93d9b79a), SPH_C32(0xf7190000), + SPH_C32(0xac8b0046), SPH_C32(0x9233e000), SPH_C32(0x798b0000), + SPH_C32(0x43cf7ef0), SPH_C32(0x74bea2c2), SPH_C32(0x63724c59), + SPH_C32(0x65afcf0a) }, + { SPH_C32(0x62cf0000), SPH_C32(0x14e500cc), SPH_C32(0x0dc80000), + SPH_C32(0xbd740000), SPH_C32(0xbf367f13), SPH_C32(0xcf27b68d), + SPH_C32(0x2a795bde), SPH_C32(0xd4e53740), SPH_C32(0x65790000), + SPH_C32(0xb0780078), SPH_C32(0x23760000), SPH_C32(0xa56b0000), + SPH_C32(0xcdc67e4e), SPH_C32(0x06c5c65d), SPH_C32(0xd14915ad), + SPH_C32(0xa878ce33) }, + { SPH_C32(0xe4b60000), SPH_C32(0x2bdc00ce), SPH_C32(0xec52e000), + SPH_C32(0x25220000), SPH_C32(0x2a53181d), SPH_C32(0x81af7e67), + SPH_C32(0xf9a4129a), SPH_C32(0xc2f8edf9), SPH_C32(0x55ce0000), + SPH_C32(0x55a80078), SPH_C32(0xd7826000), SPH_C32(0xe7af0000), + SPH_C32(0xae7e4324), SPH_C32(0x7e7f523d), SPH_C32(0xf0e6b447), + SPH_C32(0x18ddd607) }, + { SPH_C32(0x52780000), SPH_C32(0xf13500cc), SPH_C32(0xf93c6000), + SPH_C32(0xffb00000), SPH_C32(0xdc8e4279), SPH_C32(0xb79d22ed), + SPH_C32(0x0bd6fa34), SPH_C32(0x64402f74), SPH_C32(0xd3b70000), + SPH_C32(0x6a91007a), SPH_C32(0x36188000), SPH_C32(0x7ff90000), + SPH_C32(0x3b1b242a), SPH_C32(0x30f79ad7), SPH_C32(0x233bfd03), + SPH_C32(0x0ec00cbe) }, + { SPH_C32(0xd4010000), SPH_C32(0xce0c00ce), SPH_C32(0x18a68000), + SPH_C32(0x67e60000), SPH_C32(0x49eb2577), SPH_C32(0xf915ea07), + SPH_C32(0xd80bb370), SPH_C32(0x725df5cd), SPH_C32(0xe3000000), + SPH_C32(0x8f41007a), SPH_C32(0xc2ece000), SPH_C32(0x3d3d0000), + SPH_C32(0x58a31940), SPH_C32(0x484d0eb7), SPH_C32(0x02945ce9), + SPH_C32(0xbe65148a) }, + { SPH_C32(0x76d60000), SPH_C32(0x372f00f0), SPH_C32(0x5d170000), + SPH_C32(0xf9c20000), SPH_C32(0xa45a18a3), SPH_C32(0xf3d41af8), + SPH_C32(0x4b9f4b6e), SPH_C32(0x0f2fecc0), SPH_C32(0x863a0000), + SPH_C32(0x8a36006c), SPH_C32(0xd1b00000), SPH_C32(0x0f250000), + SPH_C32(0x16d83ce8), SPH_C32(0x23ae7848), SPH_C32(0xc374a4fb), + SPH_C32(0x923657e4) }, + { SPH_C32(0xf0af0000), SPH_C32(0x081600f2), SPH_C32(0xbc8de000), + SPH_C32(0x61940000), SPH_C32(0x313f7fad), SPH_C32(0xbd5cd212), + SPH_C32(0x9842022a), SPH_C32(0x19323679), SPH_C32(0xb68d0000), + SPH_C32(0x6fe6006c), SPH_C32(0x25446000), SPH_C32(0x4de10000), + SPH_C32(0x75600182), SPH_C32(0x5b14ec28), SPH_C32(0xe2db0511), + SPH_C32(0x22934fd0) }, + { SPH_C32(0x46610000), SPH_C32(0xd2ff00f0), SPH_C32(0xa9e36000), + SPH_C32(0xbb060000), SPH_C32(0xc7e225c9), SPH_C32(0x8b6e8e98), + SPH_C32(0x6a30ea84), SPH_C32(0xbf8af4f4), SPH_C32(0x30f40000), + SPH_C32(0x50df006e), SPH_C32(0xc4de8000), SPH_C32(0xd5b70000), + SPH_C32(0xe005668c), SPH_C32(0x159c24c2), SPH_C32(0x31064c55), + SPH_C32(0x348e9569) }, + { SPH_C32(0xc0180000), SPH_C32(0xedc600f2), SPH_C32(0x48798000), + SPH_C32(0x23500000), SPH_C32(0x528742c7), SPH_C32(0xc5e64672), + SPH_C32(0xb9eda3c0), SPH_C32(0xa9972e4d), SPH_C32(0x00430000), + SPH_C32(0xb50f006e), SPH_C32(0x302ae000), SPH_C32(0x97730000), + SPH_C32(0x83bd5be6), SPH_C32(0x6d26b0a2), SPH_C32(0x10a9edbf), + SPH_C32(0x842b8d5d) }, + { SPH_C32(0xc6730000), SPH_C32(0xaf8d000c), SPH_C32(0xa4c10000), + SPH_C32(0x218d0000), SPH_C32(0x23111587), SPH_C32(0x7913512f), + SPH_C32(0x1d28ac88), SPH_C32(0x378dd173), SPH_C32(0xaf220000), + SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), SPH_C32(0x8da20000), + SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), SPH_C32(0x9ac484f4), + SPH_C32(0x8b6c72bd) }, + { SPH_C32(0x400a0000), SPH_C32(0x90b4000e), SPH_C32(0x455be000), + SPH_C32(0xb9db0000), SPH_C32(0xb6747289), SPH_C32(0x379b99c5), + SPH_C32(0xcef5e5cc), SPH_C32(0x21900bca), SPH_C32(0x9f950000), + SPH_C32(0x9ebc0090), SPH_C32(0x93166000), SPH_C32(0xcf660000), + SPH_C32(0xa43c2343), SPH_C32(0xcf0dd093), SPH_C32(0xbb6b251e), + SPH_C32(0x3bc96a89) }, + { SPH_C32(0xf6c40000), SPH_C32(0x4a5d000c), SPH_C32(0x50356000), + SPH_C32(0x63490000), SPH_C32(0x40a928ed), SPH_C32(0x01a9c54f), + SPH_C32(0x3c870d62), SPH_C32(0x8728c947), SPH_C32(0x19ec0000), + SPH_C32(0xa1850092), SPH_C32(0x728c8000), SPH_C32(0x57300000), + SPH_C32(0x3159444d), SPH_C32(0x81851879), SPH_C32(0x68b66c5a), + SPH_C32(0x2dd4b030) }, + { SPH_C32(0x70bd0000), SPH_C32(0x7564000e), SPH_C32(0xb1af8000), + SPH_C32(0xfb1f0000), SPH_C32(0xd5cc4fe3), SPH_C32(0x4f210da5), + SPH_C32(0xef5a4426), SPH_C32(0x913513fe), SPH_C32(0x295b0000), + SPH_C32(0x44550092), SPH_C32(0x8678e000), SPH_C32(0x15f40000), + SPH_C32(0x52e17927), SPH_C32(0xf93f8c19), SPH_C32(0x4919cdb0), + SPH_C32(0x9d71a804) }, + { SPH_C32(0xd26a0000), SPH_C32(0x8c470030), SPH_C32(0xf41e0000), + SPH_C32(0x653b0000), SPH_C32(0x387d7237), SPH_C32(0x45e0fd5a), + SPH_C32(0x7ccebc38), SPH_C32(0xec470af3), SPH_C32(0x4c610000), + SPH_C32(0x41220084), SPH_C32(0x95240000), SPH_C32(0x27ec0000), + SPH_C32(0x1c9a5c8f), SPH_C32(0x92dcfae6), SPH_C32(0x88f935a2), + SPH_C32(0xb122eb6a) }, + { SPH_C32(0x54130000), SPH_C32(0xb37e0032), SPH_C32(0x1584e000), + SPH_C32(0xfd6d0000), SPH_C32(0xad181539), SPH_C32(0x0b6835b0), + SPH_C32(0xaf13f57c), SPH_C32(0xfa5ad04a), SPH_C32(0x7cd60000), + SPH_C32(0xa4f20084), SPH_C32(0x61d06000), SPH_C32(0x65280000), + SPH_C32(0x7f2261e5), SPH_C32(0xea666e86), SPH_C32(0xa9569448), + SPH_C32(0x0187f35e) }, + { SPH_C32(0xe2dd0000), SPH_C32(0x69970030), SPH_C32(0x00ea6000), + SPH_C32(0x27ff0000), SPH_C32(0x5bc54f5d), SPH_C32(0x3d5a693a), + SPH_C32(0x5d611dd2), SPH_C32(0x5ce212c7), SPH_C32(0xfaaf0000), + SPH_C32(0x9bcb0086), SPH_C32(0x804a8000), SPH_C32(0xfd7e0000), + SPH_C32(0xea4706eb), SPH_C32(0xa4eea66c), SPH_C32(0x7a8bdd0c), + SPH_C32(0x179a29e7) }, + { SPH_C32(0x64a40000), SPH_C32(0x56ae0032), SPH_C32(0xe1708000), + SPH_C32(0xbfa90000), SPH_C32(0xcea02853), SPH_C32(0x73d2a1d0), + SPH_C32(0x8ebc5496), SPH_C32(0x4affc87e), SPH_C32(0xca180000), + SPH_C32(0x7e1b0086), SPH_C32(0x74bee000), SPH_C32(0xbfba0000), + SPH_C32(0x89ff3b81), SPH_C32(0xdc54320c), SPH_C32(0x5b247ce6), + SPH_C32(0xa73f31d3) }, + { SPH_C32(0x25300000), SPH_C32(0x95c30018), SPH_C32(0x56070000), + SPH_C32(0x8bc30000), SPH_C32(0xf80f5721), SPH_C32(0x5c78ef3a), + SPH_C32(0x0f151dde), SPH_C32(0x0dc348a4), SPH_C32(0x58780000), + SPH_C32(0x62e800b8), SPH_C32(0xc5fb0000), SPH_C32(0x635a0000), + SPH_C32(0x07f63b3f), SPH_C32(0xae2f5693), SPH_C32(0xe91f2512), + SPH_C32(0x6ae830ea) }, + { SPH_C32(0xa3490000), SPH_C32(0xaafa001a), SPH_C32(0xb79de000), + SPH_C32(0x13950000), SPH_C32(0x6d6a302f), SPH_C32(0x12f027d0), + SPH_C32(0xdcc8549a), SPH_C32(0x1bde921d), SPH_C32(0x68cf0000), + SPH_C32(0x873800b8), SPH_C32(0x310f6000), SPH_C32(0x219e0000), + SPH_C32(0x644e0655), SPH_C32(0xd695c2f3), SPH_C32(0xc8b084f8), + SPH_C32(0xda4d28de) }, + { SPH_C32(0x15870000), SPH_C32(0x70130018), SPH_C32(0xa2f36000), + SPH_C32(0xc9070000), SPH_C32(0x9bb76a4b), SPH_C32(0x24c27b5a), + SPH_C32(0x2ebabc34), SPH_C32(0xbd665090), SPH_C32(0xeeb60000), + SPH_C32(0xb80100ba), SPH_C32(0xd0958000), SPH_C32(0xb9c80000), + SPH_C32(0xf12b615b), SPH_C32(0x981d0a19), SPH_C32(0x1b6dcdbc), + SPH_C32(0xcc50f267) }, + { SPH_C32(0x93fe0000), SPH_C32(0x4f2a001a), SPH_C32(0x43698000), + SPH_C32(0x51510000), SPH_C32(0x0ed20d45), SPH_C32(0x6a4ab3b0), + SPH_C32(0xfd67f570), SPH_C32(0xab7b8a29), SPH_C32(0xde010000), + SPH_C32(0x5dd100ba), SPH_C32(0x2461e000), SPH_C32(0xfb0c0000), + SPH_C32(0x92935c31), SPH_C32(0xe0a79e79), SPH_C32(0x3ac26c56), + SPH_C32(0x7cf5ea53) }, + { SPH_C32(0x31290000), SPH_C32(0xb6090024), SPH_C32(0x06d80000), + SPH_C32(0xcf750000), SPH_C32(0xe3633091), SPH_C32(0x608b434f), + SPH_C32(0x6ef30d6e), SPH_C32(0xd6099324), SPH_C32(0xbb3b0000), + SPH_C32(0x58a600ac), SPH_C32(0x373d0000), SPH_C32(0xc9140000), + SPH_C32(0xdce87999), SPH_C32(0x8b44e886), SPH_C32(0xfb229444), + SPH_C32(0x50a6a93d) }, + { SPH_C32(0xb7500000), SPH_C32(0x89300026), SPH_C32(0xe742e000), + SPH_C32(0x57230000), SPH_C32(0x7606579f), SPH_C32(0x2e038ba5), + SPH_C32(0xbd2e442a), SPH_C32(0xc014499d), SPH_C32(0x8b8c0000), + SPH_C32(0xbd7600ac), SPH_C32(0xc3c96000), SPH_C32(0x8bd00000), + SPH_C32(0xbf5044f3), SPH_C32(0xf3fe7ce6), SPH_C32(0xda8d35ae), + SPH_C32(0xe003b109) }, + { SPH_C32(0x019e0000), SPH_C32(0x53d90024), SPH_C32(0xf22c6000), + SPH_C32(0x8db10000), SPH_C32(0x80db0dfb), SPH_C32(0x1831d72f), + SPH_C32(0x4f5cac84), SPH_C32(0x66ac8b10), SPH_C32(0x0df50000), + SPH_C32(0x824f00ae), SPH_C32(0x22538000), SPH_C32(0x13860000), + SPH_C32(0x2a3523fd), SPH_C32(0xbd76b40c), SPH_C32(0x09507cea), + SPH_C32(0xf61e6bb0) }, + { SPH_C32(0x87e70000), SPH_C32(0x6ce00026), SPH_C32(0x13b68000), + SPH_C32(0x15e70000), SPH_C32(0x15be6af5), SPH_C32(0x56b91fc5), + SPH_C32(0x9c81e5c0), SPH_C32(0x70b151a9), SPH_C32(0x3d420000), + SPH_C32(0x679f00ae), SPH_C32(0xd6a7e000), SPH_C32(0x51420000), + SPH_C32(0x498d1e97), SPH_C32(0xc5cc206c), SPH_C32(0x28ffdd00), + SPH_C32(0x46bb7384) }, + { SPH_C32(0x92230000), SPH_C32(0xa9fc0050), SPH_C32(0x816f0000), + SPH_C32(0x4b930000), SPH_C32(0x0db45b58), SPH_C32(0x1f5dd43d), + SPH_C32(0xa292b44b), SPH_C32(0x49fc8c64), SPH_C32(0x13af0000), + SPH_C32(0x87570088), SPH_C32(0x7e610000), SPH_C32(0x5ca90000), + SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), SPH_C32(0x9ad65ec3), + SPH_C32(0xa75722f3) }, + { SPH_C32(0x145a0000), SPH_C32(0x96c50052), SPH_C32(0x60f5e000), + SPH_C32(0xd3c50000), SPH_C32(0x98d13c56), SPH_C32(0x51d51cd7), + SPH_C32(0x714ffd0f), SPH_C32(0x5fe156dd), SPH_C32(0x23180000), + SPH_C32(0x62870088), SPH_C32(0x8a956000), SPH_C32(0x1e6d0000), + SPH_C32(0x0a245b87), SPH_C32(0x8dab48c5), SPH_C32(0xbb79ff29), + SPH_C32(0x17f23ac7) }, + { SPH_C32(0xa2940000), SPH_C32(0x4c2c0050), SPH_C32(0x759b6000), + SPH_C32(0x09570000), SPH_C32(0x6e0c6632), SPH_C32(0x67e7405d), + SPH_C32(0x833d15a1), SPH_C32(0xf9599450), SPH_C32(0xa5610000), + SPH_C32(0x5dbe008a), SPH_C32(0x6b0f8000), SPH_C32(0x863b0000), + SPH_C32(0x9f413c89), SPH_C32(0xc323802f), SPH_C32(0x68a4b66d), + SPH_C32(0x01efe07e) }, + { SPH_C32(0x24ed0000), SPH_C32(0x73150052), SPH_C32(0x94018000), + SPH_C32(0x91010000), SPH_C32(0xfb69013c), SPH_C32(0x296f88b7), + SPH_C32(0x50e05ce5), SPH_C32(0xef444ee9), SPH_C32(0x95d60000), + SPH_C32(0xb86e008a), SPH_C32(0x9ffbe000), SPH_C32(0xc4ff0000), + SPH_C32(0xfcf901e3), SPH_C32(0xbb99144f), SPH_C32(0x490b1787), + SPH_C32(0xb14af84a) }, + { SPH_C32(0x863a0000), SPH_C32(0x8a36006c), SPH_C32(0xd1b00000), + SPH_C32(0x0f250000), SPH_C32(0x16d83ce8), SPH_C32(0x23ae7848), + SPH_C32(0xc374a4fb), SPH_C32(0x923657e4), SPH_C32(0xf0ec0000), + SPH_C32(0xbd19009c), SPH_C32(0x8ca70000), SPH_C32(0xf6e70000), + SPH_C32(0xb282244b), SPH_C32(0xd07a62b0), SPH_C32(0x88ebef95), + SPH_C32(0x9d19bb24) }, + { SPH_C32(0x00430000), SPH_C32(0xb50f006e), SPH_C32(0x302ae000), + SPH_C32(0x97730000), SPH_C32(0x83bd5be6), SPH_C32(0x6d26b0a2), + SPH_C32(0x10a9edbf), SPH_C32(0x842b8d5d), SPH_C32(0xc05b0000), + SPH_C32(0x58c9009c), SPH_C32(0x78536000), SPH_C32(0xb4230000), + SPH_C32(0xd13a1921), SPH_C32(0xa8c0f6d0), SPH_C32(0xa9444e7f), + SPH_C32(0x2dbca310) }, + { SPH_C32(0xb68d0000), SPH_C32(0x6fe6006c), SPH_C32(0x25446000), + SPH_C32(0x4de10000), SPH_C32(0x75600182), SPH_C32(0x5b14ec28), + SPH_C32(0xe2db0511), SPH_C32(0x22934fd0), SPH_C32(0x46220000), + SPH_C32(0x67f0009e), SPH_C32(0x99c98000), SPH_C32(0x2c750000), + SPH_C32(0x445f7e2f), SPH_C32(0xe6483e3a), SPH_C32(0x7a99073b), + SPH_C32(0x3ba179a9) }, + { SPH_C32(0x30f40000), SPH_C32(0x50df006e), SPH_C32(0xc4de8000), + SPH_C32(0xd5b70000), SPH_C32(0xe005668c), SPH_C32(0x159c24c2), + SPH_C32(0x31064c55), SPH_C32(0x348e9569), SPH_C32(0x76950000), + SPH_C32(0x8220009e), SPH_C32(0x6d3de000), SPH_C32(0x6eb10000), + SPH_C32(0x27e74345), SPH_C32(0x9ef2aa5a), SPH_C32(0x5b36a6d1), + SPH_C32(0x8b04619d) }, + { SPH_C32(0x71600000), SPH_C32(0x93b20044), SPH_C32(0x73a90000), + SPH_C32(0xe1dd0000), SPH_C32(0xd6aa19fe), SPH_C32(0x3a366a28), + SPH_C32(0xb0af051d), SPH_C32(0x73b215b3), SPH_C32(0xe4f50000), + SPH_C32(0x9ed300a0), SPH_C32(0xdc780000), SPH_C32(0xb2510000), + SPH_C32(0xa9ee43fb), SPH_C32(0xec89cec5), SPH_C32(0xe90dff25), + SPH_C32(0x46d360a4) }, + { SPH_C32(0xf7190000), SPH_C32(0xac8b0046), SPH_C32(0x9233e000), + SPH_C32(0x798b0000), SPH_C32(0x43cf7ef0), SPH_C32(0x74bea2c2), + SPH_C32(0x63724c59), SPH_C32(0x65afcf0a), SPH_C32(0xd4420000), + SPH_C32(0x7b0300a0), SPH_C32(0x288c6000), SPH_C32(0xf0950000), + SPH_C32(0xca567e91), SPH_C32(0x94335aa5), SPH_C32(0xc8a25ecf), + SPH_C32(0xf6767890) }, + { SPH_C32(0x41d70000), SPH_C32(0x76620044), SPH_C32(0x875d6000), + SPH_C32(0xa3190000), SPH_C32(0xb5122494), SPH_C32(0x428cfe48), + SPH_C32(0x9100a4f7), SPH_C32(0xc3170d87), SPH_C32(0x523b0000), + SPH_C32(0x443a00a2), SPH_C32(0xc9168000), SPH_C32(0x68c30000), + SPH_C32(0x5f33199f), SPH_C32(0xdabb924f), SPH_C32(0x1b7f178b), + SPH_C32(0xe06ba229) }, + { SPH_C32(0xc7ae0000), SPH_C32(0x495b0046), SPH_C32(0x66c78000), + SPH_C32(0x3b4f0000), SPH_C32(0x2077439a), SPH_C32(0x0c0436a2), + SPH_C32(0x42ddedb3), SPH_C32(0xd50ad73e), SPH_C32(0x628c0000), + SPH_C32(0xa1ea00a2), SPH_C32(0x3de2e000), SPH_C32(0x2a070000), + SPH_C32(0x3c8b24f5), SPH_C32(0xa201062f), SPH_C32(0x3ad0b661), + SPH_C32(0x50ceba1d) }, + { SPH_C32(0x65790000), SPH_C32(0xb0780078), SPH_C32(0x23760000), + SPH_C32(0xa56b0000), SPH_C32(0xcdc67e4e), SPH_C32(0x06c5c65d), + SPH_C32(0xd14915ad), SPH_C32(0xa878ce33), SPH_C32(0x07b60000), + SPH_C32(0xa49d00b4), SPH_C32(0x2ebe0000), SPH_C32(0x181f0000), + SPH_C32(0x72f0015d), SPH_C32(0xc9e270d0), SPH_C32(0xfb304e73), + SPH_C32(0x7c9df973) }, + { SPH_C32(0xe3000000), SPH_C32(0x8f41007a), SPH_C32(0xc2ece000), + SPH_C32(0x3d3d0000), SPH_C32(0x58a31940), SPH_C32(0x484d0eb7), + SPH_C32(0x02945ce9), SPH_C32(0xbe65148a), SPH_C32(0x37010000), + SPH_C32(0x414d00b4), SPH_C32(0xda4a6000), SPH_C32(0x5adb0000), + SPH_C32(0x11483c37), SPH_C32(0xb158e4b0), SPH_C32(0xda9fef99), + SPH_C32(0xcc38e147) }, + { SPH_C32(0x55ce0000), SPH_C32(0x55a80078), SPH_C32(0xd7826000), + SPH_C32(0xe7af0000), SPH_C32(0xae7e4324), SPH_C32(0x7e7f523d), + SPH_C32(0xf0e6b447), SPH_C32(0x18ddd607), SPH_C32(0xb1780000), + SPH_C32(0x7e7400b6), SPH_C32(0x3bd08000), SPH_C32(0xc28d0000), + SPH_C32(0x842d5b39), SPH_C32(0xffd02c5a), SPH_C32(0x0942a6dd), + SPH_C32(0xda253bfe) }, + { SPH_C32(0xd3b70000), SPH_C32(0x6a91007a), SPH_C32(0x36188000), + SPH_C32(0x7ff90000), SPH_C32(0x3b1b242a), SPH_C32(0x30f79ad7), + SPH_C32(0x233bfd03), SPH_C32(0x0ec00cbe), SPH_C32(0x81cf0000), + SPH_C32(0x9ba400b6), SPH_C32(0xcf24e000), SPH_C32(0x80490000), + SPH_C32(0xe7956653), SPH_C32(0x876ab83a), SPH_C32(0x28ed0737), + SPH_C32(0x6a8023ca) }, + { SPH_C32(0x7afe0000), SPH_C32(0x53b60014), SPH_C32(0xbd420000), + SPH_C32(0xf0860000), SPH_C32(0x8d096d43), SPH_C32(0x3bb5c979), + SPH_C32(0x1d3a76bf), SPH_C32(0x1bb6813d), SPH_C32(0x47ff0000), + SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), SPH_C32(0x36b70000), + SPH_C32(0x47392832), SPH_C32(0x935f59b7), SPH_C32(0x256c4600), + SPH_C32(0xd9267fe4) }, + { SPH_C32(0xfc870000), SPH_C32(0x6c8f0016), SPH_C32(0x5cd8e000), + SPH_C32(0x68d00000), SPH_C32(0x186c0a4d), SPH_C32(0x753d0193), + SPH_C32(0xcee73ffb), SPH_C32(0x0dab5b84), SPH_C32(0x77480000), + SPH_C32(0x64f600d4), SPH_C32(0xaf3b6000), SPH_C32(0x74730000), + SPH_C32(0x24811558), SPH_C32(0xebe5cdd7), SPH_C32(0x04c3e7ea), + SPH_C32(0x698367d0) }, + { SPH_C32(0x4a490000), SPH_C32(0xb6660014), SPH_C32(0x49b66000), + SPH_C32(0xb2420000), SPH_C32(0xeeb15029), SPH_C32(0x430f5d19), + SPH_C32(0x3c95d755), SPH_C32(0xab139909), SPH_C32(0xf1310000), + SPH_C32(0x5bcf00d6), SPH_C32(0x4ea18000), SPH_C32(0xec250000), + SPH_C32(0xb1e47256), SPH_C32(0xa56d053d), SPH_C32(0xd71eaeae), + SPH_C32(0x7f9ebd69) }, + { SPH_C32(0xcc300000), SPH_C32(0x895f0016), SPH_C32(0xa82c8000), + SPH_C32(0x2a140000), SPH_C32(0x7bd43727), SPH_C32(0x0d8795f3), + SPH_C32(0xef489e11), SPH_C32(0xbd0e43b0), SPH_C32(0xc1860000), + SPH_C32(0xbe1f00d6), SPH_C32(0xba55e000), SPH_C32(0xaee10000), + SPH_C32(0xd25c4f3c), SPH_C32(0xddd7915d), SPH_C32(0xf6b10f44), + SPH_C32(0xcf3ba55d) }, + { SPH_C32(0x6ee70000), SPH_C32(0x707c0028), SPH_C32(0xed9d0000), + SPH_C32(0xb4300000), SPH_C32(0x96650af3), SPH_C32(0x0746650c), + SPH_C32(0x7cdc660f), SPH_C32(0xc07c5abd), SPH_C32(0xa4bc0000), + SPH_C32(0xbb6800c0), SPH_C32(0xa9090000), SPH_C32(0x9cf90000), + SPH_C32(0x9c276a94), SPH_C32(0xb634e7a2), SPH_C32(0x3751f756), + SPH_C32(0xe368e633) }, + { SPH_C32(0xe89e0000), SPH_C32(0x4f45002a), SPH_C32(0x0c07e000), + SPH_C32(0x2c660000), SPH_C32(0x03006dfd), SPH_C32(0x49ceade6), + SPH_C32(0xaf012f4b), SPH_C32(0xd6618004), SPH_C32(0x940b0000), + SPH_C32(0x5eb800c0), SPH_C32(0x5dfd6000), SPH_C32(0xde3d0000), + SPH_C32(0xff9f57fe), SPH_C32(0xce8e73c2), SPH_C32(0x16fe56bc), + SPH_C32(0x53cdfe07) }, + { SPH_C32(0x5e500000), SPH_C32(0x95ac0028), SPH_C32(0x19696000), + SPH_C32(0xf6f40000), SPH_C32(0xf5dd3799), SPH_C32(0x7ffcf16c), + SPH_C32(0x5d73c7e5), SPH_C32(0x70d94289), SPH_C32(0x12720000), + SPH_C32(0x618100c2), SPH_C32(0xbc678000), SPH_C32(0x466b0000), + SPH_C32(0x6afa30f0), SPH_C32(0x8006bb28), SPH_C32(0xc5231ff8), + SPH_C32(0x45d024be) }, + { SPH_C32(0xd8290000), SPH_C32(0xaa95002a), SPH_C32(0xf8f38000), + SPH_C32(0x6ea20000), SPH_C32(0x60b85097), SPH_C32(0x31743986), + SPH_C32(0x8eae8ea1), SPH_C32(0x66c49830), SPH_C32(0x22c50000), + SPH_C32(0x845100c2), SPH_C32(0x4893e000), SPH_C32(0x04af0000), + SPH_C32(0x09420d9a), SPH_C32(0xf8bc2f48), SPH_C32(0xe48cbe12), + SPH_C32(0xf5753c8a) }, + { SPH_C32(0x99bd0000), SPH_C32(0x69f80000), SPH_C32(0x4f840000), + SPH_C32(0x5ac80000), SPH_C32(0x56172fe5), SPH_C32(0x1ede776c), + SPH_C32(0x0f07c7e9), SPH_C32(0x21f818ea), SPH_C32(0xb0a50000), + SPH_C32(0x98a200fc), SPH_C32(0xf9d60000), SPH_C32(0xd84f0000), + SPH_C32(0x874b0d24), SPH_C32(0x8ac74bd7), SPH_C32(0x56b7e7e6), + SPH_C32(0x38a23db3) }, + { SPH_C32(0x1fc40000), SPH_C32(0x56c10002), SPH_C32(0xae1ee000), + SPH_C32(0xc29e0000), SPH_C32(0xc37248eb), SPH_C32(0x5056bf86), + SPH_C32(0xdcda8ead), SPH_C32(0x37e5c253), SPH_C32(0x80120000), + SPH_C32(0x7d7200fc), SPH_C32(0x0d226000), SPH_C32(0x9a8b0000), + SPH_C32(0xe4f3304e), SPH_C32(0xf27ddfb7), SPH_C32(0x7718460c), + SPH_C32(0x88072587) }, + { SPH_C32(0xa90a0000), SPH_C32(0x8c280000), SPH_C32(0xbb706000), + SPH_C32(0x180c0000), SPH_C32(0x35af128f), SPH_C32(0x6664e30c), + SPH_C32(0x2ea86603), SPH_C32(0x915d00de), SPH_C32(0x066b0000), + SPH_C32(0x424b00fe), SPH_C32(0xecb88000), SPH_C32(0x02dd0000), + SPH_C32(0x71965740), SPH_C32(0xbcf5175d), SPH_C32(0xa4c50f48), + SPH_C32(0x9e1aff3e) }, + { SPH_C32(0x2f730000), SPH_C32(0xb3110002), SPH_C32(0x5aea8000), + SPH_C32(0x805a0000), SPH_C32(0xa0ca7581), SPH_C32(0x28ec2be6), + SPH_C32(0xfd752f47), SPH_C32(0x8740da67), SPH_C32(0x36dc0000), + SPH_C32(0xa79b00fe), SPH_C32(0x184ce000), SPH_C32(0x40190000), + SPH_C32(0x122e6a2a), SPH_C32(0xc44f833d), SPH_C32(0x856aaea2), + SPH_C32(0x2ebfe70a) }, + { SPH_C32(0x8da40000), SPH_C32(0x4a32003c), SPH_C32(0x1f5b0000), + SPH_C32(0x1e7e0000), SPH_C32(0x4d7b4855), SPH_C32(0x222ddb19), + SPH_C32(0x6ee1d759), SPH_C32(0xfa32c36a), SPH_C32(0x53e60000), + SPH_C32(0xa2ec00e8), SPH_C32(0x0b100000), SPH_C32(0x72010000), + SPH_C32(0x5c554f82), SPH_C32(0xafacf5c2), SPH_C32(0x448a56b0), + SPH_C32(0x02eca464) }, + { SPH_C32(0x0bdd0000), SPH_C32(0x750b003e), SPH_C32(0xfec1e000), + SPH_C32(0x86280000), SPH_C32(0xd81e2f5b), SPH_C32(0x6ca513f3), + SPH_C32(0xbd3c9e1d), SPH_C32(0xec2f19d3), SPH_C32(0x63510000), + SPH_C32(0x473c00e8), SPH_C32(0xffe46000), SPH_C32(0x30c50000), + SPH_C32(0x3fed72e8), SPH_C32(0xd71661a2), SPH_C32(0x6525f75a), + SPH_C32(0xb249bc50) }, + { SPH_C32(0xbd130000), SPH_C32(0xafe2003c), SPH_C32(0xebaf6000), + SPH_C32(0x5cba0000), SPH_C32(0x2ec3753f), SPH_C32(0x5a974f79), + SPH_C32(0x4f4e76b3), SPH_C32(0x4a97db5e), SPH_C32(0xe5280000), + SPH_C32(0x780500ea), SPH_C32(0x1e7e8000), SPH_C32(0xa8930000), + SPH_C32(0xaa8815e6), SPH_C32(0x999ea948), SPH_C32(0xb6f8be1e), + SPH_C32(0xa45466e9) }, + { SPH_C32(0x3b6a0000), SPH_C32(0x90db003e), SPH_C32(0x0a358000), + SPH_C32(0xc4ec0000), SPH_C32(0xbba61231), SPH_C32(0x141f8793), + SPH_C32(0x9c933ff7), SPH_C32(0x5c8a01e7), SPH_C32(0xd59f0000), + SPH_C32(0x9dd500ea), SPH_C32(0xea8ae000), SPH_C32(0xea570000), + SPH_C32(0xc930288c), SPH_C32(0xe1243d28), SPH_C32(0x97571ff4), + SPH_C32(0x14f17edd) }, + { SPH_C32(0x2eae0000), SPH_C32(0x55c70048), SPH_C32(0x98ec0000), + SPH_C32(0x9a980000), SPH_C32(0xa3ac239c), SPH_C32(0x5dfb4c6b), + SPH_C32(0xa2806e7c), SPH_C32(0x65c7dc2a), SPH_C32(0xfb720000), + SPH_C32(0x7d1d00cc), SPH_C32(0x424c0000), SPH_C32(0xe7bc0000), + SPH_C32(0xe92150f6), SPH_C32(0xd1f9c1e1), SPH_C32(0x257e9c37), + SPH_C32(0xf51d2faa) }, + { SPH_C32(0xa8d70000), SPH_C32(0x6afe004a), SPH_C32(0x7976e000), + SPH_C32(0x02ce0000), SPH_C32(0x36c94492), SPH_C32(0x13738481), + SPH_C32(0x715d2738), SPH_C32(0x73da0693), SPH_C32(0xcbc50000), + SPH_C32(0x98cd00cc), SPH_C32(0xb6b86000), SPH_C32(0xa5780000), + SPH_C32(0x8a996d9c), SPH_C32(0xa9435581), SPH_C32(0x04d13ddd), + SPH_C32(0x45b8379e) }, + { SPH_C32(0x1e190000), SPH_C32(0xb0170048), SPH_C32(0x6c186000), + SPH_C32(0xd85c0000), SPH_C32(0xc0141ef6), SPH_C32(0x2541d80b), + SPH_C32(0x832fcf96), SPH_C32(0xd562c41e), SPH_C32(0x4dbc0000), + SPH_C32(0xa7f400ce), SPH_C32(0x57228000), SPH_C32(0x3d2e0000), + SPH_C32(0x1ffc0a92), SPH_C32(0xe7cb9d6b), SPH_C32(0xd70c7499), + SPH_C32(0x53a5ed27) }, + { SPH_C32(0x98600000), SPH_C32(0x8f2e004a), SPH_C32(0x8d828000), + SPH_C32(0x400a0000), SPH_C32(0x557179f8), SPH_C32(0x6bc910e1), + SPH_C32(0x50f286d2), SPH_C32(0xc37f1ea7), SPH_C32(0x7d0b0000), + SPH_C32(0x422400ce), SPH_C32(0xa3d6e000), SPH_C32(0x7fea0000), + SPH_C32(0x7c4437f8), SPH_C32(0x9f71090b), SPH_C32(0xf6a3d573), + SPH_C32(0xe300f513) }, + { SPH_C32(0x3ab70000), SPH_C32(0x760d0074), SPH_C32(0xc8330000), + SPH_C32(0xde2e0000), SPH_C32(0xb8c0442c), SPH_C32(0x6108e01e), + SPH_C32(0xc3667ecc), SPH_C32(0xbe0d07aa), SPH_C32(0x18310000), + SPH_C32(0x475300d8), SPH_C32(0xb08a0000), SPH_C32(0x4df20000), + SPH_C32(0x323f1250), SPH_C32(0xf4927ff4), SPH_C32(0x37432d61), + SPH_C32(0xcf53b67d) }, + { SPH_C32(0xbcce0000), SPH_C32(0x49340076), SPH_C32(0x29a9e000), + SPH_C32(0x46780000), SPH_C32(0x2da52322), SPH_C32(0x2f8028f4), + SPH_C32(0x10bb3788), SPH_C32(0xa810dd13), SPH_C32(0x28860000), + SPH_C32(0xa28300d8), SPH_C32(0x447e6000), SPH_C32(0x0f360000), + SPH_C32(0x51872f3a), SPH_C32(0x8c28eb94), SPH_C32(0x16ec8c8b), + SPH_C32(0x7ff6ae49) }, + { SPH_C32(0x0a000000), SPH_C32(0x93dd0074), SPH_C32(0x3cc76000), + SPH_C32(0x9cea0000), SPH_C32(0xdb787946), SPH_C32(0x19b2747e), + SPH_C32(0xe2c9df26), SPH_C32(0x0ea81f9e), SPH_C32(0xaeff0000), + SPH_C32(0x9dba00da), SPH_C32(0xa5e48000), SPH_C32(0x97600000), + SPH_C32(0xc4e24834), SPH_C32(0xc2a0237e), SPH_C32(0xc531c5cf), + SPH_C32(0x69eb74f0) }, + { SPH_C32(0x8c790000), SPH_C32(0xace40076), SPH_C32(0xdd5d8000), + SPH_C32(0x04bc0000), SPH_C32(0x4e1d1e48), SPH_C32(0x573abc94), + SPH_C32(0x31149662), SPH_C32(0x18b5c527), SPH_C32(0x9e480000), + SPH_C32(0x786a00da), SPH_C32(0x5110e000), SPH_C32(0xd5a40000), + SPH_C32(0xa75a755e), SPH_C32(0xba1ab71e), SPH_C32(0xe49e6425), + SPH_C32(0xd94e6cc4) }, + { SPH_C32(0xcded0000), SPH_C32(0x6f89005c), SPH_C32(0x6a2a0000), + SPH_C32(0x30d60000), SPH_C32(0x78b2613a), SPH_C32(0x7890f27e), + SPH_C32(0xb0bddf2a), SPH_C32(0x5f8945fd), SPH_C32(0x0c280000), + SPH_C32(0x649900e4), SPH_C32(0xe0550000), SPH_C32(0x09440000), + SPH_C32(0x295375e0), SPH_C32(0xc861d381), SPH_C32(0x56a53dd1), + SPH_C32(0x14996dfd) }, + { SPH_C32(0x4b940000), SPH_C32(0x50b0005e), SPH_C32(0x8bb0e000), + SPH_C32(0xa8800000), SPH_C32(0xedd70634), SPH_C32(0x36183a94), + SPH_C32(0x6360966e), SPH_C32(0x49949f44), SPH_C32(0x3c9f0000), + SPH_C32(0x814900e4), SPH_C32(0x14a16000), SPH_C32(0x4b800000), + SPH_C32(0x4aeb488a), SPH_C32(0xb0db47e1), SPH_C32(0x770a9c3b), + SPH_C32(0xa43c75c9) }, + { SPH_C32(0xfd5a0000), SPH_C32(0x8a59005c), SPH_C32(0x9ede6000), + SPH_C32(0x72120000), SPH_C32(0x1b0a5c50), SPH_C32(0x002a661e), + SPH_C32(0x91127ec0), SPH_C32(0xef2c5dc9), SPH_C32(0xbae60000), + SPH_C32(0xbe7000e6), SPH_C32(0xf53b8000), SPH_C32(0xd3d60000), + SPH_C32(0xdf8e2f84), SPH_C32(0xfe538f0b), SPH_C32(0xa4d7d57f), + SPH_C32(0xb221af70) }, + { SPH_C32(0x7b230000), SPH_C32(0xb560005e), SPH_C32(0x7f448000), + SPH_C32(0xea440000), SPH_C32(0x8e6f3b5e), SPH_C32(0x4ea2aef4), + SPH_C32(0x42cf3784), SPH_C32(0xf9318770), SPH_C32(0x8a510000), + SPH_C32(0x5ba000e6), SPH_C32(0x01cfe000), SPH_C32(0x91120000), + SPH_C32(0xbc3612ee), SPH_C32(0x86e91b6b), SPH_C32(0x85787495), + SPH_C32(0x0284b744) }, + { SPH_C32(0xd9f40000), SPH_C32(0x4c430060), SPH_C32(0x3af50000), + SPH_C32(0x74600000), SPH_C32(0x63de068a), SPH_C32(0x44635e0b), + SPH_C32(0xd15bcf9a), SPH_C32(0x84439e7d), SPH_C32(0xef6b0000), + SPH_C32(0x5ed700f0), SPH_C32(0x12930000), SPH_C32(0xa30a0000), + SPH_C32(0xf24d3746), SPH_C32(0xed0a6d94), SPH_C32(0x44988c87), + SPH_C32(0x2ed7f42a) }, + { SPH_C32(0x5f8d0000), SPH_C32(0x737a0062), SPH_C32(0xdb6fe000), + SPH_C32(0xec360000), SPH_C32(0xf6bb6184), SPH_C32(0x0aeb96e1), + SPH_C32(0x028686de), SPH_C32(0x925e44c4), SPH_C32(0xdfdc0000), + SPH_C32(0xbb0700f0), SPH_C32(0xe6676000), SPH_C32(0xe1ce0000), + SPH_C32(0x91f50a2c), SPH_C32(0x95b0f9f4), SPH_C32(0x65372d6d), + SPH_C32(0x9e72ec1e) }, + { SPH_C32(0xe9430000), SPH_C32(0xa9930060), SPH_C32(0xce016000), + SPH_C32(0x36a40000), SPH_C32(0x00663be0), SPH_C32(0x3cd9ca6b), + SPH_C32(0xf0f46e70), SPH_C32(0x34e68649), SPH_C32(0x59a50000), + SPH_C32(0x843e00f2), SPH_C32(0x07fd8000), SPH_C32(0x79980000), + SPH_C32(0x04906d22), SPH_C32(0xdb38311e), SPH_C32(0xb6ea6429), + SPH_C32(0x886f36a7) }, + { SPH_C32(0x6f3a0000), SPH_C32(0x96aa0062), SPH_C32(0x2f9b8000), + SPH_C32(0xaef20000), SPH_C32(0x95035cee), SPH_C32(0x72510281), + SPH_C32(0x23292734), SPH_C32(0x22fb5cf0), SPH_C32(0x69120000), + SPH_C32(0x61ee00f2), SPH_C32(0xf309e000), SPH_C32(0x3b5c0000), + SPH_C32(0x67285048), SPH_C32(0xa382a57e), SPH_C32(0x9745c5c3), + SPH_C32(0x38ca2e93) }, + { SPH_C32(0xaf220000), SPH_C32(0x7b6c0090), SPH_C32(0x67e20000), + SPH_C32(0x8da20000), SPH_C32(0xc7841e29), SPH_C32(0xb7b744f3), + SPH_C32(0x9ac484f4), SPH_C32(0x8b6c72bd), SPH_C32(0x69510000), + SPH_C32(0xd4e1009c), SPH_C32(0xc3230000), SPH_C32(0xac2f0000), + SPH_C32(0xe4950bae), SPH_C32(0xcea415dc), SPH_C32(0x87ec287c), + SPH_C32(0xbce1a3ce) }, + { SPH_C32(0x295b0000), SPH_C32(0x44550092), SPH_C32(0x8678e000), + SPH_C32(0x15f40000), SPH_C32(0x52e17927), SPH_C32(0xf93f8c19), + SPH_C32(0x4919cdb0), SPH_C32(0x9d71a804), SPH_C32(0x59e60000), + SPH_C32(0x3131009c), SPH_C32(0x37d76000), SPH_C32(0xeeeb0000), + SPH_C32(0x872d36c4), SPH_C32(0xb61e81bc), SPH_C32(0xa6438996), + SPH_C32(0x0c44bbfa) }, + { SPH_C32(0x9f950000), SPH_C32(0x9ebc0090), SPH_C32(0x93166000), + SPH_C32(0xcf660000), SPH_C32(0xa43c2343), SPH_C32(0xcf0dd093), + SPH_C32(0xbb6b251e), SPH_C32(0x3bc96a89), SPH_C32(0xdf9f0000), + SPH_C32(0x0e08009e), SPH_C32(0xd64d8000), SPH_C32(0x76bd0000), + SPH_C32(0x124851ca), SPH_C32(0xf8964956), SPH_C32(0x759ec0d2), + SPH_C32(0x1a596143) }, + { SPH_C32(0x19ec0000), SPH_C32(0xa1850092), SPH_C32(0x728c8000), + SPH_C32(0x57300000), SPH_C32(0x3159444d), SPH_C32(0x81851879), + SPH_C32(0x68b66c5a), SPH_C32(0x2dd4b030), SPH_C32(0xef280000), + SPH_C32(0xebd8009e), SPH_C32(0x22b9e000), SPH_C32(0x34790000), + SPH_C32(0x71f06ca0), SPH_C32(0x802cdd36), SPH_C32(0x54316138), + SPH_C32(0xaafc7977) }, + { SPH_C32(0xbb3b0000), SPH_C32(0x58a600ac), SPH_C32(0x373d0000), + SPH_C32(0xc9140000), SPH_C32(0xdce87999), SPH_C32(0x8b44e886), + SPH_C32(0xfb229444), SPH_C32(0x50a6a93d), SPH_C32(0x8a120000), + SPH_C32(0xeeaf0088), SPH_C32(0x31e50000), SPH_C32(0x06610000), + SPH_C32(0x3f8b4908), SPH_C32(0xebcfabc9), SPH_C32(0x95d1992a), + SPH_C32(0x86af3a19) }, + { SPH_C32(0x3d420000), SPH_C32(0x679f00ae), SPH_C32(0xd6a7e000), + SPH_C32(0x51420000), SPH_C32(0x498d1e97), SPH_C32(0xc5cc206c), + SPH_C32(0x28ffdd00), SPH_C32(0x46bb7384), SPH_C32(0xbaa50000), + SPH_C32(0x0b7f0088), SPH_C32(0xc5116000), SPH_C32(0x44a50000), + SPH_C32(0x5c337462), SPH_C32(0x93753fa9), SPH_C32(0xb47e38c0), + SPH_C32(0x360a222d) }, + { SPH_C32(0x8b8c0000), SPH_C32(0xbd7600ac), SPH_C32(0xc3c96000), + SPH_C32(0x8bd00000), SPH_C32(0xbf5044f3), SPH_C32(0xf3fe7ce6), + SPH_C32(0xda8d35ae), SPH_C32(0xe003b109), SPH_C32(0x3cdc0000), + SPH_C32(0x3446008a), SPH_C32(0x248b8000), SPH_C32(0xdcf30000), + SPH_C32(0xc956136c), SPH_C32(0xddfdf743), SPH_C32(0x67a37184), + SPH_C32(0x2017f894) }, + { SPH_C32(0x0df50000), SPH_C32(0x824f00ae), SPH_C32(0x22538000), + SPH_C32(0x13860000), SPH_C32(0x2a3523fd), SPH_C32(0xbd76b40c), + SPH_C32(0x09507cea), SPH_C32(0xf61e6bb0), SPH_C32(0x0c6b0000), + SPH_C32(0xd196008a), SPH_C32(0xd07fe000), SPH_C32(0x9e370000), + SPH_C32(0xaaee2e06), SPH_C32(0xa5476323), SPH_C32(0x460cd06e), + SPH_C32(0x90b2e0a0) }, + { SPH_C32(0x4c610000), SPH_C32(0x41220084), SPH_C32(0x95240000), + SPH_C32(0x27ec0000), SPH_C32(0x1c9a5c8f), SPH_C32(0x92dcfae6), + SPH_C32(0x88f935a2), SPH_C32(0xb122eb6a), SPH_C32(0x9e0b0000), + SPH_C32(0xcd6500b4), SPH_C32(0x613a0000), SPH_C32(0x42d70000), + SPH_C32(0x24e72eb8), SPH_C32(0xd73c07bc), SPH_C32(0xf437899a), + SPH_C32(0x5d65e199) }, + { SPH_C32(0xca180000), SPH_C32(0x7e1b0086), SPH_C32(0x74bee000), + SPH_C32(0xbfba0000), SPH_C32(0x89ff3b81), SPH_C32(0xdc54320c), + SPH_C32(0x5b247ce6), SPH_C32(0xa73f31d3), SPH_C32(0xaebc0000), + SPH_C32(0x28b500b4), SPH_C32(0x95ce6000), SPH_C32(0x00130000), + SPH_C32(0x475f13d2), SPH_C32(0xaf8693dc), SPH_C32(0xd5982870), + SPH_C32(0xedc0f9ad) }, + { SPH_C32(0x7cd60000), SPH_C32(0xa4f20084), SPH_C32(0x61d06000), + SPH_C32(0x65280000), SPH_C32(0x7f2261e5), SPH_C32(0xea666e86), + SPH_C32(0xa9569448), SPH_C32(0x0187f35e), SPH_C32(0x28c50000), + SPH_C32(0x178c00b6), SPH_C32(0x74548000), SPH_C32(0x98450000), + SPH_C32(0xd23a74dc), SPH_C32(0xe10e5b36), SPH_C32(0x06456134), + SPH_C32(0xfbdd2314) }, + { SPH_C32(0xfaaf0000), SPH_C32(0x9bcb0086), SPH_C32(0x804a8000), + SPH_C32(0xfd7e0000), SPH_C32(0xea4706eb), SPH_C32(0xa4eea66c), + SPH_C32(0x7a8bdd0c), SPH_C32(0x179a29e7), SPH_C32(0x18720000), + SPH_C32(0xf25c00b6), SPH_C32(0x80a0e000), SPH_C32(0xda810000), + SPH_C32(0xb18249b6), SPH_C32(0x99b4cf56), SPH_C32(0x27eac0de), + SPH_C32(0x4b783b20) }, + { SPH_C32(0x58780000), SPH_C32(0x62e800b8), SPH_C32(0xc5fb0000), + SPH_C32(0x635a0000), SPH_C32(0x07f63b3f), SPH_C32(0xae2f5693), + SPH_C32(0xe91f2512), SPH_C32(0x6ae830ea), SPH_C32(0x7d480000), + SPH_C32(0xf72b00a0), SPH_C32(0x93fc0000), SPH_C32(0xe8990000), + SPH_C32(0xfff96c1e), SPH_C32(0xf257b9a9), SPH_C32(0xe60a38cc), + SPH_C32(0x672b784e) }, + { SPH_C32(0xde010000), SPH_C32(0x5dd100ba), SPH_C32(0x2461e000), + SPH_C32(0xfb0c0000), SPH_C32(0x92935c31), SPH_C32(0xe0a79e79), + SPH_C32(0x3ac26c56), SPH_C32(0x7cf5ea53), SPH_C32(0x4dff0000), + SPH_C32(0x12fb00a0), SPH_C32(0x67086000), SPH_C32(0xaa5d0000), + SPH_C32(0x9c415174), SPH_C32(0x8aed2dc9), SPH_C32(0xc7a59926), + SPH_C32(0xd78e607a) }, + { SPH_C32(0x68cf0000), SPH_C32(0x873800b8), SPH_C32(0x310f6000), + SPH_C32(0x219e0000), SPH_C32(0x644e0655), SPH_C32(0xd695c2f3), + SPH_C32(0xc8b084f8), SPH_C32(0xda4d28de), SPH_C32(0xcb860000), + SPH_C32(0x2dc200a2), SPH_C32(0x86928000), SPH_C32(0x320b0000), + SPH_C32(0x0924367a), SPH_C32(0xc465e523), SPH_C32(0x1478d062), + SPH_C32(0xc193bac3) }, + { SPH_C32(0xeeb60000), SPH_C32(0xb80100ba), SPH_C32(0xd0958000), + SPH_C32(0xb9c80000), SPH_C32(0xf12b615b), SPH_C32(0x981d0a19), + SPH_C32(0x1b6dcdbc), SPH_C32(0xcc50f267), SPH_C32(0xfb310000), + SPH_C32(0xc81200a2), SPH_C32(0x7266e000), SPH_C32(0x70cf0000), + SPH_C32(0x6a9c0b10), SPH_C32(0xbcdf7143), SPH_C32(0x35d77188), + SPH_C32(0x7136a2f7) }, + { SPH_C32(0xfb720000), SPH_C32(0x7d1d00cc), SPH_C32(0x424c0000), + SPH_C32(0xe7bc0000), SPH_C32(0xe92150f6), SPH_C32(0xd1f9c1e1), + SPH_C32(0x257e9c37), SPH_C32(0xf51d2faa), SPH_C32(0xd5dc0000), + SPH_C32(0x28da0084), SPH_C32(0xdaa00000), SPH_C32(0x7d240000), + SPH_C32(0x4a8d736a), SPH_C32(0x8c028d8a), SPH_C32(0x87fef24b), + SPH_C32(0x90daf380) }, + { SPH_C32(0x7d0b0000), SPH_C32(0x422400ce), SPH_C32(0xa3d6e000), + SPH_C32(0x7fea0000), SPH_C32(0x7c4437f8), SPH_C32(0x9f71090b), + SPH_C32(0xf6a3d573), SPH_C32(0xe300f513), SPH_C32(0xe56b0000), + SPH_C32(0xcd0a0084), SPH_C32(0x2e546000), SPH_C32(0x3fe00000), + SPH_C32(0x29354e00), SPH_C32(0xf4b819ea), SPH_C32(0xa65153a1), + SPH_C32(0x207febb4) }, + { SPH_C32(0xcbc50000), SPH_C32(0x98cd00cc), SPH_C32(0xb6b86000), + SPH_C32(0xa5780000), SPH_C32(0x8a996d9c), SPH_C32(0xa9435581), + SPH_C32(0x04d13ddd), SPH_C32(0x45b8379e), SPH_C32(0x63120000), + SPH_C32(0xf2330086), SPH_C32(0xcfce8000), SPH_C32(0xa7b60000), + SPH_C32(0xbc50290e), SPH_C32(0xba30d100), SPH_C32(0x758c1ae5), + SPH_C32(0x3662310d) }, + { SPH_C32(0x4dbc0000), SPH_C32(0xa7f400ce), SPH_C32(0x57228000), + SPH_C32(0x3d2e0000), SPH_C32(0x1ffc0a92), SPH_C32(0xe7cb9d6b), + SPH_C32(0xd70c7499), SPH_C32(0x53a5ed27), SPH_C32(0x53a50000), + SPH_C32(0x17e30086), SPH_C32(0x3b3ae000), SPH_C32(0xe5720000), + SPH_C32(0xdfe81464), SPH_C32(0xc28a4560), SPH_C32(0x5423bb0f), + SPH_C32(0x86c72939) }, + { SPH_C32(0xef6b0000), SPH_C32(0x5ed700f0), SPH_C32(0x12930000), + SPH_C32(0xa30a0000), SPH_C32(0xf24d3746), SPH_C32(0xed0a6d94), + SPH_C32(0x44988c87), SPH_C32(0x2ed7f42a), SPH_C32(0x369f0000), + SPH_C32(0x12940090), SPH_C32(0x28660000), SPH_C32(0xd76a0000), + SPH_C32(0x919331cc), SPH_C32(0xa969339f), SPH_C32(0x95c3431d), + SPH_C32(0xaa946a57) }, + { SPH_C32(0x69120000), SPH_C32(0x61ee00f2), SPH_C32(0xf309e000), + SPH_C32(0x3b5c0000), SPH_C32(0x67285048), SPH_C32(0xa382a57e), + SPH_C32(0x9745c5c3), SPH_C32(0x38ca2e93), SPH_C32(0x06280000), + SPH_C32(0xf7440090), SPH_C32(0xdc926000), SPH_C32(0x95ae0000), + SPH_C32(0xf22b0ca6), SPH_C32(0xd1d3a7ff), SPH_C32(0xb46ce2f7), + SPH_C32(0x1a317263) }, + { SPH_C32(0xdfdc0000), SPH_C32(0xbb0700f0), SPH_C32(0xe6676000), + SPH_C32(0xe1ce0000), SPH_C32(0x91f50a2c), SPH_C32(0x95b0f9f4), + SPH_C32(0x65372d6d), SPH_C32(0x9e72ec1e), SPH_C32(0x80510000), + SPH_C32(0xc87d0092), SPH_C32(0x3d088000), SPH_C32(0x0df80000), + SPH_C32(0x674e6ba8), SPH_C32(0x9f5b6f15), SPH_C32(0x67b1abb3), + SPH_C32(0x0c2ca8da) }, + { SPH_C32(0x59a50000), SPH_C32(0x843e00f2), SPH_C32(0x07fd8000), + SPH_C32(0x79980000), SPH_C32(0x04906d22), SPH_C32(0xdb38311e), + SPH_C32(0xb6ea6429), SPH_C32(0x886f36a7), SPH_C32(0xb0e60000), + SPH_C32(0x2dad0092), SPH_C32(0xc9fce000), SPH_C32(0x4f3c0000), + SPH_C32(0x04f656c2), SPH_C32(0xe7e1fb75), SPH_C32(0x461e0a59), + SPH_C32(0xbc89b0ee) }, + { SPH_C32(0x18310000), SPH_C32(0x475300d8), SPH_C32(0xb08a0000), + SPH_C32(0x4df20000), SPH_C32(0x323f1250), SPH_C32(0xf4927ff4), + SPH_C32(0x37432d61), SPH_C32(0xcf53b67d), SPH_C32(0x22860000), + SPH_C32(0x315e00ac), SPH_C32(0x78b90000), SPH_C32(0x93dc0000), + SPH_C32(0x8aff567c), SPH_C32(0x959a9fea), SPH_C32(0xf42553ad), + SPH_C32(0x715eb1d7) }, + { SPH_C32(0x9e480000), SPH_C32(0x786a00da), SPH_C32(0x5110e000), + SPH_C32(0xd5a40000), SPH_C32(0xa75a755e), SPH_C32(0xba1ab71e), + SPH_C32(0xe49e6425), SPH_C32(0xd94e6cc4), SPH_C32(0x12310000), + SPH_C32(0xd48e00ac), SPH_C32(0x8c4d6000), SPH_C32(0xd1180000), + SPH_C32(0xe9476b16), SPH_C32(0xed200b8a), SPH_C32(0xd58af247), + SPH_C32(0xc1fba9e3) }, + { SPH_C32(0x28860000), SPH_C32(0xa28300d8), SPH_C32(0x447e6000), + SPH_C32(0x0f360000), SPH_C32(0x51872f3a), SPH_C32(0x8c28eb94), + SPH_C32(0x16ec8c8b), SPH_C32(0x7ff6ae49), SPH_C32(0x94480000), + SPH_C32(0xebb700ae), SPH_C32(0x6dd78000), SPH_C32(0x494e0000), + SPH_C32(0x7c220c18), SPH_C32(0xa3a8c360), SPH_C32(0x0657bb03), + SPH_C32(0xd7e6735a) }, + { SPH_C32(0xaeff0000), SPH_C32(0x9dba00da), SPH_C32(0xa5e48000), + SPH_C32(0x97600000), SPH_C32(0xc4e24834), SPH_C32(0xc2a0237e), + SPH_C32(0xc531c5cf), SPH_C32(0x69eb74f0), SPH_C32(0xa4ff0000), + SPH_C32(0x0e6700ae), SPH_C32(0x9923e000), SPH_C32(0x0b8a0000), + SPH_C32(0x1f9a3172), SPH_C32(0xdb125700), SPH_C32(0x27f81ae9), + SPH_C32(0x67436b6e) }, + { SPH_C32(0x0c280000), SPH_C32(0x649900e4), SPH_C32(0xe0550000), + SPH_C32(0x09440000), SPH_C32(0x295375e0), SPH_C32(0xc861d381), + SPH_C32(0x56a53dd1), SPH_C32(0x14996dfd), SPH_C32(0xc1c50000), + SPH_C32(0x0b1000b8), SPH_C32(0x8a7f0000), SPH_C32(0x39920000), + SPH_C32(0x51e114da), SPH_C32(0xb0f121ff), SPH_C32(0xe618e2fb), + SPH_C32(0x4b102800) }, + { SPH_C32(0x8a510000), SPH_C32(0x5ba000e6), SPH_C32(0x01cfe000), + SPH_C32(0x91120000), SPH_C32(0xbc3612ee), SPH_C32(0x86e91b6b), + SPH_C32(0x85787495), SPH_C32(0x0284b744), SPH_C32(0xf1720000), + SPH_C32(0xeec000b8), SPH_C32(0x7e8b6000), SPH_C32(0x7b560000), + SPH_C32(0x325929b0), SPH_C32(0xc84bb59f), SPH_C32(0xc7b74311), + SPH_C32(0xfbb53034) }, + { SPH_C32(0x3c9f0000), SPH_C32(0x814900e4), SPH_C32(0x14a16000), + SPH_C32(0x4b800000), SPH_C32(0x4aeb488a), SPH_C32(0xb0db47e1), + SPH_C32(0x770a9c3b), SPH_C32(0xa43c75c9), SPH_C32(0x770b0000), + SPH_C32(0xd1f900ba), SPH_C32(0x9f118000), SPH_C32(0xe3000000), + SPH_C32(0xa73c4ebe), SPH_C32(0x86c37d75), SPH_C32(0x146a0a55), + SPH_C32(0xeda8ea8d) }, + { SPH_C32(0xbae60000), SPH_C32(0xbe7000e6), SPH_C32(0xf53b8000), + SPH_C32(0xd3d60000), SPH_C32(0xdf8e2f84), SPH_C32(0xfe538f0b), + SPH_C32(0xa4d7d57f), SPH_C32(0xb221af70), SPH_C32(0x47bc0000), + SPH_C32(0x342900ba), SPH_C32(0x6be5e000), SPH_C32(0xa1c40000), + SPH_C32(0xc48473d4), SPH_C32(0xfe79e915), SPH_C32(0x35c5abbf), + SPH_C32(0x5d0df2b9) }, + { SPH_C32(0x13af0000), SPH_C32(0x87570088), SPH_C32(0x7e610000), + SPH_C32(0x5ca90000), SPH_C32(0x699c66ed), SPH_C32(0xf511dca5), + SPH_C32(0x9ad65ec3), SPH_C32(0xa75722f3), SPH_C32(0x818c0000), + SPH_C32(0x2eab00d8), SPH_C32(0xff0e0000), SPH_C32(0x173a0000), + SPH_C32(0x64283db5), SPH_C32(0xea4c0898), SPH_C32(0x3844ea88), + SPH_C32(0xeeabae97) }, + { SPH_C32(0x95d60000), SPH_C32(0xb86e008a), SPH_C32(0x9ffbe000), + SPH_C32(0xc4ff0000), SPH_C32(0xfcf901e3), SPH_C32(0xbb99144f), + SPH_C32(0x490b1787), SPH_C32(0xb14af84a), SPH_C32(0xb13b0000), + SPH_C32(0xcb7b00d8), SPH_C32(0x0bfa6000), SPH_C32(0x55fe0000), + SPH_C32(0x079000df), SPH_C32(0x92f69cf8), SPH_C32(0x19eb4b62), + SPH_C32(0x5e0eb6a3) }, + { SPH_C32(0x23180000), SPH_C32(0x62870088), SPH_C32(0x8a956000), + SPH_C32(0x1e6d0000), SPH_C32(0x0a245b87), SPH_C32(0x8dab48c5), + SPH_C32(0xbb79ff29), SPH_C32(0x17f23ac7), SPH_C32(0x37420000), + SPH_C32(0xf44200da), SPH_C32(0xea608000), SPH_C32(0xcda80000), + SPH_C32(0x92f567d1), SPH_C32(0xdc7e5412), SPH_C32(0xca360226), + SPH_C32(0x48136c1a) }, + { SPH_C32(0xa5610000), SPH_C32(0x5dbe008a), SPH_C32(0x6b0f8000), + SPH_C32(0x863b0000), SPH_C32(0x9f413c89), SPH_C32(0xc323802f), + SPH_C32(0x68a4b66d), SPH_C32(0x01efe07e), SPH_C32(0x07f50000), + SPH_C32(0x119200da), SPH_C32(0x1e94e000), SPH_C32(0x8f6c0000), + SPH_C32(0xf14d5abb), SPH_C32(0xa4c4c072), SPH_C32(0xeb99a3cc), + SPH_C32(0xf8b6742e) }, + { SPH_C32(0x07b60000), SPH_C32(0xa49d00b4), SPH_C32(0x2ebe0000), + SPH_C32(0x181f0000), SPH_C32(0x72f0015d), SPH_C32(0xc9e270d0), + SPH_C32(0xfb304e73), SPH_C32(0x7c9df973), SPH_C32(0x62cf0000), + SPH_C32(0x14e500cc), SPH_C32(0x0dc80000), SPH_C32(0xbd740000), + SPH_C32(0xbf367f13), SPH_C32(0xcf27b68d), SPH_C32(0x2a795bde), + SPH_C32(0xd4e53740) }, + { SPH_C32(0x81cf0000), SPH_C32(0x9ba400b6), SPH_C32(0xcf24e000), + SPH_C32(0x80490000), SPH_C32(0xe7956653), SPH_C32(0x876ab83a), + SPH_C32(0x28ed0737), SPH_C32(0x6a8023ca), SPH_C32(0x52780000), + SPH_C32(0xf13500cc), SPH_C32(0xf93c6000), SPH_C32(0xffb00000), + SPH_C32(0xdc8e4279), SPH_C32(0xb79d22ed), SPH_C32(0x0bd6fa34), + SPH_C32(0x64402f74) }, + { SPH_C32(0x37010000), SPH_C32(0x414d00b4), SPH_C32(0xda4a6000), + SPH_C32(0x5adb0000), SPH_C32(0x11483c37), SPH_C32(0xb158e4b0), + SPH_C32(0xda9fef99), SPH_C32(0xcc38e147), SPH_C32(0xd4010000), + SPH_C32(0xce0c00ce), SPH_C32(0x18a68000), SPH_C32(0x67e60000), + SPH_C32(0x49eb2577), SPH_C32(0xf915ea07), SPH_C32(0xd80bb370), + SPH_C32(0x725df5cd) }, + { SPH_C32(0xb1780000), SPH_C32(0x7e7400b6), SPH_C32(0x3bd08000), + SPH_C32(0xc28d0000), SPH_C32(0x842d5b39), SPH_C32(0xffd02c5a), + SPH_C32(0x0942a6dd), SPH_C32(0xda253bfe), SPH_C32(0xe4b60000), + SPH_C32(0x2bdc00ce), SPH_C32(0xec52e000), SPH_C32(0x25220000), + SPH_C32(0x2a53181d), SPH_C32(0x81af7e67), SPH_C32(0xf9a4129a), + SPH_C32(0xc2f8edf9) }, + { SPH_C32(0xf0ec0000), SPH_C32(0xbd19009c), SPH_C32(0x8ca70000), + SPH_C32(0xf6e70000), SPH_C32(0xb282244b), SPH_C32(0xd07a62b0), + SPH_C32(0x88ebef95), SPH_C32(0x9d19bb24), SPH_C32(0x76d60000), + SPH_C32(0x372f00f0), SPH_C32(0x5d170000), SPH_C32(0xf9c20000), + SPH_C32(0xa45a18a3), SPH_C32(0xf3d41af8), SPH_C32(0x4b9f4b6e), + SPH_C32(0x0f2fecc0) }, + { SPH_C32(0x76950000), SPH_C32(0x8220009e), SPH_C32(0x6d3de000), + SPH_C32(0x6eb10000), SPH_C32(0x27e74345), SPH_C32(0x9ef2aa5a), + SPH_C32(0x5b36a6d1), SPH_C32(0x8b04619d), SPH_C32(0x46610000), + SPH_C32(0xd2ff00f0), SPH_C32(0xa9e36000), SPH_C32(0xbb060000), + SPH_C32(0xc7e225c9), SPH_C32(0x8b6e8e98), SPH_C32(0x6a30ea84), + SPH_C32(0xbf8af4f4) }, + { SPH_C32(0xc05b0000), SPH_C32(0x58c9009c), SPH_C32(0x78536000), + SPH_C32(0xb4230000), SPH_C32(0xd13a1921), SPH_C32(0xa8c0f6d0), + SPH_C32(0xa9444e7f), SPH_C32(0x2dbca310), SPH_C32(0xc0180000), + SPH_C32(0xedc600f2), SPH_C32(0x48798000), SPH_C32(0x23500000), + SPH_C32(0x528742c7), SPH_C32(0xc5e64672), SPH_C32(0xb9eda3c0), + SPH_C32(0xa9972e4d) }, + { SPH_C32(0x46220000), SPH_C32(0x67f0009e), SPH_C32(0x99c98000), + SPH_C32(0x2c750000), SPH_C32(0x445f7e2f), SPH_C32(0xe6483e3a), + SPH_C32(0x7a99073b), SPH_C32(0x3ba179a9), SPH_C32(0xf0af0000), + SPH_C32(0x081600f2), SPH_C32(0xbc8de000), SPH_C32(0x61940000), + SPH_C32(0x313f7fad), SPH_C32(0xbd5cd212), SPH_C32(0x9842022a), + SPH_C32(0x19323679) }, + { SPH_C32(0xe4f50000), SPH_C32(0x9ed300a0), SPH_C32(0xdc780000), + SPH_C32(0xb2510000), SPH_C32(0xa9ee43fb), SPH_C32(0xec89cec5), + SPH_C32(0xe90dff25), SPH_C32(0x46d360a4), SPH_C32(0x95950000), + SPH_C32(0x0d6100e4), SPH_C32(0xafd10000), SPH_C32(0x538c0000), + SPH_C32(0x7f445a05), SPH_C32(0xd6bfa4ed), SPH_C32(0x59a2fa38), + SPH_C32(0x35617517) }, + { SPH_C32(0x628c0000), SPH_C32(0xa1ea00a2), SPH_C32(0x3de2e000), + SPH_C32(0x2a070000), SPH_C32(0x3c8b24f5), SPH_C32(0xa201062f), + SPH_C32(0x3ad0b661), SPH_C32(0x50ceba1d), SPH_C32(0xa5220000), + SPH_C32(0xe8b100e4), SPH_C32(0x5b256000), SPH_C32(0x11480000), + SPH_C32(0x1cfc676f), SPH_C32(0xae05308d), SPH_C32(0x780d5bd2), + SPH_C32(0x85c46d23) }, + { SPH_C32(0xd4420000), SPH_C32(0x7b0300a0), SPH_C32(0x288c6000), + SPH_C32(0xf0950000), SPH_C32(0xca567e91), SPH_C32(0x94335aa5), + SPH_C32(0xc8a25ecf), SPH_C32(0xf6767890), SPH_C32(0x235b0000), + SPH_C32(0xd78800e6), SPH_C32(0xbabf8000), SPH_C32(0x891e0000), + SPH_C32(0x89990061), SPH_C32(0xe08df867), SPH_C32(0xabd01296), + SPH_C32(0x93d9b79a) }, + { SPH_C32(0x523b0000), SPH_C32(0x443a00a2), SPH_C32(0xc9168000), + SPH_C32(0x68c30000), SPH_C32(0x5f33199f), SPH_C32(0xdabb924f), + SPH_C32(0x1b7f178b), SPH_C32(0xe06ba229), SPH_C32(0x13ec0000), + SPH_C32(0x325800e6), SPH_C32(0x4e4be000), SPH_C32(0xcbda0000), + SPH_C32(0xea213d0b), SPH_C32(0x98376c07), SPH_C32(0x8a7fb37c), + SPH_C32(0x237cafae) }, + { SPH_C32(0x47ff0000), SPH_C32(0x812600d4), SPH_C32(0x5bcf0000), + SPH_C32(0x36b70000), SPH_C32(0x47392832), SPH_C32(0x935f59b7), + SPH_C32(0x256c4600), SPH_C32(0xd9267fe4), SPH_C32(0x3d010000), + SPH_C32(0xd29000c0), SPH_C32(0xe68d0000), SPH_C32(0xc6310000), + SPH_C32(0xca304571), SPH_C32(0xa8ea90ce), SPH_C32(0x385630bf), + SPH_C32(0xc290fed9) }, + { SPH_C32(0xc1860000), SPH_C32(0xbe1f00d6), SPH_C32(0xba55e000), + SPH_C32(0xaee10000), SPH_C32(0xd25c4f3c), SPH_C32(0xddd7915d), + SPH_C32(0xf6b10f44), SPH_C32(0xcf3ba55d), SPH_C32(0x0db60000), + SPH_C32(0x374000c0), SPH_C32(0x12796000), SPH_C32(0x84f50000), + SPH_C32(0xa988781b), SPH_C32(0xd05004ae), SPH_C32(0x19f99155), + SPH_C32(0x7235e6ed) }, + { SPH_C32(0x77480000), SPH_C32(0x64f600d4), SPH_C32(0xaf3b6000), + SPH_C32(0x74730000), SPH_C32(0x24811558), SPH_C32(0xebe5cdd7), + SPH_C32(0x04c3e7ea), SPH_C32(0x698367d0), SPH_C32(0x8bcf0000), + SPH_C32(0x087900c2), SPH_C32(0xf3e38000), SPH_C32(0x1ca30000), + SPH_C32(0x3ced1f15), SPH_C32(0x9ed8cc44), SPH_C32(0xca24d811), + SPH_C32(0x64283c54) }, + { SPH_C32(0xf1310000), SPH_C32(0x5bcf00d6), SPH_C32(0x4ea18000), + SPH_C32(0xec250000), SPH_C32(0xb1e47256), SPH_C32(0xa56d053d), + SPH_C32(0xd71eaeae), SPH_C32(0x7f9ebd69), SPH_C32(0xbb780000), + SPH_C32(0xeda900c2), SPH_C32(0x0717e000), SPH_C32(0x5e670000), + SPH_C32(0x5f55227f), SPH_C32(0xe6625824), SPH_C32(0xeb8b79fb), + SPH_C32(0xd48d2460) }, + { SPH_C32(0x53e60000), SPH_C32(0xa2ec00e8), SPH_C32(0x0b100000), + SPH_C32(0x72010000), SPH_C32(0x5c554f82), SPH_C32(0xafacf5c2), + SPH_C32(0x448a56b0), SPH_C32(0x02eca464), SPH_C32(0xde420000), + SPH_C32(0xe8de00d4), SPH_C32(0x144b0000), SPH_C32(0x6c7f0000), + SPH_C32(0x112e07d7), SPH_C32(0x8d812edb), SPH_C32(0x2a6b81e9), + SPH_C32(0xf8de670e) }, + { SPH_C32(0xd59f0000), SPH_C32(0x9dd500ea), SPH_C32(0xea8ae000), + SPH_C32(0xea570000), SPH_C32(0xc930288c), SPH_C32(0xe1243d28), + SPH_C32(0x97571ff4), SPH_C32(0x14f17edd), SPH_C32(0xeef50000), + SPH_C32(0x0d0e00d4), SPH_C32(0xe0bf6000), SPH_C32(0x2ebb0000), + SPH_C32(0x72963abd), SPH_C32(0xf53bbabb), SPH_C32(0x0bc42003), + SPH_C32(0x487b7f3a) }, + { SPH_C32(0x63510000), SPH_C32(0x473c00e8), SPH_C32(0xffe46000), + SPH_C32(0x30c50000), SPH_C32(0x3fed72e8), SPH_C32(0xd71661a2), + SPH_C32(0x6525f75a), SPH_C32(0xb249bc50), SPH_C32(0x688c0000), + SPH_C32(0x323700d6), SPH_C32(0x01258000), SPH_C32(0xb6ed0000), + SPH_C32(0xe7f35db3), SPH_C32(0xbbb37251), SPH_C32(0xd8196947), + SPH_C32(0x5e66a583) }, + { SPH_C32(0xe5280000), SPH_C32(0x780500ea), SPH_C32(0x1e7e8000), + SPH_C32(0xa8930000), SPH_C32(0xaa8815e6), SPH_C32(0x999ea948), + SPH_C32(0xb6f8be1e), SPH_C32(0xa45466e9), SPH_C32(0x583b0000), + SPH_C32(0xd7e700d6), SPH_C32(0xf5d1e000), SPH_C32(0xf4290000), + SPH_C32(0x844b60d9), SPH_C32(0xc309e631), SPH_C32(0xf9b6c8ad), + SPH_C32(0xeec3bdb7) }, + { SPH_C32(0xa4bc0000), SPH_C32(0xbb6800c0), SPH_C32(0xa9090000), + SPH_C32(0x9cf90000), SPH_C32(0x9c276a94), SPH_C32(0xb634e7a2), + SPH_C32(0x3751f756), SPH_C32(0xe368e633), SPH_C32(0xca5b0000), + SPH_C32(0xcb1400e8), SPH_C32(0x44940000), SPH_C32(0x28c90000), + SPH_C32(0x0a426067), SPH_C32(0xb17282ae), SPH_C32(0x4b8d9159), + SPH_C32(0x2314bc8e) }, + { SPH_C32(0x22c50000), SPH_C32(0x845100c2), SPH_C32(0x4893e000), + SPH_C32(0x04af0000), SPH_C32(0x09420d9a), SPH_C32(0xf8bc2f48), + SPH_C32(0xe48cbe12), SPH_C32(0xf5753c8a), SPH_C32(0xfaec0000), + SPH_C32(0x2ec400e8), SPH_C32(0xb0606000), SPH_C32(0x6a0d0000), + SPH_C32(0x69fa5d0d), SPH_C32(0xc9c816ce), SPH_C32(0x6a2230b3), + SPH_C32(0x93b1a4ba) }, + { SPH_C32(0x940b0000), SPH_C32(0x5eb800c0), SPH_C32(0x5dfd6000), + SPH_C32(0xde3d0000), SPH_C32(0xff9f57fe), SPH_C32(0xce8e73c2), + SPH_C32(0x16fe56bc), SPH_C32(0x53cdfe07), SPH_C32(0x7c950000), + SPH_C32(0x11fd00ea), SPH_C32(0x51fa8000), SPH_C32(0xf25b0000), + SPH_C32(0xfc9f3a03), SPH_C32(0x8740de24), SPH_C32(0xb9ff79f7), + SPH_C32(0x85ac7e03) }, + { SPH_C32(0x12720000), SPH_C32(0x618100c2), SPH_C32(0xbc678000), + SPH_C32(0x466b0000), SPH_C32(0x6afa30f0), SPH_C32(0x8006bb28), + SPH_C32(0xc5231ff8), SPH_C32(0x45d024be), SPH_C32(0x4c220000), + SPH_C32(0xf42d00ea), SPH_C32(0xa50ee000), SPH_C32(0xb09f0000), + SPH_C32(0x9f270769), SPH_C32(0xfffa4a44), SPH_C32(0x9850d81d), + SPH_C32(0x35096637) }, + { SPH_C32(0xb0a50000), SPH_C32(0x98a200fc), SPH_C32(0xf9d60000), + SPH_C32(0xd84f0000), SPH_C32(0x874b0d24), SPH_C32(0x8ac74bd7), + SPH_C32(0x56b7e7e6), SPH_C32(0x38a23db3), SPH_C32(0x29180000), + SPH_C32(0xf15a00fc), SPH_C32(0xb6520000), SPH_C32(0x82870000), + SPH_C32(0xd15c22c1), SPH_C32(0x94193cbb), SPH_C32(0x59b0200f), + SPH_C32(0x195a2559) }, + { SPH_C32(0x36dc0000), SPH_C32(0xa79b00fe), SPH_C32(0x184ce000), + SPH_C32(0x40190000), SPH_C32(0x122e6a2a), SPH_C32(0xc44f833d), + SPH_C32(0x856aaea2), SPH_C32(0x2ebfe70a), SPH_C32(0x19af0000), + SPH_C32(0x148a00fc), SPH_C32(0x42a66000), SPH_C32(0xc0430000), + SPH_C32(0xb2e41fab), SPH_C32(0xeca3a8db), SPH_C32(0x781f81e5), + SPH_C32(0xa9ff3d6d) }, + { SPH_C32(0x80120000), SPH_C32(0x7d7200fc), SPH_C32(0x0d226000), + SPH_C32(0x9a8b0000), SPH_C32(0xe4f3304e), SPH_C32(0xf27ddfb7), + SPH_C32(0x7718460c), SPH_C32(0x88072587), SPH_C32(0x9fd60000), + SPH_C32(0x2bb300fe), SPH_C32(0xa33c8000), SPH_C32(0x58150000), + SPH_C32(0x278178a5), SPH_C32(0xa22b6031), SPH_C32(0xabc2c8a1), + SPH_C32(0xbfe2e7d4) }, + { SPH_C32(0x066b0000), SPH_C32(0x424b00fe), SPH_C32(0xecb88000), + SPH_C32(0x02dd0000), SPH_C32(0x71965740), SPH_C32(0xbcf5175d), + SPH_C32(0xa4c50f48), SPH_C32(0x9e1aff3e), SPH_C32(0xaf610000), + SPH_C32(0xce6300fe), SPH_C32(0x57c8e000), SPH_C32(0x1ad10000), + SPH_C32(0x443945cf), SPH_C32(0xda91f451), SPH_C32(0x8a6d694b), + SPH_C32(0x0f47ffe0) } +}; + +static const sph_u32 T512_32[256][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xcc140000), SPH_C32(0xa5630000), SPH_C32(0x5ab90780), + SPH_C32(0x3b500000), SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), + SPH_C32(0x694348c1), SPH_C32(0xca5a87fe), SPH_C32(0x819e0000), + SPH_C32(0xec570000), SPH_C32(0x66320280), SPH_C32(0x95f30000), + SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), SPH_C32(0xe65aa22d), + SPH_C32(0x8e67b7fa) }, + { SPH_C32(0x819e0000), SPH_C32(0xec570000), SPH_C32(0x66320280), + SPH_C32(0x95f30000), SPH_C32(0x5da92802), SPH_C32(0x48f43cbc), + SPH_C32(0xe65aa22d), SPH_C32(0x8e67b7fa), SPH_C32(0x4d8a0000), + SPH_C32(0x49340000), SPH_C32(0x3c8b0500), SPH_C32(0xaea30000), + SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), SPH_C32(0x8f19eaec), + SPH_C32(0x443d3004) }, + { SPH_C32(0x4d8a0000), SPH_C32(0x49340000), SPH_C32(0x3c8b0500), + SPH_C32(0xaea30000), SPH_C32(0x16793bfd), SPH_C32(0xcf6f08a4), + SPH_C32(0x8f19eaec), SPH_C32(0x443d3004), SPH_C32(0xcc140000), + SPH_C32(0xa5630000), SPH_C32(0x5ab90780), SPH_C32(0x3b500000), + SPH_C32(0x4bd013ff), SPH_C32(0x879b3418), SPH_C32(0x694348c1), + SPH_C32(0xca5a87fe) }, + { SPH_C32(0x78230000), SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), + SPH_C32(0x90a50000), SPH_C32(0x713e2879), SPH_C32(0x7ee98924), + SPH_C32(0xf08ca062), SPH_C32(0x636f8bab), SPH_C32(0x02af0000), + SPH_C32(0xb7280000), SPH_C32(0xba1c0300), SPH_C32(0x56980000), + SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), SPH_C32(0xa95c149a), + SPH_C32(0xf4f6ea7b) }, + { SPH_C32(0xb4370000), SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), + SPH_C32(0xabf50000), SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), + SPH_C32(0x99cfe8a3), SPH_C32(0xa9350c55), SPH_C32(0x83310000), + SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), SPH_C32(0xc36b0000), + SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), SPH_C32(0x4f06b6b7), + SPH_C32(0x7a915d81) }, + { SPH_C32(0xf9bd0000), SPH_C32(0xfeab0000), SPH_C32(0xcf080900), + SPH_C32(0x05560000), SPH_C32(0x2c97007b), SPH_C32(0x361db598), + SPH_C32(0x16d6024f), SPH_C32(0xed083c51), SPH_C32(0x4f250000), + SPH_C32(0xfe1c0000), SPH_C32(0x86970600), SPH_C32(0xf83b0000), + SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), SPH_C32(0x2645fe76), + SPH_C32(0xb0cbda7f) }, + { SPH_C32(0x35a90000), SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), + SPH_C32(0x3e060000), SPH_C32(0x67471384), SPH_C32(0xb1868180), + SPH_C32(0x7f954a8e), SPH_C32(0x2752bbaf), SPH_C32(0xcebb0000), + SPH_C32(0x124b0000), SPH_C32(0xe0a50480), SPH_C32(0x6dc80000), + SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), SPH_C32(0xc01f5c5b), + SPH_C32(0x3eac6d85) }, + { SPH_C32(0x02af0000), SPH_C32(0xb7280000), SPH_C32(0xba1c0300), + SPH_C32(0x56980000), SPH_C32(0xba8d45d3), SPH_C32(0x8048c667), + SPH_C32(0xa95c149a), SPH_C32(0xf4f6ea7b), SPH_C32(0x7a8c0000), + SPH_C32(0xa5d40000), SPH_C32(0x13260880), SPH_C32(0xc63d0000), + SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), SPH_C32(0x59d0b4f8), + SPH_C32(0x979961d0) }, + { SPH_C32(0xcebb0000), SPH_C32(0x124b0000), SPH_C32(0xe0a50480), + SPH_C32(0x6dc80000), SPH_C32(0xf15d562c), SPH_C32(0x07d3f27f), + SPH_C32(0xc01f5c5b), SPH_C32(0x3eac6d85), SPH_C32(0xfb120000), + SPH_C32(0x49830000), SPH_C32(0x75140a00), SPH_C32(0x53ce0000), + SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), SPH_C32(0xbf8a16d5), + SPH_C32(0x19fed62a) }, + { SPH_C32(0x83310000), SPH_C32(0x5b7f0000), SPH_C32(0xdc2e0180), + SPH_C32(0xc36b0000), SPH_C32(0xe7246dd1), SPH_C32(0xc8bcfadb), + SPH_C32(0x4f06b6b7), SPH_C32(0x7a915d81), SPH_C32(0x37060000), + SPH_C32(0xece00000), SPH_C32(0x2fad0d80), SPH_C32(0x689e0000), + SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), SPH_C32(0xd6c95e14), + SPH_C32(0xd3a451d4) }, + { SPH_C32(0x4f250000), SPH_C32(0xfe1c0000), SPH_C32(0x86970600), + SPH_C32(0xf83b0000), SPH_C32(0xacf47e2e), SPH_C32(0x4f27cec3), + SPH_C32(0x2645fe76), SPH_C32(0xb0cbda7f), SPH_C32(0xb6980000), + SPH_C32(0x00b70000), SPH_C32(0x499f0f00), SPH_C32(0xfd6d0000), + SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), SPH_C32(0x3093fc39), + SPH_C32(0x5dc3e62e) }, + { SPH_C32(0x7a8c0000), SPH_C32(0xa5d40000), SPH_C32(0x13260880), + SPH_C32(0xc63d0000), SPH_C32(0xcbb36daa), SPH_C32(0xfea14f43), + SPH_C32(0x59d0b4f8), SPH_C32(0x979961d0), SPH_C32(0x78230000), + SPH_C32(0x12fc0000), SPH_C32(0xa93a0b80), SPH_C32(0x90a50000), + SPH_C32(0x713e2879), SPH_C32(0x7ee98924), SPH_C32(0xf08ca062), + SPH_C32(0x636f8bab) }, + { SPH_C32(0xb6980000), SPH_C32(0x00b70000), SPH_C32(0x499f0f00), + SPH_C32(0xfd6d0000), SPH_C32(0x80637e55), SPH_C32(0x793a7b5b), + SPH_C32(0x3093fc39), SPH_C32(0x5dc3e62e), SPH_C32(0xf9bd0000), + SPH_C32(0xfeab0000), SPH_C32(0xcf080900), SPH_C32(0x05560000), + SPH_C32(0x2c97007b), SPH_C32(0x361db598), SPH_C32(0x16d6024f), + SPH_C32(0xed083c51) }, + { SPH_C32(0xfb120000), SPH_C32(0x49830000), SPH_C32(0x75140a00), + SPH_C32(0x53ce0000), SPH_C32(0x961a45a8), SPH_C32(0xb65573ff), + SPH_C32(0xbf8a16d5), SPH_C32(0x19fed62a), SPH_C32(0x35a90000), + SPH_C32(0x5bc80000), SPH_C32(0x95b10e80), SPH_C32(0x3e060000), + SPH_C32(0x67471384), SPH_C32(0xb1868180), SPH_C32(0x7f954a8e), + SPH_C32(0x2752bbaf) }, + { SPH_C32(0x37060000), SPH_C32(0xece00000), SPH_C32(0x2fad0d80), + SPH_C32(0x689e0000), SPH_C32(0xddca5657), SPH_C32(0x31ce47e7), + SPH_C32(0xd6c95e14), SPH_C32(0xd3a451d4), SPH_C32(0xb4370000), + SPH_C32(0xb79f0000), SPH_C32(0xf3830c00), SPH_C32(0xabf50000), + SPH_C32(0x3aee3b86), SPH_C32(0xf972bd3c), SPH_C32(0x99cfe8a3), + SPH_C32(0xa9350c55) }, + { SPH_C32(0xac480000), SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), + SPH_C32(0x03430000), SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), + SPH_C32(0xfe72c7fe), SPH_C32(0x91e478f6), SPH_C32(0x1e4e0000), + SPH_C32(0xdecf0000), SPH_C32(0x6df80180), SPH_C32(0x77240000), + SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), SPH_C32(0xcda31812), + SPH_C32(0x98aa496e) }, + { SPH_C32(0x605c0000), SPH_C32(0xbec50000), SPH_C32(0x1f421400), + SPH_C32(0x38130000), SPH_C32(0x11552295), SPH_C32(0x982964ae), + SPH_C32(0x97318f3f), SPH_C32(0x5bbeff08), SPH_C32(0x9fd00000), + SPH_C32(0x32980000), SPH_C32(0x0bca0300), SPH_C32(0xe2d70000), + SPH_C32(0xb1ee2f9c), SPH_C32(0xbc5455f2), SPH_C32(0x2bf9ba3f), + SPH_C32(0x16cdfe94) }, + { SPH_C32(0x2dd60000), SPH_C32(0xf7f10000), SPH_C32(0x23c91100), + SPH_C32(0x96b00000), SPH_C32(0x072c1968), SPH_C32(0x57466c0a), + SPH_C32(0x182865d3), SPH_C32(0x1f83cf0c), SPH_C32(0x53c40000), + SPH_C32(0x97fb0000), SPH_C32(0x51730480), SPH_C32(0xd9870000), + SPH_C32(0xfa3e3c63), SPH_C32(0x3bcf61ea), SPH_C32(0x42baf2fe), + SPH_C32(0xdc97796a) }, + { SPH_C32(0xe1c20000), SPH_C32(0x52920000), SPH_C32(0x79701680), + SPH_C32(0xade00000), SPH_C32(0x4cfc0a97), SPH_C32(0xd0dd5812), + SPH_C32(0x716b2d12), SPH_C32(0xd5d948f2), SPH_C32(0xd25a0000), + SPH_C32(0x7bac0000), SPH_C32(0x37410600), SPH_C32(0x4c740000), + SPH_C32(0xa7971461), SPH_C32(0x733b5d56), SPH_C32(0xa4e050d3), + SPH_C32(0x52f0ce90) }, + { SPH_C32(0xd46b0000), SPH_C32(0x095a0000), SPH_C32(0xecc11800), + SPH_C32(0x93e60000), SPH_C32(0x2bbb1913), SPH_C32(0x615bd992), + SPH_C32(0x0efe679c), SPH_C32(0xf28bf35d), SPH_C32(0x1ce10000), + SPH_C32(0x69e70000), SPH_C32(0xd7e40280), SPH_C32(0x21bc0000), + SPH_C32(0x56ca424d), SPH_C32(0x74e8af29), SPH_C32(0x64ff0c88), + SPH_C32(0x6c5ca315) }, + { SPH_C32(0x187f0000), SPH_C32(0xac390000), SPH_C32(0xb6781f80), + SPH_C32(0xa8b60000), SPH_C32(0x606b0aec), SPH_C32(0xe6c0ed8a), + SPH_C32(0x67bd2f5d), SPH_C32(0x38d174a3), SPH_C32(0x9d7f0000), + SPH_C32(0x85b00000), SPH_C32(0xb1d60000), SPH_C32(0xb44f0000), + SPH_C32(0x0b636a4f), SPH_C32(0x3c1c9395), SPH_C32(0x82a5aea5), + SPH_C32(0xe23b14ef) }, + { SPH_C32(0x55f50000), SPH_C32(0xe50d0000), SPH_C32(0x8af31a80), + SPH_C32(0x06150000), SPH_C32(0x76123111), SPH_C32(0x29afe52e), + SPH_C32(0xe8a4c5b1), SPH_C32(0x7cec44a7), SPH_C32(0x516b0000), + SPH_C32(0x20d30000), SPH_C32(0xeb6f0780), SPH_C32(0x8f1f0000), + SPH_C32(0x40b379b0), SPH_C32(0xbb87a78d), SPH_C32(0xebe6e664), + SPH_C32(0x28619311) }, + { SPH_C32(0x99e10000), SPH_C32(0x406e0000), SPH_C32(0xd04a1d00), + SPH_C32(0x3d450000), SPH_C32(0x3dc222ee), SPH_C32(0xae34d136), + SPH_C32(0x81e78d70), SPH_C32(0xb6b6c359), SPH_C32(0xd0f50000), + SPH_C32(0xcc840000), SPH_C32(0x8d5d0500), SPH_C32(0x1aec0000), + SPH_C32(0x1d1a51b2), SPH_C32(0xf3739b31), SPH_C32(0x0dbc4449), + SPH_C32(0xa60624eb) }, + { SPH_C32(0xaee70000), SPH_C32(0xac8e0000), SPH_C32(0xffe71080), + SPH_C32(0x55db0000), SPH_C32(0xe00874b9), SPH_C32(0x9ffa96d1), + SPH_C32(0x572ed364), SPH_C32(0x6512928d), SPH_C32(0x64c20000), + SPH_C32(0x7b1b0000), SPH_C32(0x7ede0900), SPH_C32(0xb1190000), + SPH_C32(0x27f46a34), SPH_C32(0x0a01260d), SPH_C32(0x9473acea), + SPH_C32(0x0f3328be) }, + { SPH_C32(0x62f30000), SPH_C32(0x09ed0000), SPH_C32(0xa55e1700), + SPH_C32(0x6e8b0000), SPH_C32(0xabd86746), SPH_C32(0x1861a2c9), + SPH_C32(0x3e6d9ba5), SPH_C32(0xaf481573), SPH_C32(0xe55c0000), + SPH_C32(0x974c0000), SPH_C32(0x18ec0b80), SPH_C32(0x24ea0000), + SPH_C32(0x7a5d4236), SPH_C32(0x42f51ab1), SPH_C32(0x72290ec7), + SPH_C32(0x81549f44) }, + { SPH_C32(0x2f790000), SPH_C32(0x40d90000), SPH_C32(0x99d51200), + SPH_C32(0xc0280000), SPH_C32(0xbda15cbb), SPH_C32(0xd70eaa6d), + SPH_C32(0xb1747149), SPH_C32(0xeb752577), SPH_C32(0x29480000), + SPH_C32(0x322f0000), SPH_C32(0x42550c00), SPH_C32(0x1fba0000), + SPH_C32(0x318d51c9), SPH_C32(0xc56e2ea9), SPH_C32(0x1b6a4606), + SPH_C32(0x4b0e18ba) }, + { SPH_C32(0xe36d0000), SPH_C32(0xe5ba0000), SPH_C32(0xc36c1580), + SPH_C32(0xfb780000), SPH_C32(0xf6714f44), SPH_C32(0x50959e75), + SPH_C32(0xd8373988), SPH_C32(0x212fa289), SPH_C32(0xa8d60000), + SPH_C32(0xde780000), SPH_C32(0x24670e80), SPH_C32(0x8a490000), + SPH_C32(0x6c2479cb), SPH_C32(0x8d9a1215), SPH_C32(0xfd30e42b), + SPH_C32(0xc569af40) }, + { SPH_C32(0xd6c40000), SPH_C32(0xbe720000), SPH_C32(0x56dd1b00), + SPH_C32(0xc57e0000), SPH_C32(0x91365cc0), SPH_C32(0xe1131ff5), + SPH_C32(0xa7a27306), SPH_C32(0x067d1926), SPH_C32(0x666d0000), + SPH_C32(0xcc330000), SPH_C32(0xc4c20a00), SPH_C32(0xe7810000), + SPH_C32(0x9d792fe7), SPH_C32(0x8a49e06a), SPH_C32(0x3d2fb870), + SPH_C32(0xfbc5c2c5) }, + { SPH_C32(0x1ad00000), SPH_C32(0x1b110000), SPH_C32(0x0c641c80), + SPH_C32(0xfe2e0000), SPH_C32(0xdae64f3f), SPH_C32(0x66882bed), + SPH_C32(0xcee13bc7), SPH_C32(0xcc279ed8), SPH_C32(0xe7f30000), + SPH_C32(0x20640000), SPH_C32(0xa2f00880), SPH_C32(0x72720000), + SPH_C32(0xc0d007e5), SPH_C32(0xc2bddcd6), SPH_C32(0xdb751a5d), + SPH_C32(0x75a2753f) }, + { SPH_C32(0x575a0000), SPH_C32(0x52250000), SPH_C32(0x30ef1980), + SPH_C32(0x508d0000), SPH_C32(0xcc9f74c2), SPH_C32(0xa9e72349), + SPH_C32(0x41f8d12b), SPH_C32(0x881aaedc), SPH_C32(0x2be70000), + SPH_C32(0x85070000), SPH_C32(0xf8490f00), SPH_C32(0x49220000), + SPH_C32(0x8b00141a), SPH_C32(0x4526e8ce), SPH_C32(0xb236529c), + SPH_C32(0xbff8f2c1) }, + { SPH_C32(0x9b4e0000), SPH_C32(0xf7460000), SPH_C32(0x6a561e00), + SPH_C32(0x6bdd0000), SPH_C32(0x874f673d), SPH_C32(0x2e7c1751), + SPH_C32(0x28bb99ea), SPH_C32(0x42402922), SPH_C32(0xaa790000), + SPH_C32(0x69500000), SPH_C32(0x9e7b0d80), SPH_C32(0xdcd10000), + SPH_C32(0xd6a93c18), SPH_C32(0x0dd2d472), SPH_C32(0x546cf0b1), + SPH_C32(0x319f453b) }, + { SPH_C32(0x1e4e0000), SPH_C32(0xdecf0000), SPH_C32(0x6df80180), + SPH_C32(0x77240000), SPH_C32(0xec47079e), SPH_C32(0xf4a0694e), + SPH_C32(0xcda31812), SPH_C32(0x98aa496e), SPH_C32(0xb2060000), + SPH_C32(0xc5690000), SPH_C32(0x28031200), SPH_C32(0x74670000), + SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), SPH_C32(0x33d1dfec), + SPH_C32(0x094e3198) }, + { SPH_C32(0xd25a0000), SPH_C32(0x7bac0000), SPH_C32(0x37410600), + SPH_C32(0x4c740000), SPH_C32(0xa7971461), SPH_C32(0x733b5d56), + SPH_C32(0xa4e050d3), SPH_C32(0x52f0ce90), SPH_C32(0x33980000), + SPH_C32(0x293e0000), SPH_C32(0x4e311080), SPH_C32(0xe1940000), + SPH_C32(0xeb6b1ef6), SPH_C32(0xa3e60544), SPH_C32(0xd58b7dc1), + SPH_C32(0x87298662) }, + { SPH_C32(0x9fd00000), SPH_C32(0x32980000), SPH_C32(0x0bca0300), + SPH_C32(0xe2d70000), SPH_C32(0xb1ee2f9c), SPH_C32(0xbc5455f2), + SPH_C32(0x2bf9ba3f), SPH_C32(0x16cdfe94), SPH_C32(0xff8c0000), + SPH_C32(0x8c5d0000), SPH_C32(0x14881700), SPH_C32(0xdac40000), + SPH_C32(0xa0bb0d09), SPH_C32(0x247d315c), SPH_C32(0xbcc83500), + SPH_C32(0x4d73019c) }, + { SPH_C32(0x53c40000), SPH_C32(0x97fb0000), SPH_C32(0x51730480), + SPH_C32(0xd9870000), SPH_C32(0xfa3e3c63), SPH_C32(0x3bcf61ea), + SPH_C32(0x42baf2fe), SPH_C32(0xdc97796a), SPH_C32(0x7e120000), + SPH_C32(0x600a0000), SPH_C32(0x72ba1580), SPH_C32(0x4f370000), + SPH_C32(0xfd12250b), SPH_C32(0x6c890de0), SPH_C32(0x5a92972d), + SPH_C32(0xc314b666) }, + { SPH_C32(0x666d0000), SPH_C32(0xcc330000), SPH_C32(0xc4c20a00), + SPH_C32(0xe7810000), SPH_C32(0x9d792fe7), SPH_C32(0x8a49e06a), + SPH_C32(0x3d2fb870), SPH_C32(0xfbc5c2c5), SPH_C32(0xb0a90000), + SPH_C32(0x72410000), SPH_C32(0x921f1100), SPH_C32(0x22ff0000), + SPH_C32(0x0c4f7327), SPH_C32(0x6b5aff9f), SPH_C32(0x9a8dcb76), + SPH_C32(0xfdb8dbe3) }, + { SPH_C32(0xaa790000), SPH_C32(0x69500000), SPH_C32(0x9e7b0d80), + SPH_C32(0xdcd10000), SPH_C32(0xd6a93c18), SPH_C32(0x0dd2d472), + SPH_C32(0x546cf0b1), SPH_C32(0x319f453b), SPH_C32(0x31370000), + SPH_C32(0x9e160000), SPH_C32(0xf42d1380), SPH_C32(0xb70c0000), + SPH_C32(0x51e65b25), SPH_C32(0x23aec323), SPH_C32(0x7cd7695b), + SPH_C32(0x73df6c19) }, + { SPH_C32(0xe7f30000), SPH_C32(0x20640000), SPH_C32(0xa2f00880), + SPH_C32(0x72720000), SPH_C32(0xc0d007e5), SPH_C32(0xc2bddcd6), + SPH_C32(0xdb751a5d), SPH_C32(0x75a2753f), SPH_C32(0xfd230000), + SPH_C32(0x3b750000), SPH_C32(0xae941400), SPH_C32(0x8c5c0000), + SPH_C32(0x1a3648da), SPH_C32(0xa435f73b), SPH_C32(0x1594219a), + SPH_C32(0xb985ebe7) }, + { SPH_C32(0x2be70000), SPH_C32(0x85070000), SPH_C32(0xf8490f00), + SPH_C32(0x49220000), SPH_C32(0x8b00141a), SPH_C32(0x4526e8ce), + SPH_C32(0xb236529c), SPH_C32(0xbff8f2c1), SPH_C32(0x7cbd0000), + SPH_C32(0xd7220000), SPH_C32(0xc8a61680), SPH_C32(0x19af0000), + SPH_C32(0x479f60d8), SPH_C32(0xecc1cb87), SPH_C32(0xf3ce83b7), + SPH_C32(0x37e25c1d) }, + { SPH_C32(0x1ce10000), SPH_C32(0x69e70000), SPH_C32(0xd7e40280), + SPH_C32(0x21bc0000), SPH_C32(0x56ca424d), SPH_C32(0x74e8af29), + SPH_C32(0x64ff0c88), SPH_C32(0x6c5ca315), SPH_C32(0xc88a0000), + SPH_C32(0x60bd0000), SPH_C32(0x3b251a80), SPH_C32(0xb25a0000), + SPH_C32(0x7d715b5e), SPH_C32(0x15b376bb), SPH_C32(0x6a016b14), + SPH_C32(0x9ed75048) }, + { SPH_C32(0xd0f50000), SPH_C32(0xcc840000), SPH_C32(0x8d5d0500), + SPH_C32(0x1aec0000), SPH_C32(0x1d1a51b2), SPH_C32(0xf3739b31), + SPH_C32(0x0dbc4449), SPH_C32(0xa60624eb), SPH_C32(0x49140000), + SPH_C32(0x8cea0000), SPH_C32(0x5d171800), SPH_C32(0x27a90000), + SPH_C32(0x20d8735c), SPH_C32(0x5d474a07), SPH_C32(0x8c5bc939), + SPH_C32(0x10b0e7b2) }, + { SPH_C32(0x9d7f0000), SPH_C32(0x85b00000), SPH_C32(0xb1d60000), + SPH_C32(0xb44f0000), SPH_C32(0x0b636a4f), SPH_C32(0x3c1c9395), + SPH_C32(0x82a5aea5), SPH_C32(0xe23b14ef), SPH_C32(0x85000000), + SPH_C32(0x29890000), SPH_C32(0x07ae1f80), SPH_C32(0x1cf90000), + SPH_C32(0x6b0860a3), SPH_C32(0xdadc7e1f), SPH_C32(0xe51881f8), + SPH_C32(0xdaea604c) }, + { SPH_C32(0x516b0000), SPH_C32(0x20d30000), SPH_C32(0xeb6f0780), + SPH_C32(0x8f1f0000), SPH_C32(0x40b379b0), SPH_C32(0xbb87a78d), + SPH_C32(0xebe6e664), SPH_C32(0x28619311), SPH_C32(0x049e0000), + SPH_C32(0xc5de0000), SPH_C32(0x619c1d00), SPH_C32(0x890a0000), + SPH_C32(0x36a148a1), SPH_C32(0x922842a3), SPH_C32(0x034223d5), + SPH_C32(0x548dd7b6) }, + { SPH_C32(0x64c20000), SPH_C32(0x7b1b0000), SPH_C32(0x7ede0900), + SPH_C32(0xb1190000), SPH_C32(0x27f46a34), SPH_C32(0x0a01260d), + SPH_C32(0x9473acea), SPH_C32(0x0f3328be), SPH_C32(0xca250000), + SPH_C32(0xd7950000), SPH_C32(0x81391980), SPH_C32(0xe4c20000), + SPH_C32(0xc7fc1e8d), SPH_C32(0x95fbb0dc), SPH_C32(0xc35d7f8e), + SPH_C32(0x6a21ba33) }, + { SPH_C32(0xa8d60000), SPH_C32(0xde780000), SPH_C32(0x24670e80), + SPH_C32(0x8a490000), SPH_C32(0x6c2479cb), SPH_C32(0x8d9a1215), + SPH_C32(0xfd30e42b), SPH_C32(0xc569af40), SPH_C32(0x4bbb0000), + SPH_C32(0x3bc20000), SPH_C32(0xe70b1b00), SPH_C32(0x71310000), + SPH_C32(0x9a55368f), SPH_C32(0xdd0f8c60), SPH_C32(0x2507dda3), + SPH_C32(0xe4460dc9) }, + { SPH_C32(0xe55c0000), SPH_C32(0x974c0000), SPH_C32(0x18ec0b80), + SPH_C32(0x24ea0000), SPH_C32(0x7a5d4236), SPH_C32(0x42f51ab1), + SPH_C32(0x72290ec7), SPH_C32(0x81549f44), SPH_C32(0x87af0000), + SPH_C32(0x9ea10000), SPH_C32(0xbdb21c80), SPH_C32(0x4a610000), + SPH_C32(0xd1852570), SPH_C32(0x5a94b878), SPH_C32(0x4c449562), + SPH_C32(0x2e1c8a37) }, + { SPH_C32(0x29480000), SPH_C32(0x322f0000), SPH_C32(0x42550c00), + SPH_C32(0x1fba0000), SPH_C32(0x318d51c9), SPH_C32(0xc56e2ea9), + SPH_C32(0x1b6a4606), SPH_C32(0x4b0e18ba), SPH_C32(0x06310000), + SPH_C32(0x72f60000), SPH_C32(0xdb801e00), SPH_C32(0xdf920000), + SPH_C32(0x8c2c0d72), SPH_C32(0x126084c4), SPH_C32(0xaa1e374f), + SPH_C32(0xa07b3dcd) }, + { SPH_C32(0xb2060000), SPH_C32(0xc5690000), SPH_C32(0x28031200), + SPH_C32(0x74670000), SPH_C32(0xb6c236f4), SPH_C32(0xeb1239f8), + SPH_C32(0x33d1dfec), SPH_C32(0x094e3198), SPH_C32(0xac480000), + SPH_C32(0x1ba60000), SPH_C32(0x45fb1380), SPH_C32(0x03430000), + SPH_C32(0x5a85316a), SPH_C32(0x1fb250b6), SPH_C32(0xfe72c7fe), + SPH_C32(0x91e478f6) }, + { SPH_C32(0x7e120000), SPH_C32(0x600a0000), SPH_C32(0x72ba1580), + SPH_C32(0x4f370000), SPH_C32(0xfd12250b), SPH_C32(0x6c890de0), + SPH_C32(0x5a92972d), SPH_C32(0xc314b666), SPH_C32(0x2dd60000), + SPH_C32(0xf7f10000), SPH_C32(0x23c91100), SPH_C32(0x96b00000), + SPH_C32(0x072c1968), SPH_C32(0x57466c0a), SPH_C32(0x182865d3), + SPH_C32(0x1f83cf0c) }, + { SPH_C32(0x33980000), SPH_C32(0x293e0000), SPH_C32(0x4e311080), + SPH_C32(0xe1940000), SPH_C32(0xeb6b1ef6), SPH_C32(0xa3e60544), + SPH_C32(0xd58b7dc1), SPH_C32(0x87298662), SPH_C32(0xe1c20000), + SPH_C32(0x52920000), SPH_C32(0x79701680), SPH_C32(0xade00000), + SPH_C32(0x4cfc0a97), SPH_C32(0xd0dd5812), SPH_C32(0x716b2d12), + SPH_C32(0xd5d948f2) }, + { SPH_C32(0xff8c0000), SPH_C32(0x8c5d0000), SPH_C32(0x14881700), + SPH_C32(0xdac40000), SPH_C32(0xa0bb0d09), SPH_C32(0x247d315c), + SPH_C32(0xbcc83500), SPH_C32(0x4d73019c), SPH_C32(0x605c0000), + SPH_C32(0xbec50000), SPH_C32(0x1f421400), SPH_C32(0x38130000), + SPH_C32(0x11552295), SPH_C32(0x982964ae), SPH_C32(0x97318f3f), + SPH_C32(0x5bbeff08) }, + { SPH_C32(0xca250000), SPH_C32(0xd7950000), SPH_C32(0x81391980), + SPH_C32(0xe4c20000), SPH_C32(0xc7fc1e8d), SPH_C32(0x95fbb0dc), + SPH_C32(0xc35d7f8e), SPH_C32(0x6a21ba33), SPH_C32(0xaee70000), + SPH_C32(0xac8e0000), SPH_C32(0xffe71080), SPH_C32(0x55db0000), + SPH_C32(0xe00874b9), SPH_C32(0x9ffa96d1), SPH_C32(0x572ed364), + SPH_C32(0x6512928d) }, + { SPH_C32(0x06310000), SPH_C32(0x72f60000), SPH_C32(0xdb801e00), + SPH_C32(0xdf920000), SPH_C32(0x8c2c0d72), SPH_C32(0x126084c4), + SPH_C32(0xaa1e374f), SPH_C32(0xa07b3dcd), SPH_C32(0x2f790000), + SPH_C32(0x40d90000), SPH_C32(0x99d51200), SPH_C32(0xc0280000), + SPH_C32(0xbda15cbb), SPH_C32(0xd70eaa6d), SPH_C32(0xb1747149), + SPH_C32(0xeb752577) }, + { SPH_C32(0x4bbb0000), SPH_C32(0x3bc20000), SPH_C32(0xe70b1b00), + SPH_C32(0x71310000), SPH_C32(0x9a55368f), SPH_C32(0xdd0f8c60), + SPH_C32(0x2507dda3), SPH_C32(0xe4460dc9), SPH_C32(0xe36d0000), + SPH_C32(0xe5ba0000), SPH_C32(0xc36c1580), SPH_C32(0xfb780000), + SPH_C32(0xf6714f44), SPH_C32(0x50959e75), SPH_C32(0xd8373988), + SPH_C32(0x212fa289) }, + { SPH_C32(0x87af0000), SPH_C32(0x9ea10000), SPH_C32(0xbdb21c80), + SPH_C32(0x4a610000), SPH_C32(0xd1852570), SPH_C32(0x5a94b878), + SPH_C32(0x4c449562), SPH_C32(0x2e1c8a37), SPH_C32(0x62f30000), + SPH_C32(0x09ed0000), SPH_C32(0xa55e1700), SPH_C32(0x6e8b0000), + SPH_C32(0xabd86746), SPH_C32(0x1861a2c9), SPH_C32(0x3e6d9ba5), + SPH_C32(0xaf481573) }, + { SPH_C32(0xb0a90000), SPH_C32(0x72410000), SPH_C32(0x921f1100), + SPH_C32(0x22ff0000), SPH_C32(0x0c4f7327), SPH_C32(0x6b5aff9f), + SPH_C32(0x9a8dcb76), SPH_C32(0xfdb8dbe3), SPH_C32(0xd6c40000), + SPH_C32(0xbe720000), SPH_C32(0x56dd1b00), SPH_C32(0xc57e0000), + SPH_C32(0x91365cc0), SPH_C32(0xe1131ff5), SPH_C32(0xa7a27306), + SPH_C32(0x067d1926) }, + { SPH_C32(0x7cbd0000), SPH_C32(0xd7220000), SPH_C32(0xc8a61680), + SPH_C32(0x19af0000), SPH_C32(0x479f60d8), SPH_C32(0xecc1cb87), + SPH_C32(0xf3ce83b7), SPH_C32(0x37e25c1d), SPH_C32(0x575a0000), + SPH_C32(0x52250000), SPH_C32(0x30ef1980), SPH_C32(0x508d0000), + SPH_C32(0xcc9f74c2), SPH_C32(0xa9e72349), SPH_C32(0x41f8d12b), + SPH_C32(0x881aaedc) }, + { SPH_C32(0x31370000), SPH_C32(0x9e160000), SPH_C32(0xf42d1380), + SPH_C32(0xb70c0000), SPH_C32(0x51e65b25), SPH_C32(0x23aec323), + SPH_C32(0x7cd7695b), SPH_C32(0x73df6c19), SPH_C32(0x9b4e0000), + SPH_C32(0xf7460000), SPH_C32(0x6a561e00), SPH_C32(0x6bdd0000), + SPH_C32(0x874f673d), SPH_C32(0x2e7c1751), SPH_C32(0x28bb99ea), + SPH_C32(0x42402922) }, + { SPH_C32(0xfd230000), SPH_C32(0x3b750000), SPH_C32(0xae941400), + SPH_C32(0x8c5c0000), SPH_C32(0x1a3648da), SPH_C32(0xa435f73b), + SPH_C32(0x1594219a), SPH_C32(0xb985ebe7), SPH_C32(0x1ad00000), + SPH_C32(0x1b110000), SPH_C32(0x0c641c80), SPH_C32(0xfe2e0000), + SPH_C32(0xdae64f3f), SPH_C32(0x66882bed), SPH_C32(0xcee13bc7), + SPH_C32(0xcc279ed8) }, + { SPH_C32(0xc88a0000), SPH_C32(0x60bd0000), SPH_C32(0x3b251a80), + SPH_C32(0xb25a0000), SPH_C32(0x7d715b5e), SPH_C32(0x15b376bb), + SPH_C32(0x6a016b14), SPH_C32(0x9ed75048), SPH_C32(0xd46b0000), + SPH_C32(0x095a0000), SPH_C32(0xecc11800), SPH_C32(0x93e60000), + SPH_C32(0x2bbb1913), SPH_C32(0x615bd992), SPH_C32(0x0efe679c), + SPH_C32(0xf28bf35d) }, + { SPH_C32(0x049e0000), SPH_C32(0xc5de0000), SPH_C32(0x619c1d00), + SPH_C32(0x890a0000), SPH_C32(0x36a148a1), SPH_C32(0x922842a3), + SPH_C32(0x034223d5), SPH_C32(0x548dd7b6), SPH_C32(0x55f50000), + SPH_C32(0xe50d0000), SPH_C32(0x8af31a80), SPH_C32(0x06150000), + SPH_C32(0x76123111), SPH_C32(0x29afe52e), SPH_C32(0xe8a4c5b1), + SPH_C32(0x7cec44a7) }, + { SPH_C32(0x49140000), SPH_C32(0x8cea0000), SPH_C32(0x5d171800), + SPH_C32(0x27a90000), SPH_C32(0x20d8735c), SPH_C32(0x5d474a07), + SPH_C32(0x8c5bc939), SPH_C32(0x10b0e7b2), SPH_C32(0x99e10000), + SPH_C32(0x406e0000), SPH_C32(0xd04a1d00), SPH_C32(0x3d450000), + SPH_C32(0x3dc222ee), SPH_C32(0xae34d136), SPH_C32(0x81e78d70), + SPH_C32(0xb6b6c359) }, + { SPH_C32(0x85000000), SPH_C32(0x29890000), SPH_C32(0x07ae1f80), + SPH_C32(0x1cf90000), SPH_C32(0x6b0860a3), SPH_C32(0xdadc7e1f), + SPH_C32(0xe51881f8), SPH_C32(0xdaea604c), SPH_C32(0x187f0000), + SPH_C32(0xac390000), SPH_C32(0xb6781f80), SPH_C32(0xa8b60000), + SPH_C32(0x606b0aec), SPH_C32(0xe6c0ed8a), SPH_C32(0x67bd2f5d), + SPH_C32(0x38d174a3) }, + { SPH_C32(0xaec30000), SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), + SPH_C32(0x2c150000), SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), + SPH_C32(0xab92f78f), SPH_C32(0xa312567b), SPH_C32(0xdb250000), + SPH_C32(0x09290000), SPH_C32(0x49aac000), SPH_C32(0x81e10000), + SPH_C32(0xcafe6b59), SPH_C32(0x42793431), SPH_C32(0x43566b76), + SPH_C32(0xe86cba2e) }, + { SPH_C32(0x62d70000), SPH_C32(0x392c0001), SPH_C32(0x2368e780), + SPH_C32(0x17450000), SPH_C32(0x0e1c664c), SPH_C32(0xe1cb832e), + SPH_C32(0xc2d1bf4e), SPH_C32(0x6948d185), SPH_C32(0x5abb0000), + SPH_C32(0xe57e0000), SPH_C32(0x2f98c280), SPH_C32(0x14120000), + SPH_C32(0x9757435b), SPH_C32(0x0a8d088d), SPH_C32(0xa50cc95b), + SPH_C32(0x660b0dd4) }, + { SPH_C32(0x2f5d0000), SPH_C32(0x70180001), SPH_C32(0x1fe3e280), + SPH_C32(0xb9e60000), SPH_C32(0x18655db1), SPH_C32(0x2ea48b8a), + SPH_C32(0x4dc855a2), SPH_C32(0x2d75e181), SPH_C32(0x96af0000), + SPH_C32(0x401d0000), SPH_C32(0x7521c500), SPH_C32(0x2f420000), + SPH_C32(0xdc8750a4), SPH_C32(0x8d163c95), SPH_C32(0xcc4f819a), + SPH_C32(0xac518a2a) }, + { SPH_C32(0xe3490000), SPH_C32(0xd57b0001), SPH_C32(0x455ae500), + SPH_C32(0x82b60000), SPH_C32(0x53b54e4e), SPH_C32(0xa93fbf92), + SPH_C32(0x248b1d63), SPH_C32(0xe72f667f), SPH_C32(0x17310000), + SPH_C32(0xac4a0000), SPH_C32(0x1313c780), SPH_C32(0xbab10000), + SPH_C32(0x812e78a6), SPH_C32(0xc5e20029), SPH_C32(0x2a1523b7), + SPH_C32(0x22363dd0) }, + { SPH_C32(0xd6e00000), SPH_C32(0x8eb30001), SPH_C32(0xd0ebeb80), + SPH_C32(0xbcb00000), SPH_C32(0x34f25dca), SPH_C32(0x18b93e12), + SPH_C32(0x5b1e57ed), SPH_C32(0xc07dddd0), SPH_C32(0xd98a0000), + SPH_C32(0xbe010000), SPH_C32(0xf3b6c300), SPH_C32(0xd7790000), + SPH_C32(0x70732e8a), SPH_C32(0xc231f256), SPH_C32(0xea0a7fec), + SPH_C32(0x1c9a5055) }, + { SPH_C32(0x1af40000), SPH_C32(0x2bd00001), SPH_C32(0x8a52ec00), + SPH_C32(0x87e00000), SPH_C32(0x7f224e35), SPH_C32(0x9f220a0a), + SPH_C32(0x325d1f2c), SPH_C32(0x0a275a2e), SPH_C32(0x58140000), + SPH_C32(0x52560000), SPH_C32(0x9584c180), SPH_C32(0x428a0000), + SPH_C32(0x2dda0688), SPH_C32(0x8ac5ceea), SPH_C32(0x0c50ddc1), + SPH_C32(0x92fde7af) }, + { SPH_C32(0x577e0000), SPH_C32(0x62e40001), SPH_C32(0xb6d9e900), + SPH_C32(0x29430000), SPH_C32(0x695b75c8), SPH_C32(0x504d02ae), + SPH_C32(0xbd44f5c0), SPH_C32(0x4e1a6a2a), SPH_C32(0x94000000), + SPH_C32(0xf7350000), SPH_C32(0xcf3dc600), SPH_C32(0x79da0000), + SPH_C32(0x660a1577), SPH_C32(0x0d5efaf2), SPH_C32(0x65139500), + SPH_C32(0x58a76051) }, + { SPH_C32(0x9b6a0000), SPH_C32(0xc7870001), SPH_C32(0xec60ee80), + SPH_C32(0x12130000), SPH_C32(0x228b6637), SPH_C32(0xd7d636b6), + SPH_C32(0xd407bd01), SPH_C32(0x8440edd4), SPH_C32(0x159e0000), + SPH_C32(0x1b620000), SPH_C32(0xa90fc480), SPH_C32(0xec290000), + SPH_C32(0x3ba33d75), SPH_C32(0x45aac64e), SPH_C32(0x8349372d), + SPH_C32(0xd6c0d7ab) }, + { SPH_C32(0xac6c0000), SPH_C32(0x2b670001), SPH_C32(0xc3cde300), + SPH_C32(0x7a8d0000), SPH_C32(0xff413060), SPH_C32(0xe6187151), + SPH_C32(0x02cee315), SPH_C32(0x57e4bc00), SPH_C32(0xa1a90000), + SPH_C32(0xacfd0000), SPH_C32(0x5a8cc880), SPH_C32(0x47dc0000), + SPH_C32(0x014d06f3), SPH_C32(0xbcd87b72), SPH_C32(0x1a86df8e), + SPH_C32(0x7ff5dbfe) }, + { SPH_C32(0x60780000), SPH_C32(0x8e040001), SPH_C32(0x9974e480), + SPH_C32(0x41dd0000), SPH_C32(0xb491239f), SPH_C32(0x61834549), + SPH_C32(0x6b8dabd4), SPH_C32(0x9dbe3bfe), SPH_C32(0x20370000), + SPH_C32(0x40aa0000), SPH_C32(0x3cbeca00), SPH_C32(0xd22f0000), + SPH_C32(0x5ce42ef1), SPH_C32(0xf42c47ce), SPH_C32(0xfcdc7da3), + SPH_C32(0xf1926c04) }, + { SPH_C32(0x2df20000), SPH_C32(0xc7300001), SPH_C32(0xa5ffe180), + SPH_C32(0xef7e0000), SPH_C32(0xa2e81862), SPH_C32(0xaeec4ded), + SPH_C32(0xe4944138), SPH_C32(0xd9830bfa), SPH_C32(0xec230000), + SPH_C32(0xe5c90000), SPH_C32(0x6607cd80), SPH_C32(0xe97f0000), + SPH_C32(0x17343d0e), SPH_C32(0x73b773d6), SPH_C32(0x959f3562), + SPH_C32(0x3bc8ebfa) }, + { SPH_C32(0xe1e60000), SPH_C32(0x62530001), SPH_C32(0xff46e600), + SPH_C32(0xd42e0000), SPH_C32(0xe9380b9d), SPH_C32(0x297779f5), + SPH_C32(0x8dd709f9), SPH_C32(0x13d98c04), SPH_C32(0x6dbd0000), + SPH_C32(0x099e0000), SPH_C32(0x0035cf00), SPH_C32(0x7c8c0000), + SPH_C32(0x4a9d150c), SPH_C32(0x3b434f6a), SPH_C32(0x73c5974f), + SPH_C32(0xb5af5c00) }, + { SPH_C32(0xd44f0000), SPH_C32(0x399b0001), SPH_C32(0x6af7e880), + SPH_C32(0xea280000), SPH_C32(0x8e7f1819), SPH_C32(0x98f1f875), + SPH_C32(0xf2424377), SPH_C32(0x348b37ab), SPH_C32(0xa3060000), + SPH_C32(0x1bd50000), SPH_C32(0xe090cb80), SPH_C32(0x11440000), + SPH_C32(0xbbc04320), SPH_C32(0x3c90bd15), SPH_C32(0xb3dacb14), + SPH_C32(0x8b033185) }, + { SPH_C32(0x185b0000), SPH_C32(0x9cf80001), SPH_C32(0x304eef00), + SPH_C32(0xd1780000), SPH_C32(0xc5af0be6), SPH_C32(0x1f6acc6d), + SPH_C32(0x9b010bb6), SPH_C32(0xfed1b055), SPH_C32(0x22980000), + SPH_C32(0xf7820000), SPH_C32(0x86a2c900), SPH_C32(0x84b70000), + SPH_C32(0xe6696b22), SPH_C32(0x746481a9), SPH_C32(0x55806939), + SPH_C32(0x0564867f) }, + { SPH_C32(0x55d10000), SPH_C32(0xd5cc0001), SPH_C32(0x0cc5ea00), + SPH_C32(0x7fdb0000), SPH_C32(0xd3d6301b), SPH_C32(0xd005c4c9), + SPH_C32(0x1418e15a), SPH_C32(0xbaec8051), SPH_C32(0xee8c0000), + SPH_C32(0x52e10000), SPH_C32(0xdc1bce80), SPH_C32(0xbfe70000), + SPH_C32(0xadb978dd), SPH_C32(0xf3ffb5b1), SPH_C32(0x3cc321f8), + SPH_C32(0xcf3e0181) }, + { SPH_C32(0x99c50000), SPH_C32(0x70af0001), SPH_C32(0x567ced80), + SPH_C32(0x448b0000), SPH_C32(0x980623e4), SPH_C32(0x579ef0d1), + SPH_C32(0x7d5ba99b), SPH_C32(0x70b607af), SPH_C32(0x6f120000), + SPH_C32(0xbeb60000), SPH_C32(0xba29cc00), SPH_C32(0x2a140000), + SPH_C32(0xf01050df), SPH_C32(0xbb0b890d), SPH_C32(0xda9983d5), + SPH_C32(0x4159b67b) }, + { SPH_C32(0x028b0000), SPH_C32(0x87e90001), SPH_C32(0x3c2af380), + SPH_C32(0x2f560000), SPH_C32(0x1f4944d9), SPH_C32(0x79e2e780), + SPH_C32(0x55e03071), SPH_C32(0x32f62e8d), SPH_C32(0xc56b0000), + SPH_C32(0xd7e60000), SPH_C32(0x2452c180), SPH_C32(0xf6c50000), + SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), SPH_C32(0x8ef57364), + SPH_C32(0x70c6f340) }, + { SPH_C32(0xce9f0000), SPH_C32(0x228a0001), SPH_C32(0x6693f400), + SPH_C32(0x14060000), SPH_C32(0x54995726), SPH_C32(0xfe79d398), + SPH_C32(0x3ca378b0), SPH_C32(0xf8aca973), SPH_C32(0x44f50000), + SPH_C32(0x3bb10000), SPH_C32(0x4260c300), SPH_C32(0x63360000), + SPH_C32(0x7b1044c5), SPH_C32(0xfe2d61c3), SPH_C32(0x68afd149), + SPH_C32(0xfea144ba) }, + { SPH_C32(0x83150000), SPH_C32(0x6bbe0001), SPH_C32(0x5a18f100), + SPH_C32(0xbaa50000), SPH_C32(0x42e06cdb), SPH_C32(0x3116db3c), + SPH_C32(0xb3ba925c), SPH_C32(0xbc919977), SPH_C32(0x88e10000), + SPH_C32(0x9ed20000), SPH_C32(0x18d9c480), SPH_C32(0x58660000), + SPH_C32(0x30c0573a), SPH_C32(0x79b655db), SPH_C32(0x01ec9988), + SPH_C32(0x34fbc344) }, + { SPH_C32(0x4f010000), SPH_C32(0xcedd0001), SPH_C32(0x00a1f680), + SPH_C32(0x81f50000), SPH_C32(0x09307f24), SPH_C32(0xb68def24), + SPH_C32(0xdaf9da9d), SPH_C32(0x76cb1e89), SPH_C32(0x097f0000), + SPH_C32(0x72850000), SPH_C32(0x7eebc600), SPH_C32(0xcd950000), + SPH_C32(0x6d697f38), SPH_C32(0x31426967), SPH_C32(0xe7b63ba5), + SPH_C32(0xba9c74be) }, + { SPH_C32(0x7aa80000), SPH_C32(0x95150001), SPH_C32(0x9510f800), + SPH_C32(0xbff30000), SPH_C32(0x6e776ca0), SPH_C32(0x070b6ea4), + SPH_C32(0xa56c9013), SPH_C32(0x5199a526), SPH_C32(0xc7c40000), + SPH_C32(0x60ce0000), SPH_C32(0x9e4ec280), SPH_C32(0xa05d0000), + SPH_C32(0x9c342914), SPH_C32(0x36919b18), SPH_C32(0x27a967fe), + SPH_C32(0x8430193b) }, + { SPH_C32(0xb6bc0000), SPH_C32(0x30760001), SPH_C32(0xcfa9ff80), + SPH_C32(0x84a30000), SPH_C32(0x25a77f5f), SPH_C32(0x80905abc), + SPH_C32(0xcc2fd8d2), SPH_C32(0x9bc322d8), SPH_C32(0x465a0000), + SPH_C32(0x8c990000), SPH_C32(0xf87cc000), SPH_C32(0x35ae0000), + SPH_C32(0xc19d0116), SPH_C32(0x7e65a7a4), SPH_C32(0xc1f3c5d3), + SPH_C32(0x0a57aec1) }, + { SPH_C32(0xfb360000), SPH_C32(0x79420001), SPH_C32(0xf322fa80), + SPH_C32(0x2a000000), SPH_C32(0x33de44a2), SPH_C32(0x4fff5218), + SPH_C32(0x4336323e), SPH_C32(0xdffe12dc), SPH_C32(0x8a4e0000), + SPH_C32(0x29fa0000), SPH_C32(0xa2c5c780), SPH_C32(0x0efe0000), + SPH_C32(0x8a4d12e9), SPH_C32(0xf9fe93bc), SPH_C32(0xa8b08d12), + SPH_C32(0xc00d293f) }, + { SPH_C32(0x37220000), SPH_C32(0xdc210001), SPH_C32(0xa99bfd00), + SPH_C32(0x11500000), SPH_C32(0x780e575d), SPH_C32(0xc8646600), + SPH_C32(0x2a757aff), SPH_C32(0x15a49522), SPH_C32(0x0bd00000), + SPH_C32(0xc5ad0000), SPH_C32(0xc4f7c500), SPH_C32(0x9b0d0000), + SPH_C32(0xd7e43aeb), SPH_C32(0xb10aaf00), SPH_C32(0x4eea2f3f), + SPH_C32(0x4e6a9ec5) }, + { SPH_C32(0x00240000), SPH_C32(0x30c10001), SPH_C32(0x8636f080), + SPH_C32(0x79ce0000), SPH_C32(0xa5c4010a), SPH_C32(0xf9aa21e7), + SPH_C32(0xfcbc24eb), SPH_C32(0xc600c4f6), SPH_C32(0xbfe70000), + SPH_C32(0x72320000), SPH_C32(0x3774c900), SPH_C32(0x30f80000), + SPH_C32(0xed0a016d), SPH_C32(0x4878123c), SPH_C32(0xd725c79c), + SPH_C32(0xe75f9290) }, + { SPH_C32(0xcc300000), SPH_C32(0x95a20001), SPH_C32(0xdc8ff700), + SPH_C32(0x429e0000), SPH_C32(0xee1412f5), SPH_C32(0x7e3115ff), + SPH_C32(0x95ff6c2a), SPH_C32(0x0c5a4308), SPH_C32(0x3e790000), + SPH_C32(0x9e650000), SPH_C32(0x5146cb80), SPH_C32(0xa50b0000), + SPH_C32(0xb0a3296f), SPH_C32(0x008c2e80), SPH_C32(0x317f65b1), + SPH_C32(0x6938256a) }, + { SPH_C32(0x81ba0000), SPH_C32(0xdc960001), SPH_C32(0xe004f200), + SPH_C32(0xec3d0000), SPH_C32(0xf86d2908), SPH_C32(0xb15e1d5b), + SPH_C32(0x1ae686c6), SPH_C32(0x4867730c), SPH_C32(0xf26d0000), + SPH_C32(0x3b060000), SPH_C32(0x0bffcc00), SPH_C32(0x9e5b0000), + SPH_C32(0xfb733a90), SPH_C32(0x87171a98), SPH_C32(0x583c2d70), + SPH_C32(0xa362a294) }, + { SPH_C32(0x4dae0000), SPH_C32(0x79f50001), SPH_C32(0xbabdf580), + SPH_C32(0xd76d0000), SPH_C32(0xb3bd3af7), SPH_C32(0x36c52943), + SPH_C32(0x73a5ce07), SPH_C32(0x823df4f2), SPH_C32(0x73f30000), + SPH_C32(0xd7510000), SPH_C32(0x6dcdce80), SPH_C32(0x0ba80000), + SPH_C32(0xa6da1292), SPH_C32(0xcfe32624), SPH_C32(0xbe668f5d), + SPH_C32(0x2d05156e) }, + { SPH_C32(0x78070000), SPH_C32(0x223d0001), SPH_C32(0x2f0cfb00), + SPH_C32(0xe96b0000), SPH_C32(0xd4fa2973), SPH_C32(0x8743a8c3), + SPH_C32(0x0c308489), SPH_C32(0xa56f4f5d), SPH_C32(0xbd480000), + SPH_C32(0xc51a0000), SPH_C32(0x8d68ca00), SPH_C32(0x66600000), + SPH_C32(0x578744be), SPH_C32(0xc830d45b), SPH_C32(0x7e79d306), + SPH_C32(0x13a978eb) }, + { SPH_C32(0xb4130000), SPH_C32(0x875e0001), SPH_C32(0x75b5fc80), + SPH_C32(0xd23b0000), SPH_C32(0x9f2a3a8c), SPH_C32(0x00d89cdb), + SPH_C32(0x6573cc48), SPH_C32(0x6f35c8a3), SPH_C32(0x3cd60000), + SPH_C32(0x294d0000), SPH_C32(0xeb5ac880), SPH_C32(0xf3930000), + SPH_C32(0x0a2e6cbc), SPH_C32(0x80c4e8e7), SPH_C32(0x9823712b), + SPH_C32(0x9dcecf11) }, + { SPH_C32(0xf9990000), SPH_C32(0xce6a0001), SPH_C32(0x493ef980), + SPH_C32(0x7c980000), SPH_C32(0x89530171), SPH_C32(0xcfb7947f), + SPH_C32(0xea6a26a4), SPH_C32(0x2b08f8a7), SPH_C32(0xf0c20000), + SPH_C32(0x8c2e0000), SPH_C32(0xb1e3cf00), SPH_C32(0xc8c30000), + SPH_C32(0x41fe7f43), SPH_C32(0x075fdcff), SPH_C32(0xf16039ea), + SPH_C32(0x579448ef) }, + { SPH_C32(0x358d0000), SPH_C32(0x6b090001), SPH_C32(0x1387fe00), + SPH_C32(0x47c80000), SPH_C32(0xc283128e), SPH_C32(0x482ca067), + SPH_C32(0x83296e65), SPH_C32(0xe1527f59), SPH_C32(0x715c0000), + SPH_C32(0x60790000), SPH_C32(0xd7d1cd80), SPH_C32(0x5d300000), + SPH_C32(0x1c575741), SPH_C32(0x4fabe043), SPH_C32(0x173a9bc7), + SPH_C32(0xd9f3ff15) }, + { SPH_C32(0xb08d0000), SPH_C32(0x42800001), SPH_C32(0x1429e180), + SPH_C32(0x5b310000), SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), + SPH_C32(0x6631ef9d), SPH_C32(0x3bb81f15), SPH_C32(0x69230000), + SPH_C32(0xcc400000), SPH_C32(0x61a9d200), SPH_C32(0xf5860000), + SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), SPH_C32(0x7087b49a), + SPH_C32(0xe1228bb6) }, + { SPH_C32(0x7c990000), SPH_C32(0xe7e30001), SPH_C32(0x4e90e600), + SPH_C32(0x60610000), SPH_C32(0xe25b61d2), SPH_C32(0x156bea60), + SPH_C32(0x0f72a75c), SPH_C32(0xf1e298eb), SPH_C32(0xe8bd0000), + SPH_C32(0x20170000), SPH_C32(0x079bd080), SPH_C32(0x60750000), + SPH_C32(0x219575af), SPH_C32(0xe19f3175), SPH_C32(0x96dd16b7), + SPH_C32(0x6f453c4c) }, + { SPH_C32(0x31130000), SPH_C32(0xaed70001), SPH_C32(0x721be300), + SPH_C32(0xcec20000), SPH_C32(0xf4225a2f), SPH_C32(0xda04e2c4), + SPH_C32(0x806b4db0), SPH_C32(0xb5dfa8ef), SPH_C32(0x24a90000), + SPH_C32(0x85740000), SPH_C32(0x5d22d700), SPH_C32(0x5b250000), + SPH_C32(0x6a456650), SPH_C32(0x6604056d), SPH_C32(0xff9e5e76), + SPH_C32(0xa51fbbb2) }, + { SPH_C32(0xfd070000), SPH_C32(0x0bb40001), SPH_C32(0x28a2e480), + SPH_C32(0xf5920000), SPH_C32(0xbff249d0), SPH_C32(0x5d9fd6dc), + SPH_C32(0xe9280571), SPH_C32(0x7f852f11), SPH_C32(0xa5370000), + SPH_C32(0x69230000), SPH_C32(0x3b10d580), SPH_C32(0xced60000), + SPH_C32(0x37ec4e52), SPH_C32(0x2ef039d1), SPH_C32(0x19c4fc5b), + SPH_C32(0x2b780c48) }, + { SPH_C32(0xc8ae0000), SPH_C32(0x507c0001), SPH_C32(0xbd13ea00), + SPH_C32(0xcb940000), SPH_C32(0xd8b55a54), SPH_C32(0xec19575c), + SPH_C32(0x96bd4fff), SPH_C32(0x58d794be), SPH_C32(0x6b8c0000), + SPH_C32(0x7b680000), SPH_C32(0xdbb5d100), SPH_C32(0xa31e0000), + SPH_C32(0xc6b1187e), SPH_C32(0x2923cbae), SPH_C32(0xd9dba000), + SPH_C32(0x15d461cd) }, + { SPH_C32(0x04ba0000), SPH_C32(0xf51f0001), SPH_C32(0xe7aaed80), + SPH_C32(0xf0c40000), SPH_C32(0x936549ab), SPH_C32(0x6b826344), + SPH_C32(0xfffe073e), SPH_C32(0x928d1340), SPH_C32(0xea120000), + SPH_C32(0x973f0000), SPH_C32(0xbd87d380), SPH_C32(0x36ed0000), + SPH_C32(0x9b18307c), SPH_C32(0x61d7f712), SPH_C32(0x3f81022d), + SPH_C32(0x9bb3d637) }, + { SPH_C32(0x49300000), SPH_C32(0xbc2b0001), SPH_C32(0xdb21e880), + SPH_C32(0x5e670000), SPH_C32(0x851c7256), SPH_C32(0xa4ed6be0), + SPH_C32(0x70e7edd2), SPH_C32(0xd6b02344), SPH_C32(0x26060000), + SPH_C32(0x325c0000), SPH_C32(0xe73ed400), SPH_C32(0x0dbd0000), + SPH_C32(0xd0c82383), SPH_C32(0xe64cc30a), SPH_C32(0x56c24aec), + SPH_C32(0x51e951c9) }, + { SPH_C32(0x85240000), SPH_C32(0x19480001), SPH_C32(0x8198ef00), + SPH_C32(0x65370000), SPH_C32(0xcecc61a9), SPH_C32(0x23765ff8), + SPH_C32(0x19a4a513), SPH_C32(0x1ceaa4ba), SPH_C32(0xa7980000), + SPH_C32(0xde0b0000), SPH_C32(0x810cd680), SPH_C32(0x984e0000), + SPH_C32(0x8d610b81), SPH_C32(0xaeb8ffb6), SPH_C32(0xb098e8c1), + SPH_C32(0xdf8ee633) }, + { SPH_C32(0xb2220000), SPH_C32(0xf5a80001), SPH_C32(0xae35e280), + SPH_C32(0x0da90000), SPH_C32(0x130637fe), SPH_C32(0x12b8181f), + SPH_C32(0xcf6dfb07), SPH_C32(0xcf4ef56e), SPH_C32(0x13af0000), + SPH_C32(0x69940000), SPH_C32(0x728fda80), SPH_C32(0x33bb0000), + SPH_C32(0xb78f3007), SPH_C32(0x57ca428a), SPH_C32(0x29570062), + SPH_C32(0x76bbea66) }, + { SPH_C32(0x7e360000), SPH_C32(0x50cb0001), SPH_C32(0xf48ce500), + SPH_C32(0x36f90000), SPH_C32(0x58d62401), SPH_C32(0x95232c07), + SPH_C32(0xa62eb3c6), SPH_C32(0x05147290), SPH_C32(0x92310000), + SPH_C32(0x85c30000), SPH_C32(0x14bdd800), SPH_C32(0xa6480000), + SPH_C32(0xea261805), SPH_C32(0x1f3e7e36), SPH_C32(0xcf0da24f), + SPH_C32(0xf8dc5d9c) }, + { SPH_C32(0x33bc0000), SPH_C32(0x19ff0001), SPH_C32(0xc807e000), + SPH_C32(0x985a0000), SPH_C32(0x4eaf1ffc), SPH_C32(0x5a4c24a3), + SPH_C32(0x2937592a), SPH_C32(0x41294294), SPH_C32(0x5e250000), + SPH_C32(0x20a00000), SPH_C32(0x4e04df80), SPH_C32(0x9d180000), + SPH_C32(0xa1f60bfa), SPH_C32(0x98a54a2e), SPH_C32(0xa64eea8e), + SPH_C32(0x3286da62) }, + { SPH_C32(0xffa80000), SPH_C32(0xbc9c0001), SPH_C32(0x92bee780), + SPH_C32(0xa30a0000), SPH_C32(0x057f0c03), SPH_C32(0xddd710bb), + SPH_C32(0x407411eb), SPH_C32(0x8b73c56a), SPH_C32(0xdfbb0000), + SPH_C32(0xccf70000), SPH_C32(0x2836dd00), SPH_C32(0x08eb0000), + SPH_C32(0xfc5f23f8), SPH_C32(0xd0517692), SPH_C32(0x401448a3), + SPH_C32(0xbce16d98) }, + { SPH_C32(0xca010000), SPH_C32(0xe7540001), SPH_C32(0x070fe900), + SPH_C32(0x9d0c0000), SPH_C32(0x62381f87), SPH_C32(0x6c51913b), + SPH_C32(0x3fe15b65), SPH_C32(0xac217ec5), SPH_C32(0x11000000), + SPH_C32(0xdebc0000), SPH_C32(0xc893d980), SPH_C32(0x65230000), + SPH_C32(0x0d0275d4), SPH_C32(0xd78284ed), SPH_C32(0x800b14f8), + SPH_C32(0x824d001d) }, + { SPH_C32(0x06150000), SPH_C32(0x42370001), SPH_C32(0x5db6ee80), + SPH_C32(0xa65c0000), SPH_C32(0x29e80c78), SPH_C32(0xebcaa523), + SPH_C32(0x56a213a4), SPH_C32(0x667bf93b), SPH_C32(0x909e0000), + SPH_C32(0x32eb0000), SPH_C32(0xaea1db00), SPH_C32(0xf0d00000), + SPH_C32(0x50ab5dd6), SPH_C32(0x9f76b851), SPH_C32(0x6651b6d5), + SPH_C32(0x0c2ab7e7) }, + { SPH_C32(0x4b9f0000), SPH_C32(0x0b030001), SPH_C32(0x613deb80), + SPH_C32(0x08ff0000), SPH_C32(0x3f913785), SPH_C32(0x24a5ad87), + SPH_C32(0xd9bbf948), SPH_C32(0x2246c93f), SPH_C32(0x5c8a0000), + SPH_C32(0x97880000), SPH_C32(0xf418dc80), SPH_C32(0xcb800000), + SPH_C32(0x1b7b4e29), SPH_C32(0x18ed8c49), SPH_C32(0x0f12fe14), + SPH_C32(0xc6703019) }, + { SPH_C32(0x878b0000), SPH_C32(0xae600001), SPH_C32(0x3b84ec00), + SPH_C32(0x33af0000), SPH_C32(0x7441247a), SPH_C32(0xa33e999f), + SPH_C32(0xb0f8b189), SPH_C32(0xe81c4ec1), SPH_C32(0xdd140000), + SPH_C32(0x7bdf0000), SPH_C32(0x922ade00), SPH_C32(0x5e730000), + SPH_C32(0x46d2662b), SPH_C32(0x5019b0f5), SPH_C32(0xe9485c39), + SPH_C32(0x481787e3) }, + { SPH_C32(0x1cc50000), SPH_C32(0x59260001), SPH_C32(0x51d2f200), + SPH_C32(0x58720000), SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), + SPH_C32(0x98432863), SPH_C32(0xaa5c67e3), SPH_C32(0x776d0000), + SPH_C32(0x128f0000), SPH_C32(0x0c51d380), SPH_C32(0x82a20000), + SPH_C32(0x907b5a33), SPH_C32(0x5dcb6487), SPH_C32(0xbd24ac88), + SPH_C32(0x7988c2d8) }, + { SPH_C32(0xd0d10000), SPH_C32(0xfc450001), SPH_C32(0x0b6bf580), + SPH_C32(0x63220000), SPH_C32(0xb8de50b8), SPH_C32(0x0ad9bad6), + SPH_C32(0xf10060a2), SPH_C32(0x6006e01d), SPH_C32(0xf6f30000), + SPH_C32(0xfed80000), SPH_C32(0x6a63d100), SPH_C32(0x17510000), + SPH_C32(0xcdd27231), SPH_C32(0x153f583b), SPH_C32(0x5b7e0ea5), + SPH_C32(0xf7ef7522) }, + { SPH_C32(0x9d5b0000), SPH_C32(0xb5710001), SPH_C32(0x37e0f080), + SPH_C32(0xcd810000), SPH_C32(0xaea76b45), SPH_C32(0xc5b6b272), + SPH_C32(0x7e198a4e), SPH_C32(0x243bd019), SPH_C32(0x3ae70000), + SPH_C32(0x5bbb0000), SPH_C32(0x30dad680), SPH_C32(0x2c010000), + SPH_C32(0x860261ce), SPH_C32(0x92a46c23), SPH_C32(0x323d4664), + SPH_C32(0x3db5f2dc) }, + { SPH_C32(0x514f0000), SPH_C32(0x10120001), SPH_C32(0x6d59f700), + SPH_C32(0xf6d10000), SPH_C32(0xe57778ba), SPH_C32(0x422d866a), + SPH_C32(0x175ac28f), SPH_C32(0xee6157e7), SPH_C32(0xbb790000), + SPH_C32(0xb7ec0000), SPH_C32(0x56e8d400), SPH_C32(0xb9f20000), + SPH_C32(0xdbab49cc), SPH_C32(0xda50509f), SPH_C32(0xd467e449), + SPH_C32(0xb3d24526) }, + { SPH_C32(0x64e60000), SPH_C32(0x4bda0001), SPH_C32(0xf8e8f980), + SPH_C32(0xc8d70000), SPH_C32(0x82306b3e), SPH_C32(0xf3ab07ea), + SPH_C32(0x68cf8801), SPH_C32(0xc933ec48), SPH_C32(0x75c20000), + SPH_C32(0xa5a70000), SPH_C32(0xb64dd080), SPH_C32(0xd43a0000), + SPH_C32(0x2af61fe0), SPH_C32(0xdd83a2e0), SPH_C32(0x1478b812), + SPH_C32(0x8d7e28a3) }, + { SPH_C32(0xa8f20000), SPH_C32(0xeeb90001), SPH_C32(0xa251fe00), + SPH_C32(0xf3870000), SPH_C32(0xc9e078c1), SPH_C32(0x743033f2), + SPH_C32(0x018cc0c0), SPH_C32(0x03696bb6), SPH_C32(0xf45c0000), + SPH_C32(0x49f00000), SPH_C32(0xd07fd200), SPH_C32(0x41c90000), + SPH_C32(0x775f37e2), SPH_C32(0x95779e5c), SPH_C32(0xf2221a3f), + SPH_C32(0x03199f59) }, + { SPH_C32(0xe5780000), SPH_C32(0xa78d0001), SPH_C32(0x9edafb00), + SPH_C32(0x5d240000), SPH_C32(0xdf99433c), SPH_C32(0xbb5f3b56), + SPH_C32(0x8e952a2c), SPH_C32(0x47545bb2), SPH_C32(0x38480000), + SPH_C32(0xec930000), SPH_C32(0x8ac6d580), SPH_C32(0x7a990000), + SPH_C32(0x3c8f241d), SPH_C32(0x12ecaa44), SPH_C32(0x9b6152fe), + SPH_C32(0xc94318a7) }, + { SPH_C32(0x296c0000), SPH_C32(0x02ee0001), SPH_C32(0xc463fc80), + SPH_C32(0x66740000), SPH_C32(0x944950c3), SPH_C32(0x3cc40f4e), + SPH_C32(0xe7d662ed), SPH_C32(0x8d0edc4c), SPH_C32(0xb9d60000), + SPH_C32(0x00c40000), SPH_C32(0xecf4d700), SPH_C32(0xef6a0000), + SPH_C32(0x61260c1f), SPH_C32(0x5a1896f8), SPH_C32(0x7d3bf0d3), + SPH_C32(0x4724af5d) }, + { SPH_C32(0x1e6a0000), SPH_C32(0xee0e0001), SPH_C32(0xebcef100), + SPH_C32(0x0eea0000), SPH_C32(0x49830694), SPH_C32(0x0d0a48a9), + SPH_C32(0x311f3cf9), SPH_C32(0x5eaa8d98), SPH_C32(0x0de10000), + SPH_C32(0xb75b0000), SPH_C32(0x1f77db00), SPH_C32(0x449f0000), + SPH_C32(0x5bc83799), SPH_C32(0xa36a2bc4), SPH_C32(0xe4f41870), + SPH_C32(0xee11a308) }, + { SPH_C32(0xd27e0000), SPH_C32(0x4b6d0001), SPH_C32(0xb177f680), + SPH_C32(0x35ba0000), SPH_C32(0x0253156b), SPH_C32(0x8a917cb1), + SPH_C32(0x585c7438), SPH_C32(0x94f00a66), SPH_C32(0x8c7f0000), + SPH_C32(0x5b0c0000), SPH_C32(0x7945d980), SPH_C32(0xd16c0000), + SPH_C32(0x06611f9b), SPH_C32(0xeb9e1778), SPH_C32(0x02aeba5d), + SPH_C32(0x607614f2) }, + { SPH_C32(0x9ff40000), SPH_C32(0x02590001), SPH_C32(0x8dfcf380), + SPH_C32(0x9b190000), SPH_C32(0x142a2e96), SPH_C32(0x45fe7415), + SPH_C32(0xd7459ed4), SPH_C32(0xd0cd3a62), SPH_C32(0x406b0000), + SPH_C32(0xfe6f0000), SPH_C32(0x23fcde00), SPH_C32(0xea3c0000), + SPH_C32(0x4db10c64), SPH_C32(0x6c052360), SPH_C32(0x6bedf29c), + SPH_C32(0xaa2c930c) }, + { SPH_C32(0x53e00000), SPH_C32(0xa73a0001), SPH_C32(0xd745f400), + SPH_C32(0xa0490000), SPH_C32(0x5ffa3d69), SPH_C32(0xc265400d), + SPH_C32(0xbe06d615), SPH_C32(0x1a97bd9c), SPH_C32(0xc1f50000), + SPH_C32(0x12380000), SPH_C32(0x45cedc80), SPH_C32(0x7fcf0000), + SPH_C32(0x10182466), SPH_C32(0x24f11fdc), SPH_C32(0x8db750b1), + SPH_C32(0x244b24f6) }, + { SPH_C32(0x66490000), SPH_C32(0xfcf20001), SPH_C32(0x42f4fa80), + SPH_C32(0x9e4f0000), SPH_C32(0x38bd2eed), SPH_C32(0x73e3c18d), + SPH_C32(0xc1939c9b), SPH_C32(0x3dc50633), SPH_C32(0x0f4e0000), + SPH_C32(0x00730000), SPH_C32(0xa56bd800), SPH_C32(0x12070000), + SPH_C32(0xe145724a), SPH_C32(0x2322eda3), SPH_C32(0x4da80cea), + SPH_C32(0x1ae74973) }, + { SPH_C32(0xaa5d0000), SPH_C32(0x59910001), SPH_C32(0x184dfd00), + SPH_C32(0xa51f0000), SPH_C32(0x736d3d12), SPH_C32(0xf478f595), + SPH_C32(0xa8d0d45a), SPH_C32(0xf79f81cd), SPH_C32(0x8ed00000), + SPH_C32(0xec240000), SPH_C32(0xc359da80), SPH_C32(0x87f40000), + SPH_C32(0xbcec5a48), SPH_C32(0x6bd6d11f), SPH_C32(0xabf2aec7), + SPH_C32(0x9480fe89) }, + { SPH_C32(0xe7d70000), SPH_C32(0x10a50001), SPH_C32(0x24c6f800), + SPH_C32(0x0bbc0000), SPH_C32(0x651406ef), SPH_C32(0x3b17fd31), + SPH_C32(0x27c93eb6), SPH_C32(0xb3a2b1c9), SPH_C32(0x42c40000), + SPH_C32(0x49470000), SPH_C32(0x99e0dd00), SPH_C32(0xbca40000), + SPH_C32(0xf73c49b7), SPH_C32(0xec4de507), SPH_C32(0xc2b1e606), + SPH_C32(0x5eda7977) }, + { SPH_C32(0x2bc30000), SPH_C32(0xb5c60001), SPH_C32(0x7e7fff80), + SPH_C32(0x30ec0000), SPH_C32(0x2ec41510), SPH_C32(0xbc8cc929), + SPH_C32(0x4e8a7677), SPH_C32(0x79f83637), SPH_C32(0xc35a0000), + SPH_C32(0xa5100000), SPH_C32(0xffd2df80), SPH_C32(0x29570000), + SPH_C32(0xaa9561b5), SPH_C32(0xa4b9d9bb), SPH_C32(0x24eb442b), + SPH_C32(0xd0bdce8d) }, + { SPH_C32(0xdb250000), SPH_C32(0x09290000), SPH_C32(0x49aac000), + SPH_C32(0x81e10000), SPH_C32(0xcafe6b59), SPH_C32(0x42793431), + SPH_C32(0x43566b76), SPH_C32(0xe86cba2e), SPH_C32(0x75e60000), + SPH_C32(0x95660001), SPH_C32(0x307b2000), SPH_C32(0xadf40000), + SPH_C32(0x8f321eea), SPH_C32(0x24298307), SPH_C32(0xe8c49cf9), + SPH_C32(0x4b7eec55) }, + { SPH_C32(0x17310000), SPH_C32(0xac4a0000), SPH_C32(0x1313c780), + SPH_C32(0xbab10000), SPH_C32(0x812e78a6), SPH_C32(0xc5e20029), + SPH_C32(0x2a1523b7), SPH_C32(0x22363dd0), SPH_C32(0xf4780000), + SPH_C32(0x79310001), SPH_C32(0x56492280), SPH_C32(0x38070000), + SPH_C32(0xd29b36e8), SPH_C32(0x6cddbfbb), SPH_C32(0x0e9e3ed4), + SPH_C32(0xc5195baf) }, + { SPH_C32(0x5abb0000), SPH_C32(0xe57e0000), SPH_C32(0x2f98c280), + SPH_C32(0x14120000), SPH_C32(0x9757435b), SPH_C32(0x0a8d088d), + SPH_C32(0xa50cc95b), SPH_C32(0x660b0dd4), SPH_C32(0x386c0000), + SPH_C32(0xdc520001), SPH_C32(0x0cf02500), SPH_C32(0x03570000), + SPH_C32(0x994b2517), SPH_C32(0xeb468ba3), SPH_C32(0x67dd7615), + SPH_C32(0x0f43dc51) }, + { SPH_C32(0x96af0000), SPH_C32(0x401d0000), SPH_C32(0x7521c500), + SPH_C32(0x2f420000), SPH_C32(0xdc8750a4), SPH_C32(0x8d163c95), + SPH_C32(0xcc4f819a), SPH_C32(0xac518a2a), SPH_C32(0xb9f20000), + SPH_C32(0x30050001), SPH_C32(0x6ac22780), SPH_C32(0x96a40000), + SPH_C32(0xc4e20d15), SPH_C32(0xa3b2b71f), SPH_C32(0x8187d438), + SPH_C32(0x81246bab) }, + { SPH_C32(0xa3060000), SPH_C32(0x1bd50000), SPH_C32(0xe090cb80), + SPH_C32(0x11440000), SPH_C32(0xbbc04320), SPH_C32(0x3c90bd15), + SPH_C32(0xb3dacb14), SPH_C32(0x8b033185), SPH_C32(0x77490000), + SPH_C32(0x224e0001), SPH_C32(0x8a672300), SPH_C32(0xfb6c0000), + SPH_C32(0x35bf5b39), SPH_C32(0xa4614560), SPH_C32(0x41988863), + SPH_C32(0xbf88062e) }, + { SPH_C32(0x6f120000), SPH_C32(0xbeb60000), SPH_C32(0xba29cc00), + SPH_C32(0x2a140000), SPH_C32(0xf01050df), SPH_C32(0xbb0b890d), + SPH_C32(0xda9983d5), SPH_C32(0x4159b67b), SPH_C32(0xf6d70000), + SPH_C32(0xce190001), SPH_C32(0xec552180), SPH_C32(0x6e9f0000), + SPH_C32(0x6816733b), SPH_C32(0xec9579dc), SPH_C32(0xa7c22a4e), + SPH_C32(0x31efb1d4) }, + { SPH_C32(0x22980000), SPH_C32(0xf7820000), SPH_C32(0x86a2c900), + SPH_C32(0x84b70000), SPH_C32(0xe6696b22), SPH_C32(0x746481a9), + SPH_C32(0x55806939), SPH_C32(0x0564867f), SPH_C32(0x3ac30000), + SPH_C32(0x6b7a0001), SPH_C32(0xb6ec2600), SPH_C32(0x55cf0000), + SPH_C32(0x23c660c4), SPH_C32(0x6b0e4dc4), SPH_C32(0xce81628f), + SPH_C32(0xfbb5362a) }, + { SPH_C32(0xee8c0000), SPH_C32(0x52e10000), SPH_C32(0xdc1bce80), + SPH_C32(0xbfe70000), SPH_C32(0xadb978dd), SPH_C32(0xf3ffb5b1), + SPH_C32(0x3cc321f8), SPH_C32(0xcf3e0181), SPH_C32(0xbb5d0000), + SPH_C32(0x872d0001), SPH_C32(0xd0de2480), SPH_C32(0xc03c0000), + SPH_C32(0x7e6f48c6), SPH_C32(0x23fa7178), SPH_C32(0x28dbc0a2), + SPH_C32(0x75d281d0) }, + { SPH_C32(0xd98a0000), SPH_C32(0xbe010000), SPH_C32(0xf3b6c300), + SPH_C32(0xd7790000), SPH_C32(0x70732e8a), SPH_C32(0xc231f256), + SPH_C32(0xea0a7fec), SPH_C32(0x1c9a5055), SPH_C32(0x0f6a0000), + SPH_C32(0x30b20001), SPH_C32(0x235d2880), SPH_C32(0x6bc90000), + SPH_C32(0x44817340), SPH_C32(0xda88cc44), SPH_C32(0xb1142801), + SPH_C32(0xdce78d85) }, + { SPH_C32(0x159e0000), SPH_C32(0x1b620000), SPH_C32(0xa90fc480), + SPH_C32(0xec290000), SPH_C32(0x3ba33d75), SPH_C32(0x45aac64e), + SPH_C32(0x8349372d), SPH_C32(0xd6c0d7ab), SPH_C32(0x8ef40000), + SPH_C32(0xdce50001), SPH_C32(0x456f2a00), SPH_C32(0xfe3a0000), + SPH_C32(0x19285b42), SPH_C32(0x927cf0f8), SPH_C32(0x574e8a2c), + SPH_C32(0x52803a7f) }, + { SPH_C32(0x58140000), SPH_C32(0x52560000), SPH_C32(0x9584c180), + SPH_C32(0x428a0000), SPH_C32(0x2dda0688), SPH_C32(0x8ac5ceea), + SPH_C32(0x0c50ddc1), SPH_C32(0x92fde7af), SPH_C32(0x42e00000), + SPH_C32(0x79860001), SPH_C32(0x1fd62d80), SPH_C32(0xc56a0000), + SPH_C32(0x52f848bd), SPH_C32(0x15e7c4e0), SPH_C32(0x3e0dc2ed), + SPH_C32(0x98dabd81) }, + { SPH_C32(0x94000000), SPH_C32(0xf7350000), SPH_C32(0xcf3dc600), + SPH_C32(0x79da0000), SPH_C32(0x660a1577), SPH_C32(0x0d5efaf2), + SPH_C32(0x65139500), SPH_C32(0x58a76051), SPH_C32(0xc37e0000), + SPH_C32(0x95d10001), SPH_C32(0x79e42f00), SPH_C32(0x50990000), + SPH_C32(0x0f5160bf), SPH_C32(0x5d13f85c), SPH_C32(0xd85760c0), + SPH_C32(0x16bd0a7b) }, + { SPH_C32(0xa1a90000), SPH_C32(0xacfd0000), SPH_C32(0x5a8cc880), + SPH_C32(0x47dc0000), SPH_C32(0x014d06f3), SPH_C32(0xbcd87b72), + SPH_C32(0x1a86df8e), SPH_C32(0x7ff5dbfe), SPH_C32(0x0dc50000), + SPH_C32(0x879a0001), SPH_C32(0x99412b80), SPH_C32(0x3d510000), + SPH_C32(0xfe0c3693), SPH_C32(0x5ac00a23), SPH_C32(0x18483c9b), + SPH_C32(0x281167fe) }, + { SPH_C32(0x6dbd0000), SPH_C32(0x099e0000), SPH_C32(0x0035cf00), + SPH_C32(0x7c8c0000), SPH_C32(0x4a9d150c), SPH_C32(0x3b434f6a), + SPH_C32(0x73c5974f), SPH_C32(0xb5af5c00), SPH_C32(0x8c5b0000), + SPH_C32(0x6bcd0001), SPH_C32(0xff732900), SPH_C32(0xa8a20000), + SPH_C32(0xa3a51e91), SPH_C32(0x1234369f), SPH_C32(0xfe129eb6), + SPH_C32(0xa676d004) }, + { SPH_C32(0x20370000), SPH_C32(0x40aa0000), SPH_C32(0x3cbeca00), + SPH_C32(0xd22f0000), SPH_C32(0x5ce42ef1), SPH_C32(0xf42c47ce), + SPH_C32(0xfcdc7da3), SPH_C32(0xf1926c04), SPH_C32(0x404f0000), + SPH_C32(0xceae0001), SPH_C32(0xa5ca2e80), SPH_C32(0x93f20000), + SPH_C32(0xe8750d6e), SPH_C32(0x95af0287), SPH_C32(0x9751d677), + SPH_C32(0x6c2c57fa) }, + { SPH_C32(0xec230000), SPH_C32(0xe5c90000), SPH_C32(0x6607cd80), + SPH_C32(0xe97f0000), SPH_C32(0x17343d0e), SPH_C32(0x73b773d6), + SPH_C32(0x959f3562), SPH_C32(0x3bc8ebfa), SPH_C32(0xc1d10000), + SPH_C32(0x22f90001), SPH_C32(0xc3f82c00), SPH_C32(0x06010000), + SPH_C32(0xb5dc256c), SPH_C32(0xdd5b3e3b), SPH_C32(0x710b745a), + SPH_C32(0xe24be000) }, + { SPH_C32(0x776d0000), SPH_C32(0x128f0000), SPH_C32(0x0c51d380), + SPH_C32(0x82a20000), SPH_C32(0x907b5a33), SPH_C32(0x5dcb6487), + SPH_C32(0xbd24ac88), SPH_C32(0x7988c2d8), SPH_C32(0x6ba80000), + SPH_C32(0x4ba90001), SPH_C32(0x5d832180), SPH_C32(0xdad00000), + SPH_C32(0x63751974), SPH_C32(0xd089ea49), SPH_C32(0x256784eb), + SPH_C32(0xd3d4a53b) }, + { SPH_C32(0xbb790000), SPH_C32(0xb7ec0000), SPH_C32(0x56e8d400), + SPH_C32(0xb9f20000), SPH_C32(0xdbab49cc), SPH_C32(0xda50509f), + SPH_C32(0xd467e449), SPH_C32(0xb3d24526), SPH_C32(0xea360000), + SPH_C32(0xa7fe0001), SPH_C32(0x3bb12300), SPH_C32(0x4f230000), + SPH_C32(0x3edc3176), SPH_C32(0x987dd6f5), SPH_C32(0xc33d26c6), + SPH_C32(0x5db312c1) }, + { SPH_C32(0xf6f30000), SPH_C32(0xfed80000), SPH_C32(0x6a63d100), + SPH_C32(0x17510000), SPH_C32(0xcdd27231), SPH_C32(0x153f583b), + SPH_C32(0x5b7e0ea5), SPH_C32(0xf7ef7522), SPH_C32(0x26220000), + SPH_C32(0x029d0001), SPH_C32(0x61082480), SPH_C32(0x74730000), + SPH_C32(0x750c2289), SPH_C32(0x1fe6e2ed), SPH_C32(0xaa7e6e07), + SPH_C32(0x97e9953f) }, + { SPH_C32(0x3ae70000), SPH_C32(0x5bbb0000), SPH_C32(0x30dad680), + SPH_C32(0x2c010000), SPH_C32(0x860261ce), SPH_C32(0x92a46c23), + SPH_C32(0x323d4664), SPH_C32(0x3db5f2dc), SPH_C32(0xa7bc0000), + SPH_C32(0xeeca0001), SPH_C32(0x073a2600), SPH_C32(0xe1800000), + SPH_C32(0x28a50a8b), SPH_C32(0x5712de51), SPH_C32(0x4c24cc2a), + SPH_C32(0x198e22c5) }, + { SPH_C32(0x0f4e0000), SPH_C32(0x00730000), SPH_C32(0xa56bd800), + SPH_C32(0x12070000), SPH_C32(0xe145724a), SPH_C32(0x2322eda3), + SPH_C32(0x4da80cea), SPH_C32(0x1ae74973), SPH_C32(0x69070000), + SPH_C32(0xfc810001), SPH_C32(0xe79f2280), SPH_C32(0x8c480000), + SPH_C32(0xd9f85ca7), SPH_C32(0x50c12c2e), SPH_C32(0x8c3b9071), + SPH_C32(0x27224f40) }, + { SPH_C32(0xc35a0000), SPH_C32(0xa5100000), SPH_C32(0xffd2df80), + SPH_C32(0x29570000), SPH_C32(0xaa9561b5), SPH_C32(0xa4b9d9bb), + SPH_C32(0x24eb442b), SPH_C32(0xd0bdce8d), SPH_C32(0xe8990000), + SPH_C32(0x10d60001), SPH_C32(0x81ad2000), SPH_C32(0x19bb0000), + SPH_C32(0x845174a5), SPH_C32(0x18351092), SPH_C32(0x6a61325c), + SPH_C32(0xa945f8ba) }, + { SPH_C32(0x8ed00000), SPH_C32(0xec240000), SPH_C32(0xc359da80), + SPH_C32(0x87f40000), SPH_C32(0xbcec5a48), SPH_C32(0x6bd6d11f), + SPH_C32(0xabf2aec7), SPH_C32(0x9480fe89), SPH_C32(0x248d0000), + SPH_C32(0xb5b50001), SPH_C32(0xdb142780), SPH_C32(0x22eb0000), + SPH_C32(0xcf81675a), SPH_C32(0x9fae248a), SPH_C32(0x03227a9d), + SPH_C32(0x631f7f44) }, + { SPH_C32(0x42c40000), SPH_C32(0x49470000), SPH_C32(0x99e0dd00), + SPH_C32(0xbca40000), SPH_C32(0xf73c49b7), SPH_C32(0xec4de507), + SPH_C32(0xc2b1e606), SPH_C32(0x5eda7977), SPH_C32(0xa5130000), + SPH_C32(0x59e20001), SPH_C32(0xbd262500), SPH_C32(0xb7180000), + SPH_C32(0x92284f58), SPH_C32(0xd75a1836), SPH_C32(0xe578d8b0), + SPH_C32(0xed78c8be) }, + { SPH_C32(0x75c20000), SPH_C32(0xa5a70000), SPH_C32(0xb64dd080), + SPH_C32(0xd43a0000), SPH_C32(0x2af61fe0), SPH_C32(0xdd83a2e0), + SPH_C32(0x1478b812), SPH_C32(0x8d7e28a3), SPH_C32(0x11240000), + SPH_C32(0xee7d0001), SPH_C32(0x4ea52900), SPH_C32(0x1ced0000), + SPH_C32(0xa8c674de), SPH_C32(0x2e28a50a), SPH_C32(0x7cb73013), + SPH_C32(0x444dc4eb) }, + { SPH_C32(0xb9d60000), SPH_C32(0x00c40000), SPH_C32(0xecf4d700), + SPH_C32(0xef6a0000), SPH_C32(0x61260c1f), SPH_C32(0x5a1896f8), + SPH_C32(0x7d3bf0d3), SPH_C32(0x4724af5d), SPH_C32(0x90ba0000), + SPH_C32(0x022a0001), SPH_C32(0x28972b80), SPH_C32(0x891e0000), + SPH_C32(0xf56f5cdc), SPH_C32(0x66dc99b6), SPH_C32(0x9aed923e), + SPH_C32(0xca2a7311) }, + { SPH_C32(0xf45c0000), SPH_C32(0x49f00000), SPH_C32(0xd07fd200), + SPH_C32(0x41c90000), SPH_C32(0x775f37e2), SPH_C32(0x95779e5c), + SPH_C32(0xf2221a3f), SPH_C32(0x03199f59), SPH_C32(0x5cae0000), + SPH_C32(0xa7490001), SPH_C32(0x722e2c00), SPH_C32(0xb24e0000), + SPH_C32(0xbebf4f23), SPH_C32(0xe147adae), SPH_C32(0xf3aedaff), + SPH_C32(0x0070f4ef) }, + { SPH_C32(0x38480000), SPH_C32(0xec930000), SPH_C32(0x8ac6d580), + SPH_C32(0x7a990000), SPH_C32(0x3c8f241d), SPH_C32(0x12ecaa44), + SPH_C32(0x9b6152fe), SPH_C32(0xc94318a7), SPH_C32(0xdd300000), + SPH_C32(0x4b1e0001), SPH_C32(0x141c2e80), SPH_C32(0x27bd0000), + SPH_C32(0xe3166721), SPH_C32(0xa9b39112), SPH_C32(0x15f478d2), + SPH_C32(0x8e174315) }, + { SPH_C32(0x0de10000), SPH_C32(0xb75b0000), SPH_C32(0x1f77db00), + SPH_C32(0x449f0000), SPH_C32(0x5bc83799), SPH_C32(0xa36a2bc4), + SPH_C32(0xe4f41870), SPH_C32(0xee11a308), SPH_C32(0x138b0000), + SPH_C32(0x59550001), SPH_C32(0xf4b92a00), SPH_C32(0x4a750000), + SPH_C32(0x124b310d), SPH_C32(0xae60636d), SPH_C32(0xd5eb2489), + SPH_C32(0xb0bb2e90) }, + { SPH_C32(0xc1f50000), SPH_C32(0x12380000), SPH_C32(0x45cedc80), + SPH_C32(0x7fcf0000), SPH_C32(0x10182466), SPH_C32(0x24f11fdc), + SPH_C32(0x8db750b1), SPH_C32(0x244b24f6), SPH_C32(0x92150000), + SPH_C32(0xb5020001), SPH_C32(0x928b2880), SPH_C32(0xdf860000), + SPH_C32(0x4fe2190f), SPH_C32(0xe6945fd1), SPH_C32(0x33b186a4), + SPH_C32(0x3edc996a) }, + { SPH_C32(0x8c7f0000), SPH_C32(0x5b0c0000), SPH_C32(0x7945d980), + SPH_C32(0xd16c0000), SPH_C32(0x06611f9b), SPH_C32(0xeb9e1778), + SPH_C32(0x02aeba5d), SPH_C32(0x607614f2), SPH_C32(0x5e010000), + SPH_C32(0x10610001), SPH_C32(0xc8322f00), SPH_C32(0xe4d60000), + SPH_C32(0x04320af0), SPH_C32(0x610f6bc9), SPH_C32(0x5af2ce65), + SPH_C32(0xf4861e94) }, + { SPH_C32(0x406b0000), SPH_C32(0xfe6f0000), SPH_C32(0x23fcde00), + SPH_C32(0xea3c0000), SPH_C32(0x4db10c64), SPH_C32(0x6c052360), + SPH_C32(0x6bedf29c), SPH_C32(0xaa2c930c), SPH_C32(0xdf9f0000), + SPH_C32(0xfc360001), SPH_C32(0xae002d80), SPH_C32(0x71250000), + SPH_C32(0x599b22f2), SPH_C32(0x29fb5775), SPH_C32(0xbca86c48), + SPH_C32(0x7ae1a96e) }, + { SPH_C32(0xc56b0000), SPH_C32(0xd7e60000), SPH_C32(0x2452c180), + SPH_C32(0xf6c50000), SPH_C32(0x26b96cc7), SPH_C32(0xb6d95d7f), + SPH_C32(0x8ef57364), SPH_C32(0x70c6f340), SPH_C32(0xc7e00000), + SPH_C32(0x500f0001), SPH_C32(0x18783200), SPH_C32(0xd9930000), + SPH_C32(0x39f0281e), SPH_C32(0xcf3bbaff), SPH_C32(0xdb154315), + SPH_C32(0x4230ddcd) }, + { SPH_C32(0x097f0000), SPH_C32(0x72850000), SPH_C32(0x7eebc600), + SPH_C32(0xcd950000), SPH_C32(0x6d697f38), SPH_C32(0x31426967), + SPH_C32(0xe7b63ba5), SPH_C32(0xba9c74be), SPH_C32(0x467e0000), + SPH_C32(0xbc580001), SPH_C32(0x7e4a3080), SPH_C32(0x4c600000), + SPH_C32(0x6459001c), SPH_C32(0x87cf8643), SPH_C32(0x3d4fe138), + SPH_C32(0xcc576a37) }, + { SPH_C32(0x44f50000), SPH_C32(0x3bb10000), SPH_C32(0x4260c300), + SPH_C32(0x63360000), SPH_C32(0x7b1044c5), SPH_C32(0xfe2d61c3), + SPH_C32(0x68afd149), SPH_C32(0xfea144ba), SPH_C32(0x8a6a0000), + SPH_C32(0x193b0001), SPH_C32(0x24f33700), SPH_C32(0x77300000), + SPH_C32(0x2f8913e3), SPH_C32(0x0054b25b), SPH_C32(0x540ca9f9), + SPH_C32(0x060dedc9) }, + { SPH_C32(0x88e10000), SPH_C32(0x9ed20000), SPH_C32(0x18d9c480), + SPH_C32(0x58660000), SPH_C32(0x30c0573a), SPH_C32(0x79b655db), + SPH_C32(0x01ec9988), SPH_C32(0x34fbc344), SPH_C32(0x0bf40000), + SPH_C32(0xf56c0001), SPH_C32(0x42c13580), SPH_C32(0xe2c30000), + SPH_C32(0x72203be1), SPH_C32(0x48a08ee7), SPH_C32(0xb2560bd4), + SPH_C32(0x886a5a33) }, + { SPH_C32(0xbd480000), SPH_C32(0xc51a0000), SPH_C32(0x8d68ca00), + SPH_C32(0x66600000), SPH_C32(0x578744be), SPH_C32(0xc830d45b), + SPH_C32(0x7e79d306), SPH_C32(0x13a978eb), SPH_C32(0xc54f0000), + SPH_C32(0xe7270001), SPH_C32(0xa2643100), SPH_C32(0x8f0b0000), + SPH_C32(0x837d6dcd), SPH_C32(0x4f737c98), SPH_C32(0x7249578f), + SPH_C32(0xb6c637b6) }, + { SPH_C32(0x715c0000), SPH_C32(0x60790000), SPH_C32(0xd7d1cd80), + SPH_C32(0x5d300000), SPH_C32(0x1c575741), SPH_C32(0x4fabe043), + SPH_C32(0x173a9bc7), SPH_C32(0xd9f3ff15), SPH_C32(0x44d10000), + SPH_C32(0x0b700001), SPH_C32(0xc4563380), SPH_C32(0x1af80000), + SPH_C32(0xded445cf), SPH_C32(0x07874024), SPH_C32(0x9413f5a2), + SPH_C32(0x38a1804c) }, + { SPH_C32(0x3cd60000), SPH_C32(0x294d0000), SPH_C32(0xeb5ac880), + SPH_C32(0xf3930000), SPH_C32(0x0a2e6cbc), SPH_C32(0x80c4e8e7), + SPH_C32(0x9823712b), SPH_C32(0x9dcecf11), SPH_C32(0x88c50000), + SPH_C32(0xae130001), SPH_C32(0x9eef3400), SPH_C32(0x21a80000), + SPH_C32(0x95045630), SPH_C32(0x801c743c), SPH_C32(0xfd50bd63), + SPH_C32(0xf2fb07b2) }, + { SPH_C32(0xf0c20000), SPH_C32(0x8c2e0000), SPH_C32(0xb1e3cf00), + SPH_C32(0xc8c30000), SPH_C32(0x41fe7f43), SPH_C32(0x075fdcff), + SPH_C32(0xf16039ea), SPH_C32(0x579448ef), SPH_C32(0x095b0000), + SPH_C32(0x42440001), SPH_C32(0xf8dd3680), SPH_C32(0xb45b0000), + SPH_C32(0xc8ad7e32), SPH_C32(0xc8e84880), SPH_C32(0x1b0a1f4e), + SPH_C32(0x7c9cb048) }, + { SPH_C32(0xc7c40000), SPH_C32(0x60ce0000), SPH_C32(0x9e4ec280), + SPH_C32(0xa05d0000), SPH_C32(0x9c342914), SPH_C32(0x36919b18), + SPH_C32(0x27a967fe), SPH_C32(0x8430193b), SPH_C32(0xbd6c0000), + SPH_C32(0xf5db0001), SPH_C32(0x0b5e3a80), SPH_C32(0x1fae0000), + SPH_C32(0xf24345b4), SPH_C32(0x319af5bc), SPH_C32(0x82c5f7ed), + SPH_C32(0xd5a9bc1d) }, + { SPH_C32(0x0bd00000), SPH_C32(0xc5ad0000), SPH_C32(0xc4f7c500), + SPH_C32(0x9b0d0000), SPH_C32(0xd7e43aeb), SPH_C32(0xb10aaf00), + SPH_C32(0x4eea2f3f), SPH_C32(0x4e6a9ec5), SPH_C32(0x3cf20000), + SPH_C32(0x198c0001), SPH_C32(0x6d6c3800), SPH_C32(0x8a5d0000), + SPH_C32(0xafea6db6), SPH_C32(0x796ec900), SPH_C32(0x649f55c0), + SPH_C32(0x5bce0be7) }, + { SPH_C32(0x465a0000), SPH_C32(0x8c990000), SPH_C32(0xf87cc000), + SPH_C32(0x35ae0000), SPH_C32(0xc19d0116), SPH_C32(0x7e65a7a4), + SPH_C32(0xc1f3c5d3), SPH_C32(0x0a57aec1), SPH_C32(0xf0e60000), + SPH_C32(0xbcef0001), SPH_C32(0x37d53f80), SPH_C32(0xb10d0000), + SPH_C32(0xe43a7e49), SPH_C32(0xfef5fd18), SPH_C32(0x0ddc1d01), + SPH_C32(0x91948c19) }, + { SPH_C32(0x8a4e0000), SPH_C32(0x29fa0000), SPH_C32(0xa2c5c780), + SPH_C32(0x0efe0000), SPH_C32(0x8a4d12e9), SPH_C32(0xf9fe93bc), + SPH_C32(0xa8b08d12), SPH_C32(0xc00d293f), SPH_C32(0x71780000), + SPH_C32(0x50b80001), SPH_C32(0x51e73d00), SPH_C32(0x24fe0000), + SPH_C32(0xb993564b), SPH_C32(0xb601c1a4), SPH_C32(0xeb86bf2c), + SPH_C32(0x1ff33be3) }, + { SPH_C32(0xbfe70000), SPH_C32(0x72320000), SPH_C32(0x3774c900), + SPH_C32(0x30f80000), SPH_C32(0xed0a016d), SPH_C32(0x4878123c), + SPH_C32(0xd725c79c), SPH_C32(0xe75f9290), SPH_C32(0xbfc30000), + SPH_C32(0x42f30001), SPH_C32(0xb1423980), SPH_C32(0x49360000), + SPH_C32(0x48ce0067), SPH_C32(0xb1d233db), SPH_C32(0x2b99e377), + SPH_C32(0x215f5666) }, + { SPH_C32(0x73f30000), SPH_C32(0xd7510000), SPH_C32(0x6dcdce80), + SPH_C32(0x0ba80000), SPH_C32(0xa6da1292), SPH_C32(0xcfe32624), + SPH_C32(0xbe668f5d), SPH_C32(0x2d05156e), SPH_C32(0x3e5d0000), + SPH_C32(0xaea40001), SPH_C32(0xd7703b00), SPH_C32(0xdcc50000), + SPH_C32(0x15672865), SPH_C32(0xf9260f67), SPH_C32(0xcdc3415a), + SPH_C32(0xaf38e19c) }, + { SPH_C32(0x3e790000), SPH_C32(0x9e650000), SPH_C32(0x5146cb80), + SPH_C32(0xa50b0000), SPH_C32(0xb0a3296f), SPH_C32(0x008c2e80), + SPH_C32(0x317f65b1), SPH_C32(0x6938256a), SPH_C32(0xf2490000), + SPH_C32(0x0bc70001), SPH_C32(0x8dc93c80), SPH_C32(0xe7950000), + SPH_C32(0x5eb73b9a), SPH_C32(0x7ebd3b7f), SPH_C32(0xa480099b), + SPH_C32(0x65626662) }, + { SPH_C32(0xf26d0000), SPH_C32(0x3b060000), SPH_C32(0x0bffcc00), + SPH_C32(0x9e5b0000), SPH_C32(0xfb733a90), SPH_C32(0x87171a98), + SPH_C32(0x583c2d70), SPH_C32(0xa362a294), SPH_C32(0x73d70000), + SPH_C32(0xe7900001), SPH_C32(0xebfb3e00), SPH_C32(0x72660000), + SPH_C32(0x031e1398), SPH_C32(0x364907c3), SPH_C32(0x42daabb6), + SPH_C32(0xeb05d198) }, + { SPH_C32(0x69230000), SPH_C32(0xcc400000), SPH_C32(0x61a9d200), + SPH_C32(0xf5860000), SPH_C32(0x7c3c5dad), SPH_C32(0xa96b0dc9), + SPH_C32(0x7087b49a), SPH_C32(0xe1228bb6), SPH_C32(0xd9ae0000), + SPH_C32(0x8ec00001), SPH_C32(0x75803380), SPH_C32(0xaeb70000), + SPH_C32(0xd5b72f80), SPH_C32(0x3b9bd3b1), SPH_C32(0x16b65b07), + SPH_C32(0xda9a94a3) }, + { SPH_C32(0xa5370000), SPH_C32(0x69230000), SPH_C32(0x3b10d580), + SPH_C32(0xced60000), SPH_C32(0x37ec4e52), SPH_C32(0x2ef039d1), + SPH_C32(0x19c4fc5b), SPH_C32(0x2b780c48), SPH_C32(0x58300000), + SPH_C32(0x62970001), SPH_C32(0x13b23100), SPH_C32(0x3b440000), + SPH_C32(0x881e0782), SPH_C32(0x736fef0d), SPH_C32(0xf0ecf92a), + SPH_C32(0x54fd2359) }, + { SPH_C32(0xe8bd0000), SPH_C32(0x20170000), SPH_C32(0x079bd080), + SPH_C32(0x60750000), SPH_C32(0x219575af), SPH_C32(0xe19f3175), + SPH_C32(0x96dd16b7), SPH_C32(0x6f453c4c), SPH_C32(0x94240000), + SPH_C32(0xc7f40001), SPH_C32(0x490b3680), SPH_C32(0x00140000), + SPH_C32(0xc3ce147d), SPH_C32(0xf4f4db15), SPH_C32(0x99afb1eb), + SPH_C32(0x9ea7a4a7) }, + { SPH_C32(0x24a90000), SPH_C32(0x85740000), SPH_C32(0x5d22d700), + SPH_C32(0x5b250000), SPH_C32(0x6a456650), SPH_C32(0x6604056d), + SPH_C32(0xff9e5e76), SPH_C32(0xa51fbbb2), SPH_C32(0x15ba0000), + SPH_C32(0x2ba30001), SPH_C32(0x2f393400), SPH_C32(0x95e70000), + SPH_C32(0x9e673c7f), SPH_C32(0xbc00e7a9), SPH_C32(0x7ff513c6), + SPH_C32(0x10c0135d) }, + { SPH_C32(0x11000000), SPH_C32(0xdebc0000), SPH_C32(0xc893d980), + SPH_C32(0x65230000), SPH_C32(0x0d0275d4), SPH_C32(0xd78284ed), + SPH_C32(0x800b14f8), SPH_C32(0x824d001d), SPH_C32(0xdb010000), + SPH_C32(0x39e80001), SPH_C32(0xcf9c3080), SPH_C32(0xf82f0000), + SPH_C32(0x6f3a6a53), SPH_C32(0xbbd315d6), SPH_C32(0xbfea4f9d), + SPH_C32(0x2e6c7ed8) }, + { SPH_C32(0xdd140000), SPH_C32(0x7bdf0000), SPH_C32(0x922ade00), + SPH_C32(0x5e730000), SPH_C32(0x46d2662b), SPH_C32(0x5019b0f5), + SPH_C32(0xe9485c39), SPH_C32(0x481787e3), SPH_C32(0x5a9f0000), + SPH_C32(0xd5bf0001), SPH_C32(0xa9ae3200), SPH_C32(0x6ddc0000), + SPH_C32(0x32934251), SPH_C32(0xf327296a), SPH_C32(0x59b0edb0), + SPH_C32(0xa00bc922) }, + { SPH_C32(0x909e0000), SPH_C32(0x32eb0000), SPH_C32(0xaea1db00), + SPH_C32(0xf0d00000), SPH_C32(0x50ab5dd6), SPH_C32(0x9f76b851), + SPH_C32(0x6651b6d5), SPH_C32(0x0c2ab7e7), SPH_C32(0x968b0000), + SPH_C32(0x70dc0001), SPH_C32(0xf3173580), SPH_C32(0x568c0000), + SPH_C32(0x794351ae), SPH_C32(0x74bc1d72), SPH_C32(0x30f3a571), + SPH_C32(0x6a514edc) }, + { SPH_C32(0x5c8a0000), SPH_C32(0x97880000), SPH_C32(0xf418dc80), + SPH_C32(0xcb800000), SPH_C32(0x1b7b4e29), SPH_C32(0x18ed8c49), + SPH_C32(0x0f12fe14), SPH_C32(0xc6703019), SPH_C32(0x17150000), + SPH_C32(0x9c8b0001), SPH_C32(0x95253700), SPH_C32(0xc37f0000), + SPH_C32(0x24ea79ac), SPH_C32(0x3c4821ce), SPH_C32(0xd6a9075c), + SPH_C32(0xe436f926) }, + { SPH_C32(0x6b8c0000), SPH_C32(0x7b680000), SPH_C32(0xdbb5d100), + SPH_C32(0xa31e0000), SPH_C32(0xc6b1187e), SPH_C32(0x2923cbae), + SPH_C32(0xd9dba000), SPH_C32(0x15d461cd), SPH_C32(0xa3220000), + SPH_C32(0x2b140001), SPH_C32(0x66a63b00), SPH_C32(0x688a0000), + SPH_C32(0x1e04422a), SPH_C32(0xc53a9cf2), SPH_C32(0x4f66efff), + SPH_C32(0x4d03f573) }, + { SPH_C32(0xa7980000), SPH_C32(0xde0b0000), SPH_C32(0x810cd680), + SPH_C32(0x984e0000), SPH_C32(0x8d610b81), SPH_C32(0xaeb8ffb6), + SPH_C32(0xb098e8c1), SPH_C32(0xdf8ee633), SPH_C32(0x22bc0000), + SPH_C32(0xc7430001), SPH_C32(0x00943980), SPH_C32(0xfd790000), + SPH_C32(0x43ad6a28), SPH_C32(0x8dcea04e), SPH_C32(0xa93c4dd2), + SPH_C32(0xc3644289) }, + { SPH_C32(0xea120000), SPH_C32(0x973f0000), SPH_C32(0xbd87d380), + SPH_C32(0x36ed0000), SPH_C32(0x9b18307c), SPH_C32(0x61d7f712), + SPH_C32(0x3f81022d), SPH_C32(0x9bb3d637), SPH_C32(0xeea80000), + SPH_C32(0x62200001), SPH_C32(0x5a2d3e00), SPH_C32(0xc6290000), + SPH_C32(0x087d79d7), SPH_C32(0x0a559456), SPH_C32(0xc07f0513), + SPH_C32(0x093ec577) }, + { SPH_C32(0x26060000), SPH_C32(0x325c0000), SPH_C32(0xe73ed400), + SPH_C32(0x0dbd0000), SPH_C32(0xd0c82383), SPH_C32(0xe64cc30a), + SPH_C32(0x56c24aec), SPH_C32(0x51e951c9), SPH_C32(0x6f360000), + SPH_C32(0x8e770001), SPH_C32(0x3c1f3c80), SPH_C32(0x53da0000), + SPH_C32(0x55d451d5), SPH_C32(0x42a1a8ea), SPH_C32(0x2625a73e), + SPH_C32(0x8759728d) }, + { SPH_C32(0x13af0000), SPH_C32(0x69940000), SPH_C32(0x728fda80), + SPH_C32(0x33bb0000), SPH_C32(0xb78f3007), SPH_C32(0x57ca428a), + SPH_C32(0x29570062), SPH_C32(0x76bbea66), SPH_C32(0xa18d0000), + SPH_C32(0x9c3c0001), SPH_C32(0xdcba3800), SPH_C32(0x3e120000), + SPH_C32(0xa48907f9), SPH_C32(0x45725a95), SPH_C32(0xe63afb65), + SPH_C32(0xb9f51f08) }, + { SPH_C32(0xdfbb0000), SPH_C32(0xccf70000), SPH_C32(0x2836dd00), + SPH_C32(0x08eb0000), SPH_C32(0xfc5f23f8), SPH_C32(0xd0517692), + SPH_C32(0x401448a3), SPH_C32(0xbce16d98), SPH_C32(0x20130000), + SPH_C32(0x706b0001), SPH_C32(0xba883a80), SPH_C32(0xabe10000), + SPH_C32(0xf9202ffb), SPH_C32(0x0d866629), SPH_C32(0x00605948), + SPH_C32(0x3792a8f2) }, + { SPH_C32(0x92310000), SPH_C32(0x85c30000), SPH_C32(0x14bdd800), + SPH_C32(0xa6480000), SPH_C32(0xea261805), SPH_C32(0x1f3e7e36), + SPH_C32(0xcf0da24f), SPH_C32(0xf8dc5d9c), SPH_C32(0xec070000), + SPH_C32(0xd5080001), SPH_C32(0xe0313d00), SPH_C32(0x90b10000), + SPH_C32(0xb2f03c04), SPH_C32(0x8a1d5231), SPH_C32(0x69231189), + SPH_C32(0xfdc82f0c) }, + { SPH_C32(0x5e250000), SPH_C32(0x20a00000), SPH_C32(0x4e04df80), + SPH_C32(0x9d180000), SPH_C32(0xa1f60bfa), SPH_C32(0x98a54a2e), + SPH_C32(0xa64eea8e), SPH_C32(0x3286da62), SPH_C32(0x6d990000), + SPH_C32(0x395f0001), SPH_C32(0x86033f80), SPH_C32(0x05420000), + SPH_C32(0xef591406), SPH_C32(0xc2e96e8d), SPH_C32(0x8f79b3a4), + SPH_C32(0x73af98f6) }, + { SPH_C32(0x75e60000), SPH_C32(0x95660001), SPH_C32(0x307b2000), + SPH_C32(0xadf40000), SPH_C32(0x8f321eea), SPH_C32(0x24298307), + SPH_C32(0xe8c49cf9), SPH_C32(0x4b7eec55), SPH_C32(0xaec30000), + SPH_C32(0x9c4f0001), SPH_C32(0x79d1e000), SPH_C32(0x2c150000), + SPH_C32(0x45cc75b3), SPH_C32(0x6650b736), SPH_C32(0xab92f78f), + SPH_C32(0xa312567b) }, + { SPH_C32(0xb9f20000), SPH_C32(0x30050001), SPH_C32(0x6ac22780), + SPH_C32(0x96a40000), SPH_C32(0xc4e20d15), SPH_C32(0xa3b2b71f), + SPH_C32(0x8187d438), SPH_C32(0x81246bab), SPH_C32(0x2f5d0000), + SPH_C32(0x70180001), SPH_C32(0x1fe3e280), SPH_C32(0xb9e60000), + SPH_C32(0x18655db1), SPH_C32(0x2ea48b8a), SPH_C32(0x4dc855a2), + SPH_C32(0x2d75e181) }, + { SPH_C32(0xf4780000), SPH_C32(0x79310001), SPH_C32(0x56492280), + SPH_C32(0x38070000), SPH_C32(0xd29b36e8), SPH_C32(0x6cddbfbb), + SPH_C32(0x0e9e3ed4), SPH_C32(0xc5195baf), SPH_C32(0xe3490000), + SPH_C32(0xd57b0001), SPH_C32(0x455ae500), SPH_C32(0x82b60000), + SPH_C32(0x53b54e4e), SPH_C32(0xa93fbf92), SPH_C32(0x248b1d63), + SPH_C32(0xe72f667f) }, + { SPH_C32(0x386c0000), SPH_C32(0xdc520001), SPH_C32(0x0cf02500), + SPH_C32(0x03570000), SPH_C32(0x994b2517), SPH_C32(0xeb468ba3), + SPH_C32(0x67dd7615), SPH_C32(0x0f43dc51), SPH_C32(0x62d70000), + SPH_C32(0x392c0001), SPH_C32(0x2368e780), SPH_C32(0x17450000), + SPH_C32(0x0e1c664c), SPH_C32(0xe1cb832e), SPH_C32(0xc2d1bf4e), + SPH_C32(0x6948d185) }, + { SPH_C32(0x0dc50000), SPH_C32(0x879a0001), SPH_C32(0x99412b80), + SPH_C32(0x3d510000), SPH_C32(0xfe0c3693), SPH_C32(0x5ac00a23), + SPH_C32(0x18483c9b), SPH_C32(0x281167fe), SPH_C32(0xac6c0000), + SPH_C32(0x2b670001), SPH_C32(0xc3cde300), SPH_C32(0x7a8d0000), + SPH_C32(0xff413060), SPH_C32(0xe6187151), SPH_C32(0x02cee315), + SPH_C32(0x57e4bc00) }, + { SPH_C32(0xc1d10000), SPH_C32(0x22f90001), SPH_C32(0xc3f82c00), + SPH_C32(0x06010000), SPH_C32(0xb5dc256c), SPH_C32(0xdd5b3e3b), + SPH_C32(0x710b745a), SPH_C32(0xe24be000), SPH_C32(0x2df20000), + SPH_C32(0xc7300001), SPH_C32(0xa5ffe180), SPH_C32(0xef7e0000), + SPH_C32(0xa2e81862), SPH_C32(0xaeec4ded), SPH_C32(0xe4944138), + SPH_C32(0xd9830bfa) }, + { SPH_C32(0x8c5b0000), SPH_C32(0x6bcd0001), SPH_C32(0xff732900), + SPH_C32(0xa8a20000), SPH_C32(0xa3a51e91), SPH_C32(0x1234369f), + SPH_C32(0xfe129eb6), SPH_C32(0xa676d004), SPH_C32(0xe1e60000), + SPH_C32(0x62530001), SPH_C32(0xff46e600), SPH_C32(0xd42e0000), + SPH_C32(0xe9380b9d), SPH_C32(0x297779f5), SPH_C32(0x8dd709f9), + SPH_C32(0x13d98c04) }, + { SPH_C32(0x404f0000), SPH_C32(0xceae0001), SPH_C32(0xa5ca2e80), + SPH_C32(0x93f20000), SPH_C32(0xe8750d6e), SPH_C32(0x95af0287), + SPH_C32(0x9751d677), SPH_C32(0x6c2c57fa), SPH_C32(0x60780000), + SPH_C32(0x8e040001), SPH_C32(0x9974e480), SPH_C32(0x41dd0000), + SPH_C32(0xb491239f), SPH_C32(0x61834549), SPH_C32(0x6b8dabd4), + SPH_C32(0x9dbe3bfe) }, + { SPH_C32(0x77490000), SPH_C32(0x224e0001), SPH_C32(0x8a672300), + SPH_C32(0xfb6c0000), SPH_C32(0x35bf5b39), SPH_C32(0xa4614560), + SPH_C32(0x41988863), SPH_C32(0xbf88062e), SPH_C32(0xd44f0000), + SPH_C32(0x399b0001), SPH_C32(0x6af7e880), SPH_C32(0xea280000), + SPH_C32(0x8e7f1819), SPH_C32(0x98f1f875), SPH_C32(0xf2424377), + SPH_C32(0x348b37ab) }, + { SPH_C32(0xbb5d0000), SPH_C32(0x872d0001), SPH_C32(0xd0de2480), + SPH_C32(0xc03c0000), SPH_C32(0x7e6f48c6), SPH_C32(0x23fa7178), + SPH_C32(0x28dbc0a2), SPH_C32(0x75d281d0), SPH_C32(0x55d10000), + SPH_C32(0xd5cc0001), SPH_C32(0x0cc5ea00), SPH_C32(0x7fdb0000), + SPH_C32(0xd3d6301b), SPH_C32(0xd005c4c9), SPH_C32(0x1418e15a), + SPH_C32(0xbaec8051) }, + { SPH_C32(0xf6d70000), SPH_C32(0xce190001), SPH_C32(0xec552180), + SPH_C32(0x6e9f0000), SPH_C32(0x6816733b), SPH_C32(0xec9579dc), + SPH_C32(0xa7c22a4e), SPH_C32(0x31efb1d4), SPH_C32(0x99c50000), + SPH_C32(0x70af0001), SPH_C32(0x567ced80), SPH_C32(0x448b0000), + SPH_C32(0x980623e4), SPH_C32(0x579ef0d1), SPH_C32(0x7d5ba99b), + SPH_C32(0x70b607af) }, + { SPH_C32(0x3ac30000), SPH_C32(0x6b7a0001), SPH_C32(0xb6ec2600), + SPH_C32(0x55cf0000), SPH_C32(0x23c660c4), SPH_C32(0x6b0e4dc4), + SPH_C32(0xce81628f), SPH_C32(0xfbb5362a), SPH_C32(0x185b0000), + SPH_C32(0x9cf80001), SPH_C32(0x304eef00), SPH_C32(0xd1780000), + SPH_C32(0xc5af0be6), SPH_C32(0x1f6acc6d), SPH_C32(0x9b010bb6), + SPH_C32(0xfed1b055) }, + { SPH_C32(0x0f6a0000), SPH_C32(0x30b20001), SPH_C32(0x235d2880), + SPH_C32(0x6bc90000), SPH_C32(0x44817340), SPH_C32(0xda88cc44), + SPH_C32(0xb1142801), SPH_C32(0xdce78d85), SPH_C32(0xd6e00000), + SPH_C32(0x8eb30001), SPH_C32(0xd0ebeb80), SPH_C32(0xbcb00000), + SPH_C32(0x34f25dca), SPH_C32(0x18b93e12), SPH_C32(0x5b1e57ed), + SPH_C32(0xc07dddd0) }, + { SPH_C32(0xc37e0000), SPH_C32(0x95d10001), SPH_C32(0x79e42f00), + SPH_C32(0x50990000), SPH_C32(0x0f5160bf), SPH_C32(0x5d13f85c), + SPH_C32(0xd85760c0), SPH_C32(0x16bd0a7b), SPH_C32(0x577e0000), + SPH_C32(0x62e40001), SPH_C32(0xb6d9e900), SPH_C32(0x29430000), + SPH_C32(0x695b75c8), SPH_C32(0x504d02ae), SPH_C32(0xbd44f5c0), + SPH_C32(0x4e1a6a2a) }, + { SPH_C32(0x8ef40000), SPH_C32(0xdce50001), SPH_C32(0x456f2a00), + SPH_C32(0xfe3a0000), SPH_C32(0x19285b42), SPH_C32(0x927cf0f8), + SPH_C32(0x574e8a2c), SPH_C32(0x52803a7f), SPH_C32(0x9b6a0000), + SPH_C32(0xc7870001), SPH_C32(0xec60ee80), SPH_C32(0x12130000), + SPH_C32(0x228b6637), SPH_C32(0xd7d636b6), SPH_C32(0xd407bd01), + SPH_C32(0x8440edd4) }, + { SPH_C32(0x42e00000), SPH_C32(0x79860001), SPH_C32(0x1fd62d80), + SPH_C32(0xc56a0000), SPH_C32(0x52f848bd), SPH_C32(0x15e7c4e0), + SPH_C32(0x3e0dc2ed), SPH_C32(0x98dabd81), SPH_C32(0x1af40000), + SPH_C32(0x2bd00001), SPH_C32(0x8a52ec00), SPH_C32(0x87e00000), + SPH_C32(0x7f224e35), SPH_C32(0x9f220a0a), SPH_C32(0x325d1f2c), + SPH_C32(0x0a275a2e) }, + { SPH_C32(0xd9ae0000), SPH_C32(0x8ec00001), SPH_C32(0x75803380), + SPH_C32(0xaeb70000), SPH_C32(0xd5b72f80), SPH_C32(0x3b9bd3b1), + SPH_C32(0x16b65b07), SPH_C32(0xda9a94a3), SPH_C32(0xb08d0000), + SPH_C32(0x42800001), SPH_C32(0x1429e180), SPH_C32(0x5b310000), + SPH_C32(0xa98b722d), SPH_C32(0x92f0de78), SPH_C32(0x6631ef9d), + SPH_C32(0x3bb81f15) }, + { SPH_C32(0x15ba0000), SPH_C32(0x2ba30001), SPH_C32(0x2f393400), + SPH_C32(0x95e70000), SPH_C32(0x9e673c7f), SPH_C32(0xbc00e7a9), + SPH_C32(0x7ff513c6), SPH_C32(0x10c0135d), SPH_C32(0x31130000), + SPH_C32(0xaed70001), SPH_C32(0x721be300), SPH_C32(0xcec20000), + SPH_C32(0xf4225a2f), SPH_C32(0xda04e2c4), SPH_C32(0x806b4db0), + SPH_C32(0xb5dfa8ef) }, + { SPH_C32(0x58300000), SPH_C32(0x62970001), SPH_C32(0x13b23100), + SPH_C32(0x3b440000), SPH_C32(0x881e0782), SPH_C32(0x736fef0d), + SPH_C32(0xf0ecf92a), SPH_C32(0x54fd2359), SPH_C32(0xfd070000), + SPH_C32(0x0bb40001), SPH_C32(0x28a2e480), SPH_C32(0xf5920000), + SPH_C32(0xbff249d0), SPH_C32(0x5d9fd6dc), SPH_C32(0xe9280571), + SPH_C32(0x7f852f11) }, + { SPH_C32(0x94240000), SPH_C32(0xc7f40001), SPH_C32(0x490b3680), + SPH_C32(0x00140000), SPH_C32(0xc3ce147d), SPH_C32(0xf4f4db15), + SPH_C32(0x99afb1eb), SPH_C32(0x9ea7a4a7), SPH_C32(0x7c990000), + SPH_C32(0xe7e30001), SPH_C32(0x4e90e600), SPH_C32(0x60610000), + SPH_C32(0xe25b61d2), SPH_C32(0x156bea60), SPH_C32(0x0f72a75c), + SPH_C32(0xf1e298eb) }, + { SPH_C32(0xa18d0000), SPH_C32(0x9c3c0001), SPH_C32(0xdcba3800), + SPH_C32(0x3e120000), SPH_C32(0xa48907f9), SPH_C32(0x45725a95), + SPH_C32(0xe63afb65), SPH_C32(0xb9f51f08), SPH_C32(0xb2220000), + SPH_C32(0xf5a80001), SPH_C32(0xae35e280), SPH_C32(0x0da90000), + SPH_C32(0x130637fe), SPH_C32(0x12b8181f), SPH_C32(0xcf6dfb07), + SPH_C32(0xcf4ef56e) }, + { SPH_C32(0x6d990000), SPH_C32(0x395f0001), SPH_C32(0x86033f80), + SPH_C32(0x05420000), SPH_C32(0xef591406), SPH_C32(0xc2e96e8d), + SPH_C32(0x8f79b3a4), SPH_C32(0x73af98f6), SPH_C32(0x33bc0000), + SPH_C32(0x19ff0001), SPH_C32(0xc807e000), SPH_C32(0x985a0000), + SPH_C32(0x4eaf1ffc), SPH_C32(0x5a4c24a3), SPH_C32(0x2937592a), + SPH_C32(0x41294294) }, + { SPH_C32(0x20130000), SPH_C32(0x706b0001), SPH_C32(0xba883a80), + SPH_C32(0xabe10000), SPH_C32(0xf9202ffb), SPH_C32(0x0d866629), + SPH_C32(0x00605948), SPH_C32(0x3792a8f2), SPH_C32(0xffa80000), + SPH_C32(0xbc9c0001), SPH_C32(0x92bee780), SPH_C32(0xa30a0000), + SPH_C32(0x057f0c03), SPH_C32(0xddd710bb), SPH_C32(0x407411eb), + SPH_C32(0x8b73c56a) }, + { SPH_C32(0xec070000), SPH_C32(0xd5080001), SPH_C32(0xe0313d00), + SPH_C32(0x90b10000), SPH_C32(0xb2f03c04), SPH_C32(0x8a1d5231), + SPH_C32(0x69231189), SPH_C32(0xfdc82f0c), SPH_C32(0x7e360000), + SPH_C32(0x50cb0001), SPH_C32(0xf48ce500), SPH_C32(0x36f90000), + SPH_C32(0x58d62401), SPH_C32(0x95232c07), SPH_C32(0xa62eb3c6), + SPH_C32(0x05147290) }, + { SPH_C32(0xdb010000), SPH_C32(0x39e80001), SPH_C32(0xcf9c3080), + SPH_C32(0xf82f0000), SPH_C32(0x6f3a6a53), SPH_C32(0xbbd315d6), + SPH_C32(0xbfea4f9d), SPH_C32(0x2e6c7ed8), SPH_C32(0xca010000), + SPH_C32(0xe7540001), SPH_C32(0x070fe900), SPH_C32(0x9d0c0000), + SPH_C32(0x62381f87), SPH_C32(0x6c51913b), SPH_C32(0x3fe15b65), + SPH_C32(0xac217ec5) }, + { SPH_C32(0x17150000), SPH_C32(0x9c8b0001), SPH_C32(0x95253700), + SPH_C32(0xc37f0000), SPH_C32(0x24ea79ac), SPH_C32(0x3c4821ce), + SPH_C32(0xd6a9075c), SPH_C32(0xe436f926), SPH_C32(0x4b9f0000), + SPH_C32(0x0b030001), SPH_C32(0x613deb80), SPH_C32(0x08ff0000), + SPH_C32(0x3f913785), SPH_C32(0x24a5ad87), SPH_C32(0xd9bbf948), + SPH_C32(0x2246c93f) }, + { SPH_C32(0x5a9f0000), SPH_C32(0xd5bf0001), SPH_C32(0xa9ae3200), + SPH_C32(0x6ddc0000), SPH_C32(0x32934251), SPH_C32(0xf327296a), + SPH_C32(0x59b0edb0), SPH_C32(0xa00bc922), SPH_C32(0x878b0000), + SPH_C32(0xae600001), SPH_C32(0x3b84ec00), SPH_C32(0x33af0000), + SPH_C32(0x7441247a), SPH_C32(0xa33e999f), SPH_C32(0xb0f8b189), + SPH_C32(0xe81c4ec1) }, + { SPH_C32(0x968b0000), SPH_C32(0x70dc0001), SPH_C32(0xf3173580), + SPH_C32(0x568c0000), SPH_C32(0x794351ae), SPH_C32(0x74bc1d72), + SPH_C32(0x30f3a571), SPH_C32(0x6a514edc), SPH_C32(0x06150000), + SPH_C32(0x42370001), SPH_C32(0x5db6ee80), SPH_C32(0xa65c0000), + SPH_C32(0x29e80c78), SPH_C32(0xebcaa523), SPH_C32(0x56a213a4), + SPH_C32(0x667bf93b) }, + { SPH_C32(0xa3220000), SPH_C32(0x2b140001), SPH_C32(0x66a63b00), + SPH_C32(0x688a0000), SPH_C32(0x1e04422a), SPH_C32(0xc53a9cf2), + SPH_C32(0x4f66efff), SPH_C32(0x4d03f573), SPH_C32(0xc8ae0000), + SPH_C32(0x507c0001), SPH_C32(0xbd13ea00), SPH_C32(0xcb940000), + SPH_C32(0xd8b55a54), SPH_C32(0xec19575c), SPH_C32(0x96bd4fff), + SPH_C32(0x58d794be) }, + { SPH_C32(0x6f360000), SPH_C32(0x8e770001), SPH_C32(0x3c1f3c80), + SPH_C32(0x53da0000), SPH_C32(0x55d451d5), SPH_C32(0x42a1a8ea), + SPH_C32(0x2625a73e), SPH_C32(0x8759728d), SPH_C32(0x49300000), + SPH_C32(0xbc2b0001), SPH_C32(0xdb21e880), SPH_C32(0x5e670000), + SPH_C32(0x851c7256), SPH_C32(0xa4ed6be0), SPH_C32(0x70e7edd2), + SPH_C32(0xd6b02344) }, + { SPH_C32(0x22bc0000), SPH_C32(0xc7430001), SPH_C32(0x00943980), + SPH_C32(0xfd790000), SPH_C32(0x43ad6a28), SPH_C32(0x8dcea04e), + SPH_C32(0xa93c4dd2), SPH_C32(0xc3644289), SPH_C32(0x85240000), + SPH_C32(0x19480001), SPH_C32(0x8198ef00), SPH_C32(0x65370000), + SPH_C32(0xcecc61a9), SPH_C32(0x23765ff8), SPH_C32(0x19a4a513), + SPH_C32(0x1ceaa4ba) }, + { SPH_C32(0xeea80000), SPH_C32(0x62200001), SPH_C32(0x5a2d3e00), + SPH_C32(0xc6290000), SPH_C32(0x087d79d7), SPH_C32(0x0a559456), + SPH_C32(0xc07f0513), SPH_C32(0x093ec577), SPH_C32(0x04ba0000), + SPH_C32(0xf51f0001), SPH_C32(0xe7aaed80), SPH_C32(0xf0c40000), + SPH_C32(0x936549ab), SPH_C32(0x6b826344), SPH_C32(0xfffe073e), + SPH_C32(0x928d1340) }, + { SPH_C32(0x6ba80000), SPH_C32(0x4ba90001), SPH_C32(0x5d832180), + SPH_C32(0xdad00000), SPH_C32(0x63751974), SPH_C32(0xd089ea49), + SPH_C32(0x256784eb), SPH_C32(0xd3d4a53b), SPH_C32(0x1cc50000), + SPH_C32(0x59260001), SPH_C32(0x51d2f200), SPH_C32(0x58720000), + SPH_C32(0xf30e4347), SPH_C32(0x8d428ece), SPH_C32(0x98432863), + SPH_C32(0xaa5c67e3) }, + { SPH_C32(0xa7bc0000), SPH_C32(0xeeca0001), SPH_C32(0x073a2600), + SPH_C32(0xe1800000), SPH_C32(0x28a50a8b), SPH_C32(0x5712de51), + SPH_C32(0x4c24cc2a), SPH_C32(0x198e22c5), SPH_C32(0x9d5b0000), + SPH_C32(0xb5710001), SPH_C32(0x37e0f080), SPH_C32(0xcd810000), + SPH_C32(0xaea76b45), SPH_C32(0xc5b6b272), SPH_C32(0x7e198a4e), + SPH_C32(0x243bd019) }, + { SPH_C32(0xea360000), SPH_C32(0xa7fe0001), SPH_C32(0x3bb12300), + SPH_C32(0x4f230000), SPH_C32(0x3edc3176), SPH_C32(0x987dd6f5), + SPH_C32(0xc33d26c6), SPH_C32(0x5db312c1), SPH_C32(0x514f0000), + SPH_C32(0x10120001), SPH_C32(0x6d59f700), SPH_C32(0xf6d10000), + SPH_C32(0xe57778ba), SPH_C32(0x422d866a), SPH_C32(0x175ac28f), + SPH_C32(0xee6157e7) }, + { SPH_C32(0x26220000), SPH_C32(0x029d0001), SPH_C32(0x61082480), + SPH_C32(0x74730000), SPH_C32(0x750c2289), SPH_C32(0x1fe6e2ed), + SPH_C32(0xaa7e6e07), SPH_C32(0x97e9953f), SPH_C32(0xd0d10000), + SPH_C32(0xfc450001), SPH_C32(0x0b6bf580), SPH_C32(0x63220000), + SPH_C32(0xb8de50b8), SPH_C32(0x0ad9bad6), SPH_C32(0xf10060a2), + SPH_C32(0x6006e01d) }, + { SPH_C32(0x138b0000), SPH_C32(0x59550001), SPH_C32(0xf4b92a00), + SPH_C32(0x4a750000), SPH_C32(0x124b310d), SPH_C32(0xae60636d), + SPH_C32(0xd5eb2489), SPH_C32(0xb0bb2e90), SPH_C32(0x1e6a0000), + SPH_C32(0xee0e0001), SPH_C32(0xebcef100), SPH_C32(0x0eea0000), + SPH_C32(0x49830694), SPH_C32(0x0d0a48a9), SPH_C32(0x311f3cf9), + SPH_C32(0x5eaa8d98) }, + { SPH_C32(0xdf9f0000), SPH_C32(0xfc360001), SPH_C32(0xae002d80), + SPH_C32(0x71250000), SPH_C32(0x599b22f2), SPH_C32(0x29fb5775), + SPH_C32(0xbca86c48), SPH_C32(0x7ae1a96e), SPH_C32(0x9ff40000), + SPH_C32(0x02590001), SPH_C32(0x8dfcf380), SPH_C32(0x9b190000), + SPH_C32(0x142a2e96), SPH_C32(0x45fe7415), SPH_C32(0xd7459ed4), + SPH_C32(0xd0cd3a62) }, + { SPH_C32(0x92150000), SPH_C32(0xb5020001), SPH_C32(0x928b2880), + SPH_C32(0xdf860000), SPH_C32(0x4fe2190f), SPH_C32(0xe6945fd1), + SPH_C32(0x33b186a4), SPH_C32(0x3edc996a), SPH_C32(0x53e00000), + SPH_C32(0xa73a0001), SPH_C32(0xd745f400), SPH_C32(0xa0490000), + SPH_C32(0x5ffa3d69), SPH_C32(0xc265400d), SPH_C32(0xbe06d615), + SPH_C32(0x1a97bd9c) }, + { SPH_C32(0x5e010000), SPH_C32(0x10610001), SPH_C32(0xc8322f00), + SPH_C32(0xe4d60000), SPH_C32(0x04320af0), SPH_C32(0x610f6bc9), + SPH_C32(0x5af2ce65), SPH_C32(0xf4861e94), SPH_C32(0xd27e0000), + SPH_C32(0x4b6d0001), SPH_C32(0xb177f680), SPH_C32(0x35ba0000), + SPH_C32(0x0253156b), SPH_C32(0x8a917cb1), SPH_C32(0x585c7438), + SPH_C32(0x94f00a66) }, + { SPH_C32(0x69070000), SPH_C32(0xfc810001), SPH_C32(0xe79f2280), + SPH_C32(0x8c480000), SPH_C32(0xd9f85ca7), SPH_C32(0x50c12c2e), + SPH_C32(0x8c3b9071), SPH_C32(0x27224f40), SPH_C32(0x66490000), + SPH_C32(0xfcf20001), SPH_C32(0x42f4fa80), SPH_C32(0x9e4f0000), + SPH_C32(0x38bd2eed), SPH_C32(0x73e3c18d), SPH_C32(0xc1939c9b), + SPH_C32(0x3dc50633) }, + { SPH_C32(0xa5130000), SPH_C32(0x59e20001), SPH_C32(0xbd262500), + SPH_C32(0xb7180000), SPH_C32(0x92284f58), SPH_C32(0xd75a1836), + SPH_C32(0xe578d8b0), SPH_C32(0xed78c8be), SPH_C32(0xe7d70000), + SPH_C32(0x10a50001), SPH_C32(0x24c6f800), SPH_C32(0x0bbc0000), + SPH_C32(0x651406ef), SPH_C32(0x3b17fd31), SPH_C32(0x27c93eb6), + SPH_C32(0xb3a2b1c9) }, + { SPH_C32(0xe8990000), SPH_C32(0x10d60001), SPH_C32(0x81ad2000), + SPH_C32(0x19bb0000), SPH_C32(0x845174a5), SPH_C32(0x18351092), + SPH_C32(0x6a61325c), SPH_C32(0xa945f8ba), SPH_C32(0x2bc30000), + SPH_C32(0xb5c60001), SPH_C32(0x7e7fff80), SPH_C32(0x30ec0000), + SPH_C32(0x2ec41510), SPH_C32(0xbc8cc929), SPH_C32(0x4e8a7677), + SPH_C32(0x79f83637) }, + { SPH_C32(0x248d0000), SPH_C32(0xb5b50001), SPH_C32(0xdb142780), + SPH_C32(0x22eb0000), SPH_C32(0xcf81675a), SPH_C32(0x9fae248a), + SPH_C32(0x03227a9d), SPH_C32(0x631f7f44), SPH_C32(0xaa5d0000), + SPH_C32(0x59910001), SPH_C32(0x184dfd00), SPH_C32(0xa51f0000), + SPH_C32(0x736d3d12), SPH_C32(0xf478f595), SPH_C32(0xa8d0d45a), + SPH_C32(0xf79f81cd) }, + { SPH_C32(0x11240000), SPH_C32(0xee7d0001), SPH_C32(0x4ea52900), + SPH_C32(0x1ced0000), SPH_C32(0xa8c674de), SPH_C32(0x2e28a50a), + SPH_C32(0x7cb73013), SPH_C32(0x444dc4eb), SPH_C32(0x64e60000), + SPH_C32(0x4bda0001), SPH_C32(0xf8e8f980), SPH_C32(0xc8d70000), + SPH_C32(0x82306b3e), SPH_C32(0xf3ab07ea), SPH_C32(0x68cf8801), + SPH_C32(0xc933ec48) }, + { SPH_C32(0xdd300000), SPH_C32(0x4b1e0001), SPH_C32(0x141c2e80), + SPH_C32(0x27bd0000), SPH_C32(0xe3166721), SPH_C32(0xa9b39112), + SPH_C32(0x15f478d2), SPH_C32(0x8e174315), SPH_C32(0xe5780000), + SPH_C32(0xa78d0001), SPH_C32(0x9edafb00), SPH_C32(0x5d240000), + SPH_C32(0xdf99433c), SPH_C32(0xbb5f3b56), SPH_C32(0x8e952a2c), + SPH_C32(0x47545bb2) }, + { SPH_C32(0x90ba0000), SPH_C32(0x022a0001), SPH_C32(0x28972b80), + SPH_C32(0x891e0000), SPH_C32(0xf56f5cdc), SPH_C32(0x66dc99b6), + SPH_C32(0x9aed923e), SPH_C32(0xca2a7311), SPH_C32(0x296c0000), + SPH_C32(0x02ee0001), SPH_C32(0xc463fc80), SPH_C32(0x66740000), + SPH_C32(0x944950c3), SPH_C32(0x3cc40f4e), SPH_C32(0xe7d662ed), + SPH_C32(0x8d0edc4c) }, + { SPH_C32(0x5cae0000), SPH_C32(0xa7490001), SPH_C32(0x722e2c00), + SPH_C32(0xb24e0000), SPH_C32(0xbebf4f23), SPH_C32(0xe147adae), + SPH_C32(0xf3aedaff), SPH_C32(0x0070f4ef), SPH_C32(0xa8f20000), + SPH_C32(0xeeb90001), SPH_C32(0xa251fe00), SPH_C32(0xf3870000), + SPH_C32(0xc9e078c1), SPH_C32(0x743033f2), SPH_C32(0x018cc0c0), + SPH_C32(0x03696bb6) }, + { SPH_C32(0xc7e00000), SPH_C32(0x500f0001), SPH_C32(0x18783200), + SPH_C32(0xd9930000), SPH_C32(0x39f0281e), SPH_C32(0xcf3bbaff), + SPH_C32(0xdb154315), SPH_C32(0x4230ddcd), SPH_C32(0x028b0000), + SPH_C32(0x87e90001), SPH_C32(0x3c2af380), SPH_C32(0x2f560000), + SPH_C32(0x1f4944d9), SPH_C32(0x79e2e780), SPH_C32(0x55e03071), + SPH_C32(0x32f62e8d) }, + { SPH_C32(0x0bf40000), SPH_C32(0xf56c0001), SPH_C32(0x42c13580), + SPH_C32(0xe2c30000), SPH_C32(0x72203be1), SPH_C32(0x48a08ee7), + SPH_C32(0xb2560bd4), SPH_C32(0x886a5a33), SPH_C32(0x83150000), + SPH_C32(0x6bbe0001), SPH_C32(0x5a18f100), SPH_C32(0xbaa50000), + SPH_C32(0x42e06cdb), SPH_C32(0x3116db3c), SPH_C32(0xb3ba925c), + SPH_C32(0xbc919977) }, + { SPH_C32(0x467e0000), SPH_C32(0xbc580001), SPH_C32(0x7e4a3080), + SPH_C32(0x4c600000), SPH_C32(0x6459001c), SPH_C32(0x87cf8643), + SPH_C32(0x3d4fe138), SPH_C32(0xcc576a37), SPH_C32(0x4f010000), + SPH_C32(0xcedd0001), SPH_C32(0x00a1f680), SPH_C32(0x81f50000), + SPH_C32(0x09307f24), SPH_C32(0xb68def24), SPH_C32(0xdaf9da9d), + SPH_C32(0x76cb1e89) }, + { SPH_C32(0x8a6a0000), SPH_C32(0x193b0001), SPH_C32(0x24f33700), + SPH_C32(0x77300000), SPH_C32(0x2f8913e3), SPH_C32(0x0054b25b), + SPH_C32(0x540ca9f9), SPH_C32(0x060dedc9), SPH_C32(0xce9f0000), + SPH_C32(0x228a0001), SPH_C32(0x6693f400), SPH_C32(0x14060000), + SPH_C32(0x54995726), SPH_C32(0xfe79d398), SPH_C32(0x3ca378b0), + SPH_C32(0xf8aca973) }, + { SPH_C32(0xbfc30000), SPH_C32(0x42f30001), SPH_C32(0xb1423980), + SPH_C32(0x49360000), SPH_C32(0x48ce0067), SPH_C32(0xb1d233db), + SPH_C32(0x2b99e377), SPH_C32(0x215f5666), SPH_C32(0x00240000), + SPH_C32(0x30c10001), SPH_C32(0x8636f080), SPH_C32(0x79ce0000), + SPH_C32(0xa5c4010a), SPH_C32(0xf9aa21e7), SPH_C32(0xfcbc24eb), + SPH_C32(0xc600c4f6) }, + { SPH_C32(0x73d70000), SPH_C32(0xe7900001), SPH_C32(0xebfb3e00), + SPH_C32(0x72660000), SPH_C32(0x031e1398), SPH_C32(0x364907c3), + SPH_C32(0x42daabb6), SPH_C32(0xeb05d198), SPH_C32(0x81ba0000), + SPH_C32(0xdc960001), SPH_C32(0xe004f200), SPH_C32(0xec3d0000), + SPH_C32(0xf86d2908), SPH_C32(0xb15e1d5b), SPH_C32(0x1ae686c6), + SPH_C32(0x4867730c) }, + { SPH_C32(0x3e5d0000), SPH_C32(0xaea40001), SPH_C32(0xd7703b00), + SPH_C32(0xdcc50000), SPH_C32(0x15672865), SPH_C32(0xf9260f67), + SPH_C32(0xcdc3415a), SPH_C32(0xaf38e19c), SPH_C32(0x4dae0000), + SPH_C32(0x79f50001), SPH_C32(0xbabdf580), SPH_C32(0xd76d0000), + SPH_C32(0xb3bd3af7), SPH_C32(0x36c52943), SPH_C32(0x73a5ce07), + SPH_C32(0x823df4f2) }, + { SPH_C32(0xf2490000), SPH_C32(0x0bc70001), SPH_C32(0x8dc93c80), + SPH_C32(0xe7950000), SPH_C32(0x5eb73b9a), SPH_C32(0x7ebd3b7f), + SPH_C32(0xa480099b), SPH_C32(0x65626662), SPH_C32(0xcc300000), + SPH_C32(0x95a20001), SPH_C32(0xdc8ff700), SPH_C32(0x429e0000), + SPH_C32(0xee1412f5), SPH_C32(0x7e3115ff), SPH_C32(0x95ff6c2a), + SPH_C32(0x0c5a4308) }, + { SPH_C32(0xc54f0000), SPH_C32(0xe7270001), SPH_C32(0xa2643100), + SPH_C32(0x8f0b0000), SPH_C32(0x837d6dcd), SPH_C32(0x4f737c98), + SPH_C32(0x7249578f), SPH_C32(0xb6c637b6), SPH_C32(0x78070000), + SPH_C32(0x223d0001), SPH_C32(0x2f0cfb00), SPH_C32(0xe96b0000), + SPH_C32(0xd4fa2973), SPH_C32(0x8743a8c3), SPH_C32(0x0c308489), + SPH_C32(0xa56f4f5d) }, + { SPH_C32(0x095b0000), SPH_C32(0x42440001), SPH_C32(0xf8dd3680), + SPH_C32(0xb45b0000), SPH_C32(0xc8ad7e32), SPH_C32(0xc8e84880), + SPH_C32(0x1b0a1f4e), SPH_C32(0x7c9cb048), SPH_C32(0xf9990000), + SPH_C32(0xce6a0001), SPH_C32(0x493ef980), SPH_C32(0x7c980000), + SPH_C32(0x89530171), SPH_C32(0xcfb7947f), SPH_C32(0xea6a26a4), + SPH_C32(0x2b08f8a7) }, + { SPH_C32(0x44d10000), SPH_C32(0x0b700001), SPH_C32(0xc4563380), + SPH_C32(0x1af80000), SPH_C32(0xded445cf), SPH_C32(0x07874024), + SPH_C32(0x9413f5a2), SPH_C32(0x38a1804c), SPH_C32(0x358d0000), + SPH_C32(0x6b090001), SPH_C32(0x1387fe00), SPH_C32(0x47c80000), + SPH_C32(0xc283128e), SPH_C32(0x482ca067), SPH_C32(0x83296e65), + SPH_C32(0xe1527f59) }, + { SPH_C32(0x88c50000), SPH_C32(0xae130001), SPH_C32(0x9eef3400), + SPH_C32(0x21a80000), SPH_C32(0x95045630), SPH_C32(0x801c743c), + SPH_C32(0xfd50bd63), SPH_C32(0xf2fb07b2), SPH_C32(0xb4130000), + SPH_C32(0x875e0001), SPH_C32(0x75b5fc80), SPH_C32(0xd23b0000), + SPH_C32(0x9f2a3a8c), SPH_C32(0x00d89cdb), SPH_C32(0x6573cc48), + SPH_C32(0x6f35c8a3) }, + { SPH_C32(0xbd6c0000), SPH_C32(0xf5db0001), SPH_C32(0x0b5e3a80), + SPH_C32(0x1fae0000), SPH_C32(0xf24345b4), SPH_C32(0x319af5bc), + SPH_C32(0x82c5f7ed), SPH_C32(0xd5a9bc1d), SPH_C32(0x7aa80000), + SPH_C32(0x95150001), SPH_C32(0x9510f800), SPH_C32(0xbff30000), + SPH_C32(0x6e776ca0), SPH_C32(0x070b6ea4), SPH_C32(0xa56c9013), + SPH_C32(0x5199a526) }, + { SPH_C32(0x71780000), SPH_C32(0x50b80001), SPH_C32(0x51e73d00), + SPH_C32(0x24fe0000), SPH_C32(0xb993564b), SPH_C32(0xb601c1a4), + SPH_C32(0xeb86bf2c), SPH_C32(0x1ff33be3), SPH_C32(0xfb360000), + SPH_C32(0x79420001), SPH_C32(0xf322fa80), SPH_C32(0x2a000000), + SPH_C32(0x33de44a2), SPH_C32(0x4fff5218), SPH_C32(0x4336323e), + SPH_C32(0xdffe12dc) }, + { SPH_C32(0x3cf20000), SPH_C32(0x198c0001), SPH_C32(0x6d6c3800), + SPH_C32(0x8a5d0000), SPH_C32(0xafea6db6), SPH_C32(0x796ec900), + SPH_C32(0x649f55c0), SPH_C32(0x5bce0be7), SPH_C32(0x37220000), + SPH_C32(0xdc210001), SPH_C32(0xa99bfd00), SPH_C32(0x11500000), + SPH_C32(0x780e575d), SPH_C32(0xc8646600), SPH_C32(0x2a757aff), + SPH_C32(0x15a49522) }, + { SPH_C32(0xf0e60000), SPH_C32(0xbcef0001), SPH_C32(0x37d53f80), + SPH_C32(0xb10d0000), SPH_C32(0xe43a7e49), SPH_C32(0xfef5fd18), + SPH_C32(0x0ddc1d01), SPH_C32(0x91948c19), SPH_C32(0xb6bc0000), + SPH_C32(0x30760001), SPH_C32(0xcfa9ff80), SPH_C32(0x84a30000), + SPH_C32(0x25a77f5f), SPH_C32(0x80905abc), SPH_C32(0xcc2fd8d2), + SPH_C32(0x9bc322d8) } +}; + +static const sph_u32 T512_40[256][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x58430000), SPH_C32(0x807e0000), SPH_C32(0x78330001), + SPH_C32(0xc66b3800), SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), + SPH_C32(0xac73fe6f), SPH_C32(0x3a4479b1), SPH_C32(0x1d5a0000), + SPH_C32(0x2b720000), SPH_C32(0x488d0000), SPH_C32(0xaf611800), + SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), SPH_C32(0x81a20429), + SPH_C32(0x1e7536a6) }, + { SPH_C32(0x1d5a0000), SPH_C32(0x2b720000), SPH_C32(0x488d0000), + SPH_C32(0xaf611800), SPH_C32(0x25cb2ec5), SPH_C32(0xc879bfd0), + SPH_C32(0x81a20429), SPH_C32(0x1e7536a6), SPH_C32(0x45190000), + SPH_C32(0xab0c0000), SPH_C32(0x30be0001), SPH_C32(0x690a2000), + SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), SPH_C32(0x2dd1fa46), + SPH_C32(0x24314f17) }, + { SPH_C32(0x45190000), SPH_C32(0xab0c0000), SPH_C32(0x30be0001), + SPH_C32(0x690a2000), SPH_C32(0xc2fc7219), SPH_C32(0xb1d4800d), + SPH_C32(0x2dd1fa46), SPH_C32(0x24314f17), SPH_C32(0x58430000), + SPH_C32(0x807e0000), SPH_C32(0x78330001), SPH_C32(0xc66b3800), + SPH_C32(0xe7375cdc), SPH_C32(0x79ad3fdd), SPH_C32(0xac73fe6f), + SPH_C32(0x3a4479b1) }, + { SPH_C32(0xa53b0000), SPH_C32(0x14260000), SPH_C32(0x4e30001e), + SPH_C32(0x7cae0000), SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), + SPH_C32(0xf73168d8), SPH_C32(0x0b1b4946), SPH_C32(0x07ed0000), + SPH_C32(0xb2500000), SPH_C32(0x8774000a), SPH_C32(0x970d0000), + SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), SPH_C32(0xf4786222), + SPH_C32(0x9075b1ce) }, + { SPH_C32(0xfd780000), SPH_C32(0x94580000), SPH_C32(0x3603001f), + SPH_C32(0xbac53800), SPH_C32(0x68a95109), SPH_C32(0x017295e0), + SPH_C32(0x5b4296b7), SPH_C32(0x315f30f7), SPH_C32(0x1ab70000), + SPH_C32(0x99220000), SPH_C32(0xcff9000a), SPH_C32(0x386c1800), + SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), SPH_C32(0x75da660b), + SPH_C32(0x8e008768) }, + { SPH_C32(0xb8610000), SPH_C32(0x3f540000), SPH_C32(0x06bd001e), + SPH_C32(0xd3cf1800), SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), + SPH_C32(0x76936cf1), SPH_C32(0x156e7fe0), SPH_C32(0x42f40000), + SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), SPH_C32(0xfe072000), + SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), SPH_C32(0xd9a99864), + SPH_C32(0xb444fed9) }, + { SPH_C32(0xe0220000), SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), + SPH_C32(0x15a42000), SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), + SPH_C32(0xdae0929e), SPH_C32(0x2f2a0651), SPH_C32(0x5fae0000), + SPH_C32(0x322e0000), SPH_C32(0xff47000b), SPH_C32(0x51663800), + SPH_C32(0xa4457f72), SPH_C32(0x316a5179), SPH_C32(0x580b9c4d), + SPH_C32(0xaa31c87f) }, + { SPH_C32(0x07ed0000), SPH_C32(0xb2500000), SPH_C32(0x8774000a), + SPH_C32(0x970d0000), SPH_C32(0x437223ae), SPH_C32(0x48c76ea4), + SPH_C32(0xf4786222), SPH_C32(0x9075b1ce), SPH_C32(0xa2d60000), + SPH_C32(0xa6760000), SPH_C32(0xc9440014), SPH_C32(0xeba30000), + SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), SPH_C32(0x03490afa), + SPH_C32(0x9b6ef888) }, + { SPH_C32(0x5fae0000), SPH_C32(0x322e0000), SPH_C32(0xff47000b), + SPH_C32(0x51663800), SPH_C32(0xa4457f72), SPH_C32(0x316a5179), + SPH_C32(0x580b9c4d), SPH_C32(0xaa31c87f), SPH_C32(0xbf8c0000), + SPH_C32(0x8d040000), SPH_C32(0x81c90014), SPH_C32(0x44c21800), + SPH_C32(0xe92700be), SPH_C32(0xf8617b49), SPH_C32(0x82eb0ed3), + SPH_C32(0x851bce2e) }, + { SPH_C32(0x1ab70000), SPH_C32(0x99220000), SPH_C32(0xcff9000a), + SPH_C32(0x386c1800), SPH_C32(0x66b90d6b), SPH_C32(0x80bed174), + SPH_C32(0x75da660b), SPH_C32(0x8e008768), SPH_C32(0xe7cf0000), + SPH_C32(0x0d7a0000), SPH_C32(0xf9fa0015), SPH_C32(0x82a92000), + SPH_C32(0x0e105c62), SPH_C32(0x81cc4494), SPH_C32(0x2e98f0bc), + SPH_C32(0xbf5fb79f) }, + { SPH_C32(0x42f40000), SPH_C32(0x195c0000), SPH_C32(0xb7ca000b), + SPH_C32(0xfe072000), SPH_C32(0x818e51b7), SPH_C32(0xf913eea9), + SPH_C32(0xd9a99864), SPH_C32(0xb444fed9), SPH_C32(0xfa950000), + SPH_C32(0x26080000), SPH_C32(0xb1770015), SPH_C32(0x2dc83800), + SPH_C32(0x2bdb72a7), SPH_C32(0x49b5fb44), SPH_C32(0xaf3af495), + SPH_C32(0xa12a8139) }, + { SPH_C32(0xa2d60000), SPH_C32(0xa6760000), SPH_C32(0xc9440014), + SPH_C32(0xeba30000), SPH_C32(0xccec2e7b), SPH_C32(0x3018c499), + SPH_C32(0x03490afa), SPH_C32(0x9b6ef888), SPH_C32(0xa53b0000), + SPH_C32(0x14260000), SPH_C32(0x4e30001e), SPH_C32(0x7cae0000), + SPH_C32(0x8f9e0dd5), SPH_C32(0x78dfaa3d), SPH_C32(0xf73168d8), + SPH_C32(0x0b1b4946) }, + { SPH_C32(0xfa950000), SPH_C32(0x26080000), SPH_C32(0xb1770015), + SPH_C32(0x2dc83800), SPH_C32(0x2bdb72a7), SPH_C32(0x49b5fb44), + SPH_C32(0xaf3af495), SPH_C32(0xa12a8139), SPH_C32(0xb8610000), + SPH_C32(0x3f540000), SPH_C32(0x06bd001e), SPH_C32(0xd3cf1800), + SPH_C32(0xaa552310), SPH_C32(0xb0a615ed), SPH_C32(0x76936cf1), + SPH_C32(0x156e7fe0) }, + { SPH_C32(0xbf8c0000), SPH_C32(0x8d040000), SPH_C32(0x81c90014), + SPH_C32(0x44c21800), SPH_C32(0xe92700be), SPH_C32(0xf8617b49), + SPH_C32(0x82eb0ed3), SPH_C32(0x851bce2e), SPH_C32(0xe0220000), + SPH_C32(0xbf2a0000), SPH_C32(0x7e8e001f), SPH_C32(0x15a42000), + SPH_C32(0x4d627fcc), SPH_C32(0xc90b2a30), SPH_C32(0xdae0929e), + SPH_C32(0x2f2a0651) }, + { SPH_C32(0xe7cf0000), SPH_C32(0x0d7a0000), SPH_C32(0xf9fa0015), + SPH_C32(0x82a92000), SPH_C32(0x0e105c62), SPH_C32(0x81cc4494), + SPH_C32(0x2e98f0bc), SPH_C32(0xbf5fb79f), SPH_C32(0xfd780000), + SPH_C32(0x94580000), SPH_C32(0x3603001f), SPH_C32(0xbac53800), + SPH_C32(0x68a95109), SPH_C32(0x017295e0), SPH_C32(0x5b4296b7), + SPH_C32(0x315f30f7) }, + { SPH_C32(0x88980000), SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), + SPH_C32(0xfb4e0000), SPH_C32(0xf158079a), SPH_C32(0x61ae9167), + SPH_C32(0xa895706c), SPH_C32(0xe6107494), SPH_C32(0x0bc20000), + SPH_C32(0xdb630000), SPH_C32(0x7e88000c), SPH_C32(0x15860000), + SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), SPH_C32(0xf460449e), + SPH_C32(0xd8b61463) }, + { SPH_C32(0xd0db0000), SPH_C32(0x9fea0000), SPH_C32(0x07fc002f), + SPH_C32(0x3d253800), SPH_C32(0x166f5b46), SPH_C32(0x1803aeba), + SPH_C32(0x04e68e03), SPH_C32(0xdc540d25), SPH_C32(0x16980000), + SPH_C32(0xf0110000), SPH_C32(0x3605000c), SPH_C32(0xbae71800), + SPH_C32(0xb4366636), SPH_C32(0xbdf80493), SPH_C32(0x75c240b7), + SPH_C32(0xc6c322c5) }, + { SPH_C32(0x95c20000), SPH_C32(0x34e60000), SPH_C32(0x3742002e), + SPH_C32(0x542f1800), SPH_C32(0xd493295f), SPH_C32(0xa9d72eb7), + SPH_C32(0x29377445), SPH_C32(0xf8654232), SPH_C32(0x4edb0000), + SPH_C32(0x706f0000), SPH_C32(0x4e36000d), SPH_C32(0x7c8c2000), + SPH_C32(0x53013aea), SPH_C32(0xc4553b4e), SPH_C32(0xd9b1bed8), + SPH_C32(0xfc875b74) }, + { SPH_C32(0xcd810000), SPH_C32(0xb4980000), SPH_C32(0x4f71002f), + SPH_C32(0x92442000), SPH_C32(0x33a47583), SPH_C32(0xd07a116a), + SPH_C32(0x85448a2a), SPH_C32(0xc2213b83), SPH_C32(0x53810000), + SPH_C32(0x5b1d0000), SPH_C32(0x06bb000d), SPH_C32(0xd3ed3800), + SPH_C32(0x76ca142f), SPH_C32(0x0c2c849e), SPH_C32(0x5813baf1), + SPH_C32(0xe2f26dd2) }, + { SPH_C32(0x2da30000), SPH_C32(0x0bb20000), SPH_C32(0x31ff0030), + SPH_C32(0x87e00000), SPH_C32(0x7ec60a4f), SPH_C32(0x19713b5a), + SPH_C32(0x5fa418b4), SPH_C32(0xed0b3dd2), SPH_C32(0x0c2f0000), + SPH_C32(0x69330000), SPH_C32(0xf9fc0006), SPH_C32(0x828b0000), + SPH_C32(0xd28f6b5d), SPH_C32(0x3d46d5e7), SPH_C32(0x001826bc), + SPH_C32(0x48c3a5ad) }, + { SPH_C32(0x75e00000), SPH_C32(0x8bcc0000), SPH_C32(0x49cc0031), + SPH_C32(0x418b3800), SPH_C32(0x99f15693), SPH_C32(0x60dc0487), + SPH_C32(0xf3d7e6db), SPH_C32(0xd74f4463), SPH_C32(0x11750000), + SPH_C32(0x42410000), SPH_C32(0xb1710006), SPH_C32(0x2dea1800), + SPH_C32(0xf7444598), SPH_C32(0xf53f6a37), SPH_C32(0x81ba2295), + SPH_C32(0x56b6930b) }, + { SPH_C32(0x30f90000), SPH_C32(0x20c00000), SPH_C32(0x79720030), + SPH_C32(0x28811800), SPH_C32(0x5b0d248a), SPH_C32(0xd108848a), + SPH_C32(0xde061c9d), SPH_C32(0xf37e0b74), SPH_C32(0x49360000), + SPH_C32(0xc23f0000), SPH_C32(0xc9420007), SPH_C32(0xeb812000), + SPH_C32(0x10731944), SPH_C32(0x8c9255ea), SPH_C32(0x2dc9dcfa), + SPH_C32(0x6cf2eaba) }, + { SPH_C32(0x68ba0000), SPH_C32(0xa0be0000), SPH_C32(0x01410031), + SPH_C32(0xeeea2000), SPH_C32(0xbc3a7856), SPH_C32(0xa8a5bb57), + SPH_C32(0x7275e2f2), SPH_C32(0xc93a72c5), SPH_C32(0x546c0000), + SPH_C32(0xe94d0000), SPH_C32(0x81cf0007), SPH_C32(0x44e03800), + SPH_C32(0x35b83781), SPH_C32(0x44ebea3a), SPH_C32(0xac6bd8d3), + SPH_C32(0x7287dc1c) }, + { SPH_C32(0x8f750000), SPH_C32(0xadc40000), SPH_C32(0xf8bb0024), + SPH_C32(0x6c430000), SPH_C32(0xb22a2434), SPH_C32(0x2969ffc3), + SPH_C32(0x5ced124e), SPH_C32(0x7665c55a), SPH_C32(0xa9140000), + SPH_C32(0x7d150000), SPH_C32(0xb7cc0018), SPH_C32(0xfe250000), + SPH_C32(0x5d116688), SPH_C32(0x45997fda), SPH_C32(0xf7294e64), + SPH_C32(0x43d8eceb) }, + { SPH_C32(0xd7360000), SPH_C32(0x2dba0000), SPH_C32(0x80880025), + SPH_C32(0xaa283800), SPH_C32(0x551d78e8), SPH_C32(0x50c4c01e), + SPH_C32(0xf09eec21), SPH_C32(0x4c21bceb), SPH_C32(0xb44e0000), + SPH_C32(0x56670000), SPH_C32(0xff410018), SPH_C32(0x51441800), + SPH_C32(0x78da484d), SPH_C32(0x8de0c00a), SPH_C32(0x768b4a4d), + SPH_C32(0x5dadda4d) }, + { SPH_C32(0x922f0000), SPH_C32(0x86b60000), SPH_C32(0xb0360024), + SPH_C32(0xc3221800), SPH_C32(0x97e10af1), SPH_C32(0xe1104013), + SPH_C32(0xdd4f1667), SPH_C32(0x6810f3fc), SPH_C32(0xec0d0000), + SPH_C32(0xd6190000), SPH_C32(0x87720019), SPH_C32(0x972f2000), + SPH_C32(0x9fed1491), SPH_C32(0xf44dffd7), SPH_C32(0xdaf8b422), + SPH_C32(0x67e9a3fc) }, + { SPH_C32(0xca6c0000), SPH_C32(0x06c80000), SPH_C32(0xc8050025), + SPH_C32(0x05492000), SPH_C32(0x70d6562d), SPH_C32(0x98bd7fce), + SPH_C32(0x713ce808), SPH_C32(0x52548a4d), SPH_C32(0xf1570000), + SPH_C32(0xfd6b0000), SPH_C32(0xcfff0019), SPH_C32(0x384e3800), + SPH_C32(0xba263a54), SPH_C32(0x3c344007), SPH_C32(0x5b5ab00b), + SPH_C32(0x799c955a) }, + { SPH_C32(0x2a4e0000), SPH_C32(0xb9e20000), SPH_C32(0xb68b003a), + SPH_C32(0x10ed0000), SPH_C32(0x3db429e1), SPH_C32(0x51b655fe), + SPH_C32(0xabdc7a96), SPH_C32(0x7d7e8c1c), SPH_C32(0xaef90000), + SPH_C32(0xcf450000), SPH_C32(0x30b80012), SPH_C32(0x69280000), + SPH_C32(0x1e634526), SPH_C32(0x0d5e117e), SPH_C32(0x03512c46), + SPH_C32(0xd3ad5d25) }, + { SPH_C32(0x720d0000), SPH_C32(0x399c0000), SPH_C32(0xceb8003b), + SPH_C32(0xd6863800), SPH_C32(0xda83753d), SPH_C32(0x281b6a23), + SPH_C32(0x07af84f9), SPH_C32(0x473af5ad), SPH_C32(0xb3a30000), + SPH_C32(0xe4370000), SPH_C32(0x78350012), SPH_C32(0xc6491800), + SPH_C32(0x3ba86be3), SPH_C32(0xc527aeae), SPH_C32(0x82f3286f), + SPH_C32(0xcdd86b83) }, + { SPH_C32(0x37140000), SPH_C32(0x92900000), SPH_C32(0xfe06003a), + SPH_C32(0xbf8c1800), SPH_C32(0x187f0724), SPH_C32(0x99cfea2e), + SPH_C32(0x2a7e7ebf), SPH_C32(0x630bbaba), SPH_C32(0xebe00000), + SPH_C32(0x64490000), SPH_C32(0x00060013), SPH_C32(0x00222000), + SPH_C32(0xdc9f373f), SPH_C32(0xbc8a9173), SPH_C32(0x2e80d600), + SPH_C32(0xf79c1232) }, + { SPH_C32(0x6f570000), SPH_C32(0x12ee0000), SPH_C32(0x8635003b), + SPH_C32(0x79e72000), SPH_C32(0xff485bf8), SPH_C32(0xe062d5f3), + SPH_C32(0x860d80d0), SPH_C32(0x594fc30b), SPH_C32(0xf6ba0000), + SPH_C32(0x4f3b0000), SPH_C32(0x488b0013), SPH_C32(0xaf433800), + SPH_C32(0xf95419fa), SPH_C32(0x74f32ea3), SPH_C32(0xaf22d229), + SPH_C32(0xe9e92494) }, + { SPH_C32(0x0bc20000), SPH_C32(0xdb630000), SPH_C32(0x7e88000c), + SPH_C32(0x15860000), SPH_C32(0x91fd48f3), SPH_C32(0x7581bb43), + SPH_C32(0xf460449e), SPH_C32(0xd8b61463), SPH_C32(0x835a0000), + SPH_C32(0xc4f70000), SPH_C32(0x01470022), SPH_C32(0xeec80000), + SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), SPH_C32(0x5cf534f2), + SPH_C32(0x3ea660f7) }, + { SPH_C32(0x53810000), SPH_C32(0x5b1d0000), SPH_C32(0x06bb000d), + SPH_C32(0xd3ed3800), SPH_C32(0x76ca142f), SPH_C32(0x0c2c849e), + SPH_C32(0x5813baf1), SPH_C32(0xe2f26dd2), SPH_C32(0x9e000000), + SPH_C32(0xef850000), SPH_C32(0x49ca0022), SPH_C32(0x41a91800), + SPH_C32(0x456e61ac), SPH_C32(0xdc5695f4), SPH_C32(0xdd5730db), + SPH_C32(0x20d35651) }, + { SPH_C32(0x16980000), SPH_C32(0xf0110000), SPH_C32(0x3605000c), + SPH_C32(0xbae71800), SPH_C32(0xb4366636), SPH_C32(0xbdf80493), + SPH_C32(0x75c240b7), SPH_C32(0xc6c322c5), SPH_C32(0xc6430000), + SPH_C32(0x6ffb0000), SPH_C32(0x31f90023), SPH_C32(0x87c22000), + SPH_C32(0xa2593d70), SPH_C32(0xa5fbaa29), SPH_C32(0x7124ceb4), + SPH_C32(0x1a972fe0) }, + { SPH_C32(0x4edb0000), SPH_C32(0x706f0000), SPH_C32(0x4e36000d), + SPH_C32(0x7c8c2000), SPH_C32(0x53013aea), SPH_C32(0xc4553b4e), + SPH_C32(0xd9b1bed8), SPH_C32(0xfc875b74), SPH_C32(0xdb190000), + SPH_C32(0x44890000), SPH_C32(0x79740023), SPH_C32(0x28a33800), + SPH_C32(0x879213b5), SPH_C32(0x6d8215f9), SPH_C32(0xf086ca9d), + SPH_C32(0x04e21946) }, + { SPH_C32(0xaef90000), SPH_C32(0xcf450000), SPH_C32(0x30b80012), + SPH_C32(0x69280000), SPH_C32(0x1e634526), SPH_C32(0x0d5e117e), + SPH_C32(0x03512c46), SPH_C32(0xd3ad5d25), SPH_C32(0x84b70000), + SPH_C32(0x76a70000), SPH_C32(0x86330028), SPH_C32(0x79c50000), + SPH_C32(0x23d76cc7), SPH_C32(0x5ce84480), SPH_C32(0xa88d56d0), + SPH_C32(0xaed3d139) }, + { SPH_C32(0xf6ba0000), SPH_C32(0x4f3b0000), SPH_C32(0x488b0013), + SPH_C32(0xaf433800), SPH_C32(0xf95419fa), SPH_C32(0x74f32ea3), + SPH_C32(0xaf22d229), SPH_C32(0xe9e92494), SPH_C32(0x99ed0000), + SPH_C32(0x5dd50000), SPH_C32(0xcebe0028), SPH_C32(0xd6a41800), + SPH_C32(0x061c4202), SPH_C32(0x9491fb50), SPH_C32(0x292f52f9), + SPH_C32(0xb0a6e79f) }, + { SPH_C32(0xb3a30000), SPH_C32(0xe4370000), SPH_C32(0x78350012), + SPH_C32(0xc6491800), SPH_C32(0x3ba86be3), SPH_C32(0xc527aeae), + SPH_C32(0x82f3286f), SPH_C32(0xcdd86b83), SPH_C32(0xc1ae0000), + SPH_C32(0xddab0000), SPH_C32(0xb68d0029), SPH_C32(0x10cf2000), + SPH_C32(0xe12b1ede), SPH_C32(0xed3cc48d), SPH_C32(0x855cac96), + SPH_C32(0x8ae29e2e) }, + { SPH_C32(0xebe00000), SPH_C32(0x64490000), SPH_C32(0x00060013), + SPH_C32(0x00222000), SPH_C32(0xdc9f373f), SPH_C32(0xbc8a9173), + SPH_C32(0x2e80d600), SPH_C32(0xf79c1232), SPH_C32(0xdcf40000), + SPH_C32(0xf6d90000), SPH_C32(0xfe000029), SPH_C32(0xbfae3800), + SPH_C32(0xc4e0301b), SPH_C32(0x25457b5d), SPH_C32(0x04fea8bf), + SPH_C32(0x9497a888) }, + { SPH_C32(0x0c2f0000), SPH_C32(0x69330000), SPH_C32(0xf9fc0006), + SPH_C32(0x828b0000), SPH_C32(0xd28f6b5d), SPH_C32(0x3d46d5e7), + SPH_C32(0x001826bc), SPH_C32(0x48c3a5ad), SPH_C32(0x218c0000), + SPH_C32(0x62810000), SPH_C32(0xc8030036), SPH_C32(0x056b0000), + SPH_C32(0xac496112), SPH_C32(0x2437eebd), SPH_C32(0x5fbc3e08), + SPH_C32(0xa5c8987f) }, + { SPH_C32(0x546c0000), SPH_C32(0xe94d0000), SPH_C32(0x81cf0007), + SPH_C32(0x44e03800), SPH_C32(0x35b83781), SPH_C32(0x44ebea3a), + SPH_C32(0xac6bd8d3), SPH_C32(0x7287dc1c), SPH_C32(0x3cd60000), + SPH_C32(0x49f30000), SPH_C32(0x808e0036), SPH_C32(0xaa0a1800), + SPH_C32(0x89824fd7), SPH_C32(0xec4e516d), SPH_C32(0xde1e3a21), + SPH_C32(0xbbbdaed9) }, + { SPH_C32(0x11750000), SPH_C32(0x42410000), SPH_C32(0xb1710006), + SPH_C32(0x2dea1800), SPH_C32(0xf7444598), SPH_C32(0xf53f6a37), + SPH_C32(0x81ba2295), SPH_C32(0x56b6930b), SPH_C32(0x64950000), + SPH_C32(0xc98d0000), SPH_C32(0xf8bd0037), SPH_C32(0x6c612000), + SPH_C32(0x6eb5130b), SPH_C32(0x95e36eb0), SPH_C32(0x726dc44e), + SPH_C32(0x81f9d768) }, + { SPH_C32(0x49360000), SPH_C32(0xc23f0000), SPH_C32(0xc9420007), + SPH_C32(0xeb812000), SPH_C32(0x10731944), SPH_C32(0x8c9255ea), + SPH_C32(0x2dc9dcfa), SPH_C32(0x6cf2eaba), SPH_C32(0x79cf0000), + SPH_C32(0xe2ff0000), SPH_C32(0xb0300037), SPH_C32(0xc3003800), + SPH_C32(0x4b7e3dce), SPH_C32(0x5d9ad160), SPH_C32(0xf3cfc067), + SPH_C32(0x9f8ce1ce) }, + { SPH_C32(0xa9140000), SPH_C32(0x7d150000), SPH_C32(0xb7cc0018), + SPH_C32(0xfe250000), SPH_C32(0x5d116688), SPH_C32(0x45997fda), + SPH_C32(0xf7294e64), SPH_C32(0x43d8eceb), SPH_C32(0x26610000), + SPH_C32(0xd0d10000), SPH_C32(0x4f77003c), SPH_C32(0x92660000), + SPH_C32(0xef3b42bc), SPH_C32(0x6cf08019), SPH_C32(0xabc45c2a), + SPH_C32(0x35bd29b1) }, + { SPH_C32(0xf1570000), SPH_C32(0xfd6b0000), SPH_C32(0xcfff0019), + SPH_C32(0x384e3800), SPH_C32(0xba263a54), SPH_C32(0x3c344007), + SPH_C32(0x5b5ab00b), SPH_C32(0x799c955a), SPH_C32(0x3b3b0000), + SPH_C32(0xfba30000), SPH_C32(0x07fa003c), SPH_C32(0x3d071800), + SPH_C32(0xcaf06c79), SPH_C32(0xa4893fc9), SPH_C32(0x2a665803), + SPH_C32(0x2bc81f17) }, + { SPH_C32(0xb44e0000), SPH_C32(0x56670000), SPH_C32(0xff410018), + SPH_C32(0x51441800), SPH_C32(0x78da484d), SPH_C32(0x8de0c00a), + SPH_C32(0x768b4a4d), SPH_C32(0x5dadda4d), SPH_C32(0x63780000), + SPH_C32(0x7bdd0000), SPH_C32(0x7fc9003d), SPH_C32(0xfb6c2000), + SPH_C32(0x2dc730a5), SPH_C32(0xdd240014), SPH_C32(0x8615a66c), + SPH_C32(0x118c66a6) }, + { SPH_C32(0xec0d0000), SPH_C32(0xd6190000), SPH_C32(0x87720019), + SPH_C32(0x972f2000), SPH_C32(0x9fed1491), SPH_C32(0xf44dffd7), + SPH_C32(0xdaf8b422), SPH_C32(0x67e9a3fc), SPH_C32(0x7e220000), + SPH_C32(0x50af0000), SPH_C32(0x3744003d), SPH_C32(0x540d3800), + SPH_C32(0x080c1e60), SPH_C32(0x155dbfc4), SPH_C32(0x07b7a245), + SPH_C32(0x0ff95000) }, + { SPH_C32(0x835a0000), SPH_C32(0xc4f70000), SPH_C32(0x01470022), + SPH_C32(0xeec80000), SPH_C32(0x60a54f69), SPH_C32(0x142f2a24), + SPH_C32(0x5cf534f2), SPH_C32(0x3ea660f7), SPH_C32(0x88980000), + SPH_C32(0x1f940000), SPH_C32(0x7fcf002e), SPH_C32(0xfb4e0000), + SPH_C32(0xf158079a), SPH_C32(0x61ae9167), SPH_C32(0xa895706c), + SPH_C32(0xe6107494) }, + { SPH_C32(0xdb190000), SPH_C32(0x44890000), SPH_C32(0x79740023), + SPH_C32(0x28a33800), SPH_C32(0x879213b5), SPH_C32(0x6d8215f9), + SPH_C32(0xf086ca9d), SPH_C32(0x04e21946), SPH_C32(0x95c20000), + SPH_C32(0x34e60000), SPH_C32(0x3742002e), SPH_C32(0x542f1800), + SPH_C32(0xd493295f), SPH_C32(0xa9d72eb7), SPH_C32(0x29377445), + SPH_C32(0xf8654232) }, + { SPH_C32(0x9e000000), SPH_C32(0xef850000), SPH_C32(0x49ca0022), + SPH_C32(0x41a91800), SPH_C32(0x456e61ac), SPH_C32(0xdc5695f4), + SPH_C32(0xdd5730db), SPH_C32(0x20d35651), SPH_C32(0xcd810000), + SPH_C32(0xb4980000), SPH_C32(0x4f71002f), SPH_C32(0x92442000), + SPH_C32(0x33a47583), SPH_C32(0xd07a116a), SPH_C32(0x85448a2a), + SPH_C32(0xc2213b83) }, + { SPH_C32(0xc6430000), SPH_C32(0x6ffb0000), SPH_C32(0x31f90023), + SPH_C32(0x87c22000), SPH_C32(0xa2593d70), SPH_C32(0xa5fbaa29), + SPH_C32(0x7124ceb4), SPH_C32(0x1a972fe0), SPH_C32(0xd0db0000), + SPH_C32(0x9fea0000), SPH_C32(0x07fc002f), SPH_C32(0x3d253800), + SPH_C32(0x166f5b46), SPH_C32(0x1803aeba), SPH_C32(0x04e68e03), + SPH_C32(0xdc540d25) }, + { SPH_C32(0x26610000), SPH_C32(0xd0d10000), SPH_C32(0x4f77003c), + SPH_C32(0x92660000), SPH_C32(0xef3b42bc), SPH_C32(0x6cf08019), + SPH_C32(0xabc45c2a), SPH_C32(0x35bd29b1), SPH_C32(0x8f750000), + SPH_C32(0xadc40000), SPH_C32(0xf8bb0024), SPH_C32(0x6c430000), + SPH_C32(0xb22a2434), SPH_C32(0x2969ffc3), SPH_C32(0x5ced124e), + SPH_C32(0x7665c55a) }, + { SPH_C32(0x7e220000), SPH_C32(0x50af0000), SPH_C32(0x3744003d), + SPH_C32(0x540d3800), SPH_C32(0x080c1e60), SPH_C32(0x155dbfc4), + SPH_C32(0x07b7a245), SPH_C32(0x0ff95000), SPH_C32(0x922f0000), + SPH_C32(0x86b60000), SPH_C32(0xb0360024), SPH_C32(0xc3221800), + SPH_C32(0x97e10af1), SPH_C32(0xe1104013), SPH_C32(0xdd4f1667), + SPH_C32(0x6810f3fc) }, + { SPH_C32(0x3b3b0000), SPH_C32(0xfba30000), SPH_C32(0x07fa003c), + SPH_C32(0x3d071800), SPH_C32(0xcaf06c79), SPH_C32(0xa4893fc9), + SPH_C32(0x2a665803), SPH_C32(0x2bc81f17), SPH_C32(0xca6c0000), + SPH_C32(0x06c80000), SPH_C32(0xc8050025), SPH_C32(0x05492000), + SPH_C32(0x70d6562d), SPH_C32(0x98bd7fce), SPH_C32(0x713ce808), + SPH_C32(0x52548a4d) }, + { SPH_C32(0x63780000), SPH_C32(0x7bdd0000), SPH_C32(0x7fc9003d), + SPH_C32(0xfb6c2000), SPH_C32(0x2dc730a5), SPH_C32(0xdd240014), + SPH_C32(0x8615a66c), SPH_C32(0x118c66a6), SPH_C32(0xd7360000), + SPH_C32(0x2dba0000), SPH_C32(0x80880025), SPH_C32(0xaa283800), + SPH_C32(0x551d78e8), SPH_C32(0x50c4c01e), SPH_C32(0xf09eec21), + SPH_C32(0x4c21bceb) }, + { SPH_C32(0x84b70000), SPH_C32(0x76a70000), SPH_C32(0x86330028), + SPH_C32(0x79c50000), SPH_C32(0x23d76cc7), SPH_C32(0x5ce84480), + SPH_C32(0xa88d56d0), SPH_C32(0xaed3d139), SPH_C32(0x2a4e0000), + SPH_C32(0xb9e20000), SPH_C32(0xb68b003a), SPH_C32(0x10ed0000), + SPH_C32(0x3db429e1), SPH_C32(0x51b655fe), SPH_C32(0xabdc7a96), + SPH_C32(0x7d7e8c1c) }, + { SPH_C32(0xdcf40000), SPH_C32(0xf6d90000), SPH_C32(0xfe000029), + SPH_C32(0xbfae3800), SPH_C32(0xc4e0301b), SPH_C32(0x25457b5d), + SPH_C32(0x04fea8bf), SPH_C32(0x9497a888), SPH_C32(0x37140000), + SPH_C32(0x92900000), SPH_C32(0xfe06003a), SPH_C32(0xbf8c1800), + SPH_C32(0x187f0724), SPH_C32(0x99cfea2e), SPH_C32(0x2a7e7ebf), + SPH_C32(0x630bbaba) }, + { SPH_C32(0x99ed0000), SPH_C32(0x5dd50000), SPH_C32(0xcebe0028), + SPH_C32(0xd6a41800), SPH_C32(0x061c4202), SPH_C32(0x9491fb50), + SPH_C32(0x292f52f9), SPH_C32(0xb0a6e79f), SPH_C32(0x6f570000), + SPH_C32(0x12ee0000), SPH_C32(0x8635003b), SPH_C32(0x79e72000), + SPH_C32(0xff485bf8), SPH_C32(0xe062d5f3), SPH_C32(0x860d80d0), + SPH_C32(0x594fc30b) }, + { SPH_C32(0xc1ae0000), SPH_C32(0xddab0000), SPH_C32(0xb68d0029), + SPH_C32(0x10cf2000), SPH_C32(0xe12b1ede), SPH_C32(0xed3cc48d), + SPH_C32(0x855cac96), SPH_C32(0x8ae29e2e), SPH_C32(0x720d0000), + SPH_C32(0x399c0000), SPH_C32(0xceb8003b), SPH_C32(0xd6863800), + SPH_C32(0xda83753d), SPH_C32(0x281b6a23), SPH_C32(0x07af84f9), + SPH_C32(0x473af5ad) }, + { SPH_C32(0x218c0000), SPH_C32(0x62810000), SPH_C32(0xc8030036), + SPH_C32(0x056b0000), SPH_C32(0xac496112), SPH_C32(0x2437eebd), + SPH_C32(0x5fbc3e08), SPH_C32(0xa5c8987f), SPH_C32(0x2da30000), + SPH_C32(0x0bb20000), SPH_C32(0x31ff0030), SPH_C32(0x87e00000), + SPH_C32(0x7ec60a4f), SPH_C32(0x19713b5a), SPH_C32(0x5fa418b4), + SPH_C32(0xed0b3dd2) }, + { SPH_C32(0x79cf0000), SPH_C32(0xe2ff0000), SPH_C32(0xb0300037), + SPH_C32(0xc3003800), SPH_C32(0x4b7e3dce), SPH_C32(0x5d9ad160), + SPH_C32(0xf3cfc067), SPH_C32(0x9f8ce1ce), SPH_C32(0x30f90000), + SPH_C32(0x20c00000), SPH_C32(0x79720030), SPH_C32(0x28811800), + SPH_C32(0x5b0d248a), SPH_C32(0xd108848a), SPH_C32(0xde061c9d), + SPH_C32(0xf37e0b74) }, + { SPH_C32(0x3cd60000), SPH_C32(0x49f30000), SPH_C32(0x808e0036), + SPH_C32(0xaa0a1800), SPH_C32(0x89824fd7), SPH_C32(0xec4e516d), + SPH_C32(0xde1e3a21), SPH_C32(0xbbbdaed9), SPH_C32(0x68ba0000), + SPH_C32(0xa0be0000), SPH_C32(0x01410031), SPH_C32(0xeeea2000), + SPH_C32(0xbc3a7856), SPH_C32(0xa8a5bb57), SPH_C32(0x7275e2f2), + SPH_C32(0xc93a72c5) }, + { SPH_C32(0x64950000), SPH_C32(0xc98d0000), SPH_C32(0xf8bd0037), + SPH_C32(0x6c612000), SPH_C32(0x6eb5130b), SPH_C32(0x95e36eb0), + SPH_C32(0x726dc44e), SPH_C32(0x81f9d768), SPH_C32(0x75e00000), + SPH_C32(0x8bcc0000), SPH_C32(0x49cc0031), SPH_C32(0x418b3800), + SPH_C32(0x99f15693), SPH_C32(0x60dc0487), SPH_C32(0xf3d7e6db), + SPH_C32(0xd74f4463) }, + { SPH_C32(0x52500000), SPH_C32(0x29540000), SPH_C32(0x6a61004e), + SPH_C32(0xf0ff0000), SPH_C32(0x9a317eec), SPH_C32(0x452341ce), + SPH_C32(0xcf568fe5), SPH_C32(0x5303130f), SPH_C32(0x538d0000), + SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), SPH_C32(0x56ff0000), + SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), SPH_C32(0xa9444018), + SPH_C32(0x7f975691) }, + { SPH_C32(0x0a130000), SPH_C32(0xa92a0000), SPH_C32(0x1252004f), + SPH_C32(0x36943800), SPH_C32(0x7d062230), SPH_C32(0x3c8e7e13), + SPH_C32(0x6325718a), SPH_C32(0x69476abe), SPH_C32(0x4ed70000), + SPH_C32(0x828e0000), SPH_C32(0xd67a0006), SPH_C32(0xf99e1800), + SPH_C32(0x2f2f2e8b), SPH_C32(0x5abc7229), SPH_C32(0x28e64431), + SPH_C32(0x61e26037) }, + { SPH_C32(0x4f0a0000), SPH_C32(0x02260000), SPH_C32(0x22ec004e), + SPH_C32(0x5f9e1800), SPH_C32(0xbffa5029), SPH_C32(0x8d5afe1e), + SPH_C32(0x4ef48bcc), SPH_C32(0x4d7625a9), SPH_C32(0x16940000), + SPH_C32(0x02f00000), SPH_C32(0xae490007), SPH_C32(0x3ff52000), + SPH_C32(0xc8187257), SPH_C32(0x23114df4), SPH_C32(0x8495ba5e), + SPH_C32(0x5ba61986) }, + { SPH_C32(0x17490000), SPH_C32(0x82580000), SPH_C32(0x5adf004f), + SPH_C32(0x99f52000), SPH_C32(0x58cd0cf5), SPH_C32(0xf4f7c1c3), + SPH_C32(0xe28775a3), SPH_C32(0x77325c18), SPH_C32(0x0bce0000), + SPH_C32(0x29820000), SPH_C32(0xe6c40007), SPH_C32(0x90943800), + SPH_C32(0xedd35c92), SPH_C32(0xeb68f224), SPH_C32(0x0537be77), + SPH_C32(0x45d32f20) }, + { SPH_C32(0xf76b0000), SPH_C32(0x3d720000), SPH_C32(0x24510050), + SPH_C32(0x8c510000), SPH_C32(0x15af7339), SPH_C32(0x3dfcebf3), + SPH_C32(0x3867e73d), SPH_C32(0x58185a49), SPH_C32(0x54600000), + SPH_C32(0x1bac0000), SPH_C32(0x1983000c), SPH_C32(0xc1f20000), + SPH_C32(0x499623e0), SPH_C32(0xda02a35d), SPH_C32(0x5d3c223a), + SPH_C32(0xefe2e75f) }, + { SPH_C32(0xaf280000), SPH_C32(0xbd0c0000), SPH_C32(0x5c620051), + SPH_C32(0x4a3a3800), SPH_C32(0xf2982fe5), SPH_C32(0x4451d42e), + SPH_C32(0x94141952), SPH_C32(0x625c23f8), SPH_C32(0x493a0000), + SPH_C32(0x30de0000), SPH_C32(0x510e000c), SPH_C32(0x6e931800), + SPH_C32(0x6c5d0d25), SPH_C32(0x127b1c8d), SPH_C32(0xdc9e2613), + SPH_C32(0xf197d1f9) }, + { SPH_C32(0xea310000), SPH_C32(0x16000000), SPH_C32(0x6cdc0050), + SPH_C32(0x23301800), SPH_C32(0x30645dfc), SPH_C32(0xf5855423), + SPH_C32(0xb9c5e314), SPH_C32(0x466d6cef), SPH_C32(0x11790000), + SPH_C32(0xb0a00000), SPH_C32(0x293d000d), SPH_C32(0xa8f82000), + SPH_C32(0x8b6a51f9), SPH_C32(0x6bd62350), SPH_C32(0x70edd87c), + SPH_C32(0xcbd3a848) }, + { SPH_C32(0xb2720000), SPH_C32(0x967e0000), SPH_C32(0x14ef0051), + SPH_C32(0xe55b2000), SPH_C32(0xd7530120), SPH_C32(0x8c286bfe), + SPH_C32(0x15b61d7b), SPH_C32(0x7c29155e), SPH_C32(0x0c230000), + SPH_C32(0x9bd20000), SPH_C32(0x61b0000d), SPH_C32(0x07993800), + SPH_C32(0xaea17f3c), SPH_C32(0xa3af9c80), SPH_C32(0xf14fdc55), + SPH_C32(0xd5a69eee) }, + { SPH_C32(0x55bd0000), SPH_C32(0x9b040000), SPH_C32(0xed150044), + SPH_C32(0x67f20000), SPH_C32(0xd9435d42), SPH_C32(0x0de42f6a), + SPH_C32(0x3b2eedc7), SPH_C32(0xc376a2c1), SPH_C32(0xf15b0000), + SPH_C32(0x0f8a0000), SPH_C32(0x57b30012), SPH_C32(0xbd5c0000), + SPH_C32(0xc6082e35), SPH_C32(0xa2dd0960), SPH_C32(0xaa0d4ae2), + SPH_C32(0xe4f9ae19) }, + { SPH_C32(0x0dfe0000), SPH_C32(0x1b7a0000), SPH_C32(0x95260045), + SPH_C32(0xa1993800), SPH_C32(0x3e74019e), SPH_C32(0x744910b7), + SPH_C32(0x975d13a8), SPH_C32(0xf932db70), SPH_C32(0xec010000), + SPH_C32(0x24f80000), SPH_C32(0x1f3e0012), SPH_C32(0x123d1800), + SPH_C32(0xe3c300f0), SPH_C32(0x6aa4b6b0), SPH_C32(0x2baf4ecb), + SPH_C32(0xfa8c98bf) }, + { SPH_C32(0x48e70000), SPH_C32(0xb0760000), SPH_C32(0xa5980044), + SPH_C32(0xc8931800), SPH_C32(0xfc887387), SPH_C32(0xc59d90ba), + SPH_C32(0xba8ce9ee), SPH_C32(0xdd039467), SPH_C32(0xb4420000), + SPH_C32(0xa4860000), SPH_C32(0x670d0013), SPH_C32(0xd4562000), + SPH_C32(0x04f45c2c), SPH_C32(0x1309896d), SPH_C32(0x87dcb0a4), + SPH_C32(0xc0c8e10e) }, + { SPH_C32(0x10a40000), SPH_C32(0x30080000), SPH_C32(0xddab0045), + SPH_C32(0x0ef82000), SPH_C32(0x1bbf2f5b), SPH_C32(0xbc30af67), + SPH_C32(0x16ff1781), SPH_C32(0xe747edd6), SPH_C32(0xa9180000), + SPH_C32(0x8ff40000), SPH_C32(0x2f800013), SPH_C32(0x7b373800), + SPH_C32(0x213f72e9), SPH_C32(0xdb7036bd), SPH_C32(0x067eb48d), + SPH_C32(0xdebdd7a8) }, + { SPH_C32(0xf0860000), SPH_C32(0x8f220000), SPH_C32(0xa325005a), + SPH_C32(0x1b5c0000), SPH_C32(0x56dd5097), SPH_C32(0x753b8557), + SPH_C32(0xcc1f851f), SPH_C32(0xc86deb87), SPH_C32(0xf6b60000), + SPH_C32(0xbdda0000), SPH_C32(0xd0c70018), SPH_C32(0x2a510000), + SPH_C32(0x857a0d9b), SPH_C32(0xea1a67c4), SPH_C32(0x5e7528c0), + SPH_C32(0x748c1fd7) }, + { SPH_C32(0xa8c50000), SPH_C32(0x0f5c0000), SPH_C32(0xdb16005b), + SPH_C32(0xdd373800), SPH_C32(0xb1ea0c4b), SPH_C32(0x0c96ba8a), + SPH_C32(0x606c7b70), SPH_C32(0xf2299236), SPH_C32(0xebec0000), + SPH_C32(0x96a80000), SPH_C32(0x984a0018), SPH_C32(0x85301800), + SPH_C32(0xa0b1235e), SPH_C32(0x2263d814), SPH_C32(0xdfd72ce9), + SPH_C32(0x6af92971) }, + { SPH_C32(0xeddc0000), SPH_C32(0xa4500000), SPH_C32(0xeba8005a), + SPH_C32(0xb43d1800), SPH_C32(0x73167e52), SPH_C32(0xbd423a87), + SPH_C32(0x4dbd8136), SPH_C32(0xd618dd21), SPH_C32(0xb3af0000), + SPH_C32(0x16d60000), SPH_C32(0xe0790019), SPH_C32(0x435b2000), + SPH_C32(0x47867f82), SPH_C32(0x5bcee7c9), SPH_C32(0x73a4d286), + SPH_C32(0x50bd50c0) }, + { SPH_C32(0xb59f0000), SPH_C32(0x242e0000), SPH_C32(0x939b005b), + SPH_C32(0x72562000), SPH_C32(0x9421228e), SPH_C32(0xc4ef055a), + SPH_C32(0xe1ce7f59), SPH_C32(0xec5ca490), SPH_C32(0xaef50000), + SPH_C32(0x3da40000), SPH_C32(0xa8f40019), SPH_C32(0xec3a3800), + SPH_C32(0x624d5147), SPH_C32(0x93b75819), SPH_C32(0xf206d6af), + SPH_C32(0x4ec86666) }, + { SPH_C32(0xdac80000), SPH_C32(0x36c00000), SPH_C32(0x15ae0060), + SPH_C32(0x0bb10000), SPH_C32(0x6b697976), SPH_C32(0x248dd0a9), + SPH_C32(0x67c3ff89), SPH_C32(0xb513679b), SPH_C32(0x584f0000), + SPH_C32(0x729f0000), SPH_C32(0xe07f000a), SPH_C32(0x43790000), + SPH_C32(0x9b1948bd), SPH_C32(0xe74476ba), SPH_C32(0x5d240486), + SPH_C32(0xa72142f2) }, + { SPH_C32(0x828b0000), SPH_C32(0xb6be0000), SPH_C32(0x6d9d0061), + SPH_C32(0xcdda3800), SPH_C32(0x8c5e25aa), SPH_C32(0x5d20ef74), + SPH_C32(0xcbb001e6), SPH_C32(0x8f571e2a), SPH_C32(0x45150000), + SPH_C32(0x59ed0000), SPH_C32(0xa8f2000a), SPH_C32(0xec181800), + SPH_C32(0xbed26678), SPH_C32(0x2f3dc96a), SPH_C32(0xdc8600af), + SPH_C32(0xb9547454) }, + { SPH_C32(0xc7920000), SPH_C32(0x1db20000), SPH_C32(0x5d230060), + SPH_C32(0xa4d01800), SPH_C32(0x4ea257b3), SPH_C32(0xecf46f79), + SPH_C32(0xe661fba0), SPH_C32(0xab66513d), SPH_C32(0x1d560000), + SPH_C32(0xd9930000), SPH_C32(0xd0c1000b), SPH_C32(0x2a732000), + SPH_C32(0x59e53aa4), SPH_C32(0x5690f6b7), SPH_C32(0x70f5fec0), + SPH_C32(0x83100de5) }, + { SPH_C32(0x9fd10000), SPH_C32(0x9dcc0000), SPH_C32(0x25100061), + SPH_C32(0x62bb2000), SPH_C32(0xa9950b6f), SPH_C32(0x955950a4), + SPH_C32(0x4a1205cf), SPH_C32(0x9122288c), SPH_C32(0x000c0000), + SPH_C32(0xf2e10000), SPH_C32(0x984c000b), SPH_C32(0x85123800), + SPH_C32(0x7c2e1461), SPH_C32(0x9ee94967), SPH_C32(0xf157fae9), + SPH_C32(0x9d653b43) }, + { SPH_C32(0x7ff30000), SPH_C32(0x22e60000), SPH_C32(0x5b9e007e), + SPH_C32(0x771f0000), SPH_C32(0xe4f774a3), SPH_C32(0x5c527a94), + SPH_C32(0x90f29751), SPH_C32(0xbe082edd), SPH_C32(0x5fa20000), + SPH_C32(0xc0cf0000), SPH_C32(0x670b0000), SPH_C32(0xd4740000), + SPH_C32(0xd86b6b13), SPH_C32(0xaf83181e), SPH_C32(0xa95c66a4), + SPH_C32(0x3754f33c) }, + { SPH_C32(0x27b00000), SPH_C32(0xa2980000), SPH_C32(0x23ad007f), + SPH_C32(0xb1743800), SPH_C32(0x03c0287f), SPH_C32(0x25ff4549), + SPH_C32(0x3c81693e), SPH_C32(0x844c576c), SPH_C32(0x42f80000), + SPH_C32(0xebbd0000), SPH_C32(0x2f860000), SPH_C32(0x7b151800), + SPH_C32(0xfda045d6), SPH_C32(0x67faa7ce), SPH_C32(0x28fe628d), + SPH_C32(0x2921c59a) }, + { SPH_C32(0x62a90000), SPH_C32(0x09940000), SPH_C32(0x1313007e), + SPH_C32(0xd87e1800), SPH_C32(0xc13c5a66), SPH_C32(0x942bc544), + SPH_C32(0x11509378), SPH_C32(0xa07d187b), SPH_C32(0x1abb0000), + SPH_C32(0x6bc30000), SPH_C32(0x57b50001), SPH_C32(0xbd7e2000), + SPH_C32(0x1a97190a), SPH_C32(0x1e579813), SPH_C32(0x848d9ce2), + SPH_C32(0x1365bc2b) }, + { SPH_C32(0x3aea0000), SPH_C32(0x89ea0000), SPH_C32(0x6b20007f), + SPH_C32(0x1e152000), SPH_C32(0x260b06ba), SPH_C32(0xed86fa99), + SPH_C32(0xbd236d17), SPH_C32(0x9a3961ca), SPH_C32(0x07e10000), + SPH_C32(0x40b10000), SPH_C32(0x1f380001), SPH_C32(0x121f3800), + SPH_C32(0x3f5c37cf), SPH_C32(0xd62e27c3), SPH_C32(0x052f98cb), + SPH_C32(0x0d108a8d) }, + { SPH_C32(0xdd250000), SPH_C32(0x84900000), SPH_C32(0x92da006a), + SPH_C32(0x9cbc0000), SPH_C32(0x281b5ad8), SPH_C32(0x6c4abe0d), + SPH_C32(0x93bb9dab), SPH_C32(0x2566d655), SPH_C32(0xfa990000), + SPH_C32(0xd4e90000), SPH_C32(0x293b001e), SPH_C32(0xa8da0000), + SPH_C32(0x57f566c6), SPH_C32(0xd75cb223), SPH_C32(0x5e6d0e7c), + SPH_C32(0x3c4fba7a) }, + { SPH_C32(0x85660000), SPH_C32(0x04ee0000), SPH_C32(0xeae9006b), + SPH_C32(0x5ad73800), SPH_C32(0xcf2c0604), SPH_C32(0x15e781d0), + SPH_C32(0x3fc863c4), SPH_C32(0x1f22afe4), SPH_C32(0xe7c30000), + SPH_C32(0xff9b0000), SPH_C32(0x61b6001e), SPH_C32(0x07bb1800), + SPH_C32(0x723e4803), SPH_C32(0x1f250df3), SPH_C32(0xdfcf0a55), + SPH_C32(0x223a8cdc) }, + { SPH_C32(0xc07f0000), SPH_C32(0xafe20000), SPH_C32(0xda57006a), + SPH_C32(0x33dd1800), SPH_C32(0x0dd0741d), SPH_C32(0xa43301dd), + SPH_C32(0x12199982), SPH_C32(0x3b13e0f3), SPH_C32(0xbf800000), + SPH_C32(0x7fe50000), SPH_C32(0x1985001f), SPH_C32(0xc1d02000), + SPH_C32(0x950914df), SPH_C32(0x6688322e), SPH_C32(0x73bcf43a), + SPH_C32(0x187ef56d) }, + { SPH_C32(0x983c0000), SPH_C32(0x2f9c0000), SPH_C32(0xa264006b), + SPH_C32(0xf5b62000), SPH_C32(0xeae728c1), SPH_C32(0xdd9e3e00), + SPH_C32(0xbe6a67ed), SPH_C32(0x01579942), SPH_C32(0xa2da0000), + SPH_C32(0x54970000), SPH_C32(0x5108001f), SPH_C32(0x6eb13800), + SPH_C32(0xb0c23a1a), SPH_C32(0xaef18dfe), SPH_C32(0xf21ef013), + SPH_C32(0x060bc3cb) }, + { SPH_C32(0x781e0000), SPH_C32(0x90b60000), SPH_C32(0xdcea0074), + SPH_C32(0xe0120000), SPH_C32(0xa785570d), SPH_C32(0x14951430), + SPH_C32(0x648af573), SPH_C32(0x2e7d9f13), SPH_C32(0xfd740000), + SPH_C32(0x66b90000), SPH_C32(0xae4f0014), SPH_C32(0x3fd70000), + SPH_C32(0x14874568), SPH_C32(0x9f9bdc87), SPH_C32(0xaa156c5e), + SPH_C32(0xac3a0bb4) }, + { SPH_C32(0x205d0000), SPH_C32(0x10c80000), SPH_C32(0xa4d90075), + SPH_C32(0x26793800), SPH_C32(0x40b20bd1), SPH_C32(0x6d382bed), + SPH_C32(0xc8f90b1c), SPH_C32(0x1439e6a2), SPH_C32(0xe02e0000), + SPH_C32(0x4dcb0000), SPH_C32(0xe6c20014), SPH_C32(0x90b61800), + SPH_C32(0x314c6bad), SPH_C32(0x57e26357), SPH_C32(0x2bb76877), + SPH_C32(0xb24f3d12) }, + { SPH_C32(0x65440000), SPH_C32(0xbbc40000), SPH_C32(0x94670074), + SPH_C32(0x4f731800), SPH_C32(0x824e79c8), SPH_C32(0xdcecabe0), + SPH_C32(0xe528f15a), SPH_C32(0x3008a9b5), SPH_C32(0xb86d0000), + SPH_C32(0xcdb50000), SPH_C32(0x9ef10015), SPH_C32(0x56dd2000), + SPH_C32(0xd67b3771), SPH_C32(0x2e4f5c8a), SPH_C32(0x87c49618), + SPH_C32(0x880b44a3) }, + { SPH_C32(0x3d070000), SPH_C32(0x3bba0000), SPH_C32(0xec540075), + SPH_C32(0x89182000), SPH_C32(0x65792514), SPH_C32(0xa541943d), + SPH_C32(0x495b0f35), SPH_C32(0x0a4cd004), SPH_C32(0xa5370000), + SPH_C32(0xe6c70000), SPH_C32(0xd67c0015), SPH_C32(0xf9bc3800), + SPH_C32(0xf3b019b4), SPH_C32(0xe636e35a), SPH_C32(0x06669231), + SPH_C32(0x967e7205) }, + { SPH_C32(0x59920000), SPH_C32(0xf2370000), SPH_C32(0x14e90042), + SPH_C32(0xe5790000), SPH_C32(0x0bcc361f), SPH_C32(0x30a2fa8d), + SPH_C32(0x3b36cb7b), SPH_C32(0x8bb5076c), SPH_C32(0xd0d70000), + SPH_C32(0x6d0b0000), SPH_C32(0x9fb00024), SPH_C32(0xb8370000), + SPH_C32(0x6a414f27), SPH_C32(0x86eae7dd), SPH_C32(0xf5b174ea), + SPH_C32(0x41313666) }, + { SPH_C32(0x01d10000), SPH_C32(0x72490000), SPH_C32(0x6cda0043), + SPH_C32(0x23123800), SPH_C32(0xecfb6ac3), SPH_C32(0x490fc550), + SPH_C32(0x97453514), SPH_C32(0xb1f17edd), SPH_C32(0xcd8d0000), + SPH_C32(0x46790000), SPH_C32(0xd73d0024), SPH_C32(0x17561800), + SPH_C32(0x4f8a61e2), SPH_C32(0x4e93580d), SPH_C32(0x741370c3), + SPH_C32(0x5f4400c0) }, + { SPH_C32(0x44c80000), SPH_C32(0xd9450000), SPH_C32(0x5c640042), + SPH_C32(0x4a181800), SPH_C32(0x2e0718da), SPH_C32(0xf8db455d), + SPH_C32(0xba94cf52), SPH_C32(0x95c031ca), SPH_C32(0x95ce0000), + SPH_C32(0xc6070000), SPH_C32(0xaf0e0025), SPH_C32(0xd13d2000), + SPH_C32(0xa8bd3d3e), SPH_C32(0x373e67d0), SPH_C32(0xd8608eac), + SPH_C32(0x65007971) }, + { SPH_C32(0x1c8b0000), SPH_C32(0x593b0000), SPH_C32(0x24570043), + SPH_C32(0x8c732000), SPH_C32(0xc9304406), SPH_C32(0x81767a80), + SPH_C32(0x16e7313d), SPH_C32(0xaf84487b), SPH_C32(0x88940000), + SPH_C32(0xed750000), SPH_C32(0xe7830025), SPH_C32(0x7e5c3800), + SPH_C32(0x8d7613fb), SPH_C32(0xff47d800), SPH_C32(0x59c28a85), + SPH_C32(0x7b754fd7) }, + { SPH_C32(0xfca90000), SPH_C32(0xe6110000), SPH_C32(0x5ad9005c), + SPH_C32(0x99d70000), SPH_C32(0x84523bca), SPH_C32(0x487d50b0), + SPH_C32(0xcc07a3a3), SPH_C32(0x80ae4e2a), SPH_C32(0xd73a0000), + SPH_C32(0xdf5b0000), SPH_C32(0x18c4002e), SPH_C32(0x2f3a0000), + SPH_C32(0x29336c89), SPH_C32(0xce2d8979), SPH_C32(0x01c916c8), + SPH_C32(0xd14487a8) }, + { SPH_C32(0xa4ea0000), SPH_C32(0x666f0000), SPH_C32(0x22ea005d), + SPH_C32(0x5fbc3800), SPH_C32(0x63656716), SPH_C32(0x31d06f6d), + SPH_C32(0x60745dcc), SPH_C32(0xbaea379b), SPH_C32(0xca600000), + SPH_C32(0xf4290000), SPH_C32(0x5049002e), SPH_C32(0x805b1800), + SPH_C32(0x0cf8424c), SPH_C32(0x065436a9), SPH_C32(0x806b12e1), + SPH_C32(0xcf31b10e) }, + { SPH_C32(0xe1f30000), SPH_C32(0xcd630000), SPH_C32(0x1254005c), + SPH_C32(0x36b61800), SPH_C32(0xa199150f), SPH_C32(0x8004ef60), + SPH_C32(0x4da5a78a), SPH_C32(0x9edb788c), SPH_C32(0x92230000), + SPH_C32(0x74570000), SPH_C32(0x287a002f), SPH_C32(0x46302000), + SPH_C32(0xebcf1e90), SPH_C32(0x7ff90974), SPH_C32(0x2c18ec8e), + SPH_C32(0xf575c8bf) }, + { SPH_C32(0xb9b00000), SPH_C32(0x4d1d0000), SPH_C32(0x6a67005d), + SPH_C32(0xf0dd2000), SPH_C32(0x46ae49d3), SPH_C32(0xf9a9d0bd), + SPH_C32(0xe1d659e5), SPH_C32(0xa49f013d), SPH_C32(0x8f790000), + SPH_C32(0x5f250000), SPH_C32(0x60f7002f), SPH_C32(0xe9513800), + SPH_C32(0xce043055), SPH_C32(0xb780b6a4), SPH_C32(0xadbae8a7), + SPH_C32(0xeb00fe19) }, + { SPH_C32(0x5e7f0000), SPH_C32(0x40670000), SPH_C32(0x939d0048), + SPH_C32(0x72740000), SPH_C32(0x48be15b1), SPH_C32(0x78659429), + SPH_C32(0xcf4ea959), SPH_C32(0x1bc0b6a2), SPH_C32(0x72010000), + SPH_C32(0xcb7d0000), SPH_C32(0x56f40030), SPH_C32(0x53940000), + SPH_C32(0xa6ad615c), SPH_C32(0xb6f22344), SPH_C32(0xf6f87e10), + SPH_C32(0xda5fceee) }, + { SPH_C32(0x063c0000), SPH_C32(0xc0190000), SPH_C32(0xebae0049), + SPH_C32(0xb41f3800), SPH_C32(0xaf89496d), SPH_C32(0x01c8abf4), + SPH_C32(0x633d5736), SPH_C32(0x2184cf13), SPH_C32(0x6f5b0000), + SPH_C32(0xe00f0000), SPH_C32(0x1e790030), SPH_C32(0xfcf51800), + SPH_C32(0x83664f99), SPH_C32(0x7e8b9c94), SPH_C32(0x775a7a39), + SPH_C32(0xc42af848) }, + { SPH_C32(0x43250000), SPH_C32(0x6b150000), SPH_C32(0xdb100048), + SPH_C32(0xdd151800), SPH_C32(0x6d753b74), SPH_C32(0xb01c2bf9), + SPH_C32(0x4eecad70), SPH_C32(0x05b58004), SPH_C32(0x37180000), + SPH_C32(0x60710000), SPH_C32(0x664a0031), SPH_C32(0x3a9e2000), + SPH_C32(0x64511345), SPH_C32(0x0726a349), SPH_C32(0xdb298456), + SPH_C32(0xfe6e81f9) }, + { SPH_C32(0x1b660000), SPH_C32(0xeb6b0000), SPH_C32(0xa3230049), + SPH_C32(0x1b7e2000), SPH_C32(0x8a4267a8), SPH_C32(0xc9b11424), + SPH_C32(0xe29f531f), SPH_C32(0x3ff1f9b5), SPH_C32(0x2a420000), + SPH_C32(0x4b030000), SPH_C32(0x2ec70031), SPH_C32(0x95ff3800), + SPH_C32(0x419a3d80), SPH_C32(0xcf5f1c99), SPH_C32(0x5a8b807f), + SPH_C32(0xe01bb75f) }, + { SPH_C32(0xfb440000), SPH_C32(0x54410000), SPH_C32(0xddad0056), + SPH_C32(0x0eda0000), SPH_C32(0xc7201864), SPH_C32(0x00ba3e14), + SPH_C32(0x387fc181), SPH_C32(0x10dbffe4), SPH_C32(0x75ec0000), + SPH_C32(0x792d0000), SPH_C32(0xd180003a), SPH_C32(0xc4990000), + SPH_C32(0xe5df42f2), SPH_C32(0xfe354de0), SPH_C32(0x02801c32), + SPH_C32(0x4a2a7f20) }, + { SPH_C32(0xa3070000), SPH_C32(0xd43f0000), SPH_C32(0xa59e0057), + SPH_C32(0xc8b13800), SPH_C32(0x201744b8), SPH_C32(0x791701c9), + SPH_C32(0x940c3fee), SPH_C32(0x2a9f8655), SPH_C32(0x68b60000), + SPH_C32(0x525f0000), SPH_C32(0x990d003a), SPH_C32(0x6bf81800), + SPH_C32(0xc0146c37), SPH_C32(0x364cf230), SPH_C32(0x8322181b), + SPH_C32(0x545f4986) }, + { SPH_C32(0xe61e0000), SPH_C32(0x7f330000), SPH_C32(0x95200056), + SPH_C32(0xa1bb1800), SPH_C32(0xe2eb36a1), SPH_C32(0xc8c381c4), + SPH_C32(0xb9ddc5a8), SPH_C32(0x0eaec942), SPH_C32(0x30f50000), + SPH_C32(0xd2210000), SPH_C32(0xe13e003b), SPH_C32(0xad932000), + SPH_C32(0x272330eb), SPH_C32(0x4fe1cded), SPH_C32(0x2f51e674), + SPH_C32(0x6e1b3037) }, + { SPH_C32(0xbe5d0000), SPH_C32(0xff4d0000), SPH_C32(0xed130057), + SPH_C32(0x67d02000), SPH_C32(0x05dc6a7d), SPH_C32(0xb16ebe19), + SPH_C32(0x15ae3bc7), SPH_C32(0x34eab0f3), SPH_C32(0x2daf0000), + SPH_C32(0xf9530000), SPH_C32(0xa9b3003b), SPH_C32(0x02f23800), + SPH_C32(0x02e81e2e), SPH_C32(0x8798723d), SPH_C32(0xaef3e25d), + SPH_C32(0x706e0691) }, + { SPH_C32(0xd10a0000), SPH_C32(0xeda30000), SPH_C32(0x6b26006c), + SPH_C32(0x1e370000), SPH_C32(0xfa943185), SPH_C32(0x510c6bea), + SPH_C32(0x93a3bb17), SPH_C32(0x6da573f8), SPH_C32(0xdb150000), + SPH_C32(0xb6680000), SPH_C32(0xe1380028), SPH_C32(0xadb10000), + SPH_C32(0xfbbc07d4), SPH_C32(0xf36b5c9e), SPH_C32(0x01d13074), + SPH_C32(0x99872205) }, + { SPH_C32(0x89490000), SPH_C32(0x6ddd0000), SPH_C32(0x1315006d), + SPH_C32(0xd85c3800), SPH_C32(0x1da36d59), SPH_C32(0x28a15437), + SPH_C32(0x3fd04578), SPH_C32(0x57e10a49), SPH_C32(0xc64f0000), + SPH_C32(0x9d1a0000), SPH_C32(0xa9b50028), SPH_C32(0x02d01800), + SPH_C32(0xde772911), SPH_C32(0x3b12e34e), SPH_C32(0x8073345d), + SPH_C32(0x87f214a3) }, + { SPH_C32(0xcc500000), SPH_C32(0xc6d10000), SPH_C32(0x23ab006c), + SPH_C32(0xb1561800), SPH_C32(0xdf5f1f40), SPH_C32(0x9975d43a), + SPH_C32(0x1201bf3e), SPH_C32(0x73d0455e), SPH_C32(0x9e0c0000), + SPH_C32(0x1d640000), SPH_C32(0xd1860029), SPH_C32(0xc4bb2000), + SPH_C32(0x394075cd), SPH_C32(0x42bfdc93), SPH_C32(0x2c00ca32), + SPH_C32(0xbdb66d12) }, + { SPH_C32(0x94130000), SPH_C32(0x46af0000), SPH_C32(0x5b98006d), + SPH_C32(0x773d2000), SPH_C32(0x3868439c), SPH_C32(0xe0d8ebe7), + SPH_C32(0xbe724151), SPH_C32(0x49943cef), SPH_C32(0x83560000), + SPH_C32(0x36160000), SPH_C32(0x990b0029), SPH_C32(0x6bda3800), + SPH_C32(0x1c8b5b08), SPH_C32(0x8ac66343), SPH_C32(0xada2ce1b), + SPH_C32(0xa3c35bb4) }, + { SPH_C32(0x74310000), SPH_C32(0xf9850000), SPH_C32(0x25160072), + SPH_C32(0x62990000), SPH_C32(0x750a3c50), SPH_C32(0x29d3c1d7), + SPH_C32(0x6492d3cf), SPH_C32(0x66be3abe), SPH_C32(0xdcf80000), + SPH_C32(0x04380000), SPH_C32(0x664c0022), SPH_C32(0x3abc0000), + SPH_C32(0xb8ce247a), SPH_C32(0xbbac323a), SPH_C32(0xf5a95256), + SPH_C32(0x09f293cb) }, + { SPH_C32(0x2c720000), SPH_C32(0x79fb0000), SPH_C32(0x5d250073), + SPH_C32(0xa4f23800), SPH_C32(0x923d608c), SPH_C32(0x507efe0a), + SPH_C32(0xc8e12da0), SPH_C32(0x5cfa430f), SPH_C32(0xc1a20000), + SPH_C32(0x2f4a0000), SPH_C32(0x2ec10022), SPH_C32(0x95dd1800), + SPH_C32(0x9d050abf), SPH_C32(0x73d58dea), SPH_C32(0x740b567f), + SPH_C32(0x1787a56d) }, + { SPH_C32(0x696b0000), SPH_C32(0xd2f70000), SPH_C32(0x6d9b0072), + SPH_C32(0xcdf81800), SPH_C32(0x50c11295), SPH_C32(0xe1aa7e07), + SPH_C32(0xe530d7e6), SPH_C32(0x78cb0c18), SPH_C32(0x99e10000), + SPH_C32(0xaf340000), SPH_C32(0x56f20023), SPH_C32(0x53b62000), + SPH_C32(0x7a325663), SPH_C32(0x0a78b237), SPH_C32(0xd878a810), + SPH_C32(0x2dc3dcdc) }, + { SPH_C32(0x31280000), SPH_C32(0x52890000), SPH_C32(0x15a80073), + SPH_C32(0x0b932000), SPH_C32(0xb7f64e49), SPH_C32(0x980741da), + SPH_C32(0x49432989), SPH_C32(0x428f75a9), SPH_C32(0x84bb0000), + SPH_C32(0x84460000), SPH_C32(0x1e7f0023), SPH_C32(0xfcd73800), + SPH_C32(0x5ff978a6), SPH_C32(0xc2010de7), SPH_C32(0x59daac39), + SPH_C32(0x33b6ea7a) }, + { SPH_C32(0xd6e70000), SPH_C32(0x5ff30000), SPH_C32(0xec520066), + SPH_C32(0x893a0000), SPH_C32(0xb9e6122b), SPH_C32(0x19cb054e), + SPH_C32(0x67dbd935), SPH_C32(0xfdd0c236), SPH_C32(0x79c30000), + SPH_C32(0x101e0000), SPH_C32(0x287c003c), SPH_C32(0x46120000), + SPH_C32(0x375029af), SPH_C32(0xc3739807), SPH_C32(0x02983a8e), + SPH_C32(0x02e9da8d) }, + { SPH_C32(0x8ea40000), SPH_C32(0xdf8d0000), SPH_C32(0x94610067), + SPH_C32(0x4f513800), SPH_C32(0x5ed14ef7), SPH_C32(0x60663a93), + SPH_C32(0xcba8275a), SPH_C32(0xc794bb87), SPH_C32(0x64990000), + SPH_C32(0x3b6c0000), SPH_C32(0x60f1003c), SPH_C32(0xe9731800), + SPH_C32(0x129b076a), SPH_C32(0x0b0a27d7), SPH_C32(0x833a3ea7), + SPH_C32(0x1c9cec2b) }, + { SPH_C32(0xcbbd0000), SPH_C32(0x74810000), SPH_C32(0xa4df0066), + SPH_C32(0x265b1800), SPH_C32(0x9c2d3cee), SPH_C32(0xd1b2ba9e), + SPH_C32(0xe679dd1c), SPH_C32(0xe3a5f490), SPH_C32(0x3cda0000), + SPH_C32(0xbb120000), SPH_C32(0x18c2003d), SPH_C32(0x2f182000), + SPH_C32(0xf5ac5bb6), SPH_C32(0x72a7180a), SPH_C32(0x2f49c0c8), + SPH_C32(0x26d8959a) }, + { SPH_C32(0x93fe0000), SPH_C32(0xf4ff0000), SPH_C32(0xdcec0067), + SPH_C32(0xe0302000), SPH_C32(0x7b1a6032), SPH_C32(0xa81f8543), + SPH_C32(0x4a0a2373), SPH_C32(0xd9e18d21), SPH_C32(0x21800000), + SPH_C32(0x90600000), SPH_C32(0x504f003d), SPH_C32(0x80793800), + SPH_C32(0xd0677573), SPH_C32(0xbadea7da), SPH_C32(0xaeebc4e1), + SPH_C32(0x38ada33c) }, + { SPH_C32(0x73dc0000), SPH_C32(0x4bd50000), SPH_C32(0xa2620078), + SPH_C32(0xf5940000), SPH_C32(0x36781ffe), SPH_C32(0x6114af73), + SPH_C32(0x90eab1ed), SPH_C32(0xf6cb8b70), SPH_C32(0x7e2e0000), + SPH_C32(0xa24e0000), SPH_C32(0xaf080036), SPH_C32(0xd11f0000), + SPH_C32(0x74220a01), SPH_C32(0x8bb4f6a3), SPH_C32(0xf6e058ac), + SPH_C32(0x929c6b43) }, + { SPH_C32(0x2b9f0000), SPH_C32(0xcbab0000), SPH_C32(0xda510079), + SPH_C32(0x33ff3800), SPH_C32(0xd14f4322), SPH_C32(0x18b990ae), + SPH_C32(0x3c994f82), SPH_C32(0xcc8ff2c1), SPH_C32(0x63740000), + SPH_C32(0x893c0000), SPH_C32(0xe7850036), SPH_C32(0x7e7e1800), + SPH_C32(0x51e924c4), SPH_C32(0x43cd4973), SPH_C32(0x77425c85), + SPH_C32(0x8ce95de5) }, + { SPH_C32(0x6e860000), SPH_C32(0x60a70000), SPH_C32(0xeaef0078), + SPH_C32(0x5af51800), SPH_C32(0x13b3313b), SPH_C32(0xa96d10a3), + SPH_C32(0x1148b5c4), SPH_C32(0xe8bebdd6), SPH_C32(0x3b370000), + SPH_C32(0x09420000), SPH_C32(0x9fb60037), SPH_C32(0xb8152000), + SPH_C32(0xb6de7818), SPH_C32(0x3a6076ae), SPH_C32(0xdb31a2ea), + SPH_C32(0xb6ad2454) }, + { SPH_C32(0x36c50000), SPH_C32(0xe0d90000), SPH_C32(0x92dc0079), + SPH_C32(0x9c9e2000), SPH_C32(0xf4846de7), SPH_C32(0xd0c02f7e), + SPH_C32(0xbd3b4bab), SPH_C32(0xd2fac467), SPH_C32(0x266d0000), + SPH_C32(0x22300000), SPH_C32(0xd73b0037), SPH_C32(0x17743800), + SPH_C32(0x931556dd), SPH_C32(0xf219c97e), SPH_C32(0x5a93a6c3), + SPH_C32(0xa8d812f2) }, + { SPH_C32(0x538d0000), SPH_C32(0xa9fc0000), SPH_C32(0x9ef70006), + SPH_C32(0x56ff0000), SPH_C32(0x0ae4004e), SPH_C32(0x92c5cdf9), + SPH_C32(0xa9444018), SPH_C32(0x7f975691), SPH_C32(0x01dd0000), + SPH_C32(0x80a80000), SPH_C32(0xf4960048), SPH_C32(0xa6000000), + SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), SPH_C32(0x6612cffd), + SPH_C32(0x2c94459e) }, + { SPH_C32(0x0bce0000), SPH_C32(0x29820000), SPH_C32(0xe6c40007), + SPH_C32(0x90943800), SPH_C32(0xedd35c92), SPH_C32(0xeb68f224), + SPH_C32(0x0537be77), SPH_C32(0x45d32f20), SPH_C32(0x1c870000), + SPH_C32(0xabda0000), SPH_C32(0xbc1b0048), SPH_C32(0x09611800), + SPH_C32(0xb51e5067), SPH_C32(0x1f9f33e7), SPH_C32(0xe7b0cbd4), + SPH_C32(0x32e17338) }, + { SPH_C32(0x4ed70000), SPH_C32(0x828e0000), SPH_C32(0xd67a0006), + SPH_C32(0xf99e1800), SPH_C32(0x2f2f2e8b), SPH_C32(0x5abc7229), + SPH_C32(0x28e64431), SPH_C32(0x61e26037), SPH_C32(0x44c40000), + SPH_C32(0x2ba40000), SPH_C32(0xc4280049), SPH_C32(0xcf0a2000), + SPH_C32(0x52290cbb), SPH_C32(0x66320c3a), SPH_C32(0x4bc335bb), + SPH_C32(0x08a50a89) }, + { SPH_C32(0x16940000), SPH_C32(0x02f00000), SPH_C32(0xae490007), + SPH_C32(0x3ff52000), SPH_C32(0xc8187257), SPH_C32(0x23114df4), + SPH_C32(0x8495ba5e), SPH_C32(0x5ba61986), SPH_C32(0x599e0000), + SPH_C32(0x00d60000), SPH_C32(0x8ca50049), SPH_C32(0x606b3800), + SPH_C32(0x77e2227e), SPH_C32(0xae4bb3ea), SPH_C32(0xca613192), + SPH_C32(0x16d03c2f) }, + { SPH_C32(0xf6b60000), SPH_C32(0xbdda0000), SPH_C32(0xd0c70018), + SPH_C32(0x2a510000), SPH_C32(0x857a0d9b), SPH_C32(0xea1a67c4), + SPH_C32(0x5e7528c0), SPH_C32(0x748c1fd7), SPH_C32(0x06300000), + SPH_C32(0x32f80000), SPH_C32(0x73e20042), SPH_C32(0x310d0000), + SPH_C32(0xd3a75d0c), SPH_C32(0x9f21e293), SPH_C32(0x926aaddf), + SPH_C32(0xbce1f450) }, + { SPH_C32(0xaef50000), SPH_C32(0x3da40000), SPH_C32(0xa8f40019), + SPH_C32(0xec3a3800), SPH_C32(0x624d5147), SPH_C32(0x93b75819), + SPH_C32(0xf206d6af), SPH_C32(0x4ec86666), SPH_C32(0x1b6a0000), + SPH_C32(0x198a0000), SPH_C32(0x3b6f0042), SPH_C32(0x9e6c1800), + SPH_C32(0xf66c73c9), SPH_C32(0x57585d43), SPH_C32(0x13c8a9f6), + SPH_C32(0xa294c2f6) }, + { SPH_C32(0xebec0000), SPH_C32(0x96a80000), SPH_C32(0x984a0018), + SPH_C32(0x85301800), SPH_C32(0xa0b1235e), SPH_C32(0x2263d814), + SPH_C32(0xdfd72ce9), SPH_C32(0x6af92971), SPH_C32(0x43290000), + SPH_C32(0x99f40000), SPH_C32(0x435c0043), SPH_C32(0x58072000), + SPH_C32(0x115b2f15), SPH_C32(0x2ef5629e), SPH_C32(0xbfbb5799), + SPH_C32(0x98d0bb47) }, + { SPH_C32(0xb3af0000), SPH_C32(0x16d60000), SPH_C32(0xe0790019), + SPH_C32(0x435b2000), SPH_C32(0x47867f82), SPH_C32(0x5bcee7c9), + SPH_C32(0x73a4d286), SPH_C32(0x50bd50c0), SPH_C32(0x5e730000), + SPH_C32(0xb2860000), SPH_C32(0x0bd10043), SPH_C32(0xf7663800), + SPH_C32(0x349001d0), SPH_C32(0xe68cdd4e), SPH_C32(0x3e1953b0), + SPH_C32(0x86a58de1) }, + { SPH_C32(0x54600000), SPH_C32(0x1bac0000), SPH_C32(0x1983000c), + SPH_C32(0xc1f20000), SPH_C32(0x499623e0), SPH_C32(0xda02a35d), + SPH_C32(0x5d3c223a), SPH_C32(0xefe2e75f), SPH_C32(0xa30b0000), + SPH_C32(0x26de0000), SPH_C32(0x3dd2005c), SPH_C32(0x4da30000), + SPH_C32(0x5c3950d9), SPH_C32(0xe7fe48ae), SPH_C32(0x655bc507), + SPH_C32(0xb7fabd16) }, + { SPH_C32(0x0c230000), SPH_C32(0x9bd20000), SPH_C32(0x61b0000d), + SPH_C32(0x07993800), SPH_C32(0xaea17f3c), SPH_C32(0xa3af9c80), + SPH_C32(0xf14fdc55), SPH_C32(0xd5a69eee), SPH_C32(0xbe510000), + SPH_C32(0x0dac0000), SPH_C32(0x755f005c), SPH_C32(0xe2c21800), + SPH_C32(0x79f27e1c), SPH_C32(0x2f87f77e), SPH_C32(0xe4f9c12e), + SPH_C32(0xa98f8bb0) }, + { SPH_C32(0x493a0000), SPH_C32(0x30de0000), SPH_C32(0x510e000c), + SPH_C32(0x6e931800), SPH_C32(0x6c5d0d25), SPH_C32(0x127b1c8d), + SPH_C32(0xdc9e2613), SPH_C32(0xf197d1f9), SPH_C32(0xe6120000), + SPH_C32(0x8dd20000), SPH_C32(0x0d6c005d), SPH_C32(0x24a92000), + SPH_C32(0x9ec522c0), SPH_C32(0x562ac8a3), SPH_C32(0x488a3f41), + SPH_C32(0x93cbf201) }, + { SPH_C32(0x11790000), SPH_C32(0xb0a00000), SPH_C32(0x293d000d), + SPH_C32(0xa8f82000), SPH_C32(0x8b6a51f9), SPH_C32(0x6bd62350), + SPH_C32(0x70edd87c), SPH_C32(0xcbd3a848), SPH_C32(0xfb480000), + SPH_C32(0xa6a00000), SPH_C32(0x45e1005d), SPH_C32(0x8bc83800), + SPH_C32(0xbb0e0c05), SPH_C32(0x9e537773), SPH_C32(0xc9283b68), + SPH_C32(0x8dbec4a7) }, + { SPH_C32(0xf15b0000), SPH_C32(0x0f8a0000), SPH_C32(0x57b30012), + SPH_C32(0xbd5c0000), SPH_C32(0xc6082e35), SPH_C32(0xa2dd0960), + SPH_C32(0xaa0d4ae2), SPH_C32(0xe4f9ae19), SPH_C32(0xa4e60000), + SPH_C32(0x948e0000), SPH_C32(0xbaa60056), SPH_C32(0xdaae0000), + SPH_C32(0x1f4b7377), SPH_C32(0xaf39260a), SPH_C32(0x9123a725), + SPH_C32(0x278f0cd8) }, + { SPH_C32(0xa9180000), SPH_C32(0x8ff40000), SPH_C32(0x2f800013), + SPH_C32(0x7b373800), SPH_C32(0x213f72e9), SPH_C32(0xdb7036bd), + SPH_C32(0x067eb48d), SPH_C32(0xdebdd7a8), SPH_C32(0xb9bc0000), + SPH_C32(0xbffc0000), SPH_C32(0xf22b0056), SPH_C32(0x75cf1800), + SPH_C32(0x3a805db2), SPH_C32(0x674099da), SPH_C32(0x1081a30c), + SPH_C32(0x39fa3a7e) }, + { SPH_C32(0xec010000), SPH_C32(0x24f80000), SPH_C32(0x1f3e0012), + SPH_C32(0x123d1800), SPH_C32(0xe3c300f0), SPH_C32(0x6aa4b6b0), + SPH_C32(0x2baf4ecb), SPH_C32(0xfa8c98bf), SPH_C32(0xe1ff0000), + SPH_C32(0x3f820000), SPH_C32(0x8a180057), SPH_C32(0xb3a42000), + SPH_C32(0xddb7016e), SPH_C32(0x1eeda607), SPH_C32(0xbcf25d63), + SPH_C32(0x03be43cf) }, + { SPH_C32(0xb4420000), SPH_C32(0xa4860000), SPH_C32(0x670d0013), + SPH_C32(0xd4562000), SPH_C32(0x04f45c2c), SPH_C32(0x1309896d), + SPH_C32(0x87dcb0a4), SPH_C32(0xc0c8e10e), SPH_C32(0xfca50000), + SPH_C32(0x14f00000), SPH_C32(0xc2950057), SPH_C32(0x1cc53800), + SPH_C32(0xf87c2fab), SPH_C32(0xd69419d7), SPH_C32(0x3d50594a), + SPH_C32(0x1dcb7569) }, + { SPH_C32(0xdb150000), SPH_C32(0xb6680000), SPH_C32(0xe1380028), + SPH_C32(0xadb10000), SPH_C32(0xfbbc07d4), SPH_C32(0xf36b5c9e), + SPH_C32(0x01d13074), SPH_C32(0x99872205), SPH_C32(0x0a1f0000), + SPH_C32(0x5bcb0000), SPH_C32(0x8a1e0044), SPH_C32(0xb3860000), + SPH_C32(0x01283651), SPH_C32(0xa2673774), SPH_C32(0x92728b63), + SPH_C32(0xf42251fd) }, + { SPH_C32(0x83560000), SPH_C32(0x36160000), SPH_C32(0x990b0029), + SPH_C32(0x6bda3800), SPH_C32(0x1c8b5b08), SPH_C32(0x8ac66343), + SPH_C32(0xada2ce1b), SPH_C32(0xa3c35bb4), SPH_C32(0x17450000), + SPH_C32(0x70b90000), SPH_C32(0xc2930044), SPH_C32(0x1ce71800), + SPH_C32(0x24e31894), SPH_C32(0x6a1e88a4), SPH_C32(0x13d08f4a), + SPH_C32(0xea57675b) }, + { SPH_C32(0xc64f0000), SPH_C32(0x9d1a0000), SPH_C32(0xa9b50028), + SPH_C32(0x02d01800), SPH_C32(0xde772911), SPH_C32(0x3b12e34e), + SPH_C32(0x8073345d), SPH_C32(0x87f214a3), SPH_C32(0x4f060000), + SPH_C32(0xf0c70000), SPH_C32(0xbaa00045), SPH_C32(0xda8c2000), + SPH_C32(0xc3d44448), SPH_C32(0x13b3b779), SPH_C32(0xbfa37125), + SPH_C32(0xd0131eea) }, + { SPH_C32(0x9e0c0000), SPH_C32(0x1d640000), SPH_C32(0xd1860029), + SPH_C32(0xc4bb2000), SPH_C32(0x394075cd), SPH_C32(0x42bfdc93), + SPH_C32(0x2c00ca32), SPH_C32(0xbdb66d12), SPH_C32(0x525c0000), + SPH_C32(0xdbb50000), SPH_C32(0xf22d0045), SPH_C32(0x75ed3800), + SPH_C32(0xe61f6a8d), SPH_C32(0xdbca08a9), SPH_C32(0x3e01750c), + SPH_C32(0xce66284c) }, + { SPH_C32(0x7e2e0000), SPH_C32(0xa24e0000), SPH_C32(0xaf080036), + SPH_C32(0xd11f0000), SPH_C32(0x74220a01), SPH_C32(0x8bb4f6a3), + SPH_C32(0xf6e058ac), SPH_C32(0x929c6b43), SPH_C32(0x0df20000), + SPH_C32(0xe99b0000), SPH_C32(0x0d6a004e), SPH_C32(0x248b0000), + SPH_C32(0x425a15ff), SPH_C32(0xeaa059d0), SPH_C32(0x660ae941), + SPH_C32(0x6457e033) }, + { SPH_C32(0x266d0000), SPH_C32(0x22300000), SPH_C32(0xd73b0037), + SPH_C32(0x17743800), SPH_C32(0x931556dd), SPH_C32(0xf219c97e), + SPH_C32(0x5a93a6c3), SPH_C32(0xa8d812f2), SPH_C32(0x10a80000), + SPH_C32(0xc2e90000), SPH_C32(0x45e7004e), SPH_C32(0x8bea1800), + SPH_C32(0x67913b3a), SPH_C32(0x22d9e600), SPH_C32(0xe7a8ed68), + SPH_C32(0x7a22d695) }, + { SPH_C32(0x63740000), SPH_C32(0x893c0000), SPH_C32(0xe7850036), + SPH_C32(0x7e7e1800), SPH_C32(0x51e924c4), SPH_C32(0x43cd4973), + SPH_C32(0x77425c85), SPH_C32(0x8ce95de5), SPH_C32(0x48eb0000), + SPH_C32(0x42970000), SPH_C32(0x3dd4004f), SPH_C32(0x4d812000), + SPH_C32(0x80a667e6), SPH_C32(0x5b74d9dd), SPH_C32(0x4bdb1307), + SPH_C32(0x4066af24) }, + { SPH_C32(0x3b370000), SPH_C32(0x09420000), SPH_C32(0x9fb60037), + SPH_C32(0xb8152000), SPH_C32(0xb6de7818), SPH_C32(0x3a6076ae), + SPH_C32(0xdb31a2ea), SPH_C32(0xb6ad2454), SPH_C32(0x55b10000), + SPH_C32(0x69e50000), SPH_C32(0x7559004f), SPH_C32(0xe2e03800), + SPH_C32(0xa56d4923), SPH_C32(0x930d660d), SPH_C32(0xca79172e), + SPH_C32(0x5e139982) }, + { SPH_C32(0xdcf80000), SPH_C32(0x04380000), SPH_C32(0x664c0022), + SPH_C32(0x3abc0000), SPH_C32(0xb8ce247a), SPH_C32(0xbbac323a), + SPH_C32(0xf5a95256), SPH_C32(0x09f293cb), SPH_C32(0xa8c90000), + SPH_C32(0xfdbd0000), SPH_C32(0x435a0050), SPH_C32(0x58250000), + SPH_C32(0xcdc4182a), SPH_C32(0x927ff3ed), SPH_C32(0x913b8199), + SPH_C32(0x6f4ca975) }, + { SPH_C32(0x84bb0000), SPH_C32(0x84460000), SPH_C32(0x1e7f0023), + SPH_C32(0xfcd73800), SPH_C32(0x5ff978a6), SPH_C32(0xc2010de7), + SPH_C32(0x59daac39), SPH_C32(0x33b6ea7a), SPH_C32(0xb5930000), + SPH_C32(0xd6cf0000), SPH_C32(0x0bd70050), SPH_C32(0xf7441800), + SPH_C32(0xe80f36ef), SPH_C32(0x5a064c3d), SPH_C32(0x109985b0), + SPH_C32(0x71399fd3) }, + { SPH_C32(0xc1a20000), SPH_C32(0x2f4a0000), SPH_C32(0x2ec10022), + SPH_C32(0x95dd1800), SPH_C32(0x9d050abf), SPH_C32(0x73d58dea), + SPH_C32(0x740b567f), SPH_C32(0x1787a56d), SPH_C32(0xedd00000), + SPH_C32(0x56b10000), SPH_C32(0x73e40051), SPH_C32(0x312f2000), + SPH_C32(0x0f386a33), SPH_C32(0x23ab73e0), SPH_C32(0xbcea7bdf), + SPH_C32(0x4b7de662) }, + { SPH_C32(0x99e10000), SPH_C32(0xaf340000), SPH_C32(0x56f20023), + SPH_C32(0x53b62000), SPH_C32(0x7a325663), SPH_C32(0x0a78b237), + SPH_C32(0xd878a810), SPH_C32(0x2dc3dcdc), SPH_C32(0xf08a0000), + SPH_C32(0x7dc30000), SPH_C32(0x3b690051), SPH_C32(0x9e4e3800), + SPH_C32(0x2af344f6), SPH_C32(0xebd2cc30), SPH_C32(0x3d487ff6), + SPH_C32(0x5508d0c4) }, + { SPH_C32(0x79c30000), SPH_C32(0x101e0000), SPH_C32(0x287c003c), + SPH_C32(0x46120000), SPH_C32(0x375029af), SPH_C32(0xc3739807), + SPH_C32(0x02983a8e), SPH_C32(0x02e9da8d), SPH_C32(0xaf240000), + SPH_C32(0x4fed0000), SPH_C32(0xc42e005a), SPH_C32(0xcf280000), + SPH_C32(0x8eb63b84), SPH_C32(0xdab89d49), SPH_C32(0x6543e3bb), + SPH_C32(0xff3918bb) }, + { SPH_C32(0x21800000), SPH_C32(0x90600000), SPH_C32(0x504f003d), + SPH_C32(0x80793800), SPH_C32(0xd0677573), SPH_C32(0xbadea7da), + SPH_C32(0xaeebc4e1), SPH_C32(0x38ada33c), SPH_C32(0xb27e0000), + SPH_C32(0x649f0000), SPH_C32(0x8ca3005a), SPH_C32(0x60491800), + SPH_C32(0xab7d1541), SPH_C32(0x12c12299), SPH_C32(0xe4e1e792), + SPH_C32(0xe14c2e1d) }, + { SPH_C32(0x64990000), SPH_C32(0x3b6c0000), SPH_C32(0x60f1003c), + SPH_C32(0xe9731800), SPH_C32(0x129b076a), SPH_C32(0x0b0a27d7), + SPH_C32(0x833a3ea7), SPH_C32(0x1c9cec2b), SPH_C32(0xea3d0000), + SPH_C32(0xe4e10000), SPH_C32(0xf490005b), SPH_C32(0xa6222000), + SPH_C32(0x4c4a499d), SPH_C32(0x6b6c1d44), SPH_C32(0x489219fd), + SPH_C32(0xdb0857ac) }, + { SPH_C32(0x3cda0000), SPH_C32(0xbb120000), SPH_C32(0x18c2003d), + SPH_C32(0x2f182000), SPH_C32(0xf5ac5bb6), SPH_C32(0x72a7180a), + SPH_C32(0x2f49c0c8), SPH_C32(0x26d8959a), SPH_C32(0xf7670000), + SPH_C32(0xcf930000), SPH_C32(0xbc1d005b), SPH_C32(0x09433800), + SPH_C32(0x69816758), SPH_C32(0xa315a294), SPH_C32(0xc9301dd4), + SPH_C32(0xc57d610a) }, + { SPH_C32(0x584f0000), SPH_C32(0x729f0000), SPH_C32(0xe07f000a), + SPH_C32(0x43790000), SPH_C32(0x9b1948bd), SPH_C32(0xe74476ba), + SPH_C32(0x5d240486), SPH_C32(0xa72142f2), SPH_C32(0x82870000), + SPH_C32(0x445f0000), SPH_C32(0xf5d1006a), SPH_C32(0x48c80000), + SPH_C32(0xf07031cb), SPH_C32(0xc3c9a613), SPH_C32(0x3ae7fb0f), + SPH_C32(0x12322569) }, + { SPH_C32(0x000c0000), SPH_C32(0xf2e10000), SPH_C32(0x984c000b), + SPH_C32(0x85123800), SPH_C32(0x7c2e1461), SPH_C32(0x9ee94967), + SPH_C32(0xf157fae9), SPH_C32(0x9d653b43), SPH_C32(0x9fdd0000), + SPH_C32(0x6f2d0000), SPH_C32(0xbd5c006a), SPH_C32(0xe7a91800), + SPH_C32(0xd5bb1f0e), SPH_C32(0x0bb019c3), SPH_C32(0xbb45ff26), + SPH_C32(0x0c4713cf) }, + { SPH_C32(0x45150000), SPH_C32(0x59ed0000), SPH_C32(0xa8f2000a), + SPH_C32(0xec181800), SPH_C32(0xbed26678), SPH_C32(0x2f3dc96a), + SPH_C32(0xdc8600af), SPH_C32(0xb9547454), SPH_C32(0xc79e0000), + SPH_C32(0xef530000), SPH_C32(0xc56f006b), SPH_C32(0x21c22000), + SPH_C32(0x328c43d2), SPH_C32(0x721d261e), SPH_C32(0x17360149), + SPH_C32(0x36036a7e) }, + { SPH_C32(0x1d560000), SPH_C32(0xd9930000), SPH_C32(0xd0c1000b), + SPH_C32(0x2a732000), SPH_C32(0x59e53aa4), SPH_C32(0x5690f6b7), + SPH_C32(0x70f5fec0), SPH_C32(0x83100de5), SPH_C32(0xdac40000), + SPH_C32(0xc4210000), SPH_C32(0x8de2006b), SPH_C32(0x8ea33800), + SPH_C32(0x17476d17), SPH_C32(0xba6499ce), SPH_C32(0x96940560), + SPH_C32(0x28765cd8) }, + { SPH_C32(0xfd740000), SPH_C32(0x66b90000), SPH_C32(0xae4f0014), + SPH_C32(0x3fd70000), SPH_C32(0x14874568), SPH_C32(0x9f9bdc87), + SPH_C32(0xaa156c5e), SPH_C32(0xac3a0bb4), SPH_C32(0x856a0000), + SPH_C32(0xf60f0000), SPH_C32(0x72a50060), SPH_C32(0xdfc50000), + SPH_C32(0xb3021265), SPH_C32(0x8b0ec8b7), SPH_C32(0xce9f992d), + SPH_C32(0x824794a7) }, + { SPH_C32(0xa5370000), SPH_C32(0xe6c70000), SPH_C32(0xd67c0015), + SPH_C32(0xf9bc3800), SPH_C32(0xf3b019b4), SPH_C32(0xe636e35a), + SPH_C32(0x06669231), SPH_C32(0x967e7205), SPH_C32(0x98300000), + SPH_C32(0xdd7d0000), SPH_C32(0x3a280060), SPH_C32(0x70a41800), + SPH_C32(0x96c93ca0), SPH_C32(0x43777767), SPH_C32(0x4f3d9d04), + SPH_C32(0x9c32a201) }, + { SPH_C32(0xe02e0000), SPH_C32(0x4dcb0000), SPH_C32(0xe6c20014), + SPH_C32(0x90b61800), SPH_C32(0x314c6bad), SPH_C32(0x57e26357), + SPH_C32(0x2bb76877), SPH_C32(0xb24f3d12), SPH_C32(0xc0730000), + SPH_C32(0x5d030000), SPH_C32(0x421b0061), SPH_C32(0xb6cf2000), + SPH_C32(0x71fe607c), SPH_C32(0x3ada48ba), SPH_C32(0xe34e636b), + SPH_C32(0xa676dbb0) }, + { SPH_C32(0xb86d0000), SPH_C32(0xcdb50000), SPH_C32(0x9ef10015), + SPH_C32(0x56dd2000), SPH_C32(0xd67b3771), SPH_C32(0x2e4f5c8a), + SPH_C32(0x87c49618), SPH_C32(0x880b44a3), SPH_C32(0xdd290000), + SPH_C32(0x76710000), SPH_C32(0x0a960061), SPH_C32(0x19ae3800), + SPH_C32(0x54354eb9), SPH_C32(0xf2a3f76a), SPH_C32(0x62ec6742), + SPH_C32(0xb803ed16) }, + { SPH_C32(0x5fa20000), SPH_C32(0xc0cf0000), SPH_C32(0x670b0000), + SPH_C32(0xd4740000), SPH_C32(0xd86b6b13), SPH_C32(0xaf83181e), + SPH_C32(0xa95c66a4), SPH_C32(0x3754f33c), SPH_C32(0x20510000), + SPH_C32(0xe2290000), SPH_C32(0x3c95007e), SPH_C32(0xa36b0000), + SPH_C32(0x3c9c1fb0), SPH_C32(0xf3d1628a), SPH_C32(0x39aef1f5), + SPH_C32(0x895cdde1) }, + { SPH_C32(0x07e10000), SPH_C32(0x40b10000), SPH_C32(0x1f380001), + SPH_C32(0x121f3800), SPH_C32(0x3f5c37cf), SPH_C32(0xd62e27c3), + SPH_C32(0x052f98cb), SPH_C32(0x0d108a8d), SPH_C32(0x3d0b0000), + SPH_C32(0xc95b0000), SPH_C32(0x7418007e), SPH_C32(0x0c0a1800), + SPH_C32(0x19573175), SPH_C32(0x3ba8dd5a), SPH_C32(0xb80cf5dc), + SPH_C32(0x9729eb47) }, + { SPH_C32(0x42f80000), SPH_C32(0xebbd0000), SPH_C32(0x2f860000), + SPH_C32(0x7b151800), SPH_C32(0xfda045d6), SPH_C32(0x67faa7ce), + SPH_C32(0x28fe628d), SPH_C32(0x2921c59a), SPH_C32(0x65480000), + SPH_C32(0x49250000), SPH_C32(0x0c2b007f), SPH_C32(0xca612000), + SPH_C32(0xfe606da9), SPH_C32(0x4205e287), SPH_C32(0x147f0bb3), + SPH_C32(0xad6d92f6) }, + { SPH_C32(0x1abb0000), SPH_C32(0x6bc30000), SPH_C32(0x57b50001), + SPH_C32(0xbd7e2000), SPH_C32(0x1a97190a), SPH_C32(0x1e579813), + SPH_C32(0x848d9ce2), SPH_C32(0x1365bc2b), SPH_C32(0x78120000), + SPH_C32(0x62570000), SPH_C32(0x44a6007f), SPH_C32(0x65003800), + SPH_C32(0xdbab436c), SPH_C32(0x8a7c5d57), SPH_C32(0x95dd0f9a), + SPH_C32(0xb318a450) }, + { SPH_C32(0xfa990000), SPH_C32(0xd4e90000), SPH_C32(0x293b001e), + SPH_C32(0xa8da0000), SPH_C32(0x57f566c6), SPH_C32(0xd75cb223), + SPH_C32(0x5e6d0e7c), SPH_C32(0x3c4fba7a), SPH_C32(0x27bc0000), + SPH_C32(0x50790000), SPH_C32(0xbbe10074), SPH_C32(0x34660000), + SPH_C32(0x7fee3c1e), SPH_C32(0xbb160c2e), SPH_C32(0xcdd693d7), + SPH_C32(0x19296c2f) }, + { SPH_C32(0xa2da0000), SPH_C32(0x54970000), SPH_C32(0x5108001f), + SPH_C32(0x6eb13800), SPH_C32(0xb0c23a1a), SPH_C32(0xaef18dfe), + SPH_C32(0xf21ef013), SPH_C32(0x060bc3cb), SPH_C32(0x3ae60000), + SPH_C32(0x7b0b0000), SPH_C32(0xf36c0074), SPH_C32(0x9b071800), + SPH_C32(0x5a2512db), SPH_C32(0x736fb3fe), SPH_C32(0x4c7497fe), + SPH_C32(0x075c5a89) }, + { SPH_C32(0xe7c30000), SPH_C32(0xff9b0000), SPH_C32(0x61b6001e), + SPH_C32(0x07bb1800), SPH_C32(0x723e4803), SPH_C32(0x1f250df3), + SPH_C32(0xdfcf0a55), SPH_C32(0x223a8cdc), SPH_C32(0x62a50000), + SPH_C32(0xfb750000), SPH_C32(0x8b5f0075), SPH_C32(0x5d6c2000), + SPH_C32(0xbd124e07), SPH_C32(0x0ac28c23), SPH_C32(0xe0076991), + SPH_C32(0x3d182338) }, + { SPH_C32(0xbf800000), SPH_C32(0x7fe50000), SPH_C32(0x1985001f), + SPH_C32(0xc1d02000), SPH_C32(0x950914df), SPH_C32(0x6688322e), + SPH_C32(0x73bcf43a), SPH_C32(0x187ef56d), SPH_C32(0x7fff0000), + SPH_C32(0xd0070000), SPH_C32(0xc3d20075), SPH_C32(0xf20d3800), + SPH_C32(0x98d960c2), SPH_C32(0xc2bb33f3), SPH_C32(0x61a56db8), + SPH_C32(0x236d159e) }, + { SPH_C32(0xd0d70000), SPH_C32(0x6d0b0000), SPH_C32(0x9fb00024), + SPH_C32(0xb8370000), SPH_C32(0x6a414f27), SPH_C32(0x86eae7dd), + SPH_C32(0xf5b174ea), SPH_C32(0x41313666), SPH_C32(0x89450000), + SPH_C32(0x9f3c0000), SPH_C32(0x8b590066), SPH_C32(0x5d4e0000), + SPH_C32(0x618d7938), SPH_C32(0xb6481d50), SPH_C32(0xce87bf91), + SPH_C32(0xca84310a) }, + { SPH_C32(0x88940000), SPH_C32(0xed750000), SPH_C32(0xe7830025), + SPH_C32(0x7e5c3800), SPH_C32(0x8d7613fb), SPH_C32(0xff47d800), + SPH_C32(0x59c28a85), SPH_C32(0x7b754fd7), SPH_C32(0x941f0000), + SPH_C32(0xb44e0000), SPH_C32(0xc3d40066), SPH_C32(0xf22f1800), + SPH_C32(0x444657fd), SPH_C32(0x7e31a280), SPH_C32(0x4f25bbb8), + SPH_C32(0xd4f107ac) }, + { SPH_C32(0xcd8d0000), SPH_C32(0x46790000), SPH_C32(0xd73d0024), + SPH_C32(0x17561800), SPH_C32(0x4f8a61e2), SPH_C32(0x4e93580d), + SPH_C32(0x741370c3), SPH_C32(0x5f4400c0), SPH_C32(0xcc5c0000), + SPH_C32(0x34300000), SPH_C32(0xbbe70067), SPH_C32(0x34442000), + SPH_C32(0xa3710b21), SPH_C32(0x079c9d5d), SPH_C32(0xe35645d7), + SPH_C32(0xeeb57e1d) }, + { SPH_C32(0x95ce0000), SPH_C32(0xc6070000), SPH_C32(0xaf0e0025), + SPH_C32(0xd13d2000), SPH_C32(0xa8bd3d3e), SPH_C32(0x373e67d0), + SPH_C32(0xd8608eac), SPH_C32(0x65007971), SPH_C32(0xd1060000), + SPH_C32(0x1f420000), SPH_C32(0xf36a0067), SPH_C32(0x9b253800), + SPH_C32(0x86ba25e4), SPH_C32(0xcfe5228d), SPH_C32(0x62f441fe), + SPH_C32(0xf0c048bb) }, + { SPH_C32(0x75ec0000), SPH_C32(0x792d0000), SPH_C32(0xd180003a), + SPH_C32(0xc4990000), SPH_C32(0xe5df42f2), SPH_C32(0xfe354de0), + SPH_C32(0x02801c32), SPH_C32(0x4a2a7f20), SPH_C32(0x8ea80000), + SPH_C32(0x2d6c0000), SPH_C32(0x0c2d006c), SPH_C32(0xca430000), + SPH_C32(0x22ff5a96), SPH_C32(0xfe8f73f4), SPH_C32(0x3affddb3), + SPH_C32(0x5af180c4) }, + { SPH_C32(0x2daf0000), SPH_C32(0xf9530000), SPH_C32(0xa9b3003b), + SPH_C32(0x02f23800), SPH_C32(0x02e81e2e), SPH_C32(0x8798723d), + SPH_C32(0xaef3e25d), SPH_C32(0x706e0691), SPH_C32(0x93f20000), + SPH_C32(0x061e0000), SPH_C32(0x44a0006c), SPH_C32(0x65221800), + SPH_C32(0x07347453), SPH_C32(0x36f6cc24), SPH_C32(0xbb5dd99a), + SPH_C32(0x4484b662) }, + { SPH_C32(0x68b60000), SPH_C32(0x525f0000), SPH_C32(0x990d003a), + SPH_C32(0x6bf81800), SPH_C32(0xc0146c37), SPH_C32(0x364cf230), + SPH_C32(0x8322181b), SPH_C32(0x545f4986), SPH_C32(0xcbb10000), + SPH_C32(0x86600000), SPH_C32(0x3c93006d), SPH_C32(0xa3492000), + SPH_C32(0xe003288f), SPH_C32(0x4f5bf3f9), SPH_C32(0x172e27f5), + SPH_C32(0x7ec0cfd3) }, + { SPH_C32(0x30f50000), SPH_C32(0xd2210000), SPH_C32(0xe13e003b), + SPH_C32(0xad932000), SPH_C32(0x272330eb), SPH_C32(0x4fe1cded), + SPH_C32(0x2f51e674), SPH_C32(0x6e1b3037), SPH_C32(0xd6eb0000), + SPH_C32(0xad120000), SPH_C32(0x741e006d), SPH_C32(0x0c283800), + SPH_C32(0xc5c8064a), SPH_C32(0x87224c29), SPH_C32(0x968c23dc), + SPH_C32(0x60b5f975) }, + { SPH_C32(0xd73a0000), SPH_C32(0xdf5b0000), SPH_C32(0x18c4002e), + SPH_C32(0x2f3a0000), SPH_C32(0x29336c89), SPH_C32(0xce2d8979), + SPH_C32(0x01c916c8), SPH_C32(0xd14487a8), SPH_C32(0x2b930000), + SPH_C32(0x394a0000), SPH_C32(0x421d0072), SPH_C32(0xb6ed0000), + SPH_C32(0xad615743), SPH_C32(0x8650d9c9), SPH_C32(0xcdceb56b), + SPH_C32(0x51eac982) }, + { SPH_C32(0x8f790000), SPH_C32(0x5f250000), SPH_C32(0x60f7002f), + SPH_C32(0xe9513800), SPH_C32(0xce043055), SPH_C32(0xb780b6a4), + SPH_C32(0xadbae8a7), SPH_C32(0xeb00fe19), SPH_C32(0x36c90000), + SPH_C32(0x12380000), SPH_C32(0x0a900072), SPH_C32(0x198c1800), + SPH_C32(0x88aa7986), SPH_C32(0x4e296619), SPH_C32(0x4c6cb142), + SPH_C32(0x4f9fff24) }, + { SPH_C32(0xca600000), SPH_C32(0xf4290000), SPH_C32(0x5049002e), + SPH_C32(0x805b1800), SPH_C32(0x0cf8424c), SPH_C32(0x065436a9), + SPH_C32(0x806b12e1), SPH_C32(0xcf31b10e), SPH_C32(0x6e8a0000), + SPH_C32(0x92460000), SPH_C32(0x72a30073), SPH_C32(0xdfe72000), + SPH_C32(0x6f9d255a), SPH_C32(0x378459c4), SPH_C32(0xe01f4f2d), + SPH_C32(0x75db8695) }, + { SPH_C32(0x92230000), SPH_C32(0x74570000), SPH_C32(0x287a002f), + SPH_C32(0x46302000), SPH_C32(0xebcf1e90), SPH_C32(0x7ff90974), + SPH_C32(0x2c18ec8e), SPH_C32(0xf575c8bf), SPH_C32(0x73d00000), + SPH_C32(0xb9340000), SPH_C32(0x3a2e0073), SPH_C32(0x70863800), + SPH_C32(0x4a560b9f), SPH_C32(0xfffde614), SPH_C32(0x61bd4b04), + SPH_C32(0x6baeb033) }, + { SPH_C32(0x72010000), SPH_C32(0xcb7d0000), SPH_C32(0x56f40030), + SPH_C32(0x53940000), SPH_C32(0xa6ad615c), SPH_C32(0xb6f22344), + SPH_C32(0xf6f87e10), SPH_C32(0xda5fceee), SPH_C32(0x2c7e0000), + SPH_C32(0x8b1a0000), SPH_C32(0xc5690078), SPH_C32(0x21e00000), + SPH_C32(0xee1374ed), SPH_C32(0xce97b76d), SPH_C32(0x39b6d749), + SPH_C32(0xc19f784c) }, + { SPH_C32(0x2a420000), SPH_C32(0x4b030000), SPH_C32(0x2ec70031), + SPH_C32(0x95ff3800), SPH_C32(0x419a3d80), SPH_C32(0xcf5f1c99), + SPH_C32(0x5a8b807f), SPH_C32(0xe01bb75f), SPH_C32(0x31240000), + SPH_C32(0xa0680000), SPH_C32(0x8de40078), SPH_C32(0x8e811800), + SPH_C32(0xcbd85a28), SPH_C32(0x06ee08bd), SPH_C32(0xb814d360), + SPH_C32(0xdfea4eea) }, + { SPH_C32(0x6f5b0000), SPH_C32(0xe00f0000), SPH_C32(0x1e790030), + SPH_C32(0xfcf51800), SPH_C32(0x83664f99), SPH_C32(0x7e8b9c94), + SPH_C32(0x775a7a39), SPH_C32(0xc42af848), SPH_C32(0x69670000), + SPH_C32(0x20160000), SPH_C32(0xf5d70079), SPH_C32(0x48ea2000), + SPH_C32(0x2cef06f4), SPH_C32(0x7f433760), SPH_C32(0x14672d0f), + SPH_C32(0xe5ae375b) }, + { SPH_C32(0x37180000), SPH_C32(0x60710000), SPH_C32(0x664a0031), + SPH_C32(0x3a9e2000), SPH_C32(0x64511345), SPH_C32(0x0726a349), + SPH_C32(0xdb298456), SPH_C32(0xfe6e81f9), SPH_C32(0x743d0000), + SPH_C32(0x0b640000), SPH_C32(0xbd5a0079), SPH_C32(0xe78b3800), + SPH_C32(0x09242831), SPH_C32(0xb73a88b0), SPH_C32(0x95c52926), + SPH_C32(0xfbdb01fd) }, + { SPH_C32(0x01dd0000), SPH_C32(0x80a80000), SPH_C32(0xf4960048), + SPH_C32(0xa6000000), SPH_C32(0x90d57ea2), SPH_C32(0xd7e68c37), + SPH_C32(0x6612cffd), SPH_C32(0x2c94459e), SPH_C32(0x52500000), + SPH_C32(0x29540000), SPH_C32(0x6a61004e), SPH_C32(0xf0ff0000), + SPH_C32(0x9a317eec), SPH_C32(0x452341ce), SPH_C32(0xcf568fe5), + SPH_C32(0x5303130f) }, + { SPH_C32(0x599e0000), SPH_C32(0x00d60000), SPH_C32(0x8ca50049), + SPH_C32(0x606b3800), SPH_C32(0x77e2227e), SPH_C32(0xae4bb3ea), + SPH_C32(0xca613192), SPH_C32(0x16d03c2f), SPH_C32(0x4f0a0000), + SPH_C32(0x02260000), SPH_C32(0x22ec004e), SPH_C32(0x5f9e1800), + SPH_C32(0xbffa5029), SPH_C32(0x8d5afe1e), SPH_C32(0x4ef48bcc), + SPH_C32(0x4d7625a9) }, + { SPH_C32(0x1c870000), SPH_C32(0xabda0000), SPH_C32(0xbc1b0048), + SPH_C32(0x09611800), SPH_C32(0xb51e5067), SPH_C32(0x1f9f33e7), + SPH_C32(0xe7b0cbd4), SPH_C32(0x32e17338), SPH_C32(0x17490000), + SPH_C32(0x82580000), SPH_C32(0x5adf004f), SPH_C32(0x99f52000), + SPH_C32(0x58cd0cf5), SPH_C32(0xf4f7c1c3), SPH_C32(0xe28775a3), + SPH_C32(0x77325c18) }, + { SPH_C32(0x44c40000), SPH_C32(0x2ba40000), SPH_C32(0xc4280049), + SPH_C32(0xcf0a2000), SPH_C32(0x52290cbb), SPH_C32(0x66320c3a), + SPH_C32(0x4bc335bb), SPH_C32(0x08a50a89), SPH_C32(0x0a130000), + SPH_C32(0xa92a0000), SPH_C32(0x1252004f), SPH_C32(0x36943800), + SPH_C32(0x7d062230), SPH_C32(0x3c8e7e13), SPH_C32(0x6325718a), + SPH_C32(0x69476abe) }, + { SPH_C32(0xa4e60000), SPH_C32(0x948e0000), SPH_C32(0xbaa60056), + SPH_C32(0xdaae0000), SPH_C32(0x1f4b7377), SPH_C32(0xaf39260a), + SPH_C32(0x9123a725), SPH_C32(0x278f0cd8), SPH_C32(0x55bd0000), + SPH_C32(0x9b040000), SPH_C32(0xed150044), SPH_C32(0x67f20000), + SPH_C32(0xd9435d42), SPH_C32(0x0de42f6a), SPH_C32(0x3b2eedc7), + SPH_C32(0xc376a2c1) }, + { SPH_C32(0xfca50000), SPH_C32(0x14f00000), SPH_C32(0xc2950057), + SPH_C32(0x1cc53800), SPH_C32(0xf87c2fab), SPH_C32(0xd69419d7), + SPH_C32(0x3d50594a), SPH_C32(0x1dcb7569), SPH_C32(0x48e70000), + SPH_C32(0xb0760000), SPH_C32(0xa5980044), SPH_C32(0xc8931800), + SPH_C32(0xfc887387), SPH_C32(0xc59d90ba), SPH_C32(0xba8ce9ee), + SPH_C32(0xdd039467) }, + { SPH_C32(0xb9bc0000), SPH_C32(0xbffc0000), SPH_C32(0xf22b0056), + SPH_C32(0x75cf1800), SPH_C32(0x3a805db2), SPH_C32(0x674099da), + SPH_C32(0x1081a30c), SPH_C32(0x39fa3a7e), SPH_C32(0x10a40000), + SPH_C32(0x30080000), SPH_C32(0xddab0045), SPH_C32(0x0ef82000), + SPH_C32(0x1bbf2f5b), SPH_C32(0xbc30af67), SPH_C32(0x16ff1781), + SPH_C32(0xe747edd6) }, + { SPH_C32(0xe1ff0000), SPH_C32(0x3f820000), SPH_C32(0x8a180057), + SPH_C32(0xb3a42000), SPH_C32(0xddb7016e), SPH_C32(0x1eeda607), + SPH_C32(0xbcf25d63), SPH_C32(0x03be43cf), SPH_C32(0x0dfe0000), + SPH_C32(0x1b7a0000), SPH_C32(0x95260045), SPH_C32(0xa1993800), + SPH_C32(0x3e74019e), SPH_C32(0x744910b7), SPH_C32(0x975d13a8), + SPH_C32(0xf932db70) }, + { SPH_C32(0x06300000), SPH_C32(0x32f80000), SPH_C32(0x73e20042), + SPH_C32(0x310d0000), SPH_C32(0xd3a75d0c), SPH_C32(0x9f21e293), + SPH_C32(0x926aaddf), SPH_C32(0xbce1f450), SPH_C32(0xf0860000), + SPH_C32(0x8f220000), SPH_C32(0xa325005a), SPH_C32(0x1b5c0000), + SPH_C32(0x56dd5097), SPH_C32(0x753b8557), SPH_C32(0xcc1f851f), + SPH_C32(0xc86deb87) }, + { SPH_C32(0x5e730000), SPH_C32(0xb2860000), SPH_C32(0x0bd10043), + SPH_C32(0xf7663800), SPH_C32(0x349001d0), SPH_C32(0xe68cdd4e), + SPH_C32(0x3e1953b0), SPH_C32(0x86a58de1), SPH_C32(0xeddc0000), + SPH_C32(0xa4500000), SPH_C32(0xeba8005a), SPH_C32(0xb43d1800), + SPH_C32(0x73167e52), SPH_C32(0xbd423a87), SPH_C32(0x4dbd8136), + SPH_C32(0xd618dd21) }, + { SPH_C32(0x1b6a0000), SPH_C32(0x198a0000), SPH_C32(0x3b6f0042), + SPH_C32(0x9e6c1800), SPH_C32(0xf66c73c9), SPH_C32(0x57585d43), + SPH_C32(0x13c8a9f6), SPH_C32(0xa294c2f6), SPH_C32(0xb59f0000), + SPH_C32(0x242e0000), SPH_C32(0x939b005b), SPH_C32(0x72562000), + SPH_C32(0x9421228e), SPH_C32(0xc4ef055a), SPH_C32(0xe1ce7f59), + SPH_C32(0xec5ca490) }, + { SPH_C32(0x43290000), SPH_C32(0x99f40000), SPH_C32(0x435c0043), + SPH_C32(0x58072000), SPH_C32(0x115b2f15), SPH_C32(0x2ef5629e), + SPH_C32(0xbfbb5799), SPH_C32(0x98d0bb47), SPH_C32(0xa8c50000), + SPH_C32(0x0f5c0000), SPH_C32(0xdb16005b), SPH_C32(0xdd373800), + SPH_C32(0xb1ea0c4b), SPH_C32(0x0c96ba8a), SPH_C32(0x606c7b70), + SPH_C32(0xf2299236) }, + { SPH_C32(0xa30b0000), SPH_C32(0x26de0000), SPH_C32(0x3dd2005c), + SPH_C32(0x4da30000), SPH_C32(0x5c3950d9), SPH_C32(0xe7fe48ae), + SPH_C32(0x655bc507), SPH_C32(0xb7fabd16), SPH_C32(0xf76b0000), + SPH_C32(0x3d720000), SPH_C32(0x24510050), SPH_C32(0x8c510000), + SPH_C32(0x15af7339), SPH_C32(0x3dfcebf3), SPH_C32(0x3867e73d), + SPH_C32(0x58185a49) }, + { SPH_C32(0xfb480000), SPH_C32(0xa6a00000), SPH_C32(0x45e1005d), + SPH_C32(0x8bc83800), SPH_C32(0xbb0e0c05), SPH_C32(0x9e537773), + SPH_C32(0xc9283b68), SPH_C32(0x8dbec4a7), SPH_C32(0xea310000), + SPH_C32(0x16000000), SPH_C32(0x6cdc0050), SPH_C32(0x23301800), + SPH_C32(0x30645dfc), SPH_C32(0xf5855423), SPH_C32(0xb9c5e314), + SPH_C32(0x466d6cef) }, + { SPH_C32(0xbe510000), SPH_C32(0x0dac0000), SPH_C32(0x755f005c), + SPH_C32(0xe2c21800), SPH_C32(0x79f27e1c), SPH_C32(0x2f87f77e), + SPH_C32(0xe4f9c12e), SPH_C32(0xa98f8bb0), SPH_C32(0xb2720000), + SPH_C32(0x967e0000), SPH_C32(0x14ef0051), SPH_C32(0xe55b2000), + SPH_C32(0xd7530120), SPH_C32(0x8c286bfe), SPH_C32(0x15b61d7b), + SPH_C32(0x7c29155e) }, + { SPH_C32(0xe6120000), SPH_C32(0x8dd20000), SPH_C32(0x0d6c005d), + SPH_C32(0x24a92000), SPH_C32(0x9ec522c0), SPH_C32(0x562ac8a3), + SPH_C32(0x488a3f41), SPH_C32(0x93cbf201), SPH_C32(0xaf280000), + SPH_C32(0xbd0c0000), SPH_C32(0x5c620051), SPH_C32(0x4a3a3800), + SPH_C32(0xf2982fe5), SPH_C32(0x4451d42e), SPH_C32(0x94141952), + SPH_C32(0x625c23f8) }, + { SPH_C32(0x89450000), SPH_C32(0x9f3c0000), SPH_C32(0x8b590066), + SPH_C32(0x5d4e0000), SPH_C32(0x618d7938), SPH_C32(0xb6481d50), + SPH_C32(0xce87bf91), SPH_C32(0xca84310a), SPH_C32(0x59920000), + SPH_C32(0xf2370000), SPH_C32(0x14e90042), SPH_C32(0xe5790000), + SPH_C32(0x0bcc361f), SPH_C32(0x30a2fa8d), SPH_C32(0x3b36cb7b), + SPH_C32(0x8bb5076c) }, + { SPH_C32(0xd1060000), SPH_C32(0x1f420000), SPH_C32(0xf36a0067), + SPH_C32(0x9b253800), SPH_C32(0x86ba25e4), SPH_C32(0xcfe5228d), + SPH_C32(0x62f441fe), SPH_C32(0xf0c048bb), SPH_C32(0x44c80000), + SPH_C32(0xd9450000), SPH_C32(0x5c640042), SPH_C32(0x4a181800), + SPH_C32(0x2e0718da), SPH_C32(0xf8db455d), SPH_C32(0xba94cf52), + SPH_C32(0x95c031ca) }, + { SPH_C32(0x941f0000), SPH_C32(0xb44e0000), SPH_C32(0xc3d40066), + SPH_C32(0xf22f1800), SPH_C32(0x444657fd), SPH_C32(0x7e31a280), + SPH_C32(0x4f25bbb8), SPH_C32(0xd4f107ac), SPH_C32(0x1c8b0000), + SPH_C32(0x593b0000), SPH_C32(0x24570043), SPH_C32(0x8c732000), + SPH_C32(0xc9304406), SPH_C32(0x81767a80), SPH_C32(0x16e7313d), + SPH_C32(0xaf84487b) }, + { SPH_C32(0xcc5c0000), SPH_C32(0x34300000), SPH_C32(0xbbe70067), + SPH_C32(0x34442000), SPH_C32(0xa3710b21), SPH_C32(0x079c9d5d), + SPH_C32(0xe35645d7), SPH_C32(0xeeb57e1d), SPH_C32(0x01d10000), + SPH_C32(0x72490000), SPH_C32(0x6cda0043), SPH_C32(0x23123800), + SPH_C32(0xecfb6ac3), SPH_C32(0x490fc550), SPH_C32(0x97453514), + SPH_C32(0xb1f17edd) }, + { SPH_C32(0x2c7e0000), SPH_C32(0x8b1a0000), SPH_C32(0xc5690078), + SPH_C32(0x21e00000), SPH_C32(0xee1374ed), SPH_C32(0xce97b76d), + SPH_C32(0x39b6d749), SPH_C32(0xc19f784c), SPH_C32(0x5e7f0000), + SPH_C32(0x40670000), SPH_C32(0x939d0048), SPH_C32(0x72740000), + SPH_C32(0x48be15b1), SPH_C32(0x78659429), SPH_C32(0xcf4ea959), + SPH_C32(0x1bc0b6a2) }, + { SPH_C32(0x743d0000), SPH_C32(0x0b640000), SPH_C32(0xbd5a0079), + SPH_C32(0xe78b3800), SPH_C32(0x09242831), SPH_C32(0xb73a88b0), + SPH_C32(0x95c52926), SPH_C32(0xfbdb01fd), SPH_C32(0x43250000), + SPH_C32(0x6b150000), SPH_C32(0xdb100048), SPH_C32(0xdd151800), + SPH_C32(0x6d753b74), SPH_C32(0xb01c2bf9), SPH_C32(0x4eecad70), + SPH_C32(0x05b58004) }, + { SPH_C32(0x31240000), SPH_C32(0xa0680000), SPH_C32(0x8de40078), + SPH_C32(0x8e811800), SPH_C32(0xcbd85a28), SPH_C32(0x06ee08bd), + SPH_C32(0xb814d360), SPH_C32(0xdfea4eea), SPH_C32(0x1b660000), + SPH_C32(0xeb6b0000), SPH_C32(0xa3230049), SPH_C32(0x1b7e2000), + SPH_C32(0x8a4267a8), SPH_C32(0xc9b11424), SPH_C32(0xe29f531f), + SPH_C32(0x3ff1f9b5) }, + { SPH_C32(0x69670000), SPH_C32(0x20160000), SPH_C32(0xf5d70079), + SPH_C32(0x48ea2000), SPH_C32(0x2cef06f4), SPH_C32(0x7f433760), + SPH_C32(0x14672d0f), SPH_C32(0xe5ae375b), SPH_C32(0x063c0000), + SPH_C32(0xc0190000), SPH_C32(0xebae0049), SPH_C32(0xb41f3800), + SPH_C32(0xaf89496d), SPH_C32(0x01c8abf4), SPH_C32(0x633d5736), + SPH_C32(0x2184cf13) }, + { SPH_C32(0x8ea80000), SPH_C32(0x2d6c0000), SPH_C32(0x0c2d006c), + SPH_C32(0xca430000), SPH_C32(0x22ff5a96), SPH_C32(0xfe8f73f4), + SPH_C32(0x3affddb3), SPH_C32(0x5af180c4), SPH_C32(0xfb440000), + SPH_C32(0x54410000), SPH_C32(0xddad0056), SPH_C32(0x0eda0000), + SPH_C32(0xc7201864), SPH_C32(0x00ba3e14), SPH_C32(0x387fc181), + SPH_C32(0x10dbffe4) }, + { SPH_C32(0xd6eb0000), SPH_C32(0xad120000), SPH_C32(0x741e006d), + SPH_C32(0x0c283800), SPH_C32(0xc5c8064a), SPH_C32(0x87224c29), + SPH_C32(0x968c23dc), SPH_C32(0x60b5f975), SPH_C32(0xe61e0000), + SPH_C32(0x7f330000), SPH_C32(0x95200056), SPH_C32(0xa1bb1800), + SPH_C32(0xe2eb36a1), SPH_C32(0xc8c381c4), SPH_C32(0xb9ddc5a8), + SPH_C32(0x0eaec942) }, + { SPH_C32(0x93f20000), SPH_C32(0x061e0000), SPH_C32(0x44a0006c), + SPH_C32(0x65221800), SPH_C32(0x07347453), SPH_C32(0x36f6cc24), + SPH_C32(0xbb5dd99a), SPH_C32(0x4484b662), SPH_C32(0xbe5d0000), + SPH_C32(0xff4d0000), SPH_C32(0xed130057), SPH_C32(0x67d02000), + SPH_C32(0x05dc6a7d), SPH_C32(0xb16ebe19), SPH_C32(0x15ae3bc7), + SPH_C32(0x34eab0f3) }, + { SPH_C32(0xcbb10000), SPH_C32(0x86600000), SPH_C32(0x3c93006d), + SPH_C32(0xa3492000), SPH_C32(0xe003288f), SPH_C32(0x4f5bf3f9), + SPH_C32(0x172e27f5), SPH_C32(0x7ec0cfd3), SPH_C32(0xa3070000), + SPH_C32(0xd43f0000), SPH_C32(0xa59e0057), SPH_C32(0xc8b13800), + SPH_C32(0x201744b8), SPH_C32(0x791701c9), SPH_C32(0x940c3fee), + SPH_C32(0x2a9f8655) }, + { SPH_C32(0x2b930000), SPH_C32(0x394a0000), SPH_C32(0x421d0072), + SPH_C32(0xb6ed0000), SPH_C32(0xad615743), SPH_C32(0x8650d9c9), + SPH_C32(0xcdceb56b), SPH_C32(0x51eac982), SPH_C32(0xfca90000), + SPH_C32(0xe6110000), SPH_C32(0x5ad9005c), SPH_C32(0x99d70000), + SPH_C32(0x84523bca), SPH_C32(0x487d50b0), SPH_C32(0xcc07a3a3), + SPH_C32(0x80ae4e2a) }, + { SPH_C32(0x73d00000), SPH_C32(0xb9340000), SPH_C32(0x3a2e0073), + SPH_C32(0x70863800), SPH_C32(0x4a560b9f), SPH_C32(0xfffde614), + SPH_C32(0x61bd4b04), SPH_C32(0x6baeb033), SPH_C32(0xe1f30000), + SPH_C32(0xcd630000), SPH_C32(0x1254005c), SPH_C32(0x36b61800), + SPH_C32(0xa199150f), SPH_C32(0x8004ef60), SPH_C32(0x4da5a78a), + SPH_C32(0x9edb788c) }, + { SPH_C32(0x36c90000), SPH_C32(0x12380000), SPH_C32(0x0a900072), + SPH_C32(0x198c1800), SPH_C32(0x88aa7986), SPH_C32(0x4e296619), + SPH_C32(0x4c6cb142), SPH_C32(0x4f9fff24), SPH_C32(0xb9b00000), + SPH_C32(0x4d1d0000), SPH_C32(0x6a67005d), SPH_C32(0xf0dd2000), + SPH_C32(0x46ae49d3), SPH_C32(0xf9a9d0bd), SPH_C32(0xe1d659e5), + SPH_C32(0xa49f013d) }, + { SPH_C32(0x6e8a0000), SPH_C32(0x92460000), SPH_C32(0x72a30073), + SPH_C32(0xdfe72000), SPH_C32(0x6f9d255a), SPH_C32(0x378459c4), + SPH_C32(0xe01f4f2d), SPH_C32(0x75db8695), SPH_C32(0xa4ea0000), + SPH_C32(0x666f0000), SPH_C32(0x22ea005d), SPH_C32(0x5fbc3800), + SPH_C32(0x63656716), SPH_C32(0x31d06f6d), SPH_C32(0x60745dcc), + SPH_C32(0xbaea379b) }, + { SPH_C32(0x0a1f0000), SPH_C32(0x5bcb0000), SPH_C32(0x8a1e0044), + SPH_C32(0xb3860000), SPH_C32(0x01283651), SPH_C32(0xa2673774), + SPH_C32(0x92728b63), SPH_C32(0xf42251fd), SPH_C32(0xd10a0000), + SPH_C32(0xeda30000), SPH_C32(0x6b26006c), SPH_C32(0x1e370000), + SPH_C32(0xfa943185), SPH_C32(0x510c6bea), SPH_C32(0x93a3bb17), + SPH_C32(0x6da573f8) }, + { SPH_C32(0x525c0000), SPH_C32(0xdbb50000), SPH_C32(0xf22d0045), + SPH_C32(0x75ed3800), SPH_C32(0xe61f6a8d), SPH_C32(0xdbca08a9), + SPH_C32(0x3e01750c), SPH_C32(0xce66284c), SPH_C32(0xcc500000), + SPH_C32(0xc6d10000), SPH_C32(0x23ab006c), SPH_C32(0xb1561800), + SPH_C32(0xdf5f1f40), SPH_C32(0x9975d43a), SPH_C32(0x1201bf3e), + SPH_C32(0x73d0455e) }, + { SPH_C32(0x17450000), SPH_C32(0x70b90000), SPH_C32(0xc2930044), + SPH_C32(0x1ce71800), SPH_C32(0x24e31894), SPH_C32(0x6a1e88a4), + SPH_C32(0x13d08f4a), SPH_C32(0xea57675b), SPH_C32(0x94130000), + SPH_C32(0x46af0000), SPH_C32(0x5b98006d), SPH_C32(0x773d2000), + SPH_C32(0x3868439c), SPH_C32(0xe0d8ebe7), SPH_C32(0xbe724151), + SPH_C32(0x49943cef) }, + { SPH_C32(0x4f060000), SPH_C32(0xf0c70000), SPH_C32(0xbaa00045), + SPH_C32(0xda8c2000), SPH_C32(0xc3d44448), SPH_C32(0x13b3b779), + SPH_C32(0xbfa37125), SPH_C32(0xd0131eea), SPH_C32(0x89490000), + SPH_C32(0x6ddd0000), SPH_C32(0x1315006d), SPH_C32(0xd85c3800), + SPH_C32(0x1da36d59), SPH_C32(0x28a15437), SPH_C32(0x3fd04578), + SPH_C32(0x57e10a49) }, + { SPH_C32(0xaf240000), SPH_C32(0x4fed0000), SPH_C32(0xc42e005a), + SPH_C32(0xcf280000), SPH_C32(0x8eb63b84), SPH_C32(0xdab89d49), + SPH_C32(0x6543e3bb), SPH_C32(0xff3918bb), SPH_C32(0xd6e70000), + SPH_C32(0x5ff30000), SPH_C32(0xec520066), SPH_C32(0x893a0000), + SPH_C32(0xb9e6122b), SPH_C32(0x19cb054e), SPH_C32(0x67dbd935), + SPH_C32(0xfdd0c236) }, + { SPH_C32(0xf7670000), SPH_C32(0xcf930000), SPH_C32(0xbc1d005b), + SPH_C32(0x09433800), SPH_C32(0x69816758), SPH_C32(0xa315a294), + SPH_C32(0xc9301dd4), SPH_C32(0xc57d610a), SPH_C32(0xcbbd0000), + SPH_C32(0x74810000), SPH_C32(0xa4df0066), SPH_C32(0x265b1800), + SPH_C32(0x9c2d3cee), SPH_C32(0xd1b2ba9e), SPH_C32(0xe679dd1c), + SPH_C32(0xe3a5f490) }, + { SPH_C32(0xb27e0000), SPH_C32(0x649f0000), SPH_C32(0x8ca3005a), + SPH_C32(0x60491800), SPH_C32(0xab7d1541), SPH_C32(0x12c12299), + SPH_C32(0xe4e1e792), SPH_C32(0xe14c2e1d), SPH_C32(0x93fe0000), + SPH_C32(0xf4ff0000), SPH_C32(0xdcec0067), SPH_C32(0xe0302000), + SPH_C32(0x7b1a6032), SPH_C32(0xa81f8543), SPH_C32(0x4a0a2373), + SPH_C32(0xd9e18d21) }, + { SPH_C32(0xea3d0000), SPH_C32(0xe4e10000), SPH_C32(0xf490005b), + SPH_C32(0xa6222000), SPH_C32(0x4c4a499d), SPH_C32(0x6b6c1d44), + SPH_C32(0x489219fd), SPH_C32(0xdb0857ac), SPH_C32(0x8ea40000), + SPH_C32(0xdf8d0000), SPH_C32(0x94610067), SPH_C32(0x4f513800), + SPH_C32(0x5ed14ef7), SPH_C32(0x60663a93), SPH_C32(0xcba8275a), + SPH_C32(0xc794bb87) }, + { SPH_C32(0x0df20000), SPH_C32(0xe99b0000), SPH_C32(0x0d6a004e), + SPH_C32(0x248b0000), SPH_C32(0x425a15ff), SPH_C32(0xeaa059d0), + SPH_C32(0x660ae941), SPH_C32(0x6457e033), SPH_C32(0x73dc0000), + SPH_C32(0x4bd50000), SPH_C32(0xa2620078), SPH_C32(0xf5940000), + SPH_C32(0x36781ffe), SPH_C32(0x6114af73), SPH_C32(0x90eab1ed), + SPH_C32(0xf6cb8b70) }, + { SPH_C32(0x55b10000), SPH_C32(0x69e50000), SPH_C32(0x7559004f), + SPH_C32(0xe2e03800), SPH_C32(0xa56d4923), SPH_C32(0x930d660d), + SPH_C32(0xca79172e), SPH_C32(0x5e139982), SPH_C32(0x6e860000), + SPH_C32(0x60a70000), SPH_C32(0xeaef0078), SPH_C32(0x5af51800), + SPH_C32(0x13b3313b), SPH_C32(0xa96d10a3), SPH_C32(0x1148b5c4), + SPH_C32(0xe8bebdd6) }, + { SPH_C32(0x10a80000), SPH_C32(0xc2e90000), SPH_C32(0x45e7004e), + SPH_C32(0x8bea1800), SPH_C32(0x67913b3a), SPH_C32(0x22d9e600), + SPH_C32(0xe7a8ed68), SPH_C32(0x7a22d695), SPH_C32(0x36c50000), + SPH_C32(0xe0d90000), SPH_C32(0x92dc0079), SPH_C32(0x9c9e2000), + SPH_C32(0xf4846de7), SPH_C32(0xd0c02f7e), SPH_C32(0xbd3b4bab), + SPH_C32(0xd2fac467) }, + { SPH_C32(0x48eb0000), SPH_C32(0x42970000), SPH_C32(0x3dd4004f), + SPH_C32(0x4d812000), SPH_C32(0x80a667e6), SPH_C32(0x5b74d9dd), + SPH_C32(0x4bdb1307), SPH_C32(0x4066af24), SPH_C32(0x2b9f0000), + SPH_C32(0xcbab0000), SPH_C32(0xda510079), SPH_C32(0x33ff3800), + SPH_C32(0xd14f4322), SPH_C32(0x18b990ae), SPH_C32(0x3c994f82), + SPH_C32(0xcc8ff2c1) }, + { SPH_C32(0xa8c90000), SPH_C32(0xfdbd0000), SPH_C32(0x435a0050), + SPH_C32(0x58250000), SPH_C32(0xcdc4182a), SPH_C32(0x927ff3ed), + SPH_C32(0x913b8199), SPH_C32(0x6f4ca975), SPH_C32(0x74310000), + SPH_C32(0xf9850000), SPH_C32(0x25160072), SPH_C32(0x62990000), + SPH_C32(0x750a3c50), SPH_C32(0x29d3c1d7), SPH_C32(0x6492d3cf), + SPH_C32(0x66be3abe) }, + { SPH_C32(0xf08a0000), SPH_C32(0x7dc30000), SPH_C32(0x3b690051), + SPH_C32(0x9e4e3800), SPH_C32(0x2af344f6), SPH_C32(0xebd2cc30), + SPH_C32(0x3d487ff6), SPH_C32(0x5508d0c4), SPH_C32(0x696b0000), + SPH_C32(0xd2f70000), SPH_C32(0x6d9b0072), SPH_C32(0xcdf81800), + SPH_C32(0x50c11295), SPH_C32(0xe1aa7e07), SPH_C32(0xe530d7e6), + SPH_C32(0x78cb0c18) }, + { SPH_C32(0xb5930000), SPH_C32(0xd6cf0000), SPH_C32(0x0bd70050), + SPH_C32(0xf7441800), SPH_C32(0xe80f36ef), SPH_C32(0x5a064c3d), + SPH_C32(0x109985b0), SPH_C32(0x71399fd3), SPH_C32(0x31280000), + SPH_C32(0x52890000), SPH_C32(0x15a80073), SPH_C32(0x0b932000), + SPH_C32(0xb7f64e49), SPH_C32(0x980741da), SPH_C32(0x49432989), + SPH_C32(0x428f75a9) }, + { SPH_C32(0xedd00000), SPH_C32(0x56b10000), SPH_C32(0x73e40051), + SPH_C32(0x312f2000), SPH_C32(0x0f386a33), SPH_C32(0x23ab73e0), + SPH_C32(0xbcea7bdf), SPH_C32(0x4b7de662), SPH_C32(0x2c720000), + SPH_C32(0x79fb0000), SPH_C32(0x5d250073), SPH_C32(0xa4f23800), + SPH_C32(0x923d608c), SPH_C32(0x507efe0a), SPH_C32(0xc8e12da0), + SPH_C32(0x5cfa430f) }, + { SPH_C32(0x82870000), SPH_C32(0x445f0000), SPH_C32(0xf5d1006a), + SPH_C32(0x48c80000), SPH_C32(0xf07031cb), SPH_C32(0xc3c9a613), + SPH_C32(0x3ae7fb0f), SPH_C32(0x12322569), SPH_C32(0xdac80000), + SPH_C32(0x36c00000), SPH_C32(0x15ae0060), SPH_C32(0x0bb10000), + SPH_C32(0x6b697976), SPH_C32(0x248dd0a9), SPH_C32(0x67c3ff89), + SPH_C32(0xb513679b) }, + { SPH_C32(0xdac40000), SPH_C32(0xc4210000), SPH_C32(0x8de2006b), + SPH_C32(0x8ea33800), SPH_C32(0x17476d17), SPH_C32(0xba6499ce), + SPH_C32(0x96940560), SPH_C32(0x28765cd8), SPH_C32(0xc7920000), + SPH_C32(0x1db20000), SPH_C32(0x5d230060), SPH_C32(0xa4d01800), + SPH_C32(0x4ea257b3), SPH_C32(0xecf46f79), SPH_C32(0xe661fba0), + SPH_C32(0xab66513d) }, + { SPH_C32(0x9fdd0000), SPH_C32(0x6f2d0000), SPH_C32(0xbd5c006a), + SPH_C32(0xe7a91800), SPH_C32(0xd5bb1f0e), SPH_C32(0x0bb019c3), + SPH_C32(0xbb45ff26), SPH_C32(0x0c4713cf), SPH_C32(0x9fd10000), + SPH_C32(0x9dcc0000), SPH_C32(0x25100061), SPH_C32(0x62bb2000), + SPH_C32(0xa9950b6f), SPH_C32(0x955950a4), SPH_C32(0x4a1205cf), + SPH_C32(0x9122288c) }, + { SPH_C32(0xc79e0000), SPH_C32(0xef530000), SPH_C32(0xc56f006b), + SPH_C32(0x21c22000), SPH_C32(0x328c43d2), SPH_C32(0x721d261e), + SPH_C32(0x17360149), SPH_C32(0x36036a7e), SPH_C32(0x828b0000), + SPH_C32(0xb6be0000), SPH_C32(0x6d9d0061), SPH_C32(0xcdda3800), + SPH_C32(0x8c5e25aa), SPH_C32(0x5d20ef74), SPH_C32(0xcbb001e6), + SPH_C32(0x8f571e2a) }, + { SPH_C32(0x27bc0000), SPH_C32(0x50790000), SPH_C32(0xbbe10074), + SPH_C32(0x34660000), SPH_C32(0x7fee3c1e), SPH_C32(0xbb160c2e), + SPH_C32(0xcdd693d7), SPH_C32(0x19296c2f), SPH_C32(0xdd250000), + SPH_C32(0x84900000), SPH_C32(0x92da006a), SPH_C32(0x9cbc0000), + SPH_C32(0x281b5ad8), SPH_C32(0x6c4abe0d), SPH_C32(0x93bb9dab), + SPH_C32(0x2566d655) }, + { SPH_C32(0x7fff0000), SPH_C32(0xd0070000), SPH_C32(0xc3d20075), + SPH_C32(0xf20d3800), SPH_C32(0x98d960c2), SPH_C32(0xc2bb33f3), + SPH_C32(0x61a56db8), SPH_C32(0x236d159e), SPH_C32(0xc07f0000), + SPH_C32(0xafe20000), SPH_C32(0xda57006a), SPH_C32(0x33dd1800), + SPH_C32(0x0dd0741d), SPH_C32(0xa43301dd), SPH_C32(0x12199982), + SPH_C32(0x3b13e0f3) }, + { SPH_C32(0x3ae60000), SPH_C32(0x7b0b0000), SPH_C32(0xf36c0074), + SPH_C32(0x9b071800), SPH_C32(0x5a2512db), SPH_C32(0x736fb3fe), + SPH_C32(0x4c7497fe), SPH_C32(0x075c5a89), SPH_C32(0x983c0000), + SPH_C32(0x2f9c0000), SPH_C32(0xa264006b), SPH_C32(0xf5b62000), + SPH_C32(0xeae728c1), SPH_C32(0xdd9e3e00), SPH_C32(0xbe6a67ed), + SPH_C32(0x01579942) }, + { SPH_C32(0x62a50000), SPH_C32(0xfb750000), SPH_C32(0x8b5f0075), + SPH_C32(0x5d6c2000), SPH_C32(0xbd124e07), SPH_C32(0x0ac28c23), + SPH_C32(0xe0076991), SPH_C32(0x3d182338), SPH_C32(0x85660000), + SPH_C32(0x04ee0000), SPH_C32(0xeae9006b), SPH_C32(0x5ad73800), + SPH_C32(0xcf2c0604), SPH_C32(0x15e781d0), SPH_C32(0x3fc863c4), + SPH_C32(0x1f22afe4) }, + { SPH_C32(0x856a0000), SPH_C32(0xf60f0000), SPH_C32(0x72a50060), + SPH_C32(0xdfc50000), SPH_C32(0xb3021265), SPH_C32(0x8b0ec8b7), + SPH_C32(0xce9f992d), SPH_C32(0x824794a7), SPH_C32(0x781e0000), + SPH_C32(0x90b60000), SPH_C32(0xdcea0074), SPH_C32(0xe0120000), + SPH_C32(0xa785570d), SPH_C32(0x14951430), SPH_C32(0x648af573), + SPH_C32(0x2e7d9f13) }, + { SPH_C32(0xdd290000), SPH_C32(0x76710000), SPH_C32(0x0a960061), + SPH_C32(0x19ae3800), SPH_C32(0x54354eb9), SPH_C32(0xf2a3f76a), + SPH_C32(0x62ec6742), SPH_C32(0xb803ed16), SPH_C32(0x65440000), + SPH_C32(0xbbc40000), SPH_C32(0x94670074), SPH_C32(0x4f731800), + SPH_C32(0x824e79c8), SPH_C32(0xdcecabe0), SPH_C32(0xe528f15a), + SPH_C32(0x3008a9b5) }, + { SPH_C32(0x98300000), SPH_C32(0xdd7d0000), SPH_C32(0x3a280060), + SPH_C32(0x70a41800), SPH_C32(0x96c93ca0), SPH_C32(0x43777767), + SPH_C32(0x4f3d9d04), SPH_C32(0x9c32a201), SPH_C32(0x3d070000), + SPH_C32(0x3bba0000), SPH_C32(0xec540075), SPH_C32(0x89182000), + SPH_C32(0x65792514), SPH_C32(0xa541943d), SPH_C32(0x495b0f35), + SPH_C32(0x0a4cd004) }, + { SPH_C32(0xc0730000), SPH_C32(0x5d030000), SPH_C32(0x421b0061), + SPH_C32(0xb6cf2000), SPH_C32(0x71fe607c), SPH_C32(0x3ada48ba), + SPH_C32(0xe34e636b), SPH_C32(0xa676dbb0), SPH_C32(0x205d0000), + SPH_C32(0x10c80000), SPH_C32(0xa4d90075), SPH_C32(0x26793800), + SPH_C32(0x40b20bd1), SPH_C32(0x6d382bed), SPH_C32(0xc8f90b1c), + SPH_C32(0x1439e6a2) }, + { SPH_C32(0x20510000), SPH_C32(0xe2290000), SPH_C32(0x3c95007e), + SPH_C32(0xa36b0000), SPH_C32(0x3c9c1fb0), SPH_C32(0xf3d1628a), + SPH_C32(0x39aef1f5), SPH_C32(0x895cdde1), SPH_C32(0x7ff30000), + SPH_C32(0x22e60000), SPH_C32(0x5b9e007e), SPH_C32(0x771f0000), + SPH_C32(0xe4f774a3), SPH_C32(0x5c527a94), SPH_C32(0x90f29751), + SPH_C32(0xbe082edd) }, + { SPH_C32(0x78120000), SPH_C32(0x62570000), SPH_C32(0x44a6007f), + SPH_C32(0x65003800), SPH_C32(0xdbab436c), SPH_C32(0x8a7c5d57), + SPH_C32(0x95dd0f9a), SPH_C32(0xb318a450), SPH_C32(0x62a90000), + SPH_C32(0x09940000), SPH_C32(0x1313007e), SPH_C32(0xd87e1800), + SPH_C32(0xc13c5a66), SPH_C32(0x942bc544), SPH_C32(0x11509378), + SPH_C32(0xa07d187b) }, + { SPH_C32(0x3d0b0000), SPH_C32(0xc95b0000), SPH_C32(0x7418007e), + SPH_C32(0x0c0a1800), SPH_C32(0x19573175), SPH_C32(0x3ba8dd5a), + SPH_C32(0xb80cf5dc), SPH_C32(0x9729eb47), SPH_C32(0x3aea0000), + SPH_C32(0x89ea0000), SPH_C32(0x6b20007f), SPH_C32(0x1e152000), + SPH_C32(0x260b06ba), SPH_C32(0xed86fa99), SPH_C32(0xbd236d17), + SPH_C32(0x9a3961ca) }, + { SPH_C32(0x65480000), SPH_C32(0x49250000), SPH_C32(0x0c2b007f), + SPH_C32(0xca612000), SPH_C32(0xfe606da9), SPH_C32(0x4205e287), + SPH_C32(0x147f0bb3), SPH_C32(0xad6d92f6), SPH_C32(0x27b00000), + SPH_C32(0xa2980000), SPH_C32(0x23ad007f), SPH_C32(0xb1743800), + SPH_C32(0x03c0287f), SPH_C32(0x25ff4549), SPH_C32(0x3c81693e), + SPH_C32(0x844c576c) } +}; + +static const sph_u32 T512_48[256][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0xe6280000), SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), + SPH_C32(0xd3d002e0), SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), + SPH_C32(0x289506b4), SPH_C32(0xd75a4897), SPH_C32(0xf0c50000), + SPH_C32(0x59230000), SPH_C32(0x45820000), SPH_C32(0xe18d00c0), + SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), SPH_C32(0xcbe0fe1c), + SPH_C32(0x56a7b19f) }, + { SPH_C32(0xf0c50000), SPH_C32(0x59230000), SPH_C32(0x45820000), + SPH_C32(0xe18d00c0), SPH_C32(0x3b6d0631), SPH_C32(0xc2ed5699), + SPH_C32(0xcbe0fe1c), SPH_C32(0x56a7b19f), SPH_C32(0x16ed0000), + SPH_C32(0x15680000), SPH_C32(0xedd70000), SPH_C32(0x325d0220), + SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), SPH_C32(0xe375f8a8), + SPH_C32(0x81fdf908) }, + { SPH_C32(0x16ed0000), SPH_C32(0x15680000), SPH_C32(0xedd70000), + SPH_C32(0x325d0220), SPH_C32(0xe30c3689), SPH_C32(0x5a4ae643), + SPH_C32(0xe375f8a8), SPH_C32(0x81fdf908), SPH_C32(0xe6280000), + SPH_C32(0x4c4b0000), SPH_C32(0xa8550000), SPH_C32(0xd3d002e0), + SPH_C32(0xd86130b8), SPH_C32(0x98a7b0da), SPH_C32(0x289506b4), + SPH_C32(0xd75a4897) }, + { SPH_C32(0xb4310000), SPH_C32(0x77330000), SPH_C32(0xb15d0000), + SPH_C32(0x7fd004e0), SPH_C32(0x78a26138), SPH_C32(0xd116c35d), + SPH_C32(0xd256d489), SPH_C32(0x4e6f74de), SPH_C32(0xe3060000), + SPH_C32(0xbdc10000), SPH_C32(0x87130000), SPH_C32(0xbff20060), + SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), SPH_C32(0x73c5ab06), + SPH_C32(0x5bd61539) }, + { SPH_C32(0x52190000), SPH_C32(0x3b780000), SPH_C32(0x19080000), + SPH_C32(0xac000600), SPH_C32(0xa0c35180), SPH_C32(0x49b17387), + SPH_C32(0xfac3d23d), SPH_C32(0x99353c49), SPH_C32(0x13c30000), + SPH_C32(0xe4e20000), SPH_C32(0xc2910000), SPH_C32(0x5e7f00a0), + SPH_C32(0x15d70c2b), SPH_C32(0x4f5861c8), SPH_C32(0xb825551a), + SPH_C32(0x0d71a4a6) }, + { SPH_C32(0x44f40000), SPH_C32(0x2e100000), SPH_C32(0xf4df0000), + SPH_C32(0x9e5d0420), SPH_C32(0x43cf6709), SPH_C32(0x13fb95c4), + SPH_C32(0x19b62a95), SPH_C32(0x18c8c541), SPH_C32(0xf5eb0000), + SPH_C32(0xa8a90000), SPH_C32(0x6ac40000), SPH_C32(0x8daf0240), + SPH_C32(0xcdb63c93), SPH_C32(0xd7ffd112), SPH_C32(0x90b053ae), + SPH_C32(0xda2bec31) }, + { SPH_C32(0xa2dc0000), SPH_C32(0x625b0000), SPH_C32(0x5c8a0000), + SPH_C32(0x4d8d06c0), SPH_C32(0x9bae57b1), SPH_C32(0x8b5c251e), + SPH_C32(0x31232c21), SPH_C32(0xcf928dd6), SPH_C32(0x052e0000), + SPH_C32(0xf18a0000), SPH_C32(0x2f460000), SPH_C32(0x6c220280), + SPH_C32(0xf6db3aa2), SPH_C32(0x1512878b), SPH_C32(0x5b50adb2), + SPH_C32(0x8c8c5dae) }, + { SPH_C32(0xe3060000), SPH_C32(0xbdc10000), SPH_C32(0x87130000), + SPH_C32(0xbff20060), SPH_C32(0x2eba0a1a), SPH_C32(0x8db53751), + SPH_C32(0x73c5ab06), SPH_C32(0x5bd61539), SPH_C32(0x57370000), + SPH_C32(0xcaf20000), SPH_C32(0x364e0000), SPH_C32(0xc0220480), + SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), SPH_C32(0xa1937f8f), + SPH_C32(0x15b961e7) }, + { SPH_C32(0x052e0000), SPH_C32(0xf18a0000), SPH_C32(0x2f460000), + SPH_C32(0x6c220280), SPH_C32(0xf6db3aa2), SPH_C32(0x1512878b), + SPH_C32(0x5b50adb2), SPH_C32(0x8c8c5dae), SPH_C32(0xa7f20000), + SPH_C32(0x93d10000), SPH_C32(0x73cc0000), SPH_C32(0x21af0440), + SPH_C32(0x6d756d13), SPH_C32(0x9e4ea295), SPH_C32(0x6a738193), + SPH_C32(0x431ed078) }, + { SPH_C32(0x13c30000), SPH_C32(0xe4e20000), SPH_C32(0xc2910000), + SPH_C32(0x5e7f00a0), SPH_C32(0x15d70c2b), SPH_C32(0x4f5861c8), + SPH_C32(0xb825551a), SPH_C32(0x0d71a4a6), SPH_C32(0x41da0000), + SPH_C32(0xdf9a0000), SPH_C32(0xdb990000), SPH_C32(0xf27f06a0), + SPH_C32(0xb5145dab), SPH_C32(0x06e9124f), SPH_C32(0x42e68727), + SPH_C32(0x944498ef) }, + { SPH_C32(0xf5eb0000), SPH_C32(0xa8a90000), SPH_C32(0x6ac40000), + SPH_C32(0x8daf0240), SPH_C32(0xcdb63c93), SPH_C32(0xd7ffd112), + SPH_C32(0x90b053ae), SPH_C32(0xda2bec31), SPH_C32(0xb11f0000), + SPH_C32(0x86b90000), SPH_C32(0x9e1b0000), SPH_C32(0x13f20660), + SPH_C32(0x8e795b9a), SPH_C32(0xc40444d6), SPH_C32(0x8906793b), + SPH_C32(0xc2e32970) }, + { SPH_C32(0x57370000), SPH_C32(0xcaf20000), SPH_C32(0x364e0000), + SPH_C32(0xc0220480), SPH_C32(0x56186b22), SPH_C32(0x5ca3f40c), + SPH_C32(0xa1937f8f), SPH_C32(0x15b961e7), SPH_C32(0xb4310000), + SPH_C32(0x77330000), SPH_C32(0xb15d0000), SPH_C32(0x7fd004e0), + SPH_C32(0x78a26138), SPH_C32(0xd116c35d), SPH_C32(0xd256d489), + SPH_C32(0x4e6f74de) }, + { SPH_C32(0xb11f0000), SPH_C32(0x86b90000), SPH_C32(0x9e1b0000), + SPH_C32(0x13f20660), SPH_C32(0x8e795b9a), SPH_C32(0xc40444d6), + SPH_C32(0x8906793b), SPH_C32(0xc2e32970), SPH_C32(0x44f40000), + SPH_C32(0x2e100000), SPH_C32(0xf4df0000), SPH_C32(0x9e5d0420), + SPH_C32(0x43cf6709), SPH_C32(0x13fb95c4), SPH_C32(0x19b62a95), + SPH_C32(0x18c8c541) }, + { SPH_C32(0xa7f20000), SPH_C32(0x93d10000), SPH_C32(0x73cc0000), + SPH_C32(0x21af0440), SPH_C32(0x6d756d13), SPH_C32(0x9e4ea295), + SPH_C32(0x6a738193), SPH_C32(0x431ed078), SPH_C32(0xa2dc0000), + SPH_C32(0x625b0000), SPH_C32(0x5c8a0000), SPH_C32(0x4d8d06c0), + SPH_C32(0x9bae57b1), SPH_C32(0x8b5c251e), SPH_C32(0x31232c21), + SPH_C32(0xcf928dd6) }, + { SPH_C32(0x41da0000), SPH_C32(0xdf9a0000), SPH_C32(0xdb990000), + SPH_C32(0xf27f06a0), SPH_C32(0xb5145dab), SPH_C32(0x06e9124f), + SPH_C32(0x42e68727), SPH_C32(0x944498ef), SPH_C32(0x52190000), + SPH_C32(0x3b780000), SPH_C32(0x19080000), SPH_C32(0xac000600), + SPH_C32(0xa0c35180), SPH_C32(0x49b17387), SPH_C32(0xfac3d23d), + SPH_C32(0x99353c49) }, + { SPH_C32(0x02f20000), SPH_C32(0xa2810000), SPH_C32(0x873f0000), + SPH_C32(0xe36c7800), SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), + SPH_C32(0xc4c23237), SPH_C32(0x7f32259e), SPH_C32(0xbadd0000), + SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), SPH_C32(0xf7282800), + SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), SPH_C32(0xea5a8d14), + SPH_C32(0x2a2c18f0) }, + { SPH_C32(0xe4da0000), SPH_C32(0xeeca0000), SPH_C32(0x2f6a0000), + SPH_C32(0x30bc7ae0), SPH_C32(0xc67c4457), SPH_C32(0x9f9a9b0c), + SPH_C32(0xec573483), SPH_C32(0xa8686d09), SPH_C32(0x4a180000), + SPH_C32(0x4a8e0000), SPH_C32(0xf2650000), SPH_C32(0x16a528c0), + SPH_C32(0xe428127c), SPH_C32(0xf4f795a3), SPH_C32(0x21ba7308), + SPH_C32(0x7c8ba96f) }, + { SPH_C32(0xf2370000), SPH_C32(0xfba20000), SPH_C32(0xc2bd0000), + SPH_C32(0x02e178c0), SPH_C32(0x257072de), SPH_C32(0xc5d07d4f), + SPH_C32(0x0f22cc2b), SPH_C32(0x29959401), SPH_C32(0xac300000), + SPH_C32(0x06c50000), SPH_C32(0x5a300000), SPH_C32(0xc5752a20), + SPH_C32(0x3c4922c4), SPH_C32(0x6c502579), SPH_C32(0x092f75bc), + SPH_C32(0xabd1e1f8) }, + { SPH_C32(0x141f0000), SPH_C32(0xb7e90000), SPH_C32(0x6ae80000), + SPH_C32(0xd1317a20), SPH_C32(0xfd114266), SPH_C32(0x5d77cd95), + SPH_C32(0x27b7ca9f), SPH_C32(0xfecfdc96), SPH_C32(0x5cf50000), + SPH_C32(0x5fe60000), SPH_C32(0x1fb20000), SPH_C32(0x24f82ae0), + SPH_C32(0x072424f5), SPH_C32(0xaebd73e0), SPH_C32(0xc2cf8ba0), + SPH_C32(0xfd765067) }, + { SPH_C32(0xb6c30000), SPH_C32(0xd5b20000), SPH_C32(0x36620000), + SPH_C32(0x9cbc7ce0), SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), + SPH_C32(0x1694e6be), SPH_C32(0x315d5140), SPH_C32(0x59db0000), + SPH_C32(0xae6c0000), SPH_C32(0x30f40000), SPH_C32(0x48da2860), + SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), SPH_C32(0x999f2612), + SPH_C32(0x71fa0dc9) }, + { SPH_C32(0x50eb0000), SPH_C32(0x99f90000), SPH_C32(0x9e370000), + SPH_C32(0x4f6c7e00), SPH_C32(0xbede256f), SPH_C32(0x4e8c5851), + SPH_C32(0x3e01e00a), SPH_C32(0xe60719d7), SPH_C32(0xa91e0000), + SPH_C32(0xf74f0000), SPH_C32(0x75760000), SPH_C32(0xa95728a0), + SPH_C32(0xca921866), SPH_C32(0x7942a2f2), SPH_C32(0x527fd80e), + SPH_C32(0x275dbc56) }, + { SPH_C32(0x46060000), SPH_C32(0x8c910000), SPH_C32(0x73e00000), + SPH_C32(0x7d317c20), SPH_C32(0x5dd213e6), SPH_C32(0x14c6be12), + SPH_C32(0xdd7418a2), SPH_C32(0x67fae0df), SPH_C32(0x4f360000), + SPH_C32(0xbb040000), SPH_C32(0xdd230000), SPH_C32(0x7a872a40), + SPH_C32(0x12f328de), SPH_C32(0xe1e51228), SPH_C32(0x7aeadeba), + SPH_C32(0xf007f4c1) }, + { SPH_C32(0xa02e0000), SPH_C32(0xc0da0000), SPH_C32(0xdbb50000), + SPH_C32(0xaee17ec0), SPH_C32(0x85b3235e), SPH_C32(0x8c610ec8), + SPH_C32(0xf5e11e16), SPH_C32(0xb0a0a848), SPH_C32(0xbff30000), + SPH_C32(0xe2270000), SPH_C32(0x98a10000), SPH_C32(0x9b0a2a80), + SPH_C32(0x299e2eef), SPH_C32(0x230844b1), SPH_C32(0xb10a20a6), + SPH_C32(0xa6a0455e) }, + { SPH_C32(0xe1f40000), SPH_C32(0x1f400000), SPH_C32(0x002c0000), + SPH_C32(0x5c9e7860), SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), + SPH_C32(0xb7079931), SPH_C32(0x24e430a7), SPH_C32(0xedea0000), + SPH_C32(0xd95f0000), SPH_C32(0x81a90000), SPH_C32(0x370a2c80), + SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), SPH_C32(0x4bc9f29b), + SPH_C32(0x3f957917) }, + { SPH_C32(0x07dc0000), SPH_C32(0x530b0000), SPH_C32(0xa8790000), + SPH_C32(0x8f4e7a80), SPH_C32(0xe8c64e4d), SPH_C32(0x122fac5d), + SPH_C32(0x9f929f85), SPH_C32(0xf3be7830), SPH_C32(0x1d2f0000), + SPH_C32(0x807c0000), SPH_C32(0xc42b0000), SPH_C32(0xd6872c40), + SPH_C32(0xb230795e), SPH_C32(0xa85461af), SPH_C32(0x80290c87), + SPH_C32(0x6932c888) }, + { SPH_C32(0x11310000), SPH_C32(0x46630000), SPH_C32(0x45ae0000), + SPH_C32(0xbd1378a0), SPH_C32(0x0bca78c4), SPH_C32(0x48654a1e), + SPH_C32(0x7ce7672d), SPH_C32(0x72438138), SPH_C32(0xfb070000), + SPH_C32(0xcc370000), SPH_C32(0x6c7e0000), SPH_C32(0x05572ea0), + SPH_C32(0x6a5149e6), SPH_C32(0x30f3d175), SPH_C32(0xa8bc0a33), + SPH_C32(0xbe68801f) }, + { SPH_C32(0xf7190000), SPH_C32(0x0a280000), SPH_C32(0xedfb0000), + SPH_C32(0x6ec37a40), SPH_C32(0xd3ab487c), SPH_C32(0xd0c2fac4), + SPH_C32(0x54726199), SPH_C32(0xa519c9af), SPH_C32(0x0bc20000), + SPH_C32(0x95140000), SPH_C32(0x29fc0000), SPH_C32(0xe4da2e60), + SPH_C32(0x513c4fd7), SPH_C32(0xf21e87ec), SPH_C32(0x635cf42f), + SPH_C32(0xe8cf3180) }, + { SPH_C32(0x55c50000), SPH_C32(0x68730000), SPH_C32(0xb1710000), + SPH_C32(0x234e7c80), SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), + SPH_C32(0x65514db8), SPH_C32(0x6a8b4479), SPH_C32(0x0eec0000), + SPH_C32(0x649e0000), SPH_C32(0x06ba0000), SPH_C32(0x88f82ce0), + SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), SPH_C32(0x380c599d), + SPH_C32(0x64436c2e) }, + { SPH_C32(0xb3ed0000), SPH_C32(0x24380000), SPH_C32(0x19240000), + SPH_C32(0xf09e7e60), SPH_C32(0x90642f75), SPH_C32(0xc3396f00), + SPH_C32(0x4dc44b0c), SPH_C32(0xbdd10cee), SPH_C32(0xfe290000), + SPH_C32(0x3dbd0000), SPH_C32(0x43380000), SPH_C32(0x69752c20), + SPH_C32(0x9c8a7344), SPH_C32(0x25e156fe), SPH_C32(0xf3eca781), + SPH_C32(0x32e4ddb1) }, + { SPH_C32(0xa5000000), SPH_C32(0x31500000), SPH_C32(0xf4f30000), + SPH_C32(0xc2c37c40), SPH_C32(0x736819fc), SPH_C32(0x99738943), + SPH_C32(0xaeb1b3a4), SPH_C32(0x3c2cf5e6), SPH_C32(0x18010000), + SPH_C32(0x71f60000), SPH_C32(0xeb6d0000), SPH_C32(0xbaa52ec0), + SPH_C32(0x44eb43fc), SPH_C32(0xbd46e624), SPH_C32(0xdb79a135), + SPH_C32(0xe5be9526) }, + { SPH_C32(0x43280000), SPH_C32(0x7d1b0000), SPH_C32(0x5ca60000), + SPH_C32(0x11137ea0), SPH_C32(0xab092944), SPH_C32(0x01d43999), + SPH_C32(0x8624b510), SPH_C32(0xeb76bd71), SPH_C32(0xe8c40000), + SPH_C32(0x28d50000), SPH_C32(0xaeef0000), SPH_C32(0x5b282e00), + SPH_C32(0x7f8645cd), SPH_C32(0x7fabb0bd), SPH_C32(0x10995f29), + SPH_C32(0xb31924b9) }, + { SPH_C32(0xbadd0000), SPH_C32(0x13ad0000), SPH_C32(0xb7e70000), + SPH_C32(0xf7282800), SPH_C32(0xdf45144d), SPH_C32(0x361ac33a), + SPH_C32(0xea5a8d14), SPH_C32(0x2a2c18f0), SPH_C32(0xb82f0000), + SPH_C32(0xb12c0000), SPH_C32(0x30d80000), SPH_C32(0x14445000), + SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), SPH_C32(0x2e98bf23), + SPH_C32(0x551e3d6e) }, + { SPH_C32(0x5cf50000), SPH_C32(0x5fe60000), SPH_C32(0x1fb20000), + SPH_C32(0x24f82ae0), SPH_C32(0x072424f5), SPH_C32(0xaebd73e0), + SPH_C32(0xc2cf8ba0), SPH_C32(0xfd765067), SPH_C32(0x48ea0000), + SPH_C32(0xe80f0000), SPH_C32(0x755a0000), SPH_C32(0xf5c950c0), + SPH_C32(0xfa356693), SPH_C32(0xf3cabe75), SPH_C32(0xe578413f), + SPH_C32(0x03b98cf1) }, + { SPH_C32(0x4a180000), SPH_C32(0x4a8e0000), SPH_C32(0xf2650000), + SPH_C32(0x16a528c0), SPH_C32(0xe428127c), SPH_C32(0xf4f795a3), + SPH_C32(0x21ba7308), SPH_C32(0x7c8ba96f), SPH_C32(0xaec20000), + SPH_C32(0xa4440000), SPH_C32(0xdd0f0000), SPH_C32(0x26195220), + SPH_C32(0x2254562b), SPH_C32(0x6b6d0eaf), SPH_C32(0xcded478b), + SPH_C32(0xd4e3c466) }, + { SPH_C32(0xac300000), SPH_C32(0x06c50000), SPH_C32(0x5a300000), + SPH_C32(0xc5752a20), SPH_C32(0x3c4922c4), SPH_C32(0x6c502579), + SPH_C32(0x092f75bc), SPH_C32(0xabd1e1f8), SPH_C32(0x5e070000), + SPH_C32(0xfd670000), SPH_C32(0x988d0000), SPH_C32(0xc79452e0), + SPH_C32(0x1939501a), SPH_C32(0xa9805836), SPH_C32(0x060db997), + SPH_C32(0x824475f9) }, + { SPH_C32(0x0eec0000), SPH_C32(0x649e0000), SPH_C32(0x06ba0000), + SPH_C32(0x88f82ce0), SPH_C32(0xa7e77575), SPH_C32(0xe70c0067), + SPH_C32(0x380c599d), SPH_C32(0x64436c2e), SPH_C32(0x5b290000), + SPH_C32(0x0ced0000), SPH_C32(0xb7cb0000), SPH_C32(0xabb65060), + SPH_C32(0xefe26ab8), SPH_C32(0xbc92dfbd), SPH_C32(0x5d5d1425), + SPH_C32(0x0ec82857) }, + { SPH_C32(0xe8c40000), SPH_C32(0x28d50000), SPH_C32(0xaeef0000), + SPH_C32(0x5b282e00), SPH_C32(0x7f8645cd), SPH_C32(0x7fabb0bd), + SPH_C32(0x10995f29), SPH_C32(0xb31924b9), SPH_C32(0xabec0000), + SPH_C32(0x55ce0000), SPH_C32(0xf2490000), SPH_C32(0x4a3b50a0), + SPH_C32(0xd48f6c89), SPH_C32(0x7e7f8924), SPH_C32(0x96bdea39), + SPH_C32(0x586f99c8) }, + { SPH_C32(0xfe290000), SPH_C32(0x3dbd0000), SPH_C32(0x43380000), + SPH_C32(0x69752c20), SPH_C32(0x9c8a7344), SPH_C32(0x25e156fe), + SPH_C32(0xf3eca781), SPH_C32(0x32e4ddb1), SPH_C32(0x4dc40000), + SPH_C32(0x19850000), SPH_C32(0x5a1c0000), SPH_C32(0x99eb5240), + SPH_C32(0x0cee5c31), SPH_C32(0xe6d839fe), SPH_C32(0xbe28ec8d), + SPH_C32(0x8f35d15f) }, + { SPH_C32(0x18010000), SPH_C32(0x71f60000), SPH_C32(0xeb6d0000), + SPH_C32(0xbaa52ec0), SPH_C32(0x44eb43fc), SPH_C32(0xbd46e624), + SPH_C32(0xdb79a135), SPH_C32(0xe5be9526), SPH_C32(0xbd010000), + SPH_C32(0x40a60000), SPH_C32(0x1f9e0000), SPH_C32(0x78665280), + SPH_C32(0x37835a00), SPH_C32(0x24356f67), SPH_C32(0x75c81291), + SPH_C32(0xd99260c0) }, + { SPH_C32(0x59db0000), SPH_C32(0xae6c0000), SPH_C32(0x30f40000), + SPH_C32(0x48da2860), SPH_C32(0xf1ff1e57), SPH_C32(0xbbaff46b), + SPH_C32(0x999f2612), SPH_C32(0x71fa0dc9), SPH_C32(0xef180000), + SPH_C32(0x7bde0000), SPH_C32(0x06960000), SPH_C32(0xd4665480), + SPH_C32(0x97400b80), SPH_C32(0x6d841ce0), SPH_C32(0x8f0bc0ac), + SPH_C32(0x40a75c89) }, + { SPH_C32(0xbff30000), SPH_C32(0xe2270000), SPH_C32(0x98a10000), + SPH_C32(0x9b0a2a80), SPH_C32(0x299e2eef), SPH_C32(0x230844b1), + SPH_C32(0xb10a20a6), SPH_C32(0xa6a0455e), SPH_C32(0x1fdd0000), + SPH_C32(0x22fd0000), SPH_C32(0x43140000), SPH_C32(0x35eb5440), + SPH_C32(0xac2d0db1), SPH_C32(0xaf694a79), SPH_C32(0x44eb3eb0), + SPH_C32(0x1600ed16) }, + { SPH_C32(0xa91e0000), SPH_C32(0xf74f0000), SPH_C32(0x75760000), + SPH_C32(0xa95728a0), SPH_C32(0xca921866), SPH_C32(0x7942a2f2), + SPH_C32(0x527fd80e), SPH_C32(0x275dbc56), SPH_C32(0xf9f50000), + SPH_C32(0x6eb60000), SPH_C32(0xeb410000), SPH_C32(0xe63b56a0), + SPH_C32(0x744c3d09), SPH_C32(0x37cefaa3), SPH_C32(0x6c7e3804), + SPH_C32(0xc15aa581) }, + { SPH_C32(0x4f360000), SPH_C32(0xbb040000), SPH_C32(0xdd230000), + SPH_C32(0x7a872a40), SPH_C32(0x12f328de), SPH_C32(0xe1e51228), + SPH_C32(0x7aeadeba), SPH_C32(0xf007f4c1), SPH_C32(0x09300000), + SPH_C32(0x37950000), SPH_C32(0xaec30000), SPH_C32(0x07b65660), + SPH_C32(0x4f213b38), SPH_C32(0xf523ac3a), SPH_C32(0xa79ec618), + SPH_C32(0x97fd141e) }, + { SPH_C32(0xedea0000), SPH_C32(0xd95f0000), SPH_C32(0x81a90000), + SPH_C32(0x370a2c80), SPH_C32(0x895d7f6f), SPH_C32(0x6ab93736), + SPH_C32(0x4bc9f29b), SPH_C32(0x3f957917), SPH_C32(0x0c1e0000), + SPH_C32(0xc61f0000), SPH_C32(0x81850000), SPH_C32(0x6b9454e0), + SPH_C32(0xb9fa019a), SPH_C32(0xe0312bb1), SPH_C32(0xfcce6baa), + SPH_C32(0x1b7149b0) }, + { SPH_C32(0x0bc20000), SPH_C32(0x95140000), SPH_C32(0x29fc0000), + SPH_C32(0xe4da2e60), SPH_C32(0x513c4fd7), SPH_C32(0xf21e87ec), + SPH_C32(0x635cf42f), SPH_C32(0xe8cf3180), SPH_C32(0xfcdb0000), + SPH_C32(0x9f3c0000), SPH_C32(0xc4070000), SPH_C32(0x8a195420), + SPH_C32(0x829707ab), SPH_C32(0x22dc7d28), SPH_C32(0x372e95b6), + SPH_C32(0x4dd6f82f) }, + { SPH_C32(0x1d2f0000), SPH_C32(0x807c0000), SPH_C32(0xc42b0000), + SPH_C32(0xd6872c40), SPH_C32(0xb230795e), SPH_C32(0xa85461af), + SPH_C32(0x80290c87), SPH_C32(0x6932c888), SPH_C32(0x1af30000), + SPH_C32(0xd3770000), SPH_C32(0x6c520000), SPH_C32(0x59c956c0), + SPH_C32(0x5af63713), SPH_C32(0xba7bcdf2), SPH_C32(0x1fbb9302), + SPH_C32(0x9a8cb0b8) }, + { SPH_C32(0xfb070000), SPH_C32(0xcc370000), SPH_C32(0x6c7e0000), + SPH_C32(0x05572ea0), SPH_C32(0x6a5149e6), SPH_C32(0x30f3d175), + SPH_C32(0xa8bc0a33), SPH_C32(0xbe68801f), SPH_C32(0xea360000), + SPH_C32(0x8a540000), SPH_C32(0x29d00000), SPH_C32(0xb8445600), + SPH_C32(0x619b3122), SPH_C32(0x78969b6b), SPH_C32(0xd45b6d1e), + SPH_C32(0xcc2b0127) }, + { SPH_C32(0xb82f0000), SPH_C32(0xb12c0000), SPH_C32(0x30d80000), + SPH_C32(0x14445000), SPH_C32(0xc15860a2), SPH_C32(0x3127e8ec), + SPH_C32(0x2e98bf23), SPH_C32(0x551e3d6e), SPH_C32(0x02f20000), + SPH_C32(0xa2810000), SPH_C32(0x873f0000), SPH_C32(0xe36c7800), + SPH_C32(0x1e1d74ef), SPH_C32(0x073d2bd6), SPH_C32(0xc4c23237), + SPH_C32(0x7f32259e) }, + { SPH_C32(0x5e070000), SPH_C32(0xfd670000), SPH_C32(0x988d0000), + SPH_C32(0xc79452e0), SPH_C32(0x1939501a), SPH_C32(0xa9805836), + SPH_C32(0x060db997), SPH_C32(0x824475f9), SPH_C32(0xf2370000), + SPH_C32(0xfba20000), SPH_C32(0xc2bd0000), SPH_C32(0x02e178c0), + SPH_C32(0x257072de), SPH_C32(0xc5d07d4f), SPH_C32(0x0f22cc2b), + SPH_C32(0x29959401) }, + { SPH_C32(0x48ea0000), SPH_C32(0xe80f0000), SPH_C32(0x755a0000), + SPH_C32(0xf5c950c0), SPH_C32(0xfa356693), SPH_C32(0xf3cabe75), + SPH_C32(0xe578413f), SPH_C32(0x03b98cf1), SPH_C32(0x141f0000), + SPH_C32(0xb7e90000), SPH_C32(0x6ae80000), SPH_C32(0xd1317a20), + SPH_C32(0xfd114266), SPH_C32(0x5d77cd95), SPH_C32(0x27b7ca9f), + SPH_C32(0xfecfdc96) }, + { SPH_C32(0xaec20000), SPH_C32(0xa4440000), SPH_C32(0xdd0f0000), + SPH_C32(0x26195220), SPH_C32(0x2254562b), SPH_C32(0x6b6d0eaf), + SPH_C32(0xcded478b), SPH_C32(0xd4e3c466), SPH_C32(0xe4da0000), + SPH_C32(0xeeca0000), SPH_C32(0x2f6a0000), SPH_C32(0x30bc7ae0), + SPH_C32(0xc67c4457), SPH_C32(0x9f9a9b0c), SPH_C32(0xec573483), + SPH_C32(0xa8686d09) }, + { SPH_C32(0x0c1e0000), SPH_C32(0xc61f0000), SPH_C32(0x81850000), + SPH_C32(0x6b9454e0), SPH_C32(0xb9fa019a), SPH_C32(0xe0312bb1), + SPH_C32(0xfcce6baa), SPH_C32(0x1b7149b0), SPH_C32(0xe1f40000), + SPH_C32(0x1f400000), SPH_C32(0x002c0000), SPH_C32(0x5c9e7860), + SPH_C32(0x30a77ef5), SPH_C32(0x8a881c87), SPH_C32(0xb7079931), + SPH_C32(0x24e430a7) }, + { SPH_C32(0xea360000), SPH_C32(0x8a540000), SPH_C32(0x29d00000), + SPH_C32(0xb8445600), SPH_C32(0x619b3122), SPH_C32(0x78969b6b), + SPH_C32(0xd45b6d1e), SPH_C32(0xcc2b0127), SPH_C32(0x11310000), + SPH_C32(0x46630000), SPH_C32(0x45ae0000), SPH_C32(0xbd1378a0), + SPH_C32(0x0bca78c4), SPH_C32(0x48654a1e), SPH_C32(0x7ce7672d), + SPH_C32(0x72438138) }, + { SPH_C32(0xfcdb0000), SPH_C32(0x9f3c0000), SPH_C32(0xc4070000), + SPH_C32(0x8a195420), SPH_C32(0x829707ab), SPH_C32(0x22dc7d28), + SPH_C32(0x372e95b6), SPH_C32(0x4dd6f82f), SPH_C32(0xf7190000), + SPH_C32(0x0a280000), SPH_C32(0xedfb0000), SPH_C32(0x6ec37a40), + SPH_C32(0xd3ab487c), SPH_C32(0xd0c2fac4), SPH_C32(0x54726199), + SPH_C32(0xa519c9af) }, + { SPH_C32(0x1af30000), SPH_C32(0xd3770000), SPH_C32(0x6c520000), + SPH_C32(0x59c956c0), SPH_C32(0x5af63713), SPH_C32(0xba7bcdf2), + SPH_C32(0x1fbb9302), SPH_C32(0x9a8cb0b8), SPH_C32(0x07dc0000), + SPH_C32(0x530b0000), SPH_C32(0xa8790000), SPH_C32(0x8f4e7a80), + SPH_C32(0xe8c64e4d), SPH_C32(0x122fac5d), SPH_C32(0x9f929f85), + SPH_C32(0xf3be7830) }, + { SPH_C32(0x5b290000), SPH_C32(0x0ced0000), SPH_C32(0xb7cb0000), + SPH_C32(0xabb65060), SPH_C32(0xefe26ab8), SPH_C32(0xbc92dfbd), + SPH_C32(0x5d5d1425), SPH_C32(0x0ec82857), SPH_C32(0x55c50000), + SPH_C32(0x68730000), SPH_C32(0xb1710000), SPH_C32(0x234e7c80), + SPH_C32(0x48051fcd), SPH_C32(0x5b9edfda), SPH_C32(0x65514db8), + SPH_C32(0x6a8b4479) }, + { SPH_C32(0xbd010000), SPH_C32(0x40a60000), SPH_C32(0x1f9e0000), + SPH_C32(0x78665280), SPH_C32(0x37835a00), SPH_C32(0x24356f67), + SPH_C32(0x75c81291), SPH_C32(0xd99260c0), SPH_C32(0xa5000000), + SPH_C32(0x31500000), SPH_C32(0xf4f30000), SPH_C32(0xc2c37c40), + SPH_C32(0x736819fc), SPH_C32(0x99738943), SPH_C32(0xaeb1b3a4), + SPH_C32(0x3c2cf5e6) }, + { SPH_C32(0xabec0000), SPH_C32(0x55ce0000), SPH_C32(0xf2490000), + SPH_C32(0x4a3b50a0), SPH_C32(0xd48f6c89), SPH_C32(0x7e7f8924), + SPH_C32(0x96bdea39), SPH_C32(0x586f99c8), SPH_C32(0x43280000), + SPH_C32(0x7d1b0000), SPH_C32(0x5ca60000), SPH_C32(0x11137ea0), + SPH_C32(0xab092944), SPH_C32(0x01d43999), SPH_C32(0x8624b510), + SPH_C32(0xeb76bd71) }, + { SPH_C32(0x4dc40000), SPH_C32(0x19850000), SPH_C32(0x5a1c0000), + SPH_C32(0x99eb5240), SPH_C32(0x0cee5c31), SPH_C32(0xe6d839fe), + SPH_C32(0xbe28ec8d), SPH_C32(0x8f35d15f), SPH_C32(0xb3ed0000), + SPH_C32(0x24380000), SPH_C32(0x19240000), SPH_C32(0xf09e7e60), + SPH_C32(0x90642f75), SPH_C32(0xc3396f00), SPH_C32(0x4dc44b0c), + SPH_C32(0xbdd10cee) }, + { SPH_C32(0xef180000), SPH_C32(0x7bde0000), SPH_C32(0x06960000), + SPH_C32(0xd4665480), SPH_C32(0x97400b80), SPH_C32(0x6d841ce0), + SPH_C32(0x8f0bc0ac), SPH_C32(0x40a75c89), SPH_C32(0xb6c30000), + SPH_C32(0xd5b20000), SPH_C32(0x36620000), SPH_C32(0x9cbc7ce0), + SPH_C32(0x66bf15d7), SPH_C32(0xd62be88b), SPH_C32(0x1694e6be), + SPH_C32(0x315d5140) }, + { SPH_C32(0x09300000), SPH_C32(0x37950000), SPH_C32(0xaec30000), + SPH_C32(0x07b65660), SPH_C32(0x4f213b38), SPH_C32(0xf523ac3a), + SPH_C32(0xa79ec618), SPH_C32(0x97fd141e), SPH_C32(0x46060000), + SPH_C32(0x8c910000), SPH_C32(0x73e00000), SPH_C32(0x7d317c20), + SPH_C32(0x5dd213e6), SPH_C32(0x14c6be12), SPH_C32(0xdd7418a2), + SPH_C32(0x67fae0df) }, + { SPH_C32(0x1fdd0000), SPH_C32(0x22fd0000), SPH_C32(0x43140000), + SPH_C32(0x35eb5440), SPH_C32(0xac2d0db1), SPH_C32(0xaf694a79), + SPH_C32(0x44eb3eb0), SPH_C32(0x1600ed16), SPH_C32(0xa02e0000), + SPH_C32(0xc0da0000), SPH_C32(0xdbb50000), SPH_C32(0xaee17ec0), + SPH_C32(0x85b3235e), SPH_C32(0x8c610ec8), SPH_C32(0xf5e11e16), + SPH_C32(0xb0a0a848) }, + { SPH_C32(0xf9f50000), SPH_C32(0x6eb60000), SPH_C32(0xeb410000), + SPH_C32(0xe63b56a0), SPH_C32(0x744c3d09), SPH_C32(0x37cefaa3), + SPH_C32(0x6c7e3804), SPH_C32(0xc15aa581), SPH_C32(0x50eb0000), + SPH_C32(0x99f90000), SPH_C32(0x9e370000), SPH_C32(0x4f6c7e00), + SPH_C32(0xbede256f), SPH_C32(0x4e8c5851), SPH_C32(0x3e01e00a), + SPH_C32(0xe60719d7) }, + { SPH_C32(0x1e6c0000), SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), + SPH_C32(0xbcb6b800), SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), + SPH_C32(0x6a0c1bc8), SPH_C32(0xb99dc2eb), SPH_C32(0x92560000), + SPH_C32(0x1eda0000), SPH_C32(0xea510000), SPH_C32(0xe8b13000), + SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), SPH_C32(0xb15c2254), + SPH_C32(0x33c5244f) }, + { SPH_C32(0xf8440000), SPH_C32(0x88090000), SPH_C32(0x227b0000), + SPH_C32(0x6f66bae0), SPH_C32(0xf425230e), SPH_C32(0x135a6300), + SPH_C32(0x42991d7c), SPH_C32(0x6ec78a7c), SPH_C32(0x62930000), + SPH_C32(0x47f90000), SPH_C32(0xafd30000), SPH_C32(0x093c30c0), + SPH_C32(0x92585094), SPH_C32(0x29163700), SPH_C32(0x7abcdc48), + SPH_C32(0x656295d0) }, + { SPH_C32(0xeea90000), SPH_C32(0x9d610000), SPH_C32(0xcfac0000), + SPH_C32(0x5d3bb8c0), SPH_C32(0x17291587), SPH_C32(0x49108543), + SPH_C32(0xa1ece5d4), SPH_C32(0xef3a7374), SPH_C32(0x84bb0000), + SPH_C32(0x0bb20000), SPH_C32(0x07860000), SPH_C32(0xdaec3220), + SPH_C32(0x4a39602c), SPH_C32(0xb1b187da), SPH_C32(0x5229dafc), + SPH_C32(0xb238dd47) }, + { SPH_C32(0x08810000), SPH_C32(0xd12a0000), SPH_C32(0x67f90000), + SPH_C32(0x8eebba20), SPH_C32(0xcf48253f), SPH_C32(0xd1b73599), + SPH_C32(0x8979e360), SPH_C32(0x38603be3), SPH_C32(0x747e0000), + SPH_C32(0x52910000), SPH_C32(0x42040000), SPH_C32(0x3b6132e0), + SPH_C32(0x7154661d), SPH_C32(0x735cd143), SPH_C32(0x99c924e0), + SPH_C32(0xe49f6cd8) }, + { SPH_C32(0xaa5d0000), SPH_C32(0xb3710000), SPH_C32(0x3b730000), + SPH_C32(0xc366bce0), SPH_C32(0x54e6728e), SPH_C32(0x5aeb1087), + SPH_C32(0xb85acf41), SPH_C32(0xf7f2b635), SPH_C32(0x71500000), + SPH_C32(0xa31b0000), SPH_C32(0x6d420000), SPH_C32(0x57433060), + SPH_C32(0x878f5cbf), SPH_C32(0x664e56c8), SPH_C32(0xc2998952), + SPH_C32(0x68133176) }, + { SPH_C32(0x4c750000), SPH_C32(0xff3a0000), SPH_C32(0x93260000), + SPH_C32(0x10b6be00), SPH_C32(0x8c874236), SPH_C32(0xc24ca05d), + SPH_C32(0x90cfc9f5), SPH_C32(0x20a8fea2), SPH_C32(0x81950000), + SPH_C32(0xfa380000), SPH_C32(0x28c00000), SPH_C32(0xb6ce30a0), + SPH_C32(0xbce25a8e), SPH_C32(0xa4a30051), SPH_C32(0x0979774e), + SPH_C32(0x3eb480e9) }, + { SPH_C32(0x5a980000), SPH_C32(0xea520000), SPH_C32(0x7ef10000), + SPH_C32(0x22ebbc20), SPH_C32(0x6f8b74bf), SPH_C32(0x9806461e), + SPH_C32(0x73ba315d), SPH_C32(0xa15507aa), SPH_C32(0x67bd0000), + SPH_C32(0xb6730000), SPH_C32(0x80950000), SPH_C32(0x651e3240), + SPH_C32(0x64836a36), SPH_C32(0x3c04b08b), SPH_C32(0x21ec71fa), + SPH_C32(0xe9eec87e) }, + { SPH_C32(0xbcb00000), SPH_C32(0xa6190000), SPH_C32(0xd6a40000), + SPH_C32(0xf13bbec0), SPH_C32(0xb7ea4407), SPH_C32(0x00a1f6c4), + SPH_C32(0x5b2f37e9), SPH_C32(0x760f4f3d), SPH_C32(0x97780000), + SPH_C32(0xef500000), SPH_C32(0xc5170000), SPH_C32(0x84933280), + SPH_C32(0x5fee6c07), SPH_C32(0xfee9e612), SPH_C32(0xea0c8fe6), + SPH_C32(0xbf4979e1) }, + { SPH_C32(0xfd6a0000), SPH_C32(0x79830000), SPH_C32(0x0d3d0000), + SPH_C32(0x0344b860), SPH_C32(0x02fe19ac), SPH_C32(0x0648e48b), + SPH_C32(0x19c9b0ce), SPH_C32(0xe24bd7d2), SPH_C32(0xc5610000), + SPH_C32(0xd4280000), SPH_C32(0xdc1f0000), SPH_C32(0x28933480), + SPH_C32(0xff2d3d87), SPH_C32(0xb7589595), SPH_C32(0x10cf5ddb), + SPH_C32(0x267c45a8) }, + { SPH_C32(0x1b420000), SPH_C32(0x35c80000), SPH_C32(0xa5680000), + SPH_C32(0xd094ba80), SPH_C32(0xda9f2914), SPH_C32(0x9eef5451), + SPH_C32(0x315cb67a), SPH_C32(0x35119f45), SPH_C32(0x35a40000), + SPH_C32(0x8d0b0000), SPH_C32(0x999d0000), SPH_C32(0xc91e3440), + SPH_C32(0xc4403bb6), SPH_C32(0x75b5c30c), SPH_C32(0xdb2fa3c7), + SPH_C32(0x70dbf437) }, + { SPH_C32(0x0daf0000), SPH_C32(0x20a00000), SPH_C32(0x48bf0000), + SPH_C32(0xe2c9b8a0), SPH_C32(0x39931f9d), SPH_C32(0xc4a5b212), + SPH_C32(0xd2294ed2), SPH_C32(0xb4ec664d), SPH_C32(0xd38c0000), + SPH_C32(0xc1400000), SPH_C32(0x31c80000), SPH_C32(0x1ace36a0), + SPH_C32(0x1c210b0e), SPH_C32(0xed1273d6), SPH_C32(0xf3baa573), + SPH_C32(0xa781bca0) }, + { SPH_C32(0xeb870000), SPH_C32(0x6ceb0000), SPH_C32(0xe0ea0000), + SPH_C32(0x3119ba40), SPH_C32(0xe1f22f25), SPH_C32(0x5c0202c8), + SPH_C32(0xfabc4866), SPH_C32(0x63b62eda), SPH_C32(0x23490000), + SPH_C32(0x98630000), SPH_C32(0x744a0000), SPH_C32(0xfb433660), + SPH_C32(0x274c0d3f), SPH_C32(0x2fff254f), SPH_C32(0x385a5b6f), + SPH_C32(0xf1260d3f) }, + { SPH_C32(0x495b0000), SPH_C32(0x0eb00000), SPH_C32(0xbc600000), + SPH_C32(0x7c94bc80), SPH_C32(0x7a5c7894), SPH_C32(0xd75e27d6), + SPH_C32(0xcb9f6447), SPH_C32(0xac24a30c), SPH_C32(0x26670000), + SPH_C32(0x69e90000), SPH_C32(0x5b0c0000), SPH_C32(0x976134e0), + SPH_C32(0xd197379d), SPH_C32(0x3aeda2c4), SPH_C32(0x630af6dd), + SPH_C32(0x7daa5091) }, + { SPH_C32(0xaf730000), SPH_C32(0x42fb0000), SPH_C32(0x14350000), + SPH_C32(0xaf44be60), SPH_C32(0xa23d482c), SPH_C32(0x4ff9970c), + SPH_C32(0xe30a62f3), SPH_C32(0x7b7eeb9b), SPH_C32(0xd6a20000), + SPH_C32(0x30ca0000), SPH_C32(0x1e8e0000), SPH_C32(0x76ec3420), + SPH_C32(0xeafa31ac), SPH_C32(0xf800f45d), SPH_C32(0xa8ea08c1), + SPH_C32(0x2b0de10e) }, + { SPH_C32(0xb99e0000), SPH_C32(0x57930000), SPH_C32(0xf9e20000), + SPH_C32(0x9d19bc40), SPH_C32(0x41317ea5), SPH_C32(0x15b3714f), + SPH_C32(0x007f9a5b), SPH_C32(0xfa831293), SPH_C32(0x308a0000), + SPH_C32(0x7c810000), SPH_C32(0xb6db0000), SPH_C32(0xa53c36c0), + SPH_C32(0x329b0114), SPH_C32(0x60a74487), SPH_C32(0x807f0e75), + SPH_C32(0xfc57a999) }, + { SPH_C32(0x5fb60000), SPH_C32(0x1bd80000), SPH_C32(0x51b70000), + SPH_C32(0x4ec9bea0), SPH_C32(0x99504e1d), SPH_C32(0x8d14c195), + SPH_C32(0x28ea9cef), SPH_C32(0x2dd95a04), SPH_C32(0xc04f0000), + SPH_C32(0x25a20000), SPH_C32(0xf3590000), SPH_C32(0x44b13600), + SPH_C32(0x09f60725), SPH_C32(0xa24a121e), SPH_C32(0x4b9ff069), + SPH_C32(0xaaf01806) }, + { SPH_C32(0x1c9e0000), SPH_C32(0x66c30000), SPH_C32(0x0d110000), + SPH_C32(0x5fdac000), SPH_C32(0x32596759), SPH_C32(0x8cc0f80c), + SPH_C32(0xaece29ff), SPH_C32(0xc6afe775), SPH_C32(0x288b0000), + SPH_C32(0x0d770000), SPH_C32(0x5db60000), SPH_C32(0x1f991800), + SPH_C32(0x767042e8), SPH_C32(0xdde1a2a3), SPH_C32(0x5b06af40), + SPH_C32(0x19e93cbf) }, + { SPH_C32(0xfab60000), SPH_C32(0x2a880000), SPH_C32(0xa5440000), + SPH_C32(0x8c0ac2e0), SPH_C32(0xea3857e1), SPH_C32(0x146748d6), + SPH_C32(0x865b2f4b), SPH_C32(0x11f5afe2), SPH_C32(0xd84e0000), + SPH_C32(0x54540000), SPH_C32(0x18340000), SPH_C32(0xfe1418c0), + SPH_C32(0x4d1d44d9), SPH_C32(0x1f0cf43a), SPH_C32(0x90e6515c), + SPH_C32(0x4f4e8d20) }, + { SPH_C32(0xec5b0000), SPH_C32(0x3fe00000), SPH_C32(0x48930000), + SPH_C32(0xbe57c0c0), SPH_C32(0x09346168), SPH_C32(0x4e2dae95), + SPH_C32(0x652ed7e3), SPH_C32(0x900856ea), SPH_C32(0x3e660000), + SPH_C32(0x181f0000), SPH_C32(0xb0610000), SPH_C32(0x2dc41a20), + SPH_C32(0x957c7461), SPH_C32(0x87ab44e0), SPH_C32(0xb87357e8), + SPH_C32(0x9814c5b7) }, + { SPH_C32(0x0a730000), SPH_C32(0x73ab0000), SPH_C32(0xe0c60000), + SPH_C32(0x6d87c220), SPH_C32(0xd15551d0), SPH_C32(0xd68a1e4f), + SPH_C32(0x4dbbd157), SPH_C32(0x47521e7d), SPH_C32(0xcea30000), + SPH_C32(0x413c0000), SPH_C32(0xf5e30000), SPH_C32(0xcc491ae0), + SPH_C32(0xae117250), SPH_C32(0x45461279), SPH_C32(0x7393a9f4), + SPH_C32(0xceb37428) }, + { SPH_C32(0xa8af0000), SPH_C32(0x11f00000), SPH_C32(0xbc4c0000), + SPH_C32(0x200ac4e0), SPH_C32(0x4afb0661), SPH_C32(0x5dd63b51), + SPH_C32(0x7c98fd76), SPH_C32(0x88c093ab), SPH_C32(0xcb8d0000), + SPH_C32(0xb0b60000), SPH_C32(0xdaa50000), SPH_C32(0xa06b1860), + SPH_C32(0x58ca48f2), SPH_C32(0x505495f2), SPH_C32(0x28c30446), + SPH_C32(0x423f2986) }, + { SPH_C32(0x4e870000), SPH_C32(0x5dbb0000), SPH_C32(0x14190000), + SPH_C32(0xf3dac600), SPH_C32(0x929a36d9), SPH_C32(0xc5718b8b), + SPH_C32(0x540dfbc2), SPH_C32(0x5f9adb3c), SPH_C32(0x3b480000), + SPH_C32(0xe9950000), SPH_C32(0x9f270000), SPH_C32(0x41e618a0), + SPH_C32(0x63a74ec3), SPH_C32(0x92b9c36b), SPH_C32(0xe323fa5a), + SPH_C32(0x14989819) }, + { SPH_C32(0x586a0000), SPH_C32(0x48d30000), SPH_C32(0xf9ce0000), + SPH_C32(0xc187c420), SPH_C32(0x71960050), SPH_C32(0x9f3b6dc8), + SPH_C32(0xb778036a), SPH_C32(0xde672234), SPH_C32(0xdd600000), + SPH_C32(0xa5de0000), SPH_C32(0x37720000), SPH_C32(0x92361a40), + SPH_C32(0xbbc67e7b), SPH_C32(0x0a1e73b1), SPH_C32(0xcbb6fcee), + SPH_C32(0xc3c2d08e) }, + { SPH_C32(0xbe420000), SPH_C32(0x04980000), SPH_C32(0x519b0000), + SPH_C32(0x1257c6c0), SPH_C32(0xa9f730e8), SPH_C32(0x079cdd12), + SPH_C32(0x9fed05de), SPH_C32(0x093d6aa3), SPH_C32(0x2da50000), + SPH_C32(0xfcfd0000), SPH_C32(0x72f00000), SPH_C32(0x73bb1a80), + SPH_C32(0x80ab784a), SPH_C32(0xc8f32528), SPH_C32(0x005602f2), + SPH_C32(0x95656111) }, + { SPH_C32(0xff980000), SPH_C32(0xdb020000), SPH_C32(0x8a020000), + SPH_C32(0xe028c060), SPH_C32(0x1ce36d43), SPH_C32(0x0175cf5d), + SPH_C32(0xdd0b82f9), SPH_C32(0x9d79f24c), SPH_C32(0x7fbc0000), + SPH_C32(0xc7850000), SPH_C32(0x6bf80000), SPH_C32(0xdfbb1c80), + SPH_C32(0x206829ca), SPH_C32(0x814256af), SPH_C32(0xfa95d0cf), + SPH_C32(0x0c505d58) }, + { SPH_C32(0x19b00000), SPH_C32(0x97490000), SPH_C32(0x22570000), + SPH_C32(0x33f8c280), SPH_C32(0xc4825dfb), SPH_C32(0x99d27f87), + SPH_C32(0xf59e844d), SPH_C32(0x4a23badb), SPH_C32(0x8f790000), + SPH_C32(0x9ea60000), SPH_C32(0x2e7a0000), SPH_C32(0x3e361c40), + SPH_C32(0x1b052ffb), SPH_C32(0x43af0036), SPH_C32(0x31752ed3), + SPH_C32(0x5af7ecc7) }, + { SPH_C32(0x0f5d0000), SPH_C32(0x82210000), SPH_C32(0xcf800000), + SPH_C32(0x01a5c0a0), SPH_C32(0x278e6b72), SPH_C32(0xc39899c4), + SPH_C32(0x16eb7ce5), SPH_C32(0xcbde43d3), SPH_C32(0x69510000), + SPH_C32(0xd2ed0000), SPH_C32(0x862f0000), SPH_C32(0xede61ea0), + SPH_C32(0xc3641f43), SPH_C32(0xdb08b0ec), SPH_C32(0x19e02867), + SPH_C32(0x8dada450) }, + { SPH_C32(0xe9750000), SPH_C32(0xce6a0000), SPH_C32(0x67d50000), + SPH_C32(0xd275c240), SPH_C32(0xffef5bca), SPH_C32(0x5b3f291e), + SPH_C32(0x3e7e7a51), SPH_C32(0x1c840b44), SPH_C32(0x99940000), + SPH_C32(0x8bce0000), SPH_C32(0xc3ad0000), SPH_C32(0x0c6b1e60), + SPH_C32(0xf8091972), SPH_C32(0x19e5e675), SPH_C32(0xd200d67b), + SPH_C32(0xdb0a15cf) }, + { SPH_C32(0x4ba90000), SPH_C32(0xac310000), SPH_C32(0x3b5f0000), + SPH_C32(0x9ff8c480), SPH_C32(0x64410c7b), SPH_C32(0xd0630c00), + SPH_C32(0x0f5d5670), SPH_C32(0xd3168692), SPH_C32(0x9cba0000), + SPH_C32(0x7a440000), SPH_C32(0xeceb0000), SPH_C32(0x60491ce0), + SPH_C32(0x0ed223d0), SPH_C32(0x0cf761fe), SPH_C32(0x89507bc9), + SPH_C32(0x57864861) }, + { SPH_C32(0xad810000), SPH_C32(0xe07a0000), SPH_C32(0x930a0000), + SPH_C32(0x4c28c660), SPH_C32(0xbc203cc3), SPH_C32(0x48c4bcda), + SPH_C32(0x27c850c4), SPH_C32(0x044cce05), SPH_C32(0x6c7f0000), + SPH_C32(0x23670000), SPH_C32(0xa9690000), SPH_C32(0x81c41c20), + SPH_C32(0x35bf25e1), SPH_C32(0xce1a3767), SPH_C32(0x42b085d5), + SPH_C32(0x0121f9fe) }, + { SPH_C32(0xbb6c0000), SPH_C32(0xf5120000), SPH_C32(0x7edd0000), + SPH_C32(0x7e75c440), SPH_C32(0x5f2c0a4a), SPH_C32(0x128e5a99), + SPH_C32(0xc4bda86c), SPH_C32(0x85b1370d), SPH_C32(0x8a570000), + SPH_C32(0x6f2c0000), SPH_C32(0x013c0000), SPH_C32(0x52141ec0), + SPH_C32(0xedde1559), SPH_C32(0x56bd87bd), SPH_C32(0x6a258361), + SPH_C32(0xd67bb169) }, + { SPH_C32(0x5d440000), SPH_C32(0xb9590000), SPH_C32(0xd6880000), + SPH_C32(0xada5c6a0), SPH_C32(0x874d3af2), SPH_C32(0x8a29ea43), + SPH_C32(0xec28aed8), SPH_C32(0x52eb7f9a), SPH_C32(0x7a920000), + SPH_C32(0x360f0000), SPH_C32(0x44be0000), SPH_C32(0xb3991e00), + SPH_C32(0xd6b31368), SPH_C32(0x9450d124), SPH_C32(0xa1c57d7d), + SPH_C32(0x80dc00f6) }, + { SPH_C32(0xa4b10000), SPH_C32(0xd7ef0000), SPH_C32(0x3dc90000), + SPH_C32(0x4b9e9000), SPH_C32(0xf30107fb), SPH_C32(0xbde710e0), + SPH_C32(0x805696dc), SPH_C32(0x93b1da1b), SPH_C32(0x2a790000), + SPH_C32(0xaff60000), SPH_C32(0xda890000), SPH_C32(0xfcf56000), + SPH_C32(0x686d3607), SPH_C32(0xdadc8975), SPH_C32(0x9fc49d77), + SPH_C32(0x66db1921) }, + { SPH_C32(0x42990000), SPH_C32(0x9ba40000), SPH_C32(0x959c0000), + SPH_C32(0x984e92e0), SPH_C32(0x2b603743), SPH_C32(0x2540a03a), + SPH_C32(0xa8c39068), SPH_C32(0x44eb928c), SPH_C32(0xdabc0000), + SPH_C32(0xf6d50000), SPH_C32(0x9f0b0000), SPH_C32(0x1d7860c0), + SPH_C32(0x53003036), SPH_C32(0x1831dfec), SPH_C32(0x5424636b), + SPH_C32(0x307ca8be) }, + { SPH_C32(0x54740000), SPH_C32(0x8ecc0000), SPH_C32(0x784b0000), + SPH_C32(0xaa1390c0), SPH_C32(0xc86c01ca), SPH_C32(0x7f0a4679), + SPH_C32(0x4bb668c0), SPH_C32(0xc5166b84), SPH_C32(0x3c940000), + SPH_C32(0xba9e0000), SPH_C32(0x375e0000), SPH_C32(0xcea86220), + SPH_C32(0x8b61008e), SPH_C32(0x80966f36), SPH_C32(0x7cb165df), + SPH_C32(0xe726e029) }, + { SPH_C32(0xb25c0000), SPH_C32(0xc2870000), SPH_C32(0xd01e0000), + SPH_C32(0x79c39220), SPH_C32(0x100d3172), SPH_C32(0xe7adf6a3), + SPH_C32(0x63236e74), SPH_C32(0x124c2313), SPH_C32(0xcc510000), + SPH_C32(0xe3bd0000), SPH_C32(0x72dc0000), SPH_C32(0x2f2562e0), + SPH_C32(0xb00c06bf), SPH_C32(0x427b39af), SPH_C32(0xb7519bc3), + SPH_C32(0xb18151b6) }, + { SPH_C32(0x10800000), SPH_C32(0xa0dc0000), SPH_C32(0x8c940000), + SPH_C32(0x344e94e0), SPH_C32(0x8ba366c3), SPH_C32(0x6cf1d3bd), + SPH_C32(0x52004255), SPH_C32(0xdddeaec5), SPH_C32(0xc97f0000), + SPH_C32(0x12370000), SPH_C32(0x5d9a0000), SPH_C32(0x43076060), + SPH_C32(0x46d73c1d), SPH_C32(0x5769be24), SPH_C32(0xec013671), + SPH_C32(0x3d0d0c18) }, + { SPH_C32(0xf6a80000), SPH_C32(0xec970000), SPH_C32(0x24c10000), + SPH_C32(0xe79e9600), SPH_C32(0x53c2567b), SPH_C32(0xf4566367), + SPH_C32(0x7a9544e1), SPH_C32(0x0a84e652), SPH_C32(0x39ba0000), + SPH_C32(0x4b140000), SPH_C32(0x18180000), SPH_C32(0xa28a60a0), + SPH_C32(0x7dba3a2c), SPH_C32(0x9584e8bd), SPH_C32(0x27e1c86d), + SPH_C32(0x6baabd87) }, + { SPH_C32(0xe0450000), SPH_C32(0xf9ff0000), SPH_C32(0xc9160000), + SPH_C32(0xd5c39420), SPH_C32(0xb0ce60f2), SPH_C32(0xae1c8524), + SPH_C32(0x99e0bc49), SPH_C32(0x8b791f5a), SPH_C32(0xdf920000), + SPH_C32(0x075f0000), SPH_C32(0xb04d0000), SPH_C32(0x715a6240), + SPH_C32(0xa5db0a94), SPH_C32(0x0d235867), SPH_C32(0x0f74ced9), + SPH_C32(0xbcf0f510) }, + { SPH_C32(0x066d0000), SPH_C32(0xb5b40000), SPH_C32(0x61430000), + SPH_C32(0x061396c0), SPH_C32(0x68af504a), SPH_C32(0x36bb35fe), + SPH_C32(0xb175bafd), SPH_C32(0x5c2357cd), SPH_C32(0x2f570000), + SPH_C32(0x5e7c0000), SPH_C32(0xf5cf0000), SPH_C32(0x90d76280), + SPH_C32(0x9eb60ca5), SPH_C32(0xcfce0efe), SPH_C32(0xc49430c5), + SPH_C32(0xea57448f) }, + { SPH_C32(0x47b70000), SPH_C32(0x6a2e0000), SPH_C32(0xbada0000), + SPH_C32(0xf46c9060), SPH_C32(0xddbb0de1), SPH_C32(0x305227b1), + SPH_C32(0xf3933dda), SPH_C32(0xc867cf22), SPH_C32(0x7d4e0000), + SPH_C32(0x65040000), SPH_C32(0xecc70000), SPH_C32(0x3cd76480), + SPH_C32(0x3e755d25), SPH_C32(0x867f7d79), SPH_C32(0x3e57e2f8), + SPH_C32(0x736278c6) }, + { SPH_C32(0xa19f0000), SPH_C32(0x26650000), SPH_C32(0x128f0000), + SPH_C32(0x27bc9280), SPH_C32(0x05da3d59), SPH_C32(0xa8f5976b), + SPH_C32(0xdb063b6e), SPH_C32(0x1f3d87b5), SPH_C32(0x8d8b0000), + SPH_C32(0x3c270000), SPH_C32(0xa9450000), SPH_C32(0xdd5a6440), + SPH_C32(0x05185b14), SPH_C32(0x44922be0), SPH_C32(0xf5b71ce4), + SPH_C32(0x25c5c959) }, + { SPH_C32(0xb7720000), SPH_C32(0x330d0000), SPH_C32(0xff580000), + SPH_C32(0x15e190a0), SPH_C32(0xe6d60bd0), SPH_C32(0xf2bf7128), + SPH_C32(0x3873c3c6), SPH_C32(0x9ec07ebd), SPH_C32(0x6ba30000), + SPH_C32(0x706c0000), SPH_C32(0x01100000), SPH_C32(0x0e8a66a0), + SPH_C32(0xdd796bac), SPH_C32(0xdc359b3a), SPH_C32(0xdd221a50), + SPH_C32(0xf29f81ce) }, + { SPH_C32(0x515a0000), SPH_C32(0x7f460000), SPH_C32(0x570d0000), + SPH_C32(0xc6319240), SPH_C32(0x3eb73b68), SPH_C32(0x6a18c1f2), + SPH_C32(0x10e6c572), SPH_C32(0x499a362a), SPH_C32(0x9b660000), + SPH_C32(0x294f0000), SPH_C32(0x44920000), SPH_C32(0xef076660), + SPH_C32(0xe6146d9d), SPH_C32(0x1ed8cda3), SPH_C32(0x16c2e44c), + SPH_C32(0xa4383051) }, + { SPH_C32(0xf3860000), SPH_C32(0x1d1d0000), SPH_C32(0x0b870000), + SPH_C32(0x8bbc9480), SPH_C32(0xa5196cd9), SPH_C32(0xe144e4ec), + SPH_C32(0x21c5e953), SPH_C32(0x8608bbfc), SPH_C32(0x9e480000), + SPH_C32(0xd8c50000), SPH_C32(0x6bd40000), SPH_C32(0x832564e0), + SPH_C32(0x10cf573f), SPH_C32(0x0bca4a28), SPH_C32(0x4d9249fe), + SPH_C32(0x28b46dff) }, + { SPH_C32(0x15ae0000), SPH_C32(0x51560000), SPH_C32(0xa3d20000), + SPH_C32(0x586c9660), SPH_C32(0x7d785c61), SPH_C32(0x79e35436), + SPH_C32(0x0950efe7), SPH_C32(0x5152f36b), SPH_C32(0x6e8d0000), + SPH_C32(0x81e60000), SPH_C32(0x2e560000), SPH_C32(0x62a86420), + SPH_C32(0x2ba2510e), SPH_C32(0xc9271cb1), SPH_C32(0x8672b7e2), + SPH_C32(0x7e13dc60) }, + { SPH_C32(0x03430000), SPH_C32(0x443e0000), SPH_C32(0x4e050000), + SPH_C32(0x6a319440), SPH_C32(0x9e746ae8), SPH_C32(0x23a9b275), + SPH_C32(0xea25174f), SPH_C32(0xd0af0a63), SPH_C32(0x88a50000), + SPH_C32(0xcdad0000), SPH_C32(0x86030000), SPH_C32(0xb17866c0), + SPH_C32(0xf3c361b6), SPH_C32(0x5180ac6b), SPH_C32(0xaee7b156), + SPH_C32(0xa94994f7) }, + { SPH_C32(0xe56b0000), SPH_C32(0x08750000), SPH_C32(0xe6500000), + SPH_C32(0xb9e196a0), SPH_C32(0x46155a50), SPH_C32(0xbb0e02af), + SPH_C32(0xc2b011fb), SPH_C32(0x07f542f4), SPH_C32(0x78600000), + SPH_C32(0x948e0000), SPH_C32(0xc3810000), SPH_C32(0x50f56600), + SPH_C32(0xc8ae6787), SPH_C32(0x936dfaf2), SPH_C32(0x65074f4a), + SPH_C32(0xffee2568) }, + { SPH_C32(0xa6430000), SPH_C32(0x756e0000), SPH_C32(0xbaf60000), + SPH_C32(0xa8f2e800), SPH_C32(0xed1c7314), SPH_C32(0xbada3b36), + SPH_C32(0x4494a4eb), SPH_C32(0xec83ff85), SPH_C32(0x90a40000), + SPH_C32(0xbc5b0000), SPH_C32(0x6d6e0000), SPH_C32(0x0bdd4800), + SPH_C32(0xb728224a), SPH_C32(0xecc64a4f), SPH_C32(0x759e1063), + SPH_C32(0x4cf701d1) }, + { SPH_C32(0x406b0000), SPH_C32(0x39250000), SPH_C32(0x12a30000), + SPH_C32(0x7b22eae0), SPH_C32(0x357d43ac), SPH_C32(0x227d8bec), + SPH_C32(0x6c01a25f), SPH_C32(0x3bd9b712), SPH_C32(0x60610000), + SPH_C32(0xe5780000), SPH_C32(0x28ec0000), SPH_C32(0xea5048c0), + SPH_C32(0x8c45247b), SPH_C32(0x2e2b1cd6), SPH_C32(0xbe7eee7f), + SPH_C32(0x1a50b04e) }, + { SPH_C32(0x56860000), SPH_C32(0x2c4d0000), SPH_C32(0xff740000), + SPH_C32(0x497fe8c0), SPH_C32(0xd6717525), SPH_C32(0x78376daf), + SPH_C32(0x8f745af7), SPH_C32(0xba244e1a), SPH_C32(0x86490000), + SPH_C32(0xa9330000), SPH_C32(0x80b90000), SPH_C32(0x39804a20), + SPH_C32(0x542414c3), SPH_C32(0xb68cac0c), SPH_C32(0x96ebe8cb), + SPH_C32(0xcd0af8d9) }, + { SPH_C32(0xb0ae0000), SPH_C32(0x60060000), SPH_C32(0x57210000), + SPH_C32(0x9aafea20), SPH_C32(0x0e10459d), SPH_C32(0xe090dd75), + SPH_C32(0xa7e15c43), SPH_C32(0x6d7e068d), SPH_C32(0x768c0000), + SPH_C32(0xf0100000), SPH_C32(0xc53b0000), SPH_C32(0xd80d4ae0), + SPH_C32(0x6f4912f2), SPH_C32(0x7461fa95), SPH_C32(0x5d0b16d7), + SPH_C32(0x9bad4946) }, + { SPH_C32(0x12720000), SPH_C32(0x025d0000), SPH_C32(0x0bab0000), + SPH_C32(0xd722ece0), SPH_C32(0x95be122c), SPH_C32(0x6bccf86b), + SPH_C32(0x96c27062), SPH_C32(0xa2ec8b5b), SPH_C32(0x73a20000), + SPH_C32(0x019a0000), SPH_C32(0xea7d0000), SPH_C32(0xb42f4860), + SPH_C32(0x99922850), SPH_C32(0x61737d1e), SPH_C32(0x065bbb65), + SPH_C32(0x172114e8) }, + { SPH_C32(0xf45a0000), SPH_C32(0x4e160000), SPH_C32(0xa3fe0000), + SPH_C32(0x04f2ee00), SPH_C32(0x4ddf2294), SPH_C32(0xf36b48b1), + SPH_C32(0xbe5776d6), SPH_C32(0x75b6c3cc), SPH_C32(0x83670000), + SPH_C32(0x58b90000), SPH_C32(0xafff0000), SPH_C32(0x55a248a0), + SPH_C32(0xa2ff2e61), SPH_C32(0xa39e2b87), SPH_C32(0xcdbb4579), + SPH_C32(0x4186a577) }, + { SPH_C32(0xe2b70000), SPH_C32(0x5b7e0000), SPH_C32(0x4e290000), + SPH_C32(0x36afec20), SPH_C32(0xaed3141d), SPH_C32(0xa921aef2), + SPH_C32(0x5d228e7e), SPH_C32(0xf44b3ac4), SPH_C32(0x654f0000), + SPH_C32(0x14f20000), SPH_C32(0x07aa0000), SPH_C32(0x86724a40), + SPH_C32(0x7a9e1ed9), SPH_C32(0x3b399b5d), SPH_C32(0xe52e43cd), + SPH_C32(0x96dcede0) }, + { SPH_C32(0x049f0000), SPH_C32(0x17350000), SPH_C32(0xe67c0000), + SPH_C32(0xe57feec0), SPH_C32(0x76b224a5), SPH_C32(0x31861e28), + SPH_C32(0x75b788ca), SPH_C32(0x23117253), SPH_C32(0x958a0000), + SPH_C32(0x4dd10000), SPH_C32(0x42280000), SPH_C32(0x67ff4a80), + SPH_C32(0x41f318e8), SPH_C32(0xf9d4cdc4), SPH_C32(0x2ecebdd1), + SPH_C32(0xc07b5c7f) }, + { SPH_C32(0x45450000), SPH_C32(0xc8af0000), SPH_C32(0x3de50000), + SPH_C32(0x1700e860), SPH_C32(0xc3a6790e), SPH_C32(0x376f0c67), + SPH_C32(0x37510fed), SPH_C32(0xb755eabc), SPH_C32(0xc7930000), + SPH_C32(0x76a90000), SPH_C32(0x5b200000), SPH_C32(0xcbff4c80), + SPH_C32(0xe1304968), SPH_C32(0xb065be43), SPH_C32(0xd40d6fec), + SPH_C32(0x594e6036) }, + { SPH_C32(0xa36d0000), SPH_C32(0x84e40000), SPH_C32(0x95b00000), + SPH_C32(0xc4d0ea80), SPH_C32(0x1bc749b6), SPH_C32(0xafc8bcbd), + SPH_C32(0x1fc40959), SPH_C32(0x600fa22b), SPH_C32(0x37560000), + SPH_C32(0x2f8a0000), SPH_C32(0x1ea20000), SPH_C32(0x2a724c40), + SPH_C32(0xda5d4f59), SPH_C32(0x7288e8da), SPH_C32(0x1fed91f0), + SPH_C32(0x0fe9d1a9) }, + { SPH_C32(0xb5800000), SPH_C32(0x918c0000), SPH_C32(0x78670000), + SPH_C32(0xf68de8a0), SPH_C32(0xf8cb7f3f), SPH_C32(0xf5825afe), + SPH_C32(0xfcb1f1f1), SPH_C32(0xe1f25b23), SPH_C32(0xd17e0000), + SPH_C32(0x63c10000), SPH_C32(0xb6f70000), SPH_C32(0xf9a24ea0), + SPH_C32(0x023c7fe1), SPH_C32(0xea2f5800), SPH_C32(0x37789744), + SPH_C32(0xd8b3993e) }, + { SPH_C32(0x53a80000), SPH_C32(0xddc70000), SPH_C32(0xd0320000), + SPH_C32(0x255dea40), SPH_C32(0x20aa4f87), SPH_C32(0x6d25ea24), + SPH_C32(0xd424f745), SPH_C32(0x36a813b4), SPH_C32(0x21bb0000), + SPH_C32(0x3ae20000), SPH_C32(0xf3750000), SPH_C32(0x182f4e60), + SPH_C32(0x395179d0), SPH_C32(0x28c20e99), SPH_C32(0xfc986958), + SPH_C32(0x8e1428a1) }, + { SPH_C32(0xf1740000), SPH_C32(0xbf9c0000), SPH_C32(0x8cb80000), + SPH_C32(0x68d0ec80), SPH_C32(0xbb041836), SPH_C32(0xe679cf3a), + SPH_C32(0xe507db64), SPH_C32(0xf93a9e62), SPH_C32(0x24950000), + SPH_C32(0xcb680000), SPH_C32(0xdc330000), SPH_C32(0x740d4ce0), + SPH_C32(0xcf8a4372), SPH_C32(0x3dd08912), SPH_C32(0xa7c8c4ea), + SPH_C32(0x0298750f) }, + { SPH_C32(0x175c0000), SPH_C32(0xf3d70000), SPH_C32(0x24ed0000), + SPH_C32(0xbb00ee60), SPH_C32(0x6365288e), SPH_C32(0x7ede7fe0), + SPH_C32(0xcd92ddd0), SPH_C32(0x2e60d6f5), SPH_C32(0xd4500000), + SPH_C32(0x924b0000), SPH_C32(0x99b10000), SPH_C32(0x95804c20), + SPH_C32(0xf4e74543), SPH_C32(0xff3ddf8b), SPH_C32(0x6c283af6), + SPH_C32(0x543fc490) }, + { SPH_C32(0x01b10000), SPH_C32(0xe6bf0000), SPH_C32(0xc93a0000), + SPH_C32(0x895dec40), SPH_C32(0x80691e07), SPH_C32(0x249499a3), + SPH_C32(0x2ee72578), SPH_C32(0xaf9d2ffd), SPH_C32(0x32780000), + SPH_C32(0xde000000), SPH_C32(0x31e40000), SPH_C32(0x46504ec0), + SPH_C32(0x2c8675fb), SPH_C32(0x679a6f51), SPH_C32(0x44bd3c42), + SPH_C32(0x83658c07) }, + { SPH_C32(0xe7990000), SPH_C32(0xaaf40000), SPH_C32(0x616f0000), + SPH_C32(0x5a8deea0), SPH_C32(0x58082ebf), SPH_C32(0xbc332979), + SPH_C32(0x067223cc), SPH_C32(0x78c7676a), SPH_C32(0xc2bd0000), + SPH_C32(0x87230000), SPH_C32(0x74660000), SPH_C32(0xa7dd4e00), + SPH_C32(0x17eb73ca), SPH_C32(0xa57739c8), SPH_C32(0x8f5dc25e), + SPH_C32(0xd5c23d98) }, + { SPH_C32(0x92560000), SPH_C32(0x1eda0000), SPH_C32(0xea510000), + SPH_C32(0xe8b13000), SPH_C32(0xa93556a5), SPH_C32(0xebfb6199), + SPH_C32(0xb15c2254), SPH_C32(0x33c5244f), SPH_C32(0x8c3a0000), + SPH_C32(0xda980000), SPH_C32(0x607f0000), SPH_C32(0x54078800), + SPH_C32(0x85714513), SPH_C32(0x6006b243), SPH_C32(0xdb50399c), + SPH_C32(0x8a58e6a4) }, + { SPH_C32(0x747e0000), SPH_C32(0x52910000), SPH_C32(0x42040000), + SPH_C32(0x3b6132e0), SPH_C32(0x7154661d), SPH_C32(0x735cd143), + SPH_C32(0x99c924e0), SPH_C32(0xe49f6cd8), SPH_C32(0x7cff0000), + SPH_C32(0x83bb0000), SPH_C32(0x25fd0000), SPH_C32(0xb58a88c0), + SPH_C32(0xbe1c4322), SPH_C32(0xa2ebe4da), SPH_C32(0x10b0c780), + SPH_C32(0xdcff573b) }, + { SPH_C32(0x62930000), SPH_C32(0x47f90000), SPH_C32(0xafd30000), + SPH_C32(0x093c30c0), SPH_C32(0x92585094), SPH_C32(0x29163700), + SPH_C32(0x7abcdc48), SPH_C32(0x656295d0), SPH_C32(0x9ad70000), + SPH_C32(0xcff00000), SPH_C32(0x8da80000), SPH_C32(0x665a8a20), + SPH_C32(0x667d739a), SPH_C32(0x3a4c5400), SPH_C32(0x3825c134), + SPH_C32(0x0ba51fac) }, + { SPH_C32(0x84bb0000), SPH_C32(0x0bb20000), SPH_C32(0x07860000), + SPH_C32(0xdaec3220), SPH_C32(0x4a39602c), SPH_C32(0xb1b187da), + SPH_C32(0x5229dafc), SPH_C32(0xb238dd47), SPH_C32(0x6a120000), + SPH_C32(0x96d30000), SPH_C32(0xc82a0000), SPH_C32(0x87d78ae0), + SPH_C32(0x5d1075ab), SPH_C32(0xf8a10299), SPH_C32(0xf3c53f28), + SPH_C32(0x5d02ae33) }, + { SPH_C32(0x26670000), SPH_C32(0x69e90000), SPH_C32(0x5b0c0000), + SPH_C32(0x976134e0), SPH_C32(0xd197379d), SPH_C32(0x3aeda2c4), + SPH_C32(0x630af6dd), SPH_C32(0x7daa5091), SPH_C32(0x6f3c0000), + SPH_C32(0x67590000), SPH_C32(0xe76c0000), SPH_C32(0xebf58860), + SPH_C32(0xabcb4f09), SPH_C32(0xedb38512), SPH_C32(0xa895929a), + SPH_C32(0xd18ef39d) }, + { SPH_C32(0xc04f0000), SPH_C32(0x25a20000), SPH_C32(0xf3590000), + SPH_C32(0x44b13600), SPH_C32(0x09f60725), SPH_C32(0xa24a121e), + SPH_C32(0x4b9ff069), SPH_C32(0xaaf01806), SPH_C32(0x9ff90000), + SPH_C32(0x3e7a0000), SPH_C32(0xa2ee0000), SPH_C32(0x0a7888a0), + SPH_C32(0x90a64938), SPH_C32(0x2f5ed38b), SPH_C32(0x63756c86), + SPH_C32(0x87294202) }, + { SPH_C32(0xd6a20000), SPH_C32(0x30ca0000), SPH_C32(0x1e8e0000), + SPH_C32(0x76ec3420), SPH_C32(0xeafa31ac), SPH_C32(0xf800f45d), + SPH_C32(0xa8ea08c1), SPH_C32(0x2b0de10e), SPH_C32(0x79d10000), + SPH_C32(0x72310000), SPH_C32(0x0abb0000), SPH_C32(0xd9a88a40), + SPH_C32(0x48c77980), SPH_C32(0xb7f96351), SPH_C32(0x4be06a32), + SPH_C32(0x50730a95) }, + { SPH_C32(0x308a0000), SPH_C32(0x7c810000), SPH_C32(0xb6db0000), + SPH_C32(0xa53c36c0), SPH_C32(0x329b0114), SPH_C32(0x60a74487), + SPH_C32(0x807f0e75), SPH_C32(0xfc57a999), SPH_C32(0x89140000), + SPH_C32(0x2b120000), SPH_C32(0x4f390000), SPH_C32(0x38258a80), + SPH_C32(0x73aa7fb1), SPH_C32(0x751435c8), SPH_C32(0x8000942e), + SPH_C32(0x06d4bb0a) }, + { SPH_C32(0x71500000), SPH_C32(0xa31b0000), SPH_C32(0x6d420000), + SPH_C32(0x57433060), SPH_C32(0x878f5cbf), SPH_C32(0x664e56c8), + SPH_C32(0xc2998952), SPH_C32(0x68133176), SPH_C32(0xdb0d0000), + SPH_C32(0x106a0000), SPH_C32(0x56310000), SPH_C32(0x94258c80), + SPH_C32(0xd3692e31), SPH_C32(0x3ca5464f), SPH_C32(0x7ac34613), + SPH_C32(0x9fe18743) }, + { SPH_C32(0x97780000), SPH_C32(0xef500000), SPH_C32(0xc5170000), + SPH_C32(0x84933280), SPH_C32(0x5fee6c07), SPH_C32(0xfee9e612), + SPH_C32(0xea0c8fe6), SPH_C32(0xbf4979e1), SPH_C32(0x2bc80000), + SPH_C32(0x49490000), SPH_C32(0x13b30000), SPH_C32(0x75a88c40), + SPH_C32(0xe8042800), SPH_C32(0xfe4810d6), SPH_C32(0xb123b80f), + SPH_C32(0xc94636dc) }, + { SPH_C32(0x81950000), SPH_C32(0xfa380000), SPH_C32(0x28c00000), + SPH_C32(0xb6ce30a0), SPH_C32(0xbce25a8e), SPH_C32(0xa4a30051), + SPH_C32(0x0979774e), SPH_C32(0x3eb480e9), SPH_C32(0xcde00000), + SPH_C32(0x05020000), SPH_C32(0xbbe60000), SPH_C32(0xa6788ea0), + SPH_C32(0x306518b8), SPH_C32(0x66efa00c), SPH_C32(0x99b6bebb), + SPH_C32(0x1e1c7e4b) }, + { SPH_C32(0x67bd0000), SPH_C32(0xb6730000), SPH_C32(0x80950000), + SPH_C32(0x651e3240), SPH_C32(0x64836a36), SPH_C32(0x3c04b08b), + SPH_C32(0x21ec71fa), SPH_C32(0xe9eec87e), SPH_C32(0x3d250000), + SPH_C32(0x5c210000), SPH_C32(0xfe640000), SPH_C32(0x47f58e60), + SPH_C32(0x0b081e89), SPH_C32(0xa402f695), SPH_C32(0x525640a7), + SPH_C32(0x48bbcfd4) }, + { SPH_C32(0xc5610000), SPH_C32(0xd4280000), SPH_C32(0xdc1f0000), + SPH_C32(0x28933480), SPH_C32(0xff2d3d87), SPH_C32(0xb7589595), + SPH_C32(0x10cf5ddb), SPH_C32(0x267c45a8), SPH_C32(0x380b0000), + SPH_C32(0xadab0000), SPH_C32(0xd1220000), SPH_C32(0x2bd78ce0), + SPH_C32(0xfdd3242b), SPH_C32(0xb110711e), SPH_C32(0x0906ed15), + SPH_C32(0xc437927a) }, + { SPH_C32(0x23490000), SPH_C32(0x98630000), SPH_C32(0x744a0000), + SPH_C32(0xfb433660), SPH_C32(0x274c0d3f), SPH_C32(0x2fff254f), + SPH_C32(0x385a5b6f), SPH_C32(0xf1260d3f), SPH_C32(0xc8ce0000), + SPH_C32(0xf4880000), SPH_C32(0x94a00000), SPH_C32(0xca5a8c20), + SPH_C32(0xc6be221a), SPH_C32(0x73fd2787), SPH_C32(0xc2e61309), + SPH_C32(0x929023e5) }, + { SPH_C32(0x35a40000), SPH_C32(0x8d0b0000), SPH_C32(0x999d0000), + SPH_C32(0xc91e3440), SPH_C32(0xc4403bb6), SPH_C32(0x75b5c30c), + SPH_C32(0xdb2fa3c7), SPH_C32(0x70dbf437), SPH_C32(0x2ee60000), + SPH_C32(0xb8c30000), SPH_C32(0x3cf50000), SPH_C32(0x198a8ec0), + SPH_C32(0x1edf12a2), SPH_C32(0xeb5a975d), SPH_C32(0xea7315bd), + SPH_C32(0x45ca6b72) }, + { SPH_C32(0xd38c0000), SPH_C32(0xc1400000), SPH_C32(0x31c80000), + SPH_C32(0x1ace36a0), SPH_C32(0x1c210b0e), SPH_C32(0xed1273d6), + SPH_C32(0xf3baa573), SPH_C32(0xa781bca0), SPH_C32(0xde230000), + SPH_C32(0xe1e00000), SPH_C32(0x79770000), SPH_C32(0xf8078e00), + SPH_C32(0x25b21493), SPH_C32(0x29b7c1c4), SPH_C32(0x2193eba1), + SPH_C32(0x136ddaed) }, + { SPH_C32(0x90a40000), SPH_C32(0xbc5b0000), SPH_C32(0x6d6e0000), + SPH_C32(0x0bdd4800), SPH_C32(0xb728224a), SPH_C32(0xecc64a4f), + SPH_C32(0x759e1063), SPH_C32(0x4cf701d1), SPH_C32(0x36e70000), + SPH_C32(0xc9350000), SPH_C32(0xd7980000), SPH_C32(0xa32fa000), + SPH_C32(0x5a34515e), SPH_C32(0x561c7179), SPH_C32(0x310ab488), + SPH_C32(0xa074fe54) }, + { SPH_C32(0x768c0000), SPH_C32(0xf0100000), SPH_C32(0xc53b0000), + SPH_C32(0xd80d4ae0), SPH_C32(0x6f4912f2), SPH_C32(0x7461fa95), + SPH_C32(0x5d0b16d7), SPH_C32(0x9bad4946), SPH_C32(0xc6220000), + SPH_C32(0x90160000), SPH_C32(0x921a0000), SPH_C32(0x42a2a0c0), + SPH_C32(0x6159576f), SPH_C32(0x94f127e0), SPH_C32(0xfaea4a94), + SPH_C32(0xf6d34fcb) }, + { SPH_C32(0x60610000), SPH_C32(0xe5780000), SPH_C32(0x28ec0000), + SPH_C32(0xea5048c0), SPH_C32(0x8c45247b), SPH_C32(0x2e2b1cd6), + SPH_C32(0xbe7eee7f), SPH_C32(0x1a50b04e), SPH_C32(0x200a0000), + SPH_C32(0xdc5d0000), SPH_C32(0x3a4f0000), SPH_C32(0x9172a220), + SPH_C32(0xb93867d7), SPH_C32(0x0c56973a), SPH_C32(0xd27f4c20), + SPH_C32(0x2189075c) }, + { SPH_C32(0x86490000), SPH_C32(0xa9330000), SPH_C32(0x80b90000), + SPH_C32(0x39804a20), SPH_C32(0x542414c3), SPH_C32(0xb68cac0c), + SPH_C32(0x96ebe8cb), SPH_C32(0xcd0af8d9), SPH_C32(0xd0cf0000), + SPH_C32(0x857e0000), SPH_C32(0x7fcd0000), SPH_C32(0x70ffa2e0), + SPH_C32(0x825561e6), SPH_C32(0xcebbc1a3), SPH_C32(0x199fb23c), + SPH_C32(0x772eb6c3) }, + { SPH_C32(0x24950000), SPH_C32(0xcb680000), SPH_C32(0xdc330000), + SPH_C32(0x740d4ce0), SPH_C32(0xcf8a4372), SPH_C32(0x3dd08912), + SPH_C32(0xa7c8c4ea), SPH_C32(0x0298750f), SPH_C32(0xd5e10000), + SPH_C32(0x74f40000), SPH_C32(0x508b0000), SPH_C32(0x1cdda060), + SPH_C32(0x748e5b44), SPH_C32(0xdba94628), SPH_C32(0x42cf1f8e), + SPH_C32(0xfba2eb6d) }, + { SPH_C32(0xc2bd0000), SPH_C32(0x87230000), SPH_C32(0x74660000), + SPH_C32(0xa7dd4e00), SPH_C32(0x17eb73ca), SPH_C32(0xa57739c8), + SPH_C32(0x8f5dc25e), SPH_C32(0xd5c23d98), SPH_C32(0x25240000), + SPH_C32(0x2dd70000), SPH_C32(0x15090000), SPH_C32(0xfd50a0a0), + SPH_C32(0x4fe35d75), SPH_C32(0x194410b1), SPH_C32(0x892fe192), + SPH_C32(0xad055af2) }, + { SPH_C32(0xd4500000), SPH_C32(0x924b0000), SPH_C32(0x99b10000), + SPH_C32(0x95804c20), SPH_C32(0xf4e74543), SPH_C32(0xff3ddf8b), + SPH_C32(0x6c283af6), SPH_C32(0x543fc490), SPH_C32(0xc30c0000), + SPH_C32(0x619c0000), SPH_C32(0xbd5c0000), SPH_C32(0x2e80a240), + SPH_C32(0x97826dcd), SPH_C32(0x81e3a06b), SPH_C32(0xa1bae726), + SPH_C32(0x7a5f1265) }, + { SPH_C32(0x32780000), SPH_C32(0xde000000), SPH_C32(0x31e40000), + SPH_C32(0x46504ec0), SPH_C32(0x2c8675fb), SPH_C32(0x679a6f51), + SPH_C32(0x44bd3c42), SPH_C32(0x83658c07), SPH_C32(0x33c90000), + SPH_C32(0x38bf0000), SPH_C32(0xf8de0000), SPH_C32(0xcf0da280), + SPH_C32(0xacef6bfc), SPH_C32(0x430ef6f2), SPH_C32(0x6a5a193a), + SPH_C32(0x2cf8a3fa) }, + { SPH_C32(0x73a20000), SPH_C32(0x019a0000), SPH_C32(0xea7d0000), + SPH_C32(0xb42f4860), SPH_C32(0x99922850), SPH_C32(0x61737d1e), + SPH_C32(0x065bbb65), SPH_C32(0x172114e8), SPH_C32(0x61d00000), + SPH_C32(0x03c70000), SPH_C32(0xe1d60000), SPH_C32(0x630da480), + SPH_C32(0x0c2c3a7c), SPH_C32(0x0abf8575), SPH_C32(0x9099cb07), + SPH_C32(0xb5cd9fb3) }, + { SPH_C32(0x958a0000), SPH_C32(0x4dd10000), SPH_C32(0x42280000), + SPH_C32(0x67ff4a80), SPH_C32(0x41f318e8), SPH_C32(0xf9d4cdc4), + SPH_C32(0x2ecebdd1), SPH_C32(0xc07b5c7f), SPH_C32(0x91150000), + SPH_C32(0x5ae40000), SPH_C32(0xa4540000), SPH_C32(0x8280a440), + SPH_C32(0x37413c4d), SPH_C32(0xc852d3ec), SPH_C32(0x5b79351b), + SPH_C32(0xe36a2e2c) }, + { SPH_C32(0x83670000), SPH_C32(0x58b90000), SPH_C32(0xafff0000), + SPH_C32(0x55a248a0), SPH_C32(0xa2ff2e61), SPH_C32(0xa39e2b87), + SPH_C32(0xcdbb4579), SPH_C32(0x4186a577), SPH_C32(0x773d0000), + SPH_C32(0x16af0000), SPH_C32(0x0c010000), SPH_C32(0x5150a6a0), + SPH_C32(0xef200cf5), SPH_C32(0x50f56336), SPH_C32(0x73ec33af), + SPH_C32(0x343066bb) }, + { SPH_C32(0x654f0000), SPH_C32(0x14f20000), SPH_C32(0x07aa0000), + SPH_C32(0x86724a40), SPH_C32(0x7a9e1ed9), SPH_C32(0x3b399b5d), + SPH_C32(0xe52e43cd), SPH_C32(0x96dcede0), SPH_C32(0x87f80000), + SPH_C32(0x4f8c0000), SPH_C32(0x49830000), SPH_C32(0xb0dda660), + SPH_C32(0xd44d0ac4), SPH_C32(0x921835af), SPH_C32(0xb80ccdb3), + SPH_C32(0x6297d724) }, + { SPH_C32(0xc7930000), SPH_C32(0x76a90000), SPH_C32(0x5b200000), + SPH_C32(0xcbff4c80), SPH_C32(0xe1304968), SPH_C32(0xb065be43), + SPH_C32(0xd40d6fec), SPH_C32(0x594e6036), SPH_C32(0x82d60000), + SPH_C32(0xbe060000), SPH_C32(0x66c50000), SPH_C32(0xdcffa4e0), + SPH_C32(0x22963066), SPH_C32(0x870ab224), SPH_C32(0xe35c6001), + SPH_C32(0xee1b8a8a) }, + { SPH_C32(0x21bb0000), SPH_C32(0x3ae20000), SPH_C32(0xf3750000), + SPH_C32(0x182f4e60), SPH_C32(0x395179d0), SPH_C32(0x28c20e99), + SPH_C32(0xfc986958), SPH_C32(0x8e1428a1), SPH_C32(0x72130000), + SPH_C32(0xe7250000), SPH_C32(0x23470000), SPH_C32(0x3d72a420), + SPH_C32(0x19fb3657), SPH_C32(0x45e7e4bd), SPH_C32(0x28bc9e1d), + SPH_C32(0xb8bc3b15) }, + { SPH_C32(0x37560000), SPH_C32(0x2f8a0000), SPH_C32(0x1ea20000), + SPH_C32(0x2a724c40), SPH_C32(0xda5d4f59), SPH_C32(0x7288e8da), + SPH_C32(0x1fed91f0), SPH_C32(0x0fe9d1a9), SPH_C32(0x943b0000), + SPH_C32(0xab6e0000), SPH_C32(0x8b120000), SPH_C32(0xeea2a6c0), + SPH_C32(0xc19a06ef), SPH_C32(0xdd405467), SPH_C32(0x002998a9), + SPH_C32(0x6fe67382) }, + { SPH_C32(0xd17e0000), SPH_C32(0x63c10000), SPH_C32(0xb6f70000), + SPH_C32(0xf9a24ea0), SPH_C32(0x023c7fe1), SPH_C32(0xea2f5800), + SPH_C32(0x37789744), SPH_C32(0xd8b3993e), SPH_C32(0x64fe0000), + SPH_C32(0xf24d0000), SPH_C32(0xce900000), SPH_C32(0x0f2fa600), + SPH_C32(0xfaf700de), SPH_C32(0x1fad02fe), SPH_C32(0xcbc966b5), + SPH_C32(0x3941c21d) }, + { SPH_C32(0x288b0000), SPH_C32(0x0d770000), SPH_C32(0x5db60000), + SPH_C32(0x1f991800), SPH_C32(0x767042e8), SPH_C32(0xdde1a2a3), + SPH_C32(0x5b06af40), SPH_C32(0x19e93cbf), SPH_C32(0x34150000), + SPH_C32(0x6bb40000), SPH_C32(0x50a70000), SPH_C32(0x4043d800), + SPH_C32(0x442925b1), SPH_C32(0x51215aaf), SPH_C32(0xf5c886bf), + SPH_C32(0xdf46dbca) }, + { SPH_C32(0xcea30000), SPH_C32(0x413c0000), SPH_C32(0xf5e30000), + SPH_C32(0xcc491ae0), SPH_C32(0xae117250), SPH_C32(0x45461279), + SPH_C32(0x7393a9f4), SPH_C32(0xceb37428), SPH_C32(0xc4d00000), + SPH_C32(0x32970000), SPH_C32(0x15250000), SPH_C32(0xa1ced8c0), + SPH_C32(0x7f442380), SPH_C32(0x93cc0c36), SPH_C32(0x3e2878a3), + SPH_C32(0x89e16a55) }, + { SPH_C32(0xd84e0000), SPH_C32(0x54540000), SPH_C32(0x18340000), + SPH_C32(0xfe1418c0), SPH_C32(0x4d1d44d9), SPH_C32(0x1f0cf43a), + SPH_C32(0x90e6515c), SPH_C32(0x4f4e8d20), SPH_C32(0x22f80000), + SPH_C32(0x7edc0000), SPH_C32(0xbd700000), SPH_C32(0x721eda20), + SPH_C32(0xa7251338), SPH_C32(0x0b6bbcec), SPH_C32(0x16bd7e17), + SPH_C32(0x5ebb22c2) }, + { SPH_C32(0x3e660000), SPH_C32(0x181f0000), SPH_C32(0xb0610000), + SPH_C32(0x2dc41a20), SPH_C32(0x957c7461), SPH_C32(0x87ab44e0), + SPH_C32(0xb87357e8), SPH_C32(0x9814c5b7), SPH_C32(0xd23d0000), + SPH_C32(0x27ff0000), SPH_C32(0xf8f20000), SPH_C32(0x9393dae0), + SPH_C32(0x9c481509), SPH_C32(0xc986ea75), SPH_C32(0xdd5d800b), + SPH_C32(0x081c935d) }, + { SPH_C32(0x9cba0000), SPH_C32(0x7a440000), SPH_C32(0xeceb0000), + SPH_C32(0x60491ce0), SPH_C32(0x0ed223d0), SPH_C32(0x0cf761fe), + SPH_C32(0x89507bc9), SPH_C32(0x57864861), SPH_C32(0xd7130000), + SPH_C32(0xd6750000), SPH_C32(0xd7b40000), SPH_C32(0xffb1d860), + SPH_C32(0x6a932fab), SPH_C32(0xdc946dfe), SPH_C32(0x860d2db9), + SPH_C32(0x8490cef3) }, + { SPH_C32(0x7a920000), SPH_C32(0x360f0000), SPH_C32(0x44be0000), + SPH_C32(0xb3991e00), SPH_C32(0xd6b31368), SPH_C32(0x9450d124), + SPH_C32(0xa1c57d7d), SPH_C32(0x80dc00f6), SPH_C32(0x27d60000), + SPH_C32(0x8f560000), SPH_C32(0x92360000), SPH_C32(0x1e3cd8a0), + SPH_C32(0x51fe299a), SPH_C32(0x1e793b67), SPH_C32(0x4dedd3a5), + SPH_C32(0xd2377f6c) }, + { SPH_C32(0x6c7f0000), SPH_C32(0x23670000), SPH_C32(0xa9690000), + SPH_C32(0x81c41c20), SPH_C32(0x35bf25e1), SPH_C32(0xce1a3767), + SPH_C32(0x42b085d5), SPH_C32(0x0121f9fe), SPH_C32(0xc1fe0000), + SPH_C32(0xc31d0000), SPH_C32(0x3a630000), SPH_C32(0xcdecda40), + SPH_C32(0x899f1922), SPH_C32(0x86de8bbd), SPH_C32(0x6578d511), + SPH_C32(0x056d37fb) }, + { SPH_C32(0x8a570000), SPH_C32(0x6f2c0000), SPH_C32(0x013c0000), + SPH_C32(0x52141ec0), SPH_C32(0xedde1559), SPH_C32(0x56bd87bd), + SPH_C32(0x6a258361), SPH_C32(0xd67bb169), SPH_C32(0x313b0000), + SPH_C32(0x9a3e0000), SPH_C32(0x7fe10000), SPH_C32(0x2c61da80), + SPH_C32(0xb2f21f13), SPH_C32(0x4433dd24), SPH_C32(0xae982b0d), + SPH_C32(0x53ca8664) }, + { SPH_C32(0xcb8d0000), SPH_C32(0xb0b60000), SPH_C32(0xdaa50000), + SPH_C32(0xa06b1860), SPH_C32(0x58ca48f2), SPH_C32(0x505495f2), + SPH_C32(0x28c30446), SPH_C32(0x423f2986), SPH_C32(0x63220000), + SPH_C32(0xa1460000), SPH_C32(0x66e90000), SPH_C32(0x8061dc80), + SPH_C32(0x12314e93), SPH_C32(0x0d82aea3), SPH_C32(0x545bf930), + SPH_C32(0xcaffba2d) }, + { SPH_C32(0x2da50000), SPH_C32(0xfcfd0000), SPH_C32(0x72f00000), + SPH_C32(0x73bb1a80), SPH_C32(0x80ab784a), SPH_C32(0xc8f32528), + SPH_C32(0x005602f2), SPH_C32(0x95656111), SPH_C32(0x93e70000), + SPH_C32(0xf8650000), SPH_C32(0x236b0000), SPH_C32(0x61ecdc40), + SPH_C32(0x295c48a2), SPH_C32(0xcf6ff83a), SPH_C32(0x9fbb072c), + SPH_C32(0x9c580bb2) }, + { SPH_C32(0x3b480000), SPH_C32(0xe9950000), SPH_C32(0x9f270000), + SPH_C32(0x41e618a0), SPH_C32(0x63a74ec3), SPH_C32(0x92b9c36b), + SPH_C32(0xe323fa5a), SPH_C32(0x14989819), SPH_C32(0x75cf0000), + SPH_C32(0xb42e0000), SPH_C32(0x8b3e0000), SPH_C32(0xb23cdea0), + SPH_C32(0xf13d781a), SPH_C32(0x57c848e0), SPH_C32(0xb72e0198), + SPH_C32(0x4b024325) }, + { SPH_C32(0xdd600000), SPH_C32(0xa5de0000), SPH_C32(0x37720000), + SPH_C32(0x92361a40), SPH_C32(0xbbc67e7b), SPH_C32(0x0a1e73b1), + SPH_C32(0xcbb6fcee), SPH_C32(0xc3c2d08e), SPH_C32(0x850a0000), + SPH_C32(0xed0d0000), SPH_C32(0xcebc0000), SPH_C32(0x53b1de60), + SPH_C32(0xca507e2b), SPH_C32(0x95251e79), SPH_C32(0x7cceff84), + SPH_C32(0x1da5f2ba) }, + { SPH_C32(0x7fbc0000), SPH_C32(0xc7850000), SPH_C32(0x6bf80000), + SPH_C32(0xdfbb1c80), SPH_C32(0x206829ca), SPH_C32(0x814256af), + SPH_C32(0xfa95d0cf), SPH_C32(0x0c505d58), SPH_C32(0x80240000), + SPH_C32(0x1c870000), SPH_C32(0xe1fa0000), SPH_C32(0x3f93dce0), + SPH_C32(0x3c8b4489), SPH_C32(0x803799f2), SPH_C32(0x279e5236), + SPH_C32(0x9129af14) }, + { SPH_C32(0x99940000), SPH_C32(0x8bce0000), SPH_C32(0xc3ad0000), + SPH_C32(0x0c6b1e60), SPH_C32(0xf8091972), SPH_C32(0x19e5e675), + SPH_C32(0xd200d67b), SPH_C32(0xdb0a15cf), SPH_C32(0x70e10000), + SPH_C32(0x45a40000), SPH_C32(0xa4780000), SPH_C32(0xde1edc20), + SPH_C32(0x07e642b8), SPH_C32(0x42dacf6b), SPH_C32(0xec7eac2a), + SPH_C32(0xc78e1e8b) }, + { SPH_C32(0x8f790000), SPH_C32(0x9ea60000), SPH_C32(0x2e7a0000), + SPH_C32(0x3e361c40), SPH_C32(0x1b052ffb), SPH_C32(0x43af0036), + SPH_C32(0x31752ed3), SPH_C32(0x5af7ecc7), SPH_C32(0x96c90000), + SPH_C32(0x09ef0000), SPH_C32(0x0c2d0000), SPH_C32(0x0dcedec0), + SPH_C32(0xdf877200), SPH_C32(0xda7d7fb1), SPH_C32(0xc4ebaa9e), + SPH_C32(0x10d4561c) }, + { SPH_C32(0x69510000), SPH_C32(0xd2ed0000), SPH_C32(0x862f0000), + SPH_C32(0xede61ea0), SPH_C32(0xc3641f43), SPH_C32(0xdb08b0ec), + SPH_C32(0x19e02867), SPH_C32(0x8dada450), SPH_C32(0x660c0000), + SPH_C32(0x50cc0000), SPH_C32(0x49af0000), SPH_C32(0xec43de00), + SPH_C32(0xe4ea7431), SPH_C32(0x18902928), SPH_C32(0x0f0b5482), + SPH_C32(0x4673e783) }, + { SPH_C32(0x2a790000), SPH_C32(0xaff60000), SPH_C32(0xda890000), + SPH_C32(0xfcf56000), SPH_C32(0x686d3607), SPH_C32(0xdadc8975), + SPH_C32(0x9fc49d77), SPH_C32(0x66db1921), SPH_C32(0x8ec80000), + SPH_C32(0x78190000), SPH_C32(0xe7400000), SPH_C32(0xb76bf000), + SPH_C32(0x9b6c31fc), SPH_C32(0x673b9995), SPH_C32(0x1f920bab), + SPH_C32(0xf56ac33a) }, + { SPH_C32(0xcc510000), SPH_C32(0xe3bd0000), SPH_C32(0x72dc0000), + SPH_C32(0x2f2562e0), SPH_C32(0xb00c06bf), SPH_C32(0x427b39af), + SPH_C32(0xb7519bc3), SPH_C32(0xb18151b6), SPH_C32(0x7e0d0000), + SPH_C32(0x213a0000), SPH_C32(0xa2c20000), SPH_C32(0x56e6f0c0), + SPH_C32(0xa00137cd), SPH_C32(0xa5d6cf0c), SPH_C32(0xd472f5b7), + SPH_C32(0xa3cd72a5) }, + { SPH_C32(0xdabc0000), SPH_C32(0xf6d50000), SPH_C32(0x9f0b0000), + SPH_C32(0x1d7860c0), SPH_C32(0x53003036), SPH_C32(0x1831dfec), + SPH_C32(0x5424636b), SPH_C32(0x307ca8be), SPH_C32(0x98250000), + SPH_C32(0x6d710000), SPH_C32(0x0a970000), SPH_C32(0x8536f220), + SPH_C32(0x78600775), SPH_C32(0x3d717fd6), SPH_C32(0xfce7f303), + SPH_C32(0x74973a32) }, + { SPH_C32(0x3c940000), SPH_C32(0xba9e0000), SPH_C32(0x375e0000), + SPH_C32(0xcea86220), SPH_C32(0x8b61008e), SPH_C32(0x80966f36), + SPH_C32(0x7cb165df), SPH_C32(0xe726e029), SPH_C32(0x68e00000), + SPH_C32(0x34520000), SPH_C32(0x4f150000), SPH_C32(0x64bbf2e0), + SPH_C32(0x430d0144), SPH_C32(0xff9c294f), SPH_C32(0x37070d1f), + SPH_C32(0x22308bad) }, + { SPH_C32(0x9e480000), SPH_C32(0xd8c50000), SPH_C32(0x6bd40000), + SPH_C32(0x832564e0), SPH_C32(0x10cf573f), SPH_C32(0x0bca4a28), + SPH_C32(0x4d9249fe), SPH_C32(0x28b46dff), SPH_C32(0x6dce0000), + SPH_C32(0xc5d80000), SPH_C32(0x60530000), SPH_C32(0x0899f060), + SPH_C32(0xb5d63be6), SPH_C32(0xea8eaec4), SPH_C32(0x6c57a0ad), + SPH_C32(0xaebcd603) }, + { SPH_C32(0x78600000), SPH_C32(0x948e0000), SPH_C32(0xc3810000), + SPH_C32(0x50f56600), SPH_C32(0xc8ae6787), SPH_C32(0x936dfaf2), + SPH_C32(0x65074f4a), SPH_C32(0xffee2568), SPH_C32(0x9d0b0000), + SPH_C32(0x9cfb0000), SPH_C32(0x25d10000), SPH_C32(0xe914f0a0), + SPH_C32(0x8ebb3dd7), SPH_C32(0x2863f85d), SPH_C32(0xa7b75eb1), + SPH_C32(0xf81b679c) }, + { SPH_C32(0x6e8d0000), SPH_C32(0x81e60000), SPH_C32(0x2e560000), + SPH_C32(0x62a86420), SPH_C32(0x2ba2510e), SPH_C32(0xc9271cb1), + SPH_C32(0x8672b7e2), SPH_C32(0x7e13dc60), SPH_C32(0x7b230000), + SPH_C32(0xd0b00000), SPH_C32(0x8d840000), SPH_C32(0x3ac4f240), + SPH_C32(0x56da0d6f), SPH_C32(0xb0c44887), SPH_C32(0x8f225805), + SPH_C32(0x2f412f0b) }, + { SPH_C32(0x88a50000), SPH_C32(0xcdad0000), SPH_C32(0x86030000), + SPH_C32(0xb17866c0), SPH_C32(0xf3c361b6), SPH_C32(0x5180ac6b), + SPH_C32(0xaee7b156), SPH_C32(0xa94994f7), SPH_C32(0x8be60000), + SPH_C32(0x89930000), SPH_C32(0xc8060000), SPH_C32(0xdb49f280), + SPH_C32(0x6db70b5e), SPH_C32(0x72291e1e), SPH_C32(0x44c2a619), + SPH_C32(0x79e69e94) }, + { SPH_C32(0xc97f0000), SPH_C32(0x12370000), SPH_C32(0x5d9a0000), + SPH_C32(0x43076060), SPH_C32(0x46d73c1d), SPH_C32(0x5769be24), + SPH_C32(0xec013671), SPH_C32(0x3d0d0c18), SPH_C32(0xd9ff0000), + SPH_C32(0xb2eb0000), SPH_C32(0xd10e0000), SPH_C32(0x7749f480), + SPH_C32(0xcd745ade), SPH_C32(0x3b986d99), SPH_C32(0xbe017424), + SPH_C32(0xe0d3a2dd) }, + { SPH_C32(0x2f570000), SPH_C32(0x5e7c0000), SPH_C32(0xf5cf0000), + SPH_C32(0x90d76280), SPH_C32(0x9eb60ca5), SPH_C32(0xcfce0efe), + SPH_C32(0xc49430c5), SPH_C32(0xea57448f), SPH_C32(0x293a0000), + SPH_C32(0xebc80000), SPH_C32(0x948c0000), SPH_C32(0x96c4f440), + SPH_C32(0xf6195cef), SPH_C32(0xf9753b00), SPH_C32(0x75e18a38), + SPH_C32(0xb6741342) }, + { SPH_C32(0x39ba0000), SPH_C32(0x4b140000), SPH_C32(0x18180000), + SPH_C32(0xa28a60a0), SPH_C32(0x7dba3a2c), SPH_C32(0x9584e8bd), + SPH_C32(0x27e1c86d), SPH_C32(0x6baabd87), SPH_C32(0xcf120000), + SPH_C32(0xa7830000), SPH_C32(0x3cd90000), SPH_C32(0x4514f6a0), + SPH_C32(0x2e786c57), SPH_C32(0x61d28bda), SPH_C32(0x5d748c8c), + SPH_C32(0x612e5bd5) }, + { SPH_C32(0xdf920000), SPH_C32(0x075f0000), SPH_C32(0xb04d0000), + SPH_C32(0x715a6240), SPH_C32(0xa5db0a94), SPH_C32(0x0d235867), + SPH_C32(0x0f74ced9), SPH_C32(0xbcf0f510), SPH_C32(0x3fd70000), + SPH_C32(0xfea00000), SPH_C32(0x795b0000), SPH_C32(0xa499f660), + SPH_C32(0x15156a66), SPH_C32(0xa33fdd43), SPH_C32(0x96947290), + SPH_C32(0x3789ea4a) }, + { SPH_C32(0x7d4e0000), SPH_C32(0x65040000), SPH_C32(0xecc70000), + SPH_C32(0x3cd76480), SPH_C32(0x3e755d25), SPH_C32(0x867f7d79), + SPH_C32(0x3e57e2f8), SPH_C32(0x736278c6), SPH_C32(0x3af90000), + SPH_C32(0x0f2a0000), SPH_C32(0x561d0000), SPH_C32(0xc8bbf4e0), + SPH_C32(0xe3ce50c4), SPH_C32(0xb62d5ac8), SPH_C32(0xcdc4df22), + SPH_C32(0xbb05b7e4) }, + { SPH_C32(0x9b660000), SPH_C32(0x294f0000), SPH_C32(0x44920000), + SPH_C32(0xef076660), SPH_C32(0xe6146d9d), SPH_C32(0x1ed8cda3), + SPH_C32(0x16c2e44c), SPH_C32(0xa4383051), SPH_C32(0xca3c0000), + SPH_C32(0x56090000), SPH_C32(0x139f0000), SPH_C32(0x2936f420), + SPH_C32(0xd8a356f5), SPH_C32(0x74c00c51), SPH_C32(0x0624213e), + SPH_C32(0xeda2067b) }, + { SPH_C32(0x8d8b0000), SPH_C32(0x3c270000), SPH_C32(0xa9450000), + SPH_C32(0xdd5a6440), SPH_C32(0x05185b14), SPH_C32(0x44922be0), + SPH_C32(0xf5b71ce4), SPH_C32(0x25c5c959), SPH_C32(0x2c140000), + SPH_C32(0x1a420000), SPH_C32(0xbbca0000), SPH_C32(0xfae6f6c0), + SPH_C32(0x00c2664d), SPH_C32(0xec67bc8b), SPH_C32(0x2eb1278a), + SPH_C32(0x3af84eec) }, + { SPH_C32(0x6ba30000), SPH_C32(0x706c0000), SPH_C32(0x01100000), + SPH_C32(0x0e8a66a0), SPH_C32(0xdd796bac), SPH_C32(0xdc359b3a), + SPH_C32(0xdd221a50), SPH_C32(0xf29f81ce), SPH_C32(0xdcd10000), + SPH_C32(0x43610000), SPH_C32(0xfe480000), SPH_C32(0x1b6bf600), + SPH_C32(0x3baf607c), SPH_C32(0x2e8aea12), SPH_C32(0xe551d996), + SPH_C32(0x6c5fff73) }, + { SPH_C32(0x8c3a0000), SPH_C32(0xda980000), SPH_C32(0x607f0000), + SPH_C32(0x54078800), SPH_C32(0x85714513), SPH_C32(0x6006b243), + SPH_C32(0xdb50399c), SPH_C32(0x8a58e6a4), SPH_C32(0x1e6c0000), + SPH_C32(0xc4420000), SPH_C32(0x8a2e0000), SPH_C32(0xbcb6b800), + SPH_C32(0x2c4413b6), SPH_C32(0x8bfdd3da), SPH_C32(0x6a0c1bc8), + SPH_C32(0xb99dc2eb) }, + { SPH_C32(0x6a120000), SPH_C32(0x96d30000), SPH_C32(0xc82a0000), + SPH_C32(0x87d78ae0), SPH_C32(0x5d1075ab), SPH_C32(0xf8a10299), + SPH_C32(0xf3c53f28), SPH_C32(0x5d02ae33), SPH_C32(0xeea90000), + SPH_C32(0x9d610000), SPH_C32(0xcfac0000), SPH_C32(0x5d3bb8c0), + SPH_C32(0x17291587), SPH_C32(0x49108543), SPH_C32(0xa1ece5d4), + SPH_C32(0xef3a7374) }, + { SPH_C32(0x7cff0000), SPH_C32(0x83bb0000), SPH_C32(0x25fd0000), + SPH_C32(0xb58a88c0), SPH_C32(0xbe1c4322), SPH_C32(0xa2ebe4da), + SPH_C32(0x10b0c780), SPH_C32(0xdcff573b), SPH_C32(0x08810000), + SPH_C32(0xd12a0000), SPH_C32(0x67f90000), SPH_C32(0x8eebba20), + SPH_C32(0xcf48253f), SPH_C32(0xd1b73599), SPH_C32(0x8979e360), + SPH_C32(0x38603be3) }, + { SPH_C32(0x9ad70000), SPH_C32(0xcff00000), SPH_C32(0x8da80000), + SPH_C32(0x665a8a20), SPH_C32(0x667d739a), SPH_C32(0x3a4c5400), + SPH_C32(0x3825c134), SPH_C32(0x0ba51fac), SPH_C32(0xf8440000), + SPH_C32(0x88090000), SPH_C32(0x227b0000), SPH_C32(0x6f66bae0), + SPH_C32(0xf425230e), SPH_C32(0x135a6300), SPH_C32(0x42991d7c), + SPH_C32(0x6ec78a7c) }, + { SPH_C32(0x380b0000), SPH_C32(0xadab0000), SPH_C32(0xd1220000), + SPH_C32(0x2bd78ce0), SPH_C32(0xfdd3242b), SPH_C32(0xb110711e), + SPH_C32(0x0906ed15), SPH_C32(0xc437927a), SPH_C32(0xfd6a0000), + SPH_C32(0x79830000), SPH_C32(0x0d3d0000), SPH_C32(0x0344b860), + SPH_C32(0x02fe19ac), SPH_C32(0x0648e48b), SPH_C32(0x19c9b0ce), + SPH_C32(0xe24bd7d2) }, + { SPH_C32(0xde230000), SPH_C32(0xe1e00000), SPH_C32(0x79770000), + SPH_C32(0xf8078e00), SPH_C32(0x25b21493), SPH_C32(0x29b7c1c4), + SPH_C32(0x2193eba1), SPH_C32(0x136ddaed), SPH_C32(0x0daf0000), + SPH_C32(0x20a00000), SPH_C32(0x48bf0000), SPH_C32(0xe2c9b8a0), + SPH_C32(0x39931f9d), SPH_C32(0xc4a5b212), SPH_C32(0xd2294ed2), + SPH_C32(0xb4ec664d) }, + { SPH_C32(0xc8ce0000), SPH_C32(0xf4880000), SPH_C32(0x94a00000), + SPH_C32(0xca5a8c20), SPH_C32(0xc6be221a), SPH_C32(0x73fd2787), + SPH_C32(0xc2e61309), SPH_C32(0x929023e5), SPH_C32(0xeb870000), + SPH_C32(0x6ceb0000), SPH_C32(0xe0ea0000), SPH_C32(0x3119ba40), + SPH_C32(0xe1f22f25), SPH_C32(0x5c0202c8), SPH_C32(0xfabc4866), + SPH_C32(0x63b62eda) }, + { SPH_C32(0x2ee60000), SPH_C32(0xb8c30000), SPH_C32(0x3cf50000), + SPH_C32(0x198a8ec0), SPH_C32(0x1edf12a2), SPH_C32(0xeb5a975d), + SPH_C32(0xea7315bd), SPH_C32(0x45ca6b72), SPH_C32(0x1b420000), + SPH_C32(0x35c80000), SPH_C32(0xa5680000), SPH_C32(0xd094ba80), + SPH_C32(0xda9f2914), SPH_C32(0x9eef5451), SPH_C32(0x315cb67a), + SPH_C32(0x35119f45) }, + { SPH_C32(0x6f3c0000), SPH_C32(0x67590000), SPH_C32(0xe76c0000), + SPH_C32(0xebf58860), SPH_C32(0xabcb4f09), SPH_C32(0xedb38512), + SPH_C32(0xa895929a), SPH_C32(0xd18ef39d), SPH_C32(0x495b0000), + SPH_C32(0x0eb00000), SPH_C32(0xbc600000), SPH_C32(0x7c94bc80), + SPH_C32(0x7a5c7894), SPH_C32(0xd75e27d6), SPH_C32(0xcb9f6447), + SPH_C32(0xac24a30c) }, + { SPH_C32(0x89140000), SPH_C32(0x2b120000), SPH_C32(0x4f390000), + SPH_C32(0x38258a80), SPH_C32(0x73aa7fb1), SPH_C32(0x751435c8), + SPH_C32(0x8000942e), SPH_C32(0x06d4bb0a), SPH_C32(0xb99e0000), + SPH_C32(0x57930000), SPH_C32(0xf9e20000), SPH_C32(0x9d19bc40), + SPH_C32(0x41317ea5), SPH_C32(0x15b3714f), SPH_C32(0x007f9a5b), + SPH_C32(0xfa831293) }, + { SPH_C32(0x9ff90000), SPH_C32(0x3e7a0000), SPH_C32(0xa2ee0000), + SPH_C32(0x0a7888a0), SPH_C32(0x90a64938), SPH_C32(0x2f5ed38b), + SPH_C32(0x63756c86), SPH_C32(0x87294202), SPH_C32(0x5fb60000), + SPH_C32(0x1bd80000), SPH_C32(0x51b70000), SPH_C32(0x4ec9bea0), + SPH_C32(0x99504e1d), SPH_C32(0x8d14c195), SPH_C32(0x28ea9cef), + SPH_C32(0x2dd95a04) }, + { SPH_C32(0x79d10000), SPH_C32(0x72310000), SPH_C32(0x0abb0000), + SPH_C32(0xd9a88a40), SPH_C32(0x48c77980), SPH_C32(0xb7f96351), + SPH_C32(0x4be06a32), SPH_C32(0x50730a95), SPH_C32(0xaf730000), + SPH_C32(0x42fb0000), SPH_C32(0x14350000), SPH_C32(0xaf44be60), + SPH_C32(0xa23d482c), SPH_C32(0x4ff9970c), SPH_C32(0xe30a62f3), + SPH_C32(0x7b7eeb9b) }, + { SPH_C32(0xdb0d0000), SPH_C32(0x106a0000), SPH_C32(0x56310000), + SPH_C32(0x94258c80), SPH_C32(0xd3692e31), SPH_C32(0x3ca5464f), + SPH_C32(0x7ac34613), SPH_C32(0x9fe18743), SPH_C32(0xaa5d0000), + SPH_C32(0xb3710000), SPH_C32(0x3b730000), SPH_C32(0xc366bce0), + SPH_C32(0x54e6728e), SPH_C32(0x5aeb1087), SPH_C32(0xb85acf41), + SPH_C32(0xf7f2b635) }, + { SPH_C32(0x3d250000), SPH_C32(0x5c210000), SPH_C32(0xfe640000), + SPH_C32(0x47f58e60), SPH_C32(0x0b081e89), SPH_C32(0xa402f695), + SPH_C32(0x525640a7), SPH_C32(0x48bbcfd4), SPH_C32(0x5a980000), + SPH_C32(0xea520000), SPH_C32(0x7ef10000), SPH_C32(0x22ebbc20), + SPH_C32(0x6f8b74bf), SPH_C32(0x9806461e), SPH_C32(0x73ba315d), + SPH_C32(0xa15507aa) }, + { SPH_C32(0x2bc80000), SPH_C32(0x49490000), SPH_C32(0x13b30000), + SPH_C32(0x75a88c40), SPH_C32(0xe8042800), SPH_C32(0xfe4810d6), + SPH_C32(0xb123b80f), SPH_C32(0xc94636dc), SPH_C32(0xbcb00000), + SPH_C32(0xa6190000), SPH_C32(0xd6a40000), SPH_C32(0xf13bbec0), + SPH_C32(0xb7ea4407), SPH_C32(0x00a1f6c4), SPH_C32(0x5b2f37e9), + SPH_C32(0x760f4f3d) }, + { SPH_C32(0xcde00000), SPH_C32(0x05020000), SPH_C32(0xbbe60000), + SPH_C32(0xa6788ea0), SPH_C32(0x306518b8), SPH_C32(0x66efa00c), + SPH_C32(0x99b6bebb), SPH_C32(0x1e1c7e4b), SPH_C32(0x4c750000), + SPH_C32(0xff3a0000), SPH_C32(0x93260000), SPH_C32(0x10b6be00), + SPH_C32(0x8c874236), SPH_C32(0xc24ca05d), SPH_C32(0x90cfc9f5), + SPH_C32(0x20a8fea2) }, + { SPH_C32(0x8ec80000), SPH_C32(0x78190000), SPH_C32(0xe7400000), + SPH_C32(0xb76bf000), SPH_C32(0x9b6c31fc), SPH_C32(0x673b9995), + SPH_C32(0x1f920bab), SPH_C32(0xf56ac33a), SPH_C32(0xa4b10000), + SPH_C32(0xd7ef0000), SPH_C32(0x3dc90000), SPH_C32(0x4b9e9000), + SPH_C32(0xf30107fb), SPH_C32(0xbde710e0), SPH_C32(0x805696dc), + SPH_C32(0x93b1da1b) }, + { SPH_C32(0x68e00000), SPH_C32(0x34520000), SPH_C32(0x4f150000), + SPH_C32(0x64bbf2e0), SPH_C32(0x430d0144), SPH_C32(0xff9c294f), + SPH_C32(0x37070d1f), SPH_C32(0x22308bad), SPH_C32(0x54740000), + SPH_C32(0x8ecc0000), SPH_C32(0x784b0000), SPH_C32(0xaa1390c0), + SPH_C32(0xc86c01ca), SPH_C32(0x7f0a4679), SPH_C32(0x4bb668c0), + SPH_C32(0xc5166b84) }, + { SPH_C32(0x7e0d0000), SPH_C32(0x213a0000), SPH_C32(0xa2c20000), + SPH_C32(0x56e6f0c0), SPH_C32(0xa00137cd), SPH_C32(0xa5d6cf0c), + SPH_C32(0xd472f5b7), SPH_C32(0xa3cd72a5), SPH_C32(0xb25c0000), + SPH_C32(0xc2870000), SPH_C32(0xd01e0000), SPH_C32(0x79c39220), + SPH_C32(0x100d3172), SPH_C32(0xe7adf6a3), SPH_C32(0x63236e74), + SPH_C32(0x124c2313) }, + { SPH_C32(0x98250000), SPH_C32(0x6d710000), SPH_C32(0x0a970000), + SPH_C32(0x8536f220), SPH_C32(0x78600775), SPH_C32(0x3d717fd6), + SPH_C32(0xfce7f303), SPH_C32(0x74973a32), SPH_C32(0x42990000), + SPH_C32(0x9ba40000), SPH_C32(0x959c0000), SPH_C32(0x984e92e0), + SPH_C32(0x2b603743), SPH_C32(0x2540a03a), SPH_C32(0xa8c39068), + SPH_C32(0x44eb928c) }, + { SPH_C32(0x3af90000), SPH_C32(0x0f2a0000), SPH_C32(0x561d0000), + SPH_C32(0xc8bbf4e0), SPH_C32(0xe3ce50c4), SPH_C32(0xb62d5ac8), + SPH_C32(0xcdc4df22), SPH_C32(0xbb05b7e4), SPH_C32(0x47b70000), + SPH_C32(0x6a2e0000), SPH_C32(0xbada0000), SPH_C32(0xf46c9060), + SPH_C32(0xddbb0de1), SPH_C32(0x305227b1), SPH_C32(0xf3933dda), + SPH_C32(0xc867cf22) }, + { SPH_C32(0xdcd10000), SPH_C32(0x43610000), SPH_C32(0xfe480000), + SPH_C32(0x1b6bf600), SPH_C32(0x3baf607c), SPH_C32(0x2e8aea12), + SPH_C32(0xe551d996), SPH_C32(0x6c5fff73), SPH_C32(0xb7720000), + SPH_C32(0x330d0000), SPH_C32(0xff580000), SPH_C32(0x15e190a0), + SPH_C32(0xe6d60bd0), SPH_C32(0xf2bf7128), SPH_C32(0x3873c3c6), + SPH_C32(0x9ec07ebd) }, + { SPH_C32(0xca3c0000), SPH_C32(0x56090000), SPH_C32(0x139f0000), + SPH_C32(0x2936f420), SPH_C32(0xd8a356f5), SPH_C32(0x74c00c51), + SPH_C32(0x0624213e), SPH_C32(0xeda2067b), SPH_C32(0x515a0000), + SPH_C32(0x7f460000), SPH_C32(0x570d0000), SPH_C32(0xc6319240), + SPH_C32(0x3eb73b68), SPH_C32(0x6a18c1f2), SPH_C32(0x10e6c572), + SPH_C32(0x499a362a) }, + { SPH_C32(0x2c140000), SPH_C32(0x1a420000), SPH_C32(0xbbca0000), + SPH_C32(0xfae6f6c0), SPH_C32(0x00c2664d), SPH_C32(0xec67bc8b), + SPH_C32(0x2eb1278a), SPH_C32(0x3af84eec), SPH_C32(0xa19f0000), + SPH_C32(0x26650000), SPH_C32(0x128f0000), SPH_C32(0x27bc9280), + SPH_C32(0x05da3d59), SPH_C32(0xa8f5976b), SPH_C32(0xdb063b6e), + SPH_C32(0x1f3d87b5) }, + { SPH_C32(0x6dce0000), SPH_C32(0xc5d80000), SPH_C32(0x60530000), + SPH_C32(0x0899f060), SPH_C32(0xb5d63be6), SPH_C32(0xea8eaec4), + SPH_C32(0x6c57a0ad), SPH_C32(0xaebcd603), SPH_C32(0xf3860000), + SPH_C32(0x1d1d0000), SPH_C32(0x0b870000), SPH_C32(0x8bbc9480), + SPH_C32(0xa5196cd9), SPH_C32(0xe144e4ec), SPH_C32(0x21c5e953), + SPH_C32(0x8608bbfc) }, + { SPH_C32(0x8be60000), SPH_C32(0x89930000), SPH_C32(0xc8060000), + SPH_C32(0xdb49f280), SPH_C32(0x6db70b5e), SPH_C32(0x72291e1e), + SPH_C32(0x44c2a619), SPH_C32(0x79e69e94), SPH_C32(0x03430000), + SPH_C32(0x443e0000), SPH_C32(0x4e050000), SPH_C32(0x6a319440), + SPH_C32(0x9e746ae8), SPH_C32(0x23a9b275), SPH_C32(0xea25174f), + SPH_C32(0xd0af0a63) }, + { SPH_C32(0x9d0b0000), SPH_C32(0x9cfb0000), SPH_C32(0x25d10000), + SPH_C32(0xe914f0a0), SPH_C32(0x8ebb3dd7), SPH_C32(0x2863f85d), + SPH_C32(0xa7b75eb1), SPH_C32(0xf81b679c), SPH_C32(0xe56b0000), + SPH_C32(0x08750000), SPH_C32(0xe6500000), SPH_C32(0xb9e196a0), + SPH_C32(0x46155a50), SPH_C32(0xbb0e02af), SPH_C32(0xc2b011fb), + SPH_C32(0x07f542f4) }, + { SPH_C32(0x7b230000), SPH_C32(0xd0b00000), SPH_C32(0x8d840000), + SPH_C32(0x3ac4f240), SPH_C32(0x56da0d6f), SPH_C32(0xb0c44887), + SPH_C32(0x8f225805), SPH_C32(0x2f412f0b), SPH_C32(0x15ae0000), + SPH_C32(0x51560000), SPH_C32(0xa3d20000), SPH_C32(0x586c9660), + SPH_C32(0x7d785c61), SPH_C32(0x79e35436), SPH_C32(0x0950efe7), + SPH_C32(0x5152f36b) }, + { SPH_C32(0xd9ff0000), SPH_C32(0xb2eb0000), SPH_C32(0xd10e0000), + SPH_C32(0x7749f480), SPH_C32(0xcd745ade), SPH_C32(0x3b986d99), + SPH_C32(0xbe017424), SPH_C32(0xe0d3a2dd), SPH_C32(0x10800000), + SPH_C32(0xa0dc0000), SPH_C32(0x8c940000), SPH_C32(0x344e94e0), + SPH_C32(0x8ba366c3), SPH_C32(0x6cf1d3bd), SPH_C32(0x52004255), + SPH_C32(0xdddeaec5) }, + { SPH_C32(0x3fd70000), SPH_C32(0xfea00000), SPH_C32(0x795b0000), + SPH_C32(0xa499f660), SPH_C32(0x15156a66), SPH_C32(0xa33fdd43), + SPH_C32(0x96947290), SPH_C32(0x3789ea4a), SPH_C32(0xe0450000), + SPH_C32(0xf9ff0000), SPH_C32(0xc9160000), SPH_C32(0xd5c39420), + SPH_C32(0xb0ce60f2), SPH_C32(0xae1c8524), SPH_C32(0x99e0bc49), + SPH_C32(0x8b791f5a) }, + { SPH_C32(0x293a0000), SPH_C32(0xebc80000), SPH_C32(0x948c0000), + SPH_C32(0x96c4f440), SPH_C32(0xf6195cef), SPH_C32(0xf9753b00), + SPH_C32(0x75e18a38), SPH_C32(0xb6741342), SPH_C32(0x066d0000), + SPH_C32(0xb5b40000), SPH_C32(0x61430000), SPH_C32(0x061396c0), + SPH_C32(0x68af504a), SPH_C32(0x36bb35fe), SPH_C32(0xb175bafd), + SPH_C32(0x5c2357cd) }, + { SPH_C32(0xcf120000), SPH_C32(0xa7830000), SPH_C32(0x3cd90000), + SPH_C32(0x4514f6a0), SPH_C32(0x2e786c57), SPH_C32(0x61d28bda), + SPH_C32(0x5d748c8c), SPH_C32(0x612e5bd5), SPH_C32(0xf6a80000), + SPH_C32(0xec970000), SPH_C32(0x24c10000), SPH_C32(0xe79e9600), + SPH_C32(0x53c2567b), SPH_C32(0xf4566367), SPH_C32(0x7a9544e1), + SPH_C32(0x0a84e652) }, + { SPH_C32(0x36e70000), SPH_C32(0xc9350000), SPH_C32(0xd7980000), + SPH_C32(0xa32fa000), SPH_C32(0x5a34515e), SPH_C32(0x561c7179), + SPH_C32(0x310ab488), SPH_C32(0xa074fe54), SPH_C32(0xa6430000), + SPH_C32(0x756e0000), SPH_C32(0xbaf60000), SPH_C32(0xa8f2e800), + SPH_C32(0xed1c7314), SPH_C32(0xbada3b36), SPH_C32(0x4494a4eb), + SPH_C32(0xec83ff85) }, + { SPH_C32(0xd0cf0000), SPH_C32(0x857e0000), SPH_C32(0x7fcd0000), + SPH_C32(0x70ffa2e0), SPH_C32(0x825561e6), SPH_C32(0xcebbc1a3), + SPH_C32(0x199fb23c), SPH_C32(0x772eb6c3), SPH_C32(0x56860000), + SPH_C32(0x2c4d0000), SPH_C32(0xff740000), SPH_C32(0x497fe8c0), + SPH_C32(0xd6717525), SPH_C32(0x78376daf), SPH_C32(0x8f745af7), + SPH_C32(0xba244e1a) }, + { SPH_C32(0xc6220000), SPH_C32(0x90160000), SPH_C32(0x921a0000), + SPH_C32(0x42a2a0c0), SPH_C32(0x6159576f), SPH_C32(0x94f127e0), + SPH_C32(0xfaea4a94), SPH_C32(0xf6d34fcb), SPH_C32(0xb0ae0000), + SPH_C32(0x60060000), SPH_C32(0x57210000), SPH_C32(0x9aafea20), + SPH_C32(0x0e10459d), SPH_C32(0xe090dd75), SPH_C32(0xa7e15c43), + SPH_C32(0x6d7e068d) }, + { SPH_C32(0x200a0000), SPH_C32(0xdc5d0000), SPH_C32(0x3a4f0000), + SPH_C32(0x9172a220), SPH_C32(0xb93867d7), SPH_C32(0x0c56973a), + SPH_C32(0xd27f4c20), SPH_C32(0x2189075c), SPH_C32(0x406b0000), + SPH_C32(0x39250000), SPH_C32(0x12a30000), SPH_C32(0x7b22eae0), + SPH_C32(0x357d43ac), SPH_C32(0x227d8bec), SPH_C32(0x6c01a25f), + SPH_C32(0x3bd9b712) }, + { SPH_C32(0x82d60000), SPH_C32(0xbe060000), SPH_C32(0x66c50000), + SPH_C32(0xdcffa4e0), SPH_C32(0x22963066), SPH_C32(0x870ab224), + SPH_C32(0xe35c6001), SPH_C32(0xee1b8a8a), SPH_C32(0x45450000), + SPH_C32(0xc8af0000), SPH_C32(0x3de50000), SPH_C32(0x1700e860), + SPH_C32(0xc3a6790e), SPH_C32(0x376f0c67), SPH_C32(0x37510fed), + SPH_C32(0xb755eabc) }, + { SPH_C32(0x64fe0000), SPH_C32(0xf24d0000), SPH_C32(0xce900000), + SPH_C32(0x0f2fa600), SPH_C32(0xfaf700de), SPH_C32(0x1fad02fe), + SPH_C32(0xcbc966b5), SPH_C32(0x3941c21d), SPH_C32(0xb5800000), + SPH_C32(0x918c0000), SPH_C32(0x78670000), SPH_C32(0xf68de8a0), + SPH_C32(0xf8cb7f3f), SPH_C32(0xf5825afe), SPH_C32(0xfcb1f1f1), + SPH_C32(0xe1f25b23) }, + { SPH_C32(0x72130000), SPH_C32(0xe7250000), SPH_C32(0x23470000), + SPH_C32(0x3d72a420), SPH_C32(0x19fb3657), SPH_C32(0x45e7e4bd), + SPH_C32(0x28bc9e1d), SPH_C32(0xb8bc3b15), SPH_C32(0x53a80000), + SPH_C32(0xddc70000), SPH_C32(0xd0320000), SPH_C32(0x255dea40), + SPH_C32(0x20aa4f87), SPH_C32(0x6d25ea24), SPH_C32(0xd424f745), + SPH_C32(0x36a813b4) }, + { SPH_C32(0x943b0000), SPH_C32(0xab6e0000), SPH_C32(0x8b120000), + SPH_C32(0xeea2a6c0), SPH_C32(0xc19a06ef), SPH_C32(0xdd405467), + SPH_C32(0x002998a9), SPH_C32(0x6fe67382), SPH_C32(0xa36d0000), + SPH_C32(0x84e40000), SPH_C32(0x95b00000), SPH_C32(0xc4d0ea80), + SPH_C32(0x1bc749b6), SPH_C32(0xafc8bcbd), SPH_C32(0x1fc40959), + SPH_C32(0x600fa22b) }, + { SPH_C32(0xd5e10000), SPH_C32(0x74f40000), SPH_C32(0x508b0000), + SPH_C32(0x1cdda060), SPH_C32(0x748e5b44), SPH_C32(0xdba94628), + SPH_C32(0x42cf1f8e), SPH_C32(0xfba2eb6d), SPH_C32(0xf1740000), + SPH_C32(0xbf9c0000), SPH_C32(0x8cb80000), SPH_C32(0x68d0ec80), + SPH_C32(0xbb041836), SPH_C32(0xe679cf3a), SPH_C32(0xe507db64), + SPH_C32(0xf93a9e62) }, + { SPH_C32(0x33c90000), SPH_C32(0x38bf0000), SPH_C32(0xf8de0000), + SPH_C32(0xcf0da280), SPH_C32(0xacef6bfc), SPH_C32(0x430ef6f2), + SPH_C32(0x6a5a193a), SPH_C32(0x2cf8a3fa), SPH_C32(0x01b10000), + SPH_C32(0xe6bf0000), SPH_C32(0xc93a0000), SPH_C32(0x895dec40), + SPH_C32(0x80691e07), SPH_C32(0x249499a3), SPH_C32(0x2ee72578), + SPH_C32(0xaf9d2ffd) }, + { SPH_C32(0x25240000), SPH_C32(0x2dd70000), SPH_C32(0x15090000), + SPH_C32(0xfd50a0a0), SPH_C32(0x4fe35d75), SPH_C32(0x194410b1), + SPH_C32(0x892fe192), SPH_C32(0xad055af2), SPH_C32(0xe7990000), + SPH_C32(0xaaf40000), SPH_C32(0x616f0000), SPH_C32(0x5a8deea0), + SPH_C32(0x58082ebf), SPH_C32(0xbc332979), SPH_C32(0x067223cc), + SPH_C32(0x78c7676a) }, + { SPH_C32(0xc30c0000), SPH_C32(0x619c0000), SPH_C32(0xbd5c0000), + SPH_C32(0x2e80a240), SPH_C32(0x97826dcd), SPH_C32(0x81e3a06b), + SPH_C32(0xa1bae726), SPH_C32(0x7a5f1265), SPH_C32(0x175c0000), + SPH_C32(0xf3d70000), SPH_C32(0x24ed0000), SPH_C32(0xbb00ee60), + SPH_C32(0x6365288e), SPH_C32(0x7ede7fe0), SPH_C32(0xcd92ddd0), + SPH_C32(0x2e60d6f5) }, + { SPH_C32(0x61d00000), SPH_C32(0x03c70000), SPH_C32(0xe1d60000), + SPH_C32(0x630da480), SPH_C32(0x0c2c3a7c), SPH_C32(0x0abf8575), + SPH_C32(0x9099cb07), SPH_C32(0xb5cd9fb3), SPH_C32(0x12720000), + SPH_C32(0x025d0000), SPH_C32(0x0bab0000), SPH_C32(0xd722ece0), + SPH_C32(0x95be122c), SPH_C32(0x6bccf86b), SPH_C32(0x96c27062), + SPH_C32(0xa2ec8b5b) }, + { SPH_C32(0x87f80000), SPH_C32(0x4f8c0000), SPH_C32(0x49830000), + SPH_C32(0xb0dda660), SPH_C32(0xd44d0ac4), SPH_C32(0x921835af), + SPH_C32(0xb80ccdb3), SPH_C32(0x6297d724), SPH_C32(0xe2b70000), + SPH_C32(0x5b7e0000), SPH_C32(0x4e290000), SPH_C32(0x36afec20), + SPH_C32(0xaed3141d), SPH_C32(0xa921aef2), SPH_C32(0x5d228e7e), + SPH_C32(0xf44b3ac4) }, + { SPH_C32(0x91150000), SPH_C32(0x5ae40000), SPH_C32(0xa4540000), + SPH_C32(0x8280a440), SPH_C32(0x37413c4d), SPH_C32(0xc852d3ec), + SPH_C32(0x5b79351b), SPH_C32(0xe36a2e2c), SPH_C32(0x049f0000), + SPH_C32(0x17350000), SPH_C32(0xe67c0000), SPH_C32(0xe57feec0), + SPH_C32(0x76b224a5), SPH_C32(0x31861e28), SPH_C32(0x75b788ca), + SPH_C32(0x23117253) }, + { SPH_C32(0x773d0000), SPH_C32(0x16af0000), SPH_C32(0x0c010000), + SPH_C32(0x5150a6a0), SPH_C32(0xef200cf5), SPH_C32(0x50f56336), + SPH_C32(0x73ec33af), SPH_C32(0x343066bb), SPH_C32(0xf45a0000), + SPH_C32(0x4e160000), SPH_C32(0xa3fe0000), SPH_C32(0x04f2ee00), + SPH_C32(0x4ddf2294), SPH_C32(0xf36b48b1), SPH_C32(0xbe5776d6), + SPH_C32(0x75b6c3cc) }, + { SPH_C32(0x34150000), SPH_C32(0x6bb40000), SPH_C32(0x50a70000), + SPH_C32(0x4043d800), SPH_C32(0x442925b1), SPH_C32(0x51215aaf), + SPH_C32(0xf5c886bf), SPH_C32(0xdf46dbca), SPH_C32(0x1c9e0000), + SPH_C32(0x66c30000), SPH_C32(0x0d110000), SPH_C32(0x5fdac000), + SPH_C32(0x32596759), SPH_C32(0x8cc0f80c), SPH_C32(0xaece29ff), + SPH_C32(0xc6afe775) }, + { SPH_C32(0xd23d0000), SPH_C32(0x27ff0000), SPH_C32(0xf8f20000), + SPH_C32(0x9393dae0), SPH_C32(0x9c481509), SPH_C32(0xc986ea75), + SPH_C32(0xdd5d800b), SPH_C32(0x081c935d), SPH_C32(0xec5b0000), + SPH_C32(0x3fe00000), SPH_C32(0x48930000), SPH_C32(0xbe57c0c0), + SPH_C32(0x09346168), SPH_C32(0x4e2dae95), SPH_C32(0x652ed7e3), + SPH_C32(0x900856ea) }, + { SPH_C32(0xc4d00000), SPH_C32(0x32970000), SPH_C32(0x15250000), + SPH_C32(0xa1ced8c0), SPH_C32(0x7f442380), SPH_C32(0x93cc0c36), + SPH_C32(0x3e2878a3), SPH_C32(0x89e16a55), SPH_C32(0x0a730000), + SPH_C32(0x73ab0000), SPH_C32(0xe0c60000), SPH_C32(0x6d87c220), + SPH_C32(0xd15551d0), SPH_C32(0xd68a1e4f), SPH_C32(0x4dbbd157), + SPH_C32(0x47521e7d) }, + { SPH_C32(0x22f80000), SPH_C32(0x7edc0000), SPH_C32(0xbd700000), + SPH_C32(0x721eda20), SPH_C32(0xa7251338), SPH_C32(0x0b6bbcec), + SPH_C32(0x16bd7e17), SPH_C32(0x5ebb22c2), SPH_C32(0xfab60000), + SPH_C32(0x2a880000), SPH_C32(0xa5440000), SPH_C32(0x8c0ac2e0), + SPH_C32(0xea3857e1), SPH_C32(0x146748d6), SPH_C32(0x865b2f4b), + SPH_C32(0x11f5afe2) }, + { SPH_C32(0x80240000), SPH_C32(0x1c870000), SPH_C32(0xe1fa0000), + SPH_C32(0x3f93dce0), SPH_C32(0x3c8b4489), SPH_C32(0x803799f2), + SPH_C32(0x279e5236), SPH_C32(0x9129af14), SPH_C32(0xff980000), + SPH_C32(0xdb020000), SPH_C32(0x8a020000), SPH_C32(0xe028c060), + SPH_C32(0x1ce36d43), SPH_C32(0x0175cf5d), SPH_C32(0xdd0b82f9), + SPH_C32(0x9d79f24c) }, + { SPH_C32(0x660c0000), SPH_C32(0x50cc0000), SPH_C32(0x49af0000), + SPH_C32(0xec43de00), SPH_C32(0xe4ea7431), SPH_C32(0x18902928), + SPH_C32(0x0f0b5482), SPH_C32(0x4673e783), SPH_C32(0x0f5d0000), + SPH_C32(0x82210000), SPH_C32(0xcf800000), SPH_C32(0x01a5c0a0), + SPH_C32(0x278e6b72), SPH_C32(0xc39899c4), SPH_C32(0x16eb7ce5), + SPH_C32(0xcbde43d3) }, + { SPH_C32(0x70e10000), SPH_C32(0x45a40000), SPH_C32(0xa4780000), + SPH_C32(0xde1edc20), SPH_C32(0x07e642b8), SPH_C32(0x42dacf6b), + SPH_C32(0xec7eac2a), SPH_C32(0xc78e1e8b), SPH_C32(0xe9750000), + SPH_C32(0xce6a0000), SPH_C32(0x67d50000), SPH_C32(0xd275c240), + SPH_C32(0xffef5bca), SPH_C32(0x5b3f291e), SPH_C32(0x3e7e7a51), + SPH_C32(0x1c840b44) }, + { SPH_C32(0x96c90000), SPH_C32(0x09ef0000), SPH_C32(0x0c2d0000), + SPH_C32(0x0dcedec0), SPH_C32(0xdf877200), SPH_C32(0xda7d7fb1), + SPH_C32(0xc4ebaa9e), SPH_C32(0x10d4561c), SPH_C32(0x19b00000), + SPH_C32(0x97490000), SPH_C32(0x22570000), SPH_C32(0x33f8c280), + SPH_C32(0xc4825dfb), SPH_C32(0x99d27f87), SPH_C32(0xf59e844d), + SPH_C32(0x4a23badb) }, + { SPH_C32(0xd7130000), SPH_C32(0xd6750000), SPH_C32(0xd7b40000), + SPH_C32(0xffb1d860), SPH_C32(0x6a932fab), SPH_C32(0xdc946dfe), + SPH_C32(0x860d2db9), SPH_C32(0x8490cef3), SPH_C32(0x4ba90000), + SPH_C32(0xac310000), SPH_C32(0x3b5f0000), SPH_C32(0x9ff8c480), + SPH_C32(0x64410c7b), SPH_C32(0xd0630c00), SPH_C32(0x0f5d5670), + SPH_C32(0xd3168692) }, + { SPH_C32(0x313b0000), SPH_C32(0x9a3e0000), SPH_C32(0x7fe10000), + SPH_C32(0x2c61da80), SPH_C32(0xb2f21f13), SPH_C32(0x4433dd24), + SPH_C32(0xae982b0d), SPH_C32(0x53ca8664), SPH_C32(0xbb6c0000), + SPH_C32(0xf5120000), SPH_C32(0x7edd0000), SPH_C32(0x7e75c440), + SPH_C32(0x5f2c0a4a), SPH_C32(0x128e5a99), SPH_C32(0xc4bda86c), + SPH_C32(0x85b1370d) }, + { SPH_C32(0x27d60000), SPH_C32(0x8f560000), SPH_C32(0x92360000), + SPH_C32(0x1e3cd8a0), SPH_C32(0x51fe299a), SPH_C32(0x1e793b67), + SPH_C32(0x4dedd3a5), SPH_C32(0xd2377f6c), SPH_C32(0x5d440000), + SPH_C32(0xb9590000), SPH_C32(0xd6880000), SPH_C32(0xada5c6a0), + SPH_C32(0x874d3af2), SPH_C32(0x8a29ea43), SPH_C32(0xec28aed8), + SPH_C32(0x52eb7f9a) }, + { SPH_C32(0xc1fe0000), SPH_C32(0xc31d0000), SPH_C32(0x3a630000), + SPH_C32(0xcdecda40), SPH_C32(0x899f1922), SPH_C32(0x86de8bbd), + SPH_C32(0x6578d511), SPH_C32(0x056d37fb), SPH_C32(0xad810000), + SPH_C32(0xe07a0000), SPH_C32(0x930a0000), SPH_C32(0x4c28c660), + SPH_C32(0xbc203cc3), SPH_C32(0x48c4bcda), SPH_C32(0x27c850c4), + SPH_C32(0x044cce05) }, + { SPH_C32(0x63220000), SPH_C32(0xa1460000), SPH_C32(0x66e90000), + SPH_C32(0x8061dc80), SPH_C32(0x12314e93), SPH_C32(0x0d82aea3), + SPH_C32(0x545bf930), SPH_C32(0xcaffba2d), SPH_C32(0xa8af0000), + SPH_C32(0x11f00000), SPH_C32(0xbc4c0000), SPH_C32(0x200ac4e0), + SPH_C32(0x4afb0661), SPH_C32(0x5dd63b51), SPH_C32(0x7c98fd76), + SPH_C32(0x88c093ab) }, + { SPH_C32(0x850a0000), SPH_C32(0xed0d0000), SPH_C32(0xcebc0000), + SPH_C32(0x53b1de60), SPH_C32(0xca507e2b), SPH_C32(0x95251e79), + SPH_C32(0x7cceff84), SPH_C32(0x1da5f2ba), SPH_C32(0x586a0000), + SPH_C32(0x48d30000), SPH_C32(0xf9ce0000), SPH_C32(0xc187c420), + SPH_C32(0x71960050), SPH_C32(0x9f3b6dc8), SPH_C32(0xb778036a), + SPH_C32(0xde672234) }, + { SPH_C32(0x93e70000), SPH_C32(0xf8650000), SPH_C32(0x236b0000), + SPH_C32(0x61ecdc40), SPH_C32(0x295c48a2), SPH_C32(0xcf6ff83a), + SPH_C32(0x9fbb072c), SPH_C32(0x9c580bb2), SPH_C32(0xbe420000), + SPH_C32(0x04980000), SPH_C32(0x519b0000), SPH_C32(0x1257c6c0), + SPH_C32(0xa9f730e8), SPH_C32(0x079cdd12), SPH_C32(0x9fed05de), + SPH_C32(0x093d6aa3) }, + { SPH_C32(0x75cf0000), SPH_C32(0xb42e0000), SPH_C32(0x8b3e0000), + SPH_C32(0xb23cdea0), SPH_C32(0xf13d781a), SPH_C32(0x57c848e0), + SPH_C32(0xb72e0198), SPH_C32(0x4b024325), SPH_C32(0x4e870000), + SPH_C32(0x5dbb0000), SPH_C32(0x14190000), SPH_C32(0xf3dac600), + SPH_C32(0x929a36d9), SPH_C32(0xc5718b8b), SPH_C32(0x540dfbc2), + SPH_C32(0x5f9adb3c) } +}; + +static const sph_u32 T512_56[256][16] = { + { SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000), SPH_C32(0x00000000), SPH_C32(0x00000000), + SPH_C32(0x00000000) }, + { SPH_C32(0x033d0000), SPH_C32(0x08b30000), SPH_C32(0xf33a0000), + SPH_C32(0x3ac20007), SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), + SPH_C32(0x0ea5cfe3), SPH_C32(0xe6da7ffe), SPH_C32(0xa8da0000), + SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), SPH_C32(0x07da0002), + SPH_C32(0x7d669583), SPH_C32(0x1f98708a), SPH_C32(0xbb668808), + SPH_C32(0xda878000) }, + { SPH_C32(0xa8da0000), SPH_C32(0x96be0000), SPH_C32(0x5c1d0000), + SPH_C32(0x07da0002), SPH_C32(0x7d669583), SPH_C32(0x1f98708a), + SPH_C32(0xbb668808), SPH_C32(0xda878000), SPH_C32(0xabe70000), + SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), SPH_C32(0x3d180005), + SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), SPH_C32(0xb5c347eb), + SPH_C32(0x3c5dfffe) }, + { SPH_C32(0xabe70000), SPH_C32(0x9e0d0000), SPH_C32(0xaf270000), + SPH_C32(0x3d180005), SPH_C32(0x2c4f1fd3), SPH_C32(0x74f61695), + SPH_C32(0xb5c347eb), SPH_C32(0x3c5dfffe), SPH_C32(0x033d0000), + SPH_C32(0x08b30000), SPH_C32(0xf33a0000), SPH_C32(0x3ac20007), + SPH_C32(0x51298a50), SPH_C32(0x6b6e661f), SPH_C32(0x0ea5cfe3), + SPH_C32(0xe6da7ffe) }, + { SPH_C32(0x01930000), SPH_C32(0xe7820000), SPH_C32(0xedfb0000), + SPH_C32(0xcf0c000b), SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), + SPH_C32(0x063661e1), SPH_C32(0x536f9e7b), SPH_C32(0x92280000), + SPH_C32(0xdc850000), SPH_C32(0x57fa0000), SPH_C32(0x56dc0003), + SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), SPH_C32(0x90cef752), + SPH_C32(0x7b1675d7) }, + { SPH_C32(0x02ae0000), SPH_C32(0xef310000), SPH_C32(0x1ec10000), + SPH_C32(0xf5ce000c), SPH_C32(0xdcf90708), SPH_C32(0xd7cdd231), + SPH_C32(0x0893ae02), SPH_C32(0xb5b5e185), SPH_C32(0x3af20000), + SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), SPH_C32(0x51060001), + SPH_C32(0xc78fb695), SPH_C32(0x4577d386), SPH_C32(0x2ba87f5a), + SPH_C32(0xa191f5d7) }, + { SPH_C32(0xa9490000), SPH_C32(0x713c0000), SPH_C32(0xb1e60000), + SPH_C32(0xc8d60009), SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), + SPH_C32(0xbd50e9e9), SPH_C32(0x89e81e7b), SPH_C32(0x39cf0000), + SPH_C32(0x42880000), SPH_C32(0xf8dd0000), SPH_C32(0x6bc40006), + SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), SPH_C32(0x250db0b9), + SPH_C32(0x474b8a29) }, + { SPH_C32(0xaa740000), SPH_C32(0x798f0000), SPH_C32(0x42dc0000), + SPH_C32(0xf214000e), SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), + SPH_C32(0xb3f5260a), SPH_C32(0x6f326185), SPH_C32(0x91150000), + SPH_C32(0xd4360000), SPH_C32(0xa4c00000), SPH_C32(0x6c1e0004), + SPH_C32(0xebc0a946), SPH_C32(0x3181c513), SPH_C32(0x9e6b38b1), + SPH_C32(0x9dcc0a29) }, + { SPH_C32(0x92280000), SPH_C32(0xdc850000), SPH_C32(0x57fa0000), + SPH_C32(0x56dc0003), SPH_C32(0xbae92316), SPH_C32(0x5aefa30c), + SPH_C32(0x90cef752), SPH_C32(0x7b1675d7), SPH_C32(0x93bb0000), + SPH_C32(0x3b070000), SPH_C32(0xba010000), SPH_C32(0x99d00008), + SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), SPH_C32(0x96f896b3), + SPH_C32(0x2879ebac) }, + { SPH_C32(0x91150000), SPH_C32(0xd4360000), SPH_C32(0xa4c00000), + SPH_C32(0x6c1e0004), SPH_C32(0xebc0a946), SPH_C32(0x3181c513), + SPH_C32(0x9e6b38b1), SPH_C32(0x9dcc0a29), SPH_C32(0x3b610000), + SPH_C32(0xadb90000), SPH_C32(0xe61c0000), SPH_C32(0x9e0a000a), + SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), SPH_C32(0x2d9e1ebb), + SPH_C32(0xf2fe6bac) }, + { SPH_C32(0x3af20000), SPH_C32(0x4a3b0000), SPH_C32(0x0be70000), + SPH_C32(0x51060001), SPH_C32(0xc78fb695), SPH_C32(0x4577d386), + SPH_C32(0x2ba87f5a), SPH_C32(0xa191f5d7), SPH_C32(0x385c0000), + SPH_C32(0xa50a0000), SPH_C32(0x15260000), SPH_C32(0xa4c8000d), + SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), SPH_C32(0x233bd158), + SPH_C32(0x14241452) }, + { SPH_C32(0x39cf0000), SPH_C32(0x42880000), SPH_C32(0xf8dd0000), + SPH_C32(0x6bc40006), SPH_C32(0x96a63cc5), SPH_C32(0x2e19b599), + SPH_C32(0x250db0b9), SPH_C32(0x474b8a29), SPH_C32(0x90860000), + SPH_C32(0x33b40000), SPH_C32(0x493b0000), SPH_C32(0xa312000f), + SPH_C32(0x6610241e), SPH_C32(0x8d22713d), SPH_C32(0x985d5950), + SPH_C32(0xcea39452) }, + { SPH_C32(0x93bb0000), SPH_C32(0x3b070000), SPH_C32(0xba010000), + SPH_C32(0x99d00008), SPH_C32(0x3739ae4e), SPH_C32(0xe64c1722), + SPH_C32(0x96f896b3), SPH_C32(0x2879ebac), SPH_C32(0x01930000), + SPH_C32(0xe7820000), SPH_C32(0xedfb0000), SPH_C32(0xcf0c000b), + SPH_C32(0x8dd08d58), SPH_C32(0xbca3b42e), SPH_C32(0x063661e1), + SPH_C32(0x536f9e7b) }, + { SPH_C32(0x90860000), SPH_C32(0x33b40000), SPH_C32(0x493b0000), + SPH_C32(0xa312000f), SPH_C32(0x6610241e), SPH_C32(0x8d22713d), + SPH_C32(0x985d5950), SPH_C32(0xcea39452), SPH_C32(0xa9490000), + SPH_C32(0x713c0000), SPH_C32(0xb1e60000), SPH_C32(0xc8d60009), + SPH_C32(0xf0b618db), SPH_C32(0xa33bc4a4), SPH_C32(0xbd50e9e9), + SPH_C32(0x89e81e7b) }, + { SPH_C32(0x3b610000), SPH_C32(0xadb90000), SPH_C32(0xe61c0000), + SPH_C32(0x9e0a000a), SPH_C32(0x4a5f3bcd), SPH_C32(0xf9d467a8), + SPH_C32(0x2d9e1ebb), SPH_C32(0xf2fe6bac), SPH_C32(0xaa740000), + SPH_C32(0x798f0000), SPH_C32(0x42dc0000), SPH_C32(0xf214000e), + SPH_C32(0xa19f928b), SPH_C32(0xc855a2bb), SPH_C32(0xb3f5260a), + SPH_C32(0x6f326185) }, + { SPH_C32(0x385c0000), SPH_C32(0xa50a0000), SPH_C32(0x15260000), + SPH_C32(0xa4c8000d), SPH_C32(0x1b76b19d), SPH_C32(0x92ba01b7), + SPH_C32(0x233bd158), SPH_C32(0x14241452), SPH_C32(0x02ae0000), + SPH_C32(0xef310000), SPH_C32(0x1ec10000), SPH_C32(0xf5ce000c), + SPH_C32(0xdcf90708), SPH_C32(0xd7cdd231), SPH_C32(0x0893ae02), + SPH_C32(0xb5b5e185) }, + { SPH_C32(0x5fa80000), SPH_C32(0x56030000), SPH_C32(0x43ae0000), + SPH_C32(0x64f30013), SPH_C32(0x257e86bf), SPH_C32(0x1311944e), + SPH_C32(0x541e95bf), SPH_C32(0x8ea4db69), SPH_C32(0x00440000), + SPH_C32(0x7f480000), SPH_C32(0xda7c0000), SPH_C32(0x2a230001), + SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), SPH_C32(0x030a9e60), + SPH_C32(0xbe0a679e) }, + { SPH_C32(0x5c950000), SPH_C32(0x5eb00000), SPH_C32(0xb0940000), + SPH_C32(0x5e310014), SPH_C32(0x74570cef), SPH_C32(0x787ff251), + SPH_C32(0x5abb5a5c), SPH_C32(0x687ea497), SPH_C32(0xa89e0000), + SPH_C32(0xe9f60000), SPH_C32(0x86610000), SPH_C32(0x2df90003), + SPH_C32(0x46cb5c4f), SPH_C32(0xb62eec0d), SPH_C32(0xb86c1668), + SPH_C32(0x648de79e) }, + { SPH_C32(0xf7720000), SPH_C32(0xc0bd0000), SPH_C32(0x1fb30000), + SPH_C32(0x63290011), SPH_C32(0x5818133c), SPH_C32(0x0c89e4c4), + SPH_C32(0xef781db7), SPH_C32(0x54235b69), SPH_C32(0xaba30000), + SPH_C32(0xe1450000), SPH_C32(0x755b0000), SPH_C32(0x173b0004), + SPH_C32(0x17e2d61f), SPH_C32(0xdd408a12), SPH_C32(0xb6c9d98b), + SPH_C32(0x82579860) }, + { SPH_C32(0xf44f0000), SPH_C32(0xc80e0000), SPH_C32(0xec890000), + SPH_C32(0x59eb0016), SPH_C32(0x0931996c), SPH_C32(0x67e782db), + SPH_C32(0xe1ddd254), SPH_C32(0xb2f92497), SPH_C32(0x03790000), + SPH_C32(0x77fb0000), SPH_C32(0x29460000), SPH_C32(0x10e10006), + SPH_C32(0x6a84439c), SPH_C32(0xc2d8fa98), SPH_C32(0x0daf5183), + SPH_C32(0x58d01860) }, + { SPH_C32(0x5e3b0000), SPH_C32(0xb1810000), SPH_C32(0xae550000), + SPH_C32(0xabff0018), SPH_C32(0xa8ae0be7), SPH_C32(0xafb22060), + SPH_C32(0x5228f45e), SPH_C32(0xddcb4512), SPH_C32(0x926c0000), + SPH_C32(0xa3cd0000), SPH_C32(0x8d860000), SPH_C32(0x7cff0002), + SPH_C32(0x8144eada), SPH_C32(0xf3593f8b), SPH_C32(0x93c46932), + SPH_C32(0xc51c1249) }, + { SPH_C32(0x5d060000), SPH_C32(0xb9320000), SPH_C32(0x5d6f0000), + SPH_C32(0x913d001f), SPH_C32(0xf98781b7), SPH_C32(0xc4dc467f), + SPH_C32(0x5c8d3bbd), SPH_C32(0x3b113aec), SPH_C32(0x3ab60000), + SPH_C32(0x35730000), SPH_C32(0xd19b0000), SPH_C32(0x7b250000), + SPH_C32(0xfc227f59), SPH_C32(0xecc14f01), SPH_C32(0x28a2e13a), + SPH_C32(0x1f9b9249) }, + { SPH_C32(0xf6e10000), SPH_C32(0x273f0000), SPH_C32(0xf2480000), + SPH_C32(0xac25001a), SPH_C32(0xd5c89e64), SPH_C32(0xb02a50ea), + SPH_C32(0xe94e7c56), SPH_C32(0x074cc512), SPH_C32(0x398b0000), + SPH_C32(0x3dc00000), SPH_C32(0x22a10000), SPH_C32(0x41e70007), + SPH_C32(0xad0bf509), SPH_C32(0x87af291e), SPH_C32(0x26072ed9), + SPH_C32(0xf941edb7) }, + { SPH_C32(0xf5dc0000), SPH_C32(0x2f8c0000), SPH_C32(0x01720000), + SPH_C32(0x96e7001d), SPH_C32(0x84e11434), SPH_C32(0xdb4436f5), + SPH_C32(0xe7ebb3b5), SPH_C32(0xe196baec), SPH_C32(0x91510000), + SPH_C32(0xab7e0000), SPH_C32(0x7ebc0000), SPH_C32(0x463d0005), + SPH_C32(0xd06d608a), SPH_C32(0x98375994), SPH_C32(0x9d61a6d1), + SPH_C32(0x23c66db7) }, + { SPH_C32(0xcd800000), SPH_C32(0x8a860000), SPH_C32(0x14540000), + SPH_C32(0x322f0010), SPH_C32(0x9f97a5a9), SPH_C32(0x49fe3742), + SPH_C32(0xc4d062ed), SPH_C32(0xf5b2aebe), SPH_C32(0x93ff0000), + SPH_C32(0x444f0000), SPH_C32(0x607d0000), SPH_C32(0xb3f30009), + SPH_C32(0x0c946782), SPH_C32(0x4ffa8ba5), SPH_C32(0x95f208d3), + SPH_C32(0x96738c32) }, + { SPH_C32(0xcebd0000), SPH_C32(0x82350000), SPH_C32(0xe76e0000), + SPH_C32(0x08ed0017), SPH_C32(0xcebe2ff9), SPH_C32(0x2290515d), + SPH_C32(0xca75ad0e), SPH_C32(0x1368d140), SPH_C32(0x3b250000), + SPH_C32(0xd2f10000), SPH_C32(0x3c600000), SPH_C32(0xb429000b), + SPH_C32(0x71f2f201), SPH_C32(0x5062fb2f), SPH_C32(0x2e9480db), + SPH_C32(0x4cf40c32) }, + { SPH_C32(0x655a0000), SPH_C32(0x1c380000), SPH_C32(0x48490000), + SPH_C32(0x35f50012), SPH_C32(0xe2f1302a), SPH_C32(0x566647c8), + SPH_C32(0x7fb6eae5), SPH_C32(0x2f352ebe), SPH_C32(0x38180000), + SPH_C32(0xda420000), SPH_C32(0xcf5a0000), SPH_C32(0x8eeb000c), + SPH_C32(0x20db7851), SPH_C32(0x3b0c9d30), SPH_C32(0x20314f38), + SPH_C32(0xaa2e73cc) }, + { SPH_C32(0x66670000), SPH_C32(0x148b0000), SPH_C32(0xbb730000), + SPH_C32(0x0f370015), SPH_C32(0xb3d8ba7a), SPH_C32(0x3d0821d7), + SPH_C32(0x71132506), SPH_C32(0xc9ef5140), SPH_C32(0x90c20000), + SPH_C32(0x4cfc0000), SPH_C32(0x93470000), SPH_C32(0x8931000e), + SPH_C32(0x5dbdedd2), SPH_C32(0x2494edba), SPH_C32(0x9b57c730), + SPH_C32(0x70a9f3cc) }, + { SPH_C32(0xcc130000), SPH_C32(0x6d040000), SPH_C32(0xf9af0000), + SPH_C32(0xfd23001b), SPH_C32(0x124728f1), SPH_C32(0xf55d836c), + SPH_C32(0xc2e6030c), SPH_C32(0xa6dd30c5), SPH_C32(0x01d70000), + SPH_C32(0x98ca0000), SPH_C32(0x37870000), SPH_C32(0xe52f000a), + SPH_C32(0xb67d4494), SPH_C32(0x151528a9), SPH_C32(0x053cff81), + SPH_C32(0xed65f9e5) }, + { SPH_C32(0xcf2e0000), SPH_C32(0x65b70000), SPH_C32(0x0a950000), + SPH_C32(0xc7e1001c), SPH_C32(0x436ea2a1), SPH_C32(0x9e33e573), + SPH_C32(0xcc43ccef), SPH_C32(0x40074f3b), SPH_C32(0xa90d0000), + SPH_C32(0x0e740000), SPH_C32(0x6b9a0000), SPH_C32(0xe2f50008), + SPH_C32(0xcb1bd117), SPH_C32(0x0a8d5823), SPH_C32(0xbe5a7789), + SPH_C32(0x37e279e5) }, + { SPH_C32(0x64c90000), SPH_C32(0xfbba0000), SPH_C32(0xa5b20000), + SPH_C32(0xfaf90019), SPH_C32(0x6f21bd72), SPH_C32(0xeac5f3e6), + SPH_C32(0x79808b04), SPH_C32(0x7c5ab0c5), SPH_C32(0xaa300000), + SPH_C32(0x06c70000), SPH_C32(0x98a00000), SPH_C32(0xd837000f), + SPH_C32(0x9a325b47), SPH_C32(0x61e33e3c), SPH_C32(0xb0ffb86a), + SPH_C32(0xd138061b) }, + { SPH_C32(0x67f40000), SPH_C32(0xf3090000), SPH_C32(0x56880000), + SPH_C32(0xc03b001e), SPH_C32(0x3e083722), SPH_C32(0x81ab95f9), + SPH_C32(0x772544e7), SPH_C32(0x9a80cf3b), SPH_C32(0x02ea0000), + SPH_C32(0x90790000), SPH_C32(0xc4bd0000), SPH_C32(0xdfed000d), + SPH_C32(0xe754cec4), SPH_C32(0x7e7b4eb6), SPH_C32(0x0b993062), + SPH_C32(0x0bbf861b) }, + { SPH_C32(0x00440000), SPH_C32(0x7f480000), SPH_C32(0xda7c0000), + SPH_C32(0x2a230001), SPH_C32(0x3badc9cc), SPH_C32(0xa9b69c87), + SPH_C32(0x030a9e60), SPH_C32(0xbe0a679e), SPH_C32(0x5fec0000), + SPH_C32(0x294b0000), SPH_C32(0x99d20000), SPH_C32(0x4ed00012), + SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), SPH_C32(0x57140bdf), + SPH_C32(0x30aebcf7) }, + { SPH_C32(0x03790000), SPH_C32(0x77fb0000), SPH_C32(0x29460000), + SPH_C32(0x10e10006), SPH_C32(0x6a84439c), SPH_C32(0xc2d8fa98), + SPH_C32(0x0daf5183), SPH_C32(0x58d01860), SPH_C32(0xf7360000), + SPH_C32(0xbff50000), SPH_C32(0xc5cf0000), SPH_C32(0x490a0010), + SPH_C32(0x63b5daf0), SPH_C32(0xa53f7843), SPH_C32(0xec7283d7), + SPH_C32(0xea293cf7) }, + { SPH_C32(0xa89e0000), SPH_C32(0xe9f60000), SPH_C32(0x86610000), + SPH_C32(0x2df90003), SPH_C32(0x46cb5c4f), SPH_C32(0xb62eec0d), + SPH_C32(0xb86c1668), SPH_C32(0x648de79e), SPH_C32(0xf40b0000), + SPH_C32(0xb7460000), SPH_C32(0x36f50000), SPH_C32(0x73c80017), + SPH_C32(0x329c50a0), SPH_C32(0xce511e5c), SPH_C32(0xe2d74c34), + SPH_C32(0x0cf34309) }, + { SPH_C32(0xaba30000), SPH_C32(0xe1450000), SPH_C32(0x755b0000), + SPH_C32(0x173b0004), SPH_C32(0x17e2d61f), SPH_C32(0xdd408a12), + SPH_C32(0xb6c9d98b), SPH_C32(0x82579860), SPH_C32(0x5cd10000), + SPH_C32(0x21f80000), SPH_C32(0x6ae80000), SPH_C32(0x74120015), + SPH_C32(0x4ffac523), SPH_C32(0xd1c96ed6), SPH_C32(0x59b1c43c), + SPH_C32(0xd674c309) }, + { SPH_C32(0x01d70000), SPH_C32(0x98ca0000), SPH_C32(0x37870000), + SPH_C32(0xe52f000a), SPH_C32(0xb67d4494), SPH_C32(0x151528a9), + SPH_C32(0x053cff81), SPH_C32(0xed65f9e5), SPH_C32(0xcdc40000), + SPH_C32(0xf5ce0000), SPH_C32(0xce280000), SPH_C32(0x180c0011), + SPH_C32(0xa43a6c65), SPH_C32(0xe048abc5), SPH_C32(0xc7dafc8d), + SPH_C32(0x4bb8c920) }, + { SPH_C32(0x02ea0000), SPH_C32(0x90790000), SPH_C32(0xc4bd0000), + SPH_C32(0xdfed000d), SPH_C32(0xe754cec4), SPH_C32(0x7e7b4eb6), + SPH_C32(0x0b993062), SPH_C32(0x0bbf861b), SPH_C32(0x651e0000), + SPH_C32(0x63700000), SPH_C32(0x92350000), SPH_C32(0x1fd60013), + SPH_C32(0xd95cf9e6), SPH_C32(0xffd0db4f), SPH_C32(0x7cbc7485), + SPH_C32(0x913f4920) }, + { SPH_C32(0xa90d0000), SPH_C32(0x0e740000), SPH_C32(0x6b9a0000), + SPH_C32(0xe2f50008), SPH_C32(0xcb1bd117), SPH_C32(0x0a8d5823), + SPH_C32(0xbe5a7789), SPH_C32(0x37e279e5), SPH_C32(0x66230000), + SPH_C32(0x6bc30000), SPH_C32(0x610f0000), SPH_C32(0x25140014), + SPH_C32(0x887573b6), SPH_C32(0x94bebd50), SPH_C32(0x7219bb66), + SPH_C32(0x77e536de) }, + { SPH_C32(0xaa300000), SPH_C32(0x06c70000), SPH_C32(0x98a00000), + SPH_C32(0xd837000f), SPH_C32(0x9a325b47), SPH_C32(0x61e33e3c), + SPH_C32(0xb0ffb86a), SPH_C32(0xd138061b), SPH_C32(0xcef90000), + SPH_C32(0xfd7d0000), SPH_C32(0x3d120000), SPH_C32(0x22ce0016), + SPH_C32(0xf513e635), SPH_C32(0x8b26cdda), SPH_C32(0xc97f336e), + SPH_C32(0xad62b6de) }, + { SPH_C32(0x926c0000), SPH_C32(0xa3cd0000), SPH_C32(0x8d860000), + SPH_C32(0x7cff0002), SPH_C32(0x8144eada), SPH_C32(0xf3593f8b), + SPH_C32(0x93c46932), SPH_C32(0xc51c1249), SPH_C32(0xcc570000), + SPH_C32(0x124c0000), SPH_C32(0x23d30000), SPH_C32(0xd700001a), + SPH_C32(0x29eae13d), SPH_C32(0x5ceb1feb), SPH_C32(0xc1ec9d6c), + SPH_C32(0x18d7575b) }, + { SPH_C32(0x91510000), SPH_C32(0xab7e0000), SPH_C32(0x7ebc0000), + SPH_C32(0x463d0005), SPH_C32(0xd06d608a), SPH_C32(0x98375994), + SPH_C32(0x9d61a6d1), SPH_C32(0x23c66db7), SPH_C32(0x648d0000), + SPH_C32(0x84f20000), SPH_C32(0x7fce0000), SPH_C32(0xd0da0018), + SPH_C32(0x548c74be), SPH_C32(0x43736f61), SPH_C32(0x7a8a1564), + SPH_C32(0xc250d75b) }, + { SPH_C32(0x3ab60000), SPH_C32(0x35730000), SPH_C32(0xd19b0000), + SPH_C32(0x7b250000), SPH_C32(0xfc227f59), SPH_C32(0xecc14f01), + SPH_C32(0x28a2e13a), SPH_C32(0x1f9b9249), SPH_C32(0x67b00000), + SPH_C32(0x8c410000), SPH_C32(0x8cf40000), SPH_C32(0xea18001f), + SPH_C32(0x05a5feee), SPH_C32(0x281d097e), SPH_C32(0x742fda87), + SPH_C32(0x248aa8a5) }, + { SPH_C32(0x398b0000), SPH_C32(0x3dc00000), SPH_C32(0x22a10000), + SPH_C32(0x41e70007), SPH_C32(0xad0bf509), SPH_C32(0x87af291e), + SPH_C32(0x26072ed9), SPH_C32(0xf941edb7), SPH_C32(0xcf6a0000), + SPH_C32(0x1aff0000), SPH_C32(0xd0e90000), SPH_C32(0xedc2001d), + SPH_C32(0x78c36b6d), SPH_C32(0x378579f4), SPH_C32(0xcf49528f), + SPH_C32(0xfe0d28a5) }, + { SPH_C32(0x93ff0000), SPH_C32(0x444f0000), SPH_C32(0x607d0000), + SPH_C32(0xb3f30009), SPH_C32(0x0c946782), SPH_C32(0x4ffa8ba5), + SPH_C32(0x95f208d3), SPH_C32(0x96738c32), SPH_C32(0x5e7f0000), + SPH_C32(0xcec90000), SPH_C32(0x74290000), SPH_C32(0x81dc0019), + SPH_C32(0x9303c22b), SPH_C32(0x0604bce7), SPH_C32(0x51226a3e), + SPH_C32(0x63c1228c) }, + { SPH_C32(0x90c20000), SPH_C32(0x4cfc0000), SPH_C32(0x93470000), + SPH_C32(0x8931000e), SPH_C32(0x5dbdedd2), SPH_C32(0x2494edba), + SPH_C32(0x9b57c730), SPH_C32(0x70a9f3cc), SPH_C32(0xf6a50000), + SPH_C32(0x58770000), SPH_C32(0x28340000), SPH_C32(0x8606001b), + SPH_C32(0xee6557a8), SPH_C32(0x199ccc6d), SPH_C32(0xea44e236), + SPH_C32(0xb946a28c) }, + { SPH_C32(0x3b250000), SPH_C32(0xd2f10000), SPH_C32(0x3c600000), + SPH_C32(0xb429000b), SPH_C32(0x71f2f201), SPH_C32(0x5062fb2f), + SPH_C32(0x2e9480db), SPH_C32(0x4cf40c32), SPH_C32(0xf5980000), + SPH_C32(0x50c40000), SPH_C32(0xdb0e0000), SPH_C32(0xbcc4001c), + SPH_C32(0xbf4cddf8), SPH_C32(0x72f2aa72), SPH_C32(0xe4e12dd5), + SPH_C32(0x5f9cdd72) }, + { SPH_C32(0x38180000), SPH_C32(0xda420000), SPH_C32(0xcf5a0000), + SPH_C32(0x8eeb000c), SPH_C32(0x20db7851), SPH_C32(0x3b0c9d30), + SPH_C32(0x20314f38), SPH_C32(0xaa2e73cc), SPH_C32(0x5d420000), + SPH_C32(0xc67a0000), SPH_C32(0x87130000), SPH_C32(0xbb1e001e), + SPH_C32(0xc22a487b), SPH_C32(0x6d6adaf8), SPH_C32(0x5f87a5dd), + SPH_C32(0x851b5d72) }, + { SPH_C32(0x5fec0000), SPH_C32(0x294b0000), SPH_C32(0x99d20000), + SPH_C32(0x4ed00012), SPH_C32(0x1ed34f73), SPH_C32(0xbaa708c9), + SPH_C32(0x57140bdf), SPH_C32(0x30aebcf7), SPH_C32(0x5fa80000), + SPH_C32(0x56030000), SPH_C32(0x43ae0000), SPH_C32(0x64f30013), + SPH_C32(0x257e86bf), SPH_C32(0x1311944e), SPH_C32(0x541e95bf), + SPH_C32(0x8ea4db69) }, + { SPH_C32(0x5cd10000), SPH_C32(0x21f80000), SPH_C32(0x6ae80000), + SPH_C32(0x74120015), SPH_C32(0x4ffac523), SPH_C32(0xd1c96ed6), + SPH_C32(0x59b1c43c), SPH_C32(0xd674c309), SPH_C32(0xf7720000), + SPH_C32(0xc0bd0000), SPH_C32(0x1fb30000), SPH_C32(0x63290011), + SPH_C32(0x5818133c), SPH_C32(0x0c89e4c4), SPH_C32(0xef781db7), + SPH_C32(0x54235b69) }, + { SPH_C32(0xf7360000), SPH_C32(0xbff50000), SPH_C32(0xc5cf0000), + SPH_C32(0x490a0010), SPH_C32(0x63b5daf0), SPH_C32(0xa53f7843), + SPH_C32(0xec7283d7), SPH_C32(0xea293cf7), SPH_C32(0xf44f0000), + SPH_C32(0xc80e0000), SPH_C32(0xec890000), SPH_C32(0x59eb0016), + SPH_C32(0x0931996c), SPH_C32(0x67e782db), SPH_C32(0xe1ddd254), + SPH_C32(0xb2f92497) }, + { SPH_C32(0xf40b0000), SPH_C32(0xb7460000), SPH_C32(0x36f50000), + SPH_C32(0x73c80017), SPH_C32(0x329c50a0), SPH_C32(0xce511e5c), + SPH_C32(0xe2d74c34), SPH_C32(0x0cf34309), SPH_C32(0x5c950000), + SPH_C32(0x5eb00000), SPH_C32(0xb0940000), SPH_C32(0x5e310014), + SPH_C32(0x74570cef), SPH_C32(0x787ff251), SPH_C32(0x5abb5a5c), + SPH_C32(0x687ea497) }, + { SPH_C32(0x5e7f0000), SPH_C32(0xcec90000), SPH_C32(0x74290000), + SPH_C32(0x81dc0019), SPH_C32(0x9303c22b), SPH_C32(0x0604bce7), + SPH_C32(0x51226a3e), SPH_C32(0x63c1228c), SPH_C32(0xcd800000), + SPH_C32(0x8a860000), SPH_C32(0x14540000), SPH_C32(0x322f0010), + SPH_C32(0x9f97a5a9), SPH_C32(0x49fe3742), SPH_C32(0xc4d062ed), + SPH_C32(0xf5b2aebe) }, + { SPH_C32(0x5d420000), SPH_C32(0xc67a0000), SPH_C32(0x87130000), + SPH_C32(0xbb1e001e), SPH_C32(0xc22a487b), SPH_C32(0x6d6adaf8), + SPH_C32(0x5f87a5dd), SPH_C32(0x851b5d72), SPH_C32(0x655a0000), + SPH_C32(0x1c380000), SPH_C32(0x48490000), SPH_C32(0x35f50012), + SPH_C32(0xe2f1302a), SPH_C32(0x566647c8), SPH_C32(0x7fb6eae5), + SPH_C32(0x2f352ebe) }, + { SPH_C32(0xf6a50000), SPH_C32(0x58770000), SPH_C32(0x28340000), + SPH_C32(0x8606001b), SPH_C32(0xee6557a8), SPH_C32(0x199ccc6d), + SPH_C32(0xea44e236), SPH_C32(0xb946a28c), SPH_C32(0x66670000), + SPH_C32(0x148b0000), SPH_C32(0xbb730000), SPH_C32(0x0f370015), + SPH_C32(0xb3d8ba7a), SPH_C32(0x3d0821d7), SPH_C32(0x71132506), + SPH_C32(0xc9ef5140) }, + { SPH_C32(0xf5980000), SPH_C32(0x50c40000), SPH_C32(0xdb0e0000), + SPH_C32(0xbcc4001c), SPH_C32(0xbf4cddf8), SPH_C32(0x72f2aa72), + SPH_C32(0xe4e12dd5), SPH_C32(0x5f9cdd72), SPH_C32(0xcebd0000), + SPH_C32(0x82350000), SPH_C32(0xe76e0000), SPH_C32(0x08ed0017), + SPH_C32(0xcebe2ff9), SPH_C32(0x2290515d), SPH_C32(0xca75ad0e), + SPH_C32(0x1368d140) }, + { SPH_C32(0xcdc40000), SPH_C32(0xf5ce0000), SPH_C32(0xce280000), + SPH_C32(0x180c0011), SPH_C32(0xa43a6c65), SPH_C32(0xe048abc5), + SPH_C32(0xc7dafc8d), SPH_C32(0x4bb8c920), SPH_C32(0xcc130000), + SPH_C32(0x6d040000), SPH_C32(0xf9af0000), SPH_C32(0xfd23001b), + SPH_C32(0x124728f1), SPH_C32(0xf55d836c), SPH_C32(0xc2e6030c), + SPH_C32(0xa6dd30c5) }, + { SPH_C32(0xcef90000), SPH_C32(0xfd7d0000), SPH_C32(0x3d120000), + SPH_C32(0x22ce0016), SPH_C32(0xf513e635), SPH_C32(0x8b26cdda), + SPH_C32(0xc97f336e), SPH_C32(0xad62b6de), SPH_C32(0x64c90000), + SPH_C32(0xfbba0000), SPH_C32(0xa5b20000), SPH_C32(0xfaf90019), + SPH_C32(0x6f21bd72), SPH_C32(0xeac5f3e6), SPH_C32(0x79808b04), + SPH_C32(0x7c5ab0c5) }, + { SPH_C32(0x651e0000), SPH_C32(0x63700000), SPH_C32(0x92350000), + SPH_C32(0x1fd60013), SPH_C32(0xd95cf9e6), SPH_C32(0xffd0db4f), + SPH_C32(0x7cbc7485), SPH_C32(0x913f4920), SPH_C32(0x67f40000), + SPH_C32(0xf3090000), SPH_C32(0x56880000), SPH_C32(0xc03b001e), + SPH_C32(0x3e083722), SPH_C32(0x81ab95f9), SPH_C32(0x772544e7), + SPH_C32(0x9a80cf3b) }, + { SPH_C32(0x66230000), SPH_C32(0x6bc30000), SPH_C32(0x610f0000), + SPH_C32(0x25140014), SPH_C32(0x887573b6), SPH_C32(0x94bebd50), + SPH_C32(0x7219bb66), SPH_C32(0x77e536de), SPH_C32(0xcf2e0000), + SPH_C32(0x65b70000), SPH_C32(0x0a950000), SPH_C32(0xc7e1001c), + SPH_C32(0x436ea2a1), SPH_C32(0x9e33e573), SPH_C32(0xcc43ccef), + SPH_C32(0x40074f3b) }, + { SPH_C32(0xcc570000), SPH_C32(0x124c0000), SPH_C32(0x23d30000), + SPH_C32(0xd700001a), SPH_C32(0x29eae13d), SPH_C32(0x5ceb1feb), + SPH_C32(0xc1ec9d6c), SPH_C32(0x18d7575b), SPH_C32(0x5e3b0000), + SPH_C32(0xb1810000), SPH_C32(0xae550000), SPH_C32(0xabff0018), + SPH_C32(0xa8ae0be7), SPH_C32(0xafb22060), SPH_C32(0x5228f45e), + SPH_C32(0xddcb4512) }, + { SPH_C32(0xcf6a0000), SPH_C32(0x1aff0000), SPH_C32(0xd0e90000), + SPH_C32(0xedc2001d), SPH_C32(0x78c36b6d), SPH_C32(0x378579f4), + SPH_C32(0xcf49528f), SPH_C32(0xfe0d28a5), SPH_C32(0xf6e10000), + SPH_C32(0x273f0000), SPH_C32(0xf2480000), SPH_C32(0xac25001a), + SPH_C32(0xd5c89e64), SPH_C32(0xb02a50ea), SPH_C32(0xe94e7c56), + SPH_C32(0x074cc512) }, + { SPH_C32(0x648d0000), SPH_C32(0x84f20000), SPH_C32(0x7fce0000), + SPH_C32(0xd0da0018), SPH_C32(0x548c74be), SPH_C32(0x43736f61), + SPH_C32(0x7a8a1564), SPH_C32(0xc250d75b), SPH_C32(0xf5dc0000), + SPH_C32(0x2f8c0000), SPH_C32(0x01720000), SPH_C32(0x96e7001d), + SPH_C32(0x84e11434), SPH_C32(0xdb4436f5), SPH_C32(0xe7ebb3b5), + SPH_C32(0xe196baec) }, + { SPH_C32(0x67b00000), SPH_C32(0x8c410000), SPH_C32(0x8cf40000), + SPH_C32(0xea18001f), SPH_C32(0x05a5feee), SPH_C32(0x281d097e), + SPH_C32(0x742fda87), SPH_C32(0x248aa8a5), SPH_C32(0x5d060000), + SPH_C32(0xb9320000), SPH_C32(0x5d6f0000), SPH_C32(0x913d001f), + SPH_C32(0xf98781b7), SPH_C32(0xc4dc467f), SPH_C32(0x5c8d3bbd), + SPH_C32(0x3b113aec) }, + { SPH_C32(0xee930000), SPH_C32(0xd6070000), SPH_C32(0x92c10000), + SPH_C32(0x2b9801e0), SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), + SPH_C32(0x45312374), SPH_C32(0x201f6a64), SPH_C32(0x7b280000), + SPH_C32(0x57420000), SPH_C32(0xa9e50000), SPH_C32(0x634300a0), + SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), SPH_C32(0x27f83b03), + SPH_C32(0xc7ff60f0) }, + { SPH_C32(0xedae0000), SPH_C32(0xdeb40000), SPH_C32(0x61fb0000), + SPH_C32(0x115a01e7), SPH_C32(0xc578a22c), SPH_C32(0x50029d48), + SPH_C32(0x4b94ec97), SPH_C32(0xc6c5159a), SPH_C32(0xd3f20000), + SPH_C32(0xc1fc0000), SPH_C32(0xf5f80000), SPH_C32(0x649900a2), + SPH_C32(0xe3bdd1ac), SPH_C32(0x7201e531), SPH_C32(0x9c9eb30b), + SPH_C32(0x1d78e0f0) }, + { SPH_C32(0x46490000), SPH_C32(0x40b90000), SPH_C32(0xcedc0000), + SPH_C32(0x2c4201e2), SPH_C32(0xe937bdff), SPH_C32(0x24f48bdd), + SPH_C32(0xfe57ab7c), SPH_C32(0xfa98ea64), SPH_C32(0xd0cf0000), + SPH_C32(0xc94f0000), SPH_C32(0x06c20000), SPH_C32(0x5e5b00a5), + SPH_C32(0xb2945bfc), SPH_C32(0x196f832e), SPH_C32(0x923b7ce8), + SPH_C32(0xfba29f0e) }, + { SPH_C32(0x45740000), SPH_C32(0x480a0000), SPH_C32(0x3de60000), + SPH_C32(0x168001e5), SPH_C32(0xb81e37af), SPH_C32(0x4f9aedc2), + SPH_C32(0xf0f2649f), SPH_C32(0x1c42959a), SPH_C32(0x78150000), + SPH_C32(0x5ff10000), SPH_C32(0x5adf0000), SPH_C32(0x598100a7), + SPH_C32(0xcff2ce7f), SPH_C32(0x06f7f3a4), SPH_C32(0x295df4e0), + SPH_C32(0x21251f0e) }, + { SPH_C32(0xef000000), SPH_C32(0x31850000), SPH_C32(0x7f3a0000), + SPH_C32(0xe49401eb), SPH_C32(0x1981a524), SPH_C32(0x87cf4f79), + SPH_C32(0x43074295), SPH_C32(0x7370f41f), SPH_C32(0xe9000000), + SPH_C32(0x8bc70000), SPH_C32(0xfe1f0000), SPH_C32(0x359f00a3), + SPH_C32(0x24326739), SPH_C32(0x377636b7), SPH_C32(0xb736cc51), + SPH_C32(0xbce91527) }, + { SPH_C32(0xec3d0000), SPH_C32(0x39360000), SPH_C32(0x8c000000), + SPH_C32(0xde5601ec), SPH_C32(0x48a82f74), SPH_C32(0xeca12966), + SPH_C32(0x4da28d76), SPH_C32(0x95aa8be1), SPH_C32(0x41da0000), + SPH_C32(0x1d790000), SPH_C32(0xa2020000), SPH_C32(0x324500a1), + SPH_C32(0x5954f2ba), SPH_C32(0x28ee463d), SPH_C32(0x0c504459), + SPH_C32(0x666e9527) }, + { SPH_C32(0x47da0000), SPH_C32(0xa73b0000), SPH_C32(0x23270000), + SPH_C32(0xe34e01e9), SPH_C32(0x64e730a7), SPH_C32(0x98573ff3), + SPH_C32(0xf861ca9d), SPH_C32(0xa9f7741f), SPH_C32(0x42e70000), + SPH_C32(0x15ca0000), SPH_C32(0x51380000), SPH_C32(0x088700a6), + SPH_C32(0x087d78ea), SPH_C32(0x43802022), SPH_C32(0x02f58bba), + SPH_C32(0x80b4ead9) }, + { SPH_C32(0x44e70000), SPH_C32(0xaf880000), SPH_C32(0xd01d0000), + SPH_C32(0xd98c01ee), SPH_C32(0x35cebaf7), SPH_C32(0xf33959ec), + SPH_C32(0xf6c4057e), SPH_C32(0x4f2d0be1), SPH_C32(0xea3d0000), + SPH_C32(0x83740000), SPH_C32(0x0d250000), SPH_C32(0x0f5d00a4), + SPH_C32(0x751bed69), SPH_C32(0x5c1850a8), SPH_C32(0xb99303b2), + SPH_C32(0x5a336ad9) }, + { SPH_C32(0x7cbb0000), SPH_C32(0x0a820000), SPH_C32(0xc53b0000), + SPH_C32(0x7d4401e3), SPH_C32(0x2eb80b6a), SPH_C32(0x6183585b), + SPH_C32(0xd5ffd426), SPH_C32(0x5b091fb3), SPH_C32(0xe8930000), + SPH_C32(0x6c450000), SPH_C32(0x13e40000), SPH_C32(0xfa9300a8), + SPH_C32(0xa9e2ea61), SPH_C32(0x8bd58299), SPH_C32(0xb100adb0), + SPH_C32(0xef868b5c) }, + { SPH_C32(0x7f860000), SPH_C32(0x02310000), SPH_C32(0x36010000), + SPH_C32(0x478601e4), SPH_C32(0x7f91813a), SPH_C32(0x0aed3e44), + SPH_C32(0xdb5a1bc5), SPH_C32(0xbdd3604d), SPH_C32(0x40490000), + SPH_C32(0xfafb0000), SPH_C32(0x4ff90000), SPH_C32(0xfd4900aa), + SPH_C32(0xd4847fe2), SPH_C32(0x944df213), SPH_C32(0x0a6625b8), + SPH_C32(0x35010b5c) }, + { SPH_C32(0xd4610000), SPH_C32(0x9c3c0000), SPH_C32(0x99260000), + SPH_C32(0x7a9e01e1), SPH_C32(0x53de9ee9), SPH_C32(0x7e1b28d1), + SPH_C32(0x6e995c2e), SPH_C32(0x818e9fb3), SPH_C32(0x43740000), + SPH_C32(0xf2480000), SPH_C32(0xbcc30000), SPH_C32(0xc78b00ad), + SPH_C32(0x85adf5b2), SPH_C32(0xff23940c), SPH_C32(0x04c3ea5b), + SPH_C32(0xd3db74a2) }, + { SPH_C32(0xd75c0000), SPH_C32(0x948f0000), SPH_C32(0x6a1c0000), + SPH_C32(0x405c01e6), SPH_C32(0x02f714b9), SPH_C32(0x15754ece), + SPH_C32(0x603c93cd), SPH_C32(0x6754e04d), SPH_C32(0xebae0000), + SPH_C32(0x64f60000), SPH_C32(0xe0de0000), SPH_C32(0xc05100af), + SPH_C32(0xf8cb6031), SPH_C32(0xe0bbe486), SPH_C32(0xbfa56253), + SPH_C32(0x095cf4a2) }, + { SPH_C32(0x7d280000), SPH_C32(0xed000000), SPH_C32(0x28c00000), + SPH_C32(0xb24801e8), SPH_C32(0xa3688632), SPH_C32(0xdd20ec75), + SPH_C32(0xd3c9b5c7), SPH_C32(0x086681c8), SPH_C32(0x7abb0000), + SPH_C32(0xb0c00000), SPH_C32(0x441e0000), SPH_C32(0xac4f00ab), + SPH_C32(0x130bc977), SPH_C32(0xd13a2195), SPH_C32(0x21ce5ae2), + SPH_C32(0x9490fe8b) }, + { SPH_C32(0x7e150000), SPH_C32(0xe5b30000), SPH_C32(0xdbfa0000), + SPH_C32(0x888a01ef), SPH_C32(0xf2410c62), SPH_C32(0xb64e8a6a), + SPH_C32(0xdd6c7a24), SPH_C32(0xeebcfe36), SPH_C32(0xd2610000), + SPH_C32(0x267e0000), SPH_C32(0x18030000), SPH_C32(0xab9500a9), + SPH_C32(0x6e6d5cf4), SPH_C32(0xcea2511f), SPH_C32(0x9aa8d2ea), + SPH_C32(0x4e177e8b) }, + { SPH_C32(0xd5f20000), SPH_C32(0x7bbe0000), SPH_C32(0x74dd0000), + SPH_C32(0xb59201ea), SPH_C32(0xde0e13b1), SPH_C32(0xc2b89cff), + SPH_C32(0x68af3dcf), SPH_C32(0xd2e101c8), SPH_C32(0xd15c0000), + SPH_C32(0x2ecd0000), SPH_C32(0xeb390000), SPH_C32(0x915700ae), + SPH_C32(0x3f44d6a4), SPH_C32(0xa5cc3700), SPH_C32(0x940d1d09), + SPH_C32(0xa8cd0175) }, + { SPH_C32(0xd6cf0000), SPH_C32(0x730d0000), SPH_C32(0x87e70000), + SPH_C32(0x8f5001ed), SPH_C32(0x8f2799e1), SPH_C32(0xa9d6fae0), + SPH_C32(0x660af22c), SPH_C32(0x343b7e36), SPH_C32(0x79860000), + SPH_C32(0xb8730000), SPH_C32(0xb7240000), SPH_C32(0x968d00ac), + SPH_C32(0x42224327), SPH_C32(0xba54478a), SPH_C32(0x2f6b9501), + SPH_C32(0x724a8175) }, + { SPH_C32(0xb13b0000), SPH_C32(0x80040000), SPH_C32(0xd16f0000), + SPH_C32(0x4f6b01f3), SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), + SPH_C32(0x112fb6cb), SPH_C32(0xaebbb10d), SPH_C32(0x7b6c0000), + SPH_C32(0x280a0000), SPH_C32(0x73990000), SPH_C32(0x496000a1), + SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), SPH_C32(0x24f2a563), + SPH_C32(0x79f5076e) }, + { SPH_C32(0xb2060000), SPH_C32(0x88b70000), SPH_C32(0x22550000), + SPH_C32(0x75a901f4), SPH_C32(0xe0062493), SPH_C32(0x43130906), + SPH_C32(0x1f8a7928), SPH_C32(0x4861cef3), SPH_C32(0xd3b60000), + SPH_C32(0xbeb40000), SPH_C32(0x2f840000), SPH_C32(0x4eba00a3), + SPH_C32(0xd8101860), SPH_C32(0xdbb779b6), SPH_C32(0x9f942d6b), + SPH_C32(0xa372876e) }, + { SPH_C32(0x19e10000), SPH_C32(0x16ba0000), SPH_C32(0x8d720000), + SPH_C32(0x48b101f1), SPH_C32(0xcc493b40), SPH_C32(0x37e51f93), + SPH_C32(0xaa493ec3), SPH_C32(0x743c310d), SPH_C32(0xd08b0000), + SPH_C32(0xb6070000), SPH_C32(0xdcbe0000), SPH_C32(0x747800a4), + SPH_C32(0x89399230), SPH_C32(0xb0d91fa9), SPH_C32(0x9131e288), + SPH_C32(0x45a8f890) }, + { SPH_C32(0x1adc0000), SPH_C32(0x1e090000), SPH_C32(0x7e480000), + SPH_C32(0x727301f6), SPH_C32(0x9d60b110), SPH_C32(0x5c8b798c), + SPH_C32(0xa4ecf120), SPH_C32(0x92e64ef3), SPH_C32(0x78510000), + SPH_C32(0x20b90000), SPH_C32(0x80a30000), SPH_C32(0x73a200a6), + SPH_C32(0xf45f07b3), SPH_C32(0xaf416f23), SPH_C32(0x2a576a80), + SPH_C32(0x9f2f7890) }, + { SPH_C32(0xb0a80000), SPH_C32(0x67860000), SPH_C32(0x3c940000), + SPH_C32(0x806701f8), SPH_C32(0x3cff239b), SPH_C32(0x94dedb37), + SPH_C32(0x1719d72a), SPH_C32(0xfdd42f76), SPH_C32(0xe9440000), + SPH_C32(0xf48f0000), SPH_C32(0x24630000), SPH_C32(0x1fbc00a2), + SPH_C32(0x1f9faef5), SPH_C32(0x9ec0aa30), SPH_C32(0xb43c5231), + SPH_C32(0x02e372b9) }, + { SPH_C32(0xb3950000), SPH_C32(0x6f350000), SPH_C32(0xcfae0000), + SPH_C32(0xbaa501ff), SPH_C32(0x6dd6a9cb), SPH_C32(0xffb0bd28), + SPH_C32(0x19bc18c9), SPH_C32(0x1b0e5088), SPH_C32(0x419e0000), + SPH_C32(0x62310000), SPH_C32(0x787e0000), SPH_C32(0x186600a0), + SPH_C32(0x62f93b76), SPH_C32(0x8158daba), SPH_C32(0x0f5ada39), + SPH_C32(0xd864f2b9) }, + { SPH_C32(0x18720000), SPH_C32(0xf1380000), SPH_C32(0x60890000), + SPH_C32(0x87bd01fa), SPH_C32(0x4199b618), SPH_C32(0x8b46abbd), + SPH_C32(0xac7f5f22), SPH_C32(0x2753af76), SPH_C32(0x42a30000), + SPH_C32(0x6a820000), SPH_C32(0x8b440000), SPH_C32(0x22a400a7), + SPH_C32(0x33d0b126), SPH_C32(0xea36bca5), SPH_C32(0x01ff15da), + SPH_C32(0x3ebe8d47) }, + { SPH_C32(0x1b4f0000), SPH_C32(0xf98b0000), SPH_C32(0x93b30000), + SPH_C32(0xbd7f01fd), SPH_C32(0x10b03c48), SPH_C32(0xe028cda2), + SPH_C32(0xa2da90c1), SPH_C32(0xc189d088), SPH_C32(0xea790000), + SPH_C32(0xfc3c0000), SPH_C32(0xd7590000), SPH_C32(0x257e00a5), + SPH_C32(0x4eb624a5), SPH_C32(0xf5aecc2f), SPH_C32(0xba999dd2), + SPH_C32(0xe4390d47) }, + { SPH_C32(0x23130000), SPH_C32(0x5c810000), SPH_C32(0x86950000), + SPH_C32(0x19b701f0), SPH_C32(0x0bc68dd5), SPH_C32(0x7292cc15), + SPH_C32(0x81e14199), SPH_C32(0xd5adc4da), SPH_C32(0xe8d70000), + SPH_C32(0x130d0000), SPH_C32(0xc9980000), SPH_C32(0xd0b000a9), + SPH_C32(0x924f23ad), SPH_C32(0x22631e1e), SPH_C32(0xb20a33d0), + SPH_C32(0x518cecc2) }, + { SPH_C32(0x202e0000), SPH_C32(0x54320000), SPH_C32(0x75af0000), + SPH_C32(0x237501f7), SPH_C32(0x5aef0785), SPH_C32(0x19fcaa0a), + SPH_C32(0x8f448e7a), SPH_C32(0x3377bb24), SPH_C32(0x400d0000), + SPH_C32(0x85b30000), SPH_C32(0x95850000), SPH_C32(0xd76a00ab), + SPH_C32(0xef29b62e), SPH_C32(0x3dfb6e94), SPH_C32(0x096cbbd8), + SPH_C32(0x8b0b6cc2) }, + { SPH_C32(0x8bc90000), SPH_C32(0xca3f0000), SPH_C32(0xda880000), + SPH_C32(0x1e6d01f2), SPH_C32(0x76a01856), SPH_C32(0x6d0abc9f), + SPH_C32(0x3a87c991), SPH_C32(0x0f2a44da), SPH_C32(0x43300000), + SPH_C32(0x8d000000), SPH_C32(0x66bf0000), SPH_C32(0xeda800ac), + SPH_C32(0xbe003c7e), SPH_C32(0x5695088b), SPH_C32(0x07c9743b), + SPH_C32(0x6dd1133c) }, + { SPH_C32(0x88f40000), SPH_C32(0xc28c0000), SPH_C32(0x29b20000), + SPH_C32(0x24af01f5), SPH_C32(0x27899206), SPH_C32(0x0664da80), + SPH_C32(0x34220672), SPH_C32(0xe9f03b24), SPH_C32(0xebea0000), + SPH_C32(0x1bbe0000), SPH_C32(0x3aa20000), SPH_C32(0xea7200ae), + SPH_C32(0xc366a9fd), SPH_C32(0x490d7801), SPH_C32(0xbcaffc33), + SPH_C32(0xb756933c) }, + { SPH_C32(0x22800000), SPH_C32(0xbb030000), SPH_C32(0x6b6e0000), + SPH_C32(0xd6bb01fb), SPH_C32(0x8616008d), SPH_C32(0xce31783b), + SPH_C32(0x87d72078), SPH_C32(0x86c25aa1), SPH_C32(0x7aff0000), + SPH_C32(0xcf880000), SPH_C32(0x9e620000), SPH_C32(0x866c00aa), + SPH_C32(0x28a600bb), SPH_C32(0x788cbd12), SPH_C32(0x22c4c482), + SPH_C32(0x2a9a9915) }, + { SPH_C32(0x21bd0000), SPH_C32(0xb3b00000), SPH_C32(0x98540000), + SPH_C32(0xec7901fc), SPH_C32(0xd73f8add), SPH_C32(0xa55f1e24), + SPH_C32(0x8972ef9b), SPH_C32(0x6018255f), SPH_C32(0xd2250000), + SPH_C32(0x59360000), SPH_C32(0xc27f0000), SPH_C32(0x81b600a8), + SPH_C32(0x55c09538), SPH_C32(0x6714cd98), SPH_C32(0x99a24c8a), + SPH_C32(0xf01d1915) }, + { SPH_C32(0x8a5a0000), SPH_C32(0x2dbd0000), SPH_C32(0x37730000), + SPH_C32(0xd16101f9), SPH_C32(0xfb70950e), SPH_C32(0xd1a908b1), + SPH_C32(0x3cb1a870), SPH_C32(0x5c45daa1), SPH_C32(0xd1180000), + SPH_C32(0x51850000), SPH_C32(0x31450000), SPH_C32(0xbb7400af), + SPH_C32(0x04e91f68), SPH_C32(0x0c7aab87), SPH_C32(0x97078369), + SPH_C32(0x16c766eb) }, + { SPH_C32(0x89670000), SPH_C32(0x250e0000), SPH_C32(0xc4490000), + SPH_C32(0xeba301fe), SPH_C32(0xaa591f5e), SPH_C32(0xbac76eae), + SPH_C32(0x32146793), SPH_C32(0xba9fa55f), SPH_C32(0x79c20000), + SPH_C32(0xc73b0000), SPH_C32(0x6d580000), SPH_C32(0xbcae00ad), + SPH_C32(0x798f8aeb), SPH_C32(0x13e2db0d), SPH_C32(0x2c610b61), + SPH_C32(0xcc40e6eb) }, + { SPH_C32(0xeed70000), SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), + SPH_C32(0x01bb01e1), SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), + SPH_C32(0x463bbd14), SPH_C32(0x9e150dfa), SPH_C32(0x24c40000), + SPH_C32(0x7e090000), SPH_C32(0x30370000), SPH_C32(0x2d9300b2), + SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), SPH_C32(0x70ec30dc), + SPH_C32(0xf751dc07) }, + { SPH_C32(0xedea0000), SPH_C32(0xa1fc0000), SPH_C32(0xbb870000), + SPH_C32(0x3b7901e6), SPH_C32(0xfed56be0), SPH_C32(0xf9b401cf), + SPH_C32(0x489e72f7), SPH_C32(0x78cf7204), SPH_C32(0x8c1e0000), + SPH_C32(0xe8b70000), SPH_C32(0x6c2a0000), SPH_C32(0x2a4900b0), + SPH_C32(0xfd6e9edf), SPH_C32(0xc8a6edf8), SPH_C32(0xcb8ab8d4), + SPH_C32(0x2dd65c07) }, + { SPH_C32(0x460d0000), SPH_C32(0x3ff10000), SPH_C32(0x14a00000), + SPH_C32(0x066101e3), SPH_C32(0xd29a7433), SPH_C32(0x8d42175a), + SPH_C32(0xfd5d351c), SPH_C32(0x44928dfa), SPH_C32(0x8f230000), + SPH_C32(0xe0040000), SPH_C32(0x9f100000), SPH_C32(0x108b00b7), + SPH_C32(0xac47148f), SPH_C32(0xa3c88be7), SPH_C32(0xc52f7737), + SPH_C32(0xcb0c23f9) }, + { SPH_C32(0x45300000), SPH_C32(0x37420000), SPH_C32(0xe79a0000), + SPH_C32(0x3ca301e4), SPH_C32(0x83b3fe63), SPH_C32(0xe62c7145), + SPH_C32(0xf3f8faff), SPH_C32(0xa248f204), SPH_C32(0x27f90000), + SPH_C32(0x76ba0000), SPH_C32(0xc30d0000), SPH_C32(0x175100b5), + SPH_C32(0xd121810c), SPH_C32(0xbc50fb6d), SPH_C32(0x7e49ff3f), + SPH_C32(0x118ba3f9) }, + { SPH_C32(0xef440000), SPH_C32(0x4ecd0000), SPH_C32(0xa5460000), + SPH_C32(0xceb701ea), SPH_C32(0x222c6ce8), SPH_C32(0x2e79d3fe), + SPH_C32(0x400ddcf5), SPH_C32(0xcd7a9381), SPH_C32(0xb6ec0000), + SPH_C32(0xa28c0000), SPH_C32(0x67cd0000), SPH_C32(0x7b4f00b1), + SPH_C32(0x3ae1284a), SPH_C32(0x8dd13e7e), SPH_C32(0xe022c78e), + SPH_C32(0x8c47a9d0) }, + { SPH_C32(0xec790000), SPH_C32(0x467e0000), SPH_C32(0x567c0000), + SPH_C32(0xf47501ed), SPH_C32(0x7305e6b8), SPH_C32(0x4517b5e1), + SPH_C32(0x4ea81316), SPH_C32(0x2ba0ec7f), SPH_C32(0x1e360000), + SPH_C32(0x34320000), SPH_C32(0x3bd00000), SPH_C32(0x7c9500b3), + SPH_C32(0x4787bdc9), SPH_C32(0x92494ef4), SPH_C32(0x5b444f86), + SPH_C32(0x56c029d0) }, + { SPH_C32(0x479e0000), SPH_C32(0xd8730000), SPH_C32(0xf95b0000), + SPH_C32(0xc96d01e8), SPH_C32(0x5f4af96b), SPH_C32(0x31e1a374), + SPH_C32(0xfb6b54fd), SPH_C32(0x17fd1381), SPH_C32(0x1d0b0000), + SPH_C32(0x3c810000), SPH_C32(0xc8ea0000), SPH_C32(0x465700b4), + SPH_C32(0x16ae3799), SPH_C32(0xf92728eb), SPH_C32(0x55e18065), + SPH_C32(0xb01a562e) }, + { SPH_C32(0x44a30000), SPH_C32(0xd0c00000), SPH_C32(0x0a610000), + SPH_C32(0xf3af01ef), SPH_C32(0x0e63733b), SPH_C32(0x5a8fc56b), + SPH_C32(0xf5ce9b1e), SPH_C32(0xf1276c7f), SPH_C32(0xb5d10000), + SPH_C32(0xaa3f0000), SPH_C32(0x94f70000), SPH_C32(0x418d00b6), + SPH_C32(0x6bc8a21a), SPH_C32(0xe6bf5861), SPH_C32(0xee87086d), + SPH_C32(0x6a9dd62e) }, + { SPH_C32(0x7cff0000), SPH_C32(0x75ca0000), SPH_C32(0x1f470000), + SPH_C32(0x576701e2), SPH_C32(0x1515c2a6), SPH_C32(0xc835c4dc), + SPH_C32(0xd6f54a46), SPH_C32(0xe503782d), SPH_C32(0xb77f0000), + SPH_C32(0x450e0000), SPH_C32(0x8a360000), SPH_C32(0xb44300ba), + SPH_C32(0xb731a512), SPH_C32(0x31728a50), SPH_C32(0xe614a66f), + SPH_C32(0xdf2837ab) }, + { SPH_C32(0x7fc20000), SPH_C32(0x7d790000), SPH_C32(0xec7d0000), + SPH_C32(0x6da501e5), SPH_C32(0x443c48f6), SPH_C32(0xa35ba2c3), + SPH_C32(0xd85085a5), SPH_C32(0x03d907d3), SPH_C32(0x1fa50000), + SPH_C32(0xd3b00000), SPH_C32(0xd62b0000), SPH_C32(0xb39900b8), + SPH_C32(0xca573091), SPH_C32(0x2eeafada), SPH_C32(0x5d722e67), + SPH_C32(0x05afb7ab) }, + { SPH_C32(0xd4250000), SPH_C32(0xe3740000), SPH_C32(0x435a0000), + SPH_C32(0x50bd01e0), SPH_C32(0x68735725), SPH_C32(0xd7adb456), + SPH_C32(0x6d93c24e), SPH_C32(0x3f84f82d), SPH_C32(0x1c980000), + SPH_C32(0xdb030000), SPH_C32(0x25110000), SPH_C32(0x895b00bf), + SPH_C32(0x9b7ebac1), SPH_C32(0x45849cc5), SPH_C32(0x53d7e184), + SPH_C32(0xe375c855) }, + { SPH_C32(0xd7180000), SPH_C32(0xebc70000), SPH_C32(0xb0600000), + SPH_C32(0x6a7f01e7), SPH_C32(0x395add75), SPH_C32(0xbcc3d249), + SPH_C32(0x63360dad), SPH_C32(0xd95e87d3), SPH_C32(0xb4420000), + SPH_C32(0x4dbd0000), SPH_C32(0x790c0000), SPH_C32(0x8e8100bd), + SPH_C32(0xe6182f42), SPH_C32(0x5a1cec4f), SPH_C32(0xe8b1698c), + SPH_C32(0x39f24855) }, + { SPH_C32(0x7d6c0000), SPH_C32(0x92480000), SPH_C32(0xf2bc0000), + SPH_C32(0x986b01e9), SPH_C32(0x98c54ffe), SPH_C32(0x749670f2), + SPH_C32(0xd0c32ba7), SPH_C32(0xb66ce656), SPH_C32(0x25570000), + SPH_C32(0x998b0000), SPH_C32(0xddcc0000), SPH_C32(0xe29f00b9), + SPH_C32(0x0dd88604), SPH_C32(0x6b9d295c), SPH_C32(0x76da513d), + SPH_C32(0xa43e427c) }, + { SPH_C32(0x7e510000), SPH_C32(0x9afb0000), SPH_C32(0x01860000), + SPH_C32(0xa2a901ee), SPH_C32(0xc9ecc5ae), SPH_C32(0x1ff816ed), + SPH_C32(0xde66e444), SPH_C32(0x50b699a8), SPH_C32(0x8d8d0000), + SPH_C32(0x0f350000), SPH_C32(0x81d10000), SPH_C32(0xe54500bb), + SPH_C32(0x70be1387), SPH_C32(0x740559d6), SPH_C32(0xcdbcd935), + SPH_C32(0x7eb9c27c) }, + { SPH_C32(0xd5b60000), SPH_C32(0x04f60000), SPH_C32(0xaea10000), + SPH_C32(0x9fb101eb), SPH_C32(0xe5a3da7d), SPH_C32(0x6b0e0078), + SPH_C32(0x6ba5a3af), SPH_C32(0x6ceb6656), SPH_C32(0x8eb00000), + SPH_C32(0x07860000), SPH_C32(0x72eb0000), SPH_C32(0xdf8700bc), + SPH_C32(0x219799d7), SPH_C32(0x1f6b3fc9), SPH_C32(0xc31916d6), + SPH_C32(0x9863bd82) }, + { SPH_C32(0xd68b0000), SPH_C32(0x0c450000), SPH_C32(0x5d9b0000), + SPH_C32(0xa57301ec), SPH_C32(0xb48a502d), SPH_C32(0x00606667), + SPH_C32(0x65006c4c), SPH_C32(0x8a3119a8), SPH_C32(0x266a0000), + SPH_C32(0x91380000), SPH_C32(0x2ef60000), SPH_C32(0xd85d00be), + SPH_C32(0x5cf10c54), SPH_C32(0x00f34f43), SPH_C32(0x787f9ede), + SPH_C32(0x42e43d82) }, + { SPH_C32(0xb17f0000), SPH_C32(0xff4c0000), SPH_C32(0x0b130000), + SPH_C32(0x654801f2), SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), + SPH_C32(0x122528ab), SPH_C32(0x10b1d693), SPH_C32(0x24800000), + SPH_C32(0x01410000), SPH_C32(0xea4b0000), SPH_C32(0x07b000b3), + SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), SPH_C32(0x73e6aebc), + SPH_C32(0x495bbb99) }, + { SPH_C32(0xb2420000), SPH_C32(0xf7ff0000), SPH_C32(0xf8290000), + SPH_C32(0x5f8a01f5), SPH_C32(0xdbabed5f), SPH_C32(0xeaa59581), + SPH_C32(0x1c80e748), SPH_C32(0xf66ba96d), SPH_C32(0x8c5a0000), + SPH_C32(0x97ff0000), SPH_C32(0xb6560000), SPH_C32(0x006a00b1), + SPH_C32(0xc6c35713), SPH_C32(0x6110717f), SPH_C32(0xc88026b4), + SPH_C32(0x93dc3b99) }, + { SPH_C32(0x19a50000), SPH_C32(0x69f20000), SPH_C32(0x570e0000), + SPH_C32(0x629201f0), SPH_C32(0xf7e4f28c), SPH_C32(0x9e538314), + SPH_C32(0xa943a0a3), SPH_C32(0xca365693), SPH_C32(0x8f670000), + SPH_C32(0x9f4c0000), SPH_C32(0x456c0000), SPH_C32(0x3aa800b6), + SPH_C32(0x97eadd43), SPH_C32(0x0a7e1760), SPH_C32(0xc625e957), + SPH_C32(0x75064467) }, + { SPH_C32(0x1a980000), SPH_C32(0x61410000), SPH_C32(0xa4340000), + SPH_C32(0x585001f7), SPH_C32(0xa6cd78dc), SPH_C32(0xf53de50b), + SPH_C32(0xa7e66f40), SPH_C32(0x2cec296d), SPH_C32(0x27bd0000), + SPH_C32(0x09f20000), SPH_C32(0x19710000), SPH_C32(0x3d7200b4), + SPH_C32(0xea8c48c0), SPH_C32(0x15e667ea), SPH_C32(0x7d43615f), + SPH_C32(0xaf81c467) }, + { SPH_C32(0xb0ec0000), SPH_C32(0x18ce0000), SPH_C32(0xe6e80000), + SPH_C32(0xaa4401f9), SPH_C32(0x0752ea57), SPH_C32(0x3d6847b0), + SPH_C32(0x1413494a), SPH_C32(0x43de48e8), SPH_C32(0xb6a80000), + SPH_C32(0xddc40000), SPH_C32(0xbdb10000), SPH_C32(0x516c00b0), + SPH_C32(0x014ce186), SPH_C32(0x2467a2f9), SPH_C32(0xe32859ee), + SPH_C32(0x324dce4e) }, + { SPH_C32(0xb3d10000), SPH_C32(0x107d0000), SPH_C32(0x15d20000), + SPH_C32(0x908601fe), SPH_C32(0x567b6007), SPH_C32(0x560621af), + SPH_C32(0x1ab686a9), SPH_C32(0xa5043716), SPH_C32(0x1e720000), + SPH_C32(0x4b7a0000), SPH_C32(0xe1ac0000), SPH_C32(0x56b600b2), + SPH_C32(0x7c2a7405), SPH_C32(0x3bffd273), SPH_C32(0x584ed1e6), + SPH_C32(0xe8ca4e4e) }, + { SPH_C32(0x18360000), SPH_C32(0x8e700000), SPH_C32(0xbaf50000), + SPH_C32(0xad9e01fb), SPH_C32(0x7a347fd4), SPH_C32(0x22f0373a), + SPH_C32(0xaf75c142), SPH_C32(0x9959c8e8), SPH_C32(0x1d4f0000), + SPH_C32(0x43c90000), SPH_C32(0x12960000), SPH_C32(0x6c7400b5), + SPH_C32(0x2d03fe55), SPH_C32(0x5091b46c), SPH_C32(0x56eb1e05), + SPH_C32(0x0e1031b0) }, + { SPH_C32(0x1b0b0000), SPH_C32(0x86c30000), SPH_C32(0x49cf0000), + SPH_C32(0x975c01fc), SPH_C32(0x2b1df584), SPH_C32(0x499e5125), + SPH_C32(0xa1d00ea1), SPH_C32(0x7f83b716), SPH_C32(0xb5950000), + SPH_C32(0xd5770000), SPH_C32(0x4e8b0000), SPH_C32(0x6bae00b7), + SPH_C32(0x50656bd6), SPH_C32(0x4f09c4e6), SPH_C32(0xed8d960d), + SPH_C32(0xd497b1b0) }, + { SPH_C32(0x23570000), SPH_C32(0x23c90000), SPH_C32(0x5ce90000), + SPH_C32(0x339401f1), SPH_C32(0x306b4419), SPH_C32(0xdb245092), + SPH_C32(0x82ebdff9), SPH_C32(0x6ba7a344), SPH_C32(0xb73b0000), + SPH_C32(0x3a460000), SPH_C32(0x504a0000), SPH_C32(0x9e6000bb), + SPH_C32(0x8c9c6cde), SPH_C32(0x98c416d7), SPH_C32(0xe51e380f), + SPH_C32(0x61225035) }, + { SPH_C32(0x206a0000), SPH_C32(0x2b7a0000), SPH_C32(0xafd30000), + SPH_C32(0x095601f6), SPH_C32(0x6142ce49), SPH_C32(0xb04a368d), + SPH_C32(0x8c4e101a), SPH_C32(0x8d7ddcba), SPH_C32(0x1fe10000), + SPH_C32(0xacf80000), SPH_C32(0x0c570000), SPH_C32(0x99ba00b9), + SPH_C32(0xf1faf95d), SPH_C32(0x875c665d), SPH_C32(0x5e78b007), + SPH_C32(0xbba5d035) }, + { SPH_C32(0x8b8d0000), SPH_C32(0xb5770000), SPH_C32(0x00f40000), + SPH_C32(0x344e01f3), SPH_C32(0x4d0dd19a), SPH_C32(0xc4bc2018), + SPH_C32(0x398d57f1), SPH_C32(0xb1202344), SPH_C32(0x1cdc0000), + SPH_C32(0xa44b0000), SPH_C32(0xff6d0000), SPH_C32(0xa37800be), + SPH_C32(0xa0d3730d), SPH_C32(0xec320042), SPH_C32(0x50dd7fe4), + SPH_C32(0x5d7fafcb) }, + { SPH_C32(0x88b00000), SPH_C32(0xbdc40000), SPH_C32(0xf3ce0000), + SPH_C32(0x0e8c01f4), SPH_C32(0x1c245bca), SPH_C32(0xafd24607), + SPH_C32(0x37289812), SPH_C32(0x57fa5cba), SPH_C32(0xb4060000), + SPH_C32(0x32f50000), SPH_C32(0xa3700000), SPH_C32(0xa4a200bc), + SPH_C32(0xddb5e68e), SPH_C32(0xf3aa70c8), SPH_C32(0xebbbf7ec), + SPH_C32(0x87f82fcb) }, + { SPH_C32(0x22c40000), SPH_C32(0xc44b0000), SPH_C32(0xb1120000), + SPH_C32(0xfc9801fa), SPH_C32(0xbdbbc941), SPH_C32(0x6787e4bc), + SPH_C32(0x84ddbe18), SPH_C32(0x38c83d3f), SPH_C32(0x25130000), + SPH_C32(0xe6c30000), SPH_C32(0x07b00000), SPH_C32(0xc8bc00b8), + SPH_C32(0x36754fc8), SPH_C32(0xc22bb5db), SPH_C32(0x75d0cf5d), + SPH_C32(0x1a3425e2) }, + { SPH_C32(0x21f90000), SPH_C32(0xccf80000), SPH_C32(0x42280000), + SPH_C32(0xc65a01fd), SPH_C32(0xec924311), SPH_C32(0x0ce982a3), + SPH_C32(0x8a7871fb), SPH_C32(0xde1242c1), SPH_C32(0x8dc90000), + SPH_C32(0x707d0000), SPH_C32(0x5bad0000), SPH_C32(0xcf6600ba), + SPH_C32(0x4b13da4b), SPH_C32(0xddb3c551), SPH_C32(0xceb64755), + SPH_C32(0xc0b3a5e2) }, + { SPH_C32(0x8a1e0000), SPH_C32(0x52f50000), SPH_C32(0xed0f0000), + SPH_C32(0xfb4201f8), SPH_C32(0xc0dd5cc2), SPH_C32(0x781f9436), + SPH_C32(0x3fbb3610), SPH_C32(0xe24fbd3f), SPH_C32(0x8ef40000), + SPH_C32(0x78ce0000), SPH_C32(0xa8970000), SPH_C32(0xf5a400bd), + SPH_C32(0x1a3a501b), SPH_C32(0xb6dda34e), SPH_C32(0xc01388b6), + SPH_C32(0x2669da1c) }, + { SPH_C32(0x89230000), SPH_C32(0x5a460000), SPH_C32(0x1e350000), + SPH_C32(0xc18001ff), SPH_C32(0x91f4d692), SPH_C32(0x1371f229), + SPH_C32(0x311ef9f3), SPH_C32(0x0495c2c1), SPH_C32(0x262e0000), + SPH_C32(0xee700000), SPH_C32(0xf48a0000), SPH_C32(0xf27e00bf), + SPH_C32(0x675cc598), SPH_C32(0xa945d3c4), SPH_C32(0x7b7500be), + SPH_C32(0xfcee5a1c) }, + { SPH_C32(0x7b280000), SPH_C32(0x57420000), SPH_C32(0xa9e50000), + SPH_C32(0x634300a0), SPH_C32(0x9edb442f), SPH_C32(0x6d9995bb), + SPH_C32(0x27f83b03), SPH_C32(0xc7ff60f0), SPH_C32(0x95bb0000), + SPH_C32(0x81450000), SPH_C32(0x3b240000), SPH_C32(0x48db0140), + SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), SPH_C32(0x62c91877), + SPH_C32(0xe7e00a94) }, + { SPH_C32(0x78150000), SPH_C32(0x5ff10000), SPH_C32(0x5adf0000), + SPH_C32(0x598100a7), SPH_C32(0xcff2ce7f), SPH_C32(0x06f7f3a4), + SPH_C32(0x295df4e0), SPH_C32(0x21251f0e), SPH_C32(0x3d610000), + SPH_C32(0x17fb0000), SPH_C32(0x67390000), SPH_C32(0x4f010142), + SPH_C32(0x77ecf9d0), SPH_C32(0x496d1e66), SPH_C32(0xd9af907f), + SPH_C32(0x3d678a94) }, + { SPH_C32(0xd3f20000), SPH_C32(0xc1fc0000), SPH_C32(0xf5f80000), + SPH_C32(0x649900a2), SPH_C32(0xe3bdd1ac), SPH_C32(0x7201e531), + SPH_C32(0x9c9eb30b), SPH_C32(0x1d78e0f0), SPH_C32(0x3e5c0000), + SPH_C32(0x1f480000), SPH_C32(0x94030000), SPH_C32(0x75c30145), + SPH_C32(0x26c57380), SPH_C32(0x22037879), SPH_C32(0xd70a5f9c), + SPH_C32(0xdbbdf56a) }, + { SPH_C32(0xd0cf0000), SPH_C32(0xc94f0000), SPH_C32(0x06c20000), + SPH_C32(0x5e5b00a5), SPH_C32(0xb2945bfc), SPH_C32(0x196f832e), + SPH_C32(0x923b7ce8), SPH_C32(0xfba29f0e), SPH_C32(0x96860000), + SPH_C32(0x89f60000), SPH_C32(0xc81e0000), SPH_C32(0x72190147), + SPH_C32(0x5ba3e603), SPH_C32(0x3d9b08f3), SPH_C32(0x6c6cd794), + SPH_C32(0x013a756a) }, + { SPH_C32(0x7abb0000), SPH_C32(0xb0c00000), SPH_C32(0x441e0000), + SPH_C32(0xac4f00ab), SPH_C32(0x130bc977), SPH_C32(0xd13a2195), + SPH_C32(0x21ce5ae2), SPH_C32(0x9490fe8b), SPH_C32(0x07930000), + SPH_C32(0x5dc00000), SPH_C32(0x6cde0000), SPH_C32(0x1e070143), + SPH_C32(0xb0634f45), SPH_C32(0x0c1acde0), SPH_C32(0xf207ef25), + SPH_C32(0x9cf67f43) }, + { SPH_C32(0x79860000), SPH_C32(0xb8730000), SPH_C32(0xb7240000), + SPH_C32(0x968d00ac), SPH_C32(0x42224327), SPH_C32(0xba54478a), + SPH_C32(0x2f6b9501), SPH_C32(0x724a8175), SPH_C32(0xaf490000), + SPH_C32(0xcb7e0000), SPH_C32(0x30c30000), SPH_C32(0x19dd0141), + SPH_C32(0xcd05dac6), SPH_C32(0x1382bd6a), SPH_C32(0x4961672d), + SPH_C32(0x4671ff43) }, + { SPH_C32(0xd2610000), SPH_C32(0x267e0000), SPH_C32(0x18030000), + SPH_C32(0xab9500a9), SPH_C32(0x6e6d5cf4), SPH_C32(0xcea2511f), + SPH_C32(0x9aa8d2ea), SPH_C32(0x4e177e8b), SPH_C32(0xac740000), + SPH_C32(0xc3cd0000), SPH_C32(0xc3f90000), SPH_C32(0x231f0146), + SPH_C32(0x9c2c5096), SPH_C32(0x78ecdb75), SPH_C32(0x47c4a8ce), + SPH_C32(0xa0ab80bd) }, + { SPH_C32(0xd15c0000), SPH_C32(0x2ecd0000), SPH_C32(0xeb390000), + SPH_C32(0x915700ae), SPH_C32(0x3f44d6a4), SPH_C32(0xa5cc3700), + SPH_C32(0x940d1d09), SPH_C32(0xa8cd0175), SPH_C32(0x04ae0000), + SPH_C32(0x55730000), SPH_C32(0x9fe40000), SPH_C32(0x24c50144), + SPH_C32(0xe14ac515), SPH_C32(0x6774abff), SPH_C32(0xfca220c6), + SPH_C32(0x7a2c00bd) }, + { SPH_C32(0xe9000000), SPH_C32(0x8bc70000), SPH_C32(0xfe1f0000), + SPH_C32(0x359f00a3), SPH_C32(0x24326739), SPH_C32(0x377636b7), + SPH_C32(0xb736cc51), SPH_C32(0xbce91527), SPH_C32(0x06000000), + SPH_C32(0xba420000), SPH_C32(0x81250000), SPH_C32(0xd10b0148), + SPH_C32(0x3db3c21d), SPH_C32(0xb0b979ce), SPH_C32(0xf4318ec4), + SPH_C32(0xcf99e138) }, + { SPH_C32(0xea3d0000), SPH_C32(0x83740000), SPH_C32(0x0d250000), + SPH_C32(0x0f5d00a4), SPH_C32(0x751bed69), SPH_C32(0x5c1850a8), + SPH_C32(0xb99303b2), SPH_C32(0x5a336ad9), SPH_C32(0xaeda0000), + SPH_C32(0x2cfc0000), SPH_C32(0xdd380000), SPH_C32(0xd6d1014a), + SPH_C32(0x40d5579e), SPH_C32(0xaf210944), SPH_C32(0x4f5706cc), + SPH_C32(0x151e6138) }, + { SPH_C32(0x41da0000), SPH_C32(0x1d790000), SPH_C32(0xa2020000), + SPH_C32(0x324500a1), SPH_C32(0x5954f2ba), SPH_C32(0x28ee463d), + SPH_C32(0x0c504459), SPH_C32(0x666e9527), SPH_C32(0xade70000), + SPH_C32(0x244f0000), SPH_C32(0x2e020000), SPH_C32(0xec13014d), + SPH_C32(0x11fcddce), SPH_C32(0xc44f6f5b), SPH_C32(0x41f2c92f), + SPH_C32(0xf3c41ec6) }, + { SPH_C32(0x42e70000), SPH_C32(0x15ca0000), SPH_C32(0x51380000), + SPH_C32(0x088700a6), SPH_C32(0x087d78ea), SPH_C32(0x43802022), + SPH_C32(0x02f58bba), SPH_C32(0x80b4ead9), SPH_C32(0x053d0000), + SPH_C32(0xb2f10000), SPH_C32(0x721f0000), SPH_C32(0xebc9014f), + SPH_C32(0x6c9a484d), SPH_C32(0xdbd71fd1), SPH_C32(0xfa944127), + SPH_C32(0x29439ec6) }, + { SPH_C32(0xe8930000), SPH_C32(0x6c450000), SPH_C32(0x13e40000), + SPH_C32(0xfa9300a8), SPH_C32(0xa9e2ea61), SPH_C32(0x8bd58299), + SPH_C32(0xb100adb0), SPH_C32(0xef868b5c), SPH_C32(0x94280000), + SPH_C32(0x66c70000), SPH_C32(0xd6df0000), SPH_C32(0x87d7014b), + SPH_C32(0x875ae10b), SPH_C32(0xea56dac2), SPH_C32(0x64ff7996), + SPH_C32(0xb48f94ef) }, + { SPH_C32(0xebae0000), SPH_C32(0x64f60000), SPH_C32(0xe0de0000), + SPH_C32(0xc05100af), SPH_C32(0xf8cb6031), SPH_C32(0xe0bbe486), + SPH_C32(0xbfa56253), SPH_C32(0x095cf4a2), SPH_C32(0x3cf20000), + SPH_C32(0xf0790000), SPH_C32(0x8ac20000), SPH_C32(0x800d0149), + SPH_C32(0xfa3c7488), SPH_C32(0xf5ceaa48), SPH_C32(0xdf99f19e), + SPH_C32(0x6e0814ef) }, + { SPH_C32(0x40490000), SPH_C32(0xfafb0000), SPH_C32(0x4ff90000), + SPH_C32(0xfd4900aa), SPH_C32(0xd4847fe2), SPH_C32(0x944df213), + SPH_C32(0x0a6625b8), SPH_C32(0x35010b5c), SPH_C32(0x3fcf0000), + SPH_C32(0xf8ca0000), SPH_C32(0x79f80000), SPH_C32(0xbacf014e), + SPH_C32(0xab15fed8), SPH_C32(0x9ea0cc57), SPH_C32(0xd13c3e7d), + SPH_C32(0x88d26b11) }, + { SPH_C32(0x43740000), SPH_C32(0xf2480000), SPH_C32(0xbcc30000), + SPH_C32(0xc78b00ad), SPH_C32(0x85adf5b2), SPH_C32(0xff23940c), + SPH_C32(0x04c3ea5b), SPH_C32(0xd3db74a2), SPH_C32(0x97150000), + SPH_C32(0x6e740000), SPH_C32(0x25e50000), SPH_C32(0xbd15014c), + SPH_C32(0xd6736b5b), SPH_C32(0x8138bcdd), SPH_C32(0x6a5ab675), + SPH_C32(0x5255eb11) }, + { SPH_C32(0x24800000), SPH_C32(0x01410000), SPH_C32(0xea4b0000), + SPH_C32(0x07b000b3), SPH_C32(0xbba5c290), SPH_C32(0x7e8801f5), + SPH_C32(0x73e6aebc), SPH_C32(0x495bbb99), SPH_C32(0x95ff0000), + SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), SPH_C32(0x62f80141), + SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), SPH_C32(0x61c38617), + SPH_C32(0x59ea6d0a) }, + { SPH_C32(0x27bd0000), SPH_C32(0x09f20000), SPH_C32(0x19710000), + SPH_C32(0x3d7200b4), SPH_C32(0xea8c48c0), SPH_C32(0x15e667ea), + SPH_C32(0x7d43615f), SPH_C32(0xaf81c467), SPH_C32(0x3d250000), + SPH_C32(0x68b30000), SPH_C32(0xbd450000), SPH_C32(0x65220143), + SPH_C32(0x4c41301c), SPH_C32(0xe0db82e1), SPH_C32(0xdaa50e1f), + SPH_C32(0x836ded0a) }, + { SPH_C32(0x8c5a0000), SPH_C32(0x97ff0000), SPH_C32(0xb6560000), + SPH_C32(0x006a00b1), SPH_C32(0xc6c35713), SPH_C32(0x6110717f), + SPH_C32(0xc88026b4), SPH_C32(0x93dc3b99), SPH_C32(0x3e180000), + SPH_C32(0x60000000), SPH_C32(0x4e7f0000), SPH_C32(0x5fe00144), + SPH_C32(0x1d68ba4c), SPH_C32(0x8bb5e4fe), SPH_C32(0xd400c1fc), + SPH_C32(0x65b792f4) }, + { SPH_C32(0x8f670000), SPH_C32(0x9f4c0000), SPH_C32(0x456c0000), + SPH_C32(0x3aa800b6), SPH_C32(0x97eadd43), SPH_C32(0x0a7e1760), + SPH_C32(0xc625e957), SPH_C32(0x75064467), SPH_C32(0x96c20000), + SPH_C32(0xf6be0000), SPH_C32(0x12620000), SPH_C32(0x583a0146), + SPH_C32(0x600e2fcf), SPH_C32(0x942d9474), SPH_C32(0x6f6649f4), + SPH_C32(0xbf3012f4) }, + { SPH_C32(0x25130000), SPH_C32(0xe6c30000), SPH_C32(0x07b00000), + SPH_C32(0xc8bc00b8), SPH_C32(0x36754fc8), SPH_C32(0xc22bb5db), + SPH_C32(0x75d0cf5d), SPH_C32(0x1a3425e2), SPH_C32(0x07d70000), + SPH_C32(0x22880000), SPH_C32(0xb6a20000), SPH_C32(0x34240142), + SPH_C32(0x8bce8689), SPH_C32(0xa5ac5167), SPH_C32(0xf10d7145), + SPH_C32(0x22fc18dd) }, + { SPH_C32(0x262e0000), SPH_C32(0xee700000), SPH_C32(0xf48a0000), + SPH_C32(0xf27e00bf), SPH_C32(0x675cc598), SPH_C32(0xa945d3c4), + SPH_C32(0x7b7500be), SPH_C32(0xfcee5a1c), SPH_C32(0xaf0d0000), + SPH_C32(0xb4360000), SPH_C32(0xeabf0000), SPH_C32(0x33fe0140), + SPH_C32(0xf6a8130a), SPH_C32(0xba3421ed), SPH_C32(0x4a6bf94d), + SPH_C32(0xf87b98dd) }, + { SPH_C32(0x8dc90000), SPH_C32(0x707d0000), SPH_C32(0x5bad0000), + SPH_C32(0xcf6600ba), SPH_C32(0x4b13da4b), SPH_C32(0xddb3c551), + SPH_C32(0xceb64755), SPH_C32(0xc0b3a5e2), SPH_C32(0xac300000), + SPH_C32(0xbc850000), SPH_C32(0x19850000), SPH_C32(0x093c0147), + SPH_C32(0xa781995a), SPH_C32(0xd15a47f2), SPH_C32(0x44ce36ae), + SPH_C32(0x1ea1e723) }, + { SPH_C32(0x8ef40000), SPH_C32(0x78ce0000), SPH_C32(0xa8970000), + SPH_C32(0xf5a400bd), SPH_C32(0x1a3a501b), SPH_C32(0xb6dda34e), + SPH_C32(0xc01388b6), SPH_C32(0x2669da1c), SPH_C32(0x04ea0000), + SPH_C32(0x2a3b0000), SPH_C32(0x45980000), SPH_C32(0x0ee60145), + SPH_C32(0xdae70cd9), SPH_C32(0xcec23778), SPH_C32(0xffa8bea6), + SPH_C32(0xc4266723) }, + { SPH_C32(0xb6a80000), SPH_C32(0xddc40000), SPH_C32(0xbdb10000), + SPH_C32(0x516c00b0), SPH_C32(0x014ce186), SPH_C32(0x2467a2f9), + SPH_C32(0xe32859ee), SPH_C32(0x324dce4e), SPH_C32(0x06440000), + SPH_C32(0xc50a0000), SPH_C32(0x5b590000), SPH_C32(0xfb280149), + SPH_C32(0x061e0bd1), SPH_C32(0x190fe549), SPH_C32(0xf73b10a4), + SPH_C32(0x719386a6) }, + { SPH_C32(0xb5950000), SPH_C32(0xd5770000), SPH_C32(0x4e8b0000), + SPH_C32(0x6bae00b7), SPH_C32(0x50656bd6), SPH_C32(0x4f09c4e6), + SPH_C32(0xed8d960d), SPH_C32(0xd497b1b0), SPH_C32(0xae9e0000), + SPH_C32(0x53b40000), SPH_C32(0x07440000), SPH_C32(0xfcf2014b), + SPH_C32(0x7b789e52), SPH_C32(0x069795c3), SPH_C32(0x4c5d98ac), + SPH_C32(0xab1406a6) }, + { SPH_C32(0x1e720000), SPH_C32(0x4b7a0000), SPH_C32(0xe1ac0000), + SPH_C32(0x56b600b2), SPH_C32(0x7c2a7405), SPH_C32(0x3bffd273), + SPH_C32(0x584ed1e6), SPH_C32(0xe8ca4e4e), SPH_C32(0xada30000), + SPH_C32(0x5b070000), SPH_C32(0xf47e0000), SPH_C32(0xc630014c), + SPH_C32(0x2a511402), SPH_C32(0x6df9f3dc), SPH_C32(0x42f8574f), + SPH_C32(0x4dce7958) }, + { SPH_C32(0x1d4f0000), SPH_C32(0x43c90000), SPH_C32(0x12960000), + SPH_C32(0x6c7400b5), SPH_C32(0x2d03fe55), SPH_C32(0x5091b46c), + SPH_C32(0x56eb1e05), SPH_C32(0x0e1031b0), SPH_C32(0x05790000), + SPH_C32(0xcdb90000), SPH_C32(0xa8630000), SPH_C32(0xc1ea014e), + SPH_C32(0x57378181), SPH_C32(0x72618356), SPH_C32(0xf99edf47), + SPH_C32(0x9749f958) }, + { SPH_C32(0xb73b0000), SPH_C32(0x3a460000), SPH_C32(0x504a0000), + SPH_C32(0x9e6000bb), SPH_C32(0x8c9c6cde), SPH_C32(0x98c416d7), + SPH_C32(0xe51e380f), SPH_C32(0x61225035), SPH_C32(0x946c0000), + SPH_C32(0x198f0000), SPH_C32(0x0ca30000), SPH_C32(0xadf4014a), + SPH_C32(0xbcf728c7), SPH_C32(0x43e04645), SPH_C32(0x67f5e7f6), + SPH_C32(0x0a85f371) }, + { SPH_C32(0xb4060000), SPH_C32(0x32f50000), SPH_C32(0xa3700000), + SPH_C32(0xa4a200bc), SPH_C32(0xddb5e68e), SPH_C32(0xf3aa70c8), + SPH_C32(0xebbbf7ec), SPH_C32(0x87f82fcb), SPH_C32(0x3cb60000), + SPH_C32(0x8f310000), SPH_C32(0x50be0000), SPH_C32(0xaa2e0148), + SPH_C32(0xc191bd44), SPH_C32(0x5c7836cf), SPH_C32(0xdc936ffe), + SPH_C32(0xd0027371) }, + { SPH_C32(0x1fe10000), SPH_C32(0xacf80000), SPH_C32(0x0c570000), + SPH_C32(0x99ba00b9), SPH_C32(0xf1faf95d), SPH_C32(0x875c665d), + SPH_C32(0x5e78b007), SPH_C32(0xbba5d035), SPH_C32(0x3f8b0000), + SPH_C32(0x87820000), SPH_C32(0xa3840000), SPH_C32(0x90ec014f), + SPH_C32(0x90b83714), SPH_C32(0x371650d0), SPH_C32(0xd236a01d), + SPH_C32(0x36d80c8f) }, + { SPH_C32(0x1cdc0000), SPH_C32(0xa44b0000), SPH_C32(0xff6d0000), + SPH_C32(0xa37800be), SPH_C32(0xa0d3730d), SPH_C32(0xec320042), + SPH_C32(0x50dd7fe4), SPH_C32(0x5d7fafcb), SPH_C32(0x97510000), + SPH_C32(0x113c0000), SPH_C32(0xff990000), SPH_C32(0x9736014d), + SPH_C32(0xeddea297), SPH_C32(0x288e205a), SPH_C32(0x69502815), + SPH_C32(0xec5f8c8f) }, + { SPH_C32(0x7b6c0000), SPH_C32(0x280a0000), SPH_C32(0x73990000), + SPH_C32(0x496000a1), SPH_C32(0xa5768de3), SPH_C32(0xc42f093c), + SPH_C32(0x24f2a563), SPH_C32(0x79f5076e), SPH_C32(0xca570000), + SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), SPH_C32(0x060b0152), + SPH_C32(0x14592320), SPH_C32(0xec526625), SPH_C32(0x35dd13a8), + SPH_C32(0xd74eb663) }, + { SPH_C32(0x78510000), SPH_C32(0x20b90000), SPH_C32(0x80a30000), + SPH_C32(0x73a200a6), SPH_C32(0xf45f07b3), SPH_C32(0xaf416f23), + SPH_C32(0x2a576a80), SPH_C32(0x9f2f7890), SPH_C32(0x628d0000), + SPH_C32(0x3eb00000), SPH_C32(0xfeeb0000), SPH_C32(0x01d10150), + SPH_C32(0x693fb6a3), SPH_C32(0xf3ca16af), SPH_C32(0x8ebb9ba0), + SPH_C32(0x0dc93663) }, + { SPH_C32(0xd3b60000), SPH_C32(0xbeb40000), SPH_C32(0x2f840000), + SPH_C32(0x4eba00a3), SPH_C32(0xd8101860), SPH_C32(0xdbb779b6), + SPH_C32(0x9f942d6b), SPH_C32(0xa372876e), SPH_C32(0x61b00000), + SPH_C32(0x36030000), SPH_C32(0x0dd10000), SPH_C32(0x3b130157), + SPH_C32(0x38163cf3), SPH_C32(0x98a470b0), SPH_C32(0x801e5443), + SPH_C32(0xeb13499d) }, + { SPH_C32(0xd08b0000), SPH_C32(0xb6070000), SPH_C32(0xdcbe0000), + SPH_C32(0x747800a4), SPH_C32(0x89399230), SPH_C32(0xb0d91fa9), + SPH_C32(0x9131e288), SPH_C32(0x45a8f890), SPH_C32(0xc96a0000), + SPH_C32(0xa0bd0000), SPH_C32(0x51cc0000), SPH_C32(0x3cc90155), + SPH_C32(0x4570a970), SPH_C32(0x873c003a), SPH_C32(0x3b78dc4b), + SPH_C32(0x3194c99d) }, + { SPH_C32(0x7aff0000), SPH_C32(0xcf880000), SPH_C32(0x9e620000), + SPH_C32(0x866c00aa), SPH_C32(0x28a600bb), SPH_C32(0x788cbd12), + SPH_C32(0x22c4c482), SPH_C32(0x2a9a9915), SPH_C32(0x587f0000), + SPH_C32(0x748b0000), SPH_C32(0xf50c0000), SPH_C32(0x50d70151), + SPH_C32(0xaeb00036), SPH_C32(0xb6bdc529), SPH_C32(0xa513e4fa), + SPH_C32(0xac58c3b4) }, + { SPH_C32(0x79c20000), SPH_C32(0xc73b0000), SPH_C32(0x6d580000), + SPH_C32(0xbcae00ad), SPH_C32(0x798f8aeb), SPH_C32(0x13e2db0d), + SPH_C32(0x2c610b61), SPH_C32(0xcc40e6eb), SPH_C32(0xf0a50000), + SPH_C32(0xe2350000), SPH_C32(0xa9110000), SPH_C32(0x570d0153), + SPH_C32(0xd3d695b5), SPH_C32(0xa925b5a3), SPH_C32(0x1e756cf2), + SPH_C32(0x76df43b4) }, + { SPH_C32(0xd2250000), SPH_C32(0x59360000), SPH_C32(0xc27f0000), + SPH_C32(0x81b600a8), SPH_C32(0x55c09538), SPH_C32(0x6714cd98), + SPH_C32(0x99a24c8a), SPH_C32(0xf01d1915), SPH_C32(0xf3980000), + SPH_C32(0xea860000), SPH_C32(0x5a2b0000), SPH_C32(0x6dcf0154), + SPH_C32(0x82ff1fe5), SPH_C32(0xc24bd3bc), SPH_C32(0x10d0a311), + SPH_C32(0x90053c4a) }, + { SPH_C32(0xd1180000), SPH_C32(0x51850000), SPH_C32(0x31450000), + SPH_C32(0xbb7400af), SPH_C32(0x04e91f68), SPH_C32(0x0c7aab87), + SPH_C32(0x97078369), SPH_C32(0x16c766eb), SPH_C32(0x5b420000), + SPH_C32(0x7c380000), SPH_C32(0x06360000), SPH_C32(0x6a150156), + SPH_C32(0xff998a66), SPH_C32(0xddd3a336), SPH_C32(0xabb62b19), + SPH_C32(0x4a82bc4a) }, + { SPH_C32(0xe9440000), SPH_C32(0xf48f0000), SPH_C32(0x24630000), + SPH_C32(0x1fbc00a2), SPH_C32(0x1f9faef5), SPH_C32(0x9ec0aa30), + SPH_C32(0xb43c5231), SPH_C32(0x02e372b9), SPH_C32(0x59ec0000), + SPH_C32(0x93090000), SPH_C32(0x18f70000), SPH_C32(0x9fdb015a), + SPH_C32(0x23608d6e), SPH_C32(0x0a1e7107), SPH_C32(0xa325851b), + SPH_C32(0xff375dcf) }, + { SPH_C32(0xea790000), SPH_C32(0xfc3c0000), SPH_C32(0xd7590000), + SPH_C32(0x257e00a5), SPH_C32(0x4eb624a5), SPH_C32(0xf5aecc2f), + SPH_C32(0xba999dd2), SPH_C32(0xe4390d47), SPH_C32(0xf1360000), + SPH_C32(0x05b70000), SPH_C32(0x44ea0000), SPH_C32(0x98010158), + SPH_C32(0x5e0618ed), SPH_C32(0x1586018d), SPH_C32(0x18430d13), + SPH_C32(0x25b0ddcf) }, + { SPH_C32(0x419e0000), SPH_C32(0x62310000), SPH_C32(0x787e0000), + SPH_C32(0x186600a0), SPH_C32(0x62f93b76), SPH_C32(0x8158daba), + SPH_C32(0x0f5ada39), SPH_C32(0xd864f2b9), SPH_C32(0xf20b0000), + SPH_C32(0x0d040000), SPH_C32(0xb7d00000), SPH_C32(0xa2c3015f), + SPH_C32(0x0f2f92bd), SPH_C32(0x7ee86792), SPH_C32(0x16e6c2f0), + SPH_C32(0xc36aa231) }, + { SPH_C32(0x42a30000), SPH_C32(0x6a820000), SPH_C32(0x8b440000), + SPH_C32(0x22a400a7), SPH_C32(0x33d0b126), SPH_C32(0xea36bca5), + SPH_C32(0x01ff15da), SPH_C32(0x3ebe8d47), SPH_C32(0x5ad10000), + SPH_C32(0x9bba0000), SPH_C32(0xebcd0000), SPH_C32(0xa519015d), + SPH_C32(0x7249073e), SPH_C32(0x61701718), SPH_C32(0xad804af8), + SPH_C32(0x19ed2231) }, + { SPH_C32(0xe8d70000), SPH_C32(0x130d0000), SPH_C32(0xc9980000), + SPH_C32(0xd0b000a9), SPH_C32(0x924f23ad), SPH_C32(0x22631e1e), + SPH_C32(0xb20a33d0), SPH_C32(0x518cecc2), SPH_C32(0xcbc40000), + SPH_C32(0x4f8c0000), SPH_C32(0x4f0d0000), SPH_C32(0xc9070159), + SPH_C32(0x9989ae78), SPH_C32(0x50f1d20b), SPH_C32(0x33eb7249), + SPH_C32(0x84212818) }, + { SPH_C32(0xebea0000), SPH_C32(0x1bbe0000), SPH_C32(0x3aa20000), + SPH_C32(0xea7200ae), SPH_C32(0xc366a9fd), SPH_C32(0x490d7801), + SPH_C32(0xbcaffc33), SPH_C32(0xb756933c), SPH_C32(0x631e0000), + SPH_C32(0xd9320000), SPH_C32(0x13100000), SPH_C32(0xcedd015b), + SPH_C32(0xe4ef3bfb), SPH_C32(0x4f69a281), SPH_C32(0x888dfa41), + SPH_C32(0x5ea6a818) }, + { SPH_C32(0x400d0000), SPH_C32(0x85b30000), SPH_C32(0x95850000), + SPH_C32(0xd76a00ab), SPH_C32(0xef29b62e), SPH_C32(0x3dfb6e94), + SPH_C32(0x096cbbd8), SPH_C32(0x8b0b6cc2), SPH_C32(0x60230000), + SPH_C32(0xd1810000), SPH_C32(0xe02a0000), SPH_C32(0xf41f015c), + SPH_C32(0xb5c6b1ab), SPH_C32(0x2407c49e), SPH_C32(0x862835a2), + SPH_C32(0xb87cd7e6) }, + { SPH_C32(0x43300000), SPH_C32(0x8d000000), SPH_C32(0x66bf0000), + SPH_C32(0xeda800ac), SPH_C32(0xbe003c7e), SPH_C32(0x5695088b), + SPH_C32(0x07c9743b), SPH_C32(0x6dd1133c), SPH_C32(0xc8f90000), + SPH_C32(0x473f0000), SPH_C32(0xbc370000), SPH_C32(0xf3c5015e), + SPH_C32(0xc8a02428), SPH_C32(0x3b9fb414), SPH_C32(0x3d4ebdaa), + SPH_C32(0x62fb57e6) }, + { SPH_C32(0x24c40000), SPH_C32(0x7e090000), SPH_C32(0x30370000), + SPH_C32(0x2d9300b2), SPH_C32(0x80080b5c), SPH_C32(0xd73e9d72), + SPH_C32(0x70ec30dc), SPH_C32(0xf751dc07), SPH_C32(0xca130000), + SPH_C32(0xd7460000), SPH_C32(0x788a0000), SPH_C32(0x2c280153), + SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), SPH_C32(0x36d78dc8), + SPH_C32(0x6944d1fd) }, + { SPH_C32(0x27f90000), SPH_C32(0x76ba0000), SPH_C32(0xc30d0000), + SPH_C32(0x175100b5), SPH_C32(0xd121810c), SPH_C32(0xbc50fb6d), + SPH_C32(0x7e49ff3f), SPH_C32(0x118ba3f9), SPH_C32(0x62c90000), + SPH_C32(0x41f80000), SPH_C32(0x24970000), SPH_C32(0x2bf20151), + SPH_C32(0x52927f6f), SPH_C32(0x5a7c8a28), SPH_C32(0x8db105c0), + SPH_C32(0xb3c351fd) }, + { SPH_C32(0x8c1e0000), SPH_C32(0xe8b70000), SPH_C32(0x6c2a0000), + SPH_C32(0x2a4900b0), SPH_C32(0xfd6e9edf), SPH_C32(0xc8a6edf8), + SPH_C32(0xcb8ab8d4), SPH_C32(0x2dd65c07), SPH_C32(0x61f40000), + SPH_C32(0x494b0000), SPH_C32(0xd7ad0000), SPH_C32(0x11300156), + SPH_C32(0x03bbf53f), SPH_C32(0x3112ec37), SPH_C32(0x8314ca23), + SPH_C32(0x55192e03) }, + { SPH_C32(0x8f230000), SPH_C32(0xe0040000), SPH_C32(0x9f100000), + SPH_C32(0x108b00b7), SPH_C32(0xac47148f), SPH_C32(0xa3c88be7), + SPH_C32(0xc52f7737), SPH_C32(0xcb0c23f9), SPH_C32(0xc92e0000), + SPH_C32(0xdff50000), SPH_C32(0x8bb00000), SPH_C32(0x16ea0154), + SPH_C32(0x7edd60bc), SPH_C32(0x2e8a9cbd), SPH_C32(0x3872422b), + SPH_C32(0x8f9eae03) }, + { SPH_C32(0x25570000), SPH_C32(0x998b0000), SPH_C32(0xddcc0000), + SPH_C32(0xe29f00b9), SPH_C32(0x0dd88604), SPH_C32(0x6b9d295c), + SPH_C32(0x76da513d), SPH_C32(0xa43e427c), SPH_C32(0x583b0000), + SPH_C32(0x0bc30000), SPH_C32(0x2f700000), SPH_C32(0x7af40150), + SPH_C32(0x951dc9fa), SPH_C32(0x1f0b59ae), SPH_C32(0xa6197a9a), + SPH_C32(0x1252a42a) }, + { SPH_C32(0x266a0000), SPH_C32(0x91380000), SPH_C32(0x2ef60000), + SPH_C32(0xd85d00be), SPH_C32(0x5cf10c54), SPH_C32(0x00f34f43), + SPH_C32(0x787f9ede), SPH_C32(0x42e43d82), SPH_C32(0xf0e10000), + SPH_C32(0x9d7d0000), SPH_C32(0x736d0000), SPH_C32(0x7d2e0152), + SPH_C32(0xe87b5c79), SPH_C32(0x00932924), SPH_C32(0x1d7ff292), + SPH_C32(0xc8d5242a) }, + { SPH_C32(0x8d8d0000), SPH_C32(0x0f350000), SPH_C32(0x81d10000), + SPH_C32(0xe54500bb), SPH_C32(0x70be1387), SPH_C32(0x740559d6), + SPH_C32(0xcdbcd935), SPH_C32(0x7eb9c27c), SPH_C32(0xf3dc0000), + SPH_C32(0x95ce0000), SPH_C32(0x80570000), SPH_C32(0x47ec0155), + SPH_C32(0xb952d629), SPH_C32(0x6bfd4f3b), SPH_C32(0x13da3d71), + SPH_C32(0x2e0f5bd4) }, + { SPH_C32(0x8eb00000), SPH_C32(0x07860000), SPH_C32(0x72eb0000), + SPH_C32(0xdf8700bc), SPH_C32(0x219799d7), SPH_C32(0x1f6b3fc9), + SPH_C32(0xc31916d6), SPH_C32(0x9863bd82), SPH_C32(0x5b060000), + SPH_C32(0x03700000), SPH_C32(0xdc4a0000), SPH_C32(0x40360157), + SPH_C32(0xc43443aa), SPH_C32(0x74653fb1), SPH_C32(0xa8bcb579), + SPH_C32(0xf488dbd4) }, + { SPH_C32(0xb6ec0000), SPH_C32(0xa28c0000), SPH_C32(0x67cd0000), + SPH_C32(0x7b4f00b1), SPH_C32(0x3ae1284a), SPH_C32(0x8dd13e7e), + SPH_C32(0xe022c78e), SPH_C32(0x8c47a9d0), SPH_C32(0x59a80000), + SPH_C32(0xec410000), SPH_C32(0xc28b0000), SPH_C32(0xb5f8015b), + SPH_C32(0x18cd44a2), SPH_C32(0xa3a8ed80), SPH_C32(0xa02f1b7b), + SPH_C32(0x413d3a51) }, + { SPH_C32(0xb5d10000), SPH_C32(0xaa3f0000), SPH_C32(0x94f70000), + SPH_C32(0x418d00b6), SPH_C32(0x6bc8a21a), SPH_C32(0xe6bf5861), + SPH_C32(0xee87086d), SPH_C32(0x6a9dd62e), SPH_C32(0xf1720000), + SPH_C32(0x7aff0000), SPH_C32(0x9e960000), SPH_C32(0xb2220159), + SPH_C32(0x65abd121), SPH_C32(0xbc309d0a), SPH_C32(0x1b499373), + SPH_C32(0x9bbaba51) }, + { SPH_C32(0x1e360000), SPH_C32(0x34320000), SPH_C32(0x3bd00000), + SPH_C32(0x7c9500b3), SPH_C32(0x4787bdc9), SPH_C32(0x92494ef4), + SPH_C32(0x5b444f86), SPH_C32(0x56c029d0), SPH_C32(0xf24f0000), + SPH_C32(0x724c0000), SPH_C32(0x6dac0000), SPH_C32(0x88e0015e), + SPH_C32(0x34825b71), SPH_C32(0xd75efb15), SPH_C32(0x15ec5c90), + SPH_C32(0x7d60c5af) }, + { SPH_C32(0x1d0b0000), SPH_C32(0x3c810000), SPH_C32(0xc8ea0000), + SPH_C32(0x465700b4), SPH_C32(0x16ae3799), SPH_C32(0xf92728eb), + SPH_C32(0x55e18065), SPH_C32(0xb01a562e), SPH_C32(0x5a950000), + SPH_C32(0xe4f20000), SPH_C32(0x31b10000), SPH_C32(0x8f3a015c), + SPH_C32(0x49e4cef2), SPH_C32(0xc8c68b9f), SPH_C32(0xae8ad498), + SPH_C32(0xa7e745af) }, + { SPH_C32(0xb77f0000), SPH_C32(0x450e0000), SPH_C32(0x8a360000), + SPH_C32(0xb44300ba), SPH_C32(0xb731a512), SPH_C32(0x31728a50), + SPH_C32(0xe614a66f), SPH_C32(0xdf2837ab), SPH_C32(0xcb800000), + SPH_C32(0x30c40000), SPH_C32(0x95710000), SPH_C32(0xe3240158), + SPH_C32(0xa22467b4), SPH_C32(0xf9474e8c), SPH_C32(0x30e1ec29), + SPH_C32(0x3a2b4f86) }, + { SPH_C32(0xb4420000), SPH_C32(0x4dbd0000), SPH_C32(0x790c0000), + SPH_C32(0x8e8100bd), SPH_C32(0xe6182f42), SPH_C32(0x5a1cec4f), + SPH_C32(0xe8b1698c), SPH_C32(0x39f24855), SPH_C32(0x635a0000), + SPH_C32(0xa67a0000), SPH_C32(0xc96c0000), SPH_C32(0xe4fe015a), + SPH_C32(0xdf42f237), SPH_C32(0xe6df3e06), SPH_C32(0x8b876421), + SPH_C32(0xe0accf86) }, + { SPH_C32(0x1fa50000), SPH_C32(0xd3b00000), SPH_C32(0xd62b0000), + SPH_C32(0xb39900b8), SPH_C32(0xca573091), SPH_C32(0x2eeafada), + SPH_C32(0x5d722e67), SPH_C32(0x05afb7ab), SPH_C32(0x60670000), + SPH_C32(0xaec90000), SPH_C32(0x3a560000), SPH_C32(0xde3c015d), + SPH_C32(0x8e6b7867), SPH_C32(0x8db15819), SPH_C32(0x8522abc2), + SPH_C32(0x0676b078) }, + { SPH_C32(0x1c980000), SPH_C32(0xdb030000), SPH_C32(0x25110000), + SPH_C32(0x895b00bf), SPH_C32(0x9b7ebac1), SPH_C32(0x45849cc5), + SPH_C32(0x53d7e184), SPH_C32(0xe375c855), SPH_C32(0xc8bd0000), + SPH_C32(0x38770000), SPH_C32(0x664b0000), SPH_C32(0xd9e6015f), + SPH_C32(0xf30dede4), SPH_C32(0x92292893), SPH_C32(0x3e4423ca), + SPH_C32(0xdcf13078) }, + { SPH_C32(0x95bb0000), SPH_C32(0x81450000), SPH_C32(0x3b240000), + SPH_C32(0x48db0140), SPH_C32(0x0a8a6c53), SPH_C32(0x56f56eec), + SPH_C32(0x62c91877), SPH_C32(0xe7e00a94), SPH_C32(0xee930000), + SPH_C32(0xd6070000), SPH_C32(0x92c10000), SPH_C32(0x2b9801e0), + SPH_C32(0x9451287c), SPH_C32(0x3b6cfb57), SPH_C32(0x45312374), + SPH_C32(0x201f6a64) }, + { SPH_C32(0x96860000), SPH_C32(0x89f60000), SPH_C32(0xc81e0000), + SPH_C32(0x72190147), SPH_C32(0x5ba3e603), SPH_C32(0x3d9b08f3), + SPH_C32(0x6c6cd794), SPH_C32(0x013a756a), SPH_C32(0x46490000), + SPH_C32(0x40b90000), SPH_C32(0xcedc0000), SPH_C32(0x2c4201e2), + SPH_C32(0xe937bdff), SPH_C32(0x24f48bdd), SPH_C32(0xfe57ab7c), + SPH_C32(0xfa98ea64) }, + { SPH_C32(0x3d610000), SPH_C32(0x17fb0000), SPH_C32(0x67390000), + SPH_C32(0x4f010142), SPH_C32(0x77ecf9d0), SPH_C32(0x496d1e66), + SPH_C32(0xd9af907f), SPH_C32(0x3d678a94), SPH_C32(0x45740000), + SPH_C32(0x480a0000), SPH_C32(0x3de60000), SPH_C32(0x168001e5), + SPH_C32(0xb81e37af), SPH_C32(0x4f9aedc2), SPH_C32(0xf0f2649f), + SPH_C32(0x1c42959a) }, + { SPH_C32(0x3e5c0000), SPH_C32(0x1f480000), SPH_C32(0x94030000), + SPH_C32(0x75c30145), SPH_C32(0x26c57380), SPH_C32(0x22037879), + SPH_C32(0xd70a5f9c), SPH_C32(0xdbbdf56a), SPH_C32(0xedae0000), + SPH_C32(0xdeb40000), SPH_C32(0x61fb0000), SPH_C32(0x115a01e7), + SPH_C32(0xc578a22c), SPH_C32(0x50029d48), SPH_C32(0x4b94ec97), + SPH_C32(0xc6c5159a) }, + { SPH_C32(0x94280000), SPH_C32(0x66c70000), SPH_C32(0xd6df0000), + SPH_C32(0x87d7014b), SPH_C32(0x875ae10b), SPH_C32(0xea56dac2), + SPH_C32(0x64ff7996), SPH_C32(0xb48f94ef), SPH_C32(0x7cbb0000), + SPH_C32(0x0a820000), SPH_C32(0xc53b0000), SPH_C32(0x7d4401e3), + SPH_C32(0x2eb80b6a), SPH_C32(0x6183585b), SPH_C32(0xd5ffd426), + SPH_C32(0x5b091fb3) }, + { SPH_C32(0x97150000), SPH_C32(0x6e740000), SPH_C32(0x25e50000), + SPH_C32(0xbd15014c), SPH_C32(0xd6736b5b), SPH_C32(0x8138bcdd), + SPH_C32(0x6a5ab675), SPH_C32(0x5255eb11), SPH_C32(0xd4610000), + SPH_C32(0x9c3c0000), SPH_C32(0x99260000), SPH_C32(0x7a9e01e1), + SPH_C32(0x53de9ee9), SPH_C32(0x7e1b28d1), SPH_C32(0x6e995c2e), + SPH_C32(0x818e9fb3) }, + { SPH_C32(0x3cf20000), SPH_C32(0xf0790000), SPH_C32(0x8ac20000), + SPH_C32(0x800d0149), SPH_C32(0xfa3c7488), SPH_C32(0xf5ceaa48), + SPH_C32(0xdf99f19e), SPH_C32(0x6e0814ef), SPH_C32(0xd75c0000), + SPH_C32(0x948f0000), SPH_C32(0x6a1c0000), SPH_C32(0x405c01e6), + SPH_C32(0x02f714b9), SPH_C32(0x15754ece), SPH_C32(0x603c93cd), + SPH_C32(0x6754e04d) }, + { SPH_C32(0x3fcf0000), SPH_C32(0xf8ca0000), SPH_C32(0x79f80000), + SPH_C32(0xbacf014e), SPH_C32(0xab15fed8), SPH_C32(0x9ea0cc57), + SPH_C32(0xd13c3e7d), SPH_C32(0x88d26b11), SPH_C32(0x7f860000), + SPH_C32(0x02310000), SPH_C32(0x36010000), SPH_C32(0x478601e4), + SPH_C32(0x7f91813a), SPH_C32(0x0aed3e44), SPH_C32(0xdb5a1bc5), + SPH_C32(0xbdd3604d) }, + { SPH_C32(0x07930000), SPH_C32(0x5dc00000), SPH_C32(0x6cde0000), + SPH_C32(0x1e070143), SPH_C32(0xb0634f45), SPH_C32(0x0c1acde0), + SPH_C32(0xf207ef25), SPH_C32(0x9cf67f43), SPH_C32(0x7d280000), + SPH_C32(0xed000000), SPH_C32(0x28c00000), SPH_C32(0xb24801e8), + SPH_C32(0xa3688632), SPH_C32(0xdd20ec75), SPH_C32(0xd3c9b5c7), + SPH_C32(0x086681c8) }, + { SPH_C32(0x04ae0000), SPH_C32(0x55730000), SPH_C32(0x9fe40000), + SPH_C32(0x24c50144), SPH_C32(0xe14ac515), SPH_C32(0x6774abff), + SPH_C32(0xfca220c6), SPH_C32(0x7a2c00bd), SPH_C32(0xd5f20000), + SPH_C32(0x7bbe0000), SPH_C32(0x74dd0000), SPH_C32(0xb59201ea), + SPH_C32(0xde0e13b1), SPH_C32(0xc2b89cff), SPH_C32(0x68af3dcf), + SPH_C32(0xd2e101c8) }, + { SPH_C32(0xaf490000), SPH_C32(0xcb7e0000), SPH_C32(0x30c30000), + SPH_C32(0x19dd0141), SPH_C32(0xcd05dac6), SPH_C32(0x1382bd6a), + SPH_C32(0x4961672d), SPH_C32(0x4671ff43), SPH_C32(0xd6cf0000), + SPH_C32(0x730d0000), SPH_C32(0x87e70000), SPH_C32(0x8f5001ed), + SPH_C32(0x8f2799e1), SPH_C32(0xa9d6fae0), SPH_C32(0x660af22c), + SPH_C32(0x343b7e36) }, + { SPH_C32(0xac740000), SPH_C32(0xc3cd0000), SPH_C32(0xc3f90000), + SPH_C32(0x231f0146), SPH_C32(0x9c2c5096), SPH_C32(0x78ecdb75), + SPH_C32(0x47c4a8ce), SPH_C32(0xa0ab80bd), SPH_C32(0x7e150000), + SPH_C32(0xe5b30000), SPH_C32(0xdbfa0000), SPH_C32(0x888a01ef), + SPH_C32(0xf2410c62), SPH_C32(0xb64e8a6a), SPH_C32(0xdd6c7a24), + SPH_C32(0xeebcfe36) }, + { SPH_C32(0x06000000), SPH_C32(0xba420000), SPH_C32(0x81250000), + SPH_C32(0xd10b0148), SPH_C32(0x3db3c21d), SPH_C32(0xb0b979ce), + SPH_C32(0xf4318ec4), SPH_C32(0xcf99e138), SPH_C32(0xef000000), + SPH_C32(0x31850000), SPH_C32(0x7f3a0000), SPH_C32(0xe49401eb), + SPH_C32(0x1981a524), SPH_C32(0x87cf4f79), SPH_C32(0x43074295), + SPH_C32(0x7370f41f) }, + { SPH_C32(0x053d0000), SPH_C32(0xb2f10000), SPH_C32(0x721f0000), + SPH_C32(0xebc9014f), SPH_C32(0x6c9a484d), SPH_C32(0xdbd71fd1), + SPH_C32(0xfa944127), SPH_C32(0x29439ec6), SPH_C32(0x47da0000), + SPH_C32(0xa73b0000), SPH_C32(0x23270000), SPH_C32(0xe34e01e9), + SPH_C32(0x64e730a7), SPH_C32(0x98573ff3), SPH_C32(0xf861ca9d), + SPH_C32(0xa9f7741f) }, + { SPH_C32(0xaeda0000), SPH_C32(0x2cfc0000), SPH_C32(0xdd380000), + SPH_C32(0xd6d1014a), SPH_C32(0x40d5579e), SPH_C32(0xaf210944), + SPH_C32(0x4f5706cc), SPH_C32(0x151e6138), SPH_C32(0x44e70000), + SPH_C32(0xaf880000), SPH_C32(0xd01d0000), SPH_C32(0xd98c01ee), + SPH_C32(0x35cebaf7), SPH_C32(0xf33959ec), SPH_C32(0xf6c4057e), + SPH_C32(0x4f2d0be1) }, + { SPH_C32(0xade70000), SPH_C32(0x244f0000), SPH_C32(0x2e020000), + SPH_C32(0xec13014d), SPH_C32(0x11fcddce), SPH_C32(0xc44f6f5b), + SPH_C32(0x41f2c92f), SPH_C32(0xf3c41ec6), SPH_C32(0xec3d0000), + SPH_C32(0x39360000), SPH_C32(0x8c000000), SPH_C32(0xde5601ec), + SPH_C32(0x48a82f74), SPH_C32(0xeca12966), SPH_C32(0x4da28d76), + SPH_C32(0x95aa8be1) }, + { SPH_C32(0xca130000), SPH_C32(0xd7460000), SPH_C32(0x788a0000), + SPH_C32(0x2c280153), SPH_C32(0x2ff4eaec), SPH_C32(0x45e4faa2), + SPH_C32(0x36d78dc8), SPH_C32(0x6944d1fd), SPH_C32(0xeed70000), + SPH_C32(0xa94f0000), SPH_C32(0x48bd0000), SPH_C32(0x01bb01e1), + SPH_C32(0xaffce1b0), SPH_C32(0x92da67d0), SPH_C32(0x463bbd14), + SPH_C32(0x9e150dfa) }, + { SPH_C32(0xc92e0000), SPH_C32(0xdff50000), SPH_C32(0x8bb00000), + SPH_C32(0x16ea0154), SPH_C32(0x7edd60bc), SPH_C32(0x2e8a9cbd), + SPH_C32(0x3872422b), SPH_C32(0x8f9eae03), SPH_C32(0x460d0000), + SPH_C32(0x3ff10000), SPH_C32(0x14a00000), SPH_C32(0x066101e3), + SPH_C32(0xd29a7433), SPH_C32(0x8d42175a), SPH_C32(0xfd5d351c), + SPH_C32(0x44928dfa) }, + { SPH_C32(0x62c90000), SPH_C32(0x41f80000), SPH_C32(0x24970000), + SPH_C32(0x2bf20151), SPH_C32(0x52927f6f), SPH_C32(0x5a7c8a28), + SPH_C32(0x8db105c0), SPH_C32(0xb3c351fd), SPH_C32(0x45300000), + SPH_C32(0x37420000), SPH_C32(0xe79a0000), SPH_C32(0x3ca301e4), + SPH_C32(0x83b3fe63), SPH_C32(0xe62c7145), SPH_C32(0xf3f8faff), + SPH_C32(0xa248f204) }, + { SPH_C32(0x61f40000), SPH_C32(0x494b0000), SPH_C32(0xd7ad0000), + SPH_C32(0x11300156), SPH_C32(0x03bbf53f), SPH_C32(0x3112ec37), + SPH_C32(0x8314ca23), SPH_C32(0x55192e03), SPH_C32(0xedea0000), + SPH_C32(0xa1fc0000), SPH_C32(0xbb870000), SPH_C32(0x3b7901e6), + SPH_C32(0xfed56be0), SPH_C32(0xf9b401cf), SPH_C32(0x489e72f7), + SPH_C32(0x78cf7204) }, + { SPH_C32(0xcb800000), SPH_C32(0x30c40000), SPH_C32(0x95710000), + SPH_C32(0xe3240158), SPH_C32(0xa22467b4), SPH_C32(0xf9474e8c), + SPH_C32(0x30e1ec29), SPH_C32(0x3a2b4f86), SPH_C32(0x7cff0000), + SPH_C32(0x75ca0000), SPH_C32(0x1f470000), SPH_C32(0x576701e2), + SPH_C32(0x1515c2a6), SPH_C32(0xc835c4dc), SPH_C32(0xd6f54a46), + SPH_C32(0xe503782d) }, + { SPH_C32(0xc8bd0000), SPH_C32(0x38770000), SPH_C32(0x664b0000), + SPH_C32(0xd9e6015f), SPH_C32(0xf30dede4), SPH_C32(0x92292893), + SPH_C32(0x3e4423ca), SPH_C32(0xdcf13078), SPH_C32(0xd4250000), + SPH_C32(0xe3740000), SPH_C32(0x435a0000), SPH_C32(0x50bd01e0), + SPH_C32(0x68735725), SPH_C32(0xd7adb456), SPH_C32(0x6d93c24e), + SPH_C32(0x3f84f82d) }, + { SPH_C32(0x635a0000), SPH_C32(0xa67a0000), SPH_C32(0xc96c0000), + SPH_C32(0xe4fe015a), SPH_C32(0xdf42f237), SPH_C32(0xe6df3e06), + SPH_C32(0x8b876421), SPH_C32(0xe0accf86), SPH_C32(0xd7180000), + SPH_C32(0xebc70000), SPH_C32(0xb0600000), SPH_C32(0x6a7f01e7), + SPH_C32(0x395add75), SPH_C32(0xbcc3d249), SPH_C32(0x63360dad), + SPH_C32(0xd95e87d3) }, + { SPH_C32(0x60670000), SPH_C32(0xaec90000), SPH_C32(0x3a560000), + SPH_C32(0xde3c015d), SPH_C32(0x8e6b7867), SPH_C32(0x8db15819), + SPH_C32(0x8522abc2), SPH_C32(0x0676b078), SPH_C32(0x7fc20000), + SPH_C32(0x7d790000), SPH_C32(0xec7d0000), SPH_C32(0x6da501e5), + SPH_C32(0x443c48f6), SPH_C32(0xa35ba2c3), SPH_C32(0xd85085a5), + SPH_C32(0x03d907d3) }, + { SPH_C32(0x583b0000), SPH_C32(0x0bc30000), SPH_C32(0x2f700000), + SPH_C32(0x7af40150), SPH_C32(0x951dc9fa), SPH_C32(0x1f0b59ae), + SPH_C32(0xa6197a9a), SPH_C32(0x1252a42a), SPH_C32(0x7d6c0000), + SPH_C32(0x92480000), SPH_C32(0xf2bc0000), SPH_C32(0x986b01e9), + SPH_C32(0x98c54ffe), SPH_C32(0x749670f2), SPH_C32(0xd0c32ba7), + SPH_C32(0xb66ce656) }, + { SPH_C32(0x5b060000), SPH_C32(0x03700000), SPH_C32(0xdc4a0000), + SPH_C32(0x40360157), SPH_C32(0xc43443aa), SPH_C32(0x74653fb1), + SPH_C32(0xa8bcb579), SPH_C32(0xf488dbd4), SPH_C32(0xd5b60000), + SPH_C32(0x04f60000), SPH_C32(0xaea10000), SPH_C32(0x9fb101eb), + SPH_C32(0xe5a3da7d), SPH_C32(0x6b0e0078), SPH_C32(0x6ba5a3af), + SPH_C32(0x6ceb6656) }, + { SPH_C32(0xf0e10000), SPH_C32(0x9d7d0000), SPH_C32(0x736d0000), + SPH_C32(0x7d2e0152), SPH_C32(0xe87b5c79), SPH_C32(0x00932924), + SPH_C32(0x1d7ff292), SPH_C32(0xc8d5242a), SPH_C32(0xd68b0000), + SPH_C32(0x0c450000), SPH_C32(0x5d9b0000), SPH_C32(0xa57301ec), + SPH_C32(0xb48a502d), SPH_C32(0x00606667), SPH_C32(0x65006c4c), + SPH_C32(0x8a3119a8) }, + { SPH_C32(0xf3dc0000), SPH_C32(0x95ce0000), SPH_C32(0x80570000), + SPH_C32(0x47ec0155), SPH_C32(0xb952d629), SPH_C32(0x6bfd4f3b), + SPH_C32(0x13da3d71), SPH_C32(0x2e0f5bd4), SPH_C32(0x7e510000), + SPH_C32(0x9afb0000), SPH_C32(0x01860000), SPH_C32(0xa2a901ee), + SPH_C32(0xc9ecc5ae), SPH_C32(0x1ff816ed), SPH_C32(0xde66e444), + SPH_C32(0x50b699a8) }, + { SPH_C32(0x59a80000), SPH_C32(0xec410000), SPH_C32(0xc28b0000), + SPH_C32(0xb5f8015b), SPH_C32(0x18cd44a2), SPH_C32(0xa3a8ed80), + SPH_C32(0xa02f1b7b), SPH_C32(0x413d3a51), SPH_C32(0xef440000), + SPH_C32(0x4ecd0000), SPH_C32(0xa5460000), SPH_C32(0xceb701ea), + SPH_C32(0x222c6ce8), SPH_C32(0x2e79d3fe), SPH_C32(0x400ddcf5), + SPH_C32(0xcd7a9381) }, + { SPH_C32(0x5a950000), SPH_C32(0xe4f20000), SPH_C32(0x31b10000), + SPH_C32(0x8f3a015c), SPH_C32(0x49e4cef2), SPH_C32(0xc8c68b9f), + SPH_C32(0xae8ad498), SPH_C32(0xa7e745af), SPH_C32(0x479e0000), + SPH_C32(0xd8730000), SPH_C32(0xf95b0000), SPH_C32(0xc96d01e8), + SPH_C32(0x5f4af96b), SPH_C32(0x31e1a374), SPH_C32(0xfb6b54fd), + SPH_C32(0x17fd1381) }, + { SPH_C32(0xf1720000), SPH_C32(0x7aff0000), SPH_C32(0x9e960000), + SPH_C32(0xb2220159), SPH_C32(0x65abd121), SPH_C32(0xbc309d0a), + SPH_C32(0x1b499373), SPH_C32(0x9bbaba51), SPH_C32(0x44a30000), + SPH_C32(0xd0c00000), SPH_C32(0x0a610000), SPH_C32(0xf3af01ef), + SPH_C32(0x0e63733b), SPH_C32(0x5a8fc56b), SPH_C32(0xf5ce9b1e), + SPH_C32(0xf1276c7f) }, + { SPH_C32(0xf24f0000), SPH_C32(0x724c0000), SPH_C32(0x6dac0000), + SPH_C32(0x88e0015e), SPH_C32(0x34825b71), SPH_C32(0xd75efb15), + SPH_C32(0x15ec5c90), SPH_C32(0x7d60c5af), SPH_C32(0xec790000), + SPH_C32(0x467e0000), SPH_C32(0x567c0000), SPH_C32(0xf47501ed), + SPH_C32(0x7305e6b8), SPH_C32(0x4517b5e1), SPH_C32(0x4ea81316), + SPH_C32(0x2ba0ec7f) }, + { SPH_C32(0x95ff0000), SPH_C32(0xfe0d0000), SPH_C32(0xe1580000), + SPH_C32(0x62f80141), SPH_C32(0x3127a59f), SPH_C32(0xff43f26b), + SPH_C32(0x61c38617), SPH_C32(0x59ea6d0a), SPH_C32(0xb17f0000), + SPH_C32(0xff4c0000), SPH_C32(0x0b130000), SPH_C32(0x654801f2), + SPH_C32(0x8a82670f), SPH_C32(0x81cbf39e), SPH_C32(0x122528ab), + SPH_C32(0x10b1d693) }, + { SPH_C32(0x96c20000), SPH_C32(0xf6be0000), SPH_C32(0x12620000), + SPH_C32(0x583a0146), SPH_C32(0x600e2fcf), SPH_C32(0x942d9474), + SPH_C32(0x6f6649f4), SPH_C32(0xbf3012f4), SPH_C32(0x19a50000), + SPH_C32(0x69f20000), SPH_C32(0x570e0000), SPH_C32(0x629201f0), + SPH_C32(0xf7e4f28c), SPH_C32(0x9e538314), SPH_C32(0xa943a0a3), + SPH_C32(0xca365693) }, + { SPH_C32(0x3d250000), SPH_C32(0x68b30000), SPH_C32(0xbd450000), + SPH_C32(0x65220143), SPH_C32(0x4c41301c), SPH_C32(0xe0db82e1), + SPH_C32(0xdaa50e1f), SPH_C32(0x836ded0a), SPH_C32(0x1a980000), + SPH_C32(0x61410000), SPH_C32(0xa4340000), SPH_C32(0x585001f7), + SPH_C32(0xa6cd78dc), SPH_C32(0xf53de50b), SPH_C32(0xa7e66f40), + SPH_C32(0x2cec296d) }, + { SPH_C32(0x3e180000), SPH_C32(0x60000000), SPH_C32(0x4e7f0000), + SPH_C32(0x5fe00144), SPH_C32(0x1d68ba4c), SPH_C32(0x8bb5e4fe), + SPH_C32(0xd400c1fc), SPH_C32(0x65b792f4), SPH_C32(0xb2420000), + SPH_C32(0xf7ff0000), SPH_C32(0xf8290000), SPH_C32(0x5f8a01f5), + SPH_C32(0xdbabed5f), SPH_C32(0xeaa59581), SPH_C32(0x1c80e748), + SPH_C32(0xf66ba96d) }, + { SPH_C32(0x946c0000), SPH_C32(0x198f0000), SPH_C32(0x0ca30000), + SPH_C32(0xadf4014a), SPH_C32(0xbcf728c7), SPH_C32(0x43e04645), + SPH_C32(0x67f5e7f6), SPH_C32(0x0a85f371), SPH_C32(0x23570000), + SPH_C32(0x23c90000), SPH_C32(0x5ce90000), SPH_C32(0x339401f1), + SPH_C32(0x306b4419), SPH_C32(0xdb245092), SPH_C32(0x82ebdff9), + SPH_C32(0x6ba7a344) }, + { SPH_C32(0x97510000), SPH_C32(0x113c0000), SPH_C32(0xff990000), + SPH_C32(0x9736014d), SPH_C32(0xeddea297), SPH_C32(0x288e205a), + SPH_C32(0x69502815), SPH_C32(0xec5f8c8f), SPH_C32(0x8b8d0000), + SPH_C32(0xb5770000), SPH_C32(0x00f40000), SPH_C32(0x344e01f3), + SPH_C32(0x4d0dd19a), SPH_C32(0xc4bc2018), SPH_C32(0x398d57f1), + SPH_C32(0xb1202344) }, + { SPH_C32(0x3cb60000), SPH_C32(0x8f310000), SPH_C32(0x50be0000), + SPH_C32(0xaa2e0148), SPH_C32(0xc191bd44), SPH_C32(0x5c7836cf), + SPH_C32(0xdc936ffe), SPH_C32(0xd0027371), SPH_C32(0x88b00000), + SPH_C32(0xbdc40000), SPH_C32(0xf3ce0000), SPH_C32(0x0e8c01f4), + SPH_C32(0x1c245bca), SPH_C32(0xafd24607), SPH_C32(0x37289812), + SPH_C32(0x57fa5cba) }, + { SPH_C32(0x3f8b0000), SPH_C32(0x87820000), SPH_C32(0xa3840000), + SPH_C32(0x90ec014f), SPH_C32(0x90b83714), SPH_C32(0x371650d0), + SPH_C32(0xd236a01d), SPH_C32(0x36d80c8f), SPH_C32(0x206a0000), + SPH_C32(0x2b7a0000), SPH_C32(0xafd30000), SPH_C32(0x095601f6), + SPH_C32(0x6142ce49), SPH_C32(0xb04a368d), SPH_C32(0x8c4e101a), + SPH_C32(0x8d7ddcba) }, + { SPH_C32(0x07d70000), SPH_C32(0x22880000), SPH_C32(0xb6a20000), + SPH_C32(0x34240142), SPH_C32(0x8bce8689), SPH_C32(0xa5ac5167), + SPH_C32(0xf10d7145), SPH_C32(0x22fc18dd), SPH_C32(0x22c40000), + SPH_C32(0xc44b0000), SPH_C32(0xb1120000), SPH_C32(0xfc9801fa), + SPH_C32(0xbdbbc941), SPH_C32(0x6787e4bc), SPH_C32(0x84ddbe18), + SPH_C32(0x38c83d3f) }, + { SPH_C32(0x04ea0000), SPH_C32(0x2a3b0000), SPH_C32(0x45980000), + SPH_C32(0x0ee60145), SPH_C32(0xdae70cd9), SPH_C32(0xcec23778), + SPH_C32(0xffa8bea6), SPH_C32(0xc4266723), SPH_C32(0x8a1e0000), + SPH_C32(0x52f50000), SPH_C32(0xed0f0000), SPH_C32(0xfb4201f8), + SPH_C32(0xc0dd5cc2), SPH_C32(0x781f9436), SPH_C32(0x3fbb3610), + SPH_C32(0xe24fbd3f) }, + { SPH_C32(0xaf0d0000), SPH_C32(0xb4360000), SPH_C32(0xeabf0000), + SPH_C32(0x33fe0140), SPH_C32(0xf6a8130a), SPH_C32(0xba3421ed), + SPH_C32(0x4a6bf94d), SPH_C32(0xf87b98dd), SPH_C32(0x89230000), + SPH_C32(0x5a460000), SPH_C32(0x1e350000), SPH_C32(0xc18001ff), + SPH_C32(0x91f4d692), SPH_C32(0x1371f229), SPH_C32(0x311ef9f3), + SPH_C32(0x0495c2c1) }, + { SPH_C32(0xac300000), SPH_C32(0xbc850000), SPH_C32(0x19850000), + SPH_C32(0x093c0147), SPH_C32(0xa781995a), SPH_C32(0xd15a47f2), + SPH_C32(0x44ce36ae), SPH_C32(0x1ea1e723), SPH_C32(0x21f90000), + SPH_C32(0xccf80000), SPH_C32(0x42280000), SPH_C32(0xc65a01fd), + SPH_C32(0xec924311), SPH_C32(0x0ce982a3), SPH_C32(0x8a7871fb), + SPH_C32(0xde1242c1) }, + { SPH_C32(0x06440000), SPH_C32(0xc50a0000), SPH_C32(0x5b590000), + SPH_C32(0xfb280149), SPH_C32(0x061e0bd1), SPH_C32(0x190fe549), + SPH_C32(0xf73b10a4), SPH_C32(0x719386a6), SPH_C32(0xb0ec0000), + SPH_C32(0x18ce0000), SPH_C32(0xe6e80000), SPH_C32(0xaa4401f9), + SPH_C32(0x0752ea57), SPH_C32(0x3d6847b0), SPH_C32(0x1413494a), + SPH_C32(0x43de48e8) }, + { SPH_C32(0x05790000), SPH_C32(0xcdb90000), SPH_C32(0xa8630000), + SPH_C32(0xc1ea014e), SPH_C32(0x57378181), SPH_C32(0x72618356), + SPH_C32(0xf99edf47), SPH_C32(0x9749f958), SPH_C32(0x18360000), + SPH_C32(0x8e700000), SPH_C32(0xbaf50000), SPH_C32(0xad9e01fb), + SPH_C32(0x7a347fd4), SPH_C32(0x22f0373a), SPH_C32(0xaf75c142), + SPH_C32(0x9959c8e8) }, + { SPH_C32(0xae9e0000), SPH_C32(0x53b40000), SPH_C32(0x07440000), + SPH_C32(0xfcf2014b), SPH_C32(0x7b789e52), SPH_C32(0x069795c3), + SPH_C32(0x4c5d98ac), SPH_C32(0xab1406a6), SPH_C32(0x1b0b0000), + SPH_C32(0x86c30000), SPH_C32(0x49cf0000), SPH_C32(0x975c01fc), + SPH_C32(0x2b1df584), SPH_C32(0x499e5125), SPH_C32(0xa1d00ea1), + SPH_C32(0x7f83b716) }, + { SPH_C32(0xada30000), SPH_C32(0x5b070000), SPH_C32(0xf47e0000), + SPH_C32(0xc630014c), SPH_C32(0x2a511402), SPH_C32(0x6df9f3dc), + SPH_C32(0x42f8574f), SPH_C32(0x4dce7958), SPH_C32(0xb3d10000), + SPH_C32(0x107d0000), SPH_C32(0x15d20000), SPH_C32(0x908601fe), + SPH_C32(0x567b6007), SPH_C32(0x560621af), SPH_C32(0x1ab686a9), + SPH_C32(0xa5043716) }, + { SPH_C32(0xca570000), SPH_C32(0xa80e0000), SPH_C32(0xa2f60000), + SPH_C32(0x060b0152), SPH_C32(0x14592320), SPH_C32(0xec526625), + SPH_C32(0x35dd13a8), SPH_C32(0xd74eb663), SPH_C32(0xb13b0000), + SPH_C32(0x80040000), SPH_C32(0xd16f0000), SPH_C32(0x4f6b01f3), + SPH_C32(0xb12faec3), SPH_C32(0x287d6f19), SPH_C32(0x112fb6cb), + SPH_C32(0xaebbb10d) }, + { SPH_C32(0xc96a0000), SPH_C32(0xa0bd0000), SPH_C32(0x51cc0000), + SPH_C32(0x3cc90155), SPH_C32(0x4570a970), SPH_C32(0x873c003a), + SPH_C32(0x3b78dc4b), SPH_C32(0x3194c99d), SPH_C32(0x19e10000), + SPH_C32(0x16ba0000), SPH_C32(0x8d720000), SPH_C32(0x48b101f1), + SPH_C32(0xcc493b40), SPH_C32(0x37e51f93), SPH_C32(0xaa493ec3), + SPH_C32(0x743c310d) }, + { SPH_C32(0x628d0000), SPH_C32(0x3eb00000), SPH_C32(0xfeeb0000), + SPH_C32(0x01d10150), SPH_C32(0x693fb6a3), SPH_C32(0xf3ca16af), + SPH_C32(0x8ebb9ba0), SPH_C32(0x0dc93663), SPH_C32(0x1adc0000), + SPH_C32(0x1e090000), SPH_C32(0x7e480000), SPH_C32(0x727301f6), + SPH_C32(0x9d60b110), SPH_C32(0x5c8b798c), SPH_C32(0xa4ecf120), + SPH_C32(0x92e64ef3) }, + { SPH_C32(0x61b00000), SPH_C32(0x36030000), SPH_C32(0x0dd10000), + SPH_C32(0x3b130157), SPH_C32(0x38163cf3), SPH_C32(0x98a470b0), + SPH_C32(0x801e5443), SPH_C32(0xeb13499d), SPH_C32(0xb2060000), + SPH_C32(0x88b70000), SPH_C32(0x22550000), SPH_C32(0x75a901f4), + SPH_C32(0xe0062493), SPH_C32(0x43130906), SPH_C32(0x1f8a7928), + SPH_C32(0x4861cef3) }, + { SPH_C32(0xcbc40000), SPH_C32(0x4f8c0000), SPH_C32(0x4f0d0000), + SPH_C32(0xc9070159), SPH_C32(0x9989ae78), SPH_C32(0x50f1d20b), + SPH_C32(0x33eb7249), SPH_C32(0x84212818), SPH_C32(0x23130000), + SPH_C32(0x5c810000), SPH_C32(0x86950000), SPH_C32(0x19b701f0), + SPH_C32(0x0bc68dd5), SPH_C32(0x7292cc15), SPH_C32(0x81e14199), + SPH_C32(0xd5adc4da) }, + { SPH_C32(0xc8f90000), SPH_C32(0x473f0000), SPH_C32(0xbc370000), + SPH_C32(0xf3c5015e), SPH_C32(0xc8a02428), SPH_C32(0x3b9fb414), + SPH_C32(0x3d4ebdaa), SPH_C32(0x62fb57e6), SPH_C32(0x8bc90000), + SPH_C32(0xca3f0000), SPH_C32(0xda880000), SPH_C32(0x1e6d01f2), + SPH_C32(0x76a01856), SPH_C32(0x6d0abc9f), SPH_C32(0x3a87c991), + SPH_C32(0x0f2a44da) }, + { SPH_C32(0x631e0000), SPH_C32(0xd9320000), SPH_C32(0x13100000), + SPH_C32(0xcedd015b), SPH_C32(0xe4ef3bfb), SPH_C32(0x4f69a281), + SPH_C32(0x888dfa41), SPH_C32(0x5ea6a818), SPH_C32(0x88f40000), + SPH_C32(0xc28c0000), SPH_C32(0x29b20000), SPH_C32(0x24af01f5), + SPH_C32(0x27899206), SPH_C32(0x0664da80), SPH_C32(0x34220672), + SPH_C32(0xe9f03b24) }, + { SPH_C32(0x60230000), SPH_C32(0xd1810000), SPH_C32(0xe02a0000), + SPH_C32(0xf41f015c), SPH_C32(0xb5c6b1ab), SPH_C32(0x2407c49e), + SPH_C32(0x862835a2), SPH_C32(0xb87cd7e6), SPH_C32(0x202e0000), + SPH_C32(0x54320000), SPH_C32(0x75af0000), SPH_C32(0x237501f7), + SPH_C32(0x5aef0785), SPH_C32(0x19fcaa0a), SPH_C32(0x8f448e7a), + SPH_C32(0x3377bb24) }, + { SPH_C32(0x587f0000), SPH_C32(0x748b0000), SPH_C32(0xf50c0000), + SPH_C32(0x50d70151), SPH_C32(0xaeb00036), SPH_C32(0xb6bdc529), + SPH_C32(0xa513e4fa), SPH_C32(0xac58c3b4), SPH_C32(0x22800000), + SPH_C32(0xbb030000), SPH_C32(0x6b6e0000), SPH_C32(0xd6bb01fb), + SPH_C32(0x8616008d), SPH_C32(0xce31783b), SPH_C32(0x87d72078), + SPH_C32(0x86c25aa1) }, + { SPH_C32(0x5b420000), SPH_C32(0x7c380000), SPH_C32(0x06360000), + SPH_C32(0x6a150156), SPH_C32(0xff998a66), SPH_C32(0xddd3a336), + SPH_C32(0xabb62b19), SPH_C32(0x4a82bc4a), SPH_C32(0x8a5a0000), + SPH_C32(0x2dbd0000), SPH_C32(0x37730000), SPH_C32(0xd16101f9), + SPH_C32(0xfb70950e), SPH_C32(0xd1a908b1), SPH_C32(0x3cb1a870), + SPH_C32(0x5c45daa1) }, + { SPH_C32(0xf0a50000), SPH_C32(0xe2350000), SPH_C32(0xa9110000), + SPH_C32(0x570d0153), SPH_C32(0xd3d695b5), SPH_C32(0xa925b5a3), + SPH_C32(0x1e756cf2), SPH_C32(0x76df43b4), SPH_C32(0x89670000), + SPH_C32(0x250e0000), SPH_C32(0xc4490000), SPH_C32(0xeba301fe), + SPH_C32(0xaa591f5e), SPH_C32(0xbac76eae), SPH_C32(0x32146793), + SPH_C32(0xba9fa55f) }, + { SPH_C32(0xf3980000), SPH_C32(0xea860000), SPH_C32(0x5a2b0000), + SPH_C32(0x6dcf0154), SPH_C32(0x82ff1fe5), SPH_C32(0xc24bd3bc), + SPH_C32(0x10d0a311), SPH_C32(0x90053c4a), SPH_C32(0x21bd0000), + SPH_C32(0xb3b00000), SPH_C32(0x98540000), SPH_C32(0xec7901fc), + SPH_C32(0xd73f8add), SPH_C32(0xa55f1e24), SPH_C32(0x8972ef9b), + SPH_C32(0x6018255f) }, + { SPH_C32(0x59ec0000), SPH_C32(0x93090000), SPH_C32(0x18f70000), + SPH_C32(0x9fdb015a), SPH_C32(0x23608d6e), SPH_C32(0x0a1e7107), + SPH_C32(0xa325851b), SPH_C32(0xff375dcf), SPH_C32(0xb0a80000), + SPH_C32(0x67860000), SPH_C32(0x3c940000), SPH_C32(0x806701f8), + SPH_C32(0x3cff239b), SPH_C32(0x94dedb37), SPH_C32(0x1719d72a), + SPH_C32(0xfdd42f76) }, + { SPH_C32(0x5ad10000), SPH_C32(0x9bba0000), SPH_C32(0xebcd0000), + SPH_C32(0xa519015d), SPH_C32(0x7249073e), SPH_C32(0x61701718), + SPH_C32(0xad804af8), SPH_C32(0x19ed2231), SPH_C32(0x18720000), + SPH_C32(0xf1380000), SPH_C32(0x60890000), SPH_C32(0x87bd01fa), + SPH_C32(0x4199b618), SPH_C32(0x8b46abbd), SPH_C32(0xac7f5f22), + SPH_C32(0x2753af76) }, + { SPH_C32(0xf1360000), SPH_C32(0x05b70000), SPH_C32(0x44ea0000), + SPH_C32(0x98010158), SPH_C32(0x5e0618ed), SPH_C32(0x1586018d), + SPH_C32(0x18430d13), SPH_C32(0x25b0ddcf), SPH_C32(0x1b4f0000), + SPH_C32(0xf98b0000), SPH_C32(0x93b30000), SPH_C32(0xbd7f01fd), + SPH_C32(0x10b03c48), SPH_C32(0xe028cda2), SPH_C32(0xa2da90c1), + SPH_C32(0xc189d088) }, + { SPH_C32(0xf20b0000), SPH_C32(0x0d040000), SPH_C32(0xb7d00000), + SPH_C32(0xa2c3015f), SPH_C32(0x0f2f92bd), SPH_C32(0x7ee86792), + SPH_C32(0x16e6c2f0), SPH_C32(0xc36aa231), SPH_C32(0xb3950000), + SPH_C32(0x6f350000), SPH_C32(0xcfae0000), SPH_C32(0xbaa501ff), + SPH_C32(0x6dd6a9cb), SPH_C32(0xffb0bd28), SPH_C32(0x19bc18c9), + SPH_C32(0x1b0e5088) } +}; + +#define INPUT_BIG do { \ + unsigned acc = buf[0]; \ + const sph_u32 *rp; \ + rp = &T512_0[acc][0]; \ + m0 = rp[0]; \ + m1 = rp[1]; \ + m2 = rp[2]; \ + m3 = rp[3]; \ + m4 = rp[4]; \ + m5 = rp[5]; \ + m6 = rp[6]; \ + m7 = rp[7]; \ + m8 = rp[8]; \ + m9 = rp[9]; \ + mA = rp[10]; \ + mB = rp[11]; \ + mC = rp[12]; \ + mD = rp[13]; \ + mE = rp[14]; \ + mF = rp[15]; \ + acc = buf[1]; \ + rp = &T512_8[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[2]; \ + rp = &T512_16[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[3]; \ + rp = &T512_24[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[4]; \ + rp = &T512_32[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[5]; \ + rp = &T512_40[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[6]; \ + rp = &T512_48[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + acc = buf[7]; \ + rp = &T512_56[acc][0]; \ + m0 ^= rp[0]; \ + m1 ^= rp[1]; \ + m2 ^= rp[2]; \ + m3 ^= rp[3]; \ + m4 ^= rp[4]; \ + m5 ^= rp[5]; \ + m6 ^= rp[6]; \ + m7 ^= rp[7]; \ + m8 ^= rp[8]; \ + m9 ^= rp[9]; \ + mA ^= rp[10]; \ + mB ^= rp[11]; \ + mC ^= rp[12]; \ + mD ^= rp[13]; \ + mE ^= rp[14]; \ + mF ^= rp[15]; \ + } while (0) + +#endif + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/sph/haval.c b/sph/haval.c new file mode 100644 index 0000000..f9a8918 --- /dev/null +++ b/sph/haval.c @@ -0,0 +1,983 @@ +/* $Id: haval.c 227 2010-06-16 17:28:38Z tp $ */ +/* + * HAVAL implementation. + * + * The HAVAL reference paper is of questionable clarity with regards to + * some details such as endianness of bits within a byte, bytes within + * a 32-bit word, or the actual ordering of words within a stream of + * words. This implementation has been made compatible with the reference + * implementation available on: http://labs.calyptix.com/haval.php + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_haval.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_HAVAL +#define SPH_SMALL_FOOTPRINT_HAVAL 1 +#endif + +/* + * Basic definition from the reference paper. + * +#define F1(x6, x5, x4, x3, x2, x1, x0) \ + (((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6)) ^ ((x0) & (x1)) ^ (x0)) + * + */ + +#define F1(x6, x5, x4, x3, x2, x1, x0) \ + (((x1) & ((x0) ^ (x4))) ^ ((x2) & (x5)) ^ ((x3) & (x6)) ^ (x0)) + +/* + * Basic definition from the reference paper. + * +#define F2(x6, x5, x4, x3, x2, x1, x0) \ + (((x1) & (x2) & (x3)) ^ ((x2) & (x4) & (x5)) ^ ((x1) & (x2)) \ + ^ ((x1) & (x4)) ^ ((x2) & (x6)) ^ ((x3) & (x5)) \ + ^ ((x4) & (x5)) ^ ((x0) & (x2)) ^ (x0)) + * + */ + +#define F2(x6, x5, x4, x3, x2, x1, x0) \ + (((x2) & (((x1) & ~(x3)) ^ ((x4) & (x5)) ^ (x6) ^ (x0))) \ + ^ ((x4) & ((x1) ^ (x5))) ^ ((x3 & (x5)) ^ (x0))) + +/* + * Basic definition from the reference paper. + * +#define F3(x6, x5, x4, x3, x2, x1, x0) \ + (((x1) & (x2) & (x3)) ^ ((x1) & (x4)) ^ ((x2) & (x5)) \ + ^ ((x3) & (x6)) ^ ((x0) & (x3)) ^ (x0)) + * + */ + +#define F3(x6, x5, x4, x3, x2, x1, x0) \ + (((x3) & (((x1) & (x2)) ^ (x6) ^ (x0))) \ + ^ ((x1) & (x4)) ^ ((x2) & (x5)) ^ (x0)) + +/* + * Basic definition from the reference paper. + * +#define F4(x6, x5, x4, x3, x2, x1, x0) \ + (((x1) & (x2) & (x3)) ^ ((x2) & (x4) & (x5)) ^ ((x3) & (x4) & (x6)) \ + ^ ((x1) & (x4)) ^ ((x2) & (x6)) ^ ((x3) & (x4)) ^ ((x3) & (x5)) \ + ^ ((x3) & (x6)) ^ ((x4) & (x5)) ^ ((x4) & (x6)) ^ ((x0) & (x4)) ^ (x0)) + * + */ + +#define F4(x6, x5, x4, x3, x2, x1, x0) \ + (((x3) & (((x1) & (x2)) ^ ((x4) | (x6)) ^ (x5))) \ + ^ ((x4) & ((~(x2) & (x5)) ^ (x1) ^ (x6) ^ (x0))) \ + ^ ((x2) & (x6)) ^ (x0)) + +/* + * Basic definition from the reference paper. + * +#define F5(x6, x5, x4, x3, x2, x1, x0) \ + (((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6)) \ + ^ ((x0) & (x1) & (x2) & (x3)) ^ ((x0) & (x5)) ^ (x0)) + * + */ + +#define F5(x6, x5, x4, x3, x2, x1, x0) \ + (((x0) & ~(((x1) & (x2) & (x3)) ^ (x5))) \ + ^ ((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6))) + +/* + * The macros below integrate the phi() permutations, depending on the + * pass and the total number of passes. + */ + +#define FP3_1(x6, x5, x4, x3, x2, x1, x0) \ + F1(x1, x0, x3, x5, x6, x2, x4) +#define FP3_2(x6, x5, x4, x3, x2, x1, x0) \ + F2(x4, x2, x1, x0, x5, x3, x6) +#define FP3_3(x6, x5, x4, x3, x2, x1, x0) \ + F3(x6, x1, x2, x3, x4, x5, x0) + +#define FP4_1(x6, x5, x4, x3, x2, x1, x0) \ + F1(x2, x6, x1, x4, x5, x3, x0) +#define FP4_2(x6, x5, x4, x3, x2, x1, x0) \ + F2(x3, x5, x2, x0, x1, x6, x4) +#define FP4_3(x6, x5, x4, x3, x2, x1, x0) \ + F3(x1, x4, x3, x6, x0, x2, x5) +#define FP4_4(x6, x5, x4, x3, x2, x1, x0) \ + F4(x6, x4, x0, x5, x2, x1, x3) + +#define FP5_1(x6, x5, x4, x3, x2, x1, x0) \ + F1(x3, x4, x1, x0, x5, x2, x6) +#define FP5_2(x6, x5, x4, x3, x2, x1, x0) \ + F2(x6, x2, x1, x0, x3, x4, x5) +#define FP5_3(x6, x5, x4, x3, x2, x1, x0) \ + F3(x2, x6, x0, x4, x3, x1, x5) +#define FP5_4(x6, x5, x4, x3, x2, x1, x0) \ + F4(x1, x5, x3, x2, x0, x4, x6) +#define FP5_5(x6, x5, x4, x3, x2, x1, x0) \ + F5(x2, x5, x0, x6, x4, x3, x1) + +/* + * One step, for "n" passes, pass number "p" (1 <= p <= n), using + * input word number "w" and step constant "c". + */ +#define STEP(n, p, x7, x6, x5, x4, x3, x2, x1, x0, w, c) do { \ + sph_u32 t = FP ## n ## _ ## p(x6, x5, x4, x3, x2, x1, x0); \ + (x7) = SPH_T32(SPH_ROTR32(t, 7) + SPH_ROTR32((x7), 11) \ + + (w) + (c)); \ + } while (0) + +/* + * PASSy(n, in) computes pass number "y", for a total of "n", using the + * one-argument macro "in" to access input words. Current state is assumed + * to be held in variables "s0" to "s7". + */ + +#if SPH_SMALL_FOOTPRINT_HAVAL + +#define PASS1(n, in) do { \ + unsigned pass_count; \ + for (pass_count = 0; pass_count < 32; pass_count += 8) { \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, \ + in(pass_count + 0), SPH_C32(0x00000000)); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, \ + in(pass_count + 1), SPH_C32(0x00000000)); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, \ + in(pass_count + 2), SPH_C32(0x00000000)); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, \ + in(pass_count + 3), SPH_C32(0x00000000)); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, \ + in(pass_count + 4), SPH_C32(0x00000000)); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, \ + in(pass_count + 5), SPH_C32(0x00000000)); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, \ + in(pass_count + 6), SPH_C32(0x00000000)); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, \ + in(pass_count + 7), SPH_C32(0x00000000)); \ + } \ + } while (0) + +#define PASSG(p, n, in) do { \ + unsigned pass_count; \ + for (pass_count = 0; pass_count < 32; pass_count += 8) { \ + STEP(n, p, s7, s6, s5, s4, s3, s2, s1, s0, \ + in(MP ## p[pass_count + 0]), \ + RK ## p[pass_count + 0]); \ + STEP(n, p, s6, s5, s4, s3, s2, s1, s0, s7, \ + in(MP ## p[pass_count + 1]), \ + RK ## p[pass_count + 1]); \ + STEP(n, p, s5, s4, s3, s2, s1, s0, s7, s6, \ + in(MP ## p[pass_count + 2]), \ + RK ## p[pass_count + 2]); \ + STEP(n, p, s4, s3, s2, s1, s0, s7, s6, s5, \ + in(MP ## p[pass_count + 3]), \ + RK ## p[pass_count + 3]); \ + STEP(n, p, s3, s2, s1, s0, s7, s6, s5, s4, \ + in(MP ## p[pass_count + 4]), \ + RK ## p[pass_count + 4]); \ + STEP(n, p, s2, s1, s0, s7, s6, s5, s4, s3, \ + in(MP ## p[pass_count + 5]), \ + RK ## p[pass_count + 5]); \ + STEP(n, p, s1, s0, s7, s6, s5, s4, s3, s2, \ + in(MP ## p[pass_count + 6]), \ + RK ## p[pass_count + 6]); \ + STEP(n, p, s0, s7, s6, s5, s4, s3, s2, s1, \ + in(MP ## p[pass_count + 7]), \ + RK ## p[pass_count + 7]); \ + } \ + } while (0) + +#define PASS2(n, in) PASSG(2, n, in) +#define PASS3(n, in) PASSG(3, n, in) +#define PASS4(n, in) PASSG(4, n, in) +#define PASS5(n, in) PASSG(5, n, in) + +static const unsigned MP2[32] = { + 5, 14, 26, 18, 11, 28, 7, 16, + 0, 23, 20, 22, 1, 10, 4, 8, + 30, 3, 21, 9, 17, 24, 29, 6, + 19, 12, 15, 13, 2, 25, 31, 27 +}; + +static const unsigned MP3[32] = { + 19, 9, 4, 20, 28, 17, 8, 22, + 29, 14, 25, 12, 24, 30, 16, 26, + 31, 15, 7, 3, 1, 0, 18, 27, + 13, 6, 21, 10, 23, 11, 5, 2 +}; + +static const unsigned MP4[32] = { + 24, 4, 0, 14, 2, 7, 28, 23, + 26, 6, 30, 20, 18, 25, 19, 3, + 22, 11, 31, 21, 8, 27, 12, 9, + 1, 29, 5, 15, 17, 10, 16, 13 +}; + +static const unsigned MP5[32] = { + 27, 3, 21, 26, 17, 11, 20, 29, + 19, 0, 12, 7, 13, 8, 31, 10, + 5, 9, 14, 30, 18, 6, 28, 24, + 2, 23, 16, 22, 4, 1, 25, 15 +}; + +static const sph_u32 RK2[32] = { + SPH_C32(0x452821E6), SPH_C32(0x38D01377), + SPH_C32(0xBE5466CF), SPH_C32(0x34E90C6C), + SPH_C32(0xC0AC29B7), SPH_C32(0xC97C50DD), + SPH_C32(0x3F84D5B5), SPH_C32(0xB5470917), + SPH_C32(0x9216D5D9), SPH_C32(0x8979FB1B), + SPH_C32(0xD1310BA6), SPH_C32(0x98DFB5AC), + SPH_C32(0x2FFD72DB), SPH_C32(0xD01ADFB7), + SPH_C32(0xB8E1AFED), SPH_C32(0x6A267E96), + SPH_C32(0xBA7C9045), SPH_C32(0xF12C7F99), + SPH_C32(0x24A19947), SPH_C32(0xB3916CF7), + SPH_C32(0x0801F2E2), SPH_C32(0x858EFC16), + SPH_C32(0x636920D8), SPH_C32(0x71574E69), + SPH_C32(0xA458FEA3), SPH_C32(0xF4933D7E), + SPH_C32(0x0D95748F), SPH_C32(0x728EB658), + SPH_C32(0x718BCD58), SPH_C32(0x82154AEE), + SPH_C32(0x7B54A41D), SPH_C32(0xC25A59B5) +}; + +static const sph_u32 RK3[32] = { + SPH_C32(0x9C30D539), SPH_C32(0x2AF26013), + SPH_C32(0xC5D1B023), SPH_C32(0x286085F0), + SPH_C32(0xCA417918), SPH_C32(0xB8DB38EF), + SPH_C32(0x8E79DCB0), SPH_C32(0x603A180E), + SPH_C32(0x6C9E0E8B), SPH_C32(0xB01E8A3E), + SPH_C32(0xD71577C1), SPH_C32(0xBD314B27), + SPH_C32(0x78AF2FDA), SPH_C32(0x55605C60), + SPH_C32(0xE65525F3), SPH_C32(0xAA55AB94), + SPH_C32(0x57489862), SPH_C32(0x63E81440), + SPH_C32(0x55CA396A), SPH_C32(0x2AAB10B6), + SPH_C32(0xB4CC5C34), SPH_C32(0x1141E8CE), + SPH_C32(0xA15486AF), SPH_C32(0x7C72E993), + SPH_C32(0xB3EE1411), SPH_C32(0x636FBC2A), + SPH_C32(0x2BA9C55D), SPH_C32(0x741831F6), + SPH_C32(0xCE5C3E16), SPH_C32(0x9B87931E), + SPH_C32(0xAFD6BA33), SPH_C32(0x6C24CF5C) +}; + +static const sph_u32 RK4[32] = { + SPH_C32(0x7A325381), SPH_C32(0x28958677), + SPH_C32(0x3B8F4898), SPH_C32(0x6B4BB9AF), + SPH_C32(0xC4BFE81B), SPH_C32(0x66282193), + SPH_C32(0x61D809CC), SPH_C32(0xFB21A991), + SPH_C32(0x487CAC60), SPH_C32(0x5DEC8032), + SPH_C32(0xEF845D5D), SPH_C32(0xE98575B1), + SPH_C32(0xDC262302), SPH_C32(0xEB651B88), + SPH_C32(0x23893E81), SPH_C32(0xD396ACC5), + SPH_C32(0x0F6D6FF3), SPH_C32(0x83F44239), + SPH_C32(0x2E0B4482), SPH_C32(0xA4842004), + SPH_C32(0x69C8F04A), SPH_C32(0x9E1F9B5E), + SPH_C32(0x21C66842), SPH_C32(0xF6E96C9A), + SPH_C32(0x670C9C61), SPH_C32(0xABD388F0), + SPH_C32(0x6A51A0D2), SPH_C32(0xD8542F68), + SPH_C32(0x960FA728), SPH_C32(0xAB5133A3), + SPH_C32(0x6EEF0B6C), SPH_C32(0x137A3BE4) +}; + +static const sph_u32 RK5[32] = { + SPH_C32(0xBA3BF050), SPH_C32(0x7EFB2A98), + SPH_C32(0xA1F1651D), SPH_C32(0x39AF0176), + SPH_C32(0x66CA593E), SPH_C32(0x82430E88), + SPH_C32(0x8CEE8619), SPH_C32(0x456F9FB4), + SPH_C32(0x7D84A5C3), SPH_C32(0x3B8B5EBE), + SPH_C32(0xE06F75D8), SPH_C32(0x85C12073), + SPH_C32(0x401A449F), SPH_C32(0x56C16AA6), + SPH_C32(0x4ED3AA62), SPH_C32(0x363F7706), + SPH_C32(0x1BFEDF72), SPH_C32(0x429B023D), + SPH_C32(0x37D0D724), SPH_C32(0xD00A1248), + SPH_C32(0xDB0FEAD3), SPH_C32(0x49F1C09B), + SPH_C32(0x075372C9), SPH_C32(0x80991B7B), + SPH_C32(0x25D479D8), SPH_C32(0xF6E8DEF7), + SPH_C32(0xE3FE501A), SPH_C32(0xB6794C3B), + SPH_C32(0x976CE0BD), SPH_C32(0x04C006BA), + SPH_C32(0xC1A94FB6), SPH_C32(0x409F60C4) +}; + +#else + +#define PASS1(n, in) do { \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, in( 0), SPH_C32(0x00000000)); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, in( 1), SPH_C32(0x00000000)); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, in( 2), SPH_C32(0x00000000)); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, in( 3), SPH_C32(0x00000000)); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, in( 4), SPH_C32(0x00000000)); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, in( 5), SPH_C32(0x00000000)); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, in( 6), SPH_C32(0x00000000)); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, in( 7), SPH_C32(0x00000000)); \ + \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, in( 8), SPH_C32(0x00000000)); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, in( 9), SPH_C32(0x00000000)); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, in(10), SPH_C32(0x00000000)); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, in(11), SPH_C32(0x00000000)); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, in(12), SPH_C32(0x00000000)); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, in(13), SPH_C32(0x00000000)); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, in(14), SPH_C32(0x00000000)); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, in(15), SPH_C32(0x00000000)); \ + \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, in(16), SPH_C32(0x00000000)); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, in(17), SPH_C32(0x00000000)); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, in(18), SPH_C32(0x00000000)); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, in(19), SPH_C32(0x00000000)); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, in(20), SPH_C32(0x00000000)); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, in(21), SPH_C32(0x00000000)); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, in(22), SPH_C32(0x00000000)); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, in(23), SPH_C32(0x00000000)); \ + \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, in(24), SPH_C32(0x00000000)); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, in(25), SPH_C32(0x00000000)); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, in(26), SPH_C32(0x00000000)); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, in(27), SPH_C32(0x00000000)); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, in(28), SPH_C32(0x00000000)); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, in(29), SPH_C32(0x00000000)); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, in(30), SPH_C32(0x00000000)); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, in(31), SPH_C32(0x00000000)); \ + } while (0) + +#define PASS2(n, in) do { \ + STEP(n, 2, s7, s6, s5, s4, s3, s2, s1, s0, in( 5), SPH_C32(0x452821E6)); \ + STEP(n, 2, s6, s5, s4, s3, s2, s1, s0, s7, in(14), SPH_C32(0x38D01377)); \ + STEP(n, 2, s5, s4, s3, s2, s1, s0, s7, s6, in(26), SPH_C32(0xBE5466CF)); \ + STEP(n, 2, s4, s3, s2, s1, s0, s7, s6, s5, in(18), SPH_C32(0x34E90C6C)); \ + STEP(n, 2, s3, s2, s1, s0, s7, s6, s5, s4, in(11), SPH_C32(0xC0AC29B7)); \ + STEP(n, 2, s2, s1, s0, s7, s6, s5, s4, s3, in(28), SPH_C32(0xC97C50DD)); \ + STEP(n, 2, s1, s0, s7, s6, s5, s4, s3, s2, in( 7), SPH_C32(0x3F84D5B5)); \ + STEP(n, 2, s0, s7, s6, s5, s4, s3, s2, s1, in(16), SPH_C32(0xB5470917)); \ + \ + STEP(n, 2, s7, s6, s5, s4, s3, s2, s1, s0, in( 0), SPH_C32(0x9216D5D9)); \ + STEP(n, 2, s6, s5, s4, s3, s2, s1, s0, s7, in(23), SPH_C32(0x8979FB1B)); \ + STEP(n, 2, s5, s4, s3, s2, s1, s0, s7, s6, in(20), SPH_C32(0xD1310BA6)); \ + STEP(n, 2, s4, s3, s2, s1, s0, s7, s6, s5, in(22), SPH_C32(0x98DFB5AC)); \ + STEP(n, 2, s3, s2, s1, s0, s7, s6, s5, s4, in( 1), SPH_C32(0x2FFD72DB)); \ + STEP(n, 2, s2, s1, s0, s7, s6, s5, s4, s3, in(10), SPH_C32(0xD01ADFB7)); \ + STEP(n, 2, s1, s0, s7, s6, s5, s4, s3, s2, in( 4), SPH_C32(0xB8E1AFED)); \ + STEP(n, 2, s0, s7, s6, s5, s4, s3, s2, s1, in( 8), SPH_C32(0x6A267E96)); \ + \ + STEP(n, 2, s7, s6, s5, s4, s3, s2, s1, s0, in(30), SPH_C32(0xBA7C9045)); \ + STEP(n, 2, s6, s5, s4, s3, s2, s1, s0, s7, in( 3), SPH_C32(0xF12C7F99)); \ + STEP(n, 2, s5, s4, s3, s2, s1, s0, s7, s6, in(21), SPH_C32(0x24A19947)); \ + STEP(n, 2, s4, s3, s2, s1, s0, s7, s6, s5, in( 9), SPH_C32(0xB3916CF7)); \ + STEP(n, 2, s3, s2, s1, s0, s7, s6, s5, s4, in(17), SPH_C32(0x0801F2E2)); \ + STEP(n, 2, s2, s1, s0, s7, s6, s5, s4, s3, in(24), SPH_C32(0x858EFC16)); \ + STEP(n, 2, s1, s0, s7, s6, s5, s4, s3, s2, in(29), SPH_C32(0x636920D8)); \ + STEP(n, 2, s0, s7, s6, s5, s4, s3, s2, s1, in( 6), SPH_C32(0x71574E69)); \ + \ + STEP(n, 2, s7, s6, s5, s4, s3, s2, s1, s0, in(19), SPH_C32(0xA458FEA3)); \ + STEP(n, 2, s6, s5, s4, s3, s2, s1, s0, s7, in(12), SPH_C32(0xF4933D7E)); \ + STEP(n, 2, s5, s4, s3, s2, s1, s0, s7, s6, in(15), SPH_C32(0x0D95748F)); \ + STEP(n, 2, s4, s3, s2, s1, s0, s7, s6, s5, in(13), SPH_C32(0x728EB658)); \ + STEP(n, 2, s3, s2, s1, s0, s7, s6, s5, s4, in( 2), SPH_C32(0x718BCD58)); \ + STEP(n, 2, s2, s1, s0, s7, s6, s5, s4, s3, in(25), SPH_C32(0x82154AEE)); \ + STEP(n, 2, s1, s0, s7, s6, s5, s4, s3, s2, in(31), SPH_C32(0x7B54A41D)); \ + STEP(n, 2, s0, s7, s6, s5, s4, s3, s2, s1, in(27), SPH_C32(0xC25A59B5)); \ + } while (0) + +#define PASS3(n, in) do { \ + STEP(n, 3, s7, s6, s5, s4, s3, s2, s1, s0, in(19), SPH_C32(0x9C30D539)); \ + STEP(n, 3, s6, s5, s4, s3, s2, s1, s0, s7, in( 9), SPH_C32(0x2AF26013)); \ + STEP(n, 3, s5, s4, s3, s2, s1, s0, s7, s6, in( 4), SPH_C32(0xC5D1B023)); \ + STEP(n, 3, s4, s3, s2, s1, s0, s7, s6, s5, in(20), SPH_C32(0x286085F0)); \ + STEP(n, 3, s3, s2, s1, s0, s7, s6, s5, s4, in(28), SPH_C32(0xCA417918)); \ + STEP(n, 3, s2, s1, s0, s7, s6, s5, s4, s3, in(17), SPH_C32(0xB8DB38EF)); \ + STEP(n, 3, s1, s0, s7, s6, s5, s4, s3, s2, in( 8), SPH_C32(0x8E79DCB0)); \ + STEP(n, 3, s0, s7, s6, s5, s4, s3, s2, s1, in(22), SPH_C32(0x603A180E)); \ + \ + STEP(n, 3, s7, s6, s5, s4, s3, s2, s1, s0, in(29), SPH_C32(0x6C9E0E8B)); \ + STEP(n, 3, s6, s5, s4, s3, s2, s1, s0, s7, in(14), SPH_C32(0xB01E8A3E)); \ + STEP(n, 3, s5, s4, s3, s2, s1, s0, s7, s6, in(25), SPH_C32(0xD71577C1)); \ + STEP(n, 3, s4, s3, s2, s1, s0, s7, s6, s5, in(12), SPH_C32(0xBD314B27)); \ + STEP(n, 3, s3, s2, s1, s0, s7, s6, s5, s4, in(24), SPH_C32(0x78AF2FDA)); \ + STEP(n, 3, s2, s1, s0, s7, s6, s5, s4, s3, in(30), SPH_C32(0x55605C60)); \ + STEP(n, 3, s1, s0, s7, s6, s5, s4, s3, s2, in(16), SPH_C32(0xE65525F3)); \ + STEP(n, 3, s0, s7, s6, s5, s4, s3, s2, s1, in(26), SPH_C32(0xAA55AB94)); \ + \ + STEP(n, 3, s7, s6, s5, s4, s3, s2, s1, s0, in(31), SPH_C32(0x57489862)); \ + STEP(n, 3, s6, s5, s4, s3, s2, s1, s0, s7, in(15), SPH_C32(0x63E81440)); \ + STEP(n, 3, s5, s4, s3, s2, s1, s0, s7, s6, in( 7), SPH_C32(0x55CA396A)); \ + STEP(n, 3, s4, s3, s2, s1, s0, s7, s6, s5, in( 3), SPH_C32(0x2AAB10B6)); \ + STEP(n, 3, s3, s2, s1, s0, s7, s6, s5, s4, in( 1), SPH_C32(0xB4CC5C34)); \ + STEP(n, 3, s2, s1, s0, s7, s6, s5, s4, s3, in( 0), SPH_C32(0x1141E8CE)); \ + STEP(n, 3, s1, s0, s7, s6, s5, s4, s3, s2, in(18), SPH_C32(0xA15486AF)); \ + STEP(n, 3, s0, s7, s6, s5, s4, s3, s2, s1, in(27), SPH_C32(0x7C72E993)); \ + \ + STEP(n, 3, s7, s6, s5, s4, s3, s2, s1, s0, in(13), SPH_C32(0xB3EE1411)); \ + STEP(n, 3, s6, s5, s4, s3, s2, s1, s0, s7, in( 6), SPH_C32(0x636FBC2A)); \ + STEP(n, 3, s5, s4, s3, s2, s1, s0, s7, s6, in(21), SPH_C32(0x2BA9C55D)); \ + STEP(n, 3, s4, s3, s2, s1, s0, s7, s6, s5, in(10), SPH_C32(0x741831F6)); \ + STEP(n, 3, s3, s2, s1, s0, s7, s6, s5, s4, in(23), SPH_C32(0xCE5C3E16)); \ + STEP(n, 3, s2, s1, s0, s7, s6, s5, s4, s3, in(11), SPH_C32(0x9B87931E)); \ + STEP(n, 3, s1, s0, s7, s6, s5, s4, s3, s2, in( 5), SPH_C32(0xAFD6BA33)); \ + STEP(n, 3, s0, s7, s6, s5, s4, s3, s2, s1, in( 2), SPH_C32(0x6C24CF5C)); \ + } while (0) + +#define PASS4(n, in) do { \ + STEP(n, 4, s7, s6, s5, s4, s3, s2, s1, s0, in(24), SPH_C32(0x7A325381)); \ + STEP(n, 4, s6, s5, s4, s3, s2, s1, s0, s7, in( 4), SPH_C32(0x28958677)); \ + STEP(n, 4, s5, s4, s3, s2, s1, s0, s7, s6, in( 0), SPH_C32(0x3B8F4898)); \ + STEP(n, 4, s4, s3, s2, s1, s0, s7, s6, s5, in(14), SPH_C32(0x6B4BB9AF)); \ + STEP(n, 4, s3, s2, s1, s0, s7, s6, s5, s4, in( 2), SPH_C32(0xC4BFE81B)); \ + STEP(n, 4, s2, s1, s0, s7, s6, s5, s4, s3, in( 7), SPH_C32(0x66282193)); \ + STEP(n, 4, s1, s0, s7, s6, s5, s4, s3, s2, in(28), SPH_C32(0x61D809CC)); \ + STEP(n, 4, s0, s7, s6, s5, s4, s3, s2, s1, in(23), SPH_C32(0xFB21A991)); \ + \ + STEP(n, 4, s7, s6, s5, s4, s3, s2, s1, s0, in(26), SPH_C32(0x487CAC60)); \ + STEP(n, 4, s6, s5, s4, s3, s2, s1, s0, s7, in( 6), SPH_C32(0x5DEC8032)); \ + STEP(n, 4, s5, s4, s3, s2, s1, s0, s7, s6, in(30), SPH_C32(0xEF845D5D)); \ + STEP(n, 4, s4, s3, s2, s1, s0, s7, s6, s5, in(20), SPH_C32(0xE98575B1)); \ + STEP(n, 4, s3, s2, s1, s0, s7, s6, s5, s4, in(18), SPH_C32(0xDC262302)); \ + STEP(n, 4, s2, s1, s0, s7, s6, s5, s4, s3, in(25), SPH_C32(0xEB651B88)); \ + STEP(n, 4, s1, s0, s7, s6, s5, s4, s3, s2, in(19), SPH_C32(0x23893E81)); \ + STEP(n, 4, s0, s7, s6, s5, s4, s3, s2, s1, in( 3), SPH_C32(0xD396ACC5)); \ + \ + STEP(n, 4, s7, s6, s5, s4, s3, s2, s1, s0, in(22), SPH_C32(0x0F6D6FF3)); \ + STEP(n, 4, s6, s5, s4, s3, s2, s1, s0, s7, in(11), SPH_C32(0x83F44239)); \ + STEP(n, 4, s5, s4, s3, s2, s1, s0, s7, s6, in(31), SPH_C32(0x2E0B4482)); \ + STEP(n, 4, s4, s3, s2, s1, s0, s7, s6, s5, in(21), SPH_C32(0xA4842004)); \ + STEP(n, 4, s3, s2, s1, s0, s7, s6, s5, s4, in( 8), SPH_C32(0x69C8F04A)); \ + STEP(n, 4, s2, s1, s0, s7, s6, s5, s4, s3, in(27), SPH_C32(0x9E1F9B5E)); \ + STEP(n, 4, s1, s0, s7, s6, s5, s4, s3, s2, in(12), SPH_C32(0x21C66842)); \ + STEP(n, 4, s0, s7, s6, s5, s4, s3, s2, s1, in( 9), SPH_C32(0xF6E96C9A)); \ + \ + STEP(n, 4, s7, s6, s5, s4, s3, s2, s1, s0, in( 1), SPH_C32(0x670C9C61)); \ + STEP(n, 4, s6, s5, s4, s3, s2, s1, s0, s7, in(29), SPH_C32(0xABD388F0)); \ + STEP(n, 4, s5, s4, s3, s2, s1, s0, s7, s6, in( 5), SPH_C32(0x6A51A0D2)); \ + STEP(n, 4, s4, s3, s2, s1, s0, s7, s6, s5, in(15), SPH_C32(0xD8542F68)); \ + STEP(n, 4, s3, s2, s1, s0, s7, s6, s5, s4, in(17), SPH_C32(0x960FA728)); \ + STEP(n, 4, s2, s1, s0, s7, s6, s5, s4, s3, in(10), SPH_C32(0xAB5133A3)); \ + STEP(n, 4, s1, s0, s7, s6, s5, s4, s3, s2, in(16), SPH_C32(0x6EEF0B6C)); \ + STEP(n, 4, s0, s7, s6, s5, s4, s3, s2, s1, in(13), SPH_C32(0x137A3BE4)); \ + } while (0) + +#define PASS5(n, in) do { \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in(27), SPH_C32(0xBA3BF050)); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in( 3), SPH_C32(0x7EFB2A98)); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in(21), SPH_C32(0xA1F1651D)); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in(26), SPH_C32(0x39AF0176)); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in(17), SPH_C32(0x66CA593E)); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in(11), SPH_C32(0x82430E88)); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in(20), SPH_C32(0x8CEE8619)); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in(29), SPH_C32(0x456F9FB4)); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in(19), SPH_C32(0x7D84A5C3)); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in( 0), SPH_C32(0x3B8B5EBE)); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in(12), SPH_C32(0xE06F75D8)); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in( 7), SPH_C32(0x85C12073)); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in(13), SPH_C32(0x401A449F)); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in( 8), SPH_C32(0x56C16AA6)); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in(31), SPH_C32(0x4ED3AA62)); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in(10), SPH_C32(0x363F7706)); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in( 5), SPH_C32(0x1BFEDF72)); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in( 9), SPH_C32(0x429B023D)); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in(14), SPH_C32(0x37D0D724)); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in(30), SPH_C32(0xD00A1248)); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in(18), SPH_C32(0xDB0FEAD3)); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in( 6), SPH_C32(0x49F1C09B)); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in(28), SPH_C32(0x075372C9)); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in(24), SPH_C32(0x80991B7B)); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in( 2), SPH_C32(0x25D479D8)); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in(23), SPH_C32(0xF6E8DEF7)); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in(16), SPH_C32(0xE3FE501A)); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in(22), SPH_C32(0xB6794C3B)); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in( 4), SPH_C32(0x976CE0BD)); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in( 1), SPH_C32(0x04C006BA)); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in(25), SPH_C32(0xC1A94FB6)); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in(15), SPH_C32(0x409F60C4)); \ + } while (0) + +#endif + +#define SAVE_STATE \ + sph_u32 u0, u1, u2, u3, u4, u5, u6, u7; \ + do { \ + u0 = s0; \ + u1 = s1; \ + u2 = s2; \ + u3 = s3; \ + u4 = s4; \ + u5 = s5; \ + u6 = s6; \ + u7 = s7; \ + } while (0) + +#define UPDATE_STATE do { \ + s0 = SPH_T32(s0 + u0); \ + s1 = SPH_T32(s1 + u1); \ + s2 = SPH_T32(s2 + u2); \ + s3 = SPH_T32(s3 + u3); \ + s4 = SPH_T32(s4 + u4); \ + s5 = SPH_T32(s5 + u5); \ + s6 = SPH_T32(s6 + u6); \ + s7 = SPH_T32(s7 + u7); \ + } while (0) + +/* + * COREn(in) performs the core HAVAL computation for "n" passes, using + * the one-argument macro "in" to access the input words. Running state + * is held in variable "s0" to "s7". + */ + +#define CORE3(in) do { \ + SAVE_STATE; \ + PASS1(3, in); \ + PASS2(3, in); \ + PASS3(3, in); \ + UPDATE_STATE; \ + } while (0) + +#define CORE4(in) do { \ + SAVE_STATE; \ + PASS1(4, in); \ + PASS2(4, in); \ + PASS3(4, in); \ + PASS4(4, in); \ + UPDATE_STATE; \ + } while (0) + +#define CORE5(in) do { \ + SAVE_STATE; \ + PASS1(5, in); \ + PASS2(5, in); \ + PASS3(5, in); \ + PASS4(5, in); \ + PASS5(5, in); \ + UPDATE_STATE; \ + } while (0) + +/* + * DSTATE declares the state variables "s0" to "s7". + */ +#define DSTATE sph_u32 s0, s1, s2, s3, s4, s5, s6, s7 + +/* + * RSTATE fills the state variables from the context "sc". + */ +#define RSTATE do { \ + s0 = sc->s0; \ + s1 = sc->s1; \ + s2 = sc->s2; \ + s3 = sc->s3; \ + s4 = sc->s4; \ + s5 = sc->s5; \ + s6 = sc->s6; \ + s7 = sc->s7; \ + } while (0) + +/* + * WSTATE updates the context "sc" from the state variables. + */ +#define WSTATE do { \ + sc->s0 = s0; \ + sc->s1 = s1; \ + sc->s2 = s2; \ + sc->s3 = s3; \ + sc->s4 = s4; \ + sc->s5 = s5; \ + sc->s6 = s6; \ + sc->s7 = s7; \ + } while (0) + +/* + * Initialize a context. "olen" is the output length, in 32-bit words + * (between 4 and 8, inclusive). "passes" is the number of passes + * (3, 4 or 5). + */ +static void +haval_init(sph_haval_context *sc, unsigned olen, unsigned passes) +{ + sc->s0 = SPH_C32(0x243F6A88); + sc->s1 = SPH_C32(0x85A308D3); + sc->s2 = SPH_C32(0x13198A2E); + sc->s3 = SPH_C32(0x03707344); + sc->s4 = SPH_C32(0xA4093822); + sc->s5 = SPH_C32(0x299F31D0); + sc->s6 = SPH_C32(0x082EFA98); + sc->s7 = SPH_C32(0xEC4E6C89); + sc->olen = olen; + sc->passes = passes; +#if SPH_64 + sc->count = 0; +#else + sc->count_high = 0; + sc->count_low = 0; +#endif + +} + +/* + * IN_PREPARE(data) contains declarations and code to prepare for + * reading input words pointed to by "data". + * INW(i) reads the word number "i" (from 0 to 31). + */ +#if SPH_LITTLE_FAST +#define IN_PREPARE(indata) const unsigned char *const load_ptr = \ + (const unsigned char *)(indata) +#define INW(i) sph_dec32le_aligned(load_ptr + 4 * (i)) +#else +#define IN_PREPARE(indata) \ + sph_u32 X_var[32]; \ + int load_index; \ + \ + for (load_index = 0; load_index < 32; load_index ++) \ + X_var[load_index] = sph_dec32le_aligned( \ + (const unsigned char *)(indata) + 4 * load_index) +#define INW(i) X_var[i] +#endif + +/* + * Mixing operation used for 128-bit output tailoring. This function + * takes the byte 0 from a0, byte 1 from a1, byte 2 from a2 and byte 3 + * from a3, and combines them into a 32-bit word, which is then rotated + * to the left by n bits. + */ +static SPH_INLINE sph_u32 +mix128(sph_u32 a0, sph_u32 a1, sph_u32 a2, sph_u32 a3, int n) +{ + sph_u32 tmp; + + tmp = (a0 & SPH_C32(0x000000FF)) + | (a1 & SPH_C32(0x0000FF00)) + | (a2 & SPH_C32(0x00FF0000)) + | (a3 & SPH_C32(0xFF000000)); + if (n > 0) + tmp = SPH_ROTL32(tmp, n); + return tmp; +} + +/* + * Mixing operation used to compute output word 0 for 160-bit output. + */ +static SPH_INLINE sph_u32 +mix160_0(sph_u32 x5, sph_u32 x6, sph_u32 x7) +{ + sph_u32 tmp; + + tmp = (x5 & SPH_C32(0x01F80000)) + | (x6 & SPH_C32(0xFE000000)) + | (x7 & SPH_C32(0x0000003F)); + return SPH_ROTL32(tmp, 13); +} + +/* + * Mixing operation used to compute output word 1 for 160-bit output. + */ +static SPH_INLINE sph_u32 +mix160_1(sph_u32 x5, sph_u32 x6, sph_u32 x7) +{ + sph_u32 tmp; + + tmp = (x5 & SPH_C32(0xFE000000)) + | (x6 & SPH_C32(0x0000003F)) + | (x7 & SPH_C32(0x00000FC0)); + return SPH_ROTL32(tmp, 7); +} + +/* + * Mixing operation used to compute output word 2 for 160-bit output. + */ +static SPH_INLINE sph_u32 +mix160_2(sph_u32 x5, sph_u32 x6, sph_u32 x7) +{ + sph_u32 tmp; + + tmp = (x5 & SPH_C32(0x0000003F)) + | (x6 & SPH_C32(0x00000FC0)) + | (x7 & SPH_C32(0x0007F000)); + return tmp; +} + +/* + * Mixing operation used to compute output word 3 for 160-bit output. + */ +static SPH_INLINE sph_u32 +mix160_3(sph_u32 x5, sph_u32 x6, sph_u32 x7) +{ + sph_u32 tmp; + + tmp = (x5 & SPH_C32(0x00000FC0)) + | (x6 & SPH_C32(0x0007F000)) + | (x7 & SPH_C32(0x01F80000)); + return tmp >> 6; +} + +/* + * Mixing operation used to compute output word 4 for 160-bit output. + */ +static SPH_INLINE sph_u32 +mix160_4(sph_u32 x5, sph_u32 x6, sph_u32 x7) +{ + sph_u32 tmp; + + tmp = (x5 & SPH_C32(0x0007F000)) + | (x6 & SPH_C32(0x01F80000)) + | (x7 & SPH_C32(0xFE000000)); + return tmp >> 12; +} + +/* + * Mixing operation used to compute output word 0 for 192-bit output. + */ +static SPH_INLINE sph_u32 +mix192_0(sph_u32 x6, sph_u32 x7) +{ + sph_u32 tmp; + + tmp = (x6 & SPH_C32(0xFC000000)) | (x7 & SPH_C32(0x0000001F)); + return SPH_ROTL32(tmp, 6); +} + +/* + * Mixing operation used to compute output word 1 for 192-bit output. + */ +static SPH_INLINE sph_u32 +mix192_1(sph_u32 x6, sph_u32 x7) +{ + return (x6 & SPH_C32(0x0000001F)) | (x7 & SPH_C32(0x000003E0)); +} + +/* + * Mixing operation used to compute output word 2 for 192-bit output. + */ +static SPH_INLINE sph_u32 +mix192_2(sph_u32 x6, sph_u32 x7) +{ + return ((x6 & SPH_C32(0x000003E0)) | (x7 & SPH_C32(0x0000FC00))) >> 5; +} + +/* + * Mixing operation used to compute output word 3 for 192-bit output. + */ +static SPH_INLINE sph_u32 +mix192_3(sph_u32 x6, sph_u32 x7) +{ + return ((x6 & SPH_C32(0x0000FC00)) | (x7 & SPH_C32(0x001F0000))) >> 10; +} + +/* + * Mixing operation used to compute output word 4 for 192-bit output. + */ +static SPH_INLINE sph_u32 +mix192_4(sph_u32 x6, sph_u32 x7) +{ + return ((x6 & SPH_C32(0x001F0000)) | (x7 & SPH_C32(0x03E00000))) >> 16; +} + +/* + * Mixing operation used to compute output word 5 for 192-bit output. + */ +static SPH_INLINE sph_u32 +mix192_5(sph_u32 x6, sph_u32 x7) +{ + return ((x6 & SPH_C32(0x03E00000)) | (x7 & SPH_C32(0xFC000000))) >> 21; +} + +/* + * Write out HAVAL output. The output length is tailored to the requested + * length. + */ +static void +haval_out(sph_haval_context *sc, void *dst) +{ + DSTATE; + unsigned char *buf; + + buf = dst; + RSTATE; + switch (sc->olen) { + case 4: + sph_enc32le(buf, SPH_T32(s0 + mix128(s7, s4, s5, s6, 24))); + sph_enc32le(buf + 4, SPH_T32(s1 + mix128(s6, s7, s4, s5, 16))); + sph_enc32le(buf + 8, SPH_T32(s2 + mix128(s5, s6, s7, s4, 8))); + sph_enc32le(buf + 12, SPH_T32(s3 + mix128(s4, s5, s6, s7, 0))); + break; + case 5: + sph_enc32le(buf, SPH_T32(s0 + mix160_0(s5, s6, s7))); + sph_enc32le(buf + 4, SPH_T32(s1 + mix160_1(s5, s6, s7))); + sph_enc32le(buf + 8, SPH_T32(s2 + mix160_2(s5, s6, s7))); + sph_enc32le(buf + 12, SPH_T32(s3 + mix160_3(s5, s6, s7))); + sph_enc32le(buf + 16, SPH_T32(s4 + mix160_4(s5, s6, s7))); + break; + case 6: + sph_enc32le(buf, SPH_T32(s0 + mix192_0(s6, s7))); + sph_enc32le(buf + 4, SPH_T32(s1 + mix192_1(s6, s7))); + sph_enc32le(buf + 8, SPH_T32(s2 + mix192_2(s6, s7))); + sph_enc32le(buf + 12, SPH_T32(s3 + mix192_3(s6, s7))); + sph_enc32le(buf + 16, SPH_T32(s4 + mix192_4(s6, s7))); + sph_enc32le(buf + 20, SPH_T32(s5 + mix192_5(s6, s7))); + break; + case 7: + sph_enc32le(buf, SPH_T32(s0 + ((s7 >> 27) & 0x1F))); + sph_enc32le(buf + 4, SPH_T32(s1 + ((s7 >> 22) & 0x1F))); + sph_enc32le(buf + 8, SPH_T32(s2 + ((s7 >> 18) & 0x0F))); + sph_enc32le(buf + 12, SPH_T32(s3 + ((s7 >> 13) & 0x1F))); + sph_enc32le(buf + 16, SPH_T32(s4 + ((s7 >> 9) & 0x0F))); + sph_enc32le(buf + 20, SPH_T32(s5 + ((s7 >> 4) & 0x1F))); + sph_enc32le(buf + 24, SPH_T32(s6 + ((s7 ) & 0x0F))); + break; + case 8: + sph_enc32le(buf, s0); + sph_enc32le(buf + 4, s1); + sph_enc32le(buf + 8, s2); + sph_enc32le(buf + 12, s3); + sph_enc32le(buf + 16, s4); + sph_enc32le(buf + 20, s5); + sph_enc32le(buf + 24, s6); + sph_enc32le(buf + 28, s7); + break; + } +} + +/* + * The main core functions inline the code with the COREx() macros. We + * use a helper file, included three times, which avoids code copying. + */ + +#undef PASSES +#define PASSES 3 +#include "haval_helper.c" + +#undef PASSES +#define PASSES 4 +#include "haval_helper.c" + +#undef PASSES +#define PASSES 5 +#include "haval_helper.c" + +/* ====================================================================== */ + +#define API(xxx, y) \ +void \ +sph_haval ## xxx ## _ ## y ## _init(void *cc) \ +{ \ + haval_init(cc, xxx >> 5, y); \ +} \ + \ +void \ +sph_haval ## xxx ## _ ## y (void *cc, const void *data, size_t len) \ +{ \ + haval ## y(cc, data, len); \ +} \ + \ +void \ +sph_haval ## xxx ## _ ## y ## _close(void *cc, void *dst) \ +{ \ + haval ## y ## _close(cc, 0, 0, dst); \ +} \ + \ +void \ +sph_haval ## xxx ## _ ## y ## addbits_and_close( \ + void *cc, unsigned ub, unsigned n, void *dst) \ +{ \ + haval ## y ## _close(cc, ub, n, dst); \ +} + +API(128, 3) +API(128, 4) +API(128, 5) +API(160, 3) +API(160, 4) +API(160, 5) +API(192, 3) +API(192, 4) +API(192, 5) +API(224, 3) +API(224, 4) +API(224, 5) +API(256, 3) +API(256, 4) +API(256, 5) + +#define RVAL do { \ + s0 = val[0]; \ + s1 = val[1]; \ + s2 = val[2]; \ + s3 = val[3]; \ + s4 = val[4]; \ + s5 = val[5]; \ + s6 = val[6]; \ + s7 = val[7]; \ + } while (0) + +#define WVAL do { \ + val[0] = s0; \ + val[1] = s1; \ + val[2] = s2; \ + val[3] = s3; \ + val[4] = s4; \ + val[5] = s5; \ + val[6] = s6; \ + val[7] = s7; \ + } while (0) + +#define INMSG(i) msg[i] + +/* see sph_haval.h */ +void +sph_haval_3_comp(const sph_u32 msg[32], sph_u32 val[8]) +{ + DSTATE; + + RVAL; + CORE3(INMSG); + WVAL; +} + +/* see sph_haval.h */ +void +sph_haval_4_comp(const sph_u32 msg[32], sph_u32 val[8]) +{ + DSTATE; + + RVAL; + CORE4(INMSG); + WVAL; +} + +/* see sph_haval.h */ +void +sph_haval_5_comp(const sph_u32 msg[32], sph_u32 val[8]) +{ + DSTATE; + + RVAL; + CORE5(INMSG); + WVAL; +} + +#ifdef __cplusplus +} +#endif diff --git a/sph/haval_helper.c b/sph/haval_helper.c new file mode 100644 index 0000000..26fde16 --- /dev/null +++ b/sph/haval_helper.c @@ -0,0 +1,188 @@ +/* $Id: haval_helper.c 218 2010-06-08 17:06:34Z tp $ */ +/* + * Helper code, included (three times !) by HAVAL implementation. + * + * TODO: try to merge this with md_helper.c. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#undef SPH_XCAT +#define SPH_XCAT(a, b) SPH_XCAT_(a, b) +#undef SPH_XCAT_ +#define SPH_XCAT_(a, b) a ## b + +static void +#ifdef SPH_UPTR +SPH_XCAT(SPH_XCAT(haval, PASSES), _short) +#else +SPH_XCAT(haval, PASSES) +#endif +(sph_haval_context *sc, const void *data, size_t len) +{ + unsigned current; + +#if SPH_64 + current = (unsigned)sc->count & 127U; +#else + current = (unsigned)sc->count_low & 127U; +#endif + while (len > 0) { + unsigned clen; +#if !SPH_64 + sph_u32 clow, clow2; +#endif + + clen = 128U - current; + if (clen > len) + clen = len; + memcpy(sc->buf + current, data, clen); + data = (const unsigned char *)data + clen; + current += clen; + len -= clen; + if (current == 128U) { + DSTATE; + IN_PREPARE(sc->buf); + RSTATE; + SPH_XCAT(CORE, PASSES)(INW); + WSTATE; + current = 0; + } +#if SPH_64 + sc->count += clen; +#else + clow = sc->count_low; + clow2 = SPH_T32(clow + clen); + sc->count_low = clow2; + if (clow2 < clow) + sc->count_high ++; +#endif + } +} + +#ifdef SPH_UPTR +static void +SPH_XCAT(haval, PASSES)(sph_haval_context *sc, const void *data, size_t len) +{ + unsigned current; + size_t orig_len; +#if !SPH_64 + sph_u32 clow, clow2; +#endif + DSTATE; + + if (len < 256U) { + SPH_XCAT(SPH_XCAT(haval, PASSES), _short)(sc, data, len); + return; + } +#if SPH_64 + current = (unsigned)sc->count & 127U; +#else + current = (unsigned)sc->count_low & 127U; +#endif + if (current > 0) { + unsigned clen; + clen = 128U - current; + SPH_XCAT(SPH_XCAT(haval, PASSES), _short)(sc, data, clen); + data = (const unsigned char *)data + clen; + len -= clen; + } +#if !SPH_UNALIGNED + if (((SPH_UPTR)data & 3U) != 0) { + SPH_XCAT(SPH_XCAT(haval, PASSES), _short)(sc, data, len); + return; + } +#endif + orig_len = len; + RSTATE; + while (len >= 128U) { + IN_PREPARE(data); + SPH_XCAT(CORE, PASSES)(INW); + data = (const unsigned char *)data + 128U; + len -= 128U; + } + WSTATE; + if (len > 0) + memcpy(sc->buf, data, len); +#if SPH_64 + sc->count += (sph_u64)orig_len; +#else + clow = sc->count_low; + clow2 = SPH_T32(clow + orig_len); + sc->count_low = clow2; + if (clow2 < clow) + sc->count_high ++; + orig_len >>= 12; + orig_len >>= 10; + orig_len >>= 10; + sc->count_high += orig_len; +#endif +} +#endif + +static void +SPH_XCAT(SPH_XCAT(haval, PASSES), _close)(sph_haval_context *sc,unsigned ub, unsigned n, void *dst){ + unsigned current; + DSTATE; + +#if SPH_64 + current = (unsigned)sc->count & 127U; +#else + current = (unsigned)sc->count_low & 127U; +#endif + sc->buf[current ++] = (0x01 << n) | ((ub & 0xFF) >> (8 - n)); + RSTATE; + if (current > 118U) { + memset(sc->buf + current, 0, 128U - current); + + do { + IN_PREPARE(sc->buf); + SPH_XCAT(CORE, PASSES)(INW); + } while (0); + current = 0; + } + memset(sc->buf + current, 0, 118U - current); + sc->buf[118] = 0x01 | (PASSES << 3); + sc->buf[119] = sc->olen << 3; +#if SPH_64 + sph_enc64le_aligned(sc->buf + 120, SPH_T64(sc->count << 3)); +#else + sph_enc32le_aligned(sc->buf + 120, SPH_T32(sc->count_low << 3)); + sph_enc32le_aligned(sc->buf + 124, + SPH_T32((sc->count_high << 3) | (sc->count_low >> 29))); +#endif + + do { + IN_PREPARE(sc->buf); + SPH_XCAT(CORE, PASSES)(INW); + } while (0); + WSTATE; + + haval_out(sc, dst); + haval_init(sc, sc->olen, sc->passes); +} diff --git a/sph/jh.c b/sph/jh.c new file mode 100644 index 0000000..4e26617 --- /dev/null +++ b/sph/jh.c @@ -0,0 +1,1107 @@ +/* $Id: jh.c 255 2011-06-07 19:50:20Z tp $ */ +/* + * JH implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_jh.h" + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_JH +#define SPH_SMALL_FOOTPRINT_JH 1 +#endif + +#if !defined SPH_JH_64 && SPH_64_TRUE +#define SPH_JH_64 1 +#endif + +#if !SPH_64 +#undef SPH_JH_64 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +/* + * The internal bitslice representation may use either big-endian or + * little-endian (true bitslice operations do not care about the bit + * ordering, and the bit-swapping linear operations in JH happen to + * be invariant through endianness-swapping). The constants must be + * defined according to the chosen endianness; we use some + * byte-swapping macros for that. + */ + +#if SPH_LITTLE_ENDIAN + +#define C32e(x) ((SPH_C32(x) >> 24) \ + | ((SPH_C32(x) >> 8) & SPH_C32(0x0000FF00)) \ + | ((SPH_C32(x) << 8) & SPH_C32(0x00FF0000)) \ + | ((SPH_C32(x) << 24) & SPH_C32(0xFF000000))) +#define dec32e_aligned sph_dec32le_aligned +#define enc32e sph_enc32le + +#if SPH_64 +#define C64e(x) ((SPH_C64(x) >> 56) \ + | ((SPH_C64(x) >> 40) & SPH_C64(0x000000000000FF00)) \ + | ((SPH_C64(x) >> 24) & SPH_C64(0x0000000000FF0000)) \ + | ((SPH_C64(x) >> 8) & SPH_C64(0x00000000FF000000)) \ + | ((SPH_C64(x) << 8) & SPH_C64(0x000000FF00000000)) \ + | ((SPH_C64(x) << 24) & SPH_C64(0x0000FF0000000000)) \ + | ((SPH_C64(x) << 40) & SPH_C64(0x00FF000000000000)) \ + | ((SPH_C64(x) << 56) & SPH_C64(0xFF00000000000000))) +#define dec64e_aligned sph_dec64le_aligned +#define enc64e sph_enc64le +#endif + +#else + +#define C32e(x) SPH_C32(x) +#define dec32e_aligned sph_dec32be_aligned +#define enc32e sph_enc32be +#if SPH_64 +#define C64e(x) SPH_C64(x) +#define dec64e_aligned sph_dec64be_aligned +#define enc64e sph_enc64be +#endif + +#endif + +#define Sb(x0, x1, x2, x3, c) do { \ + x3 = ~x3; \ + x0 ^= (c) & ~x2; \ + tmp = (c) ^ (x0 & x1); \ + x0 ^= x2 & x3; \ + x3 ^= ~x1 & x2; \ + x1 ^= x0 & x2; \ + x2 ^= x0 & ~x3; \ + x0 ^= x1 | x3; \ + x3 ^= x1 & x2; \ + x1 ^= tmp & x0; \ + x2 ^= tmp; \ + } while (0) + +#define Lb(x0, x1, x2, x3, x4, x5, x6, x7) do { \ + x4 ^= x1; \ + x5 ^= x2; \ + x6 ^= x3 ^ x0; \ + x7 ^= x0; \ + x0 ^= x5; \ + x1 ^= x6; \ + x2 ^= x7 ^ x4; \ + x3 ^= x4; \ + } while (0) + +#if SPH_JH_64 + +static const sph_u64 C[] = { + C64e(0x72d5dea2df15f867), C64e(0x7b84150ab7231557), + C64e(0x81abd6904d5a87f6), C64e(0x4e9f4fc5c3d12b40), + C64e(0xea983ae05c45fa9c), C64e(0x03c5d29966b2999a), + C64e(0x660296b4f2bb538a), C64e(0xb556141a88dba231), + C64e(0x03a35a5c9a190edb), C64e(0x403fb20a87c14410), + C64e(0x1c051980849e951d), C64e(0x6f33ebad5ee7cddc), + C64e(0x10ba139202bf6b41), C64e(0xdc786515f7bb27d0), + C64e(0x0a2c813937aa7850), C64e(0x3f1abfd2410091d3), + C64e(0x422d5a0df6cc7e90), C64e(0xdd629f9c92c097ce), + C64e(0x185ca70bc72b44ac), C64e(0xd1df65d663c6fc23), + C64e(0x976e6c039ee0b81a), C64e(0x2105457e446ceca8), + C64e(0xeef103bb5d8e61fa), C64e(0xfd9697b294838197), + C64e(0x4a8e8537db03302f), C64e(0x2a678d2dfb9f6a95), + C64e(0x8afe7381f8b8696c), C64e(0x8ac77246c07f4214), + C64e(0xc5f4158fbdc75ec4), C64e(0x75446fa78f11bb80), + C64e(0x52de75b7aee488bc), C64e(0x82b8001e98a6a3f4), + C64e(0x8ef48f33a9a36315), C64e(0xaa5f5624d5b7f989), + C64e(0xb6f1ed207c5ae0fd), C64e(0x36cae95a06422c36), + C64e(0xce2935434efe983d), C64e(0x533af974739a4ba7), + C64e(0xd0f51f596f4e8186), C64e(0x0e9dad81afd85a9f), + C64e(0xa7050667ee34626a), C64e(0x8b0b28be6eb91727), + C64e(0x47740726c680103f), C64e(0xe0a07e6fc67e487b), + C64e(0x0d550aa54af8a4c0), C64e(0x91e3e79f978ef19e), + C64e(0x8676728150608dd4), C64e(0x7e9e5a41f3e5b062), + C64e(0xfc9f1fec4054207a), C64e(0xe3e41a00cef4c984), + C64e(0x4fd794f59dfa95d8), C64e(0x552e7e1124c354a5), + C64e(0x5bdf7228bdfe6e28), C64e(0x78f57fe20fa5c4b2), + C64e(0x05897cefee49d32e), C64e(0x447e9385eb28597f), + C64e(0x705f6937b324314a), C64e(0x5e8628f11dd6e465), + C64e(0xc71b770451b920e7), C64e(0x74fe43e823d4878a), + C64e(0x7d29e8a3927694f2), C64e(0xddcb7a099b30d9c1), + C64e(0x1d1b30fb5bdc1be0), C64e(0xda24494ff29c82bf), + C64e(0xa4e7ba31b470bfff), C64e(0x0d324405def8bc48), + C64e(0x3baefc3253bbd339), C64e(0x459fc3c1e0298ba0), + C64e(0xe5c905fdf7ae090f), C64e(0x947034124290f134), + C64e(0xa271b701e344ed95), C64e(0xe93b8e364f2f984a), + C64e(0x88401d63a06cf615), C64e(0x47c1444b8752afff), + C64e(0x7ebb4af1e20ac630), C64e(0x4670b6c5cc6e8ce6), + C64e(0xa4d5a456bd4fca00), C64e(0xda9d844bc83e18ae), + C64e(0x7357ce453064d1ad), C64e(0xe8a6ce68145c2567), + C64e(0xa3da8cf2cb0ee116), C64e(0x33e906589a94999a), + C64e(0x1f60b220c26f847b), C64e(0xd1ceac7fa0d18518), + C64e(0x32595ba18ddd19d3), C64e(0x509a1cc0aaa5b446), + C64e(0x9f3d6367e4046bba), C64e(0xf6ca19ab0b56ee7e), + C64e(0x1fb179eaa9282174), C64e(0xe9bdf7353b3651ee), + C64e(0x1d57ac5a7550d376), C64e(0x3a46c2fea37d7001), + C64e(0xf735c1af98a4d842), C64e(0x78edec209e6b6779), + C64e(0x41836315ea3adba8), C64e(0xfac33b4d32832c83), + C64e(0xa7403b1f1c2747f3), C64e(0x5940f034b72d769a), + C64e(0xe73e4e6cd2214ffd), C64e(0xb8fd8d39dc5759ef), + C64e(0x8d9b0c492b49ebda), C64e(0x5ba2d74968f3700d), + C64e(0x7d3baed07a8d5584), C64e(0xf5a5e9f0e4f88e65), + C64e(0xa0b8a2f436103b53), C64e(0x0ca8079e753eec5a), + C64e(0x9168949256e8884f), C64e(0x5bb05c55f8babc4c), + C64e(0xe3bb3b99f387947b), C64e(0x75daf4d6726b1c5d), + C64e(0x64aeac28dc34b36d), C64e(0x6c34a550b828db71), + C64e(0xf861e2f2108d512a), C64e(0xe3db643359dd75fc), + C64e(0x1cacbcf143ce3fa2), C64e(0x67bbd13c02e843b0), + C64e(0x330a5bca8829a175), C64e(0x7f34194db416535c), + C64e(0x923b94c30e794d1e), C64e(0x797475d7b6eeaf3f), + C64e(0xeaa8d4f7be1a3921), C64e(0x5cf47e094c232751), + C64e(0x26a32453ba323cd2), C64e(0x44a3174a6da6d5ad), + C64e(0xb51d3ea6aff2c908), C64e(0x83593d98916b3c56), + C64e(0x4cf87ca17286604d), C64e(0x46e23ecc086ec7f6), + C64e(0x2f9833b3b1bc765e), C64e(0x2bd666a5efc4e62a), + C64e(0x06f4b6e8bec1d436), C64e(0x74ee8215bcef2163), + C64e(0xfdc14e0df453c969), C64e(0xa77d5ac406585826), + C64e(0x7ec1141606e0fa16), C64e(0x7e90af3d28639d3f), + C64e(0xd2c9f2e3009bd20c), C64e(0x5faace30b7d40c30), + C64e(0x742a5116f2e03298), C64e(0x0deb30d8e3cef89a), + C64e(0x4bc59e7bb5f17992), C64e(0xff51e66e048668d3), + C64e(0x9b234d57e6966731), C64e(0xcce6a6f3170a7505), + C64e(0xb17681d913326cce), C64e(0x3c175284f805a262), + C64e(0xf42bcbb378471547), C64e(0xff46548223936a48), + C64e(0x38df58074e5e6565), C64e(0xf2fc7c89fc86508e), + C64e(0x31702e44d00bca86), C64e(0xf04009a23078474e), + C64e(0x65a0ee39d1f73883), C64e(0xf75ee937e42c3abd), + C64e(0x2197b2260113f86f), C64e(0xa344edd1ef9fdee7), + C64e(0x8ba0df15762592d9), C64e(0x3c85f7f612dc42be), + C64e(0xd8a7ec7cab27b07e), C64e(0x538d7ddaaa3ea8de), + C64e(0xaa25ce93bd0269d8), C64e(0x5af643fd1a7308f9), + C64e(0xc05fefda174a19a5), C64e(0x974d66334cfd216a), + C64e(0x35b49831db411570), C64e(0xea1e0fbbedcd549b), + C64e(0x9ad063a151974072), C64e(0xf6759dbf91476fe2) +}; + +#define Ceven_hi(r) (C[((r) << 2) + 0]) +#define Ceven_lo(r) (C[((r) << 2) + 1]) +#define Codd_hi(r) (C[((r) << 2) + 2]) +#define Codd_lo(r) (C[((r) << 2) + 3]) + +#define S(x0, x1, x2, x3, cb, r) do { \ + Sb(x0 ## h, x1 ## h, x2 ## h, x3 ## h, cb ## hi(r)); \ + Sb(x0 ## l, x1 ## l, x2 ## l, x3 ## l, cb ## lo(r)); \ + } while (0) + +#define L(x0, x1, x2, x3, x4, x5, x6, x7) do { \ + Lb(x0 ## h, x1 ## h, x2 ## h, x3 ## h, \ + x4 ## h, x5 ## h, x6 ## h, x7 ## h); \ + Lb(x0 ## l, x1 ## l, x2 ## l, x3 ## l, \ + x4 ## l, x5 ## l, x6 ## l, x7 ## l); \ + } while (0) + +#define Wz(x, c, n) do { \ + sph_u64 t = (x ## h & (c)) << (n); \ + x ## h = ((x ## h >> (n)) & (c)) | t; \ + t = (x ## l & (c)) << (n); \ + x ## l = ((x ## l >> (n)) & (c)) | t; \ + } while (0) + +#define W0(x) Wz(x, SPH_C64(0x5555555555555555), 1) +#define W1(x) Wz(x, SPH_C64(0x3333333333333333), 2) +#define W2(x) Wz(x, SPH_C64(0x0F0F0F0F0F0F0F0F), 4) +#define W3(x) Wz(x, SPH_C64(0x00FF00FF00FF00FF), 8) +#define W4(x) Wz(x, SPH_C64(0x0000FFFF0000FFFF), 16) +#define W5(x) Wz(x, SPH_C64(0x00000000FFFFFFFF), 32) +#define W6(x) do { \ + sph_u64 t = x ## h; \ + x ## h = x ## l; \ + x ## l = t; \ + } while (0) + +#define DECL_STATE \ + sph_u64 h0h, h1h, h2h, h3h, h4h, h5h, h6h, h7h; \ + sph_u64 h0l, h1l, h2l, h3l, h4l, h5l, h6l, h7l; \ + sph_u64 tmp; + +#define READ_STATE(state) do { \ + h0h = (state)->H.wide[ 0]; \ + h0l = (state)->H.wide[ 1]; \ + h1h = (state)->H.wide[ 2]; \ + h1l = (state)->H.wide[ 3]; \ + h2h = (state)->H.wide[ 4]; \ + h2l = (state)->H.wide[ 5]; \ + h3h = (state)->H.wide[ 6]; \ + h3l = (state)->H.wide[ 7]; \ + h4h = (state)->H.wide[ 8]; \ + h4l = (state)->H.wide[ 9]; \ + h5h = (state)->H.wide[10]; \ + h5l = (state)->H.wide[11]; \ + h6h = (state)->H.wide[12]; \ + h6l = (state)->H.wide[13]; \ + h7h = (state)->H.wide[14]; \ + h7l = (state)->H.wide[15]; \ + } while (0) + +#define WRITE_STATE(state) do { \ + (state)->H.wide[ 0] = h0h; \ + (state)->H.wide[ 1] = h0l; \ + (state)->H.wide[ 2] = h1h; \ + (state)->H.wide[ 3] = h1l; \ + (state)->H.wide[ 4] = h2h; \ + (state)->H.wide[ 5] = h2l; \ + (state)->H.wide[ 6] = h3h; \ + (state)->H.wide[ 7] = h3l; \ + (state)->H.wide[ 8] = h4h; \ + (state)->H.wide[ 9] = h4l; \ + (state)->H.wide[10] = h5h; \ + (state)->H.wide[11] = h5l; \ + (state)->H.wide[12] = h6h; \ + (state)->H.wide[13] = h6l; \ + (state)->H.wide[14] = h7h; \ + (state)->H.wide[15] = h7l; \ + } while (0) + +#define INPUT_BUF1 \ + sph_u64 m0h = dec64e_aligned(buf + 0); \ + sph_u64 m0l = dec64e_aligned(buf + 8); \ + sph_u64 m1h = dec64e_aligned(buf + 16); \ + sph_u64 m1l = dec64e_aligned(buf + 24); \ + sph_u64 m2h = dec64e_aligned(buf + 32); \ + sph_u64 m2l = dec64e_aligned(buf + 40); \ + sph_u64 m3h = dec64e_aligned(buf + 48); \ + sph_u64 m3l = dec64e_aligned(buf + 56); \ + h0h ^= m0h; \ + h0l ^= m0l; \ + h1h ^= m1h; \ + h1l ^= m1l; \ + h2h ^= m2h; \ + h2l ^= m2l; \ + h3h ^= m3h; \ + h3l ^= m3l; + +#define INPUT_BUF2 \ + h4h ^= m0h; \ + h4l ^= m0l; \ + h5h ^= m1h; \ + h5l ^= m1l; \ + h6h ^= m2h; \ + h6l ^= m2l; \ + h7h ^= m3h; \ + h7l ^= m3l; + +static const sph_u64 IV224[] = { + C64e(0x2dfedd62f99a98ac), C64e(0xae7cacd619d634e7), + C64e(0xa4831005bc301216), C64e(0xb86038c6c9661494), + C64e(0x66d9899f2580706f), C64e(0xce9ea31b1d9b1adc), + C64e(0x11e8325f7b366e10), C64e(0xf994857f02fa06c1), + C64e(0x1b4f1b5cd8c840b3), C64e(0x97f6a17f6e738099), + C64e(0xdcdf93a5adeaa3d3), C64e(0xa431e8dec9539a68), + C64e(0x22b4a98aec86a1e4), C64e(0xd574ac959ce56cf0), + C64e(0x15960deab5ab2bbf), C64e(0x9611dcf0dd64ea6e) +}; + +static const sph_u64 IV256[] = { + C64e(0xeb98a3412c20d3eb), C64e(0x92cdbe7b9cb245c1), + C64e(0x1c93519160d4c7fa), C64e(0x260082d67e508a03), + C64e(0xa4239e267726b945), C64e(0xe0fb1a48d41a9477), + C64e(0xcdb5ab26026b177a), C64e(0x56f024420fff2fa8), + C64e(0x71a396897f2e4d75), C64e(0x1d144908f77de262), + C64e(0x277695f776248f94), C64e(0x87d5b6574780296c), + C64e(0x5c5e272dac8e0d6c), C64e(0x518450c657057a0f), + C64e(0x7be4d367702412ea), C64e(0x89e3ab13d31cd769) +}; + +static const sph_u64 IV384[] = { + C64e(0x481e3bc6d813398a), C64e(0x6d3b5e894ade879b), + C64e(0x63faea68d480ad2e), C64e(0x332ccb21480f8267), + C64e(0x98aec84d9082b928), C64e(0xd455ea3041114249), + C64e(0x36f555b2924847ec), C64e(0xc7250a93baf43ce1), + C64e(0x569b7f8a27db454c), C64e(0x9efcbd496397af0e), + C64e(0x589fc27d26aa80cd), C64e(0x80c08b8c9deb2eda), + C64e(0x8a7981e8f8d5373a), C64e(0xf43967adddd17a71), + C64e(0xa9b4d3bda475d394), C64e(0x976c3fba9842737f) +}; + +static const sph_u64 IV512[] = { + C64e(0x6fd14b963e00aa17), C64e(0x636a2e057a15d543), + C64e(0x8a225e8d0c97ef0b), C64e(0xe9341259f2b3c361), + C64e(0x891da0c1536f801e), C64e(0x2aa9056bea2b6d80), + C64e(0x588eccdb2075baa6), C64e(0xa90f3a76baf83bf7), + C64e(0x0169e60541e34a69), C64e(0x46b58a8e2e6fe65a), + C64e(0x1047a7d0c1843c24), C64e(0x3b6e71b12d5ac199), + C64e(0xcf57f6ec9db1f856), C64e(0xa706887c5716b156), + C64e(0xe3c2fcdfe68517fb), C64e(0x545a4678cc8cdd4b) +}; + +#else + +static const sph_u32 C[] = { + C32e(0x72d5dea2), C32e(0xdf15f867), C32e(0x7b84150a), + C32e(0xb7231557), C32e(0x81abd690), C32e(0x4d5a87f6), + C32e(0x4e9f4fc5), C32e(0xc3d12b40), C32e(0xea983ae0), + C32e(0x5c45fa9c), C32e(0x03c5d299), C32e(0x66b2999a), + C32e(0x660296b4), C32e(0xf2bb538a), C32e(0xb556141a), + C32e(0x88dba231), C32e(0x03a35a5c), C32e(0x9a190edb), + C32e(0x403fb20a), C32e(0x87c14410), C32e(0x1c051980), + C32e(0x849e951d), C32e(0x6f33ebad), C32e(0x5ee7cddc), + C32e(0x10ba1392), C32e(0x02bf6b41), C32e(0xdc786515), + C32e(0xf7bb27d0), C32e(0x0a2c8139), C32e(0x37aa7850), + C32e(0x3f1abfd2), C32e(0x410091d3), C32e(0x422d5a0d), + C32e(0xf6cc7e90), C32e(0xdd629f9c), C32e(0x92c097ce), + C32e(0x185ca70b), C32e(0xc72b44ac), C32e(0xd1df65d6), + C32e(0x63c6fc23), C32e(0x976e6c03), C32e(0x9ee0b81a), + C32e(0x2105457e), C32e(0x446ceca8), C32e(0xeef103bb), + C32e(0x5d8e61fa), C32e(0xfd9697b2), C32e(0x94838197), + C32e(0x4a8e8537), C32e(0xdb03302f), C32e(0x2a678d2d), + C32e(0xfb9f6a95), C32e(0x8afe7381), C32e(0xf8b8696c), + C32e(0x8ac77246), C32e(0xc07f4214), C32e(0xc5f4158f), + C32e(0xbdc75ec4), C32e(0x75446fa7), C32e(0x8f11bb80), + C32e(0x52de75b7), C32e(0xaee488bc), C32e(0x82b8001e), + C32e(0x98a6a3f4), C32e(0x8ef48f33), C32e(0xa9a36315), + C32e(0xaa5f5624), C32e(0xd5b7f989), C32e(0xb6f1ed20), + C32e(0x7c5ae0fd), C32e(0x36cae95a), C32e(0x06422c36), + C32e(0xce293543), C32e(0x4efe983d), C32e(0x533af974), + C32e(0x739a4ba7), C32e(0xd0f51f59), C32e(0x6f4e8186), + C32e(0x0e9dad81), C32e(0xafd85a9f), C32e(0xa7050667), + C32e(0xee34626a), C32e(0x8b0b28be), C32e(0x6eb91727), + C32e(0x47740726), C32e(0xc680103f), C32e(0xe0a07e6f), + C32e(0xc67e487b), C32e(0x0d550aa5), C32e(0x4af8a4c0), + C32e(0x91e3e79f), C32e(0x978ef19e), C32e(0x86767281), + C32e(0x50608dd4), C32e(0x7e9e5a41), C32e(0xf3e5b062), + C32e(0xfc9f1fec), C32e(0x4054207a), C32e(0xe3e41a00), + C32e(0xcef4c984), C32e(0x4fd794f5), C32e(0x9dfa95d8), + C32e(0x552e7e11), C32e(0x24c354a5), C32e(0x5bdf7228), + C32e(0xbdfe6e28), C32e(0x78f57fe2), C32e(0x0fa5c4b2), + C32e(0x05897cef), C32e(0xee49d32e), C32e(0x447e9385), + C32e(0xeb28597f), C32e(0x705f6937), C32e(0xb324314a), + C32e(0x5e8628f1), C32e(0x1dd6e465), C32e(0xc71b7704), + C32e(0x51b920e7), C32e(0x74fe43e8), C32e(0x23d4878a), + C32e(0x7d29e8a3), C32e(0x927694f2), C32e(0xddcb7a09), + C32e(0x9b30d9c1), C32e(0x1d1b30fb), C32e(0x5bdc1be0), + C32e(0xda24494f), C32e(0xf29c82bf), C32e(0xa4e7ba31), + C32e(0xb470bfff), C32e(0x0d324405), C32e(0xdef8bc48), + C32e(0x3baefc32), C32e(0x53bbd339), C32e(0x459fc3c1), + C32e(0xe0298ba0), C32e(0xe5c905fd), C32e(0xf7ae090f), + C32e(0x94703412), C32e(0x4290f134), C32e(0xa271b701), + C32e(0xe344ed95), C32e(0xe93b8e36), C32e(0x4f2f984a), + C32e(0x88401d63), C32e(0xa06cf615), C32e(0x47c1444b), + C32e(0x8752afff), C32e(0x7ebb4af1), C32e(0xe20ac630), + C32e(0x4670b6c5), C32e(0xcc6e8ce6), C32e(0xa4d5a456), + C32e(0xbd4fca00), C32e(0xda9d844b), C32e(0xc83e18ae), + C32e(0x7357ce45), C32e(0x3064d1ad), C32e(0xe8a6ce68), + C32e(0x145c2567), C32e(0xa3da8cf2), C32e(0xcb0ee116), + C32e(0x33e90658), C32e(0x9a94999a), C32e(0x1f60b220), + C32e(0xc26f847b), C32e(0xd1ceac7f), C32e(0xa0d18518), + C32e(0x32595ba1), C32e(0x8ddd19d3), C32e(0x509a1cc0), + C32e(0xaaa5b446), C32e(0x9f3d6367), C32e(0xe4046bba), + C32e(0xf6ca19ab), C32e(0x0b56ee7e), C32e(0x1fb179ea), + C32e(0xa9282174), C32e(0xe9bdf735), C32e(0x3b3651ee), + C32e(0x1d57ac5a), C32e(0x7550d376), C32e(0x3a46c2fe), + C32e(0xa37d7001), C32e(0xf735c1af), C32e(0x98a4d842), + C32e(0x78edec20), C32e(0x9e6b6779), C32e(0x41836315), + C32e(0xea3adba8), C32e(0xfac33b4d), C32e(0x32832c83), + C32e(0xa7403b1f), C32e(0x1c2747f3), C32e(0x5940f034), + C32e(0xb72d769a), C32e(0xe73e4e6c), C32e(0xd2214ffd), + C32e(0xb8fd8d39), C32e(0xdc5759ef), C32e(0x8d9b0c49), + C32e(0x2b49ebda), C32e(0x5ba2d749), C32e(0x68f3700d), + C32e(0x7d3baed0), C32e(0x7a8d5584), C32e(0xf5a5e9f0), + C32e(0xe4f88e65), C32e(0xa0b8a2f4), C32e(0x36103b53), + C32e(0x0ca8079e), C32e(0x753eec5a), C32e(0x91689492), + C32e(0x56e8884f), C32e(0x5bb05c55), C32e(0xf8babc4c), + C32e(0xe3bb3b99), C32e(0xf387947b), C32e(0x75daf4d6), + C32e(0x726b1c5d), C32e(0x64aeac28), C32e(0xdc34b36d), + C32e(0x6c34a550), C32e(0xb828db71), C32e(0xf861e2f2), + C32e(0x108d512a), C32e(0xe3db6433), C32e(0x59dd75fc), + C32e(0x1cacbcf1), C32e(0x43ce3fa2), C32e(0x67bbd13c), + C32e(0x02e843b0), C32e(0x330a5bca), C32e(0x8829a175), + C32e(0x7f34194d), C32e(0xb416535c), C32e(0x923b94c3), + C32e(0x0e794d1e), C32e(0x797475d7), C32e(0xb6eeaf3f), + C32e(0xeaa8d4f7), C32e(0xbe1a3921), C32e(0x5cf47e09), + C32e(0x4c232751), C32e(0x26a32453), C32e(0xba323cd2), + C32e(0x44a3174a), C32e(0x6da6d5ad), C32e(0xb51d3ea6), + C32e(0xaff2c908), C32e(0x83593d98), C32e(0x916b3c56), + C32e(0x4cf87ca1), C32e(0x7286604d), C32e(0x46e23ecc), + C32e(0x086ec7f6), C32e(0x2f9833b3), C32e(0xb1bc765e), + C32e(0x2bd666a5), C32e(0xefc4e62a), C32e(0x06f4b6e8), + C32e(0xbec1d436), C32e(0x74ee8215), C32e(0xbcef2163), + C32e(0xfdc14e0d), C32e(0xf453c969), C32e(0xa77d5ac4), + C32e(0x06585826), C32e(0x7ec11416), C32e(0x06e0fa16), + C32e(0x7e90af3d), C32e(0x28639d3f), C32e(0xd2c9f2e3), + C32e(0x009bd20c), C32e(0x5faace30), C32e(0xb7d40c30), + C32e(0x742a5116), C32e(0xf2e03298), C32e(0x0deb30d8), + C32e(0xe3cef89a), C32e(0x4bc59e7b), C32e(0xb5f17992), + C32e(0xff51e66e), C32e(0x048668d3), C32e(0x9b234d57), + C32e(0xe6966731), C32e(0xcce6a6f3), C32e(0x170a7505), + C32e(0xb17681d9), C32e(0x13326cce), C32e(0x3c175284), + C32e(0xf805a262), C32e(0xf42bcbb3), C32e(0x78471547), + C32e(0xff465482), C32e(0x23936a48), C32e(0x38df5807), + C32e(0x4e5e6565), C32e(0xf2fc7c89), C32e(0xfc86508e), + C32e(0x31702e44), C32e(0xd00bca86), C32e(0xf04009a2), + C32e(0x3078474e), C32e(0x65a0ee39), C32e(0xd1f73883), + C32e(0xf75ee937), C32e(0xe42c3abd), C32e(0x2197b226), + C32e(0x0113f86f), C32e(0xa344edd1), C32e(0xef9fdee7), + C32e(0x8ba0df15), C32e(0x762592d9), C32e(0x3c85f7f6), + C32e(0x12dc42be), C32e(0xd8a7ec7c), C32e(0xab27b07e), + C32e(0x538d7dda), C32e(0xaa3ea8de), C32e(0xaa25ce93), + C32e(0xbd0269d8), C32e(0x5af643fd), C32e(0x1a7308f9), + C32e(0xc05fefda), C32e(0x174a19a5), C32e(0x974d6633), + C32e(0x4cfd216a), C32e(0x35b49831), C32e(0xdb411570), + C32e(0xea1e0fbb), C32e(0xedcd549b), C32e(0x9ad063a1), + C32e(0x51974072), C32e(0xf6759dbf), C32e(0x91476fe2) +}; + +#define Ceven_w3(r) (C[((r) << 3) + 0]) +#define Ceven_w2(r) (C[((r) << 3) + 1]) +#define Ceven_w1(r) (C[((r) << 3) + 2]) +#define Ceven_w0(r) (C[((r) << 3) + 3]) +#define Codd_w3(r) (C[((r) << 3) + 4]) +#define Codd_w2(r) (C[((r) << 3) + 5]) +#define Codd_w1(r) (C[((r) << 3) + 6]) +#define Codd_w0(r) (C[((r) << 3) + 7]) + +#define S(x0, x1, x2, x3, cb, r) do { \ + Sb(x0 ## 3, x1 ## 3, x2 ## 3, x3 ## 3, cb ## w3(r)); \ + Sb(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, cb ## w2(r)); \ + Sb(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, cb ## w1(r)); \ + Sb(x0 ## 0, x1 ## 0, x2 ## 0, x3 ## 0, cb ## w0(r)); \ + } while (0) + +#define L(x0, x1, x2, x3, x4, x5, x6, x7) do { \ + Lb(x0 ## 3, x1 ## 3, x2 ## 3, x3 ## 3, \ + x4 ## 3, x5 ## 3, x6 ## 3, x7 ## 3); \ + Lb(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, \ + x4 ## 2, x5 ## 2, x6 ## 2, x7 ## 2); \ + Lb(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, \ + x4 ## 1, x5 ## 1, x6 ## 1, x7 ## 1); \ + Lb(x0 ## 0, x1 ## 0, x2 ## 0, x3 ## 0, \ + x4 ## 0, x5 ## 0, x6 ## 0, x7 ## 0); \ + } while (0) + +#define Wz(x, c, n) do { \ + sph_u32 t = (x ## 3 & (c)) << (n); \ + x ## 3 = ((x ## 3 >> (n)) & (c)) | t; \ + t = (x ## 2 & (c)) << (n); \ + x ## 2 = ((x ## 2 >> (n)) & (c)) | t; \ + t = (x ## 1 & (c)) << (n); \ + x ## 1 = ((x ## 1 >> (n)) & (c)) | t; \ + t = (x ## 0 & (c)) << (n); \ + x ## 0 = ((x ## 0 >> (n)) & (c)) | t; \ + } while (0) + +#define W0(x) Wz(x, SPH_C32(0x55555555), 1) +#define W1(x) Wz(x, SPH_C32(0x33333333), 2) +#define W2(x) Wz(x, SPH_C32(0x0F0F0F0F), 4) +#define W3(x) Wz(x, SPH_C32(0x00FF00FF), 8) +#define W4(x) Wz(x, SPH_C32(0x0000FFFF), 16) +#define W5(x) do { \ + sph_u32 t = x ## 3; \ + x ## 3 = x ## 2; \ + x ## 2 = t; \ + t = x ## 1; \ + x ## 1 = x ## 0; \ + x ## 0 = t; \ + } while (0) +#define W6(x) do { \ + sph_u32 t = x ## 3; \ + x ## 3 = x ## 1; \ + x ## 1 = t; \ + t = x ## 2; \ + x ## 2 = x ## 0; \ + x ## 0 = t; \ + } while (0) + +#define DECL_STATE \ + sph_u32 h03, h02, h01, h00, h13, h12, h11, h10; \ + sph_u32 h23, h22, h21, h20, h33, h32, h31, h30; \ + sph_u32 h43, h42, h41, h40, h53, h52, h51, h50; \ + sph_u32 h63, h62, h61, h60, h73, h72, h71, h70; \ + sph_u32 tmp; + +#define READ_STATE(state) do { \ + h03 = (state)->H.narrow[ 0]; \ + h02 = (state)->H.narrow[ 1]; \ + h01 = (state)->H.narrow[ 2]; \ + h00 = (state)->H.narrow[ 3]; \ + h13 = (state)->H.narrow[ 4]; \ + h12 = (state)->H.narrow[ 5]; \ + h11 = (state)->H.narrow[ 6]; \ + h10 = (state)->H.narrow[ 7]; \ + h23 = (state)->H.narrow[ 8]; \ + h22 = (state)->H.narrow[ 9]; \ + h21 = (state)->H.narrow[10]; \ + h20 = (state)->H.narrow[11]; \ + h33 = (state)->H.narrow[12]; \ + h32 = (state)->H.narrow[13]; \ + h31 = (state)->H.narrow[14]; \ + h30 = (state)->H.narrow[15]; \ + h43 = (state)->H.narrow[16]; \ + h42 = (state)->H.narrow[17]; \ + h41 = (state)->H.narrow[18]; \ + h40 = (state)->H.narrow[19]; \ + h53 = (state)->H.narrow[20]; \ + h52 = (state)->H.narrow[21]; \ + h51 = (state)->H.narrow[22]; \ + h50 = (state)->H.narrow[23]; \ + h63 = (state)->H.narrow[24]; \ + h62 = (state)->H.narrow[25]; \ + h61 = (state)->H.narrow[26]; \ + h60 = (state)->H.narrow[27]; \ + h73 = (state)->H.narrow[28]; \ + h72 = (state)->H.narrow[29]; \ + h71 = (state)->H.narrow[30]; \ + h70 = (state)->H.narrow[31]; \ + } while (0) + +#define WRITE_STATE(state) do { \ + (state)->H.narrow[ 0] = h03; \ + (state)->H.narrow[ 1] = h02; \ + (state)->H.narrow[ 2] = h01; \ + (state)->H.narrow[ 3] = h00; \ + (state)->H.narrow[ 4] = h13; \ + (state)->H.narrow[ 5] = h12; \ + (state)->H.narrow[ 6] = h11; \ + (state)->H.narrow[ 7] = h10; \ + (state)->H.narrow[ 8] = h23; \ + (state)->H.narrow[ 9] = h22; \ + (state)->H.narrow[10] = h21; \ + (state)->H.narrow[11] = h20; \ + (state)->H.narrow[12] = h33; \ + (state)->H.narrow[13] = h32; \ + (state)->H.narrow[14] = h31; \ + (state)->H.narrow[15] = h30; \ + (state)->H.narrow[16] = h43; \ + (state)->H.narrow[17] = h42; \ + (state)->H.narrow[18] = h41; \ + (state)->H.narrow[19] = h40; \ + (state)->H.narrow[20] = h53; \ + (state)->H.narrow[21] = h52; \ + (state)->H.narrow[22] = h51; \ + (state)->H.narrow[23] = h50; \ + (state)->H.narrow[24] = h63; \ + (state)->H.narrow[25] = h62; \ + (state)->H.narrow[26] = h61; \ + (state)->H.narrow[27] = h60; \ + (state)->H.narrow[28] = h73; \ + (state)->H.narrow[29] = h72; \ + (state)->H.narrow[30] = h71; \ + (state)->H.narrow[31] = h70; \ + } while (0) + +#define INPUT_BUF1 \ + sph_u32 m03 = dec32e_aligned(buf + 0); \ + sph_u32 m02 = dec32e_aligned(buf + 4); \ + sph_u32 m01 = dec32e_aligned(buf + 8); \ + sph_u32 m00 = dec32e_aligned(buf + 12); \ + sph_u32 m13 = dec32e_aligned(buf + 16); \ + sph_u32 m12 = dec32e_aligned(buf + 20); \ + sph_u32 m11 = dec32e_aligned(buf + 24); \ + sph_u32 m10 = dec32e_aligned(buf + 28); \ + sph_u32 m23 = dec32e_aligned(buf + 32); \ + sph_u32 m22 = dec32e_aligned(buf + 36); \ + sph_u32 m21 = dec32e_aligned(buf + 40); \ + sph_u32 m20 = dec32e_aligned(buf + 44); \ + sph_u32 m33 = dec32e_aligned(buf + 48); \ + sph_u32 m32 = dec32e_aligned(buf + 52); \ + sph_u32 m31 = dec32e_aligned(buf + 56); \ + sph_u32 m30 = dec32e_aligned(buf + 60); \ + h03 ^= m03; \ + h02 ^= m02; \ + h01 ^= m01; \ + h00 ^= m00; \ + h13 ^= m13; \ + h12 ^= m12; \ + h11 ^= m11; \ + h10 ^= m10; \ + h23 ^= m23; \ + h22 ^= m22; \ + h21 ^= m21; \ + h20 ^= m20; \ + h33 ^= m33; \ + h32 ^= m32; \ + h31 ^= m31; \ + h30 ^= m30; + +#define INPUT_BUF2 \ + h43 ^= m03; \ + h42 ^= m02; \ + h41 ^= m01; \ + h40 ^= m00; \ + h53 ^= m13; \ + h52 ^= m12; \ + h51 ^= m11; \ + h50 ^= m10; \ + h63 ^= m23; \ + h62 ^= m22; \ + h61 ^= m21; \ + h60 ^= m20; \ + h73 ^= m33; \ + h72 ^= m32; \ + h71 ^= m31; \ + h70 ^= m30; + +static const sph_u32 IV224[] = { + C32e(0x2dfedd62), C32e(0xf99a98ac), C32e(0xae7cacd6), C32e(0x19d634e7), + C32e(0xa4831005), C32e(0xbc301216), C32e(0xb86038c6), C32e(0xc9661494), + C32e(0x66d9899f), C32e(0x2580706f), C32e(0xce9ea31b), C32e(0x1d9b1adc), + C32e(0x11e8325f), C32e(0x7b366e10), C32e(0xf994857f), C32e(0x02fa06c1), + C32e(0x1b4f1b5c), C32e(0xd8c840b3), C32e(0x97f6a17f), C32e(0x6e738099), + C32e(0xdcdf93a5), C32e(0xadeaa3d3), C32e(0xa431e8de), C32e(0xc9539a68), + C32e(0x22b4a98a), C32e(0xec86a1e4), C32e(0xd574ac95), C32e(0x9ce56cf0), + C32e(0x15960dea), C32e(0xb5ab2bbf), C32e(0x9611dcf0), C32e(0xdd64ea6e) +}; + +static const sph_u32 IV256[] = { + C32e(0xeb98a341), C32e(0x2c20d3eb), C32e(0x92cdbe7b), C32e(0x9cb245c1), + C32e(0x1c935191), C32e(0x60d4c7fa), C32e(0x260082d6), C32e(0x7e508a03), + C32e(0xa4239e26), C32e(0x7726b945), C32e(0xe0fb1a48), C32e(0xd41a9477), + C32e(0xcdb5ab26), C32e(0x026b177a), C32e(0x56f02442), C32e(0x0fff2fa8), + C32e(0x71a39689), C32e(0x7f2e4d75), C32e(0x1d144908), C32e(0xf77de262), + C32e(0x277695f7), C32e(0x76248f94), C32e(0x87d5b657), C32e(0x4780296c), + C32e(0x5c5e272d), C32e(0xac8e0d6c), C32e(0x518450c6), C32e(0x57057a0f), + C32e(0x7be4d367), C32e(0x702412ea), C32e(0x89e3ab13), C32e(0xd31cd769) +}; + +static const sph_u32 IV384[] = { + C32e(0x481e3bc6), C32e(0xd813398a), C32e(0x6d3b5e89), C32e(0x4ade879b), + C32e(0x63faea68), C32e(0xd480ad2e), C32e(0x332ccb21), C32e(0x480f8267), + C32e(0x98aec84d), C32e(0x9082b928), C32e(0xd455ea30), C32e(0x41114249), + C32e(0x36f555b2), C32e(0x924847ec), C32e(0xc7250a93), C32e(0xbaf43ce1), + C32e(0x569b7f8a), C32e(0x27db454c), C32e(0x9efcbd49), C32e(0x6397af0e), + C32e(0x589fc27d), C32e(0x26aa80cd), C32e(0x80c08b8c), C32e(0x9deb2eda), + C32e(0x8a7981e8), C32e(0xf8d5373a), C32e(0xf43967ad), C32e(0xddd17a71), + C32e(0xa9b4d3bd), C32e(0xa475d394), C32e(0x976c3fba), C32e(0x9842737f) +}; + +static const sph_u32 IV512[] = { + C32e(0x6fd14b96), C32e(0x3e00aa17), C32e(0x636a2e05), C32e(0x7a15d543), + C32e(0x8a225e8d), C32e(0x0c97ef0b), C32e(0xe9341259), C32e(0xf2b3c361), + C32e(0x891da0c1), C32e(0x536f801e), C32e(0x2aa9056b), C32e(0xea2b6d80), + C32e(0x588eccdb), C32e(0x2075baa6), C32e(0xa90f3a76), C32e(0xbaf83bf7), + C32e(0x0169e605), C32e(0x41e34a69), C32e(0x46b58a8e), C32e(0x2e6fe65a), + C32e(0x1047a7d0), C32e(0xc1843c24), C32e(0x3b6e71b1), C32e(0x2d5ac199), + C32e(0xcf57f6ec), C32e(0x9db1f856), C32e(0xa706887c), C32e(0x5716b156), + C32e(0xe3c2fcdf), C32e(0xe68517fb), C32e(0x545a4678), C32e(0xcc8cdd4b) +}; + +#endif + +#define SL(ro) SLu(r + ro, ro) + +#define SLu(r, ro) do { \ + S(h0, h2, h4, h6, Ceven_, r); \ + S(h1, h3, h5, h7, Codd_, r); \ + L(h0, h2, h4, h6, h1, h3, h5, h7); \ + W ## ro(h1); \ + W ## ro(h3); \ + W ## ro(h5); \ + W ## ro(h7); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_JH + +#if SPH_JH_64 + +/* + * The "small footprint" 64-bit version just uses a partially unrolled + * loop. + */ + +#define E8 do { \ + unsigned r; \ + for (r = 0; r < 42; r += 7) { \ + SL(0); \ + SL(1); \ + SL(2); \ + SL(3); \ + SL(4); \ + SL(5); \ + SL(6); \ + } \ + } while (0) + +#else + +#define E8 do { \ + unsigned r, g; \ + for (r = g = 0; r < 42; r ++) { \ + S(h0, h2, h4, h6, Ceven_, r); \ + S(h1, h3, h5, h7, Codd_, r); \ + L(h0, h2, h4, h6, h1, h3, h5, h7); \ + switch (g) { \ + case 0: \ + W0(h1); \ + W0(h3); \ + W0(h5); \ + W0(h7); \ + break; \ + case 1: \ + W1(h1); \ + W1(h3); \ + W1(h5); \ + W1(h7); \ + break; \ + case 2: \ + W2(h1); \ + W2(h3); \ + W2(h5); \ + W2(h7); \ + break; \ + case 3: \ + W3(h1); \ + W3(h3); \ + W3(h5); \ + W3(h7); \ + break; \ + case 4: \ + W4(h1); \ + W4(h3); \ + W4(h5); \ + W4(h7); \ + break; \ + case 5: \ + W5(h1); \ + W5(h3); \ + W5(h5); \ + W5(h7); \ + break; \ + case 6: \ + W6(h1); \ + W6(h3); \ + W6(h5); \ + W6(h7); \ + break; \ + } \ + if (++ g == 7) \ + g = 0; \ + } \ + } while (0) + +#endif + +#else + +#if SPH_JH_64 + +/* + * On a "true 64-bit" architecture, we can unroll at will. + */ + +#define E8 do { \ + SLu( 0, 0); \ + SLu( 1, 1); \ + SLu( 2, 2); \ + SLu( 3, 3); \ + SLu( 4, 4); \ + SLu( 5, 5); \ + SLu( 6, 6); \ + SLu( 7, 0); \ + SLu( 8, 1); \ + SLu( 9, 2); \ + SLu(10, 3); \ + SLu(11, 4); \ + SLu(12, 5); \ + SLu(13, 6); \ + SLu(14, 0); \ + SLu(15, 1); \ + SLu(16, 2); \ + SLu(17, 3); \ + SLu(18, 4); \ + SLu(19, 5); \ + SLu(20, 6); \ + SLu(21, 0); \ + SLu(22, 1); \ + SLu(23, 2); \ + SLu(24, 3); \ + SLu(25, 4); \ + SLu(26, 5); \ + SLu(27, 6); \ + SLu(28, 0); \ + SLu(29, 1); \ + SLu(30, 2); \ + SLu(31, 3); \ + SLu(32, 4); \ + SLu(33, 5); \ + SLu(34, 6); \ + SLu(35, 0); \ + SLu(36, 1); \ + SLu(37, 2); \ + SLu(38, 3); \ + SLu(39, 4); \ + SLu(40, 5); \ + SLu(41, 6); \ + } while (0) + +#else + +/* + * We are not aiming at a small footprint, but we are still using a + * 32-bit implementation. Full loop unrolling would smash the L1 + * cache on some "big" architectures (32 kB L1 cache). + */ + +#define E8 do { \ + unsigned r; \ + for (r = 0; r < 42; r += 7) { \ + SL(0); \ + SL(1); \ + SL(2); \ + SL(3); \ + SL(4); \ + SL(5); \ + SL(6); \ + } \ + } while (0) + +#endif + +#endif + +static void +jh_init(sph_jh_context *sc, const void *iv) +{ + sc->ptr = 0; +#if SPH_JH_64 + memcpy(sc->H.wide, iv, sizeof sc->H.wide); +#else + memcpy(sc->H.narrow, iv, sizeof sc->H.narrow); +#endif +#if SPH_64 + sc->block_count = 0; +#else + sc->block_count_high = 0; + sc->block_count_low = 0; +#endif +} + +static void +jh_core(sph_jh_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + INPUT_BUF1; + E8; + INPUT_BUF2; +#if SPH_64 + sc->block_count ++; +#else + if ((sc->block_count_low = SPH_T32( + sc->block_count_low + 1)) == 0) + sc->block_count_high ++; +#endif + ptr = 0; + } + } + WRITE_STATE(sc); + sc->ptr = ptr; +} + +static void +jh_close(sph_jh_context *sc, unsigned ub, unsigned n, + void *dst, size_t out_size_w32, const void *iv) +{ + unsigned z; + unsigned char buf[128]; + size_t numz, u; +#if SPH_64 + sph_u64 l0, l1; +#else + sph_u32 l0, l1, l2, l3; +#endif + + z = 0x80 >> n; + buf[0] = ((ub & -z) | z) & 0xFF; + if (sc->ptr == 0 && n == 0) { + numz = 47; + } else { + numz = 111 - sc->ptr; + } + memset(buf + 1, 0, numz); +#if SPH_64 + l0 = SPH_T64(sc->block_count << 9) + (sc->ptr << 3) + n; + l1 = SPH_T64(sc->block_count >> 55); + sph_enc64be(buf + numz + 1, l1); + sph_enc64be(buf + numz + 9, l0); +#else + l0 = SPH_T32(sc->block_count_low << 9) + (sc->ptr << 3) + n; + l1 = SPH_T32(sc->block_count_low >> 23) + + SPH_T32(sc->block_count_high << 9); + l2 = SPH_T32(sc->block_count_high >> 23); + l3 = 0; + sph_enc32be(buf + numz + 1, l3); + sph_enc32be(buf + numz + 5, l2); + sph_enc32be(buf + numz + 9, l1); + sph_enc32be(buf + numz + 13, l0); +#endif + jh_core(sc, buf, numz + 17); +#if SPH_JH_64 + for (u = 0; u < 8; u ++) + enc64e(buf + (u << 3), sc->H.wide[u + 8]); +#else + for (u = 0; u < 16; u ++) + enc32e(buf + (u << 2), sc->H.narrow[u + 16]); +#endif + memcpy(dst, buf + ((16 - out_size_w32) << 2), out_size_w32 << 2); + jh_init(sc, iv); +} + +/* see sph_jh.h */ +void +sph_jh224_init(void *cc) +{ + jh_init(cc, IV224); +} + +/* see sph_jh.h */ +void +sph_jh224(void *cc, const void *data, size_t len) +{ + jh_core(cc, data, len); +} + +/* see sph_jh.h */ +void +sph_jh224_close(void *cc, void *dst) +{ + jh_close(cc, 0, 0, dst, 7, IV224); +} + +/* see sph_jh.h */ +void +sph_jh224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + jh_close(cc, ub, n, dst, 7, IV224); +} + +/* see sph_jh.h */ +void +sph_jh256_init(void *cc) +{ + jh_init(cc, IV256); +} + +/* see sph_jh.h */ +void +sph_jh256(void *cc, const void *data, size_t len) +{ + jh_core(cc, data, len); +} + +/* see sph_jh.h */ +void +sph_jh256_close(void *cc, void *dst) +{ + jh_close(cc, 0, 0, dst, 8, IV256); +} + +/* see sph_jh.h */ +void +sph_jh256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + jh_close(cc, ub, n, dst, 8, IV256); +} + +/* see sph_jh.h */ +void +sph_jh384_init(void *cc) +{ + jh_init(cc, IV384); +} + +/* see sph_jh.h */ +void +sph_jh384(void *cc, const void *data, size_t len) +{ + jh_core(cc, data, len); +} + +/* see sph_jh.h */ +void +sph_jh384_close(void *cc, void *dst) +{ + jh_close(cc, 0, 0, dst, 12, IV384); +} + +/* see sph_jh.h */ +void +sph_jh384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + jh_close(cc, ub, n, dst, 12, IV384); +} + +/* see sph_jh.h */ +void +sph_jh512_init(void *cc) +{ + jh_init(cc, IV512); +} + +/* see sph_jh.h */ +void +sph_jh512(void *cc, const void *data, size_t len) +{ + jh_core(cc, data, len); +} + +/* see sph_jh.h */ +void +sph_jh512_close(void *cc, void *dst) +{ + jh_close(cc, 0, 0, dst, 16, IV512); +} + +/* see sph_jh.h */ +void +sph_jh512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + jh_close(cc, ub, n, dst, 16, IV512); +} diff --git a/sph/keccak.c b/sph/keccak.c new file mode 100644 index 0000000..cff9f87 --- /dev/null +++ b/sph/keccak.c @@ -0,0 +1,1824 @@ +/* $Id: keccak.c 259 2011-07-19 22:11:27Z tp $ */ +/* + * Keccak implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_keccak.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +/* + * Parameters: + * + * SPH_KECCAK_64 use a 64-bit type + * SPH_KECCAK_UNROLL number of loops to unroll (0/undef for full unroll) + * SPH_KECCAK_INTERLEAVE use bit-interleaving (32-bit type only) + * SPH_KECCAK_NOCOPY do not copy the state into local variables + * + * If there is no usable 64-bit type, the code automatically switches + * back to the 32-bit implementation. + * + * Some tests on an Intel Core2 Q6600 (both 64-bit and 32-bit, 32 kB L1 + * code cache), a PowerPC (G3, 32 kB L1 code cache), an ARM920T core + * (16 kB L1 code cache), and a small MIPS-compatible CPU (Broadcom BCM3302, + * 8 kB L1 code cache), seem to show that the following are optimal: + * + * -- x86, 64-bit: use the 64-bit implementation, unroll 8 rounds, + * do not copy the state; unrolling 2, 6 or all rounds also provides + * near-optimal performance. + * -- x86, 32-bit: use the 32-bit implementation, unroll 6 rounds, + * interleave, do not copy the state. Unrolling 1, 2, 4 or 8 rounds + * also provides near-optimal performance. + * -- PowerPC: use the 64-bit implementation, unroll 8 rounds, + * copy the state. Unrolling 4 or 6 rounds is near-optimal. + * -- ARM: use the 64-bit implementation, unroll 2 or 4 rounds, + * copy the state. + * -- MIPS: use the 64-bit implementation, unroll 2 rounds, copy + * the state. Unrolling only 1 round is also near-optimal. + * + * Also, interleaving does not always yield actual improvements when + * using a 32-bit implementation; in particular when the architecture + * does not offer a native rotation opcode (interleaving replaces one + * 64-bit rotation with two 32-bit rotations, which is a gain only if + * there is a native 32-bit rotation opcode and not a native 64-bit + * rotation opcode; also, interleaving implies a small overhead when + * processing input words). + * + * To sum up: + * -- when possible, use the 64-bit code + * -- exception: on 32-bit x86, use 32-bit code + * -- when using 32-bit code, use interleaving + * -- copy the state, except on x86 + * -- unroll 8 rounds on "big" machine, 2 rounds on "small" machines + */ + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_KECCAK +#define SPH_SMALL_FOOTPRINT_KECCAK 1 +#endif + +/* + * By default, we select the 64-bit implementation if a 64-bit type + * is available, unless a 32-bit x86 is detected. + */ +#if !defined SPH_KECCAK_64 && SPH_64 \ + && !(defined __i386__ || SPH_I386_GCC || SPH_I386_MSVC) +#define SPH_KECCAK_64 1 +#endif + +/* + * If using a 32-bit implementation, we prefer to interleave. + */ +#if !SPH_KECCAK_64 && !defined SPH_KECCAK_INTERLEAVE +#define SPH_KECCAK_INTERLEAVE 1 +#endif + +/* + * Unroll 8 rounds on big systems, 2 rounds on small systems. + */ +#ifndef SPH_KECCAK_UNROLL +#if SPH_SMALL_FOOTPRINT_KECCAK +#define SPH_KECCAK_UNROLL 2 +#else +#define SPH_KECCAK_UNROLL 8 +#endif +#endif + +/* + * We do not want to copy the state to local variables on x86 (32-bit + * and 64-bit alike). + */ +#ifndef SPH_KECCAK_NOCOPY +#if defined __i386__ || defined __x86_64 || SPH_I386_MSVC || SPH_I386_GCC +#define SPH_KECCAK_NOCOPY 1 +#else +#define SPH_KECCAK_NOCOPY 0 +#endif +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +#if SPH_KECCAK_64 + +static const sph_u64 RC[] = { + SPH_C64(0x0000000000000001), SPH_C64(0x0000000000008082), + SPH_C64(0x800000000000808A), SPH_C64(0x8000000080008000), + SPH_C64(0x000000000000808B), SPH_C64(0x0000000080000001), + SPH_C64(0x8000000080008081), SPH_C64(0x8000000000008009), + SPH_C64(0x000000000000008A), SPH_C64(0x0000000000000088), + SPH_C64(0x0000000080008009), SPH_C64(0x000000008000000A), + SPH_C64(0x000000008000808B), SPH_C64(0x800000000000008B), + SPH_C64(0x8000000000008089), SPH_C64(0x8000000000008003), + SPH_C64(0x8000000000008002), SPH_C64(0x8000000000000080), + SPH_C64(0x000000000000800A), SPH_C64(0x800000008000000A), + SPH_C64(0x8000000080008081), SPH_C64(0x8000000000008080), + SPH_C64(0x0000000080000001), SPH_C64(0x8000000080008008) +}; + +#if SPH_KECCAK_NOCOPY + +#define a00 (kc->u.wide[ 0]) +#define a10 (kc->u.wide[ 1]) +#define a20 (kc->u.wide[ 2]) +#define a30 (kc->u.wide[ 3]) +#define a40 (kc->u.wide[ 4]) +#define a01 (kc->u.wide[ 5]) +#define a11 (kc->u.wide[ 6]) +#define a21 (kc->u.wide[ 7]) +#define a31 (kc->u.wide[ 8]) +#define a41 (kc->u.wide[ 9]) +#define a02 (kc->u.wide[10]) +#define a12 (kc->u.wide[11]) +#define a22 (kc->u.wide[12]) +#define a32 (kc->u.wide[13]) +#define a42 (kc->u.wide[14]) +#define a03 (kc->u.wide[15]) +#define a13 (kc->u.wide[16]) +#define a23 (kc->u.wide[17]) +#define a33 (kc->u.wide[18]) +#define a43 (kc->u.wide[19]) +#define a04 (kc->u.wide[20]) +#define a14 (kc->u.wide[21]) +#define a24 (kc->u.wide[22]) +#define a34 (kc->u.wide[23]) +#define a44 (kc->u.wide[24]) + +#define DECL_STATE +#define READ_STATE(sc) +#define WRITE_STATE(sc) + +#define INPUT_BUF(size) do { \ + size_t j; \ + for (j = 0; j < (size); j += 8) { \ + kc->u.wide[j >> 3] ^= sph_dec64le_aligned(buf + j); \ + } \ + } while (0) + +#define INPUT_BUF144 INPUT_BUF(144) +#define INPUT_BUF136 INPUT_BUF(136) +#define INPUT_BUF104 INPUT_BUF(104) +#define INPUT_BUF72 INPUT_BUF(72) + +#else + +#define DECL_STATE \ + sph_u64 a00, a01, a02, a03, a04; \ + sph_u64 a10, a11, a12, a13, a14; \ + sph_u64 a20, a21, a22, a23, a24; \ + sph_u64 a30, a31, a32, a33, a34; \ + sph_u64 a40, a41, a42, a43, a44; + +#define READ_STATE(state) do { \ + a00 = (state)->u.wide[ 0]; \ + a10 = (state)->u.wide[ 1]; \ + a20 = (state)->u.wide[ 2]; \ + a30 = (state)->u.wide[ 3]; \ + a40 = (state)->u.wide[ 4]; \ + a01 = (state)->u.wide[ 5]; \ + a11 = (state)->u.wide[ 6]; \ + a21 = (state)->u.wide[ 7]; \ + a31 = (state)->u.wide[ 8]; \ + a41 = (state)->u.wide[ 9]; \ + a02 = (state)->u.wide[10]; \ + a12 = (state)->u.wide[11]; \ + a22 = (state)->u.wide[12]; \ + a32 = (state)->u.wide[13]; \ + a42 = (state)->u.wide[14]; \ + a03 = (state)->u.wide[15]; \ + a13 = (state)->u.wide[16]; \ + a23 = (state)->u.wide[17]; \ + a33 = (state)->u.wide[18]; \ + a43 = (state)->u.wide[19]; \ + a04 = (state)->u.wide[20]; \ + a14 = (state)->u.wide[21]; \ + a24 = (state)->u.wide[22]; \ + a34 = (state)->u.wide[23]; \ + a44 = (state)->u.wide[24]; \ + } while (0) + +#define WRITE_STATE(state) do { \ + (state)->u.wide[ 0] = a00; \ + (state)->u.wide[ 1] = a10; \ + (state)->u.wide[ 2] = a20; \ + (state)->u.wide[ 3] = a30; \ + (state)->u.wide[ 4] = a40; \ + (state)->u.wide[ 5] = a01; \ + (state)->u.wide[ 6] = a11; \ + (state)->u.wide[ 7] = a21; \ + (state)->u.wide[ 8] = a31; \ + (state)->u.wide[ 9] = a41; \ + (state)->u.wide[10] = a02; \ + (state)->u.wide[11] = a12; \ + (state)->u.wide[12] = a22; \ + (state)->u.wide[13] = a32; \ + (state)->u.wide[14] = a42; \ + (state)->u.wide[15] = a03; \ + (state)->u.wide[16] = a13; \ + (state)->u.wide[17] = a23; \ + (state)->u.wide[18] = a33; \ + (state)->u.wide[19] = a43; \ + (state)->u.wide[20] = a04; \ + (state)->u.wide[21] = a14; \ + (state)->u.wide[22] = a24; \ + (state)->u.wide[23] = a34; \ + (state)->u.wide[24] = a44; \ + } while (0) + +#define INPUT_BUF144 do { \ + a00 ^= sph_dec64le_aligned(buf + 0); \ + a10 ^= sph_dec64le_aligned(buf + 8); \ + a20 ^= sph_dec64le_aligned(buf + 16); \ + a30 ^= sph_dec64le_aligned(buf + 24); \ + a40 ^= sph_dec64le_aligned(buf + 32); \ + a01 ^= sph_dec64le_aligned(buf + 40); \ + a11 ^= sph_dec64le_aligned(buf + 48); \ + a21 ^= sph_dec64le_aligned(buf + 56); \ + a31 ^= sph_dec64le_aligned(buf + 64); \ + a41 ^= sph_dec64le_aligned(buf + 72); \ + a02 ^= sph_dec64le_aligned(buf + 80); \ + a12 ^= sph_dec64le_aligned(buf + 88); \ + a22 ^= sph_dec64le_aligned(buf + 96); \ + a32 ^= sph_dec64le_aligned(buf + 104); \ + a42 ^= sph_dec64le_aligned(buf + 112); \ + a03 ^= sph_dec64le_aligned(buf + 120); \ + a13 ^= sph_dec64le_aligned(buf + 128); \ + a23 ^= sph_dec64le_aligned(buf + 136); \ + } while (0) + +#define INPUT_BUF136 do { \ + a00 ^= sph_dec64le_aligned(buf + 0); \ + a10 ^= sph_dec64le_aligned(buf + 8); \ + a20 ^= sph_dec64le_aligned(buf + 16); \ + a30 ^= sph_dec64le_aligned(buf + 24); \ + a40 ^= sph_dec64le_aligned(buf + 32); \ + a01 ^= sph_dec64le_aligned(buf + 40); \ + a11 ^= sph_dec64le_aligned(buf + 48); \ + a21 ^= sph_dec64le_aligned(buf + 56); \ + a31 ^= sph_dec64le_aligned(buf + 64); \ + a41 ^= sph_dec64le_aligned(buf + 72); \ + a02 ^= sph_dec64le_aligned(buf + 80); \ + a12 ^= sph_dec64le_aligned(buf + 88); \ + a22 ^= sph_dec64le_aligned(buf + 96); \ + a32 ^= sph_dec64le_aligned(buf + 104); \ + a42 ^= sph_dec64le_aligned(buf + 112); \ + a03 ^= sph_dec64le_aligned(buf + 120); \ + a13 ^= sph_dec64le_aligned(buf + 128); \ + } while (0) + +#define INPUT_BUF104 do { \ + a00 ^= sph_dec64le_aligned(buf + 0); \ + a10 ^= sph_dec64le_aligned(buf + 8); \ + a20 ^= sph_dec64le_aligned(buf + 16); \ + a30 ^= sph_dec64le_aligned(buf + 24); \ + a40 ^= sph_dec64le_aligned(buf + 32); \ + a01 ^= sph_dec64le_aligned(buf + 40); \ + a11 ^= sph_dec64le_aligned(buf + 48); \ + a21 ^= sph_dec64le_aligned(buf + 56); \ + a31 ^= sph_dec64le_aligned(buf + 64); \ + a41 ^= sph_dec64le_aligned(buf + 72); \ + a02 ^= sph_dec64le_aligned(buf + 80); \ + a12 ^= sph_dec64le_aligned(buf + 88); \ + a22 ^= sph_dec64le_aligned(buf + 96); \ + } while (0) + +#define INPUT_BUF72 do { \ + a00 ^= sph_dec64le_aligned(buf + 0); \ + a10 ^= sph_dec64le_aligned(buf + 8); \ + a20 ^= sph_dec64le_aligned(buf + 16); \ + a30 ^= sph_dec64le_aligned(buf + 24); \ + a40 ^= sph_dec64le_aligned(buf + 32); \ + a01 ^= sph_dec64le_aligned(buf + 40); \ + a11 ^= sph_dec64le_aligned(buf + 48); \ + a21 ^= sph_dec64le_aligned(buf + 56); \ + a31 ^= sph_dec64le_aligned(buf + 64); \ + } while (0) + +#define INPUT_BUF(lim) do { \ + a00 ^= sph_dec64le_aligned(buf + 0); \ + a10 ^= sph_dec64le_aligned(buf + 8); \ + a20 ^= sph_dec64le_aligned(buf + 16); \ + a30 ^= sph_dec64le_aligned(buf + 24); \ + a40 ^= sph_dec64le_aligned(buf + 32); \ + a01 ^= sph_dec64le_aligned(buf + 40); \ + a11 ^= sph_dec64le_aligned(buf + 48); \ + a21 ^= sph_dec64le_aligned(buf + 56); \ + a31 ^= sph_dec64le_aligned(buf + 64); \ + if ((lim) == 72) \ + break; \ + a41 ^= sph_dec64le_aligned(buf + 72); \ + a02 ^= sph_dec64le_aligned(buf + 80); \ + a12 ^= sph_dec64le_aligned(buf + 88); \ + a22 ^= sph_dec64le_aligned(buf + 96); \ + if ((lim) == 104) \ + break; \ + a32 ^= sph_dec64le_aligned(buf + 104); \ + a42 ^= sph_dec64le_aligned(buf + 112); \ + a03 ^= sph_dec64le_aligned(buf + 120); \ + a13 ^= sph_dec64le_aligned(buf + 128); \ + if ((lim) == 136) \ + break; \ + a23 ^= sph_dec64le_aligned(buf + 136); \ + } while (0) + +#endif + +#define DECL64(x) sph_u64 x +#define MOV64(d, s) (d = s) +#define XOR64(d, a, b) (d = a ^ b) +#define AND64(d, a, b) (d = a & b) +#define OR64(d, a, b) (d = a | b) +#define NOT64(d, s) (d = SPH_T64(~s)) +#define ROL64(d, v, n) (d = SPH_ROTL64(v, n)) +#define XOR64_IOTA XOR64 + +#else + +static const struct { + sph_u32 high, low; +} RC[] = { +#if SPH_KECCAK_INTERLEAVE + { SPH_C32(0x00000000), SPH_C32(0x00000001) }, + { SPH_C32(0x00000089), SPH_C32(0x00000000) }, + { SPH_C32(0x8000008B), SPH_C32(0x00000000) }, + { SPH_C32(0x80008080), SPH_C32(0x00000000) }, + { SPH_C32(0x0000008B), SPH_C32(0x00000001) }, + { SPH_C32(0x00008000), SPH_C32(0x00000001) }, + { SPH_C32(0x80008088), SPH_C32(0x00000001) }, + { SPH_C32(0x80000082), SPH_C32(0x00000001) }, + { SPH_C32(0x0000000B), SPH_C32(0x00000000) }, + { SPH_C32(0x0000000A), SPH_C32(0x00000000) }, + { SPH_C32(0x00008082), SPH_C32(0x00000001) }, + { SPH_C32(0x00008003), SPH_C32(0x00000000) }, + { SPH_C32(0x0000808B), SPH_C32(0x00000001) }, + { SPH_C32(0x8000000B), SPH_C32(0x00000001) }, + { SPH_C32(0x8000008A), SPH_C32(0x00000001) }, + { SPH_C32(0x80000081), SPH_C32(0x00000001) }, + { SPH_C32(0x80000081), SPH_C32(0x00000000) }, + { SPH_C32(0x80000008), SPH_C32(0x00000000) }, + { SPH_C32(0x00000083), SPH_C32(0x00000000) }, + { SPH_C32(0x80008003), SPH_C32(0x00000000) }, + { SPH_C32(0x80008088), SPH_C32(0x00000001) }, + { SPH_C32(0x80000088), SPH_C32(0x00000000) }, + { SPH_C32(0x00008000), SPH_C32(0x00000001) }, + { SPH_C32(0x80008082), SPH_C32(0x00000000) } +#else + { SPH_C32(0x00000000), SPH_C32(0x00000001) }, + { SPH_C32(0x00000000), SPH_C32(0x00008082) }, + { SPH_C32(0x80000000), SPH_C32(0x0000808A) }, + { SPH_C32(0x80000000), SPH_C32(0x80008000) }, + { SPH_C32(0x00000000), SPH_C32(0x0000808B) }, + { SPH_C32(0x00000000), SPH_C32(0x80000001) }, + { SPH_C32(0x80000000), SPH_C32(0x80008081) }, + { SPH_C32(0x80000000), SPH_C32(0x00008009) }, + { SPH_C32(0x00000000), SPH_C32(0x0000008A) }, + { SPH_C32(0x00000000), SPH_C32(0x00000088) }, + { SPH_C32(0x00000000), SPH_C32(0x80008009) }, + { SPH_C32(0x00000000), SPH_C32(0x8000000A) }, + { SPH_C32(0x00000000), SPH_C32(0x8000808B) }, + { SPH_C32(0x80000000), SPH_C32(0x0000008B) }, + { SPH_C32(0x80000000), SPH_C32(0x00008089) }, + { SPH_C32(0x80000000), SPH_C32(0x00008003) }, + { SPH_C32(0x80000000), SPH_C32(0x00008002) }, + { SPH_C32(0x80000000), SPH_C32(0x00000080) }, + { SPH_C32(0x00000000), SPH_C32(0x0000800A) }, + { SPH_C32(0x80000000), SPH_C32(0x8000000A) }, + { SPH_C32(0x80000000), SPH_C32(0x80008081) }, + { SPH_C32(0x80000000), SPH_C32(0x00008080) }, + { SPH_C32(0x00000000), SPH_C32(0x80000001) }, + { SPH_C32(0x80000000), SPH_C32(0x80008008) } +#endif +}; + +#if SPH_KECCAK_INTERLEAVE + +#define INTERLEAVE(xl, xh) do { \ + sph_u32 l, h, t; \ + l = (xl); h = (xh); \ + t = (l ^ (l >> 1)) & SPH_C32(0x22222222); l ^= t ^ (t << 1); \ + t = (h ^ (h >> 1)) & SPH_C32(0x22222222); h ^= t ^ (t << 1); \ + t = (l ^ (l >> 2)) & SPH_C32(0x0C0C0C0C); l ^= t ^ (t << 2); \ + t = (h ^ (h >> 2)) & SPH_C32(0x0C0C0C0C); h ^= t ^ (t << 2); \ + t = (l ^ (l >> 4)) & SPH_C32(0x00F000F0); l ^= t ^ (t << 4); \ + t = (h ^ (h >> 4)) & SPH_C32(0x00F000F0); h ^= t ^ (t << 4); \ + t = (l ^ (l >> 8)) & SPH_C32(0x0000FF00); l ^= t ^ (t << 8); \ + t = (h ^ (h >> 8)) & SPH_C32(0x0000FF00); h ^= t ^ (t << 8); \ + t = (l ^ SPH_T32(h << 16)) & SPH_C32(0xFFFF0000); \ + l ^= t; h ^= t >> 16; \ + (xl) = l; (xh) = h; \ + } while (0) + +#define UNINTERLEAVE(xl, xh) do { \ + sph_u32 l, h, t; \ + l = (xl); h = (xh); \ + t = (l ^ SPH_T32(h << 16)) & SPH_C32(0xFFFF0000); \ + l ^= t; h ^= t >> 16; \ + t = (l ^ (l >> 8)) & SPH_C32(0x0000FF00); l ^= t ^ (t << 8); \ + t = (h ^ (h >> 8)) & SPH_C32(0x0000FF00); h ^= t ^ (t << 8); \ + t = (l ^ (l >> 4)) & SPH_C32(0x00F000F0); l ^= t ^ (t << 4); \ + t = (h ^ (h >> 4)) & SPH_C32(0x00F000F0); h ^= t ^ (t << 4); \ + t = (l ^ (l >> 2)) & SPH_C32(0x0C0C0C0C); l ^= t ^ (t << 2); \ + t = (h ^ (h >> 2)) & SPH_C32(0x0C0C0C0C); h ^= t ^ (t << 2); \ + t = (l ^ (l >> 1)) & SPH_C32(0x22222222); l ^= t ^ (t << 1); \ + t = (h ^ (h >> 1)) & SPH_C32(0x22222222); h ^= t ^ (t << 1); \ + (xl) = l; (xh) = h; \ + } while (0) + +#else + +#define INTERLEAVE(l, h) +#define UNINTERLEAVE(l, h) + +#endif + +#if SPH_KECCAK_NOCOPY + +#define a00l (kc->u.narrow[2 * 0 + 0]) +#define a00h (kc->u.narrow[2 * 0 + 1]) +#define a10l (kc->u.narrow[2 * 1 + 0]) +#define a10h (kc->u.narrow[2 * 1 + 1]) +#define a20l (kc->u.narrow[2 * 2 + 0]) +#define a20h (kc->u.narrow[2 * 2 + 1]) +#define a30l (kc->u.narrow[2 * 3 + 0]) +#define a30h (kc->u.narrow[2 * 3 + 1]) +#define a40l (kc->u.narrow[2 * 4 + 0]) +#define a40h (kc->u.narrow[2 * 4 + 1]) +#define a01l (kc->u.narrow[2 * 5 + 0]) +#define a01h (kc->u.narrow[2 * 5 + 1]) +#define a11l (kc->u.narrow[2 * 6 + 0]) +#define a11h (kc->u.narrow[2 * 6 + 1]) +#define a21l (kc->u.narrow[2 * 7 + 0]) +#define a21h (kc->u.narrow[2 * 7 + 1]) +#define a31l (kc->u.narrow[2 * 8 + 0]) +#define a31h (kc->u.narrow[2 * 8 + 1]) +#define a41l (kc->u.narrow[2 * 9 + 0]) +#define a41h (kc->u.narrow[2 * 9 + 1]) +#define a02l (kc->u.narrow[2 * 10 + 0]) +#define a02h (kc->u.narrow[2 * 10 + 1]) +#define a12l (kc->u.narrow[2 * 11 + 0]) +#define a12h (kc->u.narrow[2 * 11 + 1]) +#define a22l (kc->u.narrow[2 * 12 + 0]) +#define a22h (kc->u.narrow[2 * 12 + 1]) +#define a32l (kc->u.narrow[2 * 13 + 0]) +#define a32h (kc->u.narrow[2 * 13 + 1]) +#define a42l (kc->u.narrow[2 * 14 + 0]) +#define a42h (kc->u.narrow[2 * 14 + 1]) +#define a03l (kc->u.narrow[2 * 15 + 0]) +#define a03h (kc->u.narrow[2 * 15 + 1]) +#define a13l (kc->u.narrow[2 * 16 + 0]) +#define a13h (kc->u.narrow[2 * 16 + 1]) +#define a23l (kc->u.narrow[2 * 17 + 0]) +#define a23h (kc->u.narrow[2 * 17 + 1]) +#define a33l (kc->u.narrow[2 * 18 + 0]) +#define a33h (kc->u.narrow[2 * 18 + 1]) +#define a43l (kc->u.narrow[2 * 19 + 0]) +#define a43h (kc->u.narrow[2 * 19 + 1]) +#define a04l (kc->u.narrow[2 * 20 + 0]) +#define a04h (kc->u.narrow[2 * 20 + 1]) +#define a14l (kc->u.narrow[2 * 21 + 0]) +#define a14h (kc->u.narrow[2 * 21 + 1]) +#define a24l (kc->u.narrow[2 * 22 + 0]) +#define a24h (kc->u.narrow[2 * 22 + 1]) +#define a34l (kc->u.narrow[2 * 23 + 0]) +#define a34h (kc->u.narrow[2 * 23 + 1]) +#define a44l (kc->u.narrow[2 * 24 + 0]) +#define a44h (kc->u.narrow[2 * 24 + 1]) + +#define DECL_STATE +#define READ_STATE(state) +#define WRITE_STATE(state) + +#define INPUT_BUF(size) do { \ + size_t j; \ + for (j = 0; j < (size); j += 8) { \ + sph_u32 tl, th; \ + tl = sph_dec32le_aligned(buf + j + 0); \ + th = sph_dec32le_aligned(buf + j + 4); \ + INTERLEAVE(tl, th); \ + kc->u.narrow[(j >> 2) + 0] ^= tl; \ + kc->u.narrow[(j >> 2) + 1] ^= th; \ + } \ + } while (0) + +#define INPUT_BUF144 INPUT_BUF(144) +#define INPUT_BUF136 INPUT_BUF(136) +#define INPUT_BUF104 INPUT_BUF(104) +#define INPUT_BUF72 INPUT_BUF(72) + +#else + +#define DECL_STATE \ + sph_u32 a00l, a00h, a01l, a01h, a02l, a02h, a03l, a03h, a04l, a04h; \ + sph_u32 a10l, a10h, a11l, a11h, a12l, a12h, a13l, a13h, a14l, a14h; \ + sph_u32 a20l, a20h, a21l, a21h, a22l, a22h, a23l, a23h, a24l, a24h; \ + sph_u32 a30l, a30h, a31l, a31h, a32l, a32h, a33l, a33h, a34l, a34h; \ + sph_u32 a40l, a40h, a41l, a41h, a42l, a42h, a43l, a43h, a44l, a44h; + +#define READ_STATE(state) do { \ + a00l = (state)->u.narrow[2 * 0 + 0]; \ + a00h = (state)->u.narrow[2 * 0 + 1]; \ + a10l = (state)->u.narrow[2 * 1 + 0]; \ + a10h = (state)->u.narrow[2 * 1 + 1]; \ + a20l = (state)->u.narrow[2 * 2 + 0]; \ + a20h = (state)->u.narrow[2 * 2 + 1]; \ + a30l = (state)->u.narrow[2 * 3 + 0]; \ + a30h = (state)->u.narrow[2 * 3 + 1]; \ + a40l = (state)->u.narrow[2 * 4 + 0]; \ + a40h = (state)->u.narrow[2 * 4 + 1]; \ + a01l = (state)->u.narrow[2 * 5 + 0]; \ + a01h = (state)->u.narrow[2 * 5 + 1]; \ + a11l = (state)->u.narrow[2 * 6 + 0]; \ + a11h = (state)->u.narrow[2 * 6 + 1]; \ + a21l = (state)->u.narrow[2 * 7 + 0]; \ + a21h = (state)->u.narrow[2 * 7 + 1]; \ + a31l = (state)->u.narrow[2 * 8 + 0]; \ + a31h = (state)->u.narrow[2 * 8 + 1]; \ + a41l = (state)->u.narrow[2 * 9 + 0]; \ + a41h = (state)->u.narrow[2 * 9 + 1]; \ + a02l = (state)->u.narrow[2 * 10 + 0]; \ + a02h = (state)->u.narrow[2 * 10 + 1]; \ + a12l = (state)->u.narrow[2 * 11 + 0]; \ + a12h = (state)->u.narrow[2 * 11 + 1]; \ + a22l = (state)->u.narrow[2 * 12 + 0]; \ + a22h = (state)->u.narrow[2 * 12 + 1]; \ + a32l = (state)->u.narrow[2 * 13 + 0]; \ + a32h = (state)->u.narrow[2 * 13 + 1]; \ + a42l = (state)->u.narrow[2 * 14 + 0]; \ + a42h = (state)->u.narrow[2 * 14 + 1]; \ + a03l = (state)->u.narrow[2 * 15 + 0]; \ + a03h = (state)->u.narrow[2 * 15 + 1]; \ + a13l = (state)->u.narrow[2 * 16 + 0]; \ + a13h = (state)->u.narrow[2 * 16 + 1]; \ + a23l = (state)->u.narrow[2 * 17 + 0]; \ + a23h = (state)->u.narrow[2 * 17 + 1]; \ + a33l = (state)->u.narrow[2 * 18 + 0]; \ + a33h = (state)->u.narrow[2 * 18 + 1]; \ + a43l = (state)->u.narrow[2 * 19 + 0]; \ + a43h = (state)->u.narrow[2 * 19 + 1]; \ + a04l = (state)->u.narrow[2 * 20 + 0]; \ + a04h = (state)->u.narrow[2 * 20 + 1]; \ + a14l = (state)->u.narrow[2 * 21 + 0]; \ + a14h = (state)->u.narrow[2 * 21 + 1]; \ + a24l = (state)->u.narrow[2 * 22 + 0]; \ + a24h = (state)->u.narrow[2 * 22 + 1]; \ + a34l = (state)->u.narrow[2 * 23 + 0]; \ + a34h = (state)->u.narrow[2 * 23 + 1]; \ + a44l = (state)->u.narrow[2 * 24 + 0]; \ + a44h = (state)->u.narrow[2 * 24 + 1]; \ + } while (0) + +#define WRITE_STATE(state) do { \ + (state)->u.narrow[2 * 0 + 0] = a00l; \ + (state)->u.narrow[2 * 0 + 1] = a00h; \ + (state)->u.narrow[2 * 1 + 0] = a10l; \ + (state)->u.narrow[2 * 1 + 1] = a10h; \ + (state)->u.narrow[2 * 2 + 0] = a20l; \ + (state)->u.narrow[2 * 2 + 1] = a20h; \ + (state)->u.narrow[2 * 3 + 0] = a30l; \ + (state)->u.narrow[2 * 3 + 1] = a30h; \ + (state)->u.narrow[2 * 4 + 0] = a40l; \ + (state)->u.narrow[2 * 4 + 1] = a40h; \ + (state)->u.narrow[2 * 5 + 0] = a01l; \ + (state)->u.narrow[2 * 5 + 1] = a01h; \ + (state)->u.narrow[2 * 6 + 0] = a11l; \ + (state)->u.narrow[2 * 6 + 1] = a11h; \ + (state)->u.narrow[2 * 7 + 0] = a21l; \ + (state)->u.narrow[2 * 7 + 1] = a21h; \ + (state)->u.narrow[2 * 8 + 0] = a31l; \ + (state)->u.narrow[2 * 8 + 1] = a31h; \ + (state)->u.narrow[2 * 9 + 0] = a41l; \ + (state)->u.narrow[2 * 9 + 1] = a41h; \ + (state)->u.narrow[2 * 10 + 0] = a02l; \ + (state)->u.narrow[2 * 10 + 1] = a02h; \ + (state)->u.narrow[2 * 11 + 0] = a12l; \ + (state)->u.narrow[2 * 11 + 1] = a12h; \ + (state)->u.narrow[2 * 12 + 0] = a22l; \ + (state)->u.narrow[2 * 12 + 1] = a22h; \ + (state)->u.narrow[2 * 13 + 0] = a32l; \ + (state)->u.narrow[2 * 13 + 1] = a32h; \ + (state)->u.narrow[2 * 14 + 0] = a42l; \ + (state)->u.narrow[2 * 14 + 1] = a42h; \ + (state)->u.narrow[2 * 15 + 0] = a03l; \ + (state)->u.narrow[2 * 15 + 1] = a03h; \ + (state)->u.narrow[2 * 16 + 0] = a13l; \ + (state)->u.narrow[2 * 16 + 1] = a13h; \ + (state)->u.narrow[2 * 17 + 0] = a23l; \ + (state)->u.narrow[2 * 17 + 1] = a23h; \ + (state)->u.narrow[2 * 18 + 0] = a33l; \ + (state)->u.narrow[2 * 18 + 1] = a33h; \ + (state)->u.narrow[2 * 19 + 0] = a43l; \ + (state)->u.narrow[2 * 19 + 1] = a43h; \ + (state)->u.narrow[2 * 20 + 0] = a04l; \ + (state)->u.narrow[2 * 20 + 1] = a04h; \ + (state)->u.narrow[2 * 21 + 0] = a14l; \ + (state)->u.narrow[2 * 21 + 1] = a14h; \ + (state)->u.narrow[2 * 22 + 0] = a24l; \ + (state)->u.narrow[2 * 22 + 1] = a24h; \ + (state)->u.narrow[2 * 23 + 0] = a34l; \ + (state)->u.narrow[2 * 23 + 1] = a34h; \ + (state)->u.narrow[2 * 24 + 0] = a44l; \ + (state)->u.narrow[2 * 24 + 1] = a44h; \ + } while (0) + +#define READ64(d, off) do { \ + sph_u32 tl, th; \ + tl = sph_dec32le_aligned(buf + (off)); \ + th = sph_dec32le_aligned(buf + (off) + 4); \ + INTERLEAVE(tl, th); \ + d ## l ^= tl; \ + d ## h ^= th; \ + } while (0) + +#define INPUT_BUF144 do { \ + READ64(a00, 0); \ + READ64(a10, 8); \ + READ64(a20, 16); \ + READ64(a30, 24); \ + READ64(a40, 32); \ + READ64(a01, 40); \ + READ64(a11, 48); \ + READ64(a21, 56); \ + READ64(a31, 64); \ + READ64(a41, 72); \ + READ64(a02, 80); \ + READ64(a12, 88); \ + READ64(a22, 96); \ + READ64(a32, 104); \ + READ64(a42, 112); \ + READ64(a03, 120); \ + READ64(a13, 128); \ + READ64(a23, 136); \ + } while (0) + +#define INPUT_BUF136 do { \ + READ64(a00, 0); \ + READ64(a10, 8); \ + READ64(a20, 16); \ + READ64(a30, 24); \ + READ64(a40, 32); \ + READ64(a01, 40); \ + READ64(a11, 48); \ + READ64(a21, 56); \ + READ64(a31, 64); \ + READ64(a41, 72); \ + READ64(a02, 80); \ + READ64(a12, 88); \ + READ64(a22, 96); \ + READ64(a32, 104); \ + READ64(a42, 112); \ + READ64(a03, 120); \ + READ64(a13, 128); \ + } while (0) + +#define INPUT_BUF104 do { \ + READ64(a00, 0); \ + READ64(a10, 8); \ + READ64(a20, 16); \ + READ64(a30, 24); \ + READ64(a40, 32); \ + READ64(a01, 40); \ + READ64(a11, 48); \ + READ64(a21, 56); \ + READ64(a31, 64); \ + READ64(a41, 72); \ + READ64(a02, 80); \ + READ64(a12, 88); \ + READ64(a22, 96); \ + } while (0) + +#define INPUT_BUF72 do { \ + READ64(a00, 0); \ + READ64(a10, 8); \ + READ64(a20, 16); \ + READ64(a30, 24); \ + READ64(a40, 32); \ + READ64(a01, 40); \ + READ64(a11, 48); \ + READ64(a21, 56); \ + READ64(a31, 64); \ + } while (0) + +#define INPUT_BUF(lim) do { \ + READ64(a00, 0); \ + READ64(a10, 8); \ + READ64(a20, 16); \ + READ64(a30, 24); \ + READ64(a40, 32); \ + READ64(a01, 40); \ + READ64(a11, 48); \ + READ64(a21, 56); \ + READ64(a31, 64); \ + if ((lim) == 72) \ + break; \ + READ64(a41, 72); \ + READ64(a02, 80); \ + READ64(a12, 88); \ + READ64(a22, 96); \ + if ((lim) == 104) \ + break; \ + READ64(a32, 104); \ + READ64(a42, 112); \ + READ64(a03, 120); \ + READ64(a13, 128); \ + if ((lim) == 136) \ + break; \ + READ64(a23, 136); \ + } while (0) + +#endif + +#define DECL64(x) sph_u64 x ## l, x ## h +#define MOV64(d, s) (d ## l = s ## l, d ## h = s ## h) +#define XOR64(d, a, b) (d ## l = a ## l ^ b ## l, d ## h = a ## h ^ b ## h) +#define AND64(d, a, b) (d ## l = a ## l & b ## l, d ## h = a ## h & b ## h) +#define OR64(d, a, b) (d ## l = a ## l | b ## l, d ## h = a ## h | b ## h) +#define NOT64(d, s) (d ## l = SPH_T32(~s ## l), d ## h = SPH_T32(~s ## h)) +#define ROL64(d, v, n) ROL64_ ## n(d, v) + +#if SPH_KECCAK_INTERLEAVE + +#define ROL64_odd1(d, v) do { \ + sph_u32 tmp; \ + tmp = v ## l; \ + d ## l = SPH_T32(v ## h << 1) | (v ## h >> 31); \ + d ## h = tmp; \ + } while (0) + +#define ROL64_odd63(d, v) do { \ + sph_u32 tmp; \ + tmp = SPH_T32(v ## l << 31) | (v ## l >> 1); \ + d ## l = v ## h; \ + d ## h = tmp; \ + } while (0) + +#define ROL64_odd(d, v, n) do { \ + sph_u32 tmp; \ + tmp = SPH_T32(v ## l << (n - 1)) | (v ## l >> (33 - n)); \ + d ## l = SPH_T32(v ## h << n) | (v ## h >> (32 - n)); \ + d ## h = tmp; \ + } while (0) + +#define ROL64_even(d, v, n) do { \ + d ## l = SPH_T32(v ## l << n) | (v ## l >> (32 - n)); \ + d ## h = SPH_T32(v ## h << n) | (v ## h >> (32 - n)); \ + } while (0) + +#define ROL64_0(d, v) +#define ROL64_1(d, v) ROL64_odd1(d, v) +#define ROL64_2(d, v) ROL64_even(d, v, 1) +#define ROL64_3(d, v) ROL64_odd( d, v, 2) +#define ROL64_4(d, v) ROL64_even(d, v, 2) +#define ROL64_5(d, v) ROL64_odd( d, v, 3) +#define ROL64_6(d, v) ROL64_even(d, v, 3) +#define ROL64_7(d, v) ROL64_odd( d, v, 4) +#define ROL64_8(d, v) ROL64_even(d, v, 4) +#define ROL64_9(d, v) ROL64_odd( d, v, 5) +#define ROL64_10(d, v) ROL64_even(d, v, 5) +#define ROL64_11(d, v) ROL64_odd( d, v, 6) +#define ROL64_12(d, v) ROL64_even(d, v, 6) +#define ROL64_13(d, v) ROL64_odd( d, v, 7) +#define ROL64_14(d, v) ROL64_even(d, v, 7) +#define ROL64_15(d, v) ROL64_odd( d, v, 8) +#define ROL64_16(d, v) ROL64_even(d, v, 8) +#define ROL64_17(d, v) ROL64_odd( d, v, 9) +#define ROL64_18(d, v) ROL64_even(d, v, 9) +#define ROL64_19(d, v) ROL64_odd( d, v, 10) +#define ROL64_20(d, v) ROL64_even(d, v, 10) +#define ROL64_21(d, v) ROL64_odd( d, v, 11) +#define ROL64_22(d, v) ROL64_even(d, v, 11) +#define ROL64_23(d, v) ROL64_odd( d, v, 12) +#define ROL64_24(d, v) ROL64_even(d, v, 12) +#define ROL64_25(d, v) ROL64_odd( d, v, 13) +#define ROL64_26(d, v) ROL64_even(d, v, 13) +#define ROL64_27(d, v) ROL64_odd( d, v, 14) +#define ROL64_28(d, v) ROL64_even(d, v, 14) +#define ROL64_29(d, v) ROL64_odd( d, v, 15) +#define ROL64_30(d, v) ROL64_even(d, v, 15) +#define ROL64_31(d, v) ROL64_odd( d, v, 16) +#define ROL64_32(d, v) ROL64_even(d, v, 16) +#define ROL64_33(d, v) ROL64_odd( d, v, 17) +#define ROL64_34(d, v) ROL64_even(d, v, 17) +#define ROL64_35(d, v) ROL64_odd( d, v, 18) +#define ROL64_36(d, v) ROL64_even(d, v, 18) +#define ROL64_37(d, v) ROL64_odd( d, v, 19) +#define ROL64_38(d, v) ROL64_even(d, v, 19) +#define ROL64_39(d, v) ROL64_odd( d, v, 20) +#define ROL64_40(d, v) ROL64_even(d, v, 20) +#define ROL64_41(d, v) ROL64_odd( d, v, 21) +#define ROL64_42(d, v) ROL64_even(d, v, 21) +#define ROL64_43(d, v) ROL64_odd( d, v, 22) +#define ROL64_44(d, v) ROL64_even(d, v, 22) +#define ROL64_45(d, v) ROL64_odd( d, v, 23) +#define ROL64_46(d, v) ROL64_even(d, v, 23) +#define ROL64_47(d, v) ROL64_odd( d, v, 24) +#define ROL64_48(d, v) ROL64_even(d, v, 24) +#define ROL64_49(d, v) ROL64_odd( d, v, 25) +#define ROL64_50(d, v) ROL64_even(d, v, 25) +#define ROL64_51(d, v) ROL64_odd( d, v, 26) +#define ROL64_52(d, v) ROL64_even(d, v, 26) +#define ROL64_53(d, v) ROL64_odd( d, v, 27) +#define ROL64_54(d, v) ROL64_even(d, v, 27) +#define ROL64_55(d, v) ROL64_odd( d, v, 28) +#define ROL64_56(d, v) ROL64_even(d, v, 28) +#define ROL64_57(d, v) ROL64_odd( d, v, 29) +#define ROL64_58(d, v) ROL64_even(d, v, 29) +#define ROL64_59(d, v) ROL64_odd( d, v, 30) +#define ROL64_60(d, v) ROL64_even(d, v, 30) +#define ROL64_61(d, v) ROL64_odd( d, v, 31) +#define ROL64_62(d, v) ROL64_even(d, v, 31) +#define ROL64_63(d, v) ROL64_odd63(d, v) + +#else + +#define ROL64_small(d, v, n) do { \ + sph_u32 tmp; \ + tmp = SPH_T32(v ## l << n) | (v ## h >> (32 - n)); \ + d ## h = SPH_T32(v ## h << n) | (v ## l >> (32 - n)); \ + d ## l = tmp; \ + } while (0) + +#define ROL64_0(d, v) 0 +#define ROL64_1(d, v) ROL64_small(d, v, 1) +#define ROL64_2(d, v) ROL64_small(d, v, 2) +#define ROL64_3(d, v) ROL64_small(d, v, 3) +#define ROL64_4(d, v) ROL64_small(d, v, 4) +#define ROL64_5(d, v) ROL64_small(d, v, 5) +#define ROL64_6(d, v) ROL64_small(d, v, 6) +#define ROL64_7(d, v) ROL64_small(d, v, 7) +#define ROL64_8(d, v) ROL64_small(d, v, 8) +#define ROL64_9(d, v) ROL64_small(d, v, 9) +#define ROL64_10(d, v) ROL64_small(d, v, 10) +#define ROL64_11(d, v) ROL64_small(d, v, 11) +#define ROL64_12(d, v) ROL64_small(d, v, 12) +#define ROL64_13(d, v) ROL64_small(d, v, 13) +#define ROL64_14(d, v) ROL64_small(d, v, 14) +#define ROL64_15(d, v) ROL64_small(d, v, 15) +#define ROL64_16(d, v) ROL64_small(d, v, 16) +#define ROL64_17(d, v) ROL64_small(d, v, 17) +#define ROL64_18(d, v) ROL64_small(d, v, 18) +#define ROL64_19(d, v) ROL64_small(d, v, 19) +#define ROL64_20(d, v) ROL64_small(d, v, 20) +#define ROL64_21(d, v) ROL64_small(d, v, 21) +#define ROL64_22(d, v) ROL64_small(d, v, 22) +#define ROL64_23(d, v) ROL64_small(d, v, 23) +#define ROL64_24(d, v) ROL64_small(d, v, 24) +#define ROL64_25(d, v) ROL64_small(d, v, 25) +#define ROL64_26(d, v) ROL64_small(d, v, 26) +#define ROL64_27(d, v) ROL64_small(d, v, 27) +#define ROL64_28(d, v) ROL64_small(d, v, 28) +#define ROL64_29(d, v) ROL64_small(d, v, 29) +#define ROL64_30(d, v) ROL64_small(d, v, 30) +#define ROL64_31(d, v) ROL64_small(d, v, 31) + +#define ROL64_32(d, v) do { \ + sph_u32 tmp; \ + tmp = v ## l; \ + d ## l = v ## h; \ + d ## h = tmp; \ + } while (0) + +#define ROL64_big(d, v, n) do { \ + sph_u32 trl, trh; \ + ROL64_small(tr, v, n); \ + d ## h = trl; \ + d ## l = trh; \ + } while (0) + +#define ROL64_33(d, v) ROL64_big(d, v, 1) +#define ROL64_34(d, v) ROL64_big(d, v, 2) +#define ROL64_35(d, v) ROL64_big(d, v, 3) +#define ROL64_36(d, v) ROL64_big(d, v, 4) +#define ROL64_37(d, v) ROL64_big(d, v, 5) +#define ROL64_38(d, v) ROL64_big(d, v, 6) +#define ROL64_39(d, v) ROL64_big(d, v, 7) +#define ROL64_40(d, v) ROL64_big(d, v, 8) +#define ROL64_41(d, v) ROL64_big(d, v, 9) +#define ROL64_42(d, v) ROL64_big(d, v, 10) +#define ROL64_43(d, v) ROL64_big(d, v, 11) +#define ROL64_44(d, v) ROL64_big(d, v, 12) +#define ROL64_45(d, v) ROL64_big(d, v, 13) +#define ROL64_46(d, v) ROL64_big(d, v, 14) +#define ROL64_47(d, v) ROL64_big(d, v, 15) +#define ROL64_48(d, v) ROL64_big(d, v, 16) +#define ROL64_49(d, v) ROL64_big(d, v, 17) +#define ROL64_50(d, v) ROL64_big(d, v, 18) +#define ROL64_51(d, v) ROL64_big(d, v, 19) +#define ROL64_52(d, v) ROL64_big(d, v, 20) +#define ROL64_53(d, v) ROL64_big(d, v, 21) +#define ROL64_54(d, v) ROL64_big(d, v, 22) +#define ROL64_55(d, v) ROL64_big(d, v, 23) +#define ROL64_56(d, v) ROL64_big(d, v, 24) +#define ROL64_57(d, v) ROL64_big(d, v, 25) +#define ROL64_58(d, v) ROL64_big(d, v, 26) +#define ROL64_59(d, v) ROL64_big(d, v, 27) +#define ROL64_60(d, v) ROL64_big(d, v, 28) +#define ROL64_61(d, v) ROL64_big(d, v, 29) +#define ROL64_62(d, v) ROL64_big(d, v, 30) +#define ROL64_63(d, v) ROL64_big(d, v, 31) + +#endif + +#define XOR64_IOTA(d, s, k) \ + (d ## l = s ## l ^ k.low, d ## h = s ## h ^ k.high) + +#endif + +#define TH_ELT(t, c0, c1, c2, c3, c4, d0, d1, d2, d3, d4) do { \ + DECL64(tt0); \ + DECL64(tt1); \ + DECL64(tt2); \ + DECL64(tt3); \ + XOR64(tt0, d0, d1); \ + XOR64(tt1, d2, d3); \ + XOR64(tt0, tt0, d4); \ + XOR64(tt0, tt0, tt1); \ + ROL64(tt0, tt0, 1); \ + XOR64(tt2, c0, c1); \ + XOR64(tt3, c2, c3); \ + XOR64(tt0, tt0, c4); \ + XOR64(tt2, tt2, tt3); \ + XOR64(t, tt0, tt2); \ + } while (0) + +#define THETA(b00, b01, b02, b03, b04, b10, b11, b12, b13, b14, \ + b20, b21, b22, b23, b24, b30, b31, b32, b33, b34, \ + b40, b41, b42, b43, b44) \ + do { \ + DECL64(t0); \ + DECL64(t1); \ + DECL64(t2); \ + DECL64(t3); \ + DECL64(t4); \ + TH_ELT(t0, b40, b41, b42, b43, b44, b10, b11, b12, b13, b14); \ + TH_ELT(t1, b00, b01, b02, b03, b04, b20, b21, b22, b23, b24); \ + TH_ELT(t2, b10, b11, b12, b13, b14, b30, b31, b32, b33, b34); \ + TH_ELT(t3, b20, b21, b22, b23, b24, b40, b41, b42, b43, b44); \ + TH_ELT(t4, b30, b31, b32, b33, b34, b00, b01, b02, b03, b04); \ + XOR64(b00, b00, t0); \ + XOR64(b01, b01, t0); \ + XOR64(b02, b02, t0); \ + XOR64(b03, b03, t0); \ + XOR64(b04, b04, t0); \ + XOR64(b10, b10, t1); \ + XOR64(b11, b11, t1); \ + XOR64(b12, b12, t1); \ + XOR64(b13, b13, t1); \ + XOR64(b14, b14, t1); \ + XOR64(b20, b20, t2); \ + XOR64(b21, b21, t2); \ + XOR64(b22, b22, t2); \ + XOR64(b23, b23, t2); \ + XOR64(b24, b24, t2); \ + XOR64(b30, b30, t3); \ + XOR64(b31, b31, t3); \ + XOR64(b32, b32, t3); \ + XOR64(b33, b33, t3); \ + XOR64(b34, b34, t3); \ + XOR64(b40, b40, t4); \ + XOR64(b41, b41, t4); \ + XOR64(b42, b42, t4); \ + XOR64(b43, b43, t4); \ + XOR64(b44, b44, t4); \ + } while (0) + +#define RHO(b00, b01, b02, b03, b04, b10, b11, b12, b13, b14, \ + b20, b21, b22, b23, b24, b30, b31, b32, b33, b34, \ + b40, b41, b42, b43, b44) \ + do { \ + /* ROL64(b00, b00, 0); */ \ + ROL64(b01, b01, 36); \ + ROL64(b02, b02, 3); \ + ROL64(b03, b03, 41); \ + ROL64(b04, b04, 18); \ + ROL64(b10, b10, 1); \ + ROL64(b11, b11, 44); \ + ROL64(b12, b12, 10); \ + ROL64(b13, b13, 45); \ + ROL64(b14, b14, 2); \ + ROL64(b20, b20, 62); \ + ROL64(b21, b21, 6); \ + ROL64(b22, b22, 43); \ + ROL64(b23, b23, 15); \ + ROL64(b24, b24, 61); \ + ROL64(b30, b30, 28); \ + ROL64(b31, b31, 55); \ + ROL64(b32, b32, 25); \ + ROL64(b33, b33, 21); \ + ROL64(b34, b34, 56); \ + ROL64(b40, b40, 27); \ + ROL64(b41, b41, 20); \ + ROL64(b42, b42, 39); \ + ROL64(b43, b43, 8); \ + ROL64(b44, b44, 14); \ + } while (0) + +/* + * The KHI macro integrates the "lane complement" optimization. On input, + * some words are complemented: + * a00 a01 a02 a04 a13 a20 a21 a22 a30 a33 a34 a43 + * On output, the following words are complemented: + * a04 a10 a20 a22 a23 a31 + * + * The (implicit) permutation and the theta expansion will bring back + * the input mask for the next round. + */ + +#define KHI_XO(d, a, b, c) do { \ + DECL64(kt); \ + OR64(kt, b, c); \ + XOR64(d, a, kt); \ + } while (0) + +#define KHI_XA(d, a, b, c) do { \ + DECL64(kt); \ + AND64(kt, b, c); \ + XOR64(d, a, kt); \ + } while (0) + +#define KHI(b00, b01, b02, b03, b04, b10, b11, b12, b13, b14, \ + b20, b21, b22, b23, b24, b30, b31, b32, b33, b34, \ + b40, b41, b42, b43, b44) \ + do { \ + DECL64(c0); \ + DECL64(c1); \ + DECL64(c2); \ + DECL64(c3); \ + DECL64(c4); \ + DECL64(bnn); \ + NOT64(bnn, b20); \ + KHI_XO(c0, b00, b10, b20); \ + KHI_XO(c1, b10, bnn, b30); \ + KHI_XA(c2, b20, b30, b40); \ + KHI_XO(c3, b30, b40, b00); \ + KHI_XA(c4, b40, b00, b10); \ + MOV64(b00, c0); \ + MOV64(b10, c1); \ + MOV64(b20, c2); \ + MOV64(b30, c3); \ + MOV64(b40, c4); \ + NOT64(bnn, b41); \ + KHI_XO(c0, b01, b11, b21); \ + KHI_XA(c1, b11, b21, b31); \ + KHI_XO(c2, b21, b31, bnn); \ + KHI_XO(c3, b31, b41, b01); \ + KHI_XA(c4, b41, b01, b11); \ + MOV64(b01, c0); \ + MOV64(b11, c1); \ + MOV64(b21, c2); \ + MOV64(b31, c3); \ + MOV64(b41, c4); \ + NOT64(bnn, b32); \ + KHI_XO(c0, b02, b12, b22); \ + KHI_XA(c1, b12, b22, b32); \ + KHI_XA(c2, b22, bnn, b42); \ + KHI_XO(c3, bnn, b42, b02); \ + KHI_XA(c4, b42, b02, b12); \ + MOV64(b02, c0); \ + MOV64(b12, c1); \ + MOV64(b22, c2); \ + MOV64(b32, c3); \ + MOV64(b42, c4); \ + NOT64(bnn, b33); \ + KHI_XA(c0, b03, b13, b23); \ + KHI_XO(c1, b13, b23, b33); \ + KHI_XO(c2, b23, bnn, b43); \ + KHI_XA(c3, bnn, b43, b03); \ + KHI_XO(c4, b43, b03, b13); \ + MOV64(b03, c0); \ + MOV64(b13, c1); \ + MOV64(b23, c2); \ + MOV64(b33, c3); \ + MOV64(b43, c4); \ + NOT64(bnn, b14); \ + KHI_XA(c0, b04, bnn, b24); \ + KHI_XO(c1, bnn, b24, b34); \ + KHI_XA(c2, b24, b34, b44); \ + KHI_XO(c3, b34, b44, b04); \ + KHI_XA(c4, b44, b04, b14); \ + MOV64(b04, c0); \ + MOV64(b14, c1); \ + MOV64(b24, c2); \ + MOV64(b34, c3); \ + MOV64(b44, c4); \ + } while (0) + +#define IOTA(r) XOR64_IOTA(a00, a00, r) + +#define P0 a00, a01, a02, a03, a04, a10, a11, a12, a13, a14, a20, a21, \ + a22, a23, a24, a30, a31, a32, a33, a34, a40, a41, a42, a43, a44 +#define P1 a00, a30, a10, a40, a20, a11, a41, a21, a01, a31, a22, a02, \ + a32, a12, a42, a33, a13, a43, a23, a03, a44, a24, a04, a34, a14 +#define P2 a00, a33, a11, a44, a22, a41, a24, a02, a30, a13, a32, a10, \ + a43, a21, a04, a23, a01, a34, a12, a40, a14, a42, a20, a03, a31 +#define P3 a00, a23, a41, a14, a32, a24, a42, a10, a33, a01, a43, a11, \ + a34, a02, a20, a12, a30, a03, a21, a44, a31, a04, a22, a40, a13 +#define P4 a00, a12, a24, a31, a43, a42, a04, a11, a23, a30, a34, a41, \ + a03, a10, a22, a21, a33, a40, a02, a14, a13, a20, a32, a44, a01 +#define P5 a00, a21, a42, a13, a34, a04, a20, a41, a12, a33, a03, a24, \ + a40, a11, a32, a02, a23, a44, a10, a31, a01, a22, a43, a14, a30 +#define P6 a00, a02, a04, a01, a03, a20, a22, a24, a21, a23, a40, a42, \ + a44, a41, a43, a10, a12, a14, a11, a13, a30, a32, a34, a31, a33 +#define P7 a00, a10, a20, a30, a40, a22, a32, a42, a02, a12, a44, a04, \ + a14, a24, a34, a11, a21, a31, a41, a01, a33, a43, a03, a13, a23 +#define P8 a00, a11, a22, a33, a44, a32, a43, a04, a10, a21, a14, a20, \ + a31, a42, a03, a41, a02, a13, a24, a30, a23, a34, a40, a01, a12 +#define P9 a00, a41, a32, a23, a14, a43, a34, a20, a11, a02, a31, a22, \ + a13, a04, a40, a24, a10, a01, a42, a33, a12, a03, a44, a30, a21 +#define P10 a00, a24, a43, a12, a31, a34, a03, a22, a41, a10, a13, a32, \ + a01, a20, a44, a42, a11, a30, a04, a23, a21, a40, a14, a33, a02 +#define P11 a00, a42, a34, a21, a13, a03, a40, a32, a24, a11, a01, a43, \ + a30, a22, a14, a04, a41, a33, a20, a12, a02, a44, a31, a23, a10 +#define P12 a00, a04, a03, a02, a01, a40, a44, a43, a42, a41, a30, a34, \ + a33, a32, a31, a20, a24, a23, a22, a21, a10, a14, a13, a12, a11 +#define P13 a00, a20, a40, a10, a30, a44, a14, a34, a04, a24, a33, a03, \ + a23, a43, a13, a22, a42, a12, a32, a02, a11, a31, a01, a21, a41 +#define P14 a00, a22, a44, a11, a33, a14, a31, a03, a20, a42, a23, a40, \ + a12, a34, a01, a32, a04, a21, a43, a10, a41, a13, a30, a02, a24 +#define P15 a00, a32, a14, a41, a23, a31, a13, a40, a22, a04, a12, a44, \ + a21, a03, a30, a43, a20, a02, a34, a11, a24, a01, a33, a10, a42 +#define P16 a00, a43, a31, a24, a12, a13, a01, a44, a32, a20, a21, a14, \ + a02, a40, a33, a34, a22, a10, a03, a41, a42, a30, a23, a11, a04 +#define P17 a00, a34, a13, a42, a21, a01, a30, a14, a43, a22, a02, a31, \ + a10, a44, a23, a03, a32, a11, a40, a24, a04, a33, a12, a41, a20 +#define P18 a00, a03, a01, a04, a02, a30, a33, a31, a34, a32, a10, a13, \ + a11, a14, a12, a40, a43, a41, a44, a42, a20, a23, a21, a24, a22 +#define P19 a00, a40, a30, a20, a10, a33, a23, a13, a03, a43, a11, a01, \ + a41, a31, a21, a44, a34, a24, a14, a04, a22, a12, a02, a42, a32 +#define P20 a00, a44, a33, a22, a11, a23, a12, a01, a40, a34, a41, a30, \ + a24, a13, a02, a14, a03, a42, a31, a20, a32, a21, a10, a04, a43 +#define P21 a00, a14, a23, a32, a41, a12, a21, a30, a44, a03, a24, a33, \ + a42, a01, a10, a31, a40, a04, a13, a22, a43, a02, a11, a20, a34 +#define P22 a00, a31, a12, a43, a24, a21, a02, a33, a14, a40, a42, a23, \ + a04, a30, a11, a13, a44, a20, a01, a32, a34, a10, a41, a22, a03 +#define P23 a00, a13, a21, a34, a42, a02, a10, a23, a31, a44, a04, a12, \ + a20, a33, a41, a01, a14, a22, a30, a43, a03, a11, a24, a32, a40 + +#define P1_TO_P0 do { \ + DECL64(t); \ + MOV64(t, a01); \ + MOV64(a01, a30); \ + MOV64(a30, a33); \ + MOV64(a33, a23); \ + MOV64(a23, a12); \ + MOV64(a12, a21); \ + MOV64(a21, a02); \ + MOV64(a02, a10); \ + MOV64(a10, a11); \ + MOV64(a11, a41); \ + MOV64(a41, a24); \ + MOV64(a24, a42); \ + MOV64(a42, a04); \ + MOV64(a04, a20); \ + MOV64(a20, a22); \ + MOV64(a22, a32); \ + MOV64(a32, a43); \ + MOV64(a43, a34); \ + MOV64(a34, a03); \ + MOV64(a03, a40); \ + MOV64(a40, a44); \ + MOV64(a44, a14); \ + MOV64(a14, a31); \ + MOV64(a31, a13); \ + MOV64(a13, t); \ + } while (0) + +#define P2_TO_P0 do { \ + DECL64(t); \ + MOV64(t, a01); \ + MOV64(a01, a33); \ + MOV64(a33, a12); \ + MOV64(a12, a02); \ + MOV64(a02, a11); \ + MOV64(a11, a24); \ + MOV64(a24, a04); \ + MOV64(a04, a22); \ + MOV64(a22, a43); \ + MOV64(a43, a03); \ + MOV64(a03, a44); \ + MOV64(a44, a31); \ + MOV64(a31, t); \ + MOV64(t, a10); \ + MOV64(a10, a41); \ + MOV64(a41, a42); \ + MOV64(a42, a20); \ + MOV64(a20, a32); \ + MOV64(a32, a34); \ + MOV64(a34, a40); \ + MOV64(a40, a14); \ + MOV64(a14, a13); \ + MOV64(a13, a30); \ + MOV64(a30, a23); \ + MOV64(a23, a21); \ + MOV64(a21, t); \ + } while (0) + +#define P4_TO_P0 do { \ + DECL64(t); \ + MOV64(t, a01); \ + MOV64(a01, a12); \ + MOV64(a12, a11); \ + MOV64(a11, a04); \ + MOV64(a04, a43); \ + MOV64(a43, a44); \ + MOV64(a44, t); \ + MOV64(t, a02); \ + MOV64(a02, a24); \ + MOV64(a24, a22); \ + MOV64(a22, a03); \ + MOV64(a03, a31); \ + MOV64(a31, a33); \ + MOV64(a33, t); \ + MOV64(t, a10); \ + MOV64(a10, a42); \ + MOV64(a42, a32); \ + MOV64(a32, a40); \ + MOV64(a40, a13); \ + MOV64(a13, a23); \ + MOV64(a23, t); \ + MOV64(t, a14); \ + MOV64(a14, a30); \ + MOV64(a30, a21); \ + MOV64(a21, a41); \ + MOV64(a41, a20); \ + MOV64(a20, a34); \ + MOV64(a34, t); \ + } while (0) + +#define P6_TO_P0 do { \ + DECL64(t); \ + MOV64(t, a01); \ + MOV64(a01, a02); \ + MOV64(a02, a04); \ + MOV64(a04, a03); \ + MOV64(a03, t); \ + MOV64(t, a10); \ + MOV64(a10, a20); \ + MOV64(a20, a40); \ + MOV64(a40, a30); \ + MOV64(a30, t); \ + MOV64(t, a11); \ + MOV64(a11, a22); \ + MOV64(a22, a44); \ + MOV64(a44, a33); \ + MOV64(a33, t); \ + MOV64(t, a12); \ + MOV64(a12, a24); \ + MOV64(a24, a43); \ + MOV64(a43, a31); \ + MOV64(a31, t); \ + MOV64(t, a13); \ + MOV64(a13, a21); \ + MOV64(a21, a42); \ + MOV64(a42, a34); \ + MOV64(a34, t); \ + MOV64(t, a14); \ + MOV64(a14, a23); \ + MOV64(a23, a41); \ + MOV64(a41, a32); \ + MOV64(a32, t); \ + } while (0) + +#define P8_TO_P0 do { \ + DECL64(t); \ + MOV64(t, a01); \ + MOV64(a01, a11); \ + MOV64(a11, a43); \ + MOV64(a43, t); \ + MOV64(t, a02); \ + MOV64(a02, a22); \ + MOV64(a22, a31); \ + MOV64(a31, t); \ + MOV64(t, a03); \ + MOV64(a03, a33); \ + MOV64(a33, a24); \ + MOV64(a24, t); \ + MOV64(t, a04); \ + MOV64(a04, a44); \ + MOV64(a44, a12); \ + MOV64(a12, t); \ + MOV64(t, a10); \ + MOV64(a10, a32); \ + MOV64(a32, a13); \ + MOV64(a13, t); \ + MOV64(t, a14); \ + MOV64(a14, a21); \ + MOV64(a21, a20); \ + MOV64(a20, t); \ + MOV64(t, a23); \ + MOV64(a23, a42); \ + MOV64(a42, a40); \ + MOV64(a40, t); \ + MOV64(t, a30); \ + MOV64(a30, a41); \ + MOV64(a41, a34); \ + MOV64(a34, t); \ + } while (0) + +#define P12_TO_P0 do { \ + DECL64(t); \ + MOV64(t, a01); \ + MOV64(a01, a04); \ + MOV64(a04, t); \ + MOV64(t, a02); \ + MOV64(a02, a03); \ + MOV64(a03, t); \ + MOV64(t, a10); \ + MOV64(a10, a40); \ + MOV64(a40, t); \ + MOV64(t, a11); \ + MOV64(a11, a44); \ + MOV64(a44, t); \ + MOV64(t, a12); \ + MOV64(a12, a43); \ + MOV64(a43, t); \ + MOV64(t, a13); \ + MOV64(a13, a42); \ + MOV64(a42, t); \ + MOV64(t, a14); \ + MOV64(a14, a41); \ + MOV64(a41, t); \ + MOV64(t, a20); \ + MOV64(a20, a30); \ + MOV64(a30, t); \ + MOV64(t, a21); \ + MOV64(a21, a34); \ + MOV64(a34, t); \ + MOV64(t, a22); \ + MOV64(a22, a33); \ + MOV64(a33, t); \ + MOV64(t, a23); \ + MOV64(a23, a32); \ + MOV64(a32, t); \ + MOV64(t, a24); \ + MOV64(a24, a31); \ + MOV64(a31, t); \ + } while (0) + +#define LPAR ( +#define RPAR ) + +#define KF_ELT(r, s, k) do { \ + THETA LPAR P ## r RPAR; \ + RHO LPAR P ## r RPAR; \ + KHI LPAR P ## s RPAR; \ + IOTA(k); \ + } while (0) + +#define DO(x) x + +#define KECCAK_F_1600 DO(KECCAK_F_1600_) + +#if SPH_KECCAK_UNROLL == 1 + +#define KECCAK_F_1600_ do { \ + int j; \ + for (j = 0; j < 24; j ++) { \ + KF_ELT( 0, 1, RC[j + 0]); \ + P1_TO_P0; \ + } \ + } while (0) + +#elif SPH_KECCAK_UNROLL == 2 + +#define KECCAK_F_1600_ do { \ + int j; \ + for (j = 0; j < 24; j += 2) { \ + KF_ELT( 0, 1, RC[j + 0]); \ + KF_ELT( 1, 2, RC[j + 1]); \ + P2_TO_P0; \ + } \ + } while (0) + +#elif SPH_KECCAK_UNROLL == 4 + +#define KECCAK_F_1600_ do { \ + int j; \ + for (j = 0; j < 24; j += 4) { \ + KF_ELT( 0, 1, RC[j + 0]); \ + KF_ELT( 1, 2, RC[j + 1]); \ + KF_ELT( 2, 3, RC[j + 2]); \ + KF_ELT( 3, 4, RC[j + 3]); \ + P4_TO_P0; \ + } \ + } while (0) + +#elif SPH_KECCAK_UNROLL == 6 + +#define KECCAK_F_1600_ do { \ + int j; \ + for (j = 0; j < 24; j += 6) { \ + KF_ELT( 0, 1, RC[j + 0]); \ + KF_ELT( 1, 2, RC[j + 1]); \ + KF_ELT( 2, 3, RC[j + 2]); \ + KF_ELT( 3, 4, RC[j + 3]); \ + KF_ELT( 4, 5, RC[j + 4]); \ + KF_ELT( 5, 6, RC[j + 5]); \ + P6_TO_P0; \ + } \ + } while (0) + +#elif SPH_KECCAK_UNROLL == 8 + +#define KECCAK_F_1600_ do { \ + int j; \ + for (j = 0; j < 24; j += 8) { \ + KF_ELT( 0, 1, RC[j + 0]); \ + KF_ELT( 1, 2, RC[j + 1]); \ + KF_ELT( 2, 3, RC[j + 2]); \ + KF_ELT( 3, 4, RC[j + 3]); \ + KF_ELT( 4, 5, RC[j + 4]); \ + KF_ELT( 5, 6, RC[j + 5]); \ + KF_ELT( 6, 7, RC[j + 6]); \ + KF_ELT( 7, 8, RC[j + 7]); \ + P8_TO_P0; \ + } \ + } while (0) + +#elif SPH_KECCAK_UNROLL == 12 + +#define KECCAK_F_1600_ do { \ + int j; \ + for (j = 0; j < 24; j += 12) { \ + KF_ELT( 0, 1, RC[j + 0]); \ + KF_ELT( 1, 2, RC[j + 1]); \ + KF_ELT( 2, 3, RC[j + 2]); \ + KF_ELT( 3, 4, RC[j + 3]); \ + KF_ELT( 4, 5, RC[j + 4]); \ + KF_ELT( 5, 6, RC[j + 5]); \ + KF_ELT( 6, 7, RC[j + 6]); \ + KF_ELT( 7, 8, RC[j + 7]); \ + KF_ELT( 8, 9, RC[j + 8]); \ + KF_ELT( 9, 10, RC[j + 9]); \ + KF_ELT(10, 11, RC[j + 10]); \ + KF_ELT(11, 12, RC[j + 11]); \ + P12_TO_P0; \ + } \ + } while (0) + +#elif SPH_KECCAK_UNROLL == 0 + +#define KECCAK_F_1600_ do { \ + KF_ELT( 0, 1, RC[ 0]); \ + KF_ELT( 1, 2, RC[ 1]); \ + KF_ELT( 2, 3, RC[ 2]); \ + KF_ELT( 3, 4, RC[ 3]); \ + KF_ELT( 4, 5, RC[ 4]); \ + KF_ELT( 5, 6, RC[ 5]); \ + KF_ELT( 6, 7, RC[ 6]); \ + KF_ELT( 7, 8, RC[ 7]); \ + KF_ELT( 8, 9, RC[ 8]); \ + KF_ELT( 9, 10, RC[ 9]); \ + KF_ELT(10, 11, RC[10]); \ + KF_ELT(11, 12, RC[11]); \ + KF_ELT(12, 13, RC[12]); \ + KF_ELT(13, 14, RC[13]); \ + KF_ELT(14, 15, RC[14]); \ + KF_ELT(15, 16, RC[15]); \ + KF_ELT(16, 17, RC[16]); \ + KF_ELT(17, 18, RC[17]); \ + KF_ELT(18, 19, RC[18]); \ + KF_ELT(19, 20, RC[19]); \ + KF_ELT(20, 21, RC[20]); \ + KF_ELT(21, 22, RC[21]); \ + KF_ELT(22, 23, RC[22]); \ + KF_ELT(23, 0, RC[23]); \ + } while (0) + +#else + +#error Unimplemented unroll count for Keccak. + +#endif + +static void +keccak_init(sph_keccak_context *kc, unsigned out_size) +{ + int i; + +#if SPH_KECCAK_64 + for (i = 0; i < 25; i ++) + kc->u.wide[i] = 0; + /* + * Initialization for the "lane complement". + */ + kc->u.wide[ 1] = SPH_C64(0xFFFFFFFFFFFFFFFF); + kc->u.wide[ 2] = SPH_C64(0xFFFFFFFFFFFFFFFF); + kc->u.wide[ 8] = SPH_C64(0xFFFFFFFFFFFFFFFF); + kc->u.wide[12] = SPH_C64(0xFFFFFFFFFFFFFFFF); + kc->u.wide[17] = SPH_C64(0xFFFFFFFFFFFFFFFF); + kc->u.wide[20] = SPH_C64(0xFFFFFFFFFFFFFFFF); +#else + + for (i = 0; i < 50; i ++) + kc->u.narrow[i] = 0; + /* + * Initialization for the "lane complement". + * Note: since we set to all-one full 64-bit words, + * interleaving (if applicable) is a no-op. + */ + kc->u.narrow[ 2] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[ 3] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[ 4] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[ 5] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[16] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[17] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[24] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[25] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[34] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[35] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[40] = SPH_C32(0xFFFFFFFF); + kc->u.narrow[41] = SPH_C32(0xFFFFFFFF); +#endif + kc->ptr = 0; + kc->lim = 200 - (out_size >> 2); +} + +static void +keccak_core(sph_keccak_context *kc, const void *data, size_t len, size_t lim) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE + + buf = kc->buf; + ptr = kc->ptr; + + if (len < (lim - ptr)) { + memcpy(buf + ptr, data, len); + kc->ptr = ptr + len; + return; + } + + READ_STATE(kc); + while (len > 0) { + size_t clen; + + clen = (lim - ptr); + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == lim) { + INPUT_BUF(lim); + KECCAK_F_1600; + ptr = 0; + } + } + WRITE_STATE(kc); + kc->ptr = ptr; +} + +#if SPH_KECCAK_64 + +#define DEFCLOSE(d, lim) \ + static void keccak_close ## d( \ + sph_keccak_context *kc, unsigned ub, unsigned n, void *dst) \ + { \ + unsigned eb; \ + union { \ + unsigned char tmp[lim + 1]; \ + sph_u64 dummy; /* for alignment */ \ + } u; \ + size_t j; \ + \ + eb = (0x100 | (ub & 0xFF)) >> (8 - n); \ + if (kc->ptr == (lim - 1)) { \ + if (n == 7) { \ + u.tmp[0] = eb; \ + memset(u.tmp + 1, 0, lim - 1); \ + u.tmp[lim] = 0x80; \ + j = 1 + lim; \ + } else { \ + u.tmp[0] = eb | 0x80; \ + j = 1; \ + } \ + } else { \ + j = lim - kc->ptr; \ + u.tmp[0] = eb; \ + memset(u.tmp + 1, 0, j - 2); \ + u.tmp[j - 1] = 0x80; \ + } \ + keccak_core(kc, u.tmp, j, lim); \ + /* Finalize the "lane complement" */ \ + kc->u.wide[ 1] = ~kc->u.wide[ 1]; \ + kc->u.wide[ 2] = ~kc->u.wide[ 2]; \ + kc->u.wide[ 8] = ~kc->u.wide[ 8]; \ + kc->u.wide[12] = ~kc->u.wide[12]; \ + kc->u.wide[17] = ~kc->u.wide[17]; \ + kc->u.wide[20] = ~kc->u.wide[20]; \ + for (j = 0; j < d; j += 8) \ + sph_enc64le_aligned(u.tmp + j, kc->u.wide[j >> 3]); \ + memcpy(dst, u.tmp, d); \ + keccak_init(kc, (unsigned)d << 3); \ + } \ + +#else + +#define DEFCLOSE(d, lim) \ + static void keccak_close ## d( \ + sph_keccak_context *kc, unsigned ub, unsigned n, void *dst) \ + { \ + unsigned eb; \ + union { \ + unsigned char tmp[lim + 1]; \ + sph_u64 dummy; /* for alignment */ \ + } u; \ + size_t j; \ + \ + eb = (0x100 | (ub & 0xFF)) >> (8 - n); \ + if (kc->ptr == (lim - 1)) { \ + if (n == 7) { \ + u.tmp[0] = eb; \ + memset(u.tmp + 1, 0, lim - 1); \ + u.tmp[lim] = 0x80; \ + j = 1 + lim; \ + } else { \ + u.tmp[0] = eb | 0x80; \ + j = 1; \ + } \ + } else { \ + j = lim - kc->ptr; \ + u.tmp[0] = eb; \ + memset(u.tmp + 1, 0, j - 2); \ + u.tmp[j - 1] = 0x80; \ + } \ + keccak_core(kc, u.tmp, j, lim); \ + /* Finalize the "lane complement" */ \ + kc->u.narrow[ 2] = ~kc->u.narrow[ 2]; \ + kc->u.narrow[ 3] = ~kc->u.narrow[ 3]; \ + kc->u.narrow[ 4] = ~kc->u.narrow[ 4]; \ + kc->u.narrow[ 5] = ~kc->u.narrow[ 5]; \ + kc->u.narrow[16] = ~kc->u.narrow[16]; \ + kc->u.narrow[17] = ~kc->u.narrow[17]; \ + kc->u.narrow[24] = ~kc->u.narrow[24]; \ + kc->u.narrow[25] = ~kc->u.narrow[25]; \ + kc->u.narrow[34] = ~kc->u.narrow[34]; \ + kc->u.narrow[35] = ~kc->u.narrow[35]; \ + kc->u.narrow[40] = ~kc->u.narrow[40]; \ + kc->u.narrow[41] = ~kc->u.narrow[41]; \ + /* un-interleave */ \ + for (j = 0; j < 50; j += 2) \ + UNINTERLEAVE(kc->u.narrow[j], kc->u.narrow[j + 1]); \ + for (j = 0; j < d; j += 4) \ + sph_enc32le_aligned(u.tmp + j, kc->u.narrow[j >> 2]); \ + memcpy(dst, u.tmp, d); \ + keccak_init(kc, (unsigned)d << 3); \ + } \ + +#endif + +DEFCLOSE(28, 144) +DEFCLOSE(32, 136) +DEFCLOSE(48, 104) +DEFCLOSE(64, 72) + +/* see sph_keccak.h */ +void +sph_keccak224_init(void *cc) +{ + keccak_init(cc, 224); +} + +/* see sph_keccak.h */ +void +sph_keccak224(void *cc, const void *data, size_t len) +{ + keccak_core(cc, data, len, 144); +} + +/* see sph_keccak.h */ +void +sph_keccak224_close(void *cc, void *dst) +{ + sph_keccak224_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_keccak.h */ +void +sph_keccak224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + keccak_close28(cc, ub, n, dst); +} + +/* see sph_keccak.h */ +void +sph_keccak256_init(void *cc) +{ + keccak_init(cc, 256); +} + +/* see sph_keccak.h */ +void +sph_keccak256(void *cc, const void *data, size_t len) +{ + keccak_core(cc, data, len, 136); +} + +/* see sph_keccak.h */ +void +sph_keccak256_close(void *cc, void *dst) +{ + sph_keccak256_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_keccak.h */ +void +sph_keccak256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + keccak_close32(cc, ub, n, dst); +} + +/* see sph_keccak.h */ +void +sph_keccak384_init(void *cc) +{ + keccak_init(cc, 384); +} + +/* see sph_keccak.h */ +void +sph_keccak384(void *cc, const void *data, size_t len) +{ + keccak_core(cc, data, len, 104); +} + +/* see sph_keccak.h */ +void +sph_keccak384_close(void *cc, void *dst) +{ + sph_keccak384_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_keccak.h */ +void +sph_keccak384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + keccak_close48(cc, ub, n, dst); +} + +/* see sph_keccak.h */ +void +sph_keccak512_init(void *cc) +{ + keccak_init(cc, 512); +} + +/* see sph_keccak.h */ +void +sph_keccak512(void *cc, const void *data, size_t len) +{ + keccak_core(cc, data, len, 72); +} + +/* see sph_keccak.h */ +void +sph_keccak512_close(void *cc, void *dst) +{ + sph_keccak512_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_keccak.h */ +void +sph_keccak512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + keccak_close64(cc, ub, n, dst); +} + + +#ifdef __cplusplus +} +#endif diff --git a/sph/luffa.c b/sph/luffa.c new file mode 100644 index 0000000..a761bea --- /dev/null +++ b/sph/luffa.c @@ -0,0 +1,1426 @@ +/* $Id: luffa.c 219 2010-06-08 17:24:41Z tp $ */ +/* + * Luffa implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include +#include + +#include "sph_luffa.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_64_TRUE && !defined SPH_LUFFA_PARALLEL +#define SPH_LUFFA_PARALLEL 1 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +static const sph_u32 V_INIT[5][8] = { + { + SPH_C32(0x6d251e69), SPH_C32(0x44b051e0), + SPH_C32(0x4eaa6fb4), SPH_C32(0xdbf78465), + SPH_C32(0x6e292011), SPH_C32(0x90152df4), + SPH_C32(0xee058139), SPH_C32(0xdef610bb) + }, { + SPH_C32(0xc3b44b95), SPH_C32(0xd9d2f256), + SPH_C32(0x70eee9a0), SPH_C32(0xde099fa3), + SPH_C32(0x5d9b0557), SPH_C32(0x8fc944b3), + SPH_C32(0xcf1ccf0e), SPH_C32(0x746cd581) + }, { + SPH_C32(0xf7efc89d), SPH_C32(0x5dba5781), + SPH_C32(0x04016ce5), SPH_C32(0xad659c05), + SPH_C32(0x0306194f), SPH_C32(0x666d1836), + SPH_C32(0x24aa230a), SPH_C32(0x8b264ae7) + }, { + SPH_C32(0x858075d5), SPH_C32(0x36d79cce), + SPH_C32(0xe571f7d7), SPH_C32(0x204b1f67), + SPH_C32(0x35870c6a), SPH_C32(0x57e9e923), + SPH_C32(0x14bcb808), SPH_C32(0x7cde72ce) + }, { + SPH_C32(0x6c68e9be), SPH_C32(0x5ec41e22), + SPH_C32(0xc825b7c7), SPH_C32(0xaffb4363), + SPH_C32(0xf5df3999), SPH_C32(0x0fc688f1), + SPH_C32(0xb07224cc), SPH_C32(0x03e86cea) + } +}; + +static const sph_u32 RC00[8] = { + SPH_C32(0x303994a6), SPH_C32(0xc0e65299), + SPH_C32(0x6cc33a12), SPH_C32(0xdc56983e), + SPH_C32(0x1e00108f), SPH_C32(0x7800423d), + SPH_C32(0x8f5b7882), SPH_C32(0x96e1db12) +}; + +static const sph_u32 RC04[8] = { + SPH_C32(0xe0337818), SPH_C32(0x441ba90d), + SPH_C32(0x7f34d442), SPH_C32(0x9389217f), + SPH_C32(0xe5a8bce6), SPH_C32(0x5274baf4), + SPH_C32(0x26889ba7), SPH_C32(0x9a226e9d) +}; + +static const sph_u32 RC10[8] = { + SPH_C32(0xb6de10ed), SPH_C32(0x70f47aae), + SPH_C32(0x0707a3d4), SPH_C32(0x1c1e8f51), + SPH_C32(0x707a3d45), SPH_C32(0xaeb28562), + SPH_C32(0xbaca1589), SPH_C32(0x40a46f3e) +}; + +static const sph_u32 RC14[8] = { + SPH_C32(0x01685f3d), SPH_C32(0x05a17cf4), + SPH_C32(0xbd09caca), SPH_C32(0xf4272b28), + SPH_C32(0x144ae5cc), SPH_C32(0xfaa7ae2b), + SPH_C32(0x2e48f1c1), SPH_C32(0xb923c704) +}; + +#if SPH_LUFFA_PARALLEL + +static const sph_u64 RCW010[8] = { + SPH_C64(0xb6de10ed303994a6), SPH_C64(0x70f47aaec0e65299), + SPH_C64(0x0707a3d46cc33a12), SPH_C64(0x1c1e8f51dc56983e), + SPH_C64(0x707a3d451e00108f), SPH_C64(0xaeb285627800423d), + SPH_C64(0xbaca15898f5b7882), SPH_C64(0x40a46f3e96e1db12) +}; + +static const sph_u64 RCW014[8] = { + SPH_C64(0x01685f3de0337818), SPH_C64(0x05a17cf4441ba90d), + SPH_C64(0xbd09caca7f34d442), SPH_C64(0xf4272b289389217f), + SPH_C64(0x144ae5cce5a8bce6), SPH_C64(0xfaa7ae2b5274baf4), + SPH_C64(0x2e48f1c126889ba7), SPH_C64(0xb923c7049a226e9d) +}; + +#endif + +static const sph_u32 RC20[8] = { + SPH_C32(0xfc20d9d2), SPH_C32(0x34552e25), + SPH_C32(0x7ad8818f), SPH_C32(0x8438764a), + SPH_C32(0xbb6de032), SPH_C32(0xedb780c8), + SPH_C32(0xd9847356), SPH_C32(0xa2c78434) +}; + +static const sph_u32 RC24[8] = { + SPH_C32(0xe25e72c1), SPH_C32(0xe623bb72), + SPH_C32(0x5c58a4a4), SPH_C32(0x1e38e2e7), + SPH_C32(0x78e38b9d), SPH_C32(0x27586719), + SPH_C32(0x36eda57f), SPH_C32(0x703aace7) +}; + +static const sph_u32 RC30[8] = { + SPH_C32(0xb213afa5), SPH_C32(0xc84ebe95), + SPH_C32(0x4e608a22), SPH_C32(0x56d858fe), + SPH_C32(0x343b138f), SPH_C32(0xd0ec4e3d), + SPH_C32(0x2ceb4882), SPH_C32(0xb3ad2208) +}; + +static const sph_u32 RC34[8] = { + SPH_C32(0xe028c9bf), SPH_C32(0x44756f91), + SPH_C32(0x7e8fce32), SPH_C32(0x956548be), + SPH_C32(0xfe191be2), SPH_C32(0x3cb226e5), + SPH_C32(0x5944a28e), SPH_C32(0xa1c4c355) +}; + +#if SPH_LUFFA_PARALLEL + +static const sph_u64 RCW230[8] = { + SPH_C64(0xb213afa5fc20d9d2), SPH_C64(0xc84ebe9534552e25), + SPH_C64(0x4e608a227ad8818f), SPH_C64(0x56d858fe8438764a), + SPH_C64(0x343b138fbb6de032), SPH_C64(0xd0ec4e3dedb780c8), + SPH_C64(0x2ceb4882d9847356), SPH_C64(0xb3ad2208a2c78434) +}; + + +static const sph_u64 RCW234[8] = { + SPH_C64(0xe028c9bfe25e72c1), SPH_C64(0x44756f91e623bb72), + SPH_C64(0x7e8fce325c58a4a4), SPH_C64(0x956548be1e38e2e7), + SPH_C64(0xfe191be278e38b9d), SPH_C64(0x3cb226e527586719), + SPH_C64(0x5944a28e36eda57f), SPH_C64(0xa1c4c355703aace7) +}; + +#endif + +static const sph_u32 RC40[8] = { + SPH_C32(0xf0d2e9e3), SPH_C32(0xac11d7fa), + SPH_C32(0x1bcb66f2), SPH_C32(0x6f2d9bc9), + SPH_C32(0x78602649), SPH_C32(0x8edae952), + SPH_C32(0x3b6ba548), SPH_C32(0xedae9520) +}; + +static const sph_u32 RC44[8] = { + SPH_C32(0x5090d577), SPH_C32(0x2d1925ab), + SPH_C32(0xb46496ac), SPH_C32(0xd1925ab0), + SPH_C32(0x29131ab6), SPH_C32(0x0fc053c3), + SPH_C32(0x3f014f0c), SPH_C32(0xfc053c31) +}; + +#define DECL_TMP8(w) \ + sph_u32 w ## 0, w ## 1, w ## 2, w ## 3, w ## 4, w ## 5, w ## 6, w ## 7; + +#define M2(d, s) do { \ + sph_u32 tmp = s ## 7; \ + d ## 7 = s ## 6; \ + d ## 6 = s ## 5; \ + d ## 5 = s ## 4; \ + d ## 4 = s ## 3 ^ tmp; \ + d ## 3 = s ## 2 ^ tmp; \ + d ## 2 = s ## 1; \ + d ## 1 = s ## 0 ^ tmp; \ + d ## 0 = tmp; \ + } while (0) + +#define XOR(d, s1, s2) do { \ + d ## 0 = s1 ## 0 ^ s2 ## 0; \ + d ## 1 = s1 ## 1 ^ s2 ## 1; \ + d ## 2 = s1 ## 2 ^ s2 ## 2; \ + d ## 3 = s1 ## 3 ^ s2 ## 3; \ + d ## 4 = s1 ## 4 ^ s2 ## 4; \ + d ## 5 = s1 ## 5 ^ s2 ## 5; \ + d ## 6 = s1 ## 6 ^ s2 ## 6; \ + d ## 7 = s1 ## 7 ^ s2 ## 7; \ + } while (0) + +#if SPH_LUFFA_PARALLEL + +#define SUB_CRUMB_GEN(a0, a1, a2, a3, width) do { \ + sph_u ## width tmp; \ + tmp = (a0); \ + (a0) |= (a1); \ + (a2) ^= (a3); \ + (a1) = SPH_T ## width(~(a1)); \ + (a0) ^= (a3); \ + (a3) &= tmp; \ + (a1) ^= (a3); \ + (a3) ^= (a2); \ + (a2) &= (a0); \ + (a0) = SPH_T ## width(~(a0)); \ + (a2) ^= (a1); \ + (a1) |= (a3); \ + tmp ^= (a1); \ + (a3) ^= (a2); \ + (a2) &= (a1); \ + (a1) ^= (a0); \ + (a0) = tmp; \ + } while (0) + +#define SUB_CRUMB(a0, a1, a2, a3) SUB_CRUMB_GEN(a0, a1, a2, a3, 32) +#define SUB_CRUMBW(a0, a1, a2, a3) SUB_CRUMB_GEN(a0, a1, a2, a3, 64) + + +#if 0 + +#define ROL32W(x, n) SPH_T64( \ + (((x) << (n)) \ + & ~((SPH_C64(0xFFFFFFFF) >> (32 - (n))) << 32)) \ + | (((x) >> (32 - (n))) \ + & ~((SPH_C64(0xFFFFFFFF) >> (n)) << (n)))) + +#define MIX_WORDW(u, v) do { \ + (v) ^= (u); \ + (u) = ROL32W((u), 2) ^ (v); \ + (v) = ROL32W((v), 14) ^ (u); \ + (u) = ROL32W((u), 10) ^ (v); \ + (v) = ROL32W((v), 1); \ + } while (0) + +#endif + +#define MIX_WORDW(u, v) do { \ + sph_u32 ul, uh, vl, vh; \ + (v) ^= (u); \ + ul = SPH_T32((sph_u32)(u)); \ + uh = SPH_T32((sph_u32)((u) >> 32)); \ + vl = SPH_T32((sph_u32)(v)); \ + vh = SPH_T32((sph_u32)((v) >> 32)); \ + ul = SPH_ROTL32(ul, 2) ^ vl; \ + vl = SPH_ROTL32(vl, 14) ^ ul; \ + ul = SPH_ROTL32(ul, 10) ^ vl; \ + vl = SPH_ROTL32(vl, 1); \ + uh = SPH_ROTL32(uh, 2) ^ vh; \ + vh = SPH_ROTL32(vh, 14) ^ uh; \ + uh = SPH_ROTL32(uh, 10) ^ vh; \ + vh = SPH_ROTL32(vh, 1); \ + (u) = (sph_u64)ul | ((sph_u64)uh << 32); \ + (v) = (sph_u64)vl | ((sph_u64)vh << 32); \ + } while (0) + +#else + +#define SUB_CRUMB(a0, a1, a2, a3) do { \ + sph_u32 tmp; \ + tmp = (a0); \ + (a0) |= (a1); \ + (a2) ^= (a3); \ + (a1) = SPH_T32(~(a1)); \ + (a0) ^= (a3); \ + (a3) &= tmp; \ + (a1) ^= (a3); \ + (a3) ^= (a2); \ + (a2) &= (a0); \ + (a0) = SPH_T32(~(a0)); \ + (a2) ^= (a1); \ + (a1) |= (a3); \ + tmp ^= (a1); \ + (a3) ^= (a2); \ + (a2) &= (a1); \ + (a1) ^= (a0); \ + (a0) = tmp; \ + } while (0) + +#endif + +#define MIX_WORD(u, v) do { \ + (v) ^= (u); \ + (u) = SPH_ROTL32((u), 2) ^ (v); \ + (v) = SPH_ROTL32((v), 14) ^ (u); \ + (u) = SPH_ROTL32((u), 10) ^ (v); \ + (v) = SPH_ROTL32((v), 1); \ + } while (0) + +#define DECL_STATE3 \ + sph_u32 V00, V01, V02, V03, V04, V05, V06, V07; \ + sph_u32 V10, V11, V12, V13, V14, V15, V16, V17; \ + sph_u32 V20, V21, V22, V23, V24, V25, V26, V27; + +#define READ_STATE3(state) do { \ + V00 = (state)->V[0][0]; \ + V01 = (state)->V[0][1]; \ + V02 = (state)->V[0][2]; \ + V03 = (state)->V[0][3]; \ + V04 = (state)->V[0][4]; \ + V05 = (state)->V[0][5]; \ + V06 = (state)->V[0][6]; \ + V07 = (state)->V[0][7]; \ + V10 = (state)->V[1][0]; \ + V11 = (state)->V[1][1]; \ + V12 = (state)->V[1][2]; \ + V13 = (state)->V[1][3]; \ + V14 = (state)->V[1][4]; \ + V15 = (state)->V[1][5]; \ + V16 = (state)->V[1][6]; \ + V17 = (state)->V[1][7]; \ + V20 = (state)->V[2][0]; \ + V21 = (state)->V[2][1]; \ + V22 = (state)->V[2][2]; \ + V23 = (state)->V[2][3]; \ + V24 = (state)->V[2][4]; \ + V25 = (state)->V[2][5]; \ + V26 = (state)->V[2][6]; \ + V27 = (state)->V[2][7]; \ + } while (0) + +#define WRITE_STATE3(state) do { \ + (state)->V[0][0] = V00; \ + (state)->V[0][1] = V01; \ + (state)->V[0][2] = V02; \ + (state)->V[0][3] = V03; \ + (state)->V[0][4] = V04; \ + (state)->V[0][5] = V05; \ + (state)->V[0][6] = V06; \ + (state)->V[0][7] = V07; \ + (state)->V[1][0] = V10; \ + (state)->V[1][1] = V11; \ + (state)->V[1][2] = V12; \ + (state)->V[1][3] = V13; \ + (state)->V[1][4] = V14; \ + (state)->V[1][5] = V15; \ + (state)->V[1][6] = V16; \ + (state)->V[1][7] = V17; \ + (state)->V[2][0] = V20; \ + (state)->V[2][1] = V21; \ + (state)->V[2][2] = V22; \ + (state)->V[2][3] = V23; \ + (state)->V[2][4] = V24; \ + (state)->V[2][5] = V25; \ + (state)->V[2][6] = V26; \ + (state)->V[2][7] = V27; \ + } while (0) + +#define MI3 do { \ + DECL_TMP8(M) \ + DECL_TMP8(a) \ + M0 = sph_dec32be_aligned(buf + 0); \ + M1 = sph_dec32be_aligned(buf + 4); \ + M2 = sph_dec32be_aligned(buf + 8); \ + M3 = sph_dec32be_aligned(buf + 12); \ + M4 = sph_dec32be_aligned(buf + 16); \ + M5 = sph_dec32be_aligned(buf + 20); \ + M6 = sph_dec32be_aligned(buf + 24); \ + M7 = sph_dec32be_aligned(buf + 28); \ + XOR(a, V0, V1); \ + XOR(a, a, V2); \ + M2(a, a); \ + XOR(V0, a, V0); \ + XOR(V0, M, V0); \ + M2(M, M); \ + XOR(V1, a, V1); \ + XOR(V1, M, V1); \ + M2(M, M); \ + XOR(V2, a, V2); \ + XOR(V2, M, V2); \ + } while (0) + +#define TWEAK3 do { \ + V14 = SPH_ROTL32(V14, 1); \ + V15 = SPH_ROTL32(V15, 1); \ + V16 = SPH_ROTL32(V16, 1); \ + V17 = SPH_ROTL32(V17, 1); \ + V24 = SPH_ROTL32(V24, 2); \ + V25 = SPH_ROTL32(V25, 2); \ + V26 = SPH_ROTL32(V26, 2); \ + V27 = SPH_ROTL32(V27, 2); \ + } while (0) + +#if SPH_LUFFA_PARALLEL + +#define P3 do { \ + int r; \ + sph_u64 W0, W1, W2, W3, W4, W5, W6, W7; \ + TWEAK3; \ + W0 = (sph_u64)V00 | ((sph_u64)V10 << 32); \ + W1 = (sph_u64)V01 | ((sph_u64)V11 << 32); \ + W2 = (sph_u64)V02 | ((sph_u64)V12 << 32); \ + W3 = (sph_u64)V03 | ((sph_u64)V13 << 32); \ + W4 = (sph_u64)V04 | ((sph_u64)V14 << 32); \ + W5 = (sph_u64)V05 | ((sph_u64)V15 << 32); \ + W6 = (sph_u64)V06 | ((sph_u64)V16 << 32); \ + W7 = (sph_u64)V07 | ((sph_u64)V17 << 32); \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMBW(W0, W1, W2, W3); \ + SUB_CRUMBW(W5, W6, W7, W4); \ + MIX_WORDW(W0, W4); \ + MIX_WORDW(W1, W5); \ + MIX_WORDW(W2, W6); \ + MIX_WORDW(W3, W7); \ + W0 ^= RCW010[r]; \ + W4 ^= RCW014[r]; \ + } \ + V00 = SPH_T32((sph_u32)W0); \ + V10 = SPH_T32((sph_u32)(W0 >> 32)); \ + V01 = SPH_T32((sph_u32)W1); \ + V11 = SPH_T32((sph_u32)(W1 >> 32)); \ + V02 = SPH_T32((sph_u32)W2); \ + V12 = SPH_T32((sph_u32)(W2 >> 32)); \ + V03 = SPH_T32((sph_u32)W3); \ + V13 = SPH_T32((sph_u32)(W3 >> 32)); \ + V04 = SPH_T32((sph_u32)W4); \ + V14 = SPH_T32((sph_u32)(W4 >> 32)); \ + V05 = SPH_T32((sph_u32)W5); \ + V15 = SPH_T32((sph_u32)(W5 >> 32)); \ + V06 = SPH_T32((sph_u32)W6); \ + V16 = SPH_T32((sph_u32)(W6 >> 32)); \ + V07 = SPH_T32((sph_u32)W7); \ + V17 = SPH_T32((sph_u32)(W7 >> 32)); \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V20, V21, V22, V23); \ + SUB_CRUMB(V25, V26, V27, V24); \ + MIX_WORD(V20, V24); \ + MIX_WORD(V21, V25); \ + MIX_WORD(V22, V26); \ + MIX_WORD(V23, V27); \ + V20 ^= RC20[r]; \ + V24 ^= RC24[r]; \ + } \ + } while (0) + +#else + +#define P3 do { \ + int r; \ + TWEAK3; \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V00, V01, V02, V03); \ + SUB_CRUMB(V05, V06, V07, V04); \ + MIX_WORD(V00, V04); \ + MIX_WORD(V01, V05); \ + MIX_WORD(V02, V06); \ + MIX_WORD(V03, V07); \ + V00 ^= RC00[r]; \ + V04 ^= RC04[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V10, V11, V12, V13); \ + SUB_CRUMB(V15, V16, V17, V14); \ + MIX_WORD(V10, V14); \ + MIX_WORD(V11, V15); \ + MIX_WORD(V12, V16); \ + MIX_WORD(V13, V17); \ + V10 ^= RC10[r]; \ + V14 ^= RC14[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V20, V21, V22, V23); \ + SUB_CRUMB(V25, V26, V27, V24); \ + MIX_WORD(V20, V24); \ + MIX_WORD(V21, V25); \ + MIX_WORD(V22, V26); \ + MIX_WORD(V23, V27); \ + V20 ^= RC20[r]; \ + V24 ^= RC24[r]; \ + } \ + } while (0) + +#endif + +#define DECL_STATE4 \ + sph_u32 V00, V01, V02, V03, V04, V05, V06, V07; \ + sph_u32 V10, V11, V12, V13, V14, V15, V16, V17; \ + sph_u32 V20, V21, V22, V23, V24, V25, V26, V27; \ + sph_u32 V30, V31, V32, V33, V34, V35, V36, V37; + +#define READ_STATE4(state) do { \ + V00 = (state)->V[0][0]; \ + V01 = (state)->V[0][1]; \ + V02 = (state)->V[0][2]; \ + V03 = (state)->V[0][3]; \ + V04 = (state)->V[0][4]; \ + V05 = (state)->V[0][5]; \ + V06 = (state)->V[0][6]; \ + V07 = (state)->V[0][7]; \ + V10 = (state)->V[1][0]; \ + V11 = (state)->V[1][1]; \ + V12 = (state)->V[1][2]; \ + V13 = (state)->V[1][3]; \ + V14 = (state)->V[1][4]; \ + V15 = (state)->V[1][5]; \ + V16 = (state)->V[1][6]; \ + V17 = (state)->V[1][7]; \ + V20 = (state)->V[2][0]; \ + V21 = (state)->V[2][1]; \ + V22 = (state)->V[2][2]; \ + V23 = (state)->V[2][3]; \ + V24 = (state)->V[2][4]; \ + V25 = (state)->V[2][5]; \ + V26 = (state)->V[2][6]; \ + V27 = (state)->V[2][7]; \ + V30 = (state)->V[3][0]; \ + V31 = (state)->V[3][1]; \ + V32 = (state)->V[3][2]; \ + V33 = (state)->V[3][3]; \ + V34 = (state)->V[3][4]; \ + V35 = (state)->V[3][5]; \ + V36 = (state)->V[3][6]; \ + V37 = (state)->V[3][7]; \ + } while (0) + +#define WRITE_STATE4(state) do { \ + (state)->V[0][0] = V00; \ + (state)->V[0][1] = V01; \ + (state)->V[0][2] = V02; \ + (state)->V[0][3] = V03; \ + (state)->V[0][4] = V04; \ + (state)->V[0][5] = V05; \ + (state)->V[0][6] = V06; \ + (state)->V[0][7] = V07; \ + (state)->V[1][0] = V10; \ + (state)->V[1][1] = V11; \ + (state)->V[1][2] = V12; \ + (state)->V[1][3] = V13; \ + (state)->V[1][4] = V14; \ + (state)->V[1][5] = V15; \ + (state)->V[1][6] = V16; \ + (state)->V[1][7] = V17; \ + (state)->V[2][0] = V20; \ + (state)->V[2][1] = V21; \ + (state)->V[2][2] = V22; \ + (state)->V[2][3] = V23; \ + (state)->V[2][4] = V24; \ + (state)->V[2][5] = V25; \ + (state)->V[2][6] = V26; \ + (state)->V[2][7] = V27; \ + (state)->V[3][0] = V30; \ + (state)->V[3][1] = V31; \ + (state)->V[3][2] = V32; \ + (state)->V[3][3] = V33; \ + (state)->V[3][4] = V34; \ + (state)->V[3][5] = V35; \ + (state)->V[3][6] = V36; \ + (state)->V[3][7] = V37; \ + } while (0) + +#define MI4 do { \ + DECL_TMP8(M) \ + DECL_TMP8(a) \ + DECL_TMP8(b) \ + M0 = sph_dec32be_aligned(buf + 0); \ + M1 = sph_dec32be_aligned(buf + 4); \ + M2 = sph_dec32be_aligned(buf + 8); \ + M3 = sph_dec32be_aligned(buf + 12); \ + M4 = sph_dec32be_aligned(buf + 16); \ + M5 = sph_dec32be_aligned(buf + 20); \ + M6 = sph_dec32be_aligned(buf + 24); \ + M7 = sph_dec32be_aligned(buf + 28); \ + XOR(a, V0, V1); \ + XOR(b, V2, V3); \ + XOR(a, a, b); \ + M2(a, a); \ + XOR(V0, a, V0); \ + XOR(V1, a, V1); \ + XOR(V2, a, V2); \ + XOR(V3, a, V3); \ + M2(b, V0); \ + XOR(b, b, V3); \ + M2(V3, V3); \ + XOR(V3, V3, V2); \ + M2(V2, V2); \ + XOR(V2, V2, V1); \ + M2(V1, V1); \ + XOR(V1, V1, V0); \ + XOR(V0, b, M); \ + M2(M, M); \ + XOR(V1, V1, M); \ + M2(M, M); \ + XOR(V2, V2, M); \ + M2(M, M); \ + XOR(V3, V3, M); \ + } while (0) + +#define TWEAK4 do { \ + V14 = SPH_ROTL32(V14, 1); \ + V15 = SPH_ROTL32(V15, 1); \ + V16 = SPH_ROTL32(V16, 1); \ + V17 = SPH_ROTL32(V17, 1); \ + V24 = SPH_ROTL32(V24, 2); \ + V25 = SPH_ROTL32(V25, 2); \ + V26 = SPH_ROTL32(V26, 2); \ + V27 = SPH_ROTL32(V27, 2); \ + V34 = SPH_ROTL32(V34, 3); \ + V35 = SPH_ROTL32(V35, 3); \ + V36 = SPH_ROTL32(V36, 3); \ + V37 = SPH_ROTL32(V37, 3); \ + } while (0) + +#if SPH_LUFFA_PARALLEL + +#define P4 do { \ + int r; \ + sph_u64 W0, W1, W2, W3, W4, W5, W6, W7; \ + TWEAK4; \ + W0 = (sph_u64)V00 | ((sph_u64)V10 << 32); \ + W1 = (sph_u64)V01 | ((sph_u64)V11 << 32); \ + W2 = (sph_u64)V02 | ((sph_u64)V12 << 32); \ + W3 = (sph_u64)V03 | ((sph_u64)V13 << 32); \ + W4 = (sph_u64)V04 | ((sph_u64)V14 << 32); \ + W5 = (sph_u64)V05 | ((sph_u64)V15 << 32); \ + W6 = (sph_u64)V06 | ((sph_u64)V16 << 32); \ + W7 = (sph_u64)V07 | ((sph_u64)V17 << 32); \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMBW(W0, W1, W2, W3); \ + SUB_CRUMBW(W5, W6, W7, W4); \ + MIX_WORDW(W0, W4); \ + MIX_WORDW(W1, W5); \ + MIX_WORDW(W2, W6); \ + MIX_WORDW(W3, W7); \ + W0 ^= RCW010[r]; \ + W4 ^= RCW014[r]; \ + } \ + V00 = SPH_T32((sph_u32)W0); \ + V10 = SPH_T32((sph_u32)(W0 >> 32)); \ + V01 = SPH_T32((sph_u32)W1); \ + V11 = SPH_T32((sph_u32)(W1 >> 32)); \ + V02 = SPH_T32((sph_u32)W2); \ + V12 = SPH_T32((sph_u32)(W2 >> 32)); \ + V03 = SPH_T32((sph_u32)W3); \ + V13 = SPH_T32((sph_u32)(W3 >> 32)); \ + V04 = SPH_T32((sph_u32)W4); \ + V14 = SPH_T32((sph_u32)(W4 >> 32)); \ + V05 = SPH_T32((sph_u32)W5); \ + V15 = SPH_T32((sph_u32)(W5 >> 32)); \ + V06 = SPH_T32((sph_u32)W6); \ + V16 = SPH_T32((sph_u32)(W6 >> 32)); \ + V07 = SPH_T32((sph_u32)W7); \ + V17 = SPH_T32((sph_u32)(W7 >> 32)); \ + W0 = (sph_u64)V20 | ((sph_u64)V30 << 32); \ + W1 = (sph_u64)V21 | ((sph_u64)V31 << 32); \ + W2 = (sph_u64)V22 | ((sph_u64)V32 << 32); \ + W3 = (sph_u64)V23 | ((sph_u64)V33 << 32); \ + W4 = (sph_u64)V24 | ((sph_u64)V34 << 32); \ + W5 = (sph_u64)V25 | ((sph_u64)V35 << 32); \ + W6 = (sph_u64)V26 | ((sph_u64)V36 << 32); \ + W7 = (sph_u64)V27 | ((sph_u64)V37 << 32); \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMBW(W0, W1, W2, W3); \ + SUB_CRUMBW(W5, W6, W7, W4); \ + MIX_WORDW(W0, W4); \ + MIX_WORDW(W1, W5); \ + MIX_WORDW(W2, W6); \ + MIX_WORDW(W3, W7); \ + W0 ^= RCW230[r]; \ + W4 ^= RCW234[r]; \ + } \ + V20 = SPH_T32((sph_u32)W0); \ + V30 = SPH_T32((sph_u32)(W0 >> 32)); \ + V21 = SPH_T32((sph_u32)W1); \ + V31 = SPH_T32((sph_u32)(W1 >> 32)); \ + V22 = SPH_T32((sph_u32)W2); \ + V32 = SPH_T32((sph_u32)(W2 >> 32)); \ + V23 = SPH_T32((sph_u32)W3); \ + V33 = SPH_T32((sph_u32)(W3 >> 32)); \ + V24 = SPH_T32((sph_u32)W4); \ + V34 = SPH_T32((sph_u32)(W4 >> 32)); \ + V25 = SPH_T32((sph_u32)W5); \ + V35 = SPH_T32((sph_u32)(W5 >> 32)); \ + V26 = SPH_T32((sph_u32)W6); \ + V36 = SPH_T32((sph_u32)(W6 >> 32)); \ + V27 = SPH_T32((sph_u32)W7); \ + V37 = SPH_T32((sph_u32)(W7 >> 32)); \ + } while (0) + +#else + +#define P4 do { \ + int r; \ + TWEAK4; \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V00, V01, V02, V03); \ + SUB_CRUMB(V05, V06, V07, V04); \ + MIX_WORD(V00, V04); \ + MIX_WORD(V01, V05); \ + MIX_WORD(V02, V06); \ + MIX_WORD(V03, V07); \ + V00 ^= RC00[r]; \ + V04 ^= RC04[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V10, V11, V12, V13); \ + SUB_CRUMB(V15, V16, V17, V14); \ + MIX_WORD(V10, V14); \ + MIX_WORD(V11, V15); \ + MIX_WORD(V12, V16); \ + MIX_WORD(V13, V17); \ + V10 ^= RC10[r]; \ + V14 ^= RC14[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V20, V21, V22, V23); \ + SUB_CRUMB(V25, V26, V27, V24); \ + MIX_WORD(V20, V24); \ + MIX_WORD(V21, V25); \ + MIX_WORD(V22, V26); \ + MIX_WORD(V23, V27); \ + V20 ^= RC20[r]; \ + V24 ^= RC24[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V30, V31, V32, V33); \ + SUB_CRUMB(V35, V36, V37, V34); \ + MIX_WORD(V30, V34); \ + MIX_WORD(V31, V35); \ + MIX_WORD(V32, V36); \ + MIX_WORD(V33, V37); \ + V30 ^= RC30[r]; \ + V34 ^= RC34[r]; \ + } \ + } while (0) + +#endif + +#define DECL_STATE5 \ + sph_u32 V00, V01, V02, V03, V04, V05, V06, V07; \ + sph_u32 V10, V11, V12, V13, V14, V15, V16, V17; \ + sph_u32 V20, V21, V22, V23, V24, V25, V26, V27; \ + sph_u32 V30, V31, V32, V33, V34, V35, V36, V37; \ + sph_u32 V40, V41, V42, V43, V44, V45, V46, V47; + +#define READ_STATE5(state) do { \ + V00 = (state)->V[0][0]; \ + V01 = (state)->V[0][1]; \ + V02 = (state)->V[0][2]; \ + V03 = (state)->V[0][3]; \ + V04 = (state)->V[0][4]; \ + V05 = (state)->V[0][5]; \ + V06 = (state)->V[0][6]; \ + V07 = (state)->V[0][7]; \ + V10 = (state)->V[1][0]; \ + V11 = (state)->V[1][1]; \ + V12 = (state)->V[1][2]; \ + V13 = (state)->V[1][3]; \ + V14 = (state)->V[1][4]; \ + V15 = (state)->V[1][5]; \ + V16 = (state)->V[1][6]; \ + V17 = (state)->V[1][7]; \ + V20 = (state)->V[2][0]; \ + V21 = (state)->V[2][1]; \ + V22 = (state)->V[2][2]; \ + V23 = (state)->V[2][3]; \ + V24 = (state)->V[2][4]; \ + V25 = (state)->V[2][5]; \ + V26 = (state)->V[2][6]; \ + V27 = (state)->V[2][7]; \ + V30 = (state)->V[3][0]; \ + V31 = (state)->V[3][1]; \ + V32 = (state)->V[3][2]; \ + V33 = (state)->V[3][3]; \ + V34 = (state)->V[3][4]; \ + V35 = (state)->V[3][5]; \ + V36 = (state)->V[3][6]; \ + V37 = (state)->V[3][7]; \ + V40 = (state)->V[4][0]; \ + V41 = (state)->V[4][1]; \ + V42 = (state)->V[4][2]; \ + V43 = (state)->V[4][3]; \ + V44 = (state)->V[4][4]; \ + V45 = (state)->V[4][5]; \ + V46 = (state)->V[4][6]; \ + V47 = (state)->V[4][7]; \ + } while (0) + +#define WRITE_STATE5(state) do { \ + (state)->V[0][0] = V00; \ + (state)->V[0][1] = V01; \ + (state)->V[0][2] = V02; \ + (state)->V[0][3] = V03; \ + (state)->V[0][4] = V04; \ + (state)->V[0][5] = V05; \ + (state)->V[0][6] = V06; \ + (state)->V[0][7] = V07; \ + (state)->V[1][0] = V10; \ + (state)->V[1][1] = V11; \ + (state)->V[1][2] = V12; \ + (state)->V[1][3] = V13; \ + (state)->V[1][4] = V14; \ + (state)->V[1][5] = V15; \ + (state)->V[1][6] = V16; \ + (state)->V[1][7] = V17; \ + (state)->V[2][0] = V20; \ + (state)->V[2][1] = V21; \ + (state)->V[2][2] = V22; \ + (state)->V[2][3] = V23; \ + (state)->V[2][4] = V24; \ + (state)->V[2][5] = V25; \ + (state)->V[2][6] = V26; \ + (state)->V[2][7] = V27; \ + (state)->V[3][0] = V30; \ + (state)->V[3][1] = V31; \ + (state)->V[3][2] = V32; \ + (state)->V[3][3] = V33; \ + (state)->V[3][4] = V34; \ + (state)->V[3][5] = V35; \ + (state)->V[3][6] = V36; \ + (state)->V[3][7] = V37; \ + (state)->V[4][0] = V40; \ + (state)->V[4][1] = V41; \ + (state)->V[4][2] = V42; \ + (state)->V[4][3] = V43; \ + (state)->V[4][4] = V44; \ + (state)->V[4][5] = V45; \ + (state)->V[4][6] = V46; \ + (state)->V[4][7] = V47; \ + } while (0) + +#define MI5 do { \ + DECL_TMP8(M) \ + DECL_TMP8(a) \ + DECL_TMP8(b) \ + M0 = sph_dec32be_aligned(buf + 0); \ + M1 = sph_dec32be_aligned(buf + 4); \ + M2 = sph_dec32be_aligned(buf + 8); \ + M3 = sph_dec32be_aligned(buf + 12); \ + M4 = sph_dec32be_aligned(buf + 16); \ + M5 = sph_dec32be_aligned(buf + 20); \ + M6 = sph_dec32be_aligned(buf + 24); \ + M7 = sph_dec32be_aligned(buf + 28); \ + XOR(a, V0, V1); \ + XOR(b, V2, V3); \ + XOR(a, a, b); \ + XOR(a, a, V4); \ + M2(a, a); \ + XOR(V0, a, V0); \ + XOR(V1, a, V1); \ + XOR(V2, a, V2); \ + XOR(V3, a, V3); \ + XOR(V4, a, V4); \ + M2(b, V0); \ + XOR(b, b, V1); \ + M2(V1, V1); \ + XOR(V1, V1, V2); \ + M2(V2, V2); \ + XOR(V2, V2, V3); \ + M2(V3, V3); \ + XOR(V3, V3, V4); \ + M2(V4, V4); \ + XOR(V4, V4, V0); \ + M2(V0, b); \ + XOR(V0, V0, V4); \ + M2(V4, V4); \ + XOR(V4, V4, V3); \ + M2(V3, V3); \ + XOR(V3, V3, V2); \ + M2(V2, V2); \ + XOR(V2, V2, V1); \ + M2(V1, V1); \ + XOR(V1, V1, b); \ + XOR(V0, V0, M); \ + M2(M, M); \ + XOR(V1, V1, M); \ + M2(M, M); \ + XOR(V2, V2, M); \ + M2(M, M); \ + XOR(V3, V3, M); \ + M2(M, M); \ + XOR(V4, V4, M); \ + } while (0) + +#define TWEAK5 do { \ + V14 = SPH_ROTL32(V14, 1); \ + V15 = SPH_ROTL32(V15, 1); \ + V16 = SPH_ROTL32(V16, 1); \ + V17 = SPH_ROTL32(V17, 1); \ + V24 = SPH_ROTL32(V24, 2); \ + V25 = SPH_ROTL32(V25, 2); \ + V26 = SPH_ROTL32(V26, 2); \ + V27 = SPH_ROTL32(V27, 2); \ + V34 = SPH_ROTL32(V34, 3); \ + V35 = SPH_ROTL32(V35, 3); \ + V36 = SPH_ROTL32(V36, 3); \ + V37 = SPH_ROTL32(V37, 3); \ + V44 = SPH_ROTL32(V44, 4); \ + V45 = SPH_ROTL32(V45, 4); \ + V46 = SPH_ROTL32(V46, 4); \ + V47 = SPH_ROTL32(V47, 4); \ + } while (0) + +#if SPH_LUFFA_PARALLEL + +#define P5 do { \ + int r; \ + sph_u64 W0, W1, W2, W3, W4, W5, W6, W7; \ + TWEAK5; \ + W0 = (sph_u64)V00 | ((sph_u64)V10 << 32); \ + W1 = (sph_u64)V01 | ((sph_u64)V11 << 32); \ + W2 = (sph_u64)V02 | ((sph_u64)V12 << 32); \ + W3 = (sph_u64)V03 | ((sph_u64)V13 << 32); \ + W4 = (sph_u64)V04 | ((sph_u64)V14 << 32); \ + W5 = (sph_u64)V05 | ((sph_u64)V15 << 32); \ + W6 = (sph_u64)V06 | ((sph_u64)V16 << 32); \ + W7 = (sph_u64)V07 | ((sph_u64)V17 << 32); \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMBW(W0, W1, W2, W3); \ + SUB_CRUMBW(W5, W6, W7, W4); \ + MIX_WORDW(W0, W4); \ + MIX_WORDW(W1, W5); \ + MIX_WORDW(W2, W6); \ + MIX_WORDW(W3, W7); \ + W0 ^= RCW010[r]; \ + W4 ^= RCW014[r]; \ + } \ + V00 = SPH_T32((sph_u32)W0); \ + V10 = SPH_T32((sph_u32)(W0 >> 32)); \ + V01 = SPH_T32((sph_u32)W1); \ + V11 = SPH_T32((sph_u32)(W1 >> 32)); \ + V02 = SPH_T32((sph_u32)W2); \ + V12 = SPH_T32((sph_u32)(W2 >> 32)); \ + V03 = SPH_T32((sph_u32)W3); \ + V13 = SPH_T32((sph_u32)(W3 >> 32)); \ + V04 = SPH_T32((sph_u32)W4); \ + V14 = SPH_T32((sph_u32)(W4 >> 32)); \ + V05 = SPH_T32((sph_u32)W5); \ + V15 = SPH_T32((sph_u32)(W5 >> 32)); \ + V06 = SPH_T32((sph_u32)W6); \ + V16 = SPH_T32((sph_u32)(W6 >> 32)); \ + V07 = SPH_T32((sph_u32)W7); \ + V17 = SPH_T32((sph_u32)(W7 >> 32)); \ + W0 = (sph_u64)V20 | ((sph_u64)V30 << 32); \ + W1 = (sph_u64)V21 | ((sph_u64)V31 << 32); \ + W2 = (sph_u64)V22 | ((sph_u64)V32 << 32); \ + W3 = (sph_u64)V23 | ((sph_u64)V33 << 32); \ + W4 = (sph_u64)V24 | ((sph_u64)V34 << 32); \ + W5 = (sph_u64)V25 | ((sph_u64)V35 << 32); \ + W6 = (sph_u64)V26 | ((sph_u64)V36 << 32); \ + W7 = (sph_u64)V27 | ((sph_u64)V37 << 32); \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMBW(W0, W1, W2, W3); \ + SUB_CRUMBW(W5, W6, W7, W4); \ + MIX_WORDW(W0, W4); \ + MIX_WORDW(W1, W5); \ + MIX_WORDW(W2, W6); \ + MIX_WORDW(W3, W7); \ + W0 ^= RCW230[r]; \ + W4 ^= RCW234[r]; \ + } \ + V20 = SPH_T32((sph_u32)W0); \ + V30 = SPH_T32((sph_u32)(W0 >> 32)); \ + V21 = SPH_T32((sph_u32)W1); \ + V31 = SPH_T32((sph_u32)(W1 >> 32)); \ + V22 = SPH_T32((sph_u32)W2); \ + V32 = SPH_T32((sph_u32)(W2 >> 32)); \ + V23 = SPH_T32((sph_u32)W3); \ + V33 = SPH_T32((sph_u32)(W3 >> 32)); \ + V24 = SPH_T32((sph_u32)W4); \ + V34 = SPH_T32((sph_u32)(W4 >> 32)); \ + V25 = SPH_T32((sph_u32)W5); \ + V35 = SPH_T32((sph_u32)(W5 >> 32)); \ + V26 = SPH_T32((sph_u32)W6); \ + V36 = SPH_T32((sph_u32)(W6 >> 32)); \ + V27 = SPH_T32((sph_u32)W7); \ + V37 = SPH_T32((sph_u32)(W7 >> 32)); \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V40, V41, V42, V43); \ + SUB_CRUMB(V45, V46, V47, V44); \ + MIX_WORD(V40, V44); \ + MIX_WORD(V41, V45); \ + MIX_WORD(V42, V46); \ + MIX_WORD(V43, V47); \ + V40 ^= RC40[r]; \ + V44 ^= RC44[r]; \ + } \ + } while (0) + +#else + +#define P5 do { \ + int r; \ + TWEAK5; \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V00, V01, V02, V03); \ + SUB_CRUMB(V05, V06, V07, V04); \ + MIX_WORD(V00, V04); \ + MIX_WORD(V01, V05); \ + MIX_WORD(V02, V06); \ + MIX_WORD(V03, V07); \ + V00 ^= RC00[r]; \ + V04 ^= RC04[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V10, V11, V12, V13); \ + SUB_CRUMB(V15, V16, V17, V14); \ + MIX_WORD(V10, V14); \ + MIX_WORD(V11, V15); \ + MIX_WORD(V12, V16); \ + MIX_WORD(V13, V17); \ + V10 ^= RC10[r]; \ + V14 ^= RC14[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V20, V21, V22, V23); \ + SUB_CRUMB(V25, V26, V27, V24); \ + MIX_WORD(V20, V24); \ + MIX_WORD(V21, V25); \ + MIX_WORD(V22, V26); \ + MIX_WORD(V23, V27); \ + V20 ^= RC20[r]; \ + V24 ^= RC24[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V30, V31, V32, V33); \ + SUB_CRUMB(V35, V36, V37, V34); \ + MIX_WORD(V30, V34); \ + MIX_WORD(V31, V35); \ + MIX_WORD(V32, V36); \ + MIX_WORD(V33, V37); \ + V30 ^= RC30[r]; \ + V34 ^= RC34[r]; \ + } \ + for (r = 0; r < 8; r ++) { \ + SUB_CRUMB(V40, V41, V42, V43); \ + SUB_CRUMB(V45, V46, V47, V44); \ + MIX_WORD(V40, V44); \ + MIX_WORD(V41, V45); \ + MIX_WORD(V42, V46); \ + MIX_WORD(V43, V47); \ + V40 ^= RC40[r]; \ + V44 ^= RC44[r]; \ + } \ + } while (0) + +#endif + +static void +luffa3(sph_luffa224_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE3 + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE3(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + MI3; + P3; + ptr = 0; + } + } + WRITE_STATE3(sc); + sc->ptr = ptr; +} + +static void +luffa3_close(sph_luffa224_context *sc, unsigned ub, unsigned n, + void *dst, unsigned out_size_w32) +{ + unsigned char *buf, *out; + size_t ptr; + unsigned z; + int i; + DECL_STATE3 + + buf = sc->buf; + ptr = sc->ptr; + z = 0x80 >> n; + buf[ptr ++] = ((ub & -z) | z) & 0xFF; + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + READ_STATE3(sc); + for (i = 0; i < 2; i ++) { + MI3; + P3; + memset(buf, 0, sizeof sc->buf); + } + out = dst; + sph_enc32be(out + 0, V00 ^ V10 ^ V20); + sph_enc32be(out + 4, V01 ^ V11 ^ V21); + sph_enc32be(out + 8, V02 ^ V12 ^ V22); + sph_enc32be(out + 12, V03 ^ V13 ^ V23); + sph_enc32be(out + 16, V04 ^ V14 ^ V24); + sph_enc32be(out + 20, V05 ^ V15 ^ V25); + sph_enc32be(out + 24, V06 ^ V16 ^ V26); + if (out_size_w32 > 7) + sph_enc32be(out + 28, V07 ^ V17 ^ V27); +} + +static void +luffa4(sph_luffa384_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE4 + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE4(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + MI4; + P4; + ptr = 0; + } + } + WRITE_STATE4(sc); + sc->ptr = ptr; +} + +static void +luffa4_close(sph_luffa384_context *sc, unsigned ub, unsigned n, void *dst) +{ + unsigned char *buf, *out; + size_t ptr; + unsigned z; + int i; + DECL_STATE4 + + buf = sc->buf; + ptr = sc->ptr; + out = dst; + z = 0x80 >> n; + buf[ptr ++] = ((ub & -z) | z) & 0xFF; + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + READ_STATE4(sc); + for (i = 0; i < 3; i ++) { + MI4; + P4; + switch (i) { + case 0: + memset(buf, 0, sizeof sc->buf); + break; + case 1: + sph_enc32be(out + 0, V00 ^ V10 ^ V20 ^ V30); + sph_enc32be(out + 4, V01 ^ V11 ^ V21 ^ V31); + sph_enc32be(out + 8, V02 ^ V12 ^ V22 ^ V32); + sph_enc32be(out + 12, V03 ^ V13 ^ V23 ^ V33); + sph_enc32be(out + 16, V04 ^ V14 ^ V24 ^ V34); + sph_enc32be(out + 20, V05 ^ V15 ^ V25 ^ V35); + sph_enc32be(out + 24, V06 ^ V16 ^ V26 ^ V36); + sph_enc32be(out + 28, V07 ^ V17 ^ V27 ^ V37); + break; + case 2: + sph_enc32be(out + 32, V00 ^ V10 ^ V20 ^ V30); + sph_enc32be(out + 36, V01 ^ V11 ^ V21 ^ V31); + sph_enc32be(out + 40, V02 ^ V12 ^ V22 ^ V32); + sph_enc32be(out + 44, V03 ^ V13 ^ V23 ^ V33); + break; + } + } +} + +static void +luffa5(sph_luffa512_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + DECL_STATE5 + + buf = sc->buf; + ptr = sc->ptr; + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE5(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + if (ptr == sizeof sc->buf) { + MI5; + P5; + ptr = 0; + } + } + WRITE_STATE5(sc); + sc->ptr = ptr; +} + +static void +luffa5_close(sph_luffa512_context *sc, unsigned ub, unsigned n, void *dst) +{ + unsigned char *buf, *out; + size_t ptr; + unsigned z; + int i; + DECL_STATE5 + + buf = sc->buf; + ptr = sc->ptr; + out = dst; + z = 0x80 >> n; + buf[ptr ++] = ((ub & -z) | z) & 0xFF; + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + READ_STATE5(sc); + for (i = 0; i < 3; i ++) { + MI5; + P5; + switch (i) { + case 0: + memset(buf, 0, sizeof sc->buf); + break; + case 1: + sph_enc32be(out + 0, V00 ^ V10 ^ V20 ^ V30 ^ V40); + sph_enc32be(out + 4, V01 ^ V11 ^ V21 ^ V31 ^ V41); + sph_enc32be(out + 8, V02 ^ V12 ^ V22 ^ V32 ^ V42); + sph_enc32be(out + 12, V03 ^ V13 ^ V23 ^ V33 ^ V43); + sph_enc32be(out + 16, V04 ^ V14 ^ V24 ^ V34 ^ V44); + sph_enc32be(out + 20, V05 ^ V15 ^ V25 ^ V35 ^ V45); + sph_enc32be(out + 24, V06 ^ V16 ^ V26 ^ V36 ^ V46); + sph_enc32be(out + 28, V07 ^ V17 ^ V27 ^ V37 ^ V47); + break; + case 2: + sph_enc32be(out + 32, V00 ^ V10 ^ V20 ^ V30 ^ V40); + sph_enc32be(out + 36, V01 ^ V11 ^ V21 ^ V31 ^ V41); + sph_enc32be(out + 40, V02 ^ V12 ^ V22 ^ V32 ^ V42); + sph_enc32be(out + 44, V03 ^ V13 ^ V23 ^ V33 ^ V43); + sph_enc32be(out + 48, V04 ^ V14 ^ V24 ^ V34 ^ V44); + sph_enc32be(out + 52, V05 ^ V15 ^ V25 ^ V35 ^ V45); + sph_enc32be(out + 56, V06 ^ V16 ^ V26 ^ V36 ^ V46); + sph_enc32be(out + 60, V07 ^ V17 ^ V27 ^ V37 ^ V47); + break; + } + } +} + +/* see sph_luffa.h */ +void +sph_luffa224_init(void *cc) +{ + sph_luffa224_context *sc; + + sc = cc; + memcpy(sc->V, V_INIT, sizeof(sc->V)); + sc->ptr = 0; +} + +/* see sph_luffa.h */ +void +sph_luffa224(void *cc, const void *data, size_t len) +{ + luffa3(cc, data, len); +} + +/* see sph_luffa.h */ +void +sph_luffa224_close(void *cc, void *dst) +{ + sph_luffa224_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_luffa.h */ +void +sph_luffa224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + luffa3_close(cc, ub, n, dst, 7); + sph_luffa224_init(cc); +} + +/* see sph_luffa.h */ +void +sph_luffa256_init(void *cc) +{ + sph_luffa256_context *sc; + + sc = cc; + memcpy(sc->V, V_INIT, sizeof(sc->V)); + sc->ptr = 0; +} + +/* see sph_luffa.h */ +void +sph_luffa256(void *cc, const void *data, size_t len) +{ + luffa3(cc, data, len); +} + +/* see sph_luffa.h */ +void +sph_luffa256_close(void *cc, void *dst) +{ + sph_luffa256_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_luffa.h */ +void +sph_luffa256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + luffa3_close(cc, ub, n, dst, 8); + sph_luffa256_init(cc); +} + +/* see sph_luffa.h */ +void +sph_luffa384_init(void *cc) +{ + sph_luffa384_context *sc; + + sc = cc; + memcpy(sc->V, V_INIT, sizeof(sc->V)); + sc->ptr = 0; +} + +/* see sph_luffa.h */ +void +sph_luffa384(void *cc, const void *data, size_t len) +{ + luffa4(cc, data, len); +} + +/* see sph_luffa.h */ +void +sph_luffa384_close(void *cc, void *dst) +{ + sph_luffa384_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_luffa.h */ +void +sph_luffa384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + luffa4_close(cc, ub, n, dst); + sph_luffa384_init(cc); +} + +/* see sph_luffa.h */ +void +sph_luffa512_init(void *cc) +{ + sph_luffa512_context *sc; + + sc = cc; + memcpy(sc->V, V_INIT, sizeof(sc->V)); + sc->ptr = 0; +} + +/* see sph_luffa.h */ +void +sph_luffa512(void *cc, const void *data, size_t len) +{ + luffa5(cc, data, len); +} + +/* see sph_luffa.h */ +void +sph_luffa512_close(void *cc, void *dst) +{ + sph_luffa512_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_luffa.h */ +void +sph_luffa512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + luffa5_close(cc, ub, n, dst); + sph_luffa512_init(cc); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/sph/md_helper.c b/sph/md_helper.c new file mode 100644 index 0000000..5384f03 --- /dev/null +++ b/sph/md_helper.c @@ -0,0 +1,346 @@ +/* $Id: md_helper.c 216 2010-06-08 09:46:57Z tp $ */ +/* + * This file contains some functions which implement the external data + * handling and padding for Merkle-Damgard hash functions which follow + * the conventions set out by MD4 (little-endian) or SHA-1 (big-endian). + * + * API: this file is meant to be included, not compiled as a stand-alone + * file. Some macros must be defined: + * RFUN name for the round function + * HASH "short name" for the hash function + * BE32 defined for big-endian, 32-bit based (e.g. SHA-1) + * LE32 defined for little-endian, 32-bit based (e.g. MD5) + * BE64 defined for big-endian, 64-bit based (e.g. SHA-512) + * LE64 defined for little-endian, 64-bit based (no example yet) + * PW01 if defined, append 0x01 instead of 0x80 (for Tiger) + * BLEN if defined, length of a message block (in bytes) + * PLW1 if defined, length is defined on one 64-bit word only (for Tiger) + * PLW4 if defined, length is defined on four 64-bit words (for WHIRLPOOL) + * SVAL if defined, reference to the context state information + * + * BLEN is used when a message block is not 16 (32-bit or 64-bit) words: + * this is used for instance for Tiger, which works on 64-bit words but + * uses 512-bit message blocks (eight 64-bit words). PLW1 and PLW4 are + * ignored if 32-bit words are used; if 64-bit words are used and PLW1 is + * set, then only one word (64 bits) will be used to encode the input + * message length (in bits), otherwise two words will be used (as in + * SHA-384 and SHA-512). If 64-bit words are used and PLW4 is defined (but + * not PLW1), four 64-bit words will be used to encode the message length + * (in bits). Note that regardless of those settings, only 64-bit message + * lengths are supported (in bits): messages longer than 2 Exabytes will be + * improperly hashed (this is unlikely to happen soon: 2 Exabytes is about + * 2 millions Terabytes, which is huge). + * + * If CLOSE_ONLY is defined, then this file defines only the sph_XXX_close() + * function. This is used for Tiger2, which is identical to Tiger except + * when it comes to the padding (Tiger2 uses the standard 0x80 byte instead + * of the 0x01 from original Tiger). + * + * The RFUN function is invoked with two arguments, the first pointing to + * aligned data (as a "const void *"), the second being state information + * from the context structure. By default, this state information is the + * "val" field from the context, and this field is assumed to be an array + * of words ("sph_u32" or "sph_u64", depending on BE32/LE32/BE64/LE64). + * from the context structure. The "val" field can have any type, except + * for the output encoding which assumes that it is an array of "sph_u32" + * values. By defining NO_OUTPUT, this last step is deactivated; the + * includer code is then responsible for writing out the hash result. When + * NO_OUTPUT is defined, the third parameter to the "close()" function is + * ignored. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +#undef SPH_XCAT +#define SPH_XCAT(a, b) SPH_XCAT_(a, b) +#undef SPH_XCAT_ +#define SPH_XCAT_(a, b) a ## b + +#undef SPH_BLEN +#undef SPH_WLEN +#if defined BE64 || defined LE64 +#define SPH_BLEN 128U +#define SPH_WLEN 8U +#else +#define SPH_BLEN 64U +#define SPH_WLEN 4U +#endif + +#ifdef BLEN +#undef SPH_BLEN +#define SPH_BLEN BLEN +#endif + +#undef SPH_MAXPAD +#if defined PLW1 +#define SPH_MAXPAD (SPH_BLEN - SPH_WLEN) +#elif defined PLW4 +#define SPH_MAXPAD (SPH_BLEN - (SPH_WLEN << 2)) +#else +#define SPH_MAXPAD (SPH_BLEN - (SPH_WLEN << 1)) +#endif + +#undef SPH_VAL +#undef SPH_NO_OUTPUT +#ifdef SVAL +#define SPH_VAL SVAL +#define SPH_NO_OUTPUT 1 +#else +#define SPH_VAL sc->val +#endif + +#ifndef CLOSE_ONLY + +#ifdef SPH_UPTR +static void +SPH_XCAT(HASH, _short)(void *cc, const void *data, size_t len) +#else +void +SPH_XCAT(sph_, HASH)(void *cc, const void *data, size_t len) +#endif +{ + SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc; + unsigned current; + + sc = cc; +#if SPH_64 + current = (unsigned)sc->count & (SPH_BLEN - 1U); +#else + current = (unsigned)sc->count_low & (SPH_BLEN - 1U); +#endif + while (len > 0) { + unsigned clen; +#if !SPH_64 + sph_u32 clow, clow2; +#endif + + clen = SPH_BLEN - current; + if (clen > len) + clen = len; + memcpy(sc->buf + current, data, clen); + data = (const unsigned char *)data + clen; + current += clen; + len -= clen; + if (current == SPH_BLEN) { + RFUN(sc->buf, SPH_VAL); + current = 0; + } +#if SPH_64 + sc->count += clen; +#else + clow = sc->count_low; + clow2 = SPH_T32(clow + clen); + sc->count_low = clow2; + if (clow2 < clow) + sc->count_high ++; +#endif + } +} + +#ifdef SPH_UPTR +void +SPH_XCAT(sph_, HASH)(void *cc, const void *data, size_t len) +{ + SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc; + unsigned current; + size_t orig_len; +#if !SPH_64 + sph_u32 clow, clow2; +#endif + + if (len < (2 * SPH_BLEN)) { + SPH_XCAT(HASH, _short)(cc, data, len); + return; + } + sc = cc; +#if SPH_64 + current = (unsigned)sc->count & (SPH_BLEN - 1U); +#else + current = (unsigned)sc->count_low & (SPH_BLEN - 1U); +#endif + if (current > 0) { + unsigned t; + + t = SPH_BLEN - current; + SPH_XCAT(HASH, _short)(cc, data, t); + data = (const unsigned char *)data + t; + len -= t; + } +#if !SPH_UNALIGNED + if (((SPH_UPTR)data & (SPH_WLEN - 1U)) != 0) { + SPH_XCAT(HASH, _short)(cc, data, len); + return; + } +#endif + orig_len = len; + while (len >= SPH_BLEN) { + RFUN(data, SPH_VAL); + len -= SPH_BLEN; + data = (const unsigned char *)data + SPH_BLEN; + } + if (len > 0) + memcpy(sc->buf, data, len); +#if SPH_64 + sc->count += (sph_u64)orig_len; +#else + clow = sc->count_low; + clow2 = SPH_T32(clow + orig_len); + sc->count_low = clow2; + if (clow2 < clow) + sc->count_high ++; + /* + * This code handles the improbable situation where "size_t" is + * greater than 32 bits, and yet we do not have a 64-bit type. + */ + orig_len >>= 12; + orig_len >>= 10; + orig_len >>= 10; + sc->count_high += orig_len; +#endif +} +#endif + +#endif + +/* + * Perform padding and produce result. The context is NOT reinitialized + * by this function. + */ +static void +SPH_XCAT(HASH, _addbits_and_close)(void *cc, + unsigned ub, unsigned n, void *dst, unsigned rnum) +{ + SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc; + unsigned current, u; +#if !SPH_64 + sph_u32 low, high; +#endif + + sc = cc; +#if SPH_64 + current = (unsigned)sc->count & (SPH_BLEN - 1U); +#else + current = (unsigned)sc->count_low & (SPH_BLEN - 1U); +#endif +#ifdef PW01 + sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n); +#else + { + unsigned z; + + z = 0x80 >> n; + sc->buf[current ++] = ((ub & -z) | z) & 0xFF; + } +#endif + if (current > SPH_MAXPAD) { + memset(sc->buf + current, 0, SPH_BLEN - current); + RFUN(sc->buf, SPH_VAL); + memset(sc->buf, 0, SPH_MAXPAD); + } else { + memset(sc->buf + current, 0, SPH_MAXPAD - current); + } +#if defined BE64 +#if defined PLW1 + sph_enc64be_aligned(sc->buf + SPH_MAXPAD, + SPH_T64(sc->count << 3) + (sph_u64)n); +#elif defined PLW4 + memset(sc->buf + SPH_MAXPAD, 0, 2 * SPH_WLEN); + sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN, + sc->count >> 61); + sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 3 * SPH_WLEN, + SPH_T64(sc->count << 3) + (sph_u64)n); +#else + sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61); + sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, + SPH_T64(sc->count << 3) + (sph_u64)n); +#endif +#elif defined LE64 +#if defined PLW1 + sph_enc64le_aligned(sc->buf + SPH_MAXPAD, + SPH_T64(sc->count << 3) + (sph_u64)n); +#elif defined PLW1 + sph_enc64le_aligned(sc->buf + SPH_MAXPAD, + SPH_T64(sc->count << 3) + (sph_u64)n); + sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61); + memset(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN, 0, 2 * SPH_WLEN); +#else + sph_enc64le_aligned(sc->buf + SPH_MAXPAD, + SPH_T64(sc->count << 3) + (sph_u64)n); + sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61); +#endif +#else +#if SPH_64 +#ifdef BE32 + sph_enc64be_aligned(sc->buf + SPH_MAXPAD, + SPH_T64(sc->count << 3) + (sph_u64)n); +#else + sph_enc64le_aligned(sc->buf + SPH_MAXPAD, + SPH_T64(sc->count << 3) + (sph_u64)n); +#endif +#else + low = sc->count_low; + high = SPH_T32((sc->count_high << 3) | (low >> 29)); + low = SPH_T32(low << 3) + (sph_u32)n; +#ifdef BE32 + sph_enc32be(sc->buf + SPH_MAXPAD, high); + sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low); +#else + sph_enc32le(sc->buf + SPH_MAXPAD, low); + sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high); +#endif +#endif +#endif + RFUN(sc->buf, SPH_VAL); +#ifdef SPH_NO_OUTPUT + (void)dst; + (void)rnum; + (void)u; +#else + for (u = 0; u < rnum; u ++) { +#if defined BE64 + sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]); +#elif defined LE64 + sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]); +#elif defined BE32 + sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]); +#else + sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]); +#endif + } +#endif +} + +static void +SPH_XCAT(HASH, _close)(void *cc, void *dst, unsigned rnum) +{ + SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum); +} diff --git a/sph/ripemd.c b/sph/ripemd.c new file mode 100644 index 0000000..dd12b1f --- /dev/null +++ b/sph/ripemd.c @@ -0,0 +1,833 @@ +/* $Id: ripemd.c 216 2010-06-08 09:46:57Z tp $ */ +/* + * RIPEMD-160 implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_ripemd.h" + +/* + * Round functions for RIPEMD (original). + */ +#define F(x, y, z) ((((y) ^ (z)) & (x)) ^ (z)) +#define G(x, y, z) (((x) & (y)) | (((x) | (y)) & (z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) + +static const sph_u32 oIV[5] = { + SPH_C32(0x67452301), SPH_C32(0xEFCDAB89), + SPH_C32(0x98BADCFE), SPH_C32(0x10325476) +}; + +/* + * Round functions for RIPEMD-128 and RIPEMD-160. + */ +#define F1(x, y, z) ((x) ^ (y) ^ (z)) +#define F2(x, y, z) ((((y) ^ (z)) & (x)) ^ (z)) +#define F3(x, y, z) (((x) | ~(y)) ^ (z)) +#define F4(x, y, z) ((((x) ^ (y)) & (z)) ^ (y)) +#define F5(x, y, z) ((x) ^ ((y) | ~(z))) + +static const sph_u32 IV[5] = { + SPH_C32(0x67452301), SPH_C32(0xEFCDAB89), SPH_C32(0x98BADCFE), + SPH_C32(0x10325476), SPH_C32(0xC3D2E1F0) +}; + +#define ROTL SPH_ROTL32 + +/* ===================================================================== */ +/* + * RIPEMD (original hash, deprecated). + */ + +#define FF1(A, B, C, D, X, s) do { \ + sph_u32 tmp = SPH_T32((A) + F(B, C, D) + (X)); \ + (A) = ROTL(tmp, (s)); \ + } while (0) + +#define GG1(A, B, C, D, X, s) do { \ + sph_u32 tmp = SPH_T32((A) + G(B, C, D) \ + + (X) + SPH_C32(0x5A827999)); \ + (A) = ROTL(tmp, (s)); \ + } while (0) + +#define HH1(A, B, C, D, X, s) do { \ + sph_u32 tmp = SPH_T32((A) + H(B, C, D) \ + + (X) + SPH_C32(0x6ED9EBA1)); \ + (A) = ROTL(tmp, (s)); \ + } while (0) + +#define FF2(A, B, C, D, X, s) do { \ + sph_u32 tmp = SPH_T32((A) + F(B, C, D) \ + + (X) + SPH_C32(0x50A28BE6)); \ + (A) = ROTL(tmp, (s)); \ + } while (0) + +#define GG2(A, B, C, D, X, s) do { \ + sph_u32 tmp = SPH_T32((A) + G(B, C, D) + (X)); \ + (A) = ROTL(tmp, (s)); \ + } while (0) + +#define HH2(A, B, C, D, X, s) do { \ + sph_u32 tmp = SPH_T32((A) + H(B, C, D) \ + + (X) + SPH_C32(0x5C4DD124)); \ + (A) = ROTL(tmp, (s)); \ + } while (0) + +#define RIPEMD_ROUND_BODY(in, h) do { \ + sph_u32 A1, B1, C1, D1; \ + sph_u32 A2, B2, C2, D2; \ + sph_u32 tmp; \ + \ + A1 = A2 = (h)[0]; \ + B1 = B2 = (h)[1]; \ + C1 = C2 = (h)[2]; \ + D1 = D2 = (h)[3]; \ + \ + FF1(A1, B1, C1, D1, in( 0), 11); \ + FF1(D1, A1, B1, C1, in( 1), 14); \ + FF1(C1, D1, A1, B1, in( 2), 15); \ + FF1(B1, C1, D1, A1, in( 3), 12); \ + FF1(A1, B1, C1, D1, in( 4), 5); \ + FF1(D1, A1, B1, C1, in( 5), 8); \ + FF1(C1, D1, A1, B1, in( 6), 7); \ + FF1(B1, C1, D1, A1, in( 7), 9); \ + FF1(A1, B1, C1, D1, in( 8), 11); \ + FF1(D1, A1, B1, C1, in( 9), 13); \ + FF1(C1, D1, A1, B1, in(10), 14); \ + FF1(B1, C1, D1, A1, in(11), 15); \ + FF1(A1, B1, C1, D1, in(12), 6); \ + FF1(D1, A1, B1, C1, in(13), 7); \ + FF1(C1, D1, A1, B1, in(14), 9); \ + FF1(B1, C1, D1, A1, in(15), 8); \ + \ + GG1(A1, B1, C1, D1, in( 7), 7); \ + GG1(D1, A1, B1, C1, in( 4), 6); \ + GG1(C1, D1, A1, B1, in(13), 8); \ + GG1(B1, C1, D1, A1, in( 1), 13); \ + GG1(A1, B1, C1, D1, in(10), 11); \ + GG1(D1, A1, B1, C1, in( 6), 9); \ + GG1(C1, D1, A1, B1, in(15), 7); \ + GG1(B1, C1, D1, A1, in( 3), 15); \ + GG1(A1, B1, C1, D1, in(12), 7); \ + GG1(D1, A1, B1, C1, in( 0), 12); \ + GG1(C1, D1, A1, B1, in( 9), 15); \ + GG1(B1, C1, D1, A1, in( 5), 9); \ + GG1(A1, B1, C1, D1, in(14), 7); \ + GG1(D1, A1, B1, C1, in( 2), 11); \ + GG1(C1, D1, A1, B1, in(11), 13); \ + GG1(B1, C1, D1, A1, in( 8), 12); \ + \ + HH1(A1, B1, C1, D1, in( 3), 11); \ + HH1(D1, A1, B1, C1, in(10), 13); \ + HH1(C1, D1, A1, B1, in( 2), 14); \ + HH1(B1, C1, D1, A1, in( 4), 7); \ + HH1(A1, B1, C1, D1, in( 9), 14); \ + HH1(D1, A1, B1, C1, in(15), 9); \ + HH1(C1, D1, A1, B1, in( 8), 13); \ + HH1(B1, C1, D1, A1, in( 1), 15); \ + HH1(A1, B1, C1, D1, in(14), 6); \ + HH1(D1, A1, B1, C1, in( 7), 8); \ + HH1(C1, D1, A1, B1, in( 0), 13); \ + HH1(B1, C1, D1, A1, in( 6), 6); \ + HH1(A1, B1, C1, D1, in(11), 12); \ + HH1(D1, A1, B1, C1, in(13), 5); \ + HH1(C1, D1, A1, B1, in( 5), 7); \ + HH1(B1, C1, D1, A1, in(12), 5); \ + \ + FF2(A2, B2, C2, D2, in( 0), 11); \ + FF2(D2, A2, B2, C2, in( 1), 14); \ + FF2(C2, D2, A2, B2, in( 2), 15); \ + FF2(B2, C2, D2, A2, in( 3), 12); \ + FF2(A2, B2, C2, D2, in( 4), 5); \ + FF2(D2, A2, B2, C2, in( 5), 8); \ + FF2(C2, D2, A2, B2, in( 6), 7); \ + FF2(B2, C2, D2, A2, in( 7), 9); \ + FF2(A2, B2, C2, D2, in( 8), 11); \ + FF2(D2, A2, B2, C2, in( 9), 13); \ + FF2(C2, D2, A2, B2, in(10), 14); \ + FF2(B2, C2, D2, A2, in(11), 15); \ + FF2(A2, B2, C2, D2, in(12), 6); \ + FF2(D2, A2, B2, C2, in(13), 7); \ + FF2(C2, D2, A2, B2, in(14), 9); \ + FF2(B2, C2, D2, A2, in(15), 8); \ + \ + GG2(A2, B2, C2, D2, in( 7), 7); \ + GG2(D2, A2, B2, C2, in( 4), 6); \ + GG2(C2, D2, A2, B2, in(13), 8); \ + GG2(B2, C2, D2, A2, in( 1), 13); \ + GG2(A2, B2, C2, D2, in(10), 11); \ + GG2(D2, A2, B2, C2, in( 6), 9); \ + GG2(C2, D2, A2, B2, in(15), 7); \ + GG2(B2, C2, D2, A2, in( 3), 15); \ + GG2(A2, B2, C2, D2, in(12), 7); \ + GG2(D2, A2, B2, C2, in( 0), 12); \ + GG2(C2, D2, A2, B2, in( 9), 15); \ + GG2(B2, C2, D2, A2, in( 5), 9); \ + GG2(A2, B2, C2, D2, in(14), 7); \ + GG2(D2, A2, B2, C2, in( 2), 11); \ + GG2(C2, D2, A2, B2, in(11), 13); \ + GG2(B2, C2, D2, A2, in( 8), 12); \ + \ + HH2(A2, B2, C2, D2, in( 3), 11); \ + HH2(D2, A2, B2, C2, in(10), 13); \ + HH2(C2, D2, A2, B2, in( 2), 14); \ + HH2(B2, C2, D2, A2, in( 4), 7); \ + HH2(A2, B2, C2, D2, in( 9), 14); \ + HH2(D2, A2, B2, C2, in(15), 9); \ + HH2(C2, D2, A2, B2, in( 8), 13); \ + HH2(B2, C2, D2, A2, in( 1), 15); \ + HH2(A2, B2, C2, D2, in(14), 6); \ + HH2(D2, A2, B2, C2, in( 7), 8); \ + HH2(C2, D2, A2, B2, in( 0), 13); \ + HH2(B2, C2, D2, A2, in( 6), 6); \ + HH2(A2, B2, C2, D2, in(11), 12); \ + HH2(D2, A2, B2, C2, in(13), 5); \ + HH2(C2, D2, A2, B2, in( 5), 7); \ + HH2(B2, C2, D2, A2, in(12), 5); \ + \ + tmp = SPH_T32((h)[1] + C1 + D2); \ + (h)[1] = SPH_T32((h)[2] + D1 + A2); \ + (h)[2] = SPH_T32((h)[3] + A1 + B2); \ + (h)[3] = SPH_T32((h)[0] + B1 + C2); \ + (h)[0] = tmp; \ + } while (0) + +/* + * One round of RIPEMD. The data must be aligned for 32-bit access. + */ +static void +ripemd_round(const unsigned char *data, sph_u32 r[5]) +{ +#if SPH_LITTLE_FAST + +#define RIPEMD_IN(x) sph_dec32le_aligned(data + (4 * (x))) + +#else + + sph_u32 X_var[16]; + int i; + + for (i = 0; i < 16; i ++) + X_var[i] = sph_dec32le_aligned(data + 4 * i); +#define RIPEMD_IN(x) X_var[x] + +#endif + RIPEMD_ROUND_BODY(RIPEMD_IN, r); +#undef RIPEMD_IN +} + +/* see sph_ripemd.h */ +void +sph_ripemd_init(void *cc) +{ + sph_ripemd_context *sc; + + sc = cc; + memcpy(sc->val, oIV, sizeof sc->val); +#if SPH_64 + sc->count = 0; +#else + sc->count_high = sc->count_low = 0; +#endif +} + +#define RFUN ripemd_round +#define HASH ripemd +#define LE32 1 +#include "md_helper.c" +#undef RFUN +#undef HASH +#undef LE32 + +/* see sph_ripemd.h */ +void +sph_ripemd_close(void *cc, void *dst) +{ + ripemd_close(cc, dst, 4); + sph_ripemd_init(cc); +} + +/* see sph_ripemd.h */ +void +sph_ripemd_comp(const sph_u32 msg[16], sph_u32 val[4]) +{ +#define RIPEMD_IN(x) msg[x] + RIPEMD_ROUND_BODY(RIPEMD_IN, val); +#undef RIPEMD_IN +} + +/* ===================================================================== */ +/* + * RIPEMD-128. + */ + +/* + * Round constants for RIPEMD-128. + */ +#define sK11 SPH_C32(0x00000000) +#define sK12 SPH_C32(0x5A827999) +#define sK13 SPH_C32(0x6ED9EBA1) +#define sK14 SPH_C32(0x8F1BBCDC) + +#define sK21 SPH_C32(0x50A28BE6) +#define sK22 SPH_C32(0x5C4DD124) +#define sK23 SPH_C32(0x6D703EF3) +#define sK24 SPH_C32(0x00000000) + +#define sRR(a, b, c, d, f, s, r, k) do { \ + a = ROTL(SPH_T32(a + f(b, c, d) + r + k), s); \ + } while (0) + +#define sROUND1(a, b, c, d, f, s, r, k) \ + sRR(a ## 1, b ## 1, c ## 1, d ## 1, f, s, r, sK1 ## k) + +#define sROUND2(a, b, c, d, f, s, r, k) \ + sRR(a ## 2, b ## 2, c ## 2, d ## 2, f, s, r, sK2 ## k) + +/* + * This macro defines the body for a RIPEMD-128 compression function + * implementation. The "in" parameter should evaluate, when applied to a + * numerical input parameter from 0 to 15, to an expression which yields + * the corresponding input block. The "h" parameter should evaluate to + * an array or pointer expression designating the array of 4 words which + * contains the input and output of the compression function. + */ + +#define RIPEMD128_ROUND_BODY(in, h) do { \ + sph_u32 A1, B1, C1, D1; \ + sph_u32 A2, B2, C2, D2; \ + sph_u32 tmp; \ + \ + A1 = A2 = (h)[0]; \ + B1 = B2 = (h)[1]; \ + C1 = C2 = (h)[2]; \ + D1 = D2 = (h)[3]; \ + \ + sROUND1(A, B, C, D, F1, 11, in( 0), 1); \ + sROUND1(D, A, B, C, F1, 14, in( 1), 1); \ + sROUND1(C, D, A, B, F1, 15, in( 2), 1); \ + sROUND1(B, C, D, A, F1, 12, in( 3), 1); \ + sROUND1(A, B, C, D, F1, 5, in( 4), 1); \ + sROUND1(D, A, B, C, F1, 8, in( 5), 1); \ + sROUND1(C, D, A, B, F1, 7, in( 6), 1); \ + sROUND1(B, C, D, A, F1, 9, in( 7), 1); \ + sROUND1(A, B, C, D, F1, 11, in( 8), 1); \ + sROUND1(D, A, B, C, F1, 13, in( 9), 1); \ + sROUND1(C, D, A, B, F1, 14, in(10), 1); \ + sROUND1(B, C, D, A, F1, 15, in(11), 1); \ + sROUND1(A, B, C, D, F1, 6, in(12), 1); \ + sROUND1(D, A, B, C, F1, 7, in(13), 1); \ + sROUND1(C, D, A, B, F1, 9, in(14), 1); \ + sROUND1(B, C, D, A, F1, 8, in(15), 1); \ + \ + sROUND1(A, B, C, D, F2, 7, in( 7), 2); \ + sROUND1(D, A, B, C, F2, 6, in( 4), 2); \ + sROUND1(C, D, A, B, F2, 8, in(13), 2); \ + sROUND1(B, C, D, A, F2, 13, in( 1), 2); \ + sROUND1(A, B, C, D, F2, 11, in(10), 2); \ + sROUND1(D, A, B, C, F2, 9, in( 6), 2); \ + sROUND1(C, D, A, B, F2, 7, in(15), 2); \ + sROUND1(B, C, D, A, F2, 15, in( 3), 2); \ + sROUND1(A, B, C, D, F2, 7, in(12), 2); \ + sROUND1(D, A, B, C, F2, 12, in( 0), 2); \ + sROUND1(C, D, A, B, F2, 15, in( 9), 2); \ + sROUND1(B, C, D, A, F2, 9, in( 5), 2); \ + sROUND1(A, B, C, D, F2, 11, in( 2), 2); \ + sROUND1(D, A, B, C, F2, 7, in(14), 2); \ + sROUND1(C, D, A, B, F2, 13, in(11), 2); \ + sROUND1(B, C, D, A, F2, 12, in( 8), 2); \ + \ + sROUND1(A, B, C, D, F3, 11, in( 3), 3); \ + sROUND1(D, A, B, C, F3, 13, in(10), 3); \ + sROUND1(C, D, A, B, F3, 6, in(14), 3); \ + sROUND1(B, C, D, A, F3, 7, in( 4), 3); \ + sROUND1(A, B, C, D, F3, 14, in( 9), 3); \ + sROUND1(D, A, B, C, F3, 9, in(15), 3); \ + sROUND1(C, D, A, B, F3, 13, in( 8), 3); \ + sROUND1(B, C, D, A, F3, 15, in( 1), 3); \ + sROUND1(A, B, C, D, F3, 14, in( 2), 3); \ + sROUND1(D, A, B, C, F3, 8, in( 7), 3); \ + sROUND1(C, D, A, B, F3, 13, in( 0), 3); \ + sROUND1(B, C, D, A, F3, 6, in( 6), 3); \ + sROUND1(A, B, C, D, F3, 5, in(13), 3); \ + sROUND1(D, A, B, C, F3, 12, in(11), 3); \ + sROUND1(C, D, A, B, F3, 7, in( 5), 3); \ + sROUND1(B, C, D, A, F3, 5, in(12), 3); \ + \ + sROUND1(A, B, C, D, F4, 11, in( 1), 4); \ + sROUND1(D, A, B, C, F4, 12, in( 9), 4); \ + sROUND1(C, D, A, B, F4, 14, in(11), 4); \ + sROUND1(B, C, D, A, F4, 15, in(10), 4); \ + sROUND1(A, B, C, D, F4, 14, in( 0), 4); \ + sROUND1(D, A, B, C, F4, 15, in( 8), 4); \ + sROUND1(C, D, A, B, F4, 9, in(12), 4); \ + sROUND1(B, C, D, A, F4, 8, in( 4), 4); \ + sROUND1(A, B, C, D, F4, 9, in(13), 4); \ + sROUND1(D, A, B, C, F4, 14, in( 3), 4); \ + sROUND1(C, D, A, B, F4, 5, in( 7), 4); \ + sROUND1(B, C, D, A, F4, 6, in(15), 4); \ + sROUND1(A, B, C, D, F4, 8, in(14), 4); \ + sROUND1(D, A, B, C, F4, 6, in( 5), 4); \ + sROUND1(C, D, A, B, F4, 5, in( 6), 4); \ + sROUND1(B, C, D, A, F4, 12, in( 2), 4); \ + \ + sROUND2(A, B, C, D, F4, 8, in( 5), 1); \ + sROUND2(D, A, B, C, F4, 9, in(14), 1); \ + sROUND2(C, D, A, B, F4, 9, in( 7), 1); \ + sROUND2(B, C, D, A, F4, 11, in( 0), 1); \ + sROUND2(A, B, C, D, F4, 13, in( 9), 1); \ + sROUND2(D, A, B, C, F4, 15, in( 2), 1); \ + sROUND2(C, D, A, B, F4, 15, in(11), 1); \ + sROUND2(B, C, D, A, F4, 5, in( 4), 1); \ + sROUND2(A, B, C, D, F4, 7, in(13), 1); \ + sROUND2(D, A, B, C, F4, 7, in( 6), 1); \ + sROUND2(C, D, A, B, F4, 8, in(15), 1); \ + sROUND2(B, C, D, A, F4, 11, in( 8), 1); \ + sROUND2(A, B, C, D, F4, 14, in( 1), 1); \ + sROUND2(D, A, B, C, F4, 14, in(10), 1); \ + sROUND2(C, D, A, B, F4, 12, in( 3), 1); \ + sROUND2(B, C, D, A, F4, 6, in(12), 1); \ + \ + sROUND2(A, B, C, D, F3, 9, in( 6), 2); \ + sROUND2(D, A, B, C, F3, 13, in(11), 2); \ + sROUND2(C, D, A, B, F3, 15, in( 3), 2); \ + sROUND2(B, C, D, A, F3, 7, in( 7), 2); \ + sROUND2(A, B, C, D, F3, 12, in( 0), 2); \ + sROUND2(D, A, B, C, F3, 8, in(13), 2); \ + sROUND2(C, D, A, B, F3, 9, in( 5), 2); \ + sROUND2(B, C, D, A, F3, 11, in(10), 2); \ + sROUND2(A, B, C, D, F3, 7, in(14), 2); \ + sROUND2(D, A, B, C, F3, 7, in(15), 2); \ + sROUND2(C, D, A, B, F3, 12, in( 8), 2); \ + sROUND2(B, C, D, A, F3, 7, in(12), 2); \ + sROUND2(A, B, C, D, F3, 6, in( 4), 2); \ + sROUND2(D, A, B, C, F3, 15, in( 9), 2); \ + sROUND2(C, D, A, B, F3, 13, in( 1), 2); \ + sROUND2(B, C, D, A, F3, 11, in( 2), 2); \ + \ + sROUND2(A, B, C, D, F2, 9, in(15), 3); \ + sROUND2(D, A, B, C, F2, 7, in( 5), 3); \ + sROUND2(C, D, A, B, F2, 15, in( 1), 3); \ + sROUND2(B, C, D, A, F2, 11, in( 3), 3); \ + sROUND2(A, B, C, D, F2, 8, in( 7), 3); \ + sROUND2(D, A, B, C, F2, 6, in(14), 3); \ + sROUND2(C, D, A, B, F2, 6, in( 6), 3); \ + sROUND2(B, C, D, A, F2, 14, in( 9), 3); \ + sROUND2(A, B, C, D, F2, 12, in(11), 3); \ + sROUND2(D, A, B, C, F2, 13, in( 8), 3); \ + sROUND2(C, D, A, B, F2, 5, in(12), 3); \ + sROUND2(B, C, D, A, F2, 14, in( 2), 3); \ + sROUND2(A, B, C, D, F2, 13, in(10), 3); \ + sROUND2(D, A, B, C, F2, 13, in( 0), 3); \ + sROUND2(C, D, A, B, F2, 7, in( 4), 3); \ + sROUND2(B, C, D, A, F2, 5, in(13), 3); \ + \ + sROUND2(A, B, C, D, F1, 15, in( 8), 4); \ + sROUND2(D, A, B, C, F1, 5, in( 6), 4); \ + sROUND2(C, D, A, B, F1, 8, in( 4), 4); \ + sROUND2(B, C, D, A, F1, 11, in( 1), 4); \ + sROUND2(A, B, C, D, F1, 14, in( 3), 4); \ + sROUND2(D, A, B, C, F1, 14, in(11), 4); \ + sROUND2(C, D, A, B, F1, 6, in(15), 4); \ + sROUND2(B, C, D, A, F1, 14, in( 0), 4); \ + sROUND2(A, B, C, D, F1, 6, in( 5), 4); \ + sROUND2(D, A, B, C, F1, 9, in(12), 4); \ + sROUND2(C, D, A, B, F1, 12, in( 2), 4); \ + sROUND2(B, C, D, A, F1, 9, in(13), 4); \ + sROUND2(A, B, C, D, F1, 12, in( 9), 4); \ + sROUND2(D, A, B, C, F1, 5, in( 7), 4); \ + sROUND2(C, D, A, B, F1, 15, in(10), 4); \ + sROUND2(B, C, D, A, F1, 8, in(14), 4); \ + \ + tmp = SPH_T32((h)[1] + C1 + D2); \ + (h)[1] = SPH_T32((h)[2] + D1 + A2); \ + (h)[2] = SPH_T32((h)[3] + A1 + B2); \ + (h)[3] = SPH_T32((h)[0] + B1 + C2); \ + (h)[0] = tmp; \ + } while (0) + +/* + * One round of RIPEMD-128. The data must be aligned for 32-bit access. + */ +static void +ripemd128_round(const unsigned char *data, sph_u32 r[5]) +{ +#if SPH_LITTLE_FAST + +#define RIPEMD128_IN(x) sph_dec32le_aligned(data + (4 * (x))) + +#else + + sph_u32 X_var[16]; + int i; + + for (i = 0; i < 16; i ++) + X_var[i] = sph_dec32le_aligned(data + 4 * i); +#define RIPEMD128_IN(x) X_var[x] + +#endif + RIPEMD128_ROUND_BODY(RIPEMD128_IN, r); +#undef RIPEMD128_IN +} + +/* see sph_ripemd.h */ +void +sph_ripemd128_init(void *cc) +{ + sph_ripemd128_context *sc; + + sc = cc; + memcpy(sc->val, IV, sizeof sc->val); +#if SPH_64 + sc->count = 0; +#else + sc->count_high = sc->count_low = 0; +#endif +} + +#define RFUN ripemd128_round +#define HASH ripemd128 +#define LE32 1 +#include "md_helper.c" +#undef RFUN +#undef HASH +#undef LE32 + +/* see sph_ripemd.h */ +void +sph_ripemd128_close(void *cc, void *dst) +{ + ripemd128_close(cc, dst, 4); + sph_ripemd128_init(cc); +} + +/* see sph_ripemd.h */ +void +sph_ripemd128_comp(const sph_u32 msg[16], sph_u32 val[4]) +{ +#define RIPEMD128_IN(x) msg[x] + RIPEMD128_ROUND_BODY(RIPEMD128_IN, val); +#undef RIPEMD128_IN +} + +/* ===================================================================== */ +/* + * RIPEMD-160. + */ + +/* + * Round constants for RIPEMD-160. + */ +#define K11 SPH_C32(0x00000000) +#define K12 SPH_C32(0x5A827999) +#define K13 SPH_C32(0x6ED9EBA1) +#define K14 SPH_C32(0x8F1BBCDC) +#define K15 SPH_C32(0xA953FD4E) + +#define K21 SPH_C32(0x50A28BE6) +#define K22 SPH_C32(0x5C4DD124) +#define K23 SPH_C32(0x6D703EF3) +#define K24 SPH_C32(0x7A6D76E9) +#define K25 SPH_C32(0x00000000) + +#define RR(a, b, c, d, e, f, s, r, k) do { \ + a = SPH_T32(ROTL(SPH_T32(a + f(b, c, d) + r + k), s) + e); \ + c = ROTL(c, 10); \ + } while (0) + +#define ROUND1(a, b, c, d, e, f, s, r, k) \ + RR(a ## 1, b ## 1, c ## 1, d ## 1, e ## 1, f, s, r, K1 ## k) + +#define ROUND2(a, b, c, d, e, f, s, r, k) \ + RR(a ## 2, b ## 2, c ## 2, d ## 2, e ## 2, f, s, r, K2 ## k) + +/* + * This macro defines the body for a RIPEMD-160 compression function + * implementation. The "in" parameter should evaluate, when applied to a + * numerical input parameter from 0 to 15, to an expression which yields + * the corresponding input block. The "h" parameter should evaluate to + * an array or pointer expression designating the array of 5 words which + * contains the input and output of the compression function. + */ + +#define RIPEMD160_ROUND_BODY(in, h) do { \ + sph_u32 A1, B1, C1, D1, E1; \ + sph_u32 A2, B2, C2, D2, E2; \ + sph_u32 tmp; \ + \ + A1 = A2 = (h)[0]; \ + B1 = B2 = (h)[1]; \ + C1 = C2 = (h)[2]; \ + D1 = D2 = (h)[3]; \ + E1 = E2 = (h)[4]; \ + \ + ROUND1(A, B, C, D, E, F1, 11, in( 0), 1); \ + ROUND1(E, A, B, C, D, F1, 14, in( 1), 1); \ + ROUND1(D, E, A, B, C, F1, 15, in( 2), 1); \ + ROUND1(C, D, E, A, B, F1, 12, in( 3), 1); \ + ROUND1(B, C, D, E, A, F1, 5, in( 4), 1); \ + ROUND1(A, B, C, D, E, F1, 8, in( 5), 1); \ + ROUND1(E, A, B, C, D, F1, 7, in( 6), 1); \ + ROUND1(D, E, A, B, C, F1, 9, in( 7), 1); \ + ROUND1(C, D, E, A, B, F1, 11, in( 8), 1); \ + ROUND1(B, C, D, E, A, F1, 13, in( 9), 1); \ + ROUND1(A, B, C, D, E, F1, 14, in(10), 1); \ + ROUND1(E, A, B, C, D, F1, 15, in(11), 1); \ + ROUND1(D, E, A, B, C, F1, 6, in(12), 1); \ + ROUND1(C, D, E, A, B, F1, 7, in(13), 1); \ + ROUND1(B, C, D, E, A, F1, 9, in(14), 1); \ + ROUND1(A, B, C, D, E, F1, 8, in(15), 1); \ + \ + ROUND1(E, A, B, C, D, F2, 7, in( 7), 2); \ + ROUND1(D, E, A, B, C, F2, 6, in( 4), 2); \ + ROUND1(C, D, E, A, B, F2, 8, in(13), 2); \ + ROUND1(B, C, D, E, A, F2, 13, in( 1), 2); \ + ROUND1(A, B, C, D, E, F2, 11, in(10), 2); \ + ROUND1(E, A, B, C, D, F2, 9, in( 6), 2); \ + ROUND1(D, E, A, B, C, F2, 7, in(15), 2); \ + ROUND1(C, D, E, A, B, F2, 15, in( 3), 2); \ + ROUND1(B, C, D, E, A, F2, 7, in(12), 2); \ + ROUND1(A, B, C, D, E, F2, 12, in( 0), 2); \ + ROUND1(E, A, B, C, D, F2, 15, in( 9), 2); \ + ROUND1(D, E, A, B, C, F2, 9, in( 5), 2); \ + ROUND1(C, D, E, A, B, F2, 11, in( 2), 2); \ + ROUND1(B, C, D, E, A, F2, 7, in(14), 2); \ + ROUND1(A, B, C, D, E, F2, 13, in(11), 2); \ + ROUND1(E, A, B, C, D, F2, 12, in( 8), 2); \ + \ + ROUND1(D, E, A, B, C, F3, 11, in( 3), 3); \ + ROUND1(C, D, E, A, B, F3, 13, in(10), 3); \ + ROUND1(B, C, D, E, A, F3, 6, in(14), 3); \ + ROUND1(A, B, C, D, E, F3, 7, in( 4), 3); \ + ROUND1(E, A, B, C, D, F3, 14, in( 9), 3); \ + ROUND1(D, E, A, B, C, F3, 9, in(15), 3); \ + ROUND1(C, D, E, A, B, F3, 13, in( 8), 3); \ + ROUND1(B, C, D, E, A, F3, 15, in( 1), 3); \ + ROUND1(A, B, C, D, E, F3, 14, in( 2), 3); \ + ROUND1(E, A, B, C, D, F3, 8, in( 7), 3); \ + ROUND1(D, E, A, B, C, F3, 13, in( 0), 3); \ + ROUND1(C, D, E, A, B, F3, 6, in( 6), 3); \ + ROUND1(B, C, D, E, A, F3, 5, in(13), 3); \ + ROUND1(A, B, C, D, E, F3, 12, in(11), 3); \ + ROUND1(E, A, B, C, D, F3, 7, in( 5), 3); \ + ROUND1(D, E, A, B, C, F3, 5, in(12), 3); \ + \ + ROUND1(C, D, E, A, B, F4, 11, in( 1), 4); \ + ROUND1(B, C, D, E, A, F4, 12, in( 9), 4); \ + ROUND1(A, B, C, D, E, F4, 14, in(11), 4); \ + ROUND1(E, A, B, C, D, F4, 15, in(10), 4); \ + ROUND1(D, E, A, B, C, F4, 14, in( 0), 4); \ + ROUND1(C, D, E, A, B, F4, 15, in( 8), 4); \ + ROUND1(B, C, D, E, A, F4, 9, in(12), 4); \ + ROUND1(A, B, C, D, E, F4, 8, in( 4), 4); \ + ROUND1(E, A, B, C, D, F4, 9, in(13), 4); \ + ROUND1(D, E, A, B, C, F4, 14, in( 3), 4); \ + ROUND1(C, D, E, A, B, F4, 5, in( 7), 4); \ + ROUND1(B, C, D, E, A, F4, 6, in(15), 4); \ + ROUND1(A, B, C, D, E, F4, 8, in(14), 4); \ + ROUND1(E, A, B, C, D, F4, 6, in( 5), 4); \ + ROUND1(D, E, A, B, C, F4, 5, in( 6), 4); \ + ROUND1(C, D, E, A, B, F4, 12, in( 2), 4); \ + \ + ROUND1(B, C, D, E, A, F5, 9, in( 4), 5); \ + ROUND1(A, B, C, D, E, F5, 15, in( 0), 5); \ + ROUND1(E, A, B, C, D, F5, 5, in( 5), 5); \ + ROUND1(D, E, A, B, C, F5, 11, in( 9), 5); \ + ROUND1(C, D, E, A, B, F5, 6, in( 7), 5); \ + ROUND1(B, C, D, E, A, F5, 8, in(12), 5); \ + ROUND1(A, B, C, D, E, F5, 13, in( 2), 5); \ + ROUND1(E, A, B, C, D, F5, 12, in(10), 5); \ + ROUND1(D, E, A, B, C, F5, 5, in(14), 5); \ + ROUND1(C, D, E, A, B, F5, 12, in( 1), 5); \ + ROUND1(B, C, D, E, A, F5, 13, in( 3), 5); \ + ROUND1(A, B, C, D, E, F5, 14, in( 8), 5); \ + ROUND1(E, A, B, C, D, F5, 11, in(11), 5); \ + ROUND1(D, E, A, B, C, F5, 8, in( 6), 5); \ + ROUND1(C, D, E, A, B, F5, 5, in(15), 5); \ + ROUND1(B, C, D, E, A, F5, 6, in(13), 5); \ + \ + ROUND2(A, B, C, D, E, F5, 8, in( 5), 1); \ + ROUND2(E, A, B, C, D, F5, 9, in(14), 1); \ + ROUND2(D, E, A, B, C, F5, 9, in( 7), 1); \ + ROUND2(C, D, E, A, B, F5, 11, in( 0), 1); \ + ROUND2(B, C, D, E, A, F5, 13, in( 9), 1); \ + ROUND2(A, B, C, D, E, F5, 15, in( 2), 1); \ + ROUND2(E, A, B, C, D, F5, 15, in(11), 1); \ + ROUND2(D, E, A, B, C, F5, 5, in( 4), 1); \ + ROUND2(C, D, E, A, B, F5, 7, in(13), 1); \ + ROUND2(B, C, D, E, A, F5, 7, in( 6), 1); \ + ROUND2(A, B, C, D, E, F5, 8, in(15), 1); \ + ROUND2(E, A, B, C, D, F5, 11, in( 8), 1); \ + ROUND2(D, E, A, B, C, F5, 14, in( 1), 1); \ + ROUND2(C, D, E, A, B, F5, 14, in(10), 1); \ + ROUND2(B, C, D, E, A, F5, 12, in( 3), 1); \ + ROUND2(A, B, C, D, E, F5, 6, in(12), 1); \ + \ + ROUND2(E, A, B, C, D, F4, 9, in( 6), 2); \ + ROUND2(D, E, A, B, C, F4, 13, in(11), 2); \ + ROUND2(C, D, E, A, B, F4, 15, in( 3), 2); \ + ROUND2(B, C, D, E, A, F4, 7, in( 7), 2); \ + ROUND2(A, B, C, D, E, F4, 12, in( 0), 2); \ + ROUND2(E, A, B, C, D, F4, 8, in(13), 2); \ + ROUND2(D, E, A, B, C, F4, 9, in( 5), 2); \ + ROUND2(C, D, E, A, B, F4, 11, in(10), 2); \ + ROUND2(B, C, D, E, A, F4, 7, in(14), 2); \ + ROUND2(A, B, C, D, E, F4, 7, in(15), 2); \ + ROUND2(E, A, B, C, D, F4, 12, in( 8), 2); \ + ROUND2(D, E, A, B, C, F4, 7, in(12), 2); \ + ROUND2(C, D, E, A, B, F4, 6, in( 4), 2); \ + ROUND2(B, C, D, E, A, F4, 15, in( 9), 2); \ + ROUND2(A, B, C, D, E, F4, 13, in( 1), 2); \ + ROUND2(E, A, B, C, D, F4, 11, in( 2), 2); \ + \ + ROUND2(D, E, A, B, C, F3, 9, in(15), 3); \ + ROUND2(C, D, E, A, B, F3, 7, in( 5), 3); \ + ROUND2(B, C, D, E, A, F3, 15, in( 1), 3); \ + ROUND2(A, B, C, D, E, F3, 11, in( 3), 3); \ + ROUND2(E, A, B, C, D, F3, 8, in( 7), 3); \ + ROUND2(D, E, A, B, C, F3, 6, in(14), 3); \ + ROUND2(C, D, E, A, B, F3, 6, in( 6), 3); \ + ROUND2(B, C, D, E, A, F3, 14, in( 9), 3); \ + ROUND2(A, B, C, D, E, F3, 12, in(11), 3); \ + ROUND2(E, A, B, C, D, F3, 13, in( 8), 3); \ + ROUND2(D, E, A, B, C, F3, 5, in(12), 3); \ + ROUND2(C, D, E, A, B, F3, 14, in( 2), 3); \ + ROUND2(B, C, D, E, A, F3, 13, in(10), 3); \ + ROUND2(A, B, C, D, E, F3, 13, in( 0), 3); \ + ROUND2(E, A, B, C, D, F3, 7, in( 4), 3); \ + ROUND2(D, E, A, B, C, F3, 5, in(13), 3); \ + \ + ROUND2(C, D, E, A, B, F2, 15, in( 8), 4); \ + ROUND2(B, C, D, E, A, F2, 5, in( 6), 4); \ + ROUND2(A, B, C, D, E, F2, 8, in( 4), 4); \ + ROUND2(E, A, B, C, D, F2, 11, in( 1), 4); \ + ROUND2(D, E, A, B, C, F2, 14, in( 3), 4); \ + ROUND2(C, D, E, A, B, F2, 14, in(11), 4); \ + ROUND2(B, C, D, E, A, F2, 6, in(15), 4); \ + ROUND2(A, B, C, D, E, F2, 14, in( 0), 4); \ + ROUND2(E, A, B, C, D, F2, 6, in( 5), 4); \ + ROUND2(D, E, A, B, C, F2, 9, in(12), 4); \ + ROUND2(C, D, E, A, B, F2, 12, in( 2), 4); \ + ROUND2(B, C, D, E, A, F2, 9, in(13), 4); \ + ROUND2(A, B, C, D, E, F2, 12, in( 9), 4); \ + ROUND2(E, A, B, C, D, F2, 5, in( 7), 4); \ + ROUND2(D, E, A, B, C, F2, 15, in(10), 4); \ + ROUND2(C, D, E, A, B, F2, 8, in(14), 4); \ + \ + ROUND2(B, C, D, E, A, F1, 8, in(12), 5); \ + ROUND2(A, B, C, D, E, F1, 5, in(15), 5); \ + ROUND2(E, A, B, C, D, F1, 12, in(10), 5); \ + ROUND2(D, E, A, B, C, F1, 9, in( 4), 5); \ + ROUND2(C, D, E, A, B, F1, 12, in( 1), 5); \ + ROUND2(B, C, D, E, A, F1, 5, in( 5), 5); \ + ROUND2(A, B, C, D, E, F1, 14, in( 8), 5); \ + ROUND2(E, A, B, C, D, F1, 6, in( 7), 5); \ + ROUND2(D, E, A, B, C, F1, 8, in( 6), 5); \ + ROUND2(C, D, E, A, B, F1, 13, in( 2), 5); \ + ROUND2(B, C, D, E, A, F1, 6, in(13), 5); \ + ROUND2(A, B, C, D, E, F1, 5, in(14), 5); \ + ROUND2(E, A, B, C, D, F1, 15, in( 0), 5); \ + ROUND2(D, E, A, B, C, F1, 13, in( 3), 5); \ + ROUND2(C, D, E, A, B, F1, 11, in( 9), 5); \ + ROUND2(B, C, D, E, A, F1, 11, in(11), 5); \ + \ + tmp = SPH_T32((h)[1] + C1 + D2); \ + (h)[1] = SPH_T32((h)[2] + D1 + E2); \ + (h)[2] = SPH_T32((h)[3] + E1 + A2); \ + (h)[3] = SPH_T32((h)[4] + A1 + B2); \ + (h)[4] = SPH_T32((h)[0] + B1 + C2); \ + (h)[0] = tmp; \ + } while (0) + +/* + * One round of RIPEMD-160. The data must be aligned for 32-bit access. + */ +static void +ripemd160_round(const unsigned char *data, sph_u32 r[5]) +{ +#if SPH_LITTLE_FAST + +#define RIPEMD160_IN(x) sph_dec32le_aligned(data + (4 * (x))) + +#else + + sph_u32 X_var[16]; + int i; + + for (i = 0; i < 16; i ++) + X_var[i] = sph_dec32le_aligned(data + 4 * i); +#define RIPEMD160_IN(x) X_var[x] + +#endif + RIPEMD160_ROUND_BODY(RIPEMD160_IN, r); +#undef RIPEMD160_IN +} + +/* see sph_ripemd.h */ +void +sph_ripemd160_init(void *cc) +{ + sph_ripemd160_context *sc; + + sc = cc; + memcpy(sc->val, IV, sizeof sc->val); +#if SPH_64 + sc->count = 0; +#else + sc->count_high = sc->count_low = 0; +#endif +} + +#define RFUN ripemd160_round +#define HASH ripemd160 +#define LE32 1 +#include "md_helper.c" +#undef RFUN +#undef HASH +#undef LE32 + +/* see sph_ripemd.h */ +void +sph_ripemd160_close(void *cc, void *dst) +{ + ripemd160_close(cc, dst, 5); + sph_ripemd160_init(cc); +} + +/* see sph_ripemd.h */ +void +sph_ripemd160_comp(const sph_u32 msg[16], sph_u32 val[5]) +{ +#define RIPEMD160_IN(x) msg[x] + RIPEMD160_ROUND_BODY(RIPEMD160_IN, val); +#undef RIPEMD160_IN +} diff --git a/sph/sha2.c b/sph/sha2.c new file mode 100644 index 0000000..517bdcf --- /dev/null +++ b/sph/sha2.c @@ -0,0 +1,632 @@ +/* + * Copyright 2011 ArtForz + * Copyright 2011-2013 pooler + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. See COPYING for more details. + */ + +#include "cpuminer-config.h" +#include "miner.h" + +#include +#include + +#if defined(__arm__) && defined(__APCS_32__) +#define EXTERN_SHA256 +#endif + +static const uint32_t sha256_h[8] = { + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 +}; + +static const uint32_t sha256_k[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +void sha256_init(uint32_t *state) +{ + memcpy(state, sha256_h, 32); +} + +/* Elementary functions used by SHA256 */ +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define ROTR(x, n) ((x >> n) | (x << (32 - n))) +#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) +#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ (x >> 3)) +#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ (x >> 10)) + +/* SHA256 round function */ +#define RND(a, b, c, d, e, f, g, h, k) \ + do { \ + t0 = h + S1(e) + Ch(e, f, g) + k; \ + t1 = S0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; \ + } while (0) + +/* Adjusted round function for rotating state */ +#define RNDr(S, W, i) \ + RND(S[(64 - i) % 8], S[(65 - i) % 8], \ + S[(66 - i) % 8], S[(67 - i) % 8], \ + S[(68 - i) % 8], S[(69 - i) % 8], \ + S[(70 - i) % 8], S[(71 - i) % 8], \ + W[i] + sha256_k[i]) + +#ifndef EXTERN_SHA256 + +/* + * SHA256 block compression function. The 256-bit state is transformed via + * the 512-bit input block to produce a new state. + */ +void sha256_transform(uint32_t *state, const uint32_t *block, int swap) +{ + uint32_t W[64]; + uint32_t S[8]; + uint32_t t0, t1; + int i; + + /* 1. Prepare message schedule W. */ + if (swap) { + for (i = 0; i < 16; i++) + W[i] = swab32(block[i]); + } else + memcpy(W, block, 64); + for (i = 16; i < 64; i += 2) { + W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; + W[i+1] = s1(W[i - 1]) + W[i - 6] + s0(W[i - 14]) + W[i - 15]; + } + + /* 2. Initialize working variables. */ + memcpy(S, state, 32); + + /* 3. Mix. */ + RNDr(S, W, 0); + RNDr(S, W, 1); + RNDr(S, W, 2); + RNDr(S, W, 3); + RNDr(S, W, 4); + RNDr(S, W, 5); + RNDr(S, W, 6); + RNDr(S, W, 7); + RNDr(S, W, 8); + RNDr(S, W, 9); + RNDr(S, W, 10); + RNDr(S, W, 11); + RNDr(S, W, 12); + RNDr(S, W, 13); + RNDr(S, W, 14); + RNDr(S, W, 15); + RNDr(S, W, 16); + RNDr(S, W, 17); + RNDr(S, W, 18); + RNDr(S, W, 19); + RNDr(S, W, 20); + RNDr(S, W, 21); + RNDr(S, W, 22); + RNDr(S, W, 23); + RNDr(S, W, 24); + RNDr(S, W, 25); + RNDr(S, W, 26); + RNDr(S, W, 27); + RNDr(S, W, 28); + RNDr(S, W, 29); + RNDr(S, W, 30); + RNDr(S, W, 31); + RNDr(S, W, 32); + RNDr(S, W, 33); + RNDr(S, W, 34); + RNDr(S, W, 35); + RNDr(S, W, 36); + RNDr(S, W, 37); + RNDr(S, W, 38); + RNDr(S, W, 39); + RNDr(S, W, 40); + RNDr(S, W, 41); + RNDr(S, W, 42); + RNDr(S, W, 43); + RNDr(S, W, 44); + RNDr(S, W, 45); + RNDr(S, W, 46); + RNDr(S, W, 47); + RNDr(S, W, 48); + RNDr(S, W, 49); + RNDr(S, W, 50); + RNDr(S, W, 51); + RNDr(S, W, 52); + RNDr(S, W, 53); + RNDr(S, W, 54); + RNDr(S, W, 55); + RNDr(S, W, 56); + RNDr(S, W, 57); + RNDr(S, W, 58); + RNDr(S, W, 59); + RNDr(S, W, 60); + RNDr(S, W, 61); + RNDr(S, W, 62); + RNDr(S, W, 63); + + /* 4. Mix local working variables into global state */ + for (i = 0; i < 8; i++) + state[i] += S[i]; +} + +#endif /* EXTERN_SHA256 */ + + +static const uint32_t sha256d_hash1[16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x80000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000100 +}; + +static void sha256d_80_swap(uint32_t *hash, const uint32_t *data) +{ + uint32_t S[16]; + int i; + + sha256_init(S); + sha256_transform(S, data, 0); + sha256_transform(S, data + 16, 0); + memcpy(S + 8, sha256d_hash1 + 8, 32); + sha256_init(hash); + sha256_transform(hash, S, 0); + for (i = 0; i < 8; i++) + hash[i] = swab32(hash[i]); +} + +void sha256d(unsigned char *hash, const unsigned char *data, int len) +{ + uint32_t S[16], T[16]; + int i, r; + + sha256_init(S); + for (r = len; r > -9; r -= 64) { + if (r < 64) + memset(T, 0, 64); + memcpy(T, data + len - r, r > 64 ? 64 : (r < 0 ? 0 : r)); + if (r >= 0 && r < 64) + ((unsigned char *)T)[r] = 0x80; + for (i = 0; i < 16; i++) + T[i] = be32dec(T + i); + if (r < 56) + T[15] = 8 * len; + sha256_transform(S, T, 0); + } + memcpy(S + 8, sha256d_hash1 + 8, 32); + sha256_init(T); + sha256_transform(T, S, 0); + for (i = 0; i < 8; i++) + be32enc((uint32_t *)hash + i, T[i]); +} + +static inline void sha256d_preextend(uint32_t *W) +{ + W[16] = s1(W[14]) + W[ 9] + s0(W[ 1]) + W[ 0]; + W[17] = s1(W[15]) + W[10] + s0(W[ 2]) + W[ 1]; + W[18] = s1(W[16]) + W[11] + W[ 2]; + W[19] = s1(W[17]) + W[12] + s0(W[ 4]); + W[20] = W[13] + s0(W[ 5]) + W[ 4]; + W[21] = W[14] + s0(W[ 6]) + W[ 5]; + W[22] = W[15] + s0(W[ 7]) + W[ 6]; + W[23] = W[16] + s0(W[ 8]) + W[ 7]; + W[24] = W[17] + s0(W[ 9]) + W[ 8]; + W[25] = s0(W[10]) + W[ 9]; + W[26] = s0(W[11]) + W[10]; + W[27] = s0(W[12]) + W[11]; + W[28] = s0(W[13]) + W[12]; + W[29] = s0(W[14]) + W[13]; + W[30] = s0(W[15]) + W[14]; + W[31] = s0(W[16]) + W[15]; +} + +static inline void sha256d_prehash(uint32_t *S, const uint32_t *W) +{ + uint32_t t0, t1; + RNDr(S, W, 0); + RNDr(S, W, 1); + RNDr(S, W, 2); +} + +#ifdef EXTERN_SHA256 + +void sha256d_ms(uint32_t *hash, uint32_t *W, + const uint32_t *midstate, const uint32_t *prehash); + +#else + +static inline void sha256d_ms(uint32_t *hash, uint32_t *W, + const uint32_t *midstate, const uint32_t *prehash) +{ + uint32_t S[64]; + uint32_t t0, t1; + int i; + + S[18] = W[18]; + S[19] = W[19]; + S[20] = W[20]; + S[22] = W[22]; + S[23] = W[23]; + S[24] = W[24]; + S[30] = W[30]; + S[31] = W[31]; + + W[18] += s0(W[3]); + W[19] += W[3]; + W[20] += s1(W[18]); + W[21] = s1(W[19]); + W[22] += s1(W[20]); + W[23] += s1(W[21]); + W[24] += s1(W[22]); + W[25] = s1(W[23]) + W[18]; + W[26] = s1(W[24]) + W[19]; + W[27] = s1(W[25]) + W[20]; + W[28] = s1(W[26]) + W[21]; + W[29] = s1(W[27]) + W[22]; + W[30] += s1(W[28]) + W[23]; + W[31] += s1(W[29]) + W[24]; + for (i = 32; i < 64; i += 2) { + W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; + W[i+1] = s1(W[i - 1]) + W[i - 6] + s0(W[i - 14]) + W[i - 15]; + } + + memcpy(S, prehash, 32); + + RNDr(S, W, 3); + RNDr(S, W, 4); + RNDr(S, W, 5); + RNDr(S, W, 6); + RNDr(S, W, 7); + RNDr(S, W, 8); + RNDr(S, W, 9); + RNDr(S, W, 10); + RNDr(S, W, 11); + RNDr(S, W, 12); + RNDr(S, W, 13); + RNDr(S, W, 14); + RNDr(S, W, 15); + RNDr(S, W, 16); + RNDr(S, W, 17); + RNDr(S, W, 18); + RNDr(S, W, 19); + RNDr(S, W, 20); + RNDr(S, W, 21); + RNDr(S, W, 22); + RNDr(S, W, 23); + RNDr(S, W, 24); + RNDr(S, W, 25); + RNDr(S, W, 26); + RNDr(S, W, 27); + RNDr(S, W, 28); + RNDr(S, W, 29); + RNDr(S, W, 30); + RNDr(S, W, 31); + RNDr(S, W, 32); + RNDr(S, W, 33); + RNDr(S, W, 34); + RNDr(S, W, 35); + RNDr(S, W, 36); + RNDr(S, W, 37); + RNDr(S, W, 38); + RNDr(S, W, 39); + RNDr(S, W, 40); + RNDr(S, W, 41); + RNDr(S, W, 42); + RNDr(S, W, 43); + RNDr(S, W, 44); + RNDr(S, W, 45); + RNDr(S, W, 46); + RNDr(S, W, 47); + RNDr(S, W, 48); + RNDr(S, W, 49); + RNDr(S, W, 50); + RNDr(S, W, 51); + RNDr(S, W, 52); + RNDr(S, W, 53); + RNDr(S, W, 54); + RNDr(S, W, 55); + RNDr(S, W, 56); + RNDr(S, W, 57); + RNDr(S, W, 58); + RNDr(S, W, 59); + RNDr(S, W, 60); + RNDr(S, W, 61); + RNDr(S, W, 62); + RNDr(S, W, 63); + + for (i = 0; i < 8; i++) + S[i] += midstate[i]; + + W[18] = S[18]; + W[19] = S[19]; + W[20] = S[20]; + W[22] = S[22]; + W[23] = S[23]; + W[24] = S[24]; + W[30] = S[30]; + W[31] = S[31]; + + memcpy(S + 8, sha256d_hash1 + 8, 32); + S[16] = s1(sha256d_hash1[14]) + sha256d_hash1[ 9] + s0(S[ 1]) + S[ 0]; + S[17] = s1(sha256d_hash1[15]) + sha256d_hash1[10] + s0(S[ 2]) + S[ 1]; + S[18] = s1(S[16]) + sha256d_hash1[11] + s0(S[ 3]) + S[ 2]; + S[19] = s1(S[17]) + sha256d_hash1[12] + s0(S[ 4]) + S[ 3]; + S[20] = s1(S[18]) + sha256d_hash1[13] + s0(S[ 5]) + S[ 4]; + S[21] = s1(S[19]) + sha256d_hash1[14] + s0(S[ 6]) + S[ 5]; + S[22] = s1(S[20]) + sha256d_hash1[15] + s0(S[ 7]) + S[ 6]; + S[23] = s1(S[21]) + S[16] + s0(sha256d_hash1[ 8]) + S[ 7]; + S[24] = s1(S[22]) + S[17] + s0(sha256d_hash1[ 9]) + sha256d_hash1[ 8]; + S[25] = s1(S[23]) + S[18] + s0(sha256d_hash1[10]) + sha256d_hash1[ 9]; + S[26] = s1(S[24]) + S[19] + s0(sha256d_hash1[11]) + sha256d_hash1[10]; + S[27] = s1(S[25]) + S[20] + s0(sha256d_hash1[12]) + sha256d_hash1[11]; + S[28] = s1(S[26]) + S[21] + s0(sha256d_hash1[13]) + sha256d_hash1[12]; + S[29] = s1(S[27]) + S[22] + s0(sha256d_hash1[14]) + sha256d_hash1[13]; + S[30] = s1(S[28]) + S[23] + s0(sha256d_hash1[15]) + sha256d_hash1[14]; + S[31] = s1(S[29]) + S[24] + s0(S[16]) + sha256d_hash1[15]; + for (i = 32; i < 60; i += 2) { + S[i] = s1(S[i - 2]) + S[i - 7] + s0(S[i - 15]) + S[i - 16]; + S[i+1] = s1(S[i - 1]) + S[i - 6] + s0(S[i - 14]) + S[i - 15]; + } + S[60] = s1(S[58]) + S[53] + s0(S[45]) + S[44]; + + sha256_init(hash); + + RNDr(hash, S, 0); + RNDr(hash, S, 1); + RNDr(hash, S, 2); + RNDr(hash, S, 3); + RNDr(hash, S, 4); + RNDr(hash, S, 5); + RNDr(hash, S, 6); + RNDr(hash, S, 7); + RNDr(hash, S, 8); + RNDr(hash, S, 9); + RNDr(hash, S, 10); + RNDr(hash, S, 11); + RNDr(hash, S, 12); + RNDr(hash, S, 13); + RNDr(hash, S, 14); + RNDr(hash, S, 15); + RNDr(hash, S, 16); + RNDr(hash, S, 17); + RNDr(hash, S, 18); + RNDr(hash, S, 19); + RNDr(hash, S, 20); + RNDr(hash, S, 21); + RNDr(hash, S, 22); + RNDr(hash, S, 23); + RNDr(hash, S, 24); + RNDr(hash, S, 25); + RNDr(hash, S, 26); + RNDr(hash, S, 27); + RNDr(hash, S, 28); + RNDr(hash, S, 29); + RNDr(hash, S, 30); + RNDr(hash, S, 31); + RNDr(hash, S, 32); + RNDr(hash, S, 33); + RNDr(hash, S, 34); + RNDr(hash, S, 35); + RNDr(hash, S, 36); + RNDr(hash, S, 37); + RNDr(hash, S, 38); + RNDr(hash, S, 39); + RNDr(hash, S, 40); + RNDr(hash, S, 41); + RNDr(hash, S, 42); + RNDr(hash, S, 43); + RNDr(hash, S, 44); + RNDr(hash, S, 45); + RNDr(hash, S, 46); + RNDr(hash, S, 47); + RNDr(hash, S, 48); + RNDr(hash, S, 49); + RNDr(hash, S, 50); + RNDr(hash, S, 51); + RNDr(hash, S, 52); + RNDr(hash, S, 53); + RNDr(hash, S, 54); + RNDr(hash, S, 55); + RNDr(hash, S, 56); + + hash[2] += hash[6] + S1(hash[3]) + Ch(hash[3], hash[4], hash[5]) + + S[57] + sha256_k[57]; + hash[1] += hash[5] + S1(hash[2]) + Ch(hash[2], hash[3], hash[4]) + + S[58] + sha256_k[58]; + hash[0] += hash[4] + S1(hash[1]) + Ch(hash[1], hash[2], hash[3]) + + S[59] + sha256_k[59]; + hash[7] += hash[3] + S1(hash[0]) + Ch(hash[0], hash[1], hash[2]) + + S[60] + sha256_k[60] + + sha256_h[7]; +} + +#endif /* EXTERN_SHA256 */ + +#if HAVE_SHA256_4WAY + +void sha256d_ms_4way(uint32_t *hash, uint32_t *data, + const uint32_t *midstate, const uint32_t *prehash); + +static inline int scanhash_sha256d_4way(int thr_id, uint32_t *pdata, + const uint32_t *ptarget uint32_t max_nonce, unsigned long *hashes_done) +{ + uint32_t data[4 * 64] __attribute__((aligned(128))); + uint32_t hash[4 * 8] __attribute__((aligned(32))); + uint32_t midstate[4 * 8] __attribute__((aligned(32))); + uint32_t prehash[4 * 8] __attribute__((aligned(32))); + uint32_t n = pdata[19] - 1; + const uint32_t first_nonce = pdata[19]; + const uint32_t Htarg = ptarget[7]; + int i, j; + + memcpy(data, pdata + 16, 64); + sha256d_preextend(data); + for (i = 31; i >= 0; i--) + for (j = 0; j < 4; j++) + data[i * 4 + j] = data[i]; + + sha256_init(midstate); + sha256_transform(midstate, pdata, 0); + memcpy(prehash, midstate, 32); + sha256d_prehash(prehash, pdata + 16); + for (i = 7; i >= 0; i--) { + for (j = 0; j < 4; j++) { + midstate[i * 4 + j] = midstate[i]; + prehash[i * 4 + j] = prehash[i]; + } + } + + do { + for (i = 0; i < 4; i++) + data[4 * 3 + i] = ++n; + + sha256d_ms_4way(hash, data, midstate, prehash); + + for (i = 0; i < 4; i++) { + if (swab32(hash[4 * 7 + i]) <= Htarg) { + pdata[19] = data[4 * 3 + i]; + sha256d_80_swap(hash, pdata); + if (fulltest(hash, ptarget)) { + work_set_target_ratio(work, hash); + *hashes_done = n - first_nonce + 1; + return 1; + } + } + } + } while (n < max_nonce && !work_restart[thr_id].restart); + + *hashes_done = n - first_nonce + 1; + pdata[19] = n; + return 0; +} + +#endif /* HAVE_SHA256_4WAY */ + +#if HAVE_SHA256_8WAY + +void sha256d_ms_8way(uint32_t *hash, uint32_t *data, + const uint32_t *midstate, const uint32_t *prehash); + +static inline int scanhash_sha256d_8way(int thr_id, uint32_t *pdata, + const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done) +{ + uint32_t data[8 * 64] __attribute__((aligned(128))); + uint32_t hash[8 * 8] __attribute__((aligned(32))); + uint32_t midstate[8 * 8] __attribute__((aligned(32))); + uint32_t prehash[8 * 8] __attribute__((aligned(32))); + uint32_t n = pdata[19] - 1; + const uint32_t first_nonce = pdata[19]; + const uint32_t Htarg = ptarget[7]; + int i, j; + + memcpy(data, pdata + 16, 64); + sha256d_preextend(data); + for (i = 31; i >= 0; i--) + for (j = 0; j < 8; j++) + data[i * 8 + j] = data[i]; + + sha256_init(midstate); + sha256_transform(midstate, pdata, 0); + memcpy(prehash, midstate, 32); + sha256d_prehash(prehash, pdata + 16); + for (i = 7; i >= 0; i--) { + for (j = 0; j < 8; j++) { + midstate[i * 8 + j] = midstate[i]; + prehash[i * 8 + j] = prehash[i]; + } + } + + do { + for (i = 0; i < 8; i++) + data[8 * 3 + i] = ++n; + + sha256d_ms_8way(hash, data, midstate, prehash); + + for (i = 0; i < 8; i++) { + if (swab32(hash[8 * 7 + i]) <= Htarg) { + pdata[19] = data[8 * 3 + i]; + sha256d_80_swap(hash, pdata); + if (fulltest(hash, ptarget)) { + *hashes_done = n - first_nonce + 1; + return 1; + } + } + } + } while (n < max_nonce && !work_restart[thr_id].restart); + + *hashes_done = n - first_nonce + 1; + pdata[19] = n; + return 0; +} + +#endif /* HAVE_SHA256_8WAY */ + +int scanhash_sha256d(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + uint32_t _ALIGN(128) data[64]; + uint32_t hash[8]; + uint32_t midstate[8]; + uint32_t prehash[8]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + uint32_t n = pdata[19] - 1; + const uint32_t first_nonce = pdata[19]; + const uint32_t Htarg = ptarget[7]; + +#if HAVE_SHA256_8WAY + if (sha256_use_8way()) + return scanhash_sha256d_8way(thr_id, pdata, ptarget, + max_nonce, hashes_done); +#endif +#if HAVE_SHA256_4WAY + if (sha256_use_4way()) + return scanhash_sha256d_4way(thr_id, pdata, ptarget, + max_nonce, hashes_done); +#endif + + memcpy(data, pdata + 16, 64); + sha256d_preextend(data); + + sha256_init(midstate); + sha256_transform(midstate, pdata, 0); + memcpy(prehash, midstate, 32); + sha256d_prehash(prehash, pdata + 16); + + do { + data[3] = ++n; + sha256d_ms(hash, data, midstate, prehash); + if (swab32(hash[7]) <= Htarg) { + pdata[19] = data[3]; + sha256d_80_swap(hash, pdata); + if (fulltest(hash, ptarget)) { + *hashes_done = n - first_nonce + 1; + return 1; + } + } + } while (n < max_nonce && !work_restart[thr_id].restart); + + *hashes_done = n - first_nonce + 1; + pdata[19] = n; + return 0; +} diff --git a/sph/sha256_Y.c b/sph/sha256_Y.c new file mode 100644 index 0000000..d17cbe2 --- /dev/null +++ b/sph/sha256_Y.c @@ -0,0 +1,418 @@ +/*- + * Copyright 2005,2007,2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +#include "sph/sysendian.h" + +#include "sph/sha256_Y.h" + +/* + * Encode a length len/4 vector of (uint32_t) into a length len vector of + * (unsigned char) in big-endian form. Assumes len is a multiple of 4. + */ +static void +be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 4; i++) + be32enc(dst + i * 4, src[i]); +} + +/* + * Decode a big-endian length len vector of (unsigned char) into a length + * len/4 vector of (uint32_t). Assumes len is a multiple of 4. + */ +static void +be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 4; i++) + dst[i] = be32dec(src + i * 4); +} + +/* Elementary functions used by SHA256 */ +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define SHR(x, n) (x >> n) +#define ROTR(x, n) ((x >> n) | (x << (32 - n))) +#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) +#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3)) +#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10)) + +/* SHA256 round function */ +#define RND(a, b, c, d, e, f, g, h, k) \ + t0 = h + S1(e) + Ch(e, f, g) + k; \ + t1 = S0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + +/* Adjusted round function for rotating state */ +#define RNDr(S, W, i, k) \ + RND(S[(64 - i) % 8], S[(65 - i) % 8], \ + S[(66 - i) % 8], S[(67 - i) % 8], \ + S[(68 - i) % 8], S[(69 - i) % 8], \ + S[(70 - i) % 8], S[(71 - i) % 8], \ + W[i] + k) + +/* + * SHA256 block compression function. The 256-bit state is transformed via + * the 512-bit input block to produce a new state. + */ +static void +SHA256_Transform(uint32_t * state, const unsigned char block[64]) +{ + uint32_t W[64]; + uint32_t S[8]; + uint32_t t0, t1; + int i; + /* 1. Prepare message schedule W. */ + be32dec_vect(W, block, 64); + + for (i = 16; i < 64; i++) + W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; + + /* 2. Initialize working variables. */ + memcpy(S, state, 32); + + /* 3. Mix. */ + RNDr(S, W, 0, 0x428a2f98); + RNDr(S, W, 1, 0x71374491); + RNDr(S, W, 2, 0xb5c0fbcf); + RNDr(S, W, 3, 0xe9b5dba5); + RNDr(S, W, 4, 0x3956c25b); + RNDr(S, W, 5, 0x59f111f1); + RNDr(S, W, 6, 0x923f82a4); + RNDr(S, W, 7, 0xab1c5ed5); + RNDr(S, W, 8, 0xd807aa98); + RNDr(S, W, 9, 0x12835b01); + RNDr(S, W, 10, 0x243185be); + RNDr(S, W, 11, 0x550c7dc3); + RNDr(S, W, 12, 0x72be5d74); + RNDr(S, W, 13, 0x80deb1fe); + RNDr(S, W, 14, 0x9bdc06a7); + RNDr(S, W, 15, 0xc19bf174); + RNDr(S, W, 16, 0xe49b69c1); + RNDr(S, W, 17, 0xefbe4786); + RNDr(S, W, 18, 0x0fc19dc6); + RNDr(S, W, 19, 0x240ca1cc); + RNDr(S, W, 20, 0x2de92c6f); + RNDr(S, W, 21, 0x4a7484aa); + RNDr(S, W, 22, 0x5cb0a9dc); + RNDr(S, W, 23, 0x76f988da); + RNDr(S, W, 24, 0x983e5152); + RNDr(S, W, 25, 0xa831c66d); + RNDr(S, W, 26, 0xb00327c8); + RNDr(S, W, 27, 0xbf597fc7); + RNDr(S, W, 28, 0xc6e00bf3); + RNDr(S, W, 29, 0xd5a79147); + RNDr(S, W, 30, 0x06ca6351); + RNDr(S, W, 31, 0x14292967); + RNDr(S, W, 32, 0x27b70a85); + RNDr(S, W, 33, 0x2e1b2138); + RNDr(S, W, 34, 0x4d2c6dfc); + RNDr(S, W, 35, 0x53380d13); + RNDr(S, W, 36, 0x650a7354); + RNDr(S, W, 37, 0x766a0abb); + RNDr(S, W, 38, 0x81c2c92e); + RNDr(S, W, 39, 0x92722c85); + RNDr(S, W, 40, 0xa2bfe8a1); + RNDr(S, W, 41, 0xa81a664b); + RNDr(S, W, 42, 0xc24b8b70); + RNDr(S, W, 43, 0xc76c51a3); + RNDr(S, W, 44, 0xd192e819); + RNDr(S, W, 45, 0xd6990624); + RNDr(S, W, 46, 0xf40e3585); + RNDr(S, W, 47, 0x106aa070); + RNDr(S, W, 48, 0x19a4c116); + RNDr(S, W, 49, 0x1e376c08); + RNDr(S, W, 50, 0x2748774c); + RNDr(S, W, 51, 0x34b0bcb5); + RNDr(S, W, 52, 0x391c0cb3); + RNDr(S, W, 53, 0x4ed8aa4a); + RNDr(S, W, 54, 0x5b9cca4f); + RNDr(S, W, 55, 0x682e6ff3); + RNDr(S, W, 56, 0x748f82ee); + RNDr(S, W, 57, 0x78a5636f); + RNDr(S, W, 58, 0x84c87814); + RNDr(S, W, 59, 0x8cc70208); + RNDr(S, W, 60, 0x90befffa); + RNDr(S, W, 61, 0xa4506ceb); + RNDr(S, W, 62, 0xbef9a3f7); + RNDr(S, W, 63, 0xc67178f2); + + /* 4. Mix local working variables into global state */ + for (i = 0; i < 8; i++) { + state[i] += S[i]; + +} + + /* Clean the stack. */ + memset(W, 0, 256); + memset(S, 0, 32); + t0 = t1 = 0; +} + +static unsigned char PAD[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Add padding and terminating bit-count. */ +static void +SHA256_Pad(SHA256_CTX_Y * ctx) +{ + unsigned char len[8]; + uint32_t r, plen; + + /* + * Convert length to a vector of bytes -- we do this now rather + * than later because the length will change after we pad. + */ + be32enc_vect(len, ctx->count, 8); + + /* Add 1--64 bytes so that the resulting length is 56 mod 64 */ + r = (ctx->count[1] >> 3) & 0x3f; + plen = (r < 56) ? (56 - r) : (120 - r); + SHA256_Update_Y(ctx, PAD, (size_t)plen); + + /* Add the terminating bit-count */ + SHA256_Update_Y(ctx, len, 8); +} + +/* SHA-256 initialization. Begins a SHA-256 operation. */ +void +SHA256_Init_Y(SHA256_CTX_Y * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x6A09E667; + ctx->state[1] = 0xBB67AE85; + ctx->state[2] = 0x3C6EF372; + ctx->state[3] = 0xA54FF53A; + ctx->state[4] = 0x510E527F; + ctx->state[5] = 0x9B05688C; + ctx->state[6] = 0x1F83D9AB; + ctx->state[7] = 0x5BE0CD19; +} + +/* Add bytes into the hash */ +void +SHA256_Update_Y(SHA256_CTX_Y * ctx, const void *in, size_t len) +{ + uint32_t bitlen[2]; + uint32_t r; + const unsigned char *src = in; + + /* Number of bytes left in the buffer from previous updates */ + r = (ctx->count[1] >> 3) & 0x3f; + + /* Convert the length into a number of bits */ + bitlen[1] = ((uint32_t)len) << 3; + bitlen[0] = (uint32_t)(len >> 29); + + /* Update number of bits */ + if ((ctx->count[1] += bitlen[1]) < bitlen[1]) + ctx->count[0]++; + ctx->count[0] += bitlen[0]; + + /* Handle the case where we don't need to perform any transforms */ + if (len < 64 - r) { + + memcpy(&ctx->buf[r], src, len); + return; + } + + /* Finish the current block */ + memcpy(&ctx->buf[r], src, 64 - r); + + SHA256_Transform(ctx->state, ctx->buf); + src += 64 - r; + len -= 64 - r; + + /* Perform complete blocks */ + + while (len >= 64) { + SHA256_Transform(ctx->state, src); + src += 64; + len -= 64; + } + + /* Copy left over data into buffer */ + memcpy(ctx->buf, src, len); +} + +/* + * SHA-256 finalization. Pads the input data, exports the hash value, + * and clears the context state. + */ +void +SHA256_Final_Y(unsigned char digest[32], SHA256_CTX_Y * ctx) +{ + /* Add padding */ + SHA256_Pad(ctx); + + /* Write the hash */ + be32enc_vect(digest, ctx->state, 32); + + /* Clear the context state */ + memset((void *)ctx, 0, sizeof(*ctx)); +} + +/* Initialize an HMAC-SHA256 operation with the given key. */ +void +HMAC_SHA256_Init_Y(HMAC_SHA256_CTX_Y * ctx, const void * _K, size_t Klen) +{ + unsigned char pad[64]; + unsigned char khash[32]; + const unsigned char * K = _K; + size_t i; + + /* If Klen > 64, the key is really SHA256(K). */ + if (Klen > 64) { + SHA256_Init_Y(&ctx->ictx); + SHA256_Update_Y(&ctx->ictx, K, Klen); + SHA256_Final_Y(khash, &ctx->ictx); + K = khash; + Klen = 32; + } + + /* Inner SHA256 operation is SHA256(K xor [block of 0x36] || data). */ + SHA256_Init_Y(&ctx->ictx); + memset(pad, 0x36, 64); + for (i = 0; i < Klen; i++) { + pad[i] ^= K[i]; + } + SHA256_Update_Y(&ctx->ictx, pad, 64); + + /* Outer SHA256 operation is SHA256(K xor [block of 0x5c] || hash). */ + SHA256_Init_Y(&ctx->octx); + memset(pad, 0x5c, 64); + for (i = 0; i < Klen; i++) + { + pad[i] ^= K[i]; + } + SHA256_Update_Y(&ctx->octx, pad, 64); + + /* Clean the stack. */ + memset(khash, 0, 32); +} + +/* Add bytes to the HMAC-SHA256 operation. */ +void +HMAC_SHA256_Update_Y(HMAC_SHA256_CTX_Y * ctx, const void *in, size_t len) +{ + /* Feed data to the inner SHA256 operation. */ + SHA256_Update_Y(&ctx->ictx, in, len); +} + +/* Finish an HMAC-SHA256 operation. */ +void +HMAC_SHA256_Final_Y(unsigned char digest[32], HMAC_SHA256_CTX_Y * ctx) +{ + unsigned char ihash[32]; + + /* Finish the inner SHA256 operation. */ + SHA256_Final_Y(ihash, &ctx->ictx); + + /* Feed the inner hash to the outer SHA256 operation. */ + SHA256_Update_Y(&ctx->octx, ihash, 32); + + /* Finish the outer SHA256 operation. */ + SHA256_Final_Y(digest, &ctx->octx); + + /* Clean the stack. */ + memset(ihash, 0, 32); +} + +/** + * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): + * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and + * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). + */ + +void +PBKDF2_SHA256(const uint8_t * passwd, size_t passwdlen, const uint8_t * salt, +size_t saltlen, uint64_t c, uint8_t * buf, size_t dkLen) +{ + HMAC_SHA256_CTX_Y PShctx, hctx; + size_t i; + uint8_t ivec[4]; + uint8_t U[32]; + uint8_t T[32]; + uint64_t j; + int k; + size_t clen; + + /* Compute HMAC state after processing P and S. */ + HMAC_SHA256_Init_Y(&PShctx, passwd, passwdlen); + HMAC_SHA256_Update_Y(&PShctx, salt, saltlen); + + /* Iterate through the blocks. */ + for (i = 0; i * 32 < dkLen; i++) { + /* Generate INT(i + 1). */ + be32enc(ivec, (uint32_t)(i + 1)); + + /* Compute U_1 = PRF(P, S || INT(i)). */ + memcpy(&hctx, &PShctx, sizeof(HMAC_SHA256_CTX_Y)); + HMAC_SHA256_Update_Y(&hctx, ivec, 4); + HMAC_SHA256_Final_Y(U, &hctx); + + /* T_i = U_1 ... */ + memcpy(T, U, 32); + + for (j = 2; j <= c; j++) { + /* Compute U_j. */ + HMAC_SHA256_Init_Y(&hctx, passwd, passwdlen); + HMAC_SHA256_Update_Y(&hctx, U, 32); + HMAC_SHA256_Final_Y(U, &hctx); + + /* ... xor U_j ... */ + for (k = 0; k < 32; k++) + T[k] ^= U[k]; + } + + /* Copy as many bytes as necessary into buf. */ + clen = dkLen - i * 32; + if (clen > 32) + clen = 32; + memcpy(&buf[i * 32], T, clen); + } + + /* Clean PShctx, since we never called _Final on it. */ + memset(&PShctx, 0, sizeof(HMAC_SHA256_CTX_Y)); +} diff --git a/sph/sha256_Y.h b/sph/sha256_Y.h new file mode 100644 index 0000000..e97b81b --- /dev/null +++ b/sph/sha256_Y.h @@ -0,0 +1,63 @@ +/*- + * Copyright 2005,2007,2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libmd/sha256_Y.h,v 1.2 2006/01/17 15:35:56 phk Exp $ + */ + +#ifndef _SHA256_H_ +#define _SHA256_H_ + +#include + +#include + +typedef struct SHA256Context { + uint32_t state[8]; + uint32_t count[2]; + unsigned char buf[64]; +} SHA256_CTX_Y; + +typedef struct HMAC_SHA256Context { + SHA256_CTX_Y ictx; + SHA256_CTX_Y octx; +} HMAC_SHA256_CTX_Y; + +void SHA256_Init_Y(SHA256_CTX_Y *); +void SHA256_Update_Y(SHA256_CTX_Y *, const void *, size_t); +void SHA256_Final_Y(unsigned char [32], SHA256_CTX_Y *); +void HMAC_SHA256_Init_Y(HMAC_SHA256_CTX_Y *, const void *, size_t); +void HMAC_SHA256_Update_Y(HMAC_SHA256_CTX_Y *, const void *, size_t); +void HMAC_SHA256_Final_Y(unsigned char [32], HMAC_SHA256_CTX_Y *); + +/** + * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): + * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and + * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). + */ +void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t, + uint64_t, uint8_t *, size_t); + + +#endif /* !_SHA256_H_ */ diff --git a/sph/sha2big.c b/sph/sha2big.c new file mode 100644 index 0000000..bd3a895 --- /dev/null +++ b/sph/sha2big.c @@ -0,0 +1,256 @@ +/* $Id: sha2big.c 216 2010-06-08 09:46:57Z tp $ */ +/* + * SHA-384 / SHA-512 implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_sha2.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_64 + +#define CH(X, Y, Z) ((((Y) ^ (Z)) & (X)) ^ (Z)) +#define MAJ(X, Y, Z) (((X) & (Y)) | (((X) | (Y)) & (Z))) + +#define ROTR64 SPH_ROTR64 + +#define BSG5_0(x) (ROTR64(x, 28) ^ ROTR64(x, 34) ^ ROTR64(x, 39)) +#define BSG5_1(x) (ROTR64(x, 14) ^ ROTR64(x, 18) ^ ROTR64(x, 41)) +#define SSG5_0(x) (ROTR64(x, 1) ^ ROTR64(x, 8) ^ SPH_T64((x) >> 7)) +#define SSG5_1(x) (ROTR64(x, 19) ^ ROTR64(x, 61) ^ SPH_T64((x) >> 6)) + +static const sph_u64 K512[80] = { + SPH_C64(0x428A2F98D728AE22), SPH_C64(0x7137449123EF65CD), + SPH_C64(0xB5C0FBCFEC4D3B2F), SPH_C64(0xE9B5DBA58189DBBC), + SPH_C64(0x3956C25BF348B538), SPH_C64(0x59F111F1B605D019), + SPH_C64(0x923F82A4AF194F9B), SPH_C64(0xAB1C5ED5DA6D8118), + SPH_C64(0xD807AA98A3030242), SPH_C64(0x12835B0145706FBE), + SPH_C64(0x243185BE4EE4B28C), SPH_C64(0x550C7DC3D5FFB4E2), + SPH_C64(0x72BE5D74F27B896F), SPH_C64(0x80DEB1FE3B1696B1), + SPH_C64(0x9BDC06A725C71235), SPH_C64(0xC19BF174CF692694), + SPH_C64(0xE49B69C19EF14AD2), SPH_C64(0xEFBE4786384F25E3), + SPH_C64(0x0FC19DC68B8CD5B5), SPH_C64(0x240CA1CC77AC9C65), + SPH_C64(0x2DE92C6F592B0275), SPH_C64(0x4A7484AA6EA6E483), + SPH_C64(0x5CB0A9DCBD41FBD4), SPH_C64(0x76F988DA831153B5), + SPH_C64(0x983E5152EE66DFAB), SPH_C64(0xA831C66D2DB43210), + SPH_C64(0xB00327C898FB213F), SPH_C64(0xBF597FC7BEEF0EE4), + SPH_C64(0xC6E00BF33DA88FC2), SPH_C64(0xD5A79147930AA725), + SPH_C64(0x06CA6351E003826F), SPH_C64(0x142929670A0E6E70), + SPH_C64(0x27B70A8546D22FFC), SPH_C64(0x2E1B21385C26C926), + SPH_C64(0x4D2C6DFC5AC42AED), SPH_C64(0x53380D139D95B3DF), + SPH_C64(0x650A73548BAF63DE), SPH_C64(0x766A0ABB3C77B2A8), + SPH_C64(0x81C2C92E47EDAEE6), SPH_C64(0x92722C851482353B), + SPH_C64(0xA2BFE8A14CF10364), SPH_C64(0xA81A664BBC423001), + SPH_C64(0xC24B8B70D0F89791), SPH_C64(0xC76C51A30654BE30), + SPH_C64(0xD192E819D6EF5218), SPH_C64(0xD69906245565A910), + SPH_C64(0xF40E35855771202A), SPH_C64(0x106AA07032BBD1B8), + SPH_C64(0x19A4C116B8D2D0C8), SPH_C64(0x1E376C085141AB53), + SPH_C64(0x2748774CDF8EEB99), SPH_C64(0x34B0BCB5E19B48A8), + SPH_C64(0x391C0CB3C5C95A63), SPH_C64(0x4ED8AA4AE3418ACB), + SPH_C64(0x5B9CCA4F7763E373), SPH_C64(0x682E6FF3D6B2B8A3), + SPH_C64(0x748F82EE5DEFB2FC), SPH_C64(0x78A5636F43172F60), + SPH_C64(0x84C87814A1F0AB72), SPH_C64(0x8CC702081A6439EC), + SPH_C64(0x90BEFFFA23631E28), SPH_C64(0xA4506CEBDE82BDE9), + SPH_C64(0xBEF9A3F7B2C67915), SPH_C64(0xC67178F2E372532B), + SPH_C64(0xCA273ECEEA26619C), SPH_C64(0xD186B8C721C0C207), + SPH_C64(0xEADA7DD6CDE0EB1E), SPH_C64(0xF57D4F7FEE6ED178), + SPH_C64(0x06F067AA72176FBA), SPH_C64(0x0A637DC5A2C898A6), + SPH_C64(0x113F9804BEF90DAE), SPH_C64(0x1B710B35131C471B), + SPH_C64(0x28DB77F523047D84), SPH_C64(0x32CAAB7B40C72493), + SPH_C64(0x3C9EBE0A15C9BEBC), SPH_C64(0x431D67C49C100D4C), + SPH_C64(0x4CC5D4BECB3E42B6), SPH_C64(0x597F299CFC657E2A), + SPH_C64(0x5FCB6FAB3AD6FAEC), SPH_C64(0x6C44198C4A475817) +}; + +static const sph_u64 H384[8] = { + SPH_C64(0xCBBB9D5DC1059ED8), SPH_C64(0x629A292A367CD507), + SPH_C64(0x9159015A3070DD17), SPH_C64(0x152FECD8F70E5939), + SPH_C64(0x67332667FFC00B31), SPH_C64(0x8EB44A8768581511), + SPH_C64(0xDB0C2E0D64F98FA7), SPH_C64(0x47B5481DBEFA4FA4) +}; + +static const sph_u64 H512[8] = { + SPH_C64(0x6A09E667F3BCC908), SPH_C64(0xBB67AE8584CAA73B), + SPH_C64(0x3C6EF372FE94F82B), SPH_C64(0xA54FF53A5F1D36F1), + SPH_C64(0x510E527FADE682D1), SPH_C64(0x9B05688C2B3E6C1F), + SPH_C64(0x1F83D9ABFB41BD6B), SPH_C64(0x5BE0CD19137E2179) +}; + +/* + * This macro defines the body for a SHA-384 / SHA-512 compression function + * implementation. The "in" parameter should evaluate, when applied to a + * numerical input parameter from 0 to 15, to an expression which yields + * the corresponding input block. The "r" parameter should evaluate to + * an array or pointer expression designating the array of 8 words which + * contains the input and output of the compression function. + * + * SHA-512 is hard for the compiler. If the loop is completely unrolled, + * then the code will be quite huge (possibly more than 100 kB), and the + * performance will be degraded due to cache misses on the code. We + * unroll only eight steps, which avoids all needless copies when + * 64-bit registers are swapped. + */ + +#define SHA3_STEP(A, B, C, D, E, F, G, H, i) do { \ + sph_u64 T1, T2; \ + T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \ + T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \ + D = SPH_T64(D + T1); \ + H = SPH_T64(T1 + T2); \ + } while (0) + +#define SHA3_ROUND_BODY(in, r) do { \ + int i; \ + sph_u64 A, B, C, D, E, F, G, H; \ + sph_u64 W[80]; \ + \ + for (i = 0; i < 16; i ++) \ + W[i] = in(i); \ + \ + for (i = 16; i < 80; i ++) \ + W[i] = SPH_T64(SSG5_1(W[i - 2]) + W[i - 7] \ + + SSG5_0(W[i - 15]) + W[i - 16]); \ + A = (r)[0]; \ + B = (r)[1]; \ + C = (r)[2]; \ + D = (r)[3]; \ + E = (r)[4]; \ + F = (r)[5]; \ + G = (r)[6]; \ + H = (r)[7]; \ + for (i = 0; i < 80; i += 8) { \ + SHA3_STEP(A, B, C, D, E, F, G, H, i + 0); \ + SHA3_STEP(H, A, B, C, D, E, F, G, i + 1); \ + SHA3_STEP(G, H, A, B, C, D, E, F, i + 2); \ + SHA3_STEP(F, G, H, A, B, C, D, E, i + 3); \ + SHA3_STEP(E, F, G, H, A, B, C, D, i + 4); \ + SHA3_STEP(D, E, F, G, H, A, B, C, i + 5); \ + SHA3_STEP(C, D, E, F, G, H, A, B, i + 6); \ + SHA3_STEP(B, C, D, E, F, G, H, A, i + 7); \ + } \ + (r)[0] = SPH_T64((r)[0] + A); \ + (r)[1] = SPH_T64((r)[1] + B); \ + (r)[2] = SPH_T64((r)[2] + C); \ + (r)[3] = SPH_T64((r)[3] + D); \ + (r)[4] = SPH_T64((r)[4] + E); \ + (r)[5] = SPH_T64((r)[5] + F); \ + (r)[6] = SPH_T64((r)[6] + G); \ + (r)[7] = SPH_T64((r)[7] + H); \ + } while (0) + +/* + * One round of SHA-384 / SHA-512. The data must be aligned for 64-bit access. + */ +static void +sha3_round(const unsigned char *data, sph_u64 r[8]) +{ +#define SHA3_IN(x) sph_dec64be_aligned(data + (8 * (x))) + SHA3_ROUND_BODY(SHA3_IN, r); +#undef SHA3_IN +} + +/* see sph_sha3.h */ +void +sph_sha384_init(void *cc) +{ + sph_sha384_context *sc; + + sc = cc; + memcpy(sc->val, H384, sizeof H384); + sc->count = 0; +} + +/* see sph_sha3.h */ +void +sph_sha512_init(void *cc) +{ + sph_sha512_context *sc; + + sc = cc; + memcpy(sc->val, H512, sizeof H512); + sc->count = 0; +} + +#define RFUN sha3_round +#define HASH sha384 +#define BE64 1 +#include "md_helper.c" + +/* see sph_sha3.h */ +void +sph_sha384_close(void *cc, void *dst) +{ + sha384_close(cc, dst, 6); + sph_sha384_init(cc); +} + +/* see sph_sha3.h */ +void +sph_sha384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + sha384_addbits_and_close(cc, ub, n, dst, 6); + sph_sha384_init(cc); +} + +/* see sph_sha3.h */ +void +sph_sha512_close(void *cc, void *dst) +{ + sha384_close(cc, dst, 8); + sph_sha512_init(cc); +} + +/* see sph_sha3.h */ +void +sph_sha512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + sha384_addbits_and_close(cc, ub, n, dst, 8); + sph_sha512_init(cc); +} + +/* see sph_sha3.h */ +void +sph_sha384_comp(const sph_u64 msg[16], sph_u64 val[8]) +{ +#define SHA3_IN(x) msg[x] + SHA3_ROUND_BODY(SHA3_IN, val); +#undef SHA3_IN +} + +#endif +#ifdef __cplusplus +} +#endif + diff --git a/sph/shabal.c b/sph/shabal.c new file mode 100644 index 0000000..06d368c --- /dev/null +++ b/sph/shabal.c @@ -0,0 +1,810 @@ +/* $Id: shabal.c 175 2010-05-07 16:03:20Z tp $ */ +/* + * Shabal implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_shabal.h" +#ifdef __cplusplus +extern "C"{ +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +/* + * Part of this code was automatically generated (the part between + * the "BEGIN" and "END" markers). + */ + +#define sM 16 + +#define C32 SPH_C32 +#define T32 SPH_T32 + +#define O1 13 +#define O2 9 +#define O3 6 + +/* + * We copy the state into local variables, so that the compiler knows + * that it can optimize them at will. + */ + +/* BEGIN -- automatically generated code. */ + +#define DECL_STATE \ + sph_u32 A00, A01, A02, A03, A04, A05, A06, A07, \ + A08, A09, A0A, A0B; \ + sph_u32 B0, B1, B2, B3, B4, B5, B6, B7, \ + B8, B9, BA, BB, BC, BD, BE, BF; \ + sph_u32 C0, C1, C2, C3, C4, C5, C6, C7, \ + C8, C9, CA, CB, CC, CD, CE, CF; \ + sph_u32 M0, M1, M2, M3, M4, M5, M6, M7, \ + M8, M9, MA, MB, MC, MD, ME, MF; \ + sph_u32 Wlow, Whigh; + +#define READ_STATE(state) do { \ + A00 = (state)->A[0]; \ + A01 = (state)->A[1]; \ + A02 = (state)->A[2]; \ + A03 = (state)->A[3]; \ + A04 = (state)->A[4]; \ + A05 = (state)->A[5]; \ + A06 = (state)->A[6]; \ + A07 = (state)->A[7]; \ + A08 = (state)->A[8]; \ + A09 = (state)->A[9]; \ + A0A = (state)->A[10]; \ + A0B = (state)->A[11]; \ + B0 = (state)->B[0]; \ + B1 = (state)->B[1]; \ + B2 = (state)->B[2]; \ + B3 = (state)->B[3]; \ + B4 = (state)->B[4]; \ + B5 = (state)->B[5]; \ + B6 = (state)->B[6]; \ + B7 = (state)->B[7]; \ + B8 = (state)->B[8]; \ + B9 = (state)->B[9]; \ + BA = (state)->B[10]; \ + BB = (state)->B[11]; \ + BC = (state)->B[12]; \ + BD = (state)->B[13]; \ + BE = (state)->B[14]; \ + BF = (state)->B[15]; \ + C0 = (state)->C[0]; \ + C1 = (state)->C[1]; \ + C2 = (state)->C[2]; \ + C3 = (state)->C[3]; \ + C4 = (state)->C[4]; \ + C5 = (state)->C[5]; \ + C6 = (state)->C[6]; \ + C7 = (state)->C[7]; \ + C8 = (state)->C[8]; \ + C9 = (state)->C[9]; \ + CA = (state)->C[10]; \ + CB = (state)->C[11]; \ + CC = (state)->C[12]; \ + CD = (state)->C[13]; \ + CE = (state)->C[14]; \ + CF = (state)->C[15]; \ + Wlow = (state)->Wlow; \ + Whigh = (state)->Whigh; \ + } while (0) + +#define WRITE_STATE(state) do { \ + (state)->A[0] = A00; \ + (state)->A[1] = A01; \ + (state)->A[2] = A02; \ + (state)->A[3] = A03; \ + (state)->A[4] = A04; \ + (state)->A[5] = A05; \ + (state)->A[6] = A06; \ + (state)->A[7] = A07; \ + (state)->A[8] = A08; \ + (state)->A[9] = A09; \ + (state)->A[10] = A0A; \ + (state)->A[11] = A0B; \ + (state)->B[0] = B0; \ + (state)->B[1] = B1; \ + (state)->B[2] = B2; \ + (state)->B[3] = B3; \ + (state)->B[4] = B4; \ + (state)->B[5] = B5; \ + (state)->B[6] = B6; \ + (state)->B[7] = B7; \ + (state)->B[8] = B8; \ + (state)->B[9] = B9; \ + (state)->B[10] = BA; \ + (state)->B[11] = BB; \ + (state)->B[12] = BC; \ + (state)->B[13] = BD; \ + (state)->B[14] = BE; \ + (state)->B[15] = BF; \ + (state)->C[0] = C0; \ + (state)->C[1] = C1; \ + (state)->C[2] = C2; \ + (state)->C[3] = C3; \ + (state)->C[4] = C4; \ + (state)->C[5] = C5; \ + (state)->C[6] = C6; \ + (state)->C[7] = C7; \ + (state)->C[8] = C8; \ + (state)->C[9] = C9; \ + (state)->C[10] = CA; \ + (state)->C[11] = CB; \ + (state)->C[12] = CC; \ + (state)->C[13] = CD; \ + (state)->C[14] = CE; \ + (state)->C[15] = CF; \ + (state)->Wlow = Wlow; \ + (state)->Whigh = Whigh; \ + } while (0) + +#define DECODE_BLOCK do { \ + M0 = sph_dec32le_aligned(buf + 0); \ + M1 = sph_dec32le_aligned(buf + 4); \ + M2 = sph_dec32le_aligned(buf + 8); \ + M3 = sph_dec32le_aligned(buf + 12); \ + M4 = sph_dec32le_aligned(buf + 16); \ + M5 = sph_dec32le_aligned(buf + 20); \ + M6 = sph_dec32le_aligned(buf + 24); \ + M7 = sph_dec32le_aligned(buf + 28); \ + M8 = sph_dec32le_aligned(buf + 32); \ + M9 = sph_dec32le_aligned(buf + 36); \ + MA = sph_dec32le_aligned(buf + 40); \ + MB = sph_dec32le_aligned(buf + 44); \ + MC = sph_dec32le_aligned(buf + 48); \ + MD = sph_dec32le_aligned(buf + 52); \ + ME = sph_dec32le_aligned(buf + 56); \ + MF = sph_dec32le_aligned(buf + 60); \ + } while (0) + +#define INPUT_BLOCK_ADD do { \ + B0 = T32(B0 + M0); \ + B1 = T32(B1 + M1); \ + B2 = T32(B2 + M2); \ + B3 = T32(B3 + M3); \ + B4 = T32(B4 + M4); \ + B5 = T32(B5 + M5); \ + B6 = T32(B6 + M6); \ + B7 = T32(B7 + M7); \ + B8 = T32(B8 + M8); \ + B9 = T32(B9 + M9); \ + BA = T32(BA + MA); \ + BB = T32(BB + MB); \ + BC = T32(BC + MC); \ + BD = T32(BD + MD); \ + BE = T32(BE + ME); \ + BF = T32(BF + MF); \ + } while (0) + +#define INPUT_BLOCK_SUB do { \ + C0 = T32(C0 - M0); \ + C1 = T32(C1 - M1); \ + C2 = T32(C2 - M2); \ + C3 = T32(C3 - M3); \ + C4 = T32(C4 - M4); \ + C5 = T32(C5 - M5); \ + C6 = T32(C6 - M6); \ + C7 = T32(C7 - M7); \ + C8 = T32(C8 - M8); \ + C9 = T32(C9 - M9); \ + CA = T32(CA - MA); \ + CB = T32(CB - MB); \ + CC = T32(CC - MC); \ + CD = T32(CD - MD); \ + CE = T32(CE - ME); \ + CF = T32(CF - MF); \ + } while (0) + +#define XOR_W do { \ + A00 ^= Wlow; \ + A01 ^= Whigh; \ + } while (0) + +#define SWAP(v1, v2) do { \ + sph_u32 tmp = (v1); \ + (v1) = (v2); \ + (v2) = tmp; \ + } while (0) + +#define SWAP_BC do { \ + SWAP(B0, C0); \ + SWAP(B1, C1); \ + SWAP(B2, C2); \ + SWAP(B3, C3); \ + SWAP(B4, C4); \ + SWAP(B5, C5); \ + SWAP(B6, C6); \ + SWAP(B7, C7); \ + SWAP(B8, C8); \ + SWAP(B9, C9); \ + SWAP(BA, CA); \ + SWAP(BB, CB); \ + SWAP(BC, CC); \ + SWAP(BD, CD); \ + SWAP(BE, CE); \ + SWAP(BF, CF); \ + } while (0) + +#define PERM_ELT(xa0, xa1, xb0, xb1, xb2, xb3, xc, xm) do { \ + xa0 = T32((xa0 \ + ^ (((xa1 << 15) | (xa1 >> 17)) * 5U) \ + ^ xc) * 3U) \ + ^ xb1 ^ (xb2 & ~xb3) ^ xm; \ + xb0 = T32(~(((xb0 << 1) | (xb0 >> 31)) ^ xa0)); \ + } while (0) + +#define PERM_STEP_0 do { \ + PERM_ELT(A00, A0B, B0, BD, B9, B6, C8, M0); \ + PERM_ELT(A01, A00, B1, BE, BA, B7, C7, M1); \ + PERM_ELT(A02, A01, B2, BF, BB, B8, C6, M2); \ + PERM_ELT(A03, A02, B3, B0, BC, B9, C5, M3); \ + PERM_ELT(A04, A03, B4, B1, BD, BA, C4, M4); \ + PERM_ELT(A05, A04, B5, B2, BE, BB, C3, M5); \ + PERM_ELT(A06, A05, B6, B3, BF, BC, C2, M6); \ + PERM_ELT(A07, A06, B7, B4, B0, BD, C1, M7); \ + PERM_ELT(A08, A07, B8, B5, B1, BE, C0, M8); \ + PERM_ELT(A09, A08, B9, B6, B2, BF, CF, M9); \ + PERM_ELT(A0A, A09, BA, B7, B3, B0, CE, MA); \ + PERM_ELT(A0B, A0A, BB, B8, B4, B1, CD, MB); \ + PERM_ELT(A00, A0B, BC, B9, B5, B2, CC, MC); \ + PERM_ELT(A01, A00, BD, BA, B6, B3, CB, MD); \ + PERM_ELT(A02, A01, BE, BB, B7, B4, CA, ME); \ + PERM_ELT(A03, A02, BF, BC, B8, B5, C9, MF); \ + } while (0) + +#define PERM_STEP_1 do { \ + PERM_ELT(A04, A03, B0, BD, B9, B6, C8, M0); \ + PERM_ELT(A05, A04, B1, BE, BA, B7, C7, M1); \ + PERM_ELT(A06, A05, B2, BF, BB, B8, C6, M2); \ + PERM_ELT(A07, A06, B3, B0, BC, B9, C5, M3); \ + PERM_ELT(A08, A07, B4, B1, BD, BA, C4, M4); \ + PERM_ELT(A09, A08, B5, B2, BE, BB, C3, M5); \ + PERM_ELT(A0A, A09, B6, B3, BF, BC, C2, M6); \ + PERM_ELT(A0B, A0A, B7, B4, B0, BD, C1, M7); \ + PERM_ELT(A00, A0B, B8, B5, B1, BE, C0, M8); \ + PERM_ELT(A01, A00, B9, B6, B2, BF, CF, M9); \ + PERM_ELT(A02, A01, BA, B7, B3, B0, CE, MA); \ + PERM_ELT(A03, A02, BB, B8, B4, B1, CD, MB); \ + PERM_ELT(A04, A03, BC, B9, B5, B2, CC, MC); \ + PERM_ELT(A05, A04, BD, BA, B6, B3, CB, MD); \ + PERM_ELT(A06, A05, BE, BB, B7, B4, CA, ME); \ + PERM_ELT(A07, A06, BF, BC, B8, B5, C9, MF); \ + } while (0) + +#define PERM_STEP_2 do { \ + PERM_ELT(A08, A07, B0, BD, B9, B6, C8, M0); \ + PERM_ELT(A09, A08, B1, BE, BA, B7, C7, M1); \ + PERM_ELT(A0A, A09, B2, BF, BB, B8, C6, M2); \ + PERM_ELT(A0B, A0A, B3, B0, BC, B9, C5, M3); \ + PERM_ELT(A00, A0B, B4, B1, BD, BA, C4, M4); \ + PERM_ELT(A01, A00, B5, B2, BE, BB, C3, M5); \ + PERM_ELT(A02, A01, B6, B3, BF, BC, C2, M6); \ + PERM_ELT(A03, A02, B7, B4, B0, BD, C1, M7); \ + PERM_ELT(A04, A03, B8, B5, B1, BE, C0, M8); \ + PERM_ELT(A05, A04, B9, B6, B2, BF, CF, M9); \ + PERM_ELT(A06, A05, BA, B7, B3, B0, CE, MA); \ + PERM_ELT(A07, A06, BB, B8, B4, B1, CD, MB); \ + PERM_ELT(A08, A07, BC, B9, B5, B2, CC, MC); \ + PERM_ELT(A09, A08, BD, BA, B6, B3, CB, MD); \ + PERM_ELT(A0A, A09, BE, BB, B7, B4, CA, ME); \ + PERM_ELT(A0B, A0A, BF, BC, B8, B5, C9, MF); \ + } while (0) + +#define APPLY_P do { \ + B0 = T32(B0 << 17) | (B0 >> 15); \ + B1 = T32(B1 << 17) | (B1 >> 15); \ + B2 = T32(B2 << 17) | (B2 >> 15); \ + B3 = T32(B3 << 17) | (B3 >> 15); \ + B4 = T32(B4 << 17) | (B4 >> 15); \ + B5 = T32(B5 << 17) | (B5 >> 15); \ + B6 = T32(B6 << 17) | (B6 >> 15); \ + B7 = T32(B7 << 17) | (B7 >> 15); \ + B8 = T32(B8 << 17) | (B8 >> 15); \ + B9 = T32(B9 << 17) | (B9 >> 15); \ + BA = T32(BA << 17) | (BA >> 15); \ + BB = T32(BB << 17) | (BB >> 15); \ + BC = T32(BC << 17) | (BC >> 15); \ + BD = T32(BD << 17) | (BD >> 15); \ + BE = T32(BE << 17) | (BE >> 15); \ + BF = T32(BF << 17) | (BF >> 15); \ + PERM_STEP_0; \ + PERM_STEP_1; \ + PERM_STEP_2; \ + A0B = T32(A0B + C6); \ + A0A = T32(A0A + C5); \ + A09 = T32(A09 + C4); \ + A08 = T32(A08 + C3); \ + A07 = T32(A07 + C2); \ + A06 = T32(A06 + C1); \ + A05 = T32(A05 + C0); \ + A04 = T32(A04 + CF); \ + A03 = T32(A03 + CE); \ + A02 = T32(A02 + CD); \ + A01 = T32(A01 + CC); \ + A00 = T32(A00 + CB); \ + A0B = T32(A0B + CA); \ + A0A = T32(A0A + C9); \ + A09 = T32(A09 + C8); \ + A08 = T32(A08 + C7); \ + A07 = T32(A07 + C6); \ + A06 = T32(A06 + C5); \ + A05 = T32(A05 + C4); \ + A04 = T32(A04 + C3); \ + A03 = T32(A03 + C2); \ + A02 = T32(A02 + C1); \ + A01 = T32(A01 + C0); \ + A00 = T32(A00 + CF); \ + A0B = T32(A0B + CE); \ + A0A = T32(A0A + CD); \ + A09 = T32(A09 + CC); \ + A08 = T32(A08 + CB); \ + A07 = T32(A07 + CA); \ + A06 = T32(A06 + C9); \ + A05 = T32(A05 + C8); \ + A04 = T32(A04 + C7); \ + A03 = T32(A03 + C6); \ + A02 = T32(A02 + C5); \ + A01 = T32(A01 + C4); \ + A00 = T32(A00 + C3); \ + } while (0) + +#define INCR_W do { \ + if ((Wlow = T32(Wlow + 1)) == 0) \ + Whigh = T32(Whigh + 1); \ + } while (0) +#if 0 +static const sph_u32 A_init_192[] = { + C32(0xFD749ED4), C32(0xB798E530), C32(0x33904B6F), C32(0x46BDA85E), + C32(0x076934B4), C32(0x454B4058), C32(0x77F74527), C32(0xFB4CF465), + C32(0x62931DA9), C32(0xE778C8DB), C32(0x22B3998E), C32(0xAC15CFB9) +}; + +static const sph_u32 B_init_192[] = { + C32(0x58BCBAC4), C32(0xEC47A08E), C32(0xAEE933B2), C32(0xDFCBC824), + C32(0xA7944804), C32(0xBF65BDB0), C32(0x5A9D4502), C32(0x59979AF7), + C32(0xC5CEA54E), C32(0x4B6B8150), C32(0x16E71909), C32(0x7D632319), + C32(0x930573A0), C32(0xF34C63D1), C32(0xCAF914B4), C32(0xFDD6612C) +}; + +static const sph_u32 C_init_192[] = { + C32(0x61550878), C32(0x89EF2B75), C32(0xA1660C46), C32(0x7EF3855B), + C32(0x7297B58C), C32(0x1BC67793), C32(0x7FB1C723), C32(0xB66FC640), + C32(0x1A48B71C), C32(0xF0976D17), C32(0x088CE80A), C32(0xA454EDF3), + C32(0x1C096BF4), C32(0xAC76224B), C32(0x5215781C), C32(0xCD5D2669) +}; + +static const sph_u32 A_init_224[] = { + C32(0xA5201467), C32(0xA9B8D94A), C32(0xD4CED997), C32(0x68379D7B), + C32(0xA7FC73BA), C32(0xF1A2546B), C32(0x606782BF), C32(0xE0BCFD0F), + C32(0x2F25374E), C32(0x069A149F), C32(0x5E2DFF25), C32(0xFAECF061) +}; + +static const sph_u32 B_init_224[] = { + C32(0xEC9905D8), C32(0xF21850CF), C32(0xC0A746C8), C32(0x21DAD498), + C32(0x35156EEB), C32(0x088C97F2), C32(0x26303E40), C32(0x8A2D4FB5), + C32(0xFEEE44B6), C32(0x8A1E9573), C32(0x7B81111A), C32(0xCBC139F0), + C32(0xA3513861), C32(0x1D2C362E), C32(0x918C580E), C32(0xB58E1B9C) +}; + +static const sph_u32 C_init_224[] = { + C32(0xE4B573A1), C32(0x4C1A0880), C32(0x1E907C51), C32(0x04807EFD), + C32(0x3AD8CDE5), C32(0x16B21302), C32(0x02512C53), C32(0x2204CB18), + C32(0x99405F2D), C32(0xE5B648A1), C32(0x70AB1D43), C32(0xA10C25C2), + C32(0x16F1AC05), C32(0x38BBEB56), C32(0x9B01DC60), C32(0xB1096D83) +}; + +static const sph_u32 A_init_256[] = { + C32(0x52F84552), C32(0xE54B7999), C32(0x2D8EE3EC), C32(0xB9645191), + C32(0xE0078B86), C32(0xBB7C44C9), C32(0xD2B5C1CA), C32(0xB0D2EB8C), + C32(0x14CE5A45), C32(0x22AF50DC), C32(0xEFFDBC6B), C32(0xEB21B74A) +}; + +static const sph_u32 B_init_256[] = { + C32(0xB555C6EE), C32(0x3E710596), C32(0xA72A652F), C32(0x9301515F), + C32(0xDA28C1FA), C32(0x696FD868), C32(0x9CB6BF72), C32(0x0AFE4002), + C32(0xA6E03615), C32(0x5138C1D4), C32(0xBE216306), C32(0xB38B8890), + C32(0x3EA8B96B), C32(0x3299ACE4), C32(0x30924DD4), C32(0x55CB34A5) +}; + +static const sph_u32 C_init_256[] = { + C32(0xB405F031), C32(0xC4233EBA), C32(0xB3733979), C32(0xC0DD9D55), + C32(0xC51C28AE), C32(0xA327B8E1), C32(0x56C56167), C32(0xED614433), + C32(0x88B59D60), C32(0x60E2CEBA), C32(0x758B4B8B), C32(0x83E82A7F), + C32(0xBC968828), C32(0xE6E00BF7), C32(0xBA839E55), C32(0x9B491C60) +}; + +static const sph_u32 A_init_384[] = { + C32(0xC8FCA331), C32(0xE55C504E), C32(0x003EBF26), C32(0xBB6B8D83), + C32(0x7B0448C1), C32(0x41B82789), C32(0x0A7C9601), C32(0x8D659CFF), + C32(0xB6E2673E), C32(0xCA54C77B), C32(0x1460FD7E), C32(0x3FCB8F2D) +}; + +static const sph_u32 B_init_384[] = { + C32(0x527291FC), C32(0x2A16455F), C32(0x78E627E5), C32(0x944F169F), + C32(0x1CA6F016), C32(0xA854EA25), C32(0x8DB98ABE), C32(0xF2C62641), + C32(0x30117DCB), C32(0xCF5C4309), C32(0x93711A25), C32(0xF9F671B8), + C32(0xB01D2116), C32(0x333F4B89), C32(0xB285D165), C32(0x86829B36) +}; + +static const sph_u32 C_init_384[] = { + C32(0xF764B11A), C32(0x76172146), C32(0xCEF6934D), C32(0xC6D28399), + C32(0xFE095F61), C32(0x5E6018B4), C32(0x5048ECF5), C32(0x51353261), + C32(0x6E6E36DC), C32(0x63130DAD), C32(0xA9C69BD6), C32(0x1E90EA0C), + C32(0x7C35073B), C32(0x28D95E6D), C32(0xAA340E0D), C32(0xCB3DEE70) +}; +#endif +static const sph_u32 A_init_512[] = { + C32(0x20728DFD), C32(0x46C0BD53), C32(0xE782B699), C32(0x55304632), + C32(0x71B4EF90), C32(0x0EA9E82C), C32(0xDBB930F1), C32(0xFAD06B8B), + C32(0xBE0CAE40), C32(0x8BD14410), C32(0x76D2ADAC), C32(0x28ACAB7F) +}; + +static const sph_u32 B_init_512[] = { + C32(0xC1099CB7), C32(0x07B385F3), C32(0xE7442C26), C32(0xCC8AD640), + C32(0xEB6F56C7), C32(0x1EA81AA9), C32(0x73B9D314), C32(0x1DE85D08), + C32(0x48910A5A), C32(0x893B22DB), C32(0xC5A0DF44), C32(0xBBC4324E), + C32(0x72D2F240), C32(0x75941D99), C32(0x6D8BDE82), C32(0xA1A7502B) +}; + +static const sph_u32 C_init_512[] = { + C32(0xD9BF68D1), C32(0x58BAD750), C32(0x56028CB2), C32(0x8134F359), + C32(0xB5D469D8), C32(0x941A8CC2), C32(0x418B2A6E), C32(0x04052780), + C32(0x7F07D787), C32(0x5194358F), C32(0x3C60D665), C32(0xBE97D79A), + C32(0x950C3434), C32(0xAED9A06D), C32(0x2537DC8D), C32(0x7CDB5969) +}; + +/* END -- automatically generated code. */ + +static void +shabal_init(void *cc, unsigned size) +{ + /* + * We have precomputed initial states for all the supported + * output bit lengths. + */ + const sph_u32 *A_init, *B_init, *C_init; + sph_shabal_context *sc; + + switch (size) { +#if 0 + case 192: + A_init = A_init_192; + B_init = B_init_192; + C_init = C_init_192; + break; + case 224: + A_init = A_init_224; + B_init = B_init_224; + C_init = C_init_224; + break; + case 256: + A_init = A_init_256; + B_init = B_init_256; + C_init = C_init_256; + break; + case 384: + A_init = A_init_384; + B_init = B_init_384; + C_init = C_init_384; + break; +#endif + case 512: + A_init = A_init_512; + B_init = B_init_512; + C_init = C_init_512; + break; + default: + return; + } + sc = cc; + memcpy(sc->A, A_init, sizeof sc->A); + memcpy(sc->B, B_init, sizeof sc->B); + memcpy(sc->C, C_init, sizeof sc->C); + sc->Wlow = 1; + sc->Whigh = 0; + sc->ptr = 0; +} + +static void +shabal_core(void *cc, const unsigned char *data, size_t len) +{ + sph_shabal_context *sc; + unsigned char *buf; + size_t ptr; + DECL_STATE + + sc = cc; + buf = sc->buf; + ptr = sc->ptr; + + /* + * We do not want to copy the state to local variables if the + * amount of data is less than what is needed to complete the + * current block. Note that it is anyway suboptimal to call + * this method many times for small chunks of data. + */ + if (len < (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE(sc); + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data += clen; + len -= clen; + if (ptr == sizeof sc->buf) { + DECODE_BLOCK; + INPUT_BLOCK_ADD; + XOR_W; + APPLY_P; + INPUT_BLOCK_SUB; + SWAP_BC; + INCR_W; + ptr = 0; + } + } + WRITE_STATE(sc); + sc->ptr = ptr; +} + +static void +shabal_close(void *cc, unsigned ub, unsigned n, void *dst, unsigned size_words) +{ + sph_shabal_context *sc; + unsigned char *buf; + size_t ptr; + int i; + unsigned z; + union { + unsigned char tmp_out[64]; + sph_u32 dummy; + } u; + size_t out_len; + DECL_STATE + + sc = cc; + buf = sc->buf; + ptr = sc->ptr; + z = 0x80 >> n; + buf[ptr] = ((ub & -z) | z) & 0xFF; + memset(buf + ptr + 1, 0, (sizeof sc->buf) - (ptr + 1)); + READ_STATE(sc); + DECODE_BLOCK; + INPUT_BLOCK_ADD; + XOR_W; + APPLY_P; + for (i = 0; i < 3; i ++) { + SWAP_BC; + XOR_W; + APPLY_P; + } + + /* + * We just use our local variables; no need to go through + * the state structure. In order to share some code, we + * emit the relevant words into a temporary buffer, which + * we finally copy into the destination array. + */ + switch (size_words) { + case 16: + sph_enc32le_aligned(u.tmp_out + 0, B0); + sph_enc32le_aligned(u.tmp_out + 4, B1); + sph_enc32le_aligned(u.tmp_out + 8, B2); + sph_enc32le_aligned(u.tmp_out + 12, B3); + /* fall through */ + case 12: + sph_enc32le_aligned(u.tmp_out + 16, B4); + sph_enc32le_aligned(u.tmp_out + 20, B5); + sph_enc32le_aligned(u.tmp_out + 24, B6); + sph_enc32le_aligned(u.tmp_out + 28, B7); + /* fall through */ + case 8: + sph_enc32le_aligned(u.tmp_out + 32, B8); + /* fall through */ + case 7: + sph_enc32le_aligned(u.tmp_out + 36, B9); + /* fall through */ + case 6: + sph_enc32le_aligned(u.tmp_out + 40, BA); + sph_enc32le_aligned(u.tmp_out + 44, BB); + sph_enc32le_aligned(u.tmp_out + 48, BC); + sph_enc32le_aligned(u.tmp_out + 52, BD); + sph_enc32le_aligned(u.tmp_out + 56, BE); + sph_enc32le_aligned(u.tmp_out + 60, BF); + break; + default: + return; + } + out_len = size_words << 2; + memcpy(dst, u.tmp_out + (sizeof u.tmp_out) - out_len, out_len); + shabal_init(sc, size_words << 5); +} + +#if 0 +/* see sph_shabal.h */ +void +sph_shabal192_init(void *cc) +{ + shabal_init(cc, 192); +} + +/* see sph_shabal.h */ +void +sph_shabal192(void *cc, const void *data, size_t len) +{ + shabal_core(cc, data, len); +} + +/* see sph_shabal.h */ +void +sph_shabal192_close(void *cc, void *dst) +{ + shabal_close(cc, 0, 0, dst, 6); +} + +/* see sph_shabal.h */ +void +sph_shabal192_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shabal_close(cc, ub, n, dst, 6); +} + +/* see sph_shabal.h */ +void +sph_shabal224_init(void *cc) +{ + shabal_init(cc, 224); +} + +/* see sph_shabal.h */ +void +sph_shabal224(void *cc, const void *data, size_t len) +{ + shabal_core(cc, data, len); +} + +/* see sph_shabal.h */ +void +sph_shabal224_close(void *cc, void *dst) +{ + shabal_close(cc, 0, 0, dst, 7); +} + +/* see sph_shabal.h */ +void +sph_shabal224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shabal_close(cc, ub, n, dst, 7); +} + +/* see sph_shabal.h */ +void +sph_shabal256_init(void *cc) +{ + shabal_init(cc, 256); +} + +/* see sph_shabal.h */ +void +sph_shabal256(void *cc, const void *data, size_t len) +{ + shabal_core(cc, data, len); +} + +/* see sph_shabal.h */ +void +sph_shabal256_close(void *cc, void *dst) +{ + shabal_close(cc, 0, 0, dst, 8); +} + +/* see sph_shabal.h */ +void +sph_shabal256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shabal_close(cc, ub, n, dst, 8); +} + +/* see sph_shabal.h */ +void +sph_shabal384_init(void *cc) +{ + shabal_init(cc, 384); +} + +/* see sph_shabal.h */ +void +sph_shabal384(void *cc, const void *data, size_t len) +{ + shabal_core(cc, data, len); +} + +/* see sph_shabal.h */ +void +sph_shabal384_close(void *cc, void *dst) +{ + shabal_close(cc, 0, 0, dst, 12); +} + +/* see sph_shabal.h */ +void +sph_shabal384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shabal_close(cc, ub, n, dst, 12); +} + +#endif + +/* see sph_shabal.h */ +void +sph_shabal512_init(void *cc) +{ + shabal_init(cc, 512); +} + +/* see sph_shabal.h */ +void +sph_shabal512(void *cc, const void *data, size_t len) +{ + shabal_core(cc, data, len); +} + +/* see sph_shabal.h */ +void +sph_shabal512_close(void *cc, void *dst) +{ + shabal_close(cc, 0, 0, dst, 16); +} + +/* see sph_shabal.h */ +void +sph_shabal512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shabal_close(cc, ub, n, dst, 16); +} +#ifdef __cplusplus +} +#endif diff --git a/sph/shavite.c b/sph/shavite.c new file mode 100644 index 0000000..85074f3 --- /dev/null +++ b/sph/shavite.c @@ -0,0 +1,1764 @@ +/* $Id: shavite.c 227 2010-06-16 17:28:38Z tp $ */ +/* + * SHAvite-3 implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_shavite.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_SHAVITE +#define SPH_SMALL_FOOTPRINT_SHAVITE 1 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +#define C32 SPH_C32 + +/* + * As of round 2 of the SHA-3 competition, the published reference + * implementation and test vectors are wrong, because they use + * big-endian AES tables while the internal decoding uses little-endian. + * The code below follows the specification. To turn it into a code + * which follows the reference implementation (the one called "BugFix" + * on the SHAvite-3 web site, published on Nov 23rd, 2009), comment out + * the code below (from the '#define AES_BIG_ENDIAN...' to the definition + * of the AES_ROUND_NOKEY macro) and replace it with the version which + * is commented out afterwards. + */ + +#define AES_BIG_ENDIAN 0 +#include "aes_helper.c" + +static const sph_u32 IV224[] = { + C32(0x6774F31C), C32(0x990AE210), C32(0xC87D4274), C32(0xC9546371), + C32(0x62B2AEA8), C32(0x4B5801D8), C32(0x1B702860), C32(0x842F3017) +}; + +static const sph_u32 IV256[] = { + C32(0x49BB3E47), C32(0x2674860D), C32(0xA8B392AC), C32(0x021AC4E6), + C32(0x409283CF), C32(0x620E5D86), C32(0x6D929DCB), C32(0x96CC2A8B) +}; + +static const sph_u32 IV384[] = { + C32(0x83DF1545), C32(0xF9AAEC13), C32(0xF4803CB0), C32(0x11FE1F47), + C32(0xDA6CD269), C32(0x4F53FCD7), C32(0x950529A2), C32(0x97908147), + C32(0xB0A4D7AF), C32(0x2B9132BF), C32(0x226E607D), C32(0x3C0F8D7C), + C32(0x487B3F0F), C32(0x04363E22), C32(0x0155C99C), C32(0xEC2E20D3) +}; + +static const sph_u32 IV512[] = { + C32(0x72FCCDD8), C32(0x79CA4727), C32(0x128A077B), C32(0x40D55AEC), + C32(0xD1901A06), C32(0x430AE307), C32(0xB29F5CD1), C32(0xDF07FBFC), + C32(0x8E45D73D), C32(0x681AB538), C32(0xBDE86578), C32(0xDD577E47), + C32(0xE275EADE), C32(0x502D9FCD), C32(0xB9357178), C32(0x022A4B9A) +}; + +#define AES_ROUND_NOKEY(x0, x1, x2, x3) do { \ + sph_u32 t0 = (x0); \ + sph_u32 t1 = (x1); \ + sph_u32 t2 = (x2); \ + sph_u32 t3 = (x3); \ + AES_ROUND_NOKEY_LE(t0, t1, t2, t3, x0, x1, x2, x3); \ + } while (0) + +/* + * This is the code needed to match the "reference implementation" as + * published on Nov 23rd, 2009, instead of the published specification. + * + +#define AES_BIG_ENDIAN 1 +#include "aes_helper.c" + +static const sph_u32 IV224[] = { + C32(0xC4C67795), C32(0xC0B1817F), C32(0xEAD88924), C32(0x1ABB1BB0), + C32(0xE0C29152), C32(0xBDE046BA), C32(0xAEEECF99), C32(0x58D509D8) +}; + +static const sph_u32 IV256[] = { + C32(0x3EECF551), C32(0xBF10819B), C32(0xE6DC8559), C32(0xF3E23FD5), + C32(0x431AEC73), C32(0x79E3F731), C32(0x98325F05), C32(0xA92A31F1) +}; + +static const sph_u32 IV384[] = { + C32(0x71F48510), C32(0xA903A8AC), C32(0xFE3216DD), C32(0x0B2D2AD4), + C32(0x6672900A), C32(0x41032819), C32(0x15A7D780), C32(0xB3CAB8D9), + C32(0x34EF4711), C32(0xDE019FE8), C32(0x4D674DC4), C32(0xE056D96B), + C32(0xA35C016B), C32(0xDD903BA7), C32(0x8C1B09B4), C32(0x2C3E9F25) +}; + +static const sph_u32 IV512[] = { + C32(0xD5652B63), C32(0x25F1E6EA), C32(0xB18F48FA), C32(0xA1EE3A47), + C32(0xC8B67B07), C32(0xBDCE48D3), C32(0xE3937B78), C32(0x05DB5186), + C32(0x613BE326), C32(0xA11FA303), C32(0x90C833D4), C32(0x79CEE316), + C32(0x1E1AF00F), C32(0x2829B165), C32(0x23B25F80), C32(0x21E11499) +}; + +#define AES_ROUND_NOKEY(x0, x1, x2, x3) do { \ + sph_u32 t0 = (x0); \ + sph_u32 t1 = (x1); \ + sph_u32 t2 = (x2); \ + sph_u32 t3 = (x3); \ + AES_ROUND_NOKEY_BE(t0, t1, t2, t3, x0, x1, x2, x3); \ + } while (0) + + */ + +#define KEY_EXPAND_ELT(k0, k1, k2, k3) do { \ + sph_u32 kt; \ + AES_ROUND_NOKEY(k1, k2, k3, k0); \ + kt = (k0); \ + (k0) = (k1); \ + (k1) = (k2); \ + (k2) = (k3); \ + (k3) = kt; \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_SHAVITE + +/* + * This function assumes that "msg" is aligned for 32-bit access. + */ +static void +c256(sph_shavite_small_context *sc, const void *msg) +{ + sph_u32 p0, p1, p2, p3, p4, p5, p6, p7; + sph_u32 rk[144]; + size_t u; + int r, s; + +#if SPH_LITTLE_ENDIAN + memcpy(rk, msg, 64); +#else + for (u = 0; u < 16; u += 4) { + rk[u + 0] = sph_dec32le_aligned( + (const unsigned char *)msg + (u << 2) + 0); + rk[u + 1] = sph_dec32le_aligned( + (const unsigned char *)msg + (u << 2) + 4); + rk[u + 2] = sph_dec32le_aligned( + (const unsigned char *)msg + (u << 2) + 8); + rk[u + 3] = sph_dec32le_aligned( + (const unsigned char *)msg + (u << 2) + 12); + } +#endif + u = 16; + for (r = 0; r < 4; r ++) { + for (s = 0; s < 2; s ++) { + sph_u32 x0, x1, x2, x3; + + x0 = rk[u - 15]; + x1 = rk[u - 14]; + x2 = rk[u - 13]; + x3 = rk[u - 16]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk[u + 0] = x0 ^ rk[u - 4]; + rk[u + 1] = x1 ^ rk[u - 3]; + rk[u + 2] = x2 ^ rk[u - 2]; + rk[u + 3] = x3 ^ rk[u - 1]; + if (u == 16) { + rk[ 16] ^= sc->count0; + rk[ 17] ^= SPH_T32(~sc->count1); + } else if (u == 56) { + rk[ 57] ^= sc->count1; + rk[ 58] ^= SPH_T32(~sc->count0); + } + u += 4; + + x0 = rk[u - 15]; + x1 = rk[u - 14]; + x2 = rk[u - 13]; + x3 = rk[u - 16]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk[u + 0] = x0 ^ rk[u - 4]; + rk[u + 1] = x1 ^ rk[u - 3]; + rk[u + 2] = x2 ^ rk[u - 2]; + rk[u + 3] = x3 ^ rk[u - 1]; + if (u == 84) { + rk[ 86] ^= sc->count1; + rk[ 87] ^= SPH_T32(~sc->count0); + } else if (u == 124) { + rk[124] ^= sc->count0; + rk[127] ^= SPH_T32(~sc->count1); + } + u += 4; + } + for (s = 0; s < 4; s ++) { + rk[u + 0] = rk[u - 16] ^ rk[u - 3]; + rk[u + 1] = rk[u - 15] ^ rk[u - 2]; + rk[u + 2] = rk[u - 14] ^ rk[u - 1]; + rk[u + 3] = rk[u - 13] ^ rk[u - 0]; + u += 4; + } + } + + p0 = sc->h[0x0]; + p1 = sc->h[0x1]; + p2 = sc->h[0x2]; + p3 = sc->h[0x3]; + p4 = sc->h[0x4]; + p5 = sc->h[0x5]; + p6 = sc->h[0x6]; + p7 = sc->h[0x7]; + u = 0; + for (r = 0; r < 6; r ++) { + sph_u32 x0, x1, x2, x3; + + x0 = p4 ^ rk[u ++]; + x1 = p5 ^ rk[u ++]; + x2 = p6 ^ rk[u ++]; + x3 = p7 ^ rk[u ++]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + x0 ^= rk[u ++]; + x1 ^= rk[u ++]; + x2 ^= rk[u ++]; + x3 ^= rk[u ++]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + x0 ^= rk[u ++]; + x1 ^= rk[u ++]; + x2 ^= rk[u ++]; + x3 ^= rk[u ++]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + + x0 = p0 ^ rk[u ++]; + x1 = p1 ^ rk[u ++]; + x2 = p2 ^ rk[u ++]; + x3 = p3 ^ rk[u ++]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + x0 ^= rk[u ++]; + x1 ^= rk[u ++]; + x2 ^= rk[u ++]; + x3 ^= rk[u ++]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + x0 ^= rk[u ++]; + x1 ^= rk[u ++]; + x2 ^= rk[u ++]; + x3 ^= rk[u ++]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + } + sc->h[0x0] ^= p0; + sc->h[0x1] ^= p1; + sc->h[0x2] ^= p2; + sc->h[0x3] ^= p3; + sc->h[0x4] ^= p4; + sc->h[0x5] ^= p5; + sc->h[0x6] ^= p6; + sc->h[0x7] ^= p7; +} + +#else + +/* + * This function assumes that "msg" is aligned for 32-bit access. + */ +static void +c256(sph_shavite_small_context *sc, const void *msg) +{ + sph_u32 p0, p1, p2, p3, p4, p5, p6, p7; + sph_u32 x0, x1, x2, x3; + sph_u32 rk0, rk1, rk2, rk3, rk4, rk5, rk6, rk7; + sph_u32 rk8, rk9, rkA, rkB, rkC, rkD, rkE, rkF; + + p0 = sc->h[0x0]; + p1 = sc->h[0x1]; + p2 = sc->h[0x2]; + p3 = sc->h[0x3]; + p4 = sc->h[0x4]; + p5 = sc->h[0x5]; + p6 = sc->h[0x6]; + p7 = sc->h[0x7]; + /* round 0 */ + rk0 = sph_dec32le_aligned((const unsigned char *)msg + 0); + x0 = p4 ^ rk0; + rk1 = sph_dec32le_aligned((const unsigned char *)msg + 4); + x1 = p5 ^ rk1; + rk2 = sph_dec32le_aligned((const unsigned char *)msg + 8); + x2 = p6 ^ rk2; + rk3 = sph_dec32le_aligned((const unsigned char *)msg + 12); + x3 = p7 ^ rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk4 = sph_dec32le_aligned((const unsigned char *)msg + 16); + x0 ^= rk4; + rk5 = sph_dec32le_aligned((const unsigned char *)msg + 20); + x1 ^= rk5; + rk6 = sph_dec32le_aligned((const unsigned char *)msg + 24); + x2 ^= rk6; + rk7 = sph_dec32le_aligned((const unsigned char *)msg + 28); + x3 ^= rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk8 = sph_dec32le_aligned((const unsigned char *)msg + 32); + x0 ^= rk8; + rk9 = sph_dec32le_aligned((const unsigned char *)msg + 36); + x1 ^= rk9; + rkA = sph_dec32le_aligned((const unsigned char *)msg + 40); + x2 ^= rkA; + rkB = sph_dec32le_aligned((const unsigned char *)msg + 44); + x3 ^= rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + /* round 1 */ + rkC = sph_dec32le_aligned((const unsigned char *)msg + 48); + x0 = p0 ^ rkC; + rkD = sph_dec32le_aligned((const unsigned char *)msg + 52); + x1 = p1 ^ rkD; + rkE = sph_dec32le_aligned((const unsigned char *)msg + 56); + x2 = p2 ^ rkE; + rkF = sph_dec32le_aligned((const unsigned char *)msg + 60); + x3 = p3 ^ rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk0, rk1, rk2, rk3); + rk0 ^= rkC ^ sc->count0; + rk1 ^= rkD ^ SPH_T32(~sc->count1); + rk2 ^= rkE; + rk3 ^= rkF; + x0 ^= rk0; + x1 ^= rk1; + x2 ^= rk2; + x3 ^= rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk4, rk5, rk6, rk7); + rk4 ^= rk0; + rk5 ^= rk1; + rk6 ^= rk2; + rk7 ^= rk3; + x0 ^= rk4; + x1 ^= rk5; + x2 ^= rk6; + x3 ^= rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + /* round 2 */ + KEY_EXPAND_ELT(rk8, rk9, rkA, rkB); + rk8 ^= rk4; + rk9 ^= rk5; + rkA ^= rk6; + rkB ^= rk7; + x0 = p4 ^ rk8; + x1 = p5 ^ rk9; + x2 = p6 ^ rkA; + x3 = p7 ^ rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rkC, rkD, rkE, rkF); + rkC ^= rk8; + rkD ^= rk9; + rkE ^= rkA; + rkF ^= rkB; + x0 ^= rkC; + x1 ^= rkD; + x2 ^= rkE; + x3 ^= rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk0 ^= rkD; + x0 ^= rk0; + rk1 ^= rkE; + x1 ^= rk1; + rk2 ^= rkF; + x2 ^= rk2; + rk3 ^= rk0; + x3 ^= rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + /* round 3 */ + rk4 ^= rk1; + x0 = p0 ^ rk4; + rk5 ^= rk2; + x1 = p1 ^ rk5; + rk6 ^= rk3; + x2 = p2 ^ rk6; + rk7 ^= rk4; + x3 = p3 ^ rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk8 ^= rk5; + x0 ^= rk8; + rk9 ^= rk6; + x1 ^= rk9; + rkA ^= rk7; + x2 ^= rkA; + rkB ^= rk8; + x3 ^= rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rkC ^= rk9; + x0 ^= rkC; + rkD ^= rkA; + x1 ^= rkD; + rkE ^= rkB; + x2 ^= rkE; + rkF ^= rkC; + x3 ^= rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + /* round 4 */ + KEY_EXPAND_ELT(rk0, rk1, rk2, rk3); + rk0 ^= rkC; + rk1 ^= rkD; + rk2 ^= rkE; + rk3 ^= rkF; + x0 = p4 ^ rk0; + x1 = p5 ^ rk1; + x2 = p6 ^ rk2; + x3 = p7 ^ rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk4, rk5, rk6, rk7); + rk4 ^= rk0; + rk5 ^= rk1; + rk6 ^= rk2; + rk7 ^= rk3; + x0 ^= rk4; + x1 ^= rk5; + x2 ^= rk6; + x3 ^= rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk8, rk9, rkA, rkB); + rk8 ^= rk4; + rk9 ^= rk5 ^ sc->count1; + rkA ^= rk6 ^ SPH_T32(~sc->count0); + rkB ^= rk7; + x0 ^= rk8; + x1 ^= rk9; + x2 ^= rkA; + x3 ^= rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + /* round 5 */ + KEY_EXPAND_ELT(rkC, rkD, rkE, rkF); + rkC ^= rk8; + rkD ^= rk9; + rkE ^= rkA; + rkF ^= rkB; + x0 = p0 ^ rkC; + x1 = p1 ^ rkD; + x2 = p2 ^ rkE; + x3 = p3 ^ rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk0 ^= rkD; + x0 ^= rk0; + rk1 ^= rkE; + x1 ^= rk1; + rk2 ^= rkF; + x2 ^= rk2; + rk3 ^= rk0; + x3 ^= rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk4 ^= rk1; + x0 ^= rk4; + rk5 ^= rk2; + x1 ^= rk5; + rk6 ^= rk3; + x2 ^= rk6; + rk7 ^= rk4; + x3 ^= rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + /* round 6 */ + rk8 ^= rk5; + x0 = p4 ^ rk8; + rk9 ^= rk6; + x1 = p5 ^ rk9; + rkA ^= rk7; + x2 = p6 ^ rkA; + rkB ^= rk8; + x3 = p7 ^ rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rkC ^= rk9; + x0 ^= rkC; + rkD ^= rkA; + x1 ^= rkD; + rkE ^= rkB; + x2 ^= rkE; + rkF ^= rkC; + x3 ^= rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk0, rk1, rk2, rk3); + rk0 ^= rkC; + rk1 ^= rkD; + rk2 ^= rkE; + rk3 ^= rkF; + x0 ^= rk0; + x1 ^= rk1; + x2 ^= rk2; + x3 ^= rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + /* round 7 */ + KEY_EXPAND_ELT(rk4, rk5, rk6, rk7); + rk4 ^= rk0; + rk5 ^= rk1; + rk6 ^= rk2 ^ sc->count1; + rk7 ^= rk3 ^ SPH_T32(~sc->count0); + x0 = p0 ^ rk4; + x1 = p1 ^ rk5; + x2 = p2 ^ rk6; + x3 = p3 ^ rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk8, rk9, rkA, rkB); + rk8 ^= rk4; + rk9 ^= rk5; + rkA ^= rk6; + rkB ^= rk7; + x0 ^= rk8; + x1 ^= rk9; + x2 ^= rkA; + x3 ^= rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rkC, rkD, rkE, rkF); + rkC ^= rk8; + rkD ^= rk9; + rkE ^= rkA; + rkF ^= rkB; + x0 ^= rkC; + x1 ^= rkD; + x2 ^= rkE; + x3 ^= rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + /* round 8 */ + rk0 ^= rkD; + x0 = p4 ^ rk0; + rk1 ^= rkE; + x1 = p5 ^ rk1; + rk2 ^= rkF; + x2 = p6 ^ rk2; + rk3 ^= rk0; + x3 = p7 ^ rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk4 ^= rk1; + x0 ^= rk4; + rk5 ^= rk2; + x1 ^= rk5; + rk6 ^= rk3; + x2 ^= rk6; + rk7 ^= rk4; + x3 ^= rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk8 ^= rk5; + x0 ^= rk8; + rk9 ^= rk6; + x1 ^= rk9; + rkA ^= rk7; + x2 ^= rkA; + rkB ^= rk8; + x3 ^= rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + /* round 9 */ + rkC ^= rk9; + x0 = p0 ^ rkC; + rkD ^= rkA; + x1 = p1 ^ rkD; + rkE ^= rkB; + x2 = p2 ^ rkE; + rkF ^= rkC; + x3 = p3 ^ rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk0, rk1, rk2, rk3); + rk0 ^= rkC; + rk1 ^= rkD; + rk2 ^= rkE; + rk3 ^= rkF; + x0 ^= rk0; + x1 ^= rk1; + x2 ^= rk2; + x3 ^= rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk4, rk5, rk6, rk7); + rk4 ^= rk0; + rk5 ^= rk1; + rk6 ^= rk2; + rk7 ^= rk3; + x0 ^= rk4; + x1 ^= rk5; + x2 ^= rk6; + x3 ^= rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + /* round 10 */ + KEY_EXPAND_ELT(rk8, rk9, rkA, rkB); + rk8 ^= rk4; + rk9 ^= rk5; + rkA ^= rk6; + rkB ^= rk7; + x0 = p4 ^ rk8; + x1 = p5 ^ rk9; + x2 = p6 ^ rkA; + x3 = p7 ^ rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rkC, rkD, rkE, rkF); + rkC ^= rk8 ^ sc->count0; + rkD ^= rk9; + rkE ^= rkA; + rkF ^= rkB ^ SPH_T32(~sc->count1); + x0 ^= rkC; + x1 ^= rkD; + x2 ^= rkE; + x3 ^= rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk0 ^= rkD; + x0 ^= rk0; + rk1 ^= rkE; + x1 ^= rk1; + rk2 ^= rkF; + x2 ^= rk2; + rk3 ^= rk0; + x3 ^= rk3; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + /* round 11 */ + rk4 ^= rk1; + x0 = p0 ^ rk4; + rk5 ^= rk2; + x1 = p1 ^ rk5; + rk6 ^= rk3; + x2 = p2 ^ rk6; + rk7 ^= rk4; + x3 = p3 ^ rk7; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk8 ^= rk5; + x0 ^= rk8; + rk9 ^= rk6; + x1 ^= rk9; + rkA ^= rk7; + x2 ^= rkA; + rkB ^= rk8; + x3 ^= rkB; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rkC ^= rk9; + x0 ^= rkC; + rkD ^= rkA; + x1 ^= rkD; + rkE ^= rkB; + x2 ^= rkE; + rkF ^= rkC; + x3 ^= rkF; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + sc->h[0x0] ^= p0; + sc->h[0x1] ^= p1; + sc->h[0x2] ^= p2; + sc->h[0x3] ^= p3; + sc->h[0x4] ^= p4; + sc->h[0x5] ^= p5; + sc->h[0x6] ^= p6; + sc->h[0x7] ^= p7; +} + +#endif + +#if SPH_SMALL_FOOTPRINT_SHAVITE + +/* + * This function assumes that "msg" is aligned for 32-bit access. + */ +static void +c512(sph_shavite_big_context *sc, const void *msg) +{ + sph_u32 p0, p1, p2, p3, p4, p5, p6, p7; + sph_u32 p8, p9, pA, pB, pC, pD, pE, pF; + sph_u32 rk[448]; + size_t u; + int r, s; + +#if SPH_LITTLE_ENDIAN + memcpy(rk, msg, 128); +#else + for (u = 0; u < 32; u += 4) { + rk[u + 0] = sph_dec32le_aligned( + (const unsigned char *)msg + (u << 2) + 0); + rk[u + 1] = sph_dec32le_aligned( + (const unsigned char *)msg + (u << 2) + 4); + rk[u + 2] = sph_dec32le_aligned( + (const unsigned char *)msg + (u << 2) + 8); + rk[u + 3] = sph_dec32le_aligned( + (const unsigned char *)msg + (u << 2) + 12); + } +#endif + u = 32; + for (;;) { + for (s = 0; s < 4; s ++) { + sph_u32 x0, x1, x2, x3; + + x0 = rk[u - 31]; + x1 = rk[u - 30]; + x2 = rk[u - 29]; + x3 = rk[u - 32]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk[u + 0] = x0 ^ rk[u - 4]; + rk[u + 1] = x1 ^ rk[u - 3]; + rk[u + 2] = x2 ^ rk[u - 2]; + rk[u + 3] = x3 ^ rk[u - 1]; + if (u == 32) { + rk[ 32] ^= sc->count0; + rk[ 33] ^= sc->count1; + rk[ 34] ^= sc->count2; + rk[ 35] ^= SPH_T32(~sc->count3); + } else if (u == 440) { + rk[440] ^= sc->count1; + rk[441] ^= sc->count0; + rk[442] ^= sc->count3; + rk[443] ^= SPH_T32(~sc->count2); + } + u += 4; + + x0 = rk[u - 31]; + x1 = rk[u - 30]; + x2 = rk[u - 29]; + x3 = rk[u - 32]; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk[u + 0] = x0 ^ rk[u - 4]; + rk[u + 1] = x1 ^ rk[u - 3]; + rk[u + 2] = x2 ^ rk[u - 2]; + rk[u + 3] = x3 ^ rk[u - 1]; + if (u == 164) { + rk[164] ^= sc->count3; + rk[165] ^= sc->count2; + rk[166] ^= sc->count1; + rk[167] ^= SPH_T32(~sc->count0); + } else if (u == 316) { + rk[316] ^= sc->count2; + rk[317] ^= sc->count3; + rk[318] ^= sc->count0; + rk[319] ^= SPH_T32(~sc->count1); + } + u += 4; + } + if (u == 448) + break; + for (s = 0; s < 8; s ++) { + rk[u + 0] = rk[u - 32] ^ rk[u - 7]; + rk[u + 1] = rk[u - 31] ^ rk[u - 6]; + rk[u + 2] = rk[u - 30] ^ rk[u - 5]; + rk[u + 3] = rk[u - 29] ^ rk[u - 4]; + u += 4; + } + } + + p0 = sc->h[0x0]; + p1 = sc->h[0x1]; + p2 = sc->h[0x2]; + p3 = sc->h[0x3]; + p4 = sc->h[0x4]; + p5 = sc->h[0x5]; + p6 = sc->h[0x6]; + p7 = sc->h[0x7]; + p8 = sc->h[0x8]; + p9 = sc->h[0x9]; + pA = sc->h[0xA]; + pB = sc->h[0xB]; + pC = sc->h[0xC]; + pD = sc->h[0xD]; + pE = sc->h[0xE]; + pF = sc->h[0xF]; + u = 0; + for (r = 0; r < 14; r ++) { +#define C512_ELT(l0, l1, l2, l3, r0, r1, r2, r3) do { \ + sph_u32 x0, x1, x2, x3; \ + x0 = r0 ^ rk[u ++]; \ + x1 = r1 ^ rk[u ++]; \ + x2 = r2 ^ rk[u ++]; \ + x3 = r3 ^ rk[u ++]; \ + AES_ROUND_NOKEY(x0, x1, x2, x3); \ + x0 ^= rk[u ++]; \ + x1 ^= rk[u ++]; \ + x2 ^= rk[u ++]; \ + x3 ^= rk[u ++]; \ + AES_ROUND_NOKEY(x0, x1, x2, x3); \ + x0 ^= rk[u ++]; \ + x1 ^= rk[u ++]; \ + x2 ^= rk[u ++]; \ + x3 ^= rk[u ++]; \ + AES_ROUND_NOKEY(x0, x1, x2, x3); \ + x0 ^= rk[u ++]; \ + x1 ^= rk[u ++]; \ + x2 ^= rk[u ++]; \ + x3 ^= rk[u ++]; \ + AES_ROUND_NOKEY(x0, x1, x2, x3); \ + l0 ^= x0; \ + l1 ^= x1; \ + l2 ^= x2; \ + l3 ^= x3; \ + } while (0) + +#define WROT(a, b, c, d) do { \ + sph_u32 t = d; \ + d = c; \ + c = b; \ + b = a; \ + a = t; \ + } while (0) + + C512_ELT(p0, p1, p2, p3, p4, p5, p6, p7); + C512_ELT(p8, p9, pA, pB, pC, pD, pE, pF); + + WROT(p0, p4, p8, pC); + WROT(p1, p5, p9, pD); + WROT(p2, p6, pA, pE); + WROT(p3, p7, pB, pF); + +#undef C512_ELT +#undef WROT + } + sc->h[0x0] ^= p0; + sc->h[0x1] ^= p1; + sc->h[0x2] ^= p2; + sc->h[0x3] ^= p3; + sc->h[0x4] ^= p4; + sc->h[0x5] ^= p5; + sc->h[0x6] ^= p6; + sc->h[0x7] ^= p7; + sc->h[0x8] ^= p8; + sc->h[0x9] ^= p9; + sc->h[0xA] ^= pA; + sc->h[0xB] ^= pB; + sc->h[0xC] ^= pC; + sc->h[0xD] ^= pD; + sc->h[0xE] ^= pE; + sc->h[0xF] ^= pF; +} + +#else + +/* + * This function assumes that "msg" is aligned for 32-bit access. + */ +static void +c512(sph_shavite_big_context *sc, const void *msg) +{ + sph_u32 p0, p1, p2, p3, p4, p5, p6, p7; + sph_u32 p8, p9, pA, pB, pC, pD, pE, pF; + sph_u32 x0, x1, x2, x3; + sph_u32 rk00, rk01, rk02, rk03, rk04, rk05, rk06, rk07; + sph_u32 rk08, rk09, rk0A, rk0B, rk0C, rk0D, rk0E, rk0F; + sph_u32 rk10, rk11, rk12, rk13, rk14, rk15, rk16, rk17; + sph_u32 rk18, rk19, rk1A, rk1B, rk1C, rk1D, rk1E, rk1F; + int r; + + p0 = sc->h[0x0]; + p1 = sc->h[0x1]; + p2 = sc->h[0x2]; + p3 = sc->h[0x3]; + p4 = sc->h[0x4]; + p5 = sc->h[0x5]; + p6 = sc->h[0x6]; + p7 = sc->h[0x7]; + p8 = sc->h[0x8]; + p9 = sc->h[0x9]; + pA = sc->h[0xA]; + pB = sc->h[0xB]; + pC = sc->h[0xC]; + pD = sc->h[0xD]; + pE = sc->h[0xE]; + pF = sc->h[0xF]; + /* round 0 */ + rk00 = sph_dec32le_aligned((const unsigned char *)msg + 0); + x0 = p4 ^ rk00; + rk01 = sph_dec32le_aligned((const unsigned char *)msg + 4); + x1 = p5 ^ rk01; + rk02 = sph_dec32le_aligned((const unsigned char *)msg + 8); + x2 = p6 ^ rk02; + rk03 = sph_dec32le_aligned((const unsigned char *)msg + 12); + x3 = p7 ^ rk03; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk04 = sph_dec32le_aligned((const unsigned char *)msg + 16); + x0 ^= rk04; + rk05 = sph_dec32le_aligned((const unsigned char *)msg + 20); + x1 ^= rk05; + rk06 = sph_dec32le_aligned((const unsigned char *)msg + 24); + x2 ^= rk06; + rk07 = sph_dec32le_aligned((const unsigned char *)msg + 28); + x3 ^= rk07; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk08 = sph_dec32le_aligned((const unsigned char *)msg + 32); + x0 ^= rk08; + rk09 = sph_dec32le_aligned((const unsigned char *)msg + 36); + x1 ^= rk09; + rk0A = sph_dec32le_aligned((const unsigned char *)msg + 40); + x2 ^= rk0A; + rk0B = sph_dec32le_aligned((const unsigned char *)msg + 44); + x3 ^= rk0B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk0C = sph_dec32le_aligned((const unsigned char *)msg + 48); + x0 ^= rk0C; + rk0D = sph_dec32le_aligned((const unsigned char *)msg + 52); + x1 ^= rk0D; + rk0E = sph_dec32le_aligned((const unsigned char *)msg + 56); + x2 ^= rk0E; + rk0F = sph_dec32le_aligned((const unsigned char *)msg + 60); + x3 ^= rk0F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + rk10 = sph_dec32le_aligned((const unsigned char *)msg + 64); + x0 = pC ^ rk10; + rk11 = sph_dec32le_aligned((const unsigned char *)msg + 68); + x1 = pD ^ rk11; + rk12 = sph_dec32le_aligned((const unsigned char *)msg + 72); + x2 = pE ^ rk12; + rk13 = sph_dec32le_aligned((const unsigned char *)msg + 76); + x3 = pF ^ rk13; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk14 = sph_dec32le_aligned((const unsigned char *)msg + 80); + x0 ^= rk14; + rk15 = sph_dec32le_aligned((const unsigned char *)msg + 84); + x1 ^= rk15; + rk16 = sph_dec32le_aligned((const unsigned char *)msg + 88); + x2 ^= rk16; + rk17 = sph_dec32le_aligned((const unsigned char *)msg + 92); + x3 ^= rk17; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk18 = sph_dec32le_aligned((const unsigned char *)msg + 96); + x0 ^= rk18; + rk19 = sph_dec32le_aligned((const unsigned char *)msg + 100); + x1 ^= rk19; + rk1A = sph_dec32le_aligned((const unsigned char *)msg + 104); + x2 ^= rk1A; + rk1B = sph_dec32le_aligned((const unsigned char *)msg + 108); + x3 ^= rk1B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk1C = sph_dec32le_aligned((const unsigned char *)msg + 112); + x0 ^= rk1C; + rk1D = sph_dec32le_aligned((const unsigned char *)msg + 116); + x1 ^= rk1D; + rk1E = sph_dec32le_aligned((const unsigned char *)msg + 120); + x2 ^= rk1E; + rk1F = sph_dec32le_aligned((const unsigned char *)msg + 124); + x3 ^= rk1F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p8 ^= x0; + p9 ^= x1; + pA ^= x2; + pB ^= x3; + + for (r = 0; r < 3; r ++) { + /* round 1, 5, 9 */ + KEY_EXPAND_ELT(rk00, rk01, rk02, rk03); + rk00 ^= rk1C; + rk01 ^= rk1D; + rk02 ^= rk1E; + rk03 ^= rk1F; + if (r == 0) { + rk00 ^= sc->count0; + rk01 ^= sc->count1; + rk02 ^= sc->count2; + rk03 ^= SPH_T32(~sc->count3); + } + x0 = p0 ^ rk00; + x1 = p1 ^ rk01; + x2 = p2 ^ rk02; + x3 = p3 ^ rk03; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk04, rk05, rk06, rk07); + rk04 ^= rk00; + rk05 ^= rk01; + rk06 ^= rk02; + rk07 ^= rk03; + if (r == 1) { + rk04 ^= sc->count3; + rk05 ^= sc->count2; + rk06 ^= sc->count1; + rk07 ^= SPH_T32(~sc->count0); + } + x0 ^= rk04; + x1 ^= rk05; + x2 ^= rk06; + x3 ^= rk07; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk08, rk09, rk0A, rk0B); + rk08 ^= rk04; + rk09 ^= rk05; + rk0A ^= rk06; + rk0B ^= rk07; + x0 ^= rk08; + x1 ^= rk09; + x2 ^= rk0A; + x3 ^= rk0B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk0C, rk0D, rk0E, rk0F); + rk0C ^= rk08; + rk0D ^= rk09; + rk0E ^= rk0A; + rk0F ^= rk0B; + x0 ^= rk0C; + x1 ^= rk0D; + x2 ^= rk0E; + x3 ^= rk0F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + pC ^= x0; + pD ^= x1; + pE ^= x2; + pF ^= x3; + KEY_EXPAND_ELT(rk10, rk11, rk12, rk13); + rk10 ^= rk0C; + rk11 ^= rk0D; + rk12 ^= rk0E; + rk13 ^= rk0F; + x0 = p8 ^ rk10; + x1 = p9 ^ rk11; + x2 = pA ^ rk12; + x3 = pB ^ rk13; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk14, rk15, rk16, rk17); + rk14 ^= rk10; + rk15 ^= rk11; + rk16 ^= rk12; + rk17 ^= rk13; + x0 ^= rk14; + x1 ^= rk15; + x2 ^= rk16; + x3 ^= rk17; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk18, rk19, rk1A, rk1B); + rk18 ^= rk14; + rk19 ^= rk15; + rk1A ^= rk16; + rk1B ^= rk17; + x0 ^= rk18; + x1 ^= rk19; + x2 ^= rk1A; + x3 ^= rk1B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk1C, rk1D, rk1E, rk1F); + rk1C ^= rk18; + rk1D ^= rk19; + rk1E ^= rk1A; + rk1F ^= rk1B; + if (r == 2) { + rk1C ^= sc->count2; + rk1D ^= sc->count3; + rk1E ^= sc->count0; + rk1F ^= SPH_T32(~sc->count1); + } + x0 ^= rk1C; + x1 ^= rk1D; + x2 ^= rk1E; + x3 ^= rk1F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + /* round 2, 6, 10 */ + rk00 ^= rk19; + x0 = pC ^ rk00; + rk01 ^= rk1A; + x1 = pD ^ rk01; + rk02 ^= rk1B; + x2 = pE ^ rk02; + rk03 ^= rk1C; + x3 = pF ^ rk03; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk04 ^= rk1D; + x0 ^= rk04; + rk05 ^= rk1E; + x1 ^= rk05; + rk06 ^= rk1F; + x2 ^= rk06; + rk07 ^= rk00; + x3 ^= rk07; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk08 ^= rk01; + x0 ^= rk08; + rk09 ^= rk02; + x1 ^= rk09; + rk0A ^= rk03; + x2 ^= rk0A; + rk0B ^= rk04; + x3 ^= rk0B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk0C ^= rk05; + x0 ^= rk0C; + rk0D ^= rk06; + x1 ^= rk0D; + rk0E ^= rk07; + x2 ^= rk0E; + rk0F ^= rk08; + x3 ^= rk0F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p8 ^= x0; + p9 ^= x1; + pA ^= x2; + pB ^= x3; + rk10 ^= rk09; + x0 = p4 ^ rk10; + rk11 ^= rk0A; + x1 = p5 ^ rk11; + rk12 ^= rk0B; + x2 = p6 ^ rk12; + rk13 ^= rk0C; + x3 = p7 ^ rk13; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk14 ^= rk0D; + x0 ^= rk14; + rk15 ^= rk0E; + x1 ^= rk15; + rk16 ^= rk0F; + x2 ^= rk16; + rk17 ^= rk10; + x3 ^= rk17; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk18 ^= rk11; + x0 ^= rk18; + rk19 ^= rk12; + x1 ^= rk19; + rk1A ^= rk13; + x2 ^= rk1A; + rk1B ^= rk14; + x3 ^= rk1B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk1C ^= rk15; + x0 ^= rk1C; + rk1D ^= rk16; + x1 ^= rk1D; + rk1E ^= rk17; + x2 ^= rk1E; + rk1F ^= rk18; + x3 ^= rk1F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + /* round 3, 7, 11 */ + KEY_EXPAND_ELT(rk00, rk01, rk02, rk03); + rk00 ^= rk1C; + rk01 ^= rk1D; + rk02 ^= rk1E; + rk03 ^= rk1F; + x0 = p8 ^ rk00; + x1 = p9 ^ rk01; + x2 = pA ^ rk02; + x3 = pB ^ rk03; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk04, rk05, rk06, rk07); + rk04 ^= rk00; + rk05 ^= rk01; + rk06 ^= rk02; + rk07 ^= rk03; + x0 ^= rk04; + x1 ^= rk05; + x2 ^= rk06; + x3 ^= rk07; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk08, rk09, rk0A, rk0B); + rk08 ^= rk04; + rk09 ^= rk05; + rk0A ^= rk06; + rk0B ^= rk07; + x0 ^= rk08; + x1 ^= rk09; + x2 ^= rk0A; + x3 ^= rk0B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk0C, rk0D, rk0E, rk0F); + rk0C ^= rk08; + rk0D ^= rk09; + rk0E ^= rk0A; + rk0F ^= rk0B; + x0 ^= rk0C; + x1 ^= rk0D; + x2 ^= rk0E; + x3 ^= rk0F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + KEY_EXPAND_ELT(rk10, rk11, rk12, rk13); + rk10 ^= rk0C; + rk11 ^= rk0D; + rk12 ^= rk0E; + rk13 ^= rk0F; + x0 = p0 ^ rk10; + x1 = p1 ^ rk11; + x2 = p2 ^ rk12; + x3 = p3 ^ rk13; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk14, rk15, rk16, rk17); + rk14 ^= rk10; + rk15 ^= rk11; + rk16 ^= rk12; + rk17 ^= rk13; + x0 ^= rk14; + x1 ^= rk15; + x2 ^= rk16; + x3 ^= rk17; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk18, rk19, rk1A, rk1B); + rk18 ^= rk14; + rk19 ^= rk15; + rk1A ^= rk16; + rk1B ^= rk17; + x0 ^= rk18; + x1 ^= rk19; + x2 ^= rk1A; + x3 ^= rk1B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk1C, rk1D, rk1E, rk1F); + rk1C ^= rk18; + rk1D ^= rk19; + rk1E ^= rk1A; + rk1F ^= rk1B; + x0 ^= rk1C; + x1 ^= rk1D; + x2 ^= rk1E; + x3 ^= rk1F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + pC ^= x0; + pD ^= x1; + pE ^= x2; + pF ^= x3; + /* round 4, 8, 12 */ + rk00 ^= rk19; + x0 = p4 ^ rk00; + rk01 ^= rk1A; + x1 = p5 ^ rk01; + rk02 ^= rk1B; + x2 = p6 ^ rk02; + rk03 ^= rk1C; + x3 = p7 ^ rk03; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk04 ^= rk1D; + x0 ^= rk04; + rk05 ^= rk1E; + x1 ^= rk05; + rk06 ^= rk1F; + x2 ^= rk06; + rk07 ^= rk00; + x3 ^= rk07; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk08 ^= rk01; + x0 ^= rk08; + rk09 ^= rk02; + x1 ^= rk09; + rk0A ^= rk03; + x2 ^= rk0A; + rk0B ^= rk04; + x3 ^= rk0B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk0C ^= rk05; + x0 ^= rk0C; + rk0D ^= rk06; + x1 ^= rk0D; + rk0E ^= rk07; + x2 ^= rk0E; + rk0F ^= rk08; + x3 ^= rk0F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p0 ^= x0; + p1 ^= x1; + p2 ^= x2; + p3 ^= x3; + rk10 ^= rk09; + x0 = pC ^ rk10; + rk11 ^= rk0A; + x1 = pD ^ rk11; + rk12 ^= rk0B; + x2 = pE ^ rk12; + rk13 ^= rk0C; + x3 = pF ^ rk13; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk14 ^= rk0D; + x0 ^= rk14; + rk15 ^= rk0E; + x1 ^= rk15; + rk16 ^= rk0F; + x2 ^= rk16; + rk17 ^= rk10; + x3 ^= rk17; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk18 ^= rk11; + x0 ^= rk18; + rk19 ^= rk12; + x1 ^= rk19; + rk1A ^= rk13; + x2 ^= rk1A; + rk1B ^= rk14; + x3 ^= rk1B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + rk1C ^= rk15; + x0 ^= rk1C; + rk1D ^= rk16; + x1 ^= rk1D; + rk1E ^= rk17; + x2 ^= rk1E; + rk1F ^= rk18; + x3 ^= rk1F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p8 ^= x0; + p9 ^= x1; + pA ^= x2; + pB ^= x3; + } + /* round 13 */ + KEY_EXPAND_ELT(rk00, rk01, rk02, rk03); + rk00 ^= rk1C; + rk01 ^= rk1D; + rk02 ^= rk1E; + rk03 ^= rk1F; + x0 = p0 ^ rk00; + x1 = p1 ^ rk01; + x2 = p2 ^ rk02; + x3 = p3 ^ rk03; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk04, rk05, rk06, rk07); + rk04 ^= rk00; + rk05 ^= rk01; + rk06 ^= rk02; + rk07 ^= rk03; + x0 ^= rk04; + x1 ^= rk05; + x2 ^= rk06; + x3 ^= rk07; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk08, rk09, rk0A, rk0B); + rk08 ^= rk04; + rk09 ^= rk05; + rk0A ^= rk06; + rk0B ^= rk07; + x0 ^= rk08; + x1 ^= rk09; + x2 ^= rk0A; + x3 ^= rk0B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk0C, rk0D, rk0E, rk0F); + rk0C ^= rk08; + rk0D ^= rk09; + rk0E ^= rk0A; + rk0F ^= rk0B; + x0 ^= rk0C; + x1 ^= rk0D; + x2 ^= rk0E; + x3 ^= rk0F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + pC ^= x0; + pD ^= x1; + pE ^= x2; + pF ^= x3; + KEY_EXPAND_ELT(rk10, rk11, rk12, rk13); + rk10 ^= rk0C; + rk11 ^= rk0D; + rk12 ^= rk0E; + rk13 ^= rk0F; + x0 = p8 ^ rk10; + x1 = p9 ^ rk11; + x2 = pA ^ rk12; + x3 = pB ^ rk13; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk14, rk15, rk16, rk17); + rk14 ^= rk10; + rk15 ^= rk11; + rk16 ^= rk12; + rk17 ^= rk13; + x0 ^= rk14; + x1 ^= rk15; + x2 ^= rk16; + x3 ^= rk17; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk18, rk19, rk1A, rk1B); + rk18 ^= rk14 ^ sc->count1; + rk19 ^= rk15 ^ sc->count0; + rk1A ^= rk16 ^ sc->count3; + rk1B ^= rk17 ^ SPH_T32(~sc->count2); + x0 ^= rk18; + x1 ^= rk19; + x2 ^= rk1A; + x3 ^= rk1B; + AES_ROUND_NOKEY(x0, x1, x2, x3); + KEY_EXPAND_ELT(rk1C, rk1D, rk1E, rk1F); + rk1C ^= rk18; + rk1D ^= rk19; + rk1E ^= rk1A; + rk1F ^= rk1B; + x0 ^= rk1C; + x1 ^= rk1D; + x2 ^= rk1E; + x3 ^= rk1F; + AES_ROUND_NOKEY(x0, x1, x2, x3); + p4 ^= x0; + p5 ^= x1; + p6 ^= x2; + p7 ^= x3; + sc->h[0x0] ^= p8; + sc->h[0x1] ^= p9; + sc->h[0x2] ^= pA; + sc->h[0x3] ^= pB; + sc->h[0x4] ^= pC; + sc->h[0x5] ^= pD; + sc->h[0x6] ^= pE; + sc->h[0x7] ^= pF; + sc->h[0x8] ^= p0; + sc->h[0x9] ^= p1; + sc->h[0xA] ^= p2; + sc->h[0xB] ^= p3; + sc->h[0xC] ^= p4; + sc->h[0xD] ^= p5; + sc->h[0xE] ^= p6; + sc->h[0xF] ^= p7; +} + +#endif + +static void +shavite_small_init(sph_shavite_small_context *sc, const sph_u32 *iv) +{ + memcpy(sc->h, iv, sizeof sc->h); + sc->ptr = 0; + sc->count0 = 0; + sc->count1 = 0; +} + +static void +shavite_small_core(sph_shavite_small_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + + buf = sc->buf; + ptr = sc->ptr; + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + data = (const unsigned char *)data + clen; + ptr += clen; + len -= clen; + if (ptr == sizeof sc->buf) { + if ((sc->count0 = SPH_T32(sc->count0 + 512)) == 0) + sc->count1 = SPH_T32(sc->count1 + 1); + c256(sc, buf); + ptr = 0; + } + } + sc->ptr = ptr; +} + +static void +shavite_small_close(sph_shavite_small_context *sc, + unsigned ub, unsigned n, void *dst, size_t out_size_w32) +{ + unsigned char *buf; + size_t ptr, u; + unsigned z; + sph_u32 count0, count1; + + buf = sc->buf; + ptr = sc->ptr; + count0 = (sc->count0 += (ptr << 3) + n); + count1 = sc->count1; + z = 0x80 >> n; + z = ((ub & -z) | z) & 0xFF; + if (ptr == 0 && n == 0) { + buf[0] = 0x80; + memset(buf + 1, 0, 53); + sc->count0 = sc->count1 = 0; + } else if (ptr < 54) { + buf[ptr ++] = z; + memset(buf + ptr, 0, 54 - ptr); + } else { + buf[ptr ++] = z; + memset(buf + ptr, 0, 64 - ptr); + c256(sc, buf); + memset(buf, 0, 54); + sc->count0 = sc->count1 = 0; + } + sph_enc32le(buf + 54, count0); + sph_enc32le(buf + 58, count1); + buf[62] = out_size_w32 << 5; + buf[63] = out_size_w32 >> 3; + c256(sc, buf); + for (u = 0; u < out_size_w32; u ++) + sph_enc32le((unsigned char *)dst + (u << 2), sc->h[u]); +} + +static void +shavite_big_init(sph_shavite_big_context *sc, const sph_u32 *iv) +{ + memcpy(sc->h, iv, sizeof sc->h); + sc->ptr = 0; + sc->count0 = 0; + sc->count1 = 0; + sc->count2 = 0; + sc->count3 = 0; +} + +static void +shavite_big_core(sph_shavite_big_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr; + + buf = sc->buf; + ptr = sc->ptr; + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + data = (const unsigned char *)data + clen; + ptr += clen; + len -= clen; + if (ptr == sizeof sc->buf) { + if ((sc->count0 = SPH_T32(sc->count0 + 1024)) == 0) { + sc->count1 = SPH_T32(sc->count1 + 1); + if (sc->count1 == 0) { + sc->count2 = SPH_T32(sc->count2 + 1); + if (sc->count2 == 0) { + sc->count3 = SPH_T32( + sc->count3 + 1); + } + } + } + c512(sc, buf); + ptr = 0; + } + } + sc->ptr = ptr; +} + +static void +shavite_big_close(sph_shavite_big_context *sc, + unsigned ub, unsigned n, void *dst, size_t out_size_w32) +{ + unsigned char *buf; + size_t ptr, u; + unsigned z; + sph_u32 count0, count1, count2, count3; + + buf = sc->buf; + ptr = sc->ptr; + count0 = (sc->count0 += (ptr << 3) + n); + count1 = sc->count1; + count2 = sc->count2; + count3 = sc->count3; + z = 0x80 >> n; + z = ((ub & -z) | z) & 0xFF; + if (ptr == 0 && n == 0) { + buf[0] = 0x80; + memset(buf + 1, 0, 109); + sc->count0 = sc->count1 = sc->count2 = sc->count3 = 0; + } else if (ptr < 110) { + buf[ptr ++] = z; + memset(buf + ptr, 0, 110 - ptr); + } else { + buf[ptr ++] = z; + memset(buf + ptr, 0, 128 - ptr); + c512(sc, buf); + memset(buf, 0, 110); + sc->count0 = sc->count1 = sc->count2 = sc->count3 = 0; + } + sph_enc32le(buf + 110, count0); + sph_enc32le(buf + 114, count1); + sph_enc32le(buf + 118, count2); + sph_enc32le(buf + 122, count3); + buf[126] = out_size_w32 << 5; + buf[127] = out_size_w32 >> 3; + c512(sc, buf); + for (u = 0; u < out_size_w32; u ++) + sph_enc32le((unsigned char *)dst + (u << 2), sc->h[u]); +} + +/* see sph_shavite.h */ +void +sph_shavite224_init(void *cc) +{ + shavite_small_init(cc, IV224); +} + +/* see sph_shavite.h */ +void +sph_shavite224(void *cc, const void *data, size_t len) +{ + shavite_small_core(cc, data, len); +} + +/* see sph_shavite.h */ +void +sph_shavite224_close(void *cc, void *dst) +{ + shavite_small_close(cc, 0, 0, dst, 7); + shavite_small_init(cc, IV224); +} + +/* see sph_shavite.h */ +void +sph_shavite224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shavite_small_close(cc, ub, n, dst, 7); + shavite_small_init(cc, IV224); +} + +/* see sph_shavite.h */ +void +sph_shavite256_init(void *cc) +{ + shavite_small_init(cc, IV256); +} + +/* see sph_shavite.h */ +void +sph_shavite256(void *cc, const void *data, size_t len) +{ + shavite_small_core(cc, data, len); +} + +/* see sph_shavite.h */ +void +sph_shavite256_close(void *cc, void *dst) +{ + shavite_small_close(cc, 0, 0, dst, 8); + shavite_small_init(cc, IV256); +} + +/* see sph_shavite.h */ +void +sph_shavite256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shavite_small_close(cc, ub, n, dst, 8); + shavite_small_init(cc, IV256); +} + +/* see sph_shavite.h */ +void +sph_shavite384_init(void *cc) +{ + shavite_big_init(cc, IV384); +} + +/* see sph_shavite.h */ +void +sph_shavite384(void *cc, const void *data, size_t len) +{ + shavite_big_core(cc, data, len); +} + +/* see sph_shavite.h */ +void +sph_shavite384_close(void *cc, void *dst) +{ + shavite_big_close(cc, 0, 0, dst, 12); + shavite_big_init(cc, IV384); +} + +/* see sph_shavite.h */ +void +sph_shavite384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shavite_big_close(cc, ub, n, dst, 12); + shavite_big_init(cc, IV384); +} + +/* see sph_shavite.h */ +void +sph_shavite512_init(void *cc) +{ + shavite_big_init(cc, IV512); +} + +/* see sph_shavite.h */ +void +sph_shavite512(void *cc, const void *data, size_t len) +{ + shavite_big_core(cc, data, len); +} + +/* see sph_shavite.h */ +void +sph_shavite512_close(void *cc, void *dst) +{ + shavite_big_close(cc, 0, 0, dst, 16); + shavite_big_init(cc, IV512); +} + +/* see sph_shavite.h */ +void +sph_shavite512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + shavite_big_close(cc, ub, n, dst, 16); + shavite_big_init(cc, IV512); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/sph/simd.c b/sph/simd.c new file mode 100644 index 0000000..2c80626 --- /dev/null +++ b/sph/simd.c @@ -0,0 +1,1799 @@ +/* $Id: simd.c 227 2010-06-16 17:28:38Z tp $ */ +/* + * SIMD implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include +#include + +#include "sph_simd.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_SIMD +#define SPH_SMALL_FOOTPRINT_SIMD 1 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +typedef sph_u32 u32; +typedef sph_s32 s32; +#define C32 SPH_C32 +#define T32 SPH_T32 +#define ROL32 SPH_ROTL32 + +#define XCAT(x, y) XCAT_(x, y) +#define XCAT_(x, y) x ## y + +/* + * The powers of 41 modulo 257. We use exponents from 0 to 255, inclusive. + */ +static const s32 alpha_tab[] = { + 1, 41, 139, 45, 46, 87, 226, 14, 60, 147, 116, 130, + 190, 80, 196, 69, 2, 82, 21, 90, 92, 174, 195, 28, + 120, 37, 232, 3, 123, 160, 135, 138, 4, 164, 42, 180, + 184, 91, 133, 56, 240, 74, 207, 6, 246, 63, 13, 19, + 8, 71, 84, 103, 111, 182, 9, 112, 223, 148, 157, 12, + 235, 126, 26, 38, 16, 142, 168, 206, 222, 107, 18, 224, + 189, 39, 57, 24, 213, 252, 52, 76, 32, 27, 79, 155, + 187, 214, 36, 191, 121, 78, 114, 48, 169, 247, 104, 152, + 64, 54, 158, 53, 117, 171, 72, 125, 242, 156, 228, 96, + 81, 237, 208, 47, 128, 108, 59, 106, 234, 85, 144, 250, + 227, 55, 199, 192, 162, 217, 159, 94, 256, 216, 118, 212, + 211, 170, 31, 243, 197, 110, 141, 127, 67, 177, 61, 188, + 255, 175, 236, 167, 165, 83, 62, 229, 137, 220, 25, 254, + 134, 97, 122, 119, 253, 93, 215, 77, 73, 166, 124, 201, + 17, 183, 50, 251, 11, 194, 244, 238, 249, 186, 173, 154, + 146, 75, 248, 145, 34, 109, 100, 245, 22, 131, 231, 219, + 241, 115, 89, 51, 35, 150, 239, 33, 68, 218, 200, 233, + 44, 5, 205, 181, 225, 230, 178, 102, 70, 43, 221, 66, + 136, 179, 143, 209, 88, 10, 153, 105, 193, 203, 99, 204, + 140, 86, 185, 132, 15, 101, 29, 161, 176, 20, 49, 210, + 129, 149, 198, 151, 23, 172, 113, 7, 30, 202, 58, 65, + 95, 40, 98, 163 +}; + +/* + * Ranges: + * REDS1: from -32768..98302 to -383..383 + * REDS2: from -2^31..2^31-1 to -32768..98302 + */ +#define REDS1(x) (((x) & 0xFF) - ((x) >> 8)) +#define REDS2(x) (((x) & 0xFFFF) + ((x) >> 16)) + +/* + * If, upon entry, the values of q[] are all in the -N..N range (where + * N >= 98302) then the new values of q[] are in the -2N..2N range. + * + * Since alpha_tab[v] <= 256, maximum allowed range is for N = 8388608. + */ +#define FFT_LOOP(rb, hk, as, id) do { \ + size_t u, v; \ + s32 m = q[(rb)]; \ + s32 n = q[(rb) + (hk)]; \ + q[(rb)] = m + n; \ + q[(rb) + (hk)] = m - n; \ + u = v = 0; \ + goto id; \ + for (; u < (hk); u += 4, v += 4 * (as)) { \ + s32 t; \ + m = q[(rb) + u + 0]; \ + n = q[(rb) + u + 0 + (hk)]; \ + t = REDS2(n * alpha_tab[v + 0 * (as)]); \ + q[(rb) + u + 0] = m + t; \ + q[(rb) + u + 0 + (hk)] = m - t; \ + id: \ + m = q[(rb) + u + 1]; \ + n = q[(rb) + u + 1 + (hk)]; \ + t = REDS2(n * alpha_tab[v + 1 * (as)]); \ + q[(rb) + u + 1] = m + t; \ + q[(rb) + u + 1 + (hk)] = m - t; \ + m = q[(rb) + u + 2]; \ + n = q[(rb) + u + 2 + (hk)]; \ + t = REDS2(n * alpha_tab[v + 2 * (as)]); \ + q[(rb) + u + 2] = m + t; \ + q[(rb) + u + 2 + (hk)] = m - t; \ + m = q[(rb) + u + 3]; \ + n = q[(rb) + u + 3 + (hk)]; \ + t = REDS2(n * alpha_tab[v + 3 * (as)]); \ + q[(rb) + u + 3] = m + t; \ + q[(rb) + u + 3 + (hk)] = m - t; \ + } \ + } while (0) + +/* + * Output ranges: + * d0: min= 0 max= 1020 + * d1: min= -67 max= 4587 + * d2: min=-4335 max= 4335 + * d3: min=-4147 max= 507 + * d4: min= -510 max= 510 + * d5: min= -252 max= 4402 + * d6: min=-4335 max= 4335 + * d7: min=-4332 max= 322 + */ +#define FFT8(xb, xs, d) do { \ + s32 x0 = x[(xb)]; \ + s32 x1 = x[(xb) + (xs)]; \ + s32 x2 = x[(xb) + 2 * (xs)]; \ + s32 x3 = x[(xb) + 3 * (xs)]; \ + s32 a0 = x0 + x2; \ + s32 a1 = x0 + (x2 << 4); \ + s32 a2 = x0 - x2; \ + s32 a3 = x0 - (x2 << 4); \ + s32 b0 = x1 + x3; \ + s32 b1 = REDS1((x1 << 2) + (x3 << 6)); \ + s32 b2 = (x1 << 4) - (x3 << 4); \ + s32 b3 = REDS1((x1 << 6) + (x3 << 2)); \ + d ## 0 = a0 + b0; \ + d ## 1 = a1 + b1; \ + d ## 2 = a2 + b2; \ + d ## 3 = a3 + b3; \ + d ## 4 = a0 - b0; \ + d ## 5 = a1 - b1; \ + d ## 6 = a2 - b2; \ + d ## 7 = a3 - b3; \ + } while (0) + +/* + * When k=16, we have alpha=2. Multiplication by alpha^i is then reduced + * to some shifting. + * + * Output: within -591471..591723 + */ +#define FFT16(xb, xs, rb) do { \ + s32 d1_0, d1_1, d1_2, d1_3, d1_4, d1_5, d1_6, d1_7; \ + s32 d2_0, d2_1, d2_2, d2_3, d2_4, d2_5, d2_6, d2_7; \ + FFT8(xb, (xs) << 1, d1_); \ + FFT8((xb) + (xs), (xs) << 1, d2_); \ + q[(rb) + 0] = d1_0 + d2_0; \ + q[(rb) + 1] = d1_1 + (d2_1 << 1); \ + q[(rb) + 2] = d1_2 + (d2_2 << 2); \ + q[(rb) + 3] = d1_3 + (d2_3 << 3); \ + q[(rb) + 4] = d1_4 + (d2_4 << 4); \ + q[(rb) + 5] = d1_5 + (d2_5 << 5); \ + q[(rb) + 6] = d1_6 + (d2_6 << 6); \ + q[(rb) + 7] = d1_7 + (d2_7 << 7); \ + q[(rb) + 8] = d1_0 - d2_0; \ + q[(rb) + 9] = d1_1 - (d2_1 << 1); \ + q[(rb) + 10] = d1_2 - (d2_2 << 2); \ + q[(rb) + 11] = d1_3 - (d2_3 << 3); \ + q[(rb) + 12] = d1_4 - (d2_4 << 4); \ + q[(rb) + 13] = d1_5 - (d2_5 << 5); \ + q[(rb) + 14] = d1_6 - (d2_6 << 6); \ + q[(rb) + 15] = d1_7 - (d2_7 << 7); \ + } while (0) + +/* + * Output range: |q| <= 1183446 + */ +#define FFT32(xb, xs, rb, id) do { \ + FFT16(xb, (xs) << 1, rb); \ + FFT16((xb) + (xs), (xs) << 1, (rb) + 16); \ + FFT_LOOP(rb, 16, 8, id); \ + } while (0) + +/* + * Output range: |q| <= 2366892 + */ +#define FFT64(xb, xs, rb, id) do { \ + FFT32(xb, (xs) << 1, rb, XCAT(id, a)); \ + FFT32((xb) + (xs), (xs) << 1, (rb) + 32, XCAT(id, b)); \ + FFT_LOOP(rb, 32, 4, id); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_SIMD + +static void +fft32(unsigned char *x, size_t xs, s32 *q) +{ + size_t xd; + + xd = xs << 1; + FFT16(0, xd, 0); + FFT16(xs, xd, 16); + FFT_LOOP(0, 16, 8, label_); +} + +#define FFT128(xb, xs, rb, id) do { \ + fft32(x + (xb) + ((xs) * 0), (xs) << 2, &q[(rb) + 0]); \ + fft32(x + (xb) + ((xs) * 2), (xs) << 2, &q[(rb) + 32]); \ + FFT_LOOP(rb, 32, 4, XCAT(id, aa)); \ + fft32(x + (xb) + ((xs) * 1), (xs) << 2, &q[(rb) + 64]); \ + fft32(x + (xb) + ((xs) * 3), (xs) << 2, &q[(rb) + 96]); \ + FFT_LOOP((rb) + 64, 32, 4, XCAT(id, ab)); \ + FFT_LOOP(rb, 64, 2, XCAT(id, a)); \ + } while (0) + +#else + +/* + * Output range: |q| <= 4733784 + */ +#define FFT128(xb, xs, rb, id) do { \ + FFT64(xb, (xs) << 1, rb, XCAT(id, a)); \ + FFT64((xb) + (xs), (xs) << 1, (rb) + 64, XCAT(id, b)); \ + FFT_LOOP(rb, 64, 2, id); \ + } while (0) + +#endif + +/* + * For SIMD-384 / SIMD-512, the fully unrolled FFT yields a compression + * function which does not fit in the 32 kB L1 cache of a typical x86 + * Intel. We therefore add a function call layer at the FFT64 level. + */ + +static void +fft64(unsigned char *x, size_t xs, s32 *q) +{ + size_t xd; + + xd = xs << 1; + FFT32(0, xd, 0, label_a); + FFT32(xs, xd, 32, label_b); + FFT_LOOP(0, 32, 4, label_); +} + +/* + * Output range: |q| <= 9467568 + */ +#define FFT256(xb, xs, rb, id) do { \ + fft64(x + (xb) + ((xs) * 0), (xs) << 2, &q[(rb) + 0]); \ + fft64(x + (xb) + ((xs) * 2), (xs) << 2, &q[(rb) + 64]); \ + FFT_LOOP(rb, 64, 2, XCAT(id, aa)); \ + fft64(x + (xb) + ((xs) * 1), (xs) << 2, &q[(rb) + 128]); \ + fft64(x + (xb) + ((xs) * 3), (xs) << 2, &q[(rb) + 192]); \ + FFT_LOOP((rb) + 128, 64, 2, XCAT(id, ab)); \ + FFT_LOOP(rb, 128, 1, XCAT(id, a)); \ + } while (0) + +/* + * alpha^(127*i) mod 257 + */ +static const unsigned short yoff_s_n[] = { + 1, 98, 95, 58, 30, 113, 23, 198, 129, 49, 176, 29, + 15, 185, 140, 99, 193, 153, 88, 143, 136, 221, 70, 178, + 225, 205, 44, 200, 68, 239, 35, 89, 241, 231, 22, 100, + 34, 248, 146, 173, 249, 244, 11, 50, 17, 124, 73, 215, + 253, 122, 134, 25, 137, 62, 165, 236, 255, 61, 67, 141, + 197, 31, 211, 118, 256, 159, 162, 199, 227, 144, 234, 59, + 128, 208, 81, 228, 242, 72, 117, 158, 64, 104, 169, 114, + 121, 36, 187, 79, 32, 52, 213, 57, 189, 18, 222, 168, + 16, 26, 235, 157, 223, 9, 111, 84, 8, 13, 246, 207, + 240, 133, 184, 42, 4, 135, 123, 232, 120, 195, 92, 21, + 2, 196, 190, 116, 60, 226, 46, 139 +}; + +/* + * alpha^(127*i) + alpha^(125*i) mod 257 + */ +static const unsigned short yoff_s_f[] = { + 2, 156, 118, 107, 45, 212, 111, 162, 97, 249, 211, 3, + 49, 101, 151, 223, 189, 178, 253, 204, 76, 82, 232, 65, + 96, 176, 161, 47, 189, 61, 248, 107, 0, 131, 133, 113, + 17, 33, 12, 111, 251, 103, 57, 148, 47, 65, 249, 143, + 189, 8, 204, 230, 205, 151, 187, 227, 247, 111, 140, 6, + 77, 10, 21, 149, 255, 101, 139, 150, 212, 45, 146, 95, + 160, 8, 46, 254, 208, 156, 106, 34, 68, 79, 4, 53, + 181, 175, 25, 192, 161, 81, 96, 210, 68, 196, 9, 150, + 0, 126, 124, 144, 240, 224, 245, 146, 6, 154, 200, 109, + 210, 192, 8, 114, 68, 249, 53, 27, 52, 106, 70, 30, + 10, 146, 117, 251, 180, 247, 236, 108 +}; + +/* + * beta^(255*i) mod 257 + */ +static const unsigned short yoff_b_n[] = { + 1, 163, 98, 40, 95, 65, 58, 202, 30, 7, 113, 172, + 23, 151, 198, 149, 129, 210, 49, 20, 176, 161, 29, 101, + 15, 132, 185, 86, 140, 204, 99, 203, 193, 105, 153, 10, + 88, 209, 143, 179, 136, 66, 221, 43, 70, 102, 178, 230, + 225, 181, 205, 5, 44, 233, 200, 218, 68, 33, 239, 150, + 35, 51, 89, 115, 241, 219, 231, 131, 22, 245, 100, 109, + 34, 145, 248, 75, 146, 154, 173, 186, 249, 238, 244, 194, + 11, 251, 50, 183, 17, 201, 124, 166, 73, 77, 215, 93, + 253, 119, 122, 97, 134, 254, 25, 220, 137, 229, 62, 83, + 165, 167, 236, 175, 255, 188, 61, 177, 67, 127, 141, 110, + 197, 243, 31, 170, 211, 212, 118, 216, 256, 94, 159, 217, + 162, 192, 199, 55, 227, 250, 144, 85, 234, 106, 59, 108, + 128, 47, 208, 237, 81, 96, 228, 156, 242, 125, 72, 171, + 117, 53, 158, 54, 64, 152, 104, 247, 169, 48, 114, 78, + 121, 191, 36, 214, 187, 155, 79, 27, 32, 76, 52, 252, + 213, 24, 57, 39, 189, 224, 18, 107, 222, 206, 168, 142, + 16, 38, 26, 126, 235, 12, 157, 148, 223, 112, 9, 182, + 111, 103, 84, 71, 8, 19, 13, 63, 246, 6, 207, 74, + 240, 56, 133, 91, 184, 180, 42, 164, 4, 138, 135, 160, + 123, 3, 232, 37, 120, 28, 195, 174, 92, 90, 21, 82, + 2, 69, 196, 80, 190, 130, 116, 147, 60, 14, 226, 87, + 46, 45, 139, 41 +}; + +/* + * beta^(255*i) + beta^(253*i) mod 257 + */ +static const unsigned short yoff_b_f[] = { + 2, 203, 156, 47, 118, 214, 107, 106, 45, 93, 212, 20, + 111, 73, 162, 251, 97, 215, 249, 53, 211, 19, 3, 89, + 49, 207, 101, 67, 151, 130, 223, 23, 189, 202, 178, 239, + 253, 127, 204, 49, 76, 236, 82, 137, 232, 157, 65, 79, + 96, 161, 176, 130, 161, 30, 47, 9, 189, 247, 61, 226, + 248, 90, 107, 64, 0, 88, 131, 243, 133, 59, 113, 115, + 17, 236, 33, 213, 12, 191, 111, 19, 251, 61, 103, 208, + 57, 35, 148, 248, 47, 116, 65, 119, 249, 178, 143, 40, + 189, 129, 8, 163, 204, 227, 230, 196, 205, 122, 151, 45, + 187, 19, 227, 72, 247, 125, 111, 121, 140, 220, 6, 107, + 77, 69, 10, 101, 21, 65, 149, 171, 255, 54, 101, 210, + 139, 43, 150, 151, 212, 164, 45, 237, 146, 184, 95, 6, + 160, 42, 8, 204, 46, 238, 254, 168, 208, 50, 156, 190, + 106, 127, 34, 234, 68, 55, 79, 18, 4, 130, 53, 208, + 181, 21, 175, 120, 25, 100, 192, 178, 161, 96, 81, 127, + 96, 227, 210, 248, 68, 10, 196, 31, 9, 167, 150, 193, + 0, 169, 126, 14, 124, 198, 144, 142, 240, 21, 224, 44, + 245, 66, 146, 238, 6, 196, 154, 49, 200, 222, 109, 9, + 210, 141, 192, 138, 8, 79, 114, 217, 68, 128, 249, 94, + 53, 30, 27, 61, 52, 135, 106, 212, 70, 238, 30, 185, + 10, 132, 146, 136, 117, 37, 251, 150, 180, 188, 247, 156, + 236, 192, 108, 86 +}; + +#define INNER(l, h, mm) (((u32)((l) * (mm)) & 0xFFFFU) \ + + ((u32)((h) * (mm)) << 16)) + +#define W_SMALL(sb, o1, o2, mm) \ + (INNER(q[8 * (sb) + 2 * 0 + o1], q[8 * (sb) + 2 * 0 + o2], mm), \ + INNER(q[8 * (sb) + 2 * 1 + o1], q[8 * (sb) + 2 * 1 + o2], mm), \ + INNER(q[8 * (sb) + 2 * 2 + o1], q[8 * (sb) + 2 * 2 + o2], mm), \ + INNER(q[8 * (sb) + 2 * 3 + o1], q[8 * (sb) + 2 * 3 + o2], mm) + +#define WS_0_0 W_SMALL( 4, 0, 1, 185) +#define WS_0_1 W_SMALL( 6, 0, 1, 185) +#define WS_0_2 W_SMALL( 0, 0, 1, 185) +#define WS_0_3 W_SMALL( 2, 0, 1, 185) +#define WS_0_4 W_SMALL( 7, 0, 1, 185) +#define WS_0_5 W_SMALL( 5, 0, 1, 185) +#define WS_0_6 W_SMALL( 3, 0, 1, 185) +#define WS_0_7 W_SMALL( 1, 0, 1, 185) +#define WS_1_0 W_SMALL(15, 0, 1, 185) +#define WS_1_1 W_SMALL(11, 0, 1, 185) +#define WS_1_2 W_SMALL(12, 0, 1, 185) +#define WS_1_3 W_SMALL( 8, 0, 1, 185) +#define WS_1_4 W_SMALL( 9, 0, 1, 185) +#define WS_1_5 W_SMALL(13, 0, 1, 185) +#define WS_1_6 W_SMALL(10, 0, 1, 185) +#define WS_1_7 W_SMALL(14, 0, 1, 185) +#define WS_2_0 W_SMALL(17, -128, -64, 233) +#define WS_2_1 W_SMALL(18, -128, -64, 233) +#define WS_2_2 W_SMALL(23, -128, -64, 233) +#define WS_2_3 W_SMALL(20, -128, -64, 233) +#define WS_2_4 W_SMALL(22, -128, -64, 233) +#define WS_2_5 W_SMALL(21, -128, -64, 233) +#define WS_2_6 W_SMALL(16, -128, -64, 233) +#define WS_2_7 W_SMALL(19, -128, -64, 233) +#define WS_3_0 W_SMALL(30, -191, -127, 233) +#define WS_3_1 W_SMALL(24, -191, -127, 233) +#define WS_3_2 W_SMALL(25, -191, -127, 233) +#define WS_3_3 W_SMALL(31, -191, -127, 233) +#define WS_3_4 W_SMALL(27, -191, -127, 233) +#define WS_3_5 W_SMALL(29, -191, -127, 233) +#define WS_3_6 W_SMALL(28, -191, -127, 233) +#define WS_3_7 W_SMALL(26, -191, -127, 233) + +#define W_BIG(sb, o1, o2, mm) \ + (INNER(q[16 * (sb) + 2 * 0 + o1], q[16 * (sb) + 2 * 0 + o2], mm), \ + INNER(q[16 * (sb) + 2 * 1 + o1], q[16 * (sb) + 2 * 1 + o2], mm), \ + INNER(q[16 * (sb) + 2 * 2 + o1], q[16 * (sb) + 2 * 2 + o2], mm), \ + INNER(q[16 * (sb) + 2 * 3 + o1], q[16 * (sb) + 2 * 3 + o2], mm), \ + INNER(q[16 * (sb) + 2 * 4 + o1], q[16 * (sb) + 2 * 4 + o2], mm), \ + INNER(q[16 * (sb) + 2 * 5 + o1], q[16 * (sb) + 2 * 5 + o2], mm), \ + INNER(q[16 * (sb) + 2 * 6 + o1], q[16 * (sb) + 2 * 6 + o2], mm), \ + INNER(q[16 * (sb) + 2 * 7 + o1], q[16 * (sb) + 2 * 7 + o2], mm) + +#define WB_0_0 W_BIG( 4, 0, 1, 185) +#define WB_0_1 W_BIG( 6, 0, 1, 185) +#define WB_0_2 W_BIG( 0, 0, 1, 185) +#define WB_0_3 W_BIG( 2, 0, 1, 185) +#define WB_0_4 W_BIG( 7, 0, 1, 185) +#define WB_0_5 W_BIG( 5, 0, 1, 185) +#define WB_0_6 W_BIG( 3, 0, 1, 185) +#define WB_0_7 W_BIG( 1, 0, 1, 185) +#define WB_1_0 W_BIG(15, 0, 1, 185) +#define WB_1_1 W_BIG(11, 0, 1, 185) +#define WB_1_2 W_BIG(12, 0, 1, 185) +#define WB_1_3 W_BIG( 8, 0, 1, 185) +#define WB_1_4 W_BIG( 9, 0, 1, 185) +#define WB_1_5 W_BIG(13, 0, 1, 185) +#define WB_1_6 W_BIG(10, 0, 1, 185) +#define WB_1_7 W_BIG(14, 0, 1, 185) +#define WB_2_0 W_BIG(17, -256, -128, 233) +#define WB_2_1 W_BIG(18, -256, -128, 233) +#define WB_2_2 W_BIG(23, -256, -128, 233) +#define WB_2_3 W_BIG(20, -256, -128, 233) +#define WB_2_4 W_BIG(22, -256, -128, 233) +#define WB_2_5 W_BIG(21, -256, -128, 233) +#define WB_2_6 W_BIG(16, -256, -128, 233) +#define WB_2_7 W_BIG(19, -256, -128, 233) +#define WB_3_0 W_BIG(30, -383, -255, 233) +#define WB_3_1 W_BIG(24, -383, -255, 233) +#define WB_3_2 W_BIG(25, -383, -255, 233) +#define WB_3_3 W_BIG(31, -383, -255, 233) +#define WB_3_4 W_BIG(27, -383, -255, 233) +#define WB_3_5 W_BIG(29, -383, -255, 233) +#define WB_3_6 W_BIG(28, -383, -255, 233) +#define WB_3_7 W_BIG(26, -383, -255, 233) + +#define IF(x, y, z) ((((y) ^ (z)) & (x)) ^ (z)) +#define MAJ(x, y, z) (((x) & (y)) | (((x) | (y)) & (z))) + +#define PP4_0_0 1 +#define PP4_0_1 0 +#define PP4_0_2 3 +#define PP4_0_3 2 +#define PP4_1_0 2 +#define PP4_1_1 3 +#define PP4_1_2 0 +#define PP4_1_3 1 +#define PP4_2_0 3 +#define PP4_2_1 2 +#define PP4_2_2 1 +#define PP4_2_3 0 + +#define PP8_0_0 1 +#define PP8_0_1 0 +#define PP8_0_2 3 +#define PP8_0_3 2 +#define PP8_0_4 5 +#define PP8_0_5 4 +#define PP8_0_6 7 +#define PP8_0_7 6 + +#define PP8_1_0 6 +#define PP8_1_1 7 +#define PP8_1_2 4 +#define PP8_1_3 5 +#define PP8_1_4 2 +#define PP8_1_5 3 +#define PP8_1_6 0 +#define PP8_1_7 1 + +#define PP8_2_0 2 +#define PP8_2_1 3 +#define PP8_2_2 0 +#define PP8_2_3 1 +#define PP8_2_4 6 +#define PP8_2_5 7 +#define PP8_2_6 4 +#define PP8_2_7 5 + +#define PP8_3_0 3 +#define PP8_3_1 2 +#define PP8_3_2 1 +#define PP8_3_3 0 +#define PP8_3_4 7 +#define PP8_3_5 6 +#define PP8_3_6 5 +#define PP8_3_7 4 + +#define PP8_4_0 5 +#define PP8_4_1 4 +#define PP8_4_2 7 +#define PP8_4_3 6 +#define PP8_4_4 1 +#define PP8_4_5 0 +#define PP8_4_6 3 +#define PP8_4_7 2 + +#define PP8_5_0 7 +#define PP8_5_1 6 +#define PP8_5_2 5 +#define PP8_5_3 4 +#define PP8_5_4 3 +#define PP8_5_5 2 +#define PP8_5_6 1 +#define PP8_5_7 0 + +#define PP8_6_0 4 +#define PP8_6_1 5 +#define PP8_6_2 6 +#define PP8_6_3 7 +#define PP8_6_4 0 +#define PP8_6_5 1 +#define PP8_6_6 2 +#define PP8_6_7 3 + +#if SPH_SIMD_NOCOPY + +#define DECL_STATE_SMALL +#define READ_STATE_SMALL(sc) +#define WRITE_STATE_SMALL(sc) +#define DECL_STATE_BIG +#define READ_STATE_BIG(sc) +#define WRITE_STATE_BIG(sc) + +#else + +#define DECL_STATE_SMALL \ + u32 A0, A1, A2, A3, B0, B1, B2, B3, C0, C1, C2, C3, D0, D1, D2, D3; + +#define READ_STATE_SMALL(sc) do { \ + A0 = (sc)->state[ 0]; \ + A1 = (sc)->state[ 1]; \ + A2 = (sc)->state[ 2]; \ + A3 = (sc)->state[ 3]; \ + B0 = (sc)->state[ 4]; \ + B1 = (sc)->state[ 5]; \ + B2 = (sc)->state[ 6]; \ + B3 = (sc)->state[ 7]; \ + C0 = (sc)->state[ 8]; \ + C1 = (sc)->state[ 9]; \ + C2 = (sc)->state[10]; \ + C3 = (sc)->state[11]; \ + D0 = (sc)->state[12]; \ + D1 = (sc)->state[13]; \ + D2 = (sc)->state[14]; \ + D3 = (sc)->state[15]; \ + } while (0) + +#define WRITE_STATE_SMALL(sc) do { \ + (sc)->state[ 0] = A0; \ + (sc)->state[ 1] = A1; \ + (sc)->state[ 2] = A2; \ + (sc)->state[ 3] = A3; \ + (sc)->state[ 4] = B0; \ + (sc)->state[ 5] = B1; \ + (sc)->state[ 6] = B2; \ + (sc)->state[ 7] = B3; \ + (sc)->state[ 8] = C0; \ + (sc)->state[ 9] = C1; \ + (sc)->state[10] = C2; \ + (sc)->state[11] = C3; \ + (sc)->state[12] = D0; \ + (sc)->state[13] = D1; \ + (sc)->state[14] = D2; \ + (sc)->state[15] = D3; \ + } while (0) + +#define DECL_STATE_BIG \ + u32 A0, A1, A2, A3, A4, A5, A6, A7; \ + u32 B0, B1, B2, B3, B4, B5, B6, B7; \ + u32 C0, C1, C2, C3, C4, C5, C6, C7; \ + u32 D0, D1, D2, D3, D4, D5, D6, D7; + +#define READ_STATE_BIG(sc) do { \ + A0 = (sc)->state[ 0]; \ + A1 = (sc)->state[ 1]; \ + A2 = (sc)->state[ 2]; \ + A3 = (sc)->state[ 3]; \ + A4 = (sc)->state[ 4]; \ + A5 = (sc)->state[ 5]; \ + A6 = (sc)->state[ 6]; \ + A7 = (sc)->state[ 7]; \ + B0 = (sc)->state[ 8]; \ + B1 = (sc)->state[ 9]; \ + B2 = (sc)->state[10]; \ + B3 = (sc)->state[11]; \ + B4 = (sc)->state[12]; \ + B5 = (sc)->state[13]; \ + B6 = (sc)->state[14]; \ + B7 = (sc)->state[15]; \ + C0 = (sc)->state[16]; \ + C1 = (sc)->state[17]; \ + C2 = (sc)->state[18]; \ + C3 = (sc)->state[19]; \ + C4 = (sc)->state[20]; \ + C5 = (sc)->state[21]; \ + C6 = (sc)->state[22]; \ + C7 = (sc)->state[23]; \ + D0 = (sc)->state[24]; \ + D1 = (sc)->state[25]; \ + D2 = (sc)->state[26]; \ + D3 = (sc)->state[27]; \ + D4 = (sc)->state[28]; \ + D5 = (sc)->state[29]; \ + D6 = (sc)->state[30]; \ + D7 = (sc)->state[31]; \ + } while (0) + +#define WRITE_STATE_BIG(sc) do { \ + (sc)->state[ 0] = A0; \ + (sc)->state[ 1] = A1; \ + (sc)->state[ 2] = A2; \ + (sc)->state[ 3] = A3; \ + (sc)->state[ 4] = A4; \ + (sc)->state[ 5] = A5; \ + (sc)->state[ 6] = A6; \ + (sc)->state[ 7] = A7; \ + (sc)->state[ 8] = B0; \ + (sc)->state[ 9] = B1; \ + (sc)->state[10] = B2; \ + (sc)->state[11] = B3; \ + (sc)->state[12] = B4; \ + (sc)->state[13] = B5; \ + (sc)->state[14] = B6; \ + (sc)->state[15] = B7; \ + (sc)->state[16] = C0; \ + (sc)->state[17] = C1; \ + (sc)->state[18] = C2; \ + (sc)->state[19] = C3; \ + (sc)->state[20] = C4; \ + (sc)->state[21] = C5; \ + (sc)->state[22] = C6; \ + (sc)->state[23] = C7; \ + (sc)->state[24] = D0; \ + (sc)->state[25] = D1; \ + (sc)->state[26] = D2; \ + (sc)->state[27] = D3; \ + (sc)->state[28] = D4; \ + (sc)->state[29] = D5; \ + (sc)->state[30] = D6; \ + (sc)->state[31] = D7; \ + } while (0) + +#endif + +#define STEP_ELT(n, w, fun, s, ppb) do { \ + u32 tt = T32(D ## n + (w) + fun(A ## n, B ## n, C ## n)); \ + A ## n = T32(ROL32(tt, s) + XCAT(tA, XCAT(ppb, n))); \ + D ## n = C ## n; \ + C ## n = B ## n; \ + B ## n = tA ## n; \ + } while (0) + +#define STEP_SMALL(w0, w1, w2, w3, fun, r, s, pp4b) do { \ + u32 tA0 = ROL32(A0, r); \ + u32 tA1 = ROL32(A1, r); \ + u32 tA2 = ROL32(A2, r); \ + u32 tA3 = ROL32(A3, r); \ + STEP_ELT(0, w0, fun, s, pp4b); \ + STEP_ELT(1, w1, fun, s, pp4b); \ + STEP_ELT(2, w2, fun, s, pp4b); \ + STEP_ELT(3, w3, fun, s, pp4b); \ + } while (0) + +#define STEP_BIG(w0, w1, w2, w3, w4, w5, w6, w7, fun, r, s, pp8b) do { \ + u32 tA0 = ROL32(A0, r); \ + u32 tA1 = ROL32(A1, r); \ + u32 tA2 = ROL32(A2, r); \ + u32 tA3 = ROL32(A3, r); \ + u32 tA4 = ROL32(A4, r); \ + u32 tA5 = ROL32(A5, r); \ + u32 tA6 = ROL32(A6, r); \ + u32 tA7 = ROL32(A7, r); \ + STEP_ELT(0, w0, fun, s, pp8b); \ + STEP_ELT(1, w1, fun, s, pp8b); \ + STEP_ELT(2, w2, fun, s, pp8b); \ + STEP_ELT(3, w3, fun, s, pp8b); \ + STEP_ELT(4, w4, fun, s, pp8b); \ + STEP_ELT(5, w5, fun, s, pp8b); \ + STEP_ELT(6, w6, fun, s, pp8b); \ + STEP_ELT(7, w7, fun, s, pp8b); \ + } while (0) + +#define M3_0_0 0_ +#define M3_1_0 1_ +#define M3_2_0 2_ +#define M3_3_0 0_ +#define M3_4_0 1_ +#define M3_5_0 2_ +#define M3_6_0 0_ +#define M3_7_0 1_ + +#define M3_0_1 1_ +#define M3_1_1 2_ +#define M3_2_1 0_ +#define M3_3_1 1_ +#define M3_4_1 2_ +#define M3_5_1 0_ +#define M3_6_1 1_ +#define M3_7_1 2_ + +#define M3_0_2 2_ +#define M3_1_2 0_ +#define M3_2_2 1_ +#define M3_3_2 2_ +#define M3_4_2 0_ +#define M3_5_2 1_ +#define M3_6_2 2_ +#define M3_7_2 0_ + +#define STEP_SMALL_(w, fun, r, s, pp4b) STEP_SMALL w, fun, r, s, pp4b) + +#define ONE_ROUND_SMALL(ri, isp, p0, p1, p2, p3) do { \ + STEP_SMALL_(WS_ ## ri ## 0, \ + IF, p0, p1, XCAT(PP4_, M3_0_ ## isp)); \ + STEP_SMALL_(WS_ ## ri ## 1, \ + IF, p1, p2, XCAT(PP4_, M3_1_ ## isp)); \ + STEP_SMALL_(WS_ ## ri ## 2, \ + IF, p2, p3, XCAT(PP4_, M3_2_ ## isp)); \ + STEP_SMALL_(WS_ ## ri ## 3, \ + IF, p3, p0, XCAT(PP4_, M3_3_ ## isp)); \ + STEP_SMALL_(WS_ ## ri ## 4, \ + MAJ, p0, p1, XCAT(PP4_, M3_4_ ## isp)); \ + STEP_SMALL_(WS_ ## ri ## 5, \ + MAJ, p1, p2, XCAT(PP4_, M3_5_ ## isp)); \ + STEP_SMALL_(WS_ ## ri ## 6, \ + MAJ, p2, p3, XCAT(PP4_, M3_6_ ## isp)); \ + STEP_SMALL_(WS_ ## ri ## 7, \ + MAJ, p3, p0, XCAT(PP4_, M3_7_ ## isp)); \ + } while (0) + +#define M7_0_0 0_ +#define M7_1_0 1_ +#define M7_2_0 2_ +#define M7_3_0 3_ +#define M7_4_0 4_ +#define M7_5_0 5_ +#define M7_6_0 6_ +#define M7_7_0 0_ + +#define M7_0_1 1_ +#define M7_1_1 2_ +#define M7_2_1 3_ +#define M7_3_1 4_ +#define M7_4_1 5_ +#define M7_5_1 6_ +#define M7_6_1 0_ +#define M7_7_1 1_ + +#define M7_0_2 2_ +#define M7_1_2 3_ +#define M7_2_2 4_ +#define M7_3_2 5_ +#define M7_4_2 6_ +#define M7_5_2 0_ +#define M7_6_2 1_ +#define M7_7_2 2_ + +#define M7_0_3 3_ +#define M7_1_3 4_ +#define M7_2_3 5_ +#define M7_3_3 6_ +#define M7_4_3 0_ +#define M7_5_3 1_ +#define M7_6_3 2_ +#define M7_7_3 3_ + +#define STEP_BIG_(w, fun, r, s, pp8b) STEP_BIG w, fun, r, s, pp8b) + +#define ONE_ROUND_BIG(ri, isp, p0, p1, p2, p3) do { \ + STEP_BIG_(WB_ ## ri ## 0, \ + IF, p0, p1, XCAT(PP8_, M7_0_ ## isp)); \ + STEP_BIG_(WB_ ## ri ## 1, \ + IF, p1, p2, XCAT(PP8_, M7_1_ ## isp)); \ + STEP_BIG_(WB_ ## ri ## 2, \ + IF, p2, p3, XCAT(PP8_, M7_2_ ## isp)); \ + STEP_BIG_(WB_ ## ri ## 3, \ + IF, p3, p0, XCAT(PP8_, M7_3_ ## isp)); \ + STEP_BIG_(WB_ ## ri ## 4, \ + MAJ, p0, p1, XCAT(PP8_, M7_4_ ## isp)); \ + STEP_BIG_(WB_ ## ri ## 5, \ + MAJ, p1, p2, XCAT(PP8_, M7_5_ ## isp)); \ + STEP_BIG_(WB_ ## ri ## 6, \ + MAJ, p2, p3, XCAT(PP8_, M7_6_ ## isp)); \ + STEP_BIG_(WB_ ## ri ## 7, \ + MAJ, p3, p0, XCAT(PP8_, M7_7_ ## isp)); \ + } while (0) + +#if SPH_SMALL_FOOTPRINT_SIMD + +#define A0 state[ 0] +#define A1 state[ 1] +#define A2 state[ 2] +#define A3 state[ 3] +#define B0 state[ 4] +#define B1 state[ 5] +#define B2 state[ 6] +#define B3 state[ 7] +#define C0 state[ 8] +#define C1 state[ 9] +#define C2 state[10] +#define C3 state[11] +#define D0 state[12] +#define D1 state[13] +#define D2 state[14] +#define D3 state[15] + +#define STEP2_ELT(n, w, fun, s, ppb) do { \ + u32 tt = T32(D ## n + (w) + fun(A ## n, B ## n, C ## n)); \ + A ## n = T32(ROL32(tt, s) + tA[(ppb) ^ n]); \ + D ## n = C ## n; \ + C ## n = B ## n; \ + B ## n = tA[n]; \ + } while (0) + +#define STEP2_SMALL(w0, w1, w2, w3, fun, r, s, pp4b) do { \ + u32 tA[4]; \ + tA[0] = ROL32(A0, r); \ + tA[1] = ROL32(A1, r); \ + tA[2] = ROL32(A2, r); \ + tA[3] = ROL32(A3, r); \ + STEP2_ELT(0, w0, fun, s, pp4b); \ + STEP2_ELT(1, w1, fun, s, pp4b); \ + STEP2_ELT(2, w2, fun, s, pp4b); \ + STEP2_ELT(3, w3, fun, s, pp4b); \ + } while (0) + +static void +one_round_small(u32 *state, u32 *w, int isp, int p0, int p1, int p2, int p3) +{ + static const int pp4k[] = { 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2 }; + + STEP2_SMALL(w[ 0], w[ 1], w[ 2], w[ 3], IF, p0, p1, pp4k[isp + 0]); + STEP2_SMALL(w[ 4], w[ 5], w[ 6], w[ 7], IF, p1, p2, pp4k[isp + 1]); + STEP2_SMALL(w[ 8], w[ 9], w[10], w[11], IF, p2, p3, pp4k[isp + 2]); + STEP2_SMALL(w[12], w[13], w[14], w[15], IF, p3, p0, pp4k[isp + 3]); + STEP2_SMALL(w[16], w[17], w[18], w[19], MAJ, p0, p1, pp4k[isp + 4]); + STEP2_SMALL(w[20], w[21], w[22], w[23], MAJ, p1, p2, pp4k[isp + 5]); + STEP2_SMALL(w[24], w[25], w[26], w[27], MAJ, p2, p3, pp4k[isp + 6]); + STEP2_SMALL(w[28], w[29], w[30], w[31], MAJ, p3, p0, pp4k[isp + 7]); +} + +static void +compress_small(sph_simd_small_context *sc, int last) +{ + unsigned char *x; + s32 q[128]; + int i; + u32 w[32]; + u32 state[16]; + size_t u; + + static const size_t wsp[32] = { + 4 << 3, 6 << 3, 0 << 3, 2 << 3, + 7 << 3, 5 << 3, 3 << 3, 1 << 3, + 15 << 3, 11 << 3, 12 << 3, 8 << 3, + 9 << 3, 13 << 3, 10 << 3, 14 << 3, + 17 << 3, 18 << 3, 23 << 3, 20 << 3, + 22 << 3, 21 << 3, 16 << 3, 19 << 3, + 30 << 3, 24 << 3, 25 << 3, 31 << 3, + 27 << 3, 29 << 3, 28 << 3, 26 << 3 + }; + + x = sc->buf; + FFT128(0, 1, 0, ll); + if (last) { + for (i = 0; i < 128; i ++) { + s32 tq; + + tq = q[i] + yoff_s_f[i]; + tq = REDS2(tq); + tq = REDS1(tq); + tq = REDS1(tq); + q[i] = (tq <= 128 ? tq : tq - 257); + } + } else { + for (i = 0; i < 128; i ++) { + s32 tq; + + tq = q[i] + yoff_s_n[i]; + tq = REDS2(tq); + tq = REDS1(tq); + tq = REDS1(tq); + q[i] = (tq <= 128 ? tq : tq - 257); + } + } + + for (i = 0; i < 16; i += 4) { + state[i + 0] = sc->state[i + 0] + ^ sph_dec32le_aligned(x + 4 * (i + 0)); + state[i + 1] = sc->state[i + 1] + ^ sph_dec32le_aligned(x + 4 * (i + 1)); + state[i + 2] = sc->state[i + 2] + ^ sph_dec32le_aligned(x + 4 * (i + 2)); + state[i + 3] = sc->state[i + 3] + ^ sph_dec32le_aligned(x + 4 * (i + 3)); + } + +#define WSREAD(sb, o1, o2, mm) do { \ + for (u = 0; u < 32; u += 4) { \ + size_t v = wsp[(u >> 2) + (sb)]; \ + w[u + 0] = INNER(q[v + 2 * 0 + (o1)], \ + q[v + 2 * 0 + (o2)], mm); \ + w[u + 1] = INNER(q[v + 2 * 1 + (o1)], \ + q[v + 2 * 1 + (o2)], mm); \ + w[u + 2] = INNER(q[v + 2 * 2 + (o1)], \ + q[v + 2 * 2 + (o2)], mm); \ + w[u + 3] = INNER(q[v + 2 * 3 + (o1)], \ + q[v + 2 * 3 + (o2)], mm); \ + } \ + } while (0) + + WSREAD( 0, 0, 1, 185); + one_round_small(state, w, 0, 3, 23, 17, 27); + WSREAD( 8, 0, 1, 185); + one_round_small(state, w, 2, 28, 19, 22, 7); + WSREAD(16, -128, -64, 233); + one_round_small(state, w, 1, 29, 9, 15, 5); + WSREAD(24, -191, -127, 233); + one_round_small(state, w, 0, 4, 13, 10, 25); + +#undef WSREAD + + STEP_SMALL(sc->state[ 0], sc->state[ 1], sc->state[ 2], sc->state[ 3], + IF, 4, 13, PP4_2_); + STEP_SMALL(sc->state[ 4], sc->state[ 5], sc->state[ 6], sc->state[ 7], + IF, 13, 10, PP4_0_); + STEP_SMALL(sc->state[ 8], sc->state[ 9], sc->state[10], sc->state[11], + IF, 10, 25, PP4_1_); + STEP_SMALL(sc->state[12], sc->state[13], sc->state[14], sc->state[15], + IF, 25, 4, PP4_2_); + + memcpy(sc->state, state, sizeof state); +} + +#undef A0 +#undef A1 +#undef A2 +#undef A3 +#undef B0 +#undef B1 +#undef B2 +#undef B3 +#undef C0 +#undef C1 +#undef C2 +#undef C3 +#undef D0 +#undef D1 +#undef D2 +#undef D3 + +#else + +#if SPH_SIMD_NOCOPY +#define A0 (sc->state[ 0]) +#define A1 (sc->state[ 1]) +#define A2 (sc->state[ 2]) +#define A3 (sc->state[ 3]) +#define B0 (sc->state[ 4]) +#define B1 (sc->state[ 5]) +#define B2 (sc->state[ 6]) +#define B3 (sc->state[ 7]) +#define C0 (sc->state[ 8]) +#define C1 (sc->state[ 9]) +#define C2 (sc->state[10]) +#define C3 (sc->state[11]) +#define D0 (sc->state[12]) +#define D1 (sc->state[13]) +#define D2 (sc->state[14]) +#define D3 (sc->state[15]) +#endif + +static void +compress_small(sph_simd_small_context *sc, int last) +{ + unsigned char *x; + s32 q[128]; + int i; + DECL_STATE_SMALL +#if SPH_SIMD_NOCOPY + sph_u32 saved[16]; +#endif + +#if SPH_SIMD_NOCOPY + memcpy(saved, sc->state, sizeof saved); +#endif + x = sc->buf; + FFT128(0, 1, 0, ll); + if (last) { + for (i = 0; i < 128; i ++) { + s32 tq; + + tq = q[i] + yoff_s_f[i]; + tq = REDS2(tq); + tq = REDS1(tq); + tq = REDS1(tq); + q[i] = (tq <= 128 ? tq : tq - 257); + } + } else { + for (i = 0; i < 128; i ++) { + s32 tq; + + tq = q[i] + yoff_s_n[i]; + tq = REDS2(tq); + tq = REDS1(tq); + tq = REDS1(tq); + q[i] = (tq <= 128 ? tq : tq - 257); + } + } + READ_STATE_SMALL(sc); + A0 ^= sph_dec32le_aligned(x + 0); + A1 ^= sph_dec32le_aligned(x + 4); + A2 ^= sph_dec32le_aligned(x + 8); + A3 ^= sph_dec32le_aligned(x + 12); + B0 ^= sph_dec32le_aligned(x + 16); + B1 ^= sph_dec32le_aligned(x + 20); + B2 ^= sph_dec32le_aligned(x + 24); + B3 ^= sph_dec32le_aligned(x + 28); + C0 ^= sph_dec32le_aligned(x + 32); + C1 ^= sph_dec32le_aligned(x + 36); + C2 ^= sph_dec32le_aligned(x + 40); + C3 ^= sph_dec32le_aligned(x + 44); + D0 ^= sph_dec32le_aligned(x + 48); + D1 ^= sph_dec32le_aligned(x + 52); + D2 ^= sph_dec32le_aligned(x + 56); + D3 ^= sph_dec32le_aligned(x + 60); + ONE_ROUND_SMALL(0_, 0, 3, 23, 17, 27); + ONE_ROUND_SMALL(1_, 2, 28, 19, 22, 7); + ONE_ROUND_SMALL(2_, 1, 29, 9, 15, 5); + ONE_ROUND_SMALL(3_, 0, 4, 13, 10, 25); +#if SPH_SIMD_NOCOPY + STEP_SMALL(saved[ 0], saved[ 1], saved[ 2], saved[ 3], + IF, 4, 13, PP4_2_); + STEP_SMALL(saved[ 4], saved[ 5], saved[ 6], saved[ 7], + IF, 13, 10, PP4_0_); + STEP_SMALL(saved[ 8], saved[ 9], saved[10], saved[11], + IF, 10, 25, PP4_1_); + STEP_SMALL(saved[12], saved[13], saved[14], saved[15], + IF, 25, 4, PP4_2_); +#else + STEP_SMALL(sc->state[ 0], sc->state[ 1], sc->state[ 2], sc->state[ 3], + IF, 4, 13, PP4_2_); + STEP_SMALL(sc->state[ 4], sc->state[ 5], sc->state[ 6], sc->state[ 7], + IF, 13, 10, PP4_0_); + STEP_SMALL(sc->state[ 8], sc->state[ 9], sc->state[10], sc->state[11], + IF, 10, 25, PP4_1_); + STEP_SMALL(sc->state[12], sc->state[13], sc->state[14], sc->state[15], + IF, 25, 4, PP4_2_); + WRITE_STATE_SMALL(sc); +#endif +} + +#if SPH_SIMD_NOCOPY +#undef A0 +#undef A1 +#undef A2 +#undef A3 +#undef B0 +#undef B1 +#undef B2 +#undef B3 +#undef C0 +#undef C1 +#undef C2 +#undef C3 +#undef D0 +#undef D1 +#undef D2 +#undef D3 +#endif + +#endif + +#if SPH_SMALL_FOOTPRINT_SIMD + +#define A0 state[ 0] +#define A1 state[ 1] +#define A2 state[ 2] +#define A3 state[ 3] +#define A4 state[ 4] +#define A5 state[ 5] +#define A6 state[ 6] +#define A7 state[ 7] +#define B0 state[ 8] +#define B1 state[ 9] +#define B2 state[10] +#define B3 state[11] +#define B4 state[12] +#define B5 state[13] +#define B6 state[14] +#define B7 state[15] +#define C0 state[16] +#define C1 state[17] +#define C2 state[18] +#define C3 state[19] +#define C4 state[20] +#define C5 state[21] +#define C6 state[22] +#define C7 state[23] +#define D0 state[24] +#define D1 state[25] +#define D2 state[26] +#define D3 state[27] +#define D4 state[28] +#define D5 state[29] +#define D6 state[30] +#define D7 state[31] + +/* + * Not needed -- already defined for SIMD-224 / SIMD-256 + * +#define STEP2_ELT(n, w, fun, s, ppb) do { \ + u32 tt = T32(D ## n + (w) + fun(A ## n, B ## n, C ## n)); \ + A ## n = T32(ROL32(tt, s) + tA[(ppb) ^ n]); \ + D ## n = C ## n; \ + C ## n = B ## n; \ + B ## n = tA[n]; \ + } while (0) + */ + +#define STEP2_BIG(w0, w1, w2, w3, w4, w5, w6, w7, fun, r, s, pp8b) do { \ + u32 tA[8]; \ + tA[0] = ROL32(A0, r); \ + tA[1] = ROL32(A1, r); \ + tA[2] = ROL32(A2, r); \ + tA[3] = ROL32(A3, r); \ + tA[4] = ROL32(A4, r); \ + tA[5] = ROL32(A5, r); \ + tA[6] = ROL32(A6, r); \ + tA[7] = ROL32(A7, r); \ + STEP2_ELT(0, w0, fun, s, pp8b); \ + STEP2_ELT(1, w1, fun, s, pp8b); \ + STEP2_ELT(2, w2, fun, s, pp8b); \ + STEP2_ELT(3, w3, fun, s, pp8b); \ + STEP2_ELT(4, w4, fun, s, pp8b); \ + STEP2_ELT(5, w5, fun, s, pp8b); \ + STEP2_ELT(6, w6, fun, s, pp8b); \ + STEP2_ELT(7, w7, fun, s, pp8b); \ + } while (0) + +static void +one_round_big(u32 *state, u32 *w, int isp, int p0, int p1, int p2, int p3) +{ + static const int pp8k[] = { 1, 6, 2, 3, 5, 7, 4, 1, 6, 2, 3 }; + + STEP2_BIG(w[ 0], w[ 1], w[ 2], w[ 3], w[ 4], w[ 5], w[ 6], w[ 7], + IF, p0, p1, pp8k[isp + 0]); + STEP2_BIG(w[ 8], w[ 9], w[10], w[11], w[12], w[13], w[14], w[15], + IF, p1, p2, pp8k[isp + 1]); + STEP2_BIG(w[16], w[17], w[18], w[19], w[20], w[21], w[22], w[23], + IF, p2, p3, pp8k[isp + 2]); + STEP2_BIG(w[24], w[25], w[26], w[27], w[28], w[29], w[30], w[31], + IF, p3, p0, pp8k[isp + 3]); + STEP2_BIG(w[32], w[33], w[34], w[35], w[36], w[37], w[38], w[39], + MAJ, p0, p1, pp8k[isp + 4]); + STEP2_BIG(w[40], w[41], w[42], w[43], w[44], w[45], w[46], w[47], + MAJ, p1, p2, pp8k[isp + 5]); + STEP2_BIG(w[48], w[49], w[50], w[51], w[52], w[53], w[54], w[55], + MAJ, p2, p3, pp8k[isp + 6]); + STEP2_BIG(w[56], w[57], w[58], w[59], w[60], w[61], w[62], w[63], + MAJ, p3, p0, pp8k[isp + 7]); +} + +static void +compress_big(sph_simd_big_context *sc, int last) +{ + unsigned char *x; + s32 q[256]; + int i; + u32 w[64]; + u32 state[32]; + size_t u; + + static const size_t wbp[32] = { + 4 << 4, 6 << 4, 0 << 4, 2 << 4, + 7 << 4, 5 << 4, 3 << 4, 1 << 4, + 15 << 4, 11 << 4, 12 << 4, 8 << 4, + 9 << 4, 13 << 4, 10 << 4, 14 << 4, + 17 << 4, 18 << 4, 23 << 4, 20 << 4, + 22 << 4, 21 << 4, 16 << 4, 19 << 4, + 30 << 4, 24 << 4, 25 << 4, 31 << 4, + 27 << 4, 29 << 4, 28 << 4, 26 << 4 + }; + + x = sc->buf; + FFT256(0, 1, 0, ll); + if (last) { + for (i = 0; i < 256; i ++) { + s32 tq; + + tq = q[i] + yoff_b_f[i]; + tq = REDS2(tq); + tq = REDS1(tq); + tq = REDS1(tq); + q[i] = (tq <= 128 ? tq : tq - 257); + } + } else { + for (i = 0; i < 256; i ++) { + s32 tq; + + tq = q[i] + yoff_b_n[i]; + tq = REDS2(tq); + tq = REDS1(tq); + tq = REDS1(tq); + q[i] = (tq <= 128 ? tq : tq - 257); + } + } + + for (i = 0; i < 32; i += 8) { + state[i + 0] = sc->state[i + 0] + ^ sph_dec32le_aligned(x + 4 * (i + 0)); + state[i + 1] = sc->state[i + 1] + ^ sph_dec32le_aligned(x + 4 * (i + 1)); + state[i + 2] = sc->state[i + 2] + ^ sph_dec32le_aligned(x + 4 * (i + 2)); + state[i + 3] = sc->state[i + 3] + ^ sph_dec32le_aligned(x + 4 * (i + 3)); + state[i + 4] = sc->state[i + 4] + ^ sph_dec32le_aligned(x + 4 * (i + 4)); + state[i + 5] = sc->state[i + 5] + ^ sph_dec32le_aligned(x + 4 * (i + 5)); + state[i + 6] = sc->state[i + 6] + ^ sph_dec32le_aligned(x + 4 * (i + 6)); + state[i + 7] = sc->state[i + 7] + ^ sph_dec32le_aligned(x + 4 * (i + 7)); + } + +#define WBREAD(sb, o1, o2, mm) do { \ + for (u = 0; u < 64; u += 8) { \ + size_t v = wbp[(u >> 3) + (sb)]; \ + w[u + 0] = INNER(q[v + 2 * 0 + (o1)], \ + q[v + 2 * 0 + (o2)], mm); \ + w[u + 1] = INNER(q[v + 2 * 1 + (o1)], \ + q[v + 2 * 1 + (o2)], mm); \ + w[u + 2] = INNER(q[v + 2 * 2 + (o1)], \ + q[v + 2 * 2 + (o2)], mm); \ + w[u + 3] = INNER(q[v + 2 * 3 + (o1)], \ + q[v + 2 * 3 + (o2)], mm); \ + w[u + 4] = INNER(q[v + 2 * 4 + (o1)], \ + q[v + 2 * 4 + (o2)], mm); \ + w[u + 5] = INNER(q[v + 2 * 5 + (o1)], \ + q[v + 2 * 5 + (o2)], mm); \ + w[u + 6] = INNER(q[v + 2 * 6 + (o1)], \ + q[v + 2 * 6 + (o2)], mm); \ + w[u + 7] = INNER(q[v + 2 * 7 + (o1)], \ + q[v + 2 * 7 + (o2)], mm); \ + } \ + } while (0) + + WBREAD( 0, 0, 1, 185); + one_round_big(state, w, 0, 3, 23, 17, 27); + WBREAD( 8, 0, 1, 185); + one_round_big(state, w, 1, 28, 19, 22, 7); + WBREAD(16, -256, -128, 233); + one_round_big(state, w, 2, 29, 9, 15, 5); + WBREAD(24, -383, -255, 233); + one_round_big(state, w, 3, 4, 13, 10, 25); + +#undef WBREAD + + STEP_BIG( + sc->state[ 0], sc->state[ 1], sc->state[ 2], sc->state[ 3], + sc->state[ 4], sc->state[ 5], sc->state[ 6], sc->state[ 7], + IF, 4, 13, PP8_4_); + STEP_BIG( + sc->state[ 8], sc->state[ 9], sc->state[10], sc->state[11], + sc->state[12], sc->state[13], sc->state[14], sc->state[15], + IF, 13, 10, PP8_5_); + STEP_BIG( + sc->state[16], sc->state[17], sc->state[18], sc->state[19], + sc->state[20], sc->state[21], sc->state[22], sc->state[23], + IF, 10, 25, PP8_6_); + STEP_BIG( + sc->state[24], sc->state[25], sc->state[26], sc->state[27], + sc->state[28], sc->state[29], sc->state[30], sc->state[31], + IF, 25, 4, PP8_0_); + + memcpy(sc->state, state, sizeof state); +} + +#undef A0 +#undef A1 +#undef A2 +#undef A3 +#undef A4 +#undef A5 +#undef A6 +#undef A7 +#undef B0 +#undef B1 +#undef B2 +#undef B3 +#undef B4 +#undef B5 +#undef B6 +#undef B7 +#undef C0 +#undef C1 +#undef C2 +#undef C3 +#undef C4 +#undef C5 +#undef C6 +#undef C7 +#undef D0 +#undef D1 +#undef D2 +#undef D3 +#undef D4 +#undef D5 +#undef D6 +#undef D7 + +#else + +#if SPH_SIMD_NOCOPY +#define A0 (sc->state[ 0]) +#define A1 (sc->state[ 1]) +#define A2 (sc->state[ 2]) +#define A3 (sc->state[ 3]) +#define A4 (sc->state[ 4]) +#define A5 (sc->state[ 5]) +#define A6 (sc->state[ 6]) +#define A7 (sc->state[ 7]) +#define B0 (sc->state[ 8]) +#define B1 (sc->state[ 9]) +#define B2 (sc->state[10]) +#define B3 (sc->state[11]) +#define B4 (sc->state[12]) +#define B5 (sc->state[13]) +#define B6 (sc->state[14]) +#define B7 (sc->state[15]) +#define C0 (sc->state[16]) +#define C1 (sc->state[17]) +#define C2 (sc->state[18]) +#define C3 (sc->state[19]) +#define C4 (sc->state[20]) +#define C5 (sc->state[21]) +#define C6 (sc->state[22]) +#define C7 (sc->state[23]) +#define D0 (sc->state[24]) +#define D1 (sc->state[25]) +#define D2 (sc->state[26]) +#define D3 (sc->state[27]) +#define D4 (sc->state[28]) +#define D5 (sc->state[29]) +#define D6 (sc->state[30]) +#define D7 (sc->state[31]) +#endif + +static void +compress_big(sph_simd_big_context *sc, int last) +{ + unsigned char *x; + s32 q[256]; + int i; + DECL_STATE_BIG +#if SPH_SIMD_NOCOPY + sph_u32 saved[32]; +#endif + +#if SPH_SIMD_NOCOPY + memcpy(saved, sc->state, sizeof saved); +#endif + + x = sc->buf; + FFT256(0, 1, 0, ll); + if (last) { + for (i = 0; i < 256; i ++) { + s32 tq; + + tq = q[i] + yoff_b_f[i]; + tq = REDS2(tq); + tq = REDS1(tq); + tq = REDS1(tq); + q[i] = (tq <= 128 ? tq : tq - 257); + } + } else { + for (i = 0; i < 256; i ++) { + s32 tq; + + tq = q[i] + yoff_b_n[i]; + tq = REDS2(tq); + tq = REDS1(tq); + tq = REDS1(tq); + q[i] = (tq <= 128 ? tq : tq - 257); + } + } + READ_STATE_BIG(sc); + A0 ^= sph_dec32le_aligned(x + 0); + A1 ^= sph_dec32le_aligned(x + 4); + A2 ^= sph_dec32le_aligned(x + 8); + A3 ^= sph_dec32le_aligned(x + 12); + A4 ^= sph_dec32le_aligned(x + 16); + A5 ^= sph_dec32le_aligned(x + 20); + A6 ^= sph_dec32le_aligned(x + 24); + A7 ^= sph_dec32le_aligned(x + 28); + B0 ^= sph_dec32le_aligned(x + 32); + B1 ^= sph_dec32le_aligned(x + 36); + B2 ^= sph_dec32le_aligned(x + 40); + B3 ^= sph_dec32le_aligned(x + 44); + B4 ^= sph_dec32le_aligned(x + 48); + B5 ^= sph_dec32le_aligned(x + 52); + B6 ^= sph_dec32le_aligned(x + 56); + B7 ^= sph_dec32le_aligned(x + 60); + C0 ^= sph_dec32le_aligned(x + 64); + C1 ^= sph_dec32le_aligned(x + 68); + C2 ^= sph_dec32le_aligned(x + 72); + C3 ^= sph_dec32le_aligned(x + 76); + C4 ^= sph_dec32le_aligned(x + 80); + C5 ^= sph_dec32le_aligned(x + 84); + C6 ^= sph_dec32le_aligned(x + 88); + C7 ^= sph_dec32le_aligned(x + 92); + D0 ^= sph_dec32le_aligned(x + 96); + D1 ^= sph_dec32le_aligned(x + 100); + D2 ^= sph_dec32le_aligned(x + 104); + D3 ^= sph_dec32le_aligned(x + 108); + D4 ^= sph_dec32le_aligned(x + 112); + D5 ^= sph_dec32le_aligned(x + 116); + D6 ^= sph_dec32le_aligned(x + 120); + D7 ^= sph_dec32le_aligned(x + 124); + + ONE_ROUND_BIG(0_, 0, 3, 23, 17, 27); + ONE_ROUND_BIG(1_, 1, 28, 19, 22, 7); + ONE_ROUND_BIG(2_, 2, 29, 9, 15, 5); + ONE_ROUND_BIG(3_, 3, 4, 13, 10, 25); +#if SPH_SIMD_NOCOPY + STEP_BIG( + saved[ 0], saved[ 1], saved[ 2], saved[ 3], + saved[ 4], saved[ 5], saved[ 6], saved[ 7], + IF, 4, 13, PP8_4_); + STEP_BIG( + saved[ 8], saved[ 9], saved[10], saved[11], + saved[12], saved[13], saved[14], saved[15], + IF, 13, 10, PP8_5_); + STEP_BIG( + saved[16], saved[17], saved[18], saved[19], + saved[20], saved[21], saved[22], saved[23], + IF, 10, 25, PP8_6_); + STEP_BIG( + saved[24], saved[25], saved[26], saved[27], + saved[28], saved[29], saved[30], saved[31], + IF, 25, 4, PP8_0_); +#else + STEP_BIG( + sc->state[ 0], sc->state[ 1], sc->state[ 2], sc->state[ 3], + sc->state[ 4], sc->state[ 5], sc->state[ 6], sc->state[ 7], + IF, 4, 13, PP8_4_); + STEP_BIG( + sc->state[ 8], sc->state[ 9], sc->state[10], sc->state[11], + sc->state[12], sc->state[13], sc->state[14], sc->state[15], + IF, 13, 10, PP8_5_); + STEP_BIG( + sc->state[16], sc->state[17], sc->state[18], sc->state[19], + sc->state[20], sc->state[21], sc->state[22], sc->state[23], + IF, 10, 25, PP8_6_); + STEP_BIG( + sc->state[24], sc->state[25], sc->state[26], sc->state[27], + sc->state[28], sc->state[29], sc->state[30], sc->state[31], + IF, 25, 4, PP8_0_); + WRITE_STATE_BIG(sc); +#endif +} + +#if SPH_SIMD_NOCOPY +#undef A0 +#undef A1 +#undef A2 +#undef A3 +#undef A4 +#undef A5 +#undef A6 +#undef A7 +#undef B0 +#undef B1 +#undef B2 +#undef B3 +#undef B4 +#undef B5 +#undef B6 +#undef B7 +#undef C0 +#undef C1 +#undef C2 +#undef C3 +#undef C4 +#undef C5 +#undef C6 +#undef C7 +#undef D0 +#undef D1 +#undef D2 +#undef D3 +#undef D4 +#undef D5 +#undef D6 +#undef D7 +#endif + +#endif + +static const u32 IV224[] = { + C32(0x33586E9F), C32(0x12FFF033), C32(0xB2D9F64D), C32(0x6F8FEA53), + C32(0xDE943106), C32(0x2742E439), C32(0x4FBAB5AC), C32(0x62B9FF96), + C32(0x22E7B0AF), C32(0xC862B3A8), C32(0x33E00CDC), C32(0x236B86A6), + C32(0xF64AE77C), C32(0xFA373B76), C32(0x7DC1EE5B), C32(0x7FB29CE8) +}; + +static const u32 IV256[] = { + C32(0x4D567983), C32(0x07190BA9), C32(0x8474577B), C32(0x39D726E9), + C32(0xAAF3D925), C32(0x3EE20B03), C32(0xAFD5E751), C32(0xC96006D3), + C32(0xC2C2BA14), C32(0x49B3BCB4), C32(0xF67CAF46), C32(0x668626C9), + C32(0xE2EAA8D2), C32(0x1FF47833), C32(0xD0C661A5), C32(0x55693DE1) +}; + +static const u32 IV384[] = { + C32(0x8A36EEBC), C32(0x94A3BD90), C32(0xD1537B83), C32(0xB25B070B), + C32(0xF463F1B5), C32(0xB6F81E20), C32(0x0055C339), C32(0xB4D144D1), + C32(0x7360CA61), C32(0x18361A03), C32(0x17DCB4B9), C32(0x3414C45A), + C32(0xA699A9D2), C32(0xE39E9664), C32(0x468BFE77), C32(0x51D062F8), + C32(0xB9E3BFE8), C32(0x63BECE2A), C32(0x8FE506B9), C32(0xF8CC4AC2), + C32(0x7AE11542), C32(0xB1AADDA1), C32(0x64B06794), C32(0x28D2F462), + C32(0xE64071EC), C32(0x1DEB91A8), C32(0x8AC8DB23), C32(0x3F782AB5), + C32(0x039B5CB8), C32(0x71DDD962), C32(0xFADE2CEA), C32(0x1416DF71) +}; + +static const u32 IV512[] = { + C32(0x0BA16B95), C32(0x72F999AD), C32(0x9FECC2AE), C32(0xBA3264FC), + C32(0x5E894929), C32(0x8E9F30E5), C32(0x2F1DAA37), C32(0xF0F2C558), + C32(0xAC506643), C32(0xA90635A5), C32(0xE25B878B), C32(0xAAB7878F), + C32(0x88817F7A), C32(0x0A02892B), C32(0x559A7550), C32(0x598F657E), + C32(0x7EEF60A1), C32(0x6B70E3E8), C32(0x9C1714D1), C32(0xB958E2A8), + C32(0xAB02675E), C32(0xED1C014F), C32(0xCD8D65BB), C32(0xFDB7A257), + C32(0x09254899), C32(0xD699C7BC), C32(0x9019B6DC), C32(0x2B9022E4), + C32(0x8FA14956), C32(0x21BF9BD3), C32(0xB94D0943), C32(0x6FFDDC22) +}; + +static void +init_small(void *cc, const u32 *iv) +{ + sph_simd_small_context *sc; + + sc = cc; + memcpy(sc->state, iv, sizeof sc->state); + sc->count_low = sc->count_high = 0; + sc->ptr = 0; +} + +static void +init_big(void *cc, const u32 *iv) +{ + sph_simd_big_context *sc; + + sc = cc; + memcpy(sc->state, iv, sizeof sc->state); + sc->count_low = sc->count_high = 0; + sc->ptr = 0; +} + +static void +update_small(void *cc, const void *data, size_t len) +{ + sph_simd_small_context *sc; + + sc = cc; + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - sc->ptr; + if (clen > len) + clen = len; + memcpy(sc->buf + sc->ptr, data, clen); + data = (const unsigned char *)data + clen; + len -= clen; + if ((sc->ptr += clen) == sizeof sc->buf) { + compress_small(sc, 0); + sc->ptr = 0; + sc->count_low = T32(sc->count_low + 1); + if (sc->count_low == 0) + sc->count_high ++; + } + } +} + +static void +update_big(void *cc, const void *data, size_t len) +{ + sph_simd_big_context *sc; + + sc = cc; + while (len > 0) { + size_t clen; + + clen = (sizeof sc->buf) - sc->ptr; + if (clen > len) + clen = len; + memcpy(sc->buf + sc->ptr, data, clen); + data = (const unsigned char *)data + clen; + len -= clen; + if ((sc->ptr += clen) == sizeof sc->buf) { + compress_big(sc, 0); + sc->ptr = 0; + sc->count_low = T32(sc->count_low + 1); + if (sc->count_low == 0) + sc->count_high ++; + } + } +} + +static void +encode_count_small(unsigned char *dst, + u32 low, u32 high, size_t ptr, unsigned n) +{ + low = T32(low << 9); + high = T32(high << 9) + (low >> 23); + low += (ptr << 3) + n; + sph_enc32le(dst, low); + sph_enc32le(dst + 4, high); +} + +static void +encode_count_big(unsigned char *dst, + u32 low, u32 high, size_t ptr, unsigned n) +{ + low = T32(low << 10); + high = T32(high << 10) + (low >> 22); + low += (ptr << 3) + n; + sph_enc32le(dst, low); + sph_enc32le(dst + 4, high); +} + +static void +finalize_small(void *cc, unsigned ub, unsigned n, void *dst, size_t dst_len) +{ + sph_simd_small_context *sc; + unsigned char *d; + size_t u; + + sc = cc; + if (sc->ptr > 0 || n > 0) { + memset(sc->buf + sc->ptr, 0, + (sizeof sc->buf) - sc->ptr); + sc->buf[sc->ptr] = ub & (0xFF << (8 - n)); + compress_small(sc, 0); + } + memset(sc->buf, 0, sizeof sc->buf); + encode_count_small(sc->buf, sc->count_low, sc->count_high, sc->ptr, n); + compress_small(sc, 1); + d = dst; + for (d = dst, u = 0; u < dst_len; u ++) + sph_enc32le(d + (u << 2), sc->state[u]); +} + +static void +finalize_big(void *cc, unsigned ub, unsigned n, void *dst, size_t dst_len) +{ + sph_simd_big_context *sc; + unsigned char *d; + size_t u; + + sc = cc; + if (sc->ptr > 0 || n > 0) { + memset(sc->buf + sc->ptr, 0, + (sizeof sc->buf) - sc->ptr); + sc->buf[sc->ptr] = ub & (0xFF << (8 - n)); + compress_big(sc, 0); + } + memset(sc->buf, 0, sizeof sc->buf); + encode_count_big(sc->buf, sc->count_low, sc->count_high, sc->ptr, n); + compress_big(sc, 1); + d = dst; + for (d = dst, u = 0; u < dst_len; u ++) + sph_enc32le(d + (u << 2), sc->state[u]); +} + +void +sph_simd224_init(void *cc) +{ + init_small(cc, IV224); +} + +void +sph_simd224(void *cc, const void *data, size_t len) +{ + update_small(cc, data, len); +} + +void +sph_simd224_close(void *cc, void *dst) +{ + sph_simd224_addbits_and_close(cc, 0, 0, dst); +} + +void +sph_simd224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + finalize_small(cc, ub, n, dst, 7); + sph_simd224_init(cc); +} + +void +sph_simd256_init(void *cc) +{ + init_small(cc, IV256); +} + +void +sph_simd256(void *cc, const void *data, size_t len) +{ + update_small(cc, data, len); +} + +void +sph_simd256_close(void *cc, void *dst) +{ + sph_simd256_addbits_and_close(cc, 0, 0, dst); +} + +void +sph_simd256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + finalize_small(cc, ub, n, dst, 8); + sph_simd256_init(cc); +} + +void +sph_simd384_init(void *cc) +{ + init_big(cc, IV384); +} + +void +sph_simd384(void *cc, const void *data, size_t len) +{ + update_big(cc, data, len); +} + +void +sph_simd384_close(void *cc, void *dst) +{ + sph_simd384_addbits_and_close(cc, 0, 0, dst); +} + +void +sph_simd384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + finalize_big(cc, ub, n, dst, 12); + sph_simd384_init(cc); +} + +void +sph_simd512_init(void *cc) +{ + init_big(cc, IV512); +} + +void +sph_simd512(void *cc, const void *data, size_t len) +{ + update_big(cc, data, len); +} + +void +sph_simd512_close(void *cc, void *dst) +{ + sph_simd512_addbits_and_close(cc, 0, 0, dst); +} + +void +sph_simd512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + finalize_big(cc, ub, n, dst, 16); + sph_simd512_init(cc); +} +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/sph/skein.c b/sph/skein.c new file mode 100644 index 0000000..7e47e35 --- /dev/null +++ b/sph/skein.c @@ -0,0 +1,1254 @@ +/* $Id: skein.c 254 2011-06-07 19:38:58Z tp $ */ +/* + * Skein implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_skein.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_SKEIN +#define SPH_SMALL_FOOTPRINT_SKEIN 1 +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +#if SPH_64 + +#if 0 +/* obsolete */ +/* + * M5_ ## s ## _ ## i evaluates to s+i mod 5 (0 <= s <= 18, 0 <= i <= 3). + */ + +#define M5_0_0 0 +#define M5_0_1 1 +#define M5_0_2 2 +#define M5_0_3 3 + +#define M5_1_0 1 +#define M5_1_1 2 +#define M5_1_2 3 +#define M5_1_3 4 + +#define M5_2_0 2 +#define M5_2_1 3 +#define M5_2_2 4 +#define M5_2_3 0 + +#define M5_3_0 3 +#define M5_3_1 4 +#define M5_3_2 0 +#define M5_3_3 1 + +#define M5_4_0 4 +#define M5_4_1 0 +#define M5_4_2 1 +#define M5_4_3 2 + +#define M5_5_0 0 +#define M5_5_1 1 +#define M5_5_2 2 +#define M5_5_3 3 + +#define M5_6_0 1 +#define M5_6_1 2 +#define M5_6_2 3 +#define M5_6_3 4 + +#define M5_7_0 2 +#define M5_7_1 3 +#define M5_7_2 4 +#define M5_7_3 0 + +#define M5_8_0 3 +#define M5_8_1 4 +#define M5_8_2 0 +#define M5_8_3 1 + +#define M5_9_0 4 +#define M5_9_1 0 +#define M5_9_2 1 +#define M5_9_3 2 + +#define M5_10_0 0 +#define M5_10_1 1 +#define M5_10_2 2 +#define M5_10_3 3 + +#define M5_11_0 1 +#define M5_11_1 2 +#define M5_11_2 3 +#define M5_11_3 4 + +#define M5_12_0 2 +#define M5_12_1 3 +#define M5_12_2 4 +#define M5_12_3 0 + +#define M5_13_0 3 +#define M5_13_1 4 +#define M5_13_2 0 +#define M5_13_3 1 + +#define M5_14_0 4 +#define M5_14_1 0 +#define M5_14_2 1 +#define M5_14_3 2 + +#define M5_15_0 0 +#define M5_15_1 1 +#define M5_15_2 2 +#define M5_15_3 3 + +#define M5_16_0 1 +#define M5_16_1 2 +#define M5_16_2 3 +#define M5_16_3 4 + +#define M5_17_0 2 +#define M5_17_1 3 +#define M5_17_2 4 +#define M5_17_3 0 + +#define M5_18_0 3 +#define M5_18_1 4 +#define M5_18_2 0 +#define M5_18_3 1 +#endif + +/* + * M9_ ## s ## _ ## i evaluates to s+i mod 9 (0 <= s <= 18, 0 <= i <= 7). + */ + +#define M9_0_0 0 +#define M9_0_1 1 +#define M9_0_2 2 +#define M9_0_3 3 +#define M9_0_4 4 +#define M9_0_5 5 +#define M9_0_6 6 +#define M9_0_7 7 + +#define M9_1_0 1 +#define M9_1_1 2 +#define M9_1_2 3 +#define M9_1_3 4 +#define M9_1_4 5 +#define M9_1_5 6 +#define M9_1_6 7 +#define M9_1_7 8 + +#define M9_2_0 2 +#define M9_2_1 3 +#define M9_2_2 4 +#define M9_2_3 5 +#define M9_2_4 6 +#define M9_2_5 7 +#define M9_2_6 8 +#define M9_2_7 0 + +#define M9_3_0 3 +#define M9_3_1 4 +#define M9_3_2 5 +#define M9_3_3 6 +#define M9_3_4 7 +#define M9_3_5 8 +#define M9_3_6 0 +#define M9_3_7 1 + +#define M9_4_0 4 +#define M9_4_1 5 +#define M9_4_2 6 +#define M9_4_3 7 +#define M9_4_4 8 +#define M9_4_5 0 +#define M9_4_6 1 +#define M9_4_7 2 + +#define M9_5_0 5 +#define M9_5_1 6 +#define M9_5_2 7 +#define M9_5_3 8 +#define M9_5_4 0 +#define M9_5_5 1 +#define M9_5_6 2 +#define M9_5_7 3 + +#define M9_6_0 6 +#define M9_6_1 7 +#define M9_6_2 8 +#define M9_6_3 0 +#define M9_6_4 1 +#define M9_6_5 2 +#define M9_6_6 3 +#define M9_6_7 4 + +#define M9_7_0 7 +#define M9_7_1 8 +#define M9_7_2 0 +#define M9_7_3 1 +#define M9_7_4 2 +#define M9_7_5 3 +#define M9_7_6 4 +#define M9_7_7 5 + +#define M9_8_0 8 +#define M9_8_1 0 +#define M9_8_2 1 +#define M9_8_3 2 +#define M9_8_4 3 +#define M9_8_5 4 +#define M9_8_6 5 +#define M9_8_7 6 + +#define M9_9_0 0 +#define M9_9_1 1 +#define M9_9_2 2 +#define M9_9_3 3 +#define M9_9_4 4 +#define M9_9_5 5 +#define M9_9_6 6 +#define M9_9_7 7 + +#define M9_10_0 1 +#define M9_10_1 2 +#define M9_10_2 3 +#define M9_10_3 4 +#define M9_10_4 5 +#define M9_10_5 6 +#define M9_10_6 7 +#define M9_10_7 8 + +#define M9_11_0 2 +#define M9_11_1 3 +#define M9_11_2 4 +#define M9_11_3 5 +#define M9_11_4 6 +#define M9_11_5 7 +#define M9_11_6 8 +#define M9_11_7 0 + +#define M9_12_0 3 +#define M9_12_1 4 +#define M9_12_2 5 +#define M9_12_3 6 +#define M9_12_4 7 +#define M9_12_5 8 +#define M9_12_6 0 +#define M9_12_7 1 + +#define M9_13_0 4 +#define M9_13_1 5 +#define M9_13_2 6 +#define M9_13_3 7 +#define M9_13_4 8 +#define M9_13_5 0 +#define M9_13_6 1 +#define M9_13_7 2 + +#define M9_14_0 5 +#define M9_14_1 6 +#define M9_14_2 7 +#define M9_14_3 8 +#define M9_14_4 0 +#define M9_14_5 1 +#define M9_14_6 2 +#define M9_14_7 3 + +#define M9_15_0 6 +#define M9_15_1 7 +#define M9_15_2 8 +#define M9_15_3 0 +#define M9_15_4 1 +#define M9_15_5 2 +#define M9_15_6 3 +#define M9_15_7 4 + +#define M9_16_0 7 +#define M9_16_1 8 +#define M9_16_2 0 +#define M9_16_3 1 +#define M9_16_4 2 +#define M9_16_5 3 +#define M9_16_6 4 +#define M9_16_7 5 + +#define M9_17_0 8 +#define M9_17_1 0 +#define M9_17_2 1 +#define M9_17_3 2 +#define M9_17_4 3 +#define M9_17_5 4 +#define M9_17_6 5 +#define M9_17_7 6 + +#define M9_18_0 0 +#define M9_18_1 1 +#define M9_18_2 2 +#define M9_18_3 3 +#define M9_18_4 4 +#define M9_18_5 5 +#define M9_18_6 6 +#define M9_18_7 7 + +/* + * M3_ ## s ## _ ## i evaluates to s+i mod 3 (0 <= s <= 18, 0 <= i <= 1). + */ + +#define M3_0_0 0 +#define M3_0_1 1 +#define M3_1_0 1 +#define M3_1_1 2 +#define M3_2_0 2 +#define M3_2_1 0 +#define M3_3_0 0 +#define M3_3_1 1 +#define M3_4_0 1 +#define M3_4_1 2 +#define M3_5_0 2 +#define M3_5_1 0 +#define M3_6_0 0 +#define M3_6_1 1 +#define M3_7_0 1 +#define M3_7_1 2 +#define M3_8_0 2 +#define M3_8_1 0 +#define M3_9_0 0 +#define M3_9_1 1 +#define M3_10_0 1 +#define M3_10_1 2 +#define M3_11_0 2 +#define M3_11_1 0 +#define M3_12_0 0 +#define M3_12_1 1 +#define M3_13_0 1 +#define M3_13_1 2 +#define M3_14_0 2 +#define M3_14_1 0 +#define M3_15_0 0 +#define M3_15_1 1 +#define M3_16_0 1 +#define M3_16_1 2 +#define M3_17_0 2 +#define M3_17_1 0 +#define M3_18_0 0 +#define M3_18_1 1 + +#define XCAT(x, y) XCAT_(x, y) +#define XCAT_(x, y) x ## y + +#if 0 +/* obsolete */ +#define SKSI(k, s, i) XCAT(k, XCAT(XCAT(XCAT(M5_, s), _), i)) +#define SKST(t, s, v) XCAT(t, XCAT(XCAT(XCAT(M3_, s), _), v)) +#endif + +#define SKBI(k, s, i) XCAT(k, XCAT(XCAT(XCAT(M9_, s), _), i)) +#define SKBT(t, s, v) XCAT(t, XCAT(XCAT(XCAT(M3_, s), _), v)) + +#if 0 +/* obsolete */ +#define TFSMALL_KINIT(k0, k1, k2, k3, k4, t0, t1, t2) do { \ + k4 = (k0 ^ k1) ^ (k2 ^ k3) ^ SPH_C64(0x1BD11BDAA9FC1A22); \ + t2 = t0 ^ t1; \ + } while (0) +#endif + +#define TFBIG_KINIT(k0, k1, k2, k3, k4, k5, k6, k7, k8, t0, t1, t2) do { \ + k8 = ((k0 ^ k1) ^ (k2 ^ k3)) ^ ((k4 ^ k5) ^ (k6 ^ k7)) \ + ^ SPH_C64(0x1BD11BDAA9FC1A22); \ + t2 = t0 ^ t1; \ + } while (0) + +#if 0 +/* obsolete */ +#define TFSMALL_ADDKEY(w0, w1, w2, w3, k, t, s) do { \ + w0 = SPH_T64(w0 + SKSI(k, s, 0)); \ + w1 = SPH_T64(w1 + SKSI(k, s, 1) + SKST(t, s, 0)); \ + w2 = SPH_T64(w2 + SKSI(k, s, 2) + SKST(t, s, 1)); \ + w3 = SPH_T64(w3 + SKSI(k, s, 3) + (sph_u64)s); \ + } while (0) +#endif + +#if SPH_SMALL_FOOTPRINT_SKEIN + +#define TFBIG_ADDKEY(s, tt0, tt1) do { \ + p0 = SPH_T64(p0 + h[s + 0]); \ + p1 = SPH_T64(p1 + h[s + 1]); \ + p2 = SPH_T64(p2 + h[s + 2]); \ + p3 = SPH_T64(p3 + h[s + 3]); \ + p4 = SPH_T64(p4 + h[s + 4]); \ + p5 = SPH_T64(p5 + h[s + 5] + tt0); \ + p6 = SPH_T64(p6 + h[s + 6] + tt1); \ + p7 = SPH_T64(p7 + h[s + 7] + (sph_u64)s); \ + } while (0) + +#else + +#define TFBIG_ADDKEY(w0, w1, w2, w3, w4, w5, w6, w7, k, t, s) do { \ + w0 = SPH_T64(w0 + SKBI(k, s, 0)); \ + w1 = SPH_T64(w1 + SKBI(k, s, 1)); \ + w2 = SPH_T64(w2 + SKBI(k, s, 2)); \ + w3 = SPH_T64(w3 + SKBI(k, s, 3)); \ + w4 = SPH_T64(w4 + SKBI(k, s, 4)); \ + w5 = SPH_T64(w5 + SKBI(k, s, 5) + SKBT(t, s, 0)); \ + w6 = SPH_T64(w6 + SKBI(k, s, 6) + SKBT(t, s, 1)); \ + w7 = SPH_T64(w7 + SKBI(k, s, 7) + (sph_u64)s); \ + } while (0) + +#endif + +#if 0 +/* obsolete */ +#define TFSMALL_MIX(x0, x1, rc) do { \ + x0 = SPH_T64(x0 + x1); \ + x1 = SPH_ROTL64(x1, rc) ^ x0; \ + } while (0) +#endif + +#define TFBIG_MIX(x0, x1, rc) do { \ + x0 = SPH_T64(x0 + x1); \ + x1 = SPH_ROTL64(x1, rc) ^ x0; \ + } while (0) + +#if 0 +/* obsolete */ +#define TFSMALL_MIX4(w0, w1, w2, w3, rc0, rc1) do { \ + TFSMALL_MIX(w0, w1, rc0); \ + TFSMALL_MIX(w2, w3, rc1); \ + } while (0) +#endif + +#define TFBIG_MIX8(w0, w1, w2, w3, w4, w5, w6, w7, rc0, rc1, rc2, rc3) do { \ + TFBIG_MIX(w0, w1, rc0); \ + TFBIG_MIX(w2, w3, rc1); \ + TFBIG_MIX(w4, w5, rc2); \ + TFBIG_MIX(w6, w7, rc3); \ + } while (0) + +#if 0 +/* obsolete */ +#define TFSMALL_4e(s) do { \ + TFSMALL_ADDKEY(p0, p1, p2, p3, h, t, s); \ + TFSMALL_MIX4(p0, p1, p2, p3, 14, 16); \ + TFSMALL_MIX4(p0, p3, p2, p1, 52, 57); \ + TFSMALL_MIX4(p0, p1, p2, p3, 23, 40); \ + TFSMALL_MIX4(p0, p3, p2, p1, 5, 37); \ + } while (0) + +#define TFSMALL_4o(s) do { \ + TFSMALL_ADDKEY(p0, p1, p2, p3, h, t, s); \ + TFSMALL_MIX4(p0, p1, p2, p3, 25, 33); \ + TFSMALL_MIX4(p0, p3, p2, p1, 46, 12); \ + TFSMALL_MIX4(p0, p1, p2, p3, 58, 22); \ + TFSMALL_MIX4(p0, p3, p2, p1, 32, 32); \ + } while (0) +#endif + +#if SPH_SMALL_FOOTPRINT_SKEIN + +#define TFBIG_4e(s) do { \ + TFBIG_ADDKEY(s, t0, t1); \ + TFBIG_MIX8(p0, p1, p2, p3, p4, p5, p6, p7, 46, 36, 19, 37); \ + TFBIG_MIX8(p2, p1, p4, p7, p6, p5, p0, p3, 33, 27, 14, 42); \ + TFBIG_MIX8(p4, p1, p6, p3, p0, p5, p2, p7, 17, 49, 36, 39); \ + TFBIG_MIX8(p6, p1, p0, p7, p2, p5, p4, p3, 44, 9, 54, 56); \ + } while (0) + +#define TFBIG_4o(s) do { \ + TFBIG_ADDKEY(s, t1, t2); \ + TFBIG_MIX8(p0, p1, p2, p3, p4, p5, p6, p7, 39, 30, 34, 24); \ + TFBIG_MIX8(p2, p1, p4, p7, p6, p5, p0, p3, 13, 50, 10, 17); \ + TFBIG_MIX8(p4, p1, p6, p3, p0, p5, p2, p7, 25, 29, 39, 43); \ + TFBIG_MIX8(p6, p1, p0, p7, p2, p5, p4, p3, 8, 35, 56, 22); \ + } while (0) + +#else + +#define TFBIG_4e(s) do { \ + TFBIG_ADDKEY(p0, p1, p2, p3, p4, p5, p6, p7, h, t, s); \ + TFBIG_MIX8(p0, p1, p2, p3, p4, p5, p6, p7, 46, 36, 19, 37); \ + TFBIG_MIX8(p2, p1, p4, p7, p6, p5, p0, p3, 33, 27, 14, 42); \ + TFBIG_MIX8(p4, p1, p6, p3, p0, p5, p2, p7, 17, 49, 36, 39); \ + TFBIG_MIX8(p6, p1, p0, p7, p2, p5, p4, p3, 44, 9, 54, 56); \ + } while (0) + +#define TFBIG_4o(s) do { \ + TFBIG_ADDKEY(p0, p1, p2, p3, p4, p5, p6, p7, h, t, s); \ + TFBIG_MIX8(p0, p1, p2, p3, p4, p5, p6, p7, 39, 30, 34, 24); \ + TFBIG_MIX8(p2, p1, p4, p7, p6, p5, p0, p3, 13, 50, 10, 17); \ + TFBIG_MIX8(p4, p1, p6, p3, p0, p5, p2, p7, 25, 29, 39, 43); \ + TFBIG_MIX8(p6, p1, p0, p7, p2, p5, p4, p3, 8, 35, 56, 22); \ + } while (0) + +#endif + +#if 0 +/* obsolete */ +#define UBI_SMALL(etype, extra) do { \ + sph_u64 h4, t0, t1, t2; \ + sph_u64 m0 = sph_dec64le(buf + 0); \ + sph_u64 m1 = sph_dec64le(buf + 8); \ + sph_u64 m2 = sph_dec64le(buf + 16); \ + sph_u64 m3 = sph_dec64le(buf + 24); \ + sph_u64 p0 = m0; \ + sph_u64 p1 = m1; \ + sph_u64 p2 = m2; \ + sph_u64 p3 = m3; \ + t0 = SPH_T64(bcount << 5) + (sph_u64)(extra); \ + t1 = (bcount >> 59) + ((sph_u64)(etype) << 55); \ + TFSMALL_KINIT(h0, h1, h2, h3, h4, t0, t1, t2); \ + TFSMALL_4e(0); \ + TFSMALL_4o(1); \ + TFSMALL_4e(2); \ + TFSMALL_4o(3); \ + TFSMALL_4e(4); \ + TFSMALL_4o(5); \ + TFSMALL_4e(6); \ + TFSMALL_4o(7); \ + TFSMALL_4e(8); \ + TFSMALL_4o(9); \ + TFSMALL_4e(10); \ + TFSMALL_4o(11); \ + TFSMALL_4e(12); \ + TFSMALL_4o(13); \ + TFSMALL_4e(14); \ + TFSMALL_4o(15); \ + TFSMALL_4e(16); \ + TFSMALL_4o(17); \ + TFSMALL_ADDKEY(p0, p1, p2, p3, h, t, 18); \ + h0 = m0 ^ p0; \ + h1 = m1 ^ p1; \ + h2 = m2 ^ p2; \ + h3 = m3 ^ p3; \ + } while (0) +#endif + +#if SPH_SMALL_FOOTPRINT_SKEIN + +#define UBI_BIG(etype, extra) do { \ + sph_u64 t0, t1, t2; \ + unsigned u; \ + sph_u64 m0 = sph_dec64le_aligned(buf + 0); \ + sph_u64 m1 = sph_dec64le_aligned(buf + 8); \ + sph_u64 m2 = sph_dec64le_aligned(buf + 16); \ + sph_u64 m3 = sph_dec64le_aligned(buf + 24); \ + sph_u64 m4 = sph_dec64le_aligned(buf + 32); \ + sph_u64 m5 = sph_dec64le_aligned(buf + 40); \ + sph_u64 m6 = sph_dec64le_aligned(buf + 48); \ + sph_u64 m7 = sph_dec64le_aligned(buf + 56); \ + sph_u64 p0 = m0; \ + sph_u64 p1 = m1; \ + sph_u64 p2 = m2; \ + sph_u64 p3 = m3; \ + sph_u64 p4 = m4; \ + sph_u64 p5 = m5; \ + sph_u64 p6 = m6; \ + sph_u64 p7 = m7; \ + t0 = SPH_T64(bcount << 6) + (sph_u64)(extra); \ + t1 = (bcount >> 58) + ((sph_u64)(etype) << 55); \ + TFBIG_KINIT(h[0], h[1], h[2], h[3], h[4], h[5], \ + h[6], h[7], h[8], t0, t1, t2); \ + for (u = 0; u <= 15; u += 3) { \ + h[u + 9] = h[u + 0]; \ + h[u + 10] = h[u + 1]; \ + h[u + 11] = h[u + 2]; \ + } \ + for (u = 0; u < 9; u ++) { \ + sph_u64 s = u << 1; \ + sph_u64 tmp; \ + TFBIG_4e(s); \ + TFBIG_4o(s + 1); \ + tmp = t2; \ + t2 = t1; \ + t1 = t0; \ + t0 = tmp; \ + } \ + TFBIG_ADDKEY(18, t0, t1); \ + h[0] = m0 ^ p0; \ + h[1] = m1 ^ p1; \ + h[2] = m2 ^ p2; \ + h[3] = m3 ^ p3; \ + h[4] = m4 ^ p4; \ + h[5] = m5 ^ p5; \ + h[6] = m6 ^ p6; \ + h[7] = m7 ^ p7; \ + } while (0) + +#else + +#define UBI_BIG(etype, extra) do { \ + sph_u64 h8, t0, t1, t2; \ + sph_u64 m0 = sph_dec64le_aligned(buf + 0); \ + sph_u64 m1 = sph_dec64le_aligned(buf + 8); \ + sph_u64 m2 = sph_dec64le_aligned(buf + 16); \ + sph_u64 m3 = sph_dec64le_aligned(buf + 24); \ + sph_u64 m4 = sph_dec64le_aligned(buf + 32); \ + sph_u64 m5 = sph_dec64le_aligned(buf + 40); \ + sph_u64 m6 = sph_dec64le_aligned(buf + 48); \ + sph_u64 m7 = sph_dec64le_aligned(buf + 56); \ + sph_u64 p0 = m0; \ + sph_u64 p1 = m1; \ + sph_u64 p2 = m2; \ + sph_u64 p3 = m3; \ + sph_u64 p4 = m4; \ + sph_u64 p5 = m5; \ + sph_u64 p6 = m6; \ + sph_u64 p7 = m7; \ + t0 = SPH_T64(bcount << 6) + (sph_u64)(extra); \ + t1 = (bcount >> 58) + ((sph_u64)(etype) << 55); \ + TFBIG_KINIT(h0, h1, h2, h3, h4, h5, h6, h7, h8, t0, t1, t2); \ + TFBIG_4e(0); \ + TFBIG_4o(1); \ + TFBIG_4e(2); \ + TFBIG_4o(3); \ + TFBIG_4e(4); \ + TFBIG_4o(5); \ + TFBIG_4e(6); \ + TFBIG_4o(7); \ + TFBIG_4e(8); \ + TFBIG_4o(9); \ + TFBIG_4e(10); \ + TFBIG_4o(11); \ + TFBIG_4e(12); \ + TFBIG_4o(13); \ + TFBIG_4e(14); \ + TFBIG_4o(15); \ + TFBIG_4e(16); \ + TFBIG_4o(17); \ + TFBIG_ADDKEY(p0, p1, p2, p3, p4, p5, p6, p7, h, t, 18); \ + h0 = m0 ^ p0; \ + h1 = m1 ^ p1; \ + h2 = m2 ^ p2; \ + h3 = m3 ^ p3; \ + h4 = m4 ^ p4; \ + h5 = m5 ^ p5; \ + h6 = m6 ^ p6; \ + h7 = m7 ^ p7; \ + } while (0) + +#endif + +#if 0 +/* obsolete */ +#define DECL_STATE_SMALL \ + sph_u64 h0, h1, h2, h3; \ + sph_u64 bcount; + +#define READ_STATE_SMALL(sc) do { \ + h0 = (sc)->h0; \ + h1 = (sc)->h1; \ + h2 = (sc)->h2; \ + h3 = (sc)->h3; \ + bcount = sc->bcount; \ + } while (0) + +#define WRITE_STATE_SMALL(sc) do { \ + (sc)->h0 = h0; \ + (sc)->h1 = h1; \ + (sc)->h2 = h2; \ + (sc)->h3 = h3; \ + sc->bcount = bcount; \ + } while (0) +#endif + +#if SPH_SMALL_FOOTPRINT_SKEIN + +#define DECL_STATE_BIG \ + sph_u64 h[27]; \ + sph_u64 bcount; + +#define READ_STATE_BIG(sc) do { \ + h[0] = (sc)->h0; \ + h[1] = (sc)->h1; \ + h[2] = (sc)->h2; \ + h[3] = (sc)->h3; \ + h[4] = (sc)->h4; \ + h[5] = (sc)->h5; \ + h[6] = (sc)->h6; \ + h[7] = (sc)->h7; \ + bcount = sc->bcount; \ + } while (0) + +#define WRITE_STATE_BIG(sc) do { \ + (sc)->h0 = h[0]; \ + (sc)->h1 = h[1]; \ + (sc)->h2 = h[2]; \ + (sc)->h3 = h[3]; \ + (sc)->h4 = h[4]; \ + (sc)->h5 = h[5]; \ + (sc)->h6 = h[6]; \ + (sc)->h7 = h[7]; \ + sc->bcount = bcount; \ + } while (0) + +#else + +#define DECL_STATE_BIG \ + sph_u64 h0, h1, h2, h3, h4, h5, h6, h7; \ + sph_u64 bcount; + +#define READ_STATE_BIG(sc) do { \ + h0 = (sc)->h0; \ + h1 = (sc)->h1; \ + h2 = (sc)->h2; \ + h3 = (sc)->h3; \ + h4 = (sc)->h4; \ + h5 = (sc)->h5; \ + h6 = (sc)->h6; \ + h7 = (sc)->h7; \ + bcount = sc->bcount; \ + } while (0) + +#define WRITE_STATE_BIG(sc) do { \ + (sc)->h0 = h0; \ + (sc)->h1 = h1; \ + (sc)->h2 = h2; \ + (sc)->h3 = h3; \ + (sc)->h4 = h4; \ + (sc)->h5 = h5; \ + (sc)->h6 = h6; \ + (sc)->h7 = h7; \ + sc->bcount = bcount; \ + } while (0) + +#endif + +#if 0 +/* obsolete */ +static void +skein_small_init(sph_skein_small_context *sc, const sph_u64 *iv) +{ + sc->h0 = iv[0]; + sc->h1 = iv[1]; + sc->h2 = iv[2]; + sc->h3 = iv[3]; + sc->bcount = 0; + sc->ptr = 0; +} +#endif + +static void +skein_big_init(sph_skein_big_context *sc, const sph_u64 *iv) +{ + sc->h0 = iv[0]; + sc->h1 = iv[1]; + sc->h2 = iv[2]; + sc->h3 = iv[3]; + sc->h4 = iv[4]; + sc->h5 = iv[5]; + sc->h6 = iv[6]; + sc->h7 = iv[7]; + sc->bcount = 0; + sc->ptr = 0; +} + +#if 0 +/* obsolete */ +static void +skein_small_core(sph_skein_small_context *sc, const void *data, size_t len) +{ + unsigned char *buf; + size_t ptr, clen; + unsigned first; + DECL_STATE_SMALL + + buf = sc->buf; + ptr = sc->ptr; + clen = (sizeof sc->buf) - ptr; + if (len <= clen) { + memcpy(buf + ptr, data, len); + sc->ptr = ptr + len; + return; + } + if (clen != 0) { + memcpy(buf + ptr, data, clen); + data = (const unsigned char *)data + clen; + len -= clen; + } + +#if SPH_SMALL_FOOTPRINT_SKEIN + + READ_STATE_SMALL(sc); + first = (bcount == 0) << 7; + for (;;) { + bcount ++; + UBI_SMALL(96 + first, 0); + if (len <= sizeof sc->buf) + break; + first = 0; + memcpy(buf, data, sizeof sc->buf); + data = (const unsigned char *)data + sizeof sc->buf; + len -= sizeof sc->buf; + } + WRITE_STATE_SMALL(sc); + sc->ptr = len; + memcpy(buf, data, len); + +#else + + /* + * Unrolling the loop yields a slight performance boost, while + * keeping the code size aorund 24 kB on 32-bit x86. + */ + READ_STATE_SMALL(sc); + first = (bcount == 0) << 7; + for (;;) { + bcount ++; + UBI_SMALL(96 + first, 0); + if (len <= sizeof sc->buf) + break; + buf = (unsigned char *)data; + bcount ++; + UBI_SMALL(96, 0); + if (len <= 2 * sizeof sc->buf) { + data = buf + sizeof sc->buf; + len -= sizeof sc->buf; + break; + } + buf += sizeof sc->buf; + data = buf + sizeof sc->buf; + first = 0; + len -= 2 * sizeof sc->buf; + } + WRITE_STATE_SMALL(sc); + sc->ptr = len; + memcpy(sc->buf, data, len); + +#endif +} +#endif + +static void +skein_big_core(sph_skein_big_context *sc, const void *data, size_t len) +{ + /* + * The Skein "final bit" in the tweak is troublesome here, + * because if the input has a length which is a multiple of the + * block size (512 bits) then that bit must be set for the + * final block, which is full of message bits (padding in + * Skein can be reduced to no extra bit at all). However, this + * function cannot know whether it processes the last chunks of + * the message or not. Hence we may keep a full block of buffered + * data (64 bytes). + */ + unsigned char *buf; + size_t ptr; + unsigned first; + DECL_STATE_BIG + + buf = sc->buf; + ptr = sc->ptr; + if (len <= (sizeof sc->buf) - ptr) { + memcpy(buf + ptr, data, len); + ptr += len; + sc->ptr = ptr; + return; + } + + READ_STATE_BIG(sc); + first = (bcount == 0) << 7; + do { + size_t clen; + + if (ptr == sizeof sc->buf) { + bcount ++; + UBI_BIG(96 + first, 0); + first = 0; + ptr = 0; + } + clen = (sizeof sc->buf) - ptr; + if (clen > len) + clen = len; + memcpy(buf + ptr, data, clen); + ptr += clen; + data = (const unsigned char *)data + clen; + len -= clen; + } while (len > 0); + WRITE_STATE_BIG(sc); + sc->ptr = ptr; +} + +#if 0 +/* obsolete */ +static void +skein_small_close(sph_skein_small_context *sc, unsigned ub, unsigned n, + void *dst, size_t out_len) +{ + unsigned char *buf; + size_t ptr; + unsigned et; + int i; + DECL_STATE_SMALL + + if (n != 0) { + unsigned z; + unsigned char x; + + z = 0x80 >> n; + x = ((ub & -z) | z) & 0xFF; + skein_small_core(sc, &x, 1); + } + + buf = sc->buf; + ptr = sc->ptr; + READ_STATE_SMALL(sc); + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + et = 352 + ((bcount == 0) << 7) + (n != 0); + for (i = 0; i < 2; i ++) { + UBI_SMALL(et, ptr); + if (i == 0) { + memset(buf, 0, sizeof sc->buf); + bcount = 0; + et = 510; + ptr = 8; + } + } + + sph_enc64le_aligned(buf + 0, h0); + sph_enc64le_aligned(buf + 8, h1); + sph_enc64le_aligned(buf + 16, h2); + sph_enc64le_aligned(buf + 24, h3); + memcpy(dst, buf, out_len); +} +#endif + +static void +skein_big_close(sph_skein_big_context *sc, unsigned ub, unsigned n, + void *dst, size_t out_len) +{ + unsigned char *buf; + size_t ptr; + unsigned et; + int i; +#if SPH_SMALL_FOOTPRINT_SKEIN + size_t u; +#endif + DECL_STATE_BIG + + /* + * Add bit padding if necessary. + */ + if (n != 0) { + unsigned z; + unsigned char x; + + z = 0x80 >> n; + x = ((ub & -z) | z) & 0xFF; + skein_big_core(sc, &x, 1); + } + + buf = sc->buf; + ptr = sc->ptr; + + /* + * At that point, if ptr == 0, then the message was empty; + * otherwise, there is between 1 and 64 bytes (inclusive) which + * are yet to be processed. Either way, we complete the buffer + * to a full block with zeros (the Skein specification mandates + * that an empty message is padded so that there is at least + * one block to process). + * + * Once this block has been processed, we do it again, with + * a block full of zeros, for the output (that block contains + * the encoding of "0", over 8 bytes, then padded with zeros). + */ + READ_STATE_BIG(sc); + memset(buf + ptr, 0, (sizeof sc->buf) - ptr); + et = 352 + ((bcount == 0) << 7) + (n != 0); + for (i = 0; i < 2; i ++) { + UBI_BIG(et, ptr); + if (i == 0) { + memset(buf, 0, sizeof sc->buf); + bcount = 0; + et = 510; + ptr = 8; + } + } + +#if SPH_SMALL_FOOTPRINT_SKEIN + + /* + * We use a temporary buffer because we must support the case + * where output size is not a multiple of 64 (namely, a 224-bit + * output). + */ + for (u = 0; u < out_len; u += 8) + sph_enc64le_aligned(buf + u, h[u >> 3]); + memcpy(dst, buf, out_len); + +#else + + sph_enc64le_aligned(buf + 0, h0); + sph_enc64le_aligned(buf + 8, h1); + sph_enc64le_aligned(buf + 16, h2); + sph_enc64le_aligned(buf + 24, h3); + sph_enc64le_aligned(buf + 32, h4); + sph_enc64le_aligned(buf + 40, h5); + sph_enc64le_aligned(buf + 48, h6); + sph_enc64le_aligned(buf + 56, h7); + memcpy(dst, buf, out_len); + +#endif +} + +#if 0 +/* obsolete */ +static const sph_u64 IV224[] = { + SPH_C64(0xC6098A8C9AE5EA0B), SPH_C64(0x876D568608C5191C), + SPH_C64(0x99CB88D7D7F53884), SPH_C64(0x384BDDB1AEDDB5DE) +}; + +static const sph_u64 IV256[] = { + SPH_C64(0xFC9DA860D048B449), SPH_C64(0x2FCA66479FA7D833), + SPH_C64(0xB33BC3896656840F), SPH_C64(0x6A54E920FDE8DA69) +}; +#endif + +static const sph_u64 IV224[] = { + SPH_C64(0xCCD0616248677224), SPH_C64(0xCBA65CF3A92339EF), + SPH_C64(0x8CCD69D652FF4B64), SPH_C64(0x398AED7B3AB890B4), + SPH_C64(0x0F59D1B1457D2BD0), SPH_C64(0x6776FE6575D4EB3D), + SPH_C64(0x99FBC70E997413E9), SPH_C64(0x9E2CFCCFE1C41EF7) +}; + +static const sph_u64 IV256[] = { + SPH_C64(0xCCD044A12FDB3E13), SPH_C64(0xE83590301A79A9EB), + SPH_C64(0x55AEA0614F816E6F), SPH_C64(0x2A2767A4AE9B94DB), + SPH_C64(0xEC06025E74DD7683), SPH_C64(0xE7A436CDC4746251), + SPH_C64(0xC36FBAF9393AD185), SPH_C64(0x3EEDBA1833EDFC13) +}; + +static const sph_u64 IV384[] = { + SPH_C64(0xA3F6C6BF3A75EF5F), SPH_C64(0xB0FEF9CCFD84FAA4), + SPH_C64(0x9D77DD663D770CFE), SPH_C64(0xD798CBF3B468FDDA), + SPH_C64(0x1BC4A6668A0E4465), SPH_C64(0x7ED7D434E5807407), + SPH_C64(0x548FC1ACD4EC44D6), SPH_C64(0x266E17546AA18FF8) +}; + +static const sph_u64 IV512[] = { + SPH_C64(0x4903ADFF749C51CE), SPH_C64(0x0D95DE399746DF03), + SPH_C64(0x8FD1934127C79BCE), SPH_C64(0x9A255629FF352CB1), + SPH_C64(0x5DB62599DF6CA7B0), SPH_C64(0xEABE394CA9D5C3F4), + SPH_C64(0x991112C71A75B523), SPH_C64(0xAE18A40B660FCC33) +}; + +#if 0 +/* obsolete */ +/* see sph_skein.h */ +void +sph_skein224_init(void *cc) +{ + skein_small_init(cc, IV224); +} + +/* see sph_skein.h */ +void +sph_skein224(void *cc, const void *data, size_t len) +{ + skein_small_core(cc, data, len); +} + +/* see sph_skein.h */ +void +sph_skein224_close(void *cc, void *dst) +{ + sph_skein224_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_skein.h */ +void +sph_skein224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + skein_small_close(cc, ub, n, dst, 28); + sph_skein224_init(cc); +} + +/* see sph_skein.h */ +void +sph_skein256_init(void *cc) +{ + skein_small_init(cc, IV256); +} + +/* see sph_skein.h */ +void +sph_skein256(void *cc, const void *data, size_t len) +{ + skein_small_core(cc, data, len); +} + +/* see sph_skein.h */ +void +sph_skein256_close(void *cc, void *dst) +{ + sph_skein256_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_skein.h */ +void +sph_skein256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + skein_small_close(cc, ub, n, dst, 32); + sph_skein256_init(cc); +} +#endif + +/* see sph_skein.h */ +void +sph_skein224_init(void *cc) +{ + skein_big_init(cc, IV224); +} + +/* see sph_skein.h */ +void +sph_skein224(void *cc, const void *data, size_t len) +{ + skein_big_core(cc, data, len); +} + +/* see sph_skein.h */ +void +sph_skein224_close(void *cc, void *dst) +{ + sph_skein224_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_skein.h */ +void +sph_skein224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + skein_big_close(cc, ub, n, dst, 28); + sph_skein224_init(cc); +} + +/* see sph_skein.h */ +void +sph_skein256_init(void *cc) +{ + skein_big_init(cc, IV256); +} + +/* see sph_skein.h */ +void +sph_skein256(void *cc, const void *data, size_t len) +{ + skein_big_core(cc, data, len); +} + +/* see sph_skein.h */ +void +sph_skein256_close(void *cc, void *dst) +{ + sph_skein256_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_skein.h */ +void +sph_skein256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + skein_big_close(cc, ub, n, dst, 32); + sph_skein256_init(cc); +} + +/* see sph_skein.h */ +void +sph_skein384_init(void *cc) +{ + skein_big_init(cc, IV384); +} + +/* see sph_skein.h */ +void +sph_skein384(void *cc, const void *data, size_t len) +{ + skein_big_core(cc, data, len); +} + +/* see sph_skein.h */ +void +sph_skein384_close(void *cc, void *dst) +{ + sph_skein384_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_skein.h */ +void +sph_skein384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + skein_big_close(cc, ub, n, dst, 48); + sph_skein384_init(cc); +} + +/* see sph_skein.h */ +void +sph_skein512_init(void *cc) +{ + skein_big_init(cc, IV512); +} + +/* see sph_skein.h */ +void +sph_skein512(void *cc, const void *data, size_t len) +{ + skein_big_core(cc, data, len); +} + +/* see sph_skein.h */ +void +sph_skein512_close(void *cc, void *dst) +{ + sph_skein512_addbits_and_close(cc, 0, 0, dst); +} + +/* see sph_skein.h */ +void +sph_skein512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + skein_big_close(cc, ub, n, dst, 64); + sph_skein512_init(cc); +} + +#endif + + +#ifdef __cplusplus +} +#endif diff --git a/sph/sph_blake.h b/sph/sph_blake.h new file mode 100644 index 0000000..2c2b3da --- /dev/null +++ b/sph/sph_blake.h @@ -0,0 +1,337 @@ +/* $Id: sph_blake.h 252 2011-06-07 17:55:14Z tp $ */ +/** + * BLAKE interface. BLAKE is a family of functions which differ by their + * output size; this implementation defines BLAKE for output sizes 224, + * 256, 384 and 512 bits. This implementation conforms to the "third + * round" specification. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_blake.h + * @author Thomas Pornin + */ + +#ifndef SPH_BLAKE_H__ +#define SPH_BLAKE_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for BLAKE-224. + */ +#define SPH_SIZE_blake224 224 + +/** + * Output size (in bits) for BLAKE-256. + */ +#define SPH_SIZE_blake256 256 + +#if SPH_64 + +/** + * Output size (in bits) for BLAKE-384. + */ +#define SPH_SIZE_blake384 384 + +/** + * Output size (in bits) for BLAKE-512. + */ +#define SPH_SIZE_blake512 512 + +#endif + +/** + * This structure is a context for BLAKE-224 and BLAKE-256 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a BLAKE computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running BLAKE + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + sph_u32 H[8]; + sph_u32 S[4]; + sph_u32 T0, T1; +#endif +} sph_blake_small_context; + +/** + * This structure is a context for BLAKE-224 computations. It is + * identical to the common sph_blake_small_context. + */ +typedef sph_blake_small_context sph_blake224_context; + +/** + * This structure is a context for BLAKE-256 computations. It is + * identical to the common sph_blake_small_context. + */ +typedef sph_blake_small_context sph_blake256_context; + +#if SPH_64 + +/** + * This structure is a context for BLAKE-384 and BLAKE-512 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a BLAKE computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running BLAKE + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[128]; /* first field, for alignment */ + size_t ptr; + sph_u64 H[8]; + sph_u64 S[4]; + sph_u64 T0, T1; +#endif +} sph_blake_big_context; + +/** + * This structure is a context for BLAKE-384 computations. It is + * identical to the common sph_blake_small_context. + */ +typedef sph_blake_big_context sph_blake384_context; + +/** + * This structure is a context for BLAKE-512 computations. It is + * identical to the common sph_blake_small_context. + */ +typedef sph_blake_big_context sph_blake512_context; + +#endif + +/** + * Initialize a BLAKE-224 context. This process performs no memory allocation. + * + * @param cc the BLAKE-224 context (pointer to a + * sph_blake224_context) + */ +void sph_blake224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the BLAKE-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_blake224(void *cc, const void *data, size_t len); + +/** + * Terminate the current BLAKE-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the BLAKE-224 context + * @param dst the destination buffer + */ +void sph_blake224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the BLAKE-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_blake224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Switch for the number of rounds (old blake was 8) + */ +extern int blake256_rounds; + +/** + * Initialize a BLAKE-256 context. This process performs no memory allocation. + * + * @param cc the BLAKE-256 context (pointer to a + * sph_blake256_context) + */ +void sph_blake256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the BLAKE-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_blake256(void *cc, const void *data, size_t len); + +/** + * Terminate the current BLAKE-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the BLAKE-256 context + * @param dst the destination buffer + */ +void sph_blake256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the BLAKE-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_blake256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Allow blakecoin and blake variants + */ +void sph_blake256_set_rounds(int rounds); + +#if SPH_64 + +/** + * Initialize a BLAKE-384 context. This process performs no memory allocation. + * + * @param cc the BLAKE-384 context (pointer to a + * sph_blake384_context) + */ +void sph_blake384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the BLAKE-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_blake384(void *cc, const void *data, size_t len); + +/** + * Terminate the current BLAKE-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the BLAKE-384 context + * @param dst the destination buffer + */ +void sph_blake384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the BLAKE-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_blake384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a BLAKE-512 context. This process performs no memory allocation. + * + * @param cc the BLAKE-512 context (pointer to a + * sph_blake512_context) + */ +void sph_blake512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the BLAKE-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_blake512(void *cc, const void *data, size_t len); + +/** + * Terminate the current BLAKE-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the BLAKE-512 context + * @param dst the destination buffer + */ +void sph_blake512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the BLAKE-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_blake512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_bmw.h b/sph/sph_bmw.h new file mode 100644 index 0000000..484a2a7 --- /dev/null +++ b/sph/sph_bmw.h @@ -0,0 +1,320 @@ +/* $Id: sph_bmw.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * BMW interface. BMW (aka "Blue Midnight Wish") is a family of + * functions which differ by their output size; this implementation + * defines BMW for output sizes 224, 256, 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_bmw.h + * @author Thomas Pornin + */ + +#ifndef SPH_BMW_H__ +#define SPH_BMW_H__ + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for BMW-224. + */ +#define SPH_SIZE_bmw224 224 + +/** + * Output size (in bits) for BMW-256. + */ +#define SPH_SIZE_bmw256 256 + +#if SPH_64 + +/** + * Output size (in bits) for BMW-384. + */ +#define SPH_SIZE_bmw384 384 + +/** + * Output size (in bits) for BMW-512. + */ +#define SPH_SIZE_bmw512 512 + +#endif + +/** + * This structure is a context for BMW-224 and BMW-256 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a BMW computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running BMW + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + sph_u32 H[16]; +#if SPH_64 + sph_u64 bit_count; +#else + sph_u32 bit_count_high, bit_count_low; +#endif +#endif +} sph_bmw_small_context; + +/** + * This structure is a context for BMW-224 computations. It is + * identical to the common sph_bmw_small_context. + */ +typedef sph_bmw_small_context sph_bmw224_context; + +/** + * This structure is a context for BMW-256 computations. It is + * identical to the common sph_bmw_small_context. + */ +typedef sph_bmw_small_context sph_bmw256_context; + +#if SPH_64 + +/** + * This structure is a context for BMW-384 and BMW-512 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a BMW computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running BMW + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[128]; /* first field, for alignment */ + size_t ptr; + sph_u64 H[16]; + sph_u64 bit_count; +#endif +} sph_bmw_big_context; + +/** + * This structure is a context for BMW-384 computations. It is + * identical to the common sph_bmw_small_context. + */ +typedef sph_bmw_big_context sph_bmw384_context; + +/** + * This structure is a context for BMW-512 computations. It is + * identical to the common sph_bmw_small_context. + */ +typedef sph_bmw_big_context sph_bmw512_context; + +#endif + +/** + * Initialize a BMW-224 context. This process performs no memory allocation. + * + * @param cc the BMW-224 context (pointer to a + * sph_bmw224_context) + */ +void sph_bmw224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the BMW-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_bmw224(void *cc, const void *data, size_t len); + +/** + * Terminate the current BMW-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the BMW-224 context + * @param dst the destination buffer + */ +void sph_bmw224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the BMW-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_bmw224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a BMW-256 context. This process performs no memory allocation. + * + * @param cc the BMW-256 context (pointer to a + * sph_bmw256_context) + */ +void sph_bmw256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the BMW-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_bmw256(void *cc, const void *data, size_t len); + +/** + * Terminate the current BMW-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the BMW-256 context + * @param dst the destination buffer + */ +void sph_bmw256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the BMW-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_bmw256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#if SPH_64 + +/** + * Initialize a BMW-384 context. This process performs no memory allocation. + * + * @param cc the BMW-384 context (pointer to a + * sph_bmw384_context) + */ +void sph_bmw384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the BMW-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_bmw384(void *cc, const void *data, size_t len); + +/** + * Terminate the current BMW-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the BMW-384 context + * @param dst the destination buffer + */ +void sph_bmw384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the BMW-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_bmw384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a BMW-512 context. This process performs no memory allocation. + * + * @param cc the BMW-512 context (pointer to a + * sph_bmw512_context) + */ +void sph_bmw512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the BMW-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_bmw512(void *cc, const void *data, size_t len); + +/** + * Terminate the current BMW-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the BMW-512 context + * @param dst the destination buffer + */ +void sph_bmw512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the BMW-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_bmw512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#endif + +#endif diff --git a/sph/sph_cubehash.h b/sph/sph_cubehash.h new file mode 100644 index 0000000..487a194 --- /dev/null +++ b/sph/sph_cubehash.h @@ -0,0 +1,292 @@ +/* $Id: sph_cubehash.h 180 2010-05-08 02:29:25Z tp $ */ +/** + * CubeHash interface. CubeHash is a family of functions which differ by + * their output size; this implementation defines CubeHash for output + * sizes 224, 256, 384 and 512 bits, with the "standard parameters" + * (CubeHash16/32 with the CubeHash specification notations). + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_cubehash.h + * @author Thomas Pornin + */ + +#ifndef SPH_CUBEHASH_H__ +#define SPH_CUBEHASH_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for CubeHash-224. + */ +#define SPH_SIZE_cubehash224 224 + +/** + * Output size (in bits) for CubeHash-256. + */ +#define SPH_SIZE_cubehash256 256 + +/** + * Output size (in bits) for CubeHash-384. + */ +#define SPH_SIZE_cubehash384 384 + +/** + * Output size (in bits) for CubeHash-512. + */ +#define SPH_SIZE_cubehash512 512 + +/** + * This structure is a context for CubeHash computations: it contains the + * intermediate values and some data from the last entered block. Once + * a CubeHash computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running CubeHash computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[32]; /* first field, for alignment */ + size_t ptr; + sph_u32 state[32]; +#endif +} sph_cubehash_context; + +/** + * Type for a CubeHash-224 context (identical to the common context). + */ +typedef sph_cubehash_context sph_cubehash224_context; + +/** + * Type for a CubeHash-256 context (identical to the common context). + */ +typedef sph_cubehash_context sph_cubehash256_context; + +/** + * Type for a CubeHash-384 context (identical to the common context). + */ +typedef sph_cubehash_context sph_cubehash384_context; + +/** + * Type for a CubeHash-512 context (identical to the common context). + */ +typedef sph_cubehash_context sph_cubehash512_context; + +/** + * Initialize a CubeHash-224 context. This process performs no memory + * allocation. + * + * @param cc the CubeHash-224 context (pointer to a + * sph_cubehash224_context) + */ +void sph_cubehash224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the CubeHash-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_cubehash224(void *cc, const void *data, size_t len); + +/** + * Terminate the current CubeHash-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the CubeHash-224 context + * @param dst the destination buffer + */ +void sph_cubehash224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the CubeHash-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_cubehash224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a CubeHash-256 context. This process performs no memory + * allocation. + * + * @param cc the CubeHash-256 context (pointer to a + * sph_cubehash256_context) + */ +void sph_cubehash256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the CubeHash-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_cubehash256(void *cc, const void *data, size_t len); + +/** + * Terminate the current CubeHash-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the CubeHash-256 context + * @param dst the destination buffer + */ +void sph_cubehash256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the CubeHash-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_cubehash256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a CubeHash-384 context. This process performs no memory + * allocation. + * + * @param cc the CubeHash-384 context (pointer to a + * sph_cubehash384_context) + */ +void sph_cubehash384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the CubeHash-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_cubehash384(void *cc, const void *data, size_t len); + +/** + * Terminate the current CubeHash-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the CubeHash-384 context + * @param dst the destination buffer + */ +void sph_cubehash384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the CubeHash-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_cubehash384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a CubeHash-512 context. This process performs no memory + * allocation. + * + * @param cc the CubeHash-512 context (pointer to a + * sph_cubehash512_context) + */ +void sph_cubehash512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the CubeHash-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_cubehash512(void *cc, const void *data, size_t len); + +/** + * Terminate the current CubeHash-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the CubeHash-512 context + * @param dst the destination buffer + */ +void sph_cubehash512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the CubeHash-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_cubehash512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_echo.h b/sph/sph_echo.h new file mode 100644 index 0000000..1ae1e3d --- /dev/null +++ b/sph/sph_echo.h @@ -0,0 +1,320 @@ +/* $Id: sph_echo.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * ECHO interface. ECHO is a family of functions which differ by + * their output size; this implementation defines ECHO for output + * sizes 224, 256, 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_echo.h + * @author Thomas Pornin + */ + +#ifndef SPH_ECHO_H__ +#define SPH_ECHO_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for ECHO-224. + */ +#define SPH_SIZE_echo224 224 + +/** + * Output size (in bits) for ECHO-256. + */ +#define SPH_SIZE_echo256 256 + +/** + * Output size (in bits) for ECHO-384. + */ +#define SPH_SIZE_echo384 384 + +/** + * Output size (in bits) for ECHO-512. + */ +#define SPH_SIZE_echo512 512 + +/** + * This structure is a context for ECHO computations: it contains the + * intermediate values and some data from the last entered block. Once + * an ECHO computation has been performed, the context can be reused for + * another computation. This specific structure is used for ECHO-224 + * and ECHO-256. + * + * The contents of this structure are private. A running ECHO computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[192]; /* first field, for alignment */ + size_t ptr; + union { + sph_u32 Vs[4][4]; +#if SPH_64 + sph_u64 Vb[4][2]; +#endif + } u; + sph_u32 C0, C1, C2, C3; +#endif +} sph_echo_small_context; + +/** + * This structure is a context for ECHO computations: it contains the + * intermediate values and some data from the last entered block. Once + * an ECHO computation has been performed, the context can be reused for + * another computation. This specific structure is used for ECHO-384 + * and ECHO-512. + * + * The contents of this structure are private. A running ECHO computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[128]; /* first field, for alignment */ + size_t ptr; + union { + sph_u32 Vs[8][4]; +#if SPH_64 + sph_u64 Vb[8][2]; +#endif + } u; + sph_u32 C0, C1, C2, C3; +#endif +} sph_echo_big_context; + +/** + * Type for a ECHO-224 context (identical to the common "small" context). + */ +typedef sph_echo_small_context sph_echo224_context; + +/** + * Type for a ECHO-256 context (identical to the common "small" context). + */ +typedef sph_echo_small_context sph_echo256_context; + +/** + * Type for a ECHO-384 context (identical to the common "big" context). + */ +typedef sph_echo_big_context sph_echo384_context; + +/** + * Type for a ECHO-512 context (identical to the common "big" context). + */ +typedef sph_echo_big_context sph_echo512_context; + +/** + * Initialize an ECHO-224 context. This process performs no memory allocation. + * + * @param cc the ECHO-224 context (pointer to a + * sph_echo224_context) + */ +void sph_echo224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the ECHO-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_echo224(void *cc, const void *data, size_t len); + +/** + * Terminate the current ECHO-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the ECHO-224 context + * @param dst the destination buffer + */ +void sph_echo224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the ECHO-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_echo224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize an ECHO-256 context. This process performs no memory allocation. + * + * @param cc the ECHO-256 context (pointer to a + * sph_echo256_context) + */ +void sph_echo256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the ECHO-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_echo256(void *cc, const void *data, size_t len); + +/** + * Terminate the current ECHO-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the ECHO-256 context + * @param dst the destination buffer + */ +void sph_echo256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the ECHO-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_echo256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize an ECHO-384 context. This process performs no memory allocation. + * + * @param cc the ECHO-384 context (pointer to a + * sph_echo384_context) + */ +void sph_echo384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the ECHO-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_echo384(void *cc, const void *data, size_t len); + +/** + * Terminate the current ECHO-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the ECHO-384 context + * @param dst the destination buffer + */ +void sph_echo384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the ECHO-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_echo384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize an ECHO-512 context. This process performs no memory allocation. + * + * @param cc the ECHO-512 context (pointer to a + * sph_echo512_context) + */ +void sph_echo512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the ECHO-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_echo512(void *cc, const void *data, size_t len); + +/** + * Terminate the current ECHO-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the ECHO-512 context + * @param dst the destination buffer + */ +void sph_echo512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the ECHO-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_echo512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_fugue.h b/sph/sph_fugue.h new file mode 100644 index 0000000..c8ff395 --- /dev/null +++ b/sph/sph_fugue.h @@ -0,0 +1,81 @@ +#ifndef SPH_FUGUE_H__ +#define SPH_FUGUE_H__ + +#include +#include "sph_types.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#define SPH_SIZE_fugue224 224 + +#define SPH_SIZE_fugue256 256 + +#define SPH_SIZE_fugue384 384 + +#define SPH_SIZE_fugue512 512 + +typedef struct { +#ifndef DOXYGEN_IGNORE + sph_u32 partial; + unsigned partial_len; + unsigned round_shift; + sph_u32 S[36]; +#if SPH_64 + sph_u64 bit_count; +#else + sph_u32 bit_count_high, bit_count_low; +#endif +#endif +} sph_fugue_context; + +typedef sph_fugue_context sph_fugue224_context; + +typedef sph_fugue_context sph_fugue256_context; + +typedef sph_fugue_context sph_fugue384_context; + +typedef sph_fugue_context sph_fugue512_context; + +void sph_fugue224_init(void *cc); + +void sph_fugue224(void *cc, const void *data, size_t len); + +void sph_fugue224_close(void *cc, void *dst); + +void sph_fugue224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +void sph_fugue256_init(void *cc); + +void sph_fugue256(void *cc, const void *data, size_t len); + +void sph_fugue256_close(void *cc, void *dst); + +void sph_fugue256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +void sph_fugue384_init(void *cc); + +void sph_fugue384(void *cc, const void *data, size_t len); + +void sph_fugue384_close(void *cc, void *dst); + +void sph_fugue384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +void sph_fugue512_init(void *cc); + +void sph_fugue512(void *cc, const void *data, size_t len); + +void sph_fugue512_close(void *cc, void *dst); + +void sph_fugue512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_groestl.h b/sph/sph_groestl.h new file mode 100644 index 0000000..495f05e --- /dev/null +++ b/sph/sph_groestl.h @@ -0,0 +1,329 @@ +/* $Id: sph_groestl.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * Groestl interface. This code implements Groestl with the recommended + * parameters for SHA-3, with outputs of 224, 256, 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_groestl.h + * @author Thomas Pornin + */ + +#ifndef SPH_GROESTL_H__ +#define SPH_GROESTL_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for Groestl-224. + */ +#define SPH_SIZE_groestl224 224 + +/** + * Output size (in bits) for Groestl-256. + */ +#define SPH_SIZE_groestl256 256 + +/** + * Output size (in bits) for Groestl-384. + */ +#define SPH_SIZE_groestl384 384 + +/** + * Output size (in bits) for Groestl-512. + */ +#define SPH_SIZE_groestl512 512 + +/** + * This structure is a context for Groestl-224 and Groestl-256 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a Groestl computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running Groestl + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + union { +#if SPH_64 + sph_u64 wide[8]; +#endif + sph_u32 narrow[16]; + } state; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_groestl_small_context; + +/** + * This structure is a context for Groestl-224 computations. It is + * identical to the common sph_groestl_small_context. + */ +typedef sph_groestl_small_context sph_groestl224_context; + +/** + * This structure is a context for Groestl-256 computations. It is + * identical to the common sph_groestl_small_context. + */ +typedef sph_groestl_small_context sph_groestl256_context; + +/** + * This structure is a context for Groestl-384 and Groestl-512 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a Groestl computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running Groestl + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[128]; /* first field, for alignment */ + size_t ptr; + union { +#if SPH_64 + sph_u64 wide[16]; +#endif + sph_u32 narrow[32]; + } state; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_groestl_big_context; + +/** + * This structure is a context for Groestl-384 computations. It is + * identical to the common sph_groestl_small_context. + */ +typedef sph_groestl_big_context sph_groestl384_context; + +/** + * This structure is a context for Groestl-512 computations. It is + * identical to the common sph_groestl_small_context. + */ +typedef sph_groestl_big_context sph_groestl512_context; + +/** + * Initialize a Groestl-224 context. This process performs no memory allocation. + * + * @param cc the Groestl-224 context (pointer to a + * sph_groestl224_context) + */ +void sph_groestl224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Groestl-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_groestl224(void *cc, const void *data, size_t len); + +/** + * Terminate the current Groestl-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the Groestl-224 context + * @param dst the destination buffer + */ +void sph_groestl224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Groestl-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_groestl224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Groestl-256 context. This process performs no memory allocation. + * + * @param cc the Groestl-256 context (pointer to a + * sph_groestl256_context) + */ +void sph_groestl256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Groestl-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_groestl256(void *cc, const void *data, size_t len); + +/** + * Terminate the current Groestl-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the Groestl-256 context + * @param dst the destination buffer + */ +void sph_groestl256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Groestl-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_groestl256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Groestl-384 context. This process performs no memory allocation. + * + * @param cc the Groestl-384 context (pointer to a + * sph_groestl384_context) + */ +void sph_groestl384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Groestl-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_groestl384(void *cc, const void *data, size_t len); + +/** + * Terminate the current Groestl-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the Groestl-384 context + * @param dst the destination buffer + */ +void sph_groestl384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Groestl-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_groestl384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Groestl-512 context. This process performs no memory allocation. + * + * @param cc the Groestl-512 context (pointer to a + * sph_groestl512_context) + */ +void sph_groestl512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Groestl-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_groestl512(void *cc, const void *data, size_t len); + +/** + * Terminate the current Groestl-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the Groestl-512 context + * @param dst the destination buffer + */ +void sph_groestl512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Groestl-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_groestl512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_hamsi.h b/sph/sph_hamsi.h new file mode 100644 index 0000000..b2cba30 --- /dev/null +++ b/sph/sph_hamsi.h @@ -0,0 +1,321 @@ +/* $Id: sph_hamsi.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * Hamsi interface. This code implements Hamsi with the recommended + * parameters for SHA-3, with outputs of 224, 256, 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_hamsi.h + * @author Thomas Pornin + */ + +#ifndef SPH_HAMSI_H__ +#define SPH_HAMSI_H__ + +#include +#include "sph_types.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +/** + * Output size (in bits) for Hamsi-224. + */ +#define SPH_SIZE_hamsi224 224 + +/** + * Output size (in bits) for Hamsi-256. + */ +#define SPH_SIZE_hamsi256 256 + +/** + * Output size (in bits) for Hamsi-384. + */ +#define SPH_SIZE_hamsi384 384 + +/** + * Output size (in bits) for Hamsi-512. + */ +#define SPH_SIZE_hamsi512 512 + +/** + * This structure is a context for Hamsi-224 and Hamsi-256 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a Hamsi computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running Hamsi + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char partial[4]; + size_t partial_len; + sph_u32 h[8]; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_hamsi_small_context; + +/** + * This structure is a context for Hamsi-224 computations. It is + * identical to the common sph_hamsi_small_context. + */ +typedef sph_hamsi_small_context sph_hamsi224_context; + +/** + * This structure is a context for Hamsi-256 computations. It is + * identical to the common sph_hamsi_small_context. + */ +typedef sph_hamsi_small_context sph_hamsi256_context; + +/** + * This structure is a context for Hamsi-384 and Hamsi-512 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a Hamsi computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running Hamsi + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char partial[8]; + size_t partial_len; + sph_u32 h[16]; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_hamsi_big_context; + +/** + * This structure is a context for Hamsi-384 computations. It is + * identical to the common sph_hamsi_small_context. + */ +typedef sph_hamsi_big_context sph_hamsi384_context; + +/** + * This structure is a context for Hamsi-512 computations. It is + * identical to the common sph_hamsi_small_context. + */ +typedef sph_hamsi_big_context sph_hamsi512_context; + +/** + * Initialize a Hamsi-224 context. This process performs no memory allocation. + * + * @param cc the Hamsi-224 context (pointer to a + * sph_hamsi224_context) + */ +void sph_hamsi224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Hamsi-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_hamsi224(void *cc, const void *data, size_t len); + +/** + * Terminate the current Hamsi-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the Hamsi-224 context + * @param dst the destination buffer + */ +void sph_hamsi224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Hamsi-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_hamsi224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Hamsi-256 context. This process performs no memory allocation. + * + * @param cc the Hamsi-256 context (pointer to a + * sph_hamsi256_context) + */ +void sph_hamsi256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Hamsi-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_hamsi256(void *cc, const void *data, size_t len); + +/** + * Terminate the current Hamsi-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the Hamsi-256 context + * @param dst the destination buffer + */ +void sph_hamsi256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Hamsi-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_hamsi256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Hamsi-384 context. This process performs no memory allocation. + * + * @param cc the Hamsi-384 context (pointer to a + * sph_hamsi384_context) + */ +void sph_hamsi384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Hamsi-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_hamsi384(void *cc, const void *data, size_t len); + +/** + * Terminate the current Hamsi-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the Hamsi-384 context + * @param dst the destination buffer + */ +void sph_hamsi384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Hamsi-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_hamsi384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Hamsi-512 context. This process performs no memory allocation. + * + * @param cc the Hamsi-512 context (pointer to a + * sph_hamsi512_context) + */ +void sph_hamsi512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Hamsi-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_hamsi512(void *cc, const void *data, size_t len); + +/** + * Terminate the current Hamsi-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the Hamsi-512 context + * @param dst the destination buffer + */ +void sph_hamsi512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Hamsi-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_hamsi512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_haval.h b/sph/sph_haval.h new file mode 100644 index 0000000..409daaf --- /dev/null +++ b/sph/sph_haval.h @@ -0,0 +1,976 @@ +/* $Id: sph_haval.h 218 2010-06-08 17:06:34Z tp $ */ +/** + * HAVAL interface. + * + * HAVAL is actually a family of 15 hash functions, depending on whether + * the internal computation uses 3, 4 or 5 passes, and on the output + * length, which is 128, 160, 192, 224 or 256 bits. This implementation + * provides interface functions for all 15, which internally map to + * three cores (depending on the number of passes). Note that output + * lengths other than 256 bits are not obtained by a simple truncation + * of a longer result; the requested length is encoded within the + * padding data. + * + * HAVAL was published in: Yuliang Zheng, Josef Pieprzyk and Jennifer + * Seberry: "HAVAL -- a one-way hashing algorithm with variable length + * of output", Advances in Cryptology -- AUSCRYPT'92, Lecture Notes in + * Computer Science, Vol.718, pp.83-104, Springer-Verlag, 1993. + * + * This paper, and a reference implementation, are available on the + * Calyptix web site: http://labs.calyptix.com/haval.php + * + * The HAVAL reference paper is quite unclear on the data encoding + * details, i.e. endianness (both byte order within a 32-bit word, and + * word order within a message block). This implementation has been + * made compatible with the reference implementation referenced above. + * + * @warning A collision for HAVAL-128/3 (HAVAL with three passes and + * 128-bit output) has been published; this function is thus considered + * as cryptographically broken. The status for other variants is unclear; + * use only with care. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_haval.h + * @author Thomas Pornin + */ + +#ifndef SPH_HAVAL_H__ +#define SPH_HAVAL_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for HAVAL-128/3. + */ +#define SPH_SIZE_haval128_3 128 + +/** + * Output size (in bits) for HAVAL-128/4. + */ +#define SPH_SIZE_haval128_4 128 + +/** + * Output size (in bits) for HAVAL-128/5. + */ +#define SPH_SIZE_haval128_5 128 + +/** + * Output size (in bits) for HAVAL-160/3. + */ +#define SPH_SIZE_haval160_3 160 + +/** + * Output size (in bits) for HAVAL-160/4. + */ +#define SPH_SIZE_haval160_4 160 + +/** + * Output size (in bits) for HAVAL-160/5. + */ +#define SPH_SIZE_haval160_5 160 + +/** + * Output size (in bits) for HAVAL-192/3. + */ +#define SPH_SIZE_haval192_3 192 + +/** + * Output size (in bits) for HAVAL-192/4. + */ +#define SPH_SIZE_haval192_4 192 + +/** + * Output size (in bits) for HAVAL-192/5. + */ +#define SPH_SIZE_haval192_5 192 + +/** + * Output size (in bits) for HAVAL-224/3. + */ +#define SPH_SIZE_haval224_3 224 + +/** + * Output size (in bits) for HAVAL-224/4. + */ +#define SPH_SIZE_haval224_4 224 + +/** + * Output size (in bits) for HAVAL-224/5. + */ +#define SPH_SIZE_haval224_5 224 + +/** + * Output size (in bits) for HAVAL-256/3. + */ +#define SPH_SIZE_haval256_3 256 + +/** + * Output size (in bits) for HAVAL-256/4. + */ +#define SPH_SIZE_haval256_4 256 + +/** + * Output size (in bits) for HAVAL-256/5. + */ +#define SPH_SIZE_haval256_5 256 + +/** + * This structure is a context for HAVAL computations: it contains the + * intermediate values and some data from the last entered block. Once + * a HAVAL computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running HAVAL computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[128]; /* first field, for alignment */ + sph_u32 s0, s1, s2, s3, s4, s5, s6, s7; + unsigned olen, passes; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_haval_context; + +/** + * Type for a HAVAL-128/3 context (identical to the common context). + */ +typedef sph_haval_context sph_haval128_3_context; + +/** + * Type for a HAVAL-128/4 context (identical to the common context). + */ +typedef sph_haval_context sph_haval128_4_context; + +/** + * Type for a HAVAL-128/5 context (identical to the common context). + */ +typedef sph_haval_context sph_haval128_5_context; + +/** + * Type for a HAVAL-160/3 context (identical to the common context). + */ +typedef sph_haval_context sph_haval160_3_context; + +/** + * Type for a HAVAL-160/4 context (identical to the common context). + */ +typedef sph_haval_context sph_haval160_4_context; + +/** + * Type for a HAVAL-160/5 context (identical to the common context). + */ +typedef sph_haval_context sph_haval160_5_context; + +/** + * Type for a HAVAL-192/3 context (identical to the common context). + */ +typedef sph_haval_context sph_haval192_3_context; + +/** + * Type for a HAVAL-192/4 context (identical to the common context). + */ +typedef sph_haval_context sph_haval192_4_context; + +/** + * Type for a HAVAL-192/5 context (identical to the common context). + */ +typedef sph_haval_context sph_haval192_5_context; + +/** + * Type for a HAVAL-224/3 context (identical to the common context). + */ +typedef sph_haval_context sph_haval224_3_context; + +/** + * Type for a HAVAL-224/4 context (identical to the common context). + */ +typedef sph_haval_context sph_haval224_4_context; + +/** + * Type for a HAVAL-224/5 context (identical to the common context). + */ +typedef sph_haval_context sph_haval224_5_context; + +/** + * Type for a HAVAL-256/3 context (identical to the common context). + */ +typedef sph_haval_context sph_haval256_3_context; + +/** + * Type for a HAVAL-256/4 context (identical to the common context). + */ +typedef sph_haval_context sph_haval256_4_context; + +/** + * Type for a HAVAL-256/5 context (identical to the common context). + */ +typedef sph_haval_context sph_haval256_5_context; + +/** + * Initialize the context for HAVAL-128/3. + * + * @param cc context to initialize (pointer to a + * sph_haval128_3_context structure) + */ +void sph_haval128_3_init(void *cc); + +/** + * Process some data bytes for HAVAL-128/3. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-128/3 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval128_3(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-128/3 computation. The output buffer must be wide + * enough to accomodate the result (16 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-128/3 context + * @param dst the output buffer + */ +void sph_haval128_3_close(void *cc, void *dst); + +/** + * Close a HAVAL-128/3 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (16 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-128/3 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval128_3_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-128/4. + * + * @param cc context to initialize (pointer to a + * sph_haval128_4_context structure) + */ +void sph_haval128_4_init(void *cc); + +/** + * Process some data bytes for HAVAL-128/4. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-128/4 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval128_4(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-128/4 computation. The output buffer must be wide + * enough to accomodate the result (16 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-128/4 context + * @param dst the output buffer + */ +void sph_haval128_4_close(void *cc, void *dst); + +/** + * Close a HAVAL-128/4 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (16 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-128/4 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval128_4_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-128/5. + * + * @param cc context to initialize (pointer to a + * sph_haval128_5_context structure) + */ +void sph_haval128_5_init(void *cc); + +/** + * Process some data bytes for HAVAL-128/5. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-128/5 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval128_5(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-128/5 computation. The output buffer must be wide + * enough to accomodate the result (16 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-128/5 context + * @param dst the output buffer + */ +void sph_haval128_5_close(void *cc, void *dst); + +/** + * Close a HAVAL-128/5 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (16 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-128/5 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval128_5_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-160/3. + * + * @param cc context to initialize (pointer to a + * sph_haval160_3_context structure) + */ +void sph_haval160_3_init(void *cc); + +/** + * Process some data bytes for HAVAL-160/3. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-160/3 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval160_3(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-160/3 computation. The output buffer must be wide + * enough to accomodate the result (20 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-160/3 context + * @param dst the output buffer + */ +void sph_haval160_3_close(void *cc, void *dst); + +/** + * Close a HAVAL-160/3 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (20 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-160/3 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval160_3_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-160/4. + * + * @param cc context to initialize (pointer to a + * sph_haval160_4_context structure) + */ +void sph_haval160_4_init(void *cc); + +/** + * Process some data bytes for HAVAL-160/4. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-160/4 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval160_4(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-160/4 computation. The output buffer must be wide + * enough to accomodate the result (20 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-160/4 context + * @param dst the output buffer + */ +void sph_haval160_4_close(void *cc, void *dst); + +/** + * Close a HAVAL-160/4 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (20 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-160/4 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval160_3_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-160/5. + * + * @param cc context to initialize (pointer to a + * sph_haval160_5_context structure) + */ +void sph_haval160_5_init(void *cc); + +/** + * Process some data bytes for HAVAL-160/5. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-160/5 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval160_5(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-160/5 computation. The output buffer must be wide + * enough to accomodate the result (20 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-160/5 context + * @param dst the output buffer + */ +void sph_haval160_5_close(void *cc, void *dst); + +/** + * Close a HAVAL-160/5 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (20 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-160/5 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval160_5_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-192/3. + * + * @param cc context to initialize (pointer to a + * sph_haval192_3_context structure) + */ +void sph_haval192_3_init(void *cc); + +/** + * Process some data bytes for HAVAL-192/3. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-192/3 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval192_3(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-192/3 computation. The output buffer must be wide + * enough to accomodate the result (24 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-192/3 context + * @param dst the output buffer + */ +void sph_haval192_3_close(void *cc, void *dst); + +/** + * Close a HAVAL-192/3 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (24 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-192/3 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval192_3_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-192/4. + * + * @param cc context to initialize (pointer to a + * sph_haval192_4_context structure) + */ +void sph_haval192_4_init(void *cc); + +/** + * Process some data bytes for HAVAL-192/4. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-192/4 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval192_4(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-192/4 computation. The output buffer must be wide + * enough to accomodate the result (24 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-192/4 context + * @param dst the output buffer + */ +void sph_haval192_4_close(void *cc, void *dst); + +/** + * Close a HAVAL-192/4 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (24 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-192/4 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval192_4_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-192/5. + * + * @param cc context to initialize (pointer to a + * sph_haval192_5_context structure) + */ +void sph_haval192_5_init(void *cc); + +/** + * Process some data bytes for HAVAL-192/5. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-192/5 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval192_5(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-192/5 computation. The output buffer must be wide + * enough to accomodate the result (24 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-192/5 context + * @param dst the output buffer + */ +void sph_haval192_5_close(void *cc, void *dst); + +/** + * Close a HAVAL-192/5 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (24 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-192/5 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval192_5_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-224/3. + * + * @param cc context to initialize (pointer to a + * sph_haval224_3_context structure) + */ +void sph_haval224_3_init(void *cc); + +/** + * Process some data bytes for HAVAL-224/3. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-224/3 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval224_3(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-224/3 computation. The output buffer must be wide + * enough to accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-224/3 context + * @param dst the output buffer + */ +void sph_haval224_3_close(void *cc, void *dst); + +/** + * Close a HAVAL-224/3 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (28 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-224/3 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval224_3_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-224/4. + * + * @param cc context to initialize (pointer to a + * sph_haval224_4_context structure) + */ +void sph_haval224_4_init(void *cc); + +/** + * Process some data bytes for HAVAL-224/4. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-224/4 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval224_4(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-224/4 computation. The output buffer must be wide + * enough to accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-224/4 context + * @param dst the output buffer + */ +void sph_haval224_4_close(void *cc, void *dst); + +/** + * Close a HAVAL-224/4 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (28 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-224/4 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval224_4_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-224/5. + * + * @param cc context to initialize (pointer to a + * sph_haval224_5_context structure) + */ +void sph_haval224_5_init(void *cc); + +/** + * Process some data bytes for HAVAL-224/5. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-224/5 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval224_5(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-224/5 computation. The output buffer must be wide + * enough to accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-224/5 context + * @param dst the output buffer + */ +void sph_haval224_5_close(void *cc, void *dst); + +/** + * Close a HAVAL-224/5 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (28 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-224/5 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval224_5_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-256/3. + * + * @param cc context to initialize (pointer to a + * sph_haval256_3_context structure) + */ +void sph_haval256_3_init(void *cc); + +/** + * Process some data bytes for HAVAL-256/3. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-256/3 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval256_3(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-256/3 computation. The output buffer must be wide + * enough to accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-256/3 context + * @param dst the output buffer + */ +void sph_haval256_3_close(void *cc, void *dst); + +/** + * Close a HAVAL-256/3 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (32 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-256/3 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval256_3_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-256/4. + * + * @param cc context to initialize (pointer to a + * sph_haval256_4_context structure) + */ +void sph_haval256_4_init(void *cc); + +/** + * Process some data bytes for HAVAL-256/4. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-256/4 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval256_4(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-256/4 computation. The output buffer must be wide + * enough to accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-256/4 context + * @param dst the output buffer + */ +void sph_haval256_4_close(void *cc, void *dst); + +/** + * Close a HAVAL-256/4 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (32 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-256/4 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval256_4_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Initialize the context for HAVAL-256/5. + * + * @param cc context to initialize (pointer to a + * sph_haval256_5_context structure) + */ +void sph_haval256_5_init(void *cc); + +/** + * Process some data bytes for HAVAL-256/5. If len is 0, + * then this function does nothing. + * + * @param cc the HAVAL-256/5 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_haval256_5(void *cc, const void *data, size_t len); + +/** + * Close a HAVAL-256/5 computation. The output buffer must be wide + * enough to accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the HAVAL-256/5 context + * @param dst the output buffer + */ +void sph_haval256_5_close(void *cc, void *dst); + +/** + * Close a HAVAL-256/5 computation. Up to 7 extra input bits may be added + * to the input message; these are the n upper bits of + * the ub byte (i.e. the first extra bit has value 128 in + * ub, the second extra bit has value 64, and so on). Other + * bits in ub are ignored. + * + * The output buffer must be wide enough to accomodate the result (32 + * bytes). The context is automatically reinitialized. + * + * @param cc the HAVAL-256/5 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the output buffer + */ +void sph_haval256_5_addbits_and_close(void *cc, + unsigned ub, unsigned n, void *dst); + +/** + * Apply the HAVAL compression function on the provided data. The + * msg parameter contains the 32 32-bit input blocks, + * as numerical values (hence after the little-endian decoding). The + * val parameter contains the 8 32-bit input blocks for + * the compression function; the output is written in place in this + * array. This function uses three internal passes. + * + * @param msg the message block (32 values) + * @param val the function 256-bit input and output + */ +void sph_haval_3_comp(const sph_u32 msg[32], sph_u32 val[8]); + +/** + * Apply the HAVAL compression function on the provided data. The + * msg parameter contains the 32 32-bit input blocks, + * as numerical values (hence after the little-endian decoding). The + * val parameter contains the 8 32-bit input blocks for + * the compression function; the output is written in place in this + * array. This function uses four internal passes. + * + * @param msg the message block (32 values) + * @param val the function 256-bit input and output + */ +void sph_haval_4_comp(const sph_u32 msg[32], sph_u32 val[8]); + +/** + * Apply the HAVAL compression function on the provided data. The + * msg parameter contains the 32 32-bit input blocks, + * as numerical values (hence after the little-endian decoding). The + * val parameter contains the 8 32-bit input blocks for + * the compression function; the output is written in place in this + * array. This function uses five internal passes. + * + * @param msg the message block (32 values) + * @param val the function 256-bit input and output + */ +void sph_haval_5_comp(const sph_u32 msg[32], sph_u32 val[8]); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/sph/sph_jh.h b/sph/sph_jh.h new file mode 100644 index 0000000..0268406 --- /dev/null +++ b/sph/sph_jh.h @@ -0,0 +1,290 @@ +/* $Id: sph_jh.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * JH interface. JH is a family of functions which differ by + * their output size; this implementation defines JH for output + * sizes 224, 256, 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_jh.h + * @author Thomas Pornin + */ + +#ifndef SPH_JH_H__ +#define SPH_JH_H__ + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for JH-224. + */ +#define SPH_SIZE_jh224 224 + +/** + * Output size (in bits) for JH-256. + */ +#define SPH_SIZE_jh256 256 + +/** + * Output size (in bits) for JH-384. + */ +#define SPH_SIZE_jh384 384 + +/** + * Output size (in bits) for JH-512. + */ +#define SPH_SIZE_jh512 512 + +/** + * This structure is a context for JH computations: it contains the + * intermediate values and some data from the last entered block. Once + * a JH computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running JH computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + union { +#if SPH_64 + sph_u64 wide[16]; +#endif + sph_u32 narrow[32]; + } H; +#if SPH_64 + sph_u64 block_count; +#else + sph_u32 block_count_high, block_count_low; +#endif +#endif +} sph_jh_context; + +/** + * Type for a JH-224 context (identical to the common context). + */ +typedef sph_jh_context sph_jh224_context; + +/** + * Type for a JH-256 context (identical to the common context). + */ +typedef sph_jh_context sph_jh256_context; + +/** + * Type for a JH-384 context (identical to the common context). + */ +typedef sph_jh_context sph_jh384_context; + +/** + * Type for a JH-512 context (identical to the common context). + */ +typedef sph_jh_context sph_jh512_context; + +/** + * Initialize a JH-224 context. This process performs no memory allocation. + * + * @param cc the JH-224 context (pointer to a + * sph_jh224_context) + */ +void sph_jh224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the JH-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_jh224(void *cc, const void *data, size_t len); + +/** + * Terminate the current JH-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the JH-224 context + * @param dst the destination buffer + */ +void sph_jh224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the JH-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_jh224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a JH-256 context. This process performs no memory allocation. + * + * @param cc the JH-256 context (pointer to a + * sph_jh256_context) + */ +void sph_jh256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the JH-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_jh256(void *cc, const void *data, size_t len); + +/** + * Terminate the current JH-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the JH-256 context + * @param dst the destination buffer + */ +void sph_jh256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the JH-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_jh256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a JH-384 context. This process performs no memory allocation. + * + * @param cc the JH-384 context (pointer to a + * sph_jh384_context) + */ +void sph_jh384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the JH-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_jh384(void *cc, const void *data, size_t len); + +/** + * Terminate the current JH-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the JH-384 context + * @param dst the destination buffer + */ +void sph_jh384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the JH-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_jh384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a JH-512 context. This process performs no memory allocation. + * + * @param cc the JH-512 context (pointer to a + * sph_jh512_context) + */ +void sph_jh512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the JH-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_jh512(void *cc, const void *data, size_t len); + +/** + * Terminate the current JH-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the JH-512 context + * @param dst the destination buffer + */ +void sph_jh512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the JH-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_jh512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#endif diff --git a/sph/sph_keccak.h b/sph/sph_keccak.h new file mode 100644 index 0000000..bdafdb8 --- /dev/null +++ b/sph/sph_keccak.h @@ -0,0 +1,293 @@ +/* $Id: sph_keccak.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * Keccak interface. This is the interface for Keccak with the + * recommended parameters for SHA-3, with output lengths 224, 256, + * 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_keccak.h + * @author Thomas Pornin + */ + +#ifndef SPH_KECCAK_H__ +#define SPH_KECCAK_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for Keccak-224. + */ +#define SPH_SIZE_keccak224 224 + +/** + * Output size (in bits) for Keccak-256. + */ +#define SPH_SIZE_keccak256 256 + +/** + * Output size (in bits) for Keccak-384. + */ +#define SPH_SIZE_keccak384 384 + +/** + * Output size (in bits) for Keccak-512. + */ +#define SPH_SIZE_keccak512 512 + +/** + * This structure is a context for Keccak computations: it contains the + * intermediate values and some data from the last entered block. Once a + * Keccak computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running Keccak computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[144]; /* first field, for alignment */ + size_t ptr, lim; + union { +#if SPH_64 + sph_u64 wide[25]; +#endif + sph_u32 narrow[50]; + } u; +#endif +} sph_keccak_context; + +/** + * Type for a Keccak-224 context (identical to the common context). + */ +typedef sph_keccak_context sph_keccak224_context; + +/** + * Type for a Keccak-256 context (identical to the common context). + */ +typedef sph_keccak_context sph_keccak256_context; + +/** + * Type for a Keccak-384 context (identical to the common context). + */ +typedef sph_keccak_context sph_keccak384_context; + +/** + * Type for a Keccak-512 context (identical to the common context). + */ +typedef sph_keccak_context sph_keccak512_context; + +/** + * Initialize a Keccak-224 context. This process performs no memory allocation. + * + * @param cc the Keccak-224 context (pointer to a + * sph_keccak224_context) + */ +void sph_keccak224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Keccak-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_keccak224(void *cc, const void *data, size_t len); + +/** + * Terminate the current Keccak-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the Keccak-224 context + * @param dst the destination buffer + */ +void sph_keccak224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Keccak-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_keccak224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Keccak-256 context. This process performs no memory allocation. + * + * @param cc the Keccak-256 context (pointer to a + * sph_keccak256_context) + */ +void sph_keccak256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Keccak-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_keccak256(void *cc, const void *data, size_t len); + +/** + * Terminate the current Keccak-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the Keccak-256 context + * @param dst the destination buffer + */ +void sph_keccak256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Keccak-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_keccak256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Keccak-384 context. This process performs no memory allocation. + * + * @param cc the Keccak-384 context (pointer to a + * sph_keccak384_context) + */ +void sph_keccak384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Keccak-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_keccak384(void *cc, const void *data, size_t len); + +/** + * Terminate the current Keccak-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the Keccak-384 context + * @param dst the destination buffer + */ +void sph_keccak384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Keccak-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_keccak384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Keccak-512 context. This process performs no memory allocation. + * + * @param cc the Keccak-512 context (pointer to a + * sph_keccak512_context) + */ +void sph_keccak512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Keccak-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_keccak512(void *cc, const void *data, size_t len); + +/** + * Terminate the current Keccak-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the Keccak-512 context + * @param dst the destination buffer + */ +void sph_keccak512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Keccak-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_keccak512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_luffa.h b/sph/sph_luffa.h new file mode 100644 index 0000000..a32fd7b --- /dev/null +++ b/sph/sph_luffa.h @@ -0,0 +1,296 @@ +/* $Id: sph_luffa.h 154 2010-04-26 17:00:24Z tp $ */ +/** + * Luffa interface. Luffa is a family of functions which differ by + * their output size; this implementation defines Luffa for output + * sizes 224, 256, 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_luffa.h + * @author Thomas Pornin + */ + +#ifndef SPH_LUFFA_H__ +#define SPH_LUFFA_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for Luffa-224. + */ +#define SPH_SIZE_luffa224 224 + +/** + * Output size (in bits) for Luffa-256. + */ +#define SPH_SIZE_luffa256 256 + +/** + * Output size (in bits) for Luffa-384. + */ +#define SPH_SIZE_luffa384 384 + +/** + * Output size (in bits) for Luffa-512. + */ +#define SPH_SIZE_luffa512 512 + +/** + * This structure is a context for Luffa-224 computations: it contains + * the intermediate values and some data from the last entered block. + * Once a Luffa computation has been performed, the context can be + * reused for another computation. + * + * The contents of this structure are private. A running Luffa + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[32]; /* first field, for alignment */ + size_t ptr; + sph_u32 V[3][8]; +#endif +} sph_luffa224_context; + +/** + * This structure is a context for Luffa-256 computations. It is + * identical to sph_luffa224_context. + */ +typedef sph_luffa224_context sph_luffa256_context; + +/** + * This structure is a context for Luffa-384 computations. + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[32]; /* first field, for alignment */ + size_t ptr; + sph_u32 V[4][8]; +#endif +} sph_luffa384_context; + +/** + * This structure is a context for Luffa-512 computations. + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[32]; /* first field, for alignment */ + size_t ptr; + sph_u32 V[5][8]; +#endif +} sph_luffa512_context; + +/** + * Initialize a Luffa-224 context. This process performs no memory allocation. + * + * @param cc the Luffa-224 context (pointer to a + * sph_luffa224_context) + */ +void sph_luffa224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Luffa-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_luffa224(void *cc, const void *data, size_t len); + +/** + * Terminate the current Luffa-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the Luffa-224 context + * @param dst the destination buffer + */ +void sph_luffa224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Luffa-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_luffa224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Luffa-256 context. This process performs no memory allocation. + * + * @param cc the Luffa-256 context (pointer to a + * sph_luffa256_context) + */ +void sph_luffa256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Luffa-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_luffa256(void *cc, const void *data, size_t len); + +/** + * Terminate the current Luffa-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the Luffa-256 context + * @param dst the destination buffer + */ +void sph_luffa256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Luffa-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_luffa256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Luffa-384 context. This process performs no memory allocation. + * + * @param cc the Luffa-384 context (pointer to a + * sph_luffa384_context) + */ +void sph_luffa384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Luffa-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_luffa384(void *cc, const void *data, size_t len); + +/** + * Terminate the current Luffa-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the Luffa-384 context + * @param dst the destination buffer + */ +void sph_luffa384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Luffa-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_luffa384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Luffa-512 context. This process performs no memory allocation. + * + * @param cc the Luffa-512 context (pointer to a + * sph_luffa512_context) + */ +void sph_luffa512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Luffa-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_luffa512(void *cc, const void *data, size_t len); + +/** + * Terminate the current Luffa-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the Luffa-512 context + * @param dst the destination buffer + */ +void sph_luffa512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Luffa-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_luffa512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_ripemd.h b/sph/sph_ripemd.h new file mode 100644 index 0000000..f1f0982 --- /dev/null +++ b/sph/sph_ripemd.h @@ -0,0 +1,273 @@ +/* $Id: sph_ripemd.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * RIPEMD, RIPEMD-128 and RIPEMD-160 interface. + * + * RIPEMD was first described in: Research and Development in Advanced + * Communication Technologies in Europe, "RIPE Integrity Primitives: + * Final Report of RACE Integrity Primitives Evaluation (R1040)", RACE, + * June 1992. + * + * A new, strengthened version, dubbed RIPEMD-160, was published in: H. + * Dobbertin, A. Bosselaers, and B. Preneel, "RIPEMD-160, a strengthened + * version of RIPEMD", Fast Software Encryption - FSE'96, LNCS 1039, + * Springer (1996), pp. 71--82. + * + * This article describes both RIPEMD-160, with a 160-bit output, and a + * reduced version called RIPEMD-128, which has a 128-bit output. RIPEMD-128 + * was meant as a "drop-in" replacement for any hash function with 128-bit + * output, especially the original RIPEMD. + * + * @warning Collisions, and an efficient method to build other collisions, + * have been published for the original RIPEMD, which is thus considered as + * cryptographically broken. It is also very rarely encountered, and there + * seems to exist no free description or implementation of RIPEMD (except + * the sphlib code, of course). As of january 2007, RIPEMD-128 and RIPEMD-160 + * seem as secure as their output length allows. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_ripemd.h + * @author Thomas Pornin + */ + +#ifndef SPH_RIPEMD_H__ +#define SPH_RIPEMD_H__ + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for RIPEMD. + */ +#define SPH_SIZE_ripemd 128 + +/** + * Output size (in bits) for RIPEMD-128. + */ +#define SPH_SIZE_ripemd128 128 + +/** + * Output size (in bits) for RIPEMD-160. + */ +#define SPH_SIZE_ripemd160 160 + +/** + * This structure is a context for RIPEMD computations: it contains the + * intermediate values and some data from the last entered block. Once + * a RIPEMD computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running RIPEMD computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + sph_u32 val[4]; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_ripemd_context; + +/** + * Initialize a RIPEMD context. This process performs no memory allocation. + * + * @param cc the RIPEMD context (pointer to + * a sph_ripemd_context) + */ +void sph_ripemd_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the RIPEMD context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_ripemd(void *cc, const void *data, size_t len); + +/** + * Terminate the current RIPEMD computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (16 bytes). The context is automatically + * reinitialized. + * + * @param cc the RIPEMD context + * @param dst the destination buffer + */ +void sph_ripemd_close(void *cc, void *dst); + +/** + * Apply the RIPEMD compression function on the provided data. The + * msg parameter contains the 16 32-bit input blocks, + * as numerical values (hence after the little-endian decoding). The + * val parameter contains the 5 32-bit input blocks for + * the compression function; the output is written in place in this + * array. + * + * @param msg the message block (16 values) + * @param val the function 128-bit input and output + */ +void sph_ripemd_comp(const sph_u32 msg[16], sph_u32 val[4]); + +/* ===================================================================== */ + +/** + * This structure is a context for RIPEMD-128 computations: it contains the + * intermediate values and some data from the last entered block. Once + * a RIPEMD-128 computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running RIPEMD-128 computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + sph_u32 val[4]; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_ripemd128_context; + +/** + * Initialize a RIPEMD-128 context. This process performs no memory allocation. + * + * @param cc the RIPEMD-128 context (pointer to + * a sph_ripemd128_context) + */ +void sph_ripemd128_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the RIPEMD-128 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_ripemd128(void *cc, const void *data, size_t len); + +/** + * Terminate the current RIPEMD-128 computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (16 bytes). The context is automatically + * reinitialized. + * + * @param cc the RIPEMD-128 context + * @param dst the destination buffer + */ +void sph_ripemd128_close(void *cc, void *dst); + +/** + * Apply the RIPEMD-128 compression function on the provided data. The + * msg parameter contains the 16 32-bit input blocks, + * as numerical values (hence after the little-endian decoding). The + * val parameter contains the 5 32-bit input blocks for + * the compression function; the output is written in place in this + * array. + * + * @param msg the message block (16 values) + * @param val the function 128-bit input and output + */ +void sph_ripemd128_comp(const sph_u32 msg[16], sph_u32 val[4]); + +/* ===================================================================== */ + +/** + * This structure is a context for RIPEMD-160 computations: it contains the + * intermediate values and some data from the last entered block. Once + * a RIPEMD-160 computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running RIPEMD-160 computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + sph_u32 val[5]; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_ripemd160_context; + +/** + * Initialize a RIPEMD-160 context. This process performs no memory allocation. + * + * @param cc the RIPEMD-160 context (pointer to + * a sph_ripemd160_context) + */ +void sph_ripemd160_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the RIPEMD-160 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_ripemd160(void *cc, const void *data, size_t len); + +/** + * Terminate the current RIPEMD-160 computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (20 bytes). The context is automatically + * reinitialized. + * + * @param cc the RIPEMD-160 context + * @param dst the destination buffer + */ +void sph_ripemd160_close(void *cc, void *dst); + +/** + * Apply the RIPEMD-160 compression function on the provided data. The + * msg parameter contains the 16 32-bit input blocks, + * as numerical values (hence after the little-endian decoding). The + * val parameter contains the 5 32-bit input blocks for + * the compression function; the output is written in place in this + * array. + * + * @param msg the message block (16 values) + * @param val the function 160-bit input and output + */ +void sph_ripemd160_comp(const sph_u32 msg[16], sph_u32 val[5]); + +#endif diff --git a/sph/sph_sha2.c b/sph/sph_sha2.c new file mode 100644 index 0000000..aab2c55 --- /dev/null +++ b/sph/sph_sha2.c @@ -0,0 +1,691 @@ +/* $Id: sha2.c 227 2010-06-16 17:28:38Z tp $ */ +/* + * SHA-224 / SHA-256 implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_sha2.h" + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_SHA2 +#define SPH_SMALL_FOOTPRINT_SHA2 1 +#endif + +#define CH(X, Y, Z) ((((Y) ^ (Z)) & (X)) ^ (Z)) +#define MAJ(X, Y, Z) (((Y) & (Z)) | (((Y) | (Z)) & (X))) + +#define ROTR SPH_ROTR32 + +#define BSG2_0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) +#define BSG2_1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) +#define SSG2_0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SPH_T32((x) >> 3)) +#define SSG2_1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SPH_T32((x) >> 10)) + +static const sph_u32 H224[8] = { + SPH_C32(0xC1059ED8), SPH_C32(0x367CD507), SPH_C32(0x3070DD17), + SPH_C32(0xF70E5939), SPH_C32(0xFFC00B31), SPH_C32(0x68581511), + SPH_C32(0x64F98FA7), SPH_C32(0xBEFA4FA4) +}; + +static const sph_u32 H256[8] = { + SPH_C32(0x6A09E667), SPH_C32(0xBB67AE85), SPH_C32(0x3C6EF372), + SPH_C32(0xA54FF53A), SPH_C32(0x510E527F), SPH_C32(0x9B05688C), + SPH_C32(0x1F83D9AB), SPH_C32(0x5BE0CD19) +}; + +/* + * The SHA2_ROUND_BODY defines the body for a SHA-224 / SHA-256 + * compression function implementation. The "in" parameter should + * evaluate, when applied to a numerical input parameter from 0 to 15, + * to an expression which yields the corresponding input block. The "r" + * parameter should evaluate to an array or pointer expression + * designating the array of 8 words which contains the input and output + * of the compression function. + */ + +#if SPH_SMALL_FOOTPRINT_SHA2 + +static const sph_u32 K[64] = { + SPH_C32(0x428A2F98), SPH_C32(0x71374491), + SPH_C32(0xB5C0FBCF), SPH_C32(0xE9B5DBA5), + SPH_C32(0x3956C25B), SPH_C32(0x59F111F1), + SPH_C32(0x923F82A4), SPH_C32(0xAB1C5ED5), + SPH_C32(0xD807AA98), SPH_C32(0x12835B01), + SPH_C32(0x243185BE), SPH_C32(0x550C7DC3), + SPH_C32(0x72BE5D74), SPH_C32(0x80DEB1FE), + SPH_C32(0x9BDC06A7), SPH_C32(0xC19BF174), + SPH_C32(0xE49B69C1), SPH_C32(0xEFBE4786), + SPH_C32(0x0FC19DC6), SPH_C32(0x240CA1CC), + SPH_C32(0x2DE92C6F), SPH_C32(0x4A7484AA), + SPH_C32(0x5CB0A9DC), SPH_C32(0x76F988DA), + SPH_C32(0x983E5152), SPH_C32(0xA831C66D), + SPH_C32(0xB00327C8), SPH_C32(0xBF597FC7), + SPH_C32(0xC6E00BF3), SPH_C32(0xD5A79147), + SPH_C32(0x06CA6351), SPH_C32(0x14292967), + SPH_C32(0x27B70A85), SPH_C32(0x2E1B2138), + SPH_C32(0x4D2C6DFC), SPH_C32(0x53380D13), + SPH_C32(0x650A7354), SPH_C32(0x766A0ABB), + SPH_C32(0x81C2C92E), SPH_C32(0x92722C85), + SPH_C32(0xA2BFE8A1), SPH_C32(0xA81A664B), + SPH_C32(0xC24B8B70), SPH_C32(0xC76C51A3), + SPH_C32(0xD192E819), SPH_C32(0xD6990624), + SPH_C32(0xF40E3585), SPH_C32(0x106AA070), + SPH_C32(0x19A4C116), SPH_C32(0x1E376C08), + SPH_C32(0x2748774C), SPH_C32(0x34B0BCB5), + SPH_C32(0x391C0CB3), SPH_C32(0x4ED8AA4A), + SPH_C32(0x5B9CCA4F), SPH_C32(0x682E6FF3), + SPH_C32(0x748F82EE), SPH_C32(0x78A5636F), + SPH_C32(0x84C87814), SPH_C32(0x8CC70208), + SPH_C32(0x90BEFFFA), SPH_C32(0xA4506CEB), + SPH_C32(0xBEF9A3F7), SPH_C32(0xC67178F2) +}; + +#define SHA2_MEXP1(in, pc) do { \ + W[pc] = in(pc); \ + } while (0) + +#define SHA2_MEXP2(in, pc) do { \ + W[(pc) & 0x0F] = SPH_T32(SSG2_1(W[((pc) - 2) & 0x0F]) \ + + W[((pc) - 7) & 0x0F] \ + + SSG2_0(W[((pc) - 15) & 0x0F]) + W[(pc) & 0x0F]); \ + } while (0) + +#define SHA2_STEPn(n, a, b, c, d, e, f, g, h, in, pc) do { \ + sph_u32 t1, t2; \ + SHA2_MEXP ## n(in, pc); \ + t1 = SPH_T32(h + BSG2_1(e) + CH(e, f, g) \ + + K[pcount + (pc)] + W[(pc) & 0x0F]); \ + t2 = SPH_T32(BSG2_0(a) + MAJ(a, b, c)); \ + d = SPH_T32(d + t1); \ + h = SPH_T32(t1 + t2); \ + } while (0) + +#define SHA2_STEP1(a, b, c, d, e, f, g, h, in, pc) \ + SHA2_STEPn(1, a, b, c, d, e, f, g, h, in, pc) +#define SHA2_STEP2(a, b, c, d, e, f, g, h, in, pc) \ + SHA2_STEPn(2, a, b, c, d, e, f, g, h, in, pc) + +#define SHA2_ROUND_BODY(in, r) do { \ + sph_u32 A, B, C, D, E, F, G, H; \ + sph_u32 W[16]; \ + unsigned pcount; \ + \ + A = (r)[0]; \ + B = (r)[1]; \ + C = (r)[2]; \ + D = (r)[3]; \ + E = (r)[4]; \ + F = (r)[5]; \ + G = (r)[6]; \ + H = (r)[7]; \ + pcount = 0; \ + SHA2_STEP1(A, B, C, D, E, F, G, H, in, 0); \ + SHA2_STEP1(H, A, B, C, D, E, F, G, in, 1); \ + SHA2_STEP1(G, H, A, B, C, D, E, F, in, 2); \ + SHA2_STEP1(F, G, H, A, B, C, D, E, in, 3); \ + SHA2_STEP1(E, F, G, H, A, B, C, D, in, 4); \ + SHA2_STEP1(D, E, F, G, H, A, B, C, in, 5); \ + SHA2_STEP1(C, D, E, F, G, H, A, B, in, 6); \ + SHA2_STEP1(B, C, D, E, F, G, H, A, in, 7); \ + SHA2_STEP1(A, B, C, D, E, F, G, H, in, 8); \ + SHA2_STEP1(H, A, B, C, D, E, F, G, in, 9); \ + SHA2_STEP1(G, H, A, B, C, D, E, F, in, 10); \ + SHA2_STEP1(F, G, H, A, B, C, D, E, in, 11); \ + SHA2_STEP1(E, F, G, H, A, B, C, D, in, 12); \ + SHA2_STEP1(D, E, F, G, H, A, B, C, in, 13); \ + SHA2_STEP1(C, D, E, F, G, H, A, B, in, 14); \ + SHA2_STEP1(B, C, D, E, F, G, H, A, in, 15); \ + for (pcount = 16; pcount < 64; pcount += 16) { \ + SHA2_STEP2(A, B, C, D, E, F, G, H, in, 0); \ + SHA2_STEP2(H, A, B, C, D, E, F, G, in, 1); \ + SHA2_STEP2(G, H, A, B, C, D, E, F, in, 2); \ + SHA2_STEP2(F, G, H, A, B, C, D, E, in, 3); \ + SHA2_STEP2(E, F, G, H, A, B, C, D, in, 4); \ + SHA2_STEP2(D, E, F, G, H, A, B, C, in, 5); \ + SHA2_STEP2(C, D, E, F, G, H, A, B, in, 6); \ + SHA2_STEP2(B, C, D, E, F, G, H, A, in, 7); \ + SHA2_STEP2(A, B, C, D, E, F, G, H, in, 8); \ + SHA2_STEP2(H, A, B, C, D, E, F, G, in, 9); \ + SHA2_STEP2(G, H, A, B, C, D, E, F, in, 10); \ + SHA2_STEP2(F, G, H, A, B, C, D, E, in, 11); \ + SHA2_STEP2(E, F, G, H, A, B, C, D, in, 12); \ + SHA2_STEP2(D, E, F, G, H, A, B, C, in, 13); \ + SHA2_STEP2(C, D, E, F, G, H, A, B, in, 14); \ + SHA2_STEP2(B, C, D, E, F, G, H, A, in, 15); \ + } \ + (r)[0] = SPH_T32((r)[0] + A); \ + (r)[1] = SPH_T32((r)[1] + B); \ + (r)[2] = SPH_T32((r)[2] + C); \ + (r)[3] = SPH_T32((r)[3] + D); \ + (r)[4] = SPH_T32((r)[4] + E); \ + (r)[5] = SPH_T32((r)[5] + F); \ + (r)[6] = SPH_T32((r)[6] + G); \ + (r)[7] = SPH_T32((r)[7] + H); \ + } while (0) + +#else + +#define SHA2_ROUND_BODY(in, r) do { \ + sph_u32 A, B, C, D, E, F, G, H, T1, T2; \ + sph_u32 W00, W01, W02, W03, W04, W05, W06, W07; \ + sph_u32 W08, W09, W10, W11, W12, W13, W14, W15; \ + int i; \ + \ + A = (r)[0]; \ + B = (r)[1]; \ + C = (r)[2]; \ + D = (r)[3]; \ + E = (r)[4]; \ + F = (r)[5]; \ + G = (r)[6]; \ + H = (r)[7]; \ + W00 = in(0); \ + T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \ + + SPH_C32(0x428A2F98) + W00); \ + T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \ + D = SPH_T32(D + T1); \ + H = SPH_T32(T1 + T2); \ + W01 = in(1); \ + T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \ + + SPH_C32(0x71374491) + W01); \ + T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \ + C = SPH_T32(C + T1); \ + G = SPH_T32(T1 + T2); \ + W02 = in(2); \ + T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \ + + SPH_C32(0xB5C0FBCF) + W02); \ + T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \ + B = SPH_T32(B + T1); \ + F = SPH_T32(T1 + T2); \ + W03 = in(3); \ + T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \ + + SPH_C32(0xE9B5DBA5) + W03); \ + T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \ + A = SPH_T32(A + T1); \ + E = SPH_T32(T1 + T2); \ + W04 = in(4); \ + T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \ + + SPH_C32(0x3956C25B) + W04); \ + T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \ + H = SPH_T32(H + T1); \ + D = SPH_T32(T1 + T2); \ + W05 = in(5); \ + T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \ + + SPH_C32(0x59F111F1) + W05); \ + T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \ + G = SPH_T32(G + T1); \ + C = SPH_T32(T1 + T2); \ + W06 = in(6); \ + T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \ + + SPH_C32(0x923F82A4) + W06); \ + T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \ + F = SPH_T32(F + T1); \ + B = SPH_T32(T1 + T2); \ + W07 = in(7); \ + T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \ + + SPH_C32(0xAB1C5ED5) + W07); \ + T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \ + E = SPH_T32(E + T1); \ + A = SPH_T32(T1 + T2); \ + W08 = in(8); \ + T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \ + + SPH_C32(0xD807AA98) + W08); \ + T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \ + D = SPH_T32(D + T1); \ + H = SPH_T32(T1 + T2); \ + W09 = in(9); \ + T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \ + + SPH_C32(0x12835B01) + W09); \ + T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \ + C = SPH_T32(C + T1); \ + G = SPH_T32(T1 + T2); \ + W10 = in(10); \ + T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \ + + SPH_C32(0x243185BE) + W10); \ + T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \ + B = SPH_T32(B + T1); \ + F = SPH_T32(T1 + T2); \ + W11 = in(11); \ + T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \ + + SPH_C32(0x550C7DC3) + W11); \ + T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \ + A = SPH_T32(A + T1); \ + E = SPH_T32(T1 + T2); \ + W12 = in(12); \ + T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \ + + SPH_C32(0x72BE5D74) + W12); \ + T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \ + H = SPH_T32(H + T1); \ + D = SPH_T32(T1 + T2); \ + W13 = in(13); \ + T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \ + + SPH_C32(0x80DEB1FE) + W13); \ + T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \ + G = SPH_T32(G + T1); \ + C = SPH_T32(T1 + T2); \ + W14 = in(14); \ + T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \ + + SPH_C32(0x9BDC06A7) + W14); \ + T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \ + F = SPH_T32(F + T1); \ + B = SPH_T32(T1 + T2); \ + W15 = in(15); \ + T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \ + + SPH_C32(0xC19BF174) + W15); \ + T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \ + E = SPH_T32(E + T1); \ + A = SPH_T32(T1 + T2); \ + W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \ + T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \ + + SPH_C32(0xE49B69C1) + W00); \ + T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \ + D = SPH_T32(D + T1); \ + H = SPH_T32(T1 + T2); \ + W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \ + T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \ + + SPH_C32(0xEFBE4786) + W01); \ + T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \ + C = SPH_T32(C + T1); \ + G = SPH_T32(T1 + T2); \ + W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \ + T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \ + + SPH_C32(0x0FC19DC6) + W02); \ + T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \ + B = SPH_T32(B + T1); \ + F = SPH_T32(T1 + T2); \ + W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \ + T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \ + + SPH_C32(0x240CA1CC) + W03); \ + T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \ + A = SPH_T32(A + T1); \ + E = SPH_T32(T1 + T2); \ + W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \ + T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \ + + SPH_C32(0x2DE92C6F) + W04); \ + T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \ + H = SPH_T32(H + T1); \ + D = SPH_T32(T1 + T2); \ + W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \ + T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \ + + SPH_C32(0x4A7484AA) + W05); \ + T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \ + G = SPH_T32(G + T1); \ + C = SPH_T32(T1 + T2); \ + W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \ + T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \ + + SPH_C32(0x5CB0A9DC) + W06); \ + T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \ + F = SPH_T32(F + T1); \ + B = SPH_T32(T1 + T2); \ + W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \ + T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \ + + SPH_C32(0x76F988DA) + W07); \ + T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \ + E = SPH_T32(E + T1); \ + A = SPH_T32(T1 + T2); \ + W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \ + T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \ + + SPH_C32(0x983E5152) + W08); \ + T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \ + D = SPH_T32(D + T1); \ + H = SPH_T32(T1 + T2); \ + W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \ + T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \ + + SPH_C32(0xA831C66D) + W09); \ + T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \ + C = SPH_T32(C + T1); \ + G = SPH_T32(T1 + T2); \ + W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \ + T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \ + + SPH_C32(0xB00327C8) + W10); \ + T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \ + B = SPH_T32(B + T1); \ + F = SPH_T32(T1 + T2); \ + W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \ + T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \ + + SPH_C32(0xBF597FC7) + W11); \ + T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \ + A = SPH_T32(A + T1); \ + E = SPH_T32(T1 + T2); \ + W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \ + T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \ + + SPH_C32(0xC6E00BF3) + W12); \ + T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \ + H = SPH_T32(H + T1); \ + D = SPH_T32(T1 + T2); \ + W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \ + T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \ + + SPH_C32(0xD5A79147) + W13); \ + T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \ + G = SPH_T32(G + T1); \ + C = SPH_T32(T1 + T2); \ + W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \ + T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \ + + SPH_C32(0x06CA6351) + W14); \ + T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \ + F = SPH_T32(F + T1); \ + B = SPH_T32(T1 + T2); \ + W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \ + T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \ + + SPH_C32(0x14292967) + W15); \ + T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \ + E = SPH_T32(E + T1); \ + A = SPH_T32(T1 + T2); \ + W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \ + T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \ + + SPH_C32(0x27B70A85) + W00); \ + T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \ + D = SPH_T32(D + T1); \ + H = SPH_T32(T1 + T2); \ + W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \ + T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \ + + SPH_C32(0x2E1B2138) + W01); \ + T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \ + C = SPH_T32(C + T1); \ + G = SPH_T32(T1 + T2); \ + W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \ + T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \ + + SPH_C32(0x4D2C6DFC) + W02); \ + T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \ + B = SPH_T32(B + T1); \ + F = SPH_T32(T1 + T2); \ + W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \ + T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \ + + SPH_C32(0x53380D13) + W03); \ + T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \ + A = SPH_T32(A + T1); \ + E = SPH_T32(T1 + T2); \ + W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \ + T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \ + + SPH_C32(0x650A7354) + W04); \ + T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \ + H = SPH_T32(H + T1); \ + D = SPH_T32(T1 + T2); \ + W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \ + T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \ + + SPH_C32(0x766A0ABB) + W05); \ + T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \ + G = SPH_T32(G + T1); \ + C = SPH_T32(T1 + T2); \ + W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \ + T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \ + + SPH_C32(0x81C2C92E) + W06); \ + T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \ + F = SPH_T32(F + T1); \ + B = SPH_T32(T1 + T2); \ + W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \ + T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \ + + SPH_C32(0x92722C85) + W07); \ + T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \ + E = SPH_T32(E + T1); \ + A = SPH_T32(T1 + T2); \ + W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \ + T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \ + + SPH_C32(0xA2BFE8A1) + W08); \ + T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \ + D = SPH_T32(D + T1); \ + H = SPH_T32(T1 + T2); \ + W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \ + T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \ + + SPH_C32(0xA81A664B) + W09); \ + T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \ + C = SPH_T32(C + T1); \ + G = SPH_T32(T1 + T2); \ + W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \ + T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \ + + SPH_C32(0xC24B8B70) + W10); \ + T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \ + B = SPH_T32(B + T1); \ + F = SPH_T32(T1 + T2); \ + W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \ + T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \ + + SPH_C32(0xC76C51A3) + W11); \ + T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \ + A = SPH_T32(A + T1); \ + E = SPH_T32(T1 + T2); \ + W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \ + T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \ + + SPH_C32(0xD192E819) + W12); \ + T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \ + H = SPH_T32(H + T1); \ + D = SPH_T32(T1 + T2); \ + W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \ + T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \ + + SPH_C32(0xD6990624) + W13); \ + T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \ + G = SPH_T32(G + T1); \ + C = SPH_T32(T1 + T2); \ + W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \ + T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \ + + SPH_C32(0xF40E3585) + W14); \ + T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \ + F = SPH_T32(F + T1); \ + B = SPH_T32(T1 + T2); \ + W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \ + T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \ + + SPH_C32(0x106AA070) + W15); \ + T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \ + E = SPH_T32(E + T1); \ + A = SPH_T32(T1 + T2); \ + W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \ + T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \ + + SPH_C32(0x19A4C116) + W00); \ + T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \ + D = SPH_T32(D + T1); \ + H = SPH_T32(T1 + T2); \ + W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \ + T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \ + + SPH_C32(0x1E376C08) + W01); \ + T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \ + C = SPH_T32(C + T1); \ + G = SPH_T32(T1 + T2); \ + W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \ + T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \ + + SPH_C32(0x2748774C) + W02); \ + T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \ + B = SPH_T32(B + T1); \ + F = SPH_T32(T1 + T2); \ + W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \ + T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \ + + SPH_C32(0x34B0BCB5) + W03); \ + T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \ + A = SPH_T32(A + T1); \ + E = SPH_T32(T1 + T2); \ + W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \ + T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \ + + SPH_C32(0x391C0CB3) + W04); \ + T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \ + H = SPH_T32(H + T1); \ + D = SPH_T32(T1 + T2); \ + W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \ + T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \ + + SPH_C32(0x4ED8AA4A) + W05); \ + T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \ + G = SPH_T32(G + T1); \ + C = SPH_T32(T1 + T2); \ + W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \ + T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \ + + SPH_C32(0x5B9CCA4F) + W06); \ + T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \ + F = SPH_T32(F + T1); \ + B = SPH_T32(T1 + T2); \ + W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \ + T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \ + + SPH_C32(0x682E6FF3) + W07); \ + T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \ + E = SPH_T32(E + T1); \ + A = SPH_T32(T1 + T2); \ + W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \ + T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \ + + SPH_C32(0x748F82EE) + W08); \ + T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \ + D = SPH_T32(D + T1); \ + H = SPH_T32(T1 + T2); \ + W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \ + T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \ + + SPH_C32(0x78A5636F) + W09); \ + T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \ + C = SPH_T32(C + T1); \ + G = SPH_T32(T1 + T2); \ + W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \ + T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \ + + SPH_C32(0x84C87814) + W10); \ + T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \ + B = SPH_T32(B + T1); \ + F = SPH_T32(T1 + T2); \ + W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \ + T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \ + + SPH_C32(0x8CC70208) + W11); \ + T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \ + A = SPH_T32(A + T1); \ + E = SPH_T32(T1 + T2); \ + W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \ + T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \ + + SPH_C32(0x90BEFFFA) + W12); \ + T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \ + H = SPH_T32(H + T1); \ + D = SPH_T32(T1 + T2); \ + W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \ + T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \ + + SPH_C32(0xA4506CEB) + W13); \ + T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \ + G = SPH_T32(G + T1); \ + C = SPH_T32(T1 + T2); \ + W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \ + T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \ + + SPH_C32(0xBEF9A3F7) + W14); \ + T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \ + F = SPH_T32(F + T1); \ + B = SPH_T32(T1 + T2); \ + W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \ + T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \ + + SPH_C32(0xC67178F2) + W15); \ + T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \ + E = SPH_T32(E + T1); \ + A = SPH_T32(T1 + T2); \ + (r)[0] = SPH_T32((r)[0] + A); \ + (r)[1] = SPH_T32((r)[1] + B); \ + (r)[2] = SPH_T32((r)[2] + C); \ + (r)[3] = SPH_T32((r)[3] + D); \ + (r)[4] = SPH_T32((r)[4] + E); \ + (r)[5] = SPH_T32((r)[5] + F); \ + (r)[6] = SPH_T32((r)[6] + G); \ + (r)[7] = SPH_T32((r)[7] + H); \ + } while (0) + +#endif + +/* + * One round of SHA-224 / SHA-256. The data must be aligned for 32-bit access. + */ +static void +sha2_round(const unsigned char *data, sph_u32 r[8]) +{ +#define SHA2_IN(x) sph_dec32be_aligned(data + (4 * (x))) + SHA2_ROUND_BODY(SHA2_IN, r); +#undef SHA2_IN +} + +/* see sph_sha2.h */ +void +sph_sha224_init(void *cc) +{ + sph_sha224_context *sc; + + sc = cc; + memcpy(sc->val, H224, sizeof H224); +#if SPH_64 + sc->count = 0; +#else + sc->count_high = sc->count_low = 0; +#endif +} + +/* see sph_sha2.h */ +void +sph_sha256_init(void *cc) +{ + sph_sha256_context *sc; + + sc = cc; + memcpy(sc->val, H256, sizeof H256); +#if SPH_64 + sc->count = 0; +#else + sc->count_high = sc->count_low = 0; +#endif +} + +#define RFUN sha2_round +#define HASH sha224 +#define BE32 1 +#include "md_helper.c" + +/* see sph_sha2.h */ +void +sph_sha224_close(void *cc, void *dst) +{ + sha224_close(cc, dst, 7); + sph_sha224_init(cc); +} + +/* see sph_sha2.h */ +void +sph_sha224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + sha224_addbits_and_close(cc, ub, n, dst, 7); + sph_sha224_init(cc); +} + +/* see sph_sha2.h */ +void +sph_sha256_close(void *cc, void *dst) +{ + sha224_close(cc, dst, 8); + sph_sha256_init(cc); +} + +/* see sph_sha2.h */ +void +sph_sha256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + sha224_addbits_and_close(cc, ub, n, dst, 8); + sph_sha256_init(cc); +} + +/* see sph_sha2.h */ +void +sph_sha224_comp(const sph_u32 msg[16], sph_u32 val[8]) +{ +#define SHA2_IN(x) msg[x] + SHA2_ROUND_BODY(SHA2_IN, val); +#undef SHA2_IN +} diff --git a/sph/sph_sha2.h b/sph/sph_sha2.h new file mode 100644 index 0000000..c47b0f3 --- /dev/null +++ b/sph/sph_sha2.h @@ -0,0 +1,378 @@ +/* $Id: sph_sha2.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * SHA-224, SHA-256, SHA-384 and SHA-512 interface. + * + * SHA-256 has been published in FIPS 180-2, now amended with a change + * notice to include SHA-224 as well (which is a simple variation on + * SHA-256). SHA-384 and SHA-512 are also defined in FIPS 180-2. FIPS + * standards can be found at: + * http://csrc.nist.gov/publications/fips/ + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_sha2.h + * @author Thomas Pornin + */ + +#ifndef SPH_SHA2_H__ +#define SPH_SHA2_H__ + +#include +#include "sph_types.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +/** + * Output size (in bits) for SHA-224. + */ +#define SPH_SIZE_sha224 224 + +/** + * Output size (in bits) for SHA-256. + */ +#define SPH_SIZE_sha256 256 + +/** + * This structure is a context for SHA-224 computations: it contains the + * intermediate values and some data from the last entered block. Once + * a SHA-224 computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running SHA-224 computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + sph_u32 val[8]; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_sha224_context; + +/** + * This structure is a context for SHA-256 computations. It is identical + * to the SHA-224 context. However, a context is initialized for SHA-224 + * or SHA-256, but not both (the internal IV is not the + * same). + */ +typedef sph_sha224_context sph_sha256_context; + +/** + * Initialize a SHA-224 context. This process performs no memory allocation. + * + * @param cc the SHA-224 context (pointer to + * a sph_sha224_context) + */ +void sph_sha224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SHA-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_sha224(void *cc, const void *data, size_t len); + +/** + * Terminate the current SHA-224 computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the SHA-224 context + * @param dst the destination buffer + */ +void sph_sha224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SHA-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_sha224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Apply the SHA-224 compression function on the provided data. The + * msg parameter contains the 16 32-bit input blocks, + * as numerical values (hence after the big-endian decoding). The + * val parameter contains the 8 32-bit input blocks for + * the compression function; the output is written in place in this + * array. + * + * @param msg the message block (16 values) + * @param val the function 256-bit input and output + */ +void sph_sha224_comp(const sph_u32 msg[16], sph_u32 val[8]); + +/** + * Initialize a SHA-256 context. This process performs no memory allocation. + * + * @param cc the SHA-256 context (pointer to + * a sph_sha256_context) + */ +void sph_sha256_init(void *cc); + +#ifdef DOXYGEN_IGNORE +/** + * Process some data bytes, for SHA-256. This function is identical to + * sha_224() + * + * @param cc the SHA-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_sha256(void *cc, const void *data, size_t len); +#endif + +#ifndef DOXYGEN_IGNORE +#define sph_sha256 sph_sha224 +#endif + +/** + * Terminate the current SHA-256 computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the SHA-256 context + * @param dst the destination buffer + */ +void sph_sha256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SHA-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_sha256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef DOXYGEN_IGNORE +/** + * Apply the SHA-256 compression function on the provided data. This + * function is identical to sha224_comp(). + * + * @param msg the message block (16 values) + * @param val the function 256-bit input and output + */ +void sph_sha256_comp(const sph_u32 msg[16], sph_u32 val[8]); +#endif + +#ifndef DOXYGEN_IGNORE +#define sph_sha256_comp sph_sha224_comp +#endif + +#if SPH_64 + +/** + * Output size (in bits) for SHA-384. + */ +#define SPH_SIZE_sha384 384 + +/** + * Output size (in bits) for SHA-512. + */ +#define SPH_SIZE_sha512 512 + +/** + * This structure is a context for SHA-384 computations: it contains the + * intermediate values and some data from the last entered block. Once + * a SHA-384 computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running SHA-384 computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[128]; /* first field, for alignment */ + sph_u64 val[8]; + sph_u64 count; +#endif +} sph_sha384_context; + +/** + * Initialize a SHA-384 context. This process performs no memory allocation. + * + * @param cc the SHA-384 context (pointer to + * a sph_sha384_context) + */ +void sph_sha384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SHA-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_sha384(void *cc, const void *data, size_t len); + +/** + * Terminate the current SHA-384 computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the SHA-384 context + * @param dst the destination buffer + */ +void sph_sha384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SHA-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_sha384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Apply the SHA-384 compression function on the provided data. The + * msg parameter contains the 16 64-bit input blocks, + * as numerical values (hence after the big-endian decoding). The + * val parameter contains the 8 64-bit input blocks for + * the compression function; the output is written in place in this + * array. + * + * @param msg the message block (16 values) + * @param val the function 512-bit input and output + */ +void sph_sha384_comp(const sph_u64 msg[16], sph_u64 val[8]); + +/** + * This structure is a context for SHA-512 computations. It is identical + * to the SHA-384 context. However, a context is initialized for SHA-384 + * or SHA-512, but not both (the internal IV is not the + * same). + */ +typedef sph_sha384_context sph_sha512_context; + +/** + * Initialize a SHA-512 context. This process performs no memory allocation. + * + * @param cc the SHA-512 context (pointer to + * a sph_sha512_context) + */ +void sph_sha512_init(void *cc); + +#ifdef DOXYGEN_IGNORE +/** + * Process some data bytes, for SHA-512. This function is identical to + * sph_sha384(). + * + * @param cc the SHA-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_sha512(void *cc, const void *data, size_t len); +#endif + +#ifndef DOXYGEN_IGNORE +#define sph_sha512 sph_sha384 +#endif + +/** + * Terminate the current SHA-512 computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the SHA-512 context + * @param dst the destination buffer + */ +void sph_sha512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SHA-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_sha512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef DOXYGEN_IGNORE +/** + * Apply the SHA-512 compression function. This function is identical to + * sph_sha384_comp(). + * + * @param msg the message block (16 values) + * @param val the function 512-bit input and output + */ +void sph_sha512_comp(const sph_u64 msg[16], sph_u64 val[8]); +#endif + +#ifndef DOXYGEN_IGNORE +#define sph_sha512_comp sph_sha384_comp +#endif + +#endif + +#endif +#ifdef __cplusplus +} +#endif + diff --git a/sph/sph_shabal.h b/sph/sph_shabal.h new file mode 100644 index 0000000..08aa5f7 --- /dev/null +++ b/sph/sph_shabal.h @@ -0,0 +1,344 @@ +/* $Id: sph_shabal.h 175 2010-05-07 16:03:20Z tp $ */ +/** + * Shabal interface. Shabal is a family of functions which differ by + * their output size; this implementation defines Shabal for output + * sizes 192, 224, 256, 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_shabal.h + * @author Thomas Pornin + */ + +#ifndef SPH_SHABAL_H__ +#define SPH_SHABAL_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for Shabal-192. + */ +#define SPH_SIZE_shabal192 192 + +/** + * Output size (in bits) for Shabal-224. + */ +#define SPH_SIZE_shabal224 224 + +/** + * Output size (in bits) for Shabal-256. + */ +#define SPH_SIZE_shabal256 256 + +/** + * Output size (in bits) for Shabal-384. + */ +#define SPH_SIZE_shabal384 384 + +/** + * Output size (in bits) for Shabal-512. + */ +#define SPH_SIZE_shabal512 512 + +/** + * This structure is a context for Shabal computations: it contains the + * intermediate values and some data from the last entered block. Once + * a Shabal computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running Shabal computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + sph_u32 A[12], B[16], C[16]; + sph_u32 Whigh, Wlow; +#endif +} sph_shabal_context; + +/** + * Type for a Shabal-192 context (identical to the common context). + */ +typedef sph_shabal_context sph_shabal192_context; + +/** + * Type for a Shabal-224 context (identical to the common context). + */ +typedef sph_shabal_context sph_shabal224_context; + +/** + * Type for a Shabal-256 context (identical to the common context). + */ +typedef sph_shabal_context sph_shabal256_context; + +/** + * Type for a Shabal-384 context (identical to the common context). + */ +typedef sph_shabal_context sph_shabal384_context; + +/** + * Type for a Shabal-512 context (identical to the common context). + */ +typedef sph_shabal_context sph_shabal512_context; + +/** + * Initialize a Shabal-192 context. This process performs no memory allocation. + * + * @param cc the Shabal-192 context (pointer to a + * sph_shabal192_context) + */ +void sph_shabal192_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Shabal-192 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shabal192(void *cc, const void *data, size_t len); + +/** + * Terminate the current Shabal-192 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (24 bytes). The context is automatically + * reinitialized. + * + * @param cc the Shabal-192 context + * @param dst the destination buffer + */ +void sph_shabal192_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (24 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Shabal-192 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shabal192_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Shabal-224 context. This process performs no memory allocation. + * + * @param cc the Shabal-224 context (pointer to a + * sph_shabal224_context) + */ +void sph_shabal224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Shabal-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shabal224(void *cc, const void *data, size_t len); + +/** + * Terminate the current Shabal-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the Shabal-224 context + * @param dst the destination buffer + */ +void sph_shabal224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Shabal-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shabal224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Shabal-256 context. This process performs no memory allocation. + * + * @param cc the Shabal-256 context (pointer to a + * sph_shabal256_context) + */ +void sph_shabal256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Shabal-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shabal256(void *cc, const void *data, size_t len); + +/** + * Terminate the current Shabal-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the Shabal-256 context + * @param dst the destination buffer + */ +void sph_shabal256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Shabal-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shabal256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Shabal-384 context. This process performs no memory allocation. + * + * @param cc the Shabal-384 context (pointer to a + * sph_shabal384_context) + */ +void sph_shabal384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Shabal-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shabal384(void *cc, const void *data, size_t len); + +/** + * Terminate the current Shabal-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the Shabal-384 context + * @param dst the destination buffer + */ +void sph_shabal384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Shabal-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shabal384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Shabal-512 context. This process performs no memory allocation. + * + * @param cc the Shabal-512 context (pointer to a + * sph_shabal512_context) + */ +void sph_shabal512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Shabal-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shabal512(void *cc, const void *data, size_t len); + +/** + * Terminate the current Shabal-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the Shabal-512 context + * @param dst the destination buffer + */ +void sph_shabal512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Shabal-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shabal512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_shavite.h b/sph/sph_shavite.h new file mode 100644 index 0000000..0957e42 --- /dev/null +++ b/sph/sph_shavite.h @@ -0,0 +1,314 @@ +/* $Id: sph_shavite.h 208 2010-06-02 20:33:00Z tp $ */ +/** + * SHAvite-3 interface. This code implements SHAvite-3 with the + * recommended parameters for SHA-3, with outputs of 224, 256, 384 and + * 512 bits. In the following, we call the function "SHAvite" (without + * the "-3" suffix), thus "SHAvite-224" is "SHAvite-3 with a 224-bit + * output". + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_shavite.h + * @author Thomas Pornin + */ + +#ifndef SPH_SHAVITE_H__ +#define SPH_SHAVITE_H__ + +#include +#include "sph_types.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +/** + * Output size (in bits) for SHAvite-224. + */ +#define SPH_SIZE_shavite224 224 + +/** + * Output size (in bits) for SHAvite-256. + */ +#define SPH_SIZE_shavite256 256 + +/** + * Output size (in bits) for SHAvite-384. + */ +#define SPH_SIZE_shavite384 384 + +/** + * Output size (in bits) for SHAvite-512. + */ +#define SPH_SIZE_shavite512 512 + +/** + * This structure is a context for SHAvite-224 and SHAvite-256 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a SHAvite computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running SHAvite + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + sph_u32 h[8]; + sph_u32 count0, count1; +#endif +} sph_shavite_small_context; + +/** + * This structure is a context for SHAvite-224 computations. It is + * identical to the common sph_shavite_small_context. + */ +typedef sph_shavite_small_context sph_shavite224_context; + +/** + * This structure is a context for SHAvite-256 computations. It is + * identical to the common sph_shavite_small_context. + */ +typedef sph_shavite_small_context sph_shavite256_context; + +/** + * This structure is a context for SHAvite-384 and SHAvite-512 computations: + * it contains the intermediate values and some data from the last + * entered block. Once a SHAvite computation has been performed, the + * context can be reused for another computation. + * + * The contents of this structure are private. A running SHAvite + * computation can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[128]; /* first field, for alignment */ + size_t ptr; + sph_u32 h[16]; + sph_u32 count0, count1, count2, count3; +#endif +} sph_shavite_big_context; + +/** + * This structure is a context for SHAvite-384 computations. It is + * identical to the common sph_shavite_small_context. + */ +typedef sph_shavite_big_context sph_shavite384_context; + +/** + * This structure is a context for SHAvite-512 computations. It is + * identical to the common sph_shavite_small_context. + */ +typedef sph_shavite_big_context sph_shavite512_context; + +/** + * Initialize a SHAvite-224 context. This process performs no memory allocation. + * + * @param cc the SHAvite-224 context (pointer to a + * sph_shavite224_context) + */ +void sph_shavite224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SHAvite-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shavite224(void *cc, const void *data, size_t len); + +/** + * Terminate the current SHAvite-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the SHAvite-224 context + * @param dst the destination buffer + */ +void sph_shavite224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SHAvite-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shavite224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a SHAvite-256 context. This process performs no memory allocation. + * + * @param cc the SHAvite-256 context (pointer to a + * sph_shavite256_context) + */ +void sph_shavite256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SHAvite-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shavite256(void *cc, const void *data, size_t len); + +/** + * Terminate the current SHAvite-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the SHAvite-256 context + * @param dst the destination buffer + */ +void sph_shavite256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SHAvite-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shavite256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a SHAvite-384 context. This process performs no memory allocation. + * + * @param cc the SHAvite-384 context (pointer to a + * sph_shavite384_context) + */ +void sph_shavite384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SHAvite-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shavite384(void *cc, const void *data, size_t len); + +/** + * Terminate the current SHAvite-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the SHAvite-384 context + * @param dst the destination buffer + */ +void sph_shavite384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SHAvite-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shavite384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a SHAvite-512 context. This process performs no memory allocation. + * + * @param cc the SHAvite-512 context (pointer to a + * sph_shavite512_context) + */ +void sph_shavite512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SHAvite-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_shavite512(void *cc, const void *data, size_t len); + +/** + * Terminate the current SHAvite-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the SHAvite-512 context + * @param dst the destination buffer + */ +void sph_shavite512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SHAvite-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_shavite512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_simd.h b/sph/sph_simd.h new file mode 100644 index 0000000..92ee1e7 --- /dev/null +++ b/sph/sph_simd.h @@ -0,0 +1,309 @@ +/* $Id: sph_simd.h 154 2010-04-26 17:00:24Z tp $ */ +/** + * SIMD interface. SIMD is a family of functions which differ by + * their output size; this implementation defines SIMD for output + * sizes 224, 256, 384 and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_simd.h + * @author Thomas Pornin + */ + +#ifndef SPH_SIMD_H__ +#define SPH_SIMD_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for SIMD-224. + */ +#define SPH_SIZE_simd224 224 + +/** + * Output size (in bits) for SIMD-256. + */ +#define SPH_SIZE_simd256 256 + +/** + * Output size (in bits) for SIMD-384. + */ +#define SPH_SIZE_simd384 384 + +/** + * Output size (in bits) for SIMD-512. + */ +#define SPH_SIZE_simd512 512 + +/** + * This structure is a context for SIMD computations: it contains the + * intermediate values and some data from the last entered block. Once + * an SIMD computation has been performed, the context can be reused for + * another computation. This specific structure is used for SIMD-224 + * and SIMD-256. + * + * The contents of this structure are private. A running SIMD computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + sph_u32 state[16]; + sph_u32 count_low, count_high; +#endif +} sph_simd_small_context; + +/** + * This structure is a context for SIMD computations: it contains the + * intermediate values and some data from the last entered block. Once + * an SIMD computation has been performed, the context can be reused for + * another computation. This specific structure is used for SIMD-384 + * and SIMD-512. + * + * The contents of this structure are private. A running SIMD computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[128]; /* first field, for alignment */ + size_t ptr; + sph_u32 state[32]; + sph_u32 count_low, count_high; +#endif +} sph_simd_big_context; + +/** + * Type for a SIMD-224 context (identical to the common "small" context). + */ +typedef sph_simd_small_context sph_simd224_context; + +/** + * Type for a SIMD-256 context (identical to the common "small" context). + */ +typedef sph_simd_small_context sph_simd256_context; + +/** + * Type for a SIMD-384 context (identical to the common "big" context). + */ +typedef sph_simd_big_context sph_simd384_context; + +/** + * Type for a SIMD-512 context (identical to the common "big" context). + */ +typedef sph_simd_big_context sph_simd512_context; + +/** + * Initialize an SIMD-224 context. This process performs no memory allocation. + * + * @param cc the SIMD-224 context (pointer to a + * sph_simd224_context) + */ +void sph_simd224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SIMD-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_simd224(void *cc, const void *data, size_t len); + +/** + * Terminate the current SIMD-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the SIMD-224 context + * @param dst the destination buffer + */ +void sph_simd224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SIMD-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_simd224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize an SIMD-256 context. This process performs no memory allocation. + * + * @param cc the SIMD-256 context (pointer to a + * sph_simd256_context) + */ +void sph_simd256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SIMD-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_simd256(void *cc, const void *data, size_t len); + +/** + * Terminate the current SIMD-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the SIMD-256 context + * @param dst the destination buffer + */ +void sph_simd256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SIMD-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_simd256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize an SIMD-384 context. This process performs no memory allocation. + * + * @param cc the SIMD-384 context (pointer to a + * sph_simd384_context) + */ +void sph_simd384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SIMD-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_simd384(void *cc, const void *data, size_t len); + +/** + * Terminate the current SIMD-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the SIMD-384 context + * @param dst the destination buffer + */ +void sph_simd384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SIMD-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_simd384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize an SIMD-512 context. This process performs no memory allocation. + * + * @param cc the SIMD-512 context (pointer to a + * sph_simd512_context) + */ +void sph_simd512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the SIMD-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_simd512(void *cc, const void *data, size_t len); + +/** + * Terminate the current SIMD-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the SIMD-512 context + * @param dst the destination buffer + */ +void sph_simd512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the SIMD-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_simd512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_skein.h b/sph/sph_skein.h new file mode 100644 index 0000000..bddbc86 --- /dev/null +++ b/sph/sph_skein.h @@ -0,0 +1,298 @@ +/* $Id: sph_skein.h 253 2011-06-07 18:33:10Z tp $ */ +/** + * Skein interface. The Skein specification defines three main + * functions, called Skein-256, Skein-512 and Skein-1024, which can be + * further parameterized with an output length. For the SHA-3 + * competition, Skein-512 is used for output sizes of 224, 256, 384 and + * 512 bits; this is what this code implements. Thus, we hereafter call + * Skein-224, Skein-256, Skein-384 and Skein-512 what the Skein + * specification defines as Skein-512-224, Skein-512-256, Skein-512-384 + * and Skein-512-512, respectively. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_skein.h + * @author Thomas Pornin + */ + +#ifndef SPH_SKEIN_H__ +#define SPH_SKEIN_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +#if SPH_64 + +/** + * Output size (in bits) for Skein-224. + */ +#define SPH_SIZE_skein224 224 + +/** + * Output size (in bits) for Skein-256. + */ +#define SPH_SIZE_skein256 256 + +/** + * Output size (in bits) for Skein-384. + */ +#define SPH_SIZE_skein384 384 + +/** + * Output size (in bits) for Skein-512. + */ +#define SPH_SIZE_skein512 512 + +/** + * This structure is a context for Skein computations (with a 384- or + * 512-bit output): it contains the intermediate values and some data + * from the last entered block. Once a Skein computation has been + * performed, the context can be reused for another computation. + * + * The contents of this structure are private. A running Skein computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + sph_u64 h0, h1, h2, h3, h4, h5, h6, h7; + sph_u64 bcount; +#endif +} sph_skein_big_context; + +/** + * Type for a Skein-224 context (identical to the common "big" context). + */ +typedef sph_skein_big_context sph_skein224_context; + +/** + * Type for a Skein-256 context (identical to the common "big" context). + */ +typedef sph_skein_big_context sph_skein256_context; + +/** + * Type for a Skein-384 context (identical to the common "big" context). + */ +typedef sph_skein_big_context sph_skein384_context; + +/** + * Type for a Skein-512 context (identical to the common "big" context). + */ +typedef sph_skein_big_context sph_skein512_context; + +/** + * Initialize a Skein-224 context. This process performs no memory allocation. + * + * @param cc the Skein-224 context (pointer to a + * sph_skein224_context) + */ +void sph_skein224_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Skein-224 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_skein224(void *cc, const void *data, size_t len); + +/** + * Terminate the current Skein-224 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (28 bytes). The context is automatically + * reinitialized. + * + * @param cc the Skein-224 context + * @param dst the destination buffer + */ +void sph_skein224_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (28 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Skein-224 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_skein224_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Skein-256 context. This process performs no memory allocation. + * + * @param cc the Skein-256 context (pointer to a + * sph_skein256_context) + */ +void sph_skein256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Skein-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_skein256(void *cc, const void *data, size_t len); + +/** + * Terminate the current Skein-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the Skein-256 context + * @param dst the destination buffer + */ +void sph_skein256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Skein-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_skein256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Skein-384 context. This process performs no memory allocation. + * + * @param cc the Skein-384 context (pointer to a + * sph_skein384_context) + */ +void sph_skein384_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Skein-384 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_skein384(void *cc, const void *data, size_t len); + +/** + * Terminate the current Skein-384 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (48 bytes). The context is automatically + * reinitialized. + * + * @param cc the Skein-384 context + * @param dst the destination buffer + */ +void sph_skein384_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (48 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Skein-384 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_skein384_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Skein-512 context. This process performs no memory allocation. + * + * @param cc the Skein-512 context (pointer to a + * sph_skein512_context) + */ +void sph_skein512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Skein-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_skein512(void *cc, const void *data, size_t len); + +/** + * Terminate the current Skein-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the Skein-512 context + * @param dst the destination buffer + */ +void sph_skein512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the Skein-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_skein512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_streebog.h b/sph/sph_streebog.h new file mode 100644 index 0000000..aa8f69d --- /dev/null +++ b/sph/sph_streebog.h @@ -0,0 +1,185 @@ +/* $Id: sph_gost.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * GOST interface. This is the interface for GOST R 12 with the + * recommended parameters for SHA-3, with output lengths 256 + * and 512 bits. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_gost.h + * @author Mish + */ + +#ifndef SPH_GOST_H__ +#define SPH_GOST_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include "sph_types.h" + +/** + * Output size (in bits) for GOST-256. + */ +#define SPH_SIZE_gost256 256 + +/** + * Output size (in bits) for GOST-512. + */ +#define SPH_SIZE_gost512 512 + +/** + * This structure is a context for Keccak computations: it contains the + * intermediate values and some data from the last entered block. Once a + * GOST computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running GOST computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ + +/** + * This structure is a context for Gost-256 computations. + */ + +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[32]; /* first field, for alignment */ + size_t ptr; + sph_u32 V[3][8]; +#endif +} sph_gost256_context; + +/** + * This structure is a context for Gost-512 computations. + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + size_t ptr; + sph_u32 V[5][8]; +#endif +} sph_gost512_context; + + +/** + * Initialize a GOST-256 context. This process performs no memory allocation. + * + * @param cc the GOST-256 context (pointer to a + * sph_gost256_context) + */ +void sph_gost256_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the Gost-256 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_gost256(void *cc, const void *data, size_t len); + +/** + * Terminate the current GOST-256 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (32 bytes). The context is automatically + * reinitialized. + * + * @param cc the GOST-256 context + * @param dst the destination buffer + */ +void sph_gost256_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (32 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the GOST-256 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_gost256_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +/** + * Initialize a Gost-512 context. This process performs no memory allocation. + * + * @param cc the GOST-512 context (pointer to a + * sph_gost512_context) + */ +void sph_gost512_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). + * + * @param cc the GOST-512 context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_gost512(void *cc, const void *data, size_t len); + +/** + * Terminate the current GOST-512 computation and output the result into + * the provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the GOST-512 context + * @param dst the destination buffer + */ +void sph_gost512_close(void *cc, void *dst); + +/** + * Add a few additional bits (0 to 7) to the current computation, then + * terminate it and output the result in the provided buffer, which must + * be wide enough to accomodate the result (64 bytes). If bit number i + * in ub has value 2^i, then the extra bits are those + * numbered 7 downto 8-n (this is the big-endian convention at the byte + * level). The context is automatically reinitialized. + * + * @param cc the GOST-512 context + * @param ub the extra bits + * @param n the number of extra bits (0 to 7) + * @param dst the destination buffer + */ +void sph_gost512_addbits_and_close( + void *cc, unsigned ub, unsigned n, void *dst); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sph/sph_types.h b/sph/sph_types.h new file mode 100644 index 0000000..7295b0b --- /dev/null +++ b/sph/sph_types.h @@ -0,0 +1,1976 @@ +/* $Id: sph_types.h 260 2011-07-21 01:02:38Z tp $ */ +/** + * Basic type definitions. + * + * This header file defines the generic integer types that will be used + * for the implementation of hash functions; it also contains helper + * functions which encode and decode multi-byte integer values, using + * either little-endian or big-endian conventions. + * + * This file contains a compile-time test on the size of a byte + * (the unsigned char C type). If bytes are not octets, + * i.e. if they do not have a size of exactly 8 bits, then compilation + * is aborted. Architectures where bytes are not octets are relatively + * rare, even in the embedded devices market. We forbid non-octet bytes + * because there is no clear convention on how octet streams are encoded + * on such systems. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_types.h + * @author Thomas Pornin + */ + +#ifndef SPH_TYPES_H__ +#define SPH_TYPES_H__ + +#include + +/* + * All our I/O functions are defined over octet streams. We do not know + * how to handle input data if bytes are not octets. + */ +#if CHAR_BIT != 8 +#error This code requires 8-bit bytes +#endif + +/* ============= BEGIN documentation block for Doxygen ============ */ + +#ifdef DOXYGEN_IGNORE + +/** @mainpage sphlib C code documentation + * + * @section overview Overview + * + * sphlib is a library which contains implementations of + * various cryptographic hash functions. These pages have been generated + * with doxygen and + * document the API for the C implementations. + * + * The API is described in appropriate header files, which are available + * in the "Files" section. Each hash function family has its own header, + * whose name begins with "sph_" and contains the family + * name. For instance, the API for the RIPEMD hash functions is available + * in the header file sph_ripemd.h. + * + * @section principles API structure and conventions + * + * @subsection io Input/output conventions + * + * In all generality, hash functions operate over strings of bits. + * Individual bits are rarely encountered in C programming or actual + * communication protocols; most protocols converge on the ubiquitous + * "octet" which is a group of eight bits. Data is thus expressed as a + * stream of octets. The C programming language contains the notion of a + * "byte", which is a data unit managed under the type "unsigned + * char". The C standard prescribes that a byte should hold at + * least eight bits, but possibly more. Most modern architectures, even + * in the embedded world, feature eight-bit bytes, i.e. map bytes to + * octets. + * + * Nevertheless, for some of the implemented hash functions, an extra + * API has been added, which allows the input of arbitrary sequences of + * bits: when the computation is about to be closed, 1 to 7 extra bits + * can be added. The functions for which this API is implemented include + * the SHA-2 functions and all SHA-3 candidates. + * + * sphlib defines hash function which may hash octet streams, + * i.e. streams of bits where the number of bits is a multiple of eight. + * The data input functions in the sphlib API expect data + * as anonymous pointers ("const void *") with a length + * (of type "size_t") which gives the input data chunk length + * in bytes. A byte is assumed to be an octet; the sph_types.h + * header contains a compile-time test which prevents compilation on + * architectures where this property is not met. + * + * The hash function output is also converted into bytes. All currently + * implemented hash functions have an output width which is a multiple of + * eight, and this is likely to remain true for new designs. + * + * Most hash functions internally convert input data into 32-bit of 64-bit + * words, using either little-endian or big-endian conversion. The hash + * output also often consists of such words, which are encoded into output + * bytes with a similar endianness convention. Some hash functions have + * been only loosely specified on that subject; when necessary, + * sphlib has been tested against published "reference" + * implementations in order to use the same conventions. + * + * @subsection shortname Function short name + * + * Each implemented hash function has a "short name" which is used + * internally to derive the identifiers for the functions and context + * structures which the function uses. For instance, MD5 has the short + * name "md5". Short names are listed in the next section, + * for the implemented hash functions. In subsequent sections, the + * short name will be assumed to be "XXX": replace with the + * actual hash function name to get the C identifier. + * + * Note: some functions within the same family share the same core + * elements, such as update function or context structure. Correspondingly, + * some of the defined types or functions may actually be macros which + * transparently evaluate to another type or function name. + * + * @subsection context Context structure + * + * Each implemented hash fonction has its own context structure, available + * under the type name "sph_XXX_context" for the hash function + * with short name "XXX". This structure holds all needed + * state for a running hash computation. + * + * The contents of these structures are meant to be opaque, and private + * to the implementation. However, these contents are specified in the + * header files so that application code which uses sphlib + * may access the size of those structures. + * + * The caller is responsible for allocating the context structure, + * whether by dynamic allocation (malloc() or equivalent), + * static allocation (a global permanent variable), as an automatic + * variable ("on the stack"), or by any other mean which ensures proper + * structure alignment. sphlib code performs no dynamic + * allocation by itself. + * + * The context must be initialized before use, using the + * sph_XXX_init() function. This function sets the context + * state to proper initial values for hashing. + * + * Since all state data is contained within the context structure, + * sphlib is thread-safe and reentrant: several hash + * computations may be performed in parallel, provided that they do not + * operate on the same context. Moreover, a running computation can be + * cloned by copying the context (with a simple memcpy()): + * the context and its clone are then independant and may be updated + * with new data and/or closed without interfering with each other. + * Similarly, a context structure can be moved in memory at will: + * context structures contain no pointer, in particular no pointer to + * themselves. + * + * @subsection dataio Data input + * + * Hashed data is input with the sph_XXX() fonction, which + * takes as parameters a pointer to the context, a pointer to the data + * to hash, and the number of data bytes to hash. The context is updated + * with the new data. + * + * Data can be input in one or several calls, with arbitrary input lengths. + * However, it is best, performance wise, to input data by relatively big + * chunks (say a few kilobytes), because this allows sphlib to + * optimize things and avoid internal copying. + * + * When all data has been input, the context can be closed with + * sph_XXX_close(). The hash output is computed and written + * into the provided buffer. The caller must take care to provide a + * buffer of appropriate length; e.g., when using SHA-1, the output is + * a 20-byte word, therefore the output buffer must be at least 20-byte + * long. + * + * For some hash functions, the sph_XXX_addbits_and_close() + * function can be used instead of sph_XXX_close(). This + * function can take a few extra bits to be added at + * the end of the input message. This allows hashing messages with a + * bit length which is not a multiple of 8. The extra bits are provided + * as an unsigned integer value, and a bit count. The bit count must be + * between 0 and 7, inclusive. The extra bits are provided as bits 7 to + * 0 (bits of numerical value 128, 64, 32... downto 0), in that order. + * For instance, to add three bits of value 1, 1 and 0, the unsigned + * integer will have value 192 (1*128 + 1*64 + 0*32) and the bit count + * will be 3. + * + * The SPH_SIZE_XXX macro is defined for each hash function; + * it evaluates to the function output size, expressed in bits. For instance, + * SPH_SIZE_sha1 evaluates to 160. + * + * When closed, the context is automatically reinitialized and can be + * immediately used for another computation. It is not necessary to call + * sph_XXX_init() after a close. Note that + * sph_XXX_init() can still be called to "reset" a context, + * i.e. forget previously input data, and get back to the initial state. + * + * @subsection alignment Data alignment + * + * "Alignment" is a property of data, which is said to be "properly + * aligned" when its emplacement in memory is such that the data can + * be optimally read by full words. This depends on the type of access; + * basically, some hash functions will read data by 32-bit or 64-bit + * words. sphlib does not mandate such alignment for input + * data, but using aligned data can substantially improve performance. + * + * As a rule, it is best to input data by chunks whose length (in bytes) + * is a multiple of eight, and which begins at "generally aligned" + * addresses, such as the base address returned by a call to + * malloc(). + * + * @section functions Implemented functions + * + * We give here the list of implemented functions. They are grouped by + * family; to each family corresponds a specific header file. Each + * individual function has its associated "short name". Please refer to + * the documentation for that header file to get details on the hash + * function denomination and provenance. + * + * Note: the functions marked with a '(64)' in the list below are + * available only if the C compiler provides an integer type of length + * 64 bits or more. Such a type is mandatory in the latest C standard + * (ISO 9899:1999, aka "C99") and is present in several older compilers + * as well, so chances are that such a type is available. + * + * - HAVAL family: file sph_haval.h + * - HAVAL-128/3 (128-bit, 3 passes): short name: haval128_3 + * - HAVAL-128/4 (128-bit, 4 passes): short name: haval128_4 + * - HAVAL-128/5 (128-bit, 5 passes): short name: haval128_5 + * - HAVAL-160/3 (160-bit, 3 passes): short name: haval160_3 + * - HAVAL-160/4 (160-bit, 4 passes): short name: haval160_4 + * - HAVAL-160/5 (160-bit, 5 passes): short name: haval160_5 + * - HAVAL-192/3 (192-bit, 3 passes): short name: haval192_3 + * - HAVAL-192/4 (192-bit, 4 passes): short name: haval192_4 + * - HAVAL-192/5 (192-bit, 5 passes): short name: haval192_5 + * - HAVAL-224/3 (224-bit, 3 passes): short name: haval224_3 + * - HAVAL-224/4 (224-bit, 4 passes): short name: haval224_4 + * - HAVAL-224/5 (224-bit, 5 passes): short name: haval224_5 + * - HAVAL-256/3 (256-bit, 3 passes): short name: haval256_3 + * - HAVAL-256/4 (256-bit, 4 passes): short name: haval256_4 + * - HAVAL-256/5 (256-bit, 5 passes): short name: haval256_5 + * - MD2: file sph_md2.h, short name: md2 + * - MD4: file sph_md4.h, short name: md4 + * - MD5: file sph_md5.h, short name: md5 + * - PANAMA: file sph_panama.h, short name: panama + * - RadioGatun family: file sph_radiogatun.h + * - RadioGatun[32]: short name: radiogatun32 + * - RadioGatun[64]: short name: radiogatun64 (64) + * - RIPEMD family: file sph_ripemd.h + * - RIPEMD: short name: ripemd + * - RIPEMD-128: short name: ripemd128 + * - RIPEMD-160: short name: ripemd160 + * - SHA-0: file sph_sha0.h, short name: sha0 + * - SHA-1: file sph_sha1.h, short name: sha1 + * - SHA-2 family, 32-bit hashes: file sph_sha2.h + * - SHA-224: short name: sha224 + * - SHA-256: short name: sha256 + * - SHA-384: short name: sha384 (64) + * - SHA-512: short name: sha512 (64) + * - Tiger family: file sph_tiger.h + * - Tiger: short name: tiger (64) + * - Tiger2: short name: tiger2 (64) + * - WHIRLPOOL family: file sph_whirlpool.h + * - WHIRLPOOL-0: short name: whirlpool0 (64) + * - WHIRLPOOL-1: short name: whirlpool1 (64) + * - WHIRLPOOL: short name: whirlpool (64) + * + * The fourteen second-round SHA-3 candidates are also implemented; + * when applicable, the implementations follow the "final" specifications + * as published for the third round of the SHA-3 competition (BLAKE, + * Groestl, JH, Keccak and Skein have been tweaked for third round). + * + * - BLAKE family: file sph_blake.h + * - BLAKE-224: short name: blake224 + * - BLAKE-256: short name: blake256 + * - BLAKE-384: short name: blake384 + * - BLAKE-512: short name: blake512 + * - BMW (Blue Midnight Wish) family: file sph_bmw.h + * - BMW-224: short name: bmw224 + * - BMW-256: short name: bmw256 + * - BMW-384: short name: bmw384 (64) + * - BMW-512: short name: bmw512 (64) + * - CubeHash family: file sph_cubehash.h (specified as + * CubeHash16/32 in the CubeHash specification) + * - CubeHash-224: short name: cubehash224 + * - CubeHash-256: short name: cubehash256 + * - CubeHash-384: short name: cubehash384 + * - CubeHash-512: short name: cubehash512 + * - ECHO family: file sph_echo.h + * - ECHO-224: short name: echo224 + * - ECHO-256: short name: echo256 + * - ECHO-384: short name: echo384 + * - ECHO-512: short name: echo512 + * - Fugue family: file sph_fugue.h + * - Fugue-224: short name: fugue224 + * - Fugue-256: short name: fugue256 + * - Fugue-384: short name: fugue384 + * - Fugue-512: short name: fugue512 + * - Groestl family: file sph_groestl.h + * - Groestl-224: short name: groestl224 + * - Groestl-256: short name: groestl256 + * - Groestl-384: short name: groestl384 + * - Groestl-512: short name: groestl512 + * - Hamsi family: file sph_hamsi.h + * - Hamsi-224: short name: hamsi224 + * - Hamsi-256: short name: hamsi256 + * - Hamsi-384: short name: hamsi384 + * - Hamsi-512: short name: hamsi512 + * - JH family: file sph_jh.h + * - JH-224: short name: jh224 + * - JH-256: short name: jh256 + * - JH-384: short name: jh384 + * - JH-512: short name: jh512 + * - Keccak family: file sph_keccak.h + * - Keccak-224: short name: keccak224 + * - Keccak-256: short name: keccak256 + * - Keccak-384: short name: keccak384 + * - Keccak-512: short name: keccak512 + * - Luffa family: file sph_luffa.h + * - Luffa-224: short name: luffa224 + * - Luffa-256: short name: luffa256 + * - Luffa-384: short name: luffa384 + * - Luffa-512: short name: luffa512 + * - Shabal family: file sph_shabal.h + * - Shabal-192: short name: shabal192 + * - Shabal-224: short name: shabal224 + * - Shabal-256: short name: shabal256 + * - Shabal-384: short name: shabal384 + * - Shabal-512: short name: shabal512 + * - SHAvite-3 family: file sph_shavite.h + * - SHAvite-224 (nominally "SHAvite-3 with 224-bit output"): + * short name: shabal224 + * - SHAvite-256 (nominally "SHAvite-3 with 256-bit output"): + * short name: shabal256 + * - SHAvite-384 (nominally "SHAvite-3 with 384-bit output"): + * short name: shabal384 + * - SHAvite-512 (nominally "SHAvite-3 with 512-bit output"): + * short name: shabal512 + * - SIMD family: file sph_simd.h + * - SIMD-224: short name: simd224 + * - SIMD-256: short name: simd256 + * - SIMD-384: short name: simd384 + * - SIMD-512: short name: simd512 + * - Skein family: file sph_skein.h + * - Skein-224 (nominally specified as Skein-512-224): short name: + * skein224 (64) + * - Skein-256 (nominally specified as Skein-512-256): short name: + * skein256 (64) + * - Skein-384 (nominally specified as Skein-512-384): short name: + * skein384 (64) + * - Skein-512 (nominally specified as Skein-512-512): short name: + * skein512 (64) + * + * For the second-round SHA-3 candidates, the functions are as specified + * for round 2, i.e. with the "tweaks" that some candidates added + * between round 1 and round 2. Also, some of the submitted packages for + * round 2 contained errors, in the specification, reference code, or + * both. sphlib implements the corrected versions. + */ + +/** @hideinitializer + * Unsigned integer type whose length is at least 32 bits; on most + * architectures, it will have a width of exactly 32 bits. Unsigned C + * types implement arithmetics modulo a power of 2; use the + * SPH_T32() macro to ensure that the value is truncated + * to exactly 32 bits. Unless otherwise specified, all macros and + * functions which accept sph_u32 values assume that these + * values fit on 32 bits, i.e. do not exceed 2^32-1, even on architectures + * where sph_u32 is larger than that. + */ +typedef __arch_dependant__ sph_u32; + +/** @hideinitializer + * Signed integer type corresponding to sph_u32; it has + * width 32 bits or more. + */ +typedef __arch_dependant__ sph_s32; + +/** @hideinitializer + * Unsigned integer type whose length is at least 64 bits; on most + * architectures which feature such a type, it will have a width of + * exactly 64 bits. C99-compliant platform will have this type; it + * is also defined when the GNU compiler (gcc) is used, and on + * platforms where unsigned long is large enough. If this + * type is not available, then some hash functions which depends on + * a 64-bit type will not be available (most notably SHA-384, SHA-512, + * Tiger and WHIRLPOOL). + */ +typedef __arch_dependant__ sph_u64; + +/** @hideinitializer + * Signed integer type corresponding to sph_u64; it has + * width 64 bits or more. + */ +typedef __arch_dependant__ sph_s64; + +/** + * This macro expands the token x into a suitable + * constant expression of type sph_u32. Depending on + * how this type is defined, a suffix such as UL may + * be appended to the argument. + * + * @param x the token to expand into a suitable constant expression + */ +#define SPH_C32(x) + +/** + * Truncate a 32-bit value to exactly 32 bits. On most systems, this is + * a no-op, recognized as such by the compiler. + * + * @param x the value to truncate (of type sph_u32) + */ +#define SPH_T32(x) + +/** + * Rotate a 32-bit value by a number of bits to the left. The rotate + * count must reside between 1 and 31. This macro assumes that its + * first argument fits in 32 bits (no extra bit allowed on machines where + * sph_u32 is wider); both arguments may be evaluated + * several times. + * + * @param x the value to rotate (of type sph_u32) + * @param n the rotation count (between 1 and 31, inclusive) + */ +#define SPH_ROTL32(x, n) + +/** + * Rotate a 32-bit value by a number of bits to the left. The rotate + * count must reside between 1 and 31. This macro assumes that its + * first argument fits in 32 bits (no extra bit allowed on machines where + * sph_u32 is wider); both arguments may be evaluated + * several times. + * + * @param x the value to rotate (of type sph_u32) + * @param n the rotation count (between 1 and 31, inclusive) + */ +#define SPH_ROTR32(x, n) + +/** + * This macro is defined on systems for which a 64-bit type has been + * detected, and is used for sph_u64. + */ +#define SPH_64 + +/** + * This macro is defined on systems for the "native" integer size is + * 64 bits (64-bit values fit in one register). + */ +#define SPH_64_TRUE + +/** + * This macro expands the token x into a suitable + * constant expression of type sph_u64. Depending on + * how this type is defined, a suffix such as ULL may + * be appended to the argument. This macro is defined only if a + * 64-bit type was detected and used for sph_u64. + * + * @param x the token to expand into a suitable constant expression + */ +#define SPH_C64(x) + +/** + * Truncate a 64-bit value to exactly 64 bits. On most systems, this is + * a no-op, recognized as such by the compiler. This macro is defined only + * if a 64-bit type was detected and used for sph_u64. + * + * @param x the value to truncate (of type sph_u64) + */ +#define SPH_T64(x) + +/** + * Rotate a 64-bit value by a number of bits to the left. The rotate + * count must reside between 1 and 63. This macro assumes that its + * first argument fits in 64 bits (no extra bit allowed on machines where + * sph_u64 is wider); both arguments may be evaluated + * several times. This macro is defined only if a 64-bit type was detected + * and used for sph_u64. + * + * @param x the value to rotate (of type sph_u64) + * @param n the rotation count (between 1 and 63, inclusive) + */ +#define SPH_ROTL64(x, n) + +/** + * Rotate a 64-bit value by a number of bits to the left. The rotate + * count must reside between 1 and 63. This macro assumes that its + * first argument fits in 64 bits (no extra bit allowed on machines where + * sph_u64 is wider); both arguments may be evaluated + * several times. This macro is defined only if a 64-bit type was detected + * and used for sph_u64. + * + * @param x the value to rotate (of type sph_u64) + * @param n the rotation count (between 1 and 63, inclusive) + */ +#define SPH_ROTR64(x, n) + +/** + * This macro evaluates to inline or an equivalent construction, + * if available on the compilation platform, or to nothing otherwise. This + * is used to declare inline functions, for which the compiler should + * endeavour to include the code directly in the caller. Inline functions + * are typically defined in header files as replacement for macros. + */ +#define SPH_INLINE + +/** + * This macro is defined if the platform has been detected as using + * little-endian convention. This implies that the sph_u32 + * type (and the sph_u64 type also, if it is defined) has + * an exact width (i.e. exactly 32-bit, respectively 64-bit). + */ +#define SPH_LITTLE_ENDIAN + +/** + * This macro is defined if the platform has been detected as using + * big-endian convention. This implies that the sph_u32 + * type (and the sph_u64 type also, if it is defined) has + * an exact width (i.e. exactly 32-bit, respectively 64-bit). + */ +#define SPH_BIG_ENDIAN + +/** + * This macro is defined if 32-bit words (and 64-bit words, if defined) + * can be read from and written to memory efficiently in little-endian + * convention. This is the case for little-endian platforms, and also + * for the big-endian platforms which have special little-endian access + * opcodes (e.g. Ultrasparc). + */ +#define SPH_LITTLE_FAST + +/** + * This macro is defined if 32-bit words (and 64-bit words, if defined) + * can be read from and written to memory efficiently in big-endian + * convention. This is the case for little-endian platforms, and also + * for the little-endian platforms which have special big-endian access + * opcodes. + */ +#define SPH_BIG_FAST + +/** + * On some platforms, this macro is defined to an unsigned integer type + * into which pointer values may be cast. The resulting value can then + * be tested for being a multiple of 2, 4 or 8, indicating an aligned + * pointer for, respectively, 16-bit, 32-bit or 64-bit memory accesses. + */ +#define SPH_UPTR + +/** + * When defined, this macro indicates that unaligned memory accesses + * are possible with only a minor penalty, and thus should be prefered + * over strategies which first copy data to an aligned buffer. + */ +#define SPH_UNALIGNED + +/** + * Byte-swap a 32-bit word (i.e. 0x12345678 becomes + * 0x78563412). This is an inline function which resorts + * to inline assembly on some platforms, for better performance. + * + * @param x the 32-bit value to byte-swap + * @return the byte-swapped value + */ +static inline sph_u32 sph_bswap32(sph_u32 x); + +/** + * Byte-swap a 64-bit word. This is an inline function which resorts + * to inline assembly on some platforms, for better performance. This + * function is defined only if a suitable 64-bit type was found for + * sph_u64 + * + * @param x the 64-bit value to byte-swap + * @return the byte-swapped value + */ +static inline sph_u64 sph_bswap64(sph_u64 x); + +/** + * Decode a 16-bit unsigned value from memory, in little-endian convention + * (least significant byte comes first). + * + * @param src the source address + * @return the decoded value + */ +static inline unsigned sph_dec16le(const void *src); + +/** + * Encode a 16-bit unsigned value into memory, in little-endian convention + * (least significant byte comes first). + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc16le(void *dst, unsigned val); + +/** + * Decode a 16-bit unsigned value from memory, in big-endian convention + * (most significant byte comes first). + * + * @param src the source address + * @return the decoded value + */ +static inline unsigned sph_dec16be(const void *src); + +/** + * Encode a 16-bit unsigned value into memory, in big-endian convention + * (most significant byte comes first). + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc16be(void *dst, unsigned val); + +/** + * Decode a 32-bit unsigned value from memory, in little-endian convention + * (least significant byte comes first). + * + * @param src the source address + * @return the decoded value + */ +static inline sph_u32 sph_dec32le(const void *src); + +/** + * Decode a 32-bit unsigned value from memory, in little-endian convention + * (least significant byte comes first). This function assumes that the + * source address is suitably aligned for a direct access, if the platform + * supports such things; it can thus be marginally faster than the generic + * sph_dec32le() function. + * + * @param src the source address + * @return the decoded value + */ +static inline sph_u32 sph_dec32le_aligned(const void *src); + +/** + * Encode a 32-bit unsigned value into memory, in little-endian convention + * (least significant byte comes first). + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc32le(void *dst, sph_u32 val); + +/** + * Encode a 32-bit unsigned value into memory, in little-endian convention + * (least significant byte comes first). This function assumes that the + * destination address is suitably aligned for a direct access, if the + * platform supports such things; it can thus be marginally faster than + * the generic sph_enc32le() function. + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc32le_aligned(void *dst, sph_u32 val); + +/** + * Decode a 32-bit unsigned value from memory, in big-endian convention + * (most significant byte comes first). + * + * @param src the source address + * @return the decoded value + */ +static inline sph_u32 sph_dec32be(const void *src); + +/** + * Decode a 32-bit unsigned value from memory, in big-endian convention + * (most significant byte comes first). This function assumes that the + * source address is suitably aligned for a direct access, if the platform + * supports such things; it can thus be marginally faster than the generic + * sph_dec32be() function. + * + * @param src the source address + * @return the decoded value + */ +static inline sph_u32 sph_dec32be_aligned(const void *src); + +/** + * Encode a 32-bit unsigned value into memory, in big-endian convention + * (most significant byte comes first). + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc32be(void *dst, sph_u32 val); + +/** + * Encode a 32-bit unsigned value into memory, in big-endian convention + * (most significant byte comes first). This function assumes that the + * destination address is suitably aligned for a direct access, if the + * platform supports such things; it can thus be marginally faster than + * the generic sph_enc32be() function. + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc32be_aligned(void *dst, sph_u32 val); + +/** + * Decode a 64-bit unsigned value from memory, in little-endian convention + * (least significant byte comes first). This function is defined only + * if a suitable 64-bit type was detected and used for sph_u64. + * + * @param src the source address + * @return the decoded value + */ +static inline sph_u64 sph_dec64le(const void *src); + +/** + * Decode a 64-bit unsigned value from memory, in little-endian convention + * (least significant byte comes first). This function assumes that the + * source address is suitably aligned for a direct access, if the platform + * supports such things; it can thus be marginally faster than the generic + * sph_dec64le() function. This function is defined only + * if a suitable 64-bit type was detected and used for sph_u64. + * + * @param src the source address + * @return the decoded value + */ +static inline sph_u64 sph_dec64le_aligned(const void *src); + +/** + * Encode a 64-bit unsigned value into memory, in little-endian convention + * (least significant byte comes first). This function is defined only + * if a suitable 64-bit type was detected and used for sph_u64. + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc64le(void *dst, sph_u64 val); + +/** + * Encode a 64-bit unsigned value into memory, in little-endian convention + * (least significant byte comes first). This function assumes that the + * destination address is suitably aligned for a direct access, if the + * platform supports such things; it can thus be marginally faster than + * the generic sph_enc64le() function. This function is defined + * only if a suitable 64-bit type was detected and used for + * sph_u64. + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc64le_aligned(void *dst, sph_u64 val); + +/** + * Decode a 64-bit unsigned value from memory, in big-endian convention + * (most significant byte comes first). This function is defined only + * if a suitable 64-bit type was detected and used for sph_u64. + * + * @param src the source address + * @return the decoded value + */ +static inline sph_u64 sph_dec64be(const void *src); + +/** + * Decode a 64-bit unsigned value from memory, in big-endian convention + * (most significant byte comes first). This function assumes that the + * source address is suitably aligned for a direct access, if the platform + * supports such things; it can thus be marginally faster than the generic + * sph_dec64be() function. This function is defined only + * if a suitable 64-bit type was detected and used for sph_u64. + * + * @param src the source address + * @return the decoded value + */ +static inline sph_u64 sph_dec64be_aligned(const void *src); + +/** + * Encode a 64-bit unsigned value into memory, in big-endian convention + * (most significant byte comes first). This function is defined only + * if a suitable 64-bit type was detected and used for sph_u64. + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc64be(void *dst, sph_u64 val); + +/** + * Encode a 64-bit unsigned value into memory, in big-endian convention + * (most significant byte comes first). This function assumes that the + * destination address is suitably aligned for a direct access, if the + * platform supports such things; it can thus be marginally faster than + * the generic sph_enc64be() function. This function is defined + * only if a suitable 64-bit type was detected and used for + * sph_u64. + * + * @param dst the destination buffer + * @param val the value to encode + */ +static inline void sph_enc64be_aligned(void *dst, sph_u64 val); + +#endif + +/* ============== END documentation block for Doxygen ============= */ + +#ifndef DOXYGEN_IGNORE + +/* + * We want to define the types "sph_u32" and "sph_u64" which hold + * unsigned values of at least, respectively, 32 and 64 bits. These + * tests should select appropriate types for most platforms. The + * macro "SPH_64" is defined if the 64-bit is supported. + */ + +#undef SPH_64 +#undef SPH_64_TRUE + +#if defined __STDC__ && __STDC_VERSION__ >= 199901L + +/* + * On C99 implementations, we can use to get an exact 64-bit + * type, if any, or otherwise use a wider type (which must exist, for + * C99 conformance). + */ + +#include + +#ifdef UINT32_MAX +typedef uint32_t sph_u32; +typedef int32_t sph_s32; +#else +typedef uint_fast32_t sph_u32; +typedef int_fast32_t sph_s32; +#endif +#if !SPH_NO_64 +#ifdef UINT64_MAX +typedef uint64_t sph_u64; +typedef int64_t sph_s64; +#else +typedef uint_fast64_t sph_u64; +typedef int_fast64_t sph_s64; +#endif +#endif + +#define SPH_C32(x) ((sph_u32)(x)) +#if !SPH_NO_64 +#define SPH_C64(x) ((sph_u64)(x)) +#define SPH_64 1 +#endif + +#else + +/* + * On non-C99 systems, we use "unsigned int" if it is wide enough, + * "unsigned long" otherwise. This supports all "reasonable" architectures. + * We have to be cautious: pre-C99 preprocessors handle constants + * differently in '#if' expressions. Hence the shifts to test UINT_MAX. + */ + +#if ((UINT_MAX >> 11) >> 11) >= 0x3FF + +typedef unsigned int sph_u32; +typedef int sph_s32; + +#define SPH_C32(x) ((sph_u32)(x ## U)) + +#else + +typedef unsigned long sph_u32; +typedef long sph_s32; + +#define SPH_C32(x) ((sph_u32)(x ## UL)) + +#endif + +#if !SPH_NO_64 + +/* + * We want a 64-bit type. We use "unsigned long" if it is wide enough (as + * is common on 64-bit architectures such as AMD64, Alpha or Sparcv9), + * "unsigned long long" otherwise, if available. We use ULLONG_MAX to + * test whether "unsigned long long" is available; we also know that + * gcc features this type, even if the libc header do not know it. + */ + +#if ((ULONG_MAX >> 31) >> 31) >= 3 + +typedef unsigned long sph_u64; +typedef long sph_s64; + +#define SPH_C64(x) ((sph_u64)(x ## UL)) + +#define SPH_64 1 + +#elif ((ULLONG_MAX >> 31) >> 31) >= 3 || defined __GNUC__ + +typedef unsigned long long sph_u64; +typedef long long sph_s64; + +#define SPH_C64(x) ((sph_u64)(x ## ULL)) + +#define SPH_64 1 + +#else + +/* + * No 64-bit type... + */ + +#endif + +#endif + +#endif + +/* + * If the "unsigned long" type has length 64 bits or more, then this is + * a "true" 64-bit architectures. This is also true with Visual C on + * amd64, even though the "long" type is limited to 32 bits. + */ +#if SPH_64 && (((ULONG_MAX >> 31) >> 31) >= 3 || defined _M_X64) +#define SPH_64_TRUE 1 +#endif + +/* + * Implementation note: some processors have specific opcodes to perform + * a rotation. Recent versions of gcc recognize the expression above and + * use the relevant opcodes, when appropriate. + */ + +#define SPH_T32(x) ((x) & SPH_C32(0xFFFFFFFF)) +#define SPH_ROTL32(x, n) SPH_T32(((x) << (n)) | ((x) >> (32 - (n)))) +#define SPH_ROTR32(x, n) SPH_ROTL32(x, (32 - (n))) + +#if SPH_64 + +#define SPH_T64(x) ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF)) +#define SPH_ROTL64(x, n) SPH_T64(((x) << (n)) | ((x) >> (64 - (n)))) +#define SPH_ROTR64(x, n) SPH_ROTL64(x, (64 - (n))) + +#endif + +#ifndef DOXYGEN_IGNORE +/* + * Define SPH_INLINE to be an "inline" qualifier, if available. We define + * some small macro-like functions which benefit greatly from being inlined. + */ +#if (defined __STDC__ && __STDC_VERSION__ >= 199901L) || defined __GNUC__ +#define SPH_INLINE inline +#elif defined _MSC_VER +#define SPH_INLINE __inline +#else +#define SPH_INLINE +#endif +#endif + +/* + * We define some macros which qualify the architecture. These macros + * may be explicit set externally (e.g. as compiler parameters). The + * code below sets those macros if they are not already defined. + * + * Most macros are boolean, thus evaluate to either zero or non-zero. + * The SPH_UPTR macro is special, in that it evaluates to a C type, + * or is not defined. + * + * SPH_UPTR if defined: unsigned type to cast pointers into + * + * SPH_UNALIGNED non-zero if unaligned accesses are efficient + * SPH_LITTLE_ENDIAN non-zero if architecture is known to be little-endian + * SPH_BIG_ENDIAN non-zero if architecture is known to be big-endian + * SPH_LITTLE_FAST non-zero if little-endian decoding is fast + * SPH_BIG_FAST non-zero if big-endian decoding is fast + * + * If SPH_UPTR is defined, then encoding and decoding of 32-bit and 64-bit + * values will try to be "smart". Either SPH_LITTLE_ENDIAN or SPH_BIG_ENDIAN + * _must_ be non-zero in those situations. The 32-bit and 64-bit types + * _must_ also have an exact width. + * + * SPH_SPARCV9_GCC_32 UltraSPARC-compatible with gcc, 32-bit mode + * SPH_SPARCV9_GCC_64 UltraSPARC-compatible with gcc, 64-bit mode + * SPH_SPARCV9_GCC UltraSPARC-compatible with gcc + * SPH_I386_GCC x86-compatible (32-bit) with gcc + * SPH_I386_MSVC x86-compatible (32-bit) with Microsoft Visual C + * SPH_AMD64_GCC x86-compatible (64-bit) with gcc + * SPH_AMD64_MSVC x86-compatible (64-bit) with Microsoft Visual C + * SPH_PPC32_GCC PowerPC, 32-bit, with gcc + * SPH_PPC64_GCC PowerPC, 64-bit, with gcc + * + * TODO: enhance automatic detection, for more architectures and compilers. + * Endianness is the most important. SPH_UNALIGNED and SPH_UPTR help with + * some very fast functions (e.g. MD4) when using unaligned input data. + * The CPU-specific-with-GCC macros are useful only for inline assembly, + * normally restrained to this header file. + */ + +/* + * 32-bit x86, aka "i386 compatible". + */ +#if defined __i386__ || defined _M_IX86 + +#define SPH_DETECT_UNALIGNED 1 +#define SPH_DETECT_LITTLE_ENDIAN 1 +#define SPH_DETECT_UPTR sph_u32 +#ifdef __GNUC__ +#define SPH_DETECT_I386_GCC 1 +#endif +#ifdef _MSC_VER +#define SPH_DETECT_I386_MSVC 1 +#endif + +/* + * 64-bit x86, hereafter known as "amd64". + */ +#elif defined __x86_64 || defined _M_X64 + +#define SPH_DETECT_UNALIGNED 1 +#define SPH_DETECT_LITTLE_ENDIAN 1 +#define SPH_DETECT_UPTR sph_u64 +#ifdef __GNUC__ +#define SPH_DETECT_AMD64_GCC 1 +#endif +#ifdef _MSC_VER +#define SPH_DETECT_AMD64_MSVC 1 +#endif + +/* + * 64-bit Sparc architecture (implies v9). + */ +#elif ((defined __sparc__ || defined __sparc) && defined __arch64__) \ + || defined __sparcv9 + +#define SPH_DETECT_BIG_ENDIAN 1 +#define SPH_DETECT_UPTR sph_u64 +#ifdef __GNUC__ +#define SPH_DETECT_SPARCV9_GCC_64 1 +#define SPH_DETECT_LITTLE_FAST 1 +#endif + +/* + * 32-bit Sparc. + */ +#elif (defined __sparc__ || defined __sparc) \ + && !(defined __sparcv9 || defined __arch64__) + +#define SPH_DETECT_BIG_ENDIAN 1 +#define SPH_DETECT_UPTR sph_u32 +#if defined __GNUC__ && defined __sparc_v9__ +#define SPH_DETECT_SPARCV9_GCC_32 1 +#define SPH_DETECT_LITTLE_FAST 1 +#endif + +/* + * ARM, little-endian. + */ +#elif defined __arm__ && __ARMEL__ + +#define SPH_DETECT_LITTLE_ENDIAN 1 + +/* + * MIPS, little-endian. + */ +#elif MIPSEL || _MIPSEL || __MIPSEL || __MIPSEL__ + +#define SPH_DETECT_LITTLE_ENDIAN 1 + +/* + * MIPS, big-endian. + */ +#elif MIPSEB || _MIPSEB || __MIPSEB || __MIPSEB__ + +#define SPH_DETECT_BIG_ENDIAN 1 + +/* + * PowerPC. + */ +#elif defined __powerpc__ || defined __POWERPC__ || defined __ppc__ \ + || defined _ARCH_PPC + +/* + * Note: we do not declare cross-endian access to be "fast": even if + * using inline assembly, implementation should still assume that + * keeping the decoded word in a temporary is faster than decoding + * it again. + */ +#if defined __GNUC__ +#if SPH_64_TRUE +#define SPH_DETECT_PPC64_GCC 1 +#else +#define SPH_DETECT_PPC32_GCC 1 +#endif +#endif + +#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN +#define SPH_DETECT_BIG_ENDIAN 1 +#elif defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN +#define SPH_DETECT_LITTLE_ENDIAN 1 +#endif + +/* + * Itanium, 64-bit. + */ +#elif defined __ia64 || defined __ia64__ \ + || defined __itanium__ || defined _M_IA64 + +#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN +#define SPH_DETECT_BIG_ENDIAN 1 +#else +#define SPH_DETECT_LITTLE_ENDIAN 1 +#endif +#if defined __LP64__ || defined _LP64 +#define SPH_DETECT_UPTR sph_u64 +#else +#define SPH_DETECT_UPTR sph_u32 +#endif + +#endif + +#if defined SPH_DETECT_SPARCV9_GCC_32 || defined SPH_DETECT_SPARCV9_GCC_64 +#define SPH_DETECT_SPARCV9_GCC 1 +#endif + +#if defined SPH_DETECT_UNALIGNED && !defined SPH_UNALIGNED +#define SPH_UNALIGNED SPH_DETECT_UNALIGNED +#endif +#if defined SPH_DETECT_UPTR && !defined SPH_UPTR +#define SPH_UPTR SPH_DETECT_UPTR +#endif +#if defined SPH_DETECT_LITTLE_ENDIAN && !defined SPH_LITTLE_ENDIAN +#define SPH_LITTLE_ENDIAN SPH_DETECT_LITTLE_ENDIAN +#endif +#if defined SPH_DETECT_BIG_ENDIAN && !defined SPH_BIG_ENDIAN +#define SPH_BIG_ENDIAN SPH_DETECT_BIG_ENDIAN +#endif +#if defined SPH_DETECT_LITTLE_FAST && !defined SPH_LITTLE_FAST +#define SPH_LITTLE_FAST SPH_DETECT_LITTLE_FAST +#endif +#if defined SPH_DETECT_BIG_FAST && !defined SPH_BIG_FAST +#define SPH_BIG_FAST SPH_DETECT_BIG_FAST +#endif +#if defined SPH_DETECT_SPARCV9_GCC_32 && !defined SPH_SPARCV9_GCC_32 +#define SPH_SPARCV9_GCC_32 SPH_DETECT_SPARCV9_GCC_32 +#endif +#if defined SPH_DETECT_SPARCV9_GCC_64 && !defined SPH_SPARCV9_GCC_64 +#define SPH_SPARCV9_GCC_64 SPH_DETECT_SPARCV9_GCC_64 +#endif +#if defined SPH_DETECT_SPARCV9_GCC && !defined SPH_SPARCV9_GCC +#define SPH_SPARCV9_GCC SPH_DETECT_SPARCV9_GCC +#endif +#if defined SPH_DETECT_I386_GCC && !defined SPH_I386_GCC +#define SPH_I386_GCC SPH_DETECT_I386_GCC +#endif +#if defined SPH_DETECT_I386_MSVC && !defined SPH_I386_MSVC +#define SPH_I386_MSVC SPH_DETECT_I386_MSVC +#endif +#if defined SPH_DETECT_AMD64_GCC && !defined SPH_AMD64_GCC +#define SPH_AMD64_GCC SPH_DETECT_AMD64_GCC +#endif +#if defined SPH_DETECT_AMD64_MSVC && !defined SPH_AMD64_MSVC +#define SPH_AMD64_MSVC SPH_DETECT_AMD64_MSVC +#endif +#if defined SPH_DETECT_PPC32_GCC && !defined SPH_PPC32_GCC +#define SPH_PPC32_GCC SPH_DETECT_PPC32_GCC +#endif +#if defined SPH_DETECT_PPC64_GCC && !defined SPH_PPC64_GCC +#define SPH_PPC64_GCC SPH_DETECT_PPC64_GCC +#endif + +#if SPH_LITTLE_ENDIAN && !defined SPH_LITTLE_FAST +#define SPH_LITTLE_FAST 1 +#endif +#if SPH_BIG_ENDIAN && !defined SPH_BIG_FAST +#define SPH_BIG_FAST 1 +#endif + +#if defined SPH_UPTR && !(SPH_LITTLE_ENDIAN || SPH_BIG_ENDIAN) +#error SPH_UPTR defined, but endianness is not known. +#endif + +#if SPH_I386_GCC && !SPH_NO_ASM + +/* + * On x86 32-bit, with gcc, we use the bswapl opcode to byte-swap 32-bit + * values. + */ + +static SPH_INLINE sph_u32 +sph_bswap32(sph_u32 x) +{ + __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x)); + return x; +} + +#if SPH_64 + +static SPH_INLINE sph_u64 +sph_bswap64(sph_u64 x) +{ + return ((sph_u64)sph_bswap32((sph_u32)x) << 32) + | (sph_u64)sph_bswap32((sph_u32)(x >> 32)); +} + +#endif + +#elif SPH_AMD64_GCC && !SPH_NO_ASM + +/* + * On x86 64-bit, with gcc, we use the bswapl opcode to byte-swap 32-bit + * and 64-bit values. + */ + +static SPH_INLINE sph_u32 +sph_bswap32(sph_u32 x) +{ + __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x)); + return x; +} + +#if SPH_64 + +static SPH_INLINE sph_u64 +sph_bswap64(sph_u64 x) +{ + __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x)); + return x; +} + +#endif + +/* + * Disabled code. Apparently, Microsoft Visual C 2005 is smart enough + * to generate proper opcodes for endianness swapping with the pure C + * implementation below. + * + +#elif SPH_I386_MSVC && !SPH_NO_ASM + +static __inline sph_u32 __declspec(naked) __fastcall +sph_bswap32(sph_u32 x) +{ + __asm { + bswap ecx + mov eax,ecx + ret + } +} + +#if SPH_64 + +static SPH_INLINE sph_u64 +sph_bswap64(sph_u64 x) +{ + return ((sph_u64)sph_bswap32((sph_u32)x) << 32) + | (sph_u64)sph_bswap32((sph_u32)(x >> 32)); +} + +#endif + + * + * [end of disabled code] + */ + +#else + +static SPH_INLINE sph_u32 +sph_bswap32(sph_u32 x) +{ + x = SPH_T32((x << 16) | (x >> 16)); + x = ((x & SPH_C32(0xFF00FF00)) >> 8) + | ((x & SPH_C32(0x00FF00FF)) << 8); + return x; +} + +#if SPH_64 + +/** + * Byte-swap a 64-bit value. + * + * @param x the input value + * @return the byte-swapped value + */ +static SPH_INLINE sph_u64 +sph_bswap64(sph_u64 x) +{ + x = SPH_T64((x << 32) | (x >> 32)); + x = ((x & SPH_C64(0xFFFF0000FFFF0000)) >> 16) + | ((x & SPH_C64(0x0000FFFF0000FFFF)) << 16); + x = ((x & SPH_C64(0xFF00FF00FF00FF00)) >> 8) + | ((x & SPH_C64(0x00FF00FF00FF00FF)) << 8); + return x; +} + +#endif + +#endif + +#if SPH_SPARCV9_GCC && !SPH_NO_ASM + +/* + * On UltraSPARC systems, native ordering is big-endian, but it is + * possible to perform little-endian read accesses by specifying the + * address space 0x88 (ASI_PRIMARY_LITTLE). Basically, either we use + * the opcode "lda [%reg]0x88,%dst", where %reg is the register which + * contains the source address and %dst is the destination register, + * or we use "lda [%reg+imm]%asi,%dst", which uses the %asi register + * to get the address space name. The latter format is better since it + * combines an addition and the actual access in a single opcode; but + * it requires the setting (and subsequent resetting) of %asi, which is + * slow. Some operations (i.e. MD5 compression function) combine many + * successive little-endian read accesses, which may share the same + * %asi setting. The macros below contain the appropriate inline + * assembly. + */ + +#define SPH_SPARCV9_SET_ASI \ + sph_u32 sph_sparcv9_asi; \ + __asm__ __volatile__ ( \ + "rd %%asi,%0\n\twr %%g0,0x88,%%asi" : "=r" (sph_sparcv9_asi)); + +#define SPH_SPARCV9_RESET_ASI \ + __asm__ __volatile__ ("wr %%g0,%0,%%asi" : : "r" (sph_sparcv9_asi)); + +#define SPH_SPARCV9_DEC32LE(base, idx) ({ \ + sph_u32 sph_sparcv9_tmp; \ + __asm__ __volatile__ ("lda [%1+" #idx "*4]%%asi,%0" \ + : "=r" (sph_sparcv9_tmp) : "r" (base)); \ + sph_sparcv9_tmp; \ + }) + +#endif + +static SPH_INLINE void +sph_enc16be(void *dst, unsigned val) +{ + ((unsigned char *)dst)[0] = (val >> 8); + ((unsigned char *)dst)[1] = val; +} + +static SPH_INLINE unsigned +sph_dec16be(const void *src) +{ + return ((unsigned)(((const unsigned char *)src)[0]) << 8) + | (unsigned)(((const unsigned char *)src)[1]); +} + +static SPH_INLINE void +sph_enc16le(void *dst, unsigned val) +{ + ((unsigned char *)dst)[0] = val; + ((unsigned char *)dst)[1] = val >> 8; +} + +static SPH_INLINE unsigned +sph_dec16le(const void *src) +{ + return (unsigned)(((const unsigned char *)src)[0]) + | ((unsigned)(((const unsigned char *)src)[1]) << 8); +} + +/** + * Encode a 32-bit value into the provided buffer (big endian convention). + * + * @param dst the destination buffer + * @param val the 32-bit value to encode + */ +static SPH_INLINE void +sph_enc32be(void *dst, sph_u32 val) +{ +#if defined SPH_UPTR +#if SPH_UNALIGNED +#if SPH_LITTLE_ENDIAN + val = sph_bswap32(val); +#endif + *(sph_u32 *)dst = val; +#else + if (((SPH_UPTR)dst & 3) == 0) { +#if SPH_LITTLE_ENDIAN + val = sph_bswap32(val); +#endif + *(sph_u32 *)dst = val; + } else { + ((unsigned char *)dst)[0] = (val >> 24); + ((unsigned char *)dst)[1] = (val >> 16); + ((unsigned char *)dst)[2] = (val >> 8); + ((unsigned char *)dst)[3] = val; + } +#endif +#else + ((unsigned char *)dst)[0] = (val >> 24); + ((unsigned char *)dst)[1] = (val >> 16); + ((unsigned char *)dst)[2] = (val >> 8); + ((unsigned char *)dst)[3] = val; +#endif +} + +/** + * Encode a 32-bit value into the provided buffer (big endian convention). + * The destination buffer must be properly aligned. + * + * @param dst the destination buffer (32-bit aligned) + * @param val the value to encode + */ +static SPH_INLINE void +sph_enc32be_aligned(void *dst, sph_u32 val) +{ +#if SPH_LITTLE_ENDIAN + *(sph_u32 *)dst = sph_bswap32(val); +#elif SPH_BIG_ENDIAN + *(sph_u32 *)dst = val; +#else + ((unsigned char *)dst)[0] = (val >> 24); + ((unsigned char *)dst)[1] = (val >> 16); + ((unsigned char *)dst)[2] = (val >> 8); + ((unsigned char *)dst)[3] = val; +#endif +} + +/** + * Decode a 32-bit value from the provided buffer (big endian convention). + * + * @param src the source buffer + * @return the decoded value + */ +static SPH_INLINE sph_u32 +sph_dec32be(const void *src) +{ +#if defined SPH_UPTR +#if SPH_UNALIGNED +#if SPH_LITTLE_ENDIAN + return sph_bswap32(*(const sph_u32 *)src); +#else + return *(const sph_u32 *)src; +#endif +#else + if (((SPH_UPTR)src & 3) == 0) { +#if SPH_LITTLE_ENDIAN + return sph_bswap32(*(const sph_u32 *)src); +#else + return *(const sph_u32 *)src; +#endif + } else { + return ((sph_u32)(((const unsigned char *)src)[0]) << 24) + | ((sph_u32)(((const unsigned char *)src)[1]) << 16) + | ((sph_u32)(((const unsigned char *)src)[2]) << 8) + | (sph_u32)(((const unsigned char *)src)[3]); + } +#endif +#else + return ((sph_u32)(((const unsigned char *)src)[0]) << 24) + | ((sph_u32)(((const unsigned char *)src)[1]) << 16) + | ((sph_u32)(((const unsigned char *)src)[2]) << 8) + | (sph_u32)(((const unsigned char *)src)[3]); +#endif +} + +/** + * Decode a 32-bit value from the provided buffer (big endian convention). + * The source buffer must be properly aligned. + * + * @param src the source buffer (32-bit aligned) + * @return the decoded value + */ +static SPH_INLINE sph_u32 +sph_dec32be_aligned(const void *src) +{ +#if SPH_LITTLE_ENDIAN + return sph_bswap32(*(const sph_u32 *)src); +#elif SPH_BIG_ENDIAN + return *(const sph_u32 *)src; +#else + return ((sph_u32)(((const unsigned char *)src)[0]) << 24) + | ((sph_u32)(((const unsigned char *)src)[1]) << 16) + | ((sph_u32)(((const unsigned char *)src)[2]) << 8) + | (sph_u32)(((const unsigned char *)src)[3]); +#endif +} + +/** + * Encode a 32-bit value into the provided buffer (little endian convention). + * + * @param dst the destination buffer + * @param val the 32-bit value to encode + */ +static SPH_INLINE void +sph_enc32le(void *dst, sph_u32 val) +{ +#if defined SPH_UPTR +#if SPH_UNALIGNED +#if SPH_BIG_ENDIAN + val = sph_bswap32(val); +#endif + *(sph_u32 *)dst = val; +#else + if (((SPH_UPTR)dst & 3) == 0) { +#if SPH_BIG_ENDIAN + val = sph_bswap32(val); +#endif + *(sph_u32 *)dst = val; + } else { + ((unsigned char *)dst)[0] = val; + ((unsigned char *)dst)[1] = (val >> 8); + ((unsigned char *)dst)[2] = (val >> 16); + ((unsigned char *)dst)[3] = (val >> 24); + } +#endif +#else + ((unsigned char *)dst)[0] = val; + ((unsigned char *)dst)[1] = (val >> 8); + ((unsigned char *)dst)[2] = (val >> 16); + ((unsigned char *)dst)[3] = (val >> 24); +#endif +} + +/** + * Encode a 32-bit value into the provided buffer (little endian convention). + * The destination buffer must be properly aligned. + * + * @param dst the destination buffer (32-bit aligned) + * @param val the value to encode + */ +static SPH_INLINE void +sph_enc32le_aligned(void *dst, sph_u32 val) +{ +#if SPH_LITTLE_ENDIAN + *(sph_u32 *)dst = val; +#elif SPH_BIG_ENDIAN + *(sph_u32 *)dst = sph_bswap32(val); +#else + ((unsigned char *)dst)[0] = val; + ((unsigned char *)dst)[1] = (val >> 8); + ((unsigned char *)dst)[2] = (val >> 16); + ((unsigned char *)dst)[3] = (val >> 24); +#endif +} + +/** + * Decode a 32-bit value from the provided buffer (little endian convention). + * + * @param src the source buffer + * @return the decoded value + */ +static SPH_INLINE sph_u32 +sph_dec32le(const void *src) +{ +#if defined SPH_UPTR +#if SPH_UNALIGNED +#if SPH_BIG_ENDIAN + return sph_bswap32(*(const sph_u32 *)src); +#else + return *(const sph_u32 *)src; +#endif +#else + if (((SPH_UPTR)src & 3) == 0) { +#if SPH_BIG_ENDIAN +#if SPH_SPARCV9_GCC && !SPH_NO_ASM + sph_u32 tmp; + + /* + * "__volatile__" is needed here because without it, + * gcc-3.4.3 miscompiles the code and performs the + * access before the test on the address, thus triggering + * a bus error... + */ + __asm__ __volatile__ ( + "lda [%1]0x88,%0" : "=r" (tmp) : "r" (src)); + return tmp; +/* + * On PowerPC, this turns out not to be worth the effort: the inline + * assembly makes GCC optimizer uncomfortable, which tends to nullify + * the decoding gains. + * + * For most hash functions, using this inline assembly trick changes + * hashing speed by less than 5% and often _reduces_ it. The biggest + * gains are for MD4 (+11%) and CubeHash (+30%). For all others, it is + * less then 10%. The speed gain on CubeHash is probably due to the + * chronic shortage of registers that CubeHash endures; for the other + * functions, the generic code appears to be efficient enough already. + * +#elif (SPH_PPC32_GCC || SPH_PPC64_GCC) && !SPH_NO_ASM + sph_u32 tmp; + + __asm__ __volatile__ ( + "lwbrx %0,0,%1" : "=r" (tmp) : "r" (src)); + return tmp; + */ +#else + return sph_bswap32(*(const sph_u32 *)src); +#endif +#else + return *(const sph_u32 *)src; +#endif + } else { + return (sph_u32)(((const unsigned char *)src)[0]) + | ((sph_u32)(((const unsigned char *)src)[1]) << 8) + | ((sph_u32)(((const unsigned char *)src)[2]) << 16) + | ((sph_u32)(((const unsigned char *)src)[3]) << 24); + } +#endif +#else + return (sph_u32)(((const unsigned char *)src)[0]) + | ((sph_u32)(((const unsigned char *)src)[1]) << 8) + | ((sph_u32)(((const unsigned char *)src)[2]) << 16) + | ((sph_u32)(((const unsigned char *)src)[3]) << 24); +#endif +} + +/** + * Decode a 32-bit value from the provided buffer (little endian convention). + * The source buffer must be properly aligned. + * + * @param src the source buffer (32-bit aligned) + * @return the decoded value + */ +static SPH_INLINE sph_u32 +sph_dec32le_aligned(const void *src) +{ +#if SPH_LITTLE_ENDIAN + return *(const sph_u32 *)src; +#elif SPH_BIG_ENDIAN +#if SPH_SPARCV9_GCC && !SPH_NO_ASM + sph_u32 tmp; + + __asm__ __volatile__ ("lda [%1]0x88,%0" : "=r" (tmp) : "r" (src)); + return tmp; +/* + * Not worth it generally. + * +#elif (SPH_PPC32_GCC || SPH_PPC64_GCC) && !SPH_NO_ASM + sph_u32 tmp; + + __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (tmp) : "r" (src)); + return tmp; + */ +#else + return sph_bswap32(*(const sph_u32 *)src); +#endif +#else + return (sph_u32)(((const unsigned char *)src)[0]) + | ((sph_u32)(((const unsigned char *)src)[1]) << 8) + | ((sph_u32)(((const unsigned char *)src)[2]) << 16) + | ((sph_u32)(((const unsigned char *)src)[3]) << 24); +#endif +} + +#if SPH_64 + +/** + * Encode a 64-bit value into the provided buffer (big endian convention). + * + * @param dst the destination buffer + * @param val the 64-bit value to encode + */ +static SPH_INLINE void +sph_enc64be(void *dst, sph_u64 val) +{ +#if defined SPH_UPTR +#if SPH_UNALIGNED +#if SPH_LITTLE_ENDIAN + val = sph_bswap64(val); +#endif + *(sph_u64 *)dst = val; +#else + if (((SPH_UPTR)dst & 7) == 0) { +#if SPH_LITTLE_ENDIAN + val = sph_bswap64(val); +#endif + *(sph_u64 *)dst = val; + } else { + ((unsigned char *)dst)[0] = (val >> 56); + ((unsigned char *)dst)[1] = (val >> 48); + ((unsigned char *)dst)[2] = (val >> 40); + ((unsigned char *)dst)[3] = (val >> 32); + ((unsigned char *)dst)[4] = (val >> 24); + ((unsigned char *)dst)[5] = (val >> 16); + ((unsigned char *)dst)[6] = (val >> 8); + ((unsigned char *)dst)[7] = val; + } +#endif +#else + ((unsigned char *)dst)[0] = (val >> 56); + ((unsigned char *)dst)[1] = (val >> 48); + ((unsigned char *)dst)[2] = (val >> 40); + ((unsigned char *)dst)[3] = (val >> 32); + ((unsigned char *)dst)[4] = (val >> 24); + ((unsigned char *)dst)[5] = (val >> 16); + ((unsigned char *)dst)[6] = (val >> 8); + ((unsigned char *)dst)[7] = val; +#endif +} + +/** + * Encode a 64-bit value into the provided buffer (big endian convention). + * The destination buffer must be properly aligned. + * + * @param dst the destination buffer (64-bit aligned) + * @param val the value to encode + */ +static SPH_INLINE void +sph_enc64be_aligned(void *dst, sph_u64 val) +{ +#if SPH_LITTLE_ENDIAN + *(sph_u64 *)dst = sph_bswap64(val); +#elif SPH_BIG_ENDIAN + *(sph_u64 *)dst = val; +#else + ((unsigned char *)dst)[0] = (val >> 56); + ((unsigned char *)dst)[1] = (val >> 48); + ((unsigned char *)dst)[2] = (val >> 40); + ((unsigned char *)dst)[3] = (val >> 32); + ((unsigned char *)dst)[4] = (val >> 24); + ((unsigned char *)dst)[5] = (val >> 16); + ((unsigned char *)dst)[6] = (val >> 8); + ((unsigned char *)dst)[7] = val; +#endif +} + +/** + * Decode a 64-bit value from the provided buffer (big endian convention). + * + * @param src the source buffer + * @return the decoded value + */ +static SPH_INLINE sph_u64 +sph_dec64be(const void *src) +{ +#if defined SPH_UPTR +#if SPH_UNALIGNED +#if SPH_LITTLE_ENDIAN + return sph_bswap64(*(const sph_u64 *)src); +#else + return *(const sph_u64 *)src; +#endif +#else + if (((SPH_UPTR)src & 7) == 0) { +#if SPH_LITTLE_ENDIAN + return sph_bswap64(*(const sph_u64 *)src); +#else + return *(const sph_u64 *)src; +#endif + } else { + return ((sph_u64)(((const unsigned char *)src)[0]) << 56) + | ((sph_u64)(((const unsigned char *)src)[1]) << 48) + | ((sph_u64)(((const unsigned char *)src)[2]) << 40) + | ((sph_u64)(((const unsigned char *)src)[3]) << 32) + | ((sph_u64)(((const unsigned char *)src)[4]) << 24) + | ((sph_u64)(((const unsigned char *)src)[5]) << 16) + | ((sph_u64)(((const unsigned char *)src)[6]) << 8) + | (sph_u64)(((const unsigned char *)src)[7]); + } +#endif +#else + return ((sph_u64)(((const unsigned char *)src)[0]) << 56) + | ((sph_u64)(((const unsigned char *)src)[1]) << 48) + | ((sph_u64)(((const unsigned char *)src)[2]) << 40) + | ((sph_u64)(((const unsigned char *)src)[3]) << 32) + | ((sph_u64)(((const unsigned char *)src)[4]) << 24) + | ((sph_u64)(((const unsigned char *)src)[5]) << 16) + | ((sph_u64)(((const unsigned char *)src)[6]) << 8) + | (sph_u64)(((const unsigned char *)src)[7]); +#endif +} + +/** + * Decode a 64-bit value from the provided buffer (big endian convention). + * The source buffer must be properly aligned. + * + * @param src the source buffer (64-bit aligned) + * @return the decoded value + */ +static SPH_INLINE sph_u64 +sph_dec64be_aligned(const void *src) +{ +#if SPH_LITTLE_ENDIAN + return sph_bswap64(*(const sph_u64 *)src); +#elif SPH_BIG_ENDIAN + return *(const sph_u64 *)src; +#else + return ((sph_u64)(((const unsigned char *)src)[0]) << 56) + | ((sph_u64)(((const unsigned char *)src)[1]) << 48) + | ((sph_u64)(((const unsigned char *)src)[2]) << 40) + | ((sph_u64)(((const unsigned char *)src)[3]) << 32) + | ((sph_u64)(((const unsigned char *)src)[4]) << 24) + | ((sph_u64)(((const unsigned char *)src)[5]) << 16) + | ((sph_u64)(((const unsigned char *)src)[6]) << 8) + | (sph_u64)(((const unsigned char *)src)[7]); +#endif +} + +/** + * Encode a 64-bit value into the provided buffer (little endian convention). + * + * @param dst the destination buffer + * @param val the 64-bit value to encode + */ +static SPH_INLINE void +sph_enc64le(void *dst, sph_u64 val) +{ +#if defined SPH_UPTR +#if SPH_UNALIGNED +#if SPH_BIG_ENDIAN + val = sph_bswap64(val); +#endif + *(sph_u64 *)dst = val; +#else + if (((SPH_UPTR)dst & 7) == 0) { +#if SPH_BIG_ENDIAN + val = sph_bswap64(val); +#endif + *(sph_u64 *)dst = val; + } else { + ((unsigned char *)dst)[0] = val; + ((unsigned char *)dst)[1] = (val >> 8); + ((unsigned char *)dst)[2] = (val >> 16); + ((unsigned char *)dst)[3] = (val >> 24); + ((unsigned char *)dst)[4] = (val >> 32); + ((unsigned char *)dst)[5] = (val >> 40); + ((unsigned char *)dst)[6] = (val >> 48); + ((unsigned char *)dst)[7] = (val >> 56); + } +#endif +#else + ((unsigned char *)dst)[0] = val; + ((unsigned char *)dst)[1] = (val >> 8); + ((unsigned char *)dst)[2] = (val >> 16); + ((unsigned char *)dst)[3] = (val >> 24); + ((unsigned char *)dst)[4] = (val >> 32); + ((unsigned char *)dst)[5] = (val >> 40); + ((unsigned char *)dst)[6] = (val >> 48); + ((unsigned char *)dst)[7] = (val >> 56); +#endif +} + +/** + * Encode a 64-bit value into the provided buffer (little endian convention). + * The destination buffer must be properly aligned. + * + * @param dst the destination buffer (64-bit aligned) + * @param val the value to encode + */ +static SPH_INLINE void +sph_enc64le_aligned(void *dst, sph_u64 val) +{ +#if SPH_LITTLE_ENDIAN + *(sph_u64 *)dst = val; +#elif SPH_BIG_ENDIAN + *(sph_u64 *)dst = sph_bswap64(val); +#else + ((unsigned char *)dst)[0] = val; + ((unsigned char *)dst)[1] = (val >> 8); + ((unsigned char *)dst)[2] = (val >> 16); + ((unsigned char *)dst)[3] = (val >> 24); + ((unsigned char *)dst)[4] = (val >> 32); + ((unsigned char *)dst)[5] = (val >> 40); + ((unsigned char *)dst)[6] = (val >> 48); + ((unsigned char *)dst)[7] = (val >> 56); +#endif +} + +/** + * Decode a 64-bit value from the provided buffer (little endian convention). + * + * @param src the source buffer + * @return the decoded value + */ +static SPH_INLINE sph_u64 +sph_dec64le(const void *src) +{ +#if defined SPH_UPTR +#if SPH_UNALIGNED +#if SPH_BIG_ENDIAN + return sph_bswap64(*(const sph_u64 *)src); +#else + return *(const sph_u64 *)src; +#endif +#else + if (((SPH_UPTR)src & 7) == 0) { +#if SPH_BIG_ENDIAN +#if SPH_SPARCV9_GCC_64 && !SPH_NO_ASM + sph_u64 tmp; + + __asm__ __volatile__ ( + "ldxa [%1]0x88,%0" : "=r" (tmp) : "r" (src)); + return tmp; +/* + * Not worth it generally. + * +#elif SPH_PPC32_GCC && !SPH_NO_ASM + return (sph_u64)sph_dec32le_aligned(src) + | ((sph_u64)sph_dec32le_aligned( + (const char *)src + 4) << 32); +#elif SPH_PPC64_GCC && !SPH_NO_ASM + sph_u64 tmp; + + __asm__ __volatile__ ( + "ldbrx %0,0,%1" : "=r" (tmp) : "r" (src)); + return tmp; + */ +#else + return sph_bswap64(*(const sph_u64 *)src); +#endif +#else + return *(const sph_u64 *)src; +#endif + } else { + return (sph_u64)(((const unsigned char *)src)[0]) + | ((sph_u64)(((const unsigned char *)src)[1]) << 8) + | ((sph_u64)(((const unsigned char *)src)[2]) << 16) + | ((sph_u64)(((const unsigned char *)src)[3]) << 24) + | ((sph_u64)(((const unsigned char *)src)[4]) << 32) + | ((sph_u64)(((const unsigned char *)src)[5]) << 40) + | ((sph_u64)(((const unsigned char *)src)[6]) << 48) + | ((sph_u64)(((const unsigned char *)src)[7]) << 56); + } +#endif +#else + return (sph_u64)(((const unsigned char *)src)[0]) + | ((sph_u64)(((const unsigned char *)src)[1]) << 8) + | ((sph_u64)(((const unsigned char *)src)[2]) << 16) + | ((sph_u64)(((const unsigned char *)src)[3]) << 24) + | ((sph_u64)(((const unsigned char *)src)[4]) << 32) + | ((sph_u64)(((const unsigned char *)src)[5]) << 40) + | ((sph_u64)(((const unsigned char *)src)[6]) << 48) + | ((sph_u64)(((const unsigned char *)src)[7]) << 56); +#endif +} + +/** + * Decode a 64-bit value from the provided buffer (little endian convention). + * The source buffer must be properly aligned. + * + * @param src the source buffer (64-bit aligned) + * @return the decoded value + */ +static SPH_INLINE sph_u64 +sph_dec64le_aligned(const void *src) +{ +#if SPH_LITTLE_ENDIAN + return *(const sph_u64 *)src; +#elif SPH_BIG_ENDIAN +#if SPH_SPARCV9_GCC_64 && !SPH_NO_ASM + sph_u64 tmp; + + __asm__ __volatile__ ("ldxa [%1]0x88,%0" : "=r" (tmp) : "r" (src)); + return tmp; +/* + * Not worth it generally. + * +#elif SPH_PPC32_GCC && !SPH_NO_ASM + return (sph_u64)sph_dec32le_aligned(src) + | ((sph_u64)sph_dec32le_aligned((const char *)src + 4) << 32); +#elif SPH_PPC64_GCC && !SPH_NO_ASM + sph_u64 tmp; + + __asm__ __volatile__ ("ldbrx %0,0,%1" : "=r" (tmp) : "r" (src)); + return tmp; + */ +#else + return sph_bswap64(*(const sph_u64 *)src); +#endif +#else + return (sph_u64)(((const unsigned char *)src)[0]) + | ((sph_u64)(((const unsigned char *)src)[1]) << 8) + | ((sph_u64)(((const unsigned char *)src)[2]) << 16) + | ((sph_u64)(((const unsigned char *)src)[3]) << 24) + | ((sph_u64)(((const unsigned char *)src)[4]) << 32) + | ((sph_u64)(((const unsigned char *)src)[5]) << 40) + | ((sph_u64)(((const unsigned char *)src)[6]) << 48) + | ((sph_u64)(((const unsigned char *)src)[7]) << 56); +#endif +} + +#endif + +#endif /* Doxygen excluded block */ + +#endif diff --git a/sph/sph_whirlpool.h b/sph/sph_whirlpool.h new file mode 100644 index 0000000..493b7d7 --- /dev/null +++ b/sph/sph_whirlpool.h @@ -0,0 +1,216 @@ +/* $Id: sph_whirlpool.h 216 2010-06-08 09:46:57Z tp $ */ +/** + * WHIRLPOOL interface. + * + * WHIRLPOOL knows three variants, dubbed "WHIRLPOOL-0" (original + * version, published in 2000, studied by NESSIE), "WHIRLPOOL-1" + * (first revision, 2001, with a new S-box) and "WHIRLPOOL" (current + * version, 2003, with a new diffusion matrix, also described as "plain + * WHIRLPOOL"). All three variants are implemented here. + * + * The original WHIRLPOOL (i.e. WHIRLPOOL-0) was published in: P. S. L. + * M. Barreto, V. Rijmen, "The Whirlpool Hashing Function", First open + * NESSIE Workshop, Leuven, Belgium, November 13--14, 2000. + * + * The current WHIRLPOOL specification and a reference implementation + * can be found on the WHIRLPOOL web page: + * http://paginas.terra.com.br/informatica/paulobarreto/WhirlpoolPage.html + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @file sph_whirlpool.h + * @author Thomas Pornin + */ + +#ifndef SPH_WHIRLPOOL_H__ +#define SPH_WHIRLPOOL_H__ + +#include +#include "sph_types.h" +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_64 + +/** + * Output size (in bits) for WHIRLPOOL. + */ +#define SPH_SIZE_whirlpool 512 + +/** + * Output size (in bits) for WHIRLPOOL-0. + */ +#define SPH_SIZE_whirlpool0 512 + +/** + * Output size (in bits) for WHIRLPOOL-1. + */ +#define SPH_SIZE_whirlpool1 512 + +/** + * This structure is a context for WHIRLPOOL computations: it contains the + * intermediate values and some data from the last entered block. Once + * a WHIRLPOOL computation has been performed, the context can be reused for + * another computation. + * + * The contents of this structure are private. A running WHIRLPOOL computation + * can be cloned by copying the context (e.g. with a simple + * memcpy()). + */ +typedef struct { +#ifndef DOXYGEN_IGNORE + unsigned char buf[64]; /* first field, for alignment */ + sph_u64 state[8]; +#if SPH_64 + sph_u64 count; +#else + sph_u32 count_high, count_low; +#endif +#endif +} sph_whirlpool_context; + +/** + * Initialize a WHIRLPOOL context. This process performs no memory allocation. + * + * @param cc the WHIRLPOOL context (pointer to a + * sph_whirlpool_context) + */ +void sph_whirlpool_init(void *cc); + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). This function applies the + * plain WHIRLPOOL algorithm. + * + * @param cc the WHIRLPOOL context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_whirlpool(void *cc, const void *data, size_t len); + +/** + * Terminate the current WHIRLPOOL computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the WHIRLPOOL context + * @param dst the destination buffer + */ +void sph_whirlpool_close(void *cc, void *dst); + +/** + * WHIRLPOOL-0 uses the same structure than plain WHIRLPOOL. + */ +typedef sph_whirlpool_context sph_whirlpool0_context; + +#ifdef DOXYGEN_IGNORE +/** + * Initialize a WHIRLPOOL-0 context. This function is identical to + * sph_whirlpool_init(). + * + * @param cc the WHIRLPOOL context (pointer to a + * sph_whirlpool0_context) + */ +void sph_whirlpool0_init(void *cc); +#endif + +#ifndef DOXYGEN_IGNORE +#define sph_whirlpool0_init sph_whirlpool_init +#endif + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). This function applies the + * WHIRLPOOL-0 algorithm. + * + * @param cc the WHIRLPOOL context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_whirlpool0(void *cc, const void *data, size_t len); + +/** + * Terminate the current WHIRLPOOL-0 computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the WHIRLPOOL-0 context + * @param dst the destination buffer + */ +void sph_whirlpool0_close(void *cc, void *dst); + +/** + * WHIRLPOOL-1 uses the same structure than plain WHIRLPOOL. + */ +typedef sph_whirlpool_context sph_whirlpool1_context; + +#ifdef DOXYGEN_IGNORE +/** + * Initialize a WHIRLPOOL-1 context. This function is identical to + * sph_whirlpool_init(). + * + * @param cc the WHIRLPOOL context (pointer to a + * sph_whirlpool1_context) + */ +void sph_whirlpool1_init(void *cc); +#endif + +#ifndef DOXYGEN_IGNORE +#define sph_whirlpool1_init sph_whirlpool_init +#endif + +/** + * Process some data bytes. It is acceptable that len is zero + * (in which case this function does nothing). This function applies the + * WHIRLPOOL-1 algorithm. + * + * @param cc the WHIRLPOOL context + * @param data the input data + * @param len the input data length (in bytes) + */ +void sph_whirlpool1(void *cc, const void *data, size_t len); + +/** + * Terminate the current WHIRLPOOL-1 computation and output the result into the + * provided buffer. The destination buffer must be wide enough to + * accomodate the result (64 bytes). The context is automatically + * reinitialized. + * + * @param cc the WHIRLPOOL-1 context + * @param dst the destination buffer + */ +void sph_whirlpool1_close(void *cc, void *dst); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/sph/streebog.c b/sph/streebog.c new file mode 100644 index 0000000..dbae4e5 --- /dev/null +++ b/sph/streebog.c @@ -0,0 +1,1045 @@ +/* Streebog GOST hash function for sib algo SibCoin */ + +#include +#include +#include +#include + +#include "sph_streebog.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +#ifdef _MSC_VER +#pragma warning (disable: 4146) +#endif + +//-------------------------------------------------------------------------------------------- +// +// Streebog 512 implementation +// +//-------------------------------------------------------------------------------------------- + + +// Tables for function F +static const sph_u64 TG[8][256] = {{ + 0xE6F87E5C5B711FD0,0x258377800924FA16,0xC849E07E852EA4A8,0x5B4686A18F06C16A, + 0x0B32E9A2D77B416E,0xABDA37A467815C66,0xF61796A81A686676,0xF5DC0B706391954B, + 0x4862F38DB7E64BF1,0xFF5C629A68BD85C5,0xCB827DA6FCD75795,0x66D36DAF69B9F089, + 0x356C9F74483D83B0,0x7CBCECB1238C99A1,0x36A702AC31C4708D,0x9EB6A8D02FBCDFD6, + 0x8B19FA51E5B3AE37,0x9CCFB5408A127D0B,0xBC0C78B508208F5A,0xE533E3842288ECED, + 0xCEC2C7D377C15FD2,0xEC7817B6505D0F5E,0xB94CC2C08336871D,0x8C205DB4CB0B04AD, + 0x763C855B28A0892F,0x588D1B79F6FF3257,0x3FECF69E4311933E,0x0FC0D39F803A18C9, + 0xEE010A26F5F3AD83,0x10EFE8F4411979A6,0x5DCDA10C7DE93A10,0x4A1BEE1D1248E92C, + 0x53BFF2DB21847339,0xB4F50CCFA6A23D09,0x5FB4BC9CD84798CD,0xE88A2D8B071C56F9, + 0x7F7771695A756A9C,0xC5F02E71A0BA1EBC,0xA663F9AB4215E672,0x2EB19E22DE5FBB78, + 0x0DB9CE0F2594BA14,0x82520E6397664D84,0x2F031E6A0208EA98,0x5C7F2144A1BE6BF0, + 0x7A37CB1CD16362DB,0x83E08E2B4B311C64,0xCF70479BAB960E32,0x856BA986B9DEE71E, + 0xB5478C877AF56CE9,0xB8FE42885F61D6FD,0x1BDD0156966238C8,0x622157923EF8A92E, + 0xFC97FF42114476F8,0x9D7D350856452CEB,0x4C90C9B0E0A71256,0x2308502DFBCB016C, + 0x2D7A03FAA7A64845,0xF46E8B38BFC6C4AB,0xBDBEF8FDD477DEBA,0x3AAC4CEBC8079B79, + 0xF09CB105E8879D0C,0x27FA6A10AC8A58CB,0x8960E7C1401D0CEA,0x1A6F811E4A356928, + 0x90C4FB0773D196FF,0x43501A2F609D0A9F,0xF7A516E0C63F3796,0x1CE4A6B3B8DA9252, + 0x1324752C38E08A9B,0xA5A864733BEC154F,0x2BF124575549B33F,0xD766DB15440DC5C7, + 0xA7D179E39E42B792,0xDADF151A61997FD3,0x86A0345EC0271423,0x38D5517B6DA939A4, + 0x6518F077104003B4,0x02791D90A5AEA2DD,0x88D267899C4A5D0A,0x930F66DF0A2865C2, + 0x4EE9D4204509B08B,0x325538916685292A,0x412907BFC533A842,0xB27E2B62544DC673, + 0x6C5304456295E007,0x5AF406E95351908A,0x1F2F3B6BC123616F,0xC37B09DC5255E5C6, + 0x3967D133B1FE6844,0x298839C7F0E711E2,0x409B87F71964F9A2,0xE938ADC3DB4B0719, + 0x0C0B4E47F9C3EBF4,0x5534D576D36B8843,0x4610A05AEB8B02D8,0x20C3CDF58232F251, + 0x6DE1840DBEC2B1E7,0xA0E8DE06B0FA1D08,0x7B854B540D34333B,0x42E29A67BCCA5B7F, + 0xD8A6088AC437DD0E,0xC63BB3A9D943ED81,0x21714DBD5E65A3B1,0x6761EDE7B5EEA169, + 0x2431F7C8D573ABF6,0xD51FC685E1A3671A,0x5E063CD40410C92D,0x283AB98F2CB04002, + 0x8FEBC06CB2F2F790,0x17D64F116FA1D33C,0xE07359F1A99EE4AA,0x784ED68C74CDC006, + 0x6E2A19D5C73B42DA,0x8712B4161C7045C3,0x371582E4ED93216D,0xACE390414939F6FC, + 0x7EC5F12186223B7C,0xC0B094042BAC16FB,0xF9D745379A527EBF,0x737C3F2EA3B68168, + 0x33E7B8D9BAD278CA,0xA9A32A34C22FFEBB,0xE48163CCFEDFBD0D,0x8E5940246EA5A670, + 0x51C6EF4B842AD1E4,0x22BAD065279C508C,0xD91488C218608CEE,0x319EA5491F7CDA17, + 0xD394E128134C9C60,0x094BF43272D5E3B3,0x9BF612A5A4AAD791,0xCCBBDA43D26FFD0F, + 0x34DE1F3C946AD250,0x4F5B5468995EE16B,0xDF9FAF6FEA8F7794,0x2648EA5870DD092B, + 0xBFC7E56D71D97C67,0xDDE6B2FF4F21D549,0x3C276B463AE86003,0x91767B4FAF86C71F, + 0x68A13E7835D4B9A0,0xB68C115F030C9FD4,0x141DD2C916582001,0x983D8F7DDD5324AC, + 0x64AA703FCC175254,0xC2C989948E02B426,0x3E5E76D69F46C2DE,0x50746F03587D8004, + 0x45DB3D829272F1E5,0x60584A029B560BF3,0xFBAE58A73FFCDC62,0xA15A5E4E6CAD4CE8, + 0x4BA96E55CE1FB8CC,0x08F9747AAE82B253,0xC102144CF7FB471B,0x9F042898F3EB8E36, + 0x068B27ADF2EFFB7A,0xEDCA97FE8C0A5EBE,0x778E0513F4F7D8CF,0x302C2501C32B8BF7, + 0x8D92DDFC175C554D,0xF865C57F46052F5F,0xEAF3301BA2B2F424,0xAA68B7ECBBD60D86, + 0x998F0F350104754C,0x0000000000000000,0xF12E314D34D0CCEC,0x710522BE061823B5, + 0xAF280D9930C005C1,0x97FD5CE25D693C65,0x19A41CC633CC9A15,0x95844172F8C79EB8, + 0xDC5432B7937684A9,0x9436C13A2490CF58,0x802B13F332C8EF59,0xC442AE397CED4F5C, + 0xFA1CD8EFE3AB8D82,0xF2E5AC954D293FD1,0x6AD823E8907A1B7D,0x4D2249F83CF043B6, + 0x03CB9DD879F9F33D,0xDE2D2F2736D82674,0x2A43A41F891EE2DF,0x6F98999D1B6C133A, + 0xD4AD46CD3DF436FA,0xBB35DF50269825C0,0x964FDCAA813E6D85,0xEB41B0537EE5A5C4, + 0x0540BA758B160847,0xA41AE43BE7BB44AF,0xE3B8C429D0671797,0x819993BBEE9FBEB9, + 0xAE9A8DD1EC975421,0xF3572CDD917E6E31,0x6393D7DAE2AFF8CE,0x47A2201237DC5338, + 0xA32343DEC903EE35,0x79FC56C4A89A91E6,0x01B28048DC5751E0,0x1296F564E4B7DB7B, + 0x75F7188351597A12,0xDB6D9552BDCE2E33,0x1E9DBB231D74308F,0x520D7293FDD322D9, + 0xE20A44610C304677,0xFEEEE2D2B4EAD425,0xCA30FDEE20800675,0x61EACA4A47015A13, + 0xE74AFE1487264E30,0x2CC883B27BF119A5,0x1664CF59B3F682DC,0xA811AA7C1E78AF5B, + 0x1D5626FB648DC3B2,0xB73E9117DF5BCE34,0xD05F7CF06AB56F5D,0xFD257F0ACD132718, + 0x574DC8E676C52A9E,0x0739A7E52EB8AA9A,0x5486553E0F3CD9A3,0x56FF48AEAA927B7E, + 0xBE756525AD8E2D87,0x7D0E6CF9FFDBC841,0x3B1ECCA31450CA99,0x6913BE30E983E840, + 0xAD511009956EA71C,0xB1B5B6BA2DB4354E,0x4469BDCA4E25A005,0x15AF5281CA0F71E1, + 0x744598CB8D0E2BF2,0x593F9B312AA863B7,0xEFB38A6E29A4FC63,0x6B6AA3A04C2D4A9D, + 0x3D95EB0EE6BF31E3,0xA291C3961554BFD5,0x18169C8EEF9BCBF5,0x115D68BC9D4E2846, + 0xBA875F18FACF7420,0xD1EDFCB8B6E23EBD,0xB00736F2F1E364AE,0x84D929CE6589B6FE, + 0x70B7A2F6DA4F7255,0x0E7253D75C6D4929,0x04F23A3D574159A7,0x0A8069EA0B2C108E, + 0x49D073C56BB11A11,0x8AAB7A1939E4FFD7,0xCD095A0B0E38ACEF,0xC9FB60365979F548, + 0x92BDE697D67F3422,0xC78933E10514BC61,0xE1C1D9B975C9B54A,0xD2266160CF1BCD80, + 0x9A4492ED78FD8671,0xB3CCAB2A881A9793,0x72CEBF667FE1D088,0xD6D45B5D985A9427 +},{ + 0xC811A8058C3F55DE,0x65F5B43196B50619,0xF74F96B1D6706E43,0x859D1E8BCB43D336, + 0x5AAB8A85CCFA3D84,0xF9C7BF99C295FCFD,0xA21FD5A1DE4B630F,0xCDB3EF763B8B456D, + 0x803F59F87CF7C385,0xB27C73BE5F31913C,0x98E3AC6633B04821,0xBF61674C26B8F818, + 0x0FFBC995C4C130C8,0xAAA0862010761A98,0x6057F342210116AA,0xF63C760C0654CC35, + 0x2DDB45CC667D9042,0xBCF45A964BD40382,0x68E8A0C3EF3C6F3D,0xA7BD92D269FF73BC, + 0x290AE20201ED2287,0xB7DE34CDE885818F,0xD901EEA7DD61059B,0xD6FA273219A03553, + 0xD56F1AE874CCCEC9,0xEA31245C2E83F554,0x7034555DA07BE499,0xCE26D2AC56E7BEF7, + 0xFD161857A5054E38,0x6A0E7DA4527436D1,0x5BD86A381CDE9FF2,0xCAF7756231770C32, + 0xB09AAED9E279C8D0,0x5DEF1091C60674DB,0x111046A2515E5045,0x23536CE4729802FC, + 0xC50CBCF7F5B63CFA,0x73A16887CD171F03,0x7D2941AFD9F28DBD,0x3F5E3EB45A4F3B9D, + 0x84EEFE361B677140,0x3DB8E3D3E7076271,0x1A3A28F9F20FD248,0x7EBC7C75B49E7627, + 0x74E5F293C7EB565C,0x18DCF59E4F478BA4,0x0C6EF44FA9ADCB52,0xC699812D98DAC760, + 0x788B06DC6E469D0E,0xFC65F8EA7521EC4E,0x30A5F7219E8E0B55,0x2BEC3F65BCA57B6B, + 0xDDD04969BAF1B75E,0x99904CDBE394EA57,0x14B201D1E6EA40F6,0xBBB0C08241284ADD, + 0x50F20463BF8F1DFF,0xE8D7F93B93CBACB8,0x4D8CB68E477C86E8,0xC1DD1B3992268E3F, + 0x7C5AA11209D62FCB,0x2F3D98ABDB35C9AE,0x671369562BFD5FF5,0x15C1E16C36CEE280, + 0x1D7EB2EDF8F39B17,0xDA94D37DB00DFE01,0x877BC3EC760B8ADA,0xCB8495DFE153AE44, + 0x05A24773B7B410B3,0x12857B783C32ABDF,0x8EB770D06812513B,0x536739B9D2E3E665, + 0x584D57E271B26468,0xD789C78FC9849725,0xA935BBFA7D1AE102,0x8B1537A3DFA64188, + 0xD0CD5D9BC378DE7A,0x4AC82C9A4D80CFB7,0x42777F1B83BDB620,0x72D2883A1D33BD75, + 0x5E7A2D4BAB6A8F41,0xF4DAAB6BBB1C95D9,0x905CFFE7FD8D31B6,0x83AA6422119B381F, + 0xC0AEFB8442022C49,0xA0F908C663033AE3,0xA428AF0804938826,0xADE41C341A8A53C7, + 0xAE7121EE77E6A85D,0xC47F5C4A25929E8C,0xB538E9AA55CDD863,0x06377AA9DAD8EB29, + 0xA18AE87BB3279895,0x6EDFDA6A35E48414,0x6B7D9D19825094A7,0xD41CFA55A4E86CBF, + 0xE5CAEDC9EA42C59C,0xA36C351C0E6FC179,0x5181E4DE6FABBF89,0xFFF0C530184D17D4, + 0x9D41EB1584045892,0x1C0D525028D73961,0xF178EC180CA8856A,0x9A0571018EF811CD, + 0x4091A27C3EF5EFCC,0x19AF15239F6329D2,0x347450EFF91EB990,0xE11B4A078DD27759, + 0xB9561DE5FC601331,0x912F1F5A2DA993C0,0x1654DCB65BA2191A,0x3E2DDE098A6B99EB, + 0x8A66D71E0F82E3FE,0x8C51ADB7D55A08D7,0x4533E50F8941FF7F,0x02E6DD67BD4859EC, + 0xE068AABA5DF6D52F,0xC24826E3FF4A75A5,0x6C39070D88ACDDF8,0x6486548C4691A46F, + 0xD1BEBD26135C7C0C,0xB30F93038F15334A,0x82D9849FC1BF9A69,0x9C320BA85420FAE4, + 0xFA528243AFF90767,0x9ED4D6CFE968A308,0xB825FD582C44B147,0x9B7691BC5EDCB3BB, + 0xC7EA619048FE6516,0x1063A61F817AF233,0x47D538683409A693,0x63C2CE984C6DED30, + 0x2A9FDFD86C81D91D,0x7B1E3B06032A6694,0x666089EBFBD9FD83,0x0A598EE67375207B, + 0x07449A140AFC495F,0x2CA8A571B6593234,0x1F986F8A45BBC2FB,0x381AA4A050B372C2, + 0x5423A3ADD81FAF3A,0x17273C0B8B86BB6C,0xFE83258DC869B5A2,0x287902BFD1C980F1, + 0xF5A94BD66B3837AF,0x88800A79B2CABA12,0x55504310083B0D4C,0xDF36940E07B9EEB2, + 0x04D1A7CE6790B2C5,0x612413FFF125B4DC,0x26F12B97C52C124F,0x86082351A62F28AC, + 0xEF93632F9937E5E7,0x3507B052293A1BE6,0xE72C30AE570A9C70,0xD3586041AE1425E0, + 0xDE4574B3D79D4CC4,0x92BA228040C5685A,0xF00B0CA5DC8C271C,0xBE1287F1F69C5A6E, + 0xF39E317FB1E0DC86,0x495D114020EC342D,0x699B407E3F18CD4B,0xDCA3A9D46AD51528, + 0x0D1D14F279896924,0x0000000000000000,0x593EB75FA196C61E,0x2E4E78160B116BD8, + 0x6D4AE7B058887F8E,0xE65FD013872E3E06,0x7A6DDBBBD30EC4E2,0xAC97FC89CAAEF1B1, + 0x09CCB33C1E19DBE1,0x89F3EAC462EE1864,0x7770CF49AA87ADC6,0x56C57ECA6557F6D6, + 0x03953DDA6D6CFB9A,0x36928D884456E07C,0x1EEB8F37959F608D,0x31D6179C4EAAA923, + 0x6FAC3AD7E5C02662,0x43049FA653991456,0xABD3669DC052B8EE,0xAF02C153A7C20A2B, + 0x3CCB036E3723C007,0x93C9C23D90E1CA2C,0xC33BC65E2F6ED7D3,0x4CFF56339758249E, + 0xB1E94E64325D6AA6,0x37E16D359472420A,0x79F8E661BE623F78,0x5214D90402C74413, + 0x482EF1FDF0C8965B,0x13F69BC5EC1609A9,0x0E88292814E592BE,0x4E198B542A107D72, + 0xCCC00FCBEBAFE71B,0x1B49C844222B703E,0x2564164DA840E9D5,0x20C6513E1FF4F966, + 0xBAC3203F910CE8AB,0xF2EDD1C261C47EF0,0x814CB945ACD361F3,0x95FEB8944A392105, + 0x5C9CF02C1622D6AD,0x971865F3F77178E9,0xBD87BA2B9BF0A1F4,0x444005B259655D09, + 0xED75BE48247FBC0B,0x7596122E17CFF42A,0xB44B091785E97A15,0x966B854E2755DA9F, + 0xEEE0839249134791,0x32432A4623C652B9,0xA8465B47AD3E4374,0xF8B45F2412B15E8B, + 0x2417F6F078644BA3,0xFB2162FE7FDDA511,0x4BBBCC279DA46DC1,0x0173E0BDD024A276, + 0x22208C59A2BCA08A,0x8FC4906DB836F34D,0xE4B90D743A6667EA,0x7147B5E0705F46EF, + 0x2782CB2A1508B039,0xEC065EF5F45B1E7D,0x21B5B183CFD05B10,0xDBE733C060295C77, + 0x9FA73672394C017E,0xCF55321186C31C81,0xD8720E1A0D45A7ED,0x3B8F997A3DDF8958, + 0x3AFC79C7EDFB2B2E,0xE9A4198643EF0ECE,0x5F09CDF67B4E2D37,0x4F6A6BE9FA34DF04, + 0xB6ADD47038A123F9,0x8D224D0A057EAAA1,0xC96248B85C1BF7A8,0xE3FD9760309A2EB5, + 0x0B2A6E5BA351820D,0xEB42C4E1FEA75722,0x948D58299A1D8373,0x7FCF9CC864BAD451, + 0xA55B4FB5D4B72A50,0x08BF5381CE3D7997,0x46A6D8D5E42D04E5,0xD22B80FC7E308796, + 0x57B69E77B57354A0,0x3969441D8097D0B4,0x3330CAFBF3E2F0CF,0xE28E77DDE0BE8CC3, + 0x62B12E259C494F46,0xA6CE726FB9DBD1CA,0x41E242C1EED14DBA,0x76032FF47AA30FB0 +},{ + 0x45B268A93ACDE4CC,0xAF7F0BE884549D08,0x048354B3C1468263,0x925435C2C80EFED2, + 0xEE4E37F27FDFFBA7,0x167A33920C60F14D,0xFB123B52EA03E584,0x4A0CAB53FDBB9007, + 0x9DEAF6380F788A19,0xCB48EC558F0CB32A,0xB59DC4B2D6FEF7E0,0xDCDBCA22F4F3ECB6, + 0x11DF5813549A9C40,0xE33FDEDF568ACED3,0xA0C1C8124322E9C3,0x07A56B8158FA6D0D, + 0x77279579B1E1F3DD,0xD9B18B74422AC004,0xB8EC2D9FFFABC294,0xF4ACF8A82D75914F, + 0x7BBF69B1EF2B6878,0xC4F62FAF487AC7E1,0x76CE809CC67E5D0C,0x6711D88F92E4C14C, + 0x627B99D9243DEDFE,0x234AA5C3DFB68B51,0x909B1F15262DBF6D,0x4F66EA054B62BCB5, + 0x1AE2CF5A52AA6AE8,0xBEA053FBD0CE0148,0xED6808C0E66314C9,0x43FE16CD15A82710, + 0xCD049231A06970F6,0xE7BC8A6C97CC4CB0,0x337CE835FCB3B9C0,0x65DEF2587CC780F3, + 0x52214EDE4132BB50,0x95F15E4390F493DF,0x870839625DD2E0F1,0x41313C1AFB8B66AF, + 0x91720AF051B211BC,0x477D427ED4EEA573,0x2E3B4CEEF6E3BE25,0x82627834EB0BCC43, + 0x9C03E3DD78E724C8,0x2877328AD9867DF9,0x14B51945E243B0F2,0x574B0F88F7EB97E2, + 0x88B6FA989AA4943A,0x19C4F068CB168586,0x50EE6409AF11FAEF,0x7DF317D5C04EABA4, + 0x7A567C5498B4C6A9,0xB6BBFB804F42188E,0x3CC22BCF3BC5CD0B,0xD04336EAAA397713, + 0xF02FAC1BEC33132C,0x2506DBA7F0D3488D,0xD7E65D6BF2C31A1E,0x5EB9B2161FF820F5, + 0x842E0650C46E0F9F,0x716BEB1D9E843001,0xA933758CAB315ED4,0x3FE414FDA2792265, + 0x27C9F1701EF00932,0x73A4C1CA70A771BE,0x94184BA6E76B3D0E,0x40D829FF8C14C87E, + 0x0FBEC3FAC77674CB,0x3616A9634A6A9572,0x8F139119C25EF937,0xF545ED4D5AEA3F9E, + 0xE802499650BA387B,0x6437E7BD0B582E22,0xE6559F89E053E261,0x80AD52E305288DFC, + 0x6DC55A23E34B9935,0xDE14E0F51AD0AD09,0xC6390578A659865E,0x96D7617109487CB1, + 0xE2D6CB3A21156002,0x01E915E5779FAED1,0xADB0213F6A77DCB7,0x9880B76EB9A1A6AB, + 0x5D9F8D248644CF9B,0xFD5E4536C5662658,0xF1C6B9FE9BACBDFD,0xEACD6341BE9979C4, + 0xEFA7221708405576,0x510771ECD88E543E,0xC2BA51CB671F043D,0x0AD482AC71AF5879, + 0xFE787A045CDAC936,0xB238AF338E049AED,0xBD866CC94972EE26,0x615DA6EBBD810290, + 0x3295FDD08B2C1711,0xF834046073BF0AEA,0xF3099329758FFC42,0x1CAEB13E7DCFA934, + 0xBA2307481188832B,0x24EFCE42874CE65C,0x0E57D61FB0E9DA1A,0xB3D1BAD6F99B343C, + 0xC0757B1C893C4582,0x2B510DB8403A9297,0x5C7698C1F1DB614A,0x3E0D0118D5E68CB4, + 0xD60F488E855CB4CF,0xAE961E0DF3CB33D9,0x3A8E55AB14A00ED7,0x42170328623789C1, + 0x838B6DD19C946292,0x895FEF7DED3B3AEB,0xCFCBB8E64E4A3149,0x064C7E642F65C3DC, + 0x3D2B3E2A4C5A63DA,0x5BD3F340A9210C47,0xB474D157A1615931,0xAC5934DA1DE87266, + 0x6EE365117AF7765B,0xC86ED36716B05C44,0x9BA6885C201D49C5,0xB905387A88346C45, + 0x131072C4BAB9DDFF,0xBF49461EA751AF99,0xD52977BC1CE05BA1,0xB0F785E46027DB52, + 0x546D30BA6E57788C,0x305AD707650F56AE,0xC987C682612FF295,0xA5AB8944F5FBC571, + 0x7ED528E759F244CA,0x8DDCBBCE2C7DB888,0xAA154ABE328DB1BA,0x1E619BE993ECE88B, + 0x09F2BD9EE813B717,0x7401AA4B285D1CB3,0x21858F143195CAEE,0x48C381841398D1B8, + 0xFCB750D3B2F98889,0x39A86A998D1CE1B9,0x1F888E0CE473465A,0x7899568376978716, + 0x02CF2AD7EE2341BF,0x85C713B5B3F1A14E,0xFF916FE12B4567E7,0x7C1A0230B7D10575, + 0x0C98FCC85ECA9BA5,0xA3E7F720DA9E06AD,0x6A6031A2BBB1F438,0x973E74947ED7D260, + 0x2CF4663918C0FF9A,0x5F50A7F368678E24,0x34D983B4A449D4CD,0x68AF1B755592B587, + 0x7F3C3D022E6DEA1B,0xABFC5F5B45121F6B,0x0D71E92D29553574,0xDFFDF5106D4F03D8, + 0x081BA87B9F8C19C6,0xDB7EA1A3AC0981BB,0xBBCA12AD66172DFA,0x79704366010829C7, + 0x179326777BFF5F9C,0x0000000000000000,0xEB2476A4C906D715,0x724DD42F0738DF6F, + 0xB752EE6538DDB65F,0x37FFBC863DF53BA3,0x8EFA84FCB5C157E6,0xE9EB5C73272596AA, + 0x1B0BDABF2535C439,0x86E12C872A4D4E20,0x9969A28BCE3E087A,0xFAFB2EB79D9C4B55, + 0x056A4156B6D92CB2,0x5A3AE6A5DEBEA296,0x22A3B026A8292580,0x53C85B3B36AD1581, + 0xB11E900117B87583,0xC51F3A4A3FE56930,0xE019E1EDCF3621BD,0xEC811D2591FCBA18, + 0x445B7D4C4D524A1D,0xA8DA6069DCAEF005,0x58F5CC72309DE329,0xD4C062596B7FF570, + 0xCE22AD0339D59F98,0x591CD99747024DF8,0x8B90C5AA03187B54,0xF663D27FC356D0F0, + 0xD8589E9135B56ED5,0x35309651D3D67A1C,0x12F96721CD26732E,0xD28C1C3D441A36AC, + 0x492A946164077F69,0x2D1D73DC6F5F514B,0x6F0A70F40D68D88A,0x60B4B30ECA1EAC41, + 0xD36509D83385987D,0x0B3D97490630F6A8,0x9ECCC90A96C46577,0xA20EE2C5AD01A87C, + 0xE49AB55E0E70A3DE,0xA4429CA182646BA0,0xDA97B446DB962F6A,0xCCED87D4D7F6DE27, + 0x2AB8185D37A53C46,0x9F25DCEFE15BCBA6,0xC19C6EF9FEA3EB53,0xA764A3931BD884CE, + 0x2FD2590B817C10F4,0x56A21A6D80743933,0xE573A0BB79EF0D0F,0x155C0CA095DC1E23, + 0x6C2C4FC694D437E4,0x10364DF623053291,0xDD32DFC7836C4267,0x03263F3299BCEF6E, + 0x66F8CD6AE57B6F9D,0x8C35AE2B5BE21659,0x31B3C2E21290F87F,0x93BD2027BF915003, + 0x69460E90220D1B56,0x299E276FAE19D328,0x63928C3C53A2432F,0x7082FEF8E91B9ED0, + 0xBC6F792C3EED40F7,0x4C40D537D2DE53DB,0x75E8BFAE5FC2B262,0x4DA9C0D2A541FD0A, + 0x4E8FFFE03CFD1264,0x2620E495696FA7E3,0xE1F0F408B8A98F6C,0xD1AA230FDDA6D9C2, + 0xC7D0109DD1C6288F,0x8A79D04F7487D585,0x4694579BA3710BA2,0x38417F7CFA834F68, + 0x1D47A4DB0A5007E5,0x206C9AF1460A643F,0xA128DDF734BD4712,0x8144470672B7232D, + 0xF2E086CC02105293,0x182DE58DBC892B57,0xCAA1F9B0F8931DFB,0x6B892447CC2E5AE9, + 0xF9DD11850420A43B,0x4BE5BEB68A243ED6,0x5584255F19C8D65D,0x3B67404E633FA006, + 0xA68DB6766C472A1F,0xF78AC79AB4C97E21,0xC353442E1080AAEC,0x9A4F9DB95782E714 +},{ + 0x05BA7BC82C9B3220,0x31A54665F8B65E4F,0xB1B651F77547F4D4,0x8BFA0D857BA46682, + 0x85A96C5AA16A98BB,0x990FAEF908EB79C9,0xA15E37A247F4A62D,0x76857DCD5D27741E, + 0xF8C50B800A1820BC,0xBE65DCB201F7A2B4,0x666D1B986F9426E7,0x4CC921BF53C4E648, + 0x95410A0F93D9CA42,0x20CDCCAA647BA4EF,0x429A4060890A1871,0x0C4EA4F69B32B38B, + 0xCCDA362DDE354CD3,0x96DC23BC7C5B2FA9,0xC309BB68AA851AB3,0xD26131A73648E013, + 0x021DC52941FC4DB2,0xCD5ADAB7704BE48A,0xA77965D984ED71E6,0x32386FD61734BBA4, + 0xE82D6DD538AB7245,0x5C2147EA6177B4B1,0x5DA1AB70CF091CE8,0xAC907FCE72B8BDFF, + 0x57C85DFD972278A8,0xA4E44C6A6B6F940D,0x3851995B4F1FDFE4,0x62578CCAED71BC9E, + 0xD9882BB0C01D2C0A,0x917B9D5D113C503B,0xA2C31E11A87643C6,0xE463C923A399C1CE, + 0xF71686C57EA876DC,0x87B4A973E096D509,0xAF0D567D9D3A5814,0xB40C2A3F59DCC6F4, + 0x3602F88495D121DD,0xD3E1DD3D9836484A,0xF945E71AA46688E5,0x7518547EB2A591F5, + 0x9366587450C01D89,0x9EA81018658C065B,0x4F54080CBC4603A3,0x2D0384C65137BF3D, + 0xDC325078EC861E2A,0xEA30A8FC79573FF7,0x214D2030CA050CB6,0x65F0322B8016C30C, + 0x69BE96DD1B247087,0xDB95EE9981E161B8,0xD1FC1814D9CA05F8,0x820ED2BBCC0DE729, + 0x63D76050430F14C7,0x3BCCB0E8A09D3A0F,0x8E40764D573F54A2,0x39D175C1E16177BD, + 0x12F5A37C734F1F4B,0xAB37C12F1FDFC26D,0x5648B167395CD0F1,0x6C04ED1537BF42A7, + 0xED97161D14304065,0x7D6C67DAAB72B807,0xEC17FA87BA4EE83C,0xDFAF79CB0304FBC1, + 0x733F060571BC463E,0x78D61C1287E98A27,0xD07CF48E77B4ADA1,0xB9C262536C90DD26, + 0xE2449B5860801605,0x8FC09AD7F941FCFB,0xFAD8CEA94BE46D0E,0xA343F28B0608EB9F, + 0x9B126BD04917347B,0x9A92874AE7699C22,0x1B017C42C4E69EE0,0x3A4C5C720EE39256, + 0x4B6E9F5E3EA399DA,0x6BA353F45AD83D35,0xE7FEE0904C1B2425,0x22D009832587E95D, + 0x842980C00F1430E2,0xC6B3C0A0861E2893,0x087433A419D729F2,0x341F3DADD42D6C6F, + 0xEE0A3FAEFBB2A58E,0x4AEE73C490DD3183,0xAAB72DB5B1A16A34,0xA92A04065E238FDF, + 0x7B4B35A1686B6FCC,0x6A23BF6EF4A6956C,0x191CB96B851AD352,0x55D598D4D6DE351A, + 0xC9604DE5F2AE7EF3,0x1CA6C2A3A981E172,0xDE2F9551AD7A5398,0x3025AAFF56C8F616, + 0x15521D9D1E2860D9,0x506FE31CFA45073A,0x189C55F12B647B0B,0x0180EC9AAE7EA859, + 0x7CEC8B40050C105E,0x2350E5198BF94104,0xEF8AD33455CC0DD7,0x07A7BEE16D677F92, + 0xE5E325B90DE76997,0x5A061591A26E637A,0xB611EF1618208B46,0x09F4DF3EB7A981AB, + 0x1EBB078AE87DACC0,0xB791038CB65E231F,0x0FD38D4574B05660,0x67EDF702C1EA8EBE, + 0xBA5F4BE0831238CD,0xE3C477C2CEFEBE5C,0x0DCE486C354C1BD2,0x8C5DB36416C31910, + 0x26EA9ED1A7627324,0x039D29B3EF82E5EB,0x9F28FC82CBF2AE02,0xA8AAE89CF05D2786, + 0x431AACFA2774B028,0xCF471F9E31B7A938,0x581BD0B8E3922EC8,0xBC78199B400BEF06, + 0x90FB71C7BF42F862,0x1F3BEB1046030499,0x683E7A47B55AD8DE,0x988F4263A695D190, + 0xD808C72A6E638453,0x0627527BC319D7CB,0xEBB04466D72997AE,0xE67E0C0AE2658C7C, + 0x14D2F107B056C880,0x7122C32C30400B8C,0x8A7AE11FD5DACEDB,0xA0DEDB38E98A0E74, + 0xAD109354DCC615A6,0x0BE91A17F655CC19,0x8DDD5FFEB8BDB149,0xBFE53028AF890AED, + 0xD65BA6F5B4AD7A6A,0x7956F0882997227E,0x10E8665532B352F9,0x0E5361DFDACEFE39, + 0xCEC7F3049FC90161,0xFF62B561677F5F2E,0x975CCF26D22587F0,0x51EF0F86543BAF63, + 0x2F1E41EF10CBF28F,0x52722635BBB94A88,0xAE8DBAE73344F04D,0x410769D36688FD9A, + 0xB3AB94DE34BBB966,0x801317928DF1AA9B,0xA564A0F0C5113C54,0xF131D4BEBDB1A117, + 0x7F71A2F3EA8EF5B5,0x40878549C8F655C3,0x7EF14E6944F05DEC,0xD44663DCF55137D8, + 0xF2ACFD0D523344FC,0x0000000000000000,0x5FBC6E598EF5515A,0x16CF342EF1AA8532, + 0xB036BD6DDB395C8D,0x13754FE6DD31B712,0xBBDFA77A2D6C9094,0x89E7C8AC3A582B30, + 0x3C6B0E09CDFA459D,0xC4AE0589C7E26521,0x49735A777F5FD468,0xCAFD64561D2C9B18, + 0xDA1502032F9FC9E1,0x8867243694268369,0x3782141E3BAF8984,0x9CB5D53124704BE9, + 0xD7DB4A6F1AD3D233,0xA6F989432A93D9BF,0x9D3539AB8A0EE3B0,0x53F2CAAF15C7E2D1, + 0x6E19283C76430F15,0x3DEBE2936384EDC4,0x5E3C82C3208BF903,0x33B8834CB94A13FD, + 0x6470DEB12E686B55,0x359FD1377A53C436,0x61CAA57902F35975,0x043A975282E59A79, + 0xFD7F70482683129C,0xC52EE913699CCD78,0x28B9FF0E7DAC8D1D,0x5455744E78A09D43, + 0xCB7D88CCB3523341,0x44BD121B4A13CFBA,0x4D49CD25FDBA4E11,0x3E76CB208C06082F, + 0x3FF627BA2278A076,0xC28957F204FBB2EA,0x453DFE81E46D67E3,0x94C1E6953DA7621B, + 0x2C83685CFF491764,0xF32C1197FC4DECA5,0x2B24D6BD922E68F6,0xB22B78449AC5113F, + 0x48F3B6EDD1217C31,0x2E9EAD75BEB55AD6,0x174FD8B45FD42D6B,0x4ED4E4961238ABFA, + 0x92E6B4EEFEBEB5D0,0x46A0D7320BEF8208,0x47203BA8A5912A51,0x24F75BF8E69E3E96, + 0xF0B1382413CF094E,0xFEE259FBC901F777,0x276A724B091CDB7D,0xBDF8F501EE75475F, + 0x599B3C224DEC8691,0x6D84018F99C1EAFE,0x7498B8E41CDB39AC,0xE0595E71217C5BB7, + 0x2AA43A273C50C0AF,0xF50B43EC3F543B6E,0x838E3E2162734F70,0xC09492DB4507FF58, + 0x72BFEA9FDFC2EE67,0x11688ACF9CCDFAA0,0x1A8190D86A9836B9,0x7ACBD93BC615C795, + 0xC7332C3A286080CA,0x863445E94EE87D50,0xF6966A5FD0D6DE85,0xE9AD814F96D5DA1C, + 0x70A22FB69E3EA3D5,0x0A69F68D582B6440,0xB8428EC9C2EE757F,0x604A49E3AC8DF12C, + 0x5B86F90B0C10CB23,0xE1D9B2EB8F02F3EE,0x29391394D3D22544,0xC8E0A17F5CD0D6AA, + 0xB58CC6A5F7A26EAD,0x8193FB08238F02C2,0xD5C68F465B2F9F81,0xFCFF9CD288FDBAC5, + 0x77059157F359DC47,0x1D262E3907FF492B,0xFB582233E59AC557,0xDDB2BCE242F8B673, + 0x2577B76248E096CF,0x6F99C4A6D83DA74C,0xC1147E41EB795701,0xF48BAF76912A9337 +},{ + 0x3EF29D249B2C0A19,0xE9E16322B6F8622F,0x5536994047757F7A,0x9F4D56D5A47B0B33, + 0x822567466AA1174C,0xB8F5057DEB082FB2,0xCC48C10BF4475F53,0x373088D4275DEC3A, + 0x968F4325180AED10,0x173D232CF7016151,0xAE4ED09F946FCC13,0xFD4B4741C4539873, + 0x1B5B3F0DD9933765,0x2FFCB0967B644052,0xE02376D20A89840C,0xA3AE3A70329B18D7, + 0x419CBD2335DE8526,0xFAFEBF115B7C3199,0x0397074F85AA9B0D,0xC58AD4FB4836B970, + 0xBEC60BE3FC4104A8,0x1EFF36DC4B708772,0x131FDC33ED8453B6,0x0844E33E341764D3, + 0x0FF11B6EAB38CD39,0x64351F0A7761B85A,0x3B5694F509CFBA0E,0x30857084B87245D0, + 0x47AFB3BD2297AE3C,0xF2BA5C2F6F6B554A,0x74BDC4761F4F70E1,0xCFDFC64471EDC45E, + 0xE610784C1DC0AF16,0x7ACA29D63C113F28,0x2DED411776A859AF,0xAC5F211E99A3D5EE, + 0xD484F949A87EF33B,0x3CE36CA596E013E4,0xD120F0983A9D432C,0x6BC40464DC597563, + 0x69D5F5E5D1956C9E,0x9AE95F043698BB24,0xC9ECC8DA66A4EF44,0xD69508C8A5B2EAC6, + 0xC40C2235C0503B80,0x38C193BA8C652103,0x1CEEC75D46BC9E8F,0xD331011937515AD1, + 0xD8E2E56886ECA50F,0xB137108D5779C991,0x709F3B6905CA4206,0x4FEB50831680CAEF, + 0xEC456AF3241BD238,0x58D673AFE181ABBE,0x242F54E7CAD9BF8C,0x0211F1810DCC19FD, + 0x90BC4DBB0F43C60A,0x9518446A9DA0761D,0xA1BFCBF13F57012A,0x2BDE4F8961E172B5, + 0x27B853A84F732481,0xB0B1E643DF1F4B61,0x18CC38425C39AC68,0xD2B7F7D7BF37D821, + 0x3103864A3014C720,0x14AA246372ABFA5C,0x6E600DB54EBAC574,0x394765740403A3F3, + 0x09C215F0BC71E623,0x2A58B947E987F045,0x7B4CDF18B477BDD8,0x9709B5EB906C6FE0, + 0x73083C268060D90B,0xFEDC400E41F9037E,0x284948C6E44BE9B8,0x728ECAE808065BFB, + 0x06330E9E17492B1A,0x5950856169E7294E,0xBAE4F4FCE6C4364F,0xCA7BCF95E30E7449, + 0x7D7FD186A33E96C2,0x52836110D85AD690,0x4DFAA1021B4CD312,0x913ABB75872544FA, + 0xDD46ECB9140F1518,0x3D659A6B1E869114,0xC23F2CABD719109A,0xD713FE062DD46836, + 0xD0A60656B2FBC1DC,0x221C5A79DD909496,0xEFD26DBCA1B14935,0x0E77EDA0235E4FC9, + 0xCBFD395B6B68F6B9,0x0DE0EAEFA6F4D4C4,0x0422FF1F1A8532E7,0xF969B85EDED6AA94, + 0x7F6E2007AEF28F3F,0x3AD0623B81A938FE,0x6624EE8B7AADA1A7,0xB682E8DDC856607B, + 0xA78CC56F281E2A30,0xC79B257A45FAA08D,0x5B4174E0642B30B3,0x5F638BFF7EAE0254, + 0x4BC9AF9C0C05F808,0xCE59308AF98B46AE,0x8FC58DA9CC55C388,0x803496C7676D0EB1, + 0xF33CAAE1E70DD7BA,0xBB6202326EA2B4BF,0xD5020F87201871CB,0x9D5CA754A9B712CE, + 0x841669D87DE83C56,0x8A6184785EB6739F,0x420BBA6CB0741E2B,0xF12D5B60EAC1CE47, + 0x76AC35F71283691C,0x2C6BB7D9FECEDB5F,0xFCCDB18F4C351A83,0x1F79C012C3160582, + 0xF0ABADAE62A74CB7,0xE1A5801C82EF06FC,0x67A21845F2CB2357,0x5114665F5DF04D9D, + 0xBF40FD2D74278658,0xA0393D3FB73183DA,0x05A409D192E3B017,0xA9FB28CF0B4065F9, + 0x25A9A22942BF3D7C,0xDB75E22703463E02,0xB326E10C5AB5D06C,0xE7968E8295A62DE6, + 0xB973F3B3636EAD42,0xDF571D3819C30CE5,0xEE549B7229D7CBC5,0x12992AFD65E2D146, + 0xF8EF4E9056B02864,0xB7041E134030E28B,0xC02EDD2ADAD50967,0x932B4AF48AE95D07, + 0x6FE6FB7BC6DC4784,0x239AACB755F61666,0x401A4BEDBDB807D6,0x485EA8D389AF6305, + 0xA41BC220ADB4B13D,0x753B32B89729F211,0x997E584BB3322029,0x1D683193CEDA1C7F, + 0xFF5AB6C0C99F818E,0x16BBD5E27F67E3A1,0xA59D34EE25D233CD,0x98F8AE853B54A2D9, + 0x6DF70AFACB105E79,0x795D2E99B9BBA425,0x8E437B6744334178,0x0186F6CE886682F0, + 0xEBF092A3BB347BD2,0xBCD7FA62F18D1D55,0xADD9D7D011C5571E,0x0BD3E471B1BDFFDE, + 0xAA6C2F808EEAFEF4,0x5EE57D31F6C880A4,0xF50FA47FF044FCA0,0x1ADDC9C351F5B595, + 0xEA76646D3352F922,0x0000000000000000,0x85909F16F58EBEA6,0x46294573AAF12CCC, + 0x0A5512BF39DB7D2E,0x78DBD85731DD26D5,0x29CFBE086C2D6B48,0x218B5D36583A0F9B, + 0x152CD2ADFACD78AC,0x83A39188E2C795BC,0xC3B9DA655F7F926A,0x9ECBA01B2C1D89C3, + 0x07B5F8509F2FA9EA,0x7EE8D6C926940DCF,0x36B67E1AAF3B6ECA,0x86079859702425AB, + 0xFB7849DFD31AB369,0x4C7C57CC932A51E2,0xD96413A60E8A27FF,0x263EA566C715A671, + 0x6C71FC344376DC89,0x4A4F595284637AF8,0xDAF314E98B20BCF2,0x572768C14AB96687, + 0x1088DB7C682EC8BB,0x887075F9537A6A62,0x2E7A4658F302C2A2,0x619116DBE582084D, + 0xA87DDE018326E709,0xDCC01A779C6997E8,0xEDC39C3DAC7D50C8,0xA60A33A1A078A8C0, + 0xC1A82BE452B38B97,0x3F746BEA134A88E9,0xA228CCBEBAFD9A27,0xABEAD94E068C7C04, + 0xF48952B178227E50,0x5CF48CB0FB049959,0x6017E0156DE48ABD,0x4438B4F2A73D3531, + 0x8C528AE649FF5885,0xB515EF924DFCFB76,0x0C661C212E925634,0xB493195CC59A7986, + 0x9CDA519A21D1903E,0x32948105B5BE5C2D,0x194ACE8CD45F2E98,0x438D4CA238129CDB, + 0x9B6FA9CABEFE39D4,0x81B26009EF0B8C41,0xDED1EBF691A58E15,0x4E6DA64D9EE6481F, + 0x54B06F8ECF13FD8A,0x49D85E1D01C9E1F5,0xAFC826511C094EE3,0xF698A33075EE67AD, + 0x5AC7822EEC4DB243,0x8DD47C28C199DA75,0x89F68337DB1CE892,0xCDCE37C57C21DDA3, + 0x530597DE503C5460,0x6A42F2AA543FF793,0x5D727A7E73621BA9,0xE232875307459DF1, + 0x56A19E0FC2DFE477,0xC61DD3B4CD9C227D,0xE5877F03986A341B,0x949EB2A415C6F4ED, + 0x6206119460289340,0x6380E75AE84E11B0,0x8BE772B6D6D0F16F,0x50929091D596CF6D, + 0xE86795EC3E9EE0DF,0x7CF927482B581432,0xC86A3E14EEC26DB4,0x7119CDA78DACC0F6, + 0xE40189CD100CB6EB,0x92ADBC3A028FDFF7,0xB2A017C2D2D3529C,0x200DABF8D05C8D6B, + 0x34A78F9BA2F77737,0xE3B4719D8F231F01,0x45BE423C2F5BB7C1,0xF71E55FEFD88E55D, + 0x6853032B59F3EE6E,0x65B3E9C4FF073AAA,0x772AC3399AE5EBEC,0x87816E97F842A75B, + 0x110E2DB2E0484A4B,0x331277CB3DD8DEDD,0xBD510CAC79EB9FA5,0x352179552A91F5C7 +},{ + 0x8AB0A96846E06A6D,0x43C7E80B4BF0B33A,0x08C9B3546B161EE5,0x39F1C235EBA990BE, + 0xC1BEF2376606C7B2,0x2C209233614569AA,0xEB01523B6FC3289A,0x946953AB935ACEDD, + 0x272838F63E13340E,0x8B0455ECA12BA052,0x77A1B2C4978FF8A2,0xA55122CA13E54086, + 0x2276135862D3F1CD,0xDB8DDFDE08B76CFE,0x5D1E12C89E4A178A,0x0E56816B03969867, + 0xEE5F79953303ED59,0xAFED748BAB78D71D,0x6D929F2DF93E53EE,0xF5D8A8F8BA798C2A, + 0xF619B1698E39CF6B,0x95DDAF2F749104E2,0xEC2A9C80E0886427,0xCE5C8FD8825B95EA, + 0xC4E0D9993AC60271,0x4699C3A5173076F9,0x3D1B151F50A29F42,0x9ED505EA2BC75946, + 0x34665ACFDC7F4B98,0x61B1FB53292342F7,0xC721C0080E864130,0x8693CD1696FD7B74, + 0x872731927136B14B,0xD3446C8A63A1721B,0x669A35E8A6680E4A,0xCAB658F239509A16, + 0xA4E5DE4EF42E8AB9,0x37A7435EE83F08D9,0x134E6239E26C7F96,0x82791A3C2DF67488, + 0x3F6EF00A8329163C,0x8E5A7E42FDEB6591,0x5CAAEE4C7981DDB5,0x19F234785AF1E80D, + 0x255DDDE3ED98BD70,0x50898A32A99CCCAC,0x28CA4519DA4E6656,0xAE59880F4CB31D22, + 0x0D9798FA37D6DB26,0x32F968F0B4FFCD1A,0xA00F09644F258545,0xFA3AD5175E24DE72, + 0xF46C547C5DB24615,0x713E80FBFF0F7E20,0x7843CF2B73D2AAFA,0xBD17EA36AEDF62B4, + 0xFD111BACD16F92CF,0x4ABAA7DBC72D67E0,0xB3416B5DAD49FAD3,0xBCA316B24914A88B, + 0x15D150068AECF914,0xE27C1DEBE31EFC40,0x4FE48C759BEDA223,0x7EDCFD141B522C78, + 0x4E5070F17C26681C,0xE696CAC15815F3BC,0x35D2A64B3BB481A7,0x800CFF29FE7DFDF6, + 0x1ED9FAC3D5BAA4B0,0x6C2663A91EF599D1,0x03C1199134404341,0xF7AD4DED69F20554, + 0xCD9D9649B61BD6AB,0xC8C3BDE7EADB1368,0xD131899FB02AFB65,0x1D18E352E1FAE7F1, + 0xDA39235AEF7CA6C1,0xA1BBF5E0A8EE4F7A,0x91377805CF9A0B1E,0x3138716180BF8E5B, + 0xD9F83ACBDB3CE580,0x0275E515D38B897E,0x472D3F21F0FBBCC6,0x2D946EB7868EA395, + 0xBA3C248D21942E09,0xE7223645BFDE3983,0xFF64FEB902E41BB1,0xC97741630D10D957, + 0xC3CB1722B58D4ECC,0xA27AEC719CAE0C3B,0x99FECB51A48C15FB,0x1465AC826D27332B, + 0xE1BD047AD75EBF01,0x79F733AF941960C5,0x672EC96C41A3C475,0xC27FEBA6524684F3, + 0x64EFD0FD75E38734,0xED9E60040743AE18,0xFB8E2993B9EF144D,0x38453EB10C625A81, + 0x6978480742355C12,0x48CF42CE14A6EE9E,0x1CAC1FD606312DCE,0x7B82D6BA4792E9BB, + 0x9D141C7B1F871A07,0x5616B80DC11C4A2E,0xB849C198F21FA777,0x7CA91801C8D9A506, + 0xB1348E487EC273AD,0x41B20D1E987B3A44,0x7460AB55A3CFBBE3,0x84E628034576F20A, + 0x1B87D16D897A6173,0x0FE27DEFE45D5258,0x83CDE6B8CA3DBEB7,0x0C23647ED01D1119, + 0x7A362A3EA0592384,0xB61F40F3F1893F10,0x75D457D1440471DC,0x4558DA34237035B8, + 0xDCA6116587FC2043,0x8D9B67D3C9AB26D0,0x2B0B5C88EE0E2517,0x6FE77A382AB5DA90, + 0x269CC472D9D8FE31,0x63C41E46FAA8CB89,0xB7ABBC771642F52F,0x7D1DE4852F126F39, + 0xA8C6BA3024339BA0,0x600507D7CEE888C8,0x8FEE82C61A20AFAE,0x57A2448926D78011, + 0xFCA5E72836A458F0,0x072BCEBB8F4B4CBD,0x497BBE4AF36D24A1,0x3CAFE99BB769557D, + 0x12FA9EBD05A7B5A9,0xE8C04BAA5B836BDB,0x4273148FAC3B7905,0x908384812851C121, + 0xE557D3506C55B0FD,0x72FF996ACB4F3D61,0x3EDA0C8E64E2DC03,0xF0868356E6B949E9, + 0x04EAD72ABB0B0FFC,0x17A4B5135967706A,0xE3C8E16F04D5367F,0xF84F30028DAF570C, + 0x1846C8FCBD3A2232,0x5B8120F7F6CA9108,0xD46FA231ECEA3EA6,0x334D947453340725, + 0x58403966C28AD249,0xBED6F3A79A9F21F5,0x68CCB483A5FE962D,0xD085751B57E1315A, + 0xFED0023DE52FD18E,0x4B0E5B5F20E6ADDF,0x1A332DE96EB1AB4C,0xA3CE10F57B65C604, + 0x108F7BA8D62C3CD7,0xAB07A3A11073D8E1,0x6B0DAD1291BED56C,0xF2F366433532C097, + 0x2E557726B2CEE0D4,0x0000000000000000,0xCB02A476DE9B5029,0xE4E32FD48B9E7AC2, + 0x734B65EE2C84F75E,0x6E5386BCCD7E10AF,0x01B4FC84E7CBCA3F,0xCFE8735C65905FD5, + 0x3613BFDA0FF4C2E6,0x113B872C31E7F6E8,0x2FE18BA255052AEB,0xE974B72EBC48A1E4, + 0x0ABC5641B89D979B,0xB46AA5E62202B66E,0x44EC26B0C4BBFF87,0xA6903B5B27A503C7, + 0x7F680190FC99E647,0x97A84A3AA71A8D9C,0xDD12EDE16037EA7C,0xC554251DDD0DC84E, + 0x88C54C7D956BE313,0x4D91696048662B5D,0xB08072CC9909B992,0xB5DE5962C5C97C51, + 0x81B803AD19B637C9,0xB2F597D94A8230EC,0x0B08AAC55F565DA4,0xF1327FD2017283D6, + 0xAD98919E78F35E63,0x6AB9519676751F53,0x24E921670A53774F,0xB9FD3D1C15D46D48, + 0x92F66194FBDA485F,0x5A35DC7311015B37,0xDED3F4705477A93D,0xC00A0EB381CD0D8D, + 0xBB88D809C65FE436,0x16104997BEACBA55,0x21B70AC95693B28C,0x59F4C5E225411876, + 0xD5DB5EB50B21F499,0x55D7A19CF55C096F,0xA97246B4C3F8519F,0x8552D487A2BD3835, + 0x54635D181297C350,0x23C2EFDC85183BF2,0x9F61F96ECC0C9379,0x534893A39DDC8FED, + 0x5EDF0B59AA0A54CB,0xAC2C6D1A9F38945C,0xD7AEBBA0D8AA7DE7,0x2ABFA00C09C5EF28, + 0xD84CC64F3CF72FBF,0x2003F64DB15878B3,0xA724C7DFC06EC9F8,0x069F323F68808682, + 0xCC296ACD51D01C94,0x055E2BAE5CC0C5C3,0x6270E2C21D6301B6,0x3B842720382219C0, + 0xD2F0900E846AB824,0x52FC6F277A1745D2,0xC6953C8CE94D8B0F,0xE009F8FE3095753E, + 0x655B2C7992284D0B,0x984A37D54347DFC4,0xEAB5AEBF8808E2A5,0x9A3FD2C090CC56BA, + 0x9CA0E0FFF84CD038,0x4C2595E4AFADE162,0xDF6708F4B3BC6302,0xBF620F237D54EBCA, + 0x93429D101C118260,0x097D4FD08CDDD4DA,0x8C2F9B572E60ECEF,0x708A7C7F18C4B41F, + 0x3A30DBA4DFE9D3FF,0x4006F19A7FB0F07B,0x5F6BF7DD4DC19EF4,0x1F6D064732716E8F, + 0xF9FBCC866A649D33,0x308C8DE567744464,0x8971B0F972A0292C,0xD61A47243F61B7D8, + 0xEFEB8511D4C82766,0x961CB6BE40D147A3,0xAAB35F25F7B812DE,0x76154E407044329D, + 0x513D76B64E570693,0xF3479AC7D2F90AA8,0x9B8B2E4477079C85,0x297EB99D3D85AC69 +},{ + 0x7E37E62DFC7D40C3,0x776F25A4EE939E5B,0xE045C850DD8FB5AD,0x86ED5BA711FF1952, + 0xE91D0BD9CF616B35,0x37E0AB256E408FFB,0x9607F6C031025A7A,0x0B02F5E116D23C9D, + 0xF3D8486BFB50650C,0x621CFF27C40875F5,0x7D40CB71FA5FD34A,0x6DAA6616DAA29062, + 0x9F5F354923EC84E2,0xEC847C3DC507C3B3,0x025A3668043CE205,0xA8BF9E6C4DAC0B19, + 0xFA808BE2E9BEBB94,0xB5B99C5277C74FA3,0x78D9BC95F0397BCC,0xE332E50CDBAD2624, + 0xC74FCE129332797E,0x1729ECEB2EA709AB,0xC2D6B9F69954D1F8,0x5D898CBFBAB8551A, + 0x859A76FB17DD8ADB,0x1BE85886362F7FB5,0xF6413F8FF136CD8A,0xD3110FA5BBB7E35C, + 0x0A2FEED514CC4D11,0xE83010EDCD7F1AB9,0xA1E75DE55F42D581,0xEEDE4A55C13B21B6, + 0xF2F5535FF94E1480,0x0CC1B46D1888761E,0xBCE15FDB6529913B,0x2D25E8975A7181C2, + 0x71817F1CE2D7A554,0x2E52C5CB5C53124B,0xF9F7A6BEEF9C281D,0x9E722E7D21F2F56E, + 0xCE170D9B81DCA7E6,0x0E9B82051CB4941B,0x1E712F623C49D733,0x21E45CFA42F9F7DC, + 0xCB8E7A7F8BBA0F60,0x8E98831A010FB646,0x474CCF0D8E895B23,0xA99285584FB27A95, + 0x8CC2B57205335443,0x42D5B8E984EFF3A5,0x012D1B34021E718C,0x57A6626AAE74180B, + 0xFF19FC06E3D81312,0x35BA9D4D6A7C6DFE,0xC9D44C178F86ED65,0x506523E6A02E5288, + 0x03772D5C06229389,0x8B01F4FE0B691EC0,0xF8DABD8AED825991,0x4C4E3AEC985B67BE, + 0xB10DF0827FBF96A9,0x6A69279AD4F8DAE1,0xE78689DCD3D5FF2E,0x812E1A2B1FA553D1, + 0xFBAD90D6EBA0CA18,0x1AC543B234310E39,0x1604F7DF2CB97827,0xA6241C6951189F02, + 0x753513CCEAAF7C5E,0x64F2A59FC84C4EFA,0x247D2B1E489F5F5A,0xDB64D718AB474C48, + 0x79F4A7A1F2270A40,0x1573DA832A9BEBAE,0x3497867968621C72,0x514838D2A2302304, + 0xF0AF6537FD72F685,0x1D06023E3A6B44BA,0x678588C3CE6EDD73,0x66A893F7CC70ACFF, + 0xD4D24E29B5EDA9DF,0x3856321470EA6A6C,0x07C3418C0E5A4A83,0x2BCBB22F5635BACD, + 0x04B46CD00878D90A,0x06EE5AB80C443B0F,0x3B211F4876C8F9E5,0x0958C38912EEDE98, + 0xD14B39CDBF8B0159,0x397B292072F41BE0,0x87C0409313E168DE,0xAD26E98847CAA39F, + 0x4E140C849C6785BB,0xD5FF551DB7F3D853,0xA0CA46D15D5CA40D,0xCD6020C787FE346F, + 0x84B76DCF15C3FB57,0xDEFDA0FCA121E4CE,0x4B8D7B6096012D3D,0x9AC642AD298A2C64, + 0x0875D8BD10F0AF14,0xB357C6EA7B8374AC,0x4D6321D89A451632,0xEDA96709C719B23F, + 0xF76C24BBF328BC06,0xC662D526912C08F2,0x3CE25EC47892B366,0xB978283F6F4F39BD, + 0xC08C8F9E9D6833FD,0x4F3917B09E79F437,0x593DE06FB2C08C10,0xD6887841B1D14BDA, + 0x19B26EEE32139DB0,0xB494876675D93E2F,0x825937771987C058,0x90E9AC783D466175, + 0xF1827E03FF6C8709,0x945DC0A8353EB87F,0x4516F9658AB5B926,0x3F9573987EB020EF, + 0xB855330B6D514831,0x2AE6A91B542BCB41,0x6331E413C6160479,0x408F8E8180D311A0, + 0xEFF35161C325503A,0xD06622F9BD9570D5,0x8876D9A20D4B8D49,0xA5533135573A0C8B, + 0xE168D364DF91C421,0xF41B09E7F50A2F8F,0x12B09B0F24C1A12D,0xDA49CC2CA9593DC4, + 0x1F5C34563E57A6BF,0x54D14F36A8568B82,0xAF7CDFE043F6419A,0xEA6A2685C943F8BC, + 0xE5DCBFB4D7E91D2B,0xB27ADDDE799D0520,0x6B443CAED6E6AB6D,0x7BAE91C9F61BE845, + 0x3EB868AC7CAE5163,0x11C7B65322E332A4,0xD23C1491B9A992D0,0x8FB5982E0311C7CA, + 0x70AC6428E0C9D4D8,0x895BC2960F55FCC5,0x76423E90EC8DEFD7,0x6FF0507EDE9E7267, + 0x3DCF45F07A8CC2EA,0x4AA06054941F5CB1,0x5810FB5BB0DEFD9C,0x5EFEA1E3BC9AC693, + 0x6EDD4B4ADC8003EB,0x741808F8E8B10DD2,0x145EC1B728859A22,0x28BC9F7350172944, + 0x270A06424EBDCCD3,0x972AEDF4331C2BF6,0x059977E40A66A886,0x2550302A4A812ED6, + 0xDD8A8DA0A7037747,0xC515F87A970E9B7B,0x3023EAA9601AC578,0xB7E3AA3A73FBADA6, + 0x0FB699311EAAE597,0x0000000000000000,0x310EF19D6204B4F4,0x229371A644DB6455, + 0x0DECAF591A960792,0x5CA4978BB8A62496,0x1C2B190A38753536,0x41A295B582CD602C, + 0x3279DCC16426277D,0xC1A194AA9F764271,0x139D803B26DFD0A1,0xAE51C4D441E83016, + 0xD813FA44AD65DFC1,0xAC0BF2BC45D4D213,0x23BE6A9246C515D9,0x49D74D08923DCF38, + 0x9D05032127D066E7,0x2F7FDEFF5E4D63C7,0xA47E2A0155247D07,0x99B16FF12FA8BFED, + 0x4661D4398C972AAF,0xDFD0BBC8A33F9542,0xDCA79694A51D06CB,0xB020EBB67DA1E725, + 0xBA0F0563696DAA34,0xE4F1A480D5F76CA7,0xC438E34E9510EAF7,0x939E81243B64F2FC, + 0x8DEFAE46072D25CF,0x2C08F3A3586FF04E,0xD7A56375B3CF3A56,0x20C947CE40E78650, + 0x43F8A3DD86F18229,0x568B795EAC6A6987,0x8003011F1DBB225D,0xF53612D3F7145E03, + 0x189F75DA300DEC3C,0x9570DB9C3720C9F3,0xBB221E576B73DBB8,0x72F65240E4F536DD, + 0x443BE25188ABC8AA,0xE21FFE38D9B357A8,0xFD43CA6EE7E4F117,0xCAA3614B89A47EEC, + 0xFE34E732E1C6629E,0x83742C431B99B1D4,0xCF3A16AF83C2D66A,0xAAE5A8044990E91C, + 0x26271D764CA3BD5F,0x91C4B74C3F5810F9,0x7C6DD045F841A2C6,0x7F1AFD19FE63314F, + 0xC8F957238D989CE9,0xA709075D5306EE8E,0x55FC5402AA48FA0E,0x48FA563C9023BEB4, + 0x65DFBEABCA523F76,0x6C877D22D8BCE1EE,0xCC4D3BF385E045E3,0xBEBB69B36115733E, + 0x10EAAD6720FD4328,0xB6CEB10E71E5DC2A,0xBDCC44EF6737E0B7,0x523F158EA412B08D, + 0x989C74C52DB6CE61,0x9BEB59992B945DE8,0x8A2CEFCA09776F4C,0xA3BD6B8D5B7E3784, + 0xEB473DB1CB5D8930,0xC3FBA2C29B4AA074,0x9C28181525CE176B,0x683311F2D0C438E4, + 0x5FD3BAD7BE84B71F,0xFC6ED15AE5FA809B,0x36CDB0116C5EFE77,0x29918447520958C8, + 0xA29070B959604608,0x53120EBAA60CC101,0x3A0C047C74D68869,0x691E0AC6D2DA4968, + 0x73DB4974E6EB4751,0x7A838AFDF40599C9,0x5A4ACD33B4E21F99,0x6046C94FC03497F0, + 0xE6AB92E8D1CB8EA2,0x3354C7F5663856F1,0xD93EE170AF7BAE4D,0x616BD27BC22AE67C, + 0x92B39A10397A8370,0xABC8B3304B8E9890,0xBF967287630B02B2,0x5B67D607B6FC6E15 +},{ + 0xD031C397CE553FE6,0x16BA5B01B006B525,0xA89BADE6296E70C8,0x6A1F525D77D3435B, + 0x6E103570573DFA0B,0x660EFB2A17FC95AB,0x76327A9E97634BF6,0x4BAD9D6462458BF5, + 0xF1830CAEDBC3F748,0xC5C8F542669131FF,0x95044A1CDC48B0CB,0x892962DF3CF8B866, + 0xB0B9E208E930C135,0xA14FB3F0611A767C,0x8D2605F21C160136,0xD6B71922FECC549E, + 0x37089438A5907D8B,0x0B5DA38E5803D49C,0x5A5BCC9CEA6F3CBC,0xEDAE246D3B73FFE5, + 0xD2B87E0FDE22EDCE,0x5E54ABB1CA8185EC,0x1DE7F88FE80561B9,0xAD5E1A870135A08C, + 0x2F2ADBD665CECC76,0x5780B5A782F58358,0x3EDC8A2EEDE47B3F,0xC9D95C3506BEE70F, + 0x83BE111D6C4E05EE,0xA603B90959367410,0x103C81B4809FDE5D,0x2C69B6027D0C774A, + 0x399080D7D5C87953,0x09D41E16487406B4,0xCDD63B1826505E5F,0xF99DC2F49B0298E8, + 0x9CD0540A943CB67F,0xBCA84B7F891F17C5,0x723D1DB3B78DF2A6,0x78AA6E71E73B4F2E, + 0x1433E699A071670D,0x84F21BE454620782,0x98DF3327B4D20F2F,0xF049DCE2D3769E5C, + 0xDB6C60199656EB7A,0x648746B2078B4783,0x32CD23598DCBADCF,0x1EA4955BF0C7DA85, + 0xE9A143401B9D46B5,0xFD92A5D9BBEC21B8,0xC8138C790E0B8E1B,0x2EE00B9A6D7BA562, + 0xF85712B893B7F1FC,0xEB28FED80BEA949D,0x564A65EB8A40EA4C,0x6C9988E8474A2823, + 0x4535898B121D8F2D,0xABD8C03231ACCBF4,0xBA2E91CAB9867CBD,0x7960BE3DEF8E263A, + 0x0C11A977602FD6F0,0xCB50E1AD16C93527,0xEAE22E94035FFD89,0x2866D12F5DE2CE1A, + 0xFF1B1841AB9BF390,0x9F9339DE8CFE0D43,0x964727C8C48A0BF7,0x524502C6AAAE531C, + 0x9B9C5EF3AC10B413,0x4FA2FA4942AB32A5,0x3F165A62E551122B,0xC74148DA76E6E3D7, + 0x924840E5E464B2A7,0xD372AE43D69784DA,0x233B72A105E11A86,0xA48A04914941A638, + 0xB4B68525C9DE7865,0xDDEABAACA6CF8002,0x0A9773C250B6BD88,0xC284FFBB5EBD3393, + 0x8BA0DF472C8F6A4E,0x2AEF6CB74D951C32,0x427983722A318D41,0x73F7CDFFBF389BB2, + 0x074C0AF9382C026C,0x8A6A0F0B243A035A,0x6FDAE53C5F88931F,0xC68B98967E538AC3, + 0x44FF59C71AA8E639,0xE2FCE0CE439E9229,0xA20CDE2479D8CD40,0x19E89FA2C8EBD8E9, + 0xF446BBCFF398270C,0x43B3533E2284E455,0xD82F0DCD8E945046,0x51066F12B26CE820, + 0xE73957AF6BC5426D,0x081ECE5A40C16FA0,0x3B193D4FC5BFAB7B,0x7FE66488DF174D42, + 0x0E9814EF705804D8,0x8137AC857C39D7C6,0xB1733244E185A821,0x695C3F896F11F867, + 0xF6CF0657E3EFF524,0x1AABF276D02963D5,0x2DA3664E75B91E5E,0x0289BD981077D228, + 0x90C1FD7DF413608F,0x3C5537B6FD93A917,0xAA12107E3919A2E0,0x0686DAB530996B78, + 0xDAA6B0559EE3826E,0xC34E2FF756085A87,0x6D5358A44FFF4137,0xFC587595B35948AC, + 0x7CA5095CC7D5F67E,0xFB147F6C8B754AC0,0xBFEB26AB91DDACF9,0x6896EFC567A49173, + 0xCA9A31E11E7C5C33,0xBBE44186B13315A9,0x0DDB793B689ABFE4,0x70B4A02BA7FA208E, + 0xE47A3A7B7307F951,0x8CECD5BE14A36822,0xEEED49B923B144D9,0x17708B4DB8B3DC31, + 0x6088219F2765FED3,0xB3FA8FDCF1F27A09,0x910B2D31FCA6099B,0x0F52C4A378ED6DCC, + 0x50CCBF5EBAD98134,0x6BD582117F662A4F,0x94CE9A50D4FDD9DF,0x2B25BCFB45207526, + 0x67C42B661F49FCBF,0x492420FC723259DD,0x03436DD418C2BB3C,0x1F6E4517F872B391, + 0xA08563BC69AF1F68,0xD43EA4BAEEBB86B6,0x01CAD04C08B56914,0xAC94CACB0980C998, + 0x54C3D8739A373864,0x26FEC5C02DBACAC2,0xDEA9D778BE0D3B3E,0x040F672D20EEB950, + 0xE5B0EA377BB29045,0xF30AB136CBB42560,0x62019C0737122CFB,0xE86B930C13282FA1, + 0xCC1CEB542EE5374B,0x538FD28AA21B3A08,0x1B61223AD89C0AC1,0x36C24474AD25149F, + 0x7A23D3E9F74C9D06,0xBE21F6E79968C5ED,0xCF5F868036278C77,0xF705D61BEB5A9C30, + 0x4D2B47D152DCE08D,0x5F9E7BFDC234ECF8,0x247778583DCD18EA,0x867BA67C4415D5AA, + 0x4CE1979D5A698999,0x0000000000000000,0xEC64F42133C696F1,0xB57C5569C16B1171, + 0xC1C7926F467F88AF,0x654D96FE0F3E2E97,0x15F936D5A8C40E19,0xB8A72C52A9F1AE95, + 0xA9517DAA21DB19DC,0x58D27104FA18EE94,0x5918A148F2AD8780,0x5CDD1629DAF657C4, + 0x8274C15164FB6CFA,0xD1FB13DBC6E056F2,0x7D6FD910CF609F6A,0xB63F38BDD9A9AA4D, + 0x3D9FE7FAF526C003,0x74BBC706871499DE,0xDF630734B6B8522A,0x3AD3ED03CD0AC26F, + 0xFADEAF2083C023D4,0xC00D42234ECAE1BB,0x8538CBA85CD76E96,0xC402250E6E2458EB, + 0x47BC3413026A5D05,0xAFD7A71F114272A4,0x978DF784CC3F62E3,0xB96DFC1EA144C781, + 0x21B2CF391596C8AE,0x318E4E8D950916F3,0xCE9556CC3E92E563,0x385A509BDD7D1047, + 0x358129A0B5E7AFA3,0xE6F387E363702B79,0xE0755D5653E94001,0x7BE903A5FFF9F412, + 0x12B53C2C90E80C75,0x3307F315857EC4DB,0x8FAFB86A0C61D31E,0xD9E5DD8186213952, + 0x77F8AAD29FD622E2,0x25BDA814357871FE,0x7571174A8FA1F0CA,0x137FEC60985D6561, + 0x30449EC19DBC7FE7,0xA540D4DD41F4CF2C,0xDC206AE0AE7AE916,0x5B911CD0E2DA55A8, + 0xB2305F90F947131D,0x344BF9ECBD52C6B7,0x5D17C665D2433ED0,0x18224FEEC05EB1FD, + 0x9E59E992844B6457,0x9A568EBFA4A5DD07,0xA3C60E68716DA454,0x7E2CB4C4D7A22456, + 0x87B176304CA0BCBE,0x413AEEA632F3367D,0x9915E36BBC67663B,0x40F03EEA3A465F69, + 0x1C2D28C3E0B008AD,0x4E682A054A1E5BB1,0x05C5B761285BD044,0xE1BF8D1A5B5C2915, + 0xF2C0617AC3014C74,0xB7F5E8F1D11CC359,0x63CB4C4B3FA745EF,0x9D1A84469C89DF6B, + 0xE33630824B2BFB3D,0xD5F474F6E60EEFA2,0xF58C6B83FB2D4E18,0x4676E45F0ADF3411, + 0x20781F751D23A1BA,0xBD629B3381AA7ED1,0xAE1D775319F71BB0,0xFED1C80DA32E9A84, + 0x5509083F92825170,0x29AC01635557A70E,0xA7C9694551831D04,0x8E65682604D4BA0A, + 0x11F651F8882AB749,0xD77DC96EF6793D8A,0xEF2799F52B042DCD,0x48EEF0B07A8730C9, + 0x22F1A2ED0D547392,0x6142F1D32FD097C7,0x4A674D286AF0E2E1,0x80FD7CC9748CBED2, + 0x717E7067AF4F499A,0x938290A9ECD1DBB3,0x88E3B293344DD172,0x2734158C250FA3D6 +}}; + +// Constant values for KeySchedule function +const unsigned char C[12][64] = {{ + 0xB1,0x08,0x5B,0xDA,0x1E,0xCA,0xDA,0xE9,0xEB,0xCB,0x2F,0x81,0xC0,0x65,0x7C,0x1F, + 0x2F,0x6A,0x76,0x43,0x2E,0x45,0xD0,0x16,0x71,0x4E,0xB8,0x8D,0x75,0x85,0xC4,0xFC, + 0x4B,0x7C,0xE0,0x91,0x92,0x67,0x69,0x01,0xA2,0x42,0x2A,0x08,0xA4,0x60,0xD3,0x15, + 0x05,0x76,0x74,0x36,0xCC,0x74,0x4D,0x23,0xDD,0x80,0x65,0x59,0xF2,0xA6,0x45,0x07 +},{ + 0x6F,0xA3,0xB5,0x8A,0xA9,0x9D,0x2F,0x1A,0x4F,0xE3,0x9D,0x46,0x0F,0x70,0xB5,0xD7, + 0xF3,0xFE,0xEA,0x72,0x0A,0x23,0x2B,0x98,0x61,0xD5,0x5E,0x0F,0x16,0xB5,0x01,0x31, + 0x9A,0xB5,0x17,0x6B,0x12,0xD6,0x99,0x58,0x5C,0xB5,0x61,0xC2,0xDB,0x0A,0xA7,0xCA, + 0x55,0xDD,0xA2,0x1B,0xD7,0xCB,0xCD,0x56,0xE6,0x79,0x04,0x70,0x21,0xB1,0x9B,0xB7 +},{ + 0xF5,0x74,0xDC,0xAC,0x2B,0xCE,0x2F,0xC7,0x0A,0x39,0xFC,0x28,0x6A,0x3D,0x84,0x35, + 0x06,0xF1,0x5E,0x5F,0x52,0x9C,0x1F,0x8B,0xF2,0xEA,0x75,0x14,0xB1,0x29,0x7B,0x7B, + 0xD3,0xE2,0x0F,0xE4,0x90,0x35,0x9E,0xB1,0xC1,0xC9,0x3A,0x37,0x60,0x62,0xDB,0x09, + 0xC2,0xB6,0xF4,0x43,0x86,0x7A,0xDB,0x31,0x99,0x1E,0x96,0xF5,0x0A,0xBA,0x0A,0xB2 +},{ + 0xEF,0x1F,0xDF,0xB3,0xE8,0x15,0x66,0xD2,0xF9,0x48,0xE1,0xA0,0x5D,0x71,0xE4,0xDD, + 0x48,0x8E,0x85,0x7E,0x33,0x5C,0x3C,0x7D,0x9D,0x72,0x1C,0xAD,0x68,0x5E,0x35,0x3F, + 0xA9,0xD7,0x2C,0x82,0xED,0x03,0xD6,0x75,0xD8,0xB7,0x13,0x33,0x93,0x52,0x03,0xBE, + 0x34,0x53,0xEA,0xA1,0x93,0xE8,0x37,0xF1,0x22,0x0C,0xBE,0xBC,0x84,0xE3,0xD1,0x2E +},{ + 0x4B,0xEA,0x6B,0xAC,0xAD,0x47,0x47,0x99,0x9A,0x3F,0x41,0x0C,0x6C,0xA9,0x23,0x63, + 0x7F,0x15,0x1C,0x1F,0x16,0x86,0x10,0x4A,0x35,0x9E,0x35,0xD7,0x80,0x0F,0xFF,0xBD, + 0xBF,0xCD,0x17,0x47,0x25,0x3A,0xF5,0xA3,0xDF,0xFF,0x00,0xB7,0x23,0x27,0x1A,0x16, + 0x7A,0x56,0xA2,0x7E,0xA9,0xEA,0x63,0xF5,0x60,0x17,0x58,0xFD,0x7C,0x6C,0xFE,0x57 +},{ + 0xAE,0x4F,0xAE,0xAE,0x1D,0x3A,0xD3,0xD9,0x6F,0xA4,0xC3,0x3B,0x7A,0x30,0x39,0xC0, + 0x2D,0x66,0xC4,0xF9,0x51,0x42,0xA4,0x6C,0x18,0x7F,0x9A,0xB4,0x9A,0xF0,0x8E,0xC6, + 0xCF,0xFA,0xA6,0xB7,0x1C,0x9A,0xB7,0xB4,0x0A,0xF2,0x1F,0x66,0xC2,0xBE,0xC6,0xB6, + 0xBF,0x71,0xC5,0x72,0x36,0x90,0x4F,0x35,0xFA,0x68,0x40,0x7A,0x46,0x64,0x7D,0x6E +},{ + 0xF4,0xC7,0x0E,0x16,0xEE,0xAA,0xC5,0xEC,0x51,0xAC,0x86,0xFE,0xBF,0x24,0x09,0x54, + 0x39,0x9E,0xC6,0xC7,0xE6,0xBF,0x87,0xC9,0xD3,0x47,0x3E,0x33,0x19,0x7A,0x93,0xC9, + 0x09,0x92,0xAB,0xC5,0x2D,0x82,0x2C,0x37,0x06,0x47,0x69,0x83,0x28,0x4A,0x05,0x04, + 0x35,0x17,0x45,0x4C,0xA2,0x3C,0x4A,0xF3,0x88,0x86,0x56,0x4D,0x3A,0x14,0xD4,0x93 +},{ + 0x9B,0x1F,0x5B,0x42,0x4D,0x93,0xC9,0xA7,0x03,0xE7,0xAA,0x02,0x0C,0x6E,0x41,0x41, + 0x4E,0xB7,0xF8,0x71,0x9C,0x36,0xDE,0x1E,0x89,0xB4,0x44,0x3B,0x4D,0xDB,0xC4,0x9A, + 0xF4,0x89,0x2B,0xCB,0x92,0x9B,0x06,0x90,0x69,0xD1,0x8D,0x2B,0xD1,0xA5,0xC4,0x2F, + 0x36,0xAC,0xC2,0x35,0x59,0x51,0xA8,0xD9,0xA4,0x7F,0x0D,0xD4,0xBF,0x02,0xE7,0x1E +},{ + 0x37,0x8F,0x5A,0x54,0x16,0x31,0x22,0x9B,0x94,0x4C,0x9A,0xD8,0xEC,0x16,0x5F,0xDE, + 0x3A,0x7D,0x3A,0x1B,0x25,0x89,0x42,0x24,0x3C,0xD9,0x55,0xB7,0xE0,0x0D,0x09,0x84, + 0x80,0x0A,0x44,0x0B,0xDB,0xB2,0xCE,0xB1,0x7B,0x2B,0x8A,0x9A,0xA6,0x07,0x9C,0x54, + 0x0E,0x38,0xDC,0x92,0xCB,0x1F,0x2A,0x60,0x72,0x61,0x44,0x51,0x83,0x23,0x5A,0xDB +},{ + 0xAB,0xBE,0xDE,0xA6,0x80,0x05,0x6F,0x52,0x38,0x2A,0xE5,0x48,0xB2,0xE4,0xF3,0xF3, + 0x89,0x41,0xE7,0x1C,0xFF,0x8A,0x78,0xDB,0x1F,0xFF,0xE1,0x8A,0x1B,0x33,0x61,0x03, + 0x9F,0xE7,0x67,0x02,0xAF,0x69,0x33,0x4B,0x7A,0x1E,0x6C,0x30,0x3B,0x76,0x52,0xF4, + 0x36,0x98,0xFA,0xD1,0x15,0x3B,0xB6,0xC3,0x74,0xB4,0xC7,0xFB,0x98,0x45,0x9C,0xED +},{ + 0x7B,0xCD,0x9E,0xD0,0xEF,0xC8,0x89,0xFB,0x30,0x02,0xC6,0xCD,0x63,0x5A,0xFE,0x94, + 0xD8,0xFA,0x6B,0xBB,0xEB,0xAB,0x07,0x61,0x20,0x01,0x80,0x21,0x14,0x84,0x66,0x79, + 0x8A,0x1D,0x71,0xEF,0xEA,0x48,0xB9,0xCA,0xEF,0xBA,0xCD,0x1D,0x7D,0x47,0x6E,0x98, + 0xDE,0xA2,0x59,0x4A,0xC0,0x6F,0xD8,0x5D,0x6B,0xCA,0xA4,0xCD,0x81,0xF3,0x2D,0x1B +},{ + 0x37,0x8E,0xE7,0x67,0xF1,0x16,0x31,0xBA,0xD2,0x13,0x80,0xB0,0x04,0x49,0xB1,0x7A, + 0xCD,0xA4,0x3C,0x32,0xBC,0xDF,0x1D,0x77,0xF8,0x20,0x12,0xD4,0x30,0x21,0x9F,0x9B, + 0x5D,0x80,0xEF,0x9D,0x18,0x91,0xCC,0x86,0xE7,0x1D,0xA4,0xAA,0x88,0xE1,0x28,0x52, + 0xFA,0xF4,0x17,0xD5,0xD9,0xB2,0x1B,0x99,0x48,0xBC,0x92,0x4A,0xF1,0x1B,0xD7,0x20 +}}; + + +static void AddModulo512(const void *a,const void *b,void *c) +{ + const unsigned char *A=a, *B=b; + unsigned char *C=c; + int t = 0; +#ifdef FULL_UNROLL +#define ADDBYTE_8(i) t = A[i] + B[i] + (t >> 8); C[i] = t & 0xFF; + + ADDBYTE_8(63) + ADDBYTE_8(62) + ADDBYTE_8(61) + ADDBYTE_8(60) + ADDBYTE_8(59) + ADDBYTE_8(58) + ADDBYTE_8(57) + ADDBYTE_8(56) + ADDBYTE_8(55) + ADDBYTE_8(54) + ADDBYTE_8(53) + ADDBYTE_8(52) + ADDBYTE_8(51) + ADDBYTE_8(50) + ADDBYTE_8(49) + ADDBYTE_8(48) + ADDBYTE_8(47) + ADDBYTE_8(46) + ADDBYTE_8(45) + ADDBYTE_8(44) + ADDBYTE_8(43) + ADDBYTE_8(42) + ADDBYTE_8(41) + ADDBYTE_8(40) + ADDBYTE_8(39) + ADDBYTE_8(38) + ADDBYTE_8(37) + ADDBYTE_8(36) + ADDBYTE_8(35) + ADDBYTE_8(34) + ADDBYTE_8(33) + ADDBYTE_8(32) + ADDBYTE_8(31) + ADDBYTE_8(30) + ADDBYTE_8(29) + ADDBYTE_8(28) + ADDBYTE_8(27) + ADDBYTE_8(26) + ADDBYTE_8(25) + ADDBYTE_8(24) + ADDBYTE_8(23) + ADDBYTE_8(22) + ADDBYTE_8(21) + ADDBYTE_8(20) + ADDBYTE_8(19) + ADDBYTE_8(18) + ADDBYTE_8(17) + ADDBYTE_8(16) + ADDBYTE_8(15) + ADDBYTE_8(14) + ADDBYTE_8(13) + ADDBYTE_8(12) + ADDBYTE_8(11) + ADDBYTE_8(10) + ADDBYTE_8(9) + ADDBYTE_8(8) + ADDBYTE_8(7) + ADDBYTE_8(6) + ADDBYTE_8(5) + ADDBYTE_8(4) + ADDBYTE_8(3) + ADDBYTE_8(2) + ADDBYTE_8(1) + ADDBYTE_8(0) + +#else + int i = 0; + + for(i=63;i>=0;i--) + { + t = A[i] + B[i] + (t >> 8); + C[i] = t & 0xFF; + } +#endif +} + +static void AddXor512(const void *a,const void *b,void *c) +{ + const unsigned long long *A=a, *B=b; + unsigned long long *C=c; +#ifdef FULL_UNROLL + C[0] = A[0] ^ B[0]; + C[1] = A[1] ^ B[1]; + C[2] = A[2] ^ B[2]; + C[3] = A[3] ^ B[3]; + C[4] = A[4] ^ B[4]; + C[5] = A[5] ^ B[5]; + C[6] = A[6] ^ B[6]; + C[7] = A[7] ^ B[7]; +#else + int i = 0; + + for(i=0; i<8; i++) { + C[i] = A[i] ^ B[i]; + } +#endif +} + +static void F(unsigned char *state) +{ + unsigned long long return_state[8]; + register unsigned long long r = 0; + r ^= TG[0][state[56]]; + r ^= TG[1][state[48]]; + r ^= TG[2][state[40]]; + r ^= TG[3][state[32]]; + r ^= TG[4][state[24]]; + r ^= TG[5][state[16]]; + r ^= TG[6][state[8]]; + r ^= TG[7][state[0]]; + return_state[0] = r; + r = 0; + + r ^= TG[0][state[57]]; + r ^= TG[1][state[49]]; + r ^= TG[2][state[41]]; + r ^= TG[3][state[33]]; + r ^= TG[4][state[25]]; + r ^= TG[5][state[17]]; + r ^= TG[6][state[9]]; + r ^= TG[7][state[1]]; + return_state[1] = r; + r = 0; + + r ^= TG[0][state[58]]; + r ^= TG[1][state[50]]; + r ^= TG[2][state[42]]; + r ^= TG[3][state[34]]; + r ^= TG[4][state[26]]; + r ^= TG[5][state[18]]; + r ^= TG[6][state[10]]; + r ^= TG[7][state[2]]; + return_state[2] = r; + r = 0; + + r ^= TG[0][state[59]]; + r ^= TG[1][state[51]]; + r ^= TG[2][state[43]]; + r ^= TG[3][state[35]]; + r ^= TG[4][state[27]]; + r ^= TG[5][state[19]]; + r ^= TG[6][state[11]]; + r ^= TG[7][state[3]]; + return_state[3] = r; + r = 0; + + r ^= TG[0][state[60]]; + r ^= TG[1][state[52]]; + r ^= TG[2][state[44]]; + r ^= TG[3][state[36]]; + r ^= TG[4][state[28]]; + r ^= TG[5][state[20]]; + r ^= TG[6][state[12]]; + r ^= TG[7][state[4]]; + return_state[4] = r; + r = 0; + + r ^= TG[0][state[61]]; + r ^= TG[1][state[53]]; + r ^= TG[2][state[45]]; + r ^= TG[3][state[37]]; + r ^= TG[4][state[29]]; + r ^= TG[5][state[21]]; + r ^= TG[6][state[13]]; + r ^= TG[7][state[5]]; + return_state[5] = r; + r = 0; + + r ^= TG[0][state[62]]; + r ^= TG[1][state[54]]; + r ^= TG[2][state[46]]; + r ^= TG[3][state[38]]; + r ^= TG[4][state[30]]; + r ^= TG[5][state[22]]; + r ^= TG[6][state[14]]; + r ^= TG[7][state[6]]; + return_state[6] = r; + r = 0; + + r ^= TG[0][state[63]]; + r ^= TG[1][state[55]]; + r ^= TG[2][state[47]]; + r ^= TG[3][state[39]]; + r ^= TG[4][state[31]]; + r ^= TG[5][state[23]]; + r ^= TG[6][state[15]]; + r ^= TG[7][state[7]]; + return_state[7] = r; + + memcpy(state,(unsigned char*)return_state,64); +} + +#define KeySchedule(K,i) AddXor512(K,C[i],K); F(K); + +static void E(unsigned char *K,const unsigned char *m, unsigned char *state) +{ +#ifdef FULL_UNROLL + AddXor512(m,K,state); + + F(state); + KeySchedule(K,0); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,1); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,2); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,3); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,4); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,5); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,6); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,7); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,8); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,9); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,10); + AddXor512(state,K,state); + + F(state); + KeySchedule(K,11); + AddXor512(state,K,state); +#else + int i = 0; + + AddXor512(m,K,state); + + for(i=0;i<12;i++) { + F(state); + KeySchedule(K,i); + AddXor512(state,K,state); + } +#endif +} + +static void g_N(const unsigned char *N,unsigned char *h,const unsigned char *m) +{ + unsigned char t[64], K[64]; + + AddXor512(N,h,K); + + F(K); + + E(K,m,t); + + AddXor512(t,h,t); + AddXor512(t,m,h); +} + +static void hash_X(unsigned char *IV,const unsigned char *message,unsigned long long length,unsigned char *out) +{ + unsigned char v512[64] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00 + }; + unsigned char v0[64] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + }; + unsigned char Sigma[64] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + }; + unsigned char N[64] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + }; + unsigned char m[64], *hash = IV; + unsigned long long len = length; + + // Stage 2 + while (len >= 512) + { + memcpy(m, message + len/8 - 63 - ( (len & 0x7) == 0 ), 64); + + g_N(N,hash,m); + AddModulo512(N,v512,N); + AddModulo512(Sigma,m,Sigma); + len -= 512; + } + + memset(m,0,64); + memcpy(m + 63 - len/8 + ( (len & 0x7) == 0 ), message, len/8 + 1 - ( (len & 0x7) == 0 )); + + // Stage 3 + m[ 63 - len/8 ] |= (1 << (len & 0x7)); + + g_N(N,hash,m); + v512[63] = len & 0xFF; + v512[62] = (unsigned char) (len >> 8); + AddModulo512(N,v512,N); + + AddModulo512(Sigma,m,Sigma); + + g_N(v0,hash,N); + g_N(v0,hash,Sigma); + + memcpy(out, hash, 64); +} + +static void hash_512(const unsigned char *message, unsigned long long length, unsigned char *out) +{ + unsigned char IV[64] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + }; + + hash_X(IV,message,length,out); +} + +static void hash_256(const unsigned char *message, unsigned long long length, unsigned char *out) +{ + unsigned char IV[64] = { + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 + }; + unsigned char hash[64]; + + hash_X(IV,message,length,hash); + + memcpy(out,hash,32); +} + + + + + +/* see sph_gost.h */ +void +sph_gost256_init(void *cc) +{ + //gost_init(cc, 256); +} + +/* see sph_gost.h */ +void +sph_gost256(void *cc, const void *data, size_t len) +{ + hash_256(data, 8*len, cc); +} + +/* see sph_gost.h */ +void +sph_gost256_close(void *cc, void *dst) +{ + //sph_gost256_addbits_and_close(cc, 0, 0, dst); + memcpy(dst, cc, 32); +} + +/* see sph_gost.h */ +void +sph_gost256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + //gost_close32(cc, ub, n, dst); +} + +/* see sph_gost.h */ +void +sph_gost512_init(void *cc) +{ + //gost_init(cc, 512); +} + +/* see sph_gost.h */ +void +sph_gost512(void *cc, const void *data, size_t len) +{ + hash_512(data, 8*len, cc); +} + +/* see sph_gost.h */ +void +sph_gost512_close(void *cc, void *dst) +{ + //sph_gost512_addbits_and_close(cc, 0, 0, dst); + memcpy(dst, cc, 64); +} + +/* see sph_gost.h */ +void +sph_gost512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) +{ + //gost_close64(cc, ub, n, dst); +} + + +#ifdef __cplusplus +} +#endif diff --git a/sph/sysendian.h b/sph/sysendian.h new file mode 100644 index 0000000..31ac985 --- /dev/null +++ b/sph/sysendian.h @@ -0,0 +1,140 @@ +/*- + * Copyright 2007-2009 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ +#ifndef _SYSENDIAN_H_ +#define _SYSENDIAN_H_ + +/* If we don't have be64enc, the we have isn't usable. */ +#if !HAVE_DECL_BE64ENC +#undef HAVE_SYS_ENDIAN_H +#endif + +#ifdef HAVE_SYS_ENDIAN_H + +#include + +#else + +#include + +#if !HAVE_DECL_LE32DEC +static uint32_t le32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) + + ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24)); +} +#endif + +#if !HAVE_DECL_BE32ENC +static void be32enc(void *pp, uint32_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[3] = x & 0xff; + p[2] = (x >> 8) & 0xff; + p[1] = (x >> 16) & 0xff; + p[0] = (x >> 24) & 0xff; +} +#endif + +#if !HAVE_DECL_BE32DEC +static uint32_t be32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) + + ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24)); +} +#endif + +#if !HAVE_DECL_LE32ENC +static void le32enc(void *pp, uint32_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; +} +#endif + +static uint64_t +be64dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint64_t)(p[7]) + ((uint64_t)(p[6]) << 8) + + ((uint64_t)(p[5]) << 16) + ((uint64_t)(p[4]) << 24) + + ((uint64_t)(p[3]) << 32) + ((uint64_t)(p[2]) << 40) + + ((uint64_t)(p[1]) << 48) + ((uint64_t)(p[0]) << 56)); +} + +static void +be64enc(void *pp, uint64_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[7] = x & 0xff; + p[6] = (x >> 8) & 0xff; + p[5] = (x >> 16) & 0xff; + p[4] = (x >> 24) & 0xff; + p[3] = (x >> 32) & 0xff; + p[2] = (x >> 40) & 0xff; + p[1] = (x >> 48) & 0xff; + p[0] = (x >> 56) & 0xff; +} + + + +static uint64_t +le64dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + + return ((uint64_t)(p[0]) + ((uint64_t)(p[1]) << 8) + + ((uint64_t)(p[2]) << 16) + ((uint64_t)(p[3]) << 24) + + ((uint64_t)(p[4]) << 32) + ((uint64_t)(p[5]) << 40) + + ((uint64_t)(p[6]) << 48) + ((uint64_t)(p[7]) << 56)); +} + +static void +le64enc(void *pp, uint64_t x) +{ + uint8_t * p = (uint8_t *)pp; + + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; + p[4] = (x >> 32) & 0xff; + p[5] = (x >> 40) & 0xff; + p[6] = (x >> 48) & 0xff; + p[7] = (x >> 56) & 0xff; +} +#endif /* !HAVE_SYS_ENDIAN_H */ + +#endif /* !_SYSENDIAN_H_ */ diff --git a/sph/whirlpool.c b/sph/whirlpool.c new file mode 100644 index 0000000..fd24d21 --- /dev/null +++ b/sph/whirlpool.c @@ -0,0 +1,3480 @@ +/* $Id: whirlpool.c 227 2010-06-16 17:28:38Z tp $ */ +/* + * WHIRLPOOL implementation. + * + * Internally, we use little-endian convention, on the assumption that + * architectures which favour big-endian encoding are: + * 1. rarer + * 2. in decreasing numbers + * 3. able to decode little-endian data efficiently anyway + * + * The most common big-endian architecture is Sparc, and Ultrasparc CPU + * include special opcodes to perform little-endian accesses, which we use + * (see sph_types.h). Most modern CPU designs can work with both endianness + * and architecture designer now favour little-endian (basically, x86 has + * won the endianness war). + * + * TODO: implement a 32-bit version. Not only such a version would be handy + * for non-64-bit-able architectures, but it may also use smaller tables, + * at the expense of more lookups and XORs. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +#include +#include + +#include "sph_whirlpool.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_WHIRLPOOL +#define SPH_SMALL_FOOTPRINT_WHIRLPOOL 0 +#endif + +/* ====================================================================== */ +/* + * Constants for plain WHIRLPOOL (current version). + */ + +static const sph_u64 plain_T0[256] = { + SPH_C64(0xD83078C018601818), SPH_C64(0x2646AF05238C2323), + SPH_C64(0xB891F97EC63FC6C6), SPH_C64(0xFBCD6F13E887E8E8), + SPH_C64(0xCB13A14C87268787), SPH_C64(0x116D62A9B8DAB8B8), + SPH_C64(0x0902050801040101), SPH_C64(0x0D9E6E424F214F4F), + SPH_C64(0x9B6CEEAD36D83636), SPH_C64(0xFF510459A6A2A6A6), + SPH_C64(0x0CB9BDDED26FD2D2), SPH_C64(0x0EF706FBF5F3F5F5), + SPH_C64(0x96F280EF79F97979), SPH_C64(0x30DECE5F6FA16F6F), + SPH_C64(0x6D3FEFFC917E9191), SPH_C64(0xF8A407AA52555252), + SPH_C64(0x47C0FD27609D6060), SPH_C64(0x35657689BCCABCBC), + SPH_C64(0x372BCDAC9B569B9B), SPH_C64(0x8A018C048E028E8E), + SPH_C64(0xD25B1571A3B6A3A3), SPH_C64(0x6C183C600C300C0C), + SPH_C64(0x84F68AFF7BF17B7B), SPH_C64(0x806AE1B535D43535), + SPH_C64(0xF53A69E81D741D1D), SPH_C64(0xB3DD4753E0A7E0E0), + SPH_C64(0x21B3ACF6D77BD7D7), SPH_C64(0x9C99ED5EC22FC2C2), + SPH_C64(0x435C966D2EB82E2E), SPH_C64(0x29967A624B314B4B), + SPH_C64(0x5DE121A3FEDFFEFE), SPH_C64(0xD5AE168257415757), + SPH_C64(0xBD2A41A815541515), SPH_C64(0xE8EEB69F77C17777), + SPH_C64(0x926EEBA537DC3737), SPH_C64(0x9ED7567BE5B3E5E5), + SPH_C64(0x1323D98C9F469F9F), SPH_C64(0x23FD17D3F0E7F0F0), + SPH_C64(0x20947F6A4A354A4A), SPH_C64(0x44A9959EDA4FDADA), + SPH_C64(0xA2B025FA587D5858), SPH_C64(0xCF8FCA06C903C9C9), + SPH_C64(0x7C528D5529A42929), SPH_C64(0x5A1422500A280A0A), + SPH_C64(0x507F4FE1B1FEB1B1), SPH_C64(0xC95D1A69A0BAA0A0), + SPH_C64(0x14D6DA7F6BB16B6B), SPH_C64(0xD917AB5C852E8585), + SPH_C64(0x3C677381BDCEBDBD), SPH_C64(0x8FBA34D25D695D5D), + SPH_C64(0x9020508010401010), SPH_C64(0x07F503F3F4F7F4F4), + SPH_C64(0xDD8BC016CB0BCBCB), SPH_C64(0xD37CC6ED3EF83E3E), + SPH_C64(0x2D0A112805140505), SPH_C64(0x78CEE61F67816767), + SPH_C64(0x97D55373E4B7E4E4), SPH_C64(0x024EBB25279C2727), + SPH_C64(0x7382583241194141), SPH_C64(0xA70B9D2C8B168B8B), + SPH_C64(0xF6530151A7A6A7A7), SPH_C64(0xB2FA94CF7DE97D7D), + SPH_C64(0x4937FBDC956E9595), SPH_C64(0x56AD9F8ED847D8D8), + SPH_C64(0x70EB308BFBCBFBFB), SPH_C64(0xCDC17123EE9FEEEE), + SPH_C64(0xBBF891C77CED7C7C), SPH_C64(0x71CCE31766856666), + SPH_C64(0x7BA78EA6DD53DDDD), SPH_C64(0xAF2E4BB8175C1717), + SPH_C64(0x458E460247014747), SPH_C64(0x1A21DC849E429E9E), + SPH_C64(0xD489C51ECA0FCACA), SPH_C64(0x585A99752DB42D2D), + SPH_C64(0x2E637991BFC6BFBF), SPH_C64(0x3F0E1B38071C0707), + SPH_C64(0xAC472301AD8EADAD), SPH_C64(0xB0B42FEA5A755A5A), + SPH_C64(0xEF1BB56C83368383), SPH_C64(0xB666FF8533CC3333), + SPH_C64(0x5CC6F23F63916363), SPH_C64(0x12040A1002080202), + SPH_C64(0x93493839AA92AAAA), SPH_C64(0xDEE2A8AF71D97171), + SPH_C64(0xC68DCF0EC807C8C8), SPH_C64(0xD1327DC819641919), + SPH_C64(0x3B92707249394949), SPH_C64(0x5FAF9A86D943D9D9), + SPH_C64(0x31F91DC3F2EFF2F2), SPH_C64(0xA8DB484BE3ABE3E3), + SPH_C64(0xB9B62AE25B715B5B), SPH_C64(0xBC0D9234881A8888), + SPH_C64(0x3E29C8A49A529A9A), SPH_C64(0x0B4CBE2D26982626), + SPH_C64(0xBF64FA8D32C83232), SPH_C64(0x597D4AE9B0FAB0B0), + SPH_C64(0xF2CF6A1BE983E9E9), SPH_C64(0x771E33780F3C0F0F), + SPH_C64(0x33B7A6E6D573D5D5), SPH_C64(0xF41DBA74803A8080), + SPH_C64(0x27617C99BEC2BEBE), SPH_C64(0xEB87DE26CD13CDCD), + SPH_C64(0x8968E4BD34D03434), SPH_C64(0x3290757A483D4848), + SPH_C64(0x54E324ABFFDBFFFF), SPH_C64(0x8DF48FF77AF57A7A), + SPH_C64(0x643DEAF4907A9090), SPH_C64(0x9DBE3EC25F615F5F), + SPH_C64(0x3D40A01D20802020), SPH_C64(0x0FD0D56768BD6868), + SPH_C64(0xCA3472D01A681A1A), SPH_C64(0xB7412C19AE82AEAE), + SPH_C64(0x7D755EC9B4EAB4B4), SPH_C64(0xCEA8199A544D5454), + SPH_C64(0x7F3BE5EC93769393), SPH_C64(0x2F44AA0D22882222), + SPH_C64(0x63C8E907648D6464), SPH_C64(0x2AFF12DBF1E3F1F1), + SPH_C64(0xCCE6A2BF73D17373), SPH_C64(0x82245A9012481212), + SPH_C64(0x7A805D3A401D4040), SPH_C64(0x4810284008200808), + SPH_C64(0x959BE856C32BC3C3), SPH_C64(0xDFC57B33EC97ECEC), + SPH_C64(0x4DAB9096DB4BDBDB), SPH_C64(0xC05F1F61A1BEA1A1), + SPH_C64(0x9107831C8D0E8D8D), SPH_C64(0xC87AC9F53DF43D3D), + SPH_C64(0x5B33F1CC97669797), SPH_C64(0x0000000000000000), + SPH_C64(0xF983D436CF1BCFCF), SPH_C64(0x6E5687452BAC2B2B), + SPH_C64(0xE1ECB39776C57676), SPH_C64(0xE619B06482328282), + SPH_C64(0x28B1A9FED67FD6D6), SPH_C64(0xC33677D81B6C1B1B), + SPH_C64(0x74775BC1B5EEB5B5), SPH_C64(0xBE432911AF86AFAF), + SPH_C64(0x1DD4DF776AB56A6A), SPH_C64(0xEAA00DBA505D5050), + SPH_C64(0x578A4C1245094545), SPH_C64(0x38FB18CBF3EBF3F3), + SPH_C64(0xAD60F09D30C03030), SPH_C64(0xC4C3742BEF9BEFEF), + SPH_C64(0xDA7EC3E53FFC3F3F), SPH_C64(0xC7AA1C9255495555), + SPH_C64(0xDB591079A2B2A2A2), SPH_C64(0xE9C96503EA8FEAEA), + SPH_C64(0x6ACAEC0F65896565), SPH_C64(0x036968B9BAD2BABA), + SPH_C64(0x4A5E93652FBC2F2F), SPH_C64(0x8E9DE74EC027C0C0), + SPH_C64(0x60A181BEDE5FDEDE), SPH_C64(0xFC386CE01C701C1C), + SPH_C64(0x46E72EBBFDD3FDFD), SPH_C64(0x1F9A64524D294D4D), + SPH_C64(0x7639E0E492729292), SPH_C64(0xFAEABC8F75C97575), + SPH_C64(0x360C1E3006180606), SPH_C64(0xAE0998248A128A8A), + SPH_C64(0x4B7940F9B2F2B2B2), SPH_C64(0x85D15963E6BFE6E6), + SPH_C64(0x7E1C36700E380E0E), SPH_C64(0xE73E63F81F7C1F1F), + SPH_C64(0x55C4F73762956262), SPH_C64(0x3AB5A3EED477D4D4), + SPH_C64(0x814D3229A89AA8A8), SPH_C64(0x5231F4C496629696), + SPH_C64(0x62EF3A9BF9C3F9F9), SPH_C64(0xA397F666C533C5C5), + SPH_C64(0x104AB13525942525), SPH_C64(0xABB220F259795959), + SPH_C64(0xD015AE54842A8484), SPH_C64(0xC5E4A7B772D57272), + SPH_C64(0xEC72DDD539E43939), SPH_C64(0x1698615A4C2D4C4C), + SPH_C64(0x94BC3BCA5E655E5E), SPH_C64(0x9FF085E778FD7878), + SPH_C64(0xE570D8DD38E03838), SPH_C64(0x980586148C0A8C8C), + SPH_C64(0x17BFB2C6D163D1D1), SPH_C64(0xE4570B41A5AEA5A5), + SPH_C64(0xA1D94D43E2AFE2E2), SPH_C64(0x4EC2F82F61996161), + SPH_C64(0x427B45F1B3F6B3B3), SPH_C64(0x3442A51521842121), + SPH_C64(0x0825D6949C4A9C9C), SPH_C64(0xEE3C66F01E781E1E), + SPH_C64(0x6186522243114343), SPH_C64(0xB193FC76C73BC7C7), + SPH_C64(0x4FE52BB3FCD7FCFC), SPH_C64(0x2408142004100404), + SPH_C64(0xE3A208B251595151), SPH_C64(0x252FC7BC995E9999), + SPH_C64(0x22DAC44F6DA96D6D), SPH_C64(0x651A39680D340D0D), + SPH_C64(0x79E93583FACFFAFA), SPH_C64(0x69A384B6DF5BDFDF), + SPH_C64(0xA9FC9BD77EE57E7E), SPH_C64(0x1948B43D24902424), + SPH_C64(0xFE76D7C53BEC3B3B), SPH_C64(0x9A4B3D31AB96ABAB), + SPH_C64(0xF081D13ECE1FCECE), SPH_C64(0x9922558811441111), + SPH_C64(0x8303890C8F068F8F), SPH_C64(0x049C6B4A4E254E4E), + SPH_C64(0x667351D1B7E6B7B7), SPH_C64(0xE0CB600BEB8BEBEB), + SPH_C64(0xC178CCFD3CF03C3C), SPH_C64(0xFD1FBF7C813E8181), + SPH_C64(0x4035FED4946A9494), SPH_C64(0x1CF30CEBF7FBF7F7), + SPH_C64(0x186F67A1B9DEB9B9), SPH_C64(0x8B265F98134C1313), + SPH_C64(0x51589C7D2CB02C2C), SPH_C64(0x05BBB8D6D36BD3D3), + SPH_C64(0x8CD35C6BE7BBE7E7), SPH_C64(0x39DCCB576EA56E6E), + SPH_C64(0xAA95F36EC437C4C4), SPH_C64(0x1B060F18030C0303), + SPH_C64(0xDCAC138A56455656), SPH_C64(0x5E88491A440D4444), + SPH_C64(0xA0FE9EDF7FE17F7F), SPH_C64(0x884F3721A99EA9A9), + SPH_C64(0x6754824D2AA82A2A), SPH_C64(0x0A6B6DB1BBD6BBBB), + SPH_C64(0x879FE246C123C1C1), SPH_C64(0xF1A602A253515353), + SPH_C64(0x72A58BAEDC57DCDC), SPH_C64(0x531627580B2C0B0B), + SPH_C64(0x0127D39C9D4E9D9D), SPH_C64(0x2BD8C1476CAD6C6C), + SPH_C64(0xA462F59531C43131), SPH_C64(0xF3E8B98774CD7474), + SPH_C64(0x15F109E3F6FFF6F6), SPH_C64(0x4C8C430A46054646), + SPH_C64(0xA5452609AC8AACAC), SPH_C64(0xB50F973C891E8989), + SPH_C64(0xB42844A014501414), SPH_C64(0xBADF425BE1A3E1E1), + SPH_C64(0xA62C4EB016581616), SPH_C64(0xF774D2CD3AE83A3A), + SPH_C64(0x06D2D06F69B96969), SPH_C64(0x41122D4809240909), + SPH_C64(0xD7E0ADA770DD7070), SPH_C64(0x6F7154D9B6E2B6B6), + SPH_C64(0x1EBDB7CED067D0D0), SPH_C64(0xD6C77E3BED93EDED), + SPH_C64(0xE285DB2ECC17CCCC), SPH_C64(0x6884572A42154242), + SPH_C64(0x2C2DC2B4985A9898), SPH_C64(0xED550E49A4AAA4A4), + SPH_C64(0x7550885D28A02828), SPH_C64(0x86B831DA5C6D5C5C), + SPH_C64(0x6BED3F93F8C7F8F8), SPH_C64(0xC211A44486228686) +}; + +#if !SPH_SMALL_FOOTPRINT_WHIRLPOOL + +static const sph_u64 plain_T1[256] = { + SPH_C64(0x3078C018601818D8), SPH_C64(0x46AF05238C232326), + SPH_C64(0x91F97EC63FC6C6B8), SPH_C64(0xCD6F13E887E8E8FB), + SPH_C64(0x13A14C87268787CB), SPH_C64(0x6D62A9B8DAB8B811), + SPH_C64(0x0205080104010109), SPH_C64(0x9E6E424F214F4F0D), + SPH_C64(0x6CEEAD36D836369B), SPH_C64(0x510459A6A2A6A6FF), + SPH_C64(0xB9BDDED26FD2D20C), SPH_C64(0xF706FBF5F3F5F50E), + SPH_C64(0xF280EF79F9797996), SPH_C64(0xDECE5F6FA16F6F30), + SPH_C64(0x3FEFFC917E91916D), SPH_C64(0xA407AA52555252F8), + SPH_C64(0xC0FD27609D606047), SPH_C64(0x657689BCCABCBC35), + SPH_C64(0x2BCDAC9B569B9B37), SPH_C64(0x018C048E028E8E8A), + SPH_C64(0x5B1571A3B6A3A3D2), SPH_C64(0x183C600C300C0C6C), + SPH_C64(0xF68AFF7BF17B7B84), SPH_C64(0x6AE1B535D4353580), + SPH_C64(0x3A69E81D741D1DF5), SPH_C64(0xDD4753E0A7E0E0B3), + SPH_C64(0xB3ACF6D77BD7D721), SPH_C64(0x99ED5EC22FC2C29C), + SPH_C64(0x5C966D2EB82E2E43), SPH_C64(0x967A624B314B4B29), + SPH_C64(0xE121A3FEDFFEFE5D), SPH_C64(0xAE168257415757D5), + SPH_C64(0x2A41A815541515BD), SPH_C64(0xEEB69F77C17777E8), + SPH_C64(0x6EEBA537DC373792), SPH_C64(0xD7567BE5B3E5E59E), + SPH_C64(0x23D98C9F469F9F13), SPH_C64(0xFD17D3F0E7F0F023), + SPH_C64(0x947F6A4A354A4A20), SPH_C64(0xA9959EDA4FDADA44), + SPH_C64(0xB025FA587D5858A2), SPH_C64(0x8FCA06C903C9C9CF), + SPH_C64(0x528D5529A429297C), SPH_C64(0x1422500A280A0A5A), + SPH_C64(0x7F4FE1B1FEB1B150), SPH_C64(0x5D1A69A0BAA0A0C9), + SPH_C64(0xD6DA7F6BB16B6B14), SPH_C64(0x17AB5C852E8585D9), + SPH_C64(0x677381BDCEBDBD3C), SPH_C64(0xBA34D25D695D5D8F), + SPH_C64(0x2050801040101090), SPH_C64(0xF503F3F4F7F4F407), + SPH_C64(0x8BC016CB0BCBCBDD), SPH_C64(0x7CC6ED3EF83E3ED3), + SPH_C64(0x0A1128051405052D), SPH_C64(0xCEE61F6781676778), + SPH_C64(0xD55373E4B7E4E497), SPH_C64(0x4EBB25279C272702), + SPH_C64(0x8258324119414173), SPH_C64(0x0B9D2C8B168B8BA7), + SPH_C64(0x530151A7A6A7A7F6), SPH_C64(0xFA94CF7DE97D7DB2), + SPH_C64(0x37FBDC956E959549), SPH_C64(0xAD9F8ED847D8D856), + SPH_C64(0xEB308BFBCBFBFB70), SPH_C64(0xC17123EE9FEEEECD), + SPH_C64(0xF891C77CED7C7CBB), SPH_C64(0xCCE3176685666671), + SPH_C64(0xA78EA6DD53DDDD7B), SPH_C64(0x2E4BB8175C1717AF), + SPH_C64(0x8E46024701474745), SPH_C64(0x21DC849E429E9E1A), + SPH_C64(0x89C51ECA0FCACAD4), SPH_C64(0x5A99752DB42D2D58), + SPH_C64(0x637991BFC6BFBF2E), SPH_C64(0x0E1B38071C07073F), + SPH_C64(0x472301AD8EADADAC), SPH_C64(0xB42FEA5A755A5AB0), + SPH_C64(0x1BB56C83368383EF), SPH_C64(0x66FF8533CC3333B6), + SPH_C64(0xC6F23F639163635C), SPH_C64(0x040A100208020212), + SPH_C64(0x493839AA92AAAA93), SPH_C64(0xE2A8AF71D97171DE), + SPH_C64(0x8DCF0EC807C8C8C6), SPH_C64(0x327DC819641919D1), + SPH_C64(0x927072493949493B), SPH_C64(0xAF9A86D943D9D95F), + SPH_C64(0xF91DC3F2EFF2F231), SPH_C64(0xDB484BE3ABE3E3A8), + SPH_C64(0xB62AE25B715B5BB9), SPH_C64(0x0D9234881A8888BC), + SPH_C64(0x29C8A49A529A9A3E), SPH_C64(0x4CBE2D269826260B), + SPH_C64(0x64FA8D32C83232BF), SPH_C64(0x7D4AE9B0FAB0B059), + SPH_C64(0xCF6A1BE983E9E9F2), SPH_C64(0x1E33780F3C0F0F77), + SPH_C64(0xB7A6E6D573D5D533), SPH_C64(0x1DBA74803A8080F4), + SPH_C64(0x617C99BEC2BEBE27), SPH_C64(0x87DE26CD13CDCDEB), + SPH_C64(0x68E4BD34D0343489), SPH_C64(0x90757A483D484832), + SPH_C64(0xE324ABFFDBFFFF54), SPH_C64(0xF48FF77AF57A7A8D), + SPH_C64(0x3DEAF4907A909064), SPH_C64(0xBE3EC25F615F5F9D), + SPH_C64(0x40A01D208020203D), SPH_C64(0xD0D56768BD68680F), + SPH_C64(0x3472D01A681A1ACA), SPH_C64(0x412C19AE82AEAEB7), + SPH_C64(0x755EC9B4EAB4B47D), SPH_C64(0xA8199A544D5454CE), + SPH_C64(0x3BE5EC937693937F), SPH_C64(0x44AA0D228822222F), + SPH_C64(0xC8E907648D646463), SPH_C64(0xFF12DBF1E3F1F12A), + SPH_C64(0xE6A2BF73D17373CC), SPH_C64(0x245A901248121282), + SPH_C64(0x805D3A401D40407A), SPH_C64(0x1028400820080848), + SPH_C64(0x9BE856C32BC3C395), SPH_C64(0xC57B33EC97ECECDF), + SPH_C64(0xAB9096DB4BDBDB4D), SPH_C64(0x5F1F61A1BEA1A1C0), + SPH_C64(0x07831C8D0E8D8D91), SPH_C64(0x7AC9F53DF43D3DC8), + SPH_C64(0x33F1CC976697975B), SPH_C64(0x0000000000000000), + SPH_C64(0x83D436CF1BCFCFF9), SPH_C64(0x5687452BAC2B2B6E), + SPH_C64(0xECB39776C57676E1), SPH_C64(0x19B06482328282E6), + SPH_C64(0xB1A9FED67FD6D628), SPH_C64(0x3677D81B6C1B1BC3), + SPH_C64(0x775BC1B5EEB5B574), SPH_C64(0x432911AF86AFAFBE), + SPH_C64(0xD4DF776AB56A6A1D), SPH_C64(0xA00DBA505D5050EA), + SPH_C64(0x8A4C124509454557), SPH_C64(0xFB18CBF3EBF3F338), + SPH_C64(0x60F09D30C03030AD), SPH_C64(0xC3742BEF9BEFEFC4), + SPH_C64(0x7EC3E53FFC3F3FDA), SPH_C64(0xAA1C9255495555C7), + SPH_C64(0x591079A2B2A2A2DB), SPH_C64(0xC96503EA8FEAEAE9), + SPH_C64(0xCAEC0F658965656A), SPH_C64(0x6968B9BAD2BABA03), + SPH_C64(0x5E93652FBC2F2F4A), SPH_C64(0x9DE74EC027C0C08E), + SPH_C64(0xA181BEDE5FDEDE60), SPH_C64(0x386CE01C701C1CFC), + SPH_C64(0xE72EBBFDD3FDFD46), SPH_C64(0x9A64524D294D4D1F), + SPH_C64(0x39E0E49272929276), SPH_C64(0xEABC8F75C97575FA), + SPH_C64(0x0C1E300618060636), SPH_C64(0x0998248A128A8AAE), + SPH_C64(0x7940F9B2F2B2B24B), SPH_C64(0xD15963E6BFE6E685), + SPH_C64(0x1C36700E380E0E7E), SPH_C64(0x3E63F81F7C1F1FE7), + SPH_C64(0xC4F7376295626255), SPH_C64(0xB5A3EED477D4D43A), + SPH_C64(0x4D3229A89AA8A881), SPH_C64(0x31F4C49662969652), + SPH_C64(0xEF3A9BF9C3F9F962), SPH_C64(0x97F666C533C5C5A3), + SPH_C64(0x4AB1352594252510), SPH_C64(0xB220F259795959AB), + SPH_C64(0x15AE54842A8484D0), SPH_C64(0xE4A7B772D57272C5), + SPH_C64(0x72DDD539E43939EC), SPH_C64(0x98615A4C2D4C4C16), + SPH_C64(0xBC3BCA5E655E5E94), SPH_C64(0xF085E778FD78789F), + SPH_C64(0x70D8DD38E03838E5), SPH_C64(0x0586148C0A8C8C98), + SPH_C64(0xBFB2C6D163D1D117), SPH_C64(0x570B41A5AEA5A5E4), + SPH_C64(0xD94D43E2AFE2E2A1), SPH_C64(0xC2F82F619961614E), + SPH_C64(0x7B45F1B3F6B3B342), SPH_C64(0x42A5152184212134), + SPH_C64(0x25D6949C4A9C9C08), SPH_C64(0x3C66F01E781E1EEE), + SPH_C64(0x8652224311434361), SPH_C64(0x93FC76C73BC7C7B1), + SPH_C64(0xE52BB3FCD7FCFC4F), SPH_C64(0x0814200410040424), + SPH_C64(0xA208B251595151E3), SPH_C64(0x2FC7BC995E999925), + SPH_C64(0xDAC44F6DA96D6D22), SPH_C64(0x1A39680D340D0D65), + SPH_C64(0xE93583FACFFAFA79), SPH_C64(0xA384B6DF5BDFDF69), + SPH_C64(0xFC9BD77EE57E7EA9), SPH_C64(0x48B43D2490242419), + SPH_C64(0x76D7C53BEC3B3BFE), SPH_C64(0x4B3D31AB96ABAB9A), + SPH_C64(0x81D13ECE1FCECEF0), SPH_C64(0x2255881144111199), + SPH_C64(0x03890C8F068F8F83), SPH_C64(0x9C6B4A4E254E4E04), + SPH_C64(0x7351D1B7E6B7B766), SPH_C64(0xCB600BEB8BEBEBE0), + SPH_C64(0x78CCFD3CF03C3CC1), SPH_C64(0x1FBF7C813E8181FD), + SPH_C64(0x35FED4946A949440), SPH_C64(0xF30CEBF7FBF7F71C), + SPH_C64(0x6F67A1B9DEB9B918), SPH_C64(0x265F98134C13138B), + SPH_C64(0x589C7D2CB02C2C51), SPH_C64(0xBBB8D6D36BD3D305), + SPH_C64(0xD35C6BE7BBE7E78C), SPH_C64(0xDCCB576EA56E6E39), + SPH_C64(0x95F36EC437C4C4AA), SPH_C64(0x060F18030C03031B), + SPH_C64(0xAC138A56455656DC), SPH_C64(0x88491A440D44445E), + SPH_C64(0xFE9EDF7FE17F7FA0), SPH_C64(0x4F3721A99EA9A988), + SPH_C64(0x54824D2AA82A2A67), SPH_C64(0x6B6DB1BBD6BBBB0A), + SPH_C64(0x9FE246C123C1C187), SPH_C64(0xA602A253515353F1), + SPH_C64(0xA58BAEDC57DCDC72), SPH_C64(0x1627580B2C0B0B53), + SPH_C64(0x27D39C9D4E9D9D01), SPH_C64(0xD8C1476CAD6C6C2B), + SPH_C64(0x62F59531C43131A4), SPH_C64(0xE8B98774CD7474F3), + SPH_C64(0xF109E3F6FFF6F615), SPH_C64(0x8C430A460546464C), + SPH_C64(0x452609AC8AACACA5), SPH_C64(0x0F973C891E8989B5), + SPH_C64(0x2844A014501414B4), SPH_C64(0xDF425BE1A3E1E1BA), + SPH_C64(0x2C4EB016581616A6), SPH_C64(0x74D2CD3AE83A3AF7), + SPH_C64(0xD2D06F69B9696906), SPH_C64(0x122D480924090941), + SPH_C64(0xE0ADA770DD7070D7), SPH_C64(0x7154D9B6E2B6B66F), + SPH_C64(0xBDB7CED067D0D01E), SPH_C64(0xC77E3BED93EDEDD6), + SPH_C64(0x85DB2ECC17CCCCE2), SPH_C64(0x84572A4215424268), + SPH_C64(0x2DC2B4985A98982C), SPH_C64(0x550E49A4AAA4A4ED), + SPH_C64(0x50885D28A0282875), SPH_C64(0xB831DA5C6D5C5C86), + SPH_C64(0xED3F93F8C7F8F86B), SPH_C64(0x11A44486228686C2) +}; + +static const sph_u64 plain_T2[256] = { + SPH_C64(0x78C018601818D830), SPH_C64(0xAF05238C23232646), + SPH_C64(0xF97EC63FC6C6B891), SPH_C64(0x6F13E887E8E8FBCD), + SPH_C64(0xA14C87268787CB13), SPH_C64(0x62A9B8DAB8B8116D), + SPH_C64(0x0508010401010902), SPH_C64(0x6E424F214F4F0D9E), + SPH_C64(0xEEAD36D836369B6C), SPH_C64(0x0459A6A2A6A6FF51), + SPH_C64(0xBDDED26FD2D20CB9), SPH_C64(0x06FBF5F3F5F50EF7), + SPH_C64(0x80EF79F9797996F2), SPH_C64(0xCE5F6FA16F6F30DE), + SPH_C64(0xEFFC917E91916D3F), SPH_C64(0x07AA52555252F8A4), + SPH_C64(0xFD27609D606047C0), SPH_C64(0x7689BCCABCBC3565), + SPH_C64(0xCDAC9B569B9B372B), SPH_C64(0x8C048E028E8E8A01), + SPH_C64(0x1571A3B6A3A3D25B), SPH_C64(0x3C600C300C0C6C18), + SPH_C64(0x8AFF7BF17B7B84F6), SPH_C64(0xE1B535D43535806A), + SPH_C64(0x69E81D741D1DF53A), SPH_C64(0x4753E0A7E0E0B3DD), + SPH_C64(0xACF6D77BD7D721B3), SPH_C64(0xED5EC22FC2C29C99), + SPH_C64(0x966D2EB82E2E435C), SPH_C64(0x7A624B314B4B2996), + SPH_C64(0x21A3FEDFFEFE5DE1), SPH_C64(0x168257415757D5AE), + SPH_C64(0x41A815541515BD2A), SPH_C64(0xB69F77C17777E8EE), + SPH_C64(0xEBA537DC3737926E), SPH_C64(0x567BE5B3E5E59ED7), + SPH_C64(0xD98C9F469F9F1323), SPH_C64(0x17D3F0E7F0F023FD), + SPH_C64(0x7F6A4A354A4A2094), SPH_C64(0x959EDA4FDADA44A9), + SPH_C64(0x25FA587D5858A2B0), SPH_C64(0xCA06C903C9C9CF8F), + SPH_C64(0x8D5529A429297C52), SPH_C64(0x22500A280A0A5A14), + SPH_C64(0x4FE1B1FEB1B1507F), SPH_C64(0x1A69A0BAA0A0C95D), + SPH_C64(0xDA7F6BB16B6B14D6), SPH_C64(0xAB5C852E8585D917), + SPH_C64(0x7381BDCEBDBD3C67), SPH_C64(0x34D25D695D5D8FBA), + SPH_C64(0x5080104010109020), SPH_C64(0x03F3F4F7F4F407F5), + SPH_C64(0xC016CB0BCBCBDD8B), SPH_C64(0xC6ED3EF83E3ED37C), + SPH_C64(0x1128051405052D0A), SPH_C64(0xE61F6781676778CE), + SPH_C64(0x5373E4B7E4E497D5), SPH_C64(0xBB25279C2727024E), + SPH_C64(0x5832411941417382), SPH_C64(0x9D2C8B168B8BA70B), + SPH_C64(0x0151A7A6A7A7F653), SPH_C64(0x94CF7DE97D7DB2FA), + SPH_C64(0xFBDC956E95954937), SPH_C64(0x9F8ED847D8D856AD), + SPH_C64(0x308BFBCBFBFB70EB), SPH_C64(0x7123EE9FEEEECDC1), + SPH_C64(0x91C77CED7C7CBBF8), SPH_C64(0xE3176685666671CC), + SPH_C64(0x8EA6DD53DDDD7BA7), SPH_C64(0x4BB8175C1717AF2E), + SPH_C64(0x460247014747458E), SPH_C64(0xDC849E429E9E1A21), + SPH_C64(0xC51ECA0FCACAD489), SPH_C64(0x99752DB42D2D585A), + SPH_C64(0x7991BFC6BFBF2E63), SPH_C64(0x1B38071C07073F0E), + SPH_C64(0x2301AD8EADADAC47), SPH_C64(0x2FEA5A755A5AB0B4), + SPH_C64(0xB56C83368383EF1B), SPH_C64(0xFF8533CC3333B666), + SPH_C64(0xF23F639163635CC6), SPH_C64(0x0A10020802021204), + SPH_C64(0x3839AA92AAAA9349), SPH_C64(0xA8AF71D97171DEE2), + SPH_C64(0xCF0EC807C8C8C68D), SPH_C64(0x7DC819641919D132), + SPH_C64(0x7072493949493B92), SPH_C64(0x9A86D943D9D95FAF), + SPH_C64(0x1DC3F2EFF2F231F9), SPH_C64(0x484BE3ABE3E3A8DB), + SPH_C64(0x2AE25B715B5BB9B6), SPH_C64(0x9234881A8888BC0D), + SPH_C64(0xC8A49A529A9A3E29), SPH_C64(0xBE2D269826260B4C), + SPH_C64(0xFA8D32C83232BF64), SPH_C64(0x4AE9B0FAB0B0597D), + SPH_C64(0x6A1BE983E9E9F2CF), SPH_C64(0x33780F3C0F0F771E), + SPH_C64(0xA6E6D573D5D533B7), SPH_C64(0xBA74803A8080F41D), + SPH_C64(0x7C99BEC2BEBE2761), SPH_C64(0xDE26CD13CDCDEB87), + SPH_C64(0xE4BD34D034348968), SPH_C64(0x757A483D48483290), + SPH_C64(0x24ABFFDBFFFF54E3), SPH_C64(0x8FF77AF57A7A8DF4), + SPH_C64(0xEAF4907A9090643D), SPH_C64(0x3EC25F615F5F9DBE), + SPH_C64(0xA01D208020203D40), SPH_C64(0xD56768BD68680FD0), + SPH_C64(0x72D01A681A1ACA34), SPH_C64(0x2C19AE82AEAEB741), + SPH_C64(0x5EC9B4EAB4B47D75), SPH_C64(0x199A544D5454CEA8), + SPH_C64(0xE5EC937693937F3B), SPH_C64(0xAA0D228822222F44), + SPH_C64(0xE907648D646463C8), SPH_C64(0x12DBF1E3F1F12AFF), + SPH_C64(0xA2BF73D17373CCE6), SPH_C64(0x5A90124812128224), + SPH_C64(0x5D3A401D40407A80), SPH_C64(0x2840082008084810), + SPH_C64(0xE856C32BC3C3959B), SPH_C64(0x7B33EC97ECECDFC5), + SPH_C64(0x9096DB4BDBDB4DAB), SPH_C64(0x1F61A1BEA1A1C05F), + SPH_C64(0x831C8D0E8D8D9107), SPH_C64(0xC9F53DF43D3DC87A), + SPH_C64(0xF1CC976697975B33), SPH_C64(0x0000000000000000), + SPH_C64(0xD436CF1BCFCFF983), SPH_C64(0x87452BAC2B2B6E56), + SPH_C64(0xB39776C57676E1EC), SPH_C64(0xB06482328282E619), + SPH_C64(0xA9FED67FD6D628B1), SPH_C64(0x77D81B6C1B1BC336), + SPH_C64(0x5BC1B5EEB5B57477), SPH_C64(0x2911AF86AFAFBE43), + SPH_C64(0xDF776AB56A6A1DD4), SPH_C64(0x0DBA505D5050EAA0), + SPH_C64(0x4C1245094545578A), SPH_C64(0x18CBF3EBF3F338FB), + SPH_C64(0xF09D30C03030AD60), SPH_C64(0x742BEF9BEFEFC4C3), + SPH_C64(0xC3E53FFC3F3FDA7E), SPH_C64(0x1C9255495555C7AA), + SPH_C64(0x1079A2B2A2A2DB59), SPH_C64(0x6503EA8FEAEAE9C9), + SPH_C64(0xEC0F658965656ACA), SPH_C64(0x68B9BAD2BABA0369), + SPH_C64(0x93652FBC2F2F4A5E), SPH_C64(0xE74EC027C0C08E9D), + SPH_C64(0x81BEDE5FDEDE60A1), SPH_C64(0x6CE01C701C1CFC38), + SPH_C64(0x2EBBFDD3FDFD46E7), SPH_C64(0x64524D294D4D1F9A), + SPH_C64(0xE0E4927292927639), SPH_C64(0xBC8F75C97575FAEA), + SPH_C64(0x1E3006180606360C), SPH_C64(0x98248A128A8AAE09), + SPH_C64(0x40F9B2F2B2B24B79), SPH_C64(0x5963E6BFE6E685D1), + SPH_C64(0x36700E380E0E7E1C), SPH_C64(0x63F81F7C1F1FE73E), + SPH_C64(0xF7376295626255C4), SPH_C64(0xA3EED477D4D43AB5), + SPH_C64(0x3229A89AA8A8814D), SPH_C64(0xF4C4966296965231), + SPH_C64(0x3A9BF9C3F9F962EF), SPH_C64(0xF666C533C5C5A397), + SPH_C64(0xB13525942525104A), SPH_C64(0x20F259795959ABB2), + SPH_C64(0xAE54842A8484D015), SPH_C64(0xA7B772D57272C5E4), + SPH_C64(0xDDD539E43939EC72), SPH_C64(0x615A4C2D4C4C1698), + SPH_C64(0x3BCA5E655E5E94BC), SPH_C64(0x85E778FD78789FF0), + SPH_C64(0xD8DD38E03838E570), SPH_C64(0x86148C0A8C8C9805), + SPH_C64(0xB2C6D163D1D117BF), SPH_C64(0x0B41A5AEA5A5E457), + SPH_C64(0x4D43E2AFE2E2A1D9), SPH_C64(0xF82F619961614EC2), + SPH_C64(0x45F1B3F6B3B3427B), SPH_C64(0xA515218421213442), + SPH_C64(0xD6949C4A9C9C0825), SPH_C64(0x66F01E781E1EEE3C), + SPH_C64(0x5222431143436186), SPH_C64(0xFC76C73BC7C7B193), + SPH_C64(0x2BB3FCD7FCFC4FE5), SPH_C64(0x1420041004042408), + SPH_C64(0x08B251595151E3A2), SPH_C64(0xC7BC995E9999252F), + SPH_C64(0xC44F6DA96D6D22DA), SPH_C64(0x39680D340D0D651A), + SPH_C64(0x3583FACFFAFA79E9), SPH_C64(0x84B6DF5BDFDF69A3), + SPH_C64(0x9BD77EE57E7EA9FC), SPH_C64(0xB43D249024241948), + SPH_C64(0xD7C53BEC3B3BFE76), SPH_C64(0x3D31AB96ABAB9A4B), + SPH_C64(0xD13ECE1FCECEF081), SPH_C64(0x5588114411119922), + SPH_C64(0x890C8F068F8F8303), SPH_C64(0x6B4A4E254E4E049C), + SPH_C64(0x51D1B7E6B7B76673), SPH_C64(0x600BEB8BEBEBE0CB), + SPH_C64(0xCCFD3CF03C3CC178), SPH_C64(0xBF7C813E8181FD1F), + SPH_C64(0xFED4946A94944035), SPH_C64(0x0CEBF7FBF7F71CF3), + SPH_C64(0x67A1B9DEB9B9186F), SPH_C64(0x5F98134C13138B26), + SPH_C64(0x9C7D2CB02C2C5158), SPH_C64(0xB8D6D36BD3D305BB), + SPH_C64(0x5C6BE7BBE7E78CD3), SPH_C64(0xCB576EA56E6E39DC), + SPH_C64(0xF36EC437C4C4AA95), SPH_C64(0x0F18030C03031B06), + SPH_C64(0x138A56455656DCAC), SPH_C64(0x491A440D44445E88), + SPH_C64(0x9EDF7FE17F7FA0FE), SPH_C64(0x3721A99EA9A9884F), + SPH_C64(0x824D2AA82A2A6754), SPH_C64(0x6DB1BBD6BBBB0A6B), + SPH_C64(0xE246C123C1C1879F), SPH_C64(0x02A253515353F1A6), + SPH_C64(0x8BAEDC57DCDC72A5), SPH_C64(0x27580B2C0B0B5316), + SPH_C64(0xD39C9D4E9D9D0127), SPH_C64(0xC1476CAD6C6C2BD8), + SPH_C64(0xF59531C43131A462), SPH_C64(0xB98774CD7474F3E8), + SPH_C64(0x09E3F6FFF6F615F1), SPH_C64(0x430A460546464C8C), + SPH_C64(0x2609AC8AACACA545), SPH_C64(0x973C891E8989B50F), + SPH_C64(0x44A014501414B428), SPH_C64(0x425BE1A3E1E1BADF), + SPH_C64(0x4EB016581616A62C), SPH_C64(0xD2CD3AE83A3AF774), + SPH_C64(0xD06F69B9696906D2), SPH_C64(0x2D48092409094112), + SPH_C64(0xADA770DD7070D7E0), SPH_C64(0x54D9B6E2B6B66F71), + SPH_C64(0xB7CED067D0D01EBD), SPH_C64(0x7E3BED93EDEDD6C7), + SPH_C64(0xDB2ECC17CCCCE285), SPH_C64(0x572A421542426884), + SPH_C64(0xC2B4985A98982C2D), SPH_C64(0x0E49A4AAA4A4ED55), + SPH_C64(0x885D28A028287550), SPH_C64(0x31DA5C6D5C5C86B8), + SPH_C64(0x3F93F8C7F8F86BED), SPH_C64(0xA44486228686C211) +}; + +static const sph_u64 plain_T3[256] = { + SPH_C64(0xC018601818D83078), SPH_C64(0x05238C23232646AF), + SPH_C64(0x7EC63FC6C6B891F9), SPH_C64(0x13E887E8E8FBCD6F), + SPH_C64(0x4C87268787CB13A1), SPH_C64(0xA9B8DAB8B8116D62), + SPH_C64(0x0801040101090205), SPH_C64(0x424F214F4F0D9E6E), + SPH_C64(0xAD36D836369B6CEE), SPH_C64(0x59A6A2A6A6FF5104), + SPH_C64(0xDED26FD2D20CB9BD), SPH_C64(0xFBF5F3F5F50EF706), + SPH_C64(0xEF79F9797996F280), SPH_C64(0x5F6FA16F6F30DECE), + SPH_C64(0xFC917E91916D3FEF), SPH_C64(0xAA52555252F8A407), + SPH_C64(0x27609D606047C0FD), SPH_C64(0x89BCCABCBC356576), + SPH_C64(0xAC9B569B9B372BCD), SPH_C64(0x048E028E8E8A018C), + SPH_C64(0x71A3B6A3A3D25B15), SPH_C64(0x600C300C0C6C183C), + SPH_C64(0xFF7BF17B7B84F68A), SPH_C64(0xB535D43535806AE1), + SPH_C64(0xE81D741D1DF53A69), SPH_C64(0x53E0A7E0E0B3DD47), + SPH_C64(0xF6D77BD7D721B3AC), SPH_C64(0x5EC22FC2C29C99ED), + SPH_C64(0x6D2EB82E2E435C96), SPH_C64(0x624B314B4B29967A), + SPH_C64(0xA3FEDFFEFE5DE121), SPH_C64(0x8257415757D5AE16), + SPH_C64(0xA815541515BD2A41), SPH_C64(0x9F77C17777E8EEB6), + SPH_C64(0xA537DC3737926EEB), SPH_C64(0x7BE5B3E5E59ED756), + SPH_C64(0x8C9F469F9F1323D9), SPH_C64(0xD3F0E7F0F023FD17), + SPH_C64(0x6A4A354A4A20947F), SPH_C64(0x9EDA4FDADA44A995), + SPH_C64(0xFA587D5858A2B025), SPH_C64(0x06C903C9C9CF8FCA), + SPH_C64(0x5529A429297C528D), SPH_C64(0x500A280A0A5A1422), + SPH_C64(0xE1B1FEB1B1507F4F), SPH_C64(0x69A0BAA0A0C95D1A), + SPH_C64(0x7F6BB16B6B14D6DA), SPH_C64(0x5C852E8585D917AB), + SPH_C64(0x81BDCEBDBD3C6773), SPH_C64(0xD25D695D5D8FBA34), + SPH_C64(0x8010401010902050), SPH_C64(0xF3F4F7F4F407F503), + SPH_C64(0x16CB0BCBCBDD8BC0), SPH_C64(0xED3EF83E3ED37CC6), + SPH_C64(0x28051405052D0A11), SPH_C64(0x1F6781676778CEE6), + SPH_C64(0x73E4B7E4E497D553), SPH_C64(0x25279C2727024EBB), + SPH_C64(0x3241194141738258), SPH_C64(0x2C8B168B8BA70B9D), + SPH_C64(0x51A7A6A7A7F65301), SPH_C64(0xCF7DE97D7DB2FA94), + SPH_C64(0xDC956E95954937FB), SPH_C64(0x8ED847D8D856AD9F), + SPH_C64(0x8BFBCBFBFB70EB30), SPH_C64(0x23EE9FEEEECDC171), + SPH_C64(0xC77CED7C7CBBF891), SPH_C64(0x176685666671CCE3), + SPH_C64(0xA6DD53DDDD7BA78E), SPH_C64(0xB8175C1717AF2E4B), + SPH_C64(0x0247014747458E46), SPH_C64(0x849E429E9E1A21DC), + SPH_C64(0x1ECA0FCACAD489C5), SPH_C64(0x752DB42D2D585A99), + SPH_C64(0x91BFC6BFBF2E6379), SPH_C64(0x38071C07073F0E1B), + SPH_C64(0x01AD8EADADAC4723), SPH_C64(0xEA5A755A5AB0B42F), + SPH_C64(0x6C83368383EF1BB5), SPH_C64(0x8533CC3333B666FF), + SPH_C64(0x3F639163635CC6F2), SPH_C64(0x100208020212040A), + SPH_C64(0x39AA92AAAA934938), SPH_C64(0xAF71D97171DEE2A8), + SPH_C64(0x0EC807C8C8C68DCF), SPH_C64(0xC819641919D1327D), + SPH_C64(0x72493949493B9270), SPH_C64(0x86D943D9D95FAF9A), + SPH_C64(0xC3F2EFF2F231F91D), SPH_C64(0x4BE3ABE3E3A8DB48), + SPH_C64(0xE25B715B5BB9B62A), SPH_C64(0x34881A8888BC0D92), + SPH_C64(0xA49A529A9A3E29C8), SPH_C64(0x2D269826260B4CBE), + SPH_C64(0x8D32C83232BF64FA), SPH_C64(0xE9B0FAB0B0597D4A), + SPH_C64(0x1BE983E9E9F2CF6A), SPH_C64(0x780F3C0F0F771E33), + SPH_C64(0xE6D573D5D533B7A6), SPH_C64(0x74803A8080F41DBA), + SPH_C64(0x99BEC2BEBE27617C), SPH_C64(0x26CD13CDCDEB87DE), + SPH_C64(0xBD34D034348968E4), SPH_C64(0x7A483D4848329075), + SPH_C64(0xABFFDBFFFF54E324), SPH_C64(0xF77AF57A7A8DF48F), + SPH_C64(0xF4907A9090643DEA), SPH_C64(0xC25F615F5F9DBE3E), + SPH_C64(0x1D208020203D40A0), SPH_C64(0x6768BD68680FD0D5), + SPH_C64(0xD01A681A1ACA3472), SPH_C64(0x19AE82AEAEB7412C), + SPH_C64(0xC9B4EAB4B47D755E), SPH_C64(0x9A544D5454CEA819), + SPH_C64(0xEC937693937F3BE5), SPH_C64(0x0D228822222F44AA), + SPH_C64(0x07648D646463C8E9), SPH_C64(0xDBF1E3F1F12AFF12), + SPH_C64(0xBF73D17373CCE6A2), SPH_C64(0x901248121282245A), + SPH_C64(0x3A401D40407A805D), SPH_C64(0x4008200808481028), + SPH_C64(0x56C32BC3C3959BE8), SPH_C64(0x33EC97ECECDFC57B), + SPH_C64(0x96DB4BDBDB4DAB90), SPH_C64(0x61A1BEA1A1C05F1F), + SPH_C64(0x1C8D0E8D8D910783), SPH_C64(0xF53DF43D3DC87AC9), + SPH_C64(0xCC976697975B33F1), SPH_C64(0x0000000000000000), + SPH_C64(0x36CF1BCFCFF983D4), SPH_C64(0x452BAC2B2B6E5687), + SPH_C64(0x9776C57676E1ECB3), SPH_C64(0x6482328282E619B0), + SPH_C64(0xFED67FD6D628B1A9), SPH_C64(0xD81B6C1B1BC33677), + SPH_C64(0xC1B5EEB5B574775B), SPH_C64(0x11AF86AFAFBE4329), + SPH_C64(0x776AB56A6A1DD4DF), SPH_C64(0xBA505D5050EAA00D), + SPH_C64(0x1245094545578A4C), SPH_C64(0xCBF3EBF3F338FB18), + SPH_C64(0x9D30C03030AD60F0), SPH_C64(0x2BEF9BEFEFC4C374), + SPH_C64(0xE53FFC3F3FDA7EC3), SPH_C64(0x9255495555C7AA1C), + SPH_C64(0x79A2B2A2A2DB5910), SPH_C64(0x03EA8FEAEAE9C965), + SPH_C64(0x0F658965656ACAEC), SPH_C64(0xB9BAD2BABA036968), + SPH_C64(0x652FBC2F2F4A5E93), SPH_C64(0x4EC027C0C08E9DE7), + SPH_C64(0xBEDE5FDEDE60A181), SPH_C64(0xE01C701C1CFC386C), + SPH_C64(0xBBFDD3FDFD46E72E), SPH_C64(0x524D294D4D1F9A64), + SPH_C64(0xE4927292927639E0), SPH_C64(0x8F75C97575FAEABC), + SPH_C64(0x3006180606360C1E), SPH_C64(0x248A128A8AAE0998), + SPH_C64(0xF9B2F2B2B24B7940), SPH_C64(0x63E6BFE6E685D159), + SPH_C64(0x700E380E0E7E1C36), SPH_C64(0xF81F7C1F1FE73E63), + SPH_C64(0x376295626255C4F7), SPH_C64(0xEED477D4D43AB5A3), + SPH_C64(0x29A89AA8A8814D32), SPH_C64(0xC4966296965231F4), + SPH_C64(0x9BF9C3F9F962EF3A), SPH_C64(0x66C533C5C5A397F6), + SPH_C64(0x3525942525104AB1), SPH_C64(0xF259795959ABB220), + SPH_C64(0x54842A8484D015AE), SPH_C64(0xB772D57272C5E4A7), + SPH_C64(0xD539E43939EC72DD), SPH_C64(0x5A4C2D4C4C169861), + SPH_C64(0xCA5E655E5E94BC3B), SPH_C64(0xE778FD78789FF085), + SPH_C64(0xDD38E03838E570D8), SPH_C64(0x148C0A8C8C980586), + SPH_C64(0xC6D163D1D117BFB2), SPH_C64(0x41A5AEA5A5E4570B), + SPH_C64(0x43E2AFE2E2A1D94D), SPH_C64(0x2F619961614EC2F8), + SPH_C64(0xF1B3F6B3B3427B45), SPH_C64(0x15218421213442A5), + SPH_C64(0x949C4A9C9C0825D6), SPH_C64(0xF01E781E1EEE3C66), + SPH_C64(0x2243114343618652), SPH_C64(0x76C73BC7C7B193FC), + SPH_C64(0xB3FCD7FCFC4FE52B), SPH_C64(0x2004100404240814), + SPH_C64(0xB251595151E3A208), SPH_C64(0xBC995E9999252FC7), + SPH_C64(0x4F6DA96D6D22DAC4), SPH_C64(0x680D340D0D651A39), + SPH_C64(0x83FACFFAFA79E935), SPH_C64(0xB6DF5BDFDF69A384), + SPH_C64(0xD77EE57E7EA9FC9B), SPH_C64(0x3D249024241948B4), + SPH_C64(0xC53BEC3B3BFE76D7), SPH_C64(0x31AB96ABAB9A4B3D), + SPH_C64(0x3ECE1FCECEF081D1), SPH_C64(0x8811441111992255), + SPH_C64(0x0C8F068F8F830389), SPH_C64(0x4A4E254E4E049C6B), + SPH_C64(0xD1B7E6B7B7667351), SPH_C64(0x0BEB8BEBEBE0CB60), + SPH_C64(0xFD3CF03C3CC178CC), SPH_C64(0x7C813E8181FD1FBF), + SPH_C64(0xD4946A94944035FE), SPH_C64(0xEBF7FBF7F71CF30C), + SPH_C64(0xA1B9DEB9B9186F67), SPH_C64(0x98134C13138B265F), + SPH_C64(0x7D2CB02C2C51589C), SPH_C64(0xD6D36BD3D305BBB8), + SPH_C64(0x6BE7BBE7E78CD35C), SPH_C64(0x576EA56E6E39DCCB), + SPH_C64(0x6EC437C4C4AA95F3), SPH_C64(0x18030C03031B060F), + SPH_C64(0x8A56455656DCAC13), SPH_C64(0x1A440D44445E8849), + SPH_C64(0xDF7FE17F7FA0FE9E), SPH_C64(0x21A99EA9A9884F37), + SPH_C64(0x4D2AA82A2A675482), SPH_C64(0xB1BBD6BBBB0A6B6D), + SPH_C64(0x46C123C1C1879FE2), SPH_C64(0xA253515353F1A602), + SPH_C64(0xAEDC57DCDC72A58B), SPH_C64(0x580B2C0B0B531627), + SPH_C64(0x9C9D4E9D9D0127D3), SPH_C64(0x476CAD6C6C2BD8C1), + SPH_C64(0x9531C43131A462F5), SPH_C64(0x8774CD7474F3E8B9), + SPH_C64(0xE3F6FFF6F615F109), SPH_C64(0x0A460546464C8C43), + SPH_C64(0x09AC8AACACA54526), SPH_C64(0x3C891E8989B50F97), + SPH_C64(0xA014501414B42844), SPH_C64(0x5BE1A3E1E1BADF42), + SPH_C64(0xB016581616A62C4E), SPH_C64(0xCD3AE83A3AF774D2), + SPH_C64(0x6F69B9696906D2D0), SPH_C64(0x480924090941122D), + SPH_C64(0xA770DD7070D7E0AD), SPH_C64(0xD9B6E2B6B66F7154), + SPH_C64(0xCED067D0D01EBDB7), SPH_C64(0x3BED93EDEDD6C77E), + SPH_C64(0x2ECC17CCCCE285DB), SPH_C64(0x2A42154242688457), + SPH_C64(0xB4985A98982C2DC2), SPH_C64(0x49A4AAA4A4ED550E), + SPH_C64(0x5D28A02828755088), SPH_C64(0xDA5C6D5C5C86B831), + SPH_C64(0x93F8C7F8F86BED3F), SPH_C64(0x4486228686C211A4) +}; + +static const sph_u64 plain_T4[256] = { + SPH_C64(0x18601818D83078C0), SPH_C64(0x238C23232646AF05), + SPH_C64(0xC63FC6C6B891F97E), SPH_C64(0xE887E8E8FBCD6F13), + SPH_C64(0x87268787CB13A14C), SPH_C64(0xB8DAB8B8116D62A9), + SPH_C64(0x0104010109020508), SPH_C64(0x4F214F4F0D9E6E42), + SPH_C64(0x36D836369B6CEEAD), SPH_C64(0xA6A2A6A6FF510459), + SPH_C64(0xD26FD2D20CB9BDDE), SPH_C64(0xF5F3F5F50EF706FB), + SPH_C64(0x79F9797996F280EF), SPH_C64(0x6FA16F6F30DECE5F), + SPH_C64(0x917E91916D3FEFFC), SPH_C64(0x52555252F8A407AA), + SPH_C64(0x609D606047C0FD27), SPH_C64(0xBCCABCBC35657689), + SPH_C64(0x9B569B9B372BCDAC), SPH_C64(0x8E028E8E8A018C04), + SPH_C64(0xA3B6A3A3D25B1571), SPH_C64(0x0C300C0C6C183C60), + SPH_C64(0x7BF17B7B84F68AFF), SPH_C64(0x35D43535806AE1B5), + SPH_C64(0x1D741D1DF53A69E8), SPH_C64(0xE0A7E0E0B3DD4753), + SPH_C64(0xD77BD7D721B3ACF6), SPH_C64(0xC22FC2C29C99ED5E), + SPH_C64(0x2EB82E2E435C966D), SPH_C64(0x4B314B4B29967A62), + SPH_C64(0xFEDFFEFE5DE121A3), SPH_C64(0x57415757D5AE1682), + SPH_C64(0x15541515BD2A41A8), SPH_C64(0x77C17777E8EEB69F), + SPH_C64(0x37DC3737926EEBA5), SPH_C64(0xE5B3E5E59ED7567B), + SPH_C64(0x9F469F9F1323D98C), SPH_C64(0xF0E7F0F023FD17D3), + SPH_C64(0x4A354A4A20947F6A), SPH_C64(0xDA4FDADA44A9959E), + SPH_C64(0x587D5858A2B025FA), SPH_C64(0xC903C9C9CF8FCA06), + SPH_C64(0x29A429297C528D55), SPH_C64(0x0A280A0A5A142250), + SPH_C64(0xB1FEB1B1507F4FE1), SPH_C64(0xA0BAA0A0C95D1A69), + SPH_C64(0x6BB16B6B14D6DA7F), SPH_C64(0x852E8585D917AB5C), + SPH_C64(0xBDCEBDBD3C677381), SPH_C64(0x5D695D5D8FBA34D2), + SPH_C64(0x1040101090205080), SPH_C64(0xF4F7F4F407F503F3), + SPH_C64(0xCB0BCBCBDD8BC016), SPH_C64(0x3EF83E3ED37CC6ED), + SPH_C64(0x051405052D0A1128), SPH_C64(0x6781676778CEE61F), + SPH_C64(0xE4B7E4E497D55373), SPH_C64(0x279C2727024EBB25), + SPH_C64(0x4119414173825832), SPH_C64(0x8B168B8BA70B9D2C), + SPH_C64(0xA7A6A7A7F6530151), SPH_C64(0x7DE97D7DB2FA94CF), + SPH_C64(0x956E95954937FBDC), SPH_C64(0xD847D8D856AD9F8E), + SPH_C64(0xFBCBFBFB70EB308B), SPH_C64(0xEE9FEEEECDC17123), + SPH_C64(0x7CED7C7CBBF891C7), SPH_C64(0x6685666671CCE317), + SPH_C64(0xDD53DDDD7BA78EA6), SPH_C64(0x175C1717AF2E4BB8), + SPH_C64(0x47014747458E4602), SPH_C64(0x9E429E9E1A21DC84), + SPH_C64(0xCA0FCACAD489C51E), SPH_C64(0x2DB42D2D585A9975), + SPH_C64(0xBFC6BFBF2E637991), SPH_C64(0x071C07073F0E1B38), + SPH_C64(0xAD8EADADAC472301), SPH_C64(0x5A755A5AB0B42FEA), + SPH_C64(0x83368383EF1BB56C), SPH_C64(0x33CC3333B666FF85), + SPH_C64(0x639163635CC6F23F), SPH_C64(0x0208020212040A10), + SPH_C64(0xAA92AAAA93493839), SPH_C64(0x71D97171DEE2A8AF), + SPH_C64(0xC807C8C8C68DCF0E), SPH_C64(0x19641919D1327DC8), + SPH_C64(0x493949493B927072), SPH_C64(0xD943D9D95FAF9A86), + SPH_C64(0xF2EFF2F231F91DC3), SPH_C64(0xE3ABE3E3A8DB484B), + SPH_C64(0x5B715B5BB9B62AE2), SPH_C64(0x881A8888BC0D9234), + SPH_C64(0x9A529A9A3E29C8A4), SPH_C64(0x269826260B4CBE2D), + SPH_C64(0x32C83232BF64FA8D), SPH_C64(0xB0FAB0B0597D4AE9), + SPH_C64(0xE983E9E9F2CF6A1B), SPH_C64(0x0F3C0F0F771E3378), + SPH_C64(0xD573D5D533B7A6E6), SPH_C64(0x803A8080F41DBA74), + SPH_C64(0xBEC2BEBE27617C99), SPH_C64(0xCD13CDCDEB87DE26), + SPH_C64(0x34D034348968E4BD), SPH_C64(0x483D48483290757A), + SPH_C64(0xFFDBFFFF54E324AB), SPH_C64(0x7AF57A7A8DF48FF7), + SPH_C64(0x907A9090643DEAF4), SPH_C64(0x5F615F5F9DBE3EC2), + SPH_C64(0x208020203D40A01D), SPH_C64(0x68BD68680FD0D567), + SPH_C64(0x1A681A1ACA3472D0), SPH_C64(0xAE82AEAEB7412C19), + SPH_C64(0xB4EAB4B47D755EC9), SPH_C64(0x544D5454CEA8199A), + SPH_C64(0x937693937F3BE5EC), SPH_C64(0x228822222F44AA0D), + SPH_C64(0x648D646463C8E907), SPH_C64(0xF1E3F1F12AFF12DB), + SPH_C64(0x73D17373CCE6A2BF), SPH_C64(0x1248121282245A90), + SPH_C64(0x401D40407A805D3A), SPH_C64(0x0820080848102840), + SPH_C64(0xC32BC3C3959BE856), SPH_C64(0xEC97ECECDFC57B33), + SPH_C64(0xDB4BDBDB4DAB9096), SPH_C64(0xA1BEA1A1C05F1F61), + SPH_C64(0x8D0E8D8D9107831C), SPH_C64(0x3DF43D3DC87AC9F5), + SPH_C64(0x976697975B33F1CC), SPH_C64(0x0000000000000000), + SPH_C64(0xCF1BCFCFF983D436), SPH_C64(0x2BAC2B2B6E568745), + SPH_C64(0x76C57676E1ECB397), SPH_C64(0x82328282E619B064), + SPH_C64(0xD67FD6D628B1A9FE), SPH_C64(0x1B6C1B1BC33677D8), + SPH_C64(0xB5EEB5B574775BC1), SPH_C64(0xAF86AFAFBE432911), + SPH_C64(0x6AB56A6A1DD4DF77), SPH_C64(0x505D5050EAA00DBA), + SPH_C64(0x45094545578A4C12), SPH_C64(0xF3EBF3F338FB18CB), + SPH_C64(0x30C03030AD60F09D), SPH_C64(0xEF9BEFEFC4C3742B), + SPH_C64(0x3FFC3F3FDA7EC3E5), SPH_C64(0x55495555C7AA1C92), + SPH_C64(0xA2B2A2A2DB591079), SPH_C64(0xEA8FEAEAE9C96503), + SPH_C64(0x658965656ACAEC0F), SPH_C64(0xBAD2BABA036968B9), + SPH_C64(0x2FBC2F2F4A5E9365), SPH_C64(0xC027C0C08E9DE74E), + SPH_C64(0xDE5FDEDE60A181BE), SPH_C64(0x1C701C1CFC386CE0), + SPH_C64(0xFDD3FDFD46E72EBB), SPH_C64(0x4D294D4D1F9A6452), + SPH_C64(0x927292927639E0E4), SPH_C64(0x75C97575FAEABC8F), + SPH_C64(0x06180606360C1E30), SPH_C64(0x8A128A8AAE099824), + SPH_C64(0xB2F2B2B24B7940F9), SPH_C64(0xE6BFE6E685D15963), + SPH_C64(0x0E380E0E7E1C3670), SPH_C64(0x1F7C1F1FE73E63F8), + SPH_C64(0x6295626255C4F737), SPH_C64(0xD477D4D43AB5A3EE), + SPH_C64(0xA89AA8A8814D3229), SPH_C64(0x966296965231F4C4), + SPH_C64(0xF9C3F9F962EF3A9B), SPH_C64(0xC533C5C5A397F666), + SPH_C64(0x25942525104AB135), SPH_C64(0x59795959ABB220F2), + SPH_C64(0x842A8484D015AE54), SPH_C64(0x72D57272C5E4A7B7), + SPH_C64(0x39E43939EC72DDD5), SPH_C64(0x4C2D4C4C1698615A), + SPH_C64(0x5E655E5E94BC3BCA), SPH_C64(0x78FD78789FF085E7), + SPH_C64(0x38E03838E570D8DD), SPH_C64(0x8C0A8C8C98058614), + SPH_C64(0xD163D1D117BFB2C6), SPH_C64(0xA5AEA5A5E4570B41), + SPH_C64(0xE2AFE2E2A1D94D43), SPH_C64(0x619961614EC2F82F), + SPH_C64(0xB3F6B3B3427B45F1), SPH_C64(0x218421213442A515), + SPH_C64(0x9C4A9C9C0825D694), SPH_C64(0x1E781E1EEE3C66F0), + SPH_C64(0x4311434361865222), SPH_C64(0xC73BC7C7B193FC76), + SPH_C64(0xFCD7FCFC4FE52BB3), SPH_C64(0x0410040424081420), + SPH_C64(0x51595151E3A208B2), SPH_C64(0x995E9999252FC7BC), + SPH_C64(0x6DA96D6D22DAC44F), SPH_C64(0x0D340D0D651A3968), + SPH_C64(0xFACFFAFA79E93583), SPH_C64(0xDF5BDFDF69A384B6), + SPH_C64(0x7EE57E7EA9FC9BD7), SPH_C64(0x249024241948B43D), + SPH_C64(0x3BEC3B3BFE76D7C5), SPH_C64(0xAB96ABAB9A4B3D31), + SPH_C64(0xCE1FCECEF081D13E), SPH_C64(0x1144111199225588), + SPH_C64(0x8F068F8F8303890C), SPH_C64(0x4E254E4E049C6B4A), + SPH_C64(0xB7E6B7B7667351D1), SPH_C64(0xEB8BEBEBE0CB600B), + SPH_C64(0x3CF03C3CC178CCFD), SPH_C64(0x813E8181FD1FBF7C), + SPH_C64(0x946A94944035FED4), SPH_C64(0xF7FBF7F71CF30CEB), + SPH_C64(0xB9DEB9B9186F67A1), SPH_C64(0x134C13138B265F98), + SPH_C64(0x2CB02C2C51589C7D), SPH_C64(0xD36BD3D305BBB8D6), + SPH_C64(0xE7BBE7E78CD35C6B), SPH_C64(0x6EA56E6E39DCCB57), + SPH_C64(0xC437C4C4AA95F36E), SPH_C64(0x030C03031B060F18), + SPH_C64(0x56455656DCAC138A), SPH_C64(0x440D44445E88491A), + SPH_C64(0x7FE17F7FA0FE9EDF), SPH_C64(0xA99EA9A9884F3721), + SPH_C64(0x2AA82A2A6754824D), SPH_C64(0xBBD6BBBB0A6B6DB1), + SPH_C64(0xC123C1C1879FE246), SPH_C64(0x53515353F1A602A2), + SPH_C64(0xDC57DCDC72A58BAE), SPH_C64(0x0B2C0B0B53162758), + SPH_C64(0x9D4E9D9D0127D39C), SPH_C64(0x6CAD6C6C2BD8C147), + SPH_C64(0x31C43131A462F595), SPH_C64(0x74CD7474F3E8B987), + SPH_C64(0xF6FFF6F615F109E3), SPH_C64(0x460546464C8C430A), + SPH_C64(0xAC8AACACA5452609), SPH_C64(0x891E8989B50F973C), + SPH_C64(0x14501414B42844A0), SPH_C64(0xE1A3E1E1BADF425B), + SPH_C64(0x16581616A62C4EB0), SPH_C64(0x3AE83A3AF774D2CD), + SPH_C64(0x69B9696906D2D06F), SPH_C64(0x0924090941122D48), + SPH_C64(0x70DD7070D7E0ADA7), SPH_C64(0xB6E2B6B66F7154D9), + SPH_C64(0xD067D0D01EBDB7CE), SPH_C64(0xED93EDEDD6C77E3B), + SPH_C64(0xCC17CCCCE285DB2E), SPH_C64(0x421542426884572A), + SPH_C64(0x985A98982C2DC2B4), SPH_C64(0xA4AAA4A4ED550E49), + SPH_C64(0x28A028287550885D), SPH_C64(0x5C6D5C5C86B831DA), + SPH_C64(0xF8C7F8F86BED3F93), SPH_C64(0x86228686C211A444) +}; + +static const sph_u64 plain_T5[256] = { + SPH_C64(0x601818D83078C018), SPH_C64(0x8C23232646AF0523), + SPH_C64(0x3FC6C6B891F97EC6), SPH_C64(0x87E8E8FBCD6F13E8), + SPH_C64(0x268787CB13A14C87), SPH_C64(0xDAB8B8116D62A9B8), + SPH_C64(0x0401010902050801), SPH_C64(0x214F4F0D9E6E424F), + SPH_C64(0xD836369B6CEEAD36), SPH_C64(0xA2A6A6FF510459A6), + SPH_C64(0x6FD2D20CB9BDDED2), SPH_C64(0xF3F5F50EF706FBF5), + SPH_C64(0xF9797996F280EF79), SPH_C64(0xA16F6F30DECE5F6F), + SPH_C64(0x7E91916D3FEFFC91), SPH_C64(0x555252F8A407AA52), + SPH_C64(0x9D606047C0FD2760), SPH_C64(0xCABCBC35657689BC), + SPH_C64(0x569B9B372BCDAC9B), SPH_C64(0x028E8E8A018C048E), + SPH_C64(0xB6A3A3D25B1571A3), SPH_C64(0x300C0C6C183C600C), + SPH_C64(0xF17B7B84F68AFF7B), SPH_C64(0xD43535806AE1B535), + SPH_C64(0x741D1DF53A69E81D), SPH_C64(0xA7E0E0B3DD4753E0), + SPH_C64(0x7BD7D721B3ACF6D7), SPH_C64(0x2FC2C29C99ED5EC2), + SPH_C64(0xB82E2E435C966D2E), SPH_C64(0x314B4B29967A624B), + SPH_C64(0xDFFEFE5DE121A3FE), SPH_C64(0x415757D5AE168257), + SPH_C64(0x541515BD2A41A815), SPH_C64(0xC17777E8EEB69F77), + SPH_C64(0xDC3737926EEBA537), SPH_C64(0xB3E5E59ED7567BE5), + SPH_C64(0x469F9F1323D98C9F), SPH_C64(0xE7F0F023FD17D3F0), + SPH_C64(0x354A4A20947F6A4A), SPH_C64(0x4FDADA44A9959EDA), + SPH_C64(0x7D5858A2B025FA58), SPH_C64(0x03C9C9CF8FCA06C9), + SPH_C64(0xA429297C528D5529), SPH_C64(0x280A0A5A1422500A), + SPH_C64(0xFEB1B1507F4FE1B1), SPH_C64(0xBAA0A0C95D1A69A0), + SPH_C64(0xB16B6B14D6DA7F6B), SPH_C64(0x2E8585D917AB5C85), + SPH_C64(0xCEBDBD3C677381BD), SPH_C64(0x695D5D8FBA34D25D), + SPH_C64(0x4010109020508010), SPH_C64(0xF7F4F407F503F3F4), + SPH_C64(0x0BCBCBDD8BC016CB), SPH_C64(0xF83E3ED37CC6ED3E), + SPH_C64(0x1405052D0A112805), SPH_C64(0x81676778CEE61F67), + SPH_C64(0xB7E4E497D55373E4), SPH_C64(0x9C2727024EBB2527), + SPH_C64(0x1941417382583241), SPH_C64(0x168B8BA70B9D2C8B), + SPH_C64(0xA6A7A7F6530151A7), SPH_C64(0xE97D7DB2FA94CF7D), + SPH_C64(0x6E95954937FBDC95), SPH_C64(0x47D8D856AD9F8ED8), + SPH_C64(0xCBFBFB70EB308BFB), SPH_C64(0x9FEEEECDC17123EE), + SPH_C64(0xED7C7CBBF891C77C), SPH_C64(0x85666671CCE31766), + SPH_C64(0x53DDDD7BA78EA6DD), SPH_C64(0x5C1717AF2E4BB817), + SPH_C64(0x014747458E460247), SPH_C64(0x429E9E1A21DC849E), + SPH_C64(0x0FCACAD489C51ECA), SPH_C64(0xB42D2D585A99752D), + SPH_C64(0xC6BFBF2E637991BF), SPH_C64(0x1C07073F0E1B3807), + SPH_C64(0x8EADADAC472301AD), SPH_C64(0x755A5AB0B42FEA5A), + SPH_C64(0x368383EF1BB56C83), SPH_C64(0xCC3333B666FF8533), + SPH_C64(0x9163635CC6F23F63), SPH_C64(0x08020212040A1002), + SPH_C64(0x92AAAA93493839AA), SPH_C64(0xD97171DEE2A8AF71), + SPH_C64(0x07C8C8C68DCF0EC8), SPH_C64(0x641919D1327DC819), + SPH_C64(0x3949493B92707249), SPH_C64(0x43D9D95FAF9A86D9), + SPH_C64(0xEFF2F231F91DC3F2), SPH_C64(0xABE3E3A8DB484BE3), + SPH_C64(0x715B5BB9B62AE25B), SPH_C64(0x1A8888BC0D923488), + SPH_C64(0x529A9A3E29C8A49A), SPH_C64(0x9826260B4CBE2D26), + SPH_C64(0xC83232BF64FA8D32), SPH_C64(0xFAB0B0597D4AE9B0), + SPH_C64(0x83E9E9F2CF6A1BE9), SPH_C64(0x3C0F0F771E33780F), + SPH_C64(0x73D5D533B7A6E6D5), SPH_C64(0x3A8080F41DBA7480), + SPH_C64(0xC2BEBE27617C99BE), SPH_C64(0x13CDCDEB87DE26CD), + SPH_C64(0xD034348968E4BD34), SPH_C64(0x3D48483290757A48), + SPH_C64(0xDBFFFF54E324ABFF), SPH_C64(0xF57A7A8DF48FF77A), + SPH_C64(0x7A9090643DEAF490), SPH_C64(0x615F5F9DBE3EC25F), + SPH_C64(0x8020203D40A01D20), SPH_C64(0xBD68680FD0D56768), + SPH_C64(0x681A1ACA3472D01A), SPH_C64(0x82AEAEB7412C19AE), + SPH_C64(0xEAB4B47D755EC9B4), SPH_C64(0x4D5454CEA8199A54), + SPH_C64(0x7693937F3BE5EC93), SPH_C64(0x8822222F44AA0D22), + SPH_C64(0x8D646463C8E90764), SPH_C64(0xE3F1F12AFF12DBF1), + SPH_C64(0xD17373CCE6A2BF73), SPH_C64(0x48121282245A9012), + SPH_C64(0x1D40407A805D3A40), SPH_C64(0x2008084810284008), + SPH_C64(0x2BC3C3959BE856C3), SPH_C64(0x97ECECDFC57B33EC), + SPH_C64(0x4BDBDB4DAB9096DB), SPH_C64(0xBEA1A1C05F1F61A1), + SPH_C64(0x0E8D8D9107831C8D), SPH_C64(0xF43D3DC87AC9F53D), + SPH_C64(0x6697975B33F1CC97), SPH_C64(0x0000000000000000), + SPH_C64(0x1BCFCFF983D436CF), SPH_C64(0xAC2B2B6E5687452B), + SPH_C64(0xC57676E1ECB39776), SPH_C64(0x328282E619B06482), + SPH_C64(0x7FD6D628B1A9FED6), SPH_C64(0x6C1B1BC33677D81B), + SPH_C64(0xEEB5B574775BC1B5), SPH_C64(0x86AFAFBE432911AF), + SPH_C64(0xB56A6A1DD4DF776A), SPH_C64(0x5D5050EAA00DBA50), + SPH_C64(0x094545578A4C1245), SPH_C64(0xEBF3F338FB18CBF3), + SPH_C64(0xC03030AD60F09D30), SPH_C64(0x9BEFEFC4C3742BEF), + SPH_C64(0xFC3F3FDA7EC3E53F), SPH_C64(0x495555C7AA1C9255), + SPH_C64(0xB2A2A2DB591079A2), SPH_C64(0x8FEAEAE9C96503EA), + SPH_C64(0x8965656ACAEC0F65), SPH_C64(0xD2BABA036968B9BA), + SPH_C64(0xBC2F2F4A5E93652F), SPH_C64(0x27C0C08E9DE74EC0), + SPH_C64(0x5FDEDE60A181BEDE), SPH_C64(0x701C1CFC386CE01C), + SPH_C64(0xD3FDFD46E72EBBFD), SPH_C64(0x294D4D1F9A64524D), + SPH_C64(0x7292927639E0E492), SPH_C64(0xC97575FAEABC8F75), + SPH_C64(0x180606360C1E3006), SPH_C64(0x128A8AAE0998248A), + SPH_C64(0xF2B2B24B7940F9B2), SPH_C64(0xBFE6E685D15963E6), + SPH_C64(0x380E0E7E1C36700E), SPH_C64(0x7C1F1FE73E63F81F), + SPH_C64(0x95626255C4F73762), SPH_C64(0x77D4D43AB5A3EED4), + SPH_C64(0x9AA8A8814D3229A8), SPH_C64(0x6296965231F4C496), + SPH_C64(0xC3F9F962EF3A9BF9), SPH_C64(0x33C5C5A397F666C5), + SPH_C64(0x942525104AB13525), SPH_C64(0x795959ABB220F259), + SPH_C64(0x2A8484D015AE5484), SPH_C64(0xD57272C5E4A7B772), + SPH_C64(0xE43939EC72DDD539), SPH_C64(0x2D4C4C1698615A4C), + SPH_C64(0x655E5E94BC3BCA5E), SPH_C64(0xFD78789FF085E778), + SPH_C64(0xE03838E570D8DD38), SPH_C64(0x0A8C8C980586148C), + SPH_C64(0x63D1D117BFB2C6D1), SPH_C64(0xAEA5A5E4570B41A5), + SPH_C64(0xAFE2E2A1D94D43E2), SPH_C64(0x9961614EC2F82F61), + SPH_C64(0xF6B3B3427B45F1B3), SPH_C64(0x8421213442A51521), + SPH_C64(0x4A9C9C0825D6949C), SPH_C64(0x781E1EEE3C66F01E), + SPH_C64(0x1143436186522243), SPH_C64(0x3BC7C7B193FC76C7), + SPH_C64(0xD7FCFC4FE52BB3FC), SPH_C64(0x1004042408142004), + SPH_C64(0x595151E3A208B251), SPH_C64(0x5E9999252FC7BC99), + SPH_C64(0xA96D6D22DAC44F6D), SPH_C64(0x340D0D651A39680D), + SPH_C64(0xCFFAFA79E93583FA), SPH_C64(0x5BDFDF69A384B6DF), + SPH_C64(0xE57E7EA9FC9BD77E), SPH_C64(0x9024241948B43D24), + SPH_C64(0xEC3B3BFE76D7C53B), SPH_C64(0x96ABAB9A4B3D31AB), + SPH_C64(0x1FCECEF081D13ECE), SPH_C64(0x4411119922558811), + SPH_C64(0x068F8F8303890C8F), SPH_C64(0x254E4E049C6B4A4E), + SPH_C64(0xE6B7B7667351D1B7), SPH_C64(0x8BEBEBE0CB600BEB), + SPH_C64(0xF03C3CC178CCFD3C), SPH_C64(0x3E8181FD1FBF7C81), + SPH_C64(0x6A94944035FED494), SPH_C64(0xFBF7F71CF30CEBF7), + SPH_C64(0xDEB9B9186F67A1B9), SPH_C64(0x4C13138B265F9813), + SPH_C64(0xB02C2C51589C7D2C), SPH_C64(0x6BD3D305BBB8D6D3), + SPH_C64(0xBBE7E78CD35C6BE7), SPH_C64(0xA56E6E39DCCB576E), + SPH_C64(0x37C4C4AA95F36EC4), SPH_C64(0x0C03031B060F1803), + SPH_C64(0x455656DCAC138A56), SPH_C64(0x0D44445E88491A44), + SPH_C64(0xE17F7FA0FE9EDF7F), SPH_C64(0x9EA9A9884F3721A9), + SPH_C64(0xA82A2A6754824D2A), SPH_C64(0xD6BBBB0A6B6DB1BB), + SPH_C64(0x23C1C1879FE246C1), SPH_C64(0x515353F1A602A253), + SPH_C64(0x57DCDC72A58BAEDC), SPH_C64(0x2C0B0B531627580B), + SPH_C64(0x4E9D9D0127D39C9D), SPH_C64(0xAD6C6C2BD8C1476C), + SPH_C64(0xC43131A462F59531), SPH_C64(0xCD7474F3E8B98774), + SPH_C64(0xFFF6F615F109E3F6), SPH_C64(0x0546464C8C430A46), + SPH_C64(0x8AACACA5452609AC), SPH_C64(0x1E8989B50F973C89), + SPH_C64(0x501414B42844A014), SPH_C64(0xA3E1E1BADF425BE1), + SPH_C64(0x581616A62C4EB016), SPH_C64(0xE83A3AF774D2CD3A), + SPH_C64(0xB9696906D2D06F69), SPH_C64(0x24090941122D4809), + SPH_C64(0xDD7070D7E0ADA770), SPH_C64(0xE2B6B66F7154D9B6), + SPH_C64(0x67D0D01EBDB7CED0), SPH_C64(0x93EDEDD6C77E3BED), + SPH_C64(0x17CCCCE285DB2ECC), SPH_C64(0x1542426884572A42), + SPH_C64(0x5A98982C2DC2B498), SPH_C64(0xAAA4A4ED550E49A4), + SPH_C64(0xA028287550885D28), SPH_C64(0x6D5C5C86B831DA5C), + SPH_C64(0xC7F8F86BED3F93F8), SPH_C64(0x228686C211A44486) +}; + +static const sph_u64 plain_T6[256] = { + SPH_C64(0x1818D83078C01860), SPH_C64(0x23232646AF05238C), + SPH_C64(0xC6C6B891F97EC63F), SPH_C64(0xE8E8FBCD6F13E887), + SPH_C64(0x8787CB13A14C8726), SPH_C64(0xB8B8116D62A9B8DA), + SPH_C64(0x0101090205080104), SPH_C64(0x4F4F0D9E6E424F21), + SPH_C64(0x36369B6CEEAD36D8), SPH_C64(0xA6A6FF510459A6A2), + SPH_C64(0xD2D20CB9BDDED26F), SPH_C64(0xF5F50EF706FBF5F3), + SPH_C64(0x797996F280EF79F9), SPH_C64(0x6F6F30DECE5F6FA1), + SPH_C64(0x91916D3FEFFC917E), SPH_C64(0x5252F8A407AA5255), + SPH_C64(0x606047C0FD27609D), SPH_C64(0xBCBC35657689BCCA), + SPH_C64(0x9B9B372BCDAC9B56), SPH_C64(0x8E8E8A018C048E02), + SPH_C64(0xA3A3D25B1571A3B6), SPH_C64(0x0C0C6C183C600C30), + SPH_C64(0x7B7B84F68AFF7BF1), SPH_C64(0x3535806AE1B535D4), + SPH_C64(0x1D1DF53A69E81D74), SPH_C64(0xE0E0B3DD4753E0A7), + SPH_C64(0xD7D721B3ACF6D77B), SPH_C64(0xC2C29C99ED5EC22F), + SPH_C64(0x2E2E435C966D2EB8), SPH_C64(0x4B4B29967A624B31), + SPH_C64(0xFEFE5DE121A3FEDF), SPH_C64(0x5757D5AE16825741), + SPH_C64(0x1515BD2A41A81554), SPH_C64(0x7777E8EEB69F77C1), + SPH_C64(0x3737926EEBA537DC), SPH_C64(0xE5E59ED7567BE5B3), + SPH_C64(0x9F9F1323D98C9F46), SPH_C64(0xF0F023FD17D3F0E7), + SPH_C64(0x4A4A20947F6A4A35), SPH_C64(0xDADA44A9959EDA4F), + SPH_C64(0x5858A2B025FA587D), SPH_C64(0xC9C9CF8FCA06C903), + SPH_C64(0x29297C528D5529A4), SPH_C64(0x0A0A5A1422500A28), + SPH_C64(0xB1B1507F4FE1B1FE), SPH_C64(0xA0A0C95D1A69A0BA), + SPH_C64(0x6B6B14D6DA7F6BB1), SPH_C64(0x8585D917AB5C852E), + SPH_C64(0xBDBD3C677381BDCE), SPH_C64(0x5D5D8FBA34D25D69), + SPH_C64(0x1010902050801040), SPH_C64(0xF4F407F503F3F4F7), + SPH_C64(0xCBCBDD8BC016CB0B), SPH_C64(0x3E3ED37CC6ED3EF8), + SPH_C64(0x05052D0A11280514), SPH_C64(0x676778CEE61F6781), + SPH_C64(0xE4E497D55373E4B7), SPH_C64(0x2727024EBB25279C), + SPH_C64(0x4141738258324119), SPH_C64(0x8B8BA70B9D2C8B16), + SPH_C64(0xA7A7F6530151A7A6), SPH_C64(0x7D7DB2FA94CF7DE9), + SPH_C64(0x95954937FBDC956E), SPH_C64(0xD8D856AD9F8ED847), + SPH_C64(0xFBFB70EB308BFBCB), SPH_C64(0xEEEECDC17123EE9F), + SPH_C64(0x7C7CBBF891C77CED), SPH_C64(0x666671CCE3176685), + SPH_C64(0xDDDD7BA78EA6DD53), SPH_C64(0x1717AF2E4BB8175C), + SPH_C64(0x4747458E46024701), SPH_C64(0x9E9E1A21DC849E42), + SPH_C64(0xCACAD489C51ECA0F), SPH_C64(0x2D2D585A99752DB4), + SPH_C64(0xBFBF2E637991BFC6), SPH_C64(0x07073F0E1B38071C), + SPH_C64(0xADADAC472301AD8E), SPH_C64(0x5A5AB0B42FEA5A75), + SPH_C64(0x8383EF1BB56C8336), SPH_C64(0x3333B666FF8533CC), + SPH_C64(0x63635CC6F23F6391), SPH_C64(0x020212040A100208), + SPH_C64(0xAAAA93493839AA92), SPH_C64(0x7171DEE2A8AF71D9), + SPH_C64(0xC8C8C68DCF0EC807), SPH_C64(0x1919D1327DC81964), + SPH_C64(0x49493B9270724939), SPH_C64(0xD9D95FAF9A86D943), + SPH_C64(0xF2F231F91DC3F2EF), SPH_C64(0xE3E3A8DB484BE3AB), + SPH_C64(0x5B5BB9B62AE25B71), SPH_C64(0x8888BC0D9234881A), + SPH_C64(0x9A9A3E29C8A49A52), SPH_C64(0x26260B4CBE2D2698), + SPH_C64(0x3232BF64FA8D32C8), SPH_C64(0xB0B0597D4AE9B0FA), + SPH_C64(0xE9E9F2CF6A1BE983), SPH_C64(0x0F0F771E33780F3C), + SPH_C64(0xD5D533B7A6E6D573), SPH_C64(0x8080F41DBA74803A), + SPH_C64(0xBEBE27617C99BEC2), SPH_C64(0xCDCDEB87DE26CD13), + SPH_C64(0x34348968E4BD34D0), SPH_C64(0x48483290757A483D), + SPH_C64(0xFFFF54E324ABFFDB), SPH_C64(0x7A7A8DF48FF77AF5), + SPH_C64(0x9090643DEAF4907A), SPH_C64(0x5F5F9DBE3EC25F61), + SPH_C64(0x20203D40A01D2080), SPH_C64(0x68680FD0D56768BD), + SPH_C64(0x1A1ACA3472D01A68), SPH_C64(0xAEAEB7412C19AE82), + SPH_C64(0xB4B47D755EC9B4EA), SPH_C64(0x5454CEA8199A544D), + SPH_C64(0x93937F3BE5EC9376), SPH_C64(0x22222F44AA0D2288), + SPH_C64(0x646463C8E907648D), SPH_C64(0xF1F12AFF12DBF1E3), + SPH_C64(0x7373CCE6A2BF73D1), SPH_C64(0x121282245A901248), + SPH_C64(0x40407A805D3A401D), SPH_C64(0x0808481028400820), + SPH_C64(0xC3C3959BE856C32B), SPH_C64(0xECECDFC57B33EC97), + SPH_C64(0xDBDB4DAB9096DB4B), SPH_C64(0xA1A1C05F1F61A1BE), + SPH_C64(0x8D8D9107831C8D0E), SPH_C64(0x3D3DC87AC9F53DF4), + SPH_C64(0x97975B33F1CC9766), SPH_C64(0x0000000000000000), + SPH_C64(0xCFCFF983D436CF1B), SPH_C64(0x2B2B6E5687452BAC), + SPH_C64(0x7676E1ECB39776C5), SPH_C64(0x8282E619B0648232), + SPH_C64(0xD6D628B1A9FED67F), SPH_C64(0x1B1BC33677D81B6C), + SPH_C64(0xB5B574775BC1B5EE), SPH_C64(0xAFAFBE432911AF86), + SPH_C64(0x6A6A1DD4DF776AB5), SPH_C64(0x5050EAA00DBA505D), + SPH_C64(0x4545578A4C124509), SPH_C64(0xF3F338FB18CBF3EB), + SPH_C64(0x3030AD60F09D30C0), SPH_C64(0xEFEFC4C3742BEF9B), + SPH_C64(0x3F3FDA7EC3E53FFC), SPH_C64(0x5555C7AA1C925549), + SPH_C64(0xA2A2DB591079A2B2), SPH_C64(0xEAEAE9C96503EA8F), + SPH_C64(0x65656ACAEC0F6589), SPH_C64(0xBABA036968B9BAD2), + SPH_C64(0x2F2F4A5E93652FBC), SPH_C64(0xC0C08E9DE74EC027), + SPH_C64(0xDEDE60A181BEDE5F), SPH_C64(0x1C1CFC386CE01C70), + SPH_C64(0xFDFD46E72EBBFDD3), SPH_C64(0x4D4D1F9A64524D29), + SPH_C64(0x92927639E0E49272), SPH_C64(0x7575FAEABC8F75C9), + SPH_C64(0x0606360C1E300618), SPH_C64(0x8A8AAE0998248A12), + SPH_C64(0xB2B24B7940F9B2F2), SPH_C64(0xE6E685D15963E6BF), + SPH_C64(0x0E0E7E1C36700E38), SPH_C64(0x1F1FE73E63F81F7C), + SPH_C64(0x626255C4F7376295), SPH_C64(0xD4D43AB5A3EED477), + SPH_C64(0xA8A8814D3229A89A), SPH_C64(0x96965231F4C49662), + SPH_C64(0xF9F962EF3A9BF9C3), SPH_C64(0xC5C5A397F666C533), + SPH_C64(0x2525104AB1352594), SPH_C64(0x5959ABB220F25979), + SPH_C64(0x8484D015AE54842A), SPH_C64(0x7272C5E4A7B772D5), + SPH_C64(0x3939EC72DDD539E4), SPH_C64(0x4C4C1698615A4C2D), + SPH_C64(0x5E5E94BC3BCA5E65), SPH_C64(0x78789FF085E778FD), + SPH_C64(0x3838E570D8DD38E0), SPH_C64(0x8C8C980586148C0A), + SPH_C64(0xD1D117BFB2C6D163), SPH_C64(0xA5A5E4570B41A5AE), + SPH_C64(0xE2E2A1D94D43E2AF), SPH_C64(0x61614EC2F82F6199), + SPH_C64(0xB3B3427B45F1B3F6), SPH_C64(0x21213442A5152184), + SPH_C64(0x9C9C0825D6949C4A), SPH_C64(0x1E1EEE3C66F01E78), + SPH_C64(0x4343618652224311), SPH_C64(0xC7C7B193FC76C73B), + SPH_C64(0xFCFC4FE52BB3FCD7), SPH_C64(0x0404240814200410), + SPH_C64(0x5151E3A208B25159), SPH_C64(0x9999252FC7BC995E), + SPH_C64(0x6D6D22DAC44F6DA9), SPH_C64(0x0D0D651A39680D34), + SPH_C64(0xFAFA79E93583FACF), SPH_C64(0xDFDF69A384B6DF5B), + SPH_C64(0x7E7EA9FC9BD77EE5), SPH_C64(0x24241948B43D2490), + SPH_C64(0x3B3BFE76D7C53BEC), SPH_C64(0xABAB9A4B3D31AB96), + SPH_C64(0xCECEF081D13ECE1F), SPH_C64(0x1111992255881144), + SPH_C64(0x8F8F8303890C8F06), SPH_C64(0x4E4E049C6B4A4E25), + SPH_C64(0xB7B7667351D1B7E6), SPH_C64(0xEBEBE0CB600BEB8B), + SPH_C64(0x3C3CC178CCFD3CF0), SPH_C64(0x8181FD1FBF7C813E), + SPH_C64(0x94944035FED4946A), SPH_C64(0xF7F71CF30CEBF7FB), + SPH_C64(0xB9B9186F67A1B9DE), SPH_C64(0x13138B265F98134C), + SPH_C64(0x2C2C51589C7D2CB0), SPH_C64(0xD3D305BBB8D6D36B), + SPH_C64(0xE7E78CD35C6BE7BB), SPH_C64(0x6E6E39DCCB576EA5), + SPH_C64(0xC4C4AA95F36EC437), SPH_C64(0x03031B060F18030C), + SPH_C64(0x5656DCAC138A5645), SPH_C64(0x44445E88491A440D), + SPH_C64(0x7F7FA0FE9EDF7FE1), SPH_C64(0xA9A9884F3721A99E), + SPH_C64(0x2A2A6754824D2AA8), SPH_C64(0xBBBB0A6B6DB1BBD6), + SPH_C64(0xC1C1879FE246C123), SPH_C64(0x5353F1A602A25351), + SPH_C64(0xDCDC72A58BAEDC57), SPH_C64(0x0B0B531627580B2C), + SPH_C64(0x9D9D0127D39C9D4E), SPH_C64(0x6C6C2BD8C1476CAD), + SPH_C64(0x3131A462F59531C4), SPH_C64(0x7474F3E8B98774CD), + SPH_C64(0xF6F615F109E3F6FF), SPH_C64(0x46464C8C430A4605), + SPH_C64(0xACACA5452609AC8A), SPH_C64(0x8989B50F973C891E), + SPH_C64(0x1414B42844A01450), SPH_C64(0xE1E1BADF425BE1A3), + SPH_C64(0x1616A62C4EB01658), SPH_C64(0x3A3AF774D2CD3AE8), + SPH_C64(0x696906D2D06F69B9), SPH_C64(0x090941122D480924), + SPH_C64(0x7070D7E0ADA770DD), SPH_C64(0xB6B66F7154D9B6E2), + SPH_C64(0xD0D01EBDB7CED067), SPH_C64(0xEDEDD6C77E3BED93), + SPH_C64(0xCCCCE285DB2ECC17), SPH_C64(0x42426884572A4215), + SPH_C64(0x98982C2DC2B4985A), SPH_C64(0xA4A4ED550E49A4AA), + SPH_C64(0x28287550885D28A0), SPH_C64(0x5C5C86B831DA5C6D), + SPH_C64(0xF8F86BED3F93F8C7), SPH_C64(0x8686C211A4448622) +}; + +static const sph_u64 plain_T7[256] = { + SPH_C64(0x18D83078C0186018), SPH_C64(0x232646AF05238C23), + SPH_C64(0xC6B891F97EC63FC6), SPH_C64(0xE8FBCD6F13E887E8), + SPH_C64(0x87CB13A14C872687), SPH_C64(0xB8116D62A9B8DAB8), + SPH_C64(0x0109020508010401), SPH_C64(0x4F0D9E6E424F214F), + SPH_C64(0x369B6CEEAD36D836), SPH_C64(0xA6FF510459A6A2A6), + SPH_C64(0xD20CB9BDDED26FD2), SPH_C64(0xF50EF706FBF5F3F5), + SPH_C64(0x7996F280EF79F979), SPH_C64(0x6F30DECE5F6FA16F), + SPH_C64(0x916D3FEFFC917E91), SPH_C64(0x52F8A407AA525552), + SPH_C64(0x6047C0FD27609D60), SPH_C64(0xBC35657689BCCABC), + SPH_C64(0x9B372BCDAC9B569B), SPH_C64(0x8E8A018C048E028E), + SPH_C64(0xA3D25B1571A3B6A3), SPH_C64(0x0C6C183C600C300C), + SPH_C64(0x7B84F68AFF7BF17B), SPH_C64(0x35806AE1B535D435), + SPH_C64(0x1DF53A69E81D741D), SPH_C64(0xE0B3DD4753E0A7E0), + SPH_C64(0xD721B3ACF6D77BD7), SPH_C64(0xC29C99ED5EC22FC2), + SPH_C64(0x2E435C966D2EB82E), SPH_C64(0x4B29967A624B314B), + SPH_C64(0xFE5DE121A3FEDFFE), SPH_C64(0x57D5AE1682574157), + SPH_C64(0x15BD2A41A8155415), SPH_C64(0x77E8EEB69F77C177), + SPH_C64(0x37926EEBA537DC37), SPH_C64(0xE59ED7567BE5B3E5), + SPH_C64(0x9F1323D98C9F469F), SPH_C64(0xF023FD17D3F0E7F0), + SPH_C64(0x4A20947F6A4A354A), SPH_C64(0xDA44A9959EDA4FDA), + SPH_C64(0x58A2B025FA587D58), SPH_C64(0xC9CF8FCA06C903C9), + SPH_C64(0x297C528D5529A429), SPH_C64(0x0A5A1422500A280A), + SPH_C64(0xB1507F4FE1B1FEB1), SPH_C64(0xA0C95D1A69A0BAA0), + SPH_C64(0x6B14D6DA7F6BB16B), SPH_C64(0x85D917AB5C852E85), + SPH_C64(0xBD3C677381BDCEBD), SPH_C64(0x5D8FBA34D25D695D), + SPH_C64(0x1090205080104010), SPH_C64(0xF407F503F3F4F7F4), + SPH_C64(0xCBDD8BC016CB0BCB), SPH_C64(0x3ED37CC6ED3EF83E), + SPH_C64(0x052D0A1128051405), SPH_C64(0x6778CEE61F678167), + SPH_C64(0xE497D55373E4B7E4), SPH_C64(0x27024EBB25279C27), + SPH_C64(0x4173825832411941), SPH_C64(0x8BA70B9D2C8B168B), + SPH_C64(0xA7F6530151A7A6A7), SPH_C64(0x7DB2FA94CF7DE97D), + SPH_C64(0x954937FBDC956E95), SPH_C64(0xD856AD9F8ED847D8), + SPH_C64(0xFB70EB308BFBCBFB), SPH_C64(0xEECDC17123EE9FEE), + SPH_C64(0x7CBBF891C77CED7C), SPH_C64(0x6671CCE317668566), + SPH_C64(0xDD7BA78EA6DD53DD), SPH_C64(0x17AF2E4BB8175C17), + SPH_C64(0x47458E4602470147), SPH_C64(0x9E1A21DC849E429E), + SPH_C64(0xCAD489C51ECA0FCA), SPH_C64(0x2D585A99752DB42D), + SPH_C64(0xBF2E637991BFC6BF), SPH_C64(0x073F0E1B38071C07), + SPH_C64(0xADAC472301AD8EAD), SPH_C64(0x5AB0B42FEA5A755A), + SPH_C64(0x83EF1BB56C833683), SPH_C64(0x33B666FF8533CC33), + SPH_C64(0x635CC6F23F639163), SPH_C64(0x0212040A10020802), + SPH_C64(0xAA93493839AA92AA), SPH_C64(0x71DEE2A8AF71D971), + SPH_C64(0xC8C68DCF0EC807C8), SPH_C64(0x19D1327DC8196419), + SPH_C64(0x493B927072493949), SPH_C64(0xD95FAF9A86D943D9), + SPH_C64(0xF231F91DC3F2EFF2), SPH_C64(0xE3A8DB484BE3ABE3), + SPH_C64(0x5BB9B62AE25B715B), SPH_C64(0x88BC0D9234881A88), + SPH_C64(0x9A3E29C8A49A529A), SPH_C64(0x260B4CBE2D269826), + SPH_C64(0x32BF64FA8D32C832), SPH_C64(0xB0597D4AE9B0FAB0), + SPH_C64(0xE9F2CF6A1BE983E9), SPH_C64(0x0F771E33780F3C0F), + SPH_C64(0xD533B7A6E6D573D5), SPH_C64(0x80F41DBA74803A80), + SPH_C64(0xBE27617C99BEC2BE), SPH_C64(0xCDEB87DE26CD13CD), + SPH_C64(0x348968E4BD34D034), SPH_C64(0x483290757A483D48), + SPH_C64(0xFF54E324ABFFDBFF), SPH_C64(0x7A8DF48FF77AF57A), + SPH_C64(0x90643DEAF4907A90), SPH_C64(0x5F9DBE3EC25F615F), + SPH_C64(0x203D40A01D208020), SPH_C64(0x680FD0D56768BD68), + SPH_C64(0x1ACA3472D01A681A), SPH_C64(0xAEB7412C19AE82AE), + SPH_C64(0xB47D755EC9B4EAB4), SPH_C64(0x54CEA8199A544D54), + SPH_C64(0x937F3BE5EC937693), SPH_C64(0x222F44AA0D228822), + SPH_C64(0x6463C8E907648D64), SPH_C64(0xF12AFF12DBF1E3F1), + SPH_C64(0x73CCE6A2BF73D173), SPH_C64(0x1282245A90124812), + SPH_C64(0x407A805D3A401D40), SPH_C64(0x0848102840082008), + SPH_C64(0xC3959BE856C32BC3), SPH_C64(0xECDFC57B33EC97EC), + SPH_C64(0xDB4DAB9096DB4BDB), SPH_C64(0xA1C05F1F61A1BEA1), + SPH_C64(0x8D9107831C8D0E8D), SPH_C64(0x3DC87AC9F53DF43D), + SPH_C64(0x975B33F1CC976697), SPH_C64(0x0000000000000000), + SPH_C64(0xCFF983D436CF1BCF), SPH_C64(0x2B6E5687452BAC2B), + SPH_C64(0x76E1ECB39776C576), SPH_C64(0x82E619B064823282), + SPH_C64(0xD628B1A9FED67FD6), SPH_C64(0x1BC33677D81B6C1B), + SPH_C64(0xB574775BC1B5EEB5), SPH_C64(0xAFBE432911AF86AF), + SPH_C64(0x6A1DD4DF776AB56A), SPH_C64(0x50EAA00DBA505D50), + SPH_C64(0x45578A4C12450945), SPH_C64(0xF338FB18CBF3EBF3), + SPH_C64(0x30AD60F09D30C030), SPH_C64(0xEFC4C3742BEF9BEF), + SPH_C64(0x3FDA7EC3E53FFC3F), SPH_C64(0x55C7AA1C92554955), + SPH_C64(0xA2DB591079A2B2A2), SPH_C64(0xEAE9C96503EA8FEA), + SPH_C64(0x656ACAEC0F658965), SPH_C64(0xBA036968B9BAD2BA), + SPH_C64(0x2F4A5E93652FBC2F), SPH_C64(0xC08E9DE74EC027C0), + SPH_C64(0xDE60A181BEDE5FDE), SPH_C64(0x1CFC386CE01C701C), + SPH_C64(0xFD46E72EBBFDD3FD), SPH_C64(0x4D1F9A64524D294D), + SPH_C64(0x927639E0E4927292), SPH_C64(0x75FAEABC8F75C975), + SPH_C64(0x06360C1E30061806), SPH_C64(0x8AAE0998248A128A), + SPH_C64(0xB24B7940F9B2F2B2), SPH_C64(0xE685D15963E6BFE6), + SPH_C64(0x0E7E1C36700E380E), SPH_C64(0x1FE73E63F81F7C1F), + SPH_C64(0x6255C4F737629562), SPH_C64(0xD43AB5A3EED477D4), + SPH_C64(0xA8814D3229A89AA8), SPH_C64(0x965231F4C4966296), + SPH_C64(0xF962EF3A9BF9C3F9), SPH_C64(0xC5A397F666C533C5), + SPH_C64(0x25104AB135259425), SPH_C64(0x59ABB220F2597959), + SPH_C64(0x84D015AE54842A84), SPH_C64(0x72C5E4A7B772D572), + SPH_C64(0x39EC72DDD539E439), SPH_C64(0x4C1698615A4C2D4C), + SPH_C64(0x5E94BC3BCA5E655E), SPH_C64(0x789FF085E778FD78), + SPH_C64(0x38E570D8DD38E038), SPH_C64(0x8C980586148C0A8C), + SPH_C64(0xD117BFB2C6D163D1), SPH_C64(0xA5E4570B41A5AEA5), + SPH_C64(0xE2A1D94D43E2AFE2), SPH_C64(0x614EC2F82F619961), + SPH_C64(0xB3427B45F1B3F6B3), SPH_C64(0x213442A515218421), + SPH_C64(0x9C0825D6949C4A9C), SPH_C64(0x1EEE3C66F01E781E), + SPH_C64(0x4361865222431143), SPH_C64(0xC7B193FC76C73BC7), + SPH_C64(0xFC4FE52BB3FCD7FC), SPH_C64(0x0424081420041004), + SPH_C64(0x51E3A208B2515951), SPH_C64(0x99252FC7BC995E99), + SPH_C64(0x6D22DAC44F6DA96D), SPH_C64(0x0D651A39680D340D), + SPH_C64(0xFA79E93583FACFFA), SPH_C64(0xDF69A384B6DF5BDF), + SPH_C64(0x7EA9FC9BD77EE57E), SPH_C64(0x241948B43D249024), + SPH_C64(0x3BFE76D7C53BEC3B), SPH_C64(0xAB9A4B3D31AB96AB), + SPH_C64(0xCEF081D13ECE1FCE), SPH_C64(0x1199225588114411), + SPH_C64(0x8F8303890C8F068F), SPH_C64(0x4E049C6B4A4E254E), + SPH_C64(0xB7667351D1B7E6B7), SPH_C64(0xEBE0CB600BEB8BEB), + SPH_C64(0x3CC178CCFD3CF03C), SPH_C64(0x81FD1FBF7C813E81), + SPH_C64(0x944035FED4946A94), SPH_C64(0xF71CF30CEBF7FBF7), + SPH_C64(0xB9186F67A1B9DEB9), SPH_C64(0x138B265F98134C13), + SPH_C64(0x2C51589C7D2CB02C), SPH_C64(0xD305BBB8D6D36BD3), + SPH_C64(0xE78CD35C6BE7BBE7), SPH_C64(0x6E39DCCB576EA56E), + SPH_C64(0xC4AA95F36EC437C4), SPH_C64(0x031B060F18030C03), + SPH_C64(0x56DCAC138A564556), SPH_C64(0x445E88491A440D44), + SPH_C64(0x7FA0FE9EDF7FE17F), SPH_C64(0xA9884F3721A99EA9), + SPH_C64(0x2A6754824D2AA82A), SPH_C64(0xBB0A6B6DB1BBD6BB), + SPH_C64(0xC1879FE246C123C1), SPH_C64(0x53F1A602A2535153), + SPH_C64(0xDC72A58BAEDC57DC), SPH_C64(0x0B531627580B2C0B), + SPH_C64(0x9D0127D39C9D4E9D), SPH_C64(0x6C2BD8C1476CAD6C), + SPH_C64(0x31A462F59531C431), SPH_C64(0x74F3E8B98774CD74), + SPH_C64(0xF615F109E3F6FFF6), SPH_C64(0x464C8C430A460546), + SPH_C64(0xACA5452609AC8AAC), SPH_C64(0x89B50F973C891E89), + SPH_C64(0x14B42844A0145014), SPH_C64(0xE1BADF425BE1A3E1), + SPH_C64(0x16A62C4EB0165816), SPH_C64(0x3AF774D2CD3AE83A), + SPH_C64(0x6906D2D06F69B969), SPH_C64(0x0941122D48092409), + SPH_C64(0x70D7E0ADA770DD70), SPH_C64(0xB66F7154D9B6E2B6), + SPH_C64(0xD01EBDB7CED067D0), SPH_C64(0xEDD6C77E3BED93ED), + SPH_C64(0xCCE285DB2ECC17CC), SPH_C64(0x426884572A421542), + SPH_C64(0x982C2DC2B4985A98), SPH_C64(0xA4ED550E49A4AAA4), + SPH_C64(0x287550885D28A028), SPH_C64(0x5C86B831DA5C6D5C), + SPH_C64(0xF86BED3F93F8C7F8), SPH_C64(0x86C211A444862286) +}; + +#endif + +/* + * Round constants. + */ +static const sph_u64 plain_RC[10] = { + SPH_C64(0x4F01B887E8C62318), + SPH_C64(0x52916F79F5D2A636), + SPH_C64(0x357B0CA38E9BBC60), + SPH_C64(0x57FE4B2EC2D7E01D), + SPH_C64(0xDA4AF09FE5377715), + SPH_C64(0x856BA0B10A29C958), + SPH_C64(0x67053ECBF4105DBD), + SPH_C64(0xD8957DA78B4127E4), + SPH_C64(0x9E4717DD667CEEFB), + SPH_C64(0x33835AAD07BF2DCA) +}; + +/* ====================================================================== */ +/* + * Constants for plain WHIRLPOOL-0 (first version). + */ + +static const sph_u64 old0_T0[256] = { + SPH_C64(0xD50F67D568B86868), SPH_C64(0xB71ECEB7D06DD0D0), + SPH_C64(0x60E00B60EB20EBEB), SPH_C64(0x876E45872B7D2B2B), + SPH_C64(0x75327A7548D84848), SPH_C64(0xD3019CD39DBA9D9D), + SPH_C64(0xDF1D77DF6ABE6A6A), SPH_C64(0x53977353E431E4E4), + SPH_C64(0x48A84B48E338E3E3), SPH_C64(0x15D27115A3F8A3A3), + SPH_C64(0x13DC8A1356FA5656), SPH_C64(0xBFFD7CBF819E8181), + SPH_C64(0x94B2CF947D877D7D), SPH_C64(0x122ADB12F10EF1F1), + SPH_C64(0xABD95CAB85928585), SPH_C64(0xDC1A84DC9EBF9E9E), + SPH_C64(0x9C517D9C2C742C2C), SPH_C64(0x8C8A048C8E8F8E8E), + SPH_C64(0x859FE78578887878), SPH_C64(0xC5D41EC5CA43CACA), + SPH_C64(0x4BAFB84B17391717), SPH_C64(0x37882137A9E6A9A9), + SPH_C64(0xF84E2FF861A36161), SPH_C64(0xA633E6A6D562D5D5), + SPH_C64(0x348FD2345DE75D5D), SPH_C64(0x275358270B1D0B0B), + SPH_C64(0x869814868C898C8C), SPH_C64(0xCCC1FDCC3C443C3C), + SPH_C64(0xB6E89FB677997777), SPH_C64(0x08E3B20851F35151), + SPH_C64(0xAA2F0DAA22662222), SPH_C64(0x57682A5742C64242), + SPH_C64(0xC3DAE5C33F413F3F), SPH_C64(0x19CE9A1954FC5454), + SPH_C64(0x5873325841C34141), SPH_C64(0xBAF474BA809D8080), + SPH_C64(0xDBE22EDBCC49CCCC), SPH_C64(0xA4C244A486978686), + SPH_C64(0x4542F145B3C8B3B3), SPH_C64(0x78D8C07818281818), + SPH_C64(0x96436D962E722E2E), SPH_C64(0x16D5821657F95757), + SPH_C64(0x1E36301E060A0606), SPH_C64(0xF75537F762A66262), + SPH_C64(0x0307F303F401F4F4), SPH_C64(0xEE9BADEE365A3636), + SPH_C64(0xB217C6B2D16ED1D1), SPH_C64(0xDA147FDA6BBD6B6B), + SPH_C64(0x77C3D8771B2D1B1B), SPH_C64(0xEC6A0FEC65AF6565), + SPH_C64(0xBCFA8FBC759F7575), SPH_C64(0x5090805010301010), + SPH_C64(0x95449E95DA73DADA), SPH_C64(0x703B727049DB4949), + SPH_C64(0xBE0B2DBE266A2626), SPH_C64(0x3A629B3AF916F9F9), + SPH_C64(0xC0DD16C0CB40CBCB), SPH_C64(0xE37117E366AA6666), + SPH_C64(0x5C8C6B5CE734E7E7), SPH_C64(0x6803B968BAD3BABA), + SPH_C64(0x2CB7192CAEEFAEAE), SPH_C64(0x0DEABA0D50F05050), + SPH_C64(0x07F8AA0752F65252), SPH_C64(0x3D9A313DABE0ABAB), + SPH_C64(0x112D2811050F0505), SPH_C64(0x1723D317F00DF0F0), + SPH_C64(0x396568390D170D0D), SPH_C64(0xA2CCBFA273957373), + SPH_C64(0xD7FEC5D73B4D3B3B), SPH_C64(0x14242014040C0404), + SPH_C64(0xA03D1DA020602020), SPH_C64(0x215DA321FE1FFEFE), + SPH_C64(0x8E7BA68EDD7ADDDD), SPH_C64(0x060EFB06F502F5F5), + SPH_C64(0x5E7DC95EB4C1B4B4), SPH_C64(0x3E9DC23E5FE15F5F), + SPH_C64(0x225A50220A1E0A0A), SPH_C64(0x5B74C15BB5C2B5B5), + SPH_C64(0xE78E4EE7C05DC0C0), SPH_C64(0x1AC9691AA0FDA0A0), + SPH_C64(0xA8DEAFA871937171), SPH_C64(0x0BE4410BA5F2A5A5), + SPH_C64(0x995875992D772D2D), SPH_C64(0xFD4727FD60A06060), + SPH_C64(0xA7C5B7A772967272), SPH_C64(0xE57FECE593A89393), + SPH_C64(0xDDECD5DD394B3939), SPH_C64(0x2848402808180808), + SPH_C64(0xB5EF6CB583988383), SPH_C64(0xA53415A521632121), + SPH_C64(0x3186DA315CE45C5C), SPH_C64(0xA1CB4CA187948787), + SPH_C64(0x4F50E14FB1CEB1B1), SPH_C64(0x47B35347E03DE0E0), + SPH_C64(0x0000000000000000), SPH_C64(0xE89556E8C358C3C3), + SPH_C64(0x5A82905A12361212), SPH_C64(0xEF6DFCEF91AE9191), + SPH_C64(0x98AE24988A838A8A), SPH_C64(0x0A12100A02060202), + SPH_C64(0x6CFCE06C1C241C1C), SPH_C64(0x59856359E637E6E6), + SPH_C64(0x4C57124C45CF4545), SPH_C64(0xED9C5EEDC25BC2C2), + SPH_C64(0xF3AA6EF3C451C4C4), SPH_C64(0x2E46BB2EFD1AFDFD), + SPH_C64(0x792E9179BFDCBFBF), SPH_C64(0x495E1A4944CC4444), + SPH_C64(0x1FC0611FA1FEA1A1), SPH_C64(0x61165A614CD44C4C), + SPH_C64(0xFFB685FF33553333), SPH_C64(0xF6A366F6C552C5C5), + SPH_C64(0xAED054AE84918484), SPH_C64(0xAF2605AF23652323), + SPH_C64(0x91BBC7917C847C7C), SPH_C64(0x4A59E94AB0CDB0B0), + SPH_C64(0xB11035B1256F2525), SPH_C64(0x41BDA841153F1515), + SPH_C64(0xE180B5E1355F3535), SPH_C64(0xD0066FD069BB6969), + SPH_C64(0x2454AB24FF1CFFFF), SPH_C64(0xFE40D4FE94A19494), + SPH_C64(0x641F52644DD74D4D), SPH_C64(0xADD7A7AD70907070), + SPH_C64(0x10DB7910A2FBA2A2), SPH_C64(0x29BE1129AFECAFAF), + SPH_C64(0xDEEB26DECD4ACDCD), SPH_C64(0xA928FEA9D667D6D6), + SPH_C64(0xC12B47C16CB46C6C), SPH_C64(0x5166D151B7C4B7B7), + SPH_C64(0x3F6B933FF815F8F8), SPH_C64(0x2D41482D091B0909), + SPH_C64(0x1838CB18F308F3F3), SPH_C64(0xE6781FE667A96767), + SPH_C64(0x0EED490EA4F1A4A4), SPH_C64(0x65E90365EA23EAEA), + SPH_C64(0x7BDF337BEC29ECEC), SPH_C64(0x546FD954B6C7B6B6), + SPH_C64(0xA33AEEA3D461D4D4), SPH_C64(0xBD0CDEBDD26BD2D2), + SPH_C64(0x44B4A044143C1414), SPH_C64(0x66EEF0661E221E1E), + SPH_C64(0x42BA5B42E13EE1E1), SPH_C64(0xB4193DB4246C2424), + SPH_C64(0xD8E5DDD838483838), SPH_C64(0xF9B87EF9C657C6C6), + SPH_C64(0x904D9690DB70DBDB), SPH_C64(0x7A29627A4BDD4B4B), + SPH_C64(0x8F8DF78F7A8E7A7A), SPH_C64(0xD2F7CDD23A4E3A3A), + SPH_C64(0x8160BE81DE7FDEDE), SPH_C64(0x3B94CA3B5EE25E5E), + SPH_C64(0x8469B684DF7CDFDF), SPH_C64(0xFB49DCFB95A29595), + SPH_C64(0x2B4FB32BFC19FCFC), SPH_C64(0x38933938AAE3AAAA), + SPH_C64(0xAC21F6ACD764D7D7), SPH_C64(0xD1F03ED1CE4FCECE), + SPH_C64(0x1B3F381B07090707), SPH_C64(0x337778330F110F0F), + SPH_C64(0xC9C8F5C93D473D3D), SPH_C64(0x25A2FA2558E85858), + SPH_C64(0xC83EA4C89AB39A9A), SPH_C64(0xC22CB4C298B59898), + SPH_C64(0xD60894D69CB99C9C), SPH_C64(0x1D31C31DF20BF2F2), + SPH_C64(0x01F65101A7F4A7A7), SPH_C64(0x5599885511331111), + SPH_C64(0x9BA9D79B7E827E7E), SPH_C64(0x9DA72C9D8B808B8B), + SPH_C64(0x5261225243C54343), SPH_C64(0x0F1B180F03050303), + SPH_C64(0x4DA1434DE23BE2E2), SPH_C64(0x8B72AE8BDC79DCDC), + SPH_C64(0x569E7B56E532E5E5), SPH_C64(0x404BF940B2CBB2B2), + SPH_C64(0x6B044A6B4ED24E4E), SPH_C64(0xFCB176FCC754C7C7), + SPH_C64(0xC4224FC46DB76D6D), SPH_C64(0x6AF21B6AE926E9E9), + SPH_C64(0xBB0225BB27692727), SPH_C64(0x5D7A3A5D40C04040), + SPH_C64(0x9F568E9FD875D8D8), SPH_C64(0xEB92A5EB37593737), + SPH_C64(0xE076E4E092AB9292), SPH_C64(0x89830C898F8C8F8F), + SPH_C64(0x0509080501030101), SPH_C64(0x69F5E8691D271D1D), + SPH_C64(0x02F1A20253F55353), SPH_C64(0xC6D3EDC63E423E3E), + SPH_C64(0x20ABF22059EB5959), SPH_C64(0xE28746E2C15EC1C1), + SPH_C64(0x6E0D426E4FD14F4F), SPH_C64(0xFABF8DFA32563232), + SPH_C64(0x4EA6B04E163A1616), SPH_C64(0x35798335FA13FAFA), + SPH_C64(0xB9F387B9749C7474), SPH_C64(0x30708B30FB10FBFB), + SPH_C64(0xF25C3FF263A56363), SPH_C64(0xD9138CD99FBC9F9F), + SPH_C64(0xE489BDE4345C3434), SPH_C64(0x72CAD0721A2E1A1A), + SPH_C64(0x82674D822A7E2A2A), SPH_C64(0x2FB0EA2F5AEE5A5A), + SPH_C64(0x83911C838D8A8D8D), SPH_C64(0xCACF06CAC946C9C9), + SPH_C64(0xD4F936D4CF4CCFCF), SPH_C64(0x0915E309F607F6F6), + SPH_C64(0xEA64F4EA90AD9090), SPH_C64(0x88755D8828782828), + SPH_C64(0x92BC349288858888), SPH_C64(0xCD37ACCD9BB09B9B), + SPH_C64(0xF5A495F531533131), SPH_C64(0x367E70360E120E0E), + SPH_C64(0x733C8173BDDABDBD), SPH_C64(0x7F206A7F4ADE4A4A), + SPH_C64(0x6FFB136FE825E8E8), SPH_C64(0xF452C4F496A79696), + SPH_C64(0x04FF5904A6F7A6A6), SPH_C64(0x3C6C603C0C140C0C), + SPH_C64(0xCFC60ECFC845C8C8), SPH_C64(0x8096EF80798B7979), + SPH_C64(0x76358976BCD9BCBC), SPH_C64(0x7C27997CBEDFBEBE), + SPH_C64(0x74C42B74EF2CEFEF), SPH_C64(0xCB3957CB6EB26E6E), + SPH_C64(0x434C0A4346CA4646), SPH_C64(0xF15BCCF197A49797), + SPH_C64(0x2AB9E22A5BED5B5B), SPH_C64(0x7ED63B7EED2AEDED), + SPH_C64(0x7DD1C87D192B1919), SPH_C64(0x9A5F869AD976D9D9), + SPH_C64(0x26A50926ACE9ACAC), SPH_C64(0xC725BCC799B69999), + SPH_C64(0x32812932A8E5A8A8), SPH_C64(0x8D7C558D297B2929), + SPH_C64(0xE96307E964AC6464), SPH_C64(0x63E7F8631F211F1F), + SPH_C64(0x23AC0123ADEAADAD), SPH_C64(0x1CC7921C55FF5555), + SPH_C64(0x5F8B985F13351313), SPH_C64(0x6D0AB16DBBD0BBBB), + SPH_C64(0x0C1CEB0CF704F7F7), SPH_C64(0xCE305FCE6FB16F6F), + SPH_C64(0x6718A167B9D6B9B9), SPH_C64(0x4645024647C94747), + SPH_C64(0x934A65932F712F2F), SPH_C64(0x71CD2371EE2FEEEE), + SPH_C64(0x6211A962B8D5B8B8), SPH_C64(0x8A84FF8A7B8D7B7B), + SPH_C64(0x97B53C9789868989), SPH_C64(0xF0AD9DF030503030), + SPH_C64(0xB805D6B8D368D3D3), SPH_C64(0x9EA0DF9E7F817F7F), + SPH_C64(0xB3E197B3769A7676), SPH_C64(0xB0E664B0829B8282) +}; + +#if !SPH_SMALL_FOOTPRINT_WHIRLPOOL + +static const sph_u64 old0_T1[256] = { + SPH_C64(0x0F67D568B86868D5), SPH_C64(0x1ECEB7D06DD0D0B7), + SPH_C64(0xE00B60EB20EBEB60), SPH_C64(0x6E45872B7D2B2B87), + SPH_C64(0x327A7548D8484875), SPH_C64(0x019CD39DBA9D9DD3), + SPH_C64(0x1D77DF6ABE6A6ADF), SPH_C64(0x977353E431E4E453), + SPH_C64(0xA84B48E338E3E348), SPH_C64(0xD27115A3F8A3A315), + SPH_C64(0xDC8A1356FA565613), SPH_C64(0xFD7CBF819E8181BF), + SPH_C64(0xB2CF947D877D7D94), SPH_C64(0x2ADB12F10EF1F112), + SPH_C64(0xD95CAB85928585AB), SPH_C64(0x1A84DC9EBF9E9EDC), + SPH_C64(0x517D9C2C742C2C9C), SPH_C64(0x8A048C8E8F8E8E8C), + SPH_C64(0x9FE7857888787885), SPH_C64(0xD41EC5CA43CACAC5), + SPH_C64(0xAFB84B173917174B), SPH_C64(0x882137A9E6A9A937), + SPH_C64(0x4E2FF861A36161F8), SPH_C64(0x33E6A6D562D5D5A6), + SPH_C64(0x8FD2345DE75D5D34), SPH_C64(0x5358270B1D0B0B27), + SPH_C64(0x9814868C898C8C86), SPH_C64(0xC1FDCC3C443C3CCC), + SPH_C64(0xE89FB677997777B6), SPH_C64(0xE3B20851F3515108), + SPH_C64(0x2F0DAA22662222AA), SPH_C64(0x682A5742C6424257), + SPH_C64(0xDAE5C33F413F3FC3), SPH_C64(0xCE9A1954FC545419), + SPH_C64(0x73325841C3414158), SPH_C64(0xF474BA809D8080BA), + SPH_C64(0xE22EDBCC49CCCCDB), SPH_C64(0xC244A486978686A4), + SPH_C64(0x42F145B3C8B3B345), SPH_C64(0xD8C0781828181878), + SPH_C64(0x436D962E722E2E96), SPH_C64(0xD5821657F9575716), + SPH_C64(0x36301E060A06061E), SPH_C64(0x5537F762A66262F7), + SPH_C64(0x07F303F401F4F403), SPH_C64(0x9BADEE365A3636EE), + SPH_C64(0x17C6B2D16ED1D1B2), SPH_C64(0x147FDA6BBD6B6BDA), + SPH_C64(0xC3D8771B2D1B1B77), SPH_C64(0x6A0FEC65AF6565EC), + SPH_C64(0xFA8FBC759F7575BC), SPH_C64(0x9080501030101050), + SPH_C64(0x449E95DA73DADA95), SPH_C64(0x3B727049DB494970), + SPH_C64(0x0B2DBE266A2626BE), SPH_C64(0x629B3AF916F9F93A), + SPH_C64(0xDD16C0CB40CBCBC0), SPH_C64(0x7117E366AA6666E3), + SPH_C64(0x8C6B5CE734E7E75C), SPH_C64(0x03B968BAD3BABA68), + SPH_C64(0xB7192CAEEFAEAE2C), SPH_C64(0xEABA0D50F050500D), + SPH_C64(0xF8AA0752F6525207), SPH_C64(0x9A313DABE0ABAB3D), + SPH_C64(0x2D2811050F050511), SPH_C64(0x23D317F00DF0F017), + SPH_C64(0x6568390D170D0D39), SPH_C64(0xCCBFA273957373A2), + SPH_C64(0xFEC5D73B4D3B3BD7), SPH_C64(0x242014040C040414), + SPH_C64(0x3D1DA020602020A0), SPH_C64(0x5DA321FE1FFEFE21), + SPH_C64(0x7BA68EDD7ADDDD8E), SPH_C64(0x0EFB06F502F5F506), + SPH_C64(0x7DC95EB4C1B4B45E), SPH_C64(0x9DC23E5FE15F5F3E), + SPH_C64(0x5A50220A1E0A0A22), SPH_C64(0x74C15BB5C2B5B55B), + SPH_C64(0x8E4EE7C05DC0C0E7), SPH_C64(0xC9691AA0FDA0A01A), + SPH_C64(0xDEAFA871937171A8), SPH_C64(0xE4410BA5F2A5A50B), + SPH_C64(0x5875992D772D2D99), SPH_C64(0x4727FD60A06060FD), + SPH_C64(0xC5B7A772967272A7), SPH_C64(0x7FECE593A89393E5), + SPH_C64(0xECD5DD394B3939DD), SPH_C64(0x4840280818080828), + SPH_C64(0xEF6CB583988383B5), SPH_C64(0x3415A521632121A5), + SPH_C64(0x86DA315CE45C5C31), SPH_C64(0xCB4CA187948787A1), + SPH_C64(0x50E14FB1CEB1B14F), SPH_C64(0xB35347E03DE0E047), + SPH_C64(0x0000000000000000), SPH_C64(0x9556E8C358C3C3E8), + SPH_C64(0x82905A123612125A), SPH_C64(0x6DFCEF91AE9191EF), + SPH_C64(0xAE24988A838A8A98), SPH_C64(0x12100A020602020A), + SPH_C64(0xFCE06C1C241C1C6C), SPH_C64(0x856359E637E6E659), + SPH_C64(0x57124C45CF45454C), SPH_C64(0x9C5EEDC25BC2C2ED), + SPH_C64(0xAA6EF3C451C4C4F3), SPH_C64(0x46BB2EFD1AFDFD2E), + SPH_C64(0x2E9179BFDCBFBF79), SPH_C64(0x5E1A4944CC444449), + SPH_C64(0xC0611FA1FEA1A11F), SPH_C64(0x165A614CD44C4C61), + SPH_C64(0xB685FF33553333FF), SPH_C64(0xA366F6C552C5C5F6), + SPH_C64(0xD054AE84918484AE), SPH_C64(0x2605AF23652323AF), + SPH_C64(0xBBC7917C847C7C91), SPH_C64(0x59E94AB0CDB0B04A), + SPH_C64(0x1035B1256F2525B1), SPH_C64(0xBDA841153F151541), + SPH_C64(0x80B5E1355F3535E1), SPH_C64(0x066FD069BB6969D0), + SPH_C64(0x54AB24FF1CFFFF24), SPH_C64(0x40D4FE94A19494FE), + SPH_C64(0x1F52644DD74D4D64), SPH_C64(0xD7A7AD70907070AD), + SPH_C64(0xDB7910A2FBA2A210), SPH_C64(0xBE1129AFECAFAF29), + SPH_C64(0xEB26DECD4ACDCDDE), SPH_C64(0x28FEA9D667D6D6A9), + SPH_C64(0x2B47C16CB46C6CC1), SPH_C64(0x66D151B7C4B7B751), + SPH_C64(0x6B933FF815F8F83F), SPH_C64(0x41482D091B09092D), + SPH_C64(0x38CB18F308F3F318), SPH_C64(0x781FE667A96767E6), + SPH_C64(0xED490EA4F1A4A40E), SPH_C64(0xE90365EA23EAEA65), + SPH_C64(0xDF337BEC29ECEC7B), SPH_C64(0x6FD954B6C7B6B654), + SPH_C64(0x3AEEA3D461D4D4A3), SPH_C64(0x0CDEBDD26BD2D2BD), + SPH_C64(0xB4A044143C141444), SPH_C64(0xEEF0661E221E1E66), + SPH_C64(0xBA5B42E13EE1E142), SPH_C64(0x193DB4246C2424B4), + SPH_C64(0xE5DDD838483838D8), SPH_C64(0xB87EF9C657C6C6F9), + SPH_C64(0x4D9690DB70DBDB90), SPH_C64(0x29627A4BDD4B4B7A), + SPH_C64(0x8DF78F7A8E7A7A8F), SPH_C64(0xF7CDD23A4E3A3AD2), + SPH_C64(0x60BE81DE7FDEDE81), SPH_C64(0x94CA3B5EE25E5E3B), + SPH_C64(0x69B684DF7CDFDF84), SPH_C64(0x49DCFB95A29595FB), + SPH_C64(0x4FB32BFC19FCFC2B), SPH_C64(0x933938AAE3AAAA38), + SPH_C64(0x21F6ACD764D7D7AC), SPH_C64(0xF03ED1CE4FCECED1), + SPH_C64(0x3F381B070907071B), SPH_C64(0x7778330F110F0F33), + SPH_C64(0xC8F5C93D473D3DC9), SPH_C64(0xA2FA2558E8585825), + SPH_C64(0x3EA4C89AB39A9AC8), SPH_C64(0x2CB4C298B59898C2), + SPH_C64(0x0894D69CB99C9CD6), SPH_C64(0x31C31DF20BF2F21D), + SPH_C64(0xF65101A7F4A7A701), SPH_C64(0x9988551133111155), + SPH_C64(0xA9D79B7E827E7E9B), SPH_C64(0xA72C9D8B808B8B9D), + SPH_C64(0x61225243C5434352), SPH_C64(0x1B180F030503030F), + SPH_C64(0xA1434DE23BE2E24D), SPH_C64(0x72AE8BDC79DCDC8B), + SPH_C64(0x9E7B56E532E5E556), SPH_C64(0x4BF940B2CBB2B240), + SPH_C64(0x044A6B4ED24E4E6B), SPH_C64(0xB176FCC754C7C7FC), + SPH_C64(0x224FC46DB76D6DC4), SPH_C64(0xF21B6AE926E9E96A), + SPH_C64(0x0225BB27692727BB), SPH_C64(0x7A3A5D40C040405D), + SPH_C64(0x568E9FD875D8D89F), SPH_C64(0x92A5EB37593737EB), + SPH_C64(0x76E4E092AB9292E0), SPH_C64(0x830C898F8C8F8F89), + SPH_C64(0x0908050103010105), SPH_C64(0xF5E8691D271D1D69), + SPH_C64(0xF1A20253F5535302), SPH_C64(0xD3EDC63E423E3EC6), + SPH_C64(0xABF22059EB595920), SPH_C64(0x8746E2C15EC1C1E2), + SPH_C64(0x0D426E4FD14F4F6E), SPH_C64(0xBF8DFA32563232FA), + SPH_C64(0xA6B04E163A16164E), SPH_C64(0x798335FA13FAFA35), + SPH_C64(0xF387B9749C7474B9), SPH_C64(0x708B30FB10FBFB30), + SPH_C64(0x5C3FF263A56363F2), SPH_C64(0x138CD99FBC9F9FD9), + SPH_C64(0x89BDE4345C3434E4), SPH_C64(0xCAD0721A2E1A1A72), + SPH_C64(0x674D822A7E2A2A82), SPH_C64(0xB0EA2F5AEE5A5A2F), + SPH_C64(0x911C838D8A8D8D83), SPH_C64(0xCF06CAC946C9C9CA), + SPH_C64(0xF936D4CF4CCFCFD4), SPH_C64(0x15E309F607F6F609), + SPH_C64(0x64F4EA90AD9090EA), SPH_C64(0x755D882878282888), + SPH_C64(0xBC34928885888892), SPH_C64(0x37ACCD9BB09B9BCD), + SPH_C64(0xA495F531533131F5), SPH_C64(0x7E70360E120E0E36), + SPH_C64(0x3C8173BDDABDBD73), SPH_C64(0x206A7F4ADE4A4A7F), + SPH_C64(0xFB136FE825E8E86F), SPH_C64(0x52C4F496A79696F4), + SPH_C64(0xFF5904A6F7A6A604), SPH_C64(0x6C603C0C140C0C3C), + SPH_C64(0xC60ECFC845C8C8CF), SPH_C64(0x96EF80798B797980), + SPH_C64(0x358976BCD9BCBC76), SPH_C64(0x27997CBEDFBEBE7C), + SPH_C64(0xC42B74EF2CEFEF74), SPH_C64(0x3957CB6EB26E6ECB), + SPH_C64(0x4C0A4346CA464643), SPH_C64(0x5BCCF197A49797F1), + SPH_C64(0xB9E22A5BED5B5B2A), SPH_C64(0xD63B7EED2AEDED7E), + SPH_C64(0xD1C87D192B19197D), SPH_C64(0x5F869AD976D9D99A), + SPH_C64(0xA50926ACE9ACAC26), SPH_C64(0x25BCC799B69999C7), + SPH_C64(0x812932A8E5A8A832), SPH_C64(0x7C558D297B29298D), + SPH_C64(0x6307E964AC6464E9), SPH_C64(0xE7F8631F211F1F63), + SPH_C64(0xAC0123ADEAADAD23), SPH_C64(0xC7921C55FF55551C), + SPH_C64(0x8B985F133513135F), SPH_C64(0x0AB16DBBD0BBBB6D), + SPH_C64(0x1CEB0CF704F7F70C), SPH_C64(0x305FCE6FB16F6FCE), + SPH_C64(0x18A167B9D6B9B967), SPH_C64(0x45024647C9474746), + SPH_C64(0x4A65932F712F2F93), SPH_C64(0xCD2371EE2FEEEE71), + SPH_C64(0x11A962B8D5B8B862), SPH_C64(0x84FF8A7B8D7B7B8A), + SPH_C64(0xB53C978986898997), SPH_C64(0xAD9DF030503030F0), + SPH_C64(0x05D6B8D368D3D3B8), SPH_C64(0xA0DF9E7F817F7F9E), + SPH_C64(0xE197B3769A7676B3), SPH_C64(0xE664B0829B8282B0) +}; + +static const sph_u64 old0_T2[256] = { + SPH_C64(0x67D568B86868D50F), SPH_C64(0xCEB7D06DD0D0B71E), + SPH_C64(0x0B60EB20EBEB60E0), SPH_C64(0x45872B7D2B2B876E), + SPH_C64(0x7A7548D848487532), SPH_C64(0x9CD39DBA9D9DD301), + SPH_C64(0x77DF6ABE6A6ADF1D), SPH_C64(0x7353E431E4E45397), + SPH_C64(0x4B48E338E3E348A8), SPH_C64(0x7115A3F8A3A315D2), + SPH_C64(0x8A1356FA565613DC), SPH_C64(0x7CBF819E8181BFFD), + SPH_C64(0xCF947D877D7D94B2), SPH_C64(0xDB12F10EF1F1122A), + SPH_C64(0x5CAB85928585ABD9), SPH_C64(0x84DC9EBF9E9EDC1A), + SPH_C64(0x7D9C2C742C2C9C51), SPH_C64(0x048C8E8F8E8E8C8A), + SPH_C64(0xE78578887878859F), SPH_C64(0x1EC5CA43CACAC5D4), + SPH_C64(0xB84B173917174BAF), SPH_C64(0x2137A9E6A9A93788), + SPH_C64(0x2FF861A36161F84E), SPH_C64(0xE6A6D562D5D5A633), + SPH_C64(0xD2345DE75D5D348F), SPH_C64(0x58270B1D0B0B2753), + SPH_C64(0x14868C898C8C8698), SPH_C64(0xFDCC3C443C3CCCC1), + SPH_C64(0x9FB677997777B6E8), SPH_C64(0xB20851F3515108E3), + SPH_C64(0x0DAA22662222AA2F), SPH_C64(0x2A5742C642425768), + SPH_C64(0xE5C33F413F3FC3DA), SPH_C64(0x9A1954FC545419CE), + SPH_C64(0x325841C341415873), SPH_C64(0x74BA809D8080BAF4), + SPH_C64(0x2EDBCC49CCCCDBE2), SPH_C64(0x44A486978686A4C2), + SPH_C64(0xF145B3C8B3B34542), SPH_C64(0xC0781828181878D8), + SPH_C64(0x6D962E722E2E9643), SPH_C64(0x821657F9575716D5), + SPH_C64(0x301E060A06061E36), SPH_C64(0x37F762A66262F755), + SPH_C64(0xF303F401F4F40307), SPH_C64(0xADEE365A3636EE9B), + SPH_C64(0xC6B2D16ED1D1B217), SPH_C64(0x7FDA6BBD6B6BDA14), + SPH_C64(0xD8771B2D1B1B77C3), SPH_C64(0x0FEC65AF6565EC6A), + SPH_C64(0x8FBC759F7575BCFA), SPH_C64(0x8050103010105090), + SPH_C64(0x9E95DA73DADA9544), SPH_C64(0x727049DB4949703B), + SPH_C64(0x2DBE266A2626BE0B), SPH_C64(0x9B3AF916F9F93A62), + SPH_C64(0x16C0CB40CBCBC0DD), SPH_C64(0x17E366AA6666E371), + SPH_C64(0x6B5CE734E7E75C8C), SPH_C64(0xB968BAD3BABA6803), + SPH_C64(0x192CAEEFAEAE2CB7), SPH_C64(0xBA0D50F050500DEA), + SPH_C64(0xAA0752F6525207F8), SPH_C64(0x313DABE0ABAB3D9A), + SPH_C64(0x2811050F0505112D), SPH_C64(0xD317F00DF0F01723), + SPH_C64(0x68390D170D0D3965), SPH_C64(0xBFA273957373A2CC), + SPH_C64(0xC5D73B4D3B3BD7FE), SPH_C64(0x2014040C04041424), + SPH_C64(0x1DA020602020A03D), SPH_C64(0xA321FE1FFEFE215D), + SPH_C64(0xA68EDD7ADDDD8E7B), SPH_C64(0xFB06F502F5F5060E), + SPH_C64(0xC95EB4C1B4B45E7D), SPH_C64(0xC23E5FE15F5F3E9D), + SPH_C64(0x50220A1E0A0A225A), SPH_C64(0xC15BB5C2B5B55B74), + SPH_C64(0x4EE7C05DC0C0E78E), SPH_C64(0x691AA0FDA0A01AC9), + SPH_C64(0xAFA871937171A8DE), SPH_C64(0x410BA5F2A5A50BE4), + SPH_C64(0x75992D772D2D9958), SPH_C64(0x27FD60A06060FD47), + SPH_C64(0xB7A772967272A7C5), SPH_C64(0xECE593A89393E57F), + SPH_C64(0xD5DD394B3939DDEC), SPH_C64(0x4028081808082848), + SPH_C64(0x6CB583988383B5EF), SPH_C64(0x15A521632121A534), + SPH_C64(0xDA315CE45C5C3186), SPH_C64(0x4CA187948787A1CB), + SPH_C64(0xE14FB1CEB1B14F50), SPH_C64(0x5347E03DE0E047B3), + SPH_C64(0x0000000000000000), SPH_C64(0x56E8C358C3C3E895), + SPH_C64(0x905A123612125A82), SPH_C64(0xFCEF91AE9191EF6D), + SPH_C64(0x24988A838A8A98AE), SPH_C64(0x100A020602020A12), + SPH_C64(0xE06C1C241C1C6CFC), SPH_C64(0x6359E637E6E65985), + SPH_C64(0x124C45CF45454C57), SPH_C64(0x5EEDC25BC2C2ED9C), + SPH_C64(0x6EF3C451C4C4F3AA), SPH_C64(0xBB2EFD1AFDFD2E46), + SPH_C64(0x9179BFDCBFBF792E), SPH_C64(0x1A4944CC4444495E), + SPH_C64(0x611FA1FEA1A11FC0), SPH_C64(0x5A614CD44C4C6116), + SPH_C64(0x85FF33553333FFB6), SPH_C64(0x66F6C552C5C5F6A3), + SPH_C64(0x54AE84918484AED0), SPH_C64(0x05AF23652323AF26), + SPH_C64(0xC7917C847C7C91BB), SPH_C64(0xE94AB0CDB0B04A59), + SPH_C64(0x35B1256F2525B110), SPH_C64(0xA841153F151541BD), + SPH_C64(0xB5E1355F3535E180), SPH_C64(0x6FD069BB6969D006), + SPH_C64(0xAB24FF1CFFFF2454), SPH_C64(0xD4FE94A19494FE40), + SPH_C64(0x52644DD74D4D641F), SPH_C64(0xA7AD70907070ADD7), + SPH_C64(0x7910A2FBA2A210DB), SPH_C64(0x1129AFECAFAF29BE), + SPH_C64(0x26DECD4ACDCDDEEB), SPH_C64(0xFEA9D667D6D6A928), + SPH_C64(0x47C16CB46C6CC12B), SPH_C64(0xD151B7C4B7B75166), + SPH_C64(0x933FF815F8F83F6B), SPH_C64(0x482D091B09092D41), + SPH_C64(0xCB18F308F3F31838), SPH_C64(0x1FE667A96767E678), + SPH_C64(0x490EA4F1A4A40EED), SPH_C64(0x0365EA23EAEA65E9), + SPH_C64(0x337BEC29ECEC7BDF), SPH_C64(0xD954B6C7B6B6546F), + SPH_C64(0xEEA3D461D4D4A33A), SPH_C64(0xDEBDD26BD2D2BD0C), + SPH_C64(0xA044143C141444B4), SPH_C64(0xF0661E221E1E66EE), + SPH_C64(0x5B42E13EE1E142BA), SPH_C64(0x3DB4246C2424B419), + SPH_C64(0xDDD838483838D8E5), SPH_C64(0x7EF9C657C6C6F9B8), + SPH_C64(0x9690DB70DBDB904D), SPH_C64(0x627A4BDD4B4B7A29), + SPH_C64(0xF78F7A8E7A7A8F8D), SPH_C64(0xCDD23A4E3A3AD2F7), + SPH_C64(0xBE81DE7FDEDE8160), SPH_C64(0xCA3B5EE25E5E3B94), + SPH_C64(0xB684DF7CDFDF8469), SPH_C64(0xDCFB95A29595FB49), + SPH_C64(0xB32BFC19FCFC2B4F), SPH_C64(0x3938AAE3AAAA3893), + SPH_C64(0xF6ACD764D7D7AC21), SPH_C64(0x3ED1CE4FCECED1F0), + SPH_C64(0x381B070907071B3F), SPH_C64(0x78330F110F0F3377), + SPH_C64(0xF5C93D473D3DC9C8), SPH_C64(0xFA2558E8585825A2), + SPH_C64(0xA4C89AB39A9AC83E), SPH_C64(0xB4C298B59898C22C), + SPH_C64(0x94D69CB99C9CD608), SPH_C64(0xC31DF20BF2F21D31), + SPH_C64(0x5101A7F4A7A701F6), SPH_C64(0x8855113311115599), + SPH_C64(0xD79B7E827E7E9BA9), SPH_C64(0x2C9D8B808B8B9DA7), + SPH_C64(0x225243C543435261), SPH_C64(0x180F030503030F1B), + SPH_C64(0x434DE23BE2E24DA1), SPH_C64(0xAE8BDC79DCDC8B72), + SPH_C64(0x7B56E532E5E5569E), SPH_C64(0xF940B2CBB2B2404B), + SPH_C64(0x4A6B4ED24E4E6B04), SPH_C64(0x76FCC754C7C7FCB1), + SPH_C64(0x4FC46DB76D6DC422), SPH_C64(0x1B6AE926E9E96AF2), + SPH_C64(0x25BB27692727BB02), SPH_C64(0x3A5D40C040405D7A), + SPH_C64(0x8E9FD875D8D89F56), SPH_C64(0xA5EB37593737EB92), + SPH_C64(0xE4E092AB9292E076), SPH_C64(0x0C898F8C8F8F8983), + SPH_C64(0x0805010301010509), SPH_C64(0xE8691D271D1D69F5), + SPH_C64(0xA20253F5535302F1), SPH_C64(0xEDC63E423E3EC6D3), + SPH_C64(0xF22059EB595920AB), SPH_C64(0x46E2C15EC1C1E287), + SPH_C64(0x426E4FD14F4F6E0D), SPH_C64(0x8DFA32563232FABF), + SPH_C64(0xB04E163A16164EA6), SPH_C64(0x8335FA13FAFA3579), + SPH_C64(0x87B9749C7474B9F3), SPH_C64(0x8B30FB10FBFB3070), + SPH_C64(0x3FF263A56363F25C), SPH_C64(0x8CD99FBC9F9FD913), + SPH_C64(0xBDE4345C3434E489), SPH_C64(0xD0721A2E1A1A72CA), + SPH_C64(0x4D822A7E2A2A8267), SPH_C64(0xEA2F5AEE5A5A2FB0), + SPH_C64(0x1C838D8A8D8D8391), SPH_C64(0x06CAC946C9C9CACF), + SPH_C64(0x36D4CF4CCFCFD4F9), SPH_C64(0xE309F607F6F60915), + SPH_C64(0xF4EA90AD9090EA64), SPH_C64(0x5D88287828288875), + SPH_C64(0x34928885888892BC), SPH_C64(0xACCD9BB09B9BCD37), + SPH_C64(0x95F531533131F5A4), SPH_C64(0x70360E120E0E367E), + SPH_C64(0x8173BDDABDBD733C), SPH_C64(0x6A7F4ADE4A4A7F20), + SPH_C64(0x136FE825E8E86FFB), SPH_C64(0xC4F496A79696F452), + SPH_C64(0x5904A6F7A6A604FF), SPH_C64(0x603C0C140C0C3C6C), + SPH_C64(0x0ECFC845C8C8CFC6), SPH_C64(0xEF80798B79798096), + SPH_C64(0x8976BCD9BCBC7635), SPH_C64(0x997CBEDFBEBE7C27), + SPH_C64(0x2B74EF2CEFEF74C4), SPH_C64(0x57CB6EB26E6ECB39), + SPH_C64(0x0A4346CA4646434C), SPH_C64(0xCCF197A49797F15B), + SPH_C64(0xE22A5BED5B5B2AB9), SPH_C64(0x3B7EED2AEDED7ED6), + SPH_C64(0xC87D192B19197DD1), SPH_C64(0x869AD976D9D99A5F), + SPH_C64(0x0926ACE9ACAC26A5), SPH_C64(0xBCC799B69999C725), + SPH_C64(0x2932A8E5A8A83281), SPH_C64(0x558D297B29298D7C), + SPH_C64(0x07E964AC6464E963), SPH_C64(0xF8631F211F1F63E7), + SPH_C64(0x0123ADEAADAD23AC), SPH_C64(0x921C55FF55551CC7), + SPH_C64(0x985F133513135F8B), SPH_C64(0xB16DBBD0BBBB6D0A), + SPH_C64(0xEB0CF704F7F70C1C), SPH_C64(0x5FCE6FB16F6FCE30), + SPH_C64(0xA167B9D6B9B96718), SPH_C64(0x024647C947474645), + SPH_C64(0x65932F712F2F934A), SPH_C64(0x2371EE2FEEEE71CD), + SPH_C64(0xA962B8D5B8B86211), SPH_C64(0xFF8A7B8D7B7B8A84), + SPH_C64(0x3C978986898997B5), SPH_C64(0x9DF030503030F0AD), + SPH_C64(0xD6B8D368D3D3B805), SPH_C64(0xDF9E7F817F7F9EA0), + SPH_C64(0x97B3769A7676B3E1), SPH_C64(0x64B0829B8282B0E6) +}; + +static const sph_u64 old0_T3[256] = { + SPH_C64(0xD568B86868D50F67), SPH_C64(0xB7D06DD0D0B71ECE), + SPH_C64(0x60EB20EBEB60E00B), SPH_C64(0x872B7D2B2B876E45), + SPH_C64(0x7548D8484875327A), SPH_C64(0xD39DBA9D9DD3019C), + SPH_C64(0xDF6ABE6A6ADF1D77), SPH_C64(0x53E431E4E4539773), + SPH_C64(0x48E338E3E348A84B), SPH_C64(0x15A3F8A3A315D271), + SPH_C64(0x1356FA565613DC8A), SPH_C64(0xBF819E8181BFFD7C), + SPH_C64(0x947D877D7D94B2CF), SPH_C64(0x12F10EF1F1122ADB), + SPH_C64(0xAB85928585ABD95C), SPH_C64(0xDC9EBF9E9EDC1A84), + SPH_C64(0x9C2C742C2C9C517D), SPH_C64(0x8C8E8F8E8E8C8A04), + SPH_C64(0x8578887878859FE7), SPH_C64(0xC5CA43CACAC5D41E), + SPH_C64(0x4B173917174BAFB8), SPH_C64(0x37A9E6A9A9378821), + SPH_C64(0xF861A36161F84E2F), SPH_C64(0xA6D562D5D5A633E6), + SPH_C64(0x345DE75D5D348FD2), SPH_C64(0x270B1D0B0B275358), + SPH_C64(0x868C898C8C869814), SPH_C64(0xCC3C443C3CCCC1FD), + SPH_C64(0xB677997777B6E89F), SPH_C64(0x0851F3515108E3B2), + SPH_C64(0xAA22662222AA2F0D), SPH_C64(0x5742C6424257682A), + SPH_C64(0xC33F413F3FC3DAE5), SPH_C64(0x1954FC545419CE9A), + SPH_C64(0x5841C34141587332), SPH_C64(0xBA809D8080BAF474), + SPH_C64(0xDBCC49CCCCDBE22E), SPH_C64(0xA486978686A4C244), + SPH_C64(0x45B3C8B3B34542F1), SPH_C64(0x781828181878D8C0), + SPH_C64(0x962E722E2E96436D), SPH_C64(0x1657F9575716D582), + SPH_C64(0x1E060A06061E3630), SPH_C64(0xF762A66262F75537), + SPH_C64(0x03F401F4F40307F3), SPH_C64(0xEE365A3636EE9BAD), + SPH_C64(0xB2D16ED1D1B217C6), SPH_C64(0xDA6BBD6B6BDA147F), + SPH_C64(0x771B2D1B1B77C3D8), SPH_C64(0xEC65AF6565EC6A0F), + SPH_C64(0xBC759F7575BCFA8F), SPH_C64(0x5010301010509080), + SPH_C64(0x95DA73DADA95449E), SPH_C64(0x7049DB4949703B72), + SPH_C64(0xBE266A2626BE0B2D), SPH_C64(0x3AF916F9F93A629B), + SPH_C64(0xC0CB40CBCBC0DD16), SPH_C64(0xE366AA6666E37117), + SPH_C64(0x5CE734E7E75C8C6B), SPH_C64(0x68BAD3BABA6803B9), + SPH_C64(0x2CAEEFAEAE2CB719), SPH_C64(0x0D50F050500DEABA), + SPH_C64(0x0752F6525207F8AA), SPH_C64(0x3DABE0ABAB3D9A31), + SPH_C64(0x11050F0505112D28), SPH_C64(0x17F00DF0F01723D3), + SPH_C64(0x390D170D0D396568), SPH_C64(0xA273957373A2CCBF), + SPH_C64(0xD73B4D3B3BD7FEC5), SPH_C64(0x14040C0404142420), + SPH_C64(0xA020602020A03D1D), SPH_C64(0x21FE1FFEFE215DA3), + SPH_C64(0x8EDD7ADDDD8E7BA6), SPH_C64(0x06F502F5F5060EFB), + SPH_C64(0x5EB4C1B4B45E7DC9), SPH_C64(0x3E5FE15F5F3E9DC2), + SPH_C64(0x220A1E0A0A225A50), SPH_C64(0x5BB5C2B5B55B74C1), + SPH_C64(0xE7C05DC0C0E78E4E), SPH_C64(0x1AA0FDA0A01AC969), + SPH_C64(0xA871937171A8DEAF), SPH_C64(0x0BA5F2A5A50BE441), + SPH_C64(0x992D772D2D995875), SPH_C64(0xFD60A06060FD4727), + SPH_C64(0xA772967272A7C5B7), SPH_C64(0xE593A89393E57FEC), + SPH_C64(0xDD394B3939DDECD5), SPH_C64(0x2808180808284840), + SPH_C64(0xB583988383B5EF6C), SPH_C64(0xA521632121A53415), + SPH_C64(0x315CE45C5C3186DA), SPH_C64(0xA187948787A1CB4C), + SPH_C64(0x4FB1CEB1B14F50E1), SPH_C64(0x47E03DE0E047B353), + SPH_C64(0x0000000000000000), SPH_C64(0xE8C358C3C3E89556), + SPH_C64(0x5A123612125A8290), SPH_C64(0xEF91AE9191EF6DFC), + SPH_C64(0x988A838A8A98AE24), SPH_C64(0x0A020602020A1210), + SPH_C64(0x6C1C241C1C6CFCE0), SPH_C64(0x59E637E6E6598563), + SPH_C64(0x4C45CF45454C5712), SPH_C64(0xEDC25BC2C2ED9C5E), + SPH_C64(0xF3C451C4C4F3AA6E), SPH_C64(0x2EFD1AFDFD2E46BB), + SPH_C64(0x79BFDCBFBF792E91), SPH_C64(0x4944CC4444495E1A), + SPH_C64(0x1FA1FEA1A11FC061), SPH_C64(0x614CD44C4C61165A), + SPH_C64(0xFF33553333FFB685), SPH_C64(0xF6C552C5C5F6A366), + SPH_C64(0xAE84918484AED054), SPH_C64(0xAF23652323AF2605), + SPH_C64(0x917C847C7C91BBC7), SPH_C64(0x4AB0CDB0B04A59E9), + SPH_C64(0xB1256F2525B11035), SPH_C64(0x41153F151541BDA8), + SPH_C64(0xE1355F3535E180B5), SPH_C64(0xD069BB6969D0066F), + SPH_C64(0x24FF1CFFFF2454AB), SPH_C64(0xFE94A19494FE40D4), + SPH_C64(0x644DD74D4D641F52), SPH_C64(0xAD70907070ADD7A7), + SPH_C64(0x10A2FBA2A210DB79), SPH_C64(0x29AFECAFAF29BE11), + SPH_C64(0xDECD4ACDCDDEEB26), SPH_C64(0xA9D667D6D6A928FE), + SPH_C64(0xC16CB46C6CC12B47), SPH_C64(0x51B7C4B7B75166D1), + SPH_C64(0x3FF815F8F83F6B93), SPH_C64(0x2D091B09092D4148), + SPH_C64(0x18F308F3F31838CB), SPH_C64(0xE667A96767E6781F), + SPH_C64(0x0EA4F1A4A40EED49), SPH_C64(0x65EA23EAEA65E903), + SPH_C64(0x7BEC29ECEC7BDF33), SPH_C64(0x54B6C7B6B6546FD9), + SPH_C64(0xA3D461D4D4A33AEE), SPH_C64(0xBDD26BD2D2BD0CDE), + SPH_C64(0x44143C141444B4A0), SPH_C64(0x661E221E1E66EEF0), + SPH_C64(0x42E13EE1E142BA5B), SPH_C64(0xB4246C2424B4193D), + SPH_C64(0xD838483838D8E5DD), SPH_C64(0xF9C657C6C6F9B87E), + SPH_C64(0x90DB70DBDB904D96), SPH_C64(0x7A4BDD4B4B7A2962), + SPH_C64(0x8F7A8E7A7A8F8DF7), SPH_C64(0xD23A4E3A3AD2F7CD), + SPH_C64(0x81DE7FDEDE8160BE), SPH_C64(0x3B5EE25E5E3B94CA), + SPH_C64(0x84DF7CDFDF8469B6), SPH_C64(0xFB95A29595FB49DC), + SPH_C64(0x2BFC19FCFC2B4FB3), SPH_C64(0x38AAE3AAAA389339), + SPH_C64(0xACD764D7D7AC21F6), SPH_C64(0xD1CE4FCECED1F03E), + SPH_C64(0x1B070907071B3F38), SPH_C64(0x330F110F0F337778), + SPH_C64(0xC93D473D3DC9C8F5), SPH_C64(0x2558E8585825A2FA), + SPH_C64(0xC89AB39A9AC83EA4), SPH_C64(0xC298B59898C22CB4), + SPH_C64(0xD69CB99C9CD60894), SPH_C64(0x1DF20BF2F21D31C3), + SPH_C64(0x01A7F4A7A701F651), SPH_C64(0x5511331111559988), + SPH_C64(0x9B7E827E7E9BA9D7), SPH_C64(0x9D8B808B8B9DA72C), + SPH_C64(0x5243C54343526122), SPH_C64(0x0F030503030F1B18), + SPH_C64(0x4DE23BE2E24DA143), SPH_C64(0x8BDC79DCDC8B72AE), + SPH_C64(0x56E532E5E5569E7B), SPH_C64(0x40B2CBB2B2404BF9), + SPH_C64(0x6B4ED24E4E6B044A), SPH_C64(0xFCC754C7C7FCB176), + SPH_C64(0xC46DB76D6DC4224F), SPH_C64(0x6AE926E9E96AF21B), + SPH_C64(0xBB27692727BB0225), SPH_C64(0x5D40C040405D7A3A), + SPH_C64(0x9FD875D8D89F568E), SPH_C64(0xEB37593737EB92A5), + SPH_C64(0xE092AB9292E076E4), SPH_C64(0x898F8C8F8F89830C), + SPH_C64(0x0501030101050908), SPH_C64(0x691D271D1D69F5E8), + SPH_C64(0x0253F5535302F1A2), SPH_C64(0xC63E423E3EC6D3ED), + SPH_C64(0x2059EB595920ABF2), SPH_C64(0xE2C15EC1C1E28746), + SPH_C64(0x6E4FD14F4F6E0D42), SPH_C64(0xFA32563232FABF8D), + SPH_C64(0x4E163A16164EA6B0), SPH_C64(0x35FA13FAFA357983), + SPH_C64(0xB9749C7474B9F387), SPH_C64(0x30FB10FBFB30708B), + SPH_C64(0xF263A56363F25C3F), SPH_C64(0xD99FBC9F9FD9138C), + SPH_C64(0xE4345C3434E489BD), SPH_C64(0x721A2E1A1A72CAD0), + SPH_C64(0x822A7E2A2A82674D), SPH_C64(0x2F5AEE5A5A2FB0EA), + SPH_C64(0x838D8A8D8D83911C), SPH_C64(0xCAC946C9C9CACF06), + SPH_C64(0xD4CF4CCFCFD4F936), SPH_C64(0x09F607F6F60915E3), + SPH_C64(0xEA90AD9090EA64F4), SPH_C64(0x882878282888755D), + SPH_C64(0x928885888892BC34), SPH_C64(0xCD9BB09B9BCD37AC), + SPH_C64(0xF531533131F5A495), SPH_C64(0x360E120E0E367E70), + SPH_C64(0x73BDDABDBD733C81), SPH_C64(0x7F4ADE4A4A7F206A), + SPH_C64(0x6FE825E8E86FFB13), SPH_C64(0xF496A79696F452C4), + SPH_C64(0x04A6F7A6A604FF59), SPH_C64(0x3C0C140C0C3C6C60), + SPH_C64(0xCFC845C8C8CFC60E), SPH_C64(0x80798B79798096EF), + SPH_C64(0x76BCD9BCBC763589), SPH_C64(0x7CBEDFBEBE7C2799), + SPH_C64(0x74EF2CEFEF74C42B), SPH_C64(0xCB6EB26E6ECB3957), + SPH_C64(0x4346CA4646434C0A), SPH_C64(0xF197A49797F15BCC), + SPH_C64(0x2A5BED5B5B2AB9E2), SPH_C64(0x7EED2AEDED7ED63B), + SPH_C64(0x7D192B19197DD1C8), SPH_C64(0x9AD976D9D99A5F86), + SPH_C64(0x26ACE9ACAC26A509), SPH_C64(0xC799B69999C725BC), + SPH_C64(0x32A8E5A8A8328129), SPH_C64(0x8D297B29298D7C55), + SPH_C64(0xE964AC6464E96307), SPH_C64(0x631F211F1F63E7F8), + SPH_C64(0x23ADEAADAD23AC01), SPH_C64(0x1C55FF55551CC792), + SPH_C64(0x5F133513135F8B98), SPH_C64(0x6DBBD0BBBB6D0AB1), + SPH_C64(0x0CF704F7F70C1CEB), SPH_C64(0xCE6FB16F6FCE305F), + SPH_C64(0x67B9D6B9B96718A1), SPH_C64(0x4647C94747464502), + SPH_C64(0x932F712F2F934A65), SPH_C64(0x71EE2FEEEE71CD23), + SPH_C64(0x62B8D5B8B86211A9), SPH_C64(0x8A7B8D7B7B8A84FF), + SPH_C64(0x978986898997B53C), SPH_C64(0xF030503030F0AD9D), + SPH_C64(0xB8D368D3D3B805D6), SPH_C64(0x9E7F817F7F9EA0DF), + SPH_C64(0xB3769A7676B3E197), SPH_C64(0xB0829B8282B0E664) +}; + +static const sph_u64 old0_T4[256] = { + SPH_C64(0x68B86868D50F67D5), SPH_C64(0xD06DD0D0B71ECEB7), + SPH_C64(0xEB20EBEB60E00B60), SPH_C64(0x2B7D2B2B876E4587), + SPH_C64(0x48D8484875327A75), SPH_C64(0x9DBA9D9DD3019CD3), + SPH_C64(0x6ABE6A6ADF1D77DF), SPH_C64(0xE431E4E453977353), + SPH_C64(0xE338E3E348A84B48), SPH_C64(0xA3F8A3A315D27115), + SPH_C64(0x56FA565613DC8A13), SPH_C64(0x819E8181BFFD7CBF), + SPH_C64(0x7D877D7D94B2CF94), SPH_C64(0xF10EF1F1122ADB12), + SPH_C64(0x85928585ABD95CAB), SPH_C64(0x9EBF9E9EDC1A84DC), + SPH_C64(0x2C742C2C9C517D9C), SPH_C64(0x8E8F8E8E8C8A048C), + SPH_C64(0x78887878859FE785), SPH_C64(0xCA43CACAC5D41EC5), + SPH_C64(0x173917174BAFB84B), SPH_C64(0xA9E6A9A937882137), + SPH_C64(0x61A36161F84E2FF8), SPH_C64(0xD562D5D5A633E6A6), + SPH_C64(0x5DE75D5D348FD234), SPH_C64(0x0B1D0B0B27535827), + SPH_C64(0x8C898C8C86981486), SPH_C64(0x3C443C3CCCC1FDCC), + SPH_C64(0x77997777B6E89FB6), SPH_C64(0x51F3515108E3B208), + SPH_C64(0x22662222AA2F0DAA), SPH_C64(0x42C6424257682A57), + SPH_C64(0x3F413F3FC3DAE5C3), SPH_C64(0x54FC545419CE9A19), + SPH_C64(0x41C3414158733258), SPH_C64(0x809D8080BAF474BA), + SPH_C64(0xCC49CCCCDBE22EDB), SPH_C64(0x86978686A4C244A4), + SPH_C64(0xB3C8B3B34542F145), SPH_C64(0x1828181878D8C078), + SPH_C64(0x2E722E2E96436D96), SPH_C64(0x57F9575716D58216), + SPH_C64(0x060A06061E36301E), SPH_C64(0x62A66262F75537F7), + SPH_C64(0xF401F4F40307F303), SPH_C64(0x365A3636EE9BADEE), + SPH_C64(0xD16ED1D1B217C6B2), SPH_C64(0x6BBD6B6BDA147FDA), + SPH_C64(0x1B2D1B1B77C3D877), SPH_C64(0x65AF6565EC6A0FEC), + SPH_C64(0x759F7575BCFA8FBC), SPH_C64(0x1030101050908050), + SPH_C64(0xDA73DADA95449E95), SPH_C64(0x49DB4949703B7270), + SPH_C64(0x266A2626BE0B2DBE), SPH_C64(0xF916F9F93A629B3A), + SPH_C64(0xCB40CBCBC0DD16C0), SPH_C64(0x66AA6666E37117E3), + SPH_C64(0xE734E7E75C8C6B5C), SPH_C64(0xBAD3BABA6803B968), + SPH_C64(0xAEEFAEAE2CB7192C), SPH_C64(0x50F050500DEABA0D), + SPH_C64(0x52F6525207F8AA07), SPH_C64(0xABE0ABAB3D9A313D), + SPH_C64(0x050F0505112D2811), SPH_C64(0xF00DF0F01723D317), + SPH_C64(0x0D170D0D39656839), SPH_C64(0x73957373A2CCBFA2), + SPH_C64(0x3B4D3B3BD7FEC5D7), SPH_C64(0x040C040414242014), + SPH_C64(0x20602020A03D1DA0), SPH_C64(0xFE1FFEFE215DA321), + SPH_C64(0xDD7ADDDD8E7BA68E), SPH_C64(0xF502F5F5060EFB06), + SPH_C64(0xB4C1B4B45E7DC95E), SPH_C64(0x5FE15F5F3E9DC23E), + SPH_C64(0x0A1E0A0A225A5022), SPH_C64(0xB5C2B5B55B74C15B), + SPH_C64(0xC05DC0C0E78E4EE7), SPH_C64(0xA0FDA0A01AC9691A), + SPH_C64(0x71937171A8DEAFA8), SPH_C64(0xA5F2A5A50BE4410B), + SPH_C64(0x2D772D2D99587599), SPH_C64(0x60A06060FD4727FD), + SPH_C64(0x72967272A7C5B7A7), SPH_C64(0x93A89393E57FECE5), + SPH_C64(0x394B3939DDECD5DD), SPH_C64(0x0818080828484028), + SPH_C64(0x83988383B5EF6CB5), SPH_C64(0x21632121A53415A5), + SPH_C64(0x5CE45C5C3186DA31), SPH_C64(0x87948787A1CB4CA1), + SPH_C64(0xB1CEB1B14F50E14F), SPH_C64(0xE03DE0E047B35347), + SPH_C64(0x0000000000000000), SPH_C64(0xC358C3C3E89556E8), + SPH_C64(0x123612125A82905A), SPH_C64(0x91AE9191EF6DFCEF), + SPH_C64(0x8A838A8A98AE2498), SPH_C64(0x020602020A12100A), + SPH_C64(0x1C241C1C6CFCE06C), SPH_C64(0xE637E6E659856359), + SPH_C64(0x45CF45454C57124C), SPH_C64(0xC25BC2C2ED9C5EED), + SPH_C64(0xC451C4C4F3AA6EF3), SPH_C64(0xFD1AFDFD2E46BB2E), + SPH_C64(0xBFDCBFBF792E9179), SPH_C64(0x44CC4444495E1A49), + SPH_C64(0xA1FEA1A11FC0611F), SPH_C64(0x4CD44C4C61165A61), + SPH_C64(0x33553333FFB685FF), SPH_C64(0xC552C5C5F6A366F6), + SPH_C64(0x84918484AED054AE), SPH_C64(0x23652323AF2605AF), + SPH_C64(0x7C847C7C91BBC791), SPH_C64(0xB0CDB0B04A59E94A), + SPH_C64(0x256F2525B11035B1), SPH_C64(0x153F151541BDA841), + SPH_C64(0x355F3535E180B5E1), SPH_C64(0x69BB6969D0066FD0), + SPH_C64(0xFF1CFFFF2454AB24), SPH_C64(0x94A19494FE40D4FE), + SPH_C64(0x4DD74D4D641F5264), SPH_C64(0x70907070ADD7A7AD), + SPH_C64(0xA2FBA2A210DB7910), SPH_C64(0xAFECAFAF29BE1129), + SPH_C64(0xCD4ACDCDDEEB26DE), SPH_C64(0xD667D6D6A928FEA9), + SPH_C64(0x6CB46C6CC12B47C1), SPH_C64(0xB7C4B7B75166D151), + SPH_C64(0xF815F8F83F6B933F), SPH_C64(0x091B09092D41482D), + SPH_C64(0xF308F3F31838CB18), SPH_C64(0x67A96767E6781FE6), + SPH_C64(0xA4F1A4A40EED490E), SPH_C64(0xEA23EAEA65E90365), + SPH_C64(0xEC29ECEC7BDF337B), SPH_C64(0xB6C7B6B6546FD954), + SPH_C64(0xD461D4D4A33AEEA3), SPH_C64(0xD26BD2D2BD0CDEBD), + SPH_C64(0x143C141444B4A044), SPH_C64(0x1E221E1E66EEF066), + SPH_C64(0xE13EE1E142BA5B42), SPH_C64(0x246C2424B4193DB4), + SPH_C64(0x38483838D8E5DDD8), SPH_C64(0xC657C6C6F9B87EF9), + SPH_C64(0xDB70DBDB904D9690), SPH_C64(0x4BDD4B4B7A29627A), + SPH_C64(0x7A8E7A7A8F8DF78F), SPH_C64(0x3A4E3A3AD2F7CDD2), + SPH_C64(0xDE7FDEDE8160BE81), SPH_C64(0x5EE25E5E3B94CA3B), + SPH_C64(0xDF7CDFDF8469B684), SPH_C64(0x95A29595FB49DCFB), + SPH_C64(0xFC19FCFC2B4FB32B), SPH_C64(0xAAE3AAAA38933938), + SPH_C64(0xD764D7D7AC21F6AC), SPH_C64(0xCE4FCECED1F03ED1), + SPH_C64(0x070907071B3F381B), SPH_C64(0x0F110F0F33777833), + SPH_C64(0x3D473D3DC9C8F5C9), SPH_C64(0x58E8585825A2FA25), + SPH_C64(0x9AB39A9AC83EA4C8), SPH_C64(0x98B59898C22CB4C2), + SPH_C64(0x9CB99C9CD60894D6), SPH_C64(0xF20BF2F21D31C31D), + SPH_C64(0xA7F4A7A701F65101), SPH_C64(0x1133111155998855), + SPH_C64(0x7E827E7E9BA9D79B), SPH_C64(0x8B808B8B9DA72C9D), + SPH_C64(0x43C5434352612252), SPH_C64(0x030503030F1B180F), + SPH_C64(0xE23BE2E24DA1434D), SPH_C64(0xDC79DCDC8B72AE8B), + SPH_C64(0xE532E5E5569E7B56), SPH_C64(0xB2CBB2B2404BF940), + SPH_C64(0x4ED24E4E6B044A6B), SPH_C64(0xC754C7C7FCB176FC), + SPH_C64(0x6DB76D6DC4224FC4), SPH_C64(0xE926E9E96AF21B6A), + SPH_C64(0x27692727BB0225BB), SPH_C64(0x40C040405D7A3A5D), + SPH_C64(0xD875D8D89F568E9F), SPH_C64(0x37593737EB92A5EB), + SPH_C64(0x92AB9292E076E4E0), SPH_C64(0x8F8C8F8F89830C89), + SPH_C64(0x0103010105090805), SPH_C64(0x1D271D1D69F5E869), + SPH_C64(0x53F5535302F1A202), SPH_C64(0x3E423E3EC6D3EDC6), + SPH_C64(0x59EB595920ABF220), SPH_C64(0xC15EC1C1E28746E2), + SPH_C64(0x4FD14F4F6E0D426E), SPH_C64(0x32563232FABF8DFA), + SPH_C64(0x163A16164EA6B04E), SPH_C64(0xFA13FAFA35798335), + SPH_C64(0x749C7474B9F387B9), SPH_C64(0xFB10FBFB30708B30), + SPH_C64(0x63A56363F25C3FF2), SPH_C64(0x9FBC9F9FD9138CD9), + SPH_C64(0x345C3434E489BDE4), SPH_C64(0x1A2E1A1A72CAD072), + SPH_C64(0x2A7E2A2A82674D82), SPH_C64(0x5AEE5A5A2FB0EA2F), + SPH_C64(0x8D8A8D8D83911C83), SPH_C64(0xC946C9C9CACF06CA), + SPH_C64(0xCF4CCFCFD4F936D4), SPH_C64(0xF607F6F60915E309), + SPH_C64(0x90AD9090EA64F4EA), SPH_C64(0x2878282888755D88), + SPH_C64(0x8885888892BC3492), SPH_C64(0x9BB09B9BCD37ACCD), + SPH_C64(0x31533131F5A495F5), SPH_C64(0x0E120E0E367E7036), + SPH_C64(0xBDDABDBD733C8173), SPH_C64(0x4ADE4A4A7F206A7F), + SPH_C64(0xE825E8E86FFB136F), SPH_C64(0x96A79696F452C4F4), + SPH_C64(0xA6F7A6A604FF5904), SPH_C64(0x0C140C0C3C6C603C), + SPH_C64(0xC845C8C8CFC60ECF), SPH_C64(0x798B79798096EF80), + SPH_C64(0xBCD9BCBC76358976), SPH_C64(0xBEDFBEBE7C27997C), + SPH_C64(0xEF2CEFEF74C42B74), SPH_C64(0x6EB26E6ECB3957CB), + SPH_C64(0x46CA4646434C0A43), SPH_C64(0x97A49797F15BCCF1), + SPH_C64(0x5BED5B5B2AB9E22A), SPH_C64(0xED2AEDED7ED63B7E), + SPH_C64(0x192B19197DD1C87D), SPH_C64(0xD976D9D99A5F869A), + SPH_C64(0xACE9ACAC26A50926), SPH_C64(0x99B69999C725BCC7), + SPH_C64(0xA8E5A8A832812932), SPH_C64(0x297B29298D7C558D), + SPH_C64(0x64AC6464E96307E9), SPH_C64(0x1F211F1F63E7F863), + SPH_C64(0xADEAADAD23AC0123), SPH_C64(0x55FF55551CC7921C), + SPH_C64(0x133513135F8B985F), SPH_C64(0xBBD0BBBB6D0AB16D), + SPH_C64(0xF704F7F70C1CEB0C), SPH_C64(0x6FB16F6FCE305FCE), + SPH_C64(0xB9D6B9B96718A167), SPH_C64(0x47C9474746450246), + SPH_C64(0x2F712F2F934A6593), SPH_C64(0xEE2FEEEE71CD2371), + SPH_C64(0xB8D5B8B86211A962), SPH_C64(0x7B8D7B7B8A84FF8A), + SPH_C64(0x8986898997B53C97), SPH_C64(0x30503030F0AD9DF0), + SPH_C64(0xD368D3D3B805D6B8), SPH_C64(0x7F817F7F9EA0DF9E), + SPH_C64(0x769A7676B3E197B3), SPH_C64(0x829B8282B0E664B0) +}; + +static const sph_u64 old0_T5[256] = { + SPH_C64(0xB86868D50F67D568), SPH_C64(0x6DD0D0B71ECEB7D0), + SPH_C64(0x20EBEB60E00B60EB), SPH_C64(0x7D2B2B876E45872B), + SPH_C64(0xD8484875327A7548), SPH_C64(0xBA9D9DD3019CD39D), + SPH_C64(0xBE6A6ADF1D77DF6A), SPH_C64(0x31E4E453977353E4), + SPH_C64(0x38E3E348A84B48E3), SPH_C64(0xF8A3A315D27115A3), + SPH_C64(0xFA565613DC8A1356), SPH_C64(0x9E8181BFFD7CBF81), + SPH_C64(0x877D7D94B2CF947D), SPH_C64(0x0EF1F1122ADB12F1), + SPH_C64(0x928585ABD95CAB85), SPH_C64(0xBF9E9EDC1A84DC9E), + SPH_C64(0x742C2C9C517D9C2C), SPH_C64(0x8F8E8E8C8A048C8E), + SPH_C64(0x887878859FE78578), SPH_C64(0x43CACAC5D41EC5CA), + SPH_C64(0x3917174BAFB84B17), SPH_C64(0xE6A9A937882137A9), + SPH_C64(0xA36161F84E2FF861), SPH_C64(0x62D5D5A633E6A6D5), + SPH_C64(0xE75D5D348FD2345D), SPH_C64(0x1D0B0B275358270B), + SPH_C64(0x898C8C869814868C), SPH_C64(0x443C3CCCC1FDCC3C), + SPH_C64(0x997777B6E89FB677), SPH_C64(0xF3515108E3B20851), + SPH_C64(0x662222AA2F0DAA22), SPH_C64(0xC6424257682A5742), + SPH_C64(0x413F3FC3DAE5C33F), SPH_C64(0xFC545419CE9A1954), + SPH_C64(0xC341415873325841), SPH_C64(0x9D8080BAF474BA80), + SPH_C64(0x49CCCCDBE22EDBCC), SPH_C64(0x978686A4C244A486), + SPH_C64(0xC8B3B34542F145B3), SPH_C64(0x28181878D8C07818), + SPH_C64(0x722E2E96436D962E), SPH_C64(0xF9575716D5821657), + SPH_C64(0x0A06061E36301E06), SPH_C64(0xA66262F75537F762), + SPH_C64(0x01F4F40307F303F4), SPH_C64(0x5A3636EE9BADEE36), + SPH_C64(0x6ED1D1B217C6B2D1), SPH_C64(0xBD6B6BDA147FDA6B), + SPH_C64(0x2D1B1B77C3D8771B), SPH_C64(0xAF6565EC6A0FEC65), + SPH_C64(0x9F7575BCFA8FBC75), SPH_C64(0x3010105090805010), + SPH_C64(0x73DADA95449E95DA), SPH_C64(0xDB4949703B727049), + SPH_C64(0x6A2626BE0B2DBE26), SPH_C64(0x16F9F93A629B3AF9), + SPH_C64(0x40CBCBC0DD16C0CB), SPH_C64(0xAA6666E37117E366), + SPH_C64(0x34E7E75C8C6B5CE7), SPH_C64(0xD3BABA6803B968BA), + SPH_C64(0xEFAEAE2CB7192CAE), SPH_C64(0xF050500DEABA0D50), + SPH_C64(0xF6525207F8AA0752), SPH_C64(0xE0ABAB3D9A313DAB), + SPH_C64(0x0F0505112D281105), SPH_C64(0x0DF0F01723D317F0), + SPH_C64(0x170D0D396568390D), SPH_C64(0x957373A2CCBFA273), + SPH_C64(0x4D3B3BD7FEC5D73B), SPH_C64(0x0C04041424201404), + SPH_C64(0x602020A03D1DA020), SPH_C64(0x1FFEFE215DA321FE), + SPH_C64(0x7ADDDD8E7BA68EDD), SPH_C64(0x02F5F5060EFB06F5), + SPH_C64(0xC1B4B45E7DC95EB4), SPH_C64(0xE15F5F3E9DC23E5F), + SPH_C64(0x1E0A0A225A50220A), SPH_C64(0xC2B5B55B74C15BB5), + SPH_C64(0x5DC0C0E78E4EE7C0), SPH_C64(0xFDA0A01AC9691AA0), + SPH_C64(0x937171A8DEAFA871), SPH_C64(0xF2A5A50BE4410BA5), + SPH_C64(0x772D2D995875992D), SPH_C64(0xA06060FD4727FD60), + SPH_C64(0x967272A7C5B7A772), SPH_C64(0xA89393E57FECE593), + SPH_C64(0x4B3939DDECD5DD39), SPH_C64(0x1808082848402808), + SPH_C64(0x988383B5EF6CB583), SPH_C64(0x632121A53415A521), + SPH_C64(0xE45C5C3186DA315C), SPH_C64(0x948787A1CB4CA187), + SPH_C64(0xCEB1B14F50E14FB1), SPH_C64(0x3DE0E047B35347E0), + SPH_C64(0x0000000000000000), SPH_C64(0x58C3C3E89556E8C3), + SPH_C64(0x3612125A82905A12), SPH_C64(0xAE9191EF6DFCEF91), + SPH_C64(0x838A8A98AE24988A), SPH_C64(0x0602020A12100A02), + SPH_C64(0x241C1C6CFCE06C1C), SPH_C64(0x37E6E659856359E6), + SPH_C64(0xCF45454C57124C45), SPH_C64(0x5BC2C2ED9C5EEDC2), + SPH_C64(0x51C4C4F3AA6EF3C4), SPH_C64(0x1AFDFD2E46BB2EFD), + SPH_C64(0xDCBFBF792E9179BF), SPH_C64(0xCC4444495E1A4944), + SPH_C64(0xFEA1A11FC0611FA1), SPH_C64(0xD44C4C61165A614C), + SPH_C64(0x553333FFB685FF33), SPH_C64(0x52C5C5F6A366F6C5), + SPH_C64(0x918484AED054AE84), SPH_C64(0x652323AF2605AF23), + SPH_C64(0x847C7C91BBC7917C), SPH_C64(0xCDB0B04A59E94AB0), + SPH_C64(0x6F2525B11035B125), SPH_C64(0x3F151541BDA84115), + SPH_C64(0x5F3535E180B5E135), SPH_C64(0xBB6969D0066FD069), + SPH_C64(0x1CFFFF2454AB24FF), SPH_C64(0xA19494FE40D4FE94), + SPH_C64(0xD74D4D641F52644D), SPH_C64(0x907070ADD7A7AD70), + SPH_C64(0xFBA2A210DB7910A2), SPH_C64(0xECAFAF29BE1129AF), + SPH_C64(0x4ACDCDDEEB26DECD), SPH_C64(0x67D6D6A928FEA9D6), + SPH_C64(0xB46C6CC12B47C16C), SPH_C64(0xC4B7B75166D151B7), + SPH_C64(0x15F8F83F6B933FF8), SPH_C64(0x1B09092D41482D09), + SPH_C64(0x08F3F31838CB18F3), SPH_C64(0xA96767E6781FE667), + SPH_C64(0xF1A4A40EED490EA4), SPH_C64(0x23EAEA65E90365EA), + SPH_C64(0x29ECEC7BDF337BEC), SPH_C64(0xC7B6B6546FD954B6), + SPH_C64(0x61D4D4A33AEEA3D4), SPH_C64(0x6BD2D2BD0CDEBDD2), + SPH_C64(0x3C141444B4A04414), SPH_C64(0x221E1E66EEF0661E), + SPH_C64(0x3EE1E142BA5B42E1), SPH_C64(0x6C2424B4193DB424), + SPH_C64(0x483838D8E5DDD838), SPH_C64(0x57C6C6F9B87EF9C6), + SPH_C64(0x70DBDB904D9690DB), SPH_C64(0xDD4B4B7A29627A4B), + SPH_C64(0x8E7A7A8F8DF78F7A), SPH_C64(0x4E3A3AD2F7CDD23A), + SPH_C64(0x7FDEDE8160BE81DE), SPH_C64(0xE25E5E3B94CA3B5E), + SPH_C64(0x7CDFDF8469B684DF), SPH_C64(0xA29595FB49DCFB95), + SPH_C64(0x19FCFC2B4FB32BFC), SPH_C64(0xE3AAAA38933938AA), + SPH_C64(0x64D7D7AC21F6ACD7), SPH_C64(0x4FCECED1F03ED1CE), + SPH_C64(0x0907071B3F381B07), SPH_C64(0x110F0F337778330F), + SPH_C64(0x473D3DC9C8F5C93D), SPH_C64(0xE8585825A2FA2558), + SPH_C64(0xB39A9AC83EA4C89A), SPH_C64(0xB59898C22CB4C298), + SPH_C64(0xB99C9CD60894D69C), SPH_C64(0x0BF2F21D31C31DF2), + SPH_C64(0xF4A7A701F65101A7), SPH_C64(0x3311115599885511), + SPH_C64(0x827E7E9BA9D79B7E), SPH_C64(0x808B8B9DA72C9D8B), + SPH_C64(0xC543435261225243), SPH_C64(0x0503030F1B180F03), + SPH_C64(0x3BE2E24DA1434DE2), SPH_C64(0x79DCDC8B72AE8BDC), + SPH_C64(0x32E5E5569E7B56E5), SPH_C64(0xCBB2B2404BF940B2), + SPH_C64(0xD24E4E6B044A6B4E), SPH_C64(0x54C7C7FCB176FCC7), + SPH_C64(0xB76D6DC4224FC46D), SPH_C64(0x26E9E96AF21B6AE9), + SPH_C64(0x692727BB0225BB27), SPH_C64(0xC040405D7A3A5D40), + SPH_C64(0x75D8D89F568E9FD8), SPH_C64(0x593737EB92A5EB37), + SPH_C64(0xAB9292E076E4E092), SPH_C64(0x8C8F8F89830C898F), + SPH_C64(0x0301010509080501), SPH_C64(0x271D1D69F5E8691D), + SPH_C64(0xF5535302F1A20253), SPH_C64(0x423E3EC6D3EDC63E), + SPH_C64(0xEB595920ABF22059), SPH_C64(0x5EC1C1E28746E2C1), + SPH_C64(0xD14F4F6E0D426E4F), SPH_C64(0x563232FABF8DFA32), + SPH_C64(0x3A16164EA6B04E16), SPH_C64(0x13FAFA35798335FA), + SPH_C64(0x9C7474B9F387B974), SPH_C64(0x10FBFB30708B30FB), + SPH_C64(0xA56363F25C3FF263), SPH_C64(0xBC9F9FD9138CD99F), + SPH_C64(0x5C3434E489BDE434), SPH_C64(0x2E1A1A72CAD0721A), + SPH_C64(0x7E2A2A82674D822A), SPH_C64(0xEE5A5A2FB0EA2F5A), + SPH_C64(0x8A8D8D83911C838D), SPH_C64(0x46C9C9CACF06CAC9), + SPH_C64(0x4CCFCFD4F936D4CF), SPH_C64(0x07F6F60915E309F6), + SPH_C64(0xAD9090EA64F4EA90), SPH_C64(0x78282888755D8828), + SPH_C64(0x85888892BC349288), SPH_C64(0xB09B9BCD37ACCD9B), + SPH_C64(0x533131F5A495F531), SPH_C64(0x120E0E367E70360E), + SPH_C64(0xDABDBD733C8173BD), SPH_C64(0xDE4A4A7F206A7F4A), + SPH_C64(0x25E8E86FFB136FE8), SPH_C64(0xA79696F452C4F496), + SPH_C64(0xF7A6A604FF5904A6), SPH_C64(0x140C0C3C6C603C0C), + SPH_C64(0x45C8C8CFC60ECFC8), SPH_C64(0x8B79798096EF8079), + SPH_C64(0xD9BCBC76358976BC), SPH_C64(0xDFBEBE7C27997CBE), + SPH_C64(0x2CEFEF74C42B74EF), SPH_C64(0xB26E6ECB3957CB6E), + SPH_C64(0xCA4646434C0A4346), SPH_C64(0xA49797F15BCCF197), + SPH_C64(0xED5B5B2AB9E22A5B), SPH_C64(0x2AEDED7ED63B7EED), + SPH_C64(0x2B19197DD1C87D19), SPH_C64(0x76D9D99A5F869AD9), + SPH_C64(0xE9ACAC26A50926AC), SPH_C64(0xB69999C725BCC799), + SPH_C64(0xE5A8A832812932A8), SPH_C64(0x7B29298D7C558D29), + SPH_C64(0xAC6464E96307E964), SPH_C64(0x211F1F63E7F8631F), + SPH_C64(0xEAADAD23AC0123AD), SPH_C64(0xFF55551CC7921C55), + SPH_C64(0x3513135F8B985F13), SPH_C64(0xD0BBBB6D0AB16DBB), + SPH_C64(0x04F7F70C1CEB0CF7), SPH_C64(0xB16F6FCE305FCE6F), + SPH_C64(0xD6B9B96718A167B9), SPH_C64(0xC947474645024647), + SPH_C64(0x712F2F934A65932F), SPH_C64(0x2FEEEE71CD2371EE), + SPH_C64(0xD5B8B86211A962B8), SPH_C64(0x8D7B7B8A84FF8A7B), + SPH_C64(0x86898997B53C9789), SPH_C64(0x503030F0AD9DF030), + SPH_C64(0x68D3D3B805D6B8D3), SPH_C64(0x817F7F9EA0DF9E7F), + SPH_C64(0x9A7676B3E197B376), SPH_C64(0x9B8282B0E664B082) +}; + +static const sph_u64 old0_T6[256] = { + SPH_C64(0x6868D50F67D568B8), SPH_C64(0xD0D0B71ECEB7D06D), + SPH_C64(0xEBEB60E00B60EB20), SPH_C64(0x2B2B876E45872B7D), + SPH_C64(0x484875327A7548D8), SPH_C64(0x9D9DD3019CD39DBA), + SPH_C64(0x6A6ADF1D77DF6ABE), SPH_C64(0xE4E453977353E431), + SPH_C64(0xE3E348A84B48E338), SPH_C64(0xA3A315D27115A3F8), + SPH_C64(0x565613DC8A1356FA), SPH_C64(0x8181BFFD7CBF819E), + SPH_C64(0x7D7D94B2CF947D87), SPH_C64(0xF1F1122ADB12F10E), + SPH_C64(0x8585ABD95CAB8592), SPH_C64(0x9E9EDC1A84DC9EBF), + SPH_C64(0x2C2C9C517D9C2C74), SPH_C64(0x8E8E8C8A048C8E8F), + SPH_C64(0x7878859FE7857888), SPH_C64(0xCACAC5D41EC5CA43), + SPH_C64(0x17174BAFB84B1739), SPH_C64(0xA9A937882137A9E6), + SPH_C64(0x6161F84E2FF861A3), SPH_C64(0xD5D5A633E6A6D562), + SPH_C64(0x5D5D348FD2345DE7), SPH_C64(0x0B0B275358270B1D), + SPH_C64(0x8C8C869814868C89), SPH_C64(0x3C3CCCC1FDCC3C44), + SPH_C64(0x7777B6E89FB67799), SPH_C64(0x515108E3B20851F3), + SPH_C64(0x2222AA2F0DAA2266), SPH_C64(0x424257682A5742C6), + SPH_C64(0x3F3FC3DAE5C33F41), SPH_C64(0x545419CE9A1954FC), + SPH_C64(0x41415873325841C3), SPH_C64(0x8080BAF474BA809D), + SPH_C64(0xCCCCDBE22EDBCC49), SPH_C64(0x8686A4C244A48697), + SPH_C64(0xB3B34542F145B3C8), SPH_C64(0x181878D8C0781828), + SPH_C64(0x2E2E96436D962E72), SPH_C64(0x575716D5821657F9), + SPH_C64(0x06061E36301E060A), SPH_C64(0x6262F75537F762A6), + SPH_C64(0xF4F40307F303F401), SPH_C64(0x3636EE9BADEE365A), + SPH_C64(0xD1D1B217C6B2D16E), SPH_C64(0x6B6BDA147FDA6BBD), + SPH_C64(0x1B1B77C3D8771B2D), SPH_C64(0x6565EC6A0FEC65AF), + SPH_C64(0x7575BCFA8FBC759F), SPH_C64(0x1010509080501030), + SPH_C64(0xDADA95449E95DA73), SPH_C64(0x4949703B727049DB), + SPH_C64(0x2626BE0B2DBE266A), SPH_C64(0xF9F93A629B3AF916), + SPH_C64(0xCBCBC0DD16C0CB40), SPH_C64(0x6666E37117E366AA), + SPH_C64(0xE7E75C8C6B5CE734), SPH_C64(0xBABA6803B968BAD3), + SPH_C64(0xAEAE2CB7192CAEEF), SPH_C64(0x50500DEABA0D50F0), + SPH_C64(0x525207F8AA0752F6), SPH_C64(0xABAB3D9A313DABE0), + SPH_C64(0x0505112D2811050F), SPH_C64(0xF0F01723D317F00D), + SPH_C64(0x0D0D396568390D17), SPH_C64(0x7373A2CCBFA27395), + SPH_C64(0x3B3BD7FEC5D73B4D), SPH_C64(0x040414242014040C), + SPH_C64(0x2020A03D1DA02060), SPH_C64(0xFEFE215DA321FE1F), + SPH_C64(0xDDDD8E7BA68EDD7A), SPH_C64(0xF5F5060EFB06F502), + SPH_C64(0xB4B45E7DC95EB4C1), SPH_C64(0x5F5F3E9DC23E5FE1), + SPH_C64(0x0A0A225A50220A1E), SPH_C64(0xB5B55B74C15BB5C2), + SPH_C64(0xC0C0E78E4EE7C05D), SPH_C64(0xA0A01AC9691AA0FD), + SPH_C64(0x7171A8DEAFA87193), SPH_C64(0xA5A50BE4410BA5F2), + SPH_C64(0x2D2D995875992D77), SPH_C64(0x6060FD4727FD60A0), + SPH_C64(0x7272A7C5B7A77296), SPH_C64(0x9393E57FECE593A8), + SPH_C64(0x3939DDECD5DD394B), SPH_C64(0x0808284840280818), + SPH_C64(0x8383B5EF6CB58398), SPH_C64(0x2121A53415A52163), + SPH_C64(0x5C5C3186DA315CE4), SPH_C64(0x8787A1CB4CA18794), + SPH_C64(0xB1B14F50E14FB1CE), SPH_C64(0xE0E047B35347E03D), + SPH_C64(0x0000000000000000), SPH_C64(0xC3C3E89556E8C358), + SPH_C64(0x12125A82905A1236), SPH_C64(0x9191EF6DFCEF91AE), + SPH_C64(0x8A8A98AE24988A83), SPH_C64(0x02020A12100A0206), + SPH_C64(0x1C1C6CFCE06C1C24), SPH_C64(0xE6E659856359E637), + SPH_C64(0x45454C57124C45CF), SPH_C64(0xC2C2ED9C5EEDC25B), + SPH_C64(0xC4C4F3AA6EF3C451), SPH_C64(0xFDFD2E46BB2EFD1A), + SPH_C64(0xBFBF792E9179BFDC), SPH_C64(0x4444495E1A4944CC), + SPH_C64(0xA1A11FC0611FA1FE), SPH_C64(0x4C4C61165A614CD4), + SPH_C64(0x3333FFB685FF3355), SPH_C64(0xC5C5F6A366F6C552), + SPH_C64(0x8484AED054AE8491), SPH_C64(0x2323AF2605AF2365), + SPH_C64(0x7C7C91BBC7917C84), SPH_C64(0xB0B04A59E94AB0CD), + SPH_C64(0x2525B11035B1256F), SPH_C64(0x151541BDA841153F), + SPH_C64(0x3535E180B5E1355F), SPH_C64(0x6969D0066FD069BB), + SPH_C64(0xFFFF2454AB24FF1C), SPH_C64(0x9494FE40D4FE94A1), + SPH_C64(0x4D4D641F52644DD7), SPH_C64(0x7070ADD7A7AD7090), + SPH_C64(0xA2A210DB7910A2FB), SPH_C64(0xAFAF29BE1129AFEC), + SPH_C64(0xCDCDDEEB26DECD4A), SPH_C64(0xD6D6A928FEA9D667), + SPH_C64(0x6C6CC12B47C16CB4), SPH_C64(0xB7B75166D151B7C4), + SPH_C64(0xF8F83F6B933FF815), SPH_C64(0x09092D41482D091B), + SPH_C64(0xF3F31838CB18F308), SPH_C64(0x6767E6781FE667A9), + SPH_C64(0xA4A40EED490EA4F1), SPH_C64(0xEAEA65E90365EA23), + SPH_C64(0xECEC7BDF337BEC29), SPH_C64(0xB6B6546FD954B6C7), + SPH_C64(0xD4D4A33AEEA3D461), SPH_C64(0xD2D2BD0CDEBDD26B), + SPH_C64(0x141444B4A044143C), SPH_C64(0x1E1E66EEF0661E22), + SPH_C64(0xE1E142BA5B42E13E), SPH_C64(0x2424B4193DB4246C), + SPH_C64(0x3838D8E5DDD83848), SPH_C64(0xC6C6F9B87EF9C657), + SPH_C64(0xDBDB904D9690DB70), SPH_C64(0x4B4B7A29627A4BDD), + SPH_C64(0x7A7A8F8DF78F7A8E), SPH_C64(0x3A3AD2F7CDD23A4E), + SPH_C64(0xDEDE8160BE81DE7F), SPH_C64(0x5E5E3B94CA3B5EE2), + SPH_C64(0xDFDF8469B684DF7C), SPH_C64(0x9595FB49DCFB95A2), + SPH_C64(0xFCFC2B4FB32BFC19), SPH_C64(0xAAAA38933938AAE3), + SPH_C64(0xD7D7AC21F6ACD764), SPH_C64(0xCECED1F03ED1CE4F), + SPH_C64(0x07071B3F381B0709), SPH_C64(0x0F0F337778330F11), + SPH_C64(0x3D3DC9C8F5C93D47), SPH_C64(0x585825A2FA2558E8), + SPH_C64(0x9A9AC83EA4C89AB3), SPH_C64(0x9898C22CB4C298B5), + SPH_C64(0x9C9CD60894D69CB9), SPH_C64(0xF2F21D31C31DF20B), + SPH_C64(0xA7A701F65101A7F4), SPH_C64(0x1111559988551133), + SPH_C64(0x7E7E9BA9D79B7E82), SPH_C64(0x8B8B9DA72C9D8B80), + SPH_C64(0x43435261225243C5), SPH_C64(0x03030F1B180F0305), + SPH_C64(0xE2E24DA1434DE23B), SPH_C64(0xDCDC8B72AE8BDC79), + SPH_C64(0xE5E5569E7B56E532), SPH_C64(0xB2B2404BF940B2CB), + SPH_C64(0x4E4E6B044A6B4ED2), SPH_C64(0xC7C7FCB176FCC754), + SPH_C64(0x6D6DC4224FC46DB7), SPH_C64(0xE9E96AF21B6AE926), + SPH_C64(0x2727BB0225BB2769), SPH_C64(0x40405D7A3A5D40C0), + SPH_C64(0xD8D89F568E9FD875), SPH_C64(0x3737EB92A5EB3759), + SPH_C64(0x9292E076E4E092AB), SPH_C64(0x8F8F89830C898F8C), + SPH_C64(0x0101050908050103), SPH_C64(0x1D1D69F5E8691D27), + SPH_C64(0x535302F1A20253F5), SPH_C64(0x3E3EC6D3EDC63E42), + SPH_C64(0x595920ABF22059EB), SPH_C64(0xC1C1E28746E2C15E), + SPH_C64(0x4F4F6E0D426E4FD1), SPH_C64(0x3232FABF8DFA3256), + SPH_C64(0x16164EA6B04E163A), SPH_C64(0xFAFA35798335FA13), + SPH_C64(0x7474B9F387B9749C), SPH_C64(0xFBFB30708B30FB10), + SPH_C64(0x6363F25C3FF263A5), SPH_C64(0x9F9FD9138CD99FBC), + SPH_C64(0x3434E489BDE4345C), SPH_C64(0x1A1A72CAD0721A2E), + SPH_C64(0x2A2A82674D822A7E), SPH_C64(0x5A5A2FB0EA2F5AEE), + SPH_C64(0x8D8D83911C838D8A), SPH_C64(0xC9C9CACF06CAC946), + SPH_C64(0xCFCFD4F936D4CF4C), SPH_C64(0xF6F60915E309F607), + SPH_C64(0x9090EA64F4EA90AD), SPH_C64(0x282888755D882878), + SPH_C64(0x888892BC34928885), SPH_C64(0x9B9BCD37ACCD9BB0), + SPH_C64(0x3131F5A495F53153), SPH_C64(0x0E0E367E70360E12), + SPH_C64(0xBDBD733C8173BDDA), SPH_C64(0x4A4A7F206A7F4ADE), + SPH_C64(0xE8E86FFB136FE825), SPH_C64(0x9696F452C4F496A7), + SPH_C64(0xA6A604FF5904A6F7), SPH_C64(0x0C0C3C6C603C0C14), + SPH_C64(0xC8C8CFC60ECFC845), SPH_C64(0x79798096EF80798B), + SPH_C64(0xBCBC76358976BCD9), SPH_C64(0xBEBE7C27997CBEDF), + SPH_C64(0xEFEF74C42B74EF2C), SPH_C64(0x6E6ECB3957CB6EB2), + SPH_C64(0x4646434C0A4346CA), SPH_C64(0x9797F15BCCF197A4), + SPH_C64(0x5B5B2AB9E22A5BED), SPH_C64(0xEDED7ED63B7EED2A), + SPH_C64(0x19197DD1C87D192B), SPH_C64(0xD9D99A5F869AD976), + SPH_C64(0xACAC26A50926ACE9), SPH_C64(0x9999C725BCC799B6), + SPH_C64(0xA8A832812932A8E5), SPH_C64(0x29298D7C558D297B), + SPH_C64(0x6464E96307E964AC), SPH_C64(0x1F1F63E7F8631F21), + SPH_C64(0xADAD23AC0123ADEA), SPH_C64(0x55551CC7921C55FF), + SPH_C64(0x13135F8B985F1335), SPH_C64(0xBBBB6D0AB16DBBD0), + SPH_C64(0xF7F70C1CEB0CF704), SPH_C64(0x6F6FCE305FCE6FB1), + SPH_C64(0xB9B96718A167B9D6), SPH_C64(0x47474645024647C9), + SPH_C64(0x2F2F934A65932F71), SPH_C64(0xEEEE71CD2371EE2F), + SPH_C64(0xB8B86211A962B8D5), SPH_C64(0x7B7B8A84FF8A7B8D), + SPH_C64(0x898997B53C978986), SPH_C64(0x3030F0AD9DF03050), + SPH_C64(0xD3D3B805D6B8D368), SPH_C64(0x7F7F9EA0DF9E7F81), + SPH_C64(0x7676B3E197B3769A), SPH_C64(0x8282B0E664B0829B) +}; + +static const sph_u64 old0_T7[256] = { + SPH_C64(0x68D50F67D568B868), SPH_C64(0xD0B71ECEB7D06DD0), + SPH_C64(0xEB60E00B60EB20EB), SPH_C64(0x2B876E45872B7D2B), + SPH_C64(0x4875327A7548D848), SPH_C64(0x9DD3019CD39DBA9D), + SPH_C64(0x6ADF1D77DF6ABE6A), SPH_C64(0xE453977353E431E4), + SPH_C64(0xE348A84B48E338E3), SPH_C64(0xA315D27115A3F8A3), + SPH_C64(0x5613DC8A1356FA56), SPH_C64(0x81BFFD7CBF819E81), + SPH_C64(0x7D94B2CF947D877D), SPH_C64(0xF1122ADB12F10EF1), + SPH_C64(0x85ABD95CAB859285), SPH_C64(0x9EDC1A84DC9EBF9E), + SPH_C64(0x2C9C517D9C2C742C), SPH_C64(0x8E8C8A048C8E8F8E), + SPH_C64(0x78859FE785788878), SPH_C64(0xCAC5D41EC5CA43CA), + SPH_C64(0x174BAFB84B173917), SPH_C64(0xA937882137A9E6A9), + SPH_C64(0x61F84E2FF861A361), SPH_C64(0xD5A633E6A6D562D5), + SPH_C64(0x5D348FD2345DE75D), SPH_C64(0x0B275358270B1D0B), + SPH_C64(0x8C869814868C898C), SPH_C64(0x3CCCC1FDCC3C443C), + SPH_C64(0x77B6E89FB6779977), SPH_C64(0x5108E3B20851F351), + SPH_C64(0x22AA2F0DAA226622), SPH_C64(0x4257682A5742C642), + SPH_C64(0x3FC3DAE5C33F413F), SPH_C64(0x5419CE9A1954FC54), + SPH_C64(0x415873325841C341), SPH_C64(0x80BAF474BA809D80), + SPH_C64(0xCCDBE22EDBCC49CC), SPH_C64(0x86A4C244A4869786), + SPH_C64(0xB34542F145B3C8B3), SPH_C64(0x1878D8C078182818), + SPH_C64(0x2E96436D962E722E), SPH_C64(0x5716D5821657F957), + SPH_C64(0x061E36301E060A06), SPH_C64(0x62F75537F762A662), + SPH_C64(0xF40307F303F401F4), SPH_C64(0x36EE9BADEE365A36), + SPH_C64(0xD1B217C6B2D16ED1), SPH_C64(0x6BDA147FDA6BBD6B), + SPH_C64(0x1B77C3D8771B2D1B), SPH_C64(0x65EC6A0FEC65AF65), + SPH_C64(0x75BCFA8FBC759F75), SPH_C64(0x1050908050103010), + SPH_C64(0xDA95449E95DA73DA), SPH_C64(0x49703B727049DB49), + SPH_C64(0x26BE0B2DBE266A26), SPH_C64(0xF93A629B3AF916F9), + SPH_C64(0xCBC0DD16C0CB40CB), SPH_C64(0x66E37117E366AA66), + SPH_C64(0xE75C8C6B5CE734E7), SPH_C64(0xBA6803B968BAD3BA), + SPH_C64(0xAE2CB7192CAEEFAE), SPH_C64(0x500DEABA0D50F050), + SPH_C64(0x5207F8AA0752F652), SPH_C64(0xAB3D9A313DABE0AB), + SPH_C64(0x05112D2811050F05), SPH_C64(0xF01723D317F00DF0), + SPH_C64(0x0D396568390D170D), SPH_C64(0x73A2CCBFA2739573), + SPH_C64(0x3BD7FEC5D73B4D3B), SPH_C64(0x0414242014040C04), + SPH_C64(0x20A03D1DA0206020), SPH_C64(0xFE215DA321FE1FFE), + SPH_C64(0xDD8E7BA68EDD7ADD), SPH_C64(0xF5060EFB06F502F5), + SPH_C64(0xB45E7DC95EB4C1B4), SPH_C64(0x5F3E9DC23E5FE15F), + SPH_C64(0x0A225A50220A1E0A), SPH_C64(0xB55B74C15BB5C2B5), + SPH_C64(0xC0E78E4EE7C05DC0), SPH_C64(0xA01AC9691AA0FDA0), + SPH_C64(0x71A8DEAFA8719371), SPH_C64(0xA50BE4410BA5F2A5), + SPH_C64(0x2D995875992D772D), SPH_C64(0x60FD4727FD60A060), + SPH_C64(0x72A7C5B7A7729672), SPH_C64(0x93E57FECE593A893), + SPH_C64(0x39DDECD5DD394B39), SPH_C64(0x0828484028081808), + SPH_C64(0x83B5EF6CB5839883), SPH_C64(0x21A53415A5216321), + SPH_C64(0x5C3186DA315CE45C), SPH_C64(0x87A1CB4CA1879487), + SPH_C64(0xB14F50E14FB1CEB1), SPH_C64(0xE047B35347E03DE0), + SPH_C64(0x0000000000000000), SPH_C64(0xC3E89556E8C358C3), + SPH_C64(0x125A82905A123612), SPH_C64(0x91EF6DFCEF91AE91), + SPH_C64(0x8A98AE24988A838A), SPH_C64(0x020A12100A020602), + SPH_C64(0x1C6CFCE06C1C241C), SPH_C64(0xE659856359E637E6), + SPH_C64(0x454C57124C45CF45), SPH_C64(0xC2ED9C5EEDC25BC2), + SPH_C64(0xC4F3AA6EF3C451C4), SPH_C64(0xFD2E46BB2EFD1AFD), + SPH_C64(0xBF792E9179BFDCBF), SPH_C64(0x44495E1A4944CC44), + SPH_C64(0xA11FC0611FA1FEA1), SPH_C64(0x4C61165A614CD44C), + SPH_C64(0x33FFB685FF335533), SPH_C64(0xC5F6A366F6C552C5), + SPH_C64(0x84AED054AE849184), SPH_C64(0x23AF2605AF236523), + SPH_C64(0x7C91BBC7917C847C), SPH_C64(0xB04A59E94AB0CDB0), + SPH_C64(0x25B11035B1256F25), SPH_C64(0x1541BDA841153F15), + SPH_C64(0x35E180B5E1355F35), SPH_C64(0x69D0066FD069BB69), + SPH_C64(0xFF2454AB24FF1CFF), SPH_C64(0x94FE40D4FE94A194), + SPH_C64(0x4D641F52644DD74D), SPH_C64(0x70ADD7A7AD709070), + SPH_C64(0xA210DB7910A2FBA2), SPH_C64(0xAF29BE1129AFECAF), + SPH_C64(0xCDDEEB26DECD4ACD), SPH_C64(0xD6A928FEA9D667D6), + SPH_C64(0x6CC12B47C16CB46C), SPH_C64(0xB75166D151B7C4B7), + SPH_C64(0xF83F6B933FF815F8), SPH_C64(0x092D41482D091B09), + SPH_C64(0xF31838CB18F308F3), SPH_C64(0x67E6781FE667A967), + SPH_C64(0xA40EED490EA4F1A4), SPH_C64(0xEA65E90365EA23EA), + SPH_C64(0xEC7BDF337BEC29EC), SPH_C64(0xB6546FD954B6C7B6), + SPH_C64(0xD4A33AEEA3D461D4), SPH_C64(0xD2BD0CDEBDD26BD2), + SPH_C64(0x1444B4A044143C14), SPH_C64(0x1E66EEF0661E221E), + SPH_C64(0xE142BA5B42E13EE1), SPH_C64(0x24B4193DB4246C24), + SPH_C64(0x38D8E5DDD8384838), SPH_C64(0xC6F9B87EF9C657C6), + SPH_C64(0xDB904D9690DB70DB), SPH_C64(0x4B7A29627A4BDD4B), + SPH_C64(0x7A8F8DF78F7A8E7A), SPH_C64(0x3AD2F7CDD23A4E3A), + SPH_C64(0xDE8160BE81DE7FDE), SPH_C64(0x5E3B94CA3B5EE25E), + SPH_C64(0xDF8469B684DF7CDF), SPH_C64(0x95FB49DCFB95A295), + SPH_C64(0xFC2B4FB32BFC19FC), SPH_C64(0xAA38933938AAE3AA), + SPH_C64(0xD7AC21F6ACD764D7), SPH_C64(0xCED1F03ED1CE4FCE), + SPH_C64(0x071B3F381B070907), SPH_C64(0x0F337778330F110F), + SPH_C64(0x3DC9C8F5C93D473D), SPH_C64(0x5825A2FA2558E858), + SPH_C64(0x9AC83EA4C89AB39A), SPH_C64(0x98C22CB4C298B598), + SPH_C64(0x9CD60894D69CB99C), SPH_C64(0xF21D31C31DF20BF2), + SPH_C64(0xA701F65101A7F4A7), SPH_C64(0x1155998855113311), + SPH_C64(0x7E9BA9D79B7E827E), SPH_C64(0x8B9DA72C9D8B808B), + SPH_C64(0x435261225243C543), SPH_C64(0x030F1B180F030503), + SPH_C64(0xE24DA1434DE23BE2), SPH_C64(0xDC8B72AE8BDC79DC), + SPH_C64(0xE5569E7B56E532E5), SPH_C64(0xB2404BF940B2CBB2), + SPH_C64(0x4E6B044A6B4ED24E), SPH_C64(0xC7FCB176FCC754C7), + SPH_C64(0x6DC4224FC46DB76D), SPH_C64(0xE96AF21B6AE926E9), + SPH_C64(0x27BB0225BB276927), SPH_C64(0x405D7A3A5D40C040), + SPH_C64(0xD89F568E9FD875D8), SPH_C64(0x37EB92A5EB375937), + SPH_C64(0x92E076E4E092AB92), SPH_C64(0x8F89830C898F8C8F), + SPH_C64(0x0105090805010301), SPH_C64(0x1D69F5E8691D271D), + SPH_C64(0x5302F1A20253F553), SPH_C64(0x3EC6D3EDC63E423E), + SPH_C64(0x5920ABF22059EB59), SPH_C64(0xC1E28746E2C15EC1), + SPH_C64(0x4F6E0D426E4FD14F), SPH_C64(0x32FABF8DFA325632), + SPH_C64(0x164EA6B04E163A16), SPH_C64(0xFA35798335FA13FA), + SPH_C64(0x74B9F387B9749C74), SPH_C64(0xFB30708B30FB10FB), + SPH_C64(0x63F25C3FF263A563), SPH_C64(0x9FD9138CD99FBC9F), + SPH_C64(0x34E489BDE4345C34), SPH_C64(0x1A72CAD0721A2E1A), + SPH_C64(0x2A82674D822A7E2A), SPH_C64(0x5A2FB0EA2F5AEE5A), + SPH_C64(0x8D83911C838D8A8D), SPH_C64(0xC9CACF06CAC946C9), + SPH_C64(0xCFD4F936D4CF4CCF), SPH_C64(0xF60915E309F607F6), + SPH_C64(0x90EA64F4EA90AD90), SPH_C64(0x2888755D88287828), + SPH_C64(0x8892BC3492888588), SPH_C64(0x9BCD37ACCD9BB09B), + SPH_C64(0x31F5A495F5315331), SPH_C64(0x0E367E70360E120E), + SPH_C64(0xBD733C8173BDDABD), SPH_C64(0x4A7F206A7F4ADE4A), + SPH_C64(0xE86FFB136FE825E8), SPH_C64(0x96F452C4F496A796), + SPH_C64(0xA604FF5904A6F7A6), SPH_C64(0x0C3C6C603C0C140C), + SPH_C64(0xC8CFC60ECFC845C8), SPH_C64(0x798096EF80798B79), + SPH_C64(0xBC76358976BCD9BC), SPH_C64(0xBE7C27997CBEDFBE), + SPH_C64(0xEF74C42B74EF2CEF), SPH_C64(0x6ECB3957CB6EB26E), + SPH_C64(0x46434C0A4346CA46), SPH_C64(0x97F15BCCF197A497), + SPH_C64(0x5B2AB9E22A5BED5B), SPH_C64(0xED7ED63B7EED2AED), + SPH_C64(0x197DD1C87D192B19), SPH_C64(0xD99A5F869AD976D9), + SPH_C64(0xAC26A50926ACE9AC), SPH_C64(0x99C725BCC799B699), + SPH_C64(0xA832812932A8E5A8), SPH_C64(0x298D7C558D297B29), + SPH_C64(0x64E96307E964AC64), SPH_C64(0x1F63E7F8631F211F), + SPH_C64(0xAD23AC0123ADEAAD), SPH_C64(0x551CC7921C55FF55), + SPH_C64(0x135F8B985F133513), SPH_C64(0xBB6D0AB16DBBD0BB), + SPH_C64(0xF70C1CEB0CF704F7), SPH_C64(0x6FCE305FCE6FB16F), + SPH_C64(0xB96718A167B9D6B9), SPH_C64(0x474645024647C947), + SPH_C64(0x2F934A65932F712F), SPH_C64(0xEE71CD2371EE2FEE), + SPH_C64(0xB86211A962B8D5B8), SPH_C64(0x7B8A84FF8A7B8D7B), + SPH_C64(0x8997B53C97898689), SPH_C64(0x30F0AD9DF0305030), + SPH_C64(0xD3B805D6B8D368D3), SPH_C64(0x7F9EA0DF9E7F817F), + SPH_C64(0x76B3E197B3769A76), SPH_C64(0x82B0E664B0829B82) +}; + +#endif + +static const sph_u64 old0_RC[10] = { + SPH_C64(0xE46A9D482BEBD068), + SPH_C64(0x9E85F17D8156A3E3), + SPH_C64(0xD561A917CA788E2C), + SPH_C64(0x422251773C8C0B5D), + SPH_C64(0x18B386CC8041543F), + SPH_C64(0x6BD136F46206572E), + SPH_C64(0xF92649DA1075651B), + SPH_C64(0xAB5250AEBAE766CB), + SPH_C64(0xFE20043B730DF005), + SPH_C64(0xA0C0B50A5FB4F5DD) +}; + +/* ====================================================================== */ +/* + * Constants for plain WHIRLPOOL-1 (second version). + */ + +static const sph_u64 old1_T0[256] = { + SPH_C64(0x78D8C07818281818), SPH_C64(0xAF2605AF23652323), + SPH_C64(0xF9B87EF9C657C6C6), SPH_C64(0x6FFB136FE825E8E8), + SPH_C64(0xA1CB4CA187948787), SPH_C64(0x6211A962B8D5B8B8), + SPH_C64(0x0509080501030101), SPH_C64(0x6E0D426E4FD14F4F), + SPH_C64(0xEE9BADEE365A3636), SPH_C64(0x04FF5904A6F7A6A6), + SPH_C64(0xBD0CDEBDD26BD2D2), SPH_C64(0x060EFB06F502F5F5), + SPH_C64(0x8096EF80798B7979), SPH_C64(0xCE305FCE6FB16F6F), + SPH_C64(0xEF6DFCEF91AE9191), SPH_C64(0x07F8AA0752F65252), + SPH_C64(0xFD4727FD60A06060), SPH_C64(0x76358976BCD9BCBC), + SPH_C64(0xCD37ACCD9BB09B9B), SPH_C64(0x8C8A048C8E8F8E8E), + SPH_C64(0x15D27115A3F8A3A3), SPH_C64(0x3C6C603C0C140C0C), + SPH_C64(0x8A84FF8A7B8D7B7B), SPH_C64(0xE180B5E1355F3535), + SPH_C64(0x69F5E8691D271D1D), SPH_C64(0x47B35347E03DE0E0), + SPH_C64(0xAC21F6ACD764D7D7), SPH_C64(0xED9C5EEDC25BC2C2), + SPH_C64(0x96436D962E722E2E), SPH_C64(0x7A29627A4BDD4B4B), + SPH_C64(0x215DA321FE1FFEFE), SPH_C64(0x16D5821657F95757), + SPH_C64(0x41BDA841153F1515), SPH_C64(0xB6E89FB677997777), + SPH_C64(0xEB92A5EB37593737), SPH_C64(0x569E7B56E532E5E5), + SPH_C64(0xD9138CD99FBC9F9F), SPH_C64(0x1723D317F00DF0F0), + SPH_C64(0x7F206A7F4ADE4A4A), SPH_C64(0x95449E95DA73DADA), + SPH_C64(0x25A2FA2558E85858), SPH_C64(0xCACF06CAC946C9C9), + SPH_C64(0x8D7C558D297B2929), SPH_C64(0x225A50220A1E0A0A), + SPH_C64(0x4F50E14FB1CEB1B1), SPH_C64(0x1AC9691AA0FDA0A0), + SPH_C64(0xDA147FDA6BBD6B6B), SPH_C64(0xABD95CAB85928585), + SPH_C64(0x733C8173BDDABDBD), SPH_C64(0x348FD2345DE75D5D), + SPH_C64(0x5090805010301010), SPH_C64(0x0307F303F401F4F4), + SPH_C64(0xC0DD16C0CB40CBCB), SPH_C64(0xC6D3EDC63E423E3E), + SPH_C64(0x112D2811050F0505), SPH_C64(0xE6781FE667A96767), + SPH_C64(0x53977353E431E4E4), SPH_C64(0xBB0225BB27692727), + SPH_C64(0x5873325841C34141), SPH_C64(0x9DA72C9D8B808B8B), + SPH_C64(0x01F65101A7F4A7A7), SPH_C64(0x94B2CF947D877D7D), + SPH_C64(0xFB49DCFB95A29595), SPH_C64(0x9F568E9FD875D8D8), + SPH_C64(0x30708B30FB10FBFB), SPH_C64(0x71CD2371EE2FEEEE), + SPH_C64(0x91BBC7917C847C7C), SPH_C64(0xE37117E366AA6666), + SPH_C64(0x8E7BA68EDD7ADDDD), SPH_C64(0x4BAFB84B17391717), + SPH_C64(0x4645024647C94747), SPH_C64(0xDC1A84DC9EBF9E9E), + SPH_C64(0xC5D41EC5CA43CACA), SPH_C64(0x995875992D772D2D), + SPH_C64(0x792E9179BFDCBFBF), SPH_C64(0x1B3F381B07090707), + SPH_C64(0x23AC0123ADEAADAD), SPH_C64(0x2FB0EA2F5AEE5A5A), + SPH_C64(0xB5EF6CB583988383), SPH_C64(0xFFB685FF33553333), + SPH_C64(0xF25C3FF263A56363), SPH_C64(0x0A12100A02060202), + SPH_C64(0x38933938AAE3AAAA), SPH_C64(0xA8DEAFA871937171), + SPH_C64(0xCFC60ECFC845C8C8), SPH_C64(0x7DD1C87D192B1919), + SPH_C64(0x703B727049DB4949), SPH_C64(0x9A5F869AD976D9D9), + SPH_C64(0x1D31C31DF20BF2F2), SPH_C64(0x48A84B48E338E3E3), + SPH_C64(0x2AB9E22A5BED5B5B), SPH_C64(0x92BC349288858888), + SPH_C64(0xC83EA4C89AB39A9A), SPH_C64(0xBE0B2DBE266A2626), + SPH_C64(0xFABF8DFA32563232), SPH_C64(0x4A59E94AB0CDB0B0), + SPH_C64(0x6AF21B6AE926E9E9), SPH_C64(0x337778330F110F0F), + SPH_C64(0xA633E6A6D562D5D5), SPH_C64(0xBAF474BA809D8080), + SPH_C64(0x7C27997CBEDFBEBE), SPH_C64(0xDEEB26DECD4ACDCD), + SPH_C64(0xE489BDE4345C3434), SPH_C64(0x75327A7548D84848), + SPH_C64(0x2454AB24FF1CFFFF), SPH_C64(0x8F8DF78F7A8E7A7A), + SPH_C64(0xEA64F4EA90AD9090), SPH_C64(0x3E9DC23E5FE15F5F), + SPH_C64(0xA03D1DA020602020), SPH_C64(0xD50F67D568B86868), + SPH_C64(0x72CAD0721A2E1A1A), SPH_C64(0x2CB7192CAEEFAEAE), + SPH_C64(0x5E7DC95EB4C1B4B4), SPH_C64(0x19CE9A1954FC5454), + SPH_C64(0xE57FECE593A89393), SPH_C64(0xAA2F0DAA22662222), + SPH_C64(0xE96307E964AC6464), SPH_C64(0x122ADB12F10EF1F1), + SPH_C64(0xA2CCBFA273957373), SPH_C64(0x5A82905A12361212), + SPH_C64(0x5D7A3A5D40C04040), SPH_C64(0x2848402808180808), + SPH_C64(0xE89556E8C358C3C3), SPH_C64(0x7BDF337BEC29ECEC), + SPH_C64(0x904D9690DB70DBDB), SPH_C64(0x1FC0611FA1FEA1A1), + SPH_C64(0x83911C838D8A8D8D), SPH_C64(0xC9C8F5C93D473D3D), + SPH_C64(0xF15BCCF197A49797), SPH_C64(0x0000000000000000), + SPH_C64(0xD4F936D4CF4CCFCF), SPH_C64(0x876E45872B7D2B2B), + SPH_C64(0xB3E197B3769A7676), SPH_C64(0xB0E664B0829B8282), + SPH_C64(0xA928FEA9D667D6D6), SPH_C64(0x77C3D8771B2D1B1B), + SPH_C64(0x5B74C15BB5C2B5B5), SPH_C64(0x29BE1129AFECAFAF), + SPH_C64(0xDF1D77DF6ABE6A6A), SPH_C64(0x0DEABA0D50F05050), + SPH_C64(0x4C57124C45CF4545), SPH_C64(0x1838CB18F308F3F3), + SPH_C64(0xF0AD9DF030503030), SPH_C64(0x74C42B74EF2CEFEF), + SPH_C64(0xC3DAE5C33F413F3F), SPH_C64(0x1CC7921C55FF5555), + SPH_C64(0x10DB7910A2FBA2A2), SPH_C64(0x65E90365EA23EAEA), + SPH_C64(0xEC6A0FEC65AF6565), SPH_C64(0x6803B968BAD3BABA), + SPH_C64(0x934A65932F712F2F), SPH_C64(0xE78E4EE7C05DC0C0), + SPH_C64(0x8160BE81DE7FDEDE), SPH_C64(0x6CFCE06C1C241C1C), + SPH_C64(0x2E46BB2EFD1AFDFD), SPH_C64(0x641F52644DD74D4D), + SPH_C64(0xE076E4E092AB9292), SPH_C64(0xBCFA8FBC759F7575), + SPH_C64(0x1E36301E060A0606), SPH_C64(0x98AE24988A838A8A), + SPH_C64(0x404BF940B2CBB2B2), SPH_C64(0x59856359E637E6E6), + SPH_C64(0x367E70360E120E0E), SPH_C64(0x63E7F8631F211F1F), + SPH_C64(0xF75537F762A66262), SPH_C64(0xA33AEEA3D461D4D4), + SPH_C64(0x32812932A8E5A8A8), SPH_C64(0xF452C4F496A79696), + SPH_C64(0x3A629B3AF916F9F9), SPH_C64(0xF6A366F6C552C5C5), + SPH_C64(0xB11035B1256F2525), SPH_C64(0x20ABF22059EB5959), + SPH_C64(0xAED054AE84918484), SPH_C64(0xA7C5B7A772967272), + SPH_C64(0xDDECD5DD394B3939), SPH_C64(0x61165A614CD44C4C), + SPH_C64(0x3B94CA3B5EE25E5E), SPH_C64(0x859FE78578887878), + SPH_C64(0xD8E5DDD838483838), SPH_C64(0x869814868C898C8C), + SPH_C64(0xB217C6B2D16ED1D1), SPH_C64(0x0BE4410BA5F2A5A5), + SPH_C64(0x4DA1434DE23BE2E2), SPH_C64(0xF84E2FF861A36161), + SPH_C64(0x4542F145B3C8B3B3), SPH_C64(0xA53415A521632121), + SPH_C64(0xD60894D69CB99C9C), SPH_C64(0x66EEF0661E221E1E), + SPH_C64(0x5261225243C54343), SPH_C64(0xFCB176FCC754C7C7), + SPH_C64(0x2B4FB32BFC19FCFC), SPH_C64(0x14242014040C0404), + SPH_C64(0x08E3B20851F35151), SPH_C64(0xC725BCC799B69999), + SPH_C64(0xC4224FC46DB76D6D), SPH_C64(0x396568390D170D0D), + SPH_C64(0x35798335FA13FAFA), SPH_C64(0x8469B684DF7CDFDF), + SPH_C64(0x9BA9D79B7E827E7E), SPH_C64(0xB4193DB4246C2424), + SPH_C64(0xD7FEC5D73B4D3B3B), SPH_C64(0x3D9A313DABE0ABAB), + SPH_C64(0xD1F03ED1CE4FCECE), SPH_C64(0x5599885511331111), + SPH_C64(0x89830C898F8C8F8F), SPH_C64(0x6B044A6B4ED24E4E), + SPH_C64(0x5166D151B7C4B7B7), SPH_C64(0x60E00B60EB20EBEB), + SPH_C64(0xCCC1FDCC3C443C3C), SPH_C64(0xBFFD7CBF819E8181), + SPH_C64(0xFE40D4FE94A19494), SPH_C64(0x0C1CEB0CF704F7F7), + SPH_C64(0x6718A167B9D6B9B9), SPH_C64(0x5F8B985F13351313), + SPH_C64(0x9C517D9C2C742C2C), SPH_C64(0xB805D6B8D368D3D3), + SPH_C64(0x5C8C6B5CE734E7E7), SPH_C64(0xCB3957CB6EB26E6E), + SPH_C64(0xF3AA6EF3C451C4C4), SPH_C64(0x0F1B180F03050303), + SPH_C64(0x13DC8A1356FA5656), SPH_C64(0x495E1A4944CC4444), + SPH_C64(0x9EA0DF9E7F817F7F), SPH_C64(0x37882137A9E6A9A9), + SPH_C64(0x82674D822A7E2A2A), SPH_C64(0x6D0AB16DBBD0BBBB), + SPH_C64(0xE28746E2C15EC1C1), SPH_C64(0x02F1A20253F55353), + SPH_C64(0x8B72AE8BDC79DCDC), SPH_C64(0x275358270B1D0B0B), + SPH_C64(0xD3019CD39DBA9D9D), SPH_C64(0xC12B47C16CB46C6C), + SPH_C64(0xF5A495F531533131), SPH_C64(0xB9F387B9749C7474), + SPH_C64(0x0915E309F607F6F6), SPH_C64(0x434C0A4346CA4646), + SPH_C64(0x26A50926ACE9ACAC), SPH_C64(0x97B53C9789868989), + SPH_C64(0x44B4A044143C1414), SPH_C64(0x42BA5B42E13EE1E1), + SPH_C64(0x4EA6B04E163A1616), SPH_C64(0xD2F7CDD23A4E3A3A), + SPH_C64(0xD0066FD069BB6969), SPH_C64(0x2D41482D091B0909), + SPH_C64(0xADD7A7AD70907070), SPH_C64(0x546FD954B6C7B6B6), + SPH_C64(0xB71ECEB7D06DD0D0), SPH_C64(0x7ED63B7EED2AEDED), + SPH_C64(0xDBE22EDBCC49CCCC), SPH_C64(0x57682A5742C64242), + SPH_C64(0xC22CB4C298B59898), SPH_C64(0x0EED490EA4F1A4A4), + SPH_C64(0x88755D8828782828), SPH_C64(0x3186DA315CE45C5C), + SPH_C64(0x3F6B933FF815F8F8), SPH_C64(0xA4C244A486978686) +}; + +#if !SPH_SMALL_FOOTPRINT_WHIRLPOOL + +static const sph_u64 old1_T1[256] = { + SPH_C64(0xD8C0781828181878), SPH_C64(0x2605AF23652323AF), + SPH_C64(0xB87EF9C657C6C6F9), SPH_C64(0xFB136FE825E8E86F), + SPH_C64(0xCB4CA187948787A1), SPH_C64(0x11A962B8D5B8B862), + SPH_C64(0x0908050103010105), SPH_C64(0x0D426E4FD14F4F6E), + SPH_C64(0x9BADEE365A3636EE), SPH_C64(0xFF5904A6F7A6A604), + SPH_C64(0x0CDEBDD26BD2D2BD), SPH_C64(0x0EFB06F502F5F506), + SPH_C64(0x96EF80798B797980), SPH_C64(0x305FCE6FB16F6FCE), + SPH_C64(0x6DFCEF91AE9191EF), SPH_C64(0xF8AA0752F6525207), + SPH_C64(0x4727FD60A06060FD), SPH_C64(0x358976BCD9BCBC76), + SPH_C64(0x37ACCD9BB09B9BCD), SPH_C64(0x8A048C8E8F8E8E8C), + SPH_C64(0xD27115A3F8A3A315), SPH_C64(0x6C603C0C140C0C3C), + SPH_C64(0x84FF8A7B8D7B7B8A), SPH_C64(0x80B5E1355F3535E1), + SPH_C64(0xF5E8691D271D1D69), SPH_C64(0xB35347E03DE0E047), + SPH_C64(0x21F6ACD764D7D7AC), SPH_C64(0x9C5EEDC25BC2C2ED), + SPH_C64(0x436D962E722E2E96), SPH_C64(0x29627A4BDD4B4B7A), + SPH_C64(0x5DA321FE1FFEFE21), SPH_C64(0xD5821657F9575716), + SPH_C64(0xBDA841153F151541), SPH_C64(0xE89FB677997777B6), + SPH_C64(0x92A5EB37593737EB), SPH_C64(0x9E7B56E532E5E556), + SPH_C64(0x138CD99FBC9F9FD9), SPH_C64(0x23D317F00DF0F017), + SPH_C64(0x206A7F4ADE4A4A7F), SPH_C64(0x449E95DA73DADA95), + SPH_C64(0xA2FA2558E8585825), SPH_C64(0xCF06CAC946C9C9CA), + SPH_C64(0x7C558D297B29298D), SPH_C64(0x5A50220A1E0A0A22), + SPH_C64(0x50E14FB1CEB1B14F), SPH_C64(0xC9691AA0FDA0A01A), + SPH_C64(0x147FDA6BBD6B6BDA), SPH_C64(0xD95CAB85928585AB), + SPH_C64(0x3C8173BDDABDBD73), SPH_C64(0x8FD2345DE75D5D34), + SPH_C64(0x9080501030101050), SPH_C64(0x07F303F401F4F403), + SPH_C64(0xDD16C0CB40CBCBC0), SPH_C64(0xD3EDC63E423E3EC6), + SPH_C64(0x2D2811050F050511), SPH_C64(0x781FE667A96767E6), + SPH_C64(0x977353E431E4E453), SPH_C64(0x0225BB27692727BB), + SPH_C64(0x73325841C3414158), SPH_C64(0xA72C9D8B808B8B9D), + SPH_C64(0xF65101A7F4A7A701), SPH_C64(0xB2CF947D877D7D94), + SPH_C64(0x49DCFB95A29595FB), SPH_C64(0x568E9FD875D8D89F), + SPH_C64(0x708B30FB10FBFB30), SPH_C64(0xCD2371EE2FEEEE71), + SPH_C64(0xBBC7917C847C7C91), SPH_C64(0x7117E366AA6666E3), + SPH_C64(0x7BA68EDD7ADDDD8E), SPH_C64(0xAFB84B173917174B), + SPH_C64(0x45024647C9474746), SPH_C64(0x1A84DC9EBF9E9EDC), + SPH_C64(0xD41EC5CA43CACAC5), SPH_C64(0x5875992D772D2D99), + SPH_C64(0x2E9179BFDCBFBF79), SPH_C64(0x3F381B070907071B), + SPH_C64(0xAC0123ADEAADAD23), SPH_C64(0xB0EA2F5AEE5A5A2F), + SPH_C64(0xEF6CB583988383B5), SPH_C64(0xB685FF33553333FF), + SPH_C64(0x5C3FF263A56363F2), SPH_C64(0x12100A020602020A), + SPH_C64(0x933938AAE3AAAA38), SPH_C64(0xDEAFA871937171A8), + SPH_C64(0xC60ECFC845C8C8CF), SPH_C64(0xD1C87D192B19197D), + SPH_C64(0x3B727049DB494970), SPH_C64(0x5F869AD976D9D99A), + SPH_C64(0x31C31DF20BF2F21D), SPH_C64(0xA84B48E338E3E348), + SPH_C64(0xB9E22A5BED5B5B2A), SPH_C64(0xBC34928885888892), + SPH_C64(0x3EA4C89AB39A9AC8), SPH_C64(0x0B2DBE266A2626BE), + SPH_C64(0xBF8DFA32563232FA), SPH_C64(0x59E94AB0CDB0B04A), + SPH_C64(0xF21B6AE926E9E96A), SPH_C64(0x7778330F110F0F33), + SPH_C64(0x33E6A6D562D5D5A6), SPH_C64(0xF474BA809D8080BA), + SPH_C64(0x27997CBEDFBEBE7C), SPH_C64(0xEB26DECD4ACDCDDE), + SPH_C64(0x89BDE4345C3434E4), SPH_C64(0x327A7548D8484875), + SPH_C64(0x54AB24FF1CFFFF24), SPH_C64(0x8DF78F7A8E7A7A8F), + SPH_C64(0x64F4EA90AD9090EA), SPH_C64(0x9DC23E5FE15F5F3E), + SPH_C64(0x3D1DA020602020A0), SPH_C64(0x0F67D568B86868D5), + SPH_C64(0xCAD0721A2E1A1A72), SPH_C64(0xB7192CAEEFAEAE2C), + SPH_C64(0x7DC95EB4C1B4B45E), SPH_C64(0xCE9A1954FC545419), + SPH_C64(0x7FECE593A89393E5), SPH_C64(0x2F0DAA22662222AA), + SPH_C64(0x6307E964AC6464E9), SPH_C64(0x2ADB12F10EF1F112), + SPH_C64(0xCCBFA273957373A2), SPH_C64(0x82905A123612125A), + SPH_C64(0x7A3A5D40C040405D), SPH_C64(0x4840280818080828), + SPH_C64(0x9556E8C358C3C3E8), SPH_C64(0xDF337BEC29ECEC7B), + SPH_C64(0x4D9690DB70DBDB90), SPH_C64(0xC0611FA1FEA1A11F), + SPH_C64(0x911C838D8A8D8D83), SPH_C64(0xC8F5C93D473D3DC9), + SPH_C64(0x5BCCF197A49797F1), SPH_C64(0x0000000000000000), + SPH_C64(0xF936D4CF4CCFCFD4), SPH_C64(0x6E45872B7D2B2B87), + SPH_C64(0xE197B3769A7676B3), SPH_C64(0xE664B0829B8282B0), + SPH_C64(0x28FEA9D667D6D6A9), SPH_C64(0xC3D8771B2D1B1B77), + SPH_C64(0x74C15BB5C2B5B55B), SPH_C64(0xBE1129AFECAFAF29), + SPH_C64(0x1D77DF6ABE6A6ADF), SPH_C64(0xEABA0D50F050500D), + SPH_C64(0x57124C45CF45454C), SPH_C64(0x38CB18F308F3F318), + SPH_C64(0xAD9DF030503030F0), SPH_C64(0xC42B74EF2CEFEF74), + SPH_C64(0xDAE5C33F413F3FC3), SPH_C64(0xC7921C55FF55551C), + SPH_C64(0xDB7910A2FBA2A210), SPH_C64(0xE90365EA23EAEA65), + SPH_C64(0x6A0FEC65AF6565EC), SPH_C64(0x03B968BAD3BABA68), + SPH_C64(0x4A65932F712F2F93), SPH_C64(0x8E4EE7C05DC0C0E7), + SPH_C64(0x60BE81DE7FDEDE81), SPH_C64(0xFCE06C1C241C1C6C), + SPH_C64(0x46BB2EFD1AFDFD2E), SPH_C64(0x1F52644DD74D4D64), + SPH_C64(0x76E4E092AB9292E0), SPH_C64(0xFA8FBC759F7575BC), + SPH_C64(0x36301E060A06061E), SPH_C64(0xAE24988A838A8A98), + SPH_C64(0x4BF940B2CBB2B240), SPH_C64(0x856359E637E6E659), + SPH_C64(0x7E70360E120E0E36), SPH_C64(0xE7F8631F211F1F63), + SPH_C64(0x5537F762A66262F7), SPH_C64(0x3AEEA3D461D4D4A3), + SPH_C64(0x812932A8E5A8A832), SPH_C64(0x52C4F496A79696F4), + SPH_C64(0x629B3AF916F9F93A), SPH_C64(0xA366F6C552C5C5F6), + SPH_C64(0x1035B1256F2525B1), SPH_C64(0xABF22059EB595920), + SPH_C64(0xD054AE84918484AE), SPH_C64(0xC5B7A772967272A7), + SPH_C64(0xECD5DD394B3939DD), SPH_C64(0x165A614CD44C4C61), + SPH_C64(0x94CA3B5EE25E5E3B), SPH_C64(0x9FE7857888787885), + SPH_C64(0xE5DDD838483838D8), SPH_C64(0x9814868C898C8C86), + SPH_C64(0x17C6B2D16ED1D1B2), SPH_C64(0xE4410BA5F2A5A50B), + SPH_C64(0xA1434DE23BE2E24D), SPH_C64(0x4E2FF861A36161F8), + SPH_C64(0x42F145B3C8B3B345), SPH_C64(0x3415A521632121A5), + SPH_C64(0x0894D69CB99C9CD6), SPH_C64(0xEEF0661E221E1E66), + SPH_C64(0x61225243C5434352), SPH_C64(0xB176FCC754C7C7FC), + SPH_C64(0x4FB32BFC19FCFC2B), SPH_C64(0x242014040C040414), + SPH_C64(0xE3B20851F3515108), SPH_C64(0x25BCC799B69999C7), + SPH_C64(0x224FC46DB76D6DC4), SPH_C64(0x6568390D170D0D39), + SPH_C64(0x798335FA13FAFA35), SPH_C64(0x69B684DF7CDFDF84), + SPH_C64(0xA9D79B7E827E7E9B), SPH_C64(0x193DB4246C2424B4), + SPH_C64(0xFEC5D73B4D3B3BD7), SPH_C64(0x9A313DABE0ABAB3D), + SPH_C64(0xF03ED1CE4FCECED1), SPH_C64(0x9988551133111155), + SPH_C64(0x830C898F8C8F8F89), SPH_C64(0x044A6B4ED24E4E6B), + SPH_C64(0x66D151B7C4B7B751), SPH_C64(0xE00B60EB20EBEB60), + SPH_C64(0xC1FDCC3C443C3CCC), SPH_C64(0xFD7CBF819E8181BF), + SPH_C64(0x40D4FE94A19494FE), SPH_C64(0x1CEB0CF704F7F70C), + SPH_C64(0x18A167B9D6B9B967), SPH_C64(0x8B985F133513135F), + SPH_C64(0x517D9C2C742C2C9C), SPH_C64(0x05D6B8D368D3D3B8), + SPH_C64(0x8C6B5CE734E7E75C), SPH_C64(0x3957CB6EB26E6ECB), + SPH_C64(0xAA6EF3C451C4C4F3), SPH_C64(0x1B180F030503030F), + SPH_C64(0xDC8A1356FA565613), SPH_C64(0x5E1A4944CC444449), + SPH_C64(0xA0DF9E7F817F7F9E), SPH_C64(0x882137A9E6A9A937), + SPH_C64(0x674D822A7E2A2A82), SPH_C64(0x0AB16DBBD0BBBB6D), + SPH_C64(0x8746E2C15EC1C1E2), SPH_C64(0xF1A20253F5535302), + SPH_C64(0x72AE8BDC79DCDC8B), SPH_C64(0x5358270B1D0B0B27), + SPH_C64(0x019CD39DBA9D9DD3), SPH_C64(0x2B47C16CB46C6CC1), + SPH_C64(0xA495F531533131F5), SPH_C64(0xF387B9749C7474B9), + SPH_C64(0x15E309F607F6F609), SPH_C64(0x4C0A4346CA464643), + SPH_C64(0xA50926ACE9ACAC26), SPH_C64(0xB53C978986898997), + SPH_C64(0xB4A044143C141444), SPH_C64(0xBA5B42E13EE1E142), + SPH_C64(0xA6B04E163A16164E), SPH_C64(0xF7CDD23A4E3A3AD2), + SPH_C64(0x066FD069BB6969D0), SPH_C64(0x41482D091B09092D), + SPH_C64(0xD7A7AD70907070AD), SPH_C64(0x6FD954B6C7B6B654), + SPH_C64(0x1ECEB7D06DD0D0B7), SPH_C64(0xD63B7EED2AEDED7E), + SPH_C64(0xE22EDBCC49CCCCDB), SPH_C64(0x682A5742C6424257), + SPH_C64(0x2CB4C298B59898C2), SPH_C64(0xED490EA4F1A4A40E), + SPH_C64(0x755D882878282888), SPH_C64(0x86DA315CE45C5C31), + SPH_C64(0x6B933FF815F8F83F), SPH_C64(0xC244A486978686A4) +}; + +static const sph_u64 old1_T2[256] = { + SPH_C64(0xC0781828181878D8), SPH_C64(0x05AF23652323AF26), + SPH_C64(0x7EF9C657C6C6F9B8), SPH_C64(0x136FE825E8E86FFB), + SPH_C64(0x4CA187948787A1CB), SPH_C64(0xA962B8D5B8B86211), + SPH_C64(0x0805010301010509), SPH_C64(0x426E4FD14F4F6E0D), + SPH_C64(0xADEE365A3636EE9B), SPH_C64(0x5904A6F7A6A604FF), + SPH_C64(0xDEBDD26BD2D2BD0C), SPH_C64(0xFB06F502F5F5060E), + SPH_C64(0xEF80798B79798096), SPH_C64(0x5FCE6FB16F6FCE30), + SPH_C64(0xFCEF91AE9191EF6D), SPH_C64(0xAA0752F6525207F8), + SPH_C64(0x27FD60A06060FD47), SPH_C64(0x8976BCD9BCBC7635), + SPH_C64(0xACCD9BB09B9BCD37), SPH_C64(0x048C8E8F8E8E8C8A), + SPH_C64(0x7115A3F8A3A315D2), SPH_C64(0x603C0C140C0C3C6C), + SPH_C64(0xFF8A7B8D7B7B8A84), SPH_C64(0xB5E1355F3535E180), + SPH_C64(0xE8691D271D1D69F5), SPH_C64(0x5347E03DE0E047B3), + SPH_C64(0xF6ACD764D7D7AC21), SPH_C64(0x5EEDC25BC2C2ED9C), + SPH_C64(0x6D962E722E2E9643), SPH_C64(0x627A4BDD4B4B7A29), + SPH_C64(0xA321FE1FFEFE215D), SPH_C64(0x821657F9575716D5), + SPH_C64(0xA841153F151541BD), SPH_C64(0x9FB677997777B6E8), + SPH_C64(0xA5EB37593737EB92), SPH_C64(0x7B56E532E5E5569E), + SPH_C64(0x8CD99FBC9F9FD913), SPH_C64(0xD317F00DF0F01723), + SPH_C64(0x6A7F4ADE4A4A7F20), SPH_C64(0x9E95DA73DADA9544), + SPH_C64(0xFA2558E8585825A2), SPH_C64(0x06CAC946C9C9CACF), + SPH_C64(0x558D297B29298D7C), SPH_C64(0x50220A1E0A0A225A), + SPH_C64(0xE14FB1CEB1B14F50), SPH_C64(0x691AA0FDA0A01AC9), + SPH_C64(0x7FDA6BBD6B6BDA14), SPH_C64(0x5CAB85928585ABD9), + SPH_C64(0x8173BDDABDBD733C), SPH_C64(0xD2345DE75D5D348F), + SPH_C64(0x8050103010105090), SPH_C64(0xF303F401F4F40307), + SPH_C64(0x16C0CB40CBCBC0DD), SPH_C64(0xEDC63E423E3EC6D3), + SPH_C64(0x2811050F0505112D), SPH_C64(0x1FE667A96767E678), + SPH_C64(0x7353E431E4E45397), SPH_C64(0x25BB27692727BB02), + SPH_C64(0x325841C341415873), SPH_C64(0x2C9D8B808B8B9DA7), + SPH_C64(0x5101A7F4A7A701F6), SPH_C64(0xCF947D877D7D94B2), + SPH_C64(0xDCFB95A29595FB49), SPH_C64(0x8E9FD875D8D89F56), + SPH_C64(0x8B30FB10FBFB3070), SPH_C64(0x2371EE2FEEEE71CD), + SPH_C64(0xC7917C847C7C91BB), SPH_C64(0x17E366AA6666E371), + SPH_C64(0xA68EDD7ADDDD8E7B), SPH_C64(0xB84B173917174BAF), + SPH_C64(0x024647C947474645), SPH_C64(0x84DC9EBF9E9EDC1A), + SPH_C64(0x1EC5CA43CACAC5D4), SPH_C64(0x75992D772D2D9958), + SPH_C64(0x9179BFDCBFBF792E), SPH_C64(0x381B070907071B3F), + SPH_C64(0x0123ADEAADAD23AC), SPH_C64(0xEA2F5AEE5A5A2FB0), + SPH_C64(0x6CB583988383B5EF), SPH_C64(0x85FF33553333FFB6), + SPH_C64(0x3FF263A56363F25C), SPH_C64(0x100A020602020A12), + SPH_C64(0x3938AAE3AAAA3893), SPH_C64(0xAFA871937171A8DE), + SPH_C64(0x0ECFC845C8C8CFC6), SPH_C64(0xC87D192B19197DD1), + SPH_C64(0x727049DB4949703B), SPH_C64(0x869AD976D9D99A5F), + SPH_C64(0xC31DF20BF2F21D31), SPH_C64(0x4B48E338E3E348A8), + SPH_C64(0xE22A5BED5B5B2AB9), SPH_C64(0x34928885888892BC), + SPH_C64(0xA4C89AB39A9AC83E), SPH_C64(0x2DBE266A2626BE0B), + SPH_C64(0x8DFA32563232FABF), SPH_C64(0xE94AB0CDB0B04A59), + SPH_C64(0x1B6AE926E9E96AF2), SPH_C64(0x78330F110F0F3377), + SPH_C64(0xE6A6D562D5D5A633), SPH_C64(0x74BA809D8080BAF4), + SPH_C64(0x997CBEDFBEBE7C27), SPH_C64(0x26DECD4ACDCDDEEB), + SPH_C64(0xBDE4345C3434E489), SPH_C64(0x7A7548D848487532), + SPH_C64(0xAB24FF1CFFFF2454), SPH_C64(0xF78F7A8E7A7A8F8D), + SPH_C64(0xF4EA90AD9090EA64), SPH_C64(0xC23E5FE15F5F3E9D), + SPH_C64(0x1DA020602020A03D), SPH_C64(0x67D568B86868D50F), + SPH_C64(0xD0721A2E1A1A72CA), SPH_C64(0x192CAEEFAEAE2CB7), + SPH_C64(0xC95EB4C1B4B45E7D), SPH_C64(0x9A1954FC545419CE), + SPH_C64(0xECE593A89393E57F), SPH_C64(0x0DAA22662222AA2F), + SPH_C64(0x07E964AC6464E963), SPH_C64(0xDB12F10EF1F1122A), + SPH_C64(0xBFA273957373A2CC), SPH_C64(0x905A123612125A82), + SPH_C64(0x3A5D40C040405D7A), SPH_C64(0x4028081808082848), + SPH_C64(0x56E8C358C3C3E895), SPH_C64(0x337BEC29ECEC7BDF), + SPH_C64(0x9690DB70DBDB904D), SPH_C64(0x611FA1FEA1A11FC0), + SPH_C64(0x1C838D8A8D8D8391), SPH_C64(0xF5C93D473D3DC9C8), + SPH_C64(0xCCF197A49797F15B), SPH_C64(0x0000000000000000), + SPH_C64(0x36D4CF4CCFCFD4F9), SPH_C64(0x45872B7D2B2B876E), + SPH_C64(0x97B3769A7676B3E1), SPH_C64(0x64B0829B8282B0E6), + SPH_C64(0xFEA9D667D6D6A928), SPH_C64(0xD8771B2D1B1B77C3), + SPH_C64(0xC15BB5C2B5B55B74), SPH_C64(0x1129AFECAFAF29BE), + SPH_C64(0x77DF6ABE6A6ADF1D), SPH_C64(0xBA0D50F050500DEA), + SPH_C64(0x124C45CF45454C57), SPH_C64(0xCB18F308F3F31838), + SPH_C64(0x9DF030503030F0AD), SPH_C64(0x2B74EF2CEFEF74C4), + SPH_C64(0xE5C33F413F3FC3DA), SPH_C64(0x921C55FF55551CC7), + SPH_C64(0x7910A2FBA2A210DB), SPH_C64(0x0365EA23EAEA65E9), + SPH_C64(0x0FEC65AF6565EC6A), SPH_C64(0xB968BAD3BABA6803), + SPH_C64(0x65932F712F2F934A), SPH_C64(0x4EE7C05DC0C0E78E), + SPH_C64(0xBE81DE7FDEDE8160), SPH_C64(0xE06C1C241C1C6CFC), + SPH_C64(0xBB2EFD1AFDFD2E46), SPH_C64(0x52644DD74D4D641F), + SPH_C64(0xE4E092AB9292E076), SPH_C64(0x8FBC759F7575BCFA), + SPH_C64(0x301E060A06061E36), SPH_C64(0x24988A838A8A98AE), + SPH_C64(0xF940B2CBB2B2404B), SPH_C64(0x6359E637E6E65985), + SPH_C64(0x70360E120E0E367E), SPH_C64(0xF8631F211F1F63E7), + SPH_C64(0x37F762A66262F755), SPH_C64(0xEEA3D461D4D4A33A), + SPH_C64(0x2932A8E5A8A83281), SPH_C64(0xC4F496A79696F452), + SPH_C64(0x9B3AF916F9F93A62), SPH_C64(0x66F6C552C5C5F6A3), + SPH_C64(0x35B1256F2525B110), SPH_C64(0xF22059EB595920AB), + SPH_C64(0x54AE84918484AED0), SPH_C64(0xB7A772967272A7C5), + SPH_C64(0xD5DD394B3939DDEC), SPH_C64(0x5A614CD44C4C6116), + SPH_C64(0xCA3B5EE25E5E3B94), SPH_C64(0xE78578887878859F), + SPH_C64(0xDDD838483838D8E5), SPH_C64(0x14868C898C8C8698), + SPH_C64(0xC6B2D16ED1D1B217), SPH_C64(0x410BA5F2A5A50BE4), + SPH_C64(0x434DE23BE2E24DA1), SPH_C64(0x2FF861A36161F84E), + SPH_C64(0xF145B3C8B3B34542), SPH_C64(0x15A521632121A534), + SPH_C64(0x94D69CB99C9CD608), SPH_C64(0xF0661E221E1E66EE), + SPH_C64(0x225243C543435261), SPH_C64(0x76FCC754C7C7FCB1), + SPH_C64(0xB32BFC19FCFC2B4F), SPH_C64(0x2014040C04041424), + SPH_C64(0xB20851F3515108E3), SPH_C64(0xBCC799B69999C725), + SPH_C64(0x4FC46DB76D6DC422), SPH_C64(0x68390D170D0D3965), + SPH_C64(0x8335FA13FAFA3579), SPH_C64(0xB684DF7CDFDF8469), + SPH_C64(0xD79B7E827E7E9BA9), SPH_C64(0x3DB4246C2424B419), + SPH_C64(0xC5D73B4D3B3BD7FE), SPH_C64(0x313DABE0ABAB3D9A), + SPH_C64(0x3ED1CE4FCECED1F0), SPH_C64(0x8855113311115599), + SPH_C64(0x0C898F8C8F8F8983), SPH_C64(0x4A6B4ED24E4E6B04), + SPH_C64(0xD151B7C4B7B75166), SPH_C64(0x0B60EB20EBEB60E0), + SPH_C64(0xFDCC3C443C3CCCC1), SPH_C64(0x7CBF819E8181BFFD), + SPH_C64(0xD4FE94A19494FE40), SPH_C64(0xEB0CF704F7F70C1C), + SPH_C64(0xA167B9D6B9B96718), SPH_C64(0x985F133513135F8B), + SPH_C64(0x7D9C2C742C2C9C51), SPH_C64(0xD6B8D368D3D3B805), + SPH_C64(0x6B5CE734E7E75C8C), SPH_C64(0x57CB6EB26E6ECB39), + SPH_C64(0x6EF3C451C4C4F3AA), SPH_C64(0x180F030503030F1B), + SPH_C64(0x8A1356FA565613DC), SPH_C64(0x1A4944CC4444495E), + SPH_C64(0xDF9E7F817F7F9EA0), SPH_C64(0x2137A9E6A9A93788), + SPH_C64(0x4D822A7E2A2A8267), SPH_C64(0xB16DBBD0BBBB6D0A), + SPH_C64(0x46E2C15EC1C1E287), SPH_C64(0xA20253F5535302F1), + SPH_C64(0xAE8BDC79DCDC8B72), SPH_C64(0x58270B1D0B0B2753), + SPH_C64(0x9CD39DBA9D9DD301), SPH_C64(0x47C16CB46C6CC12B), + SPH_C64(0x95F531533131F5A4), SPH_C64(0x87B9749C7474B9F3), + SPH_C64(0xE309F607F6F60915), SPH_C64(0x0A4346CA4646434C), + SPH_C64(0x0926ACE9ACAC26A5), SPH_C64(0x3C978986898997B5), + SPH_C64(0xA044143C141444B4), SPH_C64(0x5B42E13EE1E142BA), + SPH_C64(0xB04E163A16164EA6), SPH_C64(0xCDD23A4E3A3AD2F7), + SPH_C64(0x6FD069BB6969D006), SPH_C64(0x482D091B09092D41), + SPH_C64(0xA7AD70907070ADD7), SPH_C64(0xD954B6C7B6B6546F), + SPH_C64(0xCEB7D06DD0D0B71E), SPH_C64(0x3B7EED2AEDED7ED6), + SPH_C64(0x2EDBCC49CCCCDBE2), SPH_C64(0x2A5742C642425768), + SPH_C64(0xB4C298B59898C22C), SPH_C64(0x490EA4F1A4A40EED), + SPH_C64(0x5D88287828288875), SPH_C64(0xDA315CE45C5C3186), + SPH_C64(0x933FF815F8F83F6B), SPH_C64(0x44A486978686A4C2) +}; + +static const sph_u64 old1_T3[256] = { + SPH_C64(0x781828181878D8C0), SPH_C64(0xAF23652323AF2605), + SPH_C64(0xF9C657C6C6F9B87E), SPH_C64(0x6FE825E8E86FFB13), + SPH_C64(0xA187948787A1CB4C), SPH_C64(0x62B8D5B8B86211A9), + SPH_C64(0x0501030101050908), SPH_C64(0x6E4FD14F4F6E0D42), + SPH_C64(0xEE365A3636EE9BAD), SPH_C64(0x04A6F7A6A604FF59), + SPH_C64(0xBDD26BD2D2BD0CDE), SPH_C64(0x06F502F5F5060EFB), + SPH_C64(0x80798B79798096EF), SPH_C64(0xCE6FB16F6FCE305F), + SPH_C64(0xEF91AE9191EF6DFC), SPH_C64(0x0752F6525207F8AA), + SPH_C64(0xFD60A06060FD4727), SPH_C64(0x76BCD9BCBC763589), + SPH_C64(0xCD9BB09B9BCD37AC), SPH_C64(0x8C8E8F8E8E8C8A04), + SPH_C64(0x15A3F8A3A315D271), SPH_C64(0x3C0C140C0C3C6C60), + SPH_C64(0x8A7B8D7B7B8A84FF), SPH_C64(0xE1355F3535E180B5), + SPH_C64(0x691D271D1D69F5E8), SPH_C64(0x47E03DE0E047B353), + SPH_C64(0xACD764D7D7AC21F6), SPH_C64(0xEDC25BC2C2ED9C5E), + SPH_C64(0x962E722E2E96436D), SPH_C64(0x7A4BDD4B4B7A2962), + SPH_C64(0x21FE1FFEFE215DA3), SPH_C64(0x1657F9575716D582), + SPH_C64(0x41153F151541BDA8), SPH_C64(0xB677997777B6E89F), + SPH_C64(0xEB37593737EB92A5), SPH_C64(0x56E532E5E5569E7B), + SPH_C64(0xD99FBC9F9FD9138C), SPH_C64(0x17F00DF0F01723D3), + SPH_C64(0x7F4ADE4A4A7F206A), SPH_C64(0x95DA73DADA95449E), + SPH_C64(0x2558E8585825A2FA), SPH_C64(0xCAC946C9C9CACF06), + SPH_C64(0x8D297B29298D7C55), SPH_C64(0x220A1E0A0A225A50), + SPH_C64(0x4FB1CEB1B14F50E1), SPH_C64(0x1AA0FDA0A01AC969), + SPH_C64(0xDA6BBD6B6BDA147F), SPH_C64(0xAB85928585ABD95C), + SPH_C64(0x73BDDABDBD733C81), SPH_C64(0x345DE75D5D348FD2), + SPH_C64(0x5010301010509080), SPH_C64(0x03F401F4F40307F3), + SPH_C64(0xC0CB40CBCBC0DD16), SPH_C64(0xC63E423E3EC6D3ED), + SPH_C64(0x11050F0505112D28), SPH_C64(0xE667A96767E6781F), + SPH_C64(0x53E431E4E4539773), SPH_C64(0xBB27692727BB0225), + SPH_C64(0x5841C34141587332), SPH_C64(0x9D8B808B8B9DA72C), + SPH_C64(0x01A7F4A7A701F651), SPH_C64(0x947D877D7D94B2CF), + SPH_C64(0xFB95A29595FB49DC), SPH_C64(0x9FD875D8D89F568E), + SPH_C64(0x30FB10FBFB30708B), SPH_C64(0x71EE2FEEEE71CD23), + SPH_C64(0x917C847C7C91BBC7), SPH_C64(0xE366AA6666E37117), + SPH_C64(0x8EDD7ADDDD8E7BA6), SPH_C64(0x4B173917174BAFB8), + SPH_C64(0x4647C94747464502), SPH_C64(0xDC9EBF9E9EDC1A84), + SPH_C64(0xC5CA43CACAC5D41E), SPH_C64(0x992D772D2D995875), + SPH_C64(0x79BFDCBFBF792E91), SPH_C64(0x1B070907071B3F38), + SPH_C64(0x23ADEAADAD23AC01), SPH_C64(0x2F5AEE5A5A2FB0EA), + SPH_C64(0xB583988383B5EF6C), SPH_C64(0xFF33553333FFB685), + SPH_C64(0xF263A56363F25C3F), SPH_C64(0x0A020602020A1210), + SPH_C64(0x38AAE3AAAA389339), SPH_C64(0xA871937171A8DEAF), + SPH_C64(0xCFC845C8C8CFC60E), SPH_C64(0x7D192B19197DD1C8), + SPH_C64(0x7049DB4949703B72), SPH_C64(0x9AD976D9D99A5F86), + SPH_C64(0x1DF20BF2F21D31C3), SPH_C64(0x48E338E3E348A84B), + SPH_C64(0x2A5BED5B5B2AB9E2), SPH_C64(0x928885888892BC34), + SPH_C64(0xC89AB39A9AC83EA4), SPH_C64(0xBE266A2626BE0B2D), + SPH_C64(0xFA32563232FABF8D), SPH_C64(0x4AB0CDB0B04A59E9), + SPH_C64(0x6AE926E9E96AF21B), SPH_C64(0x330F110F0F337778), + SPH_C64(0xA6D562D5D5A633E6), SPH_C64(0xBA809D8080BAF474), + SPH_C64(0x7CBEDFBEBE7C2799), SPH_C64(0xDECD4ACDCDDEEB26), + SPH_C64(0xE4345C3434E489BD), SPH_C64(0x7548D8484875327A), + SPH_C64(0x24FF1CFFFF2454AB), SPH_C64(0x8F7A8E7A7A8F8DF7), + SPH_C64(0xEA90AD9090EA64F4), SPH_C64(0x3E5FE15F5F3E9DC2), + SPH_C64(0xA020602020A03D1D), SPH_C64(0xD568B86868D50F67), + SPH_C64(0x721A2E1A1A72CAD0), SPH_C64(0x2CAEEFAEAE2CB719), + SPH_C64(0x5EB4C1B4B45E7DC9), SPH_C64(0x1954FC545419CE9A), + SPH_C64(0xE593A89393E57FEC), SPH_C64(0xAA22662222AA2F0D), + SPH_C64(0xE964AC6464E96307), SPH_C64(0x12F10EF1F1122ADB), + SPH_C64(0xA273957373A2CCBF), SPH_C64(0x5A123612125A8290), + SPH_C64(0x5D40C040405D7A3A), SPH_C64(0x2808180808284840), + SPH_C64(0xE8C358C3C3E89556), SPH_C64(0x7BEC29ECEC7BDF33), + SPH_C64(0x90DB70DBDB904D96), SPH_C64(0x1FA1FEA1A11FC061), + SPH_C64(0x838D8A8D8D83911C), SPH_C64(0xC93D473D3DC9C8F5), + SPH_C64(0xF197A49797F15BCC), SPH_C64(0x0000000000000000), + SPH_C64(0xD4CF4CCFCFD4F936), SPH_C64(0x872B7D2B2B876E45), + SPH_C64(0xB3769A7676B3E197), SPH_C64(0xB0829B8282B0E664), + SPH_C64(0xA9D667D6D6A928FE), SPH_C64(0x771B2D1B1B77C3D8), + SPH_C64(0x5BB5C2B5B55B74C1), SPH_C64(0x29AFECAFAF29BE11), + SPH_C64(0xDF6ABE6A6ADF1D77), SPH_C64(0x0D50F050500DEABA), + SPH_C64(0x4C45CF45454C5712), SPH_C64(0x18F308F3F31838CB), + SPH_C64(0xF030503030F0AD9D), SPH_C64(0x74EF2CEFEF74C42B), + SPH_C64(0xC33F413F3FC3DAE5), SPH_C64(0x1C55FF55551CC792), + SPH_C64(0x10A2FBA2A210DB79), SPH_C64(0x65EA23EAEA65E903), + SPH_C64(0xEC65AF6565EC6A0F), SPH_C64(0x68BAD3BABA6803B9), + SPH_C64(0x932F712F2F934A65), SPH_C64(0xE7C05DC0C0E78E4E), + SPH_C64(0x81DE7FDEDE8160BE), SPH_C64(0x6C1C241C1C6CFCE0), + SPH_C64(0x2EFD1AFDFD2E46BB), SPH_C64(0x644DD74D4D641F52), + SPH_C64(0xE092AB9292E076E4), SPH_C64(0xBC759F7575BCFA8F), + SPH_C64(0x1E060A06061E3630), SPH_C64(0x988A838A8A98AE24), + SPH_C64(0x40B2CBB2B2404BF9), SPH_C64(0x59E637E6E6598563), + SPH_C64(0x360E120E0E367E70), SPH_C64(0x631F211F1F63E7F8), + SPH_C64(0xF762A66262F75537), SPH_C64(0xA3D461D4D4A33AEE), + SPH_C64(0x32A8E5A8A8328129), SPH_C64(0xF496A79696F452C4), + SPH_C64(0x3AF916F9F93A629B), SPH_C64(0xF6C552C5C5F6A366), + SPH_C64(0xB1256F2525B11035), SPH_C64(0x2059EB595920ABF2), + SPH_C64(0xAE84918484AED054), SPH_C64(0xA772967272A7C5B7), + SPH_C64(0xDD394B3939DDECD5), SPH_C64(0x614CD44C4C61165A), + SPH_C64(0x3B5EE25E5E3B94CA), SPH_C64(0x8578887878859FE7), + SPH_C64(0xD838483838D8E5DD), SPH_C64(0x868C898C8C869814), + SPH_C64(0xB2D16ED1D1B217C6), SPH_C64(0x0BA5F2A5A50BE441), + SPH_C64(0x4DE23BE2E24DA143), SPH_C64(0xF861A36161F84E2F), + SPH_C64(0x45B3C8B3B34542F1), SPH_C64(0xA521632121A53415), + SPH_C64(0xD69CB99C9CD60894), SPH_C64(0x661E221E1E66EEF0), + SPH_C64(0x5243C54343526122), SPH_C64(0xFCC754C7C7FCB176), + SPH_C64(0x2BFC19FCFC2B4FB3), SPH_C64(0x14040C0404142420), + SPH_C64(0x0851F3515108E3B2), SPH_C64(0xC799B69999C725BC), + SPH_C64(0xC46DB76D6DC4224F), SPH_C64(0x390D170D0D396568), + SPH_C64(0x35FA13FAFA357983), SPH_C64(0x84DF7CDFDF8469B6), + SPH_C64(0x9B7E827E7E9BA9D7), SPH_C64(0xB4246C2424B4193D), + SPH_C64(0xD73B4D3B3BD7FEC5), SPH_C64(0x3DABE0ABAB3D9A31), + SPH_C64(0xD1CE4FCECED1F03E), SPH_C64(0x5511331111559988), + SPH_C64(0x898F8C8F8F89830C), SPH_C64(0x6B4ED24E4E6B044A), + SPH_C64(0x51B7C4B7B75166D1), SPH_C64(0x60EB20EBEB60E00B), + SPH_C64(0xCC3C443C3CCCC1FD), SPH_C64(0xBF819E8181BFFD7C), + SPH_C64(0xFE94A19494FE40D4), SPH_C64(0x0CF704F7F70C1CEB), + SPH_C64(0x67B9D6B9B96718A1), SPH_C64(0x5F133513135F8B98), + SPH_C64(0x9C2C742C2C9C517D), SPH_C64(0xB8D368D3D3B805D6), + SPH_C64(0x5CE734E7E75C8C6B), SPH_C64(0xCB6EB26E6ECB3957), + SPH_C64(0xF3C451C4C4F3AA6E), SPH_C64(0x0F030503030F1B18), + SPH_C64(0x1356FA565613DC8A), SPH_C64(0x4944CC4444495E1A), + SPH_C64(0x9E7F817F7F9EA0DF), SPH_C64(0x37A9E6A9A9378821), + SPH_C64(0x822A7E2A2A82674D), SPH_C64(0x6DBBD0BBBB6D0AB1), + SPH_C64(0xE2C15EC1C1E28746), SPH_C64(0x0253F5535302F1A2), + SPH_C64(0x8BDC79DCDC8B72AE), SPH_C64(0x270B1D0B0B275358), + SPH_C64(0xD39DBA9D9DD3019C), SPH_C64(0xC16CB46C6CC12B47), + SPH_C64(0xF531533131F5A495), SPH_C64(0xB9749C7474B9F387), + SPH_C64(0x09F607F6F60915E3), SPH_C64(0x4346CA4646434C0A), + SPH_C64(0x26ACE9ACAC26A509), SPH_C64(0x978986898997B53C), + SPH_C64(0x44143C141444B4A0), SPH_C64(0x42E13EE1E142BA5B), + SPH_C64(0x4E163A16164EA6B0), SPH_C64(0xD23A4E3A3AD2F7CD), + SPH_C64(0xD069BB6969D0066F), SPH_C64(0x2D091B09092D4148), + SPH_C64(0xAD70907070ADD7A7), SPH_C64(0x54B6C7B6B6546FD9), + SPH_C64(0xB7D06DD0D0B71ECE), SPH_C64(0x7EED2AEDED7ED63B), + SPH_C64(0xDBCC49CCCCDBE22E), SPH_C64(0x5742C6424257682A), + SPH_C64(0xC298B59898C22CB4), SPH_C64(0x0EA4F1A4A40EED49), + SPH_C64(0x882878282888755D), SPH_C64(0x315CE45C5C3186DA), + SPH_C64(0x3FF815F8F83F6B93), SPH_C64(0xA486978686A4C244) +}; + +static const sph_u64 old1_T4[256] = { + SPH_C64(0x1828181878D8C078), SPH_C64(0x23652323AF2605AF), + SPH_C64(0xC657C6C6F9B87EF9), SPH_C64(0xE825E8E86FFB136F), + SPH_C64(0x87948787A1CB4CA1), SPH_C64(0xB8D5B8B86211A962), + SPH_C64(0x0103010105090805), SPH_C64(0x4FD14F4F6E0D426E), + SPH_C64(0x365A3636EE9BADEE), SPH_C64(0xA6F7A6A604FF5904), + SPH_C64(0xD26BD2D2BD0CDEBD), SPH_C64(0xF502F5F5060EFB06), + SPH_C64(0x798B79798096EF80), SPH_C64(0x6FB16F6FCE305FCE), + SPH_C64(0x91AE9191EF6DFCEF), SPH_C64(0x52F6525207F8AA07), + SPH_C64(0x60A06060FD4727FD), SPH_C64(0xBCD9BCBC76358976), + SPH_C64(0x9BB09B9BCD37ACCD), SPH_C64(0x8E8F8E8E8C8A048C), + SPH_C64(0xA3F8A3A315D27115), SPH_C64(0x0C140C0C3C6C603C), + SPH_C64(0x7B8D7B7B8A84FF8A), SPH_C64(0x355F3535E180B5E1), + SPH_C64(0x1D271D1D69F5E869), SPH_C64(0xE03DE0E047B35347), + SPH_C64(0xD764D7D7AC21F6AC), SPH_C64(0xC25BC2C2ED9C5EED), + SPH_C64(0x2E722E2E96436D96), SPH_C64(0x4BDD4B4B7A29627A), + SPH_C64(0xFE1FFEFE215DA321), SPH_C64(0x57F9575716D58216), + SPH_C64(0x153F151541BDA841), SPH_C64(0x77997777B6E89FB6), + SPH_C64(0x37593737EB92A5EB), SPH_C64(0xE532E5E5569E7B56), + SPH_C64(0x9FBC9F9FD9138CD9), SPH_C64(0xF00DF0F01723D317), + SPH_C64(0x4ADE4A4A7F206A7F), SPH_C64(0xDA73DADA95449E95), + SPH_C64(0x58E8585825A2FA25), SPH_C64(0xC946C9C9CACF06CA), + SPH_C64(0x297B29298D7C558D), SPH_C64(0x0A1E0A0A225A5022), + SPH_C64(0xB1CEB1B14F50E14F), SPH_C64(0xA0FDA0A01AC9691A), + SPH_C64(0x6BBD6B6BDA147FDA), SPH_C64(0x85928585ABD95CAB), + SPH_C64(0xBDDABDBD733C8173), SPH_C64(0x5DE75D5D348FD234), + SPH_C64(0x1030101050908050), SPH_C64(0xF401F4F40307F303), + SPH_C64(0xCB40CBCBC0DD16C0), SPH_C64(0x3E423E3EC6D3EDC6), + SPH_C64(0x050F0505112D2811), SPH_C64(0x67A96767E6781FE6), + SPH_C64(0xE431E4E453977353), SPH_C64(0x27692727BB0225BB), + SPH_C64(0x41C3414158733258), SPH_C64(0x8B808B8B9DA72C9D), + SPH_C64(0xA7F4A7A701F65101), SPH_C64(0x7D877D7D94B2CF94), + SPH_C64(0x95A29595FB49DCFB), SPH_C64(0xD875D8D89F568E9F), + SPH_C64(0xFB10FBFB30708B30), SPH_C64(0xEE2FEEEE71CD2371), + SPH_C64(0x7C847C7C91BBC791), SPH_C64(0x66AA6666E37117E3), + SPH_C64(0xDD7ADDDD8E7BA68E), SPH_C64(0x173917174BAFB84B), + SPH_C64(0x47C9474746450246), SPH_C64(0x9EBF9E9EDC1A84DC), + SPH_C64(0xCA43CACAC5D41EC5), SPH_C64(0x2D772D2D99587599), + SPH_C64(0xBFDCBFBF792E9179), SPH_C64(0x070907071B3F381B), + SPH_C64(0xADEAADAD23AC0123), SPH_C64(0x5AEE5A5A2FB0EA2F), + SPH_C64(0x83988383B5EF6CB5), SPH_C64(0x33553333FFB685FF), + SPH_C64(0x63A56363F25C3FF2), SPH_C64(0x020602020A12100A), + SPH_C64(0xAAE3AAAA38933938), SPH_C64(0x71937171A8DEAFA8), + SPH_C64(0xC845C8C8CFC60ECF), SPH_C64(0x192B19197DD1C87D), + SPH_C64(0x49DB4949703B7270), SPH_C64(0xD976D9D99A5F869A), + SPH_C64(0xF20BF2F21D31C31D), SPH_C64(0xE338E3E348A84B48), + SPH_C64(0x5BED5B5B2AB9E22A), SPH_C64(0x8885888892BC3492), + SPH_C64(0x9AB39A9AC83EA4C8), SPH_C64(0x266A2626BE0B2DBE), + SPH_C64(0x32563232FABF8DFA), SPH_C64(0xB0CDB0B04A59E94A), + SPH_C64(0xE926E9E96AF21B6A), SPH_C64(0x0F110F0F33777833), + SPH_C64(0xD562D5D5A633E6A6), SPH_C64(0x809D8080BAF474BA), + SPH_C64(0xBEDFBEBE7C27997C), SPH_C64(0xCD4ACDCDDEEB26DE), + SPH_C64(0x345C3434E489BDE4), SPH_C64(0x48D8484875327A75), + SPH_C64(0xFF1CFFFF2454AB24), SPH_C64(0x7A8E7A7A8F8DF78F), + SPH_C64(0x90AD9090EA64F4EA), SPH_C64(0x5FE15F5F3E9DC23E), + SPH_C64(0x20602020A03D1DA0), SPH_C64(0x68B86868D50F67D5), + SPH_C64(0x1A2E1A1A72CAD072), SPH_C64(0xAEEFAEAE2CB7192C), + SPH_C64(0xB4C1B4B45E7DC95E), SPH_C64(0x54FC545419CE9A19), + SPH_C64(0x93A89393E57FECE5), SPH_C64(0x22662222AA2F0DAA), + SPH_C64(0x64AC6464E96307E9), SPH_C64(0xF10EF1F1122ADB12), + SPH_C64(0x73957373A2CCBFA2), SPH_C64(0x123612125A82905A), + SPH_C64(0x40C040405D7A3A5D), SPH_C64(0x0818080828484028), + SPH_C64(0xC358C3C3E89556E8), SPH_C64(0xEC29ECEC7BDF337B), + SPH_C64(0xDB70DBDB904D9690), SPH_C64(0xA1FEA1A11FC0611F), + SPH_C64(0x8D8A8D8D83911C83), SPH_C64(0x3D473D3DC9C8F5C9), + SPH_C64(0x97A49797F15BCCF1), SPH_C64(0x0000000000000000), + SPH_C64(0xCF4CCFCFD4F936D4), SPH_C64(0x2B7D2B2B876E4587), + SPH_C64(0x769A7676B3E197B3), SPH_C64(0x829B8282B0E664B0), + SPH_C64(0xD667D6D6A928FEA9), SPH_C64(0x1B2D1B1B77C3D877), + SPH_C64(0xB5C2B5B55B74C15B), SPH_C64(0xAFECAFAF29BE1129), + SPH_C64(0x6ABE6A6ADF1D77DF), SPH_C64(0x50F050500DEABA0D), + SPH_C64(0x45CF45454C57124C), SPH_C64(0xF308F3F31838CB18), + SPH_C64(0x30503030F0AD9DF0), SPH_C64(0xEF2CEFEF74C42B74), + SPH_C64(0x3F413F3FC3DAE5C3), SPH_C64(0x55FF55551CC7921C), + SPH_C64(0xA2FBA2A210DB7910), SPH_C64(0xEA23EAEA65E90365), + SPH_C64(0x65AF6565EC6A0FEC), SPH_C64(0xBAD3BABA6803B968), + SPH_C64(0x2F712F2F934A6593), SPH_C64(0xC05DC0C0E78E4EE7), + SPH_C64(0xDE7FDEDE8160BE81), SPH_C64(0x1C241C1C6CFCE06C), + SPH_C64(0xFD1AFDFD2E46BB2E), SPH_C64(0x4DD74D4D641F5264), + SPH_C64(0x92AB9292E076E4E0), SPH_C64(0x759F7575BCFA8FBC), + SPH_C64(0x060A06061E36301E), SPH_C64(0x8A838A8A98AE2498), + SPH_C64(0xB2CBB2B2404BF940), SPH_C64(0xE637E6E659856359), + SPH_C64(0x0E120E0E367E7036), SPH_C64(0x1F211F1F63E7F863), + SPH_C64(0x62A66262F75537F7), SPH_C64(0xD461D4D4A33AEEA3), + SPH_C64(0xA8E5A8A832812932), SPH_C64(0x96A79696F452C4F4), + SPH_C64(0xF916F9F93A629B3A), SPH_C64(0xC552C5C5F6A366F6), + SPH_C64(0x256F2525B11035B1), SPH_C64(0x59EB595920ABF220), + SPH_C64(0x84918484AED054AE), SPH_C64(0x72967272A7C5B7A7), + SPH_C64(0x394B3939DDECD5DD), SPH_C64(0x4CD44C4C61165A61), + SPH_C64(0x5EE25E5E3B94CA3B), SPH_C64(0x78887878859FE785), + SPH_C64(0x38483838D8E5DDD8), SPH_C64(0x8C898C8C86981486), + SPH_C64(0xD16ED1D1B217C6B2), SPH_C64(0xA5F2A5A50BE4410B), + SPH_C64(0xE23BE2E24DA1434D), SPH_C64(0x61A36161F84E2FF8), + SPH_C64(0xB3C8B3B34542F145), SPH_C64(0x21632121A53415A5), + SPH_C64(0x9CB99C9CD60894D6), SPH_C64(0x1E221E1E66EEF066), + SPH_C64(0x43C5434352612252), SPH_C64(0xC754C7C7FCB176FC), + SPH_C64(0xFC19FCFC2B4FB32B), SPH_C64(0x040C040414242014), + SPH_C64(0x51F3515108E3B208), SPH_C64(0x99B69999C725BCC7), + SPH_C64(0x6DB76D6DC4224FC4), SPH_C64(0x0D170D0D39656839), + SPH_C64(0xFA13FAFA35798335), SPH_C64(0xDF7CDFDF8469B684), + SPH_C64(0x7E827E7E9BA9D79B), SPH_C64(0x246C2424B4193DB4), + SPH_C64(0x3B4D3B3BD7FEC5D7), SPH_C64(0xABE0ABAB3D9A313D), + SPH_C64(0xCE4FCECED1F03ED1), SPH_C64(0x1133111155998855), + SPH_C64(0x8F8C8F8F89830C89), SPH_C64(0x4ED24E4E6B044A6B), + SPH_C64(0xB7C4B7B75166D151), SPH_C64(0xEB20EBEB60E00B60), + SPH_C64(0x3C443C3CCCC1FDCC), SPH_C64(0x819E8181BFFD7CBF), + SPH_C64(0x94A19494FE40D4FE), SPH_C64(0xF704F7F70C1CEB0C), + SPH_C64(0xB9D6B9B96718A167), SPH_C64(0x133513135F8B985F), + SPH_C64(0x2C742C2C9C517D9C), SPH_C64(0xD368D3D3B805D6B8), + SPH_C64(0xE734E7E75C8C6B5C), SPH_C64(0x6EB26E6ECB3957CB), + SPH_C64(0xC451C4C4F3AA6EF3), SPH_C64(0x030503030F1B180F), + SPH_C64(0x56FA565613DC8A13), SPH_C64(0x44CC4444495E1A49), + SPH_C64(0x7F817F7F9EA0DF9E), SPH_C64(0xA9E6A9A937882137), + SPH_C64(0x2A7E2A2A82674D82), SPH_C64(0xBBD0BBBB6D0AB16D), + SPH_C64(0xC15EC1C1E28746E2), SPH_C64(0x53F5535302F1A202), + SPH_C64(0xDC79DCDC8B72AE8B), SPH_C64(0x0B1D0B0B27535827), + SPH_C64(0x9DBA9D9DD3019CD3), SPH_C64(0x6CB46C6CC12B47C1), + SPH_C64(0x31533131F5A495F5), SPH_C64(0x749C7474B9F387B9), + SPH_C64(0xF607F6F60915E309), SPH_C64(0x46CA4646434C0A43), + SPH_C64(0xACE9ACAC26A50926), SPH_C64(0x8986898997B53C97), + SPH_C64(0x143C141444B4A044), SPH_C64(0xE13EE1E142BA5B42), + SPH_C64(0x163A16164EA6B04E), SPH_C64(0x3A4E3A3AD2F7CDD2), + SPH_C64(0x69BB6969D0066FD0), SPH_C64(0x091B09092D41482D), + SPH_C64(0x70907070ADD7A7AD), SPH_C64(0xB6C7B6B6546FD954), + SPH_C64(0xD06DD0D0B71ECEB7), SPH_C64(0xED2AEDED7ED63B7E), + SPH_C64(0xCC49CCCCDBE22EDB), SPH_C64(0x42C6424257682A57), + SPH_C64(0x98B59898C22CB4C2), SPH_C64(0xA4F1A4A40EED490E), + SPH_C64(0x2878282888755D88), SPH_C64(0x5CE45C5C3186DA31), + SPH_C64(0xF815F8F83F6B933F), SPH_C64(0x86978686A4C244A4) +}; + +static const sph_u64 old1_T5[256] = { + SPH_C64(0x28181878D8C07818), SPH_C64(0x652323AF2605AF23), + SPH_C64(0x57C6C6F9B87EF9C6), SPH_C64(0x25E8E86FFB136FE8), + SPH_C64(0x948787A1CB4CA187), SPH_C64(0xD5B8B86211A962B8), + SPH_C64(0x0301010509080501), SPH_C64(0xD14F4F6E0D426E4F), + SPH_C64(0x5A3636EE9BADEE36), SPH_C64(0xF7A6A604FF5904A6), + SPH_C64(0x6BD2D2BD0CDEBDD2), SPH_C64(0x02F5F5060EFB06F5), + SPH_C64(0x8B79798096EF8079), SPH_C64(0xB16F6FCE305FCE6F), + SPH_C64(0xAE9191EF6DFCEF91), SPH_C64(0xF6525207F8AA0752), + SPH_C64(0xA06060FD4727FD60), SPH_C64(0xD9BCBC76358976BC), + SPH_C64(0xB09B9BCD37ACCD9B), SPH_C64(0x8F8E8E8C8A048C8E), + SPH_C64(0xF8A3A315D27115A3), SPH_C64(0x140C0C3C6C603C0C), + SPH_C64(0x8D7B7B8A84FF8A7B), SPH_C64(0x5F3535E180B5E135), + SPH_C64(0x271D1D69F5E8691D), SPH_C64(0x3DE0E047B35347E0), + SPH_C64(0x64D7D7AC21F6ACD7), SPH_C64(0x5BC2C2ED9C5EEDC2), + SPH_C64(0x722E2E96436D962E), SPH_C64(0xDD4B4B7A29627A4B), + SPH_C64(0x1FFEFE215DA321FE), SPH_C64(0xF9575716D5821657), + SPH_C64(0x3F151541BDA84115), SPH_C64(0x997777B6E89FB677), + SPH_C64(0x593737EB92A5EB37), SPH_C64(0x32E5E5569E7B56E5), + SPH_C64(0xBC9F9FD9138CD99F), SPH_C64(0x0DF0F01723D317F0), + SPH_C64(0xDE4A4A7F206A7F4A), SPH_C64(0x73DADA95449E95DA), + SPH_C64(0xE8585825A2FA2558), SPH_C64(0x46C9C9CACF06CAC9), + SPH_C64(0x7B29298D7C558D29), SPH_C64(0x1E0A0A225A50220A), + SPH_C64(0xCEB1B14F50E14FB1), SPH_C64(0xFDA0A01AC9691AA0), + SPH_C64(0xBD6B6BDA147FDA6B), SPH_C64(0x928585ABD95CAB85), + SPH_C64(0xDABDBD733C8173BD), SPH_C64(0xE75D5D348FD2345D), + SPH_C64(0x3010105090805010), SPH_C64(0x01F4F40307F303F4), + SPH_C64(0x40CBCBC0DD16C0CB), SPH_C64(0x423E3EC6D3EDC63E), + SPH_C64(0x0F0505112D281105), SPH_C64(0xA96767E6781FE667), + SPH_C64(0x31E4E453977353E4), SPH_C64(0x692727BB0225BB27), + SPH_C64(0xC341415873325841), SPH_C64(0x808B8B9DA72C9D8B), + SPH_C64(0xF4A7A701F65101A7), SPH_C64(0x877D7D94B2CF947D), + SPH_C64(0xA29595FB49DCFB95), SPH_C64(0x75D8D89F568E9FD8), + SPH_C64(0x10FBFB30708B30FB), SPH_C64(0x2FEEEE71CD2371EE), + SPH_C64(0x847C7C91BBC7917C), SPH_C64(0xAA6666E37117E366), + SPH_C64(0x7ADDDD8E7BA68EDD), SPH_C64(0x3917174BAFB84B17), + SPH_C64(0xC947474645024647), SPH_C64(0xBF9E9EDC1A84DC9E), + SPH_C64(0x43CACAC5D41EC5CA), SPH_C64(0x772D2D995875992D), + SPH_C64(0xDCBFBF792E9179BF), SPH_C64(0x0907071B3F381B07), + SPH_C64(0xEAADAD23AC0123AD), SPH_C64(0xEE5A5A2FB0EA2F5A), + SPH_C64(0x988383B5EF6CB583), SPH_C64(0x553333FFB685FF33), + SPH_C64(0xA56363F25C3FF263), SPH_C64(0x0602020A12100A02), + SPH_C64(0xE3AAAA38933938AA), SPH_C64(0x937171A8DEAFA871), + SPH_C64(0x45C8C8CFC60ECFC8), SPH_C64(0x2B19197DD1C87D19), + SPH_C64(0xDB4949703B727049), SPH_C64(0x76D9D99A5F869AD9), + SPH_C64(0x0BF2F21D31C31DF2), SPH_C64(0x38E3E348A84B48E3), + SPH_C64(0xED5B5B2AB9E22A5B), SPH_C64(0x85888892BC349288), + SPH_C64(0xB39A9AC83EA4C89A), SPH_C64(0x6A2626BE0B2DBE26), + SPH_C64(0x563232FABF8DFA32), SPH_C64(0xCDB0B04A59E94AB0), + SPH_C64(0x26E9E96AF21B6AE9), SPH_C64(0x110F0F337778330F), + SPH_C64(0x62D5D5A633E6A6D5), SPH_C64(0x9D8080BAF474BA80), + SPH_C64(0xDFBEBE7C27997CBE), SPH_C64(0x4ACDCDDEEB26DECD), + SPH_C64(0x5C3434E489BDE434), SPH_C64(0xD8484875327A7548), + SPH_C64(0x1CFFFF2454AB24FF), SPH_C64(0x8E7A7A8F8DF78F7A), + SPH_C64(0xAD9090EA64F4EA90), SPH_C64(0xE15F5F3E9DC23E5F), + SPH_C64(0x602020A03D1DA020), SPH_C64(0xB86868D50F67D568), + SPH_C64(0x2E1A1A72CAD0721A), SPH_C64(0xEFAEAE2CB7192CAE), + SPH_C64(0xC1B4B45E7DC95EB4), SPH_C64(0xFC545419CE9A1954), + SPH_C64(0xA89393E57FECE593), SPH_C64(0x662222AA2F0DAA22), + SPH_C64(0xAC6464E96307E964), SPH_C64(0x0EF1F1122ADB12F1), + SPH_C64(0x957373A2CCBFA273), SPH_C64(0x3612125A82905A12), + SPH_C64(0xC040405D7A3A5D40), SPH_C64(0x1808082848402808), + SPH_C64(0x58C3C3E89556E8C3), SPH_C64(0x29ECEC7BDF337BEC), + SPH_C64(0x70DBDB904D9690DB), SPH_C64(0xFEA1A11FC0611FA1), + SPH_C64(0x8A8D8D83911C838D), SPH_C64(0x473D3DC9C8F5C93D), + SPH_C64(0xA49797F15BCCF197), SPH_C64(0x0000000000000000), + SPH_C64(0x4CCFCFD4F936D4CF), SPH_C64(0x7D2B2B876E45872B), + SPH_C64(0x9A7676B3E197B376), SPH_C64(0x9B8282B0E664B082), + SPH_C64(0x67D6D6A928FEA9D6), SPH_C64(0x2D1B1B77C3D8771B), + SPH_C64(0xC2B5B55B74C15BB5), SPH_C64(0xECAFAF29BE1129AF), + SPH_C64(0xBE6A6ADF1D77DF6A), SPH_C64(0xF050500DEABA0D50), + SPH_C64(0xCF45454C57124C45), SPH_C64(0x08F3F31838CB18F3), + SPH_C64(0x503030F0AD9DF030), SPH_C64(0x2CEFEF74C42B74EF), + SPH_C64(0x413F3FC3DAE5C33F), SPH_C64(0xFF55551CC7921C55), + SPH_C64(0xFBA2A210DB7910A2), SPH_C64(0x23EAEA65E90365EA), + SPH_C64(0xAF6565EC6A0FEC65), SPH_C64(0xD3BABA6803B968BA), + SPH_C64(0x712F2F934A65932F), SPH_C64(0x5DC0C0E78E4EE7C0), + SPH_C64(0x7FDEDE8160BE81DE), SPH_C64(0x241C1C6CFCE06C1C), + SPH_C64(0x1AFDFD2E46BB2EFD), SPH_C64(0xD74D4D641F52644D), + SPH_C64(0xAB9292E076E4E092), SPH_C64(0x9F7575BCFA8FBC75), + SPH_C64(0x0A06061E36301E06), SPH_C64(0x838A8A98AE24988A), + SPH_C64(0xCBB2B2404BF940B2), SPH_C64(0x37E6E659856359E6), + SPH_C64(0x120E0E367E70360E), SPH_C64(0x211F1F63E7F8631F), + SPH_C64(0xA66262F75537F762), SPH_C64(0x61D4D4A33AEEA3D4), + SPH_C64(0xE5A8A832812932A8), SPH_C64(0xA79696F452C4F496), + SPH_C64(0x16F9F93A629B3AF9), SPH_C64(0x52C5C5F6A366F6C5), + SPH_C64(0x6F2525B11035B125), SPH_C64(0xEB595920ABF22059), + SPH_C64(0x918484AED054AE84), SPH_C64(0x967272A7C5B7A772), + SPH_C64(0x4B3939DDECD5DD39), SPH_C64(0xD44C4C61165A614C), + SPH_C64(0xE25E5E3B94CA3B5E), SPH_C64(0x887878859FE78578), + SPH_C64(0x483838D8E5DDD838), SPH_C64(0x898C8C869814868C), + SPH_C64(0x6ED1D1B217C6B2D1), SPH_C64(0xF2A5A50BE4410BA5), + SPH_C64(0x3BE2E24DA1434DE2), SPH_C64(0xA36161F84E2FF861), + SPH_C64(0xC8B3B34542F145B3), SPH_C64(0x632121A53415A521), + SPH_C64(0xB99C9CD60894D69C), SPH_C64(0x221E1E66EEF0661E), + SPH_C64(0xC543435261225243), SPH_C64(0x54C7C7FCB176FCC7), + SPH_C64(0x19FCFC2B4FB32BFC), SPH_C64(0x0C04041424201404), + SPH_C64(0xF3515108E3B20851), SPH_C64(0xB69999C725BCC799), + SPH_C64(0xB76D6DC4224FC46D), SPH_C64(0x170D0D396568390D), + SPH_C64(0x13FAFA35798335FA), SPH_C64(0x7CDFDF8469B684DF), + SPH_C64(0x827E7E9BA9D79B7E), SPH_C64(0x6C2424B4193DB424), + SPH_C64(0x4D3B3BD7FEC5D73B), SPH_C64(0xE0ABAB3D9A313DAB), + SPH_C64(0x4FCECED1F03ED1CE), SPH_C64(0x3311115599885511), + SPH_C64(0x8C8F8F89830C898F), SPH_C64(0xD24E4E6B044A6B4E), + SPH_C64(0xC4B7B75166D151B7), SPH_C64(0x20EBEB60E00B60EB), + SPH_C64(0x443C3CCCC1FDCC3C), SPH_C64(0x9E8181BFFD7CBF81), + SPH_C64(0xA19494FE40D4FE94), SPH_C64(0x04F7F70C1CEB0CF7), + SPH_C64(0xD6B9B96718A167B9), SPH_C64(0x3513135F8B985F13), + SPH_C64(0x742C2C9C517D9C2C), SPH_C64(0x68D3D3B805D6B8D3), + SPH_C64(0x34E7E75C8C6B5CE7), SPH_C64(0xB26E6ECB3957CB6E), + SPH_C64(0x51C4C4F3AA6EF3C4), SPH_C64(0x0503030F1B180F03), + SPH_C64(0xFA565613DC8A1356), SPH_C64(0xCC4444495E1A4944), + SPH_C64(0x817F7F9EA0DF9E7F), SPH_C64(0xE6A9A937882137A9), + SPH_C64(0x7E2A2A82674D822A), SPH_C64(0xD0BBBB6D0AB16DBB), + SPH_C64(0x5EC1C1E28746E2C1), SPH_C64(0xF5535302F1A20253), + SPH_C64(0x79DCDC8B72AE8BDC), SPH_C64(0x1D0B0B275358270B), + SPH_C64(0xBA9D9DD3019CD39D), SPH_C64(0xB46C6CC12B47C16C), + SPH_C64(0x533131F5A495F531), SPH_C64(0x9C7474B9F387B974), + SPH_C64(0x07F6F60915E309F6), SPH_C64(0xCA4646434C0A4346), + SPH_C64(0xE9ACAC26A50926AC), SPH_C64(0x86898997B53C9789), + SPH_C64(0x3C141444B4A04414), SPH_C64(0x3EE1E142BA5B42E1), + SPH_C64(0x3A16164EA6B04E16), SPH_C64(0x4E3A3AD2F7CDD23A), + SPH_C64(0xBB6969D0066FD069), SPH_C64(0x1B09092D41482D09), + SPH_C64(0x907070ADD7A7AD70), SPH_C64(0xC7B6B6546FD954B6), + SPH_C64(0x6DD0D0B71ECEB7D0), SPH_C64(0x2AEDED7ED63B7EED), + SPH_C64(0x49CCCCDBE22EDBCC), SPH_C64(0xC6424257682A5742), + SPH_C64(0xB59898C22CB4C298), SPH_C64(0xF1A4A40EED490EA4), + SPH_C64(0x78282888755D8828), SPH_C64(0xE45C5C3186DA315C), + SPH_C64(0x15F8F83F6B933FF8), SPH_C64(0x978686A4C244A486) +}; + +static const sph_u64 old1_T6[256] = { + SPH_C64(0x181878D8C0781828), SPH_C64(0x2323AF2605AF2365), + SPH_C64(0xC6C6F9B87EF9C657), SPH_C64(0xE8E86FFB136FE825), + SPH_C64(0x8787A1CB4CA18794), SPH_C64(0xB8B86211A962B8D5), + SPH_C64(0x0101050908050103), SPH_C64(0x4F4F6E0D426E4FD1), + SPH_C64(0x3636EE9BADEE365A), SPH_C64(0xA6A604FF5904A6F7), + SPH_C64(0xD2D2BD0CDEBDD26B), SPH_C64(0xF5F5060EFB06F502), + SPH_C64(0x79798096EF80798B), SPH_C64(0x6F6FCE305FCE6FB1), + SPH_C64(0x9191EF6DFCEF91AE), SPH_C64(0x525207F8AA0752F6), + SPH_C64(0x6060FD4727FD60A0), SPH_C64(0xBCBC76358976BCD9), + SPH_C64(0x9B9BCD37ACCD9BB0), SPH_C64(0x8E8E8C8A048C8E8F), + SPH_C64(0xA3A315D27115A3F8), SPH_C64(0x0C0C3C6C603C0C14), + SPH_C64(0x7B7B8A84FF8A7B8D), SPH_C64(0x3535E180B5E1355F), + SPH_C64(0x1D1D69F5E8691D27), SPH_C64(0xE0E047B35347E03D), + SPH_C64(0xD7D7AC21F6ACD764), SPH_C64(0xC2C2ED9C5EEDC25B), + SPH_C64(0x2E2E96436D962E72), SPH_C64(0x4B4B7A29627A4BDD), + SPH_C64(0xFEFE215DA321FE1F), SPH_C64(0x575716D5821657F9), + SPH_C64(0x151541BDA841153F), SPH_C64(0x7777B6E89FB67799), + SPH_C64(0x3737EB92A5EB3759), SPH_C64(0xE5E5569E7B56E532), + SPH_C64(0x9F9FD9138CD99FBC), SPH_C64(0xF0F01723D317F00D), + SPH_C64(0x4A4A7F206A7F4ADE), SPH_C64(0xDADA95449E95DA73), + SPH_C64(0x585825A2FA2558E8), SPH_C64(0xC9C9CACF06CAC946), + SPH_C64(0x29298D7C558D297B), SPH_C64(0x0A0A225A50220A1E), + SPH_C64(0xB1B14F50E14FB1CE), SPH_C64(0xA0A01AC9691AA0FD), + SPH_C64(0x6B6BDA147FDA6BBD), SPH_C64(0x8585ABD95CAB8592), + SPH_C64(0xBDBD733C8173BDDA), SPH_C64(0x5D5D348FD2345DE7), + SPH_C64(0x1010509080501030), SPH_C64(0xF4F40307F303F401), + SPH_C64(0xCBCBC0DD16C0CB40), SPH_C64(0x3E3EC6D3EDC63E42), + SPH_C64(0x0505112D2811050F), SPH_C64(0x6767E6781FE667A9), + SPH_C64(0xE4E453977353E431), SPH_C64(0x2727BB0225BB2769), + SPH_C64(0x41415873325841C3), SPH_C64(0x8B8B9DA72C9D8B80), + SPH_C64(0xA7A701F65101A7F4), SPH_C64(0x7D7D94B2CF947D87), + SPH_C64(0x9595FB49DCFB95A2), SPH_C64(0xD8D89F568E9FD875), + SPH_C64(0xFBFB30708B30FB10), SPH_C64(0xEEEE71CD2371EE2F), + SPH_C64(0x7C7C91BBC7917C84), SPH_C64(0x6666E37117E366AA), + SPH_C64(0xDDDD8E7BA68EDD7A), SPH_C64(0x17174BAFB84B1739), + SPH_C64(0x47474645024647C9), SPH_C64(0x9E9EDC1A84DC9EBF), + SPH_C64(0xCACAC5D41EC5CA43), SPH_C64(0x2D2D995875992D77), + SPH_C64(0xBFBF792E9179BFDC), SPH_C64(0x07071B3F381B0709), + SPH_C64(0xADAD23AC0123ADEA), SPH_C64(0x5A5A2FB0EA2F5AEE), + SPH_C64(0x8383B5EF6CB58398), SPH_C64(0x3333FFB685FF3355), + SPH_C64(0x6363F25C3FF263A5), SPH_C64(0x02020A12100A0206), + SPH_C64(0xAAAA38933938AAE3), SPH_C64(0x7171A8DEAFA87193), + SPH_C64(0xC8C8CFC60ECFC845), SPH_C64(0x19197DD1C87D192B), + SPH_C64(0x4949703B727049DB), SPH_C64(0xD9D99A5F869AD976), + SPH_C64(0xF2F21D31C31DF20B), SPH_C64(0xE3E348A84B48E338), + SPH_C64(0x5B5B2AB9E22A5BED), SPH_C64(0x888892BC34928885), + SPH_C64(0x9A9AC83EA4C89AB3), SPH_C64(0x2626BE0B2DBE266A), + SPH_C64(0x3232FABF8DFA3256), SPH_C64(0xB0B04A59E94AB0CD), + SPH_C64(0xE9E96AF21B6AE926), SPH_C64(0x0F0F337778330F11), + SPH_C64(0xD5D5A633E6A6D562), SPH_C64(0x8080BAF474BA809D), + SPH_C64(0xBEBE7C27997CBEDF), SPH_C64(0xCDCDDEEB26DECD4A), + SPH_C64(0x3434E489BDE4345C), SPH_C64(0x484875327A7548D8), + SPH_C64(0xFFFF2454AB24FF1C), SPH_C64(0x7A7A8F8DF78F7A8E), + SPH_C64(0x9090EA64F4EA90AD), SPH_C64(0x5F5F3E9DC23E5FE1), + SPH_C64(0x2020A03D1DA02060), SPH_C64(0x6868D50F67D568B8), + SPH_C64(0x1A1A72CAD0721A2E), SPH_C64(0xAEAE2CB7192CAEEF), + SPH_C64(0xB4B45E7DC95EB4C1), SPH_C64(0x545419CE9A1954FC), + SPH_C64(0x9393E57FECE593A8), SPH_C64(0x2222AA2F0DAA2266), + SPH_C64(0x6464E96307E964AC), SPH_C64(0xF1F1122ADB12F10E), + SPH_C64(0x7373A2CCBFA27395), SPH_C64(0x12125A82905A1236), + SPH_C64(0x40405D7A3A5D40C0), SPH_C64(0x0808284840280818), + SPH_C64(0xC3C3E89556E8C358), SPH_C64(0xECEC7BDF337BEC29), + SPH_C64(0xDBDB904D9690DB70), SPH_C64(0xA1A11FC0611FA1FE), + SPH_C64(0x8D8D83911C838D8A), SPH_C64(0x3D3DC9C8F5C93D47), + SPH_C64(0x9797F15BCCF197A4), SPH_C64(0x0000000000000000), + SPH_C64(0xCFCFD4F936D4CF4C), SPH_C64(0x2B2B876E45872B7D), + SPH_C64(0x7676B3E197B3769A), SPH_C64(0x8282B0E664B0829B), + SPH_C64(0xD6D6A928FEA9D667), SPH_C64(0x1B1B77C3D8771B2D), + SPH_C64(0xB5B55B74C15BB5C2), SPH_C64(0xAFAF29BE1129AFEC), + SPH_C64(0x6A6ADF1D77DF6ABE), SPH_C64(0x50500DEABA0D50F0), + SPH_C64(0x45454C57124C45CF), SPH_C64(0xF3F31838CB18F308), + SPH_C64(0x3030F0AD9DF03050), SPH_C64(0xEFEF74C42B74EF2C), + SPH_C64(0x3F3FC3DAE5C33F41), SPH_C64(0x55551CC7921C55FF), + SPH_C64(0xA2A210DB7910A2FB), SPH_C64(0xEAEA65E90365EA23), + SPH_C64(0x6565EC6A0FEC65AF), SPH_C64(0xBABA6803B968BAD3), + SPH_C64(0x2F2F934A65932F71), SPH_C64(0xC0C0E78E4EE7C05D), + SPH_C64(0xDEDE8160BE81DE7F), SPH_C64(0x1C1C6CFCE06C1C24), + SPH_C64(0xFDFD2E46BB2EFD1A), SPH_C64(0x4D4D641F52644DD7), + SPH_C64(0x9292E076E4E092AB), SPH_C64(0x7575BCFA8FBC759F), + SPH_C64(0x06061E36301E060A), SPH_C64(0x8A8A98AE24988A83), + SPH_C64(0xB2B2404BF940B2CB), SPH_C64(0xE6E659856359E637), + SPH_C64(0x0E0E367E70360E12), SPH_C64(0x1F1F63E7F8631F21), + SPH_C64(0x6262F75537F762A6), SPH_C64(0xD4D4A33AEEA3D461), + SPH_C64(0xA8A832812932A8E5), SPH_C64(0x9696F452C4F496A7), + SPH_C64(0xF9F93A629B3AF916), SPH_C64(0xC5C5F6A366F6C552), + SPH_C64(0x2525B11035B1256F), SPH_C64(0x595920ABF22059EB), + SPH_C64(0x8484AED054AE8491), SPH_C64(0x7272A7C5B7A77296), + SPH_C64(0x3939DDECD5DD394B), SPH_C64(0x4C4C61165A614CD4), + SPH_C64(0x5E5E3B94CA3B5EE2), SPH_C64(0x7878859FE7857888), + SPH_C64(0x3838D8E5DDD83848), SPH_C64(0x8C8C869814868C89), + SPH_C64(0xD1D1B217C6B2D16E), SPH_C64(0xA5A50BE4410BA5F2), + SPH_C64(0xE2E24DA1434DE23B), SPH_C64(0x6161F84E2FF861A3), + SPH_C64(0xB3B34542F145B3C8), SPH_C64(0x2121A53415A52163), + SPH_C64(0x9C9CD60894D69CB9), SPH_C64(0x1E1E66EEF0661E22), + SPH_C64(0x43435261225243C5), SPH_C64(0xC7C7FCB176FCC754), + SPH_C64(0xFCFC2B4FB32BFC19), SPH_C64(0x040414242014040C), + SPH_C64(0x515108E3B20851F3), SPH_C64(0x9999C725BCC799B6), + SPH_C64(0x6D6DC4224FC46DB7), SPH_C64(0x0D0D396568390D17), + SPH_C64(0xFAFA35798335FA13), SPH_C64(0xDFDF8469B684DF7C), + SPH_C64(0x7E7E9BA9D79B7E82), SPH_C64(0x2424B4193DB4246C), + SPH_C64(0x3B3BD7FEC5D73B4D), SPH_C64(0xABAB3D9A313DABE0), + SPH_C64(0xCECED1F03ED1CE4F), SPH_C64(0x1111559988551133), + SPH_C64(0x8F8F89830C898F8C), SPH_C64(0x4E4E6B044A6B4ED2), + SPH_C64(0xB7B75166D151B7C4), SPH_C64(0xEBEB60E00B60EB20), + SPH_C64(0x3C3CCCC1FDCC3C44), SPH_C64(0x8181BFFD7CBF819E), + SPH_C64(0x9494FE40D4FE94A1), SPH_C64(0xF7F70C1CEB0CF704), + SPH_C64(0xB9B96718A167B9D6), SPH_C64(0x13135F8B985F1335), + SPH_C64(0x2C2C9C517D9C2C74), SPH_C64(0xD3D3B805D6B8D368), + SPH_C64(0xE7E75C8C6B5CE734), SPH_C64(0x6E6ECB3957CB6EB2), + SPH_C64(0xC4C4F3AA6EF3C451), SPH_C64(0x03030F1B180F0305), + SPH_C64(0x565613DC8A1356FA), SPH_C64(0x4444495E1A4944CC), + SPH_C64(0x7F7F9EA0DF9E7F81), SPH_C64(0xA9A937882137A9E6), + SPH_C64(0x2A2A82674D822A7E), SPH_C64(0xBBBB6D0AB16DBBD0), + SPH_C64(0xC1C1E28746E2C15E), SPH_C64(0x535302F1A20253F5), + SPH_C64(0xDCDC8B72AE8BDC79), SPH_C64(0x0B0B275358270B1D), + SPH_C64(0x9D9DD3019CD39DBA), SPH_C64(0x6C6CC12B47C16CB4), + SPH_C64(0x3131F5A495F53153), SPH_C64(0x7474B9F387B9749C), + SPH_C64(0xF6F60915E309F607), SPH_C64(0x4646434C0A4346CA), + SPH_C64(0xACAC26A50926ACE9), SPH_C64(0x898997B53C978986), + SPH_C64(0x141444B4A044143C), SPH_C64(0xE1E142BA5B42E13E), + SPH_C64(0x16164EA6B04E163A), SPH_C64(0x3A3AD2F7CDD23A4E), + SPH_C64(0x6969D0066FD069BB), SPH_C64(0x09092D41482D091B), + SPH_C64(0x7070ADD7A7AD7090), SPH_C64(0xB6B6546FD954B6C7), + SPH_C64(0xD0D0B71ECEB7D06D), SPH_C64(0xEDED7ED63B7EED2A), + SPH_C64(0xCCCCDBE22EDBCC49), SPH_C64(0x424257682A5742C6), + SPH_C64(0x9898C22CB4C298B5), SPH_C64(0xA4A40EED490EA4F1), + SPH_C64(0x282888755D882878), SPH_C64(0x5C5C3186DA315CE4), + SPH_C64(0xF8F83F6B933FF815), SPH_C64(0x8686A4C244A48697) +}; + +static const sph_u64 old1_T7[256] = { + SPH_C64(0x1878D8C078182818), SPH_C64(0x23AF2605AF236523), + SPH_C64(0xC6F9B87EF9C657C6), SPH_C64(0xE86FFB136FE825E8), + SPH_C64(0x87A1CB4CA1879487), SPH_C64(0xB86211A962B8D5B8), + SPH_C64(0x0105090805010301), SPH_C64(0x4F6E0D426E4FD14F), + SPH_C64(0x36EE9BADEE365A36), SPH_C64(0xA604FF5904A6F7A6), + SPH_C64(0xD2BD0CDEBDD26BD2), SPH_C64(0xF5060EFB06F502F5), + SPH_C64(0x798096EF80798B79), SPH_C64(0x6FCE305FCE6FB16F), + SPH_C64(0x91EF6DFCEF91AE91), SPH_C64(0x5207F8AA0752F652), + SPH_C64(0x60FD4727FD60A060), SPH_C64(0xBC76358976BCD9BC), + SPH_C64(0x9BCD37ACCD9BB09B), SPH_C64(0x8E8C8A048C8E8F8E), + SPH_C64(0xA315D27115A3F8A3), SPH_C64(0x0C3C6C603C0C140C), + SPH_C64(0x7B8A84FF8A7B8D7B), SPH_C64(0x35E180B5E1355F35), + SPH_C64(0x1D69F5E8691D271D), SPH_C64(0xE047B35347E03DE0), + SPH_C64(0xD7AC21F6ACD764D7), SPH_C64(0xC2ED9C5EEDC25BC2), + SPH_C64(0x2E96436D962E722E), SPH_C64(0x4B7A29627A4BDD4B), + SPH_C64(0xFE215DA321FE1FFE), SPH_C64(0x5716D5821657F957), + SPH_C64(0x1541BDA841153F15), SPH_C64(0x77B6E89FB6779977), + SPH_C64(0x37EB92A5EB375937), SPH_C64(0xE5569E7B56E532E5), + SPH_C64(0x9FD9138CD99FBC9F), SPH_C64(0xF01723D317F00DF0), + SPH_C64(0x4A7F206A7F4ADE4A), SPH_C64(0xDA95449E95DA73DA), + SPH_C64(0x5825A2FA2558E858), SPH_C64(0xC9CACF06CAC946C9), + SPH_C64(0x298D7C558D297B29), SPH_C64(0x0A225A50220A1E0A), + SPH_C64(0xB14F50E14FB1CEB1), SPH_C64(0xA01AC9691AA0FDA0), + SPH_C64(0x6BDA147FDA6BBD6B), SPH_C64(0x85ABD95CAB859285), + SPH_C64(0xBD733C8173BDDABD), SPH_C64(0x5D348FD2345DE75D), + SPH_C64(0x1050908050103010), SPH_C64(0xF40307F303F401F4), + SPH_C64(0xCBC0DD16C0CB40CB), SPH_C64(0x3EC6D3EDC63E423E), + SPH_C64(0x05112D2811050F05), SPH_C64(0x67E6781FE667A967), + SPH_C64(0xE453977353E431E4), SPH_C64(0x27BB0225BB276927), + SPH_C64(0x415873325841C341), SPH_C64(0x8B9DA72C9D8B808B), + SPH_C64(0xA701F65101A7F4A7), SPH_C64(0x7D94B2CF947D877D), + SPH_C64(0x95FB49DCFB95A295), SPH_C64(0xD89F568E9FD875D8), + SPH_C64(0xFB30708B30FB10FB), SPH_C64(0xEE71CD2371EE2FEE), + SPH_C64(0x7C91BBC7917C847C), SPH_C64(0x66E37117E366AA66), + SPH_C64(0xDD8E7BA68EDD7ADD), SPH_C64(0x174BAFB84B173917), + SPH_C64(0x474645024647C947), SPH_C64(0x9EDC1A84DC9EBF9E), + SPH_C64(0xCAC5D41EC5CA43CA), SPH_C64(0x2D995875992D772D), + SPH_C64(0xBF792E9179BFDCBF), SPH_C64(0x071B3F381B070907), + SPH_C64(0xAD23AC0123ADEAAD), SPH_C64(0x5A2FB0EA2F5AEE5A), + SPH_C64(0x83B5EF6CB5839883), SPH_C64(0x33FFB685FF335533), + SPH_C64(0x63F25C3FF263A563), SPH_C64(0x020A12100A020602), + SPH_C64(0xAA38933938AAE3AA), SPH_C64(0x71A8DEAFA8719371), + SPH_C64(0xC8CFC60ECFC845C8), SPH_C64(0x197DD1C87D192B19), + SPH_C64(0x49703B727049DB49), SPH_C64(0xD99A5F869AD976D9), + SPH_C64(0xF21D31C31DF20BF2), SPH_C64(0xE348A84B48E338E3), + SPH_C64(0x5B2AB9E22A5BED5B), SPH_C64(0x8892BC3492888588), + SPH_C64(0x9AC83EA4C89AB39A), SPH_C64(0x26BE0B2DBE266A26), + SPH_C64(0x32FABF8DFA325632), SPH_C64(0xB04A59E94AB0CDB0), + SPH_C64(0xE96AF21B6AE926E9), SPH_C64(0x0F337778330F110F), + SPH_C64(0xD5A633E6A6D562D5), SPH_C64(0x80BAF474BA809D80), + SPH_C64(0xBE7C27997CBEDFBE), SPH_C64(0xCDDEEB26DECD4ACD), + SPH_C64(0x34E489BDE4345C34), SPH_C64(0x4875327A7548D848), + SPH_C64(0xFF2454AB24FF1CFF), SPH_C64(0x7A8F8DF78F7A8E7A), + SPH_C64(0x90EA64F4EA90AD90), SPH_C64(0x5F3E9DC23E5FE15F), + SPH_C64(0x20A03D1DA0206020), SPH_C64(0x68D50F67D568B868), + SPH_C64(0x1A72CAD0721A2E1A), SPH_C64(0xAE2CB7192CAEEFAE), + SPH_C64(0xB45E7DC95EB4C1B4), SPH_C64(0x5419CE9A1954FC54), + SPH_C64(0x93E57FECE593A893), SPH_C64(0x22AA2F0DAA226622), + SPH_C64(0x64E96307E964AC64), SPH_C64(0xF1122ADB12F10EF1), + SPH_C64(0x73A2CCBFA2739573), SPH_C64(0x125A82905A123612), + SPH_C64(0x405D7A3A5D40C040), SPH_C64(0x0828484028081808), + SPH_C64(0xC3E89556E8C358C3), SPH_C64(0xEC7BDF337BEC29EC), + SPH_C64(0xDB904D9690DB70DB), SPH_C64(0xA11FC0611FA1FEA1), + SPH_C64(0x8D83911C838D8A8D), SPH_C64(0x3DC9C8F5C93D473D), + SPH_C64(0x97F15BCCF197A497), SPH_C64(0x0000000000000000), + SPH_C64(0xCFD4F936D4CF4CCF), SPH_C64(0x2B876E45872B7D2B), + SPH_C64(0x76B3E197B3769A76), SPH_C64(0x82B0E664B0829B82), + SPH_C64(0xD6A928FEA9D667D6), SPH_C64(0x1B77C3D8771B2D1B), + SPH_C64(0xB55B74C15BB5C2B5), SPH_C64(0xAF29BE1129AFECAF), + SPH_C64(0x6ADF1D77DF6ABE6A), SPH_C64(0x500DEABA0D50F050), + SPH_C64(0x454C57124C45CF45), SPH_C64(0xF31838CB18F308F3), + SPH_C64(0x30F0AD9DF0305030), SPH_C64(0xEF74C42B74EF2CEF), + SPH_C64(0x3FC3DAE5C33F413F), SPH_C64(0x551CC7921C55FF55), + SPH_C64(0xA210DB7910A2FBA2), SPH_C64(0xEA65E90365EA23EA), + SPH_C64(0x65EC6A0FEC65AF65), SPH_C64(0xBA6803B968BAD3BA), + SPH_C64(0x2F934A65932F712F), SPH_C64(0xC0E78E4EE7C05DC0), + SPH_C64(0xDE8160BE81DE7FDE), SPH_C64(0x1C6CFCE06C1C241C), + SPH_C64(0xFD2E46BB2EFD1AFD), SPH_C64(0x4D641F52644DD74D), + SPH_C64(0x92E076E4E092AB92), SPH_C64(0x75BCFA8FBC759F75), + SPH_C64(0x061E36301E060A06), SPH_C64(0x8A98AE24988A838A), + SPH_C64(0xB2404BF940B2CBB2), SPH_C64(0xE659856359E637E6), + SPH_C64(0x0E367E70360E120E), SPH_C64(0x1F63E7F8631F211F), + SPH_C64(0x62F75537F762A662), SPH_C64(0xD4A33AEEA3D461D4), + SPH_C64(0xA832812932A8E5A8), SPH_C64(0x96F452C4F496A796), + SPH_C64(0xF93A629B3AF916F9), SPH_C64(0xC5F6A366F6C552C5), + SPH_C64(0x25B11035B1256F25), SPH_C64(0x5920ABF22059EB59), + SPH_C64(0x84AED054AE849184), SPH_C64(0x72A7C5B7A7729672), + SPH_C64(0x39DDECD5DD394B39), SPH_C64(0x4C61165A614CD44C), + SPH_C64(0x5E3B94CA3B5EE25E), SPH_C64(0x78859FE785788878), + SPH_C64(0x38D8E5DDD8384838), SPH_C64(0x8C869814868C898C), + SPH_C64(0xD1B217C6B2D16ED1), SPH_C64(0xA50BE4410BA5F2A5), + SPH_C64(0xE24DA1434DE23BE2), SPH_C64(0x61F84E2FF861A361), + SPH_C64(0xB34542F145B3C8B3), SPH_C64(0x21A53415A5216321), + SPH_C64(0x9CD60894D69CB99C), SPH_C64(0x1E66EEF0661E221E), + SPH_C64(0x435261225243C543), SPH_C64(0xC7FCB176FCC754C7), + SPH_C64(0xFC2B4FB32BFC19FC), SPH_C64(0x0414242014040C04), + SPH_C64(0x5108E3B20851F351), SPH_C64(0x99C725BCC799B699), + SPH_C64(0x6DC4224FC46DB76D), SPH_C64(0x0D396568390D170D), + SPH_C64(0xFA35798335FA13FA), SPH_C64(0xDF8469B684DF7CDF), + SPH_C64(0x7E9BA9D79B7E827E), SPH_C64(0x24B4193DB4246C24), + SPH_C64(0x3BD7FEC5D73B4D3B), SPH_C64(0xAB3D9A313DABE0AB), + SPH_C64(0xCED1F03ED1CE4FCE), SPH_C64(0x1155998855113311), + SPH_C64(0x8F89830C898F8C8F), SPH_C64(0x4E6B044A6B4ED24E), + SPH_C64(0xB75166D151B7C4B7), SPH_C64(0xEB60E00B60EB20EB), + SPH_C64(0x3CCCC1FDCC3C443C), SPH_C64(0x81BFFD7CBF819E81), + SPH_C64(0x94FE40D4FE94A194), SPH_C64(0xF70C1CEB0CF704F7), + SPH_C64(0xB96718A167B9D6B9), SPH_C64(0x135F8B985F133513), + SPH_C64(0x2C9C517D9C2C742C), SPH_C64(0xD3B805D6B8D368D3), + SPH_C64(0xE75C8C6B5CE734E7), SPH_C64(0x6ECB3957CB6EB26E), + SPH_C64(0xC4F3AA6EF3C451C4), SPH_C64(0x030F1B180F030503), + SPH_C64(0x5613DC8A1356FA56), SPH_C64(0x44495E1A4944CC44), + SPH_C64(0x7F9EA0DF9E7F817F), SPH_C64(0xA937882137A9E6A9), + SPH_C64(0x2A82674D822A7E2A), SPH_C64(0xBB6D0AB16DBBD0BB), + SPH_C64(0xC1E28746E2C15EC1), SPH_C64(0x5302F1A20253F553), + SPH_C64(0xDC8B72AE8BDC79DC), SPH_C64(0x0B275358270B1D0B), + SPH_C64(0x9DD3019CD39DBA9D), SPH_C64(0x6CC12B47C16CB46C), + SPH_C64(0x31F5A495F5315331), SPH_C64(0x74B9F387B9749C74), + SPH_C64(0xF60915E309F607F6), SPH_C64(0x46434C0A4346CA46), + SPH_C64(0xAC26A50926ACE9AC), SPH_C64(0x8997B53C97898689), + SPH_C64(0x1444B4A044143C14), SPH_C64(0xE142BA5B42E13EE1), + SPH_C64(0x164EA6B04E163A16), SPH_C64(0x3AD2F7CDD23A4E3A), + SPH_C64(0x69D0066FD069BB69), SPH_C64(0x092D41482D091B09), + SPH_C64(0x70ADD7A7AD709070), SPH_C64(0xB6546FD954B6C7B6), + SPH_C64(0xD0B71ECEB7D06DD0), SPH_C64(0xED7ED63B7EED2AED), + SPH_C64(0xCCDBE22EDBCC49CC), SPH_C64(0x4257682A5742C642), + SPH_C64(0x98C22CB4C298B598), SPH_C64(0xA40EED490EA4F1A4), + SPH_C64(0x2888755D88287828), SPH_C64(0x5C3186DA315CE45C), + SPH_C64(0xF83F6B933FF815F8), SPH_C64(0x86A4C244A4869786) +}; + +#endif + +static const sph_u64 old1_RC[10] = { + SPH_C64(0x4F01B887E8C62318), + SPH_C64(0x52916F79F5D2A636), + SPH_C64(0x357B0CA38E9BBC60), + SPH_C64(0x57FE4B2EC2D7E01D), + SPH_C64(0xDA4AF09FE5377715), + SPH_C64(0x856BA0B10A29C958), + SPH_C64(0x67053ECBF4105DBD), + SPH_C64(0xD8957DA78B4127E4), + SPH_C64(0x9E4717DD667CEEFB), + SPH_C64(0x33835AAD07BF2DCA) +}; + +/* ====================================================================== */ + +#define DECL8(z) sph_u64 z ## 0, z ## 1, z ## 2, z ## 3, \ + z ## 4, z ## 5, z ## 6, z ## 7 + +#if SPH_LITTLE_FAST +#define READ_DATA_W(x) do { \ + n ## x = sph_dec64le_aligned( \ + (const unsigned char *)src + 8 * (x)); \ + } while (0) +#define UPDATE_STATE_W(x) do { \ + state[x] ^= n ## x ^ sph_dec64le_aligned( \ + (const unsigned char *)src + 8 * (x)); \ + } while (0) +#define LVARS DECL8(n); DECL8(h); +#else +#define READ_DATA_W(x) do { \ + sn ## x = n ## x = sph_dec64le_aligned( \ + (const unsigned char *)src + 8 * (x)); \ + } while (0) +#define UPDATE_STATE_W(x) do { \ + state[x] ^= n ## x ^ sn ## x; \ + } while (0) +#define LVARS DECL8(n); DECL8(sn); DECL8(h); +#endif + +#define READ_STATE_W(x) do { h ## x = state[x]; } while (0) + +#define MUL8(FUN) do { \ + FUN(0); \ + FUN(1); \ + FUN(2); \ + FUN(3); \ + FUN(4); \ + FUN(5); \ + FUN(6); \ + FUN(7); \ + } while (0) + +/* + * First operation: XOR the input data with the first round key. + */ +#define ROUND0_W(x) do { \ + n ## x ^= h ## x; \ + } while (0) + +#define READ_DATA MUL8(READ_DATA_W) +#define READ_STATE MUL8(READ_STATE_W) +#define ROUND0 MUL8(ROUND0_W) +#define UPDATE_STATE MUL8(UPDATE_STATE_W) + +#define BYTE(x, n) ((unsigned)((x) >> (8 * (n))) & 0xFF) + +#if SPH_SMALL_FOOTPRINT_WHIRLPOOL + +static SPH_INLINE sph_u64 +table_skew(sph_u64 val, int num) +{ + return SPH_ROTL64(val, 8 * num); +} + +#define ROUND_ELT(table, in, i0, i1, i2, i3, i4, i5, i6, i7) \ + (table ## 0[BYTE(in ## i0, 0)] \ + ^ table_skew(table ## 0[BYTE(in ## i1, 1)], 1) \ + ^ table_skew(table ## 0[BYTE(in ## i2, 2)], 2) \ + ^ table_skew(table ## 0[BYTE(in ## i3, 3)], 3) \ + ^ table_skew(table ## 0[BYTE(in ## i4, 4)], 4) \ + ^ table_skew(table ## 0[BYTE(in ## i5, 5)], 5) \ + ^ table_skew(table ## 0[BYTE(in ## i6, 6)], 6) \ + ^ table_skew(table ## 0[BYTE(in ## i7, 7)], 7)) +#else +#define ROUND_ELT(table, in, i0, i1, i2, i3, i4, i5, i6, i7) \ + (table ## 0[BYTE(in ## i0, 0)] \ + ^ table ## 1[BYTE(in ## i1, 1)] \ + ^ table ## 2[BYTE(in ## i2, 2)] \ + ^ table ## 3[BYTE(in ## i3, 3)] \ + ^ table ## 4[BYTE(in ## i4, 4)] \ + ^ table ## 5[BYTE(in ## i5, 5)] \ + ^ table ## 6[BYTE(in ## i6, 6)] \ + ^ table ## 7[BYTE(in ## i7, 7)]) +#endif + +#define ROUND(table, in, out, c0, c1, c2, c3, c4, c5, c6, c7) do { \ + out ## 0 = ROUND_ELT(table, in, 0, 7, 6, 5, 4, 3, 2, 1) ^ c0; \ + out ## 1 = ROUND_ELT(table, in, 1, 0, 7, 6, 5, 4, 3, 2) ^ c1; \ + out ## 2 = ROUND_ELT(table, in, 2, 1, 0, 7, 6, 5, 4, 3) ^ c2; \ + out ## 3 = ROUND_ELT(table, in, 3, 2, 1, 0, 7, 6, 5, 4) ^ c3; \ + out ## 4 = ROUND_ELT(table, in, 4, 3, 2, 1, 0, 7, 6, 5) ^ c4; \ + out ## 5 = ROUND_ELT(table, in, 5, 4, 3, 2, 1, 0, 7, 6) ^ c5; \ + out ## 6 = ROUND_ELT(table, in, 6, 5, 4, 3, 2, 1, 0, 7) ^ c6; \ + out ## 7 = ROUND_ELT(table, in, 7, 6, 5, 4, 3, 2, 1, 0) ^ c7; \ + } while (0) + +#define ROUND_KSCHED(table, in, out, c) \ + ROUND(table, in, out, c, 0, 0, 0, 0, 0, 0, 0) + +#define ROUND_WENC(table, in, key, out) \ + ROUND(table, in, out, key ## 0, key ## 1, key ## 2, \ + key ## 3, key ## 4, key ## 5, key ## 6, key ## 7) + +#define TRANSFER(dst, src) do { \ + dst ## 0 = src ## 0; \ + dst ## 1 = src ## 1; \ + dst ## 2 = src ## 2; \ + dst ## 3 = src ## 3; \ + dst ## 4 = src ## 4; \ + dst ## 5 = src ## 5; \ + dst ## 6 = src ## 6; \ + dst ## 7 = src ## 7; \ + } while (0) + +/* see sph_whirlpool.h */ +void +sph_whirlpool_init(void *cc) +{ + sph_whirlpool_context *sc; + + sc = cc; + /* + * We want to set all eight 64-bit words to 0. A "memset()" + * is not, theoretically, fully standard, but in practice it + * will work everywhere. + */ + memset(sc->state, 0, sizeof sc->state); +#if SPH_64 + sc->count = 0; +#else + sc->count_high = sc->count_low = 0; +#endif +} + +#define ROUND_FUN(name, type) \ +static void \ +name ## _round(const void *src, sph_u64 *state) \ +{ \ + LVARS \ + int r; \ + \ + READ_DATA; \ + READ_STATE; \ + ROUND0; \ + for (r = 0; r < 10; r ++) { \ + DECL8(tmp); \ + \ + ROUND_KSCHED(type ## _T, h, tmp, type ## _RC[r]); \ + TRANSFER(h, tmp); \ + ROUND_WENC(type ## _T, n, h, tmp); \ + TRANSFER(n, tmp); \ + } \ + UPDATE_STATE; \ +} + +ROUND_FUN(whirlpool, plain) +ROUND_FUN(whirlpool0, old0) +ROUND_FUN(whirlpool1, old1) + +/* + * We want big-endian encoding of the message length, over 256 bits. BE64 + * triggers that. However, our block length is 512 bits, not 1024 bits. + * Internally, our encoding/decoding is little-endian, which is not a + * problem here since we also deactivate output in md_helper.c. + */ +#define BE64 1 +#define SVAL sc->state +#define BLEN 64U +#define PLW4 1 + +#define RFUN whirlpool_round +#define HASH whirlpool +#include "md_helper.c" +#undef RFUN +#undef HASH + +#define RFUN whirlpool0_round +#define HASH whirlpool0 +#include "md_helper.c" +#undef RFUN +#undef HASH + +#define RFUN whirlpool1_round +#define HASH whirlpool1 +#include "md_helper.c" +#undef RFUN +#undef HASH + +#define MAKE_CLOSE(name) \ +void \ +sph_ ## name ## _close(void *cc, void *dst) \ +{ \ + sph_ ## name ## _context *sc; \ + int i; \ + \ + name ## _close(cc, dst, 0); \ + sc = cc; \ + for (i = 0; i < 8; i ++) \ + sph_enc64le((unsigned char *)dst + 8 * i, sc->state[i]); \ + sph_ ## name ## _init(cc); \ +} + +MAKE_CLOSE(whirlpool) +MAKE_CLOSE(whirlpool0) +MAKE_CLOSE(whirlpool1) + +#ifdef __cplusplus +} +#endif diff --git a/sph/yescrypt-opt.c b/sph/yescrypt-opt.c new file mode 100644 index 0000000..b14b216 --- /dev/null +++ b/sph/yescrypt-opt.c @@ -0,0 +1,1392 @@ +/*- + * Copyright 2009 Colin Percival + * Copyright 2013,2014 Alexander Peslyak + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ + +#ifdef __i386__ +#warning "This implementation does not use SIMD, and thus it runs a lot slower than the SIMD-enabled implementation. Enable at least SSE2 in the C compiler and use yescrypt-best.c instead unless you're building this SIMD-less implementation on purpose (portability to older CPUs or testing)." +#elif defined(__x86_64__) +#warning "This implementation does not use SIMD, and thus it runs a lot slower than the SIMD-enabled implementation. Use yescrypt-best.c instead unless you're building this SIMD-less implementation on purpose (for testing only)." +#endif + +#include +#include +#include +#include "yescrypt.h" +#include "sha256_Y.h" +#include "sysendian.h" + +// #include "sph/yescrypt-platform.c" +#define HUGEPAGE_THRESHOLD (12 * 1024 * 1024) + +#ifdef __x86_64__ +#define HUGEPAGE_SIZE (2 * 1024 * 1024) +#else +#undef HUGEPAGE_SIZE +#endif + + +static void * +alloc_region(yescrypt_region_t * region, size_t size) +{ + size_t base_size = size; + uint8_t * base, *aligned; +#ifdef MAP_ANON + int flags = +#ifdef MAP_NOCORE + MAP_NOCORE | +#endif + MAP_ANON | MAP_PRIVATE; +#if defined(MAP_HUGETLB) && defined(HUGEPAGE_SIZE) + size_t new_size = size; + const size_t hugepage_mask = (size_t)HUGEPAGE_SIZE - 1; + if (size >= HUGEPAGE_THRESHOLD && size + hugepage_mask >= size) { + flags |= MAP_HUGETLB; + /* + * Linux's munmap() fails on MAP_HUGETLB mappings if size is not a multiple of + * huge page size, so let's round up to huge page size here. + */ + new_size = size + hugepage_mask; + new_size &= ~hugepage_mask; + } + base = mmap(NULL, new_size, PROT_READ | PROT_WRITE, flags, -1, 0); + if (base != MAP_FAILED) { + base_size = new_size; + } + else + if (flags & MAP_HUGETLB) { + flags &= ~MAP_HUGETLB; + base = mmap(NULL, size, PROT_READ | PROT_WRITE, flags, -1, 0); + } + +#else + base = mmap(NULL, size, PROT_READ | PROT_WRITE, flags, -1, 0); +#endif + if (base == MAP_FAILED) + base = NULL; + aligned = base; +#elif defined(HAVE_POSIX_MEMALIGN) + if ((errno = posix_memalign((void **)&base, 64, size)) != 0) + base = NULL; + aligned = base; +#else + base = aligned = NULL; + if (size + 63 < size) { + errno = ENOMEM; + } + else if ((base = malloc(size + 63)) != NULL) { + aligned = base + 63; + aligned -= (uintptr_t)aligned & 63; + } +#endif + region->base = base; + region->aligned = aligned; + region->base_size = base ? base_size : 0; + region->aligned_size = base ? size : 0; + return aligned; +} + +static void init_region(yescrypt_region_t * region) +{ + region->base = region->aligned = NULL; + region->base_size = region->aligned_size = 0; +} + +static int +free_region(yescrypt_region_t * region) +{ + if (region->base) { +#ifdef MAP_ANON + if (munmap(region->base, region->base_size)) + return -1; +#else + free(region->base); +#endif + } + init_region(region); + return 0; +} + +int +yescrypt_init_shared(yescrypt_shared_t * shared, +const uint8_t * param, size_t paramlen, +uint64_t N, uint32_t r, uint32_t p, +yescrypt_init_shared_flags_t flags, uint32_t mask, +uint8_t * buf, size_t buflen) +{ + yescrypt_shared1_t * shared1 = &shared->shared1; + yescrypt_shared_t dummy, half1, half2; + // yescrypt_shared_t * half2; + uint8_t salt[32]; + + if (flags & YESCRYPT_SHARED_PREALLOCATED) { + if (!shared1->aligned || !shared1->aligned_size) + return -1; + } + else { + init_region(shared1); + } + shared->mask1 = 1; + if (!param && !paramlen && !N && !r && !p && !buf && !buflen) + return 0; + + init_region(&dummy.shared1); + dummy.mask1 = 1; + if (yescrypt_kdf(&dummy, shared1, + param, paramlen, NULL, 0, N, r, p, 0, + YESCRYPT_RW | YESCRYPT_PARALLEL_SMIX | __YESCRYPT_INIT_SHARED_1, + salt, sizeof(salt))) + goto out; + + half1 = half2 = *shared; + half1.shared1.aligned_size /= 2; + half2.shared1.aligned_size = half1.shared1.aligned_size; + half2.shared1.aligned = (char*)half2.shared1.aligned + half1.shared1.aligned_size; + + N /= 2; + + if (p > 1 && yescrypt_kdf(&half1, &half2.shared1, + param, paramlen, salt, sizeof(salt), N, r, p, 0, + YESCRYPT_RW | YESCRYPT_PARALLEL_SMIX | __YESCRYPT_INIT_SHARED_2, + salt, sizeof(salt))) + goto out; + + if (yescrypt_kdf(&half2, &half1.shared1, + param, paramlen, salt, sizeof(salt), N, r, p, 0, + YESCRYPT_RW | YESCRYPT_PARALLEL_SMIX | __YESCRYPT_INIT_SHARED_1, + salt, sizeof(salt))) + goto out; + + if (yescrypt_kdf(&half1, &half2.shared1, + param, paramlen, salt, sizeof(salt), N, r, p, 0, + YESCRYPT_RW | YESCRYPT_PARALLEL_SMIX | __YESCRYPT_INIT_SHARED_1, + buf, buflen)) + goto out; + + shared->mask1 = mask; + + return 0; + +out: + if (!(flags & YESCRYPT_SHARED_PREALLOCATED)) + free_region(shared1); + return -1; +} + +int +yescrypt_free_shared(yescrypt_shared_t * shared) +{ + return free_region(&shared->shared1); +} + +int +yescrypt_init_local(yescrypt_local_t * local) +{ + init_region(local); + return 0; +} + +int +yescrypt_free_local(yescrypt_local_t * local) +{ + return free_region(local); +} + + +static void +blkcpy(uint64_t * dest, const uint64_t * src, size_t count) +{ + do { + *dest++ = *src++; *dest++ = *src++; + *dest++ = *src++; *dest++ = *src++; + } while (count -= 4); +}; + +static void +blkxor(uint64_t * dest, const uint64_t * src, size_t count) +{ + do { + *dest++ ^= *src++; *dest++ ^= *src++; + *dest++ ^= *src++; *dest++ ^= *src++; + } while (count -= 4); +}; + +typedef union { + uint32_t w[16]; + uint64_t d[8]; +} salsa20_blk_t; + +static void +salsa20_simd_shuffle(const salsa20_blk_t * Bin, salsa20_blk_t * Bout) +{ +#define COMBINE(out, in1, in2) \ + Bout->d[out] = Bin->w[in1 * 2] | ((uint64_t)Bin->w[in2 * 2 + 1] << 32); + COMBINE(0, 0, 2) + COMBINE(1, 5, 7) + COMBINE(2, 2, 4) + COMBINE(3, 7, 1) + COMBINE(4, 4, 6) + COMBINE(5, 1, 3) + COMBINE(6, 6, 0) + COMBINE(7, 3, 5) +#undef COMBINE +} + +static void +salsa20_simd_unshuffle(const salsa20_blk_t * Bin, salsa20_blk_t * Bout) +{ +#define COMBINE(out, in1, in2) \ + Bout->w[out * 2] = Bin->d[in1]; \ + Bout->w[out * 2 + 1] = Bin->d[in2] >> 32; + COMBINE(0, 0, 6) + COMBINE(1, 5, 3) + COMBINE(2, 2, 0) + COMBINE(3, 7, 5) + COMBINE(4, 4, 2) + COMBINE(5, 1, 7) + COMBINE(6, 6, 4) + COMBINE(7, 3, 1) +#undef COMBINE +} + +/** + * salsa20_8(B): + * Apply the salsa20/8 core to the provided block. + */ + +static void +salsa20_8(uint64_t B[8]) +{ + size_t i; + salsa20_blk_t X; + +#define x X.w + + salsa20_simd_unshuffle((const salsa20_blk_t *)B, &X); + + for (i = 0; i < 8; i += 2) { +#define R(a,b) (((a) << (b)) | ((a) >> (32 - (b)))) + /* Operate on columns */ + x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9); + x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18); + + x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9); + x[ 1] ^= R(x[13]+x[ 9],13); x[ 5] ^= R(x[ 1]+x[13],18); + + x[14] ^= R(x[10]+x[ 6], 7); x[ 2] ^= R(x[14]+x[10], 9); + x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],18); + + x[ 3] ^= R(x[15]+x[11], 7); x[ 7] ^= R(x[ 3]+x[15], 9); + x[11] ^= R(x[ 7]+x[ 3],13); x[15] ^= R(x[11]+x[ 7],18); + + /* Operate on rows */ + x[ 1] ^= R(x[ 0]+x[ 3], 7); x[ 2] ^= R(x[ 1]+x[ 0], 9); + x[ 3] ^= R(x[ 2]+x[ 1],13); x[ 0] ^= R(x[ 3]+x[ 2],18); + + x[ 6] ^= R(x[ 5]+x[ 4], 7); x[ 7] ^= R(x[ 6]+x[ 5], 9); + x[ 4] ^= R(x[ 7]+x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],18); + + x[11] ^= R(x[10]+x[ 9], 7); x[ 8] ^= R(x[11]+x[10], 9); + x[ 9] ^= R(x[ 8]+x[11],13); x[10] ^= R(x[ 9]+x[ 8],18); + + x[12] ^= R(x[15]+x[14], 7); x[13] ^= R(x[12]+x[15], 9); + x[14] ^= R(x[13]+x[12],13); x[15] ^= R(x[14]+x[13],18); +#undef R + } +#undef x + + { + salsa20_blk_t Y; + salsa20_simd_shuffle(&X, &Y); + for (i = 0; i < 16; i += 4) { + ((salsa20_blk_t *)B)->w[i] += Y.w[i]; + ((salsa20_blk_t *)B)->w[i + 1] += Y.w[i + 1]; + ((salsa20_blk_t *)B)->w[i + 2] += Y.w[i + 2]; + ((salsa20_blk_t *)B)->w[i + 3] += Y.w[i + 3]; + } + } +} + +/** + * blockmix_salsa8(Bin, Bout, X, r): + * Compute Bout = BlockMix_{salsa20/8, r}(Bin). The input Bin must be 128r + * bytes in length; the output Bout must also be the same size. The + * temporary space X must be 64 bytes. + */ +static void +blockmix_salsa8(const uint64_t * Bin, uint64_t * Bout, uint64_t * X, size_t r) +{ + size_t i; + + /* 1: X <-- B_{2r - 1} */ + blkcpy(X, &Bin[(2 * r - 1) * 8], 8); + + /* 2: for i = 0 to 2r - 1 do */ + for (i = 0; i < 2 * r; i += 2) { + /* 3: X <-- H(X \xor B_i) */ + blkxor(X, &Bin[i * 8], 8); + salsa20_8(X); + + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + blkcpy(&Bout[i * 4], X, 8); + + /* 3: X <-- H(X \xor B_i) */ + blkxor(X, &Bin[i * 8 + 8], 8); + salsa20_8(X); + + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + blkcpy(&Bout[i * 4 + r * 8], X, 8); + } + +} + +/* These are tunable */ +#define S_BITS 8 +#define S_SIMD 2 +#define S_P 4 +#define S_ROUNDS 6 + +/* Number of S-boxes. Not tunable, hard-coded in a few places. */ +#define S_N 2 + +/* Derived values. Not tunable on their own. */ +#define S_SIZE1 (1 << S_BITS) +#define S_MASK ((S_SIZE1 - 1) * S_SIMD * 8) +#define S_MASK2 (((uint64_t)S_MASK << 32) | S_MASK) +#define S_SIZE_ALL (S_N * S_SIZE1 * S_SIMD) +#define S_P_SIZE (S_P * S_SIMD) +#define S_MIN_R ((S_P * S_SIMD + 15) / 16) + +/** + * pwxform(B): + * Transform the provided block using the provided S-boxes. + */ + +static void +block_pwxform(uint64_t * B, const uint64_t * S) +{ + uint64_t(*X)[S_SIMD] = (uint64_t(*)[S_SIMD])B; + const uint8_t *S0 = (const uint8_t *)S; + const uint8_t *S1 = (const uint8_t *)(S + S_SIZE1 * S_SIMD); + size_t i, j; + + for (j = 0; j < S_P; j++) { + + uint64_t *Xj = X[j]; + uint64_t x0 = Xj[0]; + uint64_t x1 = Xj[1]; + + for (i = 0; i < S_ROUNDS; i++) { + uint64_t x = x0 & S_MASK2; + const uint64_t *p0, *p1; + + p0 = (const uint64_t *)(S0 + (uint32_t)x); + p1 = (const uint64_t *)(S1 + (x >> 32)); + + x0 = (uint64_t)(x0 >> 32) * (uint32_t)x0; + x0 += p0[0]; + x0 ^= p1[0]; + + x1 = (uint64_t)(x1 >> 32) * (uint32_t)x1; + x1 += p0[1]; + x1 ^= p1[1]; + } + Xj[0] = x0; + Xj[1] = x1; + } + + + +} + + +/** + * blockmix_pwxform(Bin, Bout, S, r): + * Compute Bout = BlockMix_pwxform{salsa20/8, S, r}(Bin). The input Bin must + * be 128r bytes in length; the output Bout must also be the same size. + * + * S lacks const qualifier to match blockmix_salsa8()'s prototype, which we + * need to refer to both functions via the same function pointers. + */ +static void +blockmix_pwxform(const uint64_t * Bin, uint64_t * Bout, uint64_t * S, size_t r) +{ + size_t r1, r2, i; + // S_P_SIZE = 8; + /* Convert 128-byte blocks to (S_P_SIZE * 64-bit) blocks */ + + r1 = r * 128 / (S_P_SIZE * 8); + /* X <-- B_{r1 - 1} */ + blkcpy(Bout, &Bin[(r1 - 1) * S_P_SIZE], S_P_SIZE); + + /* X <-- X \xor B_i */ + blkxor(Bout, Bin, S_P_SIZE); + + /* X <-- H'(X) */ + /* B'_i <-- X */ + block_pwxform(Bout, S); + + /* for i = 0 to r1 - 1 do */ + for (i = 1; i < r1; i++) { + /* X <-- X \xor B_i */ + blkcpy(&Bout[i * S_P_SIZE], &Bout[(i - 1) * S_P_SIZE],S_P_SIZE); + blkxor(&Bout[i * S_P_SIZE], &Bin[i * S_P_SIZE], S_P_SIZE); + + /* X <-- H'(X) */ + /* B'_i <-- X */ + block_pwxform(&Bout[i * S_P_SIZE], S); + } + + /* Handle partial blocks */ + if (i * S_P_SIZE < r * 16) { + blkcpy(&Bout[i * S_P_SIZE], &Bin[i * S_P_SIZE],r * 16 - i * S_P_SIZE); +} + + i = (r1 - 1) * S_P_SIZE / 8; + /* Convert 128-byte blocks to 64-byte blocks */ + r2 = r * 2; + + /* B'_i <-- H(B'_i) */ + salsa20_8(&Bout[i * 8]); + + + i++; +/// not used yescrypt + + for (; i < r2; i++) { + /* B'_i <-- H(B'_i \xor B'_{i-1}) */ + blkxor(&Bout[i * 8], &Bout[(i - 1) * 8], 8); + salsa20_8(&Bout[i * 8]); + } +} + + + +/** + * integerify(B, r): + * Return the result of parsing B_{2r-1} as a little-endian integer. + */ +static uint64_t +integerify(const uint64_t * B, size_t r) +{ +/* + * Our 64-bit words are in host byte order, and word 6 holds the second 32-bit + * word of B_{2r-1} due to SIMD shuffling. The 64-bit value we return is also + * in host byte order, as it should be. + */ + const uint64_t * X = &B[(2 * r - 1) * 8]; + uint32_t lo = X[0]; + uint32_t hi = X[6] >> 32; + return ((uint64_t)hi << 32) + lo; +} + +/** + * smix1(B, r, N, flags, V, NROM, shared, XY, S): + * Compute first loop of B = SMix_r(B, N). The input B must be 128r bytes in + * length; the temporary storage V must be 128rN bytes in length; the temporary + * storage XY must be 256r + 64 bytes in length. The value N must be even and + * no smaller than 2. + */ +static void +smix1(uint64_t * B, size_t r, uint64_t N, yescrypt_flags_t flags, + uint64_t * V, uint64_t NROM, const yescrypt_shared_t * shared, + uint64_t * XY, uint64_t * S) +{ + void (*blockmix)(const uint64_t *, uint64_t *, uint64_t *, size_t) = (S ? blockmix_pwxform : blockmix_salsa8); + const uint64_t * VROM = shared->shared1.aligned; + uint32_t VROM_mask = shared->mask1; + size_t s = 16 * r; + uint64_t * X = V; + uint64_t * Y = &XY[s]; + uint64_t * Z = S ? S : &XY[2 * s]; + uint64_t n, i, j; + size_t k; + + /* 1: X <-- B */ + /* 3: V_i <-- X */ + for (i = 0; i < 2 * r; i++) { + const salsa20_blk_t *src = (const salsa20_blk_t *)&B[i * 8]; + salsa20_blk_t *tmp = (salsa20_blk_t *)Y; + salsa20_blk_t *dst = (salsa20_blk_t *)&X[i * 8]; + for (k = 0; k < 16; k++) + tmp->w[k] = le32dec(&src->w[k]); + + salsa20_simd_shuffle(tmp, dst); + } + + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + + blockmix(X, Y, Z, r); + + blkcpy(&V[s], Y, s); + + X = XY; + + if (NROM && (VROM_mask & 1)) { + if ((1 & VROM_mask) == 1) { + /* j <-- Integerify(X) mod NROM */ + j = integerify(Y, r) & (NROM - 1); + + /* X <-- H(X \xor VROM_j) */ + blkxor(Y, &VROM[j * s], s); + } + + blockmix(Y, X, Z, r); + + /* 2: for i = 0 to N - 1 do */ + for (n = 1, i = 2; i < N; i += 2) { + /* 3: V_i <-- X */ + blkcpy(&V[i * s], X, s); + + if ((i & (i - 1)) == 0) + n <<= 1; + + /* j <-- Wrap(Integerify(X), i) */ + j = integerify(X, r) & (n - 1); + j += i - n; + + /* X <-- X \xor V_j */ + blkxor(X, &V[j * s], s); + + /* 4: X <-- H(X) */ + blockmix(X, Y, Z, r); + + /* 3: V_i <-- X */ + blkcpy(&V[(i + 1) * s], Y, s); + + j = integerify(Y, r); + if (((i + 1) & VROM_mask) == 1) { + /* j <-- Integerify(X) mod NROM */ + j &= NROM - 1; + + /* X <-- H(X \xor VROM_j) */ + blkxor(Y, &VROM[j * s], s); + } else { + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += i + 1 - n; + + /* X <-- H(X \xor V_j) */ + blkxor(Y, &V[j * s], s); + } + + blockmix(Y, X, Z, r); + } + } else { + yescrypt_flags_t rw = flags & YESCRYPT_RW; + /* 4: X <-- H(X) */ + blockmix(Y, X, Z, r); + + /* 2: for i = 0 to N - 1 do */ + for (n = 1, i = 2; i < N; i += 2) { + /* 3: V_i <-- X */ + blkcpy(&V[i * s], X, s); + + if (rw) { + if ((i & (i - 1)) == 0) + n <<= 1; + + /* j <-- Wrap(Integerify(X), i) */ + j = integerify(X, r) & (n - 1); + j += i - n; + + /* X <-- X \xor V_j */ + blkxor(X, &V[j * s], s); + } + + /* 4: X <-- H(X) */ + blockmix(X, Y, Z, r); + + /* 3: V_i <-- X */ + blkcpy(&V[(i + 1) * s], Y, s); + + if (rw) { + /* j <-- Wrap(Integerify(X), i) */ + j = integerify(Y, r) & (n - 1); + j += (i + 1) - n; + + + /* X <-- X \xor V_j */ + blkxor(Y, &V[j * s], s); + } + + /* 4: X <-- H(X) */ + blockmix(Y, X, Z, r); + } + } + + /* B' <-- X */ + for (i = 0; i < 2 * r; i++) { + const salsa20_blk_t *src = (const salsa20_blk_t *)&X[i * 8]; + salsa20_blk_t *tmp = (salsa20_blk_t *)Y; + salsa20_blk_t *dst = (salsa20_blk_t *)&B[i * 8]; + for (k = 0; k < 16; k++) + le32enc(&tmp->w[k], src->w[k]); + salsa20_simd_unshuffle(tmp, dst); + } +} + + + +/** + * smix2(B, r, N, Nloop, flags, V, NROM, shared, XY, S): + * Compute second loop of B = SMix_r(B, N). The input B must be 128r bytes in + * length; the temporary storage V must be 128rN bytes in length; the temporary + * storage XY must be 256r + 64 bytes in length. The value N must be a + * power of 2 greater than 1. The value Nloop must be even. + */ +static void +smix2(uint64_t * B, size_t r, uint64_t N, uint64_t Nloop, + yescrypt_flags_t flags, + uint64_t * V, uint64_t NROM, const yescrypt_shared_t * shared, + uint64_t * XY, uint64_t * S) +{ + + void (*blockmix)(const uint64_t *, uint64_t *, uint64_t *, size_t) = + (S ? blockmix_pwxform : blockmix_salsa8); + const uint64_t * VROM = shared->shared1.aligned; + uint32_t VROM_mask = shared->mask1 | 1; + size_t s = 16 * r; + yescrypt_flags_t rw = flags & YESCRYPT_RW; + uint64_t * X = XY; + uint64_t * Y = &XY[s]; + uint64_t * Z = S ? S : &XY[2 * s]; + uint64_t i, j; + size_t k; + + if (Nloop == 0) + return; + + /* X <-- B' */ + for (i = 0; i < 2 * r; i++) { + const salsa20_blk_t *src = (const salsa20_blk_t *)&B[i * 8]; + salsa20_blk_t *tmp = (salsa20_blk_t *)Y; + salsa20_blk_t *dst = (salsa20_blk_t *)&X[i * 8]; + for (k = 0; k < 16; k++) + tmp->w[k] = le32dec(&src->w[k]); + salsa20_simd_shuffle(tmp, dst); + } + if (NROM) { + + /* 6: for i = 0 to N - 1 do */ + for (i = 0; i < Nloop; i += 2) { + /* 7: j <-- Integerify(X) mod N */ + j = integerify(X, r) & (N - 1); + + /* 8: X <-- H(X \xor V_j) */ + blkxor(X, &V[j * s], s); + /* V_j <-- Xprev \xor V_j */ + if (rw) + blkcpy(&V[j * s], X, s); + blockmix(X, Y, Z, r); + + j = integerify(Y, r); + if (((i + 1) & VROM_mask) == 1) { + /* j <-- Integerify(X) mod NROM */ + j &= NROM - 1; + + /* X <-- H(X \xor VROM_j) */ + blkxor(Y, &VROM[j * s], s); + } else { + /* 7: j <-- Integerify(X) mod N */ + j &= N - 1; + + /* 8: X <-- H(X \xor V_j) */ + blkxor(Y, &V[j * s], s); + /* V_j <-- Xprev \xor V_j */ + if (rw) + blkcpy(&V[j * s], Y, s); + } + + blockmix(Y, X, Z, r); + } + } else { + + /* 6: for i = 0 to N - 1 do */ + i = Nloop / 2; + do { + /* 7: j <-- Integerify(X) mod N */ + j = integerify(X, r) & (N - 1); + + /* 8: X <-- H(X \xor V_j) */ + blkxor(X, &V[j * s], s); + /* V_j <-- Xprev \xor V_j */ + if (rw) + blkcpy(&V[j * s], X, s); + blockmix(X, Y, Z, r); + + /* 7: j <-- Integerify(X) mod N */ + j = integerify(Y, r) & (N - 1); + + /* 8: X <-- H(X \xor V_j) */ + blkxor(Y, &V[j * s], s); + /* V_j <-- Xprev \xor V_j */ + if (rw) + blkcpy(&V[j * s], Y, s); + blockmix(Y, X, Z, r); + } while (--i); + } + + /* 10: B' <-- X */ + for (i = 0; i < 2 * r; i++) { + const salsa20_blk_t *src = (const salsa20_blk_t *)&X[i * 8]; + salsa20_blk_t *tmp = (salsa20_blk_t *)Y; + salsa20_blk_t *dst = (salsa20_blk_t *)&B[i * 8]; + for (k = 0; k < 16; k++) + le32enc(&tmp->w[k], src->w[k]); + salsa20_simd_unshuffle(tmp, dst); + } +} + + + + +/** + * p2floor(x): + * Largest power of 2 not greater than argument. + */ +static uint64_t +p2floor(uint64_t x) +{ + uint64_t y; + while ((y = x & (x - 1))) + x = y; + return x; +} + +/** + * smix(B, r, N, p, t, flags, V, NROM, shared, XY, S): + * Compute B = SMix_r(B, N). The input B must be 128rp bytes in length; the + * temporary storage V must be 128rN bytes in length; the temporary storage + * XY must be 256r+64 or (256r+64)*p bytes in length (the larger size is + * required with OpenMP-enabled builds). The value N must be a power of 2 + * greater than 1. + */ +static void +smix(uint64_t * B, size_t r, uint64_t N, uint32_t p, uint32_t t, + yescrypt_flags_t flags, + uint64_t * V, uint64_t NROM, const yescrypt_shared_t * shared, + uint64_t * XY, uint64_t * S) +{ + size_t s = 16 * r; + uint64_t Nchunk = N / p, Nloop_all, Nloop_rw; + uint32_t i; + + Nloop_all = Nchunk; + if (flags & YESCRYPT_RW) { + if (t <= 1) { + if (t) + Nloop_all *= 2; /* 2/3 */ + Nloop_all = (Nloop_all + 2) / 3; /* 1/3, round up */ + } else { + Nloop_all *= t - 1; + } + } else if (t) { + if (t == 1) + Nloop_all += (Nloop_all + 1) / 2; /* 1.5, round up */ + Nloop_all *= t; + } + + Nloop_rw = 0; + if (flags & __YESCRYPT_INIT_SHARED) + Nloop_rw = Nloop_all; + else if (flags & YESCRYPT_RW) + Nloop_rw = Nloop_all / p; + + Nchunk &= ~(uint64_t)1; /* round down to even */ + Nloop_all++; Nloop_all &= ~(uint64_t)1; /* round up to even */ + Nloop_rw &= ~(uint64_t)1; /* round down to even */ + + + for (i = 0; i < p; i++) { + uint64_t Vchunk = i * Nchunk; + uint64_t * Bp = &B[i * s]; + uint64_t * Vp = &V[Vchunk * s]; + uint64_t * XYp = XY; + + uint64_t Np = (i < p - 1) ? Nchunk : (N - Vchunk); + uint64_t * Sp = S ? &S[i * S_SIZE_ALL] : S; + + if (Sp) + smix1(Bp, 1, S_SIZE_ALL / 16, flags & ~YESCRYPT_PWXFORM,Sp, NROM, shared, XYp, NULL); + + + + if (!(flags & __YESCRYPT_INIT_SHARED_2)) + smix1(Bp, r, Np, flags, Vp, NROM, shared, XYp, Sp); + + smix2(Bp, r, p2floor(Np), Nloop_rw, flags, Vp, NROM, shared, XYp, Sp); + } + if (Nloop_all > Nloop_rw) { + + for (i = 0; i < p; i++) { + uint64_t * Bp = &B[i * s]; + + uint64_t * XYp = XY; + + uint64_t * Sp = S ? &S[i * S_SIZE_ALL] : S; + smix2(Bp, r, N, Nloop_all - Nloop_rw,flags & ~YESCRYPT_RW, V, NROM, shared, XYp, Sp); + } + } + +} + +static void +smix_old(uint64_t * B, size_t r, uint64_t N, uint32_t p, uint32_t t, +yescrypt_flags_t flags, +uint64_t * V, uint64_t NROM, const yescrypt_shared_t * shared, +uint64_t * XY, uint64_t * S) +{ + size_t s = 16 * r; + uint64_t Nchunk = N / p, Nloop_all, Nloop_rw; + uint32_t i; + + Nloop_all = Nchunk; + if (flags & YESCRYPT_RW) { + if (t <= 1) { + if (t) + Nloop_all *= 2; /* 2/3 */ + Nloop_all = (Nloop_all + 2) / 3; /* 1/3, round up */ + } + else { + Nloop_all *= t - 1; + } + } + else if (t) { + if (t == 1) + Nloop_all += (Nloop_all + 1) / 2; /* 1.5, round up */ + Nloop_all *= t; + } + + Nloop_rw = 0; + if (flags & __YESCRYPT_INIT_SHARED) + Nloop_rw = Nloop_all; + else if (flags & YESCRYPT_RW) + Nloop_rw = Nloop_all / p; + + Nchunk &= ~(uint64_t)1; /* round down to even */ + Nloop_all++; Nloop_all &= ~(uint64_t)1; /* round up to even */ + Nloop_rw &= ~(uint64_t)1; /* round down to even */ + + + for (i = 0; i < p; i++) { + printf("smix first loop p=%d s=%d Nchunk=%d\n",p,s,(uint32_t)Nchunk); + uint64_t Vchunk = i * Nchunk; + uint64_t * Bp = &B[i * s]; + uint64_t * Vp = &V[Vchunk * s]; + uint64_t * XYp = XY; + printf("beofre XYp[0] %08x %08x XYp[1] %08x %08x\n", ((uint32_t*)XYp)[0], ((uint32_t*)XYp)[1], ((uint32_t*)XYp)[2], ((uint32_t*)XYp)[3]); + + uint64_t Np = (i < p - 1) ? Nchunk : (N - Vchunk); + uint64_t * Sp = S ? &S[i * S_SIZE_ALL] : S; + printf("Np %d beofre Sp[0] %08x %08x Sp[1] %08x %08x\n",(uint32_t)Np, ((uint32_t*)Sp)[0], ((uint32_t*)Sp)[1], ((uint32_t*)Sp)[2], ((uint32_t*)Sp)[3]); + + if (Sp) { + printf("sp condition s_size_all %d\n", S_SIZE_ALL); + smix1(Bp, 1, S_SIZE_ALL / 16, flags & ~YESCRYPT_PWXFORM, Sp, NROM, shared, XYp, NULL); + printf("after XYp[0] %08x %08x XYp[1] %08x %08x\n", ((uint32_t*)XYp)[0], ((uint32_t*)XYp)[1], ((uint32_t*)XYp)[2], ((uint32_t*)XYp)[3]); + printf("after Sp[0] %08x %08x Sp[1] %08x %08x\n", ((uint32_t*)Sp)[0], ((uint32_t*)Sp)[1], ((uint32_t*)Sp)[2], ((uint32_t*)Sp)[3]); + + + } + + + if (!(flags & __YESCRYPT_INIT_SHARED_2)) { + printf("flag condition Np smix1 and smix2 again %d \n", Np); + smix1(Bp, r, Np, flags, Vp, NROM, shared, XYp, Sp); + } + + + smix2(Bp, r, p2floor(Np), Nloop_rw, flags, Vp, NROM, shared, XYp, Sp); + } + + printf("Nloop_all %d Nloop_rw %d\n", Nloop_all, Nloop_rw); + if (Nloop_all > Nloop_rw) { + + for (i = 0; i < p; i++) { + printf("smix second loop p=%d s=%d\n",p,s); + uint64_t * Bp = &B[i * s]; + + uint64_t * XYp = XY; + + uint64_t * Sp = S ? &S[i * S_SIZE_ALL] : S; + smix2(Bp, r, N, Nloop_all - Nloop_rw, flags & ~YESCRYPT_RW, V, NROM, shared, XYp, Sp); + } + } +} + +/** + * yescrypt_kdf(shared, local, passwd, passwdlen, salt, saltlen, + * N, r, p, t, flags, buf, buflen): + * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r, + * p, buflen), or a revision of scrypt as requested by flags and shared, and + * write the result into buf. The parameters r, p, and buflen must satisfy + * r * p < 2^30 and buflen <= (2^32 - 1) * 32. The parameter N must be a power + * of 2 greater than 1. + * + * t controls computation time while not affecting peak memory usage. shared + * and flags may request special modes as described in yescrypt.h. local is + * the thread-local data structure, allowing to preserve and reuse a memory + * allocation across calls, thereby reducing its overhead. + * + * Return 0 on success; or -1 on error. + */ +int +yescrypt_kdf(const yescrypt_shared_t * shared, yescrypt_local_t * local, + const uint8_t * passwd, size_t passwdlen, + const uint8_t * salt, size_t saltlen, + uint64_t N, uint32_t r, uint32_t p, uint32_t t, yescrypt_flags_t flags, + uint8_t * buf, size_t buflen) +{ + yescrypt_region_t tmp; + uint64_t NROM; + size_t B_size, V_size, XY_size, need; + uint64_t * B, * V, * XY, * S; + uint64_t sha256[4]; + + /* + * YESCRYPT_PARALLEL_SMIX is a no-op at p = 1 for its intended purpose, + * so don't let it have side-effects. Without this adjustment, it'd + * enable the SHA-256 password pre-hashing and output post-hashing, + * because any deviation from classic scrypt implies those. + */ + if (p == 1) + flags &= ~YESCRYPT_PARALLEL_SMIX; + + /* Sanity-check parameters */ + if (flags & ~YESCRYPT_KNOWN_FLAGS) { + errno = EINVAL; + return -1; + } +#if SIZE_MAX > UINT32_MAX + if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { + errno = EFBIG; + return -1; + } +#endif + if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) { + errno = EFBIG; + return -1; + } + if (((N & (N - 1)) != 0) || (N <= 1) || (r < 1) || (p < 1)) { + errno = EINVAL; + return -1; + } + if ((flags & YESCRYPT_PARALLEL_SMIX) && (N / p <= 1)) { + errno = EINVAL; + return -1; + } +#if S_MIN_R > 1 + if ((flags & YESCRYPT_PWXFORM) && (r < S_MIN_R)) { + errno = EINVAL; + return -1; + } +#endif + if ((p > SIZE_MAX / ((size_t)256 * r + 64)) || +#if SIZE_MAX / 256 <= UINT32_MAX + (r > SIZE_MAX / 256) || +#endif + (N > SIZE_MAX / 128 / r)) { + errno = ENOMEM; + return -1; + } + if (N > UINT64_MAX / ((uint64_t)t + 1)) { + errno = EFBIG; + return -1; + } + + if ((flags & YESCRYPT_PWXFORM) && + p > SIZE_MAX / (S_SIZE_ALL * sizeof(*S))) { + errno = ENOMEM; + return -1; + } + + NROM = 0; + if (shared->shared1.aligned) { + NROM = shared->shared1.aligned_size / ((size_t)128 * r); + if (((NROM & (NROM - 1)) != 0) || (NROM <= 1) || + !(flags & YESCRYPT_RW)) { + errno = EINVAL; + return -1; + } + } + + /* Allocate memory */ + V = NULL; + V_size = (size_t)128 * r * N; + + need = V_size; + if (flags & __YESCRYPT_INIT_SHARED) { + if (local->aligned_size < need) { + if (local->base || local->aligned || + local->base_size || local->aligned_size) { + errno = EINVAL; + return -1; + } + if (!alloc_region(local, need)) + return -1; + } + V = (uint64_t *)local->aligned; + need = 0; + } + B_size = (size_t)128 * r * p; + need += B_size; + if (need < B_size) { + errno = ENOMEM; + return -1; + } + XY_size = (size_t)256 * r + 64; + + need += XY_size; + if (need < XY_size) { + errno = ENOMEM; + return -1; + } + if (flags & YESCRYPT_PWXFORM) { + size_t S_size = S_SIZE_ALL * sizeof(*S); + + if (flags & YESCRYPT_PARALLEL_SMIX) + S_size *= p; + + need += S_size; + if (need < S_size) { + errno = ENOMEM; + return -1; + } + } + if (flags & __YESCRYPT_INIT_SHARED) { + if (!alloc_region(&tmp, need)) + return -1; + B = (uint64_t *)tmp.aligned; + XY = (uint64_t *)((uint8_t *)B + B_size); + } else { + init_region(&tmp); + if (local->aligned_size < need) { + if (free_region(local)) + return -1; + if (!alloc_region(local, need)) + return -1; + } + B = (uint64_t *)local->aligned; + V = (uint64_t *)((uint8_t *)B + B_size); + XY = (uint64_t *)((uint8_t *)V + V_size); + } + S = NULL; + if (flags & YESCRYPT_PWXFORM) + S = (uint64_t *)((uint8_t *)XY + XY_size); + + + if (t || flags) { + SHA256_CTX_Y ctx; + SHA256_Init_Y(&ctx); + SHA256_Update_Y(&ctx, passwd, passwdlen); + SHA256_Final_Y((uint8_t *)sha256, &ctx); + passwd = (uint8_t *)sha256; + passwdlen = sizeof(sha256); + } + + /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */ + PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1,(uint8_t *)B, B_size); + + if (t || flags) + { + blkcpy(sha256, B, sizeof(sha256) / sizeof(sha256[0])); + } + if (p == 1 || (flags & YESCRYPT_PARALLEL_SMIX)) { + smix(B, r, N, p, t, flags, V, NROM, shared, XY, S); + } else { + uint32_t i; + /* 2: for i = 0 to p - 1 do */ + for (i = 0; i < p; i++) { + /* 3: B_i <-- MF(B_i, N) */ + smix(&B[(size_t)16 * r * i], r, N, 1, t, flags, V, NROM, shared, XY, S); + } + } + + /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ + PBKDF2_SHA256(passwd, passwdlen, (uint8_t *)B, B_size, 1, buf, buflen); + /* + * Except when computing classic scrypt, allow all computation so far + * to be performed on the client. The final steps below match those of + * SCRAM (RFC 5802), so that an extension of SCRAM (with the steps so + * far in place of SCRAM's use of PBKDF2 and with SHA-256 in place of + * SCRAM's use of SHA-1) would be usable with yescrypt hashes. + */ + if ((t || flags) && buflen == sizeof(sha256)) { + /* Compute ClientKey */ + + { + HMAC_SHA256_CTX_Y ctx; + HMAC_SHA256_Init_Y(&ctx, buf, buflen); + HMAC_SHA256_Update_Y(&ctx, salt, saltlen); + HMAC_SHA256_Final_Y((uint8_t *)sha256, &ctx); + } + /* Compute StoredKey */ + { + SHA256_CTX_Y ctx; + SHA256_Init_Y(&ctx); + SHA256_Update_Y(&ctx, (uint8_t *)sha256, sizeof(sha256)); + SHA256_Final_Y(buf, &ctx); + } + } + + if (free_region(&tmp)) + return -1; + + /* Success! */ + return 0; +} + +int +yescrypt_kdf_old(const yescrypt_shared_t * shared, yescrypt_local_t * local, +const uint8_t * passwd, size_t passwdlen, +const uint8_t * salt, size_t saltlen, +uint64_t N, uint32_t r, uint32_t p, uint32_t t, yescrypt_flags_t flags, +uint8_t * buf, size_t buflen) +{ + yescrypt_region_t tmp; + uint64_t NROM; + size_t B_size, V_size, XY_size, need; + uint64_t * B, *V, *XY, *S; + uint64_t sha256[4]; + + /* + * YESCRYPT_PARALLEL_SMIX is a no-op at p = 1 for its intended purpose, + * so don't let it have side-effects. Without this adjustment, it'd + * enable the SHA-256 password pre-hashing and output post-hashing, + * because any deviation from classic scrypt implies those. + */ + if (p == 1) + flags &= ~YESCRYPT_PARALLEL_SMIX; + + /* Sanity-check parameters */ + if (flags & ~YESCRYPT_KNOWN_FLAGS) { + errno = EINVAL; + return -1; + } +#if SIZE_MAX > UINT32_MAX + if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { + errno = EFBIG; + return -1; + } +#endif + if ((uint64_t)(r)* (uint64_t)(p) >= (1 << 30)) { + errno = EFBIG; + return -1; + } + if (((N & (N - 1)) != 0) || (N <= 1) || (r < 1) || (p < 1)) { + errno = EINVAL; + return -1; + } + if ((flags & YESCRYPT_PARALLEL_SMIX) && (N / p <= 1)) { + errno = EINVAL; + return -1; + } +#if S_MIN_R > 1 + if ((flags & YESCRYPT_PWXFORM) && (r < S_MIN_R)) { + errno = EINVAL; + return -1; + } +#endif + if ((p > SIZE_MAX / ((size_t)256 * r + 64)) || +#if SIZE_MAX / 256 <= UINT32_MAX + (r > SIZE_MAX / 256) || +#endif + (N > SIZE_MAX / 128 / r)) { + errno = ENOMEM; + return -1; + } + if (N > UINT64_MAX / ((uint64_t)t + 1)) { + errno = EFBIG; + return -1; + } + + if ((flags & YESCRYPT_PWXFORM) && + p > SIZE_MAX / (S_SIZE_ALL * sizeof(*S))) { + errno = ENOMEM; + return -1; + } + + NROM = 0; + if (shared->shared1.aligned) { + NROM = shared->shared1.aligned_size / ((size_t)128 * r); + if (((NROM & (NROM - 1)) != 0) || (NROM <= 1) || + !(flags & YESCRYPT_RW)) { + errno = EINVAL; + return -1; + } + } + + /* Allocate memory */ + V = NULL; + V_size = (size_t)128 * r * N; + + need = V_size; + if (flags & __YESCRYPT_INIT_SHARED) { + if (local->aligned_size < need) { + if (local->base || local->aligned || + local->base_size || local->aligned_size) { + errno = EINVAL; + return -1; + } + if (!alloc_region(local, need)) + return -1; + } + V = (uint64_t *)local->aligned; + need = 0; + } + B_size = (size_t)128 * r * p; + need += B_size; + if (need < B_size) { + errno = ENOMEM; + return -1; + } + XY_size = (size_t)256 * r + 64; + + need += XY_size; + if (need < XY_size) { + errno = ENOMEM; + return -1; + } + if (flags & YESCRYPT_PWXFORM) { + size_t S_size = S_SIZE_ALL * sizeof(*S); + + if (flags & YESCRYPT_PARALLEL_SMIX) + S_size *= p; + + need += S_size; + if (need < S_size) { + errno = ENOMEM; + return -1; + } + } + if (flags & __YESCRYPT_INIT_SHARED) { + if (!alloc_region(&tmp, need)) + return -1; + B = (uint64_t *)tmp.aligned; + XY = (uint64_t *)((uint8_t *)B + B_size); + printf("yescrypt_init_shared and flag"); + } + else { + printf("NOT yescrypt_init_shared and flag"); + init_region(&tmp); + if (local->aligned_size < need) { + if (free_region(local)) + return -1; + if (!alloc_region(local, need)) + return -1; + } + B = (uint64_t *)local->aligned; + V = (uint64_t *)((uint8_t *)B + B_size); + XY = (uint64_t *)((uint8_t *)V + V_size); + } + S = NULL; + if (flags & YESCRYPT_PWXFORM) + S = (uint64_t *)((uint8_t *)XY + XY_size); + + printf("XY_size %d S_size %d B_size %d V_size %d\n", XY_size, S_SIZE_ALL*sizeof(S), B_size, V_size); + + if (t || flags) { + printf(" first sha t %d flag %d t or flag %d\n", t, flags, (t || flags)); + for (int i = 0; i<10; i++) { printf("i=%d passwd %08x %08x\n",i, ((uint32_t*)passwd)[2 * i], ((uint32_t*)passwd)[2 * i+1]); } + SHA256_CTX_Y ctx; + SHA256_Init_Y(&ctx); + SHA256_Update_Y(&ctx, passwd, passwdlen); + SHA256_Final_Y((uint8_t *)sha256, &ctx); + passwd = (uint8_t *)sha256; + passwdlen = sizeof(sha256); + } + + /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */ + printf("passwdlen=%d saltlen=%d before 1st pbkdf2 B_size %d\n",passwdlen,saltlen, B_size); + PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, (uint8_t *)B, B_size); + //for (int k = 0; k<32; k++) + // printf("k=%d the buf %08x %08x %08x %08x %08x %08x %08x %08x\n", k, ((uint32_t*)B)[8 * k], ((uint32_t*)B)[8 * k + 1], + // ((uint32_t*)B)[8 * k+2], ((uint32_t*)B)[8 * k + 3], + // ((uint32_t*)B)[8 * k+4], ((uint32_t*)B)[8 * k + 5], + // ((uint32_t*)B)[8 * k+6], ((uint32_t*)B)[8 * k + 7]); + + + if (t || flags) + { + printf("before blkcpy count %d\n", sizeof(sha256) / sizeof(sha256[0])); + blkcpy(sha256, B, sizeof(sha256) / sizeof(sha256[0])); + } + printf("after pbkdf2 B0= %08x %08x %08x %08x %08x %08x %08x %08x\n", B[0], B[1], B[2], B[3]); + + printf("before smix p %d flag %d\n", p, (flags & YESCRYPT_PARALLEL_SMIX)); + printf("coef smix r %d N %d p %d t %d flags %d NROM %d\n", r, N, p, t, flags, NROM); + smix(B, r, N, p, t, flags, V, NROM, shared, XY, S); + + + /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ + printf("before 2nd pbkdf2 B_size %d buflen %d\n", B_size); + printf("paswd = %08x %08x %08x %08x\n", ((uint32_t*)passwd)[0], ((uint32_t*)passwd)[1],((uint32_t*)passwd)[2],((uint32_t*)passwd)[3]); + PBKDF2_SHA256(passwd, passwdlen, (uint8_t *)B, B_size, 1, buf, buflen); + printf("after 2nd pbkdf2 B_size %d buflen %d\n", B_size, buflen); + printf("buf = %08x %08x %08x %08x %08x %08x %08x %08x", + ((uint64_t*)buf)[0], ((uint64_t*)buf)[1], ((uint64_t*)buf)[2], ((uint64_t*)buf)[3]); + + /* + * Except when computing classic scrypt, allow all computation so far + * to be performed on the client. The final steps below match those of + * SCRAM (RFC 5802), so that an extension of SCRAM (with the steps so + * far in place of SCRAM's use of PBKDF2 and with SHA-256 in place of + * SCRAM's use of SHA-1) would be usable with yescrypt hashes. + */ + if ((t || flags) && buflen == sizeof(sha256)) { + /* Compute ClientKey */ + printf("compute keys before end the flag %d\n", (t || flags)); + + { + HMAC_SHA256_CTX_Y ctx; + HMAC_SHA256_Init_Y(&ctx, buf, buflen); + HMAC_SHA256_Update_Y(&ctx, salt, saltlen); + HMAC_SHA256_Final_Y((uint8_t *)sha256, &ctx); + } + /* Compute StoredKey */ + { + SHA256_CTX_Y ctx; + SHA256_Init_Y(&ctx); + SHA256_Update_Y(&ctx, (uint8_t *)sha256, sizeof(sha256)); + SHA256_Final_Y(buf, &ctx); + } + } + printf("buf = %08x %08x %08x %08x %08x %08x %08x %08x", + ((uint64_t*)buf)[0], ((uint64_t*)buf)[1], ((uint64_t*)buf)[2], ((uint64_t*)buf)[3]); + + if (free_region(&tmp)) + return -1; + + /* Success! */ + return 0; +} + diff --git a/sph/yescrypt-simd.c b/sph/yescrypt-simd.c new file mode 100644 index 0000000..32c2963 --- /dev/null +++ b/sph/yescrypt-simd.c @@ -0,0 +1,1380 @@ +/*- + * Copyright 2009 Colin Percival + * Copyright 2012-2014 Alexander Peslyak + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ + +/* + * On 64-bit, enabling SSE4.1 helps our pwxform code indirectly, via avoiding + * gcc bug 54349 (fixed for gcc 4.9+). On 32-bit, it's of direct help. AVX + * and XOP are of further help either way. + */ +//#ifndef __SSE4_1__ +//#warning "Consider enabling SSE4.1, AVX, or XOP in the C compiler for significantly better performance" +//#endif + +#include +#ifdef __XOP__ +#include +#endif + +#include +#include +#include +#include + +#include "sha256_Y.h" +#include "sysendian.h" + +#include "sph/yescrypt.h" + +#include "sph/yescrypt-platform.c" + +#if __STDC_VERSION__ >= 199901L +/* have restrict */ +#elif defined(__GNUC__) +#define restrict __restrict +#else +#define restrict +#endif + +#define PREFETCH(x, hint) _mm_prefetch((const char *)(x), (hint)); +#define PREFETCH_OUT(x, hint) /* disabled */ + +#ifdef __XOP__ +#define ARX(out, in1, in2, s) \ + out = _mm_xor_si128(out, _mm_roti_epi32(_mm_add_epi32(in1, in2), s)); +#else +#define ARX(out, in1, in2, s) \ + { \ + __m128i T = _mm_add_epi32(in1, in2); \ + out = _mm_xor_si128(out, _mm_slli_epi32(T, s)); \ + out = _mm_xor_si128(out, _mm_srli_epi32(T, 32-s)); \ + } +#endif + +#define SALSA20_2ROUNDS \ + /* Operate on "columns" */ \ + ARX(X1, X0, X3, 7) \ + ARX(X2, X1, X0, 9) \ + ARX(X3, X2, X1, 13) \ + ARX(X0, X3, X2, 18) \ +\ + /* Rearrange data */ \ + X1 = _mm_shuffle_epi32(X1, 0x93); \ + X2 = _mm_shuffle_epi32(X2, 0x4E); \ + X3 = _mm_shuffle_epi32(X3, 0x39); \ +\ + /* Operate on "rows" */ \ + ARX(X3, X0, X1, 7) \ + ARX(X2, X3, X0, 9) \ + ARX(X1, X2, X3, 13) \ + ARX(X0, X1, X2, 18) \ +\ + /* Rearrange data */ \ + X1 = _mm_shuffle_epi32(X1, 0x39); \ + X2 = _mm_shuffle_epi32(X2, 0x4E); \ + X3 = _mm_shuffle_epi32(X3, 0x93); + +/** + * Apply the salsa20/8 core to the block provided in (X0 ... X3). + */ +#define SALSA20_8_BASE(maybe_decl, out) \ + { \ + maybe_decl Y0 = X0; \ + maybe_decl Y1 = X1; \ + maybe_decl Y2 = X2; \ + maybe_decl Y3 = X3; \ + SALSA20_2ROUNDS \ + SALSA20_2ROUNDS \ + SALSA20_2ROUNDS \ + SALSA20_2ROUNDS \ + (out)[0] = X0 = _mm_add_epi32(X0, Y0); \ + (out)[1] = X1 = _mm_add_epi32(X1, Y1); \ + (out)[2] = X2 = _mm_add_epi32(X2, Y2); \ + (out)[3] = X3 = _mm_add_epi32(X3, Y3); \ + } +#define SALSA20_8(out) \ + SALSA20_8_BASE(__m128i, out) + +/** + * Apply the salsa20/8 core to the block provided in (X0 ... X3) ^ (Z0 ... Z3). + */ +#define SALSA20_8_XOR_ANY(maybe_decl, Z0, Z1, Z2, Z3, out) \ + X0 = _mm_xor_si128(X0, Z0); \ + X1 = _mm_xor_si128(X1, Z1); \ + X2 = _mm_xor_si128(X2, Z2); \ + X3 = _mm_xor_si128(X3, Z3); \ + SALSA20_8_BASE(maybe_decl, out) + +#define SALSA20_8_XOR_MEM(in, out) \ + SALSA20_8_XOR_ANY(__m128i, (in)[0], (in)[1], (in)[2], (in)[3], out) + +#define SALSA20_8_XOR_REG(out) \ + SALSA20_8_XOR_ANY(/* empty */, Y0, Y1, Y2, Y3, out) + +typedef union { + uint32_t w[16]; + __m128i q[4]; +} salsa20_blk_t; + +/** + * blockmix_salsa8(Bin, Bout, r): + * Compute Bout = BlockMix_{salsa20/8, r}(Bin). The input Bin must be 128r + * bytes in length; the output Bout must also be the same size. + */ +static inline void +blockmix_salsa8(const salsa20_blk_t *restrict Bin, + salsa20_blk_t *restrict Bout, size_t r) +{ + __m128i X0, X1, X2, X3; + size_t i; + + r--; + PREFETCH(&Bin[r * 2 + 1], _MM_HINT_T0) + for (i = 0; i < r; i++) { + PREFETCH(&Bin[i * 2], _MM_HINT_T0) + PREFETCH_OUT(&Bout[i], _MM_HINT_T0) + PREFETCH(&Bin[i * 2 + 1], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r + 1 + i], _MM_HINT_T0) + } + PREFETCH(&Bin[r * 2], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r * 2 + 1], _MM_HINT_T0) + + /* 1: X <-- B_{2r - 1} */ + X0 = Bin[r * 2 + 1].q[0]; + X1 = Bin[r * 2 + 1].q[1]; + X2 = Bin[r * 2 + 1].q[2]; + X3 = Bin[r * 2 + 1].q[3]; + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + SALSA20_8_XOR_MEM(Bin[0].q, Bout[0].q) + + /* 2: for i = 0 to 2r - 1 do */ + for (i = 0; i < r;) { + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + SALSA20_8_XOR_MEM(Bin[i * 2 + 1].q, Bout[r + 1 + i].q) + + i++; + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + SALSA20_8_XOR_MEM(Bin[i * 2].q, Bout[i].q) + } + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + SALSA20_8_XOR_MEM(Bin[r * 2 + 1].q, Bout[r * 2 + 1].q) +} + +/* + * (V)PSRLDQ and (V)PSHUFD have higher throughput than (V)PSRLQ on some CPUs + * starting with Sandy Bridge. Additionally, PSHUFD uses separate source and + * destination registers, whereas the shifts would require an extra move + * instruction for our code when building without AVX. Unfortunately, PSHUFD + * is much slower on Conroe (4 cycles latency vs. 1 cycle latency for PSRLQ) + * and somewhat slower on some non-Intel CPUs (luckily not including AMD + * Bulldozer and Piledriver). Since for many other CPUs using (V)PSHUFD is a + * win in terms of throughput or/and not needing a move instruction, we + * currently use it despite of the higher latency on some older CPUs. As an + * alternative, the #if below may be patched to only enable use of (V)PSHUFD + * when building with SSE4.1 or newer, which is not available on older CPUs + * where this instruction has higher latency. + */ +#if 1 +#define HI32(X) \ + _mm_shuffle_epi32((X), _MM_SHUFFLE(2,3,0,1)) +#elif 0 +#define HI32(X) \ + _mm_srli_si128((X), 4) +#else +#define HI32(X) \ + _mm_srli_epi64((X), 32) +#endif + +#if defined(__x86_64__) && (defined(__ICC) || defined(__llvm__)) +/* Intel's name, also supported by recent gcc */ +#define EXTRACT64(X) _mm_cvtsi128_si64(X) +#elif defined(__x86_64__) && !defined(_MSC_VER) && !defined(__OPEN64__) +/* gcc got the 'x' name earlier than non-'x', MSVC and Open64 had bugs */ +#define EXTRACT64(X) _mm_cvtsi128_si64x(X) +#elif defined(__x86_64__) && defined(__SSE4_1__) +/* No known bugs for this intrinsic */ +#include +#define EXTRACT64(X) _mm_extract_epi64((X), 0) +#elif defined(__SSE4_1__) +/* 32-bit */ +#include +#if 0 +/* This is currently unused by the code below, which instead uses these two + * intrinsics explicitly when (!defined(__x86_64__) && defined(__SSE4_1__)) */ +#define EXTRACT64(X) \ + ((uint64_t)(uint32_t)_mm_cvtsi128_si32(X) | \ + ((uint64_t)(uint32_t)_mm_extract_epi32((X), 1) << 32)) +#endif +#else +/* 32-bit or compilers with known past bugs in _mm_cvtsi128_si64*() */ +#define EXTRACT64(X) \ + ((uint64_t)(uint32_t)_mm_cvtsi128_si32(X) | \ + ((uint64_t)(uint32_t)_mm_cvtsi128_si32(HI32(X)) << 32)) +#endif + +/* This is tunable */ +#define S_BITS 8 + +/* Not tunable in this implementation, hard-coded in a few places */ +#define S_SIMD 2 +#define S_P 4 + +/* Number of S-boxes. Not tunable by design, hard-coded in a few places. */ +#define S_N 2 + +/* Derived values. Not tunable except via S_BITS above. */ +#define S_SIZE1 (1 << S_BITS) +#define S_MASK ((S_SIZE1 - 1) * S_SIMD * 8) +#define S_MASK2 (((uint64_t)S_MASK << 32) | S_MASK) +#define S_SIZE_ALL (S_N * S_SIZE1 * S_SIMD * 8) + +#if !defined(__x86_64__) && defined(__SSE4_1__) +/* 32-bit with SSE4.1 */ +#define PWXFORM_X_T __m128i +#define PWXFORM_SIMD(X, x, s0, s1) \ + x = _mm_and_si128(X, _mm_set1_epi64x(S_MASK2)); \ + s0 = *(const __m128i *)(S0 + (uint32_t)_mm_cvtsi128_si32(x)); \ + s1 = *(const __m128i *)(S1 + (uint32_t)_mm_extract_epi32(x, 1)); \ + X = _mm_mul_epu32(HI32(X), X); \ + X = _mm_add_epi64(X, s0); \ + X = _mm_xor_si128(X, s1); +#else +/* 64-bit, or 32-bit without SSE4.1 */ +#define PWXFORM_X_T uint64_t +#define PWXFORM_SIMD(X, x, s0, s1) \ + x = EXTRACT64(X) & S_MASK2; \ + s0 = *(const __m128i *)(S0 + (uint32_t)x); \ + s1 = *(const __m128i *)(S1 + (x >> 32)); \ + X = _mm_mul_epu32(HI32(X), X); \ + X = _mm_add_epi64(X, s0); \ + X = _mm_xor_si128(X, s1); +#endif + +#define PWXFORM_ROUND \ + PWXFORM_SIMD(X0, x0, s00, s01) \ + PWXFORM_SIMD(X1, x1, s10, s11) \ + PWXFORM_SIMD(X2, x2, s20, s21) \ + PWXFORM_SIMD(X3, x3, s30, s31) + +#define PWXFORM \ + { \ + PWXFORM_X_T x0, x1, x2, x3; \ + __m128i s00, s01, s10, s11, s20, s21, s30, s31; \ + PWXFORM_ROUND PWXFORM_ROUND \ + PWXFORM_ROUND PWXFORM_ROUND \ + PWXFORM_ROUND PWXFORM_ROUND \ + } + +#define XOR4(in) \ + X0 = _mm_xor_si128(X0, (in)[0]); \ + X1 = _mm_xor_si128(X1, (in)[1]); \ + X2 = _mm_xor_si128(X2, (in)[2]); \ + X3 = _mm_xor_si128(X3, (in)[3]); + +#define OUT(out) \ + (out)[0] = X0; \ + (out)[1] = X1; \ + (out)[2] = X2; \ + (out)[3] = X3; + +/** + * blockmix_pwxform(Bin, Bout, r, S): + * Compute Bout = BlockMix_pwxform{salsa20/8, r, S}(Bin). The input Bin must + * be 128r bytes in length; the output Bout must also be the same size. + */ +static void +blockmix(const salsa20_blk_t *restrict Bin, salsa20_blk_t *restrict Bout, + size_t r, const __m128i *restrict S) +{ + const uint8_t * S0, * S1; + __m128i X0, X1, X2, X3; + size_t i; + + if (!S) { + blockmix_salsa8(Bin, Bout, r); + return; + } + + S0 = (const uint8_t *)S; + S1 = (const uint8_t *)S + S_SIZE_ALL / 2; + + /* Convert 128-byte blocks to 64-byte blocks */ + r *= 2; + + r--; + PREFETCH(&Bin[r], _MM_HINT_T0) + for (i = 0; i < r; i++) { + PREFETCH(&Bin[i], _MM_HINT_T0) + PREFETCH_OUT(&Bout[i], _MM_HINT_T0) + } + PREFETCH_OUT(&Bout[r], _MM_HINT_T0) + + /* X <-- B_{r1 - 1} */ + X0 = Bin[r].q[0]; + X1 = Bin[r].q[1]; + X2 = Bin[r].q[2]; + X3 = Bin[r].q[3]; + + /* for i = 0 to r1 - 1 do */ + for (i = 0; i < r; i++) { + /* X <-- H'(X \xor B_i) */ + XOR4(Bin[i].q) + PWXFORM + /* B'_i <-- X */ + OUT(Bout[i].q) + } + + /* Last iteration of the loop above */ + XOR4(Bin[i].q) + PWXFORM + + /* B'_i <-- H(B'_i) */ + SALSA20_8(Bout[i].q) +} + +#define XOR4_2(in1, in2) \ + X0 = _mm_xor_si128((in1)[0], (in2)[0]); \ + X1 = _mm_xor_si128((in1)[1], (in2)[1]); \ + X2 = _mm_xor_si128((in1)[2], (in2)[2]); \ + X3 = _mm_xor_si128((in1)[3], (in2)[3]); + +static inline uint32_t +blockmix_salsa8_xor(const salsa20_blk_t *restrict Bin1, + const salsa20_blk_t *restrict Bin2, salsa20_blk_t *restrict Bout, + size_t r, int Bin2_in_ROM) +{ + __m128i X0, X1, X2, X3; + size_t i; + + r--; + if (Bin2_in_ROM) { + PREFETCH(&Bin2[r * 2 + 1], _MM_HINT_NTA) + PREFETCH(&Bin1[r * 2 + 1], _MM_HINT_T0) + for (i = 0; i < r; i++) { + PREFETCH(&Bin2[i * 2], _MM_HINT_NTA) + PREFETCH(&Bin1[i * 2], _MM_HINT_T0) + PREFETCH(&Bin2[i * 2 + 1], _MM_HINT_NTA) + PREFETCH(&Bin1[i * 2 + 1], _MM_HINT_T0) + PREFETCH_OUT(&Bout[i], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r + 1 + i], _MM_HINT_T0) + } + PREFETCH(&Bin2[r * 2], _MM_HINT_T0) + } else { + PREFETCH(&Bin2[r * 2 + 1], _MM_HINT_T0) + PREFETCH(&Bin1[r * 2 + 1], _MM_HINT_T0) + for (i = 0; i < r; i++) { + PREFETCH(&Bin2[i * 2], _MM_HINT_T0) + PREFETCH(&Bin1[i * 2], _MM_HINT_T0) + PREFETCH(&Bin2[i * 2 + 1], _MM_HINT_T0) + PREFETCH(&Bin1[i * 2 + 1], _MM_HINT_T0) + PREFETCH_OUT(&Bout[i], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r + 1 + i], _MM_HINT_T0) + } + PREFETCH(&Bin2[r * 2], _MM_HINT_T0) + } + PREFETCH(&Bin1[r * 2], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r * 2 + 1], _MM_HINT_T0) + + /* 1: X <-- B_{2r - 1} */ + XOR4_2(Bin1[r * 2 + 1].q, Bin2[r * 2 + 1].q) + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + XOR4(Bin1[0].q) + SALSA20_8_XOR_MEM(Bin2[0].q, Bout[0].q) + + /* 2: for i = 0 to 2r - 1 do */ + for (i = 0; i < r;) { + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + XOR4(Bin1[i * 2 + 1].q) + SALSA20_8_XOR_MEM(Bin2[i * 2 + 1].q, Bout[r + 1 + i].q) + + i++; + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + XOR4(Bin1[i * 2].q) + SALSA20_8_XOR_MEM(Bin2[i * 2].q, Bout[i].q) + } + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + XOR4(Bin1[r * 2 + 1].q) + SALSA20_8_XOR_MEM(Bin2[r * 2 + 1].q, Bout[r * 2 + 1].q) + + return _mm_cvtsi128_si32(X0); +} + +static uint32_t +blockmix_xor(const salsa20_blk_t *restrict Bin1, + const salsa20_blk_t *restrict Bin2, salsa20_blk_t *restrict Bout, + size_t r, int Bin2_in_ROM, const __m128i *restrict S) +{ + const uint8_t * S0, * S1; + __m128i X0, X1, X2, X3; + size_t i; + + if (!S) + return blockmix_salsa8_xor(Bin1, Bin2, Bout, r, Bin2_in_ROM); + + S0 = (const uint8_t *)S; + S1 = (const uint8_t *)S + S_SIZE_ALL / 2; + + /* Convert 128-byte blocks to 64-byte blocks */ + r *= 2; + + r--; + if (Bin2_in_ROM) { + PREFETCH(&Bin2[r], _MM_HINT_NTA) + PREFETCH(&Bin1[r], _MM_HINT_T0) + for (i = 0; i < r; i++) { + PREFETCH(&Bin2[i], _MM_HINT_NTA) + PREFETCH(&Bin1[i], _MM_HINT_T0) + PREFETCH_OUT(&Bout[i], _MM_HINT_T0) + } + } else { + PREFETCH(&Bin2[r], _MM_HINT_T0) + PREFETCH(&Bin1[r], _MM_HINT_T0) + for (i = 0; i < r; i++) { + PREFETCH(&Bin2[i], _MM_HINT_T0) + PREFETCH(&Bin1[i], _MM_HINT_T0) + PREFETCH_OUT(&Bout[i], _MM_HINT_T0) + } + } + PREFETCH_OUT(&Bout[r], _MM_HINT_T0); + + /* X <-- B_{r1 - 1} */ + XOR4_2(Bin1[r].q, Bin2[r].q) + + /* for i = 0 to r1 - 1 do */ + for (i = 0; i < r; i++) { + /* X <-- H'(X \xor B_i) */ + XOR4(Bin1[i].q) + XOR4(Bin2[i].q) + PWXFORM + /* B'_i <-- X */ + OUT(Bout[i].q) + } + + /* Last iteration of the loop above */ + XOR4(Bin1[i].q) + XOR4(Bin2[i].q) + PWXFORM + + /* B'_i <-- H(B'_i) */ + SALSA20_8(Bout[i].q) + + return _mm_cvtsi128_si32(X0); +} + +#undef XOR4 +#define XOR4(in, out) \ + (out)[0] = Y0 = _mm_xor_si128((in)[0], (out)[0]); \ + (out)[1] = Y1 = _mm_xor_si128((in)[1], (out)[1]); \ + (out)[2] = Y2 = _mm_xor_si128((in)[2], (out)[2]); \ + (out)[3] = Y3 = _mm_xor_si128((in)[3], (out)[3]); + +static inline uint32_t +blockmix_salsa8_xor_save(const salsa20_blk_t *restrict Bin1, + salsa20_blk_t *restrict Bin2, salsa20_blk_t *restrict Bout, + size_t r) +{ + __m128i X0, X1, X2, X3, Y0, Y1, Y2, Y3; + size_t i; + + r--; + PREFETCH(&Bin2[r * 2 + 1], _MM_HINT_T0) + PREFETCH(&Bin1[r * 2 + 1], _MM_HINT_T0) + for (i = 0; i < r; i++) { + PREFETCH(&Bin2[i * 2], _MM_HINT_T0) + PREFETCH(&Bin1[i * 2], _MM_HINT_T0) + PREFETCH(&Bin2[i * 2 + 1], _MM_HINT_T0) + PREFETCH(&Bin1[i * 2 + 1], _MM_HINT_T0) + PREFETCH_OUT(&Bout[i], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r + 1 + i], _MM_HINT_T0) + } + PREFETCH(&Bin2[r * 2], _MM_HINT_T0) + PREFETCH(&Bin1[r * 2], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r], _MM_HINT_T0) + PREFETCH_OUT(&Bout[r * 2 + 1], _MM_HINT_T0) + + /* 1: X <-- B_{2r - 1} */ + XOR4_2(Bin1[r * 2 + 1].q, Bin2[r * 2 + 1].q) + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + XOR4(Bin1[0].q, Bin2[0].q) + SALSA20_8_XOR_REG(Bout[0].q) + + /* 2: for i = 0 to 2r - 1 do */ + for (i = 0; i < r;) { + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + XOR4(Bin1[i * 2 + 1].q, Bin2[i * 2 + 1].q) + SALSA20_8_XOR_REG(Bout[r + 1 + i].q) + + i++; + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + XOR4(Bin1[i * 2].q, Bin2[i * 2].q) + SALSA20_8_XOR_REG(Bout[i].q) + } + + /* 3: X <-- H(X \xor B_i) */ + /* 4: Y_i <-- X */ + /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ + XOR4(Bin1[r * 2 + 1].q, Bin2[r * 2 + 1].q) + SALSA20_8_XOR_REG(Bout[r * 2 + 1].q) + + return _mm_cvtsi128_si32(X0); +} + +#define XOR4_Y \ + X0 = _mm_xor_si128(X0, Y0); \ + X1 = _mm_xor_si128(X1, Y1); \ + X2 = _mm_xor_si128(X2, Y2); \ + X3 = _mm_xor_si128(X3, Y3); + +static uint32_t +blockmix_xor_save(const salsa20_blk_t *restrict Bin1, + salsa20_blk_t *restrict Bin2, salsa20_blk_t *restrict Bout, + size_t r, const __m128i *restrict S) +{ + const uint8_t * S0, * S1; + __m128i X0, X1, X2, X3, Y0, Y1, Y2, Y3; + size_t i; + + if (!S) + return blockmix_salsa8_xor_save(Bin1, Bin2, Bout, r); + + S0 = (const uint8_t *)S; + S1 = (const uint8_t *)S + S_SIZE_ALL / 2; + + /* Convert 128-byte blocks to 64-byte blocks */ + r *= 2; + + r--; + PREFETCH(&Bin2[r], _MM_HINT_T0) + PREFETCH(&Bin1[r], _MM_HINT_T0) + for (i = 0; i < r; i++) { + PREFETCH(&Bin2[i], _MM_HINT_T0) + PREFETCH(&Bin1[i], _MM_HINT_T0) + PREFETCH_OUT(&Bout[i], _MM_HINT_T0) + } + PREFETCH_OUT(&Bout[r], _MM_HINT_T0); + + /* X <-- B_{r1 - 1} */ + XOR4_2(Bin1[r].q, Bin2[r].q) + + /* for i = 0 to r1 - 1 do */ + for (i = 0; i < r; i++) { + XOR4(Bin1[i].q, Bin2[i].q) + /* X <-- H'(X \xor B_i) */ + XOR4_Y + PWXFORM + /* B'_i <-- X */ + OUT(Bout[i].q) + } + + /* Last iteration of the loop above */ + XOR4(Bin1[i].q, Bin2[i].q) + XOR4_Y + PWXFORM + + /* B'_i <-- H(B'_i) */ + SALSA20_8(Bout[i].q) + + return _mm_cvtsi128_si32(X0); +} + +#undef ARX +#undef SALSA20_2ROUNDS +#undef SALSA20_8 +#undef SALSA20_8_XOR_ANY +#undef SALSA20_8_XOR_MEM +#undef SALSA20_8_XOR_REG +#undef PWXFORM_SIMD_1 +#undef PWXFORM_SIMD_2 +#undef PWXFORM_ROUND +#undef PWXFORM +#undef OUT +#undef XOR4 +#undef XOR4_2 +#undef XOR4_Y + +/** + * integerify(B, r): + * Return the result of parsing B_{2r-1} as a little-endian integer. + */ +static inline uint32_t +integerify(const salsa20_blk_t * B, size_t r) +{ + return B[2 * r - 1].w[0]; +} + +/** + * smix1(B, r, N, flags, V, NROM, shared, XY, S): + * Compute first loop of B = SMix_r(B, N). The input B must be 128r bytes in + * length; the temporary storage V must be 128rN bytes in length; the temporary + * storage XY must be 128r bytes in length. The value N must be even and no + * smaller than 2. The array V must be aligned to a multiple of 64 bytes, and + * arrays B and XY to a multiple of at least 16 bytes (aligning them to 64 + * bytes as well saves cache lines, but might result in cache bank conflicts). + */ +static void +smix1(uint8_t * B, size_t r, uint32_t N, yescrypt_flags_t flags, + salsa20_blk_t * V, uint32_t NROM, const yescrypt_shared_t * shared, + salsa20_blk_t * XY, void * S) +{ + const salsa20_blk_t * VROM = shared->shared1.aligned; + uint32_t VROM_mask = shared->mask1; + size_t s = 2 * r; + salsa20_blk_t * X = V, * Y; + uint32_t i, j; + size_t k; + + /* 1: X <-- B */ + /* 3: V_i <-- X */ + for (k = 0; k < 2 * r; k++) { + for (i = 0; i < 16; i++) { + X[k].w[i] = le32dec(&B[(k * 16 + (i * 5 % 16)) * 4]); + } + } + + if (NROM && (VROM_mask & 1)) { + uint32_t n; + salsa20_blk_t * V_n; + const salsa20_blk_t * V_j; + + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + Y = &V[s]; + blockmix(X, Y, r, S); + + X = &V[2 * s]; + if ((1 & VROM_mask) == 1) { + /* j <-- Integerify(X) mod NROM */ + j = integerify(Y, r) & (NROM - 1); + V_j = &VROM[j * s]; + + /* X <-- H(X \xor VROM_j) */ + j = blockmix_xor(Y, V_j, X, r, 1, S); + } else { + /* X <-- H(X) */ + blockmix(Y, X, r, S); + j = integerify(X, r); + } + + for (n = 2; n < N; n <<= 1) { + uint32_t m = (n < N / 2) ? n : (N - 1 - n); + + V_n = &V[n * s]; + + /* 2: for i = 0 to N - 1 do */ + for (i = 1; i < m; i += 2) { + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += i - 1; + V_j = &V[j * s]; + + /* X <-- X \xor V_j */ + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + Y = &V_n[i * s]; + j = blockmix_xor(X, V_j, Y, r, 0, S); + + if (((n + i) & VROM_mask) == 1) { + /* j <-- Integerify(X) mod NROM */ + j &= NROM - 1; + V_j = &VROM[j * s]; + } else { + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += i; + V_j = &V[j * s]; + } + + /* X <-- H(X \xor VROM_j) */ + X = &V_n[(i + 1) * s]; + j = blockmix_xor(Y, V_j, X, r, 1, S); + } + } + + n >>= 1; + + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += N - 2 - n; + V_j = &V[j * s]; + + /* X <-- X \xor V_j */ + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + Y = &V[(N - 1) * s]; + j = blockmix_xor(X, V_j, Y, r, 0, S); + + if (((N - 1) & VROM_mask) == 1) { + /* j <-- Integerify(X) mod NROM */ + j &= NROM - 1; + V_j = &VROM[j * s]; + } else { + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += N - 1 - n; + V_j = &V[j * s]; + } + + /* X <-- X \xor V_j */ + /* 4: X <-- H(X) */ + X = XY; + blockmix_xor(Y, V_j, X, r, 1, S); + } else if (flags & YESCRYPT_RW) { + uint32_t n; + salsa20_blk_t * V_n, * V_j; + + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + Y = &V[s]; + blockmix(X, Y, r, S); + + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + X = &V[2 * s]; + blockmix(Y, X, r, S); + j = integerify(X, r); + + for (n = 2; n < N; n <<= 1) { + uint32_t m = (n < N / 2) ? n : (N - 1 - n); + + V_n = &V[n * s]; + + /* 2: for i = 0 to N - 1 do */ + for (i = 1; i < m; i += 2) { + Y = &V_n[i * s]; + + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += i - 1; + V_j = &V[j * s]; + + /* X <-- X \xor V_j */ + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + j = blockmix_xor(X, V_j, Y, r, 0, S); + + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += i; + V_j = &V[j * s]; + + /* X <-- X \xor V_j */ + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + X = &V_n[(i + 1) * s]; + j = blockmix_xor(Y, V_j, X, r, 0, S); + } + } + + n >>= 1; + + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += N - 2 - n; + V_j = &V[j * s]; + + /* X <-- X \xor V_j */ + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + Y = &V[(N - 1) * s]; + j = blockmix_xor(X, V_j, Y, r, 0, S); + + /* j <-- Wrap(Integerify(X), i) */ + j &= n - 1; + j += N - 1 - n; + V_j = &V[j * s]; + + /* X <-- X \xor V_j */ + /* 4: X <-- H(X) */ + X = XY; + blockmix_xor(Y, V_j, X, r, 0, S); + } else { + /* 2: for i = 0 to N - 1 do */ + for (i = 1; i < N - 1; i += 2) { + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + Y = &V[i * s]; + blockmix(X, Y, r, S); + + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + X = &V[(i + 1) * s]; + blockmix(Y, X, r, S); + } + + /* 4: X <-- H(X) */ + /* 3: V_i <-- X */ + Y = &V[i * s]; + blockmix(X, Y, r, S); + + /* 4: X <-- H(X) */ + X = XY; + blockmix(Y, X, r, S); + } + + /* B' <-- X */ + for (k = 0; k < 2 * r; k++) { + for (i = 0; i < 16; i++) { + le32enc(&B[(k * 16 + (i * 5 % 16)) * 4], X[k].w[i]); + } + } +} + +/** + * smix2(B, r, N, Nloop, flags, V, NROM, shared, XY, S): + * Compute second loop of B = SMix_r(B, N). The input B must be 128r bytes in + * length; the temporary storage V must be 128rN bytes in length; the temporary + * storage XY must be 256r bytes in length. The value N must be a power of 2 + * greater than 1. The value Nloop must be even. The array V must be aligned + * to a multiple of 64 bytes, and arrays B and XY to a multiple of at least 16 + * bytes (aligning them to 64 bytes as well saves cache lines, but might result + * in cache bank conflicts). + */ +static void +smix2(uint8_t * B, size_t r, uint32_t N, uint64_t Nloop, + yescrypt_flags_t flags, salsa20_blk_t * V, uint32_t NROM, + const yescrypt_shared_t * shared, salsa20_blk_t * XY, void * S) +{ + const salsa20_blk_t * VROM = shared->shared1.aligned; + uint32_t VROM_mask = shared->mask1; + size_t s = 2 * r; + salsa20_blk_t * X = XY, * Y = &XY[s]; + uint64_t i; + uint32_t j; + size_t k; + + if (Nloop == 0) + return; + + /* X <-- B' */ + /* 3: V_i <-- X */ + for (k = 0; k < 2 * r; k++) { + for (i = 0; i < 16; i++) { + X[k].w[i] = le32dec(&B[(k * 16 + (i * 5 % 16)) * 4]); + } + } + + i = Nloop / 2; + + /* 7: j <-- Integerify(X) mod N */ + j = integerify(X, r) & (N - 1); + +/* + * Normally, NROM implies YESCRYPT_RW, but we check for these separately + * because YESCRYPT_PARALLEL_SMIX resets YESCRYPT_RW for the smix2() calls + * operating on the entire V. + */ + if (NROM && (flags & YESCRYPT_RW)) { + /* 6: for i = 0 to N - 1 do */ + for (i = 0; i < Nloop; i += 2) { + salsa20_blk_t * V_j = &V[j * s]; + + /* 8: X <-- H(X \xor V_j) */ + /* V_j <-- Xprev \xor V_j */ + /* j <-- Integerify(X) mod NROM */ + j = blockmix_xor_save(X, V_j, Y, r, S); + + if (((i + 1) & VROM_mask) == 1) { + const salsa20_blk_t * VROM_j; + + j &= NROM - 1; + VROM_j = &VROM[j * s]; + + /* X <-- H(X \xor VROM_j) */ + /* 7: j <-- Integerify(X) mod N */ + j = blockmix_xor(Y, VROM_j, X, r, 1, S); + } else { + j &= N - 1; + V_j = &V[j * s]; + + /* 8: X <-- H(X \xor V_j) */ + /* V_j <-- Xprev \xor V_j */ + /* j <-- Integerify(X) mod NROM */ + j = blockmix_xor_save(Y, V_j, X, r, S); + } + j &= N - 1; + V_j = &V[j * s]; + } + } else if (NROM) { + /* 6: for i = 0 to N - 1 do */ + for (i = 0; i < Nloop; i += 2) { + const salsa20_blk_t * V_j = &V[j * s]; + + /* 8: X <-- H(X \xor V_j) */ + /* V_j <-- Xprev \xor V_j */ + /* j <-- Integerify(X) mod NROM */ + j = blockmix_xor(X, V_j, Y, r, 0, S); + + if (((i + 1) & VROM_mask) == 1) { + j &= NROM - 1; + V_j = &VROM[j * s]; + } else { + j &= N - 1; + V_j = &V[j * s]; + } + + /* X <-- H(X \xor VROM_j) */ + /* 7: j <-- Integerify(X) mod N */ + j = blockmix_xor(Y, V_j, X, r, 1, S); + j &= N - 1; + V_j = &V[j * s]; + } + } else if (flags & YESCRYPT_RW) { + /* 6: for i = 0 to N - 1 do */ + do { + salsa20_blk_t * V_j = &V[j * s]; + + /* 8: X <-- H(X \xor V_j) */ + /* V_j <-- Xprev \xor V_j */ + /* 7: j <-- Integerify(X) mod N */ + j = blockmix_xor_save(X, V_j, Y, r, S); + j &= N - 1; + V_j = &V[j * s]; + + /* 8: X <-- H(X \xor V_j) */ + /* V_j <-- Xprev \xor V_j */ + /* 7: j <-- Integerify(X) mod N */ + j = blockmix_xor_save(Y, V_j, X, r, S); + j &= N - 1; + } while (--i); + } else { + /* 6: for i = 0 to N - 1 do */ + do { + const salsa20_blk_t * V_j = &V[j * s]; + + /* 8: X <-- H(X \xor V_j) */ + /* 7: j <-- Integerify(X) mod N */ + j = blockmix_xor(X, V_j, Y, r, 0, S); + j &= N - 1; + V_j = &V[j * s]; + + /* 8: X <-- H(X \xor V_j) */ + /* 7: j <-- Integerify(X) mod N */ + j = blockmix_xor(Y, V_j, X, r, 0, S); + j &= N - 1; + } while (--i); + } + + /* 10: B' <-- X */ + for (k = 0; k < 2 * r; k++) { + for (i = 0; i < 16; i++) { + le32enc(&B[(k * 16 + (i * 5 % 16)) * 4], X[k].w[i]); + } + } +} + +/** + * p2floor(x): + * Largest power of 2 not greater than argument. + */ +static uint64_t +p2floor(uint64_t x) +{ + uint64_t y; + while ((y = x & (x - 1))) + x = y; + return x; +} + +/** + * smix(B, r, N, p, t, flags, V, NROM, shared, XY, S): + * Compute B = SMix_r(B, N). The input B must be 128rp bytes in length; the + * temporary storage V must be 128rN bytes in length; the temporary storage XY + * must be 256r or 256rp bytes in length (the larger size is required with + * OpenMP-enabled builds). The value N must be a power of 2 greater than 1. + * The array V must be aligned to a multiple of 64 bytes, and arrays B and + * XY to a multiple of at least 16 bytes (aligning them to 64 bytes as well + * saves cache lines and helps avoid false sharing in OpenMP-enabled builds + * when p > 1, but it might also result in cache bank conflicts). + */ +static void +smix(uint8_t * B, size_t r, uint32_t N, uint32_t p, uint32_t t, + yescrypt_flags_t flags, + salsa20_blk_t * V, uint32_t NROM, const yescrypt_shared_t * shared, + salsa20_blk_t * XY, void * S) +{ + size_t s = 2 * r; + uint32_t Nchunk = N / p; + uint64_t Nloop_all, Nloop_rw; + uint32_t i; + + Nloop_all = Nchunk; + if (flags & YESCRYPT_RW) { + if (t <= 1) { + if (t) + Nloop_all *= 2; /* 2/3 */ + Nloop_all = (Nloop_all + 2) / 3; /* 1/3, round up */ + } else { + Nloop_all *= t - 1; + } + } else if (t) { + if (t == 1) + Nloop_all += (Nloop_all + 1) / 2; /* 1.5, round up */ + Nloop_all *= t; + } + + Nloop_rw = 0; + if (flags & __YESCRYPT_INIT_SHARED) + Nloop_rw = Nloop_all; + else if (flags & YESCRYPT_RW) + Nloop_rw = Nloop_all / p; + + Nchunk &= ~(uint32_t)1; /* round down to even */ + Nloop_all++; Nloop_all &= ~(uint64_t)1; /* round up to even */ + Nloop_rw &= ~(uint64_t)1; /* round down to even */ + +#ifdef _OPENMP +#pragma omp parallel if (p > 1) default(none) private(i) shared(B, r, N, p, flags, V, NROM, shared, XY, S, s, Nchunk, Nloop_all, Nloop_rw) + { +#pragma omp for +#endif + for (i = 0; i < p; i++) { + uint32_t Vchunk = i * Nchunk; + uint8_t * Bp = &B[128 * r * i]; + salsa20_blk_t * Vp = &V[Vchunk * s]; +#ifdef _OPENMP + salsa20_blk_t * XYp = &XY[i * (2 * s)]; +#else + salsa20_blk_t * XYp = XY; +#endif + uint32_t Np = (i < p - 1) ? Nchunk : (N - Vchunk); + void * Sp = S ? ((uint8_t *)S + i * S_SIZE_ALL) : S; + if (Sp) + smix1(Bp, 1, S_SIZE_ALL / 128, + flags & ~YESCRYPT_PWXFORM, + Sp, NROM, shared, XYp, NULL); + if (!(flags & __YESCRYPT_INIT_SHARED_2)) + smix1(Bp, r, Np, flags, Vp, NROM, shared, XYp, Sp); + smix2(Bp, r, p2floor(Np), Nloop_rw, flags, Vp, + NROM, shared, XYp, Sp); + } + + if (Nloop_all > Nloop_rw) { +#ifdef _OPENMP +#pragma omp for +#endif + for (i = 0; i < p; i++) { + uint8_t * Bp = &B[128 * r * i]; +#ifdef _OPENMP + salsa20_blk_t * XYp = &XY[i * (2 * s)]; +#else + salsa20_blk_t * XYp = XY; +#endif + void * Sp = S ? ((uint8_t *)S + i * S_SIZE_ALL) : S; + smix2(Bp, r, N, Nloop_all - Nloop_rw, + flags & ~YESCRYPT_RW, V, NROM, shared, XYp, Sp); + } + } +#ifdef _OPENMP + } +#endif +} + +/** + * yescrypt_kdf(shared, local, passwd, passwdlen, salt, saltlen, + * N, r, p, t, flags, buf, buflen): + * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r, + * p, buflen), or a revision of scrypt as requested by flags and shared, and + * write the result into buf. The parameters r, p, and buflen must satisfy + * r * p < 2^30 and buflen <= (2^32 - 1) * 32. The parameter N must be a power + * of 2 greater than 1. (This optimized implementation currently additionally + * limits N to the range from 8 to 2^31, but other implementation might not.) + * + * t controls computation time while not affecting peak memory usage. shared + * and flags may request special modes as described in yescrypt.h. local is + * the thread-local data structure, allowing to preserve and reuse a memory + * allocation across calls, thereby reducing its overhead. + * + * Return 0 on success; or -1 on error. + */ +int +yescrypt_kdf(const yescrypt_shared_t * shared, yescrypt_local_t * local, + const uint8_t * passwd, size_t passwdlen, + const uint8_t * salt, size_t saltlen, + uint64_t N, uint32_t r, uint32_t p, uint32_t t, yescrypt_flags_t flags, + uint8_t * buf, size_t buflen) +{ + yescrypt_region_t tmp; + uint64_t NROM; + size_t B_size, V_size, XY_size, need; + uint8_t * B, * S; + salsa20_blk_t * V, * XY; + uint8_t sha256[32]; + + /* + * YESCRYPT_PARALLEL_SMIX is a no-op at p = 1 for its intended purpose, + * so don't let it have side-effects. Without this adjustment, it'd + * enable the SHA-256 password pre-hashing and output post-hashing, + * because any deviation from classic scrypt implies those. + */ + if (p == 1) + flags &= ~YESCRYPT_PARALLEL_SMIX; + + /* Sanity-check parameters */ + if (flags & ~YESCRYPT_KNOWN_FLAGS) { + errno = EINVAL; + return -1; + } +#if SIZE_MAX > UINT32_MAX + if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { + errno = EFBIG; + return -1; + } +#endif + if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) { + errno = EFBIG; + return -1; + } + if (N > UINT32_MAX) { + errno = EFBIG; + return -1; + } + if (((N & (N - 1)) != 0) || (N <= 7) || (r < 1) || (p < 1)) { + errno = EINVAL; + return -1; + } + if ((flags & YESCRYPT_PARALLEL_SMIX) && (N / p <= 7)) { + errno = EINVAL; + return -1; + } + if ((r > SIZE_MAX / 256 / p) || + (N > SIZE_MAX / 128 / r)) { + errno = ENOMEM; + return -1; + } +#ifdef _OPENMP + if (!(flags & YESCRYPT_PARALLEL_SMIX) && + (N > SIZE_MAX / 128 / (r * p))) { + errno = ENOMEM; + return -1; + } +#endif + if ((flags & YESCRYPT_PWXFORM) && +#ifndef _OPENMP + (flags & YESCRYPT_PARALLEL_SMIX) && +#endif + p > SIZE_MAX / S_SIZE_ALL) { + errno = ENOMEM; + return -1; + } + + NROM = 0; + if (shared->shared1.aligned) { + NROM = shared->shared1.aligned_size / ((size_t)128 * r); + if (NROM > UINT32_MAX) { + errno = EFBIG; + return -1; + } + if (((NROM & (NROM - 1)) != 0) || (NROM <= 7) || + !(flags & YESCRYPT_RW)) { + errno = EINVAL; + return -1; + } + } + + /* Allocate memory */ + V = NULL; + V_size = (size_t)128 * r * N; +#ifdef _OPENMP + if (!(flags & YESCRYPT_PARALLEL_SMIX)) + V_size *= p; +#endif + need = V_size; + if (flags & __YESCRYPT_INIT_SHARED) { + if (local->aligned_size < need) { + if (local->base || local->aligned || + local->base_size || local->aligned_size) { + errno = EINVAL; + return -1; + } + if (!alloc_region(local, need)) + return -1; + } + V = (salsa20_blk_t *)local->aligned; + need = 0; + } + B_size = (size_t)128 * r * p; + need += B_size; + if (need < B_size) { + errno = ENOMEM; + return -1; + } + XY_size = (size_t)256 * r; +#ifdef _OPENMP + XY_size *= p; +#endif + need += XY_size; + if (need < XY_size) { + errno = ENOMEM; + return -1; + } + if (flags & YESCRYPT_PWXFORM) { + size_t S_size = S_SIZE_ALL; +#ifdef _OPENMP + S_size *= p; +#else + if (flags & YESCRYPT_PARALLEL_SMIX) + S_size *= p; +#endif + need += S_size; + if (need < S_size) { + errno = ENOMEM; + return -1; + } + } + if (flags & __YESCRYPT_INIT_SHARED) { + if (!alloc_region(&tmp, need)) + return -1; + B = (uint8_t *)tmp.aligned; + XY = (salsa20_blk_t *)((uint8_t *)B + B_size); + } else { + init_region(&tmp); + if (local->aligned_size < need) { + if (free_region(local)) + return -1; + if (!alloc_region(local, need)) + return -1; + } + B = (uint8_t *)local->aligned; + V = (salsa20_blk_t *)((uint8_t *)B + B_size); + XY = (salsa20_blk_t *)((uint8_t *)V + V_size); + } + S = NULL; + if (flags & YESCRYPT_PWXFORM) + S = (uint8_t *)XY + XY_size; + + if (t || flags) { + SHA256_CTX_Y ctx; + SHA256_Init_Y(&ctx); + SHA256_Update_Y(&ctx, passwd, passwdlen); + SHA256_Final_Y(sha256, &ctx); + passwd = sha256; + passwdlen = sizeof(sha256); + } + + /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */ + PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, B_size); + + if (t || flags) + memcpy(sha256, B, sizeof(sha256)); + + if (p == 1 || (flags & YESCRYPT_PARALLEL_SMIX)) { + smix(B, r, N, p, t, flags, V, NROM, shared, XY, S); + } else { + uint32_t i; + + /* 2: for i = 0 to p - 1 do */ +#ifdef _OPENMP +#pragma omp parallel for default(none) private(i) shared(B, r, N, p, t, flags, V, NROM, shared, XY, S) +#endif + for (i = 0; i < p; i++) { + /* 3: B_i <-- MF(B_i, N) */ +#ifdef _OPENMP + smix(&B[(size_t)128 * r * i], r, N, 1, t, flags, + &V[(size_t)2 * r * i * N], + NROM, shared, + &XY[(size_t)4 * r * i], + S ? &S[S_SIZE_ALL * i] : S); +#else + smix(&B[(size_t)128 * r * i], r, N, 1, t, flags, V, + NROM, shared, XY, S); +#endif + } + } + + /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ + PBKDF2_SHA256(passwd, passwdlen, B, B_size, 1, buf, buflen); + + /* + * Except when computing classic scrypt, allow all computation so far + * to be performed on the client. The final steps below match those of + * SCRAM (RFC 5802), so that an extension of SCRAM (with the steps so + * far in place of SCRAM's use of PBKDF2 and with SHA-256 in place of + * SCRAM's use of SHA-1) would be usable with yescrypt hashes. + */ + if ((t || flags) && buflen == sizeof(sha256)) { + /* Compute ClientKey */ + { + HMAC_SHA256_CTX_Y ctx; + HMAC_SHA256_Init_Y(&ctx, buf, buflen); +#if 0 +/* Proper yescrypt */ + HMAC_SHA256_Update_Y(&ctx, "Client Key", 10); +#else +/* GlobalBoost-Y buggy yescrypt */ + HMAC_SHA256_Update_Y(&ctx, salt, saltlen); +#endif + HMAC_SHA256_Final_Y(sha256, &ctx); + } + /* Compute StoredKey */ + { + SHA256_CTX_Y ctx; + SHA256_Init_Y(&ctx); + SHA256_Update_Y(&ctx, sha256, sizeof(sha256)); + SHA256_Final_Y(buf, &ctx); + } + } + + if (free_region(&tmp)) + return -1; + + /* Success! */ + return 0; +} diff --git a/sph/yescrypt.h b/sph/yescrypt.h new file mode 100644 index 0000000..6512258 --- /dev/null +++ b/sph/yescrypt.h @@ -0,0 +1,376 @@ +/*- + * Copyright 2009 Colin Percival + * Copyright 2013,2014 Alexander Peslyak + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ +#ifndef _YESCRYPT_H_ +#define _YESCRYPT_H_ + +#include +#include /* for size_t */ +#include + +//#ifdef __cplusplus +//extern "C" { +//#endif + + +//extern void yescrypt_hash_sp(const unsigned char *input, unsigned char *output); +extern void yescrypt_hash(const unsigned char *input, unsigned char *output); + + + +/** + * crypto_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen): + * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r, + * p, buflen) and write the result into buf. The parameters r, p, and buflen + * must satisfy r * p < 2^30 and buflen <= (2^32 - 1) * 32. The parameter N + * must be a power of 2 greater than 1. + * + * Return 0 on success; or -1 on error. + * + * MT-safe as long as buf is local to the thread. + */ +extern int crypto_scrypt(const uint8_t * __passwd, size_t __passwdlen, + const uint8_t * __salt, size_t __saltlen, + uint64_t __N, uint32_t __r, uint32_t __p, + uint8_t * __buf, size_t __buflen); + +/** + * Internal type used by the memory allocator. Please do not use it directly. + * Use yescrypt_shared_t and yescrypt_local_t as appropriate instead, since + * they might differ from each other in a future version. + */ +typedef struct { + void * base, * aligned; + size_t base_size, aligned_size; +} yescrypt_region_t; + +/** + * Types for shared (ROM) and thread-local (RAM) data structures. + */ +typedef yescrypt_region_t yescrypt_shared1_t; +typedef struct { + yescrypt_shared1_t shared1; + uint32_t mask1; +} yescrypt_shared_t; +typedef yescrypt_region_t yescrypt_local_t; + +/** + * Possible values for yescrypt_init_shared()'s flags argument. + */ +typedef enum { + YESCRYPT_SHARED_DEFAULTS = 0, + YESCRYPT_SHARED_PREALLOCATED = 0x100 +} yescrypt_init_shared_flags_t; + +/** + * Possible values for the flags argument of yescrypt_kdf(), + * yescrypt_gensalt_r(), yescrypt_gensalt(). These may be OR'ed together, + * except that YESCRYPT_WORM and YESCRYPT_RW are mutually exclusive. + * Please refer to the description of yescrypt_kdf() below for the meaning of + * these flags. + */ +typedef enum { +/* public */ + YESCRYPT_WORM = 0, + YESCRYPT_RW = 1, + YESCRYPT_PARALLEL_SMIX = 2, + YESCRYPT_PWXFORM = 4, +/* private */ + __YESCRYPT_INIT_SHARED_1 = 0x10000, + __YESCRYPT_INIT_SHARED_2 = 0x20000, + __YESCRYPT_INIT_SHARED = 0x30000 +} yescrypt_flags_t; + +#define YESCRYPT_KNOWN_FLAGS \ + (YESCRYPT_RW | YESCRYPT_PARALLEL_SMIX | YESCRYPT_PWXFORM | \ + __YESCRYPT_INIT_SHARED) + +/** + * yescrypt_init_shared(shared, param, paramlen, N, r, p, flags, mask, + * buf, buflen): + * Optionally allocate memory for and initialize the shared (ROM) data + * structure. The parameters N, r, and p must satisfy the same conditions as + * with crypto_scrypt(). param and paramlen specify a local parameter with + * which the ROM is seeded. If buf is not NULL, then it is used to return + * buflen bytes of message digest for the initialized ROM (the caller may use + * this to verify that the ROM has been computed in the same way that it was on + * a previous run). + * + * Return 0 on success; or -1 on error. + * + * If bit YESCRYPT_SHARED_PREALLOCATED in flags is set, then memory for the + * ROM is assumed to have been preallocated by the caller, with + * shared->shared1.aligned being the start address of the ROM and + * shared->shared1.aligned_size being its size (which must be consistent with + * N, r, and p). This may be used e.g. when the ROM is to be placed in a SysV + * shared memory segment allocated by the caller. + * + * mask controls the frequency of ROM accesses by yescrypt_kdf(). Normally it + * should be set to 1, to interleave RAM and ROM accesses, which works well + * when both regions reside in the machine's RAM anyway. Other values may be + * used e.g. when the ROM is memory-mapped from a disk file. Recommended mask + * values are powers of 2 minus 1 or minus 2. Here's the effect of some mask + * values: + * mask value ROM accesses in SMix 1st loop ROM accesses in SMix 2nd loop + * 0 0 1/2 + * 1 1/2 1/2 + * 2 0 1/4 + * 3 1/4 1/4 + * 6 0 1/8 + * 7 1/8 1/8 + * 14 0 1/16 + * 15 1/16 1/16 + * 1022 0 1/1024 + * 1023 1/1024 1/1024 + * + * Actual computation of the ROM contents may be avoided, if you don't intend + * to use a ROM but need a dummy shared structure, by calling this function + * with NULL, 0, 0, 0, 0, YESCRYPT_SHARED_DEFAULTS, 0, NULL, 0 for the + * arguments starting with param and on. + * + * MT-safe as long as shared is local to the thread. + */ +extern int yescrypt_init_shared(yescrypt_shared_t * __shared, + const uint8_t * __param, size_t __paramlen, + uint64_t __N, uint32_t __r, uint32_t __p, + yescrypt_init_shared_flags_t __flags, uint32_t __mask, + uint8_t * __buf, size_t __buflen); + +/** + * yescrypt_free_shared(shared): + * Free memory that had been allocated with yescrypt_init_shared(). + * + * Return 0 on success; or -1 on error. + * + * MT-safe as long as shared is local to the thread. + */ +extern int yescrypt_free_shared(yescrypt_shared_t * __shared); + +/** + * yescrypt_init_local(local): + * Initialize the thread-local (RAM) data structure. Actual memory allocation + * is currently fully postponed until a call to yescrypt_kdf() or yescrypt_r(). + * + * Return 0 on success; or -1 on error. + * + * MT-safe as long as local is local to the thread. + */ +extern int yescrypt_init_local(yescrypt_local_t * __local); + +/** + * yescrypt_free_local(local): + * Free memory that may have been allocated for an initialized thread-local + * (RAM) data structure. + * + * Return 0 on success; or -1 on error. + * + * MT-safe as long as local is local to the thread. + */ +extern int yescrypt_free_local(yescrypt_local_t * __local); + +/** + * yescrypt_kdf(shared, local, passwd, passwdlen, salt, saltlen, + * N, r, p, t, flags, buf, buflen): + * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r, + * p, buflen), or a revision of scrypt as requested by flags and shared, and + * write the result into buf. The parameters N, r, p, and buflen must satisfy + * the same conditions as with crypto_scrypt(). t controls computation time + * while not affecting peak memory usage. shared and flags may request + * special modes as described below. local is the thread-local data + * structure, allowing to preserve and reuse a memory allocation across calls, + * thereby reducing its overhead. + * + * Return 0 on success; or -1 on error. + * + * t controls computation time. t = 0 is optimal in terms of achieving the + * highest area-time for ASIC attackers. Thus, higher computation time, if + * affordable, is best achieved by increasing N rather than by increasing t. + * However, if the higher memory usage (which goes along with higher N) is not + * affordable, or if fine-tuning of the time is needed (recall that N must be a + * power of 2), then t = 1 or above may be used to increase time while staying + * at the same peak memory usage. t = 1 increases the time by 25% and + * decreases the normalized area-time to 96% of optimal. (Of course, in + * absolute terms the area-time increases with higher t. It's just that it + * would increase slightly more with higher N*r rather than with higher t.) + * t = 2 increases the time by another 20% and decreases the normalized + * area-time to 89% of optimal. Thus, these two values are reasonable to use + * for fine-tuning. Values of t higher than 2 result in further increase in + * time while reducing the efficiency much further (e.g., down to around 50% of + * optimal for t = 5, which runs 3 to 4 times slower than t = 0, with exact + * numbers varying by the flags settings). + * + * Classic scrypt is available by setting t = 0 and flags to YESCRYPT_WORM and + * passing a dummy shared structure (see the description of + * yescrypt_init_shared() above for how to produce one). In this mode, the + * thread-local memory region (RAM) is first sequentially written to and then + * randomly read from. This algorithm is friendly towards time-memory + * tradeoffs (TMTO), available both to defenders (albeit not in this + * implementation) and to attackers. + * + * Setting YESCRYPT_RW adds extra random reads and writes to the thread-local + * memory region (RAM), which makes TMTO a lot less efficient. This may be + * used to slow down the kinds of attackers who would otherwise benefit from + * classic scrypt's efficient TMTO. Since classic scrypt's TMTO allows not + * only for the tradeoff, but also for a decrease of attacker's area-time (by + * up to a constant factor), setting YESCRYPT_RW substantially increases the + * cost of attacks in area-time terms as well. Yet another benefit of it is + * that optimal area-time is reached at an earlier time than with classic + * scrypt, and t = 0 actually corresponds to this earlier completion time, + * resulting in quicker hash computations (and thus in higher request rate + * capacity). Due to these properties, YESCRYPT_RW should almost always be + * set, except when compatibility with classic scrypt or TMTO-friendliness are + * desired. + * + * YESCRYPT_PARALLEL_SMIX moves parallelism that is present with p > 1 to a + * lower level as compared to where it is in classic scrypt. This reduces + * flexibility for efficient computation (for both attackers and defenders) by + * requiring that, short of resorting to TMTO, the full amount of memory be + * allocated as needed for the specified p, regardless of whether that + * parallelism is actually being fully made use of or not. (For comparison, a + * single instance of classic scrypt may be computed in less memory without any + * CPU time overhead, but in more real time, by not making full use of the + * parallelism.) This may be desirable when the defender has enough memory + * with sufficiently low latency and high bandwidth for efficient full parallel + * execution, yet the required memory size is high enough that some likely + * attackers might end up being forced to choose between using higher latency + * memory than they could use otherwise (waiting for data longer) or using TMTO + * (waiting for data more times per one hash computation). The area-time cost + * for other kinds of attackers (who would use the same memory type and TMTO + * factor or no TMTO either way) remains roughly the same, given the same + * running time for the defender. In the TMTO-friendly YESCRYPT_WORM mode, as + * long as the defender has enough memory that is just as fast as the smaller + * per-thread regions would be, doesn't expect to ever need greater + * flexibility (except possibly via TMTO), and doesn't need backwards + * compatibility with classic scrypt, there are no other serious drawbacks to + * this setting. In the YESCRYPT_RW mode, which is meant to discourage TMTO, + * this new approach to parallelization makes TMTO less inefficient. (This is + * an unfortunate side-effect of avoiding some random writes, as we have to in + * order to allow for parallel threads to access a common memory region without + * synchronization overhead.) Thus, in this mode this setting poses an extra + * tradeoff of its own (higher area-time cost for a subset of attackers vs. + * better TMTO resistance). Setting YESCRYPT_PARALLEL_SMIX also changes the + * way the running time is to be controlled from N*r*p (for classic scrypt) to + * N*r (in this modification). All of this applies only when p > 1. For + * p = 1, this setting is a no-op. + * + * Passing a real shared structure, with ROM contents previously computed by + * yescrypt_init_shared(), enables the use of ROM and requires YESCRYPT_RW for + * the thread-local RAM region. In order to allow for initialization of the + * ROM to be split into a separate program, the shared->shared1.aligned and + * shared->shared1.aligned_size fields may be set by the caller of + * yescrypt_kdf() manually rather than with yescrypt_init_shared(). + * + * local must be initialized with yescrypt_init_local(). + * + * MT-safe as long as local and buf are local to the thread. + */ +extern int yescrypt_kdf(const yescrypt_shared_t * __shared, + yescrypt_local_t * __local, + const uint8_t * __passwd, size_t __passwdlen, + const uint8_t * __salt, size_t __saltlen, + uint64_t __N, uint32_t __r, uint32_t __p, uint32_t __t, + yescrypt_flags_t __flags, + uint8_t * __buf, size_t __buflen); + +/** + * yescrypt_r(shared, local, passwd, passwdlen, setting, buf, buflen): + * Compute and encode an scrypt or enhanced scrypt hash of passwd given the + * parameters and salt value encoded in setting. If the shared structure is + * not dummy, a ROM is used and YESCRYPT_RW is required. Otherwise, whether to + * use the YESCRYPT_WORM (classic scrypt) or YESCRYPT_RW (time-memory tradeoff + * discouraging modification) is determined by the setting string. shared and + * local must be initialized as described above for yescrypt_kdf(). buf must + * be large enough (as indicated by buflen) to hold the encoded hash string. + * + * Return the encoded hash string on success; or NULL on error. + * + * MT-safe as long as local and buf are local to the thread. + */ +extern uint8_t * yescrypt_r(const yescrypt_shared_t * __shared, + yescrypt_local_t * __local, + const uint8_t * __passwd, size_t __passwdlen, + const uint8_t * __setting, + uint8_t * __buf, size_t __buflen); + +/** + * yescrypt(passwd, setting): + * Compute and encode an scrypt or enhanced scrypt hash of passwd given the + * parameters and salt value encoded in setting. Whether to use the + * YESCRYPT_WORM (classic scrypt) or YESCRYPT_RW (time-memory tradeoff + * discouraging modification) is determined by the setting string. + * + * Return the encoded hash string on success; or NULL on error. + * + * This is a crypt(3)-like interface, which is simpler to use than + * yescrypt_r(), but it is not MT-safe, it does not allow for the use of a ROM, + * and it is slower than yescrypt_r() for repeated calls because it allocates + * and frees memory on each call. + * + * MT-unsafe. + */ +extern uint8_t * yescrypt(const uint8_t * __passwd, const uint8_t * __setting); + +/** + * yescrypt_gensalt_r(N_log2, r, p, flags, src, srclen, buf, buflen): + * Generate a setting string for use with yescrypt_r() and yescrypt() by + * encoding into it the parameters N_log2 (which is to be set to base 2 + * logarithm of the desired value for N), r, p, flags, and a salt given by src + * (of srclen bytes). buf must be large enough (as indicated by buflen) to + * hold the setting string. + * + * Return the setting string on success; or NULL on error. + * + * MT-safe as long as buf is local to the thread. + */ +extern uint8_t * yescrypt_gensalt_r( + uint32_t __N_log2, uint32_t __r, uint32_t __p, + yescrypt_flags_t __flags, + const uint8_t * __src, size_t __srclen, + uint8_t * __buf, size_t __buflen); + +/** + * yescrypt_gensalt(N_log2, r, p, flags, src, srclen): + * Generate a setting string for use with yescrypt_r() and yescrypt(). This + * function is the same as yescrypt_gensalt_r() except that it uses a static + * buffer and thus is not MT-safe. + * + * Return the setting string on success; or NULL on error. + * + * MT-unsafe. + */ +extern uint8_t * yescrypt_gensalt( + uint32_t __N_log2, uint32_t __r, uint32_t __p, + yescrypt_flags_t __flags, + const uint8_t * __src, size_t __srclen); + +//#ifdef __cplusplus +//} +//#endif + +#endif /* !_YESCRYPT_H_ */ diff --git a/sph/yescryptcommon.c b/sph/yescryptcommon.c new file mode 100644 index 0000000..c2e7349 --- /dev/null +++ b/sph/yescryptcommon.c @@ -0,0 +1,365 @@ +/*- + * Copyright 2013,2014 Alexander Peslyak + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include "sph/yescrypt.h" +#include + +#define BYTES2CHARS(bytes) \ + ((((bytes) * 8) + 5) / 6) + +#define HASH_SIZE 32 /* bytes */ +#define HASH_LEN BYTES2CHARS(HASH_SIZE) /* base-64 chars */ +#define YESCRYPT_FLAGS (YESCRYPT_RW | YESCRYPT_PWXFORM) +static const char * const itoa64 = + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +static uint8_t * encode64_uint32(uint8_t * dst, size_t dstlen, + uint32_t src, uint32_t srcbits) +{ + uint32_t bit; + + for (bit = 0; bit < srcbits; bit += 6) { + if (dstlen < 1) + return NULL; + *dst++ = itoa64[src & 0x3f]; + dstlen--; + src >>= 6; + } + + return dst; +} + +static uint8_t * encode64(uint8_t * dst, size_t dstlen, + const uint8_t * src, size_t srclen) +{ + size_t i; + + for (i = 0; i < srclen; ) { + uint8_t * dnext; + uint32_t value = 0, bits = 0; + do { + value |= (uint32_t)src[i++] << bits; + bits += 8; + } while (bits < 24 && i < srclen); + dnext = encode64_uint32(dst, dstlen, value, bits); + if (!dnext) + return NULL; + dstlen -= dnext - dst; + dst = dnext; + } + + return dst; +} + +static int decode64_one(uint32_t * dst, uint8_t src) +{ + const char * ptr = strchr(itoa64, src); + if (ptr) { + *dst = ptr - itoa64; + return 0; + } + *dst = 0; + return -1; +} + +static const uint8_t * decode64_uint32(uint32_t * dst, uint32_t dstbits, + const uint8_t * src) +{ + uint32_t bit; + uint32_t value; + + value = 0; + for (bit = 0; bit < dstbits; bit += 6) { + uint32_t one; + if (decode64_one(&one, *src)) { + *dst = 0; + return NULL; + } + src++; + value |= one << bit; + } + + *dst = value; + return src; +} + +uint8_t * +yescrypt_r(const yescrypt_shared_t * shared, yescrypt_local_t * local, + const uint8_t * passwd, size_t passwdlen, + const uint8_t * setting, + uint8_t * buf, size_t buflen) +{ + uint8_t hash[HASH_SIZE]; + const uint8_t * src, * salt; + uint8_t * dst; + size_t prefixlen, saltlen, need; + uint8_t version; + uint64_t N; + uint32_t r, p; + yescrypt_flags_t flags = YESCRYPT_WORM; + fflush(stdout); + if (setting[0] != '$' || setting[1] != '7') + { + fflush(stdout); + return NULL; + } + fflush(stdout); + src = setting + 2; + fflush(stdout); + switch ((version = *src)) { + case '$': + fflush(stdout); + break; + case 'X': + src++; + flags = YESCRYPT_RW; + fflush(stdout); + break; + default: + { + fflush(stdout); + return NULL; + } + } + + fflush(stdout); + if (*src != '$') { + uint32_t decoded_flags; + if (decode64_one(&decoded_flags, *src)) + + { + fflush(stdout); + return NULL; + } + flags = decoded_flags; + if (*++src != '$') + { + fflush(stdout); + return NULL; + } + } + src++; + + { + uint32_t N_log2; + if (decode64_one(&N_log2, *src)) + { + return NULL; + } + src++; + N = (uint64_t)1 << N_log2; + } + + src = decode64_uint32(&r, 30, src); + if (!src) + { + return NULL; + } + + src = decode64_uint32(&p, 30, src); + if (!src) + { + return NULL; + } + + prefixlen = src - setting; + + salt = src; + src = (uint8_t *)strrchr((char *)salt, '$'); + if (src) + saltlen = src - salt; + else + saltlen = strlen((char *)salt); + + need = prefixlen + saltlen + 1 + HASH_LEN + 1; + if (need > buflen || need < saltlen) + + { + fflush(stdout); + return NULL; + } + +fflush(stdout); + if (yescrypt_kdf(shared, local, passwd, passwdlen, salt, saltlen, + N, r, p, 0, flags, hash, sizeof(hash))) + { + fflush(stdout); + return NULL; + } + + dst = buf; + memcpy(dst, setting, prefixlen + saltlen); + dst += prefixlen + saltlen; + *dst++ = '$'; + + dst = encode64(dst, buflen - (dst - buf), hash, sizeof(hash)); + /* Could zeroize hash[] here, but yescrypt_kdf() doesn't zeroize its + * memory allocations yet anyway. */ + if (!dst || dst >= buf + buflen) /* Can't happen */ + { + return NULL; + } + + *dst = 0; /* NUL termination */ + fflush(stdout); + return buf; +} + +uint8_t * +yescrypt(const uint8_t * passwd, const uint8_t * setting) +{ + static uint8_t buf[4 + 1 + 5 + 5 + BYTES2CHARS(32) + 1 + HASH_LEN + 1]; + yescrypt_shared_t shared; + yescrypt_local_t local; + uint8_t * retval; + if (yescrypt_init_shared(&shared, NULL, 0, + 0, 0, 0, YESCRYPT_SHARED_DEFAULTS, 0, NULL, 0)) + return NULL; + if (yescrypt_init_local(&local)) { + yescrypt_free_shared(&shared); + return NULL; + } + retval = yescrypt_r(&shared, &local, + passwd, 80, setting, buf, sizeof(buf)); + // printf("hashse='%s'\n", (char *)retval); + if (yescrypt_free_local(&local)) { + yescrypt_free_shared(&shared); + return NULL; + } + if (yescrypt_free_shared(&shared)) + return NULL; + return retval; + +} + +uint8_t * +yescrypt_gensalt_r(uint32_t N_log2, uint32_t r, uint32_t p, + yescrypt_flags_t flags, + const uint8_t * src, size_t srclen, + uint8_t * buf, size_t buflen) +{ + uint8_t * dst; + size_t prefixlen = 3 + 1 + 5 + 5; + size_t saltlen = BYTES2CHARS(srclen); + size_t need; + + if (p == 1) + flags &= ~YESCRYPT_PARALLEL_SMIX; + + if (flags) { + if (flags & ~0x3f) + return NULL; + + prefixlen++; + if (flags != YESCRYPT_RW) + prefixlen++; + } + + need = prefixlen + saltlen + 1; + if (need > buflen || need < saltlen || saltlen < srclen) + return NULL; + + if (N_log2 > 63 || ((uint64_t)r * (uint64_t)p >= (1U << 30))) + return NULL; + + dst = buf; + *dst++ = '$'; + *dst++ = '7'; + if (flags) { + *dst++ = 'X'; /* eXperimental, subject to change */ + if (flags != YESCRYPT_RW) + *dst++ = itoa64[flags]; + } + *dst++ = '$'; + + *dst++ = itoa64[N_log2]; + + dst = encode64_uint32(dst, buflen - (dst - buf), r, 30); + if (!dst) /* Can't happen */ + return NULL; + + dst = encode64_uint32(dst, buflen - (dst - buf), p, 30); + if (!dst) /* Can't happen */ + return NULL; + + dst = encode64(dst, buflen - (dst - buf), src, srclen); + if (!dst || dst >= buf + buflen) /* Can't happen */ + return NULL; + + *dst = 0; /* NUL termination */ + + return buf; +} + +uint8_t * +yescrypt_gensalt(uint32_t N_log2, uint32_t r, uint32_t p, + yescrypt_flags_t flags, + const uint8_t * src, size_t srclen) +{ + static uint8_t buf[4 + 1 + 5 + 5 + BYTES2CHARS(32) + 1]; + return yescrypt_gensalt_r(N_log2, r, p, flags, src, srclen, + buf, sizeof(buf)); +} + +static int +yescrypt_bsty(const uint8_t * passwd, size_t passwdlen, + const uint8_t * salt, size_t saltlen, uint64_t N, uint32_t r, uint32_t p, + uint8_t * buf, size_t buflen) +{ + +#ifdef WIN32 + static __declspec(thread) int initialized = 0; + static __declspec(thread) yescrypt_shared_t shared; + static __declspec(thread) yescrypt_local_t local; +#else + static __thread int initialized = 0; + static __thread yescrypt_shared_t shared; + static __thread yescrypt_local_t local; +#endif + + + int retval; + if (!initialized) { +/* "shared" could in fact be shared, but it's simpler to keep it private + * along with "local". It's dummy and tiny anyway. */ + if (yescrypt_init_shared(&shared, NULL, 0, + 0, 0, 0, YESCRYPT_SHARED_DEFAULTS, 0, NULL, 0)) + return -1; + if (yescrypt_init_local(&local)) { + yescrypt_free_shared(&shared); + return -1; + } + initialized = 1; + } + retval = yescrypt_kdf(&shared, &local, + passwd, passwdlen, salt, saltlen, N, r, p, 0, YESCRYPT_FLAGS, + buf, buflen); + + return retval; +} + +void yescrypt_hash(const unsigned char *input, unsigned char *output) +{ + + yescrypt_bsty((const uint8_t *)input, 80, (const uint8_t *) input, 80, 2048, 8, 1, (uint8_t *)output, 32); +} diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..6a3cbb6 --- /dev/null +++ b/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# +#USE THIS STARTUP SCRIPT TO AUTOMATICALLY MINE THE MOST PROFITABLE COIN IN ZPOOL UNDER LINUX + +while : +do + +./ccminer -r 0 -a quark --url stratum+tcp://mine.zpool.ca:4033 -u 13VDy6uNHnoChvR8mW68KJqorBVG93eK5p -p quark,skein,lyra2v2,nist5 --show-diff +./ccminer -r 0 -a skein --url stratum+tcp://mine.zpool.ca:4933 -u 13VDy6uNHnoChvR8mW68KJqorBVG93eK5p -p quark,skein,lyra2v2,nist5 --show-diff -d 0,1 -i 28,26 +./ccminer -r 0 -a lyra2v2 --url stratum+tcp://mine.zpool.ca:4533 -u 13VDy6uNHnoChvR8mW68KJqorBVG93eK5p -p quark,skein,lyra2v2,nist5 --show-diff -i 21 +./ccminer -r 0 -a nist5 --url stratum+tcp://mine.zpool.ca:3833 -u 13VDy6uNHnoChvR8mW68KJqorBVG93eK5p -p quark,skein,lyra2v2,nist5 --show-diff -d 0,1 -i 21,19 + +sleep 5 +done diff --git a/stats.cpp b/stats.cpp new file mode 100644 index 0000000..b58f997 --- /dev/null +++ b/stats.cpp @@ -0,0 +1,164 @@ +/** + * Stats place holder + * + * Note: this source is C++ (requires std::map) + * + * tpruvot@github 2014 + */ +#include +#include +#include + +#include "miner.h" + +static std::map tlastscans; +static uint64_t uid = 0; + +#define STATS_AVG_SAMPLES 30 +#define STATS_PURGE_TIMEOUT 120*60 /* 120 mn */ + +extern uint64_t global_hashrate; +extern int opt_statsavg; + +/** + * Store speed per thread + */ +void stats_remember_speed(int thr_id, uint32_t hashcount, double hashrate, uint8_t found, uint32_t height) +{ + const uint64_t key = uid++; + stats_data data; + // to enough hashes to give right stats + if (hashcount < 1000 || hashrate < 0.01) + return; + + // first hash rates are often erroneous + //if (uid < opt_n_threads * 2) + // return; + + memset(&data, 0, sizeof(data)); + data.uid = (uint32_t) uid; + data.gpu_id = (uint8_t) device_map[thr_id]; + data.thr_id = (uint8_t) thr_id; + data.tm_stat = (uint32_t) time(NULL); + data.height = height; + data.npool = (uint8_t) cur_pooln; + data.pool_type = pools[cur_pooln].type; + data.hashcount = hashcount; + data.hashfound = found; + data.hashrate = hashrate; + data.difficulty = net_diff ? net_diff : stratum_diff; + if (opt_n_threads == 1 && global_hashrate && uid > 10) { + // prevent stats on too high vardiff (erroneous rates) + double ratio = (hashrate / (1.0 * global_hashrate)); + if (ratio < 0.4 || ratio > 1.6) + data.ignored = 1; + } + tlastscans[key] = data; +} + +/** + * Get the computed average speed + * @param thr_id int (-1 for all threads) + */ +double stats_get_speed(int thr_id, double def_speed) +{ + double speed = 0.0; + int records = 0; + + std::map::reverse_iterator i = tlastscans.rbegin(); + while (i != tlastscans.rend() && records < opt_statsavg) { + if (!i->second.ignored) + if (thr_id == -1 || i->second.thr_id == thr_id) { + if (i->second.hashcount > 1000) { + speed += i->second.hashrate; + records++; + // applog(LOG_BLUE, "%d %x %.1f", thr_id, i->second.thr_id, i->second.hashrate); + } + } + ++i; + } + + if (records) + speed /= (double)(records); + else + speed = def_speed; + + if (thr_id == -1) + speed *= (double)(opt_n_threads); + + return speed; +} + +/** + * Get the gpu average speed + * @param gpu_id int (-1 for all threads) + */ +double stats_get_gpu_speed(int gpu_id) +{ + double speed = 0.0; + + for (int thr_id=0; thr_id::reverse_iterator i = tlastscans.rbegin(); + while (i != tlastscans.rend() && records < max_records) { + if (!i->second.ignored) + if (thr_id == -1 || i->second.thr_id == thr_id) { + memcpy(&data[records], &(i->second), sizeof(struct stats_data)); + records++; + } + ++i; + } + return records; +} + +/** + * Remove old entries to reduce memory usage + */ +void stats_purge_old(void) +{ + int deleted = 0; + uint32_t now = (uint32_t) time(NULL); + uint32_t sz = (uint32_t) tlastscans.size(); + std::map::iterator i = tlastscans.begin(); + while (i != tlastscans.end()) { + if (i->second.ignored || (now - i->second.tm_stat) > STATS_PURGE_TIMEOUT) { + deleted++; + tlastscans.erase(i++); + } + else ++i; + } + if (opt_debug && deleted) { + applog(LOG_DEBUG, "stats: %d/%d records purged", deleted, sz); + } +} + +/** + * Reset the cache + */ +void stats_purge_all(void) +{ + tlastscans.clear(); +} + +/** + * API meminfo + */ +void stats_getmeminfo(uint64_t *mem, uint32_t *records) +{ + (*records) = (uint32_t) tlastscans.size(); + (*mem) = (*records) * sizeof(stats_data); +} diff --git a/streebog/cuda_keccak_streebog.cu b/streebog/cuda_keccak_streebog.cu new file mode 100644 index 0000000..429e877 --- /dev/null +++ b/streebog/cuda_keccak_streebog.cu @@ -0,0 +1,499 @@ +/* + * Streebog GOST R 34.10-2012 CUDA implementation. + * + * https://tools.ietf.org/html/rfc6986 + * https://en.wikipedia.org/wiki/Streebog + * + * ==========================(LICENSE BEGIN)============================ + * + * @author Tanguy Pruvot - 2015 + * @author Alexis Provos - 2016 + */ + +// Further improved with shared memory partial utilization +// Merged implementation to decrease shared memory's bottleneck +// Tested under CUDA7.5 toolkit for cp 5.0/5.2 + +#include "miner.h" + +#include "cuda_helper.h" +#include "cuda_vectors.h" +#include "streebog_arrays.cuh" + +__constant__ +static uint2 keccak_round_constants[24] = { + { 0x00000001, 0x00000000 }, { 0x00008082, 0x00000000 }, { 0x0000808a, 0x80000000 }, { 0x80008000, 0x80000000 }, + { 0x0000808b, 0x00000000 }, { 0x80000001, 0x00000000 }, { 0x80008081, 0x80000000 }, { 0x00008009, 0x80000000 }, + { 0x0000008a, 0x00000000 }, { 0x00000088, 0x00000000 }, { 0x80008009, 0x00000000 }, { 0x8000000a, 0x00000000 }, + { 0x8000808b, 0x00000000 }, { 0x0000008b, 0x80000000 }, { 0x00008089, 0x80000000 }, { 0x00008003, 0x80000000 }, + { 0x00008002, 0x80000000 }, { 0x00000080, 0x80000000 }, { 0x0000800a, 0x00000000 }, { 0x8000000a, 0x80000000 }, + { 0x80008081, 0x80000000 }, { 0x00008080, 0x80000000 }, { 0x80000001, 0x00000000 }, { 0x80008008, 0x80000000 } +}; + +__device__ __forceinline__ +static void GOST_FS(const uint2 shared[8][256],const uint2 *const __restrict__ state,uint2* return_state){ + + return_state[0] = __ldg(&T02[__byte_perm(state[7].x,0,0x44440)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44440)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44440)] + ^ shared[3][__byte_perm(state[4].x,0,0x44440)] + ^ shared[4][__byte_perm(state[3].x,0,0x44440)] + ^ shared[5][__byte_perm(state[2].x,0,0x44440)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44440)]) + ^ shared[6][__byte_perm(state[1].x,0,0x44440)]; + + return_state[1] = __ldg(&T02[__byte_perm(state[7].x,0,0x44441)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44441)] + ^ shared[3][__byte_perm(state[4].x,0,0x44441)] + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44441)]) + ^ shared[4][__byte_perm(state[3].x,0,0x44441)] + ^ shared[5][__byte_perm(state[2].x,0,0x44441)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44441)]) + ^ shared[6][__byte_perm(state[1].x,0,0x44441)]; + + return_state[2] = __ldg(&T02[__byte_perm(state[7].x,0,0x44442)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44442)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44442)] + ^ shared[3][__byte_perm(state[4].x,0,0x44442)] + ^ shared[4][__byte_perm(state[3].x,0,0x44442)] + ^ shared[5][__byte_perm(state[2].x,0,0x44442)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44442)]) + ^ shared[6][__byte_perm(state[1].x,0,0x44442)]; + + return_state[3] = __ldg(&T02[__byte_perm(state[7].x,0,0x44443)]) + ^ shared[1][__byte_perm(state[6].x,0,0x44443)] + ^ shared[2][__byte_perm(state[5].x,0,0x44443)] + ^ shared[3][__byte_perm(state[4].x,0,0x44443)] + ^ __ldg(&T42[__byte_perm(state[3].x,0,0x44443)]) + ^ shared[5][__byte_perm(state[2].x,0,0x44443)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44443)]) + ^ shared[6][__byte_perm(state[1].x,0,0x44443)]; + + return_state[4] = __ldg(&T02[__byte_perm(state[7].y,0,0x44440)]) + ^ shared[1][__byte_perm(state[6].y,0,0x44440)] + ^ __ldg(&T22[__byte_perm(state[5].y,0,0x44440)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44440)] + ^ shared[4][__byte_perm(state[3].y,0,0x44440)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44440)]) + ^ shared[5][__byte_perm(state[2].y,0,0x44440)] + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44440)]); + + return_state[5] = __ldg(&T02[__byte_perm(state[7].y,0,0x44441)]) + ^ shared[2][__byte_perm(state[5].y,0,0x44441)] + ^ __ldg(&T12[__byte_perm(state[6].y,0,0x44441)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44441)] + ^ shared[4][__byte_perm(state[3].y,0,0x44441)] + ^ shared[5][__byte_perm(state[2].y,0,0x44441)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44441)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44441)]); + + return_state[6] = __ldg(&T02[__byte_perm(state[7].y,0,0x44442)]) + ^ shared[1][__byte_perm(state[6].y,0,0x44442)] + ^ shared[2][__byte_perm(state[5].y,0,0x44442)] + ^ shared[3][__byte_perm(state[4].y,0,0x44442)] + ^ shared[4][__byte_perm(state[3].y,0,0x44442)] + ^ shared[5][__byte_perm(state[2].y,0,0x44442)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44442)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44442)]); + + return_state[7] = __ldg(&T02[__byte_perm(state[7].y,0,0x44443)]) + ^ __ldg(&T12[__byte_perm(state[6].y,0,0x44443)]) + ^ shared[2][__byte_perm(state[5].y,0,0x44443)] + ^ shared[3][__byte_perm(state[4].y,0,0x44443)] + ^ shared[4][__byte_perm(state[3].y,0,0x44443)] + ^ shared[5][__byte_perm(state[2].y,0,0x44443)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44443)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44443)]); +} + +__device__ __forceinline__ +static void GOST_FS_LDG(const uint2 shared[8][256],const uint2 *const __restrict__ state,uint2* return_state){ + + return_state[0] = __ldg(&T02[__byte_perm(state[7].x,0,0x44440)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44440)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44440)] + ^ shared[3][__byte_perm(state[4].x,0,0x44440)] + ^ shared[4][__byte_perm(state[3].x,0,0x44440)] + ^ shared[5][__byte_perm(state[2].x,0,0x44440)] + ^ shared[6][__byte_perm(state[1].x,0,0x44440)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44440)]); + + return_state[1] = __ldg(&T02[__byte_perm(state[7].x,0,0x44441)]) + ^ shared[1][__byte_perm(state[6].x,0,0x44441)] + ^ shared[2][__byte_perm(state[5].x,0,0x44441)] + ^ shared[3][__byte_perm(state[4].x,0,0x44441)] + ^ shared[4][__byte_perm(state[3].x,0,0x44441)] + ^ shared[5][__byte_perm(state[2].x,0,0x44441)] + ^ shared[6][__byte_perm(state[1].x,0,0x44441)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44441)]); + + return_state[2] = __ldg(&T02[__byte_perm(state[7].x,0,0x44442)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44442)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44442)] + ^ shared[3][__byte_perm(state[4].x,0,0x44442)] + ^ shared[4][__byte_perm(state[3].x,0,0x44442)] + ^ shared[5][__byte_perm(state[2].x,0,0x44442)] + ^ shared[6][__byte_perm(state[1].x,0,0x44442)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44442)]); + + return_state[3] = __ldg(&T02[__byte_perm(state[7].x,0,0x44443)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44443)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44443)] + ^ shared[3][__byte_perm(state[4].x,0,0x44443)] + ^ shared[4][__byte_perm(state[3].x,0,0x44443)] + ^ shared[5][__byte_perm(state[2].x,0,0x44443)] + ^ __ldg(&T62[__byte_perm(state[1].x,0,0x44443)]) + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44443)]); + + return_state[4] = __ldg(&T02[__byte_perm(state[7].y,0,0x44440)]) + ^ shared[1][__byte_perm(state[6].y,0,0x44440)] + ^ __ldg(&T22[__byte_perm(state[5].y,0,0x44440)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44440)] + ^ shared[4][__byte_perm(state[3].y,0,0x44440)] + ^ shared[5][__byte_perm(state[2].y,0,0x44440)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44440)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44440)]); + + return_state[5] = __ldg(&T02[__byte_perm(state[7].y,0,0x44441)]) + ^ __ldg(&T12[__byte_perm(state[6].y,0,0x44441)]) + ^ shared[2][__byte_perm(state[5].y,0,0x44441)] + ^ shared[3][__byte_perm(state[4].y,0,0x44441)] + ^ shared[4][__byte_perm(state[3].y,0,0x44441)] + ^ shared[5][__byte_perm(state[2].y,0,0x44441)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44441)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44441)]); + + return_state[6] = __ldg(&T02[__byte_perm(state[7].y,0,0x44442)]) + ^ __ldg(&T12[__byte_perm(state[6].y,0,0x44442)]) + ^ shared[2][__byte_perm(state[5].y,0,0x44442)] + ^ shared[3][__byte_perm(state[4].y,0,0x44442)] + ^ shared[4][__byte_perm(state[3].y,0,0x44442)] + ^ shared[5][__byte_perm(state[2].y,0,0x44442)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44442)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44442)]); + + return_state[7] = __ldg(&T02[__byte_perm(state[7].y,0,0x44443)]) + ^ shared[1][__byte_perm(state[6].y,0,0x44443)] + ^ __ldg(&T22[__byte_perm(state[5].y,0,0x44443)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44443)] + ^ shared[4][__byte_perm(state[3].y,0,0x44443)] + ^ shared[5][__byte_perm(state[2].y,0,0x44443)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44443)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44443)]); +} + +__device__ __forceinline__ +static void GOST_E12(const uint2 shared[8][256],uint2 *const __restrict__ K, uint2 *const __restrict__ state){ + + uint2 t[ 8]; +// #pragma unroll 2 + for(int i=0; i<12; i++){ + GOST_FS(shared,state, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + K[ j] ^= *(uint2*)&CC[i][j]; + + #pragma unroll 8 + for(int j=0;j<8;j++) + state[ j] = t[ j]; + + GOST_FS_LDG(shared,K, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + state[ j]^= t[ j]; + + #pragma unroll 8 + for(int j=0;j<8;j++) + K[ j] = t[ j]; + } +} + +__device__ __forceinline__ +static void keccak_kernel(uint2* s){ + uint2 u[5],t[5], v, w; + + /*theta*/ + t[ 0] = vectorize(devectorize(s[ 0])^devectorize(s[ 5])); + t[ 1] = vectorize(devectorize(s[ 1])^devectorize(s[ 6])); + t[ 2] = vectorize(devectorize(s[ 2])^devectorize(s[ 7])); + t[ 3] = vectorize(devectorize(s[ 3])^devectorize(s[ 8])); + t[ 4] = s[4]; + + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + + s[ 4] = xor3x(s[ 4], t[3], u[ 0]); + s[24] = s[19] = s[14] = s[ 9] = t[ 3] ^ u[ 0]; + + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[ 5] = xor3x(s[ 5], t[4], u[ 1]); + s[20] = s[15] = s[10] = t[4] ^ u[ 1]; + + s[ 1] = xor3x(s[ 1], t[0], u[ 2]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[21] = s[16] = s[11] = t[0] ^ u[ 2]; + + s[ 2] = xor3x(s[ 2], t[1], u[ 3]); + s[ 7] = xor3x(s[ 7], t[1], u[ 3]); + s[22] = s[17] = s[12] = t[1] ^ u[ 3]; + + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]); + s[23] = s[18] = s[13] = t[2] ^ u[ 4]; + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[ 0]; + + for (int i = 1; i < 23; i++) { + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = vectorize(xor5(devectorize(s[ j]),devectorize(s[j+5]),devectorize(s[j+10]),devectorize(s[j+15]),devectorize(s[j+20]))); + } + /*theta*/ + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 4] = xor3x(s[ 4], t[3], u[ 0]);s[ 9] = xor3x(s[ 9], t[3], u[ 0]);s[14] = xor3x(s[14], t[3], u[ 0]);s[19] = xor3x(s[19], t[3], u[ 0]);s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]);s[ 5] = xor3x(s[ 5], t[4], u[ 1]);s[10] = xor3x(s[10], t[4], u[ 1]);s[15] = xor3x(s[15], t[4], u[ 1]);s[20] = xor3x(s[20], t[4], u[ 1]); + s[ 1] = xor3x(s[ 1], t[0], u[ 2]);s[ 6] = xor3x(s[ 6], t[0], u[ 2]);s[11] = xor3x(s[11], t[0], u[ 2]);s[16] = xor3x(s[16], t[0], u[ 2]);s[21] = xor3x(s[21], t[0], u[ 2]); + s[ 2] = xor3x(s[ 2], t[1], u[ 3]);s[ 7] = xor3x(s[ 7], t[1], u[ 3]);s[12] = xor3x(s[12], t[1], u[ 3]);s[17] = xor3x(s[17], t[1], u[ 3]);s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]);s[ 8] = xor3x(s[ 8], t[2], u[ 4]);s[13] = xor3x(s[13], t[2], u[ 4]);s[18] = xor3x(s[18], t[2], u[ 4]);s[23] = xor3x(s[23], t[2], u[ 4]); + + /* rho pi: b[..] = rotl(a[..], ..) */ + v = s[1]; + s[1] = ROL2(s[6], 44); + s[6] = ROL2(s[9], 20); + s[9] = ROL2(s[22], 61); + s[22] = ROL2(s[14], 39); + s[14] = ROL2(s[20], 18); + s[20] = ROL2(s[2], 62); + s[2] = ROL2(s[12], 43); + s[12] = ROL2(s[13], 25); + s[13] = ROL8(s[19]); + s[19] = ROR8(s[23]); + s[23] = ROL2(s[15], 41); + s[15] = ROL2(s[4], 27); + s[4] = ROL2(s[24], 14); + s[24] = ROL2(s[21], 2); + s[21] = ROL2(s[8], 55); + s[8] = ROL2(s[16], 45); + s[16] = ROL2(s[5], 36); + s[5] = ROL2(s[3], 28); + s[3] = ROL2(s[18], 21); + s[18] = ROL2(s[17], 15); + s[17] = ROL2(s[11], 10); + s[11] = ROL2(s[7], 6); + s[7] = ROL2(s[10], 3); + s[10] = ROL2(v, 1); + + /* chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] */ + #pragma unroll 5 + for(int j=0;j<25;j+=5){ + v=s[j];w=s[j + 1];s[j] = chi(v,w,s[j+2]);s[j+1] = chi(w,s[j+2],s[j+3]);s[j+2]=chi(s[j+2],s[j+3],s[j+4]);s[j+3]=chi(s[j+3],s[j+4],v);s[j+4]=chi(s[j+4],v,w); + } + /* iota: a[0,0] ^= round constant */ + s[0] ^= keccak_round_constants[i]; + } + //theta + #pragma unroll 5 + for(int j=0;j<5;j++){ + t[ j] = xor3x(xor3x(s[j+0],s[j+5],s[j+10]),s[j+15],s[j+20]); + } + //theta + #pragma unroll 5 + for(int j=0;j<5;j++){ + u[ j] = ROL2(t[ j], 1); + } + s[ 9] = xor3x(s[ 9], t[3], u[ 0]); + s[24] = xor3x(s[24], t[3], u[ 0]); + s[ 0] = xor3x(s[ 0], t[4], u[ 1]); + s[10] = xor3x(s[10], t[4], u[ 1]); + s[ 6] = xor3x(s[ 6], t[0], u[ 2]); + s[16] = xor3x(s[16], t[0], u[ 2]); + s[12] = xor3x(s[12], t[1], u[ 3]); + s[22] = xor3x(s[22], t[1], u[ 3]); + s[ 3] = xor3x(s[ 3], t[2], u[ 4]); + s[18] = xor3x(s[18], t[2], u[ 4]); + // rho pi: b[..] = rotl(a[..], ..) + s[ 1] = ROL2(s[ 6], 44); + s[ 2] = ROL2(s[12], 43); + s[ 5] = ROL2(s[ 3], 28); + s[ 7] = ROL2(s[10], 3); + s[ 3] = ROL2(s[18], 21); + s[ 4] = ROL2(s[24], 14); + s[ 6] = ROL2(s[ 9], 20); + s[ 8] = ROL2(s[16], 45); + s[ 9] = ROL2(s[22], 61); + // chi: a[i,j] ^= ~b[i,j+1] & b[i,j+2] + v=s[ 0];w=s[ 1];s[ 0] = chi(v,w,s[ 2]);s[ 1] = chi(w,s[ 2],s[ 3]);s[ 2]=chi(s[ 2],s[ 3],s[ 4]);s[ 3]=chi(s[ 3],s[ 4],v);s[ 4]=chi(s[ 4],v,w); + v=s[ 5];w=s[ 6];s[ 5] = chi(v,w,s[ 7]);s[ 6] = chi(w,s[ 7],s[ 8]);s[ 7]=chi(s[ 7],s[ 8],s[ 9]); + // iota: a[0,0] ^= round constant + s[0] ^= keccak_round_constants[23]; +} + +__device__ __forceinline__ +static void streebog_kernel(const uint2 shared[8][256],uint2* s){ + + uint2 buf[8], t[8], temp[8],K0[8]; + + K0[0] = vectorize(0x74a5d4ce2efc83b3); + + #pragma unroll 8 + for(int i=0;i<8;i++){ + buf[ i] = K0[ 0] ^ s[ i]; + } + +// #pragma unroll 11 + for(int i=0; i<12; i++){ + GOST_FS(shared,buf, temp); + #pragma unroll 8 + for(int j=0;j<8;j++){ + buf[ j] = temp[ j] ^ *(uint2*)&precomputed_values[i][j]; + } + } + #pragma unroll 8 + for(int j=0;j<8;j++){ + buf[ j]^= s[ j]; + } + #pragma unroll 8 + for(int j=0;j<8;j++){ + K0[ j] = buf[ j]; + } + + K0[7].y ^= 0x00020000; + + GOST_FS(shared,K0, t); + + #pragma unroll 8 + for(int i=0;i<8;i++) + K0[ i] = t[ i]; + + t[7].y ^= 0x01000000; + + GOST_E12(shared,K0, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + buf[ j] ^= t[ j]; + + buf[7].y ^= 0x01000000; + + GOST_FS(shared,buf,K0); + + buf[7].y ^= 0x00020000; + + #pragma unroll 8 + for(int j=0;j<8;j++) + t[ j] = K0[ j]; + + t[7].y ^= 0x00020000; + + GOST_E12(shared,K0, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + buf[ j] ^= t[ j]; + + GOST_FS(shared,buf,K0); // K = F(h) + + s[7]+= vectorize(0x0100000000000000); + + #pragma unroll 8 + for(int j=0;j<8;j++) + t[ j] = K0[ j] ^ s[ j]; + + GOST_E12(shared,K0, t); + + #pragma unroll 8 + for(int i=0;i<8;i++) + s[i] = s[ i] ^ buf[ i] ^ t[ i]; +} + +#define TPB 256 +__global__ +__launch_bounds__(TPB,3) +void keccak_streebog_gpu_hash_64(const uint32_t threads,uint64_t *g_hash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint2 s[25]; + + __shared__ uint2 shared[8][256]; + shared[0][threadIdx.x] = __ldg(&T02[threadIdx.x]); + shared[1][threadIdx.x] = __ldg(&T12[threadIdx.x]); + shared[2][threadIdx.x] = __ldg(&T22[threadIdx.x]); + shared[3][threadIdx.x] = __ldg(&T32[threadIdx.x]); + shared[4][threadIdx.x] = __ldg(&T42[threadIdx.x]); + shared[5][threadIdx.x] = __ldg(&T52[threadIdx.x]); + shared[6][threadIdx.x] = __ldg(&T62[threadIdx.x]); + shared[7][threadIdx.x] = __ldg(&T72[threadIdx.x]); + +// shared[threadIdx.x] = __ldg(&T02[threadIdx.x]); +// shared[256+threadIdx.x] = __ldg(&T12[threadIdx.x]); +// shared[512+threadIdx.x] = __ldg(&T22[threadIdx.x]); +// shared[768+threadIdx.x] = __ldg(&T32[threadIdx.x]); +// shared[1024+threadIdx.x] = __ldg(&T42[threadIdx.x]); + +// shared[1280+threadIdx.x] = T52[threadIdx.x]; +// shared[1536+threadIdx.x] = T62[threadIdx.x]; +// shared[1792+threadIdx.x] = T72[threadIdx.x]; + + uint64_t* inout = &g_hash[thread<<3]; + + __threadfence_block(); + + *(uint2x4*)&s[ 0] = __ldg4((uint2x4 *)&inout[ 0]); + *(uint2x4*)&s[ 4] = __ldg4((uint2x4 *)&inout[ 4]); + s[8] = make_uint2(1,0x80000000); + + keccak_kernel(s); + streebog_kernel(shared,s); + + *(uint2x4*)&inout[ 0] = *(uint2x4*)&s[ 0]; + *(uint2x4*)&inout[ 4] = *(uint2x4*)&s[ 4]; +} + +__host__ +void keccak_streebog_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + dim3 grid((threads + TPB-1) / TPB); + dim3 block(TPB); + + keccak_streebog_gpu_hash_64<<>>(threads,(uint64_t*)d_hash); +} diff --git a/streebog/cuda_streebog.cu b/streebog/cuda_streebog.cu new file mode 100644 index 0000000..52a32c3 --- /dev/null +++ b/streebog/cuda_streebog.cu @@ -0,0 +1,490 @@ +/* + * Streebog GOST R 34.10-2012 CUDA implementation. + * + * https://tools.ietf.org/html/rfc6986 + * https://en.wikipedia.org/wiki/Streebog + * + * ==========================(LICENSE BEGIN)============================ + * + * @author Tanguy Pruvot - 2015 + * @author Alexis Provos - 2016 + */ + +// Further improved with shared memory partial utilization +// Tested under CUDA7.5 toolkit for cp 5.0/5.2 + +#include "miner.h" + +#include "cuda_helper.h" +#include "cuda_vectors.h" +#include "streebog_arrays.cuh" + +//#define FULL_UNROLL +__device__ __forceinline__ +static void GOST_FS(const uint2 shared[8][256],const uint2 *const __restrict__ state,uint2* return_state){ + + return_state[0] = __ldg(&T02[__byte_perm(state[7].x,0,0x44440)]) + ^ shared[1][__byte_perm(state[6].x,0,0x44440)] + ^ shared[2][__byte_perm(state[5].x,0,0x44440)] + ^ shared[3][__byte_perm(state[4].x,0,0x44440)] + ^ shared[4][__byte_perm(state[3].x,0,0x44440)] + ^ shared[5][__byte_perm(state[2].x,0,0x44440)] + ^ shared[6][__byte_perm(state[1].x,0,0x44440)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44440)]); + + return_state[1] = __ldg(&T02[__byte_perm(state[7].x,0,0x44441)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44441)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44441)] + ^ shared[3][__byte_perm(state[4].x,0,0x44441)] + ^ shared[4][__byte_perm(state[3].x,0,0x44441)] + ^ shared[5][__byte_perm(state[2].x,0,0x44441)] + ^ shared[6][__byte_perm(state[1].x,0,0x44441)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44441)]); + + return_state[2] = __ldg(&T02[__byte_perm(state[7].x,0,0x44442)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44442)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44442)] + ^ shared[3][__byte_perm(state[4].x,0,0x44442)] + ^ shared[4][__byte_perm(state[3].x,0,0x44442)] + ^ shared[5][__byte_perm(state[2].x,0,0x44442)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44442)]) + ^ shared[6][__byte_perm(state[1].x,0,0x44442)]; + + return_state[3] = __ldg(&T02[__byte_perm(state[7].x,0,0x44443)]) + ^ shared[1][__byte_perm(state[6].x,0,0x44443)] + ^ shared[2][__byte_perm(state[5].x,0,0x44443)] + ^ shared[3][__byte_perm(state[4].x,0,0x44443)] + ^ __ldg(&T42[__byte_perm(state[3].x,0,0x44443)]) + ^ shared[5][__byte_perm(state[2].x,0,0x44443)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44443)]) + ^ shared[6][__byte_perm(state[1].x,0,0x44443)]; + + return_state[4] = __ldg(&T02[__byte_perm(state[7].y,0,0x44440)]) + ^ shared[1][__byte_perm(state[6].y,0,0x44440)] + ^ __ldg(&T22[__byte_perm(state[5].y,0,0x44440)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44440)] + ^ shared[4][__byte_perm(state[3].y,0,0x44440)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44440)]) + ^ shared[5][__byte_perm(state[2].y,0,0x44440)] + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44440)]); + + return_state[5] = __ldg(&T02[__byte_perm(state[7].y,0,0x44441)]) + ^ shared[2][__byte_perm(state[5].y,0,0x44441)] + ^ __ldg(&T12[__byte_perm(state[6].y,0,0x44441)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44441)] + ^ shared[4][__byte_perm(state[3].y,0,0x44441)] + ^ shared[5][__byte_perm(state[2].y,0,0x44441)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44441)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44441)]); + + return_state[6] = __ldg(&T02[__byte_perm(state[7].y,0,0x44442)]) + ^ shared[1][__byte_perm(state[6].y,0,0x44442)] + ^ shared[2][__byte_perm(state[5].y,0,0x44442)] + ^ shared[3][__byte_perm(state[4].y,0,0x44442)] + ^ shared[4][__byte_perm(state[3].y,0,0x44442)] + ^ shared[5][__byte_perm(state[2].y,0,0x44442)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44442)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44442)]); + + return_state[7] = __ldg(&T02[__byte_perm(state[7].y,0,0x44443)]) + ^ __ldg(&T12[__byte_perm(state[6].y,0,0x44443)]) + ^ shared[2][__byte_perm(state[5].y,0,0x44443)] + ^ shared[3][__byte_perm(state[4].y,0,0x44443)] + ^ shared[4][__byte_perm(state[3].y,0,0x44443)] + ^ shared[5][__byte_perm(state[2].y,0,0x44443)] + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44443)]) + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44443)]); +} + +__device__ __forceinline__ +static void GOST_FS_LDG(const uint2 shared[8][256],const uint2 *const __restrict__ state,uint2* return_state){ + + return_state[0] = __ldg(&T02[__byte_perm(state[7].x,0,0x44440)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44440)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44440)] + ^ shared[3][__byte_perm(state[4].x,0,0x44440)] + ^ shared[4][__byte_perm(state[3].x,0,0x44440)] + ^ shared[5][__byte_perm(state[2].x,0,0x44440)] + ^ shared[6][__byte_perm(state[1].x,0,0x44440)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44440)]); + + return_state[1] = __ldg(&T02[__byte_perm(state[7].x,0,0x44441)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44441)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44441)] + ^ shared[3][__byte_perm(state[4].x,0,0x44441)] + ^ shared[4][__byte_perm(state[3].x,0,0x44441)] + ^ shared[5][__byte_perm(state[2].x,0,0x44441)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44441)]) + ^ shared[6][__byte_perm(state[1].x,0,0x44441)]; + + return_state[2] = __ldg(&T02[__byte_perm(state[7].x,0,0x44442)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44442)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44442)] + ^ shared[3][__byte_perm(state[4].x,0,0x44442)] + ^ shared[4][__byte_perm(state[3].x,0,0x44442)] + ^ shared[5][__byte_perm(state[2].x,0,0x44442)] + ^ shared[6][__byte_perm(state[1].x,0,0x44442)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44442)]); + + return_state[3] = __ldg(&T02[__byte_perm(state[7].x,0,0x44443)]) + ^ __ldg(&T12[__byte_perm(state[6].x,0,0x44443)]) + ^ shared[2][__byte_perm(state[5].x,0,0x44443)] + ^ shared[3][__byte_perm(state[4].x,0,0x44443)] + ^ shared[4][__byte_perm(state[3].x,0,0x44443)] + ^ shared[5][__byte_perm(state[2].x,0,0x44443)] + ^ shared[6][__byte_perm(state[1].x,0,0x44443)] + ^ __ldg(&T72[__byte_perm(state[0].x,0,0x44443)]); + + return_state[4] = __ldg(&T02[__byte_perm(state[7].y,0,0x44440)]) + ^ shared[1][__byte_perm(state[6].y,0,0x44440)] + ^ __ldg(&T22[__byte_perm(state[5].y,0,0x44440)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44440)] + ^ shared[4][__byte_perm(state[3].y,0,0x44440)] + ^ shared[5][__byte_perm(state[2].y,0,0x44440)] + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44440)]) + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44440)]); + + return_state[5] = __ldg(&T02[__byte_perm(state[7].y,0,0x44441)]) + ^ __ldg(&T12[__byte_perm(state[6].y,0,0x44441)]) + ^ shared[2][__byte_perm(state[5].y,0,0x44441)] + ^ shared[3][__byte_perm(state[4].y,0,0x44441)] + ^ shared[4][__byte_perm(state[3].y,0,0x44441)] + ^ shared[5][__byte_perm(state[2].y,0,0x44441)] + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44441)]) + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44441)]); + + return_state[6] = __ldg(&T02[__byte_perm(state[7].y,0,0x44442)]) + ^ __ldg(&T12[__byte_perm(state[6].y,0,0x44442)]) + ^ __ldg(&T22[__byte_perm(state[5].y,0,0x44442)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44442)] + ^ shared[4][__byte_perm(state[3].y,0,0x44442)] + ^ shared[5][__byte_perm(state[2].y,0,0x44442)] + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44442)]) + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44442)]); + + return_state[7] = __ldg(&T02[__byte_perm(state[7].y,0,0x44443)]) + ^ shared[1][__byte_perm(state[6].y,0,0x44443)] + ^ __ldg(&T22[__byte_perm(state[5].y,0,0x44443)]) + ^ shared[3][__byte_perm(state[4].y,0,0x44443)] + ^ shared[4][__byte_perm(state[3].y,0,0x44443)] + ^ shared[5][__byte_perm(state[2].y,0,0x44443)] + ^ __ldg(&T72[__byte_perm(state[0].y,0,0x44443)]) + ^ __ldg(&T62[__byte_perm(state[1].y,0,0x44443)]); +} + +__device__ __forceinline__ +static void GOST_E12(const uint2 shared[8][256],uint2 *const __restrict__ K, uint2 *const __restrict__ state){ + + uint2 t[ 8]; + for(int i=0; i<12; i++){ + GOST_FS(shared,state, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + K[ j] ^= *(uint2*)&CC[i][j]; + + #pragma unroll 8 + for(int j=0;j<8;j++) + state[ j] = t[ j]; + + GOST_FS_LDG(shared,K, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + state[ j]^= t[ j]; + + #pragma unroll 8 + for(int j=0;j<8;j++) + K[ j] = t[ j]; + } +} + +#define TPB 256 +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB, 3) +#else +__launch_bounds__(TPB, 3) +#endif +void streebog_gpu_hash_64(uint64_t *g_hash){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint2 buf[8], t[8], temp[8],K0[8], hash[8]; + + __shared__ uint2 shared[8][256]; +// ((uint4*)&shared[0])[threadIdx.x] = __ldg(&((uint4*)&T02)[threadIdx.x]); +// ((uint4*)&shared[1])[threadIdx.x] = __ldg(&((uint4*)&T12)[threadIdx.x]); +// ((uint4*)&shared[2])[threadIdx.x] = __ldg(&((uint4*)&T22)[threadIdx.x]); +// ((uint4*)&shared[3])[threadIdx.x] = __ldg(&((uint4*)&T32)[threadIdx.x]); +// ((uint4*)&shared[4])[threadIdx.x] = __ldg(&((uint4*)&T42)[threadIdx.x]); + shared[0][threadIdx.x] = __ldg(&T02[threadIdx.x]); + shared[1][threadIdx.x] = __ldg(&T12[threadIdx.x]); + shared[2][threadIdx.x] = __ldg(&T22[threadIdx.x]); + shared[3][threadIdx.x] = __ldg(&T32[threadIdx.x]); + shared[4][threadIdx.x] = __ldg(&T42[threadIdx.x]); + shared[5][threadIdx.x] = __ldg(&T52[threadIdx.x]); + shared[6][threadIdx.x] = __ldg(&T62[threadIdx.x]); + shared[7][threadIdx.x] = __ldg(&T72[threadIdx.x]); + +// if (thread < threads) +// { + uint64_t* inout = &g_hash[thread<<3]; + + *(uint2x4*)&hash[0] = __ldg4((uint2x4*)&inout[0]); + *(uint2x4*)&hash[4] = __ldg4((uint2x4*)&inout[4]); + + __threadfence_block(); + + K0[0] = vectorize(0x74a5d4ce2efc83b3); + + #pragma unroll 8 + for(int i=0;i<8;i++){ + buf[ i] = K0[ 0] ^ hash[ i]; + } + + for(int i=0; i<12; i++){ + GOST_FS(shared, buf, temp); + #pragma unroll 8 + for(uint32_t j=0;j<8;j++){ + buf[ j] = temp[ j] ^ *(uint2*)&precomputed_values[i][j]; + } + } + #pragma unroll 8 + for(int j=0;j<8;j++){ + buf[ j]^= hash[ j]; + } + #pragma unroll 8 + for(int j=0;j<8;j++){ + K0[ j] = buf[ j]; + } + + K0[7].y ^= 0x00020000; + + GOST_FS(shared, K0, t); + + #pragma unroll 8 + for(int i=0;i<8;i++) + K0[ i] = t[ i]; + + t[7].y ^= 0x01000000; + + GOST_E12(shared, K0, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + buf[ j] ^= t[ j]; + + buf[7].y ^= 0x01000000; + + GOST_FS(shared, buf,K0); + + buf[7].y ^= 0x00020000; + + #pragma unroll 8 + for(int j=0;j<8;j++) + t[ j] = K0[ j]; + + t[7].y ^= 0x00020000; + + GOST_E12(shared, K0, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + buf[ j] ^= t[ j]; + + GOST_FS(shared, buf,K0); // K = F(h) + + hash[7]+= vectorize(0x0100000000000000); + + #pragma unroll 8 + for(int j=0;j<8;j++) + t[ j] = K0[ j] ^ hash[ j]; + + GOST_E12(shared, K0, t); + + *(uint2x4*)&inout[ 0] = *(uint2x4*)&t[ 0] ^ *(uint2x4*)&hash[0] ^ *(uint2x4*)&buf[0]; + *(uint2x4*)&inout[ 4] = *(uint2x4*)&t[ 4] ^ *(uint2x4*)&hash[4] ^ *(uint2x4*)&buf[4]; +} + +__host__ +void streebog_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + dim3 grid((threads + TPB-1) / TPB); + dim3 block(TPB); + + streebog_gpu_hash_64<<>>((uint64_t*)d_hash); +} + +__constant__ uint64_t target64[4]; + +void streebog_set_target(const uint32_t* ptarget){ + cudaMemcpyToSymbol(target64,ptarget,4*sizeof(uint64_t),0,cudaMemcpyHostToDevice); +} + +__global__ +__launch_bounds__(TPB, 3) +void streebog_gpu_hash_64_final(uint64_t *g_hash, uint32_t* resNonce) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint2 buf[8], t[8], temp[8],K0[8], hash[8]; + + __shared__ uint2 shared[8][256]; +// ((uint4*)&shared[0])[threadIdx.x] = __ldg(&((uint4*)&T02)[threadIdx.x]); +// ((uint4*)&shared[1])[threadIdx.x] = __ldg(&((uint4*)&T12)[threadIdx.x]); +// ((uint4*)&shared[2])[threadIdx.x] = __ldg(&((uint4*)&T22)[threadIdx.x]); +// ((uint4*)&shared[3])[threadIdx.x] = __ldg(&((uint4*)&T32)[threadIdx.x]); +// ((uint4*)&shared[4])[threadIdx.x] = __ldg(&((uint4*)&T42)[threadIdx.x]); + shared[0][threadIdx.x] = __ldg(&T02[threadIdx.x]); + shared[1][threadIdx.x] = __ldg(&T12[threadIdx.x]); + shared[2][threadIdx.x] = __ldg(&T22[threadIdx.x]); + shared[3][threadIdx.x] = __ldg(&T32[threadIdx.x]); + shared[4][threadIdx.x] = __ldg(&T42[threadIdx.x]); + shared[5][threadIdx.x] = __ldg(&T52[threadIdx.x]); + shared[6][threadIdx.x] = __ldg(&T62[threadIdx.x]); + shared[7][threadIdx.x] = __ldg(&T72[threadIdx.x]); + +// if (thread < threads) +// { + uint64_t* inout = &g_hash[thread<<3]; + + *(uint2x4*)&hash[0] = __ldg4((uint2x4*)&inout[0]); + *(uint2x4*)&hash[4] = __ldg4((uint2x4*)&inout[4]); + + __threadfence_block(); + + K0[0] = vectorize(0x74a5d4ce2efc83b3); + + #pragma unroll 8 + for(uint32_t i=0;i<8;i++){ + buf[ i] = hash[ i] ^ K0[ 0]; + } + + for(int i=0; i<12; i++){ + GOST_FS(shared, buf, temp); + #pragma unroll 8 + for(uint32_t j=0;j<8;j++){ + buf[ j] = temp[ j] ^ *(uint2*)&precomputed_values[i][j]; + } + } + #pragma unroll 8 + for(int j=0;j<8;j++){ + buf[ j]^= hash[ j]; + } + #pragma unroll 8 + for(int j=0;j<8;j++){ + K0[ j] = buf[ j]; + } + + K0[7].y ^= 0x00020000; + + GOST_FS(shared, K0, t); + + #pragma unroll 8 + for(uint32_t i=0;i<8;i++) + K0[ i] = t[ i]; + + t[7].y ^= 0x01000000; + + GOST_E12(shared, K0, t); + + #pragma unroll 8 + for(int j=0;j<8;j++) + buf[ j] ^= t[ j]; + + buf[7].y ^= 0x01000000; + + GOST_FS(shared, buf,K0); + + buf[7].y ^= 0x00020000; + + #pragma unroll 8 + for(uint32_t j=0;j<8;j++) + t[ j] = K0[ j]; + + t[7].y ^= 0x00020000; + + GOST_E12(shared, K0, t); + + #pragma unroll 8 + for(uint32_t j=0;j<8;j++) + buf[ j] ^= t[ j]; + + GOST_FS(shared, buf,K0); // K = F(h) + + hash[7]+= vectorize(0x0100000000000000); + + #pragma unroll 8 + for(uint32_t j=0;j<8;j++) + t[ j] = K0[ j] ^ hash[ j]; + +// #pragma unroll + for(uint32_t i=0; i<10; i++){ + GOST_FS(shared, t, temp); + + #pragma unroll 8 + for(uint32_t j=0;j<8;j++){ + t[ j] = temp[ j]; + K0[ j] = K0[ j] ^ *(uint2*)&CC[ i][ j]; + } + + GOST_FS(shared, K0, temp); + + #pragma unroll 8 + for(uint32_t j=0;j<8;j++){ + K0[ j] = temp[ j]; + t[ j]^= temp[ j]; + } + } + + GOST_FS(shared, t, temp); + + #pragma unroll 8 + for(uint32_t j=0;j<8;j++){ + t[ j] = temp[ j]; + K0[ j] = K0[ j] ^ *(uint2*)&CC[10][ j]; + } + + GOST_FS(shared, K0, temp); + + #pragma unroll 8 + for(int i=7;i>=0;i--){ + t[i].x = t[i].x ^ temp[i].x; + temp[i].x = temp[i].x ^ ((uint32_t*)&CC[11])[i<<1]; + } + + uint2 last[2]; + +#define T0(x) shared[0][x] +#define T1(x) shared[1][x] +#define T2(x) shared[2][x] +#define T3(x) shared[3][x] +#define T4(x) shared[4][x] +#define T5(x) shared[5][x] +#define T6(x) shared[6][x] +#define T7(x) shared[7][x] + + last[ 0] = T0(__byte_perm(t[7].x,0,0x44443)) ^ T1(__byte_perm(t[6].x,0,0x44443)) + ^ T2(__byte_perm(t[5].x,0,0x44443)) ^ T3(__byte_perm(t[4].x,0,0x44443)) + ^ T4(__byte_perm(t[3].x,0,0x44443)) ^ T5(__byte_perm(t[2].x,0,0x44443)) + ^ T6(__byte_perm(t[1].x,0,0x44443)) ^ T7(__byte_perm(t[0].x,0,0x44443)); + + last[ 1] = T0(__byte_perm(temp[7].x,0,0x44443)) ^ T1(__byte_perm(temp[6].x,0,0x44443)) + ^ T2(__byte_perm(temp[5].x,0,0x44443)) ^ T3(__byte_perm(temp[4].x,0,0x44443)) + ^ T4(__byte_perm(temp[3].x,0,0x44443)) ^ T5(__byte_perm(temp[2].x,0,0x44443)) + ^ T6(__byte_perm(temp[1].x,0,0x44443)) ^ T7(__byte_perm(temp[0].x,0,0x44443)); + + if(devectorize(buf[3] ^ hash[3] ^ last[ 0] ^ last[ 1]) <= target64[3]){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } +} + +__host__ +void streebog_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash,uint32_t* d_resNonce) +{ + dim3 grid((threads + TPB-1) / TPB); + dim3 block(TPB); + + streebog_gpu_hash_64_final<<>>((uint64_t*)d_hash, d_resNonce); +} diff --git a/streebog/sib.cu b/streebog/sib.cu new file mode 100644 index 0000000..24de940 --- /dev/null +++ b/streebog/sib.cu @@ -0,0 +1,240 @@ +extern "C" { +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" +#include "sph/sph_streebog.h" +} + +#include "miner.h" +#include "cuda_helper.h" +#include "x11/cuda_x11.h" + +extern void streebog_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void keccak_streebog_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void keccak_streebog_luffa_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +#include +#include + +#define NBN 2 +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +// Sibcoin CPU Hash +extern "C" void sibhash(void *output, const void *input) +{ + unsigned char _ALIGN(128) hash[128] = { 0 }; + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_skein512_context ctx_skein; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_gost512_context ctx_gost; + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, (void*) hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512 (&ctx_bmw, (const void*) hash, 64); + sph_bmw512_close(&ctx_bmw, (void*) hash); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, (void*) hash); + + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, (void*) hash); + + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, (void*) hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + + sph_gost512_init(&ctx_gost); + sph_gost512(&ctx_gost, (const void*) hash, 64); + sph_gost512_close(&ctx_gost, (void*) hash); + + sph_luffa512_init(&ctx_luffa); + sph_luffa512 (&ctx_luffa, (const void*) hash, 64); + sph_luffa512_close (&ctx_luffa, (void*) hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512 (&ctx_cubehash, (const void*) hash, 64); + sph_cubehash512_close(&ctx_cubehash, (void*) hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512 (&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, (void*) hash); + + sph_simd512_init(&ctx_simd); + sph_simd512 (&ctx_simd, (const void*) hash, 64); + sph_simd512_close(&ctx_simd, (void*) hash); + + sph_echo512_init(&ctx_echo); + sph_echo512 (&ctx_echo, (const void*) hash, 64); + sph_echo512_close(&ctx_echo, (void*) hash); + + memcpy(output, hash, 32); +} + +//#define _DEBUG +#define _DEBUG_PREFIX "sib" +#include "cuda_debug.cuh" + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_sib(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + + int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<20; + else if(device_sm[dev_id]<=520) default_throughput = 1<<21; + else if(device_sm[dev_id]>520) default_throughput = 1<<22; + + if((strstr(device_name[dev_id], "3GB")))default_throughput = 1<<21; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + throughput&=0xFFFFFF70; //multiples of 128 due to keccak_streebog_luffa + + if (opt_benchmark) + ptarget[7] = 0xf; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + init[thr_id] = true; + } + + uint32_t endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + + do { + // Hash with CUDA + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + +// quark_keccak512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); +// streebog_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + keccak_streebog_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); +// x11_luffaCubehashShavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id], d_resNonce[thr_id], *(uint64_t*)&ptarget[6]); + + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + sibhash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], startNounce+h_resNonce[thr_id][1]); + sibhash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce; + + return 0; +} + +// cleanup +extern "C" void free_sib(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/streebog/streebog_arrays.cuh b/streebog/streebog_arrays.cuh new file mode 100644 index 0000000..c0c9464 --- /dev/null +++ b/streebog/streebog_arrays.cuh @@ -0,0 +1,310 @@ +// Tables for function F +__device__ uint2 T02[256] = { +{0x5B711FD0,0xE6F87E5C}, {0x0924FA16,0x25837780}, {0x852EA4A8,0xC849E07E}, {0x8F06C16A,0x5B4686A1}, {0xD77B416E,0x0B32E9A2}, {0x67815C66,0xABDA37A4}, {0x1A686676,0xF61796A8}, {0x6391954B,0xF5DC0B70}, +{0xB7E64BF1,0x4862F38D}, {0x68BD85C5,0xFF5C629A}, {0xFCD75795,0xCB827DA6}, {0x69B9F089,0x66D36DAF}, {0x483D83B0,0x356C9F74}, {0x238C99A1,0x7CBCECB1}, {0x31C4708D,0x36A702AC}, {0x2FBCDFD6,0x9EB6A8D0}, +{0xE5B3AE37,0x8B19FA51}, {0x8A127D0B,0x9CCFB540}, {0x08208F5A,0xBC0C78B5}, {0x2288ECED,0xE533E384}, {0x77C15FD2,0xCEC2C7D3}, {0x505D0F5E,0xEC7817B6}, {0x8336871D,0xB94CC2C0}, {0xCB0B04AD,0x8C205DB4}, +{0x28A0892F,0x763C855B}, {0xF6FF3257,0x588D1B79}, {0x4311933E,0x3FECF69E}, {0x803A18C9,0x0FC0D39F}, {0xF5F3AD83,0xEE010A26}, {0x411979A6,0x10EFE8F4}, {0x7DE93A10,0x5DCDA10C}, {0x1248E92C,0x4A1BEE1D}, +{0x21847339,0x53BFF2DB}, {0xA6A23D09,0xB4F50CCF}, {0xD84798CD,0x5FB4BC9C}, {0x071C56F9,0xE88A2D8B}, {0x5A756A9C,0x7F777169}, {0xA0BA1EBC,0xC5F02E71}, {0x4215E672,0xA663F9AB}, {0xDE5FBB78,0x2EB19E22}, +{0x2594BA14,0x0DB9CE0F}, {0x97664D84,0x82520E63}, {0x0208EA98,0x2F031E6A}, {0xA1BE6BF0,0x5C7F2144}, {0xD16362DB,0x7A37CB1C}, {0x4B311C64,0x83E08E2B}, {0xAB960E32,0xCF70479B}, {0xB9DEE71E,0x856BA986}, +{0x7AF56CE9,0xB5478C87}, {0x5F61D6FD,0xB8FE4288}, {0x966238C8,0x1BDD0156}, {0x3EF8A92E,0x62215792}, {0x114476F8,0xFC97FF42}, {0x56452CEB,0x9D7D3508}, {0xE0A71256,0x4C90C9B0}, {0xFBCB016C,0x2308502D}, +{0xA7A64845,0x2D7A03FA}, {0xBFC6C4AB,0xF46E8B38}, {0xD477DEBA,0xBDBEF8FD}, {0xC8079B79,0x3AAC4CEB}, {0xE8879D0C,0xF09CB105}, {0xAC8A58CB,0x27FA6A10}, {0x401D0CEA,0x8960E7C1}, {0x4A356928,0x1A6F811E}, +{0x73D196FF,0x90C4FB07}, {0x609D0A9F,0x43501A2F}, {0xC63F3796,0xF7A516E0}, {0xB8DA9252,0x1CE4A6B3}, {0x38E08A9B,0x1324752C}, {0x3BEC154F,0xA5A86473}, {0x5549B33F,0x2BF12457}, {0x440DC5C7,0xD766DB15}, +{0x9E42B792,0xA7D179E3}, {0x61997FD3,0xDADF151A}, {0xC0271423,0x86A0345E}, {0x6DA939A4,0x38D5517B}, {0x104003B4,0x6518F077}, {0xA5AEA2DD,0x02791D90}, {0x9C4A5D0A,0x88D26789}, {0x0A2865C2,0x930F66DF}, +{0x4509B08B,0x4EE9D420}, {0x6685292A,0x32553891}, {0xC533A842,0x412907BF}, {0x544DC673,0xB27E2B62}, {0x6295E007,0x6C530445}, {0x5351908A,0x5AF406E9}, {0xC123616F,0x1F2F3B6B}, {0x5255E5C6,0xC37B09DC}, +{0xB1FE6844,0x3967D133}, {0xF0E711E2,0x298839C7}, {0x1964F9A2,0x409B87F7}, {0xDB4B0719,0xE938ADC3}, {0xF9C3EBF4,0x0C0B4E47}, {0xD36B8843,0x5534D576}, {0xEB8B02D8,0x4610A05A}, {0x8232F251,0x20C3CDF5}, +{0xBEC2B1E7,0x6DE1840D}, {0xB0FA1D08,0xA0E8DE06}, {0x0D34333B,0x7B854B54}, {0xBCCA5B7F,0x42E29A67}, {0xC437DD0E,0xD8A6088A}, {0xD943ED81,0xC63BB3A9}, {0x5E65A3B1,0x21714DBD}, {0xB5EEA169,0x6761EDE7}, +{0xD573ABF6,0x2431F7C8}, {0xE1A3671A,0xD51FC685}, {0x0410C92D,0x5E063CD4}, {0x2CB04002,0x283AB98F}, {0xB2F2F790,0x8FEBC06C}, {0x6FA1D33C,0x17D64F11}, {0xA99EE4AA,0xE07359F1}, {0x74CDC006,0x784ED68C}, +{0xC73B42DA,0x6E2A19D5}, {0x1C7045C3,0x8712B416}, {0xED93216D,0x371582E4}, {0x4939F6FC,0xACE39041}, {0x86223B7C,0x7EC5F121}, {0x2BAC16FB,0xC0B09404}, {0x9A527EBF,0xF9D74537}, {0xA3B68168,0x737C3F2E}, +{0xBAD278CA,0x33E7B8D9}, {0xC22FFEBB,0xA9A32A34}, {0xFEDFBD0D,0xE48163CC}, {0x6EA5A670,0x8E594024}, {0x842AD1E4,0x51C6EF4B}, {0x279C508C,0x22BAD065}, {0x18608CEE,0xD91488C2}, {0x1F7CDA17,0x319EA549}, +{0x134C9C60,0xD394E128}, {0x72D5E3B3,0x094BF432}, {0xA4AAD791,0x9BF612A5}, {0xD26FFD0F,0xCCBBDA43}, {0x946AD250,0x34DE1F3C}, {0x995EE16B,0x4F5B5468}, {0xEA8F7794,0xDF9FAF6F}, {0x70DD092B,0x2648EA58}, +{0x71D97C67,0xBFC7E56D}, {0x4F21D549,0xDDE6B2FF}, {0x3AE86003,0x3C276B46}, {0xAF86C71F,0x91767B4F}, {0x35D4B9A0,0x68A13E78}, {0x030C9FD4,0xB68C115F}, {0x16582001,0x141DD2C9}, {0xDD5324AC,0x983D8F7D}, +{0xCC175254,0x64AA703F}, {0x8E02B426,0xC2C98994}, {0x9F46C2DE,0x3E5E76D6}, {0x587D8004,0x50746F03}, {0x9272F1E5,0x45DB3D82}, {0x9B560BF3,0x60584A02}, {0x3FFCDC62,0xFBAE58A7}, {0x6CAD4CE8,0xA15A5E4E}, +{0xCE1FB8CC,0x4BA96E55}, {0xAE82B253,0x08F9747A}, {0xF7FB471B,0xC102144C}, {0xF3EB8E36,0x9F042898}, {0xF2EFFB7A,0x068B27AD}, {0x8C0A5EBE,0xEDCA97FE}, {0xF4F7D8CF,0x778E0513}, {0xC32B8BF7,0x302C2501}, +{0x175C554D,0x8D92DDFC}, {0x46052F5F,0xF865C57F}, {0xA2B2F424,0xEAF3301B}, {0xBBD60D86,0xAA68B7EC}, {0x0104754C,0x998F0F35}, {0x00000000,0x00000000}, {0x34D0CCEC,0xF12E314D}, {0x061823B5,0x710522BE}, +{0x30C005C1,0xAF280D99}, {0x5D693C65,0x97FD5CE2}, {0x33CC9A15,0x19A41CC6}, {0xF8C79EB8,0x95844172}, {0x937684A9,0xDC5432B7}, {0x2490CF58,0x9436C13A}, {0x32C8EF59,0x802B13F3}, {0x7CED4F5C,0xC442AE39}, +{0xE3AB8D82,0xFA1CD8EF}, {0x4D293FD1,0xF2E5AC95}, {0x907A1B7D,0x6AD823E8}, {0x3CF043B6,0x4D2249F8}, {0x79F9F33D,0x03CB9DD8}, {0x36D82674,0xDE2D2F27}, {0x891EE2DF,0x2A43A41F}, {0x1B6C133A,0x6F98999D}, +{0x3DF436FA,0xD4AD46CD}, {0x269825C0,0xBB35DF50}, {0x813E6D85,0x964FDCAA}, {0x7EE5A5C4,0xEB41B053}, {0x8B160847,0x0540BA75}, {0xE7BB44AF,0xA41AE43B}, {0xD0671797,0xE3B8C429}, {0xEE9FBEB9,0x819993BB}, +{0xEC975421,0xAE9A8DD1}, {0x917E6E31,0xF3572CDD}, {0xE2AFF8CE,0x6393D7DA}, {0x37DC5338,0x47A22012}, {0xC903EE35,0xA32343DE}, {0xA89A91E6,0x79FC56C4}, {0xDC5751E0,0x01B28048}, {0xE4B7DB7B,0x1296F564}, +{0x51597A12,0x75F71883}, {0xBDCE2E33,0xDB6D9552}, {0x1D74308F,0x1E9DBB23}, {0xFDD322D9,0x520D7293}, {0x0C304677,0xE20A4461}, {0xB4EAD425,0xFEEEE2D2}, {0x20800675,0xCA30FDEE}, {0x47015A13,0x61EACA4A}, +{0x87264E30,0xE74AFE14}, {0x7BF119A5,0x2CC883B2}, {0xB3F682DC,0x1664CF59}, {0x1E78AF5B,0xA811AA7C}, {0x648DC3B2,0x1D5626FB}, {0xDF5BCE34,0xB73E9117}, {0x6AB56F5D,0xD05F7CF0}, {0xCD132718,0xFD257F0A}, +{0x76C52A9E,0x574DC8E6}, {0x2EB8AA9A,0x0739A7E5}, {0x0F3CD9A3,0x5486553E}, {0xAA927B7E,0x56FF48AE}, {0xAD8E2D87,0xBE756525}, {0xFFDBC841,0x7D0E6CF9}, {0x1450CA99,0x3B1ECCA3}, {0xE983E840,0x6913BE30}, +{0x956EA71C,0xAD511009}, {0x2DB4354E,0xB1B5B6BA}, {0x4E25A005,0x4469BDCA}, {0xCA0F71E1,0x15AF5281}, {0x8D0E2BF2,0x744598CB}, {0x2AA863B7,0x593F9B31}, {0x29A4FC63,0xEFB38A6E}, {0x4C2D4A9D,0x6B6AA3A0}, +{0xE6BF31E3,0x3D95EB0E}, {0x1554BFD5,0xA291C396}, {0xEF9BCBF5,0x18169C8E}, {0x9D4E2846,0x115D68BC}, {0xFACF7420,0xBA875F18}, {0xB6E23EBD,0xD1EDFCB8}, {0xF1E364AE,0xB00736F2}, {0x6589B6FE,0x84D929CE}, +{0xDA4F7255,0x70B7A2F6}, {0x5C6D4929,0x0E7253D7}, {0x574159A7,0x04F23A3D}, {0x0B2C108E,0x0A8069EA}, {0x6BB11A11,0x49D073C5}, {0x39E4FFD7,0x8AAB7A19}, {0x0E38ACEF,0xCD095A0B}, {0x5979F548,0xC9FB6036}, +{0xD67F3422,0x92BDE697}, {0x0514BC61,0xC78933E1}, {0x75C9B54A,0xE1C1D9B9}, {0xCF1BCD80,0xD2266160}, {0x78FD8671,0x9A4492ED}, {0x881A9793,0xB3CCAB2A}, {0x7FE1D088,0x72CEBF66}, {0x985A9427,0xD6D45B5D}, +}; + +__device__ uint2 T12[256] = { +{0x8C3F55DE,0xC811A805}, {0x96B50619,0x65F5B431}, {0xD6706E43,0xF74F96B1}, {0xCB43D336,0x859D1E8B}, {0xCCFA3D84,0x5AAB8A85}, {0xC295FCFD,0xF9C7BF99}, {0xDE4B630F,0xA21FD5A1}, {0x3B8B456D,0xCDB3EF76}, +{0x7CF7C385,0x803F59F8}, {0x5F31913C,0xB27C73BE}, {0x33B04821,0x98E3AC66}, {0x26B8F818,0xBF61674C}, {0xC4C130C8,0x0FFBC995}, {0x10761A98,0xAAA08620}, {0x210116AA,0x6057F342}, {0x0654CC35,0xF63C760C}, +{0x667D9042,0x2DDB45CC}, {0x4BD40382,0xBCF45A96}, {0xEF3C6F3D,0x68E8A0C3}, {0x69FF73BC,0xA7BD92D2}, {0x01ED2287,0x290AE202}, {0xE885818F,0xB7DE34CD}, {0xDD61059B,0xD901EEA7}, {0x19A03553,0xD6FA2732}, +{0x74CCCEC9,0xD56F1AE8}, {0x2E83F554,0xEA31245C}, {0xA07BE499,0x7034555D}, {0x56E7BEF7,0xCE26D2AC}, {0xA5054E38,0xFD161857}, {0x527436D1,0x6A0E7DA4}, {0x1CDE9FF2,0x5BD86A38}, {0x31770C32,0xCAF77562}, +{0xE279C8D0,0xB09AAED9}, {0xC60674DB,0x5DEF1091}, {0x515E5045,0x111046A2}, {0x729802FC,0x23536CE4}, {0xF5B63CFA,0xC50CBCF7}, {0xCD171F03,0x73A16887}, {0xD9F28DBD,0x7D2941AF}, {0x5A4F3B9D,0x3F5E3EB4}, +{0x1B677140,0x84EEFE36}, {0xE7076271,0x3DB8E3D3}, {0xF20FD248,0x1A3A28F9}, {0xB49E7627,0x7EBC7C75}, {0xC7EB565C,0x74E5F293}, {0x4F478BA4,0x18DCF59E}, {0xA9ADCB52,0x0C6EF44F}, {0x98DAC760,0xC699812D}, +{0x6E469D0E,0x788B06DC}, {0x7521EC4E,0xFC65F8EA}, {0x9E8E0B55,0x30A5F721}, {0xBCA57B6B,0x2BEC3F65}, {0xBAF1B75E,0xDDD04969}, {0xE394EA57,0x99904CDB}, {0xE6EA40F6,0x14B201D1}, {0x41284ADD,0xBBB0C082}, +{0xBF8F1DFF,0x50F20463}, {0x93CBACB8,0xE8D7F93B}, {0x477C86E8,0x4D8CB68E}, {0x92268E3F,0xC1DD1B39}, {0x09D62FCB,0x7C5AA112}, {0xDB35C9AE,0x2F3D98AB}, {0x2BFD5FF5,0x67136956}, {0x36CEE280,0x15C1E16C}, +{0xF8F39B17,0x1D7EB2ED}, {0xB00DFE01,0xDA94D37D}, {0x760B8ADA,0x877BC3EC}, {0xE153AE44,0xCB8495DF}, {0xB7B410B3,0x05A24773}, {0x3C32ABDF,0x12857B78}, {0x6812513B,0x8EB770D0}, {0xD2E3E665,0x536739B9}, +{0x71B26468,0x584D57E2}, {0xC9849725,0xD789C78F}, {0x7D1AE102,0xA935BBFA}, {0xDFA64188,0x8B1537A3}, {0xC378DE7A,0xD0CD5D9B}, {0x4D80CFB7,0x4AC82C9A}, {0x83BDB620,0x42777F1B}, {0x1D33BD75,0x72D2883A}, +{0xAB6A8F41,0x5E7A2D4B}, {0xBB1C95D9,0xF4DAAB6B}, {0xFD8D31B6,0x905CFFE7}, {0x119B381F,0x83AA6422}, {0x42022C49,0xC0AEFB84}, {0x63033AE3,0xA0F908C6}, {0x04938826,0xA428AF08}, {0x1A8A53C7,0xADE41C34}, +{0x77E6A85D,0xAE7121EE}, {0x25929E8C,0xC47F5C4A}, {0x55CDD863,0xB538E9AA}, {0xDAD8EB29,0x06377AA9}, {0xB3279895,0xA18AE87B}, {0x35E48414,0x6EDFDA6A}, {0x825094A7,0x6B7D9D19}, {0xA4E86CBF,0xD41CFA55}, +{0xEA42C59C,0xE5CAEDC9}, {0x0E6FC179,0xA36C351C}, {0x6FABBF89,0x5181E4DE}, {0x184D17D4,0xFFF0C530}, {0x84045892,0x9D41EB15}, {0x28D73961,0x1C0D5250}, {0x0CA8856A,0xF178EC18}, {0x8EF811CD,0x9A057101}, +{0x3EF5EFCC,0x4091A27C}, {0x9F6329D2,0x19AF1523}, {0xF91EB990,0x347450EF}, {0x8DD27759,0xE11B4A07}, {0xFC601331,0xB9561DE5}, {0x2DA993C0,0x912F1F5A}, {0x5BA2191A,0x1654DCB6}, {0x8A6B99EB,0x3E2DDE09}, +{0x0F82E3FE,0x8A66D71E}, {0xD55A08D7,0x8C51ADB7}, {0x8941FF7F,0x4533E50F}, {0xBD4859EC,0x02E6DD67}, {0x5DF6D52F,0xE068AABA}, {0xFF4A75A5,0xC24826E3}, {0x88ACDDF8,0x6C39070D}, {0x4691A46F,0x6486548C}, +{0x135C7C0C,0xD1BEBD26}, {0x8F15334A,0xB30F9303}, {0xC1BF9A69,0x82D9849F}, {0x5420FAE4,0x9C320BA8}, {0xAFF90767,0xFA528243}, {0xE968A308,0x9ED4D6CF}, {0x2C44B147,0xB825FD58}, {0x5EDCB3BB,0x9B7691BC}, +{0x48FE6516,0xC7EA6190}, {0x817AF233,0x1063A61F}, {0x3409A693,0x47D53868}, {0x4C6DED30,0x63C2CE98}, {0x6C81D91D,0x2A9FDFD8}, {0x032A6694,0x7B1E3B06}, {0xFBD9FD83,0x666089EB}, {0x7375207B,0x0A598EE6}, +{0x0AFC495F,0x07449A14}, {0xB6593234,0x2CA8A571}, {0x45BBC2FB,0x1F986F8A}, {0x50B372C2,0x381AA4A0}, {0xD81FAF3A,0x5423A3AD}, {0x8B86BB6C,0x17273C0B}, {0xC869B5A2,0xFE83258D}, {0xD1C980F1,0x287902BF}, +{0x6B3837AF,0xF5A94BD6}, {0xB2CABA12,0x88800A79}, {0x083B0D4C,0x55504310}, {0x07B9EEB2,0xDF36940E}, {0x6790B2C5,0x04D1A7CE}, {0xF125B4DC,0x612413FF}, {0xC52C124F,0x26F12B97}, {0xA62F28AC,0x86082351}, +{0x9937E5E7,0xEF93632F}, {0x293A1BE6,0x3507B052}, {0x570A9C70,0xE72C30AE}, {0xAE1425E0,0xD3586041}, {0xD79D4CC4,0xDE4574B3}, {0x40C5685A,0x92BA2280}, {0xDC8C271C,0xF00B0CA5}, {0xF69C5A6E,0xBE1287F1}, +{0xB1E0DC86,0xF39E317F}, {0x20EC342D,0x495D1140}, {0x3F18CD4B,0x699B407E}, {0x6AD51528,0xDCA3A9D4}, {0x79896924,0x0D1D14F2}, {0x00000000,0x00000000}, {0xA196C61E,0x593EB75F}, {0x0B116BD8,0x2E4E7816}, +{0x58887F8E,0x6D4AE7B0}, {0x872E3E06,0xE65FD013}, {0xD30EC4E2,0x7A6DDBBB}, {0xCAAEF1B1,0xAC97FC89}, {0x1E19DBE1,0x09CCB33C}, {0x62EE1864,0x89F3EAC4}, {0xAA87ADC6,0x7770CF49}, {0x6557F6D6,0x56C57ECA}, +{0x6D6CFB9A,0x03953DDA}, {0x4456E07C,0x36928D88}, {0x959F608D,0x1EEB8F37}, {0x4EAAA923,0x31D6179C}, {0xE5C02662,0x6FAC3AD7}, {0x53991456,0x43049FA6}, {0xC052B8EE,0xABD3669D}, {0xA7C20A2B,0xAF02C153}, +{0x3723C007,0x3CCB036E}, {0x90E1CA2C,0x93C9C23D}, {0x2F6ED7D3,0xC33BC65E}, {0x9758249E,0x4CFF5633}, {0x325D6AA6,0xB1E94E64}, {0x9472420A,0x37E16D35}, {0xBE623F78,0x79F8E661}, {0x02C74413,0x5214D904}, +{0xF0C8965B,0x482EF1FD}, {0xEC1609A9,0x13F69BC5}, {0x14E592BE,0x0E882928}, {0x2A107D72,0x4E198B54}, {0xEBAFE71B,0xCCC00FCB}, {0x222B703E,0x1B49C844}, {0xA840E9D5,0x2564164D}, {0x1FF4F966,0x20C6513E}, +{0x910CE8AB,0xBAC3203F}, {0x61C47EF0,0xF2EDD1C2}, {0xACD361F3,0x814CB945}, {0x4A392105,0x95FEB894}, {0x1622D6AD,0x5C9CF02C}, {0xF77178E9,0x971865F3}, {0x9BF0A1F4,0xBD87BA2B}, {0x59655D09,0x444005B2}, +{0x247FBC0B,0xED75BE48}, {0x17CFF42A,0x7596122E}, {0x85E97A15,0xB44B0917}, {0x2755DA9F,0x966B854E}, {0x49134791,0xEEE08392}, {0x23C652B9,0x32432A46}, {0xAD3E4374,0xA8465B47}, {0x12B15E8B,0xF8B45F24}, +{0x78644BA3,0x2417F6F0}, {0x7FDDA511,0xFB2162FE}, {0x9DA46DC1,0x4BBBCC27}, {0xD024A276,0x0173E0BD}, {0xA2BCA08A,0x22208C59}, {0xB836F34D,0x8FC4906D}, {0x3A6667EA,0xE4B90D74}, {0x705F46EF,0x7147B5E0}, +{0x1508B039,0x2782CB2A}, {0xF45B1E7D,0xEC065EF5}, {0xCFD05B10,0x21B5B183}, {0x60295C77,0xDBE733C0}, {0x394C017E,0x9FA73672}, {0x86C31C81,0xCF553211}, {0x0D45A7ED,0xD8720E1A}, {0x3DDF8958,0x3B8F997A}, +{0xEDFB2B2E,0x3AFC79C7}, {0x43EF0ECE,0xE9A41986}, {0x7B4E2D37,0x5F09CDF6}, {0xFA34DF04,0x4F6A6BE9}, {0x38A123F9,0xB6ADD470}, {0x057EAAA1,0x8D224D0A}, {0x5C1BF7A8,0xC96248B8}, {0x309A2EB5,0xE3FD9760}, +{0xA351820D,0x0B2A6E5B}, {0xFEA75722,0xEB42C4E1}, {0x9A1D8373,0x948D5829}, {0x64BAD451,0x7FCF9CC8}, {0xD4B72A50,0xA55B4FB5}, {0xCE3D7997,0x08BF5381}, {0xE42D04E5,0x46A6D8D5}, {0x7E308796,0xD22B80FC}, +{0xB57354A0,0x57B69E77}, {0x8097D0B4,0x3969441D}, {0xF3E2F0CF,0x3330CAFB}, {0xE0BE8CC3,0xE28E77DD}, {0x9C494F46,0x62B12E25}, {0xB9DBD1CA,0xA6CE726F}, {0xEED14DBA,0x41E242C1}, {0x7AA30FB0,0x76032FF4}, +}; + +__device__ uint2 T22[256] = { +{0x3ACDE4CC,0x45B268A9}, {0x84549D08,0xAF7F0BE8}, {0xC1468263,0x048354B3}, {0xC80EFED2,0x925435C2}, {0x7FDFFBA7,0xEE4E37F2}, {0x0C60F14D,0x167A3392}, {0xEA03E584,0xFB123B52}, {0xFDBB9007,0x4A0CAB53}, +{0x0F788A19,0x9DEAF638}, {0x8F0CB32A,0xCB48EC55}, {0xD6FEF7E0,0xB59DC4B2}, {0xF4F3ECB6,0xDCDBCA22}, {0x549A9C40,0x11DF5813}, {0x568ACED3,0xE33FDEDF}, {0x4322E9C3,0xA0C1C812}, {0x58FA6D0D,0x07A56B81}, +{0xB1E1F3DD,0x77279579}, {0x422AC004,0xD9B18B74}, {0xFFABC294,0xB8EC2D9F}, {0x2D75914F,0xF4ACF8A8}, {0xEF2B6878,0x7BBF69B1}, {0x487AC7E1,0xC4F62FAF}, {0xC67E5D0C,0x76CE809C}, {0x92E4C14C,0x6711D88F}, +{0x243DEDFE,0x627B99D9}, {0xDFB68B51,0x234AA5C3}, {0x262DBF6D,0x909B1F15}, {0x4B62BCB5,0x4F66EA05}, {0x52AA6AE8,0x1AE2CF5A}, {0xD0CE0148,0xBEA053FB}, {0xE66314C9,0xED6808C0}, {0x15A82710,0x43FE16CD}, +{0xA06970F6,0xCD049231}, {0x97CC4CB0,0xE7BC8A6C}, {0xFCB3B9C0,0x337CE835}, {0x7CC780F3,0x65DEF258}, {0x4132BB50,0x52214EDE}, {0x90F493DF,0x95F15E43}, {0x5DD2E0F1,0x87083962}, {0xFB8B66AF,0x41313C1A}, +{0x51B211BC,0x91720AF0}, {0xD4EEA573,0x477D427E}, {0xF6E3BE25,0x2E3B4CEE}, {0xEB0BCC43,0x82627834}, {0x78E724C8,0x9C03E3DD}, {0xD9867DF9,0x2877328A}, {0xE243B0F2,0x14B51945}, {0xF7EB97E2,0x574B0F88}, +{0x9AA4943A,0x88B6FA98}, {0xCB168586,0x19C4F068}, {0xAF11FAEF,0x50EE6409}, {0xC04EABA4,0x7DF317D5}, {0x98B4C6A9,0x7A567C54}, {0x4F42188E,0xB6BBFB80}, {0x3BC5CD0B,0x3CC22BCF}, {0xAA397713,0xD04336EA}, +{0xEC33132C,0xF02FAC1B}, {0xF0D3488D,0x2506DBA7}, {0xF2C31A1E,0xD7E65D6B}, {0x1FF820F5,0x5EB9B216}, {0xC46E0F9F,0x842E0650}, {0x9E843001,0x716BEB1D}, {0xAB315ED4,0xA933758C}, {0xA2792265,0x3FE414FD}, +{0x1EF00932,0x27C9F170}, {0x70A771BE,0x73A4C1CA}, {0xE76B3D0E,0x94184BA6}, {0x8C14C87E,0x40D829FF}, {0xC77674CB,0x0FBEC3FA}, {0x4A6A9572,0x3616A963}, {0xC25EF937,0x8F139119}, {0x5AEA3F9E,0xF545ED4D}, +{0x50BA387B,0xE8024996}, {0x0B582E22,0x6437E7BD}, {0xE053E261,0xE6559F89}, {0x05288DFC,0x80AD52E3}, {0xE34B9935,0x6DC55A23}, {0x1AD0AD09,0xDE14E0F5}, {0xA659865E,0xC6390578}, {0x09487CB1,0x96D76171}, +{0x21156002,0xE2D6CB3A}, {0x779FAED1,0x01E915E5}, {0x6A77DCB7,0xADB0213F}, {0xB9A1A6AB,0x9880B76E}, {0x8644CF9B,0x5D9F8D24}, {0xC5662658,0xFD5E4536}, {0x9BACBDFD,0xF1C6B9FE}, {0xBE9979C4,0xEACD6341}, +{0x08405576,0xEFA72217}, {0xD88E543E,0x510771EC}, {0x671F043D,0xC2BA51CB}, {0x71AF5879,0x0AD482AC}, {0x5CDAC936,0xFE787A04}, {0x8E049AED,0xB238AF33}, {0x4972EE26,0xBD866CC9}, {0xBD810290,0x615DA6EB}, +{0x8B2C1711,0x3295FDD0}, {0x73BF0AEA,0xF8340460}, {0x758FFC42,0xF3099329}, {0x7DCFA934,0x1CAEB13E}, {0x1188832B,0xBA230748}, {0x874CE65C,0x24EFCE42}, {0xB0E9DA1A,0x0E57D61F}, {0xF99B343C,0xB3D1BAD6}, +{0x893C4582,0xC0757B1C}, {0x403A9297,0x2B510DB8}, {0xF1DB614A,0x5C7698C1}, {0xD5E68CB4,0x3E0D0118}, {0x855CB4CF,0xD60F488E}, {0xF3CB33D9,0xAE961E0D}, {0x14A00ED7,0x3A8E55AB}, {0x623789C1,0x42170328}, +{0x9C946292,0x838B6DD1}, {0xED3B3AEB,0x895FEF7D}, {0x4E4A3149,0xCFCBB8E6}, {0x2F65C3DC,0x064C7E64}, {0x4C5A63DA,0x3D2B3E2A}, {0xA9210C47,0x5BD3F340}, {0xA1615931,0xB474D157}, {0x1DE87266,0xAC5934DA}, +{0x7AF7765B,0x6EE36511}, {0x16B05C44,0xC86ED367}, {0x201D49C5,0x9BA6885C}, {0x88346C45,0xB905387A}, {0xBAB9DDFF,0x131072C4}, {0xA751AF99,0xBF49461E}, {0x1CE05BA1,0xD52977BC}, {0x6027DB52,0xB0F785E4}, +{0x6E57788C,0x546D30BA}, {0x650F56AE,0x305AD707}, {0x612FF295,0xC987C682}, {0xF5FBC571,0xA5AB8944}, {0x59F244CA,0x7ED528E7}, {0x2C7DB888,0x8DDCBBCE}, {0x328DB1BA,0xAA154ABE}, {0x93ECE88B,0x1E619BE9}, +{0xE813B717,0x09F2BD9E}, {0x285D1CB3,0x7401AA4B}, {0x3195CAEE,0x21858F14}, {0x1398D1B8,0x48C38184}, {0xB2F98889,0xFCB750D3}, {0x8D1CE1B9,0x39A86A99}, {0xE473465A,0x1F888E0C}, {0x76978716,0x78995683}, +{0xEE2341BF,0x02CF2AD7}, {0xB3F1A14E,0x85C713B5}, {0x2B4567E7,0xFF916FE1}, {0xB7D10575,0x7C1A0230}, {0x5ECA9BA5,0x0C98FCC8}, {0xDA9E06AD,0xA3E7F720}, {0xBBB1F438,0x6A6031A2}, {0x7ED7D260,0x973E7494}, +{0x18C0FF9A,0x2CF46639}, {0x68678E24,0x5F50A7F3}, {0xA449D4CD,0x34D983B4}, {0x5592B587,0x68AF1B75}, {0x2E6DEA1B,0x7F3C3D02}, {0x45121F6B,0xABFC5F5B}, {0x29553574,0x0D71E92D}, {0x6D4F03D8,0xDFFDF510}, +{0x9F8C19C6,0x081BA87B}, {0xAC0981BB,0xDB7EA1A3}, {0x66172DFA,0xBBCA12AD}, {0x010829C7,0x79704366}, {0x7BFF5F9C,0x17932677}, {0x00000000,0x00000000}, {0xC906D715,0xEB2476A4}, {0x0738DF6F,0x724DD42F}, +{0x38DDB65F,0xB752EE65}, {0x3DF53BA3,0x37FFBC86}, {0xB5C157E6,0x8EFA84FC}, {0x272596AA,0xE9EB5C73}, {0x2535C439,0x1B0BDABF}, {0x2A4D4E20,0x86E12C87}, {0xCE3E087A,0x9969A28B}, {0x9D9C4B55,0xFAFB2EB7}, +{0xB6D92CB2,0x056A4156}, {0xDEBEA296,0x5A3AE6A5}, {0xA8292580,0x22A3B026}, {0x36AD1581,0x53C85B3B}, {0x17B87583,0xB11E9001}, {0x3FE56930,0xC51F3A4A}, {0xCF3621BD,0xE019E1ED}, {0x91FCBA18,0xEC811D25}, +{0x4D524A1D,0x445B7D4C}, {0xDCAEF005,0xA8DA6069}, {0x309DE329,0x58F5CC72}, {0x6B7FF570,0xD4C06259}, {0x39D59F98,0xCE22AD03}, {0x47024DF8,0x591CD997}, {0x03187B54,0x8B90C5AA}, {0xC356D0F0,0xF663D27F}, +{0x35B56ED5,0xD8589E91}, {0xD3D67A1C,0x35309651}, {0xCD26732E,0x12F96721}, {0x441A36AC,0xD28C1C3D}, {0x64077F69,0x492A9461}, {0x6F5F514B,0x2D1D73DC}, {0x0D68D88A,0x6F0A70F4}, {0xCA1EAC41,0x60B4B30E}, +{0x3385987D,0xD36509D8}, {0x0630F6A8,0x0B3D9749}, {0x96C46577,0x9ECCC90A}, {0xAD01A87C,0xA20EE2C5}, {0x0E70A3DE,0xE49AB55E}, {0x82646BA0,0xA4429CA1}, {0xDB962F6A,0xDA97B446}, {0xD7F6DE27,0xCCED87D4}, +{0x37A53C46,0x2AB8185D}, {0xE15BCBA6,0x9F25DCEF}, {0xFEA3EB53,0xC19C6EF9}, {0x1BD884CE,0xA764A393}, {0x817C10F4,0x2FD2590B}, {0x80743933,0x56A21A6D}, {0x79EF0D0F,0xE573A0BB}, {0x95DC1E23,0x155C0CA0}, +{0x94D437E4,0x6C2C4FC6}, {0x23053291,0x10364DF6}, {0x836C4267,0xDD32DFC7}, {0x99BCEF6E,0x03263F32}, {0xE57B6F9D,0x66F8CD6A}, {0x5BE21659,0x8C35AE2B}, {0x1290F87F,0x31B3C2E2}, {0xBF915003,0x93BD2027}, +{0x220D1B56,0x69460E90}, {0xAE19D328,0x299E276F}, {0x53A2432F,0x63928C3C}, {0xE91B9ED0,0x7082FEF8}, {0x3EED40F7,0xBC6F792C}, {0xD2DE53DB,0x4C40D537}, {0x5FC2B262,0x75E8BFAE}, {0xA541FD0A,0x4DA9C0D2}, +{0x3CFD1264,0x4E8FFFE0}, {0x696FA7E3,0x2620E495}, {0xB8A98F6C,0xE1F0F408}, {0xDDA6D9C2,0xD1AA230F}, {0xD1C6288F,0xC7D0109D}, {0x7487D585,0x8A79D04F}, {0xA3710BA2,0x4694579B}, {0xFA834F68,0x38417F7C}, +{0x0A5007E5,0x1D47A4DB}, {0x460A643F,0x206C9AF1}, {0x34BD4712,0xA128DDF7}, {0x72B7232D,0x81444706}, {0x02105293,0xF2E086CC}, {0xBC892B57,0x182DE58D}, {0xF8931DFB,0xCAA1F9B0}, {0xCC2E5AE9,0x6B892447}, +{0x0420A43B,0xF9DD1185}, {0x8A243ED6,0x4BE5BEB6}, {0x19C8D65D,0x5584255F}, {0x633FA006,0x3B67404E}, {0x6C472A1F,0xA68DB676}, {0xB4C97E21,0xF78AC79A}, {0x1080AAEC,0xC353442E}, {0x5782E714,0x9A4F9DB9}, +}; + +__device__ uint2 T32[256] = { +{0x2C9B3220,0x05BA7BC8}, {0xF8B65E4F,0x31A54665}, {0x7547F4D4,0xB1B651F7}, {0x7BA46682,0x8BFA0D85}, {0xA16A98BB,0x85A96C5A}, {0x08EB79C9,0x990FAEF9}, {0x47F4A62D,0xA15E37A2}, {0x5D27741E,0x76857DCD}, +{0x0A1820BC,0xF8C50B80}, {0x01F7A2B4,0xBE65DCB2}, {0x6F9426E7,0x666D1B98}, {0x53C4E648,0x4CC921BF}, {0x93D9CA42,0x95410A0F}, {0x647BA4EF,0x20CDCCAA}, {0x890A1871,0x429A4060}, {0x9B32B38B,0x0C4EA4F6}, +{0xDE354CD3,0xCCDA362D}, {0x7C5B2FA9,0x96DC23BC}, {0xAA851AB3,0xC309BB68}, {0x3648E013,0xD26131A7}, {0x41FC4DB2,0x021DC529}, {0x704BE48A,0xCD5ADAB7}, {0x84ED71E6,0xA77965D9}, {0x1734BBA4,0x32386FD6}, +{0x38AB7245,0xE82D6DD5}, {0x6177B4B1,0x5C2147EA}, {0xCF091CE8,0x5DA1AB70}, {0x72B8BDFF,0xAC907FCE}, {0x972278A8,0x57C85DFD}, {0x6B6F940D,0xA4E44C6A}, {0x4F1FDFE4,0x3851995B}, {0xED71BC9E,0x62578CCA}, +{0xC01D2C0A,0xD9882BB0}, {0x113C503B,0x917B9D5D}, {0xA87643C6,0xA2C31E11}, {0xA399C1CE,0xE463C923}, {0x7EA876DC,0xF71686C5}, {0xE096D509,0x87B4A973}, {0x9D3A5814,0xAF0D567D}, {0x59DCC6F4,0xB40C2A3F}, +{0x95D121DD,0x3602F884}, {0x9836484A,0xD3E1DD3D}, {0xA46688E5,0xF945E71A}, {0xB2A591F5,0x7518547E}, {0x50C01D89,0x93665874}, {0x658C065B,0x9EA81018}, {0xBC4603A3,0x4F54080C}, {0x5137BF3D,0x2D0384C6}, +{0xEC861E2A,0xDC325078}, {0x79573FF7,0xEA30A8FC}, {0xCA050CB6,0x214D2030}, {0x8016C30C,0x65F0322B}, {0x1B247087,0x69BE96DD}, {0x81E161B8,0xDB95EE99}, {0xD9CA05F8,0xD1FC1814}, {0xCC0DE729,0x820ED2BB}, +{0x430F14C7,0x63D76050}, {0xA09D3A0F,0x3BCCB0E8}, {0x573F54A2,0x8E40764D}, {0xE16177BD,0x39D175C1}, {0x734F1F4B,0x12F5A37C}, {0x1FDFC26D,0xAB37C12F}, {0x395CD0F1,0x5648B167}, {0x37BF42A7,0x6C04ED15}, +{0x14304065,0xED97161D}, {0xAB72B807,0x7D6C67DA}, {0xBA4EE83C,0xEC17FA87}, {0x0304FBC1,0xDFAF79CB}, {0x71BC463E,0x733F0605}, {0x87E98A27,0x78D61C12}, {0x77B4ADA1,0xD07CF48E}, {0x6C90DD26,0xB9C26253}, +{0x60801605,0xE2449B58}, {0xF941FCFB,0x8FC09AD7}, {0x4BE46D0E,0xFAD8CEA9}, {0x0608EB9F,0xA343F28B}, {0x4917347B,0x9B126BD0}, {0xE7699C22,0x9A92874A}, {0xC4E69EE0,0x1B017C42}, {0x0EE39256,0x3A4C5C72}, +{0x3EA399DA,0x4B6E9F5E}, {0x5AD83D35,0x6BA353F4}, {0x4C1B2425,0xE7FEE090}, {0x2587E95D,0x22D00983}, {0x0F1430E2,0x842980C0}, {0x861E2893,0xC6B3C0A0}, {0x19D729F2,0x087433A4}, {0xD42D6C6F,0x341F3DAD}, +{0xFBB2A58E,0xEE0A3FAE}, {0x90DD3183,0x4AEE73C4}, {0xB1A16A34,0xAAB72DB5}, {0x5E238FDF,0xA92A0406}, {0x686B6FCC,0x7B4B35A1}, {0xF4A6956C,0x6A23BF6E}, {0x851AD352,0x191CB96B}, {0xD6DE351A,0x55D598D4}, +{0xF2AE7EF3,0xC9604DE5}, {0xA981E172,0x1CA6C2A3}, {0xAD7A5398,0xDE2F9551}, {0x56C8F616,0x3025AAFF}, {0x1E2860D9,0x15521D9D}, {0xFA45073A,0x506FE31C}, {0x2B647B0B,0x189C55F1}, {0xAE7EA859,0x0180EC9A}, +{0x050C105E,0x7CEC8B40}, {0x8BF94104,0x2350E519}, {0x55CC0DD7,0xEF8AD334}, {0x6D677F92,0x07A7BEE1}, {0x0DE76997,0xE5E325B9}, {0xA26E637A,0x5A061591}, {0x18208B46,0xB611EF16}, {0xB7A981AB,0x09F4DF3E}, +{0xE87DACC0,0x1EBB078A}, {0xB65E231F,0xB791038C}, {0x74B05660,0x0FD38D45}, {0xC1EA8EBE,0x67EDF702}, {0x831238CD,0xBA5F4BE0}, {0xCEFEBE5C,0xE3C477C2}, {0x354C1BD2,0x0DCE486C}, {0x16C31910,0x8C5DB364}, +{0xA7627324,0x26EA9ED1}, {0xEF82E5EB,0x039D29B3}, {0xCBF2AE02,0x9F28FC82}, {0xF05D2786,0xA8AAE89C}, {0x2774B028,0x431AACFA}, {0x31B7A938,0xCF471F9E}, {0xE3922EC8,0x581BD0B8}, {0x400BEF06,0xBC78199B}, +{0xBF42F862,0x90FB71C7}, {0x46030499,0x1F3BEB10}, {0xB55AD8DE,0x683E7A47}, {0xA695D190,0x988F4263}, {0x6E638453,0xD808C72A}, {0xC319D7CB,0x0627527B}, {0xD72997AE,0xEBB04466}, {0xE2658C7C,0xE67E0C0A}, +{0xB056C880,0x14D2F107}, {0x30400B8C,0x7122C32C}, {0xD5DACEDB,0x8A7AE11F}, {0xE98A0E74,0xA0DEDB38}, {0xDCC615A6,0xAD109354}, {0xF655CC19,0x0BE91A17}, {0xB8BDB149,0x8DDD5FFE}, {0xAF890AED,0xBFE53028}, +{0xB4AD7A6A,0xD65BA6F5}, {0x2997227E,0x7956F088}, {0x32B352F9,0x10E86655}, {0xDACEFE39,0x0E5361DF}, {0x9FC90161,0xCEC7F304}, {0x677F5F2E,0xFF62B561}, {0xD22587F0,0x975CCF26}, {0x543BAF63,0x51EF0F86}, +{0x10CBF28F,0x2F1E41EF}, {0xBBB94A88,0x52722635}, {0x3344F04D,0xAE8DBAE7}, {0x6688FD9A,0x410769D3}, {0x34BBB966,0xB3AB94DE}, {0x8DF1AA9B,0x80131792}, {0xC5113C54,0xA564A0F0}, {0xBDB1A117,0xF131D4BE}, +{0xEA8EF5B5,0x7F71A2F3}, {0xC8F655C3,0x40878549}, {0x44F05DEC,0x7EF14E69}, {0xF55137D8,0xD44663DC}, {0x523344FC,0xF2ACFD0D}, {0x00000000,0x00000000}, {0x8EF5515A,0x5FBC6E59}, {0xF1AA8532,0x16CF342E}, +{0xDB395C8D,0xB036BD6D}, {0xDD31B712,0x13754FE6}, {0x2D6C9094,0xBBDFA77A}, {0x3A582B30,0x89E7C8AC}, {0xCDFA459D,0x3C6B0E09}, {0xC7E26521,0xC4AE0589}, {0x7F5FD468,0x49735A77}, {0x1D2C9B18,0xCAFD6456}, +{0x2F9FC9E1,0xDA150203}, {0x94268369,0x88672436}, {0x3BAF8984,0x3782141E}, {0x24704BE9,0x9CB5D531}, {0x1AD3D233,0xD7DB4A6F}, {0x2A93D9BF,0xA6F98943}, {0x8A0EE3B0,0x9D3539AB}, {0x15C7E2D1,0x53F2CAAF}, +{0x76430F15,0x6E19283C}, {0x6384EDC4,0x3DEBE293}, {0x208BF903,0x5E3C82C3}, {0xB94A13FD,0x33B8834C}, {0x2E686B55,0x6470DEB1}, {0x7A53C436,0x359FD137}, {0x02F35975,0x61CAA579}, {0x82E59A79,0x043A9752}, +{0x2683129C,0xFD7F7048}, {0x699CCD78,0xC52EE913}, {0x7DAC8D1D,0x28B9FF0E}, {0x78A09D43,0x5455744E}, {0xB3523341,0xCB7D88CC}, {0x4A13CFBA,0x44BD121B}, {0xFDBA4E11,0x4D49CD25}, {0x8C06082F,0x3E76CB20}, +{0x2278A076,0x3FF627BA}, {0x04FBB2EA,0xC28957F2}, {0xE46D67E3,0x453DFE81}, {0x3DA7621B,0x94C1E695}, {0xFF491764,0x2C83685C}, {0xFC4DECA5,0xF32C1197}, {0x922E68F6,0x2B24D6BD}, {0x9AC5113F,0xB22B7844}, +{0xD1217C31,0x48F3B6ED}, {0xBEB55AD6,0x2E9EAD75}, {0x5FD42D6B,0x174FD8B4}, {0x1238ABFA,0x4ED4E496}, {0xFEBEB5D0,0x92E6B4EE}, {0x0BEF8208,0x46A0D732}, {0xA5912A51,0x47203BA8}, {0xE69E3E96,0x24F75BF8}, +{0x13CF094E,0xF0B13824}, {0xC901F777,0xFEE259FB}, {0x091CDB7D,0x276A724B}, {0xEE75475F,0xBDF8F501}, {0x4DEC8691,0x599B3C22}, {0x99C1EAFE,0x6D84018F}, {0x1CDB39AC,0x7498B8E4}, {0x217C5BB7,0xE0595E71}, +{0x3C50C0AF,0x2AA43A27}, {0x3F543B6E,0xF50B43EC}, {0x62734F70,0x838E3E21}, {0x4507FF58,0xC09492DB}, {0xDFC2EE67,0x72BFEA9F}, {0x9CCDFAA0,0x11688ACF}, {0x6A9836B9,0x1A8190D8}, {0xC615C795,0x7ACBD93B}, +{0x286080CA,0xC7332C3A}, {0x4EE87D50,0x863445E9}, {0xD0D6DE85,0xF6966A5F}, {0x96D5DA1C,0xE9AD814F}, {0x9E3EA3D5,0x70A22FB6}, {0x582B6440,0x0A69F68D}, {0xC2EE757F,0xB8428EC9}, {0xAC8DF12C,0x604A49E3}, +{0x0C10CB23,0x5B86F90B}, {0x8F02F3EE,0xE1D9B2EB}, {0xD3D22544,0x29391394}, {0x5CD0D6AA,0xC8E0A17F}, {0xF7A26EAD,0xB58CC6A5}, {0x238F02C2,0x8193FB08}, {0x5B2F9F81,0xD5C68F46}, {0x88FDBAC5,0xFCFF9CD2}, +{0xF359DC47,0x77059157}, {0x07FF492B,0x1D262E39}, {0xE59AC557,0xFB582233}, {0x42F8B673,0xDDB2BCE2}, {0x48E096CF,0x2577B762}, {0xD83DA74C,0x6F99C4A6}, {0xEB795701,0xC1147E41}, {0x912A9337,0xF48BAF76}, +}; + +__device__ uint2 T42[256] = { +{0x9B2C0A19,0x3EF29D24}, {0xB6F8622F,0xE9E16322}, {0x47757F7A,0x55369940}, {0xA47B0B33,0x9F4D56D5}, {0x6AA1174C,0x82256746}, {0xEB082FB2,0xB8F5057D}, {0xF4475F53,0xCC48C10B}, {0x275DEC3A,0x373088D4}, +{0x180AED10,0x968F4325}, {0xF7016151,0x173D232C}, {0x946FCC13,0xAE4ED09F}, {0xC4539873,0xFD4B4741}, {0xD9933765,0x1B5B3F0D}, {0x7B644052,0x2FFCB096}, {0x0A89840C,0xE02376D2}, {0x329B18D7,0xA3AE3A70}, +{0x35DE8526,0x419CBD23}, {0x5B7C3199,0xFAFEBF11}, {0x85AA9B0D,0x0397074F}, {0x4836B970,0xC58AD4FB}, {0xFC4104A8,0xBEC60BE3}, {0x4B708772,0x1EFF36DC}, {0xED8453B6,0x131FDC33}, {0x341764D3,0x0844E33E}, +{0xAB38CD39,0x0FF11B6E}, {0x7761B85A,0x64351F0A}, {0x09CFBA0E,0x3B5694F5}, {0xB87245D0,0x30857084}, {0x2297AE3C,0x47AFB3BD}, {0x6F6B554A,0xF2BA5C2F}, {0x1F4F70E1,0x74BDC476}, {0x71EDC45E,0xCFDFC644}, +{0x1DC0AF16,0xE610784C}, {0x3C113F28,0x7ACA29D6}, {0x76A859AF,0x2DED4117}, {0x99A3D5EE,0xAC5F211E}, {0xA87EF33B,0xD484F949}, {0x96E013E4,0x3CE36CA5}, {0x3A9D432C,0xD120F098}, {0xDC597563,0x6BC40464}, +{0xD1956C9E,0x69D5F5E5}, {0x3698BB24,0x9AE95F04}, {0x66A4EF44,0xC9ECC8DA}, {0xA5B2EAC6,0xD69508C8}, {0xC0503B80,0xC40C2235}, {0x8C652103,0x38C193BA}, {0x46BC9E8F,0x1CEEC75D}, {0x37515AD1,0xD3310119}, +{0x86ECA50F,0xD8E2E568}, {0x5779C991,0xB137108D}, {0x05CA4206,0x709F3B69}, {0x1680CAEF,0x4FEB5083}, {0x241BD238,0xEC456AF3}, {0xE181ABBE,0x58D673AF}, {0xCAD9BF8C,0x242F54E7}, {0x0DCC19FD,0x0211F181}, +{0x0F43C60A,0x90BC4DBB}, {0x9DA0761D,0x9518446A}, {0x3F57012A,0xA1BFCBF1}, {0x61E172B5,0x2BDE4F89}, {0x4F732481,0x27B853A8}, {0xDF1F4B61,0xB0B1E643}, {0x5C39AC68,0x18CC3842}, {0xBF37D821,0xD2B7F7D7}, +{0x3014C720,0x3103864A}, {0x72ABFA5C,0x14AA2463}, {0x4EBAC574,0x6E600DB5}, {0x0403A3F3,0x39476574}, {0xBC71E623,0x09C215F0}, {0xE987F045,0x2A58B947}, {0xB477BDD8,0x7B4CDF18}, {0x906C6FE0,0x9709B5EB}, +{0x8060D90B,0x73083C26}, {0x41F9037E,0xFEDC400E}, {0xE44BE9B8,0x284948C6}, {0x08065BFB,0x728ECAE8}, {0x17492B1A,0x06330E9E}, {0x69E7294E,0x59508561}, {0xE6C4364F,0xBAE4F4FC}, {0xE30E7449,0xCA7BCF95}, +{0xA33E96C2,0x7D7FD186}, {0xD85AD690,0x52836110}, {0x1B4CD312,0x4DFAA102}, {0x872544FA,0x913ABB75}, {0x140F1518,0xDD46ECB9}, {0x1E869114,0x3D659A6B}, {0xD719109A,0xC23F2CAB}, {0x2DD46836,0xD713FE06}, +{0xB2FBC1DC,0xD0A60656}, {0xDD909496,0x221C5A79}, {0xA1B14935,0xEFD26DBC}, {0x235E4FC9,0x0E77EDA0}, {0x6B68F6B9,0xCBFD395B}, {0xA6F4D4C4,0x0DE0EAEF}, {0x1A8532E7,0x0422FF1F}, {0xDED6AA94,0xF969B85E}, +{0xAEF28F3F,0x7F6E2007}, {0x81A938FE,0x3AD0623B}, {0x7AADA1A7,0x6624EE8B}, {0xC856607B,0xB682E8DD}, {0x281E2A30,0xA78CC56F}, {0x45FAA08D,0xC79B257A}, {0x642B30B3,0x5B4174E0}, {0x7EAE0254,0x5F638BFF}, +{0x0C05F808,0x4BC9AF9C}, {0xF98B46AE,0xCE59308A}, {0xCC55C388,0x8FC58DA9}, {0x676D0EB1,0x803496C7}, {0xE70DD7BA,0xF33CAAE1}, {0x6EA2B4BF,0xBB620232}, {0x201871CB,0xD5020F87}, {0xA9B712CE,0x9D5CA754}, +{0x7DE83C56,0x841669D8}, {0x5EB6739F,0x8A618478}, {0xB0741E2B,0x420BBA6C}, {0xEAC1CE47,0xF12D5B60}, {0x1283691C,0x76AC35F7}, {0xFECEDB5F,0x2C6BB7D9}, {0x4C351A83,0xFCCDB18F}, {0xC3160582,0x1F79C012}, +{0x62A74CB7,0xF0ABADAE}, {0x82EF06FC,0xE1A5801C}, {0xF2CB2357,0x67A21845}, {0x5DF04D9D,0x5114665F}, {0x74278658,0xBF40FD2D}, {0xB73183DA,0xA0393D3F}, {0x92E3B017,0x05A409D1}, {0x0B4065F9,0xA9FB28CF}, +{0x42BF3D7C,0x25A9A229}, {0x03463E02,0xDB75E227}, {0x5AB5D06C,0xB326E10C}, {0x95A62DE6,0xE7968E82}, {0x636EAD42,0xB973F3B3}, {0x19C30CE5,0xDF571D38}, {0x29D7CBC5,0xEE549B72}, {0x65E2D146,0x12992AFD}, +{0x56B02864,0xF8EF4E90}, {0x4030E28B,0xB7041E13}, {0xDAD50967,0xC02EDD2A}, {0x8AE95D07,0x932B4AF4}, {0xC6DC4784,0x6FE6FB7B}, {0x55F61666,0x239AACB7}, {0xBDB807D6,0x401A4BED}, {0x89AF6305,0x485EA8D3}, +{0xADB4B13D,0xA41BC220}, {0x9729F211,0x753B32B8}, {0xB3322029,0x997E584B}, {0xCEDA1C7F,0x1D683193}, {0xC99F818E,0xFF5AB6C0}, {0x7F67E3A1,0x16BBD5E2}, {0x25D233CD,0xA59D34EE}, {0x3B54A2D9,0x98F8AE85}, +{0xCB105E79,0x6DF70AFA}, {0xB9BBA425,0x795D2E99}, {0x44334178,0x8E437B67}, {0x886682F0,0x0186F6CE}, {0xBB347BD2,0xEBF092A3}, {0xF18D1D55,0xBCD7FA62}, {0x11C5571E,0xADD9D7D0}, {0xB1BDFFDE,0x0BD3E471}, +{0x8EEAFEF4,0xAA6C2F80}, {0xF6C880A4,0x5EE57D31}, {0xF044FCA0,0xF50FA47F}, {0x51F5B595,0x1ADDC9C3}, {0x3352F922,0xEA76646D}, {0x00000000,0x00000000}, {0xF58EBEA6,0x85909F16}, {0xAAF12CCC,0x46294573}, +{0x39DB7D2E,0x0A5512BF}, {0x31DD26D5,0x78DBD857}, {0x6C2D6B48,0x29CFBE08}, {0x583A0F9B,0x218B5D36}, {0xFACD78AC,0x152CD2AD}, {0xE2C795BC,0x83A39188}, {0x5F7F926A,0xC3B9DA65}, {0x2C1D89C3,0x9ECBA01B}, +{0x9F2FA9EA,0x07B5F850}, {0x26940DCF,0x7EE8D6C9}, {0xAF3B6ECA,0x36B67E1A}, {0x702425AB,0x86079859}, {0xD31AB369,0xFB7849DF}, {0x932A51E2,0x4C7C57CC}, {0x0E8A27FF,0xD96413A6}, {0xC715A671,0x263EA566}, +{0x4376DC89,0x6C71FC34}, {0x84637AF8,0x4A4F5952}, {0x8B20BCF2,0xDAF314E9}, {0x4AB96687,0x572768C1}, {0x682EC8BB,0x1088DB7C}, {0x537A6A62,0x887075F9}, {0xF302C2A2,0x2E7A4658}, {0xE582084D,0x619116DB}, +{0x8326E709,0xA87DDE01}, {0x9C6997E8,0xDCC01A77}, {0xAC7D50C8,0xEDC39C3D}, {0xA078A8C0,0xA60A33A1}, {0x52B38B97,0xC1A82BE4}, {0x134A88E9,0x3F746BEA}, {0xBAFD9A27,0xA228CCBE}, {0x068C7C04,0xABEAD94E}, +{0x78227E50,0xF48952B1}, {0xFB049959,0x5CF48CB0}, {0x6DE48ABD,0x6017E015}, {0xA73D3531,0x4438B4F2}, {0x49FF5885,0x8C528AE6}, {0x4DFCFB76,0xB515EF92}, {0x2E925634,0x0C661C21}, {0xC59A7986,0xB493195C}, +{0x21D1903E,0x9CDA519A}, {0xB5BE5C2D,0x32948105}, {0xD45F2E98,0x194ACE8C}, {0x38129CDB,0x438D4CA2}, {0xBEFE39D4,0x9B6FA9CA}, {0xEF0B8C41,0x81B26009}, {0x91A58E15,0xDED1EBF6}, {0x9EE6481F,0x4E6DA64D}, +{0xCF13FD8A,0x54B06F8E}, {0x01C9E1F5,0x49D85E1D}, {0x1C094EE3,0xAFC82651}, {0x75EE67AD,0xF698A330}, {0xEC4DB243,0x5AC7822E}, {0xC199DA75,0x8DD47C28}, {0xDB1CE892,0x89F68337}, {0x7C21DDA3,0xCDCE37C5}, +{0x503C5460,0x530597DE}, {0x543FF793,0x6A42F2AA}, {0x73621BA9,0x5D727A7E}, {0x07459DF1,0xE2328753}, {0xC2DFE477,0x56A19E0F}, {0xCD9C227D,0xC61DD3B4}, {0x986A341B,0xE5877F03}, {0x15C6F4ED,0x949EB2A4}, +{0x60289340,0x62061194}, {0xE84E11B0,0x6380E75A}, {0xD6D0F16F,0x8BE772B6}, {0xD596CF6D,0x50929091}, {0x3E9EE0DF,0xE86795EC}, {0x2B581432,0x7CF92748}, {0xEEC26DB4,0xC86A3E14}, {0x8DACC0F6,0x7119CDA7}, +{0x100CB6EB,0xE40189CD}, {0x028FDFF7,0x92ADBC3A}, {0xD2D3529C,0xB2A017C2}, {0xD05C8D6B,0x200DABF8}, {0xA2F77737,0x34A78F9B}, {0x8F231F01,0xE3B4719D}, {0x2F5BB7C1,0x45BE423C}, {0xFD88E55D,0xF71E55FE}, +{0x59F3EE6E,0x6853032B}, {0xFF073AAA,0x65B3E9C4}, {0x9AE5EBEC,0x772AC339}, {0xF842A75B,0x87816E97}, {0xE0484A4B,0x110E2DB2}, {0x3DD8DEDD,0x331277CB}, {0x79EB9FA5,0xBD510CAC}, {0x2A91F5C7,0x35217955}, +}; + +__device__ uint2 T52[256] = { +{0x46E06A6D,0x8AB0A968}, {0x4BF0B33A,0x43C7E80B}, {0x6B161EE5,0x08C9B354}, {0xEBA990BE,0x39F1C235}, {0x6606C7B2,0xC1BEF237}, {0x614569AA,0x2C209233}, {0x6FC3289A,0xEB01523B}, {0x935ACEDD,0x946953AB}, +{0x3E13340E,0x272838F6}, {0xA12BA052,0x8B0455EC}, {0x978FF8A2,0x77A1B2C4}, {0x13E54086,0xA55122CA}, {0x62D3F1CD,0x22761358}, {0x08B76CFE,0xDB8DDFDE}, {0x9E4A178A,0x5D1E12C8}, {0x03969867,0x0E56816B}, +{0x3303ED59,0xEE5F7995}, {0xAB78D71D,0xAFED748B}, {0xF93E53EE,0x6D929F2D}, {0xBA798C2A,0xF5D8A8F8}, {0x8E39CF6B,0xF619B169}, {0x749104E2,0x95DDAF2F}, {0xE0886427,0xEC2A9C80}, {0x825B95EA,0xCE5C8FD8}, +{0x3AC60271,0xC4E0D999}, {0x173076F9,0x4699C3A5}, {0x50A29F42,0x3D1B151F}, {0x2BC75946,0x9ED505EA}, {0xDC7F4B98,0x34665ACF}, {0x292342F7,0x61B1FB53}, {0x0E864130,0xC721C008}, {0x96FD7B74,0x8693CD16}, +{0x7136B14B,0x87273192}, {0x63A1721B,0xD3446C8A}, {0xA6680E4A,0x669A35E8}, {0x39509A16,0xCAB658F2}, {0xF42E8AB9,0xA4E5DE4E}, {0xE83F08D9,0x37A7435E}, {0xE26C7F96,0x134E6239}, {0x2DF67488,0x82791A3C}, +{0x8329163C,0x3F6EF00A}, {0xFDEB6591,0x8E5A7E42}, {0x7981DDB5,0x5CAAEE4C}, {0x5AF1E80D,0x19F23478}, {0xED98BD70,0x255DDDE3}, {0xA99CCCAC,0x50898A32}, {0xDA4E6656,0x28CA4519}, {0x4CB31D22,0xAE59880F}, +{0x37D6DB26,0x0D9798FA}, {0xB4FFCD1A,0x32F968F0}, {0x4F258545,0xA00F0964}, {0x5E24DE72,0xFA3AD517}, {0x5DB24615,0xF46C547C}, {0xFF0F7E20,0x713E80FB}, {0x73D2AAFA,0x7843CF2B}, {0xAEDF62B4,0xBD17EA36}, +{0xD16F92CF,0xFD111BAC}, {0xC72D67E0,0x4ABAA7DB}, {0xAD49FAD3,0xB3416B5D}, {0x4914A88B,0xBCA316B2}, {0x8AECF914,0x15D15006}, {0xE31EFC40,0xE27C1DEB}, {0x9BEDA223,0x4FE48C75}, {0x1B522C78,0x7EDCFD14}, +{0x7C26681C,0x4E5070F1}, {0x5815F3BC,0xE696CAC1}, {0x3BB481A7,0x35D2A64B}, {0xFE7DFDF6,0x800CFF29}, {0xD5BAA4B0,0x1ED9FAC3}, {0x1EF599D1,0x6C2663A9}, {0x34404341,0x03C11991}, {0x69F20554,0xF7AD4DED}, +{0xB61BD6AB,0xCD9D9649}, {0xEADB1368,0xC8C3BDE7}, {0xB02AFB65,0xD131899F}, {0xE1FAE7F1,0x1D18E352}, {0xEF7CA6C1,0xDA39235A}, {0xA8EE4F7A,0xA1BBF5E0}, {0xCF9A0B1E,0x91377805}, {0x80BF8E5B,0x31387161}, +{0xDB3CE580,0xD9F83ACB}, {0xD38B897E,0x0275E515}, {0xF0FBBCC6,0x472D3F21}, {0x868EA395,0x2D946EB7}, {0x21942E09,0xBA3C248D}, {0xBFDE3983,0xE7223645}, {0x02E41BB1,0xFF64FEB9}, {0x0D10D957,0xC9774163}, +{0xB58D4ECC,0xC3CB1722}, {0x9CAE0C3B,0xA27AEC71}, {0xA48C15FB,0x99FECB51}, {0x6D27332B,0x1465AC82}, {0xD75EBF01,0xE1BD047A}, {0x941960C5,0x79F733AF}, {0x41A3C475,0x672EC96C}, {0x524684F3,0xC27FEBA6}, +{0x75E38734,0x64EFD0FD}, {0x0743AE18,0xED9E6004}, {0xB9EF144D,0xFB8E2993}, {0x0C625A81,0x38453EB1}, {0x42355C12,0x69784807}, {0x14A6EE9E,0x48CF42CE}, {0x06312DCE,0x1CAC1FD6}, {0x4792E9BB,0x7B82D6BA}, +{0x1F871A07,0x9D141C7B}, {0xC11C4A2E,0x5616B80D}, {0xF21FA777,0xB849C198}, {0xC8D9A506,0x7CA91801}, {0x7EC273AD,0xB1348E48}, {0x987B3A44,0x41B20D1E}, {0xA3CFBBE3,0x7460AB55}, {0x4576F20A,0x84E62803}, +{0x897A6173,0x1B87D16D}, {0xE45D5258,0x0FE27DEF}, {0xCA3DBEB7,0x83CDE6B8}, {0xD01D1119,0x0C23647E}, {0xA0592384,0x7A362A3E}, {0xF1893F10,0xB61F40F3}, {0x440471DC,0x75D457D1}, {0x237035B8,0x4558DA34}, +{0x87FC2043,0xDCA61165}, {0xC9AB26D0,0x8D9B67D3}, {0xEE0E2517,0x2B0B5C88}, {0x2AB5DA90,0x6FE77A38}, {0xD9D8FE31,0x269CC472}, {0xFAA8CB89,0x63C41E46}, {0x1642F52F,0xB7ABBC77}, {0x2F126F39,0x7D1DE485}, +{0x24339BA0,0xA8C6BA30}, {0xCEE888C8,0x600507D7}, {0x1A20AFAE,0x8FEE82C6}, {0x26D78011,0x57A24489}, {0x36A458F0,0xFCA5E728}, {0x8F4B4CBD,0x072BCEBB}, {0xF36D24A1,0x497BBE4A}, {0xB769557D,0x3CAFE99B}, +{0x05A7B5A9,0x12FA9EBD}, {0x5B836BDB,0xE8C04BAA}, {0xAC3B7905,0x4273148F}, {0x2851C121,0x90838481}, {0x6C55B0FD,0xE557D350}, {0xCB4F3D61,0x72FF996A}, {0x64E2DC03,0x3EDA0C8E}, {0xE6B949E9,0xF0868356}, +{0xBB0B0FFC,0x04EAD72A}, {0x5967706A,0x17A4B513}, {0x04D5367F,0xE3C8E16F}, {0x8DAF570C,0xF84F3002}, {0xBD3A2232,0x1846C8FC}, {0xF6CA9108,0x5B8120F7}, {0xECEA3EA6,0xD46FA231}, {0x53340725,0x334D9474}, +{0xC28AD249,0x58403966}, {0x9A9F21F5,0xBED6F3A7}, {0xA5FE962D,0x68CCB483}, {0x57E1315A,0xD085751B}, {0xE52FD18E,0xFED0023D}, {0x20E6ADDF,0x4B0E5B5F}, {0x6EB1AB4C,0x1A332DE9}, {0x7B65C604,0xA3CE10F5}, +{0xD62C3CD7,0x108F7BA8}, {0x1073D8E1,0xAB07A3A1}, {0x91BED56C,0x6B0DAD12}, {0x3532C097,0xF2F36643}, {0xB2CEE0D4,0x2E557726}, {0x00000000,0x00000000}, {0xDE9B5029,0xCB02A476}, {0x8B9E7AC2,0xE4E32FD4}, +{0x2C84F75E,0x734B65EE}, {0xCD7E10AF,0x6E5386BC}, {0xE7CBCA3F,0x01B4FC84}, {0x65905FD5,0xCFE8735C}, {0x0FF4C2E6,0x3613BFDA}, {0x31E7F6E8,0x113B872C}, {0x55052AEB,0x2FE18BA2}, {0xBC48A1E4,0xE974B72E}, +{0xB89D979B,0x0ABC5641}, {0x2202B66E,0xB46AA5E6}, {0xC4BBFF87,0x44EC26B0}, {0x27A503C7,0xA6903B5B}, {0xFC99E647,0x7F680190}, {0xA71A8D9C,0x97A84A3A}, {0x6037EA7C,0xDD12EDE1}, {0xDD0DC84E,0xC554251D}, +{0x956BE313,0x88C54C7D}, {0x48662B5D,0x4D916960}, {0x9909B992,0xB08072CC}, {0xC5C97C51,0xB5DE5962}, {0x19B637C9,0x81B803AD}, {0x4A8230EC,0xB2F597D9}, {0x5F565DA4,0x0B08AAC5}, {0x017283D6,0xF1327FD2}, +{0x78F35E63,0xAD98919E}, {0x76751F53,0x6AB95196}, {0x0A53774F,0x24E92167}, {0x15D46D48,0xB9FD3D1C}, {0xFBDA485F,0x92F66194}, {0x11015B37,0x5A35DC73}, {0x5477A93D,0xDED3F470}, {0x81CD0D8D,0xC00A0EB3}, +{0xC65FE436,0xBB88D809}, {0xBEACBA55,0x16104997}, {0x5693B28C,0x21B70AC9}, {0x25411876,0x59F4C5E2}, {0x0B21F499,0xD5DB5EB5}, {0xF55C096F,0x55D7A19C}, {0xC3F8519F,0xA97246B4}, {0xA2BD3835,0x8552D487}, +{0x1297C350,0x54635D18}, {0x85183BF2,0x23C2EFDC}, {0xCC0C9379,0x9F61F96E}, {0x9DDC8FED,0x534893A3}, {0xAA0A54CB,0x5EDF0B59}, {0x9F38945C,0xAC2C6D1A}, {0xD8AA7DE7,0xD7AEBBA0}, {0x09C5EF28,0x2ABFA00C}, +{0x3CF72FBF,0xD84CC64F}, {0xB15878B3,0x2003F64D}, {0xC06EC9F8,0xA724C7DF}, {0x68808682,0x069F323F}, {0x51D01C94,0xCC296ACD}, {0x5CC0C5C3,0x055E2BAE}, {0x1D6301B6,0x6270E2C2}, {0x382219C0,0x3B842720}, +{0x846AB824,0xD2F0900E}, {0x7A1745D2,0x52FC6F27}, {0xE94D8B0F,0xC6953C8C}, {0x3095753E,0xE009F8FE}, {0x92284D0B,0x655B2C79}, {0x4347DFC4,0x984A37D5}, {0x8808E2A5,0xEAB5AEBF}, {0x90CC56BA,0x9A3FD2C0}, +{0xF84CD038,0x9CA0E0FF}, {0xAFADE162,0x4C2595E4}, {0xB3BC6302,0xDF6708F4}, {0x7D54EBCA,0xBF620F23}, {0x1C118260,0x93429D10}, {0x8CDDD4DA,0x097D4FD0}, {0x2E60ECEF,0x8C2F9B57}, {0x18C4B41F,0x708A7C7F}, +{0xDFE9D3FF,0x3A30DBA4}, {0x7FB0F07B,0x4006F19A}, {0x4DC19EF4,0x5F6BF7DD}, {0x32716E8F,0x1F6D0647}, {0x6A649D33,0xF9FBCC86}, {0x67744464,0x308C8DE5}, {0x72A0292C,0x8971B0F9}, {0x3F61B7D8,0xD61A4724}, +{0xD4C82766,0xEFEB8511}, {0x40D147A3,0x961CB6BE}, {0xF7B812DE,0xAAB35F25}, {0x7044329D,0x76154E40}, {0x4E570693,0x513D76B6}, {0xD2F90AA8,0xF3479AC7}, {0x77079C85,0x9B8B2E44}, {0x3D85AC69,0x297EB99D}, +}; + +__device__ uint2 T62[256] = { +{0xFC7D40C3,0x7E37E62D}, {0xEE939E5B,0x776F25A4}, {0xDD8FB5AD,0xE045C850}, {0x11FF1952,0x86ED5BA7}, {0xCF616B35,0xE91D0BD9}, {0x6E408FFB,0x37E0AB25}, {0x31025A7A,0x9607F6C0}, {0x16D23C9D,0x0B02F5E1}, +{0xFB50650C,0xF3D8486B}, {0xC40875F5,0x621CFF27}, {0xFA5FD34A,0x7D40CB71}, {0xDAA29062,0x6DAA6616}, {0x23EC84E2,0x9F5F3549}, {0xC507C3B3,0xEC847C3D}, {0x043CE205,0x025A3668}, {0x4DAC0B19,0xA8BF9E6C}, +{0xE9BEBB94,0xFA808BE2}, {0x77C74FA3,0xB5B99C52}, {0xF0397BCC,0x78D9BC95}, {0xDBAD2624,0xE332E50C}, {0x9332797E,0xC74FCE12}, {0x2EA709AB,0x1729ECEB}, {0x9954D1F8,0xC2D6B9F6}, {0xBAB8551A,0x5D898CBF}, +{0x17DD8ADB,0x859A76FB}, {0x362F7FB5,0x1BE85886}, {0xF136CD8A,0xF6413F8F}, {0xBBB7E35C,0xD3110FA5}, {0x14CC4D11,0x0A2FEED5}, {0xCD7F1AB9,0xE83010ED}, {0x5F42D581,0xA1E75DE5}, {0xC13B21B6,0xEEDE4A55}, +{0xF94E1480,0xF2F5535F}, {0x1888761E,0x0CC1B46D}, {0x6529913B,0xBCE15FDB}, {0x5A7181C2,0x2D25E897}, {0xE2D7A554,0x71817F1C}, {0x5C53124B,0x2E52C5CB}, {0xEF9C281D,0xF9F7A6BE}, {0x21F2F56E,0x9E722E7D}, +{0x81DCA7E6,0xCE170D9B}, {0x1CB4941B,0x0E9B8205}, {0x3C49D733,0x1E712F62}, {0x42F9F7DC,0x21E45CFA}, {0x8BBA0F60,0xCB8E7A7F}, {0x010FB646,0x8E98831A}, {0x8E895B23,0x474CCF0D}, {0x4FB27A95,0xA9928558}, +{0x05335443,0x8CC2B572}, {0x84EFF3A5,0x42D5B8E9}, {0x021E718C,0x012D1B34}, {0xAE74180B,0x57A6626A}, {0xE3D81312,0xFF19FC06}, {0x6A7C6DFE,0x35BA9D4D}, {0x8F86ED65,0xC9D44C17}, {0xA02E5288,0x506523E6}, +{0x06229389,0x03772D5C}, {0x0B691EC0,0x8B01F4FE}, {0xED825991,0xF8DABD8A}, {0x985B67BE,0x4C4E3AEC}, {0x7FBF96A9,0xB10DF082}, {0xD4F8DAE1,0x6A69279A}, {0xD3D5FF2E,0xE78689DC}, {0x1FA553D1,0x812E1A2B}, +{0xEBA0CA18,0xFBAD90D6}, {0x34310E39,0x1AC543B2}, {0x2CB97827,0x1604F7DF}, {0x51189F02,0xA6241C69}, {0xEAAF7C5E,0x753513CC}, {0xC84C4EFA,0x64F2A59F}, {0x489F5F5A,0x247D2B1E}, {0xAB474C48,0xDB64D718}, +{0xF2270A40,0x79F4A7A1}, {0x2A9BEBAE,0x1573DA83}, {0x68621C72,0x34978679}, {0xA2302304,0x514838D2}, {0xFD72F685,0xF0AF6537}, {0x3A6B44BA,0x1D06023E}, {0xCE6EDD73,0x678588C3}, {0xCC70ACFF,0x66A893F7}, +{0xB5EDA9DF,0xD4D24E29}, {0x70EA6A6C,0x38563214}, {0x0E5A4A83,0x07C3418C}, {0x5635BACD,0x2BCBB22F}, {0x0878D90A,0x04B46CD0}, {0x0C443B0F,0x06EE5AB8}, {0x76C8F9E5,0x3B211F48}, {0x12EEDE98,0x0958C389}, +{0xBF8B0159,0xD14B39CD}, {0x72F41BE0,0x397B2920}, {0x13E168DE,0x87C04093}, {0x47CAA39F,0xAD26E988}, {0x9C6785BB,0x4E140C84}, {0xB7F3D853,0xD5FF551D}, {0x5D5CA40D,0xA0CA46D1}, {0x87FE346F,0xCD6020C7}, +{0x15C3FB57,0x84B76DCF}, {0xA121E4CE,0xDEFDA0FC}, {0x96012D3D,0x4B8D7B60}, {0x298A2C64,0x9AC642AD}, {0x10F0AF14,0x0875D8BD}, {0x7B8374AC,0xB357C6EA}, {0x9A451632,0x4D6321D8}, {0xC719B23F,0xEDA96709}, +{0xF328BC06,0xF76C24BB}, {0x912C08F2,0xC662D526}, {0x7892B366,0x3CE25EC4}, {0x6F4F39BD,0xB978283F}, {0x9D6833FD,0xC08C8F9E}, {0x9E79F437,0x4F3917B0}, {0xB2C08C10,0x593DE06F}, {0xB1D14BDA,0xD6887841}, +{0x32139DB0,0x19B26EEE}, {0x75D93E2F,0xB4948766}, {0x1987C058,0x82593777}, {0x3D466175,0x90E9AC78}, {0xFF6C8709,0xF1827E03}, {0x353EB87F,0x945DC0A8}, {0x8AB5B926,0x4516F965}, {0x7EB020EF,0x3F957398}, +{0x6D514831,0xB855330B}, {0x542BCB41,0x2AE6A91B}, {0xC6160479,0x6331E413}, {0x80D311A0,0x408F8E81}, {0xC325503A,0xEFF35161}, {0xBD9570D5,0xD06622F9}, {0x0D4B8D49,0x8876D9A2}, {0x573A0C8B,0xA5533135}, +{0xDF91C421,0xE168D364}, {0xF50A2F8F,0xF41B09E7}, {0x24C1A12D,0x12B09B0F}, {0xA9593DC4,0xDA49CC2C}, {0x3E57A6BF,0x1F5C3456}, {0xA8568B82,0x54D14F36}, {0x43F6419A,0xAF7CDFE0}, {0xC943F8BC,0xEA6A2685}, +{0xD7E91D2B,0xE5DCBFB4}, {0x799D0520,0xB27ADDDE}, {0xD6E6AB6D,0x6B443CAE}, {0xF61BE845,0x7BAE91C9}, {0x7CAE5163,0x3EB868AC}, {0x22E332A4,0x11C7B653}, {0xB9A992D0,0xD23C1491}, {0x0311C7CA,0x8FB5982E}, +{0xE0C9D4D8,0x70AC6428}, {0x0F55FCC5,0x895BC296}, {0xEC8DEFD7,0x76423E90}, {0xDE9E7267,0x6FF0507E}, {0x7A8CC2EA,0x3DCF45F0}, {0x941F5CB1,0x4AA06054}, {0xB0DEFD9C,0x5810FB5B}, {0xBC9AC693,0x5EFEA1E3}, +{0xDC8003EB,0x6EDD4B4A}, {0xE8B10DD2,0x741808F8}, {0x28859A22,0x145EC1B7}, {0x50172944,0x28BC9F73}, {0x4EBDCCD3,0x270A0642}, {0x331C2BF6,0x972AEDF4}, {0x0A66A886,0x059977E4}, {0x4A812ED6,0x2550302A}, +{0xA7037747,0xDD8A8DA0}, {0x970E9B7B,0xC515F87A}, {0x601AC578,0x3023EAA9}, {0x73FBADA6,0xB7E3AA3A}, {0x1EAAE597,0x0FB69931}, {0x00000000,0x00000000}, {0x6204B4F4,0x310EF19D}, {0x44DB6455,0x229371A6}, +{0x1A960792,0x0DECAF59}, {0xB8A62496,0x5CA4978B}, {0x38753536,0x1C2B190A}, {0x82CD602C,0x41A295B5}, {0x6426277D,0x3279DCC1}, {0x9F764271,0xC1A194AA}, {0x26DFD0A1,0x139D803B}, {0x41E83016,0xAE51C4D4}, +{0xAD65DFC1,0xD813FA44}, {0x45D4D213,0xAC0BF2BC}, {0x46C515D9,0x23BE6A92}, {0x923DCF38,0x49D74D08}, {0x27D066E7,0x9D050321}, {0x5E4D63C7,0x2F7FDEFF}, {0x55247D07,0xA47E2A01}, {0x2FA8BFED,0x99B16FF1}, +{0x8C972AAF,0x4661D439}, {0xA33F9542,0xDFD0BBC8}, {0xA51D06CB,0xDCA79694}, {0x7DA1E725,0xB020EBB6}, {0x696DAA34,0xBA0F0563}, {0xD5F76CA7,0xE4F1A480}, {0x9510EAF7,0xC438E34E}, {0x3B64F2FC,0x939E8124}, +{0x072D25CF,0x8DEFAE46}, {0x586FF04E,0x2C08F3A3}, {0xB3CF3A56,0xD7A56375}, {0x40E78650,0x20C947CE}, {0x86F18229,0x43F8A3DD}, {0xAC6A6987,0x568B795E}, {0x1DBB225D,0x8003011F}, {0xF7145E03,0xF53612D3}, +{0x300DEC3C,0x189F75DA}, {0x3720C9F3,0x9570DB9C}, {0x6B73DBB8,0xBB221E57}, {0xE4F536DD,0x72F65240}, {0x88ABC8AA,0x443BE251}, {0xD9B357A8,0xE21FFE38}, {0xE7E4F117,0xFD43CA6E}, {0x89A47EEC,0xCAA3614B}, +{0xE1C6629E,0xFE34E732}, {0x1B99B1D4,0x83742C43}, {0x83C2D66A,0xCF3A16AF}, {0x4990E91C,0xAAE5A804}, {0x4CA3BD5F,0x26271D76}, {0x3F5810F9,0x91C4B74C}, {0xF841A2C6,0x7C6DD045}, {0xFE63314F,0x7F1AFD19}, +{0x8D989CE9,0xC8F95723}, {0x5306EE8E,0xA709075D}, {0xAA48FA0E,0x55FC5402}, {0x9023BEB4,0x48FA563C}, {0xCA523F76,0x65DFBEAB}, {0xD8BCE1EE,0x6C877D22}, {0x85E045E3,0xCC4D3BF3}, {0x6115733E,0xBEBB69B3}, +{0x20FD4328,0x10EAAD67}, {0x71E5DC2A,0xB6CEB10E}, {0x6737E0B7,0xBDCC44EF}, {0xA412B08D,0x523F158E}, {0x2DB6CE61,0x989C74C5}, {0x2B945DE8,0x9BEB5999}, {0x09776F4C,0x8A2CEFCA}, {0x5B7E3784,0xA3BD6B8D}, +{0xCB5D8930,0xEB473DB1}, {0x9B4AA074,0xC3FBA2C2}, {0x25CE176B,0x9C281815}, {0xD0C438E4,0x683311F2}, {0xBE84B71F,0x5FD3BAD7}, {0xE5FA809B,0xFC6ED15A}, {0x6C5EFE77,0x36CDB011}, {0x520958C8,0x29918447}, +{0x59604608,0xA29070B9}, {0xA60CC101,0x53120EBA}, {0x74D68869,0x3A0C047C}, {0xD2DA4968,0x691E0AC6}, {0xE6EB4751,0x73DB4974}, {0xF40599C9,0x7A838AFD}, {0xB4E21F99,0x5A4ACD33}, {0xC03497F0,0x6046C94F}, +{0xD1CB8EA2,0xE6AB92E8}, {0x663856F1,0x3354C7F5}, {0xAF7BAE4D,0xD93EE170}, {0xC22AE67C,0x616BD27B}, {0x397A8370,0x92B39A10}, {0x4B8E9890,0xABC8B330}, {0x630B02B2,0xBF967287}, {0xB6FC6E15,0x5B67D607}, +}; + +__device__ uint2 T72[256] = { +{0xCE553FE6,0xD031C397}, {0xB006B525,0x16BA5B01}, {0x296E70C8,0xA89BADE6}, {0x77D3435B,0x6A1F525D}, {0x573DFA0B,0x6E103570}, {0x17FC95AB,0x660EFB2A}, {0x97634BF6,0x76327A9E}, {0x62458BF5,0x4BAD9D64}, +{0xDBC3F748,0xF1830CAE}, {0x669131FF,0xC5C8F542}, {0xDC48B0CB,0x95044A1C}, {0x3CF8B866,0x892962DF}, {0xE930C135,0xB0B9E208}, {0x611A767C,0xA14FB3F0}, {0x1C160136,0x8D2605F2}, {0xFECC549E,0xD6B71922}, +{0xA5907D8B,0x37089438}, {0x5803D49C,0x0B5DA38E}, {0xEA6F3CBC,0x5A5BCC9C}, {0x3B73FFE5,0xEDAE246D}, {0xDE22EDCE,0xD2B87E0F}, {0xCA8185EC,0x5E54ABB1}, {0xE80561B9,0x1DE7F88F}, {0x0135A08C,0xAD5E1A87}, +{0x65CECC76,0x2F2ADBD6}, {0x82F58358,0x5780B5A7}, {0xEDE47B3F,0x3EDC8A2E}, {0x06BEE70F,0xC9D95C35}, {0x6C4E05EE,0x83BE111D}, {0x59367410,0xA603B909}, {0x809FDE5D,0x103C81B4}, {0x7D0C774A,0x2C69B602}, +{0xD5C87953,0x399080D7}, {0x487406B4,0x09D41E16}, {0x26505E5F,0xCDD63B18}, {0x9B0298E8,0xF99DC2F4}, {0x943CB67F,0x9CD0540A}, {0x891F17C5,0xBCA84B7F}, {0xB78DF2A6,0x723D1DB3}, {0xE73B4F2E,0x78AA6E71}, +{0xA071670D,0x1433E699}, {0x54620782,0x84F21BE4}, {0xB4D20F2F,0x98DF3327}, {0xD3769E5C,0xF049DCE2}, {0x9656EB7A,0xDB6C6019}, {0x078B4783,0x648746B2}, {0x8DCBADCF,0x32CD2359}, {0xF0C7DA85,0x1EA4955B}, +{0x1B9D46B5,0xE9A14340}, {0xBBEC21B8,0xFD92A5D9}, {0x0E0B8E1B,0xC8138C79}, {0x6D7BA562,0x2EE00B9A}, {0x93B7F1FC,0xF85712B8}, {0x0BEA949D,0xEB28FED8}, {0x8A40EA4C,0x564A65EB}, {0x474A2823,0x6C9988E8}, +{0x121D8F2D,0x4535898B}, {0x31ACCBF4,0xABD8C032}, {0xB9867CBD,0xBA2E91CA}, {0xEF8E263A,0x7960BE3D}, {0x602FD6F0,0x0C11A977}, {0x16C93527,0xCB50E1AD}, {0x035FFD89,0xEAE22E94}, {0x5DE2CE1A,0x2866D12F}, +{0xAB9BF390,0xFF1B1841}, {0x8CFE0D43,0x9F9339DE}, {0xC48A0BF7,0x964727C8}, {0xAAAE531C,0x524502C6}, {0xAC10B413,0x9B9C5EF3}, {0x42AB32A5,0x4FA2FA49}, {0xE551122B,0x3F165A62}, {0x76E6E3D7,0xC74148DA}, +{0xE464B2A7,0x924840E5}, {0xD69784DA,0xD372AE43}, {0x05E11A86,0x233B72A1}, {0x4941A638,0xA48A0491}, {0xC9DE7865,0xB4B68525}, {0xA6CF8002,0xDDEABAAC}, {0x50B6BD88,0x0A9773C2}, {0x5EBD3393,0xC284FFBB}, +{0x2C8F6A4E,0x8BA0DF47}, {0x4D951C32,0x2AEF6CB7}, {0x2A318D41,0x42798372}, {0xBF389BB2,0x73F7CDFF}, {0x382C026C,0x074C0AF9}, {0x243A035A,0x8A6A0F0B}, {0x5F88931F,0x6FDAE53C}, {0x7E538AC3,0xC68B9896}, +{0x1AA8E639,0x44FF59C7}, {0x439E9229,0xE2FCE0CE}, {0x79D8CD40,0xA20CDE24}, {0xC8EBD8E9,0x19E89FA2}, {0xF398270C,0xF446BBCF}, {0x2284E455,0x43B3533E}, {0x8E945046,0xD82F0DCD}, {0xB26CE820,0x51066F12}, +{0x6BC5426D,0xE73957AF}, {0x40C16FA0,0x081ECE5A}, {0xC5BFAB7B,0x3B193D4F}, {0xDF174D42,0x7FE66488}, {0x705804D8,0x0E9814EF}, {0x7C39D7C6,0x8137AC85}, {0xE185A821,0xB1733244}, {0x6F11F867,0x695C3F89}, +{0xE3EFF524,0xF6CF0657}, {0xD02963D5,0x1AABF276}, {0x75B91E5E,0x2DA3664E}, {0x1077D228,0x0289BD98}, {0xF413608F,0x90C1FD7D}, {0xFD93A917,0x3C5537B6}, {0x3919A2E0,0xAA12107E}, {0x30996B78,0x0686DAB5}, +{0x9EE3826E,0xDAA6B055}, {0x56085A87,0xC34E2FF7}, {0x4FFF4137,0x6D5358A4}, {0xB35948AC,0xFC587595}, {0xC7D5F67E,0x7CA5095C}, {0x8B754AC0,0xFB147F6C}, {0x91DDACF9,0xBFEB26AB}, {0x67A49173,0x6896EFC5}, +{0x1E7C5C33,0xCA9A31E1}, {0xB13315A9,0xBBE44186}, {0x689ABFE4,0x0DDB793B}, {0xA7FA208E,0x70B4A02B}, {0x7307F951,0xE47A3A7B}, {0x14A36822,0x8CECD5BE}, {0x23B144D9,0xEEED49B9}, {0xB8B3DC31,0x17708B4D}, +{0x2765FED3,0x6088219F}, {0xF1F27A09,0xB3FA8FDC}, {0xFCA6099B,0x910B2D31}, {0x78ED6DCC,0x0F52C4A3}, {0xBAD98134,0x50CCBF5E}, {0x7F662A4F,0x6BD58211}, {0xD4FDD9DF,0x94CE9A50}, {0x45207526,0x2B25BCFB}, +{0x1F49FCBF,0x67C42B66}, {0x723259DD,0x492420FC}, {0x18C2BB3C,0x03436DD4}, {0xF872B391,0x1F6E4517}, {0x69AF1F68,0xA08563BC}, {0xEEBB86B6,0xD43EA4BA}, {0x08B56914,0x01CAD04C}, {0x0980C998,0xAC94CACB}, +{0x9A373864,0x54C3D873}, {0x2DBACAC2,0x26FEC5C0}, {0xBE0D3B3E,0xDEA9D778}, {0x20EEB950,0x040F672D}, {0x7BB29045,0xE5B0EA37}, {0xCBB42560,0xF30AB136}, {0x37122CFB,0x62019C07}, {0x13282FA1,0xE86B930C}, +{0x2EE5374B,0xCC1CEB54}, {0xA21B3A08,0x538FD28A}, {0xD89C0AC1,0x1B61223A}, {0xAD25149F,0x36C24474}, {0xF74C9D06,0x7A23D3E9}, {0x9968C5ED,0xBE21F6E7}, {0x36278C77,0xCF5F8680}, {0xEB5A9C30,0xF705D61B}, +{0x52DCE08D,0x4D2B47D1}, {0xC234ECF8,0x5F9E7BFD}, {0x3DCD18EA,0x24777858}, {0x4415D5AA,0x867BA67C}, {0x5A698999,0x4CE1979D}, {0x00000000,0x00000000}, {0x33C696F1,0xEC64F421}, {0xC16B1171,0xB57C5569}, +{0x467F88AF,0xC1C7926F}, {0x0F3E2E97,0x654D96FE}, {0xA8C40E19,0x15F936D5}, {0xA9F1AE95,0xB8A72C52}, {0x21DB19DC,0xA9517DAA}, {0xFA18EE94,0x58D27104}, {0xF2AD8780,0x5918A148}, {0xDAF657C4,0x5CDD1629}, +{0x64FB6CFA,0x8274C151}, {0xC6E056F2,0xD1FB13DB}, {0xCF609F6A,0x7D6FD910}, {0xD9A9AA4D,0xB63F38BD}, {0xF526C003,0x3D9FE7FA}, {0x871499DE,0x74BBC706}, {0xB6B8522A,0xDF630734}, {0xCD0AC26F,0x3AD3ED03}, +{0x83C023D4,0xFADEAF20}, {0x4ECAE1BB,0xC00D4223}, {0x5CD76E96,0x8538CBA8}, {0x6E2458EB,0xC402250E}, {0x026A5D05,0x47BC3413}, {0x114272A4,0xAFD7A71F}, {0xCC3F62E3,0x978DF784}, {0xA144C781,0xB96DFC1E}, +{0x1596C8AE,0x21B2CF39}, {0x950916F3,0x318E4E8D}, {0x3E92E563,0xCE9556CC}, {0xDD7D1047,0x385A509B}, {0xB5E7AFA3,0x358129A0}, {0x63702B79,0xE6F387E3}, {0x53E94001,0xE0755D56}, {0xFFF9F412,0x7BE903A5}, +{0x90E80C75,0x12B53C2C}, {0x857EC4DB,0x3307F315}, {0x0C61D31E,0x8FAFB86A}, {0x86213952,0xD9E5DD81}, {0x9FD622E2,0x77F8AAD2}, {0x357871FE,0x25BDA814}, {0x8FA1F0CA,0x7571174A}, {0x985D6561,0x137FEC60}, +{0x9DBC7FE7,0x30449EC1}, {0x41F4CF2C,0xA540D4DD}, {0xAE7AE916,0xDC206AE0}, {0xE2DA55A8,0x5B911CD0}, {0xF947131D,0xB2305F90}, {0xBD52C6B7,0x344BF9EC}, {0xD2433ED0,0x5D17C665}, {0xC05EB1FD,0x18224FEE}, +{0x844B6457,0x9E59E992}, {0xA4A5DD07,0x9A568EBF}, {0x716DA454,0xA3C60E68}, {0xD7A22456,0x7E2CB4C4}, {0x4CA0BCBE,0x87B17630}, {0x32F3367D,0x413AEEA6}, {0xBC67663B,0x9915E36B}, {0x3A465F69,0x40F03EEA}, +{0xE0B008AD,0x1C2D28C3}, {0x4A1E5BB1,0x4E682A05}, {0x285BD044,0x05C5B761}, {0x5B5C2915,0xE1BF8D1A}, {0xC3014C74,0xF2C0617A}, {0xD11CC359,0xB7F5E8F1}, {0x3FA745EF,0x63CB4C4B}, {0x9C89DF6B,0x9D1A8446}, +{0x4B2BFB3D,0xE3363082}, {0xE60EEFA2,0xD5F474F6}, {0xFB2D4E18,0xF58C6B83}, {0x0ADF3411,0x4676E45F}, {0x1D23A1BA,0x20781F75}, {0x81AA7ED1,0xBD629B33}, {0x19F71BB0,0xAE1D7753}, {0xA32E9A84,0xFED1C80D}, +{0x92825170,0x5509083F}, {0x5557A70E,0x29AC0163}, {0x51831D04,0xA7C96945}, {0x04D4BA0A,0x8E656826}, {0x882AB749,0x11F651F8}, {0xF6793D8A,0xD77DC96E}, {0x2B042DCD,0xEF2799F5}, {0x7A8730C9,0x48EEF0B0}, +{0x0D547392,0x22F1A2ED}, {0x2FD097C7,0x6142F1D3}, {0x6AF0E2E1,0x4A674D28}, {0x748CBED2,0x80FD7CC9}, {0xAF4F499A,0x717E7067}, {0xECD1DBB3,0x938290A9}, {0x344DD172,0x88E3B293}, {0x250FA3D6,0x2734158C}, +}; +// KeySchedule +__constant__ const uint64_t CC[12][8] = { + {0xe9daca1eda5b08b1, 0x1f7c65c0812fcbeb, 0x16d0452e43766a2f, 0xfcc485758db84e71, 0x0169679291e07c4b, 0x15d360a4082a42a2, 0x234d74cc36747605, 0x0745a6f2596580dd}, + {0x1a2f9da98ab5a36f, 0xd7b5700f469de34f, 0x982b230a72eafef3, 0x3101b5160f5ed561, 0x5899d6126b17b59a, 0xcaa70adbc261b55c, 0x56cdcbd71ba2dd55, 0xb79bb121700479e6}, + {0xc72fce2bacdc74f5, 0x35843d6a28fc390a, 0x8b1f9c525f5ef106, 0x7b7b29b11475eaf2, 0xb19e3590e40fe2d3, 0x09db6260373ac9c1, 0x31db7a8643f4b6c2, 0xb20aba0af5961e99}, + {0xd26615e8b3df1fef, 0xdde4715da0e148f9, 0x7d3c5c337e858e48, 0x3f355e68ad1c729d, 0x75d603ed822cd7a9, 0xbe0352933313b7d8, 0xf137e893a1ea5334, 0x2ed1e384bcbe0c22}, + {0x994747adac6bea4b, 0x6323a96c0c413f9a, 0x4a1086161f1c157f, 0xbdff0f80d7359e35, 0xa3f53a254717cdbf, 0x161a2723b700ffdf, 0xf563eaa97ea2567a, 0x57fe6c7cfd581760}, + {0xd9d33a1daeae4fae, 0xc039307a3bc3a46f, 0x6ca44251f9c4662d, 0xc68ef09ab49a7f18, 0xb4b79a1cb7a6facf, 0xb6c6bec2661ff20a, 0x354f903672c571bf, 0x6e7d64467a4068fa}, + {0xecc5aaee160ec7f4, 0x540924bffe86ac51, 0xc987bfe6c7c69e39, 0xc9937a19333e47d3, 0x372c822dc5ab9209, 0x04054a2883694706, 0xf34a3ca24c451735, 0x93d4143a4d568688}, + {0xa7c9934d425b1f9b, 0x41416e0c02aae703, 0x1ede369c71f8b74e, 0x9ac4db4d3b44b489, 0x90069b92cb2b89f4, 0x2fc4a5d12b8dd169, 0xd9a8515935c2ac36, 0x1ee702bfd40d7fa4}, + {0x9b223116545a8f37, 0xde5f16ecd89a4c94, 0x244289251b3a7d3a, 0x84090de0b755d93c, 0xb1ceb2db0b440a80, 0x549c07a69a8a2b7b, 0x602a1fcb92dc380e, 0xdb5a238351446172}, + {0x526f0580a6debeab, 0xf3f3e4b248e52a38, 0xdb788aff1ce74189, 0x0361331b8ae1ff1f, 0x4b3369af0267e79f, 0xf452763b306c1e7a, 0xc3b63b15d1fa9836, 0xed9c4598fbc7b474}, + {0xfb89c8efd09ecd7b, 0x94fe5a63cdc60230, 0x6107abebbb6bfad8, 0x7966841421800120, 0xcab948eaef711d8a, 0x986e477d1dcdbaef, 0x5dd86fc04a59a2de, 0x1b2df381cda4ca6b}, + {0xba3116f167e78e37, 0x7ab14904b08013d2, 0x771ddfbc323ca4cd, 0x9b9f2130d41220f8, 0x86cc91189def805d, 0x5228e188aaa41de7, 0x991bb2d9d517f4fa, 0x20d71bf14a92bc48} +}; + +__constant__ const uint64_t precomputed_values[12][8] = { + 0x8FD72F640708B0D0, 0x0DE874C7EBC3F213, 0xE92EEF3AD202E9E0, 0xC1E9DA0708013DA7, 0x9727DAB2F014BE88, 0x103051A02BCD6935, 0x33EC7E1DBD28F736, 0x1ECF460CF78AD1F4, + 0x0B2D9F89C775449D, 0x6B6EEFC6DAB7E8B0, 0xF1A0D31667F6EC44, 0x2A71132D5E108166, 0x0E9357C2EC87931A, 0xC99F5C1B4A01612D, 0x7E60B16E637D4EE2, 0xA9FCB827F9BA6D81, + 0x231FECA5AB3D285C, 0x70C6E1483C838C3B, 0x9C21C3C40CE4E2DA, 0x2FA796BD5688E573, 0x04C0E3FF55809FDF, 0x5FF978BFB8E3CDC8, 0xC54A19D6A3D07033, 0x0FCA83FDDE872478, + 0xBDF9312726339F10, 0x51A5BA1793BC9C56, 0xC4428DA14F96D2D4, 0xEC925222374EAB1F, 0x79477893747DD92F, 0xC495E19A46886304, 0x9C23F893BA7CFA36, 0x0C47268881FC5FEB, + 0xCF117966029B2CB3, 0x07179ABE77088A8F, 0x671EF4CC2650E257, 0x7474B8B170DAB5C6, 0x4224FEBECF35113E, 0x993D156C675C5537, 0x2DEE3A5782C39B45, 0xE7C586F2990DD385, + 0x8608FD95B1C1138A, 0x8BB0847D9E9849AC, 0x5E76623F4F0EB0C7, 0x34C2BDBAFC5060CE, 0xE9E814475907826C, 0x22C9ED94D6AAC7C9, 0xE6B75E28171EB0D6, 0xF1329E5534E60215, + 0x86BB4814B1C3CE52, 0xE8F226C9FBDDD017, 0xCEDED67991CB3087, 0x76C33E32FDBFACA5, 0xDBB13BE1A9F7474C, 0x3D0273470342C356, 0x8E7246C51CF07F61, 0xAC8C125DDEF8DF71, + 0x6D73E747795B8CF3, 0x4E4AA65EA0072050, 0xA14A1582CB43C2B9, 0x748EF2B7BB63B938, 0x126789534410D7D4, 0xD4D48FF40301D791, 0xC67DFBE315C41FC0, 0x35E7A1A1AF88601C, + 0x9BD33EA0FAB34007, 0xF51B7CDBE3D67D25, 0xD3ABDA0CE4186E6B, 0x8E61DDADCBCE1706, 0x58994565B41BE6A5, 0x7A87ABC1240CD31D, 0xFAFE6C28487968D0, 0x15B368609FF9EEA7, + 0xAE33263CCF115818, 0x93B2DBE9CADFCFC8, 0x0A91952BF91B0147, 0x458E67CA5F1ED73A, 0x94C2E5F288F074E3, 0x377895E85C69E996, 0xF11A4456AAB37B10, 0x163131934816821A, + 0xD07E4A2366BF469D, 0x5EF1A3D220213B6C, 0x3C5BB78971D8ED0F, 0x0DE05E6B9006F2D2, 0xC58CFB00B8EAA1C9, 0xEFCDB54D1F250B76, 0xFD135634FA527042, 0x4CEE791290516407, + 0xD800B9264010790F, 0x974C4823E2B668D7, 0xA605A4B385C5E361, 0x3F6C92DA5A56D8D2, 0x82B9D67C12EF8277, 0x0AB6B4582561BF90, 0x46954FD98FC2CBA3, 0x70BE45CB21B6760D +}; diff --git a/streebog/veltor.cu b/streebog/veltor.cu new file mode 100644 index 0000000..c288b4f --- /dev/null +++ b/streebog/veltor.cu @@ -0,0 +1,170 @@ +extern "C" { +#include "sph/sph_skein.h" +#include "sph/sph_shavite.h" +#include "sph/sph_shabal.h" +#include "sph/sph_streebog.h" +} + +#include "miner.h" +#include "cuda_helper.h" +#include "x11/cuda_x11.h" + +extern void streebog_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash,uint32_t* d_resNonce); +extern void streebog_set_target(const uint32_t* ptarget); +extern void x14_shabal512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void skein512_cpu_setBlock_80(void *pdata); +extern void skein512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_hash); + +#include +#include + +#define NBN 2 +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +// veltorcoin CPU Hash +extern "C" void veltorhash(void *output, const void *input) +{ + unsigned char _ALIGN(128) hash[128] = { 0 }; + + sph_skein512_context ctx_skein; + sph_gost512_context ctx_gost; + sph_shabal512_context ctx_shabal; + sph_shavite512_context ctx_shavite; + + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, input, 80); + sph_skein512_close(&ctx_skein, (void*) hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512 (&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, (void*) hash); + + sph_shabal512_init(&ctx_shabal); + sph_shabal512 (&ctx_shabal, (const void*) hash, 64); + sph_shabal512_close(&ctx_shabal, (void*) hash); + + sph_gost512_init(&ctx_gost); + sph_gost512(&ctx_gost, (const void*) hash, 64); + sph_gost512_close(&ctx_gost, (void*) hash); + + memcpy(output, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_veltor(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + int intensity = (device_sm[device_map[thr_id]] > 500) ? 24 : 22; +// int intensity = is_windows() ? 14 : 16; + if (strstr(device_name[dev_id], "GTX 9")) intensity = 24; + if (strstr(device_name[dev_id], "GTX 10")) intensity = 25; + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); // 19=256*256*8; + //if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ptarget[7] = 0xf; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); +// cudaDeviceSetSharedMemConfig(cudaSharedMemBankSizeEightByte); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + + init[thr_id] = true; + } + + uint32_t endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + skein512_cpu_setBlock_80(endiandata); + + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + streebog_set_target(ptarget); + + do { + skein512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + x11_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x14_shabal512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + streebog_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id], d_resNonce[thr_id]); + + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + veltorhash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], startNounce+h_resNonce[thr_id][1]); + veltorhash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce; + + return 0; +} + +// cleanup +extern "C" void free_veltor(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/sysinfos.cpp b/sysinfos.cpp new file mode 100644 index 0000000..4515830 --- /dev/null +++ b/sysinfos.cpp @@ -0,0 +1,94 @@ +/** + * Unit to read cpu informations + * + * TODO: WMI implementation for windows + * + * tpruvot 2014 + */ + +#include +#include +#include +#include + +#include "miner.h" + +#ifndef WIN32 + +#define HWMON_PATH \ + "/sys/class/hwmon/hwmon1/device/temp1_input" +#define HWMON_ALT \ + "/sys/class/hwmon/hwmon0/temp1_input" + +static double linux_cputemp(int core) +{ + double tc = 0.0; + FILE *fd = fopen(HWMON_PATH, "r"); + uint32_t val = 0; + + if (!fd) + fd = fopen(HWMON_ALT, "r"); + + if (!fd) + return tc; + + if (fscanf(fd, "%d", &val)) + tc = (double)val / 1000.0; + + fclose(fd); + return tc; +} + +#define CPUFREQ_PATH \ + "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq" +static uint32_t linux_cpufreq(int core) +{ + FILE *fd = fopen(CPUFREQ_PATH, "r"); + uint32_t freq = 0; + + if (!fd) + return freq; + + if (!fscanf(fd, "%d", &freq)) + return freq; + + return freq; +} + +#else /* WIN32 */ + +static float win32_cputemp(int core) +{ + // todo + return 0.0; +} + +#endif /* !WIN32 */ + + +/* exports */ + + +float cpu_temp(int core) +{ +#ifdef WIN32 + return win32_cputemp(core); +#else + return (float) linux_cputemp(core); +#endif +} + +uint32_t cpu_clock(int core) +{ +#ifdef WIN32 + return 0; +#else + return linux_cpufreq(core); +#endif +} + +int cpu_fanpercent() +{ + return 0; +} + diff --git a/uint256.h b/uint256.h new file mode 100644 index 0000000..2a252c9 --- /dev/null +++ b/uint256.h @@ -0,0 +1,784 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2012 The Bitcoin developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. +#ifndef BITCOIN_UINT256_H +#define BITCOIN_UINT256_H + +#include +#include +#include +#include +#include +#include + +typedef long long int64; +typedef unsigned long long uint64; + + +inline int Testuint256AdHoc(std::vector vArg); + + + +/** Base class without constructors for uint256 and uint160. + * This makes the compiler let you use it in a union. + */ +template +class base_uint +{ +protected: + enum { WIDTH=BITS/32 }; + uint32_t pn[WIDTH]; +public: + + bool operator!() const + { + for (int i = 0; i < WIDTH; i++) + if (pn[i] != 0) + return false; + return true; + } + + const base_uint operator~() const + { + base_uint ret; + for (int i = 0; i < WIDTH; i++) + ret.pn[i] = ~pn[i]; + return ret; + } + + const base_uint operator-() const + { + base_uint ret; + for (int i = 0; i < WIDTH; i++) + ret.pn[i] = ~pn[i]; + ret++; + return ret; + } + + double getdouble() const + { + double ret = 0.0; + double fact = 1.0; + for (int i = 0; i < WIDTH; i++) { + ret += fact * pn[i]; + fact *= 4294967296.0; + } + return ret; + } + + base_uint& operator=(uint64 b) + { + pn[0] = (unsigned int)b; + pn[1] = (unsigned int)(b >> 32); + for (int i = 2; i < WIDTH; i++) + pn[i] = 0; + return *this; + } + + base_uint& operator^=(const base_uint& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] ^= b.pn[i]; + return *this; + } + + base_uint& operator&=(const base_uint& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] &= b.pn[i]; + return *this; + } + + base_uint& operator|=(const base_uint& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] |= b.pn[i]; + return *this; + } + + base_uint& operator^=(uint64 b) + { + pn[0] ^= (unsigned int)b; + pn[1] ^= (unsigned int)(b >> 32); + return *this; + } + + base_uint& operator|=(uint64 b) + { + pn[0] |= (unsigned int)b; + pn[1] |= (unsigned int)(b >> 32); + return *this; + } + + base_uint& operator<<=(unsigned int shift) + { + base_uint a(*this); + for (int i = 0; i < WIDTH; i++) + pn[i] = 0; + int k = shift / 32; + shift = shift % 32; + for (int i = 0; i < WIDTH; i++) + { + if (i+k+1 < WIDTH && shift != 0) + pn[i+k+1] |= (a.pn[i] >> (32-shift)); + if (i+k < WIDTH) + pn[i+k] |= (a.pn[i] << shift); + } + return *this; + } + + base_uint& operator>>=(unsigned int shift) + { + base_uint a(*this); + for (int i = 0; i < WIDTH; i++) + pn[i] = 0; + int k = shift / 32; + shift = shift % 32; + for (int i = 0; i < WIDTH; i++) + { + if (i-k-1 >= 0 && shift != 0) + pn[i-k-1] |= (a.pn[i] << (32-shift)); + if (i-k >= 0) + pn[i-k] |= (a.pn[i] >> shift); + } + return *this; + } + + base_uint& operator+=(const base_uint& b) + { + uint64 carry = 0; + for (int i = 0; i < WIDTH; i++) + { + uint64 n = carry + pn[i] + b.pn[i]; + pn[i] = n & 0xffffffff; + carry = n >> 32; + } + return *this; + } + + base_uint& operator-=(const base_uint& b) + { + *this += -b; + return *this; + } + + base_uint& operator+=(uint64 b64) + { + base_uint b; + b = b64; + *this += b; + return *this; + } + + base_uint& operator-=(uint64 b64) + { + base_uint b; + b = b64; + *this += -b; + return *this; + } + + + base_uint& operator++() + { + // prefix operator + int i = 0; + while (++pn[i] == 0 && i < WIDTH-1) + i++; + return *this; + } + + const base_uint operator++(int) + { + // postfix operator + const base_uint ret = *this; + ++(*this); + return ret; + } + + base_uint& operator--() + { + // prefix operator + int i = 0; + while (--pn[i] == -1 && i < WIDTH-1) + i++; + return *this; + } + + const base_uint operator--(int) + { + // postfix operator + const base_uint ret = *this; + --(*this); + return ret; + } + + + friend inline bool operator<(const base_uint& a, const base_uint& b) + { + for (int i = base_uint::WIDTH-1; i >= 0; i--) + { + if (a.pn[i] < b.pn[i]) + return true; + else if (a.pn[i] > b.pn[i]) + return false; + } + return false; + } + + friend inline bool operator<=(const base_uint& a, const base_uint& b) + { + for (int i = base_uint::WIDTH-1; i >= 0; i--) + { + if (a.pn[i] < b.pn[i]) + return true; + else if (a.pn[i] > b.pn[i]) + return false; + } + return true; + } + + friend inline bool operator>(const base_uint& a, const base_uint& b) + { + for (int i = base_uint::WIDTH-1; i >= 0; i--) + { + if (a.pn[i] > b.pn[i]) + return true; + else if (a.pn[i] < b.pn[i]) + return false; + } + return false; + } + + friend inline bool operator>=(const base_uint& a, const base_uint& b) + { + for (int i = base_uint::WIDTH-1; i >= 0; i--) + { + if (a.pn[i] > b.pn[i]) + return true; + else if (a.pn[i] < b.pn[i]) + return false; + } + return true; + } + + friend inline bool operator==(const base_uint& a, const base_uint& b) + { + for (int i = 0; i < base_uint::WIDTH; i++) + if (a.pn[i] != b.pn[i]) + return false; + return true; + } + + friend inline bool operator==(const base_uint& a, uint64 b) + { + if (a.pn[0] != (unsigned int)b) + return false; + if (a.pn[1] != (unsigned int)(b >> 32)) + return false; + for (int i = 2; i < base_uint::WIDTH; i++) + if (a.pn[i] != 0) + return false; + return true; + } + + friend inline bool operator!=(const base_uint& a, const base_uint& b) + { + return (!(a == b)); + } + + friend inline bool operator!=(const base_uint& a, uint64 b) + { + return (!(a == b)); + } + + + + std::string GetHex() const + { + char psz[sizeof(pn)*2 + 1]; + for (unsigned int i = 0; i < sizeof(pn); i++) + sprintf(psz + i*2, "%02x", ((unsigned char*)pn)[sizeof(pn) - i - 1]); + return std::string(psz, psz + sizeof(pn)*2); + } + + void SetHex(const char* psz) + { + for (int i = 0; i < WIDTH; i++) + pn[i] = 0; + + // skip leading spaces + while (isspace(*psz)) + psz++; + + // skip 0x + if (psz[0] == '0' && tolower(psz[1]) == 'x') + psz += 2; + + // hex string to uint + static const unsigned char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 }; + const char* pbegin = psz; + while (phexdigit[(unsigned char)*psz] || *psz == '0') + psz++; + psz--; + unsigned char* p1 = (unsigned char*)pn; + unsigned char* pend = p1 + WIDTH * 4; + while (psz >= pbegin && p1 < pend) + { + *p1 = phexdigit[(unsigned char)*psz--]; + if (psz >= pbegin) + { + *p1 |= (phexdigit[(unsigned char)*psz--] << 4); + p1++; + } + } + } + + void SetHex(const std::string& str) + { + SetHex(str.c_str()); + } + + std::string ToString() const + { + return (GetHex()); + } + + unsigned char* begin() + { + return (unsigned char*)&pn[0]; + } + + unsigned char* end() + { + return (unsigned char*)&pn[WIDTH]; + } + + const unsigned char* begin() const + { + return (unsigned char*)&pn[0]; + } + + const unsigned char* end() const + { + return (unsigned char*)&pn[WIDTH]; + } + + unsigned int size() const + { + return sizeof(pn); + } + + uint64 Get64(int n=0) const + { + return pn[2*n] | (uint64)pn[2*n+1] << 32; + } + +// unsigned int GetSerializeSize(int nType=0, int nVersion=PROTOCOL_VERSION) const + unsigned int GetSerializeSize(int nType, int nVersion) const + { + return sizeof(pn); + } + + template +// void Serialize(Stream& s, int nType=0, int nVersion=PROTOCOL_VERSION) const + void Serialize(Stream& s, int nType, int nVersion) const + { + s.write((char*)pn, sizeof(pn)); + } + + template +// void Unserialize(Stream& s, int nType=0, int nVersion=PROTOCOL_VERSION) + void Unserialize(Stream& s, int nType, int nVersion) + { + s.read((char*)pn, sizeof(pn)); + } + + + friend class uint160; + friend class uint256; + friend inline int Testuint256AdHoc(std::vector vArg); +}; + +typedef base_uint<160> base_uint160; +typedef base_uint<256> base_uint256; + + + +// +// uint160 and uint256 could be implemented as templates, but to keep +// compile errors and debugging cleaner, they're copy and pasted. +// + + + +////////////////////////////////////////////////////////////////////////////// +// +// uint160 +// + +/** 160-bit unsigned integer */ +class uint160 : public base_uint160 +{ +public: + typedef base_uint160 basetype; + + uint160() + { + for (int i = 0; i < WIDTH; i++) + pn[i] = 0; + } + + uint160(const basetype& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] = b.pn[i]; + } + + uint160& operator=(const basetype& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] = b.pn[i]; + return *this; + } + + uint160(uint64 b) + { + pn[0] = (unsigned int)b; + pn[1] = (unsigned int)(b >> 32); + for (int i = 2; i < WIDTH; i++) + pn[i] = 0; + } + + uint160& operator=(uint64 b) + { + pn[0] = (unsigned int)b; + pn[1] = (unsigned int)(b >> 32); + for (int i = 2; i < WIDTH; i++) + pn[i] = 0; + return *this; + } + + explicit uint160(const std::string& str) + { + SetHex(str); + } + + explicit uint160(const std::vector& vch) + { + if (vch.size() == sizeof(pn)) + memcpy(pn, &vch[0], sizeof(pn)); + else + *this = 0; + } +}; + +inline bool operator==(const uint160& a, uint64 b) { return (base_uint160)a == b; } +inline bool operator!=(const uint160& a, uint64 b) { return (base_uint160)a != b; } +inline const uint160 operator<<(const base_uint160& a, unsigned int shift) { return uint160(a) <<= shift; } +inline const uint160 operator>>(const base_uint160& a, unsigned int shift) { return uint160(a) >>= shift; } +inline const uint160 operator<<(const uint160& a, unsigned int shift) { return uint160(a) <<= shift; } +inline const uint160 operator>>(const uint160& a, unsigned int shift) { return uint160(a) >>= shift; } + +inline const uint160 operator^(const base_uint160& a, const base_uint160& b) { return uint160(a) ^= b; } +inline const uint160 operator&(const base_uint160& a, const base_uint160& b) { return uint160(a) &= b; } +inline const uint160 operator|(const base_uint160& a, const base_uint160& b) { return uint160(a) |= b; } +inline const uint160 operator+(const base_uint160& a, const base_uint160& b) { return uint160(a) += b; } +inline const uint160 operator-(const base_uint160& a, const base_uint160& b) { return uint160(a) -= b; } + +inline bool operator<(const base_uint160& a, const uint160& b) { return (base_uint160)a < (base_uint160)b; } +inline bool operator<=(const base_uint160& a, const uint160& b) { return (base_uint160)a <= (base_uint160)b; } +inline bool operator>(const base_uint160& a, const uint160& b) { return (base_uint160)a > (base_uint160)b; } +inline bool operator>=(const base_uint160& a, const uint160& b) { return (base_uint160)a >= (base_uint160)b; } +inline bool operator==(const base_uint160& a, const uint160& b) { return (base_uint160)a == (base_uint160)b; } +inline bool operator!=(const base_uint160& a, const uint160& b) { return (base_uint160)a != (base_uint160)b; } +inline const uint160 operator^(const base_uint160& a, const uint160& b) { return (base_uint160)a ^ (base_uint160)b; } +inline const uint160 operator&(const base_uint160& a, const uint160& b) { return (base_uint160)a & (base_uint160)b; } +inline const uint160 operator|(const base_uint160& a, const uint160& b) { return (base_uint160)a | (base_uint160)b; } +inline const uint160 operator+(const base_uint160& a, const uint160& b) { return (base_uint160)a + (base_uint160)b; } +inline const uint160 operator-(const base_uint160& a, const uint160& b) { return (base_uint160)a - (base_uint160)b; } + +inline bool operator<(const uint160& a, const base_uint160& b) { return (base_uint160)a < (base_uint160)b; } +inline bool operator<=(const uint160& a, const base_uint160& b) { return (base_uint160)a <= (base_uint160)b; } +inline bool operator>(const uint160& a, const base_uint160& b) { return (base_uint160)a > (base_uint160)b; } +inline bool operator>=(const uint160& a, const base_uint160& b) { return (base_uint160)a >= (base_uint160)b; } +inline bool operator==(const uint160& a, const base_uint160& b) { return (base_uint160)a == (base_uint160)b; } +inline bool operator!=(const uint160& a, const base_uint160& b) { return (base_uint160)a != (base_uint160)b; } +inline const uint160 operator^(const uint160& a, const base_uint160& b) { return (base_uint160)a ^ (base_uint160)b; } +inline const uint160 operator&(const uint160& a, const base_uint160& b) { return (base_uint160)a & (base_uint160)b; } +inline const uint160 operator|(const uint160& a, const base_uint160& b) { return (base_uint160)a | (base_uint160)b; } +inline const uint160 operator+(const uint160& a, const base_uint160& b) { return (base_uint160)a + (base_uint160)b; } +inline const uint160 operator-(const uint160& a, const base_uint160& b) { return (base_uint160)a - (base_uint160)b; } + +inline bool operator<(const uint160& a, const uint160& b) { return (base_uint160)a < (base_uint160)b; } +inline bool operator<=(const uint160& a, const uint160& b) { return (base_uint160)a <= (base_uint160)b; } +inline bool operator>(const uint160& a, const uint160& b) { return (base_uint160)a > (base_uint160)b; } +inline bool operator>=(const uint160& a, const uint160& b) { return (base_uint160)a >= (base_uint160)b; } +inline bool operator==(const uint160& a, const uint160& b) { return (base_uint160)a == (base_uint160)b; } +inline bool operator!=(const uint160& a, const uint160& b) { return (base_uint160)a != (base_uint160)b; } +inline const uint160 operator^(const uint160& a, const uint160& b) { return (base_uint160)a ^ (base_uint160)b; } +inline const uint160 operator&(const uint160& a, const uint160& b) { return (base_uint160)a & (base_uint160)b; } +inline const uint160 operator|(const uint160& a, const uint160& b) { return (base_uint160)a | (base_uint160)b; } +inline const uint160 operator+(const uint160& a, const uint160& b) { return (base_uint160)a + (base_uint160)b; } +inline const uint160 operator-(const uint160& a, const uint160& b) { return (base_uint160)a - (base_uint160)b; } + + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// uint256 +// + +/** 256-bit unsigned integer */ +class uint256 : public base_uint256 +{ +public: + typedef base_uint256 basetype; + + uint256() + { + for (int i = 0; i < WIDTH; i++) + pn[i] = 0; + } + + uint256(const basetype& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] = b.pn[i]; + } + + uint256& operator=(const basetype& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] = b.pn[i]; + return *this; + } + + uint256(uint64 b) + { + pn[0] = (unsigned int)b; + pn[1] = (unsigned int)(b >> 32); + for (int i = 2; i < WIDTH; i++) + pn[i] = 0; + } + + uint256& operator=(uint64 b) + { + pn[0] = (unsigned int)b; + pn[1] = (unsigned int)(b >> 32); + for (int i = 2; i < WIDTH; i++) + pn[i] = 0; + return *this; + } + + explicit uint256(const std::string& str) + { + SetHex(str); + } + + explicit uint256(const std::vector& vch) + { + if (vch.size() == sizeof(pn)) + memcpy(pn, &vch[0], sizeof(pn)); + else + *this = 0; + } +}; + +inline bool operator==(const uint256& a, uint64 b) { return (base_uint256)a == b; } +inline bool operator!=(const uint256& a, uint64 b) { return (base_uint256)a != b; } +inline const uint256 operator<<(const base_uint256& a, unsigned int shift) { return uint256(a) <<= shift; } +inline const uint256 operator>>(const base_uint256& a, unsigned int shift) { return uint256(a) >>= shift; } +inline const uint256 operator<<(const uint256& a, unsigned int shift) { return uint256(a) <<= shift; } +inline const uint256 operator>>(const uint256& a, unsigned int shift) { return uint256(a) >>= shift; } + +inline const uint256 operator^(const base_uint256& a, const base_uint256& b) { return uint256(a) ^= b; } +inline const uint256 operator&(const base_uint256& a, const base_uint256& b) { return uint256(a) &= b; } +inline const uint256 operator|(const base_uint256& a, const base_uint256& b) { return uint256(a) |= b; } +inline const uint256 operator+(const base_uint256& a, const base_uint256& b) { return uint256(a) += b; } +inline const uint256 operator-(const base_uint256& a, const base_uint256& b) { return uint256(a) -= b; } + +inline bool operator<(const base_uint256& a, const uint256& b) { return (base_uint256)a < (base_uint256)b; } +inline bool operator<=(const base_uint256& a, const uint256& b) { return (base_uint256)a <= (base_uint256)b; } +inline bool operator>(const base_uint256& a, const uint256& b) { return (base_uint256)a > (base_uint256)b; } +inline bool operator>=(const base_uint256& a, const uint256& b) { return (base_uint256)a >= (base_uint256)b; } +inline bool operator==(const base_uint256& a, const uint256& b) { return (base_uint256)a == (base_uint256)b; } +inline bool operator!=(const base_uint256& a, const uint256& b) { return (base_uint256)a != (base_uint256)b; } +inline const uint256 operator^(const base_uint256& a, const uint256& b) { return (base_uint256)a ^ (base_uint256)b; } +inline const uint256 operator&(const base_uint256& a, const uint256& b) { return (base_uint256)a & (base_uint256)b; } +inline const uint256 operator|(const base_uint256& a, const uint256& b) { return (base_uint256)a | (base_uint256)b; } +inline const uint256 operator+(const base_uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; } +inline const uint256 operator-(const base_uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; } + +inline bool operator<(const uint256& a, const base_uint256& b) { return (base_uint256)a < (base_uint256)b; } +inline bool operator<=(const uint256& a, const base_uint256& b) { return (base_uint256)a <= (base_uint256)b; } +inline bool operator>(const uint256& a, const base_uint256& b) { return (base_uint256)a > (base_uint256)b; } +inline bool operator>=(const uint256& a, const base_uint256& b) { return (base_uint256)a >= (base_uint256)b; } +inline bool operator==(const uint256& a, const base_uint256& b) { return (base_uint256)a == (base_uint256)b; } +inline bool operator!=(const uint256& a, const base_uint256& b) { return (base_uint256)a != (base_uint256)b; } +inline const uint256 operator^(const uint256& a, const base_uint256& b) { return (base_uint256)a ^ (base_uint256)b; } +inline const uint256 operator&(const uint256& a, const base_uint256& b) { return (base_uint256)a & (base_uint256)b; } +inline const uint256 operator|(const uint256& a, const base_uint256& b) { return (base_uint256)a | (base_uint256)b; } +inline const uint256 operator+(const uint256& a, const base_uint256& b) { return (base_uint256)a + (base_uint256)b; } +inline const uint256 operator-(const uint256& a, const base_uint256& b) { return (base_uint256)a - (base_uint256)b; } + +inline bool operator<(const uint256& a, const uint256& b) { return (base_uint256)a < (base_uint256)b; } +inline bool operator<=(const uint256& a, const uint256& b) { return (base_uint256)a <= (base_uint256)b; } +inline bool operator>(const uint256& a, const uint256& b) { return (base_uint256)a > (base_uint256)b; } +inline bool operator>=(const uint256& a, const uint256& b) { return (base_uint256)a >= (base_uint256)b; } +inline bool operator==(const uint256& a, const uint256& b) { return (base_uint256)a == (base_uint256)b; } +inline bool operator!=(const uint256& a, const uint256& b) { return (base_uint256)a != (base_uint256)b; } +inline const uint256 operator^(const uint256& a, const uint256& b) { return (base_uint256)a ^ (base_uint256)b; } +inline const uint256 operator&(const uint256& a, const uint256& b) { return (base_uint256)a & (base_uint256)b; } +inline const uint256 operator|(const uint256& a, const uint256& b) { return (base_uint256)a | (base_uint256)b; } +inline const uint256 operator+(const uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; } +inline const uint256 operator-(const uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; } + + + + + + + + + + +#ifdef TEST_UINT256 + +inline int Testuint256AdHoc(std::vector vArg) +{ + uint256 g(0); + + + printf("%s\n", g.ToString().c_str()); + g--; printf("g--\n"); + printf("%s\n", g.ToString().c_str()); + g--; printf("g--\n"); + printf("%s\n", g.ToString().c_str()); + g++; printf("g++\n"); + printf("%s\n", g.ToString().c_str()); + g++; printf("g++\n"); + printf("%s\n", g.ToString().c_str()); + g++; printf("g++\n"); + printf("%s\n", g.ToString().c_str()); + g++; printf("g++\n"); + printf("%s\n", g.ToString().c_str()); + + + + uint256 a(7); + printf("a=7\n"); + printf("%s\n", a.ToString().c_str()); + + uint256 b; + printf("b undefined\n"); + printf("%s\n", b.ToString().c_str()); + int c = 3; + + a = c; + a.pn[3] = 15; + printf("%s\n", a.ToString().c_str()); + uint256 k(c); + + a = 5; + a.pn[3] = 15; + printf("%s\n", a.ToString().c_str()); + b = 1; + b <<= 52; + + a |= b; + + a ^= 0x500; + + printf("a %s\n", a.ToString().c_str()); + + a = a | b | (uint256)0x1000; + + + printf("a %s\n", a.ToString().c_str()); + printf("b %s\n", b.ToString().c_str()); + + a = 0xfffffffe; + a.pn[4] = 9; + + printf("%s\n", a.ToString().c_str()); + a++; + printf("%s\n", a.ToString().c_str()); + a++; + printf("%s\n", a.ToString().c_str()); + a++; + printf("%s\n", a.ToString().c_str()); + a++; + printf("%s\n", a.ToString().c_str()); + + a--; + printf("%s\n", a.ToString().c_str()); + a--; + printf("%s\n", a.ToString().c_str()); + a--; + printf("%s\n", a.ToString().c_str()); + uint256 d = a--; + printf("%s\n", d.ToString().c_str()); + printf("%s\n", a.ToString().c_str()); + a--; + printf("%s\n", a.ToString().c_str()); + a--; + printf("%s\n", a.ToString().c_str()); + + d = a; + + printf("%s\n", d.ToString().c_str()); + for (int i = uint256::WIDTH-1; i >= 0; i--) printf("%08x", d.pn[i]); printf("\n"); + + uint256 neg = d; + neg = ~neg; + printf("%s\n", neg.ToString().c_str()); + + + uint256 e = uint256("0xABCDEF123abcdef12345678909832180000011111111"); + printf("\n"); + printf("%s\n", e.ToString().c_str()); + + + printf("\n"); + uint256 x1 = uint256("0xABCDEF123abcdef12345678909832180000011111111"); + uint256 x2; + printf("%s\n", x1.ToString().c_str()); + for (int i = 0; i < 270; i += 4) + { + x2 = x1 << i; + printf("%s\n", x2.ToString().c_str()); + } + + printf("\n"); + printf("%s\n", x1.ToString().c_str()); + for (int i = 0; i < 270; i += 4) + { + x2 = x1; + x2 >>= i; + printf("%s\n", x2.ToString().c_str()); + } + + + for (int i = 0; i < 100; i++) + { + uint256 k = (~uint256(0) >> i); + printf("%s\n", k.ToString().c_str()); + } + + for (int i = 0; i < 100; i++) + { + uint256 k = (~uint256(0) << i); + printf("%s\n", k.ToString().c_str()); + } + + return (0); +} + +#endif + +#endif diff --git a/util.cpp b/util.cpp new file mode 100644 index 0000000..146e89d --- /dev/null +++ b/util.cpp @@ -0,0 +1,2223 @@ +/* + * Copyright 2010 Jeff Garzik + * Copyright 2012-2014 pooler + * Copyright 2014 ccminer team + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. See COPYING for more details. + */ + +//#define _GNU_SOURCE +#include "cpuminer-config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef WIN32 +#include "compat/winansi.h" +#include +#include +#else +#include +#include +#include +#include +#endif +#include "miner.h" +#include "elist.h" + +extern pthread_mutex_t stratum_sock_lock; +extern pthread_mutex_t stratum_work_lock; +extern bool opt_debug_diff; + +bool opt_tracegpu = false; + +struct data_buffer { + void *buf; + size_t len; +}; + +struct upload_buffer { + const void *buf; + size_t len; + size_t pos; +}; + +struct header_info { + char *lp_path; + char *reason; + char *stratum_url; +}; + +struct tq_ent { + void *data; + struct list_head q_node; +}; + +struct thread_q { + struct list_head q; + + bool frozen; + + pthread_mutex_t mutex; + pthread_cond_t cond; +}; + +void applog(int prio, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + +#ifdef HAVE_SYSLOG_H + if (use_syslog) { + va_list ap2; + char *buf; + int len; + + /* custom colors to syslog prio */ + if (prio > LOG_DEBUG) { + switch (prio) { + case LOG_BLUE: prio = LOG_NOTICE; break; + } + } + + va_copy(ap2, ap); + len = vsnprintf(NULL, 0, fmt, ap2) + 1; + va_end(ap2); + buf = (char*) alloca(len); + if (vsnprintf(buf, len, fmt, ap) >= 0) + syslog(prio, "%s", buf); + } +#else + if (0) {} +#endif + else { + const char* color = ""; + char *f; + int len; + struct tm tm; + time_t now = time(NULL); + + localtime_r(&now, &tm); + + switch (prio) { + case LOG_ERR: color = CL_RED; break; + case LOG_WARNING: color = CL_YLW; break; + case LOG_NOTICE: color = CL_WHT; break; + case LOG_INFO: color = ""; break; + case LOG_DEBUG: color = CL_GRY; break; + + case LOG_BLUE: + prio = LOG_NOTICE; + color = CL_CYN; + break; + } + if (!use_colors) + color = ""; + + len = 40 + (int) strlen(fmt) + 2; + f = (char*) alloca(len); + sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d]%s %s%s\n", + tm.tm_year + 1900, + tm.tm_mon + 1, + tm.tm_mday, + tm.tm_hour, + tm.tm_min, + tm.tm_sec, + color, + fmt, + use_colors ? CL_N : "" + ); + if (prio == LOG_RAW){ + // no time prefix, for ccminer -n + sprintf(f, "%s%s\n", fmt, CL_N); + } + pthread_mutex_lock(&applog_lock); + vfprintf(stdout, f, ap); /* atomic write to stdout */ + fflush(stdout); + pthread_mutex_unlock(&applog_lock); + } + va_end(ap); +} + +extern int gpu_threads; +// Use different prefix if multiple cpu threads per gpu +// Also, auto hide LOG_DEBUG if --debug (-D) is not used +void gpulog(int prio, int thr_id, const char *fmt, ...){ + + char _ALIGN(128) pfmt[128]; + char _ALIGN(128) line[256]; + int len, dev_id = device_map[thr_id % MAX_GPUS]; + va_list ap; + + if (prio == LOG_DEBUG && !opt_debug) + return; + + if (gpu_threads > 1) + len = snprintf(pfmt, 128, "GPU T%d: %s", thr_id, fmt); + else + len = snprintf(pfmt, 128, "GPU#%d: %s", dev_id, fmt); + pfmt[sizeof(pfmt)-1]='\0'; + + va_start(ap, fmt); + + if (len && vsnprintf(line, sizeof(line), pfmt, ap)) { + line[sizeof(line)-1]='\0'; + applog(prio, "%s", line); + } else { + fprintf(stderr, "%s OOM!\n", __func__); + } + + va_end(ap); +} + +/* Get default config.json path (system specific) */ +void get_defconfig_path(char *out, size_t bufsize, char *argv0){ + + char *cmd = strdup(argv0); + char *dir = dirname(cmd); + const char *sep = strstr(dir, "\\") ? "\\" : "/"; + struct stat info; +#ifdef WIN32 + snprintf(out, bufsize, "%s\\ccminer\\ccminer.conf\0", getenv("APPDATA")); +#else + snprintf(out, bufsize, "%s\\.ccminer\\ccminer.conf", getenv("HOME")); +#endif + if (dir && stat(out, &info) != 0) { + // binary folder if not present in user folder + snprintf(out, bufsize, "%s%sccminer.conf%s", dir, sep, ""); + } + if (stat(out, &info) != 0) { + out[0] = '\0'; + return; + } + out[bufsize - 1] = '\0'; + free(cmd); +#ifdef WIN32 + if (dir) free(dir); +#endif +} + +void format_hashrate(double hashrate, char *output){ + + char prefix = '\0'; + + if (hashrate < 10000) { + // nop + } + else if (hashrate < 1e7) { + prefix = 'k'; + hashrate *= 1e-3; + } + else if (hashrate < 1e10) { + prefix = 'M'; + hashrate *= 1e-6; + } + else if (hashrate < 1e13) { + prefix = 'G'; + hashrate *= 1e-9; + } + else { + prefix = 'T'; + hashrate *= 1e-12; + } + + sprintf(output,prefix ? "%.2f%cH/s" : "%.2fH/s%c",hashrate, prefix); +} + +static void databuf_free(struct data_buffer *db) +{ + if (!db) + return; + + free(db->buf); + + memset(db, 0, sizeof(*db)); +} + +static size_t all_data_cb(const void *ptr, size_t size, size_t nmemb, void *user_data){ + + struct data_buffer *db = (struct data_buffer *)user_data; + size_t len = size * nmemb; + size_t oldlen, newlen; + void *newmem; + static const uchar zero = 0; + + oldlen = db->len; + newlen = oldlen + len; + + newmem = realloc(db->buf, newlen + 1); + if (!newmem) + return 0; + + db->buf = newmem; + db->len = newlen; + memcpy((char*)db->buf + oldlen, ptr, len); + memcpy((char*)db->buf + newlen, &zero, 1); /* null terminate */ + + return len; +} + +static size_t upload_data_cb(void *ptr, size_t size, size_t nmemb, void *user_data){ + + struct upload_buffer *ub = (struct upload_buffer *)user_data; + unsigned int len = (unsigned int)(size * nmemb); + + if (len > ub->len - ub->pos) + len = (unsigned int)(ub->len - ub->pos); + + if (len) { + memcpy(ptr, (char*)ub->buf + ub->pos, len); + ub->pos += len; + } + + return len; +} + +#if LIBCURL_VERSION_NUM >= 0x071200 +static int seek_data_cb(void *user_data, curl_off_t offset, int origin){ + + struct upload_buffer *ub = (struct upload_buffer *)user_data; + + switch (origin) { + case SEEK_SET: + ub->pos = (size_t)offset; + break; + case SEEK_CUR: + ub->pos += (size_t)offset; + break; + case SEEK_END: + ub->pos = ub->len + (size_t)offset; + break; + default: + return 1; /* CURL_SEEKFUNC_FAIL */ + } + + return 0; /* CURL_SEEKFUNC_OK */ +} +#endif + +static size_t resp_hdr_cb(void *ptr, size_t size, size_t nmemb, void *user_data){ + + struct header_info *hi = (struct header_info *)user_data; + size_t remlen, slen, ptrlen = size * nmemb; + char *rem, *val = NULL, *key = NULL; + void *tmp; + + val = (char*)calloc(1, ptrlen); + key = (char*)calloc(1, ptrlen); + if (!key || !val) + goto out; + + tmp = memchr(ptr, ':', ptrlen); + if (!tmp || (tmp == ptr)) /* skip empty keys / blanks */ + goto out; + slen = (size_t)((char*)tmp - (char*)ptr); + if ((slen + 1) == ptrlen) /* skip key w/ no value */ + goto out; + memcpy(key, ptr, slen); /* store & nul term key */ + key[slen] = 0; + + rem = (char*)ptr + slen + 1; /* trim value's leading whitespace */ + remlen = ptrlen - slen - 1; + while ((remlen > 0) && (isspace(*rem))) { + remlen--; + rem++; + } + + memcpy(val, rem, remlen); /* store value, trim trailing ws */ + val[remlen] = 0; + while ((*val) && (isspace(val[strlen(val) - 1]))) { + val[strlen(val) - 1] = 0; + } + if (!*val) /* skip blank value */ + goto out; + + if (!strcasecmp("X-Long-Polling", key)) { + hi->lp_path = val; /* X-Mining-Extensions: longpoll */ + val = NULL; + } + + if (!strcasecmp("X-Reject-Reason", key)) { + hi->reason = val; /* X-Mining-Extensions: reject-reason */ + //applog(LOG_WARNING, "%s:%s", key, val); + val = NULL; + } + + if (!strcasecmp("X-Stratum", key)) { + hi->stratum_url = val; /* steal memory reference */ + val = NULL; + } + + if (!strcasecmp("X-Nonce-Range", key)) { + /* todo when available: X-Mining-Extensions: noncerange */ + } +out: + free(key); + free(val); + return ptrlen; +} + +#if LIBCURL_VERSION_NUM >= 0x070f06 +static int sockopt_keepalive_cb(void *userdata, curl_socket_t fd, curlsocktype purpose){ + + int keepalive = 1; + int tcp_keepcnt = 3; + int tcp_keepidle = 50; + int tcp_keepintvl = 50; +#ifdef WIN32 + DWORD outputBytes; +#endif + +#ifndef WIN32 + if (unlikely(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, + sizeof(keepalive)))) + return 1; +#ifdef __linux + if (unlikely(setsockopt(fd, SOL_TCP, TCP_KEEPCNT, + &tcp_keepcnt, sizeof(tcp_keepcnt)))) + return 1; + if (unlikely(setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, + &tcp_keepidle, sizeof(tcp_keepidle)))) + return 1; + if (unlikely(setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, + &tcp_keepintvl, sizeof(tcp_keepintvl)))) + return 1; +#endif /* __linux */ +#ifdef __APPLE_CC__ + if (unlikely(setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, + &tcp_keepintvl, sizeof(tcp_keepintvl)))) + return 1; +#endif /* __APPLE_CC__ */ +#else /* WIN32 */ + struct tcp_keepalive vals; + vals.onoff = 1; + vals.keepalivetime = tcp_keepidle * 1000; + vals.keepaliveinterval = tcp_keepintvl * 1000; + if (unlikely(WSAIoctl(fd, SIO_KEEPALIVE_VALS, &vals, sizeof(vals), + NULL, 0, &outputBytes, NULL, NULL))) + return 1; +#endif /* WIN32 */ + + return 0; +} +#endif + +/* For getwork (longpoll or wallet) - not stratum pools! + * DO NOT USE DIRECTLY + */ +static json_t *json_rpc_call(CURL *curl, const char *url, const char *userpass, const char *rpc_req, bool longpoll_scan, bool longpoll, bool keepalive, int *curl_err){ + + json_t *val, *err_val, *res_val; + int rc; + struct data_buffer all_data = { 0 }; + struct upload_buffer upload_data; + json_error_t err; + struct curl_slist *headers = NULL; + char *httpdata; + char len_hdr[64], hashrate_hdr[64]; + char curl_err_str[CURL_ERROR_SIZE] = { 0 }; + long timeout = longpoll ? opt_timeout : opt_timeout/2; + struct header_info hi = { 0 }; + bool lp_scanning = longpoll_scan && !have_longpoll; + + /* it is assumed that 'curl' is freshly [re]initialized at this pt */ + + if (opt_protocol) + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + curl_easy_setopt(curl, CURLOPT_URL, url); + if (opt_cert) { + curl_easy_setopt(curl, CURLOPT_CAINFO, opt_cert); + // ignore CN domain name, allow to move cert files + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); + } + curl_easy_setopt(curl, CURLOPT_ENCODING, ""); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 0); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); + curl_easy_setopt(curl, CURLOPT_READFUNCTION, upload_data_cb); + curl_easy_setopt(curl, CURLOPT_READDATA, &upload_data); +#if LIBCURL_VERSION_NUM >= 0x071200 + curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, &seek_data_cb); + curl_easy_setopt(curl, CURLOPT_SEEKDATA, &upload_data); +#endif + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, resp_hdr_cb); + curl_easy_setopt(curl, CURLOPT_HEADERDATA, &hi); + if (opt_proxy) { + curl_easy_setopt(curl, CURLOPT_PROXY, opt_proxy); + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type); + } + if (userpass) { + curl_easy_setopt(curl, CURLOPT_USERPWD, userpass); + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + } +#if LIBCURL_VERSION_NUM >= 0x070f06 + if (keepalive) + curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_keepalive_cb); +#endif + curl_easy_setopt(curl, CURLOPT_POST, 1); + + if (opt_protocol) + applog(LOG_DEBUG, "JSON protocol request:\n%s", rpc_req); + + upload_data.buf = rpc_req; + upload_data.len = strlen(rpc_req); + upload_data.pos = 0; + sprintf(len_hdr, "Content-Length: %lu", (unsigned long) upload_data.len); + sprintf(hashrate_hdr, "X-Mining-Hashrate: %llu", (unsigned long long) global_hashrate); + + headers = curl_slist_append(headers, "Content-Type: application/json"); + headers = curl_slist_append(headers, len_hdr); + headers = curl_slist_append(headers, "User-Agent: " USER_AGENT); + headers = curl_slist_append(headers, "X-Mining-Extensions: longpoll noncerange reject-reason"); + headers = curl_slist_append(headers, hashrate_hdr); + headers = curl_slist_append(headers, "Accept:"); /* disable Accept hdr*/ + headers = curl_slist_append(headers, "Expect:"); /* disable Expect hdr*/ + + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + + rc = curl_easy_perform(curl); + if (curl_err != NULL) + *curl_err = rc; + if (rc) { + if (!(longpoll && rc == CURLE_OPERATION_TIMEDOUT)) { + applog(LOG_ERR, "HTTP request failed: %s", curl_err_str); + goto err_out; + } + } + + /* If X-Stratum was found, activate Stratum */ + if (want_stratum && hi.stratum_url && + !strncasecmp(hi.stratum_url, "stratum+tcp://", 14) && + !(opt_proxy && opt_proxy_type == CURLPROXY_HTTP)) { + have_stratum = true; + tq_push(thr_info[stratum_thr_id].q, hi.stratum_url); + hi.stratum_url = NULL; + } + + /* If X-Long-Polling was found, activate long polling */ + if (lp_scanning && hi.lp_path && !have_stratum) { + have_longpoll = true; + tq_push(thr_info[longpoll_thr_id].q, hi.lp_path); + hi.lp_path = NULL; + } + + if (!all_data.buf || !all_data.len) { + if (!have_longpoll) // seems normal on longpoll timeout + applog(LOG_ERR, "Empty data received in json_rpc_call."); + goto err_out; + } + + httpdata = (char*) all_data.buf; + + if (*httpdata != '{' && *httpdata != '[') { + long errcode = 0; + CURLcode c = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &errcode); + if (c == CURLE_OK && errcode == 401) { + applog(LOG_ERR, "You are not authorized, check your login and password."); + goto err_out; + } + } + + val = JSON_LOADS(httpdata, &err); + if (!val) { + applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text); + if (opt_protocol) + applog(LOG_DEBUG, "%s", httpdata); + goto err_out; + } + + if (opt_protocol) { + char *s = json_dumps(val, JSON_INDENT(3)); + applog(LOG_DEBUG, "JSON protocol response:\n%s\n", s); + free(s); + } + + /* JSON-RPC valid response returns a non-null 'result', + * and a null 'error'. */ + res_val = json_object_get(val, "result"); + err_val = json_object_get(val, "error"); + + if (!res_val || json_is_null(res_val) || + (err_val && !json_is_null(err_val))) { + char *s = NULL; + + if (err_val) { + s = json_dumps(err_val, 0); + json_t *msg = json_object_get(err_val, "message"); + json_t *err_code = json_object_get(err_val, "code"); + if (curl_err && json_integer_value(err_code)) + *curl_err = (int) json_integer_value(err_code); + + if (json_is_string(msg)) { + free(s); + s = strdup(json_string_value(msg)); + if (have_longpoll && s && !strcmp(s, "method not getwork")) { + json_decref(err_val); + free(s); + goto err_out; + } + } + json_decref(err_val); + } + else + s = strdup("(unknown reason)"); + + if (!curl_err || opt_debug) + applog(LOG_ERR, "JSON-RPC call failed: %s", s); + + free(s); + + goto err_out; + } + + if (hi.reason) + json_object_set_new(val, "reject-reason", json_string(hi.reason)); + + databuf_free(&all_data); + curl_slist_free_all(headers); + curl_easy_reset(curl); + return val; + +err_out: + free(hi.lp_path); + free(hi.reason); + free(hi.stratum_url); + databuf_free(&all_data); + curl_slist_free_all(headers); + curl_easy_reset(curl); + return NULL; +} + +/* getwork calls with pool pointer (wallet/longpoll pools) */ +json_t *json_rpc_call_pool(CURL *curl, struct pool_infos *pool, const char *req, bool longpoll_scan, bool longpoll, int *curl_err){ + + char userpass[512]; + // todo, malloc and store that in pool array + snprintf(userpass, sizeof(userpass), "%s%c%s", pool->user, strlen(pool->pass)?':':'\0', pool->pass); + + return json_rpc_call(curl, pool->url, userpass, req, longpoll_scan, false, false, curl_err); +} + +/* called only from longpoll thread, we have the lp_url */ +json_t *json_rpc_longpoll(CURL *curl, char *lp_url, struct pool_infos *pool, const char *req, int *curl_err){ + + char userpass[256]; + snprintf(userpass, sizeof(userpass), "%s%c%s", pool->user, strlen(pool->pass)?':':'\0', pool->pass); + + // on pool rotate by time-limit, this keepalive can be a problem + bool keepalive = pool->time_limit == 0 || pool->time_limit > opt_timeout; + + return json_rpc_call(curl, lp_url, userpass, req, false, true, keepalive, curl_err); +} + +json_t *json_load_url(char* cfg_url, json_error_t *err){ + + char err_str[CURL_ERROR_SIZE] = { 0 }; + struct data_buffer all_data = { 0 }; + int rc = 0; json_t *cfg = NULL; + CURL *curl = curl_easy_init(); + if (unlikely(!curl)) { + applog(LOG_ERR, "Remote config init failed!"); + return NULL; + } + curl_easy_setopt(curl, CURLOPT_URL, cfg_url); + curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, err_str); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); + if (opt_proxy) { + curl_easy_setopt(curl, CURLOPT_PROXY, opt_proxy); + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type); + } else if (getenv("http_proxy")) { + if (getenv("all_proxy")) + curl_easy_setopt(curl, CURLOPT_PROXY, getenv("all_proxy")); + else if (getenv("ALL_PROXY")) + curl_easy_setopt(curl, CURLOPT_PROXY, getenv("ALL_PROXY")); + else + curl_easy_setopt(curl, CURLOPT_PROXY, ""); + } + rc = curl_easy_perform(curl); + if (rc) { + applog(LOG_ERR, "Remote config read failed: %s", err_str); + goto err_out; + } + if (!all_data.buf || !all_data.len) { + applog(LOG_ERR, "Empty data received for config"); + goto err_out; + } + + cfg = JSON_LOADS((char*)all_data.buf, err); +err_out: + curl_easy_cleanup(curl); + return cfg; +} + +/** + * Unlike malloc, calloc set the memory to zero + */ +void *aligned_calloc(int size){ + + const int ALIGN = 64; // cache line +#ifdef _MSC_VER + void* res = _aligned_malloc(size, ALIGN); + memset(res, 0, size); + return res; +#else + void *mem = calloc(1, size+ALIGN+sizeof(uintptr_t)); + void **ptr = (void**)((size_t)(((uintptr_t)(mem))+ALIGN+sizeof(uintptr_t)) & ~(ALIGN-1)); + ptr[-1] = mem; + return ptr; +#endif +} + +void aligned_free(void *ptr){ + +#ifdef _MSC_VER + _aligned_free(ptr); +#else + free(((void**)ptr)[-1]); +#endif +} + +double throughput2intensity(uint32_t throughput){ + double intensity = 0; + uint32_t ws = throughput; + uint8_t i = 0; + while (ws > 1 && i++ < 32) + ws = ws >> 1; + intensity = (double) i; + if (i && ((1U << i) < throughput)) { +// printf("%u - %u = %u\n",throughput,1U<tv_usec < y->tv_usec) { + int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; + y->tv_usec -= 1000000 * nsec; + y->tv_sec += nsec; + } + if (x->tv_usec - y->tv_usec > 1000000) { + int nsec = (x->tv_usec - y->tv_usec) / 1000000; + y->tv_usec += 1000000 * nsec; + y->tv_sec -= nsec; + } + + /* Compute the time remaining to wait. + * `tv_usec' is certainly positive. */ + result->tv_sec = x->tv_sec - y->tv_sec; + result->tv_usec = x->tv_usec - y->tv_usec; + + /* Return 1 if result is negative. */ + return x->tv_sec < y->tv_sec; +} + +bool fulltest(const uint32_t *hash, const uint32_t *target){ + + int i; + bool rc = true; + + for (i = 7; i >= 0; i--) { + if (hash[i] > target[i]) { + rc = false; + break; + } + if (hash[i] < target[i]) { + rc = true; + break; + } + if (hash[1] == target[1]) { + applog(LOG_NOTICE, "We found a close match!"); + } + } + + if ((!rc && opt_debug) || opt_debug_diff) { + uint32_t hash_be[8], target_be[8]; + char *hash_str, *target_str; + + for (i = 0; i < 8; i++) { + be32enc(hash_be + i, hash[7 - i]); + be32enc(target_be + i, target[7 - i]); + } + hash_str = bin2hex((uchar *)hash_be, 32); + target_str = bin2hex((uchar *)target_be, 32); + + applog(LOG_DEBUG, "DEBUG: %s\nHash: %s\nTarget: %s", + rc ? "hash <= target" + : CL_YLW "hash > target (false positive)" CL_N, + hash_str, + target_str); + + free(hash_str); + free(target_str); + } + + return rc; +} + +// Only used by stratum pools +void diff_to_target(uint32_t *target, double diff){ + + uint64_t m; + int k; + + for (k = 6; k > 0 && diff > 1.0; k--) + diff /= 4294967296.0; + m = (uint64_t)(4294901760.0 / diff); + if (m == 0 && k == 6) + memset(target, 0xff, 32); + else { + memset(target, 0, 32); + target[k] = (uint32_t)m; + target[k + 1] = (uint32_t)(m >> 32); + } +} + +// Only used by stratum pools +void work_set_target(struct work* work, double diff){ + + diff_to_target(work->target, diff); + work->targetdiff = diff; +} + +// Only used by longpoll pools +double target_to_diff(uint32_t* target){ + + uchar* tgt = (uchar*) target; + uint64_t m = (uint64_t)tgt[29] << 56 | (uint64_t)tgt[28] << 48 | (uint64_t)tgt[27] << 40 | (uint64_t)tgt[26] << 32 | + (uint64_t)tgt[25] << 24 | (uint64_t)tgt[24] << 16 | (uint64_t)tgt[23] << 8 | (uint64_t)tgt[22] << 0; + if (!m) + return 0.; + else + return (double)0x0000ffff00000000/m; +} + +#ifdef WIN32 +#define socket_blocks() (WSAGetLastError() == WSAEWOULDBLOCK) +#else +#define socket_blocks() (errno == EAGAIN || errno == EWOULDBLOCK) +#endif + +static bool send_line(curl_socket_t sock, char *s){ + + ssize_t len, sent = 0; + + len = (ssize_t)strlen(s); + s[len++] = '\n'; + + while (len > 0) { + struct timeval timeout = {0, 0}; + ssize_t n; + fd_set wd; + + FD_ZERO(&wd); + FD_SET(sock, &wd); + if (select((int)sock + 1, NULL, &wd, NULL, &timeout) < 1) + return false; + n = send(sock, s + sent, len, 0); + if (n < 0) { + if (!socket_blocks()) + return false; + n = 0; + } + sent += n; + len -= n; + } + return true; +} + +bool stratum_send_line(struct stratum_ctx *sctx, char *s){ + + bool ret = false; + + if (opt_protocol) + applog(LOG_DEBUG, "> %s", s); + + pthread_mutex_lock(&stratum_sock_lock); + ret = send_line(sctx->sock, s); + pthread_mutex_unlock(&stratum_sock_lock); + + return ret; +} + +static bool socket_full(curl_socket_t sock, int timeout){ + + struct timeval tv; + fd_set rd; + + FD_ZERO(&rd); + FD_SET(sock, &rd); + tv.tv_sec = timeout; + tv.tv_usec = 0; + if (select((int)sock + 1, &rd, NULL, NULL, &tv) > 0) + return true; + return false; +} + +bool stratum_socket_full(struct stratum_ctx *sctx, int timeout){ + + if (!sctx->sockbuf) return false; + return strlen(sctx->sockbuf) || socket_full(sctx->sock, timeout); +} + +#define RBUFSIZE 2048 +#define RECVSIZE (RBUFSIZE - 4) + +static void stratum_buffer_append(struct stratum_ctx *sctx, const char *s){ + + size_t old, snew; + + old = strlen(sctx->sockbuf); + snew = old + strlen(s) + 1; + if (snew >= sctx->sockbuf_size) { + sctx->sockbuf_size = snew + (RBUFSIZE - (snew % RBUFSIZE)); + sctx->sockbuf = (char*)realloc(sctx->sockbuf, sctx->sockbuf_size); + } + strcpy(sctx->sockbuf + old, s); +} + +char *stratum_recv_line(struct stratum_ctx *sctx){ + + ssize_t len, buflen; + char *tok, *sret = NULL; + int timeout = opt_timeout; + + if (!sctx->sockbuf) + return NULL; + + if (!strstr(sctx->sockbuf, "\n")) { + bool ret = true; + time_t rstart = time(NULL); + if (!socket_full(sctx->sock, timeout)) { + applog(LOG_ERR, "stratum_recv_line timed out"); + goto out; + } + do { + char s[RBUFSIZE]; + ssize_t n; + + memset(s, 0, RBUFSIZE); + n = recv(sctx->sock, s, RECVSIZE, 0); + if (!n) { + ret = false; + break; + } + if (n < 0) { + if (!socket_blocks() || !socket_full(sctx->sock, 1)) { + ret = false; + break; + } + } else + stratum_buffer_append(sctx, s); + } while (time(NULL) - rstart < timeout && !strstr(sctx->sockbuf, "\n")); + + if (!ret) { + if (opt_debug) applog(LOG_ERR, "stratum_recv_line failed"); + goto out; + } + } + + buflen = (ssize_t)strlen(sctx->sockbuf); + tok = strtok(sctx->sockbuf, "\n"); + if (!tok) { + applog(LOG_ERR, "stratum_recv_line failed to parse a newline-terminated string"); + goto out; + } + sret = strdup(tok); + len = (ssize_t)strlen(sret); + + if (buflen > len + 1) + memmove(sctx->sockbuf, sctx->sockbuf + len + 1, buflen - len + 1); + else + sctx->sockbuf[0] = '\0'; + +out: + if (sret && opt_protocol) + applog(LOG_DEBUG, "< %s", sret); + return sret; +} + +#if LIBCURL_VERSION_NUM >= 0x071101 +static curl_socket_t opensocket_grab_cb(void *clientp, curlsocktype purpose, struct curl_sockaddr *addr){ + + curl_socket_t *sock = (curl_socket_t *)clientp; + *sock = socket(addr->family, addr->socktype, addr->protocol); + return *sock; +} +#endif + +bool stratum_connect(struct stratum_ctx *sctx, const char *url){ + + CURL *curl; + int rc; + + pthread_mutex_lock(&stratum_sock_lock); + if (sctx->curl) + curl_easy_cleanup(sctx->curl); + sctx->curl = curl_easy_init(); + if (!sctx->curl) { + applog(LOG_ERR, "CURL initialization failed"); + pthread_mutex_unlock(&stratum_sock_lock); + return false; + } + curl = sctx->curl; + if (!sctx->sockbuf) { + sctx->sockbuf = (char*)calloc(RBUFSIZE, 1); + sctx->sockbuf_size = RBUFSIZE; + } + sctx->sockbuf[0] = '\0'; + pthread_mutex_unlock(&stratum_sock_lock); + + if (url != sctx->url) { + free(sctx->url); + sctx->url = strdup(url); + } + free(sctx->curl_url); + sctx->curl_url = (char*)malloc(strlen(url)+1); + sprintf(sctx->curl_url, "http%s", strstr(url, "://")); + + if (opt_protocol) + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + curl_easy_setopt(curl, CURLOPT_URL, sctx->curl_url); + curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, opt_timeout); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, sctx->curl_err_str); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + if (opt_proxy && opt_proxy_type != CURLPROXY_HTTP) { + curl_easy_setopt(curl, CURLOPT_PROXY, opt_proxy); + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type); + } else if (getenv("http_proxy")) { + if (getenv("all_proxy")) + curl_easy_setopt(curl, CURLOPT_PROXY, getenv("all_proxy")); + else if (getenv("ALL_PROXY")) + curl_easy_setopt(curl, CURLOPT_PROXY, getenv("ALL_PROXY")); + else + curl_easy_setopt(curl, CURLOPT_PROXY, ""); + } +#if LIBCURL_VERSION_NUM >= 0x070f06 + curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_keepalive_cb); +#endif +#if LIBCURL_VERSION_NUM >= 0x071101 + curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket_grab_cb); + curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sctx->sock); +#endif + curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1); + + rc = curl_easy_perform(curl); + if (rc) { + applog(LOG_ERR, "Stratum connection failed: %s", sctx->curl_err_str); + curl_easy_cleanup(curl); + sctx->curl = NULL; + return false; + } + +#if LIBCURL_VERSION_NUM < 0x071101 + /* CURLINFO_LASTSOCKET is broken on Win64; only use it as a last resort */ + curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, (long *)&sctx->sock); +#endif + + return true; +} + +void stratum_free_job(struct stratum_ctx *sctx){ + + pthread_mutex_lock(&stratum_work_lock); + if (sctx->job.job_id) { + free(sctx->job.job_id); + } + if (sctx->job.merkle_count) { + for (int i = 0; i < sctx->job.merkle_count; i++) { + free(sctx->job.merkle[i]); + sctx->job.merkle[i] = NULL; + } + free(sctx->job.merkle); + } + free(sctx->job.coinbase); + // note: xnonce2 is not allocated + memset(&(sctx->job.job_id), 0, sizeof(struct stratum_job)); + pthread_mutex_unlock(&stratum_work_lock); +} + +void stratum_disconnect(struct stratum_ctx *sctx){ + + pthread_mutex_lock(&stratum_sock_lock); + if (sctx->curl) { + pools[sctx->pooln].disconnects++; + curl_easy_cleanup(sctx->curl); + sctx->curl = NULL; + if (sctx->sockbuf) + sctx->sockbuf[0] = '\0'; + // free(sctx->sockbuf); + // sctx->sockbuf = NULL; + } + if (sctx->job.job_id) { + stratum_free_job(sctx); + } + pthread_mutex_unlock(&stratum_sock_lock); +} + +static const char *get_stratum_session_id(json_t *val){ + + json_t *arr_val; + int i, n; + + arr_val = json_array_get(val, 0); + if (!arr_val || !json_is_array(arr_val)) + return NULL; + n = (int) json_array_size(arr_val); + for (i = 0; i < n; i++) { + const char *notify; + json_t *arr = json_array_get(arr_val, i); + if (!arr || !json_is_array(arr)) + break; + notify = json_string_value(json_array_get(arr, 0)); + if (!notify) + continue; + if (!strcasecmp(notify, "mining.notify")) + return json_string_value(json_array_get(arr, 1)); + } + return NULL; +} + +static bool stratum_parse_extranonce(struct stratum_ctx *sctx, json_t *params, int pndx){ + + const char* xnonce1; + int xn2_size; + + xnonce1 = json_string_value(json_array_get(params, pndx)); + if (!xnonce1) { + applog(LOG_ERR, "Failed to get extranonce1"); + goto out; + } + xn2_size = (int) json_integer_value(json_array_get(params, pndx+1)); + if (!xn2_size) { + applog(LOG_ERR, "Failed to get extranonce2_size"); + goto out; + } + if (xn2_size < 2 || xn2_size > 16) { + applog(LOG_INFO, "Failed to get valid n2size in parse_extranonce"); + goto out; + } + + pthread_mutex_lock(&stratum_work_lock); + if (sctx->xnonce1) + free(sctx->xnonce1); + sctx->xnonce1_size = strlen(xnonce1) / 2; + sctx->xnonce1 = (uchar*) calloc(1, sctx->xnonce1_size); + if (unlikely(!sctx->xnonce1)) { + applog(LOG_ERR, "Failed to alloc xnonce1"); + pthread_mutex_unlock(&stratum_work_lock); + goto out; + } + hex2bin(sctx->xnonce1, xnonce1, sctx->xnonce1_size); + sctx->xnonce2_size = xn2_size; + pthread_mutex_unlock(&stratum_work_lock); + + if (pndx == 0 && opt_debug) /* pool dynamic change */ + applog(LOG_DEBUG, "Stratum set nonce %s with extranonce2 size=%d", + xnonce1, xn2_size); + + return true; +out: + return false; +} + +bool stratum_subscribe(struct stratum_ctx *sctx){ + + char *s, *sret = NULL; + const char *sid; + json_t *val = NULL, *res_val, *err_val; + json_error_t err; + bool ret = false, retry = false; + +start: + s = (char*)malloc(128 + (sctx->session_id ? strlen(sctx->session_id) : 0)); + if (retry) + sprintf(s, "{\"id\": 1, \"method\": \"mining.subscribe\", \"params\": []}"); + else if (sctx->session_id) + sprintf(s, "{\"id\": 1, \"method\": \"mining.subscribe\", \"params\": [\"" USER_AGENT "\", \"%s\"]}", sctx->session_id); + else + sprintf(s, "{\"id\": 1, \"method\": \"mining.subscribe\", \"params\": [\"" USER_AGENT "\"]}"); + + if (!stratum_send_line(sctx, s)) + goto out; + + if (!socket_full(sctx->sock, 10)) { + applog(LOG_ERR, "stratum_subscribe timed out"); + goto out; + } + + sret = stratum_recv_line(sctx); + if (!sret) + goto out; + + val = JSON_LOADS(sret, &err); + free(sret); + if (!val) { + applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text); + goto out; + } + + if (json_integer_value(json_object_get(val, "id")) != 1) { + applog(LOG_WARNING, "Stratum subscribe answer id is not correct!"); + } + + res_val = json_object_get(val, "result"); + err_val = json_object_get(val, "error"); + + if (!res_val || json_is_null(res_val) || + (err_val && !json_is_null(err_val))) { + if (opt_debug || retry) { + free(s); + if (err_val) + s = json_dumps(err_val, JSON_INDENT(3)); + else + s = strdup("(unknown reason)"); + applog(LOG_ERR, "JSON-RPC call failed: %s", s); + } + goto out; + } + + // sid is param 1, extranonce params are 2 and 3 + if (!stratum_parse_extranonce(sctx, res_val, 1)) { + goto out; + } + + ret = true; + + // session id (optional) + sid = get_stratum_session_id(res_val); + if (opt_debug && sid) + applog(LOG_DEBUG, "Stratum session id: %s", sid); + + pthread_mutex_lock(&stratum_work_lock); + if (sctx->session_id) + free(sctx->session_id); + sctx->session_id = sid ? strdup(sid) : NULL; + sctx->next_diff = 1.0; + pthread_mutex_unlock(&stratum_work_lock); + +out: + free(s); + if (val) + json_decref(val); + + if (!ret) { + if (sret && !retry) { + retry = true; + goto start; + } + } + + return ret; +} + +extern bool opt_extranonce; + +bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *pass){ + + json_t *val = NULL, *res_val, *err_val; + char *s, *sret; + json_error_t err; + bool ret = false; + + s = (char*)malloc(80 + strlen(user) + strlen(pass)); + sprintf(s, "{\"id\": 2, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"%s\"]}", + user, pass); + + if (!stratum_send_line(sctx, s)) + goto out; + + while (1) { + sret = stratum_recv_line(sctx); + if (!sret) + goto out; + if (!stratum_handle_method(sctx, sret)) + break; + free(sret); + } + + val = JSON_LOADS(sret, &err); + free(sret); + if (!val) { + applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text); + goto out; + } + + if (json_integer_value(json_object_get(val, "id")) != 2) { + applog(LOG_WARNING, "Stratum authorize answer id is not correct!"); + } + res_val = json_object_get(val, "result"); + err_val = json_object_get(val, "error"); + + if (!res_val || json_is_false(res_val) || + (err_val && !json_is_null(err_val))) { + applog(LOG_ERR, "Stratum authentication failed"); + goto out; + } + + sctx->tm_connected = time(NULL); + ret = true; + + if (!opt_extranonce) + goto out; + + // subscribe to extranonce (optional) + sprintf(s, "{\"id\": 3, \"method\": \"mining.extranonce.subscribe\", \"params\": []}"); + + if (!stratum_send_line(sctx, s)) + goto out; + + // reduced timeout to handle pools ignoring this method without answer (like xpool.ca) + if (!socket_full(sctx->sock, 1)) { + if (opt_debug) + applog(LOG_DEBUG, "stratum extranonce subscribe timed out"); + goto out; + } + + sret = stratum_recv_line(sctx); + if (sret) { + json_t *extra = JSON_LOADS(sret, &err); + if (!extra) { + applog(LOG_WARNING, "JSON decode failed(%d): %s", err.line, err.text); + } else { + if (json_integer_value(json_object_get(extra, "id")) != 3) { + // we receive a standard method if extranonce is ignored + if (!stratum_handle_method(sctx, sret)) + applog(LOG_WARNING, "Stratum extranonce answer id was not correct!"); + } else { + res_val = json_object_get(extra, "result"); + if (opt_debug && (!res_val || json_is_false(res_val))) + applog(LOG_DEBUG, "extranonce subscribe not supported"); + } + json_decref(extra); + } + free(sret); + } + +out: + free(s); + if (val) + json_decref(val); + + return ret; +} + +/** + * Extract bloc height L H... here len=3, height=0x1333e8 + * "...0000000000ffffffff2703e83313062f503253482f043d61105408" + */ +static uint32_t getblocheight(struct stratum_ctx *sctx){ + + uint32_t height = 0; + uint8_t hlen = 0, *p, *m; + + // find 0xffff tag + p = (uint8_t*) sctx->job.coinbase + 32; + m = p + 128; + while (*p != 0xff && p < m) p++; + while (*p == 0xff && p < m) p++; + if (*(p-1) == 0xff && *(p-2) == 0xff) { + p++; hlen = *p; + p++; height = le16dec(p); + p += 2; + switch (hlen) { + case 4: + height += 0x10000UL * le16dec(p); + break; + case 3: + height += 0x10000UL * (*p); + break; + } + } + return height; +} + +static bool stratum_notify(struct stratum_ctx *sctx, json_t *params){ + + const char *job_id, *prevhash, *coinb1, *coinb2, *version, *nbits, *stime; + const char *claim = NULL, *nreward = NULL; + size_t coinb1_size, coinb2_size; + bool clean, ret = false; + int merkle_count, i, p=0; + json_t *merkle_arr; + uchar **merkle = NULL; + // uchar(*merkle_tree)[32] = { 0 }; + int ntime; + char algo[64] = { 0 }; + get_currentalgo(algo, sizeof(algo)); + bool has_claim = !strcasecmp(algo, "lbry"); + + job_id = json_string_value(json_array_get(params, p++)); + prevhash = json_string_value(json_array_get(params, p++)); + if (has_claim) { + claim = json_string_value(json_array_get(params, p++)); + if (!claim || strlen(claim) != 64) { + applog(LOG_ERR, "Stratum notify: invalid claim parameter"); + goto out; + } + } + coinb1 = json_string_value(json_array_get(params, p++)); + coinb2 = json_string_value(json_array_get(params, p++)); + merkle_arr = json_array_get(params, p++); + if (!merkle_arr || !json_is_array(merkle_arr)) + goto out; + merkle_count = (int) json_array_size(merkle_arr); + version = json_string_value(json_array_get(params, p++)); + nbits = json_string_value(json_array_get(params, p++)); + stime = json_string_value(json_array_get(params, p++)); + clean = json_is_true(json_array_get(params, p)); p++; + nreward = json_string_value(json_array_get(params, p++)); + + if (!job_id || !prevhash || !coinb1 || !coinb2 || !version || !nbits || !stime || + strlen(prevhash) != 64 || strlen(version) != 8 || + strlen(nbits) != 8 || strlen(stime) != 8) { + applog(LOG_ERR, "Stratum notify: invalid parameters"); + goto out; + } + + /* store stratum server time diff */ + hex2bin((uchar *)&ntime, stime, 4); + ntime = swab32(ntime) - (uint32_t) time(0); + if (ntime > sctx->srvtime_diff) { + sctx->srvtime_diff = ntime; + if (opt_protocol && ntime > 20) + applog(LOG_DEBUG, "stratum time is at least %ds in the future", ntime); + } + + if (merkle_count) + merkle = (uchar**) malloc(merkle_count * sizeof(char *)); + for (i = 0; i < merkle_count; i++) { + const char *s = json_string_value(json_array_get(merkle_arr, i)); + if (!s || strlen(s) != 64) { + while (i--) + free(merkle[i]); + free(merkle); + applog(LOG_ERR, "Stratum notify: invalid Merkle branch"); + goto out; + } + merkle[i] = (uchar*) malloc(32); + hex2bin(merkle[i], s, 32); + } + + pthread_mutex_lock(&stratum_work_lock); + + coinb1_size = strlen(coinb1) / 2; + coinb2_size = strlen(coinb2) / 2; + sctx->job.coinbase_size = coinb1_size + sctx->xnonce1_size + + sctx->xnonce2_size + coinb2_size; + + sctx->job.coinbase = (uchar*) realloc(sctx->job.coinbase, sctx->job.coinbase_size); + sctx->job.xnonce2 = sctx->job.coinbase + coinb1_size + sctx->xnonce1_size; + hex2bin(sctx->job.coinbase, coinb1, coinb1_size); + memcpy(sctx->job.coinbase + coinb1_size, sctx->xnonce1, sctx->xnonce1_size); + + if (!sctx->job.job_id || strcmp(sctx->job.job_id, job_id)) + memset(sctx->job.xnonce2, 0, sctx->xnonce2_size); + hex2bin(sctx->job.xnonce2 + sctx->xnonce2_size, coinb2, coinb2_size); + + free(sctx->job.job_id); + sctx->job.job_id = strdup(job_id); + hex2bin(sctx->job.prevhash, prevhash, 32); + if (has_claim) hex2bin(sctx->job.claim, claim, 32); + + sctx->job.height = getblocheight(sctx); + + for (i = 0; i < sctx->job.merkle_count; i++) + free(sctx->job.merkle[i]); + free(sctx->job.merkle); + sctx->job.merkle = merkle; + sctx->job.merkle_count = merkle_count; + + hex2bin(sctx->job.version, version, 4); + hex2bin(sctx->job.nbits, nbits, 4); + hex2bin(sctx->job.ntime, stime, 4); + if(nreward != NULL) + { + if(strlen(nreward) == 4) + hex2bin(sctx->job.nreward, nreward, 2); + } + sctx->job.clean = clean; + + sctx->job.diff = sctx->next_diff; + + pthread_mutex_unlock(&stratum_work_lock); + + ret = true; + +out: + return ret; +} + +extern volatile time_t g_work_time; + +static bool stratum_set_difficulty(struct stratum_ctx *sctx, json_t *params){ + + double diff; + + diff = json_number_value(json_array_get(params, 0)); + if (diff <= 0.0) + return false; + + pthread_mutex_lock(&stratum_work_lock); + sctx->next_diff = diff; + pthread_mutex_unlock(&stratum_work_lock); + + return true; +} + +static bool stratum_reconnect(struct stratum_ctx *sctx, json_t *params){ + + json_t *port_val; + const char *host; + int port; + + host = json_string_value(json_array_get(params, 0)); + port_val = json_array_get(params, 1); + if (json_is_string(port_val)) + port = atoi(json_string_value(port_val)); + else + port = (int) json_integer_value(port_val); + if (!host || !port) + return false; + + free(sctx->url); + sctx->url = (char*)malloc(32 + strlen(host)); + sprintf(sctx->url, "stratum+tcp://%s:%d", host, port); + + applog(LOG_NOTICE, "Server requested reconnection to %s", sctx->url); + + stratum_disconnect(sctx); + + return true; +} + +static bool stratum_get_version(struct stratum_ctx *sctx, json_t *id){ + + char *s; + json_t *val; + bool ret; + + if (!id || json_is_null(id)) + return false; + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "error", json_null()); + json_object_set_new(val, "result", json_string(USER_AGENT)); + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +static bool stratum_pong(struct stratum_ctx *sctx, json_t *id) +{ + char buf[64]; + bool ret = false; + + if (!id || json_is_null(id)) + return ret; + + sprintf(buf, "{\"id\":%d,\"result\":\"pong\",\"error\":null}", + (int) json_integer_value(id)); + ret = stratum_send_line(sctx, buf); + + return ret; +} + +static bool stratum_get_algo(struct stratum_ctx *sctx, json_t *id, json_t *params) +{ + char algo[64] = { 0 }; + char *s; + json_t *val; + bool ret = true; + + if (!id || json_is_null(id)) + return false; + + get_currentalgo(algo, sizeof(algo)); + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "error", json_null()); + json_object_set_new(val, "result", json_string(algo)); + + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +#include "nvml.h" +extern char driver_version[32]; +extern int cuda_arch[MAX_GPUS]; + +static bool json_object_set_error(json_t *result, int code, const char *msg) +{ + json_t *val = json_object(); + json_object_set_new(val, "code", json_integer(code)); + json_object_set_new(val, "message", json_string(msg)); + return json_object_set_new(result, "error", val) != -1; +} + +/* allow to report algo/device perf to the pool for algo stats */ +static bool stratum_benchdata(json_t *result, json_t *params, int thr_id) +{ + char algo[64] = { 0 }; + char vid[32], arch[8], driver[32]; + char *card; + char os[8]; + uint32_t watts = 0; + int dev_id = device_map[thr_id]; + int cuda_ver = cuda_version(); + struct cgpu_info *cgpu = &thr_info[thr_id].gpu; + json_t *val; + + if (!cgpu || !opt_stratum_stats) return false; + +#if defined(WIN32) && (defined(_M_X64) || defined(__x86_64__)) + strcpy(os, "win64"); +#else + strcpy(os, is_windows() ? "win32" : "linux"); +#endif + + cuda_gpu_info(cgpu); + + uint32_t curr_core_clock = 0; + uint32_t curr_mem_clock = 0; +#ifdef USE_WRAPNVML + cgpu->has_monitoring = true; + cgpu->gpu_power = gpu_power(cgpu); // mWatts + watts = (cgpu->gpu_power >= 1000) ? cgpu->gpu_power / 1000 : 0; // ignore nvapi % + + nvml_get_current_clocks(dev_id, &curr_core_clock, &curr_mem_clock); //values are in MHz + gpu_info(cgpu); +#endif + get_currentalgo(algo, sizeof(algo)); + + card = device_name[dev_id]; + cgpu->khashes = stats_get_speed(thr_id, 0.0) / 1000.0; + + sprintf(vid, "%04hx:%04hx", cgpu->gpu_vid, cgpu->gpu_pid); + sprintf(arch, "%d", (int) cgpu->gpu_arch); + if (cuda_arch[dev_id] > 0 && cuda_arch[dev_id] != cgpu->gpu_arch) { + // if binary was not compiled for the highest cuda arch, add it + snprintf(arch, 8, "%d@%d", (int) cgpu->gpu_arch, cuda_arch[dev_id]); + } + snprintf(driver, 32, "CUDA %d.%d %s", cuda_ver/1000, (cuda_ver%1000) / 10, driver_version); + driver[31] = '\0'; + + val = json_object(); + json_object_set_new(val, "algo", json_string(algo)); + json_object_set_new(val, "type", json_string("gpu")); + json_object_set_new(val, "device", json_string(card)); + json_object_set_new(val, "vendorid", json_string(vid)); + json_object_set_new(val, "arch", json_string(arch)); + json_object_set_new(val, "freq", json_integer(cgpu->gpu_clock/1000)); + json_object_set_new(val, "curr_freq", json_integer(curr_core_clock)); + json_object_set_new(val, "memf", json_integer(cgpu->gpu_memclock/1000)); + json_object_set_new(val, "curr_memf", json_integer(curr_mem_clock)); + json_object_set_new(val, "power", json_integer(watts)); + json_object_set_new(val, "khashes", json_real(cgpu->khashes)); + json_object_set_new(val, "intensity", json_real(cgpu->intensity)); + json_object_set_new(val, "throughput", json_integer(cgpu->throughput)); + json_object_set_new(val, "client", json_string(PACKAGE_NAME "/" PACKAGE_VERSION)); + json_object_set_new(val, "os", json_string(os)); + json_object_set_new(val, "driver", json_string(driver)); + + json_object_set_new(result, "result", val); + + if(!opt_quiet)applog(LOG_BLUE,"Sent stats for %s",card); + return true; +} + +static bool stratum_get_stats(struct stratum_ctx *sctx, json_t *id, json_t *params) +{ + char *s; + json_t *val; + bool ret; + + if (!id || json_is_null(id)) + return false; + + val = json_object(); + json_object_set(val, "id", id); + + ret = stratum_benchdata(val, params, 0); + + if (!ret) { + json_object_set_error(val, 1, "disabled"); //EPERM + } else { + json_object_set_new(val, "error", json_null()); + } + + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +static bool stratum_get_version(struct stratum_ctx *sctx, json_t *id, json_t *params) +{ + char *s; + json_t *val; + bool ret = true; + + if (!id || json_is_null(id)) + return false; + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "result", json_string(USER_AGENT)); + if (ret) json_object_set_new(val, "error", json_null()); + + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + + json_decref(val); + free(s); + + return ret; +} + +static bool stratum_show_message(struct stratum_ctx *sctx, json_t *id, json_t *params){ + + char *s; + json_t *val; + bool ret; + + val = json_array_get(params, 0); + if (val) + applog(LOG_NOTICE, "MESSAGE FROM SERVER: %s", json_string_value(val)); + + if (!id || json_is_null(id)) + return true; + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "error", json_null()); + json_object_set_new(val, "result", json_true()); + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +static bool stratum_unknown_method(struct stratum_ctx *sctx, json_t *id) +{ + char *s; + json_t *val; + bool ret = false; + + if (!id || json_is_null(id)) + return ret; + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "result", json_false()); + json_object_set_error(val, 38, "unknown method"); // ENOSYS + + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +bool stratum_handle_method(struct stratum_ctx *sctx, const char *s){ + + json_t *val, *id, *params; + json_error_t err; + const char *method; + bool ret = false; + + val = JSON_LOADS(s, &err); + if (!val) { + applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text); + goto out; + } + + method = json_string_value(json_object_get(val, "method")); + if (!method) + goto out; + id = json_object_get(val, "id"); + params = json_object_get(val, "params"); + + if (!strcasecmp(method, "mining.notify")) { + ret = stratum_notify(sctx, params); + goto out; + } + if (!strcasecmp(method, "mining.ping")) { // cgminer 4.7.1+ + if (opt_debug) applog(LOG_DEBUG, "Pool ping"); + ret = stratum_pong(sctx, id); + goto out; + } + if (!strcasecmp(method, "mining.set_difficulty")) { + ret = stratum_set_difficulty(sctx, params); + goto out; + } + if (!strcasecmp(method, "mining.set_extranonce")) { + ret = stratum_parse_extranonce(sctx, params, 0); + goto out; + } + if (!strcasecmp(method, "client.reconnect")) { + ret = stratum_reconnect(sctx, params); + goto out; + } + if (!strcasecmp(method, "client.get_algo")) { // ccminer only yet! + // will prevent wrong algo parameters on a pool, will be used as test on rejects + if (!opt_quiet) applog(LOG_BLUE, "Pool asked your algo parameter"); + ret = stratum_get_algo(sctx, id, params); + goto out; + } + if (!strcasecmp(method, "client.get_stats")) { // ccminer/yiimp only yet! + // optional to fill device benchmarks + if (!opt_quiet) applog(LOG_BLUE, "Pool asked your stats"); + ret = stratum_get_stats(sctx, id, params); + goto out; + } + if (!strcasecmp(method, "client.get_version")) { + ret = stratum_get_version(sctx, id); + goto out; + } + if (!strcasecmp(method, "client.show_message")) { + ret = stratum_show_message(sctx, id, params); + goto out; + } + + if (!ret) { + // don't fail = disconnect stratum on unknown (and optional?) methods + if (opt_debug) applog(LOG_WARNING, "unknown stratum method %s!", method); + ret = stratum_unknown_method(sctx, id); + } + +out: + if (val) + json_decref(val); + + return ret; +} + +struct thread_q *tq_new(void){ + + struct thread_q *tq; + + tq = (struct thread_q *)calloc(1, sizeof(*tq)); + if (!tq) + return NULL; + + INIT_LIST_HEAD(&tq->q); + pthread_mutex_init(&tq->mutex, NULL); + pthread_cond_init(&tq->cond, NULL); + + return tq; +} + +void tq_free(struct thread_q *tq){ + + struct tq_ent *ent, *iter; + + if (!tq) + return; + + list_for_each_entry_safe(ent, iter, &tq->q, q_node, struct tq_ent, struct tq_ent) { + list_del(&ent->q_node); + free(ent); + } + + pthread_cond_destroy(&tq->cond); + pthread_mutex_destroy(&tq->mutex); + + memset(tq, 0, sizeof(*tq)); /* poison */ + free(tq); +} + +static void tq_freezethaw(struct thread_q *tq, bool frozen){ + + pthread_mutex_lock(&tq->mutex); + + tq->frozen = frozen; + + pthread_cond_signal(&tq->cond); + pthread_mutex_unlock(&tq->mutex); +} + +void tq_freeze(struct thread_q *tq){ + + tq_freezethaw(tq, true); +} + +void tq_thaw(struct thread_q *tq){ + + tq_freezethaw(tq, false); +} + +bool tq_push(struct thread_q *tq, void *data){ + + struct tq_ent *ent; + bool rc = true; + + ent = (struct tq_ent *)calloc(1, sizeof(*ent)); + if (!ent) + return false; + + ent->data = data; + INIT_LIST_HEAD(&ent->q_node); + + pthread_mutex_lock(&tq->mutex); + + if (!tq->frozen) { + list_add_tail(&ent->q_node, &tq->q); + } else { + free(ent); + rc = false; + } + + pthread_cond_signal(&tq->cond); + pthread_mutex_unlock(&tq->mutex); + + return rc; +} + +void *tq_pop(struct thread_q *tq, const struct timespec *abstime){ + + struct tq_ent *ent; + void *rval = NULL; + int rc; + + pthread_mutex_lock(&tq->mutex); + + if (!list_empty(&tq->q)) + goto pop; + + if (abstime) + rc = pthread_cond_timedwait(&tq->cond, &tq->mutex, abstime); + else + rc = pthread_cond_wait(&tq->cond, &tq->mutex); + if (rc) + goto out; + if (list_empty(&tq->q)) + goto out; + +pop: + ent = list_entry(tq->q.next, struct tq_ent, q_node); + rval = ent->data; + + list_del(&ent->q_node); + free(ent); + +out: + pthread_mutex_unlock(&tq->mutex); + return rval; +} + +/** + * @param buf char[9] mini + * @param time_t timer to convert + */ +size_t time2str(char* buf, time_t timer){ + + struct tm* tm_info; + tm_info = localtime(&timer); + return strftime(buf, 19, "%H:%M:%S", tm_info); +} + +/** + * Alloc and returns time string (to be freed) + * @param time_t timer to convert + */ +char* atime2str(time_t timer){ + + char* buf = (char*) malloc(16); + memset(buf, 0, 16); + time2str(buf, timer); + return buf; +} + +/* sprintf can be used in applog */ +static char* format_hash(char* buf, uint8_t* h){ + + uchar *hash = (uchar*) h; + int len = 0; + for (int i=0; i < 32; i += 4) { + len += sprintf(buf+len, "%02x%02x%02x%02x ", + hash[i], hash[i+1], hash[i+2], hash[i+3]); + } + return buf; +} + +/* to debug diff in data */ +void applog_compare_hash(void *hash, void *hash_ref){ + + char s[256] = ""; + int len = 0; + uchar* hash1 = (uchar*)hash; + uchar* hash2 = (uchar*)hash_ref; + for (int i=0; i < 32; i += 4) { + const char *color = memcmp(hash1+i, hash2+i, 4) ? CL_WHT : CL_GRY; + len += sprintf(s+len, "%s%02x%02x%02x%02x " CL_GRY, color, + hash1[i], hash1[i+1], hash1[i+2], hash1[i+3]); + s[len] = '\0'; + } + applog(LOG_DEBUG, "%s", s); +} + +void applog_hash(void *hash){ + + char s[128] = {'\0'}; + applog(LOG_DEBUG, "%s", format_hash(s, (uint8_t*)hash)); +} + +void applog_hash64(void *hash){ + + char s[128] = {'\0'}; + char t[128] = {'\0'}; + applog(LOG_DEBUG, "%s %s", format_hash(s, (uint8_t*)hash), format_hash(t, &((uint8_t*)hash)[32])); +} + +void applog_hex(void *data, int len){ + + char* hex = bin2hex((uchar*)data, len); + applog(LOG_DEBUG, "%s", hex); + free(hex); +} + +#define printpfx(n,h) \ + printf("%s%11s%s: %s\n", CL_GRN, n, CL_N, format_hash(s, h)) + +static uint32_t zrtest[20] = { + swab32(0x01806486), + swab32(0x00000000), + swab32(0x00000000), + swab32(0x00000000), + swab32(0x00000000), + swab32(0x00000000), + swab32(0x00000000), + swab32(0x00000000), + swab32(0x00000000), + swab32(0x2ab03251), + swab32(0x87d4f28b), + swab32(0x6e22f086), + swab32(0x4845ddd5), + swab32(0x0ac4e6aa), + swab32(0x22a1709f), + swab32(0xfb4275d9), + swab32(0x25f26636), + swab32(0x300eed54), + swab32(0xffff0f1e), + swab32(0x2a9e2300), +}; + +void do_gpu_tests(void){ + +#ifdef _DEBUG + unsigned long done; + char s[128] = { '\0' }; + struct work work; + memset(&work, 0, sizeof(work)); + + opt_tracegpu = true; + work_restart = (struct work_restart*) malloc(sizeof(struct work_restart)); + work_restart[0].restart = 1; + work.target[7] = 0xffff; + + //struct timeval tv; + //memset(work.data, 0, sizeof(work.data)); + //scanhash_scrypt_jane(0, &work, NULL, 1, &done, &tv, &tv); + + memset(work.data, 0, sizeof(work.data)); + scanhash_decred(0, &work, 1, &done); + + free(work_restart); + work_restart = NULL; + opt_tracegpu = false; +#endif +} + +void print_hash_tests(void){ + + uchar *scratchbuf = NULL; + char s[128] = {'\0'}; + uchar hash[128]; + uchar buf[128]; + + // work space for scratchpad based algos + scratchbuf = (uchar*)calloc(128, 1024); + memset(buf, 0, sizeof buf); + + // buf[0] = 1; buf[64] = 2; // for endian tests + + printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n"); + + blake256_8roundHash(&hash[0], &buf[0]); + printpfx("blake256 / 8round", hash); + + wcoinhash(&hash[0], &buf[0]); + printpfx("whirlpool", hash); + +// whirlxHash(&hash[0], &buf[0]); +// printpfx("whirlpoolx", hash); + + keccak256_hash(&hash[0], &buf[0]); + printpfx("keccak", hash); + + hsr_hash(&hash[0], &buf[0]); + printpfx("hsr", hash); + + lyra2re_hash(&hash[0], &buf[0]); + printpfx("lyra2", hash); + + lyra2v2_hash(&hash[0], &buf[0]); + printpfx("lyra2v2", hash); + + skeincoinhash(&hash[0], &buf[0]); + printpfx("skein", hash); + + skein2hash(&hash[0], &buf[0]); + printpfx("skein2", hash); + + nist5hash(&hash[0], &buf[0]); + printpfx("nist5", hash); + + quarkhash(&hash[0], &buf[0]); + printpfx("quark", hash); + + qubithash(&hash[0], &buf[0]); + printpfx("qubit", hash); + + x11hash(&hash[0], &buf[0]); + printpfx("X11", hash); + + x11evo_hash(&hash[0], &buf[0]); + printpfx("x11evo", hash); + + c11hash(&hash[0], &buf[0]); + printpfx("c11", hash); + + sibhash(&hash[0], &buf[0]); + printpfx("sib", hash); + + x13hash(&hash[0], &buf[0]); + printpfx("X13", hash); + + x14hash(&hash[0], &buf[0]); + printpfx("X14", hash); + + x15hash(&hash[0], &buf[0]); + printpfx("X15", hash); + + x17hash(&hash[0], &buf[0]); + printpfx("X17", hash); + + lbry_hash(&hash[0], &buf[0]); + printpfx("LBRY", hash); + + neoscrypt(&hash[0], &buf[0], 80000620); + printpfx("neoscrypt", hash); + +// blake2b_hash(&hash[0], &buf[0]); +// printpfx("sia", hash); + + myriadhash(&hash[0], &buf[0]); + printpfx("myriad", hash); + + veltorhash(&hash[0], &buf[0]); + printpfx("veltor", hash); + +// yescrypt(&hash[0], &buf[0]); +// printpfx("yescrypt", hash); + + printf("\n"); + + do_gpu_tests(); + + free(scratchbuf); +} diff --git a/x11/c11.cu b/x11/c11.cu new file mode 100644 index 0000000..f9d7dc5 --- /dev/null +++ b/x11/c11.cu @@ -0,0 +1,219 @@ +extern "C" +{ +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" + +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" +} + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_x11.h" + +#include +#include + +#define NBN 2 + +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +// Flax/Chaincoin C11 CPU Hash +extern "C" void c11hash(void *output, const void *input) +{ + unsigned char hash[128] = { 0 }; + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, (void*) hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512 (&ctx_bmw, (const void*) hash, 64); + sph_bmw512_close(&ctx_bmw, (void*) hash); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, (void*) hash); + + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, (void*) hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, (void*) hash); + + sph_luffa512_init(&ctx_luffa); + sph_luffa512 (&ctx_luffa, (const void*) hash, 64); + sph_luffa512_close (&ctx_luffa, (void*) hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512 (&ctx_cubehash, (const void*) hash, 64); + sph_cubehash512_close(&ctx_cubehash, (void*) hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512 (&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, (void*) hash); + + sph_simd512_init(&ctx_simd); + sph_simd512 (&ctx_simd, (const void*) hash, 64); + sph_simd512_close(&ctx_simd, (void*) hash); + + sph_echo512_init(&ctx_echo); + sph_echo512 (&ctx_echo, (const void*) hash, 64); + sph_echo512_close(&ctx_echo, (void*) hash); + + memcpy(output, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_c11(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<20; + else if(device_sm[dev_id]<=520) default_throughput = 1<<21; + else if(device_sm[dev_id]>520) default_throughput = 1<<22; + + if((strstr(device_name[dev_id], "3GB")))default_throughput = 1<<21; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + throughput&=0xFFFFFF70; //multiples of 128 due to cubehash_shavite & simd_echo kernels + + if (opt_benchmark) + ptarget[7] = 0x5; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + uint32_t endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + int rc = 0; + do { + + // Hash with CUDA + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_keccak_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id], d_resNonce[thr_id], *(uint64_t*)&ptarget[6]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + c11hash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + rc = 1; + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], pdata[21]); + c11hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + rc=2; + } + return rc; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce; + + return rc; +} + +// cleanup +extern "C" void free_c11(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/x11/cuda_x11.h b/x11/cuda_x11.h new file mode 100644 index 0000000..102d962 --- /dev/null +++ b/x11/cuda_x11.h @@ -0,0 +1,20 @@ +#include "quark/cuda_quark.h" + +extern void x11_luffa512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void x11_cubehash512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void x11_shavite512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void x11_cubehash_shavite512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void x11_simd512_cpu_init(int thr_id, uint32_t threads); +extern void x11_simd512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void x11_simd512_cpu_free(int thr_id); + +extern void x11_echo512_cpu_hash_64(int thr_id, uint32_t threads,uint32_t *d_hash); +extern void x11_echo512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target); + +extern void x11_simd_echo_512_cpu_init(int thr_id, uint32_t threads); +extern void x11_simd_echo512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target); +extern void x11_simd_echo512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void x11_simd_echo_512_cpu_free(int thr_id); + diff --git a/x11/cuda_x11_aes.cuh b/x11/cuda_x11_aes.cuh new file mode 100644 index 0000000..8bda7dd --- /dev/null +++ b/x11/cuda_x11_aes.cuh @@ -0,0 +1,256 @@ +#include "miner.h" + +__device__ uint32_t d_AES0[256] = { + 0xA56363C6, 0x847C7CF8, 0x997777EE, 0x8D7B7BF6, 0x0DF2F2FF, 0xBD6B6BD6, 0xB16F6FDE, 0x54C5C591, 0x50303060, 0x03010102, 0xA96767CE, 0x7D2B2B56, 0x19FEFEE7, 0x62D7D7B5, 0xE6ABAB4D, 0x9A7676EC, + 0x45CACA8F, 0x9D82821F, 0x40C9C989, 0x877D7DFA, 0x15FAFAEF, 0xEB5959B2, 0xC947478E, 0x0BF0F0FB, 0xECADAD41, 0x67D4D4B3, 0xFDA2A25F, 0xEAAFAF45, 0xBF9C9C23, 0xF7A4A453, 0x967272E4, 0x5BC0C09B, + 0xC2B7B775, 0x1CFDFDE1, 0xAE93933D, 0x6A26264C, 0x5A36366C, 0x413F3F7E, 0x02F7F7F5, 0x4FCCCC83, 0x5C343468, 0xF4A5A551, 0x34E5E5D1, 0x08F1F1F9, 0x937171E2, 0x73D8D8AB, 0x53313162, 0x3F15152A, + 0x0C040408, 0x52C7C795, 0x65232346, 0x5EC3C39D, 0x28181830, 0xA1969637, 0x0F05050A, 0xB59A9A2F, 0x0907070E, 0x36121224, 0x9B80801B, 0x3DE2E2DF, 0x26EBEBCD, 0x6927274E, 0xCDB2B27F, 0x9F7575EA, + 0x1B090912, 0x9E83831D, 0x742C2C58, 0x2E1A1A34, 0x2D1B1B36, 0xB26E6EDC, 0xEE5A5AB4, 0xFBA0A05B, 0xF65252A4, 0x4D3B3B76, 0x61D6D6B7, 0xCEB3B37D, 0x7B292952, 0x3EE3E3DD, 0x712F2F5E, 0x97848413, + 0xF55353A6, 0x68D1D1B9, 0x00000000, 0x2CEDEDC1, 0x60202040, 0x1FFCFCE3, 0xC8B1B179, 0xED5B5BB6, 0xBE6A6AD4, 0x46CBCB8D, 0xD9BEBE67, 0x4B393972, 0xDE4A4A94, 0xD44C4C98, 0xE85858B0, 0x4ACFCF85, + 0x6BD0D0BB, 0x2AEFEFC5, 0xE5AAAA4F, 0x16FBFBED, 0xC5434386, 0xD74D4D9A, 0x55333366, 0x94858511, 0xCF45458A, 0x10F9F9E9, 0x06020204, 0x817F7FFE, 0xF05050A0, 0x443C3C78, 0xBA9F9F25, 0xE3A8A84B, + 0xF35151A2, 0xFEA3A35D, 0xC0404080, 0x8A8F8F05, 0xAD92923F, 0xBC9D9D21, 0x48383870, 0x04F5F5F1, 0xDFBCBC63, 0xC1B6B677, 0x75DADAAF, 0x63212142, 0x30101020, 0x1AFFFFE5, 0x0EF3F3FD, 0x6DD2D2BF, + 0x4CCDCD81, 0x140C0C18, 0x35131326, 0x2FECECC3, 0xE15F5FBE, 0xA2979735, 0xCC444488, 0x3917172E, 0x57C4C493, 0xF2A7A755, 0x827E7EFC, 0x473D3D7A, 0xAC6464C8, 0xE75D5DBA, 0x2B191932, 0x957373E6, + 0xA06060C0, 0x98818119, 0xD14F4F9E, 0x7FDCDCA3, 0x66222244, 0x7E2A2A54, 0xAB90903B, 0x8388880B, 0xCA46468C, 0x29EEEEC7, 0xD3B8B86B, 0x3C141428, 0x79DEDEA7, 0xE25E5EBC, 0x1D0B0B16, 0x76DBDBAD, + 0x3BE0E0DB, 0x56323264, 0x4E3A3A74, 0x1E0A0A14, 0xDB494992, 0x0A06060C, 0x6C242448, 0xE45C5CB8, 0x5DC2C29F, 0x6ED3D3BD, 0xEFACAC43, 0xA66262C4, 0xA8919139, 0xA4959531, 0x37E4E4D3, 0x8B7979F2, + 0x32E7E7D5, 0x43C8C88B, 0x5937376E, 0xB76D6DDA, 0x8C8D8D01, 0x64D5D5B1, 0xD24E4E9C, 0xE0A9A949, 0xB46C6CD8, 0xFA5656AC, 0x07F4F4F3, 0x25EAEACF, 0xAF6565CA, 0x8E7A7AF4, 0xE9AEAE47, 0x18080810, + 0xD5BABA6F, 0x887878F0, 0x6F25254A, 0x722E2E5C, 0x241C1C38, 0xF1A6A657, 0xC7B4B473, 0x51C6C697, 0x23E8E8CB, 0x7CDDDDA1, 0x9C7474E8, 0x211F1F3E, 0xDD4B4B96, 0xDCBDBD61, 0x868B8B0D, 0x858A8A0F, + 0x907070E0, 0x423E3E7C, 0xC4B5B571, 0xAA6666CC, 0xD8484890, 0x05030306, 0x01F6F6F7, 0x120E0E1C, 0xA36161C2, 0x5F35356A, 0xF95757AE, 0xD0B9B969, 0x91868617, 0x58C1C199, 0x271D1D3A, 0xB99E9E27, + 0x38E1E1D9, 0x13F8F8EB, 0xB398982B, 0x33111122, 0xBB6969D2, 0x70D9D9A9, 0x898E8E07, 0xA7949433, 0xB69B9B2D, 0x221E1E3C, 0x92878715, 0x20E9E9C9, 0x49CECE87, 0xFF5555AA, 0x78282850, 0x7ADFDFA5, + 0x8F8C8C03, 0xF8A1A159, 0x80898909, 0x170D0D1A, 0xDABFBF65, 0x31E6E6D7, 0xC6424284, 0xB86868D0, 0xC3414182, 0xB0999929, 0x772D2D5A, 0x110F0F1E, 0xCBB0B07B, 0xFC5454A8, 0xD6BBBB6D, 0x3A16162C +}; + +__device__ uint32_t d_AES3[256] = { + 0xC6A56363, 0xF8847C7C, 0xEE997777, 0xF68D7B7B, 0xFF0DF2F2, 0xD6BD6B6B, 0xDEB16F6F, 0x9154C5C5, 0x60503030, 0x02030101, 0xCEA96767, 0x567D2B2B, 0xE719FEFE, 0xB562D7D7, 0x4DE6ABAB, 0xEC9A7676, + 0x8F45CACA, 0x1F9D8282, 0x8940C9C9, 0xFA877D7D, 0xEF15FAFA, 0xB2EB5959, 0x8EC94747, 0xFB0BF0F0, 0x41ECADAD, 0xB367D4D4, 0x5FFDA2A2, 0x45EAAFAF, 0x23BF9C9C, 0x53F7A4A4, 0xE4967272, 0x9B5BC0C0, + 0x75C2B7B7, 0xE11CFDFD, 0x3DAE9393, 0x4C6A2626, 0x6C5A3636, 0x7E413F3F, 0xF502F7F7, 0x834FCCCC, 0x685C3434, 0x51F4A5A5, 0xD134E5E5, 0xF908F1F1, 0xE2937171, 0xAB73D8D8, 0x62533131, 0x2A3F1515, + 0x080C0404, 0x9552C7C7, 0x46652323, 0x9D5EC3C3, 0x30281818, 0x37A19696, 0x0A0F0505, 0x2FB59A9A, 0x0E090707, 0x24361212, 0x1B9B8080, 0xDF3DE2E2, 0xCD26EBEB, 0x4E692727, 0x7FCDB2B2, 0xEA9F7575, + 0x121B0909, 0x1D9E8383, 0x58742C2C, 0x342E1A1A, 0x362D1B1B, 0xDCB26E6E, 0xB4EE5A5A, 0x5BFBA0A0, 0xA4F65252, 0x764D3B3B, 0xB761D6D6, 0x7DCEB3B3, 0x527B2929, 0xDD3EE3E3, 0x5E712F2F, 0x13978484, + 0xA6F55353, 0xB968D1D1, 0x00000000, 0xC12CEDED, 0x40602020, 0xE31FFCFC, 0x79C8B1B1, 0xB6ED5B5B, 0xD4BE6A6A, 0x8D46CBCB, 0x67D9BEBE, 0x724B3939, 0x94DE4A4A, 0x98D44C4C, 0xB0E85858, 0x854ACFCF, + 0xBB6BD0D0, 0xC52AEFEF, 0x4FE5AAAA, 0xED16FBFB, 0x86C54343, 0x9AD74D4D, 0x66553333, 0x11948585, 0x8ACF4545, 0xE910F9F9, 0x04060202, 0xFE817F7F, 0xA0F05050, 0x78443C3C, 0x25BA9F9F, 0x4BE3A8A8, + 0xA2F35151, 0x5DFEA3A3, 0x80C04040, 0x058A8F8F, 0x3FAD9292, 0x21BC9D9D, 0x70483838, 0xF104F5F5, 0x63DFBCBC, 0x77C1B6B6, 0xAF75DADA, 0x42632121, 0x20301010, 0xE51AFFFF, 0xFD0EF3F3, 0xBF6DD2D2, + 0x814CCDCD, 0x18140C0C, 0x26351313, 0xC32FECEC, 0xBEE15F5F, 0x35A29797, 0x88CC4444, 0x2E391717, 0x9357C4C4, 0x55F2A7A7, 0xFC827E7E, 0x7A473D3D, 0xC8AC6464, 0xBAE75D5D, 0x322B1919, 0xE6957373, + 0xC0A06060, 0x19988181, 0x9ED14F4F, 0xA37FDCDC, 0x44662222, 0x547E2A2A, 0x3BAB9090, 0x0B838888, 0x8CCA4646, 0xC729EEEE, 0x6BD3B8B8, 0x283C1414, 0xA779DEDE, 0xBCE25E5E, 0x161D0B0B, 0xAD76DBDB, + 0xDB3BE0E0, 0x64563232, 0x744E3A3A, 0x141E0A0A, 0x92DB4949, 0x0C0A0606, 0x486C2424, 0xB8E45C5C, 0x9F5DC2C2, 0xBD6ED3D3, 0x43EFACAC, 0xC4A66262, 0x39A89191, 0x31A49595, 0xD337E4E4, 0xF28B7979, + 0xD532E7E7, 0x8B43C8C8, 0x6E593737, 0xDAB76D6D, 0x018C8D8D, 0xB164D5D5, 0x9CD24E4E, 0x49E0A9A9, 0xD8B46C6C, 0xACFA5656, 0xF307F4F4, 0xCF25EAEA, 0xCAAF6565, 0xF48E7A7A, 0x47E9AEAE, 0x10180808, + 0x6FD5BABA, 0xF0887878, 0x4A6F2525, 0x5C722E2E, 0x38241C1C, 0x57F1A6A6, 0x73C7B4B4, 0x9751C6C6, 0xCB23E8E8, 0xA17CDDDD, 0xE89C7474, 0x3E211F1F, 0x96DD4B4B, 0x61DCBDBD, 0x0D868B8B, 0x0F858A8A, + 0xE0907070, 0x7C423E3E, 0x71C4B5B5, 0xCCAA6666, 0x90D84848, 0x06050303, 0xF701F6F6, 0x1C120E0E, 0xC2A36161, 0x6A5F3535, 0xAEF95757, 0x69D0B9B9, 0x17918686, 0x9958C1C1, 0x3A271D1D, 0x27B99E9E, + 0xD938E1E1, 0xEB13F8F8, 0x2BB39898, 0x22331111, 0xD2BB6969, 0xA970D9D9, 0x07898E8E, 0x33A79494, 0x2DB69B9B, 0x3C221E1E, 0x15928787, 0xC920E9E9, 0x8749CECE, 0xAAFF5555, 0x50782828, 0xA57ADFDF, + 0x038F8C8C, 0x59F8A1A1, 0x09808989, 0x1A170D0D, 0x65DABFBF, 0xD731E6E6, 0x84C64242, 0xD0B86868, 0x82C34141, 0x29B09999, 0x5A772D2D, 0x1E110F0F, 0x7BCBB0B0, 0xA8FC5454, 0x6DD6BBBB, 0x2C3A1616 +}; + +__device__ __forceinline__ +void aes_gpu_init_mt_256(uint32_t sharedMemory[4][256]) +{ + /* each thread startup will fill a uint32 */ + if(threadIdx.x<256){ + uint32_t temp = __ldg(&d_AES0[threadIdx.x]); + sharedMemory[0][threadIdx.x] = temp; + sharedMemory[1][threadIdx.x] = ROL8(temp); + sharedMemory[2][threadIdx.x] = ROL16(temp); + sharedMemory[3][threadIdx.x] = ROR8(temp); + } +} + +__device__ __forceinline__ +void aes_gpu_init256(uint32_t sharedMemory[4][256]) +{ + /* each thread startup will fill a uint32 */ + uint32_t temp = __ldg(&d_AES0[threadIdx.x]); + sharedMemory[0][threadIdx.x] = temp; + sharedMemory[1][threadIdx.x] = ROL8(temp); + sharedMemory[2][threadIdx.x] = ROL16(temp); + sharedMemory[3][threadIdx.x] = ROR8(temp); +} + +__device__ __forceinline__ +void aes_gpu_init128(uint32_t sharedMemory[4][256]) +{ + /* each thread startup will fill 2 uint32 */ + uint2 temp = __ldg(&((uint2*)&d_AES0)[threadIdx.x]); + + sharedMemory[0][(threadIdx.x<<1) + 0] = temp.x; + sharedMemory[0][(threadIdx.x<<1) + 1] = temp.y; + sharedMemory[1][(threadIdx.x<<1) + 0] = ROL8(temp.x); + sharedMemory[1][(threadIdx.x<<1) + 1] = ROL8(temp.y); + sharedMemory[2][(threadIdx.x<<1) + 0] = ROL16(temp.x); + sharedMemory[2][(threadIdx.x<<1) + 1] = ROL16(temp.y); + sharedMemory[3][(threadIdx.x<<1) + 0] = ROR8(temp.x); + sharedMemory[3][(threadIdx.x<<1) + 1] = ROR8(temp.y); +} + +__device__ __forceinline__ +void aes_gpu_init_lt_256(uint32_t sharedMemory[4][256]) +{ + if(threadIdx.x<128){ + /* each thread startup will fill 2 uint32 */ + uint2 temp = __ldg(&((uint2*)&d_AES0)[threadIdx.x]); + + sharedMemory[0][(threadIdx.x<<1) + 0] = temp.x; + sharedMemory[0][(threadIdx.x<<1) + 1] = temp.y; + sharedMemory[1][(threadIdx.x<<1) + 0] = ROL8(temp.x); + sharedMemory[1][(threadIdx.x<<1) + 1] = ROL8(temp.y); + sharedMemory[2][(threadIdx.x<<1) + 0] = ROL16(temp.x); + sharedMemory[2][(threadIdx.x<<1) + 1] = ROL16(temp.y); + sharedMemory[3][(threadIdx.x<<1) + 0] = ROR8(temp.x); + sharedMemory[3][(threadIdx.x<<1) + 1] = ROR8(temp.y); + } +} + + +__device__ __forceinline__ +static void aes_round(const uint32_t sharedMemory[4][256],const uint32_t x0,const uint32_t x1,const uint32_t x2,const uint32_t x3,const uint32_t k0,uint32_t &y0, uint32_t &y1, uint32_t &y2, uint32_t &y3){ + + y0 = __ldg(&d_AES0[__byte_perm(x0, 0, 0x4440)]); + y3 = sharedMemory[1][__byte_perm(x0, 0, 0x4441)]; + y2 = sharedMemory[2][__byte_perm(x0, 0, 0x4442)]; + y1 = __ldg(&d_AES3[__byte_perm(x0, 0, 0x4443)]); + + y1^= sharedMemory[0][__byte_perm(x1, 0, 0x4440)]; + y0^= sharedMemory[1][__byte_perm(x1, 0, 0x4441)]; + y3^= sharedMemory[2][__byte_perm(x1, 0, 0x4442)]; + #ifdef INTENSIVE_GMF + y2^= __ldg(&d_AES3[__byte_perm(x1, 0, 0x4443)]); + #else + y2^= sharedMemory[3][__byte_perm(x1, 0, 0x4443)]; + #endif + + y0^= k0; + + y2^= __ldg(&d_AES0[__byte_perm(x2, 0, 0x4440)]); + y1^= sharedMemory[1][__byte_perm(x2, 0, 0x4441)]; + y0^= sharedMemory[2][__byte_perm(x2, 0, 0x4442)]; + y3^= __ldg(&d_AES3[__byte_perm(x2, 0, 0x4443)]); + + y3^= sharedMemory[0][__byte_perm(x3, 0, 0x4440)]; + y2^= sharedMemory[1][__byte_perm(x3, 0, 0x4441)]; + y1^= sharedMemory[2][__byte_perm(x3, 0, 0x4442)]; + y0^= __ldg(&d_AES3[__byte_perm(x3, 0, 0x4443)]); +} + +__device__ __forceinline__ +static void aes_round_LDG(const uint32_t sharedMemory[4][256],const uint32_t x0,const uint32_t x1,const uint32_t x2,const uint32_t x3,const uint32_t k0,uint32_t &y0, uint32_t &y1, uint32_t &y2, uint32_t &y3){ + + y0 = __ldg(&d_AES0[__byte_perm(x0, 0, 0x4440)]); + y3 = sharedMemory[1][__byte_perm(x0, 0, 0x4441)]; + y2 = sharedMemory[2][__byte_perm(x0, 0, 0x4442)]; + y1 = __ldg(&d_AES3[__byte_perm(x0, 0, 0x4443)]); + + y1^= sharedMemory[0][__byte_perm(x1, 0, 0x4440)]; + y0^= sharedMemory[1][__byte_perm(x1, 0, 0x4441)]; + y3^= sharedMemory[2][__byte_perm(x1, 0, 0x4442)]; + y2^= __ldg(&d_AES3[__byte_perm(x1, 0, 0x4443)]); + + y0^= k0; + + y2^= __ldg(&d_AES0[__byte_perm(x2, 0, 0x4440)]); + y1^= sharedMemory[1][__byte_perm(x2, 0, 0x4441)]; + y0^= sharedMemory[2][__byte_perm(x2, 0, 0x4442)]; + y3^= __ldg(&d_AES3[__byte_perm(x2, 0, 0x4443)]); + + y3^= __ldg(&d_AES0[__byte_perm(x3, 0, 0x4440)]); + y2^= sharedMemory[1][__byte_perm(x3, 0, 0x4441)]; + y1^= sharedMemory[2][__byte_perm(x3, 0, 0x4442)]; + y0^= __ldg(&d_AES3[__byte_perm(x3, 0, 0x4443)]); +} + +__device__ __forceinline__ +static void aes_round(const uint32_t sharedMemory[4][256],const uint32_t x0,const uint32_t x1,const uint32_t x2,const uint32_t x3,uint32_t &y0, uint32_t &y1, uint32_t &y2, uint32_t &y3){ + + y0 = sharedMemory[0][__byte_perm(x0, 0, 0x4440)]; + y3 = sharedMemory[1][__byte_perm(x0, 0, 0x4441)]; + y2 = sharedMemory[2][__byte_perm(x0, 0, 0x4442)]; + y1 = __ldg(&d_AES3[__byte_perm(x0, 0, 0x4443)]); + + #ifdef INTENSIVE_GMF + y1^= __ldg(&d_AES0[__byte_perm(x1, 0, 0x4440)]); + #else + y1^= sharedMemory[0][__byte_perm(x1, 0, 0x4440)]; + #endif + y0^= sharedMemory[1][__byte_perm(x1, 0, 0x4441)]; + y3^= sharedMemory[2][__byte_perm(x1, 0, 0x4442)]; + y2^= __ldg(&d_AES3[__byte_perm(x1, 0, 0x4443)]); + + y2^= sharedMemory[0][__byte_perm(x2, 0, 0x4440)]; + y1^= sharedMemory[1][__byte_perm(x2, 0, 0x4441)]; + y0^= sharedMemory[2][__byte_perm(x2, 0, 0x4442)]; + y3^= __ldg(&d_AES3[__byte_perm(x2, 0, 0x4443)]); + + y3^= sharedMemory[0][__byte_perm(x3, 0, 0x4440)]; + y2^= sharedMemory[1][__byte_perm(x3, 0, 0x4441)]; + y1^= sharedMemory[2][__byte_perm(x3, 0, 0x4442)]; + y0^= __ldg(&d_AES3[__byte_perm(x3, 0, 0x4443)]); +} + +__device__ __forceinline__ +static void aes_round_LDG(const uint32_t sharedMemory[4][256],const uint32_t x0,const uint32_t x1,const uint32_t x2,const uint32_t x3,uint32_t &y0, uint32_t &y1, uint32_t &y2, uint32_t &y3){ + + y0 = sharedMemory[0][__byte_perm(x0, 0, 0x4440)]; + y3 = sharedMemory[1][__byte_perm(x0, 0, 0x4441)]; + y2 = sharedMemory[2][__byte_perm(x0, 0, 0x4442)]; + y1 = __ldg(&d_AES3[__byte_perm(x0, 0, 0x4443)]); + + y1^= __ldg(&d_AES0[__byte_perm(x1, 0, 0x4440)]); + y0^= sharedMemory[1][__byte_perm(x1, 0, 0x4441)]; + y3^= sharedMemory[2][__byte_perm(x1, 0, 0x4442)]; + y2^= __ldg(&d_AES3[__byte_perm(x1, 0, 0x4443)]); + + y2^= sharedMemory[0][__byte_perm(x2, 0, 0x4440)]; + y1^= sharedMemory[1][__byte_perm(x2, 0, 0x4441)]; + y0^= sharedMemory[2][__byte_perm(x2, 0, 0x4442)]; + y3^= __ldg(&d_AES3[__byte_perm(x2, 0, 0x4443)]); + + y3^= sharedMemory[0][__byte_perm(x3, 0, 0x4440)]; + y2^= sharedMemory[1][__byte_perm(x3, 0, 0x4441)]; + y1^= sharedMemory[2][__byte_perm(x3, 0, 0x4442)]; + y0^= __ldg(&d_AES3[__byte_perm(x3, 0, 0x4443)]); +} + +__device__ __forceinline__ +static void AES_2ROUND(const uint32_t sharedMemory[4][256], uint32_t &x0, uint32_t &x1, uint32_t &x2, uint32_t &x3, uint32_t &k0){ + + uint32_t y0, y1, y2, y3; + + aes_round(sharedMemory, x0, x1, x2, x3, k0, y0, y1, y2, y3); + + aes_round(sharedMemory, y0, y1, y2, y3, x0, x1, x2, x3); + + // hier werden wir ein carry brauchen (oder auch nicht) + k0++; +} + +__device__ __forceinline__ +static void AES_2ROUND_LDG(const uint32_t sharedMemory[4][256], uint32_t &x0, uint32_t &x1, uint32_t &x2, uint32_t &x3, uint32_t &k0){ + + uint32_t y0, y1, y2, y3; + + aes_round_LDG(sharedMemory, x0, x1, x2, x3, k0, y0, y1, y2, y3); + + aes_round_LDG(sharedMemory, y0, y1, y2, y3, x0, x1, x2, x3); + + // hier werden wir ein carry brauchen (oder auch nicht) + k0++; +} + +__device__ __forceinline__ +static void AES_ROUND_NOKEY(const uint32_t sharedMemory[4][256],uint4* x){ + + uint32_t y0, y1, y2, y3; + aes_round(sharedMemory, x->x, x->y, x->z, x->w, y0, y1, y2, y3); + + x->x = y0; + x->y = y1; + x->z = y2; + x->w = y3; + +} +__device__ __forceinline__ +static void KEY_EXPAND_ELT(const uint32_t sharedMemory[4][256],uint32_t *k){ + + uint32_t y0, y1, y2, y3; + aes_round(sharedMemory, k[0], k[1], k[2], k[3], y0, y1, y2, y3); + + k[0] = y1; + k[1] = y2; + k[2] = y3; + k[3] = y0; +} diff --git a/x11/cuda_x11_cubehash512.cu b/x11/cuda_x11_cubehash512.cu new file mode 100644 index 0000000..29ce1e4 --- /dev/null +++ b/x11/cuda_x11_cubehash512.cu @@ -0,0 +1,241 @@ +/* + Based on Tanguy Pruvot's repo + Provos Alexis - 2016 +*/ + +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#define SWAP(a,b) { uint32_t u = a; a = b; b = u; } + +//#define SHUFFLE + +#if defined(SHUFFLE) + +#define TPB 1024 + +__device__ __forceinline__ +void rrounds(uint32_t *x){ + #pragma unroll 16 + for (int r = 0; r < 16; ++r) { + /* "add x_0jklm into x_1jklm modulo 2^32 rotate x_0jklm upwards by 7 bits" */ + x[ 8] += x[ 0]; x[ 9] += x[ 1]; + x[10] += x[ 2]; x[11] += x[ 3]; + x[12] += x[ 4]; x[13] += x[ 5]; + x[14] += x[ 6]; x[15] += x[ 7]; + x[ 0] = ROTL32(x[ 0], 7); + x[ 1] = ROTL32(x[ 1], 7); + x[ 2] = ROTL32(x[ 2], 7); + x[ 3] = ROTL32(x[ 3], 7); + x[ 4] = ROTL32(x[ 4], 7); + x[ 5] = ROTL32(x[ 5], 7); + x[ 6] = ROTL32(x[ 6], 7); + x[ 7] = ROTL32(x[ 7], 7); + /* "swap x_00klm with x_01klm" */ + SWAP(x[ 0], x[ 4]); SWAP(x[ 1], x[ 5]); + SWAP(x[ 2], x[ 6]); SWAP(x[ 3], x[ 7]); + + x[ 0] ^= x[ 8]; x[ 4] ^= x[12]; + x[ 1] ^= x[ 9]; x[ 5] ^= x[13]; + x[ 2] ^= x[10]; x[ 6] ^= x[14]; + x[ 3] ^= x[11]; x[ 7] ^= x[15]; + /* "swap x_1jk0m with x_1jk1m" */ + SWAP(x[ 8],x[10]); SWAP(x[ 9],x[11]); + SWAP(x[12],x[14]); SWAP(x[13],x[15]); + /* "add x_0jklm into x_1jklm modulo 2^32 rotate x_0jklm upwards by 11 bits" */ + x[ 8] += x[ 0]; x[ 9] += x[ 1]; + x[10] += x[ 2]; x[11] += x[ 3]; + x[12] += x[ 4]; x[13] += x[ 5]; + x[14] += x[ 6]; x[15] += x[ 7]; + x[ 0] = ROTL32(x[ 0],11); + x[ 1] = ROTL32(x[ 1],11); + x[ 2] = ROTL32(x[ 2],11); + x[ 3] = ROTL32(x[ 3],11); + x[ 4] = ROTL32(x[ 4],11); + x[ 5] = ROTL32(x[ 5],11); + x[ 6] = ROTL32(x[ 6],11); + x[ 7] = ROTL32(x[ 7],11); + /* "swap x_0j0lm with x_0j1lm" */ + x[ 0] = __shfl(x[ 0],threadIdx.x^1); + x[ 1] = __shfl(x[ 1],threadIdx.x^1); + x[ 2] = __shfl(x[ 2],threadIdx.x^1); + x[ 3] = __shfl(x[ 3],threadIdx.x^1); + x[ 4] = __shfl(x[ 4],threadIdx.x^1); + x[ 5] = __shfl(x[ 5],threadIdx.x^1); + x[ 6] = __shfl(x[ 6],threadIdx.x^1); + x[ 7] = __shfl(x[ 7],threadIdx.x^1); + + x[ 0] ^= x[ 8]; x[ 1] ^= x[ 9]; + x[ 2] ^= x[10]; x[ 3] ^= x[11]; + x[ 4] ^= x[12]; x[ 5] ^= x[13]; + x[ 6] ^= x[14]; x[ 7] ^= x[15]; + /* "swap x_1jkl0 with x_1jkl1" */ + SWAP(x[ 8],x[ 9]); SWAP(x[10],x[11]); + SWAP(x[12],x[13]); SWAP(x[14],x[15]); + } +} +__global__ __launch_bounds__(TPB, 1) +void x11_cubehash512_gpu_hash_64(uint32_t threads, uint64_t *g_hash){ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x)>>1; + + const uint32_t even = (threadIdx.x & 1); + + if (thread < threads){ + uint32_t *Hash = (uint32_t*)&g_hash[8 * thread + 2*even]; + + uint32_t x[16]; + + if(even==0){ + x[ 0] = 0x2AEA2A61; x[ 1] = 0x50F494D4; x[ 2] = 0x2D538B8B; x[ 3] = 0x4167D83E; + x[ 4] = 0x4D42C787; x[ 5] = 0xA647A8B3; x[ 6] = 0x97CF0BEF; x[ 7] = 0x825B4537; + x[ 8] = 0xFCD398D9; x[ 9] = 0x148FE485; x[10] = 0x1B017BEF; x[11] = 0xB6444532; + x[12] = 0xD65C8A2B; x[13] = 0xA5A70E75; x[14] = 0xB1C62456; x[15] = 0xBC796576; + }else{ + x[ 0] = 0x3FEE2313; x[ 1] = 0xC701CF8C; x[ 2] = 0xCC39968E; x[ 3] = 0x50AC5695; + x[ 4] = 0xEEF864D2; x[ 5] = 0xF22090C4; x[ 6] = 0xD0E5CD33; x[ 7] = 0xA23911AE; + x[ 8] = 0x6A536159; x[ 9] = 0x2FF5781C; x[10] = 0x91FA7934; x[11] = 0x0DBADEA9; + x[12] = 0x1921C8F7; x[13] = 0xE7989AF1; x[14] = 0x7795D246; x[15] = 0xD43E3B44; + } + *(uint4*)&x[ 0]^= __ldg((uint4*)&Hash[ 0]); + rrounds(x); + + *(uint4*)&x[ 0]^= __ldg((uint4*)&Hash[ 8]); + + rrounds(x); + + if(!even) + x[ 0] ^= 0x80; + + rrounds(x); + /* "the integer 1 is xored into the last state word x_11111" */ + if(even) + x[15] ^= 1; + + #pragma unroll 10 + for (int i = 0; i < 10; ++i) + rrounds(x); + + *(uint4*)&Hash[ 0] = *(uint4*)&x[ 0]; + *(uint4*)&Hash[ 8] = *(uint4*)&x[ 4]; +// g_hash[thread + (2*even+0) * threads] = *(uint2*)&x[ 0]; +// g_hash[thread + (2*even+1) * threads] = *(uint2*)&x[ 2]; + } +} +__host__ +void x11_cubehash512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash){ + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((2*threads + TPB-1)/TPB); + dim3 block(TPB); + + x11_cubehash512_gpu_hash_64<<>>(threads, (uint64_t*)d_hash); + +} + +#else + +#define TPB 768 + +__device__ __forceinline__ +static void rrounds(uint32_t *x){ + #pragma unroll 2 + for (int r = 0; r < 16; r++) { + /* "add x_0jklm into x_1jklmn modulo 2^32 rotate x_0jklm upwards by 7 bits" */ + x[16] = x[16] + x[ 0]; x[ 0] = ROTL32(x[ 0], 7);x[17] = x[17] + x[ 1];x[ 1] = ROTL32(x[ 1], 7); + x[18] = x[18] + x[ 2]; x[ 2] = ROTL32(x[ 2], 7);x[19] = x[19] + x[ 3];x[ 3] = ROTL32(x[ 3], 7); + x[20] = x[20] + x[ 4]; x[ 4] = ROTL32(x[ 4], 7);x[21] = x[21] + x[ 5];x[ 5] = ROTL32(x[ 5], 7); + x[22] = x[22] + x[ 6]; x[ 6] = ROTL32(x[ 6], 7);x[23] = x[23] + x[ 7];x[ 7] = ROTL32(x[ 7], 7); + x[24] = x[24] + x[ 8]; x[ 8] = ROTL32(x[ 8], 7);x[25] = x[25] + x[ 9];x[ 9] = ROTL32(x[ 9], 7); + x[26] = x[26] + x[10]; x[10] = ROTL32(x[10], 7);x[27] = x[27] + x[11];x[11] = ROTL32(x[11], 7); + x[28] = x[28] + x[12]; x[12] = ROTL32(x[12], 7);x[29] = x[29] + x[13];x[13] = ROTL32(x[13], 7); + x[30] = x[30] + x[14]; x[14] = ROTL32(x[14], 7);x[31] = x[31] + x[15];x[15] = ROTL32(x[15], 7); + /* "swap x_00klm with x_01klm" */ + SWAP(x[ 0], x[ 8]);x[ 0] ^= x[16];x[ 8] ^= x[24];SWAP(x[ 1], x[ 9]);x[ 1] ^= x[17];x[ 9] ^= x[25]; + SWAP(x[ 2], x[10]);x[ 2] ^= x[18];x[10] ^= x[26];SWAP(x[ 3], x[11]);x[ 3] ^= x[19];x[11] ^= x[27]; + SWAP(x[ 4], x[12]);x[ 4] ^= x[20];x[12] ^= x[28];SWAP(x[ 5], x[13]);x[ 5] ^= x[21];x[13] ^= x[29]; + SWAP(x[ 6], x[14]);x[ 6] ^= x[22];x[14] ^= x[30];SWAP(x[ 7], x[15]);x[ 7] ^= x[23];x[15] ^= x[31]; + /* "swap x_1jk0m with x_1jk1m" */ + SWAP(x[16], x[18]); SWAP(x[17], x[19]); SWAP(x[20], x[22]); SWAP(x[21], x[23]);SWAP(x[24], x[26]); SWAP(x[25], x[27]); SWAP(x[28], x[30]); SWAP(x[29], x[31]); + /* "add x_0jklm into x_1jklm modulo 2^32 rotate x_0jklm upwards by 11 bits" */ + x[16] = x[16] + x[ 0]; x[ 0] = ROTL32(x[ 0],11);x[17] = x[17] + x[ 1];x[ 1] = ROTL32(x[ 1],11); + x[18] = x[18] + x[ 2]; x[ 2] = ROTL32(x[ 2],11);x[19] = x[19] + x[ 3];x[ 3] = ROTL32(x[ 3],11); + x[20] = x[20] + x[ 4]; x[ 4] = ROTL32(x[ 4],11);x[21] = x[21] + x[ 5];x[ 5] = ROTL32(x[ 5],11); + x[22] = x[22] + x[ 6]; x[ 6] = ROTL32(x[ 6],11);x[23] = x[23] + x[ 7];x[ 7] = ROTL32(x[ 7],11); + x[24] = x[24] + x[ 8]; x[ 8] = ROTL32(x[ 8],11);x[25] = x[25] + x[ 9];x[ 9] = ROTL32(x[ 9],11); + x[26] = x[26] + x[10]; x[10] = ROTL32(x[10],11);x[27] = x[27] + x[11];x[11] = ROTL32(x[11],11); + x[28] = x[28] + x[12]; x[12] = ROTL32(x[12],11);x[29] = x[29] + x[13];x[13] = ROTL32(x[13],11); + x[30] = x[30] + x[14]; x[14] = ROTL32(x[14],11);x[31] = x[31] + x[15];x[15] = ROTL32(x[15],11); + /* "swap x_0j0lm with x_0j1lm" */ + SWAP(x[ 0], x[ 4]); x[ 0] ^= x[16]; x[ 4] ^= x[20]; SWAP(x[ 1], x[ 5]); x[ 1] ^= x[17]; x[ 5] ^= x[21]; + SWAP(x[ 2], x[ 6]); x[ 2] ^= x[18]; x[ 6] ^= x[22]; SWAP(x[ 3], x[ 7]); x[ 3] ^= x[19]; x[ 7] ^= x[23]; + SWAP(x[ 8], x[12]); x[ 8] ^= x[24]; x[12] ^= x[28]; SWAP(x[ 9], x[13]); x[ 9] ^= x[25]; x[13] ^= x[29]; + SWAP(x[10], x[14]); x[10] ^= x[26]; x[14] ^= x[30]; SWAP(x[11], x[15]); x[11] ^= x[27]; x[15] ^= x[31]; + /* "swap x_1jkl0 with x_1jkl1" */ + SWAP(x[16], x[17]); SWAP(x[18], x[19]); SWAP(x[20], x[21]); SWAP(x[22], x[23]);SWAP(x[24], x[25]); SWAP(x[26], x[27]); SWAP(x[28], x[29]); SWAP(x[30], x[31]); + } +} + +/***************************************************/ +// GPU Hash Function +__global__ __launch_bounds__(TPB) +void x11_cubehash512_gpu_hash_64(uint32_t threads, uint64_t *g_hash){ + + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + + uint32_t *Hash = (uint32_t*)&g_hash[8 * thread]; + + uint32_t x[32] = { + 0x2AEA2A61, 0x50F494D4, 0x2D538B8B, 0x4167D83E, + 0x3FEE2313, 0xC701CF8C, 0xCC39968E, 0x50AC5695, + 0x4D42C787, 0xA647A8B3, 0x97CF0BEF, 0x825B4537, + 0xEEF864D2, 0xF22090C4, 0xD0E5CD33, 0xA23911AE, + 0xFCD398D9, 0x148FE485, 0x1B017BEF, 0xB6444532, + 0x6A536159, 0x2FF5781C, 0x91FA7934, 0x0DBADEA9, + 0xD65C8A2B, 0xA5A70E75, 0xB1C62456, 0xBC796576, + 0x1921C8F7, 0xE7989AF1, 0x7795D246, 0xD43E3B44 + }; + + // erste Hälfte des Hashes (32 bytes) + //Update32(x, (const BitSequence*)Hash); + *(uint2x4*)&x[ 0] ^= __ldg4((uint2x4*)&Hash[0]); + + rrounds(x); + + // zweite Hälfte des Hashes (32 bytes) + // Update32(x, (const BitSequence*)(Hash+8)); + *(uint2x4*)&x[ 0] ^= __ldg4((uint2x4*)&Hash[8]); + + rrounds(x); + + // Padding Block + x[ 0] ^= 0x80; + rrounds(x); + + // Final(x, (BitSequence*)Hash); + x[31] ^= 1; + + /* "the state is then transformed invertibly through 10r identical rounds" */ + #pragma unroll 10 + for (int i = 0;i < 10;++i) + rrounds(x); + + /* "output the first h/8 bytes of the state" */ + *(uint2x4*)&Hash[ 0] = *(uint2x4*)&x[ 0]; + *(uint2x4*)&Hash[ 8] = *(uint2x4*)&x[ 8]; + } +} + + +__host__ +void x11_cubehash512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash){ + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + TPB-1)/TPB); + dim3 block(TPB); + + x11_cubehash512_gpu_hash_64<<>>(threads, (uint64_t*)d_hash); + +} +#endif diff --git a/x11/cuda_x11_cubehash_shavite_512.cu b/x11/cuda_x11_cubehash_shavite_512.cu new file mode 100644 index 0000000..1cf4339 --- /dev/null +++ b/x11/cuda_x11_cubehash_shavite_512.cu @@ -0,0 +1,515 @@ +/* + * Merged cubehash and Shavite kernels in order to further decrease shared memory bottleneck + * Built/tested under CUDA7.5 for compute 5.0/5.2 + * Provos Alexis - 2016 + */ + +#include "cuda_helper.h" +#include "cuda_vectors.h" +#include "cuda_x11_aes.cuh" + +#define TPB 128 + +//--SHAVITE-------------------------------------------- +__device__ +static void round_3_7_11(const uint32_t sharedMemory[4][256], uint32_t* r, uint4 *p, uint4 &x){ + KEY_EXPAND_ELT(sharedMemory, &r[ 0]); + *(uint4*)&r[ 0] ^= *(uint4*)&r[28]; + x = p[ 2] ^ *(uint4*)&r[ 0]; + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + r[4] ^= r[0]; + r[5] ^= r[1]; + r[6] ^= r[2]; + r[7] ^= r[3]; + AES_ROUND_NOKEY(sharedMemory, &x); + x = x ^ *(uint4*)&r[4]; + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + r[8] ^= r[4]; + r[9] ^= r[5]; + r[10]^= r[6]; + r[11]^= r[7]; + AES_ROUND_NOKEY(sharedMemory, &x); + x.x ^= r[8]; + x.y ^= r[9]; + x.z ^= r[10]; + x.w ^= r[11]; + KEY_EXPAND_ELT(sharedMemory, &r[12]); + r[12] ^= r[8]; + r[13] ^= r[9]; + r[14]^= r[10]; + r[15]^= r[11]; + AES_ROUND_NOKEY(sharedMemory, &x); + x.x ^= r[12]; + x.y ^= r[13]; + x.z ^= r[14]; + x.w ^= r[15]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 1].x ^= x.x; + p[ 1].y ^= x.y; + p[ 1].z ^= x.z; + p[ 1].w ^= x.w; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + x = p[ 0] ^ *(uint4*)&r[16]; + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[20]; + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24] ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[24]; + KEY_EXPAND_ELT(sharedMemory,&r[28]); + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 3] ^= x; +} + +__device__ +static void round_4_8_12(const uint32_t sharedMemory[4][256], uint32_t* r, uint4 *p, uint4 &x){ + *(uint4*)&r[ 0] ^= *(uint4*)&r[25]; + x = p[ 1] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + + r[ 4] ^= r[29]; r[ 5] ^= r[30]; + r[ 6] ^= r[31]; r[ 7] ^= r[ 0]; + + x ^= *(uint4*)&r[ 4]; + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 1]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[ 8]; + *(uint4*)&r[12] ^= *(uint4*)&r[ 5]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 0] ^= x; + *(uint4*)&r[16] ^= *(uint4*)&r[ 9]; + x = p[ 3] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[20] ^= *(uint4*)&r[13]; + x ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[24] ^= *(uint4*)&r[17]; + x ^= *(uint4*)&r[24]; + *(uint4*)&r[28] ^= *(uint4*)&r[21]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 2] ^= x; +} + +//--END OF SHAVITE MACROS------------------------------------ + +//--CUBEHASH512 MACROS---------------------------------- + +#define SWAP(a,b) { uint32_t u = a; a = b; b = u; } + +__device__ +unsigned int rotate(const unsigned int val, const unsigned int shift) +{ + unsigned int ret; + asm ("shf.l.wrap.b32 %0, %1, %2, %3;" : "=r"(ret) : "r"(val), "r"(val), "r"(shift)); + return ret; +} + +__device__ +static void rrounds(uint32_t *x){ + #pragma unroll 1 + for (uint32_t r = 0; r < 16; r++) { + /* "add x_0jklm into x_1jklmn modulo 2^32 rotate x_0jklm upwards by 7 bits" */ + x[16] = x[16] + x[ 0]; x[ 0] = rotate(x[ 0], 7);x[17] = x[17] + x[ 1];x[ 1] = rotate(x[ 1], 7); + x[18] = x[18] + x[ 2]; x[ 2] = rotate(x[ 2], 7);x[19] = x[19] + x[ 3];x[ 3] = rotate(x[ 3], 7); + x[20] = x[20] + x[ 4]; x[ 4] = rotate(x[ 4], 7);x[21] = x[21] + x[ 5];x[ 5] = rotate(x[ 5], 7); + x[22] = x[22] + x[ 6]; x[ 6] = rotate(x[ 6], 7);x[23] = x[23] + x[ 7];x[ 7] = rotate(x[ 7], 7); + x[24] = x[24] + x[ 8]; x[ 8] = rotate(x[ 8], 7);x[25] = x[25] + x[ 9];x[ 9] = rotate(x[ 9], 7); + x[26] = x[26] + x[10]; x[10] = rotate(x[10], 7);x[27] = x[27] + x[11];x[11] = rotate(x[11], 7); + x[28] = x[28] + x[12]; x[12] = rotate(x[12], 7);x[29] = x[29] + x[13];x[13] = rotate(x[13], 7); + x[30] = x[30] + x[14]; x[14] = rotate(x[14], 7);x[31] = x[31] + x[15];x[15] = rotate(x[15], 7); + /* "swap x_00klm with x_01klm" */ + SWAP(x[ 0], x[ 8]);x[ 0] ^= x[16];x[ 8] ^= x[24];SWAP(x[ 1], x[ 9]);x[ 1] ^= x[17];x[ 9] ^= x[25]; + SWAP(x[ 2], x[10]);x[ 2] ^= x[18];x[10] ^= x[26];SWAP(x[ 3], x[11]);x[ 3] ^= x[19];x[11] ^= x[27]; + SWAP(x[ 4], x[12]);x[ 4] ^= x[20];x[12] ^= x[28];SWAP(x[ 5], x[13]);x[ 5] ^= x[21];x[13] ^= x[29]; + SWAP(x[ 6], x[14]);x[ 6] ^= x[22];x[14] ^= x[30];SWAP(x[ 7], x[15]);x[ 7] ^= x[23];x[15] ^= x[31]; + /* "swap x_1jk0m with x_1jk1m" */ + SWAP(x[16], x[18]); SWAP(x[17], x[19]); SWAP(x[20], x[22]); SWAP(x[21], x[23]);SWAP(x[24], x[26]); SWAP(x[25], x[27]); SWAP(x[28], x[30]); SWAP(x[29], x[31]); + /* "add x_0jklm into x_1jklm modulo 2^32 rotate x_0jklm upwards by 11 bits" */ + x[16] = x[16] + x[ 0]; x[ 0] = rotate(x[ 0],11);x[17] = x[17] + x[ 1];x[ 1] = rotate(x[ 1],11); + x[18] = x[18] + x[ 2]; x[ 2] = rotate(x[ 2],11);x[19] = x[19] + x[ 3];x[ 3] = rotate(x[ 3],11); + x[20] = x[20] + x[ 4]; x[ 4] = rotate(x[ 4],11);x[21] = x[21] + x[ 5];x[ 5] = rotate(x[ 5],11); + x[22] = x[22] + x[ 6]; x[ 6] = rotate(x[ 6],11);x[23] = x[23] + x[ 7];x[ 7] = rotate(x[ 7],11); + x[24] = x[24] + x[ 8]; x[ 8] = rotate(x[ 8],11);x[25] = x[25] + x[ 9];x[ 9] = rotate(x[ 9],11); + x[26] = x[26] + x[10]; x[10] = rotate(x[10],11);x[27] = x[27] + x[11];x[11] = rotate(x[11],11); + x[28] = x[28] + x[12]; x[12] = rotate(x[12],11);x[29] = x[29] + x[13];x[13] = rotate(x[13],11); + x[30] = x[30] + x[14]; x[14] = rotate(x[14],11);x[31] = x[31] + x[15];x[15] = rotate(x[15],11); + /* "swap x_0j0lm with x_0j1lm" */ + SWAP(x[ 0], x[ 4]); x[ 0] ^= x[16]; x[ 4] ^= x[20]; SWAP(x[ 1], x[ 5]); x[ 1] ^= x[17]; x[ 5] ^= x[21]; + SWAP(x[ 2], x[ 6]); x[ 2] ^= x[18]; x[ 6] ^= x[22]; SWAP(x[ 3], x[ 7]); x[ 3] ^= x[19]; x[ 7] ^= x[23]; + SWAP(x[ 8], x[12]); x[ 8] ^= x[24]; x[12] ^= x[28]; SWAP(x[ 9], x[13]); x[ 9] ^= x[25]; x[13] ^= x[29]; + SWAP(x[10], x[14]); x[10] ^= x[26]; x[14] ^= x[30]; SWAP(x[11], x[15]); x[11] ^= x[27]; x[15] ^= x[31]; + /* "swap x_1jkl0 with x_1jkl1" */ + SWAP(x[16], x[17]); SWAP(x[18], x[19]); SWAP(x[20], x[21]); SWAP(x[22], x[23]);SWAP(x[24], x[25]); SWAP(x[26], x[27]); SWAP(x[28], x[29]); SWAP(x[30], x[31]); + } +} + +//--END OF CUBEHASH512 MACROS---------------------------------- + +__global__ +__launch_bounds__(TPB,3) +void x11_cubehashShavite512_gpu_hash_64(uint32_t threads, uint32_t *g_hash){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + __shared__ uint32_t sharedMemory[4][256]; + + aes_gpu_init128(sharedMemory); + __syncthreads(); +// if (thread < threads) +// { + uint32_t *const hash = &g_hash[thread * 16U]; + + //Cubehash + + uint32_t x[32] = { + 0x2AEA2A61, 0x50F494D4, 0x2D538B8B, 0x4167D83E, 0x3FEE2313, 0xC701CF8C, 0xCC39968E, 0x50AC5695, + 0x4D42C787, 0xA647A8B3, 0x97CF0BEF, 0x825B4537, 0xEEF864D2, 0xF22090C4, 0xD0E5CD33, 0xA23911AE, + 0xFCD398D9, 0x148FE485, 0x1B017BEF, 0xB6444532, 0x6A536159, 0x2FF5781C, 0x91FA7934, 0x0DBADEA9, + 0xD65C8A2B, 0xA5A70E75, 0xB1C62456, 0xBC796576, 0x1921C8F7, 0xE7989AF1, 0x7795D246, 0xD43E3B44 + }; + uint32_t Hash[16]; + *(uint2x4*)&Hash[0] = __ldg4((uint2x4*)&hash[0]); + *(uint2x4*)&Hash[8] = __ldg4((uint2x4*)&hash[8]); + + *(uint2x4*)&x[ 0] ^= *(uint2x4*)&Hash[0]; + + rrounds(x); + + *(uint2x4*)&x[ 0] ^= *(uint2x4*)&Hash[8]; + + rrounds(x); + x[0] ^= 0x80; + + rrounds(x); + x[31] ^= 1; + +// #pragma unroll 10 + for (int i = 0;i < 9;++i) + rrounds(x); + + + rrounds(x); + + uint4 y; + uint32_t r[32]; + uint4 msg[ 4]; + // kopiere init-state + uint4 p[ 4]; + const uint32_t state[16] = { + 0x72FCCDD8, 0x79CA4727, 0x128A077B, 0x40D55AEC, 0xD1901A06, 0x430AE307, 0xB29F5CD1, 0xDF07FBFC, + 0x8E45D73D, 0x681AB538, 0xBDE86578, 0xDD577E47, 0xE275EADE, 0x502D9FCD, 0xB9357178, 0x022A4B9A + }; + *(uint2x4*)&p[ 0] = *(uint2x4*)&state[ 0]; + *(uint2x4*)&p[ 2] = *(uint2x4*)&state[ 8]; + + #pragma unroll 4 + for(int i=0;i<4;i++){ + *(uint4*)&msg[ i] = *(uint4*)&x[i<<2]; + *(uint4*)&r[i<<2] = *(uint4*)&x[i<<2]; + } + r[16] = 0x80; r[17] = 0; r[18] = 0; r[19] = 0; + r[20] = 0; r[21] = 0; r[22] = 0; r[23] = 0; + r[24] = 0; r[25] = 0; r[26] = 0; r[27] = 0x02000000; + r[28] = 0; r[29] = 0; r[30] = 0; r[31] = 0x02000000; + y = p[ 1] ^ msg[ 0]; + AES_ROUND_NOKEY(sharedMemory, &y); + y ^= msg[ 1]; + AES_ROUND_NOKEY(sharedMemory, &y); + y ^= msg[ 2]; + AES_ROUND_NOKEY(sharedMemory, &y); + y ^= msg[ 3]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 0] ^= y; + y = p[ 3]; + y.x ^= 0x80; + AES_ROUND_NOKEY(sharedMemory, &y); + AES_ROUND_NOKEY(sharedMemory, &y); + y.w ^= 0x02000000; + AES_ROUND_NOKEY(sharedMemory, &y); + y.w ^= 0x02000000; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 2]^= y; + + // 1 + KEY_EXPAND_ELT(sharedMemory, &r[ 0]); + *(uint4*)&r[ 0]^=*(uint4*)&r[28]; + r[ 0] ^= 0x200; + r[ 3] ^= 0xFFFFFFFF; + y = p[ 0] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + *(uint4*)&r[ 4] ^= *(uint4*)&r[ 0]; + y ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 4]; + y ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[12]); + *(uint4*)&r[12] ^= *(uint4*)&r[ 8]; + y ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 3] ^= y; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + y = p[ 2] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + y ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24] ^= *(uint4*)&r[20]; + y ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[28]); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + y ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 1] ^= y; + *(uint4*)&r[ 0] ^= *(uint4*)&r[25]; + y = p[ 3] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &y); + + r[ 4] ^= r[29]; r[ 5] ^= r[30]; + r[ 6] ^= r[31]; r[ 7] ^= r[ 0]; + + y ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 1]; + y ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[12] ^= *(uint4*)&r[ 5]; + y ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 2] ^= y; + *(uint4*)&r[16] ^= *(uint4*)&r[ 9]; + y = p[ 1] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[20] ^= *(uint4*)&r[13]; + y ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[24] ^= *(uint4*)&r[17]; + y ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[28] ^= *(uint4*)&r[21]; + y ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &y); + + p[ 0] ^= y; + + /* round 3, 7, 11 */ + round_3_7_11(sharedMemory,r,p,y); + + + /* round 4, 8, 12 */ + round_4_8_12(sharedMemory,r,p,y); + + // 2 + KEY_EXPAND_ELT(sharedMemory,&r[ 0]); + *(uint4*)&r[ 0] ^= *(uint4*)&r[28]; + y = p[ 0] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + *(uint4*)&r[ 4] ^= *(uint4*)&r[ 0]; + r[ 7] ^= (~0x200); + y ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 4]; + y ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[12]); + *(uint4*)&r[12] ^= *(uint4*)&r[ 8]; + y ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 3] ^= y; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + y = p[ 2] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + y ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24] ^= *(uint4*)&r[20]; + y ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory,&r[28]); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + y ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 1] ^= y; + + *(uint4*)&r[ 0] ^= *(uint4*)&r[25]; + y = p[ 3] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &y); + r[ 4] ^= r[29]; + r[ 5] ^= r[30]; + r[ 6] ^= r[31]; + r[ 7] ^= r[ 0]; + y ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 1]; + y ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[12] ^= *(uint4*)&r[ 5]; + y ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 2] ^= y; + *(uint4*)&r[16] ^= *(uint4*)&r[ 9]; + y = p[ 1] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[20] ^= *(uint4*)&r[13]; + y ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[24] ^= *(uint4*)&r[17]; + y ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[28] ^= *(uint4*)&r[21]; + y ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 0] ^= y; + + /* round 3, 7, 11 */ + round_3_7_11(sharedMemory,r,p,y); + + /* round 4, 8, 12 */ + round_4_8_12(sharedMemory,r,p,y); + + // 3 + KEY_EXPAND_ELT(sharedMemory,&r[ 0]); + *(uint4*)&r[ 0] ^= *(uint4*)&r[28]; + y = p[ 0] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + *(uint4*)&r[ 4] ^= *(uint4*)&r[ 0]; + y ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 4]; + y ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[12]); + *(uint4*)&r[12] ^= *(uint4*)&r[ 8]; + y ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 3] ^= y; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + y = p[ 2] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + y^=*(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24]^=*(uint4*)&r[20]; + y ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory,&r[28]); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + r[30] ^= 0x200; + r[31] ^= 0xFFFFFFFF; + y ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 1] ^= y; + + *(uint4*)&r[ 0] ^= *(uint4*)&r[25]; + y = p[ 3] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &y); + r[ 4] ^= r[29]; + r[ 5] ^= r[30]; + r[ 6] ^= r[31]; + r[ 7] ^= r[ 0]; + y ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 1]; + y ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[12] ^= *(uint4*)&r[ 5]; + y ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 2] ^= y; + *(uint4*)&r[16] ^= *(uint4*)&r[ 9]; + y = p[ 1] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[20] ^= *(uint4*)&r[13]; + y ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[24] ^= *(uint4*)&r[17]; + y ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &y); + *(uint4*)&r[28] ^= *(uint4*)&r[21]; + y ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 0] ^= y; + + /* round 3, 7, 11 */ + round_3_7_11(sharedMemory,r,p,y); + + /* round 4, 8, 12 */ + round_4_8_12(sharedMemory,r,p,y); + + /* round 13 */ + KEY_EXPAND_ELT(sharedMemory,&r[ 0]); + *(uint4*)&r[ 0] ^= *(uint4*)&r[28]; + y = p[ 0] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + *(uint4*)&r[ 4] ^= *(uint4*)&r[ 0]; + y ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 4]; + y ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[12]); + *(uint4*)&r[12] ^= *(uint4*)&r[ 8]; + y ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 3] ^= y; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + y = p[ 2] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + y ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24] ^= *(uint4*)&r[20]; + r[25] ^= 0x200; + r[27] ^= 0xFFFFFFFF; + y ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &y); + KEY_EXPAND_ELT(sharedMemory,&r[28]); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + y ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &y); + p[ 1] ^= y; + + *(uint2x4*)&hash[ 0] = *(uint2x4*)&state[ 0] ^ *(uint2x4*)&p[ 2]; + *(uint2x4*)&hash[ 8] = *(uint2x4*)&state[ 8] ^ *(uint2x4*)&p[ 0]; +// } +} + +__host__ +void x11_cubehash_shavite512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash){ + + dim3 grid((threads + TPB-1)/TPB); + dim3 block(TPB); + + x11_cubehashShavite512_gpu_hash_64 <<>> (threads, d_hash); +} diff --git a/x11/cuda_x11_echo.cu b/x11/cuda_x11_echo.cu new file mode 100644 index 0000000..2c0229e --- /dev/null +++ b/x11/cuda_x11_echo.cu @@ -0,0 +1,449 @@ +/* + Based on Tanguy Pruvot's repo + Provos Alexis - 2016 +*/ + +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#define INTENSIVE_GMF +#include "cuda_x11_aes.cuh" + +__device__ +static void echo_round(const uint32_t sharedMemory[4][256], uint32_t *W, uint32_t &k0){ + // Big Sub Words + #pragma unroll 16 + for (int idx = 0; idx < 16; idx++) + AES_2ROUND(sharedMemory,W[(idx<<2) + 0], W[(idx<<2) + 1], W[(idx<<2) + 2], W[(idx<<2) + 3], k0); + + // Shift Rows + #pragma unroll 4 + for (int i = 0; i < 4; i++){ + uint32_t t[4]; + /// 1, 5, 9, 13 + t[0] = W[i+ 4]; + t[1] = W[i+ 8]; + t[2] = W[i+24]; + t[3] = W[i+60]; + W[i + 4] = W[i + 20]; + W[i + 8] = W[i + 40]; + W[i +24] = W[i + 56]; + W[i +60] = W[i + 44]; + + W[i +20] = W[i +36]; + W[i +40] = t[1]; + W[i +56] = t[2]; + W[i +44] = W[i +28]; + + W[i +28] = W[i +12]; + W[i +12] = t[3]; + W[i +36] = W[i +52]; + W[i +52] = t[0]; + } + // Mix Columns + #pragma unroll 4 + for (int i = 0; i < 4; i++){ // Schleife über je 2*uint32_t + #pragma unroll 4 + for (int idx = 0; idx < 64; idx += 16){ // Schleife über die elemnte + uint32_t a[4]; + a[0] = W[idx + i]; + a[1] = W[idx + i + 4]; + a[2] = W[idx + i + 8]; + a[3] = W[idx + i +12]; + + uint32_t ab = a[0] ^ a[1]; + uint32_t bc = a[1] ^ a[2]; + uint32_t cd = a[2] ^ a[3]; + + uint32_t t, t2, t3; + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + uint32_t abx = (t >> 7) * 27U ^ ((ab^t) << 1); + uint32_t bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + uint32_t cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[idx + i] = bc ^ a[3] ^ abx; + W[idx + i + 4] = a[0] ^ cd ^ bcx; + W[idx + i + 8] = ab ^ a[3] ^ cdx; + W[idx + i +12] = ab ^ a[2] ^ (abx ^ bcx ^ cdx); + } + } +} + +__global__ __launch_bounds__(256, 3) /* will force 80 registers */ +static void x11_echo512_gpu_hash_64_final(uint32_t threads, uint64_t *g_hash,uint32_t* resNonce, const uint64_t target){ + __shared__ uint32_t sharedMemory[4][256]; + + aes_gpu_init256(sharedMemory); + + const uint32_t P[48] = { + 0xe7e9f5f5, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0xa4213d7e, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + //8-12 + 0x01425eb8, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0x65978b09, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + //21-25 + 0x2cb6b661, 0x6b23b3b3, 0xcf93a7cf, 0x9d9d3751,0x9ac2dea3, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + //34-38 + 0x579f9f33, 0xfbfbfbfb, 0xfbfbfbfb, 0xefefd3c7,0xdbfde1dd, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x34514d9e, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0xb134347e, 0xea6f7e7e, 0xbd7731bd, 0x8a8a1968, + 0x14b8a457, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0x265f4382, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af + //58-61 + }; + uint32_t k0; + uint32_t h[16]; + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + + const uint32_t *hash = (uint32_t*)&g_hash[thread<<3]; + + *(uint2x4*)&h[ 0] = __ldg4((uint2x4*)&hash[ 0]); + *(uint2x4*)&h[ 8] = __ldg4((uint2x4*)&hash[ 8]); + + uint64_t backup = *(uint64_t*)&h[ 6]; + + k0 = 512 + 8; + + #pragma unroll 4 + for (uint32_t idx = 0; idx < 16; idx += 4) + AES_2ROUND(sharedMemory,h[idx + 0], h[idx + 1], h[idx + 2], h[idx + 3], k0); + + k0 += 4; + + uint32_t W[64]; + + #pragma unroll 4 + for (uint32_t i = 0; i < 4; i++){ + uint32_t a = P[i]; + uint32_t b = P[i + 4]; + uint32_t c = h[i + 8]; + uint32_t d = P[i + 8]; + + uint32_t ab = a ^ b; + uint32_t bc = b ^ c; + uint32_t cd = c ^ d; + + + uint32_t t = ((a ^ b) & 0x80808080); + uint32_t t2 = ((b ^ c) & 0x80808080); + uint32_t t3 = ((c ^ d) & 0x80808080); + + uint32_t abx = ((t >> 7) * 27U) ^ ((ab^t) << 1); + uint32_t bcx = ((t2 >> 7) * 27U) ^ ((bc^t2) << 1); + uint32_t cdx = ((t3 >> 7) * 27U) ^ ((cd^t3) << 1); + + W[0 + i] = bc ^ d ^ abx; + W[4 + i] = a ^ cd ^ bcx; + W[8 + i] = ab ^ d ^ cdx; + W[12+ i] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = P[12 + i]; + b = h[i + 4]; + c = P[12 + i + 4]; + d = P[12 + i + 8]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[16 + i] = abx ^ bc ^ d; + W[16 + i + 4] = bcx ^ a ^ cd; + W[16 + i + 8] = cdx ^ ab ^ d; + W[16 + i +12] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = h[i]; + b = P[24 + i]; + c = P[24 + i + 4]; + d = P[24 + i + 8]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[32 + i] = abx ^ bc ^ d; + W[32 + i + 4] = bcx ^ a ^ cd; + W[32 + i + 8] = cdx ^ ab ^ d; + W[32 + i +12] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = P[36 + i ]; + b = P[36 + i + 4]; + c = P[36 + i + 8]; + d = h[i + 12]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[48 + i] = abx ^ bc ^ d; + W[48 + i + 4] = bcx ^ a ^ cd; + W[48 + i + 8] = cdx ^ ab ^ d; + W[48 + i +12] = abx ^ bcx ^ cdx ^ ab ^ c; + } + + for (int k = 1; k < 9; k++) + echo_round(sharedMemory,W,k0); + // Big Sub Words + uint32_t y0, y1, y2, y3; +// AES_2ROUND(sharedMemory,W[ 0], W[ 1], W[ 2], W[ 3], k0); + aes_round(sharedMemory, W[ 0], W[ 1], W[ 2], W[ 3], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[ 0], W[ 1], W[ 2], W[ 3]); +// AES_2ROUND(sharedMemory,W[ 4], W[ 5], W[ 6], W[ 7], k0); + aes_round(sharedMemory, W[ 4], W[ 5], W[ 6], W[ 7], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[ 4], W[ 5], W[ 6], W[ 7]); +// AES_2ROUND(sharedMemory,W[ 8], W[ 9], W[10], W[11], k0); + aes_round(sharedMemory, W[ 8], W[ 9], W[10], W[11], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[ 8], W[ 9], W[10], W[11]); + +// AES_2ROUND(sharedMemory,W[20], W[21], W[22], W[23], k0); + aes_round(sharedMemory, W[20], W[21], W[22], W[23], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[20], W[21], W[22], W[23]); +// AES_2ROUND(sharedMemory,W[28], W[29], W[30], W[31], k0); + aes_round(sharedMemory, W[28], W[29], W[30], W[31], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[28], W[29], W[30], W[31]); + +// AES_2ROUND(sharedMemory,W[32], W[33], W[34], W[35], k0); + aes_round(sharedMemory, W[32], W[33], W[34], W[35], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[32], W[33], W[34], W[35]); +// AES_2ROUND(sharedMemory,W[40], W[41], W[42], W[43], k0); + aes_round(sharedMemory, W[40], W[41], W[42], W[43], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[40], W[41], W[42], W[43]); + + aes_round(sharedMemory, W[52], W[53], W[54], W[55], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[52], W[53], W[54], W[55]); +// AES_2ROUND(sharedMemory,W[60], W[61], W[62], W[63], k0); + aes_round(sharedMemory, W[60], W[61], W[62], W[63], k0, y0, y1, y2, y3); + aes_round(sharedMemory, y0, y1, y2, y3, W[60], W[61], W[62], W[63]); + + uint32_t bc = W[22] ^ W[42]; + uint32_t t2 = (bc & 0x80808080); + W[ 6] = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + + bc = W[23] ^ W[43]; + t2 = (bc & 0x80808080); + W[ 7] = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + + bc = W[10] ^ W[54]; + t2 = (bc & 0x80808080); + W[38] = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + + bc = W[11] ^ W[55]; + t2 = (bc & 0x80808080); + W[39] = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + + uint64_t check = backup ^ *(uint64_t*)&W[2] ^ *(uint64_t*)&W[6] ^ *(uint64_t*)&W[10] ^ *(uint64_t*)&W[30] ^ *(uint64_t*)&W[34] ^ *(uint64_t*)&W[38] ^ *(uint64_t*)&W[42] ^ *(uint64_t*)&W[62]; + if(check <= target){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } +} + +__host__ +void x11_echo512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target) +{ + const uint32_t threadsperblock = 256; + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x11_echo512_gpu_hash_64_final<<>>(threads, (uint64_t*)d_hash,d_resNonce,target); +} + +__global__ __launch_bounds__(128, 5) /* will force 80 registers */ +static void x11_echo512_gpu_hash_64(uint32_t threads, uint32_t *g_hash) +{ + __shared__ uint32_t sharedMemory[4][256]; + + aes_gpu_init128(sharedMemory); + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + uint32_t k0; + uint32_t h[16]; + uint32_t hash[16]; + if (thread < threads){ + + uint32_t *Hash = &g_hash[thread<<4]; + + *(uint2x4*)&h[ 0] = __ldg4((uint2x4*)&Hash[ 0]); + *(uint2x4*)&h[ 8] = __ldg4((uint2x4*)&Hash[ 8]); + + *(uint2x4*)&hash[ 0] = *(uint2x4*)&h[ 0]; + *(uint2x4*)&hash[ 8] = *(uint2x4*)&h[ 8]; + + __syncthreads(); + + const uint32_t P[48] = { + 0xe7e9f5f5, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, 0xa4213d7e, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + //8-12 + 0x01425eb8, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, 0x65978b09, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + //21-25 + 0x2cb6b661, 0x6b23b3b3, 0xcf93a7cf, 0x9d9d3751, 0x9ac2dea3, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + //34-38 + 0x579f9f33, 0xfbfbfbfb, 0xfbfbfbfb, 0xefefd3c7, 0xdbfde1dd, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x34514d9e, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, 0xb134347e, 0xea6f7e7e, 0xbd7731bd, 0x8a8a1968, + 0x14b8a457, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, 0x265f4382, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af + //58-61 + }; + + k0 = 520; + + #pragma unroll 4 + for (uint32_t idx = 0; idx < 16; idx += 4) + { + AES_2ROUND(sharedMemory, h[idx + 0], h[idx + 1], h[idx + 2], h[idx + 3], k0); + } + k0 += 4; + + uint32_t W[64]; + + #pragma unroll 4 + for (uint32_t i = 0; i < 4; i++) + { + uint32_t a = P[i]; + uint32_t b = P[i + 4]; + uint32_t c = h[i + 8]; + uint32_t d = P[i + 8]; + + uint32_t ab = a ^ b; + uint32_t bc = b ^ c; + uint32_t cd = c ^ d; + + + uint32_t t = (ab & 0x80808080); + uint32_t t2 = (bc & 0x80808080); + uint32_t t3 = (cd & 0x80808080); + + uint32_t abx = (t >> 7) * 27U ^ ((ab^t) << 1); + uint32_t bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + uint32_t cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[i] = abx ^ bc ^ d; + W[i + 4] = bcx ^ a ^ cd; + W[i + 8] = cdx ^ ab ^ d; + W[i +12] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = P[i +12]; + b = h[i + 4]; + c = P[i +16]; + d = P[i +20]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[16 + i] = bc ^ d ^ abx; + W[16 + i + 4] = a ^ cd ^ bcx; + W[16 + i + 8] = d ^ ab ^ cdx; + W[16 + i + 12] = c ^ ab ^ abx ^ bcx ^ cdx; + + a = h[i]; + b = P[24 + i + 0]; + c = P[24 + i + 4]; + d = P[24 + i + 8]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[32 + i] = bc ^ d ^ abx; + W[32 + i + 4] = a ^ cd ^ bcx; + W[32 + i + 8] = d ^ ab ^ cdx; + W[32 + i + 12] = c ^ ab ^ abx ^ bcx ^ cdx; + + a = P[36 + i ]; + b = P[36 + i + 4]; + c = P[36 + i + 8]; + d = h[i + 12]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[48 + i] = bc ^ d ^ abx; + W[48 + i + 4] = a ^ cd ^ bcx; + W[48 + i + 8] = d ^ ab ^ cdx; + W[48 + i + 12] = c ^ ab ^ abx ^ bcx ^ cdx; + + } + + for (int k = 1; k < 10; k++) + echo_round(sharedMemory,W,k0); + + #pragma unroll 4 + for (int i = 0; i < 16; i += 4) + { + W[i] ^= W[32 + i] ^ 512; + W[i + 1] ^= W[32 + i + 1]; + W[i + 2] ^= W[32 + i + 2]; + W[i + 3] ^= W[32 + i + 3]; + } + *(uint2x4*)&Hash[ 0] = *(uint2x4*)&hash[ 0] ^ *(uint2x4*)&W[ 0]; + *(uint2x4*)&Hash[ 8] = *(uint2x4*)&hash[ 8] ^ *(uint2x4*)&W[ 8]; + } +} + +__host__ +void x11_echo512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash){ + + const uint32_t threadsperblock = 128; + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x11_echo512_gpu_hash_64<<>>(threads, d_hash); +} diff --git a/x11/cuda_x11_shavite512.cu b/x11/cuda_x11_shavite512.cu new file mode 100644 index 0000000..37dfb47 --- /dev/null +++ b/x11/cuda_x11_shavite512.cu @@ -0,0 +1,436 @@ +/* + Based on Tanguy Pruvot's repo + Provos Alexis - 2016 +*/ +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#define INTENSIVE_GMF +#include "cuda_x11_aes.cuh" + +#define TPB 384 + + +__device__ __forceinline__ +static void round_3_7_11(const uint32_t sharedMemory[4][256], uint32_t* r, uint4 *p, uint4 &x){ + KEY_EXPAND_ELT(sharedMemory, &r[ 0]); + *(uint4*)&r[ 0] ^= *(uint4*)&r[28]; + x = p[ 2] ^ *(uint4*)&r[ 0]; + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + r[4] ^= r[0]; + r[5] ^= r[1]; + r[6] ^= r[2]; + r[7] ^= r[3]; + AES_ROUND_NOKEY(sharedMemory, &x); + x.x ^= r[4]; + x.y ^= r[5]; + x.z ^= r[6]; + x.w ^= r[7]; + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + r[8] ^= r[4]; + r[9] ^= r[5]; + r[10]^= r[6]; + r[11]^= r[7]; + AES_ROUND_NOKEY(sharedMemory, &x); + x.x ^= r[8]; + x.y ^= r[9]; + x.z ^= r[10]; + x.w ^= r[11]; + KEY_EXPAND_ELT(sharedMemory, &r[12]); + r[12] ^= r[8]; + r[13] ^= r[9]; + r[14]^= r[10]; + r[15]^= r[11]; + AES_ROUND_NOKEY(sharedMemory, &x); + x.x ^= r[12]; + x.y ^= r[13]; + x.z ^= r[14]; + x.w ^= r[15]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 1].x ^= x.x; + p[ 1].y ^= x.y; + p[ 1].z ^= x.z; + p[ 1].w ^= x.w; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + x = p[ 0] ^ *(uint4*)&r[16]; + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[20]; + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24] ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[24]; + KEY_EXPAND_ELT(sharedMemory,&r[28]); + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 3] ^= x; +} + +__device__ __forceinline__ +static void round_4_8_12(const uint32_t sharedMemory[4][256], uint32_t* r, uint4 *p, uint4 &x){ + *(uint4*)&r[ 0] ^= *(uint4*)&r[25]; + x = p[ 1] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + + r[ 4] ^= r[29]; r[ 5] ^= r[30]; + r[ 6] ^= r[31]; r[ 7] ^= r[ 0]; + + x ^= *(uint4*)&r[ 4]; + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 1]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[ 8]; + *(uint4*)&r[12] ^= *(uint4*)&r[ 5]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 0] ^= x; + *(uint4*)&r[16] ^= *(uint4*)&r[ 9]; + x = p[ 3] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[20] ^= *(uint4*)&r[13]; + x ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[24] ^= *(uint4*)&r[17]; + x ^= *(uint4*)&r[24]; + *(uint4*)&r[28] ^= *(uint4*)&r[21]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 2] ^= x; +} + +// GPU Hash +__global__ __launch_bounds__(TPB,2) /* 64 registers with 128,8 - 72 regs with 128,7 */ +void x11_shavite512_gpu_hash_64(const uint32_t threads, uint64_t *g_hash) +{ + __shared__ uint32_t sharedMemory[4][256]; + + aes_gpu_init_mt_256(sharedMemory); + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint4 p[ 4]; + uint4 x; + uint32_t r[32]; + + // kopiere init-state + const uint32_t state[16] = { + 0x72FCCDD8, 0x79CA4727, 0x128A077B, 0x40D55AEC, 0xD1901A06, 0x430AE307, 0xB29F5CD1, 0xDF07FBFC, + 0x8E45D73D, 0x681AB538, 0xBDE86578, 0xDD577E47, 0xE275EADE, 0x502D9FCD, 0xB9357178, 0x022A4B9A + }; + if (thread < threads) + { + uint64_t *Hash = &g_hash[thread<<3]; + + // fülle die Nachricht mit 64-byte (vorheriger Hash) + *(uint2x4*)&r[ 0] = __ldg4((uint2x4*)&Hash[ 0]); + *(uint2x4*)&r[ 8] = __ldg4((uint2x4*)&Hash[ 4]); + __syncthreads(); + + *(uint2x4*)&p[ 0] = *(uint2x4*)&state[ 0]; + *(uint2x4*)&p[ 2] = *(uint2x4*)&state[ 8]; + r[16] = 0x80; r[17] = 0; r[18] = 0; r[19] = 0; + r[20] = 0; r[21] = 0; r[22] = 0; r[23] = 0; + r[24] = 0; r[25] = 0; r[26] = 0; r[27] = 0x02000000; + r[28] = 0; r[29] = 0; r[30] = 0; r[31] = 0x02000000; + /* round 0 */ + x = p[ 1] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &x); + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 0] ^= x; + x = p[ 3]; + x.x ^= 0x80; + + AES_ROUND_NOKEY(sharedMemory, &x); + + AES_ROUND_NOKEY(sharedMemory, &x); + + x.w ^= 0x02000000; + AES_ROUND_NOKEY(sharedMemory, &x); + + x.w ^= 0x02000000; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 2]^= x; + // 1 + KEY_EXPAND_ELT(sharedMemory, &r[ 0]); + *(uint4*)&r[ 0]^=*(uint4*)&r[28]; + r[ 0] ^= 0x200; + r[ 3] ^= 0xFFFFFFFF; + x = p[ 0] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + *(uint4*)&r[ 4] ^= *(uint4*)&r[ 0]; + x ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 4]; + x ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[12]); + *(uint4*)&r[12] ^= *(uint4*)&r[ 8]; + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 3] ^= x; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + x = p[ 2] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + x ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24] ^= *(uint4*)&r[20]; + x ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[28]); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 1] ^= x; + *(uint4*)&r[ 0] ^= *(uint4*)&r[25]; + x = p[ 3] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + + r[ 4] ^= r[29]; r[ 5] ^= r[30]; + r[ 6] ^= r[31]; r[ 7] ^= r[ 0]; + + x ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 1]; + x ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[12] ^= *(uint4*)&r[ 5]; + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 2] ^= x; + *(uint4*)&r[16] ^= *(uint4*)&r[ 9]; + x = p[ 1] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[20] ^= *(uint4*)&r[13]; + x ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[24] ^= *(uint4*)&r[17]; + x ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[28] ^= *(uint4*)&r[21]; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + + p[ 0] ^= x; + + /* round 3, 7, 11 */ + round_3_7_11(sharedMemory,r,p,x); + + + /* round 4, 8, 12 */ + round_4_8_12(sharedMemory,r,p,x); + + // 2 + KEY_EXPAND_ELT(sharedMemory,&r[ 0]); + *(uint4*)&r[ 0] ^= *(uint4*)&r[28]; + x = p[ 0] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + *(uint4*)&r[ 4] ^= *(uint4*)&r[ 0]; + r[ 7] ^= (~0x200); + x ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 4]; + x ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[12]); + *(uint4*)&r[12] ^= *(uint4*)&r[ 8]; + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 3] ^= x; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + x = p[ 2] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + x ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24] ^= *(uint4*)&r[20]; + x ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory,&r[28]); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 1] ^= x; + + *(uint4*)&r[ 0] ^= *(uint4*)&r[25]; + x = p[ 3] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + r[ 4] ^= r[29]; + r[ 5] ^= r[30]; + r[ 6] ^= r[31]; + r[ 7] ^= r[ 0]; + x ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 1]; + x ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[12] ^= *(uint4*)&r[ 5]; + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 2] ^= x; + *(uint4*)&r[16] ^= *(uint4*)&r[ 9]; + x = p[ 1] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[20] ^= *(uint4*)&r[13]; + x ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[24] ^= *(uint4*)&r[17]; + x ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[28] ^= *(uint4*)&r[21]; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 0] ^= x; + + /* round 3, 7, 11 */ + round_3_7_11(sharedMemory,r,p,x); + + /* round 4, 8, 12 */ + round_4_8_12(sharedMemory,r,p,x); + + // 3 + KEY_EXPAND_ELT(sharedMemory,&r[ 0]); + *(uint4*)&r[ 0] ^= *(uint4*)&r[28]; + x = p[ 0] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + *(uint4*)&r[ 4] ^= *(uint4*)&r[ 0]; + x ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 4]; + x ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[12]); + *(uint4*)&r[12] ^= *(uint4*)&r[ 8]; + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 3] ^= x; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + x = p[ 2] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + x^=*(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24]^=*(uint4*)&r[20]; + x ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory,&r[28]); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + r[30] ^= 0x200; + r[31] ^= 0xFFFFFFFF; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 1] ^= x; + + *(uint4*)&r[ 0] ^= *(uint4*)&r[25]; + x = p[ 3] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + r[ 4] ^= r[29]; + r[ 5] ^= r[30]; + r[ 6] ^= r[31]; + r[ 7] ^= r[ 0]; + x ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 1]; + x ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[12] ^= *(uint4*)&r[ 5]; + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 2] ^= x; + *(uint4*)&r[16] ^= *(uint4*)&r[ 9]; + x = p[ 1] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[20] ^= *(uint4*)&r[13]; + x ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[24] ^= *(uint4*)&r[17]; + x ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &x); + *(uint4*)&r[28] ^= *(uint4*)&r[21]; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 0] ^= x; + + /* round 3, 7, 11 */ + round_3_7_11(sharedMemory,r,p,x); + + /* round 4, 8, 12 */ + round_4_8_12(sharedMemory,r,p,x); + + /* round 13 */ + KEY_EXPAND_ELT(sharedMemory,&r[ 0]); + *(uint4*)&r[ 0] ^= *(uint4*)&r[28]; + x = p[ 0] ^ *(uint4*)&r[ 0]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[ 4]); + *(uint4*)&r[ 4] ^= *(uint4*)&r[ 0]; + x ^= *(uint4*)&r[ 4]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[ 8]); + *(uint4*)&r[ 8] ^= *(uint4*)&r[ 4]; + x ^= *(uint4*)&r[ 8]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[12]); + *(uint4*)&r[12] ^= *(uint4*)&r[ 8]; + x ^= *(uint4*)&r[12]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 3] ^= x; + KEY_EXPAND_ELT(sharedMemory, &r[16]); + *(uint4*)&r[16] ^= *(uint4*)&r[12]; + x = p[ 2] ^ *(uint4*)&r[16]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[20]); + *(uint4*)&r[20] ^= *(uint4*)&r[16]; + x ^= *(uint4*)&r[20]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory, &r[24]); + *(uint4*)&r[24] ^= *(uint4*)&r[20]; + r[25] ^= 0x200; + r[27] ^= 0xFFFFFFFF; + x ^= *(uint4*)&r[24]; + AES_ROUND_NOKEY(sharedMemory, &x); + KEY_EXPAND_ELT(sharedMemory,&r[28]); + *(uint4*)&r[28] ^= *(uint4*)&r[24]; + x ^= *(uint4*)&r[28]; + AES_ROUND_NOKEY(sharedMemory, &x); + p[ 1] ^= x; + + *(uint2x4*)&Hash[ 0] = *(uint2x4*)&state[ 0] ^ *(uint2x4*)&p[ 2]; + *(uint2x4*)&Hash[ 4] = *(uint2x4*)&state[ 8] ^ *(uint2x4*)&p[ 0]; + } +} + +__host__ +void x11_shavite512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + dim3 grid((threads + TPB-1)/TPB); + dim3 block(TPB); + + // note: 128 threads minimum are required to init the shared memory array + x11_shavite512_gpu_hash_64<<>>(threads, (uint64_t*)d_hash); +} diff --git a/x11/cuda_x11_simd512.cu b/x11/cuda_x11_simd512.cu new file mode 100644 index 0000000..1f2b40f --- /dev/null +++ b/x11/cuda_x11_simd512.cu @@ -0,0 +1,110 @@ +/*************************************************************************************************** + * SIMD512 SM3+ CUDA IMPLEMENTATION (require cuda_x11_simd512_func.cuh) + */ + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#ifdef __INTELLISENSE__ +/* just for vstudio code colors */ +#define __CUDA_ARCH__ 500 +#endif + +#define TPB50_1 128 +#define TPB50_2 128 +#define TPB52_1 128 +#define TPB52_2 128 + +static uint4 *d_temp4[MAX_GPUS]; +#include "cuda_x11_simd512_func.cuh" + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB52_2,1) +#else +__launch_bounds__(TPB50_2,4) +#endif +static void x11_simd512_gpu_compress_64_maxwell(uint32_t threads, uint32_t *g_hash,const uint4 *const __restrict__ g_fft4) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + const uint32_t thr_offset = thread << 6; // thr_id * 128 (je zwei elemente) + uint32_t IV[32]; + if (thread < threads){ + + uint32_t *Hash = &g_hash[thread<<4]; +// Compression1(Hash, thread, g_fft4, g_state); + uint32_t A[32]; + + *(uint2x4*)&IV[ 0] = *(uint2x4*)&c_IV_512[ 0]; + *(uint2x4*)&IV[ 8] = *(uint2x4*)&c_IV_512[ 8]; + *(uint2x4*)&IV[16] = *(uint2x4*)&c_IV_512[16]; + *(uint2x4*)&IV[24] = *(uint2x4*)&c_IV_512[24]; + + *(uint2x4*)&A[ 0] = __ldg4((uint2x4*)&Hash[ 0]); + *(uint2x4*)&A[ 8] = __ldg4((uint2x4*)&Hash[ 8]); + + #pragma unroll 16 + for(uint32_t i=0;i<16;i++) + A[ i] = A[ i] ^ IV[ i]; + + #pragma unroll 16 + for(uint32_t i=16;i<32;i++) + A[ i] = IV[ i]; + + Round8(A, thr_offset, g_fft4); + + STEP8_IF(&IV[ 0],32, 4,13,&A[ 0],&A[ 8],&A[16],&A[24]); + STEP8_IF(&IV[ 8],33,13,10,&A[24],&A[ 0],&A[ 8],&A[16]); + STEP8_IF(&IV[16],34,10,25,&A[16],&A[24],&A[ 0],&A[ 8]); + STEP8_IF(&IV[24],35,25, 4,&A[ 8],&A[16],&A[24],&A[ 0]); + + #pragma unroll 32 + for(uint32_t i=0;i<32;i++){ + IV[ i] = A[ i]; + } + + A[ 0] ^= 512; + + Round8_0_final(A, 3,23,17,27); + Round8_1_final(A,28,19,22, 7); + Round8_2_final(A,29, 9,15, 5); + Round8_3_final(A, 4,13,10,25); + STEP8_IF(&IV[ 0],32, 4,13, &A[ 0], &A[ 8], &A[16], &A[24]); + STEP8_IF(&IV[ 8],33,13,10, &A[24], &A[ 0], &A[ 8], &A[16]); + STEP8_IF(&IV[16],34,10,25, &A[16], &A[24], &A[ 0], &A[ 8]); + STEP8_IF(&IV[24],35,25, 4, &A[ 8], &A[16], &A[24], &A[ 0]); + + *(uint2x4*)&Hash[ 0] = *(uint2x4*)&A[ 0]; + *(uint2x4*)&Hash[ 8] = *(uint2x4*)&A[ 8]; + } +} + +__host__ +void x11_simd512_cpu_init(int thr_id, uint32_t threads){ + cudaMalloc(&d_temp4[thr_id], 64*sizeof(uint4)*threads); +} + +__host__ +void x11_simd512_cpu_free(int thr_id){ + cudaFree(d_temp4[thr_id]); +} + +__host__ +void x11_simd512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash){ + + int dev_id = device_map[thr_id]; + + uint32_t tpb = TPB52_1; + if (device_sm[dev_id] <= 500) tpb = TPB50_1; + const dim3 grid1((8*threads + tpb - 1) / tpb); + const dim3 block1(tpb); + + tpb = TPB52_2; + if (device_sm[dev_id] <= 500) tpb = TPB50_2; + const dim3 grid2((threads + tpb - 1) / tpb); + const dim3 block2(tpb); + + x11_simd512_gpu_expand_64 <<>> (threads, d_hash, d_temp4[thr_id]); + x11_simd512_gpu_compress_64_maxwell <<< grid2, block2 >>> (threads, d_hash, d_temp4[thr_id]); +} diff --git a/x11/cuda_x11_simd512_func.cuh b/x11/cuda_x11_simd512_func.cuh new file mode 100644 index 0000000..c258508 --- /dev/null +++ b/x11/cuda_x11_simd512_func.cuh @@ -0,0 +1,656 @@ +static __constant__ const uint8_t c_perm[8][8] = { + { 2, 3, 6, 7, 0, 1, 4, 5 },{ 6, 7, 2, 3, 4, 5, 0, 1 },{ 7, 6, 5, 4, 3, 2, 1, 0 },{ 1, 0, 3, 2, 5, 4, 7, 6 }, + { 0, 1, 4, 5, 6, 7, 2, 3 },{ 6, 7, 2, 3, 0, 1, 4, 5 },{ 6, 7, 0, 1, 4, 5, 2, 3 },{ 4, 5, 2, 3, 6, 7, 0, 1 } +}; + +static __constant__ const uint32_t c_IV_512[32] = { + 0x0ba16b95, 0x72f999ad, 0x9fecc2ae, 0xba3264fc, 0x5e894929, 0x8e9f30e5, 0x2f1daa37, 0xf0f2c558, + 0xac506643, 0xa90635a5, 0xe25b878b, 0xaab7878f, 0x88817f7a, 0x0a02892b, 0x559a7550, 0x598f657e, + 0x7eef60a1, 0x6b70e3e8, 0x9c1714d1, 0xb958e2a8, 0xab02675e, 0xed1c014f, 0xcd8d65bb, 0xfdb7a257, + 0x09254899, 0xd699c7bc, 0x9019b6dc, 0x2b9022e4, 0x8fa14956, 0x21bf9bd3, 0xb94d0943, 0x6ffddc22 +}; + +static __constant__ const int16_t c_FFT128_8_16_Twiddle[128] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60, 2, 120, 4, -17, 8, -34, 16, -68, 32, 121, 64, -15, 128, -30, + 1, 46, 60, -67, 2, 92, 120, 123, 4, -73, -17, -11, 8, 111, -34, -22, 1, -67, 120, -73, 8, -22, -68, -70, 64, 81, -30, -46, -2,-123, 17,-111, + 1,-118, 46, -31, 60, 116, -67, -61, 2, 21, 92, -62, 120, -25, 123,-122, 1, 116, 92,-122, -17, 84, -22, 18, 32, 114, 117, -49, -30, 118, 67, 62, + 1, -31, -67, 21, 120, -122, -73, -50, 8, 9, -22, -89, -68, 52, -70, 114, 1, -61, 123, -50, -34, 18, -70, -99, 128, -98, 67, 25, 17, -9, 35, -79 +}; + +static __constant__ const int16_t c_FFT256_2_128_Twiddle[128] = { + 1, 41,-118, 45, 46, 87, -31, 14, 60,-110, 116,-127, -67, 80, -61, 69, 2, 82, 21, 90, 92, -83, -62, 28,120, 37, -25, 3, 123, -97,-122,-119, + 4, -93, 42, -77, -73, 91,-124, 56,-17, 74, -50, 6, -11, 63, 13, 19, 8, 71, 84, 103, 111, -75, 9, 112,-34,-109,-100, 12, -22, 126, 26, 38, + 16,-115, -89, -51, -35, 107, 18, -33,-68, 39, 57, 24, -44, -5, 52, 76, 32, 27, 79,-102, -70, -43, 36, -66,121, 78, 114, 48, -88, -10, 104,-105, + 64, 54, -99, 53, 117, -86, 72, 125,-15,-101, -29, 96, 81, -20, -49, 47,128, 108, 59, 106, -23, 85,-113, -7,-30, 55, -58, -65, -95, -40, -98, 94 +}; + +__device__ __forceinline__ +static uint32_t IF(uint32_t x,uint32_t y,uint32_t z){ +/* + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + uint32_t result; + asm("lop3.b32 %0, %1, %2, %3, 0xCA;" : "=r"(result) : "r"(x), "r"(y), "r"(z)); // x=F0, y=CC, z=AA // 0xCA = ((CC⊻AA)∧F0)⊻AA + return result; + #else +*/ return (((y ^ z) & x) ^ z); +// #endif +} + + +__device__ __forceinline__ +static uint32_t MAJ(const uint32_t x,const uint32_t y,const uint32_t z){ + + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + uint32_t result; + asm ("lop3.b32 %0, %1, %2, %3, 0xE8;" : "=r"(result) : "r"(x), "r"(y), "r"(z)); // x=AA, y=CC, z=F0 // 0xCA = ((CC⊻AA)∧F0)⊻AA + return result; + #else + return ((z &y) | ((z|y) & x)); + #endif +} + +#define p8_xor(x) ( ((x)%7) == 0 ? 1 : \ + ((x)%7) == 1 ? 6 : \ + ((x)%7) == 2 ? 2 : \ + ((x)%7) == 3 ? 3 : \ + ((x)%7) == 4 ? 5 : \ + ((x)%7) == 5 ? 7 : 4 ) + +__device__ __forceinline__ +static void STEP8_IF(const uint32_t *w, const uint32_t i, const uint32_t r, const uint32_t s, uint32_t *A, const uint32_t *B, const uint32_t *C, uint32_t *D) +{ + uint32_t R[8]; + + #pragma unroll 8 + for(int j=0; j<8; j++) + R[j] = ROTL32(A[j], r); + + uint32_t W[8]; + *(uint2x4*)&W[0] = *(uint2x4*)&w[0]; + #pragma unroll 8 + for(int j=0; j<8; j++) + D[j]+= W[j] + IF(A[j], B[j], C[j]); + #pragma unroll 8 + for(int j=0; j<8; j++) + D[j] = R[j^p8_xor(i)] + ROTL32(D[j], s); + #pragma unroll 8 + for(int j=0; j<8; j++) + A[j] = R[j]; +} + +__device__ __forceinline__ +static void STEP8_MAJ(const uint32_t *w, const uint32_t i, const uint32_t r, const uint32_t s, uint32_t *A, const uint32_t *B, const uint32_t *C, uint32_t *D) +{ + uint32_t R[8]; + + uint32_t W[8]; + *(uint2x4*)&W[0] = *(uint2x4*)&w[0]; + + #pragma unroll 8 + for(int j=0; j<8; j++) + R[j] = ROTL32(A[j], r); + + #pragma unroll 8 + for(int j=0; j<8; j++) + D[j]+= W[j] + MAJ(A[j], B[j], C[j]); + #pragma unroll 8 + for(int j=0; j<8; j++) + D[j] = R[j^p8_xor(i)] + ROTL32(D[j], s); + #pragma unroll 8 + for(int j=0; j<8; j++) + A[j] = R[j]; +} + +static __constant__ uint32_t d_cw[4][8][8] = { + 0x531B1720, 0xAC2CDE09, 0x0B902D87, 0x2369B1F4, 0x2931AA01, 0x02E4B082, 0xC914C914, 0xC1DAE1A6, 0xF18C2B5C, 0x08AC306B, 0x27BFC914, 0xCEDC548D, 0xC630C4BE, 0xF18C4335, 0xF0D3427C, 0xBE3DA380, + 0x143C02E4, 0xA948C630, 0xA4F2DE09, 0xA71D2085, 0xA439BD84, 0x109FCD6A, 0xEEA8EF61, 0xA5AB1CE8, 0x0B90D4A4, 0x3D6D039D, 0x25944D53, 0xBAA0E034, 0x5BC71E5A, 0xB1F4F2FE, 0x12CADE09, 0x548D41C3, + 0x3CB4F80D, 0x36ECEBC4, 0xA66443EE, 0x43351ABD, 0xC7A20C49, 0xEB0BB366, 0xF5293F98, 0x49B6DE09, 0x531B29EA, 0x02E402E4, 0xDB25C405, 0x53D4E543, 0x0AD71720, 0xE1A61A04, 0xB87534C1, 0x3EDF43EE, + 0x213E50F0, 0x39173EDF, 0xA9485B0E, 0xEEA82EF9, 0x14F55771, 0xFAF15546, 0x3D6DD9B3, 0xAB73B92E, 0x582A48FD, 0xEEA81892, 0x4F7EAA01, 0xAF10A88F, 0x11581720, 0x34C124DB, 0xD1C0AB73, 0x1E5AF0D3, + 0xC34C07F3, 0xC914143C, 0x599CBC12, 0xBCCBE543, 0x385EF3B7, 0x14F54C9A, 0x0AD7C068, 0xB64A21F7, 0xDEC2AF10, 0xC6E9C121, 0x56B8A4F2, 0x1158D107, 0xEB0BA88F, 0x050FAABA, 0xC293264D, 0x548D46D2, + 0xACE5E8E0, 0x53D421F7, 0xF470D279, 0xDC974E0C, 0xD6CF55FF, 0xFD1C4F7E, 0x36EC36EC, 0x3E261E5A, 0xEBC4FD1C, 0x56B839D0, 0x5B0E21F7, 0x58E3DF7B, 0x5BC7427C, 0xEF613296, 0x1158109F, 0x5A55E318, + 0xA7D6B703, 0x1158E76E, 0xB08255FF, 0x50F05771, 0xEEA8E8E0, 0xCB3FDB25, 0x2E40548D, 0xE1A60F2D, 0xACE5D616, 0xFD1CFD1C, 0x24DB3BFB, 0xAC2C1ABD, 0xF529E8E0, 0x1E5AE5FC, 0x478BCB3F, 0xC121BC12, + 0xF4702B5C, 0xC293FC63, 0xDA6CB2AD, 0x45601FCC, 0xA439E1A6, 0x4E0C0D02, 0xED3621F7, 0xAB73BE3D, 0x0E74D4A4, 0xF754CF95, 0xD84136EC, 0x3124AB73, 0x39D03B42, 0x0E74BCCB, 0x0F2DBD84, 0x41C35C80, + 0xA4135BED, 0xE10E1EF2, 0x6C4F93B1, 0x6E2191DF, 0xE2E01D20, 0xD1952E6B, 0x6A7D9583, 0x131DECE3, 0x369CC964, 0xFB73048D, 0x9E9D6163, 0x280CD7F4, 0xD9C6263A, 0x1062EF9E, 0x2AC7D539, 0xAD2D52D3, + 0x0A03F5FD, 0x197CE684, 0xAA72558E, 0xDE5321AD, 0xF0870F79, 0x607A9F86, 0xAFE85018, 0x2AC7D539, 0xE2E01D20, 0x2AC7D539, 0xC6A93957, 0x624C9DB4, 0x6C4F93B1, 0x641E9BE2, 0x452CBAD4, 0x263AD9C6, + 0xC964369C, 0xC3053CFB, 0x452CBAD4, 0x95836A7D, 0x4AA2B55E, 0xAB5B54A5, 0xAC4453BC, 0x74808B80, 0xCB3634CA, 0xFC5C03A4, 0x4B8BB475, 0x21ADDE53, 0xE2E01D20, 0xDF3C20C4, 0xBD8F4271, 0xAA72558E, + 0xFC5C03A4, 0x48D0B730, 0x2AC7D539, 0xD70B28F5, 0x53BCAC44, 0x3FB6C04A, 0x14EFEB11, 0xDB982468, 0x9A1065F0, 0xB0D14F2F, 0x8D5272AE, 0xC4D73B29, 0x91DF6E21, 0x949A6B66, 0x303DCFC3, 0x5932A6CE, + 0x1234EDCC, 0xF5140AEC, 0xCDF1320F, 0x3DE4C21C, 0x48D0B730, 0x1234EDCC, 0x131DECE3, 0x52D3AD2D, 0xE684197C, 0x6D3892C8, 0x72AE8D52, 0x6FF3900D, 0x73978C69, 0xEB1114EF, 0x15D8EA28, 0x71C58E3B, + 0x90F66F0A, 0x15D8EA28, 0x9BE2641E, 0x65F09A10, 0xEA2815D8, 0xBD8F4271, 0x3A40C5C0, 0xD9C6263A, 0xB38C4C74, 0xBAD4452C, 0x70DC8F24, 0xAB5B54A5, 0x46FEB902, 0x1A65E59B, 0x0DA7F259, 0xA32A5CD6, + 0xD62229DE, 0xB81947E7, 0x6D3892C8, 0x15D8EA28, 0xE59B1A65, 0x065FF9A1, 0xB2A34D5D, 0x6A7D9583, 0x975568AB, 0xFC5C03A4, 0x2E6BD195, 0x966C6994, 0xF2590DA7, 0x263AD9C6, 0x5A1BA5E5, 0xB0D14F2F, + 0x975568AB, 0x6994966C, 0xF1700E90, 0xD3672C99, 0xCC1F33E1, 0xFC5C03A4, 0x452CBAD4, 0x4E46B1BA, 0xF1700E90, 0xB2A34D5D, 0xD0AC2F54, 0x5760A8A0, 0x8C697397, 0x624C9DB4, 0xE85617AA, 0x95836A7D + +}; + +__device__ __forceinline__ +static void Round8_0_final(uint32_t* A,const uint32_t r,const uint32_t s,const uint32_t t,const uint32_t u){ + + STEP8_IF(d_cw[0][0],0, r, s, A, &A[ 8], &A[16], &A[24]); + STEP8_IF(d_cw[0][1],1, s, t, &A[24], A, &A[ 8], &A[16]); + STEP8_IF(d_cw[0][2],2, t, u, &A[16], &A[24], A, &A[ 8]); + STEP8_IF(d_cw[0][3],3, u, r, &A[ 8], &A[16], &A[24], A); + STEP8_MAJ(d_cw[0][4],4, r, s, A, &A[ 8], &A[16], &A[24]); + STEP8_MAJ(d_cw[0][5],5, s, t, &A[24], A, &A[ 8], &A[16]); + STEP8_MAJ(d_cw[0][6],6, t, u, &A[16], &A[24], A, &A[ 8]); + STEP8_MAJ(d_cw[0][7],7, u, r, &A[ 8], &A[16], &A[24], A); +} + +__device__ __forceinline__ +static void Round8_1_final(uint32_t* A,const uint32_t r,const uint32_t s,const uint32_t t,const uint32_t u){ + + STEP8_IF(d_cw[1][0], 8, r, s, A, &A[ 8], &A[16], &A[24]); + STEP8_IF(d_cw[1][1], 9, s, t, &A[24], A, &A[ 8], &A[16]); + STEP8_IF(d_cw[1][2],10, t, u, &A[16], &A[24], A, &A[ 8]); + STEP8_IF(d_cw[1][3],11, u, r, &A[ 8], &A[16], &A[24], A); + STEP8_MAJ(d_cw[1][4],12, r, s, A, &A[ 8], &A[16], &A[24]); + STEP8_MAJ(d_cw[1][5],13, s, t, &A[24], A, &A[ 8], &A[16]); + STEP8_MAJ(d_cw[1][6],14, t, u, &A[16], &A[24], A, &A[ 8]); + STEP8_MAJ(d_cw[1][7],15, u, r, &A[ 8], &A[16], &A[24], A); +} + +__device__ __forceinline__ +static void Round8_2_final(uint32_t* A,const uint32_t r,const uint32_t s,const uint32_t t,const uint32_t u){ + + STEP8_IF(d_cw[2][0],16, r, s, A, &A[ 8], &A[16], &A[24]); + STEP8_IF(d_cw[2][1],17, s, t, &A[24], A, &A[ 8], &A[16]); + STEP8_IF(d_cw[2][2],18, t, u, &A[16], &A[24], A, &A[ 8]); + STEP8_IF(d_cw[2][3],19, u, r, &A[ 8], &A[16], &A[24], A); + STEP8_MAJ(d_cw[2][4],20, r, s, A, &A[ 8], &A[16], &A[24]); + STEP8_MAJ(d_cw[2][5],21, s, t, &A[24], A, &A[ 8], &A[16]); + STEP8_MAJ(d_cw[2][6],22, t, u, &A[16], &A[24], A, &A[ 8]); + STEP8_MAJ(d_cw[2][7],23, u, r, &A[ 8], &A[16], &A[24], A); +} + +__device__ __forceinline__ +static void Round8_3_final(uint32_t* A,const uint32_t r,const uint32_t s,const uint32_t t,const uint32_t u){ + + STEP8_IF(d_cw[3][0],24, r, s, A, &A[ 8], &A[16], &A[24]); + STEP8_IF(d_cw[3][1],25, s, t, &A[24], A, &A[ 8], &A[16]); + STEP8_IF(d_cw[3][2],26, t, u, &A[16], &A[24], A, &A[ 8]); + STEP8_IF(d_cw[3][3],27, u, r, &A[ 8], &A[16], &A[24], A); + STEP8_MAJ(d_cw[3][4],28, r, s, A, &A[ 8], &A[16], &A[24]); + STEP8_MAJ(d_cw[3][5],29, s, t, &A[24], A, &A[ 8], &A[16]); + STEP8_MAJ(d_cw[3][6],30, t, u, &A[16], &A[24], A, &A[ 8]); + STEP8_MAJ(d_cw[3][7],31, u, r, &A[ 8], &A[16], &A[24], A); +} + +//#define expanded_vector(x) __ldg(&g_fft4[x]) +static __device__ __forceinline__ void expanded_vector(uint32_t* w,const uint4* ptr){ + asm volatile ("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4];" : "=r"(w[0]), "=r"(w[1]),"=r"(w[2]), "=r"(w[3]) : __LDG_PTR(ptr)); +} + +__device__ __forceinline__ +static void Round8(uint32_t* A, const uint32_t thr_offset, const uint4 *const __restrict__ g_fft4) { + + uint32_t w[8]; + uint32_t tmp = thr_offset; + + uint32_t r = 3, s = 23, t = 17, u = 27; + + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,0, r, s, A, &A[8], &A[16], &A[24]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,1, s, t, &A[24], A, &A[8], &A[16]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,2, t, u, &A[16], &A[24], A, &A[8]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,3, u, r, &A[8], &A[16], &A[24], A); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,4, r, s, A, &A[8], &A[16], &A[24]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,5, s, t, &A[24], A, &A[8], &A[16]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,6, t, u, &A[16], &A[24], A, &A[8]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,7, u, r, &A[8], &A[16], &A[24], A); + + r = 28; s = 19; t = 22; u = 7; + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,8, r, s, A, &A[8], &A[16], &A[24]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,9, s, t, &A[24], A, &A[8], &A[16]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,10, t, u, &A[16], &A[24], A, &A[8]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,11, u, r, &A[8], &A[16], &A[24], A); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,12, r, s, A, &A[8], &A[16], &A[24]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,13, s, t, &A[24], A, &A[8], &A[16]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,14, t, u, &A[16], &A[24], A, &A[8]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,15, u, r, &A[8], &A[16], &A[24], A); + + r = 29; s = 9; t = 15; u = 5; + + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,16, r, s, A, &A[8], &A[16], &A[24]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,17, s, t, &A[24], A, &A[8], &A[16]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,18, t, u, &A[16], &A[24], A, &A[8]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,19, u, r, &A[8], &A[16], &A[24], A); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,20, r, s, A, &A[8], &A[16], &A[24]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,21, s, t, &A[24], A, &A[8], &A[16]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,22, t, u, &A[16], &A[24], A, &A[8]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,23, u, r, &A[8], &A[16], &A[24], A); + + r = 4; s = 13; t = 10; u = 25; + + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,24, r, s, A, &A[8], &A[16], &A[24]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,25, s, t, &A[24], A, &A[8], &A[16]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,26, t, u, &A[16], &A[24], A, &A[8]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_IF(w,27, u, r, &A[8], &A[16], &A[24], A); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,28, r, s, A, &A[8], &A[16], &A[24]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,29, s, t, &A[24], A, &A[8], &A[16]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,30, t, u, &A[16], &A[24], A, &A[8]); + expanded_vector(&w[0],&g_fft4[tmp++]); + expanded_vector(&w[4],&g_fft4[tmp++]); + STEP8_MAJ(w,31, u, r, &A[8], &A[16], &A[24], A); + +} + +/********************* Message expansion ************************/ + +/* + * Reduce modulo 257; result is in [-127; 383] + * REDUCE(x) := (x&255) - (x>>8) + */ +#define REDUCE(x) \ + (((x)&255) - ((x)>>8)) + +/* + * Reduce from [-127; 383] to [-128; 128] + * EXTRA_REDUCE_S(x) := x<=128 ? x : x-257 + */ +#define EXTRA_REDUCE_S(x) \ + ((x)<=128 ? (x) : (x)-257) + +/* + * Reduce modulo 257; result is in [-128; 128] + */ +#define REDUCE_FULL_S(x) \ + EXTRA_REDUCE_S(REDUCE(x)) + +// Parallelization: +// +// FFT_8 wird 2 times 8-fach parallel ausgeführt (in FFT_64) +// and 1 time 16-fach parallel (in FFT_128_full) +// +// STEP8_IF and STEP8_MAJ beinhalten je 2x 8-fach parallel Operations + +/** + * FFT_8 using w=4 as 8th root of unity + * Unrolled decimation in frequency (DIF) radix-2 NTT. + * Output data is in revbin_permuted order. + */ +__device__ __forceinline__ +static void FFT_8(int *y,const uint8_t stripe){ + +#define BUTTERFLY(i,j,n) \ +do { \ + int u= y[stripe*i]; \ + int v= y[stripe*j]; \ + y[stripe*i] = u+v; \ + y[stripe*j] = (u-v) << (n<<1); \ +} while(0) + + BUTTERFLY(0, 4, 0); + BUTTERFLY(1, 5, 1); + BUTTERFLY(2, 6, 2); + BUTTERFLY(3, 7, 3); + + y[stripe*6] = REDUCE(y[stripe*6]); + y[stripe*7] = REDUCE(y[stripe*7]); + + BUTTERFLY(0, 2, 0); + BUTTERFLY(4, 6, 0); + BUTTERFLY(1, 3, 2); + BUTTERFLY(5, 7, 2); + + y[stripe*7] = REDUCE(y[stripe*7]); + + BUTTERFLY(0, 1, 0); + BUTTERFLY(2, 3, 0); + BUTTERFLY(4, 5, 0); + BUTTERFLY(6, 7, 0); + + y[ 0] = REDUCE(y[ 0]); + y[stripe] = REDUCE(y[stripe]); + y[stripe<<1] = REDUCE(y[stripe<<1]); + y[stripe*3] = REDUCE(y[stripe*3]); + y[stripe<<2] = REDUCE(y[stripe<<2]); + y[stripe*5] = REDUCE(y[stripe*5]); + y[stripe*6] = REDUCE(y[stripe*6]); + y[stripe*7] = REDUCE(y[stripe*7]); + + y[ 0] = EXTRA_REDUCE_S(y[ 0]); + y[stripe] = EXTRA_REDUCE_S(y[stripe]); + y[stripe<<1] = EXTRA_REDUCE_S(y[stripe<<1]); + y[stripe*3] = EXTRA_REDUCE_S(y[stripe*3]); + y[stripe<<2] = EXTRA_REDUCE_S(y[stripe<<2]); + y[stripe*5] = EXTRA_REDUCE_S(y[stripe*5]); + y[stripe*6] = EXTRA_REDUCE_S(y[stripe*6]); + y[stripe*7] = EXTRA_REDUCE_S(y[stripe*7]); + +#undef BUTTERFLY +} + +/** + * FFT_16 using w=2 as 16th root of unity + * Unrolled decimation in frequency (DIF) radix-2 NTT. + * Output data is in revbin_permuted order. + */ +__device__ __forceinline__ +static void FFT_16(int *y){ + +#define DO_REDUCE_FULL_S(i) \ + do { \ + y[i] = REDUCE(y[i]); \ + y[i] = EXTRA_REDUCE_S(y[i]); \ + } while(0) + + int u,v; + + const uint8_t thr = threadIdx.x&7; + + u = y[0]; // 0..7 + v = y[1]; // 8..15 + y[0] = u+v; + y[1] = (u-v) << (thr); + + if ((thr) >=3) y[1] = REDUCE(y[1]); // 11...15 + + u = __shfl(y[0], (threadIdx.x&3),8); // 0,1,2,3 0,1,2,3 + v = __shfl(y[0],4+(threadIdx.x&3),8); // 4,5,6,7 4,5,6,7 + y[0] = ((thr) < 4) ? (u+v) : ((u-v) << ((threadIdx.x&3)<<1)); + + u = __shfl(y[1], (threadIdx.x&3),8); // 8,9,10,11 8,9,10,11 + v = __shfl(y[1],4+(threadIdx.x&3),8); // 12,13,14,15 12,13,14,15 + y[1] = ((thr) < 4) ? (u+v) : ((u-v) << ((threadIdx.x&3)<<1)); + + if ((threadIdx.x&1) && (thr >= 4)) { + y[0] = REDUCE(y[0]); // 5, 7 + y[1] = REDUCE(y[1]); // 13, 15 + } + + u = __shfl(y[0], (threadIdx.x&5),8); // 0,1,0,1 4,5,4,5 + v = __shfl(y[0],2+(threadIdx.x&5),8); // 2,3,2,3 6,7,6,7 + y[0] = ((threadIdx.x&3) < 2) ? (u+v) : ((u-v) << ((threadIdx.x&1)<<2)); + + u = __shfl(y[1], (threadIdx.x&5),8); // 8,9,8,9 12,13,12,13 + v = __shfl(y[1],2+(threadIdx.x&5),8); // 10,11,10,11 14,15,14,15 + y[1] = ((threadIdx.x&3) < 2) ? (u+v) : ((u-v) << ((threadIdx.x&1)<<2)); + + u = __shfl(y[0], (threadIdx.x&6),8); // 0,0,2,2 4,4,6,6 + v = __shfl(y[0],1+(threadIdx.x&6),8); // 1,1,3,3 5,5,7,7 + y[0] = ((threadIdx.x&1) < 1) ? (u+v) : (u-v); + + u = __shfl(y[1], (threadIdx.x&6),8); // 8,8,10,10 12,12,14,14 + v = __shfl(y[1],1+(threadIdx.x&6),8); // 9,9,11,11 13,13,15,15 + y[1] = ((threadIdx.x&1) < 1) ? (u+v) : (u-v); + + DO_REDUCE_FULL_S( 0); // 0...7 + DO_REDUCE_FULL_S( 1); // 8...15 + +#undef DO_REDUCE_FULL_S +} + +/***************************************************/ +#if __CUDA_ARCH__ > 500 +__global__ __launch_bounds__(TPB52_1,9) +#else +__global__ __launch_bounds__(TPB50_1,9) +#endif +static void x11_simd512_gpu_expand_64(uint32_t threads,const uint32_t* __restrict__ g_hash, uint4 *g_temp4) +{ + const uint32_t threadBloc = (blockDim.x * blockIdx.x + threadIdx.x)>>3; + const uint8_t thr = (threadIdx.x & 7); + /* Message Expansion using Number Theoretical Transform similar to FFT */ + int expanded[32]; + + uint4 vec0; + int P, Q, P1, Q1, P2, Q2; + + const bool even = (threadIdx.x & 1) == 0; + const bool hi = (thr)>=4; + const bool lo = (thr)<4; + const bool sel = ((threadIdx.x+2)&7) >= 4; // 2,3,4,5 + + if (threadBloc < threads){ + + const uint32_t hashPosition = threadBloc<<4; + + const uint32_t *inpHash = &g_hash[hashPosition]; + + const uint32_t data0 = __ldg(&inpHash[thr]); + const uint32_t data1 = __ldg(&inpHash[thr + 8]); + + // Puffer für expandierte Nachricht + uint4 *temp4 = &g_temp4[hashPosition<<2]; + + #pragma unroll 4 + for (uint32_t i=0; i < 4; i++) { + expanded[ i] = bfe(__byte_perm(__shfl(data0, i<<1, 8), __shfl(data0, (i<<1)+1, 8), thr),0,8); + } + #pragma unroll 4 + for (uint32_t i=0; i < 4; i++) { + expanded[4+i] = bfe(__byte_perm(__shfl(data1, i<<1, 8), __shfl(data1, (i<<1)+1, 8), thr),0,8); + } + #pragma unroll 8 + for (uint32_t i=8; i < 16; i++) { + expanded[ i] = 0; + } + /* + * FFT_256 using w=41 as 256th root of unity. Decimation in frequency (DIF) NTT. Output data is in revbin_permuted order. In place. + */ + #pragma unroll 8 + for (uint32_t i=0; i<8; i++) + expanded[16+i] = REDUCE(expanded[i] * c_FFT256_2_128_Twiddle[8*i+(thr)]); + + #pragma unroll 8 + for (uint32_t i=24; i < 32; i++) { + expanded[ i] = 0; + } + /* handle X^255 with an additional butterfly */ + if (thr==7){ + expanded[15] = 1; + expanded[31] = REDUCE((-1) * c_FFT256_2_128_Twiddle[127]); + } + +// FFT_128_full(expanded); + FFT_8(expanded,2); // eight parallel FFT8's + FFT_8(&expanded[16],2); // eight parallel FFT8's + FFT_8(&expanded[ 1],2); // eight parallel FFT8's + FFT_8(&expanded[17],2); // eight parallel FFT8's + + #pragma unroll 16 + for (uint32_t i=0; i<16; i++){ + expanded[i] = REDUCE(expanded[i]*c_FFT128_8_16_Twiddle[i*8+(thr)]); + expanded[i+16] = REDUCE(expanded[i+16]*c_FFT128_8_16_Twiddle[i*8+(thr)]); + } + + #pragma unroll 8 + for (uint32_t i=0; i<8; i++){ + FFT_16(expanded+(i<<1)); // eight sequential FFT16's, each one executed in parallel by 8 threads + FFT_16(expanded+16+(i<<1)); // eight sequential FFT16's, each one executed in parallel by 8 threads + } + + // store w matrices in global memory + P1 = expanded[ 0]; P2 = __shfl(expanded[ 2], (threadIdx.x-1)&7, 8); P = even ? P1 : P2; + Q1 = expanded[16]; Q2 = __shfl(expanded[18], (threadIdx.x-1)&7, 8); Q = even ? Q1 : Q2; + vec0.x = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[0][thr], 8); + P1 = expanded[ 8]; P2 = __shfl(expanded[10], (threadIdx.x-1)&7, 8); P = even ? P1 : P2; + Q1 = expanded[24]; Q2 = __shfl(expanded[26], (threadIdx.x-1)&7, 8); Q = even ? Q1 : Q2; + vec0.y = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[0][thr], 8); + P1 = expanded[ 4]; P2 = __shfl(expanded[ 6], (threadIdx.x-1)&7, 8); P = even ? P1 : P2; + Q1 = expanded[20]; Q2 = __shfl(expanded[22], (threadIdx.x-1)&7, 8); Q = even ? Q1 : Q2; + vec0.z = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[0][thr], 8); + P1 = expanded[12]; P2 = __shfl(expanded[14], (threadIdx.x-1)&7, 8); P = even ? P1 : P2; + Q1 = expanded[28]; Q2 = __shfl(expanded[30], (threadIdx.x-1)&7, 8); Q = even ? Q1 : Q2; + vec0.w = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[0][thr], 8); + temp4[thr] = vec0; + + P1 = expanded[ 1]; P2 = __shfl(expanded[ 3], (threadIdx.x-1)&7, 8); P = even ? P1 : P2; + Q1 = expanded[17]; Q2 = __shfl(expanded[19], (threadIdx.x-1)&7, 8); Q = even ? Q1 : Q2; + vec0.x = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[1][thr], 8); + P1 = expanded[ 9]; P2 = __shfl(expanded[11], (threadIdx.x-1)&7, 8); P = even ? P1 : P2; + Q1 = expanded[25]; Q2 = __shfl(expanded[27], (threadIdx.x-1)&7, 8); Q = even ? Q1 : Q2; + vec0.y = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[1][thr], 8); + P1 = expanded[ 5]; P2 = __shfl(expanded[ 7], (threadIdx.x-1)&7, 8); P = even ? P1 : P2; + Q1 = expanded[21]; Q2 = __shfl(expanded[23], (threadIdx.x-1)&7, 8); Q = even ? Q1 : Q2; + vec0.z = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[1][thr], 8); + P1 = expanded[13]; P2 = __shfl(expanded[15], (threadIdx.x-1)&7, 8); P = even ? P1 : P2; + Q1 = expanded[29]; Q2 = __shfl(expanded[31], (threadIdx.x-1)&7, 8); Q = even ? Q1 : Q2; + vec0.w = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[1][thr], 8); + temp4[8+(thr)] = vec0; + + P1 = hi?expanded[ 1]:expanded[ 0]; P2 = __shfl(hi?expanded[ 3]:expanded[ 2], (threadIdx.x+1)&7, 8); P = !even ? P1 : P2; + Q1 = hi?expanded[17]:expanded[16]; Q2 = __shfl(hi?expanded[19]:expanded[18], (threadIdx.x+1)&7, 8); Q = !even ? Q1 : Q2; + vec0.x = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[2][thr], 8); + P1 = hi?expanded[ 9]:expanded[ 8]; P2 = __shfl(hi?expanded[11]:expanded[10], (threadIdx.x+1)&7, 8); P = !even ? P1 : P2; + Q1 = hi?expanded[25]:expanded[24]; Q2 = __shfl(hi?expanded[27]:expanded[26], (threadIdx.x+1)&7, 8); Q = !even ? Q1 : Q2; + vec0.y = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[2][thr], 8); + P1 = hi?expanded[ 5]:expanded[ 4]; P2 = __shfl(hi?expanded[ 7]:expanded[ 6], (threadIdx.x+1)&7, 8); P = !even ? P1 : P2; + Q1 = hi?expanded[21]:expanded[20]; Q2 = __shfl(hi?expanded[23]:expanded[22], (threadIdx.x+1)&7, 8); Q = !even ? Q1 : Q2; + vec0.z = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[2][thr], 8); + P1 = hi?expanded[13]:expanded[12]; P2 = __shfl(hi?expanded[15]:expanded[14], (threadIdx.x+1)&7, 8); P = !even ? P1 : P2; + Q1 = hi?expanded[29]:expanded[28]; Q2 = __shfl(hi?expanded[31]:expanded[30], (threadIdx.x+1)&7, 8); Q = !even ? Q1 : Q2; + vec0.w = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[2][thr], 8); + temp4[16+(thr)] = vec0; + + P1 = lo?expanded[ 1]:expanded[ 0]; P2 = __shfl(lo?expanded[ 3]:expanded[ 2], (threadIdx.x+1)&7, 8); P = !even ? P1 : P2; + Q1 = lo?expanded[17]:expanded[16]; Q2 = __shfl(lo?expanded[19]:expanded[18], (threadIdx.x+1)&7, 8); Q = !even ? Q1 : Q2; + vec0.x = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[3][thr], 8); + P1 = lo?expanded[ 9]:expanded[ 8]; P2 = __shfl(lo?expanded[11]:expanded[10], (threadIdx.x+1)&7, 8); P = !even ? P1 : P2; + Q1 = lo?expanded[25]:expanded[24]; Q2 = __shfl(lo?expanded[27]:expanded[26], (threadIdx.x+1)&7, 8); Q = !even ? Q1 : Q2; + vec0.y = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[3][thr], 8); + P1 = lo?expanded[ 5]:expanded[ 4]; P2 = __shfl(lo?expanded[ 7]:expanded[ 6], (threadIdx.x+1)&7, 8); P = !even ? P1 : P2; + Q1 = lo?expanded[21]:expanded[20]; Q2 = __shfl(lo?expanded[23]:expanded[22], (threadIdx.x+1)&7, 8); Q = !even ? Q1 : Q2; + vec0.z = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[3][thr], 8); + P1 = lo?expanded[13]:expanded[12]; P2 = __shfl(lo?expanded[15]:expanded[14], (threadIdx.x+1)&7, 8); P = !even ? P1 : P2; + Q1 = lo?expanded[29]:expanded[28]; Q2 = __shfl(lo?expanded[31]:expanded[30], (threadIdx.x+1)&7, 8); Q = !even ? Q1 : Q2; + vec0.w = __shfl(__byte_perm(185*P, 185*Q , 0x5410), c_perm[3][thr], 8); + temp4[24+(thr)] = vec0; + + P1 = sel?expanded[0]:expanded[1]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + Q2 = sel?expanded[2]:expanded[3]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.x = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[4][thr], 8); + P1 = sel?expanded[8]:expanded[9]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + Q2 = sel?expanded[10]:expanded[11]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.y = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[4][thr], 8); + P1 = sel?expanded[4]:expanded[5]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + Q2 = sel?expanded[6]:expanded[7]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.z = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[4][thr], 8); + P1 = sel?expanded[12]:expanded[13]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + Q2 = sel?expanded[14]:expanded[15]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.w = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[4][thr], 8); + + temp4[32+thr] = vec0; + + P1 = sel?expanded[1]:expanded[0]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + Q2 = sel?expanded[3]:expanded[2]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.x = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[5][thr], 8); + P1 = sel?expanded[9]:expanded[8]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + Q2 = sel?expanded[11]:expanded[10]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.y = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[5][thr], 8); + P1 = sel?expanded[5]:expanded[4]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + Q2 = sel?expanded[7]:expanded[6]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.z = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[5][thr], 8); + P1 = sel?expanded[13]:expanded[12]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + Q2 = sel?expanded[15]:expanded[14]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.w = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[5][thr], 8); + + temp4[40+thr] = vec0; + + uint32_t t; + t = __shfl(expanded[17],(threadIdx.x+4)&7,8); P1 = sel?t:expanded[16]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + t = __shfl(expanded[19],(threadIdx.x+4)&7,8); Q2 = sel?t:expanded[18]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.x = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[6][thr], 8); + t = __shfl(expanded[25],(threadIdx.x+4)&7,8); P1 = sel?t:expanded[24]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + t = __shfl(expanded[27],(threadIdx.x+4)&7,8); Q2 = sel?t:expanded[26]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.y = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[6][thr], 8); + t = __shfl(expanded[21],(threadIdx.x+4)&7,8); P1 = sel?t:expanded[20]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + t = __shfl(expanded[23],(threadIdx.x+4)&7,8); Q2 = sel?t:expanded[22]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.z = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[6][thr], 8); + t = __shfl(expanded[29],(threadIdx.x+4)&7,8); P1 = sel?t:expanded[28]; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + t = __shfl(expanded[31],(threadIdx.x+4)&7,8); Q2 = sel?t:expanded[30]; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.w = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[6][thr], 8); + + temp4[48+thr] = vec0; + + t = __shfl(expanded[16],(threadIdx.x+4)&7,8); P1 = sel?expanded[17]:t; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + t = __shfl(expanded[18],(threadIdx.x+4)&7,8); Q2 = sel?expanded[19]:t; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.x = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[7][thr], 8); + t = __shfl(expanded[24],(threadIdx.x+4)&7,8); P1 = sel?expanded[25]:t; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + t = __shfl(expanded[26],(threadIdx.x+4)&7,8); Q2 = sel?expanded[27]:t; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.y = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[7][thr], 8); + t = __shfl(expanded[20],(threadIdx.x+4)&7,8); P1 = sel?expanded[21]:t; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + t = __shfl(expanded[22],(threadIdx.x+4)&7,8); Q2 = sel?expanded[23]:t; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.z = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[7][thr], 8); + t = __shfl(expanded[28],(threadIdx.x+4)&7,8); P1 = sel?expanded[29]:t; Q1 = __shfl(P1, (threadIdx.x^1)&7, 8); + t = __shfl(expanded[30],(threadIdx.x+4)&7,8); Q2 = sel?expanded[31]:t; P2 = __shfl(Q2, (threadIdx.x^1)&7, 8); + P = even? P1 : P2; Q = even? Q1 : Q2; + vec0.w = __shfl(__byte_perm(233*P, 233*Q , 0x5410), c_perm[7][thr], 8); + + temp4[56+thr] = vec0; + } +} diff --git a/x11/cuda_x11_simd_echo512.cu b/x11/cuda_x11_simd_echo512.cu new file mode 100644 index 0000000..6cb55f5 --- /dev/null +++ b/x11/cuda_x11_simd_echo512.cu @@ -0,0 +1,609 @@ +/*************************************************************************************************** + * SIMD512 SM3+ CUDA IMPLEMENTATION (require cuda_x11_simd512_func.cuh) + * Forked from Tanguy Pruvot's repo + * Merged with echo512 kernel + * Provos Alexis - 2016 + */ + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" +#include "cuda_x11_aes.cuh" + +#ifdef __INTELLISENSE__ +/* just for vstudio code colors */ +#define __CUDA_ARCH__ 500 +#endif + +#define TPB50_1 128 +#define TPB50_2 128 +#define TPB52_1 128 +#define TPB52_2 128 + +//SIMD512 MACROS ---------------------------- +static uint4 *d_temp4[MAX_GPUS]; +#include "cuda_x11_simd512_func.cuh" +//END OF SIMD512 MACROS --------------------- + +//ECHO MACROS-------------------------------- +#define SHIFT_ROW1(a, b, c, d) do { \ + tmp0 = W[a+0]; \ + W[a+0] = W[b+0]; \ + W[b+0] = W[c+0]; \ + W[c+0] = W[d+0]; \ + W[d+0] = tmp0; \ +\ + tmp0 = W[a+1]; \ + W[a+1] = W[b+1]; \ + W[b+1] = W[c+1]; \ + W[c+1] = W[d+1]; \ + W[d+1] = tmp0; \ +\ + tmp0 = W[a+2]; \ + W[a+2] = W[b+2]; \ + W[b+2] = W[c+2]; \ + W[c+2] = W[d+2]; \ + W[d+2] = tmp0; \ +\ + tmp0 = W[a+3]; \ + W[a+3] = W[b+3]; \ + W[b+3] = W[c+3]; \ + W[c+3] = W[d+3]; \ + W[d+3] = tmp0; \ + } while (0) + +#define SHIFT_ROW2(a, b, c, d) do { \ + tmp0 = W[a+0]; \ + W[a+0] = W[c+0]; \ + W[c+0] = tmp0; \ +\ + tmp0 = W[a+1]; \ + W[a+1] = W[c+1]; \ + W[c+1] = tmp0; \ +\ + tmp0 = W[a+2]; \ + W[a+2] = W[c+2]; \ + W[c+2] = tmp0; \ +\ + tmp0 = W[a+3]; \ + W[a+3] = W[c+3]; \ + W[c+3] = tmp0; \ +\ + tmp0 = W[b+0]; \ + W[b+0] = W[d+0]; \ + W[d+0] = tmp0; \ +\ + tmp0 = W[b+1]; \ + W[b+1] = W[d+1]; \ + W[d+1] = tmp0; \ +\ + tmp0 = W[b+2]; \ + W[b+2] = W[d+2]; \ + W[d+2] = tmp0; \ +\ + tmp0 = W[b+3]; \ + W[b+3] = W[d+3]; \ + W[d+3] = tmp0; \ + } while (0) + +#define MIX_COLUMN1(ia, ib, ic, id, n) do { \ + tmp0 = W[ia+n]; \ + unsigned int tmp1 = W[ic+n]; \ + unsigned int tmp2 = tmp0 ^ W[ib+n]; \ + unsigned int tmp3 = W[ib+n] ^ tmp1; \ + unsigned int tmp4 = tmp1 ^ W[id+n]; \ + unsigned int tmp5 = (((tmp2 & (0x80808080)) >> 7) * 27 ^ ((tmp2 & (0x7F7F7F7F)) << 1));\ + unsigned int tmp6 = (((tmp3 & (0x80808080)) >> 7) * 27 ^ ((tmp3 & (0x7F7F7F7F)) << 1));\ + unsigned int tmp7 = (((tmp4 & (0x80808080)) >> 7) * 27 ^ ((tmp4 & (0x7F7F7F7F)) << 1));\ + W[ia+n] = tmp5 ^ tmp3 ^ W[id+n]; \ + W[ib+n] = tmp6 ^ tmp0 ^ tmp4; \ + W[ic+n] = tmp7 ^ tmp2 ^ W[id+n]; \ + W[id+n] = tmp5^tmp6^tmp7^tmp2^tmp1; \ + } while (0) + +#define MIX_COLUMN(a, b, c, d) do { \ + MIX_COLUMN1(a, b, c, d, 0); \ + MIX_COLUMN1(a, b, c, d, 1); \ + MIX_COLUMN1(a, b, c, d, 2); \ + MIX_COLUMN1(a, b, c, d, 3); \ + } while (0) +//END OF ECHO MACROS------------------------- + +__device__ __forceinline__ +static void SIMD_Compress(uint32_t *A,const uint32_t thr_offset,const uint4 *const __restrict__ g_fft4){ + + uint32_t IV[32]; + + *(uint2x4*)&IV[ 0] = *(uint2x4*)&c_IV_512[ 0]; + *(uint2x4*)&IV[ 8] = *(uint2x4*)&c_IV_512[ 8]; + *(uint2x4*)&IV[16] = *(uint2x4*)&c_IV_512[16]; + *(uint2x4*)&IV[24] = *(uint2x4*)&c_IV_512[24]; + + Round8(A, thr_offset, g_fft4); + + const uint32_t a[4] = {4,13,10,25}; + + for(int i=0;i<4;i++) + STEP8_IF(&IV[i*8],32+i,a[i],a[(i+1)&3],&A[(0+i*24)&31],&A[(8+i*24)&31],&A[(16+i*24)&31],&A[(24+i*24)&31]); + + #pragma unroll 32 + for(uint32_t i=0;i<32;i++){ + IV[ i] = A[ i]; + } + + A[ 0] ^= 512; + + Round8_0_final(A, 3,23,17,27); + Round8_1_final(A,28,19,22, 7); + Round8_2_final(A,29, 9,15, 5); + Round8_3_final(A, 4,13,10,25); + + for(int i=0;i<4;i++) + STEP8_IF(&IV[i*8],32+i,a[i],a[(i+1)&3],&A[(0+i*24)&31],&A[(8+i*24)&31],&A[(16+i*24)&31],&A[(24+i*24)&31]); + +} + +__device__ +static void echo_round(const uint32_t sharedMemory[4][256], uint32_t* W, uint32_t &k0){ + // Big Sub Words + #pragma unroll 4 + for (int idx = 0; idx < 16; idx++){ + AES_2ROUND(sharedMemory,W[(idx<<2) + 0], W[(idx<<2) + 1], W[(idx<<2) + 2], W[(idx<<2) + 3], k0); + idx++; + AES_2ROUND_LDG(sharedMemory,W[(idx<<2) + 0], W[(idx<<2) + 1], W[(idx<<2) + 2], W[(idx<<2) + 3], k0); + idx++; + AES_2ROUND_LDG(sharedMemory,W[(idx<<2) + 0], W[(idx<<2) + 1], W[(idx<<2) + 2], W[(idx<<2) + 3], k0); + idx++; + AES_2ROUND(sharedMemory,W[(idx<<2) + 0], W[(idx<<2) + 1], W[(idx<<2) + 2], W[(idx<<2) + 3], k0); + } + uint32_t tmp0; + SHIFT_ROW1(4, 20, 36, 52); + SHIFT_ROW2(8, 24, 40, 56); + SHIFT_ROW1(60,44, 28, 12); + // Mix Columns + #pragma unroll 4 + for (int i = 0; i < 4; i++){ // Schleife über je 2*uint32_t + #pragma unroll 4 + for (int idx = 0; idx < 64; idx += 16){ // Schleife über die elemnte + uint32_t a[4]; + a[0] = W[idx + i]; + a[1] = W[idx + i + 4]; + a[2] = W[idx + i + 8]; + a[3] = W[idx + i +12]; + + uint32_t ab = a[0] ^ a[1]; + uint32_t bc = a[1] ^ a[2]; + uint32_t cd = a[2] ^ a[3]; + + uint32_t t, t2, t3; + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + uint32_t abx = (t >> 7) * 27U ^ ((ab^t) << 1); + uint32_t bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + uint32_t cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[idx + i] = bc ^ a[3] ^ abx; + W[idx + i + 4] = a[0] ^ cd ^ bcx; + W[idx + i + 8] = ab ^ a[3] ^ cdx; + W[idx + i +12] = ab ^ a[2] ^ (abx ^ bcx ^ cdx); + } + } +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB52_2,5) +#else +__launch_bounds__(TPB50_2,5) +#endif +static void x11_simd512_gpu_compress_64_maxwell_echo512_final(const uint32_t* __restrict__ g_hash,const uint4 *const __restrict__ g_fft4,uint32_t* resNonce, const uint64_t target) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + const uint32_t thr_offset = thread << 6; // thr_id * 128 (je zwei elemente) + + __shared__ uint32_t sharedMemory[4][256]; + + aes_gpu_init128(sharedMemory); + + const uint32_t P[48] = { + 0xe7e9f5f5, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0xa4213d7e, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x01425eb8, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0x65978b09, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x2cb6b661, 0x6b23b3b3, 0xcf93a7cf, 0x9d9d3751,0x9ac2dea3, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x579f9f33, 0xfbfbfbfb, 0xfbfbfbfb, 0xefefd3c7,0xdbfde1dd, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x34514d9e, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0xb134347e, 0xea6f7e7e, 0xbd7731bd, 0x8a8a1968, + 0x14b8a457, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0x265f4382, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af + }; + uint32_t k0; + uint32_t h[16]; + +// if (thread < threads){ + + const uint32_t* __restrict__ Hash = &g_hash[thread<<4]; + + uint32_t A[32]; + + *(uint2x4*)&A[ 0] = *(uint2x4*)&c_IV_512[ 0] ^ __ldg4((uint2x4*)&Hash[ 0]); + *(uint2x4*)&A[ 8] = *(uint2x4*)&c_IV_512[ 8] ^ __ldg4((uint2x4*)&Hash[ 8]); + *(uint2x4*)&A[16] = *(uint2x4*)&c_IV_512[16]; + *(uint2x4*)&A[24] = *(uint2x4*)&c_IV_512[24]; + + SIMD_Compress(A, thr_offset, g_fft4); + + #pragma unroll 16 + for(int i=0;i<16;i++){ + h[i] = A[i]; + } + + uint64_t backup = *(uint64_t*)&h[ 6]; + + k0 = 512 + 8; + + #pragma unroll 2 + for (uint32_t idx = 0; idx < 16; idx += 4){ + AES_2ROUND(sharedMemory,h[idx + 0], h[idx + 1], h[idx + 2], h[idx + 3], k0); + idx+=4; + AES_2ROUND_LDG(sharedMemory,h[idx + 0], h[idx + 1], h[idx + 2], h[idx + 3], k0); + } + k0 += 4; + + uint32_t W[64]; + +// #pragma unroll 4 + for (int i = 0; i < 4; i++){ + uint32_t a = P[i]; + uint32_t b = P[i + 4]; + uint32_t c = h[i + 8]; + uint32_t d = P[i + 8]; + + uint32_t ab = a ^ b; + uint32_t bc = b ^ c; + uint32_t cd = c ^ d; + + + uint32_t t = ((a ^ b) & 0x80808080); + uint32_t t2 = ((b ^ c) & 0x80808080); + uint32_t t3 = ((c ^ d) & 0x80808080); + + uint32_t abx = ((t >> 7) * 27U) ^ ((ab^t) << 1); + uint32_t bcx = ((t2 >> 7) * 27U) ^ ((bc^t2) << 1); + uint32_t cdx = ((t3 >> 7) * 27U) ^ ((cd^t3) << 1); + + W[0U + i] = bc ^ d ^ abx; + W[4U + i] = a ^ cd ^ bcx; + W[8U + i] = ab ^ d ^ cdx; + W[12U+ i] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = P[12U + i]; + b = h[i + 4U]; + c = P[12U + i + 4U]; + d = P[12U + i + 8U]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[16U + i] = abx ^ bc ^ d; + W[16U + i + 4U] = bcx ^ a ^ cd; + W[16U + i + 8U] = cdx ^ ab ^ d; + W[16U + i +12U] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = h[i]; + b = P[24U + i + 0U]; + c = P[24U + i + 4U]; + d = P[24U + i + 8U]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[32U + i] = abx ^ bc ^ d; + W[32U + i + 4U] = bcx ^ a ^ cd; + W[32U + i + 8U] = cdx ^ ab ^ d; + W[32U + i +12U] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = P[36U + i ]; + b = P[36U + i + 4U]; + c = P[36U + i + 8U]; + d = h[i + 12U]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[48U + i] = abx ^ bc ^ d; + W[48U + i + 4U] = bcx ^ a ^ cd; + W[48U + i + 8U] = cdx ^ ab ^ d; + W[48U + i +12U] = abx ^ bcx ^ cdx ^ ab ^ c; + } + + for (int k = 1; k < 9; k++){ + echo_round(sharedMemory,W,k0); + } + + // Big Sub Words + uint32_t y[4]; + aes_round(sharedMemory, W[ 0], W[ 1], W[ 2], W[ 3], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[ 0], W[ 1], W[ 2], W[ 3]); + aes_round(sharedMemory, W[ 4], W[ 5], W[ 6], W[ 7], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[ 4], W[ 5], W[ 6], W[ 7]); + aes_round(sharedMemory, W[ 8], W[ 9], W[10], W[11], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[ 8], W[ 9], W[10], W[11]); + aes_round(sharedMemory, W[20], W[21], W[22], W[23], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[20], W[21], W[22], W[23]); + aes_round(sharedMemory, W[28], W[29], W[30], W[31], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[28], W[29], W[30], W[31]); + aes_round(sharedMemory, W[32], W[33], W[34], W[35], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[32], W[33], W[34], W[35]); + aes_round(sharedMemory, W[40], W[41], W[42], W[43], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[40], W[41], W[42], W[43]); + aes_round(sharedMemory, W[52], W[53], W[54], W[55], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[52], W[53], W[54], W[55]); + aes_round(sharedMemory, W[60], W[61], W[62], W[63], k0, y[0], y[1], y[2], y[3]); + aes_round(sharedMemory, y[ 0], y[ 1], y[ 2], y[ 3], W[60], W[61], W[62], W[63]); + + uint32_t bc = W[22] ^ W[42]; + uint32_t t2 = (bc & 0x80808080); + W[ 6] = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + + bc = W[23] ^ W[43]; + t2 = (bc & 0x80808080); + W[ 7] = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + + bc = W[10] ^ W[54]; + t2 = (bc & 0x80808080); + W[38] = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + + bc = W[11] ^ W[55]; + t2 = (bc & 0x80808080); + W[39] = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + + uint64_t check = backup ^ *(uint64_t*)&W[2] ^ *(uint64_t*)&W[6] ^ *(uint64_t*)&W[10] ^ *(uint64_t*)&W[30] ^ *(uint64_t*)&W[34] ^ *(uint64_t*)&W[38] ^ *(uint64_t*)&W[42] ^ *(uint64_t*)&W[62]; + if(check <= target){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } +// } +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(TPB52_2,6) +#else +__launch_bounds__(TPB50_2,6) +#endif +static void x11_simd512_gpu_compress_64_maxwell_echo512(uint32_t *g_hash,const uint4 *const __restrict__ g_fft4) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + const uint32_t thr_offset = thread << 6; // thr_id * 128 (je zwei elemente) + + __shared__ uint32_t sharedMemory[4][256]; + + aes_gpu_init128(sharedMemory); + + const uint32_t P[48] = { + 0xe7e9f5f5, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0xa4213d7e, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x01425eb8, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0x65978b09, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x2cb6b661, 0x6b23b3b3, 0xcf93a7cf, 0x9d9d3751,0x9ac2dea3, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x579f9f33, 0xfbfbfbfb, 0xfbfbfbfb, 0xefefd3c7,0xdbfde1dd, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af, + 0x34514d9e, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0xb134347e, 0xea6f7e7e, 0xbd7731bd, 0x8a8a1968, + 0x14b8a457, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af,0x265f4382, 0xf5e7e9f5, 0xb3b36b23, 0xb3dbe7af + }; + uint32_t k0; + uint32_t h[16]; + +// if (thread < threads){ + + uint32_t *Hash = &g_hash[thread<<4]; + + uint32_t A[32]; + + *(uint2x4*)&A[ 0] = *(uint2x4*)&c_IV_512[ 0] ^ __ldg4((uint2x4*)&Hash[ 0]); + *(uint2x4*)&A[ 8] = *(uint2x4*)&c_IV_512[ 8] ^ __ldg4((uint2x4*)&Hash[ 8]); + *(uint2x4*)&A[16] = *(uint2x4*)&c_IV_512[16]; + *(uint2x4*)&A[24] = *(uint2x4*)&c_IV_512[24]; + + __syncthreads(); + + SIMD_Compress(A, thr_offset, g_fft4); + + #pragma unroll 16 + for(int i=0;i<16;i++){ + h[i] = A[i]; + } + + k0 = 512 + 8; + + #pragma unroll 4 + for (uint32_t idx = 0; idx < 16; idx += 4) + AES_2ROUND(sharedMemory,h[idx + 0], h[idx + 1], h[idx + 2], h[idx + 3], k0); + + k0 += 4; + + uint32_t W[64]; + +// #pragma unroll 4 + for (int i = 0; i < 4; i++){ + uint32_t a = P[i]; + uint32_t b = P[i + 4]; + uint32_t c = h[i + 8]; + uint32_t d = P[i + 8]; + + uint32_t ab = a ^ b; + uint32_t bc = b ^ c; + uint32_t cd = c ^ d; + + + uint32_t t = ((a ^ b) & 0x80808080); + uint32_t t2 = ((b ^ c) & 0x80808080); + uint32_t t3 = ((c ^ d) & 0x80808080); + + uint32_t abx = ((t >> 7) * 27U) ^ ((ab^t) << 1); + uint32_t bcx = ((t2 >> 7) * 27U) ^ ((bc^t2) << 1); + uint32_t cdx = ((t3 >> 7) * 27U) ^ ((cd^t3) << 1); + + W[0U + i] = bc ^ d ^ abx; + W[4U + i] = a ^ cd ^ bcx; + W[8U + i] = ab ^ d ^ cdx; + W[12U+ i] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = P[12U + i]; + b = h[i + 4U]; + c = P[12U + i + 4U]; + d = P[12U + i + 8U]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[16U + i] = abx ^ bc ^ d; + W[16U + i + 4U] = bcx ^ a ^ cd; + W[16U + i + 8U] = cdx ^ ab ^ d; + W[16U + i +12U] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = h[i]; + b = P[24U + i + 0U]; + c = P[24U + i + 4U]; + d = P[24U + i + 8U]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[32U + i] = abx ^ bc ^ d; + W[32U + i + 4U] = bcx ^ a ^ cd; + W[32U + i + 8U] = cdx ^ ab ^ d; + W[32U + i +12U] = abx ^ bcx ^ cdx ^ ab ^ c; + + a = P[36U + i ]; + b = P[36U + i + 4U]; + c = P[36U + i + 8U]; + d = h[i + 12U]; + + ab = a ^ b; + bc = b ^ c; + cd = c ^ d; + + t = (ab & 0x80808080); + t2 = (bc & 0x80808080); + t3 = (cd & 0x80808080); + + abx = (t >> 7) * 27U ^ ((ab^t) << 1); + bcx = (t2 >> 7) * 27U ^ ((bc^t2) << 1); + cdx = (t3 >> 7) * 27U ^ ((cd^t3) << 1); + + W[48U + i] = abx ^ bc ^ d; + W[48U + i + 4U] = bcx ^ a ^ cd; + W[48U + i + 8U] = cdx ^ ab ^ d; + W[48U + i +12U] = abx ^ bcx ^ cdx ^ ab ^ c; + } + + for (int k = 1; k < 10; k++){ + echo_round(sharedMemory,W,k0); + } + #pragma unroll 4 + for (uint32_t i = 0; i < 16; i += 4) + { + W[i] ^= W[32 + i] ^ 512; + W[i + 1] ^= W[32 + i + 1]; + W[i + 2] ^= W[32 + i + 2]; + W[i + 3] ^= W[32 + i + 3]; + } + *(uint2x4*)&Hash[ 0] = *(uint2x4*)&A[ 0] ^ *(uint2x4*)&W[ 0]; + *(uint2x4*)&Hash[ 8] = *(uint2x4*)&A[ 8] ^ *(uint2x4*)&W[ 8]; +// } +} + +__host__ +void x11_simd_echo_512_cpu_init(int thr_id, uint32_t threads){ + cudaMalloc(&d_temp4[thr_id], 64*sizeof(uint4)*threads); +} + +__host__ +void x11_simd_echo_512_cpu_free(int thr_id){ + cudaFree(d_temp4[thr_id]); +} + +__host__ +void x11_simd_echo512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target){ + + int dev_id = device_map[thr_id]; + + uint32_t tpb = TPB52_1; + if (device_sm[dev_id] <= 500) tpb = TPB50_1; + const dim3 grid1((8*threads + tpb - 1) / tpb); + const dim3 block1(tpb); + + tpb = TPB52_2; + if (device_sm[dev_id] <= 500) tpb = TPB50_2; + const dim3 grid2((threads + tpb - 1) / tpb); + const dim3 block2(tpb); + + x11_simd512_gpu_expand_64 <<>> (threads, d_hash, d_temp4[thr_id]); + x11_simd512_gpu_compress_64_maxwell_echo512_final <<< grid2, block2 >>> (d_hash, d_temp4[thr_id],d_resNonce,target); +} + +__host__ +void x11_simd_echo512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash){ + + int dev_id = device_map[thr_id]; + + uint32_t tpb = TPB52_1; + if (device_sm[dev_id] <= 500) tpb = TPB50_1; + const dim3 grid1((8*threads + tpb - 1) / tpb); + const dim3 block1(tpb); + + tpb = TPB52_2; + if (device_sm[dev_id] <= 500) tpb = TPB50_2; + const dim3 grid2((threads + tpb - 1) / tpb); + const dim3 block2(tpb); + + x11_simd512_gpu_expand_64 <<>> (threads, d_hash, d_temp4[thr_id]); + x11_simd512_gpu_compress_64_maxwell_echo512 <<< grid2, block2 >>> (d_hash, d_temp4[thr_id]); +} diff --git a/x11/x11.cu b/x11/x11.cu new file mode 100644 index 0000000..89b6b54 --- /dev/null +++ b/x11/x11.cu @@ -0,0 +1,226 @@ +extern "C" { +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" +} + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_x11.h" + +#include +#include + +#define NBN 2 + +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +// X11 CPU Hash +extern "C" void x11hash(void *output, const void *input) +{ + unsigned char _ALIGN(128) hash[128] = { 0 }; + + // blake1-bmw2-grs3-skein4-jh5-keccak6-luffa7-cubehash8-shavite9-simd10-echo11 + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, (void*) hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512 (&ctx_bmw, (const void*) hash, 64); + sph_bmw512_close(&ctx_bmw, (void*) hash); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, (void*) hash); + + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, (void*) hash); + + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, (void*) hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + + sph_luffa512_init(&ctx_luffa); + sph_luffa512 (&ctx_luffa, (const void*) hash, 64); + sph_luffa512_close (&ctx_luffa, (void*) hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512 (&ctx_cubehash, (const void*) hash, 64); + sph_cubehash512_close(&ctx_cubehash, (void*) hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512 (&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, (void*) hash); + + sph_simd512_init(&ctx_simd); + sph_simd512 (&ctx_simd, (const void*) hash, 64); + sph_simd512_close(&ctx_simd, (void*) hash); + + sph_echo512_init(&ctx_echo); + sph_echo512 (&ctx_echo, (const void*) hash, 64); + sph_echo512_close(&ctx_echo, (void*) hash); + + memcpy(output, hash, 32); +} + +//#define _DEBUG +#define _DEBUG_PREFIX "x11" +#include "cuda_debug.cuh" + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_x11(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + + const int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<20; + else if(device_sm[dev_id]<=520) default_throughput = 1<<21; + else if(device_sm[dev_id]>520) default_throughput = 1<<22; + + if((strstr(device_name[dev_id], "3GB")))default_throughput = 1<<21; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + throughput&=0xFFFFFF70; //multiples of 128 due to cubehash_shavite & simd_echo kernels + + if (opt_benchmark) + ptarget[7] = 0x5; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + uint32_t endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + + do { + // Hash with CUDA + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_keccak512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id], d_resNonce[thr_id], *(uint64_t*)&ptarget[6]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + x11hash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", h_resNonce[thr_id][1]); + be32enc(&endiandata[19], startNounce+h_resNonce[thr_id][1]); + x11hash(vhash64, endiandata); + pdata[21] = startNounce+h_resNonce[thr_id][1]; + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, dev_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && (((uint64_t)pdata[19] + (uint64_t)throughput) < (uint64_t)max_nonce)); + + *hashes_done = pdata[19] - first_nonce; + + return 0; +} + +// cleanup +extern "C" void free_x11(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/x11/x11evo.cu b/x11/x11evo.cu new file mode 100644 index 0000000..dc5bef7 --- /dev/null +++ b/x11/x11evo.cu @@ -0,0 +1,392 @@ +/** + * X11EVO algo implementation + * Cuda implementation by tpruvot@github - May 2016 + */ +#include +#include + +extern "C" { +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" +} + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_x11.h" + +static uint32_t *d_hash[MAX_GPUS]; + +enum Algo { + BLAKE = 0, + BMW, + GROESTL, + SKEIN, + JH, + KECCAK, + LUFFA, + CUBEHASH, + SHAVITE, + SIMD, + ECHO, + HASH_FUNC_COUNT +}; + +static void swap8(uint8_t *a, uint8_t *b) +{ + uint8_t t = *a; + *a = *b; + *b = t; +} + +static void initPerm(uint8_t n[], int count) +{ + for (int i = 0; i < count; i++) + n[i] = i; +} + +static int nextPerm(uint8_t n[], int count) +{ + int tail, i, j; + + if (count <= 1) + return 0; + + for (i = count - 1; i>0 && n[i - 1] >= n[i]; i--); + tail = i; + + if (tail > 0) { + for (j = count - 1; j>tail && n[j] <= n[tail - 1]; j--); + swap8(&n[tail - 1], &n[j]); + } + + for (i = tail, j = count - 1; i= 10) + sprintf(sptr, "%c", 'A' + (algoList[j] - 10)); + else + sprintf(sptr, "%u", (uint32_t) algoList[j]); + sptr++; + } + *sptr = '\0'; + //applog(LOG_DEBUG, "nextPerm %s", str); +} + +static __thread uint32_t s_ntime = 0; +static char hashOrder[HASH_FUNC_COUNT + 1] = { 0 }; +static int s_sequence = -1; + +#define INITIAL_DATE 0x57254700 +static inline int getCurrentAlgoSeq(uint32_t current_time) +{ + // change once per day + return (int) (current_time - INITIAL_DATE) / (60 * 60 * 24); +} + +static void evo_twisted_code(uint32_t ntime, char *permstr) +{ + int seq = getCurrentAlgoSeq(ntime); + if (s_sequence != seq) { + getAlgoString(permstr, seq); + s_sequence = seq; + } +} + +// X11evo CPU Hash +extern "C" void x11evo_hash(void *output, const void *input) +{ + uint32_t _ALIGN(64) hash[64/4] = { 0 }; + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_skein512_context ctx_skein; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_luffa512_context ctx_luffa1; + sph_cubehash512_context ctx_cubehash1; + sph_shavite512_context ctx_shavite1; + sph_simd512_context ctx_simd1; + sph_echo512_context ctx_echo1; + + if (s_sequence == -1) { + uint32_t *data = (uint32_t*) input; + const uint32_t ntime = data[17]; + evo_twisted_code(ntime, hashOrder); + } + + void *in = (void*) input; + int size = 80; + + const int hashes = (int) strlen(hashOrder); + + for (int i = 0; i < hashes; i++) + { + const char elem = hashOrder[i]; + uint8_t algo = elem >= 'A' ? elem - 'A' + 10 : elem - '0'; + + if (i > 0) { + in = (void*) hash; + size = 64; + } + + switch (algo) { + case BLAKE: + sph_blake512_init(&ctx_blake); + sph_blake512(&ctx_blake, in, size); + sph_blake512_close(&ctx_blake, hash); + break; + case BMW: + sph_bmw512_init(&ctx_bmw); + sph_bmw512(&ctx_bmw, in, size); + sph_bmw512_close(&ctx_bmw, hash); + break; + case GROESTL: + sph_groestl512_init(&ctx_groestl); + sph_groestl512(&ctx_groestl, in, size); + sph_groestl512_close(&ctx_groestl, hash); + break; + case SKEIN: + sph_skein512_init(&ctx_skein); + sph_skein512(&ctx_skein, in, size); + sph_skein512_close(&ctx_skein, hash); + break; + case JH: + sph_jh512_init(&ctx_jh); + sph_jh512(&ctx_jh, in, size); + sph_jh512_close(&ctx_jh, hash); + break; + case KECCAK: + sph_keccak512_init(&ctx_keccak); + sph_keccak512(&ctx_keccak, in, size); + sph_keccak512_close(&ctx_keccak, hash); + break; + case LUFFA: + sph_luffa512_init(&ctx_luffa1); + sph_luffa512(&ctx_luffa1, in, size); + sph_luffa512_close(&ctx_luffa1, hash); + break; + case CUBEHASH: + sph_cubehash512_init(&ctx_cubehash1); + sph_cubehash512(&ctx_cubehash1, in, size); + sph_cubehash512_close(&ctx_cubehash1, hash); + break; + case SHAVITE: + sph_shavite512_init(&ctx_shavite1); + sph_shavite512(&ctx_shavite1, in, size); + sph_shavite512_close(&ctx_shavite1, hash); + break; + case SIMD: + sph_simd512_init(&ctx_simd1); + sph_simd512(&ctx_simd1, in, size); + sph_simd512_close(&ctx_simd1, hash); + break; + case ECHO: + sph_echo512_init(&ctx_echo1); + sph_echo512(&ctx_echo1, in, size); + sph_echo512_close(&ctx_echo1, hash); + break; + } + } + + memcpy(output, hash, 32); +} + +//#define _DEBUG +#define _DEBUG_PREFIX "evo" +#include "cuda_debug.cuh" + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_x11evo(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + + uint32_t dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<20; + else if(device_sm[dev_id]<=520) default_throughput = 1<<21; + else if(device_sm[dev_id]>520) default_throughput = 1<<22; + + if((strstr(device_name[dev_id], "3GB")))default_throughput = 1<<21; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_debug || s_ntime != pdata[17] || s_sequence == -1) { + uint32_t ntime = swab32(work->data[17]); + evo_twisted_code(ntime, hashOrder); + s_ntime = pdata[17]; + if (opt_debug) { + int secs = (int) (ntime - INITIAL_DATE) % (60 * 60 * 24); + secs = (60 * 60 * 24) - secs; + applog(LOG_DEBUG, "evo hash order %s, next in %d mn", hashOrder, secs/60); + } + } + + if (opt_benchmark) + ptarget[7] = 0x0; + + if (!init[thr_id]){ + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd512_cpu_init(thr_id, throughput); + + CUDA_CALL_OR_RET_X(cudaMalloc(&d_hash[thr_id], (size_t) 64 * throughput), 0); + + cuda_check_cpu_init(thr_id, throughput); + + init[thr_id] = true; + } + + uint32_t endiandata[20]; + for (int k=0; k < 19; k++) + be32enc(&endiandata[k], pdata[k]); + + cuda_check_cpu_setTarget(ptarget); + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + + const int hashes = (int) strlen(hashOrder); + + do { + uint32_t foundNonce; + + // Hash with CUDA + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + + for (int i = 1; i < hashes; i++) + { + const char elem = hashOrder[i]; + const uint8_t algo64 = elem >= 'A' ? elem - 'A' + 10 : elem - '0'; + + switch (algo64) { + case BLAKE: + quark_blake512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + break; + case BMW: + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + break; + case GROESTL: + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + break; + case SKEIN: + quark_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + break; + case JH: + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + break; + case KECCAK: + quark_keccak512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + break; + case LUFFA: + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + break; + case CUBEHASH: + x11_cubehash512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + break; + case SHAVITE: + x11_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + break; + case SIMD: + x11_simd512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + break; + case ECHO: + x11_echo512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + break; + } + } + + foundNonce = cuda_check_hash(thr_id, throughput, pdata[19], d_hash[thr_id]); + if (foundNonce != UINT32_MAX) + { + uint32_t _ALIGN(64) vhash64[8]; + const uint32_t Htarg = ptarget[7]; + be32enc(&endiandata[19], foundNonce); + x11evo_hash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + // check if there was some other ones... + uint32_t secNonce = cuda_check_hash_suppl(thr_id, throughput, pdata[19], d_hash[thr_id], 1); + work_set_target_ratio(work, vhash64); + *hashes_done = pdata[19] - first_nonce + throughput; + pdata[19] = foundNonce; + if (secNonce != 0) { +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", secNonce); + be32enc(&endiandata[19], secNonce); + pdata[21] = secNonce; + x11evo_hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + res++; + } + return res; + } else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNonce); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce; + + return 0; +} + +// cleanup +extern "C" void free_x11evo(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + cudaFree(d_hash[thr_id]); + + x11_simd512_cpu_free(thr_id); + cuda_check_cpu_free(thr_id); + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/x13/cuda_hsr_sm3.cu b/x13/cuda_hsr_sm3.cu new file mode 100644 index 0000000..5ce0186 --- /dev/null +++ b/x13/cuda_hsr_sm3.cu @@ -0,0 +1,139 @@ +#include +#include +#include + +#include +#include + +#define F(x, y, z) (((x) ^ (y) ^ (z))) +#define FF(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) +#define GG(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) + +#define P0(x) x ^ ROTL32(x, 9) ^ ROTL32(x, 17) +#define P1(x) x ^ ROTL32(x, 15) ^ ROTL32(x, 23) + +static __forceinline__ __device__ +void sm3_compress2(uint32_t digest[8], const uint32_t pblock[16]) +{ + uint32_t tt1, tt2, i, t, ss1, ss2, x, y; + uint32_t w[68]; + uint32_t a = digest[0]; + uint32_t b = digest[1]; + uint32_t c = digest[2]; + uint32_t d = digest[3]; + uint32_t e = digest[4]; + uint32_t f = digest[5]; + uint32_t g = digest[6]; + uint32_t h = digest[7]; + + #pragma unroll + for (i = 0; i<16; i++) { + w[i] = cuda_swab32(pblock[i]); + } + + for (i = 16; i<68; i++) { + x = ROTL32(w[i - 3], 15); + y = ROTL32(w[i - 13], 7); + + x ^= w[i - 16]; + x ^= w[i - 9]; + y ^= w[i - 6]; + + w[i] = P1(x) ^ y; + } + + for (i = 0; i<64; i++) { + + t = (i < 16) ? 0x79cc4519 : 0x7a879d8a; + + ss2 = ROTL32(a, 12); + ss1 = ROTL32(ss2 + e + ROTL32(t, i), 7); + ss2 ^= ss1; + + tt1 = d + ss2 + (w[i] ^ w[i + 4]); + tt2 = h + ss1 + w[i]; + + if (i < 16) { + tt1 += F(a, b, c); + tt2 += F(e, f, g); + } + else { + tt1 += FF(a, b, c); + tt2 += GG(e, f, g); + } + d = c; + c = ROTL32(b, 9); + b = a; + a = tt1; + h = g; + g = ROTL32(f, 19); + f = e; + e = P0(tt2); + } + + digest[0] ^= a; + digest[1] ^= b; + digest[2] ^= c; + digest[3] ^= d; + digest[4] ^= e; + digest[5] ^= f; + digest[6] ^= g; + digest[7] ^= h; +} + +/***************************************************/ +// GPU Hash Function +__global__ +void sm3_gpu_hash_64(const uint32_t threads, uint32_t *g_hash) +{ + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads) + { + const size_t hashPosition = thread; + + uint32_t digest[8]; + digest[0] = 0x7380166F; + digest[1] = 0x4914B2B9; + digest[2] = 0x172442D7; + digest[3] = 0xDA8A0600; + digest[4] = 0xA96F30BC; + digest[5] = 0x163138AA; + digest[6] = 0xE38DEE4D; + digest[7] = 0xB0FB0E4E; + + uint32_t *pHash = &g_hash[hashPosition << 4]; + sm3_compress2(digest, pHash); + + uint32_t block[16]; + block[0] = 0x80; + + #pragma unroll + for (int i = 1; i < 14; i++) + block[i] = 0; + + // count + block[14] = cuda_swab32(1 >> 23); + block[15] = cuda_swab32((1 << 9) + (0 << 3)); + + sm3_compress2(digest, block); + + for (int i = 0; i < 8; i++) + pHash[i] = cuda_swab32(digest[i]); + + for (int i = 8; i < 16; i++) + pHash[i] = 0; + } +} + +__host__ +void sm3_cuda_hash_64(int thr_id, uint32_t threads, uint32_t *g_hash, int order) +{ + const uint32_t threadsperblock = 256; + + dim3 grid((threads + threadsperblock - 1) / threadsperblock); + dim3 block(threadsperblock); + + sm3_gpu_hash_64 <<>>(threads, g_hash); + //MyStreamSynchronize(NULL, order, thr_id); +} diff --git a/x13/cuda_x13_fugue512.cu b/x13/cuda_x13_fugue512.cu new file mode 100644 index 0000000..b3d708a --- /dev/null +++ b/x13/cuda_x13_fugue512.cu @@ -0,0 +1,408 @@ +/* + * Quick and dirty addition of Fugue-512 for X13 + * + * Built on cbuchner1's implementation, actual hashing code + * heavily based on phm's sgminer + * + * + */ +#include "cuda_helper.h" +#include "miner.h" +#include "cuda_vectors.h" +/* + * X13 kernel implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2014-2016 phm, Provos Alexis + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software", to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author phm + * @author Provos Alexis (Applied partial shared Mem utilization under CUDA 7.5 for compute5.0/5.2 / 2016) + */ + +static __constant__ const uint32_t c_S[16] = { + 0x8807a57e, 0xe616af75, 0xc5d3e4db, 0xac9ab027, + 0xd915f117, 0xb6eecc54, 0x06e8020b, 0x4a92efd1, + 0xaac6e2c9, 0xddb21398, 0xcae65838, 0x437f203f, + 0x25ea78e7, 0x951fddd6, 0xda6ed11d, 0xe13e3567 +}; + +static __device__ uint32_t mixtab0[256] = { + 0x63633297, 0x7c7c6feb, 0x77775ec7, 0x7b7b7af7, 0xf2f2e8e5, 0x6b6b0ab7, 0x6f6f16a7, 0xc5c56d39, 0x303090c0, 0x01010704, 0x67672e87, 0x2b2bd1ac, 0xfefeccd5, 0xd7d71371, 0xabab7c9a, + 0x767659c3, 0xcaca4005, 0x8282a33e, 0xc9c94909, 0x7d7d68ef, 0xfafad0c5, 0x5959947f, 0x4747ce07, 0xf0f0e6ed, 0xadad6e82, 0xd4d41a7d, 0xa2a243be, 0xafaf608a, 0x9c9cf946, 0xa4a451a6, + 0x727245d3, 0xc0c0762d, 0xb7b728ea, 0xfdfdc5d9, 0x9393d47a, 0x2626f298, 0x363682d8, 0x3f3fbdfc, 0xf7f7f3f1, 0xcccc521d, 0x34348cd0, 0xa5a556a2, 0xe5e58db9, 0xf1f1e1e9, 0x71714cdf, + 0xd8d83e4d, 0x313197c4, 0x15156b54, 0x04041c10, 0xc7c76331, 0x2323e98c, 0xc3c37f21, 0x18184860, 0x9696cf6e, 0x05051b14, 0x9a9aeb5e, 0x0707151c, 0x12127e48, 0x8080ad36, 0xe2e298a5, + 0xebeba781, 0x2727f59c, 0xb2b233fe, 0x757550cf, 0x09093f24, 0x8383a43a, 0x2c2cc4b0, 0x1a1a4668, 0x1b1b416c, 0x6e6e11a3, 0x5a5a9d73, 0xa0a04db6, 0x5252a553, 0x3b3ba1ec, 0xd6d61475, + 0xb3b334fa, 0x2929dfa4, 0xe3e39fa1, 0x2f2fcdbc, 0x8484b126, 0x5353a257, 0xd1d10169, 0x00000000, 0xededb599, 0x2020e080, 0xfcfcc2dd, 0xb1b13af2, 0x5b5b9a77, 0x6a6a0db3, 0xcbcb4701, + 0xbebe17ce, 0x3939afe4, 0x4a4aed33, 0x4c4cff2b, 0x5858937b, 0xcfcf5b11, 0xd0d0066d, 0xefefbb91, 0xaaaa7b9e, 0xfbfbd7c1, 0x4343d217, 0x4d4df82f, 0x333399cc, 0x8585b622, 0x4545c00f, + 0xf9f9d9c9, 0x02020e08, 0x7f7f66e7, 0x5050ab5b, 0x3c3cb4f0, 0x9f9ff04a, 0xa8a87596, 0x5151ac5f, 0xa3a344ba, 0x4040db1b, 0x8f8f800a, 0x9292d37e, 0x9d9dfe42, 0x3838a8e0, 0xf5f5fdf9, + 0xbcbc19c6, 0xb6b62fee, 0xdada3045, 0x2121e784, 0x10107040, 0xffffcbd1, 0xf3f3efe1, 0xd2d20865, 0xcdcd5519, 0x0c0c2430, 0x1313794c, 0xececb29d, 0x5f5f8667, 0x9797c86a, 0x4444c70b, + 0x1717655c, 0xc4c46a3d, 0xa7a758aa, 0x7e7e61e3, 0x3d3db3f4, 0x6464278b, 0x5d5d886f, 0x19194f64, 0x737342d7, 0x60603b9b, 0x8181aa32, 0x4f4ff627, 0xdcdc225d, 0x2222ee88, 0x2a2ad6a8, + 0x9090dd76, 0x88889516, 0x4646c903, 0xeeeebc95, 0xb8b805d6, 0x14146c50, 0xdede2c55, 0x5e5e8163, 0x0b0b312c, 0xdbdb3741, 0xe0e096ad, 0x32329ec8, 0x3a3aa6e8, 0x0a0a3628, 0x4949e43f, + 0x06061218, 0x2424fc90, 0x5c5c8f6b, 0xc2c27825, 0xd3d30f61, 0xacac6986, 0x62623593, 0x9191da72, 0x9595c662, 0xe4e48abd, 0x797974ff, 0xe7e783b1, 0xc8c84e0d, 0x373785dc, 0x6d6d18af, + 0x8d8d8e02, 0xd5d51d79, 0x4e4ef123, 0xa9a97292, 0x6c6c1fab, 0x5656b943, 0xf4f4fafd, 0xeaeaa085, 0x6565208f, 0x7a7a7df3, 0xaeae678e, 0x08083820, 0xbaba0bde, 0x787873fb, 0x2525fb94, + 0x2e2ecab8, 0x1c1c5470, 0xa6a65fae, 0xb4b421e6, 0xc6c66435, 0xe8e8ae8d, 0xdddd2559, 0x747457cb, 0x1f1f5d7c, 0x4b4bea37, 0xbdbd1ec2, 0x8b8b9c1a, 0x8a8a9b1e, 0x70704bdb, 0x3e3ebaf8, + 0xb5b526e2, 0x66662983, 0x4848e33b, 0x0303090c, 0xf6f6f4f5, 0x0e0e2a38, 0x61613c9f, 0x35358bd4, 0x5757be47, 0xb9b902d2, 0x8686bf2e, 0xc1c17129, 0x1d1d5374, 0x9e9ef74e, 0xe1e191a9, + 0xf8f8decd, 0x9898e556, 0x11117744, 0x696904bf, 0xd9d93949, 0x8e8e870e, 0x9494c166, 0x9b9bec5a, 0x1e1e5a78, 0x8787b82a, 0xe9e9a989, 0xcece5c15, 0x5555b04f, 0x2828d8a0, 0xdfdf2b51, + 0x8c8c8906, 0xa1a14ab2, 0x89899212, 0x0d0d2334, 0xbfbf10ca, 0xe6e684b5, 0x4242d513, 0x686803bb, 0x4141dc1f, 0x9999e252, 0x2d2dc3b4, 0x0f0f2d3c, 0xb0b03df6, 0x5454b74b, 0xbbbb0cda, + 0x16166258 +}; + +#define mixtab0(x) shared[0][x] +#define mixtab1(x) shared[1][x] +#define mixtab2(x) shared[2][x] +#define mixtab3(x) shared[3][x] + +#define TIX4(q, x00, x01, x04, x07, x08, x22, x24, x27, x30) { \ + x22 ^= x00; \ + x00 = (q); \ + x08 ^= (q); \ + x01 ^= x24; \ + x04 ^= x27; \ + x07 ^= x30; \ + } + +#define CMIX36(x00, x01, x02, x04, x05, x06, x18, x19, x20) { \ + x00 ^= x04; \ + x01 ^= x05; \ + x02 ^= x06; \ + x18 ^= x04; \ + x19 ^= x05; \ + x20 ^= x06; \ + } + +__device__ __forceinline__ +static void SMIX(const uint32_t shared[4][256], uint32_t &x0,uint32_t &x1,uint32_t &x2,uint32_t &x3){ + uint32_t c0 = mixtab0(__byte_perm(x0,0,0x4443)); + uint32_t r1 = mixtab1(__byte_perm(x0,0,0x4442)); + uint32_t r2 = mixtab2(__byte_perm(x0,0,0x4441)); + uint32_t r3 = mixtab3(__byte_perm(x0,0,0x4440)); + c0 = c0 ^ r1 ^ r2 ^ r3; + uint32_t r0 = mixtab0(__byte_perm(x1,0,0x4443)); + uint32_t c1 = r0 ^ mixtab1(__byte_perm(x1,0,0x4442)); + uint32_t tmp = mixtab2(__byte_perm(x1,0,0x4441)); + c1 ^= tmp; + r2 ^= tmp; + tmp = mixtab3(__byte_perm(x1,0,0x4440)); + c1 ^= tmp; + r3 ^= tmp; + uint32_t c2 = mixtab0(__byte_perm(x2,0,0x4443)); + r0 ^= c2; + tmp = mixtab1(__byte_perm(x2,0,0x4442)); + c2 ^= tmp; + r1 ^= tmp; + tmp = mixtab2(__byte_perm(x2,0,0x4441)); + c2 ^= tmp; + tmp = mixtab3(__byte_perm(x2,0,0x4440)); + c2 ^= tmp; + r3 ^= tmp; + uint32_t c3 = mixtab0(__byte_perm(x3,0,0x4443)); + r0 ^= c3; + tmp = mixtab1(__byte_perm(x3,0,0x4442)); + c3 ^= tmp; + r1 ^= tmp; + tmp = mixtab2(__byte_perm(x3,0,0x4441)); + c3 ^= tmp; + r2 ^= tmp; + tmp = mixtab3(__byte_perm(x3,0,0x4440)); + c3 ^= tmp; + x0 = ((c0 ^ (r0 << 0)) & 0xFF000000) | ((c1 ^ (r1 << 0)) & 0x00FF0000) | ((c2 ^ (r2 << 0)) & 0x0000FF00) | ((c3 ^ (r3 << 0)) & 0x000000FF); + x1 = ((c1 ^ (r0 << 8)) & 0xFF000000) | ((c2 ^ (r1 << 8)) & 0x00FF0000) | ((c3 ^ (r2 << 8)) & 0x0000FF00) | ((c0 ^ (r3 >>24)) & 0x000000FF); + x2 = ((c2 ^ (r0 <<16)) & 0xFF000000) | ((c3 ^ (r1 <<16)) & 0x00FF0000) | ((c0 ^ (r2 >>16)) & 0x0000FF00) | ((c1 ^ (r3 >>16)) & 0x000000FF); + x3 = ((c3 ^ (r0 <<24)) & 0xFF000000) | ((c0 ^ (r1 >> 8)) & 0x00FF0000) | ((c1 ^ (r2 >> 8)) & 0x0000FF00) | ((c2 ^ (r3 >> 8)) & 0x000000FF); +} + +__device__ +static void SMIX_LDG(const uint32_t shared[4][256], uint32_t &x0,uint32_t &x1,uint32_t &x2,uint32_t &x3){ + uint32_t c0 = __ldg(&mixtab0[__byte_perm(x0,0,0x4443)]); + uint32_t r1 = mixtab1(__byte_perm(x0,0,0x4442)); + uint32_t r2 = mixtab2(__byte_perm(x0,0,0x4441)); + uint32_t r3 = mixtab3(__byte_perm(x0,0,0x4440)); + c0 = c0 ^ r1 ^ r2 ^ r3; + uint32_t r0 = __ldg(&mixtab0[__byte_perm(x1,0,0x4443)]); + uint32_t c1 = r0 ^ mixtab1(__byte_perm(x1,0,0x4442)); + uint32_t tmp = mixtab2(__byte_perm(x1,0,0x4441)); + c1 ^= tmp; + r2 ^= tmp; + tmp = mixtab3(__byte_perm(x1,0,0x4440)); + c1 ^= tmp; + r3 ^= tmp; + uint32_t c2 = __ldg(&mixtab0[__byte_perm(x2,0,0x4443)]); + r0 ^= c2; + tmp = mixtab1(__byte_perm(x2,0,0x4442)); + c2 ^= tmp; + r1 ^= tmp; + tmp = mixtab2(__byte_perm(x2,0,0x4441)); + c2 ^= tmp; + tmp = mixtab3(__byte_perm(x2,0,0x4440)); + c2 ^= tmp; + r3 ^= tmp; + uint32_t c3 = __ldg(&mixtab0[__byte_perm(x3,0,0x4443)]); + r0 ^= c3; + tmp = mixtab1(__byte_perm(x3,0,0x4442)); + c3 ^= tmp; + r1 ^= tmp; + tmp = mixtab2(__byte_perm(x3,0,0x4441)); + c3 ^= tmp; + r2 ^= tmp; + tmp = ROL8(__ldg(&mixtab0[__byte_perm(x3,0,0x4440)])); + c3 ^= tmp; + x0 = ((c0 ^ (r0 << 0)) & 0xFF000000) | ((c1 ^ (r1 << 0)) & 0x00FF0000) | ((c2 ^ (r2 << 0)) & 0x0000FF00) | ((c3 ^ (r3 << 0)) & 0x000000FF); + x1 = ((c1 ^ (r0 << 8)) & 0xFF000000) | ((c2 ^ (r1 << 8)) & 0x00FF0000) | ((c3 ^ (r2 << 8)) & 0x0000FF00) | ((c0 ^ (r3 >>24)) & 0x000000FF); + x2 = ((c2 ^ (r0 <<16)) & 0xFF000000) | ((c3 ^ (r1 <<16)) & 0x00FF0000) | ((c0 ^ (r2 >>16)) & 0x0000FF00) | ((c1 ^ (r3 >>16)) & 0x000000FF); + x3 = ((c3 ^ (r0 <<24)) & 0xFF000000) | ((c0 ^ (r1 >> 8)) & 0x00FF0000) | ((c1 ^ (r2 >> 8)) & 0x0000FF00) | ((c2 ^ (r3 >> 8)) & 0x000000FF); +} +#define mROR3 { \ + B[ 6] = S[33], B[ 7] = S[34], B[ 8] = S[35]; \ + S[35] = S[32]; S[34] = S[31]; S[33] = S[30]; S[32] = S[29]; S[31] = S[28]; S[30] = S[27]; S[29] = S[26]; S[28] = S[25]; S[27] = S[24]; \ + S[26] = S[23]; S[25] = S[22]; S[24] = S[21]; S[23] = S[20]; S[22] = S[19]; S[21] = S[18]; S[20] = S[17]; S[19] = S[16]; S[18] = S[15]; \ + S[17] = S[14]; S[16] = S[13]; S[15] = S[12]; S[14] = S[11]; S[13] = S[10]; S[12] = S[ 9]; S[11] = S[ 8]; S[10] = S[ 7]; S[ 9] = S[ 6]; \ + S[ 8] = S[ 5]; S[ 7] = S[ 4]; S[ 6] = S[ 3]; S[ 5] = S[ 2]; S[ 4] = S[ 1]; S[ 3] = S[ 0]; S[ 2] = B[ 8]; S[ 1] = B[ 7]; S[ 0] = B[ 6]; \ + } + +#define mROR8 { \ + B[ 1] = S[28], B[ 2] = S[29], B[ 3] = S[30], B[ 4] = S[31], B[ 5] = S[32], B[ 6] = S[33], B[ 7] = S[34], B[ 8] = S[35]; \ + S[35] = S[27]; S[34] = S[26]; S[33] = S[25]; S[32] = S[24]; S[31] = S[23]; S[30] = S[22]; S[29] = S[21]; S[28] = S[20]; S[27] = S[19]; \ + S[26] = S[18]; S[25] = S[17]; S[24] = S[16]; S[23] = S[15]; S[22] = S[14]; S[21] = S[13]; S[20] = S[12]; S[19] = S[11]; S[18] = S[10]; \ + S[17] = S[ 9]; S[16] = S[ 8]; S[15] = S[ 7]; S[14] = S[ 6]; S[13] = S[ 5]; S[12] = S[ 4]; S[11] = S[ 3]; S[10] = S[ 2]; S[ 9] = S[ 1]; \ + S[ 8] = S[ 0]; S[ 7] = B[ 8]; S[ 6] = B[ 7]; S[ 5] = B[ 6]; S[ 4] = B[ 5]; S[ 3] = B[ 4]; S[ 2] = B[ 3]; S[ 1] = B[ 2]; S[ 0] = B[ 1]; \ + } + +#define mROR9 { \ + B[ 0] = S[27], B[ 1] = S[28], B[ 2] = S[29], B[ 3] = S[30], B[ 4] = S[31], B[ 5] = S[32], B[ 6] = S[33], B[ 7] = S[34], B[ 8] = S[35]; \ + S[35] = S[26]; S[34] = S[25]; S[33] = S[24]; S[32] = S[23]; S[31] = S[22]; S[30] = S[21]; S[29] = S[20]; S[28] = S[19]; S[27] = S[18]; \ + S[26] = S[17]; S[25] = S[16]; S[24] = S[15]; S[23] = S[14]; S[22] = S[13]; S[21] = S[12]; S[20] = S[11]; S[19] = S[10]; S[18] = S[ 9]; \ + S[17] = S[ 8]; S[16] = S[ 7]; S[15] = S[ 6]; S[14] = S[ 5]; S[13] = S[ 4]; S[12] = S[ 3]; S[11] = S[ 2]; S[10] = S[ 1]; S[ 9] = S[ 0]; \ + S[ 8] = B[ 8]; S[ 7] = B[ 7]; S[ 6] = B[ 6]; S[ 5] = B[ 5]; S[ 4] = B[ 4]; S[ 3] = B[ 3]; S[ 2] = B[ 2]; S[ 1] = B[ 1]; S[ 0] = B[ 0]; \ + } + +#define FUGUE512_3(x, y, z) { \ + TIX4(x, S[ 0], S[ 1], S[ 4], S[ 7], S[ 8], S[22], S[24], S[27], S[30]); \ + CMIX36(S[33], S[34], S[35], S[ 1], S[ 2], S[ 3], S[15], S[16], S[17]); \ + SMIX_LDG(shared, S[33], S[34], S[35], S[ 0]); \ + CMIX36(S[30], S[31], S[32], S[34], S[35], S[ 0], S[12], S[13], S[14]); \ + SMIX_LDG(shared, S[30], S[31], S[32], S[33]); \ + CMIX36(S[27], S[28], S[29], S[31], S[32], S[33], S[ 9], S[10], S[11]); \ + SMIX(shared, S[27], S[28], S[29], S[30]); \ + CMIX36(S[24], S[25], S[26], S[28], S[29], S[30], S[ 6], S[ 7], S[ 8]); \ + SMIX_LDG(shared, S[24], S[25], S[26], S[27]); \ + \ + TIX4(y, S[24], S[25], S[28], S[31], S[32], S[10], S[12], S[15], S[18]); \ + CMIX36(S[21], S[22], S[23], S[25], S[26], S[27], S[ 3], S[ 4], S[ 5]); \ + SMIX(shared, S[21], S[22], S[23], S[24]); \ + CMIX36(S[18], S[19], S[20], S[22], S[23], S[24], S[ 0], S[ 1], S[ 2]); \ + SMIX_LDG(shared, S[18], S[19], S[20], S[21]); \ + CMIX36(S[15], S[16], S[17], S[19], S[20], S[21], S[33], S[34], S[35]); \ + SMIX_LDG(shared, S[15], S[16], S[17], S[18]); \ + CMIX36(S[12], S[13], S[14], S[16], S[17], S[18], S[30], S[31], S[32]); \ + SMIX(shared, S[12], S[13], S[14], S[15]); \ + \ + TIX4(z, S[12], S[13], S[16], S[19], S[20], S[34], S[ 0], S[ 3], S[ 6]); \ + CMIX36(S[ 9], S[10], S[11], S[13], S[14], S[15], S[27], S[28], S[29]); \ + SMIX_LDG(shared, S[ 9], S[10], S[11], S[12]); \ + CMIX36(S[ 6], S[ 7], S[ 8], S[10], S[11], S[12], S[24], S[25], S[26]); \ + SMIX_LDG(shared, S[ 6], S[ 7], S[ 8], S[ 9]); \ + CMIX36(S[ 3], S[ 4], S[ 5], S[ 7], S[ 8], S[ 9], S[21], S[22], S[23]); \ + SMIX_LDG(shared, S[ 3], S[ 4], S[ 5], S[ 6]); \ + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); \ + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); \ + } + +/***************************************************/ +// Die Hash-Funktion +__global__ __launch_bounds__(256,3) +void x13_fugue512_gpu_hash_64(uint32_t threads, uint64_t *g_hash) +{ + __shared__ uint32_t shared[4][256]; + +// if(threadIdx.x<256){ + const uint32_t tmp = mixtab0[threadIdx.x]; + shared[0][threadIdx.x] = tmp; + shared[1][threadIdx.x] = ROR8(tmp); + shared[2][threadIdx.x] = ROL16(tmp); + shared[3][threadIdx.x] = ROL8(tmp); +// } + __syncthreads(); + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + uint32_t *hash = (uint32_t*)&g_hash[thread<<3]; + + uint32_t S[36]; + uint32_t B[ 9]; + + uint32_t Hash[16]; + + *(uint2x4*)&Hash[0] = __ldg4((uint2x4*)&hash[0]); + *(uint2x4*)&Hash[8] = __ldg4((uint2x4*)&hash[8]); + __syncthreads(); + + S[ 0] = S[ 1] = S[ 2] = S[ 3] = S[ 4] = S[ 5] = S[ 6] = S[ 7] = S[ 8] = S[ 9] = S[10] = S[11] = S[12] = S[13] = S[14] = S[15] = S[16] = S[17] = S[18] = S[19] = 0; + *(uint2x4*)&S[20] = *(uint2x4*)&c_S[ 0]; + *(uint2x4*)&S[28] = *(uint2x4*)&c_S[ 8]; + + FUGUE512_3(Hash[0x0], Hash[0x1], Hash[0x2]); + FUGUE512_3(Hash[0x3], Hash[0x4], Hash[0x5]); + FUGUE512_3(Hash[0x6], Hash[0x7], Hash[0x8]); + FUGUE512_3(Hash[0x9], Hash[0xA], Hash[0xB]); + FUGUE512_3(Hash[0xC], Hash[0xD], Hash[0xE]); + FUGUE512_3(Hash[0xF], 0U, 512U); + + for (uint32_t i = 0; i < 32; i+=2){ + mROR3; + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + mROR3; + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + } + #pragma unroll + for (uint32_t i = 0; i < 13; i ++) { + S[ 4] ^= S[ 0]; S[ 9] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[28] ^= S[ 0]; + mROR8; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + } + S[ 4] ^= S[ 0]; S[ 9] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + + S[ 0] = cuda_swab32(S[ 1]); S[ 1] = cuda_swab32(S[ 2]); S[ 2] = cuda_swab32(S[ 3]); S[ 3] = cuda_swab32(S[ 4]); + S[ 4] = cuda_swab32(S[ 9]); S[ 5] = cuda_swab32(S[10]); S[ 6] = cuda_swab32(S[11]); S[ 7] = cuda_swab32(S[12]); + S[ 8] = cuda_swab32(S[18]); S[ 9] = cuda_swab32(S[19]); S[10] = cuda_swab32(S[20]); S[11] = cuda_swab32(S[21]); + S[12] = cuda_swab32(S[27]); S[13] = cuda_swab32(S[28]); S[14] = cuda_swab32(S[29]); S[15] = cuda_swab32(S[30]); + + *(uint2x4*)&hash[ 0] = *(uint2x4*)&S[ 0]; + *(uint2x4*)&hash[ 8] = *(uint2x4*)&S[ 8]; + } +} + +/***************************************************/ +// The final hash function +__global__ __launch_bounds__(512,2) /* force 56 registers */ +void x13_fugue512_gpu_hash_64_final(uint32_t threads,const uint32_t* __restrict__ g_hash,uint32_t* resNonce, const uint64_t target){ + + __shared__ uint32_t shared[4][256]; + + if(threadIdx.x<256){ + const uint32_t tmp = mixtab0[threadIdx.x]; + shared[0][threadIdx.x] = tmp; + shared[1][threadIdx.x] = ROR8(tmp); + shared[2][threadIdx.x] = ROL16(tmp); + shared[3][threadIdx.x] = ROL8(tmp); + } + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + const uint32_t* __restrict__ hash = &g_hash[thread<<4]; + + uint32_t S[36]; + uint32_t B[ 9]; + uint32_t Hash[16]; + + *(uint2x4*)&Hash[0] = __ldg4((uint2x4*)&hash[0]); + *(uint2x4*)&Hash[8] = __ldg4((uint2x4*)&hash[8]); + __syncthreads(); + S[ 0] = S[ 1] = S[ 2] = S[ 3] = S[ 4] = S[ 5] = S[ 6] = S[ 7] = S[ 8] = S[ 9] = S[10] = S[11] = S[12] = S[13] = S[14] = S[15] = S[16] = S[17] = S[18] = S[19] = 0; + *(uint2x4*)&S[20] = *(uint2x4*)&c_S[ 0]; + *(uint2x4*)&S[28] = *(uint2x4*)&c_S[ 8]; + + FUGUE512_3(Hash[0x0], Hash[0x1], Hash[0x2]); + FUGUE512_3(Hash[0x3], Hash[0x4], Hash[0x5]); + FUGUE512_3(Hash[0x6], Hash[0x7], Hash[0x8]); + FUGUE512_3(Hash[0x9], Hash[0xA], Hash[0xB]); + FUGUE512_3(Hash[0xC], Hash[0xD], Hash[0xE]); + FUGUE512_3(Hash[0xF], 0, 512); + + for (int i = 0; i < 32; i++){ + mROR3; + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + } + #pragma unroll + for (int i = 0; i < 12; i++) { + S[ 4] ^= S[ 0]; S[ 9] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[28] ^= S[ 0]; + mROR8; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + } + S[ 4] ^= S[ 0]; S[ 9] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + + S[ 3] = cuda_swab32(S[3]); S[ 4] = cuda_swab32(S[4]^S[ 0]); + + const uint64_t check = *(uint64_t*)&S[ 3]; + if(check <= target){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } +} + +__host__ +void x13_fugue512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash){ + + const uint32_t threadsperblock = 256; + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x13_fugue512_gpu_hash_64<<>>(threads, (uint64_t*)d_hash); +} + +__host__ +void x13_fugue512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target){ + + const uint32_t threadsperblock = 512; + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x13_fugue512_gpu_hash_64_final<<>>(threads, d_hash,d_resNonce,target); +} diff --git a/x13/cuda_x13_hamsi512.cu b/x13/cuda_x13_hamsi512.cu new file mode 100644 index 0000000..0bcaed9 --- /dev/null +++ b/x13/cuda_x13_hamsi512.cu @@ -0,0 +1,295 @@ +/* + * Quick Hamsi-512 for X13 + * by tsiv - 2014 + * + * Provos Alexis - 2016 + */ + +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" + +static __constant__ const uint32_t d_alpha_n[] = { + 0xff00f0f0, 0xccccaaaa, 0xf0f0cccc, 0xff00aaaa, 0xccccaaaa, 0xf0f0ff00, 0xaaaacccc, 0xf0f0ff00, 0xf0f0cccc, 0xaaaaff00, 0xccccff00, 0xaaaaf0f0, 0xaaaaf0f0, 0xff00cccc, 0xccccf0f0, 0xff00aaaa, + 0xccccaaaa, 0xff00f0f0, 0xff00aaaa, 0xf0f0cccc, 0xf0f0ff00, 0xccccaaaa, 0xf0f0ff00, 0xaaaacccc, 0xaaaaff00, 0xf0f0cccc, 0xaaaaf0f0, 0xccccff00, 0xff00cccc, 0xaaaaf0f0, 0xff00aaaa, 0xccccf0f0 +}; + +static __constant__ const uint32_t d_alpha_f[] = { + 0xcaf9639c, 0x0ff0f9c0, 0x639c0ff0, 0xcaf9f9c0, 0x0ff0f9c0, 0x639ccaf9, 0xf9c00ff0, 0x639ccaf9, 0x639c0ff0, 0xf9c0caf9, 0x0ff0caf9, 0xf9c0639c, 0xf9c0639c, 0xcaf90ff0, 0x0ff0639c, 0xcaf9f9c0, + 0x0ff0f9c0, 0xcaf9639c, 0xcaf9f9c0, 0x639c0ff0, 0x639ccaf9, 0x0ff0f9c0, 0x639ccaf9, 0xf9c00ff0, 0xf9c0caf9, 0x639c0ff0, 0xf9c0639c, 0x0ff0caf9, 0xcaf90ff0, 0xf9c0639c, 0xcaf9f9c0, 0x0ff0639c +}; + +static __constant__ const uint32_t c_c[] = { + 0x73746565, 0x6c706172, 0x6b204172, 0x656e6265, 0x72672031, 0x302c2062, 0x75732032, 0x3434362c, + 0x20422d33, 0x30303120, 0x4c657576, 0x656e2d48, 0x65766572, 0x6c65652c, 0x2042656c, 0x6769756d +}; + +static __constant__ const uint32_t d_T512[1024] = { + 0xef0b0270, 0x3afd0000, 0x5dae0000, 0x69490000, 0x9b0f3c06, 0x4405b5f9, 0x66140a51, 0x924f5d0a, 0xc96b0030, 0xe7250000, 0x2f840000, 0x264f0000, 0x08695bf9, 0x6dfcf137, 0x509f6984, 0x9e69af68, + 0xc96b0030, 0xe7250000, 0x2f840000, 0x264f0000, 0x08695bf9, 0x6dfcf137, 0x509f6984, 0x9e69af68, 0x26600240, 0xddd80000, 0x722a0000, 0x4f060000, 0x936667ff, 0x29f944ce, 0x368b63d5, 0x0c26f262, + 0x145a3c00, 0xb9e90000, 0x61270000, 0xf1610000, 0xce613d6c, 0xb0493d78, 0x47a96720, 0xe18e24c5, 0x23671400, 0xc8b90000, 0xf4c70000, 0xfb750000, 0x73cd2465, 0xf8a6a549, 0x02c40a3f, 0xdc24e61f, + 0x23671400, 0xc8b90000, 0xf4c70000, 0xfb750000, 0x73cd2465, 0xf8a6a549, 0x02c40a3f, 0xdc24e61f, 0x373d2800, 0x71500000, 0x95e00000, 0x0a140000, 0xbdac1909, 0x48ef9831, 0x456d6d1f, 0x3daac2da, + 0x54285c00, 0xeaed0000, 0xc5d60000, 0xa1c50000, 0xb3a26770, 0x94a5c4e1, 0x6bb0419d, 0x551b3782, 0x9cbb1800, 0xb0d30000, 0x92510000, 0xed930000, 0x593a4345, 0xe114d5f4, 0x430633da, 0x78cace29, + 0x9cbb1800, 0xb0d30000, 0x92510000, 0xed930000, 0x593a4345, 0xe114d5f4, 0x430633da, 0x78cace29, 0xc8934400, 0x5a3e0000, 0x57870000, 0x4c560000, 0xea982435, 0x75b11115, 0x28b67247, 0x2dd1f9ab, + 0x29449c00, 0x64e70000, 0xf24b0000, 0xc2f30000, 0x0ede4e8f, 0x56c23745, 0xf3e04259, 0x8d0d9ec4, 0x466d0c00, 0x08620000, 0xdd5d0000, 0xbadd0000, 0x6a927942, 0x441f2b93, 0x218ace6f, 0xbf2c0be2, + 0x466d0c00, 0x08620000, 0xdd5d0000, 0xbadd0000, 0x6a927942, 0x441f2b93, 0x218ace6f, 0xbf2c0be2, 0x6f299000, 0x6c850000, 0x2f160000, 0x782e0000, 0x644c37cd, 0x12dd1cd6, 0xd26a8c36, 0x32219526, + 0xf6800005, 0x3443c000, 0x24070000, 0x8f3d0000, 0x21373bfb, 0x0ab8d5ae, 0xcdc58b19, 0xd795ba31, 0xa67f0001, 0x71378000, 0x19fc0000, 0x96db0000, 0x3a8b6dfd, 0xebcaaef3, 0x2c6d478f, 0xac8e6c88, + 0xa67f0001, 0x71378000, 0x19fc0000, 0x96db0000, 0x3a8b6dfd, 0xebcaaef3, 0x2c6d478f, 0xac8e6c88, 0x50ff0004, 0x45744000, 0x3dfb0000, 0x19e60000, 0x1bbc5606, 0xe1727b5d, 0xe1a8cc96, 0x7b1bd6b9, + 0xf7750009, 0xcf3cc000, 0xc3d60000, 0x04920000, 0x029519a9, 0xf8e836ba, 0x7a87f14e, 0x9e16981a, 0xd46a0000, 0x8dc8c000, 0xa5af0000, 0x4a290000, 0xfc4e427a, 0xc9b4866c, 0x98369604, 0xf746c320, + 0xd46a0000, 0x8dc8c000, 0xa5af0000, 0x4a290000, 0xfc4e427a, 0xc9b4866c, 0x98369604, 0xf746c320, 0x231f0009, 0x42f40000, 0x66790000, 0x4ebb0000, 0xfedb5bd3, 0x315cb0d6, 0xe2b1674a, 0x69505b3a, + 0x774400f0, 0xf15a0000, 0xf5b20000, 0x34140000, 0x89377e8c, 0x5a8bec25, 0x0bc3cd1e, 0xcf3775cb, 0xf46c0050, 0x96180000, 0x14a50000, 0x031f0000, 0x42947eb8, 0x66bf7e19, 0x9ca470d2, 0x8a341574, + 0xf46c0050, 0x96180000, 0x14a50000, 0x031f0000, 0x42947eb8, 0x66bf7e19, 0x9ca470d2, 0x8a341574, 0x832800a0, 0x67420000, 0xe1170000, 0x370b0000, 0xcba30034, 0x3c34923c, 0x9767bdcc, 0x450360bf, + 0xe8870170, 0x9d720000, 0x12db0000, 0xd4220000, 0xf2886b27, 0xa921e543, 0x4ef8b518, 0x618813b1, 0xb4370060, 0x0c4c0000, 0x56c20000, 0x5cae0000, 0x94541f3f, 0x3b3ef825, 0x1b365f3d, 0xf3d45758, + 0xb4370060, 0x0c4c0000, 0x56c20000, 0x5cae0000, 0x94541f3f, 0x3b3ef825, 0x1b365f3d, 0xf3d45758, 0x5cb00110, 0x913e0000, 0x44190000, 0x888c0000, 0x66dc7418, 0x921f1d66, 0x55ceea25, 0x925c44e9, + 0x0c720000, 0x49e50f00, 0x42790000, 0x5cea0000, 0x33aa301a, 0x15822514, 0x95a34b7b, 0xb44b0090, 0xfe220000, 0xa7580500, 0x25d10000, 0xf7600000, 0x893178da, 0x1fd4f860, 0x4ed0a315, 0xa123ff9f, + 0xfe220000, 0xa7580500, 0x25d10000, 0xf7600000, 0x893178da, 0x1fd4f860, 0x4ed0a315, 0xa123ff9f, 0xf2500000, 0xeebd0a00, 0x67a80000, 0xab8a0000, 0xba9b48c0, 0x0a56dd74, 0xdb73e86e, 0x1568ff0f, + 0x45180000, 0xa5b51700, 0xf96a0000, 0x3b480000, 0x1ecc142c, 0x231395d6, 0x16bca6b0, 0xdf33f4df, 0xb83d0000, 0x16710600, 0x379a0000, 0xf5b10000, 0x228161ac, 0xae48f145, 0x66241616, 0xc5c1eb3e, + 0xb83d0000, 0x16710600, 0x379a0000, 0xf5b10000, 0x228161ac, 0xae48f145, 0x66241616, 0xc5c1eb3e, 0xfd250000, 0xb3c41100, 0xcef00000, 0xcef90000, 0x3c4d7580, 0x8d5b6493, 0x7098b0a6, 0x1af21fe1, + 0x75a40000, 0xc28b2700, 0x94a40000, 0x90f50000, 0xfb7857e0, 0x49ce0bae, 0x1767c483, 0xaedf667e, 0xd1660000, 0x1bbc0300, 0x9eec0000, 0xf6940000, 0x03024527, 0xcf70fcf2, 0xb4431b17, 0x857f3c2b, + 0xd1660000, 0x1bbc0300, 0x9eec0000, 0xf6940000, 0x03024527, 0xcf70fcf2, 0xb4431b17, 0x857f3c2b, 0xa4c20000, 0xd9372400, 0x0a480000, 0x66610000, 0xf87a12c7, 0x86bef75c, 0xa324df94, 0x2ba05a55, + 0x75c90003, 0x0e10c000, 0xd1200000, 0xbaea0000, 0x8bc42f3e, 0x8758b757, 0xbb28761d, 0x00b72e2b, 0xeecf0001, 0x6f564000, 0xf33e0000, 0xa79e0000, 0xbdb57219, 0xb711ebc5, 0x4a3b40ba, 0xfeabf254, + 0xeecf0001, 0x6f564000, 0xf33e0000, 0xa79e0000, 0xbdb57219, 0xb711ebc5, 0x4a3b40ba, 0xfeabf254, 0x9b060002, 0x61468000, 0x221e0000, 0x1d740000, 0x36715d27, 0x30495c92, 0xf11336a7, 0xfe1cdc7f, + 0x86790000, 0x3f390002, 0xe19ae000, 0x98560000, 0x9565670e, 0x4e88c8ea, 0xd3dd4944, 0x161ddab9, 0x30b70000, 0xe5d00000, 0xf4f46000, 0x42c40000, 0x63b83d6a, 0x78ba9460, 0x21afa1ea, 0xb0a51834, + 0x30b70000, 0xe5d00000, 0xf4f46000, 0x42c40000, 0x63b83d6a, 0x78ba9460, 0x21afa1ea, 0xb0a51834, 0xb6ce0000, 0xdae90002, 0x156e8000, 0xda920000, 0xf6dd5a64, 0x36325c8a, 0xf272e8ae, 0xa6b8c28d, + 0x14190000, 0x23ca003c, 0x50df0000, 0x44b60000, 0x1b6c67b0, 0x3cf3ac75, 0x61e610b0, 0xdbcadb80, 0xe3430000, 0x3a4e0014, 0xf2c60000, 0xaa4e0000, 0xdb1e42a6, 0x256bbe15, 0x123db156, 0x3a4e99d7, + 0xe3430000, 0x3a4e0014, 0xf2c60000, 0xaa4e0000, 0xdb1e42a6, 0x256bbe15, 0x123db156, 0x3a4e99d7, 0xf75a0000, 0x19840028, 0xa2190000, 0xeef80000, 0xc0722516, 0x19981260, 0x73dba1e6, 0xe1844257, + 0x54500000, 0x0671005c, 0x25ae0000, 0x6a1e0000, 0x2ea54edf, 0x664e8512, 0xbfba18c3, 0x7e715d17, 0xbc8d0000, 0xfc3b0018, 0x19830000, 0xd10b0000, 0xae1878c4, 0x42a69856, 0x0012da37, 0x2c3b504e, + 0xbc8d0000, 0xfc3b0018, 0x19830000, 0xd10b0000, 0xae1878c4, 0x42a69856, 0x0012da37, 0x2c3b504e, 0xe8dd0000, 0xfa4a0044, 0x3c2d0000, 0xbb150000, 0x80bd361b, 0x24e81d44, 0xbfa8c2f4, 0x524a0d59, + 0x69510000, 0xd4e1009c, 0xc3230000, 0xac2f0000, 0xe4950bae, 0xcea415dc, 0x87ec287c, 0xbce1a3ce, 0xc6730000, 0xaf8d000c, 0xa4c10000, 0x218d0000, 0x23111587, 0x7913512f, 0x1d28ac88, 0x378dd173, + 0xc6730000, 0xaf8d000c, 0xa4c10000, 0x218d0000, 0x23111587, 0x7913512f, 0x1d28ac88, 0x378dd173, 0xaf220000, 0x7b6c0090, 0x67e20000, 0x8da20000, 0xc7841e29, 0xb7b744f3, 0x9ac484f4, 0x8b6c72bd, + 0xcc140000, 0xa5630000, 0x5ab90780, 0x3b500000, 0x4bd013ff, 0x879b3418, 0x694348c1, 0xca5a87fe, 0x819e0000, 0xec570000, 0x66320280, 0x95f30000, 0x5da92802, 0x48f43cbc, 0xe65aa22d, 0x8e67b7fa, + 0x819e0000, 0xec570000, 0x66320280, 0x95f30000, 0x5da92802, 0x48f43cbc, 0xe65aa22d, 0x8e67b7fa, 0x4d8a0000, 0x49340000, 0x3c8b0500, 0xaea30000, 0x16793bfd, 0xcf6f08a4, 0x8f19eaec, 0x443d3004, + 0x78230000, 0x12fc0000, 0xa93a0b80, 0x90a50000, 0x713e2879, 0x7ee98924, 0xf08ca062, 0x636f8bab, 0x02af0000, 0xb7280000, 0xba1c0300, 0x56980000, 0xba8d45d3, 0x8048c667, 0xa95c149a, 0xf4f6ea7b, + 0x02af0000, 0xb7280000, 0xba1c0300, 0x56980000, 0xba8d45d3, 0x8048c667, 0xa95c149a, 0xf4f6ea7b, 0x7a8c0000, 0xa5d40000, 0x13260880, 0xc63d0000, 0xcbb36daa, 0xfea14f43, 0x59d0b4f8, 0x979961d0, + 0xac480000, 0x1ba60000, 0x45fb1380, 0x03430000, 0x5a85316a, 0x1fb250b6, 0xfe72c7fe, 0x91e478f6, 0x1e4e0000, 0xdecf0000, 0x6df80180, 0x77240000, 0xec47079e, 0xf4a0694e, 0xcda31812, 0x98aa496e, + 0x1e4e0000, 0xdecf0000, 0x6df80180, 0x77240000, 0xec47079e, 0xf4a0694e, 0xcda31812, 0x98aa496e, 0xb2060000, 0xc5690000, 0x28031200, 0x74670000, 0xb6c236f4, 0xeb1239f8, 0x33d1dfec, 0x094e3198, + 0xaec30000, 0x9c4f0001, 0x79d1e000, 0x2c150000, 0x45cc75b3, 0x6650b736, 0xab92f78f, 0xa312567b, 0xdb250000, 0x09290000, 0x49aac000, 0x81e10000, 0xcafe6b59, 0x42793431, 0x43566b76, 0xe86cba2e, + 0xdb250000, 0x09290000, 0x49aac000, 0x81e10000, 0xcafe6b59, 0x42793431, 0x43566b76, 0xe86cba2e, 0x75e60000, 0x95660001, 0x307b2000, 0xadf40000, 0x8f321eea, 0x24298307, 0xe8c49cf9, 0x4b7eec55, + 0x58430000, 0x807e0000, 0x78330001, 0xc66b3800, 0xe7375cdc, 0x79ad3fdd, 0xac73fe6f, 0x3a4479b1, 0x1d5a0000, 0x2b720000, 0x488d0000, 0xaf611800, 0x25cb2ec5, 0xc879bfd0, 0x81a20429, 0x1e7536a6, + 0x1d5a0000, 0x2b720000, 0x488d0000, 0xaf611800, 0x25cb2ec5, 0xc879bfd0, 0x81a20429, 0x1e7536a6, 0x45190000, 0xab0c0000, 0x30be0001, 0x690a2000, 0xc2fc7219, 0xb1d4800d, 0x2dd1fa46, 0x24314f17, + 0xa53b0000, 0x14260000, 0x4e30001e, 0x7cae0000, 0x8f9e0dd5, 0x78dfaa3d, 0xf73168d8, 0x0b1b4946, 0x07ed0000, 0xb2500000, 0x8774000a, 0x970d0000, 0x437223ae, 0x48c76ea4, 0xf4786222, 0x9075b1ce, + 0x07ed0000, 0xb2500000, 0x8774000a, 0x970d0000, 0x437223ae, 0x48c76ea4, 0xf4786222, 0x9075b1ce, 0xa2d60000, 0xa6760000, 0xc9440014, 0xeba30000, 0xccec2e7b, 0x3018c499, 0x03490afa, 0x9b6ef888, + 0x88980000, 0x1f940000, 0x7fcf002e, 0xfb4e0000, 0xf158079a, 0x61ae9167, 0xa895706c, 0xe6107494, 0x0bc20000, 0xdb630000, 0x7e88000c, 0x15860000, 0x91fd48f3, 0x7581bb43, 0xf460449e, 0xd8b61463, + 0x0bc20000, 0xdb630000, 0x7e88000c, 0x15860000, 0x91fd48f3, 0x7581bb43, 0xf460449e, 0xd8b61463, 0x835a0000, 0xc4f70000, 0x01470022, 0xeec80000, 0x60a54f69, 0x142f2a24, 0x5cf534f2, 0x3ea660f7, + 0x52500000, 0x29540000, 0x6a61004e, 0xf0ff0000, 0x9a317eec, 0x452341ce, 0xcf568fe5, 0x5303130f, 0x538d0000, 0xa9fc0000, 0x9ef70006, 0x56ff0000, 0x0ae4004e, 0x92c5cdf9, 0xa9444018, 0x7f975691, + 0x538d0000, 0xa9fc0000, 0x9ef70006, 0x56ff0000, 0x0ae4004e, 0x92c5cdf9, 0xa9444018, 0x7f975691, 0x01dd0000, 0x80a80000, 0xf4960048, 0xa6000000, 0x90d57ea2, 0xd7e68c37, 0x6612cffd, 0x2c94459e, + 0xe6280000, 0x4c4b0000, 0xa8550000, 0xd3d002e0, 0xd86130b8, 0x98a7b0da, 0x289506b4, 0xd75a4897, 0xf0c50000, 0x59230000, 0x45820000, 0xe18d00c0, 0x3b6d0631, 0xc2ed5699, 0xcbe0fe1c, 0x56a7b19f, + 0xf0c50000, 0x59230000, 0x45820000, 0xe18d00c0, 0x3b6d0631, 0xc2ed5699, 0xcbe0fe1c, 0x56a7b19f, 0x16ed0000, 0x15680000, 0xedd70000, 0x325d0220, 0xe30c3689, 0x5a4ae643, 0xe375f8a8, 0x81fdf908, + 0xb4310000, 0x77330000, 0xb15d0000, 0x7fd004e0, 0x78a26138, 0xd116c35d, 0xd256d489, 0x4e6f74de, 0xe3060000, 0xbdc10000, 0x87130000, 0xbff20060, 0x2eba0a1a, 0x8db53751, 0x73c5ab06, 0x5bd61539, + 0xe3060000, 0xbdc10000, 0x87130000, 0xbff20060, 0x2eba0a1a, 0x8db53751, 0x73c5ab06, 0x5bd61539, 0x57370000, 0xcaf20000, 0x364e0000, 0xc0220480, 0x56186b22, 0x5ca3f40c, 0xa1937f8f, 0x15b961e7, + 0x02f20000, 0xa2810000, 0x873f0000, 0xe36c7800, 0x1e1d74ef, 0x073d2bd6, 0xc4c23237, 0x7f32259e, 0xbadd0000, 0x13ad0000, 0xb7e70000, 0xf7282800, 0xdf45144d, 0x361ac33a, 0xea5a8d14, 0x2a2c18f0, + 0xbadd0000, 0x13ad0000, 0xb7e70000, 0xf7282800, 0xdf45144d, 0x361ac33a, 0xea5a8d14, 0x2a2c18f0, 0xb82f0000, 0xb12c0000, 0x30d80000, 0x14445000, 0xc15860a2, 0x3127e8ec, 0x2e98bf23, 0x551e3d6e, + 0x1e6c0000, 0xc4420000, 0x8a2e0000, 0xbcb6b800, 0x2c4413b6, 0x8bfdd3da, 0x6a0c1bc8, 0xb99dc2eb, 0x92560000, 0x1eda0000, 0xea510000, 0xe8b13000, 0xa93556a5, 0xebfb6199, 0xb15c2254, 0x33c5244f, + 0x92560000, 0x1eda0000, 0xea510000, 0xe8b13000, 0xa93556a5, 0xebfb6199, 0xb15c2254, 0x33c5244f, 0x8c3a0000, 0xda980000, 0x607f0000, 0x54078800, 0x85714513, 0x6006b243, 0xdb50399c, 0x8a58e6a4, + 0x033d0000, 0x08b30000, 0xf33a0000, 0x3ac20007, 0x51298a50, 0x6b6e661f, 0x0ea5cfe3, 0xe6da7ffe, 0xa8da0000, 0x96be0000, 0x5c1d0000, 0x07da0002, 0x7d669583, 0x1f98708a, 0xbb668808, 0xda878000, + 0xa8da0000, 0x96be0000, 0x5c1d0000, 0x07da0002, 0x7d669583, 0x1f98708a, 0xbb668808, 0xda878000, 0xabe70000, 0x9e0d0000, 0xaf270000, 0x3d180005, 0x2c4f1fd3, 0x74f61695, 0xb5c347eb, 0x3c5dfffe, + 0x01930000, 0xe7820000, 0xedfb0000, 0xcf0c000b, 0x8dd08d58, 0xbca3b42e, 0x063661e1, 0x536f9e7b, 0x92280000, 0xdc850000, 0x57fa0000, 0x56dc0003, 0xbae92316, 0x5aefa30c, 0x90cef752, 0x7b1675d7, + 0x92280000, 0xdc850000, 0x57fa0000, 0x56dc0003, 0xbae92316, 0x5aefa30c, 0x90cef752, 0x7b1675d7, 0x93bb0000, 0x3b070000, 0xba010000, 0x99d00008, 0x3739ae4e, 0xe64c1722, 0x96f896b3, 0x2879ebac, + 0x5fa80000, 0x56030000, 0x43ae0000, 0x64f30013, 0x257e86bf, 0x1311944e, 0x541e95bf, 0x8ea4db69, 0x00440000, 0x7f480000, 0xda7c0000, 0x2a230001, 0x3badc9cc, 0xa9b69c87, 0x030a9e60, 0xbe0a679e, + 0x00440000, 0x7f480000, 0xda7c0000, 0x2a230001, 0x3badc9cc, 0xa9b69c87, 0x030a9e60, 0xbe0a679e, 0x5fec0000, 0x294b0000, 0x99d20000, 0x4ed00012, 0x1ed34f73, 0xbaa708c9, 0x57140bdf, 0x30aebcf7, + 0xee930000, 0xd6070000, 0x92c10000, 0x2b9801e0, 0x9451287c, 0x3b6cfb57, 0x45312374, 0x201f6a64, 0x7b280000, 0x57420000, 0xa9e50000, 0x634300a0, 0x9edb442f, 0x6d9995bb, 0x27f83b03, 0xc7ff60f0, + 0x7b280000, 0x57420000, 0xa9e50000, 0x634300a0, 0x9edb442f, 0x6d9995bb, 0x27f83b03, 0xc7ff60f0, 0x95bb0000, 0x81450000, 0x3b240000, 0x48db0140, 0x0a8a6c53, 0x56f56eec, 0x62c91877, 0xe7e00a94 +}; + +#define SBOX(a, b, c, d) { \ + uint32_t t; \ + t =(a); \ + a =(a & c) ^ d; \ + c =(c ^ b) ^ a; \ + d =(d | t) ^ b; \ + b = d; \ + d =((d | (t ^ c)) ^ a); \ + a&= b; \ + t^=(c ^ a); \ + b = b ^ d ^ t; \ + (a) = (c); \ + (c) = (b); \ + (b) = (d); \ + (d) = (~t); \ + } + +#define HAMSI_L(a, b, c, d) { \ + (a) = ROTL32(a, 13); \ + (c) = ROTL32(c, 3); \ + (b) ^= (a) ^ (c); \ + (d) ^= (c) ^ ((a) << 3); \ + (b) = ROTL32(b, 1); \ + (d) = ROTL32(d, 7); \ + (a) = ROTL32(a ^ b ^ d, 5); \ + (c) = ROTL32(c ^ d ^ (b<<7), 22); \ + } + +#define ROUND_BIG(rc, alpha) { \ + m[ 0] ^= alpha[ 0]; \ + c[ 4] ^= alpha[ 8]; \ + m[ 8] ^= alpha[16]; \ + c[12] ^= alpha[24]; \ + m[ 1] ^= alpha[ 1] ^ (rc); \ + c[ 5] ^= alpha[ 9]; \ + m[ 9] ^= alpha[17]; \ + c[13] ^= alpha[25]; \ + c[ 0] ^= alpha[ 2]; \ + m[ 4] ^= alpha[10]; \ + c[ 8] ^= alpha[18]; \ + m[12] ^= alpha[26]; \ + c[ 1] ^= alpha[ 3]; \ + m[ 5] ^= alpha[11]; \ + c[ 9] ^= alpha[19]; \ + m[13] ^= alpha[27]; \ + m[ 2] ^= alpha[ 4]; \ + c[ 6] ^= alpha[12]; \ + m[10] ^= alpha[20]; \ + c[14] ^= alpha[28]; \ + m[ 3] ^= alpha[ 5]; \ + c[ 7] ^= alpha[13]; \ + m[11] ^= alpha[21]; \ + c[15] ^= alpha[29]; \ + c[ 2] ^= alpha[ 6]; \ + m[ 6] ^= alpha[14]; \ + c[10] ^= alpha[22]; \ + m[14] ^= alpha[30]; \ + c[ 3] ^= alpha[ 7]; \ + m[ 7] ^= alpha[15]; \ + c[11] ^= alpha[23]; \ + m[15] ^= alpha[31]; \ + SBOX(m[ 0], c[ 4], m[ 8], c[12]); \ + SBOX(m[ 1], c[ 5], m[ 9], c[13]); \ + SBOX(c[ 0], m[ 4], c[ 8], m[12]); \ + SBOX(c[ 1], m[ 5], c[ 9], m[13]); \ + HAMSI_L(m[ 0], c[ 5], c[ 8], m[13]); \ + SBOX(m[ 2], c[ 6], m[10], c[14]); \ + HAMSI_L(m[ 1], m[ 4], c[ 9], c[14]); \ + SBOX(m[ 3], c[ 7], m[11], c[15]); \ + HAMSI_L(c[ 0], m[ 5], m[10], c[15]); \ + SBOX(c[ 2], m[ 6], c[10], m[14]); \ + HAMSI_L(c[ 1], c[ 6], m[11], m[14]); \ + SBOX(c[ 3], m[ 7], c[11], m[15]); \ + HAMSI_L(m[ 2], c[ 7], c[10], m[15]); \ + HAMSI_L(m[ 3], m[ 6], c[11], c[12]); \ + HAMSI_L(c[ 2], m[ 7], m[ 8], c[13]); \ + HAMSI_L(c[ 3], c[ 4], m[ 9], m[12]); \ + HAMSI_L(m[ 0], c[ 0], m[ 3], c[ 3]); \ + HAMSI_L(m[ 8], c[ 9], m[11], c[10]); \ + HAMSI_L(c[ 5], m[ 5], c[ 6], m[ 6]); \ + HAMSI_L(c[13], m[12], c[14], m[15]); \ + } + +__global__ __launch_bounds__(384,2) +void x13_hamsi512_gpu_hash_64(uint32_t threads, uint32_t *g_hash){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + uint32_t *Hash = &g_hash[thread<<4]; + uint8_t h1[64]; + *(uint2x4*)&h1[ 0] = *(uint2x4*)&Hash[0]; + *(uint2x4*)&h1[32] = *(uint2x4*)&Hash[8]; + + uint32_t c[16], h[16], m[16]; + *(uint16*)&c[ 0] = *(uint16*)&c_c[ 0]; + *(uint16*)&h[ 0] = *(uint16*)&c_c[ 0]; + + const uint32_t *tp; + uint32_t dm; + + for(int i = 0; i < 64; i += 8) { + tp = &d_T512[0]; + + dm = -(h1[i] & 1); + m[ 0] = dm & tp[ 0]; m[ 1] = dm & tp[ 1]; + m[ 2] = dm & tp[ 2]; m[ 3] = dm & tp[ 3]; + m[ 4] = dm & tp[ 4]; m[ 5] = dm & tp[ 5]; + m[ 6] = dm & tp[ 6]; m[ 7] = dm & tp[ 7]; + m[ 8] = dm & tp[ 8]; m[ 9] = dm & tp[ 9]; + m[10] = dm & tp[10]; m[11] = dm & tp[11]; + m[12] = dm & tp[12]; m[13] = dm & tp[13]; + m[14] = dm & tp[14]; m[15] = dm & tp[15]; + tp += 16; + #pragma unroll 7 + for (int v = 1; v < 8; v ++) { + dm = -((h1[i]>>v) & 1); + m[ 0] ^= dm & tp[ 0]; m[ 1] ^= dm & tp[ 1]; + m[ 2] ^= dm & tp[ 2]; m[ 3] ^= dm & tp[ 3]; + m[ 4] ^= dm & tp[ 4]; m[ 5] ^= dm & tp[ 5]; + m[ 6] ^= dm & tp[ 6]; m[ 7] ^= dm & tp[ 7]; + m[ 8] ^= dm & tp[ 8]; m[ 9] ^= dm & tp[ 9]; + m[10] ^= dm & tp[10]; m[11] ^= dm & tp[11]; + m[12] ^= dm & tp[12]; m[13] ^= dm & tp[13]; + m[14] ^= dm & tp[14]; m[15] ^= dm & tp[15]; + tp += 16; + } + #pragma unroll + for (int u = 1; u < 8; u ++) { + #pragma unroll 8 + for (int v = 0; v < 8; v ++) { + dm = -((h1[i+u]>>v) & 1); + m[ 0] ^= dm & tp[ 0]; m[ 1] ^= dm & tp[ 1]; + m[ 2] ^= dm & tp[ 2]; m[ 3] ^= dm & tp[ 3]; + m[ 4] ^= dm & tp[ 4]; m[ 5] ^= dm & tp[ 5]; + m[ 6] ^= dm & tp[ 6]; m[ 7] ^= dm & tp[ 7]; + m[ 8] ^= dm & tp[ 8]; m[ 9] ^= dm & tp[ 9]; + m[10] ^= dm & tp[10]; m[11] ^= dm & tp[11]; + m[12] ^= dm & tp[12]; m[13] ^= dm & tp[13]; + m[14] ^= dm & tp[14]; m[15] ^= dm & tp[15]; + tp += 16; + } + } + + #pragma unroll 6 + for( int r = 0; r < 6; r++ ) { + ROUND_BIG(r, d_alpha_n); + } + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + + *(uint16*)&c[ 0] = *(uint16*)&h[ 0]; + } + + *(uint2x4*)&m[ 0] = *(uint2x4*)&d_T512[112]; + *(uint2x4*)&m[ 8] = *(uint2x4*)&d_T512[120]; + + #pragma unroll 6 + for( int r = 0; r < 6; r++ ) { + ROUND_BIG(r, d_alpha_n); + } + + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + + *(uint16*)&c[ 0] = *(uint16*)&h[ 0]; + + *(uint2x4*)&m[ 0] = *(uint2x4*)&d_T512[784]; + *(uint2x4*)&m[ 8] = *(uint2x4*)&d_T512[792]; + + #pragma unroll 12 + for( int r = 0; r < 12; r++ ) + ROUND_BIG(r, d_alpha_f); + + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + + *(uint2x4*)&Hash[ 0] = *(uint2x4*)&h[ 0]; + *(uint2x4*)&Hash[ 8] = *(uint2x4*)&h[ 8]; + } +} + +__host__ +void x13_hamsi512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + const uint32_t threadsperblock = 384; + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x13_hamsi512_gpu_hash_64<<>>(threads, d_hash); + +} diff --git a/x13/cuda_x13_hamsi_fugue512.cu b/x13/cuda_x13_hamsi_fugue512.cu new file mode 100644 index 0000000..1791a65 --- /dev/null +++ b/x13/cuda_x13_hamsi_fugue512.cu @@ -0,0 +1,795 @@ +/* + * Quick Hamsi-512 for X13 + * by tsiv - 2014 + * Provos Alexis - 2016 + */ + +/* + * X13 kernel implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2014-2016 phm, Provos Alexis + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author phm (fugue512 implementation / 2014) + * @author Provos Alexis (Merged hamsi512 and fugue512, Applied partial shared Mem utilization under Cuda7.5/ 2016) + */ +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" + +//-------HAMSI MACROS-------------------------------------------- + +static __constant__ const uint32_t d_alpha_n[] = { + 0xff00f0f0, 0xccccaaaa, 0xf0f0cccc, 0xff00aaaa, 0xccccaaaa, 0xf0f0ff00, 0xaaaacccc, 0xf0f0ff00, 0xf0f0cccc, 0xaaaaff00, 0xccccff00, 0xaaaaf0f0, 0xaaaaf0f0, 0xff00cccc, 0xccccf0f0, 0xff00aaaa, + 0xccccaaaa, 0xff00f0f0, 0xff00aaaa, 0xf0f0cccc, 0xf0f0ff00, 0xccccaaaa, 0xf0f0ff00, 0xaaaacccc, 0xaaaaff00, 0xf0f0cccc, 0xaaaaf0f0, 0xccccff00, 0xff00cccc, 0xaaaaf0f0, 0xff00aaaa, 0xccccf0f0 +}; + +static __constant__ const uint32_t d_alpha_f[] = { + 0xcaf9639c, 0x0ff0f9c0, 0x639c0ff0, 0xcaf9f9c0, 0x0ff0f9c0, 0x639ccaf9, 0xf9c00ff0, 0x639ccaf9, 0x639c0ff0, 0xf9c0caf9, 0x0ff0caf9, 0xf9c0639c, 0xf9c0639c, 0xcaf90ff0, 0x0ff0639c, 0xcaf9f9c0, + 0x0ff0f9c0, 0xcaf9639c, 0xcaf9f9c0, 0x639c0ff0, 0x639ccaf9, 0x0ff0f9c0, 0x639ccaf9, 0xf9c00ff0, 0xf9c0caf9, 0x639c0ff0, 0xf9c0639c, 0x0ff0caf9, 0xcaf90ff0, 0xf9c0639c, 0xcaf9f9c0, 0x0ff0639c +}; + +static __constant__ const uint32_t c_c[] = { + 0x73746565, 0x6c706172, 0x6b204172, 0x656e6265, 0x72672031, 0x302c2062, 0x75732032, 0x3434362c, + 0x20422d33, 0x30303120, 0x4c657576, 0x656e2d48, 0x65766572, 0x6c65652c, 0x2042656c, 0x6769756d +}; + +static __constant__ const uint32_t d_T512[1024] = { + 0xef0b0270, 0x3afd0000, 0x5dae0000, 0x69490000, 0x9b0f3c06, 0x4405b5f9, 0x66140a51, 0x924f5d0a, 0xc96b0030, 0xe7250000, 0x2f840000, 0x264f0000, 0x08695bf9, 0x6dfcf137, 0x509f6984, 0x9e69af68, + 0xc96b0030, 0xe7250000, 0x2f840000, 0x264f0000, 0x08695bf9, 0x6dfcf137, 0x509f6984, 0x9e69af68, 0x26600240, 0xddd80000, 0x722a0000, 0x4f060000, 0x936667ff, 0x29f944ce, 0x368b63d5, 0x0c26f262, + 0x145a3c00, 0xb9e90000, 0x61270000, 0xf1610000, 0xce613d6c, 0xb0493d78, 0x47a96720, 0xe18e24c5, 0x23671400, 0xc8b90000, 0xf4c70000, 0xfb750000, 0x73cd2465, 0xf8a6a549, 0x02c40a3f, 0xdc24e61f, + 0x23671400, 0xc8b90000, 0xf4c70000, 0xfb750000, 0x73cd2465, 0xf8a6a549, 0x02c40a3f, 0xdc24e61f, 0x373d2800, 0x71500000, 0x95e00000, 0x0a140000, 0xbdac1909, 0x48ef9831, 0x456d6d1f, 0x3daac2da, + 0x54285c00, 0xeaed0000, 0xc5d60000, 0xa1c50000, 0xb3a26770, 0x94a5c4e1, 0x6bb0419d, 0x551b3782, 0x9cbb1800, 0xb0d30000, 0x92510000, 0xed930000, 0x593a4345, 0xe114d5f4, 0x430633da, 0x78cace29, + 0x9cbb1800, 0xb0d30000, 0x92510000, 0xed930000, 0x593a4345, 0xe114d5f4, 0x430633da, 0x78cace29, 0xc8934400, 0x5a3e0000, 0x57870000, 0x4c560000, 0xea982435, 0x75b11115, 0x28b67247, 0x2dd1f9ab, + 0x29449c00, 0x64e70000, 0xf24b0000, 0xc2f30000, 0x0ede4e8f, 0x56c23745, 0xf3e04259, 0x8d0d9ec4, 0x466d0c00, 0x08620000, 0xdd5d0000, 0xbadd0000, 0x6a927942, 0x441f2b93, 0x218ace6f, 0xbf2c0be2, + 0x466d0c00, 0x08620000, 0xdd5d0000, 0xbadd0000, 0x6a927942, 0x441f2b93, 0x218ace6f, 0xbf2c0be2, 0x6f299000, 0x6c850000, 0x2f160000, 0x782e0000, 0x644c37cd, 0x12dd1cd6, 0xd26a8c36, 0x32219526, + 0xf6800005, 0x3443c000, 0x24070000, 0x8f3d0000, 0x21373bfb, 0x0ab8d5ae, 0xcdc58b19, 0xd795ba31, 0xa67f0001, 0x71378000, 0x19fc0000, 0x96db0000, 0x3a8b6dfd, 0xebcaaef3, 0x2c6d478f, 0xac8e6c88, + 0xa67f0001, 0x71378000, 0x19fc0000, 0x96db0000, 0x3a8b6dfd, 0xebcaaef3, 0x2c6d478f, 0xac8e6c88, 0x50ff0004, 0x45744000, 0x3dfb0000, 0x19e60000, 0x1bbc5606, 0xe1727b5d, 0xe1a8cc96, 0x7b1bd6b9, + 0xf7750009, 0xcf3cc000, 0xc3d60000, 0x04920000, 0x029519a9, 0xf8e836ba, 0x7a87f14e, 0x9e16981a, 0xd46a0000, 0x8dc8c000, 0xa5af0000, 0x4a290000, 0xfc4e427a, 0xc9b4866c, 0x98369604, 0xf746c320, + 0xd46a0000, 0x8dc8c000, 0xa5af0000, 0x4a290000, 0xfc4e427a, 0xc9b4866c, 0x98369604, 0xf746c320, 0x231f0009, 0x42f40000, 0x66790000, 0x4ebb0000, 0xfedb5bd3, 0x315cb0d6, 0xe2b1674a, 0x69505b3a, + 0x774400f0, 0xf15a0000, 0xf5b20000, 0x34140000, 0x89377e8c, 0x5a8bec25, 0x0bc3cd1e, 0xcf3775cb, 0xf46c0050, 0x96180000, 0x14a50000, 0x031f0000, 0x42947eb8, 0x66bf7e19, 0x9ca470d2, 0x8a341574, + 0xf46c0050, 0x96180000, 0x14a50000, 0x031f0000, 0x42947eb8, 0x66bf7e19, 0x9ca470d2, 0x8a341574, 0x832800a0, 0x67420000, 0xe1170000, 0x370b0000, 0xcba30034, 0x3c34923c, 0x9767bdcc, 0x450360bf, + 0xe8870170, 0x9d720000, 0x12db0000, 0xd4220000, 0xf2886b27, 0xa921e543, 0x4ef8b518, 0x618813b1, 0xb4370060, 0x0c4c0000, 0x56c20000, 0x5cae0000, 0x94541f3f, 0x3b3ef825, 0x1b365f3d, 0xf3d45758, + 0xb4370060, 0x0c4c0000, 0x56c20000, 0x5cae0000, 0x94541f3f, 0x3b3ef825, 0x1b365f3d, 0xf3d45758, 0x5cb00110, 0x913e0000, 0x44190000, 0x888c0000, 0x66dc7418, 0x921f1d66, 0x55ceea25, 0x925c44e9, + 0x0c720000, 0x49e50f00, 0x42790000, 0x5cea0000, 0x33aa301a, 0x15822514, 0x95a34b7b, 0xb44b0090, 0xfe220000, 0xa7580500, 0x25d10000, 0xf7600000, 0x893178da, 0x1fd4f860, 0x4ed0a315, 0xa123ff9f, + 0xfe220000, 0xa7580500, 0x25d10000, 0xf7600000, 0x893178da, 0x1fd4f860, 0x4ed0a315, 0xa123ff9f, 0xf2500000, 0xeebd0a00, 0x67a80000, 0xab8a0000, 0xba9b48c0, 0x0a56dd74, 0xdb73e86e, 0x1568ff0f, + 0x45180000, 0xa5b51700, 0xf96a0000, 0x3b480000, 0x1ecc142c, 0x231395d6, 0x16bca6b0, 0xdf33f4df, 0xb83d0000, 0x16710600, 0x379a0000, 0xf5b10000, 0x228161ac, 0xae48f145, 0x66241616, 0xc5c1eb3e, + 0xb83d0000, 0x16710600, 0x379a0000, 0xf5b10000, 0x228161ac, 0xae48f145, 0x66241616, 0xc5c1eb3e, 0xfd250000, 0xb3c41100, 0xcef00000, 0xcef90000, 0x3c4d7580, 0x8d5b6493, 0x7098b0a6, 0x1af21fe1, + 0x75a40000, 0xc28b2700, 0x94a40000, 0x90f50000, 0xfb7857e0, 0x49ce0bae, 0x1767c483, 0xaedf667e, 0xd1660000, 0x1bbc0300, 0x9eec0000, 0xf6940000, 0x03024527, 0xcf70fcf2, 0xb4431b17, 0x857f3c2b, + 0xd1660000, 0x1bbc0300, 0x9eec0000, 0xf6940000, 0x03024527, 0xcf70fcf2, 0xb4431b17, 0x857f3c2b, 0xa4c20000, 0xd9372400, 0x0a480000, 0x66610000, 0xf87a12c7, 0x86bef75c, 0xa324df94, 0x2ba05a55, + 0x75c90003, 0x0e10c000, 0xd1200000, 0xbaea0000, 0x8bc42f3e, 0x8758b757, 0xbb28761d, 0x00b72e2b, 0xeecf0001, 0x6f564000, 0xf33e0000, 0xa79e0000, 0xbdb57219, 0xb711ebc5, 0x4a3b40ba, 0xfeabf254, + 0xeecf0001, 0x6f564000, 0xf33e0000, 0xa79e0000, 0xbdb57219, 0xb711ebc5, 0x4a3b40ba, 0xfeabf254, 0x9b060002, 0x61468000, 0x221e0000, 0x1d740000, 0x36715d27, 0x30495c92, 0xf11336a7, 0xfe1cdc7f, + 0x86790000, 0x3f390002, 0xe19ae000, 0x98560000, 0x9565670e, 0x4e88c8ea, 0xd3dd4944, 0x161ddab9, 0x30b70000, 0xe5d00000, 0xf4f46000, 0x42c40000, 0x63b83d6a, 0x78ba9460, 0x21afa1ea, 0xb0a51834, + 0x30b70000, 0xe5d00000, 0xf4f46000, 0x42c40000, 0x63b83d6a, 0x78ba9460, 0x21afa1ea, 0xb0a51834, 0xb6ce0000, 0xdae90002, 0x156e8000, 0xda920000, 0xf6dd5a64, 0x36325c8a, 0xf272e8ae, 0xa6b8c28d, + 0x14190000, 0x23ca003c, 0x50df0000, 0x44b60000, 0x1b6c67b0, 0x3cf3ac75, 0x61e610b0, 0xdbcadb80, 0xe3430000, 0x3a4e0014, 0xf2c60000, 0xaa4e0000, 0xdb1e42a6, 0x256bbe15, 0x123db156, 0x3a4e99d7, + 0xe3430000, 0x3a4e0014, 0xf2c60000, 0xaa4e0000, 0xdb1e42a6, 0x256bbe15, 0x123db156, 0x3a4e99d7, 0xf75a0000, 0x19840028, 0xa2190000, 0xeef80000, 0xc0722516, 0x19981260, 0x73dba1e6, 0xe1844257, + 0x54500000, 0x0671005c, 0x25ae0000, 0x6a1e0000, 0x2ea54edf, 0x664e8512, 0xbfba18c3, 0x7e715d17, 0xbc8d0000, 0xfc3b0018, 0x19830000, 0xd10b0000, 0xae1878c4, 0x42a69856, 0x0012da37, 0x2c3b504e, + 0xbc8d0000, 0xfc3b0018, 0x19830000, 0xd10b0000, 0xae1878c4, 0x42a69856, 0x0012da37, 0x2c3b504e, 0xe8dd0000, 0xfa4a0044, 0x3c2d0000, 0xbb150000, 0x80bd361b, 0x24e81d44, 0xbfa8c2f4, 0x524a0d59, + 0x69510000, 0xd4e1009c, 0xc3230000, 0xac2f0000, 0xe4950bae, 0xcea415dc, 0x87ec287c, 0xbce1a3ce, 0xc6730000, 0xaf8d000c, 0xa4c10000, 0x218d0000, 0x23111587, 0x7913512f, 0x1d28ac88, 0x378dd173, + 0xc6730000, 0xaf8d000c, 0xa4c10000, 0x218d0000, 0x23111587, 0x7913512f, 0x1d28ac88, 0x378dd173, 0xaf220000, 0x7b6c0090, 0x67e20000, 0x8da20000, 0xc7841e29, 0xb7b744f3, 0x9ac484f4, 0x8b6c72bd, + 0xcc140000, 0xa5630000, 0x5ab90780, 0x3b500000, 0x4bd013ff, 0x879b3418, 0x694348c1, 0xca5a87fe, 0x819e0000, 0xec570000, 0x66320280, 0x95f30000, 0x5da92802, 0x48f43cbc, 0xe65aa22d, 0x8e67b7fa, + 0x819e0000, 0xec570000, 0x66320280, 0x95f30000, 0x5da92802, 0x48f43cbc, 0xe65aa22d, 0x8e67b7fa, 0x4d8a0000, 0x49340000, 0x3c8b0500, 0xaea30000, 0x16793bfd, 0xcf6f08a4, 0x8f19eaec, 0x443d3004, + 0x78230000, 0x12fc0000, 0xa93a0b80, 0x90a50000, 0x713e2879, 0x7ee98924, 0xf08ca062, 0x636f8bab, 0x02af0000, 0xb7280000, 0xba1c0300, 0x56980000, 0xba8d45d3, 0x8048c667, 0xa95c149a, 0xf4f6ea7b, + 0x02af0000, 0xb7280000, 0xba1c0300, 0x56980000, 0xba8d45d3, 0x8048c667, 0xa95c149a, 0xf4f6ea7b, 0x7a8c0000, 0xa5d40000, 0x13260880, 0xc63d0000, 0xcbb36daa, 0xfea14f43, 0x59d0b4f8, 0x979961d0, + 0xac480000, 0x1ba60000, 0x45fb1380, 0x03430000, 0x5a85316a, 0x1fb250b6, 0xfe72c7fe, 0x91e478f6, 0x1e4e0000, 0xdecf0000, 0x6df80180, 0x77240000, 0xec47079e, 0xf4a0694e, 0xcda31812, 0x98aa496e, + 0x1e4e0000, 0xdecf0000, 0x6df80180, 0x77240000, 0xec47079e, 0xf4a0694e, 0xcda31812, 0x98aa496e, 0xb2060000, 0xc5690000, 0x28031200, 0x74670000, 0xb6c236f4, 0xeb1239f8, 0x33d1dfec, 0x094e3198, + 0xaec30000, 0x9c4f0001, 0x79d1e000, 0x2c150000, 0x45cc75b3, 0x6650b736, 0xab92f78f, 0xa312567b, 0xdb250000, 0x09290000, 0x49aac000, 0x81e10000, 0xcafe6b59, 0x42793431, 0x43566b76, 0xe86cba2e, + 0xdb250000, 0x09290000, 0x49aac000, 0x81e10000, 0xcafe6b59, 0x42793431, 0x43566b76, 0xe86cba2e, 0x75e60000, 0x95660001, 0x307b2000, 0xadf40000, 0x8f321eea, 0x24298307, 0xe8c49cf9, 0x4b7eec55, + 0x58430000, 0x807e0000, 0x78330001, 0xc66b3800, 0xe7375cdc, 0x79ad3fdd, 0xac73fe6f, 0x3a4479b1, 0x1d5a0000, 0x2b720000, 0x488d0000, 0xaf611800, 0x25cb2ec5, 0xc879bfd0, 0x81a20429, 0x1e7536a6, + 0x1d5a0000, 0x2b720000, 0x488d0000, 0xaf611800, 0x25cb2ec5, 0xc879bfd0, 0x81a20429, 0x1e7536a6, 0x45190000, 0xab0c0000, 0x30be0001, 0x690a2000, 0xc2fc7219, 0xb1d4800d, 0x2dd1fa46, 0x24314f17, + 0xa53b0000, 0x14260000, 0x4e30001e, 0x7cae0000, 0x8f9e0dd5, 0x78dfaa3d, 0xf73168d8, 0x0b1b4946, 0x07ed0000, 0xb2500000, 0x8774000a, 0x970d0000, 0x437223ae, 0x48c76ea4, 0xf4786222, 0x9075b1ce, + 0x07ed0000, 0xb2500000, 0x8774000a, 0x970d0000, 0x437223ae, 0x48c76ea4, 0xf4786222, 0x9075b1ce, 0xa2d60000, 0xa6760000, 0xc9440014, 0xeba30000, 0xccec2e7b, 0x3018c499, 0x03490afa, 0x9b6ef888, + 0x88980000, 0x1f940000, 0x7fcf002e, 0xfb4e0000, 0xf158079a, 0x61ae9167, 0xa895706c, 0xe6107494, 0x0bc20000, 0xdb630000, 0x7e88000c, 0x15860000, 0x91fd48f3, 0x7581bb43, 0xf460449e, 0xd8b61463, + 0x0bc20000, 0xdb630000, 0x7e88000c, 0x15860000, 0x91fd48f3, 0x7581bb43, 0xf460449e, 0xd8b61463, 0x835a0000, 0xc4f70000, 0x01470022, 0xeec80000, 0x60a54f69, 0x142f2a24, 0x5cf534f2, 0x3ea660f7, + 0x52500000, 0x29540000, 0x6a61004e, 0xf0ff0000, 0x9a317eec, 0x452341ce, 0xcf568fe5, 0x5303130f, 0x538d0000, 0xa9fc0000, 0x9ef70006, 0x56ff0000, 0x0ae4004e, 0x92c5cdf9, 0xa9444018, 0x7f975691, + 0x538d0000, 0xa9fc0000, 0x9ef70006, 0x56ff0000, 0x0ae4004e, 0x92c5cdf9, 0xa9444018, 0x7f975691, 0x01dd0000, 0x80a80000, 0xf4960048, 0xa6000000, 0x90d57ea2, 0xd7e68c37, 0x6612cffd, 0x2c94459e, + 0xe6280000, 0x4c4b0000, 0xa8550000, 0xd3d002e0, 0xd86130b8, 0x98a7b0da, 0x289506b4, 0xd75a4897, 0xf0c50000, 0x59230000, 0x45820000, 0xe18d00c0, 0x3b6d0631, 0xc2ed5699, 0xcbe0fe1c, 0x56a7b19f, + 0xf0c50000, 0x59230000, 0x45820000, 0xe18d00c0, 0x3b6d0631, 0xc2ed5699, 0xcbe0fe1c, 0x56a7b19f, 0x16ed0000, 0x15680000, 0xedd70000, 0x325d0220, 0xe30c3689, 0x5a4ae643, 0xe375f8a8, 0x81fdf908, + 0xb4310000, 0x77330000, 0xb15d0000, 0x7fd004e0, 0x78a26138, 0xd116c35d, 0xd256d489, 0x4e6f74de, 0xe3060000, 0xbdc10000, 0x87130000, 0xbff20060, 0x2eba0a1a, 0x8db53751, 0x73c5ab06, 0x5bd61539, + 0xe3060000, 0xbdc10000, 0x87130000, 0xbff20060, 0x2eba0a1a, 0x8db53751, 0x73c5ab06, 0x5bd61539, 0x57370000, 0xcaf20000, 0x364e0000, 0xc0220480, 0x56186b22, 0x5ca3f40c, 0xa1937f8f, 0x15b961e7, + 0x02f20000, 0xa2810000, 0x873f0000, 0xe36c7800, 0x1e1d74ef, 0x073d2bd6, 0xc4c23237, 0x7f32259e, 0xbadd0000, 0x13ad0000, 0xb7e70000, 0xf7282800, 0xdf45144d, 0x361ac33a, 0xea5a8d14, 0x2a2c18f0, + 0xbadd0000, 0x13ad0000, 0xb7e70000, 0xf7282800, 0xdf45144d, 0x361ac33a, 0xea5a8d14, 0x2a2c18f0, 0xb82f0000, 0xb12c0000, 0x30d80000, 0x14445000, 0xc15860a2, 0x3127e8ec, 0x2e98bf23, 0x551e3d6e, + 0x1e6c0000, 0xc4420000, 0x8a2e0000, 0xbcb6b800, 0x2c4413b6, 0x8bfdd3da, 0x6a0c1bc8, 0xb99dc2eb, 0x92560000, 0x1eda0000, 0xea510000, 0xe8b13000, 0xa93556a5, 0xebfb6199, 0xb15c2254, 0x33c5244f, + 0x92560000, 0x1eda0000, 0xea510000, 0xe8b13000, 0xa93556a5, 0xebfb6199, 0xb15c2254, 0x33c5244f, 0x8c3a0000, 0xda980000, 0x607f0000, 0x54078800, 0x85714513, 0x6006b243, 0xdb50399c, 0x8a58e6a4, + 0x033d0000, 0x08b30000, 0xf33a0000, 0x3ac20007, 0x51298a50, 0x6b6e661f, 0x0ea5cfe3, 0xe6da7ffe, 0xa8da0000, 0x96be0000, 0x5c1d0000, 0x07da0002, 0x7d669583, 0x1f98708a, 0xbb668808, 0xda878000, + 0xa8da0000, 0x96be0000, 0x5c1d0000, 0x07da0002, 0x7d669583, 0x1f98708a, 0xbb668808, 0xda878000, 0xabe70000, 0x9e0d0000, 0xaf270000, 0x3d180005, 0x2c4f1fd3, 0x74f61695, 0xb5c347eb, 0x3c5dfffe, + 0x01930000, 0xe7820000, 0xedfb0000, 0xcf0c000b, 0x8dd08d58, 0xbca3b42e, 0x063661e1, 0x536f9e7b, 0x92280000, 0xdc850000, 0x57fa0000, 0x56dc0003, 0xbae92316, 0x5aefa30c, 0x90cef752, 0x7b1675d7, + 0x92280000, 0xdc850000, 0x57fa0000, 0x56dc0003, 0xbae92316, 0x5aefa30c, 0x90cef752, 0x7b1675d7, 0x93bb0000, 0x3b070000, 0xba010000, 0x99d00008, 0x3739ae4e, 0xe64c1722, 0x96f896b3, 0x2879ebac, + 0x5fa80000, 0x56030000, 0x43ae0000, 0x64f30013, 0x257e86bf, 0x1311944e, 0x541e95bf, 0x8ea4db69, 0x00440000, 0x7f480000, 0xda7c0000, 0x2a230001, 0x3badc9cc, 0xa9b69c87, 0x030a9e60, 0xbe0a679e, + 0x00440000, 0x7f480000, 0xda7c0000, 0x2a230001, 0x3badc9cc, 0xa9b69c87, 0x030a9e60, 0xbe0a679e, 0x5fec0000, 0x294b0000, 0x99d20000, 0x4ed00012, 0x1ed34f73, 0xbaa708c9, 0x57140bdf, 0x30aebcf7, + 0xee930000, 0xd6070000, 0x92c10000, 0x2b9801e0, 0x9451287c, 0x3b6cfb57, 0x45312374, 0x201f6a64, 0x7b280000, 0x57420000, 0xa9e50000, 0x634300a0, 0x9edb442f, 0x6d9995bb, 0x27f83b03, 0xc7ff60f0, + 0x7b280000, 0x57420000, 0xa9e50000, 0x634300a0, 0x9edb442f, 0x6d9995bb, 0x27f83b03, 0xc7ff60f0, 0x95bb0000, 0x81450000, 0x3b240000, 0x48db0140, 0x0a8a6c53, 0x56f56eec, 0x62c91877, 0xe7e00a94 +}; + +__device__ __forceinline__ +static void hamsi_block(uint32_t *m, const uint32_t* tp, const uint32_t dm){ + + #pragma unroll 16 + for(int i=0;i<16;i++){ + m[ i] ^= dm & tp[ i]; + } +} + +#define SBOX(a, b, c, d) { \ + uint32_t t; \ + t = (a); \ + (a) &= (c); \ + (a) ^= (d); \ + (c) ^= (b); \ + (c) ^= (a); \ + (d) |= t; \ + (d) ^= (b); \ + t ^= (c); \ + (b) = (d); \ + (d) |= t; \ + (d) ^= (a); \ + (a) &= (b); \ + t ^= (a); \ + (b) ^= (d); \ + (a) = (c); \ + (c) = (b) ^ t; \ + (b) = (d); \ + (d) = ~t; \ +} + +#define HAMSI_L(a, b, c, d) { \ + (a) = ROTL32(a, 13); \ + (c) = ROTL32(c, 3); \ + (b) ^= (a) ^ (c); \ + (d) ^= (c) ^ ((a) << 3); \ + (b) = ROTL32(b, 1); \ + (d) = ROTL32(d, 7); \ + (a) = ROTL32(a ^ b ^ d, 5); \ + (c) = ROTL32(c ^ d ^ (b<<7), 22); \ + } + +#define ROUND_BIG(rc, alpha) { \ + m[ 0] ^= alpha[ 0]; \ + m[ 1] ^= alpha[ 1] ^ (rc); \ + c[ 0] ^= alpha[ 2]; \ + c[ 1] ^= alpha[ 3]; \ + m[ 2] ^= alpha[ 4]; \ + m[ 3] ^= alpha[ 5]; \ + c[ 2] ^= alpha[ 6]; \ + c[ 3] ^= alpha[ 7]; \ + c[ 4] ^= alpha[ 8]; \ + c[ 5] ^= alpha[ 9]; \ + m[ 4] ^= alpha[10]; \ + m[ 5] ^= alpha[11]; \ + c[ 6] ^= alpha[12]; \ + c[ 7] ^= alpha[13]; \ + m[ 6] ^= alpha[14]; \ + m[ 7] ^= alpha[15]; \ + m[ 8] ^= alpha[16]; \ + m[ 9] ^= alpha[17]; \ + c[ 8] ^= alpha[18]; \ + c[ 9] ^= alpha[19]; \ + m[10] ^= alpha[20]; \ + m[11] ^= alpha[21]; \ + c[10] ^= alpha[22]; \ + c[11] ^= alpha[23]; \ + c[12] ^= alpha[24]; \ + c[13] ^= alpha[25]; \ + m[12] ^= alpha[26]; \ + m[13] ^= alpha[27]; \ + c[14] ^= alpha[28]; \ + c[15] ^= alpha[29]; \ + m[14] ^= alpha[30]; \ + m[15] ^= alpha[31]; \ + SBOX(m[ 0], c[ 4], m[ 8], c[12]); \ + SBOX(m[ 1], c[ 5], m[ 9], c[13]); \ + SBOX(c[ 0], m[ 4], c[ 8], m[12]); \ + SBOX(c[ 1], m[ 5], c[ 9], m[13]); \ + HAMSI_L(m[ 0], c[ 5], c[ 8], m[13]); \ + SBOX(m[ 2], c[ 6], m[10], c[14]); \ + HAMSI_L(m[ 1], m[ 4], c[ 9], c[14]); \ + SBOX(m[ 3], c[ 7], m[11], c[15]); \ + HAMSI_L(c[ 0], m[ 5], m[10], c[15]); \ + SBOX(c[ 2], m[ 6], c[10], m[14]); \ + HAMSI_L(c[ 1], c[ 6], m[11], m[14]); \ + SBOX(c[ 3], m[ 7], c[11], m[15]); \ + HAMSI_L(m[ 2], c[ 7], c[10], m[15]); \ + HAMSI_L(m[ 3], m[ 6], c[11], c[12]); \ + HAMSI_L(c[ 2], m[ 7], m[ 8], c[13]); \ + HAMSI_L(c[ 3], c[ 4], m[ 9], m[12]); \ + HAMSI_L(m[ 0], c[ 0], m[ 3], c[ 3]); \ + HAMSI_L(m[ 8], c[ 9], m[11], c[10]); \ + HAMSI_L(c[ 5], m[ 5], c[ 6], m[ 6]); \ + HAMSI_L(c[13], m[12], c[14], m[15]); \ + } +//-------END OF HAMSI MACROS-------------------------------------------- + +//------FUGUE MACROS-------------------------------------------------- +static __constant__ const uint32_t c_S[16] = { + 0x8807a57e, 0xe616af75, 0xc5d3e4db, 0xac9ab027, + 0xd915f117, 0xb6eecc54, 0x06e8020b, 0x4a92efd1, + 0xaac6e2c9, 0xddb21398, 0xcae65838, 0x437f203f, + 0x25ea78e7, 0x951fddd6, 0xda6ed11d, 0xe13e3567 +}; + +static __device__ uint32_t mixtab0[256] = { + 0x63633297, 0x7c7c6feb, 0x77775ec7, 0x7b7b7af7, 0xf2f2e8e5, 0x6b6b0ab7, 0x6f6f16a7, 0xc5c56d39, 0x303090c0, 0x01010704, 0x67672e87, 0x2b2bd1ac, 0xfefeccd5, 0xd7d71371, 0xabab7c9a, + 0x767659c3, 0xcaca4005, 0x8282a33e, 0xc9c94909, 0x7d7d68ef, 0xfafad0c5, 0x5959947f, 0x4747ce07, 0xf0f0e6ed, 0xadad6e82, 0xd4d41a7d, 0xa2a243be, 0xafaf608a, 0x9c9cf946, 0xa4a451a6, + 0x727245d3, 0xc0c0762d, 0xb7b728ea, 0xfdfdc5d9, 0x9393d47a, 0x2626f298, 0x363682d8, 0x3f3fbdfc, 0xf7f7f3f1, 0xcccc521d, 0x34348cd0, 0xa5a556a2, 0xe5e58db9, 0xf1f1e1e9, 0x71714cdf, + 0xd8d83e4d, 0x313197c4, 0x15156b54, 0x04041c10, 0xc7c76331, 0x2323e98c, 0xc3c37f21, 0x18184860, 0x9696cf6e, 0x05051b14, 0x9a9aeb5e, 0x0707151c, 0x12127e48, 0x8080ad36, 0xe2e298a5, + 0xebeba781, 0x2727f59c, 0xb2b233fe, 0x757550cf, 0x09093f24, 0x8383a43a, 0x2c2cc4b0, 0x1a1a4668, 0x1b1b416c, 0x6e6e11a3, 0x5a5a9d73, 0xa0a04db6, 0x5252a553, 0x3b3ba1ec, 0xd6d61475, + 0xb3b334fa, 0x2929dfa4, 0xe3e39fa1, 0x2f2fcdbc, 0x8484b126, 0x5353a257, 0xd1d10169, 0x00000000, 0xededb599, 0x2020e080, 0xfcfcc2dd, 0xb1b13af2, 0x5b5b9a77, 0x6a6a0db3, 0xcbcb4701, + 0xbebe17ce, 0x3939afe4, 0x4a4aed33, 0x4c4cff2b, 0x5858937b, 0xcfcf5b11, 0xd0d0066d, 0xefefbb91, 0xaaaa7b9e, 0xfbfbd7c1, 0x4343d217, 0x4d4df82f, 0x333399cc, 0x8585b622, 0x4545c00f, + 0xf9f9d9c9, 0x02020e08, 0x7f7f66e7, 0x5050ab5b, 0x3c3cb4f0, 0x9f9ff04a, 0xa8a87596, 0x5151ac5f, 0xa3a344ba, 0x4040db1b, 0x8f8f800a, 0x9292d37e, 0x9d9dfe42, 0x3838a8e0, 0xf5f5fdf9, + 0xbcbc19c6, 0xb6b62fee, 0xdada3045, 0x2121e784, 0x10107040, 0xffffcbd1, 0xf3f3efe1, 0xd2d20865, 0xcdcd5519, 0x0c0c2430, 0x1313794c, 0xececb29d, 0x5f5f8667, 0x9797c86a, 0x4444c70b, + 0x1717655c, 0xc4c46a3d, 0xa7a758aa, 0x7e7e61e3, 0x3d3db3f4, 0x6464278b, 0x5d5d886f, 0x19194f64, 0x737342d7, 0x60603b9b, 0x8181aa32, 0x4f4ff627, 0xdcdc225d, 0x2222ee88, 0x2a2ad6a8, + 0x9090dd76, 0x88889516, 0x4646c903, 0xeeeebc95, 0xb8b805d6, 0x14146c50, 0xdede2c55, 0x5e5e8163, 0x0b0b312c, 0xdbdb3741, 0xe0e096ad, 0x32329ec8, 0x3a3aa6e8, 0x0a0a3628, 0x4949e43f, + 0x06061218, 0x2424fc90, 0x5c5c8f6b, 0xc2c27825, 0xd3d30f61, 0xacac6986, 0x62623593, 0x9191da72, 0x9595c662, 0xe4e48abd, 0x797974ff, 0xe7e783b1, 0xc8c84e0d, 0x373785dc, 0x6d6d18af, + 0x8d8d8e02, 0xd5d51d79, 0x4e4ef123, 0xa9a97292, 0x6c6c1fab, 0x5656b943, 0xf4f4fafd, 0xeaeaa085, 0x6565208f, 0x7a7a7df3, 0xaeae678e, 0x08083820, 0xbaba0bde, 0x787873fb, 0x2525fb94, + 0x2e2ecab8, 0x1c1c5470, 0xa6a65fae, 0xb4b421e6, 0xc6c66435, 0xe8e8ae8d, 0xdddd2559, 0x747457cb, 0x1f1f5d7c, 0x4b4bea37, 0xbdbd1ec2, 0x8b8b9c1a, 0x8a8a9b1e, 0x70704bdb, 0x3e3ebaf8, + 0xb5b526e2, 0x66662983, 0x4848e33b, 0x0303090c, 0xf6f6f4f5, 0x0e0e2a38, 0x61613c9f, 0x35358bd4, 0x5757be47, 0xb9b902d2, 0x8686bf2e, 0xc1c17129, 0x1d1d5374, 0x9e9ef74e, 0xe1e191a9, + 0xf8f8decd, 0x9898e556, 0x11117744, 0x696904bf, 0xd9d93949, 0x8e8e870e, 0x9494c166, 0x9b9bec5a, 0x1e1e5a78, 0x8787b82a, 0xe9e9a989, 0xcece5c15, 0x5555b04f, 0x2828d8a0, 0xdfdf2b51, + 0x8c8c8906, 0xa1a14ab2, 0x89899212, 0x0d0d2334, 0xbfbf10ca, 0xe6e684b5, 0x4242d513, 0x686803bb, 0x4141dc1f, 0x9999e252, 0x2d2dc3b4, 0x0f0f2d3c, 0xb0b03df6, 0x5454b74b, 0xbbbb0cda, + 0x16166258 +}; + + +#define mixtab0(x) shared[0][x] +#define mixtab1(x) shared[1][x] +#define mixtab2(x) shared[2][x] +#define mixtab3(x) shared[3][x] + +#define TIX4(q, x00, x01, x04, x07, x08, x22, x24, x27, x30) { \ + x22 ^= x00; \ + x00 = (q); \ + x08 ^= (q); \ + x01 ^= x24; \ + x04 ^= x27; \ + x07 ^= x30; \ + } + +#define CMIX36(x00, x01, x02, x04, x05, x06, x18, x19, x20) { \ + x00 ^= x04; \ + x01 ^= x05; \ + x02 ^= x06; \ + x18 ^= x04; \ + x19 ^= x05; \ + x20 ^= x06; \ + } + +__device__ __forceinline__ +static void SMIX_LDG(const uint32_t shared[4][256], uint32_t &x0,uint32_t &x1,uint32_t &x2,uint32_t &x3){ + uint32_t c0 = __ldg(&mixtab0[__byte_perm(x0,0,0x4443)]); + uint32_t r1 = mixtab1(__byte_perm(x0,0,0x4442)); + uint32_t r2 = mixtab2(__byte_perm(x0,0,0x4441)); + uint32_t r3 = mixtab3(__byte_perm(x0,0,0x4440)); + c0 = c0 ^ r1 ^ r2 ^ r3; + uint32_t r0 = mixtab0(__byte_perm(x1,0,0x4443)); + uint32_t c1 = r0 ^ mixtab1(__byte_perm(x1,0,0x4442)); + uint32_t tmp = mixtab2(__byte_perm(x1,0,0x4441)); + c1 ^= tmp; + r2 ^= tmp; + tmp = mixtab3(__byte_perm(x1,0,0x4440)); + c1 ^= tmp; + r3 ^= tmp; + uint32_t c2 = __ldg(&mixtab0[__byte_perm(x2,0,0x4443)]); + r0 ^= c2; + tmp = mixtab1(__byte_perm(x2,0,0x4442)); + c2 ^= tmp; + r1 ^= tmp; + tmp = mixtab2(__byte_perm(x2,0,0x4441)); + c2 ^= tmp; + tmp = mixtab3(__byte_perm(x2,0,0x4440)); + c2 ^= tmp; + r3 ^= tmp; + uint32_t c3 = __ldg(&mixtab0[__byte_perm(x3,0,0x4443)]); + r0 ^= c3; + tmp = mixtab1(__byte_perm(x3,0,0x4442)); + c3 ^= tmp; + r1 ^= tmp; + tmp = mixtab2(__byte_perm(x3,0,0x4441)); + c3 ^= tmp; + r2 ^= tmp; + tmp = mixtab3(__byte_perm(x3,0,0x4440)); + c3 ^= tmp; + x0 = ((c0 ^ (r0 << 0)) & 0xFF000000) | ((c1 ^ (r1 << 0)) & 0x00FF0000) | ((c2 ^ (r2 << 0)) & 0x0000FF00) | ((c3 ^ (r3 << 0)) & 0x000000FF); + x1 = ((c1 ^ (r0 << 8)) & 0xFF000000) | ((c2 ^ (r1 << 8)) & 0x00FF0000) | ((c3 ^ (r2 << 8)) & 0x0000FF00) | ((c0 ^ (r3 >>24)) & 0x000000FF); + x2 = ((c2 ^ (r0 <<16)) & 0xFF000000) | ((c3 ^ (r1 <<16)) & 0x00FF0000) | ((c0 ^ (r2 >>16)) & 0x0000FF00) | ((c1 ^ (r3 >>16)) & 0x000000FF); + x3 = ((c3 ^ (r0 <<24)) & 0xFF000000) | ((c0 ^ (r1 >> 8)) & 0x00FF0000) | ((c1 ^ (r2 >> 8)) & 0x0000FF00) | ((c2 ^ (r3 >> 8)) & 0x000000FF); +} + +__device__ __forceinline__ +static void SMIX(const uint32_t shared[4][256], uint32_t &x0,uint32_t &x1,uint32_t &x2,uint32_t &x3){ + uint32_t c0 = mixtab0(__byte_perm(x0,0,0x4443)); + uint32_t r1 = mixtab1(__byte_perm(x0,0,0x4442)); + uint32_t r2 = mixtab2(__byte_perm(x0,0,0x4441)); + uint32_t r3 = mixtab3(__byte_perm(x0,0,0x4440)); + c0 = c0 ^ r1 ^ r2 ^ r3; + uint32_t r0 = mixtab0(__byte_perm(x1,0,0x4443)); + uint32_t c1 = r0 ^ mixtab1(__byte_perm(x1,0,0x4442)); + uint32_t tmp = mixtab2(__byte_perm(x1,0,0x4441)); + c1 ^= tmp; + r2 ^= tmp; + tmp = mixtab3(__byte_perm(x1,0,0x4440)); + c1 ^= tmp; + r3 ^= tmp; + uint32_t c2 = mixtab0(__byte_perm(x2,0,0x4443)); + r0 ^= c2; + tmp = mixtab1(__byte_perm(x2,0,0x4442)); + c2 ^= tmp; + r1 ^= tmp; + tmp = mixtab2(__byte_perm(x2,0,0x4441)); + c2 ^= tmp; + tmp = mixtab3(__byte_perm(x2,0,0x4440)); + c2 ^= tmp; + r3 ^= tmp; + uint32_t c3 = mixtab0(__byte_perm(x3,0,0x4443)); + r0 ^= c3; + tmp = mixtab1(__byte_perm(x3,0,0x4442)); + c3 ^= tmp; + r1 ^= tmp; + tmp = mixtab2(__byte_perm(x3,0,0x4441)); + c3 ^= tmp; + r2 ^= tmp; + tmp = mixtab3(__byte_perm(x3,0,0x4440)); + c3 ^= tmp; + x0 = ((c0 ^ (r0 << 0)) & 0xFF000000) | ((c1 ^ (r1 << 0)) & 0x00FF0000) | ((c2 ^ (r2 << 0)) & 0x0000FF00) | ((c3 ^ (r3 << 0)) & 0x000000FF); + x1 = ((c1 ^ (r0 << 8)) & 0xFF000000) | ((c2 ^ (r1 << 8)) & 0x00FF0000) | ((c3 ^ (r2 << 8)) & 0x0000FF00) | ((c0 ^ (r3 >>24)) & 0x000000FF); + x2 = ((c2 ^ (r0 <<16)) & 0xFF000000) | ((c3 ^ (r1 <<16)) & 0x00FF0000) | ((c0 ^ (r2 >>16)) & 0x0000FF00) | ((c1 ^ (r3 >>16)) & 0x000000FF); + x3 = ((c3 ^ (r0 <<24)) & 0xFF000000) | ((c0 ^ (r1 >> 8)) & 0x00FF0000) | ((c1 ^ (r2 >> 8)) & 0x0000FF00) | ((c2 ^ (r3 >> 8)) & 0x000000FF); +} + +#define mROR3 { \ + B[ 6] = S[33], B[ 7] = S[34], B[ 8] = S[35]; \ + S[35] = S[32]; S[34] = S[31]; S[33] = S[30]; S[32] = S[29]; S[31] = S[28]; S[30] = S[27]; S[29] = S[26]; S[28] = S[25]; S[27] = S[24]; \ + S[26] = S[23]; S[25] = S[22]; S[24] = S[21]; S[23] = S[20]; S[22] = S[19]; S[21] = S[18]; S[20] = S[17]; S[19] = S[16]; S[18] = S[15]; \ + S[17] = S[14]; S[16] = S[13]; S[15] = S[12]; S[14] = S[11]; S[13] = S[10]; S[12] = S[ 9]; S[11] = S[ 8]; S[10] = S[ 7]; S[ 9] = S[ 6]; \ + S[ 8] = S[ 5]; S[ 7] = S[ 4]; S[ 6] = S[ 3]; S[ 5] = S[ 2]; S[ 4] = S[ 1]; S[ 3] = S[ 0]; S[ 2] = B[ 8]; S[ 1] = B[ 7]; S[ 0] = B[ 6]; \ + } + +#define mROR8 { \ + B[ 1] = S[28]; B[ 2] = S[29]; B[ 3] = S[30]; B[ 4] = S[31]; B[ 5] = S[32]; B[ 6] = S[33]; B[ 7] = S[34]; B[ 8] = S[35]; \ + S[35] = S[27]; S[34] = S[26]; S[33] = S[25]; S[32] = S[24]; S[31] = S[23]; S[30] = S[22]; S[29] = S[21]; S[28] = S[20]; S[27] = S[19]; \ + S[26] = S[18]; S[25] = S[17]; S[24] = S[16]; S[23] = S[15]; S[22] = S[14]; S[21] = S[13]; S[20] = S[12]; S[19] = S[11]; S[18] = S[10]; \ + S[17] = S[ 9]; S[16] = S[ 8]; S[15] = S[ 7]; S[14] = S[ 6]; S[13] = S[ 5]; S[12] = S[ 4]; S[11] = S[ 3]; S[10] = S[ 2]; S[ 9] = S[ 1]; \ + S[ 8] = S[ 0]; S[ 7] = B[ 8]; S[ 6] = B[ 7]; S[ 5] = B[ 6]; S[ 4] = B[ 5]; S[ 3] = B[ 4]; S[ 2] = B[ 3]; S[ 1] = B[ 2]; S[ 0] = B[ 1]; \ + } + +#define mROR9 { \ + B[ 0] = S[27]; B[ 1] = S[28]; B[ 2] = S[29]; B[ 3] = S[30]; B[ 4] = S[31]; B[ 5] = S[32]; B[ 6] = S[33]; B[ 7] = S[34]; B[ 8] = S[35]; \ + S[35] = S[26]; S[34] = S[25]; S[33] = S[24]; S[32] = S[23]; S[31] = S[22]; S[30] = S[21]; S[29] = S[20]; S[28] = S[19]; S[27] = S[18]; \ + S[26] = S[17]; S[25] = S[16]; S[24] = S[15]; S[23] = S[14]; S[22] = S[13]; S[21] = S[12]; S[20] = S[11]; S[19] = S[10]; S[18] = S[ 9]; \ + S[17] = S[ 8]; S[16] = S[ 7]; S[15] = S[ 6]; S[14] = S[ 5]; S[13] = S[ 4]; S[12] = S[ 3]; S[11] = S[ 2]; S[10] = S[ 1]; S[ 9] = S[ 0]; \ + S[ 8] = B[ 8]; S[ 7] = B[ 7]; S[ 6] = B[ 6]; S[ 5] = B[ 5]; S[ 4] = B[ 4]; S[ 3] = B[ 3]; S[ 2] = B[ 2]; S[ 1] = B[ 1]; S[ 0] = B[ 0]; \ + } + +#define FUGUE512_3(x, y, z) { \ + TIX4(x, S[ 0], S[ 1], S[ 4], S[ 7], S[ 8], S[22], S[24], S[27], S[30]); \ + CMIX36(S[33], S[34], S[35], S[ 1], S[ 2], S[ 3], S[15], S[16], S[17]); \ + SMIX(shared, S[33], S[34], S[35], S[ 0]); \ + CMIX36(S[30], S[31], S[32], S[34], S[35], S[ 0], S[12], S[13], S[14]); \ + SMIX(shared, S[30], S[31], S[32], S[33]); \ + CMIX36(S[27], S[28], S[29], S[31], S[32], S[33], S[ 9], S[10], S[11]); \ + SMIX(shared, S[27], S[28], S[29], S[30]); \ + CMIX36(S[24], S[25], S[26], S[28], S[29], S[30], S[ 6], S[ 7], S[ 8]); \ + SMIX_LDG(shared, S[24], S[25], S[26], S[27]); \ + \ + TIX4(y, S[24], S[25], S[28], S[31], S[32], S[10], S[12], S[15], S[18]); \ + CMIX36(S[21], S[22], S[23], S[25], S[26], S[27], S[ 3], S[ 4], S[ 5]); \ + SMIX(shared, S[21], S[22], S[23], S[24]); \ + CMIX36(S[18], S[19], S[20], S[22], S[23], S[24], S[ 0], S[ 1], S[ 2]); \ + SMIX_LDG(shared, S[18], S[19], S[20], S[21]); \ + CMIX36(S[15], S[16], S[17], S[19], S[20], S[21], S[33], S[34], S[35]); \ + SMIX(shared, S[15], S[16], S[17], S[18]); \ + CMIX36(S[12], S[13], S[14], S[16], S[17], S[18], S[30], S[31], S[32]); \ + SMIX_LDG(shared, S[12], S[13], S[14], S[15]); \ + \ + TIX4(z, S[12], S[13], S[16], S[19], S[20], S[34], S[ 0], S[ 3], S[ 6]); \ + CMIX36(S[ 9], S[10], S[11], S[13], S[14], S[15], S[27], S[28], S[29]); \ + SMIX(shared, S[ 9], S[10], S[11], S[12]); \ + CMIX36(S[ 6], S[ 7], S[ 8], S[10], S[11], S[12], S[24], S[25], S[26]); \ + SMIX_LDG(shared, S[ 6], S[ 7], S[ 8], S[ 9]); \ + CMIX36(S[ 3], S[ 4], S[ 5], S[ 7], S[ 8], S[ 9], S[21], S[22], S[23]); \ + SMIX_LDG(shared, S[ 3], S[ 4], S[ 5], S[ 6]); \ + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); \ + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); \ + } + +//------END OF FUGUE MACROS------------------------------------------- + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(384,2) +#else +__launch_bounds__(384) +#endif +void x13_hamsi_fugue512_gpu_hash_64(uint32_t threads, uint32_t *g_hash){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + __shared__ uint32_t shared[4][256]; + + if(threadIdx.x<256){ + const uint32_t tmp = mixtab0[threadIdx.x]; + shared[0][threadIdx.x] = tmp; + shared[1][threadIdx.x] = ROR8(tmp); + shared[2][threadIdx.x] = ROL16(tmp); + shared[3][threadIdx.x] = ROL8(tmp); + } + if (thread < threads){ + + uint32_t *Hash = &g_hash[thread<<4]; + uint8_t h1[64]; + *(uint2x4*)&h1[ 0] = __ldg4((uint2x4*)&Hash[0]); + *(uint2x4*)&h1[32] = __ldg4((uint2x4*)&Hash[8]); + + __syncthreads(); + + uint32_t c[16], h[16], m[16]; + #pragma unroll 16 + for(int i=0;i<16;i++){ + c[i]=c_c[i]; + h[i]=c_c[i]; + } + + const uint32_t *tp; + uint32_t dm; + + for(int i = 0; i < 64; i += 8) { + tp = &d_T512[0]; + + dm = -(h1[i] & 1); + m[ 0] = dm & tp[ 0]; m[ 1] = dm & tp[ 1]; + m[ 2] = dm & tp[ 2]; m[ 3] = dm & tp[ 3]; + m[ 4] = dm & tp[ 4]; m[ 5] = dm & tp[ 5]; + m[ 6] = dm & tp[ 6]; m[ 7] = dm & tp[ 7]; + m[ 8] = dm & tp[ 8]; m[ 9] = dm & tp[ 9]; + m[10] = dm & tp[10]; m[11] = dm & tp[11]; + m[12] = dm & tp[12]; m[13] = dm & tp[13]; + m[14] = dm & tp[14]; m[15] = dm & tp[15]; + tp += 16; + #pragma unroll 7 + for (int v = 1; v < 8; v ++) { + dm = -((h1[i]>>v) & 1); + hamsi_block(m,tp,dm); + tp += 16; + } + #pragma unroll + for (int u = 1; u < 8; u ++) { + #pragma unroll 8 + for (int v = 0; v < 8; v ++) { + dm = -((h1[i+u]>>v) & 1); + hamsi_block(m,tp,dm); + tp += 16; + } + } + + #pragma unroll 6 + for( int r = 0; r < 6; r++ ) { + ROUND_BIG(r, d_alpha_n); + } + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + + #pragma unroll 16 + for(int i=0;i<16;i++) + c[i]=h[i]; + } + + *(uint2x4*)&m[ 0] = *(uint2x4*)&d_T512[112]; + *(uint2x4*)&m[ 8] = *(uint2x4*)&d_T512[120]; + + #pragma unroll 6 + for( int r = 0; r < 6; r++ ) { + ROUND_BIG(r, d_alpha_n); + } + + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + + #pragma unroll 16 + for(int i=0;i<16;i++) + c[i]=h[i]; + + *(uint2x4*)&m[ 0] = *(uint2x4*)&d_T512[784]; + *(uint2x4*)&m[ 8] = *(uint2x4*)&d_T512[792]; + +// #pragma unroll 12 + for( int r = 0; r < 12; r+=6 ){ + ROUND_BIG(r+0, d_alpha_f); + ROUND_BIG(r+1, d_alpha_f); + ROUND_BIG(r+2, d_alpha_f); + ROUND_BIG(r+3, d_alpha_f); + ROUND_BIG(r+4, d_alpha_f); + ROUND_BIG(r+5, d_alpha_f); + } + + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + +// *(uint2x4*)&Hash[ 0] = *(uint2x4*)&h[ 0]; +// *(uint2x4*)&Hash[ 8] = *(uint2x4*)&h[ 8]; + uint32_t S[36]; + uint32_t B[ 9]; + + S[ 0] = S[ 1] = S[ 2] = S[ 3] = S[ 4] = S[ 5] = S[ 6] = S[ 7] = S[ 8] = S[ 9] = S[10] = S[11] = S[12] = S[13] = S[14] = S[15] = S[16] = S[17] = S[18] = S[19] = 0; + *(uint2x4*)&S[20] = *(uint2x4*)&c_S[ 0]; + #pragma unroll 8 + for(int i=0;i<8;i++){ + S[28+i] = c_S[i+8]; + } + + FUGUE512_3(h[0x0], h[0x1], h[0x2]); + FUGUE512_3(h[0x3], h[0x4], h[0x5]); + FUGUE512_3(h[0x6], h[0x7], h[0x8]); + FUGUE512_3(h[0x9], h[0xA], h[0xB]); + FUGUE512_3(h[0xC], h[0xD], h[0xE]); + FUGUE512_3(h[0xF], 0U, 512U); + + for (uint32_t i = 0; i < 32; i+=2){ + mROR3; + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); + SMIX(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + mROR3; + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + } + #pragma unroll 11 + for (uint32_t i = 0; i < 13; i ++) { + S[ 4] ^= S[ 0]; S[ 9] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[28] ^= S[ 0]; + mROR8; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + } + S[ 4] ^= S[ 0]; S[ 9] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + + S[ 0] = cuda_swab32(S[ 1]); S[ 1] = cuda_swab32(S[ 2]); S[ 2] = cuda_swab32(S[ 3]); S[ 3] = cuda_swab32(S[ 4]); + S[ 4] = cuda_swab32(S[ 9]); S[ 5] = cuda_swab32(S[10]); S[ 6] = cuda_swab32(S[11]); S[ 7] = cuda_swab32(S[12]); + S[ 8] = cuda_swab32(S[18]); S[ 9] = cuda_swab32(S[19]); S[10] = cuda_swab32(S[20]); S[11] = cuda_swab32(S[21]); + S[12] = cuda_swab32(S[27]); S[13] = cuda_swab32(S[28]); S[14] = cuda_swab32(S[29]); S[15] = cuda_swab32(S[30]); + + *(uint2x4*)&Hash[ 0] = *(uint2x4*)&S[ 0]; + *(uint2x4*)&Hash[ 8] = *(uint2x4*)&S[ 8]; + } +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(384,2) +#else +__launch_bounds__(384) +#endif +void x13_hamsi_fugue512_gpu_hash_64_final(uint32_t threads, uint32_t *g_hash,uint32_t* resNonce, const uint64_t target){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + __shared__ uint32_t shared[4][256]; + + if(threadIdx.x<256){ + const uint32_t tmp = mixtab0[threadIdx.x]; + shared[0][threadIdx.x] = tmp; + shared[1][threadIdx.x] = ROR8(tmp); + shared[2][threadIdx.x] = ROL16(tmp); + shared[3][threadIdx.x] = ROL8(tmp); + } + + if (thread < threads){ + uint32_t *Hash = &g_hash[thread<<4]; + uint8_t h1[64]; + *(uint2x4*)&h1[ 0] = __ldg4((uint2x4*)&Hash[0]); + *(uint2x4*)&h1[32] = __ldg4((uint2x4*)&Hash[8]); + + __syncthreads(); + + uint32_t c[16], h[16], m[16]; + #pragma unroll 16 + for(int i=0;i<16;i++){ + c[i]=c_c[i]; + h[i]=c_c[i]; + } + + const uint32_t *tp; + uint32_t dm; + + for(int i = 0; i < 64; i += 8) { + tp = &d_T512[0]; + + dm = -(h1[i] & 1); + m[ 0] = dm & tp[ 0]; m[ 1] = dm & tp[ 1]; + m[ 2] = dm & tp[ 2]; m[ 3] = dm & tp[ 3]; + m[ 4] = dm & tp[ 4]; m[ 5] = dm & tp[ 5]; + m[ 6] = dm & tp[ 6]; m[ 7] = dm & tp[ 7]; + m[ 8] = dm & tp[ 8]; m[ 9] = dm & tp[ 9]; + m[10] = dm & tp[10]; m[11] = dm & tp[11]; + m[12] = dm & tp[12]; m[13] = dm & tp[13]; + m[14] = dm & tp[14]; m[15] = dm & tp[15]; + tp += 16; + #pragma unroll 7 + for (int v = 1; v < 8; v ++) { + dm = -((h1[i]>>v) & 1); + hamsi_block(m,tp,dm); + tp += 16; + } + #pragma unroll + for (int u = 1; u < 8; u ++) { + #pragma unroll 8 + for (int v = 0; v < 8; v ++) { + dm = -((h1[i+u]>>v) & 1); + hamsi_block(m,tp,dm); + tp += 16; + } + } + + #pragma unroll 6 + for( int r = 0; r < 6; r++ ) { + ROUND_BIG(r, d_alpha_n); + } + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + + #pragma unroll 16 + for(int i=0;i<16;i++){ + c[i]=h[i]; + } + } + + *(uint2x4*)&m[ 0] = *(uint2x4*)&d_T512[112]; + *(uint2x4*)&m[ 8] = *(uint2x4*)&d_T512[120]; + + #pragma unroll 6 + for( int r = 0; r < 6; r++ ) { + ROUND_BIG(r, d_alpha_n); + } + + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + + #pragma unroll 16 + for(int i=0;i<16;i++){ + c[i]=h[i]; + } + + *(uint2x4*)&m[ 0] = *(uint2x4*)&d_T512[784]; + *(uint2x4*)&m[ 8] = *(uint2x4*)&d_T512[792]; + +// #pragma unroll 12 + for( int r = 0; r < 12; r+=6 ){ + ROUND_BIG(r+0, d_alpha_f); + ROUND_BIG(r+1, d_alpha_f); + ROUND_BIG(r+2, d_alpha_f); + ROUND_BIG(r+3, d_alpha_f); + ROUND_BIG(r+4, d_alpha_f); + ROUND_BIG(r+5, d_alpha_f); + } + + /* order is (no more) important */ + h[ 0] ^= m[ 0]; h[ 1] ^= m[ 1]; h[ 2] ^= c[ 0]; h[ 3] ^= c[ 1]; + h[ 4] ^= m[ 2]; h[ 5] ^= m[ 3]; h[ 6] ^= c[ 2]; h[ 7] ^= c[ 3]; + h[ 8] ^= m[ 8]; h[ 9] ^= m[ 9]; h[10] ^= c[ 8]; h[11] ^= c[ 9]; + h[12] ^= m[10]; h[13] ^= m[11]; h[14] ^= c[10]; h[15] ^= c[11]; + +// *(uint2x4*)&Hash[ 0] = *(uint2x4*)&h[ 0]; +// *(uint2x4*)&Hash[ 8] = *(uint2x4*)&h[ 8]; + uint32_t S[36]; + uint32_t B[ 9]; + + S[ 0] = S[ 1] = S[ 2] = S[ 3] = S[ 4] = S[ 5] = S[ 6] = S[ 7] = S[ 8] = S[ 9] = S[10] = S[11] = S[12] = S[13] = S[14] = S[15] = S[16] = S[17] = S[18] = S[19] = 0; + *(uint2x4*)&S[20] = *(uint2x4*)&c_S[ 0]; + #pragma unroll 8 + for(int i=0;i<8;i++){ + S[28+i] = c_S[i+8]; + } + + FUGUE512_3(h[0x0], h[0x1], h[0x2]); + FUGUE512_3(h[0x3], h[0x4], h[0x5]); + FUGUE512_3(h[0x6], h[0x7], h[0x8]); + FUGUE512_3(h[0x9], h[0xA], h[0xB]); + FUGUE512_3(h[0xC], h[0xD], h[0xE]); + FUGUE512_3(h[0xF], 0U, 512U); + + for (uint32_t i = 0; i < 32; i+=2){ + mROR3; + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); + SMIX(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + mROR3; + CMIX36(S[ 0], S[ 1], S[ 2], S[ 4], S[ 5], S[ 6], S[18], S[19], S[20]); + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + } + #pragma unroll 10 + for (int i = 0; i < 12; i++) { + S[ 4] ^= S[ 0]; S[ 9] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[28] ^= S[ 0]; + mROR8; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + } + S[ 4] ^= S[ 0]; S[ 9] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[18] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + S[ 4] ^= S[ 0]; S[10] ^= S[ 0]; S[19] ^= S[ 0]; S[27] ^= S[ 0]; + mROR9; + SMIX_LDG(shared, S[ 0], S[ 1], S[ 2], S[ 3]); + + S[ 3] = cuda_swab32(S[3]); S[ 4] = cuda_swab32(S[4]^S[ 0]); + + const uint64_t check = *(uint64_t*)&S[ 3]; + if(check <= target){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } +} + +__host__ +void x13_hamsi_fugue512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + const uint32_t threadsperblock = 384; + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x13_hamsi_fugue512_gpu_hash_64<<>>(threads, d_hash); + +} + +__host__ +void x13_hamsi_fugue512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target){ + + const uint32_t threadsperblock = 384; + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x13_hamsi_fugue512_gpu_hash_64_final<<>>(threads, d_hash,d_resNonce,target); +} diff --git a/x13/hsr.cu b/x13/hsr.cu new file mode 100644 index 0000000..2f3a71e --- /dev/null +++ b/x13/hsr.cu @@ -0,0 +1,241 @@ +/* + * XSR algorithm + */ +extern "C" +{ +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" + +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" + +#include "sph/sph_hamsi.h" +#include "sph/sph_fugue.h" +#include "x13/sm3.h" +} + +#include "miner.h" + +#include "cuda_helper.h" +#include "x11/cuda_x11.h" + +#define NBN 2 + +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +extern void sm3_cuda_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash, int order); +extern void x13_hamsi_fugue512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target); + +// HSR CPU Hash +extern "C" void hsr_hash(void *output, const void *input) +{ + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + sm3_ctx_t ctx_sm3; + sph_hamsi512_context ctx_hamsi; + sph_fugue512_context ctx_fugue; + + uint32_t hash[16]; + memset(hash, 0, sizeof hash); + + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, (void*) hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512 (&ctx_bmw, (const void*) hash, 64); + sph_bmw512_close(&ctx_bmw, (void*) hash); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, (void*) hash); + + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, (void*) hash); + + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, (void*) hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + + sph_luffa512_init(&ctx_luffa); + sph_luffa512 (&ctx_luffa, (const void*) hash, 64); + sph_luffa512_close (&ctx_luffa, (void*) hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512 (&ctx_cubehash, (const void*) hash, 64); + sph_cubehash512_close(&ctx_cubehash, (void*) hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512 (&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, (void*) hash); + + sph_simd512_init(&ctx_simd); + sph_simd512 (&ctx_simd, (const void*) hash, 64); + sph_simd512_close(&ctx_simd, (void*) hash); + + sph_echo512_init(&ctx_echo); + sph_echo512 (&ctx_echo, (const void*) hash, 64); + sph_echo512_close(&ctx_echo, (void*) hash); + + sm3_init(&ctx_sm3); + sm3_update(&ctx_sm3, (const unsigned char*)hash, 64); + memset(hash, 0, sizeof hash); + sm3_close(&ctx_sm3, (void*)hash); + + sph_hamsi512_init(&ctx_hamsi); + sph_hamsi512 (&ctx_hamsi, (const void*) hash, 64); + sph_hamsi512_close(&ctx_hamsi, (void*) hash); + + sph_fugue512_init(&ctx_fugue); + sph_fugue512 (&ctx_fugue, (const void*) hash, 64); + sph_fugue512_close(&ctx_fugue, (void*) hash); + + memcpy(output, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_hsr(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + const int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + uint32_t default_throughput = 1<<20; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + throughput&=0xFFFFFF70; //multiples of 128 due to simd_echo kernel + + if (opt_benchmark) + ((uint32_t*)ptarget)[7] = 0x000f; + + if (!init[thr_id]) + { + cudaSetDevice(dev_id); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + uint32_t endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + + do { + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_keccak512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + sm3_cuda_hash_64(thr_id, throughput, d_hash[thr_id], 0); + x13_hamsi_fugue512_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id],d_resNonce[thr_id],*(uint64_t*)&ptarget[6]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + hsr_hash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput + 1; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], pdata[21]); + hsr_hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce + 1; + + return 0; +} + +// cleanup +extern "C" void free_hsr(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/x13/sm3.c b/x13/sm3.c new file mode 100644 index 0000000..295ba15 --- /dev/null +++ b/x13/sm3.c @@ -0,0 +1,220 @@ +/* ==================================================================== + * Copyright (c) 2014 - 2017 The GmSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the GmSSL Project. + * (http://gmssl.org/)" + * + * 4. The name "GmSSL Project" must not be used to endorse or promote + * products derived from this software without prior written + * permission. For written permission, please contact + * guanzhi1980@gmail.com. + * + * 5. Products derived from this software may not be called "GmSSL" + * nor may "GmSSL" appear in their names without prior written + * permission of the GmSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the GmSSL Project + * (http://gmssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + */ + +#include + +#include "sm3.h" + +void sm3_init(sm3_ctx_t *ctx) +{ + ctx->digest[0] = 0x7380166F; + ctx->digest[1] = 0x4914B2B9; + ctx->digest[2] = 0x172442D7; + ctx->digest[3] = 0xDA8A0600; + ctx->digest[4] = 0xA96F30BC; + ctx->digest[5] = 0x163138AA; + ctx->digest[6] = 0xE38DEE4D; + ctx->digest[7] = 0xB0FB0E4E; + + ctx->nblocks = 0; + ctx->num = 0; +} + +void sm3_update(sm3_ctx_t *ctx, const unsigned char* data, size_t data_len) +{ + if (ctx->num) { + unsigned int left = SM3_BLOCK_SIZE - ctx->num; + if (data_len < left) { + memcpy(ctx->block + ctx->num, data, data_len); + ctx->num += data_len; + return; + } else { + memcpy(ctx->block + ctx->num, data, left); + sm3_compress(ctx->digest, ctx->block); + ctx->nblocks++; + data += left; + data_len -= left; + } + } + while (data_len >= SM3_BLOCK_SIZE) { + sm3_compress(ctx->digest, data); + ctx->nblocks++; + data += SM3_BLOCK_SIZE; + data_len -= SM3_BLOCK_SIZE; + } + ctx->num = data_len; + if (data_len) { + memcpy(ctx->block, data, data_len); + } +} + +void sm3_close(void *cc, void *dst) +{ + sm3_final(cc, dst); + memset(cc, 0, sizeof(sm3_ctx_t)); +} + +void sm3_final(sm3_ctx_t *ctx, unsigned char *digest) +{ + int i; + uint32_t *pdigest = (uint32_t *)digest; + uint32_t *count = (uint32_t *)(ctx->block + SM3_BLOCK_SIZE - 8); + + ctx->block[ctx->num] = 0x80; + + if (ctx->num + 9 <= SM3_BLOCK_SIZE) { + memset(ctx->block + ctx->num + 1, 0, SM3_BLOCK_SIZE - ctx->num - 9); + } else { + memset(ctx->block + ctx->num + 1, 0, SM3_BLOCK_SIZE - ctx->num - 1); + sm3_compress(ctx->digest, ctx->block); + memset(ctx->block, 0, SM3_BLOCK_SIZE - 8); + } + + count[0] = cpu_to_be32((ctx->nblocks) >> 23); + count[1] = cpu_to_be32((ctx->nblocks << 9) + (ctx->num << 3)); + + sm3_compress(ctx->digest, ctx->block); + for (i = 0; i < sizeof(ctx->digest)/sizeof(ctx->digest[0]); i++) { + pdigest[i] = cpu_to_be32(ctx->digest[i]); + } +} + +#define ROTATELEFT(X,n) (((X)<<(n)) | ((X)>>(32-(n)))) + +#define P0(x) ((x) ^ ROTATELEFT((x),9) ^ ROTATELEFT((x),17)) +#define P1(x) ((x) ^ ROTATELEFT((x),15) ^ ROTATELEFT((x),23)) + +#define FF0(x,y,z) ( (x) ^ (y) ^ (z)) +#define FF1(x,y,z) (((x) & (y)) | ( (x) & (z)) | ( (y) & (z))) + +#define GG0(x,y,z) ( (x) ^ (y) ^ (z)) +#define GG1(x,y,z) (((x) & (y)) | ( (~(x)) & (z)) ) + + +void sm3_compress(uint32_t digest[8], const unsigned char block[64]) +{ + int j; + uint32_t W[68], W1[64]; + const uint32_t *pblock = (const uint32_t *)block; + + uint32_t A = digest[0]; + uint32_t B = digest[1]; + uint32_t C = digest[2]; + uint32_t D = digest[3]; + uint32_t E = digest[4]; + uint32_t F = digest[5]; + uint32_t G = digest[6]; + uint32_t H = digest[7]; + uint32_t SS1,SS2,TT1,TT2,T[64]; + + for (j = 0; j < 16; j++) { + W[j] = cpu_to_be32(pblock[j]); + } + for (j = 16; j < 68; j++) { + W[j] = P1( W[j-16] ^ W[j-9] ^ ROTATELEFT(W[j-3],15)) ^ ROTATELEFT(W[j - 13],7 ) ^ W[j-6];; + } + for( j = 0; j < 64; j++) { + W1[j] = W[j] ^ W[j+4]; + } + + for(j =0; j < 16; j++) { + + T[j] = 0x79CC4519; + SS1 = ROTATELEFT((ROTATELEFT(A,12) + E + ROTATELEFT(T[j],j)), 7); + SS2 = SS1 ^ ROTATELEFT(A,12); + TT1 = FF0(A,B,C) + D + SS2 + W1[j]; + TT2 = GG0(E,F,G) + H + SS1 + W[j]; + D = C; + C = ROTATELEFT(B,9); + B = A; + A = TT1; + H = G; + G = ROTATELEFT(F,19); + F = E; + E = P0(TT2); + } + + for(j =16; j < 64; j++) { + + T[j] = 0x7A879D8A; + SS1 = ROTATELEFT((ROTATELEFT(A,12) + E + ROTATELEFT(T[j],j)), 7); + SS2 = SS1 ^ ROTATELEFT(A,12); + TT1 = FF1(A,B,C) + D + SS2 + W1[j]; + TT2 = GG1(E,F,G) + H + SS1 + W[j]; + D = C; + C = ROTATELEFT(B,9); + B = A; + A = TT1; + H = G; + G = ROTATELEFT(F,19); + F = E; + E = P0(TT2); + } + + digest[0] ^= A; + digest[1] ^= B; + digest[2] ^= C; + digest[3] ^= D; + digest[4] ^= E; + digest[5] ^= F; + digest[6] ^= G; + digest[7] ^= H; +} + +void sm3(const unsigned char *msg, size_t msglen, + unsigned char dgst[SM3_DIGEST_LENGTH]) +{ + sm3_ctx_t ctx; + + sm3_init(&ctx); + sm3_update(&ctx, msg, msglen); + sm3_final(&ctx, dgst); + + memset(&ctx, 0, sizeof(sm3_ctx_t)); +} diff --git a/x13/sm3.h b/x13/sm3.h new file mode 100644 index 0000000..05c6595 --- /dev/null +++ b/x13/sm3.h @@ -0,0 +1,109 @@ +/* ==================================================================== + * Copyright (c) 2014 - 2016 The GmSSL Project. All rights reserved. + * Copyright (c) 2017 - YiiMP (cleaned hmac dead stuff) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the GmSSL Project. + * (http://gmssl.org/)" + * + * 4. The name "GmSSL Project" must not be used to endorse or promote + * products derived from this software without prior written + * permission. For written permission, please contact + * guanzhi1980@gmail.com. + * + * 5. Products derived from this software may not be called "GmSSL" + * nor may "GmSSL" appear in their names without prior written + * permission of the GmSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the GmSSL Project + * (http://gmssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + */ + +#ifndef _SM3_H +#define _SM3_H + +#define SM3_DIGEST_LENGTH 32 +#define SM3_BLOCK_SIZE 64 +#define SM3_CBLOCK (SM3_BLOCK_SIZE) +#define SM3_HMAC_SIZE (SM3_DIGEST_LENGTH) + + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct { + uint32_t digest[8]; + int nblocks; + unsigned char block[64]; + int num; +} sm3_ctx_t; + +void sm3_init(sm3_ctx_t *ctx); +void sm3_update(sm3_ctx_t *ctx, const unsigned char* data, size_t data_len); +void sm3_close(void *cc, void *dst); + +void sm3_final(sm3_ctx_t *ctx, unsigned char digest[SM3_DIGEST_LENGTH]); +void sm3_compress(uint32_t digest[8], const unsigned char block[SM3_BLOCK_SIZE]); +void sm3(const unsigned char *data, size_t datalen, + unsigned char digest[SM3_DIGEST_LENGTH]); + +#ifdef CPU_BIGENDIAN + +#define cpu_to_be16(v) (v) +#define cpu_to_be32(v) (v) +#define be16_to_cpu(v) (v) +#define be32_to_cpu(v) (v) + +#else + +#define cpu_to_le16(v) (v) +#define cpu_to_le32(v) (v) +#define le16_to_cpu(v) (v) +#define le32_to_cpu(v) (v) + +#define cpu_to_be16(v) (((v)<< 8) | ((v)>>8)) +#define cpu_to_be32(v) (((v)>>24) | (((v)>>8)&0xff00) | (((v)<<8)&0xff0000) | ((v)<<24)) +#define be16_to_cpu(v) cpu_to_be16(v) +#define be32_to_cpu(v) cpu_to_be32(v) + +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/x13/x13.cu b/x13/x13.cu new file mode 100644 index 0000000..4f1dc98 --- /dev/null +++ b/x13/x13.cu @@ -0,0 +1,244 @@ +/* + * X13 algorithm + */ +extern "C" +{ +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" + +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" + +#include "sph/sph_hamsi.h" +#include "sph/sph_fugue.h" +} +#include "miner.h" + +#include "cuda_helper.h" +#include "x11/cuda_x11.h" + +#define NBN 2 + +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +extern void x13_hamsi512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void x13_fugue512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target); + +extern void x13_hamsi_fugue512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target); + +// X13 CPU Hash +extern "C" void x13hash(void *output, const void *input) +{ + // blake1-bmw2-grs3-skein4-jh5-keccak6-luffa7-cubehash8-shavite9-simd10-echo11-hamsi12-fugue13 + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + sph_hamsi512_context ctx_hamsi; + sph_fugue512_context ctx_fugue; + + uint32_t hash[32]; + memset(hash, 0, sizeof hash); + + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, (void*) hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512 (&ctx_bmw, (const void*) hash, 64); + sph_bmw512_close(&ctx_bmw, (void*) hash); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, (void*) hash); + + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, (void*) hash); + + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, (void*) hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + + sph_luffa512_init(&ctx_luffa); + sph_luffa512 (&ctx_luffa, (const void*) hash, 64); + sph_luffa512_close (&ctx_luffa, (void*) hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512 (&ctx_cubehash, (const void*) hash, 64); + sph_cubehash512_close(&ctx_cubehash, (void*) hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512 (&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, (void*) hash); + + sph_simd512_init(&ctx_simd); + sph_simd512 (&ctx_simd, (const void*) hash, 64); + sph_simd512_close(&ctx_simd, (void*) hash); + + sph_echo512_init(&ctx_echo); + sph_echo512 (&ctx_echo, (const void*) hash, 64); + sph_echo512_close(&ctx_echo, (void*) hash); + + sph_hamsi512_init(&ctx_hamsi); + sph_hamsi512 (&ctx_hamsi, (const void*) hash, 64); + sph_hamsi512_close(&ctx_hamsi, (void*) hash); + + sph_fugue512_init(&ctx_fugue); + sph_fugue512 (&ctx_fugue, (const void*) hash, 64); + sph_fugue512_close(&ctx_fugue, (void*) hash); + + memcpy(output, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_x13(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<20; + else if(device_sm[dev_id]<=520) default_throughput = 1<<21; + else if(device_sm[dev_id]>520) default_throughput = (1<<22) + (1<<21); + + if((strstr(device_name[dev_id], "3GB")))default_throughput = 1<<21; + if((strstr(device_name[dev_id], "6GB")))default_throughput = 1<<22; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + throughput&=0xFFFFFF70; //multiples of 128 due to simd_echo kernel + + if (opt_benchmark) + ((uint32_t*)ptarget)[7] = 0x000f; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + uint32_t endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + + do { + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_keccak512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x13_hamsi_fugue512_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id],d_resNonce[thr_id],*(uint64_t*)&ptarget[6]); +// x13_hamsi512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); +// x13_fugue512_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id],d_resNonce[thr_id],*(uint64_t*)&ptarget[6]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + x13hash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput + 1; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], pdata[21]); + x13hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce + 1; + + return 0; +} + +// cleanup +extern "C" void free_x13(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/x14/cuda_x14_shabal512.cu b/x14/cuda_x14_shabal512.cu new file mode 100644 index 0000000..1fd7ad2 --- /dev/null +++ b/x14/cuda_x14_shabal512.cu @@ -0,0 +1,261 @@ +/* + * Shabal-512 for X14/X15 + * Provos Alexis - 2016 + */ +#include "cuda_helper.h" +#include "cuda_vectors.h" + +/* $Id: shabal.c 175 2010-05-07 16:03:20Z tp $ */ +/* + * Shabal implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2007-2010 Projet RNRT SAPHIR + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS B[14] LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * + * @author Thomas Pornin + */ + +__device__ __forceinline__ void PERM_ELT(uint32_t &xa0,const uint32_t xa1,uint32_t &xb0,const uint32_t xb1,const uint32_t xb2,const uint32_t xb3,const uint32_t xc,const uint32_t xm){ + + uint32_t tmp; + #if __CUDA_ARCH__ >= 500 && CUDA_VERSION >= 7050 + asm ("lop3.b32 %0, %1, %2, %3, 0x9A;" : "=r"(tmp) : "r"(xb2),"r"(xb3),"r"(xm)); // 0x9A = (F0 &(~CC)) ^ (AA) + #else + tmp = (xb2 & ~xb3) ^ xm; + #endif + + xa0 = ((xa0 ^ xc ^ (ROTL32(xa1, 15) * 5U)) * 3U) ^ xb1 ^ tmp; + xb0 = xor3x(0xFFFFFFFF, xa0, ROTL32(xb0, 1)); +} + +__device__ __forceinline__ +void PERM_STEP_0(uint32_t *A,uint32_t *B,const uint32_t *C,const uint32_t* M){ + PERM_ELT(A[ 0], A[11], B[ 0], B[13], B[ 9], B[ 6], C[ 8], M[ 0]); PERM_ELT(A[ 1], A[ 0], B[ 1], B[14], B[10], B[ 7], C[ 7], M[ 1]); + PERM_ELT(A[ 2], A[ 1], B[ 2], B[15], B[11], B[ 8], C[ 6], M[ 2]); PERM_ELT(A[ 3], A[ 2], B[ 3], B[ 0], B[12], B[ 9], C[ 5], M[ 3]); + PERM_ELT(A[ 4], A[ 3], B[ 4], B[ 1], B[13], B[10], C[ 4], M[ 4]); PERM_ELT(A[ 5], A[ 4], B[ 5], B[ 2], B[14], B[11], C[ 3], M[ 5]); + PERM_ELT(A[ 6], A[ 5], B[ 6], B[ 3], B[15], B[12], C[ 2], M[ 6]); PERM_ELT(A[ 7], A[ 6], B[ 7], B[ 4], B[ 0], B[13], C[ 1], M[ 7]); + PERM_ELT(A[ 8], A[ 7], B[ 8], B[ 5], B[ 1], B[14], C[ 0], M[ 8]); PERM_ELT(A[ 9], A[ 8], B[ 9], B[ 6], B[ 2], B[15], C[15], M[ 9]); + PERM_ELT(A[10], A[ 9], B[10], B[ 7], B[ 3], B[ 0], C[14], M[10]); PERM_ELT(A[11], A[10], B[11], B[ 8], B[ 4], B[ 1], C[13], M[11]); + PERM_ELT(A[ 0], A[11], B[12], B[ 9], B[ 5], B[ 2], C[12], M[12]); PERM_ELT(A[ 1], A[ 0], B[13], B[10], B[ 6], B[ 3], C[11], M[13]); + PERM_ELT(A[ 2], A[ 1], B[14], B[11], B[ 7], B[ 4], C[10], M[14]); PERM_ELT(A[ 3], A[ 2], B[15], B[12], B[ 8], B[ 5], C[ 9], M[15]); +} + +__device__ __forceinline__ +void PERM_STEP_1(uint32_t *A,uint32_t *B,const uint32_t *C,const uint32_t* M){ + PERM_ELT(A[ 4], A[ 3], B[ 0], B[13], B[ 9], B[ 6], C[ 8], M[ 0]); PERM_ELT(A[ 5], A[ 4], B[ 1], B[14], B[10], B[ 7], C[ 7], M[ 1]); + PERM_ELT(A[ 6], A[ 5], B[ 2], B[15], B[11], B[ 8], C[ 6], M[ 2]); PERM_ELT(A[ 7], A[ 6], B[ 3], B[ 0], B[12], B[ 9], C[ 5], M[ 3]); + PERM_ELT(A[ 8], A[ 7], B[ 4], B[ 1], B[13], B[10], C[ 4], M[ 4]); PERM_ELT(A[ 9], A[ 8], B[ 5], B[ 2], B[14], B[11], C[ 3], M[ 5]); + PERM_ELT(A[10], A[ 9], B[ 6], B[ 3], B[15], B[12], C[ 2], M[ 6]); PERM_ELT(A[11], A[10], B[ 7], B[ 4], B[ 0], B[13], C[ 1], M[ 7]); + PERM_ELT(A[ 0], A[11], B[ 8], B[ 5], B[ 1], B[14], C[ 0], M[ 8]); PERM_ELT(A[ 1], A[ 0], B[ 9], B[ 6], B[ 2], B[15], C[15], M[ 9]); + PERM_ELT(A[ 2], A[ 1], B[10], B[ 7], B[ 3], B[ 0], C[14], M[10]); PERM_ELT(A[ 3], A[ 2], B[11], B[ 8], B[ 4], B[ 1], C[13], M[11]); + PERM_ELT(A[ 4], A[ 3], B[12], B[ 9], B[ 5], B[ 2], C[12], M[12]); PERM_ELT(A[ 5], A[ 4], B[13], B[10], B[ 6], B[ 3], C[11], M[13]); + PERM_ELT(A[ 6], A[ 5], B[14], B[11], B[ 7], B[ 4], C[10], M[14]); PERM_ELT(A[ 7], A[ 6], B[15], B[12], B[ 8], B[ 5], C[ 9], M[15]); +} + +__device__ __forceinline__ +void PERM_STEP_2(uint32_t *A,uint32_t *B,const uint32_t *C,const uint32_t* M){ + PERM_ELT(A[ 8], A[ 7], B[ 0], B[13], B[ 9], B[ 6], C[ 8], M[ 0]); PERM_ELT(A[ 9], A[ 8], B[ 1], B[14], B[10], B[ 7], C[ 7], M[ 1]); + PERM_ELT(A[10], A[ 9], B[ 2], B[15], B[11], B[ 8], C[ 6], M[ 2]); PERM_ELT(A[11], A[10], B[ 3], B[ 0], B[12], B[ 9], C[ 5], M[ 3]); + PERM_ELT(A[ 0], A[11], B[ 4], B[ 1], B[13], B[10], C[ 4], M[ 4]); PERM_ELT(A[ 1], A[ 0], B[ 5], B[ 2], B[14], B[11], C[ 3], M[ 5]); + PERM_ELT(A[ 2], A[ 1], B[ 6], B[ 3], B[15], B[12], C[ 2], M[ 6]); PERM_ELT(A[ 3], A[ 2], B[ 7], B[ 4], B[ 0], B[13], C[ 1], M[ 7]); + PERM_ELT(A[ 4], A[ 3], B[ 8], B[ 5], B[ 1], B[14], C[ 0], M[ 8]); PERM_ELT(A[ 5], A[ 4], B[ 9], B[ 6], B[ 2], B[15], C[15], M[ 9]); + PERM_ELT(A[ 6], A[ 5], B[10], B[ 7], B[ 3], B[ 0], C[14], M[10]); PERM_ELT(A[ 7], A[ 6], B[11], B[ 8], B[ 4], B[ 1], C[13], M[11]); + PERM_ELT(A[ 8], A[ 7], B[12], B[ 9], B[ 5], B[ 2], C[12], M[12]); PERM_ELT(A[ 9], A[ 8], B[13], B[10], B[ 6], B[ 3], C[11], M[13]); + PERM_ELT(A[10], A[ 9], B[14], B[11], B[ 7], B[ 4], C[10], M[14]); PERM_ELT(A[11], A[10], B[15], B[12], B[ 8], B[ 5], C[ 9], M[15]); +} + +__device__ __forceinline__ +void ADD_BLOCK(uint32_t* A, const uint32_t *B){ + A[11]+= B[ 6]; A[10]+= B[ 5]; A[ 9]+= B[ 4]; A[ 8]+= B[ 3]; A[ 7]+= B[ 2]; A[ 6]+= B[ 1]; A[ 5]+= B[ 0]; A[ 4]+= B[15]; A[ 3]+= B[14]; A[ 2]+= B[13]; A[ 1]+= B[12]; A[ 0]+= B[11]; + A[11]+= B[10]; A[10]+= B[ 9]; A[ 9]+= B[ 8]; A[ 8]+= B[ 7]; A[ 7]+= B[ 6]; A[ 6]+= B[ 5]; A[ 5]+= B[ 4]; A[ 4]+= B[ 3]; A[ 3]+= B[ 2]; A[ 2]+= B[ 1]; A[ 1]+= B[ 0]; A[ 0]+= B[15]; + A[11]+= B[14]; A[10]+= B[13]; A[ 9]+= B[12]; A[ 8]+= B[11]; A[ 7]+= B[10]; A[ 6]+= B[ 9]; A[ 5]+= B[ 8]; A[ 4]+= B[ 7]; A[ 3]+= B[ 6]; A[ 2]+= B[ 5]; A[ 1]+= B[ 4]; A[ 0]+= B[ 3]; +} +__device__ __forceinline__ +void ROTATE(uint32_t* A){ + #pragma unroll 16 + for(int i=0;i<16;i++){ + A[ i] = ROTL32(A[ i],17); + } +} +/***************************************************/ +// GPU Hash Function +__global__ __launch_bounds__(384,3) +void x14_shabal512_gpu_hash_64(uint32_t threads, uint32_t *g_hash){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint32_t A[]={ + 0x20728DFD, 0x46C0BD53, 0xE782B699, 0x55304632, 0x71B4EF90, 0x0EA9E82C, 0xDBB930F1, 0xFAD06B8B, + 0xBE0CAE40, 0x8BD14410, 0x76D2ADAC, 0x28ACAB7F}; + uint32_t B[]={ + 0xC1099CB7, 0x07B385F3, 0xE7442C26, 0xCC8AD640, 0xEB6F56C7, 0x1EA81AA9, 0x73B9D314, 0x1DE85D08, + 0x48910A5A, 0x893B22DB, 0xC5A0DF44, 0xBBC4324E, 0x72D2F240, 0x75941D99, 0x6D8BDE82, 0xA1A7502B}; + uint32_t C[]={ + 0xD9BF68D1, 0x58BAD750, 0x56028CB2, 0x8134F359, 0xB5D469D8, 0x941A8CC2, 0x418B2A6E, 0x04052780, + 0x7F07D787, 0x5194358F, 0x3C60D665, 0xBE97D79A, 0x950C3434, 0xAED9A06D, 0x2537DC8D, 0x7CDB5969}; + uint32_t M[16]; + + if (thread < threads){ + + uint32_t *Hash = &g_hash[thread<<4]; + + *(uint2x4*)&M[ 0] = __ldg4((uint2x4*)&Hash[ 0]); + *(uint2x4*)&M[ 8] = __ldg4((uint2x4*)&Hash[ 8]); + + *(uint16*)&B[ 0]+= *(uint16*)&M[ 0]; + A[ 0] ^= 1; + ROTATE(B); + PERM_STEP_0(A,B,C,M); + PERM_STEP_1(A,B,C,M); + PERM_STEP_2(A,B,C,M); + ADD_BLOCK(A,C); + *(uint16*)&C[ 0]-= *(uint16*)&M[ 0]; +// SWAP_BC; + + M[ 0] = 0x80; + M[ 1] = M[ 2] = M[ 3] = M[ 4] = M[ 5] = M[ 6] = M[ 7] = M[ 8] = M[ 9] = M[10] = M[11] = M[12] = M[13] = M[14] = M[15] = 0; + C[ 0]+= M[ 0]; + A[ 0]^= 0x02; + ROTATE(C); + PERM_STEP_0(A,C,B,M); + PERM_STEP_1(A,C,B,M); + PERM_STEP_2(A,C,B,M); + ADD_BLOCK(A,B); + A[ 0] ^= 0x02; + ROTATE(B); + PERM_STEP_0(A,B,C,M); + PERM_STEP_1(A,B,C,M); + PERM_STEP_2(A,B,C,M); + ADD_BLOCK(A,C); + A[ 0] ^= 0x02; + ROTATE(C); + PERM_STEP_0(A,C,B,M); + PERM_STEP_1(A,C,B,M); + PERM_STEP_2(A,C,B,M); + ADD_BLOCK(A,B); + A[ 0] ^= 0x02; + ROTATE(B); + PERM_STEP_0(A,B,C,M); + PERM_STEP_1(A,B,C,M); + PERM_STEP_2(A,B,C,M); + + *(uint2x4*)&Hash[ 0] = *(uint2x4*)&B[ 0]; + *(uint2x4*)&Hash[ 8] = *(uint2x4*)&B[ 8]; + } +} + +__host__ void x14_shabal512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + const uint32_t threadsperblock = 384; + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x14_shabal512_gpu_hash_64<<>>(threads, d_hash); +} + +__global__ __launch_bounds__(512,2) +void x14_shabal512_gpu_hash_64_final(uint32_t threads,const uint32_t* __restrict__ g_hash,uint32_t* resNonce, const uint64_t target){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint32_t A[]={ + 0x20728DFD, 0x46C0BD53, 0xE782B699, 0x55304632, 0x71B4EF90, 0x0EA9E82C, 0xDBB930F1, 0xFAD06B8B, + 0xBE0CAE40, 0x8BD14410, 0x76D2ADAC, 0x28ACAB7F}; + uint32_t B[]={ + 0xC1099CB7, 0x07B385F3, 0xE7442C26, 0xCC8AD640, 0xEB6F56C7, 0x1EA81AA9, 0x73B9D314, 0x1DE85D08, + 0x48910A5A, 0x893B22DB, 0xC5A0DF44, 0xBBC4324E, 0x72D2F240, 0x75941D99, 0x6D8BDE82, 0xA1A7502B}; + uint32_t C[]={ + 0xD9BF68D1, 0x58BAD750, 0x56028CB2, 0x8134F359, 0xB5D469D8, 0x941A8CC2, 0x418B2A6E, 0x04052780, + 0x7F07D787, 0x5194358F, 0x3C60D665, 0xBE97D79A, 0x950C3434, 0xAED9A06D, 0x2537DC8D, 0x7CDB5969}; + uint32_t M[16]; + + if (thread < threads){ + + const uint32_t *Hash = &g_hash[thread<<4]; + + *(uint2x4*)&M[ 0] = __ldg4((uint2x4*)&Hash[ 0]); + *(uint2x4*)&M[ 8] = __ldg4((uint2x4*)&Hash[ 8]); + + *(uint16*)&B[ 0]+= *(uint16*)&M[ 0]; + A[ 0] ^= 1; + ROTATE(B); + PERM_STEP_0(A,B,C,M); + PERM_STEP_1(A,B,C,M); + PERM_STEP_2(A,B,C,M); + ADD_BLOCK(A,C); + *(uint16*)&C[ 0]-= *(uint16*)&M[ 0]; +// SWAP_BC; + + M[ 0] = 0x80; + M[ 1] = M[ 2] = M[ 3] = M[ 4] = M[ 5] = M[ 6] = M[ 7] = M[ 8] = M[ 9] = M[10] = M[11] = M[12] = M[13] = M[14] = M[15] = 0; + C[ 0]+= M[ 0]; + A[ 0]^= 0x02; + ROTATE(C); + PERM_STEP_0(A,C,B,M); + PERM_STEP_1(A,C,B,M); + PERM_STEP_2(A,C,B,M); + ADD_BLOCK(A,B); + A[ 0] ^= 0x02; + ROTATE(B); + PERM_STEP_0(A,B,C,M); + PERM_STEP_1(A,B,C,M); + PERM_STEP_2(A,B,C,M); + ADD_BLOCK(A,C); + A[ 0] ^= 0x02; + ROTATE(C); + PERM_STEP_0(A,C,B,M); + PERM_STEP_1(A,C,B,M); + PERM_STEP_2(A,C,B,M); + ADD_BLOCK(A,B); + A[ 0] ^= 0x02; + ROTATE(B); + PERM_STEP_0(A,B,C,M); + PERM_STEP_1(A,B,C,M); +// PERM_STEP_2(A,B,C,M); + PERM_ELT(A[ 8], A[ 7], B[ 0], B[13], B[ 9], B[ 6], C[ 8], M[ 0]); PERM_ELT(A[ 9], A[ 8], B[ 1], B[14], B[10], B[ 7], C[ 7], M[ 1]); + PERM_ELT(A[10], A[ 9], B[ 2], B[15], B[11], B[ 8], C[ 6], M[ 2]); PERM_ELT(A[11], A[10], B[ 3], B[ 0], B[12], B[ 9], C[ 5], M[ 3]); + PERM_ELT(A[ 0], A[11], B[ 4], B[ 1], B[13], B[10], C[ 4], M[ 4]); PERM_ELT(A[ 1], A[ 0], B[ 5], B[ 2], B[14], B[11], C[ 3], M[ 5]); + PERM_ELT(A[ 2], A[ 1], B[ 6], B[ 3], B[15], B[12], C[ 2], M[ 6]); PERM_ELT(A[ 3], A[ 2], B[ 7], B[ 4], B[ 0], B[13], C[ 1], M[ 7]); + + if(*(uint64_t*)&B[ 6] <= target){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } +} + +__host__ void x14_shabal512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target){ + + const uint32_t threadsperblock = 512; + + // berechne wie viele Thread Blocks wir brauchen + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x14_shabal512_gpu_hash_64_final<<>>(threads, d_hash, d_resNonce, target); +} diff --git a/x14/x14.cu b/x14/x14.cu new file mode 100644 index 0000000..60d0980 --- /dev/null +++ b/x14/x14.cu @@ -0,0 +1,254 @@ +/* + * X14 algorithm + * Added in ccminer by Tanguy Pruvot - 2014 + */ + +extern "C" { +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" + +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" + +#include "sph/sph_hamsi.h" +#include "sph/sph_fugue.h" +#include "sph/sph_shabal.h" +} + +#include "miner.h" + +#include "cuda_helper.h" +#include "x11/cuda_x11.h" + +#define NBN 2 + +// Memory for the hash functions +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + + +extern void x13_hamsi_fugue512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void x14_shabal512_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target); + +// X14 CPU Hash function +extern "C" void x14hash(void *output, const void *input) +{ + unsigned char hash[128]; // uint32_t hashA[16], hashB[16]; + #define hashB hash+64 + + memset(hash, 0, sizeof hash); + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + sph_hamsi512_context ctx_hamsi; + sph_fugue512_context ctx_fugue; + sph_shabal512_context ctx_shabal; + + sph_blake512_init(&ctx_blake); + sph_blake512(&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512(&ctx_bmw, hash, 64); + sph_bmw512_close(&ctx_bmw, hashB); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512(&ctx_groestl, hashB, 64); + sph_groestl512_close(&ctx_groestl, hash); + + sph_skein512_init(&ctx_skein); + sph_skein512(&ctx_skein, hash, 64); + sph_skein512_close(&ctx_skein, hashB); + + sph_jh512_init(&ctx_jh); + sph_jh512(&ctx_jh, hashB, 64); + sph_jh512_close(&ctx_jh, hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512(&ctx_keccak, hash, 64); + sph_keccak512_close(&ctx_keccak, hashB); + + sph_luffa512_init(&ctx_luffa); + sph_luffa512(&ctx_luffa, hashB, 64); + sph_luffa512_close(&ctx_luffa, hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512(&ctx_cubehash, hash, 64); + sph_cubehash512_close(&ctx_cubehash, hashB); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512(&ctx_shavite, hashB, 64); + sph_shavite512_close(&ctx_shavite, hash); + + sph_simd512_init(&ctx_simd); + sph_simd512(&ctx_simd, hash, 64); + sph_simd512_close(&ctx_simd, hashB); + + sph_echo512_init(&ctx_echo); + sph_echo512(&ctx_echo, hashB, 64); + sph_echo512_close(&ctx_echo, hash); + + sph_hamsi512_init(&ctx_hamsi); + sph_hamsi512(&ctx_hamsi, hash, 64); + sph_hamsi512_close(&ctx_hamsi, hashB); + + sph_fugue512_init(&ctx_fugue); + sph_fugue512(&ctx_fugue, hashB, 64); + sph_fugue512_close(&ctx_fugue, hash); + + sph_shabal512_init(&ctx_shabal); + sph_shabal512(&ctx_shabal, hash, 64); + sph_shabal512_close(&ctx_shabal, hash); + + memcpy(output, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_x14(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + uint32_t endiandata[20]; + + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<20; + else if(device_sm[dev_id]<=520) default_throughput = 1<<21; + else if(device_sm[dev_id]>520) default_throughput = 1<<22; + + if((strstr(device_name[dev_id], "3GB")))default_throughput = 1<<21; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + throughput&=0xFFFFFF70; //multiples of 128 due to simd_echo kernel + + if (opt_benchmark) + ptarget[7] = 0x000f; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + for (int k = 0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + do { + + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_keccak512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x13_hamsi_fugue512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); +// x13_fugue512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x14_shabal512_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id], d_resNonce[thr_id], *(uint64_t*)&ptarget[ 6]); + + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + x14hash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput + 1; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], pdata[21]); + x14hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce + 1; + + return 0; +} + +// cleanup +extern "C" void free_x14(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + + init[thr_id] = false; + + cudaDeviceSynchronize(); + +} diff --git a/x15/cuda_whirlpool_tables.cuh b/x15/cuda_whirlpool_tables.cuh new file mode 100644 index 0000000..d5af029 --- /dev/null +++ b/x15/cuda_whirlpool_tables.cuh @@ -0,0 +1,105 @@ +static const uint64_t old1_T0[256] = { + 0x78D8C07818281818, 0xAF2605AF23652323, 0xF9B87EF9C657C6C6, 0x6FFB136FE825E8E8, 0xA1CB4CA187948787, 0x6211A962B8D5B8B8, 0x0509080501030101, 0x6E0D426E4FD14F4F, + 0xEE9BADEE365A3636, 0x04FF5904A6F7A6A6, 0xBD0CDEBDD26BD2D2, 0x060EFB06F502F5F5, 0x8096EF80798B7979, 0xCE305FCE6FB16F6F, 0xEF6DFCEF91AE9191, 0x07F8AA0752F65252, + 0xFD4727FD60A06060, 0x76358976BCD9BCBC, 0xCD37ACCD9BB09B9B, 0x8C8A048C8E8F8E8E, 0x15D27115A3F8A3A3, 0x3C6C603C0C140C0C, 0x8A84FF8A7B8D7B7B, 0xE180B5E1355F3535, + 0x69F5E8691D271D1D, 0x47B35347E03DE0E0, 0xAC21F6ACD764D7D7, 0xED9C5EEDC25BC2C2, 0x96436D962E722E2E, 0x7A29627A4BDD4B4B, 0x215DA321FE1FFEFE, 0x16D5821657F95757, + 0x41BDA841153F1515, 0xB6E89FB677997777, 0xEB92A5EB37593737, 0x569E7B56E532E5E5, 0xD9138CD99FBC9F9F, 0x1723D317F00DF0F0, 0x7F206A7F4ADE4A4A, 0x95449E95DA73DADA, + 0x25A2FA2558E85858, 0xCACF06CAC946C9C9, 0x8D7C558D297B2929, 0x225A50220A1E0A0A, 0x4F50E14FB1CEB1B1, 0x1AC9691AA0FDA0A0, 0xDA147FDA6BBD6B6B, 0xABD95CAB85928585, + 0x733C8173BDDABDBD, 0x348FD2345DE75D5D, 0x5090805010301010, 0x0307F303F401F4F4, 0xC0DD16C0CB40CBCB, 0xC6D3EDC63E423E3E, 0x112D2811050F0505, 0xE6781FE667A96767, + 0x53977353E431E4E4, 0xBB0225BB27692727, 0x5873325841C34141, 0x9DA72C9D8B808B8B, 0x01F65101A7F4A7A7, 0x94B2CF947D877D7D, 0xFB49DCFB95A29595, 0x9F568E9FD875D8D8, + 0x30708B30FB10FBFB, 0x71CD2371EE2FEEEE, 0x91BBC7917C847C7C, 0xE37117E366AA6666, 0x8E7BA68EDD7ADDDD, 0x4BAFB84B17391717, 0x4645024647C94747, 0xDC1A84DC9EBF9E9E, + 0xC5D41EC5CA43CACA, 0x995875992D772D2D, 0x792E9179BFDCBFBF, 0x1B3F381B07090707, 0x23AC0123ADEAADAD, 0x2FB0EA2F5AEE5A5A, 0xB5EF6CB583988383, 0xFFB685FF33553333, + 0xF25C3FF263A56363, 0x0A12100A02060202, 0x38933938AAE3AAAA, 0xA8DEAFA871937171, 0xCFC60ECFC845C8C8, 0x7DD1C87D192B1919, 0x703B727049DB4949, 0x9A5F869AD976D9D9, + 0x1D31C31DF20BF2F2, 0x48A84B48E338E3E3, 0x2AB9E22A5BED5B5B, 0x92BC349288858888, 0xC83EA4C89AB39A9A, 0xBE0B2DBE266A2626, 0xFABF8DFA32563232, 0x4A59E94AB0CDB0B0, + 0x6AF21B6AE926E9E9, 0x337778330F110F0F, 0xA633E6A6D562D5D5, 0xBAF474BA809D8080, 0x7C27997CBEDFBEBE, 0xDEEB26DECD4ACDCD, 0xE489BDE4345C3434, 0x75327A7548D84848, + 0x2454AB24FF1CFFFF, 0x8F8DF78F7A8E7A7A, 0xEA64F4EA90AD9090, 0x3E9DC23E5FE15F5F, 0xA03D1DA020602020, 0xD50F67D568B86868, 0x72CAD0721A2E1A1A, 0x2CB7192CAEEFAEAE, + 0x5E7DC95EB4C1B4B4, 0x19CE9A1954FC5454, 0xE57FECE593A89393, 0xAA2F0DAA22662222, 0xE96307E964AC6464, 0x122ADB12F10EF1F1, 0xA2CCBFA273957373, 0x5A82905A12361212, + 0x5D7A3A5D40C04040, 0x2848402808180808, 0xE89556E8C358C3C3, 0x7BDF337BEC29ECEC, 0x904D9690DB70DBDB, 0x1FC0611FA1FEA1A1, 0x83911C838D8A8D8D, 0xC9C8F5C93D473D3D, + 0xF15BCCF197A49797, 0x0000000000000000, 0xD4F936D4CF4CCFCF, 0x876E45872B7D2B2B, 0xB3E197B3769A7676, 0xB0E664B0829B8282, 0xA928FEA9D667D6D6, 0x77C3D8771B2D1B1B, + 0x5B74C15BB5C2B5B5, 0x29BE1129AFECAFAF, 0xDF1D77DF6ABE6A6A, 0x0DEABA0D50F05050, 0x4C57124C45CF4545, 0x1838CB18F308F3F3, 0xF0AD9DF030503030, 0x74C42B74EF2CEFEF, + 0xC3DAE5C33F413F3F, 0x1CC7921C55FF5555, 0x10DB7910A2FBA2A2, 0x65E90365EA23EAEA, 0xEC6A0FEC65AF6565, 0x6803B968BAD3BABA, 0x934A65932F712F2F, 0xE78E4EE7C05DC0C0, + 0x8160BE81DE7FDEDE, 0x6CFCE06C1C241C1C, 0x2E46BB2EFD1AFDFD, 0x641F52644DD74D4D, 0xE076E4E092AB9292, 0xBCFA8FBC759F7575, 0x1E36301E060A0606, 0x98AE24988A838A8A, + 0x404BF940B2CBB2B2, 0x59856359E637E6E6, 0x367E70360E120E0E, 0x63E7F8631F211F1F, 0xF75537F762A66262, 0xA33AEEA3D461D4D4, 0x32812932A8E5A8A8, 0xF452C4F496A79696, + 0x3A629B3AF916F9F9, 0xF6A366F6C552C5C5, 0xB11035B1256F2525, 0x20ABF22059EB5959, 0xAED054AE84918484, 0xA7C5B7A772967272, 0xDDECD5DD394B3939, 0x61165A614CD44C4C, + 0x3B94CA3B5EE25E5E, 0x859FE78578887878, 0xD8E5DDD838483838, 0x869814868C898C8C, 0xB217C6B2D16ED1D1, 0x0BE4410BA5F2A5A5, 0x4DA1434DE23BE2E2, 0xF84E2FF861A36161, + 0x4542F145B3C8B3B3, 0xA53415A521632121, 0xD60894D69CB99C9C, 0x66EEF0661E221E1E, 0x5261225243C54343, 0xFCB176FCC754C7C7, 0x2B4FB32BFC19FCFC, 0x14242014040C0404, + 0x08E3B20851F35151, 0xC725BCC799B69999, 0xC4224FC46DB76D6D, 0x396568390D170D0D, 0x35798335FA13FAFA, 0x8469B684DF7CDFDF, 0x9BA9D79B7E827E7E, 0xB4193DB4246C2424, + 0xD7FEC5D73B4D3B3B, 0x3D9A313DABE0ABAB, 0xD1F03ED1CE4FCECE, 0x5599885511331111, 0x89830C898F8C8F8F, 0x6B044A6B4ED24E4E, 0x5166D151B7C4B7B7, 0x60E00B60EB20EBEB, + 0xCCC1FDCC3C443C3C, 0xBFFD7CBF819E8181, 0xFE40D4FE94A19494, 0x0C1CEB0CF704F7F7, 0x6718A167B9D6B9B9, 0x5F8B985F13351313, 0x9C517D9C2C742C2C, 0xB805D6B8D368D3D3, + 0x5C8C6B5CE734E7E7, 0xCB3957CB6EB26E6E, 0xF3AA6EF3C451C4C4, 0x0F1B180F03050303, 0x13DC8A1356FA5656, 0x495E1A4944CC4444, 0x9EA0DF9E7F817F7F, 0x37882137A9E6A9A9, + 0x82674D822A7E2A2A, 0x6D0AB16DBBD0BBBB, 0xE28746E2C15EC1C1, 0x02F1A20253F55353, 0x8B72AE8BDC79DCDC, 0x275358270B1D0B0B, 0xD3019CD39DBA9D9D, 0xC12B47C16CB46C6C, + 0xF5A495F531533131, 0xB9F387B9749C7474, 0x0915E309F607F6F6, 0x434C0A4346CA4646, 0x26A50926ACE9ACAC, 0x97B53C9789868989, 0x44B4A044143C1414, 0x42BA5B42E13EE1E1, + 0x4EA6B04E163A1616, 0xD2F7CDD23A4E3A3A, 0xD0066FD069BB6969, 0x2D41482D091B0909, 0xADD7A7AD70907070, 0x546FD954B6C7B6B6, 0xB71ECEB7D06DD0D0, 0x7ED63B7EED2AEDED, + 0xDBE22EDBCC49CCCC, 0x57682A5742C64242, 0xC22CB4C298B59898, 0x0EED490EA4F1A4A4, 0x88755D8828782828, 0x3186DA315CE45C5C, 0x3F6B933FF815F8F8, 0xA4C244A486978686 +}; + +static const uint64_t old1_RC[10] = { + 0x4F01B887E8C62318, 0x52916F79F5D2A636, 0x357B0CA38E9BBC60, 0x57FE4B2EC2D7E01D, 0xDA4AF09FE5377715, 0x856BA0B10A29C958, 0x67053ECBF4105DBD, 0xD8957DA78B4127E4, + 0x9E4717DD667CEEFB, 0x33835AAD07BF2DCA +}; + +static const uint64_t old1_precomputed_round_key_64[72] = { + 0xECE7FCC7F808AB3B, 0x44E9CB45024545CB, 0xB289A43CA4A489FE, 0xC5E1F3E1E1C5A9A0, 0xFCD4FCFCAC5C48AC, 0x418F8F0E90F70E8F, 0x7979078514077946, 0xF8B87868B8F8D8F8, + 0xE4B6012A17B9C1EF, 0xAFF6AD2866D6C68D, 0xB0C745991504968F, 0x74E93F120FE2E675, 0xC1D216198D2A495B, 0x35B6A53DF6716FD7, 0xD6983228CCDC354F, 0xC3B8BFCB242AB159, + 0x4AC0340260B548D4, 0x3B3582BB4F9BB769, 0xD8683C4AF17C46F8, 0x9EE05220D8214E61, 0xFED2431F5098E0E5, 0x387AF50F0776E24F, 0x7FFD300A74DE5AE1, 0xB753981921AEB24B, + 0x296F5919978BA0BD, 0x52CC9DD7031E59AC, 0xE5E646C9A5165AE3, 0x4F848BDF70532817, 0xA01ADD556B693C51, 0xC7268B83DDB75E97, 0xCB908F9316E2C076, 0x8FC39EE0D946E9C5, + 0x5B256B0FE7937D86, 0xF77C51751A22932C, 0x2582A83CD34108C4, 0xE218CDE28A9C790D, 0xC93A572E592E3594, 0xEA70CF71BC4E55AC, 0xC135C8214155BC85, 0x50989643A6B8456E, + 0x60E970DFD74C71E6, 0xC0B5A520AB7C88D8, 0x3A66AA761D5B1400, 0x0502AB3087300DE6, 0xC06203EDED483DEA, 0xC2620EDF55C1CB74, 0xF36A22CF9AA452F1, 0xB3502DC83BA2660F, + 0xCF249B6DB82273C3, 0xC74DADAB026388F2, 0xB8B77B3275AFCDE8, 0xC9947382C6D6A3C0, 0x84938F2258A6BC21, 0x1E51E15A3B99CDF7, 0xC812F9AC41F5CC05, 0x21BFEC61E9B9393E, + 0xF576066160243540, 0x3A62D1CB6404180D, 0x8807A55C2AC7AFE2, 0x804237B54859503E, 0x1619B3612106744B, 0xC1ECB5643D81C76F, 0xBA7CBB8C13214C6C, 0xD241AEAD7622701E, + 0xDD900A1B66BF748C, 0xCACCF665EC2391FE, 0xF9BED90100B89447, 0x4CF5D284E56B7A0F, 0x003EB289B6993F96, 0xE9DB01146199245D, 0x97701270F3F41CCB, 0x9C8CA117E01E4B49 +}; + +//-------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +static const uint64_t plain_T0[256] = { + 0xD83078C018601818, 0x2646AF05238C2323, 0xB891F97EC63FC6C6, 0xFBCD6F13E887E8E8, 0xCB13A14C87268787, 0x116D62A9B8DAB8B8, 0x0902050801040101, 0x0D9E6E424F214F4F, + 0x9B6CEEAD36D83636, 0xFF510459A6A2A6A6, 0x0CB9BDDED26FD2D2, 0x0EF706FBF5F3F5F5, 0x96F280EF79F97979, 0x30DECE5F6FA16F6F, 0x6D3FEFFC917E9191, 0xF8A407AA52555252, + 0x47C0FD27609D6060, 0x35657689BCCABCBC, 0x372BCDAC9B569B9B, 0x8A018C048E028E8E, 0xD25B1571A3B6A3A3, 0x6C183C600C300C0C, 0x84F68AFF7BF17B7B, 0x806AE1B535D43535, + 0xF53A69E81D741D1D, 0xB3DD4753E0A7E0E0, 0x21B3ACF6D77BD7D7, 0x9C99ED5EC22FC2C2, 0x435C966D2EB82E2E, 0x29967A624B314B4B, 0x5DE121A3FEDFFEFE, 0xD5AE168257415757, + 0xBD2A41A815541515, 0xE8EEB69F77C17777, 0x926EEBA537DC3737, 0x9ED7567BE5B3E5E5, 0x1323D98C9F469F9F, 0x23FD17D3F0E7F0F0, 0x20947F6A4A354A4A, 0x44A9959EDA4FDADA, + 0xA2B025FA587D5858, 0xCF8FCA06C903C9C9, 0x7C528D5529A42929, 0x5A1422500A280A0A, 0x507F4FE1B1FEB1B1, 0xC95D1A69A0BAA0A0, 0x14D6DA7F6BB16B6B, 0xD917AB5C852E8585, + 0x3C677381BDCEBDBD, 0x8FBA34D25D695D5D, 0x9020508010401010, 0x07F503F3F4F7F4F4, 0xDD8BC016CB0BCBCB, 0xD37CC6ED3EF83E3E, 0x2D0A112805140505, 0x78CEE61F67816767, + 0x97D55373E4B7E4E4, 0x024EBB25279C2727, 0x7382583241194141, 0xA70B9D2C8B168B8B, 0xF6530151A7A6A7A7, 0xB2FA94CF7DE97D7D, 0x4937FBDC956E9595, 0x56AD9F8ED847D8D8, + 0x70EB308BFBCBFBFB, 0xCDC17123EE9FEEEE, 0xBBF891C77CED7C7C, 0x71CCE31766856666, 0x7BA78EA6DD53DDDD, 0xAF2E4BB8175C1717, 0x458E460247014747, 0x1A21DC849E429E9E, + 0xD489C51ECA0FCACA, 0x585A99752DB42D2D, 0x2E637991BFC6BFBF, 0x3F0E1B38071C0707, 0xAC472301AD8EADAD, 0xB0B42FEA5A755A5A, 0xEF1BB56C83368383, 0xB666FF8533CC3333, + 0x5CC6F23F63916363, 0x12040A1002080202, 0x93493839AA92AAAA, 0xDEE2A8AF71D97171, 0xC68DCF0EC807C8C8, 0xD1327DC819641919, 0x3B92707249394949, 0x5FAF9A86D943D9D9, + 0x31F91DC3F2EFF2F2, 0xA8DB484BE3ABE3E3, 0xB9B62AE25B715B5B, 0xBC0D9234881A8888, 0x3E29C8A49A529A9A, 0x0B4CBE2D26982626, 0xBF64FA8D32C83232, 0x597D4AE9B0FAB0B0, + 0xF2CF6A1BE983E9E9, 0x771E33780F3C0F0F, 0x33B7A6E6D573D5D5, 0xF41DBA74803A8080, 0x27617C99BEC2BEBE, 0xEB87DE26CD13CDCD, 0x8968E4BD34D03434, 0x3290757A483D4848, + 0x54E324ABFFDBFFFF, 0x8DF48FF77AF57A7A, 0x643DEAF4907A9090, 0x9DBE3EC25F615F5F, 0x3D40A01D20802020, 0x0FD0D56768BD6868, 0xCA3472D01A681A1A, 0xB7412C19AE82AEAE, + 0x7D755EC9B4EAB4B4, 0xCEA8199A544D5454, 0x7F3BE5EC93769393, 0x2F44AA0D22882222, 0x63C8E907648D6464, 0x2AFF12DBF1E3F1F1, 0xCCE6A2BF73D17373, 0x82245A9012481212, + 0x7A805D3A401D4040, 0x4810284008200808, 0x959BE856C32BC3C3, 0xDFC57B33EC97ECEC, 0x4DAB9096DB4BDBDB, 0xC05F1F61A1BEA1A1, 0x9107831C8D0E8D8D, 0xC87AC9F53DF43D3D, + 0x5B33F1CC97669797, 0x0000000000000000, 0xF983D436CF1BCFCF, 0x6E5687452BAC2B2B, 0xE1ECB39776C57676, 0xE619B06482328282, 0x28B1A9FED67FD6D6, 0xC33677D81B6C1B1B, + 0x74775BC1B5EEB5B5, 0xBE432911AF86AFAF, 0x1DD4DF776AB56A6A, 0xEAA00DBA505D5050, 0x578A4C1245094545, 0x38FB18CBF3EBF3F3, 0xAD60F09D30C03030, 0xC4C3742BEF9BEFEF, + 0xDA7EC3E53FFC3F3F, 0xC7AA1C9255495555, 0xDB591079A2B2A2A2, 0xE9C96503EA8FEAEA, 0x6ACAEC0F65896565, 0x036968B9BAD2BABA, 0x4A5E93652FBC2F2F, 0x8E9DE74EC027C0C0, + 0x60A181BEDE5FDEDE, 0xFC386CE01C701C1C, 0x46E72EBBFDD3FDFD, 0x1F9A64524D294D4D, 0x7639E0E492729292, 0xFAEABC8F75C97575, 0x360C1E3006180606, 0xAE0998248A128A8A, + 0x4B7940F9B2F2B2B2, 0x85D15963E6BFE6E6, 0x7E1C36700E380E0E, 0xE73E63F81F7C1F1F, 0x55C4F73762956262, 0x3AB5A3EED477D4D4, 0x814D3229A89AA8A8, 0x5231F4C496629696, + 0x62EF3A9BF9C3F9F9, 0xA397F666C533C5C5, 0x104AB13525942525, 0xABB220F259795959, 0xD015AE54842A8484, 0xC5E4A7B772D57272, 0xEC72DDD539E43939, 0x1698615A4C2D4C4C, + 0x94BC3BCA5E655E5E, 0x9FF085E778FD7878, 0xE570D8DD38E03838, 0x980586148C0A8C8C, 0x17BFB2C6D163D1D1, 0xE4570B41A5AEA5A5, 0xA1D94D43E2AFE2E2, 0x4EC2F82F61996161, + 0x427B45F1B3F6B3B3, 0x3442A51521842121, 0x0825D6949C4A9C9C, 0xEE3C66F01E781E1E, 0x6186522243114343, 0xB193FC76C73BC7C7, 0x4FE52BB3FCD7FCFC, 0x2408142004100404, + 0xE3A208B251595151, 0x252FC7BC995E9999, 0x22DAC44F6DA96D6D, 0x651A39680D340D0D, 0x79E93583FACFFAFA, 0x69A384B6DF5BDFDF, 0xA9FC9BD77EE57E7E, 0x1948B43D24902424, + 0xFE76D7C53BEC3B3B, 0x9A4B3D31AB96ABAB, 0xF081D13ECE1FCECE, 0x9922558811441111, 0x8303890C8F068F8F, 0x049C6B4A4E254E4E, 0x667351D1B7E6B7B7, 0xE0CB600BEB8BEBEB, + 0xC178CCFD3CF03C3C, 0xFD1FBF7C813E8181, 0x4035FED4946A9494, 0x1CF30CEBF7FBF7F7, 0x186F67A1B9DEB9B9, 0x8B265F98134C1313, 0x51589C7D2CB02C2C, 0x05BBB8D6D36BD3D3, + 0x8CD35C6BE7BBE7E7, 0x39DCCB576EA56E6E, 0xAA95F36EC437C4C4, 0x1B060F18030C0303, 0xDCAC138A56455656, 0x5E88491A440D4444, 0xA0FE9EDF7FE17F7F, 0x884F3721A99EA9A9, + 0x6754824D2AA82A2A, 0x0A6B6DB1BBD6BBBB, 0x879FE246C123C1C1, 0xF1A602A253515353, 0x72A58BAEDC57DCDC, 0x531627580B2C0B0B, 0x0127D39C9D4E9D9D, 0x2BD8C1476CAD6C6C, + 0xA462F59531C43131, 0xF3E8B98774CD7474, 0x15F109E3F6FFF6F6, 0x4C8C430A46054646, 0xA5452609AC8AACAC, 0xB50F973C891E8989, 0xB42844A014501414, 0xBADF425BE1A3E1E1, + 0xA62C4EB016581616, 0xF774D2CD3AE83A3A, 0x06D2D06F69B96969, 0x41122D4809240909, 0xD7E0ADA770DD7070, 0x6F7154D9B6E2B6B6, 0x1EBDB7CED067D0D0, 0xD6C77E3BED93EDED, + 0xE285DB2ECC17CCCC, 0x6884572A42154242, 0x2C2DC2B4985A9898, 0xED550E49A4AAA4A4, 0x7550885D28A02828, 0x86B831DA5C6D5C5C, 0x6BED3F93F8C7F8F8, 0xC211A44486228686 +}; + +static const uint64_t plain_RC[10] = { + 0x4F01B887E8C62318, 0x52916F79F5D2A636, 0x357B0CA38E9BBC60, 0x57FE4B2EC2D7E01D, 0xDA4AF09FE5377715, 0x856BA0B10A29C958, 0x67053ECBF4105DBD, 0xD8957DA78B4127E4, + 0x9E4717DD667CEEFB, 0x33835AAD07BF2DCA +}; + +static const uint64_t plain_precomputed_round_key_64[72] = { + 0x24AED1EAF889AB3B, 0xAFCBE94566454544, 0x89B2A4C5A4A4FE70, 0xA0E1CCE1E1A9FAC5, 0xFCB8FCFC5CC0AC48, 0x698F8F90260EF78F, 0x797985D707147996, 0xF878C8B868F8A8F8, + 0x58704630DBBF19D3, 0xDB37CFAFD1235B29, 0x98AC958BC28A2C01, 0xA706B2C0B19E6381, 0xDB09B2B07A605E44, 0x71BC8CBCCF2C5B73, 0xD3DDEDEF240967DC, 0x197D3BD7F03B8D7B, + 0x866511DEC1AABE38, 0x7F33874AD0F37C68, 0x57F0AD98DBFA37F3, 0xBC8D35EE5842E2C5, 0x7E246E99E8F00911, 0x0134B010EDD6C501, 0xD3EC287BF152C9FB, 0x4027F1C70CDC5632, + 0x14CF9B9420A525AF, 0x4D53C4E3A92636C1, 0xE1F94077867D0FE6, 0x29066AE2BBE65D91, 0x8D5EFE4CCC545A96, 0xA63A3262CB31E9BE, 0x476A849618597BB1, 0x31AF592736C9F0D4, + 0xB00B3725C0B5F9E2, 0xA5948416A2CB2B39, 0x148C34FACEF88A60, 0x19928C416437A57A, 0x893F83FAA146F3B3, 0x7CCF0278483F4997, 0x238F001EBAE8ADDC, 0x3D32B0ED494F7792, + 0x2FFF4D7782634175, 0x00460355D038FAFF, 0x61F3983E49027DBF, 0x0BCEE59AC260A8F4, 0x279D5DEE445ADFC8, 0xA4007504555AF423, 0x8CE2F902121016B0, 0x1D33336829CD30AC, + 0x89AD846882F16B03, 0x637146D862C64099, 0x10C2194B173E434C, 0xC586FF4CD3CF9CE2, 0x5326DF42A011FF21, 0x134BE46CCB008E1B, 0xCEB747A3F73B12A6, 0xCA33283B0E9018D9, + 0xF92C9A0A7A671CD0, 0xB2B6634A532F942A, 0xB4A8ACFE46224288, 0x5935583DC75C4A47, 0xA16F5CA55D92A674, 0x395C73C48CE61777, 0xC61AEC530B3B2A08, 0x62E74D81EB58F62A, + 0x3ABCEE01B6489548, 0x818EED6BC66B0DA5, 0x755A2688CF3DCEE0, 0xE99CF6C0DB4A8CC2, 0x1385717FD59CB754, 0x7B0B7D978A4B4143, 0x7A15F6DBBB351963, 0x27820137F64E7A6A +}; diff --git a/x15/cuda_whirlpoolx.cu b/x15/cuda_whirlpoolx.cu new file mode 100644 index 0000000..cd25832 --- /dev/null +++ b/x15/cuda_whirlpoolx.cu @@ -0,0 +1,460 @@ +/* + * Built on cbuchner1's implementation, actual hashing code + * based on sphlib 3.0 + */ +#include +#include + +#define threadsPerBlock 1024 + +#include "cuda_helper.h" + +__constant__ uint64_t c_PaddedMessage80[16]; // padded message (80 bytes + padding) +__constant__ uint64_t c_tmp[8*9]; +__constant__ uint64_t pTarget[4]; + +uint32_t *d_wxnonce[MAX_GPUS] = { 0 }; +uint32_t *d_WXNonce[MAX_GPUS] = { 0 }; + +/** + * Whirlpool CUDA kernel implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2014 djm34 & tpruvot & SP & Provos Alexis + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * @author djm34 + * @author tpruvot + * @author SP + * @author Provos Alexis + */ + +__constant__ __align__(128) uint64_t mixTob0Tox[256]; + +const uint64_t plain_T0[256]= { + 0xD83078C018601818,0x2646AF05238C2323,0xB891F97EC63FC6C6,0xFBCD6F13E887E8E8,0xCB13A14C87268787,0x116D62A9B8DAB8B8,0x0902050801040101,0x0D9E6E424F214F4F,0x9B6CEEAD36D83636, + 0xFF510459A6A2A6A6,0x0CB9BDDED26FD2D2,0x0EF706FBF5F3F5F5,0x96F280EF79F97979,0x30DECE5F6FA16F6F,0x6D3FEFFC917E9191,0xF8A407AA52555252,0x47C0FD27609D6060,0x35657689BCCABCBC, + 0x372BCDAC9B569B9B,0x8A018C048E028E8E,0xD25B1571A3B6A3A3,0x6C183C600C300C0C,0x84F68AFF7BF17B7B,0x806AE1B535D43535,0xF53A69E81D741D1D,0xB3DD4753E0A7E0E0,0x21B3ACF6D77BD7D7, + 0x9C99ED5EC22FC2C2,0x435C966D2EB82E2E,0x29967A624B314B4B,0x5DE121A3FEDFFEFE,0xD5AE168257415757,0xBD2A41A815541515,0xE8EEB69F77C17777,0x926EEBA537DC3737,0x9ED7567BE5B3E5E5, + 0x1323D98C9F469F9F,0x23FD17D3F0E7F0F0,0x20947F6A4A354A4A,0x44A9959EDA4FDADA,0xA2B025FA587D5858,0xCF8FCA06C903C9C9,0x7C528D5529A42929,0x5A1422500A280A0A,0x507F4FE1B1FEB1B1, + 0xC95D1A69A0BAA0A0,0x14D6DA7F6BB16B6B,0xD917AB5C852E8585,0x3C677381BDCEBDBD,0x8FBA34D25D695D5D,0x9020508010401010,0x07F503F3F4F7F4F4,0xDD8BC016CB0BCBCB,0xD37CC6ED3EF83E3E, + 0x2D0A112805140505,0x78CEE61F67816767,0x97D55373E4B7E4E4,0x024EBB25279C2727,0x7382583241194141,0xA70B9D2C8B168B8B,0xF6530151A7A6A7A7,0xB2FA94CF7DE97D7D,0x4937FBDC956E9595, + 0x56AD9F8ED847D8D8,0x70EB308BFBCBFBFB,0xCDC17123EE9FEEEE,0xBBF891C77CED7C7C,0x71CCE31766856666,0x7BA78EA6DD53DDDD,0xAF2E4BB8175C1717,0x458E460247014747,0x1A21DC849E429E9E, + 0xD489C51ECA0FCACA,0x585A99752DB42D2D,0x2E637991BFC6BFBF,0x3F0E1B38071C0707,0xAC472301AD8EADAD,0xB0B42FEA5A755A5A,0xEF1BB56C83368383,0xB666FF8533CC3333,0x5CC6F23F63916363, + 0x12040A1002080202,0x93493839AA92AAAA,0xDEE2A8AF71D97171,0xC68DCF0EC807C8C8,0xD1327DC819641919,0x3B92707249394949,0x5FAF9A86D943D9D9,0x31F91DC3F2EFF2F2,0xA8DB484BE3ABE3E3, + 0xB9B62AE25B715B5B,0xBC0D9234881A8888,0x3E29C8A49A529A9A,0x0B4CBE2D26982626,0xBF64FA8D32C83232,0x597D4AE9B0FAB0B0,0xF2CF6A1BE983E9E9,0x771E33780F3C0F0F,0x33B7A6E6D573D5D5, + 0xF41DBA74803A8080,0x27617C99BEC2BEBE,0xEB87DE26CD13CDCD,0x8968E4BD34D03434,0x3290757A483D4848,0x54E324ABFFDBFFFF,0x8DF48FF77AF57A7A,0x643DEAF4907A9090,0x9DBE3EC25F615F5F, + 0x3D40A01D20802020,0x0FD0D56768BD6868,0xCA3472D01A681A1A,0xB7412C19AE82AEAE,0x7D755EC9B4EAB4B4,0xCEA8199A544D5454,0x7F3BE5EC93769393,0x2F44AA0D22882222,0x63C8E907648D6464, + 0x2AFF12DBF1E3F1F1,0xCCE6A2BF73D17373,0x82245A9012481212,0x7A805D3A401D4040,0x4810284008200808,0x959BE856C32BC3C3,0xDFC57B33EC97ECEC,0x4DAB9096DB4BDBDB,0xC05F1F61A1BEA1A1, + 0x9107831C8D0E8D8D,0xC87AC9F53DF43D3D,0x5B33F1CC97669797,0x0000000000000000,0xF983D436CF1BCFCF,0x6E5687452BAC2B2B,0xE1ECB39776C57676,0xE619B06482328282,0x28B1A9FED67FD6D6, + 0xC33677D81B6C1B1B,0x74775BC1B5EEB5B5,0xBE432911AF86AFAF,0x1DD4DF776AB56A6A,0xEAA00DBA505D5050,0x578A4C1245094545,0x38FB18CBF3EBF3F3,0xAD60F09D30C03030,0xC4C3742BEF9BEFEF, + 0xDA7EC3E53FFC3F3F,0xC7AA1C9255495555,0xDB591079A2B2A2A2,0xE9C96503EA8FEAEA,0x6ACAEC0F65896565,0x036968B9BAD2BABA,0x4A5E93652FBC2F2F,0x8E9DE74EC027C0C0,0x60A181BEDE5FDEDE, + 0xFC386CE01C701C1C,0x46E72EBBFDD3FDFD,0x1F9A64524D294D4D,0x7639E0E492729292,0xFAEABC8F75C97575,0x360C1E3006180606,0xAE0998248A128A8A,0x4B7940F9B2F2B2B2,0x85D15963E6BFE6E6, + 0x7E1C36700E380E0E,0xE73E63F81F7C1F1F,0x55C4F73762956262,0x3AB5A3EED477D4D4,0x814D3229A89AA8A8,0x5231F4C496629696,0x62EF3A9BF9C3F9F9,0xA397F666C533C5C5,0x104AB13525942525, + 0xABB220F259795959,0xD015AE54842A8484,0xC5E4A7B772D57272,0xEC72DDD539E43939,0x1698615A4C2D4C4C,0x94BC3BCA5E655E5E,0x9FF085E778FD7878,0xE570D8DD38E03838,0x980586148C0A8C8C, + 0x17BFB2C6D163D1D1,0xE4570B41A5AEA5A5,0xA1D94D43E2AFE2E2,0x4EC2F82F61996161,0x427B45F1B3F6B3B3,0x3442A51521842121,0x0825D6949C4A9C9C,0xEE3C66F01E781E1E,0x6186522243114343, + 0xB193FC76C73BC7C7,0x4FE52BB3FCD7FCFC,0x2408142004100404,0xE3A208B251595151,0x252FC7BC995E9999,0x22DAC44F6DA96D6D,0x651A39680D340D0D,0x79E93583FACFFAFA,0x69A384B6DF5BDFDF, + 0xA9FC9BD77EE57E7E,0x1948B43D24902424,0xFE76D7C53BEC3B3B,0x9A4B3D31AB96ABAB,0xF081D13ECE1FCECE,0x9922558811441111,0x8303890C8F068F8F,0x049C6B4A4E254E4E,0x667351D1B7E6B7B7, + 0xE0CB600BEB8BEBEB,0xC178CCFD3CF03C3C,0xFD1FBF7C813E8181,0x4035FED4946A9494,0x1CF30CEBF7FBF7F7,0x186F67A1B9DEB9B9,0x8B265F98134C1313,0x51589C7D2CB02C2C,0x05BBB8D6D36BD3D3, + 0x8CD35C6BE7BBE7E7,0x39DCCB576EA56E6E,0xAA95F36EC437C4C4,0x1B060F18030C0303,0xDCAC138A56455656,0x5E88491A440D4444,0xA0FE9EDF7FE17F7F,0x884F3721A99EA9A9,0x6754824D2AA82A2A, + 0x0A6B6DB1BBD6BBBB,0x879FE246C123C1C1,0xF1A602A253515353,0x72A58BAEDC57DCDC,0x531627580B2C0B0B,0x0127D39C9D4E9D9D,0x2BD8C1476CAD6C6C,0xA462F59531C43131,0xF3E8B98774CD7474, + 0x15F109E3F6FFF6F6,0x4C8C430A46054646,0xA5452609AC8AACAC,0xB50F973C891E8989,0xB42844A014501414,0xBADF425BE1A3E1E1,0xA62C4EB016581616,0xF774D2CD3AE83A3A,0x06D2D06F69B96969, + 0x41122D4809240909,0xD7E0ADA770DD7070,0x6F7154D9B6E2B6B6,0x1EBDB7CED067D0D0,0xD6C77E3BED93EDED,0xE285DB2ECC17CCCC,0x6884572A42154242,0x2C2DC2B4985A9898,0xED550E49A4AAA4A4, + 0x7550885D28A02828,0x86B831DA5C6D5C5C,0x6BED3F93F8C7F8F8,0xC211A44486228686 +}; + +/** + * Round constants. + */ +__constant__ uint64_t InitVector_RC[10]; + +const uint64_t plain_RC[10] = { + 0x4F01B887E8C62318,0x52916F79F5D2A636,0x357B0CA38E9BBC60,0x57FE4B2EC2D7E01D,0xDA4AF09FE5377715, + 0x856BA0B10A29C958,0x67053ECBF4105DBD,0xD8957DA78B4127E4,0x9E4717DD667CEEFB,0x33835AAD07BF2DCA +}; + +/* ====================================================================== */ + +__device__ __forceinline__ +static uint64_t ROUND_ELT(const uint64_t* sharedMemory, const uint64_t* in, const int i0, const int i1, const int i2, const int i3, const int i4, const int i5, const int i6, const int i7) +{ + uint32_t* in32 = (uint32_t*)in; + return xor8( sharedMemory[in32[(i0 << 1)]&0xFF], + sharedMemory[__byte_perm(in32[(i1 << 1)], 0, 0x4441) + 256], + sharedMemory[__byte_perm(in32[(i2 << 1)], 0, 0x4442) + 512], + sharedMemory[__byte_perm(in32[(i3 << 1)], 0, 0x4443) + 768], + sharedMemory[(in32[(i4 << 1) + 1]&0xFF) + 1024], + sharedMemory[__byte_perm(in32[(i5 << 1) + 1], 0, 0x4441) + 1280], + sharedMemory[__byte_perm(in32[(i6 << 1) + 1], 0, 0x4442) + 1536], + sharedMemory[__byte_perm(in32[(i7 << 1) + 1], 0, 0x4443) + 1792]); +} + +#define TRANSFER(dst, src) { \ + dst[0] = src ## 0; \ + dst[1] = src ## 1; \ + dst[2] = src ## 2; \ + dst[3] = src ## 3; \ + dst[4] = src ## 4; \ + dst[5] = src ## 5; \ + dst[6] = src ## 6; \ + dst[7] = src ## 7; \ +} + +#define ROUND(table, in, out, c0, c1, c2, c3, c4, c5, c6, c7) { \ + out ## 0 = xor1(ROUND_ELT(table, in, 0, 7, 6, 5, 4, 3, 2, 1), c0); \ + out ## 1 = xor1(ROUND_ELT(table, in, 1, 0, 7, 6, 5, 4, 3, 2), c1); \ + out ## 2 = xor1(ROUND_ELT(table, in, 2, 1, 0, 7, 6, 5, 4, 3), c2); \ + out ## 3 = xor1(ROUND_ELT(table, in, 3, 2, 1, 0, 7, 6, 5, 4), c3); \ + out ## 4 = xor1(ROUND_ELT(table, in, 4, 3, 2, 1, 0, 7, 6, 5), c4); \ + out ## 5 = xor1(ROUND_ELT(table, in, 5, 4, 3, 2, 1, 0, 7, 6), c5); \ + out ## 6 = xor1(ROUND_ELT(table, in, 6, 5, 4, 3, 2, 1, 0, 7), c6); \ + out ## 7 = xor1(ROUND_ELT(table, in, 7, 6, 5, 4, 3, 2, 1, 0), c7); \ +} + +#define ROUND1(table, in, out, c) { \ + out ## 0 = xor1(ROUND_ELT(table, in, 0, 7, 6, 5, 4, 3, 2, 1), c); \ + out ## 1 = ROUND_ELT(table, in, 1, 0, 7, 6, 5, 4, 3, 2); \ + out ## 2 = ROUND_ELT(table, in, 2, 1, 0, 7, 6, 5, 4, 3); \ + out ## 3 = ROUND_ELT(table, in, 3, 2, 1, 0, 7, 6, 5, 4); \ + out ## 4 = ROUND_ELT(table, in, 4, 3, 2, 1, 0, 7, 6, 5); \ + out ## 5 = ROUND_ELT(table, in, 5, 4, 3, 2, 1, 0, 7, 6); \ + out ## 6 = ROUND_ELT(table, in, 6, 5, 4, 3, 2, 1, 0, 7); \ + out ## 7 = ROUND_ELT(table, in, 7, 6, 5, 4, 3, 2, 1, 0); \ +} + +#define ROUND_KSCHED(table, in, out, c) \ + ROUND1(table, in, out, c) \ + TRANSFER(in, out) + +#define ROUND_WENC(table, in, key, out) \ + ROUND(table, in, out, key[0], key[1], key[2],key[3], key[4], key[5], key[6], key[7]) \ + TRANSFER(in, out) + +uint64_t* d_tmp[MAX_GPUS] = { 0 }; + +__device__ __forceinline__ +static void getShared(uint64_t* sharedMemory){ + if (threadIdx.x < 256) { + sharedMemory[threadIdx.x] = mixTob0Tox[threadIdx.x]; + sharedMemory[threadIdx.x+256] = ROTL64(sharedMemory[threadIdx.x], 8); + sharedMemory[threadIdx.x+512] = ROTL64(sharedMemory[threadIdx.x],16); + sharedMemory[threadIdx.x+768] = ROTL64(sharedMemory[threadIdx.x],24); + sharedMemory[threadIdx.x+1024] = ROTL64(sharedMemory[threadIdx.x],32); + sharedMemory[threadIdx.x+1280] = ROTR64(sharedMemory[threadIdx.x],24); + sharedMemory[threadIdx.x+1536] = ROTR64(sharedMemory[threadIdx.x],16); + sharedMemory[threadIdx.x+1792] = ROTR64(sharedMemory[threadIdx.x], 8); + } + __syncthreads(); +} + + +__global__ +#if __CUDA_ARCH__ > 200 + __launch_bounds__(256,8) +#endif +void precomputeX(int threads,uint64_t* d_tmp){ + + __shared__ uint64_t sharedMemory[2048]; + + getShared(sharedMemory); + int thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads) + { + uint64_t n[8]; + uint64_t h[8] = {0,0,0,0,0,0,0,0}; + + #pragma unroll 8 + for (int i=0; i<8; i++) { + n[i] = c_PaddedMessage80[i]; // read data + } + //#pragma unroll 10 + for (unsigned int r=0; r < 10; r++) { + uint64_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + ROUND_KSCHED(sharedMemory, h, tmp, InitVector_RC[r]); + ROUND_WENC(sharedMemory, n, h, tmp); + } + #pragma unroll 8 + for (int i=0; i < 8; i++) { + h[i] = xor1(n[i],c_PaddedMessage80[i]); + } + + uint64_t atLastCalc=xor1(h[3],h[5]); + + ////////////////////////////////// + n[0] = c_PaddedMessage80[8]; //read data + n[1] = c_PaddedMessage80[9]; //whirlpool + n[2] = 0x0000000000000080; //whirlpool + n[3] = 0; + n[4] = 0; + n[5] = 0; + n[6] = 0; + n[7] = 0x8002000000000000; + + n[0] = xor1(n[0],h[0]); + n[2] = xor1(n[2],h[2]); n[3] = h[3]; + n[4] = h[4]; n[5] = h[5]; + n[6] = h[6]; n[7] = xor1(n[7],h[7]); + uint64_t tmp[16]; + tmp[0] = xor1(ROUND_ELT(sharedMemory, h, 0, 7, 6, 5, 4, 3, 2, 1),InitVector_RC[0]); + tmp[1] = ROUND_ELT(sharedMemory, h, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[2] = ROUND_ELT(sharedMemory, h, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[3] = ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[4] = ROUND_ELT(sharedMemory, h, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[5] = ROUND_ELT(sharedMemory, h, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[6] = ROUND_ELT(sharedMemory, h, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[7] = ROUND_ELT(sharedMemory, h, 7, 6, 5, 4, 3, 2, 1, 0); + + uint32_t* n32 = (uint32_t*)n; + tmp[8]=xor8( sharedMemory[__byte_perm(n32[ 0], 0, 0x4440)] ,sharedMemory[__byte_perm(n32[14], 0, 0x4441) + 256], + sharedMemory[__byte_perm(n32[12], 0, 0x4442) + 512] ,sharedMemory[__byte_perm(n32[10], 0, 0x4443) + 768], + sharedMemory[__byte_perm(n32[ 9], 0, 0x4440) + 1024] ,sharedMemory[__byte_perm(n32[ 7], 0, 0x4441) + 1280], + sharedMemory[__byte_perm(n32[ 5], 0, 0x4442) + 1536] ,tmp[0]); + + tmp[9]=xor8( tmp[1] ,sharedMemory[__byte_perm(n32[ 0], 0, 0x4441) + 256], + sharedMemory[__byte_perm(n32[14], 0, 0x4442) + 512] ,sharedMemory[__byte_perm(n32[12], 0, 0x4443) + 768], + sharedMemory[__byte_perm(n32[11], 0, 0x4440) + 1024] ,sharedMemory[__byte_perm(n32[ 9], 0, 0x4441) + 1280], + sharedMemory[__byte_perm(n32[ 7], 0, 0x4442) + 1536] ,sharedMemory[__byte_perm(n32[ 5], 0, 0x4443) + 1792]); + + tmp[10]=xor8( sharedMemory[__byte_perm(n32[ 4], 0, 0x4440)] ,tmp[2] , + sharedMemory[__byte_perm(n32[ 0], 0, 0x4442) + 512] ,sharedMemory[__byte_perm(n32[14], 0, 0x4443) + 768], + sharedMemory[__byte_perm(n32[13], 0, 0x4440) + 1024] ,sharedMemory[__byte_perm(n32[11], 0, 0x4441) + 1280], + sharedMemory[__byte_perm(n32[ 9], 0, 0x4442) + 1536] ,sharedMemory[__byte_perm(n32[ 7], 0, 0x4443) + 1792]); + + tmp[11]=xor8( sharedMemory[__byte_perm(n32[ 6], 0, 0x4440)] ,sharedMemory[__byte_perm(n32[ 4], 0, 0x4441) + 256], + tmp[3] ,sharedMemory[__byte_perm(n32[ 0], 0, 0x4443) + 768], + sharedMemory[__byte_perm(n32[15], 0, 0x4440) + 1024] ,sharedMemory[__byte_perm(n32[13], 0, 0x4441) + 1280], + sharedMemory[__byte_perm(n32[11], 0, 0x4442) + 1536] ,sharedMemory[__byte_perm(n32[ 9], 0, 0x4443) + 1792]); + + tmp[12]=xor8( sharedMemory[__byte_perm(n32[ 8], 0, 0x4440)] ,sharedMemory[__byte_perm(n32[ 6], 0, 0x4441) + 256] , + sharedMemory[__byte_perm(n32[ 4], 0, 0x4442) + 512] ,tmp[4] , + sharedMemory[__byte_perm(n32[ 1], 0, 0x4440) + 1024] ,sharedMemory[__byte_perm(n32[15], 0, 0x4441) + 1280] , + sharedMemory[__byte_perm(n32[13], 0, 0x4442) + 1536] ,sharedMemory[__byte_perm(n32[11], 0, 0x4443) + 1792]); + + tmp[13]=xor8( sharedMemory[__byte_perm(n32[10], 0, 0x4440)] ,sharedMemory[__byte_perm(n32[ 8], 0, 0x4441) + 256], + sharedMemory[__byte_perm(n32[ 6], 0, 0x4442) + 512] ,sharedMemory[__byte_perm(n32[ 4], 0, 0x4443) + 768], + tmp[5] ,sharedMemory[__byte_perm(n32[ 1], 0, 0x4441) + 1280], + sharedMemory[__byte_perm(n32[15], 0, 0x4442) + 1536] ,sharedMemory[__byte_perm(n32[13], 0, 0x4443) + 1792]); + + tmp[14]=xor8( sharedMemory[__byte_perm(n32[12], 0, 0x4440)] ,sharedMemory[__byte_perm(n32[10], 0, 0x4441) + 256], + sharedMemory[__byte_perm(n32[ 8], 0, 0x4442) + 512] ,sharedMemory[__byte_perm(n32[ 6], 0, 0x4443) + 768], + sharedMemory[__byte_perm(n32[ 5], 0, 0x4440) + 1024] ,tmp[6], + sharedMemory[__byte_perm(n32[ 1], 0, 0x4442) + 1536] ,sharedMemory[__byte_perm(n32[15], 0, 0x4443) + 1792]); + + tmp[15]=xor8( sharedMemory[__byte_perm(n32[14], 0, 0x4440)] ,sharedMemory[__byte_perm(n32[12], 0, 0x4441) + 256], + sharedMemory[__byte_perm(n32[10], 0, 0x4442) + 512] ,sharedMemory[__byte_perm(n32[ 8], 0, 0x4443) + 768], + sharedMemory[__byte_perm(n32[ 7], 0, 0x4440) + 1024] ,sharedMemory[__byte_perm(n32[ 5], 0, 0x4441) + 1280], + tmp[7] ,sharedMemory[__byte_perm(n32[ 1], 0, 0x4443) + 1792]); + + n[1] =xor1(n[1],h[1]); + tmp[9]=xor1(tmp[9],sharedMemory[__byte_perm(n32[2], 0, 0x4440)]); + tmp[10]=xor1(tmp[10],sharedMemory[__byte_perm(n32[2], 0, 0x4441) + 256]); + tmp[11]=xor1(tmp[11],sharedMemory[__byte_perm(n32[2], 0, 0x4442) + 512]); + tmp[12]=xor1(tmp[12],sharedMemory[__byte_perm(n32[2], 0, 0x4443) + 768]); + + d_tmp[threadIdx.x]=tmp[8+threadIdx.x]; + + uint64_t tmp3[8]; + tmp3[0] = xor1(ROUND_ELT(sharedMemory, tmp, 0, 7, 6, 5, 4, 3, 2, 1), InitVector_RC[1]); + tmp3[1] = ROUND_ELT(sharedMemory, tmp, 1, 0, 7, 6, 5, 4, 3, 2); + tmp3[2] = ROUND_ELT(sharedMemory, tmp, 2, 1, 0, 7, 6, 5, 4, 3); + tmp3[3] = ROUND_ELT(sharedMemory, tmp, 3, 2, 1, 0, 7, 6, 5, 4); + tmp3[4] = ROUND_ELT(sharedMemory, tmp, 4, 3, 2, 1, 0, 7, 6, 5); + tmp3[5] = ROUND_ELT(sharedMemory, tmp, 5, 4, 3, 2, 1, 0, 7, 6); + tmp3[6] = ROUND_ELT(sharedMemory, tmp, 6, 5, 4, 3, 2, 1, 0, 7); + tmp3[7] = ROUND_ELT(sharedMemory, tmp, 7, 6, 5, 4, 3, 2, 1, 0); + + n32 = (uint32_t*)&tmp[8]; + tmp[0]=xor1( xor3(sharedMemory[__byte_perm(n32[ 9], 0, 0x4440) + 1024],sharedMemory[__byte_perm(n32[ 7], 0, 0x4441) + 1280],sharedMemory[__byte_perm(n32[ 5], 0, 0x4442) + 1536]), + xor1(sharedMemory[__byte_perm(n32[ 3], 0, 0x4443) + 1792],tmp3[0])); + + tmp[1]=xor1( xor3(sharedMemory[__byte_perm(n32[ 2], 0, 0x4440)],sharedMemory[__byte_perm(n32[ 9], 0, 0x4441) + 1280],sharedMemory[__byte_perm(n32[ 7], 0, 0x4442) + 1536]), + xor1(sharedMemory[__byte_perm(n32[ 5], 0, 0x4443) + 1792],tmp3[1])); + + tmp[2]=xor1( xor3(sharedMemory[__byte_perm(n32[ 4], 0, 0x4440)],sharedMemory[__byte_perm(n32[ 2], 0, 0x4441) + 256],sharedMemory[__byte_perm(n32[ 9], 0, 0x4442) + 1536]), + xor1(sharedMemory[__byte_perm(n32[ 7], 0, 0x4443) + 1792],tmp3[2])); + + tmp[3]=xor1( xor3(sharedMemory[__byte_perm(n32[ 6], 0, 0x4440)],sharedMemory[__byte_perm(n32[ 4], 0, 0x4441) + 256],sharedMemory[__byte_perm(n32[ 2], 0, 0x4442) + 512]), + xor1(sharedMemory[__byte_perm(n32[ 9], 0, 0x4443) + 1792],tmp3[3])); + + tmp[4]=xor1( xor3(sharedMemory[__byte_perm(n32[ 8], 0, 0x4440)],sharedMemory[__byte_perm(n32[ 6], 0, 0x4441) + 256],sharedMemory[__byte_perm(n32[ 4], 0, 0x4442) + 512]), + xor1(sharedMemory[__byte_perm(n32[ 2], 0, 0x4443) + 768],tmp3[4])); + + tmp[5]=xor1( xor3(sharedMemory[__byte_perm(n32[ 8], 0, 0x4441) + 256],sharedMemory[__byte_perm(n32[ 6], 0, 0x4442) + 512],sharedMemory[__byte_perm(n32[ 4], 0, 0x4443) + 768]), + xor1(sharedMemory[__byte_perm(n32[ 3], 0, 0x4440) + 1024],tmp3[5])); + + tmp[6]=xor1( xor3(sharedMemory[__byte_perm(n32[ 8], 0, 0x4442) + 512],sharedMemory[__byte_perm(n32[ 6], 0, 0x4443) + 768],sharedMemory[__byte_perm(n32[ 5], 0, 0x4440) + 1024]), + xor1(sharedMemory[__byte_perm(n32[ 3], 0, 0x4441) + 1280],tmp3[6])); + + tmp[7]=xor1( xor3(sharedMemory[__byte_perm(n32[ 8], 0, 0x4443) + 768],sharedMemory[__byte_perm(n32[ 7], 0, 0x4440) + 1024],sharedMemory[__byte_perm(n32[ 5], 0, 0x4441) + 1280]), + xor1(sharedMemory[__byte_perm(n32[ 3], 0, 0x4442) + 1536],tmp3[7])); + + d_tmp[threadIdx.x+8]=tmp[threadIdx.x]; + + tmp[0] = xor1(ROUND_ELT(sharedMemory, tmp3, 0, 7, 6, 5, 4, 3, 2, 1), InitVector_RC[2]); + tmp[1] = ROUND_ELT(sharedMemory, tmp3, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[2] = ROUND_ELT(sharedMemory, tmp3, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[3] = ROUND_ELT(sharedMemory, tmp3, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[4] = ROUND_ELT(sharedMemory, tmp3, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[5] = ROUND_ELT(sharedMemory, tmp3, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[6] = ROUND_ELT(sharedMemory, tmp3, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[7] = ROUND_ELT(sharedMemory, tmp3, 7, 6, 5, 4, 3, 2, 1, 0); + + d_tmp[threadIdx.x+16]=tmp[threadIdx.x]; + + #pragma unroll 6 + for(int i=0;i<6;i++){ + tmp[0+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &tmp[8*(i&1)], 0, 7, 6, 5, 4, 3, 2, 1), InitVector_RC[3+i]); + tmp[1+8*((i+1)&1)] = ROUND_ELT(sharedMemory, &tmp[8*(i&1)], 1, 0, 7, 6, 5, 4, 3, 2); + tmp[2+8*((i+1)&1)] = ROUND_ELT(sharedMemory, &tmp[8*(i&1)], 2, 1, 0, 7, 6, 5, 4, 3); + tmp[3+8*((i+1)&1)] = ROUND_ELT(sharedMemory, &tmp[8*(i&1)], 3, 2, 1, 0, 7, 6, 5, 4); + tmp[4+8*((i+1)&1)] = ROUND_ELT(sharedMemory, &tmp[8*(i&1)], 4, 3, 2, 1, 0, 7, 6, 5); + tmp[5+8*((i+1)&1)] = ROUND_ELT(sharedMemory, &tmp[8*(i&1)], 5, 4, 3, 2, 1, 0, 7, 6); + tmp[6+8*((i+1)&1)] = ROUND_ELT(sharedMemory, &tmp[8*(i&1)], 6, 5, 4, 3, 2, 1, 0, 7); + tmp[7+8*((i+1)&1)] = ROUND_ELT(sharedMemory, &tmp[8*(i&1)], 7, 6, 5, 4, 3, 2, 1, 0); + + d_tmp[threadIdx.x+24+8*i]=tmp[threadIdx.x+8*((i+1)&1)]; + } + + if(threadIdx.x==0){ + d_tmp[1]=h[1]; + tmp[8]=ROUND_ELT(sharedMemory,&tmp[0], 3, 2, 1, 0, 7, 6, 5, 4); + tmp[9]=ROUND_ELT(sharedMemory,&tmp[0], 5, 4, 3, 2, 1, 0, 7, 6); + tmp[10] = xor3(tmp[8],tmp[9],atLastCalc); + d_tmp[2]=tmp[10]; + } + } +} + +__global__ +#if __CUDA_ARCH__ > 210 + __launch_bounds__(threadsPerBlock,2) +#endif +void whirlpoolx(const uint32_t threads, const uint32_t startNounce,uint32_t *resNounce){ + + __shared__ uint64_t sharedMemory[2048]; + + getShared(sharedMemory); + + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + + uint64_t n[16]; + uint32_t *n32 = (uint32_t*)n; + const uint32_t nounce = startNounce + thread; + + + n[1] = xor1(REPLACE_HIDWORD(c_PaddedMessage80[9], cuda_swab32(nounce)),c_tmp[1]); + + const uint64_t b=xor1(sharedMemory[__byte_perm(n32[3], 0, 0x4443) + 1792],c_tmp[0]); + + n[5]=xor1(sharedMemory[__byte_perm(n32[3], 0, 0x4440) + 1024],c_tmp[5]); + n[6]=xor1(sharedMemory[__byte_perm(n32[3], 0, 0x4441) + 1280],c_tmp[6]); + n[7]=xor1(sharedMemory[__byte_perm(n32[3], 0, 0x4442) + 1536],c_tmp[7]); + + n[8]=xor3(sharedMemory[__byte_perm(n32[10],0,0x4443)+768],sharedMemory[__byte_perm(n32[12],0,0x4442)+512],sharedMemory[__byte_perm(n32[14],0,0x4441)+256]); + n[9]=xor3(sharedMemory[__byte_perm(n32[11],0,0x4440)+1024],sharedMemory[__byte_perm(n32[12],0,0x4443)+768],sharedMemory[__byte_perm(n32[14],0,0x4442)+512]); + n[10]=xor3(sharedMemory[__byte_perm(n32[11],0,0x4441)+1280],sharedMemory[__byte_perm(n32[13],0,0x4440)+1024],sharedMemory[__byte_perm(n32[14],0,0x4443)+768]); + n[11]=xor3(sharedMemory[__byte_perm(n32[11],0,0x4442)+1536],sharedMemory[__byte_perm(n32[13],0,0x4441)+1280],sharedMemory[__byte_perm(n32[15],0,0x4440)+1024]); + n[12]=xor3(sharedMemory[__byte_perm(n32[11],0,0x4443)+1792],sharedMemory[__byte_perm(n32[13],0,0x4442)+1536],sharedMemory[__byte_perm(n32[15],0,0x4441)+1280]); + n[13]=xor3(sharedMemory[__byte_perm(n32[10],0,0x4440)],sharedMemory[__byte_perm(n32[13],0,0x4443)+1792],sharedMemory[__byte_perm(n32[15],0,0x4442)+1536]); + n[14]=xor3(sharedMemory[__byte_perm(n32[12],0,0x4440)],sharedMemory[__byte_perm(n32[10],0,0x4441)+256],sharedMemory[__byte_perm(n32[15],0,0x4443)+1792]); + n[15]=xor3(sharedMemory[__byte_perm(n32[14],0,0x4440)],sharedMemory[__byte_perm(n32[12],0,0x4441)+256],sharedMemory[__byte_perm(n32[10],0,0x4442)+ 512]); + + n32 = (uint32_t* __restrict__)&b; + n[0]=xor3(sharedMemory[__byte_perm(n32[ 0], 0, 0x4440) ], n[ 8],c_tmp[0+8]); + n[1]=xor3(sharedMemory[__byte_perm(n32[ 0], 0, 0x4441) + 256], n[ 9],c_tmp[1+8]); + n[2]=xor3(sharedMemory[__byte_perm(n32[ 0], 0, 0x4442) + 512], n[10],c_tmp[2+8]); + n[3]=xor3(sharedMemory[__byte_perm(n32[ 0], 0, 0x4443) + 768], n[11],c_tmp[3+8]); + n[4]=xor3(sharedMemory[__byte_perm(n32[ 1], 0, 0x4440) +1024], n[12],c_tmp[4+8]); + n[5]=xor3(sharedMemory[__byte_perm(n32[ 1], 0, 0x4441) +1280], n[13],c_tmp[5+8]); + n[6]=xor3(sharedMemory[__byte_perm(n32[ 1], 0, 0x4442) +1536], n[14],c_tmp[6+8]); + n[7]=xor3(sharedMemory[__byte_perm(n32[ 1], 0, 0x4443) +1792], n[15],c_tmp[7+8]); + + #pragma unroll 7 + for(int i=2;i<9;i++){ + n[0+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &n[8*(i&1)], 0, 7, 6, 5, 4, 3, 2, 1), c_tmp[0+(8*i)]); + n[1+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &n[8*(i&1)], 1, 0, 7, 6, 5, 4, 3, 2), c_tmp[1+(8*i)]); + n[2+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &n[8*(i&1)], 2, 1, 0, 7, 6, 5, 4, 3), c_tmp[2+(8*i)]); + n[3+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &n[8*(i&1)], 3, 2, 1, 0, 7, 6, 5, 4), c_tmp[3+(8*i)]); + n[4+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &n[8*(i&1)], 4, 3, 2, 1, 0, 7, 6, 5), c_tmp[4+(8*i)]); + n[5+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &n[8*(i&1)], 5, 4, 3, 2, 1, 0, 7, 6), c_tmp[5+(8*i)]); + n[6+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &n[8*(i&1)], 6, 5, 4, 3, 2, 1, 0, 7), c_tmp[6+(8*i)]); + n[7+8*((i+1)&1)] = xor1(ROUND_ELT(sharedMemory, &n[8*(i&1)], 7, 6, 5, 4, 3, 2, 1, 0), c_tmp[7+(8*i)]); + } + + if (xor3(c_tmp[2],ROUND_ELT(sharedMemory, &n[8],3,2,1,0,7,6,5,4),ROUND_ELT(sharedMemory, &n[8],5,4,3,2,1,0,7,6)) <= pTarget[3]) + atomicMin(&resNounce[0],nounce); + } // thread < threads +} + +__host__ +void whirlpoolx_cpu_init(int thr_id, int threads){ + cudaSetDevice(device_map[thr_id]); + cudaSetDeviceFlags(cudaDeviceMapHost); + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetSharedMemConfig(cudaSharedMemBankSizeEightByte); + + cudaMemcpyToSymbol(InitVector_RC, plain_RC, sizeof(plain_RC), 0, cudaMemcpyHostToDevice); + cudaMemcpyToSymbol(mixTob0Tox, plain_T0, sizeof(plain_T0), 0, cudaMemcpyHostToDevice); + cudaHostAlloc((void**)&d_wxnonce[thr_id],sizeof(uint32_t),cudaHostAllocMapped); + cudaHostGetDevicePointer((void**)&d_WXNonce[thr_id],(void*)d_wxnonce[thr_id],0); + + cudaMalloc(&d_tmp[thr_id],8*9*sizeof(uint64_t)); +} + +__host__ +void whirlpoolx_setBlock_precompute(void *pdata, const void *ptarget,int thr_id){ + uint64_t PaddedMessage[16]; + dim3 grid(1); + dim3 block(256); + + memcpy(PaddedMessage, pdata, 80); + memset((uint8_t*)&PaddedMessage+80, 0, 48); + *(uint8_t*)(&PaddedMessage+80) = 0x80; /* ending */ + + cudaMemcpyToSymbol(c_PaddedMessage80, PaddedMessage, 16*sizeof(uint64_t), 0, cudaMemcpyHostToDevice); + cudaMemcpyToSymbol(pTarget, ptarget, 4*sizeof(uint64_t), 0, cudaMemcpyHostToDevice); + + precomputeX<<>>(8,d_tmp[thr_id]); + cudaThreadSynchronize(); + + cudaMemcpyToSymbol(c_tmp,d_tmp[thr_id],8*9*sizeof(uint64_t),0,cudaMemcpyDeviceToDevice); +} + +__host__ +uint32_t cpu_whirlpoolx(int thr_id, uint32_t threads, uint32_t startNounce){ + dim3 grid((threads + threadsPerBlock-1) / threadsPerBlock); + dim3 block(threadsPerBlock); + d_wxnonce[thr_id][0]=UINT32_MAX; + whirlpoolx<<>>(threads, startNounce,d_WXNonce[thr_id]); + cudaThreadSynchronize(); + return *d_wxnonce[thr_id]; +} + +__host__ +extern void whirlpoolx_cpu_free(int thr_id) +{ + cudaFree(d_WXNonce[thr_id]); + cudaFree(d_tmp[thr_id]); +} diff --git a/x15/cuda_x15_whirlpool.cu b/x15/cuda_x15_whirlpool.cu new file mode 100644 index 0000000..458e4e6 --- /dev/null +++ b/x15/cuda_x15_whirlpool.cu @@ -0,0 +1,850 @@ +/** + * Whirlpool-512 CUDA implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2014-2016 djm34, tpruvot, SP, Provos Alexis + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + * @author djm34 (initial draft) + * @author tpruvot (dual old/whirlpool modes, midstate) + * @author SP ("final" function opt and tuning) + * @author Provos Alexis (Applied partial shared memory utilization, precomputations, merging & tuning for 970/750ti under CUDA7.5 -> +93% increased throughput of whirlpool) + */ + + +// Change with caution, used by shared mem fetch +#define TPB80 384 +#define TPB64 384 + +extern "C" +{ +#include "sph/sph_whirlpool.h" +#include "miner.h" +} + +#include "cuda_helper.h" +#include "cuda_vectors.h" +#include "cuda_whirlpool_tables.cuh" + +__device__ static uint64_t b0[256]; +__device__ static uint64_t b7[256]; + +__constant__ static uint2 precomputed_round_key_64[72]; +__constant__ static uint2 precomputed_round_key_80[80]; + +__device__ static uint2 c_PaddedMessage80[16]; + + +/** + * Round constants. + */ +__device__ uint2 InitVector_RC[10]; + +//--------START OF WHIRLPOOL DEVICE MACROS--------------------------------------------------------------------------- +__device__ __forceinline__ +void static TRANSFER(uint2 *const __restrict__ dst,const uint2 *const __restrict__ src){ + dst[0] = src[ 0]; + dst[1] = src[ 1]; + dst[2] = src[ 2]; + dst[3] = src[ 3]; + dst[4] = src[ 4]; + dst[5] = src[ 5]; + dst[6] = src[ 6]; + dst[7] = src[ 7]; +} + +__device__ __forceinline__ +static uint2 d_ROUND_ELT_LDG(const uint2 sharedMemory[7][256],const uint2 *const __restrict__ in,const int i0, const int i1, const int i2, const int i3, const int i4, const int i5, const int i6, const int i7){ + uint2 ret = __ldg((uint2*)&b0[__byte_perm(in[i0].x, 0, 0x4440)]); + ret ^= sharedMemory[1][__byte_perm(in[i1].x, 0, 0x4441)]; + ret ^= sharedMemory[2][__byte_perm(in[i2].x, 0, 0x4442)]; + ret ^= sharedMemory[3][__byte_perm(in[i3].x, 0, 0x4443)]; + ret ^= sharedMemory[4][__byte_perm(in[i4].y, 0, 0x4440)]; + ret ^= ROR24(__ldg((uint2*)&b0[__byte_perm(in[i5].y, 0, 0x4441)])); + ret ^= ROR8(__ldg((uint2*)&b7[__byte_perm(in[i6].y, 0, 0x4442)])); + ret ^= __ldg((uint2*)&b7[__byte_perm(in[i7].y, 0, 0x4443)]); + return ret; +} + +__device__ __forceinline__ +static uint2 d_ROUND_ELT(const uint2 sharedMemory[7][256],const uint2 *const __restrict__ in,const int i0, const int i1, const int i2, const int i3, const int i4, const int i5, const int i6, const int i7){ + + uint2 ret = __ldg((uint2*)&b0[__byte_perm(in[i0].x, 0, 0x4440)]); + ret ^= sharedMemory[1][__byte_perm(in[i1].x, 0, 0x4441)]; + ret ^= sharedMemory[2][__byte_perm(in[i2].x, 0, 0x4442)]; + ret ^= sharedMemory[3][__byte_perm(in[i3].x, 0, 0x4443)]; + ret ^= sharedMemory[4][__byte_perm(in[i4].y, 0, 0x4440)]; + ret ^= sharedMemory[5][__byte_perm(in[i5].y, 0, 0x4441)]; + ret ^= ROR8(__ldg((uint2*)&b7[__byte_perm(in[i6].y, 0, 0x4442)])); + ret ^= __ldg((uint2*)&b7[__byte_perm(in[i7].y, 0, 0x4443)]); + return ret; +} + +__device__ __forceinline__ +static uint2 d_ROUND_ELT1_LDG(const uint2 sharedMemory[7][256],const uint2 *const __restrict__ in,const int i0, const int i1, const int i2, const int i3, const int i4, const int i5, const int i6, const int i7, const uint2 c0){ + + uint2 ret = __ldg((uint2*)&b0[__byte_perm(in[i0].x, 0, 0x4440)]); + ret ^= sharedMemory[1][__byte_perm(in[i1].x, 0, 0x4441)]; + ret ^= sharedMemory[2][__byte_perm(in[i2].x, 0, 0x4442)]; + ret ^= sharedMemory[3][__byte_perm(in[i3].x, 0, 0x4443)]; + ret ^= sharedMemory[4][__byte_perm(in[i4].y, 0, 0x4440)]; + ret ^= ROR24(__ldg((uint2*)&b0[__byte_perm(in[i5].y, 0, 0x4441)])); + ret ^= ROR8(__ldg((uint2*)&b7[__byte_perm(in[i6].y, 0, 0x4442)])); + ret ^= __ldg((uint2*)&b7[__byte_perm(in[i7].y, 0, 0x4443)]); + ret ^= c0; + return ret; +} + +__device__ __forceinline__ +static uint2 d_ROUND_ELT1(const uint2 sharedMemory[7][256],const uint2 *const __restrict__ in,const int i0, const int i1, const int i2, const int i3, const int i4, const int i5, const int i6, const int i7, const uint2 c0){ + uint2 ret = __ldg((uint2*)&b0[__byte_perm(in[i0].x, 0, 0x4440)]); + ret ^= sharedMemory[1][__byte_perm(in[i1].x, 0, 0x4441)]; + ret ^= sharedMemory[2][__byte_perm(in[i2].x, 0, 0x4442)]; + ret ^= sharedMemory[3][__byte_perm(in[i3].x, 0, 0x4443)]; + ret ^= sharedMemory[4][__byte_perm(in[i4].y, 0, 0x4440)]; + ret ^= sharedMemory[5][__byte_perm(in[i5].y, 0, 0x4441)]; + ret ^= ROR8(__ldg((uint2*)&b7[__byte_perm(in[i6].y, 0, 0x4442)]));//sharedMemory[6][__byte_perm(in[i6].y, 0, 0x4442)] + ret ^= __ldg((uint2*)&b7[__byte_perm(in[i7].y, 0, 0x4443)]);//sharedMemory[7][__byte_perm(in[i7].y, 0, 0x4443)] + ret ^= c0; + return ret; +} + +//--------END OF WHIRLPOOL DEVICE MACROS----------------------------------------------------------------------------- + +//--------START OF WHIRLPOOL HOST MACROS----------------------------------------------------------------------------- + +#define table_skew(val,num) SPH_ROTL64(val,8*num) +#define BYTE(x, n) ((unsigned)((x) >> (8 * (n))) & 0xFF) + +#define ROUND_ELT(table, in, i0, i1, i2, i3, i4, i5, i6, i7) \ + (table[BYTE(in[i0], 0)] \ + ^ table_skew(table[BYTE(in[i1], 1)], 1) \ + ^ table_skew(table[BYTE(in[i2], 2)], 2) \ + ^ table_skew(table[BYTE(in[i3], 3)], 3) \ + ^ table_skew(table[BYTE(in[i4], 4)], 4) \ + ^ table_skew(table[BYTE(in[i5], 5)], 5) \ + ^ table_skew(table[BYTE(in[i6], 6)], 6) \ + ^ table_skew(table[BYTE(in[i7], 7)], 7)) + +#define ROUND(table, in, out, c0, c1, c2, c3, c4, c5, c6, c7) do { \ + out[0] = ROUND_ELT(table, in, 0, 7, 6, 5, 4, 3, 2, 1) ^ c0; \ + out[1] = ROUND_ELT(table, in, 1, 0, 7, 6, 5, 4, 3, 2) ^ c1; \ + out[2] = ROUND_ELT(table, in, 2, 1, 0, 7, 6, 5, 4, 3) ^ c2; \ + out[3] = ROUND_ELT(table, in, 3, 2, 1, 0, 7, 6, 5, 4) ^ c3; \ + out[4] = ROUND_ELT(table, in, 4, 3, 2, 1, 0, 7, 6, 5) ^ c4; \ + out[5] = ROUND_ELT(table, in, 5, 4, 3, 2, 1, 0, 7, 6) ^ c5; \ + out[6] = ROUND_ELT(table, in, 6, 5, 4, 3, 2, 1, 0, 7) ^ c6; \ + out[7] = ROUND_ELT(table, in, 7, 6, 5, 4, 3, 2, 1, 0) ^ c7; \ + } while (0) + +__host__ +static void ROUND_KSCHED(const uint64_t *in,uint64_t *out,const uint64_t c){ + const uint64_t *a = in; + uint64_t *b = out; + ROUND(old1_T0, a, b, c, 0, 0, 0, 0, 0, 0, 0); +} + + +//--------END OF WHIRLPOOL HOST MACROS------------------------------------------------------------------------------- + +__host__ +extern void x15_whirlpool_cpu_init(int thr_id, uint32_t threads, int mode){ + + uint64_t* table0 = NULL; + + switch (mode) { + case 0: /* x15 with rotated T1-T7 (based on T0) */ + table0 = (uint64_t*)plain_T0; + cudaMemcpyToSymbol(InitVector_RC, plain_RC, 10*sizeof(uint64_t),0, cudaMemcpyHostToDevice); + cudaMemcpyToSymbol(precomputed_round_key_64, plain_precomputed_round_key_64, 72*sizeof(uint64_t),0, cudaMemcpyHostToDevice); + break; + case 1: /* old whirlpool */ + table0 = (uint64_t*)old1_T0; + cudaMemcpyToSymbol(InitVector_RC, old1_RC, 10*sizeof(uint64_t),0,cudaMemcpyHostToDevice); + cudaMemcpyToSymbol(precomputed_round_key_64, old1_precomputed_round_key_64, 72*sizeof(uint64_t),0, cudaMemcpyHostToDevice); + break; + default: + applog(LOG_ERR,"Bad whirlpool mode"); + exit(0); + } + cudaMemcpyToSymbol(b0, table0, 256*sizeof(uint64_t),0, cudaMemcpyHostToDevice); + uint64_t table7[256]; + for(int i=0;i<256;i++){ + table7[i] = ROTR64(table0[i],8); + } + cudaMemcpyToSymbol(b7, table7, 256*sizeof(uint64_t),0, cudaMemcpyHostToDevice); +} + +void whirl_midstate(void *state, const void *input) +{ + sph_whirlpool_context ctx; + + sph_whirlpool1_init(&ctx); + sph_whirlpool1(&ctx, input, 64); + + memcpy(state, ctx.state, 64); +} + +__host__ +void whirlpool512_setBlock_80(void *pdata, const void *ptarget) +{ + uint64_t PaddedMessage[16]; + + memcpy(PaddedMessage, pdata, 80); + memset(((uint8_t*)&PaddedMessage)+80, 0, 48); + ((uint8_t*)&PaddedMessage)[80] = 0x80; /* ending */ + + // compute constant first block + uint64_t midstate[16] = { 0 }; + whirl_midstate(midstate, pdata); + memcpy(PaddedMessage, midstate, 64); + + uint64_t round_constants[80]; + uint64_t n[8]; + + n[0] = PaddedMessage[0] ^ PaddedMessage[8]; //read data + n[1] = PaddedMessage[1] ^ PaddedMessage[9]; + n[2] = PaddedMessage[2] ^ 0x0000000000000080; //whirlpool + n[3] = PaddedMessage[3]; + n[4] = PaddedMessage[4]; + n[5] = PaddedMessage[5]; + n[6] = PaddedMessage[6]; + n[7] = PaddedMessage[7] ^ 0x8002000000000000; + + ROUND_KSCHED(PaddedMessage,round_constants,old1_RC[0]); + + for(int i=1;i<10;i++){ + ROUND_KSCHED(&round_constants[8*(i-1)],&round_constants[8*i],old1_RC[i]); + } + + //USE the same memory place to store keys and state + round_constants[ 0]^= old1_T0[BYTE(n[0], 0)] + ^ table_skew(old1_T0[BYTE(n[7], 1)], 1) ^ table_skew(old1_T0[BYTE(n[6], 2)], 2) ^ table_skew(old1_T0[BYTE(n[5], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[4], 4)], 4) ^ table_skew(old1_T0[BYTE(n[3], 5)], 5) ^ table_skew(old1_T0[BYTE(n[2], 6)], 6); + + round_constants[ 1]^= old1_T0[BYTE(n[1], 0)] + ^ table_skew(old1_T0[BYTE(n[0], 1)], 1) ^ table_skew(old1_T0[BYTE(n[7], 2)], 2) ^ table_skew(old1_T0[BYTE(n[6], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[5], 4)], 4) ^ table_skew(old1_T0[BYTE(n[4], 5)], 5) ^ table_skew(old1_T0[BYTE(n[3], 6)], 6) + ^ table_skew(old1_T0[BYTE(n[2], 7)], 7); + + round_constants[ 2]^= old1_T0[BYTE(n[2], 0)] + ^ table_skew(old1_T0[BYTE(n[1], 1)], 1) ^ table_skew(old1_T0[BYTE(n[0], 2)], 2) ^ table_skew(old1_T0[BYTE(n[7], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[6], 4)], 4) ^ table_skew(old1_T0[BYTE(n[5], 5)], 5) ^ table_skew(old1_T0[BYTE(n[4], 6)], 6) + ^ table_skew(old1_T0[BYTE(n[3], 7)], 7); + + round_constants[ 3]^= old1_T0[BYTE(n[3], 0)] + ^ table_skew(old1_T0[BYTE(n[2], 1)], 1) ^ table_skew(old1_T0[BYTE(n[1], 2)], 2) ^ table_skew(old1_T0[BYTE(n[0], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[7], 4)], 4) ^ table_skew(old1_T0[BYTE(n[6], 5)], 5) ^ table_skew(old1_T0[BYTE(n[5], 6)], 6) + ^ table_skew(old1_T0[BYTE(n[4], 7)], 7); + + round_constants[ 4]^= old1_T0[BYTE(n[4], 0)] + ^ table_skew(old1_T0[BYTE(n[3], 1)], 1) ^ table_skew(old1_T0[BYTE(n[2], 2)], 2) ^ table_skew(old1_T0[BYTE(n[1], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[0], 4)], 4) ^ table_skew(old1_T0[BYTE(n[7], 5)], 5) ^ table_skew(old1_T0[BYTE(n[6], 6)], 6) + ^ table_skew(old1_T0[BYTE(n[5], 7)], 7); + + round_constants[ 5]^= old1_T0[BYTE(n[5], 0)] + ^ table_skew(old1_T0[BYTE(n[4], 1)], 1) ^ table_skew(old1_T0[BYTE(n[3], 2)], 2) ^ table_skew(old1_T0[BYTE(n[2], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[0], 5)], 5) ^ table_skew(old1_T0[BYTE(n[7], 6)], 6) ^ table_skew(old1_T0[BYTE(n[6], 7)], 7); + + round_constants[ 6]^= old1_T0[BYTE(n[6], 0)] + ^ table_skew(old1_T0[BYTE(n[5], 1)], 1) ^ table_skew(old1_T0[BYTE(n[4], 2)], 2) ^ table_skew(old1_T0[BYTE(n[3], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[2], 4)], 4) ^ table_skew(old1_T0[BYTE(n[0], 6)], 6) ^ table_skew(old1_T0[BYTE(n[7], 7)], 7); + + round_constants[ 7]^= old1_T0[BYTE(n[7], 0)] + ^ table_skew(old1_T0[BYTE(n[6], 1)], 1) ^ table_skew(old1_T0[BYTE(n[5], 2)], 2) ^ table_skew(old1_T0[BYTE(n[4], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[3], 4)], 4) ^ table_skew(old1_T0[BYTE(n[2], 5)], 5) ^ table_skew(old1_T0[BYTE(n[0], 7)], 7); + + for(int i=1;i<5;i++) + n[i] = round_constants[i]; + + round_constants[ 8]^= table_skew(old1_T0[BYTE(n[4], 4)], 4) ^ table_skew(old1_T0[BYTE(n[3], 5)], 5) ^ table_skew(old1_T0[BYTE(n[2], 6)], 6) + ^ table_skew(old1_T0[BYTE(n[1], 7)], 7); + + round_constants[ 9]^= old1_T0[BYTE(n[1], 0)] + ^ table_skew(old1_T0[BYTE(n[4], 5)], 5) ^ table_skew(old1_T0[BYTE(n[3], 6)], 6) ^ table_skew(old1_T0[BYTE(n[2], 7)], 7); + + round_constants[10]^= old1_T0[BYTE(n[2], 0)] + ^ table_skew(old1_T0[BYTE(n[1], 1)], 1) ^ table_skew(old1_T0[BYTE(n[4], 6)], 6) ^ table_skew(old1_T0[BYTE(n[3], 7)], 7); + + round_constants[11]^= old1_T0[BYTE(n[3], 0)] + ^ table_skew(old1_T0[BYTE(n[2], 1)], 1) ^ table_skew(old1_T0[BYTE(n[1], 2)], 2) ^ table_skew(old1_T0[BYTE(n[4], 7)], 7); + + round_constants[12]^= old1_T0[BYTE(n[4], 0)] + ^ table_skew(old1_T0[BYTE(n[3], 1)], 1) ^ table_skew(old1_T0[BYTE(n[2], 2)], 2) ^ table_skew(old1_T0[BYTE(n[1], 3)], 3); + + round_constants[13]^= table_skew(old1_T0[BYTE(n[4], 1)], 1) ^ table_skew(old1_T0[BYTE(n[3], 2)], 2) ^ table_skew(old1_T0[BYTE(n[2], 3)], 3) + ^ table_skew(old1_T0[BYTE(n[1], 4)], 4); + + round_constants[14]^= table_skew(old1_T0[BYTE(n[4], 2)], 2) ^ table_skew(old1_T0[BYTE(n[3], 3)], 3) ^ table_skew(old1_T0[BYTE(n[2], 4)], 4) + ^ table_skew(old1_T0[BYTE(n[1], 5)], 5); + + round_constants[15]^= table_skew(old1_T0[BYTE(n[4], 3)], 3) ^ table_skew(old1_T0[BYTE(n[3], 4)], 4) ^ table_skew(old1_T0[BYTE(n[2], 5)], 5) + ^ table_skew(old1_T0[BYTE(n[1], 6)], 6); + + PaddedMessage[0] ^= PaddedMessage[8]; + + cudaMemcpyToSymbol(c_PaddedMessage80, PaddedMessage, 128, 0, cudaMemcpyHostToDevice); + + cudaMemcpyToSymbol(precomputed_round_key_80, round_constants, 80*sizeof(uint64_t), 0, cudaMemcpyHostToDevice); +} + +__host__ +extern void x15_whirlpool_cpu_free(int thr_id){ + cudaFree(InitVector_RC); + cudaFree(b0); + cudaFree(b7); +} + +__global__ __launch_bounds__(TPB80,2) +void oldwhirlpool_gpu_hash_80(uint32_t threads, uint32_t startNounce, uint32_t* resNonce, const uint64_t target){ + + __shared__ uint2 sharedMemory[7][256]; + + if (threadIdx.x < 256) { + const uint2 tmp = __ldg((uint2*)&b0[threadIdx.x]); + sharedMemory[0][threadIdx.x] = tmp; + sharedMemory[1][threadIdx.x] = ROL8(tmp); + sharedMemory[2][threadIdx.x] = ROL16(tmp); + sharedMemory[3][threadIdx.x] = ROL24(tmp); + sharedMemory[4][threadIdx.x] = SWAPUINT2(tmp); + sharedMemory[5][threadIdx.x] = ROR24(tmp); + sharedMemory[6][threadIdx.x] = ROR16(tmp); + } + + __syncthreads(); + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + + uint2 hash[8], state[8],n[8], tmp[8]; + uint32_t nonce = cuda_swab32(startNounce + thread); + uint2 temp = c_PaddedMessage80[9]; + temp.y = nonce; + + /// round 2 /////// + ////////////////////////////////// + temp = temp ^ c_PaddedMessage80[1]; + + *(uint2x4*)&n[ 0] = *(uint2x4*)&precomputed_round_key_80[ 0]; + *(uint2x4*)&n[ 4] = *(uint2x4*)&precomputed_round_key_80[ 4]; + *(uint2x4*)&tmp[ 0] = *(uint2x4*)&precomputed_round_key_80[ 8]; + *(uint2x4*)&tmp[ 4] = *(uint2x4*)&precomputed_round_key_80[12]; + + n[ 0]^= __ldg((uint2*)&b7[__byte_perm(temp.y, 0, 0x4443)]); + n[ 5]^= sharedMemory[4][__byte_perm(temp.y, 0, 0x4440)]; + n[ 6]^= sharedMemory[5][__byte_perm(temp.y, 0, 0x4441)]; + n[ 7]^= sharedMemory[6][__byte_perm(temp.y, 0, 0x4442)]; + + tmp[ 0]^= __ldg((uint2*)&b0[__byte_perm(n[0].x, 0, 0x4440)]); + tmp[ 0]^= sharedMemory[1][__byte_perm(n[7].x, 0, 0x4441)]; + tmp[ 0]^= sharedMemory[2][__byte_perm(n[6].x, 0, 0x4442)]; + tmp[ 0]^= sharedMemory[3][__byte_perm(n[5].x, 0, 0x4443)]; + + tmp[ 1]^= sharedMemory[1][__byte_perm(n[0].x, 0, 0x4441)]; + tmp[ 1]^= sharedMemory[2][__byte_perm(n[7].x, 0, 0x4442)]; + tmp[ 1]^= sharedMemory[3][__byte_perm(n[6].x, 0, 0x4443)]; + tmp[ 1]^= sharedMemory[4][__byte_perm(n[5].y, 0, 0x4440)]; + + tmp[ 2]^= sharedMemory[2][__byte_perm(n[0].x, 0, 0x4442)]; + tmp[ 2]^= sharedMemory[3][__byte_perm(n[7].x, 0, 0x4443)]; + tmp[ 2]^= sharedMemory[4][__byte_perm(n[6].y, 0, 0x4440)]; + tmp[ 2]^= sharedMemory[5][__byte_perm(n[5].y, 0, 0x4441)]; + + tmp[ 3]^= sharedMemory[3][__byte_perm(n[0].x, 0, 0x4443)]; + tmp[ 3]^= sharedMemory[4][__byte_perm(n[7].y, 0, 0x4440)]; + tmp[ 3]^= ROR24(__ldg((uint2*)&b0[__byte_perm(n[6].y, 0, 0x4441)])); + tmp[ 3]^= ROR8(__ldg((uint2*)&b7[__byte_perm(n[5].y, 0, 0x4442)])); + + tmp[ 4]^= sharedMemory[4][__byte_perm(n[0].y, 0, 0x4440)]; + tmp[ 4]^= sharedMemory[5][__byte_perm(n[7].y, 0, 0x4441)]; + tmp[ 4]^= ROR8(__ldg((uint2*)&b7[__byte_perm(n[6].y, 0, 0x4442)])); + tmp[ 4]^= __ldg((uint2*)&b7[__byte_perm(n[5].y, 0, 0x4443)]); + + tmp[ 5]^= __ldg((uint2*)&b0[__byte_perm(n[5].x, 0, 0x4440)]); + tmp[ 5]^= sharedMemory[5][__byte_perm(n[0].y, 0, 0x4441)]; + tmp[ 5]^= sharedMemory[6][__byte_perm(n[7].y, 0, 0x4442)]; + tmp[ 5]^= __ldg((uint2*)&b7[__byte_perm(n[6].y, 0, 0x4443)]); + + tmp[ 6]^= __ldg((uint2*)&b0[__byte_perm(n[6].x, 0, 0x4440)]); + tmp[ 6]^= sharedMemory[1][__byte_perm(n[5].x, 0, 0x4441)]; + tmp[ 6]^= sharedMemory[6][__byte_perm(n[0].y, 0, 0x4442)]; + tmp[ 6]^= __ldg((uint2*)&b7[__byte_perm(n[7].y, 0, 0x4443)]); + + tmp[ 7]^= __ldg((uint2*)&b0[__byte_perm(n[7].x, 0, 0x4440)]); + tmp[ 7]^= sharedMemory[1][__byte_perm(n[6].x, 0, 0x4441)]; + tmp[ 7]^= sharedMemory[2][__byte_perm(n[5].x, 0, 0x4442)]; + tmp[ 7]^= __ldg((uint2*)&b7[__byte_perm(n[0].y, 0, 0x4443)]); + + TRANSFER(n, tmp); + + for (int i=2; i<10; i++) { + tmp[ 0] = d_ROUND_ELT1_LDG(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, precomputed_round_key_80[i*8+0]); + tmp[ 1] = d_ROUND_ELT1( sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, precomputed_round_key_80[i*8+1]); + tmp[ 2] = d_ROUND_ELT1( sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, precomputed_round_key_80[i*8+2]); + tmp[ 3] = d_ROUND_ELT1_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, precomputed_round_key_80[i*8+3]); + tmp[ 4] = d_ROUND_ELT1_LDG(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, precomputed_round_key_80[i*8+4]); + tmp[ 5] = d_ROUND_ELT1( sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, precomputed_round_key_80[i*8+5]); + tmp[ 6] = d_ROUND_ELT1( sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, precomputed_round_key_80[i*8+6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, precomputed_round_key_80[i*8+7]); + TRANSFER(n, tmp); + } + + state[0] = c_PaddedMessage80[0] ^ n[0]; + state[1] = c_PaddedMessage80[1] ^ n[1] ^ vectorize(REPLACE_HIDWORD(devectorize(c_PaddedMessage80[9]),nonce)); + state[2] = c_PaddedMessage80[2] ^ n[2] ^ vectorize(0x0000000000000080); + state[3] = c_PaddedMessage80[3] ^ n[3]; + state[4] = c_PaddedMessage80[4] ^ n[4]; + state[5] = c_PaddedMessage80[5] ^ n[5]; + state[6] = c_PaddedMessage80[6] ^ n[6]; + state[7] = c_PaddedMessage80[7] ^ n[7] ^ vectorize(0x8002000000000000); + + #pragma unroll 2 + for(int r=0;r<2;r++){ + #pragma unroll 8 + for(int i=0;i<8;i++) + hash[ i] = n[ i] = state[ i]; + + uint2 h[8] = { + {0xC0EE0B30,0x672990AF},{0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828}, + {0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828} + }; + + tmp[ 0] = d_ROUND_ELT1_LDG(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, h[0]); + tmp[ 1] = d_ROUND_ELT1(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, h[1]); + tmp[ 2] = d_ROUND_ELT1(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, h[2]); + tmp[ 3] = d_ROUND_ELT1_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, h[3]); + tmp[ 4] = d_ROUND_ELT1(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, h[4]); + tmp[ 5] = d_ROUND_ELT1_LDG(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, h[5]); + tmp[ 6] = d_ROUND_ELT1(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, h[6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, h[7]); + TRANSFER(n, tmp); + // #pragma unroll 10 + for (int i=1; i <10; i++){ + tmp[ 0] = d_ROUND_ELT1_LDG(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, precomputed_round_key_64[(i-1)*8+0]); + tmp[ 1] = d_ROUND_ELT1( sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, precomputed_round_key_64[(i-1)*8+1]); + tmp[ 2] = d_ROUND_ELT1( sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, precomputed_round_key_64[(i-1)*8+2]); + tmp[ 3] = d_ROUND_ELT1_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, precomputed_round_key_64[(i-1)*8+3]); + tmp[ 4] = d_ROUND_ELT1( sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, precomputed_round_key_64[(i-1)*8+4]); + tmp[ 5] = d_ROUND_ELT1( sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, precomputed_round_key_64[(i-1)*8+5]); + tmp[ 6] = d_ROUND_ELT1( sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, precomputed_round_key_64[(i-1)*8+6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, precomputed_round_key_64[(i-1)*8+7]); + TRANSFER(n, tmp); + } + #pragma unroll 8 + for (int i=0; i<8; i++) + state[i] = n[i] ^ hash[i]; + + #pragma unroll 6 + for (int i=1; i<7; i++) + n[i]=vectorize(0); + + n[0] = vectorize(0x80); + n[7] = vectorize(0x2000000000000); + + #pragma unroll 8 + for (int i=0; i < 8; i++) { + h[i] = state[i]; + n[i] = n[i] ^ h[i]; + } + + // #pragma unroll 10 + for (int i=0; i < 10; i++) { + tmp[ 0] = d_ROUND_ELT1(sharedMemory, h, 0, 7, 6, 5, 4, 3, 2, 1, InitVector_RC[i]); + tmp[ 1] = d_ROUND_ELT(sharedMemory, h, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[ 2] = d_ROUND_ELT_LDG(sharedMemory, h, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[ 3] = d_ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[ 4] = d_ROUND_ELT_LDG(sharedMemory, h, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[ 5] = d_ROUND_ELT(sharedMemory, h, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[ 6] = d_ROUND_ELT_LDG(sharedMemory, h, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[ 7] = d_ROUND_ELT(sharedMemory, h, 7, 6, 5, 4, 3, 2, 1, 0); + TRANSFER(h, tmp); + tmp[ 0] = d_ROUND_ELT1(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, tmp[0]); + tmp[ 1] = d_ROUND_ELT1(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, tmp[1]); + tmp[ 2] = d_ROUND_ELT1_LDG(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, tmp[2]); + tmp[ 3] = d_ROUND_ELT1(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, tmp[3]); + tmp[ 4] = d_ROUND_ELT1(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, tmp[4]); + tmp[ 5] = d_ROUND_ELT1(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, tmp[5]); + tmp[ 6] = d_ROUND_ELT1(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, tmp[6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, tmp[7]); + TRANSFER(n, tmp); + } + + state[0] = xor3x(state[0], n[0], vectorize(0x80)); + state[1] = state[1]^ n[1]; + state[2] = state[2]^ n[2]; + state[3] = state[3]^ n[3]; + state[4] = state[4]^ n[4]; + state[5] = state[5]^ n[5]; + state[6] = state[6]^ n[6]; + state[7] = xor3x(state[7], n[7], vectorize(0x2000000000000)); + } + + uint2 h[8] = { + {0xC0EE0B30,0x672990AF},{0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828}, + {0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828} + }; + + #pragma unroll 8 + for(int i=0;i<8;i++) + n[i]=hash[i] = state[ i]; + + tmp[ 0] = d_ROUND_ELT1(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, h[0]); + tmp[ 1] = d_ROUND_ELT1_LDG(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, h[1]); + tmp[ 2] = d_ROUND_ELT1(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, h[2]); + tmp[ 3] = d_ROUND_ELT1_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, h[3]); + tmp[ 4] = d_ROUND_ELT1(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, h[4]); + tmp[ 5] = d_ROUND_ELT1_LDG(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, h[5]); + tmp[ 6] = d_ROUND_ELT1(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, h[6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, h[7]); + TRANSFER(n, tmp); +// #pragma unroll 10 + for (int i=1; i <10; i++){ + tmp[ 0] = d_ROUND_ELT1_LDG(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, precomputed_round_key_64[(i-1)*8+0]); + tmp[ 1] = d_ROUND_ELT1( sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, precomputed_round_key_64[(i-1)*8+1]); + tmp[ 2] = d_ROUND_ELT1( sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, precomputed_round_key_64[(i-1)*8+2]); + tmp[ 3] = d_ROUND_ELT1_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, precomputed_round_key_64[(i-1)*8+3]); + tmp[ 4] = d_ROUND_ELT1( sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, precomputed_round_key_64[(i-1)*8+4]); + tmp[ 5] = d_ROUND_ELT1( sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, precomputed_round_key_64[(i-1)*8+5]); + tmp[ 6] = d_ROUND_ELT1( sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, precomputed_round_key_64[(i-1)*8+6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, precomputed_round_key_64[(i-1)*8+7]); + TRANSFER(n, tmp); + } + + #pragma unroll 8 + for (int i=0; i<8; i++) + n[ i] = h[i] = n[i] ^ hash[i]; + + uint2 backup = h[ 3]; + + n[0]^= vectorize(0x80); + n[7]^= vectorize(0x2000000000000); + +// #pragma unroll 8 + for (int i=0; i < 8; i++) { + tmp[ 0] = d_ROUND_ELT1(sharedMemory, h, 0, 7, 6, 5, 4, 3, 2, 1, InitVector_RC[i]); + tmp[ 1] = d_ROUND_ELT(sharedMemory, h, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[ 2] = d_ROUND_ELT_LDG(sharedMemory, h, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[ 3] = d_ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[ 4] = d_ROUND_ELT_LDG(sharedMemory, h, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[ 5] = d_ROUND_ELT(sharedMemory, h, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[ 6] = d_ROUND_ELT_LDG(sharedMemory, h, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[ 7] = d_ROUND_ELT(sharedMemory, h, 7, 6, 5, 4, 3, 2, 1, 0); + TRANSFER(h, tmp); + tmp[ 0] = d_ROUND_ELT1(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, tmp[0]); + tmp[ 1] = d_ROUND_ELT1(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, tmp[1]); + tmp[ 2] = d_ROUND_ELT1_LDG(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, tmp[2]); + tmp[ 3] = d_ROUND_ELT1(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, tmp[3]); + tmp[ 4] = d_ROUND_ELT1(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, tmp[4]); + tmp[ 5] = d_ROUND_ELT1(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, tmp[5]); + tmp[ 6] = d_ROUND_ELT1(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, tmp[6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, tmp[7]); + TRANSFER(n, tmp); + } + tmp[ 0] = d_ROUND_ELT1(sharedMemory, h, 0, 7, 6, 5, 4, 3, 2, 1, InitVector_RC[8]); + tmp[ 1] = d_ROUND_ELT(sharedMemory, h, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[ 2] = d_ROUND_ELT_LDG(sharedMemory, h, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[ 3] = d_ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[ 4] = d_ROUND_ELT_LDG(sharedMemory, h, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[ 5] = d_ROUND_ELT(sharedMemory, h, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[ 6] = d_ROUND_ELT(sharedMemory, h, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[ 7] = d_ROUND_ELT(sharedMemory, h, 7, 6, 5, 4, 3, 2, 1, 0); + TRANSFER(h, tmp); + tmp[ 0] = d_ROUND_ELT1(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, tmp[0]); + tmp[ 1] = d_ROUND_ELT1(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, tmp[1]); + tmp[ 2] = d_ROUND_ELT1(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, tmp[2]); + tmp[ 3] = d_ROUND_ELT1(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, tmp[3]); + tmp[ 4] = d_ROUND_ELT1(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, tmp[4]); + tmp[ 5] = d_ROUND_ELT1(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, tmp[5]); + tmp[ 6] = d_ROUND_ELT1_LDG(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, tmp[6]); + tmp[ 7] = d_ROUND_ELT1(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, tmp[7]); + + n[ 3] = backup ^ d_ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4) ^ d_ROUND_ELT(sharedMemory,tmp, 3, 2, 1, 0, 7, 6, 5, 4); + + if(devectorize(n[3]) <= target){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + + } // thread < threads +} + +__host__ +void whirlpool512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_resNonce, const uint64_t target) +{ + dim3 grid((threads + TPB80-1) / TPB80); + dim3 block(TPB80); + + oldwhirlpool_gpu_hash_80<<>>(threads, startNounce,d_resNonce,target); +} + +__global__ __launch_bounds__(TPB64,2) +void x15_whirlpool_gpu_hash_64(uint32_t threads, uint64_t *g_hash) +{ + __shared__ uint2 sharedMemory[7][256]; + + if (threadIdx.x < 256) { + const uint2 tmp = __ldg((uint2*)&b0[threadIdx.x]); + sharedMemory[0][threadIdx.x] = tmp; + sharedMemory[1][threadIdx.x] = ROL8(tmp); + sharedMemory[2][threadIdx.x] = ROL16(tmp); + sharedMemory[3][threadIdx.x] = ROL24(tmp); + sharedMemory[4][threadIdx.x] = SWAPUINT2(tmp); + sharedMemory[5][threadIdx.x] = ROR24(tmp); + sharedMemory[6][threadIdx.x] = ROR16(tmp); + } + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads){ + + uint2 hash[8], n[8], h[ 8]; + uint2 tmp[8] = { + {0xC0EE0B30,0x672990AF},{0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828}, + {0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828} + }; + + *(uint2x4*)&hash[ 0] = __ldg4((uint2x4*)&g_hash[(thread<<3) + 0]); + *(uint2x4*)&hash[ 4] = __ldg4((uint2x4*)&g_hash[(thread<<3) + 4]); + + __syncthreads(); + + #pragma unroll 8 + for(int i=0;i<8;i++) + n[i]=hash[i]; + + tmp[ 0]^= d_ROUND_ELT(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1); + tmp[ 1]^= d_ROUND_ELT_LDG(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[ 2]^= d_ROUND_ELT(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[ 3]^= d_ROUND_ELT_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[ 4]^= d_ROUND_ELT(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[ 5]^= d_ROUND_ELT_LDG(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[ 6]^= d_ROUND_ELT(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[ 7]^= d_ROUND_ELT_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0); + for (int i=1; i <10; i++){ + TRANSFER(n, tmp); + tmp[ 0] = d_ROUND_ELT1_LDG(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, precomputed_round_key_64[(i-1)*8+0]); + tmp[ 1] = d_ROUND_ELT1( sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, precomputed_round_key_64[(i-1)*8+1]); + tmp[ 2] = d_ROUND_ELT1( sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, precomputed_round_key_64[(i-1)*8+2]); + tmp[ 3] = d_ROUND_ELT1_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, precomputed_round_key_64[(i-1)*8+3]); + tmp[ 4] = d_ROUND_ELT1( sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, precomputed_round_key_64[(i-1)*8+4]); + tmp[ 5] = d_ROUND_ELT1( sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, precomputed_round_key_64[(i-1)*8+5]); + tmp[ 6] = d_ROUND_ELT1( sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, precomputed_round_key_64[(i-1)*8+6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, precomputed_round_key_64[(i-1)*8+7]); + } + + TRANSFER(h, tmp); + #pragma unroll 8 + for (int i=0; i<8; i++) + hash[ i] = h[i] = h[i] ^ hash[i]; + + #pragma unroll 6 + for (int i=1; i<7; i++) + n[i]=vectorize(0); + + n[0] = vectorize(0x80); + n[7] = vectorize(0x2000000000000); + + #pragma unroll 8 + for (int i=0; i < 8; i++) { + n[i] = n[i] ^ h[i]; + } + +// #pragma unroll 10 + for (int i=0; i < 10; i++) { + tmp[ 0] = InitVector_RC[i]; + tmp[ 0]^= d_ROUND_ELT(sharedMemory, h, 0, 7, 6, 5, 4, 3, 2, 1); + tmp[ 1] = d_ROUND_ELT(sharedMemory, h, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[ 2] = d_ROUND_ELT_LDG(sharedMemory, h, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[ 3] = d_ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[ 4] = d_ROUND_ELT_LDG(sharedMemory, h, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[ 5] = d_ROUND_ELT(sharedMemory, h, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[ 6] = d_ROUND_ELT(sharedMemory, h, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[ 7] = d_ROUND_ELT(sharedMemory, h, 7, 6, 5, 4, 3, 2, 1, 0); + TRANSFER(h, tmp); + tmp[ 0] = d_ROUND_ELT1(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, tmp[0]); + tmp[ 1] = d_ROUND_ELT1_LDG(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, tmp[1]); + tmp[ 2] = d_ROUND_ELT1(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, tmp[2]); + tmp[ 3] = d_ROUND_ELT1(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, tmp[3]); + tmp[ 4] = d_ROUND_ELT1_LDG(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, tmp[4]); + tmp[ 5] = d_ROUND_ELT1(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, tmp[5]); + tmp[ 6] = d_ROUND_ELT1_LDG(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, tmp[6]); + tmp[ 7] = d_ROUND_ELT1(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, tmp[7]); + TRANSFER(n, tmp); + } + + hash[0] = xor3x(hash[0], n[0], vectorize(0x80)); + hash[1] = hash[1]^ n[1]; + hash[2] = hash[2]^ n[2]; + hash[3] = hash[3]^ n[3]; + hash[4] = hash[4]^ n[4]; + hash[5] = hash[5]^ n[5]; + hash[6] = hash[6]^ n[6]; + hash[7] = xor3x(hash[7], n[7], vectorize(0x2000000000000)); + + *(uint2x4*)&g_hash[(thread<<3)+ 0] = *(uint2x4*)&hash[ 0]; + *(uint2x4*)&g_hash[(thread<<3)+ 4] = *(uint2x4*)&hash[ 4]; + } +} + +__host__ +extern void x15_whirlpool_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + dim3 grid((threads + TPB64-1) / TPB64); + dim3 block(TPB64); + + x15_whirlpool_gpu_hash_64 <<>> (threads, (uint64_t*)d_hash); +} + +__global__ __launch_bounds__(TPB64,2) +void x15_whirlpool_gpu_hash_64_final(uint32_t threads,const uint64_t* __restrict__ g_hash, uint32_t* resNonce, const uint64_t target) +{ + __shared__ uint2 sharedMemory[7][256]; + + if (threadIdx.x < 256) { + const uint2 tmp = __ldg((uint2*)&b0[threadIdx.x]); + sharedMemory[0][threadIdx.x] = tmp; + sharedMemory[1][threadIdx.x] = ROL8(tmp); + sharedMemory[2][threadIdx.x] = ROL16(tmp); + sharedMemory[3][threadIdx.x] = ROL24(tmp); + sharedMemory[4][threadIdx.x] = SWAPUINT2(tmp); + sharedMemory[5][threadIdx.x] = ROR24(tmp); + sharedMemory[6][threadIdx.x] = ROR16(tmp); + } + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + if (thread < threads){ + + uint2 hash[8], n[8], h[ 8], backup; + uint2 tmp[8] = { + {0xC0EE0B30,0x672990AF},{0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828}, + {0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828},{0x28282828,0x28282828} + }; + + *(uint2x4*)&hash[ 0] = __ldg4((uint2x4*)&g_hash[(thread<<3) + 0]); + *(uint2x4*)&hash[ 4] = __ldg4((uint2x4*)&g_hash[(thread<<3) + 4]); + + __syncthreads(); + + #pragma unroll 8 + for(int i=0;i<8;i++) + n[i]=hash[i]; + +// __syncthreads(); + + tmp[ 0]^= d_ROUND_ELT(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1); + tmp[ 1]^= d_ROUND_ELT_LDG(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[ 2]^= d_ROUND_ELT(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[ 3]^= d_ROUND_ELT_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[ 4]^= d_ROUND_ELT(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[ 5]^= d_ROUND_ELT_LDG(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[ 6]^= d_ROUND_ELT(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[ 7]^= d_ROUND_ELT_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0); + + for (int i=1; i <10; i++){ + TRANSFER(n, tmp); + tmp[ 0] = d_ROUND_ELT1_LDG(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, precomputed_round_key_64[(i-1)*8+0]); + tmp[ 1] = d_ROUND_ELT1( sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, precomputed_round_key_64[(i-1)*8+1]); + tmp[ 2] = d_ROUND_ELT1( sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, precomputed_round_key_64[(i-1)*8+2]); + tmp[ 3] = d_ROUND_ELT1_LDG(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, precomputed_round_key_64[(i-1)*8+3]); + tmp[ 4] = d_ROUND_ELT1( sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, precomputed_round_key_64[(i-1)*8+4]); + tmp[ 5] = d_ROUND_ELT1( sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, precomputed_round_key_64[(i-1)*8+5]); + tmp[ 6] = d_ROUND_ELT1( sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, precomputed_round_key_64[(i-1)*8+6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, precomputed_round_key_64[(i-1)*8+7]); + } + + TRANSFER(h, tmp); + #pragma unroll 8 + for (int i=0; i<8; i++) + h[i] = h[i] ^ hash[i]; + + #pragma unroll 6 + for (int i=1; i<7; i++) + n[i]=vectorize(0); + + n[0] = vectorize(0x80); + n[7] = vectorize(0x2000000000000); + + #pragma unroll 8 + for (int i=0; i < 8; i++) { + n[i] = n[i] ^ h[i]; + } + + backup = h[ 3]; + +// #pragma unroll 8 + for (int i=0; i < 8; i++) { + tmp[ 0] = d_ROUND_ELT1(sharedMemory, h, 0, 7, 6, 5, 4, 3, 2, 1, InitVector_RC[i]); + tmp[ 1] = d_ROUND_ELT(sharedMemory, h, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[ 2] = d_ROUND_ELT_LDG(sharedMemory, h, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[ 3] = d_ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[ 4] = d_ROUND_ELT_LDG(sharedMemory, h, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[ 5] = d_ROUND_ELT(sharedMemory, h, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[ 6] = d_ROUND_ELT_LDG(sharedMemory, h, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[ 7] = d_ROUND_ELT(sharedMemory, h, 7, 6, 5, 4, 3, 2, 1, 0); + TRANSFER(h, tmp); + tmp[ 0] = d_ROUND_ELT1(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, tmp[0]); + tmp[ 1] = d_ROUND_ELT1(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, tmp[1]); + tmp[ 2] = d_ROUND_ELT1_LDG(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, tmp[2]); + tmp[ 3] = d_ROUND_ELT1(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, tmp[3]); + tmp[ 4] = d_ROUND_ELT1(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, tmp[4]); + tmp[ 5] = d_ROUND_ELT1(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, tmp[5]); + tmp[ 6] = d_ROUND_ELT1(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, tmp[6]); + tmp[ 7] = d_ROUND_ELT1_LDG(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, tmp[7]); + TRANSFER(n, tmp); + } + tmp[ 0] = d_ROUND_ELT1(sharedMemory, h, 0, 7, 6, 5, 4, 3, 2, 1, InitVector_RC[8]); + tmp[ 1] = d_ROUND_ELT(sharedMemory, h, 1, 0, 7, 6, 5, 4, 3, 2); + tmp[ 2] = d_ROUND_ELT_LDG(sharedMemory, h, 2, 1, 0, 7, 6, 5, 4, 3); + tmp[ 3] = d_ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4); + tmp[ 4] = d_ROUND_ELT_LDG(sharedMemory, h, 4, 3, 2, 1, 0, 7, 6, 5); + tmp[ 5] = d_ROUND_ELT(sharedMemory, h, 5, 4, 3, 2, 1, 0, 7, 6); + tmp[ 6] = d_ROUND_ELT(sharedMemory, h, 6, 5, 4, 3, 2, 1, 0, 7); + tmp[ 7] = d_ROUND_ELT(sharedMemory, h, 7, 6, 5, 4, 3, 2, 1, 0); + TRANSFER(h, tmp); + tmp[ 0] = d_ROUND_ELT1(sharedMemory,n, 0, 7, 6, 5, 4, 3, 2, 1, tmp[0]); + tmp[ 1] = d_ROUND_ELT1(sharedMemory,n, 1, 0, 7, 6, 5, 4, 3, 2, tmp[1]); + tmp[ 2] = d_ROUND_ELT1(sharedMemory,n, 2, 1, 0, 7, 6, 5, 4, 3, tmp[2]); + tmp[ 3] = d_ROUND_ELT1(sharedMemory,n, 3, 2, 1, 0, 7, 6, 5, 4, tmp[3]); + tmp[ 4] = d_ROUND_ELT1(sharedMemory,n, 4, 3, 2, 1, 0, 7, 6, 5, tmp[4]); + tmp[ 5] = d_ROUND_ELT1(sharedMemory,n, 5, 4, 3, 2, 1, 0, 7, 6, tmp[5]); + tmp[ 6] = d_ROUND_ELT1_LDG(sharedMemory,n, 6, 5, 4, 3, 2, 1, 0, 7, tmp[6]); + tmp[ 7] = d_ROUND_ELT1(sharedMemory,n, 7, 6, 5, 4, 3, 2, 1, 0, tmp[7]); + + n[ 3] = backup ^ d_ROUND_ELT(sharedMemory, h, 3, 2, 1, 0, 7, 6, 5, 4) ^ d_ROUND_ELT(sharedMemory,tmp, 3, 2, 1, 0, 7, 6, 5, 4); + + if(devectorize(n[3]) <= target){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } +} + +extern void x15_whirlpool_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target) +{ + dim3 grid((threads + TPB64-1) / TPB64); + dim3 block(TPB64); + + x15_whirlpool_gpu_hash_64_final <<>> (threads, (uint64_t*)d_hash,d_resNonce,target); +} diff --git a/x15/whirlpool.cu b/x15/whirlpool.cu new file mode 100644 index 0000000..553697d --- /dev/null +++ b/x15/whirlpool.cu @@ -0,0 +1,159 @@ +/* + * whirlpool routine (djm) + */ +extern "C" +{ +#include "sph/sph_whirlpool.h" +} +#include "miner.h" +#include "cuda_helper.h" + +#define NBN 2 + +// Memory for the hash functions +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +extern void x15_whirlpool_cpu_init(int thr_id, uint32_t threads, int mode); +extern void x15_whirlpool_cpu_free(int thr_id); + +extern void whirlpool512_setBlock_80(void *pdata, const void *ptarget); +extern void whirlpool512_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *d_resNonce, const uint64_t target); + +// CPU Hash function +extern "C" void wcoinhash(void *state, const void *input) +{ + sph_whirlpool_context ctx_whirlpool; + + unsigned char hash[128]; // uint32_t hashA[16], hashB[16]; + #define hashB hash+64 + + memset(hash, 0, sizeof hash); + + sph_whirlpool1_init(&ctx_whirlpool); + sph_whirlpool1(&ctx_whirlpool, input, 80); + sph_whirlpool1_close(&ctx_whirlpool, hash); + + sph_whirlpool1_init(&ctx_whirlpool); + sph_whirlpool1(&ctx_whirlpool, hash, 64); + sph_whirlpool1_close(&ctx_whirlpool, hashB); + + sph_whirlpool1_init(&ctx_whirlpool); + sph_whirlpool1(&ctx_whirlpool, hashB, 64); + sph_whirlpool1_close(&ctx_whirlpool, hash); + + sph_whirlpool1_init(&ctx_whirlpool); + sph_whirlpool1(&ctx_whirlpool, hash, 64); + sph_whirlpool1_close(&ctx_whirlpool, hash); + + memcpy(state, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_whirl(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + + int dev_id = device_map[thr_id]; + + uint32_t endiandata[20]; + uint32_t* pdata = work->data; + uint32_t* ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<22; + else if(device_sm[dev_id]<=520) default_throughput = 1<<25; + else if((device_sm[dev_id]<=520) && is_windows()) default_throughput = 1<<24; + else if(device_sm[dev_id]>520) default_throughput = 1<<25; + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ((uint32_t*)ptarget)[7] = 0x0000ff; + + if (!init[thr_id]) { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x15_whirlpool_cpu_init(thr_id, throughput, 1 /* old whirlpool */); + +// CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], (size_t) 64 * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + for (int k=0; k < 20; k++) { + be32enc(&endiandata[k], pdata[k]); + } + + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + whirlpool512_setBlock_80((void*)endiandata, ptarget); + do { + whirlpool512_cpu_hash_80(thr_id, throughput, pdata[19], d_resNonce[thr_id], *(uint64_t*)&ptarget[ 6]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + wcoinhash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], pdata[21]); + wcoinhash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + res++; + } + return res; + }else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce; + return 0; +} + +// cleanup +extern "C" void free_whirl(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + x15_whirlpool_cpu_free(thr_id); + init[thr_id] = false; + + cudaDeviceSynchronize(); +} + diff --git a/x15/whirlpoolx.cu b/x15/whirlpoolx.cu new file mode 100644 index 0000000..6eff7d9 --- /dev/null +++ b/x15/whirlpoolx.cu @@ -0,0 +1,126 @@ +/* + * whirlpool routine (djm) + * whirlpoolx routine (provos alexis, tpruvot) + */ +extern "C" { +#include "sph/sph_whirlpool.h" +} + +#include "miner.h" +#include "cuda_helper.h" + +static uint32_t *d_hash[MAX_GPUS] = { 0 }; + +extern void whirlpoolx_cpu_free(int thr_id); +extern void whirlpoolx_cpu_init(int thr_id, int threads); +extern void whirlpoolx_setBlock_precompute(void *pdata, const void *ptarget,int thr_id); +extern uint32_t cpu_whirlpoolx(int thr_id, uint32_t threads, uint32_t startNounce); +extern void whirlpoolx_precompute(int thr_id); +// CPU Hash function +extern "C" void whirlxHash(void *state, const void *input) +{ + sph_whirlpool_context ctx_whirlpool; + + unsigned char hash[64]; + unsigned char hash_xored[32]; + + sph_whirlpool_init(&ctx_whirlpool); + sph_whirlpool(&ctx_whirlpool, input, 80); + sph_whirlpool_close(&ctx_whirlpool, hash); + + // compress the 48 first bytes of the hash to 32 + for (int i = 0; i < 32; i++) { + hash_xored[i] = hash[i] ^ hash[i + 16]; + } + memcpy(state, hash_xored, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_whirlpoolx(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + uint32_t endiandata[20]; + int intensity = is_windows() ? 20 : 22; + uint32_t throughput = cuda_default_throughput(thr_id, 1U << intensity); + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + if (opt_benchmark) + ptarget[7] = 0x000f; + + if (!init[thr_id]) { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + CUDA_LOG_ERROR(); + } + + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + CUDA_CALL_OR_RET_X(cudaMalloc(&d_hash[thr_id], (size_t) 64 * throughput), -1); + + whirlpoolx_cpu_init(thr_id, throughput); + + init[thr_id] = true; + } + + for (int k=0; k < 20; k++) { + be32enc(&endiandata[k], pdata[k]); + } + + whirlpoolx_setBlock_precompute((void*)endiandata, ptarget,thr_id); + + do { + uint32_t foundNonce = cpu_whirlpoolx(thr_id, throughput, pdata[19]); + + *(hashes_done) = pdata[19] - first_nonce + throughput; + + if (foundNonce != UINT32_MAX && bench_algo < 0) + { + const uint32_t Htarg = ptarget[7]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], foundNonce); + whirlxHash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + work_set_target_ratio(work, vhash64); + pdata[19] = foundNonce; + return 1; + } else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNonce); + } + } + + if ((uint64_t)throughput + pdata[19] >= max_nonce) { + pdata[19] = max_nonce; + break; + } + + pdata[19] += throughput; + + } while (!work_restart[thr_id].restart); + + *(hashes_done) = pdata[19] - first_nonce; + + return 0; +} + +// cleanup +extern "C" void free_whirlx(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaThreadSynchronize(); + + cudaFree(d_hash[thr_id]); + + whirlpoolx_cpu_free(thr_id); + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/x15/x15.cu b/x15/x15.cu new file mode 100644 index 0000000..08f5534 --- /dev/null +++ b/x15/x15.cu @@ -0,0 +1,267 @@ +/* + * X15 algorithm (CHC, BBC, X15C) + * Added in ccminer by Tanguy Pruvot - 2014 + */ + +extern "C" { +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" + +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" + +#include "sph/sph_hamsi.h" +#include "sph/sph_fugue.h" +#include "sph/sph_shabal.h" +#include "sph/sph_whirlpool.h" +} + +#include "miner.h" + +#include "cuda_helper.h" +#include "x11/cuda_x11.h" + + +#define NBN 2 + +// Memory for the hash functions +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +extern void x13_hamsi_fugue512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void x14_shabal512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void x15_whirlpool_cpu_init(int thr_id, uint32_t threads, int mode); +extern void x15_whirlpool_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void x15_whirlpool_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *d_resNonce, const uint64_t target); +extern void x15_whirlpool_cpu_free(int thr_id); + + +// X15 CPU Hash function +extern "C" void x15hash(void *output, const void *input) +{ + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + sph_hamsi512_context ctx_hamsi; + sph_fugue512_context ctx_fugue; + sph_shabal512_context ctx_shabal; + sph_whirlpool_context ctx_whirlpool; + + unsigned char hash[128]; // uint32_t hashA[16], hashB[16]; + #define hashB hash+64 + + memset(hash, 0, sizeof hash); + + sph_blake512_init(&ctx_blake); + sph_blake512(&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512(&ctx_bmw, hash, 64); + sph_bmw512_close(&ctx_bmw, hashB); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512(&ctx_groestl, hashB, 64); + sph_groestl512_close(&ctx_groestl, hash); + + sph_skein512_init(&ctx_skein); + sph_skein512(&ctx_skein, hash, 64); + sph_skein512_close(&ctx_skein, hashB); + + sph_jh512_init(&ctx_jh); + sph_jh512(&ctx_jh, hashB, 64); + sph_jh512_close(&ctx_jh, hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512(&ctx_keccak, hash, 64); + sph_keccak512_close(&ctx_keccak, hashB); + + sph_luffa512_init(&ctx_luffa); + sph_luffa512(&ctx_luffa, hashB, 64); + sph_luffa512_close(&ctx_luffa, hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512(&ctx_cubehash, hash, 64); + sph_cubehash512_close(&ctx_cubehash, hashB); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512(&ctx_shavite, hashB, 64); + sph_shavite512_close(&ctx_shavite, hash); + + sph_simd512_init(&ctx_simd); + sph_simd512(&ctx_simd, hash, 64); + sph_simd512_close(&ctx_simd, hashB); + + sph_echo512_init(&ctx_echo); + sph_echo512(&ctx_echo, hashB, 64); + sph_echo512_close(&ctx_echo, hash); + + sph_hamsi512_init(&ctx_hamsi); + sph_hamsi512(&ctx_hamsi, hash, 64); + sph_hamsi512_close(&ctx_hamsi, hashB); + + sph_fugue512_init(&ctx_fugue); + sph_fugue512(&ctx_fugue, hashB, 64); + sph_fugue512_close(&ctx_fugue, hash); + + sph_shabal512_init(&ctx_shabal); + sph_shabal512(&ctx_shabal, hash, 64); + sph_shabal512_close(&ctx_shabal, hashB); + + sph_whirlpool_init(&ctx_whirlpool); + sph_whirlpool(&ctx_whirlpool, hashB, 64); + sph_whirlpool_close(&ctx_whirlpool, hash); + + memcpy(output, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_x15(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done) +{ + + int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + uint32_t endiandata[20]; + + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<20; + else if(device_sm[dev_id]<=520) default_throughput = 1<<21; + else if(device_sm[dev_id]>520) default_throughput = (1<<22) + (1<<21); + + if((strstr(device_name[dev_id], "3GB")))default_throughput = 1<<21; + if((strstr(device_name[dev_id], "6GB")))default_throughput = 1<<22; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + throughput&=0xFFFFFF70; //multiples of 128 due to simd_echo kernel + + if (opt_benchmark) + ptarget[7] = 0x000f; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_LOG_ERROR(); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + x15_whirlpool_cpu_init(thr_id, throughput, 0); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + do { + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_keccak512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x13_hamsi_fugue512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x14_shabal512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); +// x15_whirlpool_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x15_whirlpool_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id], d_resNonce[thr_id], *(uint64_t*)&ptarget[ 6]); + + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + x15hash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput + 1; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], pdata[21]); + x15hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce + 1; + + return 0; +} + +// cleanup +extern "C" void free_x15(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + x15_whirlpool_cpu_free(thr_id); + init[thr_id] = false; + + cudaDeviceSynchronize(); +} diff --git a/x17/cuda_x17_haval256.cu b/x17/cuda_x17_haval256.cu new file mode 100644 index 0000000..6567eb5 --- /dev/null +++ b/x17/cuda_x17_haval256.cu @@ -0,0 +1,348 @@ +/* + * haval-256 kernel implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2014 djm34 + * 2016 tpruvot + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + */ + +#define TPB 512 + +#include "cuda_helper.h" +#include "cuda_vectors.h" + +#define F1(x6, x5, x4, x3, x2, x1, x0) \ + (((x1) & ((x0) ^ (x4))) ^ ((x2) & (x5)) ^ ((x3) & (x6)) ^ (x0)) + +#define F2(x6, x5, x4, x3, x2, x1, x0) \ + (((x2) & (((x1) & ~(x3)) ^ ((x4) & (x5)) ^ (x6) ^ (x0))) ^ ((x4) & ((x1) ^ (x5))) ^ ((x3 & (x5)) ^ (x0))) + +#define F3(x6, x5, x4, x3, x2, x1, x0) \ + (((x3) & (((x1) & (x2)) ^ (x6) ^ (x0))) ^ ((x1) & (x4)) ^ ((x2) & (x5)) ^ (x0)) + +#define F4(x6, x5, x4, x3, x2, x1, x0) \ + (((x3) & (((x1) & (x2)) ^ ((x4) | (x6)) ^ (x5))) ^ ((x4) & ((~(x2) & (x5)) ^ (x1) ^ (x6) ^ (x0))) ^ ((x2) & (x6)) ^ (x0)) + +#define F5(x6, x5, x4, x3, x2, x1, x0) \ + (((x0) & ~(((x1) & (x2) & (x3)) ^ (x5))) ^ ((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6))) + +#define FP5_1(x6, x5, x4, x3, x2, x1, x0) \ + F1(x3, x4, x1, x0, x5, x2, x6) +#define FP5_2(x6, x5, x4, x3, x2, x1, x0) \ + F2(x6, x2, x1, x0, x3, x4, x5) +#define FP5_3(x6, x5, x4, x3, x2, x1, x0) \ + F3(x2, x6, x0, x4, x3, x1, x5) +#define FP5_4(x6, x5, x4, x3, x2, x1, x0) \ + F4(x1, x5, x3, x2, x0, x4, x6) +#define FP5_5(x6, x5, x4, x3, x2, x1, x0) \ + F5(x2, x5, x0, x6, x4, x3, x1) + +#define STEP(n, p, x7, x6, x5, x4, x3, x2, x1, x0, w, c) { \ + uint32_t t = FP ## n ## _ ## p(x6, x5, x4, x3, x2, x1, x0); \ + (x7) = (uint32_t)(ROTR32(t, 7) + ROTR32((x7), 11) + (w) + (c)); \ +} + +#define PASS1(n, in) { \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, in[ 0], 0U); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, in[ 1], 0U); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, in[ 2], 0U); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, in[ 3], 0U); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, in[ 4], 0U); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, in[ 5], 0U); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, in[ 6], 0U); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, in[ 7], 0U); \ + \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, in[ 8], 0U); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, in[ 9], 0U); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, in[10], 0U); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, in[11], 0U); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, in[12], 0U); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, in[13], 0U); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, in[14], 0U); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, in[15], 0U); \ + \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, in[16], 0U); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, in[17], 0U); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, in[18], 0U); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, in[19], 0U); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, in[20], 0U); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, in[21], 0U); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, in[22], 0U); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, in[23], 0U); \ + \ + STEP(n, 1, s7, s6, s5, s4, s3, s2, s1, s0, in[24], 0U); \ + STEP(n, 1, s6, s5, s4, s3, s2, s1, s0, s7, in[25], 0U); \ + STEP(n, 1, s5, s4, s3, s2, s1, s0, s7, s6, in[26], 0U); \ + STEP(n, 1, s4, s3, s2, s1, s0, s7, s6, s5, in[27], 0U); \ + STEP(n, 1, s3, s2, s1, s0, s7, s6, s5, s4, in[28], 0U); \ + STEP(n, 1, s2, s1, s0, s7, s6, s5, s4, s3, in[29], 0U); \ + STEP(n, 1, s1, s0, s7, s6, s5, s4, s3, s2, in[30], 0U); \ + STEP(n, 1, s0, s7, s6, s5, s4, s3, s2, s1, in[31], 0U); \ +} + +#define PASS2(n, in) { \ + STEP(n, 2, s7, s6, s5, s4, s3, s2, s1, s0, in[ 5], 0x452821E6); \ + STEP(n, 2, s6, s5, s4, s3, s2, s1, s0, s7, in[14], 0x38D01377); \ + STEP(n, 2, s5, s4, s3, s2, s1, s0, s7, s6, in[26], 0xBE5466CF); \ + STEP(n, 2, s4, s3, s2, s1, s0, s7, s6, s5, in[18], 0x34E90C6C); \ + STEP(n, 2, s3, s2, s1, s0, s7, s6, s5, s4, in[11], 0xC0AC29B7); \ + STEP(n, 2, s2, s1, s0, s7, s6, s5, s4, s3, in[28], 0xC97C50DD); \ + STEP(n, 2, s1, s0, s7, s6, s5, s4, s3, s2, in[ 7], 0x3F84D5B5); \ + STEP(n, 2, s0, s7, s6, s5, s4, s3, s2, s1, in[16], 0xB5470917); \ + \ + STEP(n, 2, s7, s6, s5, s4, s3, s2, s1, s0, in[ 0], 0x9216D5D9); \ + STEP(n, 2, s6, s5, s4, s3, s2, s1, s0, s7, in[23], 0x8979FB1B); \ + STEP(n, 2, s5, s4, s3, s2, s1, s0, s7, s6, in[20], 0xD1310BA6); \ + STEP(n, 2, s4, s3, s2, s1, s0, s7, s6, s5, in[22], 0x98DFB5AC); \ + STEP(n, 2, s3, s2, s1, s0, s7, s6, s5, s4, in[ 1], 0x2FFD72DB); \ + STEP(n, 2, s2, s1, s0, s7, s6, s5, s4, s3, in[10], 0xD01ADFB7); \ + STEP(n, 2, s1, s0, s7, s6, s5, s4, s3, s2, in[ 4], 0xB8E1AFED); \ + STEP(n, 2, s0, s7, s6, s5, s4, s3, s2, s1, in[ 8], 0x6A267E96); \ + \ + STEP(n, 2, s7, s6, s5, s4, s3, s2, s1, s0, in[30], 0xBA7C9045); \ + STEP(n, 2, s6, s5, s4, s3, s2, s1, s0, s7, in[ 3], 0xF12C7F99); \ + STEP(n, 2, s5, s4, s3, s2, s1, s0, s7, s6, in[21], 0x24A19947); \ + STEP(n, 2, s4, s3, s2, s1, s0, s7, s6, s5, in[ 9], 0xB3916CF7); \ + STEP(n, 2, s3, s2, s1, s0, s7, s6, s5, s4, in[17], 0x0801F2E2); \ + STEP(n, 2, s2, s1, s0, s7, s6, s5, s4, s3, in[24], 0x858EFC16); \ + STEP(n, 2, s1, s0, s7, s6, s5, s4, s3, s2, in[29], 0x636920D8); \ + STEP(n, 2, s0, s7, s6, s5, s4, s3, s2, s1, in[ 6], 0x71574E69); \ + \ + STEP(n, 2, s7, s6, s5, s4, s3, s2, s1, s0, in[19], 0xA458FEA3); \ + STEP(n, 2, s6, s5, s4, s3, s2, s1, s0, s7, in[12], 0xF4933D7E); \ + STEP(n, 2, s5, s4, s3, s2, s1, s0, s7, s6, in[15], 0x0D95748F); \ + STEP(n, 2, s4, s3, s2, s1, s0, s7, s6, s5, in[13], 0x728EB658); \ + STEP(n, 2, s3, s2, s1, s0, s7, s6, s5, s4, in[ 2], 0x718BCD58); \ + STEP(n, 2, s2, s1, s0, s7, s6, s5, s4, s3, in[25], 0x82154AEE); \ + STEP(n, 2, s1, s0, s7, s6, s5, s4, s3, s2, in[31], 0x7B54A41D); \ + STEP(n, 2, s0, s7, s6, s5, s4, s3, s2, s1, in[27], 0xC25A59B5); \ +} + +#define PASS3(n, in) { \ + STEP(n, 3, s7, s6, s5, s4, s3, s2, s1, s0, in[19], 0x9C30D539); \ + STEP(n, 3, s6, s5, s4, s3, s2, s1, s0, s7, in[ 9], 0x2AF26013); \ + STEP(n, 3, s5, s4, s3, s2, s1, s0, s7, s6, in[ 4], 0xC5D1B023); \ + STEP(n, 3, s4, s3, s2, s1, s0, s7, s6, s5, in[20], 0x286085F0); \ + STEP(n, 3, s3, s2, s1, s0, s7, s6, s5, s4, in[28], 0xCA417918); \ + STEP(n, 3, s2, s1, s0, s7, s6, s5, s4, s3, in[17], 0xB8DB38EF); \ + STEP(n, 3, s1, s0, s7, s6, s5, s4, s3, s2, in[ 8], 0x8E79DCB0); \ + STEP(n, 3, s0, s7, s6, s5, s4, s3, s2, s1, in[22], 0x603A180E); \ + \ + STEP(n, 3, s7, s6, s5, s4, s3, s2, s1, s0, in[29], 0x6C9E0E8B); \ + STEP(n, 3, s6, s5, s4, s3, s2, s1, s0, s7, in[14], 0xB01E8A3E); \ + STEP(n, 3, s5, s4, s3, s2, s1, s0, s7, s6, in[25], 0xD71577C1); \ + STEP(n, 3, s4, s3, s2, s1, s0, s7, s6, s5, in[12], 0xBD314B27); \ + STEP(n, 3, s3, s2, s1, s0, s7, s6, s5, s4, in[24], 0x78AF2FDA); \ + STEP(n, 3, s2, s1, s0, s7, s6, s5, s4, s3, in[30], 0x55605C60); \ + STEP(n, 3, s1, s0, s7, s6, s5, s4, s3, s2, in[16], 0xE65525F3); \ + STEP(n, 3, s0, s7, s6, s5, s4, s3, s2, s1, in[26], 0xAA55AB94); \ + \ + STEP(n, 3, s7, s6, s5, s4, s3, s2, s1, s0, in[31], 0x57489862); \ + STEP(n, 3, s6, s5, s4, s3, s2, s1, s0, s7, in[15], 0x63E81440); \ + STEP(n, 3, s5, s4, s3, s2, s1, s0, s7, s6, in[ 7], 0x55CA396A); \ + STEP(n, 3, s4, s3, s2, s1, s0, s7, s6, s5, in[ 3], 0x2AAB10B6); \ + STEP(n, 3, s3, s2, s1, s0, s7, s6, s5, s4, in[ 1], 0xB4CC5C34); \ + STEP(n, 3, s2, s1, s0, s7, s6, s5, s4, s3, in[ 0], 0x1141E8CE); \ + STEP(n, 3, s1, s0, s7, s6, s5, s4, s3, s2, in[18], 0xA15486AF); \ + STEP(n, 3, s0, s7, s6, s5, s4, s3, s2, s1, in[27], 0x7C72E993); \ + \ + STEP(n, 3, s7, s6, s5, s4, s3, s2, s1, s0, in[13], 0xB3EE1411); \ + STEP(n, 3, s6, s5, s4, s3, s2, s1, s0, s7, in[ 6], 0x636FBC2A); \ + STEP(n, 3, s5, s4, s3, s2, s1, s0, s7, s6, in[21], 0x2BA9C55D); \ + STEP(n, 3, s4, s3, s2, s1, s0, s7, s6, s5, in[10], 0x741831F6); \ + STEP(n, 3, s3, s2, s1, s0, s7, s6, s5, s4, in[23], 0xCE5C3E16); \ + STEP(n, 3, s2, s1, s0, s7, s6, s5, s4, s3, in[11], 0x9B87931E); \ + STEP(n, 3, s1, s0, s7, s6, s5, s4, s3, s2, in[ 5], 0xAFD6BA33); \ + STEP(n, 3, s0, s7, s6, s5, s4, s3, s2, s1, in[ 2], 0x6C24CF5C); \ +} + +#define PASS4(n, in) { \ + STEP(n, 4, s7, s6, s5, s4, s3, s2, s1, s0, in[24], 0x7A325381); \ + STEP(n, 4, s6, s5, s4, s3, s2, s1, s0, s7, in[ 4], 0x28958677); \ + STEP(n, 4, s5, s4, s3, s2, s1, s0, s7, s6, in[ 0], 0x3B8F4898); \ + STEP(n, 4, s4, s3, s2, s1, s0, s7, s6, s5, in[14], 0x6B4BB9AF); \ + STEP(n, 4, s3, s2, s1, s0, s7, s6, s5, s4, in[ 2], 0xC4BFE81B); \ + STEP(n, 4, s2, s1, s0, s7, s6, s5, s4, s3, in[ 7], 0x66282193); \ + STEP(n, 4, s1, s0, s7, s6, s5, s4, s3, s2, in[28], 0x61D809CC); \ + STEP(n, 4, s0, s7, s6, s5, s4, s3, s2, s1, in[23], 0xFB21A991); \ + \ + STEP(n, 4, s7, s6, s5, s4, s3, s2, s1, s0, in[26], 0x487CAC60); \ + STEP(n, 4, s6, s5, s4, s3, s2, s1, s0, s7, in[ 6], 0x5DEC8032); \ + STEP(n, 4, s5, s4, s3, s2, s1, s0, s7, s6, in[30], 0xEF845D5D); \ + STEP(n, 4, s4, s3, s2, s1, s0, s7, s6, s5, in[20], 0xE98575B1); \ + STEP(n, 4, s3, s2, s1, s0, s7, s6, s5, s4, in[18], 0xDC262302); \ + STEP(n, 4, s2, s1, s0, s7, s6, s5, s4, s3, in[25], 0xEB651B88); \ + STEP(n, 4, s1, s0, s7, s6, s5, s4, s3, s2, in[19], 0x23893E81); \ + STEP(n, 4, s0, s7, s6, s5, s4, s3, s2, s1, in[ 3], 0xD396ACC5); \ + \ + STEP(n, 4, s7, s6, s5, s4, s3, s2, s1, s0, in[22], 0x0F6D6FF3); \ + STEP(n, 4, s6, s5, s4, s3, s2, s1, s0, s7, in[11], 0x83F44239); \ + STEP(n, 4, s5, s4, s3, s2, s1, s0, s7, s6, in[31], 0x2E0B4482); \ + STEP(n, 4, s4, s3, s2, s1, s0, s7, s6, s5, in[21], 0xA4842004); \ + STEP(n, 4, s3, s2, s1, s0, s7, s6, s5, s4, in[ 8], 0x69C8F04A); \ + STEP(n, 4, s2, s1, s0, s7, s6, s5, s4, s3, in[27], 0x9E1F9B5E); \ + STEP(n, 4, s1, s0, s7, s6, s5, s4, s3, s2, in[12], 0x21C66842); \ + STEP(n, 4, s0, s7, s6, s5, s4, s3, s2, s1, in[ 9], 0xF6E96C9A); \ + \ + STEP(n, 4, s7, s6, s5, s4, s3, s2, s1, s0, in[ 1], 0x670C9C61); \ + STEP(n, 4, s6, s5, s4, s3, s2, s1, s0, s7, in[29], 0xABD388F0); \ + STEP(n, 4, s5, s4, s3, s2, s1, s0, s7, s6, in[ 5], 0x6A51A0D2); \ + STEP(n, 4, s4, s3, s2, s1, s0, s7, s6, s5, in[15], 0xD8542F68); \ + STEP(n, 4, s3, s2, s1, s0, s7, s6, s5, s4, in[17], 0x960FA728); \ + STEP(n, 4, s2, s1, s0, s7, s6, s5, s4, s3, in[10], 0xAB5133A3); \ + STEP(n, 4, s1, s0, s7, s6, s5, s4, s3, s2, in[16], 0x6EEF0B6C); \ + STEP(n, 4, s0, s7, s6, s5, s4, s3, s2, s1, in[13], 0x137A3BE4); \ +} + +#define PASS5(n, in) { \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in[27], 0xBA3BF050); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in[ 3], 0x7EFB2A98); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in[21], 0xA1F1651D); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in[26], 0x39AF0176); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in[17], 0x66CA593E); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in[11], 0x82430E88); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in[20], 0x8CEE8619); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in[29], 0x456F9FB4); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in[19], 0x7D84A5C3); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in[ 0], 0x3B8B5EBE); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in[12], 0xE06F75D8); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in[ 7], 0x85C12073); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in[13], 0x401A449F); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in[ 8], 0x56C16AA6); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in[31], 0x4ED3AA62); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in[10], 0x363F7706); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in[ 5], 0x1BFEDF72); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in[ 9], 0x429B023D); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in[14], 0x37D0D724); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in[30], 0xD00A1248); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in[18], 0xDB0FEAD3); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in[ 6], 0x49F1C09B); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in[28], 0x075372C9); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in[24], 0x80991B7B); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in[ 2], 0x25D479D8); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in[23], 0xF6E8DEF7); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in[16], 0xE3FE501A); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in[22], 0xB6794C3B); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in[ 4], 0x976CE0BD); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in[ 1], 0x04C006BA); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in[25], 0xC1A94FB6); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in[15], 0x409F60C4); \ +} + +#define PASS5_final(n, in) { \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in[27], 0xBA3BF050); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in[ 3], 0x7EFB2A98); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in[21], 0xA1F1651D); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in[26], 0x39AF0176); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in[17], 0x66CA593E); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in[11], 0x82430E88); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in[20], 0x8CEE8619); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in[29], 0x456F9FB4); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in[19], 0x7D84A5C3); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in[ 0], 0x3B8B5EBE); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in[12], 0xE06F75D8); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in[ 7], 0x85C12073); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in[13], 0x401A449F); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in[ 8], 0x56C16AA6); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in[31], 0x4ED3AA62); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in[10], 0x363F7706); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in[ 5], 0x1BFEDF72); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in[ 9], 0x429B023D); \ + STEP(n, 5, s5, s4, s3, s2, s1, s0, s7, s6, in[14], 0x37D0D724); \ + STEP(n, 5, s4, s3, s2, s1, s0, s7, s6, s5, in[30], 0xD00A1248); \ + STEP(n, 5, s3, s2, s1, s0, s7, s6, s5, s4, in[18], 0xDB0FEAD3); \ + STEP(n, 5, s2, s1, s0, s7, s6, s5, s4, s3, in[ 6], 0x49F1C09B); \ + STEP(n, 5, s1, s0, s7, s6, s5, s4, s3, s2, in[28], 0x075372C9); \ + STEP(n, 5, s0, s7, s6, s5, s4, s3, s2, s1, in[24], 0x80991B7B); \ + \ + STEP(n, 5, s7, s6, s5, s4, s3, s2, s1, s0, in[ 2], 0x25D479D8); \ + STEP(n, 5, s6, s5, s4, s3, s2, s1, s0, s7, in[23], 0xF6E8DEF7); \ +} + +__global__ __launch_bounds__(TPB, 4) +void x17_haval256_gpu_hash_64_final(const uint32_t threads,const uint64_t* __restrict__ g_hash,uint32_t* resNonce,const uint64_t target) +{ + uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + uint32_t s0, s1, s2, s3, s4, s5, s6, s7; + const uint32_t u0 = s0 = 0x243F6A88; + const uint32_t u1 = s1 = 0x85A308D3; + const uint32_t u2 = s2 = 0x13198A2E; + const uint32_t u3 = s3 = 0x03707344; + const uint32_t u4 = s4 = 0xA4093822; + const uint32_t u5 = s5 = 0x299F31D0; + const uint32_t u6 = s6 = 0x082EFA98; + const uint32_t u7 = s7 = 0xEC4E6C89; + + uint32_t buf[32]; + if (thread < threads) + { + const uint64_t *pHash = &g_hash[thread<<3]; + + #pragma unroll 8 + for(int i=0;i<8;i++){ + *(uint2*)&buf[i<<1] = __ldg((uint2*)&pHash[i]); + } + + buf[16] = 0x00000001; + + #pragma unroll + for (int i=17; i<29; i++) + buf[i] = 0; + + buf[29] = 0x40290000; + buf[30] = 0x00000200; + buf[31] = 0; + + PASS1(5, buf); + PASS2(5, buf); + PASS3(5, buf); + PASS4(5, buf); + PASS5_final(5, buf); + + buf[6] = s6 + u6; + buf[7] = s7 + u7; + + if(*(uint64_t*)&buf[ 6] <= target){ + uint32_t tmp = atomicExch(&resNonce[0], thread); + if (tmp != UINT32_MAX) + resNonce[1] = tmp; + } + } +} + +__host__ +void x17_haval256_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t *resNonce, uint64_t target) +{ + dim3 grid((threads + TPB-1)/TPB); + dim3 block(TPB); + + x17_haval256_gpu_hash_64_final <<>> (threads, (uint64_t*)d_hash,resNonce,target); +} diff --git a/x17/cuda_x17_sha512.cu b/x17/cuda_x17_sha512.cu new file mode 100644 index 0000000..4087bd3 --- /dev/null +++ b/x17/cuda_x17_sha512.cu @@ -0,0 +1,149 @@ +/* + * sha-512 cuda kernel implementation. + * + * ==========================(LICENSE BEGIN)============================ + * + * Copyright (c) 2014 djm34 + * 2016 tpruvot + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * ===========================(LICENSE END)============================= + */ +#include "cuda_helper.h" +#include "miner.h" +#include "cuda_vectors.h" + +#define SWAP64(u64) cuda_swab64(u64) + +static __constant__ uint64_t c_WB[80] = { + 0x428A2F98D728AE22, 0x7137449123EF65CD, 0xB5C0FBCFEC4D3B2F, 0xE9B5DBA58189DBBC, + 0x3956C25BF348B538, 0x59F111F1B605D019, 0x923F82A4AF194F9B, 0xAB1C5ED5DA6D8118, + 0xD807AA98A3030242, 0x12835B0145706FBE, 0x243185BE4EE4B28C, 0x550C7DC3D5FFB4E2, + 0x72BE5D74F27B896F, 0x80DEB1FE3B1696B1, 0x9BDC06A725C71235, 0xC19BF174CF692694, + 0xE49B69C19EF14AD2, 0xEFBE4786384F25E3, 0x0FC19DC68B8CD5B5, 0x240CA1CC77AC9C65, + 0x2DE92C6F592B0275, 0x4A7484AA6EA6E483, 0x5CB0A9DCBD41FBD4, 0x76F988DA831153B5, + 0x983E5152EE66DFAB, 0xA831C66D2DB43210, 0xB00327C898FB213F, 0xBF597FC7BEEF0EE4, + 0xC6E00BF33DA88FC2, 0xD5A79147930AA725, 0x06CA6351E003826F, 0x142929670A0E6E70, + 0x27B70A8546D22FFC, 0x2E1B21385C26C926, 0x4D2C6DFC5AC42AED, 0x53380D139D95B3DF, + 0x650A73548BAF63DE, 0x766A0ABB3C77B2A8, 0x81C2C92E47EDAEE6, 0x92722C851482353B, + 0xA2BFE8A14CF10364, 0xA81A664BBC423001, 0xC24B8B70D0F89791, 0xC76C51A30654BE30, + 0xD192E819D6EF5218, 0xD69906245565A910, 0xF40E35855771202A, 0x106AA07032BBD1B8, + 0x19A4C116B8D2D0C8, 0x1E376C085141AB53, 0x2748774CDF8EEB99, 0x34B0BCB5E19B48A8, + 0x391C0CB3C5C95A63, 0x4ED8AA4AE3418ACB, 0x5B9CCA4F7763E373, 0x682E6FF3D6B2B8A3, + 0x748F82EE5DEFB2FC, 0x78A5636F43172F60, 0x84C87814A1F0AB72, 0x8CC702081A6439EC, + 0x90BEFFFA23631E28, 0xA4506CEBDE82BDE9, 0xBEF9A3F7B2C67915, 0xC67178F2E372532B, + 0xCA273ECEEA26619C, 0xD186B8C721C0C207, 0xEADA7DD6CDE0EB1E, 0xF57D4F7FEE6ED178, + 0x06F067AA72176FBA, 0x0A637DC5A2C898A6, 0x113F9804BEF90DAE, 0x1B710B35131C471B, + 0x28DB77F523047D84, 0x32CAAB7B40C72493, 0x3C9EBE0A15C9BEBC, 0x431D67C49C100D4C, + 0x4CC5D4BECB3E42B6, 0x597F299CFC657E2A, 0x5FCB6FAB3AD6FAEC, 0x6C44198C4A475817 +}; + +#define BSG5_0(x) xor3(ROTR64(x,28), ROTR64(x,34), ROTR64(x,39)) +#define SSG5_0(x) xor3(ROTR64(x, 1), ROTR64(x ,8), shr_u64(x,7)) +#define SSG5_1(x) xor3(ROTR64(x,19), ROTR64(x,61), shr_u64(x,6)) + +#define MAJ(X, Y, Z) (((X) & (Y)) | (((X) | (Y)) & (Z))) +//#define MAJ(x, y, z) andor(x,y,z) + +__device__ __forceinline__ +uint64_t Tone(const uint64_t* K, uint64_t* r, uint64_t* W, const uint8_t a, const uint8_t i) +{ + //asm("// TONE \n"); + const uint64_t e = r[(a+4) & 7]; + const uint64_t BSG51 = xor3(ROTR64(e, 14), ROTR64(e, 18), ROTR64(e, 41)); + const uint64_t f = r[(a+5) & 7]; + const uint64_t g = r[(a+6) & 7]; + const uint64_t CHl = ((f ^ g) & e) ^ g; // xandx(e, f, g); + return (r[(a+7) & 7] + W[i] + BSG51 + CHl + K[i]); +} + +#define SHA3_STEP(K, r, W, ord, i) { \ + const int a = (8 - ord) & 7; \ + uint64_t T1 = Tone(K, r, W, a, i); \ + r[(a+3) & 7]+= T1; \ + r[(a+7) & 7] = T1 + (BSG5_0(r[a]) + MAJ(r[a], r[(a+1) & 7], r[(a+2) & 7])); \ +} + +__global__ +__launch_bounds__(256, 4) +void x17_sha512_gpu_hash_64(const uint32_t threads, uint64_t *g_hash){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + const uint64_t IV512[8] = { + 0x6A09E667F3BCC908, 0xBB67AE8584CAA73B, 0x3C6EF372FE94F82B, 0xA54FF53A5F1D36F1, + 0x510E527FADE682D1, 0x9B05688C2B3E6C1F, 0x1F83D9ABFB41BD6B, 0x5BE0CD19137E2179 + }; + uint64_t r[8]; + uint64_t W[80]; + if (thread < threads){ + + uint64_t *pHash = &g_hash[thread<<3]; + + *(uint2x4*)&W[ 0] = *(uint2x4*)&pHash[ 0]; + *(uint2x4*)&W[ 4] = *(uint2x4*)&pHash[ 4]; + + #pragma unroll + for (int i = 0; i < 8; i ++) { + W[i] = cuda_swab64(W[i]); + } + W[8] = 0x8000000000000000; + + #pragma unroll + for (int i = 9; i<15; i++) { + W[i] = 0U; + } + W[15] = 0x0000000000000200; + + #pragma unroll 64 + for (int i = 16; i < 80; i++) { + W[i] = W[i-7] + W[i-16] + SSG5_0(W[i-15]) + SSG5_1(W[i-2]); + } + + *(uint2x4*)&r[ 0] = *(uint2x4*)&IV512[0]; + *(uint2x4*)&r[ 4] = *(uint2x4*)&IV512[4]; + + #pragma unroll 80 + for (int i = 0; i < 80; i ++){ + SHA3_STEP(c_WB, r, W, i&7, i); + } + + #pragma unroll + for (int u = 0; u < 8; u ++) { + r[u] = cuda_swab64(r[u] + IV512[u]); + } + + *(uint2x4*)&pHash[ 0] = *(uint2x4*)&r[ 0]; + *(uint2x4*)&pHash[ 4] = *(uint2x4*)&r[ 4]; + + } +} + +__host__ +void x17_sha512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash) +{ + const uint32_t threadsperblock = 256; + + dim3 grid((threads + threadsperblock-1)/threadsperblock); + dim3 block(threadsperblock); + + x17_sha512_gpu_hash_64 <<>> (threads, (uint64_t*)d_hash); + +} diff --git a/x17/x17.cu b/x17/x17.cu new file mode 100644 index 0000000..93cd182 --- /dev/null +++ b/x17/x17.cu @@ -0,0 +1,289 @@ +/** + * X17 algorithm (X15 + sha512 + haval256) + */ + +extern "C" { +#include "sph/sph_blake.h" +#include "sph/sph_bmw.h" +#include "sph/sph_groestl.h" +#include "sph/sph_skein.h" +#include "sph/sph_jh.h" +#include "sph/sph_keccak.h" + +#include "sph/sph_luffa.h" +#include "sph/sph_cubehash.h" +#include "sph/sph_shavite.h" +#include "sph/sph_simd.h" +#include "sph/sph_echo.h" + +#include "sph/sph_hamsi.h" +#include "sph/sph_fugue.h" + +#include "sph/sph_shabal.h" +#include "sph/sph_whirlpool.h" + +#include "sph/sph_sha2.h" +#include "sph/sph_haval.h" +} + +#include "miner.h" +#include "cuda_helper.h" +#include "x11/cuda_x11.h" + +#define NBN 2 + +// Memory for the hash functions +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +extern void x13_hamsi_fugue512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void x14_shabal512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void x15_whirlpool_cpu_init(int thr_id, uint32_t threads, int mode); +extern void x15_whirlpool_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); +extern void x15_whirlpool_cpu_free(int thr_id); + +extern void x17_sha512_cpu_hash_64(int thr_id, uint32_t threads, uint32_t *d_hash); + +extern void x17_haval256_cpu_hash_64_final(int thr_id, uint32_t threads, uint32_t *d_hash, uint32_t* resNonce, uint64_t target); + + +// X17 CPU Hash (Validation) +extern "C" void x17hash(void *output, const void *input) +{ + unsigned char _ALIGN(64) hash[128]; + + // x11 + hamsi12-fugue13-shabal14-whirlpool15-sha512-haval256 + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_skein512_context ctx_skein; + sph_luffa512_context ctx_luffa; + sph_cubehash512_context ctx_cubehash; + sph_shavite512_context ctx_shavite; + sph_simd512_context ctx_simd; + sph_echo512_context ctx_echo; + sph_hamsi512_context ctx_hamsi; + sph_fugue512_context ctx_fugue; + sph_shabal512_context ctx_shabal; + sph_whirlpool_context ctx_whirlpool; + sph_sha512_context ctx_sha512; + sph_haval256_5_context ctx_haval; + + + sph_blake512_init(&ctx_blake); + sph_blake512(&ctx_blake, input, 80); + sph_blake512_close(&ctx_blake, hash); + + sph_bmw512_init(&ctx_bmw); + sph_bmw512(&ctx_bmw, (const void*) hash, 64); + sph_bmw512_close(&ctx_bmw, hash); + + sph_groestl512_init(&ctx_groestl); + sph_groestl512(&ctx_groestl, (const void*) hash, 64); + sph_groestl512_close(&ctx_groestl, hash); + + sph_skein512_init(&ctx_skein); + sph_skein512(&ctx_skein, (const void*) hash, 64); + sph_skein512_close(&ctx_skein, hash); + + sph_jh512_init(&ctx_jh); + sph_jh512(&ctx_jh, (const void*) hash, 64); + sph_jh512_close(&ctx_jh, hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512(&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, hash); + + sph_luffa512_init(&ctx_luffa); + sph_luffa512(&ctx_luffa, (const void*) hash, 64); + sph_luffa512_close (&ctx_luffa, hash); + + sph_cubehash512_init(&ctx_cubehash); + sph_cubehash512(&ctx_cubehash, (const void*) hash, 64); + sph_cubehash512_close(&ctx_cubehash, hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512(&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, hash); + + sph_simd512_init(&ctx_simd); + sph_simd512(&ctx_simd, (const void*) hash, 64); + sph_simd512_close(&ctx_simd, hash); + + sph_echo512_init(&ctx_echo); + sph_echo512(&ctx_echo, (const void*) hash, 64); + sph_echo512_close(&ctx_echo, hash); + + sph_hamsi512_init(&ctx_hamsi); + sph_hamsi512(&ctx_hamsi, (const void*) hash, 64); + sph_hamsi512_close(&ctx_hamsi, hash); + + sph_fugue512_init(&ctx_fugue); + sph_fugue512(&ctx_fugue, (const void*) hash, 64); + sph_fugue512_close(&ctx_fugue, hash); + + sph_shabal512_init(&ctx_shabal); + sph_shabal512(&ctx_shabal, (const void*) hash, 64); + sph_shabal512_close(&ctx_shabal, hash); + + sph_whirlpool_init(&ctx_whirlpool); + sph_whirlpool (&ctx_whirlpool, (const void*) hash, 64); + sph_whirlpool_close(&ctx_whirlpool, hash); + + sph_sha512_init(&ctx_sha512); + sph_sha512(&ctx_sha512,(const void*) hash, 64); + sph_sha512_close(&ctx_sha512,(void*) hash); + + sph_haval256_5_init(&ctx_haval); + sph_haval256_5(&ctx_haval,(const void*) hash, 64); + sph_haval256_5_close(&ctx_haval,hash); + + memcpy(output, hash, 32); +} + +static bool init[MAX_GPUS] = { 0 }; + +extern "C" int scanhash_x17(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + int dev_id = device_map[thr_id]; + + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; +/* + uint32_t default_throughput = 1<<20; + + if (strstr(device_name[dev_id], "GTX 970")) default_throughput+=256*256*6; + if (strstr(device_name[dev_id], "GTX 980")) default_throughput =1<<22; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; +*/ + uint32_t default_throughput; + if(device_sm[dev_id]<=500) default_throughput = 1<<20; + else if(device_sm[dev_id]<=520) default_throughput = 1<<21; + else if(device_sm[dev_id]>520) default_throughput = (1<<22) + (1<<21); + + if((strstr(device_name[dev_id], "3GB")))default_throughput = 1<<21; + if((strstr(device_name[dev_id], "6GB")))default_throughput = 1<<22; + + uint32_t throughput = cuda_default_throughput(thr_id, default_throughput); // 19=256*256*8; + if (init[thr_id]) throughput = min(throughput, max_nonce - first_nonce); + + throughput&=0xFFFFFF70; //multiples of 128 due to simd_echo kernel + + if (opt_benchmark) + ((uint32_t*)ptarget)[7] = 0x00ff; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferShared); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + x11_simd_echo_512_cpu_init(thr_id, throughput); + x15_whirlpool_cpu_init(thr_id, throughput, 0); + + CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 8 * sizeof(uint64_t) * throughput)); + CUDA_SAFE_CALL(cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t))); + h_resNonce[thr_id] = (uint32_t*) malloc(NBN * sizeof(uint32_t)); + if(h_resNonce[thr_id] == NULL){ + gpulog(LOG_ERR,thr_id,"Host memory allocation failed"); + exit(EXIT_FAILURE); + } + init[thr_id] = true; + } + + uint32_t _ALIGN(64) endiandata[20]; + for (int k=0; k < 20; k++) + be32enc(&endiandata[k], pdata[k]); + + quark_blake512_cpu_setBlock_80(thr_id, endiandata); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + + do { + // Hash with CUDA + quark_blake512_cpu_hash_80(thr_id, throughput, pdata[19], d_hash[thr_id]); + quark_bmw512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_groestl512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_skein512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_jh512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + quark_keccak512_cpu_hash_64(thr_id, throughput, NULL, d_hash[thr_id]); + x11_luffa512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_cubehash_shavite512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x11_simd_echo512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x13_hamsi_fugue512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x14_shabal512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x15_whirlpool_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x17_sha512_cpu_hash_64(thr_id, throughput, d_hash[thr_id]); + x17_haval256_cpu_hash_64_final(thr_id, throughput, d_hash[thr_id],d_resNonce[thr_id],*(uint64_t*)&ptarget[6]); + + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + + if (h_resNonce[thr_id][0] != UINT32_MAX){ + const uint32_t Htarg = ptarget[7]; + const uint32_t startNounce = pdata[19]; + uint32_t vhash64[8]; + be32enc(&endiandata[19], startNounce + h_resNonce[thr_id][0]); + x17hash(vhash64, endiandata); + + if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { + int res = 1; + *hashes_done = pdata[19] - first_nonce + throughput + 1; + work_set_target_ratio(work, vhash64); + pdata[19] = startNounce + h_resNonce[thr_id][0]; + if (h_resNonce[thr_id][1] != UINT32_MAX) { + pdata[21] = startNounce+h_resNonce[thr_id][1]; +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", pdata[21]); + be32enc(&endiandata[19], pdata[21]); + x17hash(vhash64, endiandata); + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + res++; + } + return res; + } + else { + gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", h_resNonce[thr_id][0]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + + pdata[19] += throughput; + } while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > (uint64_t)throughput + pdata[19])); + + *hashes_done = pdata[19] - first_nonce + 1; + + return 0; +} + +// cleanup +extern "C" void free_x17(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + free(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + cudaFree(d_hash[thr_id]); + + x11_simd_echo_512_cpu_free(thr_id); + x15_whirlpool_cpu_free(thr_id); + cudaDeviceSynchronize(); + init[thr_id] = false; +} diff --git a/yescrypt/cuda_yescrypt.cu b/yescrypt/cuda_yescrypt.cu new file mode 100644 index 0000000..826cf46 --- /dev/null +++ b/yescrypt/cuda_yescrypt.cu @@ -0,0 +1,911 @@ +#include +#include +#include "miner.h" +#include "cuda_helper.h" +#include "cuda_vectors.h" + +__device__ ulonglong8to16 *state2; +uint32_t *d_YNonce[MAX_GPUS]; +__constant__ uint32_t pTarget[8]; +__constant__ uint32_t c_data[32]; +__constant__ uint16 shapad; + +static uint32_t *d_hash[MAX_GPUS]; +static uint8* d_hash2[MAX_GPUS]; +static uint32* d_hash3[MAX_GPUS]; +static uint32* d_hash4[MAX_GPUS]; + +#define xor3b(a,b,c) (a^b^c) +#define andor32(x, y, z) ((x & (y | z)) | (y & z)) +#define xandx(a, b, c) (((b^c) & a) ^ c) + +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define Ch(a, b, c) (((b^c) & a) ^ c) + +static __device__ __forceinline__ void madd4long2(ulonglong2 &a, ulonglong2 b){ + + asm ("{\n\t" + ".reg .u32 a0,a1,a2,a3,b0,b1,b2,b3;\n\t" + "mov.b64 {a0,a1}, %0;\n\t" + "mov.b64 {a2,a3}, %1;\n\t" + "mov.b64 {b0,b1}, %2;\n\t" + "mov.b64 {b2,b3}, %3;\n\t" + "mad.lo.cc.u32 b0,a0,a1,b0; \n\t" + "madc.hi.u32 b1,a0,a1,b1; \n\t" + "mad.lo.cc.u32 b2,a2,a3,b2; \n\t" + "madc.hi.u32 b3,a2,a3,b3; \n\t" + "mov.b64 %0, {b0,b1};\n\t" + "mov.b64 %1, {b2,b3};\n\t" + "}\n\t" + : "+l"(a.x), "+l"(a.y) : "l"(b.x), "l"(b.y)); + +} + +static __device__ __forceinline__ ulonglong2 __ldg2(const ulonglong2 *ptr){ + + ulonglong2 ret; + asm("ld.global.nc.v2.u64 {%0,%1}, [%2];" : "=l"(ret.x), "=l"(ret.y) : __LDG_PTR(ptr)); + return ret; +} + +static __device__ __forceinline__ uint32 __ldg32b(const uint32 *ptr) +{ + uint32 ret; + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4];" : "=r"(ret.lo.s0), "=r"(ret.lo.s1), "=r"(ret.lo.s2), "=r"(ret.lo.s3) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+16];" : "=r"(ret.lo.s4), "=r"(ret.lo.s5), "=r"(ret.lo.s6), "=r"(ret.lo.s7) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+32];" : "=r"(ret.lo.s8), "=r"(ret.lo.s9), "=r"(ret.lo.sa), "=r"(ret.lo.sb) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+48];" : "=r"(ret.lo.sc), "=r"(ret.lo.sd), "=r"(ret.lo.se), "=r"(ret.lo.sf) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+64];" : "=r"(ret.hi.s0), "=r"(ret.hi.s1), "=r"(ret.hi.s2), "=r"(ret.hi.s3) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+80];" : "=r"(ret.hi.s4), "=r"(ret.hi.s5), "=r"(ret.hi.s6), "=r"(ret.hi.s7) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+96];" : "=r"(ret.hi.s8), "=r"(ret.hi.s9), "=r"(ret.hi.sa), "=r"(ret.hi.sb) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+112];" : "=r"(ret.hi.sc), "=r"(ret.hi.sd), "=r"(ret.hi.se), "=r"(ret.hi.sf) : __LDG_PTR(ptr)); + return ret; +} + +static __device__ __forceinline__ uint16 __ldg16b(const uint16 *ptr) +{ + uint16 ret; + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4];" : "=r"(ret.s0), "=r"(ret.s1), "=r"(ret.s2), "=r"(ret.s3) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+16];" : "=r"(ret.s4), "=r"(ret.s5), "=r"(ret.s6), "=r"(ret.s7) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+32];" : "=r"(ret.s8), "=r"(ret.s9), "=r"(ret.sa), "=r"(ret.sb) : __LDG_PTR(ptr)); + asm("ld.global.nc.v4.u32 {%0,%1,%2,%3}, [%4+48];" : "=r"(ret.sc), "=r"(ret.sd), "=r"(ret.se), "=r"(ret.sf) : __LDG_PTR(ptr)); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////// sha256 Transform function ///////////////////////// + + +static __constant__ const uint16 pad1 = +{ + 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636, 0x36363636 +}; +static __constant__ const uint16 pad2 = +{ + 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c, 0x5c5c5c5c +}; +static __constant__ const uint16 pad5 = +{ + 0x00000001, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00002220 +}; +static __constant__ const uint16 padsha80 = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000280 +}; + +static __constant__ const uint8 pad4 = +{ + 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300 +}; + +static __constant__ const uint8 H256 = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 +}; + +__constant__ static uint32_t _ALIGN(16) Ksha[64] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +}; + +__device__ __forceinline__ +static uint32_t bsg2_0(const uint32_t x){ + return xor3b(ROTR32(x, 2), ROTR32(x, 13), ROTR32(x, 22)); +} +__device__ __forceinline__ +static uint32_t bsg2_1(const uint32_t x){ + return xor3b(ROTR32(x, 6), ROTR32(x, 11), ROTR32(x, 25)); +} +__device__ __forceinline__ +static uint32_t ssg2_0(const uint32_t x){ + return xor3b(ROTR32(x, 7), ROTR32(x, 18), shr_u32(x, 3)); +} +__device__ __forceinline__ +static uint32_t ssg2_1(const uint32_t x){ + return xor3b(ROTR32(x, 17), ROTR32(x, 19), shr_u32(x, 10)); +} + +__device__ __forceinline__ +static void sha2_step1(const uint32_t a, const uint32_t b, const uint32_t c, uint32_t &d, const uint32_t e, const uint32_t f, const uint32_t g, uint32_t &h, const uint32_t in, const uint32_t Kshared){ + const uint32_t t1 = h + bsg2_1(e) + Ch(e, f, g) + Kshared + in; + h = t1 + bsg2_0(a) + Maj(a, b, c); + d+= t1; +} + +__device__ __forceinline__ +static void sha2_step2(const uint32_t a, const uint32_t b, const uint32_t c, uint32_t &d, const uint32_t e,const uint32_t f, const uint32_t g, uint32_t &h, uint32_t* in, const uint32_t pc, const uint32_t Kshared){ + uint32_t t1, t2; + + int pcidx1 = (pc - 2) & 0xF; + int pcidx2 = (pc - 7) & 0xF; + int pcidx3 = (pc - 15) & 0xF; + uint32_t inx0 = in[pc]; + uint32_t inx1 = in[pcidx1]; + uint32_t inx2 = in[pcidx2]; + uint32_t inx3 = in[pcidx3]; + + uint32_t ssg21 = ssg2_1(inx1); + uint32_t ssg20 = ssg2_0(inx3); + uint32_t vxandx = xandx(e, f, g); + uint32_t bsg21 = bsg2_1(e); + uint32_t bsg20 = bsg2_0(a); + uint32_t andorv = andor32(a, b, c); + + in[pc] = ssg21 + inx2 + ssg20 + inx0; + + t1 = h + bsg21 + vxandx + Kshared + in[pc]; + t2 = bsg20 + andorv; + d = d + t1; + h = t1 + t2; +} + + + +#define SALSA(a,b,c,d) { \ + b^=ROTL32(a+d, 7); \ + c^=ROTL32(a+b, 9); \ + d^=ROTL32(b+c, 13); \ + a^=ROTL32(d+c, 18); \ +} + +#define SALSA_CORE(state) { \ +\ +SALSA(state.s0,state.s4,state.s8,state.sc); \ +SALSA(state.s5,state.s9,state.sd,state.s1); \ +SALSA(state.sa,state.se,state.s2,state.s6); \ +SALSA(state.sf,state.s3,state.s7,state.sb); \ +SALSA(state.s0,state.s1,state.s2,state.s3); \ +SALSA(state.s5,state.s6,state.s7,state.s4); \ +SALSA(state.sa,state.sb,state.s8,state.s9); \ +SALSA(state.sf,state.sc,state.sd,state.se); \ +} + +#define uSALSA_CORE(state) { \ +\ +SALSA(state.s0,state.s4,state.s8,state.sc); \ +SALSA(state.s1,state.s5,state.s9,state.sd); \ +SALSA(state.s2,state.s6,state.sa,state.se); \ +SALSA(state.s3,state.s7,state.sb,state.sf); \ +SALSA(state.s0,state.sd,state.sa,state.s7); \ +SALSA(state.s1,state.se,state.sb,state.s4); \ +SALSA(state.s2,state.sf,state.s8,state.s5); \ +SALSA(state.s3,state.sc,state.s9,state.s6); \ +} + + +#define shuffle(stat,state) { \ +stat.s0 = state.s0; \ +stat.s1 = state.s5; \ +stat.s2 = state.sa; \ +stat.s3 = state.sf; \ +stat.s4 = state.s4; \ +stat.s5 = state.s9; \ +stat.s6 = state.se; \ +stat.s7 = state.s3; \ +stat.s8 = state.s8; \ +stat.s9 = state.sd; \ +stat.sa = state.s2; \ +stat.sb = state.s7; \ +stat.sc = state.sc; \ +stat.sd = state.s1; \ +stat.se = state.s6; \ +stat.sf = state.sb; \ +} +#define unshuffle(state,X) { \ + state.s0 = X.s0; \ + state.s1 = X.sd; \ + state.s2 = X.sa; \ + state.s3 = X.s7; \ + state.s4 = X.s4; \ + state.s5 = X.s1; \ + state.s6 = X.se; \ + state.s7 = X.sb; \ + state.s8 = X.s8; \ + state.s9 = X.s5; \ + state.sa = X.s2; \ + state.sb = X.sf; \ + state.sc = X.sc; \ + state.sd = X.s9; \ + state.se = X.s6; \ + state.sf = X.s3; \ +} + +__device__ __forceinline__ +static void sha256_Transform(uint32_t* in, uint32_t *state){ // also known as sha2_round_body + uint32_t a = state[0]; + uint32_t b = state[1]; + uint32_t c = state[2]; + uint32_t d = state[3]; + uint32_t e = state[4]; + uint32_t f = state[5]; + uint32_t g = state[6]; + uint32_t h = state[7]; + + sha2_step1(a, b, c, d, e, f, g, h, in[ 0], Ksha[0]); + sha2_step1(h, a, b, c, d, e, f, g, in[ 1], Ksha[1]); + sha2_step1(g, h, a, b, c, d, e, f, in[ 2], Ksha[2]); + sha2_step1(f, g, h, a, b, c, d, e, in[ 3], Ksha[3]); + sha2_step1(e, f, g, h, a, b, c, d, in[ 4], Ksha[4]); + sha2_step1(d, e, f, g, h, a, b, c, in[ 5], Ksha[5]); + sha2_step1(c, d, e, f, g, h, a, b, in[ 6], Ksha[6]); + sha2_step1(b, c, d, e, f, g, h, a, in[ 7], Ksha[7]); + sha2_step1(a, b, c, d, e, f, g, h, in[ 8], Ksha[8]); + sha2_step1(h, a, b, c, d, e, f, g, in[ 9], Ksha[9]); + sha2_step1(g, h, a, b, c, d, e, f, in[10], Ksha[10]); + sha2_step1(f, g, h, a, b, c, d, e, in[11], Ksha[11]); + sha2_step1(e, f, g, h, a, b, c, d, in[12], Ksha[12]); + sha2_step1(d, e, f, g, h, a, b, c, in[13], Ksha[13]); + sha2_step1(c, d, e, f, g, h, a, b, in[14], Ksha[14]); + sha2_step1(b, c, d, e, f, g, h, a, in[15], Ksha[15]); + +#pragma unroll 3 + for (uint32_t i = 0; i<3; i++) { + + sha2_step2(a, b, c, d, e, f, g, h, in, 0, Ksha[16 + 16 * i]); + sha2_step2(h, a, b, c, d, e, f, g, in, 1, Ksha[17 + 16 * i]); + sha2_step2(g, h, a, b, c, d, e, f, in, 2, Ksha[18 + 16 * i]); + sha2_step2(f, g, h, a, b, c, d, e, in, 3, Ksha[19 + 16 * i]); + sha2_step2(e, f, g, h, a, b, c, d, in, 4, Ksha[20 + 16 * i]); + sha2_step2(d, e, f, g, h, a, b, c, in, 5, Ksha[21 + 16 * i]); + sha2_step2(c, d, e, f, g, h, a, b, in, 6, Ksha[22 + 16 * i]); + sha2_step2(b, c, d, e, f, g, h, a, in, 7, Ksha[23 + 16 * i]); + sha2_step2(a, b, c, d, e, f, g, h, in, 8, Ksha[24 + 16 * i]); + sha2_step2(h, a, b, c, d, e, f, g, in, 9, Ksha[25 + 16 * i]); + sha2_step2(g, h, a, b, c, d, e, f, in, 10, Ksha[26 + 16 * i]); + sha2_step2(f, g, h, a, b, c, d, e, in, 11, Ksha[27 + 16 * i]); + sha2_step2(e, f, g, h, a, b, c, d, in, 12, Ksha[28 + 16 * i]); + sha2_step2(d, e, f, g, h, a, b, c, in, 13, Ksha[29 + 16 * i]); + sha2_step2(c, d, e, f, g, h, a, b, in, 14, Ksha[30 + 16 * i]); + sha2_step2(b, c, d, e, f, g, h, a, in, 15, Ksha[31 + 16 * i]); + + } + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; +} + +__device__ __forceinline__ +static uint8 sha256_Transform2(uint16 in[1], const uint8 &r){ // also known as sha2_round_body + + uint8 tmp = r; +#define a tmp.s0 +#define b tmp.s1 +#define c tmp.s2 +#define d tmp.s3 +#define e tmp.s4 +#define f tmp.s5 +#define g tmp.s6 +#define h tmp.s7 + + sha2_step1(a, b, c, d, e, f, g, h, in[0].s0, Ksha[0]); + sha2_step1(h, a, b, c, d, e, f, g, in[0].s1, Ksha[1]); + sha2_step1(g, h, a, b, c, d, e, f, in[0].s2, Ksha[2]); + sha2_step1(f, g, h, a, b, c, d, e, in[0].s3, Ksha[3]); + sha2_step1(e, f, g, h, a, b, c, d, in[0].s4, Ksha[4]); + sha2_step1(d, e, f, g, h, a, b, c, in[0].s5, Ksha[5]); + sha2_step1(c, d, e, f, g, h, a, b, in[0].s6, Ksha[6]); + sha2_step1(b, c, d, e, f, g, h, a, in[0].s7, Ksha[7]); + sha2_step1(a, b, c, d, e, f, g, h, in[0].s8, Ksha[8]); + sha2_step1(h, a, b, c, d, e, f, g, in[0].s9, Ksha[9]); + sha2_step1(g, h, a, b, c, d, e, f, in[0].sa, Ksha[10]); + sha2_step1(f, g, h, a, b, c, d, e, in[0].sb, Ksha[11]); + sha2_step1(e, f, g, h, a, b, c, d, in[0].sc, Ksha[12]); + sha2_step1(d, e, f, g, h, a, b, c, in[0].sd, Ksha[13]); + sha2_step1(c, d, e, f, g, h, a, b, in[0].se, Ksha[14]); + sha2_step1(b, c, d, e, f, g, h, a, in[0].sf, Ksha[15]); + + #pragma unroll 3 + for (uint32_t i = 0; i<3; i++) { + + sha2_step2(a, b, c, d, e, f, g, h, (uint32_t*)in, 0, Ksha[16 + 16 * i]); + sha2_step2(h, a, b, c, d, e, f, g, (uint32_t*)in, 1, Ksha[17 + 16 * i]); + sha2_step2(g, h, a, b, c, d, e, f, (uint32_t*)in, 2, Ksha[18 + 16 * i]); + sha2_step2(f, g, h, a, b, c, d, e, (uint32_t*)in, 3, Ksha[19 + 16 * i]); + sha2_step2(e, f, g, h, a, b, c, d, (uint32_t*)in, 4, Ksha[20 + 16 * i]); + sha2_step2(d, e, f, g, h, a, b, c, (uint32_t*)in, 5, Ksha[21 + 16 * i]); + sha2_step2(c, d, e, f, g, h, a, b, (uint32_t*)in, 6, Ksha[22 + 16 * i]); + sha2_step2(b, c, d, e, f, g, h, a, (uint32_t*)in, 7, Ksha[23 + 16 * i]); + sha2_step2(a, b, c, d, e, f, g, h, (uint32_t*)in, 8, Ksha[24 + 16 * i]); + sha2_step2(h, a, b, c, d, e, f, g, (uint32_t*)in, 9, Ksha[25 + 16 * i]); + sha2_step2(g, h, a, b, c, d, e, f, (uint32_t*)in, 10, Ksha[26 + 16 * i]); + sha2_step2(f, g, h, a, b, c, d, e, (uint32_t*)in, 11, Ksha[27 + 16 * i]); + sha2_step2(e, f, g, h, a, b, c, d, (uint32_t*)in, 12, Ksha[28 + 16 * i]); + sha2_step2(d, e, f, g, h, a, b, c, (uint32_t*)in, 13, Ksha[29 + 16 * i]); + sha2_step2(c, d, e, f, g, h, a, b, (uint32_t*)in, 14, Ksha[30 + 16 * i]); + sha2_step2(b, c, d, e, f, g, h, a, (uint32_t*)in, 15, Ksha[31 + 16 * i]); + + } +#undef a +#undef b +#undef c +#undef d +#undef e +#undef f + return (r + tmp); +} + + +__device__ __forceinline__ +static uint8 sha256_Transform3(uint32_t nonce,uint32_t next, const uint8 &r){ // also known as sha2_round_body + + uint8 tmp = r; + uint16 in[1]={shapad}; + in[0].s3=nonce; + in[0].s4=next; +#define a tmp.s0 +#define b tmp.s1 +#define c tmp.s2 +#define d tmp.s3 +#define e tmp.s4 +#define f tmp.s5 +#define g tmp.s6 +#define h tmp.s7 + + sha2_step1(a, b, c, d, e, f, g, h, in[0].s0, Ksha[0]); + sha2_step1(h, a, b, c, d, e, f, g, in[0].s1, Ksha[1]); + sha2_step1(g, h, a, b, c, d, e, f, in[0].s2, Ksha[2]); + sha2_step1(f, g, h, a, b, c, d, e, in[0].s3, Ksha[3]); + sha2_step1(e, f, g, h, a, b, c, d, in[0].s4, Ksha[4]); + sha2_step1(d, e, f, g, h, a, b, c, in[0].s5, Ksha[5]); + sha2_step1(c, d, e, f, g, h, a, b, in[0].s6, Ksha[6]); + sha2_step1(b, c, d, e, f, g, h, a, in[0].s7, Ksha[7]); + sha2_step1(a, b, c, d, e, f, g, h, in[0].s8, Ksha[8]); + sha2_step1(h, a, b, c, d, e, f, g, in[0].s9, Ksha[9]); + sha2_step1(g, h, a, b, c, d, e, f, in[0].sa, Ksha[10]); + sha2_step1(f, g, h, a, b, c, d, e, in[0].sb, Ksha[11]); + sha2_step1(e, f, g, h, a, b, c, d, in[0].sc, Ksha[12]); + sha2_step1(d, e, f, g, h, a, b, c, in[0].sd, Ksha[13]); + sha2_step1(c, d, e, f, g, h, a, b, in[0].se, Ksha[14]); + sha2_step1(b, c, d, e, f, g, h, a, in[0].sf, Ksha[15]); + +#pragma unroll 3 + for (uint32_t i = 0; i<3; i++) { + + sha2_step2(a, b, c, d, e, f, g, h, (uint32_t*)in, 0, Ksha[16 + 16 * i]); + sha2_step2(h, a, b, c, d, e, f, g, (uint32_t*)in, 1, Ksha[17 + 16 * i]); + sha2_step2(g, h, a, b, c, d, e, f, (uint32_t*)in, 2, Ksha[18 + 16 * i]); + sha2_step2(f, g, h, a, b, c, d, e, (uint32_t*)in, 3, Ksha[19 + 16 * i]); + sha2_step2(e, f, g, h, a, b, c, d, (uint32_t*)in, 4, Ksha[20 + 16 * i]); + sha2_step2(d, e, f, g, h, a, b, c, (uint32_t*)in, 5, Ksha[21 + 16 * i]); + sha2_step2(c, d, e, f, g, h, a, b, (uint32_t*)in, 6, Ksha[22 + 16 * i]); + sha2_step2(b, c, d, e, f, g, h, a, (uint32_t*)in, 7, Ksha[23 + 16 * i]); + sha2_step2(a, b, c, d, e, f, g, h, (uint32_t*)in, 8, Ksha[24 + 16 * i]); + sha2_step2(h, a, b, c, d, e, f, g, (uint32_t*)in, 9, Ksha[25 + 16 * i]); + sha2_step2(g, h, a, b, c, d, e, f, (uint32_t*)in, 10, Ksha[26 + 16 * i]); + sha2_step2(f, g, h, a, b, c, d, e, (uint32_t*)in, 11, Ksha[27 + 16 * i]); + sha2_step2(e, f, g, h, a, b, c, d, (uint32_t*)in, 12, Ksha[28 + 16 * i]); + sha2_step2(d, e, f, g, h, a, b, c, (uint32_t*)in, 13, Ksha[29 + 16 * i]); + sha2_step2(c, d, e, f, g, h, a, b, (uint32_t*)in, 14, Ksha[30 + 16 * i]); + sha2_step2(b, c, d, e, f, g, h, a, (uint32_t*)in, 15, Ksha[31 + 16 * i]); + + } +#undef a +#undef b +#undef c +#undef d +#undef e +#undef f + return (r + tmp); +} + +//////////////////////////////// end sha transform mechanism //////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////// + +__device__ __forceinline__ +static uint16 salsa20_8(const uint16 &X){ + uint16 state=X; + + #pragma unroll 4 + for (uint32_t i = 0; i < 4; ++i) + uSALSA_CORE(state); + + return(X + state); +} + +__device__ __forceinline__ +static void block_pwxform_long(int thread, ulonglong2to8 *const __restrict__ Bout,uint32 *const __restrict__ prevstate){ + + ulonglong2 vec = Bout->l0; + + #pragma unroll 6 + for (uint32_t i = 0; i < 6; i++) + { + ulonglong2 p0, p1; + uint2 x = vectorize((vec.x >> 4) & 0x000000FF000000FF); + p0 = __ldg2(&((ulonglong2*)(prevstate + 64 * thread))[x.x]); + madd4long2(vec, p0); + p1 = __ldg2(&((ulonglong2*)(prevstate + 64 * thread + 32))[x.y]); + + + vec ^= p1; + } + Bout->l0 = vec; + vec = Bout->l1; + + #pragma unroll 6 + for (uint32_t i = 0; i < 6; i++){ + ulonglong2 p0, p1; + uint2 x = vectorize((vec.x >> 4) & 0x000000FF000000FF); + p0 = __ldg2(&((ulonglong2*)(prevstate + 64 * thread))[x.x]); + madd4long2(vec, p0); + p1 = __ldg2(&((ulonglong2*)(prevstate + 64 * thread + 32))[x.y]); + + + vec ^= p1; + } + Bout->l1 = vec; + + vec = Bout->l2; + + #pragma unroll 6 + for (uint32_t i = 0; i < 6; i++){ + ulonglong2 p0, p1; + uint2 x = vectorize((vec.x >> 4) & 0x000000FF000000FF); + p0 = __ldg2(&((ulonglong2*)(prevstate + 64 * thread))[x.x]); + madd4long2(vec, p0); + p1 = __ldg2(&((ulonglong2*)(prevstate + 64 * thread + 32))[x.y]); + + + vec ^= p1; + } + Bout->l2 = vec; + vec = Bout->l3; + + #pragma unroll 6 + for (uint32_t i = 0; i < 6; i++){ + ulonglong2 p0, p1; + uint2 x = vectorize((vec.x >> 4) & 0x000000FF000000FF); + p0 = __ldg2(&((ulonglong2*)(prevstate + 64 * thread))[x.x]); + madd4long2(vec, p0); + p1 = __ldg2(&((ulonglong2*)(prevstate + 64 * thread + 32))[x.y]); + + + vec ^= p1; + } + Bout->l3 = vec; + + +} + +__device__ __forceinline__ +static void blockmix_salsa8_small2(uint32 &Bin) +{ + uint16 X = Bin.hi; + X ^= Bin.lo; + X = salsa20_8(X); + Bin.lo = X; + X ^= Bin.hi; + X = salsa20_8(X); + Bin.hi = X; +} + +__device__ __forceinline__ +static void blockmix_pwxform3(int thread, ulonglong2to8 *const __restrict__ Bin,uint32 *const __restrict__ prevstate){ + Bin[0] ^= Bin[15]; + block_pwxform_long(thread, &Bin[0],prevstate); + + for (uint32_t i = 1; i < 16; i++){ + + Bin[i] ^= Bin[i - 1]; + block_pwxform_long(thread, &Bin[i],prevstate); + } + ((uint16*)Bin)[15] = salsa20_8(((uint16*)Bin)[15]); +// Bin[15] = salsa20_8_long(Bin[15]); +} + + +__global__ __launch_bounds__(256, 1) +void yescrypt_gpu_hash_k0(const uint32_t threads,const uint32_t startNonce, uint8* sha256test, uint32* B){ + + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + + const uint32_t nonce = startNonce + thread; + uint16 in[1]; + uint8 state1, state2; + uint8 passwd;// = sha256_80(nonce); + + uint32_t in1[16] = { 0 }; +// uint32_t buf[ 8]; + + ((uint16*)in1)[0] = ((uint16*)c_data)[0]; + + passwd = H256; + + sha256_Transform(in1, ((uint32_t*)&passwd)); + ((uint16*)in1)[0] = padsha80; + in1[0] = c_data[16]; + in1[1] = c_data[17]; + in1[2] = c_data[18]; + in1[3] = nonce; + + sha256_Transform(in1, ((uint32_t*)&passwd)); + + in[0].lo = pad1.lo ^ passwd; + in[0].hi = pad1.hi; + state1 = sha256_Transform2(in, H256); + in[0].lo = pad2.lo ^ passwd; + in[0].hi = pad2.hi; + state2 = sha256_Transform2(in, H256); + in[0] = ((uint16*)c_data)[0]; + ///HMAC_SHA256_update(salt) + state1 = sha256_Transform2(in, state1); + #pragma unroll + for (uint32_t i = 0; i<8; i++) + { + uint32 result; + + in[0].lo = sha256_Transform3(nonce,4*i+1, state1); + in[0].hi = pad4; + result.lo.lo = swapvec(sha256_Transform2(in, state2)); + if (i == 0) (sha256test + thread)[0] = result.lo.lo; + + in[0].lo = sha256_Transform3(nonce,4*i+2, state1); + in[0].hi = pad4; + result.lo.hi = swapvec(sha256_Transform2(in, state2)); + + + in[0].lo = sha256_Transform3(nonce,4*i+3, state1); + in[0].hi = pad4; + result.hi.lo = swapvec(sha256_Transform2(in, state2)); + + in[0].lo = sha256_Transform3(nonce,4*i+4, state1); + in[0].hi = pad4; + result.hi.hi = swapvec(sha256_Transform2(in, state2)); + + + shuffle((B + 8 * thread)[i].lo, result.lo); + shuffle((B + 8 * thread)[i].hi, result.hi); + } + + + } +} + +__global__ __launch_bounds__(32, 1) +void yescrypt_gpu_hash_k1(const uint32_t threads, uint32_t startNonce,uint32* prevstate,uint32* B){ + + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + +// smix1_first(thread); + uint32 X; + +#define Bdev(x) (B+8*thread)[x] +#define state(x) (prevstate+64*thread)[x] + X = Bdev(0); + state(0) = X; + blockmix_salsa8_small2(X); + state(1) = X; + blockmix_salsa8_small2(X); + + + + uint32_t n = 1; + + #pragma unroll + for (uint32_t i = 2; i < 64; i ++) + { + + state(i) = X; + + if ((i&(i - 1)) == 0) n = n << 1; + + uint32_t j = X.hi.s0 & (n - 1); + + j += i - n; + X ^= __ldg32b(&state(j)); + + blockmix_salsa8_small2(X); + } + + Bdev(0) = X; +#undef Bdev +#undef state + + } +} + +__global__ +#if __CUDA_ARCH__ > 500 +__launch_bounds__(128, 1) +#else +__launch_bounds__(16, 1) +#endif +void yescrypt_gpu_hash_k2c(int threads,uint32* prevstate,uint32* B){ + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + + // smix1_second(thread); + ulonglong8to16 X[8]; //,Z; + const uint32_t length = 8; + const uint32_t shift = 8 * 2048 * thread; + +#define Bdev(x) (B+8*thread)[x] + + #pragma unroll 8 + for (uint32_t i = 0; i<8; i++) { + ((uint32*)X)[i] = __ldg32b(&Bdev(i)); + } + + #pragma unroll 8 + for (uint32_t i = 0; i 500 +__launch_bounds__(128, 1) +#else +__launch_bounds__(16, 1) +#endif +void yescrypt_gpu_hash_k2c1(int threads,uint32* prevstate,uint32* B){ + + + const uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); + + if (thread < threads){ + + ulonglong8to16 X[8]; //,Z; + const uint32_t length = 8; + const uint32_t shift = 8 * 2048 * thread; + +#define Bdev(x) (B+8*thread)[x] +#define BigStore(s,i) (state2 + shift + s)[i] + + + #pragma unroll 8 + for (uint32_t i = 0; i<8; i++) { + ((uint32*)X)[i] = __ldg32b(&Bdev(i)); + } + + for (uint32_t z = 0; z < 682; z++){ + + uint32_t j = ((uint32*)X)[7].hi.s0 & 2047; + + #pragma unroll 64 + for (uint32_t k = 0; k < 64; k++) + ((ulonglong2*)X)[k] ^= __ldg2(&((ulonglong2*)(state2 + shift + length * j))[k]); + + #pragma unroll 8 + for (uint32_t k = 0; k> >(threads, startNounce,d_hash2[thr_id],d_hash4[thr_id]); + yescrypt_gpu_hash_k1 << > >(threads, startNounce,d_hash3[thr_id],d_hash4[thr_id]); + yescrypt_gpu_hash_k2c << > >(threads, d_hash3[thr_id],d_hash4[thr_id]); + yescrypt_gpu_hash_k2c1 << > >(threads, d_hash3[thr_id],d_hash4[thr_id]); + yescrypt_gpu_hash_k5 << > >(threads, startNounce, resNonce,d_hash2[thr_id],d_hash4[thr_id]); +} + +__host__ void yescrypt_setBlockTarget(uint32_t* pdata, const void *target){ + + unsigned char PaddedMessage[128]; //bring balance to the force + memcpy(PaddedMessage, pdata, 80); +// memcpy(PaddedMessage+80, 0, 48); + uint32_t pad3[16] = + { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x80000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x000004a0 + }; + pad3[0] = pdata[16]; + pad3[1] = pdata[17]; + pad3[2] = pdata[18]; + + cudaMemcpyToSymbol(shapad, pad3, 16 * sizeof(uint32_t), 0, cudaMemcpyHostToDevice); + CUDA_SAFE_CALL(cudaMemcpyToSymbol(pTarget, target, 8 * sizeof(uint32_t), 0, cudaMemcpyHostToDevice)); + CUDA_SAFE_CALL(cudaMemcpyToSymbol(c_data, PaddedMessage, 32 * sizeof(uint32_t), 0, cudaMemcpyHostToDevice)); +} diff --git a/yescrypt/yescrypt.cu b/yescrypt/yescrypt.cu new file mode 100644 index 0000000..57f8714 --- /dev/null +++ b/yescrypt/yescrypt.cu @@ -0,0 +1,118 @@ + +extern "C" +{ +#include "sph/yescrypt.h" +} + +#include "cuda_helper.h" +#include "miner.h" + +#define NBN 2 + +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +extern void yescrypt_setBlockTarget(uint32_t * data, const void *ptarget); +extern void yescrypt_cpu_init(int thr_id, int threads); +extern void yescrypt_free(int thr_id); +extern void yescrypt_cpu_hash_k4(int thr_id, int threads, uint32_t startNounce, uint32_t* resNonce); + + +static bool init[MAX_GPUS] = { 0 }; + +int scanhash_yescrypt(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done){ + + int dev_id = device_map[thr_id]; + + uint32_t _ALIGN(64) endiandata[20]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + + if (opt_benchmark) + ((uint32_t*)ptarget)[7] = 0x0000ff; + + int coef = 16; + if (device_sm[device_map[thr_id]] == 500) coef = 6; + if (device_sm[device_map[thr_id]] == 350) coef = 2; + + const int throughput = 64*coef; + + if (!init[thr_id]) + { + cudaSetDevice(device_map[thr_id]); + if (opt_cudaschedule == -1 && gpu_threads == 1) { + cudaDeviceReset(); + // reduce cpu usage + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + } + gpulog(LOG_INFO,thr_id, "Intensity set to %g, %u cuda threads", throughput2intensity(throughput), throughput); + + yescrypt_cpu_init(thr_id, throughput); + + cudaMalloc(&d_resNonce[thr_id], NBN * sizeof(uint32_t)); + cudaMallocHost(&h_resNonce[thr_id], NBN * sizeof(uint32_t)); + + init[thr_id] = true; + } + + for (int k = 0; k < 20; k++) + be32enc(&endiandata[k], ((uint32_t*)pdata)[k]); + + yescrypt_setBlockTarget(pdata,ptarget); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + int rc = 0; + do { + yescrypt_cpu_hash_k4(thr_id, throughput, pdata[19], d_resNonce[thr_id]); + cudaMemcpy(h_resNonce[thr_id], d_resNonce[thr_id], NBN*sizeof(uint32_t), cudaMemcpyDeviceToHost); + if(h_resNonce[thr_id][0] != UINT32_MAX){ + uint32_t vhash64[8]; + be32enc(&endiandata[19], h_resNonce[thr_id][0]); + yescrypt_hash((uchar*) endiandata, (uchar*)vhash64); + + if ( (vhash64[7] <= ptarget[7]) && fulltest(vhash64, ptarget)) { + *hashes_done = pdata[19] - first_nonce + throughput; + pdata[19] = h_resNonce[thr_id][0]; + rc = 1; + + if(h_resNonce[thr_id][1] != UINT32_MAX){ +// if(!opt_quiet) +// gpulog(LOG_BLUE,dev_id,"Found 2nd nonce: %08x", h_resNonce[thr_id][1]); + endiandata[19] = h_resNonce[thr_id][1]; + yescrypt_hash((uchar*)endiandata, (uchar*)vhash64); + pdata[21] = h_resNonce[thr_id][1]; + if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio){ + work_set_target_ratio(work, vhash64); + xchg(pdata[19],pdata[21]); + } + rc = 2; + } + return rc; + } else { + gpulog(LOG_INFO,dev_id, "Result for nonce $%08X does not validate on CPU!", h_resNonce[thr_id]); + cudaMemset(d_resNonce[thr_id], 0xff, NBN*sizeof(uint32_t)); + } + } + pdata[19] += throughput; + }while(!work_restart[thr_id].restart && ((uint64_t)max_nonce > ((uint64_t)(pdata[19]) + (uint64_t)throughput))); + *hashes_done = pdata[19] - first_nonce + 1; + return rc; +} + +// cleanup +void free_yescrypt(int thr_id) +{ + if (!init[thr_id]) + return; + + cudaDeviceSynchronize(); + + cudaFreeHost(h_resNonce[thr_id]); + cudaFree(d_resNonce[thr_id]); + + yescrypt_free(thr_id); + init[thr_id] = false; + + cudaDeviceSynchronize(); +}